instar 1.3.397 → 1.3.399
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/server.d.ts.map +1 -1
- package/dist/commands/server.js +94 -1
- package/dist/commands/server.js.map +1 -1
- package/dist/core/MeshRpc.d.ts +3 -0
- package/dist/core/MeshRpc.d.ts.map +1 -1
- package/dist/core/MeshRpc.js +1 -0
- package/dist/core/MeshRpc.js.map +1 -1
- package/dist/core/types.d.ts +10 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/server/AgentServer.d.ts +14 -0
- package/dist/server/AgentServer.d.ts.map +1 -1
- package/dist/server/AgentServer.js +12 -0
- package/dist/server/AgentServer.js.map +1 -1
- package/dist/server/StreamTicketStore.d.ts +54 -0
- package/dist/server/StreamTicketStore.d.ts.map +1 -0
- package/dist/server/StreamTicketStore.js +147 -0
- package/dist/server/StreamTicketStore.js.map +1 -0
- package/dist/server/WebSocketManager.d.ts +45 -0
- package/dist/server/WebSocketManager.d.ts.map +1 -1
- package/dist/server/WebSocketManager.js +178 -2
- package/dist/server/WebSocketManager.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +3 -3
- package/src/data/state-coherence-registry.json +13 -1
- package/upgrades/1.3.398.md +30 -0
- package/upgrades/1.3.399.md +34 -0
- package/upgrades/side-effects/dashboard-stream-phase2a-serving.md +69 -0
- package/upgrades/side-effects/dashboard-stream-phase2b-requesting.md +64 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAaH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAQ3D,OAAO,EAAE,eAAe,EAAiC,MAAM,iCAAiC,CAAC;AAuBjG,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,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AAO,CAAC,IAAI,CAAC,CAy5TtE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
|
package/dist/commands/server.js
CHANGED
|
@@ -337,6 +337,14 @@ let _resolvePeerUrls = null;
|
|
|
337
337
|
let _topicPinStore = null;
|
|
338
338
|
/** Cross-machine secret-sync (spec Phase 4): route-facing handle (push lever + read-only status). */
|
|
339
339
|
let _secretSyncHandle = null;
|
|
340
|
+
/** Pool Dashboard Streaming (POOL-DASHBOARD-STREAM-SPEC §2.3): shared single-use
|
|
341
|
+
* ticket store — minted by the `pool-stream-ticket` mesh verb, consumed by the
|
|
342
|
+
* WebSocketManager's /pool-stream upgrade. Constructed in the mesh-setup block. */
|
|
343
|
+
let _streamTicketStore = null;
|
|
344
|
+
/** Pool Dashboard Streaming requesting side (§2.2): opens upstream /pool-stream
|
|
345
|
+
* links to peers (mint a ticket via the mesh verb, then connect). Injected into
|
|
346
|
+
* the WebSocketManager so a remote-session subscribe streams from its owner. */
|
|
347
|
+
let _poolStreamConnector = null;
|
|
340
348
|
/** Recognize + apply a "move/run this on <nickname>" relocation on inbound; returns handled=true when the message WAS a relocation command (so it must not also be dispatched). */
|
|
341
349
|
let _tryNicknameRelocation = null;
|
|
342
350
|
/** Per-topic framework override (claude-code | codex-cli). Populated from
|
|
@@ -9878,6 +9886,20 @@ export async function startServer(options) {
|
|
|
9878
9886
|
?? (meshIdMgr?.hasIdentity() ? meshIdMgr.loadIdentity().machineId : null);
|
|
9879
9887
|
if (meshIdMgr && meshSelfId) {
|
|
9880
9888
|
const meshClockToleranceMs = config.multiMachine?.sessionPool?.meshRpcClockToleranceMs ?? 30000;
|
|
9889
|
+
// Pool Dashboard Streaming (§2.3): the shared single-use ticket store —
|
|
9890
|
+
// the `pool-stream-ticket` verb mints into it; the WS /pool-stream
|
|
9891
|
+
// upgrade consumes from it. Crypto-random tickets; persisted so a
|
|
9892
|
+
// captured ticket can't replay across a restart.
|
|
9893
|
+
{
|
|
9894
|
+
const stsMod = await import('../server/StreamTicketStore.js');
|
|
9895
|
+
const cryptoMod = await import('node:crypto');
|
|
9896
|
+
_streamTicketStore = new stsMod.StreamTicketStore({
|
|
9897
|
+
filePath: path.join(config.stateDir, 'state', 'stream-tickets.json'),
|
|
9898
|
+
now: () => Date.now(),
|
|
9899
|
+
mintId: () => cryptoMod.randomBytes(32).toString('hex'),
|
|
9900
|
+
logger: (m) => console.log(pc.dim(` ${m}`)),
|
|
9901
|
+
});
|
|
9902
|
+
}
|
|
9881
9903
|
const seenMeshNonces = new Map(); // `${sender}:${nonce}` → ts, age-pruned
|
|
9882
9904
|
const meshPruneMs = Math.max(meshClockToleranceMs * 4, 120_000);
|
|
9883
9905
|
// SessionOwnership registry (§L3) — in-memory store (single-machine correct;
|
|
@@ -10127,6 +10149,19 @@ export async function startServer(options) {
|
|
|
10127
10149
|
: undefined;
|
|
10128
10150
|
return { ...base, journalAdvert, ...(commitmentsAdvert ? { commitmentsAdvert } : {}) };
|
|
10129
10151
|
},
|
|
10152
|
+
// Pool Dashboard Streaming (§2.3): mint a single-use bearer ticket
|
|
10153
|
+
// for the authenticated peer so it may open a /pool-stream WS to
|
|
10154
|
+
// watch `session`. verifyEnvelope already proved the peer's identity;
|
|
10155
|
+
// the ticket is bound to that sender and consumed once on upgrade.
|
|
10156
|
+
'pool-stream-ticket': (cmd, sender) => {
|
|
10157
|
+
const c = cmd;
|
|
10158
|
+
if (!_streamTicketStore)
|
|
10159
|
+
return { ok: false, reason: 'pool-stream disabled' };
|
|
10160
|
+
if (!c.session || typeof c.session !== 'string')
|
|
10161
|
+
return { ok: false, reason: 'session required' };
|
|
10162
|
+
const minted = _streamTicketStore.mint(sender);
|
|
10163
|
+
return { ok: true, ticket: minted.ticket, expiresAtMs: minted.expiresAtMs };
|
|
10164
|
+
},
|
|
10130
10165
|
// COHERENCE-JOURNAL-SPEC §3.4 — always-registered journal-sync verb
|
|
10131
10166
|
// (harmless when no peer sends): serve our OWN stream on `request`
|
|
10132
10167
|
// (first-hop only), durably apply an inbound `batch`. The RBAC gate
|
|
@@ -10235,6 +10270,64 @@ export async function startServer(options) {
|
|
|
10235
10270
|
.getActiveMachines()
|
|
10236
10271
|
.filter((m) => m.machineId !== meshSelfId && !!m.entry.lastKnownUrl)
|
|
10237
10272
|
.map((m) => ({ machineId: m.machineId, url: m.entry.lastKnownUrl }));
|
|
10273
|
+
// Pool Dashboard Streaming requesting side (§2.2): build the connector
|
|
10274
|
+
// the WebSocketManager uses to open an upstream /pool-stream to a peer.
|
|
10275
|
+
// connect() is synchronous (PeerStreamProxy contract) but the mint +
|
|
10276
|
+
// ws-open are async — so we return a transport immediately that buffers
|
|
10277
|
+
// sends until the socket opens, mints a single-use ticket over the
|
|
10278
|
+
// machine-authed mesh verb, then connects ws://<peer>/pool-stream?ticket=.
|
|
10279
|
+
// A failure at any step fires onClose (the proxy treats it as a drop →
|
|
10280
|
+
// bounded reconnect → machine-unreachable).
|
|
10281
|
+
{
|
|
10282
|
+
const { WebSocket: WsClient } = await import('ws');
|
|
10283
|
+
_poolStreamConnector = {
|
|
10284
|
+
connect: (machineId, handlers) => {
|
|
10285
|
+
const httpUrl = peerUrl(machineId);
|
|
10286
|
+
if (!httpUrl)
|
|
10287
|
+
return null;
|
|
10288
|
+
let ws = null;
|
|
10289
|
+
let open = false;
|
|
10290
|
+
let closed = false;
|
|
10291
|
+
const pending = [];
|
|
10292
|
+
(async () => {
|
|
10293
|
+
try {
|
|
10294
|
+
const r = await meshClient.send({ machineId, url: httpUrl }, { type: 'pool-stream-ticket', session: '*' }, 0);
|
|
10295
|
+
const ticket = r.ok && r.result && typeof r.result === 'object' ? r.result.ticket : undefined;
|
|
10296
|
+
if (!ticket || closed) {
|
|
10297
|
+
if (!closed)
|
|
10298
|
+
handlers.onClose();
|
|
10299
|
+
return;
|
|
10300
|
+
}
|
|
10301
|
+
const wsUrl = httpUrl.replace(/^http/, 'ws').replace(/\/$/, '') + `/pool-stream?ticket=${encodeURIComponent(ticket)}`;
|
|
10302
|
+
ws = new WsClient(wsUrl);
|
|
10303
|
+
ws.on('open', () => { open = true; for (const m of pending)
|
|
10304
|
+
ws.send(m); pending.length = 0; handlers.onOpen(); });
|
|
10305
|
+
ws.on('message', (d) => { try {
|
|
10306
|
+
handlers.onFrame(JSON.parse(String(d)));
|
|
10307
|
+
}
|
|
10308
|
+
catch { /* @silent-fallback-ok: a non-JSON peer frame is dropped; the stream protocol is JSON-only (§2.2) */ } });
|
|
10309
|
+
ws.on('close', () => handlers.onClose());
|
|
10310
|
+
ws.on('error', () => { if (!open)
|
|
10311
|
+
handlers.onClose(); });
|
|
10312
|
+
}
|
|
10313
|
+
catch {
|
|
10314
|
+
if (!closed)
|
|
10315
|
+
handlers.onClose();
|
|
10316
|
+
}
|
|
10317
|
+
})();
|
|
10318
|
+
return {
|
|
10319
|
+
send: (frame) => { const s = JSON.stringify(frame); if (open && ws)
|
|
10320
|
+
ws.send(s);
|
|
10321
|
+
else
|
|
10322
|
+
pending.push(s); },
|
|
10323
|
+
close: () => { closed = true; try {
|
|
10324
|
+
ws?.close();
|
|
10325
|
+
}
|
|
10326
|
+
catch { /* @silent-fallback-ok: closing an unopened/dead upstream is best-effort (§2.2) */ } },
|
|
10327
|
+
};
|
|
10328
|
+
},
|
|
10329
|
+
};
|
|
10330
|
+
}
|
|
10238
10331
|
// ── Self-nickname convergence (§L4, 2026-06-04 live-caught fix) ──
|
|
10239
10332
|
// `updateNickname` (PATCH /pool/machines) is local-only, so a rename applied on a
|
|
10240
10333
|
// PEER's registry never reaches the owning machine — leaving that machine unable to
|
|
@@ -11121,7 +11214,7 @@ export async function startServer(options) {
|
|
|
11121
11214
|
catch (err) {
|
|
11122
11215
|
console.log(pc.dim(` [session-pool] rollout gate not wired: ${err instanceof Error ? err.message : String(err)}`));
|
|
11123
11216
|
}
|
|
11124
|
-
const server = new AgentServer({ config, sessionManager, state, scheduler, telegram, relationships, feedback, feedbackAnomalyDetector, dispatches, updateChecker, autoUpdater, autoDispatcher, quotaTracker, quotaManager, publisher, viewer, tunnel, evolution, watchdog, topicMemory, triageNurse, projectMapper, coherenceGate: scopeVerifier, contextHierarchy, canonicalState, operationGate, sentinel, adaptiveTrust, memoryMonitor, orphanReaper, coherenceMonitor, commitmentTracker, subscriptionPool, quotaPoller, semanticMemory, activitySentinel, rateLimitSentinel, releaseReadinessSentinel: releaseReadinessSentinel ?? undefined, messageRouter, summarySentinel, spawnManager, systemReviewer, capabilityMapper, selfKnowledgeTree, coverageAuditor, topicResumeMap: _topicResumeMap ?? undefined, sessionRefresh: _sessionRefresh ?? undefined, autonomyManager, trustElevationTracker, autonomousEvolution, coordinator: coordinator.enabled ? coordinator : undefined, localSigningKeyPem, leaseTransport, onLeasePullRequest: () => leaseCoordinatorRef?.currentLease() ?? null, liveTailReceiver, handoffWireTransport, onHandoffBegin, onHandoffInitiate: handoffInitiate, handoffInProgress: handoffSentinelInProgress, messageLedger, currentInboundByTopic, replyMarkerTransport, onReplyMarker: messageLedger ? (marker) => { const m = marker; messageLedger.applyRemoteReplyMarker(m.dedupeKey, { platform: m.platform, replyIdempotencyKey: m.replyIdempotencyKey, epoch: m.epoch, topic: m.topic ?? null }); } : undefined, whatsapp: whatsappAdapter, slack: slackAdapter, imessage: imessageAdapter, whatsappBusinessBackend, messageBridge, hookEventReceiver, worktreeMonitor, subagentTracker, instructionsVerifier, handshakeManager: threadlineHandshake, threadlineRouter, conversationStore, warrantsReplyGate, collaborationSurfacer, threadResumeMap, topicLinkageHandler: topicLinkageHandler ?? undefined, threadlineRelayClient, threadlineReplyWaiters, listenerManager: listenerManager ?? undefined, a2aDeliveryTracker: a2aDeliveryTracker ?? undefined, responseReviewGate, messagingToneGate, outboundDedupGate, telemetryHeartbeat, pasteManager, featureRegistry, discoveryEvaluator, completionEvaluator, unifiedTrust, liveConfig, sharedStateLedger, ledgerSessionRegistry, worktreeManager, oidcEnrolledRepos: parallelDevConfig?.oidcEnrolledRepos, initiativeTracker, projectRoundRunner, projectDriftChecker, machineHeartbeat, machinePoolRegistry, meshRpcDispatcher, workingSetPullCoordinator, commitmentReplicaStore, forwardCommitmentMutate, sessionOwnershipRegistry, topicPinStore: _topicPinStore ?? undefined, secretSync: _secretSyncHandle ?? undefined, meshSelfId: _meshSelfId ?? undefined, resolveRouterUrl: _resolveRouterUrl ?? undefined, resolvePeerUrls: _resolvePeerUrls ?? undefined, sessionPoolE2EResultStore, proxyCoordinator, topicIntentStore, topicIntentArcCheck, usherSignalStore, intelligence: sharedIntelligence ?? undefined, telegramBridgeConfig, telegramBridge: telegramBridge ?? undefined, threadlineObservability, briefDeps, workingMemory, taskFlowRegistry, threadlineFlowBridge, sessionReaper, agentWorktreeReaper, mcpProcessReaper, geminiLoopRunner, sleepController, agentActivityState, reapLog, sleepWakeDetector, unjustifiedStopGate, stopGateDb, stopNotifier });
|
|
11217
|
+
const server = new AgentServer({ config, sessionManager, state, scheduler, telegram, relationships, feedback, feedbackAnomalyDetector, dispatches, updateChecker, autoUpdater, autoDispatcher, quotaTracker, quotaManager, publisher, viewer, tunnel, evolution, watchdog, topicMemory, triageNurse, projectMapper, coherenceGate: scopeVerifier, contextHierarchy, canonicalState, operationGate, sentinel, adaptiveTrust, memoryMonitor, orphanReaper, coherenceMonitor, commitmentTracker, subscriptionPool, quotaPoller, semanticMemory, activitySentinel, rateLimitSentinel, releaseReadinessSentinel: releaseReadinessSentinel ?? undefined, messageRouter, summarySentinel, spawnManager, systemReviewer, capabilityMapper, selfKnowledgeTree, coverageAuditor, topicResumeMap: _topicResumeMap ?? undefined, sessionRefresh: _sessionRefresh ?? undefined, autonomyManager, trustElevationTracker, autonomousEvolution, coordinator: coordinator.enabled ? coordinator : undefined, localSigningKeyPem, leaseTransport, onLeasePullRequest: () => leaseCoordinatorRef?.currentLease() ?? null, liveTailReceiver, handoffWireTransport, onHandoffBegin, onHandoffInitiate: handoffInitiate, handoffInProgress: handoffSentinelInProgress, messageLedger, currentInboundByTopic, replyMarkerTransport, onReplyMarker: messageLedger ? (marker) => { const m = marker; messageLedger.applyRemoteReplyMarker(m.dedupeKey, { platform: m.platform, replyIdempotencyKey: m.replyIdempotencyKey, epoch: m.epoch, topic: m.topic ?? null }); } : undefined, whatsapp: whatsappAdapter, slack: slackAdapter, imessage: imessageAdapter, whatsappBusinessBackend, messageBridge, hookEventReceiver, worktreeMonitor, subagentTracker, instructionsVerifier, handshakeManager: threadlineHandshake, threadlineRouter, conversationStore, warrantsReplyGate, collaborationSurfacer, threadResumeMap, topicLinkageHandler: topicLinkageHandler ?? undefined, threadlineRelayClient, threadlineReplyWaiters, listenerManager: listenerManager ?? undefined, a2aDeliveryTracker: a2aDeliveryTracker ?? undefined, responseReviewGate, messagingToneGate, outboundDedupGate, telemetryHeartbeat, pasteManager, featureRegistry, discoveryEvaluator, completionEvaluator, unifiedTrust, liveConfig, sharedStateLedger, ledgerSessionRegistry, worktreeManager, oidcEnrolledRepos: parallelDevConfig?.oidcEnrolledRepos, initiativeTracker, projectRoundRunner, projectDriftChecker, machineHeartbeat, machinePoolRegistry, meshRpcDispatcher, workingSetPullCoordinator, commitmentReplicaStore, forwardCommitmentMutate, sessionOwnershipRegistry, topicPinStore: _topicPinStore ?? undefined, streamTicketStore: _streamTicketStore ?? undefined, poolStreamAllowRemoteInput: config.dashboard?.poolStream?.allowRemoteInput ?? false, poolStreamConnector: _poolStreamConnector ?? undefined, secretSync: _secretSyncHandle ?? undefined, meshSelfId: _meshSelfId ?? undefined, resolveRouterUrl: _resolveRouterUrl ?? undefined, resolvePeerUrls: _resolvePeerUrls ?? undefined, sessionPoolE2EResultStore, proxyCoordinator, topicIntentStore, topicIntentArcCheck, usherSignalStore, intelligence: sharedIntelligence ?? undefined, telegramBridgeConfig, telegramBridge: telegramBridge ?? undefined, threadlineObservability, briefDeps, workingMemory, taskFlowRegistry, threadlineFlowBridge, sessionReaper, agentWorktreeReaper, mcpProcessReaper, geminiLoopRunner, sleepController, agentActivityState, reapLog, sleepWakeDetector, unjustifiedStopGate, stopGateDb, stopNotifier });
|
|
11125
11218
|
// Resolve the late-bound topic-operator getter (increment 2e): routing was
|
|
11126
11219
|
// wired before the server existed; from here on inbound binds use the
|
|
11127
11220
|
// server's own store instance.
|