hyacinth-ai 0.9.6
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/LICENSE +21 -0
- package/README.md +205 -0
- package/commands.json +25 -0
- package/dist/agents/builtins.d.ts +8 -0
- package/dist/agents/builtins.js +50 -0
- package/dist/agents/config-loader.d.ts +15 -0
- package/dist/agents/config-loader.js +75 -0
- package/dist/agents/delegate-tool.d.ts +109 -0
- package/dist/agents/delegate-tool.js +407 -0
- package/dist/agents/index.d.ts +5 -0
- package/dist/agents/index.js +5 -0
- package/dist/agents/registry.d.ts +2 -0
- package/dist/agents/registry.js +2 -0
- package/dist/bypass/agents/companion/index.d.ts +57 -0
- package/dist/bypass/agents/companion/index.js +487 -0
- package/dist/bypass/agents/orchestrator/index.d.ts +17 -0
- package/dist/bypass/agents/orchestrator/index.js +414 -0
- package/dist/bypass/agents/orchestrator.d.ts +16 -0
- package/dist/bypass/agents/orchestrator.js +377 -0
- package/dist/bypass/agents/world-engine/agent.d.ts +41 -0
- package/dist/bypass/agents/world-engine/agent.js +385 -0
- package/dist/bypass/agents/world-engine/index.d.ts +52 -0
- package/dist/bypass/agents/world-engine/index.js +198 -0
- package/dist/bypass/agents/world-engine/sim.d.ts +14 -0
- package/dist/bypass/agents/world-engine/sim.js +120 -0
- package/dist/bypass/agents/world-engine/store.d.ts +110 -0
- package/dist/bypass/agents/world-engine/store.js +519 -0
- package/dist/bypass/agents/world-engine/ticker.d.ts +37 -0
- package/dist/bypass/agents/world-engine/ticker.js +214 -0
- package/dist/bypass/agents/world-engine/tools.d.ts +6 -0
- package/dist/bypass/agents/world-engine/tools.js +380 -0
- package/dist/bypass/agents/world-engine/types.d.ts +202 -0
- package/dist/bypass/agents/world-engine/types.js +56 -0
- package/dist/bypass/agents/world-engine.d.ts +20 -0
- package/dist/bypass/agents/world-engine.js +63 -0
- package/dist/bypass/base.d.ts +48 -0
- package/dist/bypass/base.js +126 -0
- package/dist/bypass/index.d.ts +5 -0
- package/dist/bypass/index.js +6 -0
- package/dist/bypass/manager.d.ts +41 -0
- package/dist/bypass/manager.js +179 -0
- package/dist/bypass/types.d.ts +63 -0
- package/dist/bypass/types.js +14 -0
- package/dist/channels/auto-detect.d.ts +25 -0
- package/dist/channels/auto-detect.js +77 -0
- package/dist/channels/builtin/http-webhook.d.ts +25 -0
- package/dist/channels/builtin/http-webhook.js +287 -0
- package/dist/channels/builtin/tui-channel.d.ts +33 -0
- package/dist/channels/builtin/tui-channel.js +61 -0
- package/dist/channels/builtin/tui-ws-session.d.ts +16 -0
- package/dist/channels/builtin/tui-ws-session.js +90 -0
- package/dist/channels/builtin/webui-output-handler.d.ts +30 -0
- package/dist/channels/builtin/webui-output-handler.js +93 -0
- package/dist/channels/index.d.ts +5 -0
- package/dist/channels/index.js +3 -0
- package/dist/channels/interface.d.ts +148 -0
- package/dist/channels/interface.js +15 -0
- package/dist/channels/manager.d.ts +43 -0
- package/dist/channels/manager.js +156 -0
- package/dist/channels/message-queue.d.ts +36 -0
- package/dist/channels/message-queue.js +91 -0
- package/dist/channels/plugins/clawbot/clawbot-auth.d.ts +50 -0
- package/dist/channels/plugins/clawbot/clawbot-auth.js +235 -0
- package/dist/channels/plugins/clawbot/clawbot-channel.d.ts +76 -0
- package/dist/channels/plugins/clawbot/clawbot-channel.js +566 -0
- package/dist/channels/plugins/clawbot/clawbot-client.d.ts +180 -0
- package/dist/channels/plugins/clawbot/clawbot-client.js +312 -0
- package/dist/channels/plugins/clawbot/clawbot-config.d.ts +30 -0
- package/dist/channels/plugins/clawbot/clawbot-config.js +28 -0
- package/dist/channels/plugins/clawbot/clawbot-message-queue.d.ts +27 -0
- package/dist/channels/plugins/clawbot/clawbot-message-queue.js +114 -0
- package/dist/channels/plugins/clawbot/clawbot-session.d.ts +10 -0
- package/dist/channels/plugins/clawbot/clawbot-session.js +26 -0
- package/dist/channels/plugins/clawbot/index.d.ts +17 -0
- package/dist/channels/plugins/clawbot/index.js +58 -0
- package/dist/channels/plugins/feishu/feishu-channel.d.ts +57 -0
- package/dist/channels/plugins/feishu/feishu-channel.js +602 -0
- package/dist/channels/plugins/feishu/feishu-client.d.ts +23 -0
- package/dist/channels/plugins/feishu/feishu-client.js +86 -0
- package/dist/channels/plugins/feishu/feishu-config.d.ts +53 -0
- package/dist/channels/plugins/feishu/feishu-config.js +35 -0
- package/dist/channels/plugins/feishu/feishu-event.d.ts +102 -0
- package/dist/channels/plugins/feishu/feishu-event.js +257 -0
- package/dist/channels/plugins/feishu/feishu-log-suppressor.d.ts +7 -0
- package/dist/channels/plugins/feishu/feishu-log-suppressor.js +34 -0
- package/dist/channels/plugins/feishu/feishu-message-queue.d.ts +27 -0
- package/dist/channels/plugins/feishu/feishu-message-queue.js +112 -0
- package/dist/channels/plugins/feishu/feishu-send.d.ts +44 -0
- package/dist/channels/plugins/feishu/feishu-send.js +232 -0
- package/dist/channels/plugins/feishu/feishu-session.d.ts +44 -0
- package/dist/channels/plugins/feishu/feishu-session.js +84 -0
- package/dist/channels/plugins/feishu/feishu-streaming.d.ts +49 -0
- package/dist/channels/plugins/feishu/feishu-streaming.js +185 -0
- package/dist/channels/plugins/feishu/feishu-transport.d.ts +29 -0
- package/dist/channels/plugins/feishu/feishu-transport.js +99 -0
- package/dist/channels/plugins/feishu/index.d.ts +22 -0
- package/dist/channels/plugins/feishu/index.js +68 -0
- package/dist/cli/doctor.d.ts +20 -0
- package/dist/cli/doctor.js +317 -0
- package/dist/context/cache-strategy.d.ts +76 -0
- package/dist/context/cache-strategy.js +123 -0
- package/dist/context/composer.d.ts +77 -0
- package/dist/context/composer.js +318 -0
- package/dist/context/compressor.d.ts +218 -0
- package/dist/context/compressor.js +909 -0
- package/dist/context/index.d.ts +14 -0
- package/dist/context/index.js +8 -0
- package/dist/context/interface.d.ts +33 -0
- package/dist/context/interface.js +2 -0
- package/dist/context/manifest-defaults.d.ts +51 -0
- package/dist/context/manifest-defaults.js +133 -0
- package/dist/context/manifest-loader.d.ts +16 -0
- package/dist/context/manifest-loader.js +103 -0
- package/dist/context/manifest-types.d.ts +26 -0
- package/dist/context/manifest-types.js +2 -0
- package/dist/context/precision/analyzer.d.ts +31 -0
- package/dist/context/precision/analyzer.js +131 -0
- package/dist/context/precision/companion.d.ts +27 -0
- package/dist/context/precision/companion.js +144 -0
- package/dist/context/precision/default.d.ts +14 -0
- package/dist/context/precision/default.js +17 -0
- package/dist/context/precision/index.d.ts +9 -0
- package/dist/context/precision/index.js +7 -0
- package/dist/context/precision/keyword-pool.d.ts +27 -0
- package/dist/context/precision/keyword-pool.js +66 -0
- package/dist/context/precision/strategy.d.ts +18 -0
- package/dist/context/precision/strategy.js +51 -0
- package/dist/context/precision/summary-store.d.ts +18 -0
- package/dist/context/precision/summary-store.js +67 -0
- package/dist/context/precision/types.d.ts +23 -0
- package/dist/context/precision/types.js +2 -0
- package/dist/context/profiles.d.ts +45 -0
- package/dist/context/profiles.js +92 -0
- package/dist/context/prompt-builder.d.ts +76 -0
- package/dist/context/prompt-builder.js +133 -0
- package/dist/context/retriever.d.ts +44 -0
- package/dist/context/retriever.js +203 -0
- package/dist/context/router.d.ts +122 -0
- package/dist/context/router.js +291 -0
- package/dist/context/section-resolver.d.ts +38 -0
- package/dist/context/section-resolver.js +398 -0
- package/dist/context/tokenizer.d.ts +23 -0
- package/dist/context/tokenizer.js +78 -0
- package/dist/dependency/analyzer.d.ts +33 -0
- package/dist/dependency/analyzer.js +242 -0
- package/dist/dependency/data-flow-tracker.d.ts +12 -0
- package/dist/dependency/data-flow-tracker.js +97 -0
- package/dist/dependency/function-parser.d.ts +34 -0
- package/dist/dependency/function-parser.js +295 -0
- package/dist/dependency/index.d.ts +14 -0
- package/dist/dependency/index.js +20 -0
- package/dist/dependency/parser.d.ts +10 -0
- package/dist/dependency/parser.js +93 -0
- package/dist/dependency/types.d.ts +57 -0
- package/dist/dependency/types.js +2 -0
- package/dist/env/env-collector.d.ts +45 -0
- package/dist/env/env-collector.js +221 -0
- package/dist/env/index.d.ts +3 -0
- package/dist/env/index.js +2 -0
- package/dist/event-store.d.ts +27 -0
- package/dist/event-store.js +71 -0
- package/dist/evolution/git-manager.d.ts +46 -0
- package/dist/evolution/git-manager.js +276 -0
- package/dist/evolution/index.d.ts +3 -0
- package/dist/evolution/index.js +2 -0
- package/dist/flow/bootstrap-flow.d.ts +19 -0
- package/dist/flow/bootstrap-flow.js +72 -0
- package/dist/flow/flow-registry.d.ts +12 -0
- package/dist/flow/flow-registry.js +74 -0
- package/dist/flow/flow-tools.d.ts +8 -0
- package/dist/flow/flow-tools.js +106 -0
- package/dist/flow/index.d.ts +6 -0
- package/dist/flow/index.js +8 -0
- package/dist/flow/todo-flow.d.ts +25 -0
- package/dist/flow/todo-flow.js +107 -0
- package/dist/flow/types.d.ts +78 -0
- package/dist/flow/types.js +12 -0
- package/dist/flows/bootstrap.d.ts +18 -0
- package/dist/flows/bootstrap.js +119 -0
- package/dist/flows/index.d.ts +6 -0
- package/dist/flows/index.js +11 -0
- package/dist/flows/todo.d.ts +26 -0
- package/dist/flows/todo.js +174 -0
- package/dist/flows/tools.d.ts +8 -0
- package/dist/flows/tools.js +119 -0
- package/dist/flows/types.d.ts +27 -0
- package/dist/flows/types.js +10 -0
- package/dist/gateway/cli.d.ts +5 -0
- package/dist/gateway/cli.js +1027 -0
- package/dist/gateway/factory.d.ts +80 -0
- package/dist/gateway/factory.js +832 -0
- package/dist/gateway/guardian.d.ts +8 -0
- package/dist/gateway/guardian.js +30 -0
- package/dist/gateway/index.d.ts +3 -0
- package/dist/gateway/index.js +3 -0
- package/dist/gateway/server.d.ts +17 -0
- package/dist/gateway/server.js +96 -0
- package/dist/gateway/tui.d.ts +16 -0
- package/dist/gateway/tui.js +3273 -0
- package/dist/hot-reload/agent-watcher.d.ts +24 -0
- package/dist/hot-reload/agent-watcher.js +175 -0
- package/dist/hot-reload/bundle-watcher.d.ts +12 -0
- package/dist/hot-reload/bundle-watcher.js +35 -0
- package/dist/hot-reload/channel-watcher.d.ts +19 -0
- package/dist/hot-reload/channel-watcher.js +54 -0
- package/dist/hot-reload/command-watcher.d.ts +14 -0
- package/dist/hot-reload/command-watcher.js +54 -0
- package/dist/hot-reload/config-watcher.d.ts +20 -0
- package/dist/hot-reload/config-watcher.js +58 -0
- package/dist/hot-reload/index.d.ts +12 -0
- package/dist/hot-reload/index.js +12 -0
- package/dist/hot-reload/manager.d.ts +58 -0
- package/dist/hot-reload/manager.js +243 -0
- package/dist/hot-reload/manifest-watcher.d.ts +9 -0
- package/dist/hot-reload/manifest-watcher.js +42 -0
- package/dist/hot-reload/mcp-watcher.d.ts +18 -0
- package/dist/hot-reload/mcp-watcher.js +64 -0
- package/dist/hot-reload/model-catalog-watcher.d.ts +18 -0
- package/dist/hot-reload/model-catalog-watcher.js +62 -0
- package/dist/hot-reload/plugin-watcher.d.ts +20 -0
- package/dist/hot-reload/plugin-watcher.js +56 -0
- package/dist/hot-reload/prompt-watcher.d.ts +6 -0
- package/dist/hot-reload/prompt-watcher.js +38 -0
- package/dist/hot-reload/provider-watcher.d.ts +16 -0
- package/dist/hot-reload/provider-watcher.js +45 -0
- package/dist/hot-reload/skill-watcher.d.ts +19 -0
- package/dist/hot-reload/skill-watcher.js +82 -0
- package/dist/hot-reload/tool-watcher.d.ts +16 -0
- package/dist/hot-reload/tool-watcher.js +168 -0
- package/dist/hot-reload/workflow-watcher.d.ts +19 -0
- package/dist/hot-reload/workflow-watcher.js +84 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -0
- package/dist/knowledge/fts5-retriever.d.ts +30 -0
- package/dist/knowledge/fts5-retriever.js +223 -0
- package/dist/knowledge/index.d.ts +11 -0
- package/dist/knowledge/index.js +14 -0
- package/dist/knowledge/indexer.d.ts +41 -0
- package/dist/knowledge/indexer.js +186 -0
- package/dist/knowledge/query-preprocessor.d.ts +13 -0
- package/dist/knowledge/query-preprocessor.js +63 -0
- package/dist/knowledge/retriever.d.ts +45 -0
- package/dist/knowledge/retriever.js +9 -0
- package/dist/knowledge/store.d.ts +27 -0
- package/dist/knowledge/store.js +61 -0
- package/dist/knowledge/structured-store.d.ts +78 -0
- package/dist/knowledge/structured-store.js +280 -0
- package/dist/knowledge/structured-tools.d.ts +12 -0
- package/dist/knowledge/structured-tools.js +151 -0
- package/dist/knowledge/tools.d.ts +20 -0
- package/dist/knowledge/tools.js +238 -0
- package/dist/knowledge/watcher.d.ts +28 -0
- package/dist/knowledge/watcher.js +113 -0
- package/dist/lifecycle/index.d.ts +12 -0
- package/dist/lifecycle/index.js +14 -0
- package/dist/lifecycle/interface.d.ts +94 -0
- package/dist/lifecycle/interface.js +2 -0
- package/dist/lifecycle/local-model.d.ts +62 -0
- package/dist/lifecycle/local-model.js +331 -0
- package/dist/lifecycle/manager.d.ts +70 -0
- package/dist/lifecycle/manager.js +374 -0
- package/dist/lifecycle/supervisor.d.ts +89 -0
- package/dist/lifecycle/supervisor.js +277 -0
- package/dist/lifecycle-integration-test.d.ts +2 -0
- package/dist/lifecycle-integration-test.js +72 -0
- package/dist/local-model/download-manager.d.ts +59 -0
- package/dist/local-model/download-manager.js +517 -0
- package/dist/local-model/index.d.ts +109 -0
- package/dist/local-model/index.js +233 -0
- package/dist/local-model/llamacpp-provider.d.ts +95 -0
- package/dist/local-model/llamacpp-provider.js +379 -0
- package/dist/local-model/model-bridge.d.ts +48 -0
- package/dist/local-model/model-bridge.js +256 -0
- package/dist/local-model/model-registry.d.ts +47 -0
- package/dist/local-model/model-registry.js +188 -0
- package/dist/local-model/types.d.ts +49 -0
- package/dist/local-model/types.js +2 -0
- package/dist/logging/index.d.ts +3 -0
- package/dist/logging/index.js +3 -0
- package/dist/logging/logger.d.ts +56 -0
- package/dist/logging/logger.js +94 -0
- package/dist/machine/flows/bootstrap.d.ts +18 -0
- package/dist/machine/flows/bootstrap.js +119 -0
- package/dist/machine/flows/index.d.ts +6 -0
- package/dist/machine/flows/index.js +11 -0
- package/dist/machine/flows/spec.d.ts +17 -0
- package/dist/machine/flows/spec.js +176 -0
- package/dist/machine/flows/todo.d.ts +26 -0
- package/dist/machine/flows/todo.js +175 -0
- package/dist/machine/flows/tools.d.ts +8 -0
- package/dist/machine/flows/tools.js +119 -0
- package/dist/machine/flows/types.d.ts +33 -0
- package/dist/machine/flows/types.js +10 -0
- package/dist/machine/index.d.ts +8 -0
- package/dist/machine/index.js +9 -0
- package/dist/machine/registry.d.ts +34 -0
- package/dist/machine/registry.js +98 -0
- package/dist/machine/runner.d.ts +41 -0
- package/dist/machine/runner.js +177 -0
- package/dist/machine/types.d.ts +121 -0
- package/dist/machine/types.js +9 -0
- package/dist/mcp/bridge.d.ts +33 -0
- package/dist/mcp/bridge.js +99 -0
- package/dist/mcp/client.d.ts +37 -0
- package/dist/mcp/client.js +161 -0
- package/dist/mcp/config.d.ts +15 -0
- package/dist/mcp/config.js +85 -0
- package/dist/mcp/index.d.ts +7 -0
- package/dist/mcp/index.js +7 -0
- package/dist/mcp/install-manager.d.ts +31 -0
- package/dist/mcp/install-manager.js +158 -0
- package/dist/mcp/lifecycle.d.ts +41 -0
- package/dist/mcp/lifecycle.js +175 -0
- package/dist/mcp/process-transport.d.ts +21 -0
- package/dist/mcp/process-transport.js +59 -0
- package/dist/mcp/side-effect.d.ts +5 -0
- package/dist/mcp/side-effect.js +21 -0
- package/dist/mcp/system.d.ts +95 -0
- package/dist/mcp/system.js +279 -0
- package/dist/memory/companion-session.d.ts +22 -0
- package/dist/memory/companion-session.js +77 -0
- package/dist/memory/compression-boundary.d.ts +20 -0
- package/dist/memory/compression-boundary.js +40 -0
- package/dist/memory/conversation.d.ts +34 -0
- package/dist/memory/conversation.js +107 -0
- package/dist/memory/events.d.ts +42 -0
- package/dist/memory/events.js +56 -0
- package/dist/memory/index.d.ts +7 -0
- package/dist/memory/index.js +6 -0
- package/dist/memory/memory-store.d.ts +11 -0
- package/dist/memory/memory-store.js +51 -0
- package/dist/memory/session-allowlist.d.ts +11 -0
- package/dist/memory/session-allowlist.js +50 -0
- package/dist/memory/session.d.ts +48 -0
- package/dist/memory/session.js +275 -0
- package/dist/memory/stats.d.ts +23 -0
- package/dist/memory/stats.js +59 -0
- package/dist/memory/summary.d.ts +7 -0
- package/dist/memory/summary.js +23 -0
- package/dist/multimodal/index.d.ts +66 -0
- package/dist/multimodal/index.js +210 -0
- package/dist/orchestrator/index.d.ts +5 -0
- package/dist/orchestrator/index.js +4 -0
- package/dist/orchestrator/loop.d.ts +331 -0
- package/dist/orchestrator/loop.js +2443 -0
- package/dist/orchestrator/plan-store.d.ts +81 -0
- package/dist/orchestrator/plan-store.js +167 -0
- package/dist/orchestrator/planner.d.ts +20 -0
- package/dist/orchestrator/planner.js +34 -0
- package/dist/parser/index.d.ts +2 -0
- package/dist/parser/index.js +2 -0
- package/dist/parser/router.d.ts +30 -0
- package/dist/parser/router.js +61 -0
- package/dist/plugins/api.d.ts +39 -0
- package/dist/plugins/api.js +85 -0
- package/dist/plugins/define.d.ts +27 -0
- package/dist/plugins/define.js +32 -0
- package/dist/plugins/index.d.ts +9 -0
- package/dist/plugins/index.js +5 -0
- package/dist/plugins/loader.d.ts +39 -0
- package/dist/plugins/loader.js +128 -0
- package/dist/plugins/manager.d.ts +61 -0
- package/dist/plugins/manager.js +257 -0
- package/dist/plugins/types.d.ts +82 -0
- package/dist/plugins/types.js +2 -0
- package/dist/prompts/agents/code-reviewer.md +16 -0
- package/dist/prompts/agents/security-auditor.md +17 -0
- package/dist/prompts/agents/test-writer.md +15 -0
- package/dist/prompts/attention/attention.md +12 -0
- package/dist/prompts/environment/environment.md +18 -0
- package/dist/prompts/environment/feishu.md +107 -0
- package/dist/prompts/flows/bootstrap-confirm.md +14 -0
- package/dist/prompts/flows/bootstrap-identity.md +11 -0
- package/dist/prompts/flows/bootstrap-soul.md +19 -0
- package/dist/prompts/flows/bootstrap-user.md +11 -0
- package/dist/prompts/flows/spec-checklist.md +27 -0
- package/dist/prompts/flows/spec-define.md +64 -0
- package/dist/prompts/flows/spec-executing-checklist.md +15 -0
- package/dist/prompts/flows/spec-executing-tasks.md +15 -0
- package/dist/prompts/flows/spec-spec.md +51 -0
- package/dist/prompts/flows/spec-tasks.md +32 -0
- package/dist/prompts/flows/todo-execution.md +7 -0
- package/dist/prompts/flows/todo-planning.md +18 -0
- package/dist/prompts/framework/architecture.md +131 -0
- package/dist/prompts/identity/identity.md +2 -0
- package/dist/prompts/loader.d.ts +24 -0
- package/dist/prompts/loader.js +102 -0
- package/dist/prompts/loader.ts +119 -0
- package/dist/prompts/orchestration/summary.md +14 -0
- package/dist/prompts/persona/BOOTSTRAP.md +5 -0
- package/dist/prompts/persona/IDENTITY.md +16 -0
- package/dist/prompts/persona/PartnerMemory.md +5 -0
- package/dist/prompts/persona/PartnerSoul.md +7 -0
- package/dist/prompts/persona/SOUL.md +30 -0
- package/dist/prompts/persona/USER.md +16 -0
- package/dist/prompts/precise/analyze.md +23 -0
- package/dist/prompts/precise/persona.md +18 -0
- package/dist/prompts/safety/coding-standards.md +5 -0
- package/dist/prompts/safety/safety.md +4 -0
- package/dist/prompts/skills/code-review.md +4 -0
- package/dist/prompts/skills/debug.md +7 -0
- package/dist/prompts/skills/framework-reference.md +131 -0
- package/dist/prompts/skills/refactor.md +6 -0
- package/dist/prompts/summary.md +22 -0
- package/dist/prompts/tools/framework-capabilities.md +241 -0
- package/dist/prompts/tools/tool-rules.md +15 -0
- package/dist/provider/anthropic.d.ts +62 -0
- package/dist/provider/anthropic.js +361 -0
- package/dist/provider/catalog.d.ts +58 -0
- package/dist/provider/catalog.js +97 -0
- package/dist/provider/compatible.d.ts +89 -0
- package/dist/provider/compatible.js +328 -0
- package/dist/provider/config.d.ts +23 -0
- package/dist/provider/config.js +158 -0
- package/dist/provider/deepseek.d.ts +25 -0
- package/dist/provider/deepseek.js +37 -0
- package/dist/provider/fallback.d.ts +51 -0
- package/dist/provider/fallback.js +113 -0
- package/dist/provider/gemini.d.ts +27 -0
- package/dist/provider/gemini.js +170 -0
- package/dist/provider/index.d.ts +36 -0
- package/dist/provider/index.js +42 -0
- package/dist/provider/interface.d.ts +62 -0
- package/dist/provider/interface.js +2 -0
- package/dist/provider/local-config.d.ts +37 -0
- package/dist/provider/local-config.js +146 -0
- package/dist/provider/local.d.ts +45 -0
- package/dist/provider/local.js +248 -0
- package/dist/provider/manager.d.ts +67 -0
- package/dist/provider/manager.js +355 -0
- package/dist/provider/mimo.d.ts +19 -0
- package/dist/provider/mimo.js +30 -0
- package/dist/provider/minimax.d.ts +22 -0
- package/dist/provider/minimax.js +33 -0
- package/dist/provider/model-catalog-loader.d.ts +42 -0
- package/dist/provider/model-catalog-loader.js +89 -0
- package/dist/provider/model-channel-registry.d.ts +130 -0
- package/dist/provider/model-channel-registry.js +488 -0
- package/dist/provider/model-router.d.ts +60 -0
- package/dist/provider/model-router.js +87 -0
- package/dist/provider/openai.d.ts +54 -0
- package/dist/provider/openai.js +274 -0
- package/dist/provider/qwen.d.ts +19 -0
- package/dist/provider/qwen.js +30 -0
- package/dist/provider/resilient.d.ts +46 -0
- package/dist/provider/resilient.js +181 -0
- package/dist/provider/retry.d.ts +16 -0
- package/dist/provider/retry.js +78 -0
- package/dist/provider/router.d.ts +68 -0
- package/dist/provider/router.js +145 -0
- package/dist/provider/tool-args-recovery.d.ts +36 -0
- package/dist/provider/tool-args-recovery.js +91 -0
- package/dist/provider/user-id.d.ts +13 -0
- package/dist/provider/user-id.js +53 -0
- package/dist/provider/zhipu.d.ts +19 -0
- package/dist/provider/zhipu.js +32 -0
- package/dist/registry/agent.registry.d.ts +57 -0
- package/dist/registry/agent.registry.js +224 -0
- package/dist/registry/base.d.ts +54 -0
- package/dist/registry/base.js +99 -0
- package/dist/registry/channel.registry.d.ts +53 -0
- package/dist/registry/channel.registry.js +87 -0
- package/dist/registry/index.d.ts +9 -0
- package/dist/registry/index.js +10 -0
- package/dist/registry/mcp.registry.d.ts +2 -0
- package/dist/registry/mcp.registry.js +2 -0
- package/dist/registry/plugin.registry.d.ts +33 -0
- package/dist/registry/plugin.registry.js +66 -0
- package/dist/registry/provider.registry.d.ts +51 -0
- package/dist/registry/provider.registry.js +104 -0
- package/dist/registry/skill.registry.d.ts +33 -0
- package/dist/registry/skill.registry.js +95 -0
- package/dist/registry/tool.registry.d.ts +68 -0
- package/dist/registry/tool.registry.js +185 -0
- package/dist/repair/loop-guard.d.ts +98 -0
- package/dist/repair/loop-guard.js +217 -0
- package/dist/repair/scavenge.d.ts +19 -0
- package/dist/repair/scavenge.js +81 -0
- package/dist/repair/storm.d.ts +7 -0
- package/dist/repair/storm.js +7 -0
- package/dist/rollback/index.d.ts +5 -0
- package/dist/rollback/index.js +4 -0
- package/dist/rollback/rollback-tool.d.ts +13 -0
- package/dist/rollback/rollback-tool.js +167 -0
- package/dist/rollback/turn-recorder.d.ts +37 -0
- package/dist/rollback/turn-recorder.js +183 -0
- package/dist/rollback/turn-store.d.ts +29 -0
- package/dist/rollback/turn-store.js +114 -0
- package/dist/rollback/types.d.ts +51 -0
- package/dist/rollback/types.js +9 -0
- package/dist/runtime/config-center.d.ts +92 -0
- package/dist/runtime/config-center.js +467 -0
- package/dist/runtime/config-schema.d.ts +201 -0
- package/dist/runtime/config-schema.js +2 -0
- package/dist/runtime/defaults.d.ts +3 -0
- package/dist/runtime/defaults.js +146 -0
- package/dist/schedule/cron.d.ts +24 -0
- package/dist/schedule/cron.js +145 -0
- package/dist/schedule/index.d.ts +6 -0
- package/dist/schedule/index.js +4 -0
- package/dist/schedule/persistence.d.ts +33 -0
- package/dist/schedule/persistence.js +106 -0
- package/dist/schedule/scheduler.d.ts +85 -0
- package/dist/schedule/scheduler.js +630 -0
- package/dist/schedule/types.d.ts +185 -0
- package/dist/schedule/types.js +2 -0
- package/dist/setup/config.d.ts +189 -0
- package/dist/setup/config.js +253 -0
- package/dist/setup/index.d.ts +3 -0
- package/dist/setup/index.js +3 -0
- package/dist/setup/model-defaults.d.ts +13 -0
- package/dist/setup/model-defaults.js +87 -0
- package/dist/setup/persona-bootstrap.d.ts +42 -0
- package/dist/setup/persona-bootstrap.js +379 -0
- package/dist/setup/wizard.d.ts +32 -0
- package/dist/setup/wizard.js +384 -0
- package/dist/skills/index.d.ts +4 -0
- package/dist/skills/index.js +4 -0
- package/dist/skills/loader.d.ts +12 -0
- package/dist/skills/loader.js +83 -0
- package/dist/skills/registry.d.ts +2 -0
- package/dist/skills/registry.js +2 -0
- package/dist/skills/skill-tool.d.ts +20 -0
- package/dist/skills/skill-tool.js +49 -0
- package/dist/tools/archive.d.ts +17 -0
- package/dist/tools/archive.js +131 -0
- package/dist/tools/ask-user.d.ts +9 -0
- package/dist/tools/ask-user.js +62 -0
- package/dist/tools/background-registry.d.ts +45 -0
- package/dist/tools/background-registry.js +164 -0
- package/dist/tools/bash.d.ts +56 -0
- package/dist/tools/bash.js +391 -0
- package/dist/tools/bundle-registry.d.ts +42 -0
- package/dist/tools/bundle-registry.js +239 -0
- package/dist/tools/bundle-tools.d.ts +11 -0
- package/dist/tools/bundle-tools.js +168 -0
- package/dist/tools/channel-info.d.ts +5 -0
- package/dist/tools/channel-info.js +38 -0
- package/dist/tools/compression.d.ts +7 -0
- package/dist/tools/compression.js +21 -0
- package/dist/tools/config.d.ts +23 -0
- package/dist/tools/config.js +255 -0
- package/dist/tools/db-query.d.ts +12 -0
- package/dist/tools/db-query.js +107 -0
- package/dist/tools/diagnostics.d.ts +30 -0
- package/dist/tools/diagnostics.js +111 -0
- package/dist/tools/diff-channel.d.ts +9 -0
- package/dist/tools/diff-channel.js +17 -0
- package/dist/tools/diff-files.d.ts +17 -0
- package/dist/tools/diff-files.js +88 -0
- package/dist/tools/disk-usage.d.ts +34 -0
- package/dist/tools/disk-usage.js +258 -0
- package/dist/tools/edit.d.ts +30 -0
- package/dist/tools/edit.js +235 -0
- package/dist/tools/executor.d.ts +32 -0
- package/dist/tools/executor.js +66 -0
- package/dist/tools/file-tracker.d.ts +20 -0
- package/dist/tools/file-tracker.js +44 -0
- package/dist/tools/filtered-registry.d.ts +29 -0
- package/dist/tools/filtered-registry.js +50 -0
- package/dist/tools/flow.d.ts +10 -0
- package/dist/tools/flow.js +180 -0
- package/dist/tools/git-tool.d.ts +24 -0
- package/dist/tools/git-tool.js +113 -0
- package/dist/tools/glob.d.ts +29 -0
- package/dist/tools/glob.js +152 -0
- package/dist/tools/grep.d.ts +14 -0
- package/dist/tools/grep.js +325 -0
- package/dist/tools/http-request.d.ts +14 -0
- package/dist/tools/http-request.js +126 -0
- package/dist/tools/index.d.ts +43 -0
- package/dist/tools/index.js +76 -0
- package/dist/tools/injection-filter.d.ts +6 -0
- package/dist/tools/injection-filter.js +71 -0
- package/dist/tools/insert.d.ts +13 -0
- package/dist/tools/insert.js +61 -0
- package/dist/tools/interface.d.ts +30 -0
- package/dist/tools/interface.js +2 -0
- package/dist/tools/json-edit.d.ts +15 -0
- package/dist/tools/json-edit.js +122 -0
- package/dist/tools/multi-edit.d.ts +9 -0
- package/dist/tools/multi-edit.js +146 -0
- package/dist/tools/path-sandbox.d.ts +14 -0
- package/dist/tools/path-sandbox.js +60 -0
- package/dist/tools/process-tools.d.ts +15 -0
- package/dist/tools/process-tools.js +95 -0
- package/dist/tools/python-bridge/bridge.d.ts +24 -0
- package/dist/tools/python-bridge/bridge.js +39 -0
- package/dist/tools/python-bridge/executor.d.ts +6 -0
- package/dist/tools/python-bridge/executor.js +69 -0
- package/dist/tools/python-bridge/index.d.ts +5 -0
- package/dist/tools/python-bridge/index.js +4 -0
- package/dist/tools/python-bridge/parser.d.ts +21 -0
- package/dist/tools/python-bridge/parser.js +258 -0
- package/dist/tools/read.d.ts +16 -0
- package/dist/tools/read.js +276 -0
- package/dist/tools/registry.d.ts +2 -0
- package/dist/tools/registry.js +2 -0
- package/dist/tools/restart.d.ts +10 -0
- package/dist/tools/restart.js +46 -0
- package/dist/tools/result-buffer.d.ts +66 -0
- package/dist/tools/result-buffer.js +146 -0
- package/dist/tools/runtime-control.d.ts +163 -0
- package/dist/tools/runtime-control.js +1780 -0
- package/dist/tools/symbol-references.d.ts +5 -0
- package/dist/tools/symbol-references.js +331 -0
- package/dist/tools/system-info.d.ts +3 -0
- package/dist/tools/system-info.js +55 -0
- package/dist/tools/write.d.ts +18 -0
- package/dist/tools/write.js +118 -0
- package/dist/tools/xref/index.d.ts +25 -0
- package/dist/tools/xref/index.js +25 -0
- package/dist/tools/xref/manager.d.ts +85 -0
- package/dist/tools/xref/manager.js +948 -0
- package/dist/tools/xref/parser.d.ts +34 -0
- package/dist/tools/xref/parser.js +64 -0
- package/dist/tools/xref/regex-parser.d.ts +26 -0
- package/dist/tools/xref/regex-parser.js +446 -0
- package/dist/tools/xref/schema.d.ts +104 -0
- package/dist/tools/xref/schema.js +68 -0
- package/dist/tools/xref/ts-parser.d.ts +20 -0
- package/dist/tools/xref/ts-parser.js +403 -0
- package/dist/tools/xref/xref-build.d.ts +20 -0
- package/dist/tools/xref/xref-build.js +128 -0
- package/dist/tools/xref/xref-graph.d.ts +24 -0
- package/dist/tools/xref/xref-graph.js +88 -0
- package/dist/tools/xref/xref-query.d.ts +30 -0
- package/dist/tools/xref/xref-query.js +123 -0
- package/dist/types.d.ts +217 -0
- package/dist/types.js +2 -0
- package/dist/ui/assistant-message.d.ts +7 -0
- package/dist/ui/assistant-message.js +18 -0
- package/dist/ui/chat-log.d.ts +52 -0
- package/dist/ui/chat-log.js +246 -0
- package/dist/ui/command-registry.d.ts +73 -0
- package/dist/ui/command-registry.js +838 -0
- package/dist/ui/diff-component.d.ts +14 -0
- package/dist/ui/diff-component.js +42 -0
- package/dist/ui/hyperlink-markdown.d.ts +10 -0
- package/dist/ui/hyperlink-markdown.js +21 -0
- package/dist/ui/markdown-message.d.ts +10 -0
- package/dist/ui/markdown-message.js +16 -0
- package/dist/ui/osc8-hyperlinks.d.ts +4 -0
- package/dist/ui/osc8-hyperlinks.js +142 -0
- package/dist/ui/pi-tui-editor.d.ts +35 -0
- package/dist/ui/pi-tui-editor.js +79 -0
- package/dist/ui/slash-commands.d.ts +16 -0
- package/dist/ui/slash-commands.js +29 -0
- package/dist/ui/slash-panel.d.ts +54 -0
- package/dist/ui/slash-panel.js +199 -0
- package/dist/ui/theme.d.ts +120 -0
- package/dist/ui/theme.js +154 -0
- package/dist/ui/tool-display.d.ts +13 -0
- package/dist/ui/tool-display.js +85 -0
- package/dist/ui/tool-execution.d.ts +22 -0
- package/dist/ui/tool-execution.js +87 -0
- package/dist/ui/tui-formatters.d.ts +2 -0
- package/dist/ui/tui-formatters.js +145 -0
- package/dist/ui/user-message.d.ts +5 -0
- package/dist/ui/user-message.js +11 -0
- package/dist/update/check.d.ts +8 -0
- package/dist/update/check.js +28 -0
- package/dist/update/config.d.ts +6 -0
- package/dist/update/config.js +18 -0
- package/dist/update/download.d.ts +3 -0
- package/dist/update/download.js +27 -0
- package/dist/update/index.d.ts +6 -0
- package/dist/update/index.js +5 -0
- package/dist/update/install.d.ts +3 -0
- package/dist/update/install.js +33 -0
- package/dist/update/types.d.ts +16 -0
- package/dist/update/types.js +2 -0
- package/dist/utils/diff.d.ts +9 -0
- package/dist/utils/diff.js +45 -0
- package/dist/utils/misc.d.ts +12 -0
- package/dist/utils/misc.js +34 -0
- package/dist/world-engine/agent.d.ts +41 -0
- package/dist/world-engine/agent.js +385 -0
- package/dist/world-engine/index.d.ts +45 -0
- package/dist/world-engine/index.js +160 -0
- package/dist/world-engine/sim.d.ts +14 -0
- package/dist/world-engine/sim.js +120 -0
- package/dist/world-engine/store.d.ts +110 -0
- package/dist/world-engine/store.js +519 -0
- package/dist/world-engine/ticker.d.ts +37 -0
- package/dist/world-engine/ticker.js +214 -0
- package/dist/world-engine/tools.d.ts +6 -0
- package/dist/world-engine/tools.js +380 -0
- package/dist/world-engine/types.d.ts +202 -0
- package/dist/world-engine/types.js +56 -0
- package/docs/api.md +180 -0
- package/docs/architecture.md +206 -0
- package/docs/diagnostics/2026-06-08-config-prompt-guidance.md +67 -0
- package/docs/superpowers/plans/2026-06-08-global-bootstrap-mode.md +89 -0
- package/docs/superpowers/specs/2026-06-08-global-bootstrap-mode-design.md +174 -0
- package/docs/user-guide.md +226 -0
- package/package.json +63 -0
- package/plugins/example-greeter/index.js +55 -0
- package/plugins/example-greeter/plugin.json +8 -0
- package/pnpm-workspace.yaml +5 -0
- package/provider_arch.md +179 -0
- package/start-webui.sh +27 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/webui-channel-design.md +789 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Tool } from './interface.js';
|
|
2
|
+
import { GitManager } from '../evolution/git-manager.js';
|
|
3
|
+
/**
|
|
4
|
+
* GitTool — 在 Agent 工作目录中执行 Git 版本控制操作
|
|
5
|
+
*
|
|
6
|
+
* 支持 4 个 subcommand:
|
|
7
|
+
* - commit: 暂存所有变更并提交
|
|
8
|
+
* - revert: 先 stash 当前变更,再 revert 指定 commit
|
|
9
|
+
* - branch: 创建并切换到新分支
|
|
10
|
+
* - diff: 获取变更差异(支持 --stat 模式)
|
|
11
|
+
*
|
|
12
|
+
* 不在 Git 仓库中时返回友好提示。
|
|
13
|
+
* commit message 自动附加 session/turn 信息便于追溯。
|
|
14
|
+
*/
|
|
15
|
+
export declare class GitTool implements Tool {
|
|
16
|
+
readonly name = "git";
|
|
17
|
+
readonly description = "Git version control: commit, revert, branch, diff";
|
|
18
|
+
readonly inputSchema: Record<string, unknown>;
|
|
19
|
+
private gitManager;
|
|
20
|
+
private sessionId?;
|
|
21
|
+
constructor(gitManager: GitManager, sessionId?: string);
|
|
22
|
+
execute(args: Record<string, unknown>): Promise<string>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=git-tool.d.ts.map
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitTool — 在 Agent 工作目录中执行 Git 版本控制操作
|
|
3
|
+
*
|
|
4
|
+
* 支持 4 个 subcommand:
|
|
5
|
+
* - commit: 暂存所有变更并提交
|
|
6
|
+
* - revert: 先 stash 当前变更,再 revert 指定 commit
|
|
7
|
+
* - branch: 创建并切换到新分支
|
|
8
|
+
* - diff: 获取变更差异(支持 --stat 模式)
|
|
9
|
+
*
|
|
10
|
+
* 不在 Git 仓库中时返回友好提示。
|
|
11
|
+
* commit message 自动附加 session/turn 信息便于追溯。
|
|
12
|
+
*/
|
|
13
|
+
export class GitTool {
|
|
14
|
+
name = 'git';
|
|
15
|
+
description = 'Git version control: commit, revert, branch, diff';
|
|
16
|
+
inputSchema = {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
action: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
enum: ['commit', 'revert', 'branch', 'diff'],
|
|
22
|
+
description: 'Git action to execute',
|
|
23
|
+
},
|
|
24
|
+
message: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
description: 'Commit message (required for commit action)',
|
|
27
|
+
},
|
|
28
|
+
commit: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
description: 'Commit hash to revert (required for revert action)',
|
|
31
|
+
},
|
|
32
|
+
name: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
description: 'Branch name (required for branch action)',
|
|
35
|
+
},
|
|
36
|
+
stat: {
|
|
37
|
+
type: 'boolean',
|
|
38
|
+
description: 'Show diff stat instead of full diff (optional, for diff action)',
|
|
39
|
+
},
|
|
40
|
+
turn: {
|
|
41
|
+
type: 'number',
|
|
42
|
+
description: 'Current turn number, appended to commit message for traceability',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
required: ['action'],
|
|
46
|
+
};
|
|
47
|
+
gitManager;
|
|
48
|
+
sessionId;
|
|
49
|
+
constructor(gitManager, sessionId) {
|
|
50
|
+
this.gitManager = gitManager;
|
|
51
|
+
this.sessionId = sessionId;
|
|
52
|
+
}
|
|
53
|
+
async execute(args) {
|
|
54
|
+
const action = args.action;
|
|
55
|
+
// 检查是否为 Git 仓库
|
|
56
|
+
if (!(await this.gitManager.isRepo())) {
|
|
57
|
+
return '当前工作目录不在 Git 仓库中';
|
|
58
|
+
}
|
|
59
|
+
switch (action) {
|
|
60
|
+
case 'commit': {
|
|
61
|
+
const message = args.message;
|
|
62
|
+
if (!message) {
|
|
63
|
+
return "Error: 'message' parameter is required for commit action";
|
|
64
|
+
}
|
|
65
|
+
const turn = args.turn;
|
|
66
|
+
let fullMessage = message;
|
|
67
|
+
if (this.sessionId || turn !== undefined) {
|
|
68
|
+
const tags = [];
|
|
69
|
+
if (this.sessionId) {
|
|
70
|
+
tags.push(`session:${this.sessionId}`);
|
|
71
|
+
}
|
|
72
|
+
if (turn !== undefined) {
|
|
73
|
+
tags.push(`turn:${turn}`);
|
|
74
|
+
}
|
|
75
|
+
fullMessage += ` [${tags.join(' ')}]`;
|
|
76
|
+
}
|
|
77
|
+
const hash = await this.gitManager.commit(fullMessage);
|
|
78
|
+
return hash ? `Committed: ${hash}` : 'Committed (no hash returned)';
|
|
79
|
+
}
|
|
80
|
+
case 'revert': {
|
|
81
|
+
const commit = args.commit;
|
|
82
|
+
if (!commit) {
|
|
83
|
+
return "Error: 'commit' parameter is required for revert action";
|
|
84
|
+
}
|
|
85
|
+
await this.gitManager.stash();
|
|
86
|
+
const result = await this.gitManager.revertCommit(commit);
|
|
87
|
+
return result || 'Revert completed';
|
|
88
|
+
}
|
|
89
|
+
case 'branch': {
|
|
90
|
+
const name = args.name;
|
|
91
|
+
if (!name) {
|
|
92
|
+
return "Error: 'name' parameter is required for branch action";
|
|
93
|
+
}
|
|
94
|
+
await this.gitManager.createBranch(name);
|
|
95
|
+
return `Created and switched to branch: ${name}`;
|
|
96
|
+
}
|
|
97
|
+
case 'diff': {
|
|
98
|
+
const stat = args.stat;
|
|
99
|
+
if (stat) {
|
|
100
|
+
const result = await this.gitManager.diffStat();
|
|
101
|
+
return result || 'No changes';
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
const result = await this.gitManager.diff();
|
|
105
|
+
return result || 'No changes';
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
default:
|
|
109
|
+
return `Error: Unknown action '${action}'. Available actions: commit, revert, branch, diff`;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=git-tool.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Tool } from './interface.js';
|
|
2
|
+
/**
|
|
3
|
+
* GlobTool — 使用 glob 模式匹配文件路径
|
|
4
|
+
*
|
|
5
|
+
* 参数:
|
|
6
|
+
* - pattern (必需): glob 匹配模式(支持 *、**、?)
|
|
7
|
+
* - path (可选): 搜索的根目录,默认为当前工作目录
|
|
8
|
+
*
|
|
9
|
+
* 返回匹配的文件路径列表(按修改时间排序),限制最大返回数量(默认 1000)
|
|
10
|
+
*/
|
|
11
|
+
export declare class GlobTool implements Tool {
|
|
12
|
+
readonly name = "glob";
|
|
13
|
+
readonly description = "Find files matching a glob pattern. Returns paths sorted by modification time.";
|
|
14
|
+
readonly inputSchema: Record<string, unknown>;
|
|
15
|
+
execute(args: Record<string, unknown>): Promise<string>;
|
|
16
|
+
/**
|
|
17
|
+
* 递归遍历目录,返回相对路径列表
|
|
18
|
+
*/
|
|
19
|
+
private walkDir;
|
|
20
|
+
/**
|
|
21
|
+
* 将 glob 模式转换为正则表达式
|
|
22
|
+
* 支持:
|
|
23
|
+
* - ** 匹配任意路径层级
|
|
24
|
+
* - * 匹配单层内的任意字符
|
|
25
|
+
* - ? 匹配单个字符
|
|
26
|
+
*/
|
|
27
|
+
private globToRegex;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=glob.d.ts.map
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { promises as fs } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
/**
|
|
4
|
+
* GlobTool — 使用 glob 模式匹配文件路径
|
|
5
|
+
*
|
|
6
|
+
* 参数:
|
|
7
|
+
* - pattern (必需): glob 匹配模式(支持 *、**、?)
|
|
8
|
+
* - path (可选): 搜索的根目录,默认为当前工作目录
|
|
9
|
+
*
|
|
10
|
+
* 返回匹配的文件路径列表(按修改时间排序),限制最大返回数量(默认 1000)
|
|
11
|
+
*/
|
|
12
|
+
export class GlobTool {
|
|
13
|
+
name = 'glob';
|
|
14
|
+
description = 'Find files matching a glob pattern. Returns paths sorted by modification time.';
|
|
15
|
+
inputSchema = {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {
|
|
18
|
+
pattern: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: 'The glob pattern to match files against (e.g., "**/*.ts", "src/**/*.js")',
|
|
21
|
+
},
|
|
22
|
+
path: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
description: 'The directory to search in. REQUIRED — always pass the project root directory (where package.json/tsconfig.json/etc. lives).',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
required: ['pattern', 'path'],
|
|
28
|
+
};
|
|
29
|
+
async execute(args) {
|
|
30
|
+
const pattern = args.pattern;
|
|
31
|
+
if (!pattern)
|
|
32
|
+
return '错误:缺少 pattern 参数。请提供文件名匹配模式,例如 "**/*.ts"。';
|
|
33
|
+
const searchPath = args.path;
|
|
34
|
+
// 验证搜索路径
|
|
35
|
+
try {
|
|
36
|
+
const stat = await fs.stat(searchPath);
|
|
37
|
+
if (!stat.isDirectory()) {
|
|
38
|
+
throw new Error(`Path is not a directory: ${searchPath}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if (error instanceof Error && error.message.startsWith('Path is not a directory')) {
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
throw new Error(`Directory not found: ${searchPath}`);
|
|
46
|
+
}
|
|
47
|
+
// 递归遍历目录获取所有文件
|
|
48
|
+
const files = await this.walkDir(searchPath);
|
|
49
|
+
// 将 glob 模式转换为正则表达式并匹配
|
|
50
|
+
const regex = this.globToRegex(pattern);
|
|
51
|
+
const matches = files.filter((f) => regex.test(f.replace(/\\/g, '/')));
|
|
52
|
+
if (matches.length === 0) {
|
|
53
|
+
return 'No files matched the pattern';
|
|
54
|
+
}
|
|
55
|
+
// 获取文件修改时间并排序
|
|
56
|
+
const withStats = await Promise.all(matches.map(async (relativePath) => {
|
|
57
|
+
const fullPath = path.join(searchPath, relativePath);
|
|
58
|
+
try {
|
|
59
|
+
const stat = await fs.stat(fullPath);
|
|
60
|
+
return { path: fullPath, mtime: stat.mtime.getTime() };
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return { path: fullPath, mtime: 0 };
|
|
64
|
+
}
|
|
65
|
+
}));
|
|
66
|
+
// 按修改时间降序排列(最新的在前)
|
|
67
|
+
withStats.sort((a, b) => b.mtime - a.mtime);
|
|
68
|
+
// 限制返回数量
|
|
69
|
+
const limited = withStats.slice(0, 1000);
|
|
70
|
+
return limited.map((item) => item.path).join('\n');
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* 递归遍历目录,返回相对路径列表
|
|
74
|
+
*/
|
|
75
|
+
async walkDir(dir, basePath = '') {
|
|
76
|
+
const results = [];
|
|
77
|
+
let entries;
|
|
78
|
+
try {
|
|
79
|
+
entries = await fs.readdir(dir, { withFileTypes: true });
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return results;
|
|
83
|
+
}
|
|
84
|
+
for (const entry of entries) {
|
|
85
|
+
const relativePath = basePath ? path.posix.join(basePath, entry.name) : entry.name;
|
|
86
|
+
const fullPath = path.join(dir, entry.name);
|
|
87
|
+
if (entry.isDirectory()) {
|
|
88
|
+
const subResults = await this.walkDir(fullPath, relativePath);
|
|
89
|
+
results.push(...subResults);
|
|
90
|
+
}
|
|
91
|
+
else if (entry.isFile()) {
|
|
92
|
+
results.push(relativePath);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return results;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* 将 glob 模式转换为正则表达式
|
|
99
|
+
* 支持:
|
|
100
|
+
* - ** 匹配任意路径层级
|
|
101
|
+
* - * 匹配单层内的任意字符
|
|
102
|
+
* - ? 匹配单个字符
|
|
103
|
+
*/
|
|
104
|
+
globToRegex(pattern) {
|
|
105
|
+
// 统一路径分隔符
|
|
106
|
+
const normalized = pattern.replace(/\\/g, '/');
|
|
107
|
+
let regex = '';
|
|
108
|
+
let i = 0;
|
|
109
|
+
while (i < normalized.length) {
|
|
110
|
+
const c = normalized[i];
|
|
111
|
+
if (c === '*') {
|
|
112
|
+
if (normalized[i + 1] === '*') {
|
|
113
|
+
if (normalized[i + 2] === '/') {
|
|
114
|
+
// **/ — 匹配零或多个目录层级
|
|
115
|
+
regex += '(?:[^/]*/)*';
|
|
116
|
+
i += 3;
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
// ** — 匹配任意字符(含路径分隔符)
|
|
120
|
+
regex += '.*';
|
|
121
|
+
i += 2;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
// * — 匹配单层内的任意字符
|
|
126
|
+
regex += '[^/]*';
|
|
127
|
+
i++;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else if (c === '?') {
|
|
131
|
+
// ? — 匹配单个非路径分隔符字符
|
|
132
|
+
regex += '[^/]';
|
|
133
|
+
i++;
|
|
134
|
+
}
|
|
135
|
+
else if (c === '/') {
|
|
136
|
+
regex += '/';
|
|
137
|
+
i++;
|
|
138
|
+
}
|
|
139
|
+
else if ('.+^${}()|[]\\'.includes(c)) {
|
|
140
|
+
// 转义正则特殊字符
|
|
141
|
+
regex += '\\' + c;
|
|
142
|
+
i++;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
regex += c;
|
|
146
|
+
i++;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return new RegExp('^' + regex + '$');
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=glob.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Tool } from './interface.js';
|
|
2
|
+
export type GrepOutputMode = 'content' | 'files_with_matches' | 'count';
|
|
3
|
+
export declare class GrepTool implements Tool {
|
|
4
|
+
readonly name = "grep";
|
|
5
|
+
readonly description = "Search file contents with regex patterns (ripgrep). Supports file type filtering, context lines, and multiline mode.";
|
|
6
|
+
readonly inputSchema: Record<string, unknown>;
|
|
7
|
+
execute(args: Record<string, unknown>): Promise<string>;
|
|
8
|
+
private searchInFile;
|
|
9
|
+
private formatResults;
|
|
10
|
+
private walkDir;
|
|
11
|
+
private isBinaryExtension;
|
|
12
|
+
private globToRegex;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=grep.d.ts.map
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import { promises as fs } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
const MAX_FILE_SIZE = 1024 * 1024;
|
|
4
|
+
const DEFAULT_HEAD_LIMIT = 2000; // ToolResultBuffer handles context protection
|
|
5
|
+
export class GrepTool {
|
|
6
|
+
name = 'grep';
|
|
7
|
+
description = 'Search file contents with regex patterns (ripgrep). Supports file type filtering, context lines, and multiline mode.';
|
|
8
|
+
inputSchema = {
|
|
9
|
+
type: 'object',
|
|
10
|
+
properties: {
|
|
11
|
+
pattern: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
description: 'The regular expression pattern to search for in file contents.',
|
|
14
|
+
},
|
|
15
|
+
path: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
description: 'Directory or file to search in. REQUIRED — always pass the project root directory (where package.json/tsconfig.json/etc. lives). Searches recursively.',
|
|
18
|
+
},
|
|
19
|
+
glob: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
description: 'Glob pattern to filter files (e.g. "*.js", "*.{ts,tsx}"). Only files matching this pattern will be searched.',
|
|
22
|
+
},
|
|
23
|
+
output_mode: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
enum: ['content', 'files_with_matches', 'count'],
|
|
26
|
+
description: 'Output mode: "content" shows matching lines (supports -A/-B/-C context, -n line numbers, head_limit), "files_with_matches" shows file paths (supports head_limit), "count" shows match counts (supports head_limit). Defaults to "files_with_matches".',
|
|
27
|
+
},
|
|
28
|
+
'-i': {
|
|
29
|
+
type: 'boolean',
|
|
30
|
+
description: 'Case insensitive search. Default: false.',
|
|
31
|
+
},
|
|
32
|
+
'-n': {
|
|
33
|
+
type: 'boolean',
|
|
34
|
+
description: 'Show line numbers in output. Default: true for content mode.',
|
|
35
|
+
},
|
|
36
|
+
'-A': {
|
|
37
|
+
type: 'number',
|
|
38
|
+
description: 'Number of lines to show after each match.',
|
|
39
|
+
},
|
|
40
|
+
'-B': {
|
|
41
|
+
type: 'number',
|
|
42
|
+
description: 'Number of lines to show before each match.',
|
|
43
|
+
},
|
|
44
|
+
'-C': {
|
|
45
|
+
type: 'number',
|
|
46
|
+
description: 'Number of lines to show before and after each match. Shorthand for -A N -B N.',
|
|
47
|
+
},
|
|
48
|
+
head_limit: {
|
|
49
|
+
type: 'number',
|
|
50
|
+
description: 'Limit output to first N lines/entries.',
|
|
51
|
+
},
|
|
52
|
+
multiline: {
|
|
53
|
+
type: 'boolean',
|
|
54
|
+
description: 'Enable multiline mode where . matches newlines and patterns can span lines. Default: false.',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
required: ['pattern', 'path'],
|
|
58
|
+
};
|
|
59
|
+
async execute(args) {
|
|
60
|
+
const pattern = args.pattern;
|
|
61
|
+
if (!pattern)
|
|
62
|
+
return '错误:缺少 pattern 参数。请提供正则表达式搜索模式。';
|
|
63
|
+
const searchPath = args.path;
|
|
64
|
+
const glob = args.glob;
|
|
65
|
+
const outputMode = args.output_mode ?? 'files_with_matches';
|
|
66
|
+
const caseInsensitive = args['-i'] ?? false;
|
|
67
|
+
const showLineNumbers = args['-n'] ?? true;
|
|
68
|
+
const contextAfter = args['-A'] ?? args['-C'] ?? 0;
|
|
69
|
+
const contextBefore = args['-B'] ?? args['-C'] ?? 0;
|
|
70
|
+
const headLimit = args.head_limit ?? DEFAULT_HEAD_LIMIT;
|
|
71
|
+
const multiline = args.multiline ?? false;
|
|
72
|
+
let flags = 'g';
|
|
73
|
+
if (caseInsensitive)
|
|
74
|
+
flags += 'i';
|
|
75
|
+
if (multiline)
|
|
76
|
+
flags += 's';
|
|
77
|
+
let regex;
|
|
78
|
+
try {
|
|
79
|
+
regex = new RegExp(pattern, flags);
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
throw new Error(`Invalid regex pattern: ${err.message}`);
|
|
83
|
+
}
|
|
84
|
+
let stat;
|
|
85
|
+
try {
|
|
86
|
+
stat = await fs.stat(searchPath);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
throw new Error(`Path not found: ${searchPath}`);
|
|
90
|
+
}
|
|
91
|
+
if (stat.isFile()) {
|
|
92
|
+
return await this.searchInFile(searchPath, regex, outputMode, showLineNumbers, contextBefore, contextAfter, headLimit);
|
|
93
|
+
}
|
|
94
|
+
if (!stat.isDirectory()) {
|
|
95
|
+
throw new Error(`Path is not a file or directory: ${searchPath}`);
|
|
96
|
+
}
|
|
97
|
+
const allFiles = await this.walkDir(searchPath);
|
|
98
|
+
const files = glob ? allFiles.filter((f) => this.globToRegex(glob).test(f)) : allFiles;
|
|
99
|
+
if (files.length === 0) {
|
|
100
|
+
return 'No files matched the search criteria';
|
|
101
|
+
}
|
|
102
|
+
const results = [];
|
|
103
|
+
for (const relativePath of files) {
|
|
104
|
+
const fullPath = path.join(searchPath, relativePath);
|
|
105
|
+
try {
|
|
106
|
+
const fileStat = await fs.stat(fullPath);
|
|
107
|
+
if (!fileStat.isFile() || fileStat.size > MAX_FILE_SIZE)
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
try {
|
|
114
|
+
const content = await fs.readFile(fullPath, 'utf-8');
|
|
115
|
+
const allLines = content.split('\n');
|
|
116
|
+
const matches = [];
|
|
117
|
+
allLines.forEach((line, idx) => {
|
|
118
|
+
let match;
|
|
119
|
+
regex.lastIndex = 0;
|
|
120
|
+
while ((match = regex.exec(line)) !== null) {
|
|
121
|
+
matches.push({
|
|
122
|
+
lineNumber: idx + 1,
|
|
123
|
+
matchIndex: match.index,
|
|
124
|
+
matchLength: match[0].length,
|
|
125
|
+
});
|
|
126
|
+
if (match[0].length === 0)
|
|
127
|
+
regex.lastIndex++;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
if (matches.length > 0) {
|
|
131
|
+
results.push({ filePath: fullPath, matches, allLines });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return this.formatResults(results, outputMode, showLineNumbers, contextBefore, contextAfter, headLimit);
|
|
139
|
+
}
|
|
140
|
+
async searchInFile(filePath, regex, outputMode, showLineNumbers, contextBefore, contextAfter, headLimit) {
|
|
141
|
+
try {
|
|
142
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
143
|
+
const allLines = content.split('\n');
|
|
144
|
+
const matches = [];
|
|
145
|
+
allLines.forEach((line, idx) => {
|
|
146
|
+
let match;
|
|
147
|
+
regex.lastIndex = 0;
|
|
148
|
+
while ((match = regex.exec(line)) !== null) {
|
|
149
|
+
matches.push({
|
|
150
|
+
lineNumber: idx + 1,
|
|
151
|
+
matchIndex: match.index,
|
|
152
|
+
matchLength: match[0].length,
|
|
153
|
+
});
|
|
154
|
+
if (match[0].length === 0)
|
|
155
|
+
regex.lastIndex++;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
if (matches.length === 0) {
|
|
159
|
+
return `No matches found for pattern in ${filePath}`;
|
|
160
|
+
}
|
|
161
|
+
return this.formatResults([{ filePath, matches, allLines }], outputMode, showLineNumbers, contextBefore, contextAfter, headLimit);
|
|
162
|
+
}
|
|
163
|
+
catch (err) {
|
|
164
|
+
throw new Error(`Error searching file ${filePath}: ${err.message}`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
formatResults(results, outputMode, showLineNumbers, contextBefore, contextAfter, headLimit) {
|
|
168
|
+
if (results.length === 0) {
|
|
169
|
+
return 'No matches found';
|
|
170
|
+
}
|
|
171
|
+
if (outputMode === 'count') {
|
|
172
|
+
const lines = [];
|
|
173
|
+
let entryCount = 0;
|
|
174
|
+
for (const r of results) {
|
|
175
|
+
entryCount++;
|
|
176
|
+
if (entryCount > headLimit)
|
|
177
|
+
break;
|
|
178
|
+
lines.push(`${r.filePath}:${r.matches.length}`);
|
|
179
|
+
}
|
|
180
|
+
if (results.length > headLimit) {
|
|
181
|
+
lines.push(`... (${results.length - headLimit} more files)`);
|
|
182
|
+
}
|
|
183
|
+
return lines.join('\n');
|
|
184
|
+
}
|
|
185
|
+
if (outputMode === 'files_with_matches') {
|
|
186
|
+
const lines = [];
|
|
187
|
+
let entryCount = 0;
|
|
188
|
+
for (const r of results) {
|
|
189
|
+
entryCount++;
|
|
190
|
+
if (entryCount > headLimit)
|
|
191
|
+
break;
|
|
192
|
+
lines.push(r.filePath);
|
|
193
|
+
}
|
|
194
|
+
if (results.length > headLimit) {
|
|
195
|
+
lines.push(`... (${results.length - headLimit} more files)`);
|
|
196
|
+
}
|
|
197
|
+
return lines.join('\n');
|
|
198
|
+
}
|
|
199
|
+
const parts = [];
|
|
200
|
+
let totalLines = 0;
|
|
201
|
+
for (const result of results) {
|
|
202
|
+
if (totalLines >= headLimit)
|
|
203
|
+
break;
|
|
204
|
+
const multiFile = results.length > 1;
|
|
205
|
+
if (multiFile) {
|
|
206
|
+
parts.push(`--- ${result.filePath}`);
|
|
207
|
+
totalLines++;
|
|
208
|
+
}
|
|
209
|
+
const seenLines = new Set();
|
|
210
|
+
const maxLineNum = Math.max(...result.matches.map((m) => m.lineNumber + contextAfter));
|
|
211
|
+
const width = String(maxLineNum).length;
|
|
212
|
+
for (const match of result.matches) {
|
|
213
|
+
if (totalLines >= headLimit)
|
|
214
|
+
break;
|
|
215
|
+
if (seenLines.has(match.lineNumber))
|
|
216
|
+
continue;
|
|
217
|
+
seenLines.add(match.lineNumber);
|
|
218
|
+
const startLine = Math.max(1, match.lineNumber - contextBefore);
|
|
219
|
+
const endLine = Math.min(result.allLines.length, match.lineNumber + contextAfter);
|
|
220
|
+
if (startLine > 1 && contextBefore > 0) {
|
|
221
|
+
parts.push('---');
|
|
222
|
+
totalLines++;
|
|
223
|
+
}
|
|
224
|
+
for (let l = startLine; l <= endLine; l++) {
|
|
225
|
+
if (totalLines >= headLimit) {
|
|
226
|
+
if (parts[parts.length - 1] !== '... (output truncated)') {
|
|
227
|
+
parts.push('... (output truncated)');
|
|
228
|
+
}
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
const lineContent = result.allLines[l - 1] ?? '';
|
|
232
|
+
const prefix = showLineNumbers
|
|
233
|
+
? `${String(l).padStart(width)}${l === match.lineNumber ? ':' : '-'}`
|
|
234
|
+
: '';
|
|
235
|
+
parts.push(`${prefix}${lineContent}`);
|
|
236
|
+
totalLines++;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return parts.join('\n');
|
|
241
|
+
}
|
|
242
|
+
async walkDir(dir, basePath = '') {
|
|
243
|
+
const results = [];
|
|
244
|
+
let entries;
|
|
245
|
+
try {
|
|
246
|
+
entries = await fs.readdir(dir, { withFileTypes: true });
|
|
247
|
+
}
|
|
248
|
+
catch {
|
|
249
|
+
return results;
|
|
250
|
+
}
|
|
251
|
+
for (const entry of entries) {
|
|
252
|
+
if (entry.name.startsWith('.') && entry.name !== '.')
|
|
253
|
+
continue;
|
|
254
|
+
const relativePath = basePath ? path.posix.join(basePath, entry.name) : entry.name;
|
|
255
|
+
const fullPath = path.join(dir, entry.name);
|
|
256
|
+
if (entry.isDirectory()) {
|
|
257
|
+
if (entry.name === 'node_modules' || entry.name === '.git' || entry.name === 'dist' || entry.name === 'build')
|
|
258
|
+
continue;
|
|
259
|
+
const subResults = await this.walkDir(fullPath, relativePath);
|
|
260
|
+
results.push(...subResults);
|
|
261
|
+
}
|
|
262
|
+
else if (entry.isFile()) {
|
|
263
|
+
if (this.isBinaryExtension(entry.name))
|
|
264
|
+
continue;
|
|
265
|
+
results.push(relativePath);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return results;
|
|
269
|
+
}
|
|
270
|
+
isBinaryExtension(filename) {
|
|
271
|
+
const ext = path.extname(filename).toLowerCase();
|
|
272
|
+
const binaryExts = new Set([
|
|
273
|
+
'.exe', '.dll', '.so', '.dylib', '.bin', '.obj', '.o',
|
|
274
|
+
'.png', '.jpg', '.jpeg', '.gif', '.bmp', '.ico', '.webp', '.svg',
|
|
275
|
+
'.mp3', '.mp4', '.avi', '.mov', '.wmv', '.flv', '.mkv',
|
|
276
|
+
'.zip', '.tar', '.gz', '.bz2', '.7z', '.rar',
|
|
277
|
+
'.ttf', '.otf', '.woff', '.woff2',
|
|
278
|
+
'.pdf', '.doc', '.docx', '.xls', '.xlsx',
|
|
279
|
+
'.pyc', '.class', '.wasm', '.min.js',
|
|
280
|
+
]);
|
|
281
|
+
return binaryExts.has(ext);
|
|
282
|
+
}
|
|
283
|
+
globToRegex(pattern) {
|
|
284
|
+
const normalized = pattern.replace(/\\/g, '/');
|
|
285
|
+
let regexStr = '';
|
|
286
|
+
let i = 0;
|
|
287
|
+
while (i < normalized.length) {
|
|
288
|
+
const c = normalized[i];
|
|
289
|
+
if (c === '*') {
|
|
290
|
+
if (normalized[i + 1] === '*') {
|
|
291
|
+
if (normalized[i + 2] === '/') {
|
|
292
|
+
regexStr += '(?:.+/)?';
|
|
293
|
+
i += 3;
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
regexStr += '.*';
|
|
297
|
+
i += 2;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
regexStr += '[^/]*';
|
|
302
|
+
i++;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
else if (c === '?') {
|
|
306
|
+
regexStr += '[^/]';
|
|
307
|
+
i++;
|
|
308
|
+
}
|
|
309
|
+
else if (c === '/') {
|
|
310
|
+
regexStr += '/';
|
|
311
|
+
i++;
|
|
312
|
+
}
|
|
313
|
+
else if ('.+^${}()|[]\\'.includes(c)) {
|
|
314
|
+
regexStr += '\\' + c;
|
|
315
|
+
i++;
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
regexStr += c;
|
|
319
|
+
i++;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return new RegExp('^' + regexStr + '$');
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
//# sourceMappingURL=grep.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Tool } from './interface.js';
|
|
2
|
+
/**
|
|
3
|
+
* HttpRequestTool — HTTP 客户端,支持 GET/POST/PUT/DELETE。
|
|
4
|
+
* 轻量爬虫 + API 调试。
|
|
5
|
+
*/
|
|
6
|
+
export declare class HttpRequestTool implements Tool {
|
|
7
|
+
readonly name = "http_request";
|
|
8
|
+
readonly description: string;
|
|
9
|
+
readonly inputSchema: Record<string, unknown>;
|
|
10
|
+
private static readonly DEFAULT_UA;
|
|
11
|
+
private static readonly MAX_RESPONSE_BYTES;
|
|
12
|
+
execute(args: Record<string, unknown>): Promise<string>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=http-request.d.ts.map
|