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
package/dist/index-6djpbnda.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
toJsonSchema
|
|
3
|
-
} from "./index-cby4ar3v.js";
|
|
4
|
-
|
|
5
|
-
// src/tools/schema.ts
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
function objectShapeKeys(schema) {
|
|
8
|
-
return schema instanceof z.ZodObject ? Object.keys(schema.shape) : [];
|
|
9
|
-
}
|
|
10
|
-
function keyPolicyOf(schema) {
|
|
11
|
-
return schema.def.catchall;
|
|
12
|
-
}
|
|
13
|
-
function rebuildObject(source, shape) {
|
|
14
|
-
return withKeyPolicy(z.object(shape), keyPolicyOf(source));
|
|
15
|
-
}
|
|
16
|
-
function withKeyPolicy(object, policy) {
|
|
17
|
-
if (policy === undefined)
|
|
18
|
-
return object;
|
|
19
|
-
return object.catchall(representable(policy));
|
|
20
|
-
}
|
|
21
|
-
function representable(policy) {
|
|
22
|
-
if (policy instanceof z.ZodNever || policy instanceof z.ZodUnknown)
|
|
23
|
-
return policy;
|
|
24
|
-
if (!(policy instanceof z.ZodType))
|
|
25
|
-
return z.unknown();
|
|
26
|
-
try {
|
|
27
|
-
toJsonSchema(policy, "input");
|
|
28
|
-
return policy;
|
|
29
|
-
} catch {
|
|
30
|
-
return z.unknown();
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
function mergeSchemas(paramsSchema, inputSchema) {
|
|
34
|
-
if (paramsSchema && !(paramsSchema instanceof z.ZodObject)) {
|
|
35
|
-
throw new Error("Tool params schema must be a z.object()");
|
|
36
|
-
}
|
|
37
|
-
const paramsObject = paramsSchema instanceof z.ZodObject ? paramsSchema : undefined;
|
|
38
|
-
if (!inputSchema) {
|
|
39
|
-
return paramsObject ?? z.object({});
|
|
40
|
-
}
|
|
41
|
-
if (inputSchema instanceof z.ZodObject) {
|
|
42
|
-
if (paramsObject) {
|
|
43
|
-
const conflicts = Object.keys(paramsObject.shape).filter((key) => (key in inputSchema.shape));
|
|
44
|
-
if (conflicts.length > 0) {
|
|
45
|
-
throw new Error(`Schema merge conflict: ${conflicts.join(", ")} appear in both params and input`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return rebuildObject(inputSchema, {
|
|
49
|
-
...paramsObject?.shape ?? {},
|
|
50
|
-
...inputSchema.shape
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
return paramsObject ? z.intersection(paramsObject, inputSchema) : inputSchema;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export { objectShapeKeys, rebuildObject, mergeSchemas };
|
package/dist/index-88yyydag.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
executeToolMethod
|
|
3
|
-
} from "./index-04agqrs8.js";
|
|
4
|
-
import {
|
|
5
|
-
assertToolExtensionCompatible,
|
|
6
|
-
projectToolSurface
|
|
7
|
-
} from "./index-vkk06pv1.js";
|
|
8
|
-
import {
|
|
9
|
-
mergeSchemas,
|
|
10
|
-
rebuildObject
|
|
11
|
-
} from "./index-6djpbnda.js";
|
|
12
|
-
|
|
13
|
-
// src/tools/mount.ts
|
|
14
|
-
import { z } from "zod";
|
|
15
|
-
function applyExtend(base, extra) {
|
|
16
|
-
if (base instanceof z.ZodObject) {
|
|
17
|
-
assertToolExtensionCompatible(base, extra);
|
|
18
|
-
return rebuildObject(base, { ...extra, ...base.shape });
|
|
19
|
-
}
|
|
20
|
-
return z.intersection(z.object(extra), base);
|
|
21
|
-
}
|
|
22
|
-
function contractToolMountable(projected, extend) {
|
|
23
|
-
const method = projected.source;
|
|
24
|
-
const baseArgumentSchema = mergeSchemas(method.paramsSchema, method.inputSchema);
|
|
25
|
-
const argumentSchema = projected.shouldExtend && extend ? applyExtend(baseArgumentSchema, extend.schema) : baseArgumentSchema;
|
|
26
|
-
return {
|
|
27
|
-
method,
|
|
28
|
-
name: projected.name,
|
|
29
|
-
argumentSchema,
|
|
30
|
-
presentationSchema: projected.presentationSchema,
|
|
31
|
-
shouldExtend: projected.shouldExtend
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function collectTools(service, transport, config = {}) {
|
|
35
|
-
const { extend, flattenUnionInput = false, assertNames = true } = config;
|
|
36
|
-
const tools = [];
|
|
37
|
-
for (const projected of projectToolSurface({ services: [service] }, transport === "HTTP" ? "AGENT" : transport, {
|
|
38
|
-
extend,
|
|
39
|
-
flattenUnionInput,
|
|
40
|
-
assertNames,
|
|
41
|
-
assertUniqueNames: false
|
|
42
|
-
})) {
|
|
43
|
-
if (projected.kind !== "contract")
|
|
44
|
-
continue;
|
|
45
|
-
tools.push(contractToolMountable(projected, extend));
|
|
46
|
-
}
|
|
47
|
-
return tools;
|
|
48
|
-
}
|
|
49
|
-
function createToolRunner(config) {
|
|
50
|
-
const extension = config.extend ? {
|
|
51
|
-
schema: z.object(config.extend.schema),
|
|
52
|
-
resolve: config.extend.resolve
|
|
53
|
-
} : undefined;
|
|
54
|
-
return async function runOneToolCall(tool, rawArgs, context) {
|
|
55
|
-
return executeToolMethod(tool.method, tool.name, rawArgs, { ...config.context, ...context, source: config.source }, config.hooks, config.lifecycle, config.coerceJsonArgs ?? true, config.onOutputStrip ? (paths) => config.onOutputStrip?.(tool.name, paths) : undefined, tool.shouldExtend ? extension : undefined);
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
function formatToolError(result, toolName, errorHint) {
|
|
59
|
-
const err = { error: result.code };
|
|
60
|
-
if (result.details)
|
|
61
|
-
err.details = result.details;
|
|
62
|
-
const hints = [];
|
|
63
|
-
if (result.hint)
|
|
64
|
-
hints.push(result.hint);
|
|
65
|
-
if (errorHint && toolName) {
|
|
66
|
-
const global = errorHint(toolName, result.code);
|
|
67
|
-
if (global)
|
|
68
|
-
hints.push(global);
|
|
69
|
-
}
|
|
70
|
-
if (hints.length > 0)
|
|
71
|
-
err._hint = hints.join(" ");
|
|
72
|
-
return err;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export { contractToolMountable, collectTools, createToolRunner, formatToolError };
|
package/dist/index-smpbdg6k.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// src/internal/typed.ts
|
|
2
|
-
function typedEntries(value) {
|
|
3
|
-
return Object.entries(value);
|
|
4
|
-
}
|
|
5
|
-
function isRecord(value) {
|
|
6
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7
|
-
}
|
|
8
|
-
function callRuntimeHandler(handler, context) {
|
|
9
|
-
if (typeof handler !== "function") {
|
|
10
|
-
throw new TypeError("Runtime handler must be a function");
|
|
11
|
-
}
|
|
12
|
-
return Reflect.apply(handler, undefined, [context]);
|
|
13
|
-
}
|
|
14
|
-
function transportResult(value) {
|
|
15
|
-
return value;
|
|
16
|
-
}
|
|
17
|
-
function mapObject(source, mapper) {
|
|
18
|
-
const result = {};
|
|
19
|
-
for (const [key, value] of typedEntries(source)) {
|
|
20
|
-
const mapped = mapper(key, value);
|
|
21
|
-
if (mapped !== undefined)
|
|
22
|
-
result[key] = mapped;
|
|
23
|
-
}
|
|
24
|
-
return result;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export { typedEntries, isRecord, callRuntimeHandler, transportResult, mapObject };
|
|
File without changes
|