@easynet/agent-tool 1.0.38 → 1.0.40
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 +14 -14
- package/dist/api/main.js +3 -3
- package/dist/api/runtimeFromConfig.d.ts +2 -0
- package/dist/api/runtimeFromConfig.d.ts.map +1 -1
- package/dist/{chunk-7VBJ64YC.js → chunk-3AEYVD7K.js} +54 -8
- package/dist/chunk-3AEYVD7K.js.map +1 -0
- package/dist/{chunk-WFRHBW32.cjs → chunk-4NNTCCJ6.cjs} +18 -9
- package/dist/chunk-4NNTCCJ6.cjs.map +1 -0
- package/dist/{chunk-HEMWFWSK.js → chunk-GWUMQRCN.js} +12 -3
- package/dist/chunk-GWUMQRCN.js.map +1 -0
- package/dist/{chunk-LP7KHBA3.cjs → chunk-J5VQMYUV.cjs} +56 -8
- package/dist/chunk-J5VQMYUV.cjs.map +1 -0
- package/dist/{chunk-NJ46JOBI.js → chunk-OSENBU42.js} +3 -3
- package/dist/{chunk-NJ46JOBI.js.map → chunk-OSENBU42.js.map} +1 -1
- package/dist/{chunk-NCPOKCX5.js → chunk-QRI34I5Z.js} +10 -5
- package/dist/chunk-QRI34I5Z.js.map +1 -0
- package/dist/{chunk-DTWOUO7M.cjs → chunk-TSJRMNOB.cjs} +7 -7
- package/dist/{chunk-DTWOUO7M.cjs.map → chunk-TSJRMNOB.cjs.map} +1 -1
- package/dist/{chunk-4HPV2K7P.cjs → chunk-ZPXO5IOW.cjs} +21 -16
- package/dist/chunk-ZPXO5IOW.cjs.map +1 -0
- package/dist/index.cjs +59 -90
- 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 +7 -45
- package/dist/index.js.map +1 -1
- package/dist/security/sandbox.d.ts +1 -0
- package/dist/security/sandbox.d.ts.map +1 -1
- package/dist/tools/util/toolConfig.d.ts +2 -0
- package/dist/tools/util/toolConfig.d.ts.map +1 -1
- package/dist/utils/cli/index.cjs +25 -20
- 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 +12 -7
- package/dist/utils/cli/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-4HPV2K7P.cjs.map +0 -1
- package/dist/chunk-7VBJ64YC.js.map +0 -1
- package/dist/chunk-HEMWFWSK.js.map +0 -1
- package/dist/chunk-LP7KHBA3.cjs.map +0 -1
- package/dist/chunk-NCPOKCX5.js.map +0 -1
- package/dist/chunk-WFRHBW32.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkJ5VQMYUV_cjs = require('./chunk-J5VQMYUV.cjs');
|
|
4
4
|
var chunkUUNG3GL3_cjs = require('./chunk-UUNG3GL3.cjs');
|
|
5
5
|
var tools = require('@langchain/core/tools');
|
|
6
6
|
|
|
@@ -73,7 +73,7 @@ var LangChainToolsHub = class {
|
|
|
73
73
|
const intent = {
|
|
74
74
|
tool: spec.name,
|
|
75
75
|
args: hasArgsWrapper(enriched.inputSchema) ? { args: flat } : flat,
|
|
76
|
-
purpose:
|
|
76
|
+
purpose: chunkJ5VQMYUV_cjs.LANGCHAIN_KIND
|
|
77
77
|
};
|
|
78
78
|
const ctx = ctxFactory();
|
|
79
79
|
const result = await runtime.invoke(intent, ctx);
|
|
@@ -106,12 +106,17 @@ function mergeHostLists(a, b) {
|
|
|
106
106
|
return out;
|
|
107
107
|
}
|
|
108
108
|
function runtimeOptionsFromConfig(opts) {
|
|
109
|
-
const coreTools = opts.coreTools ?? { sandboxRoot: process.cwd(), allowedHosts: [] };
|
|
109
|
+
const coreTools = opts.coreTools ?? { sandboxRoot: process.cwd(), allowedHosts: [], enableSandboxValidation: false };
|
|
110
110
|
if (opts.configFilePath) {
|
|
111
|
-
const toolConfig =
|
|
111
|
+
const toolConfig = chunkJ5VQMYUV_cjs.loadToolConfig(opts.configFilePath);
|
|
112
112
|
const updates = {};
|
|
113
113
|
if (toolConfig.sandboxedPath && typeof toolConfig.sandboxedPath === "string") {
|
|
114
|
-
updates.sandboxRoot =
|
|
114
|
+
updates.sandboxRoot = chunkJ5VQMYUV_cjs.resolveSandboxedPath2(opts.configFilePath, toolConfig.sandboxedPath);
|
|
115
|
+
}
|
|
116
|
+
if (typeof toolConfig.enableSandboxValidation === "boolean") {
|
|
117
|
+
updates.enableSandboxValidation = toolConfig.enableSandboxValidation;
|
|
118
|
+
} else if (coreTools.enableSandboxValidation == null) {
|
|
119
|
+
updates.enableSandboxValidation = false;
|
|
115
120
|
}
|
|
116
121
|
updates.allowedHosts = mergeHostLists(coreTools.allowedHosts, toolConfig.allowedHosts);
|
|
117
122
|
updates.blockedHosts = mergeHostLists(coreTools.blockedHosts, toolConfig.blockedHosts);
|
|
@@ -129,7 +134,7 @@ function runtimeOptionsFromConfig(opts) {
|
|
|
129
134
|
const packageDefaults = { ...coreTools.packageDefaults };
|
|
130
135
|
if (toolConfig.packageToolDefaults != null && Object.keys(toolConfig.packageToolDefaults).length > 0) {
|
|
131
136
|
for (const [descriptor, pkgConfig] of Object.entries(toolConfig.packageToolDefaults)) {
|
|
132
|
-
const prefix = descriptor.startsWith("file:") ?
|
|
137
|
+
const prefix = descriptor.startsWith("file:") ? chunkJ5VQMYUV_cjs.fileDescriptorToPackagePrefix(descriptor) : chunkJ5VQMYUV_cjs.npmDescriptorToPackagePrefixWithVersion(descriptor);
|
|
133
138
|
if (!prefix) continue;
|
|
134
139
|
const pkgDefaults = pkgConfig?.defaults != null && typeof pkgConfig.defaults === "object" && !Array.isArray(pkgConfig.defaults) ? pkgConfig.defaults : {};
|
|
135
140
|
if (Object.keys(pkgDefaults).length > 0) {
|
|
@@ -159,18 +164,18 @@ function runtimeOptionsFromConfig(opts) {
|
|
|
159
164
|
function createAgentTools(options) {
|
|
160
165
|
const opts = typeof options === "string" ? { configFilePath: options } : options ?? {};
|
|
161
166
|
const runtimeOpts = runtimeOptionsFromConfig(opts);
|
|
162
|
-
const { runtime } =
|
|
167
|
+
const { runtime } = chunkJ5VQMYUV_cjs.createRuntimeFromConfigSync(runtimeOpts);
|
|
163
168
|
const hub = new LangChainToolsHub(runtime);
|
|
164
169
|
if (opts.configFilePath) {
|
|
165
|
-
const toolConfig =
|
|
170
|
+
const toolConfig = chunkJ5VQMYUV_cjs.loadToolConfig(opts.configFilePath);
|
|
166
171
|
const names = Array.isArray(toolConfig.tools) ? toolConfig.tools : [];
|
|
167
172
|
if (names.length > 0) {
|
|
168
173
|
const registryNames = runtime.getRegistry().snapshot().map((s) => s.name);
|
|
169
|
-
const allBarePackages = names.every((n) =>
|
|
174
|
+
const allBarePackages = names.every((n) => chunkJ5VQMYUV_cjs.isBarePackageDescriptor(String(n)));
|
|
170
175
|
if (allBarePackages) {
|
|
171
176
|
return hub.getLangChainTools();
|
|
172
177
|
}
|
|
173
|
-
const expanded =
|
|
178
|
+
const expanded = chunkJ5VQMYUV_cjs.expandToolDescriptorsToRegistryNames(names, registryNames);
|
|
174
179
|
return hub.getLangChainToolsForNames(expanded);
|
|
175
180
|
}
|
|
176
181
|
}
|
|
@@ -178,18 +183,18 @@ function createAgentTools(options) {
|
|
|
178
183
|
}
|
|
179
184
|
async function createLangChainToolsAsync(options = {}) {
|
|
180
185
|
const runtimeOpts = runtimeOptionsFromConfig(options);
|
|
181
|
-
const { runtime } = await
|
|
186
|
+
const { runtime } = await chunkJ5VQMYUV_cjs.createRuntimeFromConfig(runtimeOpts);
|
|
182
187
|
const hub = new LangChainToolsHub(runtime);
|
|
183
188
|
if (options.configFilePath) {
|
|
184
|
-
const toolConfig =
|
|
189
|
+
const toolConfig = chunkJ5VQMYUV_cjs.loadToolConfig(options.configFilePath);
|
|
185
190
|
const names = Array.isArray(toolConfig.tools) ? toolConfig.tools : [];
|
|
186
191
|
if (names.length > 0) {
|
|
187
192
|
const registryNames = runtime.getRegistry().snapshot().map((s) => s.name);
|
|
188
|
-
const allBarePackages = names.every((n) =>
|
|
193
|
+
const allBarePackages = names.every((n) => chunkJ5VQMYUV_cjs.isBarePackageDescriptor(String(n)));
|
|
189
194
|
if (allBarePackages) {
|
|
190
195
|
return hub.getLangChainTools();
|
|
191
196
|
}
|
|
192
|
-
const expanded =
|
|
197
|
+
const expanded = chunkJ5VQMYUV_cjs.expandToolDescriptorsToRegistryNames(names, registryNames);
|
|
193
198
|
return hub.getLangChainToolsForNames(expanded);
|
|
194
199
|
}
|
|
195
200
|
}
|
|
@@ -199,5 +204,5 @@ async function createLangChainToolsAsync(options = {}) {
|
|
|
199
204
|
exports.LangChainToolsHub = LangChainToolsHub;
|
|
200
205
|
exports.createAgentTools = createAgentTools;
|
|
201
206
|
exports.createLangChainToolsAsync = createLangChainToolsAsync;
|
|
202
|
-
//# sourceMappingURL=chunk-
|
|
203
|
-
//# sourceMappingURL=chunk-
|
|
207
|
+
//# sourceMappingURL=chunk-ZPXO5IOW.cjs.map
|
|
208
|
+
//# sourceMappingURL=chunk-ZPXO5IOW.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api/adapters/LangChainToolsHub.ts","../src/api/createAgentTools.ts"],"names":["enrichSpecWithCanonicalSchema","DynamicStructuredTool","LANGCHAIN_KIND","loadToolConfig","resolveSandboxedPath","fileDescriptorToPackagePrefix","npmDescriptorToPackagePrefixWithVersion","createRuntimeFromConfigSync","isBarePackageDescriptor","expandToolDescriptorsToRegistryNames","createRuntimeFromConfig"],"mappings":";;;;;;AAqBA,SAAS,eAAe,WAAA,EAA8B;AACpD,EAAA,MAAM,CAAA,GAAI,WAAA;AACV,EAAA,IAAI,CAAA,EAAG,IAAA,KAAS,QAAA,IAAY,CAAC,CAAA,CAAE,cAAc,OAAO,CAAA,CAAE,UAAA,KAAe,QAAA,EAAU,OAAO,KAAA;AACtF,EAAA,MAAM,IAAA,GAAQ,EAAE,UAA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,KAAK,CAAA,GAAI,UAAA,CAAW,QAAQ,EAAC;AACpE,IAAA,IAAI,KAAA,CAAM,SAAS,CAAA,EAAG;AACpB,MAAA,MAAM,aAAA,GAAgB,OAAA,CAAQ,WAAA,EAAY,CAAE,QAAA,GAAW,GAAA,CAAI,CAAC,CAAA,KAAM,CAAA,CAAE,IAAI,CAAA;AACxE,MAAA,MAAM,eAAA,GAAkB,MAAM,KAAA,CAAM,CAAC,MAAMK,yCAAA,CAAwB,MAAA,CAAO,CAAC,CAAC,CAAC,CAAA;AAC7E,MAAA,IAAI,eAAA,EAAiB;AACnB,QAAA,OAAO,IAAI,iBAAA,EAAkB;AAAA,MAC/B;AACA,MAAA,MAAM,QAAA,GAAWC,sDAAA,CAAqC,KAAA,EAAO,aAAa,CAAA;AAC1E,MAAA,OAAO,GAAA,CAAI,0BAA0B,QAAQ,CAAA;AAAA,IAC/C;AAAA,EACF;AAEA,EAAA,OAAO,IAAI,iBAAA,EAAkB;AAC/B","file":"chunk-ZPXO5IOW.cjs","sourcesContent":["/**\n * Exposes all tools from a ToolRegistry + PTCRuntime as LangChain tools\n * for local agent use (e.g. with createReactAgent, AgentExecutor).\n *\n * For most users, use createAgentTools() which loads from tools.yaml and returns\n * StructuredTool[]. Use LangChainToolsHub when you need a custom runtime or ctxFactory.\n *\n * Use: new LangChainToolsHub(runtime, ctxFactory).getLangChainTools()\n */\n\nimport { DynamicStructuredTool, type StructuredToolInterface } from \"@langchain/core/tools\";\nimport type { PTCRuntime } from \"../../core/runtime/PTCRuntime.js\";\nimport type { ToolSpec } from \"../../core/types/ToolSpec.js\";\nimport type { ExecContext } from \"../../core/types/ToolIntent.js\";\nimport type { ToolIntent } from \"../../core/types/ToolIntent.js\";\nimport { enrichSpecWithCanonicalSchema } from \"../../tools/util/canonicalCoreSchemas.js\";\nimport { LANGCHAIN_KIND } from \"../../tools/langchain/types.js\";\n\n/**\n * True when inputSchema wraps all params in a single \"args\" object (manifest convention).\n */\nfunction hasArgsWrapper(inputSchema: object): boolean {\n const s = inputSchema as Record<string, unknown>;\n if (s?.type !== \"object\" || !s.properties || typeof s.properties !== \"object\") return false;\n const args = (s.properties as Record<string, unknown>).args;\n return (\n args != null &&\n typeof args === \"object\" &&\n (args as Record<string, unknown>).type === \"object\" &&\n (args as Record<string, unknown>).properties != null\n );\n}\n\n/**\n * If inputSchema is { type: \"object\", properties: { args: { type: \"object\", properties: {...} } } },\n * return the inner args schema so the LLM can pass { path: \".\" } instead of { args: { path: \".\" } }.\n */\nfunction schemaForLangChain(inputSchema: object): Record<string, unknown> {\n const s = inputSchema as Record<string, unknown>;\n if (s?.type !== \"object\" || !s.properties || typeof s.properties !== \"object\") {\n return s;\n }\n const props = s.properties as Record<string, unknown>;\n const args = props.args;\n if (hasArgsWrapper(inputSchema)) {\n return args as Record<string, unknown>;\n }\n return s;\n}\n\nexport type ExecContextFactory = () => ExecContext;\n\nconst DEFAULT_CTX_FACTORY: ExecContextFactory = () => ({\n requestId: `lc-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,\n taskId: `task-${Date.now()}`,\n permissions: [\n \"read:web\",\n \"read:fs\",\n \"write:fs\",\n \"read:db\",\n \"write:db\",\n \"network\",\n \"workflow\",\n \"danger:destructive\",\n ],\n});\n\n/**\n * Hub that wraps PTCRuntime and exposes every registered tool as a LangChain\n * StructuredTool (DynamicStructuredTool), so local agents (LangChain AgentExecutor,\n * createReactAgent, etc.) can use the same tools as MCP and OpenAPI.\n */\nexport class LangChainToolsHub {\n constructor(\n private readonly runtime: PTCRuntime,\n private readonly ctxFactory: ExecContextFactory = DEFAULT_CTX_FACTORY,\n ) {}\n\n /**\n * Returns all registered tools as LangChain StructuredTool[].\n * Each tool invokes the runtime through the full pipeline (policy, HITL, etc.).\n */\n getLangChainTools(): StructuredToolInterface[] {\n const registry = this.runtime.getRegistry();\n const specs = registry.snapshot();\n\n return specs.map((spec) => this.specToLangChainTool(spec));\n }\n\n /**\n * Returns LangChain tools for a subset of tools (by name or query).\n */\n getLangChainToolsForNames(toolNames: string[]): StructuredToolInterface[] {\n const registry = this.runtime.getRegistry();\n const set = new Set(toolNames);\n const specs = registry.snapshot().filter((s) => set.has(s.name));\n return specs.map((spec) => this.specToLangChainTool(spec));\n }\n\n private specToLangChainTool(spec: ToolSpec): DynamicStructuredTool {\n const runtime = this.runtime;\n const ctxFactory = this.ctxFactory;\n const enriched = enrichSpecWithCanonicalSchema(spec);\n\n const schema = schemaForLangChain(enriched.inputSchema);\n return new DynamicStructuredTool({\n name: spec.name,\n description: spec.description ?? `Tool: ${spec.name}`,\n schema,\n func: async (args: Record<string, unknown>): Promise<string> => {\n const flat = args ?? {};\n const intent: ToolIntent = {\n tool: spec.name,\n args: hasArgsWrapper(enriched.inputSchema) ? { args: flat } : flat,\n purpose: LANGCHAIN_KIND,\n };\n const ctx = ctxFactory();\n const result = await runtime.invoke(intent, ctx);\n\n if (result.ok) {\n return typeof result.result === \"string\"\n ? result.result\n : JSON.stringify(result.result);\n }\n\n const err = result.error;\n const message = err?.message ?? \"Tool failed\";\n const details = err?.details;\n return JSON.stringify(\n details != null ? { error: message, details } : { error: message },\n );\n },\n });\n }\n}\n","/**\n * Create LangChain tools from config (sync or async). Uses PTCRuntime + registry\n * and exposes tools via LangChainToolsHub. All invokes go through PTC Intent.\n */\n\nimport { loadToolConfig, resolveSandboxedPath } from \"../tools/util/toolConfig.js\";\nimport {\n expandToolDescriptorsToRegistryNames,\n isBarePackageDescriptor,\n npmDescriptorToPackagePrefixWithVersion,\n fileDescriptorToPackagePrefix,\n} from \"../tools/util/toolDescriptor.js\";\nimport { createRuntimeFromConfigSync, createRuntimeFromConfig } from \"./runtimeFromConfig.js\";\nimport type { CreateRuntimeOptions } from \"./runtimeFromConfig.js\";\nimport { LangChainToolsHub } from \"./adapters/LangChainToolsHub.js\";\nimport type { StructuredToolInterface } from \"@langchain/core/tools\";\n\nexport interface CreateAgentToolsOptions extends CreateRuntimeOptions {\n /** Path to tool.yaml; when set, only tools listed there are returned; sandboxedPath from it is used as sandboxRoot */\n configFilePath?: string;\n /** Project path for async loading (use createLangChainToolsAsync) */\n projectPath?: string;\n}\n\n/** Merge host lists from multiple sources (e.g. tool.yaml + programmatic). Union, dedup, preserves order. */\nfunction mergeHostLists(a?: string[], b?: string[]): string[] {\n const seen = new Set<string>();\n const out: string[] = [];\n for (const list of [a ?? [], b ?? []]) {\n for (const h of list) {\n if (!seen.has(h)) {\n seen.add(h);\n out.push(h);\n }\n }\n }\n return out;\n}\n\nfunction runtimeOptionsFromConfig(opts: CreateAgentToolsOptions): CreateRuntimeOptions {\n const coreTools = opts.coreTools ?? { sandboxRoot: process.cwd(), allowedHosts: [], enableSandboxValidation: false };\n if (opts.configFilePath) {\n const toolConfig = loadToolConfig(opts.configFilePath);\n const updates: {\n sandboxRoot?: string;\n enableSandboxValidation?: boolean;\n allowedHosts?: string[];\n blockedHosts?: string[];\n blockedCidrs?: string[];\n toolOverrides?: Record<string, Record<string, unknown>>;\n packageDefaults?: Record<string, Record<string, unknown>>;\n } = {};\n if (toolConfig.sandboxedPath && typeof toolConfig.sandboxedPath === \"string\") {\n updates.sandboxRoot = resolveSandboxedPath(opts.configFilePath, toolConfig.sandboxedPath);\n }\n if (typeof toolConfig.enableSandboxValidation === \"boolean\") {\n updates.enableSandboxValidation = toolConfig.enableSandboxValidation;\n } else if (coreTools.enableSandboxValidation == null) {\n updates.enableSandboxValidation = false;\n }\n // Smart merge: union of allowedHosts and blockedHosts from yaml + programmatic (both lists always applied)\n updates.allowedHosts = mergeHostLists(coreTools.allowedHosts, toolConfig.allowedHosts);\n updates.blockedHosts = mergeHostLists(coreTools.blockedHosts, toolConfig.blockedHosts);\n if (Array.isArray(toolConfig.blockedCidrs) && toolConfig.blockedCidrs.length > 0) {\n updates.blockedCidrs = toolConfig.blockedCidrs;\n } else if (coreTools.blockedCidrs?.length) {\n updates.blockedCidrs = coreTools.blockedCidrs;\n }\n let hasToolDefaults = false;\n const flatOverrides: Record<string, Record<string, unknown>> = { ...coreTools.toolOverrides };\n if (toolConfig.toolDefaults != null && Object.keys(toolConfig.toolDefaults).length > 0) {\n Object.assign(flatOverrides, toolConfig.toolDefaults);\n hasToolDefaults = true;\n }\n const packageDefaults: Record<string, Record<string, unknown>> = { ...coreTools.packageDefaults };\n if (toolConfig.packageToolDefaults != null && Object.keys(toolConfig.packageToolDefaults).length > 0) {\n for (const [descriptor, pkgConfig] of Object.entries(toolConfig.packageToolDefaults)) {\n const prefix = descriptor.startsWith(\"file:\")\n ? fileDescriptorToPackagePrefix(descriptor)\n : npmDescriptorToPackagePrefixWithVersion(descriptor);\n if (!prefix) continue;\n const pkgDefaults =\n pkgConfig?.defaults != null && typeof pkgConfig.defaults === \"object\" && !Array.isArray(pkgConfig.defaults)\n ? (pkgConfig.defaults as Record<string, unknown>)\n : {};\n if (Object.keys(pkgDefaults).length > 0) {\n packageDefaults[prefix] = pkgDefaults;\n }\n const toolConfigs = pkgConfig?.tools != null && typeof pkgConfig.tools === \"object\" && !Array.isArray(pkgConfig.tools) ? pkgConfig.tools : {};\n for (const [toolName, config] of Object.entries(toolConfigs)) {\n if (config != null && typeof config === \"object\") {\n hasToolDefaults = true;\n flatOverrides[`${prefix}::${toolName}`] = { ...pkgDefaults, ...(config as Record<string, unknown>) };\n }\n }\n }\n if (Object.keys(packageDefaults).length > 0) {\n updates.packageDefaults = packageDefaults;\n }\n }\n if (hasToolDefaults) {\n updates.toolOverrides = flatOverrides;\n }\n if (Object.keys(updates).length > 0) {\n return { ...opts, coreTools: { ...coreTools, ...updates } };\n }\n }\n return { ...opts, coreTools };\n}\n\n/**\n * Create LangChain tools synchronously. When configFilePath is set, returns only\n * tools listed in that file (and that exist in the registry). If tool.yaml has\n * sandboxedPath, fs tools can only access that directory.\n */\nexport function createAgentTools(\n options?: CreateAgentToolsOptions | string\n): StructuredToolInterface[] {\n const opts: CreateAgentToolsOptions =\n typeof options === \"string\" ? { configFilePath: options } : options ?? {};\n const runtimeOpts = runtimeOptionsFromConfig(opts);\n const { runtime } = createRuntimeFromConfigSync(runtimeOpts);\n const hub = new LangChainToolsHub(runtime);\n\n if (opts.configFilePath) {\n const toolConfig = loadToolConfig(opts.configFilePath);\n const names = Array.isArray(toolConfig.tools) ? toolConfig.tools : [];\n if (names.length > 0) {\n const registryNames = runtime.getRegistry().snapshot().map((s) => s.name);\n const allBarePackages = names.every((n) => isBarePackageDescriptor(String(n)));\n if (allBarePackages) {\n return hub.getLangChainTools();\n }\n const expanded = expandToolDescriptorsToRegistryNames(names, registryNames);\n return hub.getLangChainToolsForNames(expanded);\n }\n }\n\n return hub.getLangChainTools();\n}\n\n/**\n * Create LangChain tools asynchronously. Use when projectPath is set to load\n * tools from the project before building the tool list.\n */\nexport async function createLangChainToolsAsync(\n options: CreateAgentToolsOptions = {}\n): Promise<StructuredToolInterface[]> {\n const runtimeOpts = runtimeOptionsFromConfig(options);\n const { runtime } = await createRuntimeFromConfig(runtimeOpts);\n const hub = new LangChainToolsHub(runtime);\n\n if (options.configFilePath) {\n const toolConfig = loadToolConfig(options.configFilePath);\n const names = Array.isArray(toolConfig.tools) ? toolConfig.tools : [];\n if (names.length > 0) {\n const registryNames = runtime.getRegistry().snapshot().map((s) => s.name);\n const allBarePackages = names.every((n) => isBarePackageDescriptor(String(n)));\n if (allBarePackages) {\n return hub.getLangChainTools();\n }\n const expanded = expandToolDescriptorsToRegistryNames(names, registryNames);\n return hub.getLangChainToolsForNames(expanded);\n }\n }\n\n return hub.getLangChainTools();\n}\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkZPXO5IOW_cjs = require('./chunk-ZPXO5IOW.cjs');
|
|
4
|
+
var chunk4NNTCCJ6_cjs = require('./chunk-4NNTCCJ6.cjs');
|
|
5
|
+
var chunkJ5VQMYUV_cjs = require('./chunk-J5VQMYUV.cjs');
|
|
6
6
|
var chunkTOSPHMYU_cjs = require('./chunk-TOSPHMYU.cjs');
|
|
7
7
|
var chunkDYDNPIV2_cjs = require('./chunk-DYDNPIV2.cjs');
|
|
8
8
|
require('./chunk-UUNG3GL3.cjs');
|
|
9
9
|
var promises = require('dns/promises');
|
|
10
|
-
var path6 = require('path');
|
|
11
|
-
var promises$1 = require('fs/promises');
|
|
12
10
|
var async_hooks = require('async_hooks');
|
|
11
|
+
var path6 = require('path');
|
|
13
12
|
var url = require('url');
|
|
14
13
|
var fs = require('fs');
|
|
15
14
|
var yaml = require('js-yaml');
|
|
@@ -193,43 +192,6 @@ function expandIpv6(ip) {
|
|
|
193
192
|
for (let i = 0; i < right.length; i++) bytes[16 - right.length + i] = right[i];
|
|
194
193
|
return bytes;
|
|
195
194
|
}
|
|
196
|
-
async function resolveSandboxedPath(inputPath, sandboxRoot) {
|
|
197
|
-
let normalizedRoot;
|
|
198
|
-
try {
|
|
199
|
-
normalizedRoot = await promises$1.realpath(path6.resolve(sandboxRoot));
|
|
200
|
-
} catch {
|
|
201
|
-
normalizedRoot = path6.normalize(path6.resolve(sandboxRoot));
|
|
202
|
-
}
|
|
203
|
-
const resolved = path6.resolve(normalizedRoot, inputPath);
|
|
204
|
-
let real;
|
|
205
|
-
try {
|
|
206
|
-
await promises$1.access(resolved);
|
|
207
|
-
real = await promises$1.realpath(resolved);
|
|
208
|
-
} catch {
|
|
209
|
-
const parentDir = path6.dirname(resolved);
|
|
210
|
-
let realParent;
|
|
211
|
-
try {
|
|
212
|
-
await promises$1.access(parentDir);
|
|
213
|
-
realParent = await promises$1.realpath(parentDir);
|
|
214
|
-
} catch {
|
|
215
|
-
realParent = path6.normalize(parentDir);
|
|
216
|
-
}
|
|
217
|
-
real = path6.resolve(realParent, path6.basename(resolved));
|
|
218
|
-
}
|
|
219
|
-
if (!isWithinRoot(real, normalizedRoot)) {
|
|
220
|
-
throw chunkTOSPHMYU_cjs.createTaggedError(
|
|
221
|
-
"PATH_OUTSIDE_SANDBOX",
|
|
222
|
-
`Path "${inputPath}" resolves to "${real}" which is outside sandbox "${normalizedRoot}"`,
|
|
223
|
-
{ inputPath, resolvedPath: real, sandboxRoot: normalizedRoot }
|
|
224
|
-
);
|
|
225
|
-
}
|
|
226
|
-
return real;
|
|
227
|
-
}
|
|
228
|
-
function isWithinRoot(path7, root) {
|
|
229
|
-
const normalizedPath = path6.normalize(path7);
|
|
230
|
-
const normalizedRoot = path6.normalize(root);
|
|
231
|
-
return normalizedPath === normalizedRoot || normalizedPath.startsWith(normalizedRoot + "/");
|
|
232
|
-
}
|
|
233
195
|
function createContextRunner() {
|
|
234
196
|
const storage = new async_hooks.AsyncLocalStorage();
|
|
235
197
|
return {
|
|
@@ -481,7 +443,7 @@ function generateExtensionManifest(projectRoot = process.cwd(), options = {}) {
|
|
|
481
443
|
const root = path6__default.default.resolve(projectRoot);
|
|
482
444
|
const outDir = path6__default.default.resolve(options.outDir ?? path6__default.default.join(root, "dist"));
|
|
483
445
|
const kind = options.kind ?? "core";
|
|
484
|
-
const { specs, errors } =
|
|
446
|
+
const { specs, errors } = chunk4NNTCCJ6_cjs.scanForTools({
|
|
485
447
|
projectPath: root,
|
|
486
448
|
include: options.include ?? ["**/*.ts"],
|
|
487
449
|
tsconfigPath: options.tsconfigPath
|
|
@@ -571,7 +533,7 @@ var MCPClientAdapter = class {
|
|
|
571
533
|
constructor(client) {
|
|
572
534
|
this.client = client;
|
|
573
535
|
}
|
|
574
|
-
kind =
|
|
536
|
+
kind = chunkJ5VQMYUV_cjs.MCP_KIND;
|
|
575
537
|
async invoke(spec, args, _ctx) {
|
|
576
538
|
const params = args != null && typeof args === "object" && !Array.isArray(args) ? args : {};
|
|
577
539
|
const result = await this.client.callTool({ name: spec.name, arguments: params });
|
|
@@ -612,7 +574,7 @@ function mcpToolsToSpecs(tools) {
|
|
|
612
574
|
return tools.map((t) => ({
|
|
613
575
|
name: t.name,
|
|
614
576
|
version: "1.0.0",
|
|
615
|
-
kind:
|
|
577
|
+
kind: chunkJ5VQMYUV_cjs.MCP_KIND,
|
|
616
578
|
description: t.description ?? `MCP tool: ${t.name}`,
|
|
617
579
|
inputSchema: t.inputSchema ?? chunkDYDNPIV2_cjs.DEFAULT_INPUT_SCHEMA,
|
|
618
580
|
outputSchema: chunkDYDNPIV2_cjs.DEFAULT_OUTPUT_SCHEMA,
|
|
@@ -652,8 +614,8 @@ async function registerMCPToolsFromConfig(runtime, registry, options = {}) {
|
|
|
652
614
|
const configPath = options.configPath ?? process.env.MCP_CONFIG_PATH ?? path6.join(process.cwd(), "mcp.json");
|
|
653
615
|
const dirPath = path6.dirname(configPath);
|
|
654
616
|
const entryPoint = path6.basename(configPath);
|
|
655
|
-
const toolName = options.toolName ??
|
|
656
|
-
const loaded = await
|
|
617
|
+
const toolName = options.toolName ?? chunkJ5VQMYUV_cjs.MCP_KIND;
|
|
618
|
+
const loaded = await chunk4NNTCCJ6_cjs.loadMCPTool(dirPath, { kind: chunkJ5VQMYUV_cjs.MCP_KIND, name: toolName, entryPoint });
|
|
657
619
|
if (!loaded.mcpConfig) {
|
|
658
620
|
throw new Error("mcp.json must have command or url");
|
|
659
621
|
}
|
|
@@ -669,171 +631,179 @@ async function registerMCPToolsFromConfig(runtime, registry, options = {}) {
|
|
|
669
631
|
|
|
670
632
|
Object.defineProperty(exports, "LangChainToolsHub", {
|
|
671
633
|
enumerable: true,
|
|
672
|
-
get: function () { return
|
|
634
|
+
get: function () { return chunkZPXO5IOW_cjs.LangChainToolsHub; }
|
|
673
635
|
});
|
|
674
636
|
Object.defineProperty(exports, "createAgentTools", {
|
|
675
637
|
enumerable: true,
|
|
676
|
-
get: function () { return
|
|
638
|
+
get: function () { return chunkZPXO5IOW_cjs.createAgentTools; }
|
|
677
639
|
});
|
|
678
640
|
Object.defineProperty(exports, "DirectoryScanner", {
|
|
679
641
|
enumerable: true,
|
|
680
|
-
get: function () { return
|
|
642
|
+
get: function () { return chunk4NNTCCJ6_cjs.DirectoryScanner; }
|
|
681
643
|
});
|
|
682
644
|
Object.defineProperty(exports, "DiscoveryError", {
|
|
683
645
|
enumerable: true,
|
|
684
|
-
get: function () { return
|
|
646
|
+
get: function () { return chunk4NNTCCJ6_cjs.DiscoveryError; }
|
|
685
647
|
});
|
|
686
648
|
Object.defineProperty(exports, "SkillManifestError", {
|
|
687
649
|
enumerable: true,
|
|
688
|
-
get: function () { return
|
|
650
|
+
get: function () { return chunk4NNTCCJ6_cjs.SkillManifestError; }
|
|
689
651
|
});
|
|
690
652
|
Object.defineProperty(exports, "buildFunctionToTool", {
|
|
691
653
|
enumerable: true,
|
|
692
|
-
get: function () { return
|
|
654
|
+
get: function () { return chunk4NNTCCJ6_cjs.buildFunctionToTool; }
|
|
693
655
|
});
|
|
694
656
|
Object.defineProperty(exports, "buildMcpPackage", {
|
|
695
657
|
enumerable: true,
|
|
696
|
-
get: function () { return
|
|
658
|
+
get: function () { return chunk4NNTCCJ6_cjs.buildMcpPackage; }
|
|
697
659
|
});
|
|
698
660
|
Object.defineProperty(exports, "initProject", {
|
|
699
661
|
enumerable: true,
|
|
700
|
-
get: function () { return
|
|
662
|
+
get: function () { return chunk4NNTCCJ6_cjs.initProject; }
|
|
701
663
|
});
|
|
702
664
|
Object.defineProperty(exports, "loadMCPTool", {
|
|
703
665
|
enumerable: true,
|
|
704
|
-
get: function () { return
|
|
666
|
+
get: function () { return chunk4NNTCCJ6_cjs.loadMCPTool; }
|
|
705
667
|
});
|
|
706
668
|
Object.defineProperty(exports, "loadSkillDefinition", {
|
|
707
669
|
enumerable: true,
|
|
708
|
-
get: function () { return
|
|
670
|
+
get: function () { return chunk4NNTCCJ6_cjs.loadSkillDefinition; }
|
|
709
671
|
});
|
|
710
672
|
Object.defineProperty(exports, "parseSkillMd", {
|
|
711
673
|
enumerable: true,
|
|
712
|
-
get: function () { return
|
|
674
|
+
get: function () { return chunk4NNTCCJ6_cjs.parseSkillMd; }
|
|
713
675
|
});
|
|
714
676
|
Object.defineProperty(exports, "runGeneratedMCP", {
|
|
715
677
|
enumerable: true,
|
|
716
|
-
get: function () { return
|
|
678
|
+
get: function () { return chunk4NNTCCJ6_cjs.runGeneratedMCP; }
|
|
717
679
|
});
|
|
718
680
|
Object.defineProperty(exports, "runMcpServer", {
|
|
719
681
|
enumerable: true,
|
|
720
|
-
get: function () { return
|
|
682
|
+
get: function () { return chunk4NNTCCJ6_cjs.runMcpServer; }
|
|
721
683
|
});
|
|
722
684
|
Object.defineProperty(exports, "scan", {
|
|
723
685
|
enumerable: true,
|
|
724
|
-
get: function () { return
|
|
686
|
+
get: function () { return chunk4NNTCCJ6_cjs.scan; }
|
|
725
687
|
});
|
|
726
688
|
Object.defineProperty(exports, "scanForTools", {
|
|
727
689
|
enumerable: true,
|
|
728
|
-
get: function () { return
|
|
690
|
+
get: function () { return chunk4NNTCCJ6_cjs.scanForTools; }
|
|
729
691
|
});
|
|
730
692
|
Object.defineProperty(exports, "scanSkillResources", {
|
|
731
693
|
enumerable: true,
|
|
732
|
-
get: function () { return
|
|
694
|
+
get: function () { return chunk4NNTCCJ6_cjs.scanSkillResources; }
|
|
733
695
|
});
|
|
734
696
|
Object.defineProperty(exports, "validateFrontmatter", {
|
|
735
697
|
enumerable: true,
|
|
736
|
-
get: function () { return
|
|
698
|
+
get: function () { return chunk4NNTCCJ6_cjs.validateFrontmatter; }
|
|
737
699
|
});
|
|
738
700
|
Object.defineProperty(exports, "BudgetManager", {
|
|
739
701
|
enumerable: true,
|
|
740
|
-
get: function () { return
|
|
702
|
+
get: function () { return chunkJ5VQMYUV_cjs.BudgetManager; }
|
|
741
703
|
});
|
|
742
704
|
Object.defineProperty(exports, "EventLog", {
|
|
743
705
|
enumerable: true,
|
|
744
|
-
get: function () { return
|
|
706
|
+
get: function () { return chunkJ5VQMYUV_cjs.EventLog; }
|
|
745
707
|
});
|
|
746
708
|
Object.defineProperty(exports, "Metrics", {
|
|
747
709
|
enumerable: true,
|
|
748
|
-
get: function () { return
|
|
710
|
+
get: function () { return chunkJ5VQMYUV_cjs.Metrics; }
|
|
749
711
|
});
|
|
750
712
|
Object.defineProperty(exports, "PTCRuntime", {
|
|
751
713
|
enumerable: true,
|
|
752
|
-
get: function () { return
|
|
714
|
+
get: function () { return chunkJ5VQMYUV_cjs.PTCRuntime; }
|
|
753
715
|
});
|
|
754
716
|
Object.defineProperty(exports, "PolicyDeniedError", {
|
|
755
717
|
enumerable: true,
|
|
756
|
-
get: function () { return
|
|
718
|
+
get: function () { return chunkJ5VQMYUV_cjs.PolicyDeniedError; }
|
|
757
719
|
});
|
|
758
720
|
Object.defineProperty(exports, "PolicyEngine", {
|
|
759
721
|
enumerable: true,
|
|
760
|
-
get: function () { return
|
|
722
|
+
get: function () { return chunkJ5VQMYUV_cjs.PolicyEngine; }
|
|
761
723
|
});
|
|
762
724
|
Object.defineProperty(exports, "SchemaValidationError", {
|
|
763
725
|
enumerable: true,
|
|
764
|
-
get: function () { return
|
|
726
|
+
get: function () { return chunkJ5VQMYUV_cjs.SchemaValidationError; }
|
|
765
727
|
});
|
|
766
728
|
Object.defineProperty(exports, "SchemaValidator", {
|
|
767
729
|
enumerable: true,
|
|
768
|
-
get: function () { return
|
|
730
|
+
get: function () { return chunkJ5VQMYUV_cjs.SchemaValidator; }
|
|
769
731
|
});
|
|
770
732
|
Object.defineProperty(exports, "Tracing", {
|
|
771
733
|
enumerable: true,
|
|
772
|
-
get: function () { return
|
|
734
|
+
get: function () { return chunkJ5VQMYUV_cjs.Tracing; }
|
|
773
735
|
});
|
|
774
736
|
Object.defineProperty(exports, "buildEvidence", {
|
|
775
737
|
enumerable: true,
|
|
776
|
-
get: function () { return
|
|
738
|
+
get: function () { return chunkJ5VQMYUV_cjs.buildEvidence; }
|
|
777
739
|
});
|
|
778
740
|
Object.defineProperty(exports, "createLogger", {
|
|
779
741
|
enumerable: true,
|
|
780
|
-
get: function () { return
|
|
742
|
+
get: function () { return chunkJ5VQMYUV_cjs.createLogger; }
|
|
781
743
|
});
|
|
782
744
|
Object.defineProperty(exports, "ensurePackageInCache", {
|
|
783
745
|
enumerable: true,
|
|
784
|
-
get: function () { return
|
|
746
|
+
get: function () { return chunkJ5VQMYUV_cjs.ensurePackageInCache; }
|
|
785
747
|
});
|
|
786
748
|
Object.defineProperty(exports, "expandToolDescriptorsToRegistryNames", {
|
|
787
749
|
enumerable: true,
|
|
788
|
-
get: function () { return
|
|
750
|
+
get: function () { return chunkJ5VQMYUV_cjs.expandToolDescriptorsToRegistryNames; }
|
|
789
751
|
});
|
|
790
752
|
Object.defineProperty(exports, "getPackageEntryPath", {
|
|
791
753
|
enumerable: true,
|
|
792
|
-
get: function () { return
|
|
754
|
+
get: function () { return chunkJ5VQMYUV_cjs.getPackageEntryPath; }
|
|
793
755
|
});
|
|
794
756
|
Object.defineProperty(exports, "importFromCache", {
|
|
795
757
|
enumerable: true,
|
|
796
|
-
get: function () { return
|
|
758
|
+
get: function () { return chunkJ5VQMYUV_cjs.importFromCache; }
|
|
797
759
|
});
|
|
798
760
|
Object.defineProperty(exports, "isNpmToolDescriptor", {
|
|
799
761
|
enumerable: true,
|
|
800
|
-
get: function () { return
|
|
762
|
+
get: function () { return chunkJ5VQMYUV_cjs.isNpmToolDescriptor; }
|
|
801
763
|
});
|
|
802
764
|
Object.defineProperty(exports, "loadToolConfig", {
|
|
803
765
|
enumerable: true,
|
|
804
|
-
get: function () { return
|
|
766
|
+
get: function () { return chunkJ5VQMYUV_cjs.loadToolConfig; }
|
|
805
767
|
});
|
|
806
768
|
Object.defineProperty(exports, "normalizeToolList", {
|
|
807
769
|
enumerable: true,
|
|
808
|
-
get: function () { return
|
|
770
|
+
get: function () { return chunkJ5VQMYUV_cjs.normalizeToolList; }
|
|
809
771
|
});
|
|
810
772
|
Object.defineProperty(exports, "npmDescriptorToRegistryPrefix", {
|
|
811
773
|
enumerable: true,
|
|
812
|
-
get: function () { return
|
|
774
|
+
get: function () { return chunkJ5VQMYUV_cjs.npmDescriptorToRegistryPrefix; }
|
|
813
775
|
});
|
|
814
776
|
Object.defineProperty(exports, "parseNpmToolDescriptor", {
|
|
815
777
|
enumerable: true,
|
|
816
|
-
get: function () { return
|
|
778
|
+
get: function () { return chunkJ5VQMYUV_cjs.parseNpmToolDescriptor; }
|
|
817
779
|
});
|
|
818
780
|
Object.defineProperty(exports, "resolveLatestVersionFromRegistry", {
|
|
819
781
|
enumerable: true,
|
|
820
|
-
get: function () { return
|
|
782
|
+
get: function () { return chunkJ5VQMYUV_cjs.resolveLatestVersionFromRegistry; }
|
|
821
783
|
});
|
|
822
784
|
Object.defineProperty(exports, "resolveNpmToolDescriptor", {
|
|
823
785
|
enumerable: true,
|
|
824
|
-
get: function () { return
|
|
786
|
+
get: function () { return chunkJ5VQMYUV_cjs.resolveNpmToolDescriptor; }
|
|
787
|
+
});
|
|
788
|
+
Object.defineProperty(exports, "resolveSandboxedPath", {
|
|
789
|
+
enumerable: true,
|
|
790
|
+
get: function () { return chunkJ5VQMYUV_cjs.resolveSandboxedPath; }
|
|
825
791
|
});
|
|
826
792
|
Object.defineProperty(exports, "resolveToolDescriptor", {
|
|
827
793
|
enumerable: true,
|
|
828
|
-
get: function () { return
|
|
794
|
+
get: function () { return chunkJ5VQMYUV_cjs.resolveToolDescriptor; }
|
|
829
795
|
});
|
|
830
796
|
Object.defineProperty(exports, "sanitizeForLog", {
|
|
831
797
|
enumerable: true,
|
|
832
|
-
get: function () { return
|
|
798
|
+
get: function () { return chunkJ5VQMYUV_cjs.sanitizeForLog; }
|
|
799
|
+
});
|
|
800
|
+
Object.defineProperty(exports, "setSandboxValidationEnabled", {
|
|
801
|
+
enumerable: true,
|
|
802
|
+
get: function () { return chunkJ5VQMYUV_cjs.setSandboxValidationEnabled; }
|
|
833
803
|
});
|
|
834
804
|
Object.defineProperty(exports, "summarizeForLog", {
|
|
835
805
|
enumerable: true,
|
|
836
|
-
get: function () { return
|
|
806
|
+
get: function () { return chunkJ5VQMYUV_cjs.summarizeForLog; }
|
|
837
807
|
});
|
|
838
808
|
Object.defineProperty(exports, "ToolRegistry", {
|
|
839
809
|
enumerable: true,
|
|
@@ -885,7 +855,6 @@ exports.registerExtension = registerExtension;
|
|
|
885
855
|
exports.registerMCPToolsFromConfig = registerMCPToolsFromConfig;
|
|
886
856
|
exports.registerToolsFromManifest = registerToolsFromManifest;
|
|
887
857
|
exports.resolveExtensionPackageRoot = resolveExtensionPackageRoot;
|
|
888
|
-
exports.resolveSandboxedPath = resolveSandboxedPath;
|
|
889
858
|
exports.validateUrl = validateUrl;
|
|
890
859
|
//# sourceMappingURL=index.cjs.map
|
|
891
860
|
//# sourceMappingURL=index.cjs.map
|