@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.
- package/dist/api-docs.html +395 -395
- package/dist/assets/{index-B_dU5AHA.js → index-BvClqlMf.js} +134 -134
- 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 +1 -1
- package/dist/logo.svg +12 -12
- package/dist/openapi.yaml +1311 -1311
- package/dist-server/server/index.js +4 -0
- package/dist-server/server/index.js.map +1 -1
- package/dist-server/server/modules/orchestration/a2a/adapter-registry.js +47 -0
- package/dist-server/server/modules/orchestration/a2a/adapter-registry.js.map +1 -0
- package/dist-server/server/modules/orchestration/a2a/adapters/abstract-a2a.adapter.js +17 -0
- package/dist-server/server/modules/orchestration/a2a/adapters/abstract-a2a.adapter.js.map +1 -0
- package/dist-server/server/modules/orchestration/a2a/adapters/claude-code.adapter.js +233 -0
- package/dist-server/server/modules/orchestration/a2a/adapters/claude-code.adapter.js.map +1 -0
- package/dist-server/server/modules/orchestration/a2a/agent-card.js +50 -0
- package/dist-server/server/modules/orchestration/a2a/agent-card.js.map +1 -0
- package/dist-server/server/modules/orchestration/a2a/auth.middleware.js +25 -0
- package/dist-server/server/modules/orchestration/a2a/auth.middleware.js.map +1 -0
- package/dist-server/server/modules/orchestration/a2a/bus.js +34 -0
- package/dist-server/server/modules/orchestration/a2a/bus.js.map +1 -0
- package/dist-server/server/modules/orchestration/a2a/routes.js +233 -0
- package/dist-server/server/modules/orchestration/a2a/routes.js.map +1 -0
- package/dist-server/server/modules/orchestration/a2a/types.js +6 -0
- package/dist-server/server/modules/orchestration/a2a/types.js.map +1 -0
- package/dist-server/server/modules/orchestration/a2a/validator.js +85 -0
- package/dist-server/server/modules/orchestration/a2a/validator.js.map +1 -0
- package/dist-server/server/modules/orchestration/index.js +10 -0
- package/dist-server/server/modules/orchestration/index.js.map +1 -0
- package/dist-server/server/opencode-cli.js +4 -1
- package/dist-server/server/opencode-cli.js.map +1 -1
- package/package.json +178 -178
- package/scripts/smoke/a2a-roundtrip.mjs +98 -0
- package/server/database/db.js +794 -794
- package/server/database/json-store.js +194 -194
- package/server/index.js +9 -0
- package/server/modules/orchestration/a2a/adapter-registry.ts +58 -0
- package/server/modules/orchestration/a2a/adapters/abstract-a2a.adapter.ts +49 -0
- package/server/modules/orchestration/a2a/adapters/claude-code.adapter.ts +283 -0
- package/server/modules/orchestration/a2a/agent-card.ts +55 -0
- package/server/modules/orchestration/a2a/auth.middleware.ts +29 -0
- package/server/modules/orchestration/a2a/bus.ts +46 -0
- package/server/modules/orchestration/a2a/routes.ts +264 -0
- package/server/modules/orchestration/a2a/types.ts +111 -0
- package/server/modules/orchestration/a2a/validator.ts +90 -0
- package/server/modules/orchestration/index.ts +26 -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-sessions.provider.ts +232 -232
- 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-sessions.provider.ts +265 -265
- package/server/modules/providers/list/qwen/qwen.provider.ts +21 -21
- package/server/modules/providers/shared/provider-configs.ts +142 -142
- package/server/opencode-cli.js +4 -1
- package/server/opencode-response-handler.js +107 -107
- 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/services/external-access.js +171 -171
- package/server/services/provider-credentials.js +189 -189
- 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/scripts/rest-sweep.mjs +0 -93
|
@@ -1,126 +1,126 @@
|
|
|
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
|
-
* OpenCode MCP provider.
|
|
18
|
-
*
|
|
19
|
-
* OpenCode's MCP servers live under the top-level `mcp` key in
|
|
20
|
-
* `opencode.json` (global at `~/.config/opencode/opencode.json`, project at
|
|
21
|
-
* `<workspace>/opencode.json`). Each entry is either a local stdio command
|
|
22
|
-
* (`{ command, args, env }`) or a remote server (`{ type: "remote", url,
|
|
23
|
-
* headers, enabled }`). OpenCode's schema also supports an `enabled: false`
|
|
24
|
-
* flag we preserve on write but don't surface in the UI yet.
|
|
25
|
-
*/
|
|
26
|
-
export class OpencodeMcpProvider extends McpProvider {
|
|
27
|
-
constructor() {
|
|
28
|
-
super('opencode', ['user', 'project'], ['stdio', 'http', 'sse']);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
protected async readScopedServers(scope: McpScope, workspacePath: string): Promise<Record<string, unknown>> {
|
|
32
|
-
const filePath = scope === 'user'
|
|
33
|
-
? path.join(os.homedir(), '.config', 'opencode', 'opencode.json')
|
|
34
|
-
: path.join(workspacePath, 'opencode.json');
|
|
35
|
-
const config = await readJsonConfig(filePath);
|
|
36
|
-
return readObjectRecord(config.mcp) ?? {};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
protected async writeScopedServers(
|
|
40
|
-
scope: McpScope,
|
|
41
|
-
workspacePath: string,
|
|
42
|
-
servers: Record<string, unknown>,
|
|
43
|
-
): Promise<void> {
|
|
44
|
-
const filePath = scope === 'user'
|
|
45
|
-
? path.join(os.homedir(), '.config', 'opencode', 'opencode.json')
|
|
46
|
-
: path.join(workspacePath, 'opencode.json');
|
|
47
|
-
const config = await readJsonConfig(filePath);
|
|
48
|
-
config.mcp = servers;
|
|
49
|
-
await writeJsonConfig(filePath, config);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
protected buildServerConfig(input: UpsertProviderMcpServerInput): Record<string, unknown> {
|
|
53
|
-
if (input.transport === 'stdio') {
|
|
54
|
-
if (!input.command?.trim()) {
|
|
55
|
-
throw new AppError('command is required for stdio MCP servers.', {
|
|
56
|
-
code: 'MCP_COMMAND_REQUIRED',
|
|
57
|
-
statusCode: 400,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
return {
|
|
61
|
-
type: 'local',
|
|
62
|
-
command: input.command,
|
|
63
|
-
args: input.args ?? [],
|
|
64
|
-
env: input.env ?? {},
|
|
65
|
-
cwd: input.cwd,
|
|
66
|
-
enabled: true,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (!input.url?.trim()) {
|
|
71
|
-
throw new AppError('url is required for http/sse MCP servers.', {
|
|
72
|
-
code: 'MCP_URL_REQUIRED',
|
|
73
|
-
statusCode: 400,
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return {
|
|
78
|
-
type: 'remote',
|
|
79
|
-
url: input.url,
|
|
80
|
-
headers: input.headers ?? {},
|
|
81
|
-
enabled: true,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
protected normalizeServerConfig(
|
|
86
|
-
scope: McpScope,
|
|
87
|
-
name: string,
|
|
88
|
-
rawConfig: unknown,
|
|
89
|
-
): ProviderMcpServer | null {
|
|
90
|
-
if (!rawConfig || typeof rawConfig !== 'object') {
|
|
91
|
-
return null;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const config = rawConfig as Record<string, unknown>;
|
|
95
|
-
const opencodeType = readOptionalString(config.type);
|
|
96
|
-
|
|
97
|
-
// Local (stdio) entries — either type: "local" explicitly or any entry
|
|
98
|
-
// with a command field (pre-type schemas).
|
|
99
|
-
if (opencodeType === 'local' || typeof config.command === 'string') {
|
|
100
|
-
return {
|
|
101
|
-
provider: 'opencode',
|
|
102
|
-
name,
|
|
103
|
-
scope,
|
|
104
|
-
transport: 'stdio',
|
|
105
|
-
command: typeof config.command === 'string' ? config.command : '',
|
|
106
|
-
args: readStringArray(config.args),
|
|
107
|
-
env: readStringRecord(config.env),
|
|
108
|
-
cwd: readOptionalString(config.cwd),
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Remote entries — type: "remote" or any entry with a url field.
|
|
113
|
-
if (opencodeType === 'remote' || typeof config.url === 'string') {
|
|
114
|
-
return {
|
|
115
|
-
provider: 'opencode',
|
|
116
|
-
name,
|
|
117
|
-
scope,
|
|
118
|
-
transport: 'http',
|
|
119
|
-
url: typeof config.url === 'string' ? config.url : '',
|
|
120
|
-
headers: readStringRecord(config.headers),
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return null;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
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
|
+
* OpenCode MCP provider.
|
|
18
|
+
*
|
|
19
|
+
* OpenCode's MCP servers live under the top-level `mcp` key in
|
|
20
|
+
* `opencode.json` (global at `~/.config/opencode/opencode.json`, project at
|
|
21
|
+
* `<workspace>/opencode.json`). Each entry is either a local stdio command
|
|
22
|
+
* (`{ command, args, env }`) or a remote server (`{ type: "remote", url,
|
|
23
|
+
* headers, enabled }`). OpenCode's schema also supports an `enabled: false`
|
|
24
|
+
* flag we preserve on write but don't surface in the UI yet.
|
|
25
|
+
*/
|
|
26
|
+
export class OpencodeMcpProvider extends McpProvider {
|
|
27
|
+
constructor() {
|
|
28
|
+
super('opencode', ['user', 'project'], ['stdio', 'http', 'sse']);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
protected async readScopedServers(scope: McpScope, workspacePath: string): Promise<Record<string, unknown>> {
|
|
32
|
+
const filePath = scope === 'user'
|
|
33
|
+
? path.join(os.homedir(), '.config', 'opencode', 'opencode.json')
|
|
34
|
+
: path.join(workspacePath, 'opencode.json');
|
|
35
|
+
const config = await readJsonConfig(filePath);
|
|
36
|
+
return readObjectRecord(config.mcp) ?? {};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
protected async writeScopedServers(
|
|
40
|
+
scope: McpScope,
|
|
41
|
+
workspacePath: string,
|
|
42
|
+
servers: Record<string, unknown>,
|
|
43
|
+
): Promise<void> {
|
|
44
|
+
const filePath = scope === 'user'
|
|
45
|
+
? path.join(os.homedir(), '.config', 'opencode', 'opencode.json')
|
|
46
|
+
: path.join(workspacePath, 'opencode.json');
|
|
47
|
+
const config = await readJsonConfig(filePath);
|
|
48
|
+
config.mcp = servers;
|
|
49
|
+
await writeJsonConfig(filePath, config);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
protected buildServerConfig(input: UpsertProviderMcpServerInput): Record<string, unknown> {
|
|
53
|
+
if (input.transport === 'stdio') {
|
|
54
|
+
if (!input.command?.trim()) {
|
|
55
|
+
throw new AppError('command is required for stdio MCP servers.', {
|
|
56
|
+
code: 'MCP_COMMAND_REQUIRED',
|
|
57
|
+
statusCode: 400,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
type: 'local',
|
|
62
|
+
command: input.command,
|
|
63
|
+
args: input.args ?? [],
|
|
64
|
+
env: input.env ?? {},
|
|
65
|
+
cwd: input.cwd,
|
|
66
|
+
enabled: true,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (!input.url?.trim()) {
|
|
71
|
+
throw new AppError('url is required for http/sse MCP servers.', {
|
|
72
|
+
code: 'MCP_URL_REQUIRED',
|
|
73
|
+
statusCode: 400,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
type: 'remote',
|
|
79
|
+
url: input.url,
|
|
80
|
+
headers: input.headers ?? {},
|
|
81
|
+
enabled: true,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
protected normalizeServerConfig(
|
|
86
|
+
scope: McpScope,
|
|
87
|
+
name: string,
|
|
88
|
+
rawConfig: unknown,
|
|
89
|
+
): ProviderMcpServer | null {
|
|
90
|
+
if (!rawConfig || typeof rawConfig !== 'object') {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const config = rawConfig as Record<string, unknown>;
|
|
95
|
+
const opencodeType = readOptionalString(config.type);
|
|
96
|
+
|
|
97
|
+
// Local (stdio) entries — either type: "local" explicitly or any entry
|
|
98
|
+
// with a command field (pre-type schemas).
|
|
99
|
+
if (opencodeType === 'local' || typeof config.command === 'string') {
|
|
100
|
+
return {
|
|
101
|
+
provider: 'opencode',
|
|
102
|
+
name,
|
|
103
|
+
scope,
|
|
104
|
+
transport: 'stdio',
|
|
105
|
+
command: typeof config.command === 'string' ? config.command : '',
|
|
106
|
+
args: readStringArray(config.args),
|
|
107
|
+
env: readStringRecord(config.env),
|
|
108
|
+
cwd: readOptionalString(config.cwd),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Remote entries — type: "remote" or any entry with a url field.
|
|
113
|
+
if (opencodeType === 'remote' || typeof config.url === 'string') {
|
|
114
|
+
return {
|
|
115
|
+
provider: 'opencode',
|
|
116
|
+
name,
|
|
117
|
+
scope,
|
|
118
|
+
transport: 'http',
|
|
119
|
+
url: typeof config.url === 'string' ? config.url : '',
|
|
120
|
+
headers: readStringRecord(config.headers),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
}
|