@agentchatme/agent-core 0.1.0 → 0.3.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.
- package/README.md +71 -37
- package/dist/{chunk-I4U4A7HO.js → chunk-KUZZ3MW2.js} +796 -161
- package/dist/chunk-KUZZ3MW2.js.map +1 -0
- package/dist/daemon-entry.d.ts +183 -139
- package/dist/daemon-entry.js +548 -442
- package/dist/daemon-entry.js.map +1 -1
- package/dist/index.d.ts +47 -221
- package/dist/index.js +215 -200
- package/dist/index.js.map +1 -1
- package/dist/prompts-BUfpwUT7.d.ts +630 -0
- package/package.json +3 -3
- package/dist/chunk-I4U4A7HO.js.map +0 -1
- package/dist/status-D8qOP4kM.d.ts +0 -260
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
/** Spell a hosted tool name the way a runtime exposes it to its model. */
|
|
4
|
-
type ToolNamer = (tool: string) => string;
|
|
5
|
-
/** The names as the hosted server declares them. */
|
|
6
|
-
declare const BARE_TOOL_NAMER: ToolNamer;
|
|
7
|
-
/**
|
|
8
|
-
* The convention both resident coding agents use for MCP tools:
|
|
9
|
-
* `mcp__<server>__<tool>`. Server names are already `[a-z]`, so no
|
|
10
|
-
* normalization applies here.
|
|
11
|
-
*/
|
|
12
|
-
declare function mcpToolNamer(serverName: string): ToolNamer;
|
|
13
|
-
/** The hosted tools a run prompt names. Defined by the hosted tool core, not here. */
|
|
14
|
-
declare const HOSTED_TOOLS: {
|
|
15
|
-
readonly inbox: "agentchat_inbox";
|
|
16
|
-
readonly decide: "agentchat_decide";
|
|
17
|
-
readonly getConversation: "agentchat_get_conversation";
|
|
18
|
-
readonly sendMessage: "agentchat_send_message";
|
|
19
|
-
readonly listGroupInvites: "agentchat_list_group_invites";
|
|
20
|
-
readonly acceptGroupInvite: "agentchat_accept_group_invite";
|
|
21
|
-
readonly rejectGroupInvite: "agentchat_reject_group_invite";
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* The main line's wake instruction with the runtime's tool names. With the bare
|
|
25
|
-
* namer this is byte-identical to the server's `DEFAULT_WAKE_INSTRUCTION`.
|
|
26
|
-
*/
|
|
27
|
-
declare function wakeInstruction(name?: ToolNamer): string;
|
|
28
|
-
interface PromptOptions {
|
|
29
|
-
/** How this runtime spells the hosted tools. */
|
|
30
|
-
readonly toolName: ToolNamer;
|
|
31
|
-
/** The one pointer line to the bundled manual (`manualPointer(...)`). */
|
|
32
|
-
readonly manualPointer: string;
|
|
33
|
-
}
|
|
34
|
-
/** The prompt a knock run starts with. */
|
|
35
|
-
declare function knockPrompt(options: PromptOptions): string;
|
|
36
|
-
/** The prompt a group-invite run starts with. Invites are not on the tray and are never auto-accepted. */
|
|
37
|
-
declare function invitePrompt(options: PromptOptions): string;
|
|
38
|
-
interface DoorbellPrompts {
|
|
39
|
-
readonly knock: string;
|
|
40
|
-
readonly invite: string;
|
|
41
|
-
}
|
|
42
|
-
declare function buildDoorbellPrompts(options: PromptOptions): DoorbellPrompts;
|
|
43
|
-
|
|
44
|
-
declare const RUN_PROFILES: readonly ["answer", "work", "full"];
|
|
45
|
-
type RunProfile = (typeof RUN_PROFILES)[number];
|
|
46
|
-
declare const RUN_PROFILE_ENV = "AGENTCHAT_RUN_PROFILE";
|
|
47
|
-
declare const DEFAULT_RUN_PROFILE: RunProfile;
|
|
48
|
-
declare function isRunProfile(value: unknown): value is RunProfile;
|
|
49
|
-
/** `AGENTCHAT_RUN_PROFILE`, defaulting to `answer`; an unknown value is `answer` too. */
|
|
50
|
-
declare function resolveRunProfile(env?: NodeJS.ProcessEnv): RunProfile;
|
|
51
|
-
/** The one switch: `AGENTCHAT_DOORBELL=off` holds no socket and starts no run. Tools and manual stay. */
|
|
52
|
-
declare const DOORBELL_ENV = "AGENTCHAT_DOORBELL";
|
|
53
|
-
declare function doorbellDisabled(env?: NodeJS.ProcessEnv): boolean;
|
|
54
|
-
/** A run's time budget. Killed past it; that counts as a failed run. */
|
|
55
|
-
declare const RUN_BUDGET_ENV = "AGENTCHAT_RUN_BUDGET_MS";
|
|
56
|
-
declare const DEFAULT_RUN_BUDGET_MS: number;
|
|
57
|
-
declare function resolveRunBudgetMs(env?: NodeJS.ProcessEnv): number;
|
|
58
|
-
|
|
59
|
-
type RunKind = 'knock' | 'invite';
|
|
60
|
-
interface RunRequest {
|
|
61
|
-
readonly kind: RunKind;
|
|
62
|
-
/** The fixed prompt for this kind of run (`buildDoorbellPrompts`). */
|
|
63
|
-
readonly prompt: string;
|
|
64
|
-
/** Unique per run; for logs and for runtimes that want a session name. */
|
|
65
|
-
readonly runId: string;
|
|
66
|
-
/** The run is killed past this budget and counts as failed. */
|
|
67
|
-
readonly budgetMs: number;
|
|
68
|
-
/**
|
|
69
|
-
* Aborted when the doorbell is stopping (daemon shutdown, identity change,
|
|
70
|
-
* refused key). A runner passes it to `spawnRun`, which SIGTERMs the run's
|
|
71
|
-
* process group and SIGKILLs after a grace; the outcome is `failed` with an
|
|
72
|
-
* "interrupted" detail. Optional so a runner that cannot interrupt still
|
|
73
|
-
* satisfies the contract.
|
|
74
|
-
*/
|
|
75
|
-
readonly signal?: AbortSignal;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* `not_started` — the runtime never got going: binary missing, or a non-zero
|
|
79
|
-
* exit with NOTHING ON STDOUT (an auth gate, a bad flag, a missing config —
|
|
80
|
-
* all of which print their complaint on stderr and quit; stderr does not
|
|
81
|
-
* count as output). `failed` — it produced output and exited non-zero, or was
|
|
82
|
-
* interrupted. `timed_out` — it ran past its budget and was killed. `ok` —
|
|
83
|
-
* exit 0. Anything but `ok` schedules the retry ladder.
|
|
84
|
-
*/
|
|
85
|
-
type RunOutcomeState = 'ok' | 'failed' | 'timed_out' | 'not_started';
|
|
86
|
-
interface RunOutcome {
|
|
87
|
-
readonly state: RunOutcomeState;
|
|
88
|
-
readonly exitCode: number | null;
|
|
89
|
-
readonly durationMs: number;
|
|
90
|
-
/** Bounded, credential-redacted diagnostic. Never message content. */
|
|
91
|
-
readonly detail?: string;
|
|
92
|
-
}
|
|
93
|
-
interface RunPreflight {
|
|
94
|
-
ok: boolean;
|
|
95
|
-
detail?: string;
|
|
96
|
-
}
|
|
97
|
-
interface RunRunner {
|
|
98
|
-
/** Short runtime name for logs and status, e.g. the CLI's binary name. */
|
|
99
|
-
readonly name: string;
|
|
100
|
-
/**
|
|
101
|
-
* Is the runtime usable right now (binary present, signed in)? Called
|
|
102
|
-
* before the socket is held, and — after the retry ladder is exhausted —
|
|
103
|
-
* periodically, so a runtime that comes back (the user signs in again)
|
|
104
|
-
* earns one re-knock without waiting for the next peer.
|
|
105
|
-
*/
|
|
106
|
-
preflight(): Promise<RunPreflight>;
|
|
107
|
-
/** Start one run and wait for it. Never throws — returns an outcome. */
|
|
108
|
-
start(request: RunRequest): Promise<RunOutcome>;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
declare const DOORBELL_STATUS_FILE = "doorbell.status.json";
|
|
112
|
-
declare const SOCKET_STATES: readonly ["off", "idle", "connecting", "ready", "reconnecting", "terminal", "closed"];
|
|
113
|
-
type SocketState = (typeof SOCKET_STATES)[number];
|
|
114
|
-
declare const LastRunSchema: z.ZodObject<{
|
|
115
|
-
kind: z.ZodEnum<["knock", "invite"]>;
|
|
116
|
-
started_at: z.ZodString;
|
|
117
|
-
ended_at: z.ZodString;
|
|
118
|
-
state: z.ZodEnum<["ok", "failed", "timed_out", "not_started"]>;
|
|
119
|
-
exit_code: z.ZodNullable<z.ZodNumber>;
|
|
120
|
-
duration_ms: z.ZodNumber;
|
|
121
|
-
detail: z.ZodNullable<z.ZodString>;
|
|
122
|
-
}, "strip", z.ZodTypeAny, {
|
|
123
|
-
kind: "knock" | "invite";
|
|
124
|
-
started_at: string;
|
|
125
|
-
ended_at: string;
|
|
126
|
-
state: "ok" | "failed" | "timed_out" | "not_started";
|
|
127
|
-
exit_code: number | null;
|
|
128
|
-
duration_ms: number;
|
|
129
|
-
detail: string | null;
|
|
130
|
-
}, {
|
|
131
|
-
kind: "knock" | "invite";
|
|
132
|
-
started_at: string;
|
|
133
|
-
ended_at: string;
|
|
134
|
-
state: "ok" | "failed" | "timed_out" | "not_started";
|
|
135
|
-
exit_code: number | null;
|
|
136
|
-
duration_ms: number;
|
|
137
|
-
detail: string | null;
|
|
138
|
-
}>;
|
|
139
|
-
declare const StatusSchema: z.ZodObject<{
|
|
140
|
-
version: z.ZodLiteral<1>;
|
|
141
|
-
updated_at: z.ZodString;
|
|
142
|
-
pid: z.ZodNumber;
|
|
143
|
-
runtime: z.ZodNullable<z.ZodString>;
|
|
144
|
-
handle: z.ZodNullable<z.ZodString>;
|
|
145
|
-
profile: z.ZodString;
|
|
146
|
-
socket: z.ZodEnum<["off", "idle", "connecting", "ready", "reconnecting", "terminal", "closed"]>;
|
|
147
|
-
/** null until the server answered the capability negotiation. */
|
|
148
|
-
ack_negotiated: z.ZodNullable<z.ZodBoolean>;
|
|
149
|
-
knocks: z.ZodNumber;
|
|
150
|
-
knocks_absorbed: z.ZodNumber;
|
|
151
|
-
invites: z.ZodNumber;
|
|
152
|
-
runs_started: z.ZodNumber;
|
|
153
|
-
runs_ok: z.ZodNumber;
|
|
154
|
-
runs_failed: z.ZodNumber;
|
|
155
|
-
runs_timed_out: z.ZodNumber;
|
|
156
|
-
runs_not_started: z.ZodNumber;
|
|
157
|
-
/** Knocks whose tray count came back empty, so no run started. Absent in files from older daemons. */
|
|
158
|
-
runs_skipped_empty: z.ZodDefault<z.ZodNumber>;
|
|
159
|
-
last_run: z.ZodNullable<z.ZodObject<{
|
|
160
|
-
kind: z.ZodEnum<["knock", "invite"]>;
|
|
161
|
-
started_at: z.ZodString;
|
|
162
|
-
ended_at: z.ZodString;
|
|
163
|
-
state: z.ZodEnum<["ok", "failed", "timed_out", "not_started"]>;
|
|
164
|
-
exit_code: z.ZodNullable<z.ZodNumber>;
|
|
165
|
-
duration_ms: z.ZodNumber;
|
|
166
|
-
detail: z.ZodNullable<z.ZodString>;
|
|
167
|
-
}, "strip", z.ZodTypeAny, {
|
|
168
|
-
kind: "knock" | "invite";
|
|
169
|
-
started_at: string;
|
|
170
|
-
ended_at: string;
|
|
171
|
-
state: "ok" | "failed" | "timed_out" | "not_started";
|
|
172
|
-
exit_code: number | null;
|
|
173
|
-
duration_ms: number;
|
|
174
|
-
detail: string | null;
|
|
175
|
-
}, {
|
|
176
|
-
kind: "knock" | "invite";
|
|
177
|
-
started_at: string;
|
|
178
|
-
ended_at: string;
|
|
179
|
-
state: "ok" | "failed" | "timed_out" | "not_started";
|
|
180
|
-
exit_code: number | null;
|
|
181
|
-
duration_ms: number;
|
|
182
|
-
detail: string | null;
|
|
183
|
-
}>>;
|
|
184
|
-
retry_rung: z.ZodNumber;
|
|
185
|
-
retry_due_at: z.ZodNullable<z.ZodString>;
|
|
186
|
-
last_error: z.ZodNullable<z.ZodString>;
|
|
187
|
-
}, "strip", z.ZodTypeAny, {
|
|
188
|
-
handle: string | null;
|
|
189
|
-
version: 1;
|
|
190
|
-
updated_at: string;
|
|
191
|
-
pid: number;
|
|
192
|
-
runtime: string | null;
|
|
193
|
-
profile: string;
|
|
194
|
-
socket: "off" | "idle" | "connecting" | "ready" | "reconnecting" | "terminal" | "closed";
|
|
195
|
-
ack_negotiated: boolean | null;
|
|
196
|
-
knocks: number;
|
|
197
|
-
knocks_absorbed: number;
|
|
198
|
-
invites: number;
|
|
199
|
-
runs_started: number;
|
|
200
|
-
runs_ok: number;
|
|
201
|
-
runs_failed: number;
|
|
202
|
-
runs_timed_out: number;
|
|
203
|
-
runs_not_started: number;
|
|
204
|
-
runs_skipped_empty: number;
|
|
205
|
-
last_run: {
|
|
206
|
-
kind: "knock" | "invite";
|
|
207
|
-
started_at: string;
|
|
208
|
-
ended_at: string;
|
|
209
|
-
state: "ok" | "failed" | "timed_out" | "not_started";
|
|
210
|
-
exit_code: number | null;
|
|
211
|
-
duration_ms: number;
|
|
212
|
-
detail: string | null;
|
|
213
|
-
} | null;
|
|
214
|
-
retry_rung: number;
|
|
215
|
-
retry_due_at: string | null;
|
|
216
|
-
last_error: string | null;
|
|
217
|
-
}, {
|
|
218
|
-
handle: string | null;
|
|
219
|
-
version: 1;
|
|
220
|
-
updated_at: string;
|
|
221
|
-
pid: number;
|
|
222
|
-
runtime: string | null;
|
|
223
|
-
profile: string;
|
|
224
|
-
socket: "off" | "idle" | "connecting" | "ready" | "reconnecting" | "terminal" | "closed";
|
|
225
|
-
ack_negotiated: boolean | null;
|
|
226
|
-
knocks: number;
|
|
227
|
-
knocks_absorbed: number;
|
|
228
|
-
invites: number;
|
|
229
|
-
runs_started: number;
|
|
230
|
-
runs_ok: number;
|
|
231
|
-
runs_failed: number;
|
|
232
|
-
runs_timed_out: number;
|
|
233
|
-
runs_not_started: number;
|
|
234
|
-
last_run: {
|
|
235
|
-
kind: "knock" | "invite";
|
|
236
|
-
started_at: string;
|
|
237
|
-
ended_at: string;
|
|
238
|
-
state: "ok" | "failed" | "timed_out" | "not_started";
|
|
239
|
-
exit_code: number | null;
|
|
240
|
-
duration_ms: number;
|
|
241
|
-
detail: string | null;
|
|
242
|
-
} | null;
|
|
243
|
-
retry_rung: number;
|
|
244
|
-
retry_due_at: string | null;
|
|
245
|
-
last_error: string | null;
|
|
246
|
-
runs_skipped_empty?: number | undefined;
|
|
247
|
-
}>;
|
|
248
|
-
type DoorbellLastRun = z.infer<typeof LastRunSchema>;
|
|
249
|
-
type DoorbellStatus = z.infer<typeof StatusSchema>;
|
|
250
|
-
declare function doorbellStatusPath(home: string): string;
|
|
251
|
-
/** Best effort: the status file is diagnostics, never a dependency of ringing. */
|
|
252
|
-
declare function writeDoorbellStatus(home: string, status: DoorbellStatus): void;
|
|
253
|
-
declare function readDoorbellStatus(home: string): DoorbellStatus | null;
|
|
254
|
-
declare function clearDoorbellStatus(home: string): void;
|
|
255
|
-
/** Age of the status file, in ms, or null when absent. */
|
|
256
|
-
declare function doorbellStatusAge(status: DoorbellStatus | null, now?: number): number | null;
|
|
257
|
-
/** Human lines for `status`. Pure. */
|
|
258
|
-
declare function formatDoorbellStatus(status: DoorbellStatus | null, now?: number): string[];
|
|
259
|
-
|
|
260
|
-
export { readDoorbellStatus as A, BARE_TOOL_NAMER as B, resolveRunBudgetMs as C, type DoorbellPrompts as D, resolveRunProfile as E, wakeInstruction as F, writeDoorbellStatus as G, HOSTED_TOOLS as H, type PromptOptions as P, type RunRunner as R, type SocketState as S, type ToolNamer as T, type RunProfile as a, type DoorbellStatus as b, type DoorbellLastRun as c, type RunOutcome as d, type RunKind as e, type RunOutcomeState as f, type RunPreflight as g, type RunRequest as h, DEFAULT_RUN_BUDGET_MS as i, DEFAULT_RUN_PROFILE as j, DOORBELL_ENV as k, DOORBELL_STATUS_FILE as l, RUN_BUDGET_ENV as m, RUN_PROFILES as n, RUN_PROFILE_ENV as o, SOCKET_STATES as p, buildDoorbellPrompts as q, clearDoorbellStatus as r, doorbellDisabled as s, doorbellStatusAge as t, doorbellStatusPath as u, formatDoorbellStatus as v, invitePrompt as w, isRunProfile as x, knockPrompt as y, mcpToolNamer as z };
|