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:
2026-08-24 12:17:43 +08:00
parent 61fede2b4d
commit 5a275b93a7
199 changed files with 1330 additions and 64725 deletions

View File

@@ -2,10 +2,15 @@ import { useStore } from 'zustand';
import { createStore, type StoreApi } from 'zustand/vanilla';
import {
createCodingProjectConversation,
createCodingProject,
getCodingProjectConfig,
listCodingProjectConversations,
listCodingProjects,
acknowledgeLegacyCodingConversationNotice,
openCodingProject,
patchCodingProjectConversation,
removeCodingProject,
setActiveCodingProject,
type CodingProjectCatalog,
} from '@/lib/coding-projects';
import type {
@@ -14,6 +19,7 @@ import type {
CodingProjectConfig,
CodingProjectSummary,
} from '@/types/coding-project';
import type { ProjectType } from '../../shared/project-config';
interface CodingWorkspaceDependencies {
listProjects(): Promise<CodingProjectCatalog>;
@@ -31,6 +37,20 @@ interface CodingWorkspaceDependencies {
conversationId: string,
patch: { title?: string; archived?: boolean; unread?: boolean },
): Promise<CodingConversationMetadata>;
openProject(projectPath: string): Promise<CodingProjectSummary>;
createProject(input: {
projectPath?: string;
parentPath?: string;
projectName?: string;
projectType?: ProjectType;
}): Promise<{ project: CodingProjectSummary; config: CodingProjectConfig; knowledgeFiles: string[] }>;
setActiveProject(projectId: string): Promise<CodingProjectSummary>;
removeProject(projectId: string): Promise<void>;
acknowledgeLegacyNotice(projectId: string): Promise<{
project: CodingProjectSummary;
config: CodingProjectConfig;
knowledgeFiles: string[];
}>;
}
export interface CodingWorkspaceState {
@@ -45,6 +65,16 @@ export interface CodingWorkspaceState {
conversationErrorsByProjectId: Record<string, Record<string, string>>;
creatingAgentIds: Record<string, true>;
load(): Promise<void>;
openProject(projectPath: string): Promise<CodingProjectSummary>;
createProject(input: {
projectPath?: string;
parentPath?: string;
projectName?: string;
projectType?: ProjectType;
}): Promise<CodingProjectSummary>;
setActiveProject(projectId: string): Promise<CodingProjectSummary>;
removeProject(projectId: string): Promise<void>;
acknowledgeLegacyNotice(): Promise<void>;
selectAgent(agentId: string): void;
ensureConversation(agentId: string): Promise<CodingConversationMetadata>;
createConversation(agentId: string): Promise<CodingConversationMetadata>;
@@ -99,6 +129,11 @@ function defaultDependencies(): CodingWorkspaceDependencies {
listConversations: listCodingProjectConversations,
createConversation: createCodingProjectConversation,
patchConversation: patchCodingProjectConversation,
openProject: openCodingProject,
createProject: createCodingProject,
setActiveProject: setActiveCodingProject,
removeProject: removeCodingProject,
acknowledgeLegacyNotice: acknowledgeLegacyCodingConversationNotice,
};
}
@@ -177,6 +212,36 @@ export function createCodingWorkspaceStore(
await flight;
},
async openProject(projectPath) {
const project = await deps.openProject(projectPath);
await get().load();
return project;
},
async createProject(input) {
const snapshot = await deps.createProject(input);
await get().load();
return snapshot.project;
},
async setActiveProject(projectId) {
const project = await deps.setActiveProject(projectId);
await get().load();
return project;
},
async removeProject(projectId) {
await deps.removeProject(projectId);
await get().load();
},
async acknowledgeLegacyNotice() {
const projectId = get().activeProjectId;
if (!projectId) return;
const snapshot = await deps.acknowledgeLegacyNotice(projectId);
if (get().activeProjectId === projectId) set({ config: snapshot.config });
},
selectAgent(agentId) {
if (!enabledAgent(get().config, agentId)) return;
set({ selectedAgentId: agentId });