@idapt/cli 1.9.0 → 1.10.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/bin.cjs +36599 -1693
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +741 -19
- package/dist/bin.js.map +1 -1
- package/dist/chunk-CX7FTE47.js +40606 -0
- package/dist/chunk-CX7FTE47.js.map +1 -0
- package/dist/index.cjs +34545 -370
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -11
- package/dist/index.d.ts +46 -11
- package/dist/index.js +1 -1
- package/package.json +2 -1
- package/dist/chunk-TYSHO65D.js +0 -6431
- package/dist/chunk-TYSHO65D.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { HttpContext } from '@idapt/sdk';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* v1 contract framework — the SINGLE SOURCE of truth for the public API surface.
|
|
@@ -91,6 +92,17 @@ interface V1CommandDocFields {
|
|
|
91
92
|
readonly requestExample?: unknown;
|
|
92
93
|
/** Inline example for the success-response body. */
|
|
93
94
|
readonly responseExample?: unknown;
|
|
95
|
+
/**
|
|
96
|
+
* Agent-invocation examples — concrete `{action, args}` calls surfaced in the
|
|
97
|
+
* command catalog + `help`. Distinct from `requestExample`/`responseExample`
|
|
98
|
+
* (which document the HTTP bodies for OpenAPI). Helps the model produce
|
|
99
|
+
* well-formed calls (the Anthropic `input_examples` affordance).
|
|
100
|
+
*/
|
|
101
|
+
readonly examples?: readonly {
|
|
102
|
+
readonly title?: string;
|
|
103
|
+
readonly action: string;
|
|
104
|
+
readonly args?: Record<string, unknown>;
|
|
105
|
+
}[];
|
|
94
106
|
/** For `binary` responses — the media types served (+ optional example/description). */
|
|
95
107
|
readonly binary?: {
|
|
96
108
|
readonly contentTypes: readonly string[];
|
|
@@ -193,16 +205,26 @@ declare function autoMode(isTty: boolean, requested?: RenderMode): RenderMode;
|
|
|
193
205
|
/**
|
|
194
206
|
* Transport seam. `execute()` builds a neutral {@link AgentToolsRequest} from a
|
|
195
207
|
* command spec and hands it to a transport. The default {@link createFetchTransport}
|
|
196
|
-
*
|
|
208
|
+
* sends HTTP **through `@idapt/sdk`'s low-level `requestRaw()`** (bearer auth, URL
|
|
209
|
+
* + body building, fetch-error mapping); in the in-chat worker / MCP it is given a
|
|
197
210
|
* transport that injects the minted agent-principal token, and tests inject a
|
|
198
211
|
* mock.
|
|
199
212
|
*
|
|
200
|
-
* This is the single seam where the
|
|
201
|
-
*
|
|
202
|
-
*
|
|
213
|
+
* This is the single seam where the cli, MCP, and in-app dispatcher (which all
|
|
214
|
+
* consume this transport) share ONE HTTP layer with the SDK instead of
|
|
215
|
+
* duplicating fetch — the JS twin of the Go daemon routing through one client.
|
|
216
|
+
*
|
|
217
|
+
* The {@link AgentToolsRequest}/{@link AgentToolsResponse} interface is kept
|
|
218
|
+
* byte-stable so `execute.ts` / MCP / the dispatcher are unaffected: the
|
|
219
|
+
* transport still NEVER throws on an HTTP status — every status (incl. 4xx/5xx)
|
|
220
|
+
* comes back as `{ status, json | text | blob }`. The SDK's `requestRaw()` throws
|
|
221
|
+
* a typed `IdaptError` on non-2xx, so we catch it and rebuild that flat shape
|
|
222
|
+
* from the error's preserved `.status` + `.body`. Only a transport-level failure
|
|
223
|
+
* (network error / abort) propagates as a thrown error, exactly as before.
|
|
203
224
|
*/
|
|
225
|
+
|
|
204
226
|
interface AgentToolsRequest {
|
|
205
|
-
readonly method: "GET" | "POST" | "PATCH" | "DELETE";
|
|
227
|
+
readonly method: "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
|
|
206
228
|
/** Absolute-from-origin path, e.g. "/api/v1/drive/files/file_abc". */
|
|
207
229
|
readonly path: string;
|
|
208
230
|
readonly query?: Record<string, string | number | boolean | undefined>;
|
|
@@ -225,6 +247,15 @@ interface AgentToolsResponse {
|
|
|
225
247
|
}
|
|
226
248
|
interface AgentToolsTransport {
|
|
227
249
|
request(req: AgentToolsRequest): Promise<AgentToolsResponse>;
|
|
250
|
+
/**
|
|
251
|
+
* The underlying SDK {@link HttpContext} this transport sends through, when it
|
|
252
|
+
* is the default fetch transport. The spec executor delegates request
|
|
253
|
+
* assembly, the HTTP call, envelope unwrap, and operation polling to the SDK's
|
|
254
|
+
* `executeCommand` over THIS context — so the CLI and SDK share ONE executor
|
|
255
|
+
* with zero duplicated logic. Absent only on bespoke (non-fetch) transports,
|
|
256
|
+
* in which case the executor reports the command is not runnable.
|
|
257
|
+
*/
|
|
258
|
+
readonly ctx?: HttpContext;
|
|
228
259
|
}
|
|
229
260
|
interface FetchTransportOptions {
|
|
230
261
|
/** Origin, e.g. "https://idapt.app" or "http://localhost:3000". */
|
|
@@ -241,17 +272,21 @@ interface FetchTransportOptions {
|
|
|
241
272
|
*/
|
|
242
273
|
readonly userAgent?: string;
|
|
243
274
|
}
|
|
244
|
-
/** Default bearer-auth
|
|
275
|
+
/** Default bearer-auth transport — sends through the SDK's `requestRaw()`. */
|
|
245
276
|
declare function createFetchTransport(opts: FetchTransportOptions): AgentToolsTransport;
|
|
246
277
|
|
|
247
278
|
/**
|
|
248
279
|
* Execute an `idapt <resource> <verb> …` command against the v1 API.
|
|
249
280
|
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
281
|
+
* The CLI is the **spec/positional/validation/render adapter** around the SINGLE
|
|
282
|
+
* spec executor that lives in `@idapt/sdk` (`executeCommand`): it resolves the
|
|
283
|
+
* command spec, binds path params from positionals + named args, validates the
|
|
284
|
+
* remaining args against the contract's request schema, then DELEGATES request
|
|
285
|
+
* assembly, the HTTP call, envelope unwrap, and async-operation polling to the
|
|
286
|
+
* SDK over the transport's shared {@link HttpContext}. The CLI layers on what is
|
|
287
|
+
* its own — positional binding, pre-flight validation with repair hints, binary
|
|
288
|
+
* text-detection, render mode, and the soft `ExecuteResult` (it never throws on
|
|
289
|
+
* an HTTP status). One executor, zero duplicated transport logic.
|
|
255
290
|
*/
|
|
256
291
|
|
|
257
292
|
interface ExecuteOptions {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { HttpContext } from '@idapt/sdk';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* v1 contract framework — the SINGLE SOURCE of truth for the public API surface.
|
|
@@ -91,6 +92,17 @@ interface V1CommandDocFields {
|
|
|
91
92
|
readonly requestExample?: unknown;
|
|
92
93
|
/** Inline example for the success-response body. */
|
|
93
94
|
readonly responseExample?: unknown;
|
|
95
|
+
/**
|
|
96
|
+
* Agent-invocation examples — concrete `{action, args}` calls surfaced in the
|
|
97
|
+
* command catalog + `help`. Distinct from `requestExample`/`responseExample`
|
|
98
|
+
* (which document the HTTP bodies for OpenAPI). Helps the model produce
|
|
99
|
+
* well-formed calls (the Anthropic `input_examples` affordance).
|
|
100
|
+
*/
|
|
101
|
+
readonly examples?: readonly {
|
|
102
|
+
readonly title?: string;
|
|
103
|
+
readonly action: string;
|
|
104
|
+
readonly args?: Record<string, unknown>;
|
|
105
|
+
}[];
|
|
94
106
|
/** For `binary` responses — the media types served (+ optional example/description). */
|
|
95
107
|
readonly binary?: {
|
|
96
108
|
readonly contentTypes: readonly string[];
|
|
@@ -193,16 +205,26 @@ declare function autoMode(isTty: boolean, requested?: RenderMode): RenderMode;
|
|
|
193
205
|
/**
|
|
194
206
|
* Transport seam. `execute()` builds a neutral {@link AgentToolsRequest} from a
|
|
195
207
|
* command spec and hands it to a transport. The default {@link createFetchTransport}
|
|
196
|
-
*
|
|
208
|
+
* sends HTTP **through `@idapt/sdk`'s low-level `requestRaw()`** (bearer auth, URL
|
|
209
|
+
* + body building, fetch-error mapping); in the in-chat worker / MCP it is given a
|
|
197
210
|
* transport that injects the minted agent-principal token, and tests inject a
|
|
198
211
|
* mock.
|
|
199
212
|
*
|
|
200
|
-
* This is the single seam where the
|
|
201
|
-
*
|
|
202
|
-
*
|
|
213
|
+
* This is the single seam where the cli, MCP, and in-app dispatcher (which all
|
|
214
|
+
* consume this transport) share ONE HTTP layer with the SDK instead of
|
|
215
|
+
* duplicating fetch — the JS twin of the Go daemon routing through one client.
|
|
216
|
+
*
|
|
217
|
+
* The {@link AgentToolsRequest}/{@link AgentToolsResponse} interface is kept
|
|
218
|
+
* byte-stable so `execute.ts` / MCP / the dispatcher are unaffected: the
|
|
219
|
+
* transport still NEVER throws on an HTTP status — every status (incl. 4xx/5xx)
|
|
220
|
+
* comes back as `{ status, json | text | blob }`. The SDK's `requestRaw()` throws
|
|
221
|
+
* a typed `IdaptError` on non-2xx, so we catch it and rebuild that flat shape
|
|
222
|
+
* from the error's preserved `.status` + `.body`. Only a transport-level failure
|
|
223
|
+
* (network error / abort) propagates as a thrown error, exactly as before.
|
|
203
224
|
*/
|
|
225
|
+
|
|
204
226
|
interface AgentToolsRequest {
|
|
205
|
-
readonly method: "GET" | "POST" | "PATCH" | "DELETE";
|
|
227
|
+
readonly method: "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
|
|
206
228
|
/** Absolute-from-origin path, e.g. "/api/v1/drive/files/file_abc". */
|
|
207
229
|
readonly path: string;
|
|
208
230
|
readonly query?: Record<string, string | number | boolean | undefined>;
|
|
@@ -225,6 +247,15 @@ interface AgentToolsResponse {
|
|
|
225
247
|
}
|
|
226
248
|
interface AgentToolsTransport {
|
|
227
249
|
request(req: AgentToolsRequest): Promise<AgentToolsResponse>;
|
|
250
|
+
/**
|
|
251
|
+
* The underlying SDK {@link HttpContext} this transport sends through, when it
|
|
252
|
+
* is the default fetch transport. The spec executor delegates request
|
|
253
|
+
* assembly, the HTTP call, envelope unwrap, and operation polling to the SDK's
|
|
254
|
+
* `executeCommand` over THIS context — so the CLI and SDK share ONE executor
|
|
255
|
+
* with zero duplicated logic. Absent only on bespoke (non-fetch) transports,
|
|
256
|
+
* in which case the executor reports the command is not runnable.
|
|
257
|
+
*/
|
|
258
|
+
readonly ctx?: HttpContext;
|
|
228
259
|
}
|
|
229
260
|
interface FetchTransportOptions {
|
|
230
261
|
/** Origin, e.g. "https://idapt.app" or "http://localhost:3000". */
|
|
@@ -241,17 +272,21 @@ interface FetchTransportOptions {
|
|
|
241
272
|
*/
|
|
242
273
|
readonly userAgent?: string;
|
|
243
274
|
}
|
|
244
|
-
/** Default bearer-auth
|
|
275
|
+
/** Default bearer-auth transport — sends through the SDK's `requestRaw()`. */
|
|
245
276
|
declare function createFetchTransport(opts: FetchTransportOptions): AgentToolsTransport;
|
|
246
277
|
|
|
247
278
|
/**
|
|
248
279
|
* Execute an `idapt <resource> <verb> …` command against the v1 API.
|
|
249
280
|
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
281
|
+
* The CLI is the **spec/positional/validation/render adapter** around the SINGLE
|
|
282
|
+
* spec executor that lives in `@idapt/sdk` (`executeCommand`): it resolves the
|
|
283
|
+
* command spec, binds path params from positionals + named args, validates the
|
|
284
|
+
* remaining args against the contract's request schema, then DELEGATES request
|
|
285
|
+
* assembly, the HTTP call, envelope unwrap, and async-operation polling to the
|
|
286
|
+
* SDK over the transport's shared {@link HttpContext}. The CLI layers on what is
|
|
287
|
+
* its own — positional binding, pre-flight validation with repair hints, binary
|
|
288
|
+
* text-detection, render mode, and the soft `ExecuteResult` (it never throws on
|
|
289
|
+
* an HTTP status). One executor, zero duplicated transport logic.
|
|
255
290
|
*/
|
|
256
291
|
|
|
257
292
|
interface ExecuteOptions {
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { VERB_OVERRIDES, autoMode, commandsForResource, createFetchTransport, execute, executeCommand, findCommand, getResourcePlaybook, listCommands, listResources, mapArgsToV1, parseInvocation, reconcileToV1, render, renderHelp, renderInstructions, resolveCommand, toSnakeKey } from './chunk-
|
|
1
|
+
export { VERB_OVERRIDES, autoMode, commandsForResource, createFetchTransport, execute, executeCommand, findCommand, getResourcePlaybook, listCommands, listResources, mapArgsToV1, parseInvocation, reconcileToV1, render, renderHelp, renderInstructions, resolveCommand, toSnakeKey } from './chunk-CX7FTE47.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idapt/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "The idapt CLI — the `idapt <resource> <verb>` grammar, command→REST translation, help/instructions, output formatting, SOTA auth (OAuth 2.1 + PKCE / device-code / API-key) and self-update, over the public v1 API. One implementation shared by the in-chat dispatcher, MCP, and the `idapt` CLI binary.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://idapt.app/cli",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"prepublishOnly": "npm run build"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
+
"@idapt/sdk": "*",
|
|
34
35
|
"zod": "^4.1.12"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|