@botbotgo/kit 1.0.106
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 +65 -0
- package/config/build/build.sh +182 -0
- package/config/build/tsconfig.dts.json +34 -0
- package/config/build/tsup.config.ts +19 -0
- package/config/build/vitest.config.ts +29 -0
- package/config/tool.yaml +11 -0
- package/dist/agent-context.d.ts +3 -0
- package/dist/agent-context.d.ts.map +1 -0
- package/dist/api/adapters/LangChainToolsHub.d.ts +35 -0
- package/dist/api/adapters/LangChainToolsHub.d.ts.map +1 -0
- package/dist/api/createAgentTools.d.ts +52 -0
- package/dist/api/createAgentTools.d.ts.map +1 -0
- 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 +21 -0
- package/dist/api/expose/extension-init/initExtension.d.ts.map +1 -0
- package/dist/api/expose/index.d.ts +16 -0
- package/dist/api/expose/index.d.ts.map +1 -0
- package/dist/api/expose/mcp-build/build.d.ts +21 -0
- package/dist/api/expose/mcp-build/build.d.ts.map +1 -0
- package/dist/api/expose/mcp-build/generator.d.ts +15 -0
- package/dist/api/expose/mcp-build/generator.d.ts.map +1 -0
- package/dist/api/expose/mcp-build/index.d.ts +8 -0
- package/dist/api/expose/mcp-build/index.d.ts.map +1 -0
- package/dist/api/expose/mcp-build/init.d.ts +17 -0
- package/dist/api/expose/mcp-build/init.d.ts.map +1 -0
- package/dist/api/expose/mcp-build/run.d.ts +17 -0
- package/dist/api/expose/mcp-build/run.d.ts.map +1 -0
- package/dist/api/expose/mcp-build/types.d.ts +25 -0
- package/dist/api/expose/mcp-build/types.d.ts.map +1 -0
- package/dist/api/expose/mcpServer.d.ts +74 -0
- package/dist/api/expose/mcpServer.d.ts.map +1 -0
- package/dist/api/expose/openapi.d.ts +23 -0
- package/dist/api/expose/openapi.d.ts.map +1 -0
- package/dist/api/expose/openapiHttp.d.ts +51 -0
- package/dist/api/expose/openapiHttp.d.ts.map +1 -0
- package/dist/api/extension/contextRunner.d.ts +10 -0
- package/dist/api/extension/contextRunner.d.ts.map +1 -0
- package/dist/api/extension/createExtension.d.ts +38 -0
- package/dist/api/extension/createExtension.d.ts.map +1 -0
- package/dist/api/extension/dynamicImportAdapter.d.ts +25 -0
- package/dist/api/extension/dynamicImportAdapter.d.ts.map +1 -0
- package/dist/api/extension/generateExtensionManifest.d.ts +29 -0
- package/dist/api/extension/generateExtensionManifest.d.ts.map +1 -0
- package/dist/api/extension/index.d.ts +23 -0
- package/dist/api/extension/index.d.ts.map +1 -0
- package/dist/api/extension/loadToolYaml.d.ts +7 -0
- package/dist/api/extension/loadToolYaml.d.ts.map +1 -0
- package/dist/api/extension/overrideWithConfig.d.ts +2 -0
- package/dist/api/extension/overrideWithConfig.d.ts.map +1 -0
- package/dist/api/extension/registerExtension.d.ts +32 -0
- package/dist/api/extension/registerExtension.d.ts.map +1 -0
- package/dist/api/extension/registerFromManifest.d.ts +43 -0
- package/dist/api/extension/registerFromManifest.d.ts.map +1 -0
- package/dist/api/extension/resolvePackageRoot.d.ts +2 -0
- package/dist/api/extension/resolvePackageRoot.d.ts.map +1 -0
- package/dist/api/extension/support/groupPrefix.d.ts +21 -0
- package/dist/api/extension/support/groupPrefix.d.ts.map +1 -0
- package/dist/api/extension/support/types.d.ts +15 -0
- package/dist/api/extension/support/types.d.ts.map +1 -0
- package/dist/api/register-tools.d.ts +17 -0
- package/dist/api/register-tools.d.ts.map +1 -0
- package/dist/api/resolveAgentSkillRoots.d.ts +7 -0
- package/dist/api/resolveAgentSkillRoots.d.ts.map +1 -0
- package/dist/api/runtimeFromConfig.d.ts +20 -0
- package/dist/api/runtimeFromConfig.d.ts.map +1 -0
- package/dist/api/runtimeFromConfig.helpers.d.ts +12 -0
- package/dist/api/runtimeFromConfig.helpers.d.ts.map +1 -0
- package/dist/api/runtimeFromConfig.types.d.ts +37 -0
- package/dist/api/runtimeFromConfig.types.d.ts.map +1 -0
- package/dist/build.cjs +30 -0
- package/dist/build.cjs.map +1 -0
- package/dist/build.d.ts +13 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.js +5 -0
- package/dist/build.js.map +1 -0
- package/dist/canonicalCoreSchemas-PHGTNPN5.js +3 -0
- package/dist/canonicalCoreSchemas-PHGTNPN5.js.map +1 -0
- package/dist/canonicalCoreSchemas-TY7NCWCC.cjs +16 -0
- package/dist/canonicalCoreSchemas-TY7NCWCC.cjs.map +1 -0
- package/dist/chunk-4OOTCNR7.js +324 -0
- package/dist/chunk-4OOTCNR7.js.map +1 -0
- package/dist/chunk-4VKCWJHF.cjs +3043 -0
- package/dist/chunk-4VKCWJHF.cjs.map +1 -0
- package/dist/chunk-AGLGFQUW.cjs +259 -0
- package/dist/chunk-AGLGFQUW.cjs.map +1 -0
- package/dist/chunk-AZUXVVGV.cjs +1073 -0
- package/dist/chunk-AZUXVVGV.cjs.map +1 -0
- package/dist/chunk-BDUSB6GT.js +520 -0
- package/dist/chunk-BDUSB6GT.js.map +1 -0
- package/dist/chunk-BNIE2IKZ.cjs +100 -0
- package/dist/chunk-BNIE2IKZ.cjs.map +1 -0
- package/dist/chunk-BTHDNP3C.cjs +350 -0
- package/dist/chunk-BTHDNP3C.cjs.map +1 -0
- package/dist/chunk-GGFAGLDC.js +1049 -0
- package/dist/chunk-GGFAGLDC.js.map +1 -0
- package/dist/chunk-ITX6A2BT.js +92 -0
- package/dist/chunk-ITX6A2BT.js.map +1 -0
- package/dist/chunk-IVL4TBFB.js +248 -0
- package/dist/chunk-IVL4TBFB.js.map +1 -0
- package/dist/chunk-JH4ZF3FN.js +3013 -0
- package/dist/chunk-JH4ZF3FN.js.map +1 -0
- package/dist/chunk-JW4EMVTE.cjs +553 -0
- package/dist/chunk-JW4EMVTE.cjs.map +1 -0
- 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/core/registry/ToolRegistry.d.ts +68 -0
- package/dist/core/registry/ToolRegistry.d.ts.map +1 -0
- package/dist/core/runtime/Budget.d.ts +63 -0
- package/dist/core/runtime/Budget.d.ts.map +1 -0
- package/dist/core/runtime/Evidence.d.ts +19 -0
- package/dist/core/runtime/Evidence.d.ts.map +1 -0
- package/dist/core/runtime/PTCRuntime.d.ts +124 -0
- package/dist/core/runtime/PTCRuntime.d.ts.map +1 -0
- package/dist/core/runtime/PTCRuntimeObservability.d.ts +26 -0
- package/dist/core/runtime/PTCRuntimeObservability.d.ts.map +1 -0
- package/dist/core/runtime/PTCRuntimePipeline.d.ts +69 -0
- package/dist/core/runtime/PTCRuntimePipeline.d.ts.map +1 -0
- package/dist/core/runtime/PolicyEngine.d.ts +67 -0
- package/dist/core/runtime/PolicyEngine.d.ts.map +1 -0
- package/dist/core/runtime/Retry.d.ts +33 -0
- package/dist/core/runtime/Retry.d.ts.map +1 -0
- package/dist/core/runtime/SchemaValidator.d.ts +42 -0
- package/dist/core/runtime/SchemaValidator.d.ts.map +1 -0
- package/dist/core/runtime/toolObservation.d.ts +7 -0
- package/dist/core/runtime/toolObservation.d.ts.map +1 -0
- package/dist/core/types/Events.d.ts +99 -0
- package/dist/core/types/Events.d.ts.map +1 -0
- package/dist/core/types/ToolIntent.d.ts +40 -0
- package/dist/core/types/ToolIntent.d.ts.map +1 -0
- package/dist/core/types/ToolResult.d.ts +44 -0
- package/dist/core/types/ToolResult.d.ts.map +1 -0
- package/dist/core/types/ToolSpec.d.ts +116 -0
- package/dist/core/types/ToolSpec.d.ts.map +1 -0
- package/dist/core/types/ToolTypeHandler.d.ts +88 -0
- package/dist/core/types/ToolTypeHandler.d.ts.map +1 -0
- package/dist/core/types/index.d.ts +7 -0
- package/dist/core/types/index.d.ts.map +1 -0
- package/dist/index.cjs +399 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +394 -0
- package/dist/index.js.map +1 -0
- package/dist/observability/EventLog.d.ts +60 -0
- package/dist/observability/EventLog.d.ts.map +1 -0
- package/dist/observability/Logger.d.ts +33 -0
- package/dist/observability/Logger.d.ts.map +1 -0
- package/dist/observability/Metrics.d.ts +70 -0
- package/dist/observability/Metrics.d.ts.map +1 -0
- package/dist/observability/Tracing.d.ts +69 -0
- package/dist/observability/Tracing.d.ts.map +1 -0
- package/dist/sdk.cjs +493 -0
- package/dist/sdk.cjs.map +1 -0
- package/dist/sdk.d.ts +17 -0
- package/dist/sdk.d.ts.map +1 -0
- package/dist/sdk.js +443 -0
- package/dist/sdk.js.map +1 -0
- package/dist/security/sandbox.d.ts +10 -0
- package/dist/security/sandbox.d.ts.map +1 -0
- package/dist/security/ssrf.d.ts +24 -0
- package/dist/security/ssrf.d.ts.map +1 -0
- package/dist/templates/mcp-server.js +48 -0
- package/dist/templates/n8n-invoker.js +11 -0
- package/dist/templates/skill-invoker.js +11 -0
- package/dist/templates/tool-index.js +9 -0
- package/dist/tools/discoveryFactory.d.ts +117 -0
- package/dist/tools/discoveryFactory.d.ts.map +1 -0
- package/dist/tools/function/index.d.ts +10 -0
- package/dist/tools/function/index.d.ts.map +1 -0
- package/dist/tools/function/scanner.d.ts +29 -0
- package/dist/tools/function/scanner.d.ts.map +1 -0
- package/dist/tools/function/schemaFromTs.d.ts +16 -0
- package/dist/tools/function/schemaFromTs.d.ts.map +1 -0
- package/dist/tools/function/types.d.ts +20 -0
- package/dist/tools/function/types.d.ts.map +1 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/langchain/LangChainLoader.d.ts +7 -0
- package/dist/tools/langchain/LangChainLoader.d.ts.map +1 -0
- package/dist/tools/langchain/directoryApply.d.ts +5 -0
- package/dist/tools/langchain/directoryApply.d.ts.map +1 -0
- package/dist/tools/langchain/directoryLoad.d.ts +13 -0
- package/dist/tools/langchain/directoryLoad.d.ts.map +1 -0
- package/dist/tools/langchain/index.d.ts +3 -0
- package/dist/tools/langchain/index.d.ts.map +1 -0
- package/dist/tools/langchain/scanner.d.ts +8 -0
- package/dist/tools/langchain/scanner.d.ts.map +1 -0
- package/dist/tools/langchain/types.d.ts +5 -0
- package/dist/tools/langchain/types.d.ts.map +1 -0
- package/dist/tools/mcp/MCPClientAdapter.d.ts +34 -0
- package/dist/tools/mcp/MCPClientAdapter.d.ts.map +1 -0
- package/dist/tools/mcp/MCPLoader.d.ts +8 -0
- package/dist/tools/mcp/MCPLoader.d.ts.map +1 -0
- package/dist/tools/mcp/MCPProcessManager.d.ts +29 -0
- package/dist/tools/mcp/MCPProcessManager.d.ts.map +1 -0
- package/dist/tools/mcp/connectMCP.d.ts +47 -0
- package/dist/tools/mcp/connectMCP.d.ts.map +1 -0
- package/dist/tools/mcp/directoryApply.d.ts +10 -0
- package/dist/tools/mcp/directoryApply.d.ts.map +1 -0
- package/dist/tools/mcp/index.d.ts +16 -0
- package/dist/tools/mcp/index.d.ts.map +1 -0
- package/dist/tools/mcp/mcpSpecToToolSpec.d.ts +8 -0
- package/dist/tools/mcp/mcpSpecToToolSpec.d.ts.map +1 -0
- package/dist/tools/mcp/registerMCPTools.d.ts +24 -0
- package/dist/tools/mcp/registerMCPTools.d.ts.map +1 -0
- package/dist/tools/mcp/scanner.d.ts +8 -0
- package/dist/tools/mcp/scanner.d.ts.map +1 -0
- package/dist/tools/mcp/support/types.d.ts +3 -0
- package/dist/tools/mcp/support/types.d.ts.map +1 -0
- package/dist/tools/n8n/N8nLoader.d.ts +25 -0
- package/dist/tools/n8n/N8nLoader.d.ts.map +1 -0
- package/dist/tools/n8n/directoryApply.d.ts +10 -0
- package/dist/tools/n8n/directoryApply.d.ts.map +1 -0
- package/dist/tools/n8n/index.d.ts +6 -0
- package/dist/tools/n8n/index.d.ts.map +1 -0
- package/dist/tools/n8n/scanN8n.d.ts +20 -0
- package/dist/tools/n8n/scanN8n.d.ts.map +1 -0
- package/dist/tools/n8n/types.d.ts +18 -0
- package/dist/tools/n8n/types.d.ts.map +1 -0
- package/dist/tools/scanPackage.d.ts +42 -0
- package/dist/tools/scanPackage.d.ts.map +1 -0
- package/dist/tools/skill/SkillLoader.d.ts +20 -0
- package/dist/tools/skill/SkillLoader.d.ts.map +1 -0
- package/dist/tools/skill/SkillManifest.d.ts +79 -0
- package/dist/tools/skill/SkillManifest.d.ts.map +1 -0
- package/dist/tools/skill/SkillMdParser.d.ts +31 -0
- package/dist/tools/skill/SkillMdParser.d.ts.map +1 -0
- package/dist/tools/skill/directoryApply.d.ts +10 -0
- package/dist/tools/skill/directoryApply.d.ts.map +1 -0
- package/dist/tools/skill/index.d.ts +8 -0
- package/dist/tools/skill/index.d.ts.map +1 -0
- package/dist/tools/skill/scanSkill.d.ts +20 -0
- package/dist/tools/skill/scanSkill.d.ts.map +1 -0
- package/dist/tools/skill/types.d.ts +19 -0
- package/dist/tools/skill/types.d.ts.map +1 -0
- package/dist/tools/util/canonicalCoreSchemas.d.ts +15 -0
- package/dist/tools/util/canonicalCoreSchemas.d.ts.map +1 -0
- package/dist/tools/util/index.d.ts +13 -0
- package/dist/tools/util/index.d.ts.map +1 -0
- package/dist/tools/util/resolveEntry.d.ts +6 -0
- package/dist/tools/util/resolveEntry.d.ts.map +1 -0
- package/dist/tools/util/scanUtil.d.ts +9 -0
- package/dist/tools/util/scanUtil.d.ts.map +1 -0
- package/dist/tools/util/toolConfig.d.ts +38 -0
- package/dist/tools/util/toolConfig.d.ts.map +1 -0
- package/dist/tools/util/toolDescriptor.d.ts +117 -0
- package/dist/tools/util/toolDescriptor.d.ts.map +1 -0
- package/dist/utils/cli/help.d.ts +2 -0
- package/dist/utils/cli/help.d.ts.map +1 -0
- package/dist/utils/cli/index.cjs +700 -0
- package/dist/utils/cli/index.cjs.map +1 -0
- package/dist/utils/cli/index.d.ts +9 -0
- package/dist/utils/cli/index.d.ts.map +1 -0
- package/dist/utils/cli/index.js +677 -0
- package/dist/utils/cli/index.js.map +1 -0
- package/dist/utils/cli/toolRuntime.d.ts +19 -0
- package/dist/utils/cli/toolRuntime.d.ts.map +1 -0
- package/dist/utils/log.d.ts +2 -0
- package/dist/utils/log.d.ts.map +1 -0
- package/dist/utils/npmCache.d.ts +11 -0
- package/dist/utils/npmCache.d.ts.map +1 -0
- package/dist/utils/npmVersion.d.ts +10 -0
- package/dist/utils/npmVersion.d.ts.map +1 -0
- package/dist/utils/overrideWithConfig.d.ts +2 -0
- package/dist/utils/overrideWithConfig.d.ts.map +1 -0
- package/package.json +125 -0
package/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# @botbotgo/kit
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
`@botbotgo/kit` loads `tool.yaml`, resolves tool extensions into LangChain-compatible tools, and registers them into the default `AgentContext`.
|
|
6
|
+
|
|
7
|
+
## Exposed Interfaces
|
|
8
|
+
|
|
9
|
+
| Export | Type | Purpose |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| `createAgentTools` | root function | Load tools asynchronously from `tool.yaml`. |
|
|
12
|
+
| `@botbotgo/kit/sdk` | subpath | SDK for building tool extensions. |
|
|
13
|
+
| `ToolRegistry` | sdk export | Minimal registry for tool definitions. |
|
|
14
|
+
| `createExtension` | sdk export | Create an extension package entry. |
|
|
15
|
+
| `registerExtension` | sdk export | Register an extension into a runtime. |
|
|
16
|
+
| `registerToolsFromManifest` | sdk export | Register tools from a manifest. |
|
|
17
|
+
| `loadToolYaml` | sdk export | Load and parse `tool.yaml`. |
|
|
18
|
+
| `resolveSandboxedPath` | sdk export | Resolve sandboxed filesystem paths. |
|
|
19
|
+
| `validateUrl` | sdk export | Validate outbound URLs. |
|
|
20
|
+
|
|
21
|
+
## Configuration
|
|
22
|
+
|
|
23
|
+
The default config file is `config/tool.yaml`.
|
|
24
|
+
|
|
25
|
+
```yaml
|
|
26
|
+
apiVersion: easynet.world/v1
|
|
27
|
+
kind: ToolConfig
|
|
28
|
+
metadata:
|
|
29
|
+
name: agent-tool-default
|
|
30
|
+
spec:
|
|
31
|
+
sandboxedPath: .
|
|
32
|
+
allowedHosts: []
|
|
33
|
+
blockedHosts: []
|
|
34
|
+
tools:
|
|
35
|
+
npm:@botbotgo/kit-builtin: {}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Key fields:
|
|
39
|
+
|
|
40
|
+
- `spec.sandboxedPath`: filesystem root exposed to tools
|
|
41
|
+
- `spec.allowedHosts`: HTTP allowlist
|
|
42
|
+
- `spec.blockedHosts`: HTTP denylist
|
|
43
|
+
- `spec.tools`: extension descriptors to load
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm i @botbotgo/kit
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import { createAgentTools } from "@botbotgo/kit";
|
|
53
|
+
|
|
54
|
+
const tools = await createAgentTools("./config/tool.yaml");
|
|
55
|
+
|
|
56
|
+
console.log(tools.map((tool) => tool.name));
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Use `createAgentTools()` as the default application initializer. It matches the other async registration APIs (`createAgentModel`, `createAgentMemory`, runtime config loaders) and works cleanly with async extension loading.
|
|
60
|
+
|
|
61
|
+
If you are building your own tool extension, use the SDK subpath:
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
import { createExtension } from "@botbotgo/kit/sdk";
|
|
65
|
+
```
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Build script for @botbotgo/kit
|
|
4
|
+
# This script builds the package and creates a zip file for distribution
|
|
5
|
+
|
|
6
|
+
set -e # Exit on error
|
|
7
|
+
|
|
8
|
+
# Colors for output
|
|
9
|
+
RED='\033[0;31m'
|
|
10
|
+
GREEN='\033[0;32m'
|
|
11
|
+
YELLOW='\033[1;33m'
|
|
12
|
+
NC='\033[0m' # No Color
|
|
13
|
+
|
|
14
|
+
# Get version from package.json
|
|
15
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
16
|
+
PACKAGE_NAME=$(node -p "require('./package.json').name")
|
|
17
|
+
ZIP_NAME="${PACKAGE_NAME}-${VERSION}.zip"
|
|
18
|
+
BUILD_DIR="build"
|
|
19
|
+
TEMP_DIR="${BUILD_DIR}/package"
|
|
20
|
+
|
|
21
|
+
echo -e "${GREEN}Building ${PACKAGE_NAME} v${VERSION}...${NC}"
|
|
22
|
+
|
|
23
|
+
# Clean previous builds
|
|
24
|
+
echo -e "${YELLOW}Cleaning previous builds...${NC}"
|
|
25
|
+
rm -rf "${BUILD_DIR}"
|
|
26
|
+
rm -f "${ZIP_NAME}"
|
|
27
|
+
npm run clean
|
|
28
|
+
|
|
29
|
+
# Build the project
|
|
30
|
+
echo -e "${YELLOW}Building TypeScript...${NC}"
|
|
31
|
+
npm run build
|
|
32
|
+
|
|
33
|
+
# Verify build output
|
|
34
|
+
if [ ! -d "dist" ]; then
|
|
35
|
+
echo -e "${RED}Error: dist directory not found after build${NC}"
|
|
36
|
+
exit 1
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
# Create temporary package directory
|
|
40
|
+
echo -e "${YELLOW}Preparing package...${NC}"
|
|
41
|
+
mkdir -p "${TEMP_DIR}"
|
|
42
|
+
|
|
43
|
+
# Copy necessary files
|
|
44
|
+
echo -e "${YELLOW}Copying files...${NC}"
|
|
45
|
+
cp -r dist "${TEMP_DIR}/"
|
|
46
|
+
cp README.md "${TEMP_DIR}/"
|
|
47
|
+
cp tool.yaml "${TEMP_DIR}/" 2>/dev/null || true
|
|
48
|
+
cp agent.yaml.example "${TEMP_DIR}/" 2>/dev/null || true
|
|
49
|
+
mkdir -p "${TEMP_DIR}/extensions" && cp -r extensions/examples "${TEMP_DIR}/extensions/" 2>/dev/null || true
|
|
50
|
+
mkdir -p "${TEMP_DIR}/scripts"
|
|
51
|
+
cp scripts/dump-tools.mjs "${TEMP_DIR}/scripts/" 2>/dev/null || true
|
|
52
|
+
|
|
53
|
+
# Create a modified package.json for distribution (dump:tools doesn't need to build)
|
|
54
|
+
# Copy package.json first, then modify the dump:tools script
|
|
55
|
+
cp package.json "${TEMP_DIR}/package.json"
|
|
56
|
+
# Use node to modify the package.json
|
|
57
|
+
node -e "const fs=require('fs');const p=fs.readFileSync('${TEMP_DIR}/package.json','utf8');const j=JSON.parse(p);j.scripts=j.scripts||{};j.scripts['dump:tools']='node scripts/dump-tools.mjs';fs.writeFileSync('${TEMP_DIR}/package.json',JSON.stringify(j,null,2)+'\n');"
|
|
58
|
+
|
|
59
|
+
# Create package.json for installation (optional: could include install instructions)
|
|
60
|
+
cat > "${TEMP_DIR}/INSTALL.md" << 'EOF'
|
|
61
|
+
# Installation Instructions
|
|
62
|
+
|
|
63
|
+
## Important: Extract First!
|
|
64
|
+
|
|
65
|
+
**npm cannot install directly from zip files.** You must extract the zip file first.
|
|
66
|
+
|
|
67
|
+
## Installation Steps
|
|
68
|
+
|
|
69
|
+
### Option 1: Local Installation (Recommended)
|
|
70
|
+
|
|
71
|
+
1. **Extract the zip file:**
|
|
72
|
+
```bash
|
|
73
|
+
unzip agent-tool-0.0.1.zip
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
2. **Navigate to the extracted directory:**
|
|
77
|
+
```bash
|
|
78
|
+
cd package
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
3. **Install dependencies:**
|
|
82
|
+
```bash
|
|
83
|
+
npm install
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
4. **Install peer dependencies (if needed):**
|
|
87
|
+
```bash
|
|
88
|
+
npm install @langchain/core @modelcontextprotocol/sdk
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Option 2: Global Installation
|
|
92
|
+
|
|
93
|
+
1. **Extract the zip file:**
|
|
94
|
+
```bash
|
|
95
|
+
unzip agent-tool-0.0.1.zip
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
2. **Install globally from the extracted directory:**
|
|
99
|
+
```bash
|
|
100
|
+
npm install -g ./package
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Or if you're already in the extracted `package` directory:
|
|
104
|
+
```bash
|
|
105
|
+
npm install -g .
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Option 3: Install as Dependency in Another Project
|
|
109
|
+
|
|
110
|
+
1. **Extract the zip file to a location of your choice**
|
|
111
|
+
|
|
112
|
+
2. **In your project, install from the extracted path:**
|
|
113
|
+
```bash
|
|
114
|
+
npm install /path/to/extracted/package
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Dependencies
|
|
118
|
+
|
|
119
|
+
This package requires:
|
|
120
|
+
- Node.js >= 18.0.0
|
|
121
|
+
- Optional peer dependencies:
|
|
122
|
+
- `@langchain/core` (>=0.3.0) - for LangChain tool support
|
|
123
|
+
- `@modelcontextprotocol/sdk` (>=1.0.0) - for MCP tool support
|
|
124
|
+
|
|
125
|
+
Install peer dependencies as needed:
|
|
126
|
+
```bash
|
|
127
|
+
npm install @langchain/core @modelcontextprotocol/sdk
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Usage
|
|
131
|
+
|
|
132
|
+
See README.md for usage instructions and examples.
|
|
133
|
+
|
|
134
|
+
## Available Scripts
|
|
135
|
+
|
|
136
|
+
After installation, you can use:
|
|
137
|
+
|
|
138
|
+
- `npm run dump:tools` - Dump all discovered tools to JSON (requires tool.yaml in the current directory)
|
|
139
|
+
|
|
140
|
+
**Note:** Make sure you're in the extracted `package/` directory when running npm scripts.
|
|
141
|
+
EOF
|
|
142
|
+
|
|
143
|
+
# Create zip file
|
|
144
|
+
echo -e "${YELLOW}Creating zip file: ${ZIP_NAME}...${NC}"
|
|
145
|
+
cd "${BUILD_DIR}"
|
|
146
|
+
zip -r "../${ZIP_NAME}" package -q
|
|
147
|
+
cd ..
|
|
148
|
+
|
|
149
|
+
# Clean up temporary directory
|
|
150
|
+
rm -rf "${BUILD_DIR}"
|
|
151
|
+
|
|
152
|
+
# Display results
|
|
153
|
+
FILE_SIZE=$(du -h "${ZIP_NAME}" | cut -f1)
|
|
154
|
+
echo -e "${GREEN}✓ Build complete!${NC}"
|
|
155
|
+
echo -e "${GREEN} Package: ${ZIP_NAME}${NC}"
|
|
156
|
+
echo -e "${GREEN} Size: ${FILE_SIZE}${NC}"
|
|
157
|
+
echo ""
|
|
158
|
+
echo -e "${YELLOW}Package contents:${NC}"
|
|
159
|
+
echo " - dist/ (compiled JavaScript)"
|
|
160
|
+
echo " - package.json"
|
|
161
|
+
echo " - README.md"
|
|
162
|
+
echo " - tool.yaml, agent.yaml.example (example config)"
|
|
163
|
+
echo " - extensions/examples/ (example scripts and reference content)"
|
|
164
|
+
echo " - scripts/ (utility scripts)"
|
|
165
|
+
echo " - INSTALL.md (installation instructions)"
|
|
166
|
+
echo ""
|
|
167
|
+
echo -e "${GREEN}Installation Instructions:${NC}"
|
|
168
|
+
echo ""
|
|
169
|
+
echo -e "${YELLOW}⚠️ IMPORTANT: npm cannot install directly from zip files!${NC}"
|
|
170
|
+
echo -e "${YELLOW} You must extract the zip file first.${NC}"
|
|
171
|
+
echo ""
|
|
172
|
+
echo -e "${GREEN}To install:${NC}"
|
|
173
|
+
echo " 1. Extract: unzip ${ZIP_NAME}"
|
|
174
|
+
echo " 2. Navigate: cd package"
|
|
175
|
+
echo " 3. Install: npm install"
|
|
176
|
+
echo " 4. (Optional) Install peers: npm install @langchain/core @modelcontextprotocol/sdk"
|
|
177
|
+
echo ""
|
|
178
|
+
echo -e "${GREEN}For global installation:${NC}"
|
|
179
|
+
echo " 1. Extract: unzip ${ZIP_NAME}"
|
|
180
|
+
echo " 2. Install: npm install -g ./package"
|
|
181
|
+
echo ""
|
|
182
|
+
echo -e "${YELLOW}See INSTALL.md in the package for detailed instructions.${NC}"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"lib": [
|
|
7
|
+
"ES2022"
|
|
8
|
+
],
|
|
9
|
+
"strict": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"allowSyntheticDefaultImports": true,
|
|
13
|
+
"forceConsistentCasingInFileNames": true,
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"declarationMap": true,
|
|
16
|
+
"emitDeclarationOnly": true,
|
|
17
|
+
"outDir": "../../dist",
|
|
18
|
+
"rootDir": "../../src",
|
|
19
|
+
"resolveJsonModule": true,
|
|
20
|
+
"isolatedModules": true,
|
|
21
|
+
"baseUrl": "../..",
|
|
22
|
+
"paths": {}
|
|
23
|
+
},
|
|
24
|
+
"include": [
|
|
25
|
+
"../../src/**/*.ts"
|
|
26
|
+
],
|
|
27
|
+
"exclude": [
|
|
28
|
+
"../../node_modules",
|
|
29
|
+
"../../dist",
|
|
30
|
+
"../../test",
|
|
31
|
+
"../../**/*.test.ts",
|
|
32
|
+
"../../extensions"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineConfig } from "tsup";
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
entry: [
|
|
5
|
+
"src/index.ts",
|
|
6
|
+
"src/build.ts",
|
|
7
|
+
"src/sdk.ts",
|
|
8
|
+
"src/utils/cli/index.ts",
|
|
9
|
+
],
|
|
10
|
+
format: ["esm", "cjs"],
|
|
11
|
+
dts: false,
|
|
12
|
+
splitting: true,
|
|
13
|
+
sourcemap: true,
|
|
14
|
+
clean: false,
|
|
15
|
+
treeshake: true,
|
|
16
|
+
target: "node18",
|
|
17
|
+
outDir: "dist",
|
|
18
|
+
external: ["langchain", "zod"],
|
|
19
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineConfig } from "vitest/config";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
|
|
5
|
+
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
|
6
|
+
|
|
7
|
+
// Keep package self-references resolved to local dist build for tests.
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
test: {
|
|
10
|
+
globals: true,
|
|
11
|
+
environment: "node",
|
|
12
|
+
// CI runners can be slower; avoid flaky 5s default timeouts on integration tests.
|
|
13
|
+
testTimeout: 20_000,
|
|
14
|
+
include: ["test/**/*.test.ts"],
|
|
15
|
+
coverage: {
|
|
16
|
+
provider: "v8",
|
|
17
|
+
include: ["src/**/*.ts"],
|
|
18
|
+
exclude: ["src/**/*.d.ts", "**/node_modules/**", "**/test/**"],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
resolve: {
|
|
22
|
+
extensions: [".ts", ".js"],
|
|
23
|
+
preserveSymlinks: true,
|
|
24
|
+
alias: {
|
|
25
|
+
"@botbotgo/kit": path.join(root, "dist/index.js"),
|
|
26
|
+
"@botbotgo/kit/sdk": path.join(root, "dist/sdk.js"),
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
package/config/tool.yaml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-context.d.ts","sourceRoot":"","sources":["../src/agent-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAczE,wBAAgB,sBAAsB,IAAI,YAAY,CAQrD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exposes all tools from a ToolRegistry + PTCRuntime as LangChain tools
|
|
3
|
+
* for local agent use (e.g. with createReactAgent, AgentExecutor).
|
|
4
|
+
*
|
|
5
|
+
* For most users, use createAgentTools() from @botbotgo/kit, which loads from tool.yaml and returns
|
|
6
|
+
* StructuredTool[]. Use LangChainToolsHub when you need a custom runtime or ctxFactory.
|
|
7
|
+
*
|
|
8
|
+
* Use: new LangChainToolsHub(runtime, ctxFactory).getLangChainTools()
|
|
9
|
+
*/
|
|
10
|
+
import { type StructuredToolInterface } from "@langchain/core/tools";
|
|
11
|
+
import type { PTCRuntime } from "../../core/runtime/PTCRuntime.js";
|
|
12
|
+
import type { ExecContext } from "../../core/types/ToolIntent.js";
|
|
13
|
+
export type ExecContextFactory = () => ExecContext;
|
|
14
|
+
/**
|
|
15
|
+
* Hub that wraps PTCRuntime and exposes every registered tool as a LangChain
|
|
16
|
+
* StructuredTool (DynamicStructuredTool), so local agents (LangChain AgentExecutor,
|
|
17
|
+
* createReactAgent, etc.) can use the same tools as MCP and OpenAPI.
|
|
18
|
+
*/
|
|
19
|
+
export declare class LangChainToolsHub {
|
|
20
|
+
private readonly runtime;
|
|
21
|
+
private readonly ctxFactory;
|
|
22
|
+
constructor(runtime: PTCRuntime, ctxFactory?: ExecContextFactory);
|
|
23
|
+
/**
|
|
24
|
+
* Returns all registered tools as LangChain StructuredTool[].
|
|
25
|
+
* Each tool invokes the runtime through the full pipeline (policy, HITL, etc.).
|
|
26
|
+
*/
|
|
27
|
+
getLangChainTools(): StructuredToolInterface[];
|
|
28
|
+
/**
|
|
29
|
+
* Returns LangChain tools for a subset of tools (by name or query).
|
|
30
|
+
*/
|
|
31
|
+
getLangChainToolsForNames(toolNames: string[]): StructuredToolInterface[];
|
|
32
|
+
private buildModelToolNames;
|
|
33
|
+
private specToLangChainTool;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=LangChainToolsHub.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LangChainToolsHub.d.ts","sourceRoot":"","sources":["../../../src/api/adapters/LangChainToolsHub.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAyB,KAAK,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAEnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AA0DlE,MAAM,MAAM,kBAAkB,GAAG,MAAM,WAAW,CAAC;AAiBnD;;;;GAIG;AACH,qBAAa,iBAAiB;IAE1B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBADV,OAAO,EAAE,UAAU,EACnB,UAAU,GAAE,kBAAwC;IAGvE;;;OAGG;IACH,iBAAiB,IAAI,uBAAuB,EAAE;IAO9C;;OAEG;IACH,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,uBAAuB,EAAE;IAQzE,OAAO,CAAC,mBAAmB;IAsB3B,OAAO,CAAC,mBAAmB;CAmB5B"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standalone tool creation functions. Each function:
|
|
3
|
+
* - Uses the embedded config/tool.yaml as the default base.
|
|
4
|
+
* - If a configFilePath is provided, merges it on top of the default.
|
|
5
|
+
* - If no options are provided at all, behaves as if only the embedded default is used.
|
|
6
|
+
*
|
|
7
|
+
* Public module API uses createAgentTools() in register-tools.ts.
|
|
8
|
+
* This file keeps internal builders for LangChain / MCP / OpenAPI outputs.
|
|
9
|
+
*/
|
|
10
|
+
import type { CreateRuntimeOptions } from "./runtimeFromConfig.js";
|
|
11
|
+
import { type MCPServerOptions, type McpServer } from "./expose/mcpServer.js";
|
|
12
|
+
import { type OpenAPIExpressApp, type OpenAPIHttpServerOptions } from "./expose/openapiHttp.js";
|
|
13
|
+
import type { StructuredToolInterface } from "@langchain/core/tools";
|
|
14
|
+
export interface CreateAgentToolsOptions extends CreateRuntimeOptions {
|
|
15
|
+
/** Path to an override tool.yaml; its values are merged on top of the embedded default config/tool.yaml */
|
|
16
|
+
configFilePath?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Internal: create LangChain tools from config/runtime.
|
|
20
|
+
*
|
|
21
|
+
* - No argument → uses embedded default config/tool.yaml.
|
|
22
|
+
* - options.configFilePath → merged on top of embedded default.
|
|
23
|
+
* - All other CreateAgentToolsOptions (coreTools, etc.) are applied as programmatic overrides.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* Internal helper consumed by createAgentTools().
|
|
27
|
+
*/
|
|
28
|
+
export declare function createLangChainAgentTools(options?: CreateAgentToolsOptions | string): StructuredToolInterface[];
|
|
29
|
+
export declare function createLangChainAgentToolsAsync(options?: CreateAgentToolsOptions | string): Promise<StructuredToolInterface[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Internal: create an MCP server from tool config.
|
|
32
|
+
*
|
|
33
|
+
* - No argument → uses embedded default config/tool.yaml.
|
|
34
|
+
* - options.configFilePath → merged on top of embedded default.
|
|
35
|
+
* - options.mcp → passed to the MCP server (name, version, execContextFactory).
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* Internal helper consumed by createAgentTools() expose flows.
|
|
39
|
+
*/
|
|
40
|
+
export declare function createMcpServer(options?: (CreateAgentToolsOptions & MCPServerOptions) | string): Promise<McpServer>;
|
|
41
|
+
/**
|
|
42
|
+
* Internal: create an OpenAPI / Swagger HTTP server from tool config.
|
|
43
|
+
*
|
|
44
|
+
* - No argument → uses embedded default config/tool.yaml.
|
|
45
|
+
* - options.configFilePath → merged on top of embedded default.
|
|
46
|
+
* - options.port, host, basePath → passed to the HTTP server; tool.yaml openapi: section provides defaults.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* Internal helper consumed by createAgentTools() expose flows.
|
|
50
|
+
*/
|
|
51
|
+
export declare function createOpenAPIServer(options?: (CreateAgentToolsOptions & OpenAPIHttpServerOptions) | string): Promise<OpenAPIExpressApp>;
|
|
52
|
+
//# sourceMappingURL=createAgentTools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createAgentTools.d.ts","sourceRoot":"","sources":["../../src/api/createAgentTools.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAcH,OAAO,KAAK,EAAE,oBAAoB,EAAmB,MAAM,wBAAwB,CAAC;AAEpF,OAAO,EAAmB,KAAK,gBAAgB,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC/F,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC9B,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAOrE,MAAM,WAAW,uBAAwB,SAAQ,oBAAoB;IACnE,2GAA2G;IAC3G,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAoRD;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,CAAC,EAAE,uBAAuB,GAAG,MAAM,GACzC,uBAAuB,EAAE,CAa3B;AAED,wBAAsB,8BAA8B,CAClD,OAAO,CAAC,EAAE,uBAAuB,GAAG,MAAM,GACzC,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAsBpC;AAED;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CACnC,OAAO,CAAC,EAAE,CAAC,uBAAuB,GAAG,gBAAgB,CAAC,GAAG,MAAM,GAC9D,OAAO,CAAC,SAAS,CAAC,CAWpB;AAED;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,CAAC,EAAE,CAAC,uBAAuB,GAAG,wBAAwB,CAAC,GAAG,MAAM,GACtE,OAAO,CAAC,iBAAiB,CAAC,CAW5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/expose/extension-init/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scaffold a new agent-tool extension: folder, src, hello-world tool, generate-manifest, index, package.json.
|
|
3
|
+
* Use: agent-tool init <extension name> → then cd <name> && npm install && npm run build.
|
|
4
|
+
*/
|
|
5
|
+
export interface InitExtensionOptions {
|
|
6
|
+
/** Extension name (folder name to create). */
|
|
7
|
+
extensionName: string;
|
|
8
|
+
/** Parent directory (default: process.cwd()). */
|
|
9
|
+
parentDir?: string;
|
|
10
|
+
/** npm package scope (e.g. "wallee" → package name @wallee/<name>). Optional. */
|
|
11
|
+
scope?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create extension scaffold at parentDir/extensionName.
|
|
15
|
+
* Returns target path and list of created files.
|
|
16
|
+
*/
|
|
17
|
+
export declare function initExtension(options: InitExtensionOptions): Promise<{
|
|
18
|
+
targetPath: string;
|
|
19
|
+
filesCreated: string[];
|
|
20
|
+
}>;
|
|
21
|
+
//# sourceMappingURL=initExtension.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initExtension.d.ts","sourceRoot":"","sources":["../../../../src/api/expose/extension-init/initExtension.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,WAAW,oBAAoB;IACnC,8CAA8C;IAC9C,aAAa,EAAE,MAAM,CAAC;IACtB,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iFAAiF;IACjF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA8KD;;;GAGG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAuBzD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Expose the same tools in multiple ways: LangChain, HTTP (OpenAPI), MCP server.
|
|
3
|
+
*
|
|
4
|
+
* - LangChain: await createAgentTools() / LangChainToolsHub
|
|
5
|
+
* - HTTP: createHttpService(runtime) -> { server, openApiSpec, listen() }
|
|
6
|
+
* - MCP: createMCPServer(runtime) -> { server, connectStdio() }
|
|
7
|
+
*/
|
|
8
|
+
export { toolsToOpenAPISpec } from "./openapi.js";
|
|
9
|
+
export type { OpenAPISpecOptions } from "./openapi.js";
|
|
10
|
+
export { createHttpService, createOpenAPIHttpServer, listenOpenAPIHttpServer, } from "./openapiHttp.js";
|
|
11
|
+
export type { CreateHttpServiceOptions, HttpServiceResult, OpenAPIExpressApp, OpenAPIHttpServerOptions, } from "./openapiHttp.js";
|
|
12
|
+
export { createMCPServer, runMCPServerOverStdio, createMCPStreamableHttpHandler, createMCPServerStreamableHttp, } from "./mcpServer.js";
|
|
13
|
+
export type { MCPServerOptions, MCPServerResult, MCPStreamableHttpHandler, MCPServerStreamableHttpResult, CreateMCPServerStreamableHttpOptions, } from "./mcpServer.js";
|
|
14
|
+
export { initProject, buildMCPPackage, runMCPServer } from "./mcp-build/index.js";
|
|
15
|
+
export type { InitOptions, BuildOptions, RunOptions, ScanOptions, BuildResult, SideEffect, MCPToolSpec, FunctionToolSpec, SkillToolSpec, N8nToolSpec, } from "./mcp-build/index.js";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/expose/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,8BAA8B,EAC9B,6BAA6B,GAC9B,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EACxB,6BAA6B,EAC7B,oCAAoC,GACrC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAClF,YAAY,EACV,WAAW,EACX,YAAY,EACZ,UAAU,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,WAAW,GACZ,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP build: scan project for @tool, SKILL, n8n; generate MCP entrypoint and npm package.
|
|
3
|
+
*/
|
|
4
|
+
import type { BuildResult } from "./types.js";
|
|
5
|
+
export interface BuildOptions {
|
|
6
|
+
/** Project root (folder to scan; default: cwd). */
|
|
7
|
+
projectPath?: string;
|
|
8
|
+
/** Output directory for generated files (default: projectPath/dist). */
|
|
9
|
+
outDir?: string;
|
|
10
|
+
/** Glob patterns for TS files (default: ["**\/*.ts"]). Used for @tool (TypeScript) scanning only. */
|
|
11
|
+
include?: string[];
|
|
12
|
+
/** Path to tsconfig.json (default: projectPath/tsconfig.json). Used for @tool scanning only. */
|
|
13
|
+
tsconfigPath?: string;
|
|
14
|
+
/** Include n8n (workflow.json) tools. Default false: we do not start or install n8n-local; set true if you use n8n. */
|
|
15
|
+
includeN8n?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Scan project for all tools (@tool, SKILL, n8n); generate MCP server + tool-specs + invokers (npm package).
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildMCPPackage(options?: BuildOptions): Promise<BuildResult>;
|
|
21
|
+
//# sourceMappingURL=build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/api/expose/mcp-build/build.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG9C,MAAM,WAAW,YAAY;IAC3B,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qGAAqG;IACrG,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,gGAAgG;IAChG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uHAAuH;IACvH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CAqCtF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate MCP server entrypoint, tool-specs.json, invokers for function/skill/n8n.
|
|
3
|
+
* Accepts unified ToolSpec[] (reads _meta.sourcePath/exportName, endpoint for codegen).
|
|
4
|
+
*/
|
|
5
|
+
import type { ToolSpec } from "../../../core/types/ToolSpec.js";
|
|
6
|
+
/** Write generated files into outDir. projectPath is the folder containing source. */
|
|
7
|
+
export declare function generate(options: {
|
|
8
|
+
specs: ToolSpec[];
|
|
9
|
+
outDir: string;
|
|
10
|
+
projectPath: string;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
entryPath: string;
|
|
13
|
+
mcpJsonPath: string;
|
|
14
|
+
}>;
|
|
15
|
+
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../src/api/expose/mcp-build/generator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AA+FhE,sFAAsF;AACtF,wBAAsB,QAAQ,CAAC,OAAO,EAAE;IACtC,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CA2FtD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { initProject } from "./init.js";
|
|
2
|
+
export type { InitOptions } from "./init.js";
|
|
3
|
+
export { buildMCPPackage } from "./build.js";
|
|
4
|
+
export type { BuildOptions } from "./build.js";
|
|
5
|
+
export { runMCPServer } from "./run.js";
|
|
6
|
+
export type { RunOptions } from "./run.js";
|
|
7
|
+
export type { SideEffect, MCPToolSpec, FunctionToolSpec, SkillToolSpec, N8nToolSpec, ScanOptions, BuildResult, } from "./types.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/expose/mcp-build/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,YAAY,EACV,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,WAAW,EACX,WAAW,GACZ,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scaffold a new MCP tool project: @tool TS, SKILL sample, tsconfig, README.
|
|
3
|
+
* Use: init → build → run.
|
|
4
|
+
*/
|
|
5
|
+
export interface InitOptions {
|
|
6
|
+
/** Target directory to create project (default: cwd). */
|
|
7
|
+
targetPath?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Create project template at targetPath. Writes tsconfig, src/tools/example.ts,
|
|
11
|
+
* skills/hello-skill (SKILL.md + handler.js), and README.
|
|
12
|
+
*/
|
|
13
|
+
export declare function initProject(options?: InitOptions): Promise<{
|
|
14
|
+
targetPath: string;
|
|
15
|
+
filesCreated: string[];
|
|
16
|
+
}>;
|
|
17
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/api/expose/mcp-build/init.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,WAAW,WAAW;IAC1B,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAqFD;;;GAGG;AACH,wBAAsB,WAAW,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAoBpH"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run step: start the generated MCP server (stdio) for testing. Spawns entrypoint via npx tsx.
|
|
3
|
+
*/
|
|
4
|
+
import { spawn } from "node:child_process";
|
|
5
|
+
export interface RunOptions {
|
|
6
|
+
/** Directory containing generated mcp-server (default: cwd or cwd/dist). */
|
|
7
|
+
path?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Start the MCP server from the given directory.
|
|
11
|
+
* Expects mcp-server.ts and tool-specs.json there; runs via npx tsx mcp-server.ts.
|
|
12
|
+
* Returns a child process; caller should handle stdin/stdout and cleanup.
|
|
13
|
+
*/
|
|
14
|
+
export declare function runMCPServer(options?: RunOptions): Promise<{
|
|
15
|
+
process: ReturnType<typeof spawn>;
|
|
16
|
+
}>;
|
|
17
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../../src/api/expose/mcp-build/run.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI3C,MAAM,WAAW,UAAU;IACzB,4EAA4E;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,UAAU,CAAC,OAAO,KAAK,CAAC,CAAA;CAAE,CAAC,CAkC3G"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for MCP build: re-export scan types and add build-specific options/result.
|
|
3
|
+
*/
|
|
4
|
+
export type { SideEffect, MCPToolSpec, FunctionToolSpec, SkillToolSpec, N8nToolSpec, } from "../../../tools/discoveryFactory.js";
|
|
5
|
+
/** Options for scanning a folder for @tool functions (used by MCP build). */
|
|
6
|
+
export interface ScanOptions {
|
|
7
|
+
/** Project root (folder containing tsconfig or source). */
|
|
8
|
+
projectPath: string;
|
|
9
|
+
/** Glob or path pattern for TS files (default: "src/**\/*.ts"). */
|
|
10
|
+
include?: string[];
|
|
11
|
+
/** Path to tsconfig.json (default: projectPath/tsconfig.json). */
|
|
12
|
+
tsconfigPath?: string;
|
|
13
|
+
}
|
|
14
|
+
/** Result of a full build (scan + generate). */
|
|
15
|
+
export interface BuildResult {
|
|
16
|
+
/** Path to the generated output directory. */
|
|
17
|
+
outDir: string;
|
|
18
|
+
/** Number of tools discovered. */
|
|
19
|
+
toolCount: number;
|
|
20
|
+
/** Path to generated mcp-server entry (e.g. mcp-server.js or mcp-server.ts). */
|
|
21
|
+
entryPath: string;
|
|
22
|
+
/** Path to generated mcp.json (command/args to run the server). */
|
|
23
|
+
mcpJsonPath: string;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/api/expose/mcp-build/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EACV,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,WAAW,GACZ,MAAM,oCAAoC,CAAC;AAE5C,6EAA6E;AAC7E,MAAM,WAAW,WAAW;IAC1B,2DAA2D;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,kEAAkE;IAClE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,gDAAgD;AAChD,MAAM,WAAW,WAAW;IAC1B,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAC;IAClB,mEAAmE;IACnE,WAAW,EAAE,MAAM,CAAC;CACrB"}
|