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
+2
View File
@@ -0,0 +1,2 @@
import type { InstallArgs } from "./types";
export declare function runCliInstaller(args: InstallArgs, version: string): Promise<number>;
+1
View File
@@ -0,0 +1 @@
export declare function runCli(): void;
+11
View File
@@ -0,0 +1,11 @@
export type { ConfigContext } from "./config-manager/config-context";
export { initConfigContext, getConfigContext, resetConfigContext, } from "./config-manager/config-context";
export { fetchNpmDistTags } from "./config-manager/npm-dist-tags";
export { getPluginNameWithVersion } from "./config-manager/plugin-name-with-version";
export { addPluginToOpenCodeConfig } from "./config-manager/add-plugin-to-opencode-config";
export { generateOmoConfig } from "./config-manager/generate-omo-config";
export { writeOmoConfig } from "./config-manager/write-omo-config";
export { isOpenCodeInstalled, getOpenCodeVersion } from "./config-manager/opencode-binary";
export { detectCurrentConfig } from "./config-manager/detect-current-config";
export type { BunInstallResult } from "./config-manager/bun-install";
export { runBunInstall, runBunInstallWithDetails } from "./config-manager/bun-install";
@@ -0,0 +1,2 @@
import type { ConfigMergeResult } from "../types";
export declare function addPluginToOpenCodeConfig(currentVersion: string): Promise<ConfigMergeResult>;
+12
View File
@@ -0,0 +1,12 @@
type BunInstallOutputMode = "inherit" | "pipe";
interface RunBunInstallOptions {
outputMode?: BunInstallOutputMode;
}
export interface BunInstallResult {
success: boolean;
timedOut?: boolean;
error?: string;
}
export declare function runBunInstall(): Promise<boolean>;
export declare function runBunInstallWithDetails(options?: RunBunInstallOptions): Promise<BunInstallResult>;
export {};
+13
View File
@@ -0,0 +1,13 @@
import type { OpenCodeBinaryType, OpenCodeConfigPaths } from "../../shared/opencode-config-dir-types";
export interface ConfigContext {
binary: OpenCodeBinaryType;
version: string | null;
paths: OpenCodeConfigPaths;
}
export declare function initConfigContext(binary: OpenCodeBinaryType, version: string | null): void;
export declare function getConfigContext(): ConfigContext;
export declare function resetConfigContext(): void;
export declare function getConfigDir(): string;
export declare function getConfigJson(): string;
export declare function getConfigJsonc(): string;
export declare function getOmoConfigPath(): string;
+1
View File
@@ -0,0 +1 @@
export declare function deepMergeRecord<TTarget extends Record<string, unknown>>(target: TTarget, source: Partial<TTarget>): TTarget;
+2
View File
@@ -0,0 +1,2 @@
import type { DetectedConfig } from "../types";
export declare function detectCurrentConfig(): DetectedConfig;
@@ -0,0 +1 @@
export declare function ensureConfigDirectoryExists(): void;
@@ -0,0 +1 @@
export declare function formatErrorWithSuggestion(err: unknown, context: string): string;
+2
View File
@@ -0,0 +1,2 @@
import type { InstallConfig } from "../types";
export declare function generateOmoConfig(installConfig: InstallConfig): Record<string, unknown>;
+7
View File
@@ -0,0 +1,7 @@
export interface NpmDistTags {
latest?: string;
beta?: string;
next?: string;
[tag: string]: string | undefined;
}
export declare function fetchNpmDistTags(packageName: string): Promise<NpmDistTags | null>;
+2
View File
@@ -0,0 +1,2 @@
export declare function isOpenCodeInstalled(): Promise<boolean>;
export declare function getOpenCodeVersion(): Promise<string | null>;
+5
View File
@@ -0,0 +1,5 @@
export type ConfigFormat = "json" | "jsonc" | "none";
export declare function detectConfigFormat(): {
format: ConfigFormat;
path: string;
};
+10
View File
@@ -0,0 +1,10 @@
interface ParseConfigResult {
config: OpenCodeConfig | null;
error?: string;
}
export interface OpenCodeConfig {
plugin?: string[];
[key: string]: unknown;
}
export declare function parseOpenCodeConfigFileWithError(path: string): ParseConfigResult;
export {};
+1
View File
@@ -0,0 +1 @@
export declare function getPluginNameWithVersion(currentVersion: string, packageName?: string): Promise<string>;
+2
View File
@@ -0,0 +1,2 @@
import type { ConfigMergeResult, InstallConfig } from "../types";
export declare function writeOmoConfig(installConfig: InstallConfig): ConfigMergeResult;
+2
View File
@@ -0,0 +1,2 @@
import type { CheckResult } from "../types";
export declare function checkConfig(): Promise<CheckResult>;
+4
View File
@@ -0,0 +1,4 @@
import type { DependencyInfo } from "../types";
export declare function checkAstGrepCli(): Promise<DependencyInfo>;
export declare function checkAstGrepNapi(): Promise<DependencyInfo>;
export declare function checkCommentChecker(): Promise<DependencyInfo>;
+7
View File
@@ -0,0 +1,7 @@
import type { CheckDefinition } from "../types";
import { gatherSystemInfo } from "./system";
import { gatherToolsSummary } from "./tools";
export type { CheckDefinition };
export * from "./model-resolution-types";
export { gatherSystemInfo, gatherToolsSummary };
export declare function getAllCheckDefinitions(): CheckDefinition[];
+2
View File
@@ -0,0 +1,2 @@
import type { AvailableModelsInfo } from "./model-resolution-types";
export declare function loadAvailableModelsFromCache(): AvailableModelsInfo;
+2
View File
@@ -0,0 +1,2 @@
import type { OmoConfig } from "./model-resolution-types";
export declare function loadOmoConfig(): OmoConfig | null;
+6
View File
@@ -0,0 +1,6 @@
import type { AvailableModelsInfo, ModelResolutionInfo, OmoConfig } from "./model-resolution-types";
export declare function buildModelResolutionDetails(options: {
info: ModelResolutionInfo;
available: AvailableModelsInfo;
config: OmoConfig;
}): string[];
@@ -0,0 +1,3 @@
import type { ModelRequirement } from "../../../shared/model-requirements";
export declare function getEffectiveModel(requirement: ModelRequirement, userOverride?: string): string;
export declare function buildEffectiveResolution(requirement: ModelRequirement, userOverride?: string): string;
+37
View File
@@ -0,0 +1,37 @@
import type { ModelRequirement } from "../../../shared/model-requirements";
export interface AgentResolutionInfo {
name: string;
requirement: ModelRequirement;
userOverride?: string;
userVariant?: string;
effectiveModel: string;
effectiveResolution: string;
}
export interface CategoryResolutionInfo {
name: string;
requirement: ModelRequirement;
userOverride?: string;
userVariant?: string;
effectiveModel: string;
effectiveResolution: string;
}
export interface ModelResolutionInfo {
agents: AgentResolutionInfo[];
categories: CategoryResolutionInfo[];
}
export interface OmoConfig {
agents?: Record<string, {
model?: string;
variant?: string;
category?: string;
}>;
categories?: Record<string, {
model?: string;
variant?: string;
}>;
}
export interface AvailableModelsInfo {
providers: string[];
modelCount: number;
cacheExists: boolean;
}
+5
View File
@@ -0,0 +1,5 @@
import type { ModelRequirement } from "../../../shared/model-requirements";
import type { OmoConfig } from "./model-resolution-types";
export declare function formatModelWithVariant(model: string, variant?: string): string;
export declare function getEffectiveVariant(agentName: string, requirement: ModelRequirement, config: OmoConfig): string | undefined;
export declare function getCategoryEffectiveVariant(categoryName: string, requirement: ModelRequirement, config: OmoConfig): string | undefined;
+6
View File
@@ -0,0 +1,6 @@
import type { CheckResult } from "../types";
import type { ModelResolutionInfo, OmoConfig } from "./model-resolution-types";
export declare function getModelResolutionInfo(): ModelResolutionInfo;
export declare function getModelResolutionInfoWithOverrides(config: OmoConfig): ModelResolutionInfo;
export declare function checkModels(): Promise<CheckResult>;
export declare const checkModelResolution: typeof checkModels;
+13
View File
@@ -0,0 +1,13 @@
export interface OpenCodeBinaryInfo {
binary: string;
path: string;
}
export declare function getDesktopAppPaths(platform: NodeJS.Platform): string[];
export declare function getBinaryLookupCommand(platform: NodeJS.Platform): "which" | "where";
export declare function parseBinaryPaths(output: string): string[];
export declare function selectBinaryPath(paths: string[], platform: NodeJS.Platform): string | null;
export declare function buildVersionCommand(binaryPath: string, platform: NodeJS.Platform): string[];
export declare function findDesktopBinary(platform?: NodeJS.Platform, checkExists?: (path: string) => boolean): OpenCodeBinaryInfo | null;
export declare function findOpenCodeBinary(): Promise<OpenCodeBinaryInfo | null>;
export declare function getOpenCodeVersion(binaryPath: string, platform?: NodeJS.Platform): Promise<string | null>;
export declare function compareVersions(current: string, minimum: string): boolean;
+10
View File
@@ -0,0 +1,10 @@
export interface LoadedVersionInfo {
cacheDir: string;
cachePackagePath: string;
installedPackagePath: string;
expectedVersion: string | null;
loadedVersion: string | null;
}
export declare function getLoadedPluginVersion(): LoadedVersionInfo;
export declare function getLatestPluginVersion(currentVersion: string | null): Promise<string | null>;
export declare function getSuggestedInstallTag(currentVersion: string | null): string;
+15
View File
@@ -0,0 +1,15 @@
export interface PluginInfo {
registered: boolean;
configPath: string | null;
entry: string | null;
isPinned: boolean;
pinnedVersion: string | null;
isLocalDev: boolean;
}
declare function detectConfigPath(): string | null;
declare function findPluginEntry(entries: string[]): {
entry: string;
isLocalDev: boolean;
} | null;
export declare function getPluginInfo(): PluginInfo;
export { detectConfigPath, findPluginEntry };
+3
View File
@@ -0,0 +1,3 @@
import type { CheckResult, SystemInfo } from "../types";
export declare function gatherSystemInfo(): Promise<SystemInfo>;
export declare function checkSystem(): Promise<CheckResult>;
+10
View File
@@ -0,0 +1,10 @@
export interface GhCliInfo {
installed: boolean;
version: string | null;
path: string | null;
authenticated: boolean;
username: string | null;
scopes: string[];
error: string | null;
}
export declare function getGhCliInfo(): Promise<GhCliInfo>;
+6
View File
@@ -0,0 +1,6 @@
import type { LspServerInfo } from "../types";
export declare function getLspServersInfo(): LspServerInfo[];
export declare function getLspServerStats(servers: LspServerInfo[]): {
installed: number;
total: number;
};
+3
View File
@@ -0,0 +1,3 @@
import type { McpServerInfo } from "../types";
export declare function getBuiltinMcpInfo(): McpServerInfo[];
export declare function getUserMcpInfo(): McpServerInfo[];
+3
View File
@@ -0,0 +1,3 @@
import type { CheckResult, ToolsSummary } from "../types";
export declare function gatherToolsSummary(): Promise<ToolsSummary>;
export declare function checkTools(): Promise<CheckResult>;
+29
View File
@@ -0,0 +1,29 @@
export declare const SYMBOLS: {
readonly check: string;
readonly cross: string;
readonly warn: string;
readonly info: string;
readonly arrow: string;
readonly bullet: string;
readonly skip: string;
};
export declare const STATUS_COLORS: {
readonly pass: import("picocolors/types").Formatter;
readonly fail: import("picocolors/types").Formatter;
readonly warn: import("picocolors/types").Formatter;
readonly skip: import("picocolors/types").Formatter;
};
export declare const CHECK_IDS: {
readonly SYSTEM: "system";
readonly CONFIG: "config";
readonly TOOLS: "tools";
readonly MODELS: "models";
};
export declare const CHECK_NAMES: Record<string, string>;
export declare const EXIT_CODES: {
readonly SUCCESS: 0;
readonly FAILURE: 1;
};
export declare const MIN_OPENCODE_VERSION = "1.0.150";
export declare const PACKAGE_NAME = "oh-my-opencode";
export declare const OPENCODE_BINARIES: readonly ["opencode", "opencode-desktop"];
+2
View File
@@ -0,0 +1,2 @@
import type { DoctorResult } from "./types";
export declare function formatDefault(result: DoctorResult): string;
+6
View File
@@ -0,0 +1,6 @@
import type { CheckStatus, DoctorIssue } from "./types";
export declare function formatStatusSymbol(status: CheckStatus): string;
export declare function formatStatusMark(available: boolean): string;
export declare function stripAnsi(str: string): string;
export declare function formatHeader(): string;
export declare function formatIssue(issue: DoctorIssue, index: number): string;
+2
View File
@@ -0,0 +1,2 @@
import type { DoctorResult } from "./types";
export declare function formatStatus(result: DoctorResult): string;
+2
View File
@@ -0,0 +1,2 @@
import type { DoctorResult } from "./types";
export declare function formatVerbose(result: DoctorResult): string;
+3
View File
@@ -0,0 +1,3 @@
import type { DoctorResult, DoctorMode } from "./types";
export declare function formatDoctorOutput(result: DoctorResult, mode: DoctorMode): string;
export declare function formatJsonOutput(result: DoctorResult): string;
+5
View File
@@ -0,0 +1,5 @@
import type { DoctorOptions } from "./types";
export declare function doctor(options?: DoctorOptions): Promise<number>;
export * from "./types";
export { runDoctor } from "./runner";
export { formatDoctorOutput, formatJsonOutput } from "./formatter";
+5
View File
@@ -0,0 +1,5 @@
import type { DoctorOptions, DoctorResult, CheckDefinition, CheckResult, DoctorSummary } from "./types";
export declare function runCheck(check: CheckDefinition): Promise<CheckResult>;
export declare function calculateSummary(results: CheckResult[], duration: number): DoctorSummary;
export declare function determineExitCode(results: CheckResult[]): number;
export declare function runDoctor(options: DoctorOptions): Promise<DoctorResult>;
+124
View File
@@ -0,0 +1,124 @@
export type DoctorMode = "default" | "status" | "verbose";
export interface DoctorOptions {
mode: DoctorMode;
json?: boolean;
}
export interface DoctorIssue {
title: string;
description: string;
fix?: string;
affects?: string[];
severity: "error" | "warning";
}
export type CheckStatus = "pass" | "fail" | "warn" | "skip";
export interface CheckResult {
name: string;
status: CheckStatus;
message: string;
details?: string[];
issues: DoctorIssue[];
duration?: number;
}
export type CheckFunction = () => Promise<CheckResult>;
export interface CheckDefinition {
id: string;
name: string;
check: CheckFunction;
critical?: boolean;
}
export interface SystemInfo {
opencodeVersion: string | null;
opencodePath: string | null;
pluginVersion: string | null;
loadedVersion: string | null;
bunVersion: string | null;
configPath: string | null;
configValid: boolean;
isLocalDev: boolean;
}
export interface ToolsSummary {
lspInstalled: number;
lspTotal: number;
astGrepCli: boolean;
astGrepNapi: boolean;
commentChecker: boolean;
ghCli: {
installed: boolean;
authenticated: boolean;
username: string | null;
};
mcpBuiltin: string[];
mcpUser: string[];
}
export interface DoctorSummary {
total: number;
passed: number;
failed: number;
warnings: number;
skipped: number;
duration: number;
}
export interface DoctorResult {
results: CheckResult[];
systemInfo: SystemInfo;
tools: ToolsSummary;
summary: DoctorSummary;
exitCode: number;
}
export type CheckCategory = "installation" | "configuration" | "authentication" | "dependencies" | "tools" | "updates";
export interface OpenCodeInfo {
installed: boolean;
version: string | null;
path: string | null;
binary: "opencode" | "opencode-desktop" | null;
}
export interface PluginInfo {
registered: boolean;
configPath: string | null;
entry: string | null;
isPinned: boolean;
pinnedVersion: string | null;
}
export interface ConfigInfo {
exists: boolean;
path: string | null;
format: "json" | "jsonc" | null;
valid: boolean;
errors: string[];
}
export type AuthProviderId = "anthropic" | "openai" | "google";
export interface AuthProviderInfo {
id: AuthProviderId;
name: string;
pluginInstalled: boolean;
configured: boolean;
error?: string;
}
export interface DependencyInfo {
name: string;
required: boolean;
installed: boolean;
version: string | null;
path: string | null;
installHint?: string;
}
export interface LspServerInfo {
id: string;
installed: boolean;
extensions: string[];
source: "builtin" | "config" | "plugin";
}
export interface McpServerInfo {
id: string;
type: "builtin" | "user";
enabled: boolean;
valid: boolean;
error?: string;
}
export interface VersionCheckInfo {
currentVersion: string | null;
latestVersion: string | null;
isUpToDate: boolean;
isLocalDev: boolean;
isPinned: boolean;
}
+10
View File
@@ -0,0 +1,10 @@
import type { FallbackEntry } from "../shared/model-requirements";
import type { ProviderAvailability } from "./model-fallback-types";
export declare function resolveModelFromChain(fallbackChain: FallbackEntry[], availability: ProviderAvailability): {
model: string;
variant?: string;
} | null;
export declare function getSisyphusFallbackChain(): FallbackEntry[];
export declare function isAnyFallbackEntryAvailable(fallbackChain: FallbackEntry[], availability: ProviderAvailability): boolean;
export declare function isRequiredModelAvailable(requiresModel: string, fallbackChain: FallbackEntry[], availability: ProviderAvailability): boolean;
export declare function isRequiredProviderAvailable(requiredProviders: string[], availability: ProviderAvailability): boolean;
+3
View File
@@ -0,0 +1,3 @@
import type { VersionInfo } from "./types";
export declare function formatVersionOutput(info: VersionInfo): string;
export declare function formatJsonOutput(info: VersionInfo): string;
+2
View File
@@ -0,0 +1,2 @@
import type { GetLocalVersionOptions } from "./types";
export declare function getLocalVersion(options?: GetLocalVersionOptions): Promise<number>;
+2
View File
@@ -0,0 +1,2 @@
export { getLocalVersion } from "./get-local-version";
export * from "./types";
+13
View File
@@ -0,0 +1,13 @@
export interface VersionInfo {
currentVersion: string | null;
latestVersion: string | null;
isUpToDate: boolean;
isLocalDev: boolean;
isPinned: boolean;
pinnedVersion: string | null;
status: "up-to-date" | "outdated" | "local-dev" | "pinned" | "error" | "unknown";
}
export interface GetLocalVersionOptions {
directory?: string;
json?: boolean;
}
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/env bun
export {};
Vendored Executable
+29782
View File
File diff suppressed because one or more lines are too long
+33
View File
@@ -0,0 +1,33 @@
import type { BooleanArg, ClaudeSubscription, DetectedConfig, InstallArgs, InstallConfig } from "./types";
export declare const SYMBOLS: {
check: string;
cross: string;
arrow: string;
bullet: string;
info: string;
warn: string;
star: string;
};
export declare function formatConfigSummary(config: InstallConfig): string;
export declare function printHeader(isUpdate: boolean): void;
export declare function printStep(step: number, total: number, message: string): void;
export declare function printSuccess(message: string): void;
export declare function printError(message: string): void;
export declare function printInfo(message: string): void;
export declare function printWarning(message: string): void;
export declare function printBox(content: string, title?: string): void;
export declare function validateNonTuiArgs(args: InstallArgs): {
valid: boolean;
errors: string[];
};
export declare function argsToConfig(args: InstallArgs): InstallConfig;
export declare function detectedToInitialValues(detected: DetectedConfig): {
claude: ClaudeSubscription;
openai: BooleanArg;
gemini: BooleanArg;
copilot: BooleanArg;
opencodeZen: BooleanArg;
zaiCodingPlan: BooleanArg;
kimiForCoding: BooleanArg;
opencodeGo: BooleanArg;
};
+2
View File
@@ -0,0 +1,2 @@
import type { InstallArgs } from "./types";
export declare function install(args: InstallArgs): Promise<number>;
+6
View File
@@ -0,0 +1,6 @@
import { Command } from "commander";
import { login } from "./login";
import { logout } from "./logout";
import { status } from "./status";
export declare function createMcpOAuthCommand(): Command;
export { login, logout, status };
+6
View File
@@ -0,0 +1,6 @@
export interface LoginOptions {
serverUrl?: string;
clientId?: string;
scopes?: string[];
}
export declare function login(serverName: string, options: LoginOptions): Promise<number>;
+4
View File
@@ -0,0 +1,4 @@
export interface LogoutOptions {
serverUrl?: string;
}
export declare function logout(serverName: string, options?: LogoutOptions): Promise<number>;
+1
View File
@@ -0,0 +1 @@
export declare function status(serverName: string | undefined): Promise<number>;
+3
View File
@@ -0,0 +1,3 @@
import type { ModelRequirement } from "../shared/model-requirements";
export declare const CLI_AGENT_MODEL_REQUIREMENTS: Record<string, ModelRequirement>;
export declare const CLI_CATEGORY_MODEL_REQUIREMENTS: Record<string, ModelRequirement>;
+27
View File
@@ -0,0 +1,27 @@
export interface ProviderAvailability {
native: {
claude: boolean;
openai: boolean;
gemini: boolean;
};
opencodeZen: boolean;
copilot: boolean;
zai: boolean;
kimiForCoding: boolean;
opencodeGo: boolean;
isMaxPlan: boolean;
}
export interface AgentConfig {
model: string;
variant?: string;
}
export interface CategoryConfig {
model: string;
variant?: string;
}
export interface GeneratedOmoConfig {
$schema: string;
agents?: Record<string, AgentConfig>;
categories?: Record<string, CategoryConfig>;
[key: string]: unknown;
}
+5
View File
@@ -0,0 +1,5 @@
import type { InstallConfig } from "./types";
import type { GeneratedOmoConfig } from "./model-fallback-types";
export type { GeneratedOmoConfig } from "./model-fallback-types";
export declare function generateModelConfig(config: InstallConfig): GeneratedOmoConfig;
export declare function shouldShowChatGPTOnlyWarning(config: InstallConfig): boolean;
+3
View File
@@ -0,0 +1,3 @@
import type { GeneratedOmoConfig, ProviderAvailability } from "./model-fallback-types";
export declare function isOpenAiOnlyAvailability(availability: ProviderAvailability): boolean;
export declare function applyOpenAiOnlyModelCatalog(config: GeneratedOmoConfig): GeneratedOmoConfig;
+4
View File
@@ -0,0 +1,4 @@
import type { InstallConfig } from "./types";
import type { ProviderAvailability } from "./model-fallback-types";
export declare function toProviderAvailability(config: InstallConfig): ProviderAvailability;
export declare function isProviderAvailable(provider: string, availability: ProviderAvailability): boolean;
+1
View File
@@ -0,0 +1 @@
export { transformModelForProvider } from "../shared/provider-model-id-transform";
+2
View File
@@ -0,0 +1,2 @@
import type { OpencodeClient } from "@opencode-ai/sdk";
export declare function loadAgentProfileColors(client: OpencodeClient): Promise<Record<string, string>>;
+5
View File
@@ -0,0 +1,5 @@
import type { RunOptions } from "./types";
import type { OhMyOpenCodeConfig } from "../../config";
type EnvVars = Record<string, string | undefined>;
export declare const resolveRunAgent: (options: RunOptions, pluginConfig: OhMyOpenCodeConfig, env?: EnvVars) => string;
export {};
+2
View File
@@ -0,0 +1,2 @@
import type { RunContext } from "./types";
export declare function checkCompletionConditions(ctx: RunContext): Promise<boolean>;
+9
View File
@@ -0,0 +1,9 @@
export interface ContinuationState {
hasActiveBoulder: boolean;
hasActiveRalphLoop: boolean;
hasHookMarker: boolean;
hasTodoHookMarker: boolean;
hasActiveHookMarker: boolean;
activeHookMarkerReason: string | null;
}
export declare function getContinuationState(directory: string, sessionID: string): ContinuationState;
+5
View File
@@ -0,0 +1,5 @@
export declare const displayChars: {
readonly treeEnd: "`-" | "└─";
readonly treeIndent: " ";
readonly treeJoin: " " | " ";
};
+3
View File
@@ -0,0 +1,3 @@
import type { RunContext, EventPayload } from "./types";
export declare function serializeError(error: unknown): string;
export declare function logEventVerbose(ctx: RunContext, payload: EventPayload): void;
+11
View File
@@ -0,0 +1,11 @@
import type { RunContext, EventPayload } from "./types";
import type { EventState } from "./event-state";
export declare function handleSessionIdle(ctx: RunContext, payload: EventPayload, state: EventState): void;
export declare function handleSessionStatus(ctx: RunContext, payload: EventPayload, state: EventState): void;
export declare function handleSessionError(ctx: RunContext, payload: EventPayload, state: EventState): void;
export declare function handleMessagePartUpdated(ctx: RunContext, payload: EventPayload, state: EventState): void;
export declare function handleMessagePartDelta(ctx: RunContext, payload: EventPayload, state: EventState): void;
export declare function handleMessageUpdated(ctx: RunContext, payload: EventPayload, state: EventState): void;
export declare function handleToolExecute(ctx: RunContext, payload: EventPayload, state: EventState): void;
export declare function handleToolResult(ctx: RunContext, payload: EventPayload, state: EventState): void;
export declare function handleTuiToast(_ctx: RunContext, payload: EventPayload, state: EventState): void;
+49
View File
@@ -0,0 +1,49 @@
export interface EventState {
mainSessionIdle: boolean;
mainSessionError: boolean;
lastError: string | null;
lastOutput: string;
lastPartText: string;
currentTool: string | null;
/** Set to true when the main session has produced meaningful work (text, tool call, or tool result) */
hasReceivedMeaningfulWork: boolean;
/** Timestamp of the last received event (for watchdog detection) */
lastEventTimestamp: number;
/** Count of assistant messages for the main session */
messageCount: number;
/** Current agent name from the latest assistant message */
currentAgent: string | null;
/** Current model ID from the latest assistant message */
currentModel: string | null;
/** Current model variant from the latest assistant message */
currentVariant: string | null;
/** Current message role (user/assistant) — used to filter user messages from display */
currentMessageRole: string | null;
/** Agent profile colors keyed by display name */
agentColorsByName: Record<string, string>;
/** Part type registry keyed by partID (text, reasoning, tool, ...) */
partTypesById: Record<string, string>;
/** Whether a THINK block is currently open in output */
inThinkBlock: boolean;
/** Tracks streamed reasoning text to avoid duplicates */
lastReasoningText: string;
/** Whether compact thinking line already printed for current reasoning block */
hasPrintedThinkingLine: boolean;
/** Last rendered thinking line width (for in-place padding updates) */
lastThinkingLineWidth: number;
/** Message role lookup by message ID to filter user parts */
messageRoleById: Record<string, string>;
/** Last rendered thinking summary (to avoid duplicate re-render) */
lastThinkingSummary: string;
/** Whether text stream is currently at line start (for padding) */
textAtLineStart: boolean;
/** Whether reasoning stream is currently at line start (for padding) */
thinkingAtLineStart: boolean;
/** Current assistant message ID — prevents counter resets on repeated message.updated for same message */
currentMessageId: string | null;
/** Assistant message start timestamp by message ID */
messageStartedAtById: Record<string, number>;
/** Prevent duplicate completion metadata lines per message */
completionMetaPrintedByMessageId: Record<string, boolean>;
}
export declare function createEventState(): EventState;
+3
View File
@@ -0,0 +1,3 @@
import type { RunContext } from "./types";
import type { EventState } from "./event-state";
export declare function processEvents(ctx: RunContext, stream: AsyncIterable<unknown>, state: EventState): Promise<void>;
+4
View File
@@ -0,0 +1,4 @@
export type { EventState } from "./event-state";
export { createEventState } from "./event-state";
export { serializeError } from "./event-formatting";
export { processEvents } from "./event-stream-processor";
+10
View File
@@ -0,0 +1,10 @@
export { run } from "./runner";
export { resolveRunAgent } from "./agent-resolver";
export { resolveRunModel } from "./model-resolver";
export { createServerConnection } from "./server-connection";
export { resolveSession } from "./session-resolver";
export { createJsonOutputManager } from "./json-output";
export { executeOnCompleteHook } from "./on-complete-hook";
export { createEventState, processEvents, serializeError } from "./events";
export type { EventState } from "./events";
export type { RunOptions, RunContext, RunResult, ServerConnection } from "./types";
+12
View File
@@ -0,0 +1,12 @@
import type { RunResult } from "./types";
export interface JsonOutputManager {
redirectToStderr: () => void;
restore: () => void;
emitResult: (result: RunResult) => void;
}
interface JsonOutputManagerOptions {
stdout?: NodeJS.WriteStream;
stderr?: NodeJS.WriteStream;
}
export declare function createJsonOutputManager(options?: JsonOutputManagerOptions): JsonOutputManager;
export {};
+4
View File
@@ -0,0 +1,4 @@
export declare function resolveRunModel(modelString?: string): {
providerID: string;
modelID: string;
} | undefined;
+7
View File
@@ -0,0 +1,7 @@
export declare function executeOnCompleteHook(options: {
command: string;
sessionId: string;
exitCode: number;
durationMs: number;
messageCount: number;
}): Promise<void>;
+5
View File
@@ -0,0 +1,5 @@
export declare function collectCandidateBinaryPaths(pathEnv: string | undefined, which?: (command: string) => string | null | undefined, platform?: NodeJS.Platform): string[];
export declare function canExecuteBinary(binaryPath: string): Promise<boolean>;
export declare function findWorkingOpencodeBinary(pathEnv?: string | undefined, probe?: (binaryPath: string) => Promise<boolean>, which?: (command: string) => string | null | undefined, platform?: NodeJS.Platform): Promise<string | null>;
export declare function buildPathWithBinaryFirst(pathEnv: string | undefined, binaryPath: string): string;
export declare function withWorkingOpencodePath<T>(startServer: () => Promise<T>, finder?: (pathEnv: string | undefined) => Promise<string | null>): Promise<T>;
+7
View File
@@ -0,0 +1,7 @@
export declare function renderAgentHeader(agent: string | null, model: string | null, variant: string | null, agentColorsByName: Record<string, string>): void;
export declare function openThinkBlock(): void;
export declare function closeThinkBlock(): void;
export declare function writePaddedText(text: string, atLineStart: boolean): {
output: string;
atLineStart: boolean;
};
+10
View File
@@ -0,0 +1,10 @@
import type { RunContext } from "./types";
import type { EventState } from "./events";
export interface PollOptions {
pollIntervalMs?: number;
requiredConsecutive?: number;
minStabilizationMs?: number;
eventWatchdogMs?: number;
secondaryMeaningfulWorkTimeoutMs?: number;
}
export declare function pollForCompletion(ctx: RunContext, eventState: EventState, abortController: AbortController, options?: PollOptions): Promise<number>;
+5
View File
@@ -0,0 +1,5 @@
import type { RunOptions } from "./types";
import { resolveRunAgent } from "./agent-resolver";
export { resolveRunAgent };
export declare function waitForEventProcessorShutdown(eventProcessor: Promise<void>, timeoutMs?: number): Promise<void>;
export declare function run(options: RunOptions): Promise<number>;
+6
View File
@@ -0,0 +1,6 @@
import type { ServerConnection } from "./types";
export declare function createServerConnection(options: {
port?: number;
attach?: string;
signal: AbortSignal;
}): Promise<ServerConnection>;
+6
View File
@@ -0,0 +1,6 @@
import type { OpencodeClient } from "./types";
export declare function resolveSession(options: {
client: OpencodeClient;
sessionId?: string;
directory: string;
}): Promise<string>;
+12
View File
@@ -0,0 +1,12 @@
type StdinLike = {
isTTY?: boolean;
isRaw?: boolean;
setRawMode?: (mode: boolean) => void;
isPaused?: () => boolean;
resume: () => void;
pause: () => void;
on: (event: "data", listener: (chunk: string | Uint8Array) => void) => void;
removeListener: (event: "data", listener: (chunk: string | Uint8Array) => void) => void;
};
export declare function suppressRunInput(stdin?: StdinLike, onInterrupt?: () => void): () => void;
export {};
+5
View File
@@ -0,0 +1,5 @@
export declare function createTimestampTransformer(now?: () => Date): (chunk: string) => string;
export declare function createTimestampedStdoutController(stdout?: NodeJS.WriteStream): {
enable: () => void;
restore: () => void;
};
+6
View File
@@ -0,0 +1,6 @@
export interface ToolHeader {
icon: string;
title: string;
description?: string;
}
export declare function formatToolHeader(toolName: string, input: Record<string, unknown>): ToolHeader;
+132
View File
@@ -0,0 +1,132 @@
import type { OpencodeClient } from "@opencode-ai/sdk";
export type { OpencodeClient };
export interface RunOptions {
message: string;
agent?: string;
model?: string;
timestamp?: boolean;
verbose?: boolean;
directory?: string;
port?: number;
attach?: string;
onComplete?: string;
json?: boolean;
sessionId?: string;
}
export interface ServerConnection {
client: OpencodeClient;
cleanup: () => void;
}
export interface RunResult {
sessionId: string;
success: boolean;
durationMs: number;
messageCount: number;
summary: string;
}
export interface RunContext {
client: OpencodeClient;
sessionID: string;
directory: string;
abortController: AbortController;
verbose?: boolean;
}
export interface Todo {
id?: string;
content: string;
status: string;
priority: string;
}
export interface SessionStatus {
type: "idle" | "busy" | "retry";
}
export interface ChildSession {
id: string;
}
export interface EventPayload {
type: string;
properties?: Record<string, unknown>;
}
export interface SessionIdleProps {
sessionID?: string;
sessionId?: string;
}
export interface SessionStatusProps {
sessionID?: string;
sessionId?: string;
status?: {
type?: string;
};
}
export interface MessageUpdatedProps {
info?: {
id?: string;
sessionID?: string;
sessionId?: string;
role?: string;
modelID?: string;
providerID?: string;
agent?: string;
variant?: string;
};
}
export interface MessagePartUpdatedProps {
/** @deprecated Legacy structure — current OpenCode puts sessionID inside part */
info?: {
sessionID?: string;
sessionId?: string;
role?: string;
};
part?: {
id?: string;
sessionID?: string;
sessionId?: string;
messageID?: string;
type?: string;
text?: string;
/** Tool name (for part.type === "tool") */
tool?: string;
/** Tool state (for part.type === "tool") */
state?: {
status?: string;
input?: Record<string, unknown>;
output?: string;
};
name?: string;
input?: unknown;
time?: {
start?: number;
end?: number;
};
};
}
export interface MessagePartDeltaProps {
sessionID?: string;
sessionId?: string;
messageID?: string;
partID?: string;
field?: string;
delta?: string;
}
export interface ToolExecuteProps {
sessionID?: string;
sessionId?: string;
name?: string;
input?: Record<string, unknown>;
}
export interface ToolResultProps {
sessionID?: string;
sessionId?: string;
name?: string;
output?: string;
}
export interface SessionErrorProps {
sessionID?: string;
sessionId?: string;
error?: unknown;
}
export interface TuiToastShowProps {
title?: string;
message?: string;
variant?: "info" | "success" | "warning" | "error";
}
+2
View File
@@ -0,0 +1,2 @@
import type { DetectedConfig, InstallConfig } from "./types";
export declare function promptInstallConfig(detected: DetectedConfig): Promise<InstallConfig | null>;
+2
View File
@@ -0,0 +1,2 @@
import type { InstallArgs } from "./types";
export declare function runTuiInstaller(args: InstallArgs, version: string): Promise<number>;
+42
View File
@@ -0,0 +1,42 @@
export type ClaudeSubscription = "no" | "yes" | "max20";
export type BooleanArg = "no" | "yes";
export interface InstallArgs {
tui: boolean;
claude?: ClaudeSubscription;
openai?: BooleanArg;
gemini?: BooleanArg;
copilot?: BooleanArg;
opencodeZen?: BooleanArg;
zaiCodingPlan?: BooleanArg;
kimiForCoding?: BooleanArg;
opencodeGo?: BooleanArg;
skipAuth?: boolean;
}
export interface InstallConfig {
hasClaude: boolean;
isMax20: boolean;
hasOpenAI: boolean;
hasGemini: boolean;
hasCopilot: boolean;
hasOpencodeZen: boolean;
hasZaiCodingPlan: boolean;
hasKimiForCoding: boolean;
hasOpencodeGo: boolean;
}
export interface ConfigMergeResult {
success: boolean;
configPath: string;
error?: string;
}
export interface DetectedConfig {
isInstalled: boolean;
hasClaude: boolean;
isMax20: boolean;
hasOpenAI: boolean;
hasGemini: boolean;
hasCopilot: boolean;
hasOpencodeZen: boolean;
hasZaiCodingPlan: boolean;
hasKimiForCoding: boolean;
hasOpencodeGo: boolean;
}