@pixelbyte-software/pixcode 1.34.0 → 1.35.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 (155) hide show
  1. package/dist/api-docs.html +162 -9
  2. package/dist/assets/index-B8w57E1r.css +32 -0
  3. package/dist/assets/index-Djuh0wHV.js +854 -0
  4. package/dist/favicon.svg +8 -8
  5. package/dist/icons/icon-128x128.svg +9 -9
  6. package/dist/icons/icon-144x144.svg +9 -9
  7. package/dist/icons/icon-152x152.svg +9 -9
  8. package/dist/icons/icon-192x192.svg +9 -9
  9. package/dist/icons/icon-384x384.svg +9 -9
  10. package/dist/icons/icon-512x512.svg +9 -9
  11. package/dist/icons/icon-72x72.svg +9 -9
  12. package/dist/icons/icon-96x96.svg +9 -9
  13. package/dist/icons/icon-template.svg +9 -9
  14. package/dist/index.html +2 -2
  15. package/dist/logo.svg +12 -12
  16. package/dist/openapi.yaml +383 -1
  17. package/dist-server/server/claude-sdk.js +38 -7
  18. package/dist-server/server/claude-sdk.js.map +1 -1
  19. package/dist-server/server/cli.js +12 -17
  20. package/dist-server/server/cli.js.map +1 -1
  21. package/dist-server/server/daemon-manager.js +98 -51
  22. package/dist-server/server/daemon-manager.js.map +1 -1
  23. package/dist-server/server/database/json-store.js +8 -5
  24. package/dist-server/server/database/json-store.js.map +1 -1
  25. package/dist-server/server/index.js +31 -10
  26. package/dist-server/server/index.js.map +1 -1
  27. package/dist-server/server/modules/orchestration/a2a/adapter-registry.js +45 -19
  28. package/dist-server/server/modules/orchestration/a2a/adapter-registry.js.map +1 -1
  29. package/dist-server/server/modules/orchestration/a2a/adapters/abstract-a2a.adapter.js.map +1 -1
  30. package/dist-server/server/modules/orchestration/a2a/adapters/claude-code.adapter.js +1 -0
  31. package/dist-server/server/modules/orchestration/a2a/adapters/claude-code.adapter.js.map +1 -1
  32. package/dist-server/server/modules/orchestration/a2a/adapters/codex.adapter.js +202 -0
  33. package/dist-server/server/modules/orchestration/a2a/adapters/codex.adapter.js.map +1 -0
  34. package/dist-server/server/modules/orchestration/a2a/adapters/cursor.adapter.js +205 -0
  35. package/dist-server/server/modules/orchestration/a2a/adapters/cursor.adapter.js.map +1 -0
  36. package/dist-server/server/modules/orchestration/a2a/adapters/gemini.adapter.js +205 -0
  37. package/dist-server/server/modules/orchestration/a2a/adapters/gemini.adapter.js.map +1 -0
  38. package/dist-server/server/modules/orchestration/a2a/adapters/opencode.adapter.js +205 -0
  39. package/dist-server/server/modules/orchestration/a2a/adapters/opencode.adapter.js.map +1 -0
  40. package/dist-server/server/modules/orchestration/a2a/adapters/qwen.adapter.js +205 -0
  41. package/dist-server/server/modules/orchestration/a2a/adapters/qwen.adapter.js.map +1 -0
  42. package/dist-server/server/modules/orchestration/a2a/routes.js +298 -34
  43. package/dist-server/server/modules/orchestration/a2a/routes.js.map +1 -1
  44. package/dist-server/server/modules/orchestration/a2a/task-store.js +144 -0
  45. package/dist-server/server/modules/orchestration/a2a/task-store.js.map +1 -0
  46. package/dist-server/server/modules/orchestration/a2a/validator.js +16 -0
  47. package/dist-server/server/modules/orchestration/a2a/validator.js.map +1 -1
  48. package/dist-server/server/modules/orchestration/index.js +14 -0
  49. package/dist-server/server/modules/orchestration/index.js.map +1 -1
  50. package/dist-server/server/modules/orchestration/preview/port-watcher.js +90 -0
  51. package/dist-server/server/modules/orchestration/preview/port-watcher.js.map +1 -0
  52. package/dist-server/server/modules/orchestration/preview/preview-proxy.js +58 -0
  53. package/dist-server/server/modules/orchestration/preview/preview-proxy.js.map +1 -0
  54. package/dist-server/server/modules/orchestration/preview/types.js +2 -0
  55. package/dist-server/server/modules/orchestration/preview/types.js.map +1 -0
  56. package/dist-server/server/modules/orchestration/tasks/orchestration-task-store.js +37 -0
  57. package/dist-server/server/modules/orchestration/tasks/orchestration-task-store.js.map +1 -0
  58. package/dist-server/server/modules/orchestration/tasks/orchestration-task.routes.js +68 -0
  59. package/dist-server/server/modules/orchestration/tasks/orchestration-task.routes.js.map +1 -0
  60. package/dist-server/server/modules/orchestration/tasks/orchestration-task.service.js +128 -0
  61. package/dist-server/server/modules/orchestration/tasks/orchestration-task.service.js.map +1 -0
  62. package/dist-server/server/modules/orchestration/tasks/orchestration-task.types.js +2 -0
  63. package/dist-server/server/modules/orchestration/tasks/orchestration-task.types.js.map +1 -0
  64. package/dist-server/server/modules/orchestration/workflows/built-in-workflows.js +126 -0
  65. package/dist-server/server/modules/orchestration/workflows/built-in-workflows.js.map +1 -0
  66. package/dist-server/server/modules/orchestration/workflows/workflow-runner.js +1047 -0
  67. package/dist-server/server/modules/orchestration/workflows/workflow-runner.js.map +1 -0
  68. package/dist-server/server/modules/orchestration/workflows/workflow-store.js +76 -0
  69. package/dist-server/server/modules/orchestration/workflows/workflow-store.js.map +1 -0
  70. package/dist-server/server/modules/orchestration/workflows/workflow.routes.js +151 -0
  71. package/dist-server/server/modules/orchestration/workflows/workflow.routes.js.map +1 -0
  72. package/dist-server/server/modules/orchestration/workflows/workflow.types.js +2 -0
  73. package/dist-server/server/modules/orchestration/workflows/workflow.types.js.map +1 -0
  74. package/dist-server/server/modules/orchestration/workflows/workspace-target.js +98 -0
  75. package/dist-server/server/modules/orchestration/workflows/workspace-target.js.map +1 -0
  76. package/dist-server/server/modules/orchestration/workspace/docker-workspace.js +122 -0
  77. package/dist-server/server/modules/orchestration/workspace/docker-workspace.js.map +1 -0
  78. package/dist-server/server/modules/orchestration/workspace/path-safety.js +48 -0
  79. package/dist-server/server/modules/orchestration/workspace/path-safety.js.map +1 -0
  80. package/dist-server/server/modules/orchestration/workspace/types.js +11 -0
  81. package/dist-server/server/modules/orchestration/workspace/types.js.map +1 -0
  82. package/dist-server/server/modules/orchestration/workspace/workspace-manager.js +80 -0
  83. package/dist-server/server/modules/orchestration/workspace/workspace-manager.js.map +1 -0
  84. package/dist-server/server/modules/orchestration/workspace/worktree-workspace.js +96 -0
  85. package/dist-server/server/modules/orchestration/workspace/worktree-workspace.js.map +1 -0
  86. package/dist-server/server/modules/providers/index.js +3 -0
  87. package/dist-server/server/modules/providers/index.js.map +1 -0
  88. package/dist-server/server/openai-codex.js +35 -4
  89. package/dist-server/server/openai-codex.js.map +1 -1
  90. package/dist-server/server/routes/taskmaster.js +106 -89
  91. package/dist-server/server/routes/taskmaster.js.map +1 -1
  92. package/package.json +3 -1
  93. package/scripts/smoke/a2a-roundtrip.mjs +167 -98
  94. package/scripts/smoke/orchestration-api.mjs +172 -0
  95. package/scripts/smoke/orchestration-live-run.mjs +176 -0
  96. package/server/claude-sdk.js +48 -7
  97. package/server/cli.js +12 -17
  98. package/server/daemon-manager.js +90 -51
  99. package/server/database/db.js +794 -794
  100. package/server/database/json-store.js +8 -5
  101. package/server/index.js +40 -9
  102. package/server/modules/orchestration/a2a/adapter-registry.ts +108 -58
  103. package/server/modules/orchestration/a2a/adapters/abstract-a2a.adapter.ts +55 -49
  104. package/server/modules/orchestration/a2a/adapters/claude-code.adapter.ts +284 -283
  105. package/server/modules/orchestration/a2a/adapters/codex.adapter.ts +244 -0
  106. package/server/modules/orchestration/a2a/adapters/cursor.adapter.ts +249 -0
  107. package/server/modules/orchestration/a2a/adapters/gemini.adapter.ts +248 -0
  108. package/server/modules/orchestration/a2a/adapters/opencode.adapter.ts +248 -0
  109. package/server/modules/orchestration/a2a/adapters/qwen.adapter.ts +248 -0
  110. package/server/modules/orchestration/a2a/agent-card.ts +55 -55
  111. package/server/modules/orchestration/a2a/auth.middleware.ts +29 -29
  112. package/server/modules/orchestration/a2a/bus.ts +46 -46
  113. package/server/modules/orchestration/a2a/routes.ts +577 -264
  114. package/server/modules/orchestration/a2a/task-store.ts +178 -0
  115. package/server/modules/orchestration/a2a/types.ts +125 -111
  116. package/server/modules/orchestration/a2a/validator.ts +113 -90
  117. package/server/modules/orchestration/index.ts +66 -26
  118. package/server/modules/orchestration/preview/port-watcher.ts +112 -0
  119. package/server/modules/orchestration/preview/preview-proxy.ts +60 -0
  120. package/server/modules/orchestration/preview/types.ts +19 -0
  121. package/server/modules/orchestration/tasks/orchestration-task-store.ts +45 -0
  122. package/server/modules/orchestration/tasks/orchestration-task.routes.ts +73 -0
  123. package/server/modules/orchestration/tasks/orchestration-task.service.ts +145 -0
  124. package/server/modules/orchestration/tasks/orchestration-task.types.ts +29 -0
  125. package/server/modules/orchestration/workflows/built-in-workflows.ts +127 -0
  126. package/server/modules/orchestration/workflows/workflow-runner.ts +1206 -0
  127. package/server/modules/orchestration/workflows/workflow-store.ts +97 -0
  128. package/server/modules/orchestration/workflows/workflow.routes.ts +169 -0
  129. package/server/modules/orchestration/workflows/workflow.types.ts +70 -0
  130. package/server/modules/orchestration/workflows/workspace-target.ts +120 -0
  131. package/server/modules/orchestration/workspace/docker-workspace.ts +135 -0
  132. package/server/modules/orchestration/workspace/path-safety.ts +55 -0
  133. package/server/modules/orchestration/workspace/types.ts +52 -0
  134. package/server/modules/orchestration/workspace/workspace-manager.ts +97 -0
  135. package/server/modules/orchestration/workspace/worktree-workspace.ts +125 -0
  136. package/server/modules/providers/index.ts +2 -0
  137. package/server/modules/providers/list/opencode/opencode-auth.provider.ts +130 -130
  138. package/server/modules/providers/list/opencode/opencode-mcp.provider.ts +126 -126
  139. package/server/modules/providers/list/opencode/opencode.provider.ts +29 -29
  140. package/server/modules/providers/list/qwen/qwen-auth.provider.ts +145 -145
  141. package/server/modules/providers/list/qwen/qwen-mcp.provider.ts +114 -114
  142. package/server/modules/providers/list/qwen/qwen.provider.ts +21 -21
  143. package/server/modules/providers/shared/provider-configs.ts +142 -142
  144. package/server/openai-codex.js +40 -4
  145. package/server/qwen-code-cli.js +395 -395
  146. package/server/qwen-response-handler.js +73 -73
  147. package/server/routes/qwen.js +27 -27
  148. package/server/routes/taskmaster.js +116 -91
  149. package/server/services/external-access.js +171 -171
  150. package/server/services/provider-models.js +381 -381
  151. package/server/services/telegram/telegram-http-client.js +130 -130
  152. package/server/services/vapid-keys.js +36 -36
  153. package/server/utils/port-access.js +209 -209
  154. package/dist/assets/index-B1ghfb4w.css +0 -32
  155. package/dist/assets/index-BvClqlMf.js +0 -852
@@ -1,114 +1,114 @@
1
- import os from 'node:os';
2
- import path from 'node:path';
3
-
4
- import { McpProvider } from '@/modules/providers/shared/mcp/mcp.provider.js';
5
- import type { McpScope, ProviderMcpServer, UpsertProviderMcpServerInput } from '@/shared/types.js';
6
- import {
7
- AppError,
8
- readJsonConfig,
9
- readObjectRecord,
10
- readOptionalString,
11
- readStringArray,
12
- readStringRecord,
13
- writeJsonConfig,
14
- } from '@/shared/utils.js';
15
-
16
- /**
17
- * Qwen Code MCP provider. Qwen reads MCP servers out of the same
18
- * `settings.json` shape Gemini uses, just under `~/.qwen/` instead of
19
- * `~/.gemini/`. Supported transports and scopes match Gemini.
20
- */
21
- export class QwenMcpProvider extends McpProvider {
22
- constructor() {
23
- super('qwen', ['user', 'project'], ['stdio', 'http', 'sse']);
24
- }
25
-
26
- protected async readScopedServers(scope: McpScope, workspacePath: string): Promise<Record<string, unknown>> {
27
- const filePath = scope === 'user'
28
- ? path.join(os.homedir(), '.qwen', 'settings.json')
29
- : path.join(workspacePath, '.qwen', 'settings.json');
30
- const config = await readJsonConfig(filePath);
31
- return readObjectRecord(config.mcpServers) ?? {};
32
- }
33
-
34
- protected async writeScopedServers(
35
- scope: McpScope,
36
- workspacePath: string,
37
- servers: Record<string, unknown>,
38
- ): Promise<void> {
39
- const filePath = scope === 'user'
40
- ? path.join(os.homedir(), '.qwen', 'settings.json')
41
- : path.join(workspacePath, '.qwen', 'settings.json');
42
- const config = await readJsonConfig(filePath);
43
- config.mcpServers = servers;
44
- await writeJsonConfig(filePath, config);
45
- }
46
-
47
- protected buildServerConfig(input: UpsertProviderMcpServerInput): Record<string, unknown> {
48
- if (input.transport === 'stdio') {
49
- if (!input.command?.trim()) {
50
- throw new AppError('command is required for stdio MCP servers.', {
51
- code: 'MCP_COMMAND_REQUIRED',
52
- statusCode: 400,
53
- });
54
- }
55
- return {
56
- command: input.command,
57
- args: input.args ?? [],
58
- env: input.env ?? {},
59
- cwd: input.cwd,
60
- };
61
- }
62
-
63
- if (!input.url?.trim()) {
64
- throw new AppError('url is required for http/sse MCP servers.', {
65
- code: 'MCP_URL_REQUIRED',
66
- statusCode: 400,
67
- });
68
- }
69
-
70
- return {
71
- type: input.transport,
72
- url: input.url,
73
- headers: input.headers ?? {},
74
- };
75
- }
76
-
77
- protected normalizeServerConfig(
78
- scope: McpScope,
79
- name: string,
80
- rawConfig: unknown,
81
- ): ProviderMcpServer | null {
82
- if (!rawConfig || typeof rawConfig !== 'object') {
83
- return null;
84
- }
85
-
86
- const config = rawConfig as Record<string, unknown>;
87
- if (typeof config.command === 'string') {
88
- return {
89
- provider: 'qwen',
90
- name,
91
- scope,
92
- transport: 'stdio',
93
- command: config.command,
94
- args: readStringArray(config.args),
95
- env: readStringRecord(config.env),
96
- cwd: readOptionalString(config.cwd),
97
- };
98
- }
99
-
100
- if (typeof config.url === 'string') {
101
- const transport = readOptionalString(config.type) === 'sse' ? 'sse' : 'http';
102
- return {
103
- provider: 'qwen',
104
- name,
105
- scope,
106
- transport,
107
- url: config.url,
108
- headers: readStringRecord(config.headers),
109
- };
110
- }
111
-
112
- return null;
113
- }
114
- }
1
+ import os from 'node:os';
2
+ import path from 'node:path';
3
+
4
+ import { McpProvider } from '@/modules/providers/shared/mcp/mcp.provider.js';
5
+ import type { McpScope, ProviderMcpServer, UpsertProviderMcpServerInput } from '@/shared/types.js';
6
+ import {
7
+ AppError,
8
+ readJsonConfig,
9
+ readObjectRecord,
10
+ readOptionalString,
11
+ readStringArray,
12
+ readStringRecord,
13
+ writeJsonConfig,
14
+ } from '@/shared/utils.js';
15
+
16
+ /**
17
+ * Qwen Code MCP provider. Qwen reads MCP servers out of the same
18
+ * `settings.json` shape Gemini uses, just under `~/.qwen/` instead of
19
+ * `~/.gemini/`. Supported transports and scopes match Gemini.
20
+ */
21
+ export class QwenMcpProvider extends McpProvider {
22
+ constructor() {
23
+ super('qwen', ['user', 'project'], ['stdio', 'http', 'sse']);
24
+ }
25
+
26
+ protected async readScopedServers(scope: McpScope, workspacePath: string): Promise<Record<string, unknown>> {
27
+ const filePath = scope === 'user'
28
+ ? path.join(os.homedir(), '.qwen', 'settings.json')
29
+ : path.join(workspacePath, '.qwen', 'settings.json');
30
+ const config = await readJsonConfig(filePath);
31
+ return readObjectRecord(config.mcpServers) ?? {};
32
+ }
33
+
34
+ protected async writeScopedServers(
35
+ scope: McpScope,
36
+ workspacePath: string,
37
+ servers: Record<string, unknown>,
38
+ ): Promise<void> {
39
+ const filePath = scope === 'user'
40
+ ? path.join(os.homedir(), '.qwen', 'settings.json')
41
+ : path.join(workspacePath, '.qwen', 'settings.json');
42
+ const config = await readJsonConfig(filePath);
43
+ config.mcpServers = servers;
44
+ await writeJsonConfig(filePath, config);
45
+ }
46
+
47
+ protected buildServerConfig(input: UpsertProviderMcpServerInput): Record<string, unknown> {
48
+ if (input.transport === 'stdio') {
49
+ if (!input.command?.trim()) {
50
+ throw new AppError('command is required for stdio MCP servers.', {
51
+ code: 'MCP_COMMAND_REQUIRED',
52
+ statusCode: 400,
53
+ });
54
+ }
55
+ return {
56
+ command: input.command,
57
+ args: input.args ?? [],
58
+ env: input.env ?? {},
59
+ cwd: input.cwd,
60
+ };
61
+ }
62
+
63
+ if (!input.url?.trim()) {
64
+ throw new AppError('url is required for http/sse MCP servers.', {
65
+ code: 'MCP_URL_REQUIRED',
66
+ statusCode: 400,
67
+ });
68
+ }
69
+
70
+ return {
71
+ type: input.transport,
72
+ url: input.url,
73
+ headers: input.headers ?? {},
74
+ };
75
+ }
76
+
77
+ protected normalizeServerConfig(
78
+ scope: McpScope,
79
+ name: string,
80
+ rawConfig: unknown,
81
+ ): ProviderMcpServer | null {
82
+ if (!rawConfig || typeof rawConfig !== 'object') {
83
+ return null;
84
+ }
85
+
86
+ const config = rawConfig as Record<string, unknown>;
87
+ if (typeof config.command === 'string') {
88
+ return {
89
+ provider: 'qwen',
90
+ name,
91
+ scope,
92
+ transport: 'stdio',
93
+ command: config.command,
94
+ args: readStringArray(config.args),
95
+ env: readStringRecord(config.env),
96
+ cwd: readOptionalString(config.cwd),
97
+ };
98
+ }
99
+
100
+ if (typeof config.url === 'string') {
101
+ const transport = readOptionalString(config.type) === 'sse' ? 'sse' : 'http';
102
+ return {
103
+ provider: 'qwen',
104
+ name,
105
+ scope,
106
+ transport,
107
+ url: config.url,
108
+ headers: readStringRecord(config.headers),
109
+ };
110
+ }
111
+
112
+ return null;
113
+ }
114
+ }
@@ -1,21 +1,21 @@
1
- import { AbstractProvider } from '@/modules/providers/shared/base/abstract.provider.js';
2
- import { QwenProviderAuth } from '@/modules/providers/list/qwen/qwen-auth.provider.js';
3
- import { QwenMcpProvider } from '@/modules/providers/list/qwen/qwen-mcp.provider.js';
4
- import { QwenSessionsProvider } from '@/modules/providers/list/qwen/qwen-sessions.provider.js';
5
- import type { IProviderAuth, IProviderSessions } from '@/shared/interfaces.js';
6
-
7
- /**
8
- * Qwen Code provider (Alibaba's Gemini CLI fork). The three sub-providers
9
- * mirror the Gemini layout — Qwen shares the on-disk layout, config format,
10
- * and stream-json protocol, so the auth/mcp/sessions modules are intentional
11
- * structural twins.
12
- */
13
- export class QwenProvider extends AbstractProvider {
14
- readonly mcp = new QwenMcpProvider();
15
- readonly auth: IProviderAuth = new QwenProviderAuth();
16
- readonly sessions: IProviderSessions = new QwenSessionsProvider();
17
-
18
- constructor() {
19
- super('qwen');
20
- }
21
- }
1
+ import { AbstractProvider } from '@/modules/providers/shared/base/abstract.provider.js';
2
+ import { QwenProviderAuth } from '@/modules/providers/list/qwen/qwen-auth.provider.js';
3
+ import { QwenMcpProvider } from '@/modules/providers/list/qwen/qwen-mcp.provider.js';
4
+ import { QwenSessionsProvider } from '@/modules/providers/list/qwen/qwen-sessions.provider.js';
5
+ import type { IProviderAuth, IProviderSessions } from '@/shared/interfaces.js';
6
+
7
+ /**
8
+ * Qwen Code provider (Alibaba's Gemini CLI fork). The three sub-providers
9
+ * mirror the Gemini layout — Qwen shares the on-disk layout, config format,
10
+ * and stream-json protocol, so the auth/mcp/sessions modules are intentional
11
+ * structural twins.
12
+ */
13
+ export class QwenProvider extends AbstractProvider {
14
+ readonly mcp = new QwenMcpProvider();
15
+ readonly auth: IProviderAuth = new QwenProviderAuth();
16
+ readonly sessions: IProviderSessions = new QwenSessionsProvider();
17
+
18
+ constructor() {
19
+ super('qwen');
20
+ }
21
+ }
@@ -1,142 +1,142 @@
1
- /**
2
- * Registry of user-editable config files per provider CLI.
3
- *
4
- * This is the single source of truth for the Settings → Agents →
5
- * Configuration tab. Adding a new provider? Append a row here and the
6
- * UI + API pick it up — no component changes required.
7
- *
8
- * Rules:
9
- * - `relativePath` is relative to the user's home directory.
10
- * We never accept absolute paths from the client; the server
11
- * resolves these explicitly so path traversal is impossible.
12
- * - `format` drives the CodeMirror language extension on the client.
13
- * - `readonly: true` hides the Save button and the server rejects
14
- * writes. Use it for files the CLI owns (e.g. OAuth tokens).
15
- * - `description` is shown as a subtle caption under the editor.
16
- */
17
-
18
- export type ProviderConfigFormat = 'json' | 'toml' | 'env' | 'text';
19
-
20
- export type ProviderConfigFile = {
21
- id: string;
22
- label: string;
23
- relativePath: string;
24
- format: ProviderConfigFormat;
25
- readonly?: boolean;
26
- description?: string;
27
- };
28
-
29
- export const PROVIDER_CONFIG_FILES: Record<string, ProviderConfigFile[]> = {
30
- claude: [
31
- {
32
- id: 'settings',
33
- label: 'settings.json',
34
- relativePath: '.claude/settings.json',
35
- format: 'json',
36
- description: 'Main Claude Code settings — default model, system prompt, tool policy.',
37
- },
38
- {
39
- id: 'env',
40
- label: '.env',
41
- relativePath: '.claude/.env',
42
- format: 'env',
43
- description: 'Environment variables loaded when Claude runs (e.g. ANTHROPIC_API_KEY).',
44
- },
45
- ],
46
- codex: [
47
- {
48
- id: 'config',
49
- label: 'config.toml',
50
- relativePath: '.codex/config.toml',
51
- format: 'toml',
52
- description: 'Main Codex CLI config — models, MCP servers, approval policy, sandbox mode.',
53
- },
54
- {
55
- id: 'env',
56
- label: '.env',
57
- relativePath: '.codex/.env',
58
- format: 'env',
59
- description: 'Environment variables (OPENAI_API_KEY, OPENAI_BASE_URL, …).',
60
- },
61
- {
62
- id: 'auth',
63
- label: 'auth.json',
64
- relativePath: '.codex/auth.json',
65
- format: 'json',
66
- readonly: true,
67
- description: 'OAuth tokens managed by `codex login`. Read-only; editing here would corrupt the session.',
68
- },
69
- ],
70
- cursor: [
71
- {
72
- id: 'env',
73
- label: '.env',
74
- relativePath: '.cursor/.env',
75
- format: 'env',
76
- description: 'Cursor CLI environment variables.',
77
- },
78
- ],
79
- gemini: [
80
- {
81
- id: 'settings',
82
- label: 'settings.json',
83
- relativePath: '.gemini/settings.json',
84
- format: 'json',
85
- description: 'Main Gemini CLI settings — selected model, MCP servers, tool approval mode.',
86
- },
87
- {
88
- id: 'env',
89
- label: '.env',
90
- relativePath: '.gemini/.env',
91
- format: 'env',
92
- description: 'Environment variables (GOOGLE_API_KEY, GEMINI_API_KEY, …).',
93
- },
94
- ],
95
- qwen: [
96
- {
97
- id: 'settings',
98
- label: 'settings.json',
99
- relativePath: '.qwen/settings.json',
100
- format: 'json',
101
- description: 'Main Qwen Code settings — selected model, MCP servers, approval mode.',
102
- },
103
- {
104
- id: 'env',
105
- label: '.env',
106
- relativePath: '.qwen/.env',
107
- format: 'env',
108
- description: 'Environment variables (DASHSCOPE_API_KEY, OPENAI_API_KEY for OpenAI-compatible routes, …).',
109
- },
110
- ],
111
- opencode: [
112
- {
113
- id: 'config',
114
- label: 'opencode.json',
115
- relativePath: '.config/opencode/opencode.json',
116
- format: 'json',
117
- description: 'Main OpenCode config — provider, model, MCP servers, permission rules, agents.',
118
- },
119
- {
120
- id: 'tui',
121
- label: 'tui.json',
122
- relativePath: '.config/opencode/tui.json',
123
- format: 'json',
124
- description: 'Terminal UI preferences (theme, keybinds). Separate from the main config since 2026-02.',
125
- },
126
- {
127
- id: 'auth',
128
- label: 'auth.json',
129
- relativePath: '.local/share/opencode/auth.json',
130
- format: 'json',
131
- readonly: true,
132
- description: 'Provider credentials managed by `opencode auth login`. Read-only here; editing would corrupt stored OAuth tokens.',
133
- },
134
- ],
135
- };
136
-
137
- export const SUPPORTED_CONFIG_PROVIDERS = Object.keys(PROVIDER_CONFIG_FILES);
138
-
139
- // Hard cap — no config file we care about is remotely this big, but we
140
- // want to refuse reads and writes that would swell memory. Editing a 1 MB
141
- // settings.json is already a smell.
142
- export const MAX_CONFIG_FILE_SIZE_BYTES = 1_048_576; // 1 MB
1
+ /**
2
+ * Registry of user-editable config files per provider CLI.
3
+ *
4
+ * This is the single source of truth for the Settings → Agents →
5
+ * Configuration tab. Adding a new provider? Append a row here and the
6
+ * UI + API pick it up — no component changes required.
7
+ *
8
+ * Rules:
9
+ * - `relativePath` is relative to the user's home directory.
10
+ * We never accept absolute paths from the client; the server
11
+ * resolves these explicitly so path traversal is impossible.
12
+ * - `format` drives the CodeMirror language extension on the client.
13
+ * - `readonly: true` hides the Save button and the server rejects
14
+ * writes. Use it for files the CLI owns (e.g. OAuth tokens).
15
+ * - `description` is shown as a subtle caption under the editor.
16
+ */
17
+
18
+ export type ProviderConfigFormat = 'json' | 'toml' | 'env' | 'text';
19
+
20
+ export type ProviderConfigFile = {
21
+ id: string;
22
+ label: string;
23
+ relativePath: string;
24
+ format: ProviderConfigFormat;
25
+ readonly?: boolean;
26
+ description?: string;
27
+ };
28
+
29
+ export const PROVIDER_CONFIG_FILES: Record<string, ProviderConfigFile[]> = {
30
+ claude: [
31
+ {
32
+ id: 'settings',
33
+ label: 'settings.json',
34
+ relativePath: '.claude/settings.json',
35
+ format: 'json',
36
+ description: 'Main Claude Code settings — default model, system prompt, tool policy.',
37
+ },
38
+ {
39
+ id: 'env',
40
+ label: '.env',
41
+ relativePath: '.claude/.env',
42
+ format: 'env',
43
+ description: 'Environment variables loaded when Claude runs (e.g. ANTHROPIC_API_KEY).',
44
+ },
45
+ ],
46
+ codex: [
47
+ {
48
+ id: 'config',
49
+ label: 'config.toml',
50
+ relativePath: '.codex/config.toml',
51
+ format: 'toml',
52
+ description: 'Main Codex CLI config — models, MCP servers, approval policy, sandbox mode.',
53
+ },
54
+ {
55
+ id: 'env',
56
+ label: '.env',
57
+ relativePath: '.codex/.env',
58
+ format: 'env',
59
+ description: 'Environment variables (OPENAI_API_KEY, OPENAI_BASE_URL, …).',
60
+ },
61
+ {
62
+ id: 'auth',
63
+ label: 'auth.json',
64
+ relativePath: '.codex/auth.json',
65
+ format: 'json',
66
+ readonly: true,
67
+ description: 'OAuth tokens managed by `codex login`. Read-only; editing here would corrupt the session.',
68
+ },
69
+ ],
70
+ cursor: [
71
+ {
72
+ id: 'env',
73
+ label: '.env',
74
+ relativePath: '.cursor/.env',
75
+ format: 'env',
76
+ description: 'Cursor CLI environment variables.',
77
+ },
78
+ ],
79
+ gemini: [
80
+ {
81
+ id: 'settings',
82
+ label: 'settings.json',
83
+ relativePath: '.gemini/settings.json',
84
+ format: 'json',
85
+ description: 'Main Gemini CLI settings — selected model, MCP servers, tool approval mode.',
86
+ },
87
+ {
88
+ id: 'env',
89
+ label: '.env',
90
+ relativePath: '.gemini/.env',
91
+ format: 'env',
92
+ description: 'Environment variables (GOOGLE_API_KEY, GEMINI_API_KEY, …).',
93
+ },
94
+ ],
95
+ qwen: [
96
+ {
97
+ id: 'settings',
98
+ label: 'settings.json',
99
+ relativePath: '.qwen/settings.json',
100
+ format: 'json',
101
+ description: 'Main Qwen Code settings — selected model, MCP servers, approval mode.',
102
+ },
103
+ {
104
+ id: 'env',
105
+ label: '.env',
106
+ relativePath: '.qwen/.env',
107
+ format: 'env',
108
+ description: 'Environment variables (DASHSCOPE_API_KEY, OPENAI_API_KEY for OpenAI-compatible routes, …).',
109
+ },
110
+ ],
111
+ opencode: [
112
+ {
113
+ id: 'config',
114
+ label: 'opencode.json',
115
+ relativePath: '.config/opencode/opencode.json',
116
+ format: 'json',
117
+ description: 'Main OpenCode config — provider, model, MCP servers, permission rules, agents.',
118
+ },
119
+ {
120
+ id: 'tui',
121
+ label: 'tui.json',
122
+ relativePath: '.config/opencode/tui.json',
123
+ format: 'json',
124
+ description: 'Terminal UI preferences (theme, keybinds). Separate from the main config since 2026-02.',
125
+ },
126
+ {
127
+ id: 'auth',
128
+ label: 'auth.json',
129
+ relativePath: '.local/share/opencode/auth.json',
130
+ format: 'json',
131
+ readonly: true,
132
+ description: 'Provider credentials managed by `opencode auth login`. Read-only here; editing would corrupt stored OAuth tokens.',
133
+ },
134
+ ],
135
+ };
136
+
137
+ export const SUPPORTED_CONFIG_PROVIDERS = Object.keys(PROVIDER_CONFIG_FILES);
138
+
139
+ // Hard cap — no config file we care about is remotely this big, but we
140
+ // want to refuse reads and writes that would swell memory. Editing a 1 MB
141
+ // settings.json is already a smell.
142
+ export const MAX_CONFIG_FILE_SIZE_BYTES = 1_048_576; // 1 MB
@@ -13,7 +13,11 @@
13
13
  * - getActiveCodexSessions() - List all active sessions
14
14
  */
15
15
 
16
+ import { accessSync, constants } from 'node:fs';
17
+ import path from 'node:path';
18
+
16
19
  import { Codex } from '@openai/codex-sdk';
20
+
17
21
  import { notifyRunFailed, notifyRunStopped } from './services/notification-orchestrator.js';
18
22
  import { sessionsService } from './modules/providers/services/sessions.service.js';
19
23
  import { providerAuthService } from './modules/providers/services/provider-auth.service.js';
@@ -22,6 +26,34 @@ import { createNormalizedMessage } from './shared/utils.js';
22
26
  // Track active sessions
23
27
  const activeCodexSessions = new Map();
24
28
 
29
+ function isExecutable(filePath) {
30
+ try {
31
+ accessSync(filePath, constants.X_OK);
32
+ return true;
33
+ } catch {
34
+ return false;
35
+ }
36
+ }
37
+
38
+ function resolveCodexPathOverride() {
39
+ const configuredPath = process.env.CODEX_CLI_PATH || process.env.CODEX_PATH;
40
+ if (configuredPath && isExecutable(configuredPath)) {
41
+ return configuredPath;
42
+ }
43
+
44
+ const pathCandidates = (process.env.PATH || '')
45
+ .split(path.delimiter)
46
+ .filter(Boolean)
47
+ .map((entry) => path.join(entry, 'codex'));
48
+
49
+ return [
50
+ ...pathCandidates,
51
+ '/root/.npm-global/bin/codex',
52
+ '/usr/local/bin/codex',
53
+ '/usr/bin/codex',
54
+ ].find(isExecutable);
55
+ }
56
+
25
57
  /**
26
58
  * Transform Codex SDK event to WebSocket message format
27
59
  * @param {object} event - SDK event
@@ -213,16 +245,20 @@ export async function queryCodex(command, options = {}, ws) {
213
245
 
214
246
  try {
215
247
  // Initialize Codex SDK
216
- codex = new Codex();
248
+ const codexPathOverride = resolveCodexPathOverride();
249
+ codex = new Codex(codexPathOverride ? { codexPathOverride } : undefined);
217
250
 
218
- // Thread options with sandbox and approval settings
251
+ // Thread options with sandbox and approval settings. Do not pass a blank
252
+ // model: the SDK may resolve it to a hard default instead of CLI settings.
219
253
  const threadOptions = {
220
254
  workingDirectory,
221
255
  skipGitRepoCheck: true,
222
256
  sandboxMode,
223
- approvalPolicy,
224
- model
257
+ approvalPolicy
225
258
  };
259
+ if (typeof model === 'string' && model.trim()) {
260
+ threadOptions.model = model.trim();
261
+ }
226
262
 
227
263
  // Start or resume thread
228
264
  if (sessionId) {