Add core.status RPC, RPC invite diagnostics, and WebSocket stats refresh

- core.status handler and coreStatusRequest; diagnoseInviteIssuesAsync
  clears stale failed-invite flags when peers report canProvideInvite
- Admin invite diagnostics and Core stats UI: per-peer remote state,
  text status marks, recommendations aligned with invite.deliver RPC
- Extract stats-collector; push stats/health/status via subscribe-stats
  WebSocket; HTTP only on first Stats tab load
- Document core.status in PLUGIN_SDK; proxy registers onCoreStatus
This commit is contained in:
Raven Scott
2026-05-28 11:35:01 -04:00
parent 1d309aa82d
commit 8854365add
18 changed files with 1243 additions and 665 deletions
+46 -1
View File
@@ -92,11 +92,56 @@ function testNoLegacyAdapterInP2ns() {
function testMethodsIncludeDeliver() {
assert.strictEqual(METHODS.INVITE_DELIVER, 'invite.deliver');
assert.strictEqual(METHODS.CORE_STATUS, 'core.status');
assert.ok(INVITE_STATUS.OK);
}
function testCoreStatusMaster() {
const handlers = createCoreSwarmHandlers({
Autopass: {},
store: {},
core: { writable: true, update: async () => {} },
state: { consecutiveInviteFailures: 0, pendingInviteRequests: new Map() },
isMaster: true,
getDnsPass: () => ({}),
setDnsPass: () => {},
connectedPeers: new Set(['peer1', 'peer2']),
peerChannels: new Map(),
failedInvitePeers: new Set(),
pendingInviteAcks: new Map(),
pendingInviteRequestHandlers: new Set(),
isProcessingInvite: () => false,
acquireInviteLock: async () => {},
releaseInviteLock: () => {},
withTimeout: (p) => p,
getCurrentInvitePromise: () => null,
setCurrentInvitePromise: () => {},
getCurrentPairOperation: () => null,
setCurrentPairOperation: () => {},
setupDomainsWatcher: () => {},
listDomains: async () => [],
doAutoVotes: () => {},
setupListeners: () => {},
coreRpc: {},
channelManager: { getChannelInfo: () => null, waitForBidirectionalOpen: async () => true },
CORE_DOMAIN: 'p2ns.core'
});
return handlers.onCoreStatus().then((status) => {
assert.strictEqual(status.nodeType, 'master');
assert.strictEqual(status.dnsPassInitialized, true);
assert.strictEqual(status.canProvideInvite, true);
assert.strictEqual(status.connectedPeers, 2);
});
}
testInviteAckClearsPending();
testInviteAckIgnoresStaleId();
testNoLegacyAdapterInP2ns();
testMethodsIncludeDeliver();
console.log('core-swarm-handlers.test: ok');
testCoreStatusMaster().then(() => {
console.log('core-swarm-handlers.test: ok');
}).catch((err) => {
console.error(err);
process.exit(1);
});