@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.
- package/dist/api-docs.html +162 -9
- package/dist/assets/index-B8w57E1r.css +32 -0
- package/dist/assets/index-Djuh0wHV.js +854 -0
- package/dist/favicon.svg +8 -8
- package/dist/icons/icon-128x128.svg +9 -9
- package/dist/icons/icon-144x144.svg +9 -9
- package/dist/icons/icon-152x152.svg +9 -9
- package/dist/icons/icon-192x192.svg +9 -9
- package/dist/icons/icon-384x384.svg +9 -9
- package/dist/icons/icon-512x512.svg +9 -9
- package/dist/icons/icon-72x72.svg +9 -9
- package/dist/icons/icon-96x96.svg +9 -9
- package/dist/icons/icon-template.svg +9 -9
- package/dist/index.html +2 -2
- package/dist/logo.svg +12 -12
- package/dist/openapi.yaml +383 -1
- package/dist-server/server/claude-sdk.js +38 -7
- package/dist-server/server/claude-sdk.js.map +1 -1
- package/dist-server/server/cli.js +12 -17
- package/dist-server/server/cli.js.map +1 -1
- package/dist-server/server/daemon-manager.js +98 -51
- package/dist-server/server/daemon-manager.js.map +1 -1
- package/dist-server/server/database/json-store.js +8 -5
- package/dist-server/server/database/json-store.js.map +1 -1
- package/dist-server/server/index.js +31 -10
- package/dist-server/server/index.js.map +1 -1
- package/dist-server/server/modules/orchestration/a2a/adapter-registry.js +45 -19
- package/dist-server/server/modules/orchestration/a2a/adapter-registry.js.map +1 -1
- package/dist-server/server/modules/orchestration/a2a/adapters/abstract-a2a.adapter.js.map +1 -1
- package/dist-server/server/modules/orchestration/a2a/adapters/claude-code.adapter.js +1 -0
- package/dist-server/server/modules/orchestration/a2a/adapters/claude-code.adapter.js.map +1 -1
- package/dist-server/server/modules/orchestration/a2a/adapters/codex.adapter.js +202 -0
- package/dist-server/server/modules/orchestration/a2a/adapters/codex.adapter.js.map +1 -0
- package/dist-server/server/modules/orchestration/a2a/adapters/cursor.adapter.js +205 -0
- package/dist-server/server/modules/orchestration/a2a/adapters/cursor.adapter.js.map +1 -0
- package/dist-server/server/modules/orchestration/a2a/adapters/gemini.adapter.js +205 -0
- package/dist-server/server/modules/orchestration/a2a/adapters/gemini.adapter.js.map +1 -0
- package/dist-server/server/modules/orchestration/a2a/adapters/opencode.adapter.js +205 -0
- package/dist-server/server/modules/orchestration/a2a/adapters/opencode.adapter.js.map +1 -0
- package/dist-server/server/modules/orchestration/a2a/adapters/qwen.adapter.js +205 -0
- package/dist-server/server/modules/orchestration/a2a/adapters/qwen.adapter.js.map +1 -0
- package/dist-server/server/modules/orchestration/a2a/routes.js +298 -34
- package/dist-server/server/modules/orchestration/a2a/routes.js.map +1 -1
- package/dist-server/server/modules/orchestration/a2a/task-store.js +144 -0
- package/dist-server/server/modules/orchestration/a2a/task-store.js.map +1 -0
- package/dist-server/server/modules/orchestration/a2a/validator.js +16 -0
- package/dist-server/server/modules/orchestration/a2a/validator.js.map +1 -1
- package/dist-server/server/modules/orchestration/index.js +14 -0
- package/dist-server/server/modules/orchestration/index.js.map +1 -1
- package/dist-server/server/modules/orchestration/preview/port-watcher.js +90 -0
- package/dist-server/server/modules/orchestration/preview/port-watcher.js.map +1 -0
- package/dist-server/server/modules/orchestration/preview/preview-proxy.js +58 -0
- package/dist-server/server/modules/orchestration/preview/preview-proxy.js.map +1 -0
- package/dist-server/server/modules/orchestration/preview/types.js +2 -0
- package/dist-server/server/modules/orchestration/preview/types.js.map +1 -0
- package/dist-server/server/modules/orchestration/tasks/orchestration-task-store.js +37 -0
- package/dist-server/server/modules/orchestration/tasks/orchestration-task-store.js.map +1 -0
- package/dist-server/server/modules/orchestration/tasks/orchestration-task.routes.js +68 -0
- package/dist-server/server/modules/orchestration/tasks/orchestration-task.routes.js.map +1 -0
- package/dist-server/server/modules/orchestration/tasks/orchestration-task.service.js +128 -0
- package/dist-server/server/modules/orchestration/tasks/orchestration-task.service.js.map +1 -0
- package/dist-server/server/modules/orchestration/tasks/orchestration-task.types.js +2 -0
- package/dist-server/server/modules/orchestration/tasks/orchestration-task.types.js.map +1 -0
- package/dist-server/server/modules/orchestration/workflows/built-in-workflows.js +126 -0
- package/dist-server/server/modules/orchestration/workflows/built-in-workflows.js.map +1 -0
- package/dist-server/server/modules/orchestration/workflows/workflow-runner.js +1047 -0
- package/dist-server/server/modules/orchestration/workflows/workflow-runner.js.map +1 -0
- package/dist-server/server/modules/orchestration/workflows/workflow-store.js +76 -0
- package/dist-server/server/modules/orchestration/workflows/workflow-store.js.map +1 -0
- package/dist-server/server/modules/orchestration/workflows/workflow.routes.js +151 -0
- package/dist-server/server/modules/orchestration/workflows/workflow.routes.js.map +1 -0
- package/dist-server/server/modules/orchestration/workflows/workflow.types.js +2 -0
- package/dist-server/server/modules/orchestration/workflows/workflow.types.js.map +1 -0
- package/dist-server/server/modules/orchestration/workflows/workspace-target.js +98 -0
- package/dist-server/server/modules/orchestration/workflows/workspace-target.js.map +1 -0
- package/dist-server/server/modules/orchestration/workspace/docker-workspace.js +122 -0
- package/dist-server/server/modules/orchestration/workspace/docker-workspace.js.map +1 -0
- package/dist-server/server/modules/orchestration/workspace/path-safety.js +48 -0
- package/dist-server/server/modules/orchestration/workspace/path-safety.js.map +1 -0
- package/dist-server/server/modules/orchestration/workspace/types.js +11 -0
- package/dist-server/server/modules/orchestration/workspace/types.js.map +1 -0
- package/dist-server/server/modules/orchestration/workspace/workspace-manager.js +80 -0
- package/dist-server/server/modules/orchestration/workspace/workspace-manager.js.map +1 -0
- package/dist-server/server/modules/orchestration/workspace/worktree-workspace.js +96 -0
- package/dist-server/server/modules/orchestration/workspace/worktree-workspace.js.map +1 -0
- package/dist-server/server/modules/providers/index.js +3 -0
- package/dist-server/server/modules/providers/index.js.map +1 -0
- package/dist-server/server/openai-codex.js +35 -4
- package/dist-server/server/openai-codex.js.map +1 -1
- package/dist-server/server/routes/taskmaster.js +106 -89
- package/dist-server/server/routes/taskmaster.js.map +1 -1
- package/package.json +3 -1
- package/scripts/smoke/a2a-roundtrip.mjs +167 -98
- package/scripts/smoke/orchestration-api.mjs +172 -0
- package/scripts/smoke/orchestration-live-run.mjs +176 -0
- package/server/claude-sdk.js +48 -7
- package/server/cli.js +12 -17
- package/server/daemon-manager.js +90 -51
- package/server/database/db.js +794 -794
- package/server/database/json-store.js +8 -5
- package/server/index.js +40 -9
- package/server/modules/orchestration/a2a/adapter-registry.ts +108 -58
- package/server/modules/orchestration/a2a/adapters/abstract-a2a.adapter.ts +55 -49
- package/server/modules/orchestration/a2a/adapters/claude-code.adapter.ts +284 -283
- package/server/modules/orchestration/a2a/adapters/codex.adapter.ts +244 -0
- package/server/modules/orchestration/a2a/adapters/cursor.adapter.ts +249 -0
- package/server/modules/orchestration/a2a/adapters/gemini.adapter.ts +248 -0
- package/server/modules/orchestration/a2a/adapters/opencode.adapter.ts +248 -0
- package/server/modules/orchestration/a2a/adapters/qwen.adapter.ts +248 -0
- package/server/modules/orchestration/a2a/agent-card.ts +55 -55
- package/server/modules/orchestration/a2a/auth.middleware.ts +29 -29
- package/server/modules/orchestration/a2a/bus.ts +46 -46
- package/server/modules/orchestration/a2a/routes.ts +577 -264
- package/server/modules/orchestration/a2a/task-store.ts +178 -0
- package/server/modules/orchestration/a2a/types.ts +125 -111
- package/server/modules/orchestration/a2a/validator.ts +113 -90
- package/server/modules/orchestration/index.ts +66 -26
- package/server/modules/orchestration/preview/port-watcher.ts +112 -0
- package/server/modules/orchestration/preview/preview-proxy.ts +60 -0
- package/server/modules/orchestration/preview/types.ts +19 -0
- package/server/modules/orchestration/tasks/orchestration-task-store.ts +45 -0
- package/server/modules/orchestration/tasks/orchestration-task.routes.ts +73 -0
- package/server/modules/orchestration/tasks/orchestration-task.service.ts +145 -0
- package/server/modules/orchestration/tasks/orchestration-task.types.ts +29 -0
- package/server/modules/orchestration/workflows/built-in-workflows.ts +127 -0
- package/server/modules/orchestration/workflows/workflow-runner.ts +1206 -0
- package/server/modules/orchestration/workflows/workflow-store.ts +97 -0
- package/server/modules/orchestration/workflows/workflow.routes.ts +169 -0
- package/server/modules/orchestration/workflows/workflow.types.ts +70 -0
- package/server/modules/orchestration/workflows/workspace-target.ts +120 -0
- package/server/modules/orchestration/workspace/docker-workspace.ts +135 -0
- package/server/modules/orchestration/workspace/path-safety.ts +55 -0
- package/server/modules/orchestration/workspace/types.ts +52 -0
- package/server/modules/orchestration/workspace/workspace-manager.ts +97 -0
- package/server/modules/orchestration/workspace/worktree-workspace.ts +125 -0
- package/server/modules/providers/index.ts +2 -0
- package/server/modules/providers/list/opencode/opencode-auth.provider.ts +130 -130
- package/server/modules/providers/list/opencode/opencode-mcp.provider.ts +126 -126
- package/server/modules/providers/list/opencode/opencode.provider.ts +29 -29
- package/server/modules/providers/list/qwen/qwen-auth.provider.ts +145 -145
- package/server/modules/providers/list/qwen/qwen-mcp.provider.ts +114 -114
- package/server/modules/providers/list/qwen/qwen.provider.ts +21 -21
- package/server/modules/providers/shared/provider-configs.ts +142 -142
- package/server/openai-codex.js +40 -4
- package/server/qwen-code-cli.js +395 -395
- package/server/qwen-response-handler.js +73 -73
- package/server/routes/qwen.js +27 -27
- package/server/routes/taskmaster.js +116 -91
- package/server/services/external-access.js +171 -171
- package/server/services/provider-models.js +381 -381
- package/server/services/telegram/telegram-http-client.js +130 -130
- package/server/services/vapid-keys.js +36 -36
- package/server/utils/port-access.js +209 -209
- package/dist/assets/index-B1ghfb4w.css +0 -32
- 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
|
package/server/openai-codex.js
CHANGED
|
@@ -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
|
-
|
|
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) {
|