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,55 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// Skill List Tool — discover available skills.
|
|
3
|
+
// Reference: hermes-agent-2026.4.30/tools/skills_tool.py (skills_list)
|
|
4
|
+
// Category: skill
|
|
5
|
+
// ============================================================
|
|
6
|
+
export const SKILL_LIST_TOOL_NAME = "skill_list";
|
|
7
|
+
export const SKILL_LIST_TOOL_SCHEMA = {
|
|
8
|
+
type: "object",
|
|
9
|
+
properties: {
|
|
10
|
+
category: {
|
|
11
|
+
type: "string",
|
|
12
|
+
description: "Filter skills by category (e.g. 'devops', 'mlops'). Omit to list all.",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
required: [],
|
|
16
|
+
};
|
|
17
|
+
export function createSkillListTool(deps) {
|
|
18
|
+
return {
|
|
19
|
+
name: SKILL_LIST_TOOL_NAME,
|
|
20
|
+
label: "List Skills",
|
|
21
|
+
description: "List all available skills (reusable workflows/knowledge packages). " +
|
|
22
|
+
"Returns skill names, descriptions, and categories. " +
|
|
23
|
+
"Use skill_view to see full skill content.",
|
|
24
|
+
parameters: SKILL_LIST_TOOL_SCHEMA,
|
|
25
|
+
execute: async (_toolCallId, params) => {
|
|
26
|
+
const output = await deps.listSkills(params.category);
|
|
27
|
+
if (output.skills.length === 0) {
|
|
28
|
+
const msg = params.category
|
|
29
|
+
? `No skills found in category "${params.category}".`
|
|
30
|
+
: "No skills available.";
|
|
31
|
+
return {
|
|
32
|
+
content: [{ type: "text", text: msg }],
|
|
33
|
+
details: { type: "skill_list", count: 0 },
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const lines = [`Available skills (${output.skills.length}):`];
|
|
37
|
+
if (output.categories.length > 0) {
|
|
38
|
+
lines.push(`Categories: ${output.categories.join(", ")}`);
|
|
39
|
+
}
|
|
40
|
+
lines.push("");
|
|
41
|
+
for (const s of output.skills) {
|
|
42
|
+
const cat = s.category ? ` [${s.category}]` : "";
|
|
43
|
+
const ver = s.version ? ` (v${s.version})` : "";
|
|
44
|
+
lines.push(`- **${s.name}**${ver}${cat}: ${s.description}`);
|
|
45
|
+
}
|
|
46
|
+
lines.push("");
|
|
47
|
+
lines.push("Use skill_view(name) to see full skill content.");
|
|
48
|
+
return {
|
|
49
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
50
|
+
details: { type: "skill_list", count: output.skills.length, categories: output.categories },
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=skill-list-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-list-tool.js","sourceRoot":"","sources":["../../../src/skills/tools/skill-list-tool.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+CAA+C;AAC/C,uEAAuE;AACvE,kBAAkB;AAClB,+DAA+D;AAI/D,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAqB,CAAC;AAM1D,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,IAAI,EAAE,QAAiB;IACvB,UAAU,EAAE;QACV,QAAQ,EAAE;YACR,IAAI,EAAE,QAAiB;YACvB,WAAW,EAAE,uEAAuE;SACrF;KACF;IACD,QAAQ,EAAE,EAAW;CACb,CAAC;AAsBX,MAAM,UAAU,mBAAmB,CAAC,IAAuB;IACzD,OAAO;QACL,IAAI,EAAE,oBAAoB;QAC1B,KAAK,EAAE,aAAa;QACpB,WAAW,EACT,qEAAqE;YACrE,qDAAqD;YACrD,2CAA2C;QAC7C,UAAU,EAAE,sBAAsB;QAElC,OAAO,EAAE,KAAK,EAAE,WAAmB,EAAE,MAA2B,EAA+B,EAAE;YAC/F,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAEtD,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ;oBACzB,CAAC,CAAC,gCAAgC,MAAM,CAAC,QAAQ,IAAI;oBACrD,CAAC,CAAC,sBAAsB,CAAC;gBAC3B,OAAO;oBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;oBACtC,OAAO,EAAE,EAAE,IAAI,EAA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|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { PortableTool } from "../portable-tool.js";
|
|
2
|
+
export declare const SKILL_MANAGE_TOOL_NAME: "skill_manage";
|
|
3
|
+
export type SkillManageAction = "create" | "edit" | "patch" | "delete" | "write_file" | "remove_file";
|
|
4
|
+
export interface SkillManageToolParams {
|
|
5
|
+
action: SkillManageAction;
|
|
6
|
+
name: string;
|
|
7
|
+
content?: string;
|
|
8
|
+
category?: string;
|
|
9
|
+
filePath?: string;
|
|
10
|
+
fileContent?: string;
|
|
11
|
+
oldString?: string;
|
|
12
|
+
newString?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const SKILL_MANAGE_TOOL_SCHEMA: {
|
|
15
|
+
readonly type: "object";
|
|
16
|
+
readonly properties: {
|
|
17
|
+
readonly action: {
|
|
18
|
+
readonly type: "string";
|
|
19
|
+
readonly enum: readonly ["create", "edit", "patch", "delete", "write_file", "remove_file"];
|
|
20
|
+
readonly description: string;
|
|
21
|
+
};
|
|
22
|
+
readonly name: {
|
|
23
|
+
readonly type: "string";
|
|
24
|
+
readonly description: "Skill name (lowercase, max 64 chars, kebab-case: letters, digits, hyphens).";
|
|
25
|
+
};
|
|
26
|
+
readonly content: {
|
|
27
|
+
readonly type: "string";
|
|
28
|
+
readonly description: string;
|
|
29
|
+
};
|
|
30
|
+
readonly category: {
|
|
31
|
+
readonly type: "string";
|
|
32
|
+
readonly description: "Category/domain (e.g. 'devops', 'mlops'). Used by create to organize skills.";
|
|
33
|
+
};
|
|
34
|
+
readonly filePath: {
|
|
35
|
+
readonly type: "string";
|
|
36
|
+
readonly description: string;
|
|
37
|
+
};
|
|
38
|
+
readonly fileContent: {
|
|
39
|
+
readonly type: "string";
|
|
40
|
+
readonly description: "Content for write_file action. Max 1 MiB.";
|
|
41
|
+
};
|
|
42
|
+
readonly oldString: {
|
|
43
|
+
readonly type: "string";
|
|
44
|
+
readonly description: "Text to find for patch action (must match uniquely in SKILL.md).";
|
|
45
|
+
};
|
|
46
|
+
readonly newString: {
|
|
47
|
+
readonly type: "string";
|
|
48
|
+
readonly description: "Replacement text for patch action (can be empty to delete).";
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
readonly required: readonly ["action", "name"];
|
|
52
|
+
};
|
|
53
|
+
export interface SkillManageResult {
|
|
54
|
+
success: boolean;
|
|
55
|
+
message: string;
|
|
56
|
+
path?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Host-provided skill management backend.
|
|
60
|
+
*/
|
|
61
|
+
export interface SkillManageToolDeps {
|
|
62
|
+
/**
|
|
63
|
+
* Execute a skill management action.
|
|
64
|
+
* The host handles file system operations, validation, and security scanning.
|
|
65
|
+
*/
|
|
66
|
+
manageSkill(params: SkillManageToolParams): Promise<SkillManageResult>;
|
|
67
|
+
/**
|
|
68
|
+
* Validate skill name format.
|
|
69
|
+
* If not provided, tool uses built-in validation.
|
|
70
|
+
*/
|
|
71
|
+
validateName?(name: string): string | null;
|
|
72
|
+
}
|
|
73
|
+
export declare function createSkillManageTool(deps: SkillManageToolDeps): PortableTool<SkillManageToolParams>;
|
|
74
|
+
//# sourceMappingURL=skill-manage-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-manage-tool.d.ts","sourceRoot":"","sources":["../../../src/skills/tools/skill-manage-tool.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AAE5E,eAAO,MAAM,sBAAsB,EAAG,cAAuB,CAAC;AAE9D,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,YAAY,GAAG,aAAa,CAAC;AAEtG,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6C3B,CAAC;AAEX,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,WAAW,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAEvE;;;OAGG;IACH,YAAY,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CAC5C;AAOD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,mBAAmB,GAAG,YAAY,CAAC,qBAAqB,CAAC,CA4CpG"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// Skill Manage Tool — create/edit/delete skills.
|
|
3
|
+
// Reference: hermes-agent-2026.4.30/tools/skill_manager_tool.py
|
|
4
|
+
// Category: skill
|
|
5
|
+
// ============================================================
|
|
6
|
+
export const SKILL_MANAGE_TOOL_NAME = "skill_manage";
|
|
7
|
+
export const SKILL_MANAGE_TOOL_SCHEMA = {
|
|
8
|
+
type: "object",
|
|
9
|
+
properties: {
|
|
10
|
+
action: {
|
|
11
|
+
type: "string",
|
|
12
|
+
enum: ["create", "edit", "patch", "delete", "write_file", "remove_file"],
|
|
13
|
+
description: "Action to perform: create (new skill), edit (overwrite SKILL.md), " +
|
|
14
|
+
"patch (find/replace in SKILL.md), delete (remove skill), " +
|
|
15
|
+
"write_file (add/overwrite supporting file), remove_file (delete supporting file).",
|
|
16
|
+
},
|
|
17
|
+
name: {
|
|
18
|
+
type: "string",
|
|
19
|
+
description: "Skill name (lowercase, max 64 chars, kebab-case: letters, digits, hyphens).",
|
|
20
|
+
},
|
|
21
|
+
content: {
|
|
22
|
+
type: "string",
|
|
23
|
+
description: "Full SKILL.md content (YAML frontmatter + body). Required for create/edit. " +
|
|
24
|
+
"Max 100,000 chars. Must include ---\\nname: ...\\ndescription: ...\\n--- header.",
|
|
25
|
+
},
|
|
26
|
+
category: {
|
|
27
|
+
type: "string",
|
|
28
|
+
description: "Category/domain (e.g. 'devops', 'mlops'). Used by create to organize skills.",
|
|
29
|
+
},
|
|
30
|
+
filePath: {
|
|
31
|
+
type: "string",
|
|
32
|
+
description: "Path within the skill for write_file/remove_file. " +
|
|
33
|
+
"Must be in references/, templates/, scripts/, or assets/ subdirectory.",
|
|
34
|
+
},
|
|
35
|
+
fileContent: {
|
|
36
|
+
type: "string",
|
|
37
|
+
description: "Content for write_file action. Max 1 MiB.",
|
|
38
|
+
},
|
|
39
|
+
oldString: {
|
|
40
|
+
type: "string",
|
|
41
|
+
description: "Text to find for patch action (must match uniquely in SKILL.md).",
|
|
42
|
+
},
|
|
43
|
+
newString: {
|
|
44
|
+
type: "string",
|
|
45
|
+
description: "Replacement text for patch action (can be empty to delete).",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
required: ["action", "name"],
|
|
49
|
+
};
|
|
50
|
+
const NAME_PATTERN = /^[a-z0-9][a-z0-9._-]{0,63}$/;
|
|
51
|
+
const MAX_CONTENT_LENGTH = 100_000;
|
|
52
|
+
const MAX_FILE_CONTENT_LENGTH = 1_048_576; // 1 MiB
|
|
53
|
+
const ALLOWED_FILE_DIRS = ["references/", "templates/", "scripts/", "assets/"];
|
|
54
|
+
export function createSkillManageTool(deps) {
|
|
55
|
+
return {
|
|
56
|
+
name: SKILL_MANAGE_TOOL_NAME,
|
|
57
|
+
label: "Manage Skills",
|
|
58
|
+
description: "Create, edit, patch, or delete skills. Skills are reusable workflows/knowledge packages " +
|
|
59
|
+
"that can be discovered and invoked. Supports managing supporting files (references, templates).",
|
|
60
|
+
parameters: SKILL_MANAGE_TOOL_SCHEMA,
|
|
61
|
+
execute: async (_toolCallId, params) => {
|
|
62
|
+
// Validate name
|
|
63
|
+
const nameError = deps.validateName
|
|
64
|
+
? deps.validateName(params.name)
|
|
65
|
+
: validateNameBuiltin(params.name);
|
|
66
|
+
if (nameError) {
|
|
67
|
+
return {
|
|
68
|
+
content: [{ type: "text", text: `Error: ${nameError}` }],
|
|
69
|
+
details: { type: "skill_manage", error: "invalid_name" },
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
// Action-specific validation
|
|
73
|
+
const validationError = validateAction(params);
|
|
74
|
+
if (validationError) {
|
|
75
|
+
return {
|
|
76
|
+
content: [{ type: "text", text: `Error: ${validationError}` }],
|
|
77
|
+
details: { type: "skill_manage", error: "validation_failed" },
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const result = await deps.manageSkill(params);
|
|
81
|
+
return {
|
|
82
|
+
content: [{ type: "text", text: result.message }],
|
|
83
|
+
details: {
|
|
84
|
+
type: "skill_manage",
|
|
85
|
+
action: params.action,
|
|
86
|
+
name: params.name,
|
|
87
|
+
success: result.success,
|
|
88
|
+
path: result.path,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function validateNameBuiltin(name) {
|
|
95
|
+
if (!name)
|
|
96
|
+
return "name is required.";
|
|
97
|
+
if (!NAME_PATTERN.test(name)) {
|
|
98
|
+
return "name must be lowercase, start with letter/digit, contain only letters, digits, hyphens, dots, underscores (max 64 chars).";
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
function validateAction(params) {
|
|
103
|
+
switch (params.action) {
|
|
104
|
+
case "create":
|
|
105
|
+
case "edit":
|
|
106
|
+
if (!params.content)
|
|
107
|
+
return `content is required for ${params.action}.`;
|
|
108
|
+
if (params.content.length > MAX_CONTENT_LENGTH) {
|
|
109
|
+
return `content exceeds max length (${MAX_CONTENT_LENGTH} chars).`;
|
|
110
|
+
}
|
|
111
|
+
if (!params.content.includes("---")) {
|
|
112
|
+
return "content must include YAML frontmatter (--- delimiters).";
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
115
|
+
case "patch":
|
|
116
|
+
if (!params.oldString)
|
|
117
|
+
return "oldString is required for patch.";
|
|
118
|
+
if (params.newString === undefined)
|
|
119
|
+
return "newString is required for patch (can be empty to delete).";
|
|
120
|
+
break;
|
|
121
|
+
case "write_file":
|
|
122
|
+
if (!params.filePath)
|
|
123
|
+
return "filePath is required for write_file.";
|
|
124
|
+
if (!params.fileContent)
|
|
125
|
+
return "fileContent is required for write_file.";
|
|
126
|
+
if (params.fileContent.length > MAX_FILE_CONTENT_LENGTH) {
|
|
127
|
+
return "fileContent exceeds max length (1 MiB).";
|
|
128
|
+
}
|
|
129
|
+
if (!ALLOWED_FILE_DIRS.some((d) => params.filePath.startsWith(d))) {
|
|
130
|
+
return `filePath must be in one of: ${ALLOWED_FILE_DIRS.join(", ")}`;
|
|
131
|
+
}
|
|
132
|
+
if (params.filePath.includes("..")) {
|
|
133
|
+
return "filePath must not contain path traversal (..).";
|
|
134
|
+
}
|
|
135
|
+
break;
|
|
136
|
+
case "remove_file":
|
|
137
|
+
if (!params.filePath)
|
|
138
|
+
return "filePath is required for remove_file.";
|
|
139
|
+
if (!ALLOWED_FILE_DIRS.some((d) => params.filePath.startsWith(d))) {
|
|
140
|
+
return `filePath must be in one of: ${ALLOWED_FILE_DIRS.join(", ")}`;
|
|
141
|
+
}
|
|
142
|
+
if (params.filePath.includes("..")) {
|
|
143
|
+
return "filePath must not contain path traversal (..).";
|
|
144
|
+
}
|
|
145
|
+
break;
|
|
146
|
+
case "delete":
|
|
147
|
+
// No extra validation needed
|
|
148
|
+
break;
|
|
149
|
+
default:
|
|
150
|
+
return `unknown action: ${params.action}`;
|
|
151
|
+
}
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=skill-manage-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-manage-tool.js","sourceRoot":"","sources":["../../../src/skills/tools/skill-manage-tool.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,iDAAiD;AACjD,gEAAgE;AAChE,kBAAkB;AAClB,+DAA+D;AAI/D,MAAM,CAAC,MAAM,sBAAsB,GAAG,cAAuB,CAAC;AAe9D,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,IAAI,EAAE,QAAiB;IACvB,UAAU,EAAE;QACV,MAAM,EAAE;YACN,IAAI,EAAE,QAAiB;YACvB,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,CAAC;YACxE,WAAW,EACT,oEAAoE;gBACpE,2DAA2D;gBAC3D,mFAAmF;SACtF;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,QAAiB;YACvB,WAAW,EAAE,6EAA6E;SAC3F;QACD,OAAO,EAAE;YACP,IAAI,EAAE,QAAiB;YACvB,WAAW,EACT,6EAA6E;gBAC7E,kFAAkF;SACrF;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,QAAiB;YACvB,WAAW,EAAE,8EAA8E;SAC5F;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,QAAiB;YACvB,WAAW,EACT,oDAAoD;gBACpD,wEAAwE;SAC3E;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,WAAW,EAAE,2CAA2C;SACzD;QACD,SAAS,EAAE;YACT,IAAI,EAAE,QAAiB;YACvB,WAAW,EAAE,kEAAkE;SAChF;QACD,SAAS,EAAE;YACT,IAAI,EAAE,QAAiB;YACvB,WAAW,EAAE,6DAA6D;SAC3E;KACF;IACD,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAU;CAC7B,CAAC;AAyBX,MAA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
|
+
export declare const SKILL_VIEW_TOOL_NAME: "skill_view";
|
|
3
|
+
export interface SkillViewToolParams {
|
|
4
|
+
name: string;
|
|
5
|
+
filePath?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const SKILL_VIEW_TOOL_SCHEMA: {
|
|
8
|
+
readonly type: "object";
|
|
9
|
+
readonly properties: {
|
|
10
|
+
readonly name: {
|
|
11
|
+
readonly type: "string";
|
|
12
|
+
readonly description: "Skill name to view (e.g. 'code-review', 'deploy-ecs').";
|
|
13
|
+
};
|
|
14
|
+
readonly filePath: {
|
|
15
|
+
readonly type: "string";
|
|
16
|
+
readonly description: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
readonly required: readonly ["name"];
|
|
20
|
+
};
|
|
21
|
+
export interface SkillViewOutput {
|
|
22
|
+
name: string;
|
|
23
|
+
content: string;
|
|
24
|
+
referenceFiles?: string[];
|
|
25
|
+
tags?: string[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Host-provided skill viewer.
|
|
29
|
+
*/
|
|
30
|
+
export interface SkillViewToolDeps {
|
|
31
|
+
/**
|
|
32
|
+
* Read skill content. Returns the main SKILL.md or a specific file.
|
|
33
|
+
* Returns null if skill not found.
|
|
34
|
+
*/
|
|
35
|
+
viewSkill(name: string, filePath?: string): Promise<SkillViewOutput | null>;
|
|
36
|
+
}
|
|
37
|
+
export declare function createSkillViewTool(deps: SkillViewToolDeps): PortableTool<SkillViewToolParams>;
|
|
38
|
+
//# sourceMappingURL=skill-view-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-view-tool.d.ts","sourceRoot":"","sources":["../../../src/skills/tools/skill-view-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,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;CAezB,CAAC;AAEX,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;CAC7E;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,YAAY,CAAC,mBAAmB,CAAC,CAuD9F"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// Skill View Tool — view full skill content.
|
|
3
|
+
// Reference: hermes-agent-2026.4.30/tools/skills_tool.py (skill_view)
|
|
4
|
+
// Category: skill
|
|
5
|
+
// ============================================================
|
|
6
|
+
export const SKILL_VIEW_TOOL_NAME = "skill_view";
|
|
7
|
+
export const SKILL_VIEW_TOOL_SCHEMA = {
|
|
8
|
+
type: "object",
|
|
9
|
+
properties: {
|
|
10
|
+
name: {
|
|
11
|
+
type: "string",
|
|
12
|
+
description: "Skill name to view (e.g. 'code-review', 'deploy-ecs').",
|
|
13
|
+
},
|
|
14
|
+
filePath: {
|
|
15
|
+
type: "string",
|
|
16
|
+
description: "Optional: view a specific file within the skill (e.g. 'references/api.md'). " +
|
|
17
|
+
"Omit to view the main SKILL.md.",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
required: ["name"],
|
|
21
|
+
};
|
|
22
|
+
export function createSkillViewTool(deps) {
|
|
23
|
+
return {
|
|
24
|
+
name: SKILL_VIEW_TOOL_NAME,
|
|
25
|
+
label: "View Skill",
|
|
26
|
+
description: "View the full content of a skill (instructions, configuration, reference files). " +
|
|
27
|
+
"Use skill_list to discover available skills first.",
|
|
28
|
+
parameters: SKILL_VIEW_TOOL_SCHEMA,
|
|
29
|
+
execute: async (_toolCallId, params) => {
|
|
30
|
+
if (!params.name || params.name.trim().length === 0) {
|
|
31
|
+
return {
|
|
32
|
+
content: [{ type: "text", text: "Error: skill name is required." }],
|
|
33
|
+
details: { type: "skill_view", error: "empty_name" },
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const result = await deps.viewSkill(params.name.trim(), params.filePath);
|
|
37
|
+
if (!result) {
|
|
38
|
+
return {
|
|
39
|
+
content: [{
|
|
40
|
+
type: "text",
|
|
41
|
+
text: `Skill "${params.name}" not found. Use skill_list to see available skills.`,
|
|
42
|
+
}],
|
|
43
|
+
details: { type: "skill_view", error: "not_found", name: params.name },
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const lines = [];
|
|
47
|
+
if (params.filePath) {
|
|
48
|
+
lines.push(`## ${result.name} / ${params.filePath}`);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
lines.push(`## Skill: ${result.name}`);
|
|
52
|
+
if (result.tags && result.tags.length > 0) {
|
|
53
|
+
lines.push(`Tags: ${result.tags.join(", ")}`);
|
|
54
|
+
}
|
|
55
|
+
if (result.referenceFiles && result.referenceFiles.length > 0) {
|
|
56
|
+
lines.push(`Reference files: ${result.referenceFiles.join(", ")}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
lines.push("");
|
|
60
|
+
lines.push(result.content);
|
|
61
|
+
return {
|
|
62
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
63
|
+
details: {
|
|
64
|
+
type: "skill_view",
|
|
65
|
+
name: result.name,
|
|
66
|
+
filePath: params.filePath,
|
|
67
|
+
referenceFiles: result.referenceFiles,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=skill-view-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-view-tool.js","sourceRoot":"","sources":["../../../src/skills/tools/skill-view-tool.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,6CAA6C;AAC7C,sEAAsE;AACtE,kBAAkB;AAClB,+DAA+D;AAI/D,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAqB,CAAC;AAO1D,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,IAAI,EAAE,QAAiB;IACvB,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,IAAI,EAAE,QAAiB;YACvB,WAAW,EAAE,wDAAwD;SACtE;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,QAAiB;YACvB,WAAW,EACT,8EAA8E;gBAC9E,iCAAiC;SACpC;KACF;IACD,QAAQ,EAAE,CAAC,MAAM,CAAU;CACnB,CAAC;AAoBX,MAAM,UAAU,mBAAmB,CAAC,IAAuB;IACzD,OAAO;QACL,IAAI,EAAE,oBAAoB;QAC1B,KAAK,EAAE,YAAY;QACnB,WAAW,EACT,mFAAmF;YACnF,oDAAoD;QACtD,UAAU,EAAE,sBAAsB;QAElC,OAAO,EAAE,KAAK,EAAE,WAAmB,EAAE,MAA2B,EAA+B,EAAE;YAC/F,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACpD,OAAO;oBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gCAAgC,EAAE,CAAC;oBACnE,OAAO,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;iBACrD,CAAC;YACJ,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE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,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBACnD,OAAO,EAAE;oBACP,IAAI,EAAE,YAAY;oBAClB,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;oBACzB,cAAc,EAAE,MAAM,CAAC,cAAc;iBACtC;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { PortableTool } from "../portable-tool.js";
|
|
2
|
+
export declare const SLEEP_TOOL_NAME: "sleep";
|
|
3
|
+
export interface SleepToolParams {
|
|
4
|
+
/** Duration to sleep in seconds (1–3600). */
|
|
5
|
+
duration: number;
|
|
6
|
+
/** Reason for sleeping — helps the runtime decide whether to interrupt. */
|
|
7
|
+
reason?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const SLEEP_TOOL_SCHEMA: {
|
|
10
|
+
readonly type: "object";
|
|
11
|
+
readonly properties: {
|
|
12
|
+
readonly duration: {
|
|
13
|
+
readonly type: "number";
|
|
14
|
+
readonly description: "Duration to sleep in seconds (1–3600). Prefer short sleeps (10–60s) to stay responsive.";
|
|
15
|
+
readonly minimum: 1;
|
|
16
|
+
readonly maximum: 3600;
|
|
17
|
+
};
|
|
18
|
+
readonly reason: {
|
|
19
|
+
readonly type: "string";
|
|
20
|
+
readonly description: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
readonly required: readonly ["duration"];
|
|
24
|
+
};
|
|
25
|
+
/** The result returned after a sleep completes or is interrupted. */
|
|
26
|
+
export interface SleepResult {
|
|
27
|
+
/** Actual time slept in seconds (may be less if interrupted). */
|
|
28
|
+
sleptSeconds: number;
|
|
29
|
+
/** Whether the sleep was interrupted before completing. */
|
|
30
|
+
interrupted: boolean;
|
|
31
|
+
/** The event that caused the interruption (undefined if not interrupted). */
|
|
32
|
+
interruptReason?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Runtime dependencies injected by the host.
|
|
36
|
+
*
|
|
37
|
+
* The sleep mechanism is host-provided — the tool itself does NOT call
|
|
38
|
+
* setTimeout. The host decides how to implement the wait (timer, event loop
|
|
39
|
+
* integration, tick prompt scheduling, etc.).
|
|
40
|
+
*/
|
|
41
|
+
export interface SleepToolDeps {
|
|
42
|
+
/**
|
|
43
|
+
* Perform the actual sleep. Must resolve after `durationMs` or when
|
|
44
|
+
* interrupted (whichever is first). The AbortSignal fires if the user
|
|
45
|
+
* or the system requests an interrupt.
|
|
46
|
+
*/
|
|
47
|
+
sleep(durationMs: number, signal: AbortSignal): Promise<SleepResult>;
|
|
48
|
+
}
|
|
49
|
+
export declare function createSleepTool(deps: SleepToolDeps): PortableTool<SleepToolParams>;
|
|
50
|
+
//# sourceMappingURL=sleep-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sleep-tool.d.ts","sourceRoot":"","sources":["../../../src/skills/tools/sleep-tool.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AAE5E,eAAO,MAAM,eAAe,EAAG,OAAgB,CAAC;AAEhD,MAAM,WAAW,eAAe;IAC9B,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;CAkBpB,CAAC;AAEX,qEAAqE;AACrE,MAAM,WAAW,WAAW;IAC1B,iEAAiE;IACjE,YAAY,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,WAAW,EAAE,OAAO,CAAC;IACrB,6EAA6E;IAC7E,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CACtE;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,YAAY,CAAC,eAAe,CAAC,CA2DlF"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// Sleep Tool — lightweight wait with tick/interrupt support.
|
|
3
|
+
// Reference: claude-code-haha/src/tools/SleepTool/prompt.ts
|
|
4
|
+
// Category: autonomous / proactive mode
|
|
5
|
+
// ============================================================
|
|
6
|
+
export const SLEEP_TOOL_NAME = "sleep";
|
|
7
|
+
export const SLEEP_TOOL_SCHEMA = {
|
|
8
|
+
type: "object",
|
|
9
|
+
properties: {
|
|
10
|
+
duration: {
|
|
11
|
+
type: "number",
|
|
12
|
+
description: "Duration to sleep in seconds (1–3600). Prefer short sleeps (10–60s) to stay responsive.",
|
|
13
|
+
minimum: 1,
|
|
14
|
+
maximum: 3600,
|
|
15
|
+
},
|
|
16
|
+
reason: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "Brief reason for sleeping. Examples: \"waiting for build to finish\", " +
|
|
19
|
+
"\"nothing to do\", \"user asked to rest\".",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
required: ["duration"],
|
|
23
|
+
};
|
|
24
|
+
export function createSleepTool(deps) {
|
|
25
|
+
return {
|
|
26
|
+
name: SLEEP_TOOL_NAME,
|
|
27
|
+
label: "Sleep",
|
|
28
|
+
shouldDefer: true,
|
|
29
|
+
isConcurrencySafe: true,
|
|
30
|
+
isReadOnly: true,
|
|
31
|
+
searchHint: "wait sleep rest idle tick proactive",
|
|
32
|
+
description: [
|
|
33
|
+
"Wait for a specified duration. The user can interrupt the sleep at any time.",
|
|
34
|
+
"",
|
|
35
|
+
"Use this when:",
|
|
36
|
+
"• You have nothing useful to do right now",
|
|
37
|
+
"• You're waiting for an external process to complete",
|
|
38
|
+
"• The user tells you to sleep or rest",
|
|
39
|
+
"• You receive a <tick> check-in with no actionable work",
|
|
40
|
+
"",
|
|
41
|
+
"Prefer this over `exec(sleep ...)` — it doesn't hold a shell process.",
|
|
42
|
+
"You can call this concurrently with other tools — it won't interfere with them.",
|
|
43
|
+
"",
|
|
44
|
+
"Each wake-up costs an API call, but the prompt cache expires after 5 minutes " +
|
|
45
|
+
"of inactivity — balance accordingly.",
|
|
46
|
+
].join("\n"),
|
|
47
|
+
parameters: SLEEP_TOOL_SCHEMA,
|
|
48
|
+
execute: async (_toolCallId, params, signal) => {
|
|
49
|
+
const durationSec = Math.max(1, Math.min(3600, Math.round(params.duration)));
|
|
50
|
+
const durationMs = durationSec * 1000;
|
|
51
|
+
// Create a child AbortController so we can forward the outer signal
|
|
52
|
+
const controller = new AbortController();
|
|
53
|
+
const onAbort = () => controller.abort();
|
|
54
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
55
|
+
// Handle pre-aborted signal
|
|
56
|
+
if (signal?.aborted)
|
|
57
|
+
controller.abort();
|
|
58
|
+
try {
|
|
59
|
+
const result = await deps.sleep(durationMs, controller.signal);
|
|
60
|
+
const lines = [];
|
|
61
|
+
if (result.interrupted) {
|
|
62
|
+
lines.push(`Sleep interrupted after ${result.sleptSeconds}s.`);
|
|
63
|
+
if (result.interruptReason) {
|
|
64
|
+
lines.push(`Reason: ${result.interruptReason}`);
|
|
65
|
+
}
|
|
66
|
+
lines.push("Check for new messages or tasks.");
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
lines.push(`Slept for ${result.sleptSeconds}s. Waking up.`);
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
73
|
+
details: { ...result, requestedSeconds: durationSec },
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
finally {
|
|
77
|
+
signal?.removeEventListener("abort", onAbort);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=sleep-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|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