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,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Curator scheduler — pure strategy for autonomous skill library
|
|
3
|
+
* maintenance. Decides WHEN to run the curator review cycle and
|
|
4
|
+
* computes automatic lifecycle transitions (active → stale → archived).
|
|
5
|
+
*
|
|
6
|
+
* No I/O — all functions are pure; the caller supplies timestamps and
|
|
7
|
+
* skill records, and receives transition instructions back.
|
|
8
|
+
*/
|
|
9
|
+
export const DEFAULT_CURATOR_SCHEDULE_POLICY = {
|
|
10
|
+
minIdleSeconds: 7200,
|
|
11
|
+
intervalSeconds: 604_800,
|
|
12
|
+
staleAfterDays: 30,
|
|
13
|
+
archiveAfterDays: 90,
|
|
14
|
+
maxReviewBatchSize: 50,
|
|
15
|
+
};
|
|
16
|
+
export const INITIAL_CURATOR_STATE = {
|
|
17
|
+
lastRunAt: null,
|
|
18
|
+
lastRunDurationSeconds: 0,
|
|
19
|
+
lastRunSummary: "",
|
|
20
|
+
paused: false,
|
|
21
|
+
runCount: 0,
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Determine whether the curator should run now.
|
|
25
|
+
*
|
|
26
|
+
* All gates must pass:
|
|
27
|
+
* 1. Feature enabled
|
|
28
|
+
* 2. Not paused
|
|
29
|
+
* 3. Session idle ≥ minIdleSeconds
|
|
30
|
+
* 4. Time since last run ≥ intervalSeconds
|
|
31
|
+
*/
|
|
32
|
+
export function shouldRunCurator(input) {
|
|
33
|
+
const policy = { ...DEFAULT_CURATOR_SCHEDULE_POLICY, ...input.policy };
|
|
34
|
+
if (!input.enabled) {
|
|
35
|
+
return { shouldRun: false, reason: "curator disabled" };
|
|
36
|
+
}
|
|
37
|
+
if (input.state.paused) {
|
|
38
|
+
return { shouldRun: false, reason: "curator paused by user" };
|
|
39
|
+
}
|
|
40
|
+
if (input.idleSeconds < policy.minIdleSeconds) {
|
|
41
|
+
return {
|
|
42
|
+
shouldRun: false,
|
|
43
|
+
reason: `session not idle long enough (${input.idleSeconds}s < ${policy.minIdleSeconds}s)`,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
if (input.state.lastRunAt) {
|
|
47
|
+
const elapsed = (new Date(input.now).getTime() - new Date(input.state.lastRunAt).getTime()) / 1000;
|
|
48
|
+
if (elapsed < policy.intervalSeconds) {
|
|
49
|
+
return {
|
|
50
|
+
shouldRun: false,
|
|
51
|
+
reason: `last run too recent (${Math.round(elapsed)}s < ${policy.intervalSeconds}s)`,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return { shouldRun: true, reason: "all gates passed" };
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Compute automatic lifecycle transitions for agent-created skills.
|
|
59
|
+
*
|
|
60
|
+
* Pure function — no I/O, no mutations. The caller applies the
|
|
61
|
+
* returned transitions to its skill storage.
|
|
62
|
+
*
|
|
63
|
+
* Rules:
|
|
64
|
+
* - Pinned skills are never transitioned.
|
|
65
|
+
* - Non-agent-created skills are skipped.
|
|
66
|
+
* - active → stale: no activity for staleAfterDays.
|
|
67
|
+
* - stale → archived: no activity for archiveAfterDays.
|
|
68
|
+
* - stale/archived → active: if useCount increased (reactivation).
|
|
69
|
+
*/
|
|
70
|
+
export function computeLifecycleTransitions(skills, now, policy) {
|
|
71
|
+
const resolved = { ...DEFAULT_CURATOR_SCHEDULE_POLICY, ...policy };
|
|
72
|
+
const nowMs = new Date(now).getTime();
|
|
73
|
+
const transitions = [];
|
|
74
|
+
let checked = 0;
|
|
75
|
+
for (const skill of skills) {
|
|
76
|
+
if (!skill.agentCreated)
|
|
77
|
+
continue;
|
|
78
|
+
checked++;
|
|
79
|
+
if (skill.pinned)
|
|
80
|
+
continue;
|
|
81
|
+
const lastMs = skill.lastActivityAt
|
|
82
|
+
? new Date(skill.lastActivityAt).getTime()
|
|
83
|
+
: new Date(skill.createdAt).getTime();
|
|
84
|
+
const inactiveDays = (nowMs - lastMs) / (1000 * 60 * 60 * 24);
|
|
85
|
+
if (skill.state === "active" && inactiveDays >= resolved.staleAfterDays) {
|
|
86
|
+
transitions.push({
|
|
87
|
+
skillName: skill.name,
|
|
88
|
+
from: "active",
|
|
89
|
+
to: "stale",
|
|
90
|
+
reason: `inactive for ${Math.floor(inactiveDays)} days (threshold: ${resolved.staleAfterDays})`,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
else if (skill.state === "stale" && inactiveDays >= resolved.archiveAfterDays) {
|
|
94
|
+
transitions.push({
|
|
95
|
+
skillName: skill.name,
|
|
96
|
+
from: "stale",
|
|
97
|
+
to: "archived",
|
|
98
|
+
reason: `inactive for ${Math.floor(inactiveDays)} days (threshold: ${resolved.archiveAfterDays})`,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
// Reactivation: stale/archived skill with recent activity
|
|
102
|
+
if ((skill.state === "stale" || skill.state === "archived")
|
|
103
|
+
&& skill.useCount > 0
|
|
104
|
+
&& inactiveDays < resolved.staleAfterDays) {
|
|
105
|
+
transitions.push({
|
|
106
|
+
skillName: skill.name,
|
|
107
|
+
from: skill.state,
|
|
108
|
+
to: "active",
|
|
109
|
+
reason: "recent activity detected — reactivated",
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
checked,
|
|
115
|
+
transitions,
|
|
116
|
+
markedStale: transitions.filter((t) => t.to === "stale").length,
|
|
117
|
+
archived: transitions.filter((t) => t.to === "archived").length,
|
|
118
|
+
reactivated: transitions.filter((t) => t.to === "active").length,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
// ── Review candidate selection ─────────────────────────────────────
|
|
122
|
+
/**
|
|
123
|
+
* Select skills that should be reviewed by the LLM curator.
|
|
124
|
+
*
|
|
125
|
+
* Only non-pinned, agent-created skills in active or stale state
|
|
126
|
+
* are eligible for review. Returns at most maxReviewBatchSize names.
|
|
127
|
+
*/
|
|
128
|
+
export function selectReviewCandidates(skills, policy) {
|
|
129
|
+
const resolved = { ...DEFAULT_CURATOR_SCHEDULE_POLICY, ...policy };
|
|
130
|
+
return skills
|
|
131
|
+
.filter((s) => s.agentCreated && !s.pinned && (s.state === "active" || s.state === "stale"))
|
|
132
|
+
.sort((a, b) => a.useCount - b.useCount) // least-used first → most likely consolidation candidates
|
|
133
|
+
.slice(0, resolved.maxReviewBatchSize)
|
|
134
|
+
.map((s) => s.name);
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=curator-scheduler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"curator-scheduler.js","sourceRoot":"","sources":["../../src/orchestration/curator-scheduler.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAkBH,MAAM,CAAC,MAAM,+BAA+B,GAA0B;IACpE,cAAc,EAAE,IAAI;IACpB,eAAe,EAAE,OAAO;IACxB,cAAc,EAAE,EAAE;IAClB,gBAAgB,EAAE,EAAE;IACpB,kBAAkB,EAAE,EAAE;CACvB,CAAC;AAkBF,MAAM,CAAC,MAAM,qBAAqB,GAAiB;IACjD,SAAS,EAAE,IAAI;IACf,sBAAsB,EAAE,CAAC;IACzB,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,KAAK;IACb,QAAQ,EAAE,CAAC;CACZ,CAAC;AA+CF;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAuB;IACtD,MAAM,MAAM,GAAG,EAAE,GAAG,+BAA+B,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;IAEvE,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC1D,CAAC;IACD,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QACvB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,wBAAwB,EAAE,CAAC;IAChE,CAAC;IACD,IAAI,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,cAAc,EAAE,CAAC;QAC9C,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,MAAM,EAAE,iCAAiC,KAAK,CAAC,WAAW,OAAO,MAAM,CAAC,cAAc,IAAI;SAC3F,CAAC;IACJ,CAAC;IACD,IAAI,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,CA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AAE,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,CAAC,MAAM;QAC/D,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,MAAM;QAC/D,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC,MAAM;KACjE,CAAC;AACJ,CAAC;AAED,sEAAsE;AAEtE;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,MAAqC,EACrC,MAAuC;IAEvC,MAAM,QAAQ,GAAG,EAAE,GAAG,+BAA+B,EAAE,GAAG,MAAM,EAAE,CAAC;IAEnE,OAAO,MAAM;SACV,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,KAAK,KAAK,QAAQ,IAAI,CAAC,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC;SAC3F,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,0DAA0D;SAClG,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC;SACrC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
export type EmbeddedPromptFailureAction<TThinkingLevel extends string = string, TFailoverReason extends string = string> = {
|
|
2
|
+
kind: "retry-rotated";
|
|
3
|
+
} | {
|
|
4
|
+
kind: "retry-thinking";
|
|
5
|
+
thinkLevel: TThinkingLevel;
|
|
6
|
+
} | {
|
|
7
|
+
kind: "throw-failover";
|
|
8
|
+
reason: TFailoverReason | null;
|
|
9
|
+
} | {
|
|
10
|
+
kind: "unhandled";
|
|
11
|
+
};
|
|
12
|
+
export type EmbeddedAssistantFailureAction<TFailoverReason extends string = string> = {
|
|
13
|
+
kind: "retry-rotated";
|
|
14
|
+
} | {
|
|
15
|
+
kind: "throw-failover";
|
|
16
|
+
reason: TFailoverReason | null;
|
|
17
|
+
} | {
|
|
18
|
+
kind: "unhandled";
|
|
19
|
+
};
|
|
20
|
+
export type EmbeddedPromptErrorPolicyResolution<TThinkingLevel extends string = string, TFailoverReason extends string = string> = {
|
|
21
|
+
kind: "noop";
|
|
22
|
+
} | {
|
|
23
|
+
kind: "return-error";
|
|
24
|
+
errorKind: "role_ordering" | "image_size";
|
|
25
|
+
text: string;
|
|
26
|
+
message: string;
|
|
27
|
+
} | {
|
|
28
|
+
kind: "retry-rotated";
|
|
29
|
+
} | {
|
|
30
|
+
kind: "retry-thinking";
|
|
31
|
+
thinkLevel: TThinkingLevel;
|
|
32
|
+
} | {
|
|
33
|
+
kind: "throw-failover";
|
|
34
|
+
reason: TFailoverReason | null;
|
|
35
|
+
} | {
|
|
36
|
+
kind: "throw-original";
|
|
37
|
+
};
|
|
38
|
+
export declare function resolveRetryableFailureReason<TReason extends string = string>(params: {
|
|
39
|
+
reason: TReason | null | undefined;
|
|
40
|
+
nonRetryableReasons?: readonly TReason[];
|
|
41
|
+
}): TReason | null;
|
|
42
|
+
export declare function resolveAuthProfileFailoverReason<TFailoverReason extends string = string>(params: {
|
|
43
|
+
allInCooldown: boolean;
|
|
44
|
+
unavailableReason?: TFailoverReason | null;
|
|
45
|
+
classifiedReason?: TFailoverReason | null;
|
|
46
|
+
cooldownFallbackReason: TFailoverReason;
|
|
47
|
+
defaultReason: TFailoverReason;
|
|
48
|
+
}): TFailoverReason;
|
|
49
|
+
export declare function resolveFallbackThinkingDecision<TThinkingLevel extends string = string>(params: {
|
|
50
|
+
aborted: boolean;
|
|
51
|
+
fallbackThinking?: TThinkingLevel;
|
|
52
|
+
provider: string;
|
|
53
|
+
modelId: string;
|
|
54
|
+
}): {
|
|
55
|
+
thinkLevel: TThinkingLevel;
|
|
56
|
+
warningMessage: string;
|
|
57
|
+
} | undefined;
|
|
58
|
+
export declare function pickFallbackThinkingLevel<TThinkingLevel extends string = string>(params: {
|
|
59
|
+
message?: string;
|
|
60
|
+
attempted: Set<TThinkingLevel>;
|
|
61
|
+
normalizeThinkLevel: (raw: string) => TThinkingLevel | undefined;
|
|
62
|
+
offLevel?: TThinkingLevel;
|
|
63
|
+
}): TThinkingLevel | undefined;
|
|
64
|
+
export declare function shouldAttemptPromptFailureRotation<TFailoverReason extends string = string>(params: {
|
|
65
|
+
promptFailoverFailure: boolean;
|
|
66
|
+
promptFailoverReason: TFailoverReason | null;
|
|
67
|
+
nonRotatableReasons?: readonly TFailoverReason[];
|
|
68
|
+
}): boolean;
|
|
69
|
+
export declare function shouldAttemptAssistantFailureRotation(params: {
|
|
70
|
+
timedOut: boolean;
|
|
71
|
+
timedOutDuringCompaction: boolean;
|
|
72
|
+
failoverFailure: boolean;
|
|
73
|
+
}): boolean;
|
|
74
|
+
export declare function resolvePromptFailureActionDecision<TThinkingLevel extends string = string, TFailoverReason extends string = string>(params: {
|
|
75
|
+
promptFailoverFailure: boolean;
|
|
76
|
+
canRotate: boolean;
|
|
77
|
+
fallbackThinking?: TThinkingLevel;
|
|
78
|
+
fallbackConfigured: boolean;
|
|
79
|
+
promptFailoverReason: TFailoverReason | null;
|
|
80
|
+
}): EmbeddedPromptFailureAction<TThinkingLevel, TFailoverReason>;
|
|
81
|
+
export declare function resolveAssistantFailureActionDecision<TFailoverReason extends string = string>(params: {
|
|
82
|
+
timedOut: boolean;
|
|
83
|
+
timedOutDuringCompaction: boolean;
|
|
84
|
+
failoverFailure: boolean;
|
|
85
|
+
canRotate: boolean;
|
|
86
|
+
shouldThrowFailover: boolean;
|
|
87
|
+
failoverReason: TFailoverReason | null;
|
|
88
|
+
}): EmbeddedAssistantFailureAction<TFailoverReason>;
|
|
89
|
+
export declare function resolvePromptErrorPolicy<TThinkingLevel extends string = string, TFailoverReason extends string = string>(params: {
|
|
90
|
+
hasPromptError: boolean;
|
|
91
|
+
aborted: boolean;
|
|
92
|
+
errorText: string;
|
|
93
|
+
roleAlternationError: boolean;
|
|
94
|
+
imageSizeMaxMb?: number | null;
|
|
95
|
+
promptFailureAction: EmbeddedPromptFailureAction<TThinkingLevel, TFailoverReason>;
|
|
96
|
+
}): EmbeddedPromptErrorPolicyResolution<TThinkingLevel, TFailoverReason>;
|
|
97
|
+
export declare function buildAssistantFailoverErrorDetails(params: {
|
|
98
|
+
formattedAssistantErrorText?: string;
|
|
99
|
+
assistantErrorMessage?: string;
|
|
100
|
+
timedOut: boolean;
|
|
101
|
+
rateLimitFailure: boolean;
|
|
102
|
+
billingFailureMessage?: string;
|
|
103
|
+
authFailure: boolean;
|
|
104
|
+
failoverStatus?: number;
|
|
105
|
+
timeoutDetectedFromMessage: boolean;
|
|
106
|
+
timeoutStatus?: number;
|
|
107
|
+
}): {
|
|
108
|
+
message: string;
|
|
109
|
+
status: number | undefined;
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=embedded-failover-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedded-failover-policy.d.ts","sourceRoot":"","sources":["../../src/orchestration/embedded-failover-policy.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,2BAA2B,CACrC,cAAc,SAAS,MAAM,GAAG,MAAM,EACtC,eAAe,SAAS,MAAM,GAAG,MAAM,IAErC;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,GACzB;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,UAAU,EAAE,cAAc,CAAA;CAAE,GACtD;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAAA;CAAE,GAC1D;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC;AAE1B,MAAM,MAAM,8B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C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG;IACF,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,CAiBA"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
export function resolveRetryableFailureReason(params) {
|
|
2
|
+
if (!params.reason) {
|
|
3
|
+
return null;
|
|
4
|
+
}
|
|
5
|
+
if ((params.nonRetryableReasons ?? []).includes(params.reason)) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
return params.reason;
|
|
9
|
+
}
|
|
10
|
+
export function resolveAuthProfileFailoverReason(params) {
|
|
11
|
+
if (params.allInCooldown) {
|
|
12
|
+
return params.unavailableReason ?? params.cooldownFallbackReason;
|
|
13
|
+
}
|
|
14
|
+
return params.classifiedReason ?? params.defaultReason;
|
|
15
|
+
}
|
|
16
|
+
export function resolveFallbackThinkingDecision(params) {
|
|
17
|
+
if (params.aborted || !params.fallbackThinking) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
thinkLevel: params.fallbackThinking,
|
|
22
|
+
warningMessage: `unsupported thinking level for ${params.provider}/${params.modelId}; ` +
|
|
23
|
+
`retrying with ${params.fallbackThinking}`,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function extractSupportedThinkingValues(raw) {
|
|
27
|
+
const match = raw.match(/supported values are:\s*([^\n.]+)/i) ??
|
|
28
|
+
raw.match(/supported values:\s*([^\n.]+)/i);
|
|
29
|
+
if (!match?.[1]) {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
const fragment = match[1];
|
|
33
|
+
const quoted = Array.from(fragment.matchAll(/['"]([^'"]+)['"]/g)).map((entry) => entry[1]?.trim());
|
|
34
|
+
if (quoted.length > 0) {
|
|
35
|
+
return quoted.filter((entry) => Boolean(entry));
|
|
36
|
+
}
|
|
37
|
+
return fragment
|
|
38
|
+
.split(/,|\band\b/gi)
|
|
39
|
+
.map((entry) => entry.replace(/^[^a-zA-Z]+|[^a-zA-Z]+$/g, "").trim())
|
|
40
|
+
.filter(Boolean);
|
|
41
|
+
}
|
|
42
|
+
export function pickFallbackThinkingLevel(params) {
|
|
43
|
+
const raw = params.message?.trim();
|
|
44
|
+
if (!raw) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
const supported = extractSupportedThinkingValues(raw);
|
|
48
|
+
if (supported.length === 0) {
|
|
49
|
+
if (/not supported/i.test(raw) &&
|
|
50
|
+
params.offLevel &&
|
|
51
|
+
!params.attempted.has(params.offLevel)) {
|
|
52
|
+
return params.offLevel;
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
for (const entry of supported) {
|
|
57
|
+
const normalized = params.normalizeThinkLevel(entry);
|
|
58
|
+
if (!normalized || params.attempted.has(normalized)) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
return normalized;
|
|
62
|
+
}
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
export function shouldAttemptPromptFailureRotation(params) {
|
|
66
|
+
if (!params.promptFailoverFailure) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
return !(params.nonRotatableReasons ?? []).includes(params.promptFailoverReason);
|
|
70
|
+
}
|
|
71
|
+
export function shouldAttemptAssistantFailureRotation(params) {
|
|
72
|
+
return params.failoverFailure || (params.timedOut && !params.timedOutDuringCompaction);
|
|
73
|
+
}
|
|
74
|
+
export function resolvePromptFailureActionDecision(params) {
|
|
75
|
+
if (params.canRotate) {
|
|
76
|
+
return { kind: "retry-rotated" };
|
|
77
|
+
}
|
|
78
|
+
if (params.fallbackThinking) {
|
|
79
|
+
return {
|
|
80
|
+
kind: "retry-thinking",
|
|
81
|
+
thinkLevel: params.fallbackThinking,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (params.fallbackConfigured && params.promptFailoverFailure) {
|
|
85
|
+
return {
|
|
86
|
+
kind: "throw-failover",
|
|
87
|
+
reason: params.promptFailoverReason,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return { kind: "unhandled" };
|
|
91
|
+
}
|
|
92
|
+
export function resolveAssistantFailureActionDecision(params) {
|
|
93
|
+
const shouldRotate = shouldAttemptAssistantFailureRotation({
|
|
94
|
+
timedOut: params.timedOut,
|
|
95
|
+
timedOutDuringCompaction: params.timedOutDuringCompaction,
|
|
96
|
+
failoverFailure: params.failoverFailure,
|
|
97
|
+
});
|
|
98
|
+
if (!shouldRotate) {
|
|
99
|
+
return { kind: "unhandled" };
|
|
100
|
+
}
|
|
101
|
+
if (params.canRotate) {
|
|
102
|
+
return { kind: "retry-rotated" };
|
|
103
|
+
}
|
|
104
|
+
if (params.shouldThrowFailover) {
|
|
105
|
+
return {
|
|
106
|
+
kind: "throw-failover",
|
|
107
|
+
reason: params.failoverReason,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return { kind: "unhandled" };
|
|
111
|
+
}
|
|
112
|
+
export function resolvePromptErrorPolicy(params) {
|
|
113
|
+
if (!params.hasPromptError || params.aborted) {
|
|
114
|
+
return { kind: "noop" };
|
|
115
|
+
}
|
|
116
|
+
if (params.roleAlternationError) {
|
|
117
|
+
return {
|
|
118
|
+
kind: "return-error",
|
|
119
|
+
errorKind: "role_ordering",
|
|
120
|
+
text: "Message ordering conflict - please try again. " +
|
|
121
|
+
"If this persists, use /new to start a fresh session.",
|
|
122
|
+
message: params.errorText,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
if (typeof params.imageSizeMaxMb === "number" && Number.isFinite(params.imageSizeMaxMb)) {
|
|
126
|
+
const maxBytesHint = ` (max ${params.imageSizeMaxMb}MB)`;
|
|
127
|
+
return {
|
|
128
|
+
kind: "return-error",
|
|
129
|
+
errorKind: "image_size",
|
|
130
|
+
text: `Image too large for the model${maxBytesHint}. ` +
|
|
131
|
+
"Please compress or resize the image and try again.",
|
|
132
|
+
message: params.errorText,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
if (params.promptFailureAction.kind === "retry-rotated") {
|
|
136
|
+
return { kind: "retry-rotated" };
|
|
137
|
+
}
|
|
138
|
+
if (params.promptFailureAction.kind === "retry-thinking") {
|
|
139
|
+
return {
|
|
140
|
+
kind: "retry-thinking",
|
|
141
|
+
thinkLevel: params.promptFailureAction.thinkLevel,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
if (params.promptFailureAction.kind === "throw-failover") {
|
|
145
|
+
return {
|
|
146
|
+
kind: "throw-failover",
|
|
147
|
+
reason: params.promptFailureAction.reason,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
return { kind: "throw-original" };
|
|
151
|
+
}
|
|
152
|
+
export function buildAssistantFailoverErrorDetails(params) {
|
|
153
|
+
const message = params.formattedAssistantErrorText ||
|
|
154
|
+
params.assistantErrorMessage?.trim() ||
|
|
155
|
+
(params.timedOut
|
|
156
|
+
? "LLM request timed out."
|
|
157
|
+
: params.rateLimitFailure
|
|
158
|
+
? "LLM request rate limited."
|
|
159
|
+
: params.billingFailureMessage
|
|
160
|
+
? params.billingFailureMessage
|
|
161
|
+
: params.authFailure
|
|
162
|
+
? "LLM request unauthorized."
|
|
163
|
+
: "LLM request failed.");
|
|
164
|
+
return {
|
|
165
|
+
message,
|
|
166
|
+
status: params.failoverStatus ?? (params.timeoutDetectedFromMessage ? (params.timeoutStatus ?? 408) : undefined),
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=embedded-failover-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedded-failover-policy.js","sourceRoot":"","sources":["../../src/orchestration/embedded-failover-policy.ts"],"names":[],"mappings":"AA8BA,MAAM,UAAU,6BAA6B,CAAkC,MAG9E;IACC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IA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D,OAAO;YACL,IAAI,EAAE,gBAAgB;YACtB,UAAU,EAAE,MAAM,CAAC,mBAAmB,CAAC,UAAU;SAClD,CAAC;IACJ,CAAC;IACD,IAAI,MAAM,CAAC,mBAAmB,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;QACzD,OAAO;YACL,IAAI,EAAE,gBAAgB;YACtB,MAAM,EAAE,MAAM,CAAC,mBAAmB,CAAC,MAAM;SAC1C,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,kCAAkC,CAAC,MAUlD;IAIC,MAAM,OAAO,GACX,MAAM,CAAC,2BAA2B;QAClC,MAAM,CAAC,qBAAqB,EAAE,IAAI,EAAE;QACpC,CAAC,MAAM,CAAC,QAAQ;YACd,CAAC,CAAC,wBAAwB;YAC1B,CAAC,CAAC,MAAM,CAAC,gBAAgB;gBACvB,CAAC,CAAC,2BAA2B;gBAC7B,CAAC,CAAC,MAAM,CAAC,qBAAqB;oBAC5B,CAAC,CAAC,MAAM,CAAC,qBAAqB;oBAC9B,CAAC,CAAC,MAAM,CAAC,WAAW;wBAClB,CAAC,CAAC,2BAA2B;wBAC7B,CAAC,CAAC,qBAAqB,CAAC,CAAC;IACnC,OAAO;QACL,OAAO;QACP,MAAM,EAAE,MAAM,CAAC,cAAc,IAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;KACjH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FailoverReason } from "./failover-classification.js";
|
|
2
|
+
export type ErrorCategory = "RETRYABLE_TRANSIENT" | "RETRYABLE_DEGRADED" | "NON_RETRYABLE_AUTH" | "NON_RETRYABLE_CONTENT" | "NON_RETRYABLE_QUOTA" | "TOOL_EXECUTION_FAILED";
|
|
3
|
+
export interface RetryStrategy {
|
|
4
|
+
retryable: boolean;
|
|
5
|
+
maxRetries: number;
|
|
6
|
+
baseDelayMs: number;
|
|
7
|
+
backoffMultiplier: number;
|
|
8
|
+
switchProvider: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function classifyError(status: number | undefined, message?: string): ErrorCategory;
|
|
11
|
+
export declare function classifyErrorFromReason(reason: FailoverReason): ErrorCategory;
|
|
12
|
+
export declare function getRetryStrategy(category: ErrorCategory): RetryStrategy;
|
|
13
|
+
//# sourceMappingURL=error-classification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-classification.d.ts","sourceRoot":"","sources":["../../src/orchestration/error-classification.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAMnE,MAAM,MAAM,aAAa,GACrB,qBAAqB,GACrB,oBAAoB,GACpB,oBAAoB,GACpB,uBAAuB,GACvB,qBAAqB,GACrB,uBAAuB,CAAC;AAE5B,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAC;CACzB;AA4DD,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,CAAC,EAAE,MAAM,GACf,aAAa,CAUf;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,cAAc,GAAG,aAAa,CAE7E;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,aAAa,GAAG,aAAa,CAEvE"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// Error classification — maps FailoverReason to high-level
|
|
3
|
+
// retry categories for consumers that need a simple decision.
|
|
4
|
+
// ============================================================
|
|
5
|
+
import { classifyFailoverReason, classifyFailoverReasonFromHttpStatus, } from "./failover-classification.js";
|
|
6
|
+
const FAILOVER_TO_CATEGORY = {
|
|
7
|
+
timeout: "RETRYABLE_TRANSIENT",
|
|
8
|
+
overloaded: "RETRYABLE_TRANSIENT",
|
|
9
|
+
rate_limit: "RETRYABLE_DEGRADED",
|
|
10
|
+
auth: "NON_RETRYABLE_AUTH",
|
|
11
|
+
auth_permanent: "NON_RETRYABLE_AUTH",
|
|
12
|
+
billing: "NON_RETRYABLE_QUOTA",
|
|
13
|
+
format: "NON_RETRYABLE_CONTENT",
|
|
14
|
+
model_not_found: "NON_RETRYABLE_CONTENT",
|
|
15
|
+
session_expired: "NON_RETRYABLE_CONTENT",
|
|
16
|
+
unknown: "RETRYABLE_TRANSIENT",
|
|
17
|
+
};
|
|
18
|
+
const RETRY_STRATEGIES = {
|
|
19
|
+
RETRYABLE_TRANSIENT: {
|
|
20
|
+
retryable: true,
|
|
21
|
+
maxRetries: 3,
|
|
22
|
+
baseDelayMs: 1000,
|
|
23
|
+
backoffMultiplier: 2,
|
|
24
|
+
switchProvider: true,
|
|
25
|
+
},
|
|
26
|
+
RETRYABLE_DEGRADED: {
|
|
27
|
+
retryable: true,
|
|
28
|
+
maxRetries: 2,
|
|
29
|
+
baseDelayMs: 5000,
|
|
30
|
+
backoffMultiplier: 3,
|
|
31
|
+
switchProvider: true,
|
|
32
|
+
},
|
|
33
|
+
NON_RETRYABLE_AUTH: {
|
|
34
|
+
retryable: false,
|
|
35
|
+
maxRetries: 0,
|
|
36
|
+
baseDelayMs: 0,
|
|
37
|
+
backoffMultiplier: 1,
|
|
38
|
+
switchProvider: true,
|
|
39
|
+
},
|
|
40
|
+
NON_RETRYABLE_CONTENT: {
|
|
41
|
+
retryable: false,
|
|
42
|
+
maxRetries: 0,
|
|
43
|
+
baseDelayMs: 0,
|
|
44
|
+
backoffMultiplier: 1,
|
|
45
|
+
switchProvider: false,
|
|
46
|
+
},
|
|
47
|
+
NON_RETRYABLE_QUOTA: {
|
|
48
|
+
retryable: false,
|
|
49
|
+
maxRetries: 0,
|
|
50
|
+
baseDelayMs: 0,
|
|
51
|
+
backoffMultiplier: 1,
|
|
52
|
+
switchProvider: true,
|
|
53
|
+
},
|
|
54
|
+
TOOL_EXECUTION_FAILED: {
|
|
55
|
+
retryable: true,
|
|
56
|
+
maxRetries: 1,
|
|
57
|
+
baseDelayMs: 500,
|
|
58
|
+
backoffMultiplier: 1,
|
|
59
|
+
switchProvider: false,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
export function classifyError(status, message) {
|
|
63
|
+
const reason = classifyFailoverReasonFromHttpStatus(status, message) ??
|
|
64
|
+
(message ? classifyFailoverReason(message) : null);
|
|
65
|
+
if (!reason) {
|
|
66
|
+
return typeof status === "number" && status >= 400 && status < 500
|
|
67
|
+
? "NON_RETRYABLE_CONTENT"
|
|
68
|
+
: "RETRYABLE_TRANSIENT";
|
|
69
|
+
}
|
|
70
|
+
return FAILOVER_TO_CATEGORY[reason];
|
|
71
|
+
}
|
|
72
|
+
export function classifyErrorFromReason(reason) {
|
|
73
|
+
return FAILOVER_TO_CATEGORY[reason];
|
|
74
|
+
}
|
|
75
|
+
export function getRetryStrategy(category) {
|
|
76
|
+
return RETRY_STRATEGIES[category];
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=error-classification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-classification.js","sourceRoot":"","sources":["../../src/orchestration/error-classification.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,2DAA2D;AAC3D,8DAA8D;AAC9D,+DAA+D;AAG/D,OAAO,EACL,sBAAsB,EACtB,oCAAoC,GACrC,MAAM,8BAA8B,CAAC;AAkBtC,MAAM,oBAAoB,GAA0C;IAClE,OAAO,EAAE,qBAAqB;IAC9B,UAAU,EAAE,qBAAqB;IACjC,UAAU,EAAE,oBAAoB;IAChC,IAAI,EAAE,oBAAoB;IAC1B,cAAc,EAAE,oBAAoB;IACpC,OAAO,EA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CAAC,CAAC,IAAI,CAAC,CAAC;IACrD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG;YAChE,CAAC,CAAC,uBAAuB;YACzB,CAAC,CAAC,qBAAqB,CAAC;IAC5B,CAAC;IACD,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,MAAsB;IAC5D,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,QAAuB;IACtD,OAAO,gBAAgB,CAAC,QAAQ,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type FailoverReason = "auth" | "auth_permanent" | "format" | "rate_limit" | "overloaded" | "billing" | "timeout" | "model_not_found" | "session_expired" | "unknown";
|
|
2
|
+
export declare function isTimeoutErrorMessage(raw: string): boolean;
|
|
3
|
+
export declare function isCloudflareOrHtmlErrorPage(raw: string): boolean;
|
|
4
|
+
export declare function isTransientHttpError(raw: string): boolean;
|
|
5
|
+
export declare function classifyFailoverReasonFromHttpStatus(status: number | undefined, message?: string): FailoverReason | null;
|
|
6
|
+
export declare function isModelNotFoundErrorMessage(raw: string): boolean;
|
|
7
|
+
export declare function classifyFailoverReason(raw: string): FailoverReason | null;
|
|
8
|
+
export declare function isFailoverErrorMessage(raw: string): boolean;
|
|
9
|
+
//# sourceMappingURL=failover-classification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failover-classification.d.ts","sourceRoot":"","sources":["../../src/orchestration/failover-classification.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,gBAAgB,GAChB,QAAQ,GACR,YAAY,GACZ,YAAY,GACZ,SAAS,GACT,SAAS,GACT,iBAAiB,GACjB,iBAAiB,GACjB,SAAS,CAAC;AAqJd,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE1D;AAqHD,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAahE;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAUzD;AAED,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,CAAC,EAAE,MAAM,GACf,cAAc,GAAG,IAAI,CAsCvB;AAED,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAsBhE;AAuBD,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CA8CzE;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE3D"}
|