@songsid/agend 2.1.0-beta.1 → 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/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 +50 -3
- package/dist/daemon.js +356 -31
- package/dist/daemon.js.map +1 -1
- package/dist/fleet-context.d.ts +2 -1
- package/dist/fleet-manager.d.ts +10 -2
- package/dist/fleet-manager.js +125 -56
- 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 +60 -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,11 +1,25 @@
|
|
|
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
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";
|
|
7
8
|
export declare const DEFAULT_STUCK_TIMEOUT_MS: number;
|
|
8
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
|
+
}
|
|
9
23
|
/**
|
|
10
24
|
* Headless state machine for pane-based execution state detection.
|
|
11
25
|
*
|
|
@@ -25,6 +39,20 @@ export declare class PaneStateMachine {
|
|
|
25
39
|
observe(pane: string, now?: number): InstanceStateSnapshot;
|
|
26
40
|
snapshot(now?: number): InstanceStateSnapshot;
|
|
27
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[];
|
|
28
56
|
export declare class Daemon extends EventEmitter {
|
|
29
57
|
private name;
|
|
30
58
|
private config;
|
|
@@ -68,8 +96,13 @@ export declare class Daemon extends EventEmitter {
|
|
|
68
96
|
private hangDetector;
|
|
69
97
|
private instanceState;
|
|
70
98
|
private instanceStateMachine;
|
|
99
|
+
private pendingWork;
|
|
71
100
|
private instanceStateMonitorTimer;
|
|
72
101
|
private statePollInFlight;
|
|
102
|
+
private autoPauseController;
|
|
103
|
+
private pauseRequested;
|
|
104
|
+
private pauseWakeState;
|
|
105
|
+
private pauseWakeTransition;
|
|
73
106
|
private modelOverride;
|
|
74
107
|
private recentUserMessages;
|
|
75
108
|
private recentEvents;
|
|
@@ -82,10 +115,15 @@ export declare class Daemon extends EventEmitter {
|
|
|
82
115
|
private lastBuiltInstructions;
|
|
83
116
|
private pasteQueueDepth;
|
|
84
117
|
private errorMonitorTimer;
|
|
118
|
+
/** Prevent in-flight monitor callbacks from re-arming after a pause. */
|
|
119
|
+
private runtimeMonitorsFrozen;
|
|
85
120
|
private errorWaitingForRecovery;
|
|
86
121
|
private errorDetectedAt;
|
|
87
|
-
/** Whether this instance is in an error state (
|
|
122
|
+
/** Whether this instance is in an abnormal error state (auto-pause is normal). */
|
|
88
123
|
get isErrorState(): boolean;
|
|
124
|
+
get isPaused(): boolean;
|
|
125
|
+
get lastPausedAt(): number | null;
|
|
126
|
+
private getPauseWakeState;
|
|
89
127
|
/** Whether this instance is in a crash loop (3+ consecutive crashes). */
|
|
90
128
|
get isCrashLoop(): boolean;
|
|
91
129
|
private lastFailoverAt;
|
|
@@ -94,7 +132,7 @@ export declare class Daemon extends EventEmitter {
|
|
|
94
132
|
private static ERROR_COOLDOWN_MS;
|
|
95
133
|
private lastErrorCount;
|
|
96
134
|
private lastDetectedErrorType;
|
|
97
|
-
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);
|
|
98
136
|
start(): Promise<void>;
|
|
99
137
|
private startHealthCheck;
|
|
100
138
|
/**
|
|
@@ -115,9 +153,18 @@ export declare class Daemon extends EventEmitter {
|
|
|
115
153
|
sendEscape(): Promise<void>;
|
|
116
154
|
stop(): Promise<void>;
|
|
117
155
|
getHangDetector(): HangDetector | null;
|
|
118
|
-
getInstanceState(): InstanceState;
|
|
156
|
+
getInstanceState(): InstanceState | "paused";
|
|
119
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>;
|
|
120
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;
|
|
121
168
|
getMessageBus(): MessageBus;
|
|
122
169
|
private summarizeTool;
|
|
123
170
|
private addToolStatus;
|