stitchkit 0.92.0 → 0.93.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/CHANGELOG.md +57 -0
- package/dist/cli.js +8 -1
- package/dist/{index-7n145nbe.js → index-3bmnp41g.js} +65 -10
- package/dist/internal/secure-fetch.d.ts +12 -0
- package/dist/internal/secure-fetch.d.ts.map +1 -1
- package/dist/testing/surface-manifest.d.ts +34 -1
- package/dist/testing/surface-manifest.d.ts.map +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +27 -7
- package/dist/tools/cli-command.d.ts +18 -0
- package/dist/tools/cli-command.d.ts.map +1 -1
- package/dist/tools/cli-invoke.d.ts +28 -3
- package/dist/tools/cli-invoke.d.ts.map +1 -1
- package/dist/tools/cli-update.d.ts.map +1 -1
- package/dist/tools/cli.d.ts +0 -3
- package/dist/tools/cli.d.ts.map +1 -1
- package/dist/tools.js +1 -1
- package/llms-full.txt +94 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,63 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
|
|
|
15
15
|
|
|
16
16
|
## [Unreleased]
|
|
17
17
|
|
|
18
|
+
## [0.93.0] — 2026-09-22
|
|
19
|
+
|
|
20
|
+
### ⚠️ Breaking changes
|
|
21
|
+
|
|
22
|
+
- **The surface snapshot records what an operation asks before it runs, and
|
|
23
|
+
`manifestVersion` is `3`.** `mcp.inputRequired` changes the contract a host is
|
|
24
|
+
coded against — an operation gains or loses a question — and the snapshot did
|
|
25
|
+
not move a byte for it. Measured on 0.92.0: the same operation with and
|
|
26
|
+
without a declared round produced byte-identical manifests, so a consumer was
|
|
27
|
+
holding the link "declared → state key configured" with a test of their own.
|
|
28
|
+
An operation row now carries `mcp`: `null`, a list of `{key, message, schema}`,
|
|
29
|
+
or `'resolved-per-call'` when a resolver decides them. A committed snapshot on
|
|
30
|
+
an older version is refused by name, with the remedy in the message.
|
|
31
|
+
`// before: manifest.operations[0] // no trace of a declared round` →
|
|
32
|
+
`// after: manifest.operations[0].mcp // null | [{ key, message, schema }] | { inputRequired: 'resolved-per-call' }`
|
|
33
|
+
→ ADR 0195
|
|
34
|
+
|
|
35
|
+
**Who must act:** anyone with a committed surface snapshot — regenerate it once
|
|
36
|
+
and review the diff, which is large because the field is added to every
|
|
37
|
+
operation row, most of them `null`; and anyone whose own test held the link
|
|
38
|
+
between a declared `inputRequired` and its configured state key, who can now
|
|
39
|
+
drop it.
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
|
|
43
|
+
- **A native command that returns a result is invokable in process.**
|
|
44
|
+
`createCliInvoker` excluded `config.commands` wholesale, on the reasoning that
|
|
45
|
+
a native command prints by construction. That is true of the half declaring
|
|
46
|
+
`output?: never` and was applied to both halves; a consumer measured six of
|
|
47
|
+
their eight native commands declaring `output`, and a `describe` line that had
|
|
48
|
+
worked in their stream began answering `NOT_FOUND`. The invoker now admits a
|
|
49
|
+
native command if and only if it declares `output`. `present` is not called —
|
|
50
|
+
it is stdout formatting and there is no stdout — while `exitCode` is applied
|
|
51
|
+
through the same function the command line uses. Whatever a handler writes
|
|
52
|
+
comes back as `CliInvocationResult.written` instead of interleaving with the
|
|
53
|
+
caller's own output. A printing command is still outside, now for its own
|
|
54
|
+
reason. → ADR 0194
|
|
55
|
+
|
|
56
|
+
- **`SURFACE_MANIFEST_VERSION`, `SurfaceManifestOperationMcp` and
|
|
57
|
+
`SurfaceManifestOperationMcpSchema`** from `stitchkit/testing`, for reading
|
|
58
|
+
and asserting the new row.
|
|
59
|
+
|
|
60
|
+
### Changed
|
|
61
|
+
|
|
62
|
+
- **`CliConfig.commands` moved to `CliInvokerConfig`.** One declaration for both
|
|
63
|
+
surfaces; `createCli` keeps the field it always had.
|
|
64
|
+
|
|
65
|
+
- **An update check refused by the SSRF boundary names the field that lifts it.**
|
|
66
|
+
A self-hosted deployment serves its manifest from its own network, the check
|
|
67
|
+
has `allowPrivateHosts` for exactly that, and the refusal relayed the guard's
|
|
68
|
+
own sentence — which reads like a timeout, so the deployment goes quietly
|
|
69
|
+
stale. The reason now says the endpoint is not public, names the field, and
|
|
70
|
+
says why `applyCliUpdate` keeps its own setting: a manifest URL is
|
|
71
|
+
configuration you wrote, an asset URL arrives inside a document. Only
|
|
72
|
+
address-privacy refusals get this; a refusal the field cannot lift keeps its
|
|
73
|
+
own reason.
|
|
74
|
+
|
|
18
75
|
## [0.92.0] — 2026-09-22
|
|
19
76
|
|
|
20
77
|
### ⚠️ Breaking changes
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CliArgumentError,
|
|
3
3
|
DEFAULT_EXIT_CODES,
|
|
4
|
+
PrivateAddressRefusal,
|
|
4
5
|
cliExitCode,
|
|
5
6
|
cliInvocationResult,
|
|
6
7
|
createCli,
|
|
@@ -14,7 +15,7 @@ import {
|
|
|
14
15
|
readCapped,
|
|
15
16
|
renderCliView,
|
|
16
17
|
routeCliArgv
|
|
17
|
-
} from "./index-
|
|
18
|
+
} from "./index-3bmnp41g.js";
|
|
18
19
|
import {
|
|
19
20
|
serializeCanonicalJson
|
|
20
21
|
} from "./index-0j3vcp5m.js";
|
|
@@ -636,6 +637,12 @@ async function checkCliUpdate(config) {
|
|
|
636
637
|
signature: verdict
|
|
637
638
|
};
|
|
638
639
|
} catch (error) {
|
|
640
|
+
if (error instanceof PrivateAddressRefusal) {
|
|
641
|
+
return {
|
|
642
|
+
status: "unknown",
|
|
643
|
+
reason: `${error.message} — the manifest endpoint is not public. Set ` + "`allowPrivateHosts` if it is your own deployment; the download keeps " + "its own setting, because an asset URL comes from the document."
|
|
644
|
+
};
|
|
645
|
+
}
|
|
639
646
|
return {
|
|
640
647
|
status: "unknown",
|
|
641
648
|
reason: error instanceof Error ? error.message : String(error)
|
|
@@ -669,15 +669,22 @@ function resolveCliView(flags, ascending) {
|
|
|
669
669
|
function defineCliCommand(definition) {
|
|
670
670
|
return definition;
|
|
671
671
|
}
|
|
672
|
+
function cliCommandReturnsResult(definition) {
|
|
673
|
+
return definition.output !== undefined;
|
|
674
|
+
}
|
|
675
|
+
function cliCommandSuccessExitCode(definition, data) {
|
|
676
|
+
const successExitCode = definition.exitCode?.(data) ?? 0;
|
|
677
|
+
if (!Number.isSafeInteger(successExitCode) || successExitCode < 0 || successExitCode > 255) {
|
|
678
|
+
throw new Error("CLI success exit code must be an integer from 0 to 255");
|
|
679
|
+
}
|
|
680
|
+
return successExitCode;
|
|
681
|
+
}
|
|
672
682
|
function prepareCliCommandEmission(definition, result, options) {
|
|
673
683
|
if (!result.ok || definition.output === undefined) {
|
|
674
684
|
return { result, successExitCode: 0 };
|
|
675
685
|
}
|
|
676
686
|
try {
|
|
677
|
-
const successExitCode = definition
|
|
678
|
-
if (!Number.isSafeInteger(successExitCode) || successExitCode < 0 || successExitCode > 255) {
|
|
679
|
-
throw new Error("CLI success exit code must be an integer from 0 to 255");
|
|
680
|
-
}
|
|
687
|
+
const successExitCode = cliCommandSuccessExitCode(definition, result.data);
|
|
681
688
|
const presentation = definition.present?.({ result: result.data, options });
|
|
682
689
|
if (presentation !== undefined && typeof presentation !== "string") {
|
|
683
690
|
throw new Error("CLI result presenter must return a string");
|
|
@@ -877,6 +884,11 @@ function cliInvocationResult(result, toolName, config) {
|
|
|
877
884
|
async function createCliInvoker(config, globals) {
|
|
878
885
|
const typedGlobals = parseCliGlobals(config.globalOptions, globals);
|
|
879
886
|
const auth = await (config.resolveAuth ? config.resolveAuth(typedGlobals) : config.auth);
|
|
887
|
+
const natives = new Map((config.commands ?? []).filter(cliCommandReturnsResult).map((definition) => [definition.name, definition]));
|
|
888
|
+
const nativeHelp = new Map([...natives].map(([name, definition]) => [
|
|
889
|
+
name,
|
|
890
|
+
{ description: definition.description, argumentSchema: {}, presentationSchema: {} }
|
|
891
|
+
]));
|
|
880
892
|
const { tools, help } = buildCliSurface(config, auth, new Map, new Set);
|
|
881
893
|
const runTool = createToolRunner({
|
|
882
894
|
source: "cli",
|
|
@@ -887,11 +899,14 @@ async function createCliInvoker(config, globals) {
|
|
|
887
899
|
coerceJsonArgs: config.coerceJsonArgs
|
|
888
900
|
});
|
|
889
901
|
return {
|
|
890
|
-
commands: [...help].map(([name, presentation]) => ({
|
|
902
|
+
commands: [...nativeHelp, ...help].map(([name, presentation]) => ({
|
|
891
903
|
name,
|
|
892
904
|
description: presentation.description
|
|
893
905
|
})),
|
|
894
906
|
invoke: async (command, args) => {
|
|
907
|
+
const native = natives.get(command);
|
|
908
|
+
if (native)
|
|
909
|
+
return runNativeCommand(native, args, config, typedGlobals);
|
|
895
910
|
const tool = tools.get(command);
|
|
896
911
|
if (!tool) {
|
|
897
912
|
return cliInvocationResult({
|
|
@@ -910,6 +925,42 @@ async function createCliInvoker(config, globals) {
|
|
|
910
925
|
}
|
|
911
926
|
};
|
|
912
927
|
}
|
|
928
|
+
var IN_PROCESS_RUN_OPTIONS = Object.freeze({
|
|
929
|
+
json: false,
|
|
930
|
+
wait: false,
|
|
931
|
+
quiet: true,
|
|
932
|
+
dryRun: false,
|
|
933
|
+
help: false
|
|
934
|
+
});
|
|
935
|
+
async function runNativeCommand(definition, args, config, globals) {
|
|
936
|
+
let out = "";
|
|
937
|
+
let err = "";
|
|
938
|
+
const result = await executeCliCommand(definition, args, IN_PROCESS_RUN_OPTIONS, {
|
|
939
|
+
stdout: (text) => {
|
|
940
|
+
out += text;
|
|
941
|
+
},
|
|
942
|
+
stderr: (text) => {
|
|
943
|
+
err += text;
|
|
944
|
+
}
|
|
945
|
+
}, config.coerceJsonArgs ?? true, globals);
|
|
946
|
+
let invocation = cliInvocationResult(result, definition.name, config);
|
|
947
|
+
if (invocation.ok) {
|
|
948
|
+
try {
|
|
949
|
+
invocation = {
|
|
950
|
+
...invocation,
|
|
951
|
+
exitCode: cliCommandSuccessExitCode(definition, result.ok ? result.data : undefined)
|
|
952
|
+
};
|
|
953
|
+
} catch (error) {
|
|
954
|
+
invocation = cliInvocationResult(toolResultFromError(error), definition.name, config);
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
if (out === "" && err === "")
|
|
958
|
+
return invocation;
|
|
959
|
+
return {
|
|
960
|
+
...invocation,
|
|
961
|
+
written: { ...out !== "" && { stdout: out }, ...err !== "" && { stderr: err } }
|
|
962
|
+
};
|
|
963
|
+
}
|
|
913
964
|
function buildCliSurface(config, auth, nativeHelp, applicationGlobalNames, assertShape) {
|
|
914
965
|
const services = typeof config.services === "function" ? config.services(auth) : config.services ?? [];
|
|
915
966
|
const runtimeTools = typeof config.runtimeTools === "function" ? config.runtimeTools(auth) : config.runtimeTools ?? [];
|
|
@@ -1398,6 +1449,10 @@ async function fetchGuarded(start, allowPrivate, options = {}) {
|
|
|
1398
1449
|
clearTimeout(headerTimer);
|
|
1399
1450
|
}
|
|
1400
1451
|
}
|
|
1452
|
+
|
|
1453
|
+
class PrivateAddressRefusal extends Error {
|
|
1454
|
+
name = "PrivateAddressRefusal";
|
|
1455
|
+
}
|
|
1401
1456
|
async function resolvePublicAddress(url, signal) {
|
|
1402
1457
|
assertHttpUrl(url);
|
|
1403
1458
|
const host = url.hostname.replace(/^\[|\]$/g, "");
|
|
@@ -1406,20 +1461,20 @@ async function resolvePublicAddress(url, signal) {
|
|
|
1406
1461
|
const ipFamily = isIP(host);
|
|
1407
1462
|
if (ipFamily) {
|
|
1408
1463
|
if (isPrivateIp(host))
|
|
1409
|
-
throw new
|
|
1464
|
+
throw new PrivateAddressRefusal("refusing to fetch a private address");
|
|
1410
1465
|
return { address: host, family: ipFamily === 6 ? 6 : 4 };
|
|
1411
1466
|
}
|
|
1412
1467
|
if (NUMERIC_HOST.test(host)) {
|
|
1413
|
-
throw new
|
|
1468
|
+
throw new PrivateAddressRefusal("refusing to fetch a non-canonical numeric host");
|
|
1414
1469
|
}
|
|
1415
1470
|
if (host === "localhost" || host.endsWith(".local") || host.endsWith(".internal")) {
|
|
1416
|
-
throw new
|
|
1471
|
+
throw new PrivateAddressRefusal("refusing to fetch an internal host");
|
|
1417
1472
|
}
|
|
1418
1473
|
const pending = lookup(host, { all: true });
|
|
1419
1474
|
const records = signal ? await raceWithAbort(pending, signal) : await pending;
|
|
1420
1475
|
for (const record2 of records) {
|
|
1421
1476
|
if (isPrivateIp(record2.address)) {
|
|
1422
|
-
throw new
|
|
1477
|
+
throw new PrivateAddressRefusal("refusing to fetch a host that resolves to a private address");
|
|
1423
1478
|
}
|
|
1424
1479
|
}
|
|
1425
1480
|
const record = records[0];
|
|
@@ -2111,4 +2166,4 @@ async function createCli(config) {
|
|
|
2111
2166
|
return exit(downloadsOk ? exitCode : 1);
|
|
2112
2167
|
}
|
|
2113
2168
|
|
|
2114
|
-
export { WaitTimeoutError, runWaitOperation, fetchGuarded, fetchPinnedDocument, readCapped, routeCliArgv, CliArgumentError, parseCliArgs, extractCliGlobalOptions, defineCliCommand, DEFAULT_EXIT_CODES, cliExitCode, emitResult, cliInvocationResult, createCliInvoker, renderCliView, pollUntilDone, createCli };
|
|
2169
|
+
export { WaitTimeoutError, runWaitOperation, fetchGuarded, PrivateAddressRefusal, fetchPinnedDocument, readCapped, routeCliArgv, CliArgumentError, parseCliArgs, extractCliGlobalOptions, defineCliCommand, DEFAULT_EXIT_CODES, cliExitCode, emitResult, cliInvocationResult, createCliInvoker, renderCliView, pollUntilDone, createCli };
|
|
@@ -52,6 +52,18 @@ export interface PinnedDocumentResponse {
|
|
|
52
52
|
body: Uint8Array;
|
|
53
53
|
url: URL;
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* The network boundary refused this address — as opposed to the network failing.
|
|
57
|
+
*
|
|
58
|
+
* A caller that offers a way through the boundary has to be able to tell the two
|
|
59
|
+
* apart, and matching on a message is not telling them apart: the wording is
|
|
60
|
+
* ours to change and a match on it breaks silently the moment it does. The class
|
|
61
|
+
* is the distinction, so a caller can name its own remedy instead of relaying a
|
|
62
|
+
* sentence that reads like a timeout.
|
|
63
|
+
*/
|
|
64
|
+
export declare class PrivateAddressRefusal extends Error {
|
|
65
|
+
readonly name = "PrivateAddressRefusal";
|
|
66
|
+
}
|
|
55
67
|
/**
|
|
56
68
|
* Fetch a small public document while pinning the TCP connection to the exact
|
|
57
69
|
* public DNS answer that passed validation. This closes the check/use DNS
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secure-fetch.d.ts","sourceRoot":"","sources":["../../src/internal/secure-fetch.ts"],"names":[],"mappings":"AAiEA,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CA8D/C;AA4BD;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnF;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kEAAkE;IAClE,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,wBAAsB,YAAY,CAChC,KAAK,EAAE,GAAG,EACV,YAAY,EAAE,OAAO,EACrB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,QAAQ,CAAC,CAiDnB;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,6DAA6D;IAC7D,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,GAAG,EAAE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,GAClC,OAAO,CAAC,sBAAsB,CAAC,CAkFjC;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAoBnF"}
|
|
@@ -4,12 +4,30 @@ import type { RealtimeContract, RealtimeEventRegistry } from '../realtime/contra
|
|
|
4
4
|
import type { RouteGroup, ServiceDef } from '../server/types.js';
|
|
5
5
|
import type { CliCommandDefinition } from '../tools/cli-command.js';
|
|
6
6
|
import { type McpSchemaValidationConfig, type SurfaceRuntimeToolDefinition, type SurfaceToolExtension } from '../tools/internal/surface-projector.js';
|
|
7
|
+
/** The snapshot format's own version — bumped whenever an operation gains a field. */
|
|
8
|
+
export declare const SURFACE_MANIFEST_VERSION = 3;
|
|
7
9
|
export declare const SurfaceSchemaDigestsSchema: z.ZodObject<{
|
|
8
10
|
params: z.ZodNullable<z.ZodString>;
|
|
9
11
|
input: z.ZodNullable<z.ZodString>;
|
|
10
12
|
output: z.ZodNullable<z.ZodString>;
|
|
11
13
|
multipart: z.ZodNullable<z.ZodString>;
|
|
12
14
|
}, z.core.$strip>;
|
|
15
|
+
/**
|
|
16
|
+
* The questions an operation asks before it runs, as the host sees them.
|
|
17
|
+
*
|
|
18
|
+
* `null` means the operation declares no MCP policy at all. A list means those
|
|
19
|
+
* exact rounds; `'resolved-per-call'` means a resolver decides them and only
|
|
20
|
+
* the fact that it does is fixed at declaration time. Gaining, losing or
|
|
21
|
+
* changing any of this changes the contract a host is coded against, so it
|
|
22
|
+
* belongs in the snapshot that review reads.
|
|
23
|
+
*/
|
|
24
|
+
export declare const SurfaceManifestOperationMcpSchema: z.ZodNullable<z.ZodObject<{
|
|
25
|
+
inputRequired: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
|
|
26
|
+
key: z.ZodString;
|
|
27
|
+
message: z.ZodString;
|
|
28
|
+
schema: z.ZodNullable<z.ZodString>;
|
|
29
|
+
}, z.core.$strip>>, z.ZodLiteral<"resolved-per-call">]>;
|
|
30
|
+
}, z.core.$strip>>;
|
|
13
31
|
export declare const SurfaceManifestOperationSchema: z.ZodObject<{
|
|
14
32
|
kind: z.ZodEnum<{
|
|
15
33
|
contract: "contract";
|
|
@@ -33,6 +51,13 @@ export declare const SurfaceManifestOperationSchema: z.ZodObject<{
|
|
|
33
51
|
output: z.ZodNullable<z.ZodString>;
|
|
34
52
|
multipart: z.ZodNullable<z.ZodString>;
|
|
35
53
|
}, z.core.$strip>;
|
|
54
|
+
mcp: z.ZodNullable<z.ZodObject<{
|
|
55
|
+
inputRequired: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
|
|
56
|
+
key: z.ZodString;
|
|
57
|
+
message: z.ZodString;
|
|
58
|
+
schema: z.ZodNullable<z.ZodString>;
|
|
59
|
+
}, z.core.$strip>>, z.ZodLiteral<"resolved-per-call">]>;
|
|
60
|
+
}, z.core.$strip>>;
|
|
36
61
|
http: z.ZodArray<z.ZodObject<{
|
|
37
62
|
method: z.ZodEnum<{
|
|
38
63
|
DELETE: "DELETE";
|
|
@@ -110,7 +135,7 @@ export declare const SurfaceManifestRealtimeEventSchema: z.ZodObject<{
|
|
|
110
135
|
}, z.core.$strip>>;
|
|
111
136
|
}, z.core.$strip>;
|
|
112
137
|
export declare const SurfaceManifestSchema: z.ZodObject<{
|
|
113
|
-
manifestVersion: z.ZodLiteral<
|
|
138
|
+
manifestVersion: z.ZodLiteral<3>;
|
|
114
139
|
digestVersion: z.ZodLiteral<1>;
|
|
115
140
|
operations: z.ZodArray<z.ZodObject<{
|
|
116
141
|
kind: z.ZodEnum<{
|
|
@@ -135,6 +160,13 @@ export declare const SurfaceManifestSchema: z.ZodObject<{
|
|
|
135
160
|
output: z.ZodNullable<z.ZodString>;
|
|
136
161
|
multipart: z.ZodNullable<z.ZodString>;
|
|
137
162
|
}, z.core.$strip>;
|
|
163
|
+
mcp: z.ZodNullable<z.ZodObject<{
|
|
164
|
+
inputRequired: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
|
|
165
|
+
key: z.ZodString;
|
|
166
|
+
message: z.ZodString;
|
|
167
|
+
schema: z.ZodNullable<z.ZodString>;
|
|
168
|
+
}, z.core.$strip>>, z.ZodLiteral<"resolved-per-call">]>;
|
|
169
|
+
}, z.core.$strip>>;
|
|
138
170
|
http: z.ZodArray<z.ZodObject<{
|
|
139
171
|
method: z.ZodEnum<{
|
|
140
172
|
DELETE: "DELETE";
|
|
@@ -201,6 +233,7 @@ export declare const SurfaceManifestSchema: z.ZodObject<{
|
|
|
201
233
|
}, z.core.$strip>;
|
|
202
234
|
export type SurfaceManifest = z.infer<typeof SurfaceManifestSchema>;
|
|
203
235
|
export type SurfaceManifestOperation = z.infer<typeof SurfaceManifestOperationSchema>;
|
|
236
|
+
export type SurfaceManifestOperationMcp = z.infer<typeof SurfaceManifestOperationMcpSchema>;
|
|
204
237
|
export type SurfaceManifestTool = z.infer<typeof SurfaceManifestToolSchema>;
|
|
205
238
|
export type SurfaceManifestToolSurface = z.infer<typeof SurfaceManifestToolSurfaceSchema>;
|
|
206
239
|
export type SurfaceManifestRealtimeEvent = z.infer<typeof SurfaceManifestRealtimeEventSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface-manifest.d.ts","sourceRoot":"","sources":["../../src/testing/surface-manifest.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,CAAC,EAAE,MAAM,KAAK,CAAC;AAEtC,OAAO,EAAqB,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGvF,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EACL,KAAK,yBAAyB,EAI9B,KAAK,4BAA4B,EACjC,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gentRaceDriver, type AgentRaceTrace, type
|
|
|
35
35
|
export { type AgentStoreConformanceConfig, type AgentStoreConformanceContext, runAgentStoreConformance, } from './testing/agent-store-conformance.js';
|
|
36
36
|
export { type ManagedResourceConformanceConfig, type ManagedResourceConformanceControls, ManagedResourceConformanceError, type ManagedResourceConformanceFactoryInput, type ManagedResourceConformanceFixture, type ManagedResourceConformancePhase, ManagedResourceConformancePhaseSchema, type ManagedResourceConformanceScenario, type ManagedResourceConformanceScenarioId, ManagedResourceConformanceScenarioIdSchema, ManagedResourceConformanceScenarioSchema, type ManagedResourceConformanceTraceEntry, ManagedResourceConformanceTraceEntrySchema, type ManagedResourceConformanceTraceOutcome, ManagedResourceConformanceTraceOutcomeSchema, runManagedResourceConformance, } from './testing/managed-resource-conformance.js';
|
|
37
37
|
export { assertSurfaceDiscovery, type ConformanceTransport, type CreateRealtimeProbeDriverConfig, createRealtimeProbeDriver, type DefineRealtimeProbeConfig, defineRealtimeProbe, type RealtimeDisconnectObservation, RealtimeDisconnectObservationSchema, type RealtimeProbeAdapter, type RealtimeProbeFixture, type RealtimeProbeScenario, type RealtimeRejectionObservation, RealtimeRejectionObservationSchema, type RunSurfaceProbesConfig, runSurfaceProbes, type SurfaceDiscoveryObservation, type SurfaceProbe, type SurfaceProbeDriver, type SurfaceRealtimeDiscoveryObservation, type SurfaceToolDiscoveryObservation, type TransportObservation, TransportObservationSchema, } from './testing/surface-conformance.js';
|
|
38
|
-
export { assertSurfaceManifestSnapshot, buildSurfaceManifest, type IncompatibleSchemaPolicy, type McpSchemaValidationConfig, type SurfaceAgentProjection, type SurfaceManifest, type SurfaceManifestConfig, type SurfaceManifestExtension, SurfaceManifestExtensionSchema, type SurfaceManifestOperation, SurfaceManifestOperationSchema, type SurfaceManifestRealtimeEvent, SurfaceManifestRealtimeEventSchema, SurfaceManifestSchema, type SurfaceManifestTool, SurfaceManifestToolSchema, type SurfaceManifestToolSurface, SurfaceManifestToolSurfaceSchema, type SurfaceMcpPreparation, SurfaceRealtimeSchemaPairSchema, type SurfaceRuntimeToolDefinition, SurfaceSchemaDigestsSchema, type SurfaceToolDefinition, type SurfaceToolExtension, serializeSurfaceValue, } from './testing/surface-manifest.js';
|
|
38
|
+
export { assertSurfaceManifestSnapshot, buildSurfaceManifest, type IncompatibleSchemaPolicy, type McpSchemaValidationConfig, SURFACE_MANIFEST_VERSION, type SurfaceAgentProjection, type SurfaceManifest, type SurfaceManifestConfig, type SurfaceManifestExtension, SurfaceManifestExtensionSchema, type SurfaceManifestOperation, type SurfaceManifestOperationMcp, SurfaceManifestOperationMcpSchema, SurfaceManifestOperationSchema, type SurfaceManifestRealtimeEvent, SurfaceManifestRealtimeEventSchema, SurfaceManifestSchema, type SurfaceManifestTool, SurfaceManifestToolSchema, type SurfaceManifestToolSurface, SurfaceManifestToolSurfaceSchema, type SurfaceMcpPreparation, SurfaceRealtimeSchemaPairSchema, type SurfaceRuntimeToolDefinition, SurfaceSchemaDigestsSchema, type SurfaceToolDefinition, type SurfaceToolExtension, serializeSurfaceValue, } from './testing/surface-manifest.js';
|
|
39
39
|
//# sourceMappingURL=testing.d.ts.map
|
package/dist/testing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,KAAK,YAAY,EAEjB,KAAK,oBAAoB,EAGzB,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,OAAO,CAAC,CAAC;AAEhF,MAAM,WAAW,0BAA0B,CAAC,OAAO;IACjD,OAAO,EAAE,YAAY,CAAC,OAA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,KAAK,kBAAkB,EACvB,KAAK,mCAAmC,EACxC,KAAK,+BAA+B,EACpC,KAAK,oBAAoB,EACzB,0BAA0B,GAC3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,6BAA6B,EAC7B,oBAAoB,EACpB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,wBAAwB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,8BAA8B,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,iCAAiC,EACjC,8BAA8B,EAC9B,KAAK,4BAA4B,EACjC,kCAAkC,EAClC,qBAAqB,EACrB,KAAK,mBAAmB,EACxB,yBAAyB,EACzB,KAAK,0BAA0B,EAC/B,gCAAgC,EAChC,KAAK,qBAAqB,EAC1B,+BAA+B,EAC/B,KAAK,4BAA4B,EACjC,0BAA0B,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC"}
|
package/dist/testing.js
CHANGED
|
@@ -1487,6 +1487,7 @@ import { z as z3 } from "zod";
|
|
|
1487
1487
|
// src/testing/surface-manifest.ts
|
|
1488
1488
|
import { createHash } from "node:crypto";
|
|
1489
1489
|
import { z as z2 } from "zod";
|
|
1490
|
+
var SURFACE_MANIFEST_VERSION = 3;
|
|
1490
1491
|
var HttpMethodSchema = z2.enum(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD"]);
|
|
1491
1492
|
var ToolTransportSchema = z2.enum(["MCP", "AGENT", "CLI"]);
|
|
1492
1493
|
var SurfaceTransportSchema = z2.enum(["HTTP", "MCP", "AGENT", "CLI", "REALTIME"]);
|
|
@@ -1496,6 +1497,12 @@ var SurfaceSchemaDigestsSchema = z2.object({
|
|
|
1496
1497
|
output: z2.string().nullable(),
|
|
1497
1498
|
multipart: z2.string().nullable()
|
|
1498
1499
|
});
|
|
1500
|
+
var SurfaceManifestOperationMcpSchema = z2.object({
|
|
1501
|
+
inputRequired: z2.union([
|
|
1502
|
+
z2.array(z2.object({ key: z2.string(), message: z2.string(), schema: z2.string().nullable() })),
|
|
1503
|
+
z2.literal("resolved-per-call")
|
|
1504
|
+
])
|
|
1505
|
+
}).nullable();
|
|
1499
1506
|
var SurfaceManifestOperationSchema = z2.object({
|
|
1500
1507
|
kind: z2.enum(["contract", "runtime"]),
|
|
1501
1508
|
service: z2.string(),
|
|
@@ -1504,6 +1511,7 @@ var SurfaceManifestOperationSchema = z2.object({
|
|
|
1504
1511
|
scope: z2.string().nullable(),
|
|
1505
1512
|
description: z2.string(),
|
|
1506
1513
|
schemas: SurfaceSchemaDigestsSchema,
|
|
1514
|
+
mcp: SurfaceManifestOperationMcpSchema,
|
|
1507
1515
|
http: z2.array(z2.object({ method: HttpMethodSchema, path: z2.string() }))
|
|
1508
1516
|
});
|
|
1509
1517
|
var SurfaceManifestToolSchema = z2.object({
|
|
@@ -1540,7 +1548,7 @@ var SurfaceManifestRealtimeEventSchema = z2.object({
|
|
|
1540
1548
|
acknowledgement: SurfaceRealtimeSchemaPairSchema.nullable()
|
|
1541
1549
|
});
|
|
1542
1550
|
var SurfaceManifestSchema = z2.object({
|
|
1543
|
-
manifestVersion: z2.literal(
|
|
1551
|
+
manifestVersion: z2.literal(SURFACE_MANIFEST_VERSION),
|
|
1544
1552
|
digestVersion: z2.literal(1),
|
|
1545
1553
|
operations: z2.array(SurfaceManifestOperationSchema),
|
|
1546
1554
|
toolSurfaces: z2.array(SurfaceManifestToolSurfaceSchema),
|
|
@@ -1594,18 +1602,24 @@ function operationFrom(kind, source) {
|
|
|
1594
1602
|
output: schemaDigest(source.outputSchema, "output"),
|
|
1595
1603
|
multipart: multipartDigest(source.multipart)
|
|
1596
1604
|
},
|
|
1605
|
+
mcp: mcpRoundsOf(source),
|
|
1597
1606
|
http: []
|
|
1598
1607
|
};
|
|
1599
1608
|
}
|
|
1600
|
-
function
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1609
|
+
function mcpRoundsOf(source) {
|
|
1610
|
+
if (!source.mcp)
|
|
1611
|
+
return null;
|
|
1612
|
+
const declared = staticInputRounds(source.mcp);
|
|
1613
|
+
return {
|
|
1614
|
+
inputRequired: declared ? declared.map((request) => ({
|
|
1604
1615
|
key: request.key,
|
|
1605
1616
|
message: request.message,
|
|
1606
1617
|
schema: schemaDigest(request.schema, "input")
|
|
1607
1618
|
})) : "resolved-per-call"
|
|
1608
|
-
}
|
|
1619
|
+
};
|
|
1620
|
+
}
|
|
1621
|
+
function operationFingerprint(source) {
|
|
1622
|
+
const mcp = mcpRoundsOf(source);
|
|
1609
1623
|
return serializeSurfaceValue({
|
|
1610
1624
|
method: source.method,
|
|
1611
1625
|
serviceName: source.serviceName,
|
|
@@ -1789,7 +1803,7 @@ function buildSurfaceManifest(config) {
|
|
|
1789
1803
|
operation.http.sort((left, right) => compareCodepoints(left.path, right.path) || compareCodepoints(left.method, right.method));
|
|
1790
1804
|
}
|
|
1791
1805
|
return SurfaceManifestSchema.parse({
|
|
1792
|
-
manifestVersion:
|
|
1806
|
+
manifestVersion: SURFACE_MANIFEST_VERSION,
|
|
1793
1807
|
digestVersion: 1,
|
|
1794
1808
|
operations: [...operations.values()].sort((left, right) => compareCodepoints(left.service, right.service) || compareCodepoints(left.action, right.action) || compareCodepoints(left.kind, right.kind)),
|
|
1795
1809
|
toolSurfaces: toolSurfaces.sort((left, right) => compareCodepoints(left.transport, right.transport) || compareCodepoints(left.surface ?? "", right.surface ?? "")),
|
|
@@ -1800,6 +1814,10 @@ function buildSurfaceManifest(config) {
|
|
|
1800
1814
|
});
|
|
1801
1815
|
}
|
|
1802
1816
|
function assertSurfaceManifestSnapshot(manifest, snapshot) {
|
|
1817
|
+
const committed = snapshot.manifestVersion;
|
|
1818
|
+
if (committed !== SURFACE_MANIFEST_VERSION) {
|
|
1819
|
+
throw new Error(`Surface snapshot is manifestVersion ${String(committed)}; this build writes ` + `${SURFACE_MANIFEST_VERSION}. Regenerate it and review the diff — the format ` + "changed, so the first regeneration is expected to be large.");
|
|
1820
|
+
}
|
|
1803
1821
|
const actual = serializeSurfaceValue(SurfaceManifestSchema.parse(manifest));
|
|
1804
1822
|
const expected = serializeSurfaceValue(SurfaceManifestSchema.parse(snapshot));
|
|
1805
1823
|
if (actual !== expected) {
|
|
@@ -2177,7 +2195,9 @@ export {
|
|
|
2177
2195
|
SurfaceManifestSchema,
|
|
2178
2196
|
SurfaceManifestRealtimeEventSchema,
|
|
2179
2197
|
SurfaceManifestOperationSchema,
|
|
2198
|
+
SurfaceManifestOperationMcpSchema,
|
|
2180
2199
|
SurfaceManifestExtensionSchema,
|
|
2200
|
+
SURFACE_MANIFEST_VERSION,
|
|
2181
2201
|
RealtimeRejectionObservationSchema,
|
|
2182
2202
|
RealtimeDisconnectObservationSchema,
|
|
2183
2203
|
ManagedResourceConformanceTraceOutcomeSchema,
|
|
@@ -44,6 +44,24 @@ export interface PreparedCliCommandEmission {
|
|
|
44
44
|
presentation?: string;
|
|
45
45
|
successExitCode: number;
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Whether a native command yields a value at all.
|
|
49
|
+
*
|
|
50
|
+
* The two halves of `CliCommandDefinition` are not the same kind of thing: one
|
|
51
|
+
* returns a validated result and lets the frame print it, the other prints
|
|
52
|
+
* itself and returns nothing. Only the first can be executed somewhere that has
|
|
53
|
+
* no stdout to print to — an in-process invocation, a stream of JSON lines —
|
|
54
|
+
* and this is the test that decides it.
|
|
55
|
+
*/
|
|
56
|
+
export declare function cliCommandReturnsResult(definition: CliCommandDefinition): definition is CliCommandDefinitionWithOutput<ZodObject, ZodType>;
|
|
57
|
+
/**
|
|
58
|
+
* The exit code a successful result earns, or a throw naming the offence.
|
|
59
|
+
*
|
|
60
|
+
* Shared, because a command run in process must exit-code identically to the
|
|
61
|
+
* same command typed at a prompt; two copies of this rule would eventually
|
|
62
|
+
* disagree and the divergence would show up as a script that branches wrong.
|
|
63
|
+
*/
|
|
64
|
+
export declare function cliCommandSuccessExitCode(definition: CliCommandDefinition, data: unknown): number;
|
|
47
65
|
/** Apply native-only presentation policy after canonical output validation. */
|
|
48
66
|
export declare function prepareCliCommandEmission(definition: CliCommandDefinition, result: ToolResult, options: Readonly<CliRunOptions>): PreparedCliCommandEmission;
|
|
49
67
|
export declare function cliCommandPresentationSchema(definition: CliCommandDefinition): Record<string, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-command.d.ts","sourceRoot":"","sources":["../../src/tools/cli-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAEjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,KAAK,UAAU,EAAuB,MAAM,WAAW,CAAC;AAGjE,MAAM,WAAW,iBAAiB,CAAC,MAAM,SAAS,SAAS,CAAE,SAAQ,UAAU;IAC7E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACxB,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC;IACjC;;;;;OAKG;IACH,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,wBAAwB,CAAC,MAAM,SAAS,SAAS;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,8BAA8B,CAC7C,MAAM,SAAS,SAAS,EACxB,OAAO,SAAS,OAAO,CACvB,SAAQ,wBAAwB,CAAC,MAAM,CAAC;IACxC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,CACP,OAAO,EAAE,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IACtB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,oBAAoB,GAC/B,UAAU,IAAI,8BAA8B,CAAC,SAAS,EAAE,OAAO,CAAC,CAElE;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,oBAAoB,EAChC,IAAI,EAAE,OAAO,GACZ,MAAM,CAMR;AAED,+EAA+E;AAC/E,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,oBAAoB,EAChC,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC,GAC/B,0BAA0B,CAiB5B;AAED,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,oBAAoB,GAC/B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAKzB;AAED,iFAAiF;AACjF,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,oBAAoB,EAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,UAAU,EACnB,UAAU,EAAE,OAAO,EACnB,OAAO,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM,GAC9C,OAAO,CAAC,UAAU,CAAC,CAoCrB"}
|
|
@@ -17,12 +17,22 @@
|
|
|
17
17
|
* `createCli` is built on this same function, so the stream and the command
|
|
18
18
|
* line cannot answer differently: one surface, one runner, one exit table.
|
|
19
19
|
*
|
|
20
|
-
* Native commands (`config.commands`) are
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* Native commands (`config.commands`) are in it when, and only when, they
|
|
21
|
+
* declare `output`. The two halves of a native definition are not the same kind
|
|
22
|
+
* of thing: one returns a validated value the frame prints, the other prints
|
|
23
|
+
* itself and returns `void`. Only the second cannot be run where there is no
|
|
24
|
+
* stdout, and excluding both because of it cost a consumer a working `describe`
|
|
25
|
+
* line for no reason the type could not already tell apart.
|
|
26
|
+
*
|
|
27
|
+
* `present` is not called on this path: it is stdout formatting, and there is
|
|
28
|
+
* no stdout. `exitCode` is, through the same function the command line uses, so
|
|
29
|
+
* a script branching on the code cannot see the two paths disagree. Anything
|
|
30
|
+
* the handler does write is captured and returned on the result rather than
|
|
31
|
+
* leaking into a caller's stream of answers.
|
|
23
32
|
*/
|
|
24
33
|
import type { ZodObject, z } from 'zod';
|
|
25
34
|
import type { ServiceDef, StitchLogger } from '../server/types.js';
|
|
35
|
+
import { type CliCommandDefinition } from './cli-command.js';
|
|
26
36
|
import { type ExitCodeMap } from './cli-format.js';
|
|
27
37
|
import { type CliCommandPresentation, type CliPresentationPolicyConfig } from './cli-policy.js';
|
|
28
38
|
import { type ErrorHintFn, type ToolCallHooks, type ToolLifecycle, type ToolResult } from './execute.js';
|
|
@@ -41,6 +51,8 @@ export interface CliInvokerConfig<TAuth = unknown, TContext extends Record<strin
|
|
|
41
51
|
services?: CliSurfaceSource<TAuth, ServiceDef>;
|
|
42
52
|
/** Pathless managed operations. CLI exposure always requires `transports: ['CLI']`. */
|
|
43
53
|
runtimeTools?: CliSurfaceSource<TAuth, RuntimeToolDefinition>;
|
|
54
|
+
/** CLI-only executable commands, dispatched before the managed surface. */
|
|
55
|
+
commands?: readonly CliCommandDefinition[];
|
|
44
56
|
auth?: TAuth | Promise<TAuth>;
|
|
45
57
|
resolveAuth?: (globals: z.output<TGlobals>) => TAuth | Promise<TAuth>;
|
|
46
58
|
globalOptions?: TGlobals;
|
|
@@ -69,6 +81,19 @@ export interface CliInvocationResult {
|
|
|
69
81
|
hint?: string;
|
|
70
82
|
retryable?: boolean;
|
|
71
83
|
};
|
|
84
|
+
/**
|
|
85
|
+
* What a native handler wrote, when it wrote anything.
|
|
86
|
+
*
|
|
87
|
+
* A command that declares `output` is not supposed to write — the frame
|
|
88
|
+
* prints for it — but it holds the writers and may log. In process there is
|
|
89
|
+
* nowhere for that text to go: printing it would interleave with a caller's
|
|
90
|
+
* own output and corrupt a stream of JSON lines, and dropping it would lose a
|
|
91
|
+
* diagnostic silently. So it comes back here, and the caller decides.
|
|
92
|
+
*/
|
|
93
|
+
written?: {
|
|
94
|
+
stdout?: string;
|
|
95
|
+
stderr?: string;
|
|
96
|
+
};
|
|
72
97
|
}
|
|
73
98
|
/** One resolved managed command. */
|
|
74
99
|
export interface CliInvokerCommand {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-invoke.d.ts","sourceRoot":"","sources":["../../src/tools/cli-invoke.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cli-invoke.d.ts","sourceRoot":"","sources":["../../src/tools/cli-invoke.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EACL,KAAK,oBAAoB,EAI1B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAGL,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EACjC,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,UAAU,EAGhB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAG5D,MAAM,MAAM,gBAAgB,CAAC,KAAK,EAAE,MAAM,IACtC,SAAS,MAAM,EAAE,GACjB,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,SAAS,KAAK,SAAS,MAAM,EAAE,CAAC,CAAC;AAE9D;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|
|
|
1
1
|
import type { ZodObject, z } from 'zod';
|
|
2
|
-
import { type CliCommandDefinition } from './cli-command.js';
|
|
3
2
|
import { type ExitCodeMap } from './cli-format.js';
|
|
4
3
|
import { type CliInvocationResult, type CliInvoker, type CliInvokerCommand, type CliInvokerConfig, type CliSurfaceSource, cliInvocationResult, createCliInvoker } from './cli-invoke.js';
|
|
5
4
|
import { type CliWaitConfig } from './cli-wait.js';
|
|
@@ -9,8 +8,6 @@ export { cliInvocationResult, createCliInvoker };
|
|
|
9
8
|
export interface CliConfig<TAuth = unknown, TContext extends Record<string, unknown> = Record<string, unknown>, TGlobals extends ZodObject = ZodObject> extends CliInvokerConfig<TAuth, TContext, TGlobals> {
|
|
10
9
|
/** Program version — printed by `--version`. */
|
|
11
10
|
version: string;
|
|
12
|
-
/** CLI-only executable commands, dispatched before auth and managed surface factories. */
|
|
13
|
-
commands?: readonly CliCommandDefinition[];
|
|
14
11
|
/**
|
|
15
12
|
* Identity for the single CLI invocation — resolved ONCE at startup (from an
|
|
16
13
|
* env var / token file), like a stdio MCP server, not per call. A value or a
|
package/dist/tools/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/tools/cli.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/tools/cli.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoBxC,OAAO,EAAsB,KAAK,WAAW,EAAc,MAAM,cAAc,CAAC;AAChF,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,cAAc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AQ,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAid7D"}
|
package/dist/tools.js
CHANGED
package/llms-full.txt
CHANGED
|
@@ -66,11 +66,11 @@ own, recorded as an ADR.
|
|
|
66
66
|
| `stitchkit/geo` | server (Bun or Node) | evolving | managed GeoIP reader generations, last-known-good reload and the optional MaxMind adapter |
|
|
67
67
|
| `stitchkit/oauth` | browser **and** server | evolving | provider-neutral Authorization Code + PKCE request and one-shot callback transaction mechanics |
|
|
68
68
|
| `stitchkit/google` | server (Bun or Node) | evolving | optional Google code exchange and verified OIDC identity adapter |
|
|
69
|
-
| `stitchkit/observability` | server | stable<br>_redefined in 2 of the
|
|
69
|
+
| `stitchkit/observability` | server | stable<br>_redefined in 2 of the 38 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
|
|
70
70
|
| `stitchkit/testing` | tests on Bun or Node | stable | in-process generated clients over a real Fetch handler, plus the store and managed-resource conformance kits |
|
|
71
71
|
| `stitchkit/declaration` | browser + build and deployment tooling (Bun or Node) | evolving | `ProjectDeclarationSchema` — the one machine-readable statement a repository makes about itself |
|
|
72
72
|
| `stitchkit/react` | browser + server rendering | stable | `createCursorQuery`, `createCacheBridge`, QueryClient and `ApiError` retry policy |
|
|
73
|
-
| `stitchkit/agent-runtime` | server | evolving<br>_redefined in 20 of the
|
|
73
|
+
| `stitchkit/agent-runtime` | server | evolving<br>_redefined in 20 of the 38 minors since 0.56.2, most recently 0.89.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
|
|
74
74
|
| `stitchkit/agent-runtime/sandbox` | server | evolving | optional Linux Bubblewrap sessions, durable workspaces and a host HTTP credential gateway; see [sandbox guide](sandbox.md) |
|
|
75
75
|
| `stitchkit/agent-runtime/testing` | tests on Bun or Node | evolving | credential-free replay, scripted provider faults and deterministic race controls |
|
|
76
76
|
| `stitchkit/agent-runtime/harness` | server | evolving | resource-aware process-local facade over the canonical Agent runtime; supervision stays outside |
|
|
@@ -80,7 +80,7 @@ own, recorded as an ADR.
|
|
|
80
80
|
| `stitchkit/agent-runtime/sqlite/bun` | server (Bun) | evolving | durable built-in SQLite store for the agent runtime |
|
|
81
81
|
| `stitchkit/agent-runtime/sqlite/node` | server (Node ≥ 22.5) | evolving | durable built-in SQLite store for the agent runtime |
|
|
82
82
|
| `stitchkit-tui` | terminal (Bun) | evolving | optional official OpenTUI host over a caller-composed headless runtime |
|
|
83
|
-
| `stitchkit/application` | browser + server | evolving<br>_redefined in 7 of the
|
|
83
|
+
| `stitchkit/application` | browser + server | evolving<br>_redefined in 7 of the 38 minors since 0.56.2, most recently 0.83.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
|
|
84
84
|
| `stitchkit/application/grammy` | server | evolving | isolated grammY polling and webhook lifecycle adapters |
|
|
85
85
|
| `stitchkit/application/opentelemetry` | server | evolving | maps application snapshots onto an injected OpenTelemetry `Meter` |
|
|
86
86
|
| `stitchkit/application/schemas` | browser + server | evolving | the application's snapshot, health and shutdown schemas alone, without the kernel |
|
|
@@ -8070,6 +8070,30 @@ Carry the build stamp inside the binary (`CliBuildStampSchema`,
|
|
|
8070
8070
|
`formatCliBuildStamp`) so the tool can say what it is rather than leaving the
|
|
8071
8071
|
reader to infer it from behaviour.
|
|
8072
8072
|
|
|
8073
|
+
#### A manifest inside your own network
|
|
8074
|
+
|
|
8075
|
+
The check goes through the same SSRF boundary every outbound fetch does, so a
|
|
8076
|
+
manifest served from `10.x`, `localhost` or a `.internal` name is refused and
|
|
8077
|
+
the answer is `unknown`. For a self-hosted deployment that is a wrong answer
|
|
8078
|
+
dressed as a careful one, and the refusal says so — it names the field that
|
|
8079
|
+
lifts it rather than reading like a timeout:
|
|
8080
|
+
|
|
8081
|
+
```text
|
|
8082
|
+
refusing to fetch an internal host — the manifest endpoint is not public.
|
|
8083
|
+
Set `allowPrivateHosts` if it is your own deployment; the download keeps its
|
|
8084
|
+
own setting, because an asset URL comes from the document.
|
|
8085
|
+
```
|
|
8086
|
+
|
|
8087
|
+
```ts
|
|
8088
|
+
const check = await checkCliUpdate({ manifestUrl, currentVersion, allowPrivateHosts: true })
|
|
8089
|
+
```
|
|
8090
|
+
|
|
8091
|
+
Set it from whether **your** endpoint is private, not as a blanket switch, and
|
|
8092
|
+
leave `applyCliUpdate` at its default. The two are not the same decision: the
|
|
8093
|
+
manifest URL is configuration you wrote, while an asset URL arrives inside a
|
|
8094
|
+
document the endpoint served, and a document is exactly what an SSRF boundary
|
|
8095
|
+
exists to distrust.
|
|
8096
|
+
|
|
8073
8097
|
### Proving who built it — signing the manifest
|
|
8074
8098
|
|
|
8075
8099
|
The asset digest proves the bytes that arrived are the bytes the manifest named.
|
|
@@ -8190,6 +8214,39 @@ already holding, plus a process start measured at 0.15 s — thirty seconds for
|
|
|
8190
8214
|
two-hundred-line manifest before any work begins. The ban on nesting one stream
|
|
8191
8215
|
inside another was a consequence of that child process, not a rule anyone wanted.
|
|
8192
8216
|
|
|
8217
|
+
### Native commands in the stream
|
|
8218
|
+
|
|
8219
|
+
A native command is in the invoker's surface when — and only when — it declares
|
|
8220
|
+
`output`:
|
|
8221
|
+
|
|
8222
|
+
```ts
|
|
8223
|
+
const describe = defineCliCommand({
|
|
8224
|
+
name: 'describe', description: 'Describe the catalogue',
|
|
8225
|
+
input: z.object({ model: z.string() }),
|
|
8226
|
+
output: z.object({ model: z.string(), ratios: z.array(z.string()) }),
|
|
8227
|
+
handler: ({ input }) => ({ model: input.model, ratios: ['1:1', '16:9'] }),
|
|
8228
|
+
})
|
|
8229
|
+
|
|
8230
|
+
await createCliInvoker({ name: 'myapp', services, commands: [describe] })
|
|
8231
|
+
// invoke('describe', { model: 'flux' }) → { ok: true, exitCode: 0, data: { … } }
|
|
8232
|
+
```
|
|
8233
|
+
|
|
8234
|
+
A command that declares `output?: never` prints itself and returns nothing, so
|
|
8235
|
+
there is no result to hand back; it answers `NOT_FOUND` and stays on the command
|
|
8236
|
+
line, where stdout exists. Your stream command is one of these, which is why a
|
|
8237
|
+
stream still cannot invoke itself.
|
|
8238
|
+
|
|
8239
|
+
On this path `present` is not called — it is stdout formatting, and there is no
|
|
8240
|
+
stdout — while `exitCode` is applied through the same function the command line
|
|
8241
|
+
uses, so a script branching on the code sees one answer from both. Anything the
|
|
8242
|
+
handler writes comes back as `written` rather than interleaving with your own
|
|
8243
|
+
output:
|
|
8244
|
+
|
|
8245
|
+
```ts
|
|
8246
|
+
const outcome = await invoker.invoke('describe', { model: 'flux' })
|
|
8247
|
+
outcome.written // { stderr: 'warming the cache\n' } — absent when nothing was written
|
|
8248
|
+
```
|
|
8249
|
+
|
|
8193
8250
|
### Mounting the loop
|
|
8194
8251
|
|
|
8195
8252
|
```ts
|
|
@@ -12421,6 +12478,38 @@ analytics policy belong to the application.
|
|
|
12421
12478
|
|
|
12422
12479
|
# Upgrading stitchkit
|
|
12423
12480
|
|
|
12481
|
+
## Released migration: 0.93.0
|
|
12482
|
+
|
|
12483
|
+
1. **Regenerate every committed surface snapshot, once.** `manifestVersion` is
|
|
12484
|
+
`3` and each operation row gained `mcp` — the rounds it declares before it
|
|
12485
|
+
runs. Most rows get `null`, so the first diff is large and mechanical.
|
|
12486
|
+
**Who must act:** anyone with a committed snapshot. A snapshot on the older
|
|
12487
|
+
version is refused by name rather than failing a schema literal:
|
|
12488
|
+
|
|
12489
|
+
```text
|
|
12490
|
+
Surface snapshot is manifestVersion 2; this build writes 3. Regenerate it
|
|
12491
|
+
and review the diff — the format changed, so the first regeneration is
|
|
12492
|
+
expected to be large.
|
|
12493
|
+
```
|
|
12494
|
+
|
|
12495
|
+
```ts
|
|
12496
|
+
// before — a declared round left no trace, so declaring or removing one
|
|
12497
|
+
// passed review invisibly
|
|
12498
|
+
manifest.operations[0]
|
|
12499
|
+
// after
|
|
12500
|
+
manifest.operations[0].mcp
|
|
12501
|
+
// null | { inputRequired: [{ key, message, schema }] }
|
|
12502
|
+
// | { inputRequired: 'resolved-per-call' }
|
|
12503
|
+
```
|
|
12504
|
+
|
|
12505
|
+
A project that kept its own test for "declared `inputRequired` implies a
|
|
12506
|
+
configured state key" can drop it: the snapshot holds that link now.
|
|
12507
|
+
|
|
12508
|
+
2. **Nothing else to do.** Native commands that declare `output` became
|
|
12509
|
+
invokable in process; a name that answered `NOT_FOUND` from
|
|
12510
|
+
`createCliInvoker` in 0.92.0 may now resolve. If an application relied on
|
|
12511
|
+
native commands being unreachable there, stop passing them to the invoker.
|
|
12512
|
+
|
|
12424
12513
|
## Released migration: 0.92.0
|
|
12425
12514
|
|
|
12426
12515
|
1. **`RequestEvent.method`, `path` and `statusCode` are optional.** Work that did
|
|
@@ -17732,6 +17821,8 @@ handler pipeline without opening a TCP port.
|
|
|
17732
17821
|
| `TransportObservation` | _type_ | validated normalized driver result |
|
|
17733
17822
|
| `SurfaceManifest` / `SurfaceManifestConfig` | _type_ | deterministic surface snapshot and its inputs |
|
|
17734
17823
|
| `SurfaceManifestOperation` / `SurfaceManifestOperationSchema` | _type_ / schema | one contract or runtime operation row |
|
|
17824
|
+
| `SurfaceManifestOperationMcp` / `SurfaceManifestOperationMcpSchema` | _type_ / schema | the rounds an operation declares before it runs: a fixed list, `'resolved-per-call'`, or `null` for no MCP policy |
|
|
17825
|
+
| `SURFACE_MANIFEST_VERSION` | const | the format version this build writes; a committed snapshot on an older one is refused by name |
|
|
17735
17826
|
| `SurfaceManifestTool` / `SurfaceManifestToolSchema` | _type_ / schema | one mounted tool row with advertised input digest |
|
|
17736
17827
|
| `SurfaceManifestToolSurface` / `SurfaceManifestToolSurfaceSchema` | _type_ / schema | one static transport projection, optionally keyed for a finite MCP surface |
|
|
17737
17828
|
| `SurfaceManifestRealtimeEvent` / `SurfaceManifestRealtimeEventSchema` | _type_ / schema | one named directional realtime event with input/output args and ack digests |
|
package/package.json
CHANGED