chore: include pre-built dist for github install

This commit is contained in:
Robin Mordasiewicz
2026-03-14 04:56:50 +00:00
parent a7f0a4cf46
commit bce8ff3a75
1011 changed files with 150081 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
/**
* Agent config keys to display names mapping.
* Config keys are lowercase (e.g., "sisyphus", "atlas").
* Display names include suffixes for UI/logs (e.g., "Sisyphus (Ultraworker)").
*/
export declare const AGENT_DISPLAY_NAMES: Record<string, string>;
/**
* Get display name for an agent config key.
* Uses case-insensitive lookup for backward compatibility.
* Returns original key if not found.
*/
export declare function getAgentDisplayName(configKey: string): string;
/**
* Resolve an agent name (display name or config key) to its lowercase config key.
* "Atlas (Plan Executor)" → "atlas", "atlas" → "atlas", "unknown" → "unknown"
*/
export declare function getAgentConfigKey(agentName: string): string;
+7
View File
@@ -0,0 +1,7 @@
/**
* Agent tool restrictions for session.prompt calls.
* OpenCode SDK's session.prompt `tools` parameter expects boolean values.
* true = tool allowed, false = tool denied.
*/
export declare function getAgentToolRestrictions(agentName: string): Record<string, boolean>;
export declare function hasAgentToolRestrictions(agentName: string): boolean;
+9
View File
@@ -0,0 +1,9 @@
import type { OhMyOpenCodeConfig } from "../config";
export declare function resolveAgentVariant(config: OhMyOpenCodeConfig, agentName?: string): string | undefined;
export declare function resolveVariantForModel(config: OhMyOpenCodeConfig, agentName: string, currentModel: {
providerID: string;
modelID: string;
}): string | undefined;
export declare function applyAgentVariant(config: OhMyOpenCodeConfig, agentName: string | undefined, message: {
variant?: string;
}): void;
+10
View File
@@ -0,0 +1,10 @@
export declare function getCachedBinaryPath(cacheDir: string, binaryName: string): string | null;
export declare function ensureCacheDir(cacheDir: string): void;
export declare function downloadArchive(downloadUrl: string, archivePath: string): Promise<void>;
export declare function extractTarGz(archivePath: string, destDir: string, options?: {
args?: string[];
cwd?: string;
}): Promise<void>;
export declare function extractZipArchive(archivePath: string, destDir: string): Promise<void>;
export declare function cleanupArchive(archivePath: string): void;
export declare function ensureExecutable(binaryPath: string): void;
+1
View File
@@ -0,0 +1 @@
export declare function getClaudeConfigDir(): string;
+4
View File
@@ -0,0 +1,4 @@
export { executeHookCommand } from "./command-executor/execute-hook-command";
export type { CommandResult, ExecuteHookOptions } from "./command-executor/execute-hook-command";
export { executeCommand } from "./command-executor/execute-command";
export { resolveCommandsInText } from "./command-executor/resolve-commands-in-text";
+7
View File
@@ -0,0 +1,7 @@
export interface CommandMatch {
fullMatch: string;
command: string;
start: number;
end: number;
}
export declare function findEmbeddedCommands(text: string): CommandMatch[];
+1
View File
@@ -0,0 +1 @@
export declare function executeCommand(command: string): Promise<string>;
+12
View File
@@ -0,0 +1,12 @@
export interface CommandResult {
exitCode: number;
stdout?: string;
stderr?: string;
}
export interface ExecuteHookOptions {
forceZsh?: boolean;
zshPath?: string;
/** Timeout in milliseconds. Process is killed after this. Default: 30000 */
timeoutMs?: number;
}
export declare function executeHookCommand(command: string, stdin: string, cwd: string, options?: ExecuteHookOptions): Promise<CommandResult>;
+1
View File
@@ -0,0 +1 @@
export declare function getHomeDirectory(): string;
@@ -0,0 +1 @@
export declare function resolveCommandsInText(text: string, depth?: number, maxDepth?: number): Promise<string>;
+2
View File
@@ -0,0 +1,2 @@
export declare function findZshPath(customZshPath?: string): string | null;
export declare function findBashPath(): string | null;
+11
View File
@@ -0,0 +1,11 @@
export type CompactionAgentConfigCheckpoint = {
agent?: string;
model?: {
providerID: string;
modelID: string;
};
tools?: Record<string, boolean>;
};
export declare function setCompactionAgentConfigCheckpoint(sessionID: string, checkpoint: CompactionAgentConfigCheckpoint): void;
export declare function getCompactionAgentConfigCheckpoint(sessionID: string): CompactionAgentConfigCheckpoint | undefined;
export declare function clearCompactionAgentConfigCheckpoint(sessionID: string): void;
+7
View File
@@ -0,0 +1,7 @@
export type ConfigLoadError = {
path: string;
error: string;
};
export declare function getConfigLoadErrors(): ConfigLoadError[];
export declare function clearConfigLoadErrors(): void;
export declare function addConfigLoadError(error: ConfigLoadError): void;
+55
View File
@@ -0,0 +1,55 @@
interface ModelMetadata {
id: string;
provider?: string;
context?: number;
output?: number;
name?: string;
}
interface ProviderModelsCache {
models: Record<string, string[] | ModelMetadata[]>;
connected: string[];
updatedAt: string;
}
/**
* Read the connected providers cache.
* Returns the list of connected provider IDs, or null if cache doesn't exist.
*/
export declare function readConnectedProvidersCache(): string[] | null;
/**
* Check if connected providers cache exists.
*/
export declare function hasConnectedProvidersCache(): boolean;
/**
* Read the provider-models cache.
* Returns the cache data, or null if cache doesn't exist.
*/
export declare function readProviderModelsCache(): ProviderModelsCache | null;
/**
* Check if provider-models cache exists.
*/
export declare function hasProviderModelsCache(): boolean;
/**
* Write the provider-models cache.
*/
export declare function writeProviderModelsCache(data: {
models: Record<string, string[]>;
connected: string[];
}): void;
/**
* Update the connected providers cache by fetching from the client.
* Also updates the provider-models cache with model lists per provider.
*/
export declare function updateConnectedProvidersCache(client: {
provider?: {
list?: () => Promise<{
data?: {
connected?: string[];
all?: Array<{
id: string;
models?: Record<string, unknown>;
}>;
};
}>;
};
}): Promise<void>;
export {};
+5
View File
@@ -0,0 +1,5 @@
export type ContextLimitModelCacheState = {
anthropicContext1MEnabled: boolean;
modelContextLimitsCache?: Map<string, number>;
};
export declare function resolveActualContextLimit(providerID: string, modelID: string, modelCacheState?: ContextLimitModelCacheState): number | null;
+30
View File
@@ -0,0 +1,30 @@
/**
* Returns the user-level data directory.
* Matches OpenCode's behavior via xdg-basedir:
* - All platforms: XDG_DATA_HOME or ~/.local/share
*
* Note: OpenCode uses xdg-basedir which returns ~/.local/share on ALL platforms
* including Windows, so we match that behavior exactly.
*/
export declare function getDataDir(): string;
/**
* Returns the OpenCode storage directory path.
* All platforms: ~/.local/share/opencode/storage
*/
export declare function getOpenCodeStorageDir(): string;
/**
* Returns the user-level cache directory.
* Matches OpenCode's behavior via xdg-basedir:
* - All platforms: XDG_CACHE_HOME or ~/.cache
*/
export declare function getCacheDir(): string;
/**
* Returns the oh-my-opencode cache directory.
* All platforms: ~/.cache/oh-my-opencode
*/
export declare function getOmoOpenCodeCacheDir(): string;
/**
* Returns the OpenCode cache directory (for reading OpenCode's cache).
* All platforms: ~/.cache/opencode
*/
export declare function getOpenCodeCacheDir(): string;
+13
View File
@@ -0,0 +1,13 @@
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
/**
* Deep merges two objects, with override values taking precedence.
* - Objects are recursively merged
* - Arrays are replaced (not concatenated)
* - undefined values in override do not overwrite base values
*
* @example
* deepMerge({ a: 1, b: { c: 2, d: 3 } }, { b: { c: 10 }, e: 5 })
* // => { a: 1, b: { c: 10, d: 3 }, e: 5 }
*/
export declare function deepMerge<T extends Record<string, unknown>>(base: T, override: Partial<T>, depth?: number): T;
export declare function deepMerge<T extends Record<string, unknown>>(base: T | undefined, override: T | undefined, depth?: number): T | undefined;
+2
View File
@@ -0,0 +1,2 @@
import type { ToolDefinition } from "@opencode-ai/plugin";
export declare function filterDisabledTools(tools: Record<string, ToolDefinition>, disabledTools: readonly string[] | undefined): Record<string, ToolDefinition>;
+28
View File
@@ -0,0 +1,28 @@
import type { PluginInput } from "@opencode-ai/plugin";
import { type ContextLimitModelCacheState } from "./context-limit-resolver";
export interface TruncationResult {
result: string;
truncated: boolean;
removedCount?: number;
}
export interface TruncationOptions {
targetMaxTokens?: number;
preserveHeaderLines?: number;
contextWindowLimit?: number;
}
export declare function truncateToTokenLimit(output: string, maxTokens: number, preserveHeaderLines?: number): TruncationResult;
export declare function getContextWindowUsage(ctx: PluginInput, sessionID: string, modelCacheState?: ContextLimitModelCacheState): Promise<{
usedTokens: number;
remainingTokens: number;
usagePercentage: number;
} | null>;
export declare function dynamicTruncate(ctx: PluginInput, sessionID: string, output: string, options?: TruncationOptions, modelCacheState?: ContextLimitModelCacheState): Promise<TruncationResult>;
export declare function createDynamicTruncator(ctx: PluginInput, modelCacheState?: ContextLimitModelCacheState): {
truncate: (sessionID: string, output: string, options?: TruncationOptions) => Promise<TruncationResult>;
getUsage: (sessionID: string) => Promise<{
usedTokens: number;
remainingTokens: number;
usagePercentage: number;
} | null>;
truncateSync: (output: string, maxTokens: number, preserveHeaderLines?: number) => TruncationResult;
};
+18
View File
@@ -0,0 +1,18 @@
/**
* Detects external plugins that may conflict with oh-my-opencode features.
* Used to prevent crashes from concurrent notification plugins.
*/
export interface ExternalNotifierResult {
detected: boolean;
pluginName: string | null;
allPlugins: string[];
}
/**
* Detect if any external notification plugin is configured.
* Returns information about detected plugins for logging/warning.
*/
export declare function detectExternalNotificationPlugin(directory: string): ExternalNotifierResult;
/**
* Generate a warning message for users with conflicting notification plugins.
*/
export declare function getNotificationConflictWarning(pluginName: string): string;
+3
View File
@@ -0,0 +1,3 @@
import type { FallbackEntry } from "./model-requirements";
export declare function parseFallbackModelEntry(model: string, contextProviderID: string | undefined, defaultProviderID?: string): FallbackEntry | undefined;
export declare function buildFallbackChainFromModels(fallbackModels: string | string[] | undefined, contextProviderID: string | undefined, defaultProviderID?: string): FallbackEntry[] | undefined;
+12
View File
@@ -0,0 +1,12 @@
type FallbackEntry = {
providers: string[];
model: string;
};
type ResolvedFallbackModel = {
provider: string;
model: string;
};
export declare function resolveFirstAvailableFallback(fallbackChain: FallbackEntry[], availableModels: Set<string>): ResolvedFallbackModel | null;
export declare function isAnyFallbackModelAvailable(fallbackChain: FallbackEntry[], availableModels: Set<string>): boolean;
export declare function isAnyProviderConnected(providers: string[], availableModels: Set<string>): boolean;
export {};
+1
View File
@@ -0,0 +1 @@
export declare function resolveFileReferencesInText(text: string, cwd?: string, depth?: number, maxDepth?: number): Promise<string>;
+7
View File
@@ -0,0 +1,7 @@
export declare function isMarkdownFile(entry: {
name: string;
isFile: () => boolean;
}): boolean;
export declare function isSymbolicLink(filePath: string): boolean;
export declare function resolveSymlink(filePath: string): string;
export declare function resolveSymlinkAsync(filePath: string): Promise<string>;
+11
View File
@@ -0,0 +1,11 @@
type SessionInfo = {
id?: string;
parentID?: string;
};
export declare function createFirstMessageVariantGate(): {
markSessionCreated(info?: SessionInfo): void;
shouldOverride(sessionID?: string): boolean;
markApplied(sessionID?: string): void;
clear(sessionID?: string): void;
};
export {};
+7
View File
@@ -0,0 +1,7 @@
export interface FrontmatterResult<T = Record<string, unknown>> {
data: T;
body: string;
hadFrontmatter: boolean;
parseError: boolean;
}
export declare function parseFrontmatter<T = Record<string, unknown>>(content: string): FrontmatterResult<T>;
+2
View File
@@ -0,0 +1,2 @@
import type { GitFileStat } from "./types";
export declare function collectGitDiffStats(directory: string): GitFileStat[];
+2
View File
@@ -0,0 +1,2 @@
import type { GitFileStat } from "./types";
export declare function formatFileChanges(stats: GitFileStat[], notepadPath?: string): string;
+7
View File
@@ -0,0 +1,7 @@
export type { GitFileStatus, GitFileStat } from "./types";
export type { ParsedGitStatusPorcelainLine } from "./parse-status-porcelain-line";
export { parseGitStatusPorcelainLine } from "./parse-status-porcelain-line";
export { parseGitStatusPorcelain } from "./parse-status-porcelain";
export { parseGitDiffNumstat } from "./parse-diff-numstat";
export { collectGitDiffStats } from "./collect-git-diff-stats";
export { formatFileChanges } from "./format-file-changes";
+2
View File
@@ -0,0 +1,2 @@
import type { GitFileStat, GitFileStatus } from "./types";
export declare function parseGitDiffNumstat(output: string, statusMap: Map<string, GitFileStatus>): GitFileStat[];
@@ -0,0 +1,6 @@
import type { GitFileStatus } from "./types";
export interface ParsedGitStatusPorcelainLine {
filePath: string;
status: GitFileStatus;
}
export declare function parseGitStatusPorcelainLine(line: string): ParsedGitStatusPorcelainLine | null;
+2
View File
@@ -0,0 +1,2 @@
import type { GitFileStatus } from "./types";
export declare function parseGitStatusPorcelain(output: string): Map<string, GitFileStatus>;
+7
View File
@@ -0,0 +1,7 @@
export type GitFileStatus = "modified" | "added" | "deleted";
export interface GitFileStat {
path: string;
added: number;
removed: number;
status: GitFileStatus;
}
+2
View File
@@ -0,0 +1,2 @@
import type { ClaudeHookEvent, PluginConfig } from "../hooks/claude-code-hooks/types";
export declare function isHookDisabled(config: PluginConfig, hookType: ClaudeHookEvent): boolean;
+59
View File
@@ -0,0 +1,59 @@
export * from "./frontmatter";
export * from "./command-executor";
export * from "./file-reference-resolver";
export * from "./model-sanitizer";
export * from "./logger";
export * from "./snake-case";
export * from "./tool-name";
export * from "./pattern-matcher";
export * from "./hook-disabled";
export * from "./deep-merge";
export * from "./file-utils";
export * from "./dynamic-truncator";
export * from "./data-path";
export * from "./config-errors";
export * from "./claude-config-dir";
export * from "./jsonc-parser";
export * from "./migration";
export * from "./opencode-config-dir";
export type { OpenCodeBinaryType, OpenCodeConfigDirOptions, OpenCodeConfigPaths, } from "./opencode-config-dir-types";
export * from "./opencode-version";
export * from "./opencode-storage-detection";
export * from "./permission-compat";
export * from "./external-plugin-detector";
export * from "./zip-extractor";
export * from "./binary-downloader";
export * from "./agent-variant";
export * from "./session-cursor";
export * from "./shell-env";
export * from "./system-directive";
export * from "./agent-tool-restrictions";
export * from "./model-requirements";
export * from "./model-resolver";
export { normalizeModel, normalizeModelID } from "./model-normalization";
export { normalizeFallbackModels } from "./model-resolver";
export { resolveModelPipeline } from "./model-resolution-pipeline";
export type { ModelResolutionRequest, ModelResolutionProvenance, ModelResolutionResult, } from "./model-resolution-types";
export * from "./model-availability";
export * from "./fallback-model-availability";
export * from "./connected-providers-cache";
export * from "./context-limit-resolver";
export * from "./session-utils";
export * from "./tmux";
export * from "./model-suggestion-retry";
export * from "./opencode-server-auth";
export * from "./opencode-http-api";
export * from "./port-utils";
export * from "./git-worktree";
export * from "./safe-create-hook";
export * from "./truncate-description";
export * from "./opencode-storage-paths";
export * from "./opencode-message-dir";
export * from "./opencode-command-dirs";
export * from "./normalize-sdk-response";
export * from "./session-directory-resolver";
export * from "./prompt-tools";
export * from "./internal-initiator-marker";
export * from "./plugin-command-discovery";
export { SessionCategoryRegistry } from "./session-category-registry";
export * from "./plugin-identity";
+5
View File
@@ -0,0 +1,5 @@
export declare const OMO_INTERNAL_INITIATOR_MARKER = "<!-- OMO_INTERNAL_INITIATOR -->";
export declare function createInternalAgentTextPart(text: string): {
type: "text";
text: string;
};
+15
View File
@@ -0,0 +1,15 @@
export interface JsoncParseResult<T> {
data: T | null;
errors: Array<{
message: string;
offset: number;
length: number;
}>;
}
export declare function parseJsonc<T = unknown>(content: string): T;
export declare function parseJsoncSafe<T = unknown>(content: string): JsoncParseResult<T>;
export declare function readJsoncFile<T = unknown>(filePath: string): T | null;
export declare function detectConfigFile(basePath: string): {
format: "json" | "jsonc" | "none";
path: string;
};
+2
View File
@@ -0,0 +1,2 @@
export declare function log(message: string, data?: unknown): void;
export declare function getLogFilePath(): string;
+6
View File
@@ -0,0 +1,6 @@
import type { CategoriesConfig, CategoryConfig } from "../config/schema";
/**
* Merge default and user categories, filtering out disabled ones.
* Single source of truth for category merging across the codebase.
*/
export declare function mergeCategories(userCategories?: CategoriesConfig): Record<string, CategoryConfig>;
+5
View File
@@ -0,0 +1,5 @@
export { AGENT_NAME_MAP, BUILTIN_AGENT_NAMES, migrateAgentNames } from "./migration/agent-names";
export { HOOK_NAME_MAP, migrateHookNames } from "./migration/hook-names";
export { MODEL_VERSION_MAP, migrateModelVersions } from "./migration/model-versions";
export { MODEL_TO_CATEGORY_MAP, migrateAgentConfigToCategory, shouldDeleteAgentConfig } from "./migration/agent-category";
export { migrateConfigFile } from "./migration/config-migration";
+19
View File
@@ -0,0 +1,19 @@
/**
* @deprecated LEGACY MIGRATION ONLY
*
* This map exists solely for migrating old configs that used hardcoded model strings.
* It maps legacy model strings to semantic category names, allowing users to migrate
* from explicit model configs to category-based configs.
*
* DO NOT add new entries here. New agents should use:
* - Category-based config (preferred): { category: "unspecified-high" }
* - Or inherit from OpenCode's config.model
*
* This map will be removed in a future major version once migration period ends.
*/
export declare const MODEL_TO_CATEGORY_MAP: Record<string, string>;
export declare function migrateAgentConfigToCategory(config: Record<string, unknown>): {
migrated: Record<string, unknown>;
changed: boolean;
};
export declare function shouldDeleteAgentConfig(config: Record<string, unknown>, category: string): boolean;
+6
View File
@@ -0,0 +1,6 @@
export declare const AGENT_NAME_MAP: Record<string, string>;
export declare const BUILTIN_AGENT_NAMES: Set<string>;
export declare function migrateAgentNames(agents: Record<string, unknown>): {
migrated: Record<string, unknown>;
changed: boolean;
};
+1
View File
@@ -0,0 +1 @@
export declare function migrateConfigFile(configPath: string, rawConfig: Record<string, unknown>): boolean;
+6
View File
@@ -0,0 +1,6 @@
export declare const HOOK_NAME_MAP: Record<string, string | null>;
export declare function migrateHookNames(hooks: string[]): {
migrated: string[];
changed: boolean;
removed: string[];
};
+13
View File
@@ -0,0 +1,13 @@
/**
* Model version migration map: old full model strings → new full model strings.
* Used to auto-upgrade hardcoded model versions in user configs when the plugin
* bumps to newer model versions.
*
* Keys are full "provider/model" strings. Only openai and anthropic entries needed.
*/
export declare const MODEL_VERSION_MAP: Record<string, string>;
export declare function migrateModelVersions(configs: Record<string, unknown>, appliedMigrations?: Set<string>): {
migrated: Record<string, unknown>;
changed: boolean;
newMigrations: string[];
};
+15
View File
@@ -0,0 +1,15 @@
export declare function fuzzyMatchModel(target: string, available: Set<string>, providers?: string[]): string | null;
/**
* Check if a target model is available (fuzzy match by model name, no provider filtering)
*
* @param targetModel - Model name to check (e.g., "gpt-5.3-codex")
* @param availableModels - Set of available models in "provider/model" format
* @returns true if model is available, false otherwise
*/
export declare function isModelAvailable(targetModel: string, availableModels: Set<string>): boolean;
export declare function getConnectedProviders(client: any): Promise<string[]>;
export declare function fetchAvailableModels(client?: any, options?: {
connectedProviders?: string[] | null;
}): Promise<Set<string>>;
export declare function __resetModelCache(): void;
export declare function isModelCacheAvailable(): boolean;
+32
View File
@@ -0,0 +1,32 @@
import type { FallbackEntry } from "./model-requirements";
export interface ErrorInfo {
name?: string;
message?: string;
}
/**
* Determines if an error is a retryable model error.
* Returns true if the error is a known retryable type OR matches retryable message patterns.
*/
export declare function isRetryableModelError(error: ErrorInfo): boolean;
/**
* Determines if an error should trigger a fallback retry.
* Returns true for deadstop errors that completely halt the action loop.
*/
export declare function shouldRetryError(error: ErrorInfo): boolean;
/**
* Gets the next fallback model from the chain based on attempt count.
* Returns undefined if all fallbacks have been exhausted.
*/
export declare function getNextFallback(fallbackChain: FallbackEntry[], attemptCount: number): FallbackEntry | undefined;
/**
* Checks if there are more fallbacks available after the current attempt.
*/
export declare function hasMoreFallbacks(fallbackChain: FallbackEntry[], attemptCount: number): boolean;
/**
* Selects the best provider for a fallback entry.
* Priority:
* 1) First connected provider in the entry's provider preference order
* 2) Preferred provider when connected (and entry providers are unavailable)
* 3) First provider listed in the fallback entry
*/
export declare function selectFallbackProvider(providers: string[], preferredProviderID?: string): string;
+7
View File
@@ -0,0 +1,7 @@
export declare function normalizeModelFormat(model: string | {
providerID: string;
modelID: string;
}): {
providerID: string;
modelID: string;
} | undefined;
+2
View File
@@ -0,0 +1,2 @@
export declare function normalizeModel(model?: string): string | undefined;
export declare function normalizeModelID(modelID: string): string;
+14
View File
@@ -0,0 +1,14 @@
export type FallbackEntry = {
providers: string[];
model: string;
variant?: string;
};
export type ModelRequirement = {
fallbackChain: FallbackEntry[];
variant?: string;
requiresModel?: string;
requiresAnyModel?: boolean;
requiresProvider?: string[];
};
export declare const AGENT_MODEL_REQUIREMENTS: Record<string, ModelRequirement>;
export declare const CATEGORY_MODEL_REQUIREMENTS: Record<string, ModelRequirement>;
+26
View File
@@ -0,0 +1,26 @@
import type { FallbackEntry } from "./model-requirements";
export type ModelResolutionRequest = {
intent?: {
uiSelectedModel?: string;
userModel?: string;
userFallbackModels?: string[];
categoryDefaultModel?: string;
};
constraints: {
availableModels: Set<string>;
connectedProviders?: string[] | null;
};
policy?: {
fallbackChain?: FallbackEntry[];
systemDefaultModel?: string;
};
};
export type ModelResolutionProvenance = "override" | "category-default" | "provider-fallback" | "system-default";
export type ModelResolutionResult = {
model: string;
provenance: ModelResolutionProvenance;
variant?: string;
attempted?: string[];
reason?: string;
};
export declare function resolveModelPipeline(request: ModelResolutionRequest): ModelResolutionResult | undefined;
+23
View File
@@ -0,0 +1,23 @@
import type { FallbackEntry } from "./model-requirements";
export type ModelResolutionRequest = {
intent?: {
uiSelectedModel?: string;
userModel?: string;
categoryDefaultModel?: string;
};
constraints: {
availableModels: Set<string>;
};
policy?: {
fallbackChain?: FallbackEntry[];
systemDefaultModel?: string;
};
};
export type ModelResolutionProvenance = "override" | "category-default" | "provider-fallback" | "system-default";
export type ModelResolutionResult = {
model: string;
provenance: ModelResolutionProvenance;
variant?: string;
attempted?: string[];
reason?: string;
};
+28
View File
@@ -0,0 +1,28 @@
import type { FallbackEntry } from "./model-requirements";
export type ModelResolutionInput = {
userModel?: string;
inheritedModel?: string;
systemDefault?: string;
};
export type ModelSource = "override" | "category-default" | "provider-fallback" | "system-default";
export type ModelResolutionResult = {
model: string;
source: ModelSource;
variant?: string;
};
export type ExtendedModelResolutionInput = {
uiSelectedModel?: string;
userModel?: string;
userFallbackModels?: string[];
categoryDefaultModel?: string;
fallbackChain?: FallbackEntry[];
availableModels: Set<string>;
systemDefaultModel?: string;
};
export declare function resolveModel(input: ModelResolutionInput): string | undefined;
export declare function resolveModelWithFallback(input: ExtendedModelResolutionInput): ModelResolutionResult | undefined;
/**
* Normalizes fallback_models config (which can be string or string[]) to string[]
* Centralized helper to avoid duplicated normalization logic
*/
export declare function normalizeFallbackModels(models: string | string[] | undefined): string[] | undefined;
+3
View File
@@ -0,0 +1,3 @@
type CommandSource = "claude-code" | "opencode";
export declare function sanitizeModelField(model: unknown, source?: CommandSource): string | undefined;
export {};
+36
View File
@@ -0,0 +1,36 @@
import type { createOpencodeClient } from "@opencode-ai/sdk";
import { type PromptRetryOptions } from "./prompt-timeout-context";
type Client = ReturnType<typeof createOpencodeClient>;
export interface ModelSuggestionInfo {
providerID: string;
modelID: string;
suggestion: string;
}
export declare function parseModelSuggestion(error: unknown): ModelSuggestionInfo | null;
interface PromptBody {
model?: {
providerID: string;
modelID: string;
};
[key: string]: unknown;
}
interface PromptArgs {
path: {
id: string;
};
body: PromptBody;
signal?: AbortSignal;
[key: string]: unknown;
}
export declare function promptWithModelSuggestionRetry(client: Client, args: PromptArgs, options?: PromptRetryOptions): Promise<void>;
/**
* Synchronous variant of promptWithModelSuggestionRetry.
*
* Uses `session.prompt` (blocking HTTP call that waits for the LLM response)
* instead of `promptAsync` (fire-and-forget HTTP 204).
*
* Required by callers that need the response to be available immediately after
* the call returns — e.g. look_at, which reads session messages right away.
*/
export declare function promptSyncWithModelSuggestionRetry(client: Client, args: PromptArgs, options?: PromptRetryOptions): Promise<void>;
export {};
+4
View File
@@ -0,0 +1,4 @@
export interface NormalizeSDKResponseOptions {
preferResponseOnMissingData?: boolean;
}
export declare function normalizeSDKResponse<TData>(response: unknown, fallback: TData, options?: NormalizeSDKResponseOptions): TData;
+3
View File
@@ -0,0 +1,3 @@
import type { OpenCodeConfigDirOptions } from "./opencode-config-dir-types";
export declare function getOpenCodeCommandDirs(options: OpenCodeConfigDirOptions): string[];
export declare function getOpenCodeSkillDirs(options: OpenCodeConfigDirOptions): string[];
+13
View File
@@ -0,0 +1,13 @@
export type OpenCodeBinaryType = "opencode" | "opencode-desktop";
export type OpenCodeConfigDirOptions = {
binary: OpenCodeBinaryType;
version?: string | null;
checkExisting?: boolean;
};
export type OpenCodeConfigPaths = {
configDir: string;
configJson: string;
configJsonc: string;
packageJson: string;
omoConfig: string;
};
+8
View File
@@ -0,0 +1,8 @@
import type { OpenCodeBinaryType, OpenCodeConfigDirOptions, OpenCodeConfigPaths } from "./opencode-config-dir-types";
export type { OpenCodeBinaryType, OpenCodeConfigDirOptions, OpenCodeConfigPaths, } from "./opencode-config-dir-types";
export declare const TAURI_APP_IDENTIFIER = "ai.opencode.desktop";
export declare const TAURI_APP_IDENTIFIER_DEV = "ai.opencode.desktop.dev";
export declare function isDevBuild(version: string | null | undefined): boolean;
export declare function getOpenCodeConfigDir(options: OpenCodeConfigDirOptions): string;
export declare function getOpenCodeConfigPaths(options: OpenCodeConfigDirOptions): OpenCodeConfigPaths;
export declare function detectExistingConfigDir(binary: OpenCodeBinaryType, version?: string | null): string | null;
+3
View File
@@ -0,0 +1,3 @@
export declare function getServerBaseUrl(client: unknown): string | null;
export declare function patchPart(client: unknown, sessionID: string, messageID: string, partID: string, body: Record<string, unknown>): Promise<boolean>;
export declare function deletePart(client: unknown, sessionID: string, messageID: string, partID: string): Promise<boolean>;
+1
View File
@@ -0,0 +1 @@
export declare function getMessageDir(sessionID: string): string | null;
+19
View File
@@ -0,0 +1,19 @@
/**
* Builds HTTP Basic Auth header from environment variables.
*
* @returns Basic Auth header string, or undefined if OPENCODE_SERVER_PASSWORD is not set
*/
export declare function getServerBasicAuthHeader(): string | undefined;
/**
* Injects HTTP Basic Auth header into the OpenCode SDK client.
*
* This function accesses the SDK's internal `_client.setConfig()` method.
* While `_client` has an underscore prefix (suggesting internal use), this is actually
* a stable public API from `@hey-api/openapi-ts` generated client:
* - `setConfig()` MERGES headers (does not replace existing ones)
* - This is the documented way to update client config at runtime
*
* @see https://github.com/sst/opencode/blob/main/packages/sdk/js/src/gen/client/client.gen.ts
* @throws {Error} If OPENCODE_SERVER_PASSWORD is set but client structure is incompatible
*/
export declare function injectServerAuthIntoClient(client: unknown): void;
+2
View File
@@ -0,0 +1,2 @@
export declare function isSqliteBackend(): boolean;
export declare function resetSqliteBackendCache(): void;
+4
View File
@@ -0,0 +1,4 @@
export declare const OPENCODE_STORAGE: string;
export declare const MESSAGE_STORAGE: string;
export declare const PART_STORAGE: string;
export declare const SESSION_STORAGE: string;
+24
View File
@@ -0,0 +1,24 @@
/**
* Minimum OpenCode version required for this plugin.
* This plugin only supports OpenCode 1.1.1+ which uses the permission system.
*/
export declare const MINIMUM_OPENCODE_VERSION = "1.1.1";
/**
* OpenCode version that introduced native AGENTS.md injection.
* PR #10678 merged on Jan 26, 2026 - OpenCode now dynamically resolves
* AGENTS.md files from subdirectories as the agent explores them.
* When this version is detected, the directory-agents-injector hook
* is auto-disabled to prevent duplicate AGENTS.md loading.
*/
export declare const OPENCODE_NATIVE_AGENTS_INJECTION_VERSION = "1.1.37";
/**
* OpenCode version that introduced SQLite backend for storage.
* When this version is detected AND opencode.db exists, SQLite backend is used.
*/
export declare const OPENCODE_SQLITE_VERSION = "1.1.53";
export declare function parseVersion(version: string): number[];
export declare function compareVersions(a: string, b: string): -1 | 0 | 1;
export declare function getOpenCodeVersion(): string | null;
export declare function isOpenCodeVersionAtLeast(version: string): boolean;
export declare function resetVersionCache(): void;
export declare function setVersionCache(version: string | null): void;
+3
View File
@@ -0,0 +1,3 @@
import type { ClaudeHooksConfig, HookMatcher } from "../hooks/claude-code-hooks/types";
export declare function matchesToolMatcher(toolName: string, matcher: string): boolean;
export declare function findMatchingHooks(config: ClaudeHooksConfig, eventName: keyof ClaudeHooksConfig, toolName?: string): HookMatcher[];
+27
View File
@@ -0,0 +1,27 @@
/**
* Permission system utilities for OpenCode 1.1.1+.
* This module only supports the new permission format.
*/
export type PermissionValue = "ask" | "allow" | "deny";
export interface PermissionFormat {
permission: Record<string, PermissionValue>;
}
/**
* Creates tool restrictions that deny specified tools.
*/
export declare function createAgentToolRestrictions(denyTools: string[]): PermissionFormat;
/**
* Creates tool restrictions that ONLY allow specified tools.
* All other tools are denied by default using `*: deny` pattern.
*/
export declare function createAgentToolAllowlist(allowTools: string[]): PermissionFormat;
/**
* Converts legacy tools format to permission format.
* For migrating user configs from older versions.
*/
export declare function migrateToolsToPermission(tools: Record<string, boolean>): Record<string, PermissionValue>;
/**
* Migrates agent config from legacy tools format to permission format.
* If config has `tools`, converts to `permission`.
*/
export declare function migrateAgentConfig(config: Record<string, unknown>): Record<string, unknown>;
+6
View File
@@ -0,0 +1,6 @@
import type { CommandDefinition } from "../features/claude-code-command-loader/types";
export interface PluginCommandDiscoveryOptions {
pluginsEnabled?: boolean;
enabledPluginsOverride?: Record<string, boolean>;
}
export declare function discoverPluginCommandDefinitions(options?: PluginCommandDiscoveryOptions): Record<string, CommandDefinition>;
+7
View File
@@ -0,0 +1,7 @@
export declare const PLUGIN_NAME = "oh-my-openagent";
export declare const LEGACY_PLUGIN_NAME = "oh-my-opencode";
export declare const CONFIG_BASENAME = "oh-my-openagent";
export declare const LEGACY_CONFIG_BASENAME = "oh-my-opencode";
export declare const LOG_FILENAME = "oh-my-openagent.log";
export declare const CACHE_DIR_NAME = "oh-my-openagent";
export declare const LEGACY_CACHE_DIR_NAME = "oh-my-opencode";
+9
View File
@@ -0,0 +1,9 @@
declare const DEFAULT_SERVER_PORT = 4096;
export declare function isPortAvailable(port: number, hostname?: string): Promise<boolean>;
export declare function findAvailablePort(startPort?: number, hostname?: string): Promise<number>;
export interface AutoPortResult {
port: number;
wasAutoSelected: boolean;
}
export declare function getAvailableServerPort(preferredPort?: number, hostname?: string): Promise<AutoPortResult>;
export { DEFAULT_SERVER_PORT };
+12
View File
@@ -0,0 +1,12 @@
export interface PromptTimeoutArgs {
signal?: AbortSignal;
}
export interface PromptRetryOptions {
timeoutMs?: number;
}
export declare const PROMPT_TIMEOUT_MS = 120000;
export declare function createPromptTimeoutContext(args: PromptTimeoutArgs, timeoutMs: number): {
signal: AbortSignal;
wasTimedOut: () => boolean;
cleanup: () => void;
};
+3
View File
@@ -0,0 +1,3 @@
export type PromptToolPermission = boolean | "allow" | "deny" | "ask";
export declare function normalizePromptTools(tools: Record<string, PromptToolPermission> | undefined): Record<string, boolean> | undefined;
export declare function resolveInheritedPromptTools(sessionID: string, fallbackTools?: Record<string, PromptToolPermission>): Record<string, boolean> | undefined;
+1
View File
@@ -0,0 +1 @@
export declare function transformModelForProvider(provider: string, model: string): string;
+6
View File
@@ -0,0 +1,6 @@
export type SessionPermissionRule = {
permission: string;
action: "allow" | "deny";
pattern: string;
};
export declare const QUESTION_DENIED_SESSION_PERMISSION: SessionPermissionRule[];
+1
View File
@@ -0,0 +1 @@
export declare function isRecord(value: unknown): value is Record<string, unknown>;
+2
View File
@@ -0,0 +1,2 @@
export declare function normalizeRetryStatusMessage(message: string): string;
export declare function extractRetryAttempt(statusAttempt: unknown, message: string): string;
+5
View File
@@ -0,0 +1,5 @@
interface SafeCreateHookOptions {
enabled?: boolean;
}
export declare function safeCreateHook<T>(name: string, factory: () => T, options?: SafeCreateHookOptions): T | null;
export {};
+32
View File
@@ -0,0 +1,32 @@
/**
* Session Category Registry
*
* Maintains a mapping of session IDs to their assigned categories.
* Used by runtime-fallback hook to lookup category-specific fallback_models.
*/
export declare const SessionCategoryRegistry: {
/**
* Register a session with its category
*/
register: (sessionID: string, category: string) => void;
/**
* Get the category for a session
*/
get: (sessionID: string) => string | undefined;
/**
* Remove a session from the registry (cleanup)
*/
remove: (sessionID: string) => void;
/**
* Check if a session is registered
*/
has: (sessionID: string) => boolean;
/**
* Get the size of the registry (for debugging)
*/
size: () => number;
/**
* Clear all entries (use with caution, mainly for testing)
*/
clear: () => void;
};
+13
View File
@@ -0,0 +1,13 @@
type MessageTime = {
created?: number | string;
} | number | string | undefined;
type MessageInfo = {
id?: string;
time?: MessageTime;
};
export type CursorMessage = {
info?: MessageInfo;
};
export declare function consumeNewMessages<T extends CursorMessage>(sessionID: string | undefined, messages: T[]): T[];
export declare function resetMessageCursor(sessionID?: string): void;
export {};
+7
View File
@@ -0,0 +1,7 @@
export declare function isWindowsAppDataDirectory(directory: string): boolean;
export declare function resolveSessionDirectory(options: {
parentDirectory: string | null | undefined;
fallbackDirectory: string;
platform?: NodeJS.Platform;
currentWorkingDirectory?: string;
}): string;
+10
View File
@@ -0,0 +1,10 @@
export interface InjectedPathsData {
sessionID: string;
injectedPaths: string[];
updatedAt: number;
}
export declare function createInjectedPathsStorage(storageDir: string): {
loadInjectedPaths: (sessionID: string) => Set<string>;
saveInjectedPaths: (sessionID: string, paths: Set<string>) => void;
clearInjectedPaths: (sessionID: string) => void;
};
+7
View File
@@ -0,0 +1,7 @@
export type SessionModel = {
providerID: string;
modelID: string;
};
export declare function setSessionModel(sessionID: string, model: SessionModel): void;
export declare function getSessionModel(sessionID: string): SessionModel | undefined;
export declare function clearSessionModel(sessionID: string): void;
+4
View File
@@ -0,0 +1,4 @@
export declare function setSessionTools(sessionID: string, tools: Record<string, boolean>): void;
export declare function getSessionTools(sessionID: string): Record<string, boolean> | undefined;
export declare function deleteSessionTools(sessionID: string): void;
export declare function clearSessionTools(): void;
+2
View File
@@ -0,0 +1,2 @@
import type { PluginInput } from "@opencode-ai/plugin";
export declare function isCallerOrchestrator(sessionID?: string, client?: PluginInput["client"]): Promise<boolean>;
+41
View File
@@ -0,0 +1,41 @@
export type ShellType = "unix" | "powershell" | "cmd";
/**
* Detect the current shell type based on environment variables.
*
* Detection priority:
* 1. PSModulePath → PowerShell
* 2. SHELL env var → Unix shell
* 3. Platform fallback → win32: cmd, others: unix
*/
export declare function detectShellType(): ShellType;
/**
* Shell-escape a value for use in environment variable assignment.
*
* @param value - The value to escape
* @param shellType - The target shell type
* @returns Escaped value appropriate for the shell
*/
export declare function shellEscape(value: string, shellType: ShellType): string;
/**
* Build environment variable prefix command for the target shell.
*
* @param env - Record of environment variables to set
* @param shellType - The target shell type
* @returns Command prefix string to prepend to the actual command
*
* @example
* ```ts
* // Unix: "export VAR1=val1 VAR2=val2; command"
* buildEnvPrefix({ VAR1: "val1", VAR2: "val2" }, "unix")
* // => "export VAR1=val1 VAR2=val2;"
*
* // PowerShell: "$env:VAR1='val1'; $env:VAR2='val2'; command"
* buildEnvPrefix({ VAR1: "val1", VAR2: "val2" }, "powershell")
* // => "$env:VAR1='val1'; $env:VAR2='val2';"
*
* // cmd.exe: "set VAR1=val1 && set VAR2=val2 && command"
* buildEnvPrefix({ VAR1: "val1", VAR2: "val2" }, "cmd")
* // => "set VAR1=\"val1\" && set VAR2=\"val2\" &&"
* ```
*/
export declare function buildEnvPrefix(env: Record<string, string>, shellType: ShellType): string;
+9
View File
@@ -0,0 +1,9 @@
/**
* Resolves @path references in skill content to absolute paths.
*
* Matches @references that contain at least one slash (e.g., @scripts/search.py, @data/)
* to avoid false positives with decorators (@param), JSDoc tags (@ts-ignore), etc.
*
* Email addresses are excluded since they have alphanumeric characters before @.
*/
export declare function resolveSkillPathReferences(content: string, basePath: string): string;
+5
View File
@@ -0,0 +1,5 @@
export declare function camelToSnake(str: string): string;
export declare function snakeToCamel(str: string): string;
export declare function transformObjectKeys(obj: Record<string, unknown>, transformer: (key: string) => string, deep?: boolean): Record<string, unknown>;
export declare function objectToSnakeCase(obj: Record<string, unknown>, deep?: boolean): Record<string, unknown>;
export declare function objectToCamelCase(obj: Record<string, unknown>, deep?: boolean): Record<string, unknown>;
+15
View File
@@ -0,0 +1,15 @@
export interface SpawnOptions {
cwd?: string;
env?: Record<string, string | undefined>;
stdin?: "pipe" | "inherit" | "ignore";
stdout?: "pipe" | "inherit" | "ignore";
stderr?: "pipe" | "inherit" | "ignore";
}
export interface SpawnedProcess {
readonly exitCode: number | null;
readonly exited: Promise<number>;
readonly stdout: ReadableStream<Uint8Array> | undefined;
readonly stderr: ReadableStream<Uint8Array> | undefined;
kill(signal?: NodeJS.Signals): void;
}
export declare function spawnWithWindowsHide(command: string[], options: SpawnOptions): SpawnedProcess;
+45
View File
@@ -0,0 +1,45 @@
/**
* Unified system directive prefix for oh-my-opencode internal messages.
* All system-generated messages should use this prefix for consistent filtering.
*
* Format: [SYSTEM DIRECTIVE: OH-MY-OPENCODE - {TYPE}]
*/
export declare const SYSTEM_DIRECTIVE_PREFIX = "[SYSTEM DIRECTIVE: OH-MY-OPENCODE";
/**
* Creates a system directive header with the given type.
* @param type - The directive type (e.g., "TODO CONTINUATION", "RALPH LOOP")
* @returns Formatted directive string like "[SYSTEM DIRECTIVE: OH-MY-OPENCODE - TODO CONTINUATION]"
*/
export declare function createSystemDirective(type: string): string;
/**
* Checks if a message starts with the oh-my-opencode system directive prefix.
* Used by keyword-detector and other hooks to skip system-generated messages.
* @param text - The message text to check
* @returns true if the message is a system directive
*/
export declare function isSystemDirective(text: string): boolean;
/**
* Checks if a message contains system-generated content that should be excluded
* from keyword detection and mode triggering.
* @param text - The message text to check
* @returns true if the message contains system-reminder tags
*/
export declare function hasSystemReminder(text: string): boolean;
/**
* Removes system-reminder tag content from text.
* This prevents automated system messages from triggering mode keywords.
* @param text - The message text to clean
* @returns text with system-reminder content removed
*/
export declare function removeSystemReminders(text: string): string;
export declare const SystemDirectiveTypes: {
readonly TODO_CONTINUATION: "TODO CONTINUATION";
readonly RALPH_LOOP: "RALPH LOOP";
readonly BOULDER_CONTINUATION: "BOULDER CONTINUATION";
readonly DELEGATION_REQUIRED: "DELEGATION REQUIRED";
readonly SINGLE_TASK_ONLY: "SINGLE TASK ONLY";
readonly COMPACTION_CONTEXT: "COMPACTION CONTEXT";
readonly CONTEXT_WINDOW_MONITOR: "CONTEXT WINDOW MONITOR";
readonly PROMETHEUS_READ_ONLY: "PROMETHEUS READ-ONLY";
};
export type SystemDirectiveType = (typeof SystemDirectiveTypes)[keyof typeof SystemDirectiveTypes];
+5
View File
@@ -0,0 +1,5 @@
export declare const POLL_INTERVAL_BACKGROUND_MS = 2000;
export declare const SESSION_TIMEOUT_MS: number;
export declare const SESSION_MISSING_GRACE_MS = 6000;
export declare const SESSION_READY_POLL_INTERVAL_MS = 500;
export declare const SESSION_READY_TIMEOUT_MS = 10000;
+3
View File
@@ -0,0 +1,3 @@
export * from "./types";
export * from "./constants";
export * from "./tmux-utils";
+9
View File
@@ -0,0 +1,9 @@
export { isInsideTmux, getCurrentPaneId } from "./tmux-utils/environment";
export type { SplitDirection } from "./tmux-utils/environment";
export { isServerRunning, resetServerCheck } from "./tmux-utils/server-health";
export { getPaneDimensions } from "./tmux-utils/pane-dimensions";
export type { PaneDimensions } from "./tmux-utils/pane-dimensions";
export { spawnTmuxPane } from "./tmux-utils/pane-spawn";
export { closeTmuxPane } from "./tmux-utils/pane-close";
export { replaceTmuxPane } from "./tmux-utils/pane-replace";
export { applyLayout, enforceMainPaneWidth } from "./tmux-utils/layout";
+3
View File
@@ -0,0 +1,3 @@
export type SplitDirection = "-h" | "-v";
export declare function isInsideTmux(): boolean;
export declare function getCurrentPaneId(): string | undefined;
+18
View File
@@ -0,0 +1,18 @@
import type { TmuxLayout } from "../../../config/schema";
type TmuxSpawnCommand = (args: string[], options: {
stdout: "ignore";
stderr: "ignore";
}) => {
exited: Promise<number>;
};
interface LayoutDeps {
spawnCommand?: TmuxSpawnCommand;
}
interface MainPaneWidthOptions {
mainPaneSize?: number;
mainPaneMinWidth?: number;
agentPaneMinWidth?: number;
}
export declare function applyLayout(tmux: string, layout: TmuxLayout, mainPaneSize: number, deps?: LayoutDeps): Promise<void>;
export declare function enforceMainPaneWidth(mainPaneId: string, windowWidth: number, mainPaneSizeOrOptions?: number | MainPaneWidthOptions): Promise<void>;
export {};
+1
View File
@@ -0,0 +1 @@
export declare function closeTmuxPane(paneId: string): Promise<boolean>;
+5
View File
@@ -0,0 +1,5 @@
export interface PaneDimensions {
paneWidth: number;
windowWidth: number;
}
export declare function getPaneDimensions(paneId: string): Promise<PaneDimensions | null>;
+3
View File
@@ -0,0 +1,3 @@
import type { TmuxConfig } from "../../../config/schema";
import type { SpawnPaneResult } from "../types";
export declare function replaceTmuxPane(paneId: string, sessionId: string, description: string, config: TmuxConfig, serverUrl: string): Promise<SpawnPaneResult>;
+4
View File
@@ -0,0 +1,4 @@
import type { TmuxConfig } from "../../../config/schema";
import type { SpawnPaneResult } from "../types";
import type { SplitDirection } from "./environment";
export declare function spawnTmuxPane(sessionId: string, description: string, config: TmuxConfig, serverUrl: string, targetPaneId?: string, splitDirection?: SplitDirection): Promise<SpawnPaneResult>;
+2
View File
@@ -0,0 +1,2 @@
export declare function isServerRunning(serverUrl: string): Promise<boolean>;
export declare function resetServerCheck(): void;

Some files were not shown because too many files have changed in this diff Show More