qlogicagent 0.1.0
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 +45 -0
- package/dist/agent/agent.d.ts +44 -0
- package/dist/agent/agent.d.ts.map +1 -0
- package/dist/agent/agent.js +114 -0
- package/dist/agent/agent.js.map +1 -0
- package/dist/agent/tool-loop.d.ts +65 -0
- package/dist/agent/tool-loop.d.ts.map +1 -0
- package/dist/agent/tool-loop.js +576 -0
- package/dist/agent/tool-loop.js.map +1 -0
- package/dist/agent/types.d.ts +176 -0
- package/dist/agent/types.d.ts.map +1 -0
- package/dist/agent/types.js +15 -0
- package/dist/agent/types.js.map +1 -0
- package/dist/cli/main.d.ts +12 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +24 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/stdio-server.d.ts +46 -0
- package/dist/cli/stdio-server.d.ts.map +1 -0
- package/dist/cli/stdio-server.js +464 -0
- package/dist/cli/stdio-server.js.map +1 -0
- package/dist/config/config.d.ts +18 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +22 -0
- package/dist/config/config.js.map +1 -0
- package/dist/contracts/hooks.d.ts +121 -0
- package/dist/contracts/hooks.d.ts.map +1 -0
- package/dist/contracts/hooks.js +8 -0
- package/dist/contracts/hooks.js.map +1 -0
- package/dist/contracts/index.d.ts +11 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +11 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/planner.d.ts +36 -0
- package/dist/contracts/planner.d.ts.map +1 -0
- package/dist/contracts/planner.js +3 -0
- package/dist/contracts/planner.js.map +1 -0
- package/dist/contracts/skill-candidate.d.ts +64 -0
- package/dist/contracts/skill-candidate.d.ts.map +1 -0
- package/dist/contracts/skill-candidate.js +196 -0
- package/dist/contracts/skill-candidate.js.map +1 -0
- package/dist/contracts/todo.d.ts +15 -0
- package/dist/contracts/todo.d.ts.map +1 -0
- package/dist/contracts/todo.js +10 -0
- package/dist/contracts/todo.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/llm/builtin-providers.d.ts +11 -0
- package/dist/llm/builtin-providers.d.ts.map +1 -0
- package/dist/llm/builtin-providers.js +532 -0
- package/dist/llm/builtin-providers.js.map +1 -0
- package/dist/llm/index.d.ts +16 -0
- package/dist/llm/index.d.ts.map +1 -0
- package/dist/llm/index.js +15 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/llm/llm-client.d.ts +44 -0
- package/dist/llm/llm-client.d.ts.map +1 -0
- package/dist/llm/llm-client.js +68 -0
- package/dist/llm/llm-client.js.map +1 -0
- package/dist/llm/model-catalog.d.ts +54 -0
- package/dist/llm/model-catalog.d.ts.map +1 -0
- package/dist/llm/model-catalog.js +192 -0
- package/dist/llm/model-catalog.js.map +1 -0
- package/dist/llm/provider-def.d.ts +60 -0
- package/dist/llm/provider-def.d.ts.map +1 -0
- package/dist/llm/provider-def.js +13 -0
- package/dist/llm/provider-def.js.map +1 -0
- package/dist/llm/provider-registry.d.ts +55 -0
- package/dist/llm/provider-registry.d.ts.map +1 -0
- package/dist/llm/provider-registry.js +148 -0
- package/dist/llm/provider-registry.js.map +1 -0
- package/dist/llm/transport.d.ts +63 -0
- package/dist/llm/transport.d.ts.map +1 -0
- package/dist/llm/transport.js +28 -0
- package/dist/llm/transport.js.map +1 -0
- package/dist/llm/transports/anthropic-messages.d.ts +32 -0
- package/dist/llm/transports/anthropic-messages.d.ts.map +1 -0
- package/dist/llm/transports/anthropic-messages.js +294 -0
- package/dist/llm/transports/anthropic-messages.js.map +1 -0
- package/dist/llm/transports/openai-chat.d.ts +37 -0
- package/dist/llm/transports/openai-chat.d.ts.map +1 -0
- package/dist/llm/transports/openai-chat.js +166 -0
- package/dist/llm/transports/openai-chat.js.map +1 -0
- package/dist/orchestration/agent-registry.d.ts +42 -0
- package/dist/orchestration/agent-registry.d.ts.map +1 -0
- package/dist/orchestration/agent-registry.js +117 -0
- package/dist/orchestration/agent-registry.js.map +1 -0
- package/dist/orchestration/approval-aware-tool-plan.d.ts +33 -0
- package/dist/orchestration/approval-aware-tool-plan.d.ts.map +1 -0
- package/dist/orchestration/approval-aware-tool-plan.js +88 -0
- package/dist/orchestration/approval-aware-tool-plan.js.map +1 -0
- package/dist/orchestration/context-compression.d.ts +221 -0
- package/dist/orchestration/context-compression.d.ts.map +1 -0
- package/dist/orchestration/context-compression.js +584 -0
- package/dist/orchestration/context-compression.js.map +1 -0
- package/dist/orchestration/conversation-repair.d.ts +62 -0
- package/dist/orchestration/conversation-repair.d.ts.map +1 -0
- package/dist/orchestration/conversation-repair.js +430 -0
- package/dist/orchestration/conversation-repair.js.map +1 -0
- package/dist/orchestration/curator-scheduler.d.ts +120 -0
- package/dist/orchestration/curator-scheduler.d.ts.map +1 -0
- package/dist/orchestration/curator-scheduler.js +136 -0
- package/dist/orchestration/curator-scheduler.js.map +1 -0
- package/dist/orchestration/embedded-failover-policy.d.ts +111 -0
- package/dist/orchestration/embedded-failover-policy.d.ts.map +1 -0
- package/dist/orchestration/embedded-failover-policy.js +169 -0
- package/dist/orchestration/embedded-failover-policy.js.map +1 -0
- package/dist/orchestration/error-classification.d.ts +13 -0
- package/dist/orchestration/error-classification.d.ts.map +1 -0
- package/dist/orchestration/error-classification.js +78 -0
- package/dist/orchestration/error-classification.js.map +1 -0
- package/dist/orchestration/failover-classification.d.ts +9 -0
- package/dist/orchestration/failover-classification.d.ts.map +1 -0
- package/dist/orchestration/failover-classification.js +382 -0
- package/dist/orchestration/failover-classification.js.map +1 -0
- package/dist/orchestration/failover-error.d.ts +34 -0
- package/dist/orchestration/failover-error.d.ts.map +1 -0
- package/dist/orchestration/failover-error.js +199 -0
- package/dist/orchestration/failover-error.js.map +1 -0
- package/dist/orchestration/fork-subagent.d.ts +101 -0
- package/dist/orchestration/fork-subagent.d.ts.map +1 -0
- package/dist/orchestration/fork-subagent.js +99 -0
- package/dist/orchestration/fork-subagent.js.map +1 -0
- package/dist/orchestration/index.d.ts +121 -0
- package/dist/orchestration/index.d.ts.map +1 -0
- package/dist/orchestration/index.js +268 -0
- package/dist/orchestration/index.js.map +1 -0
- package/dist/orchestration/memory-flush-policy.d.ts +58 -0
- package/dist/orchestration/memory-flush-policy.d.ts.map +1 -0
- package/dist/orchestration/memory-flush-policy.js +86 -0
- package/dist/orchestration/memory-flush-policy.js.map +1 -0
- package/dist/orchestration/memory-provider.d.ts +15 -0
- package/dist/orchestration/memory-provider.d.ts.map +1 -0
- package/dist/orchestration/memory-provider.js +3 -0
- package/dist/orchestration/memory-provider.js.map +1 -0
- package/dist/orchestration/parallel-tool-calls.d.ts +42 -0
- package/dist/orchestration/parallel-tool-calls.d.ts.map +1 -0
- package/dist/orchestration/parallel-tool-calls.js +60 -0
- package/dist/orchestration/parallel-tool-calls.js.map +1 -0
- package/dist/orchestration/prompt-cache-strategy.d.ts +127 -0
- package/dist/orchestration/prompt-cache-strategy.d.ts.map +1 -0
- package/dist/orchestration/prompt-cache-strategy.js +229 -0
- package/dist/orchestration/prompt-cache-strategy.js.map +1 -0
- package/dist/orchestration/reactive-compact.d.ts +74 -0
- package/dist/orchestration/reactive-compact.d.ts.map +1 -0
- package/dist/orchestration/reactive-compact.js +79 -0
- package/dist/orchestration/reactive-compact.js.map +1 -0
- package/dist/orchestration/retry-loop.d.ts +23 -0
- package/dist/orchestration/retry-loop.d.ts.map +1 -0
- package/dist/orchestration/retry-loop.js +25 -0
- package/dist/orchestration/retry-loop.js.map +1 -0
- package/dist/orchestration/skill-candidate.d.ts +53 -0
- package/dist/orchestration/skill-candidate.d.ts.map +1 -0
- package/dist/orchestration/skill-candidate.js +142 -0
- package/dist/orchestration/skill-candidate.js.map +1 -0
- package/dist/orchestration/skill-consolidation.d.ts +124 -0
- package/dist/orchestration/skill-consolidation.d.ts.map +1 -0
- package/dist/orchestration/skill-consolidation.js +221 -0
- package/dist/orchestration/skill-consolidation.js.map +1 -0
- package/dist/orchestration/skill-improvement.d.ts +60 -0
- package/dist/orchestration/skill-improvement.d.ts.map +1 -0
- package/dist/orchestration/skill-improvement.js +67 -0
- package/dist/orchestration/skill-improvement.js.map +1 -0
- package/dist/orchestration/skill-similarity.d.ts +99 -0
- package/dist/orchestration/skill-similarity.d.ts.map +1 -0
- package/dist/orchestration/skill-similarity.js +132 -0
- package/dist/orchestration/skill-similarity.js.map +1 -0
- package/dist/orchestration/streaming-tool-executor.d.ts +74 -0
- package/dist/orchestration/streaming-tool-executor.d.ts.map +1 -0
- package/dist/orchestration/streaming-tool-executor.js +97 -0
- package/dist/orchestration/streaming-tool-executor.js.map +1 -0
- package/dist/orchestration/team-orchestration.d.ts +196 -0
- package/dist/orchestration/team-orchestration.d.ts.map +1 -0
- package/dist/orchestration/team-orchestration.js +370 -0
- package/dist/orchestration/team-orchestration.js.map +1 -0
- package/dist/orchestration/team-tool-loop-wiring.d.ts +93 -0
- package/dist/orchestration/team-tool-loop-wiring.d.ts.map +1 -0
- package/dist/orchestration/team-tool-loop-wiring.js +148 -0
- package/dist/orchestration/team-tool-loop-wiring.js.map +1 -0
- package/dist/orchestration/tool-choice-policy.d.ts +55 -0
- package/dist/orchestration/tool-choice-policy.d.ts.map +1 -0
- package/dist/orchestration/tool-choice-policy.js +165 -0
- package/dist/orchestration/tool-choice-policy.js.map +1 -0
- package/dist/orchestration/tool-loop-state.d.ts +51 -0
- package/dist/orchestration/tool-loop-state.d.ts.map +1 -0
- package/dist/orchestration/tool-loop-state.js +134 -0
- package/dist/orchestration/tool-loop-state.js.map +1 -0
- package/dist/orchestration/tool-schema.d.ts +40 -0
- package/dist/orchestration/tool-schema.d.ts.map +1 -0
- package/dist/orchestration/tool-schema.js +298 -0
- package/dist/orchestration/tool-schema.js.map +1 -0
- package/dist/orchestration/transcript-repair.d.ts +43 -0
- package/dist/orchestration/transcript-repair.d.ts.map +1 -0
- package/dist/orchestration/transcript-repair.js +427 -0
- package/dist/orchestration/transcript-repair.js.map +1 -0
- package/dist/orchestration/turn-loop-guard.d.ts +87 -0
- package/dist/orchestration/turn-loop-guard.d.ts.map +1 -0
- package/dist/orchestration/turn-loop-guard.js +93 -0
- package/dist/orchestration/turn-loop-guard.js.map +1 -0
- package/dist/orchestration/web-browser-policy.d.ts +18 -0
- package/dist/orchestration/web-browser-policy.d.ts.map +1 -0
- package/dist/orchestration/web-browser-policy.js +40 -0
- package/dist/orchestration/web-browser-policy.js.map +1 -0
- package/dist/runtime/context-compression.d.ts +62 -0
- package/dist/runtime/context-compression.d.ts.map +1 -0
- package/dist/runtime/context-compression.js +275 -0
- package/dist/runtime/context-compression.js.map +1 -0
- package/dist/runtime/hook-registry.d.ts +13 -0
- package/dist/runtime/hook-registry.d.ts.map +1 -0
- package/dist/runtime/hook-registry.js +54 -0
- package/dist/runtime/hook-registry.js.map +1 -0
- package/dist/runtime/memory-hooks.d.ts +24 -0
- package/dist/runtime/memory-hooks.d.ts.map +1 -0
- package/dist/runtime/memory-hooks.js +66 -0
- package/dist/runtime/memory-hooks.js.map +1 -0
- package/dist/runtime/tool-eligibility.d.ts +60 -0
- package/dist/runtime/tool-eligibility.d.ts.map +1 -0
- package/dist/runtime/tool-eligibility.js +112 -0
- package/dist/runtime/tool-eligibility.js.map +1 -0
- package/dist/skills/index.d.ts +109 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +83 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/memory-extractor.d.ts +65 -0
- package/dist/skills/memory-extractor.d.ts.map +1 -0
- package/dist/skills/memory-extractor.js +174 -0
- package/dist/skills/memory-extractor.js.map +1 -0
- package/dist/skills/memory-query-tool.d.ts +44 -0
- package/dist/skills/memory-query-tool.d.ts.map +1 -0
- package/dist/skills/memory-query-tool.js +128 -0
- package/dist/skills/memory-query-tool.js.map +1 -0
- package/dist/skills/memory-store.d.ts +67 -0
- package/dist/skills/memory-store.d.ts.map +1 -0
- package/dist/skills/memory-store.js +229 -0
- package/dist/skills/memory-store.js.map +1 -0
- package/dist/skills/memory-tool.d.ts +68 -0
- package/dist/skills/memory-tool.d.ts.map +1 -0
- package/dist/skills/memory-tool.js +193 -0
- package/dist/skills/memory-tool.js.map +1 -0
- package/dist/skills/portable-tool.d.ts +72 -0
- package/dist/skills/portable-tool.d.ts.map +1 -0
- package/dist/skills/portable-tool.js +15 -0
- package/dist/skills/portable-tool.js.map +1 -0
- package/dist/skills/qmemory-adapter.d.ts +53 -0
- package/dist/skills/qmemory-adapter.d.ts.map +1 -0
- package/dist/skills/qmemory-adapter.js +166 -0
- package/dist/skills/qmemory-adapter.js.map +1 -0
- package/dist/skills/skill-frontmatter.d.ts +20 -0
- package/dist/skills/skill-frontmatter.d.ts.map +1 -0
- package/dist/skills/skill-frontmatter.js +345 -0
- package/dist/skills/skill-frontmatter.js.map +1 -0
- package/dist/skills/skill-guard.d.ts +24 -0
- package/dist/skills/skill-guard.d.ts.map +1 -0
- package/dist/skills/skill-guard.js +230 -0
- package/dist/skills/skill-guard.js.map +1 -0
- package/dist/skills/skill-loader.d.ts +17 -0
- package/dist/skills/skill-loader.d.ts.map +1 -0
- package/dist/skills/skill-loader.js +304 -0
- package/dist/skills/skill-loader.js.map +1 -0
- package/dist/skills/skill-source.d.ts +120 -0
- package/dist/skills/skill-source.d.ts.map +1 -0
- package/dist/skills/skill-source.js +127 -0
- package/dist/skills/skill-source.js.map +1 -0
- package/dist/skills/skill-types.d.ts +200 -0
- package/dist/skills/skill-types.d.ts.map +1 -0
- package/dist/skills/skill-types.js +7 -0
- package/dist/skills/skill-types.js.map +1 -0
- package/dist/skills/think-tool.d.ts +17 -0
- package/dist/skills/think-tool.d.ts.map +1 -0
- package/dist/skills/think-tool.js +60 -0
- package/dist/skills/think-tool.js.map +1 -0
- package/dist/skills/todo-tool.d.ts +64 -0
- package/dist/skills/todo-tool.d.ts.map +1 -0
- package/dist/skills/todo-tool.js +115 -0
- package/dist/skills/todo-tool.js.map +1 -0
- package/dist/skills/tools/agent-tool.d.ts +92 -0
- package/dist/skills/tools/agent-tool.d.ts.map +1 -0
- package/dist/skills/tools/agent-tool.js +143 -0
- package/dist/skills/tools/agent-tool.js.map +1 -0
- package/dist/skills/tools/apply-patch-tool.d.ts +30 -0
- package/dist/skills/tools/apply-patch-tool.d.ts.map +1 -0
- package/dist/skills/tools/apply-patch-tool.js +185 -0
- package/dist/skills/tools/apply-patch-tool.js.map +1 -0
- package/dist/skills/tools/ask-user-tool.d.ts +81 -0
- package/dist/skills/tools/ask-user-tool.d.ts.map +1 -0
- package/dist/skills/tools/ask-user-tool.js +122 -0
- package/dist/skills/tools/ask-user-tool.js.map +1 -0
- package/dist/skills/tools/brief-tool.d.ts +75 -0
- package/dist/skills/tools/brief-tool.d.ts.map +1 -0
- package/dist/skills/tools/brief-tool.js +96 -0
- package/dist/skills/tools/brief-tool.js.map +1 -0
- package/dist/skills/tools/browser-tool.d.ts +115 -0
- package/dist/skills/tools/browser-tool.d.ts.map +1 -0
- package/dist/skills/tools/browser-tool.js +156 -0
- package/dist/skills/tools/browser-tool.js.map +1 -0
- package/dist/skills/tools/checkpoint-tool.d.ts +67 -0
- package/dist/skills/tools/checkpoint-tool.d.ts.map +1 -0
- package/dist/skills/tools/checkpoint-tool.js +103 -0
- package/dist/skills/tools/checkpoint-tool.js.map +1 -0
- package/dist/skills/tools/config-tool.d.ts +64 -0
- package/dist/skills/tools/config-tool.d.ts.map +1 -0
- package/dist/skills/tools/config-tool.js +144 -0
- package/dist/skills/tools/config-tool.js.map +1 -0
- package/dist/skills/tools/cron-tool.d.ts +117 -0
- package/dist/skills/tools/cron-tool.d.ts.map +1 -0
- package/dist/skills/tools/cron-tool.js +176 -0
- package/dist/skills/tools/cron-tool.js.map +1 -0
- package/dist/skills/tools/edit-tool.d.ts +44 -0
- package/dist/skills/tools/edit-tool.d.ts.map +1 -0
- package/dist/skills/tools/edit-tool.js +71 -0
- package/dist/skills/tools/edit-tool.js.map +1 -0
- package/dist/skills/tools/exec-tool.d.ts +103 -0
- package/dist/skills/tools/exec-tool.d.ts.map +1 -0
- package/dist/skills/tools/exec-tool.js +134 -0
- package/dist/skills/tools/exec-tool.js.map +1 -0
- package/dist/skills/tools/image-generate-tool.d.ts +63 -0
- package/dist/skills/tools/image-generate-tool.d.ts.map +1 -0
- package/dist/skills/tools/image-generate-tool.js +68 -0
- package/dist/skills/tools/image-generate-tool.js.map +1 -0
- package/dist/skills/tools/instructions-tool.d.ts +104 -0
- package/dist/skills/tools/instructions-tool.d.ts.map +1 -0
- package/dist/skills/tools/instructions-tool.js +188 -0
- package/dist/skills/tools/instructions-tool.js.map +1 -0
- package/dist/skills/tools/lsp-tool.d.ts +154 -0
- package/dist/skills/tools/lsp-tool.d.ts.map +1 -0
- package/dist/skills/tools/lsp-tool.js +228 -0
- package/dist/skills/tools/lsp-tool.js.map +1 -0
- package/dist/skills/tools/mcp-client-types.d.ts +270 -0
- package/dist/skills/tools/mcp-client-types.d.ts.map +1 -0
- package/dist/skills/tools/mcp-client-types.js +54 -0
- package/dist/skills/tools/mcp-client-types.js.map +1 -0
- package/dist/skills/tools/mcp-tool.d.ts +250 -0
- package/dist/skills/tools/mcp-tool.d.ts.map +1 -0
- package/dist/skills/tools/mcp-tool.js +504 -0
- package/dist/skills/tools/mcp-tool.js.map +1 -0
- package/dist/skills/tools/memory-tool.d.ts +75 -0
- package/dist/skills/tools/memory-tool.d.ts.map +1 -0
- package/dist/skills/tools/memory-tool.js +89 -0
- package/dist/skills/tools/memory-tool.js.map +1 -0
- package/dist/skills/tools/monitor-tool.d.ts +114 -0
- package/dist/skills/tools/monitor-tool.d.ts.map +1 -0
- package/dist/skills/tools/monitor-tool.js +132 -0
- package/dist/skills/tools/monitor-tool.js.map +1 -0
- package/dist/skills/tools/music-generate-tool.d.ts +56 -0
- package/dist/skills/tools/music-generate-tool.d.ts.map +1 -0
- package/dist/skills/tools/music-generate-tool.js +63 -0
- package/dist/skills/tools/music-generate-tool.js.map +1 -0
- package/dist/skills/tools/notify-tool.d.ts +54 -0
- package/dist/skills/tools/notify-tool.d.ts.map +1 -0
- package/dist/skills/tools/notify-tool.js +63 -0
- package/dist/skills/tools/notify-tool.js.map +1 -0
- package/dist/skills/tools/patch-tool.d.ts +46 -0
- package/dist/skills/tools/patch-tool.d.ts.map +1 -0
- package/dist/skills/tools/patch-tool.js +506 -0
- package/dist/skills/tools/patch-tool.js.map +1 -0
- package/dist/skills/tools/pdf-tool.d.ts +67 -0
- package/dist/skills/tools/pdf-tool.d.ts.map +1 -0
- package/dist/skills/tools/pdf-tool.js +89 -0
- package/dist/skills/tools/pdf-tool.js.map +1 -0
- package/dist/skills/tools/plan-mode-tool.d.ts +60 -0
- package/dist/skills/tools/plan-mode-tool.d.ts.map +1 -0
- package/dist/skills/tools/plan-mode-tool.js +123 -0
- package/dist/skills/tools/plan-mode-tool.js.map +1 -0
- package/dist/skills/tools/read-tool.d.ts +52 -0
- package/dist/skills/tools/read-tool.d.ts.map +1 -0
- package/dist/skills/tools/read-tool.js +85 -0
- package/dist/skills/tools/read-tool.js.map +1 -0
- package/dist/skills/tools/repl-tool.d.ts +71 -0
- package/dist/skills/tools/repl-tool.d.ts.map +1 -0
- package/dist/skills/tools/repl-tool.js +70 -0
- package/dist/skills/tools/repl-tool.js.map +1 -0
- package/dist/skills/tools/search-tool.d.ts +113 -0
- package/dist/skills/tools/search-tool.d.ts.map +1 -0
- package/dist/skills/tools/search-tool.js +226 -0
- package/dist/skills/tools/search-tool.js.map +1 -0
- package/dist/skills/tools/send-message-tool.d.ts +52 -0
- package/dist/skills/tools/send-message-tool.d.ts.map +1 -0
- package/dist/skills/tools/send-message-tool.js +77 -0
- package/dist/skills/tools/send-message-tool.js.map +1 -0
- package/dist/skills/tools/skill-list-tool.d.ts +34 -0
- package/dist/skills/tools/skill-list-tool.d.ts.map +1 -0
- package/dist/skills/tools/skill-list-tool.js +55 -0
- package/dist/skills/tools/skill-list-tool.js.map +1 -0
- package/dist/skills/tools/skill-manage-tool.d.ts +74 -0
- package/dist/skills/tools/skill-manage-tool.d.ts.map +1 -0
- package/dist/skills/tools/skill-manage-tool.js +154 -0
- package/dist/skills/tools/skill-manage-tool.js.map +1 -0
- package/dist/skills/tools/skill-view-tool.d.ts +38 -0
- package/dist/skills/tools/skill-view-tool.d.ts.map +1 -0
- package/dist/skills/tools/skill-view-tool.js +73 -0
- package/dist/skills/tools/skill-view-tool.js.map +1 -0
- package/dist/skills/tools/sleep-tool.d.ts +50 -0
- package/dist/skills/tools/sleep-tool.d.ts.map +1 -0
- package/dist/skills/tools/sleep-tool.js +82 -0
- package/dist/skills/tools/sleep-tool.js.map +1 -0
- package/dist/skills/tools/structured-output-tool.d.ts +117 -0
- package/dist/skills/tools/structured-output-tool.d.ts.map +1 -0
- package/dist/skills/tools/structured-output-tool.js +177 -0
- package/dist/skills/tools/structured-output-tool.js.map +1 -0
- package/dist/skills/tools/task-tool.d.ts +105 -0
- package/dist/skills/tools/task-tool.d.ts.map +1 -0
- package/dist/skills/tools/task-tool.js +162 -0
- package/dist/skills/tools/task-tool.js.map +1 -0
- package/dist/skills/tools/team-tool.d.ts +90 -0
- package/dist/skills/tools/team-tool.d.ts.map +1 -0
- package/dist/skills/tools/team-tool.js +106 -0
- package/dist/skills/tools/team-tool.js.map +1 -0
- package/dist/skills/tools/tool-search-tool.d.ts +52 -0
- package/dist/skills/tools/tool-search-tool.d.ts.map +1 -0
- package/dist/skills/tools/tool-search-tool.js +111 -0
- package/dist/skills/tools/tool-search-tool.js.map +1 -0
- package/dist/skills/tools/tts-tool.d.ts +39 -0
- package/dist/skills/tools/tts-tool.d.ts.map +1 -0
- package/dist/skills/tools/tts-tool.js +46 -0
- package/dist/skills/tools/tts-tool.js.map +1 -0
- package/dist/skills/tools/video-edit-tool.d.ts +70 -0
- package/dist/skills/tools/video-edit-tool.d.ts.map +1 -0
- package/dist/skills/tools/video-edit-tool.js +75 -0
- package/dist/skills/tools/video-edit-tool.js.map +1 -0
- package/dist/skills/tools/video-generate-tool.d.ts +63 -0
- package/dist/skills/tools/video-generate-tool.d.ts.map +1 -0
- package/dist/skills/tools/video-generate-tool.js +67 -0
- package/dist/skills/tools/video-generate-tool.js.map +1 -0
- package/dist/skills/tools/video-merge-tool.d.ts +106 -0
- package/dist/skills/tools/video-merge-tool.d.ts.map +1 -0
- package/dist/skills/tools/video-merge-tool.js +93 -0
- package/dist/skills/tools/video-merge-tool.js.map +1 -0
- package/dist/skills/tools/video-upscale-tool.d.ts +46 -0
- package/dist/skills/tools/video-upscale-tool.d.ts.map +1 -0
- package/dist/skills/tools/video-upscale-tool.js +53 -0
- package/dist/skills/tools/video-upscale-tool.js.map +1 -0
- package/dist/skills/tools/web-fetch-tool.d.ts +79 -0
- package/dist/skills/tools/web-fetch-tool.d.ts.map +1 -0
- package/dist/skills/tools/web-fetch-tool.js +93 -0
- package/dist/skills/tools/web-fetch-tool.js.map +1 -0
- package/dist/skills/tools/web-search-tool.d.ts +58 -0
- package/dist/skills/tools/web-search-tool.d.ts.map +1 -0
- package/dist/skills/tools/web-search-tool.js +87 -0
- package/dist/skills/tools/web-search-tool.js.map +1 -0
- package/dist/skills/tools/worktree-tool.d.ts +70 -0
- package/dist/skills/tools/worktree-tool.d.ts.map +1 -0
- package/dist/skills/tools/worktree-tool.js +148 -0
- package/dist/skills/tools/worktree-tool.js.map +1 -0
- package/dist/skills/tools/write-tool.d.ts +46 -0
- package/dist/skills/tools/write-tool.d.ts.map +1 -0
- package/dist/skills/tools/write-tool.js +82 -0
- package/dist/skills/tools/write-tool.js.map +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { PortableTool } from "../portable-tool.js";
|
|
2
|
+
export declare const PDF_TOOL_NAME: "pdf";
|
|
3
|
+
export interface PdfToolParams {
|
|
4
|
+
prompt?: string;
|
|
5
|
+
pdf?: string;
|
|
6
|
+
pdfs?: string[];
|
|
7
|
+
pages?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const PDF_TOOL_SCHEMA: {
|
|
10
|
+
readonly type: "object";
|
|
11
|
+
readonly properties: {
|
|
12
|
+
readonly prompt: {
|
|
13
|
+
readonly type: "string";
|
|
14
|
+
readonly description: "Describe what to analyze or extract from the PDF(s).";
|
|
15
|
+
};
|
|
16
|
+
readonly pdf: {
|
|
17
|
+
readonly type: "string";
|
|
18
|
+
readonly description: "Single PDF path or URL.";
|
|
19
|
+
};
|
|
20
|
+
readonly pdfs: {
|
|
21
|
+
readonly type: "array";
|
|
22
|
+
readonly items: {
|
|
23
|
+
readonly type: "string";
|
|
24
|
+
};
|
|
25
|
+
readonly description: "Multiple PDF paths or URLs (up to 10).";
|
|
26
|
+
};
|
|
27
|
+
readonly pages: {
|
|
28
|
+
readonly type: "string";
|
|
29
|
+
readonly description: "Page range to process, e.g. \"1-5\", \"1,3,5-7\". Defaults to all pages.";
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
readonly required: readonly [];
|
|
33
|
+
};
|
|
34
|
+
/** Deps injected by the host runtime for PDF analysis. */
|
|
35
|
+
export interface PdfToolDeps {
|
|
36
|
+
/**
|
|
37
|
+
* Extract text and/or page images from a PDF.
|
|
38
|
+
* The host decides how to load (local FS, HTTP, etc.).
|
|
39
|
+
*/
|
|
40
|
+
extractPdf(source: string, options?: {
|
|
41
|
+
pages?: string;
|
|
42
|
+
}): Promise<{
|
|
43
|
+
text: string;
|
|
44
|
+
pageImages?: Array<{
|
|
45
|
+
page: number;
|
|
46
|
+
base64: string;
|
|
47
|
+
mimeType: string;
|
|
48
|
+
}>;
|
|
49
|
+
}>;
|
|
50
|
+
/**
|
|
51
|
+
* Optional: analyze extracted content via LLM.
|
|
52
|
+
* If not provided, the tool returns raw extracted text.
|
|
53
|
+
*/
|
|
54
|
+
analyzePdfContent?(prompt: string, content: {
|
|
55
|
+
text: string;
|
|
56
|
+
images?: Array<{
|
|
57
|
+
base64: string;
|
|
58
|
+
mimeType: string;
|
|
59
|
+
}>;
|
|
60
|
+
}): Promise<{
|
|
61
|
+
text: string;
|
|
62
|
+
model?: string;
|
|
63
|
+
provider?: string;
|
|
64
|
+
}>;
|
|
65
|
+
}
|
|
66
|
+
export declare function createPdfTool(deps: PdfToolDeps): PortableTool<PdfToolParams>;
|
|
67
|
+
//# sourceMappingURL=pdf-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdf-tool.d.ts","sourceRoot":"","sources":["../../../src/skills/tools/pdf-tool.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AAE5E,eAAO,MAAM,aAAa,EAAG,KAAc,CAAC;AAE5C,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;CAsBlB,CAAC;AAIX,0DAA0D;AAC1D,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,UAAU,CACR,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAC3B,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC,CAAC;IAErG;;;OAGG;IACH,iBAAiB,CAAC,CAChB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,KAAK,CAAC;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,GAC9E,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACjE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,GAAG,YAAY,CAAC,aAAa,CAAC,CAgE5E"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// PDF Tool — analyze PDF documents via relay/backend pipeline.
|
|
3
|
+
// Category: document
|
|
4
|
+
// ============================================================
|
|
5
|
+
export const PDF_TOOL_NAME = "pdf";
|
|
6
|
+
export const PDF_TOOL_SCHEMA = {
|
|
7
|
+
type: "object",
|
|
8
|
+
properties: {
|
|
9
|
+
prompt: {
|
|
10
|
+
type: "string",
|
|
11
|
+
description: "Describe what to analyze or extract from the PDF(s).",
|
|
12
|
+
},
|
|
13
|
+
pdf: {
|
|
14
|
+
type: "string",
|
|
15
|
+
description: "Single PDF path or URL.",
|
|
16
|
+
},
|
|
17
|
+
pdfs: {
|
|
18
|
+
type: "array",
|
|
19
|
+
items: { type: "string" },
|
|
20
|
+
description: "Multiple PDF paths or URLs (up to 10).",
|
|
21
|
+
},
|
|
22
|
+
pages: {
|
|
23
|
+
type: "string",
|
|
24
|
+
description: 'Page range to process, e.g. "1-5", "1,3,5-7". Defaults to all pages.',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
required: [],
|
|
28
|
+
};
|
|
29
|
+
const MAX_PDF_COUNT = 10;
|
|
30
|
+
export function createPdfTool(deps) {
|
|
31
|
+
return {
|
|
32
|
+
name: PDF_TOOL_NAME,
|
|
33
|
+
label: "PDF",
|
|
34
|
+
description: "Analyze one or more PDF documents. Use `pdf` for a single path/URL, or `pdfs` for multiple (up to 10). " +
|
|
35
|
+
"Provide a `prompt` describing what to analyze. Use `pages` to limit which pages to process.",
|
|
36
|
+
parameters: PDF_TOOL_SCHEMA,
|
|
37
|
+
execute: async (_toolCallId, params) => {
|
|
38
|
+
// Normalize sources
|
|
39
|
+
const sources = [];
|
|
40
|
+
if (params.pdf)
|
|
41
|
+
sources.push(params.pdf);
|
|
42
|
+
if (params.pdfs)
|
|
43
|
+
sources.push(...params.pdfs);
|
|
44
|
+
// Deduplicate
|
|
45
|
+
const unique = [...new Set(sources)];
|
|
46
|
+
if (unique.length === 0) {
|
|
47
|
+
return { content: [{ type: "text", text: "Error: provide at least one PDF via `pdf` or `pdfs`." }] };
|
|
48
|
+
}
|
|
49
|
+
if (unique.length > MAX_PDF_COUNT) {
|
|
50
|
+
return { content: [{ type: "text", text: `Error: maximum ${MAX_PDF_COUNT} PDFs per call.` }] };
|
|
51
|
+
}
|
|
52
|
+
const allTexts = [];
|
|
53
|
+
const allImages = [];
|
|
54
|
+
const errors = [];
|
|
55
|
+
for (const src of unique) {
|
|
56
|
+
try {
|
|
57
|
+
const result = await deps.extractPdf(src, { pages: params.pages });
|
|
58
|
+
allTexts.push(result.text);
|
|
59
|
+
if (result.pageImages) {
|
|
60
|
+
for (const img of result.pageImages) {
|
|
61
|
+
allImages.push({ base64: img.base64, mimeType: img.mimeType });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
errors.push(`${src}: ${err instanceof Error ? err.message : String(err)}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (allTexts.length === 0) {
|
|
70
|
+
return { content: [{ type: "text", text: `Failed to extract any PDFs: ${errors.join("; ")}` }] };
|
|
71
|
+
}
|
|
72
|
+
const combinedText = allTexts.join("\n\n---\n\n");
|
|
73
|
+
// If LLM analysis is available and prompt given, use it
|
|
74
|
+
if (deps.analyzePdfContent && params.prompt) {
|
|
75
|
+
const analysis = await deps.analyzePdfContent(params.prompt, { text: combinedText, images: allImages });
|
|
76
|
+
return {
|
|
77
|
+
content: [{ type: "text", text: analysis.text }],
|
|
78
|
+
details: { type: "pdf", model: analysis.model, provider: analysis.provider, pdfCount: unique.length, errors },
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
// Otherwise return raw extracted text
|
|
82
|
+
return {
|
|
83
|
+
content: [{ type: "text", text: combinedText }],
|
|
84
|
+
details: { type: "pdf", pdfCount: unique.length, errors },
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=pdf-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdf-tool.js","sourceRoot":"","sources":["../../../src/skills/tools/pdf-tool.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAC/D,qBAAqB;AACrB,+DAA+D;AAI/D,MAAM,CAAC,MAAM,aAAa,GAAG,KAAc,CAAC;AAS5C,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,QAAiB;IACvB,UAAU,EAAE;QACV,MAAM,EAAE;YACN,IAAI,EAAE,QAAiB;YACvB,WAAW,EAAE,sDAAsD;SACpE;QACD,GAAG,EAAE;YACH,IAAI,EAAE,QAAiB;YACvB,WAAW,EAAE,yBAAyB;SACvC;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,OAAgB;YACtB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAiB,EAAE;YAClC,WAAW,EAAE,wCAAwC;SACtD;QACD,KAAK,EAAE;YACL,IAAI,EAAE,QAAiB;YACvB,WAAW,EAAE,sEAAsE;SACpF;KACF;IACD,QAAQ,EAAE,EAAW;CACb,CAAC;AAEX,MAAM,aAAa,GAAG,EAAE,CAAC;AAuBzB,MAAM,UAAU,aAAa,CAAC,IAAiB;IAC7C,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE,KAAK;QACZ,WAAW,EACT,yGAAyG;YACzG,6FAA6F;QAC/F,UAAU,EAAE,eAAe;QAE3B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O;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;gBAC/C,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE;aAC1D,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { PortableTool } from "../portable-tool.js";
|
|
2
|
+
export declare const PLAN_MODE_TOOL_NAME: "plan_mode";
|
|
3
|
+
export type PlanModeAction = "enter" | "exit";
|
|
4
|
+
export interface PlanModeToolParams {
|
|
5
|
+
/** Action: enter or exit plan mode */
|
|
6
|
+
action: PlanModeAction;
|
|
7
|
+
/** Plan text (for exit — the finalized plan to present for approval) */
|
|
8
|
+
plan?: string;
|
|
9
|
+
/** File path where plan was saved (optional) */
|
|
10
|
+
planFilePath?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const PLAN_MODE_TOOL_SCHEMA: {
|
|
13
|
+
readonly type: "object";
|
|
14
|
+
readonly properties: {
|
|
15
|
+
readonly action: {
|
|
16
|
+
readonly type: "string";
|
|
17
|
+
readonly enum: readonly ["enter", "exit"];
|
|
18
|
+
readonly description: string;
|
|
19
|
+
};
|
|
20
|
+
readonly plan: {
|
|
21
|
+
readonly type: "string";
|
|
22
|
+
readonly description: string;
|
|
23
|
+
};
|
|
24
|
+
readonly planFilePath: {
|
|
25
|
+
readonly type: "string";
|
|
26
|
+
readonly description: "Optional file path where the plan was saved for reference.";
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
readonly required: readonly ["action"];
|
|
30
|
+
};
|
|
31
|
+
/** Tools allowed during plan mode (read-only + reasoning) */
|
|
32
|
+
export declare const PLAN_MODE_ALLOWED_TOOLS: readonly string[];
|
|
33
|
+
export interface PlanModeState {
|
|
34
|
+
active: boolean;
|
|
35
|
+
enteredAt?: string;
|
|
36
|
+
plan?: string;
|
|
37
|
+
planFilePath?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface PlanModeResult {
|
|
40
|
+
success: boolean;
|
|
41
|
+
state: PlanModeState;
|
|
42
|
+
allowedTools?: readonly string[];
|
|
43
|
+
error?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Host-provided plan mode backend.
|
|
47
|
+
* The host is responsible for filtering tool availability based on mode state.
|
|
48
|
+
*/
|
|
49
|
+
export interface PlanModeToolDeps {
|
|
50
|
+
/** Get current plan mode state */
|
|
51
|
+
getState(): PlanModeState;
|
|
52
|
+
/** Enter plan mode — host should restrict tool availability */
|
|
53
|
+
enterPlanMode(): Promise<PlanModeResult>;
|
|
54
|
+
/** Exit plan mode — host restores full tool availability */
|
|
55
|
+
exitPlanMode(plan?: string, planFilePath?: string): Promise<PlanModeResult>;
|
|
56
|
+
/** Check if in agent/sub-agent context (plan mode not allowed in sub-agents) */
|
|
57
|
+
isAgentContext?(): boolean;
|
|
58
|
+
}
|
|
59
|
+
export declare function createPlanModeTool(deps: PlanModeToolDeps): PortableTool<PlanModeToolParams>;
|
|
60
|
+
//# sourceMappingURL=plan-mode-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-mode-tool.d.ts","sourceRoot":"","sources":["../../../src/skills/tools/plan-mode-tool.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AAE5E,eAAO,MAAM,mBAAmB,EAAG,WAAoB,CAAC;AAExD,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,CAAC;AAE9C,MAAM,WAAW,kBAAkB;IACjC,sCAAsC;IACtC,MAAM,EAAE,cAAc,CAAC;IACvB,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;CAsBxB,CAAC;AAEX,6DAA6D;AAC7D,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,EAa3C,CAAC;AAEX,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;IACrB,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,kCAAkC;IAClC,QAAQ,IAAI,aAAa,CAAC;IAC1B,+DAA+D;IAC/D,aAAa,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;IACzC,4DAA4D;IAC5D,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC5E,gFAAgF;IAChF,cAAc,CAAC,IAAI,OAAO,CAAC;CAC5B;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,gBAAgB,GAAG,YAAY,CAAC,kBAAkB,CAAC,CAuF3F"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// Plan Mode Tool — enter/exit plan mode for safer exploration.
|
|
3
|
+
// Reference: claude-code-haha/src/tools/EnterPlanModeTool/EnterPlanModeTool.ts
|
|
4
|
+
// claude-code-haha/src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.ts
|
|
5
|
+
// Category: system (mode switch)
|
|
6
|
+
// ============================================================
|
|
7
|
+
export const PLAN_MODE_TOOL_NAME = "plan_mode";
|
|
8
|
+
export const PLAN_MODE_TOOL_SCHEMA = {
|
|
9
|
+
type: "object",
|
|
10
|
+
properties: {
|
|
11
|
+
action: {
|
|
12
|
+
type: "string",
|
|
13
|
+
enum: ["enter", "exit"],
|
|
14
|
+
description: "enter: Switch to plan mode (only read/search/think tools available).\n" +
|
|
15
|
+
"exit: Leave plan mode and submit plan for approval (restores full tool access).",
|
|
16
|
+
},
|
|
17
|
+
plan: {
|
|
18
|
+
type: "string",
|
|
19
|
+
description: "The finalized plan text to present for user approval (used with 'exit' action). " +
|
|
20
|
+
"Write a clear, structured plan of what will be done.",
|
|
21
|
+
},
|
|
22
|
+
planFilePath: {
|
|
23
|
+
type: "string",
|
|
24
|
+
description: "Optional file path where the plan was saved for reference.",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
required: ["action"],
|
|
28
|
+
};
|
|
29
|
+
/** Tools allowed during plan mode (read-only + reasoning) */
|
|
30
|
+
export const PLAN_MODE_ALLOWED_TOOLS = [
|
|
31
|
+
"read",
|
|
32
|
+
"search",
|
|
33
|
+
"think",
|
|
34
|
+
"lsp",
|
|
35
|
+
"web_search",
|
|
36
|
+
"web_fetch",
|
|
37
|
+
"memory_query",
|
|
38
|
+
"memory_search",
|
|
39
|
+
"skill_list",
|
|
40
|
+
"skill_view",
|
|
41
|
+
"tool_search",
|
|
42
|
+
"plan_mode",
|
|
43
|
+
];
|
|
44
|
+
export function createPlanModeTool(deps) {
|
|
45
|
+
return {
|
|
46
|
+
name: PLAN_MODE_TOOL_NAME,
|
|
47
|
+
label: "Plan Mode",
|
|
48
|
+
description: "Switch between plan mode and execution mode. In plan mode, only " +
|
|
49
|
+
"read-only tools (read, search, think, lsp) are available — no file writes or commands. " +
|
|
50
|
+
"Use plan mode to safely explore a problem before committing to changes. " +
|
|
51
|
+
"Exit plan mode with a finalized plan for user approval.",
|
|
52
|
+
parameters: PLAN_MODE_TOOL_SCHEMA,
|
|
53
|
+
execute: async (_toolCallId, params) => {
|
|
54
|
+
// Plan mode not allowed in sub-agent context
|
|
55
|
+
if (deps.isAgentContext?.()) {
|
|
56
|
+
return {
|
|
57
|
+
content: [{ type: "text", text: "Error: plan mode is not available in sub-agent context." }],
|
|
58
|
+
details: { type: "plan_mode", error: "agent_context" },
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
switch (params.action) {
|
|
62
|
+
case "enter": {
|
|
63
|
+
const state = deps.getState();
|
|
64
|
+
if (state.active) {
|
|
65
|
+
return {
|
|
66
|
+
content: [{ type: "text", text: "Already in plan mode. Use action='exit' with a plan to leave." }],
|
|
67
|
+
details: { type: "plan_mode", error: "already_active" },
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const result = await deps.enterPlanMode();
|
|
71
|
+
if (!result.success) {
|
|
72
|
+
return {
|
|
73
|
+
content: [{ type: "text", text: `Error: ${result.error || "failed to enter plan mode"}` }],
|
|
74
|
+
details: { type: "plan_mode", error: result.error },
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
const lines = [
|
|
78
|
+
"Entered plan mode.",
|
|
79
|
+
"",
|
|
80
|
+
"Available tools: " + PLAN_MODE_ALLOWED_TOOLS.join(", "),
|
|
81
|
+
"",
|
|
82
|
+
"All write/execute tools are disabled. Explore the problem, then exit with a plan.",
|
|
83
|
+
'Use action="exit" with a plan parameter when ready.',
|
|
84
|
+
];
|
|
85
|
+
return {
|
|
86
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
87
|
+
details: { type: "plan_mode", action: "enter", allowedTools: PLAN_MODE_ALLOWED_TOOLS },
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
case "exit": {
|
|
91
|
+
const state = deps.getState();
|
|
92
|
+
if (!state.active) {
|
|
93
|
+
return {
|
|
94
|
+
content: [{ type: "text", text: "Not in plan mode. Nothing to exit." }],
|
|
95
|
+
details: { type: "plan_mode", error: "not_active" },
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
const result = await deps.exitPlanMode(params.plan, params.planFilePath);
|
|
99
|
+
if (!result.success) {
|
|
100
|
+
return {
|
|
101
|
+
content: [{ type: "text", text: `Error: ${result.error || "failed to exit plan mode"}` }],
|
|
102
|
+
details: { type: "plan_mode", error: result.error },
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
const lines = ["Exited plan mode. Full tool access restored."];
|
|
106
|
+
if (params.plan) {
|
|
107
|
+
lines.push("", "Submitted plan for approval:", "", params.plan);
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
111
|
+
details: { type: "plan_mode", action: "exit", hasPlan: !!params.plan },
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
default:
|
|
115
|
+
return {
|
|
116
|
+
content: [{ type: "text", text: `Error: unknown action "${params.action}". Use "enter" or "exit".` }],
|
|
117
|
+
details: { type: "plan_mode", error: "unknown_action" },
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=plan-mode-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-mode-tool.js","sourceRoot":"","sources":["../../../src/skills/tools/plan-mode-tool.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAC/D,+EAA+E;AAC/E,+EAA+E;AAC/E,iCAAiC;AACjC,+DAA+D;AAI/D,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAoB,CAAC;AAaxD,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,QAAiB;IACvB,UAAU,EAAE;QACV,MAAM,EAAE;YACN,IAAI,EAAE,QAAiB;YACvB,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;YACvB,WAAW,EACT,wEAAwE;gBACxE,iFAAiF;SACpF;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,QAAiB;YACvB,WAAW,EACT,kFAAkF;gBAClF,sDAAsD;SACzD;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,QAAiB;YAC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AAC,OAAO,EAAE,CAAC;wBACpB,OAAO;4BACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,MAAM,CAAC,KAAK,IAAI,0BAA0B,EAAE,EAAE,CAAC;4BACzF,OAAO,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE;yBACpD,CAAC;oBACJ,CAAC;oBAED,MAAM,KAAK,GAAG,CAAC,8CAA8C,CAAC,CAAC;oBAC/D,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;wBAChB,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,8BAA8B,EAAE,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;oBAClE,CAAC;oBACD,OAAO;wBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;wBACnD,OAAO,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE;qBACvE,CAAC;gBACJ,CAAC;gBAED;oBACE,OAAO;wBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,0BAA0B,MAAM,CAAC,MAAM,2BAA2B,EAAE,CAAC;wBACrG,OAAO,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,gBAAgB,EAAE;qBACxD,CAAC;YACN,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { PortableTool } from "../portable-tool.js";
|
|
2
|
+
export declare const READ_TOOL_NAME: "read";
|
|
3
|
+
export interface ReadToolParams {
|
|
4
|
+
path: string;
|
|
5
|
+
offset?: number;
|
|
6
|
+
limit?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const READ_TOOL_SCHEMA: {
|
|
9
|
+
readonly type: "object";
|
|
10
|
+
readonly properties: {
|
|
11
|
+
readonly path: {
|
|
12
|
+
readonly type: "string";
|
|
13
|
+
readonly description: "Absolute path to the file to read.";
|
|
14
|
+
};
|
|
15
|
+
readonly offset: {
|
|
16
|
+
readonly type: "number";
|
|
17
|
+
readonly description: "Line number to start reading from (1-indexed). Default: 1.";
|
|
18
|
+
};
|
|
19
|
+
readonly limit: {
|
|
20
|
+
readonly type: "number";
|
|
21
|
+
readonly description: "Maximum number of lines to read. Default/max: 2000.";
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
readonly required: readonly ["path"];
|
|
25
|
+
};
|
|
26
|
+
export type ReadResultType = "text" | "image" | "binary_rejected";
|
|
27
|
+
/** Deps injected by the host runtime for file reading. */
|
|
28
|
+
export interface ReadToolDeps {
|
|
29
|
+
/** Read file content. Return string for text, base64 for images, or rejection. */
|
|
30
|
+
readFile(path: string): Promise<{
|
|
31
|
+
type: "text";
|
|
32
|
+
text: string;
|
|
33
|
+
} | {
|
|
34
|
+
type: "image";
|
|
35
|
+
base64: string;
|
|
36
|
+
mimeType: string;
|
|
37
|
+
} | {
|
|
38
|
+
type: "binary";
|
|
39
|
+
mimeType: string;
|
|
40
|
+
}>;
|
|
41
|
+
/** Resolve a relative path to absolute. */
|
|
42
|
+
resolvePath(input: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* Validate read access for the given path.
|
|
45
|
+
* Returns null if allowed, or an error message if blocked.
|
|
46
|
+
* Blocks device paths (/dev/zero, /dev/random, etc.) and
|
|
47
|
+
* paths outside the allowed workspace.
|
|
48
|
+
*/
|
|
49
|
+
validatePath?(path: string): string | null;
|
|
50
|
+
}
|
|
51
|
+
export declare function createReadTool(deps: ReadToolDeps): PortableTool<ReadToolParams>;
|
|
52
|
+
//# sourceMappingURL=read-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-tool.d.ts","sourceRoot":"","sources":["../../../src/skills/tools/read-tool.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AAE5E,eAAO,MAAM,cAAc,EAAG,MAAe,CAAC;AAE9C,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;CAiBnB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,GAAG,iBAAiB,CAAC;AAElE,0DAA0D;AAC1D,MAAM,WAAW,YAAY;IAC3B,kFAAkF;IAClF,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAC3B;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAC9B;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GACnD;QAAE,IAAI,EAAE,QAAQ,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CACvC,CAAC;IACF,2CAA2C;IAC3C,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACnC;;;;;OAKG;IACH,YAAY,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CAC5C;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,YAAY,GAAG,YAAY,CAAC,cAAc,CAAC,CAoE/E"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// File Read Tool — read file contents with offset/limit.
|
|
3
|
+
// Reference: claude-code-haha/src/tools/FileReadTool/FileReadTool.ts
|
|
4
|
+
// Category: coding
|
|
5
|
+
// ============================================================
|
|
6
|
+
export const READ_TOOL_NAME = "read";
|
|
7
|
+
export const READ_TOOL_SCHEMA = {
|
|
8
|
+
type: "object",
|
|
9
|
+
properties: {
|
|
10
|
+
path: {
|
|
11
|
+
type: "string",
|
|
12
|
+
description: "Absolute path to the file to read.",
|
|
13
|
+
},
|
|
14
|
+
offset: {
|
|
15
|
+
type: "number",
|
|
16
|
+
description: "Line number to start reading from (1-indexed). Default: 1.",
|
|
17
|
+
},
|
|
18
|
+
limit: {
|
|
19
|
+
type: "number",
|
|
20
|
+
description: "Maximum number of lines to read. Default/max: 2000.",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
required: ["path"],
|
|
24
|
+
};
|
|
25
|
+
export function createReadTool(deps) {
|
|
26
|
+
const MAX_LINES = 2000;
|
|
27
|
+
const MAX_BYTES = 50_000;
|
|
28
|
+
return {
|
|
29
|
+
name: READ_TOOL_NAME,
|
|
30
|
+
label: "Read File",
|
|
31
|
+
description: "Read the contents of a file. Supports text files and images (jpg, png, gif, webp). " +
|
|
32
|
+
"For text files, output is truncated to 2000 lines or 50KB. " +
|
|
33
|
+
"Binary files are rejected with a hint. " +
|
|
34
|
+
"Use offset/limit for pagination of large files.",
|
|
35
|
+
parameters: READ_TOOL_SCHEMA,
|
|
36
|
+
execute: async (_toolCallId, params) => {
|
|
37
|
+
const resolved = deps.resolvePath(params.path);
|
|
38
|
+
// Validate path access
|
|
39
|
+
if (deps.validatePath) {
|
|
40
|
+
const blocked = deps.validatePath(resolved);
|
|
41
|
+
if (blocked) {
|
|
42
|
+
return {
|
|
43
|
+
content: [{ type: "text", text: `Access denied: ${blocked}` }],
|
|
44
|
+
details: { type: "read", path: resolved, error: "access_denied" },
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const result = await deps.readFile(resolved);
|
|
49
|
+
// Image
|
|
50
|
+
if (result.type === "image") {
|
|
51
|
+
return {
|
|
52
|
+
content: [{ type: "image", data: result.base64, mimeType: result.mimeType }],
|
|
53
|
+
details: { type: "read", path: resolved, isImage: true },
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
// Binary rejection
|
|
57
|
+
if (result.type === "binary") {
|
|
58
|
+
return {
|
|
59
|
+
content: [{
|
|
60
|
+
type: "text",
|
|
61
|
+
text: `Cannot read binary file (${result.mimeType}). ` +
|
|
62
|
+
"Use a specific tool for this file type (e.g. pdf tool for PDFs).",
|
|
63
|
+
}],
|
|
64
|
+
details: { type: "read", path: resolved, error: "binary_file", mimeType: result.mimeType },
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
// Text file
|
|
68
|
+
const lines = result.text.split("\n");
|
|
69
|
+
const offset = Math.max(0, (params.offset ?? 1) - 1);
|
|
70
|
+
const limit = Math.min(params.limit ?? MAX_LINES, MAX_LINES);
|
|
71
|
+
const sliced = lines.slice(offset, offset + limit);
|
|
72
|
+
let text = sliced.join("\n");
|
|
73
|
+
if (text.length > MAX_BYTES)
|
|
74
|
+
text = text.slice(0, MAX_BYTES) + "\n... (truncated)";
|
|
75
|
+
const totalLines = lines.length;
|
|
76
|
+
const endLine = offset + sliced.length;
|
|
77
|
+
const hasMore = endLine < totalLines;
|
|
78
|
+
return {
|
|
79
|
+
content: [{ type: "text", text }],
|
|
80
|
+
details: { type: "read", path: resolved, totalLines, startLine: offset + 1, endLine, hasMore },
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=read-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-tool.js","sourceRoot":"","sources":["../../../src/skills/tools/read-tool.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,yDAAyD;AACzD,qEAAqE;AACrE,mBAAmB;AACnB,+DAA+D;AAI/D,MAAM,CAAC,MAAM,cAAc,GAAG,MAAe,CAAC;AAQ9C,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,QAAiB;IACvB,UAAU,EAAE;QACV,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AAC,GAAG,mBAAmB,CAAC;YAEnF,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC;YAChC,MAAM,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;YACvC,MAAM,OAAO,GAAG,OAAO,GAAG,UAAU,CAAC;YAErC,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;gBACjC,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE;aAC/F,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { PortableTool } from "../portable-tool.js";
|
|
2
|
+
export declare const REPL_TOOL_NAME: "repl";
|
|
3
|
+
export interface ReplToolParams {
|
|
4
|
+
/** JavaScript code to execute in the persistent VM context */
|
|
5
|
+
code: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const REPL_TOOL_SCHEMA: {
|
|
8
|
+
readonly type: "object";
|
|
9
|
+
readonly properties: {
|
|
10
|
+
readonly code: {
|
|
11
|
+
readonly type: "string";
|
|
12
|
+
readonly description: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
readonly required: readonly ["code"];
|
|
16
|
+
};
|
|
17
|
+
export interface ReplExecResult {
|
|
18
|
+
output: string;
|
|
19
|
+
error?: string;
|
|
20
|
+
duration: number;
|
|
21
|
+
}
|
|
22
|
+
/** Primitive operations injected into the VM context. */
|
|
23
|
+
export interface ReplPrimitives {
|
|
24
|
+
readFile(path: string): Promise<string>;
|
|
25
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
26
|
+
editFile(path: string, edits: Array<{
|
|
27
|
+
oldText: string;
|
|
28
|
+
newText: string;
|
|
29
|
+
}>): Promise<string>;
|
|
30
|
+
exec(command: string): Promise<{
|
|
31
|
+
stdout: string;
|
|
32
|
+
stderr: string;
|
|
33
|
+
exitCode: number;
|
|
34
|
+
}>;
|
|
35
|
+
glob(pattern: string): Promise<string[]>;
|
|
36
|
+
grep(pattern: string, path?: string): Promise<Array<{
|
|
37
|
+
file: string;
|
|
38
|
+
line: number;
|
|
39
|
+
text: string;
|
|
40
|
+
}>>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Host-provided REPL execution backend.
|
|
44
|
+
*/
|
|
45
|
+
export interface ReplToolDeps {
|
|
46
|
+
/**
|
|
47
|
+
* Execute JavaScript code within a persistent VM context.
|
|
48
|
+
* The VM is pre-initialized with the primitive functions above.
|
|
49
|
+
* Each tool invocation reuses the same VM (preserving variable state).
|
|
50
|
+
*/
|
|
51
|
+
executeInVm(code: string): Promise<ReplExecResult>;
|
|
52
|
+
/**
|
|
53
|
+
* Reset the VM context (clear state). Optional hook called on errors.
|
|
54
|
+
*/
|
|
55
|
+
resetVm?(): void;
|
|
56
|
+
/**
|
|
57
|
+
* The host-provided primitives injected into the VM.
|
|
58
|
+
* When provided, the tool validates that the host has set up all required primitives.
|
|
59
|
+
*/
|
|
60
|
+
primitives?: ReplPrimitives;
|
|
61
|
+
/**
|
|
62
|
+
* Permission check for individual primitive operations.
|
|
63
|
+
* Called before each primitive executes inside the VM.
|
|
64
|
+
* Returns null if allowed, or an error message if denied.
|
|
65
|
+
*/
|
|
66
|
+
checkPermission?(operation: string, args: unknown[]): Promise<string | null>;
|
|
67
|
+
}
|
|
68
|
+
/** Tool names that should be hidden from direct LLM access when REPL is active. */
|
|
69
|
+
export declare const REPL_HIDES_TOOLS: readonly string[];
|
|
70
|
+
export declare function createReplTool(deps: ReplToolDeps): PortableTool<ReplToolParams>;
|
|
71
|
+
//# sourceMappingURL=repl-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repl-tool.d.ts","sourceRoot":"","sources":["../../../src/skills/tools/repl-tool.ts"],"names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