feat: remove legacy OpenCode runtime
Cut product flows over to Coding/Pi and retain only the migration-owned v1 boundary. Promote supported native optional packages because electron-builder omitted pnpm transitive optional closure from the packaged ASAR.
This commit is contained in:
@@ -1,344 +0,0 @@
|
||||
export type OpencodeLifecycleState = 'stopped' | 'starting' | 'running' | 'error';
|
||||
|
||||
export interface OpencodeStatus {
|
||||
state: OpencodeLifecycleState;
|
||||
port: number;
|
||||
url?: string;
|
||||
pid?: number;
|
||||
error?: string;
|
||||
startedAt?: number;
|
||||
}
|
||||
|
||||
export interface OpencodeHealth {
|
||||
ok: boolean;
|
||||
status: OpencodeStatus;
|
||||
}
|
||||
|
||||
export interface OpencodeRuntimeConfigSummary {
|
||||
model: string | null;
|
||||
smallModel: string | null;
|
||||
providerIds: string[];
|
||||
enabledProviderIds?: string[];
|
||||
providerCount: number;
|
||||
providers?: OpencodeProviderSummary[];
|
||||
mcpServerIds?: string[];
|
||||
mcpServerCount?: number;
|
||||
mcpServers?: OpencodeMcpServerSummary[];
|
||||
}
|
||||
|
||||
export interface OpencodeModelLimit {
|
||||
context: number;
|
||||
output: number;
|
||||
}
|
||||
|
||||
export interface OpencodeProviderSummary {
|
||||
id: string;
|
||||
name?: string;
|
||||
npm?: string;
|
||||
modelIds: string[];
|
||||
imageInputModelIds?: string[];
|
||||
modelLimits?: Record<string, OpencodeModelLimit>;
|
||||
hasApiKey: boolean;
|
||||
apiKeyEnv?: string;
|
||||
headerNames: string[];
|
||||
}
|
||||
|
||||
export interface OpencodeMcpServerSummary {
|
||||
id: string;
|
||||
type: string;
|
||||
enabled: boolean;
|
||||
command: string[];
|
||||
envKeys: string[];
|
||||
}
|
||||
|
||||
export interface OpencodeProject {
|
||||
id: string;
|
||||
path: string;
|
||||
name: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
lastOpenedAt: string;
|
||||
}
|
||||
|
||||
export interface OpencodeProjectSnapshot {
|
||||
projects: OpencodeProject[];
|
||||
activeProject: OpencodeProject | null;
|
||||
}
|
||||
|
||||
export interface OpencodeProjectActionResponse extends OpencodeProjectSnapshot {
|
||||
success: boolean;
|
||||
project?: OpencodeProject;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export type OpencodeContextFileType = 'file' | 'directory';
|
||||
|
||||
export interface OpencodeContextFileEntry {
|
||||
path: string;
|
||||
name: string;
|
||||
type: OpencodeContextFileType;
|
||||
status?: string;
|
||||
size?: number;
|
||||
}
|
||||
|
||||
export interface OpencodeContextFileContent {
|
||||
path: string;
|
||||
content: string;
|
||||
truncated?: boolean;
|
||||
}
|
||||
|
||||
export interface OpencodeSessionDiff {
|
||||
path: string;
|
||||
name: string;
|
||||
status?: string;
|
||||
additions: number | null;
|
||||
deletions: number | null;
|
||||
before: string | null;
|
||||
after: string;
|
||||
patch: string | null;
|
||||
}
|
||||
|
||||
export interface OpencodeSessionTodo {
|
||||
id: string;
|
||||
content: string;
|
||||
status: string;
|
||||
priority?: string;
|
||||
}
|
||||
|
||||
export interface OpencodeTextSearchSubmatch {
|
||||
text: string;
|
||||
start: number;
|
||||
end: number;
|
||||
}
|
||||
|
||||
export interface OpencodeTextSearchResult {
|
||||
path: string;
|
||||
name: string;
|
||||
lineNumber: number | null;
|
||||
lineText: string;
|
||||
submatches: OpencodeTextSearchSubmatch[];
|
||||
}
|
||||
|
||||
export interface OpencodeSession extends Record<string, unknown> {
|
||||
id?: string;
|
||||
sessionID?: string;
|
||||
agent?: string | null;
|
||||
model?: {
|
||||
providerID?: string;
|
||||
modelID?: string;
|
||||
id?: string;
|
||||
};
|
||||
title?: string;
|
||||
name?: string;
|
||||
summary?: string;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
projectID?: string;
|
||||
directory?: string;
|
||||
parentID?: string;
|
||||
time?: {
|
||||
created?: number;
|
||||
updated?: number;
|
||||
compacting?: number;
|
||||
};
|
||||
share?: { url?: string };
|
||||
revert?: { messageID?: string; partID?: string };
|
||||
}
|
||||
|
||||
export interface OpencodeProjectCommand {
|
||||
name: string;
|
||||
description?: string;
|
||||
agent?: string;
|
||||
model?: string;
|
||||
source?: 'command' | 'mcp' | 'skill';
|
||||
subtask?: boolean;
|
||||
hints: string[];
|
||||
}
|
||||
|
||||
export interface OpencodeCommandTextPartInput {
|
||||
type: 'text';
|
||||
text: string;
|
||||
synthetic: true;
|
||||
}
|
||||
|
||||
export interface OpencodeCommandFilePartInput {
|
||||
type: 'file';
|
||||
mime: string;
|
||||
filename?: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export type OpencodeCommandPartInput =
|
||||
| OpencodeCommandTextPartInput
|
||||
| OpencodeCommandFilePartInput;
|
||||
|
||||
export type OpencodeSessionExecutionState = 'idle' | 'busy' | 'retry';
|
||||
|
||||
export interface OpencodeSessionStatus extends Record<string, unknown> {
|
||||
type: OpencodeSessionExecutionState;
|
||||
attempt?: number;
|
||||
message?: string;
|
||||
next?: number;
|
||||
}
|
||||
|
||||
export type OpencodeSessionStatusMap = Record<string, OpencodeSessionStatus>;
|
||||
|
||||
export interface OpencodeSessionMessage extends Record<string, unknown> {
|
||||
id?: string;
|
||||
role?: string;
|
||||
content?: unknown;
|
||||
text?: string;
|
||||
message?: string;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
}
|
||||
|
||||
export interface OpencodeQuestionOption {
|
||||
label: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface OpencodeQuestionInfo {
|
||||
question: string;
|
||||
header?: string;
|
||||
options: OpencodeQuestionOption[];
|
||||
multiple?: boolean;
|
||||
custom?: boolean;
|
||||
}
|
||||
|
||||
export interface OpencodeQuestionRequest {
|
||||
id: string;
|
||||
requestID?: string;
|
||||
sessionID: string;
|
||||
questions: OpencodeQuestionInfo[];
|
||||
tool?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export type OpencodePermissionReply = 'once' | 'always' | 'reject';
|
||||
|
||||
export interface OpencodePermissionRequest {
|
||||
id: string;
|
||||
requestID?: string;
|
||||
sessionID: string;
|
||||
title?: string;
|
||||
action?: string;
|
||||
permission?: string;
|
||||
path?: string;
|
||||
patterns?: string[];
|
||||
always?: string[];
|
||||
tool?: Record<string, unknown>;
|
||||
metadata?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
/**
|
||||
* The native OpenCode session Part kinds that can arrive over the event bus.
|
||||
* Keep this union deliberately wider than the renderer's legacy ContentBlock
|
||||
* union so newer runtime parts can remain visible through the generic card.
|
||||
*/
|
||||
export type OpencodeNativePartKind =
|
||||
| 'text'
|
||||
| 'reasoning'
|
||||
| 'tool'
|
||||
| 'step-start'
|
||||
| 'step-finish'
|
||||
| 'retry'
|
||||
| 'subtask'
|
||||
| 'agent'
|
||||
| 'patch'
|
||||
| 'file'
|
||||
| 'snapshot'
|
||||
| 'compaction'
|
||||
| 'unknown';
|
||||
|
||||
export type OpencodeNativeToolState =
|
||||
| 'pending'
|
||||
| 'running'
|
||||
| 'completed'
|
||||
| 'error';
|
||||
|
||||
export interface OpencodeNormalizedToolState {
|
||||
status: OpencodeNativeToolState;
|
||||
input?: unknown;
|
||||
output?: unknown;
|
||||
error?: unknown;
|
||||
metadata?: Record<string, unknown>;
|
||||
time?: {
|
||||
start?: number;
|
||||
end?: number;
|
||||
};
|
||||
}
|
||||
|
||||
export interface OpencodeNormalizedSessionPart {
|
||||
id: string;
|
||||
sessionID: string;
|
||||
messageID: string;
|
||||
type: OpencodeNativePartKind;
|
||||
rawType: string;
|
||||
text?: string;
|
||||
synthetic?: boolean;
|
||||
tool?: string;
|
||||
callID?: string;
|
||||
state?: OpencodeNormalizedToolState;
|
||||
detail?: string;
|
||||
parentID?: string;
|
||||
childSessionID?: string;
|
||||
time?: {
|
||||
start?: number;
|
||||
end?: number;
|
||||
};
|
||||
raw?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface OpencodeNormalizedSessionMessage {
|
||||
id: string;
|
||||
sessionID: string;
|
||||
role: string;
|
||||
createdAt?: number;
|
||||
completedAt?: number;
|
||||
partIDs: string[];
|
||||
}
|
||||
|
||||
export type OpencodeCompactionSource = 'manual' | 'automatic';
|
||||
|
||||
export type OpencodeCompactionStatus = 'running' | 'completed';
|
||||
|
||||
/**
|
||||
* A renderer-owned compaction timeline item. `id` is the immutable UI
|
||||
* identity; native Part/event ids are correlation keys and may arrive later.
|
||||
*/
|
||||
export interface OpencodeCompactionTimelineEvent {
|
||||
id: string;
|
||||
sessionID: string;
|
||||
source: OpencodeCompactionSource;
|
||||
status: OpencodeCompactionStatus;
|
||||
order: number;
|
||||
anchorMessageID?: string;
|
||||
anchorPartID?: string;
|
||||
nativePartID?: string;
|
||||
nativeEventID?: string;
|
||||
runID?: string;
|
||||
generation?: number;
|
||||
startedAt?: number;
|
||||
completedAt?: number;
|
||||
}
|
||||
|
||||
export interface OpencodeSessionTranscriptState {
|
||||
sessionID: string;
|
||||
status: OpencodeSessionExecutionState;
|
||||
messagesById: Record<string, OpencodeNormalizedSessionMessage>;
|
||||
messageOrder: string[];
|
||||
partsById: Record<string, OpencodeNormalizedSessionPart>;
|
||||
partOrderByMessageId: Record<string, string[]>;
|
||||
compactionsById: Record<string, OpencodeCompactionTimelineEvent>;
|
||||
compactionOrder: string[];
|
||||
lastError?: string;
|
||||
lastEventKey?: string;
|
||||
lastDeltaSignature?: string;
|
||||
/** Bounded event identity cache used to make reconnect replays idempotent. */
|
||||
seenEventKeys?: string[];
|
||||
}
|
||||
|
||||
// Public architecture names used by the session UI plan. Keep the prefixed
|
||||
// aliases above for compatibility with the rest of the OpenCode type surface.
|
||||
export type NormalizedSessionPart = OpencodeNormalizedSessionPart;
|
||||
export type SessionTranscriptState = OpencodeSessionTranscriptState;
|
||||
Reference in New Issue
Block a user