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,70 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// REPL Tool — execute JavaScript in a persistent VM context
|
|
3
|
+
// with injected tool primitives for batch operations.
|
|
4
|
+
// Reference: claude-code-haha/src/tools/REPLTool/primitiveTools.ts
|
|
5
|
+
// Category: system
|
|
6
|
+
// ============================================================
|
|
7
|
+
export const REPL_TOOL_NAME = "repl";
|
|
8
|
+
export const REPL_TOOL_SCHEMA = {
|
|
9
|
+
type: "object",
|
|
10
|
+
properties: {
|
|
11
|
+
code: {
|
|
12
|
+
type: "string",
|
|
13
|
+
description: "JavaScript code to execute. The VM has access to these built-in primitives:\n" +
|
|
14
|
+
"- readFile(path): Promise<string> — read a file\n" +
|
|
15
|
+
"- writeFile(path, content): Promise<void> — write a file\n" +
|
|
16
|
+
"- editFile(path, edits): Promise<string> — apply edits [{oldText, newText}]\n" +
|
|
17
|
+
"- exec(command): Promise<{stdout, stderr, exitCode}> — run shell command\n" +
|
|
18
|
+
"- glob(pattern): Promise<string[]> — find files by glob\n" +
|
|
19
|
+
"- grep(pattern, path?): Promise<{file,line,text}[]> — search files\n" +
|
|
20
|
+
"Use this for batch operations (rename many files, transform data, etc) " +
|
|
21
|
+
"to reduce tool call round-trips.",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
required: ["code"],
|
|
25
|
+
};
|
|
26
|
+
/** Tool names that should be hidden from direct LLM access when REPL is active. */
|
|
27
|
+
export const REPL_HIDES_TOOLS = ["read", "write", "edit", "exec", "search"];
|
|
28
|
+
const MAX_CODE_LENGTH = 100_000;
|
|
29
|
+
const MAX_OUTPUT_LENGTH = 50_000;
|
|
30
|
+
export function createReplTool(deps) {
|
|
31
|
+
return {
|
|
32
|
+
name: REPL_TOOL_NAME,
|
|
33
|
+
label: "REPL",
|
|
34
|
+
description: "Execute JavaScript in a persistent VM with built-in file/shell primitives. " +
|
|
35
|
+
"Use for batch operations that would otherwise require many individual tool calls. " +
|
|
36
|
+
"The VM persists variables between calls within the same session. " +
|
|
37
|
+
"Each primitive (readFile, writeFile, exec, etc.) still goes through permission checks.",
|
|
38
|
+
parameters: REPL_TOOL_SCHEMA,
|
|
39
|
+
execute: async (_toolCallId, params) => {
|
|
40
|
+
if (!params.code || params.code.trim().length === 0) {
|
|
41
|
+
return {
|
|
42
|
+
content: [{ type: "text", text: "Error: code is required." }],
|
|
43
|
+
details: { type: "repl", error: "empty_code" },
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
if (params.code.length > MAX_CODE_LENGTH) {
|
|
47
|
+
return {
|
|
48
|
+
content: [{ type: "text", text: `Error: code too large (${params.code.length} chars, max ${MAX_CODE_LENGTH}).` }],
|
|
49
|
+
details: { type: "repl", error: "code_too_large" },
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const result = await deps.executeInVm(params.code);
|
|
53
|
+
let output = result.output || "";
|
|
54
|
+
if (output.length > MAX_OUTPUT_LENGTH) {
|
|
55
|
+
output = output.slice(0, MAX_OUTPUT_LENGTH) + "\n... (truncated)";
|
|
56
|
+
}
|
|
57
|
+
if (result.error) {
|
|
58
|
+
return {
|
|
59
|
+
content: [{ type: "text", text: `Error: ${result.error}\n\nOutput:\n${output}` }],
|
|
60
|
+
details: { type: "repl", error: result.error, duration: result.duration },
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
content: [{ type: "text", text: output || "(no output)" }],
|
|
65
|
+
details: { type: "repl", duration: result.duration, outputLength: output.length },
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=repl-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repl-tool.js","sourceRoot":"","sources":["../../../src/skills/tools/repl-tool.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,4DAA4D;AAC5D,kEAAkE;AAClE,mEAAmE;AACnE,mBAAmB;AACnB,+DAA+D;AAI/D,MAAM,CAAC,MAAM,cAAc,GAAG,MAAe,CAAC;AAO9C,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,QAAiB;IACvB,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,IAAI,EAAE,QAAiB;YACvB,WAAW,EACT,+EAA+E;gBAC/E,mDAAmD;gBACnD,4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;iBACnD,CAAC;YACJ,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAEnD,IAAI,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;YACjC,IAAI,MAAM,CAAC,MAAM,GAAG,iBAAiB,EAAE,CAAC;gBACtC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC,GAAG,mBAAmB,CAAC;YACpE,CAAC;YAED,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;gBACjB,OAAO;oBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,MAAM,CAAC,KAAK,gBAAgB,MAAM,EAAE,EAAE,CAAC;oBACjF,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE;iBAC1E,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,IAAI,aAAa,EAAE,CAAC;gBAC1D,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE;aAClF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { PortableTool } from "../portable-tool.js";
|
|
2
|
+
export declare const SEARCH_TOOL_NAME: "search";
|
|
3
|
+
export type SearchMode = "filename" | "content" | "both";
|
|
4
|
+
export interface SearchToolParams {
|
|
5
|
+
mode: SearchMode;
|
|
6
|
+
pattern: string;
|
|
7
|
+
path?: string;
|
|
8
|
+
fileGlob?: string;
|
|
9
|
+
contextLines?: number;
|
|
10
|
+
caseInsensitive?: boolean;
|
|
11
|
+
headLimit?: number;
|
|
12
|
+
offset?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare const SEARCH_TOOL_SCHEMA: {
|
|
15
|
+
readonly type: "object";
|
|
16
|
+
readonly properties: {
|
|
17
|
+
readonly mode: {
|
|
18
|
+
readonly type: "string";
|
|
19
|
+
readonly enum: readonly ["filename", "content", "both"];
|
|
20
|
+
readonly description: string;
|
|
21
|
+
};
|
|
22
|
+
readonly pattern: {
|
|
23
|
+
readonly type: "string";
|
|
24
|
+
readonly description: string;
|
|
25
|
+
};
|
|
26
|
+
readonly path: {
|
|
27
|
+
readonly type: "string";
|
|
28
|
+
readonly description: "Directory to search in. Defaults to workdir/cwd if omitted.";
|
|
29
|
+
};
|
|
30
|
+
readonly fileGlob: {
|
|
31
|
+
readonly type: "string";
|
|
32
|
+
readonly description: string;
|
|
33
|
+
};
|
|
34
|
+
readonly contextLines: {
|
|
35
|
+
readonly type: "number";
|
|
36
|
+
readonly description: string;
|
|
37
|
+
};
|
|
38
|
+
readonly caseInsensitive: {
|
|
39
|
+
readonly type: "boolean";
|
|
40
|
+
readonly description: "Case insensitive search (content/both modes). Default: false.";
|
|
41
|
+
};
|
|
42
|
+
readonly headLimit: {
|
|
43
|
+
readonly type: "number";
|
|
44
|
+
readonly description: string;
|
|
45
|
+
};
|
|
46
|
+
readonly offset: {
|
|
47
|
+
readonly type: "number";
|
|
48
|
+
readonly description: "Skip first N results before applying headLimit. Default: 0.";
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
readonly required: readonly ["mode", "pattern"];
|
|
52
|
+
};
|
|
53
|
+
export interface SearchFileResult {
|
|
54
|
+
path: string;
|
|
55
|
+
}
|
|
56
|
+
export interface SearchContentResult {
|
|
57
|
+
path: string;
|
|
58
|
+
line: number;
|
|
59
|
+
text: string;
|
|
60
|
+
contextBefore?: string[];
|
|
61
|
+
contextAfter?: string[];
|
|
62
|
+
}
|
|
63
|
+
export interface SearchOutput {
|
|
64
|
+
mode: SearchMode;
|
|
65
|
+
totalMatches: number;
|
|
66
|
+
truncated: boolean;
|
|
67
|
+
fileResults?: SearchFileResult[];
|
|
68
|
+
contentResults?: SearchContentResult[];
|
|
69
|
+
}
|
|
70
|
+
/** Host-provided search backend. */
|
|
71
|
+
export interface SearchToolDeps {
|
|
72
|
+
/**
|
|
73
|
+
* Find files matching a glob pattern.
|
|
74
|
+
* Returns array of relative file paths.
|
|
75
|
+
* The host SHOULD auto-exclude VCS directories (.git, .svn, .hg, .bzr)
|
|
76
|
+
* unless the user explicitly includes them.
|
|
77
|
+
*/
|
|
78
|
+
glob(pattern: string, options: {
|
|
79
|
+
cwd: string;
|
|
80
|
+
limit: number;
|
|
81
|
+
}): Promise<{
|
|
82
|
+
files: string[];
|
|
83
|
+
truncated: boolean;
|
|
84
|
+
}>;
|
|
85
|
+
/**
|
|
86
|
+
* Search file contents using regex.
|
|
87
|
+
* The implementation may use ripgrep, native grep, or a custom engine.
|
|
88
|
+
* Returns match records.
|
|
89
|
+
* The host SHOULD auto-exclude VCS directories (.git, .svn, .hg, .bzr)
|
|
90
|
+
* and enforce --max-columns 500 to avoid minified file noise.
|
|
91
|
+
*/
|
|
92
|
+
grep(pattern: string, options: {
|
|
93
|
+
cwd: string;
|
|
94
|
+
fileGlob?: string;
|
|
95
|
+
caseInsensitive?: boolean;
|
|
96
|
+
contextLines?: number;
|
|
97
|
+
headLimit?: number;
|
|
98
|
+
offset?: number;
|
|
99
|
+
}): Promise<{
|
|
100
|
+
matches: Array<{
|
|
101
|
+
path: string;
|
|
102
|
+
line: number;
|
|
103
|
+
text: string;
|
|
104
|
+
contextBefore?: string[];
|
|
105
|
+
contextAfter?: string[];
|
|
106
|
+
}>;
|
|
107
|
+
truncated: boolean;
|
|
108
|
+
}>;
|
|
109
|
+
/** Resolve relative path to absolute. If omitted, cwd is used. */
|
|
110
|
+
resolvePath?(input: string): string;
|
|
111
|
+
}
|
|
112
|
+
export declare function createSearchTool(deps: SearchToolDeps): PortableTool<SearchToolParams>;
|
|
113
|
+
//# sourceMappingURL=search-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-tool.d.ts","sourceRoot":"","sources":["../../../src/skills/tools/search-tool.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AAE5E,eAAO,MAAM,gBAAgB,EAAG,QAAiB,CAAC;AAElD,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAEzD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDrB,CAAC;AAIX,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACjC,cAAc,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACxC;AAID,oCAAoC;AACpC,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,IAAI,CACF,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GACtC,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAEpD;;;;;;OAMG;IACH,IAAI,CACF,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;QACP,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GACA,OAAO,CAAC;QACT,OAAO,EAAE,KAAK,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;YACb,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;YACzB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;SACzB,CAAC,CAAC;QACH,SAAS,EAAE,OAAO,CAAC;KACpB,CAAC,CAAC;IAEH,kEAAkE;IAClE,WAAW,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACrC;AAUD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,YAAY,CAAC,gBAAgB,CAAC,CA0BrF"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// Search Tool — unified file name (glob) + content (grep) search.
|
|
3
|
+
// Fuses CC GlobTool + GrepTool into single PortableTool.
|
|
4
|
+
// Reference: claude-code-haha/src/tools/GlobTool/GlobTool.ts
|
|
5
|
+
// claude-code-haha/src/tools/GrepTool/GrepTool.ts
|
|
6
|
+
// Category: search
|
|
7
|
+
// ============================================================
|
|
8
|
+
export const SEARCH_TOOL_NAME = "search";
|
|
9
|
+
export const SEARCH_TOOL_SCHEMA = {
|
|
10
|
+
type: "object",
|
|
11
|
+
properties: {
|
|
12
|
+
mode: {
|
|
13
|
+
type: "string",
|
|
14
|
+
enum: ["filename", "content", "both"],
|
|
15
|
+
description: 'Search mode: "filename" to find files by name pattern (glob), ' +
|
|
16
|
+
'"content" to search within file contents (regex), ' +
|
|
17
|
+
'"both" to match both filename patterns and content simultaneously.',
|
|
18
|
+
},
|
|
19
|
+
pattern: {
|
|
20
|
+
type: "string",
|
|
21
|
+
description: "The pattern to search for. In filename mode this is a glob pattern " +
|
|
22
|
+
"(e.g. **/*.ts). In content mode this is a regular expression. " +
|
|
23
|
+
"In both mode this is treated as a regex for content, and fileGlob " +
|
|
24
|
+
"filters the filename set.",
|
|
25
|
+
},
|
|
26
|
+
path: {
|
|
27
|
+
type: "string",
|
|
28
|
+
description: "Directory to search in. Defaults to workdir/cwd if omitted.",
|
|
29
|
+
},
|
|
30
|
+
fileGlob: {
|
|
31
|
+
type: "string",
|
|
32
|
+
description: 'Glob pattern to filter files (e.g. "*.ts", "*.{js,tsx}"). ' +
|
|
33
|
+
"In content/both modes, only files matching this glob are searched.",
|
|
34
|
+
},
|
|
35
|
+
contextLines: {
|
|
36
|
+
type: "number",
|
|
37
|
+
description: "Number of context lines to show before and after each match " +
|
|
38
|
+
"(content/both modes only). Default: 0.",
|
|
39
|
+
},
|
|
40
|
+
caseInsensitive: {
|
|
41
|
+
type: "boolean",
|
|
42
|
+
description: "Case insensitive search (content/both modes). Default: false.",
|
|
43
|
+
},
|
|
44
|
+
headLimit: {
|
|
45
|
+
type: "number",
|
|
46
|
+
description: "Maximum number of result entries to return. Default 100 for filename, " +
|
|
47
|
+
"250 for content. Pass 0 for unlimited (use sparingly).",
|
|
48
|
+
},
|
|
49
|
+
offset: {
|
|
50
|
+
type: "number",
|
|
51
|
+
description: "Skip first N results before applying headLimit. Default: 0.",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
required: ["mode", "pattern"],
|
|
55
|
+
};
|
|
56
|
+
// ── Constants ───────────────────────────────────────────────
|
|
57
|
+
const DEFAULT_FILENAME_LIMIT = 100;
|
|
58
|
+
const DEFAULT_CONTENT_LIMIT = 250;
|
|
59
|
+
const MAX_RESULT_CHARS = 100_000;
|
|
60
|
+
// ── Factory ─────────────────────────────────────────────────
|
|
61
|
+
export function createSearchTool(deps) {
|
|
62
|
+
return {
|
|
63
|
+
name: SEARCH_TOOL_NAME,
|
|
64
|
+
label: "Search",
|
|
65
|
+
description: "Search for files by name, search within file contents by regex, or both. " +
|
|
66
|
+
"In filename mode, pattern is a glob. In content mode, pattern is a regex. " +
|
|
67
|
+
"Results are paginated via headLimit + offset.",
|
|
68
|
+
parameters: SEARCH_TOOL_SCHEMA,
|
|
69
|
+
execute: async (_toolCallId, params) => {
|
|
70
|
+
const cwd = params.path
|
|
71
|
+
? (deps.resolvePath ? deps.resolvePath(params.path) : params.path)
|
|
72
|
+
: "";
|
|
73
|
+
const mode = params.mode;
|
|
74
|
+
if (mode === "filename") {
|
|
75
|
+
return executeFilenameSearch(deps, params, cwd);
|
|
76
|
+
}
|
|
77
|
+
else if (mode === "content") {
|
|
78
|
+
return executeContentSearch(deps, params, cwd);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
// "both" — run filename glob + content grep, merge results
|
|
82
|
+
return executeBothSearch(deps, params, cwd);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
// ── Filename search ─────────────────────────────────────────
|
|
88
|
+
async function executeFilenameSearch(deps, params, cwd) {
|
|
89
|
+
const limit = params.headLimit ?? DEFAULT_FILENAME_LIMIT;
|
|
90
|
+
const { files, truncated } = await deps.glob(params.pattern, {
|
|
91
|
+
cwd,
|
|
92
|
+
limit: limit === 0 ? 10000 : limit,
|
|
93
|
+
});
|
|
94
|
+
const offset = params.offset ?? 0;
|
|
95
|
+
const sliced = offset > 0 ? files.slice(offset) : files;
|
|
96
|
+
const effectiveLimit = limit === 0 ? sliced.length : limit;
|
|
97
|
+
const finalFiles = sliced.slice(0, effectiveLimit);
|
|
98
|
+
const wasTruncated = truncated || sliced.length > effectiveLimit;
|
|
99
|
+
if (finalFiles.length === 0) {
|
|
100
|
+
return {
|
|
101
|
+
content: [{ type: "text", text: "No files found matching pattern." }],
|
|
102
|
+
details: { mode: "filename", totalMatches: 0, truncated: false },
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
let text = finalFiles.join("\n");
|
|
106
|
+
if (wasTruncated) {
|
|
107
|
+
text += `\n\n(Results truncated. ${finalFiles.length} shown. Use a more specific pattern or increase headLimit.)`;
|
|
108
|
+
}
|
|
109
|
+
text = truncateText(text, MAX_RESULT_CHARS);
|
|
110
|
+
return {
|
|
111
|
+
content: [{ type: "text", text }],
|
|
112
|
+
details: {
|
|
113
|
+
mode: "filename",
|
|
114
|
+
totalMatches: finalFiles.length,
|
|
115
|
+
truncated: wasTruncated,
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
// ── Content search ──────────────────────────────────────────
|
|
120
|
+
async function executeContentSearch(deps, params, cwd) {
|
|
121
|
+
const headLimit = params.headLimit ?? DEFAULT_CONTENT_LIMIT;
|
|
122
|
+
const { matches, truncated } = await deps.grep(params.pattern, {
|
|
123
|
+
cwd,
|
|
124
|
+
fileGlob: params.fileGlob,
|
|
125
|
+
caseInsensitive: params.caseInsensitive,
|
|
126
|
+
contextLines: params.contextLines,
|
|
127
|
+
headLimit: headLimit === 0 ? undefined : headLimit,
|
|
128
|
+
offset: params.offset,
|
|
129
|
+
});
|
|
130
|
+
if (matches.length === 0) {
|
|
131
|
+
return {
|
|
132
|
+
content: [{ type: "text", text: "No matches found." }],
|
|
133
|
+
details: { mode: "content", totalMatches: 0, truncated: false },
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const lines = [];
|
|
137
|
+
for (const m of matches) {
|
|
138
|
+
if (m.contextBefore && m.contextBefore.length > 0) {
|
|
139
|
+
for (const ctx of m.contextBefore) {
|
|
140
|
+
lines.push(` ${ctx}`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
lines.push(`${m.path}:${m.line}: ${m.text}`);
|
|
144
|
+
if (m.contextAfter && m.contextAfter.length > 0) {
|
|
145
|
+
for (const ctx of m.contextAfter) {
|
|
146
|
+
lines.push(` ${ctx}`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
// Separator between match groups when context is present
|
|
150
|
+
if (params.contextLines && params.contextLines > 0) {
|
|
151
|
+
lines.push("--");
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
let text = lines.join("\n");
|
|
155
|
+
if (truncated) {
|
|
156
|
+
text += `\n\n(Results truncated at ${matches.length} matches. Use offset/headLimit for pagination.)`;
|
|
157
|
+
}
|
|
158
|
+
text = truncateText(text, MAX_RESULT_CHARS);
|
|
159
|
+
return {
|
|
160
|
+
content: [{ type: "text", text }],
|
|
161
|
+
details: {
|
|
162
|
+
mode: "content",
|
|
163
|
+
totalMatches: matches.length,
|
|
164
|
+
truncated,
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
// ── Both mode ───────────────────────────────────────────────
|
|
169
|
+
async function executeBothSearch(deps, params, cwd) {
|
|
170
|
+
// Run both in parallel
|
|
171
|
+
const [globResult, grepResult] = await Promise.all([
|
|
172
|
+
params.fileGlob
|
|
173
|
+
? deps.glob(params.fileGlob, { cwd, limit: DEFAULT_FILENAME_LIMIT })
|
|
174
|
+
: Promise.resolve({ files: [], truncated: false }),
|
|
175
|
+
deps.grep(params.pattern, {
|
|
176
|
+
cwd,
|
|
177
|
+
fileGlob: params.fileGlob,
|
|
178
|
+
caseInsensitive: params.caseInsensitive,
|
|
179
|
+
contextLines: params.contextLines,
|
|
180
|
+
headLimit: params.headLimit ?? DEFAULT_CONTENT_LIMIT,
|
|
181
|
+
offset: params.offset,
|
|
182
|
+
}),
|
|
183
|
+
]);
|
|
184
|
+
// Deduplicate: files that appear in both glob and grep results
|
|
185
|
+
const contentFiles = new Set(grepResult.matches.map((m) => m.path));
|
|
186
|
+
const uniqueGlobFiles = globResult.files.filter((f) => !contentFiles.has(f));
|
|
187
|
+
const sections = [];
|
|
188
|
+
if (uniqueGlobFiles.length > 0) {
|
|
189
|
+
sections.push(`## Files matching glob (${uniqueGlobFiles.length}):\n${uniqueGlobFiles.join("\n")}`);
|
|
190
|
+
}
|
|
191
|
+
if (grepResult.matches.length > 0) {
|
|
192
|
+
const lines = [];
|
|
193
|
+
for (const m of grepResult.matches) {
|
|
194
|
+
lines.push(`${m.path}:${m.line}: ${m.text}`);
|
|
195
|
+
}
|
|
196
|
+
sections.push(`## Content matches (${grepResult.matches.length}):\n${lines.join("\n")}`);
|
|
197
|
+
}
|
|
198
|
+
if (sections.length === 0) {
|
|
199
|
+
return {
|
|
200
|
+
content: [{ type: "text", text: "No matches found in either filename or content." }],
|
|
201
|
+
details: { mode: "both", totalMatches: 0, truncated: false },
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
const truncated = globResult.truncated || grepResult.truncated;
|
|
205
|
+
let text = sections.join("\n\n");
|
|
206
|
+
if (truncated) {
|
|
207
|
+
text += "\n\n(Some results truncated. Use more specific patterns.)";
|
|
208
|
+
}
|
|
209
|
+
text = truncateText(text, MAX_RESULT_CHARS);
|
|
210
|
+
return {
|
|
211
|
+
content: [{ type: "text", text }],
|
|
212
|
+
details: {
|
|
213
|
+
mode: "both",
|
|
214
|
+
totalMatches: uniqueGlobFiles.length + grepResult.matches.length,
|
|
215
|
+
truncated,
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
// ── Util ────────────────────────────────────────────────────
|
|
220
|
+
function truncateText(text, limit) {
|
|
221
|
+
if (text.length <= limit)
|
|
222
|
+
return text;
|
|
223
|
+
const half = Math.floor(limit / 2) - 50;
|
|
224
|
+
return `${text.slice(0, half)}\n\n... [truncated ${text.length - limit} chars] ...\n\n${text.slice(-half)}`;
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=search-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-tool.js","sourceRoot":"","sources":["../../../src/skills/tools/search-tool.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,kEAAkE;AAClE,yDAAyD;AACzD,6DAA6D;AAC7D,6DAA6D;AAC7D,mBAAmB;AACnB,+DAA+D;AAI/D,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAiB,CAAC;AAelD,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,QAAiB;IACvB,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,IAAI,EAAE,QAAiB;YACvB,IAAI,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,MAAM,CAAC;YACrC,WAAW,EACT,gEAAgE;gBAChE,oDAAoD;gBACpD,oEAAoE;SACvE;QACD,OAAO,EAAE;YACP,IAAI,EAAE,QAAiB;YACvB,WAAW,EACT,qEAAqE;gBACrE,gEAAgE;gBAChE,oEAAoE;gBACpE,2BAA2B;SAC9B;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,QAAiB;YACvB,WAAW,EACT,6DAA6D;SAChE;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,QAAiB;YACvB,WAAW,EACT,4DAA4D;gBAC5D,oEAAoE;SACvE;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,QAAiB;YACvB,WAAW,EACT,8DAA8D;gBAC9D,wCAAwC;SAC3C;QACD,eAAe,EAAE;YACf,IAAI,EAAE,SAAkB;YACxB,WAAW,EAAE,+DAA+D;SAC7E;QACD,SAAS,EAAE;YACT,IAAI,EAAE,QAAiB;YACvB,WAAW,EACT,wEAAwE;gBACxE,wDAAwD;SAC3D;QACD,MAAM,EAAE;YACN,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,CAAC,CAAC,GAAG,EAAE,CAAC;IACxC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,sBAAsB,IAAI,CAAC,MAAM,GAAG,KAAK,kBAAkB,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AAC9G,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { PortableTool } from "../portable-tool.js";
|
|
2
|
+
export declare const SEND_MESSAGE_TOOL_NAME: "send_message";
|
|
3
|
+
export interface SendMessageToolParams {
|
|
4
|
+
/** Target agent name or '*' for broadcast */
|
|
5
|
+
to: string;
|
|
6
|
+
/** Message content */
|
|
7
|
+
message: string;
|
|
8
|
+
/** Optional short summary for routing/display */
|
|
9
|
+
summary?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const SEND_MESSAGE_TOOL_SCHEMA: {
|
|
12
|
+
readonly type: "object";
|
|
13
|
+
readonly properties: {
|
|
14
|
+
readonly to: {
|
|
15
|
+
readonly type: "string";
|
|
16
|
+
readonly description: string;
|
|
17
|
+
};
|
|
18
|
+
readonly message: {
|
|
19
|
+
readonly type: "string";
|
|
20
|
+
readonly description: "Message content to send to the target agent.";
|
|
21
|
+
};
|
|
22
|
+
readonly summary: {
|
|
23
|
+
readonly type: "string";
|
|
24
|
+
readonly description: "Optional short summary (for logging/routing).";
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
readonly required: readonly ["to", "message"];
|
|
28
|
+
};
|
|
29
|
+
export interface SendMessageResult {
|
|
30
|
+
success: boolean;
|
|
31
|
+
recipients?: string[];
|
|
32
|
+
error?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Host-provided message routing backend.
|
|
36
|
+
* Messages are delivered asynchronously via mailbox pattern.
|
|
37
|
+
*/
|
|
38
|
+
export interface SendMessageToolDeps {
|
|
39
|
+
/** Send message to target agent(s). Returns delivery status. */
|
|
40
|
+
sendMessage(params: {
|
|
41
|
+
to: string;
|
|
42
|
+
message: string;
|
|
43
|
+
summary?: string;
|
|
44
|
+
senderId: string;
|
|
45
|
+
}): Promise<SendMessageResult>;
|
|
46
|
+
/** Get the current agent's ID */
|
|
47
|
+
getSenderId(): string;
|
|
48
|
+
/** List available teammates */
|
|
49
|
+
listTeammates?(): string[];
|
|
50
|
+
}
|
|
51
|
+
export declare function createSendMessageTool(deps: SendMessageToolDeps): PortableTool<SendMessageToolParams>;
|
|
52
|
+
//# sourceMappingURL=send-message-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-message-tool.d.ts","sourceRoot":"","sources":["../../../src/skills/tools/send-message-tool.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AAE5E,eAAO,MAAM,sBAAsB,EAAG,cAAuB,CAAC;AAE9D,MAAM,WAAW,qBAAqB;IACpC,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAC;IACX,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;CAmB3B,CAAC;AAEX,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,gEAAgE;IAChE,WAAW,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACrH,iCAAiC;IACjC,WAAW,IAAI,MAAM,CAAC;IACtB,+BAA+B;IAC/B,aAAa,CAAC,IAAI,MAAM,EAAE,CAAC;CAC5B;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,mBAAmB,GAAG,YAAY,CAAC,qBAAqB,CAAC,CAuDpG"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// Send Message Tool — agent-to-agent IPC within a team/swarm.
|
|
3
|
+
// Reference: claude-code-haha/src/tools/SendMessageTool/SendMessageTool.ts
|
|
4
|
+
// hermes-agent-main/tools/send_message_tool.py
|
|
5
|
+
// Category: system
|
|
6
|
+
// ============================================================
|
|
7
|
+
export const SEND_MESSAGE_TOOL_NAME = "send_message";
|
|
8
|
+
export const SEND_MESSAGE_TOOL_SCHEMA = {
|
|
9
|
+
type: "object",
|
|
10
|
+
properties: {
|
|
11
|
+
to: {
|
|
12
|
+
type: "string",
|
|
13
|
+
description: "Target agent name or '*' for broadcast to all team members. " +
|
|
14
|
+
"Must be a valid agent name within the current team.",
|
|
15
|
+
},
|
|
16
|
+
message: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "Message content to send to the target agent.",
|
|
19
|
+
},
|
|
20
|
+
summary: {
|
|
21
|
+
type: "string",
|
|
22
|
+
description: "Optional short summary (for logging/routing).",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
required: ["to", "message"],
|
|
26
|
+
};
|
|
27
|
+
export function createSendMessageTool(deps) {
|
|
28
|
+
return {
|
|
29
|
+
name: SEND_MESSAGE_TOOL_NAME,
|
|
30
|
+
label: "Send Message",
|
|
31
|
+
description: "Send a message to another agent in your team. Use '*' to broadcast to all teammates. " +
|
|
32
|
+
"Messages are delivered asynchronously. Use for coordination, delegation, and status updates.",
|
|
33
|
+
parameters: SEND_MESSAGE_TOOL_SCHEMA,
|
|
34
|
+
execute: async (_toolCallId, params) => {
|
|
35
|
+
if (!params.to || params.to.trim().length === 0) {
|
|
36
|
+
return {
|
|
37
|
+
content: [{ type: "text", text: "Error: 'to' is required (agent name or '*')." }],
|
|
38
|
+
details: { type: "send_message", error: "missing_target" },
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (!params.message || params.message.trim().length === 0) {
|
|
42
|
+
return {
|
|
43
|
+
content: [{ type: "text", text: "Error: message is required." }],
|
|
44
|
+
details: { type: "send_message", error: "empty_message" },
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
// Validate target exists (unless broadcast)
|
|
48
|
+
if (params.to !== "*" && deps.listTeammates) {
|
|
49
|
+
const teammates = deps.listTeammates();
|
|
50
|
+
if (!teammates.includes(params.to)) {
|
|
51
|
+
return {
|
|
52
|
+
content: [{ type: "text", text: `Error: agent "${params.to}" not found in team. Available: ${teammates.join(", ")}` }],
|
|
53
|
+
details: { type: "send_message", error: "target_not_found", available: teammates },
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const result = await deps.sendMessage({
|
|
58
|
+
to: params.to.trim(),
|
|
59
|
+
message: params.message.trim(),
|
|
60
|
+
summary: params.summary,
|
|
61
|
+
senderId: deps.getSenderId(),
|
|
62
|
+
});
|
|
63
|
+
if (!result.success) {
|
|
64
|
+
return {
|
|
65
|
+
content: [{ type: "text", text: `Message delivery failed: ${result.error || "unknown error"}` }],
|
|
66
|
+
details: { type: "send_message", success: false, error: result.error },
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
const target = params.to === "*" ? `broadcast (${result.recipients?.length || 0} recipients)` : params.to;
|
|
70
|
+
return {
|
|
71
|
+
content: [{ type: "text", text: `Message sent to ${target}.` }],
|
|
72
|
+
details: { type: "send_message", success: true, to: params.to, recipients: result.recipients },
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=send-message-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-message-tool.js","sourceRoot":"","sources":["../../../src/skills/tools/send-message-tool.ts"],"names":[],"mappings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,EAAE,MAAM,CAAC,KAAK,EAAE;iBACvE,CAAC;YACJ,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,cAAc,MAAM,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1G,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,MAAM,GAAG,EAAE,CAAC;gBAC/D,OAAO,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE;aAC/F,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { PortableTool } from "../portable-tool.js";
|
|
2
|
+
export declare const SKILL_LIST_TOOL_NAME: "skill_list";
|
|
3
|
+
export interface SkillListToolParams {
|
|
4
|
+
category?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const SKILL_LIST_TOOL_SCHEMA: {
|
|
7
|
+
readonly type: "object";
|
|
8
|
+
readonly properties: {
|
|
9
|
+
readonly category: {
|
|
10
|
+
readonly type: "string";
|
|
11
|
+
readonly description: "Filter skills by category (e.g. 'devops', 'mlops'). Omit to list all.";
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
readonly required: readonly [];
|
|
15
|
+
};
|
|
16
|
+
export interface SkillListItem {
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
version?: string;
|
|
20
|
+
category?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface SkillListOutput {
|
|
23
|
+
skills: SkillListItem[];
|
|
24
|
+
categories: string[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Host-provided skill registry for listing.
|
|
28
|
+
*/
|
|
29
|
+
export interface SkillListToolDeps {
|
|
30
|
+
/** List all available skills, optionally filtered by category. */
|
|
31
|
+
listSkills(category?: string): Promise<SkillListOutput>;
|
|
32
|
+
}
|
|
33
|
+
export declare function createSkillListTool(deps: SkillListToolDeps): PortableTool<SkillListToolParams>;
|
|
34
|
+
//# sourceMappingURL=skill-list-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-list-tool.d.ts","sourceRoot":"","sources":["../../../src/skills/tools/skill-list-tool.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AAE5E,eAAO,MAAM,oBAAoB,EAAG,YAAqB,CAAC;AAE1D,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,sBAAsB;;;;;;;;;CASzB,CAAC;AAEX,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,kEAAkE;IAClE,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CACzD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,YAAY,CAAC,mBAAmB,CAAC,CA4C9F"}
|