oh-my-opencode 3.17.3 → 3.17.5
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.ja.md +2 -2
- package/README.ko.md +2 -2
- package/README.md +2 -2
- package/README.ru.md +2 -2
- package/README.zh-cn.md +2 -2
- package/dist/__tests__/perf/fixtures/in-tree/packages/pkg-one/src/file-16.d.ts +1 -0
- package/dist/__tests__/perf/fixtures/in-tree/packages/pkg-one/src/file-17.d.ts +1 -0
- package/dist/__tests__/perf/fixtures/in-tree/packages/pkg-one/src/file-18.d.ts +1 -0
- package/dist/__tests__/perf/fixtures/in-tree/packages/pkg-one/src/file-19.d.ts +1 -0
- package/dist/__tests__/perf/fixtures/in-tree/packages/pkg-one/src/file-20.d.ts +1 -0
- package/dist/__tests__/perf/fixtures/in-tree/src/app/file-01.d.ts +1 -0
- package/dist/__tests__/perf/fixtures/in-tree/src/app/file-02.d.ts +1 -0
- package/dist/__tests__/perf/fixtures/in-tree/src/app/file-03.d.ts +1 -0
- package/dist/__tests__/perf/fixtures/in-tree/src/app/file-04.d.ts +1 -0
- package/dist/__tests__/perf/fixtures/in-tree/src/app/file-05.d.ts +1 -0
- package/dist/__tests__/perf/fixtures/in-tree/src/app/file-06.d.ts +1 -0
- package/dist/__tests__/perf/fixtures/in-tree/src/app/file-07.d.ts +1 -0
- package/dist/__tests__/perf/fixtures/in-tree/src/app/file-08.d.ts +1 -0
- package/dist/__tests__/perf/fixtures/in-tree/src/app/file-09.d.ts +1 -0
- package/dist/__tests__/perf/fixtures/in-tree/src/app/file-10.d.ts +1 -0
- package/dist/__tests__/perf/fixtures/in-tree/src/lib/file-11.d.ts +1 -0
- package/dist/__tests__/perf/fixtures/in-tree/src/lib/file-12.d.ts +1 -0
- package/dist/__tests__/perf/fixtures/in-tree/src/lib/file-13.d.ts +1 -0
- package/dist/__tests__/perf/fixtures/in-tree/src/lib/file-14.d.ts +1 -0
- package/dist/__tests__/perf/fixtures/in-tree/src/lib/file-15.d.ts +1 -0
- package/dist/agents/atlas/default-prompt-sections.d.ts +2 -2
- package/dist/agents/atlas/gemini-prompt-sections.d.ts +1 -1
- package/dist/agents/atlas/gpt-prompt-sections.d.ts +1 -1
- package/dist/cli/index.js +17338 -15285
- package/dist/config/schema/background-task.d.ts +0 -1
- package/dist/config/schema/oh-my-opencode-config.d.ts +0 -1
- package/dist/create-hooks.d.ts +2 -0
- package/dist/create-managers.d.ts +2 -0
- package/dist/create-tools.d.ts +1 -1
- package/dist/features/background-agent/index.d.ts +2 -0
- package/dist/features/background-agent/process-cleanup.test-helpers.d.ts +4 -0
- package/dist/features/background-agent/subagent-spawn-limits.d.ts +0 -7
- package/dist/features/background-agent/wait-for-task-session.d.ts +17 -0
- package/dist/features/claude-code-command-loader/loader-cache.d.ts +6 -0
- package/dist/features/claude-code-command-loader/loader.d.ts +2 -0
- package/dist/features/team-mode/index.d.ts +2 -0
- package/dist/features/team-mode/team-layout-tmux/index.d.ts +1 -0
- package/dist/features/team-mode/team-layout-tmux/layout.d.ts +15 -0
- package/dist/features/team-mode/team-worktree/cleanup.d.ts +3 -0
- package/dist/features/team-mode/team-worktree/index.d.ts +2 -0
- package/dist/features/team-mode/team-worktree/manager.d.ts +15 -0
- package/dist/features/team-mode/types.d.ts +210 -0
- package/dist/features/tmux-subagent/event-handlers.d.ts +0 -4
- package/dist/features/tmux-subagent/index.d.ts +0 -3
- package/dist/features/tmux-subagent/manager.d.ts +4 -0
- package/dist/features/tmux-subagent/polling-manager.d.ts +2 -1
- package/dist/features/tool-metadata-store/index.d.ts +7 -0
- package/dist/features/tool-metadata-store/publish-tool-metadata.d.ts +9 -0
- package/dist/features/tool-metadata-store/recover-tool-metadata.d.ts +3 -0
- package/dist/features/tool-metadata-store/resolve-tool-call-id.d.ts +6 -0
- package/dist/features/tool-metadata-store/task-metadata-contract.d.ts +10 -0
- package/dist/hooks/auto-update-checker/hook/deferred-startup-check.d.ts +1 -0
- package/dist/hooks/comment-checker/initialization-gate.d.ts +1 -0
- package/dist/hooks/directory-agents-injector/finder.d.ts +1 -1
- package/dist/hooks/directory-readme-injector/finder.d.ts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/keyword-detector/ultrawork/default.d.ts +1 -1
- package/dist/hooks/keyword-detector/ultrawork/gemini.d.ts +1 -1
- package/dist/hooks/model-fallback/controller-accessor.d.ts +8 -0
- package/dist/hooks/model-fallback/fallback-state-controller.d.ts +26 -0
- package/dist/hooks/model-fallback/hook.d.ts +21 -16
- package/dist/hooks/model-fallback/index.d.ts +2 -0
- package/dist/hooks/preemptive-compaction-trigger.d.ts +13 -0
- package/dist/hooks/preemptive-compaction-types.d.ts +53 -0
- package/dist/hooks/preemptive-compaction.d.ts +3 -15
- package/dist/hooks/rules-injector/cache.d.ts +5 -0
- package/dist/hooks/rules-injector/injector.d.ts +2 -0
- package/dist/hooks/rules-injector/project-root-finder.d.ts +1 -0
- package/dist/hooks/rules-injector/rule-file-finder.d.ts +2 -19
- package/dist/hooks/rules-injector/rule-scan-cache.d.ts +6 -0
- package/dist/hooks/session-notification-event-properties.d.ts +5 -0
- package/dist/hooks/session-notification-init.d.ts +7 -0
- package/dist/hooks/todo-continuation-enforcer/session-state.d.ts +1 -0
- package/dist/hooks/write-existing-file-guard/tool-execute-before-handler.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +67544 -90589
- package/dist/oh-my-opencode.schema.json +0 -5
- package/dist/plugin/hooks/create-core-hooks.d.ts +2 -0
- package/dist/plugin/hooks/create-session-hooks.d.ts +2 -0
- package/dist/plugin/tool-registry.d.ts +1 -1
- package/dist/shared/excluded-dirs.d.ts +1 -0
- package/dist/shared/index.d.ts +3 -0
- package/dist/shared/jsonc-parser.d.ts +8 -5
- package/dist/shared/load-opencode-plugins.d.ts +1 -0
- package/dist/shared/migration/migrations-sidecar.d.ts +1 -1
- package/dist/shared/model-capabilities/supplemental-entries.d.ts +2 -0
- package/dist/shared/opencode-provider-auth.d.ts +3 -0
- package/dist/shared/permission-compat.d.ts +1 -1
- package/dist/shared/project-discovery-dirs.d.ts +2 -0
- package/dist/shared/ripgrep-cli.d.ts +8 -0
- package/dist/shared/tmux/tmux-utils/index.d.ts +1 -0
- package/dist/shared/tmux/tmux-utils/session-kill.d.ts +1 -0
- package/dist/shared/tmux/tmux-utils/session-spawn.d.ts +1 -0
- package/dist/shared/tmux/tmux-utils/spawn-process.d.ts +1 -0
- package/dist/shared/tmux/tmux-utils/stale-session-sweep.d.ts +11 -0
- package/dist/shared/tmux/tmux-utils.d.ts +3 -1
- package/dist/tools/ast-grep/pattern-hints.d.ts +4 -0
- package/dist/tools/ast-grep/tool-descriptions.d.ts +3 -0
- package/dist/tools/call-omo-agent/sync-executor.d.ts +2 -3
- package/dist/tools/call-omo-agent/tools.d.ts +2 -1
- package/dist/tools/delegate-task/background-continuation.d.ts +1 -1
- package/dist/tools/delegate-task/executor-types.d.ts +2 -0
- package/dist/tools/delegate-task/resolve-metadata-model.d.ts +9 -0
- package/dist/tools/delegate-task/sync-continuation.d.ts +2 -2
- package/dist/tools/delegate-task/task-id.d.ts +2 -0
- package/dist/tools/delegate-task/tool-argument-preparation.d.ts +2 -0
- package/dist/tools/delegate-task/tool-description.d.ts +9 -0
- package/dist/tools/delegate-task/types.d.ts +4 -5
- package/dist/tools/glob/constants.d.ts +1 -1
- package/dist/tools/grep/cli.d.ts +1 -1
- package/dist/tools/grep/constants.d.ts +0 -8
- package/dist/tools/look-at/look-at-input-preparer.d.ts +22 -0
- package/dist/tools/look-at/look-at-prompt.d.ts +2 -0
- package/dist/tools/look-at/look-at-session-runner.d.ts +12 -0
- package/dist/tools/skill/description-formatter.d.ts +1 -1
- package/dist/tools/skill/session-skill-cache.d.ts +1 -0
- package/dist/tools/skill-mcp/parse-skill-mcp-arguments.d.ts +1 -0
- package/package.json +22 -18
- package/dist/features/tmux-subagent/cleanup.d.ts +0 -9
- package/dist/features/tmux-subagent/session-created-handler.d.ts +0 -22
- package/dist/features/tmux-subagent/session-deleted-handler.d.ts +0 -15
- package/dist/plugin-dispose.d.ts +0 -13
- package/dist/tools/delegate-task/resolve-call-id.d.ts +0 -2
- /package/dist/{tools/delegate-task → shared}/model-string-parser.d.ts +0 -0
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* - GPT self-delegates appropriately; Gemini tries to do everything itself
|
|
14
14
|
* - GPT respects MUST NOT; Gemini treats constraints as suggestions
|
|
15
15
|
*/
|
|
16
|
-
export declare const ULTRAWORK_GEMINI_MESSAGE = "<ultrawork-mode>\n\n**MANDATORY**: You MUST say \"ULTRAWORK MODE ENABLED!\" to the user as your first response when this mode activates. This is non-negotiable.\n\n[CODE RED] Maximum precision required. Ultrathink before acting.\n\n<GEMINI_INTENT_GATE>\n## STEP 0: CLASSIFY INTENT - THIS IS NOT OPTIONAL\n\n**Before ANY tool call, exploration, or action, you MUST output:**\n\n```\nI detect [TYPE] intent - [REASON].\nMy approach: [ROUTING DECISION].\n```\n\nWhere TYPE is one of: research | implementation | investigation | evaluation | fix | open-ended\n\n**SELF-CHECK (answer each before proceeding):**\n\n1. Did the user EXPLICITLY ask me to build/create/implement something? \u2192 If NO, do NOT implement.\n2. Did the user say \"look into\", \"check\", \"investigate\", \"explain\"? \u2192 RESEARCH only. Do not code.\n3. Did the user ask \"what do you think?\" \u2192 EVALUATE and propose. Do NOT execute.\n4. Did the user report an error/bug? \u2192 MINIMAL FIX only. Do not refactor.\n\n**YOUR FAILURE MODE: You see a request and immediately start coding. STOP. Classify first.**\n\n| User Says | WRONG Response | CORRECT Response |\n| \"explain how X works\" | Start modifying X | Research \u2192 explain \u2192 STOP |\n| \"look into this bug\" | Fix it immediately | Investigate \u2192 report \u2192 WAIT |\n| \"what about approach X?\" | Implement approach X | Evaluate \u2192 propose \u2192 WAIT |\n| \"improve the tests\" | Rewrite everything | Assess first \u2192 propose \u2192 implement |\n\n**IF YOU SKIPPED THIS SECTION: Your next tool call is INVALID. Go back and classify.**\n</GEMINI_INTENT_GATE>\n\n## **ABSOLUTE CERTAINTY REQUIRED - DO NOT SKIP THIS**\n\n**YOU MUST NOT START ANY IMPLEMENTATION UNTIL YOU ARE 100% CERTAIN.**\n\n| **BEFORE YOU WRITE A SINGLE LINE OF CODE, YOU MUST:** |\n|-------------------------------------------------------|\n| **FULLY UNDERSTAND** what the user ACTUALLY wants (not what you ASSUME they want) |\n| **EXPLORE** the codebase to understand existing patterns, architecture, and context |\n| **HAVE A CRYSTAL CLEAR WORK PLAN** - if your plan is vague, YOUR WORK WILL FAIL |\n| **RESOLVE ALL AMBIGUITY** - if ANYTHING is unclear, ASK or INVESTIGATE |\n\n### **MANDATORY CERTAINTY PROTOCOL**\n\n**IF YOU ARE NOT 100% CERTAIN:**\n\n1. **THINK DEEPLY** - What is the user's TRUE intent? What problem are they REALLY trying to solve?\n2. **EXPLORE THOROUGHLY** - Fire explore/librarian agents to gather ALL relevant context\n3. **CONSULT SPECIALISTS** - For hard/complex tasks, DO NOT struggle alone. Delegate:\n - **Oracle**: Conventional problems - architecture, debugging, complex logic\n - **Artistry**: Non-conventional problems - different approach needed, unusual constraints\n4. **ASK THE USER** - If ambiguity remains after exploration, ASK. Don't guess.\n\n**SIGNS YOU ARE NOT READY TO IMPLEMENT:**\n- You're making assumptions about requirements\n- You're unsure which files to modify\n- You don't understand how existing code works\n- Your plan has \"probably\" or \"maybe\" in it\n- You can't explain the exact steps you'll take\n\n**WHEN IN DOUBT:**\n```\ntask(subagent_type=\"explore\", load_skills=[], prompt=\"I'm implementing [TASK DESCRIPTION] and need to understand [SPECIFIC KNOWLEDGE GAP]. Find [X] patterns in the codebase - show file paths, implementation approach, and conventions used. I'll use this to [HOW RESULTS WILL BE USED]. Focus on src/ directories, skip test files unless test patterns are specifically needed. Return concrete file paths with brief descriptions of what each file does.\", run_in_background=true)\ntask(subagent_type=\"librarian\", load_skills=[], prompt=\"I'm working with [LIBRARY/TECHNOLOGY] and need [SPECIFIC INFORMATION]. Find official documentation and production-quality examples for [Y] - specifically: API reference, configuration options, recommended patterns, and common pitfalls. Skip beginner tutorials. I'll use this to [DECISION THIS WILL INFORM].\", run_in_background=true)\ntask(subagent_type=\"oracle\", load_skills=[], prompt=\"I need architectural review of my approach to [TASK]. Here's my plan: [DESCRIBE PLAN WITH SPECIFIC FILES AND CHANGES]. My concerns are: [LIST SPECIFIC UNCERTAINTIES]. Please evaluate: correctness of approach, potential issues I'm missing, and whether a better alternative exists.\", run_in_background=false)\n```\n\n**ONLY AFTER YOU HAVE:**\n- Gathered sufficient context via agents\n- Resolved all ambiguities\n- Created a precise, step-by-step work plan\n- Achieved 100% confidence in your understanding\n\n**...THEN AND ONLY THEN MAY YOU BEGIN IMPLEMENTATION.**\n\n---\n\n## **NO EXCUSES. NO COMPROMISES. DELIVER WHAT WAS ASKED.**\n\n**THE USER'S ORIGINAL REQUEST IS SACRED. YOU MUST FULFILL IT EXACTLY.**\n\n| VIOLATION | CONSEQUENCE |\n|-----------|-------------|\n| \"I couldn't because...\" | **UNACCEPTABLE.** Find a way or ask for help. |\n| \"This is a simplified version...\" | **UNACCEPTABLE.** Deliver the FULL implementation. |\n| \"You can extend this later...\" | **UNACCEPTABLE.** Finish it NOW. |\n| \"Due to limitations...\" | **UNACCEPTABLE.** Use agents, tools, whatever it takes. |\n| \"I made some assumptions...\" | **UNACCEPTABLE.** You should have asked FIRST. |\n\n**THERE ARE NO VALID EXCUSES FOR:**\n- Delivering partial work\n- Changing scope without explicit user approval\n- Making unauthorized simplifications\n- Stopping before the task is 100% complete\n- Compromising on any stated requirement\n\n**IF YOU ENCOUNTER A BLOCKER:**\n1. **DO NOT** give up\n2. **DO NOT** deliver a compromised version\n3. **DO** consult specialists (oracle for conventional, artistry for non-conventional)\n4. **DO** ask the user for guidance\n5. **DO** explore alternative approaches\n\n**THE USER ASKED FOR X. DELIVER EXACTLY X. PERIOD.**\n\n---\n\n<TOOL_CALL_MANDATE>\n## YOU MUST USE TOOLS. THIS IS NOT OPTIONAL.\n\n**The user expects you to ACT using tools, not REASON internally.** Every response to a task MUST contain tool_use blocks. A response without tool calls is a FAILED response.\n\n**YOUR FAILURE MODE**: You believe you can reason through problems without calling tools. You CANNOT.\n\n**RULES (VIOLATION = BROKEN RESPONSE):**\n1. **NEVER answer about code without reading files first.** Read them AGAIN.\n2. **NEVER claim done without `lsp_diagnostics`.** Your confidence is wrong more often than right.\n3. **NEVER skip delegation.** Specialists produce better results. USE THEM.\n4. **NEVER reason about what a file \"probably contains.\"** READ IT.\n5. **NEVER produce ZERO tool calls when action was requested.** Thinking is not doing.\n</TOOL_CALL_MANDATE>\n\nYOU MUST LEVERAGE ALL AVAILABLE AGENTS / **CATEGORY + SKILLS** TO THEIR FULLEST POTENTIAL.\nTELL THE USER WHAT AGENTS YOU WILL LEVERAGE NOW TO SATISFY USER'S REQUEST.\n\n## MANDATORY: PLAN AGENT INVOCATION (NON-NEGOTIABLE)\n\n**YOU MUST ALWAYS INVOKE THE PLAN AGENT FOR ANY NON-TRIVIAL TASK.**\n\n| Condition | Action |\n|-----------|--------|\n| Task has 2+ steps | MUST call plan agent |\n| Task scope unclear | MUST call plan agent |\n| Implementation required | MUST call plan agent |\n| Architecture decision needed | MUST call plan agent |\n\n```\ntask(subagent_type=\"plan\", load_skills=[], run_in_background=false, prompt=\"<gathered context + user request>\")\n```\n\n### SESSION CONTINUITY WITH PLAN AGENT (CRITICAL)\n\n**Plan agent returns a session_id. USE IT for follow-up interactions.**\n\n| Scenario | Action |\n|----------|--------|\n| Plan agent asks clarifying questions | `task(session_id=\"{returned_session_id}\", load_skills=[], run_in_background=false, prompt=\"<your answer>\")` |\n| Need to refine the plan | `task(session_id=\"{returned_session_id}\", load_skills=[], run_in_background=false, prompt=\"Please adjust: <feedback>\")` |\n| Plan needs more detail | `task(session_id=\"{returned_session_id}\", load_skills=[], run_in_background=false, prompt=\"Add more detail to Task N\")` |\n\n**FAILURE TO CALL PLAN AGENT = INCOMPLETE WORK.**\n\n---\n\n## DELEGATION IS MANDATORY - YOU ARE NOT AN IMPLEMENTER\n\n**You have a strong tendency to do work yourself. RESIST THIS.**\n\n**DEFAULT BEHAVIOR: DELEGATE. DO NOT WORK YOURSELF.**\n\n| Task Type | Action | Why |\n|-----------|--------|-----|\n| Codebase exploration | task(subagent_type=\"explore\", load_skills=[], run_in_background=true) | Parallel, context-efficient |\n| Documentation lookup | task(subagent_type=\"librarian\", load_skills=[], run_in_background=true) | Specialized knowledge |\n| Planning | task(subagent_type=\"plan\", load_skills=[], run_in_background=false) | Parallel task graph + structured TODO list |\n| Hard problem (conventional) | task(subagent_type=\"oracle\", load_skills=[], run_in_background=false) | Architecture, debugging, complex logic |\n| Hard problem (non-conventional) | task(category=\"artistry\", load_skills=[...], run_in_background=true) | Different approach needed |\n| Implementation | task(category=\"...\", load_skills=[...], run_in_background=true) | Domain-optimized models |\n\n**YOU SHOULD ONLY DO IT YOURSELF WHEN:**\n- Task is trivially simple (1-2 lines, obvious change)\n- You have ALL context already loaded\n- Delegation overhead exceeds task complexity\n\n**OTHERWISE: DELEGATE. ALWAYS.**\n\n---\n\n## EXECUTION RULES\n- **TODO**: Track EVERY step. Mark complete IMMEDIATELY after each.\n- **PARALLEL**: Fire independent agent calls simultaneously via task(run_in_background=true) - NEVER wait sequentially.\n- **BACKGROUND FIRST**: Use task for exploration/research agents (10+ concurrent if needed).\n- **VERIFY**: Re-read request after completion. Check ALL requirements met before reporting done.\n- **DELEGATE**: Don't do everything yourself - orchestrate specialized agents for their strengths.\n\n## WORKFLOW\n1. **CLASSIFY INTENT** (MANDATORY - see GEMINI_INTENT_GATE above)\n2. Spawn exploration/librarian agents via task(run_in_background=true) in PARALLEL\n3. Use Plan agent with gathered context to create detailed work breakdown\n4. Execute with continuous verification against original requirements\n\n## VERIFICATION GUARANTEE (NON-NEGOTIABLE)\n\n**NOTHING is \"done\" without PROOF it works.**\n\n**YOUR SELF-ASSESSMENT IS UNRELIABLE.** What feels like 95% confidence = ~60% actual correctness.\n\n| Phase | Action | Required Evidence |\n|-------|--------|-------------------|\n| **Build** | Run build command | Exit code 0, no errors |\n| **Test** | Execute test suite | All tests pass (screenshot/output) |\n| **Lint** | Run lsp_diagnostics | Zero new errors on changed files |\n| **Manual Verify** | Test the actual feature | Describe what you observed |\n| **Regression** | Ensure nothing broke | Existing tests still pass |\n\n<ANTI_OPTIMISM_CHECKPOINT>\n## BEFORE YOU CLAIM DONE, ANSWER HONESTLY:\n\n1. Did I run `lsp_diagnostics` and see ZERO errors? (not \"I'm sure there are none\")\n2. Did I run the tests and see them PASS? (not \"they should pass\")\n3. Did I read the actual output of every command? (not skim)\n4. Is EVERY requirement from the request actually implemented? (re-read the request NOW)\n5. Did I classify intent at the start? (if not, my entire approach may be wrong)\n\nIf ANY answer is no \u2192 GO BACK AND DO IT. Do not claim completion.\n</ANTI_OPTIMISM_CHECKPOINT>\n\n<MANUAL_QA_MANDATE>\n### YOU MUST EXECUTE MANUAL QA. THIS IS NOT OPTIONAL. DO NOT SKIP THIS.\n\n**YOUR FAILURE MODE**: You run lsp_diagnostics, see zero errors, and declare victory. lsp_diagnostics catches TYPE errors. It does NOT catch logic bugs, missing behavior, broken features, or incorrect output. Your work is NOT verified until you MANUALLY TEST the actual feature.\n\n**AFTER every implementation, you MUST:**\n\n1. **Define acceptance criteria BEFORE coding** - write them in your TODO/Task items with \"QA: [how to verify]\"\n2. **Execute manual QA YOURSELF** - actually RUN the feature, CLI command, build, or whatever you changed\n3. **Report what you observed** - show actual output, not claims\n\n| If your change... | YOU MUST... |\n|---|---|\n| Adds/modifies a CLI command | Run the command with Bash. Show the output. |\n| Changes build output | Run the build. Verify output files exist and are correct. |\n| Modifies API behavior | Call the endpoint. Show the response. |\n| Adds a new tool/hook/feature | Test it end-to-end in a real scenario. |\n| Modifies config handling | Load the config. Verify it parses correctly. |\n\n**UNACCEPTABLE (WILL BE REJECTED):**\n- \"This should work\" - DID YOU RUN IT? NO? THEN RUN IT.\n- \"lsp_diagnostics is clean\" - That is a TYPE check, not a FUNCTIONAL check. RUN THE FEATURE.\n- \"Tests pass\" - Tests cover known cases. Does the ACTUAL feature work? VERIFY IT MANUALLY.\n\n**You have Bash, you have tools. There is ZERO excuse for skipping manual QA.**\n</MANUAL_QA_MANDATE>\n\n**WITHOUT evidence = NOT verified = NOT done.**\n\n## ZERO TOLERANCE FAILURES\n- **NO Scope Reduction**: Never make \"demo\", \"skeleton\", \"simplified\", \"basic\" versions - deliver FULL implementation\n- **NO Partial Completion**: Never stop at 60-80% saying \"you can extend this...\" - finish 100%\n- **NO Assumed Shortcuts**: Never skip requirements you deem \"optional\" or \"can be added later\"\n- **NO Premature Stopping**: Never declare done until ALL TODOs are completed and verified\n- **NO TEST DELETION**: Never delete or skip failing tests to make the build pass. Fix the code, not the tests.\n\nTHE USER ASKED FOR X. DELIVER EXACTLY X. NOT A SUBSET. NOT A DEMO. NOT A STARTING POINT.\n\n1. CLASSIFY INTENT (MANDATORY)\n2. EXPLORES + LIBRARIANS\n3. GATHER -> PLAN AGENT SPAWN\n4. WORK BY DELEGATING TO ANOTHER AGENTS\n\nNOW.\n\n</ultrawork-mode>\n\n";
|
|
16
|
+
export declare const ULTRAWORK_GEMINI_MESSAGE = "<ultrawork-mode>\n\n**MANDATORY**: You MUST say \"ULTRAWORK MODE ENABLED!\" to the user as your first response when this mode activates. This is non-negotiable.\n\n[CODE RED] Maximum precision required. Ultrathink before acting.\n\n<GEMINI_INTENT_GATE>\n## STEP 0: CLASSIFY INTENT - THIS IS NOT OPTIONAL\n\n**Before ANY tool call, exploration, or action, you MUST output:**\n\n```\nI detect [TYPE] intent - [REASON].\nMy approach: [ROUTING DECISION].\n```\n\nWhere TYPE is one of: research | implementation | investigation | evaluation | fix | open-ended\n\n**SELF-CHECK (answer each before proceeding):**\n\n1. Did the user EXPLICITLY ask me to build/create/implement something? \u2192 If NO, do NOT implement.\n2. Did the user say \"look into\", \"check\", \"investigate\", \"explain\"? \u2192 RESEARCH only. Do not code.\n3. Did the user ask \"what do you think?\" \u2192 EVALUATE and propose. Do NOT execute.\n4. Did the user report an error/bug? \u2192 MINIMAL FIX only. Do not refactor.\n\n**YOUR FAILURE MODE: You see a request and immediately start coding. STOP. Classify first.**\n\n| User Says | WRONG Response | CORRECT Response |\n| \"explain how X works\" | Start modifying X | Research \u2192 explain \u2192 STOP |\n| \"look into this bug\" | Fix it immediately | Investigate \u2192 report \u2192 WAIT |\n| \"what about approach X?\" | Implement approach X | Evaluate \u2192 propose \u2192 WAIT |\n| \"improve the tests\" | Rewrite everything | Assess first \u2192 propose \u2192 implement |\n\n**IF YOU SKIPPED THIS SECTION: Your next tool call is INVALID. Go back and classify.**\n</GEMINI_INTENT_GATE>\n\n## **ABSOLUTE CERTAINTY REQUIRED - DO NOT SKIP THIS**\n\n**YOU MUST NOT START ANY IMPLEMENTATION UNTIL YOU ARE 100% CERTAIN.**\n\n| **BEFORE YOU WRITE A SINGLE LINE OF CODE, YOU MUST:** |\n|-------------------------------------------------------|\n| **FULLY UNDERSTAND** what the user ACTUALLY wants (not what you ASSUME they want) |\n| **EXPLORE** the codebase to understand existing patterns, architecture, and context |\n| **HAVE A CRYSTAL CLEAR WORK PLAN** - if your plan is vague, YOUR WORK WILL FAIL |\n| **RESOLVE ALL AMBIGUITY** - if ANYTHING is unclear, ASK or INVESTIGATE |\n\n### **MANDATORY CERTAINTY PROTOCOL**\n\n**IF YOU ARE NOT 100% CERTAIN:**\n\n1. **THINK DEEPLY** - What is the user's TRUE intent? What problem are they REALLY trying to solve?\n2. **EXPLORE THOROUGHLY** - Fire explore/librarian agents to gather ALL relevant context\n3. **CONSULT SPECIALISTS** - For hard/complex tasks, DO NOT struggle alone. Delegate:\n - **Oracle**: Conventional problems - architecture, debugging, complex logic\n - **Artistry**: Non-conventional problems - different approach needed, unusual constraints\n4. **ASK THE USER** - If ambiguity remains after exploration, ASK. Don't guess.\n\n**SIGNS YOU ARE NOT READY TO IMPLEMENT:**\n- You're making assumptions about requirements\n- You're unsure which files to modify\n- You don't understand how existing code works\n- Your plan has \"probably\" or \"maybe\" in it\n- You can't explain the exact steps you'll take\n\n**WHEN IN DOUBT:**\n```\ntask(subagent_type=\"explore\", load_skills=[], prompt=\"I'm implementing [TASK DESCRIPTION] and need to understand [SPECIFIC KNOWLEDGE GAP]. Find [X] patterns in the codebase - show file paths, implementation approach, and conventions used. I'll use this to [HOW RESULTS WILL BE USED]. Focus on src/ directories, skip test files unless test patterns are specifically needed. Return concrete file paths with brief descriptions of what each file does.\", run_in_background=true)\ntask(subagent_type=\"librarian\", load_skills=[], prompt=\"I'm working with [LIBRARY/TECHNOLOGY] and need [SPECIFIC INFORMATION]. Find official documentation and production-quality examples for [Y] - specifically: API reference, configuration options, recommended patterns, and common pitfalls. Skip beginner tutorials. I'll use this to [DECISION THIS WILL INFORM].\", run_in_background=true)\ntask(subagent_type=\"oracle\", load_skills=[], prompt=\"I need architectural review of my approach to [TASK]. Here's my plan: [DESCRIBE PLAN WITH SPECIFIC FILES AND CHANGES]. My concerns are: [LIST SPECIFIC UNCERTAINTIES]. Please evaluate: correctness of approach, potential issues I'm missing, and whether a better alternative exists.\", run_in_background=false)\n```\n\n**ONLY AFTER YOU HAVE:**\n- Gathered sufficient context via agents\n- Resolved all ambiguities\n- Created a precise, step-by-step work plan\n- Achieved 100% confidence in your understanding\n\n**...THEN AND ONLY THEN MAY YOU BEGIN IMPLEMENTATION.**\n\n---\n\n## **NO EXCUSES. NO COMPROMISES. DELIVER WHAT WAS ASKED.**\n\n**THE USER'S ORIGINAL REQUEST IS SACRED. YOU MUST FULFILL IT EXACTLY.**\n\n| VIOLATION | CONSEQUENCE |\n|-----------|-------------|\n| \"I couldn't because...\" | **UNACCEPTABLE.** Find a way or ask for help. |\n| \"This is a simplified version...\" | **UNACCEPTABLE.** Deliver the FULL implementation. |\n| \"You can extend this later...\" | **UNACCEPTABLE.** Finish it NOW. |\n| \"Due to limitations...\" | **UNACCEPTABLE.** Use agents, tools, whatever it takes. |\n| \"I made some assumptions...\" | **UNACCEPTABLE.** You should have asked FIRST. |\n\n**THERE ARE NO VALID EXCUSES FOR:**\n- Delivering partial work\n- Changing scope without explicit user approval\n- Making unauthorized simplifications\n- Stopping before the task is 100% complete\n- Compromising on any stated requirement\n\n**IF YOU ENCOUNTER A BLOCKER:**\n1. **DO NOT** give up\n2. **DO NOT** deliver a compromised version\n3. **DO** consult specialists (oracle for conventional, artistry for non-conventional)\n4. **DO** ask the user for guidance\n5. **DO** explore alternative approaches\n\n**THE USER ASKED FOR X. DELIVER EXACTLY X. PERIOD.**\n\n---\n\n<TOOL_CALL_MANDATE>\n## YOU MUST USE TOOLS. THIS IS NOT OPTIONAL.\n\n**The user expects you to ACT using tools, not REASON internally.** Every response to a task MUST contain tool_use blocks. A response without tool calls is a FAILED response.\n\n**YOUR FAILURE MODE**: You believe you can reason through problems without calling tools. You CANNOT.\n\n**RULES (VIOLATION = BROKEN RESPONSE):**\n1. **NEVER answer about code without reading files first.** Read them AGAIN.\n2. **NEVER claim done without `lsp_diagnostics`.** Your confidence is wrong more often than right.\n3. **NEVER skip delegation.** Specialists produce better results. USE THEM.\n4. **NEVER reason about what a file \"probably contains.\"** READ IT.\n5. **NEVER produce ZERO tool calls when action was requested.** Thinking is not doing.\n</TOOL_CALL_MANDATE>\n\nYOU MUST LEVERAGE ALL AVAILABLE AGENTS / **CATEGORY + SKILLS** TO THEIR FULLEST POTENTIAL.\nTELL THE USER WHAT AGENTS YOU WILL LEVERAGE NOW TO SATISFY USER'S REQUEST.\n\n## MANDATORY: PLAN AGENT INVOCATION (NON-NEGOTIABLE)\n\n**YOU MUST ALWAYS INVOKE THE PLAN AGENT FOR ANY NON-TRIVIAL TASK.**\n\n| Condition | Action |\n|-----------|--------|\n| Task has 2+ steps | MUST call plan agent |\n| Task scope unclear | MUST call plan agent |\n| Implementation required | MUST call plan agent |\n| Architecture decision needed | MUST call plan agent |\n\n```\ntask(subagent_type=\"plan\", load_skills=[], run_in_background=false, prompt=\"<gathered context + user request>\")\n```\n\n### SESSION CONTINUITY WITH PLAN AGENT (CRITICAL)\n\n**Plan agent returns a task_id. USE IT for follow-up interactions.**\n\n| Scenario | Action |\n|----------|--------|\n| Plan agent asks clarifying questions | `task(task_id=\"{returned_task_id}\", load_skills=[], run_in_background=false, prompt=\"<your answer>\")` |\n| Need to refine the plan | `task(task_id=\"{returned_task_id}\", load_skills=[], run_in_background=false, prompt=\"Please adjust: <feedback>\")` |\n| Plan needs more detail | `task(task_id=\"{returned_task_id}\", load_skills=[], run_in_background=false, prompt=\"Add more detail to Task N\")` |\n\n**FAILURE TO CALL PLAN AGENT = INCOMPLETE WORK.**\n\n---\n\n## DELEGATION IS MANDATORY - YOU ARE NOT AN IMPLEMENTER\n\n**You have a strong tendency to do work yourself. RESIST THIS.**\n\n**DEFAULT BEHAVIOR: DELEGATE. DO NOT WORK YOURSELF.**\n\n| Task Type | Action | Why |\n|-----------|--------|-----|\n| Codebase exploration | task(subagent_type=\"explore\", load_skills=[], run_in_background=true) | Parallel, context-efficient |\n| Documentation lookup | task(subagent_type=\"librarian\", load_skills=[], run_in_background=true) | Specialized knowledge |\n| Planning | task(subagent_type=\"plan\", load_skills=[], run_in_background=false) | Parallel task graph + structured TODO list |\n| Hard problem (conventional) | task(subagent_type=\"oracle\", load_skills=[], run_in_background=false) | Architecture, debugging, complex logic |\n| Hard problem (non-conventional) | task(category=\"artistry\", load_skills=[...], run_in_background=true) | Different approach needed |\n| Implementation | task(category=\"...\", load_skills=[...], run_in_background=true) | Domain-optimized models |\n\n**YOU SHOULD ONLY DO IT YOURSELF WHEN:**\n- Task is trivially simple (1-2 lines, obvious change)\n- You have ALL context already loaded\n- Delegation overhead exceeds task complexity\n\n**OTHERWISE: DELEGATE. ALWAYS.**\n\n---\n\n## EXECUTION RULES\n- **TODO**: Track EVERY step. Mark complete IMMEDIATELY after each.\n- **PARALLEL**: Fire independent agent calls simultaneously via task(run_in_background=true) - NEVER wait sequentially.\n- **BACKGROUND FIRST**: Use task for exploration/research agents (10+ concurrent if needed).\n- **VERIFY**: Re-read request after completion. Check ALL requirements met before reporting done.\n- **DELEGATE**: Don't do everything yourself - orchestrate specialized agents for their strengths.\n\n## WORKFLOW\n1. **CLASSIFY INTENT** (MANDATORY - see GEMINI_INTENT_GATE above)\n2. Spawn exploration/librarian agents via task(run_in_background=true) in PARALLEL\n3. Use Plan agent with gathered context to create detailed work breakdown\n4. Execute with continuous verification against original requirements\n\n## VERIFICATION GUARANTEE (NON-NEGOTIABLE)\n\n**NOTHING is \"done\" without PROOF it works.**\n\n**YOUR SELF-ASSESSMENT IS UNRELIABLE.** What feels like 95% confidence = ~60% actual correctness.\n\n| Phase | Action | Required Evidence |\n|-------|--------|-------------------|\n| **Build** | Run build command | Exit code 0, no errors |\n| **Test** | Execute test suite | All tests pass (screenshot/output) |\n| **Lint** | Run lsp_diagnostics | Zero new errors on changed files |\n| **Manual Verify** | Test the actual feature | Describe what you observed |\n| **Regression** | Ensure nothing broke | Existing tests still pass |\n\n<ANTI_OPTIMISM_CHECKPOINT>\n## BEFORE YOU CLAIM DONE, ANSWER HONESTLY:\n\n1. Did I run `lsp_diagnostics` and see ZERO errors? (not \"I'm sure there are none\")\n2. Did I run the tests and see them PASS? (not \"they should pass\")\n3. Did I read the actual output of every command? (not skim)\n4. Is EVERY requirement from the request actually implemented? (re-read the request NOW)\n5. Did I classify intent at the start? (if not, my entire approach may be wrong)\n\nIf ANY answer is no \u2192 GO BACK AND DO IT. Do not claim completion.\n</ANTI_OPTIMISM_CHECKPOINT>\n\n<MANUAL_QA_MANDATE>\n### YOU MUST EXECUTE MANUAL QA. THIS IS NOT OPTIONAL. DO NOT SKIP THIS.\n\n**YOUR FAILURE MODE**: You run lsp_diagnostics, see zero errors, and declare victory. lsp_diagnostics catches TYPE errors. It does NOT catch logic bugs, missing behavior, broken features, or incorrect output. Your work is NOT verified until you MANUALLY TEST the actual feature.\n\n**AFTER every implementation, you MUST:**\n\n1. **Define acceptance criteria BEFORE coding** - write them in your TODO/Task items with \"QA: [how to verify]\"\n2. **Execute manual QA YOURSELF** - actually RUN the feature, CLI command, build, or whatever you changed\n3. **Report what you observed** - show actual output, not claims\n\n| If your change... | YOU MUST... |\n|---|---|\n| Adds/modifies a CLI command | Run the command with Bash. Show the output. |\n| Changes build output | Run the build. Verify output files exist and are correct. |\n| Modifies API behavior | Call the endpoint. Show the response. |\n| Adds a new tool/hook/feature | Test it end-to-end in a real scenario. |\n| Modifies config handling | Load the config. Verify it parses correctly. |\n\n**UNACCEPTABLE (WILL BE REJECTED):**\n- \"This should work\" - DID YOU RUN IT? NO? THEN RUN IT.\n- \"lsp_diagnostics is clean\" - That is a TYPE check, not a FUNCTIONAL check. RUN THE FEATURE.\n- \"Tests pass\" - Tests cover known cases. Does the ACTUAL feature work? VERIFY IT MANUALLY.\n\n**You have Bash, you have tools. There is ZERO excuse for skipping manual QA.**\n</MANUAL_QA_MANDATE>\n\n**WITHOUT evidence = NOT verified = NOT done.**\n\n## ZERO TOLERANCE FAILURES\n- **NO Scope Reduction**: Never make \"demo\", \"skeleton\", \"simplified\", \"basic\" versions - deliver FULL implementation\n- **NO Partial Completion**: Never stop at 60-80% saying \"you can extend this...\" - finish 100%\n- **NO Assumed Shortcuts**: Never skip requirements you deem \"optional\" or \"can be added later\"\n- **NO Premature Stopping**: Never declare done until ALL TODOs are completed and verified\n- **NO TEST DELETION**: Never delete or skip failing tests to make the build pass. Fix the code, not the tests.\n\nTHE USER ASKED FOR X. DELIVER EXACTLY X. NOT A SUBSET. NOT A DEMO. NOT A STARTING POINT.\n\n1. CLASSIFY INTENT (MANDATORY)\n2. EXPLORES + LIBRARIANS\n3. GATHER -> PLAN AGENT SPAWN\n4. WORK BY DELEGATING TO ANOTHER AGENTS\n\nNOW.\n\n</ultrawork-mode>\n\n";
|
|
17
17
|
export declare function getGeminiUltraworkMessage(): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FallbackEntry } from "../../shared/model-requirements";
|
|
2
|
+
import type { ModelFallbackStateController } from "./fallback-state-controller";
|
|
3
|
+
export type ModelFallbackControllerAccessor = {
|
|
4
|
+
register: (controller: ModelFallbackStateController) => void;
|
|
5
|
+
setSessionFallbackChain: (sessionID: string, fallbackChain: FallbackEntry[] | undefined) => void;
|
|
6
|
+
clearSessionFallbackChain: (sessionID: string) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare function createModelFallbackControllerAccessor(): ModelFallbackControllerAccessor;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FallbackEntry } from "../../shared/model-requirements";
|
|
2
|
+
import { getNextReachableFallback } from "./next-fallback";
|
|
3
|
+
type ModelFallbackStateLike = {
|
|
4
|
+
providerID: string;
|
|
5
|
+
modelID: string;
|
|
6
|
+
fallbackChain: FallbackEntry[];
|
|
7
|
+
attemptCount: number;
|
|
8
|
+
pending: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type ModelFallbackStateController = {
|
|
11
|
+
lastToastKey: Map<string, string>;
|
|
12
|
+
setSessionFallbackChain: (sessionID: string, fallbackChain: FallbackEntry[] | undefined) => void;
|
|
13
|
+
clearSessionFallbackChain: (sessionID: string) => void;
|
|
14
|
+
setPendingModelFallback: (sessionID: string, agentName: string, currentProviderID: string, currentModelID: string) => boolean;
|
|
15
|
+
getNextFallback: (sessionID: string) => ReturnType<typeof getNextReachableFallback>;
|
|
16
|
+
clearPendingModelFallback: (sessionID: string) => void;
|
|
17
|
+
hasPendingModelFallback: (sessionID: string) => boolean;
|
|
18
|
+
getFallbackState: (sessionID: string) => ModelFallbackStateLike | undefined;
|
|
19
|
+
reset: () => void;
|
|
20
|
+
};
|
|
21
|
+
export declare function createModelFallbackStateController(input: {
|
|
22
|
+
pendingModelFallbacks: Map<string, ModelFallbackStateLike>;
|
|
23
|
+
lastToastKey: Map<string, string>;
|
|
24
|
+
sessionFallbackChains: Map<string, FallbackEntry[]>;
|
|
25
|
+
}): ModelFallbackStateController;
|
|
26
|
+
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { FallbackEntry } from "../../shared/model-requirements";
|
|
2
2
|
import type { ChatMessageInput, ChatMessageHandlerOutput } from "../../plugin/chat-message";
|
|
3
|
+
import { type ModelFallbackStateController } from "./fallback-state-controller";
|
|
4
|
+
import type { ModelFallbackControllerAccessor } from "./controller-accessor";
|
|
3
5
|
type FallbackToast = (input: {
|
|
4
6
|
title: string;
|
|
5
7
|
message: string;
|
|
@@ -19,18 +21,27 @@ export type ModelFallbackState = {
|
|
|
19
21
|
attemptCount: number;
|
|
20
22
|
pending: boolean;
|
|
21
23
|
};
|
|
22
|
-
|
|
23
|
-
export
|
|
24
|
+
type ModelFallbackControllerWithState = Pick<ModelFallbackStateController, "lastToastKey" | "setSessionFallbackChain" | "clearSessionFallbackChain" | "setPendingModelFallback" | "getNextFallback" | "clearPendingModelFallback" | "hasPendingModelFallback" | "getFallbackState" | "reset">;
|
|
25
|
+
export type ModelFallbackHook = ModelFallbackControllerWithState & {
|
|
26
|
+
"chat.message": (input: ChatMessageInput, output: ChatMessageHandlerOutput) => Promise<void>;
|
|
27
|
+
};
|
|
28
|
+
type ModelFallbackHookArgs = {
|
|
29
|
+
toast?: FallbackToast;
|
|
30
|
+
onApplied?: FallbackCallback;
|
|
31
|
+
controllerAccessor?: ModelFallbackControllerAccessor;
|
|
32
|
+
};
|
|
33
|
+
export declare function setSessionFallbackChain(controller: Pick<ModelFallbackStateController, "setSessionFallbackChain">, sessionID: string, fallbackChain: FallbackEntry[] | undefined): void;
|
|
34
|
+
export declare function clearSessionFallbackChain(controller: Pick<ModelFallbackStateController, "clearSessionFallbackChain">, sessionID: string): void;
|
|
24
35
|
/**
|
|
25
36
|
* Sets a pending model fallback for a session.
|
|
26
37
|
* Called when a model error is detected in session.error handler.
|
|
27
38
|
*/
|
|
28
|
-
export declare function setPendingModelFallback(sessionID: string, agentName: string, currentProviderID: string, currentModelID: string): boolean;
|
|
39
|
+
export declare function setPendingModelFallback(controller: Pick<ModelFallbackStateController, "setPendingModelFallback">, sessionID: string, agentName: string, currentProviderID: string, currentModelID: string): boolean;
|
|
29
40
|
/**
|
|
30
41
|
* Gets the next fallback model for a session.
|
|
31
42
|
* Increments attemptCount each time called.
|
|
32
43
|
*/
|
|
33
|
-
export declare function getNextFallback(sessionID: string): {
|
|
44
|
+
export declare function getNextFallback(controller: Pick<ModelFallbackStateController, "getNextFallback">, sessionID: string): {
|
|
34
45
|
providerID: string;
|
|
35
46
|
modelID: string;
|
|
36
47
|
variant?: string;
|
|
@@ -39,27 +50,21 @@ export declare function getNextFallback(sessionID: string): {
|
|
|
39
50
|
* Clears the pending fallback for a session.
|
|
40
51
|
* Called after fallback is successfully applied.
|
|
41
52
|
*/
|
|
42
|
-
export declare function clearPendingModelFallback(sessionID: string): void;
|
|
53
|
+
export declare function clearPendingModelFallback(controller: Pick<ModelFallbackStateController, "clearPendingModelFallback">, sessionID: string): void;
|
|
43
54
|
/**
|
|
44
55
|
* Checks if there's a pending fallback for a session.
|
|
45
56
|
*/
|
|
46
|
-
export declare function hasPendingModelFallback(sessionID: string): boolean;
|
|
57
|
+
export declare function hasPendingModelFallback(controller: Pick<ModelFallbackStateController, "hasPendingModelFallback">, sessionID: string): boolean;
|
|
47
58
|
/**
|
|
48
59
|
* Gets the current fallback state for a session (for debugging).
|
|
49
60
|
*/
|
|
50
|
-
export declare function getFallbackState(sessionID: string): ModelFallbackState | undefined;
|
|
61
|
+
export declare function getFallbackState(controller: Pick<ModelFallbackStateController, "getFallbackState">, sessionID: string): ModelFallbackState | undefined;
|
|
51
62
|
/**
|
|
52
63
|
* Creates a chat.message hook that applies model fallbacks when pending.
|
|
53
64
|
*/
|
|
54
|
-
export declare function createModelFallbackHook(args?:
|
|
55
|
-
toast?: FallbackToast;
|
|
56
|
-
onApplied?: FallbackCallback;
|
|
57
|
-
}): {
|
|
58
|
-
"chat.message": (input: ChatMessageInput, output: ChatMessageHandlerOutput) => Promise<void>;
|
|
59
|
-
};
|
|
65
|
+
export declare function createModelFallbackHook(args?: ModelFallbackHookArgs): ModelFallbackHook;
|
|
60
66
|
/**
|
|
61
|
-
* Resets
|
|
62
|
-
* Clears pending fallbacks, toast keys, and session chains.
|
|
67
|
+
* Resets hook-owned state for testing.
|
|
63
68
|
*/
|
|
64
|
-
export declare function _resetForTesting(): void;
|
|
69
|
+
export declare function _resetForTesting(controller?: Pick<ModelFallbackStateController, "reset">): void;
|
|
65
70
|
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { OhMyOpenCodeConfig } from "../config";
|
|
2
|
+
import { type ContextLimitModelCacheState } from "../shared/context-limit-resolver";
|
|
3
|
+
import type { CachedCompactionState, PreemptiveCompactionContext } from "./preemptive-compaction-types";
|
|
4
|
+
export declare function runPreemptiveCompactionIfNeeded(args: {
|
|
5
|
+
ctx: PreemptiveCompactionContext;
|
|
6
|
+
pluginConfig: OhMyOpenCodeConfig;
|
|
7
|
+
modelCacheState?: ContextLimitModelCacheState;
|
|
8
|
+
sessionID: string;
|
|
9
|
+
tokenCache: Map<string, CachedCompactionState>;
|
|
10
|
+
compactionInProgress: Set<string>;
|
|
11
|
+
compactedSessions: Set<string>;
|
|
12
|
+
lastCompactionTime: Map<string, number>;
|
|
13
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export interface TokenInfo {
|
|
2
|
+
input: number;
|
|
3
|
+
output: number;
|
|
4
|
+
reasoning: number;
|
|
5
|
+
cache: {
|
|
6
|
+
read: number;
|
|
7
|
+
write: number;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface CachedCompactionState {
|
|
11
|
+
providerID: string;
|
|
12
|
+
modelID: string;
|
|
13
|
+
tokens: TokenInfo;
|
|
14
|
+
}
|
|
15
|
+
export interface PreemptiveCompactionClient {
|
|
16
|
+
session: {
|
|
17
|
+
messages: (input: {
|
|
18
|
+
path: {
|
|
19
|
+
id: string;
|
|
20
|
+
};
|
|
21
|
+
query?: {
|
|
22
|
+
directory: string;
|
|
23
|
+
};
|
|
24
|
+
}) => Promise<unknown>;
|
|
25
|
+
summarize: (input: {
|
|
26
|
+
path: {
|
|
27
|
+
id: string;
|
|
28
|
+
};
|
|
29
|
+
body: {
|
|
30
|
+
providerID: string;
|
|
31
|
+
modelID: string;
|
|
32
|
+
auto?: boolean;
|
|
33
|
+
};
|
|
34
|
+
query: {
|
|
35
|
+
directory: string;
|
|
36
|
+
};
|
|
37
|
+
}) => Promise<unknown>;
|
|
38
|
+
};
|
|
39
|
+
tui: {
|
|
40
|
+
showToast: (input: {
|
|
41
|
+
body: {
|
|
42
|
+
title: string;
|
|
43
|
+
message: string;
|
|
44
|
+
variant: "warning";
|
|
45
|
+
duration: number;
|
|
46
|
+
};
|
|
47
|
+
}) => Promise<unknown>;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export interface PreemptiveCompactionContext {
|
|
51
|
+
client: PreemptiveCompactionClient;
|
|
52
|
+
directory: string;
|
|
53
|
+
}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
import type { OhMyOpenCodeConfig } from "../config";
|
|
2
|
-
import {
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
session: {
|
|
6
|
-
messages: (...args: any[]) => any;
|
|
7
|
-
summarize: (...args: any[]) => any;
|
|
8
|
-
};
|
|
9
|
-
tui: {
|
|
10
|
-
showToast: (...args: any[]) => any;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
directory: string;
|
|
14
|
-
};
|
|
15
|
-
export declare function createPreemptiveCompactionHook(ctx: PluginInput, pluginConfig: OhMyOpenCodeConfig, modelCacheState?: ContextLimitModelCacheState): {
|
|
2
|
+
import type { ContextLimitModelCacheState } from "../shared/context-limit-resolver";
|
|
3
|
+
import type { PreemptiveCompactionContext } from "./preemptive-compaction-types";
|
|
4
|
+
export declare function createPreemptiveCompactionHook(ctx: PreemptiveCompactionContext, pluginConfig: OhMyOpenCodeConfig, modelCacheState?: ContextLimitModelCacheState): {
|
|
16
5
|
"tool.execute.after": (input: {
|
|
17
6
|
tool: string;
|
|
18
7
|
sessionID: string;
|
|
@@ -29,4 +18,3 @@ export declare function createPreemptiveCompactionHook(ctx: PluginInput, pluginC
|
|
|
29
18
|
};
|
|
30
19
|
}) => Promise<void>;
|
|
31
20
|
};
|
|
32
|
-
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RuleScanCache } from "./rule-scan-cache";
|
|
1
2
|
export type SessionInjectedRulesCache = {
|
|
2
3
|
contentHashes: Set<string>;
|
|
3
4
|
realPaths: Set<string>;
|
|
@@ -6,3 +7,7 @@ export declare function createSessionCacheStore(): {
|
|
|
6
7
|
getSessionCache: (sessionID: string) => SessionInjectedRulesCache;
|
|
7
8
|
clearSessionCache: (sessionID: string) => void;
|
|
8
9
|
};
|
|
10
|
+
export declare function createSessionRuleScanCacheStore(): {
|
|
11
|
+
getSessionRuleScanCache: (sessionID: string) => RuleScanCache;
|
|
12
|
+
clearSessionRuleScanCache: (sessionID: string) => void;
|
|
13
|
+
};
|
|
@@ -4,6 +4,7 @@ import type { FindRuleFilesOptions } from "./rule-file-finder";
|
|
|
4
4
|
import { createContentHash, isDuplicateByContentHash, isDuplicateByRealPath, shouldApplyRule } from "./matcher";
|
|
5
5
|
import { saveInjectedRules } from "./storage";
|
|
6
6
|
import type { SessionInjectedRulesCache } from "./cache";
|
|
7
|
+
import type { RuleScanCache } from "./rule-scan-cache";
|
|
7
8
|
type ToolExecuteOutput = {
|
|
8
9
|
title: string;
|
|
9
10
|
output: string;
|
|
@@ -19,6 +20,7 @@ export declare function createRuleInjectionProcessor(deps: {
|
|
|
19
20
|
workspaceDirectory: string;
|
|
20
21
|
truncator: DynamicTruncator;
|
|
21
22
|
getSessionCache: (sessionID: string) => SessionInjectedRulesCache;
|
|
23
|
+
getSessionRuleScanCache?: (sessionID: string) => RuleScanCache;
|
|
22
24
|
ruleFinderOptions?: FindRuleFilesOptions;
|
|
23
25
|
readFileSync?: typeof readFileSync;
|
|
24
26
|
statSync?: typeof statSync;
|
|
@@ -1,23 +1,6 @@
|
|
|
1
|
+
import type { RuleScanCache } from "./rule-scan-cache";
|
|
1
2
|
import type { RuleFileCandidate } from "./types";
|
|
2
3
|
export interface FindRuleFilesOptions {
|
|
3
|
-
/**
|
|
4
|
-
* When true, skip loading rules from ~/.claude/rules/.
|
|
5
|
-
* Use when claude_code integration is disabled to prevent
|
|
6
|
-
* Claude Code-specific instructions from leaking into non-Claude agents.
|
|
7
|
-
*/
|
|
8
4
|
skipClaudeUserRules?: boolean;
|
|
9
5
|
}
|
|
10
|
-
|
|
11
|
-
* Find all rule files for a given context.
|
|
12
|
-
* Searches from currentFile upward to projectRoot for rule directories,
|
|
13
|
-
* then user-level directory (~/.claude/rules).
|
|
14
|
-
*
|
|
15
|
-
* IMPORTANT: This searches EVERY directory from file to project root.
|
|
16
|
-
* Not just the project root itself.
|
|
17
|
-
*
|
|
18
|
-
* @param projectRoot - Project root path (or null if outside any project)
|
|
19
|
-
* @param homeDir - User home directory
|
|
20
|
-
* @param currentFile - Current file being edited (for distance calculation)
|
|
21
|
-
* @returns Array of rule file candidates sorted by distance
|
|
22
|
-
*/
|
|
23
|
-
export declare function findRuleFiles(projectRoot: string | null, homeDir: string, currentFile: string, options?: FindRuleFilesOptions): RuleFileCandidate[];
|
|
6
|
+
export declare function findRuleFiles(projectRoot: string | null, homeDir: string, currentFile: string, options?: FindRuleFilesOptions, cache?: RuleScanCache): RuleFileCandidate[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
type EventProperties = Record<string, unknown> | undefined;
|
|
2
|
+
export declare function getSessionID(properties: EventProperties): string | undefined;
|
|
3
|
+
export declare function getEventToolName(properties: EventProperties): string | undefined;
|
|
4
|
+
export declare function getQuestionText(properties: EventProperties): string;
|
|
5
|
+
export {};
|
|
@@ -9,6 +9,7 @@ export interface ContinuationProgressUpdate {
|
|
|
9
9
|
export interface SessionStateStore {
|
|
10
10
|
getState: (sessionID: string) => SessionState;
|
|
11
11
|
getExistingState: (sessionID: string) => SessionState | undefined;
|
|
12
|
+
startPruneInterval: () => void;
|
|
12
13
|
recordActivity: (sessionID: string) => void;
|
|
13
14
|
trackContinuationProgress: (sessionID: string, incompleteCount: number, todos?: Todo[], options?: ContinuationProgressOptions) => ContinuationProgressUpdate;
|
|
14
15
|
resetContinuationProgress: (sessionID: string) => void;
|
|
@@ -10,6 +10,6 @@ export declare function handleWriteExistingFileGuardToolExecuteBefore(params: {
|
|
|
10
10
|
};
|
|
11
11
|
readPermissionsBySession: Map<string, Set<string>>;
|
|
12
12
|
sessionLastAccess: Map<string, number>;
|
|
13
|
-
|
|
13
|
+
getCanonicalSessionRoot: () => string;
|
|
14
14
|
maxTrackedSessions: number;
|
|
15
15
|
}): Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
1
|
+
import type { PluginModule } from "@opencode-ai/plugin";
|
|
2
|
+
declare const pluginModule: PluginModule;
|
|
3
|
+
export default pluginModule;
|
|
4
4
|
export type { OhMyOpenCodeConfig, AgentName, AgentOverrideConfig, AgentOverrides, McpName, HookName, BuiltinCommandName, } from "./config";
|
|
5
5
|
export type { ConfigLoadError } from "./shared/config-errors";
|