stitchkit 0.120.0 → 0.122.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 +83 -0
- package/dist/agent-runtime/browser-control-contract.d.ts +12 -0
- package/dist/agent-runtime/browser-control-contract.d.ts.map +1 -1
- package/dist/agent-runtime/coding-discovery.d.ts +25 -0
- package/dist/agent-runtime/coding-discovery.d.ts.map +1 -0
- package/dist/agent-runtime/coding-search-automaton.d.ts +37 -0
- package/dist/agent-runtime/coding-search-automaton.d.ts.map +1 -0
- package/dist/agent-runtime/coding-search-case-fold.d.ts +4 -0
- package/dist/agent-runtime/coding-search-case-fold.d.ts.map +1 -0
- package/dist/agent-runtime/coding-search-class-ranges.d.ts +10 -0
- package/dist/agent-runtime/coding-search-class-ranges.d.ts.map +1 -0
- package/dist/agent-runtime/coding-search-contract.d.ts +86 -0
- package/dist/agent-runtime/coding-search-contract.d.ts.map +1 -0
- package/dist/agent-runtime/coding-search-limits.d.ts +13 -0
- package/dist/agent-runtime/coding-search-limits.d.ts.map +1 -0
- package/dist/agent-runtime/coding-search-matcher.d.ts +33 -0
- package/dist/agent-runtime/coding-search-matcher.d.ts.map +1 -0
- package/dist/agent-runtime/coding-search-output.d.ts +5 -0
- package/dist/agent-runtime/coding-search-output.d.ts.map +1 -0
- package/dist/agent-runtime/coding-search-regex-syntax.d.ts +39 -0
- package/dist/agent-runtime/coding-search-regex-syntax.d.ts.map +1 -0
- package/dist/agent-runtime/coding-search-unit-classes.d.ts +31 -0
- package/dist/agent-runtime/coding-search-unit-classes.d.ts.map +1 -0
- package/dist/agent-runtime/coding-shell-process.d.ts +1 -0
- package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-contract.d.ts +8 -3
- package/dist/agent-runtime/coding-tool-contract.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-files.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-listing.d.ts +1 -11
- package/dist/agent-runtime/coding-tool-listing.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-paths.d.ts +6 -2
- package/dist/agent-runtime/coding-tool-paths.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-refusals.d.ts +6 -0
- package/dist/agent-runtime/coding-tool-refusals.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-search-patch.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-search.d.ts +113 -0
- package/dist/agent-runtime/coding-tool-search.d.ts.map +1 -0
- package/dist/agent-runtime/coding-tool-shell.d.ts.map +1 -1
- package/dist/agent-runtime/contained-scan-budget.d.ts +32 -0
- package/dist/agent-runtime/contained-scan-budget.d.ts.map +1 -0
- package/dist/agent-runtime/contained-scan-contract.d.ts +52 -0
- package/dist/agent-runtime/contained-scan-contract.d.ts.map +1 -0
- package/dist/agent-runtime/contained-scan.d.ts +48 -13
- package/dist/agent-runtime/contained-scan.d.ts.map +1 -1
- package/dist/agent-runtime/control-schema.d.ts +27 -4
- package/dist/agent-runtime/control-schema.d.ts.map +1 -1
- package/dist/agent-runtime/event-schema.d.ts +33 -0
- package/dist/agent-runtime/event-schema.d.ts.map +1 -1
- package/dist/agent-runtime/run-acquisition.d.ts.map +1 -1
- package/dist/agent-runtime/run-execution-state.d.ts +6 -0
- package/dist/agent-runtime/run-execution-state.d.ts.map +1 -1
- package/dist/agent-runtime/run-model-attempts.d.ts.map +1 -1
- package/dist/agent-runtime/run-stream-parts.d.ts +11 -0
- package/dist/agent-runtime/run-stream-parts.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox.d.ts +5 -1
- package/dist/agent-runtime/sandbox.d.ts.map +1 -1
- package/dist/agent-runtime/tool-progress.d.ts +21 -0
- package/dist/agent-runtime/tool-progress.d.ts.map +1 -0
- package/dist/agent-runtime/workspace-glob.d.ts +6 -0
- package/dist/agent-runtime/workspace-glob.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/browser.js +7 -3
- package/dist/entrypoints/agent-runtime/coding-tools.js +7 -7
- package/dist/entrypoints/agent-runtime/harness.js +8 -8
- package/dist/entrypoints/agent-runtime/realtime.js +5 -5
- package/dist/entrypoints/agent-runtime/sandbox.js +7 -7
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +9 -9
- package/dist/entrypoints/agent-runtime/sqlite/node.js +9 -9
- package/dist/entrypoints/agent-runtime/testing.js +9 -9
- package/dist/entrypoints/agent-runtime.d.ts +1 -1
- package/dist/entrypoints/agent-runtime.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime.js +15 -13
- package/dist/entrypoints/application/diagnostic-journal.js +3 -3
- package/dist/entrypoints/application/directory-inbox.js +5 -5
- package/dist/entrypoints/cli/publish.js +4 -4
- package/dist/entrypoints/cli.js +4 -4
- package/dist/entrypoints/files.js +4 -4
- package/dist/entrypoints/process/owner-loss.js +2 -1
- package/dist/entrypoints/process.js +4 -4
- package/dist/entrypoints/server.d.ts +1 -0
- package/dist/entrypoints/server.d.ts.map +1 -1
- package/dist/entrypoints/server.js +112 -47
- package/dist/entrypoints/telegram.js +3 -3
- package/dist/entrypoints/tools/agent.js +1 -1
- package/dist/entrypoints/tools/toolkit.js +5 -5
- package/dist/{index-yb9n4pgj.js → index-10rg78vf.js} +1 -1
- package/dist/{index-7zwtbak8.js → index-1fyea34p.js} +9 -4
- package/dist/{index-3yb5kft5.js → index-4tyt1qya.js} +1 -1
- package/dist/{index-8xyf8h2k.js → index-6j15ktag.js} +1 -1
- package/dist/{index-zrdcmg6j.js → index-72xtvcvr.js} +40 -6
- package/dist/{index-4qnzda76.js → index-7qyv50r4.js} +1 -1
- package/dist/{index-qctbzmg9.js → index-am1h8c9v.js} +69 -27
- package/dist/{index-e452syyh.js → index-aqmadanx.js} +2 -2
- package/dist/{index-yt7gyg5x.js → index-b51tzcgh.js} +1 -1
- package/dist/{index-aw6zahv1.js → index-dqpesdck.js} +2 -2
- package/dist/{index-1jwsfkfz.js → index-eeahxwvg.js} +60 -76
- package/dist/{index-sb9dr3tq.js → index-eh71zr32.js} +4 -4
- package/dist/{index-nyyam9ce.js → index-f6pw75e1.js} +1 -1
- package/dist/{index-qevqn3d3.js → index-gq3fnq3f.js} +1 -1
- package/dist/{index-bz479f0x.js → index-gtx3eknx.js} +1 -1
- package/dist/{index-mnkk1ffz.js → index-hs76yzt7.js} +13 -1
- package/dist/{index-nn9qvkww.js → index-j95jp7ee.js} +45 -9
- package/dist/{index-2kbysk9s.js → index-m5m9rmvt.js} +2 -0
- package/dist/{index-r3db01kh.js → index-nwm3ww60.js} +1 -1
- package/dist/index-qaqxdbxf.js +2857 -0
- package/dist/index-s9a0fjh3.js +305 -0
- package/dist/{index-b0w7rbpt.js → index-t05a2ry4.js} +39 -3
- package/dist/{index-pq2m7t46.js → index-v8yqk4w7.js} +22 -8
- package/dist/internal/contained-directory.d.ts +1 -1
- package/dist/internal/contained-directory.d.ts.map +1 -1
- package/dist/internal/contained-files.d.ts +18 -51
- package/dist/internal/contained-files.d.ts.map +1 -1
- package/dist/internal/contained-read.d.ts +17 -0
- package/dist/internal/contained-read.d.ts.map +1 -0
- package/dist/internal/darwin-binding.d.ts +3 -1
- package/dist/internal/darwin-binding.d.ts.map +1 -1
- package/dist/process/bun-child.d.ts.map +1 -1
- package/dist/process/command-owner.d.ts.map +1 -1
- package/dist/process/group.d.ts +2 -0
- package/dist/process/group.d.ts.map +1 -1
- package/dist/process/launch.d.ts +1 -0
- package/dist/process/launch.d.ts.map +1 -1
- package/dist/process/owned-child.d.ts.map +1 -1
- package/dist/process/owner-loss-guard.d.ts.map +1 -1
- package/dist/process/owner-loss-protocol.d.ts +1 -0
- package/dist/process/owner-loss-protocol.d.ts.map +1 -1
- package/dist/server/openapi-security.d.ts +73 -0
- package/dist/server/openapi-security.d.ts.map +1 -0
- package/dist/server/openapi.d.ts +12 -0
- package/dist/server/openapi.d.ts.map +1 -1
- package/dist/tools/agent.d.ts.map +1 -1
- package/dist/tools/cli/format.d.ts +11 -2
- package/dist/tools/cli/format.d.ts.map +1 -1
- package/dist/tools/cli/repeatable-read.d.ts +9 -0
- package/dist/tools/cli/repeatable-read.d.ts.map +1 -0
- package/dist/tools/cli/run-managed.d.ts.map +1 -1
- package/dist/tools/cli/run-native.d.ts.map +1 -1
- package/dist/tools/runtime-call-context.d.ts +15 -0
- package/dist/tools/runtime-call-context.d.ts.map +1 -0
- package/llms/agent-runtime-browser.txt +4 -1
- package/llms/agent-runtime-coding-tools.txt +9 -9
- package/llms/agent-runtime.2.txt +30 -108
- package/llms/agent-runtime.3.txt +111 -1
- package/llms/agent-runtime.txt +59 -24
- package/llms/application.3.txt +5 -2
- package/llms/cli.txt +21 -9
- package/llms/contract.txt +1 -1
- package/llms/process.txt +3 -1
- package/llms/server.2.txt +48 -0
- package/llms/server.5.txt +4 -0
- package/llms/stitchkit.txt +3 -3
- package/llms/tools.txt +4 -1
- package/llms/{upgrading-0.106.0-0.120.0.txt → upgrading-0.106.0-0.122.0.txt} +81 -3
- package/llms/upgrading.txt +1 -1
- package/llms-full.txt +255 -35
- package/llms.txt +7 -7
- package/native/darwin-arm64.node +0 -0
- package/native/darwin-x64.node +0 -0
- package/native-assets.json +4 -4
- package/package.json +2 -1
- package/dist/index-0qyrcjfs.js +0 -1478
- package/dist/index-aa50qwv4.js +0 -107
- package/dist/tools/durability-context.d.ts +0 -7
- package/dist/tools/durability-context.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-owner.d.ts","sourceRoot":"","sources":["../../src/process/command-owner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,EAEL,KAAK,oBAAoB,EAI1B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAEL,KAAK,yBAAyB,EAG/B,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"command-owner.d.ts","sourceRoot":"","sources":["../../src/process/command-owner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,EAEL,KAAK,oBAAoB,EAI1B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAEL,KAAK,yBAAyB,EAG/B,MAAM,UAAU,CAAC;AAWlB,wFAAwF;AACxF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,oBAAoB,EAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,EACrC,MAAM,CAAC,EAAE,yBAAyB;;;;;;;;;;EAyLnC"}
|
package/dist/process/group.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { NativeCommandError, type ParsedNativeCommandStopPolicy } from './contra
|
|
|
3
3
|
export declare function createCommandDeadline(timeoutMs: number, reason: unknown): {
|
|
4
4
|
signal: AbortSignal;
|
|
5
5
|
cancel(): void;
|
|
6
|
+
/** Grant `nextMs` from now instead; an expired deadline stays expired. */
|
|
7
|
+
restart(nextMs: number): void;
|
|
6
8
|
};
|
|
7
9
|
/** Send `signal` to the group. `false` is `ESRCH`: the kernel found no member to receive it. */
|
|
8
10
|
export declare function signalGroup(pid: number | undefined, signal: NodeJS.Signals): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../src/process/group.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,KAAK,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAKpF,+FAA+F;AAC/F,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO;IAYpE,MAAM;IACN,MAAM;
|
|
1
|
+
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../src/process/group.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,KAAK,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAKpF,+FAA+F;AAC/F,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,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AmB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,CAQtE;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAMxF"}
|
package/dist/process/launch.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export interface NativeCommandLaunchDriver {
|
|
|
27
27
|
cleanupTimeoutMs?: number;
|
|
28
28
|
timeoutMs?: number;
|
|
29
29
|
closeTimeoutMs?: number;
|
|
30
|
+
cwdDescriptor?: number;
|
|
30
31
|
}
|
|
31
32
|
/** Driver overrides retain the same finite, safe-integer budget admission. */
|
|
32
33
|
export declare function nativeCommandBudgets(options: ParsedNativeCommandOptions, driver: NativeCommandLaunchDriver | undefined): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../../src/process/launch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAsB,KAAK,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAIjF,OAAO,EAA0B,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAElF,wFAAwF;AACxF,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,2BAA2B,CAAC;IAC7C,QAAQ,CAAC,MAAM,EAAE,2BAA2B,CAAC;IAC7C,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;IACjC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,QAA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,EAAE,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,wBAAwB,CAAC;CACtC,GAAG,UAAU,CAIb;
|
|
1
|
+
{"version":3,"file":"owned-child.d.ts","sourceRoot":"","sources":["../../src/process/owned-child.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,UAAU,EAGhB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAA+B,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAM1F,OAAO,EAAE,KAAK,wBAAwB,EAAyB,MAAM,uBAAuB,CAAC;AAI7F,oFAAoF;AACpF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,wBAAwB,CAAC;CACtC,GAAG,UAAU,CAIb;AAiGD,6FAA6F;AAC7F,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,wBAAwB,CAAC;CACtC,GAAG,4BAA4B,CA0C/B;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"owner-loss-guard.d.ts","sourceRoot":"","sources":["../../src/process/owner-loss-guard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"owner-loss-guard.d.ts","sourceRoot":"","sources":["../../src/process/owner-loss-guard.ts"],"names":[],"mappings":"AAgNA;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,IAAI,OAAO,CAEzD;AAED,0FAA0F;AAC1F,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C"}
|
|
@@ -2,6 +2,7 @@ export declare const OWNER_LOSS_GUARD_FLAG = "--stitchkit-owner-loss-guard-v1";
|
|
|
2
2
|
export interface OwnerLossGuardInvocation {
|
|
3
3
|
readonly entry: string;
|
|
4
4
|
readonly signalTarget: 'group' | 'leader';
|
|
5
|
+
readonly cwdDescriptor?: number;
|
|
5
6
|
}
|
|
6
7
|
/** The owner-loss guard is certified only on the two POSIX kernels exercised by release CI. */
|
|
7
8
|
export declare function ownerLossAvailable(platform: NodeJS.Platform): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"owner-loss-protocol.d.ts","sourceRoot":"","sources":["../../src/process/owner-loss-protocol.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,oCAAoC,CAAC;AAEvE,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,OAAO,GAAG,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"owner-loss-protocol.d.ts","sourceRoot":"","sources":["../../src/process/owner-loss-protocol.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,oCAAoC,CAAC;AAEvE,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC1C,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,+FAA+F;AAC/F,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,OAAO,CAErE;AAED,mGAAmG;AACnG,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,wBAAwB,EAC/B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,SAAS,MAAM,EAAE,GACtB,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAUvB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How an OpenAPI document says what a protected operation needs from its
|
|
3
|
+
* caller: the standard `components.securitySchemes` and one `security`
|
|
4
|
+
* requirement per operation.
|
|
5
|
+
*
|
|
6
|
+
* The document describes the host's auth policy; it never enforces it. The
|
|
7
|
+
* runtime gate stays `createAuthHook` and its scope rules, so the mapping here
|
|
8
|
+
* is keyed by the same scope names the contracts already declare — no second
|
|
9
|
+
* copy of which endpoint is protected. The generator refuses to advertise a
|
|
10
|
+
* protected operation it cannot describe: a scope missing from the mapping
|
|
11
|
+
* would otherwise reach the spec as an open endpoint, and a generic client
|
|
12
|
+
* would call it without a credential.
|
|
13
|
+
*/
|
|
14
|
+
import { z } from 'zod';
|
|
15
|
+
/** One way a request presents its credential — the OpenAPI Security Scheme Object. */
|
|
16
|
+
export declare const OpenApiSecuritySchemeSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
17
|
+
description: z.ZodOptional<z.ZodString>;
|
|
18
|
+
type: z.ZodLiteral<"http">;
|
|
19
|
+
scheme: z.ZodLiteral<"bearer">;
|
|
20
|
+
bearerFormat: z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
22
|
+
description: z.ZodOptional<z.ZodString>;
|
|
23
|
+
type: z.ZodLiteral<"http">;
|
|
24
|
+
scheme: z.ZodLiteral<"basic">;
|
|
25
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
26
|
+
description: z.ZodOptional<z.ZodString>;
|
|
27
|
+
type: z.ZodLiteral<"apiKey">;
|
|
28
|
+
in: z.ZodEnum<{
|
|
29
|
+
cookie: "cookie";
|
|
30
|
+
header: "header";
|
|
31
|
+
query: "query";
|
|
32
|
+
}>;
|
|
33
|
+
name: z.ZodString;
|
|
34
|
+
}, z.core.$strict>]>;
|
|
35
|
+
export type OpenApiSecurityScheme = z.infer<typeof OpenApiSecuritySchemeSchema>;
|
|
36
|
+
export declare const OpenApiSecuritySchema: z.ZodObject<{
|
|
37
|
+
schemes: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
38
|
+
description: z.ZodOptional<z.ZodString>;
|
|
39
|
+
type: z.ZodLiteral<"http">;
|
|
40
|
+
scheme: z.ZodLiteral<"bearer">;
|
|
41
|
+
bearerFormat: z.ZodOptional<z.ZodString>;
|
|
42
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
43
|
+
description: z.ZodOptional<z.ZodString>;
|
|
44
|
+
type: z.ZodLiteral<"http">;
|
|
45
|
+
scheme: z.ZodLiteral<"basic">;
|
|
46
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
47
|
+
description: z.ZodOptional<z.ZodString>;
|
|
48
|
+
type: z.ZodLiteral<"apiKey">;
|
|
49
|
+
in: z.ZodEnum<{
|
|
50
|
+
cookie: "cookie";
|
|
51
|
+
header: "header";
|
|
52
|
+
query: "query";
|
|
53
|
+
}>;
|
|
54
|
+
name: z.ZodString;
|
|
55
|
+
}, z.core.$strict>]>>;
|
|
56
|
+
scopes: z.ZodRecord<z.ZodString, z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
57
|
+
defaultScope: z.ZodOptional<z.ZodString>;
|
|
58
|
+
}, z.core.$strict>;
|
|
59
|
+
export type OpenApiSecurity = z.infer<typeof OpenApiSecuritySchema>;
|
|
60
|
+
/** The scope that needs no credential, as `createAuthHook` and the 401/403 responses read it. */
|
|
61
|
+
export declare const PUBLIC_SCOPE = "public";
|
|
62
|
+
/** A configuration checked once, before any operation is emitted. */
|
|
63
|
+
export interface OpenApiSecurityPlan {
|
|
64
|
+
readonly schemes: Readonly<Record<string, OpenApiSecurityScheme>>;
|
|
65
|
+
/**
|
|
66
|
+
* The operation's `security` value, or `undefined` for an open one.
|
|
67
|
+
* `operation` names the endpoint in a refusal.
|
|
68
|
+
*/
|
|
69
|
+
requirement(scope: string | undefined, operation: string): Array<Record<string, string[]>> | undefined;
|
|
70
|
+
}
|
|
71
|
+
/** Validate the host's security description, failing on the first contradiction. */
|
|
72
|
+
export declare function planOpenApiSecurity(input: OpenApiSecurity): OpenApiSecurityPlan;
|
|
73
|
+
//# sourceMappingURL=openapi-security.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi-security.d.ts","sourceRoot":"","sources":["../../src/server/openapi-security.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,sFAAsF;AACtF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;oBActC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;kBAWhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,iGAAiG;AACjG,eAAO,MAAM,YAAY,WAAW,CAAC;AAErC,qEAAqE;AACrE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAClE;;;OAGG;IACH,WAAW,CACT,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,SAAS,EAAE,MAAM,GAChB,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC;CAChD;AAMD,oFAAoF;AACpF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,eAAe,GAAG,mBAAmB,CAsC/E"}
|
package/dist/server/openapi.d.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* emits — not a divergent code path. Schemas are inlined (valid OpenAPI);
|
|
11
11
|
* `$ref` de-duplication can come later if a spec grows unwieldy.
|
|
12
12
|
*/
|
|
13
|
+
import { type OpenApiSecurity, type OpenApiSecurityScheme } from './openapi-security.js';
|
|
13
14
|
import type { MethodDef, RawRoute, ServiceDef } from './types.js';
|
|
14
15
|
export interface OpenApiInfo {
|
|
15
16
|
title: string;
|
|
@@ -44,12 +45,23 @@ export interface OpenApiConfig {
|
|
|
44
45
|
* separate filtered document for a public route (see the guide).
|
|
45
46
|
*/
|
|
46
47
|
includeMethod?: (method: Readonly<MethodDef>) => boolean;
|
|
48
|
+
/**
|
|
49
|
+
* How a caller presents its credential, by the scopes the contracts already
|
|
50
|
+
* declare. Emits `components.securitySchemes` and a `security` requirement on
|
|
51
|
+
* every protected operation, so a generic client knows which header to send.
|
|
52
|
+
* Generation refuses a protected scope with no scheme rather than advertise
|
|
53
|
+
* the endpoint as open. Omit for a document without security metadata.
|
|
54
|
+
*/
|
|
55
|
+
security?: OpenApiSecurity;
|
|
47
56
|
}
|
|
48
57
|
export interface OpenApiDocument {
|
|
49
58
|
openapi: '3.1.0';
|
|
50
59
|
info: OpenApiInfo;
|
|
51
60
|
servers?: OpenApiServer[];
|
|
52
61
|
paths: Record<string, Record<string, unknown>>;
|
|
62
|
+
components?: {
|
|
63
|
+
securitySchemes: Record<string, OpenApiSecurityScheme>;
|
|
64
|
+
};
|
|
53
65
|
}
|
|
54
66
|
/**
|
|
55
67
|
* Generate an OpenAPI 3.1 document from contract services. Only methods exposed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../src/server/openapi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources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AAC;CACzE;AA4GD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,aAAa,GAAG,eAAe,CAwK9E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,GAAG,QAAQ,CAM9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/tools/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAwB,OAAO,EAAE,MAAM,IAAI,CAAC;AAGxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/tools/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAwB,OAAO,EAAE,MAAM,IAAI,CAAC;AAGxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EAAkB,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE/E,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEjF,OAAO,EAAqC,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAGxE,MAAM,WAAW,YAAY;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,qCAAqC;IACrC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;;;OAIG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,+EAA+E;IAC/E,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mEAAmE;IACnE,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC5D,+EAA+E;IAC/E,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gEAAgE;IAChE,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,2EAA2E;IAC3E,YAAY,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAChD;;;OAGG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,qBAAqB,CAAC;CACpC;AAED,wBAAgB,UAAU,CACxB,QAAQ,EAAE,UAAU,GAAG,UAAU,EAAE,EACnC,MAAM,GAAE,gBAAqB,GAC5B,OAAO,CA2HT"}
|
|
@@ -47,8 +47,17 @@ export interface EmitOptions {
|
|
|
47
47
|
*/
|
|
48
48
|
export declare function cliExitCode(result: ToolResult, exitCodes?: ExitCodeMap): number;
|
|
49
49
|
export declare function emitResult(result: ToolResult, writers: CliWriters, opts: EmitOptions): number;
|
|
50
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* A presentation failure cannot erase a successfully completed operation.
|
|
52
|
+
*
|
|
53
|
+
* A command with an effect prints its complete result, because a second call
|
|
54
|
+
* would repeat the effect instead of recovering the answer. A command that only
|
|
55
|
+
* reads withholds it: the answer is one corrected call away, and an unformatted
|
|
56
|
+
* payload is exactly what the caller asked not to receive.
|
|
57
|
+
*/
|
|
51
58
|
export declare function emitPresentationFailure(result: Extract<ToolResult, {
|
|
52
59
|
ok: true;
|
|
53
|
-
}>, failure: ToolFailure, writers: CliWriters, opts: EmitOptions
|
|
60
|
+
}>, failure: ToolFailure, writers: CliWriters, opts: EmitOptions & {
|
|
61
|
+
repeatable: boolean;
|
|
62
|
+
}): number;
|
|
54
63
|
//# sourceMappingURL=format.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGjE,sDAAsD;AACtD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAmBhC,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,WAAW;IAC1B,wEAAwE;IACxE,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,SAAS,CAAC,EAAE,WAAW,CAAC;CACzB;AAED;;;;GAIG;AACH;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,WAAW,GAAG,MAAM,CAY/E;AAED,wBAAgB,UAAU,CACxB,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,WAAW,GAChB,MAAM,CAeR;
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGjE,sDAAsD;AACtD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAmBhC,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,WAAW;IAC1B,wEAAwE;IACxE,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,SAAS,CAAC,EAAE,WAAW,CAAC;CACzB;AAED;;;;GAIG;AACH;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,WAAW,GAAG,MAAM,CAY/E;AAED,wBAAgB,UAAU,CACxB,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,WAAW,GAChB,MAAM,CAeR;AAWD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,OAAO,CAAC,UAAU,EAAE;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,CAAC,EACzC,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,WAAW,GAAG;IAAE,UAAU,EAAE,OAAO,CAAA;CAAE,GAC1C,MAAM,CAsBR"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { OperationIdentity } from '../../server/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Whether calling the operation again returns its answer without a new effect.
|
|
4
|
+
*
|
|
5
|
+
* The declared `readOnlyHint` decides in either direction; without one, `GET` is
|
|
6
|
+
* the contract's own statement that the endpoint reads.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isRepeatableRead(operation: Pick<OperationIdentity, 'method' | 'annotations'>): boolean;
|
|
9
|
+
//# sourceMappingURL=repeatable-read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repeatable-read.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/repeatable-read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,aAAa,CAAC,GAC3D,OAAO,CAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-managed.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/run-managed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"run-managed.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/run-managed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAYrC,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAkB,MAAM,WAAW,CAAC;AAQ3E,wFAAwF;AACxF,wBAAsB,oBAAoB,CACxC,KAAK,EACL,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxC,QAAQ,SAAS,SAAS,EAC1B,OAAO,EAAE,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAkC1F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-native.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/run-native.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,EACL,KAAK,oBAAoB,EAG1B,MAAM,WAAW,CAAC;AAInB,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAkB,MAAM,WAAW,CAAC;AAE3E;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EACL,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxC,QAAQ,SAAS,SAAS,EAE1B,OAAO,EAAE,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAC9C,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,EACzB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"run-native.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/run-native.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,EACL,KAAK,oBAAoB,EAG1B,MAAM,WAAW,CAAC;AAInB,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAkB,MAAM,WAAW,CAAC;AAE3E;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EACL,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxC,QAAQ,SAAS,SAAS,EAE1B,OAAO,EAAE,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAC9C,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,EACzB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,IAAI,CAAC,CA0Ef"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { McpReportProgress } from '../contract/runtime-context.js';
|
|
2
|
+
import type { LocalStepDurability } from '../durability/contract.js';
|
|
3
|
+
/** What the agent runtime hands one tool call beside the SDK's own options. */
|
|
4
|
+
export interface RuntimeToolCall {
|
|
5
|
+
/** The run's step ledger; absent when the runtime runs without durability. */
|
|
6
|
+
durability?: LocalStepDurability;
|
|
7
|
+
/** Publishes the call's progress into the run's event stream — the handler's `ctx.reportProgress`. */
|
|
8
|
+
reportProgress: McpReportProgress;
|
|
9
|
+
}
|
|
10
|
+
type Factory = (callId: string, signal?: AbortSignal) => RuntimeToolCall;
|
|
11
|
+
/** Opaque SDK context; no credentials, functions or runtime objects enter provider messages. */
|
|
12
|
+
export declare function createRuntimeToolContext(factory: Factory): object;
|
|
13
|
+
export declare function resolveRuntimeToolCall(context: unknown, callId: string, signal?: AbortSignal): RuntimeToolCall | undefined;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=runtime-call-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-call-context.d.ts","sourceRoot":"","sources":["../../src/tools/runtime-call-context.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAElE,+EAA+E;AAC/E,MAAM,WAAW,eAAe;IAC9B,8EAA8E;IAC9E,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,sGAAsG;IACtG,cAAc,EAAE,iBAAiB,CAAC;CACnC;AAED,KAAK,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,eAAe,CAAC;AAGzE,gGAAgG;AAChG,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAIjE;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,WAAW,GACnB,eAAe,GAAG,SAAS,CAG7B"}
|
|
@@ -25,7 +25,10 @@ including `AgentAttemptResetEventSchema` for `attempt-reset`),
|
|
|
25
25
|
`AgentControlErrorCodeSchema` / `AgentControlErrorCode` (the one vocabulary of every control
|
|
26
26
|
error code: `FORBIDDEN`, `CONNECTION_CLOSED`, `REQUEST_CAPACITY`, `ATTACHMENT_CAPACITY`,
|
|
27
27
|
`LEASE_CONFLICT`, `EVENT_OVERFLOW` and the rest), `AgentMultiSessionCursorSchema` /
|
|
28
|
-
`AgentMultiSessionCursor`, `AgentConversationView`, `AgentControlView`,
|
|
28
|
+
`AgentMultiSessionCursor`, `AgentConversationView`, `AgentControlView`, `AgentRunTransient` (a
|
|
29
|
+
run's streamed text, reasoning and running tool calls before its next checkpoint),
|
|
30
|
+
`AgentToolActivity` (one running call with its last reported progress),
|
|
31
|
+
`AGENT_TOOL_PROGRESS_MESSAGE_MAX` (the longest progress message a run publishes),
|
|
29
32
|
`advanceAgentMultiSessionCursor`, `createAgentControlView`, `reduceAgentControlSnapshot`,
|
|
30
33
|
`reduceAgentControlEvent` and
|
|
31
34
|
`agentDurableEventId`. It imports no model provider, executor, store, event sink
|
|
@@ -22,28 +22,28 @@ artifact store is supplied, `read_output`.
|
|
|
22
22
|
| Export | Kind | Summary |
|
|
23
23
|
|--------|------|---------|
|
|
24
24
|
| `createAgentCodingTools` | function | construct direct host-authorized bounded file, listing, glob, search, exact-snippet edit, shell and artifact runtime-tool definitions; `edit_file` inserts `newText` literally in both single and `replaceAll` modes; every ordinary refusal is a typed code with an instructive `hint`, and filesystem operations use Linux `/proc/self/fd` or the packaged macOS Node-API backend and otherwise fail closed |
|
|
25
|
-
| `AGENT_CODING_TOOL_NAMES` | const | the mounted tool names — `read_file`, `write_file`, `edit_file`, `list_directory`, `glob`, `search_files`, `run_command`, `read_output` |
|
|
26
25
|
| `AgentCodingToolDefinition` | _type_ | peer-free structural direct-tool shape accepted by the canonical runtime-tool surface |
|
|
27
26
|
| `AgentCodingToolConfig` | _type_ | absolute root, required operation authorization, optional async/sync `authorizePath({ path })` shared by direct file effects and discovery, finite executable alias map, exact child environment and optional limits |
|
|
28
27
|
| `AgentCodingToolAuthorizationSchema` / `AgentCodingToolAuthorization` | schema / _type_ | discriminated read/write/search/patch/shell/artifact decision presented to host policy before effect |
|
|
29
28
|
| `AgentCodingToolPathAuthorizationSchema` / `AgentCodingToolPathAuthorization` | schema / _type_ | strict workspace-relative path presented to the shared path policy before disclosure, opening or mutation |
|
|
30
|
-
| `AgentCodingToolLimitsSchema` / `AgentCodingToolLimits` | schema / _type_ | explicit path/read/write/argument-count/argument-byte/output/artifact/timeout/termination-grace ceilings |
|
|
29
|
+
| `AgentCodingToolLimitsSchema` / `AgentCodingToolLimits` | schema / _type_ | explicit path/read/write/argument-count/argument-byte/output/artifact/timeout/termination-grace ceilings; shared discovery directory/entry/serialized-output/deadline ceilings, aggregate search-read ceiling and measured coverage |
|
|
31
30
|
| `AgentCodingArtifactStore` | _type_ | host-owned opaque artifact write and bounded read boundary |
|
|
32
|
-
| `FileReadInputSchema` / `FileReadOutputSchema` | schema | bounded strict-UTF-8 byte slice; offsets must align with UTF-8 code-point boundaries |
|
|
33
|
-
| `FileWriteInputSchema` / `FileWriteOutputSchema` | schema | create-only by default or explicit atomic replacement; symlink targets fail closed |
|
|
34
|
-
| `createShellInputSchema` / `ShellOutputSchema` | schema | enumerated executable alias plus arguments and concrete relative cwd; explicit exited/timeout/output-limit/cancelled outcome |
|
|
35
31
|
|
|
36
|
-
File/search operations pin directory descriptors across authorization and the actual effect;
|
|
32
|
+
File/search operations select a root descriptor before both policy callback kinds and pin directory descriptors across authorization and the actual effect;
|
|
37
33
|
resource discovery uses the same ancestor-safe traversal. This closes parent rename/symlink races
|
|
38
|
-
without claiming an executable sandbox. The
|
|
34
|
+
without claiming an executable sandbox. The ordinary command launcher passes a pinned cwd to its
|
|
35
|
+
isolated guard (inherited fd 4); a custom sandbox launcher owns atomic capture of its pathname cwd. List/glob/search report coverage; canonical spelling work consumes the same budget. List raw entries
|
|
36
|
+
are capped by maxListEntries and maxSearchEntries, and glob patterns by 4,096 UTF-16 units.
|
|
37
|
+
The default ceilings are 4,096 path bytes, 256 KiB read/write/output, 128 shell arguments, 64 KiB
|
|
39
38
|
of aggregate argument text, 4 MiB per artifact and 30 seconds. The root is a path-resolution
|
|
40
39
|
boundary, not an OS sandbox; executable behavior, process
|
|
41
40
|
isolation, credentials and external-effect idempotency remain host responsibilities.
|
|
42
41
|
|
|
43
42
|
When `authorizePath` denies a path, direct read/write/edit returns `FORBIDDEN`, while
|
|
44
43
|
`list_directory`, `glob` and `search_files` omit it. Denial is recursive: direct access and
|
|
45
|
-
discovery base paths
|
|
46
|
-
|
|
44
|
+
discovery base paths check every named ancestor, outermost first and segment-wise; `.` is
|
|
45
|
+
checked only when the requested base itself is `.`, so subtree allowlists remain usable. Thus
|
|
46
|
+
denying `credentials` denies `credentials/token.txt` but not `credentials-backup`. Directory
|
|
47
47
|
admission happens before descent and file admission before opening; `search_files.include` is also
|
|
48
48
|
applied before content is read. Requested paths must use `/` — a backslash is refused, because the
|
|
49
49
|
containment walk reads it as a separator while a callback would read it as one name.
|
package/llms/agent-runtime.2.txt
CHANGED
|
@@ -14,6 +14,23 @@ Parts of this slice:
|
|
|
14
14
|
# Guide: Agent application runtime (docs/guide/agent-runtime.md) (continued)
|
|
15
15
|
==============================================================================
|
|
16
16
|
|
|
17
|
+
## Durable order
|
|
18
|
+
|
|
19
|
+
`acceptInputAndAssignRun` is one atomic operation. It is followed by ownership
|
|
20
|
+
acquisition, revision-checked assistant checkpoints and one terminal CAS. The
|
|
21
|
+
process-local coordinator releases its lane only after terminal commit.
|
|
22
|
+
|
|
23
|
+
A queued admission is durable immediately, even if its predecessor is still awaiting ownership
|
|
24
|
+
or its first checkpoint. Snapshots expose causal turn order rather than physical append order:
|
|
25
|
+
the predecessor's assigned input(s) and assistant come before the successor input(s). Execution
|
|
26
|
+
uses the same run boundary, so neither `prompt({ snapshot })` nor default/custom history
|
|
27
|
+
projection can see inputs assigned to a later run. `inject` remains the explicit path that moves
|
|
28
|
+
a successor input into the run already in flight.
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
input + queued run → running → execution settled → terminal CAS → successor
|
|
32
|
+
```
|
|
33
|
+
|
|
17
34
|
## What happens to a run when new input arrives
|
|
18
35
|
|
|
19
36
|
`runs.inputPolicy` decides. It takes five values, or a function returning one:
|
|
@@ -465,6 +482,19 @@ or it keeps the failed attempt's partial text on screen.
|
|
|
465
482
|
start and output on completion. A mounted typed failure carries the same safe
|
|
466
483
|
`{ error, retryable, details?, _hint? }` envelope as the durable result; an unknown
|
|
467
484
|
internal cause remains generic and stays in local observability only;
|
|
485
|
+
- `tool-progress` is transient: what a running tool handler reported through
|
|
486
|
+
`ctx.reportProgress` — `message`, `progress` and `total`, the fields an MCP host
|
|
487
|
+
receives — with the call's `callId` and `toolName`. It never enters the
|
|
488
|
+
model's input or the durable history. A message longer than
|
|
489
|
+
`AGENT_TOOL_PROGRESS_MESSAGE_MAX` (280) is cut, reports of one call closer
|
|
490
|
+
than 250 ms apart are dropped, and a report after the call's terminal
|
|
491
|
+
`tool-status` or after its attempt was abandoned is dropped; the terminal
|
|
492
|
+
status carries the final word. `reduceAgentControlEvent` keeps the last
|
|
493
|
+
report of each running call in `transientByRun[runId].tools[callId]` and
|
|
494
|
+
removes it on that call's `completed`, `failed` or `interrupted`. The runtime
|
|
495
|
+
hands its reporter to a call through the SDK tool context, beside its step
|
|
496
|
+
ledger; a tool that declares its own `contextSchema` keeps that contract and
|
|
497
|
+
reports nowhere;
|
|
468
498
|
- `terminal` follows the winning terminal CAS.
|
|
469
499
|
|
|
470
500
|
`loop.checkpointEveryEvents` batches ordinary stream parts (default `20`) and
|
|
@@ -770,111 +800,3 @@ Deciding *when* to compact is yours: `AgentRuntimeRunContext.contextUsage`
|
|
|
770
800
|
carries the last step's prompt size beside the model's window, and dividing them
|
|
771
801
|
is one line where the threshold is decided. The core does not own that ratio, on
|
|
772
802
|
purpose — see ADR 0142 for what it publishes and what it declines to.
|
|
773
|
-
|
|
774
|
-
## Observability
|
|
775
|
-
|
|
776
|
-
`createAgentObservability` emits a separate operator-only `AgentRunEvent`. It
|
|
777
|
-
reuses the same bounded sink lifecycle as request/tool observability without
|
|
778
|
-
sending new event kinds to existing request sinks. Product events omit provider
|
|
779
|
-
causes. Operator `internalCause` is also redacted by default; an operator-only sink must explicitly
|
|
780
|
-
set `includeInternalCause` and own its retention policy.
|
|
781
|
-
|
|
782
|
-
### What a run says it spent
|
|
783
|
-
|
|
784
|
-
Usage values carry `provider-reported`, `computed`, `estimated` or `unavailable`
|
|
785
|
-
provenance, **per field**. Cost additionally carries an ISO currency code;
|
|
786
|
-
OpenRouter-reported cost is normalized as USD.
|
|
787
|
-
|
|
788
|
-
Read the provenance before the number (→ ADR 0109):
|
|
789
|
-
|
|
790
|
-
- **`provider-reported`** — the provider handed us exactly this. On
|
|
791
|
-
`step-finished`, that is what a step's figures are.
|
|
792
|
-
- **`computed`** — a total, added up over steps. **Every figure on a terminal
|
|
793
|
-
event is this**, tokens included: the AI SDK's `totalUsage` is a sum it
|
|
794
|
-
performed, not a number a provider reported for the run. It is not a figure to
|
|
795
|
-
bill against unchanged.
|
|
796
|
-
- **`unavailable`** — nobody reported it. Not zero.
|
|
797
|
-
|
|
798
|
-
Two rules follow from that last one, and they differ by field on purpose:
|
|
799
|
-
|
|
800
|
-
- **A token total with an unreported step is a floor**, labelled `computed`. A
|
|
801
|
-
token count is a diagnostic, and a floor is a useful one.
|
|
802
|
-
- **A cost with an unreported step is `unavailable`, not a floor.** Money is what
|
|
803
|
-
people bill against, and "at least $1.00" reported as `$1.00` is the same class
|
|
804
|
-
of lie this whole section exists to remove. One step that did not report its
|
|
805
|
-
cost makes the run's cost unknown — not smaller. It also stays unknown: later
|
|
806
|
-
steps reporting normally cannot revive it.
|
|
807
|
-
|
|
808
|
-
**A terminal event always carries `usage`.** A run that ended before the provider
|
|
809
|
-
reported anything — superseded, interrupted, timed out, shut down, failed —
|
|
810
|
-
carries every field `unavailable`. That is deliberately different from a run that
|
|
811
|
-
spent nothing, and an omitted object could not tell you which one you had.
|
|
812
|
-
|
|
813
|
-
Two costs in different currencies do not add: the sum reports `unavailable`
|
|
814
|
-
rather than picking a label. The core records a currency and never converts one.
|
|
815
|
-
|
|
816
|
-
`step-finished.response` identifies the provider response for that one step. The terminal event
|
|
817
|
-
does not copy the last response: response identity remains per-step, while every terminal usage
|
|
818
|
-
figure remains a `computed` aggregate.
|
|
819
|
-
|
|
820
|
-
**A run's figure is durable, and that is where to read it when a channel loses
|
|
821
|
-
it.** `AgentRun.usage` is written at every checkpoint and again with the terminal
|
|
822
|
-
record, so a crashed process leaves behind what it had already spent and a
|
|
823
|
-
dropped event is not a lost number:
|
|
824
|
-
|
|
825
|
-
```ts
|
|
826
|
-
const snapshot = await store.loadSnapshot(conversationId)
|
|
827
|
-
const spent = snapshot.runs.find((run) => run.id === runId)?.usage
|
|
828
|
-
```
|
|
829
|
-
|
|
830
|
-
Two gaps are open and are stated rather than left to be discovered:
|
|
831
|
-
|
|
832
|
-
- **Both event sinks are bounded and drop under load**, by arrival order — the
|
|
833
|
-
event carrying the money is exactly as droppable as the one carrying nothing.
|
|
834
|
-
The run record is the recovery, and this paragraph is the only place that says
|
|
835
|
-
so.
|
|
836
|
-
- **`AgentRuntimeResult.metrics` is `undefined` when this executor did not win
|
|
837
|
-
the terminal race.** Read `result.run.usage` — the durable figure — rather than
|
|
838
|
-
`result.metrics`, which is the channel that can go missing.
|
|
839
|
-
- **Compaction spend is invisible unless you report it.** `config.history.compact`
|
|
840
|
-
calls a model inside the turn and produces no step and no event of its own.
|
|
841
|
-
Return `usage` from `AgentCompactionResult` and it joins the run's figure;
|
|
842
|
-
omit it and the run under-reports by whatever summarising cost.
|
|
843
|
-
|
|
844
|
-
What stitchkit does **not** keep is a ledger: one figure, on the run that
|
|
845
|
-
produced it, never aggregated and never reconciled against a provider invoice
|
|
846
|
-
(→ ADR 0110).
|
|
847
|
-
|
|
848
|
-
### Reconciling with the provider's own accounting
|
|
849
|
-
|
|
850
|
-
Whether a provider bills for a call that was aborted mid-flight cannot be known
|
|
851
|
-
inside the process: the authoritative number arrives later, from the provider's
|
|
852
|
-
accounting. **stitchkit does not accept it back** (→ ADR 0110) — a terminal run
|
|
853
|
-
is an absorbing state, and a write that reached it through the conversation
|
|
854
|
-
aggregate could conflict a concurrent compaction into discarding a summary it had
|
|
855
|
-
just paid a model to produce.
|
|
856
|
-
|
|
857
|
-
The join is yours, and `runId` is the key:
|
|
858
|
-
|
|
859
|
-
```ts
|
|
860
|
-
// when the run terminates — write what the runtime observed
|
|
861
|
-
await ledger.record({
|
|
862
|
-
runId: terminal.run.id,
|
|
863
|
-
conversationId: terminal.run.conversationId,
|
|
864
|
-
// The durable figure, not `terminal.metrics` — that one is absent whenever
|
|
865
|
-
// this executor did not win the terminal race.
|
|
866
|
-
costUsd: terminal.run.usage?.cost?.value ?? null, // null when `unavailable`
|
|
867
|
-
provenance: terminal.run.usage?.cost?.provenance ?? 'unavailable',
|
|
868
|
-
})
|
|
869
|
-
|
|
870
|
-
// later — the provider's accounting names the same generation
|
|
871
|
-
await ledger.reconcile({ runId, costUsd: billed, provenance: 'provider-reported' })
|
|
872
|
-
```
|
|
873
|
-
|
|
874
|
-
Record the row even when the figure is `unavailable`: that row is the evidence
|
|
875
|
-
that a run happened and cost something nobody has counted yet, and it is what the
|
|
876
|
-
provider's later figure attaches to. A run with no row is a run you cannot
|
|
877
|
-
reconcile.
|
|
878
|
-
|
|
879
|
-
The sink deduplicates stable event IDs by default. Cross-crash exactly-once still requires a durable
|
|
880
|
-
outbox.
|
package/llms/agent-runtime.3.txt
CHANGED
|
@@ -14,6 +14,114 @@ Parts of this slice:
|
|
|
14
14
|
# Guide: Agent application runtime (docs/guide/agent-runtime.md) (continued)
|
|
15
15
|
==============================================================================
|
|
16
16
|
|
|
17
|
+
## Observability
|
|
18
|
+
|
|
19
|
+
`createAgentObservability` emits a separate operator-only `AgentRunEvent`. It
|
|
20
|
+
reuses the same bounded sink lifecycle as request/tool observability without
|
|
21
|
+
sending new event kinds to existing request sinks. Product events omit provider
|
|
22
|
+
causes. Operator `internalCause` is also redacted by default; an operator-only sink must explicitly
|
|
23
|
+
set `includeInternalCause` and own its retention policy.
|
|
24
|
+
|
|
25
|
+
### What a run says it spent
|
|
26
|
+
|
|
27
|
+
Usage values carry `provider-reported`, `computed`, `estimated` or `unavailable`
|
|
28
|
+
provenance, **per field**. Cost additionally carries an ISO currency code;
|
|
29
|
+
OpenRouter-reported cost is normalized as USD.
|
|
30
|
+
|
|
31
|
+
Read the provenance before the number (→ ADR 0109):
|
|
32
|
+
|
|
33
|
+
- **`provider-reported`** — the provider handed us exactly this. On
|
|
34
|
+
`step-finished`, that is what a step's figures are.
|
|
35
|
+
- **`computed`** — a total, added up over steps. **Every figure on a terminal
|
|
36
|
+
event is this**, tokens included: the AI SDK's `totalUsage` is a sum it
|
|
37
|
+
performed, not a number a provider reported for the run. It is not a figure to
|
|
38
|
+
bill against unchanged.
|
|
39
|
+
- **`unavailable`** — nobody reported it. Not zero.
|
|
40
|
+
|
|
41
|
+
Two rules follow from that last one, and they differ by field on purpose:
|
|
42
|
+
|
|
43
|
+
- **A token total with an unreported step is a floor**, labelled `computed`. A
|
|
44
|
+
token count is a diagnostic, and a floor is a useful one.
|
|
45
|
+
- **A cost with an unreported step is `unavailable`, not a floor.** Money is what
|
|
46
|
+
people bill against, and "at least $1.00" reported as `$1.00` is the same class
|
|
47
|
+
of lie this whole section exists to remove. One step that did not report its
|
|
48
|
+
cost makes the run's cost unknown — not smaller. It also stays unknown: later
|
|
49
|
+
steps reporting normally cannot revive it.
|
|
50
|
+
|
|
51
|
+
**A terminal event always carries `usage`.** A run that ended before the provider
|
|
52
|
+
reported anything — superseded, interrupted, timed out, shut down, failed —
|
|
53
|
+
carries every field `unavailable`. That is deliberately different from a run that
|
|
54
|
+
spent nothing, and an omitted object could not tell you which one you had.
|
|
55
|
+
|
|
56
|
+
Two costs in different currencies do not add: the sum reports `unavailable`
|
|
57
|
+
rather than picking a label. The core records a currency and never converts one.
|
|
58
|
+
|
|
59
|
+
`step-finished.response` identifies the provider response for that one step. The terminal event
|
|
60
|
+
does not copy the last response: response identity remains per-step, while every terminal usage
|
|
61
|
+
figure remains a `computed` aggregate.
|
|
62
|
+
|
|
63
|
+
**A run's figure is durable, and that is where to read it when a channel loses
|
|
64
|
+
it.** `AgentRun.usage` is written at every checkpoint and again with the terminal
|
|
65
|
+
record, so a crashed process leaves behind what it had already spent and a
|
|
66
|
+
dropped event is not a lost number:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
const snapshot = await store.loadSnapshot(conversationId)
|
|
70
|
+
const spent = snapshot.runs.find((run) => run.id === runId)?.usage
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Two gaps are open and are stated rather than left to be discovered:
|
|
74
|
+
|
|
75
|
+
- **Both event sinks are bounded and drop under load**, by arrival order — the
|
|
76
|
+
event carrying the money is exactly as droppable as the one carrying nothing.
|
|
77
|
+
The run record is the recovery, and this paragraph is the only place that says
|
|
78
|
+
so.
|
|
79
|
+
- **`AgentRuntimeResult.metrics` is `undefined` when this executor did not win
|
|
80
|
+
the terminal race.** Read `result.run.usage` — the durable figure — rather than
|
|
81
|
+
`result.metrics`, which is the channel that can go missing.
|
|
82
|
+
- **Compaction spend is invisible unless you report it.** `config.history.compact`
|
|
83
|
+
calls a model inside the turn and produces no step and no event of its own.
|
|
84
|
+
Return `usage` from `AgentCompactionResult` and it joins the run's figure;
|
|
85
|
+
omit it and the run under-reports by whatever summarising cost.
|
|
86
|
+
|
|
87
|
+
What stitchkit does **not** keep is a ledger: one figure, on the run that
|
|
88
|
+
produced it, never aggregated and never reconciled against a provider invoice
|
|
89
|
+
(→ ADR 0110).
|
|
90
|
+
|
|
91
|
+
### Reconciling with the provider's own accounting
|
|
92
|
+
|
|
93
|
+
Whether a provider bills for a call that was aborted mid-flight cannot be known
|
|
94
|
+
inside the process: the authoritative number arrives later, from the provider's
|
|
95
|
+
accounting. **stitchkit does not accept it back** (→ ADR 0110) — a terminal run
|
|
96
|
+
is an absorbing state, and a write that reached it through the conversation
|
|
97
|
+
aggregate could conflict a concurrent compaction into discarding a summary it had
|
|
98
|
+
just paid a model to produce.
|
|
99
|
+
|
|
100
|
+
The join is yours, and `runId` is the key:
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
// when the run terminates — write what the runtime observed
|
|
104
|
+
await ledger.record({
|
|
105
|
+
runId: terminal.run.id,
|
|
106
|
+
conversationId: terminal.run.conversationId,
|
|
107
|
+
// The durable figure, not `terminal.metrics` — that one is absent whenever
|
|
108
|
+
// this executor did not win the terminal race.
|
|
109
|
+
costUsd: terminal.run.usage?.cost?.value ?? null, // null when `unavailable`
|
|
110
|
+
provenance: terminal.run.usage?.cost?.provenance ?? 'unavailable',
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
// later — the provider's accounting names the same generation
|
|
114
|
+
await ledger.reconcile({ runId, costUsd: billed, provenance: 'provider-reported' })
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Record the row even when the figure is `unavailable`: that row is the evidence
|
|
118
|
+
that a run happened and cost something nobody has counted yet, and it is what the
|
|
119
|
+
provider's later figure attaches to. A run with no row is a run you cannot
|
|
120
|
+
reconcile.
|
|
121
|
+
|
|
122
|
+
The sink deduplicates stable event IDs by default. Cross-crash exactly-once still requires a durable
|
|
123
|
+
outbox.
|
|
124
|
+
|
|
17
125
|
## Deterministic race and adapter proof
|
|
18
126
|
|
|
19
127
|
`stitchkit/agent-runtime/testing` exports `createAgentRaceBarrier`, `createAgentRaceDriver`,
|
|
@@ -391,7 +499,9 @@ Delivery exports are `AgentAdmissionEventSchema`, `AgentAttemptResetEventSchema`
|
|
|
391
499
|
`AgentRunStateEventSchema`, `AgentRunOperationEventSchema`, `AgentTerminalEventSchema`,
|
|
392
500
|
`AgentTransientDeltaEventSchema`,
|
|
393
501
|
`AgentReasoningStartEventSchema`, `AgentReasoningDeltaEventSchema`,
|
|
394
|
-
`AgentReasoningEndEventSchema`, `AgentToolStatusEventSchema`, `
|
|
502
|
+
`AgentReasoningEndEventSchema`, `AgentToolStatusEventSchema`, `AgentToolProgressEventSchema` (what a
|
|
503
|
+
running tool reported through `ctx.reportProgress`, transient and never part of the model's input),
|
|
504
|
+
`AgentRuntimeEvent`,
|
|
395
505
|
`AgentRuntimeEventCursor`, `AgentRuntimeEventCursorSchema`, `AgentRuntimeCursorAdvance`,
|
|
396
506
|
`advanceAgentRuntimeEventCursor`, `agentDurableEventId`, `AgentRuntimeEventSink`,
|
|
397
507
|
`AgentRuntimeEventSinkConfig` and `createAgentRuntimeEventSink`. Cursor gaps require a canonical
|