coding-tool-x 3.9.6-261014 → 3.9.6-261016
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/web/assets/{AgentsDrawer-D-1A92Ig.js → AgentsDrawer-D2oYKcOj.js} +1 -1
- package/dist/web/assets/{Analytics-B2O5txNK.js → Analytics-Cy3QSSrn.js} +1 -1
- package/dist/web/assets/{AssetPathField-DuohRI-K.js → AssetPathField-BGuw5ZR7.js} +1 -1
- package/dist/web/assets/{ChatHistoryDrawer-CjyehFJ5.js → ChatHistoryDrawer-BZ8FY_-9.js} +1 -1
- package/dist/web/assets/{CollapseItem--khwfagQ.js → CollapseItem-DOoxtmtj.js} +1 -1
- package/dist/web/assets/{CommandsDrawer-gZsBcvyW.js → CommandsDrawer-YCgZAeNx.js} +1 -1
- package/dist/web/assets/{ConfigExportDrawer-CJnljMGE.js → ConfigExportDrawer-BlAHQidK.js} +1 -1
- package/dist/web/assets/{ConfigTemplates-wkwjB2C5.js → ConfigTemplates-C6qSF4Ht.js} +1 -1
- package/dist/web/assets/{ConfigTemplatesDrawer-hAGvUnSt.js → ConfigTemplatesDrawer-lRT_6-jD.js} +1 -1
- package/dist/web/assets/{ConfigTemplatesPanel-BfF8qmL_.js → ConfigTemplatesPanel-DrS57Y8V.js} +1 -1
- package/dist/web/assets/{FavoritesDrawer-YeAnYTuA.js → FavoritesDrawer-CuOcHtqM.js} +1 -1
- package/dist/web/assets/{GatewayConvertDrawer-D1znBVev.js → GatewayConvertDrawer-b0pIvH02.js} +1 -1
- package/dist/web/assets/{Home-CSsVyr4n.js → Home-DvfQcP4b.js} +1 -1
- package/dist/web/assets/{MarkdownEditor-CeLdWA-c.js → MarkdownEditor-BLS6HmBb.js} +1 -1
- package/dist/web/assets/{McpDrawer-z-veNi2j.js → McpDrawer-BHt7zFf0.js} +1 -1
- package/dist/web/assets/{McpFormDrawer-DgDBnMOk.js → McpFormDrawer-DpTMHc-e.js} +1 -1
- package/dist/web/assets/{PluginManager-DFYt_Xmd.js → PluginManager-CYAuy5dm.js} +1 -1
- package/dist/web/assets/{PluginsDrawer-Dqpb2UsR.js → PluginsDrawer-CoyprWNl.js} +1 -1
- package/dist/web/assets/{PluginsPanel-CvcT0Up3.js → PluginsPanel-C3AzXlkH.js} +1 -1
- package/dist/web/assets/{ProjectList-DjwDDvVo.js → ProjectList-pJo0xp0Q.js} +1 -1
- package/dist/web/assets/{PromptsDrawer-B2vI4UfM.js → PromptsDrawer-CM-irN84.js} +1 -1
- package/dist/web/assets/{RecentSessionsDrawer-DTbikshr.js → RecentSessionsDrawer-l5nO_5bS.js} +1 -1
- package/dist/web/assets/{SessionCard-AKJF0KLk.js → SessionCard-BqTFOt05.js} +1 -1
- package/dist/web/assets/{SessionList-C2kxSHyw.js → SessionList-Bs_YFKW5.js} +1 -1
- package/dist/web/assets/{SettingsDrawer-CYNU3Scm.js → SettingsDrawer-COszrj_Y.js} +1 -1
- package/dist/web/assets/{SkillManager-MMDMnZuA.js → SkillManager-DgLhL2Qv.js} +1 -1
- package/dist/web/assets/{SkillsDrawer-Bg6QLvgm.js → SkillsDrawer-CT69YSEE.js} +1 -1
- package/dist/web/assets/{SkillsPanel-CDUSYnfc.js → SkillsPanel-Dm8FkYD6.js} +1 -1
- package/dist/web/assets/{Upload-DMr2S_D5.js → Upload-BHTymsxe.js} +1 -1
- package/dist/web/assets/{WorkspaceDrawer-VrUPX-Pa.js → WorkspaceDrawer-DLXh_c7u.js} +1 -1
- package/dist/web/assets/{WorkspaceManager-q76RE4Ss.js → WorkspaceManager-E_IoRTlC.js} +1 -1
- package/dist/web/assets/{WorkspacePanel-CSDGZMrU.js → WorkspacePanel-DLlTIU8Y.js} +1 -1
- package/dist/web/assets/index-DP0Ggf-8.js +2 -0
- package/dist/web/assets/index-DjIuAtaS.css +1 -0
- package/dist/web/assets/{platforms-JV36QBCw.js → platforms-DNVEAtqx.js} +1 -1
- package/dist/web/assets/platforms-p9AiybLU.js +1 -0
- package/dist/web/assets/{sessions-wvj5oaYr.js → sessions-DJiJJgvg.js} +1 -1
- package/dist/web/assets/sessions-DSLpMXCq.js +1 -0
- package/dist/web/assets/{useResponsiveDrawer-DXmsFFe1.js → useResponsiveDrawer-D9ti7g-U.js} +1 -1
- package/dist/web/index.html +4 -4
- package/package.json +1 -1
- package/src/commands/channels.js +88 -95
- package/src/commands/toggle-proxy.js +26 -19
- package/src/platforms/drivers/claude/channels.js +11 -1
- package/src/platforms/drivers/claude/proxy.js +1 -2
- package/src/platforms/drivers/codex/channels.js +14 -2
- package/src/platforms/drivers/codex/proxy.js +1 -2
- package/src/platforms/drivers/dsh/api-operations.js +1 -1
- package/src/platforms/drivers/dsh/channels.js +3 -7
- package/src/platforms/drivers/dsh/proxy.js +0 -4
- package/src/platforms/drivers/gemini/channels.js +10 -12
- package/src/platforms/drivers/gemini/proxy.js +1 -2
- package/src/platforms/drivers/omp/channels.js +53 -40
- package/src/platforms/drivers/omp/gateway-routing.js +0 -54
- package/src/platforms/drivers/omp/proxy.js +1 -2
- package/src/platforms/drivers/opencode/channels.js +53 -24
- package/src/platforms/drivers/opencode/proxy.js +1 -2
- package/src/platforms/manifest-schema.js +53 -1
- package/src/platforms/manifests/claude.json +11 -0
- package/src/platforms/manifests/codex.json +11 -16
- package/src/platforms/manifests/dsh.json +13 -0
- package/src/platforms/manifests/gemini.json +17 -16
- package/src/platforms/manifests/omp.json +6 -16
- package/src/platforms/manifests/opencode.json +21 -16
- package/src/server/api/platforms.js +29 -0
- package/src/shared/channel-driver.js +12 -14
- package/dist/web/assets/index-BXFl1mzC.js +0 -2
- package/dist/web/assets/index-CcIxENSq.css +0 -1
- package/dist/web/assets/platforms-DILqyP72.js +0 -1
- package/dist/web/assets/sessions-WXODMvLY.js +0 -1
|
@@ -55,6 +55,37 @@ const API_ROUTE_DESCRIPTOR_SCHEMA = {
|
|
|
55
55
|
|
|
56
56
|
const API_ROUTE_METHODS = new Set(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']);
|
|
57
57
|
|
|
58
|
+
const CLI_CHANNEL_QUESTION_SCHEMA = {
|
|
59
|
+
type: 'object',
|
|
60
|
+
additionalProperties: false,
|
|
61
|
+
required: ['type', 'name', 'message'],
|
|
62
|
+
properties: {
|
|
63
|
+
type: { enum: ['input', 'password', 'number', 'confirm', 'list'] },
|
|
64
|
+
name: { type: 'string', pattern: '^[a-zA-Z][a-zA-Z0-9_]*$' },
|
|
65
|
+
message: { type: 'string', minLength: 1 },
|
|
66
|
+
default: { type: ['string', 'number', 'boolean', 'null'] },
|
|
67
|
+
validation: { enum: ['required', 'http_url'] },
|
|
68
|
+
validationMessage: { type: 'string', minLength: 1 },
|
|
69
|
+
choices: {
|
|
70
|
+
type: 'array',
|
|
71
|
+
items: {
|
|
72
|
+
anyOf: [
|
|
73
|
+
{ type: 'string' },
|
|
74
|
+
{
|
|
75
|
+
type: 'object',
|
|
76
|
+
additionalProperties: false,
|
|
77
|
+
required: ['name', 'value'],
|
|
78
|
+
properties: {
|
|
79
|
+
name: { type: 'string' },
|
|
80
|
+
value: { type: ['string', 'number', 'boolean', 'null'] }
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
58
89
|
const CAPABILITY_OPERATIONS = Object.freeze({
|
|
59
90
|
api: new Set([
|
|
60
91
|
'getConfig',
|
|
@@ -124,6 +155,17 @@ const schema = {
|
|
|
124
155
|
defaultPort: { type: 'integer', minimum: 1 },
|
|
125
156
|
proxyMode: { enum: ['standard', 'managed'] },
|
|
126
157
|
proxyLabels: { type: 'object', additionalProperties: { type: 'string' } },
|
|
158
|
+
channelCli: {
|
|
159
|
+
type: 'object',
|
|
160
|
+
additionalProperties: false,
|
|
161
|
+
properties: {
|
|
162
|
+
supportsCliCreate: { type: 'boolean' },
|
|
163
|
+
supportsCliToggle: { type: 'boolean' },
|
|
164
|
+
createUnavailableMessage: { type: 'string' },
|
|
165
|
+
createDefaults: { type: 'object', additionalProperties: true },
|
|
166
|
+
createQuestions: { type: 'array', items: CLI_CHANNEL_QUESTION_SCHEMA, uniqueItems: true }
|
|
167
|
+
}
|
|
168
|
+
},
|
|
127
169
|
modelConfig: {
|
|
128
170
|
type: 'object',
|
|
129
171
|
additionalProperties: false,
|
|
@@ -131,6 +173,7 @@ const schema = {
|
|
|
131
173
|
catalogKey: { type: 'string', pattern: '^[a-z0-9][a-z0-9_-]*$' }
|
|
132
174
|
}
|
|
133
175
|
},
|
|
176
|
+
channelModelType: { enum: ['claude', 'codex', 'gemini', 'openai_compatible'] },
|
|
134
177
|
agentCapabilities: {
|
|
135
178
|
type: 'object',
|
|
136
179
|
additionalProperties: false,
|
|
@@ -297,7 +340,16 @@ const schema = {
|
|
|
297
340
|
}
|
|
298
341
|
},
|
|
299
342
|
capabilities: { type: 'object', additionalProperties: { enum: [...DRIVER_IDS] } }
|
|
300
|
-
}
|
|
343
|
+
},
|
|
344
|
+
allOf: [{
|
|
345
|
+
if: {
|
|
346
|
+
properties: { channelCli: { properties: { supportsCliCreate: { const: true } }, required: ['supportsCliCreate'] } },
|
|
347
|
+
required: ['channelCli']
|
|
348
|
+
},
|
|
349
|
+
then: {
|
|
350
|
+
properties: { channelCli: { required: ['createQuestions'], properties: { createQuestions: { minItems: 1 } } } }
|
|
351
|
+
}
|
|
352
|
+
}]
|
|
301
353
|
};
|
|
302
354
|
|
|
303
355
|
const validate = new Ajv({ allErrors: true, strict: false }).compile(schema);
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"defaultEnabled": true,
|
|
10
10
|
"sortOrder": 10,
|
|
11
11
|
"modelConfig": { "catalogKey": "claude" },
|
|
12
|
+
"channelModelType": "claude",
|
|
12
13
|
"auth": {
|
|
13
14
|
"modes": ["api_key", "oauth", "none"],
|
|
14
15
|
"oauth": { "adapter": "claude", "policy": "single-enabled", "quota": "claude" }
|
|
@@ -20,6 +21,16 @@
|
|
|
20
21
|
"apiBasePath": "/api/proxy",
|
|
21
22
|
"portKey": "proxy",
|
|
22
23
|
"defaultPort": 20088,
|
|
24
|
+
"channelCli": {
|
|
25
|
+
"supportsCliCreate": true,
|
|
26
|
+
"supportsCliToggle": true,
|
|
27
|
+
"createQuestions": [
|
|
28
|
+
{ "type": "input", "name": "name", "message": "渠道名称:", "validation": "required", "validationMessage": "渠道名称不能为空" },
|
|
29
|
+
{ "type": "input", "name": "baseUrl", "message": "Base URL:", "validation": "http_url", "validationMessage": "Base URL 必须以 http:// 或 https:// 开头" },
|
|
30
|
+
{ "type": "input", "name": "apiKey", "message": "API Key:", "validation": "required", "validationMessage": "API Key 不能为空" },
|
|
31
|
+
{ "type": "input", "name": "websiteUrl", "message": "网站地址(可选,直接回车跳过):" }
|
|
32
|
+
]
|
|
33
|
+
},
|
|
23
34
|
"resourceTypes": {
|
|
24
35
|
"skills": true,
|
|
25
36
|
"commands": true,
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"defaultEnabled": true,
|
|
10
10
|
"sortOrder": 20,
|
|
11
11
|
"modelConfig": { "catalogKey": "codex" },
|
|
12
|
+
"channelModelType": "openai_compatible",
|
|
12
13
|
"auth": {
|
|
13
14
|
"modes": ["api_key", "oauth", "none"],
|
|
14
15
|
"oauth": { "adapter": "codex", "policy": "single-enabled", "quota": "codex" }
|
|
@@ -20,6 +21,16 @@
|
|
|
20
21
|
"apiBasePath": "/api/codex/proxy",
|
|
21
22
|
"portKey": "codexProxy",
|
|
22
23
|
"defaultPort": 20089,
|
|
24
|
+
"channelCli": {
|
|
25
|
+
"supportsCliCreate": true,
|
|
26
|
+
"supportsCliToggle": true,
|
|
27
|
+
"createDefaults": { "wireApi": "responses" },
|
|
28
|
+
"createQuestions": [
|
|
29
|
+
{ "type": "input", "name": "name", "message": "渠道名称:", "validation": "required", "validationMessage": "渠道名称不能为空" },
|
|
30
|
+
{ "type": "input", "name": "baseUrl", "message": "Base URL:", "validation": "http_url", "validationMessage": "Base URL 必须以 http:// 或 https:// 开头" },
|
|
31
|
+
{ "type": "input", "name": "apiKey", "message": "API Key:", "validation": "required", "validationMessage": "API Key 不能为空" }
|
|
32
|
+
]
|
|
33
|
+
},
|
|
23
34
|
"pathResolverId": "codex",
|
|
24
35
|
"resourceTypes": {
|
|
25
36
|
"skills": true,
|
|
@@ -236,14 +247,6 @@
|
|
|
236
247
|
"request": "default",
|
|
237
248
|
"response": "default"
|
|
238
249
|
},
|
|
239
|
-
{
|
|
240
|
-
"method": "GET",
|
|
241
|
-
"path": "/channels/current",
|
|
242
|
-
"capability": "channels",
|
|
243
|
-
"operation": "current",
|
|
244
|
-
"request": "default",
|
|
245
|
-
"response": "default"
|
|
246
|
-
},
|
|
247
250
|
{
|
|
248
251
|
"method": "GET",
|
|
249
252
|
"path": "/channels/pool/status",
|
|
@@ -252,14 +255,6 @@
|
|
|
252
255
|
"request": "default",
|
|
253
256
|
"response": "default"
|
|
254
257
|
},
|
|
255
|
-
{
|
|
256
|
-
"method": "GET",
|
|
257
|
-
"path": "/channels/best-for-restore",
|
|
258
|
-
"capability": "channels",
|
|
259
|
-
"operation": "bestForRestore",
|
|
260
|
-
"request": "default",
|
|
261
|
-
"response": "default"
|
|
262
|
-
},
|
|
263
258
|
{
|
|
264
259
|
"method": "GET",
|
|
265
260
|
"path": "/channels/auth",
|
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
"portKey": "dshProxy",
|
|
16
16
|
"defaultPort": 20093,
|
|
17
17
|
"proxyMode": "managed",
|
|
18
|
+
"channelCli": {
|
|
19
|
+
"supportsCliCreate": false,
|
|
20
|
+
"supportsCliToggle": true,
|
|
21
|
+
"createUnavailableMessage": "提示: DSH 渠道请通过 Web UI 或 API 添加。"
|
|
22
|
+
},
|
|
18
23
|
"proxyLabels": {
|
|
19
24
|
"serviceLabel": "DSH 动态代理",
|
|
20
25
|
"proxyLabel": "动态切换",
|
|
@@ -198,6 +203,14 @@
|
|
|
198
203
|
"request": "default",
|
|
199
204
|
"response": "default"
|
|
200
205
|
},
|
|
206
|
+
{
|
|
207
|
+
"method": "GET",
|
|
208
|
+
"path": "/channels/pool/status",
|
|
209
|
+
"capability": "channels",
|
|
210
|
+
"operation": "poolStatus",
|
|
211
|
+
"request": "default",
|
|
212
|
+
"response": "default"
|
|
213
|
+
},
|
|
201
214
|
{
|
|
202
215
|
"method": "POST",
|
|
203
216
|
"path": "/channels",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"defaultEnabled": false,
|
|
10
10
|
"sortOrder": 50,
|
|
11
11
|
"modelConfig": { "catalogKey": "gemini" },
|
|
12
|
+
"channelModelType": "gemini",
|
|
12
13
|
"auth": {
|
|
13
14
|
"modes": ["api_key", "oauth", "none"],
|
|
14
15
|
"oauth": { "adapter": "gemini", "policy": "single-enabled", "quota": "gemini" }
|
|
@@ -20,6 +21,22 @@
|
|
|
20
21
|
"apiBasePath": "/api/gemini/proxy",
|
|
21
22
|
"portKey": "geminiProxy",
|
|
22
23
|
"defaultPort": 20090,
|
|
24
|
+
"channelCli": {
|
|
25
|
+
"supportsCliCreate": true,
|
|
26
|
+
"supportsCliToggle": true,
|
|
27
|
+
"createDefaults": { "model": "gemini-2.5-pro" },
|
|
28
|
+
"createQuestions": [
|
|
29
|
+
{ "type": "input", "name": "name", "message": "渠道名称:", "validation": "required", "validationMessage": "渠道名称不能为空" },
|
|
30
|
+
{ "type": "input", "name": "baseUrl", "message": "Base URL:", "validation": "http_url", "validationMessage": "Base URL 必须以 http:// 或 https:// 开头" },
|
|
31
|
+
{ "type": "input", "name": "apiKey", "message": "API Key:", "validation": "required", "validationMessage": "API Key 不能为空" },
|
|
32
|
+
{
|
|
33
|
+
"type": "input",
|
|
34
|
+
"name": "model",
|
|
35
|
+
"message": "模型名称 (默认: gemini-2.5-pro):",
|
|
36
|
+
"default": "gemini-2.5-pro"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
},
|
|
23
40
|
"pathResolverId": "gemini",
|
|
24
41
|
"resourceTypes": {
|
|
25
42
|
"skills": true,
|
|
@@ -235,14 +252,6 @@
|
|
|
235
252
|
"request": "default",
|
|
236
253
|
"response": "default"
|
|
237
254
|
},
|
|
238
|
-
{
|
|
239
|
-
"method": "GET",
|
|
240
|
-
"path": "/channels/current",
|
|
241
|
-
"capability": "channels",
|
|
242
|
-
"operation": "current",
|
|
243
|
-
"request": "default",
|
|
244
|
-
"response": "default"
|
|
245
|
-
},
|
|
246
255
|
{
|
|
247
256
|
"method": "GET",
|
|
248
257
|
"path": "/channels/pool/status",
|
|
@@ -251,14 +260,6 @@
|
|
|
251
260
|
"request": "default",
|
|
252
261
|
"response": "default"
|
|
253
262
|
},
|
|
254
|
-
{
|
|
255
|
-
"method": "GET",
|
|
256
|
-
"path": "/channels/best-for-restore",
|
|
257
|
-
"capability": "channels",
|
|
258
|
-
"operation": "bestForRestore",
|
|
259
|
-
"request": "default",
|
|
260
|
-
"response": "default"
|
|
261
|
-
},
|
|
262
263
|
{
|
|
263
264
|
"method": "GET",
|
|
264
265
|
"path": "/channels/auth",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"defaultEnabled": true,
|
|
10
10
|
"sortOrder": 40,
|
|
11
11
|
"modelConfig": { "catalogKey": "codex" },
|
|
12
|
+
"channelModelType": "openai_compatible",
|
|
12
13
|
"auth": {
|
|
13
14
|
"modes": ["api_key", "oauth", "none"],
|
|
14
15
|
"oauth": { "adapter": "omp", "policy": "mixed" }
|
|
@@ -21,6 +22,11 @@
|
|
|
21
22
|
"portKey": "ompProxy",
|
|
22
23
|
"defaultPort": 20092,
|
|
23
24
|
"proxyMode": "managed",
|
|
25
|
+
"channelCli": {
|
|
26
|
+
"supportsCliCreate": false,
|
|
27
|
+
"supportsCliToggle": true,
|
|
28
|
+
"createUnavailableMessage": "提示: OMP 渠道请通过 Web UI 或 API 添加后,再在这里启停调度。"
|
|
29
|
+
},
|
|
24
30
|
"proxyLabels": {
|
|
25
31
|
"serviceLabel": "OMP 动态切换",
|
|
26
32
|
"proxyLabel": "动态切换",
|
|
@@ -253,14 +259,6 @@
|
|
|
253
259
|
"request": "default",
|
|
254
260
|
"response": "default"
|
|
255
261
|
},
|
|
256
|
-
{
|
|
257
|
-
"method": "GET",
|
|
258
|
-
"path": "/channels/current",
|
|
259
|
-
"capability": "channels",
|
|
260
|
-
"operation": "current",
|
|
261
|
-
"request": "default",
|
|
262
|
-
"response": "default"
|
|
263
|
-
},
|
|
264
262
|
{
|
|
265
263
|
"method": "GET",
|
|
266
264
|
"path": "/channels/pool/status",
|
|
@@ -269,14 +267,6 @@
|
|
|
269
267
|
"request": "default",
|
|
270
268
|
"response": "default"
|
|
271
269
|
},
|
|
272
|
-
{
|
|
273
|
-
"method": "GET",
|
|
274
|
-
"path": "/channels/best-for-restore",
|
|
275
|
-
"capability": "channels",
|
|
276
|
-
"operation": "bestForRestore",
|
|
277
|
-
"request": "default",
|
|
278
|
-
"response": "default"
|
|
279
|
-
},
|
|
280
270
|
{
|
|
281
271
|
"method": "GET",
|
|
282
272
|
"path": "/channels/auth",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"defaultEnabled": true,
|
|
10
10
|
"sortOrder": 30,
|
|
11
11
|
"modelConfig": { "catalogKey": "codex" },
|
|
12
|
+
"channelModelType": "openai_compatible",
|
|
12
13
|
"auth": {
|
|
13
14
|
"modes": ["api_key", "oauth", "none"],
|
|
14
15
|
"oauth": { "adapter": "opencode", "policy": "single-enabled", "quota": "codex" }
|
|
@@ -20,6 +21,26 @@
|
|
|
20
21
|
"apiBasePath": "/api/opencode/proxy",
|
|
21
22
|
"portKey": "opencodeProxy",
|
|
22
23
|
"defaultPort": 20091,
|
|
24
|
+
"channelCli": {
|
|
25
|
+
"supportsCliCreate": true,
|
|
26
|
+
"supportsCliToggle": true,
|
|
27
|
+
"createQuestions": [
|
|
28
|
+
{ "type": "input", "name": "name", "message": "渠道名称:", "validation": "required", "validationMessage": "渠道名称不能为空" },
|
|
29
|
+
{ "type": "input", "name": "baseUrl", "message": "Base URL:", "validation": "http_url", "validationMessage": "Base URL 必须以 http:// 或 https:// 开头" },
|
|
30
|
+
{ "type": "input", "name": "apiKey", "message": "API Key:", "validation": "required", "validationMessage": "API Key 不能为空" },
|
|
31
|
+
{
|
|
32
|
+
"type": "input",
|
|
33
|
+
"name": "wireApi",
|
|
34
|
+
"message": "Wire API (默认: openai):",
|
|
35
|
+
"default": "openai"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"type": "input",
|
|
39
|
+
"name": "model",
|
|
40
|
+
"message": "默认模型(可选,直接回车跳过):"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
},
|
|
23
44
|
"pathResolverId": "opencode",
|
|
24
45
|
"resourceTypes": {
|
|
25
46
|
"skills": true,
|
|
@@ -237,14 +258,6 @@
|
|
|
237
258
|
"request": "default",
|
|
238
259
|
"response": "default"
|
|
239
260
|
},
|
|
240
|
-
{
|
|
241
|
-
"method": "GET",
|
|
242
|
-
"path": "/channels/current",
|
|
243
|
-
"capability": "channels",
|
|
244
|
-
"operation": "current",
|
|
245
|
-
"request": "default",
|
|
246
|
-
"response": "default"
|
|
247
|
-
},
|
|
248
261
|
{
|
|
249
262
|
"method": "GET",
|
|
250
263
|
"path": "/channels/pool/status",
|
|
@@ -253,14 +266,6 @@
|
|
|
253
266
|
"request": "default",
|
|
254
267
|
"response": "default"
|
|
255
268
|
},
|
|
256
|
-
{
|
|
257
|
-
"method": "GET",
|
|
258
|
-
"path": "/channels/best-for-restore",
|
|
259
|
-
"capability": "channels",
|
|
260
|
-
"operation": "bestForRestore",
|
|
261
|
-
"request": "default",
|
|
262
|
-
"response": "default"
|
|
263
|
-
},
|
|
264
269
|
{
|
|
265
270
|
"method": "GET",
|
|
266
271
|
"path": "/channels/auth",
|
|
@@ -17,6 +17,7 @@ const PUBLIC_FIELDS = Object.freeze([
|
|
|
17
17
|
'defaultPort',
|
|
18
18
|
'portLabel',
|
|
19
19
|
'apiPrefix',
|
|
20
|
+
'apiRoutes',
|
|
20
21
|
'modelCatalogKey',
|
|
21
22
|
'logLayout',
|
|
22
23
|
'promptLabel',
|
|
@@ -24,6 +25,30 @@ const PUBLIC_FIELDS = Object.freeze([
|
|
|
24
25
|
'resourceActions'
|
|
25
26
|
]);
|
|
26
27
|
|
|
28
|
+
const DEFAULT_API_ROUTES = Object.freeze([
|
|
29
|
+
{ method: 'GET', path: '/projects', capability: 'projects', operation: 'listProjects' },
|
|
30
|
+
{ method: 'GET', path: '/sessions/:projectName', capability: 'sessions', operation: 'listSessions' },
|
|
31
|
+
{ method: 'GET', path: '/channels', capability: 'channels', operation: 'list' },
|
|
32
|
+
{ method: 'POST', path: '/channels', capability: 'channels', operation: 'create' },
|
|
33
|
+
{ method: 'PUT', path: '/channels/:channelId', capability: 'channels', operation: 'update' },
|
|
34
|
+
{ method: 'DELETE', path: '/channels/:channelId', capability: 'channels', operation: 'remove' },
|
|
35
|
+
{ method: 'GET', path: '/proxy/status', capability: 'proxy', operation: 'status' }
|
|
36
|
+
]);
|
|
37
|
+
|
|
38
|
+
function publicApiRoutes(api) {
|
|
39
|
+
const routes = Array.isArray(api?.routes) ? api.routes : DEFAULT_API_ROUTES;
|
|
40
|
+
return routes
|
|
41
|
+
.filter(route => route && typeof route === 'object' && !Array.isArray(route))
|
|
42
|
+
.filter(route => typeof route.path === 'string' && route.path.startsWith('/')
|
|
43
|
+
&& typeof route.capability === 'string' && typeof route.operation === 'string')
|
|
44
|
+
.map(route => ({
|
|
45
|
+
method: String(route.method || 'GET').toUpperCase(),
|
|
46
|
+
path: route.path,
|
|
47
|
+
capability: route.capability,
|
|
48
|
+
operation: route.operation
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
|
|
27
52
|
function publicCapabilities(capabilities) {
|
|
28
53
|
if (!capabilities || typeof capabilities !== 'object' || Array.isArray(capabilities)) {
|
|
29
54
|
return {};
|
|
@@ -69,6 +94,10 @@ function toPublicDefinition(definition) {
|
|
|
69
94
|
if (resourceActions) result.resourceActions = resourceActions;
|
|
70
95
|
continue;
|
|
71
96
|
}
|
|
97
|
+
if (field === 'apiRoutes') {
|
|
98
|
+
result.apiRoutes = publicApiRoutes(definition.api);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
72
101
|
if (field === 'apiPrefix') {
|
|
73
102
|
const apiPrefix = definition.apiPrefix ?? definition.api?.prefix;
|
|
74
103
|
if (apiPrefix !== undefined) result.apiPrefix = apiPrefix || null;
|
|
@@ -28,16 +28,9 @@ const MODEL_TYPE_ALIASES = Object.freeze({
|
|
|
28
28
|
google: 'gemini'
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
function resolveModelListType(
|
|
31
|
+
function resolveModelListType(channel = {}, configuredType = '') {
|
|
32
32
|
const explicitType = String(configuredType || channel?.gatewaySourceType || '').trim().toLowerCase();
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
switch (platform) {
|
|
36
|
-
case 'claude': return 'claude';
|
|
37
|
-
case 'gemini': return 'gemini';
|
|
38
|
-
case 'codex': return 'openai_compatible';
|
|
39
|
-
default: return 'openai_compatible';
|
|
40
|
-
}
|
|
33
|
+
return MODEL_TYPE_ALIASES[explicitType] || 'openai_compatible';
|
|
41
34
|
}
|
|
42
35
|
|
|
43
36
|
function isSecretKey(key) {
|
|
@@ -131,7 +124,12 @@ function createChannelDriver({
|
|
|
131
124
|
}
|
|
132
125
|
};
|
|
133
126
|
const driver = { platform, capability };
|
|
134
|
-
driver.getCliMetadata = () => ({
|
|
127
|
+
driver.getCliMetadata = () => ({
|
|
128
|
+
supportsCliCreate: false,
|
|
129
|
+
supportsCliToggle: false,
|
|
130
|
+
...(context.manifest?.channelCli || {}),
|
|
131
|
+
...cliMetadata
|
|
132
|
+
});
|
|
135
133
|
driver.formatCliChannelDetails = typeof formatCliChannelDetails === 'function'
|
|
136
134
|
? channel => formatCliChannelDetails(channel)
|
|
137
135
|
: () => [];
|
|
@@ -159,7 +157,7 @@ function createChannelDriver({
|
|
|
159
157
|
driver.listModels = async (channel, options = {}) => {
|
|
160
158
|
try {
|
|
161
159
|
const { fetchModelsFromProvider } = require('../server/services/model-detector');
|
|
162
|
-
const channelType = resolveModelListType(
|
|
160
|
+
const channelType = resolveModelListType(channel, modelListType);
|
|
163
161
|
const data = await fetchModelsFromProvider(channel, channelType, options);
|
|
164
162
|
return ok(platform, capability, 'listModels', data);
|
|
165
163
|
} catch (error) {
|
|
@@ -173,7 +171,7 @@ function createChannelDriver({
|
|
|
173
171
|
const channel = await findChannelById(channelId);
|
|
174
172
|
if (!channel) return invalid(platform, capability, operation, new Error(`Channel not found: ${channelId}`));
|
|
175
173
|
const { fetchModelsFromProvider } = require('../server/services/model-detector');
|
|
176
|
-
const channelType = resolveModelListType(
|
|
174
|
+
const channelType = resolveModelListType(channel, modelListType);
|
|
177
175
|
const data = await fetchModelsFromProvider(channel, channelType, options);
|
|
178
176
|
return ok(platform, capability, operation, data);
|
|
179
177
|
} catch (error) {
|
|
@@ -185,7 +183,7 @@ function createChannelDriver({
|
|
|
185
183
|
const channel = input && typeof input === 'object' ? input : {};
|
|
186
184
|
try {
|
|
187
185
|
const { probeModelAvailability, getModelPriority } = require('../server/services/model-detector');
|
|
188
|
-
const channelType = resolveModelListType(
|
|
186
|
+
const channelType = resolveModelListType(channel, modelListType);
|
|
189
187
|
const probe = await probeModelAvailability(channel, channelType, {
|
|
190
188
|
forceRefresh: channel.forceRefresh === true || channel.force === true,
|
|
191
189
|
preferredModels: Array.isArray(channel.preferredModels) ? channel.preferredModels : [],
|
|
@@ -212,7 +210,7 @@ function createChannelDriver({
|
|
|
212
210
|
const channel = await findChannelById(channelId);
|
|
213
211
|
if (!channel) return invalid(platform, capability, operation, new Error(`Channel not found: ${channelId}`));
|
|
214
212
|
const { testChannelSpeed } = require('../server/services/speed-test');
|
|
215
|
-
const channelType = resolveModelListType(
|
|
213
|
+
const channelType = resolveModelListType(channel, modelListType);
|
|
216
214
|
const data = await testChannelSpeed(channel, body?.timeout, channelType, { authSourceType: platform });
|
|
217
215
|
return ok(platform, capability, operation, data);
|
|
218
216
|
} catch (error) {
|