stitchkit 0.121.0 → 0.122.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -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/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/tool-progress.d.ts +21 -0
- package/dist/agent-runtime/tool-progress.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/browser.js +7 -3
- package/dist/entrypoints/agent-runtime/harness.js +5 -5
- package/dist/entrypoints/agent-runtime/realtime.js +5 -5
- 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 +6 -4
- package/dist/entrypoints/cli.js +2 -1
- package/dist/entrypoints/server.d.ts +1 -0
- package/dist/entrypoints/server.d.ts.map +1 -1
- package/dist/entrypoints/server.js +107 -42
- package/dist/entrypoints/tools/agent.js +1 -1
- package/dist/entrypoints/tools/connections.js +7 -1
- package/dist/entrypoints/tools/mcp.js +2 -1
- package/dist/entrypoints/tools/toolkit.js +4 -3
- package/dist/{index-7zwtbak8.js → index-1fyea34p.js} +9 -4
- package/dist/index-332d0m9g.js +37 -0
- package/dist/{index-4qnzda76.js → index-7qyv50r4.js} +1 -1
- package/dist/{index-qctbzmg9.js → index-am1h8c9v.js} +69 -27
- package/dist/{index-0fra8xvy.js → index-aswegq1r.js} +18 -6
- package/dist/{index-yt7gyg5x.js → index-b51tzcgh.js} +1 -1
- package/dist/{index-aw6zahv1.js → index-dqpesdck.js} +2 -2
- package/dist/{index-sb9dr3tq.js → index-eh71zr32.js} +4 -4
- package/dist/{index-mnkk1ffz.js → index-hs76yzt7.js} +13 -1
- package/dist/{index-b0w7rbpt.js → index-t05a2ry4.js} +39 -3
- package/dist/{index-knmnj11j.js → index-y6ye582c.js} +7 -5
- 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/run-managed.d.ts.map +1 -1
- package/dist/tools/cli/run-native.d.ts.map +1 -1
- package/dist/tools/connections/mcp.d.ts.map +1 -1
- package/dist/tools/mcp/catalog.d.ts.map +1 -1
- package/dist/tools/mcp/mount.d.ts.map +1 -1
- package/dist/tools/mcp/register.d.ts +1 -2
- package/dist/tools/mcp/register.d.ts.map +1 -1
- package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
- package/dist/tools/read-operation.d.ts +21 -0
- package/dist/tools/read-operation.d.ts.map +1 -0
- 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.2.txt +13 -108
- package/llms/agent-runtime.3.txt +111 -1
- package/llms/cli.txt +30 -9
- package/llms/server.2.txt +48 -0
- package/llms/server.5.txt +2 -0
- package/llms/stitchkit.txt +3 -3
- package/llms/tools.2.txt +109 -0
- package/llms/tools.txt +34 -110
- package/llms/{upgrading-0.106.0-0.121.0.txt → upgrading-0.106.0-0.122.0.txt} +31 -3
- package/llms/upgrading.txt +1 -1
- package/llms-full.txt +165 -15
- package/llms.txt +6 -6
- package/package.json +2 -1
- package/dist/tools/durability-context.d.ts +0 -7
- package/dist/tools/durability-context.d.ts.map +0 -1
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./index-8kzct1d6.js";
|
|
5
5
|
import {
|
|
6
6
|
AgentRuntimeEventSchema2
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-hs76yzt7.js";
|
|
8
8
|
|
|
9
9
|
// src/agent-runtime/control-schema.ts
|
|
10
10
|
import { z } from "zod";
|
|
@@ -154,6 +154,43 @@ function advanceAgentMultiSessionCursor2(raw, event) {
|
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
|
+
var EMPTY_TRANSIENT = { text: "", reasoning: "", tools: {} };
|
|
158
|
+
function nextRunTransient(transient, event) {
|
|
159
|
+
switch (event.type) {
|
|
160
|
+
case "assistant-delta":
|
|
161
|
+
return { ...transient, text: transient.text + event.textDelta };
|
|
162
|
+
case "reasoning-delta":
|
|
163
|
+
return { ...transient, reasoning: transient.reasoning + event.textDelta };
|
|
164
|
+
case "attempt-reset":
|
|
165
|
+
return EMPTY_TRANSIENT;
|
|
166
|
+
case "tool-progress": {
|
|
167
|
+
const { toolName, message, progress, total } = event;
|
|
168
|
+
return {
|
|
169
|
+
...transient,
|
|
170
|
+
tools: {
|
|
171
|
+
...transient.tools,
|
|
172
|
+
[event.callId]: {
|
|
173
|
+
toolName,
|
|
174
|
+
...message !== undefined && { message },
|
|
175
|
+
...progress !== undefined && { progress },
|
|
176
|
+
...total !== undefined && { total }
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
case "tool-status": {
|
|
182
|
+
if (event.status === "started" || !Object.hasOwn(transient.tools, event.callId)) {
|
|
183
|
+
return transient;
|
|
184
|
+
}
|
|
185
|
+
return {
|
|
186
|
+
...transient,
|
|
187
|
+
tools: Object.fromEntries(Object.entries(transient.tools).filter(([callId]) => callId !== event.callId))
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
default:
|
|
191
|
+
return transient;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
157
194
|
function createAgentControlView2() {
|
|
158
195
|
return { cursor: { conversations: {} }, conversations: {} };
|
|
159
196
|
}
|
|
@@ -199,8 +236,7 @@ function reduceAgentControlEvent2(view, rawEvent) {
|
|
|
199
236
|
}
|
|
200
237
|
};
|
|
201
238
|
}
|
|
202
|
-
const
|
|
203
|
-
const nextTransient = event.type === "assistant-delta" ? { ...transient, text: transient.text + event.textDelta } : event.type === "reasoning-delta" ? { ...transient, reasoning: transient.reasoning + event.textDelta } : event.type === "attempt-reset" ? { text: "", reasoning: "" } : transient;
|
|
239
|
+
const nextTransient = nextRunTransient(current.transientByRun[event.runId] ?? EMPTY_TRANSIENT, event);
|
|
204
240
|
const snapshotStale = durable(event) && current.snapshot?.version !== event.snapshotVersion;
|
|
205
241
|
const transientByRun = event.type === "terminal" ? Object.fromEntries(Object.entries(current.transientByRun).filter(([runId]) => runId !== event.runId)) : { ...current.transientByRun, [event.runId]: nextTransient };
|
|
206
242
|
return {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
toJsonSchema
|
|
3
3
|
} from "./index-ct75c3at.js";
|
|
4
|
+
import {
|
|
5
|
+
publishedToolAnnotations
|
|
6
|
+
} from "./index-332d0m9g.js";
|
|
4
7
|
import {
|
|
5
8
|
toolSurfaceOutputSchema,
|
|
6
9
|
staticInputRounds,
|
|
@@ -86,7 +89,7 @@ function toolFingerprint(descriptor) {
|
|
|
86
89
|
description: mountable.method.desc,
|
|
87
90
|
input: descriptor.inputSchema,
|
|
88
91
|
output: descriptor.outputSchema ? toJsonSchema(descriptor.outputSchema, "output", "any") : null,
|
|
89
|
-
annotations: mountable.method
|
|
92
|
+
annotations: publishedToolAnnotations(mountable.method) ?? null
|
|
90
93
|
};
|
|
91
94
|
}
|
|
92
95
|
function mcpCatalogStamp(surface) {
|
|
@@ -556,8 +559,9 @@ function registerMcpTool(server, presentation, descriptor, config) {
|
|
|
556
559
|
};
|
|
557
560
|
if (descriptor.outputSchema)
|
|
558
561
|
toolConfig.outputSchema = descriptor.outputSchema;
|
|
559
|
-
|
|
560
|
-
|
|
562
|
+
const annotations = publishedToolAnnotations(mountable.method);
|
|
563
|
+
if (annotations)
|
|
564
|
+
toolConfig.annotations = annotations;
|
|
561
565
|
if (presentation.ui) {
|
|
562
566
|
toolConfig._meta = {
|
|
563
567
|
ui: presentation.ui,
|
|
@@ -665,7 +669,6 @@ function mountPreparedRuntimeMcp(server, tools, config) {
|
|
|
665
669
|
registerMcpTool(server, {
|
|
666
670
|
name: definition.name,
|
|
667
671
|
description: definition.description,
|
|
668
|
-
annotations: definition.annotations,
|
|
669
672
|
ui: definition.ui,
|
|
670
673
|
...present && { present }
|
|
671
674
|
}, descriptor, {
|
|
@@ -716,7 +719,6 @@ function mountPreparedMcp(mcpServer, prepared, config = {}) {
|
|
|
716
719
|
registerMcpTool(mcpServer, {
|
|
717
720
|
name,
|
|
718
721
|
description: method.desc,
|
|
719
|
-
annotations: method.annotations,
|
|
720
722
|
ui: method.ui
|
|
721
723
|
}, descriptor, {
|
|
722
724
|
runTool,
|
|
@@ -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":["../../src/server/openapi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAG3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE/D,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,WAAW,CAAC;IAClB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;IACxB,iFAAiF;IACjF,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,UAAU,EAAE,CAAA;KAAE,CAAC,CAAC;IAChE,oCAAoC;IACpC,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;IAC1B;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC,KAAK,OAAO,CAAC;IACzD;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/C,UAAU,CAAC,EAAE;QAAE,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAA;KAAE,CAAC;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,M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): 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,CAA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,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"}
|
|
@@ -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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/tools/connections/mcp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/tools/connections/mcp.ts"],"names":[],"mappings":"AAIA,OAAO,EAAqB,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAIhF,OAAO,EACL,KAAK,0BAA0B,EAIhC,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,mBAAmB,EAAiB,MAAM,SAAS,CAAC;AAUlE,gEAAgE;AAChE,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,mBAAmB,EAC/B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,0BAA0B,GACpC,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAyElC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/tools/mcp/catalog.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/tools/mcp/catalog.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,wBAAwB,EAAmB,MAAM,WAAW,CAAC;AAE3E;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,sBAAsB,CAAC;AAExD;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAyBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,wBAAwB,GAAG,eAAe,CAclF;AAED,6DAA6D;AAC7D,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE9E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAQzE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,SAAS;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,EACvF,MAAM,EAAE,OAAO,EACf,KAAK,EAAE,eAAe,GAAG,SAAS,GACjC,OAAO,CAGT;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,OAAO,SAAS;IAAE,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qBAAqB,CAAC,KAAK,CAAC,GAC9B,CAAC,sBAAsB,CAAC,KAAK,CAAC,GAAG,sBAAsB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;AAE7E;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,oBAAoB,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;AACnF,wBAAgB,cAAc,CAAC,KAAK,EAClC,MAAM,EAAE,oBAAoB,CAAC,KAAK,CAAC,EACnC,IAAI,EAAE,KAAK,GACV,SAAS,CAAC;AAwCb,iFAAiF;AACjF,wBAAgB,0BAA0B,CAAC,KAAK,EAC9C,MAAM,EAAE,oBAAoB,CAAC,KAAK,CAAC,EACnC,IAAI,EAAE,KAAK,EACX,QAAQ,EAAE,wBAAwB,GACjC,SAAS,CAqEX;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,GAAG,IAAI,CAmBlF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CallToolResult, type McpServer } from '@modelcontextprotocol/server';
|
|
2
|
-
import type {
|
|
2
|
+
import type { EndpointUiMeta } from '../../contract/tool-options.js';
|
|
3
3
|
import type { ToolExecutionOptions } from '../execute.js';
|
|
4
4
|
import type { ToolCallHooks } from '../execute-hooks.js';
|
|
5
5
|
import { type ToolResult } from '../execute-result.js';
|
|
@@ -11,7 +11,6 @@ import { type McpRoundRuntime } from './round.js';
|
|
|
11
11
|
export interface McpToolPresentation {
|
|
12
12
|
name: string;
|
|
13
13
|
description: string;
|
|
14
|
-
annotations?: EndpointToolAnnotations;
|
|
15
14
|
ui?: EndpointUiMeta;
|
|
16
15
|
/** A runtime tool's own MCP answer, built from its validated output. */
|
|
17
16
|
present?(data: unknown): unknown | Promise<unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/tools/mcp/register.ts"],"names":[],"mappings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B,CAAC,EAAE,eAAe,CAAC;IACpC,8EAA8E;IAC9E,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,YAAY,EAAE,CACZ,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,sBAAsB,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,EACxD,QAAQ,EAAE,MAAM,KACb,cAAc,CAAC;CACrB;AAaD;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,SAAS,sBAAsB,EAAE,EACxC,MAAM,EAAE,sBAAsB,GAC7B,IAAI,CAiCN"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { EndpointToolAnnotations } from '../contract/tool-options.js';
|
|
2
|
+
import type { OperationIdentity } from '../server/types.js';
|
|
3
|
+
type Operation = Pick<OperationIdentity, 'method' | 'annotations'>;
|
|
4
|
+
/**
|
|
5
|
+
* Whether calling the operation again returns its answer without a new effect.
|
|
6
|
+
*
|
|
7
|
+
* The declared `readOnlyHint` decides in either direction. Without one, `GET`
|
|
8
|
+
* is the contract's own statement that the endpoint reads — unless it declares
|
|
9
|
+
* `destructiveHint: true`, which says the opposite in the same breath.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isRepeatableRead(operation: Operation): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The annotations a tool surface publishes for the operation: the declared
|
|
14
|
+
* ones, with `readOnlyHint: true` stated for a read that declared none. A
|
|
15
|
+
* declared `readOnlyHint`, either way, is published as written.
|
|
16
|
+
*/
|
|
17
|
+
export declare function publishedToolAnnotations(operation: Operation): EndpointToolAnnotations | undefined;
|
|
18
|
+
/** The hints another MCP server published for one of its tools, or `undefined` when it gave none. */
|
|
19
|
+
export declare function readDiscoveredToolAnnotations(raw: unknown): EndpointToolAnnotations | undefined;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=read-operation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-operation.d.ts","sourceRoot":"","sources":["../../src/tools/read-operation.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,KAAK,SAAS,GAAG,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,aAAa,CAAC,CAAC;AAEnE;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAI9D;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,SAAS,GACnB,uBAAuB,GAAG,SAAS,CAIrC;AAeD,qGAAqG;AACrG,wBAAgB,6BAA6B,CAC3C,GAAG,EAAE,OAAO,GACX,uBAAuB,GAAG,SAAS,CAYrC"}
|
|
@@ -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
|
package/llms/agent-runtime.2.txt
CHANGED
|
@@ -482,6 +482,19 @@ or it keeps the failed attempt's partial text on screen.
|
|
|
482
482
|
start and output on completion. A mounted typed failure carries the same safe
|
|
483
483
|
`{ error, retryable, details?, _hint? }` envelope as the durable result; an unknown
|
|
484
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;
|
|
485
498
|
- `terminal` follows the winning terminal CAS.
|
|
486
499
|
|
|
487
500
|
`loop.checkpointEveryEvents` batches ordinary stream parts (default `20`) and
|
|
@@ -787,111 +800,3 @@ Deciding *when* to compact is yours: `AgentRuntimeRunContext.contextUsage`
|
|
|
787
800
|
carries the last step's prompt size beside the model's window, and dividing them
|
|
788
801
|
is one line where the threshold is decided. The core does not own that ratio, on
|
|
789
802
|
purpose — see ADR 0142 for what it publishes and what it declines to.
|
|
790
|
-
|
|
791
|
-
## Observability
|
|
792
|
-
|
|
793
|
-
`createAgentObservability` emits a separate operator-only `AgentRunEvent`. It
|
|
794
|
-
reuses the same bounded sink lifecycle as request/tool observability without
|
|
795
|
-
sending new event kinds to existing request sinks. Product events omit provider
|
|
796
|
-
causes. Operator `internalCause` is also redacted by default; an operator-only sink must explicitly
|
|
797
|
-
set `includeInternalCause` and own its retention policy.
|
|
798
|
-
|
|
799
|
-
### What a run says it spent
|
|
800
|
-
|
|
801
|
-
Usage values carry `provider-reported`, `computed`, `estimated` or `unavailable`
|
|
802
|
-
provenance, **per field**. Cost additionally carries an ISO currency code;
|
|
803
|
-
OpenRouter-reported cost is normalized as USD.
|
|
804
|
-
|
|
805
|
-
Read the provenance before the number (→ ADR 0109):
|
|
806
|
-
|
|
807
|
-
- **`provider-reported`** — the provider handed us exactly this. On
|
|
808
|
-
`step-finished`, that is what a step's figures are.
|
|
809
|
-
- **`computed`** — a total, added up over steps. **Every figure on a terminal
|
|
810
|
-
event is this**, tokens included: the AI SDK's `totalUsage` is a sum it
|
|
811
|
-
performed, not a number a provider reported for the run. It is not a figure to
|
|
812
|
-
bill against unchanged.
|
|
813
|
-
- **`unavailable`** — nobody reported it. Not zero.
|
|
814
|
-
|
|
815
|
-
Two rules follow from that last one, and they differ by field on purpose:
|
|
816
|
-
|
|
817
|
-
- **A token total with an unreported step is a floor**, labelled `computed`. A
|
|
818
|
-
token count is a diagnostic, and a floor is a useful one.
|
|
819
|
-
- **A cost with an unreported step is `unavailable`, not a floor.** Money is what
|
|
820
|
-
people bill against, and "at least $1.00" reported as `$1.00` is the same class
|
|
821
|
-
of lie this whole section exists to remove. One step that did not report its
|
|
822
|
-
cost makes the run's cost unknown — not smaller. It also stays unknown: later
|
|
823
|
-
steps reporting normally cannot revive it.
|
|
824
|
-
|
|
825
|
-
**A terminal event always carries `usage`.** A run that ended before the provider
|
|
826
|
-
reported anything — superseded, interrupted, timed out, shut down, failed —
|
|
827
|
-
carries every field `unavailable`. That is deliberately different from a run that
|
|
828
|
-
spent nothing, and an omitted object could not tell you which one you had.
|
|
829
|
-
|
|
830
|
-
Two costs in different currencies do not add: the sum reports `unavailable`
|
|
831
|
-
rather than picking a label. The core records a currency and never converts one.
|
|
832
|
-
|
|
833
|
-
`step-finished.response` identifies the provider response for that one step. The terminal event
|
|
834
|
-
does not copy the last response: response identity remains per-step, while every terminal usage
|
|
835
|
-
figure remains a `computed` aggregate.
|
|
836
|
-
|
|
837
|
-
**A run's figure is durable, and that is where to read it when a channel loses
|
|
838
|
-
it.** `AgentRun.usage` is written at every checkpoint and again with the terminal
|
|
839
|
-
record, so a crashed process leaves behind what it had already spent and a
|
|
840
|
-
dropped event is not a lost number:
|
|
841
|
-
|
|
842
|
-
```ts
|
|
843
|
-
const snapshot = await store.loadSnapshot(conversationId)
|
|
844
|
-
const spent = snapshot.runs.find((run) => run.id === runId)?.usage
|
|
845
|
-
```
|
|
846
|
-
|
|
847
|
-
Two gaps are open and are stated rather than left to be discovered:
|
|
848
|
-
|
|
849
|
-
- **Both event sinks are bounded and drop under load**, by arrival order — the
|
|
850
|
-
event carrying the money is exactly as droppable as the one carrying nothing.
|
|
851
|
-
The run record is the recovery, and this paragraph is the only place that says
|
|
852
|
-
so.
|
|
853
|
-
- **`AgentRuntimeResult.metrics` is `undefined` when this executor did not win
|
|
854
|
-
the terminal race.** Read `result.run.usage` — the durable figure — rather than
|
|
855
|
-
`result.metrics`, which is the channel that can go missing.
|
|
856
|
-
- **Compaction spend is invisible unless you report it.** `config.history.compact`
|
|
857
|
-
calls a model inside the turn and produces no step and no event of its own.
|
|
858
|
-
Return `usage` from `AgentCompactionResult` and it joins the run's figure;
|
|
859
|
-
omit it and the run under-reports by whatever summarising cost.
|
|
860
|
-
|
|
861
|
-
What stitchkit does **not** keep is a ledger: one figure, on the run that
|
|
862
|
-
produced it, never aggregated and never reconciled against a provider invoice
|
|
863
|
-
(→ ADR 0110).
|
|
864
|
-
|
|
865
|
-
### Reconciling with the provider's own accounting
|
|
866
|
-
|
|
867
|
-
Whether a provider bills for a call that was aborted mid-flight cannot be known
|
|
868
|
-
inside the process: the authoritative number arrives later, from the provider's
|
|
869
|
-
accounting. **stitchkit does not accept it back** (→ ADR 0110) — a terminal run
|
|
870
|
-
is an absorbing state, and a write that reached it through the conversation
|
|
871
|
-
aggregate could conflict a concurrent compaction into discarding a summary it had
|
|
872
|
-
just paid a model to produce.
|
|
873
|
-
|
|
874
|
-
The join is yours, and `runId` is the key:
|
|
875
|
-
|
|
876
|
-
```ts
|
|
877
|
-
// when the run terminates — write what the runtime observed
|
|
878
|
-
await ledger.record({
|
|
879
|
-
runId: terminal.run.id,
|
|
880
|
-
conversationId: terminal.run.conversationId,
|
|
881
|
-
// The durable figure, not `terminal.metrics` — that one is absent whenever
|
|
882
|
-
// this executor did not win the terminal race.
|
|
883
|
-
costUsd: terminal.run.usage?.cost?.value ?? null, // null when `unavailable`
|
|
884
|
-
provenance: terminal.run.usage?.cost?.provenance ?? 'unavailable',
|
|
885
|
-
})
|
|
886
|
-
|
|
887
|
-
// later — the provider's accounting names the same generation
|
|
888
|
-
await ledger.reconcile({ runId, costUsd: billed, provenance: 'provider-reported' })
|
|
889
|
-
```
|
|
890
|
-
|
|
891
|
-
Record the row even when the figure is `unavailable`: that row is the evidence
|
|
892
|
-
that a run happened and cost something nobody has counted yet, and it is what the
|
|
893
|
-
provider's later figure attaches to. A run with no row is a run you cannot
|
|
894
|
-
reconcile.
|
|
895
|
-
|
|
896
|
-
The sink deduplicates stable event IDs by default. Cross-crash exactly-once still requires a durable
|
|
897
|
-
outbox.
|