@easynet/agent-tool 1.0.52 → 1.0.53
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/main.cjs +13 -13
- package/dist/api/main.js +2 -2
- package/dist/api/runtimeFromConfig.d.ts.map +1 -1
- package/dist/{chunk-ZWYRMANX.js → chunk-6VU6PRO3.js} +30 -7
- package/dist/chunk-6VU6PRO3.js.map +1 -0
- package/dist/{chunk-H4RZJVNS.js → chunk-C56WRG4H.js} +3 -3
- package/dist/{chunk-H4RZJVNS.js.map → chunk-C56WRG4H.js.map} +1 -1
- package/dist/{chunk-E3JK57SR.cjs → chunk-DDTTGZLU.cjs} +15 -15
- package/dist/{chunk-E3JK57SR.cjs.map → chunk-DDTTGZLU.cjs.map} +1 -1
- package/dist/{chunk-QEZLUBAL.cjs → chunk-K45PQLZI.cjs} +9 -9
- package/dist/{chunk-QEZLUBAL.cjs.map → chunk-K45PQLZI.cjs.map} +1 -1
- package/dist/{chunk-3GK6IK3N.cjs → chunk-WFPHIYB6.cjs} +31 -8
- package/dist/chunk-WFPHIYB6.cjs.map +1 -0
- package/dist/{chunk-NYUSA2YV.js → chunk-Z5RKNQQB.js} +3 -3
- package/dist/{chunk-NYUSA2YV.js.map → chunk-Z5RKNQQB.js.map} +1 -1
- package/dist/core/runtime/PTCRuntime.d.ts +6 -0
- package/dist/core/runtime/PTCRuntime.d.ts.map +1 -1
- package/dist/core/runtime/PTCRuntimePipeline.d.ts +1 -0
- package/dist/core/runtime/PTCRuntimePipeline.d.ts.map +1 -1
- package/dist/index.cjs +24 -24
- package/dist/index.js +4 -4
- package/dist/utils/cli/index.cjs +16 -16
- package/dist/utils/cli/index.js +2 -2
- package/package.json +3 -3
- package/dist/chunk-3GK6IK3N.cjs.map +0 -1
- package/dist/chunk-ZWYRMANX.js.map +0 -1
|
@@ -1302,7 +1302,7 @@ async function requireHumanApproval(spec, args, ctx, deps) {
|
|
|
1302
1302
|
deps.logger.trace("hitl.granted", { tool: spec.name, sideEffect, requestId: ctx.requestId });
|
|
1303
1303
|
}
|
|
1304
1304
|
async function executeWithBudget(spec, args, ctx, spanId, deps) {
|
|
1305
|
-
const adapter = deps.adapters.get(spec.kind);
|
|
1305
|
+
const adapter = deps.adaptersByToolName.get(spec.name) ?? deps.adapters.get(spec.kind);
|
|
1306
1306
|
if (!adapter) {
|
|
1307
1307
|
throw chunkWQMHMPNC_cjs.createTaggedError(
|
|
1308
1308
|
"TOOL_NOT_FOUND",
|
|
@@ -1456,6 +1456,7 @@ function sanitizeArgs(args) {
|
|
|
1456
1456
|
var PTCRuntime = class {
|
|
1457
1457
|
registry;
|
|
1458
1458
|
adapters = /* @__PURE__ */ new Map();
|
|
1459
|
+
adaptersByToolName = /* @__PURE__ */ new Map();
|
|
1459
1460
|
validator;
|
|
1460
1461
|
policy;
|
|
1461
1462
|
budget;
|
|
@@ -1494,6 +1495,15 @@ var PTCRuntime = class {
|
|
|
1494
1495
|
registerAdapter(adapter) {
|
|
1495
1496
|
this.adapters.set(adapter.kind, adapter);
|
|
1496
1497
|
}
|
|
1498
|
+
/**
|
|
1499
|
+
* Bind an adapter to exact tool keys (full package path + tool path).
|
|
1500
|
+
* This avoids collisions when multiple extensions share the same kind.
|
|
1501
|
+
*/
|
|
1502
|
+
registerAdapterForTools(toolNames, adapter) {
|
|
1503
|
+
for (const name of toolNames) {
|
|
1504
|
+
this.adaptersByToolName.set(name, adapter);
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1497
1507
|
/**
|
|
1498
1508
|
* Get an adapter by kind (e.g. "mcp"). Use to set MCP client via adapter.setClient().
|
|
1499
1509
|
*/
|
|
@@ -1651,6 +1661,7 @@ var PTCRuntime = class {
|
|
|
1651
1661
|
return {
|
|
1652
1662
|
registry: this.registry,
|
|
1653
1663
|
adapters: this.adapters,
|
|
1664
|
+
adaptersByToolName: this.adaptersByToolName,
|
|
1654
1665
|
validator: this.validator,
|
|
1655
1666
|
policy: this.policy,
|
|
1656
1667
|
budget: this.budget,
|
|
@@ -1756,7 +1767,7 @@ function isWithinRoot(path$1, root) {
|
|
|
1756
1767
|
}
|
|
1757
1768
|
|
|
1758
1769
|
// src/api/runtimeFromConfig.ts
|
|
1759
|
-
var requireFromPackage = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
1770
|
+
var requireFromPackage = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-WFPHIYB6.cjs', document.baseURI).href)));
|
|
1760
1771
|
function getProjectRequire() {
|
|
1761
1772
|
const cwd = process.cwd();
|
|
1762
1773
|
if (fs.existsSync(path.join(cwd, "package.json"))) return module$1.createRequire(path.join(cwd, "package.json"));
|
|
@@ -1813,7 +1824,10 @@ function loadExtensionFromNodeModules() {
|
|
|
1813
1824
|
function createPrefixingRegistry(registry, prefix) {
|
|
1814
1825
|
return {
|
|
1815
1826
|
register(spec) {
|
|
1816
|
-
registry.register({
|
|
1827
|
+
registry.register({
|
|
1828
|
+
...spec,
|
|
1829
|
+
name: prefix + chunkQEJF3KDV_cjs.normalizeToolName(spec.name)
|
|
1830
|
+
});
|
|
1817
1831
|
},
|
|
1818
1832
|
bulkRegister(specs) {
|
|
1819
1833
|
specs.forEach((s) => this.register(s));
|
|
@@ -2033,10 +2047,13 @@ function createRuntimeFromConfigSync(options = {}) {
|
|
|
2033
2047
|
if (stepLog) stepLog(`Registered ${all.length} extension(s) from tool.yaml`);
|
|
2034
2048
|
const runtime3 = new PTCRuntime({ registry });
|
|
2035
2049
|
for (const ext of all) {
|
|
2050
|
+
const before = new Set(registry.snapshot().map((s) => s.name));
|
|
2036
2051
|
const prefix = ext.descriptor.startsWith("file:") ? fileDescriptorToRegistryPrefix(ext.descriptor) : npmDescriptorToRegistryPrefix(ext.descriptor, ext.resolvedVersion);
|
|
2037
|
-
const reg =
|
|
2052
|
+
const reg = createPrefixingRegistry(registry, prefix ?? "");
|
|
2038
2053
|
const adapter = ext.register(reg, options.coreTools);
|
|
2039
2054
|
runtime3.registerAdapter(adapter);
|
|
2055
|
+
const registeredNow = registry.snapshot().map((s) => s.name).filter((name) => !before.has(name));
|
|
2056
|
+
runtime3.registerAdapterForTools(registeredNow, adapter);
|
|
2040
2057
|
}
|
|
2041
2058
|
return { runtime: runtime3, registry };
|
|
2042
2059
|
}
|
|
@@ -2047,11 +2064,14 @@ function createRuntimeFromConfigSync(options = {}) {
|
|
|
2047
2064
|
if (stepLog) stepLog("Registered extension from node_modules");
|
|
2048
2065
|
const descriptor = `npm:${extensionNode.packageName}`;
|
|
2049
2066
|
const resolvedVersion = getInstalledPackageVersion(extensionNode.packageName) ?? npm.resolveLatestVersionFromRegistry(extensionNode.packageName);
|
|
2067
|
+
const before = new Set(registry.snapshot().map((s) => s.name));
|
|
2050
2068
|
const prefix = npmDescriptorToRegistryPrefix(descriptor, resolvedVersion);
|
|
2051
|
-
const reg =
|
|
2069
|
+
const reg = createPrefixingRegistry(registry, prefix ?? "");
|
|
2052
2070
|
const coreAdapter = extensionNode.register(reg, options.coreTools);
|
|
2053
2071
|
const runtime3 = new PTCRuntime({ registry });
|
|
2054
2072
|
runtime3.registerAdapter(coreAdapter);
|
|
2073
|
+
const registeredNow = registry.snapshot().map((s) => s.name).filter((name) => !before.has(name));
|
|
2074
|
+
runtime3.registerAdapterForTools(registeredNow, coreAdapter);
|
|
2055
2075
|
return { runtime: runtime3, registry };
|
|
2056
2076
|
}
|
|
2057
2077
|
const runtime2 = new PTCRuntime({ registry });
|
|
@@ -2069,10 +2089,13 @@ async function createRuntimeFromConfig(options = {}) {
|
|
|
2069
2089
|
const registry = new chunkWQMHMPNC_cjs.ToolRegistry();
|
|
2070
2090
|
const runtime = new PTCRuntime({ registry });
|
|
2071
2091
|
for (const ext of all) {
|
|
2092
|
+
const before = new Set(registry.snapshot().map((s) => s.name));
|
|
2072
2093
|
const prefix = ext.descriptor.startsWith("file:") ? fileDescriptorToRegistryPrefix(ext.descriptor) : npmDescriptorToRegistryPrefix(ext.descriptor, ext.resolvedVersion);
|
|
2073
|
-
const reg =
|
|
2094
|
+
const reg = createPrefixingRegistry(registry, prefix ?? "");
|
|
2074
2095
|
const adapter = ext.register(reg, options.coreTools);
|
|
2075
2096
|
runtime.registerAdapter(adapter);
|
|
2097
|
+
const registeredNow = registry.snapshot().map((s) => s.name).filter((name) => !before.has(name));
|
|
2098
|
+
runtime.registerAdapterForTools(registeredNow, adapter);
|
|
2076
2099
|
}
|
|
2077
2100
|
return { runtime, registry };
|
|
2078
2101
|
}
|
|
@@ -2575,5 +2598,5 @@ exports.resolveSandboxedPath2 = resolveSandboxedPath2;
|
|
|
2575
2598
|
exports.resolveToolDescriptor = resolveToolDescriptor;
|
|
2576
2599
|
exports.runMCPServerOverStdio = runMCPServerOverStdio;
|
|
2577
2600
|
exports.setSandboxValidationEnabled = setSandboxValidationEnabled;
|
|
2578
|
-
//# sourceMappingURL=chunk-
|
|
2579
|
-
//# sourceMappingURL=chunk-
|
|
2601
|
+
//# sourceMappingURL=chunk-WFPHIYB6.cjs.map
|
|
2602
|
+
//# sourceMappingURL=chunk-WFPHIYB6.cjs.map
|