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

@@ -6,7 +6,7 @@ describe('Host API transport selection', () => {
it('keeps long-lived and binary responses on loopback HTTP', () => {
expect(shouldUseLoopbackHostApi('/api/events')).toBe(true);
expect(shouldUseLoopbackHostApi('/api/events?token=session')).toBe(true);
expect(shouldUseLoopbackHostApi('/api/opencode/events')).toBe(true);
expect(shouldUseLoopbackHostApi('/api/coding/events')).toBe(true);
expect(shouldUseLoopbackHostApi('/api/ai-proxy/v1/chat/completions', 'POST')).toBe(true);
expect(shouldUseLoopbackHostApi('/api/image-workspace/workspaces/w1/conversations/c1/events')).toBe(true);
expect(shouldUseLoopbackHostApi('/api/image-workspace/workspaces/w1/assets/a1/content?download=1')).toBe(true);
@@ -15,18 +15,18 @@ describe('Host API transport selection', () => {
it('dispatches JSON and control requests in Main', () => {
expect(shouldUseLoopbackHostApi('/api/app/runtime-info')).toBe(false);
expect(shouldUseLoopbackHostApi('/api/works/projects/release-jobs', 'POST')).toBe(false);
expect(shouldUseLoopbackHostApi('/api/opencode/status')).toBe(false);
expect(shouldUseLoopbackHostApi('/api/coding/projects')).toBe(false);
});
it('reuses the existing route contract without opening a socket', async () => {
const data = await dispatchHostApiRequest({
opencodeManager: { getStatus: () => ({ state: 'stopped', port: null }) },
opencodeProjectStore: {},
codingProducts: { runtime: { getDiagnostics: () => ({ revision: 3 }) } },
codingProjectStore: {},
eventBus: {},
mainWindow: null,
} as never, { path: '/api/app/runtime-info' });
expect(data).toMatchObject({ status: 200, ok: true });
expect(data.json).toMatchObject({ runtime: 'opencode', status: { state: 'stopped' } });
expect(data.json).toMatchObject({ runtime: 'pi', diagnostics: { revision: 3 } });
});
});