stitchkit 0.124.2 → 0.124.4
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 +49 -0
- package/dist/entrypoints/agent-runtime/coding-tools.js +4 -4
- package/dist/entrypoints/agent-runtime/harness.js +5 -5
- package/dist/entrypoints/agent-runtime/sandbox.js +4 -4
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +6 -6
- package/dist/entrypoints/agent-runtime/sqlite/node.js +6 -6
- package/dist/entrypoints/agent-runtime/testing.js +6 -6
- package/dist/entrypoints/agent-runtime.js +12 -12
- package/dist/entrypoints/cli.js +7 -7
- package/dist/entrypoints/server.js +1 -1
- package/dist/entrypoints/telegram/screens.d.ts +1 -1
- package/dist/entrypoints/telegram/screens.d.ts.map +1 -1
- package/dist/entrypoints/telegram/screens.js +196 -83
- package/dist/entrypoints/testing.js +2 -2
- package/dist/entrypoints/tools/agent.js +7 -7
- package/dist/entrypoints/tools/connections.js +6 -5
- package/dist/entrypoints/tools/invoker.js +5 -5
- package/dist/entrypoints/tools/mcp.js +7 -7
- package/dist/entrypoints/tools/toolkit.js +9 -9
- package/dist/entrypoints/tools.js +8 -8
- package/dist/{index-s512scra.js → index-1wz4y15d.js} +1 -1
- package/dist/{index-yebkpytc.js → index-2ds89z96.js} +4 -4
- package/dist/{index-jkjh7zw4.js → index-3n8k175r.js} +5 -5
- package/dist/index-5dmk54h9.js +256 -0
- package/dist/{index-8pwwd6rp.js → index-6fmg17bg.js} +1 -1
- package/dist/{index-hzk4ydpy.js → index-a3ekss9t.js} +19 -6
- package/dist/{index-7177dxjn.js → index-afc3mtah.js} +1 -1
- package/dist/{index-0d3sm0m9.js → index-cm07qz01.js} +1 -1
- package/dist/{index-qsm899qp.js → index-en2xqhty.js} +1 -1
- package/dist/{index-782qtc24.js → index-p9saezh1.js} +1 -1
- package/dist/{index-993vtv1w.js → index-q7s1yr9g.js} +3 -3
- package/dist/{index-6k47xdtt.js → index-r7v5xz0g.js} +1 -1
- package/dist/{index-tynna0n4.js → index-rk7m4j7r.js} +3 -94
- package/dist/{index-qc7tq0za.js → index-x68eyh6y.js} +2 -2
- package/dist/{index-enkc9pem.js → index-xaem29dc.js} +1 -1
- package/dist/{index-96yjwwgf.js → index-z2z67tnv.js} +3 -3
- package/dist/json-schema/dialect.d.ts +6 -0
- package/dist/json-schema/dialect.d.ts.map +1 -1
- package/dist/json-schema/json-schema.d.ts.map +1 -1
- package/dist/json-schema/string-format.d.ts +36 -0
- package/dist/json-schema/string-format.d.ts.map +1 -0
- package/dist/telegram/screens/dispatch.d.ts.map +1 -1
- package/dist/telegram/screens/display.d.ts +2 -1
- package/dist/telegram/screens/display.d.ts.map +1 -1
- package/dist/telegram/screens/execute.d.ts +12 -4
- package/dist/telegram/screens/execute.d.ts.map +1 -1
- package/dist/telegram/screens/render.d.ts +5 -1
- package/dist/telegram/screens/render.d.ts.map +1 -1
- package/dist/telegram/screens/runtime.d.ts +5 -1
- package/dist/telegram/screens/runtime.d.ts.map +1 -1
- package/dist/telegram/screens/state.d.ts +3 -0
- package/dist/telegram/screens/state.d.ts.map +1 -1
- package/dist/telegram/screens/test-chat-telegram.d.ts.map +1 -1
- package/dist/telegram/screens/view.d.ts +14 -5
- package/dist/telegram/screens/view.d.ts.map +1 -1
- package/dist/tools/cli/help.d.ts.map +1 -1
- package/dist/tools/connections/runtime.d.ts.map +1 -1
- package/llms/cli.txt +11 -0
- package/llms/telegram-screens.txt +59 -4
- package/llms-full.txt +70 -4
- package/llms.txt +2 -2
- package/package.json +1 -1
- package/dist/index-ct75c3at.js +0 -46
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import"../../index-ndjzbt2v.js";
|
|
2
2
|
import"../../index-dsa676h8.js";
|
|
3
3
|
import"../../index-t8jz0e20.js";
|
|
4
|
-
import"../../index-
|
|
5
|
-
import"../../index-
|
|
6
|
-
import"../../index-
|
|
4
|
+
import"../../index-5dmk54h9.js";
|
|
5
|
+
import"../../index-rk7m4j7r.js";
|
|
6
|
+
import"../../index-1wz4y15d.js";
|
|
7
7
|
import"../../index-yt1gg11x.js";
|
|
8
|
-
import"../../index-
|
|
8
|
+
import"../../index-x68eyh6y.js";
|
|
9
9
|
import {
|
|
10
10
|
mountAgent2
|
|
11
|
-
} from "../../index-
|
|
11
|
+
} from "../../index-2ds89z96.js";
|
|
12
12
|
import {
|
|
13
13
|
createCli2
|
|
14
|
-
} from "../../index-
|
|
14
|
+
} from "../../index-a3ekss9t.js";
|
|
15
15
|
import"../../index-332d0m9g.js";
|
|
16
16
|
import"../../index-sqc6ezrb.js";
|
|
17
17
|
import"../../index-gy9x38a2.js";
|
|
@@ -21,11 +21,11 @@ import {
|
|
|
21
21
|
buildMcpServer2,
|
|
22
22
|
createMcpHandler2,
|
|
23
23
|
createStdioMcpServer2
|
|
24
|
-
} from "../../index-
|
|
24
|
+
} from "../../index-3n8k175r.js";
|
|
25
25
|
import"../../index-fa53vygr.js";
|
|
26
26
|
import"../../index-ww3gss55.js";
|
|
27
|
-
import"../../index-
|
|
28
|
-
import"../../index-
|
|
27
|
+
import"../../index-q7s1yr9g.js";
|
|
28
|
+
import"../../index-r7v5xz0g.js";
|
|
29
29
|
|
|
30
30
|
// src/tools/toolkit.ts
|
|
31
31
|
function createToolkit() {
|
|
@@ -11,7 +11,7 @@ import"../index-dsa676h8.js";
|
|
|
11
11
|
import {
|
|
12
12
|
coerceJsonArgs2
|
|
13
13
|
} from "../index-t8jz0e20.js";
|
|
14
|
-
import"../index-
|
|
14
|
+
import"../index-5dmk54h9.js";
|
|
15
15
|
import {
|
|
16
16
|
assertToolName,
|
|
17
17
|
assertUniqueToolName,
|
|
@@ -19,18 +19,18 @@ import {
|
|
|
19
19
|
findNonPortableFormats2,
|
|
20
20
|
flattenToolJsonSchema2,
|
|
21
21
|
findUntypedProperties2
|
|
22
|
-
} from "../index-
|
|
22
|
+
} from "../index-rk7m4j7r.js";
|
|
23
23
|
import {
|
|
24
24
|
ToolExecutionControlError2,
|
|
25
25
|
isToolExecutionControlError2
|
|
26
|
-
} from "../index-
|
|
26
|
+
} from "../index-1wz4y15d.js";
|
|
27
27
|
import {
|
|
28
28
|
ALL_TRANSPORTS2,
|
|
29
29
|
TOOL_TRANSPORTS2
|
|
30
30
|
} from "../index-yt1gg11x.js";
|
|
31
31
|
import {
|
|
32
32
|
collectTools2
|
|
33
|
-
} from "../index-
|
|
33
|
+
} from "../index-x68eyh6y.js";
|
|
34
34
|
import"../index-m38ej7e5.js";
|
|
35
35
|
import {
|
|
36
36
|
defineContract2
|
|
@@ -62,7 +62,7 @@ import"../index-9ypczvpj.js";
|
|
|
62
62
|
import {
|
|
63
63
|
describeToolCatalog2,
|
|
64
64
|
buildToolManifest2
|
|
65
|
-
} from "../index-
|
|
65
|
+
} from "../index-xaem29dc.js";
|
|
66
66
|
import {
|
|
67
67
|
PROTECTED_RESOURCE_PATH2,
|
|
68
68
|
protectedResourceMetadataUrl2,
|
|
@@ -79,7 +79,7 @@ import {
|
|
|
79
79
|
} from "../index-1psbyyhj.js";
|
|
80
80
|
import {
|
|
81
81
|
createToolInvoker2
|
|
82
|
-
} from "../index-
|
|
82
|
+
} from "../index-z2z67tnv.js";
|
|
83
83
|
import {
|
|
84
84
|
WaitTimeoutError,
|
|
85
85
|
runWaitOperation,
|
|
@@ -90,14 +90,14 @@ import {
|
|
|
90
90
|
} from "../index-zs8cze4j.js";
|
|
91
91
|
import {
|
|
92
92
|
collectToolSurface
|
|
93
|
-
} from "../index-
|
|
93
|
+
} from "../index-q7s1yr9g.js";
|
|
94
94
|
import {
|
|
95
95
|
getTraceId2
|
|
96
96
|
} from "../index-1d7s7da0.js";
|
|
97
97
|
import {
|
|
98
98
|
defineRuntimeTool2,
|
|
99
99
|
createRuntimeToolFactory2
|
|
100
|
-
} from "../index-
|
|
100
|
+
} from "../index-r7v5xz0g.js";
|
|
101
101
|
import {
|
|
102
102
|
ManagedFileError2
|
|
103
103
|
} from "../index-wt6rw7rf.js";
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
toolResultFromError,
|
|
3
3
|
toolCauseFromResult,
|
|
4
4
|
isToolExecutionControlError2
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-1wz4y15d.js";
|
|
6
6
|
import {
|
|
7
7
|
createToolRunner,
|
|
8
8
|
formatToolError
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-x68eyh6y.js";
|
|
10
10
|
import {
|
|
11
11
|
resolveRuntimeToolCall
|
|
12
12
|
} from "./index-eh71zr32.js";
|
|
@@ -15,10 +15,10 @@ import {
|
|
|
15
15
|
} from "./index-1psbyyhj.js";
|
|
16
16
|
import {
|
|
17
17
|
collectToolSurface
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-q7s1yr9g.js";
|
|
19
19
|
import {
|
|
20
20
|
agentPresenterOf
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-r7v5xz0g.js";
|
|
22
22
|
import {
|
|
23
23
|
isRecord
|
|
24
24
|
} from "./index-hkxgennw.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
toJsonSchema
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-5dmk54h9.js";
|
|
4
4
|
import {
|
|
5
5
|
toolSurfaceOutputSchema,
|
|
6
6
|
staticInputRounds,
|
|
@@ -8,17 +8,17 @@ import {
|
|
|
8
8
|
validateResolvedInputRounds,
|
|
9
9
|
presentationMetadata,
|
|
10
10
|
prepareProjectedMcpTools
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-rk7m4j7r.js";
|
|
12
12
|
import {
|
|
13
13
|
parseToolCallArguments,
|
|
14
14
|
toolResultFromError,
|
|
15
15
|
observed
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-1wz4y15d.js";
|
|
17
17
|
import {
|
|
18
18
|
collectTools2,
|
|
19
19
|
createToolRunner,
|
|
20
20
|
formatToolError
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-x68eyh6y.js";
|
|
22
22
|
import {
|
|
23
23
|
publishedToolAnnotations
|
|
24
24
|
} from "./index-332d0m9g.js";
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
} from "./index-568w258r.js";
|
|
41
41
|
import {
|
|
42
42
|
collectToolSurface
|
|
43
|
-
} from "./index-
|
|
43
|
+
} from "./index-q7s1yr9g.js";
|
|
44
44
|
import {
|
|
45
45
|
runWithRequestContext2,
|
|
46
46
|
getRequestContext2
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isRecord
|
|
3
|
+
} from "./index-hkxgennw.js";
|
|
4
|
+
|
|
5
|
+
// src/json-schema/json-schema.ts
|
|
6
|
+
import { z as z2 } from "zod";
|
|
7
|
+
|
|
8
|
+
// src/json-schema/string-format.ts
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
|
|
11
|
+
// src/json-schema/dialect.ts
|
|
12
|
+
var DRAFT_07_MARKER = "draft-07";
|
|
13
|
+
var DRAFT_07_KEYWORD = "definitions";
|
|
14
|
+
var DEFS_KEYWORD = "$defs";
|
|
15
|
+
var SCHEMA_KEYWORDS = [
|
|
16
|
+
"items",
|
|
17
|
+
"additionalItems",
|
|
18
|
+
"additionalProperties",
|
|
19
|
+
"contains",
|
|
20
|
+
"propertyNames",
|
|
21
|
+
"not",
|
|
22
|
+
"if",
|
|
23
|
+
"then",
|
|
24
|
+
"else",
|
|
25
|
+
"unevaluatedItems",
|
|
26
|
+
"unevaluatedProperties"
|
|
27
|
+
];
|
|
28
|
+
var SCHEMA_LIST_KEYWORDS = ["allOf", "anyOf", "oneOf", "prefixItems"];
|
|
29
|
+
var SCHEMA_MAP_KEYWORDS = [
|
|
30
|
+
"properties",
|
|
31
|
+
"patternProperties",
|
|
32
|
+
"dependentSchemas",
|
|
33
|
+
DRAFT_07_KEYWORD,
|
|
34
|
+
DEFS_KEYWORD
|
|
35
|
+
];
|
|
36
|
+
function declaresDraft07(dialect) {
|
|
37
|
+
return typeof dialect === "string" && dialect.includes(DRAFT_07_MARKER);
|
|
38
|
+
}
|
|
39
|
+
function rewriteDefinitionPointers(value) {
|
|
40
|
+
if (Array.isArray(value))
|
|
41
|
+
return value.map(rewriteDefinitionPointers);
|
|
42
|
+
if (!isRecord(value))
|
|
43
|
+
return value;
|
|
44
|
+
const rewritten = {};
|
|
45
|
+
for (const [key, child] of Object.entries(value)) {
|
|
46
|
+
rewritten[key] = key === "$ref" && typeof child === "string" && child.startsWith(`#/${DRAFT_07_KEYWORD}/`) ? `#/${DEFS_KEYWORD}/${child.slice(`#/${DRAFT_07_KEYWORD}/`.length)}` : rewriteDefinitionPointers(child);
|
|
47
|
+
}
|
|
48
|
+
return rewritten;
|
|
49
|
+
}
|
|
50
|
+
function mapValues(value, rewrite) {
|
|
51
|
+
if (!isRecord(value))
|
|
52
|
+
return value;
|
|
53
|
+
const rewritten = {};
|
|
54
|
+
for (const [name, child] of Object.entries(value))
|
|
55
|
+
rewritten[name] = rewrite(child);
|
|
56
|
+
return rewritten;
|
|
57
|
+
}
|
|
58
|
+
function withPositionalItems(schema) {
|
|
59
|
+
if (!isRecord(schema))
|
|
60
|
+
return schema;
|
|
61
|
+
const rewritten = {};
|
|
62
|
+
for (const [key, child] of Object.entries(schema)) {
|
|
63
|
+
if (SCHEMA_KEYWORDS.includes(key))
|
|
64
|
+
rewritten[key] = withPositionalItems(child);
|
|
65
|
+
else if (SCHEMA_LIST_KEYWORDS.includes(key) && Array.isArray(child)) {
|
|
66
|
+
rewritten[key] = child.map(withPositionalItems);
|
|
67
|
+
} else if (SCHEMA_MAP_KEYWORDS.includes(key)) {
|
|
68
|
+
rewritten[key] = mapValues(child, withPositionalItems);
|
|
69
|
+
} else
|
|
70
|
+
rewritten[key] = child;
|
|
71
|
+
}
|
|
72
|
+
const { items, additionalItems } = rewritten;
|
|
73
|
+
if (!Array.isArray(items))
|
|
74
|
+
return rewritten;
|
|
75
|
+
const positional = {};
|
|
76
|
+
for (const [key, child] of Object.entries(rewritten)) {
|
|
77
|
+
if (key === "items")
|
|
78
|
+
positional.prefixItems = items;
|
|
79
|
+
else if (key !== "additionalItems")
|
|
80
|
+
positional[key] = child;
|
|
81
|
+
}
|
|
82
|
+
if (additionalItems !== undefined)
|
|
83
|
+
positional.items = additionalItems;
|
|
84
|
+
return positional;
|
|
85
|
+
}
|
|
86
|
+
function withDraft2020Keywords(schema) {
|
|
87
|
+
const positional = withPositionalItems(schema);
|
|
88
|
+
if (!isRecord(positional))
|
|
89
|
+
return schema;
|
|
90
|
+
const definitions = positional[DRAFT_07_KEYWORD];
|
|
91
|
+
if (!isRecord(definitions) || DEFS_KEYWORD in positional)
|
|
92
|
+
return positional;
|
|
93
|
+
const rewritten = {};
|
|
94
|
+
for (const [key, value] of Object.entries(positional)) {
|
|
95
|
+
if (key === DRAFT_07_KEYWORD)
|
|
96
|
+
continue;
|
|
97
|
+
rewritten[key] = rewriteDefinitionPointers(value);
|
|
98
|
+
}
|
|
99
|
+
rewritten[DEFS_KEYWORD] = rewriteDefinitionPointers(definitions);
|
|
100
|
+
return rewritten;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// src/json-schema/string-format.ts
|
|
104
|
+
var STANDARD_STRING_FORMATS = new Set([
|
|
105
|
+
"date-time",
|
|
106
|
+
"date",
|
|
107
|
+
"time",
|
|
108
|
+
"duration",
|
|
109
|
+
"email",
|
|
110
|
+
"idn-email",
|
|
111
|
+
"hostname",
|
|
112
|
+
"idn-hostname",
|
|
113
|
+
"ipv4",
|
|
114
|
+
"ipv6",
|
|
115
|
+
"uri",
|
|
116
|
+
"uri-reference",
|
|
117
|
+
"iri",
|
|
118
|
+
"iri-reference",
|
|
119
|
+
"uuid",
|
|
120
|
+
"uri-template",
|
|
121
|
+
"json-pointer",
|
|
122
|
+
"relative-json-pointer",
|
|
123
|
+
"regex"
|
|
124
|
+
]);
|
|
125
|
+
var SERVED_FORMAT = "x-stitchkit-served-format";
|
|
126
|
+
function withServedFormats(schema) {
|
|
127
|
+
const carried = {};
|
|
128
|
+
for (const [key, child] of Object.entries(schema)) {
|
|
129
|
+
if (SCHEMA_KEYWORDS.includes(key))
|
|
130
|
+
carried[key] = carriedSchema(child);
|
|
131
|
+
else if (SCHEMA_LIST_KEYWORDS.includes(key) && Array.isArray(child)) {
|
|
132
|
+
carried[key] = child.map(carriedSchema);
|
|
133
|
+
} else if (SCHEMA_MAP_KEYWORDS.includes(key) && isRecord(child)) {
|
|
134
|
+
carried[key] = Object.fromEntries(Object.entries(child).map(([name, member]) => [name, carriedSchema(member)]));
|
|
135
|
+
} else
|
|
136
|
+
carried[key] = child;
|
|
137
|
+
}
|
|
138
|
+
if (typeof schema.format === "string")
|
|
139
|
+
carried[SERVED_FORMAT] = schema.format;
|
|
140
|
+
return carried;
|
|
141
|
+
}
|
|
142
|
+
function carriedSchema(schema) {
|
|
143
|
+
return isRecord(schema) ? withServedFormats(schema) : schema;
|
|
144
|
+
}
|
|
145
|
+
var readerExpressions = new Map;
|
|
146
|
+
function readerExpression(format) {
|
|
147
|
+
if (!readerExpressions.has(format)) {
|
|
148
|
+
const read = z.fromJSONSchema({ type: "string", format });
|
|
149
|
+
readerExpressions.set(format, z.toJSONSchema(read).pattern);
|
|
150
|
+
}
|
|
151
|
+
return readerExpressions.get(format);
|
|
152
|
+
}
|
|
153
|
+
function beforePatterns(schema) {
|
|
154
|
+
const def = schema._zod.def;
|
|
155
|
+
if (def.type !== "string")
|
|
156
|
+
return;
|
|
157
|
+
const checks = def.checks ?? [];
|
|
158
|
+
const named = checks.filter((check) => !(check instanceof z.core.$ZodCheckRegex));
|
|
159
|
+
if (named.length === checks.length)
|
|
160
|
+
return;
|
|
161
|
+
return z.toJSONSchema(z.core.clone(schema, { ...def, checks: named }));
|
|
162
|
+
}
|
|
163
|
+
function isPatternOnly(member) {
|
|
164
|
+
return typeof member.pattern === "string" && Object.keys(member).every((key) => key === "pattern" || key === "type");
|
|
165
|
+
}
|
|
166
|
+
function nameFormat(json, format, implied) {
|
|
167
|
+
json.format = format;
|
|
168
|
+
if (implied === undefined || json.allOf === undefined)
|
|
169
|
+
return;
|
|
170
|
+
const kept = [];
|
|
171
|
+
for (const member of json.allOf) {
|
|
172
|
+
if (isPatternOnly(member) && kept.some((other) => other.pattern === member.pattern))
|
|
173
|
+
continue;
|
|
174
|
+
kept.push(member);
|
|
175
|
+
}
|
|
176
|
+
const own = kept.filter((member) => isPatternOnly(member) && member.pattern !== implied);
|
|
177
|
+
const stated = own.length === 0 ? kept : kept.filter((member) => member.pattern !== implied);
|
|
178
|
+
const [only] = stated;
|
|
179
|
+
if (stated.length === 1 && only !== undefined && isPatternOnly(only)) {
|
|
180
|
+
delete json.allOf;
|
|
181
|
+
json.pattern = only.pattern;
|
|
182
|
+
} else
|
|
183
|
+
json.allOf = stated;
|
|
184
|
+
}
|
|
185
|
+
function keepFormatName(ctx) {
|
|
186
|
+
const { zodSchema, jsonSchema } = ctx;
|
|
187
|
+
const served = jsonSchema[SERVED_FORMAT];
|
|
188
|
+
delete jsonSchema[SERVED_FORMAT];
|
|
189
|
+
if (typeof served !== "string") {
|
|
190
|
+
if (jsonSchema.format !== undefined)
|
|
191
|
+
return;
|
|
192
|
+
const named = beforePatterns(zodSchema);
|
|
193
|
+
if (named?.format === undefined || !STANDARD_STRING_FORMATS.has(named.format))
|
|
194
|
+
return;
|
|
195
|
+
if (named.pattern !== readerExpression(named.format))
|
|
196
|
+
return;
|
|
197
|
+
nameFormat(jsonSchema, named.format, named.pattern);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (jsonSchema.anyOf === undefined) {
|
|
201
|
+
nameFormat(jsonSchema, served, readerExpression(served));
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
for (const member of jsonSchema.anyOf) {
|
|
205
|
+
if (member.type !== "null" && member.format === undefined) {
|
|
206
|
+
nameFormat(member, served, readerExpression(served));
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// src/json-schema/json-schema.ts
|
|
212
|
+
function toJsonSchema(schema, io, unrepresentable = "throw", target = "draft-2020-12") {
|
|
213
|
+
return z2.toJSONSchema(schema, {
|
|
214
|
+
io,
|
|
215
|
+
target,
|
|
216
|
+
unrepresentable,
|
|
217
|
+
cycles: "ref",
|
|
218
|
+
override: keepFormatName
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
function isObjectNode(value) {
|
|
222
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
223
|
+
}
|
|
224
|
+
function jsonSchemaFields(jsonSchema) {
|
|
225
|
+
const properties = jsonSchema.properties;
|
|
226
|
+
if (!isObjectNode(properties)) {
|
|
227
|
+
const conjunctive = Array.isArray(jsonSchema.allOf);
|
|
228
|
+
const members = conjunctive ? jsonSchema.allOf : Array.isArray(jsonSchema.oneOf) ? jsonSchema.oneOf : Array.isArray(jsonSchema.anyOf) ? jsonSchema.anyOf : [];
|
|
229
|
+
const byName = new Map;
|
|
230
|
+
for (const member of Array.isArray(members) ? members : []) {
|
|
231
|
+
if (!isObjectNode(member))
|
|
232
|
+
continue;
|
|
233
|
+
for (const field of jsonSchemaFields(member)) {
|
|
234
|
+
const existing = byName.get(field.name);
|
|
235
|
+
const required = existing ? conjunctive ? existing.required || field.required : existing.required && field.required : field.required;
|
|
236
|
+
byName.set(field.name, existing ? { ...field, required } : field);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return [...byName.values()];
|
|
240
|
+
}
|
|
241
|
+
const required = new Set(Array.isArray(jsonSchema.required) ? jsonSchema.required.filter((k) => typeof k === "string") : []);
|
|
242
|
+
const fields = [];
|
|
243
|
+
for (const [name, raw] of Object.entries(properties)) {
|
|
244
|
+
const schema = isObjectNode(raw) ? raw : {};
|
|
245
|
+
const description = typeof schema.description === "string" ? schema.description : undefined;
|
|
246
|
+
fields.push({
|
|
247
|
+
name,
|
|
248
|
+
schema,
|
|
249
|
+
required: required.has(name),
|
|
250
|
+
...description && { description }
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
return fields;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export { declaresDraft07, withDraft2020Keywords, STANDARD_STRING_FORMATS, withServedFormats, toJsonSchema, jsonSchemaFields };
|
|
@@ -8,9 +8,10 @@ import {
|
|
|
8
8
|
coerceJsonArgs2
|
|
9
9
|
} from "./index-t8jz0e20.js";
|
|
10
10
|
import {
|
|
11
|
+
STANDARD_STRING_FORMATS,
|
|
11
12
|
toJsonSchema,
|
|
12
13
|
jsonSchemaFields
|
|
13
|
-
} from "./index-
|
|
14
|
+
} from "./index-5dmk54h9.js";
|
|
14
15
|
import {
|
|
15
16
|
toolSurfaceOutputSchema,
|
|
16
17
|
objectShapeKeys,
|
|
@@ -18,15 +19,15 @@ import {
|
|
|
18
19
|
toToolName,
|
|
19
20
|
assertUniqueToolName,
|
|
20
21
|
buildToolPresentationSchema
|
|
21
|
-
} from "./index-
|
|
22
|
+
} from "./index-rk7m4j7r.js";
|
|
22
23
|
import {
|
|
23
24
|
toolResultFromError,
|
|
24
25
|
toolErrorFromResult
|
|
25
|
-
} from "./index-
|
|
26
|
+
} from "./index-1wz4y15d.js";
|
|
26
27
|
import {
|
|
27
28
|
createToolRunner,
|
|
28
29
|
formatToolError
|
|
29
|
-
} from "./index-
|
|
30
|
+
} from "./index-x68eyh6y.js";
|
|
30
31
|
import {
|
|
31
32
|
isRepeatableRead
|
|
32
33
|
} from "./index-332d0m9g.js";
|
|
@@ -53,7 +54,7 @@ import {
|
|
|
53
54
|
} from "./index-9cxxfkhb.js";
|
|
54
55
|
import {
|
|
55
56
|
collectToolSurface
|
|
56
|
-
} from "./index-
|
|
57
|
+
} from "./index-q7s1yr9g.js";
|
|
57
58
|
import {
|
|
58
59
|
fetchGuarded,
|
|
59
60
|
readCapped
|
|
@@ -1157,8 +1158,19 @@ function typeLabel(schema) {
|
|
|
1157
1158
|
return schema.type;
|
|
1158
1159
|
return "value";
|
|
1159
1160
|
}
|
|
1161
|
+
function isPatternOnly(member) {
|
|
1162
|
+
return isRecord(member) && typeof member.pattern === "string" && Object.keys(member).every((key) => key === "pattern" || key === "type");
|
|
1163
|
+
}
|
|
1160
1164
|
function constraintLabel(schema) {
|
|
1161
1165
|
const limits = [];
|
|
1166
|
+
const format = typeof schema.format === "string" ? schema.format : undefined;
|
|
1167
|
+
const pattern = typeof schema.pattern === "string" ? schema.pattern : undefined;
|
|
1168
|
+
const named = format !== undefined && STANDARD_STRING_FORMATS.has(format);
|
|
1169
|
+
if (format !== undefined && (named || pattern === undefined)) {
|
|
1170
|
+
limits.push(format);
|
|
1171
|
+
} else if (pattern !== undefined) {
|
|
1172
|
+
limits.push(`pattern /${pattern}/`);
|
|
1173
|
+
}
|
|
1162
1174
|
const bounds = [
|
|
1163
1175
|
["minimum", ">="],
|
|
1164
1176
|
["exclusiveMinimum", ">"],
|
|
@@ -1186,7 +1198,8 @@ function constraintLabel(schema) {
|
|
|
1186
1198
|
const members = schema[keyword];
|
|
1187
1199
|
if (!Array.isArray(members))
|
|
1188
1200
|
continue;
|
|
1189
|
-
const
|
|
1201
|
+
const stated = named && keyword === "allOf" ? members.filter((member) => !isPatternOnly(member)) : members;
|
|
1202
|
+
const branches = stated.map((member) => {
|
|
1190
1203
|
const constraints = isRecord(member) ? constraintLabel(member) : "";
|
|
1191
1204
|
const type = isRecord(member) ? typeLabel(member) : member === false ? "no value" : "any value";
|
|
1192
1205
|
return { constraints, text: `${type}${constraints}` };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
projectToolSurface
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-rk7m4j7r.js";
|
|
4
4
|
import {
|
|
5
5
|
contractToolMountable
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-x68eyh6y.js";
|
|
7
7
|
import {
|
|
8
8
|
runtimeToolMountable
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-r7v5xz0g.js";
|
|
10
10
|
|
|
11
11
|
// src/tools/surface.ts
|
|
12
12
|
function collectToolSurface({
|