@easynet/agent-tool 1.0.20 → 1.0.22
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/createAgentTools.d.ts.map +1 -1
- package/dist/api/main.cjs +17 -17
- package/dist/api/main.js +6 -6
- package/dist/api/runtimeFromConfig.d.ts +15 -11
- package/dist/api/runtimeFromConfig.d.ts.map +1 -1
- package/dist/canonicalCoreSchemas-3BZJH6XD.js +4 -0
- package/dist/{canonicalCoreSchemas-JPTOIQKR.js.map → canonicalCoreSchemas-3BZJH6XD.js.map} +1 -1
- package/dist/canonicalCoreSchemas-P6KUD3WP.cjs +21 -0
- package/dist/{canonicalCoreSchemas-K57HKGZJ.cjs.map → canonicalCoreSchemas-P6KUD3WP.cjs.map} +1 -1
- package/dist/{chunk-P5UPHQ7N.js → chunk-3MUOBLNB.js} +3 -3
- package/dist/{chunk-P5UPHQ7N.js.map → chunk-3MUOBLNB.js.map} +1 -1
- package/dist/{chunk-6JWQVVL2.cjs → chunk-4KTWJQ32.cjs} +4 -4
- package/dist/{chunk-6JWQVVL2.cjs.map → chunk-4KTWJQ32.cjs.map} +1 -1
- package/dist/{chunk-6WQYJLVU.cjs → chunk-AH4NI4GN.cjs} +51 -53
- package/dist/chunk-AH4NI4GN.cjs.map +1 -0
- package/dist/{chunk-QP6JJF76.cjs → chunk-AT3N7SQK.cjs} +11 -11
- package/dist/{chunk-QP6JJF76.cjs.map → chunk-AT3N7SQK.cjs.map} +1 -1
- package/dist/{chunk-OHDIMQ22.js → chunk-BOMOGAFZ.js} +4 -4
- package/dist/{chunk-OHDIMQ22.js.map → chunk-BOMOGAFZ.js.map} +1 -1
- package/dist/{chunk-IGMDLCV7.js → chunk-BPHY6UVK.js} +33 -33
- package/dist/chunk-BPHY6UVK.js.map +1 -0
- package/dist/{chunk-FGGTT32N.cjs → chunk-DYDNPIV2.cjs} +2 -2
- package/dist/{chunk-FGGTT32N.cjs.map → chunk-DYDNPIV2.cjs.map} +1 -1
- package/dist/{chunk-TAW4FP3A.cjs → chunk-FWIMPZC2.cjs} +16 -22
- package/dist/chunk-FWIMPZC2.cjs.map +1 -0
- package/dist/{chunk-GWBJEGS7.js → chunk-KDB3MY2H.js} +2 -2
- package/dist/{chunk-GWBJEGS7.js.map → chunk-KDB3MY2H.js.map} +1 -1
- package/dist/{chunk-INYWD3OJ.cjs → chunk-P2LVZGZ4.cjs} +12 -12
- package/dist/{chunk-INYWD3OJ.cjs.map → chunk-P2LVZGZ4.cjs.map} +1 -1
- package/dist/{chunk-WKWSXCS4.js → chunk-QP5FIRC2.js} +6 -6
- package/dist/{chunk-WKWSXCS4.js.map → chunk-QP5FIRC2.js.map} +1 -1
- package/dist/{chunk-ONIBCU2Y.cjs → chunk-TOSPHMYU.cjs} +7 -7
- package/dist/{chunk-ONIBCU2Y.cjs.map → chunk-TOSPHMYU.cjs.map} +1 -1
- package/dist/{chunk-NNMMUG2X.js → chunk-ZRDI2RKU.js} +7 -13
- package/dist/chunk-ZRDI2RKU.js.map +1 -0
- package/dist/{chunk-IU35EFPK.js → chunk-ZRHPGW7W.js} +3 -3
- package/dist/{chunk-IU35EFPK.js.map → chunk-ZRHPGW7W.js.map} +1 -1
- package/dist/core/index.cjs +4 -4
- package/dist/core/index.js +1 -1
- package/dist/core/runtime.cjs +6 -6
- package/dist/core/runtime.js +2 -2
- package/dist/core/types/ToolSpec.d.ts +3 -3
- package/dist/core/types/ToolSpec.d.ts.map +1 -1
- package/dist/index.cjs +68 -68
- package/dist/index.js +10 -10
- package/dist/tools/util/index.d.ts +1 -1
- package/dist/tools/util/index.d.ts.map +1 -1
- package/dist/utils/cli/index.cjs +21 -21
- package/dist/utils/cli/index.js +6 -6
- package/package.json +1 -1
- package/dist/canonicalCoreSchemas-JPTOIQKR.js +0 -4
- package/dist/canonicalCoreSchemas-K57HKGZJ.cjs +0 -21
- package/dist/chunk-6WQYJLVU.cjs.map +0 -1
- package/dist/chunk-IGMDLCV7.js.map +0 -1
- package/dist/chunk-NNMMUG2X.js.map +0 -1
- package/dist/chunk-TAW4FP3A.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkTOSPHMYU_cjs = require('./chunk-TOSPHMYU.cjs');
|
|
4
|
+
var chunkDYDNPIV2_cjs = require('./chunk-DYDNPIV2.cjs');
|
|
5
5
|
var Ajv = require('ajv');
|
|
6
6
|
var addFormats = require('ajv-formats');
|
|
7
7
|
var cockatiel = require('cockatiel');
|
|
@@ -940,10 +940,10 @@ var Tracing = class {
|
|
|
940
940
|
}
|
|
941
941
|
};
|
|
942
942
|
function resolveTool(toolName, registry) {
|
|
943
|
-
const key =
|
|
943
|
+
const key = chunkDYDNPIV2_cjs.normalizeToolName(toolName);
|
|
944
944
|
const spec = registry.get(key);
|
|
945
945
|
if (!spec) {
|
|
946
|
-
throw
|
|
946
|
+
throw chunkTOSPHMYU_cjs.createTaggedError(
|
|
947
947
|
"TOOL_NOT_FOUND",
|
|
948
948
|
`Tool not found: ${toolName}`,
|
|
949
949
|
{ availableTools: registry.snapshot().slice(0, 20).map((s) => s.name) }
|
|
@@ -982,7 +982,7 @@ function validateInput(spec, args, validator) {
|
|
|
982
982
|
if (error instanceof SchemaValidationError) {
|
|
983
983
|
const requiredKeys = getRequiredKeys(spec.inputSchema);
|
|
984
984
|
const passedKeys = args != null && typeof args === "object" && !Array.isArray(args) ? Object.keys(args) : [];
|
|
985
|
-
throw
|
|
985
|
+
throw chunkTOSPHMYU_cjs.createTaggedError("INPUT_SCHEMA_INVALID", error.message, {
|
|
986
986
|
errors: error.errors,
|
|
987
987
|
schema: spec.inputSchema,
|
|
988
988
|
requiredKeys: requiredKeys.length ? requiredKeys : void 0,
|
|
@@ -1055,7 +1055,7 @@ async function requireHumanApproval(spec, args, ctx, deps) {
|
|
|
1055
1055
|
sideEffect,
|
|
1056
1056
|
reason: err instanceof Error ? err.message : String(err)
|
|
1057
1057
|
});
|
|
1058
|
-
throw
|
|
1058
|
+
throw chunkTOSPHMYU_cjs.createTaggedError(
|
|
1059
1059
|
"HITL_DENIED",
|
|
1060
1060
|
`Human denied approval for ${spec.name} (${sideEffect})`,
|
|
1061
1061
|
{ reason: err instanceof Error ? err.message : String(err) }
|
|
@@ -1068,7 +1068,7 @@ async function requireHumanApproval(spec, args, ctx, deps) {
|
|
|
1068
1068
|
sideEffect,
|
|
1069
1069
|
reason: "User rejected"
|
|
1070
1070
|
});
|
|
1071
|
-
throw
|
|
1071
|
+
throw chunkTOSPHMYU_cjs.createTaggedError("HITL_DENIED", `Human denied approval for ${spec.name} (${sideEffect})`);
|
|
1072
1072
|
}
|
|
1073
1073
|
deps.eventLog.append({
|
|
1074
1074
|
...baseEvent,
|
|
@@ -1080,7 +1080,7 @@ async function requireHumanApproval(spec, args, ctx, deps) {
|
|
|
1080
1080
|
async function executeWithBudget(spec, args, ctx, spanId, deps) {
|
|
1081
1081
|
const adapter = deps.adapters.get(spec.kind);
|
|
1082
1082
|
if (!adapter) {
|
|
1083
|
-
throw
|
|
1083
|
+
throw chunkTOSPHMYU_cjs.createTaggedError(
|
|
1084
1084
|
"TOOL_NOT_FOUND",
|
|
1085
1085
|
`No adapter registered for kind: ${spec.kind}`
|
|
1086
1086
|
);
|
|
@@ -1108,7 +1108,7 @@ async function executeWithBudget(spec, args, ctx, spanId, deps) {
|
|
|
1108
1108
|
return result;
|
|
1109
1109
|
});
|
|
1110
1110
|
};
|
|
1111
|
-
const retryFn = () =>
|
|
1111
|
+
const retryFn = () => chunkTOSPHMYU_cjs.withRetry(executeFn, {
|
|
1112
1112
|
maxRetries,
|
|
1113
1113
|
onRetry: (error, attempt) => {
|
|
1114
1114
|
deps.metrics.recordRetry(spec.name);
|
|
@@ -1135,7 +1135,7 @@ async function executeWithBudget(spec, args, ctx, spanId, deps) {
|
|
|
1135
1135
|
});
|
|
1136
1136
|
} catch (error) {
|
|
1137
1137
|
if (error instanceof Error && error.message.includes("timed out")) {
|
|
1138
|
-
throw
|
|
1138
|
+
throw chunkTOSPHMYU_cjs.createTaggedError("TIMEOUT", error.message);
|
|
1139
1139
|
}
|
|
1140
1140
|
throw error;
|
|
1141
1141
|
}
|
|
@@ -1149,7 +1149,7 @@ function validateOutput(spec, result, validator) {
|
|
|
1149
1149
|
);
|
|
1150
1150
|
} catch (error) {
|
|
1151
1151
|
if (error instanceof SchemaValidationError) {
|
|
1152
|
-
throw
|
|
1152
|
+
throw chunkTOSPHMYU_cjs.createTaggedError("OUTPUT_SCHEMA_INVALID", error.message, {
|
|
1153
1153
|
errors: error.errors
|
|
1154
1154
|
});
|
|
1155
1155
|
}
|
|
@@ -1242,7 +1242,7 @@ var PTCRuntime = class {
|
|
|
1242
1242
|
logger;
|
|
1243
1243
|
constructor(options = {}) {
|
|
1244
1244
|
this.config = options.config ?? {};
|
|
1245
|
-
this.registry = options.registry ?? new
|
|
1245
|
+
this.registry = options.registry ?? new chunkTOSPHMYU_cjs.ToolRegistry();
|
|
1246
1246
|
this.validator = options.validator ?? new SchemaValidator();
|
|
1247
1247
|
this.policy = options.policy ?? new PolicyEngine(this.config.policy);
|
|
1248
1248
|
this.budget = options.budget ?? new BudgetManager(this.config.budget);
|
|
@@ -1343,7 +1343,7 @@ var PTCRuntime = class {
|
|
|
1343
1343
|
tracing: this.tracing
|
|
1344
1344
|
});
|
|
1345
1345
|
if (!this.budget.checkRateLimit(spec.name)) {
|
|
1346
|
-
throw
|
|
1346
|
+
throw chunkTOSPHMYU_cjs.createTaggedError(
|
|
1347
1347
|
"BUDGET_EXCEEDED",
|
|
1348
1348
|
`Rate limit exceeded for tool: ${spec.name}`
|
|
1349
1349
|
);
|
|
@@ -1366,7 +1366,7 @@ var PTCRuntime = class {
|
|
|
1366
1366
|
const toolError = asToolReturnedError(result);
|
|
1367
1367
|
if (toolError) {
|
|
1368
1368
|
const hint = buildInputSchemaHint(spec.inputSchema);
|
|
1369
|
-
throw
|
|
1369
|
+
throw chunkTOSPHMYU_cjs.createTaggedError("UPSTREAM_ERROR", toolError.message, {
|
|
1370
1370
|
...toolError.details && typeof toolError.details === "object" && !Array.isArray(toolError.details) ? toolError.details : {},
|
|
1371
1371
|
hint: hint ?? "Check the tool's input schema for required property names."
|
|
1372
1372
|
});
|
|
@@ -1526,7 +1526,7 @@ function npmDescriptorToRegistryPrefix(descriptor, resolvedVersion) {
|
|
|
1526
1526
|
const scope = slashIdx < 0 ? scopeAndPackage : scopeAndPackage.slice(0, slashIdx).replace(/^@/, "");
|
|
1527
1527
|
const pkg = slashIdx < 0 ? "" : scopeAndPackage.slice(slashIdx + 1);
|
|
1528
1528
|
const segment = [scope, pkg, version].filter(Boolean).join(".");
|
|
1529
|
-
const normalized =
|
|
1529
|
+
const normalized = chunkDYDNPIV2_cjs.normalizeToolName(segment);
|
|
1530
1530
|
if (!normalized) return "";
|
|
1531
1531
|
return "npm." + normalized + ".";
|
|
1532
1532
|
}
|
|
@@ -1552,7 +1552,7 @@ function expandToolDescriptorsToRegistryNames(descriptors, registryNames) {
|
|
|
1552
1552
|
const out = [];
|
|
1553
1553
|
const seen = /* @__PURE__ */ new Set();
|
|
1554
1554
|
function add(name) {
|
|
1555
|
-
const key =
|
|
1555
|
+
const key = chunkDYDNPIV2_cjs.normalizeToolName(name);
|
|
1556
1556
|
if (registryNames.includes(key) && !seen.has(key)) {
|
|
1557
1557
|
seen.add(key);
|
|
1558
1558
|
out.push(key);
|
|
@@ -1576,7 +1576,7 @@ function expandToolDescriptorsToRegistryNames(descriptors, registryNames) {
|
|
|
1576
1576
|
}
|
|
1577
1577
|
continue;
|
|
1578
1578
|
}
|
|
1579
|
-
const name =
|
|
1579
|
+
const name = chunkDYDNPIV2_cjs.normalizeToolName(s);
|
|
1580
1580
|
add(name);
|
|
1581
1581
|
}
|
|
1582
1582
|
return out;
|
|
@@ -1731,14 +1731,14 @@ async function importFromCache(packageRoot) {
|
|
|
1731
1731
|
fileUrl
|
|
1732
1732
|
);
|
|
1733
1733
|
}
|
|
1734
|
-
var requireFromPackage = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
1734
|
+
var requireFromPackage = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-AH4NI4GN.cjs', document.baseURI).href)));
|
|
1735
1735
|
function getProjectRequire() {
|
|
1736
1736
|
const cwd = process.cwd();
|
|
1737
1737
|
if (fs.existsSync(path.join(cwd, "package.json"))) return module$1.createRequire(path.join(cwd, "package.json"));
|
|
1738
1738
|
if (fs.existsSync(path.join(cwd, "tool.yaml"))) return module$1.createRequire(path.join(cwd, "tool.yaml"));
|
|
1739
1739
|
return null;
|
|
1740
1740
|
}
|
|
1741
|
-
var
|
|
1741
|
+
var DEFAULT_EXTENSION_PACKAGES = [
|
|
1742
1742
|
"@easynet/agent-tool-builtin-tools",
|
|
1743
1743
|
"@easynet/agent-tool-builtin",
|
|
1744
1744
|
"@easynet/agent-tool-buildin"
|
|
@@ -1759,12 +1759,12 @@ function getInstalledPackageVersion(packageName) {
|
|
|
1759
1759
|
}
|
|
1760
1760
|
return null;
|
|
1761
1761
|
}
|
|
1762
|
-
function
|
|
1762
|
+
function loadExtensionFromNodeModules() {
|
|
1763
1763
|
const projectRequire = getProjectRequire();
|
|
1764
1764
|
const requirers = [requireFromPackage];
|
|
1765
1765
|
if (projectRequire) requirers.push(projectRequire);
|
|
1766
1766
|
for (const req of requirers) {
|
|
1767
|
-
for (const pkg of
|
|
1767
|
+
for (const pkg of DEFAULT_EXTENSION_PACKAGES) {
|
|
1768
1768
|
try {
|
|
1769
1769
|
const mod = req(pkg);
|
|
1770
1770
|
if (mod && typeof mod.registerCoreTools === "function") return { registerCoreTools: mod.registerCoreTools, packageName: pkg };
|
|
@@ -1778,7 +1778,7 @@ function loadBuiltinTools() {
|
|
|
1778
1778
|
function createPrefixingRegistry(registry, prefix) {
|
|
1779
1779
|
return {
|
|
1780
1780
|
register(spec) {
|
|
1781
|
-
registry.register({ ...spec, name: prefix +
|
|
1781
|
+
registry.register({ ...spec, name: prefix + chunkDYDNPIV2_cjs.normalizeToolName(spec.name) });
|
|
1782
1782
|
},
|
|
1783
1783
|
bulkRegister(specs) {
|
|
1784
1784
|
specs.forEach((s) => this.register(s));
|
|
@@ -1818,7 +1818,7 @@ function parseNpmDescriptor(entry) {
|
|
|
1818
1818
|
const version = rest.slice(at + 1).split("#")[0]?.trim() || "latest";
|
|
1819
1819
|
return { packageName, version };
|
|
1820
1820
|
}
|
|
1821
|
-
function
|
|
1821
|
+
function loadExtensionFromToolYamlCache(configFilePath, stepLog) {
|
|
1822
1822
|
const localPath = path.isAbsolute(configFilePath) ? configFilePath : path.resolve(process.cwd(), configFilePath);
|
|
1823
1823
|
if (!fs.existsSync(localPath)) return null;
|
|
1824
1824
|
const config = loadToolConfig(localPath);
|
|
@@ -1826,11 +1826,11 @@ function loadBuiltinFromToolYamlCache(configFilePath, stepLog) {
|
|
|
1826
1826
|
if (!Array.isArray(tools)) return null;
|
|
1827
1827
|
const cacheBase = getCacheBaseFromToolConfig(localPath);
|
|
1828
1828
|
const cacheOpts = cacheBase ? { cacheBase } : {};
|
|
1829
|
-
if (stepLog) stepLog(`Loading
|
|
1829
|
+
if (stepLog) stepLog(`Loading extension from tool.yaml cache (cacheBase: ${cacheBase ?? "~/.agent/cache"})`);
|
|
1830
1830
|
for (const entry of tools) {
|
|
1831
1831
|
const entryStr = String(entry).trim();
|
|
1832
1832
|
const parsed = parseNpmDescriptor(entryStr);
|
|
1833
|
-
if (!parsed
|
|
1833
|
+
if (!parsed) continue;
|
|
1834
1834
|
for (const opts of [cacheOpts, {}]) {
|
|
1835
1835
|
try {
|
|
1836
1836
|
if (stepLog && Object.keys(opts).length === 0 && cacheBase) stepLog("Falling back to default cache ~/.agent/cache");
|
|
@@ -1852,7 +1852,7 @@ function loadBuiltinFromToolYamlCache(configFilePath, stepLog) {
|
|
|
1852
1852
|
}
|
|
1853
1853
|
return null;
|
|
1854
1854
|
}
|
|
1855
|
-
async function
|
|
1855
|
+
async function loadExtensionFromToolYamlCacheAsync(configFilePath, stepLog) {
|
|
1856
1856
|
const localPath = path.isAbsolute(configFilePath) ? configFilePath : path.resolve(process.cwd(), configFilePath);
|
|
1857
1857
|
if (!fs.existsSync(localPath)) return null;
|
|
1858
1858
|
const config = loadToolConfig(localPath);
|
|
@@ -1860,11 +1860,11 @@ async function loadBuiltinFromToolYamlCacheAsync(configFilePath, stepLog) {
|
|
|
1860
1860
|
if (!Array.isArray(tools)) return null;
|
|
1861
1861
|
const cacheBase = getCacheBaseFromToolConfig(localPath);
|
|
1862
1862
|
const cacheOpts = cacheBase ? { cacheBase } : {};
|
|
1863
|
-
if (stepLog) stepLog("Loading
|
|
1863
|
+
if (stepLog) stepLog("Loading extension from tool.yaml cache (async)");
|
|
1864
1864
|
for (const entry of tools) {
|
|
1865
1865
|
const entryStr = String(entry).trim();
|
|
1866
1866
|
const parsed = parseNpmDescriptor(entryStr);
|
|
1867
|
-
if (!parsed
|
|
1867
|
+
if (!parsed) continue;
|
|
1868
1868
|
for (const opts of [cacheOpts, {}]) {
|
|
1869
1869
|
try {
|
|
1870
1870
|
if (stepLog && Object.keys(opts).length === 0 && cacheBase) stepLog("Falling back to default cache ~/.agent/cache");
|
|
@@ -1892,18 +1892,18 @@ function loadExampleTools() {
|
|
|
1892
1892
|
}
|
|
1893
1893
|
}
|
|
1894
1894
|
function createRuntimeFromConfigSync(options = {}) {
|
|
1895
|
-
const registry = new
|
|
1895
|
+
const registry = new chunkTOSPHMYU_cjs.ToolRegistry();
|
|
1896
1896
|
const stepLog = options.stepLog;
|
|
1897
1897
|
if (options.coreTools !== void 0) {
|
|
1898
|
-
if (stepLog) stepLog("Trying
|
|
1899
|
-
let
|
|
1900
|
-
if (
|
|
1901
|
-
if (stepLog) stepLog("Registered
|
|
1902
|
-
const descriptor = `npm:${
|
|
1903
|
-
const resolvedVersion = getInstalledPackageVersion(
|
|
1898
|
+
if (stepLog) stepLog("Trying extension from node_modules");
|
|
1899
|
+
let extensionNode = loadExtensionFromNodeModules();
|
|
1900
|
+
if (extensionNode) {
|
|
1901
|
+
if (stepLog) stepLog("Registered extension from node_modules");
|
|
1902
|
+
const descriptor = `npm:${extensionNode.packageName}`;
|
|
1903
|
+
const resolvedVersion = getInstalledPackageVersion(extensionNode.packageName);
|
|
1904
1904
|
const prefix = npmDescriptorToRegistryPrefix(descriptor, resolvedVersion ?? void 0);
|
|
1905
1905
|
const reg = prefix ? createPrefixingRegistry(registry, prefix) : registry;
|
|
1906
|
-
const coreAdapter =
|
|
1906
|
+
const coreAdapter = extensionNode.registerCoreTools(reg, options.coreTools);
|
|
1907
1907
|
const runtime3 = new PTCRuntime({ registry });
|
|
1908
1908
|
runtime3.registerAdapter(coreAdapter);
|
|
1909
1909
|
if (options.exampleTools !== void 0) {
|
|
@@ -1916,13 +1916,13 @@ function createRuntimeFromConfigSync(options = {}) {
|
|
|
1916
1916
|
return { runtime: runtime3, registry };
|
|
1917
1917
|
}
|
|
1918
1918
|
if (options.configFilePath) {
|
|
1919
|
-
if (stepLog) stepLog("No
|
|
1920
|
-
const
|
|
1921
|
-
if (
|
|
1922
|
-
if (stepLog) stepLog("Registered
|
|
1923
|
-
const prefix = npmDescriptorToRegistryPrefix(
|
|
1919
|
+
if (stepLog) stepLog("No extension in node_modules, loading from tool.yaml cache");
|
|
1920
|
+
const extensionCache = loadExtensionFromToolYamlCache(options.configFilePath, stepLog);
|
|
1921
|
+
if (extensionCache) {
|
|
1922
|
+
if (stepLog) stepLog("Registered extension from cache");
|
|
1923
|
+
const prefix = npmDescriptorToRegistryPrefix(extensionCache.descriptor, extensionCache.resolvedVersion);
|
|
1924
1924
|
const reg = prefix ? createPrefixingRegistry(registry, prefix) : registry;
|
|
1925
|
-
const coreAdapter =
|
|
1925
|
+
const coreAdapter = extensionCache.registerCoreTools(reg, options.coreTools);
|
|
1926
1926
|
const runtime3 = new PTCRuntime({ registry });
|
|
1927
1927
|
runtime3.registerAdapter(coreAdapter);
|
|
1928
1928
|
if (options.exampleTools !== void 0) {
|
|
@@ -1953,14 +1953,14 @@ function createRuntimeFromConfigSync(options = {}) {
|
|
|
1953
1953
|
async function createRuntimeFromConfig(options = {}) {
|
|
1954
1954
|
const syncResult = createRuntimeFromConfigSync(options);
|
|
1955
1955
|
if (options.coreTools !== void 0 && options.configFilePath && syncResult.registry.snapshot().length === 0) {
|
|
1956
|
-
if (options.stepLog) options.stepLog("No
|
|
1957
|
-
const
|
|
1958
|
-
if (
|
|
1959
|
-
if (options.stepLog) options.stepLog("Registered
|
|
1960
|
-
const registry = new
|
|
1961
|
-
const prefix = npmDescriptorToRegistryPrefix(
|
|
1956
|
+
if (options.stepLog) options.stepLog("No extension from sync, trying async cache load");
|
|
1957
|
+
const extension = await loadExtensionFromToolYamlCacheAsync(options.configFilePath, options.stepLog);
|
|
1958
|
+
if (extension) {
|
|
1959
|
+
if (options.stepLog) options.stepLog("Registered extension from async cache");
|
|
1960
|
+
const registry = new chunkTOSPHMYU_cjs.ToolRegistry();
|
|
1961
|
+
const prefix = npmDescriptorToRegistryPrefix(extension.descriptor, extension.resolvedVersion);
|
|
1962
1962
|
const reg = prefix ? createPrefixingRegistry(registry, prefix) : registry;
|
|
1963
|
-
const coreAdapter =
|
|
1963
|
+
const coreAdapter = extension.registerCoreTools(reg, options.coreTools);
|
|
1964
1964
|
const runtime = new PTCRuntime({ registry });
|
|
1965
1965
|
runtime.registerAdapter(coreAdapter);
|
|
1966
1966
|
return { runtime, registry };
|
|
@@ -1976,7 +1976,6 @@ var MCP_KIND = "mcp";
|
|
|
1976
1976
|
var LANGCHAIN_KIND = "langchain";
|
|
1977
1977
|
var LANGCHAIN_DIR_NAME = "langchain";
|
|
1978
1978
|
|
|
1979
|
-
exports.BUILTIN_PKG_NAMES = BUILTIN_PKG_NAMES;
|
|
1980
1979
|
exports.BudgetManager = BudgetManager;
|
|
1981
1980
|
exports.EventLog = EventLog;
|
|
1982
1981
|
exports.LANGCHAIN_DIR_NAME = LANGCHAIN_DIR_NAME;
|
|
@@ -2004,12 +2003,11 @@ exports.isNpmToolDescriptor = isNpmToolDescriptor;
|
|
|
2004
2003
|
exports.loadToolConfig = loadToolConfig;
|
|
2005
2004
|
exports.normalizeToolList = normalizeToolList;
|
|
2006
2005
|
exports.npmDescriptorToRegistryPrefix = npmDescriptorToRegistryPrefix;
|
|
2007
|
-
exports.parseNpmDescriptor = parseNpmDescriptor;
|
|
2008
2006
|
exports.parseNpmToolDescriptor = parseNpmToolDescriptor;
|
|
2009
2007
|
exports.resolveNpmToolDescriptor = resolveNpmToolDescriptor;
|
|
2010
2008
|
exports.resolveSandboxedPath = resolveSandboxedPath;
|
|
2011
2009
|
exports.resolveToolDescriptor = resolveToolDescriptor;
|
|
2012
2010
|
exports.sanitizeForLog = sanitizeForLog;
|
|
2013
2011
|
exports.summarizeForLog = summarizeForLog;
|
|
2014
|
-
//# sourceMappingURL=chunk-
|
|
2015
|
-
//# sourceMappingURL=chunk-
|
|
2012
|
+
//# sourceMappingURL=chunk-AH4NI4GN.cjs.map
|
|
2013
|
+
//# sourceMappingURL=chunk-AH4NI4GN.cjs.map
|