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,4 +1,4 @@
|
||||
export function isOpencodeUpstreamSaturated(message: string | null | undefined): boolean {
|
||||
export function isAIGatewayUpstreamSaturated(message: string | null | undefined): boolean {
|
||||
const normalized = message?.trim().toLowerCase() ?? '';
|
||||
if (!normalized) return false;
|
||||
return normalized.includes('当前分组上游负载已饱和')
|
||||
@@ -1,17 +1,17 @@
|
||||
export type OpencodeErrorKind = 'quota_exhausted' | 'authentication_invalid';
|
||||
export type AIGatewayErrorKind = 'quota_exhausted' | 'authentication_invalid';
|
||||
|
||||
export function isOpencodeTokenBalanceExhausted(message: string | null | undefined): boolean {
|
||||
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 getOpencodeErrorKind(message: string | null | undefined): OpencodeErrorKind | null {
|
||||
export function getAIGatewayErrorKind(message: string | null | undefined): AIGatewayErrorKind | null {
|
||||
const normalized = message?.trim().toLowerCase() ?? '';
|
||||
if (!normalized) return null;
|
||||
if (
|
||||
isOpencodeTokenBalanceExhausted(normalized)
|
||||
isTokenBalanceExhausted(normalized)
|
||||
|| normalized.includes('user quota is not enough')
|
||||
|| normalized.includes('quota is not enough')
|
||||
|| normalized.includes('quota not enough')
|
||||
@@ -57,6 +57,9 @@ export interface ProductCodingSkill {
|
||||
name: string;
|
||||
description: string;
|
||||
selected: boolean;
|
||||
location: string;
|
||||
content: string;
|
||||
entries: Array<{ path: string; type: 'file' | 'directory' }>;
|
||||
}
|
||||
|
||||
export interface ProductCodingCommand {
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
export type OpencodeProviderAccountLike = {
|
||||
id: string;
|
||||
vendorId: string;
|
||||
};
|
||||
|
||||
export function sanitizeOpencodeProviderId(value: string): string {
|
||||
return value
|
||||
.trim()
|
||||
.replace(/[^A-Za-z0-9_-]+/g, '-')
|
||||
.replace(/^-+|-+$/g, '')
|
||||
|| 'provider';
|
||||
}
|
||||
|
||||
export function resolveOpencodeProviderId(account: OpencodeProviderAccountLike): string {
|
||||
if (account.vendorId === 'custom' || account.vendorId === 'ollama') {
|
||||
return sanitizeOpencodeProviderId(account.id);
|
||||
}
|
||||
return sanitizeOpencodeProviderId(account.vendorId);
|
||||
}
|
||||
Reference in New Issue
Block a user