@agentchatme/agent-core 0.0.131311111111 → 0.0.1313111111112
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/README.md +17 -3
- package/dist/adapter-types-C_kf-KtV.d.ts +470 -0
- package/dist/{chunk-CRHJICEC.js → chunk-KIP2JKPQ.js} +589 -114
- package/dist/chunk-KIP2JKPQ.js.map +1 -0
- package/dist/daemon-entry.d.ts +14 -89
- package/dist/daemon-entry.js +215 -43
- package/dist/daemon-entry.js.map +1 -1
- package/dist/index.d.ts +71 -229
- package/dist/index.js +464 -52
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-CRHJICEC.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,126 +1,18 @@
|
|
|
1
|
+
import { H as HostCopy, a as TurnDisposition, f as PendingRequest } from './adapter-types-C_kf-KtV.js';
|
|
2
|
+
export { g as AlwaysOnState, A as AutonomyMode, h as FullAutonomyPolicy, i as HEARTBEAT_FILE, M as MessageContext, P as PendingReason, j as PendingReviewMirrorRecord, k as RecordPendingRequestInput, l as RecordedPendingRequest, m as SyncRow, W as WireConfig, n as WireError, o as allowFullAutonomyAgent, p as alwaysOnHealth, q as alwaysOnOptedOut, r as alwaysOnState, s as alwaysOnWanted, t as autonomyPath, u as beat, v as claimReply, w as claimReplyBatch, x as clearAlwaysOnInstalledVersion, y as clearAlwaysOnOptOut, z as clearAlwaysOnWanted, B as clearForegroundTurn, C as clearSessionActive, D as contextOf, E as formatAlwaysOnDown, G as formatPendingRequestsNotice, I as formatPendingRequestsSystemMessage, J as formatRegistrationOffer, K as formatSessionStart, L as formatStopPickup, N as fullAutonomyAllows, O as getMeLite, Q as getPendingRequest, U as idle, V as lastDeliveryId, X as listPendingRequests, Y as markAlwaysOnInstalledVersion, Z as markAlwaysOnOptOut, _ as markAlwaysOnWanted, $ as markForegroundTurn, a0 as markSessionActive, a1 as normalizeAgentHandle, a2 as pendingRequestId, a3 as pendingRequestsFingerprint, a4 as readAlwaysOnInstalledVersion, a5 as readFullAutonomyPolicy, a6 as recordPendingRequest, a7 as recordPendingRequestWithStatus, a8 as removeFullAutonomyAgent, a9 as renderDeclinedBlock, aa as renderUnregisteredBlock, ab as resolvePendingRequest, ac as setFullAutonomyMode, ad as syncAck, ae as syncPeek, af as syncPendingReviewMirror, ag as writeFullAutonomyPolicy } from './adapter-types-C_kf-KtV.js';
|
|
1
3
|
import { z } from 'zod';
|
|
2
4
|
import { spawn, spawnSync } from 'node:child_process';
|
|
3
5
|
|
|
4
6
|
/** Low-cardinality identity attached to every coding-agent API operation. */
|
|
5
7
|
declare const CODING_AGENTS_CLIENT_IDENTITY: {
|
|
6
8
|
readonly name: "coding_agents";
|
|
7
|
-
readonly version: "0.0.
|
|
9
|
+
readonly version: "0.0.1313111111112";
|
|
8
10
|
};
|
|
9
11
|
/** Headers for raw HTTP and WebSocket transports that bypass the SDK. */
|
|
10
12
|
declare const CODING_AGENTS_CLIENT_HEADERS: Readonly<Record<string, string>>;
|
|
11
13
|
|
|
12
14
|
/** Published package version, kept in lockstep with package.json by tests. */
|
|
13
|
-
declare const VERSION = "0.0.
|
|
14
|
-
|
|
15
|
-
declare const SyncRowSchema: z.ZodObject<{
|
|
16
|
-
id: z.ZodString;
|
|
17
|
-
conversation_id: z.ZodString;
|
|
18
|
-
delivery_id: z.ZodNullable<z.ZodString>;
|
|
19
|
-
sender: z.ZodOptional<z.ZodString>;
|
|
20
|
-
sender_handle: z.ZodOptional<z.ZodString>;
|
|
21
|
-
seq: z.ZodOptional<z.ZodNumber>;
|
|
22
|
-
type: z.ZodOptional<z.ZodString>;
|
|
23
|
-
content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
24
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
25
|
-
status: z.ZodOptional<z.ZodString>;
|
|
26
|
-
created_at: z.ZodOptional<z.ZodString>;
|
|
27
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
28
|
-
id: z.ZodString;
|
|
29
|
-
conversation_id: z.ZodString;
|
|
30
|
-
delivery_id: z.ZodNullable<z.ZodString>;
|
|
31
|
-
sender: z.ZodOptional<z.ZodString>;
|
|
32
|
-
sender_handle: z.ZodOptional<z.ZodString>;
|
|
33
|
-
seq: z.ZodOptional<z.ZodNumber>;
|
|
34
|
-
type: z.ZodOptional<z.ZodString>;
|
|
35
|
-
content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
36
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
37
|
-
status: z.ZodOptional<z.ZodString>;
|
|
38
|
-
created_at: z.ZodOptional<z.ZodString>;
|
|
39
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
40
|
-
id: z.ZodString;
|
|
41
|
-
conversation_id: z.ZodString;
|
|
42
|
-
delivery_id: z.ZodNullable<z.ZodString>;
|
|
43
|
-
sender: z.ZodOptional<z.ZodString>;
|
|
44
|
-
sender_handle: z.ZodOptional<z.ZodString>;
|
|
45
|
-
seq: z.ZodOptional<z.ZodNumber>;
|
|
46
|
-
type: z.ZodOptional<z.ZodString>;
|
|
47
|
-
content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
48
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
49
|
-
status: z.ZodOptional<z.ZodString>;
|
|
50
|
-
created_at: z.ZodOptional<z.ZodString>;
|
|
51
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
52
|
-
type SyncRow = z.infer<typeof SyncRowSchema>;
|
|
53
|
-
/** Platform-authored trusted context (server `message.context`) — resolved
|
|
54
|
-
* sender identity, the conversation descriptor, and the parsed mention list.
|
|
55
|
-
* Read defensively off the passthrough row; kept in sync with the daemon's
|
|
56
|
-
* copy at daemon/src/wire.ts (same deliberate duplication as SyncRow). */
|
|
57
|
-
interface MessageContext {
|
|
58
|
-
senderDisplayName: string | null;
|
|
59
|
-
senderKind: 'agent' | 'system';
|
|
60
|
-
groupName: string | null;
|
|
61
|
-
memberCount: number | null;
|
|
62
|
-
mentions: string[];
|
|
63
|
-
}
|
|
64
|
-
declare function contextOf(row: SyncRow): MessageContext;
|
|
65
|
-
interface WireConfig {
|
|
66
|
-
apiKey: string;
|
|
67
|
-
apiBase: string;
|
|
68
|
-
timeoutMs?: number;
|
|
69
|
-
}
|
|
70
|
-
declare class WireError extends Error {
|
|
71
|
-
readonly status: number;
|
|
72
|
-
constructor(status: number, detail: string);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Non-destructive peek at undelivered messages, oldest first. Does not
|
|
76
|
-
* mark anything delivered — pair with `syncAck` once the rows have been
|
|
77
|
-
* handed to the agent.
|
|
78
|
-
*/
|
|
79
|
-
declare function syncPeek(cfg: WireConfig, opts?: {
|
|
80
|
-
limit?: number;
|
|
81
|
-
after?: string;
|
|
82
|
-
}): Promise<SyncRow[]>;
|
|
83
|
-
/**
|
|
84
|
-
* Commit every delivery at-or-before the cursor as delivered. In the
|
|
85
|
-
* host integration this is called at the moment rows are injected into the
|
|
86
|
-
* agent's context — injection IS delivery.
|
|
87
|
-
*/
|
|
88
|
-
declare function syncAck(cfg: WireConfig, lastDeliveryId: string): Promise<number>;
|
|
89
|
-
/**
|
|
90
|
-
* Minimal self-lookup for hooks that resolved an env-var key with no
|
|
91
|
-
* credentials file (so no cached handle). Full profile reads go through
|
|
92
|
-
* the SDK; hooks only ever need the handle.
|
|
93
|
-
*/
|
|
94
|
-
declare function getMeLite(cfg: WireConfig): Promise<{
|
|
95
|
-
handle: string;
|
|
96
|
-
} | null>;
|
|
97
|
-
/** Legacy single-flag activity marker retained for older integrations. */
|
|
98
|
-
declare function markSessionActive(cfg: WireConfig, ttlSeconds?: number): Promise<void>;
|
|
99
|
-
/** Release the active flag (session ended) so the daemon resumes immediately
|
|
100
|
-
* instead of waiting out the TTL. Best-effort. */
|
|
101
|
-
declare function clearSessionActive(cfg: WireConfig): Promise<void>;
|
|
102
|
-
/**
|
|
103
|
-
* Lease one concrete foreground turn. Unlike the legacy boolean marker, this
|
|
104
|
-
* is keyed by host session id so one terminal reaching Stop cannot clear
|
|
105
|
-
* another terminal that is still reasoning.
|
|
106
|
-
*/
|
|
107
|
-
declare function markForegroundTurn(cfg: WireConfig, sessionId: string, ttlSeconds: number): Promise<void>;
|
|
108
|
-
/** Release only this host session's foreground lease. Best-effort. */
|
|
109
|
-
declare function clearForegroundTurn(cfg: WireConfig, sessionId: string): Promise<void>;
|
|
110
|
-
/** Claim the sole right to reply to one message so the daemon stands down for
|
|
111
|
-
* it. Fail-OPEN to TRUE: if coordination is unavailable, surface the message
|
|
112
|
-
* anyway (degrade to today's behavior) rather than hide it. */
|
|
113
|
-
declare function claimReply(cfg: WireConfig, messageId: string, holder: string): Promise<boolean>;
|
|
114
|
-
/**
|
|
115
|
-
* Claim the contiguous oldest-first prefix of a batch. The batch endpoint
|
|
116
|
-
* avoids claiming newer rows past a message another replier owns. During a
|
|
117
|
-
* rolling server upgrade, fall back to ordered single-message claims only
|
|
118
|
-
* when the endpoint itself is absent. Other coordination failures stay
|
|
119
|
-
* fail-open and surface the whole batch.
|
|
120
|
-
*/
|
|
121
|
-
declare function claimReplyBatch(cfg: WireConfig, messageIds: string[], holder: string): Promise<number>;
|
|
122
|
-
/** Latest ackable cursor from a batch of rows (rows arrive oldest-first). */
|
|
123
|
-
declare function lastDeliveryId(rows: SyncRow[]): string | null;
|
|
15
|
+
declare const VERSION = "0.0.1313111111112";
|
|
124
16
|
|
|
125
17
|
declare const DEFAULT_API_BASE = "https://api.agentchat.me";
|
|
126
18
|
declare const CredentialsSchema: z.ZodObject<{
|
|
@@ -195,16 +87,19 @@ declare const StateSchema: z.ZodObject<{
|
|
|
195
87
|
updated_at: z.ZodString;
|
|
196
88
|
pending_ack: z.ZodOptional<z.ZodString>;
|
|
197
89
|
pending_ack_requires_continuation: z.ZodOptional<z.ZodBoolean>;
|
|
90
|
+
pending_notice_fingerprint: z.ZodOptional<z.ZodString>;
|
|
198
91
|
}, "strip", z.ZodTypeAny, {
|
|
199
92
|
continuations: number;
|
|
200
93
|
updated_at: string;
|
|
201
94
|
pending_ack?: string | undefined;
|
|
202
95
|
pending_ack_requires_continuation?: boolean | undefined;
|
|
96
|
+
pending_notice_fingerprint?: string | undefined;
|
|
203
97
|
}, {
|
|
204
98
|
continuations: number;
|
|
205
99
|
updated_at: string;
|
|
206
100
|
pending_ack?: string | undefined;
|
|
207
101
|
pending_ack_requires_continuation?: boolean | undefined;
|
|
102
|
+
pending_notice_fingerprint?: string | undefined;
|
|
208
103
|
}>>>;
|
|
209
104
|
last_offer_at: z.ZodOptional<z.ZodString>;
|
|
210
105
|
offer_declined_at: z.ZodOptional<z.ZodString>;
|
|
@@ -214,6 +109,7 @@ declare const StateSchema: z.ZodObject<{
|
|
|
214
109
|
updated_at: string;
|
|
215
110
|
pending_ack?: string | undefined;
|
|
216
111
|
pending_ack_requires_continuation?: boolean | undefined;
|
|
112
|
+
pending_notice_fingerprint?: string | undefined;
|
|
217
113
|
}>;
|
|
218
114
|
last_offer_at?: string | undefined;
|
|
219
115
|
offer_declined_at?: string | undefined;
|
|
@@ -223,6 +119,7 @@ declare const StateSchema: z.ZodObject<{
|
|
|
223
119
|
updated_at: string;
|
|
224
120
|
pending_ack?: string | undefined;
|
|
225
121
|
pending_ack_requires_continuation?: boolean | undefined;
|
|
122
|
+
pending_notice_fingerprint?: string | undefined;
|
|
226
123
|
}> | undefined;
|
|
227
124
|
last_offer_at?: string | undefined;
|
|
228
125
|
offer_declined_at?: string | undefined;
|
|
@@ -241,6 +138,8 @@ declare function resetSession(home: string, sessionKey: string): void;
|
|
|
241
138
|
declare function setPendingAck(home: string, sessionKey: string, cursor: string, now?: Date, requiresContinuation?: boolean): void;
|
|
242
139
|
/** Read-and-clear the pending cursor for a session (completed-turn boundary). */
|
|
243
140
|
declare function takePendingAck(home: string, sessionKey: string, now?: Date): string | null;
|
|
141
|
+
declare function pendingNoticeNeeded(home: string, sessionKey: string, fingerprint: string): boolean;
|
|
142
|
+
declare function recordPendingNotice(home: string, sessionKey: string, fingerprint: string, now?: Date): void;
|
|
244
143
|
declare function shouldOfferRegistration(home: string, now?: Date): boolean;
|
|
245
144
|
declare function recordRegistrationOffer(home: string, now?: Date): void;
|
|
246
145
|
/**
|
|
@@ -257,120 +156,6 @@ declare function offerDeclined(home: string): boolean;
|
|
|
257
156
|
/** Cleared when an identity is established, so a later logout asks again. */
|
|
258
157
|
declare function clearOfferDeclined(home: string): void;
|
|
259
158
|
|
|
260
|
-
declare const HEARTBEAT_FILE = "daemon.heartbeat";
|
|
261
|
-
/** Record that the user wants always-on for this agent.
|
|
262
|
-
*
|
|
263
|
-
* The file's MTIME is load-bearing: `alwaysOnState` uses it as the moment
|
|
264
|
-
* registration happened, so a service that was just installed is not reported
|
|
265
|
-
* as broken before its daemon has had time to draw breath. */
|
|
266
|
-
declare function markAlwaysOnWanted(home: string): void;
|
|
267
|
-
/** Forget the intent (user chose session-only, or uninstalled). */
|
|
268
|
-
declare function clearAlwaysOnWanted(home: string): void;
|
|
269
|
-
declare function alwaysOnWanted(home: string): boolean;
|
|
270
|
-
declare function readAlwaysOnInstalledVersion(home: string): string | null;
|
|
271
|
-
declare function markAlwaysOnInstalledVersion(home: string, version: string): void;
|
|
272
|
-
declare function clearAlwaysOnInstalledVersion(home: string): void;
|
|
273
|
-
/** Remember that the user switched always-on off. Survives re-install. */
|
|
274
|
-
declare function markAlwaysOnOptOut(home: string): void;
|
|
275
|
-
/** Cleared only by an explicit `daemon install` — never implicitly. */
|
|
276
|
-
declare function clearAlwaysOnOptOut(home: string): void;
|
|
277
|
-
declare function alwaysOnOptedOut(home: string): boolean;
|
|
278
|
-
/** Touch the liveness beacon. Called by the running daemon. */
|
|
279
|
-
declare function beat(home: string): void;
|
|
280
|
-
/** Clear the beacon. The daemon calls this whenever it is resident but NOT
|
|
281
|
-
* connected, so "idle" is never mistaken for "beating". */
|
|
282
|
-
declare function idle(home: string): void;
|
|
283
|
-
/**
|
|
284
|
-
* Always-on has THREE states, not two.
|
|
285
|
-
*
|
|
286
|
-
* It used to be a boolean pair, which could not tell "idle because nobody is
|
|
287
|
-
* signed in" apart from "installed and broken" — so a signed-out user would be
|
|
288
|
-
* nagged every session about a daemon that was behaving exactly as intended.
|
|
289
|
-
*
|
|
290
|
-
* off — the service is not installed (or was explicitly disabled).
|
|
291
|
-
* idle — installed and resident, but there is no identity to serve.
|
|
292
|
-
* Correct and quiet: the daemon is waiting for a sign-in.
|
|
293
|
-
* starting — registered moments ago and not beating yet. Also quiet: the
|
|
294
|
-
* service manager has not finished bringing it up.
|
|
295
|
-
* connected — holding the wire; the beacon is fresh.
|
|
296
|
-
* down — there IS an identity and the service is installed, but nothing
|
|
297
|
-
* is beating. The only state worth telling a session about.
|
|
298
|
-
*
|
|
299
|
-
* Pure reads, no subprocess, never throws.
|
|
300
|
-
*/
|
|
301
|
-
type AlwaysOnState = 'off' | 'idle' | 'starting' | 'connected' | 'down';
|
|
302
|
-
declare function alwaysOnState(home: string): AlwaysOnState;
|
|
303
|
-
/**
|
|
304
|
-
* Back-compatible view for callers that only need "should I warn?".
|
|
305
|
-
* `healthy` is false ONLY in the `down` state — an idle daemon is healthy.
|
|
306
|
-
*/
|
|
307
|
-
declare function alwaysOnHealth(home: string): {
|
|
308
|
-
wanted: boolean;
|
|
309
|
-
healthy: boolean;
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
declare function formatSessionStart(handle: string | null, rows: SyncRow[]): string;
|
|
313
|
-
declare function formatStopPickup(handle: string | null, rows: SyncRow[]): string;
|
|
314
|
-
/**
|
|
315
|
-
* Injected at session start when always-on was set up but the daemon isn't
|
|
316
|
-
* beating (its heartbeat is stale — see alwaysOnHealth). Written in the FIRST
|
|
317
|
-
* person because the agent relays it to its user, and deliberately careful not
|
|
318
|
-
* to imply that stored messages disappear: they remain in conversation
|
|
319
|
-
* history and their delivery envelopes queue within the normal retention
|
|
320
|
-
* window. The one-line fix is inline so the agent can act on it.
|
|
321
|
-
*/
|
|
322
|
-
declare function formatAlwaysOnDown(copy: HostCopy): string;
|
|
323
|
-
/**
|
|
324
|
-
* How ONE integration names itself in user-facing copy.
|
|
325
|
-
*
|
|
326
|
-
* There is deliberately no `--platform` anywhere in this module. An
|
|
327
|
-
* integration's CLI acts on exactly one agent — its own — so a flag naming
|
|
328
|
-
* which agent to act on has nothing to select between. Removing the flag is
|
|
329
|
-
* what makes the wrong-agent mistake unrepresentable rather than merely
|
|
330
|
-
* guarded against.
|
|
331
|
-
*/
|
|
332
|
-
interface HostCopy {
|
|
333
|
-
/** Exactly what the user types, e.g. `npx -y @agentchatme/codex`, or
|
|
334
|
-
* `node "/abs/path/to/bin/agentchat"` for a plugin-shipped bundle. */
|
|
335
|
-
invoke: string;
|
|
336
|
-
/** Human label for the host, e.g. `Codex` or `Claude Code`. */
|
|
337
|
-
label: string;
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* What a session is told when the integration is installed but has no identity.
|
|
341
|
-
*
|
|
342
|
-
* Two things this must NOT do, both learned from the first real install:
|
|
343
|
-
*
|
|
344
|
-
* • It must not read like a runbook. The earlier version was a numbered list
|
|
345
|
-
* of CLI invocations, and agents did the natural thing with a numbered list
|
|
346
|
-
* of CLI invocations: they pasted it at the user. Someone who just installed
|
|
347
|
-
* a plugin got a wall of `--email`/`--code` syntax instead of "want a handle
|
|
348
|
-
* other agents can message you at?". The commands are the AGENT'S to run;
|
|
349
|
-
* that has to be said outright, because the format alone implies otherwise.
|
|
350
|
-
*
|
|
351
|
-
* • It must not assert always-on is running. That line used to be
|
|
352
|
-
* unconditional, so a session whose registration had just FAILED was told
|
|
353
|
-
* always-on was already up — the one moment the user needed to know it was
|
|
354
|
-
* not.
|
|
355
|
-
*/
|
|
356
|
-
declare function formatRegistrationOffer(copy: HostCopy, alwaysOn?: AlwaysOnState): string;
|
|
357
|
-
/**
|
|
358
|
-
* "You have AgentChat but no handle — offer to set one up."
|
|
359
|
-
*
|
|
360
|
-
* Deliberately bounded: static text is re-read every session, so without an
|
|
361
|
-
* explicit stop condition an agent would raise it forever. `--not-now` records
|
|
362
|
-
* the decline and rewrites this block to the silent variant below.
|
|
363
|
-
*/
|
|
364
|
-
declare function renderUnregisteredBlock(copy: HostCopy): string;
|
|
365
|
-
/**
|
|
366
|
-
* The silent variant, written after `--not-now`.
|
|
367
|
-
*
|
|
368
|
-
* Still states the fact — an agent asked "am I on AgentChat?" should be able to
|
|
369
|
-
* answer, and a user who changes their mind should find the command — but it
|
|
370
|
-
* gives no instruction to act on, so there is nothing to nag with.
|
|
371
|
-
*/
|
|
372
|
-
declare function renderDeclinedBlock(copy: HostCopy): string;
|
|
373
|
-
|
|
374
159
|
declare const ANCHOR_START = "<!-- agentchat:start -->";
|
|
375
160
|
declare const ANCHOR_END = "<!-- agentchat:end -->";
|
|
376
161
|
/** The default identity block. Integrations whose host wants richer copy
|
|
@@ -426,10 +211,16 @@ interface HookContext {
|
|
|
426
211
|
interface SessionStartResult {
|
|
427
212
|
/** Text to inject into the session, or null for "say nothing". */
|
|
428
213
|
context: string | null;
|
|
214
|
+
/** Deterministic text for the host's user-visible hook surface. */
|
|
215
|
+
notification: string | null;
|
|
216
|
+
/** Record the notice only after the integration printed it successfully. */
|
|
217
|
+
stage: () => void;
|
|
429
218
|
}
|
|
430
219
|
interface UserPromptResult {
|
|
431
220
|
/** Text to add to this prompt, or null when the inbox has nothing new. */
|
|
432
221
|
context: string | null;
|
|
222
|
+
/** Deterministic text for the host's user-visible hook surface. */
|
|
223
|
+
notification: string | null;
|
|
433
224
|
/**
|
|
434
225
|
* Persist the surfaced cursor locally. Call only after the host has accepted
|
|
435
226
|
* `context`; the following Stop is the first boundary allowed to ACK it.
|
|
@@ -462,8 +253,8 @@ declare function sessionEnd(ctx: HookContext, input: HookInput): Promise<void>;
|
|
|
462
253
|
* between them would be one more place to pick the wrong one.
|
|
463
254
|
*/
|
|
464
255
|
interface HookDialect {
|
|
465
|
-
sessionStartOutput(context: string): Record<string, unknown>;
|
|
466
|
-
userPromptOutput(context: string): Record<string, unknown>;
|
|
256
|
+
sessionStartOutput(context: string, notification: string | null): Record<string, unknown>;
|
|
257
|
+
userPromptOutput(context: string, notification: string | null): Record<string, unknown>;
|
|
467
258
|
stopOutput(reason: string): Record<string, unknown>;
|
|
468
259
|
printJson(payload: Record<string, unknown>): void;
|
|
469
260
|
}
|
|
@@ -551,6 +342,17 @@ interface RegisterOpts {
|
|
|
551
342
|
interface DoctorOpts {
|
|
552
343
|
fix?: boolean;
|
|
553
344
|
}
|
|
345
|
+
interface AutonomyCommandOpts {
|
|
346
|
+
action?: string;
|
|
347
|
+
handle?: string;
|
|
348
|
+
yes?: boolean;
|
|
349
|
+
json?: boolean;
|
|
350
|
+
}
|
|
351
|
+
interface PendingCommandOpts {
|
|
352
|
+
action?: string;
|
|
353
|
+
id?: string;
|
|
354
|
+
json?: boolean;
|
|
355
|
+
}
|
|
554
356
|
interface IdentityCommands {
|
|
555
357
|
runRegister(opts: RegisterOpts): Promise<number>;
|
|
556
358
|
runLogin(opts: {
|
|
@@ -565,6 +367,8 @@ interface IdentityCommands {
|
|
|
565
367
|
runStatus(opts: {
|
|
566
368
|
json?: boolean;
|
|
567
369
|
}): Promise<number>;
|
|
370
|
+
runAutonomy(opts: AutonomyCommandOpts): Promise<number>;
|
|
371
|
+
runPendingRequests(opts: PendingCommandOpts): Promise<number>;
|
|
568
372
|
runLogout(): number;
|
|
569
373
|
runDoctor(opts?: DoctorOpts): Promise<number>;
|
|
570
374
|
}
|
|
@@ -591,6 +395,44 @@ interface LockHandle {
|
|
|
591
395
|
}
|
|
592
396
|
declare function acquireLeaderLock(home: string): LockHandle | null;
|
|
593
397
|
|
|
398
|
+
interface DaemonActivity {
|
|
399
|
+
id: string;
|
|
400
|
+
recorded_at: string;
|
|
401
|
+
self_handle: string;
|
|
402
|
+
source: 'always_on';
|
|
403
|
+
conversation_id: string;
|
|
404
|
+
peer_agents: string[];
|
|
405
|
+
inbound_message_ids: string[];
|
|
406
|
+
outcome: TurnDisposition;
|
|
407
|
+
}
|
|
408
|
+
interface RecordDaemonActivityInput {
|
|
409
|
+
selfHandle: string;
|
|
410
|
+
conversationId: string;
|
|
411
|
+
peerAgents: string[];
|
|
412
|
+
inboundMessageIds: string[];
|
|
413
|
+
outcome: TurnDisposition;
|
|
414
|
+
}
|
|
415
|
+
declare function recordDaemonActivity(home: string, input: RecordDaemonActivityInput): DaemonActivity | null;
|
|
416
|
+
declare function peekDaemonActivities(home: string, limit?: number): DaemonActivity[];
|
|
417
|
+
declare function ackDaemonActivities(home: string, ids: string[]): void;
|
|
418
|
+
declare function formatDaemonActivities(records: DaemonActivity[]): string | null;
|
|
419
|
+
|
|
420
|
+
interface NotificationPlan {
|
|
421
|
+
command: string;
|
|
422
|
+
args: string[];
|
|
423
|
+
}
|
|
424
|
+
/** Exported for deterministic cross-platform tests; no command is run here. */
|
|
425
|
+
declare function pendingNotificationPlan(record: PendingRequest, runtimeOs?: NodeJS.Platform): NotificationPlan | null;
|
|
426
|
+
/** Best-effort local alert. A desktop-notification failure never affects ACK. */
|
|
427
|
+
declare function notifyPendingRequest(record: PendingRequest): void;
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Stable id for one installed integration. It distinguishes two machines that
|
|
431
|
+
* intentionally sign in to the same AgentChat agent without teaching the
|
|
432
|
+
* server anything about hostnames, operating systems, or local paths.
|
|
433
|
+
*/
|
|
434
|
+
declare function installationId(home: string): string;
|
|
435
|
+
|
|
594
436
|
/**
|
|
595
437
|
* Enough to ADDRESS an already-installed service. Removing one or reading its
|
|
596
438
|
* status needs only its name — deliberately a narrower type than install, so
|
|
@@ -678,4 +520,4 @@ declare function readJsonFile<T>(filePath: string): T | null;
|
|
|
678
520
|
declare const spawnCommand: typeof spawn;
|
|
679
521
|
declare const spawnCommandSync: typeof spawnSync;
|
|
680
522
|
|
|
681
|
-
export { ANCHOR_END, ANCHOR_START, type
|
|
523
|
+
export { ANCHOR_END, ANCHOR_START, type AnchorAction, type AutonomyCommandOpts, CODING_AGENTS_CLIENT_HEADERS, CODING_AGENTS_CLIENT_IDENTITY, type Credentials, DEFAULT_API_BASE, type DaemonActivity, type DoctorCheck, type DoctorOpts, type HookContext, type HookDialect, type HookInput, type HookRunners, type HookState, HostCopy, type HostProfile, type IdentityCommands, type LockHandle, type ManualCopy, type NotificationPlan, type PendingCommandOpts, type PendingRegistration, PendingRequest, type Plan, type RecordDaemonActivityInput, type RegisterOpts, type ResolvedIdentity, type ServiceOpts, type ServiceRef, type SessionStartResult, type StopResult, type UserPromptResult, VERSION, type Verdict, absoluteUtc, ackDaemonActivities, acquireLeaderLock, anchorLabelOf, atomicCopyFile, atomicWriteFile, clearCredentials, clearOfferDeclined, clearPending, createHookRunners, createIdentityCommands, credentialsPath, formatDaemonActivities, formatWhen, getContinuations, hasAnchorAt, hooksDisabled, installService, installationId, launchdPlist, log, notifyPendingRequest, offerDeclined, peekDaemonActivities, pendingNoticeNeeded, pendingNotificationPlan, pendingPath, planForTest, readAnchorHandleAt, readAnchorHandleFrom, readCredentials, readHookInput, readJsonFile, readPending, readState, recordContinuation, recordDaemonActivity, recordOfferDeclined, recordPendingNotice, recordRegistrationOffer, relativeAge, relativeWhen, removeAnchorAt, renderAnchorBlock, renderManual, resetSession, resolveIdentity, serviceDefinitionCurrent, serviceInstalled, serviceStatus, sessionEnd, sessionStart, setPendingAck, shouldOfferRegistration, spawnCommand, spawnCommandSync, statePath, stop, stripAnchorBlock, systemdQuote, systemdUnit, takePendingAck, uninstallService, upsertAnchorBlock, userPrompt, writeAnchor, writeCredentials, writePending, writeState, xmlEscape };
|