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,103 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// Checkpoint Manager — transparent file history snapshots.
|
|
3
|
+
// Reference: hermes-agent-main/tools/checkpoint_manager.py
|
|
4
|
+
// Category: infrastructure (LLM does NOT directly invoke)
|
|
5
|
+
// ============================================================
|
|
6
|
+
export const CHECKPOINT_TOOL_NAME = "checkpoint";
|
|
7
|
+
export const CHECKPOINT_TOOL_SCHEMA = {
|
|
8
|
+
type: "object",
|
|
9
|
+
properties: {
|
|
10
|
+
action: {
|
|
11
|
+
type: "string",
|
|
12
|
+
enum: ["create", "list", "restore", "diff"],
|
|
13
|
+
description: "Action: create (snapshot current state), list (show checkpoints), " +
|
|
14
|
+
"restore (revert to checkpoint), diff (show changes since checkpoint).",
|
|
15
|
+
},
|
|
16
|
+
checkpointId: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "Checkpoint ID. Required for restore and diff.",
|
|
19
|
+
},
|
|
20
|
+
message: {
|
|
21
|
+
type: "string",
|
|
22
|
+
description: "Optional descriptive message for the checkpoint.",
|
|
23
|
+
},
|
|
24
|
+
paths: {
|
|
25
|
+
type: "array",
|
|
26
|
+
items: { type: "string" },
|
|
27
|
+
description: "File paths to restore (partial restore). Omit to restore everything.",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
required: ["action"],
|
|
31
|
+
};
|
|
32
|
+
const COMMIT_HASH_PATTERN = /^[0-9a-fA-F]{4,64}$/;
|
|
33
|
+
export function createCheckpointTool(deps) {
|
|
34
|
+
return {
|
|
35
|
+
name: CHECKPOINT_TOOL_NAME,
|
|
36
|
+
label: "Checkpoint",
|
|
37
|
+
description: "Manage workspace checkpoints (shadow snapshots independent of user's git). " +
|
|
38
|
+
"Create snapshots before risky operations, list history, restore on errors, " +
|
|
39
|
+
"or diff to see what changed. Checkpoints do NOT affect user's .git.",
|
|
40
|
+
parameters: CHECKPOINT_TOOL_SCHEMA,
|
|
41
|
+
execute: async (_toolCallId, params) => {
|
|
42
|
+
switch (params.action) {
|
|
43
|
+
case "create": {
|
|
44
|
+
const r = await deps.createCheckpoint(params.message);
|
|
45
|
+
if (!r.success) {
|
|
46
|
+
return { content: [{ type: "text", text: `Error: ${r.error}` }], details: { type: "checkpoint", error: r.error } };
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
content: [{ type: "text", text: `Checkpoint created: ${r.checkpoint.id}\nMessage: ${r.checkpoint.message}\nFiles: ${r.checkpoint.fileCount}` }],
|
|
50
|
+
details: { type: "checkpoint", action: "create", checkpointId: r.checkpoint.id },
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
case "list": {
|
|
54
|
+
const r = await deps.listCheckpoints();
|
|
55
|
+
if (!r.checkpoints || r.checkpoints.length === 0) {
|
|
56
|
+
return { content: [{ type: "text", text: "No checkpoints available." }], details: { type: "checkpoint", action: "list", count: 0 } };
|
|
57
|
+
}
|
|
58
|
+
const lines = [`Checkpoints (${r.checkpoints.length}):`, ""];
|
|
59
|
+
for (const cp of r.checkpoints) {
|
|
60
|
+
lines.push(`- ${cp.id.slice(0, 8)} [${cp.timestamp}] ${cp.message} (${cp.fileCount} files)`);
|
|
61
|
+
}
|
|
62
|
+
return { content: [{ type: "text", text: lines.join("\n") }], details: { type: "checkpoint", action: "list", count: r.checkpoints.length } };
|
|
63
|
+
}
|
|
64
|
+
case "restore": {
|
|
65
|
+
if (!params.checkpointId) {
|
|
66
|
+
return { content: [{ type: "text", text: "Error: checkpointId required for restore." }], details: { type: "checkpoint", error: "missing_id" } };
|
|
67
|
+
}
|
|
68
|
+
if (!COMMIT_HASH_PATTERN.test(params.checkpointId)) {
|
|
69
|
+
return { content: [{ type: "text", text: "Error: invalid checkpoint ID format." }], details: { type: "checkpoint", error: "invalid_id" } };
|
|
70
|
+
}
|
|
71
|
+
const r = await deps.restoreCheckpoint(params.checkpointId, params.paths);
|
|
72
|
+
if (!r.success) {
|
|
73
|
+
return { content: [{ type: "text", text: `Error: ${r.error}` }], details: { type: "checkpoint", error: r.error } };
|
|
74
|
+
}
|
|
75
|
+
const scope = params.paths ? `(${params.paths.length} files)` : "(full workspace)";
|
|
76
|
+
return {
|
|
77
|
+
content: [{ type: "text", text: `Restored to checkpoint ${params.checkpointId.slice(0, 8)} ${scope}` }],
|
|
78
|
+
details: { type: "checkpoint", action: "restore", checkpointId: params.checkpointId },
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
case "diff": {
|
|
82
|
+
if (!params.checkpointId) {
|
|
83
|
+
return { content: [{ type: "text", text: "Error: checkpointId required for diff." }], details: { type: "checkpoint", error: "missing_id" } };
|
|
84
|
+
}
|
|
85
|
+
if (!COMMIT_HASH_PATTERN.test(params.checkpointId)) {
|
|
86
|
+
return { content: [{ type: "text", text: "Error: invalid checkpoint ID format." }], details: { type: "checkpoint", error: "invalid_id" } };
|
|
87
|
+
}
|
|
88
|
+
const r = await deps.diffCheckpoint(params.checkpointId);
|
|
89
|
+
if (!r.success) {
|
|
90
|
+
return { content: [{ type: "text", text: `Error: ${r.error}` }], details: { type: "checkpoint", error: r.error } };
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
content: [{ type: "text", text: r.diff || "(no changes since checkpoint)" }],
|
|
94
|
+
details: { type: "checkpoint", action: "diff", checkpointId: params.checkpointId },
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
default:
|
|
98
|
+
return { content: [{ type: "text", text: `Error: unknown action "${params.action}".` }], details: { type: "checkpoint", error: "unknown_action" } };
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=checkpoint-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpoint-tool.js","sourceRoot":"","sources":["../../../src/skills/tools/checkpoint-tool.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,2DAA2D;AAC3D,2DAA2D;AAC3D,0DAA0D;AAC1D,+DAA+D;AAI/D,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAqB,CAAC;AAc1D,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,IAAI,EAAE,QAAiB;IACvB,UAAU,EAAE;QACV,MAAM,EAAE;YACN,IAAI,EAAE,QAAiB;YACvB,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,EA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I,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,IAAI,+BAA+B,EAAE,CAAC;wBAC5E,OAAO,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE;qBACnF,CAAC;gBACJ,CAAC;gBAED;oBACE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,0BAA0B,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,CAAC;YACxJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { PortableTool } from "../portable-tool.js";
|
|
2
|
+
export declare const CONFIG_TOOL_NAME: "config";
|
|
3
|
+
export type ConfigAction = "get" | "set" | "list" | "reset";
|
|
4
|
+
export interface ConfigToolParams {
|
|
5
|
+
/** Config action */
|
|
6
|
+
action: ConfigAction;
|
|
7
|
+
/** Setting key path (e.g. "model", "language", "theme") */
|
|
8
|
+
key?: string;
|
|
9
|
+
/** Value to set (for 'set' action) */
|
|
10
|
+
value?: string | boolean | number;
|
|
11
|
+
}
|
|
12
|
+
export declare const CONFIG_TOOL_SCHEMA: {
|
|
13
|
+
readonly type: "object";
|
|
14
|
+
readonly properties: {
|
|
15
|
+
readonly action: {
|
|
16
|
+
readonly type: "string";
|
|
17
|
+
readonly enum: readonly ["get", "set", "list", "reset"];
|
|
18
|
+
readonly description: string;
|
|
19
|
+
};
|
|
20
|
+
readonly key: {
|
|
21
|
+
readonly type: "string";
|
|
22
|
+
readonly description: string;
|
|
23
|
+
};
|
|
24
|
+
readonly value: {
|
|
25
|
+
readonly description: "Value to set. Type depends on the setting. Required for 'set' action.";
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
readonly required: readonly ["action"];
|
|
29
|
+
};
|
|
30
|
+
export interface ConfigSetting {
|
|
31
|
+
key: string;
|
|
32
|
+
value: unknown;
|
|
33
|
+
type: "string" | "boolean" | "number" | "enum";
|
|
34
|
+
description: string;
|
|
35
|
+
options?: string[];
|
|
36
|
+
readOnly?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface ConfigResult {
|
|
39
|
+
success: boolean;
|
|
40
|
+
setting?: ConfigSetting;
|
|
41
|
+
settings?: ConfigSetting[];
|
|
42
|
+
previousValue?: unknown;
|
|
43
|
+
error?: string;
|
|
44
|
+
}
|
|
45
|
+
/** Keys that cannot be modified by LLM (security-critical) */
|
|
46
|
+
export declare const CONFIG_READONLY_KEYS: readonly string[];
|
|
47
|
+
/**
|
|
48
|
+
* Host-provided config backend.
|
|
49
|
+
* Manages persistent agent settings with safety guardrails.
|
|
50
|
+
*/
|
|
51
|
+
export interface ConfigToolDeps {
|
|
52
|
+
/** Get a single config value */
|
|
53
|
+
getConfig(key: string): Promise<ConfigResult>;
|
|
54
|
+
/** Set a config value (respects readonly/whitelist) */
|
|
55
|
+
setConfig(key: string, value: unknown): Promise<ConfigResult>;
|
|
56
|
+
/** List all available config settings */
|
|
57
|
+
listConfig(): Promise<ConfigResult>;
|
|
58
|
+
/** Reset a setting to default */
|
|
59
|
+
resetConfig(key: string): Promise<ConfigResult>;
|
|
60
|
+
/** Check if a key is supported/valid */
|
|
61
|
+
isValidKey?(key: string): boolean;
|
|
62
|
+
}
|
|
63
|
+
export declare function createConfigTool(deps: ConfigToolDeps): PortableTool<ConfigToolParams>;
|
|
64
|
+
//# sourceMappingURL=config-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-tool.d.ts","sourceRoot":"","sources":["../../../src/skills/tools/config-tool.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AAE5E,eAAO,MAAM,gBAAgB,EAAG,QAAi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CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAChD,wCAAwC;IACxC,UAAU,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACnC;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,YAAY,CAAC,gBAAgB,CAAC,CA8GrF"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// Config Tool — agent configuration management (read/write preferences).
|
|
3
|
+
// Reference: claude-code-haha/src/tools/ConfigTool/ConfigTool.ts
|
|
4
|
+
// Category: system
|
|
5
|
+
// ============================================================
|
|
6
|
+
export const CONFIG_TOOL_NAME = "config";
|
|
7
|
+
export const CONFIG_TOOL_SCHEMA = {
|
|
8
|
+
type: "object",
|
|
9
|
+
properties: {
|
|
10
|
+
action: {
|
|
11
|
+
type: "string",
|
|
12
|
+
enum: ["get", "set", "list", "reset"],
|
|
13
|
+
description: "Action:\n" +
|
|
14
|
+
"- get: Read a config setting\n" +
|
|
15
|
+
"- set: Write a config setting\n" +
|
|
16
|
+
"- list: List all available settings\n" +
|
|
17
|
+
"- reset: Reset a setting to default",
|
|
18
|
+
},
|
|
19
|
+
key: {
|
|
20
|
+
type: "string",
|
|
21
|
+
description: "Config key path (e.g. 'model', 'language', 'theme', 'permissions.defaultMode'). " +
|
|
22
|
+
"Required for get/set/reset.",
|
|
23
|
+
},
|
|
24
|
+
value: {
|
|
25
|
+
description: "Value to set. Type depends on the setting. Required for 'set' action.",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
required: ["action"],
|
|
29
|
+
};
|
|
30
|
+
/** Keys that cannot be modified by LLM (security-critical) */
|
|
31
|
+
export const CONFIG_READONLY_KEYS = [
|
|
32
|
+
"permissions.securityPolicy",
|
|
33
|
+
"api.key",
|
|
34
|
+
"api.secret",
|
|
35
|
+
"auth.token",
|
|
36
|
+
"system.adminMode",
|
|
37
|
+
];
|
|
38
|
+
export function createConfigTool(deps) {
|
|
39
|
+
return {
|
|
40
|
+
name: CONFIG_TOOL_NAME,
|
|
41
|
+
label: "Config",
|
|
42
|
+
description: "Read and write agent configuration settings. " +
|
|
43
|
+
"Supports preferences like model selection, language, theme, tool enablement, etc. " +
|
|
44
|
+
"Security-critical settings (API keys, permissions) are read-only. " +
|
|
45
|
+
"Changes persist across sessions.",
|
|
46
|
+
parameters: CONFIG_TOOL_SCHEMA,
|
|
47
|
+
execute: async (_toolCallId, params) => {
|
|
48
|
+
switch (params.action) {
|
|
49
|
+
case "get": {
|
|
50
|
+
if (!params.key) {
|
|
51
|
+
return { content: [{ type: "text", text: "Error: key is required for get." }], details: { type: "config", error: "missing_key" } };
|
|
52
|
+
}
|
|
53
|
+
if (deps.isValidKey && !deps.isValidKey(params.key)) {
|
|
54
|
+
return { content: [{ type: "text", text: `Error: unknown config key "${params.key}". Use action='list' to see available settings.` }], details: { type: "config", error: "unknown_key" } };
|
|
55
|
+
}
|
|
56
|
+
const result = await deps.getConfig(params.key);
|
|
57
|
+
if (!result.success) {
|
|
58
|
+
return { content: [{ type: "text", text: `Error: ${result.error}` }], details: { type: "config", error: result.error } };
|
|
59
|
+
}
|
|
60
|
+
const s = result.setting;
|
|
61
|
+
const lines = [
|
|
62
|
+
`${s.key} = ${JSON.stringify(s.value)}`,
|
|
63
|
+
` Type: ${s.type}${s.options ? ` (${s.options.join(" | ")})` : ""}`,
|
|
64
|
+
` ${s.description}`,
|
|
65
|
+
];
|
|
66
|
+
if (s.readOnly)
|
|
67
|
+
lines.push(" ⚠️ Read-only (cannot be changed)");
|
|
68
|
+
return {
|
|
69
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
70
|
+
details: { type: "config", action: "get", key: params.key, value: s.value },
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
case "set": {
|
|
74
|
+
if (!params.key) {
|
|
75
|
+
return { content: [{ type: "text", text: "Error: key is required for set." }], details: { type: "config", error: "missing_key" } };
|
|
76
|
+
}
|
|
77
|
+
if (params.value === undefined) {
|
|
78
|
+
return { content: [{ type: "text", text: "Error: value is required for set." }], details: { type: "config", error: "missing_value" } };
|
|
79
|
+
}
|
|
80
|
+
// Block security-critical keys
|
|
81
|
+
if (CONFIG_READONLY_KEYS.includes(params.key)) {
|
|
82
|
+
return {
|
|
83
|
+
content: [{ type: "text", text: `Error: "${params.key}" is a security-critical setting and cannot be modified.` }],
|
|
84
|
+
details: { type: "config", error: "readonly_key" },
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
if (deps.isValidKey && !deps.isValidKey(params.key)) {
|
|
88
|
+
return { content: [{ type: "text", text: `Error: unknown config key "${params.key}".` }], details: { type: "config", error: "unknown_key" } };
|
|
89
|
+
}
|
|
90
|
+
const result = await deps.setConfig(params.key, params.value);
|
|
91
|
+
if (!result.success) {
|
|
92
|
+
return { content: [{ type: "text", text: `Error: ${result.error}` }], details: { type: "config", error: result.error } };
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
content: [{ type: "text", text: `Updated "${params.key}": ${JSON.stringify(result.previousValue)} → ${JSON.stringify(params.value)}` }],
|
|
96
|
+
details: { type: "config", action: "set", key: params.key, previousValue: result.previousValue, newValue: params.value },
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
case "list": {
|
|
100
|
+
const result = await deps.listConfig();
|
|
101
|
+
if (!result.settings || result.settings.length === 0) {
|
|
102
|
+
return { content: [{ type: "text", text: "No config settings available." }], details: { type: "config", action: "list", count: 0 } };
|
|
103
|
+
}
|
|
104
|
+
const lines = [`Available settings (${result.settings.length}):`, ""];
|
|
105
|
+
for (const s of result.settings) {
|
|
106
|
+
const ro = s.readOnly ? " [read-only]" : "";
|
|
107
|
+
const val = JSON.stringify(s.value);
|
|
108
|
+
lines.push(` ${s.key} = ${val}${ro}`);
|
|
109
|
+
lines.push(` ${s.description}`);
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
113
|
+
details: { type: "config", action: "list", count: result.settings.length },
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
case "reset": {
|
|
117
|
+
if (!params.key) {
|
|
118
|
+
return { content: [{ type: "text", text: "Error: key is required for reset." }], details: { type: "config", error: "missing_key" } };
|
|
119
|
+
}
|
|
120
|
+
if (CONFIG_READONLY_KEYS.includes(params.key)) {
|
|
121
|
+
return {
|
|
122
|
+
content: [{ type: "text", text: `Error: "${params.key}" cannot be reset (security-critical).` }],
|
|
123
|
+
details: { type: "config", error: "readonly_key" },
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
const result = await deps.resetConfig(params.key);
|
|
127
|
+
if (!result.success) {
|
|
128
|
+
return { content: [{ type: "text", text: `Error: ${result.error}` }], details: { type: "config", error: result.error } };
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
content: [{ type: "text", text: `Reset "${params.key}" to default: ${JSON.stringify(result.setting?.value)}` }],
|
|
132
|
+
details: { type: "config", action: "reset", key: params.key, value: result.setting?.value },
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
default:
|
|
136
|
+
return {
|
|
137
|
+
content: [{ type: "text", text: `Error: unknown action "${params.action}".` }],
|
|
138
|
+
details: { type: "config", error: "unknown_action" },
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=config-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-tool.js","sourceRoot":"","sources":["../../../src/skills/tools/config-tool.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,yEAAyE;AACzE,iEAAiE;AACjE,mBAAmB;AACnB,+DAA+D;AAI/D,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAiB,CAAC;AAalD,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,QAAiB;IACvB,UAAU,EAAE;QACV,MAAM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,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { PortableTool } from "../portable-tool.js";
|
|
2
|
+
export declare const CRON_TOOL_NAME: "cron";
|
|
3
|
+
export type CronAction = "create" | "list" | "get" | "update" | "delete" | "pause" | "resume" | "trigger";
|
|
4
|
+
export interface CronToolParams {
|
|
5
|
+
action: CronAction;
|
|
6
|
+
/** Job ID (required for get/update/delete/pause/resume/trigger) */
|
|
7
|
+
jobId?: string;
|
|
8
|
+
/** Task prompt to execute on schedule */
|
|
9
|
+
prompt?: string;
|
|
10
|
+
/** Cron expression or shorthand ('5m', '1h', '0 9 * * *') */
|
|
11
|
+
schedule?: string;
|
|
12
|
+
/** Human-readable job name */
|
|
13
|
+
name?: string;
|
|
14
|
+
/** Repeat count (null = infinite) */
|
|
15
|
+
repeat?: number | null;
|
|
16
|
+
/** Allowed tools for the scheduled task */
|
|
17
|
+
allowedTools?: string[];
|
|
18
|
+
/** Whether the job is enabled */
|
|
19
|
+
enabled?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare const CRON_TOOL_SCHEMA: {
|
|
22
|
+
readonly type: "object";
|
|
23
|
+
readonly properties: {
|
|
24
|
+
readonly action: {
|
|
25
|
+
readonly type: "string";
|
|
26
|
+
readonly enum: readonly ["create", "list", "get", "update", "delete", "pause", "resume", "trigger"];
|
|
27
|
+
readonly description: "CRUD action: create/list/get/update/delete/pause/resume/trigger.";
|
|
28
|
+
};
|
|
29
|
+
readonly jobId: {
|
|
30
|
+
readonly type: "string";
|
|
31
|
+
readonly description: "Job ID. Required for get/update/delete/pause/resume/trigger.";
|
|
32
|
+
};
|
|
33
|
+
readonly prompt: {
|
|
34
|
+
readonly type: "string";
|
|
35
|
+
readonly description: "Task prompt to execute on schedule. Required for create.";
|
|
36
|
+
};
|
|
37
|
+
readonly schedule: {
|
|
38
|
+
readonly type: "string";
|
|
39
|
+
readonly description: string;
|
|
40
|
+
};
|
|
41
|
+
readonly name: {
|
|
42
|
+
readonly type: "string";
|
|
43
|
+
readonly description: "Human-readable job name.";
|
|
44
|
+
};
|
|
45
|
+
readonly repeat: {
|
|
46
|
+
readonly type: "number";
|
|
47
|
+
readonly description: "Number of times to repeat (null = infinite). Default: null.";
|
|
48
|
+
};
|
|
49
|
+
readonly allowedTools: {
|
|
50
|
+
readonly type: "array";
|
|
51
|
+
readonly items: {
|
|
52
|
+
readonly type: "string";
|
|
53
|
+
};
|
|
54
|
+
readonly description: "Tools the scheduled task is allowed to use.";
|
|
55
|
+
};
|
|
56
|
+
readonly enabled: {
|
|
57
|
+
readonly type: "boolean";
|
|
58
|
+
readonly description: "Whether the job is enabled (for update).";
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
readonly required: readonly ["action"];
|
|
62
|
+
};
|
|
63
|
+
export interface CronJob {
|
|
64
|
+
id: string;
|
|
65
|
+
name: string;
|
|
66
|
+
prompt: string;
|
|
67
|
+
schedule: string;
|
|
68
|
+
scheduleDisplay: string;
|
|
69
|
+
state: "scheduled" | "paused";
|
|
70
|
+
enabled: boolean;
|
|
71
|
+
repeat: {
|
|
72
|
+
times: number | null;
|
|
73
|
+
completed: number;
|
|
74
|
+
};
|
|
75
|
+
nextRunAt?: string;
|
|
76
|
+
lastRunAt?: string;
|
|
77
|
+
lastStatus?: "success" | "error" | null;
|
|
78
|
+
allowedTools?: string[];
|
|
79
|
+
}
|
|
80
|
+
export interface CronResult {
|
|
81
|
+
success: boolean;
|
|
82
|
+
job?: CronJob;
|
|
83
|
+
jobs?: CronJob[];
|
|
84
|
+
error?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Host-provided cron scheduler backend.
|
|
88
|
+
* Jobs are persisted locally and survive restarts.
|
|
89
|
+
*/
|
|
90
|
+
export interface CronToolDeps {
|
|
91
|
+
createJob(params: {
|
|
92
|
+
prompt: string;
|
|
93
|
+
schedule: string;
|
|
94
|
+
name?: string;
|
|
95
|
+
repeat?: number | null;
|
|
96
|
+
allowedTools?: string[];
|
|
97
|
+
}): Promise<CronResult>;
|
|
98
|
+
listJobs(): Promise<CronResult>;
|
|
99
|
+
getJob(jobId: string): Promise<CronResult>;
|
|
100
|
+
updateJob(jobId: string, updates: Partial<{
|
|
101
|
+
prompt: string;
|
|
102
|
+
schedule: string;
|
|
103
|
+
name: string;
|
|
104
|
+
enabled: boolean;
|
|
105
|
+
repeat: number | null;
|
|
106
|
+
allowedTools: string[];
|
|
107
|
+
}>): Promise<CronResult>;
|
|
108
|
+
deleteJob(jobId: string): Promise<CronResult>;
|
|
109
|
+
pauseJob(jobId: string): Promise<CronResult>;
|
|
110
|
+
resumeJob(jobId: string): Promise<CronResult>;
|
|
111
|
+
triggerJob(jobId: string): Promise<CronResult>;
|
|
112
|
+
/** Validate cron schedule expression. Returns error or null. */
|
|
113
|
+
validateSchedule?(schedule: string): string | null;
|
|
114
|
+
}
|
|
115
|
+
export declare const MAX_CRON_JOBS = 50;
|
|
116
|
+
export declare function createCronTool(deps: CronToolDeps): PortableTool<CronToolParams>;
|
|
117
|
+
//# sourceMappingURL=cron-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron-tool.d.ts","sourceRoot":"","sources":["../../../src/skills/tools/cron-tool.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AAE5E,eAAO,MAAM,cAAc,EAAG,MAAe,CAAC;AAE9C,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE1G,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,UAAU,CAAC;IACnB,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IA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,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7I,QAAQ,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IAChC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3C,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,YAAY,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACrL,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC9C,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7C,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC9C,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAE/C,gEAAgE;IAChE,gBAAgB,CAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CACpD;AAED,eAAO,MAAM,aAAa,KAAK,CAAC;AAEhC,wBAAgB,cAAc,CAAC,IAAI,EAAE,YAAY,GAAG,YAAY,CAAC,cAAc,CAAC,CAmG/E"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// Cron Tool — scheduled task management (CRUD).
|
|
3
|
+
// Reference: hermes-agent-main/tools/cronjob_tools.py
|
|
4
|
+
// Category: system
|
|
5
|
+
// ============================================================
|
|
6
|
+
export const CRON_TOOL_NAME = "cron";
|
|
7
|
+
export const CRON_TOOL_SCHEMA = {
|
|
8
|
+
type: "object",
|
|
9
|
+
properties: {
|
|
10
|
+
action: {
|
|
11
|
+
type: "string",
|
|
12
|
+
enum: ["create", "list", "get", "update", "delete", "pause", "resume", "trigger"],
|
|
13
|
+
description: "CRUD action: create/list/get/update/delete/pause/resume/trigger.",
|
|
14
|
+
},
|
|
15
|
+
jobId: {
|
|
16
|
+
type: "string",
|
|
17
|
+
description: "Job ID. Required for get/update/delete/pause/resume/trigger.",
|
|
18
|
+
},
|
|
19
|
+
prompt: {
|
|
20
|
+
type: "string",
|
|
21
|
+
description: "Task prompt to execute on schedule. Required for create.",
|
|
22
|
+
},
|
|
23
|
+
schedule: {
|
|
24
|
+
type: "string",
|
|
25
|
+
description: "Schedule expression. Supports:\n" +
|
|
26
|
+
"- Cron: '0 9 * * *' (every day at 9am)\n" +
|
|
27
|
+
"- Shorthand: '5m' (every 5 min), '1h' (hourly), '1d' (daily)\n" +
|
|
28
|
+
"Required for create.",
|
|
29
|
+
},
|
|
30
|
+
name: {
|
|
31
|
+
type: "string",
|
|
32
|
+
description: "Human-readable job name.",
|
|
33
|
+
},
|
|
34
|
+
repeat: {
|
|
35
|
+
type: "number",
|
|
36
|
+
description: "Number of times to repeat (null = infinite). Default: null.",
|
|
37
|
+
},
|
|
38
|
+
allowedTools: {
|
|
39
|
+
type: "array",
|
|
40
|
+
items: { type: "string" },
|
|
41
|
+
description: "Tools the scheduled task is allowed to use.",
|
|
42
|
+
},
|
|
43
|
+
enabled: {
|
|
44
|
+
type: "boolean",
|
|
45
|
+
description: "Whether the job is enabled (for update).",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
required: ["action"],
|
|
49
|
+
};
|
|
50
|
+
export const MAX_CRON_JOBS = 50;
|
|
51
|
+
export function createCronTool(deps) {
|
|
52
|
+
return {
|
|
53
|
+
name: CRON_TOOL_NAME,
|
|
54
|
+
label: "Cron",
|
|
55
|
+
description: "Manage scheduled tasks. Create recurring jobs with cron expressions or shorthand " +
|
|
56
|
+
"('5m', '1h', '0 9 * * *'). Jobs persist locally and survive restarts. " +
|
|
57
|
+
"Actions: create, list, get, update, delete, pause, resume, trigger (run now).",
|
|
58
|
+
parameters: CRON_TOOL_SCHEMA,
|
|
59
|
+
execute: async (_toolCallId, params) => {
|
|
60
|
+
switch (params.action) {
|
|
61
|
+
case "create": {
|
|
62
|
+
if (!params.prompt) {
|
|
63
|
+
return { content: [{ type: "text", text: "Error: prompt is required for create." }], details: { type: "cron", error: "missing_prompt" } };
|
|
64
|
+
}
|
|
65
|
+
if (!params.schedule) {
|
|
66
|
+
return { content: [{ type: "text", text: "Error: schedule is required for create." }], details: { type: "cron", error: "missing_schedule" } };
|
|
67
|
+
}
|
|
68
|
+
if (deps.validateSchedule) {
|
|
69
|
+
const err = deps.validateSchedule(params.schedule);
|
|
70
|
+
if (err)
|
|
71
|
+
return { content: [{ type: "text", text: `Error: invalid schedule — ${err}` }], details: { type: "cron", error: "invalid_schedule" } };
|
|
72
|
+
}
|
|
73
|
+
// Check max jobs limit
|
|
74
|
+
const existing = await deps.listJobs();
|
|
75
|
+
if (existing.jobs && existing.jobs.length >= MAX_CRON_JOBS) {
|
|
76
|
+
return { content: [{ type: "text", text: `Error: maximum ${MAX_CRON_JOBS} jobs reached. Delete unused jobs first.` }], details: { type: "cron", error: "max_jobs_reached" } };
|
|
77
|
+
}
|
|
78
|
+
const r = await deps.createJob({ prompt: params.prompt, schedule: params.schedule, name: params.name, repeat: params.repeat, allowedTools: params.allowedTools });
|
|
79
|
+
if (!r.success)
|
|
80
|
+
return { content: [{ type: "text", text: `Error: ${r.error}` }], details: { type: "cron", error: r.error } };
|
|
81
|
+
return { content: [{ type: "text", text: formatJob(r.job) }], details: { type: "cron", action: "create", jobId: r.job.id } };
|
|
82
|
+
}
|
|
83
|
+
case "list": {
|
|
84
|
+
const r = await deps.listJobs();
|
|
85
|
+
if (!r.jobs || r.jobs.length === 0) {
|
|
86
|
+
return { content: [{ type: "text", text: "No scheduled jobs." }], details: { type: "cron", action: "list", count: 0 } };
|
|
87
|
+
}
|
|
88
|
+
const lines = [`Scheduled jobs (${r.jobs.length}):`, ""];
|
|
89
|
+
for (const j of r.jobs) {
|
|
90
|
+
lines.push(`- **${j.name || j.id}** [${j.state}] ${j.scheduleDisplay} — next: ${j.nextRunAt || "N/A"}`);
|
|
91
|
+
}
|
|
92
|
+
return { content: [{ type: "text", text: lines.join("\n") }], details: { type: "cron", action: "list", count: r.jobs.length } };
|
|
93
|
+
}
|
|
94
|
+
case "get": {
|
|
95
|
+
if (!params.jobId)
|
|
96
|
+
return { content: [{ type: "text", text: "Error: jobId required." }], details: { type: "cron", error: "missing_jobId" } };
|
|
97
|
+
const r = await deps.getJob(params.jobId);
|
|
98
|
+
if (!r.success)
|
|
99
|
+
return { content: [{ type: "text", text: `Error: ${r.error}` }], details: { type: "cron", error: r.error } };
|
|
100
|
+
return { content: [{ type: "text", text: formatJob(r.job) }], details: { type: "cron", action: "get", jobId: params.jobId } };
|
|
101
|
+
}
|
|
102
|
+
case "update": {
|
|
103
|
+
if (!params.jobId)
|
|
104
|
+
return { content: [{ type: "text", text: "Error: jobId required." }], details: { type: "cron", error: "missing_jobId" } };
|
|
105
|
+
const updates = {};
|
|
106
|
+
if (params.prompt !== undefined)
|
|
107
|
+
updates.prompt = params.prompt;
|
|
108
|
+
if (params.schedule !== undefined)
|
|
109
|
+
updates.schedule = params.schedule;
|
|
110
|
+
if (params.name !== undefined)
|
|
111
|
+
updates.name = params.name;
|
|
112
|
+
if (params.enabled !== undefined)
|
|
113
|
+
updates.enabled = params.enabled;
|
|
114
|
+
if (params.repeat !== undefined)
|
|
115
|
+
updates.repeat = params.repeat;
|
|
116
|
+
if (params.allowedTools !== undefined)
|
|
117
|
+
updates.allowedTools = params.allowedTools;
|
|
118
|
+
const r = await deps.updateJob(params.jobId, updates);
|
|
119
|
+
if (!r.success)
|
|
120
|
+
return { content: [{ type: "text", text: `Error: ${r.error}` }], details: { type: "cron", error: r.error } };
|
|
121
|
+
return { content: [{ type: "text", text: `Job updated.\n${formatJob(r.job)}` }], details: { type: "cron", action: "update", jobId: params.jobId } };
|
|
122
|
+
}
|
|
123
|
+
case "delete": {
|
|
124
|
+
if (!params.jobId)
|
|
125
|
+
return { content: [{ type: "text", text: "Error: jobId required." }], details: { type: "cron", error: "missing_jobId" } };
|
|
126
|
+
const r = await deps.deleteJob(params.jobId);
|
|
127
|
+
if (!r.success)
|
|
128
|
+
return { content: [{ type: "text", text: `Error: ${r.error}` }], details: { type: "cron", error: r.error } };
|
|
129
|
+
return { content: [{ type: "text", text: `Job ${params.jobId} deleted.` }], details: { type: "cron", action: "delete", jobId: params.jobId } };
|
|
130
|
+
}
|
|
131
|
+
case "pause": {
|
|
132
|
+
if (!params.jobId)
|
|
133
|
+
return { content: [{ type: "text", text: "Error: jobId required." }], details: { type: "cron", error: "missing_jobId" } };
|
|
134
|
+
const r = await deps.pauseJob(params.jobId);
|
|
135
|
+
if (!r.success)
|
|
136
|
+
return { content: [{ type: "text", text: `Error: ${r.error}` }], details: { type: "cron", error: r.error } };
|
|
137
|
+
return { content: [{ type: "text", text: `Job ${params.jobId} paused.` }], details: { type: "cron", action: "pause", jobId: params.jobId } };
|
|
138
|
+
}
|
|
139
|
+
case "resume": {
|
|
140
|
+
if (!params.jobId)
|
|
141
|
+
return { content: [{ type: "text", text: "Error: jobId required." }], details: { type: "cron", error: "missing_jobId" } };
|
|
142
|
+
const r = await deps.resumeJob(params.jobId);
|
|
143
|
+
if (!r.success)
|
|
144
|
+
return { content: [{ type: "text", text: `Error: ${r.error}` }], details: { type: "cron", error: r.error } };
|
|
145
|
+
return { content: [{ type: "text", text: `Job ${params.jobId} resumed.` }], details: { type: "cron", action: "resume", jobId: params.jobId } };
|
|
146
|
+
}
|
|
147
|
+
case "trigger": {
|
|
148
|
+
if (!params.jobId)
|
|
149
|
+
return { content: [{ type: "text", text: "Error: jobId required." }], details: { type: "cron", error: "missing_jobId" } };
|
|
150
|
+
const r = await deps.triggerJob(params.jobId);
|
|
151
|
+
if (!r.success)
|
|
152
|
+
return { content: [{ type: "text", text: `Error: ${r.error}` }], details: { type: "cron", error: r.error } };
|
|
153
|
+
return { content: [{ type: "text", text: `Job ${params.jobId} triggered (running now).` }], details: { type: "cron", action: "trigger", jobId: params.jobId } };
|
|
154
|
+
}
|
|
155
|
+
default:
|
|
156
|
+
return { content: [{ type: "text", text: `Error: unknown action "${params.action}".` }], details: { type: "cron", error: "unknown_action" } };
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
function formatJob(job) {
|
|
162
|
+
const lines = [
|
|
163
|
+
`Job: ${job.name || job.id}`,
|
|
164
|
+
`ID: ${job.id}`,
|
|
165
|
+
`Schedule: ${job.scheduleDisplay} (${job.schedule})`,
|
|
166
|
+
`State: ${job.state}`,
|
|
167
|
+
`Repeat: ${job.repeat.times === null ? "infinite" : `${job.repeat.completed}/${job.repeat.times}`}`,
|
|
168
|
+
];
|
|
169
|
+
if (job.nextRunAt)
|
|
170
|
+
lines.push(`Next run: ${job.nextRunAt}`);
|
|
171
|
+
if (job.lastRunAt)
|
|
172
|
+
lines.push(`Last run: ${job.lastRunAt} (${job.lastStatus || "unknown"})`);
|
|
173
|
+
lines.push(`Prompt: ${job.prompt.slice(0, 100)}${job.prompt.length > 100 ? "..." : ""}`);
|
|
174
|
+
return lines.join("\n");
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=cron-tool.js.map
|