@easynet/agent-tool 1.0.86 → 1.0.87
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/README.md +1 -0
- package/dist/build.cjs +8 -9
- package/dist/build.js +3 -4
- package/dist/{chunk-6ORA3MNX.js → chunk-2YP4Q4BW.js} +4 -4
- package/dist/{chunk-6ORA3MNX.js.map → chunk-2YP4Q4BW.js.map} +1 -1
- package/dist/{chunk-PYCCJF7C.cjs → chunk-AGLGFQUW.cjs} +118 -7
- package/dist/chunk-AGLGFQUW.cjs.map +1 -0
- package/dist/{chunk-W2WJOS5Z.js → chunk-BBNQ6AWK.js} +6 -8
- package/dist/chunk-BBNQ6AWK.js.map +1 -0
- package/dist/{chunk-HEVWKBBQ.js → chunk-BDUSB6GT.js} +36 -6
- package/dist/chunk-BDUSB6GT.js.map +1 -0
- package/dist/{chunk-NEMGE573.js → chunk-IJVVH4JN.js} +3 -3
- package/dist/{chunk-NEMGE573.js.map → chunk-IJVVH4JN.js.map} +1 -1
- package/dist/{chunk-WUMLZERG.js → chunk-IVL4TBFB.js} +106 -4
- package/dist/chunk-IVL4TBFB.js.map +1 -0
- package/dist/{chunk-LHKEJNKL.cjs → chunk-JW4EMVTE.cjs} +38 -6
- package/dist/chunk-JW4EMVTE.cjs.map +1 -0
- package/dist/{chunk-V2RD4BHT.cjs → chunk-LKE7PMRB.cjs} +13 -13
- package/dist/{chunk-V2RD4BHT.cjs.map → chunk-LKE7PMRB.cjs.map} +1 -1
- package/dist/{chunk-5HSGVA6S.cjs → chunk-PJDINB7G.cjs} +35 -37
- package/dist/chunk-PJDINB7G.cjs.map +1 -0
- package/dist/{chunk-F4HS7H7K.cjs → chunk-QYY6PNIB.cjs} +4 -4
- package/dist/{chunk-F4HS7H7K.cjs.map → chunk-QYY6PNIB.cjs.map} +1 -1
- package/dist/{chunk-3D7XYAZO.js → chunk-SNN4QJ5Z.js} +3 -3
- package/dist/{chunk-3D7XYAZO.js.map → chunk-SNN4QJ5Z.js.map} +1 -1
- package/dist/{chunk-QCHMXVWZ.cjs → chunk-ZDEQREVL.cjs} +14 -14
- package/dist/{chunk-QCHMXVWZ.cjs.map → chunk-ZDEQREVL.cjs.map} +1 -1
- package/dist/index.cjs +256 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +258 -10
- package/dist/index.js.map +1 -1
- package/dist/{extension.cjs → sdk.cjs} +212 -11
- package/dist/sdk.cjs.map +1 -0
- package/dist/sdk.d.ts +17 -0
- package/dist/sdk.d.ts.map +1 -0
- package/dist/{extension.js → sdk.js} +183 -7
- package/dist/sdk.js.map +1 -0
- package/dist/tools/discoveryFactory.d.ts.map +1 -1
- package/dist/tools/function/scanner.d.ts.map +1 -1
- package/dist/tools/util/toolDescriptor.d.ts +1 -1
- package/dist/tools/util/toolDescriptor.d.ts.map +1 -1
- package/dist/utils/cli/index.cjs +23 -26
- package/dist/utils/cli/index.cjs.map +1 -1
- package/dist/utils/cli/index.js +9 -12
- package/dist/utils/cli/index.js.map +1 -1
- package/package.json +6 -20
- package/dist/api/main.cjs +0 -21
- package/dist/api/main.cjs.map +0 -1
- package/dist/api/main.d.ts +0 -6
- package/dist/api/main.d.ts.map +0 -1
- package/dist/api/main.js +0 -12
- package/dist/api/main.js.map +0 -1
- package/dist/chunk-5HSGVA6S.cjs.map +0 -1
- package/dist/chunk-AV7BE52O.cjs +0 -261
- package/dist/chunk-AV7BE52O.cjs.map +0 -1
- package/dist/chunk-HEVWKBBQ.js.map +0 -1
- package/dist/chunk-LHKEJNKL.cjs.map +0 -1
- package/dist/chunk-ODEHUAR4.js +0 -33
- package/dist/chunk-ODEHUAR4.js.map +0 -1
- package/dist/chunk-OPAXCS4C.js +0 -258
- package/dist/chunk-OPAXCS4C.js.map +0 -1
- package/dist/chunk-PYCCJF7C.cjs.map +0 -1
- package/dist/chunk-QEJF3KDV.cjs +0 -38
- package/dist/chunk-QEJF3KDV.cjs.map +0 -1
- package/dist/chunk-QXQ4477T.js +0 -49
- package/dist/chunk-QXQ4477T.js.map +0 -1
- package/dist/chunk-RZTTO5MQ.js +0 -65
- package/dist/chunk-RZTTO5MQ.js.map +0 -1
- package/dist/chunk-W2WJOS5Z.js.map +0 -1
- package/dist/chunk-WUMLZERG.js.map +0 -1
- package/dist/chunk-XPGHS4W7.cjs +0 -73
- package/dist/chunk-XPGHS4W7.cjs.map +0 -1
- package/dist/chunk-ZDSZHEQU.cjs +0 -52
- package/dist/chunk-ZDSZHEQU.cjs.map +0 -1
- package/dist/config/index.d.ts +0 -12
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/ref.d.ts +0 -9
- package/dist/config/ref.d.ts.map +0 -1
- package/dist/core/index.cjs +0 -20
- package/dist/core/index.cjs.map +0 -1
- package/dist/core/index.d.ts +0 -7
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -3
- package/dist/core/index.js.map +0 -1
- package/dist/core/runtime.cjs +0 -26
- package/dist/core/runtime.cjs.map +0 -1
- package/dist/core/runtime.d.ts +0 -12
- package/dist/core/runtime.d.ts.map +0 -1
- package/dist/core/runtime.js +0 -5
- package/dist/core/runtime.js.map +0 -1
- package/dist/extension.cjs.map +0 -1
- package/dist/extension.d.ts +0 -6
- package/dist/extension.d.ts.map +0 -1
- package/dist/extension.js.map +0 -1
- package/dist/security.cjs +0 -193
- package/dist/security.cjs.map +0 -1
- package/dist/security.d.ts +0 -6
- package/dist/security.d.ts.map +0 -1
- package/dist/security.js +0 -182
- package/dist/security.js.map +0 -1
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunkLKE7PMRB_cjs = require('./chunk-LKE7PMRB.cjs');
|
|
4
|
+
var chunkAGLGFQUW_cjs = require('./chunk-AGLGFQUW.cjs');
|
|
5
|
+
var chunkJW4EMVTE_cjs = require('./chunk-JW4EMVTE.cjs');
|
|
3
6
|
var chunkUUNG3GL3_cjs = require('./chunk-UUNG3GL3.cjs');
|
|
4
|
-
var chunkV2RD4BHT_cjs = require('./chunk-V2RD4BHT.cjs');
|
|
5
|
-
var chunkZDSZHEQU_cjs = require('./chunk-ZDSZHEQU.cjs');
|
|
6
|
-
var chunkPYCCJF7C_cjs = require('./chunk-PYCCJF7C.cjs');
|
|
7
|
-
var chunkXPGHS4W7_cjs = require('./chunk-XPGHS4W7.cjs');
|
|
8
|
-
var chunkQEJF3KDV_cjs = require('./chunk-QEJF3KDV.cjs');
|
|
9
7
|
var fs = require('fs');
|
|
10
8
|
var path = require('path');
|
|
11
9
|
var agentCommon = require('@easynet/agent-common');
|
|
@@ -163,7 +161,7 @@ function npmDescriptorToRegistryPrefix(descriptor, resolvedVersion) {
|
|
|
163
161
|
const scope = slashIdx < 0 ? scopeAndPackage : scopeAndPackage.slice(0, slashIdx).replace(/^@/, "");
|
|
164
162
|
const pkg = slashIdx < 0 ? "" : scopeAndPackage.slice(slashIdx + 1);
|
|
165
163
|
const segment = [scope, pkg, version].filter(Boolean).join(".");
|
|
166
|
-
const normalized =
|
|
164
|
+
const normalized = chunkJW4EMVTE_cjs.normalizeToolName(segment);
|
|
167
165
|
if (!normalized) return "";
|
|
168
166
|
return "npm." + normalized + ".";
|
|
169
167
|
}
|
|
@@ -179,7 +177,7 @@ function npmDescriptorToPackagePrefix(descriptor) {
|
|
|
179
177
|
const scope = slashIdx < 0 ? scopeAndPackage : scopeAndPackage.slice(0, slashIdx).replace(/^@/, "");
|
|
180
178
|
const pkg = slashIdx < 0 ? "" : scopeAndPackage.slice(slashIdx + 1);
|
|
181
179
|
const segment = [scope, pkg].filter(Boolean).join(".");
|
|
182
|
-
const normalized =
|
|
180
|
+
const normalized = chunkJW4EMVTE_cjs.normalizeToolName(segment);
|
|
183
181
|
if (!normalized) return "";
|
|
184
182
|
return "npm." + normalized;
|
|
185
183
|
}
|
|
@@ -196,7 +194,7 @@ function npmDescriptorToPackagePrefixWithVersion(descriptor) {
|
|
|
196
194
|
const scope = slashIdx < 0 ? scopeAndPackage : scopeAndPackage.slice(0, slashIdx).replace(/^@/, "");
|
|
197
195
|
const pkg = slashIdx < 0 ? "" : scopeAndPackage.slice(slashIdx + 1);
|
|
198
196
|
const segment = [scope, pkg, version].filter(Boolean).join(".");
|
|
199
|
-
const normalized =
|
|
197
|
+
const normalized = chunkJW4EMVTE_cjs.normalizeToolName(segment);
|
|
200
198
|
if (!normalized) return "";
|
|
201
199
|
return "npm." + normalized;
|
|
202
200
|
}
|
|
@@ -208,7 +206,7 @@ function expandToolDescriptorsToRegistryNames(descriptors, registryNames) {
|
|
|
208
206
|
const out = [];
|
|
209
207
|
const seen = /* @__PURE__ */ new Set();
|
|
210
208
|
function add(name) {
|
|
211
|
-
const key =
|
|
209
|
+
const key = chunkJW4EMVTE_cjs.normalizeToolName(name);
|
|
212
210
|
if (registryNames.includes(key) && !seen.has(key)) {
|
|
213
211
|
seen.add(key);
|
|
214
212
|
out.push(key);
|
|
@@ -256,7 +254,7 @@ function expandToolDescriptorsToRegistryNames(descriptors, registryNames) {
|
|
|
256
254
|
}
|
|
257
255
|
continue;
|
|
258
256
|
}
|
|
259
|
-
const name =
|
|
257
|
+
const name = chunkJW4EMVTE_cjs.normalizeToolName(s);
|
|
260
258
|
add(name);
|
|
261
259
|
}
|
|
262
260
|
return out;
|
|
@@ -269,9 +267,9 @@ function fileDescriptorToPackagePrefix(descriptor) {
|
|
|
269
267
|
const path = parseToolPath(descriptor.trim());
|
|
270
268
|
if (!path || path.protocol !== "file") return "";
|
|
271
269
|
const pathPart = `${path.scope}/${path.packageWithVersion}`;
|
|
272
|
-
const normalized =
|
|
270
|
+
const normalized = chunkJW4EMVTE_cjs.normalizeToolName(pathPart);
|
|
273
271
|
if (!normalized) return "";
|
|
274
|
-
return
|
|
272
|
+
return chunkJW4EMVTE_cjs.normalizeToolName("file." + normalized);
|
|
275
273
|
}
|
|
276
274
|
function fileDescriptorToRegistryPrefix(descriptor) {
|
|
277
275
|
const prefix = fileDescriptorToPackagePrefix(descriptor);
|
|
@@ -1172,10 +1170,10 @@ var Tracing = class {
|
|
|
1172
1170
|
}
|
|
1173
1171
|
};
|
|
1174
1172
|
function resolveTool(toolName, registry) {
|
|
1175
|
-
const key =
|
|
1173
|
+
const key = chunkJW4EMVTE_cjs.normalizeToolName(toolName);
|
|
1176
1174
|
const spec = registry.get(key);
|
|
1177
1175
|
if (!spec) {
|
|
1178
|
-
throw
|
|
1176
|
+
throw chunkAGLGFQUW_cjs.createTaggedError(
|
|
1179
1177
|
"TOOL_NOT_FOUND",
|
|
1180
1178
|
`Tool not found: ${toolName}`,
|
|
1181
1179
|
{ availableTools: registry.snapshot().slice(0, 20).map((s) => s.name) }
|
|
@@ -1214,7 +1212,7 @@ function validateInput(spec, args, validator) {
|
|
|
1214
1212
|
if (error instanceof SchemaValidationError) {
|
|
1215
1213
|
const requiredKeys = getRequiredKeys(spec.inputSchema);
|
|
1216
1214
|
const passedKeys = args != null && typeof args === "object" && !Array.isArray(args) ? Object.keys(args) : [];
|
|
1217
|
-
throw
|
|
1215
|
+
throw chunkAGLGFQUW_cjs.createTaggedError("INPUT_SCHEMA_INVALID", error.message, {
|
|
1218
1216
|
errors: error.errors,
|
|
1219
1217
|
schema: spec.inputSchema,
|
|
1220
1218
|
requiredKeys: requiredKeys.length ? requiredKeys : void 0,
|
|
@@ -1287,7 +1285,7 @@ async function requireHumanApproval(spec, args, ctx, deps) {
|
|
|
1287
1285
|
sideEffect,
|
|
1288
1286
|
reason: err instanceof Error ? err.message : String(err)
|
|
1289
1287
|
});
|
|
1290
|
-
throw
|
|
1288
|
+
throw chunkAGLGFQUW_cjs.createTaggedError(
|
|
1291
1289
|
"HITL_DENIED",
|
|
1292
1290
|
`Human denied approval for ${spec.name} (${sideEffect})`,
|
|
1293
1291
|
{ reason: err instanceof Error ? err.message : String(err) }
|
|
@@ -1300,7 +1298,7 @@ async function requireHumanApproval(spec, args, ctx, deps) {
|
|
|
1300
1298
|
sideEffect,
|
|
1301
1299
|
reason: "User rejected"
|
|
1302
1300
|
});
|
|
1303
|
-
throw
|
|
1301
|
+
throw chunkAGLGFQUW_cjs.createTaggedError("HITL_DENIED", `Human denied approval for ${spec.name} (${sideEffect})`);
|
|
1304
1302
|
}
|
|
1305
1303
|
deps.eventLog.append({
|
|
1306
1304
|
...baseEvent,
|
|
@@ -1312,7 +1310,7 @@ async function requireHumanApproval(spec, args, ctx, deps) {
|
|
|
1312
1310
|
async function executeWithBudget(spec, args, ctx, spanId, deps) {
|
|
1313
1311
|
const adapter = deps.adaptersByToolName.get(spec.name) ?? deps.adapters.get(spec.kind);
|
|
1314
1312
|
if (!adapter) {
|
|
1315
|
-
throw
|
|
1313
|
+
throw chunkAGLGFQUW_cjs.createTaggedError(
|
|
1316
1314
|
"TOOL_NOT_FOUND",
|
|
1317
1315
|
`No adapter registered for kind: ${spec.kind}`
|
|
1318
1316
|
);
|
|
@@ -1340,7 +1338,7 @@ async function executeWithBudget(spec, args, ctx, spanId, deps) {
|
|
|
1340
1338
|
return result;
|
|
1341
1339
|
});
|
|
1342
1340
|
};
|
|
1343
|
-
const retryFn = () =>
|
|
1341
|
+
const retryFn = () => chunkAGLGFQUW_cjs.withRetry(executeFn, {
|
|
1344
1342
|
maxRetries,
|
|
1345
1343
|
onRetry: (error, attempt) => {
|
|
1346
1344
|
deps.metrics.recordRetry(spec.name);
|
|
@@ -1367,7 +1365,7 @@ async function executeWithBudget(spec, args, ctx, spanId, deps) {
|
|
|
1367
1365
|
});
|
|
1368
1366
|
} catch (error) {
|
|
1369
1367
|
if (error instanceof Error && error.message.includes("timed out")) {
|
|
1370
|
-
throw
|
|
1368
|
+
throw chunkAGLGFQUW_cjs.createTaggedError("TIMEOUT", error.message);
|
|
1371
1369
|
}
|
|
1372
1370
|
throw error;
|
|
1373
1371
|
}
|
|
@@ -1381,7 +1379,7 @@ function validateOutput(spec, result, validator) {
|
|
|
1381
1379
|
);
|
|
1382
1380
|
} catch (error) {
|
|
1383
1381
|
if (error instanceof SchemaValidationError) {
|
|
1384
|
-
throw
|
|
1382
|
+
throw chunkAGLGFQUW_cjs.createTaggedError("OUTPUT_SCHEMA_INVALID", error.message, {
|
|
1385
1383
|
errors: error.errors
|
|
1386
1384
|
});
|
|
1387
1385
|
}
|
|
@@ -1475,7 +1473,7 @@ var PTCRuntime = class {
|
|
|
1475
1473
|
logger;
|
|
1476
1474
|
constructor(options = {}) {
|
|
1477
1475
|
this.config = options.config ?? {};
|
|
1478
|
-
this.registry = options.registry ?? new
|
|
1476
|
+
this.registry = options.registry ?? new chunkAGLGFQUW_cjs.ToolRegistry();
|
|
1479
1477
|
this.validator = options.validator ?? new SchemaValidator();
|
|
1480
1478
|
this.policy = options.policy ?? new PolicyEngine(this.config.policy);
|
|
1481
1479
|
this.budget = options.budget ?? new BudgetManager(this.config.budget);
|
|
@@ -1636,7 +1634,7 @@ var PTCRuntime = class {
|
|
|
1636
1634
|
const enrichedArgs = enrichDefaults(spec, validatedArgs, this.validator);
|
|
1637
1635
|
enforcePolicy(spec, enrichedArgs, ctx, this.getPipelineDeps());
|
|
1638
1636
|
if (!this.budget.checkRateLimit(spec.name)) {
|
|
1639
|
-
throw
|
|
1637
|
+
throw chunkAGLGFQUW_cjs.createTaggedError("BUDGET_EXCEEDED", `Rate limit exceeded for tool: ${spec.name}`);
|
|
1640
1638
|
}
|
|
1641
1639
|
await requireHumanApproval(spec, enrichedArgs, ctx, {
|
|
1642
1640
|
onApprovalRequired: this.config.onApprovalRequired,
|
|
@@ -1651,7 +1649,7 @@ var PTCRuntime = class {
|
|
|
1651
1649
|
const toolError = asToolReturnedError(pipeline.result);
|
|
1652
1650
|
if (toolError) {
|
|
1653
1651
|
const hint = buildInputSchemaHint(pipeline.spec.inputSchema);
|
|
1654
|
-
throw
|
|
1652
|
+
throw chunkAGLGFQUW_cjs.createTaggedError("UPSTREAM_ERROR", toolError.message, {
|
|
1655
1653
|
...toolError.details && typeof toolError.details === "object" && !Array.isArray(toolError.details) ? toolError.details : {},
|
|
1656
1654
|
hint: hint ?? "Check the tool's input schema for required property names."
|
|
1657
1655
|
});
|
|
@@ -1732,7 +1730,7 @@ function buildInputSchemaHint(inputSchema) {
|
|
|
1732
1730
|
if (names.length === 0) return null;
|
|
1733
1731
|
return `This tool expects input property ${names.length === 1 ? `'${names[0]}'` : `one of [${names.map((n) => `'${n}'`).join(", ")}]`}. Use the exact property names from the tool schema.`;
|
|
1734
1732
|
}
|
|
1735
|
-
var requireFromPackage = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
1733
|
+
var requireFromPackage = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-PJDINB7G.cjs', document.baseURI).href)));
|
|
1736
1734
|
function getProjectRequire() {
|
|
1737
1735
|
const cwd = process.cwd();
|
|
1738
1736
|
if (fs.existsSync(path.join(cwd, "package.json"))) return module$1.createRequire(path.join(cwd, "package.json"));
|
|
@@ -1855,7 +1853,7 @@ function createPrefixingRegistry(registry, prefix) {
|
|
|
1855
1853
|
register(spec) {
|
|
1856
1854
|
registry.register({
|
|
1857
1855
|
...spec,
|
|
1858
|
-
name: prefix +
|
|
1856
|
+
name: prefix + chunkJW4EMVTE_cjs.normalizeToolName(spec.name)
|
|
1859
1857
|
});
|
|
1860
1858
|
},
|
|
1861
1859
|
bulkRegister(specs) {
|
|
@@ -1898,7 +1896,7 @@ function parseNpmDescriptor(entry) {
|
|
|
1898
1896
|
}
|
|
1899
1897
|
|
|
1900
1898
|
// src/api/runtimeFromConfig.ts
|
|
1901
|
-
var requireFromPackage2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
1899
|
+
var requireFromPackage2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-PJDINB7G.cjs', document.baseURI).href)));
|
|
1902
1900
|
var DEFAULT_EXTENSION_PACKAGES = [];
|
|
1903
1901
|
function resolveFileDescriptorPath(descriptor, configFilePath) {
|
|
1904
1902
|
const parsed = parseToolPath(descriptor.trim());
|
|
@@ -2082,7 +2080,7 @@ async function loadLocalDirectoryForFileDescriptor(descriptor, configFilePath, s
|
|
|
2082
2080
|
if (!resolvedPath || !fs.existsSync(resolvedPath) || !fs.statSync(resolvedPath).isDirectory()) return null;
|
|
2083
2081
|
if (fs.existsSync(path.join(resolvedPath, "package.json"))) return null;
|
|
2084
2082
|
const scanErrors = [];
|
|
2085
|
-
const scanner = new
|
|
2083
|
+
const scanner = new chunkLKE7PMRB_cjs.DirectoryScanner({
|
|
2086
2084
|
roots: [{ path: resolvedPath, namespace: "local" }],
|
|
2087
2085
|
onError: (toolDir, error) => scanErrors.push(`${toolDir}: ${error.message}`)
|
|
2088
2086
|
});
|
|
@@ -2126,9 +2124,9 @@ async function loadAllExtensionsFromToolYamlAsync(configFilePath, stepLog) {
|
|
|
2126
2124
|
return loaded;
|
|
2127
2125
|
}
|
|
2128
2126
|
function createRuntimeFromConfigSync(options = {}) {
|
|
2129
|
-
const registry = new
|
|
2127
|
+
const registry = new chunkAGLGFQUW_cjs.ToolRegistry();
|
|
2130
2128
|
const stepLog = options.stepLog;
|
|
2131
|
-
|
|
2129
|
+
chunkAGLGFQUW_cjs.setSandboxValidationEnabled(options.coreTools?.enableSandboxValidation === true);
|
|
2132
2130
|
if (options.coreTools !== void 0) {
|
|
2133
2131
|
if (options.configFilePath) {
|
|
2134
2132
|
const all = loadAllExtensionsFromToolYamlSync(options.configFilePath, stepLog);
|
|
@@ -2170,12 +2168,12 @@ function createRuntimeFromConfigSync(options = {}) {
|
|
|
2170
2168
|
return { runtime, registry };
|
|
2171
2169
|
}
|
|
2172
2170
|
async function createRuntimeFromConfig(options = {}) {
|
|
2173
|
-
|
|
2171
|
+
chunkAGLGFQUW_cjs.setSandboxValidationEnabled(options.coreTools?.enableSandboxValidation === true);
|
|
2174
2172
|
if (options.coreTools !== void 0 && options.configFilePath) {
|
|
2175
2173
|
const all = await loadAllExtensionsFromToolYamlAsync(options.configFilePath, options.stepLog);
|
|
2176
2174
|
if (all.length > 0) {
|
|
2177
2175
|
if (options.stepLog) options.stepLog(`Registered ${all.length} extension(s) from tool.yaml`);
|
|
2178
|
-
const registry = new
|
|
2176
|
+
const registry = new chunkAGLGFQUW_cjs.ToolRegistry();
|
|
2179
2177
|
const runtime = new PTCRuntime({ registry });
|
|
2180
2178
|
for (const ext of all) {
|
|
2181
2179
|
const before = new Set(registry.snapshot().map((s) => s.name));
|
|
@@ -2226,7 +2224,7 @@ var DEFAULT_CTX = {
|
|
|
2226
2224
|
]
|
|
2227
2225
|
};
|
|
2228
2226
|
function toMcpToolName(registryName) {
|
|
2229
|
-
return
|
|
2227
|
+
return chunkJW4EMVTE_cjs.normalizeToolName(registryName);
|
|
2230
2228
|
}
|
|
2231
2229
|
async function createMcpServerWithTools(runtime, options) {
|
|
2232
2230
|
const { McpServer } = await import('@modelcontextprotocol/sdk/server/mcp.js');
|
|
@@ -2248,7 +2246,7 @@ async function createMcpServerWithTools(runtime, options) {
|
|
|
2248
2246
|
async (args) => {
|
|
2249
2247
|
const ctx = ctxFactory();
|
|
2250
2248
|
const result = await runtime.invoke(
|
|
2251
|
-
{ tool: spec.name, args: args ?? {}, purpose:
|
|
2249
|
+
{ tool: spec.name, args: args ?? {}, purpose: chunkLKE7PMRB_cjs.MCP_KIND },
|
|
2252
2250
|
ctx
|
|
2253
2251
|
);
|
|
2254
2252
|
if (result.ok) {
|
|
@@ -2325,7 +2323,7 @@ async function createMCPServerStreamableHttp(runtimeOrConfig, options = {}) {
|
|
|
2325
2323
|
async listen(listenPort, listenHost) {
|
|
2326
2324
|
const p = listenPort ?? port;
|
|
2327
2325
|
const h = listenHost ?? host;
|
|
2328
|
-
return new Promise((resolve4
|
|
2326
|
+
return new Promise((resolve4) => {
|
|
2329
2327
|
const server = app.listen(p, h, () => {
|
|
2330
2328
|
const addr = server.address();
|
|
2331
2329
|
const actualPort = typeof addr === "object" && addr !== null && "port" in addr ? addr.port : p;
|
|
@@ -2740,5 +2738,5 @@ exports.npmDescriptorToPackagePrefixWithVersion = npmDescriptorToPackagePrefixWi
|
|
|
2740
2738
|
exports.resolveSandboxedPath = resolveSandboxedPath;
|
|
2741
2739
|
exports.resolveToolDescriptor = resolveToolDescriptor;
|
|
2742
2740
|
exports.runMCPServerOverStdio = runMCPServerOverStdio;
|
|
2743
|
-
//# sourceMappingURL=chunk-
|
|
2744
|
-
//# sourceMappingURL=chunk-
|
|
2741
|
+
//# sourceMappingURL=chunk-PJDINB7G.cjs.map
|
|
2742
|
+
//# sourceMappingURL=chunk-PJDINB7G.cjs.map
|