instar 1.3.1330 → 1.3.1331

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 (61) hide show
  1. package/dist/commands/server.d.ts.map +1 -1
  2. package/dist/commands/server.js +97 -1
  3. package/dist/commands/server.js.map +1 -1
  4. package/dist/core/MeshRpc.d.ts +17 -0
  5. package/dist/core/MeshRpc.d.ts.map +1 -1
  6. package/dist/core/MeshRpc.js +7 -0
  7. package/dist/core/MeshRpc.js.map +1 -1
  8. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  9. package/dist/core/PostUpdateMigrator.js +15 -0
  10. package/dist/core/PostUpdateMigrator.js.map +1 -1
  11. package/dist/core/devGatedFeatures.d.ts.map +1 -1
  12. package/dist/core/devGatedFeatures.js +6 -0
  13. package/dist/core/devGatedFeatures.js.map +1 -1
  14. package/dist/core/types.d.ts +9 -0
  15. package/dist/core/types.d.ts.map +1 -1
  16. package/dist/core/types.js.map +1 -1
  17. package/dist/data/standards-guard-index.json +1 -1
  18. package/dist/data/standards-guard-index.meta.json +2 -2
  19. package/dist/data/standards-registry.meta.json +1 -1
  20. package/dist/scaffold/templates.d.ts.map +1 -1
  21. package/dist/scaffold/templates.js +4 -0
  22. package/dist/scaffold/templates.js.map +1 -1
  23. package/dist/server/AgentServer.d.ts +4 -0
  24. package/dist/server/AgentServer.d.ts.map +1 -1
  25. package/dist/server/AgentServer.js +1 -0
  26. package/dist/server/AgentServer.js.map +1 -1
  27. package/dist/server/routes.d.ts +15 -0
  28. package/dist/server/routes.d.ts.map +1 -1
  29. package/dist/server/routes.js +459 -333
  30. package/dist/server/routes.js.map +1 -1
  31. package/dist/threadline/ThreadlineBootstrap.d.ts +9 -0
  32. package/dist/threadline/ThreadlineBootstrap.d.ts.map +1 -1
  33. package/dist/threadline/ThreadlineBootstrap.js +1 -0
  34. package/dist/threadline/ThreadlineBootstrap.js.map +1 -1
  35. package/dist/threadline/ThreadlineMCPServer.d.ts +4 -0
  36. package/dist/threadline/ThreadlineMCPServer.d.ts.map +1 -1
  37. package/dist/threadline/ThreadlineMCPServer.js +25 -0
  38. package/dist/threadline/ThreadlineMCPServer.js.map +1 -1
  39. package/dist/threadline/ThreadlineRouter.d.ts.map +1 -1
  40. package/dist/threadline/ThreadlineRouter.js +1 -0
  41. package/dist/threadline/ThreadlineRouter.js.map +1 -1
  42. package/dist/threadline/TopicLinkageHandler.d.ts +58 -0
  43. package/dist/threadline/TopicLinkageHandler.d.ts.map +1 -1
  44. package/dist/threadline/TopicLinkageHandler.js +193 -5
  45. package/dist/threadline/TopicLinkageHandler.js.map +1 -1
  46. package/dist/threadline/mcp-http-client.d.ts.map +1 -1
  47. package/dist/threadline/mcp-http-client.js +5 -0
  48. package/dist/threadline/mcp-http-client.js.map +1 -1
  49. package/dist/threadline/relayForward.d.ts +252 -0
  50. package/dist/threadline/relayForward.d.ts.map +1 -0
  51. package/dist/threadline/relayForward.js +415 -0
  52. package/dist/threadline/relayForward.js.map +1 -0
  53. package/package.json +1 -1
  54. package/src/data/builtin-manifest.json +64 -64
  55. package/src/data/standards-guard-index.json +1 -1
  56. package/src/data/standards-guard-index.meta.json +2 -2
  57. package/src/data/standards-registry.meta.json +1 -1
  58. package/src/scaffold/templates.ts +4 -0
  59. package/upgrades/1.3.1331.md +34 -0
  60. package/upgrades/a2a-cross-machine-route.eli16.md +17 -0
  61. package/upgrades/side-effects/a2a-cross-machine-route.md +132 -0
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAuGA,OAAO,EAAE,cAAc,EAAwD,MAAM,2BAA2B,CAAC;AAUjH,OAAO,EAAE,eAAe,EAAiC,MAAM,iCAAiC,CAAC;AA4BjG,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAqI7D,OAAO,KAAK,EAAW,oBAAoB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AAU,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,EAQrD,oBAAoB,CAAC,EAAE,MAAM;IAC3B,YAAY,EAAE,OAAO,kBAAkB,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACrE,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;IAC3C,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,GACP,IAAI,CA8yBN;AAgmBD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAu8wBtE;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"}
@@ -974,6 +974,13 @@ let _standDownRegistryRef = () => null;
974
974
  const _handbackSeenTokens = new Set();
975
975
  let _handbackCanary = null;
976
976
  let _handbackSendOffer = null;
977
+ // A2A cross-machine route (docs/specs/a2a-cross-machine-route.md). ONE shared
978
+ // context for the relay-send route and the two mesh handlers. The boot secret
979
+ // lives ONLY here, in memory — never env, config or logs. `forward` and
980
+ // `_a2aAskTopicOwner` are assigned where the MeshRpcClient exists; until then a
981
+ // standby answers today's 503 and a topic-bound reply takes today's path.
982
+ let _a2aRelayForwardCtx = null;
983
+ let _a2aAskTopicOwner = null;
977
984
  let _deliverA2aToMachine = null;
978
985
  // Subscription & Auth Standard P1.3 — quota-aware account-swap scheduler. Null
979
986
  // until wired (requires SessionRefresh + the subscription pool).
@@ -16745,6 +16752,17 @@ export async function startServer(options) {
16745
16752
  // router immediately.
16746
16753
  const { SalienceGate } = await import('../threadline/SalienceGate.js');
16747
16754
  const { TopicLinkageHandler } = await import('../threadline/TopicLinkageHandler.js');
16755
+ // A2A cross-machine route: the shared forward context. The secret is minted
16756
+ // here, once per boot, and held in memory only.
16757
+ const a2aRelayForwardMod = await import('../threadline/relayForward.js');
16758
+ const a2aRelayForwardCtx = {
16759
+ secret: a2aRelayForwardMod.createForwardSecret(),
16760
+ relaySuppressedByStandby: false,
16761
+ forward: null,
16762
+ counters: a2aRelayForwardMod.createRelayForwardCounters(),
16763
+ };
16764
+ _a2aRelayForwardCtx = a2aRelayForwardCtx;
16765
+ const a2aRelayForwardEnabled = () => a2aRelayForwardMod.resolveRelayForwardEnabled(liveConfig.get('threadline.relayForward.enabled', undefined), config);
16748
16766
  const salienceGate = new SalienceGate(); // fallback-only for v1; spec §5.4
16749
16767
  let topicLinkageHandler = null;
16750
16768
  if (commitmentTracker) {
@@ -16782,6 +16800,24 @@ export async function startServer(options) {
16782
16800
  getSessionForTopic: telegram
16783
16801
  ? (topicId) => telegram.getSessionForTopic(topicId)
16784
16802
  : undefined,
16803
+ // A2A cross-machine route §5: a topic-bound reply is typed into the
16804
+ // topic's live session on whichever machine has it. Late-bound: the
16805
+ // mesh client exists only after the multi-machine wiring below.
16806
+ deliverToTopicOwner: (machineId, payload, timeoutMs) => _a2aAskTopicOwner
16807
+ ? _a2aAskTopicOwner(machineId, payload, timeoutMs)
16808
+ : Promise.resolve({ injected: false, definitive: false, reason: 'mesh-not-wired' }),
16809
+ remoteReplyEnabled: () => _a2aAskTopicOwner !== null && a2aRelayForwardEnabled(),
16810
+ selfMachineId: () => _meshSelfId,
16811
+ selfMachineName: () => _listPoolMachines?.().find((m) => m.machineId === _meshSelfId)?.nickname ?? _meshSelfId,
16812
+ topicOwnerOf: (topicId) => sessionOwnershipRegistry?.ownerOf(String(topicId)) ?? null,
16813
+ onRemoteReplyEvent: (event) => {
16814
+ if (event === 'ask')
16815
+ a2aRelayForwardCtx.counters.replyAsks++;
16816
+ else if (event === 'injected')
16817
+ a2aRelayForwardCtx.counters.replyInjected++;
16818
+ else
16819
+ a2aRelayForwardCtx.counters.replyFailureVisible++;
16820
+ },
16785
16821
  });
16786
16822
  threadlineRouter.setTopicLinkageHandler(topicLinkageHandler);
16787
16823
  }
@@ -17098,6 +17134,10 @@ export async function startServer(options) {
17098
17134
  threadlineShutdown = threadline.shutdown;
17099
17135
  threadlineRelayClient = threadline.relayClient;
17100
17136
  threadlineGetLastRelayEvent = threadline.getLastRelayEvent;
17137
+ // A2A cross-machine route §1: the boot-time standby fact, threaded from
17138
+ // the bootstrap to the relay-send route. Never recomputed from live config.
17139
+ if (_a2aRelayForwardCtx)
17140
+ _a2aRelayForwardCtx.relaySuppressedByStandby = threadline.relaySuppressedByStandby === true;
17101
17141
  // Inbound-id ledger §3/§6: daemon-inbox mode is not covered — never advertise there.
17102
17142
  _inboundIdLedgerDaemonDeferred = threadline.daemonHandlingRelay === true;
17103
17143
  // Inbound-id ledger §1: the gate consults the ledger AFTER the operation-
@@ -22525,6 +22565,37 @@ export async function startServer(options) {
22525
22565
  : undefined;
22526
22566
  return { ...base, journalAdvert, ...(commitmentsAdvert ? { commitmentsAdvert } : {}), ...(preferencesAdvert ? { preferencesAdvert } : {}) };
22527
22567
  },
22568
+ // A2A cross-machine route (docs/specs/a2a-cross-machine-route.md).
22569
+ // Both verbs are ALWAYS registered; with the gate off both refuse.
22570
+ // §3 — the holder runs the complete ordinary relay-send route by a
22571
+ // loopback call marked with the boot secret; it refuses when this
22572
+ // machine is itself a relay standby (the loop stop).
22573
+ 'a2a-relay-forward': async (cmd, sender) => {
22574
+ const fwd = _a2aRelayForwardCtx;
22575
+ if (!fwd)
22576
+ return { outcome: 'refused', reason: 'relay-forward-not-wired' };
22577
+ const mod = await import('../threadline/relayForward.js');
22578
+ return mod.handleRelayForwardCommand(cmd, sender, {
22579
+ enabled: () => mod.resolveRelayForwardEnabled(liveConfig.get('threadline.relayForward.enabled', undefined), config),
22580
+ relaySuppressedByStandby: () => fwd.relaySuppressedByStandby,
22581
+ secret: fwd.secret,
22582
+ loopbackUrl: `http://127.0.0.1:${config.port}`,
22583
+ authToken: config.authToken ?? '',
22584
+ counters: fwd.counters,
22585
+ });
22586
+ },
22587
+ // §5 — type a reply into THIS machine's own live session for the
22588
+ // topic (the confirmed paste). Never spawns, never moves the topic.
22589
+ 'a2a-topic-reply-inject': async (cmd) => {
22590
+ const mod = await import('../threadline/relayForward.js');
22591
+ return mod.handleTopicReplyInjectCommand(cmd, {
22592
+ enabled: () => mod.resolveRelayForwardEnabled(liveConfig.get('threadline.relayForward.enabled', undefined), config),
22593
+ getSessionForTopic: (topicId) => telegram?.getSessionForTopic(topicId) ?? null,
22594
+ isSessionAlive: (name) => sessionManager.isSessionAlive(name),
22595
+ inject: (name, text) => sessionManager.injectPasteNotificationConfirmed(name, text),
22596
+ counters: _a2aRelayForwardCtx?.counters,
22597
+ });
22598
+ },
22528
22599
  'a2a-inbox-deliver': async (cmd, sender) => {
22529
22600
  const c = cmd;
22530
22601
  const { handleA2aMeshInbox } = await import('../core/A2aMeshInbox.js');
@@ -23022,6 +23093,31 @@ export async function startServer(options) {
23022
23093
  return 'timeout'; /* @silent-fallback-ok — a transport fault reads as timeout: the holder KEEPS HOLDING (claim-before-release, the safe direction) */
23023
23094
  }
23024
23095
  };
23096
+ // A2A cross-machine route — the SENDING legs over the signed mesh RPC.
23097
+ // §1/§2: a relay standby finds my relay-holding machine and forwards
23098
+ // one send. §5: the holder asks a topic's machine to inject a reply.
23099
+ if (_a2aRelayForwardCtx) {
23100
+ const fwdMod = await import('../threadline/relayForward.js');
23101
+ const { IdentityManager: ThreadlineIdentityManager } = await import('../threadline/client/IdentityManager.js');
23102
+ const holderFinder = new fwdMod.RelayHolderFinder({
23103
+ listPeers: () => meshIdMgr.getActiveMachines()
23104
+ .filter((m) => m.machineId !== meshSelfId)
23105
+ .map((m) => ({ machineId: m.machineId, url: peerUrl(m.machineId) ?? '', nickname: m.entry.nickname }))
23106
+ .filter((p) => p.url !== ''),
23107
+ ownFingerprint: () => new ThreadlineIdentityManager(config.stateDir).get()?.fingerprint ?? null,
23108
+ });
23109
+ const relayForwarder = new fwdMod.RelayForwarder({
23110
+ finder: holderFinder,
23111
+ send: (peer, command, timeoutMs) => meshClient.send({ machineId: peer.machineId, url: peer.url }, command, 0, { timeoutMs }),
23112
+ });
23113
+ _a2aRelayForwardCtx.forward = (command) => relayForwarder.forward(command);
23114
+ _a2aAskTopicOwner = (machineId, payload, timeoutMs) => fwdMod.askTopicOwner(async (id, command, t) => {
23115
+ const url = peerUrl(id);
23116
+ if (!url)
23117
+ return null;
23118
+ return meshClient.send({ machineId: id, url }, command, 0, { timeoutMs: t });
23119
+ }, machineId, payload, timeoutMs);
23120
+ }
23025
23121
  _deliverA2aToMachine = async (input) => {
23026
23122
  const url = peerUrl(input.machineId);
23027
23123
  if (!url)
@@ -26382,7 +26478,7 @@ export async function startServer(options) {
26382
26478
  const server = new AgentServer({ config, singleInstanceLock, terminateSessionAuthority: terminateWithAuthority, subscriptionEmailBinding: credentialLocationLedger, subscriptionEmailBarrier, subscriptionIdentityOracle, sessionManager, llmQueue: sharedLlmQueue, state, scheduler, telegram, telegramOrigin: telegramOriginBoot?.runtime, relationships, feedback, feedbackAnomalyDetector, dispatches, updateChecker, autoUpdater, autoDispatcher, quotaTracker, quotaManager, publisher, viewer, tunnel, evolution, watchdog, topicMemory, triageNurse, projectMapper, cartographerRoots: cartographerRoots ?? undefined, coherenceGate: scopeVerifier, contextHierarchy, canonicalState, operationGate, sentinel, adaptiveTrust, memoryMonitor, orphanReaper, coherenceMonitor, commitmentTracker, subscriptionPool, accountFollowMePeerViews: async () => { const nickById = new Map((_listPoolMachines?.() ?? []).map((m) => [m.machineId, m.nickname ?? m.machineId])); let peers = (_resolvePeerUrls?.() ?? []).map((p) => ({ machineId: p.machineId, nickname: nickById.get(p.machineId) ?? p.machineId, url: p.url })); if (peers.length === 0) {
26383
26479
  peers = (_listPoolMachines?.() ?? []).filter((m) => m.machineId !== _meshSelfId && !!m.lastKnownUrl).map((m) => ({ machineId: m.machineId, nickname: m.nickname ?? m.machineId, url: m.lastKnownUrl }));
26384
26480
  } if (peers.length === 0)
26385
- return []; const { fetchPeerSubscriptionViews } = await import('../core/fetchPeerSubscriptionViews.js'); return fetchPeerSubscriptionViews({ peers: () => peers, fetchImpl: fetch, authToken: config.authToken ?? '' }); }, quotaPoller, quotaAwareScheduler: _quotaAwareScheduler ?? undefined, proactiveSwapMonitor: _proactiveSwapMonitor ?? undefined, inUseAccountResolver, enrollmentWizard, accountFollowMeRevocation, credentialRepointing, 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, meshBindActive: coordinator.managers.identityManager.hasIdentity() && config.multiMachine?.meshTransport?.enabled !== false, localSigningKeyPem, leaseTransport, peerEndpointRecorder, getSelfMeshEndpoints, 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, conversationRegistry, conversationBindAuth, conversationFollowThrough, whatsappBusinessBackend, messageBridge, hookEventReceiver, worktreeMonitor, subagentTracker, instructionsVerifier, handshakeManager: threadlineHandshake, threadlineRouter, conversationStore, threadLog, threadMessageRecorder, warrantsReplyGate, collaborationSurfacer, threadResumeMap, topicLinkageHandler: topicLinkageHandler ?? undefined, threadlineRelayClient, getLastRelayEvent: threadlineGetLastRelayEvent, threadlineReplyWaiters, listenerManager: listenerManager ?? undefined, a2aDeliveryTracker: a2aDeliveryTracker ?? undefined, relayVerdictCounters: threadlineRelayClient ? (() => ({ ...threadlineRelayClient.relayVerdictCounters, expiredMismatchIgnored: a2aDeliveryTracker?.expiredMismatchIgnored ?? 0 })) : undefined, inboundIdLedger: _inboundIdLedger ?? undefined, inboundIdLedgerDaemonDeferred: () => _inboundIdLedgerDaemonDeferred, responseReviewGate, reviewCanaryBattery, messagingToneGate, outboundDedupGate, telemetryHeartbeat, pasteManager, featureRegistry, discoveryEvaluator, completionEvaluator, unifiedTrust, liveConfig, sharedStateLedger, ledgerSessionRegistry, worktreeManager, oidcEnrolledRepos: parallelDevConfig?.oidcEnrolledRepos, initiativeTracker, projectRoundRunner, projectDriftChecker, machineHeartbeat, machinePoolRegistry, ropeHealthMonitor, writeAdmission: writeAdmission ?? undefined, getInboundQueue: () => _inboundQueue, getMachineCoherence: () => _machineCoherenceSentinel, getSingleMachineFailoverGap: () => _singleMachineFailoverGap, getMissingLoginSession: () => _missingLoginSession, getSessionPoolFailoverRunner: () => _sessionPoolFailoverRunnerDriver?.status() ?? null, sessionPoolPromotionActivation: _sessionPoolPromotionActivation, meshRpcDispatcher, deliverA2aToMachine: _deliverA2aToMachine ?? undefined, workingSetPullCoordinator, workingSetArtifactManager, orchestratorPoller, commitmentReplicaStore, preferenceReplicaStore, replicatedRecordEmitter, conflictStore, rollbackUnmerge, droppedOriginRegistry, preferencesUnionReader, jevMemoryPicker, forwardCommitmentMutate, sessionOwnershipRegistry, sendDrain: _sendDrain ?? undefined, topicPinStore: _topicPinStore ?? undefined, topicPinSkewQuarantine: _topicPinSkewQuarantine ?? undefined, topicPinFoldView: _topicPinFoldView ?? undefined, ownershipReconciler: _ownershipReconciler ?? undefined, staleOwnerEngine: _staleOwnerEngine ?? undefined, duplicateReconciler: _duplicateReconciler ?? undefined, ownerDarkLadder: _ownerDarkLadder ?? undefined, spawnAdmission: _spawnAdmission ?? undefined, judgmentProvenance: _judgmentProvenance ?? undefined, leaseHandback: _leaseHandbackCtx ?? 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, deliverMandateToMachine: _deliverMandateToMachine ?? undefined, passkeyRevokeOutbox: _passkeyRevokeOutbox ? () => _passkeyRevokeOutbox : undefined, passkeyPeerOnline: _passkeyPeerOnline, passkeyPoolReader: _passkeyPoolReader ? () => _passkeyPoolReader : undefined, passkeyProofBrowser: async (profileDir) => { const { ChromeCdpReloginBrowser } = await import('../core/ChromeCdpReloginBrowser.js'); return new ChromeCdpReloginBrowser({ userDataDir: profileDir, passkeyMode: true, headless: true, launchTimeoutMs: 30_000, operationTimeoutMs: 20_000 }); }, poolLink: _poolLink ?? undefined, poolPollCache: _poolPollCache ?? undefined, sessionPoolE2EResultStore, proxyCoordinator, topicIntentStore, topicIntentArcCheck, usherSignalStore, intelligence: sharedIntelligence ?? undefined, telegramBridgeConfig, telegramBridge: telegramBridge ?? undefined, threadlineObservability, briefDeps, workingMemory, taskFlowRegistry, threadlineFlowBridge, sessionReaper, agentWorktreeReaper, externalHogSentinel, orphanedWorkSentinel, mcpProcessReaper, geminiLoopRunner, sleepController, agentActivityState, reapLog, resumeQueue, resumeDrainer, autonomousLivenessReconciler, enforcedTerminationStatus: () => enforcedTerminationWatchdog?.guardStatus() ?? null, prHandLease: prHandLease ?? undefined, standDownRegistry: _standDownRegistry ?? undefined, standDownAudit: _standDownAudit ?? undefined, operatorStopRecorder: recordOperatorStop, sleepWakeDetector, unjustifiedStopGate, stopGateDb, stopNotifier, liveTestGate, liveTestGateMode, liveTestRunnerCtx }); // Resolve the late-bound topic-operator getter (increment 2e): routing was
26481
+ return []; const { fetchPeerSubscriptionViews } = await import('../core/fetchPeerSubscriptionViews.js'); return fetchPeerSubscriptionViews({ peers: () => peers, fetchImpl: fetch, authToken: config.authToken ?? '' }); }, quotaPoller, quotaAwareScheduler: _quotaAwareScheduler ?? undefined, proactiveSwapMonitor: _proactiveSwapMonitor ?? undefined, inUseAccountResolver, enrollmentWizard, accountFollowMeRevocation, credentialRepointing, 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, meshBindActive: coordinator.managers.identityManager.hasIdentity() && config.multiMachine?.meshTransport?.enabled !== false, localSigningKeyPem, leaseTransport, peerEndpointRecorder, getSelfMeshEndpoints, 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, conversationRegistry, conversationBindAuth, conversationFollowThrough, whatsappBusinessBackend, messageBridge, hookEventReceiver, worktreeMonitor, subagentTracker, instructionsVerifier, handshakeManager: threadlineHandshake, threadlineRouter, conversationStore, threadLog, threadMessageRecorder, warrantsReplyGate, collaborationSurfacer, threadResumeMap, topicLinkageHandler: topicLinkageHandler ?? undefined, threadlineRelayClient, getLastRelayEvent: threadlineGetLastRelayEvent, a2aRelayForward: _a2aRelayForwardCtx ?? undefined, threadlineReplyWaiters, listenerManager: listenerManager ?? undefined, a2aDeliveryTracker: a2aDeliveryTracker ?? undefined, relayVerdictCounters: threadlineRelayClient ? (() => ({ ...threadlineRelayClient.relayVerdictCounters, expiredMismatchIgnored: a2aDeliveryTracker?.expiredMismatchIgnored ?? 0 })) : undefined, inboundIdLedger: _inboundIdLedger ?? undefined, inboundIdLedgerDaemonDeferred: () => _inboundIdLedgerDaemonDeferred, responseReviewGate, reviewCanaryBattery, messagingToneGate, outboundDedupGate, telemetryHeartbeat, pasteManager, featureRegistry, discoveryEvaluator, completionEvaluator, unifiedTrust, liveConfig, sharedStateLedger, ledgerSessionRegistry, worktreeManager, oidcEnrolledRepos: parallelDevConfig?.oidcEnrolledRepos, initiativeTracker, projectRoundRunner, projectDriftChecker, machineHeartbeat, machinePoolRegistry, ropeHealthMonitor, writeAdmission: writeAdmission ?? undefined, getInboundQueue: () => _inboundQueue, getMachineCoherence: () => _machineCoherenceSentinel, getSingleMachineFailoverGap: () => _singleMachineFailoverGap, getMissingLoginSession: () => _missingLoginSession, getSessionPoolFailoverRunner: () => _sessionPoolFailoverRunnerDriver?.status() ?? null, sessionPoolPromotionActivation: _sessionPoolPromotionActivation, meshRpcDispatcher, deliverA2aToMachine: _deliverA2aToMachine ?? undefined, workingSetPullCoordinator, workingSetArtifactManager, orchestratorPoller, commitmentReplicaStore, preferenceReplicaStore, replicatedRecordEmitter, conflictStore, rollbackUnmerge, droppedOriginRegistry, preferencesUnionReader, jevMemoryPicker, forwardCommitmentMutate, sessionOwnershipRegistry, sendDrain: _sendDrain ?? undefined, topicPinStore: _topicPinStore ?? undefined, topicPinSkewQuarantine: _topicPinSkewQuarantine ?? undefined, topicPinFoldView: _topicPinFoldView ?? undefined, ownershipReconciler: _ownershipReconciler ?? undefined, staleOwnerEngine: _staleOwnerEngine ?? undefined, duplicateReconciler: _duplicateReconciler ?? undefined, ownerDarkLadder: _ownerDarkLadder ?? undefined, spawnAdmission: _spawnAdmission ?? undefined, judgmentProvenance: _judgmentProvenance ?? undefined, leaseHandback: _leaseHandbackCtx ?? 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, deliverMandateToMachine: _deliverMandateToMachine ?? undefined, passkeyRevokeOutbox: _passkeyRevokeOutbox ? () => _passkeyRevokeOutbox : undefined, passkeyPeerOnline: _passkeyPeerOnline, passkeyPoolReader: _passkeyPoolReader ? () => _passkeyPoolReader : undefined, passkeyProofBrowser: async (profileDir) => { const { ChromeCdpReloginBrowser } = await import('../core/ChromeCdpReloginBrowser.js'); return new ChromeCdpReloginBrowser({ userDataDir: profileDir, passkeyMode: true, headless: true, launchTimeoutMs: 30_000, operationTimeoutMs: 20_000 }); }, poolLink: _poolLink ?? undefined, poolPollCache: _poolPollCache ?? undefined, sessionPoolE2EResultStore, proxyCoordinator, topicIntentStore, topicIntentArcCheck, usherSignalStore, intelligence: sharedIntelligence ?? undefined, telegramBridgeConfig, telegramBridge: telegramBridge ?? undefined, threadlineObservability, briefDeps, workingMemory, taskFlowRegistry, threadlineFlowBridge, sessionReaper, agentWorktreeReaper, externalHogSentinel, orphanedWorkSentinel, mcpProcessReaper, geminiLoopRunner, sleepController, agentActivityState, reapLog, resumeQueue, resumeDrainer, autonomousLivenessReconciler, enforcedTerminationStatus: () => enforcedTerminationWatchdog?.guardStatus() ?? null, prHandLease: prHandLease ?? undefined, standDownRegistry: _standDownRegistry ?? undefined, standDownAudit: _standDownAudit ?? undefined, operatorStopRecorder: recordOperatorStop, sleepWakeDetector, unjustifiedStopGate, stopGateDb, stopNotifier, liveTestGate, liveTestGateMode, liveTestRunnerCtx }); // Resolve the late-bound topic-operator getter (increment 2e): routing was
26386
26482
  const readIdentityProjectionPeerRows = async () => {
26387
26483
  const peers = _resolvePeerUrls?.() ?? [];
26388
26484
  const extra = config.multiMachine?.peerUrlAllowlist;