oh-my-opencode-slim 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.ja-JP.md +13 -12
  2. package/README.ko-KR.md +13 -12
  3. package/README.md +29 -16
  4. package/README.zh-CN.md +13 -12
  5. package/dist/agents/index.d.ts +0 -4
  6. package/dist/cli/index.js +49 -6
  7. package/dist/config/constants.d.ts +10 -0
  8. package/dist/config/schema.d.ts +680 -2
  9. package/dist/config/strip-orchestrator-model.d.ts +9 -0
  10. package/dist/hooks/command-hook-utils.d.ts +5 -0
  11. package/dist/hooks/foreground-fallback/index.d.ts +40 -28
  12. package/dist/hooks/image-hook.d.ts +1 -0
  13. package/dist/hooks/index.d.ts +1 -1
  14. package/dist/index.js +1871 -326
  15. package/dist/interview/document.d.ts +2 -1
  16. package/dist/interview/ui.d.ts +0 -1
  17. package/dist/multiplexer/cmux/close-policy.d.ts +20 -0
  18. package/dist/multiplexer/cmux/index.d.ts +102 -0
  19. package/dist/multiplexer/cmux/session-lifecycle.d.ts +92 -0
  20. package/dist/multiplexer/cmux/session-state.d.ts +45 -0
  21. package/dist/multiplexer/factory.d.ts +0 -9
  22. package/dist/multiplexer/herdr/index.d.ts +2 -0
  23. package/dist/multiplexer/index.d.ts +3 -1
  24. package/dist/multiplexer/session-manager.d.ts +10 -2
  25. package/dist/multiplexer/shared.d.ts +8 -1
  26. package/dist/multiplexer/types.d.ts +5 -2
  27. package/dist/tools/smartfetch/utils.d.ts +3 -1
  28. package/dist/tui-state.d.ts +5 -5
  29. package/dist/tui.js +86 -20
  30. package/dist/utils/escape-html.d.ts +1 -0
  31. package/dist/utils/frontmatter.d.ts +6 -0
  32. package/dist/utils/index.d.ts +1 -1
  33. package/dist/utils/logger.d.ts +0 -2
  34. package/oh-my-opencode-slim.schema.json +717 -2
  35. package/package.json +1 -1
  36. package/src/skills/clonedeps/SKILL.md +32 -29
  37. package/src/skills/codemap.md +7 -3
  38. package/src/skills/deepwork/SKILL.md +17 -6
  39. package/src/skills/verification-planning/SKILL.md +103 -0
  40. package/src/skills/worktrees/SKILL.md +14 -7
@@ -0,0 +1,9 @@
1
+ import type { PluginConfig, Preset } from './schema';
2
+ export declare function stripOrchestratorModel(agents: Record<string, unknown>, enabled: boolean | undefined, preset: Preset | undefined): void;
3
+ export declare function applyOrchestratorModelConfig(input: {
4
+ agents: Record<string, unknown>;
5
+ enabled: boolean | undefined;
6
+ presets: PluginConfig['presets'];
7
+ configPreset: string | undefined;
8
+ runtimePreset: string | null;
9
+ }): void;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Register a command hook in the OpenCode config if it doesn't already exist.
3
+ * Returns true if the command was registered, false if it already existed.
4
+ */
5
+ export declare function registerCommandHook(opencodeConfig: Record<string, unknown>, commandName: string, template: string, description: string): boolean;
@@ -2,9 +2,12 @@
2
2
  * Runtime model fallback for foreground (interactive) agent sessions.
3
3
  *
4
4
  * When OpenCode fires a session.error, message.updated, or session.status
5
- * event containing a rate-limit signal, this manager:
5
+ * event containing a transient error (rate-limit, 403/Forbidden, etc.), this
6
+ * manager:
6
7
  * 1. Looks up the next untried model in the agent's configured chain
7
- * 2. Aborts the rate-limited prompt via client.session.abort()
8
+ * 2. Aborts the rate-limited prompt via client.session.abort() on the
9
+ * session.status retry path; session.error and message.updated paths
10
+ * re-prompt directly without abort.
8
11
  * 3. Re-queues the last user message via client.session.promptAsync()
9
12
  * with the new model - promptAsync returns immediately so we never
10
13
  * block the event handler waiting for a full LLM response.
@@ -16,6 +19,13 @@
16
19
  import type { PluginInput } from '@opencode-ai/plugin';
17
20
  import type { SessionLifecycle } from '../session-lifecycle';
18
21
  type OpencodeClient = PluginInput['client'];
22
+ export declare function isFailoverError(error: unknown): boolean;
23
+ /**
24
+ * Checks whether an error is a transient/retryable error (rate-limit,
25
+ * 403/Forbidden, etc.) that should trigger model fallback.
26
+ */
27
+ export declare function isRetryableError(error: unknown): boolean;
28
+ /** @deprecated Use isRetryableError instead. */
19
29
  export declare function isRateLimitError(error: unknown): boolean;
20
30
  /**
21
31
  * Manages runtime model fallback for foreground agent sessions.
@@ -30,17 +40,10 @@ export declare class ForegroundFallbackManager {
30
40
  * e.g. { orchestrator: ['anthropic/claude-opus-4-5', 'openai/gpt-4o'] }
31
41
  * The first model that hasn't been tried yet is selected on each fallback.
32
42
  */
33
- private readonly chains;
43
+ private chains;
34
44
  private readonly enabled;
35
45
  /** Consecutive 429s tolerated on the same model before swap/abort. */
36
46
  private readonly maxRetries;
37
- /**
38
- * When true (default), a runtime model outside the configured chain
39
- * still triggers fallback on rate-limit errors. When false, out-of-chain
40
- * runtime picks are respected and the error surfaces instead. Models
41
- * that are members of the chain always fall back regardless.
42
- */
43
- private readonly runtimeOverride;
44
47
  /** sessionID → last observed model string ("providerID/modelID") */
45
48
  private readonly sessionModel;
46
49
  /** sessionID → agent name (populated from message.updated info.agent field) */
@@ -61,6 +64,13 @@ export declare class ForegroundFallbackManager {
61
64
  /** Exposed for task-session-manager: prevents idle reconciliation
62
65
  * while a fallback abort/re-prompt is in flight for this session. */
63
66
  isFallbackInProgress(sessionID: string): boolean;
67
+ /**
68
+ * Disable the fallback chain for a specific agent.
69
+ * After calling this, rate-limit errors for that agent surface instead of
70
+ * silently falling back through the chain.
71
+ */
72
+ disableChain(agentName: string): void;
73
+ registerSessionAgent(sessionID: string, agentName: string): void;
64
74
  constructor(client: OpencodeClient,
65
75
  /**
66
76
  * Ordered fallback chains per agent.
@@ -69,37 +79,39 @@ export declare class ForegroundFallbackManager {
69
79
  */
70
80
  chains: Record<string, string[]>, enabled: boolean,
71
81
  /** Consecutive 429s tolerated on the same model before swap/abort. */
72
- maxRetries?: number, coordinator?: SessionLifecycle,
73
- /**
74
- * When true (default), a runtime model outside the configured chain
75
- * still triggers fallback on rate-limit errors. When false, out-of-chain
76
- * runtime picks are respected and the error surfaces instead. Models
77
- * that are members of the chain always fall back regardless.
78
- */
79
- runtimeOverride?: boolean);
82
+ maxRetries?: number, coordinator?: SessionLifecycle);
80
83
  /**
81
84
  * Process an OpenCode plugin event.
82
85
  * Call this from the plugin's `event` hook for every event received.
83
86
  */
84
87
  handleEvent(rawEvent: unknown): Promise<void>;
85
88
  /** Increment retry counter and return true when the budget is exhausted.
86
- * Used by the session.status retry path — each retry counts toward the
89
+ * Used by shouldIntervene when tried > 0 — each retry counts toward the
87
90
  * budget and only triggers fallback after maxRetries - 1 absorptions.
88
- * Non-retry paths (session.error / message.updated) use shouldIntervene(),
89
- * which bypasses the counter on first occurrence. */
90
- private checkRetryBudget;
91
- /** For non-retry paths (session.error, message.updated): intervene immediately
92
- * unless the session is already in a retry window (has prior retries). */
93
- private shouldIntervene;
91
+ * First failover retry (tried === 0) bypasses the counter via shouldIntervene. */
92
+ private consumeRetryBudget;
93
+ /** Intervene immediately on first occurrence (tried === 0), otherwise
94
+ * delegate to retry budget. Used by all three event paths. */
95
+ private shouldTriggerFallback;
96
+ private isRecoveredStatus;
94
97
  private tryFallback;
98
+ /**
99
+ * Fallback path for session.status retry events. Aborts the retry loop
100
+ * before falling back because promptAsync alone is ignored while the
101
+ * session is in retry mode. inProgress is set first so the
102
+ * task-session-manager sees isFallbackInProgress()=true during the
103
+ * abort idle window and does not cancel the pending task call.
104
+ */
105
+ private tryFallbackWithAbort;
106
+ private isDeduped;
107
+ private execFallback;
95
108
  /**
96
109
  * Determine the fallback chain to use for a session.
97
110
  *
98
111
  * Priority:
99
112
  * 1. Agent name known AND has a configured chain → return it directly
100
- * 2. Agent name known but NO chain configured → return [] (no fallback;
101
- * do NOT bleed into other agents' chains which would re-prompt the
102
- * session with a model belonging to a completely different agent)
113
+ * 2. Agent name known but NO chain → return [] (no fallback; never
114
+ * bleed into other agents' chains)
103
115
  * 3. Agent name unknown, current model known → search all chains for
104
116
  * the model to infer which chain to use
105
117
  * 4. Nothing matches → flatten all chains as a last resort (only
@@ -2,6 +2,7 @@ import { type MessageWithParts } from './types';
2
2
  export declare function processImageAttachments(args: {
3
3
  messages: MessageWithParts[];
4
4
  workDir: string;
5
+ imageRouting: 'auto' | 'direct';
5
6
  disabledAgents: Set<string>;
6
7
  log: (msg: string) => void;
7
8
  }): void;
@@ -5,7 +5,7 @@ export { createChatHeadersHook } from './chat-headers';
5
5
  export { createDeepworkCommandHook } from './deepwork';
6
6
  export { createDelegateTaskRetryHook } from './delegate-task-retry/hook';
7
7
  export { createFilterAvailableSkillsHook } from './filter-available-skills';
8
- export { ForegroundFallbackManager, isRateLimitError, } from './foreground-fallback';
8
+ export { ForegroundFallbackManager, isFailoverError, isRetryableError, } from './foreground-fallback';
9
9
  export { processImageAttachments } from './image-hook';
10
10
  export { createJsonErrorRecoveryHook } from './json-error-recovery/hook';
11
11
  export { createLoopCommandHook } from './loop-command';