@agentproto/cli 0.6.0 → 0.7.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/dist/index.d.ts CHANGED
@@ -123,6 +123,13 @@ interface ResolvedAdapter {
123
123
  readonly handle: AgentCliHandle;
124
124
  readonly source: "npm" | "file" | "bundled" | "acp-config" | "acp-catalog";
125
125
  readonly packageName?: string;
126
+ /** True when this resolution was served from the last-known-good cache
127
+ * because the current import attempt failed (see `importFresh`'s doc
128
+ * comment for why that happens mid-rebuild). Never present on an
129
+ * actually-fresh successful resolution — callers that only care about
130
+ * spawning don't need to check it, callers that surface status
131
+ * (`listAdaptersWithCatalog`) must not report it as plain "ready". */
132
+ readonly stale?: true;
126
133
  }
127
134
  /** Mode metadata surfaced in `adapter_list` — the UI-safe subset of an
128
135
  * AIP-45 `modes[]` entry. Omits the spawn internals (`bin_args_*`, `env`)
@@ -163,13 +170,36 @@ interface AdapterInfo {
163
170
  * adapter manifest's `models.allowed` field. Empty when the adapter
164
171
  * doesn't declare a model list (accepts whatever the underlying
165
172
  * binary accepts). Pass one of these as `model` in `agent_start`
166
- * to avoid trial-and-error validation errors. */
173
+ * to avoid trial-and-error validation errors. Flat id list — kept
174
+ * exactly as before so every existing consumer of this field keeps
175
+ * working untouched; see `modelDetails` for the provider/mode a
176
+ * structured entry additionally states. */
167
177
  models: string[];
168
178
  /** AIP-45 `modes[]` the adapter declares, projected to the UI-safe
169
179
  * subset (id + description + honest status). Empty when the adapter
170
180
  * declares no modes. `status` defaults to "active" when the manifest
171
181
  * omits it, so a declared mode is never silently statusless. */
172
182
  modes: AdapterMode[];
183
+ /** Same models as `models`, in the same order, each carrying the
184
+ * `provider`/`mode` a structured `models.allowed` entry states.
185
+ * `provider`/`mode` are undefined for a bare-string entry — an
186
+ * unstated provider is never guessed here (see AdapterModelInfo). */
187
+ modelDetails: AdapterModelInfo[];
188
+ }
189
+ /** One entry of an adapter's declared model menu, projected from a
190
+ * `models.allowed` item — bare string or {@link AgentCliModelEntry}.
191
+ * `provider`/`mode` stay undefined for a bare-string entry: an unstated
192
+ * provider must never be guessed downstream (a wrong-but-confident
193
+ * guess would bill the wrong account). See AGENTS.md / AIP-45 for the
194
+ * three-facts-in-one-string problem this splits apart. */
195
+ interface AdapterModelInfo {
196
+ id: string;
197
+ /** Who serves/bills this model (a ProviderPreset id, or a direct
198
+ * provider like "anthropic"). Undefined when unstated. */
199
+ provider?: string;
200
+ /** This adapter's mode id that routes to `provider`. Undefined when
201
+ * the adapter routes on its own or needs no mode switch. */
202
+ mode?: string;
173
203
  }
174
204
  declare function resolveAdapter(slug: string): Promise<ResolvedAdapter>;
175
205
  /**
@@ -209,16 +239,26 @@ declare function listInstalledAdapters(opts?: {
209
239
  *
210
240
  * Status is derived via the kit's `computeStatus`: resolved × requiresSetup ×
211
241
  * ledger-exists — never via `handle.check()` (per OQ-5).
242
+ *
243
+ * A fourth status, `"unresolvable"`, sits outside that kit-owned vocabulary:
244
+ * when `resolveAdapter` falls back to its last-known-good cache (see there),
245
+ * the kit sees a normally-resolved handle and would compute "ready" — which
246
+ * would silently hide the fact that the CURRENT import attempt just failed.
247
+ * `resolved.stale` (threaded through `wrapCliHandle` → `AgentCliInfo`) is
248
+ * checked below and overrides whatever the kit computed, so a rebuilding
249
+ * adapter reads as neither "ready" (a lie — a spawn against a half-written
250
+ * dist would still fail) nor "supported" (equally wrong — it tells the
251
+ * operator to reinstall something that's already there).
212
252
  */
213
253
  declare function listAdaptersWithCatalog(catalog: readonly AdapterCatalogEntry[]): Promise<(AdapterInfo & {
214
- status: "supported" | "available" | "ready";
254
+ status: "supported" | "available" | "ready" | "unresolvable";
215
255
  hint?: string;
216
256
  })[]>;
217
257
  /** A single row of the merged adapter listing — npm/native catalog
218
258
  * entries and generic ACP entries share this shape (the latter also
219
259
  * carry a `source`). */
220
260
  type AdapterListing = AdapterInfo & {
221
- status: "supported" | "available" | "ready";
261
+ status: "supported" | "available" | "ready" | "unresolvable";
222
262
  hint?: string;
223
263
  source?: "acp-config" | "acp-catalog";
224
264
  };