instar 1.3.1650 → 1.3.1652
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/init.d.ts.map +1 -1
- package/dist/commands/init.js +10 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/install/engine.d.ts +2 -14
- package/dist/commands/install/engine.d.ts.map +1 -1
- package/dist/commands/install/engine.js.map +1 -1
- package/dist/commands/install.d.ts +2 -10
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +15 -147
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/machine.d.ts +2 -0
- package/dist/commands/machine.d.ts.map +1 -1
- package/dist/commands/machine.js +19 -0
- package/dist/commands/machine.js.map +1 -1
- package/dist/commands/server.d.ts.map +1 -1
- package/dist/commands/server.js +373 -14
- package/dist/commands/server.js.map +1 -1
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +3 -0
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/slack-cli.d.ts.map +1 -1
- package/dist/commands/slack-cli.js +2 -1
- package/dist/commands/slack-cli.js.map +1 -1
- package/dist/config/ConfigDefaults.d.ts.map +1 -1
- package/dist/config/ConfigDefaults.js +2 -0
- package/dist/config/ConfigDefaults.js.map +1 -1
- package/dist/core/BackupManager.d.ts.map +1 -1
- package/dist/core/BackupManager.js +1 -0
- package/dist/core/BackupManager.js.map +1 -1
- package/dist/core/CodexLifecycleProductionComposition.d.ts +1 -1
- package/dist/core/CodexLifecycleProductionComposition.d.ts.map +1 -1
- package/dist/core/MachinePoolRegistry.d.ts +8 -0
- package/dist/core/MachinePoolRegistry.d.ts.map +1 -1
- package/dist/core/MachinePoolRegistry.js +25 -2
- package/dist/core/MachinePoolRegistry.js.map +1 -1
- package/dist/core/OverloadShedPlanner.d.ts +63 -7
- package/dist/core/OverloadShedPlanner.d.ts.map +1 -1
- package/dist/core/OverloadShedPlanner.js +169 -39
- package/dist/core/OverloadShedPlanner.js.map +1 -1
- package/dist/core/OwnershipReconciler.d.ts +11 -0
- package/dist/core/OwnershipReconciler.d.ts.map +1 -1
- package/dist/core/OwnershipReconciler.js +27 -9
- package/dist/core/OwnershipReconciler.js.map +1 -1
- package/dist/core/PostUpdateMigrator.d.ts +18 -0
- package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
- package/dist/core/PostUpdateMigrator.js +106 -6
- package/dist/core/PostUpdateMigrator.js.map +1 -1
- package/dist/core/RebalancePlanner.d.ts +1 -0
- package/dist/core/RebalancePlanner.d.ts.map +1 -1
- package/dist/core/RebalancePlanner.js +1 -1
- package/dist/core/RebalancePlanner.js.map +1 -1
- package/dist/core/SessionDrainRunner.d.ts +10 -1
- package/dist/core/SessionDrainRunner.d.ts.map +1 -1
- package/dist/core/SessionDrainRunner.js +60 -3
- package/dist/core/SessionDrainRunner.js.map +1 -1
- package/dist/core/SessionManager.d.ts +53 -0
- package/dist/core/SessionManager.d.ts.map +1 -1
- package/dist/core/SessionManager.js +217 -6
- package/dist/core/SessionManager.js.map +1 -1
- package/dist/core/StageAdvancer.d.ts +19 -0
- package/dist/core/StageAdvancer.d.ts.map +1 -1
- package/dist/core/StageAdvancer.js +51 -1
- package/dist/core/StageAdvancer.js.map +1 -1
- package/dist/core/WriteDomainRegistry.d.ts.map +1 -1
- package/dist/core/WriteDomainRegistry.js +12 -0
- package/dist/core/WriteDomainRegistry.js.map +1 -1
- package/dist/core/appInboundDispatch.d.ts +5 -0
- package/dist/core/appInboundDispatch.d.ts.map +1 -1
- package/dist/core/appInboundDispatch.js +5 -1
- package/dist/core/appInboundDispatch.js.map +1 -1
- package/dist/core/leaseMediumSelection.d.ts +8 -0
- package/dist/core/leaseMediumSelection.d.ts.map +1 -1
- package/dist/core/leaseMediumSelection.js +17 -0
- package/dist/core/leaseMediumSelection.js.map +1 -1
- package/dist/core/memorySandboxProbe.d.ts +19 -0
- package/dist/core/memorySandboxProbe.d.ts.map +1 -0
- package/dist/core/memorySandboxProbe.js +73 -0
- package/dist/core/memorySandboxProbe.js.map +1 -0
- package/dist/core/memorySessionPolicy.d.ts +44 -0
- package/dist/core/memorySessionPolicy.d.ts.map +1 -0
- package/dist/core/memorySessionPolicy.js +122 -0
- package/dist/core/memorySessionPolicy.js.map +1 -0
- package/dist/core/poolReadiness.d.ts +67 -0
- package/dist/core/poolReadiness.d.ts.map +1 -0
- package/dist/core/poolReadiness.js +156 -0
- package/dist/core/poolReadiness.js.map +1 -0
- package/dist/core/quietTopicScanner.d.ts +39 -0
- package/dist/core/quietTopicScanner.d.ts.map +1 -0
- package/dist/core/quietTopicScanner.js +57 -0
- package/dist/core/quietTopicScanner.js.map +1 -0
- package/dist/core/rebalanceProof.d.ts +114 -0
- package/dist/core/rebalanceProof.d.ts.map +1 -0
- package/dist/core/rebalanceProof.js +192 -0
- package/dist/core/rebalanceProof.js.map +1 -0
- package/dist/core/types.d.ts +18 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/data/stageBCertifiedSet.d.ts +12 -0
- package/dist/data/stageBCertifiedSet.d.ts.map +1 -1
- package/dist/data/stageBCertifiedSet.js +16 -0
- package/dist/data/stageBCertifiedSet.js.map +1 -1
- package/dist/data/standards-guard-index.json +1 -1
- package/dist/data/standards-guard-index.meta.json +2 -2
- package/dist/data/standards-registry.meta.json +1 -1
- package/dist/install/doorSteps.d.ts +72 -0
- package/dist/install/doorSteps.d.ts.map +1 -0
- package/dist/install/doorSteps.js +162 -0
- package/dist/install/doorSteps.js.map +1 -0
- package/dist/{commands/install → install}/doors.d.ts +4 -4
- package/dist/install/doors.d.ts.map +1 -0
- package/dist/{commands/install → install}/doors.js +6 -6
- package/dist/install/doors.js.map +1 -0
- package/dist/messaging/SpawnRequestManager.d.ts +2 -0
- package/dist/messaging/SpawnRequestManager.d.ts.map +1 -1
- package/dist/messaging/SpawnRequestManager.js +3 -0
- package/dist/messaging/SpawnRequestManager.js.map +1 -1
- package/dist/messaging/TelegramAdapter.d.ts +20 -0
- package/dist/messaging/TelegramAdapter.d.ts.map +1 -1
- package/dist/messaging/TelegramAdapter.js +69 -7
- package/dist/messaging/TelegramAdapter.js.map +1 -1
- package/dist/messaging/slack/ChannelManager.d.ts +3 -1
- package/dist/messaging/slack/ChannelManager.d.ts.map +1 -1
- package/dist/messaging/slack/ChannelManager.js +5 -2
- package/dist/messaging/slack/ChannelManager.js.map +1 -1
- package/dist/messaging/slack/SlackAdapter.d.ts +14 -0
- package/dist/messaging/slack/SlackAdapter.d.ts.map +1 -1
- package/dist/messaging/slack/SlackAdapter.js +26 -0
- package/dist/messaging/slack/SlackAdapter.js.map +1 -1
- package/dist/monitoring/TriageOrchestrator.d.ts +1 -0
- package/dist/monitoring/TriageOrchestrator.d.ts.map +1 -1
- package/dist/monitoring/TriageOrchestrator.js +5 -0
- package/dist/monitoring/TriageOrchestrator.js.map +1 -1
- package/dist/native/InstarWedgeCanary.app/Contents/MacOS/InstarWedgeCanary +0 -0
- package/dist/native/instar-desktop-host +0 -0
- package/dist/recommended/offerPrerequisites.d.ts +16 -0
- package/dist/recommended/offerPrerequisites.d.ts.map +1 -0
- package/dist/recommended/offerPrerequisites.js +84 -0
- package/dist/recommended/offerPrerequisites.js.map +1 -0
- package/dist/scaffold/templates.d.ts.map +1 -1
- package/dist/scaffold/templates.js +10 -1
- package/dist/scaffold/templates.js.map +1 -1
- package/dist/scheduler/JobScheduler.d.ts +2 -0
- package/dist/scheduler/JobScheduler.d.ts.map +1 -1
- package/dist/scheduler/JobScheduler.js +8 -1
- package/dist/scheduler/JobScheduler.js.map +1 -1
- package/dist/server/AgentServer.d.ts +2 -0
- package/dist/server/AgentServer.d.ts.map +1 -1
- package/dist/server/AgentServer.js +3 -1
- package/dist/server/AgentServer.js.map +1 -1
- package/dist/server/CapabilityIndex.d.ts.map +1 -1
- package/dist/server/CapabilityIndex.js +22 -5
- package/dist/server/CapabilityIndex.js.map +1 -1
- package/dist/server/memorySessionGuard.d.ts +29 -0
- package/dist/server/memorySessionGuard.d.ts.map +1 -0
- package/dist/server/memorySessionGuard.js +57 -0
- package/dist/server/memorySessionGuard.js.map +1 -0
- package/dist/server/middleware.d.ts +8 -1
- package/dist/server/middleware.d.ts.map +1 -1
- package/dist/server/middleware.js +22 -1
- package/dist/server/middleware.js.map +1 -1
- package/dist/server/mobileCapacityRoutes.d.ts +258 -0
- package/dist/server/mobileCapacityRoutes.d.ts.map +1 -0
- package/dist/server/mobileCapacityRoutes.js +710 -0
- package/dist/server/mobileCapacityRoutes.js.map +1 -0
- package/dist/server/mobileConversationRoutes.js +1 -1
- package/dist/server/mobileConversationRoutes.js.map +1 -1
- package/dist/server/mobileOpsRoutes.d.ts +120 -0
- package/dist/server/mobileOpsRoutes.d.ts.map +1 -0
- package/dist/server/mobileOpsRoutes.js +432 -0
- package/dist/server/mobileOpsRoutes.js.map +1 -0
- package/dist/server/mobilePairingRoutes.d.ts.map +1 -1
- package/dist/server/mobilePairingRoutes.js +11 -0
- package/dist/server/mobilePairingRoutes.js.map +1 -1
- package/dist/server/recommendedServiceRoutes.d.ts +1 -0
- package/dist/server/recommendedServiceRoutes.d.ts.map +1 -1
- package/dist/server/recommendedServiceRoutes.js +2 -1
- package/dist/server/recommendedServiceRoutes.js.map +1 -1
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/routes.js +378 -137
- package/dist/server/routes.js.map +1 -1
- package/dist/testing/selfActionRegistry.d.ts.map +1 -1
- package/dist/testing/selfActionRegistry.js +8 -3
- package/dist/testing/selfActionRegistry.js.map +1 -1
- package/dist/threadline/PairingInviteTelegram.d.ts.map +1 -1
- package/dist/threadline/PairingInviteTelegram.js +5 -2
- package/dist/threadline/PairingInviteTelegram.js.map +1 -1
- package/dist/users/MemoryAudience.d.ts +131 -0
- package/dist/users/MemoryAudience.d.ts.map +1 -0
- package/dist/users/MemoryAudience.js +198 -0
- package/dist/users/MemoryAudience.js.map +1 -0
- package/dist/users/MemoryInboundTracker.d.ts +40 -0
- package/dist/users/MemoryInboundTracker.d.ts.map +1 -0
- package/dist/users/MemoryInboundTracker.js +62 -0
- package/dist/users/MemoryInboundTracker.js.map +1 -0
- package/dist/users/MemoryPrivacy.d.ts +132 -0
- package/dist/users/MemoryPrivacy.d.ts.map +1 -0
- package/dist/users/MemoryPrivacy.js +347 -0
- package/dist/users/MemoryPrivacy.js.map +1 -0
- package/dist/users/wireMemoryPrivacy.d.ts +38 -0
- package/dist/users/wireMemoryPrivacy.d.ts.map +1 -0
- package/dist/users/wireMemoryPrivacy.js +94 -0
- package/dist/users/wireMemoryPrivacy.js.map +1 -0
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +68 -68
- package/src/data/feature-ladders.json +1 -1
- package/src/data/stageBCertifiedSet.ts +16 -0
- package/src/data/standards-guard-index.json +1 -1
- package/src/data/standards-guard-index.meta.json +2 -2
- package/src/data/standards-registry.meta.json +1 -1
- package/src/data/state-coherence-registry.json +15 -0
- package/src/scaffold/templates.ts +10 -1
- package/src/templates/scripts/slack-reply.sh +3 -1
- package/upgrades/1.3.1651.md +30 -0
- package/upgrades/1.3.1652.md +74 -0
- package/upgrades/side-effects/memory-privacy-sandbox-setup.md +66 -0
- package/upgrades/side-effects/memory-privacy.md +79 -0
- package/upgrades/side-effects/mobile-native-capacity-screens.md +108 -0
- package/upgrades/side-effects/mobile-native-ops-screens.md +96 -0
- package/upgrades/side-effects/owner-checks-fail-closed.md +57 -0
- package/upgrades/side-effects/recommended-services-prereqs.md +69 -0
- package/upgrades/side-effects/session-pool-default-on.md +53 -0
- package/upgrades/side-effects/session-pool-rebalancing-finish.md +151 -0
- package/dist/commands/install/doors.d.ts.map +0 -1
- package/dist/commands/install/doors.js.map +0 -1
package/dist/commands/server.js
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
* TccProtectedPathGuard block beside the worktree detector).
|
|
5
5
|
*/
|
|
6
6
|
import { configureClaudeChildAuth, sweepClaudeAuthEnvFiles } from '../core/claudeChildAuth.js';
|
|
7
|
+
import { SlackPrincipalResolver } from '../permissions/SlackPrincipalResolver.js';
|
|
8
|
+
import { MEMORY_PRIVACY_UNAVAILABLE_REPLY } from '../users/MemoryInboundTracker.js';
|
|
9
|
+
import { whatsappPersonKey } from '../users/MemoryAudience.js';
|
|
7
10
|
import { slackHistoryLabel } from '../messaging/slack/threadHistoryLabel.js';
|
|
8
11
|
import { readPairingOwnerName } from '../threadline/pairingOwnerName.js';
|
|
9
12
|
import { buildThrowawayJobGuard, checkThrowawayExpiry, describeExpiry, takeLastAutoStartRefusal, throwawayStartupDecision } from '../core/ThrowawayAgentGuard.js';
|
|
@@ -55,7 +58,10 @@ import { setAspClassifierRef, getAspClassifierRef } from '../core/aspClassifierR
|
|
|
55
58
|
import { resolveInboundTelegramMessageId, resolveSignedByAgent, operatorAutoBindPermitted } from '../messaging/shared/signedInbound.js';
|
|
56
59
|
import { verifiedEntityName } from '../messaging/shared/channelIdentity.js';
|
|
57
60
|
import { StandDownRegistry } from '../core/StandDownRegistry.js';
|
|
58
|
-
import { getActiveOverloadShedPlanner } from '../core/OverloadShedPlanner.js';
|
|
61
|
+
import { getActiveOverloadShedPlanner, getMoveAftercare } from '../core/OverloadShedPlanner.js';
|
|
62
|
+
import { QuietTopicScanner } from '../core/quietTopicScanner.js';
|
|
63
|
+
import { RebalanceProofRunner, getActiveRebalanceProof, proofSpawnBrief, setActiveRebalanceProof, setActiveRebalanceProofStore } from '../core/rebalanceProof.js';
|
|
64
|
+
import { rebalanceProofState } from '../core/StageAdvancer.js';
|
|
59
65
|
import { buildHandoffContinuationInstruction } from '../core/handoffContinuation.js';
|
|
60
66
|
import { BASELINE_PROCESS_PATTERNS } from '../core/baselineProcessPatterns.js';
|
|
61
67
|
import { StandDownAudit } from '../core/StandDownAudit.js';
|
|
@@ -233,7 +239,7 @@ import { AutonomousEvolution } from '../core/AutonomousEvolution.js';
|
|
|
233
239
|
import { DispatchScopeEnforcer } from '../core/DispatchScopeEnforcer.js';
|
|
234
240
|
import { TrustRecovery } from '../core/TrustRecovery.js';
|
|
235
241
|
import { DegradationReporter } from '../monitoring/DegradationReporter.js';
|
|
236
|
-
import { reportLeaseMediumSelection, selectLeaseMedium } from '../core/leaseMediumSelection.js';
|
|
242
|
+
import { gitLeaseHasNoRemote, reportLeaseMediumSelection, selectLeaseMedium } from '../core/leaseMediumSelection.js';
|
|
237
243
|
import { HumanAsDetectorLog, observeInboundMessage } from '../monitoring/HumanAsDetectorLog.js';
|
|
238
244
|
import { creditUsherOnMiss } from '../core/UsherActedCorrelator.js';
|
|
239
245
|
import { resolveStableNodeBinary } from '../utils/resolveNodeBinary.js';
|
|
@@ -633,9 +639,18 @@ let _topicProfileCtxRef = null;
|
|
|
633
639
|
// The custody engine (null = feature dark / gate failed / invariants violated —
|
|
634
640
|
// every consumer treats null as "refused → today's fall-through").
|
|
635
641
|
let _inboundQueue = null;
|
|
642
|
+
/** Memory privacy (docs/specs/memory-privacy.md): set in startServer, read at every inbound. */
|
|
643
|
+
let _memoryInbound = null;
|
|
644
|
+
function telegramConfiguredForMemory(config) {
|
|
645
|
+
return (config.messaging ?? []).some((m) => m.type === 'telegram');
|
|
646
|
+
}
|
|
647
|
+
let _memoryTelegramOwner = null;
|
|
648
|
+
let _memoryUserResolver = null;
|
|
636
649
|
// Late-bound self-capacity refresh. The heartbeat writer is constructed before
|
|
637
650
|
// the durable inbound queue, whose live handle is one of the advertised fields.
|
|
638
651
|
let _refreshPoolHeartbeat = () => { };
|
|
652
|
+
/** Boot-cached takeover reading for the pool readiness report; never read from /health. */
|
|
653
|
+
let _takeoverReadiness = { state: 'unknown', reason: 'only a real takeover proves this' };
|
|
639
654
|
// Module-level handle for the machine-coherence guard (machine-coherence-guard
|
|
640
655
|
// §6) so `GET /pool/machine-coherence` can read the sentinel constructed deep in
|
|
641
656
|
// the mesh peer-presence wiring. Null when the guard is dark (route 503s).
|
|
@@ -994,6 +1009,12 @@ let _sessionRefresh = null;
|
|
|
994
1009
|
let _ownershipReconciler = null;
|
|
995
1010
|
/** trustworthy-machine-load D: the overload-shed evaluation timer (cleared at shutdown). */
|
|
996
1011
|
let _overloadShedTimer = null;
|
|
1012
|
+
/** This machine's rebalance proof store (session-pool-rebalancing-finish): built with the rollout gate, read by the shed. */
|
|
1013
|
+
let _rebalanceProofStore = null;
|
|
1014
|
+
let _sessionPoolBuildIdentity = null;
|
|
1015
|
+
let _shedDrainInFlight = false;
|
|
1016
|
+
/** Topics in a shed drain: they journal as `reconcile`, because peers reject an unknown reason. */
|
|
1017
|
+
const _shedDrainTopics = new Set();
|
|
997
1018
|
// U4.2 stale-owner release — the evidence-upgraded Case C engine, hoisted so the
|
|
998
1019
|
// GET /pool/stale-owner-release route + the reconciler dep can reach it. Null
|
|
999
1020
|
// until the pool block constructs it (single-machine / dark → the route 503s).
|
|
@@ -1237,7 +1258,12 @@ spawnOpts) {
|
|
|
1237
1258
|
// of who it's talking to: permissions, preferences, relationship history.
|
|
1238
1259
|
let userContextBlock = '';
|
|
1239
1260
|
if (userProfile && hasUserContext(userProfile)) {
|
|
1240
|
-
|
|
1261
|
+
// Memory privacy: in a shared place the others can ask about what is loaded, so
|
|
1262
|
+
// a person's bio, interests and relationship notes stay out of it.
|
|
1263
|
+
const shared = ['place', 'none'].includes(sessionManager.memoryAudienceKind({ telegramTopicId: topicId }));
|
|
1264
|
+
userContextBlock = shared
|
|
1265
|
+
? `[USER CONTEXT — ${userProfile.name} (${userProfile.id})]\n[SYSTEM-ENFORCED PERMISSIONS: ${userProfile.permissions.join(', ')}]`
|
|
1266
|
+
: formatUserContextForSession(userProfile);
|
|
1241
1267
|
}
|
|
1242
1268
|
// Build the bootstrap message with inline context.
|
|
1243
1269
|
// CRITICAL: Context must be BEFORE the user's message and inline (not a file reference).
|
|
@@ -2313,6 +2339,7 @@ getHubClassifierDeps) {
|
|
|
2313
2339
|
// entry (no timeout/sweep) so the verifier can SURFACE it — never auto-cleared.
|
|
2314
2340
|
const spawningTopics = new SpawningTopicsRegistry();
|
|
2315
2341
|
_spawningTopicsRegistryRef = spawningTopics; // F7: expose to the outer-scope verifier
|
|
2342
|
+
_memoryTelegramOwner = () => telegram.getOwnerUserId();
|
|
2316
2343
|
telegram.onTopicMessage = async (msg) => {
|
|
2317
2344
|
const topicId = msg.metadata?.messageThreadId ?? null;
|
|
2318
2345
|
if (!topicId)
|
|
@@ -2326,6 +2353,21 @@ getHubClassifierDeps) {
|
|
|
2326
2353
|
const resolvedUser = telegramUserId && userManager
|
|
2327
2354
|
? userManager.resolveFromTelegramUserId(telegramUserId)
|
|
2328
2355
|
: null;
|
|
2356
|
+
// Memory privacy: record who spoke and re-check the group's readers BEFORE routing.
|
|
2357
|
+
if (_memoryInbound) {
|
|
2358
|
+
const verdict = await _memoryInbound.onInbound({
|
|
2359
|
+
placeKey: telegram.memoryPlaceKey,
|
|
2360
|
+
placeKind: 'shared',
|
|
2361
|
+
senderKey: resolvedUser ? `user:${resolvedUser.id}` : telegramUserId ? `telegram:${telegramUserId}` : null,
|
|
2362
|
+
personId: resolvedUser?.id ?? null,
|
|
2363
|
+
readerCount: () => telegram.groupReaderCount(),
|
|
2364
|
+
liveSession: () => telegram.getSessionForTopic(topicId),
|
|
2365
|
+
});
|
|
2366
|
+
if (verdict === 'unavailable') {
|
|
2367
|
+
await telegram.sendToTopic(topicId, MEMORY_PRIVACY_UNAVAILABLE_REPLY);
|
|
2368
|
+
return;
|
|
2369
|
+
}
|
|
2370
|
+
}
|
|
2329
2371
|
// Agent-signed inbound (ASP). A message an agent SIGNED and delivered through
|
|
2330
2372
|
// a human's account is labelled as agent traffic for the receiving session and
|
|
2331
2373
|
// NEVER binds that human as the topic's operator. The verdict is the
|
|
@@ -2593,7 +2635,7 @@ getHubClassifierDeps) {
|
|
|
2593
2635
|
// mesh) instead of handling it locally. DARK (the default) skips this block
|
|
2594
2636
|
// entirely → byte-identical to single-machine dispatch. Any error falls back
|
|
2595
2637
|
// to the local path below (fail-safe). The live-transfer behavior is gated by
|
|
2596
|
-
// the staged rollout (StageAdvancer)
|
|
2638
|
+
// the staged rollout (StageAdvancer). Any stage past dark places for real, shadow included.
|
|
2597
2639
|
// SpawnAdmission TOCTOU guard (ownership-gated-spawn §3.1 item 2): stash the
|
|
2598
2640
|
// router's verdict for THIS message so the seam at the spawn callsites below
|
|
2599
2641
|
// CONSUMES it instead of re-resolving — the admission decision and the
|
|
@@ -3215,6 +3257,23 @@ getHubClassifierDeps) {
|
|
|
3215
3257
|
});
|
|
3216
3258
|
}
|
|
3217
3259
|
}
|
|
3260
|
+
/** Memory privacy: a 1:1 chat is private, a group is shared. False means the message was refused. */
|
|
3261
|
+
async function whatsappMemoryCheck(whatsapp, jid, metadata) {
|
|
3262
|
+
if (!_memoryInbound)
|
|
3263
|
+
return true;
|
|
3264
|
+
const profile = _memoryUserResolver?.channel('whatsapp', jid) ?? null;
|
|
3265
|
+
const verdict = await _memoryInbound.onInbound({
|
|
3266
|
+
placeKey: `whatsapp:${jid}`,
|
|
3267
|
+
placeKind: jid.endsWith('@g.us') ? 'shared' : 'private',
|
|
3268
|
+
senderKey: profile ? `user:${profile.id}` : whatsappPersonKey(metadata?.senderJid ?? jid),
|
|
3269
|
+
personId: profile?.id ?? null,
|
|
3270
|
+
liveSession: () => whatsapp.getSessionForChannel(jid),
|
|
3271
|
+
});
|
|
3272
|
+
if (verdict === 'deliver')
|
|
3273
|
+
return true;
|
|
3274
|
+
await whatsapp.send({ userId: jid, content: MEMORY_PRIVACY_UNAVAILABLE_REPLY, channel: { type: 'whatsapp', identifier: jid } });
|
|
3275
|
+
return false;
|
|
3276
|
+
}
|
|
3218
3277
|
/**
|
|
3219
3278
|
* Wire WhatsApp message routing: incoming messages → Claude sessions.
|
|
3220
3279
|
*
|
|
@@ -3229,6 +3288,9 @@ function wireWhatsAppRouting(whatsapp, sessionManager) {
|
|
|
3229
3288
|
return;
|
|
3230
3289
|
const text = msg.content;
|
|
3231
3290
|
const senderName = msg.metadata?.senderName ?? undefined;
|
|
3291
|
+
const memoryPlaceKey = `whatsapp:${jid}`;
|
|
3292
|
+
if (!(await whatsappMemoryCheck(whatsapp, jid, msg.metadata)))
|
|
3293
|
+
return;
|
|
3232
3294
|
// Check for existing session
|
|
3233
3295
|
const targetSession = whatsapp.getSessionForChannel(jid);
|
|
3234
3296
|
if (targetSession) {
|
|
@@ -3244,7 +3306,7 @@ function wireWhatsAppRouting(whatsapp, sessionManager) {
|
|
|
3244
3306
|
const replyInstruction = `(IMPORTANT: Relay all responses back via: cat <<'EOF' | .instar/scripts/whatsapp-reply.sh ${jid}\nYour response\nEOF)`;
|
|
3245
3307
|
const bootstrap = `[whatsapp:${jid}] ${text} ${replyInstruction}`;
|
|
3246
3308
|
const sessionName = `wa-${jid.split('@')[0].slice(-6)}`;
|
|
3247
|
-
const newSession = await sessionManager.spawnInteractiveSession(bootstrap, sessionName);
|
|
3309
|
+
const newSession = await sessionManager.spawnInteractiveSession(bootstrap, sessionName, { memoryPlaceKey });
|
|
3248
3310
|
whatsapp.registerSession(jid, newSession);
|
|
3249
3311
|
console.log(`[whatsapp→session] Respawned "${newSession}" for ${jid}`);
|
|
3250
3312
|
}
|
|
@@ -3260,7 +3322,7 @@ function wireWhatsAppRouting(whatsapp, sessionManager) {
|
|
|
3260
3322
|
const replyInstruction = `(IMPORTANT: Relay all responses back via: cat <<'EOF' | .instar/scripts/whatsapp-reply.sh ${jid}\nYour response\nEOF)`;
|
|
3261
3323
|
const bootstrap = `[whatsapp:${jid}${senderName ? ` from ${senderName}` : ''}] ${text} ${replyInstruction}`;
|
|
3262
3324
|
const sessionName = `wa-${jid.split('@')[0].slice(-6)}`;
|
|
3263
|
-
const newSession = await sessionManager.spawnInteractiveSession(bootstrap, sessionName);
|
|
3325
|
+
const newSession = await sessionManager.spawnInteractiveSession(bootstrap, sessionName, { memoryPlaceKey });
|
|
3264
3326
|
whatsapp.registerSession(jid, newSession);
|
|
3265
3327
|
console.log(`[whatsapp→session] Spawned "${newSession}" for ${jid}`);
|
|
3266
3328
|
}
|
|
@@ -3373,6 +3435,23 @@ function wireIMessageRouting(imessage, sessionManager) {
|
|
|
3373
3435
|
// Skip empty messages (reactions, read receipts, lookback artifacts)
|
|
3374
3436
|
if (!text || !text.trim())
|
|
3375
3437
|
return;
|
|
3438
|
+
// Memory privacy: a 1:1 conversation is private. The send happens inside the session
|
|
3439
|
+
// with imsg, which the sandbox cannot give, so a scoped session is refused here.
|
|
3440
|
+
if (_memoryInbound) {
|
|
3441
|
+
const imProfile = _memoryUserResolver?.channel('imessage', sender) ?? null;
|
|
3442
|
+
const verdict = await _memoryInbound.onInbound({
|
|
3443
|
+
placeKey: `imessage:${senderNorm}`,
|
|
3444
|
+
placeKind: 'private',
|
|
3445
|
+
senderKey: imProfile ? `user:${imProfile.id}` : `imessage:${sender}`,
|
|
3446
|
+
personId: imProfile?.id ?? null,
|
|
3447
|
+
scopedUnsupported: true,
|
|
3448
|
+
liveSession: () => imessage.getSessionForSender(sender),
|
|
3449
|
+
});
|
|
3450
|
+
if (verdict === 'unavailable') {
|
|
3451
|
+
await imessage.send({ userId: sender, content: MEMORY_PRIVACY_UNAVAILABLE_REPLY, channel: { type: 'imessage', identifier: sender } });
|
|
3452
|
+
return;
|
|
3453
|
+
}
|
|
3454
|
+
}
|
|
3376
3455
|
// Check for existing session
|
|
3377
3456
|
const targetSession = imessage.getSessionForSender(sender);
|
|
3378
3457
|
// Guard: skip if spawn already in progress for this sender
|
|
@@ -3396,7 +3475,7 @@ function wireIMessageRouting(imessage, sessionManager) {
|
|
|
3396
3475
|
const bootstrapMessage = buildBootstrapMessage(sender, text, senderName);
|
|
3397
3476
|
// Pass bootstrap as initialMessage — spawnInteractiveSession handles
|
|
3398
3477
|
// wait-for-ready and injection internally (same code path as Telegram)
|
|
3399
|
-
sessionManager.spawnInteractiveSession(bootstrapMessage, sessionName)
|
|
3478
|
+
sessionManager.spawnInteractiveSession(bootstrapMessage, sessionName, { memoryPlaceKey: `imessage:${senderNorm}` })
|
|
3400
3479
|
.then((newSession) => {
|
|
3401
3480
|
imessage.registerSession(sender, newSession);
|
|
3402
3481
|
console.log(`[imessage→session] Spawned "${newSession}" for ${imessage.constructor.maskIdentifier?.(sender) || sender}`);
|
|
@@ -5526,6 +5605,9 @@ export async function startServer(options) {
|
|
|
5526
5605
|
const leaseGitRef = leaseMedium.medium === 'local' ? undefined : gitSyncRef;
|
|
5527
5606
|
const leaseStoreName = leaseGitRef ? 'GitLeaseStore' : 'LocalLeaseStore';
|
|
5528
5607
|
coordinator.attachLeaseMediumProvider(() => ({ ...leaseMedium, store: leaseStoreName }));
|
|
5608
|
+
if (leaseGitRef && gitLeaseHasNoRemote(config.projectDir) === true) {
|
|
5609
|
+
_takeoverReadiness = { state: 'failing', reason: 'this machine uses the git lease with no git remote, so it cannot take over' };
|
|
5610
|
+
}
|
|
5529
5611
|
try {
|
|
5530
5612
|
// ── G1 fenced-lease integration (spec §6) ──────────────────
|
|
5531
5613
|
// The lease is the authority for awake/standby + the MeshRpc router-only
|
|
@@ -6405,6 +6487,38 @@ export async function startServer(options) {
|
|
|
6405
6487
|
ownerEpochForConversation: (conversationId) => stageBOwnerEpochForConversation(conversationId),
|
|
6406
6488
|
stageCRecoveryEnabled,
|
|
6407
6489
|
});
|
|
6490
|
+
// Memory privacy (docs/specs/memory-privacy.md): straight after the session manager
|
|
6491
|
+
// and before any adapter starts, so no message or session comes ahead of it.
|
|
6492
|
+
const { wireMemoryPrivacy } = await import('../users/wireMemoryPrivacy.js');
|
|
6493
|
+
const _memoryWiring = wireMemoryPrivacy({
|
|
6494
|
+
projectDir: config.projectDir,
|
|
6495
|
+
stateDir: config.stateDir,
|
|
6496
|
+
projectName: config.projectName,
|
|
6497
|
+
framework: () => sessionManagerConfig.framework ?? 'claude-code',
|
|
6498
|
+
claudePath: sessionManagerConfig.frameworkBinaryPaths?.['claude-code'] ?? sessionManagerConfig.claudePath,
|
|
6499
|
+
memoryPrivacy: () => config.memoryPrivacy,
|
|
6500
|
+
messaging: () => (config.messaging ?? []),
|
|
6501
|
+
initialUsers: config.users,
|
|
6502
|
+
sessionManager,
|
|
6503
|
+
slackBotUserId: () => _slackAdapter?.getBotUserId?.() ?? null,
|
|
6504
|
+
slackChannelForSession: (name) => _slackAdapter?.getChannelForSession?.(name) ?? null,
|
|
6505
|
+
telegramOwnerId: () => _memoryTelegramOwner?.() ?? null,
|
|
6506
|
+
});
|
|
6507
|
+
const _memoryPrivacyWired = _memoryWiring.privacy;
|
|
6508
|
+
_memoryInbound = _memoryWiring.tracker;
|
|
6509
|
+
_memoryUserResolver = {
|
|
6510
|
+
// The org permission system's own resolver, so a person registered there is the
|
|
6511
|
+
// same person here. An unregistered sender gets no profile, which means `place`.
|
|
6512
|
+
slack: (id) => {
|
|
6513
|
+
const principal = new SlackPrincipalResolver({
|
|
6514
|
+
resolveFromSlackUserId: (slackId) => _memoryWiring.users().find((u) => u.slackUserId === slackId || u.channels?.some((c) => c.type === 'slack' && c.identifier === slackId)) ?? null,
|
|
6515
|
+
}).resolve(id);
|
|
6516
|
+
return principal.userId ? _memoryWiring.users().find((u) => u.id === principal.userId) ?? null : null;
|
|
6517
|
+
},
|
|
6518
|
+
channel: (type, id) => _memoryWiring.users().find((u) => u.channels?.some((c) => c.type === type && c.identifier === id)) ?? null,
|
|
6519
|
+
};
|
|
6520
|
+
sessionManager.on('sessionComplete', (session) => sessionManager.releaseMemorySession(session));
|
|
6521
|
+
await _memoryWiring.ready.catch((err) => console.error('[memory-privacy] boot probe failed; scoped conversations stay refused:', err));
|
|
6408
6522
|
// Native hook events (docs/specs/native-hook-events.md D4): reconcile the
|
|
6409
6523
|
// reporter entries in .claude/settings.json to this machine's decision at
|
|
6410
6524
|
// boot (a flag flip takes effect at the next restart, not the next
|
|
@@ -7630,6 +7744,11 @@ export async function startServer(options) {
|
|
|
7630
7744
|
let scheduler;
|
|
7631
7745
|
if (config.scheduler.enabled && coordinator.isAwake) {
|
|
7632
7746
|
scheduler = new JobScheduler(config.scheduler, sessionManager, state, config.stateDir);
|
|
7747
|
+
scheduler.notifyDestinationHasOtherReaders = (job) => {
|
|
7748
|
+
const topicId = job.topicId;
|
|
7749
|
+
const kind = sessionManager.memoryAudienceKind(telegramConfiguredForMemory(config) ? { telegramTopicId: topicId ?? 0 } : { memoryPlace: { kind: 'system' } });
|
|
7750
|
+
return kind === 'place' || kind === 'none';
|
|
7751
|
+
};
|
|
7633
7752
|
guardRegistry.register('scheduler.enabled', () => scheduler.guardStatus());
|
|
7634
7753
|
// Test-agent leak guard: a temp-folder / recorded throwaway refuses every
|
|
7635
7754
|
// scheduled job (it cannot prove its sessions avoid the real login).
|
|
@@ -8815,6 +8934,21 @@ export async function startServer(options) {
|
|
|
8815
8934
|
}),
|
|
8816
8935
|
});
|
|
8817
8936
|
appDispatch = createAppInboundDispatch({
|
|
8937
|
+
// Memory privacy: an app conversation belongs to one phone's person. The owner's
|
|
8938
|
+
// own phone carries no person id, so it resolves to the owner.
|
|
8939
|
+
memoryInbound: async (input) => {
|
|
8940
|
+
if (!_memoryInbound)
|
|
8941
|
+
return true;
|
|
8942
|
+
const person = input.memoryPersonId ?? null;
|
|
8943
|
+
const verdict = await _memoryInbound.onInbound({
|
|
8944
|
+
placeKey: `app:${input.conversationKey}`,
|
|
8945
|
+
placeKind: 'private',
|
|
8946
|
+
senderKey: person ? `user:${person}` : null,
|
|
8947
|
+
personId: person ?? _memoryPrivacyWired.ownerUserId(),
|
|
8948
|
+
liveSession: () => appSvc.channels.getSessionForChannel(String(input.alias)),
|
|
8949
|
+
});
|
|
8950
|
+
return verdict === 'deliver';
|
|
8951
|
+
},
|
|
8818
8952
|
sessions: sessionManager, channels: appSvc.channels, store: appSvc.store, stateDir: config.stateDir,
|
|
8819
8953
|
spawnAdmission: () => _spawnAdmission,
|
|
8820
8954
|
relayReady: () => {
|
|
@@ -9329,6 +9463,8 @@ export async function startServer(options) {
|
|
|
9329
9463
|
const isThreadSession = slackAdapter.isThreadRoutingKey(routingKey);
|
|
9330
9464
|
// The thread_ts to thread replies under (only when this is a thread session).
|
|
9331
9465
|
const replyThreadTs = isThreadSession ? threadTs : undefined;
|
|
9466
|
+
if (!isThreadSession)
|
|
9467
|
+
slackAdapter.noteInboundThread(channelId, threadTs);
|
|
9332
9468
|
// ── §6.3 eager mint (durable-conversation-identity) ────────────────
|
|
9333
9469
|
// Get-or-create the durable conversation id for the RESOLVED routing
|
|
9334
9470
|
// key on EVERY inbound (one cached registry read after the first).
|
|
@@ -9346,6 +9482,23 @@ export async function startServer(options) {
|
|
|
9346
9482
|
catch { /* @silent-fallback-ok — identity never costs a message (§3.6 fail-toward-delivery): the inbound proceeds without a durable id and re-mints later */ }
|
|
9347
9483
|
// Build injection tag with sender info (matches Telegram's buildInjectionTag pattern)
|
|
9348
9484
|
const slackUserId = message.metadata?.slackUserId;
|
|
9485
|
+
// Memory privacy: record who spoke and where BEFORE routing. A DM is private;
|
|
9486
|
+
// a channel or thread is shared, and a thread's audience is its channel's.
|
|
9487
|
+
if (_memoryInbound) {
|
|
9488
|
+
const slackProfile = slackUserId ? _memoryUserResolver?.slack(slackUserId) ?? null : null;
|
|
9489
|
+
const verdict = await _memoryInbound.onInbound({
|
|
9490
|
+
placeKey: `slack:${channelId}`,
|
|
9491
|
+
placeKind: channelId.startsWith('D') ? 'private' : 'shared',
|
|
9492
|
+
senderKey: slackProfile ? `user:${slackProfile.id}` : slackUserId ? `slack:${slackUserId}` : null,
|
|
9493
|
+
personId: slackProfile?.id ?? null,
|
|
9494
|
+
readerCount: () => slackAdapter.channelReaderCount(channelId),
|
|
9495
|
+
liveSession: () => slackAdapter.getSessionForChannel(routingKey),
|
|
9496
|
+
});
|
|
9497
|
+
if (verdict === 'unavailable') {
|
|
9498
|
+
await slackAdapter.sendToChannel(channelId, MEMORY_PRIVACY_UNAVAILABLE_REPLY, replyThreadTs ? { thread_ts: replyThreadTs } : undefined);
|
|
9499
|
+
return 'refused';
|
|
9500
|
+
}
|
|
9501
|
+
}
|
|
9349
9502
|
// Sanitize sender name at injection boundary (prevents injection attacks)
|
|
9350
9503
|
const safeSenderName = senderName
|
|
9351
9504
|
? senderName.replace(/[\x00-\x1f\x7f]/g, '').replace(/\s+/g, ' ').replace(/["\[\]]/g, '').trim().slice(0, 64) || 'User'
|
|
@@ -11906,7 +12059,7 @@ export async function startServer(options) {
|
|
|
11906
12059
|
activitySentinel = new SessionActivitySentinel({
|
|
11907
12060
|
stateDir: config.stateDir,
|
|
11908
12061
|
intelligence: sharedIntelligence,
|
|
11909
|
-
getActiveSessions: () => sessionManager.
|
|
12062
|
+
getActiveSessions: () => sessionManager.sessionsForAgentDigests(),
|
|
11910
12063
|
captureSessionOutput: (tmuxSession) => sessionManager.captureOutput(tmuxSession),
|
|
11911
12064
|
getTelegramMessages: telegram
|
|
11912
12065
|
? (topicId, since) => telegram.searchLog({
|
|
@@ -12164,6 +12317,7 @@ export async function startServer(options) {
|
|
|
12164
12317
|
const matches = state.listSessions().filter(session => session.tmuxSession === name);
|
|
12165
12318
|
return readTriageSessionAuthor(telegramOriginBoot?.runtime, matches.length === 1 ? matches[0].id : undefined);
|
|
12166
12319
|
},
|
|
12320
|
+
isMemoryScopedTopic: (topicId) => ['place', 'person', 'none'].includes(sessionManager.memoryAudienceKind({ telegramTopicId: topicId })),
|
|
12167
12321
|
spawnTriageSession: (name, options) => sessionManager.spawnTriageSession(name, options),
|
|
12168
12322
|
getTriageSessionUuid: (sessionName) => {
|
|
12169
12323
|
return _topicResumeMap?.findUuidForSession(sessionName) ?? undefined;
|
|
@@ -17930,7 +18084,7 @@ export async function startServer(options) {
|
|
|
17930
18084
|
const summarySentinel = new SessionSummarySentinel({
|
|
17931
18085
|
stateDir: config.stateDir,
|
|
17932
18086
|
scrubber: durableOutputScrubber,
|
|
17933
|
-
getActiveSessions: () => sessionManager.
|
|
18087
|
+
getActiveSessions: () => sessionManager.sessionsForAgentDigests(),
|
|
17934
18088
|
captureOutput: (tmuxSession) => {
|
|
17935
18089
|
// RULE 3: EXEMPT — this is raw byte capture (the whole pane), not state parsing.
|
|
17936
18090
|
// The output is handed verbatim to the SummarySentinel (LLM-backed) which is the
|
|
@@ -17961,6 +18115,10 @@ export async function startServer(options) {
|
|
|
17961
18115
|
// manager it belongs to (for re-entrant evaluate() calls during drain).
|
|
17962
18116
|
let spawnManager;
|
|
17963
18117
|
spawnManager = new SpawnRequestManager({
|
|
18118
|
+
// Memory privacy: trust levels limit what a peer may do, not what data its
|
|
18119
|
+
// session can see, so a peer session with owner reach could pass a person's fact on.
|
|
18120
|
+
refuseSpawn: () => (_memoryInbound && sessionManager.isMultiPersonAgent()
|
|
18121
|
+
? 'agent-to-agent sessions are off on an agent that serves several people' : null),
|
|
17964
18122
|
maxSessions: config.sessions.maxSessions ?? 5,
|
|
17965
18123
|
// Live accessor — read config on every admission check so operators
|
|
17966
18124
|
// raising sessions.maxSessions don't have to rebuild the manager.
|
|
@@ -23156,7 +23314,22 @@ export async function startServer(options) {
|
|
|
23156
23314
|
};
|
|
23157
23315
|
_refreshPoolHeartbeat = refreshPool;
|
|
23158
23316
|
refreshPool();
|
|
23159
|
-
const
|
|
23317
|
+
const readinessMod = await import('../core/poolReadiness.js');
|
|
23318
|
+
const durableOwnershipMod = await import('../core/durableOwnershipActivation.js');
|
|
23319
|
+
const poolReadinessDeps = {
|
|
23320
|
+
peerIds: () => Object.entries(coordinator.managers.identityManager.loadRegistry().machines ?? {})
|
|
23321
|
+
.filter(([id, entry]) => id !== poolSelfId && !entry.revokedAt)
|
|
23322
|
+
.map(([id]) => id),
|
|
23323
|
+
capacity: (id) => machinePoolRegistry.getCapacityForReport(id),
|
|
23324
|
+
ownChannels: () => selfServesChannels(),
|
|
23325
|
+
durableOwnership: () => durableOwnershipMod.shouldActivateDurableOwnership(config, resolveDevAgentGate),
|
|
23326
|
+
duplicateCheck: () => _duplicateReconciler?.status() ?? null,
|
|
23327
|
+
takeover: () => _takeoverReadiness,
|
|
23328
|
+
};
|
|
23329
|
+
readinessMod.setActivePoolReadiness(poolReadinessDeps);
|
|
23330
|
+
const poolReadinessLog = new readinessMod.PoolReadinessLog(poolReadinessDeps, path.join(config.stateDir, '..', 'logs', 'pool-readiness.jsonl'));
|
|
23331
|
+
const poolBeat = () => { refreshPool(); poolReadinessLog.tick(); };
|
|
23332
|
+
const poolTimer = setInterval(poolBeat, 30_000);
|
|
23160
23333
|
if (typeof poolTimer.unref === 'function')
|
|
23161
23334
|
poolTimer.unref();
|
|
23162
23335
|
// Boot-time pool-flag-coherence check (multi-machine-replicated-store-
|
|
@@ -24393,6 +24566,43 @@ export async function startServer(options) {
|
|
|
24393
24566
|
return []; /* @silent-fallback-ok — no planner → no overload moves (today's behavior) */
|
|
24394
24567
|
}
|
|
24395
24568
|
},
|
|
24569
|
+
// A shed move goes through the owner-side drain: it closes the session and hands
|
|
24570
|
+
// over custody. One at a time; the slot is held until the runner settles, so a
|
|
24571
|
+
// hung drain blocks further moves rather than stacking them.
|
|
24572
|
+
drainMove: (mv, epoch) => {
|
|
24573
|
+
const planner = getActiveOverloadShedPlanner();
|
|
24574
|
+
if (!planner)
|
|
24575
|
+
return;
|
|
24576
|
+
if (_shedDrainInFlight)
|
|
24577
|
+
return;
|
|
24578
|
+
if (!_drainRunner) {
|
|
24579
|
+
planner.noteMoveOutcome(mv.sessionKey, { status: 'refused-no-drain-runner' });
|
|
24580
|
+
return;
|
|
24581
|
+
}
|
|
24582
|
+
const target = machinePoolRegistry?.getCapacity(mv.target);
|
|
24583
|
+
if (!target || target.liveness?.state !== 'live' || target.loadVerdict !== 'ok' || target.loadReport?.acceptingWork === false) {
|
|
24584
|
+
planner.noteMoveOutcome(mv.sessionKey, { status: 'refused-target-changed' });
|
|
24585
|
+
return;
|
|
24586
|
+
}
|
|
24587
|
+
_shedDrainInFlight = true;
|
|
24588
|
+
const startedAt = Date.now();
|
|
24589
|
+
_shedDrainTopics.add(mv.sessionKey);
|
|
24590
|
+
void _drainRunner.run({ sessionKey: mv.sessionKey, target: mv.target, senderObservedEpoch: epoch, onNotQuiet: 'abort' })
|
|
24591
|
+
.then((o) => {
|
|
24592
|
+
if (o.status === 'drained' || o.status === 'drained-interrupted') {
|
|
24593
|
+
const topicNum = Number(mv.sessionKey);
|
|
24594
|
+
if (Number.isFinite(topicNum)) {
|
|
24595
|
+
try {
|
|
24596
|
+
getMoveAftercare()?.(mv.target, topicNum);
|
|
24597
|
+
}
|
|
24598
|
+
catch { /* @silent-fallback-ok — the kick has bounded retries; the target can still fetch */ }
|
|
24599
|
+
}
|
|
24600
|
+
}
|
|
24601
|
+
planner.noteMoveOutcome(mv.sessionKey, { status: o.status, claimLanded: o.claimLanded, durationMs: Date.now() - startedAt, ...(o.detail ? { detail: o.detail } : {}) });
|
|
24602
|
+
})
|
|
24603
|
+
.catch((err) => { planner.noteMoveOutcome(mv.sessionKey, { status: 'refused-drain-threw', detail: err instanceof Error ? err.message : String(err) }); })
|
|
24604
|
+
.finally(() => { _shedDrainInFlight = false; _shedDrainTopics.delete(mv.sessionKey); });
|
|
24605
|
+
},
|
|
24396
24606
|
// Live only when overload shed is enabled AND out of dry-run: driving unpinned
|
|
24397
24607
|
// transfers (claim / abort past the deadline) is real authority over every
|
|
24398
24608
|
// unpinned in-flight transfer, so the soft dry-run lever must hold it too.
|
|
@@ -24457,6 +24667,7 @@ export async function startServer(options) {
|
|
|
24457
24667
|
enabled: resolveDevAgentGate(c?.enabled, config),
|
|
24458
24668
|
dryRun: c?.dryRun ?? dflt.dryRun,
|
|
24459
24669
|
sourceAfterMs: c?.sourceAfterMs ?? dflt.sourceAfterMs,
|
|
24670
|
+
topicCooldownMs: c?.topicCooldownMs ?? dflt.topicCooldownMs,
|
|
24460
24671
|
maxMovesPerHour: c?.maxMovesPerHour ?? dflt.maxMovesPerHour,
|
|
24461
24672
|
recentShedMs: c?.recentShedMs ?? dflt.recentShedMs,
|
|
24462
24673
|
};
|
|
@@ -24470,6 +24681,39 @@ export async function startServer(options) {
|
|
|
24470
24681
|
return true; /* @silent-fallback-ok — an unreadable pin view treats the topic as pinned (never moved) */
|
|
24471
24682
|
}
|
|
24472
24683
|
};
|
|
24684
|
+
const shedProofTopics = () => new Set(config.multiMachine?.sessionPool?.rebalanceProofTopics ?? []);
|
|
24685
|
+
// Topics with a running session here, with when the conversation last moved.
|
|
24686
|
+
// One cached listing; the work-state reads stay off the planner's sync tick.
|
|
24687
|
+
const quietScanner = new QuietTopicScanner({
|
|
24688
|
+
runningTopicSessions: () => {
|
|
24689
|
+
if (!telegram)
|
|
24690
|
+
return [];
|
|
24691
|
+
const out = [];
|
|
24692
|
+
for (const s of sessionManager.getCachedRunningSessions().sessions) {
|
|
24693
|
+
const topic = telegram.getTopicForSession(s.tmuxSession);
|
|
24694
|
+
if (topic === null || topic === undefined)
|
|
24695
|
+
continue;
|
|
24696
|
+
const last = telegram.getTopicHistory(topic, 1)[0];
|
|
24697
|
+
const at = last ? Date.parse(last.timestamp) : NaN;
|
|
24698
|
+
out.push({ sessionKey: String(topic), tmuxSession: s.tmuxSession, lastActivityAt: Number.isFinite(at) ? at : null });
|
|
24699
|
+
}
|
|
24700
|
+
return out;
|
|
24701
|
+
},
|
|
24702
|
+
workState: (tmux) => sessionManager.checkSessionWorkState(tmux),
|
|
24703
|
+
movable: (key) => {
|
|
24704
|
+
const r = ownReg.read(key);
|
|
24705
|
+
if (r?.status !== 'active' || r.ownerMachineId !== _meshSelfId)
|
|
24706
|
+
return false;
|
|
24707
|
+
if (shedPinned(key) || shedProofTopics().has(Number(key)))
|
|
24708
|
+
return false;
|
|
24709
|
+
try {
|
|
24710
|
+
return !autoSessionsMod.listAutonomousJobs(config.stateDir).find((j) => j.topic === key && j.active && !j.paused);
|
|
24711
|
+
}
|
|
24712
|
+
catch {
|
|
24713
|
+
return false; /* @silent-fallback-ok: unreadable run registry: treat the topic as not movable */
|
|
24714
|
+
}
|
|
24715
|
+
},
|
|
24716
|
+
});
|
|
24473
24717
|
const planner = new shedMod.OverloadShedPlanner({
|
|
24474
24718
|
config: shedCfg,
|
|
24475
24719
|
selfMachineId: () => _meshSelfId,
|
|
@@ -24477,7 +24721,16 @@ export async function startServer(options) {
|
|
|
24477
24721
|
capacities: () => machinePoolRegistry?.getCapacities() ?? [],
|
|
24478
24722
|
ownedTopics: () => ownReg.all()
|
|
24479
24723
|
.filter((r) => r.status === 'active' && r.ownerMachineId === _meshSelfId)
|
|
24480
|
-
.map((r) => ({ sessionKey: r.sessionKey, pinned: shedPinned(r.sessionKey) })),
|
|
24724
|
+
.map((r) => ({ sessionKey: r.sessionKey, pinned: shedPinned(r.sessionKey), lastMovedAt: r.timestamp })),
|
|
24725
|
+
poolStage: () => liveConfig.get('multiMachine.sessionPool.stage', 'dark'),
|
|
24726
|
+
proofFresh: () => {
|
|
24727
|
+
if (!_rebalanceProofStore)
|
|
24728
|
+
return false;
|
|
24729
|
+
return rebalanceProofState(_rebalanceProofStore, Date.now()).fresh;
|
|
24730
|
+
},
|
|
24731
|
+
quietTopics: () => quietScanner.current(),
|
|
24732
|
+
moveActuatorLive: () => resolveDevAgentGate(ws13Cfg().ws13Reconcile, config) && ws13Cfg().ws13DryRun === false,
|
|
24733
|
+
isProofTopic: (key) => shedProofTopics().has(Number(key)),
|
|
24481
24734
|
ownerOf: (key) => ownReg.read(key)?.ownerMachineId,
|
|
24482
24735
|
statusOf: (key) => {
|
|
24483
24736
|
const r = ownReg.read(key);
|
|
@@ -24501,7 +24754,81 @@ export async function startServer(options) {
|
|
|
24501
24754
|
log: (line) => console.log(pc.yellow(` [overload-shed] ${line}`)),
|
|
24502
24755
|
});
|
|
24503
24756
|
shedMod.setActiveOverloadShedPlanner(planner);
|
|
24757
|
+
// The rebalance proof: drives this planner's real path, judged from outside it.
|
|
24758
|
+
const proofMarker = path.join(config.stateDir, 'rebalance-proof-in-flight');
|
|
24759
|
+
setActiveRebalanceProof(new RebalanceProofRunner({
|
|
24760
|
+
selfMachineId: () => _meshSelfId,
|
|
24761
|
+
isProofTopic: (t) => shedProofTopics().has(t),
|
|
24762
|
+
stage: () => liveConfig.get('multiMachine.sessionPool.stage', 'dark'),
|
|
24763
|
+
stageAllowsProof: () => {
|
|
24764
|
+
const st = liveConfig.get('multiMachine.sessionPool.stage', 'dark');
|
|
24765
|
+
return st === 'live-transfer' || st === 'rebalance';
|
|
24766
|
+
},
|
|
24767
|
+
readRecord: (t) => ownReg.read(String(t)),
|
|
24768
|
+
hasLocalSession: (t) => {
|
|
24769
|
+
const tmux = telegram?.getSessionForTopic(t);
|
|
24770
|
+
return !!tmux && sessionManager.isSessionAlive(tmux);
|
|
24771
|
+
},
|
|
24772
|
+
ensureIdleSession: async (t, timeoutMs) => {
|
|
24773
|
+
if (!telegram)
|
|
24774
|
+
return false;
|
|
24775
|
+
const live = () => { const m = telegram.getSessionForTopic(t); return m && sessionManager.isSessionAlive(m) ? m : null; };
|
|
24776
|
+
if (!live()) {
|
|
24777
|
+
const name = await spawnSessionForTopic(sessionManager, telegram, `proof-${t}`, t, proofSpawnBrief());
|
|
24778
|
+
telegram.registerTopicSession(t, name, `proof-${t}`);
|
|
24779
|
+
}
|
|
24780
|
+
const deadline = Date.now() + timeoutMs;
|
|
24781
|
+
while (Date.now() < deadline) {
|
|
24782
|
+
const tmux = live();
|
|
24783
|
+
if (tmux && (await sessionManager.checkSessionWorkState(tmux)) === 'idle')
|
|
24784
|
+
return true;
|
|
24785
|
+
await new Promise((r) => setTimeout(r, 5_000));
|
|
24786
|
+
}
|
|
24787
|
+
return false;
|
|
24788
|
+
},
|
|
24789
|
+
move: (t, to) => planner.proofMove(String(t), to),
|
|
24790
|
+
sendProbe: async (t, text, messageId) => {
|
|
24791
|
+
if (!_sessionRouter)
|
|
24792
|
+
return 'no-router';
|
|
24793
|
+
const o = await _sessionRouter.route({ sessionKey: String(t), messageId, payload: text, senderEnvelope: null });
|
|
24794
|
+
return o.action;
|
|
24795
|
+
},
|
|
24796
|
+
readHistory: async (t) => {
|
|
24797
|
+
const r = await fetch(`http://127.0.0.1:${config.port}/telegram/topics/${t}/messages?scope=pool&limit=50`, {
|
|
24798
|
+
headers: { Authorization: `Bearer ${config.authToken}`, 'X-Instar-AgentId': config.projectName },
|
|
24799
|
+
});
|
|
24800
|
+
if (!r.ok)
|
|
24801
|
+
throw new Error(`history ${r.status}`);
|
|
24802
|
+
const j = await r.json();
|
|
24803
|
+
return { rows: j.messages ?? [], failed: (j.pool?.failed ?? []).map((f) => (typeof f === 'string' ? f : f.machineId ?? '')) };
|
|
24804
|
+
},
|
|
24805
|
+
record: (result, evidenceRef) => {
|
|
24806
|
+
_rebalanceProofStore?.recordResult(3, result, _sessionPoolBuildIdentity?.() ?? 'unknown', evidenceRef);
|
|
24807
|
+
},
|
|
24808
|
+
writeEvidence: (ev) => {
|
|
24809
|
+
const dir = path.join(config.stateDir, '..', 'logs', 'rebalance-proof');
|
|
24810
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
24811
|
+
const file = path.join(dir, `${new Date().toISOString().replace(/[:.]/g, '-')}.json`);
|
|
24812
|
+
fs.writeFileSync(file, JSON.stringify(ev, null, 2));
|
|
24813
|
+
return file;
|
|
24814
|
+
},
|
|
24815
|
+
newNonce: () => crypto.randomUUID().replace(/-/g, '').slice(0, 12),
|
|
24816
|
+
markInFlight: (runId) => fs.writeFileSync(proofMarker, runId),
|
|
24817
|
+
readInFlight: () => { try {
|
|
24818
|
+
return fs.readFileSync(proofMarker, 'utf8').trim() || null;
|
|
24819
|
+
}
|
|
24820
|
+
catch {
|
|
24821
|
+
return null; /* @silent-fallback-ok — no marker means no unfinished run */
|
|
24822
|
+
} },
|
|
24823
|
+
clearInFlight: () => { SafeFsExecutor.safeRmSync(proofMarker, { force: true, operation: 'rebalance-proof: run finished' }); },
|
|
24824
|
+
log: (line) => console.log(pc.dim(` [rebalance-proof] ${line}`)),
|
|
24825
|
+
}));
|
|
24504
24826
|
_overloadShedTimer = setInterval(() => {
|
|
24827
|
+
// The scan is cheap to skip: it only matters while this machine is a source.
|
|
24828
|
+
if (planner.status().isSource === true)
|
|
24829
|
+
void quietScanner.refresh();
|
|
24830
|
+
else
|
|
24831
|
+
quietScanner.clear();
|
|
24505
24832
|
try {
|
|
24506
24833
|
planner.tick();
|
|
24507
24834
|
}
|
|
@@ -25303,9 +25630,16 @@ export async function startServer(options) {
|
|
|
25303
25630
|
const r = ownReg.cas(action, c);
|
|
25304
25631
|
// Journal pairing (§3.3): the drain's transfer/abort/claim CASes
|
|
25305
25632
|
// record placement history like every other CAS site.
|
|
25306
|
-
emitPlacement(c.sessionKey, r, 'user-move', prev);
|
|
25633
|
+
emitPlacement(c.sessionKey, r, _shedDrainTopics.has(c.sessionKey) ? 'reconcile' : 'user-move', prev);
|
|
25307
25634
|
return r;
|
|
25308
25635
|
},
|
|
25636
|
+
sessionIdleNow: async (sk) => {
|
|
25637
|
+
const topicNum = Number(sk);
|
|
25638
|
+
const tmux = Number.isFinite(topicNum) ? telegram?.getSessionForTopic(topicNum) : null;
|
|
25639
|
+
if (!tmux || !sessionManager.isSessionAlive(tmux))
|
|
25640
|
+
return true; // nothing local to disturb
|
|
25641
|
+
return (await sessionManager.checkSessionWorkState(tmux)) === 'idle';
|
|
25642
|
+
},
|
|
25309
25643
|
suspendAutonomousRun: (topic, target) => autoMod.suspendAutonomousTopicForMove(config.stateDir, topic, target, coherenceJournal ?? undefined),
|
|
25310
25644
|
sessionQuiet: (sk) => {
|
|
25311
25645
|
const topicNum = Number(sk);
|
|
@@ -28736,6 +29070,30 @@ export async function startServer(options) {
|
|
|
28736
29070
|
bootCommitSha = `package:${startupVersion}`;
|
|
28737
29071
|
}
|
|
28738
29072
|
const currentSessionPoolBuildIdentity = () => bootCommitSha || 'unknown';
|
|
29073
|
+
_sessionPoolBuildIdentity = currentSessionPoolBuildIdentity;
|
|
29074
|
+
// The rebalance proof has its own signed store: the failover rows prove failover, and
|
|
29075
|
+
// 770 of them once sat at stage 3 proving nothing about rebalancing.
|
|
29076
|
+
_rebalanceProofStore = new e2eMod.SessionPoolE2EResultStore({
|
|
29077
|
+
filePath: path.join(config.stateDir, 'session-pool-rebalance-proof.json'),
|
|
29078
|
+
sign: hmac,
|
|
29079
|
+
verifySig: (c, s) => {
|
|
29080
|
+
try {
|
|
29081
|
+
const exp = hmac(c);
|
|
29082
|
+
return s.length === exp.length && crypto.timingSafeEqual(Buffer.from(s), Buffer.from(exp));
|
|
29083
|
+
}
|
|
29084
|
+
catch {
|
|
29085
|
+
return false; /* @silent-fallback-ok: HMAC verify fails closed — a malformed input is an invalid signature, never accepted */
|
|
29086
|
+
}
|
|
29087
|
+
},
|
|
29088
|
+
});
|
|
29089
|
+
setActiveRebalanceProofStore(_rebalanceProofStore);
|
|
29090
|
+
// A failure here must not cost the agent its rollout gate below.
|
|
29091
|
+
try {
|
|
29092
|
+
getActiveRebalanceProof()?.recoverInterrupted();
|
|
29093
|
+
}
|
|
29094
|
+
catch (err) {
|
|
29095
|
+
console.warn('[rebalance-proof] could not record an interrupted run:', err instanceof Error ? err.message : String(err)); /* @silent-fallback-ok (logged): the marker stays and the next boot retries */
|
|
29096
|
+
}
|
|
28739
29097
|
// ONE authoritative stage read for the rollout gate and its proof producer.
|
|
28740
29098
|
// Splitting these previously let the runner stamp every green as stage 0
|
|
28741
29099
|
// while StageAdvancer was already waiting for a green at stage 2.
|
|
@@ -28747,6 +29105,7 @@ export async function startServer(options) {
|
|
|
28747
29105
|
currentCommitSha: currentSessionPoolBuildIdentity,
|
|
28748
29106
|
readStage: readSessionPoolStage,
|
|
28749
29107
|
writeStageConfig: (s) => liveConfig.set(guardMod.STAGE_CONFIG_PATH, s, { stageWriteToken: guardMod.STAGE_WRITE_TOKEN }),
|
|
29108
|
+
rebalanceProof: () => stageMod.rebalanceProofState(_rebalanceProofStore, Date.now()),
|
|
28750
29109
|
audit: (event, detail) => console.log(pc.dim(` [stage-advancer] ${event} ${JSON.stringify(detail)}`)),
|
|
28751
29110
|
});
|
|
28752
29111
|
// ── Promotion activation ────────────────────────────────────────────────
|
|
@@ -28898,7 +29257,7 @@ export async function startServer(options) {
|
|
|
28898
29257
|
currentCommitSha: currentSessionPoolBuildIdentity,
|
|
28899
29258
|
// Credit the proof to the stage that is actually running. The next
|
|
28900
29259
|
// promotion reads this same current-stage index as its prior-stage gate.
|
|
28901
|
-
provenStage: () => stageMod.
|
|
29260
|
+
provenStage: () => stageMod.failoverProvenStage(readSessionPoolStage()),
|
|
28902
29261
|
audit: (event, detail) => console.log(pc.dim(` [failover-runner] ${event} ${JSON.stringify(detail)}`)),
|
|
28903
29262
|
});
|
|
28904
29263
|
if (_sessionPoolFailoverRunnerDriver) {
|
|
@@ -29929,7 +30288,7 @@ export async function startServer(options) {
|
|
|
29929
30288
|
const server = new AgentServer({ config, ecosystemLedger: _ecosystemLedger ?? undefined, recommendedServicesLedger: _recommendedServicesLedger ?? undefined, singleInstanceLock, agentIdentity: _agentIdentityDeps, 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, jobAnomalySendAutomationReply: sendAutomationReply, 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, verifiedEntityName(m.machineId, m.nickname) ?? ''])); let peers = (_resolvePeerUrls?.() ?? []).map((p) => ({ machineId: p.machineId, nickname: nickById.get(p.machineId) ?? '', url: p.url })); if (peers.length === 0) {
|
|
29930
30289
|
peers = (_listPoolMachines?.() ?? []).filter((m) => m.machineId !== _meshSelfId && !!m.lastKnownUrl).map((m) => ({ machineId: m.machineId, nickname: verifiedEntityName(m.machineId, m.nickname) ?? '', url: m.lastKnownUrl }));
|
|
29931
30290
|
} if (peers.length === 0)
|
|
29932
|
-
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, localVerify: localVerifyService ?? undefined, localVerifyStatus: localVerifyStatus ?? undefined, guardLatchStore: guardLatchStore ?? undefined, agentStopSurfacer: agentStopSurfacer ?? 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, appConversations: _appConversationService ?? undefined, slackInboundDispatch: () => _slackInboundDispatch, conversationFollowThrough, whatsappBusinessBackend, messageBridge, hookEventReceiver, worktreeMonitor, subagentTracker, instructionsVerifier, handshakeManager: threadlineHandshake, threadlineRouter, conversationStore, threadLog, threadMessageRecorder, warrantsReplyGate, collaborationSurfacer, peerHomebaseRelay, threadResumeMap, topicLinkageHandler: topicLinkageHandler ?? undefined, threadlineRelayClient, pairingInvites: threadlinePairingInvites, getLastRelayEvent: threadlineGetLastRelayEvent, a2aRelayForward: _a2aRelayForwardCtx ?? undefined, threadlineReplyWaiters, threadlineMcpHttp, 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, replicatedStoreReconciler, conflictStore, rollbackUnmerge, droppedOriginRegistry, preferencesUnionReader, jevMemoryPicker, forwardCommitmentMutate, sessionOwnershipRegistry, sendDrain: _sendDrain ?? undefined, claimTopicOwnershipOnSpawn: (topicId) => _claimOwnershipForAutonomousSpawn ? _claimOwnershipForAutonomousSpawn(topicId) : 'unwired', 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, recordRopeResult: _recordRopeResult ?? 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, codexArmSessionSweeper, 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 });
|
|
30291
|
+
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, localVerify: localVerifyService ?? undefined, localVerifyStatus: localVerifyStatus ?? undefined, guardLatchStore: guardLatchStore ?? undefined, agentStopSurfacer: agentStopSurfacer ?? 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, appConversations: _appConversationService ?? undefined, slackInboundDispatch: () => _slackInboundDispatch, conversationFollowThrough, whatsappBusinessBackend, messageBridge, hookEventReceiver, worktreeMonitor, subagentTracker, instructionsVerifier, handshakeManager: threadlineHandshake, threadlineRouter, conversationStore, threadLog, threadMessageRecorder, warrantsReplyGate, collaborationSurfacer, peerHomebaseRelay, threadResumeMap, topicLinkageHandler: topicLinkageHandler ?? undefined, threadlineRelayClient, pairingInvites: threadlinePairingInvites, getLastRelayEvent: threadlineGetLastRelayEvent, a2aRelayForward: _a2aRelayForwardCtx ?? undefined, threadlineReplyWaiters, threadlineMcpHttp, memoryPrivacy: _memoryPrivacyWired ?? undefined, 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, replicatedStoreReconciler, conflictStore, rollbackUnmerge, droppedOriginRegistry, preferencesUnionReader, jevMemoryPicker, forwardCommitmentMutate, sessionOwnershipRegistry, sendDrain: _sendDrain ?? undefined, claimTopicOwnershipOnSpawn: (topicId) => _claimOwnershipForAutonomousSpawn ? _claimOwnershipForAutonomousSpawn(topicId) : 'unwired', 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, recordRopeResult: _recordRopeResult ?? 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, codexArmSessionSweeper, 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 });
|
|
29933
30292
|
if (_pendingCompactionEvidence)
|
|
29934
30293
|
featureEvidence.record('multiMachine.coherenceJournal.replication.compaction', _pendingCompactionEvidence); // Resolve the late-bound topic-operator getter (increment 2e): routing was
|
|
29935
30294
|
const readIdentityProjectionPeerRows = async () => {
|