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

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
export type AIGatewayErrorKind = 'quota_exhausted' | 'authentication_invalid';
export function isTokenBalanceExhausted(message: string | null | undefined): boolean {
const normalized = message?.trim().toLowerCase() ?? '';
return normalized.includes('token_balance_exhausted')
|| normalized.includes('token balance exhausted')
|| normalized.includes('balance exhausted');
}
export function getAIGatewayErrorKind(message: string | null | undefined): AIGatewayErrorKind | null {
const normalized = message?.trim().toLowerCase() ?? '';
if (!normalized) return null;
if (
isTokenBalanceExhausted(normalized)
|| normalized.includes('user quota is not enough')
|| normalized.includes('quota is not enough')
|| normalized.includes('quota not enough')
|| normalized.includes('insufficient quota')
|| normalized.includes('quota exhausted')
|| normalized.includes('quota exceeded')
|| normalized.includes('rolling 5-hour window')
|| normalized.includes('额度不足')
) {
return 'quota_exhausted';
}
if (normalized.includes('works_square_gateway_authorize_failed')) {
return 'authentication_invalid';
}
return null;
}