@cicctencent/agent-server 0.1.1
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 +235 -0
- package/dist/cjs/agent/agent-server.d.ts +6 -0
- package/dist/cjs/agent/agent-server.d.ts.map +1 -0
- package/dist/cjs/agent/agent-server.js +412 -0
- package/dist/cjs/agent/agent-server.js.map +1 -0
- package/dist/cjs/connectors/index.d.ts +13 -0
- package/dist/cjs/connectors/index.d.ts.map +1 -0
- package/dist/cjs/connectors/index.js +37 -0
- package/dist/cjs/connectors/index.js.map +1 -0
- package/dist/cjs/index.d.ts +56 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +169 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/kb/doc-parser.d.ts +24 -0
- package/dist/cjs/kb/doc-parser.d.ts.map +1 -0
- package/dist/cjs/kb/doc-parser.js +137 -0
- package/dist/cjs/kb/doc-parser.js.map +1 -0
- package/dist/cjs/kb/embedding-vector-index.d.ts +30 -0
- package/dist/cjs/kb/embedding-vector-index.d.ts.map +1 -0
- package/dist/cjs/kb/embedding-vector-index.js +75 -0
- package/dist/cjs/kb/embedding-vector-index.js.map +1 -0
- package/dist/cjs/kb/file-knowledge-base.d.ts +25 -0
- package/dist/cjs/kb/file-knowledge-base.d.ts.map +1 -0
- package/dist/cjs/kb/file-knowledge-base.js +200 -0
- package/dist/cjs/kb/file-knowledge-base.js.map +1 -0
- package/dist/cjs/mcp/api-bridge-client.d.ts +36 -0
- package/dist/cjs/mcp/api-bridge-client.d.ts.map +1 -0
- package/dist/cjs/mcp/api-bridge-client.js +143 -0
- package/dist/cjs/mcp/api-bridge-client.js.map +1 -0
- package/dist/cjs/mcp/api-bridge-types.d.ts +91 -0
- package/dist/cjs/mcp/api-bridge-types.d.ts.map +1 -0
- package/dist/cjs/mcp/api-bridge-types.js +8 -0
- package/dist/cjs/mcp/api-bridge-types.js.map +1 -0
- package/dist/cjs/mcp/body-template.d.ts +16 -0
- package/dist/cjs/mcp/body-template.d.ts.map +1 -0
- package/dist/cjs/mcp/body-template.js +62 -0
- package/dist/cjs/mcp/body-template.js.map +1 -0
- package/dist/cjs/mcp/openapi-importer.d.ts +24 -0
- package/dist/cjs/mcp/openapi-importer.d.ts.map +1 -0
- package/dist/cjs/mcp/openapi-importer.js +183 -0
- package/dist/cjs/mcp/openapi-importer.js.map +1 -0
- package/dist/cjs/mcp/template-builder.d.ts +53 -0
- package/dist/cjs/mcp/template-builder.d.ts.map +1 -0
- package/dist/cjs/mcp/template-builder.js +177 -0
- package/dist/cjs/mcp/template-builder.js.map +1 -0
- package/dist/cjs/model/automation.d.ts +34 -0
- package/dist/cjs/model/automation.d.ts.map +1 -0
- package/dist/cjs/model/automation.js +6 -0
- package/dist/cjs/model/automation.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/prompt/prompt-builder.d.ts +14 -0
- package/dist/cjs/prompt/prompt-builder.d.ts.map +1 -0
- package/dist/cjs/prompt/prompt-builder.js +113 -0
- package/dist/cjs/prompt/prompt-builder.js.map +1 -0
- package/dist/cjs/sandbox/local-sandbox.d.ts +70 -0
- package/dist/cjs/sandbox/local-sandbox.d.ts.map +1 -0
- package/dist/cjs/sandbox/local-sandbox.js +442 -0
- package/dist/cjs/sandbox/local-sandbox.js.map +1 -0
- package/dist/cjs/sandbox/process-code-sandbox.d.ts +25 -0
- package/dist/cjs/sandbox/process-code-sandbox.d.ts.map +1 -0
- package/dist/cjs/sandbox/process-code-sandbox.js +113 -0
- package/dist/cjs/sandbox/process-code-sandbox.js.map +1 -0
- package/dist/cjs/sandbox/sandbox-manager.d.ts +47 -0
- package/dist/cjs/sandbox/sandbox-manager.d.ts.map +1 -0
- package/dist/cjs/sandbox/sandbox-manager.js +126 -0
- package/dist/cjs/sandbox/sandbox-manager.js.map +1 -0
- package/dist/cjs/service/agent-profile.service.d.ts +27 -0
- package/dist/cjs/service/agent-profile.service.d.ts.map +1 -0
- package/dist/cjs/service/agent-profile.service.js +143 -0
- package/dist/cjs/service/agent-profile.service.js.map +1 -0
- package/dist/cjs/service/artifact.service.d.ts +33 -0
- package/dist/cjs/service/artifact.service.d.ts.map +1 -0
- package/dist/cjs/service/artifact.service.js +214 -0
- package/dist/cjs/service/artifact.service.js.map +1 -0
- package/dist/cjs/service/audit.service.d.ts +30 -0
- package/dist/cjs/service/audit.service.d.ts.map +1 -0
- package/dist/cjs/service/audit.service.js +169 -0
- package/dist/cjs/service/audit.service.js.map +1 -0
- package/dist/cjs/service/chat.service.d.ts +90 -0
- package/dist/cjs/service/chat.service.d.ts.map +1 -0
- package/dist/cjs/service/chat.service.js +433 -0
- package/dist/cjs/service/chat.service.js.map +1 -0
- package/dist/cjs/service/engine-pool.d.ts +6 -0
- package/dist/cjs/service/engine-pool.d.ts.map +1 -0
- package/dist/cjs/service/engine-pool.js +24 -0
- package/dist/cjs/service/engine-pool.js.map +1 -0
- package/dist/cjs/service/memory.service.d.ts +45 -0
- package/dist/cjs/service/memory.service.d.ts.map +1 -0
- package/dist/cjs/service/memory.service.js +193 -0
- package/dist/cjs/service/memory.service.js.map +1 -0
- package/dist/cjs/service/observability.service.d.ts +3 -0
- package/dist/cjs/service/observability.service.d.ts.map +1 -0
- package/dist/cjs/service/observability.service.js +10 -0
- package/dist/cjs/service/observability.service.js.map +1 -0
- package/dist/cjs/service/permission.service.d.ts +5 -0
- package/dist/cjs/service/permission.service.d.ts.map +1 -0
- package/dist/cjs/service/permission.service.js +40 -0
- package/dist/cjs/service/permission.service.js.map +1 -0
- package/dist/cjs/service/run-registry.d.ts +7 -0
- package/dist/cjs/service/run-registry.d.ts.map +1 -0
- package/dist/cjs/service/run-registry.js +44 -0
- package/dist/cjs/service/run-registry.js.map +1 -0
- package/dist/cjs/service/safety-audit.middleware.d.ts +3 -0
- package/dist/cjs/service/safety-audit.middleware.d.ts.map +1 -0
- package/dist/cjs/service/safety-audit.middleware.js +115 -0
- package/dist/cjs/service/safety-audit.middleware.js.map +1 -0
- package/dist/cjs/service/security-policy.service.d.ts +18 -0
- package/dist/cjs/service/security-policy.service.d.ts.map +1 -0
- package/dist/cjs/service/security-policy.service.js +46 -0
- package/dist/cjs/service/security-policy.service.js.map +1 -0
- package/dist/cjs/service/settings.service.d.ts +18 -0
- package/dist/cjs/service/settings.service.d.ts.map +1 -0
- package/dist/cjs/service/settings.service.js +222 -0
- package/dist/cjs/service/settings.service.js.map +1 -0
- package/dist/cjs/service/tool-risk.service.d.ts +3 -0
- package/dist/cjs/service/tool-risk.service.d.ts.map +1 -0
- package/dist/cjs/service/tool-risk.service.js +23 -0
- package/dist/cjs/service/tool-risk.service.js.map +1 -0
- package/dist/cjs/service/workspace.service.d.ts +33 -0
- package/dist/cjs/service/workspace.service.d.ts.map +1 -0
- package/dist/cjs/service/workspace.service.js +107 -0
- package/dist/cjs/service/workspace.service.js.map +1 -0
- package/dist/cjs/sse/sse-handler.d.ts +15 -0
- package/dist/cjs/sse/sse-handler.d.ts.map +1 -0
- package/dist/cjs/sse/sse-handler.js +56 -0
- package/dist/cjs/sse/sse-handler.js.map +1 -0
- package/dist/cjs/store/app-stores.d.ts +42 -0
- package/dist/cjs/store/app-stores.d.ts.map +1 -0
- package/dist/cjs/store/app-stores.js +226 -0
- package/dist/cjs/store/app-stores.js.map +1 -0
- package/dist/cjs/store/index.d.ts +3 -0
- package/dist/cjs/store/index.d.ts.map +1 -0
- package/dist/cjs/store/index.js +10 -0
- package/dist/cjs/store/index.js.map +1 -0
- package/dist/cjs/store/mcp-server-store.d.ts +35 -0
- package/dist/cjs/store/mcp-server-store.d.ts.map +1 -0
- package/dist/cjs/store/mcp-server-store.js +288 -0
- package/dist/cjs/store/mcp-server-store.js.map +1 -0
- package/dist/cjs/tool/builtin.d.ts +18 -0
- package/dist/cjs/tool/builtin.d.ts.map +1 -0
- package/dist/cjs/tool/builtin.js +43 -0
- package/dist/cjs/tool/builtin.js.map +1 -0
- package/dist/cjs/tool/local-executors.d.ts +22 -0
- package/dist/cjs/tool/local-executors.d.ts.map +1 -0
- package/dist/cjs/tool/local-executors.js +126 -0
- package/dist/cjs/tool/local-executors.js.map +1 -0
- package/dist/cjs/tool/tools/automation.d.ts +3 -0
- package/dist/cjs/tool/tools/automation.d.ts.map +1 -0
- package/dist/cjs/tool/tools/automation.js +190 -0
- package/dist/cjs/tool/tools/automation.js.map +1 -0
- package/dist/cjs/tool/tools/communication.d.ts +3 -0
- package/dist/cjs/tool/tools/communication.d.ts.map +1 -0
- package/dist/cjs/tool/tools/communication.js +302 -0
- package/dist/cjs/tool/tools/communication.js.map +1 -0
- package/dist/cjs/tool/tools/discovery.d.ts +3 -0
- package/dist/cjs/tool/tools/discovery.d.ts.map +1 -0
- package/dist/cjs/tool/tools/discovery.js +248 -0
- package/dist/cjs/tool/tools/discovery.js.map +1 -0
- package/dist/cjs/tool/tools/filesystem.d.ts +3 -0
- package/dist/cjs/tool/tools/filesystem.d.ts.map +1 -0
- package/dist/cjs/tool/tools/filesystem.js +403 -0
- package/dist/cjs/tool/tools/filesystem.js.map +1 -0
- package/dist/cjs/tool/tools/git.d.ts +3 -0
- package/dist/cjs/tool/tools/git.d.ts.map +1 -0
- package/dist/cjs/tool/tools/git.js +224 -0
- package/dist/cjs/tool/tools/git.js.map +1 -0
- package/dist/cjs/tool/tools/memory.d.ts +3 -0
- package/dist/cjs/tool/tools/memory.d.ts.map +1 -0
- package/dist/cjs/tool/tools/memory.js +126 -0
- package/dist/cjs/tool/tools/memory.js.map +1 -0
- package/dist/cjs/tool/tools/sandbox.d.ts +3 -0
- package/dist/cjs/tool/tools/sandbox.d.ts.map +1 -0
- package/dist/cjs/tool/tools/sandbox.js +413 -0
- package/dist/cjs/tool/tools/sandbox.js.map +1 -0
- package/dist/cjs/tool/tools/web-utils.d.ts +16 -0
- package/dist/cjs/tool/tools/web-utils.d.ts.map +1 -0
- package/dist/cjs/tool/tools/web-utils.js +131 -0
- package/dist/cjs/tool/tools/web-utils.js.map +1 -0
- package/dist/cjs/tool/tools/web.d.ts +3 -0
- package/dist/cjs/tool/tools/web.d.ts.map +1 -0
- package/dist/cjs/tool/tools/web.js +358 -0
- package/dist/cjs/tool/tools/web.js.map +1 -0
- package/dist/cjs/types.d.ts +523 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +6 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/utils/data-dir.d.ts +8 -0
- package/dist/cjs/utils/data-dir.d.ts.map +1 -0
- package/dist/cjs/utils/data-dir.js +92 -0
- package/dist/cjs/utils/data-dir.js.map +1 -0
- package/dist/esm/agent/agent-server.d.ts +6 -0
- package/dist/esm/agent/agent-server.d.ts.map +1 -0
- package/dist/esm/agent/agent-server.js +409 -0
- package/dist/esm/agent/agent-server.js.map +1 -0
- package/dist/esm/connectors/index.d.ts +13 -0
- package/dist/esm/connectors/index.d.ts.map +1 -0
- package/dist/esm/connectors/index.js +30 -0
- package/dist/esm/connectors/index.js.map +1 -0
- package/dist/esm/index.d.ts +56 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +57 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/kb/doc-parser.d.ts +24 -0
- package/dist/esm/kb/doc-parser.d.ts.map +1 -0
- package/dist/esm/kb/doc-parser.js +100 -0
- package/dist/esm/kb/doc-parser.js.map +1 -0
- package/dist/esm/kb/embedding-vector-index.d.ts +30 -0
- package/dist/esm/kb/embedding-vector-index.d.ts.map +1 -0
- package/dist/esm/kb/embedding-vector-index.js +71 -0
- package/dist/esm/kb/embedding-vector-index.js.map +1 -0
- package/dist/esm/kb/file-knowledge-base.d.ts +25 -0
- package/dist/esm/kb/file-knowledge-base.d.ts.map +1 -0
- package/dist/esm/kb/file-knowledge-base.js +163 -0
- package/dist/esm/kb/file-knowledge-base.js.map +1 -0
- package/dist/esm/mcp/api-bridge-client.d.ts +36 -0
- package/dist/esm/mcp/api-bridge-client.d.ts.map +1 -0
- package/dist/esm/mcp/api-bridge-client.js +139 -0
- package/dist/esm/mcp/api-bridge-client.js.map +1 -0
- package/dist/esm/mcp/api-bridge-types.d.ts +91 -0
- package/dist/esm/mcp/api-bridge-types.d.ts.map +1 -0
- package/dist/esm/mcp/api-bridge-types.js +7 -0
- package/dist/esm/mcp/api-bridge-types.js.map +1 -0
- package/dist/esm/mcp/body-template.d.ts +16 -0
- package/dist/esm/mcp/body-template.d.ts.map +1 -0
- package/dist/esm/mcp/body-template.js +59 -0
- package/dist/esm/mcp/body-template.js.map +1 -0
- package/dist/esm/mcp/openapi-importer.d.ts +24 -0
- package/dist/esm/mcp/openapi-importer.d.ts.map +1 -0
- package/dist/esm/mcp/openapi-importer.js +177 -0
- package/dist/esm/mcp/openapi-importer.js.map +1 -0
- package/dist/esm/mcp/template-builder.d.ts +53 -0
- package/dist/esm/mcp/template-builder.d.ts.map +1 -0
- package/dist/esm/mcp/template-builder.js +173 -0
- package/dist/esm/mcp/template-builder.js.map +1 -0
- package/dist/esm/model/automation.d.ts +34 -0
- package/dist/esm/model/automation.d.ts.map +1 -0
- package/dist/esm/model/automation.js +5 -0
- package/dist/esm/model/automation.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/prompt/prompt-builder.d.ts +14 -0
- package/dist/esm/prompt/prompt-builder.d.ts.map +1 -0
- package/dist/esm/prompt/prompt-builder.js +109 -0
- package/dist/esm/prompt/prompt-builder.js.map +1 -0
- package/dist/esm/sandbox/local-sandbox.d.ts +70 -0
- package/dist/esm/sandbox/local-sandbox.d.ts.map +1 -0
- package/dist/esm/sandbox/local-sandbox.js +403 -0
- package/dist/esm/sandbox/local-sandbox.js.map +1 -0
- package/dist/esm/sandbox/process-code-sandbox.d.ts +25 -0
- package/dist/esm/sandbox/process-code-sandbox.d.ts.map +1 -0
- package/dist/esm/sandbox/process-code-sandbox.js +76 -0
- package/dist/esm/sandbox/process-code-sandbox.js.map +1 -0
- package/dist/esm/sandbox/sandbox-manager.d.ts +47 -0
- package/dist/esm/sandbox/sandbox-manager.d.ts.map +1 -0
- package/dist/esm/sandbox/sandbox-manager.js +88 -0
- package/dist/esm/sandbox/sandbox-manager.js.map +1 -0
- package/dist/esm/service/agent-profile.service.d.ts +27 -0
- package/dist/esm/service/agent-profile.service.d.ts.map +1 -0
- package/dist/esm/service/agent-profile.service.js +130 -0
- package/dist/esm/service/agent-profile.service.js.map +1 -0
- package/dist/esm/service/artifact.service.d.ts +33 -0
- package/dist/esm/service/artifact.service.d.ts.map +1 -0
- package/dist/esm/service/artifact.service.js +175 -0
- package/dist/esm/service/artifact.service.js.map +1 -0
- package/dist/esm/service/audit.service.d.ts +30 -0
- package/dist/esm/service/audit.service.d.ts.map +1 -0
- package/dist/esm/service/audit.service.js +131 -0
- package/dist/esm/service/audit.service.js.map +1 -0
- package/dist/esm/service/chat.service.d.ts +90 -0
- package/dist/esm/service/chat.service.d.ts.map +1 -0
- package/dist/esm/service/chat.service.js +388 -0
- package/dist/esm/service/chat.service.js.map +1 -0
- package/dist/esm/service/engine-pool.d.ts +6 -0
- package/dist/esm/service/engine-pool.d.ts.map +1 -0
- package/dist/esm/service/engine-pool.js +18 -0
- package/dist/esm/service/engine-pool.js.map +1 -0
- package/dist/esm/service/memory.service.d.ts +45 -0
- package/dist/esm/service/memory.service.d.ts.map +1 -0
- package/dist/esm/service/memory.service.js +154 -0
- package/dist/esm/service/memory.service.js.map +1 -0
- package/dist/esm/service/observability.service.d.ts +3 -0
- package/dist/esm/service/observability.service.d.ts.map +1 -0
- package/dist/esm/service/observability.service.js +5 -0
- package/dist/esm/service/observability.service.js.map +1 -0
- package/dist/esm/service/permission.service.d.ts +5 -0
- package/dist/esm/service/permission.service.d.ts.map +1 -0
- package/dist/esm/service/permission.service.js +33 -0
- package/dist/esm/service/permission.service.js.map +1 -0
- package/dist/esm/service/run-registry.d.ts +7 -0
- package/dist/esm/service/run-registry.d.ts.map +1 -0
- package/dist/esm/service/run-registry.js +37 -0
- package/dist/esm/service/run-registry.js.map +1 -0
- package/dist/esm/service/safety-audit.middleware.d.ts +3 -0
- package/dist/esm/service/safety-audit.middleware.d.ts.map +1 -0
- package/dist/esm/service/safety-audit.middleware.js +112 -0
- package/dist/esm/service/safety-audit.middleware.js.map +1 -0
- package/dist/esm/service/security-policy.service.d.ts +18 -0
- package/dist/esm/service/security-policy.service.d.ts.map +1 -0
- package/dist/esm/service/security-policy.service.js +42 -0
- package/dist/esm/service/security-policy.service.js.map +1 -0
- package/dist/esm/service/settings.service.d.ts +18 -0
- package/dist/esm/service/settings.service.d.ts.map +1 -0
- package/dist/esm/service/settings.service.js +181 -0
- package/dist/esm/service/settings.service.js.map +1 -0
- package/dist/esm/service/tool-risk.service.d.ts +3 -0
- package/dist/esm/service/tool-risk.service.d.ts.map +1 -0
- package/dist/esm/service/tool-risk.service.js +17 -0
- package/dist/esm/service/tool-risk.service.js.map +1 -0
- package/dist/esm/service/workspace.service.d.ts +33 -0
- package/dist/esm/service/workspace.service.d.ts.map +1 -0
- package/dist/esm/service/workspace.service.js +97 -0
- package/dist/esm/service/workspace.service.js.map +1 -0
- package/dist/esm/sse/sse-handler.d.ts +15 -0
- package/dist/esm/sse/sse-handler.d.ts.map +1 -0
- package/dist/esm/sse/sse-handler.js +49 -0
- package/dist/esm/sse/sse-handler.js.map +1 -0
- package/dist/esm/store/app-stores.d.ts +42 -0
- package/dist/esm/store/app-stores.d.ts.map +1 -0
- package/dist/esm/store/app-stores.js +181 -0
- package/dist/esm/store/app-stores.js.map +1 -0
- package/dist/esm/store/index.d.ts +3 -0
- package/dist/esm/store/index.d.ts.map +1 -0
- package/dist/esm/store/index.js +5 -0
- package/dist/esm/store/index.js.map +1 -0
- package/dist/esm/store/mcp-server-store.d.ts +35 -0
- package/dist/esm/store/mcp-server-store.d.ts.map +1 -0
- package/dist/esm/store/mcp-server-store.js +251 -0
- package/dist/esm/store/mcp-server-store.js.map +1 -0
- package/dist/esm/tool/builtin.d.ts +18 -0
- package/dist/esm/tool/builtin.d.ts.map +1 -0
- package/dist/esm/tool/builtin.js +40 -0
- package/dist/esm/tool/builtin.js.map +1 -0
- package/dist/esm/tool/local-executors.d.ts +22 -0
- package/dist/esm/tool/local-executors.d.ts.map +1 -0
- package/dist/esm/tool/local-executors.js +88 -0
- package/dist/esm/tool/local-executors.js.map +1 -0
- package/dist/esm/tool/tools/automation.d.ts +3 -0
- package/dist/esm/tool/tools/automation.d.ts.map +1 -0
- package/dist/esm/tool/tools/automation.js +154 -0
- package/dist/esm/tool/tools/automation.js.map +1 -0
- package/dist/esm/tool/tools/communication.d.ts +3 -0
- package/dist/esm/tool/tools/communication.d.ts.map +1 -0
- package/dist/esm/tool/tools/communication.js +266 -0
- package/dist/esm/tool/tools/communication.js.map +1 -0
- package/dist/esm/tool/tools/discovery.d.ts +3 -0
- package/dist/esm/tool/tools/discovery.d.ts.map +1 -0
- package/dist/esm/tool/tools/discovery.js +245 -0
- package/dist/esm/tool/tools/discovery.js.map +1 -0
- package/dist/esm/tool/tools/filesystem.d.ts +3 -0
- package/dist/esm/tool/tools/filesystem.d.ts.map +1 -0
- package/dist/esm/tool/tools/filesystem.js +367 -0
- package/dist/esm/tool/tools/filesystem.js.map +1 -0
- package/dist/esm/tool/tools/git.d.ts +3 -0
- package/dist/esm/tool/tools/git.d.ts.map +1 -0
- package/dist/esm/tool/tools/git.js +188 -0
- package/dist/esm/tool/tools/git.js.map +1 -0
- package/dist/esm/tool/tools/memory.d.ts +3 -0
- package/dist/esm/tool/tools/memory.d.ts.map +1 -0
- package/dist/esm/tool/tools/memory.js +123 -0
- package/dist/esm/tool/tools/memory.js.map +1 -0
- package/dist/esm/tool/tools/sandbox.d.ts +3 -0
- package/dist/esm/tool/tools/sandbox.d.ts.map +1 -0
- package/dist/esm/tool/tools/sandbox.js +377 -0
- package/dist/esm/tool/tools/sandbox.js.map +1 -0
- package/dist/esm/tool/tools/web-utils.d.ts +16 -0
- package/dist/esm/tool/tools/web-utils.d.ts.map +1 -0
- package/dist/esm/tool/tools/web-utils.js +88 -0
- package/dist/esm/tool/tools/web-utils.js.map +1 -0
- package/dist/esm/tool/tools/web.d.ts +3 -0
- package/dist/esm/tool/tools/web.d.ts.map +1 -0
- package/dist/esm/tool/tools/web.js +319 -0
- package/dist/esm/tool/tools/web.js.map +1 -0
- package/dist/esm/types.d.ts +523 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +5 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/utils/data-dir.d.ts +8 -0
- package/dist/esm/utils/data-dir.d.ts.map +1 -0
- package/dist/esm/utils/data-dir.js +48 -0
- package/dist/esm/utils/data-dir.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// 工具发现与元数据工具
|
|
3
|
+
// ============================================================
|
|
4
|
+
import { inlineMarkdownRefs } from "./web-utils.js";
|
|
5
|
+
export function createDiscoveryTools() {
|
|
6
|
+
return [
|
|
7
|
+
// ---- read_tool_doc ----
|
|
8
|
+
// 渐进式工具发现:读取工具的完整 schema 文档
|
|
9
|
+
{
|
|
10
|
+
definition: {
|
|
11
|
+
type: 'function',
|
|
12
|
+
function: {
|
|
13
|
+
name: 'read_tool_doc',
|
|
14
|
+
description: 'Read the full schema and documentation of a tool. ' +
|
|
15
|
+
'Use this before calling MCP tools when running in summary discovery mode. ' +
|
|
16
|
+
'Use tool_name="list" to see all available tool names.',
|
|
17
|
+
parameters: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
tool_name: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'The name of the tool to read documentation for',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
required: ['tool_name'],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
executor: async (args, ctx) => {
|
|
30
|
+
const toolName = args.tool_name;
|
|
31
|
+
if (!toolName)
|
|
32
|
+
return 'Error: tool_name is required';
|
|
33
|
+
// 从 custom 中获取 ToolRegistry 引用(由 agent.service 注入)
|
|
34
|
+
const registry = ctx.custom?.toolRegistry;
|
|
35
|
+
if (!registry)
|
|
36
|
+
return 'Error: ToolRegistry not available in context';
|
|
37
|
+
// 特殊命令:列出所有可用工具
|
|
38
|
+
if (toolName === 'list' || toolName === '*' || toolName === 'mcp_*') {
|
|
39
|
+
const allNames = registry.listNames();
|
|
40
|
+
const mcpNames = allNames.filter(n => {
|
|
41
|
+
const t = registry.get(n);
|
|
42
|
+
return t?.category === 'mcp';
|
|
43
|
+
});
|
|
44
|
+
const builtinNames = allNames.filter(n => {
|
|
45
|
+
const t = registry.get(n);
|
|
46
|
+
return t?.category !== 'mcp';
|
|
47
|
+
});
|
|
48
|
+
const lines = ['Available tools:'];
|
|
49
|
+
if (mcpNames.length > 0)
|
|
50
|
+
lines.push(`\nMCP tools:\n${mcpNames.map(n => `- ${n}`).join('\n')}`);
|
|
51
|
+
if (builtinNames.length > 0)
|
|
52
|
+
lines.push(`\nBuiltin tools:\n${builtinNames.map(n => `- ${n}`).join('\n')}`);
|
|
53
|
+
return lines.join('\n');
|
|
54
|
+
}
|
|
55
|
+
const tool = registry.get(toolName);
|
|
56
|
+
if (!tool) {
|
|
57
|
+
// 模糊匹配建议:支持按原始工具名、服务器名、连接器名模糊搜索
|
|
58
|
+
const allNames = registry.listNames();
|
|
59
|
+
const lowerQuery = toolName.toLowerCase();
|
|
60
|
+
const suggestions = allNames.filter(n => {
|
|
61
|
+
if (n.toLowerCase().includes(lowerQuery))
|
|
62
|
+
return true;
|
|
63
|
+
const t = registry.get(n);
|
|
64
|
+
const origName = (t?.metadata?.originalName || '').toLowerCase();
|
|
65
|
+
const serverName = (t?.metadata?.mcpServer || '').toLowerCase();
|
|
66
|
+
return origName.includes(lowerQuery) || serverName.includes(lowerQuery);
|
|
67
|
+
});
|
|
68
|
+
const suggestionText = suggestions.length > 0
|
|
69
|
+
? `\n\nDid you mean one of: ${suggestions.join(', ')}`
|
|
70
|
+
: `\n\nAvailable tools: ${allNames.join(', ')}`;
|
|
71
|
+
return `Error: Tool "${toolName}" not found.${suggestionText}\n\nTip: Use read_tool_doc(tool_name="list") to see all available tools.`;
|
|
72
|
+
}
|
|
73
|
+
return JSON.stringify(tool.definition, null, 2);
|
|
74
|
+
},
|
|
75
|
+
category: 'builtin',
|
|
76
|
+
concurrent: true,
|
|
77
|
+
},
|
|
78
|
+
// ---- load_skill ----
|
|
79
|
+
// 按需加载 Skill 全量内容(懒加载),或列出所有可用 Skill
|
|
80
|
+
{
|
|
81
|
+
definition: {
|
|
82
|
+
type: 'function',
|
|
83
|
+
function: {
|
|
84
|
+
name: 'load_skill',
|
|
85
|
+
description: 'Load the full content of a skill by its ID (lazy-load on demand). ' +
|
|
86
|
+
'Use this when you need detailed skill instructions, templates, or referenced sub-skills. ' +
|
|
87
|
+
'Use skill_id="list" to see all available skill IDs and descriptions.',
|
|
88
|
+
parameters: {
|
|
89
|
+
type: 'object',
|
|
90
|
+
properties: {
|
|
91
|
+
skill_id: {
|
|
92
|
+
type: 'string',
|
|
93
|
+
description: 'The ID of the skill to load, or "list" to see all available skills',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
required: ['skill_id'],
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
executor: async (args, ctx) => {
|
|
101
|
+
const skillId = args.skill_id;
|
|
102
|
+
if (!skillId)
|
|
103
|
+
return 'Error: skill_id is required';
|
|
104
|
+
const sm = ctx.custom?.skillManager;
|
|
105
|
+
if (!sm)
|
|
106
|
+
return 'Error: SkillManager not available in context';
|
|
107
|
+
// 特殊命令:列出所有可用 Skill
|
|
108
|
+
if (skillId === 'list' || skillId === '*') {
|
|
109
|
+
const manifests = sm.getAllManifests();
|
|
110
|
+
if (manifests.length === 0)
|
|
111
|
+
return 'No skills available.';
|
|
112
|
+
const lines = manifests.map(m => {
|
|
113
|
+
const size = m.contentSize ? ` (${m.contentSize} chars)` : '';
|
|
114
|
+
const refs = m.referencedSkills?.length ? ` [refs: ${m.referencedSkills.join(', ')}]` : '';
|
|
115
|
+
return `- **${m.id}**: ${m.name} — ${m.description || '(no description)'}${size}${refs}`;
|
|
116
|
+
});
|
|
117
|
+
return `Available skills (${manifests.length}):\n${lines.join('\n')}\n\nUse load_skill(skill_id="<id>") to load full content.`;
|
|
118
|
+
}
|
|
119
|
+
// 加载指定 Skill 全量内容(触发懒加载 + 自动加载引用)
|
|
120
|
+
const skill = sm.get(skillId);
|
|
121
|
+
if (!skill) {
|
|
122
|
+
// 模糊匹配建议
|
|
123
|
+
const all = sm.getAllManifests();
|
|
124
|
+
const lower = skillId.toLowerCase();
|
|
125
|
+
const suggestions = all.filter(m => m.id.toLowerCase().includes(lower) ||
|
|
126
|
+
m.name.toLowerCase().includes(lower));
|
|
127
|
+
const suggestionText = suggestions.length > 0
|
|
128
|
+
? `\n\nDid you mean: ${suggestions.map(s => s.id).join(', ')}`
|
|
129
|
+
: `\n\nUse load_skill(skill_id="list") to see all available skills.`;
|
|
130
|
+
return `Skill "${skillId}" not found.${suggestionText}`;
|
|
131
|
+
}
|
|
132
|
+
if (!skill.content) {
|
|
133
|
+
return `Skill "${skillId}" found but has no content (manifest only).`;
|
|
134
|
+
}
|
|
135
|
+
// 返回 Skill 全量内容,自动内联引用的子文档
|
|
136
|
+
let content = skill.content;
|
|
137
|
+
if (skill.filePath) {
|
|
138
|
+
content = inlineMarkdownRefs(content, skill.filePath);
|
|
139
|
+
}
|
|
140
|
+
const header = `# ${skill.name || skill.id}\nDescription: ${skill.description || '(none)'}\nTags: [${skill.tags.join(', ')}]\n${skill.referencedSkills?.length ? `Referenced skills: [${skill.referencedSkills.join(', ')}]\n` : ''}`;
|
|
141
|
+
return `${header}\n---\n\n${content}`;
|
|
142
|
+
},
|
|
143
|
+
category: 'builtin',
|
|
144
|
+
concurrent: true,
|
|
145
|
+
},
|
|
146
|
+
// ---- read_tool_result ----
|
|
147
|
+
// 读取被文件化的完整工具结果
|
|
148
|
+
{
|
|
149
|
+
definition: {
|
|
150
|
+
type: 'function',
|
|
151
|
+
function: {
|
|
152
|
+
name: 'read_tool_result',
|
|
153
|
+
description: 'Read the full content of a tool result that was too large to include inline. ' +
|
|
154
|
+
'Use the call_id from the truncated result message.',
|
|
155
|
+
parameters: {
|
|
156
|
+
type: 'object',
|
|
157
|
+
properties: {
|
|
158
|
+
call_id: {
|
|
159
|
+
type: 'string',
|
|
160
|
+
description: 'The call_id of the tool result to read',
|
|
161
|
+
},
|
|
162
|
+
offset: {
|
|
163
|
+
type: 'number',
|
|
164
|
+
description: 'Start reading from this character offset (for pagination)',
|
|
165
|
+
},
|
|
166
|
+
length: {
|
|
167
|
+
type: 'number',
|
|
168
|
+
description: 'Maximum characters to return, default 10000',
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
required: ['call_id'],
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
executor: async (args, ctx) => {
|
|
176
|
+
const callId = args.call_id;
|
|
177
|
+
const offset = args.offset || 0;
|
|
178
|
+
const length = args.length || 10000;
|
|
179
|
+
if (!callId)
|
|
180
|
+
return 'Error: call_id is required';
|
|
181
|
+
// 从 custom 中获取 ToolResultStore 引用
|
|
182
|
+
const store = ctx.custom?.toolResultStore;
|
|
183
|
+
if (!store)
|
|
184
|
+
return 'Error: ToolResultStore not available in context';
|
|
185
|
+
if (!store.has(callId)) {
|
|
186
|
+
return `Error: No saved result for call_id "${callId}". The result may have expired or was not large enough to be saved.`;
|
|
187
|
+
}
|
|
188
|
+
const content = store.read(callId);
|
|
189
|
+
if (!content)
|
|
190
|
+
return 'Error: Failed to read tool result';
|
|
191
|
+
// 支持分页读取
|
|
192
|
+
const slice = content.slice(offset, offset + length);
|
|
193
|
+
const hasMore = offset + length < content.length;
|
|
194
|
+
let result = slice;
|
|
195
|
+
if (hasMore) {
|
|
196
|
+
result += `\n\n... [showing ${offset}-${offset + length} of ${content.length} chars. Use offset=${offset + length} to read more]`;
|
|
197
|
+
}
|
|
198
|
+
else if (offset > 0) {
|
|
199
|
+
result += `\n\n[end of result, total ${content.length} chars]`;
|
|
200
|
+
}
|
|
201
|
+
return result;
|
|
202
|
+
},
|
|
203
|
+
category: 'builtin',
|
|
204
|
+
concurrent: true,
|
|
205
|
+
},
|
|
206
|
+
// ---- read_offload ----
|
|
207
|
+
// 读取被卸载到 OffloadStore 的工具结果原文
|
|
208
|
+
{
|
|
209
|
+
definition: {
|
|
210
|
+
type: 'function',
|
|
211
|
+
function: {
|
|
212
|
+
name: 'read_offload',
|
|
213
|
+
description: 'Read the full content of an offloaded tool result by its node_id. ' +
|
|
214
|
+
'Use this when you see [offload:node_id] tags in conversation history and need the original content.',
|
|
215
|
+
parameters: {
|
|
216
|
+
type: 'object',
|
|
217
|
+
properties: {
|
|
218
|
+
node_id: {
|
|
219
|
+
type: 'string',
|
|
220
|
+
description: 'The node_id from the [offload:node_id] tag',
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
required: ['node_id'],
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
executor: async (args, ctx) => {
|
|
228
|
+
const nodeId = args.node_id;
|
|
229
|
+
if (!nodeId)
|
|
230
|
+
return 'Error: node_id is required';
|
|
231
|
+
const store = ctx.custom?.toolResultStore;
|
|
232
|
+
if (!store)
|
|
233
|
+
return 'Error: ToolResultStore not available in context';
|
|
234
|
+
const content = store.readOffload(nodeId);
|
|
235
|
+
if (!content) {
|
|
236
|
+
return `Error: No offloaded content found for node_id "${nodeId}". It may have been cleaned up.`;
|
|
237
|
+
}
|
|
238
|
+
return content;
|
|
239
|
+
},
|
|
240
|
+
category: 'builtin',
|
|
241
|
+
concurrent: true,
|
|
242
|
+
},
|
|
243
|
+
];
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../../../../src/tool/tools/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AAO,iDAAiD,CAAC;gBAErE,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;gBAC1C,IAAI,CAAC,OAAO,EAAE,CAAC;oBACb,OAAO,kDAAkD,MAAM,iCAAiC,CAAC;gBACnG,CAAC;gBACD,OAAO,OAAO,CAAC;YACjB,CAAC;YACD,QAAQ,EAAE,SAAS;YACnB,UAAU,EAAE,IAAI;SACjB;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../../../../src/tool/tools/filesystem.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAW,MAAM,yBAAyB,CAAC;AAEvE,wBAAgB,qBAAqB,IAAI,cAAc,EAAE,CA6WxD"}
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// 文件系统与终端工具
|
|
3
|
+
// ============================================================
|
|
4
|
+
export function createFilesystemTools() {
|
|
5
|
+
return [
|
|
6
|
+
// ---- execute_command ----
|
|
7
|
+
{
|
|
8
|
+
definition: {
|
|
9
|
+
type: 'function',
|
|
10
|
+
function: {
|
|
11
|
+
name: 'execute_command',
|
|
12
|
+
description: 'Execute a shell command in the terminal. ' +
|
|
13
|
+
'IMPORTANT: Do NOT use heredoc (cat > file << EOF) to write scripts — the content will be truncated. ' +
|
|
14
|
+
'To write script files, use write_file (or append_file for long scripts), then use execute_command with a short command to run them. ' +
|
|
15
|
+
'SANDBOX RESTRICTIONS: Commands run inside a sandboxed directory. ' +
|
|
16
|
+
'NEVER use absolute paths (like /Users/..., /home/...) for file output — ALL file writes will be BLOCKED. ' +
|
|
17
|
+
'Use relative paths: "output/report.html", "output/gen.cjs", etc. ' +
|
|
18
|
+
'NEVER use `find /` for filesystem search — use `find . -name "file"` or `ls -la` instead.',
|
|
19
|
+
parameters: {
|
|
20
|
+
type: 'object',
|
|
21
|
+
properties: {
|
|
22
|
+
command: { type: 'string', description: 'Shell command to execute' },
|
|
23
|
+
timeout: { type: 'number', description: 'Timeout in ms, default 2000. For npm install use 60000.' },
|
|
24
|
+
},
|
|
25
|
+
required: ['command'],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
executor: async (args, ctx) => {
|
|
30
|
+
const command = args.command;
|
|
31
|
+
if (!command || typeof command !== 'string') {
|
|
32
|
+
return [
|
|
33
|
+
'ERROR: execute_command called with empty `command`. You MUST provide a shell command.',
|
|
34
|
+
'',
|
|
35
|
+
'Correct usage:',
|
|
36
|
+
' execute_command({ command: "pnpm install pptxgenjs", timeout: 60000 })',
|
|
37
|
+
' execute_command({ command: "ls -la", timeout: 5000 })',
|
|
38
|
+
].join('\n');
|
|
39
|
+
}
|
|
40
|
+
const timeout = Number(args.timeout) || 2000;
|
|
41
|
+
return ctx.shell.exec(command, timeout);
|
|
42
|
+
},
|
|
43
|
+
category: 'builtin',
|
|
44
|
+
concurrent: false,
|
|
45
|
+
},
|
|
46
|
+
// ---- read_terminal ----
|
|
47
|
+
{
|
|
48
|
+
definition: {
|
|
49
|
+
type: 'function',
|
|
50
|
+
function: {
|
|
51
|
+
name: 'read_terminal',
|
|
52
|
+
description: 'Read the current terminal output (last N lines)',
|
|
53
|
+
parameters: {
|
|
54
|
+
type: 'object',
|
|
55
|
+
properties: {
|
|
56
|
+
lines: { type: 'number', description: 'Number of lines to read, default 50' },
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
executor: async (args, ctx) => {
|
|
62
|
+
return ctx.shell.read(args.lines || 50);
|
|
63
|
+
},
|
|
64
|
+
category: 'builtin',
|
|
65
|
+
concurrent: true,
|
|
66
|
+
},
|
|
67
|
+
// ---- write_file ----
|
|
68
|
+
{
|
|
69
|
+
definition: {
|
|
70
|
+
type: 'function',
|
|
71
|
+
function: {
|
|
72
|
+
name: 'write_file',
|
|
73
|
+
description: 'Write content to a file (creates parent directories if needed). CRITICAL: Both `path` and `content` MUST be non-empty. MAX content: ~3000 chars (JSON escaping inflates size). For larger content, use write_file for first chunk then append_file for each subsequent chunk.',
|
|
74
|
+
parameters: {
|
|
75
|
+
type: 'object',
|
|
76
|
+
properties: {
|
|
77
|
+
path: { type: 'string', description: 'File path to write to (use output/ subdirectory for generated files, e.g. "output/report.html")' },
|
|
78
|
+
content: { type: 'string', description: 'File content as a string. MUST NOT be empty. For scripts, include the FULL source code.' },
|
|
79
|
+
},
|
|
80
|
+
required: ['path', 'content'],
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
executor: async (args, ctx) => {
|
|
85
|
+
if (!ctx.fs)
|
|
86
|
+
return 'Error: FileSystem executor not available';
|
|
87
|
+
const filePath = args.path;
|
|
88
|
+
const content = args.content;
|
|
89
|
+
if (!filePath || typeof filePath !== 'string') {
|
|
90
|
+
return [
|
|
91
|
+
'ERROR: write_file called with empty `path`. You MUST provide both `path` and `content`.',
|
|
92
|
+
'',
|
|
93
|
+
'Correct usage:',
|
|
94
|
+
' write_file({ path: "generate.cjs", content: "const x = require(\'module\'); /* full script here */" })',
|
|
95
|
+
'',
|
|
96
|
+
'IMPORTANT: The `content` field should contain your full script source code as a string.',
|
|
97
|
+
].join('\n');
|
|
98
|
+
}
|
|
99
|
+
if (content === undefined || content === null) {
|
|
100
|
+
return [
|
|
101
|
+
'ERROR: write_file called with empty `content`. You MUST provide the file content.',
|
|
102
|
+
'',
|
|
103
|
+
'Correct usage:',
|
|
104
|
+
' write_file({ path: "' + filePath + '", content: "<your script source code here>" })',
|
|
105
|
+
].join('\n');
|
|
106
|
+
}
|
|
107
|
+
await ctx.fs.writeFile(filePath, content);
|
|
108
|
+
// 日志:确认文件写入位置(沙箱 vs 全局 data/)
|
|
109
|
+
const sandbox = ctx.custom?.sandbox;
|
|
110
|
+
if (sandbox?.rootDir) {
|
|
111
|
+
console.log(`[write_file] ${filePath} → sandbox: ${sandbox.rootDir}`);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
console.warn(`[write_file] ${filePath} → NO SANDBOX (writing to data/ dir)`);
|
|
115
|
+
}
|
|
116
|
+
// 截断抢救模式:内容被部分恢复,提醒 LLM 补充剩余内容
|
|
117
|
+
if (args._rescued) {
|
|
118
|
+
return [
|
|
119
|
+
`File written (PARTIAL — content was truncated and rescued): ${filePath}`,
|
|
120
|
+
`Written ${content.length} chars. The ORIGINAL content was truncated by the output limit.`,
|
|
121
|
+
'',
|
|
122
|
+
'You MUST use append_file to add the REMAINING content:',
|
|
123
|
+
' append_file({ path: "' + filePath + '", content: "<remaining content>" })',
|
|
124
|
+
'',
|
|
125
|
+
'If your file is a JSON data file for create_presentation/create_document/create_pdf,',
|
|
126
|
+
'make sure the JSON is properly closed after appending (add trailing ] and }).',
|
|
127
|
+
].join('\n');
|
|
128
|
+
}
|
|
129
|
+
return `File written: ${filePath}`;
|
|
130
|
+
},
|
|
131
|
+
category: 'builtin',
|
|
132
|
+
concurrent: false,
|
|
133
|
+
},
|
|
134
|
+
// ---- append_file ----
|
|
135
|
+
{
|
|
136
|
+
definition: {
|
|
137
|
+
type: 'function',
|
|
138
|
+
function: {
|
|
139
|
+
name: 'append_file',
|
|
140
|
+
description: 'Append content to a file (creates the file if it does not exist). ' +
|
|
141
|
+
'Use this to build large scripts incrementally: write_file for the first chunk, ' +
|
|
142
|
+
'then append_file for subsequent chunks. Each call adds to the end of the file. ' +
|
|
143
|
+
'CRITICAL: Both `path` and `content` MUST be non-empty.',
|
|
144
|
+
parameters: {
|
|
145
|
+
type: 'object',
|
|
146
|
+
properties: {
|
|
147
|
+
path: { type: 'string', description: 'File path to append to (use output/ subdirectory, e.g. "output/generate.py")' },
|
|
148
|
+
content: { type: 'string', description: 'Content to append. MUST NOT be empty.' },
|
|
149
|
+
},
|
|
150
|
+
required: ['path', 'content'],
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
executor: async (args, ctx) => {
|
|
155
|
+
if (!ctx.fs)
|
|
156
|
+
return 'Error: FileSystem executor not available';
|
|
157
|
+
const filePath = args.path;
|
|
158
|
+
const content = args.content;
|
|
159
|
+
if (!filePath || typeof filePath !== 'string') {
|
|
160
|
+
return 'ERROR: append_file requires a non-empty `path` parameter.';
|
|
161
|
+
}
|
|
162
|
+
if (!content) {
|
|
163
|
+
return 'ERROR: append_file requires non-empty `content` parameter.';
|
|
164
|
+
}
|
|
165
|
+
if (ctx.fs.appendFile) {
|
|
166
|
+
await ctx.fs.appendFile(filePath, content);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
// Fallback: read existing + write combined
|
|
170
|
+
let existing = '';
|
|
171
|
+
try {
|
|
172
|
+
existing = await ctx.fs.readFile(filePath);
|
|
173
|
+
}
|
|
174
|
+
catch { /* file doesn't exist yet */ }
|
|
175
|
+
await ctx.fs.writeFile(filePath, existing + content);
|
|
176
|
+
}
|
|
177
|
+
// 日志:确认文件写入位置
|
|
178
|
+
const sandbox = ctx.custom?.sandbox;
|
|
179
|
+
if (sandbox?.rootDir) {
|
|
180
|
+
console.log(`[append_file] ${filePath} → sandbox: ${sandbox.rootDir}`);
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
console.warn(`[append_file] ${filePath} → NO SANDBOX (writing to data/ dir)`);
|
|
184
|
+
}
|
|
185
|
+
// 截断抢救模式
|
|
186
|
+
if (args._rescued) {
|
|
187
|
+
return [
|
|
188
|
+
`Content appended (PARTIAL — rescued from truncation): ${filePath}`,
|
|
189
|
+
`Appended ${content.length} chars. Some content may have been lost.`,
|
|
190
|
+
'Continue with append_file to add any remaining content.',
|
|
191
|
+
].join('\n');
|
|
192
|
+
}
|
|
193
|
+
return `Content appended to: ${filePath}`;
|
|
194
|
+
},
|
|
195
|
+
category: 'builtin',
|
|
196
|
+
concurrent: false,
|
|
197
|
+
},
|
|
198
|
+
// ---- read_file ----
|
|
199
|
+
{
|
|
200
|
+
definition: {
|
|
201
|
+
type: 'function',
|
|
202
|
+
function: {
|
|
203
|
+
name: 'read_file',
|
|
204
|
+
description: 'Read the contents of a file',
|
|
205
|
+
parameters: {
|
|
206
|
+
type: 'object',
|
|
207
|
+
properties: {
|
|
208
|
+
path: { type: 'string', description: 'File path to read' },
|
|
209
|
+
},
|
|
210
|
+
required: ['path'],
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
executor: async (args, ctx) => {
|
|
215
|
+
if (!ctx.fs)
|
|
216
|
+
return 'Error: FileSystem executor not available';
|
|
217
|
+
const filePath = args.path;
|
|
218
|
+
if (!filePath || typeof filePath !== 'string') {
|
|
219
|
+
return 'Error: `path` parameter is required and must be a non-empty string.';
|
|
220
|
+
}
|
|
221
|
+
return ctx.fs.readFile(filePath);
|
|
222
|
+
},
|
|
223
|
+
category: 'builtin',
|
|
224
|
+
concurrent: true,
|
|
225
|
+
},
|
|
226
|
+
// ---- search_code ----
|
|
227
|
+
// 在项目目录中搜索代码(正则/文件名)
|
|
228
|
+
{
|
|
229
|
+
definition: {
|
|
230
|
+
type: 'function',
|
|
231
|
+
function: {
|
|
232
|
+
name: 'search_code',
|
|
233
|
+
description: 'Search for code patterns in a directory using file glob patterns and content regex matching. ' +
|
|
234
|
+
'Returns matching files and line numbers with context. ' +
|
|
235
|
+
'Use this to find function definitions, usages, TODO comments, or any text pattern in a codebase.',
|
|
236
|
+
parameters: {
|
|
237
|
+
type: 'object',
|
|
238
|
+
properties: {
|
|
239
|
+
pattern: { type: 'string', description: 'Regex pattern to search in file contents (e.g. "function\\s+\\w+" or "TODO")' },
|
|
240
|
+
path: { type: 'string', description: 'Root directory to search (default: sandbox root)' },
|
|
241
|
+
glob: { type: 'string', description: 'File glob pattern to filter files (e.g. "**/*.ts" for TypeScript files, default: all files)' },
|
|
242
|
+
maxResults: { type: 'number', description: 'Maximum number of matches to return (default: 50)' },
|
|
243
|
+
caseSensitive: { type: 'boolean', description: 'Case sensitive search (default: false)' },
|
|
244
|
+
},
|
|
245
|
+
required: ['pattern'],
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
executor: async (args, ctx) => {
|
|
250
|
+
try {
|
|
251
|
+
const fastGlob = await import('fast-glob');
|
|
252
|
+
const fs = await import('fs');
|
|
253
|
+
const path = await import('path');
|
|
254
|
+
const sandbox = ctx.custom?.sandbox;
|
|
255
|
+
const rootPath = args.path || sandbox?.rootDir || process.cwd();
|
|
256
|
+
const pattern = args.pattern;
|
|
257
|
+
const globPattern = args.glob || '**/*';
|
|
258
|
+
const maxResults = args.maxResults || 50;
|
|
259
|
+
const caseSensitive = args.caseSensitive;
|
|
260
|
+
const regex = new RegExp(pattern, caseSensitive ? 'g' : 'gi');
|
|
261
|
+
const files = await fastGlob.default(globPattern, {
|
|
262
|
+
cwd: rootPath,
|
|
263
|
+
absolute: true,
|
|
264
|
+
ignore: ['**/node_modules/**', '**/.git/**', '**/dist/**', '**/build/**'],
|
|
265
|
+
});
|
|
266
|
+
const results = [];
|
|
267
|
+
let matchCount = 0;
|
|
268
|
+
for (const filePath of files) {
|
|
269
|
+
if (matchCount >= maxResults)
|
|
270
|
+
break;
|
|
271
|
+
try {
|
|
272
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
273
|
+
const lines = content.split('\n');
|
|
274
|
+
const relPath = path.relative(rootPath, filePath);
|
|
275
|
+
for (let i = 0; i < lines.length; i++) {
|
|
276
|
+
if (matchCount >= maxResults)
|
|
277
|
+
break;
|
|
278
|
+
regex.lastIndex = 0;
|
|
279
|
+
if (regex.test(lines[i])) {
|
|
280
|
+
results.push(`${relPath}:${i + 1}: ${lines[i].trim()}`);
|
|
281
|
+
matchCount++;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
catch { /* skip binary/unreadable files */ }
|
|
286
|
+
}
|
|
287
|
+
if (results.length === 0) {
|
|
288
|
+
return `No matches found for pattern "${pattern}" in ${files.length} files.`;
|
|
289
|
+
}
|
|
290
|
+
return `Found ${matchCount} match(es) in ${files.length} files:\n\n${results.join('\n')}`;
|
|
291
|
+
}
|
|
292
|
+
catch (e) {
|
|
293
|
+
return `ERROR: ${e.message || e}`;
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
category: 'builtin',
|
|
297
|
+
concurrent: true,
|
|
298
|
+
},
|
|
299
|
+
// ---- edit_file ----
|
|
300
|
+
// 精确搜索替换编辑文件(而非全量覆写)
|
|
301
|
+
{
|
|
302
|
+
definition: {
|
|
303
|
+
type: 'function',
|
|
304
|
+
function: {
|
|
305
|
+
name: 'edit_file',
|
|
306
|
+
description: 'Edit a file by replacing a specific text block with new content. ' +
|
|
307
|
+
'More precise than write_file for making targeted changes without rewriting the entire file. ' +
|
|
308
|
+
'The oldText must match exactly (including whitespace/indentation). ' +
|
|
309
|
+
'If oldText appears multiple times, all occurrences are replaced unless replaceAll is false.',
|
|
310
|
+
parameters: {
|
|
311
|
+
type: 'object',
|
|
312
|
+
properties: {
|
|
313
|
+
path: { type: 'string', description: 'File path (relative to sandbox root)' },
|
|
314
|
+
oldText: { type: 'string', description: 'The exact text to find and replace (must match exactly including whitespace)' },
|
|
315
|
+
newText: { type: 'string', description: 'The replacement text' },
|
|
316
|
+
replaceAll: { type: 'boolean', description: 'Replace all occurrences (default: true). If false, only replace the first match.' },
|
|
317
|
+
},
|
|
318
|
+
required: ['path', 'oldText', 'newText'],
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
executor: async (args, ctx) => {
|
|
323
|
+
try {
|
|
324
|
+
const filePath = args.path;
|
|
325
|
+
const oldText = args.oldText;
|
|
326
|
+
const newText = args.newText;
|
|
327
|
+
const replaceAll = args.replaceAll !== false;
|
|
328
|
+
const sandbox = ctx.custom?.sandbox;
|
|
329
|
+
if (!sandbox)
|
|
330
|
+
return 'ERROR: Sandbox not available.';
|
|
331
|
+
const fsExec = sandbox.getFileSystemExecutor();
|
|
332
|
+
// 读取当前内容
|
|
333
|
+
let content;
|
|
334
|
+
try {
|
|
335
|
+
content = await fsExec.readFile(filePath);
|
|
336
|
+
}
|
|
337
|
+
catch {
|
|
338
|
+
return `ERROR: File "${filePath}" not found.`;
|
|
339
|
+
}
|
|
340
|
+
// 检查 oldText 是否存在
|
|
341
|
+
if (!content.includes(oldText)) {
|
|
342
|
+
return `ERROR: oldText not found in "${filePath}". Make sure the text matches exactly (including whitespace and indentation).`;
|
|
343
|
+
}
|
|
344
|
+
// 执行替换
|
|
345
|
+
let newContent;
|
|
346
|
+
if (replaceAll) {
|
|
347
|
+
newContent = content.split(oldText).join(newText);
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
const idx = content.indexOf(oldText);
|
|
351
|
+
newContent = content.slice(0, idx) + newText + content.slice(idx + oldText.length);
|
|
352
|
+
}
|
|
353
|
+
// 写回文件
|
|
354
|
+
await fsExec.writeFile(filePath, newContent);
|
|
355
|
+
const occurrences = replaceAll ? content.split(oldText).length - 1 : 1;
|
|
356
|
+
return `File "${filePath}" updated successfully. Replaced ${occurrences} occurrence(s).`;
|
|
357
|
+
}
|
|
358
|
+
catch (e) {
|
|
359
|
+
return `ERROR: ${e.message || e}`;
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
category: 'builtin',
|
|
363
|
+
concurrent: false,
|
|
364
|
+
},
|
|
365
|
+
];
|
|
366
|
+
}
|
|
367
|
+
//# sourceMappingURL=filesystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem.js","sourceRoot":"","sources":["../../../../src/tool/tools/filesystem.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,YAAY;AACZ,+DAA+D;AAI/D,MAAM,UAAU,qBAAqB;IACnC,OAAO;QACL,4BAA4B;QAC5B;YACE,UAAU,EAAE;gBACV,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE;oBACR,IAAI,EAAE,iBAAiB;oBACvB,WAAW,EACT,2CAA2C;wBA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