@easynet/agent-tool 1.0.1 → 1.0.3
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 +92 -50
- package/dist/api/adapters/LangChainToolsHub.d.ts +34 -0
- package/dist/api/adapters/LangChainToolsHub.d.ts.map +1 -0
- package/dist/api/createAgentTools.d.ts +24 -0
- package/dist/api/createAgentTools.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.map +1 -0
- package/dist/{codegen → api/expose/mcp-build}/generator.d.ts +3 -3
- 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.map +1 -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 +75 -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 +67 -0
- package/dist/api/expose/openapiHttp.d.ts.map +1 -0
- package/dist/api/main.cjs +56 -0
- package/dist/api/main.cjs.map +1 -0
- package/dist/api/main.d.ts +23 -0
- package/dist/api/main.d.ts.map +1 -0
- package/dist/api/main.js +7 -0
- package/dist/api/main.js.map +1 -0
- package/dist/api/runtimeFromConfig.d.ts +43 -0
- package/dist/api/runtimeFromConfig.d.ts.map +1 -0
- package/dist/canonicalCoreSchemas-CTW6CCFY.cjs +20 -0
- package/dist/canonicalCoreSchemas-CTW6CCFY.cjs.map +1 -0
- package/dist/canonicalCoreSchemas-YLHVHYJZ.js +3 -0
- package/dist/canonicalCoreSchemas-YLHVHYJZ.js.map +1 -0
- package/dist/chunk-4U266P4H.cjs +1646 -0
- package/dist/chunk-4U266P4H.cjs.map +1 -0
- package/dist/{chunk-AXUNV4MK.js → chunk-5SWSNVMI.js} +3 -3
- package/dist/chunk-5SWSNVMI.js.map +1 -0
- package/dist/chunk-6F5JHLZ7.cjs +243 -0
- package/dist/chunk-6F5JHLZ7.cjs.map +1 -0
- package/dist/chunk-7SGI5EGB.js +116 -0
- package/dist/chunk-7SGI5EGB.js.map +1 -0
- package/dist/chunk-AE6FSNGY.js +201 -0
- package/dist/chunk-AE6FSNGY.js.map +1 -0
- package/dist/chunk-FR2CXERF.js +239 -0
- package/dist/chunk-FR2CXERF.js.map +1 -0
- package/dist/chunk-KPKQ647P.cjs +120 -0
- package/dist/chunk-KPKQ647P.cjs.map +1 -0
- package/dist/{chunk-3YLVPZRJ.cjs → chunk-SOFUWEZ6.cjs} +3 -3
- package/dist/chunk-SOFUWEZ6.cjs.map +1 -0
- package/dist/chunk-U55KMDXY.js +469 -0
- package/dist/chunk-U55KMDXY.js.map +1 -0
- package/dist/{chunk-BM4EVYI5.js → chunk-WOCVXQOW.js} +836 -122
- package/dist/chunk-WOCVXQOW.js.map +1 -0
- package/dist/{chunk-Z7TGIG77.cjs → chunk-XJS3NKHW.cjs} +843 -127
- package/dist/chunk-XJS3NKHW.cjs.map +1 -0
- package/dist/chunk-YJSGSAS6.cjs +475 -0
- package/dist/chunk-YJSGSAS6.cjs.map +1 -0
- package/dist/chunk-YMCAX4O6.js +1609 -0
- package/dist/chunk-YMCAX4O6.js.map +1 -0
- package/dist/chunk-ZNJBRLKN.cjs +210 -0
- package/dist/chunk-ZNJBRLKN.cjs.map +1 -0
- package/dist/core/index.cjs +20 -0
- package/dist/core/index.cjs.map +1 -0
- package/dist/{core.d.ts → core/index.d.ts} +2 -3
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +3 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/registry/ToolRegistry.d.ts.map +1 -0
- package/dist/core/runtime/Budget.d.ts.map +1 -0
- package/dist/core/runtime/Evidence.d.ts.map +1 -0
- package/dist/{runtime → core/runtime}/PTCRuntime.d.ts +4 -4
- package/dist/core/runtime/PTCRuntime.d.ts.map +1 -0
- package/dist/{runtime → core/runtime}/PTCRuntimeObservability.d.ts +4 -4
- package/dist/core/runtime/PTCRuntimeObservability.d.ts.map +1 -0
- package/dist/{runtime → core/runtime}/PTCRuntimePipeline.d.ts +4 -4
- package/dist/core/runtime/PTCRuntimePipeline.d.ts.map +1 -0
- package/dist/core/runtime/PolicyEngine.d.ts.map +1 -0
- package/dist/core/runtime/Retry.d.ts.map +1 -0
- package/dist/core/runtime/SchemaValidator.d.ts.map +1 -0
- package/dist/core/runtime.cjs +24 -0
- package/dist/core/runtime.cjs.map +1 -0
- package/dist/core/runtime.d.ts +12 -0
- package/dist/core/runtime.d.ts.map +1 -0
- package/dist/core/runtime.js +3 -0
- package/dist/core/runtime.js.map +1 -0
- package/dist/core/types/Events.d.ts.map +1 -0
- package/dist/core/types/ToolIntent.d.ts.map +1 -0
- package/dist/{types → core/types}/ToolResult.d.ts +6 -1
- package/dist/core/types/ToolResult.d.ts.map +1 -0
- package/dist/{types → core/types}/ToolSpec.d.ts +15 -5
- 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/{types → core/types}/index.d.ts +2 -1
- package/dist/core/types/index.d.ts.map +1 -0
- package/dist/index.cjs +212 -2830
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +61 -59
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +126 -2690
- package/dist/index.js.map +1 -1
- package/dist/observability/EventLog.d.ts +1 -1
- package/dist/observability/EventLog.d.ts.map +1 -1
- 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/{codegen/scan → tools/function}/scanner.d.ts +5 -2
- package/dist/{codegen/scan → tools/function}/scanner.d.ts.map +1 -1
- package/dist/{codegen/scan → tools/function}/schemaFromTs.d.ts +1 -1
- 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/{discovery/load → tools/langchain}/LangChainLoader.d.ts +1 -1
- 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/{mcp → tools/mcp}/MCPClientAdapter.d.ts +3 -3
- package/dist/tools/mcp/MCPClientAdapter.d.ts.map +1 -0
- package/dist/{discovery/load → tools/mcp}/MCPLoader.d.ts +1 -1
- 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/{mcp → tools/mcp}/connectMCP.d.ts +3 -3
- 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/{mcp → tools/mcp}/index.d.ts +6 -1
- 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/{mcp → tools/mcp}/registerMCPTools.d.ts +2 -2
- 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/types.d.ts +3 -0
- package/dist/tools/mcp/types.d.ts.map +1 -0
- package/dist/{discovery/load → tools/n8n}/N8nLoader.d.ts +3 -3
- 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/{discovery/load → tools/skill}/SkillLoader.d.ts +1 -1
- package/dist/tools/skill/SkillLoader.d.ts.map +1 -0
- package/dist/tools/skill/SkillManifest.d.ts.map +1 -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 +19 -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 +32 -0
- package/dist/tools/util/toolConfig.d.ts.map +1 -0
- package/dist/tools/util/toolDescriptor.d.ts +92 -0
- package/dist/tools/util/toolDescriptor.d.ts.map +1 -0
- package/dist/utils/cli/index.cjs +419 -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 +412 -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/npmCache.d.ts +28 -0
- package/dist/utils/npmCache.d.ts.map +1 -0
- package/package.json +24 -13
- package/dist/chunk-3YLVPZRJ.cjs.map +0 -1
- package/dist/chunk-AXUNV4MK.js.map +0 -1
- package/dist/chunk-BM4EVYI5.js.map +0 -1
- package/dist/chunk-P3UEAZHK.cjs +0 -171
- package/dist/chunk-P3UEAZHK.cjs.map +0 -1
- package/dist/chunk-RPAMQCFH.js +0 -167
- package/dist/chunk-RPAMQCFH.js.map +0 -1
- package/dist/chunk-Z7TGIG77.cjs.map +0 -1
- package/dist/cli.cjs +0 -154
- package/dist/cli.cjs.map +0 -1
- package/dist/cli.d.ts +0 -10
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -147
- package/dist/cli.js.map +0 -1
- package/dist/codegen/build.d.ts.map +0 -1
- package/dist/codegen/generator.d.ts.map +0 -1
- package/dist/codegen/index.d.ts +0 -21
- package/dist/codegen/index.d.ts.map +0 -1
- package/dist/codegen/init.d.ts.map +0 -1
- package/dist/codegen/run.d.ts.map +0 -1
- package/dist/codegen/scan/scanN8n.d.ts +0 -17
- package/dist/codegen/scan/scanN8n.d.ts.map +0 -1
- package/dist/codegen/scan/scanSkill.d.ts +0 -17
- package/dist/codegen/scan/scanSkill.d.ts.map +0 -1
- package/dist/codegen/scan/scanTools.d.ts +0 -31
- package/dist/codegen/scan/scanTools.d.ts.map +0 -1
- package/dist/codegen/scan/schemaFromTs.d.ts.map +0 -1
- package/dist/codegen/types.d.ts +0 -81
- package/dist/codegen/types.d.ts.map +0 -1
- package/dist/core.cjs +0 -20
- package/dist/core.cjs.map +0 -1
- package/dist/core.d.ts.map +0 -1
- package/dist/core.js +0 -3
- package/dist/core.js.map +0 -1
- package/dist/discovery/MCPProcessManager.d.ts +0 -57
- package/dist/discovery/MCPProcessManager.d.ts.map +0 -1
- package/dist/discovery/errors.d.ts +0 -13
- package/dist/discovery/errors.d.ts.map +0 -1
- package/dist/discovery/load/LangChainLoader.d.ts.map +0 -1
- package/dist/discovery/load/MCPLoader.d.ts.map +0 -1
- package/dist/discovery/load/N8nLoader.d.ts.map +0 -1
- package/dist/discovery/load/SkillLoader.d.ts.map +0 -1
- package/dist/discovery/load/SkillManifest.d.ts.map +0 -1
- package/dist/discovery/load/SkillMdParser.d.ts.map +0 -1
- package/dist/discovery/load/index.d.ts +0 -6
- package/dist/discovery/load/index.d.ts.map +0 -1
- package/dist/discovery/load/resolveEntry.d.ts +0 -7
- package/dist/discovery/load/resolveEntry.d.ts.map +0 -1
- package/dist/discovery/scan/DirectoryScanner.d.ts +0 -37
- package/dist/discovery/scan/DirectoryScanner.d.ts.map +0 -1
- package/dist/discovery/scan/scanUtil.d.ts +0 -16
- package/dist/discovery/scan/scanUtil.d.ts.map +0 -1
- package/dist/discovery/types.d.ts +0 -99
- package/dist/discovery/types.d.ts.map +0 -1
- package/dist/llm/AgentLLMAdapter.d.ts +0 -27
- package/dist/llm/AgentLLMAdapter.d.ts.map +0 -1
- package/dist/llm/LangChainToolsHub.d.ts +0 -31
- package/dist/llm/LangChainToolsHub.d.ts.map +0 -1
- package/dist/llm/OpenAICompatibleClient.d.ts +0 -64
- package/dist/llm/OpenAICompatibleClient.d.ts.map +0 -1
- package/dist/llm/ReActAgent.d.ts +0 -35
- package/dist/llm/ReActAgent.d.ts.map +0 -1
- package/dist/llm-export.cjs +0 -20
- package/dist/llm-export.cjs.map +0 -1
- package/dist/llm-export.d.ts +0 -9
- package/dist/llm-export.d.ts.map +0 -1
- package/dist/llm-export.js +0 -3
- package/dist/llm-export.js.map +0 -1
- package/dist/mcp/MCPClientAdapter.d.ts.map +0 -1
- package/dist/mcp/connectMCP.d.ts.map +0 -1
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/registerMCPTools.d.ts.map +0 -1
- package/dist/registry/ToolRegistry.d.ts.map +0 -1
- package/dist/report/AgentReportGenerator.d.ts +0 -53
- package/dist/report/AgentReportGenerator.d.ts.map +0 -1
- package/dist/report/agent-report-template.html +0 -362
- package/dist/report/index.d.ts +0 -3
- package/dist/report/index.d.ts.map +0 -1
- package/dist/report/types.d.ts +0 -101
- package/dist/report/types.d.ts.map +0 -1
- package/dist/runAgent.d.ts +0 -37
- package/dist/runAgent.d.ts.map +0 -1
- package/dist/runtime/Budget.d.ts.map +0 -1
- package/dist/runtime/Evidence.d.ts.map +0 -1
- package/dist/runtime/PTCRuntime.d.ts.map +0 -1
- package/dist/runtime/PTCRuntimeObservability.d.ts.map +0 -1
- package/dist/runtime/PTCRuntimePipeline.d.ts.map +0 -1
- package/dist/runtime/PolicyEngine.d.ts.map +0 -1
- package/dist/runtime/Retry.d.ts.map +0 -1
- package/dist/runtime/SchemaValidator.d.ts.map +0 -1
- package/dist/toolDescriptor.d.ts +0 -38
- package/dist/toolDescriptor.d.ts.map +0 -1
- package/dist/types/Events.d.ts.map +0 -1
- package/dist/types/ToolIntent.d.ts.map +0 -1
- package/dist/types/ToolResult.d.ts.map +0 -1
- package/dist/types/ToolSpec.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/extensions/examples/README.md +0 -40
- package/extensions/examples/scripts/agent-tool-react-stock.mjs +0 -30
- package/extensions/examples/tools/instruction-only/skill/SKILL.md +0 -26
- package/extensions/examples/tools/web-search/mcp/mcp.json +0 -8
- /package/dist/{codegen → api/expose/mcp-build}/build.d.ts +0 -0
- /package/dist/{codegen → api/expose/mcp-build}/init.d.ts +0 -0
- /package/dist/{codegen → api/expose/mcp-build}/run.d.ts +0 -0
- /package/dist/{registry → core/registry}/ToolRegistry.d.ts +0 -0
- /package/dist/{runtime → core/runtime}/Budget.d.ts +0 -0
- /package/dist/{runtime → core/runtime}/Evidence.d.ts +0 -0
- /package/dist/{runtime → core/runtime}/PolicyEngine.d.ts +0 -0
- /package/dist/{runtime → core/runtime}/Retry.d.ts +0 -0
- /package/dist/{runtime → core/runtime}/SchemaValidator.d.ts +0 -0
- /package/dist/{types → core/types}/Events.d.ts +0 -0
- /package/dist/{types → core/types}/ToolIntent.d.ts +0 -0
- /package/dist/{discovery/load → tools/skill}/SkillManifest.d.ts +0 -0
- /package/dist/{discovery/load → tools/skill}/SkillMdParser.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,78 +1,120 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @easynet/agent-tool
|
|
2
|
+
|
|
3
|
+
Agent tool runtime: unified registration, policy, budget, and observability. Multiple tool sources; expose as LangChain tools, MCP service, or OpenAPI HTTP.
|
|
4
|
+
|
|
5
|
+
## Capabilities
|
|
6
|
+
|
|
7
|
+
| Category | Name | Description |
|
|
8
|
+
|----------|------|-------------|
|
|
9
|
+
| **Tool sources** | `@tool` functions | Annotated tool functions in TS/JS |
|
|
10
|
+
| | SKILL | Skills described in SKILL.md |
|
|
11
|
+
| | n8n workflows | Workflow nodes as tools |
|
|
12
|
+
| | MCP service | Remote tools via MCP protocol |
|
|
13
|
+
| | LangChain directory | LangChain-format tool directory |
|
|
14
|
+
| **Runtime** | PTCRuntime | Tool invocation execution |
|
|
15
|
+
| | Policy engine | Pre-execution policy checks |
|
|
16
|
+
| | Schema validation | Input/output validation |
|
|
17
|
+
| | Budget | Call quotas and limits |
|
|
18
|
+
| | Retry | Automatic retry for retryable errors |
|
|
19
|
+
| | Evidence | Call logging and audit |
|
|
20
|
+
| **Exposure** | LangChain tools | For createReactAgent / AgentExecutor |
|
|
21
|
+
| | MCP service (stdio) | For Cursor / Claude etc. MCP clients |
|
|
22
|
+
| | MCP service (Streamable HTTP) | HTTP + SSE, MCP Streamable HTTP (stateless) |
|
|
23
|
+
| | OpenAPI HTTP (GET /tools, POST /invoke) | REST API for any HTTP client |
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm i @easynet/agent-tool
|
|
29
|
+
```
|
|
2
30
|
|
|
3
|
-
|
|
31
|
+
## Usage
|
|
4
32
|
|
|
5
|
-
|
|
33
|
+
### 1. CLI
|
|
6
34
|
|
|
7
|
-
|
|
35
|
+
```bash
|
|
36
|
+
# List tools from current project config
|
|
37
|
+
npx agent-tool ls
|
|
8
38
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
| **Arbitrary functions** | Add `@tool` annotation to turn them into MCP tools |
|
|
12
|
-
| **SKILL** | Full support for [SKILL](docs/AGENT_SKILLS_SPEC.md); no Claude dependency, works with any LLM |
|
|
13
|
-
| **mcp.json** | Bridge other MCPs |
|
|
39
|
+
# Show tool details
|
|
40
|
+
npx agent-tool describe <scope/name>
|
|
14
41
|
|
|
15
|
-
|
|
42
|
+
# Run a tool locally
|
|
43
|
+
npx agent-tool run <scope/name> '<{"key":"value"}>'
|
|
16
44
|
|
|
17
|
-
|
|
45
|
+
# MCP standalone package: init → build → serve
|
|
46
|
+
npx agent-tool init
|
|
47
|
+
npx agent-tool build --path . --out dist
|
|
48
|
+
npx agent-tool serve --path dist
|
|
49
|
+
```
|
|
18
50
|
|
|
19
|
-
|
|
51
|
+
### 2. Configure tool.yaml
|
|
20
52
|
|
|
21
|
-
|
|
22
|
-
npm install @easynet/agent-tool
|
|
23
|
-
```
|
|
53
|
+
Place `tool.yaml` at project root to list tools (used by `createAgentTools` and `agent-tool ls`):
|
|
24
54
|
|
|
25
|
-
|
|
55
|
+
```yaml
|
|
56
|
+
tools:
|
|
57
|
+
- npm:@easynet/agent-tool-builtin#fs.readText
|
|
58
|
+
- npm:@easynet/agent-tool-builtin#fs.writeText
|
|
59
|
+
# ...
|
|
60
|
+
```
|
|
26
61
|
|
|
27
|
-
|
|
28
|
-
agent-tool build
|
|
29
|
-
```
|
|
62
|
+
### 3. Programmatic: LangChain tools
|
|
30
63
|
|
|
31
|
-
|
|
64
|
+
```ts
|
|
65
|
+
import { createAgentTools } from "@easynet/agent-tool/api";
|
|
32
66
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
67
|
+
const tools = createAgentTools({ configFilePath: "tool.yaml", coreTools: {} });
|
|
68
|
+
// Use with createReactAgent / AgentExecutor
|
|
69
|
+
```
|
|
36
70
|
|
|
37
|
-
4.
|
|
71
|
+
### 4. Programmatic: MCP service (stdio)
|
|
38
72
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
```
|
|
73
|
+
```ts
|
|
74
|
+
import { createMCPServer, createRuntimeFromConfigSync } from "@easynet/agent-tool/api";
|
|
42
75
|
|
|
43
|
-
|
|
76
|
+
const { runtime } = createRuntimeFromConfigSync({ coreTools: {} });
|
|
77
|
+
const server = createMCPServer(runtime);
|
|
78
|
+
// runMCPServerOverStdio(server) or attach to stdio
|
|
79
|
+
```
|
|
44
80
|
|
|
45
|
-
|
|
81
|
+
### 5. Programmatic: MCP service (Streamable HTTP)
|
|
46
82
|
|
|
47
|
-
|
|
83
|
+
```ts
|
|
84
|
+
import { createMCPStreamableHttpHandler, createMCPServerStreamableHttp, createRuntimeFromConfigSync } from "@easynet/agent-tool/api";
|
|
48
85
|
|
|
49
|
-
|
|
86
|
+
const { runtime } = createRuntimeFromConfigSync({ coreTools: {} });
|
|
50
87
|
|
|
51
|
-
|
|
88
|
+
// Option A: handler only, mount on your HTTP server (use express.json() for body)
|
|
89
|
+
const handler = createMCPStreamableHttpHandler(runtime);
|
|
90
|
+
// app.use(express.json()); app.post("/mcp", handler);
|
|
52
91
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
*/
|
|
58
|
-
export async function add(a: number, b: number): Promise<number> {
|
|
59
|
-
return a + b;
|
|
60
|
-
}
|
|
92
|
+
// Option B: get Express app and start
|
|
93
|
+
const { app, path, listen } = await createMCPServerStreamableHttp(runtime, { path: "/mcp", port: 3000 });
|
|
94
|
+
const { url } = await listen(3000);
|
|
95
|
+
// Client: POST http://127.0.0.1:3000/mcp (MCP Streamable HTTP: SSE + direct response)
|
|
61
96
|
```
|
|
62
97
|
|
|
63
|
-
|
|
64
|
-
- Name: `example.add` (or `src.tools.example.add` when file is `src/tools/example.ts`)
|
|
65
|
-
- Description: Add two numbers
|
|
66
|
-
- Params: `a` (number), `b` (number)
|
|
98
|
+
### 6. Programmatic: OpenAPI HTTP
|
|
67
99
|
|
|
68
|
-
|
|
100
|
+
```ts
|
|
101
|
+
import { createOpenAPIServer, createRuntimeFromConfigSync } from "@easynet/agent-tool/api";
|
|
69
102
|
|
|
70
|
-
|
|
103
|
+
const { runtime } = createRuntimeFromConfigSync({ coreTools: {} });
|
|
104
|
+
const { app } = createOpenAPIServer(runtime, { basePath: "/api" });
|
|
105
|
+
// Express-compatible app: GET /api/tools, POST /api/invoke
|
|
106
|
+
```
|
|
71
107
|
|
|
72
|
-
|
|
108
|
+
## Entrypoints
|
|
73
109
|
|
|
74
|
-
|
|
110
|
+
| Entry | Purpose |
|
|
111
|
+
|-------|---------|
|
|
112
|
+
| `@easynet/agent-tool` | Core types, Runtime, Registry, discovery, MCP client, extensions |
|
|
113
|
+
| `@easynet/agent-tool/api` | createAgentTools, createMCPServer, createMCPStreamableHttpHandler, createMCPServerStreamableHttp, createOpenAPIServer, createRuntimeFromConfig |
|
|
114
|
+
| `@easynet/agent-tool/core` | PTCRuntime, PolicyEngine, SchemaValidator, ToolSpec, etc. |
|
|
115
|
+
| `@easynet/agent-tool/runtime` | Same as core runtime subpath |
|
|
75
116
|
|
|
76
|
-
|
|
77
|
-
- Example tools extension (core style): `extensions/example-tools/` (Yahoo Finance quote + chart; FS/HTTP use builtin-tools).
|
|
117
|
+
## Requirements
|
|
78
118
|
|
|
119
|
+
- Node.js >= 18
|
|
120
|
+
- For LangChain: install `langchain`, `@langchain/core`, `zod`. For MCP: install `@modelcontextprotocol/sdk` (see package peerDependencies).
|
|
@@ -0,0 +1,34 @@
|
|
|
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() which loads from tools.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 specToLangChainTool;
|
|
33
|
+
}
|
|
34
|
+
//# 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;AAC5F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAEnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAIlE,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;IAOzE,OAAO,CAAC,mBAAmB;CAgC5B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create LangChain tools from config (sync or async). Uses PTCRuntime + registry
|
|
3
|
+
* and exposes tools via LangChainToolsHub. All invokes go through PTC Intent.
|
|
4
|
+
*/
|
|
5
|
+
import type { CreateRuntimeOptions } from "./runtimeFromConfig.js";
|
|
6
|
+
import type { StructuredToolInterface } from "@langchain/core/tools";
|
|
7
|
+
export interface CreateAgentToolsOptions extends CreateRuntimeOptions {
|
|
8
|
+
/** Path to tool.yaml; when set, only tools listed there are returned; sandboxedPath from it is used as sandboxRoot */
|
|
9
|
+
configFilePath?: string;
|
|
10
|
+
/** Project path for async loading (use createLangChainToolsAsync) */
|
|
11
|
+
projectPath?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create LangChain tools synchronously. When configFilePath is set, returns only
|
|
15
|
+
* tools listed in that file (and that exist in the registry). If tool.yaml has
|
|
16
|
+
* sandboxedPath, fs tools can only access that directory.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createAgentTools(options?: CreateAgentToolsOptions | string): StructuredToolInterface[];
|
|
19
|
+
/**
|
|
20
|
+
* Create LangChain tools asynchronously. Use when projectPath is set to load
|
|
21
|
+
* tools from the project before building the tool list.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createLangChainToolsAsync(options?: CreateAgentToolsOptions): Promise<StructuredToolInterface[]>;
|
|
24
|
+
//# sourceMappingURL=createAgentTools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createAgentTools.d.ts","sourceRoot":"","sources":["../../src/api/createAgentTools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAErE,MAAM,WAAW,uBAAwB,SAAQ,oBAAoB;IACnE,sHAAsH;IACtH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAcD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,CAAC,EAAE,uBAAuB,GAAG,MAAM,GACzC,uBAAuB,EAAE,CAkB3B;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAgBpC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Expose the same tools in multiple ways: LangChain, HTTP (OpenAPI), MCP server.
|
|
3
|
+
*
|
|
4
|
+
* - LangChain: createAgentTools() / LangChainToolsHub (already in llm/)
|
|
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, 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, buildFunctionToTool, runMcpServer, runGeneratedMCP } 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,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,mBAAmB,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACxH,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 @@
|
|
|
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;AAED,uCAAuC;AACvC,eAAO,MAAM,mBAAmB,wBAAkB,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generate MCP server entrypoint, tool-specs.json, invokers for function/skill/n8n.
|
|
3
|
-
*
|
|
3
|
+
* Accepts unified ToolSpec[] (reads _meta.sourcePath/exportName, endpoint for codegen).
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { ToolSpec } from "../../../core/types/ToolSpec.js";
|
|
6
6
|
/** Write generated files into outDir. projectPath is the folder containing source. */
|
|
7
7
|
export declare function generate(options: {
|
|
8
|
-
specs:
|
|
8
|
+
specs: ToolSpec[];
|
|
9
9
|
outDir: string;
|
|
10
10
|
projectPath: string;
|
|
11
11
|
}): Promise<{
|
|
@@ -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;AA4FhE,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, buildFunctionToTool } from "./build.js";
|
|
4
|
+
export type { BuildOptions } from "./build.js";
|
|
5
|
+
export { runMcpServer, runGeneratedMCP } 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,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAClE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACzD,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 @@
|
|
|
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 @@
|
|
|
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;AAED,oCAAoC;AACpC,eAAO,MAAM,eAAe,qBAAe,CAAC"}
|
|
@@ -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"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Expose tools as an MCP server (stdio or Streamable HTTP). All invokes go through PTCRuntime.invoke(intent, ctx).
|
|
3
|
+
* Requires @modelcontextprotocol/sdk.
|
|
4
|
+
*/
|
|
5
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
6
|
+
import type { PTCRuntime } from "../../core/runtime/PTCRuntime.js";
|
|
7
|
+
import type { ExecContext } from "../../core/types/ToolIntent.js";
|
|
8
|
+
import type { CreateRuntimeOptions } from "../runtimeFromConfig.js";
|
|
9
|
+
export interface MCPServerOptions {
|
|
10
|
+
/** Server name (default: "agent-tool") */
|
|
11
|
+
name?: string;
|
|
12
|
+
/** Server version (default: "1.0.0") */
|
|
13
|
+
version?: string;
|
|
14
|
+
/** Build ExecContext for each tool call (default: minimal ctx) */
|
|
15
|
+
execContextFactory?: () => ExecContext;
|
|
16
|
+
}
|
|
17
|
+
export interface MCPServerResult {
|
|
18
|
+
/** The MCP server instance */
|
|
19
|
+
server: {
|
|
20
|
+
connect(transport: unknown): Promise<void>;
|
|
21
|
+
close?(): Promise<void>;
|
|
22
|
+
};
|
|
23
|
+
/** Call this to start listening on stdio (for in-process MCP service) */
|
|
24
|
+
connectStdio: () => Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
/** Request handler for Streamable HTTP: (req, res, parsedBody?) => Promise<void>. Use with Express app.post(path, handler) and express.json(). */
|
|
27
|
+
export type MCPStreamableHttpHandler = (req: IncomingMessage, res: ServerResponse, parsedBody?: unknown) => Promise<void>;
|
|
28
|
+
export interface MCPServerStreamableHttpResult {
|
|
29
|
+
/** Express app with POST /mcp (or path) wired to Streamable HTTP handler */
|
|
30
|
+
app: {
|
|
31
|
+
post: (path: string, handler: MCPStreamableHttpHandler) => void;
|
|
32
|
+
};
|
|
33
|
+
/** Path mounted (e.g. "/mcp") */
|
|
34
|
+
path: string;
|
|
35
|
+
/** Start HTTP server; returns when listening. Use createMCPStreamableHttpHandler + your own server if you prefer. */
|
|
36
|
+
listen: (port?: number, host?: string) => Promise<{
|
|
37
|
+
url: string;
|
|
38
|
+
port: number;
|
|
39
|
+
}>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Create an MCP server that serves all tools from the given PTCRuntime.
|
|
43
|
+
* Register tools with the server; then call connectStdio() to listen on stdio (for Cursor/Claude).
|
|
44
|
+
*/
|
|
45
|
+
export declare function createMCPServer(runtime: PTCRuntime, options?: MCPServerOptions): Promise<MCPServerResult>;
|
|
46
|
+
/**
|
|
47
|
+
* Create an MCP server from config (async: loads tools from projectPath when set).
|
|
48
|
+
*/
|
|
49
|
+
export declare function createMCPServer(config: CreateRuntimeOptions, options?: MCPServerOptions): Promise<MCPServerResult>;
|
|
50
|
+
/**
|
|
51
|
+
* Create a request handler for MCP Streamable HTTP (stateless). Use with Express: app.use(express.json()); app.post("/mcp", handler).
|
|
52
|
+
* Each request gets a new server and transport; supports SSE and direct HTTP responses per MCP Streamable HTTP spec.
|
|
53
|
+
*/
|
|
54
|
+
export declare function createMCPStreamableHttpHandler(runtime: PTCRuntime, options?: MCPServerOptions): MCPStreamableHttpHandler;
|
|
55
|
+
export declare function createMCPStreamableHttpHandler(config: CreateRuntimeOptions, options?: MCPServerOptions): Promise<MCPStreamableHttpHandler>;
|
|
56
|
+
export interface CreateMCPServerStreamableHttpOptions extends MCPServerOptions {
|
|
57
|
+
/** Path for MCP endpoint (default: "/mcp") */
|
|
58
|
+
path?: string;
|
|
59
|
+
/** Host to bind (default: "127.0.0.1") */
|
|
60
|
+
host?: string;
|
|
61
|
+
/** Port (default: 3000) */
|
|
62
|
+
port?: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Create an Express app with MCP Streamable HTTP handler mounted at path. Requires @modelcontextprotocol/sdk (which uses express).
|
|
66
|
+
* Returns app and listen(port?, host?) to start the HTTP server.
|
|
67
|
+
*/
|
|
68
|
+
export declare function createMCPServerStreamableHttp(runtime: PTCRuntime, options?: CreateMCPServerStreamableHttpOptions): Promise<MCPServerStreamableHttpResult>;
|
|
69
|
+
export declare function createMCPServerStreamableHttp(config: CreateRuntimeOptions, options?: CreateMCPServerStreamableHttpOptions): Promise<MCPServerStreamableHttpResult>;
|
|
70
|
+
/**
|
|
71
|
+
* Run MCP server over stdio using the given runtime.
|
|
72
|
+
* Call this when your process should act as an MCP server (e.g. for Cursor/Claude to connect).
|
|
73
|
+
*/
|
|
74
|
+
export declare function runMCPServerOverStdio(runtime: PTCRuntime, options?: MCPServerOptions): Promise<MCPServerResult>;
|
|
75
|
+
//# sourceMappingURL=mcpServer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcpServer.d.ts","sourceRoot":"","sources":["../../../src/api/expose/mcpServer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAIpE,MAAM,WAAW,gBAAgB;IAC/B,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kEAAkE;IAClE,kBAAkB,CAAC,EAAE,MAAM,WAAW,CAAC;CACxC;AAWD,MAAM,WAAW,eAAe;IAC9B,8BAA8B;IAC9B,MAAM,EAAE;QAAE,OAAO,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAAC,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;KAAE,CAAC;IAChF,yEAAyE;IACzE,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAED,kJAAkJ;AAClJ,MAAM,MAAM,wBAAwB,GAAG,CACrC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,UAAU,CAAC,EAAE,OAAO,KACjB,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,MAAM,WAAW,6BAA6B;IAC5C,4EAA4E;IAC5E,GAAG,EAAE;QAAE,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,wBAAwB,KAAK,IAAI,CAAA;KAAE,CAAC;IACzE,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,qHAAqH;IACrH,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClF;AAoDD;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,UAAU,EACnB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,eAAe,CAAC,CAAC;AAE5B;;GAEG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,oBAAoB,EAC5B,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,eAAe,CAAC,CAAC;AAuB5B;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,UAAU,EACnB,OAAO,CAAC,EAAE,gBAAgB,GACzB,wBAAwB,CAAC;AAE5B,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,oBAAoB,EAC5B,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAsCrC,MAAM,WAAW,oCAAqC,SAAQ,gBAAgB;IAC5E,8CAA8C;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,UAAU,EACnB,OAAO,CAAC,EAAE,oCAAoC,GAC7C,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAE1C,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,oBAAoB,EAC5B,OAAO,CAAC,EAAE,oCAAoC,GAC7C,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAqC1C;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,UAAU,EACnB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC,CAI1B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Expose tools as OpenAPI (Swagger) spec and optional HTTP server.
|
|
3
|
+
* Same tools can be used via LangChain, MCP, or REST.
|
|
4
|
+
*/
|
|
5
|
+
import type { ToolRegistry } from "../../core/registry/ToolRegistry.js";
|
|
6
|
+
export interface OpenAPISpecOptions {
|
|
7
|
+
/** API title (default: "Tool API") */
|
|
8
|
+
title?: string;
|
|
9
|
+
/** API version (default: "1.0.0") */
|
|
10
|
+
version?: string;
|
|
11
|
+
/** Base path for the API (default: "") */
|
|
12
|
+
basePath?: string;
|
|
13
|
+
}
|
|
14
|
+
/** Tool name to URL path segment: "core/fs.readText" -> "core~fs.readText" */
|
|
15
|
+
export declare function toolNameToSlug(name: string): string;
|
|
16
|
+
/** URL path segment back to tool name: "core~fs.readText" -> "core/fs.readText" */
|
|
17
|
+
export declare function slugToToolName(slug: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Build OpenAPI 3.0 document from the tool registry.
|
|
20
|
+
* GET /tools, POST /invoke (generic), and one POST /invoke/{toolSlug} per tool with that tool's input schema.
|
|
21
|
+
*/
|
|
22
|
+
export declare function toolsToOpenAPISpec(registry: ToolRegistry, options?: OpenAPISpecOptions): Record<string, unknown>;
|
|
23
|
+
//# sourceMappingURL=openapi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../../src/api/expose/openapi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAIxE,MAAM,WAAW,kBAAkB;IACjC,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,8EAA8E;AAC9E,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,mFAAmF;AACnF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAsBD;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,YAAY,EACtB,OAAO,GAAE,kBAAuB,GAC/B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA2HzB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP server that exposes tools via OpenAPI (Swagger): GET / (Swagger UI), GET /openapi.json, GET /tools, POST /invoke.
|
|
3
|
+
* All invokes go through PTCRuntime.invoke(intent, ctx). Uses Node's built-in http.
|
|
4
|
+
*/
|
|
5
|
+
import { type IncomingMessage } from "node:http";
|
|
6
|
+
import type { PTCRuntime } from "../../core/runtime/PTCRuntime.js";
|
|
7
|
+
import type { ExecContext } from "../../core/types/ToolIntent.js";
|
|
8
|
+
import type { CreateRuntimeOptions } from "../runtimeFromConfig.js";
|
|
9
|
+
export interface OpenAPIHttpServerOptions {
|
|
10
|
+
/** Port (default: 0 = let OS choose) */
|
|
11
|
+
port?: number;
|
|
12
|
+
/** Host (default: "localhost") */
|
|
13
|
+
host?: string;
|
|
14
|
+
/** Base path for routes (default: "") */
|
|
15
|
+
basePath?: string;
|
|
16
|
+
/** Build ExecContext for each request (default: minimal ctx) */
|
|
17
|
+
execContextFactory?: (req: IncomingMessage) => ExecContext;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Create an HTTP server that exposes tools via OpenAPI-style routes.
|
|
21
|
+
* - GET / or GET /swagger: Swagger UI (interactive docs)
|
|
22
|
+
* - GET /openapi.json (or basePath/openapi.json): OpenAPI 3.0 spec
|
|
23
|
+
* - GET /tools: list tools
|
|
24
|
+
* - POST /invoke: body { tool, args } -> { result } or { error }
|
|
25
|
+
*/
|
|
26
|
+
export declare function createOpenAPIHttpServer(runtime: PTCRuntime, options?: OpenAPIHttpServerOptions): import("node:http").Server;
|
|
27
|
+
/**
|
|
28
|
+
* Start the OpenAPI HTTP server on the given port/host.
|
|
29
|
+
* Call after createOpenAPIHttpServer if you did not pass port in options.
|
|
30
|
+
*/
|
|
31
|
+
export declare function listenOpenAPIHttpServer(server: import("node:http").Server, options?: {
|
|
32
|
+
port?: number;
|
|
33
|
+
host?: string;
|
|
34
|
+
}): Promise<{
|
|
35
|
+
port: number;
|
|
36
|
+
host: string;
|
|
37
|
+
}>;
|
|
38
|
+
export interface HttpServiceResult {
|
|
39
|
+
/** Node HTTP server (call .close() when done) */
|
|
40
|
+
server: import("node:http").Server;
|
|
41
|
+
/** OpenAPI 3.0 spec document (for Swagger UI etc.) */
|
|
42
|
+
openApiSpec: Record<string, unknown>;
|
|
43
|
+
/** Start listening; returns { port, host } */
|
|
44
|
+
listen: (options?: {
|
|
45
|
+
port?: number;
|
|
46
|
+
host?: string;
|
|
47
|
+
}) => Promise<{
|
|
48
|
+
port: number;
|
|
49
|
+
host: string;
|
|
50
|
+
}>;
|
|
51
|
+
}
|
|
52
|
+
export interface CreateHttpServiceOptions extends OpenAPIHttpServerOptions {
|
|
53
|
+
/** API title for OpenAPI spec (default: "Tool API") */
|
|
54
|
+
title?: string;
|
|
55
|
+
/** API version for OpenAPI spec (default: "1.0.0") */
|
|
56
|
+
version?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Create HTTP service that exposes tools via OpenAPI (Swagger).
|
|
60
|
+
* Returns server, OpenAPI spec, and a listen() helper.
|
|
61
|
+
*/
|
|
62
|
+
export declare function createHttpService(runtime: PTCRuntime, options?: CreateHttpServiceOptions): Promise<HttpServiceResult>;
|
|
63
|
+
/**
|
|
64
|
+
* Create HTTP service from config (async: loads tools from projectPath when set).
|
|
65
|
+
*/
|
|
66
|
+
export declare function createHttpService(config: CreateRuntimeOptions, options?: CreateHttpServiceOptions): Promise<HttpServiceResult>;
|
|
67
|
+
//# sourceMappingURL=openapiHttp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapiHttp.d.ts","sourceRoot":"","sources":["../../../src/api/expose/openapiHttp.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,KAAK,eAAe,EAAuB,MAAM,WAAW,CAAC;AACpF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAIpE,MAAM,WAAW,wBAAwB;IACvC,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gEAAgE;IAChE,kBAAkB,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,WAAW,CAAC;CAC5D;AAqED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,UAAU,EACnB,OAAO,GAAE,wBAA6B,GACrC,OAAO,WAAW,EAAE,MAAM,CAsG5B;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,OAAO,WAAW,EAAE,MAAM,EAClC,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7C,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAWzC;AAED,MAAM,WAAW,iBAAiB;IAChC,iDAAiD;IACjD,MAAM,EAAE,OAAO,WAAW,EAAE,MAAM,CAAC;IACnC,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,8CAA8C;IAC9C,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACjG;AAED,MAAM,WAAW,wBAAyB,SAAQ,wBAAwB;IACxE,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,UAAU,EACnB,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE9B;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,oBAAoB,EAC5B,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkKPKQ647P_cjs = require('../chunk-KPKQ647P.cjs');
|
|
4
|
+
var chunkYJSGSAS6_cjs = require('../chunk-YJSGSAS6.cjs');
|
|
5
|
+
var chunk4U266P4H_cjs = require('../chunk-4U266P4H.cjs');
|
|
6
|
+
require('../chunk-ZNJBRLKN.cjs');
|
|
7
|
+
require('../chunk-6F5JHLZ7.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
Object.defineProperty(exports, "createAgentTools", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkKPKQ647P_cjs.createAgentTools; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "createLangChainToolsAsync", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkKPKQ647P_cjs.createLangChainToolsAsync; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "createHttpService", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkYJSGSAS6_cjs.createHttpService; }
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, "createMCPServer", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return chunkYJSGSAS6_cjs.createMCPServer; }
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(exports, "createMCPServerStreamableHttp", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () { return chunkYJSGSAS6_cjs.createMCPServerStreamableHttp; }
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "createMCPStreamableHttpHandler", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () { return chunkYJSGSAS6_cjs.createMCPStreamableHttpHandler; }
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(exports, "createOpenAPIServer", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function () { return chunkYJSGSAS6_cjs.createHttpService; }
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports, "runMCPServerOverStdio", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () { return chunkYJSGSAS6_cjs.runMCPServerOverStdio; }
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "PTCRuntime", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () { return chunk4U266P4H_cjs.PTCRuntime; }
|
|
46
|
+
});
|
|
47
|
+
Object.defineProperty(exports, "createRuntimeFromConfig", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function () { return chunk4U266P4H_cjs.createRuntimeFromConfig; }
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(exports, "createRuntimeFromConfigSync", {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () { return chunk4U266P4H_cjs.createRuntimeFromConfigSync; }
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=main.cjs.map
|
|
56
|
+
//# sourceMappingURL=main.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"main.cjs"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public API: three create functions (config-driven) + runtime.
|
|
3
|
+
*
|
|
4
|
+
* 1. createLangChainTools(config?) → LangChain tools (createReactAgent / AgentExecutor)
|
|
5
|
+
* 2. createMCPServer(runtime | config, options?) → MCP server (stdio, Cursor / Claude)
|
|
6
|
+
* 3. createOpenAPIServer(runtime | config, options?) → HTTP + OpenAPI/Swagger (GET /tools, POST /invoke)
|
|
7
|
+
*
|
|
8
|
+
* All tool invokes go through PTC Intent (runtime.invoke(intent, ctx)) for policy, budget, observability.
|
|
9
|
+
* Use createRuntimeFromConfig(config) when you need the runtime for multiple servers.
|
|
10
|
+
*/
|
|
11
|
+
export { createAgentTools, createLangChainToolsAsync } from "./createAgentTools.js";
|
|
12
|
+
export type { CreateAgentToolsOptions } from "./createAgentTools.js";
|
|
13
|
+
export { createHttpService } from "./expose/openapiHttp.js";
|
|
14
|
+
export type { CreateHttpServiceOptions, HttpServiceResult, OpenAPIHttpServerOptions, } from "./expose/openapiHttp.js";
|
|
15
|
+
/** Alias: OpenAPI server with Swagger support */
|
|
16
|
+
export { createHttpService as createOpenAPIServer } from "./expose/openapiHttp.js";
|
|
17
|
+
export { createMCPServer, runMCPServerOverStdio, createMCPStreamableHttpHandler, createMCPServerStreamableHttp, } from "./expose/mcpServer.js";
|
|
18
|
+
export type { MCPServerOptions, MCPServerResult, MCPStreamableHttpHandler, MCPServerStreamableHttpResult, CreateMCPServerStreamableHttpOptions, } from "./expose/mcpServer.js";
|
|
19
|
+
export { createRuntimeFromConfig, createRuntimeFromConfigSync } from "./runtimeFromConfig.js";
|
|
20
|
+
export type { CreateRuntimeOptions, CreateRuntimeResult } from "./runtimeFromConfig.js";
|
|
21
|
+
export { PTCRuntime } from "../core/runtime/PTCRuntime.js";
|
|
22
|
+
export type { PTCRuntimeConfig } from "../core/runtime/PTCRuntime.js";
|
|
23
|
+
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/api/main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACpF,YAAY,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,YAAY,EACV,wBAAwB,EACxB,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AACjC,iDAAiD;AACjD,OAAO,EAAE,iBAAiB,IAAI,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnF,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,8BAA8B,EAC9B,6BAA6B,GAC9B,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EACxB,6BAA6B,EAC7B,oCAAoC,GACrC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAC9F,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAExF,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,YAAY,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC"}
|
package/dist/api/main.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createAgentTools, createLangChainToolsAsync } from '../chunk-7SGI5EGB.js';
|
|
2
|
+
export { createHttpService, createMCPServer, createMCPServerStreamableHttp, createMCPStreamableHttpHandler, createHttpService as createOpenAPIServer, runMCPServerOverStdio } from '../chunk-U55KMDXY.js';
|
|
3
|
+
export { PTCRuntime, createRuntimeFromConfig, createRuntimeFromConfigSync } from '../chunk-YMCAX4O6.js';
|
|
4
|
+
import '../chunk-AE6FSNGY.js';
|
|
5
|
+
import '../chunk-FR2CXERF.js';
|
|
6
|
+
//# sourceMappingURL=main.js.map
|
|
7
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"main.js"}
|