@songsid/agend 2.0.12 → 2.1.0-beta.10
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/backend/antigravity.js +3 -1
- package/dist/backend/antigravity.js.map +1 -1
- package/dist/backend/codex.js +3 -1
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/kiro.js +3 -2
- package/dist/backend/kiro.js.map +1 -1
- package/dist/backend/types.d.ts +12 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/cli.js +43 -6
- package/dist/cli.js.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/context-guardian.d.ts +2 -0
- package/dist/context-guardian.js +10 -2
- package/dist/context-guardian.js.map +1 -1
- package/dist/daemon-entry.js +2 -1
- package/dist/daemon-entry.js.map +1 -1
- package/dist/daemon.d.ts +78 -3
- package/dist/daemon.js +496 -27
- package/dist/daemon.js.map +1 -1
- package/dist/fleet-context.d.ts +7 -1
- package/dist/fleet-manager.d.ts +23 -2
- package/dist/fleet-manager.js +207 -65
- package/dist/fleet-manager.js.map +1 -1
- package/dist/instance-lifecycle.d.ts +6 -1
- package/dist/instance-lifecycle.js +45 -3
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/logger.js +6 -3
- package/dist/logger.js.map +1 -1
- package/dist/outbound-handlers.d.ts +5 -0
- package/dist/outbound-handlers.js +68 -16
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/statusline-watcher.d.ts +1 -1
- package/dist/statusline-watcher.js +3 -2
- package/dist/statusline-watcher.js.map +1 -1
- package/dist/tmux-manager.d.ts +2 -0
- package/dist/tmux-manager.js +9 -0
- package/dist/tmux-manager.js.map +1 -1
- package/dist/topic-archiver.d.ts +1 -1
- package/dist/topic-commands.d.ts +5 -1
- package/dist/topic-commands.js +72 -12
- package/dist/topic-commands.js.map +1 -1
- package/dist/transcript-monitor.js +2 -0
- package/dist/transcript-monitor.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/view-api.d.ts +1 -1
- package/dist/web-api.d.ts +2 -1
- package/dist/web-api.js +21 -14
- package/dist/web-api.js.map +1 -1
- package/package.json +1 -1
package/dist/daemon.d.ts
CHANGED
|
@@ -1,9 +1,58 @@
|
|
|
1
1
|
import { EventEmitter } from "node:events";
|
|
2
2
|
import type { InstanceConfig, RotationSnapshot } from "./types.js";
|
|
3
|
+
import type { Logger } from "./logger.js";
|
|
3
4
|
import { MessageBus } from "./channel/message-bus.js";
|
|
4
|
-
import type { CliBackend } from "./backend/types.js";
|
|
5
|
+
import type { CliBackend, InstanceState, InstanceStateSnapshot } from "./backend/types.js";
|
|
5
6
|
import { HangDetector } from "./hang-detector.js";
|
|
6
7
|
import type { TmuxControlClient } from "./tmux-control.js";
|
|
8
|
+
export declare const DEFAULT_STUCK_TIMEOUT_MS: number;
|
|
9
|
+
export declare const DEFAULT_STATE_POLL_INTERVAL_MS = 5000;
|
|
10
|
+
/** Headless idle timer used by the daemon and unit tests. */
|
|
11
|
+
export declare class AutoPauseController {
|
|
12
|
+
private readonly thresholdMs;
|
|
13
|
+
private idleSince;
|
|
14
|
+
private pausedAt;
|
|
15
|
+
constructor(thresholdMs: number);
|
|
16
|
+
observe(state: InstanceState, now?: number): boolean;
|
|
17
|
+
markPaused(now?: number): void;
|
|
18
|
+
markAwake(): void;
|
|
19
|
+
wakeOnDeliver(wake: () => Promise<void>): Promise<void>;
|
|
20
|
+
get isPaused(): boolean;
|
|
21
|
+
get lastPausedAt(): number | null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Headless state machine for pane-based execution state detection.
|
|
25
|
+
*
|
|
26
|
+
* Pane motion wins over a ready match because several backends keep their ready
|
|
27
|
+
* marker in a persistent header/footer while generating. A stable ready pane is
|
|
28
|
+
* idle; changing content is working; stable non-ready content eventually sticks.
|
|
29
|
+
*/
|
|
30
|
+
export declare class PaneStateMachine {
|
|
31
|
+
private readonly stuckTimeoutMs;
|
|
32
|
+
private readonly readyPattern;
|
|
33
|
+
private lastPaneHash;
|
|
34
|
+
private lastPaneChangeAt;
|
|
35
|
+
private lastObservedAt;
|
|
36
|
+
private stateChangedAt;
|
|
37
|
+
private currentState;
|
|
38
|
+
constructor(readyPattern: RegExp, stuckTimeoutMs?: number, now?: number);
|
|
39
|
+
observe(pane: string, now?: number): InstanceStateSnapshot;
|
|
40
|
+
snapshot(now?: number): InstanceStateSnapshot;
|
|
41
|
+
}
|
|
42
|
+
/** Tracks whether an inbound arrived after the most recent confirmed idle prompt. */
|
|
43
|
+
export declare class PendingWorkTracker {
|
|
44
|
+
private lastInboundAt;
|
|
45
|
+
private lastIdleAt;
|
|
46
|
+
private sequence;
|
|
47
|
+
private lastInboundOrder;
|
|
48
|
+
private lastIdleOrder;
|
|
49
|
+
constructor(now?: number);
|
|
50
|
+
recordInbound(now?: number): void;
|
|
51
|
+
recordIdle(now?: number): void;
|
|
52
|
+
hasPendingWork(): boolean;
|
|
53
|
+
}
|
|
54
|
+
/** Redact likely credentials and control sequences before pane text reaches logs. */
|
|
55
|
+
export declare function sanitizePaneTail(pane: string, lineCount?: number): string[];
|
|
7
56
|
export declare class Daemon extends EventEmitter {
|
|
8
57
|
private name;
|
|
9
58
|
private config;
|
|
@@ -45,6 +94,15 @@ export declare class Daemon extends EventEmitter {
|
|
|
45
94
|
private rotationStartedAt;
|
|
46
95
|
private preRotationContextPct;
|
|
47
96
|
private hangDetector;
|
|
97
|
+
private instanceState;
|
|
98
|
+
private instanceStateMachine;
|
|
99
|
+
private pendingWork;
|
|
100
|
+
private instanceStateMonitorTimer;
|
|
101
|
+
private statePollInFlight;
|
|
102
|
+
private autoPauseController;
|
|
103
|
+
private pauseRequested;
|
|
104
|
+
private pauseWakeState;
|
|
105
|
+
private pauseWakeTransition;
|
|
48
106
|
private modelOverride;
|
|
49
107
|
private recentUserMessages;
|
|
50
108
|
private recentEvents;
|
|
@@ -57,10 +115,15 @@ export declare class Daemon extends EventEmitter {
|
|
|
57
115
|
private lastBuiltInstructions;
|
|
58
116
|
private pasteQueueDepth;
|
|
59
117
|
private errorMonitorTimer;
|
|
118
|
+
/** Prevent in-flight monitor callbacks from re-arming after a pause. */
|
|
119
|
+
private runtimeMonitorsFrozen;
|
|
60
120
|
private errorWaitingForRecovery;
|
|
61
121
|
private errorDetectedAt;
|
|
62
|
-
/** Whether this instance is in an error state (
|
|
122
|
+
/** Whether this instance is in an abnormal error state (auto-pause is normal). */
|
|
63
123
|
get isErrorState(): boolean;
|
|
124
|
+
get isPaused(): boolean;
|
|
125
|
+
get lastPausedAt(): number | null;
|
|
126
|
+
private getPauseWakeState;
|
|
64
127
|
/** Whether this instance is in a crash loop (3+ consecutive crashes). */
|
|
65
128
|
get isCrashLoop(): boolean;
|
|
66
129
|
private lastFailoverAt;
|
|
@@ -69,7 +132,7 @@ export declare class Daemon extends EventEmitter {
|
|
|
69
132
|
private static ERROR_COOLDOWN_MS;
|
|
70
133
|
private lastErrorCount;
|
|
71
134
|
private lastDetectedErrorType;
|
|
72
|
-
constructor(name: string, config: InstanceConfig, instanceDir: string, topicMode?: boolean, backend?: CliBackend | undefined, controlClient?: TmuxControlClient | undefined);
|
|
135
|
+
constructor(name: string, config: InstanceConfig, instanceDir: string, topicMode?: boolean, backend?: CliBackend | undefined, controlClient?: TmuxControlClient | undefined, rootLogger?: Logger);
|
|
73
136
|
start(): Promise<void>;
|
|
74
137
|
private startHealthCheck;
|
|
75
138
|
/**
|
|
@@ -90,6 +153,18 @@ export declare class Daemon extends EventEmitter {
|
|
|
90
153
|
sendEscape(): Promise<void>;
|
|
91
154
|
stop(): Promise<void>;
|
|
92
155
|
getHangDetector(): HangDetector | null;
|
|
156
|
+
getInstanceState(): InstanceState | "paused";
|
|
157
|
+
getInstanceStateSnapshot(): InstanceStateSnapshot;
|
|
158
|
+
/** Gracefully stop the CLI while keeping its remain-on-exit tmux window. */
|
|
159
|
+
pause(): Promise<void>;
|
|
160
|
+
/** Respawn the CLI in the preserved window and block until its prompt is ready. */
|
|
161
|
+
wake(timeoutMs?: number): Promise<void>;
|
|
162
|
+
private startInstanceStateMonitor;
|
|
163
|
+
private handleStuckTransition;
|
|
164
|
+
/** Stop every runtime poller/watcher while preserving IPC and daemon state. */
|
|
165
|
+
private freezeRuntimeMonitors;
|
|
166
|
+
/** Restore the same monitor objects after wake without adding event listeners. */
|
|
167
|
+
private resumeRuntimeMonitors;
|
|
93
168
|
getMessageBus(): MessageBus;
|
|
94
169
|
private summarizeTool;
|
|
95
170
|
private addToolStatus;
|