@agentproto/driver-agent-cli 0.3.0 → 1.0.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/LICENSE +202 -21
- package/dist/{chunk-KHHRPQ2Q.mjs → chunk-XTZNZ7MA.mjs} +237 -28
- package/dist/chunk-XTZNZ7MA.mjs.map +1 -0
- package/dist/index.d.ts +22 -5
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/manifest/index.d.ts +2 -2
- package/dist/manifest/index.mjs +2 -2
- package/dist/{schema-Ds8jc9fL.d.ts → schema-D_7v0nav.d.ts} +342 -2
- package/package.json +4 -4
- package/dist/chunk-KHHRPQ2Q.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AcpMcpServer, StreamEvent } from '@agentproto/acp';
|
|
1
|
+
import { AcpMcpServer, StreamEvent, AcpPermissionResolution } from '@agentproto/acp';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -49,6 +49,44 @@ interface AgentCliAuth {
|
|
|
49
49
|
grace_s?: number;
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* The `subscription` (OAuth / bearer) billing mode declaration — the ONE
|
|
54
|
+
* axis of the billing-auth resolver that isn't a shared provider fact, so it
|
|
55
|
+
* lives on the adapter manifest rather than in the model catalog. Its env var
|
|
56
|
+
* is consumer-specific (claude CLI wrapper → `CLAUDE_CODE_OAUTH_TOKEN`;
|
|
57
|
+
* claude-sdk → `ANTHROPIC_AUTH_TOKEN`). Presence of this field is what tells
|
|
58
|
+
* the runtime "this adapter supports `subscription` mode"; an adapter without
|
|
59
|
+
* it that's asked for `subscription` fails with `unsupported_auth_mode`.
|
|
60
|
+
*
|
|
61
|
+
* The api-key axis needs NO such declaration — its env var derives from the
|
|
62
|
+
* catalog's `PROVIDER_KEY_ENV` via `providerEnvVar(provider)`; only the
|
|
63
|
+
* runtime resolver reads it, never this manifest.
|
|
64
|
+
*/
|
|
65
|
+
interface AgentCliAuthSubscription {
|
|
66
|
+
/** Env var SET to the resolved subscription credential (the OAuth/bearer
|
|
67
|
+
* token). */
|
|
68
|
+
setEnv: string;
|
|
69
|
+
/**
|
|
70
|
+
* Sibling billing-credential env vars the SAME consumer also honors and
|
|
71
|
+
* that must therefore be scrubbed in EVERY resolved mode except when the
|
|
72
|
+
* var IS the one being set — a leftover of one of these would silently
|
|
73
|
+
* override the credential this spawn stated (the org-credit-leak class).
|
|
74
|
+
* For anthropic: the generic bearer `ANTHROPIC_AUTH_TOKEN`, which the
|
|
75
|
+
* claude binary honors above `ANTHROPIC_API_KEY`. Distinct from
|
|
76
|
+
* {@link unsetEnvAdd} (which is native-mode-only gateway hygiene, not a
|
|
77
|
+
* credential).
|
|
78
|
+
*/
|
|
79
|
+
conflictEnv?: string[];
|
|
80
|
+
/**
|
|
81
|
+
* Extra env vars scrubbed ONLY in `subscription` (native) mode — gateway
|
|
82
|
+
* hygiene, not credentials: cloud-provider redirect toggles
|
|
83
|
+
* (`CLAUDE_CODE_USE_BEDROCK`/`_VERTEX`/…) + `ANTHROPIC_BASE_URL`, any of
|
|
84
|
+
* which would reroute or 401 a natively-billed spawn. Left present in
|
|
85
|
+
* api-key mode (a deliberate api-key + Bedrock combination is valid there),
|
|
86
|
+
* which is why this is separate from {@link conflictEnv}.
|
|
87
|
+
*/
|
|
88
|
+
unsetEnvAdd?: string[];
|
|
89
|
+
}
|
|
52
90
|
/**
|
|
53
91
|
* Re-runnable health check that, when matching, skips the enclosing
|
|
54
92
|
* setup step. Lets `agentproto setup <slug>` re-runs be idempotent
|
|
@@ -151,6 +189,18 @@ interface AgentCliSession {
|
|
|
151
189
|
interface AgentCliModels {
|
|
152
190
|
default?: string;
|
|
153
191
|
allowed?: string[];
|
|
192
|
+
/**
|
|
193
|
+
* Model-id patterns this adapter must NEVER route to, even when a caller
|
|
194
|
+
* passes the id explicitly (the `model` option is free-form, so `allowed`
|
|
195
|
+
* is only a curated menu and can't *prevent* an off-menu id). Each pattern
|
|
196
|
+
* matches case-insensitively against the requested model id and supports a
|
|
197
|
+
* single trailing `*` wildcard (prefix match); otherwise exact. A match is
|
|
198
|
+
* refused at compose time (`RuntimeConfigError`, code `model_denied`).
|
|
199
|
+
* Use to reserve a premium provider for a dedicated adapter — e.g. hermes
|
|
200
|
+
* denies `["anthropic/*", "claude-*"]` so Anthropic models stay exclusive
|
|
201
|
+
* to the claude-code adapter.
|
|
202
|
+
*/
|
|
203
|
+
deny?: string[];
|
|
154
204
|
env?: Record<string, string>;
|
|
155
205
|
/**
|
|
156
206
|
* How the host selects a model at session start:
|
|
@@ -182,6 +232,16 @@ interface AgentCliCapabilities {
|
|
|
182
232
|
*/
|
|
183
233
|
file_attach?: boolean;
|
|
184
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* Support status for a declared mode. Absent ⇒ treated as `"active"`.
|
|
237
|
+
* active — the mode does what its description claims.
|
|
238
|
+
* noop — declared and accepted, but measured to have no effect
|
|
239
|
+
* (argv/env compose fine, but the observable outcome is
|
|
240
|
+
* identical to not passing it). Kept declared for honesty
|
|
241
|
+
* and so a future fix can flip it back to `active`.
|
|
242
|
+
* planned — declared as an intended surface but not wired yet.
|
|
243
|
+
*/
|
|
244
|
+
type AgentCliModeStatus = "active" | "noop" | "planned";
|
|
185
245
|
/**
|
|
186
246
|
* AIP-45 mode declaration — a mutually-exclusive operation profile
|
|
187
247
|
* the CLI exposes. The host picks at most ONE mode per turn via
|
|
@@ -191,8 +251,51 @@ interface AgentCliCapabilities {
|
|
|
191
251
|
interface AgentCliMode {
|
|
192
252
|
id: string;
|
|
193
253
|
description?: string;
|
|
254
|
+
/**
|
|
255
|
+
* Extra argv prepended BEFORE the manifest's default `bin_args` when
|
|
256
|
+
* this mode is active. Needed for CLIs whose global flags must
|
|
257
|
+
* precede a subcommand baked into `bin_args` (e.g. hermes'
|
|
258
|
+
* `--ignore-user-config` must come before `acp`, where
|
|
259
|
+
* `bin_args_append` would land it too late).
|
|
260
|
+
*/
|
|
261
|
+
bin_args_prepend?: string[];
|
|
194
262
|
bin_args_append?: string[];
|
|
195
263
|
env?: Record<string, string>;
|
|
264
|
+
/**
|
|
265
|
+
* Env keys to DELETE from the spawn env when this mode is active.
|
|
266
|
+
* Applied at the runtime's env-merge point (after the ambient
|
|
267
|
+
* process.env + mode/option env are combined), so a mode can scrub a
|
|
268
|
+
* credential that must never reach a non-native endpoint — e.g. a
|
|
269
|
+
* gateway mode scrubbing `ANTHROPIC_API_KEY` so it can't leak to a
|
|
270
|
+
* third-party Anthropic-compatible host (it would both 401 and expose
|
|
271
|
+
* the real key). Unlike `env`, this can't be expressed as a static
|
|
272
|
+
* set (a key set to "" is still present); deletion is the only safe
|
|
273
|
+
* semantics. Mirrors the in-code scrub `claude-sdk` does in
|
|
274
|
+
* `buildQueryOptions`; surfaced here so CLI-adapter gateway modes
|
|
275
|
+
* get the same auth hygiene without per-adapter code.
|
|
276
|
+
*/
|
|
277
|
+
env_unset?: string[];
|
|
278
|
+
/**
|
|
279
|
+
* Honest support status surfaced to clients (e.g. via `adapter_list`).
|
|
280
|
+
* Lets an adapter admit that a declared mode is a measured no-op or
|
|
281
|
+
* not-yet-wired instead of silently accepting it. Absent ⇒ `"active"`.
|
|
282
|
+
*/
|
|
283
|
+
status?: AgentCliModeStatus;
|
|
284
|
+
/** Human-readable reason backing `status` (e.g. what was measured). */
|
|
285
|
+
status_note?: string;
|
|
286
|
+
/**
|
|
287
|
+
* How the host activates this mode at session start:
|
|
288
|
+
* - "bin_args" (default) — apply via this mode's `bin_args_prepend` /
|
|
289
|
+
* `bin_args_append` / `env`, composed into argv/env at spawn time.
|
|
290
|
+
* Preserves every existing adapter's behavior unchanged.
|
|
291
|
+
* - "config" — this CLI has no argv/env surface for mode selection;
|
|
292
|
+
* instead the mode id is forwarded to the ACP arm's `connect({mode})`
|
|
293
|
+
* and applied via `session/set_config_option` with `configId:"mode"`
|
|
294
|
+
* after `newSession` (e.g. opencode). `bin_args_prepend` /
|
|
295
|
+
* `bin_args_append` / `env` are ignored for a mode declaring this.
|
|
296
|
+
* Omit → "bin_args".
|
|
297
|
+
*/
|
|
298
|
+
apply?: "bin_args" | "config";
|
|
196
299
|
}
|
|
197
300
|
type AgentCliOptionType = "boolean" | "integer" | "string" | "enum";
|
|
198
301
|
/**
|
|
@@ -211,6 +314,14 @@ interface AgentCliOption {
|
|
|
211
314
|
min?: number;
|
|
212
315
|
/** Inclusive upper bound when type === "integer". */
|
|
213
316
|
max?: number;
|
|
317
|
+
/**
|
|
318
|
+
* Argv template prepended BEFORE the manifest's default `bin_args`
|
|
319
|
+
* when the option has a non-default value. The literal token
|
|
320
|
+
* `{value}` is replaced with the option's value (stringified). Use
|
|
321
|
+
* for value-bearing global flags that must precede a subcommand
|
|
322
|
+
* (e.g. hermes' `--skills {value}`).
|
|
323
|
+
*/
|
|
324
|
+
bin_args_prepend?: string[];
|
|
214
325
|
/**
|
|
215
326
|
* Argv template appended when the option has a non-default value.
|
|
216
327
|
* The literal token `{value}` is replaced with the option's value
|
|
@@ -227,6 +338,63 @@ interface AgentCliOption {
|
|
|
227
338
|
* may contain `{value}` for templating.
|
|
228
339
|
*/
|
|
229
340
|
env?: Record<string, string>;
|
|
341
|
+
/**
|
|
342
|
+
* Env keys to DELETE from the spawn env when the option has a
|
|
343
|
+
* non-default value. Symmetric with `AgentCliMode.env_unset` and
|
|
344
|
+
* applied at the same runtime env-merge point. Lets a single option
|
|
345
|
+
* carry both the value it sets AND the credential it must displace —
|
|
346
|
+
* e.g. a `base_url` option pointing at a third-party Anthropic-
|
|
347
|
+
* compatible gateway should scrub the ambient `ANTHROPIC_API_KEY`
|
|
348
|
+
* so it can't leak, without forcing the operator to also pick a
|
|
349
|
+
* preset mode. The deletion runs before operator-supplied `opts.env`
|
|
350
|
+
* is merged, so a caller can still re-inject a specific key if they
|
|
351
|
+
* truly intend to.
|
|
352
|
+
*/
|
|
353
|
+
env_unset?: string[];
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* AIP-45 gateway-preset declaration — a backend an Anthropic/OpenAI-
|
|
357
|
+
* compatible client can front, declared by the adapter that knows how to
|
|
358
|
+
* drive it. The manifest authoring shape; the runtime normalizes it to a
|
|
359
|
+
* `ProviderPreset` (via the catalog's merge seam) so adapter-declared
|
|
360
|
+
* presets appear in `agentproto presets list` / `list_provider_presets`
|
|
361
|
+
* alongside the built-in registry. Data-only — no adapter projection
|
|
362
|
+
* (`env`/`env_unset`/`bin_args`) here; that stays in the adapter's modes
|
|
363
|
+
* and options, same as the built-in presets are projected today.
|
|
364
|
+
*/
|
|
365
|
+
interface AgentCliPresetDeclaration {
|
|
366
|
+
/**
|
|
367
|
+
* Stable preset id. SHOULD equal the mode id if the adapter projects
|
|
368
|
+
* this preset as a mode (e.g. `moonshot`, `openrouter`). Catalog
|
|
369
|
+
* dedupes built-in vs adapter-declared by id; an adapter-declared id
|
|
370
|
+
* that collides with a built-in is ignored in favor of the built-in
|
|
371
|
+
* (the registry is the source of truth for canonical providers).
|
|
372
|
+
*/
|
|
373
|
+
id: string;
|
|
374
|
+
/** Human label for the catalog UI ("Moonshot (Kimi)"). */
|
|
375
|
+
label: string;
|
|
376
|
+
/** Short description; surfaced in the catalog. */
|
|
377
|
+
description?: string;
|
|
378
|
+
/** API schema flavor — selects which adapter family can consume it. */
|
|
379
|
+
schemaFlavor: "anthropic" | "openai";
|
|
380
|
+
/** Base URL the client hits. */
|
|
381
|
+
baseUrl: string;
|
|
382
|
+
/**
|
|
383
|
+
* Conventional env var holding this provider's API key
|
|
384
|
+
* (e.g. MOONSHOT_API_KEY). Catalog status is derived from its presence
|
|
385
|
+
* in the daemon's environment ("ready" vs "available").
|
|
386
|
+
*/
|
|
387
|
+
keyEnv: string;
|
|
388
|
+
/**
|
|
389
|
+
* Env vars to scrub when this preset is active. Optional at the
|
|
390
|
+
* manifest level — an adapter that scrubs in code (like claude-sdk)
|
|
391
|
+
* may omit it. The catalog does not surface `scrubEnv` to clients.
|
|
392
|
+
*/
|
|
393
|
+
scrubEnv?: string[];
|
|
394
|
+
/** Conventional default model id for this provider, if any. */
|
|
395
|
+
defaultModel?: string;
|
|
396
|
+
/** Optional homepage/docs URL for the catalog UI. */
|
|
397
|
+
homepage?: string;
|
|
230
398
|
}
|
|
231
399
|
/**
|
|
232
400
|
* Built-in continuation strategy ids. Future custom strategies require
|
|
@@ -337,11 +505,50 @@ interface AgentCliDefinition {
|
|
|
337
505
|
version: string;
|
|
338
506
|
bin: string;
|
|
339
507
|
bin_args?: string[];
|
|
508
|
+
/**
|
|
509
|
+
* Static environment variables always merged into the spawn env,
|
|
510
|
+
* before any mode/option env patch (so those can still override).
|
|
511
|
+
* The always-on counterpart to `modes[].env` / `options[].env`, which
|
|
512
|
+
* only apply when the corresponding mode/option is selected. Primary
|
|
513
|
+
* user is a generic ACP agent (`acpHandleFromSpec`) whose whole config
|
|
514
|
+
* surface is bin + args + env; a native adapter can use it too for env
|
|
515
|
+
* that should apply on every spawn regardless of mode.
|
|
516
|
+
*/
|
|
517
|
+
env?: Record<string, string>;
|
|
340
518
|
install: AgentCliInstallMethod[];
|
|
341
519
|
version_check: AgentCliVersionCheck;
|
|
342
520
|
/** AIP-29 § Setup — post-install configuration pipeline. Optional. */
|
|
343
521
|
setup?: AgentCliSetupStep[];
|
|
344
522
|
auth?: AgentCliAuth;
|
|
523
|
+
/**
|
|
524
|
+
* FIXED billing provider for a single-provider adapter (`claude-code` /
|
|
525
|
+
* `claude-sdk` → `"anthropic"`, `codex` → `"openai"`, `hermes` →
|
|
526
|
+
* `"openrouter"`). A `CatalogProvider` id (typed as `string` here to keep
|
|
527
|
+
* this generic AIP-45 doctype decoupled from `@agentproto/model-catalog` —
|
|
528
|
+
* the runtime resolver validates it against the catalog and derives the
|
|
529
|
+
* api-key env via `providerEnvVar`). Omitted for by-model routers, whose
|
|
530
|
+
* provider the resolver derives from the requested model
|
|
531
|
+
* (`getModelProvider`). Consumed by the runtime billing-auth resolver, NOT
|
|
532
|
+
* by this driver (which stays mechanical).
|
|
533
|
+
*/
|
|
534
|
+
provider?: string;
|
|
535
|
+
/**
|
|
536
|
+
* Declares that this adapter supports `subscription` billing mode and how
|
|
537
|
+
* (which env var to set + what to scrub). Presence = supported; absence
|
|
538
|
+
* means a `subscription` request is rejected with `unsupported_auth_mode`.
|
|
539
|
+
* Only the Claude adapters set it. See {@link AgentCliAuthSubscription}.
|
|
540
|
+
*/
|
|
541
|
+
authSubscription?: AgentCliAuthSubscription;
|
|
542
|
+
/**
|
|
543
|
+
* When the runtime billing-auth resolver ENGAGES credential injection:
|
|
544
|
+
* - `"when-configured"` (default) — only when an operator explicitly set
|
|
545
|
+
* `auth` (per-spawn or in `defaults.adapters.<slug>.auth`). Non-breaking:
|
|
546
|
+
* an adapter with no auth config runs ambient, unchanged.
|
|
547
|
+
* - `"always"` — every spawn, even with nothing configured (then it
|
|
548
|
+
* fails fast with `missing_auth_credential`). Only `claude-code` sets
|
|
549
|
+
* this, preserving its #312 fail-fast contract.
|
|
550
|
+
*/
|
|
551
|
+
authEnforce?: "always" | "when-configured";
|
|
345
552
|
sandbox: string | Record<string, unknown>;
|
|
346
553
|
runner?: string | Record<string, unknown>;
|
|
347
554
|
protocol: AgentCliProtocol;
|
|
@@ -360,6 +567,15 @@ interface AgentCliDefinition {
|
|
|
360
567
|
modes?: AgentCliMode[];
|
|
361
568
|
/** AIP-45 options (independent typed knobs). */
|
|
362
569
|
options?: AgentCliOption[];
|
|
570
|
+
/**
|
|
571
|
+
* AIP-45 gateway presets this adapter can drive. Adapter-declared
|
|
572
|
+
* presets are merged into the provider-preset catalog
|
|
573
|
+
* (`agentproto presets list` / `list_provider_presets`) alongside the
|
|
574
|
+
* built-in registry, deduped by id (built-in wins on collision). Lets
|
|
575
|
+
* an external adapter surface a gateway the built-in registry doesn't
|
|
576
|
+
* know about without patching `@agentproto/provider-presets`.
|
|
577
|
+
*/
|
|
578
|
+
presets?: AgentCliPresetDeclaration[];
|
|
363
579
|
/** AIP-45 continuation policy (how prior turns reach the CLI). */
|
|
364
580
|
continuation?: AgentCliContinuation;
|
|
365
581
|
requires?: AgentCliRequires;
|
|
@@ -416,6 +632,16 @@ interface AgentCliConnectOptions {
|
|
|
416
632
|
* `session/set_config_option` with `configId:"effort"` on ACP arms.
|
|
417
633
|
*/
|
|
418
634
|
effort?: string;
|
|
635
|
+
/**
|
|
636
|
+
* Mode to activate at session start, for ACP arms whose CLI models
|
|
637
|
+
* mode selection as a session config option rather than an argv/env
|
|
638
|
+
* surface (`AgentCliMode.apply === "config"`, e.g. opencode). Applied
|
|
639
|
+
* via `session/set_config_option` with `configId:"mode"` immediately
|
|
640
|
+
* after `newSession`, best-effort like `model`/`effort`. Adapters that
|
|
641
|
+
* apply mode via `bin_args`/`env` instead (claude-code) leave this
|
|
642
|
+
* unset and are unaffected.
|
|
643
|
+
*/
|
|
644
|
+
mode?: string;
|
|
419
645
|
/**
|
|
420
646
|
* Called on ANY adapter-process activity observed by the protocol
|
|
421
647
|
* arm — incoming ACP `session/update` notifications (even ones that
|
|
@@ -428,6 +654,14 @@ interface AgentCliConnectOptions {
|
|
|
428
654
|
* one-shots) MAY ignore this field.
|
|
429
655
|
*/
|
|
430
656
|
onActivity?: () => void;
|
|
657
|
+
/**
|
|
658
|
+
* When true, the ACP arm surfaces each `session/request_permission` as an
|
|
659
|
+
* `agent-prompt` StreamEvent and HOLDS the RPC until the host calls
|
|
660
|
+
* `respondPermission` — forwarded to the arm's
|
|
661
|
+
* `createAcpProtocolArm({ permissionHold })`. Arms with no permission
|
|
662
|
+
* surface (non-ACP) ignore it. Default false (auto-answer, unchanged).
|
|
663
|
+
*/
|
|
664
|
+
permissionHold?: boolean;
|
|
431
665
|
/**
|
|
432
666
|
* Turn-idle watchdog, forwarded verbatim to the ACP arm's
|
|
433
667
|
* `createAcpClient({ turnIdleTimeoutMs })` (see
|
|
@@ -450,6 +684,13 @@ interface AgentCliClient {
|
|
|
450
684
|
send(turnId: string, message: unknown): Promise<void>;
|
|
451
685
|
events(): AsyncIterable<StreamEvent>;
|
|
452
686
|
cancel(turnId: string): Promise<void>;
|
|
687
|
+
/**
|
|
688
|
+
* Resolve a permission request parked by permission-hold mode — `requestId`
|
|
689
|
+
* is the `toolCallId` carried on the `agent-prompt` StreamEvent that
|
|
690
|
+
* surfaced it. Returns true when a matching parked request was found and
|
|
691
|
+
* resolved. Only the ACP arm implements this; other arms omit it.
|
|
692
|
+
*/
|
|
693
|
+
respondPermission?(requestId: string, resolution: AcpPermissionResolution): boolean;
|
|
453
694
|
close(): Promise<void>;
|
|
454
695
|
/**
|
|
455
696
|
* The session id the protocol arm holds. Populated after `connect()`
|
|
@@ -530,6 +771,58 @@ interface AgentCliStartOptions {
|
|
|
530
771
|
* wants this protection.
|
|
531
772
|
*/
|
|
532
773
|
turnIdleTimeoutMs?: number;
|
|
774
|
+
/**
|
|
775
|
+
* When true, the spawned session runs in permission-hold mode: the ACP arm
|
|
776
|
+
* surfaces each permission request as an `agent-prompt` StreamEvent and
|
|
777
|
+
* HOLDS the RPC until the host calls `respondPermission`. Forwarded to
|
|
778
|
+
* `protocolArm.connect({ permissionHold })`. Default false (unchanged
|
|
779
|
+
* auto-answer behaviour for every existing caller).
|
|
780
|
+
*/
|
|
781
|
+
permissionHold?: boolean;
|
|
782
|
+
/**
|
|
783
|
+
* FULLY-RESOLVED billing-auth spec, computed by the runtime resolver
|
|
784
|
+
* (`@agentproto/runtime`'s `spawn-defaults`/`session-spawn`) and applied
|
|
785
|
+
* MECHANICALLY here — this driver does no provider lookup, mode selection,
|
|
786
|
+
* or catalog import of its own. EXPLICIT credential selection, not
|
|
787
|
+
* scrub-by-absence: the resolver already decided the mode (ordered
|
|
788
|
+
* preference — subscription over api-key when a subscription credential is
|
|
789
|
+
* present), the env var to SET (`setEnv`), the conflicting vars to SCRUB
|
|
790
|
+
* (`unsetEnv`), and resolved the `credential` from a NAMED config/store
|
|
791
|
+
* ref (never the ambient shell env).
|
|
792
|
+
*
|
|
793
|
+
* `createAgentCliRuntime(...).start()` ENGAGES this spec when
|
|
794
|
+
* `enforce === "always"` OR `explicit === true`; on engage it deletes every
|
|
795
|
+
* `unsetEnv` key (unless this spawn's own mode/option patch explicitly set
|
|
796
|
+
* it) then SETS `setEnv = credential`. When engaged with no `credential`, it
|
|
797
|
+
* FAILS FAST with `RuntimeConfigError` (`missing_auth_credential`) — never a
|
|
798
|
+
* fallback to another or ambient credential. When absent (the resolver
|
|
799
|
+
* produced no spec — e.g. a by-model adapter whose provider didn't resolve),
|
|
800
|
+
* this driver injects nothing and runs ambient.
|
|
801
|
+
*/
|
|
802
|
+
auth?: ResolvedAuthSpec;
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* The resolved billing-auth spec the runtime hands the driver — see
|
|
806
|
+
* {@link AgentCliStartOptions.auth}. Every field is pre-decided; the driver
|
|
807
|
+
* only applies it.
|
|
808
|
+
*/
|
|
809
|
+
interface ResolvedAuthSpec {
|
|
810
|
+
/** The resolved billing mode (already ordered/validated by the runtime). */
|
|
811
|
+
mode: "subscription" | "api-key";
|
|
812
|
+
/** The resolved secret value for `mode`, or absent when nothing resolved
|
|
813
|
+
* (⇒ fail-fast on engage). Never read ambiently. */
|
|
814
|
+
credential?: string;
|
|
815
|
+
/** Env var SET to `credential` on engage. */
|
|
816
|
+
setEnv: string;
|
|
817
|
+
/** Conflicting billing-credential (and, in native mode, gateway-hygiene)
|
|
818
|
+
* env vars DELETED on engage — unless this spawn's own mode/option patch
|
|
819
|
+
* explicitly set the key. */
|
|
820
|
+
unsetEnv: string[];
|
|
821
|
+
/** True when an operator explicitly configured `auth` (per-spawn or in
|
|
822
|
+
* `defaults.adapters.<slug>.auth`) — half the engage condition. */
|
|
823
|
+
explicit: boolean;
|
|
824
|
+
/** The adapter's enforcement policy — the other half of engage. */
|
|
825
|
+
enforce: "always" | "when-configured";
|
|
533
826
|
}
|
|
534
827
|
/**
|
|
535
828
|
* Operator-side runtime configuration. Mirrors the `runtime.config`
|
|
@@ -571,6 +864,13 @@ interface AgentCliRuntimeSession {
|
|
|
571
864
|
readonly pid?: number;
|
|
572
865
|
send(message: unknown): AsyncIterable<StreamEvent>;
|
|
573
866
|
cancel(): Promise<void>;
|
|
867
|
+
/**
|
|
868
|
+
* Resolve a permission request parked by permission-hold mode (see
|
|
869
|
+
* `AgentCliStartOptions.permissionHold`). Delegates to the protocol arm's
|
|
870
|
+
* `respondPermission`; returns true when a matching parked request was
|
|
871
|
+
* resolved. Absent for arms that don't model held permissions.
|
|
872
|
+
*/
|
|
873
|
+
respondPermission?(requestId: string, resolution: AcpPermissionResolution): boolean;
|
|
574
874
|
close(): Promise<void>;
|
|
575
875
|
}
|
|
576
876
|
|
|
@@ -596,6 +896,7 @@ declare const agentCliFrontmatterSchema: z.ZodObject<{
|
|
|
596
896
|
version: z.ZodString;
|
|
597
897
|
bin: z.ZodString;
|
|
598
898
|
bin_args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
899
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
599
900
|
install: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
600
901
|
method: z.ZodLiteral<"brew">;
|
|
601
902
|
package: z.ZodString;
|
|
@@ -759,6 +1060,16 @@ declare const agentCliFrontmatterSchema: z.ZodObject<{
|
|
|
759
1060
|
grace_s: z.ZodOptional<z.ZodNumber>;
|
|
760
1061
|
}, z.core.$strict>>;
|
|
761
1062
|
}, z.core.$strict>>;
|
|
1063
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
1064
|
+
authSubscription: z.ZodOptional<z.ZodObject<{
|
|
1065
|
+
setEnv: z.ZodString;
|
|
1066
|
+
conflictEnv: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1067
|
+
unsetEnvAdd: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1068
|
+
}, z.core.$strict>>;
|
|
1069
|
+
authEnforce: z.ZodOptional<z.ZodEnum<{
|
|
1070
|
+
always: "always";
|
|
1071
|
+
"when-configured": "when-configured";
|
|
1072
|
+
}>>;
|
|
762
1073
|
sandbox: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
|
|
763
1074
|
runner: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
|
|
764
1075
|
protocol: z.ZodEnum<{
|
|
@@ -809,6 +1120,7 @@ declare const agentCliFrontmatterSchema: z.ZodObject<{
|
|
|
809
1120
|
models: z.ZodOptional<z.ZodObject<{
|
|
810
1121
|
default: z.ZodOptional<z.ZodString>;
|
|
811
1122
|
allowed: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1123
|
+
deny: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
812
1124
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
813
1125
|
apply: z.ZodOptional<z.ZodEnum<{
|
|
814
1126
|
config: "config";
|
|
@@ -828,8 +1140,20 @@ declare const agentCliFrontmatterSchema: z.ZodObject<{
|
|
|
828
1140
|
modes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
829
1141
|
id: z.ZodString;
|
|
830
1142
|
description: z.ZodOptional<z.ZodString>;
|
|
1143
|
+
bin_args_prepend: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
831
1144
|
bin_args_append: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
832
1145
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1146
|
+
env_unset: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1147
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
1148
|
+
active: "active";
|
|
1149
|
+
noop: "noop";
|
|
1150
|
+
planned: "planned";
|
|
1151
|
+
}>>;
|
|
1152
|
+
status_note: z.ZodOptional<z.ZodString>;
|
|
1153
|
+
apply: z.ZodOptional<z.ZodEnum<{
|
|
1154
|
+
config: "config";
|
|
1155
|
+
bin_args: "bin_args";
|
|
1156
|
+
}>>;
|
|
833
1157
|
}, z.core.$strict>>>;
|
|
834
1158
|
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
835
1159
|
id: z.ZodString;
|
|
@@ -844,9 +1168,25 @@ declare const agentCliFrontmatterSchema: z.ZodObject<{
|
|
|
844
1168
|
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString]>>;
|
|
845
1169
|
min: z.ZodOptional<z.ZodNumber>;
|
|
846
1170
|
max: z.ZodOptional<z.ZodNumber>;
|
|
1171
|
+
bin_args_prepend: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
847
1172
|
bin_args_template: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
848
1173
|
bin_args_append_when_true: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
849
1174
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1175
|
+
env_unset: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1176
|
+
}, z.core.$strict>>>;
|
|
1177
|
+
presets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1178
|
+
id: z.ZodString;
|
|
1179
|
+
label: z.ZodString;
|
|
1180
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1181
|
+
schemaFlavor: z.ZodEnum<{
|
|
1182
|
+
anthropic: "anthropic";
|
|
1183
|
+
openai: "openai";
|
|
1184
|
+
}>;
|
|
1185
|
+
baseUrl: z.ZodString;
|
|
1186
|
+
keyEnv: z.ZodString;
|
|
1187
|
+
scrubEnv: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1188
|
+
defaultModel: z.ZodOptional<z.ZodString>;
|
|
1189
|
+
homepage: z.ZodOptional<z.ZodString>;
|
|
850
1190
|
}, z.core.$strict>>>;
|
|
851
1191
|
continuation: z.ZodOptional<z.ZodObject<{
|
|
852
1192
|
default: z.ZodEnum<{
|
|
@@ -908,4 +1248,4 @@ declare const runtimeConfigSchema: z.ZodObject<{
|
|
|
908
1248
|
}, z.core.$strict>;
|
|
909
1249
|
type RuntimeConfigInput = z.infer<typeof runtimeConfigSchema>;
|
|
910
1250
|
|
|
911
|
-
export { type AgentCliHandle as A, type
|
|
1251
|
+
export { type AgentCliHandle as A, type AgentCliVersionCheck as B, type ContinuationStrategyId as C, type RuntimeConfigInput as D, agentCliFrontmatterSchema as E, runtimeConfigSchema as F, type RuntimeConfig as R, type TurnContext as T, type AgentCliRuntime as a, type AgentCliDefinition as b, type AgentCliClient as c, type AgentCliPrintConfig as d, type AgentCliRuntimeSession as e, type AgentCliStartOptions as f, type ContinuationKeyScope as g, type AgentCliAuth as h, type AgentCliCapabilities as i, type AgentCliConnectOptions as j, type AgentCliContinuation as k, type AgentCliFrontmatter as l, type AgentCliInstallMethod as m, type AgentCliMcpBlock as n, type AgentCliMode as o, type AgentCliModels as p, type AgentCliOption as q, type AgentCliOptionType as r, type AgentCliPinnedSessionTuning as s, type AgentCliPresetDeclaration as t, type AgentCliProtocol as u, type AgentCliSession as v, type AgentCliSessionMode as w, type AgentCliSetupPersist as x, type AgentCliSetupSkipIf as y, type AgentCliSetupStep as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentproto/driver-agent-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
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
5
|
"keywords": [
|
|
6
6
|
"agentproto",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"bugs": {
|
|
25
25
|
"url": "https://github.com/agentproto/ts/issues"
|
|
26
26
|
},
|
|
27
|
-
"license": "
|
|
27
|
+
"license": "Apache-2.0",
|
|
28
28
|
"type": "module",
|
|
29
29
|
"main": "dist/index.mjs",
|
|
30
30
|
"module": "dist/index.mjs",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"gray-matter": "^4.0.3",
|
|
55
55
|
"zod": "^4.4.3",
|
|
56
|
-
"@agentproto/
|
|
57
|
-
"@agentproto/
|
|
56
|
+
"@agentproto/define-doctype": "0.1.1",
|
|
57
|
+
"@agentproto/acp": "0.5.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/node": "^25.6.2",
|