stitchkit 0.124.3 → 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 +24 -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/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-7rq5p3hk.js → index-a3ekss9t.js} +13 -28
- 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/tools/cli/help.d.ts.map +1 -1
- package/dist/tools/connections/runtime.d.ts.map +1 -1
- package/llms/cli.txt +6 -3
- package/llms-full.txt +6 -3
- package/llms.txt +1 -1
- package/package.json +1 -1
- package/dist/index-ct75c3at.js +0 -46
|
@@ -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,32 +1158,15 @@ function typeLabel(schema) {
|
|
|
1157
1158
|
return schema.type;
|
|
1158
1159
|
return "value";
|
|
1159
1160
|
}
|
|
1160
|
-
|
|
1161
|
-
"
|
|
1162
|
-
|
|
1163
|
-
"time",
|
|
1164
|
-
"duration",
|
|
1165
|
-
"email",
|
|
1166
|
-
"idn-email",
|
|
1167
|
-
"hostname",
|
|
1168
|
-
"idn-hostname",
|
|
1169
|
-
"ipv4",
|
|
1170
|
-
"ipv6",
|
|
1171
|
-
"uri",
|
|
1172
|
-
"uri-reference",
|
|
1173
|
-
"iri",
|
|
1174
|
-
"iri-reference",
|
|
1175
|
-
"uuid",
|
|
1176
|
-
"uri-template",
|
|
1177
|
-
"json-pointer",
|
|
1178
|
-
"relative-json-pointer",
|
|
1179
|
-
"regex"
|
|
1180
|
-
]);
|
|
1161
|
+
function isPatternOnly(member) {
|
|
1162
|
+
return isRecord(member) && typeof member.pattern === "string" && Object.keys(member).every((key) => key === "pattern" || key === "type");
|
|
1163
|
+
}
|
|
1181
1164
|
function constraintLabel(schema) {
|
|
1182
1165
|
const limits = [];
|
|
1183
1166
|
const format = typeof schema.format === "string" ? schema.format : undefined;
|
|
1184
1167
|
const pattern = typeof schema.pattern === "string" ? schema.pattern : undefined;
|
|
1185
|
-
|
|
1168
|
+
const named = format !== undefined && STANDARD_STRING_FORMATS.has(format);
|
|
1169
|
+
if (format !== undefined && (named || pattern === undefined)) {
|
|
1186
1170
|
limits.push(format);
|
|
1187
1171
|
} else if (pattern !== undefined) {
|
|
1188
1172
|
limits.push(`pattern /${pattern}/`);
|
|
@@ -1214,7 +1198,8 @@ function constraintLabel(schema) {
|
|
|
1214
1198
|
const members = schema[keyword];
|
|
1215
1199
|
if (!Array.isArray(members))
|
|
1216
1200
|
continue;
|
|
1217
|
-
const
|
|
1201
|
+
const stated = named && keyword === "allOf" ? members.filter((member) => !isPatternOnly(member)) : members;
|
|
1202
|
+
const branches = stated.map((member) => {
|
|
1218
1203
|
const constraints = isRecord(member) ? constraintLabel(member) : "";
|
|
1219
1204
|
const type = isRecord(member) ? typeLabel(member) : member === false ? "no value" : "any value";
|
|
1220
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({
|
|
@@ -2,8 +2,9 @@ import {
|
|
|
2
2
|
validateDeclaredOutput
|
|
3
3
|
} from "./index-ndjzbt2v.js";
|
|
4
4
|
import {
|
|
5
|
+
withDraft2020Keywords,
|
|
5
6
|
toJsonSchema
|
|
6
|
-
} from "./index-
|
|
7
|
+
} from "./index-5dmk54h9.js";
|
|
7
8
|
import {
|
|
8
9
|
isHttpOnlyEndpoint
|
|
9
10
|
} from "./index-yt1gg11x.js";
|
|
@@ -314,98 +315,6 @@ function findNonPortableFormats2(schema, allowFormats = []) {
|
|
|
314
315
|
// src/tools/schema/presentation.ts
|
|
315
316
|
import { z as z2 } from "zod";
|
|
316
317
|
|
|
317
|
-
// src/json-schema/dialect.ts
|
|
318
|
-
var DRAFT_07_MARKER = "draft-07";
|
|
319
|
-
var DRAFT_07_KEYWORD = "definitions";
|
|
320
|
-
var DEFS_KEYWORD = "$defs";
|
|
321
|
-
var SCHEMA_KEYWORDS = [
|
|
322
|
-
"items",
|
|
323
|
-
"additionalItems",
|
|
324
|
-
"additionalProperties",
|
|
325
|
-
"contains",
|
|
326
|
-
"propertyNames",
|
|
327
|
-
"not",
|
|
328
|
-
"if",
|
|
329
|
-
"then",
|
|
330
|
-
"else",
|
|
331
|
-
"unevaluatedItems",
|
|
332
|
-
"unevaluatedProperties"
|
|
333
|
-
];
|
|
334
|
-
var SCHEMA_LIST_KEYWORDS = ["allOf", "anyOf", "oneOf", "prefixItems"];
|
|
335
|
-
var SCHEMA_MAP_KEYWORDS = [
|
|
336
|
-
"properties",
|
|
337
|
-
"patternProperties",
|
|
338
|
-
"dependentSchemas",
|
|
339
|
-
DRAFT_07_KEYWORD,
|
|
340
|
-
DEFS_KEYWORD
|
|
341
|
-
];
|
|
342
|
-
function declaresDraft07(dialect) {
|
|
343
|
-
return typeof dialect === "string" && dialect.includes(DRAFT_07_MARKER);
|
|
344
|
-
}
|
|
345
|
-
function rewriteDefinitionPointers(value) {
|
|
346
|
-
if (Array.isArray(value))
|
|
347
|
-
return value.map(rewriteDefinitionPointers);
|
|
348
|
-
if (!isRecord(value))
|
|
349
|
-
return value;
|
|
350
|
-
const rewritten = {};
|
|
351
|
-
for (const [key, child] of Object.entries(value)) {
|
|
352
|
-
rewritten[key] = key === "$ref" && typeof child === "string" && child.startsWith(`#/${DRAFT_07_KEYWORD}/`) ? `#/${DEFS_KEYWORD}/${child.slice(`#/${DRAFT_07_KEYWORD}/`.length)}` : rewriteDefinitionPointers(child);
|
|
353
|
-
}
|
|
354
|
-
return rewritten;
|
|
355
|
-
}
|
|
356
|
-
function mapValues(value, rewrite) {
|
|
357
|
-
if (!isRecord(value))
|
|
358
|
-
return value;
|
|
359
|
-
const rewritten = {};
|
|
360
|
-
for (const [name, child] of Object.entries(value))
|
|
361
|
-
rewritten[name] = rewrite(child);
|
|
362
|
-
return rewritten;
|
|
363
|
-
}
|
|
364
|
-
function withPositionalItems(schema) {
|
|
365
|
-
if (!isRecord(schema))
|
|
366
|
-
return schema;
|
|
367
|
-
const rewritten = {};
|
|
368
|
-
for (const [key, child] of Object.entries(schema)) {
|
|
369
|
-
if (SCHEMA_KEYWORDS.includes(key))
|
|
370
|
-
rewritten[key] = withPositionalItems(child);
|
|
371
|
-
else if (SCHEMA_LIST_KEYWORDS.includes(key) && Array.isArray(child)) {
|
|
372
|
-
rewritten[key] = child.map(withPositionalItems);
|
|
373
|
-
} else if (SCHEMA_MAP_KEYWORDS.includes(key)) {
|
|
374
|
-
rewritten[key] = mapValues(child, withPositionalItems);
|
|
375
|
-
} else
|
|
376
|
-
rewritten[key] = child;
|
|
377
|
-
}
|
|
378
|
-
const { items, additionalItems } = rewritten;
|
|
379
|
-
if (!Array.isArray(items))
|
|
380
|
-
return rewritten;
|
|
381
|
-
const positional = {};
|
|
382
|
-
for (const [key, child] of Object.entries(rewritten)) {
|
|
383
|
-
if (key === "items")
|
|
384
|
-
positional.prefixItems = items;
|
|
385
|
-
else if (key !== "additionalItems")
|
|
386
|
-
positional[key] = child;
|
|
387
|
-
}
|
|
388
|
-
if (additionalItems !== undefined)
|
|
389
|
-
positional.items = additionalItems;
|
|
390
|
-
return positional;
|
|
391
|
-
}
|
|
392
|
-
function withDraft2020Keywords(schema) {
|
|
393
|
-
const positional = withPositionalItems(schema);
|
|
394
|
-
if (!isRecord(positional))
|
|
395
|
-
return schema;
|
|
396
|
-
const definitions = positional[DRAFT_07_KEYWORD];
|
|
397
|
-
if (!isRecord(definitions) || DEFS_KEYWORD in positional)
|
|
398
|
-
return positional;
|
|
399
|
-
const rewritten = {};
|
|
400
|
-
for (const [key, value] of Object.entries(positional)) {
|
|
401
|
-
if (key === DRAFT_07_KEYWORD)
|
|
402
|
-
continue;
|
|
403
|
-
rewritten[key] = rewriteDefinitionPointers(value);
|
|
404
|
-
}
|
|
405
|
-
rewritten[DEFS_KEYWORD] = rewriteDefinitionPointers(definitions);
|
|
406
|
-
return rewritten;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
318
|
// src/tools/schema/flatten-join.ts
|
|
410
319
|
var ANNOTATION_KEYS = new Set(["$schema", "default", "description", "examples", "title"]);
|
|
411
320
|
var TYPE_KEYWORDS = {
|
|
@@ -1307,4 +1216,4 @@ function prepareProjectedMcpTools(tools, config = {}) {
|
|
|
1307
1216
|
return prepared;
|
|
1308
1217
|
}
|
|
1309
1218
|
|
|
1310
|
-
export { toolSurfaceOutputSchema, applyToolViewDefaults, projectToolView, objectShapeKeys, rebuildObject, mergeSchemas, staticInputRounds, validateMcpRoundPolicy, validateResolvedInputRounds, assertToolName, toToolName, assertUniqueToolName, PORTABLE_JSON_SCHEMA_FORMATS2, findNonPortableFormats2,
|
|
1219
|
+
export { toolSurfaceOutputSchema, applyToolViewDefaults, projectToolView, objectShapeKeys, rebuildObject, mergeSchemas, staticInputRounds, validateMcpRoundPolicy, validateResolvedInputRounds, assertToolName, toToolName, assertUniqueToolName, PORTABLE_JSON_SCHEMA_FORMATS2, findNonPortableFormats2, flattenToolJsonSchema2, buildToolPresentationSchema, presentationMetadata, findUntypedProperties2, assertToolExtensionCompatible, projectRuntimeTool, projectToolSurface, mcpProjectionCandidate, prepareProjectedMcpTools };
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
mergeSchemas,
|
|
4
4
|
assertToolExtensionCompatible,
|
|
5
5
|
projectToolSurface
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-rk7m4j7r.js";
|
|
7
7
|
import {
|
|
8
8
|
toolErrorFromResult,
|
|
9
9
|
executeToolMethod
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-1wz4y15d.js";
|
|
11
11
|
import {
|
|
12
12
|
isRetryableStatus2
|
|
13
13
|
} from "./index-0w0hxp7n.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
assertUniqueToolName
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-rk7m4j7r.js";
|
|
4
4
|
import {
|
|
5
5
|
toolErrorFromResult
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-1wz4y15d.js";
|
|
7
7
|
import {
|
|
8
8
|
collectTools2,
|
|
9
9
|
createToolRunner
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-x68eyh6y.js";
|
|
11
11
|
import {
|
|
12
12
|
AppError2
|
|
13
13
|
} from "./index-0w0hxp7n.js";
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/** Keywords whose value is one subschema. */
|
|
2
|
+
export declare const SCHEMA_KEYWORDS: string[];
|
|
3
|
+
/** Keywords whose value is a list of subschemas. */
|
|
4
|
+
export declare const SCHEMA_LIST_KEYWORDS: string[];
|
|
5
|
+
/** Keywords whose value maps a name to a subschema. */
|
|
6
|
+
export declare const SCHEMA_MAP_KEYWORDS: string[];
|
|
1
7
|
/** True when a document says, in its own `$schema`, that it is draft-07. */
|
|
2
8
|
export declare function declaresDraft07(dialect: unknown): boolean;
|
|
3
9
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialect.d.ts","sourceRoot":"","sources":["../../src/json-schema/dialect.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dialect.d.ts","sourceRoot":"","sources":["../../src/json-schema/dialect.ts"],"names":[],"mappings":"AAQA,6CAA6C;AAC7C,eAAO,MAAM,eAAe,UAY3B,CAAC;AACF,oDAAoD;AACpD,eAAO,MAAM,oBAAoB,UAA6C,CAAC;AAC/E,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,UAM/B,CAAC;AAEF,4EAA4E;AAC5E,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAEzD;AAmDD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAYzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema.d.ts","sourceRoot":"","sources":["../../src/json-schema/json-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"json-schema.d.ts","sourceRoot":"","sources":["../../src/json-schema/json-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,+EAA+E;AAC/E,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE9C;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,CAAC,CAAC,OAAO,EACjB,EAAE,EAAE,YAAY,EAChB,eAAe,GAAE,OAAO,GAAG,KAAe,EAC1C,MAAM,GAAE,UAAU,GAAG,eAAiC,GACrD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQzB;AAED,uDAAuD;AACvD,MAAM,WAAW,eAAe;IAC9B,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,+DAA+D;IAC/D,QAAQ,EAAE,OAAO,CAAC;IAClB,yDAAyD;IACzD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAOD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,eAAe,EAAE,CA+CvF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** The string formats of the JSON Schema validation vocabulary (2020-12, §7.3). */
|
|
3
|
+
export declare const STANDARD_STRING_FORMATS: ReadonlySet<string>;
|
|
4
|
+
/**
|
|
5
|
+
* Copy every `format` of a foreign document into an annotation Zod carries.
|
|
6
|
+
*
|
|
7
|
+
* Read into Zod, `uri-reference` becomes `uri`, `time` a bare expression, and
|
|
8
|
+
* `idn-email`, `iri`, `json-pointer` and the rest nothing at all; a format next to
|
|
9
|
+
* a `pattern` loses its name whichever it is. The word is the server's statement
|
|
10
|
+
* about its own argument, so it is carried beside the schema and written back by
|
|
11
|
+
* `keepFormatName`. The walk follows schema keywords only: a `default`, an `enum`
|
|
12
|
+
* value or a property called "format" is left as written.
|
|
13
|
+
*/
|
|
14
|
+
export declare function withServedFormats(schema: Record<string, unknown>): Record<string, unknown>;
|
|
15
|
+
type JsonNode = z.core.JSONSchema.BaseSchema;
|
|
16
|
+
/**
|
|
17
|
+
* Keep the name of a format on the document Zod writes.
|
|
18
|
+
*
|
|
19
|
+
* Zod lets a `.regex()` take the place of the format it follows: `z.uuid().regex(p)`
|
|
20
|
+
* is written as two patterns and no `format`, and every string restored from a
|
|
21
|
+
* served document that states both keywords is exactly that schema. So a format a
|
|
22
|
+
* server declared did not survive the trip through Zod, and a reader was shown the
|
|
23
|
+
* expression instead of the name.
|
|
24
|
+
*
|
|
25
|
+
* A served format is written back as the server spelled it. An authored string is
|
|
26
|
+
* named when the name says all its format check does — `z.uuid().regex(p)`. Where
|
|
27
|
+
* the check is narrower or wider than its name (`z.uuidv4()`, `z.guid()`, a
|
|
28
|
+
* datetime that takes only `Z`) or the word is a producer's own (`starts_with`),
|
|
29
|
+
* the document stays as Zod wrote it: there the expression is the meaning.
|
|
30
|
+
*/
|
|
31
|
+
export declare function keepFormatName(ctx: {
|
|
32
|
+
zodSchema: z.core.$ZodTypes;
|
|
33
|
+
jsonSchema: JsonNode;
|
|
34
|
+
}): void;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=string-format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-format.d.ts","sourceRoot":"","sources":["../../src/json-schema/string-format.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,mFAAmF;AACnF,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAoBtD,CAAC;AASH;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAc1F;AAMD,KAAK,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;AAoD7C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE;IAClC,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;IAC5B,UAAU,EAAE,QAAQ,CAAC;CACtB,GAAG,IAAI,CAuBP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/help.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,eAAe,EAAoB,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/help.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,eAAe,EAAoB,MAAM,+BAA+B,CAAC;AAGvF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AA6JvD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC,EAC7C,MAAM,EAAE,MAAM,GACb,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC,CASrC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,SAAS,eAAe,EAAE,CAAC;IAC/C,wEAAwE;IACxE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,MAAM,CAyCT;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,sBAAsB,EAClC,kBAAkB,GAAE,SAAS,eAAe,EAAO,GAClD,MAAM,CA4ER"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/tools/connections/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAK,MAAM,KAAK,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/tools/connections/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAK,MAAM,KAAK,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAGrE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAO7D,oEAAoE;AACpE,MAAM,MAAM,uBAAuB,GAAG,CACpC,OAAO,CAAC,EAAE,cAAc,KACrB,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AAEtD,UAAU,cAAc;IACtB,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,CAAC,EACzC,MAAM,EAAE;IACN,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,uBAAuB,CAAC;IACnC,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B,EACD,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,GAC9C,OAAO,CAAC,CAAC,CAAC,CAUZ;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC1C,SAAS,CASX;AAcD,wEAAwE;AACxE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,sEAAsE;AACtE,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,0BAA0B,GAAG,CAAC,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAC;AAElF,6EAA6E;AAC7E,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAIhF;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EACzC,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,EACjC,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,qBAAqB,EAC/C,SAAS,EAAE,0BAA0B,GACpC,qBAAqB,EAAE,CAczB"}
|