oh-my-opencode 3.0.0-beta.7 → 3.0.0-beta.9

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 (71) hide show
  1. package/README.ja.md +6 -13
  2. package/README.md +20 -25
  3. package/README.zh-cn.md +18 -20
  4. package/bin/oh-my-opencode.js +80 -0
  5. package/bin/platform.js +38 -0
  6. package/bin/platform.test.ts +148 -0
  7. package/dist/agents/orchestrator-sisyphus.d.ts +2 -2
  8. package/dist/agents/prometheus-prompt.d.ts +1 -1
  9. package/dist/agents/sisyphus-junior.d.ts +1 -1
  10. package/dist/agents/utils.d.ts +3 -3
  11. package/dist/cli/config-manager.d.ts +9 -1
  12. package/dist/cli/doctor/checks/opencode.d.ts +5 -1
  13. package/dist/cli/index.js +292 -156
  14. package/dist/config/schema.d.ts +205 -211
  15. package/dist/features/background-agent/concurrency.d.ts +17 -0
  16. package/dist/features/background-agent/manager.d.ts +29 -5
  17. package/dist/features/background-agent/types.d.ts +3 -1
  18. package/dist/features/builtin-commands/templates/init-deep.d.ts +1 -1
  19. package/dist/features/builtin-commands/templates/refactor.d.ts +1 -1
  20. package/dist/features/claude-code-session-state/state.d.ts +2 -1
  21. package/dist/features/context-injector/index.d.ts +1 -1
  22. package/dist/features/hook-message-injector/index.d.ts +1 -1
  23. package/dist/features/opencode-skill-loader/skill-content.d.ts +11 -0
  24. package/dist/features/skill-mcp-manager/manager.d.ts +10 -0
  25. package/dist/features/task-toast-manager/index.d.ts +1 -1
  26. package/dist/features/task-toast-manager/manager.d.ts +2 -1
  27. package/dist/features/task-toast-manager/types.d.ts +5 -0
  28. package/dist/hooks/agent-usage-reminder/constants.d.ts +1 -1
  29. package/dist/hooks/anthropic-context-window-limit-recovery/executor.d.ts +1 -1
  30. package/dist/hooks/anthropic-context-window-limit-recovery/index.d.ts +1 -2
  31. package/dist/hooks/anthropic-context-window-limit-recovery/types.d.ts +0 -5
  32. package/dist/hooks/comment-checker/cli.d.ts +0 -1
  33. package/dist/hooks/comment-checker/cli.test.d.ts +1 -0
  34. package/dist/hooks/compaction-context-injector/index.d.ts +7 -1
  35. package/dist/hooks/delegate-task-retry/index.d.ts +24 -0
  36. package/dist/hooks/delegate-task-retry/index.test.d.ts +1 -0
  37. package/dist/hooks/index.d.ts +1 -2
  38. package/dist/hooks/prometheus-md-only/constants.d.ts +1 -1
  39. package/dist/index.js +3688 -2120
  40. package/dist/shared/agent-tool-restrictions.d.ts +7 -0
  41. package/dist/shared/index.d.ts +4 -0
  42. package/dist/shared/opencode-version.d.ts +6 -3
  43. package/dist/shared/permission-compat.d.ts +22 -9
  44. package/dist/shared/session-cursor.d.ts +13 -0
  45. package/dist/shared/session-cursor.test.d.ts +1 -0
  46. package/dist/shared/shell-env.d.ts +41 -0
  47. package/dist/shared/shell-env.test.d.ts +1 -0
  48. package/dist/shared/system-directive.d.ts +31 -0
  49. package/dist/tools/{sisyphus-task → delegate-task}/constants.d.ts +1 -1
  50. package/dist/tools/{sisyphus-task → delegate-task}/index.d.ts +1 -1
  51. package/dist/tools/{sisyphus-task → delegate-task}/tools.d.ts +2 -2
  52. package/dist/tools/delegate-task/tools.test.d.ts +1 -0
  53. package/dist/tools/{sisyphus-task → delegate-task}/types.d.ts +2 -2
  54. package/dist/tools/index.d.ts +1 -1
  55. package/dist/tools/interactive-bash/constants.d.ts +1 -1
  56. package/dist/tools/look-at/tools.d.ts +7 -0
  57. package/dist/tools/look-at/tools.test.d.ts +1 -0
  58. package/dist/tools/lsp/client.d.ts +0 -3
  59. package/dist/tools/lsp/config.test.d.ts +1 -0
  60. package/dist/tools/lsp/index.d.ts +1 -1
  61. package/dist/tools/lsp/tools.d.ts +0 -1
  62. package/dist/tools/lsp/types.d.ts +0 -33
  63. package/dist/tools/lsp/utils.d.ts +1 -4
  64. package/dist/tools/skill/types.d.ts +3 -0
  65. package/package.json +18 -3
  66. package/postinstall.mjs +43 -0
  67. package/dist/hooks/empty-message-sanitizer/index.d.ts +0 -12
  68. package/dist/hooks/preemptive-compaction/constants.d.ts +0 -3
  69. package/dist/hooks/preemptive-compaction/index.d.ts +0 -24
  70. package/dist/hooks/preemptive-compaction/types.d.ts +0 -17
  71. /package/dist/{tools/sisyphus-task/tools.test.d.ts → features/claude-code-session-state/state.test.d.ts} +0 -0
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Agent tool restrictions for session.prompt calls.
3
+ * OpenCode SDK's session.prompt `tools` parameter expects boolean values.
4
+ * true = tool allowed, false = tool denied.
5
+ */
6
+ export declare function getAgentToolRestrictions(agentName: string): Record<string, boolean>;
7
+ export declare function hasAgentToolRestrictions(agentName: string): boolean;
@@ -22,3 +22,7 @@ export * from "./permission-compat";
22
22
  export * from "./external-plugin-detector";
23
23
  export * from "./zip-extractor";
24
24
  export * from "./agent-variant";
25
+ export * from "./session-cursor";
26
+ export * from "./shell-env";
27
+ export * from "./system-directive";
28
+ export * from "./agent-tool-restrictions";
@@ -1,10 +1,13 @@
1
- export declare const PERMISSION_BREAKING_VERSION = "1.1.1";
1
+ /**
2
+ * Minimum OpenCode version required for this plugin.
3
+ * This plugin only supports OpenCode 1.1.1+ which uses the permission system.
4
+ */
5
+ export declare const MINIMUM_OPENCODE_VERSION = "1.1.1";
2
6
  export declare function parseVersion(version: string): number[];
3
7
  export declare function compareVersions(a: string, b: string): -1 | 0 | 1;
4
8
  export declare function isVersionGte(a: string, b: string): boolean;
5
9
  export declare function isVersionLt(a: string, b: string): boolean;
6
10
  export declare function getOpenCodeVersion(): string | null;
7
- export declare function supportsNewPermissionSystem(): boolean;
8
- export declare function usesLegacyToolsSystem(): boolean;
11
+ export declare function isOpenCodeVersionAtLeast(version: string): boolean;
9
12
  export declare function resetVersionCache(): void;
10
13
  export declare function setVersionCache(version: string | null): void;
@@ -1,14 +1,27 @@
1
- import { supportsNewPermissionSystem } from "./opencode-version";
2
- export { supportsNewPermissionSystem };
1
+ /**
2
+ * Permission system utilities for OpenCode 1.1.1+.
3
+ * This module only supports the new permission format.
4
+ */
3
5
  export type PermissionValue = "ask" | "allow" | "deny";
4
- export interface LegacyToolsFormat {
5
- tools: Record<string, boolean>;
6
- }
7
- export interface NewPermissionFormat {
6
+ export interface PermissionFormat {
8
7
  permission: Record<string, PermissionValue>;
9
8
  }
10
- export type VersionAwareRestrictions = LegacyToolsFormat | NewPermissionFormat;
11
- export declare function createAgentToolRestrictions(denyTools: string[]): VersionAwareRestrictions;
9
+ /**
10
+ * Creates tool restrictions that deny specified tools.
11
+ */
12
+ export declare function createAgentToolRestrictions(denyTools: string[]): PermissionFormat;
13
+ /**
14
+ * Creates tool restrictions that ONLY allow specified tools.
15
+ * All other tools are denied by default using `*: deny` pattern.
16
+ */
17
+ export declare function createAgentToolAllowlist(allowTools: string[]): PermissionFormat;
18
+ /**
19
+ * Converts legacy tools format to permission format.
20
+ * For migrating user configs from older versions.
21
+ */
12
22
  export declare function migrateToolsToPermission(tools: Record<string, boolean>): Record<string, PermissionValue>;
13
- export declare function migratePermissionToTools(permission: Record<string, PermissionValue>): Record<string, boolean>;
23
+ /**
24
+ * Migrates agent config from legacy tools format to permission format.
25
+ * If config has `tools`, converts to `permission`.
26
+ */
14
27
  export declare function migrateAgentConfig(config: Record<string, unknown>): Record<string, unknown>;
@@ -0,0 +1,13 @@
1
+ type MessageTime = {
2
+ created?: number | string;
3
+ } | number | string | undefined;
4
+ type MessageInfo = {
5
+ id?: string;
6
+ time?: MessageTime;
7
+ };
8
+ export type CursorMessage = {
9
+ info?: MessageInfo;
10
+ };
11
+ export declare function consumeNewMessages<T extends CursorMessage>(sessionID: string | undefined, messages: T[]): T[];
12
+ export declare function resetMessageCursor(sessionID?: string): void;
13
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,41 @@
1
+ export type ShellType = "unix" | "powershell" | "cmd";
2
+ /**
3
+ * Detect the current shell type based on environment variables.
4
+ *
5
+ * Detection priority:
6
+ * 1. PSModulePath → PowerShell
7
+ * 2. SHELL env var → Unix shell
8
+ * 3. Platform fallback → win32: cmd, others: unix
9
+ */
10
+ export declare function detectShellType(): ShellType;
11
+ /**
12
+ * Shell-escape a value for use in environment variable assignment.
13
+ *
14
+ * @param value - The value to escape
15
+ * @param shellType - The target shell type
16
+ * @returns Escaped value appropriate for the shell
17
+ */
18
+ export declare function shellEscape(value: string, shellType: ShellType): string;
19
+ /**
20
+ * Build environment variable prefix command for the target shell.
21
+ *
22
+ * @param env - Record of environment variables to set
23
+ * @param shellType - The target shell type
24
+ * @returns Command prefix string to prepend to the actual command
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * // Unix: "export VAR1=val1 VAR2=val2; command"
29
+ * buildEnvPrefix({ VAR1: "val1", VAR2: "val2" }, "unix")
30
+ * // => "export VAR1=val1 VAR2=val2;"
31
+ *
32
+ * // PowerShell: "$env:VAR1='val1'; $env:VAR2='val2'; command"
33
+ * buildEnvPrefix({ VAR1: "val1", VAR2: "val2" }, "powershell")
34
+ * // => "$env:VAR1='val1'; $env:VAR2='val2';"
35
+ *
36
+ * // cmd.exe: "set VAR1=val1 && set VAR2=val2 && command"
37
+ * buildEnvPrefix({ VAR1: "val1", VAR2: "val2" }, "cmd")
38
+ * // => "set VAR1=\"val1\" && set VAR2=\"val2\" &&"
39
+ * ```
40
+ */
41
+ export declare function buildEnvPrefix(env: Record<string, string>, shellType: ShellType): string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Unified system directive prefix for oh-my-opencode internal messages.
3
+ * All system-generated messages should use this prefix for consistent filtering.
4
+ *
5
+ * Format: [SYSTEM DIRECTIVE: OH-MY-OPENCODE - {TYPE}]
6
+ */
7
+ export declare const SYSTEM_DIRECTIVE_PREFIX = "[SYSTEM DIRECTIVE: OH-MY-OPENCODE";
8
+ /**
9
+ * Creates a system directive header with the given type.
10
+ * @param type - The directive type (e.g., "TODO CONTINUATION", "RALPH LOOP")
11
+ * @returns Formatted directive string like "[SYSTEM DIRECTIVE: OH-MY-OPENCODE - TODO CONTINUATION]"
12
+ */
13
+ export declare function createSystemDirective(type: string): string;
14
+ /**
15
+ * Checks if a message starts with the oh-my-opencode system directive prefix.
16
+ * Used by keyword-detector and other hooks to skip system-generated messages.
17
+ * @param text - The message text to check
18
+ * @returns true if the message is a system directive
19
+ */
20
+ export declare function isSystemDirective(text: string): boolean;
21
+ export declare const SystemDirectiveTypes: {
22
+ readonly TODO_CONTINUATION: "TODO CONTINUATION";
23
+ readonly RALPH_LOOP: "RALPH LOOP";
24
+ readonly BOULDER_CONTINUATION: "BOULDER CONTINUATION";
25
+ readonly DELEGATION_REQUIRED: "DELEGATION REQUIRED";
26
+ readonly SINGLE_TASK_ONLY: "SINGLE TASK ONLY";
27
+ readonly COMPACTION_CONTEXT: "COMPACTION CONTEXT";
28
+ readonly CONTEXT_WINDOW_MONITOR: "CONTEXT WINDOW MONITOR";
29
+ readonly PROMETHEUS_READ_ONLY: "PROMETHEUS READ-ONLY";
30
+ };
31
+ export type SystemDirectiveType = (typeof SystemDirectiveTypes)[keyof typeof SystemDirectiveTypes];
@@ -9,4 +9,4 @@ export declare const GENERAL_CATEGORY_PROMPT_APPEND = "<Category_Context>\nYou a
9
9
  export declare const DEFAULT_CATEGORIES: Record<string, CategoryConfig>;
10
10
  export declare const CATEGORY_PROMPT_APPENDS: Record<string, string>;
11
11
  export declare const CATEGORY_DESCRIPTIONS: Record<string, string>;
12
- export declare const SISYPHUS_TASK_DESCRIPTION: string;
12
+ export declare const DELEGATE_TASK_DESCRIPTION: string;
@@ -1,3 +1,3 @@
1
- export { createSisyphusTask, type SisyphusTaskToolOptions } from "./tools";
1
+ export { createDelegateTask, type DelegateTaskToolOptions } from "./tools";
2
2
  export type * from "./types";
3
3
  export * from "./constants";
@@ -2,7 +2,7 @@ import { type PluginInput, type ToolDefinition } from "@opencode-ai/plugin";
2
2
  import type { BackgroundManager } from "../../features/background-agent";
3
3
  import type { CategoriesConfig, GitMasterConfig } from "../../config/schema";
4
4
  type OpencodeClient = PluginInput["client"];
5
- export interface SisyphusTaskToolOptions {
5
+ export interface DelegateTaskToolOptions {
6
6
  manager: BackgroundManager;
7
7
  client: OpencodeClient;
8
8
  directory: string;
@@ -14,5 +14,5 @@ export interface BuildSystemContentInput {
14
14
  categoryPromptAppend?: string;
15
15
  }
16
16
  export declare function buildSystemContent(input: BuildSystemContentInput): string | undefined;
17
- export declare function createSisyphusTask(options: SisyphusTaskToolOptions): ToolDefinition;
17
+ export declare function createDelegateTask(options: DelegateTaskToolOptions): ToolDefinition;
18
18
  export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,9 +1,9 @@
1
- export interface SisyphusTaskArgs {
1
+ export interface DelegateTaskArgs {
2
2
  description: string;
3
3
  prompt: string;
4
4
  category?: string;
5
5
  subagent_type?: string;
6
6
  run_in_background: boolean;
7
7
  resume?: string;
8
- skills: string[];
8
+ skills: string[] | null;
9
9
  }
@@ -11,6 +11,6 @@ import type { BackgroundManager } from "../features/background-agent";
11
11
  type OpencodeClient = PluginInput["client"];
12
12
  export { createCallOmoAgent } from "./call-omo-agent";
13
13
  export { createLookAt } from "./look-at";
14
- export { createSisyphusTask, type SisyphusTaskToolOptions, DEFAULT_CATEGORIES, CATEGORY_PROMPT_APPENDS } from "./sisyphus-task";
14
+ export { createDelegateTask, type DelegateTaskToolOptions, DEFAULT_CATEGORIES, CATEGORY_PROMPT_APPENDS } from "./delegate-task";
15
15
  export declare function createBackgroundTools(manager: BackgroundManager, client: OpencodeClient): Record<string, ToolDefinition>;
16
16
  export declare const builtinTools: Record<string, ToolDefinition>;
@@ -1,3 +1,3 @@
1
1
  export declare const DEFAULT_TIMEOUT_MS = 60000;
2
2
  export declare const BLOCKED_TMUX_SUBCOMMANDS: string[];
3
- export declare const INTERACTIVE_BASH_DESCRIPTION = "Execute tmux commands. Use \"omo-{name}\" session pattern.\n\nFor: server processes, long-running tasks, background jobs, interactive CLI tools.\n\nBlocked (use bash instead): capture-pane, save-buffer, show-buffer, pipe-pane.";
3
+ export declare const INTERACTIVE_BASH_DESCRIPTION = "WARNING: This is TMUX ONLY. Pass tmux subcommands directly (without 'tmux' prefix).\n\nExamples: new-session -d -s omo-dev, send-keys -t omo-dev \"vim\" Enter\n\nFor TUI apps needing ongoing interaction (vim, htop, pudb). One-shot commands \u2192 use Bash with &.";
@@ -1,2 +1,9 @@
1
1
  import { type PluginInput, type ToolDefinition } from "@opencode-ai/plugin";
2
+ import type { LookAtArgs } from "./types";
3
+ interface LookAtArgsWithAlias extends LookAtArgs {
4
+ path?: string;
5
+ }
6
+ export declare function normalizeArgs(args: LookAtArgsWithAlias): LookAtArgs;
7
+ export declare function validateArgs(args: LookAtArgs): string | null;
2
8
  export declare function createLookAt(ctx: PluginInput): ToolDefinition;
9
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -42,7 +42,6 @@ export declare class LSPClient {
42
42
  private handleServerRequest;
43
43
  initialize(): Promise<void>;
44
44
  openFile(filePath: string): Promise<void>;
45
- hover(filePath: string, line: number, character: number): Promise<unknown>;
46
45
  definition(filePath: string, line: number, character: number): Promise<unknown>;
47
46
  references(filePath: string, line: number, character: number, includeDeclaration?: boolean): Promise<unknown>;
48
47
  documentSymbols(filePath: string): Promise<unknown>;
@@ -52,8 +51,6 @@ export declare class LSPClient {
52
51
  }>;
53
52
  prepareRename(filePath: string, line: number, character: number): Promise<unknown>;
54
53
  rename(filePath: string, line: number, character: number, newName: string): Promise<unknown>;
55
- codeAction(filePath: string, startLine: number, startChar: number, endLine: number, endChar: number, only?: string[]): Promise<unknown>;
56
- codeActionResolve(codeAction: unknown): Promise<unknown>;
57
54
  isAlive(): boolean;
58
55
  stop(): Promise<void>;
59
56
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -3,4 +3,4 @@ export * from "./constants";
3
3
  export * from "./config";
4
4
  export * from "./client";
5
5
  export * from "./utils";
6
- export * from "./tools";
6
+ export { lsp_goto_definition, lsp_find_references, lsp_symbols, lsp_diagnostics, lsp_prepare_rename, lsp_rename } from "./tools";
@@ -3,6 +3,5 @@ export declare const lsp_goto_definition: ToolDefinition;
3
3
  export declare const lsp_find_references: ToolDefinition;
4
4
  export declare const lsp_symbols: ToolDefinition;
5
5
  export declare const lsp_diagnostics: ToolDefinition;
6
- export declare const lsp_servers: ToolDefinition;
7
6
  export declare const lsp_prepare_rename: ToolDefinition;
8
7
  export declare const lsp_rename: ToolDefinition;
@@ -44,16 +44,6 @@ export interface Diagnostic {
44
44
  source?: string;
45
45
  message: string;
46
46
  }
47
- export interface HoverResult {
48
- contents: {
49
- kind?: string;
50
- value: string;
51
- } | string | Array<{
52
- kind?: string;
53
- value: string;
54
- } | string>;
55
- range?: Range;
56
- }
57
47
  export interface TextDocumentIdentifier {
58
48
  uri: string;
59
49
  }
@@ -106,29 +96,6 @@ export interface PrepareRenameResult {
106
96
  export interface PrepareRenameDefaultBehavior {
107
97
  defaultBehavior: boolean;
108
98
  }
109
- export interface Command {
110
- title: string;
111
- command: string;
112
- arguments?: unknown[];
113
- }
114
- export interface CodeActionContext {
115
- diagnostics: Diagnostic[];
116
- only?: string[];
117
- triggerKind?: CodeActionTriggerKind;
118
- }
119
- export type CodeActionTriggerKind = 1 | 2;
120
- export interface CodeAction {
121
- title: string;
122
- kind?: string;
123
- diagnostics?: Diagnostic[];
124
- isPreferred?: boolean;
125
- disabled?: {
126
- reason: string;
127
- };
128
- edit?: WorkspaceEdit;
129
- command?: Command;
130
- data?: unknown;
131
- }
132
99
  export interface ServerLookupInfo {
133
100
  id: string;
134
101
  command: string[];
@@ -1,12 +1,11 @@
1
1
  import { LSPClient } from "./client";
2
- import type { HoverResult, DocumentSymbol, SymbolInfo, Location, LocationLink, Diagnostic, PrepareRenameResult, PrepareRenameDefaultBehavior, Range, WorkspaceEdit, TextEdit, CodeAction, Command, ServerLookupResult } from "./types";
2
+ import type { Location, LocationLink, DocumentSymbol, SymbolInfo, Diagnostic, PrepareRenameResult, PrepareRenameDefaultBehavior, Range, WorkspaceEdit, TextEdit, ServerLookupResult } from "./types";
3
3
  export declare function findWorkspaceRoot(filePath: string): string;
4
4
  export declare function uriToPath(uri: string): string;
5
5
  export declare function formatServerLookupError(result: Exclude<ServerLookupResult, {
6
6
  status: "found";
7
7
  }>): string;
8
8
  export declare function withLspClient<T>(filePath: string, fn: (client: LSPClient) => Promise<T>): Promise<T>;
9
- export declare function formatHoverResult(result: HoverResult | null): string;
10
9
  export declare function formatLocation(loc: Location | LocationLink): string;
11
10
  export declare function formatSymbolKind(kind: number): string;
12
11
  export declare function formatSeverity(severity: number | undefined): string;
@@ -17,8 +16,6 @@ export declare function filterDiagnosticsBySeverity(diagnostics: Diagnostic[], s
17
16
  export declare function formatPrepareRenameResult(result: PrepareRenameResult | PrepareRenameDefaultBehavior | Range | null): string;
18
17
  export declare function formatTextEdit(edit: TextEdit): string;
19
18
  export declare function formatWorkspaceEdit(edit: WorkspaceEdit | null): string;
20
- export declare function formatCodeAction(action: CodeAction): string;
21
- export declare function formatCodeActions(actions: (CodeAction | Command)[] | null): string;
22
19
  export interface ApplyResult {
23
20
  success: boolean;
24
21
  filesModified: string[];
@@ -1,5 +1,6 @@
1
1
  import type { SkillScope, LoadedSkill } from "../../features/opencode-skill-loader/types";
2
2
  import type { SkillMcpManager } from "../../features/skill-mcp-manager";
3
+ import type { GitMasterConfig } from "../../config/schema";
3
4
  export interface SkillArgs {
4
5
  name: string;
5
6
  }
@@ -22,4 +23,6 @@ export interface SkillLoadOptions {
22
23
  mcpManager?: SkillMcpManager;
23
24
  /** Session ID getter for MCP client identification */
24
25
  getSessionID?: () => string;
26
+ /** Git master configuration for watermark/co-author settings */
27
+ gitMasterConfig?: GitMasterConfig;
25
28
  }
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "oh-my-opencode",
3
- "version": "3.0.0-beta.7",
3
+ "version": "3.0.0-beta.9",
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",
7
7
  "type": "module",
8
8
  "bin": {
9
- "oh-my-opencode": "./dist/cli/index.js"
9
+ "oh-my-opencode": "./bin/oh-my-opencode.js"
10
10
  },
11
11
  "files": [
12
- "dist"
12
+ "dist",
13
+ "bin",
14
+ "postinstall.mjs"
13
15
  ],
14
16
  "exports": {
15
17
  ".": {
@@ -20,8 +22,11 @@
20
22
  },
21
23
  "scripts": {
22
24
  "build": "bun build src/index.ts --outdir dist --target bun --format esm --external @ast-grep/napi && tsc --emitDeclarationOnly && bun build src/cli/index.ts --outdir dist/cli --target bun --format esm --external @ast-grep/napi && bun run build:schema",
25
+ "build:all": "bun run build && bun run build:binaries",
26
+ "build:binaries": "bun run script/build-binaries.ts",
23
27
  "build:schema": "bun run script/build-schema.ts",
24
28
  "clean": "rm -rf dist",
29
+ "postinstall": "node postinstall.mjs",
25
30
  "prepublishOnly": "bun run clean && bun run build",
26
31
  "typecheck": "tsc --noEmit",
27
32
  "test": "bun test"
@@ -55,6 +60,7 @@
55
60
  "@opencode-ai/plugin": "^1.1.19",
56
61
  "@opencode-ai/sdk": "^1.1.19",
57
62
  "commander": "^14.0.2",
63
+ "detect-libc": "^2.0.0",
58
64
  "hono": "^4.10.4",
59
65
  "js-yaml": "^4.1.1",
60
66
  "jsonc-parser": "^3.3.1",
@@ -70,6 +76,15 @@
70
76
  "bun-types": "latest",
71
77
  "typescript": "^5.7.3"
72
78
  },
79
+ "optionalDependencies": {
80
+ "oh-my-opencode-darwin-arm64": "3.0.0-beta.9",
81
+ "oh-my-opencode-darwin-x64": "3.0.0-beta.9",
82
+ "oh-my-opencode-linux-arm64": "3.0.0-beta.9",
83
+ "oh-my-opencode-linux-arm64-musl": "3.0.0-beta.9",
84
+ "oh-my-opencode-linux-x64": "3.0.0-beta.9",
85
+ "oh-my-opencode-linux-x64-musl": "3.0.0-beta.9",
86
+ "oh-my-opencode-windows-x64": "3.0.0-beta.9"
87
+ },
73
88
  "trustedDependencies": [
74
89
  "@ast-grep/cli",
75
90
  "@ast-grep/napi",
@@ -0,0 +1,43 @@
1
+ // postinstall.mjs
2
+ // Runs after npm install to verify platform binary is available
3
+
4
+ import { createRequire } from "node:module";
5
+ import { getPlatformPackage, getBinaryPath } from "./bin/platform.js";
6
+
7
+ const require = createRequire(import.meta.url);
8
+
9
+ /**
10
+ * Detect libc family on Linux
11
+ */
12
+ function getLibcFamily() {
13
+ if (process.platform !== "linux") {
14
+ return undefined;
15
+ }
16
+
17
+ try {
18
+ const detectLibc = require("detect-libc");
19
+ return detectLibc.familySync();
20
+ } catch {
21
+ return null;
22
+ }
23
+ }
24
+
25
+ function main() {
26
+ const { platform, arch } = process;
27
+ const libcFamily = getLibcFamily();
28
+
29
+ try {
30
+ const pkg = getPlatformPackage({ platform, arch, libcFamily });
31
+ const binPath = getBinaryPath(pkg, platform);
32
+
33
+ // Try to resolve the binary
34
+ require.resolve(binPath);
35
+ console.log(`✓ oh-my-opencode binary installed for ${platform}-${arch}`);
36
+ } catch (error) {
37
+ console.warn(`⚠ oh-my-opencode: ${error.message}`);
38
+ console.warn(` The CLI may not work on this platform.`);
39
+ // Don't fail installation - let user try anyway
40
+ }
41
+ }
42
+
43
+ main();
@@ -1,12 +0,0 @@
1
- import type { Message, Part } from "@opencode-ai/sdk";
2
- interface MessageWithParts {
3
- info: Message;
4
- parts: Part[];
5
- }
6
- type MessagesTransformHook = {
7
- "experimental.chat.messages.transform"?: (input: Record<string, never>, output: {
8
- messages: MessageWithParts[];
9
- }) => Promise<void>;
10
- };
11
- export declare function createEmptyMessageSanitizerHook(): MessagesTransformHook;
12
- export {};
@@ -1,3 +0,0 @@
1
- export declare const DEFAULT_THRESHOLD = 0.85;
2
- export declare const MIN_TOKENS_FOR_COMPACTION = 50000;
3
- export declare const COMPACTION_COOLDOWN_MS = 60000;
@@ -1,24 +0,0 @@
1
- import type { PluginInput } from "@opencode-ai/plugin";
2
- import type { ExperimentalConfig } from "../../config";
3
- export interface SummarizeContext {
4
- sessionID: string;
5
- providerID: string;
6
- modelID: string;
7
- usageRatio: number;
8
- directory: string;
9
- }
10
- export type BeforeSummarizeCallback = (ctx: SummarizeContext) => Promise<void> | void;
11
- export type GetModelLimitCallback = (providerID: string, modelID: string) => number | undefined;
12
- export interface PreemptiveCompactionOptions {
13
- experimental?: ExperimentalConfig;
14
- onBeforeSummarize?: BeforeSummarizeCallback;
15
- getModelLimit?: GetModelLimitCallback;
16
- }
17
- export declare function createPreemptiveCompactionHook(ctx: PluginInput, options?: PreemptiveCompactionOptions): {
18
- event: ({ event }: {
19
- event: {
20
- type: string;
21
- properties?: unknown;
22
- };
23
- }) => Promise<void>;
24
- };
@@ -1,17 +0,0 @@
1
- export interface PreemptiveCompactionState {
2
- lastCompactionTime: Map<string, number>;
3
- compactionInProgress: Set<string>;
4
- }
5
- export interface TokenInfo {
6
- input: number;
7
- output: number;
8
- reasoning: number;
9
- cache: {
10
- read: number;
11
- write: number;
12
- };
13
- }
14
- export interface ModelLimits {
15
- context: number;
16
- output: number;
17
- }