@agentproto/driver-agent-cli 0.1.0-alpha.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.
@@ -0,0 +1,22 @@
1
+ import { k as AgentCliFrontmatter, A as AgentCliHandle } from '../schema-CdCb4gW1.js';
2
+ export { x as agentCliFrontmatterSchema } from '../schema-CdCb4gW1.js';
3
+ import '@agentproto/acp';
4
+ import 'zod';
5
+
6
+ /**
7
+ * AIP-45 AGENT-CLI.md sidecar parser + manifest-to-handle constructor.
8
+ *
9
+ * Mirror of `@agentproto/skill/manifest` and `@agentproto/acp/manifest`:
10
+ * the .md provides metadata; the TS runtime supplies any spec-specific
11
+ * runtime bits. Both inputs end up in `defineAgentCli` so the cross-AIP
12
+ * invariants run uniformly.
13
+ */
14
+
15
+ interface AgentCliManifest {
16
+ frontmatter: AgentCliFrontmatter;
17
+ body: string;
18
+ }
19
+ declare function parseAgentCliManifest(source: string): AgentCliManifest;
20
+ declare function agentCliFromManifest(manifest: AgentCliManifest): AgentCliHandle;
21
+
22
+ export { AgentCliFrontmatter, type AgentCliManifest, agentCliFromManifest, parseAgentCliManifest };
@@ -0,0 +1,28 @@
1
+ import { agentCliFrontmatterSchema, defineAgentCli } from '../chunk-EEIYDRIU.mjs';
2
+ export { agentCliFrontmatterSchema } from '../chunk-EEIYDRIU.mjs';
3
+ import matter from 'gray-matter';
4
+
5
+ /**
6
+ * @agentproto/driver-agent-cli v0.1.0-alpha
7
+ * AIP-45 AGENT-CLI.md `defineAgentCli` reference implementation.
8
+ */
9
+ function parseAgentCliManifest(source) {
10
+ const parsed = matter(source);
11
+ if (Object.keys(parsed.data).length === 0) {
12
+ throw new Error("parseAgentCliManifest: missing or empty frontmatter");
13
+ }
14
+ const result = agentCliFrontmatterSchema.safeParse(parsed.data);
15
+ if (!result.success) {
16
+ throw new Error(
17
+ `parseAgentCliManifest: invalid frontmatter \u2014 ${result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ")}`
18
+ );
19
+ }
20
+ return { frontmatter: result.data, body: parsed.content };
21
+ }
22
+ function agentCliFromManifest(manifest) {
23
+ return defineAgentCli(manifest.frontmatter);
24
+ }
25
+
26
+ export { agentCliFromManifest, parseAgentCliManifest };
27
+ //# sourceMappingURL=index.mjs.map
28
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/manifest/index.ts"],"names":[],"mappings":";;;;;;;;AAwBO,SAAS,sBAAsB,MAAA,EAAkC;AACtE,EAAA,MAAM,MAAA,GAAS,OAAO,MAAM,CAAA;AAC5B,EAAA,IAAI,OAAO,IAAA,CAAK,MAAA,CAAO,IAAI,CAAA,CAAE,WAAW,CAAA,EAAG;AACzC,IAAA,MAAM,IAAI,MAAM,qDAAqD,CAAA;AAAA,EACvE;AACA,EAAA,MAAM,MAAA,GAAS,yBAAA,CAA0B,SAAA,CAAU,MAAA,CAAO,IAAI,CAAA;AAC9D,EAAA,IAAI,CAAC,OAAO,OAAA,EAAS;AACnB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,kDAAA,EAAgD,OAAO,KAAA,CAAM,MAAA,CAC1D,IAAI,CAAC,CAAA,KAAM,GAAG,CAAA,CAAE,IAAA,CAAK,KAAK,GAAG,CAAC,KAAK,CAAA,CAAE,OAAO,EAAE,CAAA,CAC9C,IAAA,CAAK,IAAI,CAAC,CAAA;AAAA,KACf;AAAA,EACF;AACA,EAAA,OAAO,EAAE,WAAA,EAAa,MAAA,CAAO,IAAA,EAAM,IAAA,EAAM,OAAO,OAAA,EAAQ;AAC1D;AAEO,SAAS,qBACd,QAAA,EACgB;AAChB,EAAA,OAAO,cAAA,CAAe,SAAS,WAA4C,CAAA;AAC7E","file":"index.mjs","sourcesContent":["/**\n * AIP-45 AGENT-CLI.md sidecar parser + manifest-to-handle constructor.\n *\n * Mirror of `@agentproto/skill/manifest` and `@agentproto/acp/manifest`:\n * the .md provides metadata; the TS runtime supplies any spec-specific\n * runtime bits. Both inputs end up in `defineAgentCli` so the cross-AIP\n * invariants run uniformly.\n */\n\nimport matter from \"gray-matter\"\nimport {\n agentCliFrontmatterSchema,\n type AgentCliFrontmatter,\n} from \"../schema.js\"\nimport { defineAgentCli } from \"../define-agent-cli.js\"\nimport type { AgentCliDefinition, AgentCliHandle } from \"../types.js\"\n\nexport { agentCliFrontmatterSchema, type AgentCliFrontmatter }\n\nexport interface AgentCliManifest {\n frontmatter: AgentCliFrontmatter\n body: string\n}\n\nexport function parseAgentCliManifest(source: string): AgentCliManifest {\n const parsed = matter(source)\n if (Object.keys(parsed.data).length === 0) {\n throw new Error(\"parseAgentCliManifest: missing or empty frontmatter\")\n }\n const result = agentCliFrontmatterSchema.safeParse(parsed.data)\n if (!result.success) {\n throw new Error(\n `parseAgentCliManifest: invalid frontmatter — ${result.error.issues\n .map((i) => `${i.path.join(\".\")}: ${i.message}`)\n .join(\"; \")}`,\n )\n }\n return { frontmatter: result.data, body: parsed.content }\n}\n\nexport function agentCliFromManifest(\n manifest: AgentCliManifest,\n): AgentCliHandle {\n return defineAgentCli(manifest.frontmatter as unknown as AgentCliDefinition)\n}\n"]}
@@ -0,0 +1,548 @@
1
+ import { StreamEvent } from '@agentproto/acp';
2
+ import { z } from 'zod';
3
+
4
+ /**
5
+ * AIP-45 AgentCliDefinition + AgentCliHandle.
6
+ *
7
+ * Mirrors `resources/aip-45/draft/AGENT-CLI.schema.json`. Top-level
8
+ * fields cover the binary's install / version / auth / sandbox /
9
+ * protocol surface; `protocol` discriminates between ACP, MCP, and
10
+ * proprietary adapter arms.
11
+ */
12
+
13
+ type AgentCliProtocol = "acp" | "mcp" | "proprietary";
14
+ type AgentCliSessionMode = "ephemeral" | "persistent" | "resumable";
15
+ interface AgentCliInstallMethod {
16
+ method: "brew" | "apt" | "dnf" | "pacman" | "choco" | "scoop" | "npm" | "pip" | "cargo" | "go" | "curl" | "download" | "vendored";
17
+ package?: string;
18
+ url?: string;
19
+ path?: string;
20
+ extract_bin?: string;
21
+ verify_sha256?: string;
22
+ global?: boolean;
23
+ user?: boolean;
24
+ experimental?: boolean;
25
+ }
26
+ interface AgentCliVersionCheck {
27
+ cmd: string;
28
+ parse: string;
29
+ range: string;
30
+ timeout_ms?: number;
31
+ }
32
+ interface AgentCliAuth {
33
+ ref?: string;
34
+ state?: {
35
+ paths?: string[];
36
+ env?: string[];
37
+ };
38
+ login?: {
39
+ cmd: string;
40
+ interactive?: boolean;
41
+ requires_callback_url?: boolean;
42
+ };
43
+ refresh?: {
44
+ cmd: string;
45
+ interval_s?: number;
46
+ };
47
+ expiry?: {
48
+ parse?: string;
49
+ grace_s?: number;
50
+ };
51
+ }
52
+ interface AgentCliSession {
53
+ mode?: AgentCliSessionMode;
54
+ idle_timeout_ms?: number;
55
+ max_turns?: number;
56
+ context_carryover?: boolean;
57
+ }
58
+ interface AgentCliModels {
59
+ default?: string;
60
+ allowed?: string[];
61
+ env?: Record<string, string>;
62
+ }
63
+ interface AgentCliCapabilities {
64
+ streaming?: boolean;
65
+ tool_calls?: boolean;
66
+ sub_agents?: boolean;
67
+ file_io?: boolean;
68
+ multimodal?: boolean;
69
+ resumable?: boolean;
70
+ bidirectional?: boolean;
71
+ }
72
+ /**
73
+ * AIP-45 mode declaration — a mutually-exclusive operation profile
74
+ * the CLI exposes. The host picks at most ONE mode per turn via
75
+ * `OPERATOR.runtime.config.mode`. Mode patches apply AFTER the
76
+ * manifest's default `bin_args` and BEFORE option patches.
77
+ */
78
+ interface AgentCliMode {
79
+ id: string;
80
+ description?: string;
81
+ bin_args_append?: string[];
82
+ env?: Record<string, string>;
83
+ }
84
+ type AgentCliOptionType = "boolean" | "integer" | "string" | "enum";
85
+ /**
86
+ * AIP-45 option declaration — an independent typed knob. Multiple
87
+ * options may be active per turn; each option's patch is independent
88
+ * and applied in declaration order, AFTER mode patches.
89
+ */
90
+ interface AgentCliOption {
91
+ id: string;
92
+ type: AgentCliOptionType;
93
+ description?: string;
94
+ /** Required when type === "enum". */
95
+ enum?: string[];
96
+ default?: boolean | number | string;
97
+ /** Inclusive lower bound when type === "integer". */
98
+ min?: number;
99
+ /** Inclusive upper bound when type === "integer". */
100
+ max?: number;
101
+ /**
102
+ * Argv template appended when the option has a non-default value.
103
+ * The literal token `{value}` is replaced with the option's value
104
+ * (stringified). Use for value-bearing flags like `--model {value}`.
105
+ */
106
+ bin_args_template?: string[];
107
+ /**
108
+ * Argv appended when type === "boolean" AND value === true. Use for
109
+ * bare flags like `--auto`.
110
+ */
111
+ bin_args_append_when_true?: string[];
112
+ /**
113
+ * Env vars to merge when the option has a non-default value. Values
114
+ * may contain `{value}` for templating.
115
+ */
116
+ env?: Record<string, string>;
117
+ }
118
+ /**
119
+ * Built-in continuation strategy ids. Future custom strategies require
120
+ * a follow-up AIP that opens this enum. Keep this in lockstep with
121
+ * `continuationStrategyId` in `AGENT-CLI.schema.json`.
122
+ */
123
+ type ContinuationStrategyId = "none" | "pinned-session" | "transcript" | "native-resume";
124
+ /**
125
+ * AIP-45 continuation declaration — declares HOW prior turns reach the
126
+ * CLI on subsequent invocations. Hosts MUST refuse to dispatch with a
127
+ * strategy outside `supported`; the operator MAY override `default` via
128
+ * `OPERATOR.runtime.config.continuation` provided the chosen id is in
129
+ * `supported`.
130
+ */
131
+ interface AgentCliContinuation {
132
+ default: ContinuationStrategyId;
133
+ supported: ContinuationStrategyId[];
134
+ pinned_session?: AgentCliPinnedSessionTuning;
135
+ }
136
+ /** Tuning for the `pinned-session` strategy. Ignored by other strategies. */
137
+ interface AgentCliPinnedSessionTuning {
138
+ /** How long an idle pinned session is kept alive before the driver
139
+ * closes it. Applies in addition to the CLI's own
140
+ * `session.idle_timeout_ms`. Default 1_800_000 (30 min). */
141
+ idle_timeout_ms?: number;
142
+ /**
143
+ * Composite key that uniquely identifies a pinned session. Default
144
+ * `["conversation", "operator"]` — different conversations get
145
+ * different child processes; one operator per conversation reuses
146
+ * one process across turns.
147
+ */
148
+ key_scope?: ContinuationKeyScope[];
149
+ }
150
+ type ContinuationKeyScope = "conversation" | "operator" | "user" | "guild" | "workspace";
151
+ interface AgentCliMcpBlock {
152
+ command?: string;
153
+ args?: string[];
154
+ transport: "stdio" | "http" | "sse";
155
+ url?: string;
156
+ }
157
+ interface AgentCliRequires {
158
+ os?: ("darwin" | "linux" | "windows")[];
159
+ arch?: ("x64" | "arm64" | "x86" | "arm")[];
160
+ min_disk_mb?: number;
161
+ min_memory_mb?: number;
162
+ }
163
+ interface AgentCliExample {
164
+ goal: string;
165
+ prompt: string;
166
+ note?: string;
167
+ }
168
+ interface AgentCliDefinition {
169
+ name: string;
170
+ id: string;
171
+ description: string;
172
+ version: string;
173
+ bin: string;
174
+ bin_args?: string[];
175
+ install: AgentCliInstallMethod[];
176
+ version_check: AgentCliVersionCheck;
177
+ auth?: AgentCliAuth;
178
+ sandbox: string | Record<string, unknown>;
179
+ runner?: string | Record<string, unknown>;
180
+ protocol: AgentCliProtocol;
181
+ /** REQUIRED when protocol=acp. Workspace-relative ref to AIP-44 ACP.md. */
182
+ acp?: string;
183
+ /** REQUIRED when protocol=mcp. */
184
+ mcp?: AgentCliMcpBlock;
185
+ /** REQUIRED when protocol=proprietary. NPM package implementing AgentCliClient. */
186
+ adapter?: string;
187
+ session?: AgentCliSession;
188
+ models?: AgentCliModels;
189
+ capabilities?: AgentCliCapabilities;
190
+ /** AIP-45 modes (mutually-exclusive operation profiles). */
191
+ modes?: AgentCliMode[];
192
+ /** AIP-45 options (independent typed knobs). */
193
+ options?: AgentCliOption[];
194
+ /** AIP-45 continuation policy (how prior turns reach the CLI). */
195
+ continuation?: AgentCliContinuation;
196
+ requires?: AgentCliRequires;
197
+ examples?: AgentCliExample[];
198
+ tags?: string[];
199
+ metadata?: Record<string, unknown>;
200
+ }
201
+ type AgentCliHandle = Readonly<AgentCliDefinition>;
202
+ /**
203
+ * Connection options handed to a protocol arm by the runner. Sandbox
204
+ * resolution + secrets injection happen *before* this point — the arm
205
+ * receives a flat env map and a working dir.
206
+ */
207
+ interface AgentCliConnectOptions {
208
+ cwd: string;
209
+ env: Record<string, string>;
210
+ abortSignal: AbortSignal;
211
+ /**
212
+ * When set, the protocol arm reattaches to the agent's existing
213
+ * session with this id (ACP `loadSession`, MCP equivalent, or argv
214
+ * `--resume`) instead of starting a fresh one. The agent decides
215
+ * the wire mechanics; the host is responsible for having stored the
216
+ * id from a prior `connect → newSession`.
217
+ *
218
+ * Drives the `native-resume` continuation strategy. Arms that don't
219
+ * support resume MAY ignore this field; the runner won't reject it
220
+ * because per-protocol semantics aren't visible at this layer.
221
+ */
222
+ resumeSessionId?: string;
223
+ }
224
+ /**
225
+ * Per-turn dispatch shape. Implemented by every protocol arm
226
+ * (ACP, MCP, proprietary). The runner is the only call site for
227
+ * these methods; consumers see {@link AgentCliSession} instead.
228
+ */
229
+ interface AgentCliClient {
230
+ connect(opts: AgentCliConnectOptions): Promise<void>;
231
+ send(turnId: string, message: unknown): Promise<void>;
232
+ events(): AsyncIterable<StreamEvent>;
233
+ cancel(turnId: string): Promise<void>;
234
+ close(): Promise<void>;
235
+ /**
236
+ * The session id the protocol arm holds. Populated after `connect()`
237
+ * resolves — for `newSession` calls it's whatever the agent assigned;
238
+ * for `loadSession` (resume) calls it's the same id the host passed
239
+ * in. Hosts persist this so a future cold start can resume.
240
+ *
241
+ * Empty string before connect or for protocols that don't have a
242
+ * session concept (proprietary one-shots).
243
+ */
244
+ readonly sessionId?: string;
245
+ }
246
+ /**
247
+ * The runtime handle returned by `defineAgentCli` — call `.start()`
248
+ * to spawn the binary and obtain a {@link AgentCliRuntimeSession}.
249
+ */
250
+ interface AgentCliRuntime {
251
+ readonly definition: AgentCliHandle;
252
+ start(opts?: AgentCliStartOptions): Promise<AgentCliRuntimeSession>;
253
+ }
254
+ interface AgentCliStartOptions {
255
+ cwd?: string;
256
+ env?: Record<string, string>;
257
+ signal?: AbortSignal;
258
+ /**
259
+ * Per-turn runtime configuration — selects a manifest mode, sets
260
+ * options, and picks the continuation strategy. Validated against
261
+ * the manifest's declarations before spawn; unknown ids reject.
262
+ */
263
+ config?: RuntimeConfig;
264
+ /**
265
+ * Identity context the host hands to the continuation strategy.
266
+ * The pinned-session strategy uses this to derive its session-pin
267
+ * key (per `manifest.continuation.pinned_session.key_scope`); other
268
+ * strategies may ignore. Hosts SHOULD always pass this when in a
269
+ * conversation context — without it, pinning can't be keyed and
270
+ * the strategy falls back to per-spawn behaviour.
271
+ */
272
+ turnCtx?: TurnContext;
273
+ /**
274
+ * Reattach to an existing protocol session (ACP `loadSession`, MCP
275
+ * equivalent, argv `--resume`) instead of spawning fresh. The
276
+ * `native-resume` strategy populates this from the host's persisted
277
+ * (turnCtx → sessionId) lookup. Other strategies leave undefined.
278
+ * Forwarded verbatim to `protocolArm.connect({ resumeSessionId })`.
279
+ */
280
+ resumeSessionId?: string;
281
+ }
282
+ /**
283
+ * Operator-side runtime configuration. Mirrors the `runtime.config`
284
+ * block in AIP-9 OPERATOR.md. Every field is optional; omitted fields
285
+ * fall back to the manifest's declared defaults.
286
+ */
287
+ interface RuntimeConfig {
288
+ /** Manifest-declared mode id. Unknown ids reject at validation time. */
289
+ mode?: string;
290
+ /** Manifest-declared option ids → values. Type / enum / bound checked. */
291
+ options?: Record<string, boolean | number | string>;
292
+ /** Continuation strategy id. Must be in `manifest.continuation.supported`. */
293
+ continuation?: ContinuationStrategyId;
294
+ }
295
+ /**
296
+ * Identity scope for continuation key derivation. The host populates
297
+ * the fields it knows; the pinned-session strategy's `key_scope` array
298
+ * picks which to actually combine. Missing fields the scope asked for
299
+ * downgrade the strategy to per-spawn behaviour with a console warning
300
+ * (rather than silently colliding pins across operators / conversations).
301
+ */
302
+ interface TurnContext {
303
+ conversation?: string;
304
+ operator?: string;
305
+ user?: string;
306
+ guild?: string;
307
+ workspace?: string;
308
+ }
309
+ interface AgentCliRuntimeSession {
310
+ readonly sessionId: string;
311
+ send(message: unknown): AsyncIterable<StreamEvent>;
312
+ cancel(): Promise<void>;
313
+ close(): Promise<void>;
314
+ }
315
+
316
+ /**
317
+ * AIP-45 AGENT-CLI.md frontmatter zod schema.
318
+ *
319
+ * Mirrors `resources/aip-45/draft/AGENT-CLI.schema.json`. AIP-45 is a
320
+ * sibling of AIP-29 (CLI.md, tool CLIs) covering interactive
321
+ * agent-as-process binaries. The `protocol` discriminator (acp / mcp
322
+ * / proprietary) selects the wire arm; cross-field rules ensure the
323
+ * matching arm-specific block is present.
324
+ *
325
+ * Both authoring paths (`define-agent-cli.ts` and
326
+ * `manifest/index.ts`) validate against this schema, so every
327
+ * field-level constraint runs in both paths from a single source of
328
+ * truth.
329
+ */
330
+
331
+ declare const agentCliFrontmatterSchema: z.ZodObject<{
332
+ name: z.ZodString;
333
+ id: z.ZodString;
334
+ description: z.ZodString;
335
+ version: z.ZodString;
336
+ bin: z.ZodString;
337
+ bin_args: z.ZodOptional<z.ZodArray<z.ZodString>>;
338
+ install: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
339
+ method: z.ZodLiteral<"brew">;
340
+ package: z.ZodString;
341
+ experimental: z.ZodOptional<z.ZodBoolean>;
342
+ }, z.core.$strict>, z.ZodObject<{
343
+ method: z.ZodLiteral<"apt">;
344
+ package: z.ZodString;
345
+ experimental: z.ZodOptional<z.ZodBoolean>;
346
+ }, z.core.$strict>, z.ZodObject<{
347
+ method: z.ZodLiteral<"dnf">;
348
+ package: z.ZodString;
349
+ experimental: z.ZodOptional<z.ZodBoolean>;
350
+ }, z.core.$strict>, z.ZodObject<{
351
+ method: z.ZodLiteral<"pacman">;
352
+ package: z.ZodString;
353
+ experimental: z.ZodOptional<z.ZodBoolean>;
354
+ }, z.core.$strict>, z.ZodObject<{
355
+ method: z.ZodLiteral<"choco">;
356
+ package: z.ZodString;
357
+ experimental: z.ZodOptional<z.ZodBoolean>;
358
+ }, z.core.$strict>, z.ZodObject<{
359
+ method: z.ZodLiteral<"scoop">;
360
+ package: z.ZodString;
361
+ experimental: z.ZodOptional<z.ZodBoolean>;
362
+ }, z.core.$strict>, z.ZodObject<{
363
+ method: z.ZodLiteral<"npm">;
364
+ package: z.ZodString;
365
+ global: z.ZodOptional<z.ZodBoolean>;
366
+ experimental: z.ZodOptional<z.ZodBoolean>;
367
+ }, z.core.$strict>, z.ZodObject<{
368
+ method: z.ZodLiteral<"pip">;
369
+ package: z.ZodString;
370
+ user: z.ZodOptional<z.ZodBoolean>;
371
+ experimental: z.ZodOptional<z.ZodBoolean>;
372
+ }, z.core.$strict>, z.ZodObject<{
373
+ method: z.ZodLiteral<"cargo">;
374
+ package: z.ZodString;
375
+ experimental: z.ZodOptional<z.ZodBoolean>;
376
+ }, z.core.$strict>, z.ZodObject<{
377
+ method: z.ZodLiteral<"go">;
378
+ package: z.ZodString;
379
+ experimental: z.ZodOptional<z.ZodBoolean>;
380
+ }, z.core.$strict>, z.ZodObject<{
381
+ method: z.ZodLiteral<"curl">;
382
+ url: z.ZodString;
383
+ verify_sha256: z.ZodOptional<z.ZodString>;
384
+ experimental: z.ZodOptional<z.ZodBoolean>;
385
+ }, z.core.$strict>, z.ZodObject<{
386
+ method: z.ZodLiteral<"download">;
387
+ url: z.ZodString;
388
+ extract_bin: z.ZodString;
389
+ verify_sha256: z.ZodOptional<z.ZodString>;
390
+ experimental: z.ZodOptional<z.ZodBoolean>;
391
+ }, z.core.$strict>, z.ZodObject<{
392
+ method: z.ZodLiteral<"vendored">;
393
+ path: z.ZodString;
394
+ experimental: z.ZodOptional<z.ZodBoolean>;
395
+ }, z.core.$strict>], "method">>;
396
+ version_check: z.ZodObject<{
397
+ cmd: z.ZodString;
398
+ parse: z.ZodString;
399
+ range: z.ZodString;
400
+ timeout_ms: z.ZodDefault<z.ZodNumber>;
401
+ }, z.core.$strict>;
402
+ auth: z.ZodOptional<z.ZodObject<{
403
+ ref: z.ZodOptional<z.ZodString>;
404
+ state: z.ZodOptional<z.ZodObject<{
405
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
406
+ env: z.ZodOptional<z.ZodArray<z.ZodString>>;
407
+ }, z.core.$strict>>;
408
+ login: z.ZodOptional<z.ZodObject<{
409
+ cmd: z.ZodString;
410
+ interactive: z.ZodOptional<z.ZodBoolean>;
411
+ requires_callback_url: z.ZodOptional<z.ZodBoolean>;
412
+ }, z.core.$strict>>;
413
+ refresh: z.ZodOptional<z.ZodObject<{
414
+ cmd: z.ZodString;
415
+ interval_s: z.ZodOptional<z.ZodNumber>;
416
+ }, z.core.$strict>>;
417
+ expiry: z.ZodOptional<z.ZodObject<{
418
+ parse: z.ZodOptional<z.ZodString>;
419
+ grace_s: z.ZodOptional<z.ZodNumber>;
420
+ }, z.core.$strict>>;
421
+ }, z.core.$strict>>;
422
+ sandbox: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
423
+ runner: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
424
+ protocol: z.ZodEnum<{
425
+ acp: "acp";
426
+ mcp: "mcp";
427
+ proprietary: "proprietary";
428
+ }>;
429
+ acp: z.ZodOptional<z.ZodString>;
430
+ mcp: z.ZodOptional<z.ZodObject<{
431
+ command: z.ZodOptional<z.ZodString>;
432
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
433
+ transport: z.ZodEnum<{
434
+ stdio: "stdio";
435
+ http: "http";
436
+ sse: "sse";
437
+ }>;
438
+ url: z.ZodOptional<z.ZodString>;
439
+ }, z.core.$strict>>;
440
+ adapter: z.ZodOptional<z.ZodString>;
441
+ session: z.ZodOptional<z.ZodObject<{
442
+ mode: z.ZodDefault<z.ZodEnum<{
443
+ ephemeral: "ephemeral";
444
+ persistent: "persistent";
445
+ resumable: "resumable";
446
+ }>>;
447
+ idle_timeout_ms: z.ZodDefault<z.ZodNumber>;
448
+ max_turns: z.ZodOptional<z.ZodNumber>;
449
+ context_carryover: z.ZodDefault<z.ZodBoolean>;
450
+ }, z.core.$strict>>;
451
+ models: z.ZodOptional<z.ZodObject<{
452
+ default: z.ZodOptional<z.ZodString>;
453
+ allowed: z.ZodOptional<z.ZodArray<z.ZodString>>;
454
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
455
+ }, z.core.$strict>>;
456
+ capabilities: z.ZodOptional<z.ZodObject<{
457
+ streaming: z.ZodOptional<z.ZodBoolean>;
458
+ tool_calls: z.ZodOptional<z.ZodBoolean>;
459
+ sub_agents: z.ZodOptional<z.ZodBoolean>;
460
+ file_io: z.ZodOptional<z.ZodBoolean>;
461
+ multimodal: z.ZodOptional<z.ZodBoolean>;
462
+ resumable: z.ZodOptional<z.ZodBoolean>;
463
+ bidirectional: z.ZodOptional<z.ZodBoolean>;
464
+ }, z.core.$strict>>;
465
+ modes: z.ZodOptional<z.ZodArray<z.ZodObject<{
466
+ id: z.ZodString;
467
+ description: z.ZodOptional<z.ZodString>;
468
+ bin_args_append: z.ZodOptional<z.ZodArray<z.ZodString>>;
469
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
470
+ }, z.core.$strict>>>;
471
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
472
+ id: z.ZodString;
473
+ type: z.ZodEnum<{
474
+ string: "string";
475
+ boolean: "boolean";
476
+ enum: "enum";
477
+ integer: "integer";
478
+ }>;
479
+ description: z.ZodOptional<z.ZodString>;
480
+ enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
481
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString]>>;
482
+ min: z.ZodOptional<z.ZodNumber>;
483
+ max: z.ZodOptional<z.ZodNumber>;
484
+ bin_args_template: z.ZodOptional<z.ZodArray<z.ZodString>>;
485
+ bin_args_append_when_true: z.ZodOptional<z.ZodArray<z.ZodString>>;
486
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
487
+ }, z.core.$strict>>>;
488
+ continuation: z.ZodOptional<z.ZodObject<{
489
+ default: z.ZodEnum<{
490
+ none: "none";
491
+ "pinned-session": "pinned-session";
492
+ transcript: "transcript";
493
+ "native-resume": "native-resume";
494
+ }>;
495
+ supported: z.ZodArray<z.ZodEnum<{
496
+ none: "none";
497
+ "pinned-session": "pinned-session";
498
+ transcript: "transcript";
499
+ "native-resume": "native-resume";
500
+ }>>;
501
+ pinned_session: z.ZodOptional<z.ZodObject<{
502
+ idle_timeout_ms: z.ZodDefault<z.ZodNumber>;
503
+ key_scope: z.ZodDefault<z.ZodArray<z.ZodEnum<{
504
+ conversation: "conversation";
505
+ operator: "operator";
506
+ user: "user";
507
+ guild: "guild";
508
+ workspace: "workspace";
509
+ }>>>;
510
+ }, z.core.$strict>>;
511
+ }, z.core.$strict>>;
512
+ requires: z.ZodOptional<z.ZodObject<{
513
+ os: z.ZodOptional<z.ZodArray<z.ZodEnum<{
514
+ darwin: "darwin";
515
+ linux: "linux";
516
+ windows: "windows";
517
+ }>>>;
518
+ arch: z.ZodOptional<z.ZodArray<z.ZodEnum<{
519
+ x64: "x64";
520
+ arm64: "arm64";
521
+ x86: "x86";
522
+ arm: "arm";
523
+ }>>>;
524
+ min_disk_mb: z.ZodOptional<z.ZodNumber>;
525
+ min_memory_mb: z.ZodOptional<z.ZodNumber>;
526
+ }, z.core.$strict>>;
527
+ examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
528
+ goal: z.ZodString;
529
+ prompt: z.ZodString;
530
+ note: z.ZodOptional<z.ZodString>;
531
+ }, z.core.$strict>>>;
532
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
533
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
534
+ }, z.core.$strict>;
535
+ type AgentCliFrontmatter = z.infer<typeof agentCliFrontmatterSchema>;
536
+ declare const runtimeConfigSchema: z.ZodObject<{
537
+ mode: z.ZodOptional<z.ZodString>;
538
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString]>>>;
539
+ continuation: z.ZodOptional<z.ZodEnum<{
540
+ none: "none";
541
+ "pinned-session": "pinned-session";
542
+ transcript: "transcript";
543
+ "native-resume": "native-resume";
544
+ }>>;
545
+ }, z.core.$strict>;
546
+ type RuntimeConfigInput = z.infer<typeof runtimeConfigSchema>;
547
+
548
+ export { type AgentCliHandle as A, type ContinuationStrategyId as C, type RuntimeConfig as R, type TurnContext as T, type AgentCliRuntime as a, type AgentCliDefinition as b, type AgentCliClient as c, type AgentCliStartOptions as d, type AgentCliRuntimeSession as e, type ContinuationKeyScope as f, type AgentCliAuth as g, type AgentCliCapabilities as h, type AgentCliConnectOptions as i, type AgentCliContinuation as j, type AgentCliFrontmatter as k, type AgentCliInstallMethod as l, type AgentCliMcpBlock as m, type AgentCliMode as n, type AgentCliModels as o, type AgentCliOption as p, type AgentCliOptionType as q, type AgentCliPinnedSessionTuning as r, type AgentCliProtocol as s, type AgentCliSession as t, type AgentCliSessionMode as u, type AgentCliVersionCheck as v, type RuntimeConfigInput as w, agentCliFrontmatterSchema as x, runtimeConfigSchema as y };
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "@agentproto/driver-agent-cli",
3
+ "version": "0.1.0-alpha.0",
4
+ "description": "@agentproto/driver-agent-cli — AIP-45 AGENT-CLI.md reference implementation. Multi-protocol runner that loads an AGENT-CLI.md manifest, spawns the binary, and dispatches turns through an ACP / MCP / proprietary arm. ACP arm delegates to @agentproto/acp; emits the canonical StreamEvent taxonomy regardless of underlying protocol.",
5
+ "keywords": [
6
+ "agentproto",
7
+ "aip-45",
8
+ "agent-cli",
9
+ "interactive",
10
+ "hermes",
11
+ "claude-code",
12
+ "opencode",
13
+ "goose",
14
+ "gemini-cli",
15
+ "acp",
16
+ "mcp"
17
+ ],
18
+ "homepage": "https://agentproto.sh/docs/aip-45",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/agentproto/ts",
22
+ "directory": "packages/driver/agent-cli"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/agentproto/ts/issues"
26
+ },
27
+ "license": "MIT",
28
+ "type": "module",
29
+ "main": "dist/index.mjs",
30
+ "module": "dist/index.mjs",
31
+ "types": "dist/index.d.ts",
32
+ "exports": {
33
+ ".": {
34
+ "types": "./dist/index.d.ts",
35
+ "import": "./dist/index.mjs",
36
+ "default": "./dist/index.mjs"
37
+ },
38
+ "./manifest": {
39
+ "types": "./dist/manifest/index.d.ts",
40
+ "import": "./dist/manifest/index.mjs",
41
+ "default": "./dist/manifest/index.mjs"
42
+ },
43
+ "./package.json": "./package.json"
44
+ },
45
+ "files": [
46
+ "dist",
47
+ "README.md",
48
+ "LICENSE"
49
+ ],
50
+ "publishConfig": {
51
+ "access": "public"
52
+ },
53
+ "dependencies": {
54
+ "gray-matter": "^4.0.3",
55
+ "zod": "^4.3.6",
56
+ "@agentproto/acp": "0.1.0-alpha.0",
57
+ "@agentproto/define-doctype": "0.1.0-alpha.0"
58
+ },
59
+ "devDependencies": {
60
+ "@types/node": "^25.1.0",
61
+ "tsup": "^8.5.1",
62
+ "typescript": "^5.9.3",
63
+ "vitest": "^3.2.4",
64
+ "@agentproto/tooling": "0.1.0-alpha.0"
65
+ },
66
+ "scripts": {
67
+ "dev": "tsup --watch",
68
+ "build": "tsup",
69
+ "clean": "rm -rf dist",
70
+ "check-types": "tsc --noEmit",
71
+ "test": "vitest run --passWithNoTests",
72
+ "test:watch": "vitest"
73
+ }
74
+ }