@luchenglong/cli-bridge 0.2.8 → 0.2.10
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/CHANGELOG.md +91 -0
- package/PROVIDER-CONTRACT.md +87 -5
- package/README.md +12 -11
- package/docs/HANDOVER.md +109 -15
- package/dynamic/agy.host.js +1 -1
- package/dynamic/claude.host.js +1858 -0
- package/dynamic/claude.host.template.mjs +108 -0
- package/dynamic/codebuddy.host.js +1427 -1379
- package/dynamic/codex.host.js +1930 -0
- package/dynamic/codex.host.template.mjs +137 -0
- package/dynamic/mimo.host.js +721 -515
- package/dynamic/mimo.host.template.mjs +2 -0
- package/dynamic/opencode.host.js +741 -585
- package/dynamic/opencode.host.template.mjs +2 -0
- package/home-plugin/cli-bridge-indicator/lib/client.js +74 -90
- package/home-plugin/cli-bridge-indicator/lib/index.mjs +48 -0
- package/home-plugin/cli-bridge-indicator/lib/preset-declarations.mjs +2 -3
- package/mcp/cli-bridge-mcp.mjs +4 -2
- package/mcp/providers/claude.mjs +231 -0
- package/mcp/providers/codebuddy.mjs +427 -427
- package/mcp/providers/codex.mjs +239 -0
- package/package.json +6 -2
- package/preset/claude-first/agent.cordis.yml +136 -0
- package/preset/claude-first/cli-bridge.mjs +131 -0
- package/preset/claude-first/plugin-list.mjs +28 -0
- package/preset/claude-first/preset.yml +3 -0
- package/preset/codex-first/agent.cordis.yml +136 -0
- package/preset/codex-first/cli-bridge.mjs +160 -0
- package/preset/codex-first/plugin-list.mjs +28 -0
- package/preset/codex-first/preset.yml +3 -0
- package/providers/claude-exe.mjs +112 -0
- package/providers/claude-models.mjs +338 -0
- package/providers/claude-policy.mjs +37 -0
- package/providers/claude.mjs +561 -0
- package/providers/codebuddy-catalog.mjs +367 -599
- package/providers/codebuddy-consts.mjs +72 -72
- package/providers/codebuddy-models-source.mjs +254 -0
- package/providers/codebuddy-models-tool.mjs +106 -106
- package/providers/codebuddy-schemas.mjs +46 -46
- package/providers/codebuddy.mjs +600 -578
- package/providers/codex-cli.mjs +405 -0
- package/providers/codex-models.mjs +107 -0
- package/providers/codex.mjs +585 -0
- package/providers/mimo-pure.mjs +270 -111
- package/providers/mimo.mjs +453 -517
- package/providers/opencode-exe.mjs +190 -63
- package/providers/opencode.mjs +553 -587
- package/providers/registry.mjs +25 -1
- package/scripts/build.mjs +261 -262
- package/scripts/verify.mjs +8 -2
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
// providers/codebuddy-models-tool.mjs — codebuddy_models 工具定义(纯逻辑)。
|
|
2
|
-
//
|
|
3
|
-
// 从 codebuddy-catalog.mjs 再拆出:两个文件都要留在 600 行红线内(规则 §26)。
|
|
4
|
-
// scripts/build.mjs 会把 providers/codebuddy-*.mjs 全部内联进 dynamic 沙箱的同一个
|
|
5
|
-
// 作用域,所以这里仍可引用 catalog 的函数(沙箱内天然可见);ESM 形态走本文件的 import。
|
|
6
|
-
// ⚠️ 注释里绝不写出口令标记字面量(build 全局替换会劈开注释 → 生成物语法崩)。
|
|
7
|
-
|
|
8
|
-
import { currentPreferredBackend, probeAccountModels, fetchHelpModelsSync } from './codebuddy-
|
|
9
|
-
|
|
10
|
-
// ── codebuddy_models 工具定义(搬自主文件;纯逻辑,依赖经 ctx 注入)────────────
|
|
11
|
-
// ctx = { env, deps, resolveBackend, modelCatalogDetailed, getAccountCatalog }
|
|
12
|
-
export function codebuddyModelsTool(ctx) {
|
|
13
|
-
const c = ctx || {}
|
|
14
|
-
const deps = c.deps || {}
|
|
15
|
-
const env = c.env || {}
|
|
16
|
-
return {
|
|
17
|
-
name: 'codebuddy_models',
|
|
18
|
-
description: 'List the models the local codebuddy CLI can use for a given backend, read LIVE from the CLI. Primary source: an account probe (runs the CLI with a deliberately invalid model id, which makes the server print "Currently supported models for your account") — this is the authoritative licensed list for THIS account. If that face is not logged in, it falls back to the roster the installed CLI declares in --help and says so in the source field. Credit multipliers (x0.00 = free) come from the product descriptor as metadata. Returns ok:false with an actionable error when no live roster can be read — it never presents a frozen static table as if it were live.',
|
|
19
|
-
inputSchema: {
|
|
20
|
-
type: 'object', additionalProperties: false, required: [],
|
|
21
|
-
properties: {
|
|
22
|
-
backend: { type: 'string', enum: c.BACKEND_ENUM, description: 'Which product face to list (default: the preferred backend).' },
|
|
23
|
-
freeOnly: { type: 'boolean', description: 'Return only x0.00 (free) models.' },
|
|
24
|
-
authorizedOnly: { type: 'boolean', description: 'Return only ids the current account is licensed for (harvested from a prior run).' }
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
render: (args, value) => {
|
|
28
|
-
const v = value || {}
|
|
29
|
-
if (!v.ok) return [{ type: 'text', text: 'codebuddy_models failed: ' + String(v.error || 'unknown') }]
|
|
30
|
-
const list = Array.isArray(v.models) ? v.models : []
|
|
31
|
-
if (!list.length) return [{ type: 'text', text: 'codebuddy_models: no models matched (backend=' + (v.backend || '?') + ')' }]
|
|
32
|
-
const lines = ['codebuddy models [' + v.backend + '] (' + list.length + '):']
|
|
33
|
-
for (const m of list.slice(0, 40)) {
|
|
34
|
-
const flags = []
|
|
35
|
-
if (m.authorized) flags.push('authorized')
|
|
36
|
-
if (m.credits === 0) flags.push('free')
|
|
37
|
-
lines.push(' ' + m.id + (m.creditLabel ? ' ' + m.creditLabel : '') + (flags.length ? ' [' + flags.join(',') + ']' : ''))
|
|
38
|
-
}
|
|
39
|
-
if (list.length > 40) lines.push(' … and ' + (list.length - 40) + ' more')
|
|
40
|
-
// 只有一种来源:账号实时(服务端裁决)。不再有 cli-help 兜底分支,
|
|
41
|
-
// 因为 CLI 的 --help 名册实测会滞后服务端并含已废弃 id。
|
|
42
|
-
lines.push('source: account-live (authoritative for this account)')
|
|
43
|
-
if (v.note) lines.push('note: ' + v.note)
|
|
44
|
-
return [{ type: 'text', text: lines.join('\n') }]
|
|
45
|
-
},
|
|
46
|
-
async logic(args) {
|
|
47
|
-
const a = args || {}
|
|
48
|
-
const preferred = currentPreferredBackend() || (deps.settings && deps.settings.preferredBackend) || null
|
|
49
|
-
const backend = c.normalizeBackend(a.backend) || c.resolveBackend({}, null, preferred)
|
|
50
|
-
|
|
51
|
-
// ① 账号实时(最权威,对照 workbuddy-auth 的 agents[cli] 白名单语义)。
|
|
52
|
-
// 该面未登录/无 token 时探测会失败 —— 失败就**明确降级到 CLI 名册并标注**,
|
|
53
|
-
// 绝不把静态表冒充成账号可用清单。
|
|
54
|
-
const extraEnv = (c.faceEnv && c.faceEnv(backend)) || {}
|
|
55
|
-
const probe = await probeAccountModels(env, { envExtra: extraEnv, timeoutMs: a.timeoutMs })
|
|
56
|
-
|
|
57
|
-
// 唯一权威源 = 账号探测(服务端裁决)。**不再回落 CLI `--help` 名册**:
|
|
58
|
-
// 实测 CLI 2.167.0 的 help 文本本身就过时(18 项、含已废弃的 minimax-m3 /
|
|
59
|
-
// kimi-k3-1、缺 3 个真实模型),拿它兜底等于把错误清单当结果交付。
|
|
60
|
-
// 探测失败就明确失败,并附上「CLI 声明了 N 项」作为诊断线索(只作提示,不展示
|
|
61
|
-
// 那些 id),符合红线:开发期禁止静默降级。
|
|
62
|
-
if (!probe.ok || !probe.ids || !probe.ids.length) {
|
|
63
|
-
let hint = ''
|
|
64
|
-
try {
|
|
65
|
-
const help = fetchHelpModelsSync(env, { timeoutMs: a.timeoutMs })
|
|
66
|
-
if (help.ok && help.ids.length) {
|
|
67
|
-
hint = ' The installed CLI declares ' + help.ids.length + ' models via --help, but that roster is a static ' +
|
|
68
|
-
'build-time list and has been observed to lag the server (it can contain retired ids). It is NOT shown here ' +
|
|
69
|
-
'because it is not authoritative for this account.'
|
|
70
|
-
}
|
|
71
|
-
} catch (e) { }
|
|
72
|
-
return {
|
|
73
|
-
ok: false, backend,
|
|
74
|
-
error: 'no account model roster for backend "' + backend + '": ' + String(probe.error || 'probe failed') +
|
|
75
|
-
'. Make sure this product face is logged in (run the codebuddy CLI and complete login), or set CODEBUDDY_BIN ' +
|
|
76
|
-
'to the right executable, then retry.' + hint
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
const ids = probe.ids
|
|
80
|
-
const source = 'account-live'
|
|
81
|
-
|
|
82
|
-
// ③ 倍率/授权元数据(来自描述文件;仅作标注,不参与「是否可用」判定)。
|
|
83
|
-
let detail = []
|
|
84
|
-
try { detail = c.modelCatalogDetailed(backend, { env, accountModels: ids }) || [] } catch (e) { detail = [] }
|
|
85
|
-
const byId = new Map(detail.map((x) => [x.id, x]))
|
|
86
|
-
let list = ids.map((id) => {
|
|
87
|
-
const d = byId.get(id)
|
|
88
|
-
return {
|
|
89
|
-
id,
|
|
90
|
-
authorized: d ? !!d.authorized : (source === 'account-live'),
|
|
91
|
-
credits: d && typeof d.credits === 'number' ? d.credits : null,
|
|
92
|
-
creditLabel: (d && (d.creditLabel || d.label)) || '',
|
|
93
|
-
label: (d && d.label) || id
|
|
94
|
-
}
|
|
95
|
-
})
|
|
96
|
-
if (a.authorizedOnly) list = list.filter((m) => m.authorized)
|
|
97
|
-
if (a.freeOnly) list = list.filter((m) => m.credits === 0)
|
|
98
|
-
return {
|
|
99
|
-
ok: true, backend, models: list, count: list.length,
|
|
100
|
-
source, note: (typeof note !== 'undefined' ? note : undefined),
|
|
101
|
-
probedAt: Date.now()
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
1
|
+
// providers/codebuddy-models-tool.mjs — codebuddy_models 工具定义(纯逻辑)。
|
|
2
|
+
//
|
|
3
|
+
// 从 codebuddy-catalog.mjs 再拆出:两个文件都要留在 600 行红线内(规则 §26)。
|
|
4
|
+
// scripts/build.mjs 会把 providers/codebuddy-*.mjs 全部内联进 dynamic 沙箱的同一个
|
|
5
|
+
// 作用域,所以这里仍可引用 catalog 的函数(沙箱内天然可见);ESM 形态走本文件的 import。
|
|
6
|
+
// ⚠️ 注释里绝不写出口令标记字面量(build 全局替换会劈开注释 → 生成物语法崩)。
|
|
7
|
+
|
|
8
|
+
import { currentPreferredBackend, probeAccountModels, fetchHelpModelsSync } from './codebuddy-models-source.mjs'
|
|
9
|
+
|
|
10
|
+
// ── codebuddy_models 工具定义(搬自主文件;纯逻辑,依赖经 ctx 注入)────────────
|
|
11
|
+
// ctx = { env, deps, resolveBackend, modelCatalogDetailed, getAccountCatalog }
|
|
12
|
+
export function codebuddyModelsTool(ctx) {
|
|
13
|
+
const c = ctx || {}
|
|
14
|
+
const deps = c.deps || {}
|
|
15
|
+
const env = c.env || {}
|
|
16
|
+
return {
|
|
17
|
+
name: 'codebuddy_models',
|
|
18
|
+
description: 'List the models the local codebuddy CLI can use for a given backend, read LIVE from the CLI. Primary source: an account probe (runs the CLI with a deliberately invalid model id, which makes the server print "Currently supported models for your account") — this is the authoritative licensed list for THIS account. If that face is not logged in, it falls back to the roster the installed CLI declares in --help and says so in the source field. Credit multipliers (x0.00 = free) come from the product descriptor as metadata. Returns ok:false with an actionable error when no live roster can be read — it never presents a frozen static table as if it were live.',
|
|
19
|
+
inputSchema: {
|
|
20
|
+
type: 'object', additionalProperties: false, required: [],
|
|
21
|
+
properties: {
|
|
22
|
+
backend: { type: 'string', enum: c.BACKEND_ENUM, description: 'Which product face to list (default: the preferred backend).' },
|
|
23
|
+
freeOnly: { type: 'boolean', description: 'Return only x0.00 (free) models.' },
|
|
24
|
+
authorizedOnly: { type: 'boolean', description: 'Return only ids the current account is licensed for (harvested from a prior run).' }
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
render: (args, value) => {
|
|
28
|
+
const v = value || {}
|
|
29
|
+
if (!v.ok) return [{ type: 'text', text: 'codebuddy_models failed: ' + String(v.error || 'unknown') }]
|
|
30
|
+
const list = Array.isArray(v.models) ? v.models : []
|
|
31
|
+
if (!list.length) return [{ type: 'text', text: 'codebuddy_models: no models matched (backend=' + (v.backend || '?') + ')' }]
|
|
32
|
+
const lines = ['codebuddy models [' + v.backend + '] (' + list.length + '):']
|
|
33
|
+
for (const m of list.slice(0, 40)) {
|
|
34
|
+
const flags = []
|
|
35
|
+
if (m.authorized) flags.push('authorized')
|
|
36
|
+
if (m.credits === 0) flags.push('free')
|
|
37
|
+
lines.push(' ' + m.id + (m.creditLabel ? ' ' + m.creditLabel : '') + (flags.length ? ' [' + flags.join(',') + ']' : ''))
|
|
38
|
+
}
|
|
39
|
+
if (list.length > 40) lines.push(' … and ' + (list.length - 40) + ' more')
|
|
40
|
+
// 只有一种来源:账号实时(服务端裁决)。不再有 cli-help 兜底分支,
|
|
41
|
+
// 因为 CLI 的 --help 名册实测会滞后服务端并含已废弃 id。
|
|
42
|
+
lines.push('source: account-live (authoritative for this account)')
|
|
43
|
+
if (v.note) lines.push('note: ' + v.note)
|
|
44
|
+
return [{ type: 'text', text: lines.join('\n') }]
|
|
45
|
+
},
|
|
46
|
+
async logic(args) {
|
|
47
|
+
const a = args || {}
|
|
48
|
+
const preferred = currentPreferredBackend() || (deps.settings && deps.settings.preferredBackend) || null
|
|
49
|
+
const backend = c.normalizeBackend(a.backend) || c.resolveBackend({}, null, preferred)
|
|
50
|
+
|
|
51
|
+
// ① 账号实时(最权威,对照 workbuddy-auth 的 agents[cli] 白名单语义)。
|
|
52
|
+
// 该面未登录/无 token 时探测会失败 —— 失败就**明确降级到 CLI 名册并标注**,
|
|
53
|
+
// 绝不把静态表冒充成账号可用清单。
|
|
54
|
+
const extraEnv = (c.faceEnv && c.faceEnv(backend)) || {}
|
|
55
|
+
const probe = await probeAccountModels(env, { envExtra: extraEnv, timeoutMs: a.timeoutMs })
|
|
56
|
+
|
|
57
|
+
// 唯一权威源 = 账号探测(服务端裁决)。**不再回落 CLI `--help` 名册**:
|
|
58
|
+
// 实测 CLI 2.167.0 的 help 文本本身就过时(18 项、含已废弃的 minimax-m3 /
|
|
59
|
+
// kimi-k3-1、缺 3 个真实模型),拿它兜底等于把错误清单当结果交付。
|
|
60
|
+
// 探测失败就明确失败,并附上「CLI 声明了 N 项」作为诊断线索(只作提示,不展示
|
|
61
|
+
// 那些 id),符合红线:开发期禁止静默降级。
|
|
62
|
+
if (!probe.ok || !probe.ids || !probe.ids.length) {
|
|
63
|
+
let hint = ''
|
|
64
|
+
try {
|
|
65
|
+
const help = fetchHelpModelsSync(env, { timeoutMs: a.timeoutMs })
|
|
66
|
+
if (help.ok && help.ids.length) {
|
|
67
|
+
hint = ' The installed CLI declares ' + help.ids.length + ' models via --help, but that roster is a static ' +
|
|
68
|
+
'build-time list and has been observed to lag the server (it can contain retired ids). It is NOT shown here ' +
|
|
69
|
+
'because it is not authoritative for this account.'
|
|
70
|
+
}
|
|
71
|
+
} catch (e) { }
|
|
72
|
+
return {
|
|
73
|
+
ok: false, backend,
|
|
74
|
+
error: 'no account model roster for backend "' + backend + '": ' + String(probe.error || 'probe failed') +
|
|
75
|
+
'. Make sure this product face is logged in (run the codebuddy CLI and complete login), or set CODEBUDDY_BIN ' +
|
|
76
|
+
'to the right executable, then retry.' + hint
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const ids = probe.ids
|
|
80
|
+
const source = 'account-live'
|
|
81
|
+
|
|
82
|
+
// ③ 倍率/授权元数据(来自描述文件;仅作标注,不参与「是否可用」判定)。
|
|
83
|
+
let detail = []
|
|
84
|
+
try { detail = c.modelCatalogDetailed(backend, { env, accountModels: ids }) || [] } catch (e) { detail = [] }
|
|
85
|
+
const byId = new Map(detail.map((x) => [x.id, x]))
|
|
86
|
+
let list = ids.map((id) => {
|
|
87
|
+
const d = byId.get(id)
|
|
88
|
+
return {
|
|
89
|
+
id,
|
|
90
|
+
authorized: d ? !!d.authorized : (source === 'account-live'),
|
|
91
|
+
credits: d && typeof d.credits === 'number' ? d.credits : null,
|
|
92
|
+
creditLabel: (d && (d.creditLabel || d.label)) || '',
|
|
93
|
+
label: (d && d.label) || id
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
if (a.authorizedOnly) list = list.filter((m) => m.authorized)
|
|
97
|
+
if (a.freeOnly) list = list.filter((m) => m.credits === 0)
|
|
98
|
+
return {
|
|
99
|
+
ok: true, backend, models: list, count: list.length,
|
|
100
|
+
source, note: (typeof note !== 'undefined' ? note : undefined),
|
|
101
|
+
probedAt: Date.now()
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
// providers/codebuddy-schemas.mjs — 三工具 JSON Schema(纯数据,零依赖)。
|
|
2
|
-
//
|
|
3
|
-
// 旧 preset/codebuddy-first verbatim(契约 §8 红线):字段名/枚举/描述一字不改。
|
|
4
|
-
// 放这里是为了让 catalog 与主描述符都留在 600 行红线内(规则 §26)。
|
|
5
|
-
// ⚠️ 注释里绝不写出口令标记字面量(build 全局替换会把注释劈开)。
|
|
6
|
-
|
|
7
|
-
import { BACKEND_ENUM, MODEL_DESCRIPTION } from './codebuddy-catalog.mjs'
|
|
8
|
-
|
|
9
|
-
// ── 三工具 schema(旧 preset/codebuddy-first verbatim;契约 §8 红线)────────────
|
|
10
|
-
// 纯数据,无依赖 —— 放这里是为了让主描述符留在 600 行红线内(规则 §26)。
|
|
11
|
-
export const RUN_PARAMS = {
|
|
12
|
-
type: 'object',
|
|
13
|
-
additionalProperties: false,
|
|
14
|
-
required: ['prompt'],
|
|
15
|
-
properties: {
|
|
16
|
-
prompt: { type: 'string', description: 'The full task/instruction for codebuddy. Be complete and self-contained.' },
|
|
17
|
-
backend: { type: 'string', enum: BACKEND_ENUM, description: 'Which CLI face to dispatch to. codebuddy (default; domestic CodeBuddy npm CLI, product endpoint www.codebuddy.ai) for coding work; codebuddy-intl = CodeBuddy INTERNATIONAL face of the same npm CLI (product.ioa.json catalogue: claude-sonnet-5 / claude-opus-5 / gemini-3.1-pro / gpt-6-astra / hy3-ioa ...; aliases codebuddy-ioa / codebuddy-international) when the account is an international CodeBuddy account; codebuddy-en = WorkBuddy international edition (the WorkBuddyAI desktop bundled CLI at C:\\Program Files\\WorkBuddyAI, product endpoint www.workbuddy.ai; needs codebuddyEnToken unless DSH already holds a workbuddy key) — aliases workbuddy-en / workbuddy-ai also accepted; workbuddy = WorkBuddy domestic desktop CLI (product endpoint copilot.tencent.com, zero config), the office-scenario face: documents/slides/spreadsheets, knowledge-base lookups, image/video generation, WeChat/WeCom replies. New calls without a backend follow the user-preferred default backend (plugin settings). Continuing a session routes back to its owning backend automatically.' },
|
|
18
|
-
mode: { type: 'string', enum: ['auto', 'plan', 'accept-edits'], description: 'auto follows DSH plan state; plan = no writes; accept-edits = allow edits. Default auto.' },
|
|
19
|
-
model: { type: 'string', description: MODEL_DESCRIPTION },
|
|
20
|
-
effort: { type: 'string', enum: ['minimal', 'low', 'medium', 'high', 'xhigh', 'max'], description: 'Optional reasoning effort.' },
|
|
21
|
-
maxTurns: { type: 'integer', description: 'Optional max agentic turns (1-500, default unlimited).' },
|
|
22
|
-
cwd: { type: 'string', description: 'Working directory for codebuddy. Defaults to the DSH workspace root.' },
|
|
23
|
-
addDirs: { type: 'array', items: { type: 'string' }, description: 'Extra directories to add to codebuddy workspace.' },
|
|
24
|
-
timeoutSec: { type: 'integer', description: 'Run timeout seconds (10-3600, default 300); a DSH-side hang guard force-terminates at timeout+60s.' },
|
|
25
|
-
background: { type: 'boolean', description: 'Run as a background job and return a jobId immediately.' }
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export const CONTINUE_PARAMS = {
|
|
29
|
-
type: 'object',
|
|
30
|
-
additionalProperties: false,
|
|
31
|
-
required: ['prompt'],
|
|
32
|
-
properties: {
|
|
33
|
-
prompt: { type: 'string', description: 'Follow-up instruction for the ongoing codebuddy conversation.' },
|
|
34
|
-
sessionId: { type: 'string', description: 'codebuddy session id to resume (from a prior codebuddy_run result).' },
|
|
35
|
-
latest: { type: 'boolean', description: 'Continue the most recent codebuddy conversation instead of a specific id.' },
|
|
36
|
-
backend: { type: 'string', enum: BACKEND_ENUM, description: 'Which CLI face to resume on. codebuddy-en = WorkBuddy international (WorkBuddyAI desktop CLI; aliases workbuddy-en / workbuddy-ai accepted), workbuddy = WorkBuddy domestic desktop CLI. When omitted, the backend that owns the sessionId is used automatically; brand-new conversations follow the user-preferred default backend (plugin settings).' },
|
|
37
|
-
mode: { type: 'string', enum: ['auto', 'plan', 'accept-edits'], description: 'Execution mode; default auto.' },
|
|
38
|
-
model: { type: 'string', description: 'Optional model id (two layers: product face carries it, account licenses it; the credit multiplier of each id comes from the CLI descriptor — see codebuddy_run).' },
|
|
39
|
-
effort: { type: 'string', enum: ['minimal', 'low', 'medium', 'high', 'xhigh', 'max'], description: 'Optional reasoning effort.' },
|
|
40
|
-
maxTurns: { type: 'integer', description: 'Optional max agentic turns.' },
|
|
41
|
-
cwd: { type: 'string', description: "Working directory for codebuddy; when resuming, defaults to the resumed session's project directory." },
|
|
42
|
-
timeoutSec: { type: 'integer', description: 'Run timeout seconds (10-3600, default 300); a DSH-side hang guard force-terminates at timeout+60s.' },
|
|
43
|
-
background: { type: 'boolean', description: 'Run as a background job and return a jobId immediately.' }
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
export const STATUS_PARAMS = { type: 'object', additionalProperties: false, required: [], properties: { cwd: { type: 'string', description: 'Optional: filter the snapshot to a single project (working directory).' } } }
|
|
1
|
+
// providers/codebuddy-schemas.mjs — 三工具 JSON Schema(纯数据,零依赖)。
|
|
2
|
+
//
|
|
3
|
+
// 旧 preset/codebuddy-first verbatim(契约 §8 红线):字段名/枚举/描述一字不改。
|
|
4
|
+
// 放这里是为了让 catalog 与主描述符都留在 600 行红线内(规则 §26)。
|
|
5
|
+
// ⚠️ 注释里绝不写出口令标记字面量(build 全局替换会把注释劈开)。
|
|
6
|
+
|
|
7
|
+
import { BACKEND_ENUM, MODEL_DESCRIPTION } from './codebuddy-catalog.mjs'
|
|
8
|
+
|
|
9
|
+
// ── 三工具 schema(旧 preset/codebuddy-first verbatim;契约 §8 红线)────────────
|
|
10
|
+
// 纯数据,无依赖 —— 放这里是为了让主描述符留在 600 行红线内(规则 §26)。
|
|
11
|
+
export const RUN_PARAMS = {
|
|
12
|
+
type: 'object',
|
|
13
|
+
additionalProperties: false,
|
|
14
|
+
required: ['prompt'],
|
|
15
|
+
properties: {
|
|
16
|
+
prompt: { type: 'string', description: 'The full task/instruction for codebuddy. Be complete and self-contained.' },
|
|
17
|
+
backend: { type: 'string', enum: BACKEND_ENUM, description: 'Which CLI face to dispatch to. codebuddy (default; domestic CodeBuddy npm CLI, product endpoint www.codebuddy.ai) for coding work; codebuddy-intl = CodeBuddy INTERNATIONAL face of the same npm CLI (product.ioa.json catalogue: claude-sonnet-5 / claude-opus-5 / gemini-3.1-pro / gpt-6-astra / hy3-ioa ...; aliases codebuddy-ioa / codebuddy-international) when the account is an international CodeBuddy account; codebuddy-en = WorkBuddy international edition (the WorkBuddyAI desktop bundled CLI at C:\\Program Files\\WorkBuddyAI, product endpoint www.workbuddy.ai; needs codebuddyEnToken unless DSH already holds a workbuddy key) — aliases workbuddy-en / workbuddy-ai also accepted; workbuddy = WorkBuddy domestic desktop CLI (product endpoint copilot.tencent.com, zero config), the office-scenario face: documents/slides/spreadsheets, knowledge-base lookups, image/video generation, WeChat/WeCom replies. New calls without a backend follow the user-preferred default backend (plugin settings). Continuing a session routes back to its owning backend automatically.' },
|
|
18
|
+
mode: { type: 'string', enum: ['auto', 'plan', 'accept-edits'], description: 'auto follows DSH plan state; plan = no writes; accept-edits = allow edits. Default auto.' },
|
|
19
|
+
model: { type: 'string', description: MODEL_DESCRIPTION },
|
|
20
|
+
effort: { type: 'string', enum: ['minimal', 'low', 'medium', 'high', 'xhigh', 'max'], description: 'Optional reasoning effort.' },
|
|
21
|
+
maxTurns: { type: 'integer', description: 'Optional max agentic turns (1-500, default unlimited).' },
|
|
22
|
+
cwd: { type: 'string', description: 'Working directory for codebuddy. Defaults to the DSH workspace root.' },
|
|
23
|
+
addDirs: { type: 'array', items: { type: 'string' }, description: 'Extra directories to add to codebuddy workspace.' },
|
|
24
|
+
timeoutSec: { type: 'integer', description: 'Run timeout seconds (10-3600, default 300); a DSH-side hang guard force-terminates at timeout+60s.' },
|
|
25
|
+
background: { type: 'boolean', description: 'Run as a background job and return a jobId immediately.' }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export const CONTINUE_PARAMS = {
|
|
29
|
+
type: 'object',
|
|
30
|
+
additionalProperties: false,
|
|
31
|
+
required: ['prompt'],
|
|
32
|
+
properties: {
|
|
33
|
+
prompt: { type: 'string', description: 'Follow-up instruction for the ongoing codebuddy conversation.' },
|
|
34
|
+
sessionId: { type: 'string', description: 'codebuddy session id to resume (from a prior codebuddy_run result).' },
|
|
35
|
+
latest: { type: 'boolean', description: 'Continue the most recent codebuddy conversation instead of a specific id.' },
|
|
36
|
+
backend: { type: 'string', enum: BACKEND_ENUM, description: 'Which CLI face to resume on. codebuddy-en = WorkBuddy international (WorkBuddyAI desktop CLI; aliases workbuddy-en / workbuddy-ai accepted), workbuddy = WorkBuddy domestic desktop CLI. When omitted, the backend that owns the sessionId is used automatically; brand-new conversations follow the user-preferred default backend (plugin settings).' },
|
|
37
|
+
mode: { type: 'string', enum: ['auto', 'plan', 'accept-edits'], description: 'Execution mode; default auto.' },
|
|
38
|
+
model: { type: 'string', description: 'Optional model id (two layers: product face carries it, account licenses it; the credit multiplier of each id comes from the CLI descriptor — see codebuddy_run).' },
|
|
39
|
+
effort: { type: 'string', enum: ['minimal', 'low', 'medium', 'high', 'xhigh', 'max'], description: 'Optional reasoning effort.' },
|
|
40
|
+
maxTurns: { type: 'integer', description: 'Optional max agentic turns.' },
|
|
41
|
+
cwd: { type: 'string', description: "Working directory for codebuddy; when resuming, defaults to the resumed session's project directory." },
|
|
42
|
+
timeoutSec: { type: 'integer', description: 'Run timeout seconds (10-3600, default 300); a DSH-side hang guard force-terminates at timeout+60s.' },
|
|
43
|
+
background: { type: 'boolean', description: 'Run as a background job and return a jobId immediately.' }
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export const STATUS_PARAMS = { type: 'object', additionalProperties: false, required: [], properties: { cwd: { type: 'string', description: 'Optional: filter the snapshot to a single project (working directory).' } } }
|