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,427 @@
|
|
|
1
|
+
const TOOL_CALL_NAME_MAX_CHARS = 64;
|
|
2
|
+
const TOOL_CALL_NAME_RE = /^[A-Za-z0-9_-]+$/;
|
|
3
|
+
const TOOL_CALL_TYPES = new Set(["toolCall", "toolUse", "functionCall"]);
|
|
4
|
+
const TRANSIENT_ERROR_RE = /rate limit|rate.limited|overloaded|too many requests|quota exceeded|timed?\s*out|billing|insufficient.*(balance|quota|credit)|try again later/i;
|
|
5
|
+
function isRawToolCallBlock(block) {
|
|
6
|
+
if (!block || typeof block !== "object") {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
const type = block.type;
|
|
10
|
+
return typeof type === "string" && TOOL_CALL_TYPES.has(type);
|
|
11
|
+
}
|
|
12
|
+
function hasToolCallInput(block) {
|
|
13
|
+
const hasInput = "input" in block ? block.input !== undefined && block.input !== null : false;
|
|
14
|
+
const hasArguments = "arguments" in block ? block.arguments !== undefined && block.arguments !== null : false;
|
|
15
|
+
return hasInput || hasArguments;
|
|
16
|
+
}
|
|
17
|
+
function hasNonEmptyStringField(value) {
|
|
18
|
+
return typeof value === "string" && value.trim().length > 0;
|
|
19
|
+
}
|
|
20
|
+
function hasToolCallId(block) {
|
|
21
|
+
return hasNonEmptyStringField(block.id);
|
|
22
|
+
}
|
|
23
|
+
function trimNonEmptyString(value) {
|
|
24
|
+
if (typeof value !== "string") {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
const trimmed = value.trim();
|
|
28
|
+
return trimmed || undefined;
|
|
29
|
+
}
|
|
30
|
+
function normalizeAllowedToolNames(allowedToolNames) {
|
|
31
|
+
if (!allowedToolNames) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
const normalized = new Set();
|
|
35
|
+
for (const name of allowedToolNames) {
|
|
36
|
+
if (typeof name !== "string") {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const trimmed = name.trim();
|
|
40
|
+
if (trimmed) {
|
|
41
|
+
normalized.add(trimmed.toLowerCase());
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return normalized.size > 0 ? normalized : null;
|
|
45
|
+
}
|
|
46
|
+
function hasToolCallName(block, allowedToolNames) {
|
|
47
|
+
if (typeof block.name !== "string") {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
const trimmed = block.name.trim();
|
|
51
|
+
if (!trimmed) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
if (trimmed.length > TOOL_CALL_NAME_MAX_CHARS || !TOOL_CALL_NAME_RE.test(trimmed)) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
if (!allowedToolNames) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
return allowedToolNames.has(trimmed.toLowerCase());
|
|
61
|
+
}
|
|
62
|
+
function redactSessionsSpawnAttachmentsArgs(value) {
|
|
63
|
+
if (!value || typeof value !== "object") {
|
|
64
|
+
return value;
|
|
65
|
+
}
|
|
66
|
+
const record = value;
|
|
67
|
+
const raw = record.attachments;
|
|
68
|
+
if (!Array.isArray(raw)) {
|
|
69
|
+
return value;
|
|
70
|
+
}
|
|
71
|
+
const next = raw.map((item) => {
|
|
72
|
+
if (!item || typeof item !== "object") {
|
|
73
|
+
return item;
|
|
74
|
+
}
|
|
75
|
+
const attachment = item;
|
|
76
|
+
if (!Object.hasOwn(attachment, "content")) {
|
|
77
|
+
return item;
|
|
78
|
+
}
|
|
79
|
+
const { content: _content, ...rest } = attachment;
|
|
80
|
+
return { ...rest, content: "__OPENCLAW_REDACTED__" };
|
|
81
|
+
});
|
|
82
|
+
return { ...record, attachments: next };
|
|
83
|
+
}
|
|
84
|
+
function sanitizeToolCallBlock(block) {
|
|
85
|
+
const rawName = typeof block.name === "string" ? block.name : undefined;
|
|
86
|
+
const trimmedName = rawName?.trim();
|
|
87
|
+
const hasTrimmedName = typeof trimmedName === "string" && trimmedName.length > 0;
|
|
88
|
+
const normalizedName = hasTrimmedName ? trimmedName : undefined;
|
|
89
|
+
const nameChanged = hasTrimmedName && rawName !== trimmedName;
|
|
90
|
+
const isDelegatedSessionSpawnToolCall = normalizedName?.toLowerCase() === "sessions_spawn";
|
|
91
|
+
if (!isDelegatedSessionSpawnToolCall) {
|
|
92
|
+
if (!nameChanged) {
|
|
93
|
+
return block;
|
|
94
|
+
}
|
|
95
|
+
return { ...block, name: normalizedName };
|
|
96
|
+
}
|
|
97
|
+
const nextArgs = redactSessionsSpawnAttachmentsArgs(block.arguments);
|
|
98
|
+
const nextInput = redactSessionsSpawnAttachmentsArgs(block.input);
|
|
99
|
+
if (nextArgs === block.arguments && nextInput === block.input && !nameChanged) {
|
|
100
|
+
return block;
|
|
101
|
+
}
|
|
102
|
+
const next = { ...block };
|
|
103
|
+
if (nameChanged && normalizedName) {
|
|
104
|
+
next.name = normalizedName;
|
|
105
|
+
}
|
|
106
|
+
if (nextArgs !== block.arguments || Object.hasOwn(block, "arguments")) {
|
|
107
|
+
next.arguments = nextArgs;
|
|
108
|
+
}
|
|
109
|
+
if (nextInput !== block.input || Object.hasOwn(block, "input")) {
|
|
110
|
+
next.input = nextInput;
|
|
111
|
+
}
|
|
112
|
+
return next;
|
|
113
|
+
}
|
|
114
|
+
function normalizeToolResultName(message, fallbackName) {
|
|
115
|
+
const rawToolName = message.toolName;
|
|
116
|
+
const normalizedToolName = trimNonEmptyString(rawToolName);
|
|
117
|
+
if (normalizedToolName) {
|
|
118
|
+
if (rawToolName === normalizedToolName) {
|
|
119
|
+
return message;
|
|
120
|
+
}
|
|
121
|
+
return { ...message, toolName: normalizedToolName };
|
|
122
|
+
}
|
|
123
|
+
const normalizedFallback = trimNonEmptyString(fallbackName);
|
|
124
|
+
if (normalizedFallback) {
|
|
125
|
+
return { ...message, toolName: normalizedFallback };
|
|
126
|
+
}
|
|
127
|
+
if (typeof rawToolName === "string") {
|
|
128
|
+
return { ...message, toolName: "unknown" };
|
|
129
|
+
}
|
|
130
|
+
return message;
|
|
131
|
+
}
|
|
132
|
+
function extractToolCallsFromAssistantLike(message) {
|
|
133
|
+
const content = message.content;
|
|
134
|
+
if (!Array.isArray(content)) {
|
|
135
|
+
return [];
|
|
136
|
+
}
|
|
137
|
+
const toolCalls = [];
|
|
138
|
+
for (const block of content) {
|
|
139
|
+
if (!block || typeof block !== "object") {
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
const record = block;
|
|
143
|
+
if (typeof record.id !== "string" || !record.id) {
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
if (typeof record.type === "string" && TOOL_CALL_TYPES.has(record.type)) {
|
|
147
|
+
toolCalls.push({
|
|
148
|
+
id: record.id,
|
|
149
|
+
name: typeof record.name === "string" ? record.name : undefined,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return toolCalls;
|
|
154
|
+
}
|
|
155
|
+
function extractToolResultIdLike(message) {
|
|
156
|
+
if (typeof message.toolCallId === "string" && message.toolCallId) {
|
|
157
|
+
return message.toolCallId;
|
|
158
|
+
}
|
|
159
|
+
if (typeof message.toolUseId === "string" && message.toolUseId) {
|
|
160
|
+
return message.toolUseId;
|
|
161
|
+
}
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
function defaultMissingToolResult(params) {
|
|
165
|
+
return {
|
|
166
|
+
role: "toolResult",
|
|
167
|
+
toolCallId: params.toolCallId,
|
|
168
|
+
toolName: params.toolName ?? "unknown",
|
|
169
|
+
content: [
|
|
170
|
+
{
|
|
171
|
+
type: "text",
|
|
172
|
+
text: "[qlogicagent] missing tool result in session history; inserted synthetic error result for transcript repair.",
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
isError: true,
|
|
176
|
+
timestamp: 0,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
export function stripToolResultDetails(messages) {
|
|
180
|
+
let touched = false;
|
|
181
|
+
const out = [];
|
|
182
|
+
for (const message of messages) {
|
|
183
|
+
if (!message || typeof message !== "object" || message.role !== "toolResult") {
|
|
184
|
+
out.push(message);
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (!("details" in message)) {
|
|
188
|
+
out.push(message);
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
const sanitized = { ...message };
|
|
192
|
+
delete sanitized.details;
|
|
193
|
+
touched = true;
|
|
194
|
+
out.push(sanitized);
|
|
195
|
+
}
|
|
196
|
+
return touched ? out : [...messages];
|
|
197
|
+
}
|
|
198
|
+
export function repairToolCallInputs(messages, options) {
|
|
199
|
+
let droppedToolCalls = 0;
|
|
200
|
+
let droppedAssistantMessages = 0;
|
|
201
|
+
let changed = false;
|
|
202
|
+
const out = [];
|
|
203
|
+
const allowedToolNames = normalizeAllowedToolNames(options?.allowedToolNames);
|
|
204
|
+
for (const message of messages) {
|
|
205
|
+
if (!message || typeof message !== "object") {
|
|
206
|
+
out.push(message);
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
if (message.role !== "assistant" || !Array.isArray(message.content)) {
|
|
210
|
+
out.push(message);
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
const nextContent = [];
|
|
214
|
+
let droppedInMessage = 0;
|
|
215
|
+
let messageChanged = false;
|
|
216
|
+
for (const block of message.content) {
|
|
217
|
+
if (isRawToolCallBlock(block) &&
|
|
218
|
+
(!hasToolCallInput(block) ||
|
|
219
|
+
!hasToolCallId(block) ||
|
|
220
|
+
!hasToolCallName(block, allowedToolNames))) {
|
|
221
|
+
droppedToolCalls += 1;
|
|
222
|
+
droppedInMessage += 1;
|
|
223
|
+
changed = true;
|
|
224
|
+
messageChanged = true;
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
if (isRawToolCallBlock(block)) {
|
|
228
|
+
const blockName = typeof block.name === "string" ? block.name.trim() : undefined;
|
|
229
|
+
if (blockName?.toLowerCase() === "sessions_spawn") {
|
|
230
|
+
const sanitized = sanitizeToolCallBlock(block);
|
|
231
|
+
if (sanitized !== block) {
|
|
232
|
+
changed = true;
|
|
233
|
+
messageChanged = true;
|
|
234
|
+
}
|
|
235
|
+
nextContent.push(sanitized);
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
if (typeof block.name === "string") {
|
|
239
|
+
const trimmedName = block.name.trim();
|
|
240
|
+
if (trimmedName && trimmedName !== block.name) {
|
|
241
|
+
nextContent.push({ ...block, name: trimmedName });
|
|
242
|
+
changed = true;
|
|
243
|
+
messageChanged = true;
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
nextContent.push(block);
|
|
249
|
+
}
|
|
250
|
+
if (droppedInMessage > 0) {
|
|
251
|
+
if (nextContent.length === 0) {
|
|
252
|
+
droppedAssistantMessages += 1;
|
|
253
|
+
changed = true;
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
out.push({ ...message, content: nextContent });
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
if (messageChanged) {
|
|
260
|
+
out.push({ ...message, content: nextContent });
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
out.push(message);
|
|
264
|
+
}
|
|
265
|
+
return {
|
|
266
|
+
messages: changed ? out : [...messages],
|
|
267
|
+
droppedToolCalls,
|
|
268
|
+
droppedAssistantMessages,
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
export function sanitizeToolCallInputs(messages, options) {
|
|
272
|
+
return repairToolCallInputs(messages, options).messages;
|
|
273
|
+
}
|
|
274
|
+
export function repairToolUseResultPairing(messages, options) {
|
|
275
|
+
const out = [];
|
|
276
|
+
const added = [];
|
|
277
|
+
const seenToolResultIds = new Set();
|
|
278
|
+
let droppedDuplicateCount = 0;
|
|
279
|
+
let droppedOrphanCount = 0;
|
|
280
|
+
let moved = false;
|
|
281
|
+
let changed = false;
|
|
282
|
+
const createMissingToolResult = options?.createMissingToolResult ?? (defaultMissingToolResult);
|
|
283
|
+
const pushToolResult = (message) => {
|
|
284
|
+
const id = extractToolResultIdLike(message);
|
|
285
|
+
if (id && seenToolResultIds.has(id)) {
|
|
286
|
+
droppedDuplicateCount += 1;
|
|
287
|
+
changed = true;
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (id) {
|
|
291
|
+
seenToolResultIds.add(id);
|
|
292
|
+
}
|
|
293
|
+
out.push(message);
|
|
294
|
+
};
|
|
295
|
+
for (let i = 0; i < messages.length; i += 1) {
|
|
296
|
+
const message = messages[i];
|
|
297
|
+
if (!message || typeof message !== "object") {
|
|
298
|
+
out.push(message);
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
301
|
+
if (message.role !== "assistant") {
|
|
302
|
+
if (message.role !== "toolResult") {
|
|
303
|
+
out.push(message);
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
droppedOrphanCount += 1;
|
|
307
|
+
changed = true;
|
|
308
|
+
}
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
const stopReason = message.stopReason;
|
|
312
|
+
if (stopReason === "error" || stopReason === "aborted") {
|
|
313
|
+
out.push(message);
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
const toolCalls = extractToolCallsFromAssistantLike(message);
|
|
317
|
+
if (toolCalls.length === 0) {
|
|
318
|
+
out.push(message);
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
const toolCallIds = new Set(toolCalls.map((toolCall) => toolCall.id));
|
|
322
|
+
const toolCallNamesById = new Map(toolCalls.map((toolCall) => [toolCall.id, toolCall.name]));
|
|
323
|
+
const spanResultsById = new Map();
|
|
324
|
+
const remainder = [];
|
|
325
|
+
let j = i + 1;
|
|
326
|
+
for (; j < messages.length; j += 1) {
|
|
327
|
+
const next = messages[j];
|
|
328
|
+
if (!next || typeof next !== "object") {
|
|
329
|
+
remainder.push(next);
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
if (next.role === "assistant") {
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
if (next.role === "toolResult") {
|
|
336
|
+
const id = extractToolResultIdLike(next);
|
|
337
|
+
if (id && toolCallIds.has(id)) {
|
|
338
|
+
if (seenToolResultIds.has(id)) {
|
|
339
|
+
droppedDuplicateCount += 1;
|
|
340
|
+
changed = true;
|
|
341
|
+
continue;
|
|
342
|
+
}
|
|
343
|
+
const normalizedToolResult = normalizeToolResultName(next, toolCallNamesById.get(id));
|
|
344
|
+
if (normalizedToolResult !== next) {
|
|
345
|
+
changed = true;
|
|
346
|
+
}
|
|
347
|
+
if (!spanResultsById.has(id)) {
|
|
348
|
+
spanResultsById.set(id, normalizedToolResult);
|
|
349
|
+
}
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
if (next.role !== "toolResult") {
|
|
354
|
+
remainder.push(next);
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
droppedOrphanCount += 1;
|
|
358
|
+
changed = true;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
out.push(message);
|
|
362
|
+
if (spanResultsById.size > 0 && remainder.length > 0) {
|
|
363
|
+
moved = true;
|
|
364
|
+
changed = true;
|
|
365
|
+
}
|
|
366
|
+
for (const call of toolCalls) {
|
|
367
|
+
const existing = spanResultsById.get(call.id);
|
|
368
|
+
if (existing) {
|
|
369
|
+
pushToolResult(existing);
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
const missing = createMissingToolResult({
|
|
373
|
+
toolCallId: call.id,
|
|
374
|
+
toolName: call.name,
|
|
375
|
+
});
|
|
376
|
+
added.push(missing);
|
|
377
|
+
changed = true;
|
|
378
|
+
pushToolResult(missing);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
for (const rem of remainder) {
|
|
382
|
+
out.push(rem);
|
|
383
|
+
}
|
|
384
|
+
i = j - 1;
|
|
385
|
+
}
|
|
386
|
+
const changedOrMoved = changed || moved;
|
|
387
|
+
return {
|
|
388
|
+
messages: changedOrMoved ? out : [...messages],
|
|
389
|
+
added,
|
|
390
|
+
droppedDuplicateCount,
|
|
391
|
+
droppedOrphanCount,
|
|
392
|
+
moved: changedOrMoved,
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
export function sanitizeToolUseResultPairing(messages, options) {
|
|
396
|
+
return repairToolUseResultPairing(messages, options).messages;
|
|
397
|
+
}
|
|
398
|
+
export function stripTransientErrorMessages(messages) {
|
|
399
|
+
let changed = false;
|
|
400
|
+
const out = [];
|
|
401
|
+
for (const message of messages) {
|
|
402
|
+
if (!message || typeof message !== "object") {
|
|
403
|
+
out.push(message);
|
|
404
|
+
continue;
|
|
405
|
+
}
|
|
406
|
+
if (message.role !== "assistant" || message.stopReason !== "error") {
|
|
407
|
+
out.push(message);
|
|
408
|
+
continue;
|
|
409
|
+
}
|
|
410
|
+
const content = message.content;
|
|
411
|
+
const text = typeof content === "string"
|
|
412
|
+
? content
|
|
413
|
+
: Array.isArray(content)
|
|
414
|
+
? content
|
|
415
|
+
.filter((block) => block.type === "text")
|
|
416
|
+
.map((block) => block.text ?? "")
|
|
417
|
+
.join(" ")
|
|
418
|
+
: "";
|
|
419
|
+
if (!TRANSIENT_ERROR_RE.test(text)) {
|
|
420
|
+
out.push(message);
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
changed = true;
|
|
424
|
+
}
|
|
425
|
+
return changed ? out : [...messages];
|
|
426
|
+
}
|
|
427
|
+
//# sourceMappingURL=transcript-repair.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcript-repair.js","sourceRoot":"","sources":["../../src/orchestration/transcript-repair.ts"],"names":[],"mappings":"AAuCA,MAAM,wBAAwB,GAAG,EAAE,CAAC;AACpC,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAC7C,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC;AACzE,MAAM,kBAAkB,GACtB,gJAAgJ,CAAC;AAUnJ,SAAS,kBAAkB,CAAC,KAAc;IACxC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,IAAI,GAAI,KAA4B,CAAC,IAAI,CAAC;IACh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,CAAC;gBACd,CAAC,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACnC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAClB,SAAS;QACX,CAAC;QACD,OAAO,GAAG,IAAI,CAAC;IACjB,CAAC;IACD,OAAO,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turn Loop Guard — Abort signal + token budget warning for preventive termination.
|
|
3
|
+
*
|
|
4
|
+
* Aligned with Claude Code's multi-condition termination:
|
|
5
|
+
* 1. AbortSignal from user cancellation
|
|
6
|
+
* 2. Token budget pre-check (don't send API call if over budget)
|
|
7
|
+
* 3. max_output_tokens escalation on truncation
|
|
8
|
+
* 4. Prompt-too-long reactive compact trigger
|
|
9
|
+
*/
|
|
10
|
+
export interface TurnLoopGuardConfig {
|
|
11
|
+
/** Context window size in tokens. */
|
|
12
|
+
contextWindowTokens: number;
|
|
13
|
+
/** Buffer reserved for response (default: 13000). */
|
|
14
|
+
responseBufferTokens: number;
|
|
15
|
+
/** Max output tokens for current model. */
|
|
16
|
+
maxOutputTokens: number;
|
|
17
|
+
/** Abort signal for user cancellation. */
|
|
18
|
+
abortSignal?: AbortSignal;
|
|
19
|
+
/** Whether reactive compact is available. */
|
|
20
|
+
reactiveCompactEnabled: boolean;
|
|
21
|
+
/** Whether max_output_tokens escalation is allowed. */
|
|
22
|
+
outputEscalationEnabled: boolean;
|
|
23
|
+
}
|
|
24
|
+
export type TokenWarningState = {
|
|
25
|
+
level: "ok";
|
|
26
|
+
} | {
|
|
27
|
+
level: "warning";
|
|
28
|
+
usagePercent: number;
|
|
29
|
+
remainingTokens: number;
|
|
30
|
+
} | {
|
|
31
|
+
level: "blocking";
|
|
32
|
+
usagePercent: number;
|
|
33
|
+
reason: "prompt_too_long" | "budget_exhausted";
|
|
34
|
+
};
|
|
35
|
+
export interface TurnLoopGuardState {
|
|
36
|
+
/** Current accumulated prompt tokens. */
|
|
37
|
+
promptTokens: number;
|
|
38
|
+
/** Whether reactive compact has already been attempted this turn. */
|
|
39
|
+
hasAttemptedReactiveCompact: boolean;
|
|
40
|
+
/** Current max_output_tokens (may escalate). */
|
|
41
|
+
currentMaxOutputTokens: number;
|
|
42
|
+
/** Number of consecutive max_tokens truncations. */
|
|
43
|
+
consecutiveTruncations: number;
|
|
44
|
+
/** Whether the turn has been aborted. */
|
|
45
|
+
aborted: boolean;
|
|
46
|
+
}
|
|
47
|
+
/** Initial guard state. */
|
|
48
|
+
export declare function createTurnLoopGuardState(config: TurnLoopGuardConfig): TurnLoopGuardState;
|
|
49
|
+
/**
|
|
50
|
+
* Calculate token warning state before making an API call.
|
|
51
|
+
* If level is "blocking", do NOT send the API call.
|
|
52
|
+
*/
|
|
53
|
+
export declare function calculateTokenWarningState(state: TurnLoopGuardState, config: TurnLoopGuardConfig): TokenWarningState;
|
|
54
|
+
/**
|
|
55
|
+
* Handle API error and determine recovery action.
|
|
56
|
+
*/
|
|
57
|
+
export type ApiErrorRecovery = {
|
|
58
|
+
action: "reactive_compact";
|
|
59
|
+
} | {
|
|
60
|
+
action: "escalate_output_tokens";
|
|
61
|
+
newMax: number;
|
|
62
|
+
} | {
|
|
63
|
+
action: "retry";
|
|
64
|
+
reason: string;
|
|
65
|
+
} | {
|
|
66
|
+
action: "abort";
|
|
67
|
+
reason: string;
|
|
68
|
+
};
|
|
69
|
+
export declare function resolveApiErrorRecovery(error: {
|
|
70
|
+
type?: string;
|
|
71
|
+
status?: number;
|
|
72
|
+
message?: string;
|
|
73
|
+
}, state: TurnLoopGuardState, config: TurnLoopGuardConfig): ApiErrorRecovery;
|
|
74
|
+
/**
|
|
75
|
+
* Handle finish_reason === "max_tokens" — escalate max_output_tokens.
|
|
76
|
+
*
|
|
77
|
+
* CC pattern: double the output token budget up to model max.
|
|
78
|
+
*/
|
|
79
|
+
export declare function resolveOutputTokenEscalation(state: TurnLoopGuardState, config: TurnLoopGuardConfig, modelMaxOutput: number): {
|
|
80
|
+
shouldEscalate: boolean;
|
|
81
|
+
newMax: number;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Check if the turn should be aborted (user cancellation).
|
|
85
|
+
*/
|
|
86
|
+
export declare function shouldAbortTurn(state: TurnLoopGuardState, config: TurnLoopGuardConfig): boolean;
|
|
87
|
+
//# sourceMappingURL=turn-loop-guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn-loop-guard.d.ts","sourceRoot":"","sources":["../../src/orchestration/turn-loop-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,WAAW,mBAAmB;IAClC,qCAAqC;IACrC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,qDAAqD;IACrD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,2CAA2C;IAC3C,eAAe,EAAE,MAAM,CAAC;IACxB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,6CAA6C;IAC7C,sBAAsB,EAAE,OAAO,CAAC;IAChC,uDAAuD;IACvD,uBAAuB,EAAE,OAAO,CAAC;CAClC;AAED,MAAM,MAAM,iBAAiB,GACzB;IAAE,KAAK,EAAE,IAAI,CAAA;CAAE,GACf;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,GACnE;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,iBAAiB,GAAG,kBAAkB,CAAA;CAAE,CAAC;AAEhG,MAAM,WAAW,kBAAkB;IACjC,yCAAyC;IACzC,YAAY,EAAE,MAAM,CAAC;IACrB,qEAAqE;IACrE,2BAA2B,EAAE,OAAO,C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**
|
|
2
|
+
* Turn Loop Guard — Abort signal + token budget warning for preventive termination.
|
|
3
|
+
*
|
|
4
|
+
* Aligned with Claude Code's multi-condition termination:
|
|
5
|
+
* 1. AbortSignal from user cancellation
|
|
6
|
+
* 2. Token budget pre-check (don't send API call if over budget)
|
|
7
|
+
* 3. max_output_tokens escalation on truncation
|
|
8
|
+
* 4. Prompt-too-long reactive compact trigger
|
|
9
|
+
*/
|
|
10
|
+
/** Initial guard state. */
|
|
11
|
+
export function createTurnLoopGuardState(config) {
|
|
12
|
+
return {
|
|
13
|
+
promptTokens: 0,
|
|
14
|
+
hasAttemptedReactiveCompact: false,
|
|
15
|
+
currentMaxOutputTokens: config.maxOutputTokens,
|
|
16
|
+
consecutiveTruncations: 0,
|
|
17
|
+
aborted: config.abortSignal?.aborted ?? false,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Calculate token warning state before making an API call.
|
|
22
|
+
* If level is "blocking", do NOT send the API call.
|
|
23
|
+
*/
|
|
24
|
+
export function calculateTokenWarningState(state, config) {
|
|
25
|
+
if (state.aborted) {
|
|
26
|
+
return { level: "blocking", usagePercent: 100, reason: "budget_exhausted" };
|
|
27
|
+
}
|
|
28
|
+
const effectiveLimit = config.contextWindowTokens - config.responseBufferTokens - state.currentMaxOutputTokens;
|
|
29
|
+
const usagePercent = effectiveLimit > 0 ? (state.promptTokens / effectiveLimit) * 100 : 100;
|
|
30
|
+
if (state.promptTokens >= effectiveLimit) {
|
|
31
|
+
if (state.hasAttemptedReactiveCompact || !config.reactiveCompactEnabled) {
|
|
32
|
+
return { level: "blocking", usagePercent, reason: "prompt_too_long" };
|
|
33
|
+
}
|
|
34
|
+
return { level: "blocking", usagePercent, reason: "prompt_too_long" };
|
|
35
|
+
}
|
|
36
|
+
// Warning at 85%
|
|
37
|
+
if (usagePercent >= 85) {
|
|
38
|
+
return { level: "warning", usagePercent, remainingTokens: effectiveLimit - state.promptTokens };
|
|
39
|
+
}
|
|
40
|
+
return { level: "ok" };
|
|
41
|
+
}
|
|
42
|
+
export function resolveApiErrorRecovery(error, state, config) {
|
|
43
|
+
const msg = error.message?.toLowerCase() ?? "";
|
|
44
|
+
const status = error.status ?? 0;
|
|
45
|
+
// Prompt too long (413 or specific error message)
|
|
46
|
+
if (status === 413 || msg.includes("prompt_too_long") || msg.includes("context_length_exceeded")) {
|
|
47
|
+
if (!state.hasAttemptedReactiveCompact && config.reactiveCompactEnabled) {
|
|
48
|
+
return { action: "reactive_compact" };
|
|
49
|
+
}
|
|
50
|
+
return { action: "abort", reason: "prompt_too_long_unrecoverable" };
|
|
51
|
+
}
|
|
52
|
+
// 5xx transient errors
|
|
53
|
+
if (status >= 500 && status < 600) {
|
|
54
|
+
return { action: "retry", reason: `server_error_${status}` };
|
|
55
|
+
}
|
|
56
|
+
// Rate limit
|
|
57
|
+
if (status === 429) {
|
|
58
|
+
return { action: "retry", reason: "rate_limited" };
|
|
59
|
+
}
|
|
60
|
+
return { action: "abort", reason: msg || "unknown_error" };
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Handle finish_reason === "max_tokens" — escalate max_output_tokens.
|
|
64
|
+
*
|
|
65
|
+
* CC pattern: double the output token budget up to model max.
|
|
66
|
+
*/
|
|
67
|
+
export function resolveOutputTokenEscalation(state, config, modelMaxOutput) {
|
|
68
|
+
if (!config.outputEscalationEnabled) {
|
|
69
|
+
return { shouldEscalate: false, newMax: state.currentMaxOutputTokens };
|
|
70
|
+
}
|
|
71
|
+
// Don't escalate more than 3 times
|
|
72
|
+
if (state.consecutiveTruncations >= 3) {
|
|
73
|
+
return { shouldEscalate: false, newMax: state.currentMaxOutputTokens };
|
|
74
|
+
}
|
|
75
|
+
const newMax = Math.min(state.currentMaxOutputTokens * 2, modelMaxOutput);
|
|
76
|
+
if (newMax <= state.currentMaxOutputTokens) {
|
|
77
|
+
return { shouldEscalate: false, newMax: state.currentMaxOutputTokens };
|
|
78
|
+
}
|
|
79
|
+
return { shouldEscalate: true, newMax };
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Check if the turn should be aborted (user cancellation).
|
|
83
|
+
*/
|
|
84
|
+
export function shouldAbortTurn(state, config) {
|
|
85
|
+
if (state.aborted)
|
|
86
|
+
return true;
|
|
87
|
+
if (config.abortSignal?.aborted) {
|
|
88
|
+
state.aborted = true;
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=turn-loop-guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn-loop-guard.js","sourceRoot":"","sources":["../../src/orchestration/turn-loop-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAmCH,2BAA2B;AAC3B,MAAM,UAAU,wBAAwB,CAAC,MAA2B;IAClE,OAAO;QACL,YAAY,EAAE,CAAC;QACf,2BAA2B,EAAE,KAAK;QAClC,sBAAsB,EAAE,MAAM,CAAC,eAAe;QAC9C,sBAAsB,EAAE,CAAC;QACzB,OAAO,EAAE,MAAM,CAAC,WAAW,EAAE,OAAO,IAAI,KAAK;KAC9C,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CACxC,KAAyB,EACzB,MAA2B;IAE3B,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QAClB,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC9E,CAAC;IAED,MAAM,cAAc,GAAG,MAAM,CAAC,mBAAmB,GAAG,MAAM,CAAC,oBAAoB,GAAG,KAAK,CAAC,sBAAsB,CAAC;IAC/G,MAAM,YAAY,GAAG,cAAc,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,GAAG,cAAc,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IAE5F,IAAI,KAAK,CAAC,YAA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AAI,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { WebCapabilityDescriptorContract, WebCapabilityFamily, WebDegradationTarget, WebEscalationReason, WebTaskMode } from "qlogicagent-runtime-contracts";
|
|
2
|
+
export interface ResolveWebBrowserPolicyInput {
|
|
3
|
+
capability?: Pick<WebCapabilityDescriptorContract, "capabilityFamily" | "taskMode" | "degradationTarget" | "upgradeTargets" | "escalationReasons" | "supportsLoginState" | "supportsPersistentProfile" | "supportsTransactionality">;
|
|
4
|
+
needsInteractiveSession?: boolean;
|
|
5
|
+
needsLoginState?: boolean;
|
|
6
|
+
needsPersistentSession?: boolean;
|
|
7
|
+
needsStateChangingAction?: boolean;
|
|
8
|
+
browserAvailable?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ResolveWebBrowserPolicyResult {
|
|
11
|
+
selectedCapabilityFamily: WebCapabilityFamily;
|
|
12
|
+
selectedTaskMode?: WebTaskMode;
|
|
13
|
+
shouldEscalateToBrowser: boolean;
|
|
14
|
+
degradationTarget?: WebDegradationTarget;
|
|
15
|
+
escalationReasons: WebEscalationReason[];
|
|
16
|
+
}
|
|
17
|
+
export declare function resolveWebBrowserPolicy(params: ResolveWebBrowserPolicyInput): ResolveWebBrowserPolicyResult;
|
|
18
|
+
//# sourceMappingURL=web-browser-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-browser-policy.d.ts","sourceRoot":"","sources":["../../src/orchestration/web-browser-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,+BAA+B,EAC/B,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,EACZ,MAAM,+BAA+B,CAAC;AAEvC,MAAM,WAAW,4BAA4B;IAC3C,UAAU,CAAC,EAAE,IAAI,CACf,+BAA+B,EAC7B,kBAAkB,GAClB,UAAU,GACV,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,oBAAoB,GACpB,2BAA2B,GAC3B,0BAA0B,CAC7B,CAAC;IACF,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,6BAA6B;IAC5C,wBAAwB,EAAE,mBAAmB,CAAC;IAC9C,gBAAgB,CAAC,EAAE,WAAW,CAAC;IAC/B,uBAAuB,EAAE,OAAO,CAAC;IACjC,iBAAiB,CAAC,EAAE,oBAAoB,CAAC;IACzC,iBAAiB,EAAE,mBAAmB,EAAE,CAAC;CAC1C;AAQD,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,4BAA4B,GACnC,6BAA6B,CAuC/B"}
|