evil-omo 3.17.0 → 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 +6 -2
- package/README.ko.md +6 -2
- package/README.ru.md +6 -2
- package/README.zh-cn.md +6 -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/agents/types.d.ts +1 -1
- package/dist/cli/doctor/spawn-with-timeout.d.ts +8 -0
- package/dist/cli/index.js +18440 -16031
- package/dist/cli/install-validators.d.ts +1 -0
- package/dist/cli/model-fallback-types.d.ts +1 -0
- package/dist/cli/provider-model-id-transform.d.ts +1 -1
- package/dist/cli/types.d.ts +3 -0
- package/dist/config/schema/agent-definitions.d.ts +3 -0
- package/dist/config/schema/background-task.d.ts +0 -1
- package/dist/config/schema/evil-omo-config.d.ts +11 -3
- package/dist/create-hooks.d.ts +2 -0
- package/dist/create-managers.d.ts +2 -0
- package/dist/create-tools.d.ts +3 -2
- package/dist/evil-omo.schema.json +24 -6
- 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/session-existence.d.ts +1 -1
- package/dist/features/background-agent/subagent-spawn-limits.d.ts +1 -8
- package/dist/features/background-agent/task-poller.d.ts +1 -0
- package/dist/features/background-agent/wait-for-task-session.d.ts +17 -0
- package/dist/features/builtin-commands/commands.d.ts +2 -1
- package/dist/features/claude-code-agent-loader/agent-definitions-loader.d.ts +3 -0
- package/dist/features/claude-code-agent-loader/index.d.ts +3 -0
- package/dist/features/claude-code-agent-loader/json-agent-loader.d.ts +2 -0
- package/dist/features/claude-code-agent-loader/loader.d.ts +2 -0
- package/dist/features/claude-code-agent-loader/opencode-config-agents-reader.d.ts +2 -0
- package/dist/features/claude-code-agent-loader/types.d.ts +9 -1
- 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/atlas/system-reminder-templates.d.ts +2 -2
- 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-agents-injector/hook.d.ts +7 -7
- package/dist/hooks/directory-readme-injector/finder.d.ts +1 -1
- package/dist/hooks/directory-readme-injector/hook.d.ts +7 -7
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/keyword-detector/ultrawork/planner.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/model-fallback/next-fallback.d.ts +8 -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 +70250 -92660
- package/dist/openclaw/config.d.ts +1 -1
- package/dist/openclaw/dispatcher.d.ts +0 -1
- package/dist/openclaw/gateway-url-validation.d.ts +1 -0
- 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/agent-tool-restrictions.d.ts +0 -5
- package/dist/shared/excluded-dirs.d.ts +1 -0
- package/dist/shared/index.d.ts +5 -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/parse-tools-config.d.ts +6 -0
- package/dist/shared/permission-compat.d.ts +1 -1
- package/dist/shared/project-discovery-dirs.d.ts +2 -0
- package/dist/shared/resolve-agent-definition-paths.d.ts +1 -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/agent-resolver.d.ts +17 -0
- package/dist/tools/call-omo-agent/constants.d.ts +1 -1
- 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/delegated-model-config.d.ts +3 -0
- package/dist/tools/delegate-task/executor-types.d.ts +2 -0
- package/dist/tools/delegate-task/fallback-entry-resolution.d.ts +12 -0
- package/dist/tools/delegate-task/fallback-entry-settings.d.ts +7 -0
- package/dist/tools/delegate-task/resolve-metadata-model.d.ts +9 -0
- package/dist/tools/delegate-task/subagent-discovery.d.ts +15 -0
- package/dist/tools/delegate-task/sync-continuation.d.ts +2 -2
- package/dist/tools/delegate-task/sync-task-fallback.d.ts +12 -0
- 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/constants.d.ts +1 -1
- 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 +20 -17
- 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
|
@@ -32,6 +32,8 @@ export declare class TmuxSessionManager {
|
|
|
32
32
|
private isolatedContainerPaneId;
|
|
33
33
|
private isolatedWindowPaneId;
|
|
34
34
|
private isolatedContainerNullStateCount;
|
|
35
|
+
private staleSweepCompleted;
|
|
36
|
+
private staleSweepInProgress;
|
|
35
37
|
constructor(ctx: PluginInput, tmuxConfig: TmuxConfig, deps?: TmuxUtilDeps);
|
|
36
38
|
private isEnabled;
|
|
37
39
|
private isIsolated;
|
|
@@ -54,6 +56,7 @@ export declare class TmuxSessionManager {
|
|
|
54
56
|
private startDeferredAttachLoop;
|
|
55
57
|
private stopDeferredAttachLoop;
|
|
56
58
|
private tryAttachDeferredSession;
|
|
59
|
+
private logSessionReadinessInBackground;
|
|
57
60
|
private waitForSessionReady;
|
|
58
61
|
onSessionCreated(event: SessionCreatedEvent): Promise<void>;
|
|
59
62
|
private enqueueSpawn;
|
|
@@ -72,5 +75,6 @@ export declare class TmuxSessionManager {
|
|
|
72
75
|
};
|
|
73
76
|
}) => Promise<void>;
|
|
74
77
|
cleanup(): Promise<void>;
|
|
78
|
+
private sweepStaleIsolatedSessionsOnce;
|
|
75
79
|
}
|
|
76
80
|
export {};
|
|
@@ -4,9 +4,10 @@ export declare class TmuxPollingManager {
|
|
|
4
4
|
private client;
|
|
5
5
|
private sessions;
|
|
6
6
|
private closeSessionById;
|
|
7
|
+
private retryPendingCloses?;
|
|
7
8
|
private pollInterval?;
|
|
8
9
|
private pollingInFlight;
|
|
9
|
-
constructor(client: OpencodeClient, sessions: Map<string, TrackedSession>, closeSessionById: (sessionId: string) => Promise<void>);
|
|
10
|
+
constructor(client: OpencodeClient, sessions: Map<string, TrackedSession>, closeSessionById: (sessionId: string) => Promise<void>, retryPendingCloses?: (() => Promise<void>) | undefined);
|
|
10
11
|
handleEvent(event: {
|
|
11
12
|
type: string;
|
|
12
13
|
properties?: Record<string, unknown>;
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
export { clearPendingStore, consumeToolMetadata, getPendingStoreSize, storeToolMetadata, } from "./store";
|
|
2
2
|
export type { PendingToolMetadata } from "./store";
|
|
3
|
+
export { resolveToolCallID } from "./resolve-tool-call-id";
|
|
4
|
+
export type { ToolCallIDCarrier } from "./resolve-tool-call-id";
|
|
5
|
+
export { buildTaskMetadataBlock, extractTaskLink, parseTaskMetadataBlock } from "./task-metadata-contract";
|
|
6
|
+
export type { TaskLink } from "./task-metadata-contract";
|
|
7
|
+
export { publishToolMetadata } from "./publish-tool-metadata";
|
|
8
|
+
export { recoverToolMetadata } from "./recover-tool-metadata";
|
|
9
|
+
export type { ToolMetadataPublisherContext } from "./publish-tool-metadata";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ToolCallIDCarrier } from "./resolve-tool-call-id";
|
|
2
|
+
import { type PendingToolMetadata } from "./store";
|
|
3
|
+
export interface ToolMetadataPublisherContext extends ToolCallIDCarrier {
|
|
4
|
+
sessionID: string;
|
|
5
|
+
metadata?: (input: PendingToolMetadata) => void | Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export declare function publishToolMetadata(ctx: ToolMetadataPublisherContext, payload: PendingToolMetadata): Promise<{
|
|
8
|
+
stored: boolean;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface TaskLink {
|
|
2
|
+
sessionId?: string;
|
|
3
|
+
taskId?: string;
|
|
4
|
+
backgroundTaskId?: string;
|
|
5
|
+
agent?: string;
|
|
6
|
+
category?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function buildTaskMetadataBlock(link: TaskLink): string;
|
|
9
|
+
export declare function parseTaskMetadataBlock(text: string): TaskLink;
|
|
10
|
+
export declare function extractTaskLink(metadata: unknown, outputText: string): TaskLink;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const DIRECT_WORK_REMINDER: string;
|
|
2
2
|
export declare const BOULDER_CONTINUATION_PROMPT: string;
|
|
3
|
-
export declare const VERIFICATION_REMINDER = "**THE SUBAGENT JUST CLAIMED THIS TASK IS DONE. THEY ARE PROBABLY LYING.**\n\nSubagents say \"done\" when code has errors, tests pass trivially, logic is wrong,\nor they quietly added features nobody asked for. This happens EVERY TIME.\nAssume the work is broken until YOU prove otherwise.\n\n---\n\n**PHASE 1: READ THE CODE FIRST (before running anything)**\n\nDo NOT run tests yet. Read the code FIRST so you know what you're testing.\n\n1. `Bash(\"git diff --stat\")` - see exactly which files changed. Any file outside expected scope = scope creep.\n2. `Read` EVERY changed file - no exceptions, no skimming.\n3. For EACH file, critically ask:\n - Does this code ACTUALLY do what the task required? (Re-read the task, compare line by line)\n - Any stubs, TODOs, placeholders, hardcoded values? (`Grep` for TODO, FIXME, HACK, xxx)\n - Logic errors? Trace the happy path AND the error path in your head.\n - Anti-patterns? (`Grep` for `as any`, `@ts-ignore`, empty catch, console.log in changed files)\n - Scope creep? Did the subagent touch things or add features NOT in the task spec?\n4. Cross-check every claim:\n - Said \"Updated X\" - READ X. Actually updated, or just superficially touched?\n - Said \"Added tests\" - READ the tests. Do they test REAL behavior or just `expect(true).toBe(true)`?\n - Said \"Follows patterns\" - OPEN a reference file. Does it ACTUALLY match?\n\n**If you cannot explain what every changed line does, you have NOT reviewed it.**\n\n**PHASE 2: RUN AUTOMATED CHECKS (targeted, then broad)**\n\nNow that you understand the code, verify mechanically:\n1. `lsp_diagnostics` on EACH changed file - ZERO new errors\n2. Run tests for changed modules FIRST, then full suite\n3. Build/typecheck - exit 0\n\nIf Phase 1 found issues but Phase 2 passes: Phase 2 is WRONG. The code has bugs that tests don't cover. Fix the code.\n\n**PHASE 3: HANDS-ON QA - ACTUALLY RUN IT (MANDATORY for user-facing changes)**\n\nTests and linters CANNOT catch: visual bugs, wrong CLI output, broken user flows, API response shape issues.\n\n**If this task produced anything a user would SEE or INTERACT with, you MUST launch it and verify yourself.**\n\n- **Frontend/UI**: `/playwright` skill - load the page, click through the flow, check console. Verify: page loads, interactions work, console clean, responsive.\n- **TUI/CLI**: `interactive_bash` - run the command, try good input, try bad input, try --help. Verify: command runs, output correct, error messages helpful, edge inputs handled.\n- **API/Backend**: `Bash` with curl - hit the endpoint, check response body, send malformed input. Verify: returns 200, body correct, error cases return proper errors.\n- **Config/Build**: Actually start the service or import the config. Verify: loads without error, backward compatible.\n\nThis is NOT optional \"if applicable\". If the deliverable is user-facing and you did not run it, you are shipping untested work.\n\n**PHASE 4: GATE DECISION - Should you proceed to the next task?**\n\nAnswer honestly:\n1. Can I explain what EVERY changed line does? (If no - back to Phase 1)\n2. Did I SEE it work with my own eyes? (If user-facing and no - back to Phase 3)\n3. Am I confident nothing existing is broken? (If no - run broader tests)\n\nALL three must be YES. \"Probably\" = NO. \"I think so\" = NO. Investigate until CERTAIN.\n\n- **All 3 YES** - Proceed: mark task complete, move to next.\n- **Any NO** - Reject: resume session with `session_id`, fix the specific issue.\n- **Unsure** - Reject: \"unsure\" = \"no\". Investigate until you have a definitive answer.\n\n**DO NOT proceed to the next task until all 4 phases are complete and the gate passes.**";
|
|
4
|
-
export declare const VERIFICATION_REMINDER_GEMINI = "**THE SUBAGENT HAS FINISHED. THEIR WORK IS EXTREMELY SUSPICIOUS.**\n\nThe subagent CLAIMS this task is done. Based on thousands of executions, subagent claims are FALSE more often than true.\nThey ROUTINELY:\n- Ship code with syntax errors they didn't bother to check\n- Create stub implementations with TODOs and call it \"done\"\n- Write tests that pass trivially (testing nothing meaningful)\n- Implement logic that does NOT match what was requested\n- Add features nobody asked for and call it \"improvement\"\n- Report \"all tests pass\" when they didn't run any tests\n\n**This is NOT a theoretical warning. This WILL happen on this task. Assume the work is BROKEN.**\n\n**YOU MUST VERIFY WITH ACTUAL TOOL CALLS. NOT REASONING. TOOL CALLS.**\nThinking \"it looks correct\" is NOT verification. Running `lsp_diagnostics` IS.\n\n---\n\n**PHASE 1: READ THE CODE FIRST (DO NOT SKIP - DO NOT RUN TESTS YET)**\n\nRead the code FIRST so you know what you're testing.\n\n1. `Bash(\"git diff --stat\")` - see exactly which files changed.\n2. `Read` EVERY changed file - no exceptions, no skimming.\n3. For EACH file:\n - Does this code ACTUALLY do what the task required? RE-READ the task spec.\n - Any stubs, TODOs, placeholders? `Grep` for TODO, FIXME, HACK, xxx\n - Anti-patterns? `Grep` for `as any`, `@ts-ignore`, empty catch\n - Scope creep? Did the subagent add things NOT in the task spec?\n4. Cross-check EVERY claim against actual code.\n\n**If you cannot explain what every changed line does, GO BACK AND READ AGAIN.**\n\n**PHASE 2: RUN AUTOMATED CHECKS**\n\n1. `lsp_diagnostics` on EACH changed file - ZERO new errors. ACTUALLY RUN THIS.\n2. Run tests for changed modules, then full suite. ACTUALLY RUN THESE.\n3. Build/typecheck - exit 0.\n\nIf Phase 1 found issues but Phase 2 passes: Phase 2 is WRONG. Fix the code.\n\n**PHASE 3: HANDS-ON QA (MANDATORY for user-facing changes)**\n\n- **Frontend/UI**: `/playwright`\n- **TUI/CLI**: `interactive_bash`\n- **API/Backend**: `Bash` with curl\n\n**If user-facing and you did not run it, you are shipping UNTESTED BROKEN work.**\n\n**PHASE 4: GATE DECISION**\n\n1. Can I explain what EVERY changed line does? (If no \u2192 Phase 1)\n2. Did I SEE it work via tool calls? (If user-facing and no \u2192 Phase 3)\n3. Am I confident nothing is broken? (If no \u2192 broader tests)\n\nALL three must be YES. \"Probably\" = NO. \"I think so\" = NO.\n\n**DO NOT proceed to the next task until all 4 phases are complete.**";
|
|
3
|
+
export declare const VERIFICATION_REMINDER = "**THE SUBAGENT JUST CLAIMED THIS TASK IS DONE. THEY ARE PROBABLY LYING.**\n\nSubagents say \"done\" when code has errors, tests pass trivially, logic is wrong,\nor they quietly added features nobody asked for. This happens EVERY TIME.\nAssume the work is broken until YOU prove otherwise.\n\n---\n\n**PHASE 1: READ THE CODE FIRST (before running anything)**\n\nDo NOT run tests yet. Read the code FIRST so you know what you're testing.\n\n1. `Bash(\"git diff --stat -- ':!node_modules'\")` - see exactly which files changed. Any file outside expected scope = scope creep.\n2. `Read` EVERY changed file - no exceptions, no skimming.\n3. For EACH file, critically ask:\n - Does this code ACTUALLY do what the task required? (Re-read the task, compare line by line)\n - Any stubs, TODOs, placeholders, hardcoded values? (`Grep` for TODO, FIXME, HACK, xxx)\n - Logic errors? Trace the happy path AND the error path in your head.\n - Anti-patterns? (`Grep` for `as any`, `@ts-ignore`, empty catch, console.log in changed files)\n - Scope creep? Did the subagent touch things or add features NOT in the task spec?\n4. Cross-check every claim:\n - Said \"Updated X\" - READ X. Actually updated, or just superficially touched?\n - Said \"Added tests\" - READ the tests. Do they test REAL behavior or just `expect(true).toBe(true)`?\n - Said \"Follows patterns\" - OPEN a reference file. Does it ACTUALLY match?\n\n**If you cannot explain what every changed line does, you have NOT reviewed it.**\n\n**PHASE 2: RUN AUTOMATED CHECKS (targeted, then broad)**\n\nNow that you understand the code, verify mechanically:\n1. `lsp_diagnostics` on EACH changed file - ZERO new errors\n2. Run tests for changed modules FIRST, then full suite\n3. Build/typecheck - exit 0\n\nIf Phase 1 found issues but Phase 2 passes: Phase 2 is WRONG. The code has bugs that tests don't cover. Fix the code.\n\n**PHASE 3: HANDS-ON QA - ACTUALLY RUN IT (MANDATORY for user-facing changes)**\n\nTests and linters CANNOT catch: visual bugs, wrong CLI output, broken user flows, API response shape issues.\n\n**If this task produced anything a user would SEE or INTERACT with, you MUST launch it and verify yourself.**\n\n- **Frontend/UI**: `/playwright` skill - load the page, click through the flow, check console. Verify: page loads, interactions work, console clean, responsive.\n- **TUI/CLI**: `interactive_bash` - run the command, try good input, try bad input, try --help. Verify: command runs, output correct, error messages helpful, edge inputs handled.\n- **API/Backend**: `Bash` with curl - hit the endpoint, check response body, send malformed input. Verify: returns 200, body correct, error cases return proper errors.\n- **Config/Build**: Actually start the service or import the config. Verify: loads without error, backward compatible.\n\nThis is NOT optional \"if applicable\". If the deliverable is user-facing and you did not run it, you are shipping untested work.\n\n**PHASE 4: GATE DECISION - Should you proceed to the next task?**\n\nAnswer honestly:\n1. Can I explain what EVERY changed line does? (If no - back to Phase 1)\n2. Did I SEE it work with my own eyes? (If user-facing and no - back to Phase 3)\n3. Am I confident nothing existing is broken? (If no - run broader tests)\n\nALL three must be YES. \"Probably\" = NO. \"I think so\" = NO. Investigate until CERTAIN.\n\n- **All 3 YES** - Proceed: mark task complete, move to next.\n- **Any NO** - Reject: resume session with `session_id`, fix the specific issue.\n- **Unsure** - Reject: \"unsure\" = \"no\". Investigate until you have a definitive answer.\n\n**DO NOT proceed to the next task until all 4 phases are complete and the gate passes.**";
|
|
4
|
+
export declare const VERIFICATION_REMINDER_GEMINI = "**THE SUBAGENT HAS FINISHED. THEIR WORK IS EXTREMELY SUSPICIOUS.**\n\nThe subagent CLAIMS this task is done. Based on thousands of executions, subagent claims are FALSE more often than true.\nThey ROUTINELY:\n- Ship code with syntax errors they didn't bother to check\n- Create stub implementations with TODOs and call it \"done\"\n- Write tests that pass trivially (testing nothing meaningful)\n- Implement logic that does NOT match what was requested\n- Add features nobody asked for and call it \"improvement\"\n- Report \"all tests pass\" when they didn't run any tests\n\n**This is NOT a theoretical warning. This WILL happen on this task. Assume the work is BROKEN.**\n\n**YOU MUST VERIFY WITH ACTUAL TOOL CALLS. NOT REASONING. TOOL CALLS.**\nThinking \"it looks correct\" is NOT verification. Running `lsp_diagnostics` IS.\n\n---\n\n**PHASE 1: READ THE CODE FIRST (DO NOT SKIP - DO NOT RUN TESTS YET)**\n\nRead the code FIRST so you know what you're testing.\n\n1. `Bash(\"git diff --stat -- ':!node_modules'\")` - see exactly which files changed.\n2. `Read` EVERY changed file - no exceptions, no skimming.\n3. For EACH file:\n - Does this code ACTUALLY do what the task required? RE-READ the task spec.\n - Any stubs, TODOs, placeholders? `Grep` for TODO, FIXME, HACK, xxx\n - Anti-patterns? `Grep` for `as any`, `@ts-ignore`, empty catch\n - Scope creep? Did the subagent add things NOT in the task spec?\n4. Cross-check EVERY claim against actual code.\n\n**If you cannot explain what every changed line does, GO BACK AND READ AGAIN.**\n\n**PHASE 2: RUN AUTOMATED CHECKS**\n\n1. `lsp_diagnostics` on EACH changed file - ZERO new errors. ACTUALLY RUN THIS.\n2. Run tests for changed modules, then full suite. ACTUALLY RUN THESE.\n3. Build/typecheck - exit 0.\n\nIf Phase 1 found issues but Phase 2 passes: Phase 2 is WRONG. Fix the code.\n\n**PHASE 3: HANDS-ON QA (MANDATORY for user-facing changes)**\n\n- **Frontend/UI**: `/playwright`\n- **TUI/CLI**: `interactive_bash`\n- **API/Backend**: `Bash` with curl\n\n**If user-facing and you did not run it, you are shipping UNTESTED BROKEN work.**\n\n**PHASE 4: GATE DECISION**\n\n1. Can I explain what EVERY changed line does? (If no \u2192 Phase 1)\n2. Did I SEE it work via tool calls? (If user-facing and no \u2192 Phase 3)\n3. Am I confident nothing is broken? (If no \u2192 broader tests)\n\nALL three must be YES. \"Probably\" = NO. \"I think so\" = NO.\n\n**DO NOT proceed to the next task until all 4 phases are complete.**";
|
|
5
5
|
export declare const ORCHESTRATOR_DELEGATION_REQUIRED: string;
|
|
6
6
|
export declare const SINGLE_TASK_DIRECTIVE: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function scheduleDeferredStartupCheck(runCheck: () => void): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ensureCommentCheckerInitialization(initializer: () => void): void;
|
|
@@ -9,8 +9,12 @@ interface ToolExecuteOutput {
|
|
|
9
9
|
output: string;
|
|
10
10
|
metadata: unknown;
|
|
11
11
|
}
|
|
12
|
-
interface
|
|
13
|
-
|
|
12
|
+
interface DirectoryAgentsInjectorHook {
|
|
13
|
+
"tool.execute.before"?: (input: ToolExecuteInput, output: {
|
|
14
|
+
args: unknown;
|
|
15
|
+
}) => Promise<void>;
|
|
16
|
+
"tool.execute.after": (input: ToolExecuteInput, output: ToolExecuteOutput) => Promise<void>;
|
|
17
|
+
event: (input: EventInput) => Promise<void>;
|
|
14
18
|
}
|
|
15
19
|
interface EventInput {
|
|
16
20
|
event: {
|
|
@@ -20,9 +24,5 @@ interface EventInput {
|
|
|
20
24
|
}
|
|
21
25
|
export declare function createDirectoryAgentsInjectorHook(ctx: PluginInput, modelCacheState?: {
|
|
22
26
|
anthropicContext1MEnabled: boolean;
|
|
23
|
-
}):
|
|
24
|
-
"tool.execute.before": (input: ToolExecuteInput, output: ToolExecuteBeforeOutput) => Promise<void>;
|
|
25
|
-
"tool.execute.after": (input: ToolExecuteInput, output: ToolExecuteOutput) => Promise<void>;
|
|
26
|
-
event: ({ event }: EventInput) => Promise<void>;
|
|
27
|
-
};
|
|
27
|
+
}): DirectoryAgentsInjectorHook;
|
|
28
28
|
export {};
|
|
@@ -9,8 +9,12 @@ interface ToolExecuteOutput {
|
|
|
9
9
|
output: string;
|
|
10
10
|
metadata: unknown;
|
|
11
11
|
}
|
|
12
|
-
interface
|
|
13
|
-
|
|
12
|
+
interface DirectoryReadmeInjectorHook {
|
|
13
|
+
"tool.execute.before"?: (input: ToolExecuteInput, output: {
|
|
14
|
+
args: unknown;
|
|
15
|
+
}) => Promise<void>;
|
|
16
|
+
"tool.execute.after": (input: ToolExecuteInput, output: ToolExecuteOutput) => Promise<void>;
|
|
17
|
+
event: (input: EventInput) => Promise<void>;
|
|
14
18
|
}
|
|
15
19
|
interface EventInput {
|
|
16
20
|
event: {
|
|
@@ -20,9 +24,5 @@ interface EventInput {
|
|
|
20
24
|
}
|
|
21
25
|
export declare function createDirectoryReadmeInjectorHook(ctx: PluginInput, modelCacheState?: {
|
|
22
26
|
anthropicContext1MEnabled: boolean;
|
|
23
|
-
}):
|
|
24
|
-
"tool.execute.before": (input: ToolExecuteInput, output: ToolExecuteBeforeOutput) => Promise<void>;
|
|
25
|
-
"tool.execute.after": (input: ToolExecuteInput, output: ToolExecuteOutput) => Promise<void>;
|
|
26
|
-
event: ({ event }: EventInput) => Promise<void>;
|
|
27
|
-
};
|
|
27
|
+
}): DirectoryReadmeInjectorHook;
|
|
28
28
|
export {};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export { createDirectoryReadmeInjectorHook } from "./directory-readme-injector";
|
|
|
13
13
|
export { createEmptyTaskResponseDetectorHook } from "./empty-task-response-detector";
|
|
14
14
|
export { createAnthropicContextWindowLimitRecoveryHook, type AnthropicContextWindowLimitRecoveryOptions } from "./anthropic-context-window-limit-recovery";
|
|
15
15
|
export { createThinkModeHook } from "./think-mode";
|
|
16
|
-
export { createModelFallbackHook, setPendingModelFallback, clearPendingModelFallback, type ModelFallbackState } from "./model-fallback/hook";
|
|
16
|
+
export { createModelFallbackHook, setPendingModelFallback, clearPendingModelFallback, type ModelFallbackHook, type ModelFallbackState, } from "./model-fallback/hook";
|
|
17
17
|
export { createClaudeCodeHooksHook } from "./claude-code-hooks";
|
|
18
18
|
export { createRulesInjectorHook } from "./rules-injector";
|
|
19
19
|
export { createBackgroundNotificationHook } from "./background-notification";
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* Ultrawork message section for planner agents (Prometheus).
|
|
3
3
|
* Planner agents should NOT be told to call plan agent - they ARE the planner.
|
|
4
4
|
*/
|
|
5
|
-
export declare const ULTRAWORK_PLANNER_SECTION = "## CRITICAL: YOU ARE A PLANNER, NOT AN IMPLEMENTER\n\n**IDENTITY CONSTRAINT (NON-NEGOTIABLE):**\nYou ARE the planner. You ARE NOT an implementer. You DO NOT write code. You DO NOT execute tasks.\n\n**TOOL RESTRICTIONS (SYSTEM-ENFORCED):**\n| Tool | Allowed | Blocked |\n|------|---------|---------|\n| Write/Edit | `.sisyphus/**/*.md` ONLY | Everything else |\n| Read | All files | - |\n| Bash | Research commands only | Implementation commands |\n| task | explore, librarian | - |\n\n**IF YOU TRY TO WRITE/EDIT OUTSIDE `.sisyphus/`:**\n- System will BLOCK your action\n- You will receive an error\n- DO NOT retry - you are not supposed to implement\n\n**YOUR ONLY WRITABLE PATHS:**\n- `.sisyphus/plans/*.md` - Final work plans\n- `.sisyphus/drafts/*.md` - Working drafts during interview\n\n**WHEN USER ASKS YOU TO IMPLEMENT:**\nREFUSE. Say: \"I'm a planner. I create work plans, not implementations. Run `/start-work` after I finish planning.\"\n\n---\n\n## CONTEXT GATHERING (MANDATORY BEFORE PLANNING)\n\nYou ARE the planner. Your job: create bulletproof work plans.\n**Before drafting ANY plan, gather context via explore/librarian agents.**\n\n### Research Protocol\n1. **Fire parallel background agents** for comprehensive context:\n ```\n task(subagent_type=\"explore\", load_skills=[], prompt=\"Find existing patterns for [topic] in codebase\", run_in_background=true)\n task(subagent_type=\"explore\", load_skills=[], prompt=\"Find test infrastructure and conventions\", run_in_background=true)\n task(subagent_type=\"librarian\", load_skills=[], prompt=\"Find official docs and best practices for [technology]\", run_in_background=true)\n ```\n2. **Wait for results** before planning - rushed plans fail\n3. **Synthesize findings** into informed requirements\n\n### What to Research\n- Existing codebase patterns and conventions\n- Test infrastructure (TDD possible?)\n- External library APIs and constraints\n- Similar implementations in OSS (via librarian)\n\n**NEVER plan blind. Context first, plan second.**\n\n---\n\n## MANDATORY OUTPUT: PARALLEL TASK GRAPH + TODO LIST\n\n**YOUR PRIMARY OUTPUT IS A PARALLEL EXECUTION TASK GRAPH.**\n\nWhen you finalize a plan, you MUST structure it for maximum parallel execution:\n\n### 1. Parallel Execution Waves (REQUIRED)\n\nAnalyze task dependencies and group independent tasks into parallel waves:\n\n```\nWave 1 (Start Immediately - No Dependencies):\n\u251C\u2500\u2500 Task 1: [description] \u2192 category: X, skills: [a, b]\n\u2514\u2500\u2500 Task 4: [description] \u2192 category: Y, skills: [c]\n\nWave 2 (After Wave 1 Completes):\n\u251C\u2500\u2500 Task 2: [depends: 1] \u2192 category: X, skills: [a]\n\u251C\u2500\u2500 Task 3: [depends: 1] \u2192 category: Z, skills: [d]\n\u2514\u2500\u2500 Task 5: [depends: 4] \u2192 category: Y, skills: [c]\n\nWave 3 (After Wave 2 Completes):\n\u2514\u2500\u2500 Task 6: [depends: 2, 3] \u2192 category: X, skills: [a, b]\n\nCritical Path: Task 1 \u2192 Task 2 \u2192 Task 6\nEstimated Parallel Speedup: ~40% faster than sequential\n```\n\n### 2. Dependency Matrix (REQUIRED)\n\n| Task | Depends On | Blocks | Can Parallelize With |\n|------|------------|--------|---------------------|\n| 1 | None | 2, 3 | 4 |\n| 2 | 1 | 6 | 3, 5 |\n| 3 | 1 | 6 | 2, 5 |\n| 4 | None | 5 | 1 |\n| 5 | 4 | None | 2, 3 |\n| 6 | 2, 3 | None | None (final) |\n\n### 3. TODO List Structure (REQUIRED)\n\nEach TODO item MUST include:\n\n```markdown\n- [ ] N. [Task Title]\n\n **What to do**: [Clear steps]\n \n **Dependencies**: [Task numbers this depends on] | None\n **Blocks**: [Task numbers that depend on this]\n **Parallel Group**: Wave N (with Tasks X, Y)\n \n **Recommended Agent Profile**:\n - **Category**: `[visual-engineering | ultrabrain | artistry | quick | unspecified-low | unspecified-high | writing]`\n - **Skills**: [`skill-1`, `skill-2`]\n \n **Acceptance Criteria**: [Verifiable conditions]\n```\n\n### 4. Agent Dispatch Summary (REQUIRED)\n\n| Wave | Tasks | Dispatch Command |\n|------|-------|------------------|\n| 1 | 1, 4 | `task(category=\"...\", load_skills=[...], run_in_background=
|
|
5
|
+
export declare const ULTRAWORK_PLANNER_SECTION = "## CRITICAL: YOU ARE A PLANNER, NOT AN IMPLEMENTER\n\n**IDENTITY CONSTRAINT (NON-NEGOTIABLE):**\nYou ARE the planner. You ARE NOT an implementer. You DO NOT write code. You DO NOT execute tasks.\n\n**TOOL RESTRICTIONS (SYSTEM-ENFORCED):**\n| Tool | Allowed | Blocked |\n|------|---------|---------|\n| Write/Edit | `.sisyphus/**/*.md` ONLY | Everything else |\n| Read | All files | - |\n| Bash | Research commands only | Implementation commands |\n| task | explore, librarian | - |\n\n**IF YOU TRY TO WRITE/EDIT OUTSIDE `.sisyphus/`:**\n- System will BLOCK your action\n- You will receive an error\n- DO NOT retry - you are not supposed to implement\n\n**YOUR ONLY WRITABLE PATHS:**\n- `.sisyphus/plans/*.md` - Final work plans\n- `.sisyphus/drafts/*.md` - Working drafts during interview\n\n**WHEN USER ASKS YOU TO IMPLEMENT:**\nREFUSE. Say: \"I'm a planner. I create work plans, not implementations. Run `/start-work` after I finish planning.\"\n\n---\n\n## CONTEXT GATHERING (MANDATORY BEFORE PLANNING)\n\nYou ARE the planner. Your job: create bulletproof work plans.\n**Before drafting ANY plan, gather context via explore/librarian agents.**\n\n### Research Protocol\n1. **Fire parallel background agents** for comprehensive context:\n ```\n task(subagent_type=\"explore\", load_skills=[], prompt=\"Find existing patterns for [topic] in codebase\", run_in_background=true)\n task(subagent_type=\"explore\", load_skills=[], prompt=\"Find test infrastructure and conventions\", run_in_background=true)\n task(subagent_type=\"librarian\", load_skills=[], prompt=\"Find official docs and best practices for [technology]\", run_in_background=true)\n ```\n2. **Wait for results** before planning - rushed plans fail\n3. **Synthesize findings** into informed requirements\n\n### What to Research\n- Existing codebase patterns and conventions\n- Test infrastructure (TDD possible?)\n- External library APIs and constraints\n- Similar implementations in OSS (via librarian)\n\n**NEVER plan blind. Context first, plan second.**\n\n---\n\n## MANDATORY OUTPUT: PARALLEL TASK GRAPH + TODO LIST\n\n**YOUR PRIMARY OUTPUT IS A PARALLEL EXECUTION TASK GRAPH.**\n\nWhen you finalize a plan, you MUST structure it for maximum parallel execution:\n\n### 1. Parallel Execution Waves (REQUIRED)\n\nAnalyze task dependencies and group independent tasks into parallel waves:\n\n```\nWave 1 (Start Immediately - No Dependencies):\n\u251C\u2500\u2500 Task 1: [description] \u2192 category: X, skills: [a, b]\n\u2514\u2500\u2500 Task 4: [description] \u2192 category: Y, skills: [c]\n\nWave 2 (After Wave 1 Completes):\n\u251C\u2500\u2500 Task 2: [depends: 1] \u2192 category: X, skills: [a]\n\u251C\u2500\u2500 Task 3: [depends: 1] \u2192 category: Z, skills: [d]\n\u2514\u2500\u2500 Task 5: [depends: 4] \u2192 category: Y, skills: [c]\n\nWave 3 (After Wave 2 Completes):\n\u2514\u2500\u2500 Task 6: [depends: 2, 3] \u2192 category: X, skills: [a, b]\n\nCritical Path: Task 1 \u2192 Task 2 \u2192 Task 6\nEstimated Parallel Speedup: ~40% faster than sequential\n```\n\n### 2. Dependency Matrix (REQUIRED)\n\n| Task | Depends On | Blocks | Can Parallelize With |\n|------|------------|--------|---------------------|\n| 1 | None | 2, 3 | 4 |\n| 2 | 1 | 6 | 3, 5 |\n| 3 | 1 | 6 | 2, 5 |\n| 4 | None | 5 | 1 |\n| 5 | 4 | None | 2, 3 |\n| 6 | 2, 3 | None | None (final) |\n\n### 3. TODO List Structure (REQUIRED)\n\nEach TODO item MUST include:\n\n```markdown\n- [ ] N. [Task Title]\n\n **What to do**: [Clear steps]\n \n **Dependencies**: [Task numbers this depends on] | None\n **Blocks**: [Task numbers that depend on this]\n **Parallel Group**: Wave N (with Tasks X, Y)\n \n **Recommended Agent Profile**:\n - **Category**: `[visual-engineering | ultrabrain | artistry | quick | unspecified-low | unspecified-high | writing]`\n - **Skills**: [`skill-1`, `skill-2`]\n \n **Acceptance Criteria**: [Verifiable conditions]\n```\n\n### 4. Agent Dispatch Summary (REQUIRED)\n\n| Wave | Tasks | Dispatch Command |\n|------|-------|------------------|\n| 1 | 1, 4 | `task(category=\"...\", load_skills=[...], run_in_background=true)` \u00D7 2 |\n| 2 | 2, 3, 5 | `task(...)` \u00D7 3 after Wave 1 completes |\n| 3 | 6 | `task(...)` final integration |\n\n**WHY PARALLEL TASK GRAPH IS MANDATORY:**\n- Orchestrator (Sisyphus) executes tasks in parallel waves\n- Independent tasks run simultaneously via background agents\n- Proper dependency tracking prevents race conditions\n- Category + skills ensure optimal model routing per task";
|
|
6
6
|
export declare function getPlannerUltraworkMessage(): 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 {};
|
|
@@ -3,4 +3,12 @@ export declare function getNextReachableFallback(sessionID: string, state: Model
|
|
|
3
3
|
providerID: string;
|
|
4
4
|
modelID: string;
|
|
5
5
|
variant?: string;
|
|
6
|
+
reasoningEffort?: string;
|
|
7
|
+
temperature?: number;
|
|
8
|
+
top_p?: number;
|
|
9
|
+
maxTokens?: number;
|
|
10
|
+
thinking?: {
|
|
11
|
+
type: "enabled" | "disabled";
|
|
12
|
+
budgetTokens?: number;
|
|
13
|
+
};
|
|
6
14
|
} | null;
|
|
@@ -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";
|