instar 1.3.514 → 1.3.515

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.
Files changed (48) hide show
  1. package/dist/commands/server.d.ts.map +1 -1
  2. package/dist/commands/server.js +172 -2
  3. package/dist/commands/server.js.map +1 -1
  4. package/dist/config/ConfigDefaults.d.ts.map +1 -1
  5. package/dist/config/ConfigDefaults.js +11 -0
  6. package/dist/config/ConfigDefaults.js.map +1 -1
  7. package/dist/core/MeshRpc.d.ts +6 -0
  8. package/dist/core/MeshRpc.d.ts.map +1 -1
  9. package/dist/core/MeshRpc.js +8 -0
  10. package/dist/core/MeshRpc.js.map +1 -1
  11. package/dist/core/PoolLinkAssertion.d.ts +164 -0
  12. package/dist/core/PoolLinkAssertion.d.ts.map +1 -0
  13. package/dist/core/PoolLinkAssertion.js +184 -0
  14. package/dist/core/PoolLinkAssertion.js.map +1 -0
  15. package/dist/core/PoolLinkJtiStore.d.ts +48 -0
  16. package/dist/core/PoolLinkJtiStore.d.ts.map +1 -0
  17. package/dist/core/PoolLinkJtiStore.js +149 -0
  18. package/dist/core/PoolLinkJtiStore.js.map +1 -0
  19. package/dist/core/PoolViewProxy.d.ts +168 -0
  20. package/dist/core/PoolViewProxy.d.ts.map +1 -0
  21. package/dist/core/PoolViewProxy.js +208 -0
  22. package/dist/core/PoolViewProxy.js.map +1 -0
  23. package/dist/core/PostUpdateMigrator.d.ts +19 -0
  24. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  25. package/dist/core/PostUpdateMigrator.js +84 -0
  26. package/dist/core/PostUpdateMigrator.js.map +1 -1
  27. package/dist/core/devGatedFeatures.d.ts.map +1 -1
  28. package/dist/core/devGatedFeatures.js +6 -0
  29. package/dist/core/devGatedFeatures.js.map +1 -1
  30. package/dist/core/types.d.ts +45 -0
  31. package/dist/core/types.d.ts.map +1 -1
  32. package/dist/core/types.js.map +1 -1
  33. package/dist/scaffold/templates.d.ts.map +1 -1
  34. package/dist/scaffold/templates.js +6 -0
  35. package/dist/scaffold/templates.js.map +1 -1
  36. package/dist/server/AgentServer.d.ts +3 -0
  37. package/dist/server/AgentServer.d.ts.map +1 -1
  38. package/dist/server/AgentServer.js +3 -0
  39. package/dist/server/AgentServer.js.map +1 -1
  40. package/dist/server/routes.d.ts +38 -0
  41. package/dist/server/routes.d.ts.map +1 -1
  42. package/dist/server/routes.js +109 -1
  43. package/dist/server/routes.js.map +1 -1
  44. package/package.json +1 -1
  45. package/src/data/builtin-manifest.json +64 -64
  46. package/src/scaffold/templates.ts +6 -0
  47. package/upgrades/1.3.515.md +64 -0
  48. package/upgrades/side-effects/multi-machine-seamlessness-ws44-pool-links.md +146 -0
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgCH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAS3D,OAAO,EAAE,eAAe,EAAiC,MAAM,iCAAiC,CAAC;AAuBjG,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AA0G7D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAsBtD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC1C,OAAO,CAUT;AAyID,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA80CD,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,cAAc,EAAE,cAAc,EAC9B,YAAY,CAAC,EAAE,YAAY,EAC3B,WAAW,CAAC,EAAE,WAAW,EACzB,WAAW,CAAC,EAAE,WAAW,EACzB,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,EAGvE,UAAU,CAAC,EAAE,MAAM,OAAO,8BAA8B,EAAE,WAAW,GAAG,IAAI,EAK5E,qBAAqB,CAAC,EAAE,MAAM,OAAO,gCAAgC,EAAE,kBAAkB,GAAG,IAAI,EAKhG,mBAAmB,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,GACpD,IAAI,CA8eN;AA2lBD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAm8YtE;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"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgCH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAS3D,OAAO,EAAE,eAAe,EAAiC,MAAM,iCAAiC,CAAC;AAuBjG,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AA0G7D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAsBtD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC1C,OAAO,CAUT;AAyID,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAm1CD,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,cAAc,EAAE,cAAc,EAC9B,YAAY,CAAC,EAAE,YAAY,EAC3B,WAAW,CAAC,EAAE,WAAW,EACzB,WAAW,CAAC,EAAE,WAAW,EACzB,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,EAGvE,UAAU,CAAC,EAAE,MAAM,OAAO,8BAA8B,EAAE,WAAW,GAAG,IAAI,EAK5E,qBAAqB,CAAC,EAAE,MAAM,OAAO,gCAAgC,EAAE,kBAAkB,GAAG,IAAI,EAKhG,mBAAmB,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,GACpD,IAAI,CA8eN;AA2lBD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAymZtE;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"}
@@ -417,6 +417,11 @@ let _streamTicketStore = null;
417
417
  * links to peers (mint a ticket via the mesh verb, then connect). Injected into
418
418
  * the WebSocketManager so a remote-session subscribe streams from its owner. */
419
419
  let _poolStreamConnector = null;
420
+ /** WS4.4 "links that survive machine boundaries" (MULTI-MACHINE-SEAMLESSNESS-SPEC
421
+ * §WS4.4): the fronting-proxy + holder verification handle attached to the routes
422
+ * ctx. Constructed in the mesh-setup block (needs meshSelfId + identity manager);
423
+ * null on single-machine or when the dark flag is off. */
424
+ let _poolLink = null;
420
425
  /** 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). */
421
426
  let _tryNicknameRelocation = null;
422
427
  /** Per-topic framework override (claude-code | codex-cli). Populated from
@@ -12022,7 +12027,7 @@ export async function startServer(options) {
12022
12027
  // WS1.1 capability advertisement (spec invariant 5): a bounded
12023
12028
  // fixed-size summary, never an inventory. Reported live each
12024
12029
  // heartbeat so a queue going dark withdraws the capability.
12025
- seamlessnessFlags: { ws11DeliverReceive: !!_inboundQueue, ws12DrainReceive: !!_drainRunner },
12030
+ seamlessnessFlags: { ws11DeliverReceive: !!_inboundQueue, ws12DrainReceive: !!_drainRunner, ws44PoolLinks: !!_poolLink },
12026
12031
  // Durable Inbound Message Queue §5.1: depth + oldest + tenure +
12027
12032
  // bounded top-K — the survivor's loss-SUSPECTED item, capped
12028
12033
  // re-placement arm, and supersede-dedupe key all read these.
@@ -12097,6 +12102,107 @@ export async function startServer(options) {
12097
12102
  logger: (m) => console.log(pc.dim(` ${m}`)),
12098
12103
  });
12099
12104
  }
12105
+ // WS4.4 "links that survive machine boundaries"
12106
+ // (MULTI-MACHINE-SEAMLESSNESS-SPEC §WS4.4). Ships DARK behind
12107
+ // multiMachine.seamlessness.ws44PoolLinks (dev-agent gated). When on, the
12108
+ // tunnel-fronting machine can resolve the holder of a /view/:id it does
12109
+ // NOT hold and proxy to it carrying a short-lived, audience-bound,
12110
+ // single-use, mesh-signed user-auth assertion (never the raw PIN). The
12111
+ // holder verifies the assertion + applies its own per-view authz.
12112
+ let _ws44PoolViewProxy = null;
12113
+ let _ws44JtiStore = null;
12114
+ {
12115
+ const ws44Cfg = config.multiMachine?.seamlessness;
12116
+ const ws44Enabled = resolveDevAgentGate(ws44Cfg?.ws44PoolLinks, config);
12117
+ if (ws44Enabled) {
12118
+ try {
12119
+ const plaMod = await import('../core/PoolLinkAssertion.js');
12120
+ const jtiMod = await import('../core/PoolLinkJtiStore.js');
12121
+ const proxyMod = await import('../core/PoolViewProxy.js');
12122
+ const cryptoMod = await import('node:crypto');
12123
+ const clientMod = await import('../core/MeshRpcClient.js');
12124
+ _ws44JtiStore = new jtiMod.PoolLinkJtiStore({
12125
+ filePath: path.join(config.stateDir, 'state', 'pool-link-jtis.json'),
12126
+ now: () => Date.now(),
12127
+ logger: (m) => console.log(pc.dim(` ${m}`)),
12128
+ });
12129
+ // Probe + fetch use a dedicated MeshRpcClient (its own nonce lane).
12130
+ let ws44Nonce = 0;
12131
+ const ws44Client = new clientMod.MeshRpcClient({
12132
+ selfMachineId: meshSelfId,
12133
+ sign: (c) => idMod.sign(c, localSigningKeyPem),
12134
+ nonce: () => `${meshSelfId}:pv:${Date.now()}:${++ws44Nonce}`,
12135
+ });
12136
+ _ws44PoolViewProxy = new proxyMod.PoolViewProxy({
12137
+ selfMachineId: meshSelfId,
12138
+ heldLocally: (viewId) => viewer.get(viewId) != null,
12139
+ listPeers: () => meshIdMgr
12140
+ .getActiveMachines()
12141
+ .filter((m) => m.machineId !== meshSelfId && !!m.entry.lastKnownUrl)
12142
+ .map((m) => ({
12143
+ machineId: m.machineId,
12144
+ url: m.entry.lastKnownUrl,
12145
+ online: machinePoolRegistry?.getCapacity(m.machineId)?.online,
12146
+ })),
12147
+ probePeer: async (peer, viewId) => {
12148
+ const res = await ws44Client.send({ machineId: peer.machineId, url: peer.url }, { type: 'pool-view-fetch', viewId, method: 'GET', probeOnly: true }, 0, { timeoutMs: 4000 });
12149
+ if (!res.ok)
12150
+ return 'unreachable';
12151
+ const r = (res.result ?? {});
12152
+ return r.present === true ? 'present' : 'absent';
12153
+ },
12154
+ now: () => Date.now(),
12155
+ // §WS4.4 (f) load-shed posture: over this 1-min load-per-core
12156
+ // threshold, holder resolution serves the last-cached result with
12157
+ // a staleness tag instead of re-fanning-out. Cores clamped to ≥1.
12158
+ cpuLoadPerCore: () => os.loadavg()[0] / Math.max(1, os.cpus().length),
12159
+ loadShedLoadPerCore: ws44Cfg?.ws44LoadShedLoadPerCore,
12160
+ logger: (m) => console.log(pc.dim(` ${m}`)),
12161
+ });
12162
+ // The fronting → holder fetch + assertion mint, attached to ctx.
12163
+ const mintJti = () => cryptoMod.randomBytes(24).toString('hex');
12164
+ _poolLink = {
12165
+ selfFingerprint: meshSelfId,
12166
+ proxy: _ws44PoolViewProxy,
12167
+ jtiStore: _ws44JtiStore,
12168
+ mintAssertion: (audience, userAuth) => plaMod.mintPoolLinkAssertion(audience, userAuth, {
12169
+ selfFingerprint: meshSelfId,
12170
+ sign: (c) => idMod.sign(c, localSigningKeyPem),
12171
+ mintJti,
12172
+ now: () => Date.now(),
12173
+ }),
12174
+ resolveIssuerPublicKeyPem: (iss) => meshIdMgr.getSigningPublicKeyPem(iss),
12175
+ verify: (canonical, signature, pem) => {
12176
+ try {
12177
+ return idMod.verify(canonical, signature, pem);
12178
+ }
12179
+ catch {
12180
+ return false;
12181
+ }
12182
+ },
12183
+ fetchFromHolder: async (holder, viewId, method, assertion) => {
12184
+ const res = await ws44Client.send({ machineId: holder.machineId, url: holder.url }, { type: 'pool-view-fetch', viewId, method, assertion }, 0, { timeoutMs: 8000 });
12185
+ if (!res.ok) {
12186
+ // A mesh-level rejection (verify/RBAC/freshness) maps to its
12187
+ // status; treat anything but 200 as a holder verdict to relay.
12188
+ return { status: res.status ?? 502, contentType: 'application/json; charset=utf-8', body: Buffer.from(JSON.stringify({ error: res.reason ?? 'holder unreachable' })) };
12189
+ }
12190
+ const r = (res.result ?? {});
12191
+ return {
12192
+ status: typeof r.status === 'number' ? r.status : 200,
12193
+ contentType: r.contentType ?? null,
12194
+ body: Buffer.from(r.bodyBase64 ?? '', 'base64'),
12195
+ };
12196
+ },
12197
+ };
12198
+ console.log(pc.green(' WS4.4 pool-links enabled (fronting proxy + holder verification)'));
12199
+ }
12200
+ catch (err) {
12201
+ // @silent-fallback-ok — WS4.4 stays null; /view/:id behaves local-only (today's behavior). Logged with context.
12202
+ console.log(pc.dim(` [ws44-pool-links] not wired: ${err instanceof Error ? err.message : String(err)}`));
12203
+ }
12204
+ }
12205
+ }
12100
12206
  const seenMeshNonces = new Map(); // `${sender}:${nonce}` → ts, age-pruned
12101
12207
  const meshPruneMs = Math.max(meshClockToleranceMs * 4, 120_000);
12102
12208
  // SessionOwnership registry (§L3) — in-memory store (single-machine correct;
@@ -12733,6 +12839,70 @@ export async function startServer(options) {
12733
12839
  'secret-share': (cmd, sender) => _secretShareHandler
12734
12840
  ? _secretShareHandler.handle(cmd, sender)
12735
12841
  : { ok: false, reason: 'secret-sync disabled' },
12842
+ // WS4.4 holder side (MULTI-MACHINE-SEAMLESSNESS-SPEC §WS4.4). The
12843
+ // verifyEnvelope gate already proved WHICH fronting machine is asking
12844
+ // (`sender` = the authenticated, registered peer — used as the
12845
+ // EXPECTED assertion issuer). Two shapes:
12846
+ // • probeOnly → disclose ONLY whether we hold the view (never the
12847
+ // body) so the fronting machine can resolve the holder by fan-out.
12848
+ // • assertion → verify the audience-bound, single-use, signed
12849
+ // user-auth assertion AND apply our OWN per-view authorization,
12850
+ // then serve the rendered body. The fronting machine is a dumb
12851
+ // relay; THIS holder makes the authorization decision.
12852
+ 'pool-view-fetch': async (cmd, sender) => {
12853
+ const c = cmd;
12854
+ if (typeof c.viewId !== 'string' || !c.viewId)
12855
+ return { ok: false, reason: 'viewId required' };
12856
+ const view = viewer.get(c.viewId);
12857
+ // Probe: existence only. A registered same-operator peer learns
12858
+ // whether we hold it — never the content (no body without an
12859
+ // assertion). Absent → present:false (every non-holder answers this).
12860
+ if (c.probeOnly === true) {
12861
+ return { present: view != null };
12862
+ }
12863
+ if (!_poolLink || !_ws44JtiStore)
12864
+ return { ok: false, reason: 'ws44 disabled' };
12865
+ if (!view)
12866
+ return { status: 404, contentType: 'application/json; charset=utf-8', bodyBase64: Buffer.from(JSON.stringify({ error: 'View not found' })).toString('base64') };
12867
+ const plaMod = await import('../core/PoolLinkAssertion.js');
12868
+ const assertion = c.assertion;
12869
+ const verdict = plaMod.verifyPoolLinkAssertion(assertion, { viewId: c.viewId, method: typeof c.method === 'string' ? c.method : 'GET' }, {
12870
+ selfFingerprint: meshSelfId,
12871
+ // The mesh transport authenticated `sender` independently —
12872
+ // the assertion's claimed issuer MUST equal it (a captured
12873
+ // assertion cannot be replayed by a different machine).
12874
+ expectedIssuer: sender,
12875
+ resolveIssuerPublicKeyPem: (iss) => meshIdMgr.getSigningPublicKeyPem(iss),
12876
+ verify: (canonical, signature, pem) => {
12877
+ try {
12878
+ return idMod.verify(canonical, signature, pem);
12879
+ }
12880
+ catch {
12881
+ return false;
12882
+ }
12883
+ },
12884
+ seenJti: (jti) => _ws44JtiStore.seen(jti),
12885
+ now: () => Date.now(),
12886
+ });
12887
+ if (!verdict.ok) {
12888
+ console.log(pc.dim(` [ws44-pool-links] holder rejected assertion from ${sender}: ${verdict.reason}`));
12889
+ return { status: plaMod.statusForPoolLinkReason(verdict.reason), contentType: 'application/json; charset=utf-8', bodyBase64: Buffer.from(JSON.stringify({ error: `assertion rejected: ${verdict.reason}` })).toString('base64') };
12890
+ }
12891
+ // Single-use: record the jti AFTER a fully-accepted assertion so a
12892
+ // rejected one never burns it; a replay within the window is then
12893
+ // caught by seenJti above.
12894
+ _ws44JtiStore.record(assertion.jti, assertion.exp);
12895
+ // HOLDER authorization decision (spec §WS4.4 b): a PIN-protected
12896
+ // view is NOT served through the cross-machine assertion path —
12897
+ // the assertion attests edge user-auth, not the per-view PIN, so a
12898
+ // pin-gated view returns the holder's PIN page UNCHANGED for the
12899
+ // fronting machine to relay (the holder owns the decision).
12900
+ if (view.pinHash) {
12901
+ return { status: 200, contentType: 'text/html; charset=utf-8', bodyBase64: Buffer.from(viewer.renderPinPage(view)).toString('base64') };
12902
+ }
12903
+ const html = viewer.renderHtml(view);
12904
+ return { status: 200, contentType: 'text/html; charset=utf-8', bodyBase64: Buffer.from(html).toString('base64') };
12905
+ },
12736
12906
  },
12737
12907
  logger: (m) => console.log(pc.dim(` ${m}`)),
12738
12908
  });
@@ -14169,7 +14339,7 @@ export async function startServer(options) {
14169
14339
  carrier: _topicProfileCarrier,
14170
14340
  }
14171
14341
  : null;
14172
- 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, cartographer: cartographer ?? undefined, coherenceGate: scopeVerifier, contextHierarchy, canonicalState, operationGate, sentinel, adaptiveTrust, memoryMonitor, orphanReaper, coherenceMonitor, commitmentTracker, subscriptionPool, quotaPoller, quotaAwareScheduler: _quotaAwareScheduler ?? undefined, proactiveSwapMonitor: _proactiveSwapMonitor ?? undefined, inUseAccountResolver, enrollmentWizard, semanticMemory, activitySentinel, rateLimitSentinel, releaseReadinessSentinel: releaseReadinessSentinel ?? undefined, greenPrAutoMerger: greenPrAutoMerger ?? undefined, guardLatchStore: guardLatchStore ?? undefined, messageRouter, summarySentinel, spawnManager, systemReviewer, capabilityMapper, selfKnowledgeTree, coverageAuditor, topicResumeMap: _topicResumeMap ?? undefined, topicProfile: _topicProfileCtx ?? 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, getInboundQueue: () => _inboundQueue, meshRpcDispatcher, workingSetPullCoordinator, commitmentReplicaStore, preferenceReplicaStore, 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, guardRegistry, listPoolMachines: _listPoolMachines ?? 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, resumeQueue, resumeDrainer, operatorStopRecorder: recordOperatorStop, sleepWakeDetector, unjustifiedStopGate, stopGateDb, stopNotifier });
14342
+ 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, cartographer: cartographer ?? undefined, coherenceGate: scopeVerifier, contextHierarchy, canonicalState, operationGate, sentinel, adaptiveTrust, memoryMonitor, orphanReaper, coherenceMonitor, commitmentTracker, subscriptionPool, quotaPoller, quotaAwareScheduler: _quotaAwareScheduler ?? undefined, proactiveSwapMonitor: _proactiveSwapMonitor ?? undefined, inUseAccountResolver, enrollmentWizard, semanticMemory, activitySentinel, rateLimitSentinel, releaseReadinessSentinel: releaseReadinessSentinel ?? undefined, greenPrAutoMerger: greenPrAutoMerger ?? undefined, guardLatchStore: guardLatchStore ?? undefined, messageRouter, summarySentinel, spawnManager, systemReviewer, capabilityMapper, selfKnowledgeTree, coverageAuditor, topicResumeMap: _topicResumeMap ?? undefined, topicProfile: _topicProfileCtx ?? 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, getInboundQueue: () => _inboundQueue, meshRpcDispatcher, workingSetPullCoordinator, commitmentReplicaStore, preferenceReplicaStore, 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, guardRegistry, listPoolMachines: _listPoolMachines ?? undefined, poolLink: _poolLink ?? 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, resumeQueue, resumeDrainer, operatorStopRecorder: recordOperatorStop, sleepWakeDetector, unjustifiedStopGate, stopGateDb, stopNotifier });
14173
14343
  // Resolve the late-bound topic-operator getter (increment 2e): routing was
14174
14344
  // wired before the server existed; from here on inbound binds use the
14175
14345
  // server's own store instance.