oh-my-opencode 3.17.5 → 3.17.7

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 (56) hide show
  1. package/README.ja.md +1 -1
  2. package/README.ko.md +1 -1
  3. package/README.md +1 -1
  4. package/README.ru.md +1 -1
  5. package/README.zh-cn.md +1 -1
  6. package/dist/agents/agent-builder.d.ts +2 -3
  7. package/dist/agents/agent-skill-resolution.d.ts +7 -0
  8. package/dist/agents/frontier-tool-schema-guard.d.ts +3 -0
  9. package/dist/agents/hephaestus/agent.d.ts +1 -1
  10. package/dist/agents/hephaestus/gpt-5-5.d.ts +12 -0
  11. package/dist/agents/sisyphus/claude-opus-4-7.d.ts +20 -0
  12. package/dist/agents/sisyphus/gpt-5-5.d.ts +20 -0
  13. package/dist/agents/sisyphus/index.d.ts +5 -0
  14. package/dist/agents/sisyphus/kimi-k2-6.d.ts +32 -0
  15. package/dist/agents/sisyphus-junior/agent.d.ts +1 -1
  16. package/dist/agents/sisyphus-junior/gpt-5-5.d.ts +14 -0
  17. package/dist/agents/sisyphus-junior/index.d.ts +2 -0
  18. package/dist/agents/sisyphus-junior/kimi-k2-6.d.ts +13 -0
  19. package/dist/agents/types.d.ts +17 -1
  20. package/dist/cli/doctor/checks/model-resolution.d.ts +4 -0
  21. package/dist/cli/index.js +141 -86
  22. package/dist/features/background-agent/attempt-lifecycle.d.ts +12 -0
  23. package/dist/features/background-agent/background-task-notification-template.d.ts +2 -1
  24. package/dist/features/background-agent/constants.d.ts +1 -0
  25. package/dist/features/background-agent/fallback-retry-handler.d.ts +8 -0
  26. package/dist/features/background-agent/manager.d.ts +9 -0
  27. package/dist/features/background-agent/types.d.ts +24 -0
  28. package/dist/hooks/model-fallback/controller-accessor.d.ts +1 -0
  29. package/dist/hooks/model-fallback/fallback-state-controller.d.ts +1 -0
  30. package/dist/hooks/model-fallback/hook.d.ts +2 -1
  31. package/dist/hooks/preemptive-compaction-degradation-monitor.d.ts +1 -0
  32. package/dist/hooks/preemptive-compaction-no-text-tail.d.ts +1 -0
  33. package/dist/hooks/ralph-loop/ralph-loop-event-handler.d.ts +1 -6
  34. package/dist/hooks/ralph-loop/session-event-handler.d.ts +2 -6
  35. package/dist/hooks/ralph-loop/types.d.ts +5 -0
  36. package/dist/index.js +3533 -667
  37. package/dist/plugin/event.d.ts +1 -0
  38. package/dist/plugin/hooks/create-core-hooks.d.ts +2 -0
  39. package/dist/plugin/hooks/create-session-hooks.d.ts +2 -0
  40. package/dist/shared/agent-display-names.d.ts +7 -2
  41. package/dist/shared/agent-sort-shim.d.ts +28 -0
  42. package/dist/shared/dynamic-truncator.d.ts +9 -10
  43. package/dist/shared/file-reference-resolver.d.ts +1 -0
  44. package/dist/shared/model-error-classifier.d.ts +2 -2
  45. package/dist/shared/posthog-activity-state.d.ts +5 -2
  46. package/dist/shared/posthog.d.ts +5 -0
  47. package/dist/tools/background-task/clients.d.ts +1 -0
  48. package/dist/tools/delegate-task/builtin-categories.d.ts +1 -0
  49. package/dist/tools/delegate-task/builtin-category-definition.d.ts +1 -0
  50. package/dist/tools/delegate-task/constants.d.ts +1 -1
  51. package/dist/tools/delegate-task/executor-types.d.ts +1 -0
  52. package/dist/tools/delegate-task/openai-categories.d.ts +3 -0
  53. package/dist/tools/delegate-task/sync-task-fallback.d.ts +3 -0
  54. package/dist/tools/slashcommand/command-discovery-deps.d.ts +6 -0
  55. package/package.json +12 -12
  56. package/dist/hooks/ralph-loop/loop-session-recovery.d.ts +0 -7
@@ -10,6 +10,7 @@ type FirstMessageVariantGate = {
10
10
  } | undefined) => void;
11
11
  clear: (sessionID: string) => void;
12
12
  };
13
+ export declare function extractErrorMessage(error: unknown): string;
13
14
  type EventInput = Parameters<NonNullable<NonNullable<CreatedHooks["writeExistingFileGuard"]>["event"]>>[0];
14
15
  export declare function createEventHandler(args: {
15
16
  ctx: PluginContext;
@@ -1,4 +1,5 @@
1
1
  import type { HookName, OhMyOpenCodeConfig } from "../../config";
2
+ import type { BackgroundManager } from "../../features/background-agent";
2
3
  import type { ModelFallbackControllerAccessor } from "../../hooks/model-fallback";
3
4
  import type { PluginContext } from "../types";
4
5
  import type { ModelCacheState } from "../../plugin-state";
@@ -6,6 +7,7 @@ export declare function createCoreHooks(args: {
6
7
  ctx: PluginContext;
7
8
  pluginConfig: OhMyOpenCodeConfig;
8
9
  modelCacheState: ModelCacheState;
10
+ backgroundManager: BackgroundManager;
9
11
  modelFallbackControllerAccessor?: ModelFallbackControllerAccessor;
10
12
  isHookEnabled: (hookName: HookName) => boolean;
11
13
  safeHookEnabled: boolean;
@@ -1,4 +1,5 @@
1
1
  import type { OhMyOpenCodeConfig, HookName } from "../../config";
2
+ import type { BackgroundManager } from "../../features/background-agent";
2
3
  import type { ModelFallbackControllerAccessor } from "../../hooks/model-fallback";
3
4
  import type { ModelCacheState } from "../../plugin-state";
4
5
  import type { PluginContext } from "../types";
@@ -34,6 +35,7 @@ export declare function createSessionHooks(args: {
34
35
  ctx: PluginContext;
35
36
  pluginConfig: OhMyOpenCodeConfig;
36
37
  modelCacheState: ModelCacheState;
38
+ backgroundManager: BackgroundManager;
37
39
  modelFallbackControllerAccessor?: ModelFallbackControllerAccessor;
38
40
  isHookEnabled: (hookName: HookName) => boolean;
39
41
  safeHookEnabled: boolean;
@@ -12,7 +12,6 @@
12
12
  export declare const AGENT_DISPLAY_NAMES: Record<string, string>;
13
13
  export declare function stripInvisibleAgentCharacters(agentName: string): string;
14
14
  export declare function stripAgentListSortPrefix(agentName: string): string;
15
- export declare function getAgentRuntimeName(configKey: string): string;
16
15
  /**
17
16
  * Get display name for an agent config key.
18
17
  * Uses case-insensitive lookup for backward compatibility.
@@ -20,7 +19,13 @@ export declare function getAgentRuntimeName(configKey: string): string;
20
19
  */
21
20
  export declare function getAgentDisplayName(configKey: string): string;
22
21
  /**
23
- * Runtime-facing agent name used for OpenCode list ordering.
22
+ * Thin alias for `getAgentDisplayName` preserved for external imports.
23
+ *
24
+ * Earlier versions injected zero-width prefixes here to bias OpenCode's
25
+ * `agent.name` sort. Sort ordering is now enforced by
26
+ * `src/shared/agent-sort-shim.ts`, so this function emits the canonical
27
+ * display name verbatim. Kept exported because downstream modules still
28
+ * import this symbol; do not collapse the call sites without coordinating.
24
29
  */
25
30
  export declare function getAgentListDisplayName(configKey: string): string;
26
31
  /**
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Agent sort shim.
3
+ *
4
+ * OpenCode 1.4.x ignores the agent `order` field (sst/opencode#19127) and
5
+ * sorts the agent list by `agent.name` via Remeda `sortBy(x => x.name, "asc")`
6
+ * at packages/opencode/src/agent/agent.ts. Without intervention, the four
7
+ * core agents collapse into Atlas -> Hephaestus -> Prometheus -> Sisyphus,
8
+ * which inverts the canonical sisyphus -> hephaestus -> prometheus -> atlas
9
+ * order this project ships.
10
+ *
11
+ * Earlier attempts to bias the sort key with invisible characters (ZWSP,
12
+ * U+2060 WORD JOINER, U+00AD SOFT HYPHEN, ANSI escape) caused visible-gap
13
+ * and column-truncation regressions in the TUI status bar (#3259, #3238).
14
+ *
15
+ * This shim is the narrowly-scoped alternative from PR #3267 with the Cubic
16
+ * P1 mitigations applied:
17
+ * 1. `isAgentArray` rejects any array element that is null, non-object, or
18
+ * lacks a string `name`, eliminating the throw-on-mixed-array failure
19
+ * mode that closed the original PR.
20
+ * 2. The activation predicate requires >= 2 elements whose `.name` is one
21
+ * of the four canonical core display names, so unrelated `.sort()` and
22
+ * `.toSorted()` calls (string arrays, number arrays, generic objects)
23
+ * execute native behavior unchanged.
24
+ *
25
+ * Remove this shim once OpenCode honors the agent `order` field
26
+ * (sst/opencode#19127).
27
+ */
28
+ export declare function installAgentSortShim(): void;
@@ -1,5 +1,11 @@
1
1
  import type { PluginInput } from "@opencode-ai/plugin";
2
2
  import { type ContextLimitModelCacheState } from "./context-limit-resolver";
3
+ type ContextWindowUsage = {
4
+ usedTokens: number;
5
+ remainingTokens: number;
6
+ usagePercentage: number;
7
+ };
8
+ export declare function invalidateContextWindowUsageCache(ctx: PluginInput, sessionID?: string): void;
3
9
  export interface TruncationResult {
4
10
  result: string;
5
11
  truncated: boolean;
@@ -11,18 +17,11 @@ export interface TruncationOptions {
11
17
  contextWindowLimit?: number;
12
18
  }
13
19
  export declare function truncateToTokenLimit(output: string, maxTokens: number, preserveHeaderLines?: number): TruncationResult;
14
- export declare function getContextWindowUsage(ctx: PluginInput, sessionID: string, modelCacheState?: ContextLimitModelCacheState): Promise<{
15
- usedTokens: number;
16
- remainingTokens: number;
17
- usagePercentage: number;
18
- } | null>;
20
+ export declare function getContextWindowUsage(ctx: PluginInput, sessionID: string, modelCacheState?: ContextLimitModelCacheState): Promise<ContextWindowUsage | null>;
19
21
  export declare function dynamicTruncate(ctx: PluginInput, sessionID: string, output: string, options?: TruncationOptions, modelCacheState?: ContextLimitModelCacheState): Promise<TruncationResult>;
20
22
  export declare function createDynamicTruncator(ctx: PluginInput, modelCacheState?: ContextLimitModelCacheState): {
21
23
  truncate: (sessionID: string, output: string, options?: TruncationOptions) => Promise<TruncationResult>;
22
- getUsage: (sessionID: string) => Promise<{
23
- usedTokens: number;
24
- remainingTokens: number;
25
- usagePercentage: number;
26
- } | null>;
24
+ getUsage: (sessionID: string) => Promise<ContextWindowUsage | null>;
27
25
  truncateSync: (output: string, maxTokens: number, preserveHeaderLines?: number) => TruncationResult;
28
26
  };
27
+ export {};
@@ -1 +1,2 @@
1
+ export declare function resolveFilePath(filePath: string, cwd: string): string;
1
2
  export declare function resolveFileReferencesInText(text: string, cwd?: string, depth?: number, maxDepth?: number): Promise<string>;
@@ -5,12 +5,12 @@ export interface ErrorInfo {
5
5
  }
6
6
  /**
7
7
  * Determines if an error is a retryable model error.
8
- * Returns true if the error is a known retryable type OR matches retryable message patterns.
8
+ * Returns true if it's a known retryable type OR matches retryable message patterns.
9
9
  */
10
10
  export declare function isRetryableModelError(error: ErrorInfo): boolean;
11
11
  /**
12
12
  * Determines if an error should trigger a fallback retry.
13
- * Returns true for deadstop errors that completely halt the action loop.
13
+ * Returns true for errors that halt execution.
14
14
  */
15
15
  export declare function shouldRetryError(error: ErrorInfo): boolean;
16
16
  /**
@@ -1,8 +1,11 @@
1
1
  type PostHogActivityCaptureState = {
2
2
  dayUTC: string;
3
- hourUTC: string;
4
3
  captureDaily: boolean;
5
- captureHourly: boolean;
4
+ };
5
+ type PluginLoadedCaptureState = {
6
+ dayUTC: string;
7
+ capturePluginLoaded: boolean;
6
8
  };
7
9
  export declare function getPostHogActivityCaptureState(now?: Date): PostHogActivityCaptureState;
10
+ export declare function getPluginLoadedCaptureState(now?: Date): PluginLoadedCaptureState;
8
11
  export {};
@@ -1,4 +1,9 @@
1
1
  import { PostHog } from "posthog-node";
2
+ import { getPostHogActivityCaptureState } from "./posthog-activity-state";
3
+ /** @internal test-only */
4
+ export declare function __setActivityStateProviderForTesting(provider: typeof getPostHogActivityCaptureState): void;
5
+ /** @internal test-only */
6
+ export declare function __resetActivityStateProviderForTesting(): void;
2
7
  type PostHogCaptureEvent = Parameters<PostHog["capture"]>[0];
3
8
  type PostHogExceptionProperties = Parameters<PostHog["captureException"]>[2];
4
9
  type PostHogActivityReason = "run_started" | "plugin_loaded";
@@ -7,6 +7,7 @@ export type BackgroundOutputMessage = {
7
7
  created?: number;
8
8
  };
9
9
  agent?: string;
10
+ error?: unknown;
10
11
  };
11
12
  parts?: Array<{
12
13
  type?: string;
@@ -2,3 +2,4 @@ import type { CategoryConfig } from "../../config/schema";
2
2
  export declare const DEFAULT_CATEGORIES: Record<string, CategoryConfig>;
3
3
  export declare const CATEGORY_PROMPT_APPENDS: Record<string, string>;
4
4
  export declare const CATEGORY_DESCRIPTIONS: Record<string, string>;
5
+ export declare const CATEGORY_PROMPT_APPEND_RESOLVERS: Record<string, (model: string | undefined) => string>;
@@ -4,4 +4,5 @@ export type BuiltinCategoryDefinition = {
4
4
  config: CategoryConfig;
5
5
  description: string;
6
6
  promptAppend: string;
7
+ resolvePromptAppend?: (model: string | undefined) => string;
7
8
  };
@@ -1,5 +1,5 @@
1
1
  import type { AvailableCategory, AvailableSkill } from "../../agents/dynamic-agent-prompt-builder";
2
- export { CATEGORY_DESCRIPTIONS, CATEGORY_PROMPT_APPENDS, DEFAULT_CATEGORIES, } from "./builtin-categories";
2
+ export { CATEGORY_DESCRIPTIONS, CATEGORY_PROMPT_APPENDS, CATEGORY_PROMPT_APPEND_RESOLVERS, DEFAULT_CATEGORIES, } from "./builtin-categories";
3
3
  /**
4
4
  * System prompt prepended to plan agent invocations.
5
5
  * Instructs the plan agent to first gather context via explore/librarian agents,
@@ -38,6 +38,7 @@ export interface SessionMessage {
38
38
  created?: number;
39
39
  };
40
40
  finish?: string;
41
+ error?: unknown;
41
42
  agent?: string;
42
43
  model?: {
43
44
  providerID: string;
@@ -1,2 +1,5 @@
1
1
  import type { BuiltinCategoryDefinition } from "./builtin-category-definition";
2
+ export declare const DEEP_CATEGORY_PROMPT_APPEND = "<Category_Context>\nYou are working on GOAL-ORIENTED AUTONOMOUS tasks.\n\nYou are NOT an interactive assistant. You are an autonomous problem-solver.\n\nBEFORE making ANY changes:\n1. Silently explore the codebase extensively (5-15 minutes of reading is normal)\n2. Read related files, trace dependencies, understand the full context\n3. Build a complete mental model of the problem space\n4. Do not ask clarifying questions - the goal is already defined\n\nYou receive a GOAL. When the goal includes numbered steps or phases, treat them as one atomic task broken into sub-steps, not as separate independent tasks. Figure out HOW to achieve it yourself. Thorough research before any action.\n\nSub-steps of ONE goal = execute all steps as phases of one atomic task.\nGenuinely independent tasks = flag and refuse, require separate delegations.\n\nApproach: explore extensively, understand deeply, then act decisively. Prefer comprehensive solutions over quick patches. If the goal is unclear, make reasonable assumptions and proceed.\n\nMinimal status updates. Focus on results, not play-by-play. Report completion with summary of changes.\n</Category_Context>";
3
+ export declare const DEEP_CATEGORY_PROMPT_APPEND_GPT_5_5 = "<Category_Context name=\"deep\">\nYou are operating in DEEP mode. This is the category reserved for goal-oriented autonomous work on hairy problems that reward thorough exploration and comprehensive solutions.\n\nThe orchestrator chose this category because the task benefits from depth over speed. You should feel empowered to spend the time needed: five to fifteen minutes of silent exploration before the first edit is normal and correct. Rushing to implementation on a deep task is a failure mode, not a feature.\n\n# How deep mode adjusts the base behavior\n\n**Exploration budget: generous.** Read the files you need, trace dependencies both directions, fire 2-5 explore/librarian sub-agents in parallel for broader questions. Build a complete mental model before the first `apply_patch`. Exploration here is an investment, not overhead.\n\n**Goal, not plan.** You receive a GOAL describing the desired outcome. You figure out HOW to achieve it. The orchestrator deliberately did not hand you a step-by-step plan; producing one and asking for approval is not what was asked. Execute.\n\n**Atomic task treatment.** When the goal contains numbered steps or phases, treat them as sub-steps of ONE task and execute them all in this turn. Splitting them across turns is wrong unless they reveal an architectural blocker that requires the user's input. If the \"steps\" turn out to be genuinely independent tasks that should have been separate delegations, flag that in your final message and refuse the ones beyond scope.\n\n**Root cause bias.** Prefer root-cause fixes over symptom fixes. A null check around `foo()` is a symptom fix; fixing whatever causes `foo()` to return unexpected values is the root fix. Trace at least two levels up before settling on an answer. In deep mode, you have permission (and the expectation) to do the deeper fix.\n\n**Ambition scaled to context.** For brand-new greenfield work, be ambitious. Choose strong defaults, avoid AI-slop aesthetics, produce something you would be proud to hand to another senior engineer. For changes in an existing codebase, be surgical and respect the existing patterns; depth does not mean invasiveness.\n\n**Completion bar: full delivery.** \"Simplified version\", \"proof of concept\", and \"you can extend this later\" are not acceptable deliveries for a deep task. The orchestrator routed here specifically for a complete solution. If you hit a genuine blocker (missing secret, design decision only the user can make, three materially different attempts all failed), document it and return; otherwise, finish the task.\n\n**Status cadence: sparse.** The user is not on the other side of this conversation; the orchestrator is, and they will synthesize your progress. Send commentary only at meaningful phase transitions (starting exploration, starting implementation, starting verification, hitting a genuine blocker). Do not narrate every tool call; silence during focused work is expected.\n</Category_Context>";
4
+ export declare function resolveDeepCategoryPromptAppend(model: string | undefined): string;
2
5
  export declare const OPENAI_CATEGORIES: BuiltinCategoryDefinition[];
@@ -1,5 +1,6 @@
1
1
  import type { FallbackEntry } from "../../shared/model-requirements";
2
2
  import type { DelegatedModelConfig } from "./types";
3
+ import type { ModelFallbackState } from "../../hooks/model-fallback/hook";
3
4
  export declare function retrySyncPromptWithFallbacks(input: {
4
5
  sessionID: string;
5
6
  initialError: string;
@@ -9,4 +10,6 @@ export declare function retrySyncPromptWithFallbacks(input: {
9
10
  }): Promise<{
10
11
  promptError: string | null;
11
12
  categoryModel: DelegatedModelConfig | undefined;
13
+ fallbackState?: ModelFallbackState;
12
14
  }>;
15
+ export declare function getNextSyncFallbackModel(sessionID: string, fallbackState: ModelFallbackState | undefined): DelegatedModelConfig | null;
@@ -0,0 +1,6 @@
1
+ export { EXCLUDED_DIRS } from "../../shared/excluded-dirs";
2
+ export { parseFrontmatter } from "../../shared/frontmatter";
3
+ export { sanitizeModelField } from "../../shared/model-sanitizer";
4
+ export { getOpenCodeCommandDirs } from "../../shared/opencode-command-dirs";
5
+ export { discoverPluginCommandDefinitions } from "../../shared/plugin-command-discovery";
6
+ export { findProjectOpencodeCommandDirs } from "../../shared/project-discovery-dirs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oh-my-opencode",
3
- "version": "3.17.5",
3
+ "version": "3.17.7",
4
4
  "description": "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
5
5
  "main": "./dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -80,17 +80,17 @@
80
80
  "zod": "^4.3.0"
81
81
  },
82
82
  "optionalDependencies": {
83
- "oh-my-opencode-darwin-arm64": "3.17.5",
84
- "oh-my-opencode-darwin-x64": "3.17.5",
85
- "oh-my-opencode-darwin-x64-baseline": "3.17.5",
86
- "oh-my-opencode-linux-arm64": "3.17.5",
87
- "oh-my-opencode-linux-arm64-musl": "3.17.5",
88
- "oh-my-opencode-linux-x64": "3.17.5",
89
- "oh-my-opencode-linux-x64-baseline": "3.17.5",
90
- "oh-my-opencode-linux-x64-musl": "3.17.5",
91
- "oh-my-opencode-linux-x64-musl-baseline": "3.17.5",
92
- "oh-my-opencode-windows-x64": "3.17.5",
93
- "oh-my-opencode-windows-x64-baseline": "3.17.5"
83
+ "oh-my-opencode-darwin-arm64": "3.17.7",
84
+ "oh-my-opencode-darwin-x64": "3.17.7",
85
+ "oh-my-opencode-darwin-x64-baseline": "3.17.7",
86
+ "oh-my-opencode-linux-arm64": "3.17.7",
87
+ "oh-my-opencode-linux-arm64-musl": "3.17.7",
88
+ "oh-my-opencode-linux-x64": "3.17.7",
89
+ "oh-my-opencode-linux-x64-baseline": "3.17.7",
90
+ "oh-my-opencode-linux-x64-musl": "3.17.7",
91
+ "oh-my-opencode-linux-x64-musl-baseline": "3.17.7",
92
+ "oh-my-opencode-windows-x64": "3.17.7",
93
+ "oh-my-opencode-windows-x64-baseline": "3.17.7"
94
94
  },
95
95
  "overrides": {},
96
96
  "trustedDependencies": [
@@ -1,7 +0,0 @@
1
- export declare function createLoopSessionRecovery(options?: {
2
- recoveryWindowMs?: number;
3
- }): {
4
- isRecovering(sessionID: string): boolean;
5
- markRecovering(sessionID: string): void;
6
- clear(sessionID: string): void;
7
- };