@easynet/agent-tool 1.0.35 → 1.0.37
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/api/expose/extension-init/index.d.ts +3 -0
- package/dist/api/expose/extension-init/index.d.ts.map +1 -0
- package/dist/api/expose/extension-init/initExtension.d.ts +19 -0
- package/dist/api/expose/extension-init/initExtension.d.ts.map +1 -0
- package/dist/api/extension/index.d.ts +1 -0
- package/dist/api/extension/index.d.ts.map +1 -1
- package/dist/api/extension/overrideWithConfig.d.ts +6 -0
- package/dist/api/extension/overrideWithConfig.d.ts.map +1 -0
- package/dist/api/main.cjs +15 -15
- package/dist/api/main.js +4 -4
- package/dist/canonicalCoreSchemas-PHGTNPN5.js +3 -0
- package/dist/{canonicalCoreSchemas-3BZJH6XD.js.map → canonicalCoreSchemas-PHGTNPN5.js.map} +1 -1
- package/dist/canonicalCoreSchemas-TY7NCWCC.cjs +16 -0
- package/dist/{canonicalCoreSchemas-P6KUD3WP.cjs.map → canonicalCoreSchemas-TY7NCWCC.cjs.map} +1 -1
- package/dist/{chunk-S27O27OH.cjs → chunk-4HPV2K7P.cjs} +17 -17
- package/dist/{chunk-S27O27OH.cjs.map → chunk-4HPV2K7P.cjs.map} +1 -1
- package/dist/{chunk-PSVSVTHY.js → chunk-7VBJ64YC.js} +69 -7
- package/dist/chunk-7VBJ64YC.js.map +1 -0
- package/dist/{chunk-P25NBSPT.cjs → chunk-DTWOUO7M.cjs} +10 -10
- package/dist/{chunk-P25NBSPT.cjs.map → chunk-DTWOUO7M.cjs.map} +1 -1
- package/dist/{chunk-U3CAAURW.js → chunk-HEMWFWSK.js} +3 -3
- package/dist/{chunk-U3CAAURW.js.map → chunk-HEMWFWSK.js.map} +1 -1
- package/dist/{chunk-2WDDJYR7.cjs → chunk-LP7KHBA3.cjs} +70 -8
- package/dist/chunk-LP7KHBA3.cjs.map +1 -0
- package/dist/{chunk-RRVM6JBA.js → chunk-NCPOKCX5.js} +4 -4
- package/dist/{chunk-RRVM6JBA.js.map → chunk-NCPOKCX5.js.map} +1 -1
- package/dist/{chunk-DDIGAOYI.js → chunk-NJ46JOBI.js} +5 -5
- package/dist/{chunk-DDIGAOYI.js.map → chunk-NJ46JOBI.js.map} +1 -1
- package/dist/chunk-NTWOVFEY.js +16 -0
- package/dist/chunk-NTWOVFEY.js.map +1 -0
- package/dist/chunk-UUNG3GL3.cjs +19 -0
- package/dist/chunk-UUNG3GL3.cjs.map +1 -0
- package/dist/{chunk-Z5STQ2JO.cjs → chunk-WFRHBW32.cjs} +9 -9
- package/dist/{chunk-Z5STQ2JO.cjs.map → chunk-WFRHBW32.cjs.map} +1 -1
- package/dist/index.cjs +64 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -7
- package/dist/index.js.map +1 -1
- package/dist/tools/util/canonicalCoreSchemas.d.ts +6 -10
- package/dist/tools/util/canonicalCoreSchemas.d.ts.map +1 -1
- package/dist/tools/util/toolDescriptor.d.ts +3 -2
- package/dist/tools/util/toolDescriptor.d.ts.map +1 -1
- package/dist/utils/cli/index.cjs +235 -33
- package/dist/utils/cli/index.cjs.map +1 -1
- package/dist/utils/cli/index.d.ts.map +1 -1
- package/dist/utils/cli/index.js +202 -16
- package/dist/utils/cli/index.js.map +1 -1
- package/dist/utils/npmCache.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/canonicalCoreSchemas-3BZJH6XD.js +0 -4
- package/dist/canonicalCoreSchemas-P6KUD3WP.cjs +0 -21
- package/dist/chunk-2WDDJYR7.cjs.map +0 -1
- package/dist/chunk-3MUOBLNB.js +0 -243
- package/dist/chunk-3MUOBLNB.js.map +0 -1
- package/dist/chunk-4KTWJQ32.cjs +0 -247
- package/dist/chunk-4KTWJQ32.cjs.map +0 -1
- package/dist/chunk-PSVSVTHY.js.map +0 -1
package/dist/chunk-3MUOBLNB.js
DELETED
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
import { normalizeToolName } from './chunk-KDB3MY2H.js';
|
|
2
|
-
|
|
3
|
-
// src/tools/util/canonicalCoreSchemas.ts
|
|
4
|
-
var S = (o) => o;
|
|
5
|
-
var CORE_TOOL_SCHEMAS = {
|
|
6
|
-
"core/fs.readText": {
|
|
7
|
-
inputSchema: S({
|
|
8
|
-
type: "object",
|
|
9
|
-
properties: {
|
|
10
|
-
path: { type: "string", description: "Path to the file (within sandbox)" },
|
|
11
|
-
maxBytes: { type: "number", description: "Max bytes to read (optional)" }
|
|
12
|
-
},
|
|
13
|
-
required: ["path"],
|
|
14
|
-
additionalProperties: false
|
|
15
|
-
}),
|
|
16
|
-
outputSchema: S({
|
|
17
|
-
type: "object",
|
|
18
|
-
properties: {
|
|
19
|
-
result: {
|
|
20
|
-
type: "object",
|
|
21
|
-
properties: {
|
|
22
|
-
path: { type: "string" },
|
|
23
|
-
text: { type: "string" },
|
|
24
|
-
bytes: { type: "number" }
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
})
|
|
29
|
-
},
|
|
30
|
-
"core.fs.writeText": {
|
|
31
|
-
inputSchema: S({
|
|
32
|
-
type: "object",
|
|
33
|
-
properties: {
|
|
34
|
-
path: { type: "string", description: "Path to write (within sandbox)" },
|
|
35
|
-
content: { type: "string", description: "UTF-8 content to write" }
|
|
36
|
-
},
|
|
37
|
-
required: ["path", "content"],
|
|
38
|
-
additionalProperties: false
|
|
39
|
-
})
|
|
40
|
-
},
|
|
41
|
-
"core.fs.listDir": {
|
|
42
|
-
inputSchema: S({
|
|
43
|
-
type: "object",
|
|
44
|
-
properties: {
|
|
45
|
-
path: { type: "string", description: "Directory path (within sandbox)" },
|
|
46
|
-
maxEntries: { type: "number", description: "Max entries to return (optional)" }
|
|
47
|
-
},
|
|
48
|
-
required: ["path"],
|
|
49
|
-
additionalProperties: false
|
|
50
|
-
})
|
|
51
|
-
},
|
|
52
|
-
"core.fs.searchText": {
|
|
53
|
-
inputSchema: S({
|
|
54
|
-
type: "object",
|
|
55
|
-
properties: {
|
|
56
|
-
path: { type: "string", description: "Path to file or directory" },
|
|
57
|
-
pattern: { type: "string", description: "Search pattern (regex or literal)" },
|
|
58
|
-
maxMatches: { type: "number", description: "Max matches (optional)" }
|
|
59
|
-
},
|
|
60
|
-
required: ["path", "pattern"],
|
|
61
|
-
additionalProperties: false
|
|
62
|
-
})
|
|
63
|
-
},
|
|
64
|
-
"core.fs.sha256": {
|
|
65
|
-
inputSchema: S({
|
|
66
|
-
type: "object",
|
|
67
|
-
properties: {
|
|
68
|
-
path: { type: "string", description: "Path to file (within sandbox)" }
|
|
69
|
-
},
|
|
70
|
-
required: ["path"],
|
|
71
|
-
additionalProperties: false
|
|
72
|
-
})
|
|
73
|
-
},
|
|
74
|
-
"core.fs.deletePath": {
|
|
75
|
-
inputSchema: S({
|
|
76
|
-
type: "object",
|
|
77
|
-
properties: {
|
|
78
|
-
path: { type: "string", description: "Path to delete (within sandbox)" }
|
|
79
|
-
},
|
|
80
|
-
required: ["path"],
|
|
81
|
-
additionalProperties: false
|
|
82
|
-
})
|
|
83
|
-
},
|
|
84
|
-
"core.http.fetchText": {
|
|
85
|
-
inputSchema: S({
|
|
86
|
-
type: "object",
|
|
87
|
-
properties: {
|
|
88
|
-
url: { type: "string", description: "URL to fetch" },
|
|
89
|
-
headers: { type: "object", additionalProperties: { type: "string" }, description: "Optional request headers" },
|
|
90
|
-
timeoutMs: { type: "number", description: "Request timeout in ms (optional)" }
|
|
91
|
-
},
|
|
92
|
-
required: ["url"],
|
|
93
|
-
additionalProperties: false
|
|
94
|
-
})
|
|
95
|
-
},
|
|
96
|
-
"core.http.fetchJson": {
|
|
97
|
-
inputSchema: S({
|
|
98
|
-
type: "object",
|
|
99
|
-
properties: {
|
|
100
|
-
url: { type: "string", description: "URL to fetch" },
|
|
101
|
-
headers: { type: "object", additionalProperties: { type: "string" } }
|
|
102
|
-
},
|
|
103
|
-
required: ["url"],
|
|
104
|
-
additionalProperties: false
|
|
105
|
-
})
|
|
106
|
-
},
|
|
107
|
-
"core.http.downloadFile": {
|
|
108
|
-
inputSchema: S({
|
|
109
|
-
type: "object",
|
|
110
|
-
properties: {
|
|
111
|
-
url: { type: "string", description: "URL to download" },
|
|
112
|
-
destPath: { type: "string", description: "Destination path (within sandbox)" },
|
|
113
|
-
headers: { type: "object", additionalProperties: { type: "string" } }
|
|
114
|
-
},
|
|
115
|
-
required: ["url", "destPath"],
|
|
116
|
-
additionalProperties: false
|
|
117
|
-
})
|
|
118
|
-
},
|
|
119
|
-
"core.http.head": {
|
|
120
|
-
inputSchema: S({
|
|
121
|
-
type: "object",
|
|
122
|
-
properties: {
|
|
123
|
-
url: { type: "string", description: "URL for HEAD request" }
|
|
124
|
-
},
|
|
125
|
-
required: ["url"],
|
|
126
|
-
additionalProperties: false
|
|
127
|
-
})
|
|
128
|
-
},
|
|
129
|
-
"core.http.duckduckgoSearch": {
|
|
130
|
-
inputSchema: S({
|
|
131
|
-
type: "object",
|
|
132
|
-
properties: {
|
|
133
|
-
query: { type: "string", description: "Search query" },
|
|
134
|
-
maxResults: { type: "number", description: "Max results (optional)" }
|
|
135
|
-
},
|
|
136
|
-
required: ["query"],
|
|
137
|
-
additionalProperties: false
|
|
138
|
-
})
|
|
139
|
-
},
|
|
140
|
-
"core.http.fetchPageMainContent": {
|
|
141
|
-
inputSchema: S({
|
|
142
|
-
type: "object",
|
|
143
|
-
properties: {
|
|
144
|
-
url: { type: "string", description: "Page URL" },
|
|
145
|
-
maxLength: { type: "number", description: "Max content length (optional)" }
|
|
146
|
-
},
|
|
147
|
-
required: ["url"],
|
|
148
|
-
additionalProperties: false
|
|
149
|
-
})
|
|
150
|
-
},
|
|
151
|
-
"core.util.json.select": {
|
|
152
|
-
inputSchema: S({
|
|
153
|
-
type: "object",
|
|
154
|
-
properties: {
|
|
155
|
-
json: { description: "JSON value (object or string)" },
|
|
156
|
-
selector: { type: "string", description: "JSONPath or selector" }
|
|
157
|
-
},
|
|
158
|
-
required: ["json", "selector"],
|
|
159
|
-
additionalProperties: false
|
|
160
|
-
})
|
|
161
|
-
},
|
|
162
|
-
"core.util.text.truncate": {
|
|
163
|
-
inputSchema: S({
|
|
164
|
-
type: "object",
|
|
165
|
-
properties: {
|
|
166
|
-
text: { type: "string", description: "Text to truncate" },
|
|
167
|
-
maxLength: { type: "number", description: "Max length" }
|
|
168
|
-
},
|
|
169
|
-
required: ["text", "maxLength"],
|
|
170
|
-
additionalProperties: false
|
|
171
|
-
})
|
|
172
|
-
},
|
|
173
|
-
"core.util.hash.sha256Text": {
|
|
174
|
-
inputSchema: S({
|
|
175
|
-
type: "object",
|
|
176
|
-
properties: {
|
|
177
|
-
text: { type: "string", description: "Text to hash" }
|
|
178
|
-
},
|
|
179
|
-
required: ["text"],
|
|
180
|
-
additionalProperties: false
|
|
181
|
-
})
|
|
182
|
-
},
|
|
183
|
-
"core.util.time.now": {
|
|
184
|
-
inputSchema: S({
|
|
185
|
-
type: "object",
|
|
186
|
-
properties: {
|
|
187
|
-
timezone: { type: "string", description: "IANA timezone (optional)" }
|
|
188
|
-
},
|
|
189
|
-
additionalProperties: false
|
|
190
|
-
})
|
|
191
|
-
},
|
|
192
|
-
"core.util.template.render": {
|
|
193
|
-
inputSchema: S({
|
|
194
|
-
type: "object",
|
|
195
|
-
properties: {
|
|
196
|
-
template: { type: "string", description: "Template string (e.g. Mustache)" },
|
|
197
|
-
data: { type: "object", description: "Data object for template" }
|
|
198
|
-
},
|
|
199
|
-
required: ["template", "data"],
|
|
200
|
-
additionalProperties: false
|
|
201
|
-
})
|
|
202
|
-
},
|
|
203
|
-
"core.exec.runCommand": {
|
|
204
|
-
inputSchema: S({
|
|
205
|
-
type: "object",
|
|
206
|
-
properties: {
|
|
207
|
-
command: { type: "string", description: "Command to run" },
|
|
208
|
-
args: { type: "array", items: { type: "string" }, description: "Arguments (optional)" },
|
|
209
|
-
cwd: { type: "string", description: "Working directory (optional)" },
|
|
210
|
-
timeoutMs: { type: "number", description: "Timeout in ms (optional)" }
|
|
211
|
-
},
|
|
212
|
-
required: ["command"],
|
|
213
|
-
additionalProperties: false
|
|
214
|
-
})
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
function isGenericSchema(schema) {
|
|
218
|
-
if (schema === null || typeof schema !== "object") return false;
|
|
219
|
-
const s = schema;
|
|
220
|
-
if (s.type !== "object") return false;
|
|
221
|
-
if (s.additionalProperties === true && !s.properties) return true;
|
|
222
|
-
if (s.properties === void 0 && s.required === void 0) return true;
|
|
223
|
-
return false;
|
|
224
|
-
}
|
|
225
|
-
function enrichSpecWithCanonicalSchema(spec) {
|
|
226
|
-
if (spec.kind !== "core") return spec;
|
|
227
|
-
const coreSuffix = spec.name.includes(".core.") ? spec.name.slice(spec.name.indexOf(".core.") + 1) : spec.name;
|
|
228
|
-
const key = normalizeToolName(coreSuffix);
|
|
229
|
-
const canonical = CORE_TOOL_SCHEMAS[key];
|
|
230
|
-
if (!canonical) return spec;
|
|
231
|
-
const useInput = isGenericSchema(spec.inputSchema) ? canonical.inputSchema : spec.inputSchema;
|
|
232
|
-
const useOutput = canonical.outputSchema && isGenericSchema(spec.outputSchema) ? canonical.outputSchema : spec.outputSchema;
|
|
233
|
-
if (useInput === spec.inputSchema && useOutput === spec.outputSchema) return spec;
|
|
234
|
-
return {
|
|
235
|
-
...spec,
|
|
236
|
-
inputSchema: useInput,
|
|
237
|
-
outputSchema: useOutput
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
export { CORE_TOOL_SCHEMAS, enrichSpecWithCanonicalSchema, isGenericSchema };
|
|
242
|
-
//# sourceMappingURL=chunk-3MUOBLNB.js.map
|
|
243
|
-
//# sourceMappingURL=chunk-3MUOBLNB.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tools/util/canonicalCoreSchemas.ts"],"names":[],"mappings":";;;AASA,IAAM,CAAA,GAAI,CAAC,CAAA,KAAc,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IAAA;AAEjC,EAAA,MAAM,aAAa,IAAA,CAAK,IAAA,CAAK,QAAA,CAAS,QAAQ,IAAI,IAAA,CAAK,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,KAAK,OAAA,CAAQ,QAAQ,CAAA,GAAI,CAAC,IAAI,IAAA,CAAK,IAAA;AAC1G,EAAA,MAAM,GAAA,GAAM,kBAAkB,UAAU,CAAA;AACxC,EAAA,MAAM,SAAA,GAAY,kBAAkB,GAAG,CAAA;AACvC,EAAA,IAAI,CAAC,WAAW,OAAO,IAAA;AACvB,EAAA,MAAM,WAAW,eAAA,CAAgB,IAAA,CAAK,WAAW,CAAA,GAAI,SAAA,CAAU,cAAc,IAAA,CAAK,WAAA;AAClF,EAAA,MAAM,SAAA,GACJ,UAAU,YAAA,IAAgB,eAAA,CAAgB,KAAK,YAAY,CAAA,GACvD,SAAA,CAAU,YAAA,GACV,IAAA,CAAK,YAAA;AACX,EAAA,IAAI,aAAa,IAAA,CAAK,WAAA,IAAe,SAAA,KAAc,IAAA,CAAK,cAAc,OAAO,IAAA;AAC7E,EAAA,OAAO;AAAA,IACL,GAAG,IAAA;AAAA,IACH,WAAA,EAAa,QAAA;AAAA,IACb,YAAA,EAAc;AAAA,GAChB;AACF","file":"chunk-3MUOBLNB.js","sourcesContent":["/**\n * Canonical input/output schemas for core (builtin) tools.\n * Used when the builtin package registers specs with generic schema\n * (type: object, additionalProperties: true) so CLI describe and OpenAPI show real schemas.\n */\n\nimport type { ToolSpec } from \"../../core/types/ToolSpec.js\";\nimport { normalizeToolName } from \"../../core/types/ToolSpec.js\";\n\nconst S = (o: object) => o as Record<string, unknown>;\n\n/** Canonical inputSchema (and optional outputSchema) by tool name (e.g. core/fs.readText). */\nexport const CORE_TOOL_SCHEMAS: Record<\n string,\n { inputSchema: object; outputSchema?: object }\n> = {\n \"core/fs.readText\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"Path to the file (within sandbox)\" },\n maxBytes: { type: \"number\", description: \"Max bytes to read (optional)\" },\n },\n required: [\"path\"],\n additionalProperties: false,\n }),\n outputSchema: S({\n type: \"object\",\n properties: {\n result: {\n type: \"object\",\n properties: {\n path: { type: \"string\" },\n text: { type: \"string\" },\n bytes: { type: \"number\" },\n },\n },\n },\n }),\n },\n \"core.fs.writeText\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"Path to write (within sandbox)\" },\n content: { type: \"string\", description: \"UTF-8 content to write\" },\n },\n required: [\"path\", \"content\"],\n additionalProperties: false,\n }),\n },\n \"core.fs.listDir\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"Directory path (within sandbox)\" },\n maxEntries: { type: \"number\", description: \"Max entries to return (optional)\" },\n },\n required: [\"path\"],\n additionalProperties: false,\n }),\n },\n \"core.fs.searchText\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"Path to file or directory\" },\n pattern: { type: \"string\", description: \"Search pattern (regex or literal)\" },\n maxMatches: { type: \"number\", description: \"Max matches (optional)\" },\n },\n required: [\"path\", \"pattern\"],\n additionalProperties: false,\n }),\n },\n \"core.fs.sha256\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"Path to file (within sandbox)\" },\n },\n required: [\"path\"],\n additionalProperties: false,\n }),\n },\n \"core.fs.deletePath\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"Path to delete (within sandbox)\" },\n },\n required: [\"path\"],\n additionalProperties: false,\n }),\n },\n \"core.http.fetchText\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n url: { type: \"string\", description: \"URL to fetch\" },\n headers: { type: \"object\", additionalProperties: { type: \"string\" }, description: \"Optional request headers\" },\n timeoutMs: { type: \"number\", description: \"Request timeout in ms (optional)\" },\n },\n required: [\"url\"],\n additionalProperties: false,\n }),\n },\n \"core.http.fetchJson\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n url: { type: \"string\", description: \"URL to fetch\" },\n headers: { type: \"object\", additionalProperties: { type: \"string\" } },\n },\n required: [\"url\"],\n additionalProperties: false,\n }),\n },\n \"core.http.downloadFile\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n url: { type: \"string\", description: \"URL to download\" },\n destPath: { type: \"string\", description: \"Destination path (within sandbox)\" },\n headers: { type: \"object\", additionalProperties: { type: \"string\" } },\n },\n required: [\"url\", \"destPath\"],\n additionalProperties: false,\n }),\n },\n \"core.http.head\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n url: { type: \"string\", description: \"URL for HEAD request\" },\n },\n required: [\"url\"],\n additionalProperties: false,\n }),\n },\n \"core.http.duckduckgoSearch\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n query: { type: \"string\", description: \"Search query\" },\n maxResults: { type: \"number\", description: \"Max results (optional)\" },\n },\n required: [\"query\"],\n additionalProperties: false,\n }),\n },\n \"core.http.fetchPageMainContent\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n url: { type: \"string\", description: \"Page URL\" },\n maxLength: { type: \"number\", description: \"Max content length (optional)\" },\n },\n required: [\"url\"],\n additionalProperties: false,\n }),\n },\n \"core.util.json.select\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n json: { description: \"JSON value (object or string)\" },\n selector: { type: \"string\", description: \"JSONPath or selector\" },\n },\n required: [\"json\", \"selector\"],\n additionalProperties: false,\n }),\n },\n \"core.util.text.truncate\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n text: { type: \"string\", description: \"Text to truncate\" },\n maxLength: { type: \"number\", description: \"Max length\" },\n },\n required: [\"text\", \"maxLength\"],\n additionalProperties: false,\n }),\n },\n \"core.util.hash.sha256Text\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n text: { type: \"string\", description: \"Text to hash\" },\n },\n required: [\"text\"],\n additionalProperties: false,\n }),\n },\n \"core.util.time.now\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n timezone: { type: \"string\", description: \"IANA timezone (optional)\" },\n },\n additionalProperties: false,\n }),\n },\n \"core.util.template.render\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n template: { type: \"string\", description: \"Template string (e.g. Mustache)\" },\n data: { type: \"object\", description: \"Data object for template\" },\n },\n required: [\"template\", \"data\"],\n additionalProperties: false,\n }),\n },\n \"core.exec.runCommand\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n command: { type: \"string\", description: \"Command to run\" },\n args: { type: \"array\", items: { type: \"string\" }, description: \"Arguments (optional)\" },\n cwd: { type: \"string\", description: \"Working directory (optional)\" },\n timeoutMs: { type: \"number\", description: \"Timeout in ms (optional)\" },\n },\n required: [\"command\"],\n additionalProperties: false,\n }),\n },\n};\n\n/** True if schema looks like the generic permissive one. */\nexport function isGenericSchema(schema: unknown): boolean {\n if (schema === null || typeof schema !== \"object\") return false;\n const s = schema as Record<string, unknown>;\n if (s.type !== \"object\") return false;\n if (s.additionalProperties === true && !s.properties) return true;\n if (s.properties === undefined && s.required === undefined) return true;\n return false;\n}\n\n/**\n * If spec is a core tool with generic input/output schema, return spec with canonical schema.\n * Otherwise return spec unchanged.\n */\nexport function enrichSpecWithCanonicalSchema(spec: ToolSpec): ToolSpec {\n if (spec.kind !== \"core\") return spec;\n // Support prefixed names (e.g. npm.easynet.agent.tool.buildin.latest.core.fs.readText) by matching core.* suffix\n const coreSuffix = spec.name.includes(\".core.\") ? spec.name.slice(spec.name.indexOf(\".core.\") + 1) : spec.name;\n const key = normalizeToolName(coreSuffix);\n const canonical = CORE_TOOL_SCHEMAS[key];\n if (!canonical) return spec;\n const useInput = isGenericSchema(spec.inputSchema) ? canonical.inputSchema : spec.inputSchema;\n const useOutput =\n canonical.outputSchema && isGenericSchema(spec.outputSchema)\n ? canonical.outputSchema\n : spec.outputSchema;\n if (useInput === spec.inputSchema && useOutput === spec.outputSchema) return spec;\n return {\n ...spec,\n inputSchema: useInput,\n outputSchema: useOutput,\n };\n}\n"]}
|
package/dist/chunk-4KTWJQ32.cjs
DELETED
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkDYDNPIV2_cjs = require('./chunk-DYDNPIV2.cjs');
|
|
4
|
-
|
|
5
|
-
// src/tools/util/canonicalCoreSchemas.ts
|
|
6
|
-
var S = (o) => o;
|
|
7
|
-
var CORE_TOOL_SCHEMAS = {
|
|
8
|
-
"core/fs.readText": {
|
|
9
|
-
inputSchema: S({
|
|
10
|
-
type: "object",
|
|
11
|
-
properties: {
|
|
12
|
-
path: { type: "string", description: "Path to the file (within sandbox)" },
|
|
13
|
-
maxBytes: { type: "number", description: "Max bytes to read (optional)" }
|
|
14
|
-
},
|
|
15
|
-
required: ["path"],
|
|
16
|
-
additionalProperties: false
|
|
17
|
-
}),
|
|
18
|
-
outputSchema: S({
|
|
19
|
-
type: "object",
|
|
20
|
-
properties: {
|
|
21
|
-
result: {
|
|
22
|
-
type: "object",
|
|
23
|
-
properties: {
|
|
24
|
-
path: { type: "string" },
|
|
25
|
-
text: { type: "string" },
|
|
26
|
-
bytes: { type: "number" }
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
})
|
|
31
|
-
},
|
|
32
|
-
"core.fs.writeText": {
|
|
33
|
-
inputSchema: S({
|
|
34
|
-
type: "object",
|
|
35
|
-
properties: {
|
|
36
|
-
path: { type: "string", description: "Path to write (within sandbox)" },
|
|
37
|
-
content: { type: "string", description: "UTF-8 content to write" }
|
|
38
|
-
},
|
|
39
|
-
required: ["path", "content"],
|
|
40
|
-
additionalProperties: false
|
|
41
|
-
})
|
|
42
|
-
},
|
|
43
|
-
"core.fs.listDir": {
|
|
44
|
-
inputSchema: S({
|
|
45
|
-
type: "object",
|
|
46
|
-
properties: {
|
|
47
|
-
path: { type: "string", description: "Directory path (within sandbox)" },
|
|
48
|
-
maxEntries: { type: "number", description: "Max entries to return (optional)" }
|
|
49
|
-
},
|
|
50
|
-
required: ["path"],
|
|
51
|
-
additionalProperties: false
|
|
52
|
-
})
|
|
53
|
-
},
|
|
54
|
-
"core.fs.searchText": {
|
|
55
|
-
inputSchema: S({
|
|
56
|
-
type: "object",
|
|
57
|
-
properties: {
|
|
58
|
-
path: { type: "string", description: "Path to file or directory" },
|
|
59
|
-
pattern: { type: "string", description: "Search pattern (regex or literal)" },
|
|
60
|
-
maxMatches: { type: "number", description: "Max matches (optional)" }
|
|
61
|
-
},
|
|
62
|
-
required: ["path", "pattern"],
|
|
63
|
-
additionalProperties: false
|
|
64
|
-
})
|
|
65
|
-
},
|
|
66
|
-
"core.fs.sha256": {
|
|
67
|
-
inputSchema: S({
|
|
68
|
-
type: "object",
|
|
69
|
-
properties: {
|
|
70
|
-
path: { type: "string", description: "Path to file (within sandbox)" }
|
|
71
|
-
},
|
|
72
|
-
required: ["path"],
|
|
73
|
-
additionalProperties: false
|
|
74
|
-
})
|
|
75
|
-
},
|
|
76
|
-
"core.fs.deletePath": {
|
|
77
|
-
inputSchema: S({
|
|
78
|
-
type: "object",
|
|
79
|
-
properties: {
|
|
80
|
-
path: { type: "string", description: "Path to delete (within sandbox)" }
|
|
81
|
-
},
|
|
82
|
-
required: ["path"],
|
|
83
|
-
additionalProperties: false
|
|
84
|
-
})
|
|
85
|
-
},
|
|
86
|
-
"core.http.fetchText": {
|
|
87
|
-
inputSchema: S({
|
|
88
|
-
type: "object",
|
|
89
|
-
properties: {
|
|
90
|
-
url: { type: "string", description: "URL to fetch" },
|
|
91
|
-
headers: { type: "object", additionalProperties: { type: "string" }, description: "Optional request headers" },
|
|
92
|
-
timeoutMs: { type: "number", description: "Request timeout in ms (optional)" }
|
|
93
|
-
},
|
|
94
|
-
required: ["url"],
|
|
95
|
-
additionalProperties: false
|
|
96
|
-
})
|
|
97
|
-
},
|
|
98
|
-
"core.http.fetchJson": {
|
|
99
|
-
inputSchema: S({
|
|
100
|
-
type: "object",
|
|
101
|
-
properties: {
|
|
102
|
-
url: { type: "string", description: "URL to fetch" },
|
|
103
|
-
headers: { type: "object", additionalProperties: { type: "string" } }
|
|
104
|
-
},
|
|
105
|
-
required: ["url"],
|
|
106
|
-
additionalProperties: false
|
|
107
|
-
})
|
|
108
|
-
},
|
|
109
|
-
"core.http.downloadFile": {
|
|
110
|
-
inputSchema: S({
|
|
111
|
-
type: "object",
|
|
112
|
-
properties: {
|
|
113
|
-
url: { type: "string", description: "URL to download" },
|
|
114
|
-
destPath: { type: "string", description: "Destination path (within sandbox)" },
|
|
115
|
-
headers: { type: "object", additionalProperties: { type: "string" } }
|
|
116
|
-
},
|
|
117
|
-
required: ["url", "destPath"],
|
|
118
|
-
additionalProperties: false
|
|
119
|
-
})
|
|
120
|
-
},
|
|
121
|
-
"core.http.head": {
|
|
122
|
-
inputSchema: S({
|
|
123
|
-
type: "object",
|
|
124
|
-
properties: {
|
|
125
|
-
url: { type: "string", description: "URL for HEAD request" }
|
|
126
|
-
},
|
|
127
|
-
required: ["url"],
|
|
128
|
-
additionalProperties: false
|
|
129
|
-
})
|
|
130
|
-
},
|
|
131
|
-
"core.http.duckduckgoSearch": {
|
|
132
|
-
inputSchema: S({
|
|
133
|
-
type: "object",
|
|
134
|
-
properties: {
|
|
135
|
-
query: { type: "string", description: "Search query" },
|
|
136
|
-
maxResults: { type: "number", description: "Max results (optional)" }
|
|
137
|
-
},
|
|
138
|
-
required: ["query"],
|
|
139
|
-
additionalProperties: false
|
|
140
|
-
})
|
|
141
|
-
},
|
|
142
|
-
"core.http.fetchPageMainContent": {
|
|
143
|
-
inputSchema: S({
|
|
144
|
-
type: "object",
|
|
145
|
-
properties: {
|
|
146
|
-
url: { type: "string", description: "Page URL" },
|
|
147
|
-
maxLength: { type: "number", description: "Max content length (optional)" }
|
|
148
|
-
},
|
|
149
|
-
required: ["url"],
|
|
150
|
-
additionalProperties: false
|
|
151
|
-
})
|
|
152
|
-
},
|
|
153
|
-
"core.util.json.select": {
|
|
154
|
-
inputSchema: S({
|
|
155
|
-
type: "object",
|
|
156
|
-
properties: {
|
|
157
|
-
json: { description: "JSON value (object or string)" },
|
|
158
|
-
selector: { type: "string", description: "JSONPath or selector" }
|
|
159
|
-
},
|
|
160
|
-
required: ["json", "selector"],
|
|
161
|
-
additionalProperties: false
|
|
162
|
-
})
|
|
163
|
-
},
|
|
164
|
-
"core.util.text.truncate": {
|
|
165
|
-
inputSchema: S({
|
|
166
|
-
type: "object",
|
|
167
|
-
properties: {
|
|
168
|
-
text: { type: "string", description: "Text to truncate" },
|
|
169
|
-
maxLength: { type: "number", description: "Max length" }
|
|
170
|
-
},
|
|
171
|
-
required: ["text", "maxLength"],
|
|
172
|
-
additionalProperties: false
|
|
173
|
-
})
|
|
174
|
-
},
|
|
175
|
-
"core.util.hash.sha256Text": {
|
|
176
|
-
inputSchema: S({
|
|
177
|
-
type: "object",
|
|
178
|
-
properties: {
|
|
179
|
-
text: { type: "string", description: "Text to hash" }
|
|
180
|
-
},
|
|
181
|
-
required: ["text"],
|
|
182
|
-
additionalProperties: false
|
|
183
|
-
})
|
|
184
|
-
},
|
|
185
|
-
"core.util.time.now": {
|
|
186
|
-
inputSchema: S({
|
|
187
|
-
type: "object",
|
|
188
|
-
properties: {
|
|
189
|
-
timezone: { type: "string", description: "IANA timezone (optional)" }
|
|
190
|
-
},
|
|
191
|
-
additionalProperties: false
|
|
192
|
-
})
|
|
193
|
-
},
|
|
194
|
-
"core.util.template.render": {
|
|
195
|
-
inputSchema: S({
|
|
196
|
-
type: "object",
|
|
197
|
-
properties: {
|
|
198
|
-
template: { type: "string", description: "Template string (e.g. Mustache)" },
|
|
199
|
-
data: { type: "object", description: "Data object for template" }
|
|
200
|
-
},
|
|
201
|
-
required: ["template", "data"],
|
|
202
|
-
additionalProperties: false
|
|
203
|
-
})
|
|
204
|
-
},
|
|
205
|
-
"core.exec.runCommand": {
|
|
206
|
-
inputSchema: S({
|
|
207
|
-
type: "object",
|
|
208
|
-
properties: {
|
|
209
|
-
command: { type: "string", description: "Command to run" },
|
|
210
|
-
args: { type: "array", items: { type: "string" }, description: "Arguments (optional)" },
|
|
211
|
-
cwd: { type: "string", description: "Working directory (optional)" },
|
|
212
|
-
timeoutMs: { type: "number", description: "Timeout in ms (optional)" }
|
|
213
|
-
},
|
|
214
|
-
required: ["command"],
|
|
215
|
-
additionalProperties: false
|
|
216
|
-
})
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
function isGenericSchema(schema) {
|
|
220
|
-
if (schema === null || typeof schema !== "object") return false;
|
|
221
|
-
const s = schema;
|
|
222
|
-
if (s.type !== "object") return false;
|
|
223
|
-
if (s.additionalProperties === true && !s.properties) return true;
|
|
224
|
-
if (s.properties === void 0 && s.required === void 0) return true;
|
|
225
|
-
return false;
|
|
226
|
-
}
|
|
227
|
-
function enrichSpecWithCanonicalSchema(spec) {
|
|
228
|
-
if (spec.kind !== "core") return spec;
|
|
229
|
-
const coreSuffix = spec.name.includes(".core.") ? spec.name.slice(spec.name.indexOf(".core.") + 1) : spec.name;
|
|
230
|
-
const key = chunkDYDNPIV2_cjs.normalizeToolName(coreSuffix);
|
|
231
|
-
const canonical = CORE_TOOL_SCHEMAS[key];
|
|
232
|
-
if (!canonical) return spec;
|
|
233
|
-
const useInput = isGenericSchema(spec.inputSchema) ? canonical.inputSchema : spec.inputSchema;
|
|
234
|
-
const useOutput = canonical.outputSchema && isGenericSchema(spec.outputSchema) ? canonical.outputSchema : spec.outputSchema;
|
|
235
|
-
if (useInput === spec.inputSchema && useOutput === spec.outputSchema) return spec;
|
|
236
|
-
return {
|
|
237
|
-
...spec,
|
|
238
|
-
inputSchema: useInput,
|
|
239
|
-
outputSchema: useOutput
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
exports.CORE_TOOL_SCHEMAS = CORE_TOOL_SCHEMAS;
|
|
244
|
-
exports.enrichSpecWithCanonicalSchema = enrichSpecWithCanonicalSchema;
|
|
245
|
-
exports.isGenericSchema = isGenericSchema;
|
|
246
|
-
//# sourceMappingURL=chunk-4KTWJQ32.cjs.map
|
|
247
|
-
//# source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AAA,IAAa,CAAA,CAAE,QAAA,KAAa,QAAW,OAAO,IAAA;AACnE,EAAA,OAAO,KAAA;AACT;AAMO,SAAS,8BAA8B,IAAA,EAA0B;AACtE,EAAA,IAAI,IAAA,CAAK,IAAA,KAAS,MAAA,EAAQ,OAAO,IAAA;AAEjC,EAAA,MAAM,aAAa,IAAA,CAAK,IAAA,CAAK,QAAA,CAAS,QAAQ,IAAI,IAAA,CAAK,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,KAAK,OAAA,CAAQ,QAAQ,CAAA,GAAI,CAAC,IAAI,IAAA,CAAK,IAAA;AAC1G,EAAA,MAAM,GAAA,GAAMA,oCAAkB,UAAU,CAAA;AACxC,EAAA,MAAM,SAAA,GAAY,kBAAkB,GAAG,CAAA;AACvC,EAAA,IAAI,CAAC,WAAW,OAAO,IAAA;AACvB,EAAA,MAAM,WAAW,eAAA,CAAgB,IAAA,CAAK,WAAW,CAAA,GAAI,SAAA,CAAU,cAAc,IAAA,CAAK,WAAA;AAClF,EAAA,MAAM,SAAA,GACJ,UAAU,YAAA,IAAgB,eAAA,CAAgB,KAAK,YAAY,CAAA,GACvD,SAAA,CAAU,YAAA,GACV,IAAA,CAAK,YAAA;AACX,EAAA,IAAI,aAAa,IAAA,CAAK,WAAA,IAAe,SAAA,KAAc,IAAA,CAAK,cAAc,OAAO,IAAA;AAC7E,EAAA,OAAO;AAAA,IACL,GAAG,IAAA;AAAA,IACH,WAAA,EAAa,QAAA;AAAA,IACb,YAAA,EAAc;AAAA,GAChB;AACF","file":"chunk-4KTWJQ32.cjs","sourcesContent":["/**\n * Canonical input/output schemas for core (builtin) tools.\n * Used when the builtin package registers specs with generic schema\n * (type: object, additionalProperties: true) so CLI describe and OpenAPI show real schemas.\n */\n\nimport type { ToolSpec } from \"../../core/types/ToolSpec.js\";\nimport { normalizeToolName } from \"../../core/types/ToolSpec.js\";\n\nconst S = (o: object) => o as Record<string, unknown>;\n\n/** Canonical inputSchema (and optional outputSchema) by tool name (e.g. core/fs.readText). */\nexport const CORE_TOOL_SCHEMAS: Record<\n string,\n { inputSchema: object; outputSchema?: object }\n> = {\n \"core/fs.readText\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"Path to the file (within sandbox)\" },\n maxBytes: { type: \"number\", description: \"Max bytes to read (optional)\" },\n },\n required: [\"path\"],\n additionalProperties: false,\n }),\n outputSchema: S({\n type: \"object\",\n properties: {\n result: {\n type: \"object\",\n properties: {\n path: { type: \"string\" },\n text: { type: \"string\" },\n bytes: { type: \"number\" },\n },\n },\n },\n }),\n },\n \"core.fs.writeText\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"Path to write (within sandbox)\" },\n content: { type: \"string\", description: \"UTF-8 content to write\" },\n },\n required: [\"path\", \"content\"],\n additionalProperties: false,\n }),\n },\n \"core.fs.listDir\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"Directory path (within sandbox)\" },\n maxEntries: { type: \"number\", description: \"Max entries to return (optional)\" },\n },\n required: [\"path\"],\n additionalProperties: false,\n }),\n },\n \"core.fs.searchText\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"Path to file or directory\" },\n pattern: { type: \"string\", description: \"Search pattern (regex or literal)\" },\n maxMatches: { type: \"number\", description: \"Max matches (optional)\" },\n },\n required: [\"path\", \"pattern\"],\n additionalProperties: false,\n }),\n },\n \"core.fs.sha256\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"Path to file (within sandbox)\" },\n },\n required: [\"path\"],\n additionalProperties: false,\n }),\n },\n \"core.fs.deletePath\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"Path to delete (within sandbox)\" },\n },\n required: [\"path\"],\n additionalProperties: false,\n }),\n },\n \"core.http.fetchText\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n url: { type: \"string\", description: \"URL to fetch\" },\n headers: { type: \"object\", additionalProperties: { type: \"string\" }, description: \"Optional request headers\" },\n timeoutMs: { type: \"number\", description: \"Request timeout in ms (optional)\" },\n },\n required: [\"url\"],\n additionalProperties: false,\n }),\n },\n \"core.http.fetchJson\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n url: { type: \"string\", description: \"URL to fetch\" },\n headers: { type: \"object\", additionalProperties: { type: \"string\" } },\n },\n required: [\"url\"],\n additionalProperties: false,\n }),\n },\n \"core.http.downloadFile\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n url: { type: \"string\", description: \"URL to download\" },\n destPath: { type: \"string\", description: \"Destination path (within sandbox)\" },\n headers: { type: \"object\", additionalProperties: { type: \"string\" } },\n },\n required: [\"url\", \"destPath\"],\n additionalProperties: false,\n }),\n },\n \"core.http.head\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n url: { type: \"string\", description: \"URL for HEAD request\" },\n },\n required: [\"url\"],\n additionalProperties: false,\n }),\n },\n \"core.http.duckduckgoSearch\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n query: { type: \"string\", description: \"Search query\" },\n maxResults: { type: \"number\", description: \"Max results (optional)\" },\n },\n required: [\"query\"],\n additionalProperties: false,\n }),\n },\n \"core.http.fetchPageMainContent\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n url: { type: \"string\", description: \"Page URL\" },\n maxLength: { type: \"number\", description: \"Max content length (optional)\" },\n },\n required: [\"url\"],\n additionalProperties: false,\n }),\n },\n \"core.util.json.select\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n json: { description: \"JSON value (object or string)\" },\n selector: { type: \"string\", description: \"JSONPath or selector\" },\n },\n required: [\"json\", \"selector\"],\n additionalProperties: false,\n }),\n },\n \"core.util.text.truncate\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n text: { type: \"string\", description: \"Text to truncate\" },\n maxLength: { type: \"number\", description: \"Max length\" },\n },\n required: [\"text\", \"maxLength\"],\n additionalProperties: false,\n }),\n },\n \"core.util.hash.sha256Text\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n text: { type: \"string\", description: \"Text to hash\" },\n },\n required: [\"text\"],\n additionalProperties: false,\n }),\n },\n \"core.util.time.now\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n timezone: { type: \"string\", description: \"IANA timezone (optional)\" },\n },\n additionalProperties: false,\n }),\n },\n \"core.util.template.render\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n template: { type: \"string\", description: \"Template string (e.g. Mustache)\" },\n data: { type: \"object\", description: \"Data object for template\" },\n },\n required: [\"template\", \"data\"],\n additionalProperties: false,\n }),\n },\n \"core.exec.runCommand\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n command: { type: \"string\", description: \"Command to run\" },\n args: { type: \"array\", items: { type: \"string\" }, description: \"Arguments (optional)\" },\n cwd: { type: \"string\", description: \"Working directory (optional)\" },\n timeoutMs: { type: \"number\", description: \"Timeout in ms (optional)\" },\n },\n required: [\"command\"],\n additionalProperties: false,\n }),\n },\n};\n\n/** True if schema looks like the generic permissive one. */\nexport function isGenericSchema(schema: unknown): boolean {\n if (schema === null || typeof schema !== \"object\") return false;\n const s = schema as Record<string, unknown>;\n if (s.type !== \"object\") return false;\n if (s.additionalProperties === true && !s.properties) return true;\n if (s.properties === undefined && s.required === undefined) return true;\n return false;\n}\n\n/**\n * If spec is a core tool with generic input/output schema, return spec with canonical schema.\n * Otherwise return spec unchanged.\n */\nexport function enrichSpecWithCanonicalSchema(spec: ToolSpec): ToolSpec {\n if (spec.kind !== \"core\") return spec;\n // Support prefixed names (e.g. npm.easynet.agent.tool.buildin.latest.core.fs.readText) by matching core.* suffix\n const coreSuffix = spec.name.includes(\".core.\") ? spec.name.slice(spec.name.indexOf(\".core.\") + 1) : spec.name;\n const key = normalizeToolName(coreSuffix);\n const canonical = CORE_TOOL_SCHEMAS[key];\n if (!canonical) return spec;\n const useInput = isGenericSchema(spec.inputSchema) ? canonical.inputSchema : spec.inputSchema;\n const useOutput =\n canonical.outputSchema && isGenericSchema(spec.outputSchema)\n ? canonical.outputSchema\n : spec.outputSchema;\n if (useInput === spec.inputSchema && useOutput === spec.outputSchema) return spec;\n return {\n ...spec,\n inputSchema: useInput,\n outputSchema: useOutput,\n };\n}\n"]}
|