@agentproto/cli 0.10.0 → 0.11.1
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 +12 -5
- package/dist/cli.mjs +38516 -24353
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.ts +112 -3
- package/dist/index.mjs +33168 -19895
- package/dist/index.mjs.map +1 -1
- package/dist/registry/builtins.mjs +1 -1
- package/dist/registry/manifest.mjs +1 -1
- package/dist/registry/plugins.mjs +1 -1
- package/dist/registry/runtime.mjs +1 -1
- package/dist/util/credentials.mjs +1 -1
- package/package.json +29 -27
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { AgentCliMode, AgentCliHandle } from '@agentproto/driver-agent-cli';
|
|
2
|
-
import { AdapterCatalogEntry } from '@agentproto/provider-kit';
|
|
1
|
+
import { AgentCliMode, AgentCliRouteSelection, AgentCliHandle } from '@agentproto/driver-agent-cli';
|
|
2
|
+
import { CapabilityStrategy, AdapterCatalogEntry } from '@agentproto/provider-kit';
|
|
3
3
|
import { AcpAgentConfigEntry, AgentprotoConfig } from '@agentproto/runtime/config';
|
|
4
|
+
import { AdapterInstallResult } from '@agentproto/runtime';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* `agentproto install <slug>`
|
|
@@ -76,6 +77,7 @@ declare function runRun(args: readonly string[]): Promise<number>;
|
|
|
76
77
|
* `~/.agentproto/policy.toml` allowlist (see project_agentproto_repos
|
|
77
78
|
* memory). The token is the only access control today.
|
|
78
79
|
*/
|
|
80
|
+
|
|
79
81
|
declare function runServe(args: readonly string[]): Promise<number>;
|
|
80
82
|
|
|
81
83
|
/**
|
|
@@ -98,6 +100,17 @@ declare function runServe(args: readonly string[]): Promise<number>;
|
|
|
98
100
|
*/
|
|
99
101
|
declare function runAcp(args: readonly string[]): Promise<number>;
|
|
100
102
|
|
|
103
|
+
/**
|
|
104
|
+
* `agentproto preset` — CRUD for user-owned session presets.
|
|
105
|
+
*
|
|
106
|
+
* Singular on purpose: `agentproto presets` remains the read-only catalogue
|
|
107
|
+
* of static provider gateway presets; this command manages combinations a
|
|
108
|
+
* user has saved for their own spawns.
|
|
109
|
+
*/
|
|
110
|
+
declare function runPreset(args: readonly string[]): Promise<number>;
|
|
111
|
+
|
|
112
|
+
declare function runProviderPresets(args: readonly string[]): Promise<number>;
|
|
113
|
+
|
|
101
114
|
declare function runPackSkill(args: readonly string[]): Promise<number>;
|
|
102
115
|
|
|
103
116
|
/**
|
|
@@ -157,6 +170,11 @@ interface ResolvedAdapter {
|
|
|
157
170
|
* spawning don't need to check it, callers that surface status
|
|
158
171
|
* (`listAdaptersWithCatalog`) must not report it as plain "ready". */
|
|
159
172
|
readonly stale?: true;
|
|
173
|
+
/** The adapter's optional `<camelSlug>Capabilities` export (harness
|
|
174
|
+
* capability-discovery layer) — present when the adapter's module
|
|
175
|
+
* exports one, absent otherwise (falls back to
|
|
176
|
+
* `deriveDeclaredCapabilities` at the call site). */
|
|
177
|
+
readonly capabilitiesStrategy?: CapabilityStrategy;
|
|
160
178
|
}
|
|
161
179
|
/** Mode metadata surfaced in `adapter_list` — the UI-safe subset of an
|
|
162
180
|
* AIP-45 `modes[]` entry. Omits the spawn internals (`bin_args_*`, `env`)
|
|
@@ -225,6 +243,17 @@ interface AdapterInfo {
|
|
|
225
243
|
* the same default the manifest schema applies.
|
|
226
244
|
*/
|
|
227
245
|
modelApply?: "config" | "command" | "arg";
|
|
246
|
+
/**
|
|
247
|
+
* How this adapter's spawn ROUTE relates to the chosen model (AIP-45
|
|
248
|
+
* launch-menu drill-down, WP1) — projected verbatim from the manifest's
|
|
249
|
+
* `routeSelection`. A capability-derived spawn/config drill-down reads
|
|
250
|
+
* this to decide whether the connection step is a real choice (`"free"`)
|
|
251
|
+
* or a read-only badge (`"derived-from-model"`, the route falls out of the
|
|
252
|
+
* model id's vendor prefix). Undefined ⇒ `"free"` (back-compat: an adapter
|
|
253
|
+
* that never declared the axis keeps presenting a route choice). Distinct
|
|
254
|
+
* from the auth-derivation axis (`modelDerivedApiKey`).
|
|
255
|
+
*/
|
|
256
|
+
routeSelection?: AgentCliRouteSelection;
|
|
228
257
|
}
|
|
229
258
|
/** One entry of an adapter's declared model menu, projected from a
|
|
230
259
|
* `models.allowed` item — bare string or {@link AgentCliModelEntry}.
|
|
@@ -418,4 +447,84 @@ declare function listAcpGenericAdapters(opts?: {
|
|
|
418
447
|
excludeSlugs?: ReadonlySet<string>;
|
|
419
448
|
}): Promise<AcpGenericListEntry[]>;
|
|
420
449
|
|
|
421
|
-
|
|
450
|
+
/**
|
|
451
|
+
* `installAdapter(slug)` — install an agent CLI adapter (harness) by slug,
|
|
452
|
+
* the mutation companion to `listAdaptersWithAcp`.
|
|
453
|
+
*
|
|
454
|
+
* Two install classes, decided purely by `planAdapterInstall` (below):
|
|
455
|
+
*
|
|
456
|
+
* - **acp-catalog / acp-config** — a generic ACP CLI with no
|
|
457
|
+
* `@agentproto/adapter-*` package (gemini-cli, qwen-code, iflow-cli, or a
|
|
458
|
+
* user's `config.acpAgents` entry). Its harness lives in an npm package
|
|
459
|
+
* named only in the entry's `install_hint` ("npm install -g …"); we parse
|
|
460
|
+
* that and run `npm i -g <package>` directly. `agentproto install <slug>`
|
|
461
|
+
* can't do this — a generic ACP handle's only install step is
|
|
462
|
+
* `{method:"vendored"}`, which the install runner treats as BYO-binary.
|
|
463
|
+
*
|
|
464
|
+
* - **first-party** — a native `@agentproto/adapter-*` adapter in the
|
|
465
|
+
* catalog (claude-code, opencode, …). Driven through the existing
|
|
466
|
+
* `agentproto install <slug>` pipeline (`runInstall`), which bootstraps
|
|
467
|
+
* the adapter package then runs its manifest `install[]` steps.
|
|
468
|
+
*
|
|
469
|
+
* Wired into the daemon as `createGateway({ installAgentAdapter })` — the
|
|
470
|
+
* runtime stays cli-free and only exposes the `adapter_install` MCP tool +
|
|
471
|
+
* `POST /adapters/:slug/install` route. Never throws for an ordinary install
|
|
472
|
+
* failure: reports it via `{ ok:false, message }` so the tool/route return a
|
|
473
|
+
* clean result rather than a 500.
|
|
474
|
+
*/
|
|
475
|
+
|
|
476
|
+
/** The minimal slice of an adapter listing `planAdapterInstall` reads —
|
|
477
|
+
* a structural subset of {@link AdapterListing} so the planner stays pure
|
|
478
|
+
* and trivially unit-testable. */
|
|
479
|
+
interface AdapterInstallCandidate {
|
|
480
|
+
slug: string;
|
|
481
|
+
status?: "supported" | "available" | "ready" | "unresolvable";
|
|
482
|
+
/** Present ONLY on generic ACP entries (`acp-catalog` / `acp-config`);
|
|
483
|
+
* absent on native `@agentproto/adapter-*` catalog entries. */
|
|
484
|
+
source?: "acp-config" | "acp-catalog";
|
|
485
|
+
/** Human "how to install" line — for acp entries this carries the npm
|
|
486
|
+
* package (`npm install -g @google/gemini-cli`). */
|
|
487
|
+
hint?: string;
|
|
488
|
+
}
|
|
489
|
+
/** A resolved install strategy. `command`/`args` name exactly what will run
|
|
490
|
+
* (for logs + error surfaces); `already-installed`/`unsupported` run
|
|
491
|
+
* nothing. */
|
|
492
|
+
type AdapterInstallPlan = {
|
|
493
|
+
kind: "already-installed";
|
|
494
|
+
} | {
|
|
495
|
+
kind: "npm-global";
|
|
496
|
+
packageName: string;
|
|
497
|
+
command: "npm";
|
|
498
|
+
args: string[];
|
|
499
|
+
} | {
|
|
500
|
+
kind: "agentproto-install";
|
|
501
|
+
slug: string;
|
|
502
|
+
command: "agentproto";
|
|
503
|
+
args: string[];
|
|
504
|
+
} | {
|
|
505
|
+
kind: "unsupported";
|
|
506
|
+
reason: string;
|
|
507
|
+
};
|
|
508
|
+
/**
|
|
509
|
+
* Pull the npm package out of an acp entry's `install_hint`
|
|
510
|
+
* (`"npm install -g @google/gemini-cli"` → `"@google/gemini-cli"`). Accepts
|
|
511
|
+
* both `install`/`i` and `-g`/`--global` spellings. Returns `undefined` when
|
|
512
|
+
* the hint isn't an npm-global install line (a BYO-binary agent, a `brew`
|
|
513
|
+
* hint, etc.) — the caller then reports it as unsupported rather than
|
|
514
|
+
* guessing a package.
|
|
515
|
+
*/
|
|
516
|
+
declare function parseNpmPackageFromHint(hint?: string): string | undefined;
|
|
517
|
+
/**
|
|
518
|
+
* Decide how to install `entry` — pure, so it's the unit-tested heart of the
|
|
519
|
+
* install flow. See the module header for the two classes.
|
|
520
|
+
*/
|
|
521
|
+
declare function planAdapterInstall(entry: AdapterInstallCandidate): AdapterInstallPlan;
|
|
522
|
+
/**
|
|
523
|
+
* Install the adapter named by `slug` and report the outcome (never throws
|
|
524
|
+
* for an ordinary failure). Lists adapters first to classify the slug, plans
|
|
525
|
+
* the install, runs it, then re-reads the listing so the result carries the
|
|
526
|
+
* adapter's fresh readiness `status`.
|
|
527
|
+
*/
|
|
528
|
+
declare function installAdapter(slug: string): Promise<AdapterInstallResult>;
|
|
529
|
+
|
|
530
|
+
export { ACP_CATALOG, type AcpAgentSpec, type AcpGenericListEntry, type AcpSpecSource, type AdapterInfo, type AdapterInstallCandidate, type AdapterInstallPlan, type AdapterListing, type ResolvedAdapter, type ZipPackResult, acpHandleFromSpec, binOnPath, installAdapter, listAcpGenericAdapters, listAdaptersWithAcp, listAdaptersWithCatalog, listInstalledAdapters, parseNpmPackageFromHint, planAdapterInstall, resolveAcpSpec, resolveAdapter, runAcp, runInstall, runPackSkill, runPreset, runProviderPresets, runRun, runServe, zipPackDir };
|