@luchenglong/cli-bridge 0.2.6 → 0.2.8
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 +72 -0
- package/docs/HANDOVER.md +9 -0
- package/docs/audits/2026-10-18-preset-0.2.1-contract-fix.md +160 -0
- package/docs/audits/README.md +15 -0
- package/dynamic/codebuddy.host.js +204 -150
- package/dynamic/mimo.host.js +514 -616
- package/dynamic/opencode.host.js +584 -628
- package/home-plugin/cli-bridge-indicator/lib/preset-declarations.mjs +85 -6
- package/mcp/cli-bridge-mcp.mjs +2 -1
- package/package.json +5 -4
- package/preset/agy-first/agent.cordis.yml +0 -5
- package/preset/agy-first/plugin-list.mjs +4 -1
- package/preset/codebuddy-first/agent.cordis.yml +0 -5
- package/preset/mimo-first/agent.cordis.yml +1 -7
- package/preset/mimo-first/plugin-list.mjs +18 -12
- package/preset/mimo-member/plugin-list.mjs +49 -0
- package/preset/opencode-first/agent.cordis.yml +0 -5
- package/preset/opencode-first/plugin-list.mjs +4 -2
- package/preset/standard-base.mjs +18 -6
- package/providers/codebuddy-catalog.mjs +32 -38
- package/providers/codebuddy-consts.mjs +72 -0
- package/providers/codebuddy-models-tool.mjs +25 -25
- package/providers/codebuddy-schemas.mjs +46 -0
- package/providers/codebuddy.mjs +33 -91
- package/providers/mimo-pure.mjs +111 -0
- package/providers/mimo.mjs +517 -618
- package/providers/opencode-exe.mjs +63 -0
- package/providers/opencode.mjs +587 -629
|
@@ -568,88 +568,19 @@ function createRunner(o) {
|
|
|
568
568
|
return { coreExecute, runSync, askFallback }
|
|
569
569
|
}
|
|
570
570
|
|
|
571
|
-
// providers/codebuddy.mjs — codebuddy provider descriptor
|
|
571
|
+
// providers/codebuddy.mjs — codebuddy provider descriptor。
|
|
572
572
|
//
|
|
573
|
-
// 移植基线:codebuddy-first-bridge v1.6.x
|
|
574
|
-
//
|
|
575
|
-
//
|
|
576
|
-
//
|
|
577
|
-
//
|
|
573
|
+
// 移植基线:codebuddy-first-bridge v1.6.x 的纯逻辑与 preset/codebuddy-first 内联语义,
|
|
574
|
+
// 逐字保持(契约 §8:工具入参语义与 schema 不许漂移)。provider 无关骨架在 bridge-kit。
|
|
575
|
+
// 纯逻辑片:codebuddy-catalog.mjs(模型目录/凭据/探测)、codebuddy-schemas.mjs(三 schema)、
|
|
576
|
+
// codebuddy-models-tool.mjs(codebuddy_models 工具)。build 会把 codebuddy-*.mjs 全部
|
|
577
|
+
// 内联进沙箱同一作用域。
|
|
578
578
|
//
|
|
579
|
-
//
|
|
580
|
-
//
|
|
581
|
-
//
|
|
582
|
-
// 单列,运行面(buildArgv/CLI 选择)不受影响。
|
|
583
|
-
//
|
|
584
|
-
// 红线(PROVIDER-CONTRACT.md §8):
|
|
585
|
-
// - 本文件会被 build 内联进 dynamic 沙箱(new Function):绝不出现元环境字面量;
|
|
586
|
-
// process/env/fs 只经 deps 注入或 typeof 守卫读取;宿主能力全部走 attach(hostOpts)。
|
|
587
|
-
// - 只允许 import '../core/bridge-kit.mjs' 一行。
|
|
588
|
-
// - isLimited 用本文件自定义的中文限流表(旧 core verbatim),不用 kit 通用表。
|
|
579
|
+
// 红线:本文件会被内联进 dynamic 沙箱 —— 绝不出现元环境字面量;process/env/fs 只经
|
|
580
|
+
// deps 注入或 typeof 守卫读取;宿主能力全部走 attach(hostOpts)。isLimited 用本文件
|
|
581
|
+
// 自定义的中文限流表(旧 core verbatim),不用 kit 通用表。
|
|
589
582
|
// ── 提示词策略段(旧 preset POLICY_TEXT verbatim;systemPrompt order 5)────────
|
|
590
|
-
const POLICY_TEXT = [
|
|
591
|
-
'codebuddy-first execution policy (local codebuddy CLI bridge, with fallback + live indicator + live status tool).',
|
|
592
|
-
'',
|
|
593
|
-
'A local sub-agent CLI named "codebuddy" (Tencent CodeBuddy Code) is available through the codebuddy_run and codebuddy_continue tools. DSH fully controls codebuddy: every invocation runs non-interactively with permissions auto-approved (--permission-mode bypassPermissions), so codebuddy never prompts and DSH decides all of its work. A header status light shows when codebuddy is working — one light per project (working directory), so parallel runs in different projects are tracked separately; call codebuddy_status any time to see what codebuddy is doing right now (per project: current tool/step, recent trail, and cumulative usage).',
|
|
594
|
-
'',
|
|
595
|
-
'Priority rule for EVERY mode (normal, plan, accept-edits, subagent/workflow/ralph delegation, and goal rounds):',
|
|
596
|
-
'- For any real work — implementing features, editing/refactoring code, debugging, running builds, or multi-file investigation — prefer dispatching the task to codebuddy_run FIRST with a complete, self-contained prompt.',
|
|
597
|
-
'- Use native read/write/shell tools mainly for quick read-only lookups and for the final build/test verification of what codebuddy produced.',
|
|
598
|
-
'- In plan mode, call codebuddy_run with mode=auto (or mode=plan); in accept-edits/normal mode codebuddy_run applies edits directly.',
|
|
599
|
-
'- When you delegate to a DSH subagent or workflow, instruct that delegate to also prefer codebuddy_run.',
|
|
600
|
-
'- For long-running tasks, call codebuddy_run with background=true and collect the result with job_output; use codebuddy_status to watch progress.',
|
|
601
|
-
'',
|
|
602
|
-
'Fallback protocol: when codebuddy is rate-limited or the network is down, codebuddy_run/codebuddy_continue automatically pop a confirmation dialog asking the user whether to use the DSH local API config. If the returned result has fallback=true (status FALLBACK_TO_DSH), the user chose to fall back: complete the task with native DSH tools / the local model and DO NOT call codebuddy again for this task. If ok=false without fallback, report the codebuddy error. Never loop codebuddy calls; never ask codebuddy to call back into DSH.',
|
|
603
|
-
'',
|
|
604
|
-
'Model selection: codebuddy_run takes an optional model. When unspecified, the CLI default applies unless the user set a preferred default model in the plugin settings (then that is injected automatically per call). Which models ACTUALLY WORK depends on the ACCOUNT, and the authoritative live list comes from the server: running the CLI with a nonexistent model returns 400 followed by "Currently supported models for your account:" and one "- <id>" per line (core exposes parseAccountModels for this; the plugin caches the result automatically and the settings panel shows exactly those ids, with the credit multiplier of each). Do NOT trust the bundled product descriptor as a menu of usable models: it lists ids with an "-ioa" suffix (glm-5.3-ioa) and expensive flagships (claude-opus-4.8, gpt-5.4, gpt-6-astra) that are present in the catalogue but NOT licensed for this account, and picking one fails with 400 "only available for authorized users". The four backends are also not one pool: "codebuddy" and "codebuddy-intl" are the npm CLI and offer its catalogue - including the free tier (hy3 and deepseek-v4.1-flash cost x0.00 credits; hy4-preview costs x0.29 but is frequently free on promotional accounts); "codebuddy-en" (WorkBuddyAI) has its OWN catalogue which does NOT contain hy4-preview or deepseek-v4.1-flash - it offers hy3 (free), gpt-5.1-codex-mini, gemini-3.1-flash-lite, gemini-2.5-flash, minimax-m3, gemini-3.0-flash, deepseek-v3-2-volc, kimi-k2.5/2.6, glm-5.0/5.2/5.3, gpt-5.3-codex, gpt-5.4/5.5, gpt-5.6-sol/terra/luna and the role aliases (fast/balanced/primary/deep-model); "workbuddy" (domestic desktop) has a further catalogue (auto, hy4-preview, hy3, deepseek-v4.1-flash, glm-5.x, kimi-k2.6/2.7/2.8-preview/k3-1, minimax-m3/m2.7, deepseek-v4-pro). Within a face availability is still gated per ACCOUNT: an id outside the account catalogue fails with "400 model [...] service info not found", and one inside it but unlicensed fails with "400 model [...] is only available for authorized users". International ids (claude-sonnet-5, claude-opus-5, gemini-3.1-pro, ...) are per-account gated and return the latter for a domestic account. COST: every id carries a credit multiplier in the credits field of its descriptor (x0.00 means free, x3.31 means 3.31x the base rate); the settings panel shows each candidate with its multiplier and reads it live from the CLI descriptor, so it stays in sync when the CLI is upgraded. Measured free (x0.00) models for this account: hy3 and deepseek-v4.1-flash (both npm faces) and hy3 for WorkBuddyAI; hy4-preview is x0.29 on npm faces. Prefer the cheapest model that can do the job and use a free one for routine work; do not silently upgrade to an expensive id when the task is simple. To get the exact live list for a CLI, run it with a deliberately invalid model id - the reply prints "Currently supported models for your account:" followed by one "- <id>" per line (core exposes parseAccountModels for this). Pass a model only when the task clearly benefits from a specific one; the default is usually right. Optional effort: minimal/low/medium/high/xhigh/max. Optional maxTurns caps agentic turns (default unlimited).',
|
|
605
|
-
'',
|
|
606
|
-
'Backends: codebuddy_run/codebuddy_continue take an optional backend parameter choosing which CLI face of the same engine (Tencent CodeBuddy Code) runs the task. "codebuddy" is the domestic CodeBuddy (npm CLI @tencent-ai/codebuddy-code, product endpoint www.codebuddy.ai) — default for coding work. "codebuddy-intl" is the INTERNATIONAL face of that SAME npm CLI (product.ioa.json catalogue: claude-sonnet-5, claude-opus-5, gemini-3.1-pro, gpt-6-astra, hy3-ioa …); use it when the account is an international CodeBuddy account. Its aliases "codebuddy-ioa" and "codebuddy-international" are accepted and normalized to codebuddy-intl. "codebuddy-en" is the WorkBuddy INTERNATIONAL edition — the CLI bundled with the WorkBuddyAI desktop app (C:\\Program Files\\WorkBuddyAI, product endpoint www.workbuddy.ai); the aliases "workbuddy-en" and "workbuddy-ai" are also accepted and normalized to codebuddy-en. "workbuddy" is the CLI bundled with the domestic WorkBuddy desktop app (product endpoint copilot.tencent.com, zero config) — the office-scenario face: documents, slides, spreadsheets, knowledge-base lookups, image/video generation, WeChat/WeCom replies. When the user asks for office/document/IM work, dispatch with backend="workbuddy"; for international accounts use "codebuddy-intl" (CodeBuddy 国际版) or "codebuddy-en" (WorkBuddy 国际版 / WorkBuddyAI). Sessions are kept per backend (login domains are exclusive), and continuing a session automatically routes back to the backend that owns it (explicit backend wins). A user-preferred default backend (plugin settings) applies when a call is new (no session) and no explicit backend is given.'
|
|
607
|
-
].join('\n')
|
|
608
|
-
|
|
609
|
-
// ── 限流/网络/认证失败判定(旧 core verbatim)。仅匹配 stderr + status;数字码
|
|
610
|
-
// 加词边界(避免 "1500" 命中 500、"4013" 命中 401)。中文码(流量/受限/金额/
|
|
611
|
-
// 余额/额度/认证/连接/断开 等)为 codebuddy 面专属,必须逐字保留。
|
|
612
|
-
// 命名纪律(mimo 同款):本文件顶层名绝不与 core/bridge-kit.mjs 顶层导出同名 ——
|
|
613
|
-
// dynamic 形态把 kit 与 provider 内联进同一脚本作用域,同名 const 直接炸语法
|
|
614
583
|
// (LIMIT_RE 在 kit L33 已有,故此处带 CODEBUDDY_ 前缀)。
|
|
615
|
-
const CODEBUDDY_LIMIT_RE = /rate.?limit|ratelimit|\b429\b|too many|quota|insufficient|credit|balance|exhausted|exceed|\bnetwork\b|offline|ENETUNREACH|ECONNREFUSED|ECONNRESET|ETIMEDOUT|EAI_AGAIN|ENOTFOUND|\btimeouts?\b|timed out|unavailable|\b50[023]\b|\b40[13]\b|unauthorized|invalid api|api key|proxy|socket|tls|ssl|\bdns\b|网络|超时|限流|流量|受限|配额|金额|余额|额度|认证|连接|断开/i
|
|
616
|
-
|
|
617
|
-
// ── 后端注册表(旧 core verbatim:端点按登录域自动对齐)───────────────────────
|
|
618
|
-
const BACKENDS = ['codebuddy', 'codebuddy-intl', 'codebuddy-en', 'workbuddy']
|
|
619
|
-
|
|
620
|
-
const BACKEND_ENDPOINTS = {
|
|
621
|
-
'codebuddy': 'https://www.codebuddy.ai/v2',
|
|
622
|
-
'codebuddy-intl': 'https://www.codebuddy.ai/v2',
|
|
623
|
-
'codebuddy-en': 'https://www.workbuddy.ai/v2',
|
|
624
|
-
'workbuddy': 'https://copilot.tencent.com/v2'
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
const AUTH_DOMAIN_ENDPOINTS = {
|
|
628
|
-
'www.codebuddy.cn': 'https://www.codebuddy.cn/v2',
|
|
629
|
-
'www.codebuddy.ai': 'https://www.codebuddy.ai/v2',
|
|
630
|
-
'www.workbuddy.ai': 'https://www.workbuddy.ai/v2',
|
|
631
|
-
'copilot.tencent.com': 'https://copilot.tencent.com/v2'
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
const BACKEND_LABELS = {
|
|
635
|
-
'codebuddy': 'CodeBuddy 国内版(npm CLI)',
|
|
636
|
-
'codebuddy-intl': 'CodeBuddy 国际版(npm CLI · 国际面)',
|
|
637
|
-
'codebuddy-en': 'WorkBuddy 国际版(WorkBuddyAI 桌面 CLI)',
|
|
638
|
-
'workbuddy': 'WorkBuddy 国内版(桌面 CLI)'
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
const BACKEND_ALIASES = {
|
|
642
|
-
'workbuddy-en': 'codebuddy-en',
|
|
643
|
-
'workbuddy-ai': 'codebuddy-en',
|
|
644
|
-
'codebuddy-ioa': 'codebuddy-intl',
|
|
645
|
-
'codebuddy-international': 'codebuddy-intl',
|
|
646
|
-
'codebuddy-oversea': 'codebuddy-intl'
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
const DEFAULT_BACKEND = 'codebuddy'
|
|
650
|
-
|
|
651
|
-
const SETTINGS_KEYS = ['preferredBackend', 'defaultModel', 'codebuddyEnToken', 'endpointOverride']
|
|
652
|
-
|
|
653
584
|
// codebuddy-en 凭据的第三条通道:DSH 凭据库里可能已有的 workbuddy key(旧 core verbatim)。
|
|
654
585
|
|
|
655
586
|
// 离线/读不到描述文件时的回退静态表(真机按账号实测快照,2026-09)。
|
|
@@ -659,7 +590,7 @@ const SETTINGS_KEYS = ['preferredBackend', 'defaultModel', 'codebuddyEnToken', '
|
|
|
659
590
|
// • dynamic 沙箱形态:scripts/build.mjs 把该文件内联进同一作用域(模板顶部的
|
|
660
591
|
// 第三个占位标记),import 行被 stripModuleSyntax 剥掉,同名标识符天然可见。
|
|
661
592
|
// ⚠️ 本注释里绝不写出那个标记的字面量:build 做全局文本替换,注释中出现同样
|
|
662
|
-
// 会被替换成正文代码,把注释劈开 → 生成物语法崩。
|
|
593
|
+
// 会被替换成正文代码,把注释劈开 → 生成物语法崩。
|
|
663
594
|
function defineProvider (deps = {}) {
|
|
664
595
|
const env = deps.env || {}
|
|
665
596
|
let host = null // attach 后保存 hostOpts(preset/dynamic/MCP 形态宿主能力)
|
|
@@ -1073,16 +1004,25 @@ function defineProvider (deps = {}) {
|
|
|
1073
1004
|
defaults: () => normalizeSettings(null),
|
|
1074
1005
|
normalize: (raw) => normalizeSettings(raw),
|
|
1075
1006
|
meta() {
|
|
1076
|
-
// defaultModel 下拉 =
|
|
1077
|
-
//
|
|
1078
|
-
//
|
|
1079
|
-
//
|
|
1080
|
-
//
|
|
1081
|
-
//
|
|
1007
|
+
// defaultModel 下拉 = 账号级实时清单(服务端裁决)。走过的弯路留档:
|
|
1008
|
+
// ① 随包冻结的 product.ioa.json → 16 项、2 个 id 已改名(错)
|
|
1009
|
+
// ② CLI `--help` 的 "Currently supported:" → 18 项,但那是 CLI 构建期烙进去的,
|
|
1010
|
+
// 实测同样滞后(含已废弃的 minimax-m3/kimi-k3-1,缺 glm-5.3-flashx 等)
|
|
1011
|
+
// ③ 现在:用无效模型探测让服务端回「该账号当前支持」的 19 项 —— 唯一权威源。
|
|
1012
|
+
// 面板同步回调故用 spawnSync 探测并缓存 5 分钟;失败则下拉留空 + 明确提示,
|
|
1013
|
+
// 绝不展示已知错误的 roster。面跟随 preferredBackend(旧实现硬编码 codebuddy 面)。
|
|
1082
1014
|
const face = (currentPreferredBackend() && normalizeBackend(currentPreferredBackend())) || DEFAULT_BACKEND
|
|
1083
|
-
const
|
|
1015
|
+
const faceEnv = (() => {
|
|
1016
|
+
try {
|
|
1017
|
+
const s = deps.settings || {}
|
|
1018
|
+
const authDomain = readBackendAuthDomain(face, { env })
|
|
1019
|
+
const tok = resolveEnToken(face === 'codebuddy-en' ? s.codebuddyEnToken : null, { env })
|
|
1020
|
+
return endpointEnv(face, s.endpointOverride, authDomain, tok.token) || {}
|
|
1021
|
+
} catch (e) { return {} }
|
|
1022
|
+
})()
|
|
1023
|
+
const live = cachedCliModels(face, () => probeAccountModelsSync(env, { envExtra: faceEnv, timeoutMs: 12000 }))
|
|
1084
1024
|
let options = []
|
|
1085
|
-
let note = '
|
|
1025
|
+
let note = ''
|
|
1086
1026
|
if (live && live.ok && live.ids.length) {
|
|
1087
1027
|
const detail = modelCatalogDetailed(face, { env, accountModels: live.ids })
|
|
1088
1028
|
const byId = new Map(detail.map((x) => [x.id, x]))
|
|
@@ -1090,9 +1030,10 @@ function defineProvider (deps = {}) {
|
|
|
1090
1030
|
const d = byId.get(id)
|
|
1091
1031
|
return { value: id, label: (d && d.label) || id }
|
|
1092
1032
|
})
|
|
1093
|
-
note = '
|
|
1033
|
+
note = '账号实时清单(' + live.ids.length + ' 项,服务端裁决);当前面:' + face + '。日常任务优先免费(x0.00)。'
|
|
1094
1034
|
} else {
|
|
1095
|
-
note = '
|
|
1035
|
+
note = '未能读取该账号的模型清单(' + String((live && live.error) || 'unknown') +
|
|
1036
|
+
')。请确认该产品面已登录(在 codebuddy CLI 里完成登录),或手动输入模型 id。'
|
|
1096
1037
|
}
|
|
1097
1038
|
return {
|
|
1098
1039
|
titleSuffix: 'CodeBuddy',
|
|
@@ -1531,6 +1472,38 @@ const BACKEND_ENUM = ['codebuddy', 'codebuddy-intl', 'codebuddy-ioa', 'codebuddy
|
|
|
1531
1472
|
return { ok: false, ids: [], mode: 'cli-help', error: lastErr || 'codebuddy CLI not found (set CODEBUDDY_BIN)' }
|
|
1532
1473
|
}
|
|
1533
1474
|
|
|
1475
|
+
/**
|
|
1476
|
+
* 同步版的账号探测(供设置面板用 —— 面板必须同步返回)。
|
|
1477
|
+
* 走 spawnSync + 超时;结果进 5 分钟缓存,避免每次渲染都打一次网络。
|
|
1478
|
+
*
|
|
1479
|
+
* ⚠️ 为什么面板不能用 `--help` 名册顶替:实测本机 CLI 2.167.0 的 help 文本**本身
|
|
1480
|
+
* 就是过时的** —— 它列 18 项且含已不存在的 `minimax-m3` / `kimi-k3-1`,缺真实的
|
|
1481
|
+
* `glm-5.3-flashx` / `minimax-m3-pay` / `kimi-k3-2`;而账号探测给出 19 项且全部有效。
|
|
1482
|
+
* 也就是说「CLI 声明」≠「服务端实际可用」,拿它当兜底会直接把错误清单展示给用户。
|
|
1483
|
+
* 故这里宁可空列表 + 明确提示,也不展示已知错误的 roster。
|
|
1484
|
+
* @returns {{ok:boolean, ids:string[], mode:string, error?:string}}
|
|
1485
|
+
*/
|
|
1486
|
+
function probeAccountModelsSync(env, opts) {
|
|
1487
|
+
const o = opts || {}
|
|
1488
|
+
const cands = cbCatalogCliCandidates(env)
|
|
1489
|
+
const extraEnv = o.envExtra || {}
|
|
1490
|
+
const reasons = []
|
|
1491
|
+
const timeout = Math.max(3000, Math.min(o.timeoutMs || 12000, 30000))
|
|
1492
|
+
for (const exe of cands) {
|
|
1493
|
+
const r = cliSpawnSync(exe, ['-p', 'hi', '--model', '__clb_probe_invalid__', '--output-format', 'text'], {
|
|
1494
|
+
timeout,
|
|
1495
|
+
env: Object.assign({}, (globalThis.process && globalThis.process.env) || {}, extraEnv)
|
|
1496
|
+
})
|
|
1497
|
+
if (!r || r.error) { reasons.push(exe + ': ' + String((r && r.error && (r.error.code || r.error.message)) || 'spawn failed')); continue }
|
|
1498
|
+
const out = String(r.stdout || '') + String(r.stderr || '')
|
|
1499
|
+
const ids = parseAccountModels(out)
|
|
1500
|
+
if (ids && ids.length) return { ok: true, ids, mode: 'account-live', exe }
|
|
1501
|
+
const head = String(out).replace(/\s+/g, ' ').trim().slice(0, 140)
|
|
1502
|
+
reasons.push(exe + ': exit ' + r.status + ', no account roster' + (head ? ' — ' + head : ''))
|
|
1503
|
+
}
|
|
1504
|
+
return { ok: false, ids: [], mode: 'account-live', error: reasons.join('; ') || 'no CLI candidate to probe' }
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1534
1507
|
/**
|
|
1535
1508
|
* 异步探测「该账号当前支持」的清单:用无效模型触发 CLI 的 400 报文。
|
|
1536
1509
|
* 对齐 workbuddy-auth 的权威白名单语义(服务器告诉我们这个账号能用什么)。
|
|
@@ -1757,44 +1730,80 @@ const CREDENTIAL_KEYS = ['WORKBUDDY_TOKEN', 'WORKBUDDY_AI_TOKEN', 'CODEBUDDY_EN_
|
|
|
1757
1730
|
return { token: null, source: null }
|
|
1758
1731
|
}
|
|
1759
1732
|
|
|
1760
|
-
|
|
1761
|
-
//
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1733
|
+
|
|
1734
|
+
// ── inlined from providers/codebuddy-consts.mjs ──
|
|
1735
|
+
// providers/codebuddy-consts.mjs — codebuddy 的提示词策略与后端注册表常量(纯数据)。
|
|
1736
|
+
//
|
|
1737
|
+
// 从 providers/codebuddy.mjs 拆出,让主描述符留在 600 行红线内(规则 §26)。
|
|
1738
|
+
// build 会把 providers/codebuddy-*.mjs 全部内联进 dynamic 沙箱同一作用域。
|
|
1739
|
+
// 命名纪律:顶层名绝不与 core/bridge-kit.mjs 同名(同作用域重复声明 = 语法错)。
|
|
1740
|
+
// ⚠️ 注释里绝不写出口令标记字面量(build 全局替换会把注释劈开)。
|
|
1741
|
+
|
|
1742
|
+
// ── 提示词策略段(旧 preset POLICY_TEXT verbatim;systemPrompt order 5)────────
|
|
1743
|
+
const POLICY_TEXT = [
|
|
1744
|
+
'codebuddy-first execution policy (local codebuddy CLI bridge, with fallback + live indicator + live status tool).',
|
|
1745
|
+
'',
|
|
1746
|
+
'A local sub-agent CLI named "codebuddy" (Tencent CodeBuddy Code) is available through the codebuddy_run and codebuddy_continue tools. DSH fully controls codebuddy: every invocation runs non-interactively with permissions auto-approved (--permission-mode bypassPermissions), so codebuddy never prompts and DSH decides all of its work. A header status light shows when codebuddy is working — one light per project (working directory), so parallel runs in different projects are tracked separately; call codebuddy_status any time to see what codebuddy is doing right now (per project: current tool/step, recent trail, and cumulative usage).',
|
|
1747
|
+
'',
|
|
1748
|
+
'Priority rule for EVERY mode (normal, plan, accept-edits, subagent/workflow/ralph delegation, and goal rounds):',
|
|
1749
|
+
'- For any real work — implementing features, editing/refactoring code, debugging, running builds, or multi-file investigation — prefer dispatching the task to codebuddy_run FIRST with a complete, self-contained prompt.',
|
|
1750
|
+
'- Use native read/write/shell tools mainly for quick read-only lookups and for the final build/test verification of what codebuddy produced.',
|
|
1751
|
+
'- In plan mode, call codebuddy_run with mode=auto (or mode=plan); in accept-edits/normal mode codebuddy_run applies edits directly.',
|
|
1752
|
+
'- When you delegate to a DSH subagent or workflow, instruct that delegate to also prefer codebuddy_run.',
|
|
1753
|
+
'- For long-running tasks, call codebuddy_run with background=true and collect the result with job_output; use codebuddy_status to watch progress.',
|
|
1754
|
+
'',
|
|
1755
|
+
'Fallback protocol: when codebuddy is rate-limited or the network is down, codebuddy_run/codebuddy_continue automatically pop a confirmation dialog asking the user whether to use the DSH local API config. If the returned result has fallback=true (status FALLBACK_TO_DSH), the user chose to fall back: complete the task with native DSH tools / the local model and DO NOT call codebuddy again for this task. If ok=false without fallback, report the codebuddy error. Never loop codebuddy calls; never ask codebuddy to call back into DSH.',
|
|
1756
|
+
'',
|
|
1757
|
+
'Model selection: codebuddy_run takes an optional model. When unspecified, the CLI default applies unless the user set a preferred default model in the plugin settings (then that is injected automatically per call). Which models ACTUALLY WORK depends on the ACCOUNT, and the authoritative live list comes from the server: running the CLI with a nonexistent model returns 400 followed by "Currently supported models for your account:" and one "- <id>" per line (core exposes parseAccountModels for this; the plugin caches the result automatically and the settings panel shows exactly those ids, with the credit multiplier of each). Do NOT trust the bundled product descriptor as a menu of usable models: it lists ids with an "-ioa" suffix (glm-5.3-ioa) and expensive flagships (claude-opus-4.8, gpt-5.4, gpt-6-astra) that are present in the catalogue but NOT licensed for this account, and picking one fails with 400 "only available for authorized users". The four backends are also not one pool: "codebuddy" and "codebuddy-intl" are the npm CLI and offer its catalogue - including the free tier (hy3 and deepseek-v4.1-flash cost x0.00 credits; hy4-preview costs x0.29 but is frequently free on promotional accounts); "codebuddy-en" (WorkBuddyAI) has its OWN catalogue which does NOT contain hy4-preview or deepseek-v4.1-flash - it offers hy3 (free), gpt-5.1-codex-mini, gemini-3.1-flash-lite, gemini-2.5-flash, minimax-m3, gemini-3.0-flash, deepseek-v3-2-volc, kimi-k2.5/2.6, glm-5.0/5.2/5.3, gpt-5.3-codex, gpt-5.4/5.5, gpt-5.6-sol/terra/luna and the role aliases (fast/balanced/primary/deep-model); "workbuddy" (domestic desktop) has a further catalogue (auto, hy4-preview, hy3, deepseek-v4.1-flash, glm-5.x, kimi-k2.6/2.7/2.8-preview/k3-1, minimax-m3/m2.7, deepseek-v4-pro). Within a face availability is still gated per ACCOUNT: an id outside the account catalogue fails with "400 model [...] service info not found", and one inside it but unlicensed fails with "400 model [...] is only available for authorized users". International ids (claude-sonnet-5, claude-opus-5, gemini-3.1-pro, ...) are per-account gated and return the latter for a domestic account. COST: every id carries a credit multiplier in the credits field of its descriptor (x0.00 means free, x3.31 means 3.31x the base rate); the settings panel shows each candidate with its multiplier and reads it live from the CLI descriptor, so it stays in sync when the CLI is upgraded. Measured free (x0.00) models for this account: hy3 and deepseek-v4.1-flash (both npm faces) and hy3 for WorkBuddyAI; hy4-preview is x0.29 on npm faces. Prefer the cheapest model that can do the job and use a free one for routine work; do not silently upgrade to an expensive id when the task is simple. To get the exact live list for a CLI, run it with a deliberately invalid model id - the reply prints "Currently supported models for your account:" followed by one "- <id>" per line (core exposes parseAccountModels for this). Pass a model only when the task clearly benefits from a specific one; the default is usually right. Optional effort: minimal/low/medium/high/xhigh/max. Optional maxTurns caps agentic turns (default unlimited).',
|
|
1758
|
+
'',
|
|
1759
|
+
'Backends: codebuddy_run/codebuddy_continue take an optional backend parameter choosing which CLI face of the same engine (Tencent CodeBuddy Code) runs the task. "codebuddy" is the domestic CodeBuddy (npm CLI @tencent-ai/codebuddy-code, product endpoint www.codebuddy.ai) — default for coding work. "codebuddy-intl" is the INTERNATIONAL face of that SAME npm CLI (product.ioa.json catalogue: claude-sonnet-5, claude-opus-5, gemini-3.1-pro, gpt-6-astra, hy3-ioa …); use it when the account is an international CodeBuddy account. Its aliases "codebuddy-ioa" and "codebuddy-international" are accepted and normalized to codebuddy-intl. "codebuddy-en" is the WorkBuddy INTERNATIONAL edition — the CLI bundled with the WorkBuddyAI desktop app (C:\\Program Files\\WorkBuddyAI, product endpoint www.workbuddy.ai); the aliases "workbuddy-en" and "workbuddy-ai" are also accepted and normalized to codebuddy-en. "workbuddy" is the CLI bundled with the domestic WorkBuddy desktop app (product endpoint copilot.tencent.com, zero config) — the office-scenario face: documents, slides, spreadsheets, knowledge-base lookups, image/video generation, WeChat/WeCom replies. When the user asks for office/document/IM work, dispatch with backend="workbuddy"; for international accounts use "codebuddy-intl" (CodeBuddy 国际版) or "codebuddy-en" (WorkBuddy 国际版 / WorkBuddyAI). Sessions are kept per backend (login domains are exclusive), and continuing a session automatically routes back to the backend that owns it (explicit backend wins). A user-preferred default backend (plugin settings) applies when a call is new (no session) and no explicit backend is given.'
|
|
1760
|
+
].join('\n')
|
|
1761
|
+
|
|
1762
|
+
// ── 限流/网络/认证失败判定(旧 core verbatim)。仅匹配 stderr + status;数字码
|
|
1763
|
+
// 加词边界(避免 "1500" 命中 500、"4013" 命中 401)。中文码(流量/受限/金额/
|
|
1764
|
+
// 余额/额度/认证/连接/断开 等)为 codebuddy 面专属,必须逐字保留。
|
|
1765
|
+
// 命名纪律(mimo 同款):本文件顶层名绝不与 core/bridge-kit.mjs 顶层导出同名 ——
|
|
1766
|
+
// dynamic 形态把 kit 与 provider 内联进同一脚本作用域,同名 const 直接炸语法
|
|
1767
|
+
|
|
1768
|
+
// ── 后端注册表(旧 core verbatim:端点按登录域自动对齐)───────────────────────
|
|
1769
|
+
const CODEBUDDY_LIMIT_RE = /rate.?limit|ratelimit|\b429\b|too many|quota|insufficient|credit|balance|exhausted|exceed|\bnetwork\b|offline|ENETUNREACH|ECONNREFUSED|ECONNRESET|ETIMEDOUT|EAI_AGAIN|ENOTFOUND|\btimeouts?\b|timed out|unavailable|\b50[023]\b|\b40[13]\b|unauthorized|invalid api|api key|proxy|socket|tls|ssl|\bdns\b|网络|超时|限流|流量|受限|配额|金额|余额|额度|认证|连接|断开/i
|
|
1770
|
+
|
|
1771
|
+
// ── 后端注册表(旧 core verbatim:端点按登录域自动对齐)───────────────────────
|
|
1772
|
+
const BACKENDS = ['codebuddy', 'codebuddy-intl', 'codebuddy-en', 'workbuddy']
|
|
1773
|
+
|
|
1774
|
+
const BACKEND_ENDPOINTS = {
|
|
1775
|
+
'codebuddy': 'https://www.codebuddy.ai/v2',
|
|
1776
|
+
'codebuddy-intl': 'https://www.codebuddy.ai/v2',
|
|
1777
|
+
'codebuddy-en': 'https://www.workbuddy.ai/v2',
|
|
1778
|
+
'workbuddy': 'https://copilot.tencent.com/v2'
|
|
1778
1779
|
}
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
sessionId: { type: 'string', description: 'codebuddy session id to resume (from a prior codebuddy_run result).' },
|
|
1786
|
-
latest: { type: 'boolean', description: 'Continue the most recent codebuddy conversation instead of a specific id.' },
|
|
1787
|
-
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).' },
|
|
1788
|
-
mode: { type: 'string', enum: ['auto', 'plan', 'accept-edits'], description: 'Execution mode; default auto.' },
|
|
1789
|
-
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).' },
|
|
1790
|
-
effort: { type: 'string', enum: ['minimal', 'low', 'medium', 'high', 'xhigh', 'max'], description: 'Optional reasoning effort.' },
|
|
1791
|
-
maxTurns: { type: 'integer', description: 'Optional max agentic turns.' },
|
|
1792
|
-
cwd: { type: 'string', description: "Working directory for codebuddy; when resuming, defaults to the resumed session's project directory." },
|
|
1793
|
-
timeoutSec: { type: 'integer', description: 'Run timeout seconds (10-3600, default 300); a DSH-side hang guard force-terminates at timeout+60s.' },
|
|
1794
|
-
background: { type: 'boolean', description: 'Run as a background job and return a jobId immediately.' }
|
|
1795
|
-
}
|
|
1780
|
+
|
|
1781
|
+
const AUTH_DOMAIN_ENDPOINTS = {
|
|
1782
|
+
'www.codebuddy.cn': 'https://www.codebuddy.cn/v2',
|
|
1783
|
+
'www.codebuddy.ai': 'https://www.codebuddy.ai/v2',
|
|
1784
|
+
'www.workbuddy.ai': 'https://www.workbuddy.ai/v2',
|
|
1785
|
+
'copilot.tencent.com': 'https://copilot.tencent.com/v2'
|
|
1796
1786
|
}
|
|
1797
|
-
|
|
1787
|
+
|
|
1788
|
+
const BACKEND_LABELS = {
|
|
1789
|
+
'codebuddy': 'CodeBuddy 国内版(npm CLI)',
|
|
1790
|
+
'codebuddy-intl': 'CodeBuddy 国际版(npm CLI · 国际面)',
|
|
1791
|
+
'codebuddy-en': 'WorkBuddy 国际版(WorkBuddyAI 桌面 CLI)',
|
|
1792
|
+
'workbuddy': 'WorkBuddy 国内版(桌面 CLI)'
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
const BACKEND_ALIASES = {
|
|
1796
|
+
'workbuddy-en': 'codebuddy-en',
|
|
1797
|
+
'workbuddy-ai': 'codebuddy-en',
|
|
1798
|
+
'codebuddy-ioa': 'codebuddy-intl',
|
|
1799
|
+
'codebuddy-international': 'codebuddy-intl',
|
|
1800
|
+
'codebuddy-oversea': 'codebuddy-intl'
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
const DEFAULT_BACKEND = 'codebuddy'
|
|
1804
|
+
|
|
1805
|
+
const SETTINGS_KEYS = ['preferredBackend', 'defaultModel', 'codebuddyEnToken', 'endpointOverride']
|
|
1806
|
+
|
|
1798
1807
|
|
|
1799
1808
|
// ── inlined from providers/codebuddy-models-tool.mjs ──
|
|
1800
1809
|
// providers/codebuddy-models-tool.mjs — codebuddy_models 工具定义(纯逻辑)。
|
|
@@ -1833,10 +1842,9 @@ function codebuddyModelsTool(ctx) {
|
|
|
1833
1842
|
lines.push(' ' + m.id + (m.creditLabel ? ' ' + m.creditLabel : '') + (flags.length ? ' [' + flags.join(',') + ']' : ''))
|
|
1834
1843
|
}
|
|
1835
1844
|
if (list.length > 40) lines.push(' … and ' + (list.length - 40) + ' more')
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
lines.push('source: ' + srcLabel)
|
|
1845
|
+
// 只有一种来源:账号实时(服务端裁决)。不再有 cli-help 兜底分支,
|
|
1846
|
+
// 因为 CLI 的 --help 名册实测会滞后服务端并含已废弃 id。
|
|
1847
|
+
lines.push('source: account-live (authoritative for this account)')
|
|
1840
1848
|
if (v.note) lines.push('note: ' + v.note)
|
|
1841
1849
|
return [{ type: 'text', text: lines.join('\n') }]
|
|
1842
1850
|
},
|
|
@@ -1850,30 +1858,31 @@ function codebuddyModelsTool(ctx) {
|
|
|
1850
1858
|
// 绝不把静态表冒充成账号可用清单。
|
|
1851
1859
|
const extraEnv = (c.faceEnv && c.faceEnv(backend)) || {}
|
|
1852
1860
|
const probe = await probeAccountModels(env, { envExtra: extraEnv, timeoutMs: a.timeoutMs })
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
if (!ids || !ids.length) {
|
|
1861
|
+
|
|
1862
|
+
// 唯一权威源 = 账号探测(服务端裁决)。**不再回落 CLI `--help` 名册**:
|
|
1863
|
+
// 实测 CLI 2.167.0 的 help 文本本身就过时(18 项、含已废弃的 minimax-m3 /
|
|
1864
|
+
// kimi-k3-1、缺 3 个真实模型),拿它兜底等于把错误清单当结果交付。
|
|
1865
|
+
// 探测失败就明确失败,并附上「CLI 声明了 N 项」作为诊断线索(只作提示,不展示
|
|
1866
|
+
// 那些 id),符合红线:开发期禁止静默降级。
|
|
1867
|
+
if (!probe.ok || !probe.ids || !probe.ids.length) {
|
|
1868
|
+
let hint = ''
|
|
1869
|
+
try {
|
|
1870
|
+
const help = fetchHelpModelsSync(env, { timeoutMs: a.timeoutMs })
|
|
1871
|
+
if (help.ok && help.ids.length) {
|
|
1872
|
+
hint = ' The installed CLI declares ' + help.ids.length + ' models via --help, but that roster is a static ' +
|
|
1873
|
+
'build-time list and has been observed to lag the server (it can contain retired ids). It is NOT shown here ' +
|
|
1874
|
+
'because it is not authoritative for this account.'
|
|
1875
|
+
}
|
|
1876
|
+
} catch (e) { }
|
|
1870
1877
|
return {
|
|
1871
1878
|
ok: false, backend,
|
|
1872
|
-
error: 'no
|
|
1873
|
-
'
|
|
1874
|
-
'
|
|
1879
|
+
error: 'no account model roster for backend "' + backend + '": ' + String(probe.error || 'probe failed') +
|
|
1880
|
+
'. Make sure this product face is logged in (run the codebuddy CLI and complete login), or set CODEBUDDY_BIN ' +
|
|
1881
|
+
'to the right executable, then retry.' + hint
|
|
1875
1882
|
}
|
|
1876
1883
|
}
|
|
1884
|
+
const ids = probe.ids
|
|
1885
|
+
const source = 'account-live'
|
|
1877
1886
|
|
|
1878
1887
|
// ③ 倍率/授权元数据(来自描述文件;仅作标注,不参与「是否可用」判定)。
|
|
1879
1888
|
let detail = []
|
|
@@ -1893,7 +1902,7 @@ function codebuddyModelsTool(ctx) {
|
|
|
1893
1902
|
if (a.freeOnly) list = list.filter((m) => m.credits === 0)
|
|
1894
1903
|
return {
|
|
1895
1904
|
ok: true, backend, models: list, count: list.length,
|
|
1896
|
-
source, note: note
|
|
1905
|
+
source, note: (typeof note !== 'undefined' ? note : undefined),
|
|
1897
1906
|
probedAt: Date.now()
|
|
1898
1907
|
}
|
|
1899
1908
|
}
|
|
@@ -1901,6 +1910,51 @@ function codebuddyModelsTool(ctx) {
|
|
|
1901
1910
|
}
|
|
1902
1911
|
|
|
1903
1912
|
|
|
1913
|
+
// ── inlined from providers/codebuddy-schemas.mjs ──
|
|
1914
|
+
// providers/codebuddy-schemas.mjs — 三工具 JSON Schema(纯数据,零依赖)。
|
|
1915
|
+
//
|
|
1916
|
+
// 旧 preset/codebuddy-first verbatim(契约 §8 红线):字段名/枚举/描述一字不改。
|
|
1917
|
+
// 放这里是为了让 catalog 与主描述符都留在 600 行红线内(规则 §26)。
|
|
1918
|
+
// ⚠️ 注释里绝不写出口令标记字面量(build 全局替换会把注释劈开)。
|
|
1919
|
+
// ── 三工具 schema(旧 preset/codebuddy-first verbatim;契约 §8 红线)────────────
|
|
1920
|
+
// 纯数据,无依赖 —— 放这里是为了让主描述符留在 600 行红线内(规则 §26)。
|
|
1921
|
+
const RUN_PARAMS = {
|
|
1922
|
+
type: 'object',
|
|
1923
|
+
additionalProperties: false,
|
|
1924
|
+
required: ['prompt'],
|
|
1925
|
+
properties: {
|
|
1926
|
+
prompt: { type: 'string', description: 'The full task/instruction for codebuddy. Be complete and self-contained.' },
|
|
1927
|
+
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.' },
|
|
1928
|
+
mode: { type: 'string', enum: ['auto', 'plan', 'accept-edits'], description: 'auto follows DSH plan state; plan = no writes; accept-edits = allow edits. Default auto.' },
|
|
1929
|
+
model: { type: 'string', description: MODEL_DESCRIPTION },
|
|
1930
|
+
effort: { type: 'string', enum: ['minimal', 'low', 'medium', 'high', 'xhigh', 'max'], description: 'Optional reasoning effort.' },
|
|
1931
|
+
maxTurns: { type: 'integer', description: 'Optional max agentic turns (1-500, default unlimited).' },
|
|
1932
|
+
cwd: { type: 'string', description: 'Working directory for codebuddy. Defaults to the DSH workspace root.' },
|
|
1933
|
+
addDirs: { type: 'array', items: { type: 'string' }, description: 'Extra directories to add to codebuddy workspace.' },
|
|
1934
|
+
timeoutSec: { type: 'integer', description: 'Run timeout seconds (10-3600, default 300); a DSH-side hang guard force-terminates at timeout+60s.' },
|
|
1935
|
+
background: { type: 'boolean', description: 'Run as a background job and return a jobId immediately.' }
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
const CONTINUE_PARAMS = {
|
|
1939
|
+
type: 'object',
|
|
1940
|
+
additionalProperties: false,
|
|
1941
|
+
required: ['prompt'],
|
|
1942
|
+
properties: {
|
|
1943
|
+
prompt: { type: 'string', description: 'Follow-up instruction for the ongoing codebuddy conversation.' },
|
|
1944
|
+
sessionId: { type: 'string', description: 'codebuddy session id to resume (from a prior codebuddy_run result).' },
|
|
1945
|
+
latest: { type: 'boolean', description: 'Continue the most recent codebuddy conversation instead of a specific id.' },
|
|
1946
|
+
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).' },
|
|
1947
|
+
mode: { type: 'string', enum: ['auto', 'plan', 'accept-edits'], description: 'Execution mode; default auto.' },
|
|
1948
|
+
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).' },
|
|
1949
|
+
effort: { type: 'string', enum: ['minimal', 'low', 'medium', 'high', 'xhigh', 'max'], description: 'Optional reasoning effort.' },
|
|
1950
|
+
maxTurns: { type: 'integer', description: 'Optional max agentic turns.' },
|
|
1951
|
+
cwd: { type: 'string', description: "Working directory for codebuddy; when resuming, defaults to the resumed session's project directory." },
|
|
1952
|
+
timeoutSec: { type: 'integer', description: 'Run timeout seconds (10-3600, default 300); a DSH-side hang guard force-terminates at timeout+60s.' },
|
|
1953
|
+
background: { type: 'boolean', description: 'Run as a background job and return a jobId immediately.' }
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
const STATUS_PARAMS = { type: 'object', additionalProperties: false, required: [], properties: { cwd: { type: 'string', description: 'Optional: filter the snapshot to a single project (working directory).' } } }
|
|
1957
|
+
|
|
1904
1958
|
// core/scheduling.mjs — CLI 调度(启用集合 + 调用优先级)单源纯逻辑。
|
|
1905
1959
|
//
|
|
1906
1960
|
// 语义(用户可见的两件事):
|