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

@@ -8,8 +8,8 @@ import {
} from '../../services/works-square-ai-gateway';
import { proxyAwareFetch } from '../../utils/proxy-fetch';
import { logger } from '../../utils/logger';
import { getOpencodeErrorKind } from '../../../shared/opencode-error-kind';
import { isOpencodeUpstreamSaturated } from '../../../shared/opencode-error-details';
import { getAIGatewayErrorKind } from '../../../shared/ai-gateway-error-kind';
import { isAIGatewayUpstreamSaturated } from '../../../shared/ai-gateway-error-details';
const AI_PROXY_PREFIX = '/api/ai-proxy/v1';
const MAX_ERROR_LOG_MESSAGE_LENGTH = 600;
@@ -79,10 +79,10 @@ function isExpiredGatewayTokenResponse(status: number, bodyText: string): boolea
}
function getForwardedOneApiStatus(status: number, bodyText: string): number {
if (status === 429 && getOpencodeErrorKind(bodyText) === 'quota_exhausted') {
if (status === 429 && getAIGatewayErrorKind(bodyText) === 'quota_exhausted') {
return 402;
}
if (status === 429 && isOpencodeUpstreamSaturated(bodyText)) {
if (status === 429 && isAIGatewayUpstreamSaturated(bodyText)) {
return 400;
}
return status;