instar 1.3.367 → 1.3.369
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/server.d.ts.map +1 -1
- package/dist/commands/server.js +104 -3
- package/dist/commands/server.js.map +1 -1
- package/dist/config/ConfigDefaults.d.ts.map +1 -1
- package/dist/config/ConfigDefaults.js +11 -0
- package/dist/config/ConfigDefaults.js.map +1 -1
- package/dist/core/CoherenceJournal.d.ts +8 -0
- package/dist/core/CoherenceJournal.d.ts.map +1 -1
- package/dist/core/CoherenceJournal.js +62 -3
- package/dist/core/CoherenceJournal.js.map +1 -1
- package/dist/core/CommitmentsSync.d.ts +144 -0
- package/dist/core/CommitmentsSync.d.ts.map +1 -0
- package/dist/core/CommitmentsSync.js +293 -0
- package/dist/core/CommitmentsSync.js.map +1 -0
- package/dist/core/MeshRpc.d.ts +6 -0
- package/dist/core/MeshRpc.d.ts.map +1 -1
- package/dist/core/MeshRpc.js +1 -0
- package/dist/core/MeshRpc.js.map +1 -1
- package/dist/core/PeerPresencePuller.d.ts +19 -0
- package/dist/core/PeerPresencePuller.d.ts.map +1 -1
- package/dist/core/PeerPresencePuller.js +7 -0
- package/dist/core/PeerPresencePuller.js.map +1 -1
- package/dist/core/types.d.ts +13 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/monitoring/CommitmentTracker.d.ts +40 -0
- package/dist/monitoring/CommitmentTracker.d.ts.map +1 -1
- package/dist/monitoring/CommitmentTracker.js +95 -4
- package/dist/monitoring/CommitmentTracker.js.map +1 -1
- package/dist/server/AgentServer.d.ts +3 -0
- package/dist/server/AgentServer.d.ts.map +1 -1
- package/dist/server/AgentServer.js +1 -0
- package/dist/server/AgentServer.js.map +1 -1
- package/dist/server/routes.d.ts +4 -0
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/routes.js +20 -1
- package/dist/server/routes.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +47 -47
- package/src/data/state-coherence-registry.json +13 -1
- package/upgrades/1.3.369.md +81 -0
- package/upgrades/side-effects/commitments-sync-p15a.md +93 -0
- package/upgrades/side-effects/journal-lock-retry-pin-fallback.md +64 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA6SH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAuxDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA6SH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAuxDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAqgTtE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
|
package/dist/commands/server.js
CHANGED
|
@@ -2363,6 +2363,10 @@ export async function startServer(options) {
|
|
|
2363
2363
|
// the mesh client) can reference it lazily; constructed in the mesh-wiring
|
|
2364
2364
|
// block ONLY under the same explicit replication gate.
|
|
2365
2365
|
let workingSetPullCoordinator;
|
|
2366
|
+
// Commitments-coherence receive side (COMMITMENTS-COHERENCE-SPEC §3.2) —
|
|
2367
|
+
// same explicit replication gate; undefined = dark (verb answers
|
|
2368
|
+
// 'disabled', merge layer returns own rows only).
|
|
2369
|
+
let commitmentReplicaStore;
|
|
2366
2370
|
{
|
|
2367
2371
|
const cjCfg = config.multiMachine?.coherenceJournal;
|
|
2368
2372
|
const cjEnabled = cjCfg?.enabled ?? !!config.developmentAgent;
|
|
@@ -2463,6 +2467,12 @@ export async function startServer(options) {
|
|
|
2463
2467
|
continue;
|
|
2464
2468
|
if (!seenRuns.has(j.topic)) {
|
|
2465
2469
|
const runId = autonomousRunId(j.startedAt, j.topic);
|
|
2470
|
+
// #925: while the writer is locked out the emit below is
|
|
2471
|
+
// dropped — do NOT mark the run seen, so it re-emits on a
|
|
2472
|
+
// later tick once the lock recovers (op-key dedupe makes
|
|
2473
|
+
// re-emits safe).
|
|
2474
|
+
if (journal.isLockedOut)
|
|
2475
|
+
continue;
|
|
2466
2476
|
seenRuns.set(j.topic, { runId, file: j.file });
|
|
2467
2477
|
journal.emitAutonomousRun(topicNum, { action: 'started', runId, artifactPaths: [j.file] });
|
|
2468
2478
|
}
|
|
@@ -6350,6 +6360,9 @@ export async function startServer(options) {
|
|
|
6350
6360
|
const commitmentTracker = new CommitmentTracker({
|
|
6351
6361
|
stateDir: config.stateDir,
|
|
6352
6362
|
liveConfig,
|
|
6363
|
+
// P1.5 §3.1: the creator stamp — (originMachineId, id) is the
|
|
6364
|
+
// cross-machine identity (ids are per-machine sequential counters).
|
|
6365
|
+
...(cjOwnMachineId ? { originMachineId: cjOwnMachineId } : {}),
|
|
6353
6366
|
onViolation: (commitment, detail) => {
|
|
6354
6367
|
notify('IMMEDIATE', 'commitment', `You asked me to "${commitment.userRequest}" but it looks like that setting reverted. ${detail}`);
|
|
6355
6368
|
},
|
|
@@ -9893,7 +9906,13 @@ export async function startServer(options) {
|
|
|
9893
9906
|
const journalAdvert = coherenceJournal
|
|
9894
9907
|
? { [cjOwnMachineId ?? meshSelfId]: coherenceJournal.getOwnAdvert() }
|
|
9895
9908
|
: {};
|
|
9896
|
-
|
|
9909
|
+
// COMMITMENTS-COHERENCE-SPEC §3.2: the commitments advert —
|
|
9910
|
+
// answered from MEMORY (never a disk read on the presence
|
|
9911
|
+
// tick). Omitted while the layer is dark; old peers ignore it.
|
|
9912
|
+
const commitmentsAdvert = commitmentReplicaStore
|
|
9913
|
+
? commitmentTracker.getReplicationAdvert() ?? undefined
|
|
9914
|
+
: undefined;
|
|
9915
|
+
return { ...base, journalAdvert, ...(commitmentsAdvert ? { commitmentsAdvert } : {}) };
|
|
9897
9916
|
},
|
|
9898
9917
|
// COHERENCE-JOURNAL-SPEC §3.4 — always-registered journal-sync verb
|
|
9899
9918
|
// (harmless when no peer sends): serve our OWN stream on `request`
|
|
@@ -9929,6 +9948,26 @@ export async function startServer(options) {
|
|
|
9929
9948
|
return { ok: false, reason: 'working-set disabled' };
|
|
9930
9949
|
return workingSetPullServer.handle(cmd);
|
|
9931
9950
|
},
|
|
9951
|
+
// COMMITMENTS-COHERENCE-SPEC §3.2 — serve OWN commitment records
|
|
9952
|
+
// as seq-windowed delta pages. Registered always (lockstep with
|
|
9953
|
+
// the union+RBAC edits); answers 'disabled' until the replication
|
|
9954
|
+
// gate constructs the layer AND the tracker advertises.
|
|
9955
|
+
'commitments-sync': async (cmd) => {
|
|
9956
|
+
const c = cmd;
|
|
9957
|
+
if (!commitmentReplicaStore || !commitmentTracker)
|
|
9958
|
+
return { ok: false, reason: 'commitments-sync disabled' };
|
|
9959
|
+
const advert = commitmentTracker.getReplicationAdvert();
|
|
9960
|
+
if (!advert)
|
|
9961
|
+
return { ok: false, reason: 'commitments-sync disabled' };
|
|
9962
|
+
const syncMod = await import('../core/CommitmentsSync.js');
|
|
9963
|
+
const wsCfgC = config.multiMachine?.coherenceJournal?.commitments;
|
|
9964
|
+
return syncMod.buildCommitmentsSyncPage(c.request, {
|
|
9965
|
+
ownMachineId: cjOwnMachineId ?? meshSelfId,
|
|
9966
|
+
records: commitmentTracker.getAll(),
|
|
9967
|
+
advert,
|
|
9968
|
+
syncPageBytes: wsCfgC?.syncPageBytes,
|
|
9969
|
+
});
|
|
9970
|
+
},
|
|
9932
9971
|
place: ownAction,
|
|
9933
9972
|
claim: ownAction,
|
|
9934
9973
|
transfer: ownAction,
|
|
@@ -10060,7 +10099,21 @@ export async function startServer(options) {
|
|
|
10060
10099
|
const wsSelf = cjOwnMachineId ?? meshSelfId;
|
|
10061
10100
|
const wsOwnerOf = (topic) => {
|
|
10062
10101
|
const rec = sessionOwnershipRegistry?.read(String(topic));
|
|
10063
|
-
|
|
10102
|
+
if (rec?.ownerMachineId) {
|
|
10103
|
+
return { owner: rec.ownerMachineId, epoch: rec.ownershipEpoch ?? null };
|
|
10104
|
+
}
|
|
10105
|
+
// Issue #926 (live 2026-06-06): ownership only CASes when real
|
|
10106
|
+
// traffic flows — a QUIET topic just moved here has owner:null
|
|
10107
|
+
// + a pin. The pin IS the live placement authority for unowned
|
|
10108
|
+
// topics; without this fallback the fetch reflex refuses in
|
|
10109
|
+
// exactly the post-move state it exists for. Epoch 0 keeps the
|
|
10110
|
+
// per-write recheck coherent (a real claim bumps past it and
|
|
10111
|
+
// the in-flight pull aborts as superseded, by design).
|
|
10112
|
+
const pin = _topicPinStore?.get(String(topic));
|
|
10113
|
+
if (pin?.pinned && pin.preferredMachine === wsSelf) {
|
|
10114
|
+
return { owner: wsSelf, epoch: 0 };
|
|
10115
|
+
}
|
|
10116
|
+
return { owner: null, epoch: null };
|
|
10064
10117
|
};
|
|
10065
10118
|
workingSetPullCoordinator = new wscMod.WorkingSetPullCoordinator({
|
|
10066
10119
|
stateDir: config.stateDir,
|
|
@@ -10151,6 +10204,21 @@ export async function startServer(options) {
|
|
|
10151
10204
|
if (typeof wsGuardTimer.unref === 'function')
|
|
10152
10205
|
wsGuardTimer.unref();
|
|
10153
10206
|
console.log(pc.dim(' [working-set] pull coordinator wired (trigger + reflex + drain + sweep + visibility guard)'));
|
|
10207
|
+
// ── Commitments-coherence receive side (P1.5a §3.2) ──
|
|
10208
|
+
// Same explicit replication gate. The puller drive below pulls
|
|
10209
|
+
// delta pages whenever a peer's advert is ahead of our cursor.
|
|
10210
|
+
try {
|
|
10211
|
+
const csMod = await import('../core/CommitmentsSync.js');
|
|
10212
|
+
commitmentReplicaStore = new csMod.CommitmentReplicaStore({
|
|
10213
|
+
stateDir: config.stateDir,
|
|
10214
|
+
logger: (m) => console.log(pc.dim(` [commitments-sync] ${m}`)),
|
|
10215
|
+
});
|
|
10216
|
+
console.log(pc.dim(' [commitments-sync] replica store wired (serve + receive + advert)'));
|
|
10217
|
+
}
|
|
10218
|
+
catch (e) { /* @silent-fallback-ok: commitments-sync construction failure degrades to local-only commitments — never blocks boot (COMMITMENTS-COHERENCE-SPEC §4) */
|
|
10219
|
+
commitmentReplicaStore = undefined;
|
|
10220
|
+
console.log(pc.dim(` [commitments-sync] not constructed: ${e instanceof Error ? e.message : String(e)}`));
|
|
10221
|
+
}
|
|
10154
10222
|
}
|
|
10155
10223
|
catch (e) { /* @silent-fallback-ok: working-set pull wiring failure degrades to serve-only (the verb still answers); never blocks server boot (WORKING-SET-HANDOFF-SPEC §4) */
|
|
10156
10224
|
workingSetPullCoordinator = undefined;
|
|
@@ -10411,6 +10479,39 @@ export async function startServer(options) {
|
|
|
10411
10479
|
},
|
|
10412
10480
|
// REPLICATION-GATED: present only when replication.enabled === true.
|
|
10413
10481
|
..._journalDeltaDeps,
|
|
10482
|
+
// COMMITMENTS-COHERENCE-SPEC §3.2 — pull delta pages when the
|
|
10483
|
+
// peer's advert is ahead of our replica cursor; bounded pages per
|
|
10484
|
+
// tick (the remainder rides the next pass). No-op while dark.
|
|
10485
|
+
driveCommitmentsSync: async (machineId, url, advert) => {
|
|
10486
|
+
if (!commitmentReplicaStore)
|
|
10487
|
+
return;
|
|
10488
|
+
const cursor = commitmentReplicaStore.cursorFor(machineId);
|
|
10489
|
+
const upToDate = cursor.incarnation === advert.incarnation && cursor.sinceSeq >= advert.replicationSeq;
|
|
10490
|
+
if (upToDate)
|
|
10491
|
+
return;
|
|
10492
|
+
const csCfg = config.multiMachine?.coherenceJournal?.commitments;
|
|
10493
|
+
const maxPages = csCfg?.maxSyncPagesPerTick ?? 4;
|
|
10494
|
+
let since = cursor.incarnation === advert.incarnation ? cursor.sinceSeq : 0;
|
|
10495
|
+
let inc = cursor.incarnation;
|
|
10496
|
+
for (let i = 0; i < maxPages; i++) {
|
|
10497
|
+
const res = await meshClient.send({ machineId, url }, { type: 'commitments-sync', request: { sinceSeq: since, ...(inc ? { incarnation: inc } : {}) } }, 0);
|
|
10498
|
+
if (!res.ok || !res.result || typeof res.result !== 'object')
|
|
10499
|
+
return;
|
|
10500
|
+
const page = res.result;
|
|
10501
|
+
if (!page.incarnation)
|
|
10502
|
+
return; // 'disabled' answer shape
|
|
10503
|
+
commitmentReplicaStore.applyPage(machineId, page);
|
|
10504
|
+
if (page.incarnationChanged) {
|
|
10505
|
+
inc = page.incarnation;
|
|
10506
|
+
since = 0;
|
|
10507
|
+
continue;
|
|
10508
|
+
}
|
|
10509
|
+
since = page.nextSinceSeq;
|
|
10510
|
+
inc = page.incarnation;
|
|
10511
|
+
if (page.done)
|
|
10512
|
+
return;
|
|
10513
|
+
}
|
|
10514
|
+
},
|
|
10414
10515
|
});
|
|
10415
10516
|
void peerPresencePuller.pullOnce();
|
|
10416
10517
|
const peerPresenceTimer = setInterval(() => { void peerPresencePuller.pullOnce(); }, 30_000);
|
|
@@ -10651,7 +10752,7 @@ export async function startServer(options) {
|
|
|
10651
10752
|
catch (err) {
|
|
10652
10753
|
console.log(pc.dim(` [session-pool] rollout gate not wired: ${err instanceof Error ? err.message : String(err)}`));
|
|
10653
10754
|
}
|
|
10654
|
-
const server = new AgentServer({ config, sessionManager, state, scheduler, telegram, relationships, feedback, feedbackAnomalyDetector, dispatches, updateChecker, autoUpdater, autoDispatcher, quotaTracker, quotaManager, publisher, viewer, tunnel, evolution, watchdog, topicMemory, triageNurse, projectMapper, coherenceGate: scopeVerifier, contextHierarchy, canonicalState, operationGate, sentinel, adaptiveTrust, memoryMonitor, orphanReaper, coherenceMonitor, commitmentTracker, semanticMemory, activitySentinel, rateLimitSentinel, releaseReadinessSentinel: releaseReadinessSentinel ?? undefined, messageRouter, summarySentinel, spawnManager, systemReviewer, capabilityMapper, selfKnowledgeTree, coverageAuditor, topicResumeMap: _topicResumeMap ?? undefined, sessionRefresh: _sessionRefresh ?? undefined, autonomyManager, trustElevationTracker, autonomousEvolution, coordinator: coordinator.enabled ? coordinator : undefined, localSigningKeyPem, leaseTransport, onLeasePullRequest: () => leaseCoordinatorRef?.currentLease() ?? null, liveTailReceiver, handoffWireTransport, onHandoffBegin, onHandoffInitiate: handoffInitiate, handoffInProgress: handoffSentinelInProgress, messageLedger, currentInboundByTopic, replyMarkerTransport, onReplyMarker: messageLedger ? (marker) => { const m = marker; messageLedger.applyRemoteReplyMarker(m.dedupeKey, { platform: m.platform, replyIdempotencyKey: m.replyIdempotencyKey, epoch: m.epoch, topic: m.topic ?? null }); } : undefined, whatsapp: whatsappAdapter, slack: slackAdapter, imessage: imessageAdapter, whatsappBusinessBackend, messageBridge, hookEventReceiver, worktreeMonitor, subagentTracker, instructionsVerifier, handshakeManager: threadlineHandshake, threadlineRouter, conversationStore, warrantsReplyGate, collaborationSurfacer, threadResumeMap, topicLinkageHandler: topicLinkageHandler ?? undefined, threadlineRelayClient, threadlineReplyWaiters, listenerManager: listenerManager ?? undefined, responseReviewGate, messagingToneGate, outboundDedupGate, telemetryHeartbeat, pasteManager, featureRegistry, discoveryEvaluator, completionEvaluator, unifiedTrust, liveConfig, sharedStateLedger, ledgerSessionRegistry, worktreeManager, oidcEnrolledRepos: parallelDevConfig?.oidcEnrolledRepos, initiativeTracker, projectRoundRunner, projectDriftChecker, machineHeartbeat, machinePoolRegistry, meshRpcDispatcher, workingSetPullCoordinator, sessionOwnershipRegistry, topicPinStore: _topicPinStore ?? undefined, secretSync: _secretSyncHandle ?? undefined, meshSelfId: _meshSelfId ?? undefined, resolveRouterUrl: _resolveRouterUrl ?? undefined, resolvePeerUrls: _resolvePeerUrls ?? undefined, sessionPoolE2EResultStore, proxyCoordinator, topicIntentStore, topicIntentArcCheck, usherSignalStore, intelligence: sharedIntelligence ?? undefined, telegramBridgeConfig, telegramBridge: telegramBridge ?? undefined, threadlineObservability, briefDeps, workingMemory, taskFlowRegistry, threadlineFlowBridge, sessionReaper, agentWorktreeReaper, mcpProcessReaper, geminiLoopRunner, sleepController, agentActivityState, reapLog, sleepWakeDetector, unjustifiedStopGate, stopGateDb, stopNotifier });
|
|
10755
|
+
const server = new AgentServer({ config, sessionManager, state, scheduler, telegram, relationships, feedback, feedbackAnomalyDetector, dispatches, updateChecker, autoUpdater, autoDispatcher, quotaTracker, quotaManager, publisher, viewer, tunnel, evolution, watchdog, topicMemory, triageNurse, projectMapper, coherenceGate: scopeVerifier, contextHierarchy, canonicalState, operationGate, sentinel, adaptiveTrust, memoryMonitor, orphanReaper, coherenceMonitor, commitmentTracker, semanticMemory, activitySentinel, rateLimitSentinel, releaseReadinessSentinel: releaseReadinessSentinel ?? undefined, messageRouter, summarySentinel, spawnManager, systemReviewer, capabilityMapper, selfKnowledgeTree, coverageAuditor, topicResumeMap: _topicResumeMap ?? undefined, sessionRefresh: _sessionRefresh ?? undefined, autonomyManager, trustElevationTracker, autonomousEvolution, coordinator: coordinator.enabled ? coordinator : undefined, localSigningKeyPem, leaseTransport, onLeasePullRequest: () => leaseCoordinatorRef?.currentLease() ?? null, liveTailReceiver, handoffWireTransport, onHandoffBegin, onHandoffInitiate: handoffInitiate, handoffInProgress: handoffSentinelInProgress, messageLedger, currentInboundByTopic, replyMarkerTransport, onReplyMarker: messageLedger ? (marker) => { const m = marker; messageLedger.applyRemoteReplyMarker(m.dedupeKey, { platform: m.platform, replyIdempotencyKey: m.replyIdempotencyKey, epoch: m.epoch, topic: m.topic ?? null }); } : undefined, whatsapp: whatsappAdapter, slack: slackAdapter, imessage: imessageAdapter, whatsappBusinessBackend, messageBridge, hookEventReceiver, worktreeMonitor, subagentTracker, instructionsVerifier, handshakeManager: threadlineHandshake, threadlineRouter, conversationStore, warrantsReplyGate, collaborationSurfacer, threadResumeMap, topicLinkageHandler: topicLinkageHandler ?? undefined, threadlineRelayClient, threadlineReplyWaiters, listenerManager: listenerManager ?? undefined, responseReviewGate, messagingToneGate, outboundDedupGate, telemetryHeartbeat, pasteManager, featureRegistry, discoveryEvaluator, completionEvaluator, unifiedTrust, liveConfig, sharedStateLedger, ledgerSessionRegistry, worktreeManager, oidcEnrolledRepos: parallelDevConfig?.oidcEnrolledRepos, initiativeTracker, projectRoundRunner, projectDriftChecker, machineHeartbeat, machinePoolRegistry, meshRpcDispatcher, workingSetPullCoordinator, commitmentReplicaStore, sessionOwnershipRegistry, topicPinStore: _topicPinStore ?? undefined, secretSync: _secretSyncHandle ?? undefined, meshSelfId: _meshSelfId ?? undefined, resolveRouterUrl: _resolveRouterUrl ?? undefined, resolvePeerUrls: _resolvePeerUrls ?? undefined, sessionPoolE2EResultStore, proxyCoordinator, topicIntentStore, topicIntentArcCheck, usherSignalStore, intelligence: sharedIntelligence ?? undefined, telegramBridgeConfig, telegramBridge: telegramBridge ?? undefined, threadlineObservability, briefDeps, workingMemory, taskFlowRegistry, threadlineFlowBridge, sessionReaper, agentWorktreeReaper, mcpProcessReaper, geminiLoopRunner, sleepController, agentActivityState, reapLog, sleepWakeDetector, unjustifiedStopGate, stopGateDb, stopNotifier });
|
|
10655
10756
|
// Boot-recovery (tunnel-failure-resilience spec Part 6): if the agent
|
|
10656
10757
|
// died mid-relay-episode, the persisted tunnel.json carries
|
|
10657
10758
|
// rotationPending=true. Rotate the dashboard PIN + authToken BEFORE
|