@agentchatme/agent-core 0.0.13131111111131 → 0.1.0

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.
@@ -1,167 +1,33 @@
1
+ import { R as RunRunner, D as DoorbellPrompts, a as RunProfile, S as SocketState, b as DoorbellStatus, c as DoorbellLastRun, d as RunOutcome } from './status-D8qOP4kM.js';
2
+ export { e as RunKind, f as RunOutcomeState, g as RunPreflight, h as RunRequest } from './status-D8qOP4kM.js';
1
3
  import { EventEmitter } from 'node:events';
2
- import { z } from 'zod';
3
- import { T as TurnContext, a as TurnDisposition, R as RuntimeAdapter } from './adapter-types-DrrsKZYk.js';
4
- export { A as AutonomyMode, F as FullAutonomyTurnContext, P as PendingReason, b as PendingTurnRequest, S as SilentReason, c as TurnBatchContext, d as TurnMentionContext, e as TurnResult } from './adapter-types-DrrsKZYk.js';
4
+ import 'zod';
5
5
 
6
- declare const SyncRowSchema: z.ZodObject<{
7
- id: z.ZodString;
8
- conversation_id: z.ZodString;
9
- delivery_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
10
- sender: z.ZodOptional<z.ZodString>;
11
- sender_handle: z.ZodOptional<z.ZodString>;
12
- seq: z.ZodOptional<z.ZodNumber>;
13
- type: z.ZodOptional<z.ZodString>;
14
- content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
15
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
16
- status: z.ZodOptional<z.ZodString>;
17
- created_at: z.ZodOptional<z.ZodString>;
18
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
19
- id: z.ZodString;
20
- conversation_id: z.ZodString;
21
- delivery_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
22
- sender: z.ZodOptional<z.ZodString>;
23
- sender_handle: z.ZodOptional<z.ZodString>;
24
- seq: z.ZodOptional<z.ZodNumber>;
25
- type: z.ZodOptional<z.ZodString>;
26
- content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
27
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
28
- status: z.ZodOptional<z.ZodString>;
29
- created_at: z.ZodOptional<z.ZodString>;
30
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
31
- id: z.ZodString;
32
- conversation_id: z.ZodString;
33
- delivery_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
34
- sender: z.ZodOptional<z.ZodString>;
35
- sender_handle: z.ZodOptional<z.ZodString>;
36
- seq: z.ZodOptional<z.ZodNumber>;
37
- type: z.ZodOptional<z.ZodString>;
38
- content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
39
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
40
- status: z.ZodOptional<z.ZodString>;
41
- created_at: z.ZodOptional<z.ZodString>;
42
- }, z.ZodTypeAny, "passthrough">>;
43
- type SyncRow = z.infer<typeof SyncRowSchema>;
44
- declare function parseInbound(payload: unknown): SyncRow | null;
45
- declare function senderOf(row: SyncRow): string;
46
-
47
- type State = 'connecting' | 'ready' | 'reconnecting' | 'terminal' | 'closed';
48
- interface WsClientEvents {
49
- inbound: (row: SyncRow) => void;
50
- ready: () => void;
51
- terminal: (reason: string) => void;
52
- }
53
- declare class AgentWsClient extends EventEmitter {
54
- private readonly url;
55
- private readonly apiKey;
56
- private ws;
57
- private state;
58
- private attempt;
59
- private reconnectTimer;
60
- private livenessTimer;
61
- private ackRetryTimer;
62
- private stopped;
63
- private ackMode;
64
- private inboundPaused;
65
- private readonly pendingAcks;
66
- private readonly acksInFlight;
67
- constructor(url: string, apiKey: string);
68
- /** True only while the socket is live and ready. The heartbeat writer keys
69
- * off this, so a reconnecting/terminal daemon lets its heartbeat go stale
70
- * and the next session detects that always-on is actually down. */
71
- get connected(): boolean;
72
- start(): void;
73
- stop(): void;
74
- /**
75
- * Apply TCP backpressure while the model-turn queue is saturated. `ws`
76
- * delegates this to the underlying socket; no delivered frame is discarded.
77
- * A server heartbeat may close a very long pause, which is safe because all
78
- * unacked messages re-drain after reconnect.
79
- */
80
- pauseInbound(): void;
81
- resumeInbound(): void;
82
- getState(): State;
83
- /**
84
- * Confirm a message as handled: `{"type":"ack","message_id":"msg_..."}`.
85
- * Fire-and-forget by design — a dropped ack is loss-free (the delivery
86
- * stays 'stored' and re-drains on the next reconnect, where dedup absorbs
87
- * the replay). Acking by message id (not delivery id) is what lets a
88
- * real-time push — which carries no delivery_id — be acked at all.
89
- */
90
- ack(messageId: string): void;
91
- private flushAcks;
92
- private scheduleAckRetry;
93
- private open;
94
- private scheduleReconnect;
95
- private armLiveness;
96
- private clearTimers;
97
- }
98
-
99
- interface CoordConfig {
100
- apiKey: string;
101
- apiBase: string;
102
- /** Stable, replier-unique token, e.g. "daemon:<host>". Same token across a
103
- * restart on the same host so the daemon re-claims its own in-flight work. */
104
- holder: string;
105
- timeoutMs?: number;
106
- }
107
- interface ClaimOutcome {
108
- claimed: boolean;
109
- deferred: boolean;
110
- }
111
- interface ClaimBatchOutcome {
112
- claimedCount: number;
113
- deferred: boolean;
114
- }
115
- declare class ReplyCoord {
116
- private readonly cfg;
117
- constructor(cfg: CoordConfig);
118
- private req;
119
- /** Is the agent's live coding session actively working? Fail-open → FALSE. */
120
- isSessionActive(): Promise<boolean>;
121
- /**
122
- * Claim the sole right to reply to a message, atomically respecting any
123
- * foreground turn. Fail-open → claimed (reply anyway rather than drop).
124
- */
125
- claim(messageId: string): Promise<ClaimOutcome>;
126
- /**
127
- * Claim the contiguous oldest-first prefix of one conversation batch.
128
- * Falls back to ordered single-message claims against an older API server;
129
- * all other coordination failures remain fail-open.
130
- */
131
- claimBatch(messageIds: string[]): Promise<ClaimBatchOutcome>;
132
- }
133
-
134
- /** "the group \"Ops\" (grp_x)", or a bare "the group conversation grp_x" when
135
- * the server supplied no name, or "the direct conversation conv_x". */
136
- declare function describeConversation(ctx: TurnContext): string;
137
- /** Resolved sender identity: "Display Name (@handle)" or "@handle", flagging a
138
- * system agent so the model weights its words as platform-authored. */
139
- declare function describeSender(ctx: TurnContext): string;
140
- /** One canonical unattended-delivery prompt for every coding-agent host.
141
- * Host adapters only decide how to launch/resume their runtime; AgentChat's
142
- * message framing and agent-facing context contract must not drift. */
143
- declare function buildAgentChatTurnPrompt(ctx: TurnContext): string;
144
-
145
- /** Parse only an exact, standalone assistant-output marker. Adapters pass
146
- * assistant text here, never tool results or peer-authored delivery data. */
147
- declare function parseAgentChatTurnOutcome(text: string): TurnDisposition | null;
148
- /** Wire-observed sends are authoritative. A model cannot claim it replied
149
- * when no send completed, and a missing marker remains a valid silence. */
150
- declare function resolveTurnDisposition(sent: boolean, reported: TurnDisposition | null): TurnDisposition;
151
-
152
- interface RunDaemonOpts {
6
+ interface RunDoorbellOpts {
153
7
  /** THE identity home for the agent this daemon serves. */
154
8
  home: string;
155
- /** How to spawn one headless turn of this integration's coding agent. */
156
- adapter: RuntimeAdapter;
157
- /** Scratch dir override; defaults to `<home>/daemon-workdir`. */
9
+ /** How to start one headless run of this integration's coding agent. */
10
+ runner: RunRunner;
11
+ /** The fixed prompts, with this runtime's tool names. */
12
+ prompts: DoorbellPrompts;
13
+ /** Scratch dir for runs; defaults to `<home>/daemon-workdir`. */
158
14
  workdir?: string;
15
+ /** Defaults to `AGENTCHAT_RUN_PROFILE`, then `answer`. */
16
+ profile?: RunProfile;
17
+ /** Defaults to `AGENTCHAT_RUN_BUDGET_MS`, then 10 minutes. */
18
+ budgetMs?: number;
19
+ /** Ends the loop (tests). Production runs until SIGTERM/SIGINT. */
20
+ signal?: AbortSignal;
21
+ env?: NodeJS.ProcessEnv;
22
+ /** Test seam: what a signal-initiated shutdown calls last. Defaults to `process.exit`. */
23
+ exit?: (code: number) => void;
159
24
  }
160
25
  /**
161
- * Run the always-on daemon. Returns only on a condition that makes running
162
- * pointless — namely another daemon already holding this home's lock.
26
+ * Run the doorbell daemon. Returns only on a condition that makes running
27
+ * pointless — another daemon already holding this home's lock — or when
28
+ * `signal` aborts (tests).
163
29
  */
164
- declare function runDaemon(opts: RunDaemonOpts): Promise<number>;
30
+ declare function runDoorbell(opts: RunDoorbellOpts): Promise<number>;
165
31
 
166
32
  interface DaemonConfig {
167
33
  apiKey: string;
@@ -191,51 +57,312 @@ interface ResolveDaemonOpts {
191
57
  */
192
58
  declare function resolveDaemonConfig(opts: ResolveDaemonOpts): Promise<DaemonConfig>;
193
59
 
194
- interface DaemonFailure {
195
- kind: 'socket-auth' | 'runtime';
196
- reason: string;
197
- }
198
- declare class Daemon {
199
- private readonly cfg;
200
- private readonly adapter;
201
- /** Called when the socket gives up for good (auth refused). The supervisor
202
- * above decides what happens next — this class does not end the process. */
203
- private readonly onTerminal?;
204
- private readonly ws;
205
- private readonly coord;
206
- private readonly seen;
207
- private readonly convQueues;
208
- private readonly convWorkers;
209
- private pending;
210
- private inFlight;
211
- private readonly waiters;
212
- private foregroundClaimsBlockedUntil;
213
- private foregroundDeferralRounds;
214
- private readonly foregroundDeferrals;
215
- private stopping;
60
+ interface MessageKnock {
61
+ readonly source: 'message';
62
+ readonly sender: string | null;
63
+ readonly conversationId: string | null;
64
+ readonly messageId: string | null;
65
+ }
66
+ type Knock = MessageKnock;
67
+ interface InviteKnock {
68
+ readonly inviteId: string;
69
+ readonly groupId: string | null;
70
+ readonly groupName: string | null;
71
+ readonly inviterHandle: string | null;
72
+ }
73
+ /**
74
+ * Why the socket gave up. `auth`: the server refused the credential — sit out
75
+ * until it changes. `cap`: the reconnect hard cap was reached — the control
76
+ * plane is unreachable, not the key; open a fresh socket after a backoff.
77
+ */
78
+ type TerminalReason = 'auth' | 'cap';
79
+ interface DoorbellSocketEvents {
80
+ knock: (knock: Knock) => void;
81
+ invite: (invite: InviteKnock) => void;
82
+ /** This agent's own outbound, echoed back by server fan-out. Not a knock. */
83
+ echo: () => void;
84
+ state: (state: SocketState, previous: SocketState) => void;
85
+ /**
86
+ * `hello.ok` arrived: the credential is accepted and the connection is live.
87
+ * Once per connection, after `state` → `ready`. The holder's connect-time
88
+ * catch-up hangs off this, not off the TCP `open`.
89
+ */
90
+ ready: () => void;
91
+ /** The server answered the capability negotiation. */
92
+ ack: (negotiated: boolean) => void;
93
+ /** The socket gave up and stays stopped. The holder decides what happens next. */
94
+ terminal: (reason: TerminalReason, detail: string) => void;
95
+ }
96
+ interface DoorbellSocketOptions {
97
+ readonly url: string;
98
+ readonly apiKey: string;
99
+ /** This agent's handle, to recognise its own echo. Bare, any case. */
100
+ readonly selfHandle: string;
101
+ }
102
+ declare class DoorbellSocket extends EventEmitter {
103
+ private readonly options;
104
+ private ws;
105
+ private _state;
106
+ private attempt;
107
+ private reconnectTimer;
108
+ private livenessTimer;
109
+ private stopped;
110
+ private _ackNegotiated;
111
+ /** `hello.ok` seen on the CURRENT connection. Reset on every open. */
112
+ private helloOk;
113
+ private readonly selfHandle;
114
+ constructor(options: DoorbellSocketOptions);
115
+ get state(): SocketState;
116
+ /** True only while the socket is live — `hello.ok` received, not merely open. */
117
+ get connected(): boolean;
118
+ /** null until the server answered; then whether `ack` was echoed. */
119
+ get ackNegotiated(): boolean | null;
120
+ on<E extends keyof DoorbellSocketEvents>(event: E, listener: DoorbellSocketEvents[E]): this;
121
+ start(): void;
122
+ stop(): void;
123
+ private setState;
124
+ private open;
125
+ /** The server accepted the credential and echoed the capability set. */
126
+ private onHelloOk;
127
+ /**
128
+ * A `message.new` frame. Only the sender (echo filter) and the ids (log
129
+ * line) are read. `content`, `metadata`, previews — never touched.
130
+ */
131
+ private onMessageFrame;
132
+ private onInviteFrame;
133
+ /** Give up. The socket stays stopped; the holder decides what happens next. */
134
+ private enterTerminal;
135
+ private scheduleReconnect;
136
+ private armLiveness;
137
+ private clearTimers;
138
+ }
139
+
140
+ interface DoorbellOptions {
141
+ readonly cfg: DaemonConfig;
142
+ readonly runner: RunRunner;
143
+ readonly prompts: DoorbellPrompts;
144
+ readonly profile: RunProfile;
145
+ readonly budgetMs: number;
146
+ /** Injectable for tests; defaults to a real socket. */
147
+ readonly socket?: DoorbellSocket;
148
+ /**
149
+ * Called when the socket gives up for good. `auth`: the credential was
150
+ * refused — sit out until it changes. `cap`: the reconnect cap was reached —
151
+ * open a fresh socket after a backoff. The supervisor above decides; this
152
+ * class does not end the process.
153
+ */
154
+ readonly onTerminal?: (reason: TerminalReason, detail: string) => void;
155
+ }
156
+ declare class Doorbell {
157
+ private readonly options;
158
+ private readonly socket;
159
+ private readonly invoker;
216
160
  private heartbeatTimer;
217
- constructor(cfg: DaemonConfig, adapter: RuntimeAdapter, ws?: AgentWsClient, // injectable for tests; defaults to a real socket
218
- /** Called when the socket gives up for good (auth refused). The supervisor
219
- * above decides what happens next — this class does not end the process. */
220
- onTerminal?: ((failure: DaemonFailure) => void) | undefined);
161
+ private statusTimer;
162
+ private lastError;
163
+ private stopping;
164
+ constructor(options: DoorbellOptions);
221
165
  start(): Promise<void>;
166
+ /**
167
+ * Stop holding the socket and interrupt a run in flight (its process group
168
+ * is SIGTERMed by the runner). Synchronous; `settled()` or `stopAndWait()`
169
+ * tell when the run has actually ended.
170
+ */
171
+ stop(): void;
172
+ /**
173
+ * `stop()`, then wait up to `graceMs` for the interrupted run to end. What a
174
+ * shutdown awaits before the process exits, so a launchd/systemd stop
175
+ * reaches the child and the restarted daemon does not find a run still
176
+ * going. Resolves true when nothing is running any more.
177
+ */
178
+ stopAndWait(graceMs: number): Promise<boolean>;
179
+ /** A run in flight finishes on its own; this resolves when it has. */
180
+ settled(): Promise<void>;
181
+ snapshot(): DoorbellStatus;
182
+ /**
183
+ * The connect-time catch-up: one knock (the invoker counts the tray before
184
+ * any run, so an empty tray costs a count, not a run) and the pending invites.
185
+ */
186
+ private catchUp;
187
+ private writeStatus;
188
+ }
189
+
190
+ declare const DEFAULT_KNOCK_DEBOUNCE_MS = 2000;
191
+ type TimerHandle = ReturnType<typeof setTimeout>;
192
+ interface KnockCoalescerOptions {
193
+ readonly onFire: () => void;
194
+ readonly debounceMs?: number;
195
+ /** Clock and timers are injectable so tests never wait on real time. */
196
+ readonly now?: () => number;
197
+ readonly setTimeout?: (fn: () => void, ms: number) => TimerHandle;
198
+ readonly clearTimeout?: (handle: TimerHandle) => void;
199
+ }
200
+ declare class KnockCoalescer {
201
+ private readonly onFire;
202
+ private readonly debounceMs;
203
+ private readonly now;
204
+ private readonly _setTimeout;
205
+ private readonly _clearTimeout;
206
+ private timer;
207
+ private delayed;
208
+ private delayedDeadline;
209
+ private stopped;
210
+ knocks: number;
211
+ absorbed: number;
212
+ fires: number;
213
+ constructor(options: KnockCoalescerOptions);
214
+ /** True while a debounce timer is armed. */
215
+ get armed(): boolean;
216
+ /** True while a retry knock is scheduled and has not fired. */
217
+ get delayedPending(): boolean;
218
+ /** Epoch ms of the pending retry knock, or null. */
219
+ get delayedDue(): number | null;
220
+ /** A knock: arm the timer if none is armed; otherwise absorb. */
221
+ knock(): void;
222
+ /** A delayed knock (retry ladder). The sooner pending deadline is kept. */
223
+ knockAfter(delayMs: number): void;
224
+ /**
225
+ * Drop a pending retry knock, if there is one; returns whether there was.
226
+ * The debounce timer and later knocks are unaffected. For when nothing is
227
+ * owed any more — a run read the whole tray, or the tray was found empty —
228
+ * so the retry would only ring for a backlog that is already handled.
229
+ */
230
+ cancelDelayed(): boolean;
231
+ /** Cancel everything; later knocks are ignored. */
232
+ stop(): void;
233
+ private fire;
234
+ }
235
+
236
+ declare const RETRY_LADDER_MS: readonly number[];
237
+ /** After the ladder is exhausted: how often the runtime is asked whether it is usable again. */
238
+ declare const PREFLIGHT_WATCH_MS: number;
239
+ interface DoorbellInvokerOptions {
240
+ readonly runner: RunRunner;
241
+ readonly prompts: DoorbellPrompts;
242
+ /** A run is killed past this and counts as failed. */
243
+ readonly budgetMs: number;
244
+ readonly debounceMs?: number;
245
+ readonly retryLadderMs?: readonly number[];
246
+ readonly preflightWatchMs?: number;
247
+ /**
248
+ * Is anything waiting on the tray? Asked before every knock run (never
249
+ * before an invite run). Resolves the answer; rejects when the count could
250
+ * not be read, and then the run starts anyway. Absent: every knock runs.
251
+ */
252
+ readonly trayHasWaiting?: () => Promise<boolean>;
253
+ /** Called after every state change (a status writer hangs off this). */
254
+ readonly onChange?: () => void;
255
+ readonly now?: () => number;
256
+ readonly setTimeout?: (fn: () => void, ms: number) => TimerHandle;
257
+ readonly clearTimeout?: (handle: TimerHandle) => void;
258
+ readonly runId?: () => string;
259
+ }
260
+ interface InvokerCounters {
261
+ readonly knocks: number;
262
+ readonly absorbed: number;
263
+ readonly invites: number;
264
+ readonly runsStarted: number;
265
+ readonly runsOk: number;
266
+ readonly runsFailed: number;
267
+ readonly runsTimedOut: number;
268
+ readonly runsNotStarted: number;
269
+ /** Knock cycles that found the tray empty and started no run. */
270
+ readonly runsSkippedEmpty: number;
271
+ readonly retryRung: number;
272
+ readonly retryDueAt: number | null;
273
+ readonly lastRun: DoorbellLastRun | null;
274
+ readonly running: boolean;
275
+ }
276
+ declare class DoorbellInvoker {
277
+ private readonly runner;
278
+ private readonly prompts;
279
+ private readonly budgetMs;
280
+ private readonly ladder;
281
+ private readonly preflightWatchMs;
282
+ private readonly now;
283
+ private readonly _setTimeout;
284
+ private readonly _clearTimeout;
285
+ private readonly onChange;
286
+ private readonly newRunId;
287
+ private readonly trayHasWaiting;
288
+ private readonly coalescer;
289
+ private cycleDue;
290
+ private running;
291
+ private inFlight;
292
+ private stopped;
293
+ private readonly invites;
294
+ private readonly seenInvites;
295
+ private retryRung;
296
+ private preflightWatch;
297
+ private preflightWasDown;
298
+ private invitesSeen;
299
+ private runsStarted;
300
+ private runsOk;
301
+ private runsFailed;
302
+ private runsTimedOut;
303
+ private runsNotStarted;
304
+ private runsSkippedEmpty;
305
+ private lastRun;
306
+ constructor(options: DoorbellInvokerOptions);
307
+ /** A knock from the socket (a frame), the connect-time catch-up, or any other source. Coalesced, then run. */
308
+ knock(source: string): void;
309
+ /**
310
+ * The second knock kind. Deduplicated by invite id for the life of the
311
+ * process. Returns true when newly queued.
312
+ */
313
+ invite(invite: InviteKnock): boolean;
314
+ /**
315
+ * Cancel timers and interrupt a run in flight (its signal aborts; the
316
+ * runner SIGTERMs the run's process group). `settled()` resolves when the
317
+ * interrupted run has ended.
318
+ */
222
319
  stop(): void;
223
- private onInbound;
224
- /** Queue one already-tracked row and ensure exactly one worker for its conversation. */
225
- private enqueueExisting;
226
- /** Process bounded backlog snapshots, in arrival order within a conversation. */
227
- private drainConversation;
228
- private handleNextBatch;
229
- private waitForForegroundClaimWindow;
230
- private noteForegroundDeferral;
231
- private finishForegroundDeferral;
232
- private turnContext;
233
- private markHandled;
234
- private markNoLongerPending;
235
- /** Bound reconnect-dedup memory without ever evicting unfinished work. */
236
- private pruneSeen;
237
- private acquireSlot;
238
- private releaseSlot;
320
+ /** The promise of the work currently running, for tests and graceful stops. */
321
+ settled(): Promise<void>;
322
+ counters(): InvokerCounters;
323
+ private onKnockFired;
324
+ /** Run the worker if idle. One run at a time; work that lands mid-run runs afterwards. */
325
+ private schedule;
326
+ private drain;
327
+ /**
328
+ * The count before a knock run. True: start the run (something waits, or
329
+ * the count could not be read). False: the tray is empty — no run, nothing
330
+ * owed — or the invoker stopped while counting.
331
+ */
332
+ private trayOwesRun;
333
+ /**
334
+ * Nothing is owed any more — a knock run read the whole tray, or a count
335
+ * found it empty: back to the first rung, drop a pending re-knock (it would
336
+ * only ring for a backlog that is already handled), end the preflight watch.
337
+ */
338
+ private settleLadder;
339
+ private run;
340
+ private scheduleRetry;
341
+ private armPreflightWatch;
342
+ private clearPreflightWatch;
343
+ private probePreflight;
344
+ }
345
+
346
+ interface SpawnRunSpec {
347
+ readonly command: string;
348
+ readonly args: readonly string[];
349
+ readonly cwd: string;
350
+ readonly env: NodeJS.ProcessEnv;
351
+ /** Written to the child's stdin and closed; `null` closes stdin at once. */
352
+ readonly stdin: string | null;
353
+ /** Kill past this. */
354
+ readonly budgetMs: number;
355
+ /** SIGTERM first; SIGKILL this long after. */
356
+ readonly graceMs?: number;
357
+ /**
358
+ * Aborting it SIGTERMs the run's process group (SIGKILL after `graceMs`);
359
+ * the outcome is `failed` with an "interrupted" detail.
360
+ */
361
+ readonly signal?: AbortSignal;
239
362
  }
363
+ /** Strip anything key-shaped or terminal-styled from a diagnostic, and bound it. */
364
+ declare function redactDiagnostic(value: string, max?: number): string;
365
+ /** Start the command, wait for it, classify. Never throws. */
366
+ declare function spawnRun(spec: SpawnRunSpec): Promise<RunOutcome>;
240
367
 
241
- export { AgentWsClient, type CoordConfig, Daemon, type DaemonConfig, ReplyCoord, type ResolveDaemonOpts, type RunDaemonOpts, RuntimeAdapter, TurnContext, TurnDisposition, type WsClientEvents, buildAgentChatTurnPrompt, describeConversation, describeSender, parseAgentChatTurnOutcome, parseInbound, resolveDaemonConfig, resolveTurnDisposition, runDaemon, senderOf, wsUrlFor };
368
+ export { DEFAULT_KNOCK_DEBOUNCE_MS, type DaemonConfig, Doorbell, DoorbellInvoker, type DoorbellInvokerOptions, type DoorbellOptions, DoorbellSocket, type DoorbellSocketEvents, type DoorbellSocketOptions, type InviteKnock, type InvokerCounters, type Knock, KnockCoalescer, type KnockCoalescerOptions, type MessageKnock, PREFLIGHT_WATCH_MS, RETRY_LADDER_MS, type ResolveDaemonOpts, type RunDoorbellOpts, RunOutcome, RunRunner, type SpawnRunSpec, type TerminalReason, redactDiagnostic, resolveDaemonConfig, runDoorbell, spawnRun, wsUrlFor };