feat: switch OpenCode Go usage to API

OpenCode Go now reads quota usage with a bearer API key from OpenCode auth.json
Removes the old workspace ID and browser cookie credential flow
Deletes legacy OpenCode Go credential files during upgrade
This commit is contained in:
Bohdan Triapitsyn
2026-08-12 01:49:22 +03:00
parent d1224213ca
commit 5917325d49
29 changed files with 192 additions and 182 deletions
@@ -3,12 +3,6 @@ import { deleteQuotaCredential, readQuotaCredential, writeQuotaCredential } from
const clean = (value) => typeof value === 'string' && !/[\r\n]/.test(value) ? value.trim() : '';
export const normalizers = {
'opencode-go': (value) => {
const workspaceId = clean(value?.workspaceId);
let authCookie = clean(value?.authCookie);
if (authCookie.startsWith('auth=')) authCookie = authCookie.slice(5).trim();
return workspaceId && authCookie ? { workspaceId, authCookie } : null;
},
'ollama-cloud': (value) => {
const cookie = clean(value?.cookie);
return cookie ? { cookie } : null;
@@ -35,7 +29,6 @@ export const writeManagedCredential = (providerId, value) => {
export const getManagedCredentialStatus = (providerId) => {
const credential = readManagedCredential(providerId);
if (!credential) return { configured: false };
if (providerId === 'opencode-go') return { configured: true, workspaceId: credential.workspaceId, secretMasked: '••••••••' };
if (providerId === 'cursor') return { configured: true, hasRefreshToken: Boolean(credential.refreshToken), secretMasked: '••••••••' };
return { configured: true, secretMasked: '••••••••' };
};