stitchkit 0.68.9 → 0.68.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-runtime/deferred-tool-search.d.ts +8 -0
- package/dist/agent-runtime/deferred-tool-search.d.ts.map +1 -0
- package/dist/agent-runtime/deferred-tool-selection.d.ts +15 -0
- package/dist/agent-runtime/deferred-tool-selection.d.ts.map +1 -0
- package/dist/agent-runtime/deferred-tool-types.d.ts +131 -0
- package/dist/agent-runtime/deferred-tool-types.d.ts.map +1 -0
- package/dist/agent-runtime/deferred-tools-internal.d.ts +10 -0
- package/dist/agent-runtime/deferred-tools-internal.d.ts.map +1 -0
- package/dist/agent-runtime/deferred-tools.d.ts +4 -0
- package/dist/agent-runtime/deferred-tools.d.ts.map +1 -0
- package/dist/agent-runtime/run-execution.d.ts.map +1 -1
- package/dist/agent-runtime-openrouter.js +1 -1
- package/dist/agent-runtime.d.ts +1 -0
- package/dist/agent-runtime.d.ts.map +1 -1
- package/dist/agent-runtime.js +471 -73
- package/dist/browser/socket-io.d.ts +8 -2
- package/dist/browser/socket-io.d.ts.map +1 -1
- package/dist/cli.js +7 -8
- package/dist/contract/index.js +2 -2
- package/dist/{index-vkk06pv1.js → index-22by16v6.js} +57 -9
- package/dist/{index-hmfpjnh7.js → index-22tjt2rk.js} +2 -2
- package/dist/{index-1bmpkhj2.js → index-2t6zt5cg.js} +9 -134
- package/dist/{index-557by2db.js → index-7b188kmz.js} +15 -0
- package/dist/index-bt5179zb.js +99 -0
- package/dist/index-eqqyd9v8.js +130 -0
- package/dist/{index-51a19y3v.js → index-f24xg2cw.js} +2 -2
- package/dist/{index-j2nq04z6.js → index-f6n5n7nz.js} +1 -1
- package/dist/{index-9t2tdk1x.js → index-grgvpbch.js} +3 -5
- package/dist/{index-n34x0q5e.js → index-hb0mncmj.js} +3 -3
- package/dist/{index-6tqys26z.js → index-hcx9yypn.js} +4 -4
- package/dist/{index-z575awm9.js → index-hxh98zbm.js} +2 -2
- package/dist/{index-bmmtz6r9.js → index-pgsyp3xh.js} +1 -1
- package/dist/index-qyrqwr4c.js +41 -0
- package/dist/{index-r5s4wqb5.js → index-t23p2b68.js} +1 -1
- package/dist/{index-3ydx9j01.js → index-xyvxez9r.js} +3 -3
- package/dist/{index-04agqrs8.js → index-y2ctppmg.js} +72 -6
- package/dist/index.js +171 -13
- package/dist/internal/typed.d.ts +8 -0
- package/dist/internal/typed.d.ts.map +1 -1
- package/dist/node.js +6 -6
- package/dist/observability/index.js +4 -4
- package/dist/react.js +1 -1
- package/dist/realtime/index.d.ts +1 -1
- package/dist/realtime/index.d.ts.map +1 -1
- package/dist/realtime/request.d.ts +25 -0
- package/dist/realtime/request.d.ts.map +1 -1
- package/dist/remote.js +4 -4
- package/dist/server/index.js +8 -8
- package/dist/testing.js +6 -7
- package/dist/tool-invoker.js +6 -8
- package/dist/tools/internal/surface-projector.d.ts +7 -0
- package/dist/tools/internal/surface-projector.d.ts.map +1 -1
- package/dist/tools.js +34 -115
- package/llms-full.txt +127 -2
- package/package.json +1 -1
- package/dist/index-6djpbnda.js +0 -56
- package/dist/index-88yyydag.js +0 -75
- package/dist/index-smpbdg6k.js +0 -27
- /package/dist/{index-tss6bk5c.js → index-ksp6e2ye.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/realtime/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE/D,MAAM,WAAW,sBAAsB;IACrC,4EAA4E;IAC5E,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,2BAA4B,SAAQ,KAAK;IACpD,QAAQ,CAAC,IAAI,8BAA8B;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,YAAY,KAAK,EAAE,MAAM,EAAE,SAAS,E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
|
createClient
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-
|
|
4
|
+
} from "./index-hb0mncmj.js";
|
|
5
|
+
import"./index-t23p2b68.js";
|
|
6
6
|
import {
|
|
7
7
|
mergeMeta
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-pgsyp3xh.js";
|
|
9
9
|
import {
|
|
10
10
|
isRecord
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-qyrqwr4c.js";
|
|
12
12
|
import {
|
|
13
13
|
AppError
|
|
14
14
|
} from "./index-0w9abg87.js";
|
package/dist/server/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
sseRoute,
|
|
14
14
|
streamingRoute,
|
|
15
15
|
webSocketLane
|
|
16
|
-
} from "../index-
|
|
16
|
+
} from "../index-hcx9yypn.js";
|
|
17
17
|
import {
|
|
18
18
|
composeAuthHooks,
|
|
19
19
|
createAuthHook,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
signJwt,
|
|
27
27
|
verifyJwt,
|
|
28
28
|
verifyPkce
|
|
29
|
-
} from "../index-
|
|
29
|
+
} from "../index-xyvxez9r.js";
|
|
30
30
|
import {
|
|
31
31
|
DEFAULT_CORS_ALLOW_HEADERS,
|
|
32
32
|
DEFAULT_CORS_EXPOSE_HEADERS,
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
defineMultipartStream,
|
|
41
41
|
implement,
|
|
42
42
|
implementRegistry
|
|
43
|
-
} from "../index-
|
|
43
|
+
} from "../index-hxh98zbm.js";
|
|
44
44
|
import {
|
|
45
45
|
extractIp,
|
|
46
46
|
generateTraceId,
|
|
@@ -48,12 +48,12 @@ import {
|
|
|
48
48
|
getTraceId,
|
|
49
49
|
resolveSocketIp,
|
|
50
50
|
resolveTraceId
|
|
51
|
-
} from "../index-
|
|
51
|
+
} from "../index-f24xg2cw.js";
|
|
52
52
|
import {
|
|
53
53
|
isWithinDir,
|
|
54
54
|
realPathWithinDir
|
|
55
55
|
} from "../index-sbdmyz75.js";
|
|
56
|
-
import"../index-
|
|
56
|
+
import"../index-7b188kmz.js";
|
|
57
57
|
import {
|
|
58
58
|
ShutdownOptionsSchema,
|
|
59
59
|
ShutdownResultSchema,
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
inputIsQuery,
|
|
70
70
|
parseSSE,
|
|
71
71
|
streamSSE
|
|
72
|
-
} from "../index-
|
|
72
|
+
} from "../index-t23p2b68.js";
|
|
73
73
|
import {
|
|
74
74
|
DEFAULT_CONTRACT_STREAM_FRAME_BYTES,
|
|
75
75
|
errorCode,
|
|
@@ -78,10 +78,10 @@ import {
|
|
|
78
78
|
normalizeError,
|
|
79
79
|
parseTrailingWildcard,
|
|
80
80
|
zodIssues
|
|
81
|
-
} from "../index-
|
|
81
|
+
} from "../index-pgsyp3xh.js";
|
|
82
82
|
import {
|
|
83
83
|
isRecord
|
|
84
|
-
} from "../index-
|
|
84
|
+
} from "../index-qyrqwr4c.js";
|
|
85
85
|
import {
|
|
86
86
|
AppError,
|
|
87
87
|
STITCH_ERROR_STATUS,
|
package/dist/testing.js
CHANGED
|
@@ -11,28 +11,27 @@ import {
|
|
|
11
11
|
RealtimeRequestDisconnectedError,
|
|
12
12
|
RealtimeRequestInvalidAcknowledgementError,
|
|
13
13
|
RealtimeRequestTimeoutError
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-7b188kmz.js";
|
|
15
15
|
import"./index-dk6e56g0.js";
|
|
16
16
|
import {
|
|
17
17
|
mcpProjectionCandidate,
|
|
18
18
|
prepareProjectedMcpTools,
|
|
19
19
|
projectToolSurface
|
|
20
|
-
} from "./index-
|
|
21
|
-
import"./index-6djpbnda.js";
|
|
20
|
+
} from "./index-22by16v6.js";
|
|
22
21
|
import {
|
|
23
22
|
toJsonSchema
|
|
24
23
|
} from "./index-cby4ar3v.js";
|
|
25
24
|
import {
|
|
26
25
|
createClient,
|
|
27
26
|
createClients
|
|
28
|
-
} from "./index-
|
|
29
|
-
import"./index-
|
|
27
|
+
} from "./index-hb0mncmj.js";
|
|
28
|
+
import"./index-t23p2b68.js";
|
|
30
29
|
import {
|
|
31
30
|
joinRoutePath
|
|
32
|
-
} from "./index-
|
|
31
|
+
} from "./index-pgsyp3xh.js";
|
|
33
32
|
import {
|
|
34
33
|
isRecord
|
|
35
|
-
} from "./index-
|
|
34
|
+
} from "./index-qyrqwr4c.js";
|
|
36
35
|
import"./index-0w9abg87.js";
|
|
37
36
|
import"./index-6k1937bx.js";
|
|
38
37
|
|
package/dist/tool-invoker.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createToolInvoker
|
|
3
|
-
} from "./index-
|
|
4
|
-
import"./index-
|
|
5
|
-
import"./index-
|
|
6
|
-
import"./index-
|
|
7
|
-
import"./index-vkk06pv1.js";
|
|
8
|
-
import"./index-6djpbnda.js";
|
|
3
|
+
} from "./index-grgvpbch.js";
|
|
4
|
+
import"./index-y2ctppmg.js";
|
|
5
|
+
import"./index-f24xg2cw.js";
|
|
6
|
+
import"./index-22by16v6.js";
|
|
9
7
|
import"./index-cby4ar3v.js";
|
|
10
|
-
import"./index-
|
|
11
|
-
import"./index-
|
|
8
|
+
import"./index-pgsyp3xh.js";
|
|
9
|
+
import"./index-qyrqwr4c.js";
|
|
12
10
|
import"./index-0w9abg87.js";
|
|
13
11
|
import"./index-6k1937bx.js";
|
|
14
12
|
export {
|
|
@@ -21,6 +21,13 @@ export interface SurfaceRuntimeToolDefinition {
|
|
|
21
21
|
ui?: EndpointUiMeta;
|
|
22
22
|
mcp?: EndpointMcpPolicy;
|
|
23
23
|
}
|
|
24
|
+
/** Peer-free executable shape accepted by Agent-only composition entrypoints. */
|
|
25
|
+
export interface SurfaceAgentRuntimeToolDefinition extends SurfaceRuntimeToolDefinition {
|
|
26
|
+
handler: unknown;
|
|
27
|
+
present?: {
|
|
28
|
+
agent?: unknown;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
24
31
|
/** One peer-free structural extension shared by executable mounts and projections. */
|
|
25
32
|
export interface SurfaceToolExtension<TContext extends Record<string, unknown> = Record<string, unknown>> {
|
|
26
33
|
schema: Record<string, ZodType>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface-projector.d.ts","sourceRoot":"","sources":["../../../src/tools/internal/surface-projector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAK,MAAM,KAAK,CAAC;AACtD,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACvB,cAAc,EACd,UAAU,EACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AASzD,MAAM,MAAM,sBAAsB,GAAG,KAAK,GAAG,OAAO,GAAG,KAAK,CAAC;AAE7D,wFAAwF;AACxF,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE;QACR,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,UAAU,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAChC,CAAC;IACF,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAC/C,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,EAAE,CAAC,EAAE,cAAc,CAAC;IACpB,GAAG,CAAC,EAAE,iBAAiB,CAAC;CACzB;AAED,sFAAsF;AACtF,MAAM,WAAW,oBAAoB,CACnC,QAAQ,SAAS,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W,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,GAAG,CAAC,EAAE,iBAAiB,CAAC;CACzB;AAED,MAAM,WAAW,wBAAwB,CAAC,KAAK;IAC7C,IAAI,EAAE,KAAK,CAAC;IACZ,WAAW,EAAE,sBAAsB,CAAC;IACpC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,SAAS,4BAA4B,EAClF,IAAI,EAAE,aAAa,CAAC,QAAQ,CAAC,GAC5B,sBAAsB,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CA0BjD;AAeD,0EAA0E;AAC1E,wBAAgB,wBAAwB,CAAC,KAAK,EAC5C,KAAK,EAAE,SAAS,sBAAsB,CAAC,KAAK,CAAC,EAAE,EAC/C,MAAM,GAAE,8BAAmC,GAC1C,wBAAwB,CAAC,KAAK,CAAC,EAAE,CA6GnC"}
|
package/dist/tools.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
redact
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-22tjt2rk.js";
|
|
4
|
+
import {
|
|
5
|
+
buildToolManifest,
|
|
6
|
+
mountAgent
|
|
7
|
+
} from "./index-bt5179zb.js";
|
|
4
8
|
import {
|
|
5
9
|
signJwt,
|
|
6
10
|
verifyPkce
|
|
7
|
-
} from "./index-
|
|
11
|
+
} from "./index-xyvxez9r.js";
|
|
8
12
|
import {
|
|
9
13
|
DEFAULT_CORS_ALLOW_HEADERS,
|
|
10
14
|
DEFAULT_PROCESS_SIGNALS,
|
|
@@ -12,39 +16,39 @@ import {
|
|
|
12
16
|
defaultSignalSource,
|
|
13
17
|
guardSignalCallback,
|
|
14
18
|
reportSignalError
|
|
15
|
-
} from "./index-
|
|
19
|
+
} from "./index-hxh98zbm.js";
|
|
16
20
|
import {
|
|
17
21
|
createToolInvoker
|
|
18
|
-
} from "./index-
|
|
22
|
+
} from "./index-grgvpbch.js";
|
|
19
23
|
import {
|
|
20
24
|
WaitTimeoutError,
|
|
21
|
-
collectToolSurface,
|
|
22
25
|
createCli,
|
|
23
|
-
createRuntimeToolFactory,
|
|
24
26
|
defineCliCommand,
|
|
25
|
-
defineRuntimeTool,
|
|
26
27
|
fetchGuarded,
|
|
27
28
|
fetchPinnedDocument,
|
|
28
29
|
readCapped,
|
|
29
30
|
runWaitOperation
|
|
30
|
-
} from "./index-
|
|
31
|
+
} from "./index-2t6zt5cg.js";
|
|
31
32
|
import {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
} from "./index-
|
|
33
|
+
collectToolSurface,
|
|
34
|
+
createRuntimeToolFactory,
|
|
35
|
+
defineRuntimeTool
|
|
36
|
+
} from "./index-eqqyd9v8.js";
|
|
36
37
|
import {
|
|
37
38
|
ToolExecutionControlError,
|
|
38
39
|
coerceJsonArgs,
|
|
40
|
+
collectTools,
|
|
41
|
+
createToolRunner,
|
|
39
42
|
executeToolMethod,
|
|
43
|
+
formatToolError,
|
|
40
44
|
isToolExecutionControlError,
|
|
41
45
|
toolResultFromError
|
|
42
|
-
} from "./index-
|
|
46
|
+
} from "./index-y2ctppmg.js";
|
|
43
47
|
import {
|
|
44
48
|
getRequestContext,
|
|
45
49
|
getTraceId,
|
|
46
50
|
runWithRequestContext
|
|
47
|
-
} from "./index-
|
|
51
|
+
} from "./index-f24xg2cw.js";
|
|
48
52
|
import {
|
|
49
53
|
ManagedFileError
|
|
50
54
|
} from "./index-bfcpjw20.js";
|
|
@@ -59,17 +63,16 @@ import {
|
|
|
59
63
|
prepareProjectedMcpTools,
|
|
60
64
|
presentationMetadata,
|
|
61
65
|
validateMcpRoundPolicy
|
|
62
|
-
} from "./index-
|
|
63
|
-
import"./index-6djpbnda.js";
|
|
66
|
+
} from "./index-22by16v6.js";
|
|
64
67
|
import"./index-cby4ar3v.js";
|
|
65
68
|
import {
|
|
66
69
|
defineContract,
|
|
67
70
|
normalizeError,
|
|
68
71
|
resolvePropagationContext
|
|
69
|
-
} from "./index-
|
|
72
|
+
} from "./index-pgsyp3xh.js";
|
|
70
73
|
import {
|
|
71
74
|
isRecord
|
|
72
|
-
} from "./index-
|
|
75
|
+
} from "./index-qyrqwr4c.js";
|
|
73
76
|
import {
|
|
74
77
|
AppError,
|
|
75
78
|
STITCH_ERROR_STATUS
|
|
@@ -78,77 +81,6 @@ import {
|
|
|
78
81
|
ManagedFilePathSchema,
|
|
79
82
|
ManagedFileRefSchema
|
|
80
83
|
} from "./index-6k1937bx.js";
|
|
81
|
-
|
|
82
|
-
// src/tools/agent.ts
|
|
83
|
-
import { jsonSchema, tool } from "ai";
|
|
84
|
-
function mountAgent(services, config = {}) {
|
|
85
|
-
const serviceList = Array.isArray(services) ? services : [services];
|
|
86
|
-
const tools = {};
|
|
87
|
-
const runTool = createToolRunner({
|
|
88
|
-
source: "agent",
|
|
89
|
-
extend: config.extend,
|
|
90
|
-
context: config.context,
|
|
91
|
-
hooks: config.hooks,
|
|
92
|
-
lifecycle: config.lifecycle,
|
|
93
|
-
errorHint: config.errorHint,
|
|
94
|
-
coerceJsonArgs: config.coerceJsonArgs,
|
|
95
|
-
onOutputStrip: config.onOutputStrip
|
|
96
|
-
});
|
|
97
|
-
for (const entry of collectToolSurface({
|
|
98
|
-
surface: { services: serviceList, runtimeTools: config.runtimeTools },
|
|
99
|
-
transport: "AGENT",
|
|
100
|
-
extend: config.extend,
|
|
101
|
-
flattenUnionInput: config.flattenUnionInput
|
|
102
|
-
})) {
|
|
103
|
-
const { mountable } = entry;
|
|
104
|
-
const inputSchema = jsonSchema(mountable.presentationSchema, {
|
|
105
|
-
validate: async (value) => isRecord(value) ? { success: true, value } : { success: false, error: new Error("Tool arguments must be an object") }
|
|
106
|
-
});
|
|
107
|
-
const execute = async (rawArgs, options) => {
|
|
108
|
-
const args = isRecord(rawArgs) ? rawArgs : {};
|
|
109
|
-
try {
|
|
110
|
-
const result = await runTool(mountable, args, { signal: options.abortSignal });
|
|
111
|
-
if (result.ok)
|
|
112
|
-
return result.data;
|
|
113
|
-
return formatToolError(result, mountable.name, config.errorHint);
|
|
114
|
-
} catch (err) {
|
|
115
|
-
if (isToolExecutionControlError(err))
|
|
116
|
-
throw err;
|
|
117
|
-
return formatToolError(toolResultFromError(err), mountable.name, config.errorHint);
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
const presenter = entry.kind === "runtime" ? entry.definition.present?.agent : undefined;
|
|
121
|
-
if (entry.kind === "runtime" && presenter) {
|
|
122
|
-
const { definition } = entry;
|
|
123
|
-
const output = definition.output;
|
|
124
|
-
if (!output) {
|
|
125
|
-
throw new Error(`Runtime tool "${definition.name}" presenter requires an output schema`);
|
|
126
|
-
}
|
|
127
|
-
tools[definition.name] = tool({
|
|
128
|
-
description: definition.description,
|
|
129
|
-
inputSchema,
|
|
130
|
-
outputSchema: output,
|
|
131
|
-
execute,
|
|
132
|
-
toModelOutput: async ({ output: rawOutput }) => {
|
|
133
|
-
const parsed = output.safeParse(rawOutput);
|
|
134
|
-
if (!parsed.success) {
|
|
135
|
-
return { type: "text", value: JSON.stringify(rawOutput) };
|
|
136
|
-
}
|
|
137
|
-
return presenter(parsed.data);
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
} else {
|
|
141
|
-
const output = entry.kind === "runtime" ? entry.definition.output : undefined;
|
|
142
|
-
tools[mountable.name] = tool({
|
|
143
|
-
description: mountable.method.desc,
|
|
144
|
-
inputSchema,
|
|
145
|
-
...output && { outputSchema: output },
|
|
146
|
-
execute
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return tools;
|
|
151
|
-
}
|
|
152
84
|
// src/tools/async-operation.ts
|
|
153
85
|
import { z } from "zod";
|
|
154
86
|
|
|
@@ -1003,19 +935,6 @@ function listToolNames(surface) {
|
|
|
1003
935
|
function listContractToolNames(contracts) {
|
|
1004
936
|
return listToolNames({ services: contracts.map(contractOnlyService) });
|
|
1005
937
|
}
|
|
1006
|
-
// src/tools/manifest.ts
|
|
1007
|
-
function buildToolManifest(config) {
|
|
1008
|
-
return collectToolSurface({
|
|
1009
|
-
surface: config,
|
|
1010
|
-
transport: config.transport,
|
|
1011
|
-
extend: config.extend,
|
|
1012
|
-
flattenUnionInput: config.flattenUnionInput
|
|
1013
|
-
}).map(({ mountable }) => ({
|
|
1014
|
-
name: mountable.name,
|
|
1015
|
-
description: mountable.method.desc,
|
|
1016
|
-
inputSchema: mountable.presentationSchema
|
|
1017
|
-
}));
|
|
1018
|
-
}
|
|
1019
938
|
// src/tools/mcp.ts
|
|
1020
939
|
import {
|
|
1021
940
|
createRequestStateCodec,
|
|
@@ -1178,23 +1097,23 @@ async function argumentsDigest(args) {
|
|
|
1178
1097
|
binary += String.fromCodePoint(byte);
|
|
1179
1098
|
return btoa(binary).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
|
|
1180
1099
|
}
|
|
1181
|
-
function operationIdentity(
|
|
1100
|
+
function operationIdentity(tool) {
|
|
1182
1101
|
return {
|
|
1183
|
-
toolName:
|
|
1184
|
-
serviceName:
|
|
1185
|
-
action:
|
|
1186
|
-
method:
|
|
1187
|
-
...
|
|
1102
|
+
toolName: tool.name,
|
|
1103
|
+
serviceName: tool.method.serviceName,
|
|
1104
|
+
action: tool.method.key,
|
|
1105
|
+
method: tool.method.method,
|
|
1106
|
+
...tool.method.scope !== undefined && { scope: tool.method.scope }
|
|
1188
1107
|
};
|
|
1189
1108
|
}
|
|
1190
1109
|
function sameIdentity(left, right) {
|
|
1191
1110
|
return left.toolName === right.toolName && left.serviceName === right.serviceName && left.action === right.action && left.method === right.method && left.scope === right.scope;
|
|
1192
1111
|
}
|
|
1193
|
-
async function runRoundSuccess(
|
|
1112
|
+
async function runRoundSuccess(tool, rawArgs, runTool, context) {
|
|
1194
1113
|
return runTool({
|
|
1195
|
-
...
|
|
1114
|
+
...tool,
|
|
1196
1115
|
method: {
|
|
1197
|
-
...
|
|
1116
|
+
...tool.method,
|
|
1198
1117
|
outputSchema: undefined,
|
|
1199
1118
|
handler: () => {
|
|
1200
1119
|
return;
|
|
@@ -1202,11 +1121,11 @@ async function runRoundSuccess(tool2, rawArgs, runTool, context) {
|
|
|
1202
1121
|
}
|
|
1203
1122
|
}, rawArgs, context);
|
|
1204
1123
|
}
|
|
1205
|
-
async function runRoundFailure(
|
|
1124
|
+
async function runRoundFailure(tool, rawArgs, runTool, context, code, message) {
|
|
1206
1125
|
return runTool({
|
|
1207
|
-
...
|
|
1126
|
+
...tool,
|
|
1208
1127
|
method: {
|
|
1209
|
-
...
|
|
1128
|
+
...tool.method,
|
|
1210
1129
|
outputSchema: undefined,
|
|
1211
1130
|
handler: () => {
|
|
1212
1131
|
throw new AppError(code, message, 400);
|
|
@@ -1402,7 +1321,7 @@ function mountPreparedRuntimeMcp(server, tools, config) {
|
|
|
1402
1321
|
}
|
|
1403
1322
|
server.registerTool(definition.name, toolConfig, async (rawArgs, mcpContext) => runInMcpRequestContext(mcpContext, definition.name, async () => {
|
|
1404
1323
|
const args = isRecord(rawArgs) ? rawArgs : {};
|
|
1405
|
-
const runTool = (
|
|
1324
|
+
const runTool = (tool, toolArgs, roundContext) => executeToolMethod(tool.method, definition.name, toolArgs, { ...config.context, ...roundContext, source: "mcp" }, config.hooks, config.lifecycle, config.coerceJsonArgs ?? true, config.onOutputStrip ? (paths) => config.onOutputStrip?.(definition.name, paths) : undefined);
|
|
1406
1325
|
const round = await resolveMcpRound({
|
|
1407
1326
|
tool: mountable,
|
|
1408
1327
|
rawArgs: args,
|
package/llms-full.txt
CHANGED
|
@@ -3712,6 +3712,16 @@ fails first on duplicate contract/runtime names. There is no runtime-only
|
|
|
3712
3712
|
manifest helper or public mount adapter: the framework owns merging and schema
|
|
3713
3713
|
projection.
|
|
3714
3714
|
|
|
3715
|
+
Applications using Stitchkit's durable runtime can compose this manifest with
|
|
3716
|
+
bounded per-run activation through `createDeferredAgentToolSurface` from
|
|
3717
|
+
`stitchkit/agent-runtime`. It keeps selected calls as direct `mountAgent` tools
|
|
3718
|
+
rather than routing them through a generic executor. Search receipts live in
|
|
3719
|
+
ordinary durable tool-result history, so recovery restores activation and a
|
|
3720
|
+
queued successor cannot inherit it. See
|
|
3721
|
+
[Bounded deferred tool catalogs](./agent-runtime.md#bounded-deferred-tool-catalogs)
|
|
3722
|
+
and ADR 0129. Raw `mountAgent`, `mountMcp` and `buildToolManifest` behavior is
|
|
3723
|
+
unchanged.
|
|
3724
|
+
|
|
3715
3725
|
`listToolNames` remains diagnostic and reports `kind: 'contract' | 'runtime'`
|
|
3716
3726
|
for every identity. `summarizeTransports` returns `contractServices`,
|
|
3717
3727
|
`runtimeTools`, aggregate `totals`, and a `sources` breakdown. Runtime tools
|
|
@@ -3763,7 +3773,7 @@ description: Configure Stitchkit's optional durable history, stream loop, run co
|
|
|
3763
3773
|
type: architecture
|
|
3764
3774
|
status: active
|
|
3765
3775
|
created: 2026-08-22
|
|
3766
|
-
updated: 2026-08-
|
|
3776
|
+
updated: 2026-08-29
|
|
3767
3777
|
---
|
|
3768
3778
|
|
|
3769
3779
|
# Agent application runtime
|
|
@@ -3918,6 +3928,69 @@ await ticket.accepted
|
|
|
3918
3928
|
const terminal = await ticket.result
|
|
3919
3929
|
```
|
|
3920
3930
|
|
|
3931
|
+
## Bounded deferred tool catalogs
|
|
3932
|
+
|
|
3933
|
+
Use `createDeferredAgentToolSurface` when a measured large catalog makes
|
|
3934
|
+
sending every schema on every provider step expensive. The controller mounts
|
|
3935
|
+
the complete executable surface in process, but initially advertises only its
|
|
3936
|
+
search tool, explicit `alwaysOn` tools and bounded policy pins:
|
|
3937
|
+
|
|
3938
|
+
```ts
|
|
3939
|
+
import { createDeferredAgentToolSurface } from 'stitchkit/agent-runtime'
|
|
3940
|
+
import { composeToolLifecycle } from 'stitchkit/tools'
|
|
3941
|
+
|
|
3942
|
+
const deferred = createDeferredAgentToolSurface({
|
|
3943
|
+
surfaces: {
|
|
3944
|
+
member: { services: memberServices, runtimeTools, alwaysOn: ['ask_user'] },
|
|
3945
|
+
broadcast: { services: broadcastServices, runtimeTools },
|
|
3946
|
+
},
|
|
3947
|
+
selectSurface: ({ context }) => context.mode,
|
|
3948
|
+
pins: ({ context }) => context.skillTools,
|
|
3949
|
+
search: {
|
|
3950
|
+
name: 'tool_search',
|
|
3951
|
+
maxQueryBytes: 1_024,
|
|
3952
|
+
maxResults: 8,
|
|
3953
|
+
maxResultBytes: 8_192,
|
|
3954
|
+
select: ({ query, manifest }) => rankCatalog(query, manifest),
|
|
3955
|
+
},
|
|
3956
|
+
activation: {
|
|
3957
|
+
maxSelectedTools: 8,
|
|
3958
|
+
maxActiveTools: 16,
|
|
3959
|
+
maxSchemaBytes: 32_768,
|
|
3960
|
+
},
|
|
3961
|
+
observe: event => recordDeferredToolEvidence(event),
|
|
3962
|
+
})
|
|
3963
|
+
|
|
3964
|
+
const runtime = createAgentRuntime({
|
|
3965
|
+
// protocol, store, models and prompt...
|
|
3966
|
+
tools: runContext => deferred.mount(runContext, {
|
|
3967
|
+
context: runContext.context,
|
|
3968
|
+
lifecycle: composeToolLifecycle(authLifecycle, runContext.toolFenceLifecycle),
|
|
3969
|
+
}),
|
|
3970
|
+
loop: { prepareStep: deferred.prepareStep(applicationPrepareStep) },
|
|
3971
|
+
})
|
|
3972
|
+
```
|
|
3973
|
+
|
|
3974
|
+
The built-in selector deterministically ranks exact name, prefix/token and
|
|
3975
|
+
description matches. A custom async selector returns names only; unknown and
|
|
3976
|
+
duplicate output is removed against the local canonical manifest. Search never
|
|
3977
|
+
executes the selected operation and never returns its schema. A later provider
|
|
3978
|
+
step receives the real selected tools by name, so their direct lifecycle,
|
|
3979
|
+
fencing, hooks, errors and `present.agent` output remain unchanged.
|
|
3980
|
+
|
|
3981
|
+
Selection is a versioned receipt in the ordinary durable tool-result history.
|
|
3982
|
+
The latest valid same-run search replaces the earlier selection; parallel
|
|
3983
|
+
searches in one step merge in call order. Recovery reconstructs it, while a
|
|
3984
|
+
different run or finite surface cannot inherit it. Known inactive calls take a
|
|
3985
|
+
recoverable `SEARCH_REQUIRED` search round; unknown names still fail.
|
|
3986
|
+
|
|
3987
|
+
Every ceiling is required. `maxSchemaBytes` measures UTF-8 bytes over canonical
|
|
3988
|
+
name, description and presentation schema. It is useful for before/after
|
|
3989
|
+
comparison, but provider serialization and tokenization differ: use existing
|
|
3990
|
+
provider-reported input usage and cost to decide whether the extra search round
|
|
3991
|
+
is beneficial. Controller evidence intentionally omits query text, prompts,
|
|
3992
|
+
arguments and application context. → ADR 0129.
|
|
3993
|
+
|
|
3921
3994
|
### Executable headless harness and capability map
|
|
3922
3995
|
|
|
3923
3996
|
[`packages/core/examples/headless-agent-harness.ts`](../../packages/core/examples/headless-agent-harness.ts)
|
|
@@ -6088,6 +6161,7 @@ const socket = createRealtimeClient(realtimeContract, {
|
|
|
6088
6161
|
url: 'https://api.example.com',
|
|
6089
6162
|
retain: ['note:created'],
|
|
6090
6163
|
onRejected: (event) => reportClientError(event),
|
|
6164
|
+
onRequestPhase: (event) => metrics.realtimeRequestPhase(event),
|
|
6091
6165
|
})
|
|
6092
6166
|
|
|
6093
6167
|
socket.connect()
|
|
@@ -6142,6 +6216,48 @@ or resumable delivery should use separate correlated events or the async
|
|
|
6142
6216
|
operation protocol; keeping one acknowledgement open is not a durable RPC/job
|
|
6143
6217
|
transport.
|
|
6144
6218
|
|
|
6219
|
+
### Acknowledged-request phases
|
|
6220
|
+
|
|
6221
|
+
`createRealtimeClient` can expose the local boundary that a single Promise
|
|
6222
|
+
normally hides:
|
|
6223
|
+
|
|
6224
|
+
```ts
|
|
6225
|
+
const socket = createRealtimeClient(realtimeContract, {
|
|
6226
|
+
url,
|
|
6227
|
+
onRequestPhase: ({ requestId, event, phase, elapsedMs }) => {
|
|
6228
|
+
requestPhaseHistogram.record(elapsedMs, { requestId, event, phase })
|
|
6229
|
+
},
|
|
6230
|
+
})
|
|
6231
|
+
```
|
|
6232
|
+
|
|
6233
|
+
The hook is opt-in and each record has exactly four metadata fields: an opaque,
|
|
6234
|
+
Kit-owned `requestId`, the contract event name, monotonic `elapsedMs`, and one
|
|
6235
|
+
closed phase:
|
|
6236
|
+
|
|
6237
|
+
| Phase | Exact local boundary |
|
|
6238
|
+
|-------|----------------------|
|
|
6239
|
+
| `engine-handoff` | Engine.IO created the outbound message packet and accepted it into its write path |
|
|
6240
|
+
| `engine-ack-received` | Engine.IO decoded the inbound acknowledgement message, before Socket.IO invokes the acknowledgement callback |
|
|
6241
|
+
| `settled` | the acknowledgement callback ran and Stitchkit finished acknowledgement validation |
|
|
6242
|
+
| `timeout` | the existing native acknowledgement timeout won |
|
|
6243
|
+
| `disconnected` | the request began disconnected or an in-flight disconnect won |
|
|
6244
|
+
|
|
6245
|
+
Engine handoff is not proof of a physical network write. Engine acknowledgement
|
|
6246
|
+
receipt is not a remote clock, end-to-end RTT or proof that application
|
|
6247
|
+
validation has run. The useful interval is local and monotonic:
|
|
6248
|
+
`engine-ack-received → settled` isolates callback scheduling plus validation
|
|
6249
|
+
from transport waiting.
|
|
6250
|
+
|
|
6251
|
+
Records never contain request arguments, acknowledgement values, raw packets,
|
|
6252
|
+
credentials, URLs or query data. Concurrent requests are correlated internally
|
|
6253
|
+
with Socket.IO acknowledgement ids, but those ids are never exposed. A timeout
|
|
6254
|
+
or disconnect is terminal, a late packet cannot reopen the identity, and sync
|
|
6255
|
+
or async observer failures are ignored so telemetry cannot change request
|
|
6256
|
+
correctness. With no hook, no request identity, Engine.IO listener or correlation
|
|
6257
|
+
map entry is created. The low-level `createSocketIOClient` and non-owning
|
|
6258
|
+
`bindRealtimeClient` remain unchanged; this phase surface belongs to the
|
|
6259
|
+
canonical composed client that owns both transport and validation.
|
|
6260
|
+
|
|
6145
6261
|
## Low-level transport
|
|
6146
6262
|
|
|
6147
6263
|
`createSocketIOClient` remains the low-level Socket.IO transport wrapper for
|
|
@@ -11175,7 +11291,7 @@ The browser-and-server entrypoint. Re-exports everything from
|
|
|
11175
11291
|
| `SocketIOClientConfig` | _type_ | config for `createSocketIOClient` (incl. `retain`, `onConnectError`, `onDroppedEmit`) |
|
|
11176
11292
|
| `SocketEventMap` | _type_ | the shape of an event map |
|
|
11177
11293
|
| `RealtimeClient` | _type_ | validated client inferred from a realtime contract |
|
|
11178
|
-
| `RealtimeClientOptions` | _type_ | transport options
|
|
11294
|
+
| `RealtimeClientOptions` | _type_ | transport options plus rejected-event and metadata-only acknowledged-request phase hooks for `createRealtimeClient` |
|
|
11179
11295
|
| `BoundRealtimeClient` | _type_ | validated non-owning `on`/`emit`/`request` client with no `connect`/`disconnect` |
|
|
11180
11296
|
| `RealtimeClientTransport` | _type_ | minimal existing transport capability accepted by `bindRealtimeClient` |
|
|
11181
11297
|
| `BindRealtimeClientOptions` | _type_ | rejection/logger options for a bound existing transport |
|
|
@@ -11183,6 +11299,9 @@ The browser-and-server entrypoint. Re-exports everything from
|
|
|
11183
11299
|
| `RealtimeAcknowledgement` | _type_ | validated acknowledgement output inferred from an event definition |
|
|
11184
11300
|
| `RealtimeRequestArguments` | _type_ | request arguments inferred from an acknowledged event tuple |
|
|
11185
11301
|
| `RealtimeRequestOptions` | _type_ | finite positive native acknowledgement `timeoutMs` |
|
|
11302
|
+
| `RealtimeRequestPhaseSchema` / `RealtimeRequestPhase` | schema / _type_ | closed `engine-handoff` / `engine-ack-received` / `settled` / `timeout` / `disconnected` lifecycle |
|
|
11303
|
+
| `RealtimeRequestPhaseEventSchema` / `RealtimeRequestPhaseEvent` | schema / _type_ | strict metadata-only `{ requestId, event, phase, elapsedMs }` observation |
|
|
11304
|
+
| `RealtimeRequestPhaseHook` | _type_ | isolated sync/async observer accepted by `RealtimeClientOptions.onRequestPhase` |
|
|
11186
11305
|
| `RealtimeRequestTimeoutError` | class | stable `REALTIME_REQUEST_TIMEOUT` rejection |
|
|
11187
11306
|
| `RealtimeRequestDisconnectedError` | class | stable `REALTIME_REQUEST_DISCONNECTED` rejection, including an immediate disconnected call |
|
|
11188
11307
|
| `RealtimeRequestInvalidAcknowledgementError` | class | invalid ack was reported through `onRejected` and the request rejected |
|
|
@@ -11683,6 +11802,12 @@ Server-only optional application runtime. See the
|
|
|
11683
11802
|
| Export | Kind | Summary |
|
|
11684
11803
|
|--------|------|---------|
|
|
11685
11804
|
| `createAgentRuntime` | function | compose durable acceptance, stream loop, checkpoints, coordination, managed tools and winner-only terminal publication; reconciles same-owner terminal/interrupt/head CAS races before releasing the lane |
|
|
11805
|
+
| `createDeferredAgentToolSurface` | function | bounded canonical catalog search plus durable same-run activation of direct `mountAgent` tools; supports one immutable surface or a finite identity-specific registry |
|
|
11806
|
+
| `DeferredAgentToolSearchInputSchema` / `DeferredAgentToolMatchSchema` / `DeferredAgentToolReceiptSchema` | schema | bounded search input, public match and versioned durable selection receipt |
|
|
11807
|
+
| `DeferredAgentToolSurfaceConfig` / `DeferredAgentToolCommonConfig` / `DeferredAgentToolSurfaceDefinition` / `DeferredAgentToolController` | _type_ | finite catalogs, selector, pin, budget and `mount`/`prepareStep` composition contracts |
|
|
11808
|
+
| `DeferredAgentRuntimeToolDefinition` / `DeferredAgentToolMountConfig` | _type_ | peer-free Agent-only runtime definition and canonical mount configuration accepted by the controller |
|
|
11809
|
+
| `DeferredAgentToolManifestEntry` / `DeferredAgentToolSearchContext` / `DeferredAgentToolReceipt` | _type_ | canonical selector input and inferred durable receipt records |
|
|
11810
|
+
| `DeferredAgentToolEvent` | _type_ | PII-free search/step evidence with surface, provenance, counts, canonical schema bytes and ceilings |
|
|
11686
11811
|
| `defineAgentProtocol` | function | declare context, input metadata, canonical parts and optional pre-CAS terminal acceptance (`allow-empty`, `require-output` or callback) |
|
|
11687
11812
|
| `hasAgentTerminalOutput` | function | generic `require-output` predicate for non-blank text, generated files, structured provider parts and explicit tool-only policy stops |
|
|
11688
11813
|
| `AgentMessageSchema` / `AgentRunSchema` / `AgentSnapshotSchema` | schema | versioned canonical engine records |
|
package/package.json
CHANGED