instar 1.2.31 → 1.2.33
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 +102 -3
- package/dist/commands/server.js.map +1 -1
- package/dist/config/ConfigDefaults.d.ts.map +1 -1
- package/dist/config/ConfigDefaults.js +6 -0
- package/dist/config/ConfigDefaults.js.map +1 -1
- package/dist/core/SessionManager.d.ts +7 -0
- package/dist/core/SessionManager.d.ts.map +1 -1
- package/dist/core/SessionManager.js +23 -0
- package/dist/core/SessionManager.js.map +1 -1
- package/dist/core/types.d.ts +42 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/monitoring/CompactionSentinel.d.ts +9 -0
- package/dist/monitoring/CompactionSentinel.d.ts.map +1 -1
- package/dist/monitoring/CompactionSentinel.js +9 -0
- package/dist/monitoring/CompactionSentinel.js.map +1 -1
- package/dist/monitoring/PresenceProxy.d.ts +9 -0
- package/dist/monitoring/PresenceProxy.d.ts.map +1 -1
- package/dist/monitoring/PresenceProxy.js +9 -0
- package/dist/monitoring/PresenceProxy.js.map +1 -1
- package/dist/monitoring/RateLimitSentinel.d.ts +140 -0
- package/dist/monitoring/RateLimitSentinel.d.ts.map +1 -0
- package/dist/monitoring/RateLimitSentinel.js +308 -0
- package/dist/monitoring/RateLimitSentinel.js.map +1 -0
- package/dist/monitoring/SessionActivitySentinel.d.ts +16 -0
- package/dist/monitoring/SessionActivitySentinel.d.ts.map +1 -1
- package/dist/monitoring/SessionActivitySentinel.js +18 -0
- package/dist/monitoring/SessionActivitySentinel.js.map +1 -1
- package/dist/monitoring/SessionWatchdog.d.ts +11 -0
- package/dist/monitoring/SessionWatchdog.d.ts.map +1 -1
- package/dist/monitoring/SessionWatchdog.js +47 -0
- package/dist/monitoring/SessionWatchdog.js.map +1 -1
- package/dist/monitoring/rateLimitDetection.d.ts +45 -0
- package/dist/monitoring/rateLimitDetection.d.ts.map +1 -0
- package/dist/monitoring/rateLimitDetection.js +71 -0
- package/dist/monitoring/rateLimitDetection.js.map +1 -0
- package/dist/server/AgentServer.d.ts +1 -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/CapabilityIndex.d.ts.map +1 -1
- package/dist/server/CapabilityIndex.js +1 -0
- package/dist/server/CapabilityIndex.js.map +1 -1
- package/dist/server/routes.d.ts +1 -0
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/routes.js +24 -0
- package/dist/server/routes.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +48 -48
- package/upgrades/1.2.29.md +24 -0
- package/upgrades/1.2.32.md +37 -0
- package/upgrades/1.2.33.md +57 -0
- package/upgrades/side-effects/feat-periodic-sentinel-scan.md +65 -0
- package/upgrades/side-effects/rate-limit-internal-prefix.md +41 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAkQH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAiqDD,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;AAkQH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAiqDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAyjLtE;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
|
@@ -3722,7 +3722,7 @@ export async function startServer(options) {
|
|
|
3722
3722
|
// Creates mid-session mini-digests via LLM, and session syntheses on completion.
|
|
3723
3723
|
let activitySentinel;
|
|
3724
3724
|
if (sharedIntelligence) {
|
|
3725
|
-
const { SessionActivitySentinel } = await import('../monitoring/SessionActivitySentinel.js');
|
|
3725
|
+
const { SessionActivitySentinel, resolveSentinelScanIntervalMs } = await import('../monitoring/SessionActivitySentinel.js');
|
|
3726
3726
|
activitySentinel = new SessionActivitySentinel({
|
|
3727
3727
|
stateDir: config.stateDir,
|
|
3728
3728
|
intelligence: sharedIntelligence,
|
|
@@ -3753,6 +3753,35 @@ export async function startServer(options) {
|
|
|
3753
3753
|
console.error(`[ActivitySentinel] Synthesis failed for ${session.name}: ${err instanceof Error ? err.message : err}`);
|
|
3754
3754
|
});
|
|
3755
3755
|
});
|
|
3756
|
+
// Periodic mid-session scan. Without this, the sentinel only digests on
|
|
3757
|
+
// sessionComplete — so a long-running Telegram session that never cleanly
|
|
3758
|
+
// ends (compaction, multi-day topic, machine restart) accumulates hours
|
|
3759
|
+
// of activity that is never digested, and the entities within it never
|
|
3760
|
+
// reach SemanticMemory. The periodic scan digests in-flight activity on a
|
|
3761
|
+
// cadence so the knowledge graph grows throughout long sessions, not just
|
|
3762
|
+
// at the end. scan() is internally idempotent (hash-keyed digests),
|
|
3763
|
+
// skips dormant sessions, and enforces a minimum-activity threshold, so a
|
|
3764
|
+
// frequent cadence is safe.
|
|
3765
|
+
const scanIntervalMs = resolveSentinelScanIntervalMs(config.monitoring.episodicSentinel);
|
|
3766
|
+
if (scanIntervalMs !== null) {
|
|
3767
|
+
const scanMinutes = Math.round(scanIntervalMs / 60_000);
|
|
3768
|
+
const activityScanTimer = setInterval(() => {
|
|
3769
|
+
// Only the awake machine scans — mirrors the scheduler gating so
|
|
3770
|
+
// standby machines in a multi-machine setup don't double-digest.
|
|
3771
|
+
if (coordinator.enabled && !coordinator.isAwake)
|
|
3772
|
+
return;
|
|
3773
|
+
activitySentinel.scan().then((report) => {
|
|
3774
|
+
if (report.digestsCreated > 0) {
|
|
3775
|
+
console.log(`[ActivitySentinel] Periodic scan: ${report.digestsCreated} digest(s) across ${report.sessionsScanned} session(s)`);
|
|
3776
|
+
}
|
|
3777
|
+
}).catch((err) => {
|
|
3778
|
+
console.error(`[ActivitySentinel] Periodic scan failed: ${err instanceof Error ? err.message : err}`);
|
|
3779
|
+
});
|
|
3780
|
+
}, scanIntervalMs);
|
|
3781
|
+
if (activityScanTimer.unref)
|
|
3782
|
+
activityScanTimer.unref();
|
|
3783
|
+
console.log(pc.dim(` Episodic memory sentinel: periodic scan every ${scanMinutes}min`));
|
|
3784
|
+
}
|
|
3756
3785
|
const semStatus = semanticMemory ? 'with entity extraction' : 'digests only (no SemanticMemory)';
|
|
3757
3786
|
console.log(pc.green(` Episodic memory sentinel enabled (LLM-powered digestion, ${semStatus})`));
|
|
3758
3787
|
}
|
|
@@ -4552,7 +4581,68 @@ export async function startServer(options) {
|
|
|
4552
4581
|
},
|
|
4553
4582
|
// Defaults are production-sensible; override here only if needed.
|
|
4554
4583
|
{});
|
|
4555
|
-
|
|
4584
|
+
// ── RateLimitSentinel ─────────────────────────────────────────────
|
|
4585
|
+
// Rides out Anthropic's server-side capacity throttle ("Server is
|
|
4586
|
+
// temporarily limiting requests · not your usage limit") with
|
|
4587
|
+
// backoff-before-nudge + user check-ins, instead of the single immediate
|
|
4588
|
+
// nudge (quota burn) → silence the session used to fall into. See
|
|
4589
|
+
// docs/specs/rate-limit-sentinel.md.
|
|
4590
|
+
const { RateLimitSentinel } = await import('../monitoring/RateLimitSentinel.js');
|
|
4591
|
+
const getClaudeSessionIdForName = (sessionName) => sessionManager.listRunningSessions().find(s => s.tmuxSession === sessionName)?.claudeSessionId;
|
|
4592
|
+
// Neutral "continue" nudge — NOT the compaction-resume payload (which would
|
|
4593
|
+
// falsely tell the agent its memory was reset). Topic-tagged so InputGuard
|
|
4594
|
+
// accepts it.
|
|
4595
|
+
const rateLimitResume = async (sessionName) => {
|
|
4596
|
+
if (!sessionManager.isSessionAlive(sessionName))
|
|
4597
|
+
return false;
|
|
4598
|
+
const topicId = telegram?.getTopicForSession(sessionName);
|
|
4599
|
+
if (topicId == null)
|
|
4600
|
+
return false;
|
|
4601
|
+
const tagged = `[telegram:${topicId}] The temporary server throttle should have cleared — please continue where you left off.`;
|
|
4602
|
+
return sessionManager.injectMessage(sessionName, tagged);
|
|
4603
|
+
};
|
|
4604
|
+
// Route a user-facing notice for the session's topic (Telegram).
|
|
4605
|
+
const rateLimitNotify = async (sessionName, text) => {
|
|
4606
|
+
const topicId = telegram?.getTopicForSession(sessionName);
|
|
4607
|
+
if (topicId == null)
|
|
4608
|
+
return;
|
|
4609
|
+
const resp = await fetch(`http://localhost:${config.port}/telegram/reply/${topicId}`, {
|
|
4610
|
+
method: 'POST',
|
|
4611
|
+
headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${config.authToken}` },
|
|
4612
|
+
body: JSON.stringify({ text }),
|
|
4613
|
+
});
|
|
4614
|
+
if (!resp.ok)
|
|
4615
|
+
throw new Error(`rate-limit notify failed: ${resp.status}`);
|
|
4616
|
+
};
|
|
4617
|
+
const rlsCfg = config.monitoring?.rateLimitSentinel ?? { enabled: true };
|
|
4618
|
+
const rateLimitSentinel = new RateLimitSentinel({
|
|
4619
|
+
resumeFn: rateLimitResume,
|
|
4620
|
+
notifyFn: rateLimitNotify,
|
|
4621
|
+
projectDir: config.projectDir,
|
|
4622
|
+
getClaudeSessionId: getClaudeSessionIdForName,
|
|
4623
|
+
}, rlsCfg);
|
|
4624
|
+
// Zombie-kill veto: compose BOTH sentinels (editing the single-predicate
|
|
4625
|
+
// checker — a second setActiveRecoveryChecker call would drop the
|
|
4626
|
+
// compaction veto).
|
|
4627
|
+
sessionManager.setActiveRecoveryChecker(session => compactionSentinel.isRecoveryActive(session.tmuxSession) ||
|
|
4628
|
+
rateLimitSentinel.isRecoveryActive(session.tmuxSession));
|
|
4629
|
+
// Bidirectional deferral — neither sentinel injects into a pane the other
|
|
4630
|
+
// already owns.
|
|
4631
|
+
rateLimitSentinel.setDeferIf(s => compactionSentinel.isRecoveryActive(s));
|
|
4632
|
+
compactionSentinel.setDeferIf(s => rateLimitSentinel.isRecoveryActive(s));
|
|
4633
|
+
// Triggers: watchdog poll + SessionManager idle-error emit. Both deduped by
|
|
4634
|
+
// the sentinel.
|
|
4635
|
+
if (watchdog) {
|
|
4636
|
+
watchdog.on('rate-limited', (sessionName) => {
|
|
4637
|
+
rateLimitSentinel.report(sessionName, 'watchdog-poll');
|
|
4638
|
+
});
|
|
4639
|
+
}
|
|
4640
|
+
sessionManager.on('rateLimitedAtIdle', (sessionName) => {
|
|
4641
|
+
rateLimitSentinel.report(sessionName, 'idle-error');
|
|
4642
|
+
});
|
|
4643
|
+
if (rlsCfg.enabled !== false) {
|
|
4644
|
+
console.log(pc.green(' RateLimitSentinel enabled (server-throttle backoff + check-ins)'));
|
|
4645
|
+
}
|
|
4556
4646
|
console.log(pc.green(' CompactionSentinel enabled (verified recovery lifecycle)'));
|
|
4557
4647
|
// Trigger 1: PreCompact hook event — report to sentinel.
|
|
4558
4648
|
hookEventReceiver.on('PreCompact', () => {
|
|
@@ -4989,6 +5079,15 @@ export async function startServer(options) {
|
|
|
4989
5079
|
// BUILD-STALL-VISIBILITY-SPEC Fix 2 — suppress generic standby when
|
|
4990
5080
|
// a /build heartbeat landed recently on this topic.
|
|
4991
5081
|
hasRecentBuildHeartbeat: (topicId, windowMs) => proxyCoordinator.hasRecentBuildHeartbeat(topicId, windowMs),
|
|
5082
|
+
// Suppress ALL tiers while the RateLimitSentinel owns the voice for
|
|
5083
|
+
// this topic's session (server-throttle recovery).
|
|
5084
|
+
hasActiveRateLimitRecovery: (topicId) => {
|
|
5085
|
+
const slackChId = slackProxyChannelMap.get(topicId);
|
|
5086
|
+
const sessionName = (slackChId && _slackAdapter)
|
|
5087
|
+
? _slackAdapter.getSessionForChannel(slackChId)
|
|
5088
|
+
: telegram.getSessionForTopic(topicId);
|
|
5089
|
+
return sessionName ? rateLimitSentinel.isRecoveryActive(sessionName) : false;
|
|
5090
|
+
},
|
|
4992
5091
|
// Shared LLM queue (interactive lane) — cross-monitor concurrency
|
|
4993
5092
|
// and daily-spend-cap with PromiseBeacon.
|
|
4994
5093
|
sharedLlmQueue,
|
|
@@ -6583,7 +6682,7 @@ export async function startServer(options) {
|
|
|
6583
6682
|
},
|
|
6584
6683
|
});
|
|
6585
6684
|
}
|
|
6586
|
-
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, messageRouter, summarySentinel, spawnManager, systemReviewer, capabilityMapper, selfKnowledgeTree, coverageAuditor, topicResumeMap: _topicResumeMap ?? undefined, sessionRefresh: _sessionRefresh ?? undefined, autonomyManager, trustElevationTracker, autonomousEvolution, coordinator: coordinator.enabled ? coordinator : undefined, localSigningKeyPem, whatsapp: whatsappAdapter, slack: slackAdapter, imessage: imessageAdapter, whatsappBusinessBackend, messageBridge, hookEventReceiver, worktreeMonitor, subagentTracker, instructionsVerifier, handshakeManager: threadlineHandshake, threadlineRouter, threadResumeMap, topicLinkageHandler: topicLinkageHandler ?? undefined, threadlineRelayClient, threadlineReplyWaiters, listenerManager: listenerManager ?? undefined, responseReviewGate, messagingToneGate, outboundDedupGate, telemetryHeartbeat, pasteManager, featureRegistry, discoveryEvaluator, unifiedTrust, liveConfig, sharedStateLedger, ledgerSessionRegistry, worktreeManager, oidcEnrolledRepos: parallelDevConfig?.oidcEnrolledRepos, initiativeTracker, projectRoundRunner, projectDriftChecker, machineHeartbeat, proxyCoordinator, telegramBridgeConfig, telegramBridge: telegramBridge ?? undefined, threadlineObservability, workingMemory, taskFlowRegistry, threadlineFlowBridge });
|
|
6685
|
+
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, messageRouter, summarySentinel, spawnManager, systemReviewer, capabilityMapper, selfKnowledgeTree, coverageAuditor, topicResumeMap: _topicResumeMap ?? undefined, sessionRefresh: _sessionRefresh ?? undefined, autonomyManager, trustElevationTracker, autonomousEvolution, coordinator: coordinator.enabled ? coordinator : undefined, localSigningKeyPem, whatsapp: whatsappAdapter, slack: slackAdapter, imessage: imessageAdapter, whatsappBusinessBackend, messageBridge, hookEventReceiver, worktreeMonitor, subagentTracker, instructionsVerifier, handshakeManager: threadlineHandshake, threadlineRouter, threadResumeMap, topicLinkageHandler: topicLinkageHandler ?? undefined, threadlineRelayClient, threadlineReplyWaiters, listenerManager: listenerManager ?? undefined, responseReviewGate, messagingToneGate, outboundDedupGate, telemetryHeartbeat, pasteManager, featureRegistry, discoveryEvaluator, unifiedTrust, liveConfig, sharedStateLedger, ledgerSessionRegistry, worktreeManager, oidcEnrolledRepos: parallelDevConfig?.oidcEnrolledRepos, initiativeTracker, projectRoundRunner, projectDriftChecker, machineHeartbeat, proxyCoordinator, telegramBridgeConfig, telegramBridge: telegramBridge ?? undefined, threadlineObservability, workingMemory, taskFlowRegistry, threadlineFlowBridge });
|
|
6587
6686
|
await server.start();
|
|
6588
6687
|
void taskFlowSweeper;
|
|
6589
6688
|
void taskFlowDueWaker;
|