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,7 +1,7 @@
|
||||
import { realpath } from 'node:fs/promises';
|
||||
import type { IncomingMessage, ServerResponse } from 'node:http';
|
||||
import type { AgentBrowserBounds, AgentBrowserFaultShape } from '../../../shared/agent-browser';
|
||||
import { normalizeProjectPath } from '../../opencode/project-store';
|
||||
import { normalizeCodingProjectPath } from '../../coding-projects/project-store';
|
||||
import type { HostApiContext } from '../context';
|
||||
import { hasRendererCapability } from '../renderer-capability';
|
||||
import { parseJsonBody, sendJson } from '../route-utils';
|
||||
@@ -71,7 +71,7 @@ function parseStringArray(value: unknown): string[] | undefined {
|
||||
}
|
||||
|
||||
async function resolveActiveProject(ctx: HostApiContext, requestedPath?: unknown) {
|
||||
const activeProject = await ctx.opencodeProjectStore.getActiveProject();
|
||||
const activeProject = await ctx.codingProjectStore.getActiveProject();
|
||||
if (!activeProject) {
|
||||
throw new AgentBrowserRouteError('PROJECT_NOT_ACTIVE', '请先打开一个项目。', 409);
|
||||
}
|
||||
@@ -93,7 +93,7 @@ async function resolveActiveProject(ctx: HostApiContext, requestedPath?: unknown
|
||||
} catch {
|
||||
throw new AgentBrowserRouteError('PROJECT_MISMATCH', '请求的项目目录不可用。', 403);
|
||||
}
|
||||
if (normalizeProjectPath(requestedRealPath) !== normalizeProjectPath(activeRealPath)) {
|
||||
if (normalizeCodingProjectPath(requestedRealPath) !== normalizeCodingProjectPath(activeRealPath)) {
|
||||
throw new AgentBrowserRouteError('PROJECT_MISMATCH', '智能体只能调试当前项目。', 403);
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ async function ensureProjectStillActive(
|
||||
ctx: HostApiContext,
|
||||
project: { id: string; path: string },
|
||||
): Promise<void> {
|
||||
const activeProject = await ctx.opencodeProjectStore.getActiveProject();
|
||||
const activeProject = await ctx.codingProjectStore.getActiveProject();
|
||||
let activeRealPath: string | null = null;
|
||||
if (activeProject?.id === project.id) {
|
||||
try {
|
||||
@@ -119,7 +119,7 @@ async function ensureProjectStillActive(
|
||||
if (
|
||||
activeProject?.id === project.id
|
||||
&& activeRealPath
|
||||
&& normalizeProjectPath(activeRealPath) === normalizeProjectPath(project.path)
|
||||
&& normalizeCodingProjectPath(activeRealPath) === normalizeCodingProjectPath(project.path)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user