@pixelbyte-software/pixcode 1.33.10 → 1.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/api-docs.html +395 -395
  2. package/dist/assets/{index-B_dU5AHA.js → index-BvClqlMf.js} +134 -134
  3. package/dist/favicon.svg +8 -8
  4. package/dist/icons/icon-128x128.svg +9 -9
  5. package/dist/icons/icon-144x144.svg +9 -9
  6. package/dist/icons/icon-152x152.svg +9 -9
  7. package/dist/icons/icon-192x192.svg +9 -9
  8. package/dist/icons/icon-384x384.svg +9 -9
  9. package/dist/icons/icon-512x512.svg +9 -9
  10. package/dist/icons/icon-72x72.svg +9 -9
  11. package/dist/icons/icon-96x96.svg +9 -9
  12. package/dist/icons/icon-template.svg +9 -9
  13. package/dist/index.html +1 -1
  14. package/dist/logo.svg +12 -12
  15. package/dist/openapi.yaml +1311 -1311
  16. package/dist-server/server/index.js +4 -0
  17. package/dist-server/server/index.js.map +1 -1
  18. package/dist-server/server/modules/orchestration/a2a/adapter-registry.js +47 -0
  19. package/dist-server/server/modules/orchestration/a2a/adapter-registry.js.map +1 -0
  20. package/dist-server/server/modules/orchestration/a2a/adapters/abstract-a2a.adapter.js +17 -0
  21. package/dist-server/server/modules/orchestration/a2a/adapters/abstract-a2a.adapter.js.map +1 -0
  22. package/dist-server/server/modules/orchestration/a2a/adapters/claude-code.adapter.js +233 -0
  23. package/dist-server/server/modules/orchestration/a2a/adapters/claude-code.adapter.js.map +1 -0
  24. package/dist-server/server/modules/orchestration/a2a/agent-card.js +50 -0
  25. package/dist-server/server/modules/orchestration/a2a/agent-card.js.map +1 -0
  26. package/dist-server/server/modules/orchestration/a2a/auth.middleware.js +25 -0
  27. package/dist-server/server/modules/orchestration/a2a/auth.middleware.js.map +1 -0
  28. package/dist-server/server/modules/orchestration/a2a/bus.js +34 -0
  29. package/dist-server/server/modules/orchestration/a2a/bus.js.map +1 -0
  30. package/dist-server/server/modules/orchestration/a2a/routes.js +233 -0
  31. package/dist-server/server/modules/orchestration/a2a/routes.js.map +1 -0
  32. package/dist-server/server/modules/orchestration/a2a/types.js +6 -0
  33. package/dist-server/server/modules/orchestration/a2a/types.js.map +1 -0
  34. package/dist-server/server/modules/orchestration/a2a/validator.js +85 -0
  35. package/dist-server/server/modules/orchestration/a2a/validator.js.map +1 -0
  36. package/dist-server/server/modules/orchestration/index.js +10 -0
  37. package/dist-server/server/modules/orchestration/index.js.map +1 -0
  38. package/dist-server/server/opencode-cli.js +4 -1
  39. package/dist-server/server/opencode-cli.js.map +1 -1
  40. package/package.json +178 -178
  41. package/scripts/smoke/a2a-roundtrip.mjs +98 -0
  42. package/server/database/db.js +794 -794
  43. package/server/database/json-store.js +194 -194
  44. package/server/index.js +9 -0
  45. package/server/modules/orchestration/a2a/adapter-registry.ts +58 -0
  46. package/server/modules/orchestration/a2a/adapters/abstract-a2a.adapter.ts +49 -0
  47. package/server/modules/orchestration/a2a/adapters/claude-code.adapter.ts +283 -0
  48. package/server/modules/orchestration/a2a/agent-card.ts +55 -0
  49. package/server/modules/orchestration/a2a/auth.middleware.ts +29 -0
  50. package/server/modules/orchestration/a2a/bus.ts +46 -0
  51. package/server/modules/orchestration/a2a/routes.ts +264 -0
  52. package/server/modules/orchestration/a2a/types.ts +111 -0
  53. package/server/modules/orchestration/a2a/validator.ts +90 -0
  54. package/server/modules/orchestration/index.ts +26 -0
  55. package/server/modules/providers/list/opencode/opencode-auth.provider.ts +130 -130
  56. package/server/modules/providers/list/opencode/opencode-mcp.provider.ts +126 -126
  57. package/server/modules/providers/list/opencode/opencode-sessions.provider.ts +232 -232
  58. package/server/modules/providers/list/opencode/opencode.provider.ts +29 -29
  59. package/server/modules/providers/list/qwen/qwen-auth.provider.ts +145 -145
  60. package/server/modules/providers/list/qwen/qwen-mcp.provider.ts +114 -114
  61. package/server/modules/providers/list/qwen/qwen-sessions.provider.ts +265 -265
  62. package/server/modules/providers/list/qwen/qwen.provider.ts +21 -21
  63. package/server/modules/providers/shared/provider-configs.ts +142 -142
  64. package/server/opencode-cli.js +4 -1
  65. package/server/opencode-response-handler.js +107 -107
  66. package/server/qwen-code-cli.js +395 -395
  67. package/server/qwen-response-handler.js +73 -73
  68. package/server/routes/qwen.js +27 -27
  69. package/server/services/external-access.js +171 -171
  70. package/server/services/provider-credentials.js +189 -189
  71. package/server/services/provider-models.js +381 -381
  72. package/server/services/telegram/telegram-http-client.js +130 -130
  73. package/server/services/vapid-keys.js +36 -36
  74. package/server/utils/port-access.js +209 -209
  75. package/scripts/rest-sweep.mjs +0 -93
@@ -0,0 +1,111 @@
1
+ // server/modules/orchestration/a2a/types.ts
2
+ // A2A protocol v0.2 types — minimal surface used by pixcode.
3
+ // See https://a2a-protocol.org for the full spec; this file
4
+ // keeps only what the orchestrator actually exchanges.
5
+
6
+ export type TaskState =
7
+ | 'submitted'
8
+ | 'working'
9
+ | 'input-required'
10
+ | 'completed'
11
+ | 'canceled'
12
+ | 'failed';
13
+
14
+ export type Role = 'user' | 'agent';
15
+
16
+ export type PartKind = 'text' | 'file' | 'data';
17
+
18
+ export interface TextPart {
19
+ kind: 'text';
20
+ text: string;
21
+ }
22
+
23
+ export interface FilePart {
24
+ kind: 'file';
25
+ name: string;
26
+ mimeType?: string;
27
+ bytesBase64?: string;
28
+ uri?: string;
29
+ }
30
+
31
+ export interface DataPart {
32
+ kind: 'data';
33
+ data: Record<string, unknown>;
34
+ }
35
+
36
+ export type Part = TextPart | FilePart | DataPart;
37
+
38
+ export interface Message {
39
+ messageId: string;
40
+ role: Role;
41
+ parts: Part[];
42
+ /** Required for task-scoped messages. Omit only for broadcast/standalone messages. */
43
+ taskId?: string;
44
+ }
45
+
46
+ export type ArtifactType =
47
+ | 'file-diff'
48
+ | 'command-output'
49
+ | 'preview-url'
50
+ | 'data';
51
+
52
+ // Note: Artifact and AuthScheme use `type` discriminator (matches A2A
53
+ // v0.2 wire format). Part and BusEvent use `kind` per the same spec.
54
+ export interface Artifact {
55
+ artifactId: string;
56
+ type: ArtifactType;
57
+ parts: Part[];
58
+ metadata?: Record<string, unknown>;
59
+ }
60
+
61
+ export interface TaskError {
62
+ code: string;
63
+ message: string;
64
+ details?: Record<string, unknown>;
65
+ }
66
+
67
+ export interface Task {
68
+ id: string;
69
+ contextId?: string;
70
+ state: TaskState;
71
+ history: Message[];
72
+ artifacts: Artifact[];
73
+ error?: TaskError;
74
+ metadata?: Record<string, unknown>;
75
+ createdAt: number;
76
+ updatedAt: number;
77
+ }
78
+
79
+ export interface AgentSkill {
80
+ id: string;
81
+ description: string;
82
+ examples?: string[];
83
+ }
84
+
85
+ export type AuthScheme =
86
+ | { type: 'none' }
87
+ | { type: 'bearer' }
88
+ | { type: 'mtls' };
89
+
90
+ export interface AgentCard {
91
+ name: string;
92
+ description: string;
93
+ url: string;
94
+ version: string;
95
+ capabilities: string[];
96
+ skills: AgentSkill[];
97
+ authentication: AuthScheme;
98
+ }
99
+
100
+ export interface SubmitTaskInput {
101
+ message: Message;
102
+ contextId?: string;
103
+ metadata?: Record<string, unknown>;
104
+ /** Adapter id, "auto", or "skill:<id>". Resolved by the adapter registry. */
105
+ adapterId: string;
106
+ }
107
+
108
+ export type BusEvent =
109
+ | { kind: 'task-state'; taskId: string; state: TaskState; error?: TaskError }
110
+ | { kind: 'message'; taskId: string; message: Message }
111
+ | { kind: 'artifact'; taskId: string; artifact: Artifact };
@@ -0,0 +1,90 @@
1
+ // server/modules/orchestration/a2a/validator.ts
2
+ // Hand-written validators for incoming A2A payloads.
3
+ // We deliberately avoid adding a new dep (zod, ajv) for the
4
+ // foundation; a follow-on plan can swap to a schema lib if needed.
5
+ //
6
+ // All path strings use JSONPath-style "$" as the document root so
7
+ // callers can map errors to wire-payload locations consistently.
8
+
9
+ import type { AgentCard, DataPart, FilePart, Message, Part, SubmitTaskInput, TextPart } from '@/modules/orchestration/a2a/types.js';
10
+
11
+ export class A2AValidationError extends Error {
12
+ constructor(message: string, public readonly path: string) {
13
+ super(`${path}: ${message}`);
14
+ this.name = 'A2AValidationError';
15
+ }
16
+ }
17
+
18
+ function assertNonEmptyString(value: unknown, path: string): asserts value is string {
19
+ if (typeof value !== 'string' || value.length === 0) {
20
+ throw new A2AValidationError('expected non-empty string', path);
21
+ }
22
+ }
23
+
24
+ function assertPart(value: unknown, path: string): asserts value is Part {
25
+ if (!value || typeof value !== 'object') {
26
+ throw new A2AValidationError('expected object', path);
27
+ }
28
+ const part = value as { kind?: unknown };
29
+ if (part.kind === 'text') {
30
+ assertNonEmptyString((part as Partial<TextPart>).text, `${path}.text`);
31
+ return;
32
+ }
33
+ if (part.kind === 'file') {
34
+ assertNonEmptyString((part as Partial<FilePart>).name, `${path}.name`);
35
+ return;
36
+ }
37
+ if (part.kind === 'data') {
38
+ const data = (part as Partial<DataPart>).data;
39
+ if (!data || typeof data !== 'object' || Array.isArray(data)) {
40
+ throw new A2AValidationError('data must be a plain object', `${path}.data`);
41
+ }
42
+ return;
43
+ }
44
+ throw new A2AValidationError('part.kind must be text|file|data', `${path}.kind`);
45
+ }
46
+
47
+ export function assertMessage(value: unknown, path = '$'): asserts value is Message {
48
+ if (!value || typeof value !== 'object') {
49
+ throw new A2AValidationError('expected object', path);
50
+ }
51
+ const m = value as { messageId?: unknown; role?: unknown; parts?: unknown };
52
+ assertNonEmptyString(m.messageId, `${path}.messageId`);
53
+ if (m.role !== 'user' && m.role !== 'agent') {
54
+ throw new A2AValidationError('role must be user|agent', `${path}.role`);
55
+ }
56
+ if (!Array.isArray(m.parts) || m.parts.length === 0) {
57
+ throw new A2AValidationError('parts must be non-empty array', `${path}.parts`);
58
+ }
59
+ m.parts.forEach((p, i) => assertPart(p, `${path}.parts[${i}]`));
60
+ }
61
+
62
+ export function assertSubmitTaskInput(value: unknown): asserts value is SubmitTaskInput {
63
+ if (!value || typeof value !== 'object') {
64
+ throw new A2AValidationError('expected object', '$');
65
+ }
66
+ const v = value as { message?: unknown; adapterId?: unknown };
67
+ assertMessage(v.message, '$.message');
68
+ assertNonEmptyString(v.adapterId, '$.adapterId');
69
+ }
70
+
71
+ export function assertAgentCard(value: unknown): asserts value is AgentCard {
72
+ if (!value || typeof value !== 'object') {
73
+ throw new A2AValidationError('expected object', '$');
74
+ }
75
+ const card = value as Partial<AgentCard>;
76
+ assertNonEmptyString(card.name, '$.name');
77
+ assertNonEmptyString(card.description, '$.description');
78
+ assertNonEmptyString(card.url, '$.url');
79
+ assertNonEmptyString(card.version, '$.version');
80
+ if (!Array.isArray(card.capabilities)) {
81
+ throw new A2AValidationError('capabilities must be array', '$.capabilities');
82
+ }
83
+ if (!Array.isArray(card.skills)) {
84
+ throw new A2AValidationError('skills must be array', '$.skills');
85
+ }
86
+ card.skills.forEach((s, i) => {
87
+ assertNonEmptyString(s.id, `$.skills[${i}].id`);
88
+ assertNonEmptyString(s.description, `$.skills[${i}].description`);
89
+ });
90
+ }
@@ -0,0 +1,26 @@
1
+ // server/modules/orchestration/index.ts
2
+ // Public surface for the orchestration module.
3
+ // All cross-module consumers must import from here per
4
+ // eslint.config.js boundaries rules.
5
+
6
+ export { createA2ARouter } from './a2a/routes.js';
7
+ export { adapterRegistry } from './a2a/adapter-registry.js';
8
+ export { ClaudeCodeA2AAdapter } from './a2a/adapters/claude-code.adapter.js';
9
+ export type {
10
+ AdapterContext,
11
+ TaskHandle,
12
+ } from './a2a/adapters/abstract-a2a.adapter.js';
13
+ export { AbstractA2AAdapter } from './a2a/adapters/abstract-a2a.adapter.js';
14
+ export { a2aBus } from './a2a/bus.js';
15
+ export type {
16
+ AgentCard,
17
+ Artifact,
18
+ ArtifactType,
19
+ BusEvent,
20
+ Message,
21
+ Part,
22
+ SubmitTaskInput,
23
+ Task,
24
+ TaskError,
25
+ TaskState,
26
+ } from './a2a/types.js';
@@ -1,130 +1,130 @@
1
- import { readFile } from 'node:fs/promises';
2
- import os from 'node:os';
3
- import path from 'node:path';
4
-
5
- import spawn from 'cross-spawn';
6
-
7
- import type { IProviderAuth } from '@/shared/interfaces.js';
8
- import type { ProviderAuthStatus } from '@/shared/types.js';
9
- import { readObjectRecord, readOptionalString } from '@/shared/utils.js';
10
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
11
- // @ts-ignore — plain-JS module, typed via inference
12
- import { getProviderCredentials } from '@/services/provider-credentials.js';
13
-
14
- type OpencodeCredentialsStatus = {
15
- authenticated: boolean;
16
- email: string | null;
17
- method: string | null;
18
- error?: string;
19
- };
20
-
21
- /**
22
- * OpenCode auth checker.
23
- *
24
- * OpenCode stores credentials at `~/.local/share/opencode/auth.json` (XDG
25
- * data dir — different layout from the other providers which use
26
- * `~/.<name>/`). The file is a JSON map of `providerName → { type, ... }`
27
- * where type is `api` (API key), `oauth` (OAuth tokens), or similar.
28
- *
29
- * Windows layout (as of the 2026 release): `%LOCALAPPDATA%\opencode\auth.json`.
30
- *
31
- * Since OpenCode is multi-provider (OpenAI, Anthropic, Google, Ollama,
32
- * OpenCode Zen), "authenticated" here means "at least ONE provider in
33
- * auth.json has credentials" — we don't care which.
34
- */
35
- export class OpencodeProviderAuth implements IProviderAuth {
36
- private checkInstalled(): boolean {
37
- const cliPath = process.env.OPENCODE_CLI_PATH || 'opencode';
38
- try {
39
- const result = spawn.sync(cliPath, ['--version'], { stdio: 'ignore', timeout: 5000 });
40
- return !result.error && result.status === 0;
41
- } catch {
42
- return false;
43
- }
44
- }
45
-
46
- async getStatus(): Promise<ProviderAuthStatus> {
47
- const installed = this.checkInstalled();
48
-
49
- if (!installed) {
50
- return {
51
- installed,
52
- provider: 'opencode',
53
- authenticated: false,
54
- email: null,
55
- method: null,
56
- error: 'OpenCode CLI is not installed',
57
- };
58
- }
59
-
60
- const credentials = await this.checkCredentials();
61
-
62
- return {
63
- installed,
64
- provider: 'opencode',
65
- authenticated: credentials.authenticated,
66
- email: credentials.email,
67
- method: credentials.method,
68
- error: credentials.authenticated ? undefined : credentials.error || 'Not authenticated',
69
- };
70
- }
71
-
72
- private async checkCredentials(): Promise<OpencodeCredentialsStatus> {
73
- // Pixcode-managed credentials come first — if the user stored an API
74
- // key via Settings > Agents > API Key, trust that regardless of
75
- // env vars or auth.json.
76
- try {
77
- const creds = await getProviderCredentials('opencode');
78
- if (creds?.apiKey) {
79
- return { authenticated: true, email: 'API Key Auth', method: 'pixcode_store' };
80
- }
81
- } catch { /* fall through */ }
82
-
83
- // Env-var shortcut — any of the multi-provider keys OpenCode recognises.
84
- const envKeys = ['ANTHROPIC_API_KEY', 'OPENAI_API_KEY', 'GOOGLE_API_KEY', 'OPENROUTER_API_KEY'];
85
- for (const k of envKeys) {
86
- if (process.env[k]?.trim()) {
87
- return { authenticated: true, email: `${k.replace('_API_KEY', '')} env`, method: 'api_key' };
88
- }
89
- }
90
-
91
- // auth.json — written by `opencode auth login`. On Windows the XDG
92
- // data dir typically resolves to `%LOCALAPPDATA%\opencode`, but since
93
- // Node's `os.homedir()` + `.local/share/opencode` covers the Linux
94
- // default and most WSL cases, we check both paths.
95
- const candidatePaths = [
96
- path.join(os.homedir(), '.local', 'share', 'opencode', 'auth.json'),
97
- path.join(os.homedir(), 'AppData', 'Local', 'opencode', 'auth.json'),
98
- ];
99
-
100
- for (const credsPath of candidatePaths) {
101
- try {
102
- const content = await readFile(credsPath, 'utf8');
103
- const creds = readObjectRecord(JSON.parse(content)) ?? {};
104
- const providerNames = Object.keys(creds);
105
- if (providerNames.length > 0) {
106
- // Prefer a real provider label over a generic one when we can
107
- // identify it.
108
- const firstProvider = providerNames[0];
109
- const firstConfig = readObjectRecord(creds[firstProvider]) ?? {};
110
- const authType = readOptionalString(firstConfig.type) ?? 'stored';
111
- const label = providerNames.length === 1
112
- ? `${firstProvider} (${authType})`
113
- : `${providerNames.length} providers configured`;
114
- return {
115
- authenticated: true,
116
- email: label,
117
- method: authType === 'oauth' ? 'credentials_file' : 'api_key',
118
- };
119
- }
120
- } catch { /* try next path */ }
121
- }
122
-
123
- return {
124
- authenticated: false,
125
- email: null,
126
- method: null,
127
- error: 'OpenCode is not configured — run `opencode auth login`.',
128
- };
129
- }
130
- }
1
+ import { readFile } from 'node:fs/promises';
2
+ import os from 'node:os';
3
+ import path from 'node:path';
4
+
5
+ import spawn from 'cross-spawn';
6
+
7
+ import type { IProviderAuth } from '@/shared/interfaces.js';
8
+ import type { ProviderAuthStatus } from '@/shared/types.js';
9
+ import { readObjectRecord, readOptionalString } from '@/shared/utils.js';
10
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
11
+ // @ts-ignore — plain-JS module, typed via inference
12
+ import { getProviderCredentials } from '@/services/provider-credentials.js';
13
+
14
+ type OpencodeCredentialsStatus = {
15
+ authenticated: boolean;
16
+ email: string | null;
17
+ method: string | null;
18
+ error?: string;
19
+ };
20
+
21
+ /**
22
+ * OpenCode auth checker.
23
+ *
24
+ * OpenCode stores credentials at `~/.local/share/opencode/auth.json` (XDG
25
+ * data dir — different layout from the other providers which use
26
+ * `~/.<name>/`). The file is a JSON map of `providerName → { type, ... }`
27
+ * where type is `api` (API key), `oauth` (OAuth tokens), or similar.
28
+ *
29
+ * Windows layout (as of the 2026 release): `%LOCALAPPDATA%\opencode\auth.json`.
30
+ *
31
+ * Since OpenCode is multi-provider (OpenAI, Anthropic, Google, Ollama,
32
+ * OpenCode Zen), "authenticated" here means "at least ONE provider in
33
+ * auth.json has credentials" — we don't care which.
34
+ */
35
+ export class OpencodeProviderAuth implements IProviderAuth {
36
+ private checkInstalled(): boolean {
37
+ const cliPath = process.env.OPENCODE_CLI_PATH || 'opencode';
38
+ try {
39
+ const result = spawn.sync(cliPath, ['--version'], { stdio: 'ignore', timeout: 5000 });
40
+ return !result.error && result.status === 0;
41
+ } catch {
42
+ return false;
43
+ }
44
+ }
45
+
46
+ async getStatus(): Promise<ProviderAuthStatus> {
47
+ const installed = this.checkInstalled();
48
+
49
+ if (!installed) {
50
+ return {
51
+ installed,
52
+ provider: 'opencode',
53
+ authenticated: false,
54
+ email: null,
55
+ method: null,
56
+ error: 'OpenCode CLI is not installed',
57
+ };
58
+ }
59
+
60
+ const credentials = await this.checkCredentials();
61
+
62
+ return {
63
+ installed,
64
+ provider: 'opencode',
65
+ authenticated: credentials.authenticated,
66
+ email: credentials.email,
67
+ method: credentials.method,
68
+ error: credentials.authenticated ? undefined : credentials.error || 'Not authenticated',
69
+ };
70
+ }
71
+
72
+ private async checkCredentials(): Promise<OpencodeCredentialsStatus> {
73
+ // Pixcode-managed credentials come first — if the user stored an API
74
+ // key via Settings > Agents > API Key, trust that regardless of
75
+ // env vars or auth.json.
76
+ try {
77
+ const creds = await getProviderCredentials('opencode');
78
+ if (creds?.apiKey) {
79
+ return { authenticated: true, email: 'API Key Auth', method: 'pixcode_store' };
80
+ }
81
+ } catch { /* fall through */ }
82
+
83
+ // Env-var shortcut — any of the multi-provider keys OpenCode recognises.
84
+ const envKeys = ['ANTHROPIC_API_KEY', 'OPENAI_API_KEY', 'GOOGLE_API_KEY', 'OPENROUTER_API_KEY'];
85
+ for (const k of envKeys) {
86
+ if (process.env[k]?.trim()) {
87
+ return { authenticated: true, email: `${k.replace('_API_KEY', '')} env`, method: 'api_key' };
88
+ }
89
+ }
90
+
91
+ // auth.json — written by `opencode auth login`. On Windows the XDG
92
+ // data dir typically resolves to `%LOCALAPPDATA%\opencode`, but since
93
+ // Node's `os.homedir()` + `.local/share/opencode` covers the Linux
94
+ // default and most WSL cases, we check both paths.
95
+ const candidatePaths = [
96
+ path.join(os.homedir(), '.local', 'share', 'opencode', 'auth.json'),
97
+ path.join(os.homedir(), 'AppData', 'Local', 'opencode', 'auth.json'),
98
+ ];
99
+
100
+ for (const credsPath of candidatePaths) {
101
+ try {
102
+ const content = await readFile(credsPath, 'utf8');
103
+ const creds = readObjectRecord(JSON.parse(content)) ?? {};
104
+ const providerNames = Object.keys(creds);
105
+ if (providerNames.length > 0) {
106
+ // Prefer a real provider label over a generic one when we can
107
+ // identify it.
108
+ const firstProvider = providerNames[0];
109
+ const firstConfig = readObjectRecord(creds[firstProvider]) ?? {};
110
+ const authType = readOptionalString(firstConfig.type) ?? 'stored';
111
+ const label = providerNames.length === 1
112
+ ? `${firstProvider} (${authType})`
113
+ : `${providerNames.length} providers configured`;
114
+ return {
115
+ authenticated: true,
116
+ email: label,
117
+ method: authType === 'oauth' ? 'credentials_file' : 'api_key',
118
+ };
119
+ }
120
+ } catch { /* try next path */ }
121
+ }
122
+
123
+ return {
124
+ authenticated: false,
125
+ email: null,
126
+ method: null,
127
+ error: 'OpenCode is not configured — run `opencode auth login`.',
128
+ };
129
+ }
130
+ }