@luchenglong/cli-bridge 0.2.7 → 0.2.9
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 +97 -0
- package/PROVIDER-CONTRACT.md +53 -4
- package/README.md +12 -11
- 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/agy.host.js +1 -1
- package/dynamic/claude.host.js +1801 -0
- package/dynamic/claude.host.template.mjs +108 -0
- package/dynamic/codebuddy.host.js +1 -1
- package/dynamic/codex.host.js +1955 -0
- package/dynamic/codex.host.template.mjs +137 -0
- package/dynamic/mimo.host.js +1 -1
- package/dynamic/opencode.host.js +1 -1
- package/home-plugin/cli-bridge-indicator/lib/client.js +600 -606
- package/home-plugin/cli-bridge-indicator/lib/preset-declarations.mjs +87 -9
- package/mcp/cli-bridge-mcp.mjs +6 -4
- package/mcp/providers/claude.mjs +231 -0
- package/mcp/providers/codex.mjs +239 -0
- package/package.json +10 -6
- package/preset/agy-first/agent.cordis.yml +0 -5
- package/preset/agy-first/plugin-list.mjs +4 -1
- 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/codebuddy-first/agent.cordis.yml +0 -5
- 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/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/claude-exe.mjs +112 -0
- package/providers/claude-models.mjs +334 -0
- package/providers/claude-policy.mjs +37 -0
- package/providers/claude.mjs +508 -0
- package/providers/codex-cli.mjs +471 -0
- package/providers/codex-models.mjs +107 -0
- package/providers/codex.mjs +544 -0
- package/providers/registry.mjs +25 -1
- package/scripts/build.mjs +1 -2
- package/scripts/verify.mjs +8 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luchenglong/cli-bridge",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "CLI Bridge for DeepSeek Harness (DSH): one package bridging
|
|
3
|
+
"version": "0.2.9",
|
|
4
|
+
"description": "CLI Bridge for DeepSeek Harness (DSH): one package bridging six local coding-CLI agents — agy (Google Antigravity CLI), Tencent CodeBuddy Code, Xiaomi MiMo (MiMoCode), OpenCode, Claude Code, and OpenAI Codex CLI. Each provider keeps its own agent preset (cordis-agy / codebuddy-first / cordis-mimo / opencode-first / claude-first / codex-first), tools (<id>_run / <id>_continue / <id>_status, plus per-provider model listing), rate-limit/network fallback dialog, and zero-dependency MCP server, unified under a single home-level status light, one settings file, and one bundle patch. Merges agy-first-bridge, codebuddy-first-bridge and mimo-first-bridge.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -20,10 +20,14 @@
|
|
|
20
20
|
"./providers/codebuddy": "./providers/codebuddy.mjs",
|
|
21
21
|
"./providers/mimo": "./providers/mimo.mjs",
|
|
22
22
|
"./providers/opencode": "./providers/opencode.mjs",
|
|
23
|
+
"./providers/claude": "./providers/claude.mjs",
|
|
24
|
+
"./providers/codex": "./providers/codex.mjs",
|
|
23
25
|
"./preset-agy": "./preset/agy-first/cli-bridge.mjs",
|
|
24
26
|
"./preset-codebuddy": "./preset/codebuddy-first/cli-bridge.mjs",
|
|
25
27
|
"./preset-mimo": "./preset/mimo-first/cli-bridge.mjs",
|
|
26
28
|
"./preset-opencode": "./preset/opencode-first/cli-bridge.mjs",
|
|
29
|
+
"./preset-claude": "./preset/claude-first/cli-bridge.mjs",
|
|
30
|
+
"./preset-codex": "./preset/codex-first/cli-bridge.mjs",
|
|
27
31
|
"./package.json": "./package.json"
|
|
28
32
|
},
|
|
29
33
|
"dsh": {
|
|
@@ -89,7 +93,7 @@
|
|
|
89
93
|
"url": "https://github.com/new-256/cli-bridge/issues"
|
|
90
94
|
}
|
|
91
95
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
- id: persona
|
|
5
5
|
name: '@deepseek-ai/dsh-persona'
|
|
6
6
|
config:
|
|
7
|
-
suffix: 'Your working directory is {{cwd}}.'
|
|
8
7
|
prefix: 'You are a coding agent powered by the {{model}} model.'
|
|
9
8
|
- id: agent-instructions
|
|
10
9
|
name: '@deepseek-ai/dsh-agent-instructions'
|
|
@@ -86,20 +85,17 @@
|
|
|
86
85
|
provider: spawn
|
|
87
86
|
toolName: subagent
|
|
88
87
|
modelSelectionSettings: true
|
|
89
|
-
backgroundMode: continuable
|
|
90
88
|
- id: tool-subagent-fork
|
|
91
89
|
name: '@deepseek-ai/dsh-tool-subagent'
|
|
92
90
|
config:
|
|
93
91
|
provider: fork
|
|
94
92
|
toolName: subagent_fork
|
|
95
|
-
backgroundMode: continuable
|
|
96
93
|
- id: tool-subagent-codex
|
|
97
94
|
name: '@deepseek-ai/dsh-tool-subagent'
|
|
98
95
|
disabled: true
|
|
99
96
|
config:
|
|
100
97
|
provider: codex
|
|
101
98
|
toolName: subagent_codex
|
|
102
|
-
backgroundMode: one-shot
|
|
103
99
|
maxDepth: provider-managed
|
|
104
100
|
- id: tool-subagent-claude-code
|
|
105
101
|
name: '@deepseek-ai/dsh-tool-subagent'
|
|
@@ -107,7 +103,6 @@
|
|
|
107
103
|
config:
|
|
108
104
|
provider: claude-code
|
|
109
105
|
toolName: subagent_claude_code
|
|
110
|
-
backgroundMode: one-shot
|
|
111
106
|
maxDepth: provider-managed
|
|
112
107
|
- id: workflow-ptc
|
|
113
108
|
name: '@deepseek-ai/dsh-workflow-ptc'
|
|
@@ -16,10 +16,13 @@ export function buildPlugins(deps) {
|
|
|
16
16
|
const rows = standardPluginRows()
|
|
17
17
|
// 旧仓 agent.cordis.yml persona 段 verbatim(v1.5.15:dsh-persona 要求
|
|
18
18
|
// prefix 必填 + suffix 可选;旧单 text: 字段被 schema 拒绝)。
|
|
19
|
+
// 2026-10-18:不再设置 suffix —— 当前 DSH 只注册 provider/model 两个提示词变量,
|
|
20
|
+
// 工作目录由 working-directory 服务作为不插值的用户上下文提供,写 {{cwd}} 会让
|
|
21
|
+
// 本预设整轮组装失败(unknown prompt variable)。delete 兼防基座再引入 suffix。
|
|
19
22
|
const persona = rows.find((r) => r.id === 'persona')
|
|
20
23
|
if (persona && persona.config) {
|
|
21
24
|
persona.config.prefix = 'You are a coding agent powered by the {{model}} model.'
|
|
22
|
-
persona.config.suffix
|
|
25
|
+
delete persona.config.suffix
|
|
23
26
|
}
|
|
24
27
|
rows.push(bridgeRow('agy', deps && deps.bridgeName))
|
|
25
28
|
return rows
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# 生成物 — 由 node scripts/build.mjs 从 preset/claude-first/plugin-list.mjs 生成,勿手改。
|
|
2
|
+
# legacy 目录形态($DSH_HOME/.agent-presets/claude-first/);新 DSH 走声明制
|
|
3
|
+
# (home-plugin/cli-bridge-indicator/lib/preset-declarations.mjs 直接 import 同一源)。
|
|
4
|
+
- id: persona
|
|
5
|
+
name: '@deepseek-ai/dsh-persona'
|
|
6
|
+
config:
|
|
7
|
+
prefix: 'You are a coding agent powered by the {{model}} model.'
|
|
8
|
+
- id: agent-instructions
|
|
9
|
+
name: '@deepseek-ai/dsh-agent-instructions'
|
|
10
|
+
config:
|
|
11
|
+
maxBytes: 65536
|
|
12
|
+
- id: tool-bash
|
|
13
|
+
name: '@deepseek-ai/dsh-tool-bash'
|
|
14
|
+
disabled: !!js 'process.platform === ''win32'''
|
|
15
|
+
- id: tool-pwsh
|
|
16
|
+
name: '@deepseek-ai/dsh-tool-pwsh'
|
|
17
|
+
disabled: !!js 'process.platform !== ''win32'''
|
|
18
|
+
- id: tool-fs
|
|
19
|
+
name: '@deepseek-ai/dsh-tool-fs'
|
|
20
|
+
- id: tool-fs-search
|
|
21
|
+
name: '@deepseek-ai/dsh-tool-fs-search'
|
|
22
|
+
config:
|
|
23
|
+
sampleOverCapGlobResults: false
|
|
24
|
+
- id: tool-jobs
|
|
25
|
+
name: '@deepseek-ai/dsh-tool-jobs'
|
|
26
|
+
- id: skill-filesystem
|
|
27
|
+
name: '@deepseek-ai/dsh-skill-filesystem'
|
|
28
|
+
- id: tool-skill
|
|
29
|
+
name: '@deepseek-ai/dsh-tool-skill'
|
|
30
|
+
- id: command-goal
|
|
31
|
+
name: '@deepseek-ai/dsh-command-goal'
|
|
32
|
+
- id: tool-goal
|
|
33
|
+
name: '@deepseek-ai/dsh-tool-goal'
|
|
34
|
+
- id: planning
|
|
35
|
+
name: 'cordis:group'
|
|
36
|
+
group: true
|
|
37
|
+
isolate:
|
|
38
|
+
planMode: true
|
|
39
|
+
config:
|
|
40
|
+
- id: plan-mode
|
|
41
|
+
name: '@deepseek-ai/dsh-plan-mode'
|
|
42
|
+
config:
|
|
43
|
+
section: |
|
|
44
|
+
You are in plan mode. Stay in plan mode until exit_plan_mode succeeds or the user switches the session mode. Imperative language to implement changes means plan the implementation, not execute it. A user's conversational agreement — including an answer confirming something you asked — approves nothing and does not end plan mode; fold the confirmed decision into the plan and submit it through exit_plan_mode.
|
|
45
|
+
|
|
46
|
+
Explore first. Use non-mutating reads, searches, static analysis, and checks to ground the plan in the actual repository. Do not edit or write files, change configuration, run formatters or code generation that rewrites tracked files, commit, or otherwise carry out the plan. Prefer existing functions and patterns over new machinery.
|
|
47
|
+
|
|
48
|
+
The tool catalog stays the same across modes for request-cache stability. These plan-mode rules override any later tool description or guidance that suggests using mutation tools; those tools remain listed to keep the tool catalog unchanged. Do not use todo_write to track this planning phase: it tracks implementation after an approved plan, while the plan itself belongs in exit_plan_mode.
|
|
49
|
+
|
|
50
|
+
Resolve discoverable facts by inspection. Use ask_user_question only for user-owned choices or material ambiguity that inspection cannot answer. Do not ask the user where code lives or how current behavior works when you can find out.
|
|
51
|
+
|
|
52
|
+
Make the plan decision-complete: state the goal and success criteria; group implementation changes by subsystem; identify public API, schema, and data-flow changes; cover edge cases, failure modes, tests, acceptance criteria, and explicit assumptions. Keep it concise enough to review but detailed enough that another engineer can implement it without making design decisions.
|
|
53
|
+
|
|
54
|
+
When ready, call exit_plan_mode with the complete plan markdown, starting with a # title. Make exit_plan_mode the only and final tool call in that assistant response: it presents the plan for approval, and implementation begins only in a later step after approval. Do not paste the final plan as a plain reply or ask "should I proceed?" through prose or ask_user_question. If review rejects it, incorporate the feedback and present again. If the review channel is unavailable or aborted, stay in plan mode and ask the user to switch modes manually; do not proceed with implementation.
|
|
55
|
+
- id: compaction
|
|
56
|
+
name: 'cordis:group'
|
|
57
|
+
group: true
|
|
58
|
+
isolate:
|
|
59
|
+
compaction: true
|
|
60
|
+
toolResultPruner: true
|
|
61
|
+
config:
|
|
62
|
+
- id: compaction-basic
|
|
63
|
+
name: '@deepseek-ai/dsh-compaction-basic'
|
|
64
|
+
- id: command-compact
|
|
65
|
+
name: '@deepseek-ai/dsh-command-compact'
|
|
66
|
+
- id: tool-result-pruner
|
|
67
|
+
name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
|
|
68
|
+
config:
|
|
69
|
+
thresholdChars: 8192
|
|
70
|
+
headChars: 4096
|
|
71
|
+
tailChars: 1024
|
|
72
|
+
- id: delegation
|
|
73
|
+
name: 'cordis:group'
|
|
74
|
+
group: true
|
|
75
|
+
isolate:
|
|
76
|
+
workflowEngine: true
|
|
77
|
+
config:
|
|
78
|
+
- id: tool-subagent-control
|
|
79
|
+
name: '@deepseek-ai/dsh-tool-subagent-control'
|
|
80
|
+
- id: tool-subagent-list-agents
|
|
81
|
+
name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
|
|
82
|
+
- id: tool-subagent
|
|
83
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
84
|
+
config:
|
|
85
|
+
provider: spawn
|
|
86
|
+
toolName: subagent
|
|
87
|
+
modelSelectionSettings: true
|
|
88
|
+
- id: tool-subagent-fork
|
|
89
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
90
|
+
config:
|
|
91
|
+
provider: fork
|
|
92
|
+
toolName: subagent_fork
|
|
93
|
+
- id: tool-subagent-codex
|
|
94
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
95
|
+
disabled: true
|
|
96
|
+
config:
|
|
97
|
+
provider: codex
|
|
98
|
+
toolName: subagent_codex
|
|
99
|
+
maxDepth: provider-managed
|
|
100
|
+
- id: tool-subagent-claude-code
|
|
101
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
102
|
+
disabled: true
|
|
103
|
+
config:
|
|
104
|
+
provider: claude-code
|
|
105
|
+
toolName: subagent_claude_code
|
|
106
|
+
maxDepth: provider-managed
|
|
107
|
+
- id: workflow-ptc
|
|
108
|
+
name: '@deepseek-ai/dsh-workflow-ptc'
|
|
109
|
+
config:
|
|
110
|
+
provider: spawn
|
|
111
|
+
- id: tool-workflow
|
|
112
|
+
name: '@deepseek-ai/dsh-tool-workflow'
|
|
113
|
+
- id: tool-ralph
|
|
114
|
+
name: '@deepseek-ai/dsh-tool-ralph'
|
|
115
|
+
disabled: true
|
|
116
|
+
config:
|
|
117
|
+
subagentProvider: spawn
|
|
118
|
+
maxRounds: 64
|
|
119
|
+
- id: tool-ask-user
|
|
120
|
+
name: '@deepseek-ai/dsh-tool-ask-user'
|
|
121
|
+
- id: tool-todo
|
|
122
|
+
name: '@deepseek-ai/dsh-tool-todo'
|
|
123
|
+
config:
|
|
124
|
+
allowParallelInProgress: true
|
|
125
|
+
- id: tool-web
|
|
126
|
+
name: '@deepseek-ai/dsh-tool-web'
|
|
127
|
+
config:
|
|
128
|
+
fetch: true
|
|
129
|
+
searchTimeoutMs: 60000
|
|
130
|
+
- id: present
|
|
131
|
+
name: '@deepseek-ai/dsh-tool-present'
|
|
132
|
+
- id: tool-plugin-manager
|
|
133
|
+
name: '@deepseek-ai/dsh-plugin-manager/tools'
|
|
134
|
+
disabled: true
|
|
135
|
+
- id: cli-bridge-claude
|
|
136
|
+
name: '@luchenglong/cli-bridge/preset-claude'
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// preset/claude-first/cli-bridge.mjs — claude-first preset 的桥接插件(preset 宿主形态)。
|
|
2
|
+
//
|
|
3
|
+
// PROVIDER-CONTRACT.md §5:本模块只做「宿主接线」——构造描述符、attach、注册三工具 +
|
|
4
|
+
// claude_models、心跳/事件发布、claude:policy 提示词段。全部执行/状态语义在
|
|
5
|
+
// providers/claude.mjs + core/bridge-kit.mjs。
|
|
6
|
+
//
|
|
7
|
+
// preset id 'claude-first' 由 plugin-list.mjs 单源声明(本文件不含 id 字面量清单)。
|
|
8
|
+
//
|
|
9
|
+
// 本模块是宿主进程内真 ESM:可 import node: 内建与包内相对路径;禁止 import
|
|
10
|
+
// @deepseek-ai/*(解析根够不到 harness 包,历史论证 —— 契约 §8)。
|
|
11
|
+
import { existsSync } from 'node:fs'
|
|
12
|
+
|
|
13
|
+
import defineProvider, { claudeExeCandidates } from '../../providers/claude.mjs'
|
|
14
|
+
import { POLICY_TEXT } from '../../providers/claude-policy.mjs'
|
|
15
|
+
import { renderResult, renderStatus } from '../../core/bridge-kit.mjs'
|
|
16
|
+
import { isBridgeEnabled } from '../../core/scheduling.mjs'
|
|
17
|
+
import { PROVIDER_IDS } from '../../providers/registry.mjs'
|
|
18
|
+
|
|
19
|
+
export const name = 'cli-bridge-claude'
|
|
20
|
+
export const inject = ['tools', 'subprocess', 'systemPrompt', 'timer']
|
|
21
|
+
|
|
22
|
+
const OUTPUT_SCHEMA = { type: 'object', additionalProperties: true }
|
|
23
|
+
|
|
24
|
+
export function apply(ctx) {
|
|
25
|
+
// 调度门禁:用户在设置面板关掉 claude → 本形态不注册任何工具/政策段/心跳。
|
|
26
|
+
// 每次会话装配时现读文件(改设置下次会话即生效,无需重启宿主);fail-open。
|
|
27
|
+
if (!isBridgeEnabled('claude', PROVIDER_IDS)) return
|
|
28
|
+
const subprocess = ctx.subprocess
|
|
29
|
+
const sandboxPolicy = ctx.get('sandboxPolicy')
|
|
30
|
+
|
|
31
|
+
const provider = defineProvider({ process, env: process.env })
|
|
32
|
+
|
|
33
|
+
// 状态快照 → 家级灯(keystone 听 'claude/status',事件是 app 级广播)。
|
|
34
|
+
function publish(snapshot) {
|
|
35
|
+
try { ctx.emit('claude/status', { snapshot }) } catch (e) { /* ignore */ }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// cwd 兜底:显式 cwd 参数 > env CLAUDE_MCP_CWD > 沙箱 workspaceRoot > process.cwd()。
|
|
39
|
+
function getCwdFallback() {
|
|
40
|
+
if (process.env.CLAUDE_MCP_CWD) return String(process.env.CLAUDE_MCP_CWD)
|
|
41
|
+
if (sandboxPolicy && typeof sandboxPolicy.workspaceRoot === 'string' && sandboxPolicy.workspaceRoot) return sandboxPolicy.workspaceRoot
|
|
42
|
+
return process.cwd()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// 设置面板分区(每次 getSettings 现读 ctx.get,面板改默认模型后下一次调用即生效)。
|
|
46
|
+
function panelSettings() {
|
|
47
|
+
try {
|
|
48
|
+
const s = ctx.get && ctx.get('cliBridgeSettings')
|
|
49
|
+
return (s && s.claude) || null
|
|
50
|
+
} catch (e) { return null }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// exe 解析优先级(与描述符 claudeExeCandidates 同一套):
|
|
54
|
+
// 面板 binPath > env CLAUDE_BIN/CLAUDE_CLI/CLAUDE_CODE_BIN > 已知本地安装 > PATH 名 claude。
|
|
55
|
+
// .js/.mjs 目标经 process.execPath 包装(返回数组前缀,buildArgv 接受)。
|
|
56
|
+
// ⚠️ npm 全局安装会在 Windows 给 claude.cmd —— 本形态经 DSH subprocess 启动,.cmd 能否
|
|
57
|
+
// 执行取决于宿主;探测不到原生 exe 时如实落到 resolveExecutable,失败会明确报
|
|
58
|
+
// CLAUDE_UNAVAILABLE/SPAWN_ERROR(绝不静默改走别的后端)。
|
|
59
|
+
const binPathSetting = (() => {
|
|
60
|
+
const s = panelSettings()
|
|
61
|
+
const v = s ? s.binPath : ''
|
|
62
|
+
return typeof v === 'string' ? v : ''
|
|
63
|
+
})()
|
|
64
|
+
const exeCandidates = claudeExeCandidates(process.env, binPathSetting)
|
|
65
|
+
|
|
66
|
+
async function resolveExe(backend, signal) {
|
|
67
|
+
for (const c of exeCandidates) {
|
|
68
|
+
if (!c) continue
|
|
69
|
+
if (/\.(mjs|cjs|js)$/i.test(c)) return [process.execPath, c]
|
|
70
|
+
try { if (existsSync(c)) return c } catch (e) { }
|
|
71
|
+
}
|
|
72
|
+
return await subprocess.resolveExecutable('claude', undefined, signal)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
provider.attach({
|
|
76
|
+
ctx, subprocess, resolveExe, getCwdFallback, publish,
|
|
77
|
+
getSettings: () => {
|
|
78
|
+
const s = panelSettings()
|
|
79
|
+
return s && typeof s === 'object' ? s : {}
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
// 宣告 claude 优先模式:家级灯据此决定常驻显示(presetActive)。挂载即宣告 +
|
|
84
|
+
// 每 30s 心跳续租(TTL 75s,契约 §2)。
|
|
85
|
+
function announceMode() {
|
|
86
|
+
try {
|
|
87
|
+
const sid = (ctx.session && ctx.session.id) || ctx.sessionId || null
|
|
88
|
+
ctx.emit('claude/mode', sid ? { active: true, sessionId: sid } : { active: true })
|
|
89
|
+
} catch (e) { /* ignore */ }
|
|
90
|
+
}
|
|
91
|
+
announceMode()
|
|
92
|
+
try { const t = ctx.setInterval ? ctx.setInterval(announceMode, 30000) : null; if (t && ctx.effect) ctx.effect(() => () => { try { t() } catch (e) {} }) } catch (e) {}
|
|
93
|
+
|
|
94
|
+
// ── 工具注册(执行进描述符三逻辑 + extraTools)──────────────────────────────
|
|
95
|
+
ctx.effect(() => ctx.tools.register({
|
|
96
|
+
name: provider.tools.run.name,
|
|
97
|
+
description: provider.tools.run.description,
|
|
98
|
+
parameters: provider.tools.run.inputSchema,
|
|
99
|
+
output: { schema: OUTPUT_SCHEMA, render: (args, value) => renderResult(value, provider) },
|
|
100
|
+
execute: (args, exec) => provider.runToolLogic(args, exec)
|
|
101
|
+
}))
|
|
102
|
+
ctx.effect(() => ctx.tools.register({
|
|
103
|
+
name: provider.tools.continue.name,
|
|
104
|
+
description: provider.tools.continue.description,
|
|
105
|
+
parameters: provider.tools.continue.inputSchema,
|
|
106
|
+
output: { schema: OUTPUT_SCHEMA, render: (args, value) => renderResult(value, provider) },
|
|
107
|
+
execute: (args, exec) => provider.continueToolLogic(args, exec)
|
|
108
|
+
}))
|
|
109
|
+
ctx.effect(() => ctx.tools.register({
|
|
110
|
+
name: provider.tools.status.name,
|
|
111
|
+
description: provider.tools.status.description,
|
|
112
|
+
parameters: provider.tools.status.inputSchema,
|
|
113
|
+
output: { schema: OUTPUT_SCHEMA, render: (args, value) => renderStatus(value, provider) },
|
|
114
|
+
execute: (args) => provider.statusToolLogic(args)
|
|
115
|
+
}))
|
|
116
|
+
for (const et of provider.extraTools || []) {
|
|
117
|
+
ctx.effect(() => ctx.tools.register({
|
|
118
|
+
name: et.name,
|
|
119
|
+
description: et.description,
|
|
120
|
+
parameters: et.inputSchema,
|
|
121
|
+
output: { schema: OUTPUT_SCHEMA, render: et.render || ((args, value) => renderResult(value, provider)) },
|
|
122
|
+
execute: (args, exec) => et.logic(args, exec)
|
|
123
|
+
}))
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
ctx.effect(() => ctx.systemPrompt.section({
|
|
127
|
+
name: 'claude:policy',
|
|
128
|
+
order: (typeof ctx.systemPrompt.getSectionOrder === 'function' ? ctx.systemPrompt.getSectionOrder('TOOL_SUBAGENT') : 2800) + 10,
|
|
129
|
+
text: POLICY_TEXT
|
|
130
|
+
}))
|
|
131
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// preset/claude-first/plugin-list.mjs — claude-first 预设的单源插件清单(PROVIDER-CONTRACT §5)。
|
|
2
|
+
//
|
|
3
|
+
// = 官方 standard 基线(standard-base.mjs)+ claude 桥接行 + persona 差异。
|
|
4
|
+
// preset id 'claude-first':本包新增 provider,无旧包兼容包袱,id 直接用 provider id + '-first'
|
|
5
|
+
// (与 opencode-first 同构;cordis-agy / cordis-mimo 的 cordis-* 前缀是旧包历史遗留,不可套用)。
|
|
6
|
+
import { standardPluginRows, bridgeRow } from '../standard-base.mjs'
|
|
7
|
+
|
|
8
|
+
export const meta = {
|
|
9
|
+
id: 'claude-first',
|
|
10
|
+
name: 'Claude Code 执行代理',
|
|
11
|
+
description: '完整编码 Agent(standard 全部能力),额外提供 claude_run/claude_continue 工具并注入"claude 优先"策略:各种模式下先把实现、编辑、调试、构建、跨文件排查派给本机 Claude Code CLI(DSH 完全控制、claude 无提示改文件、默认后台执行),原生工具仅用于只读查询与最终验证。模型清单以服务端权威探测为准(claude_models)。',
|
|
12
|
+
order: 50
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function buildPlugins(deps) {
|
|
16
|
+
const rows = standardPluginRows()
|
|
17
|
+
// persona 段:prefix 必填;**不设 suffix** —— DSH 只注册 provider/model 两个提示词变量,
|
|
18
|
+
// 写 {{cwd}} 会在组装期抛 unknown prompt variable,使整个预设不可用(工作目录由
|
|
19
|
+
// working-directory 服务以不插值的用户上下文提供)。
|
|
20
|
+
const persona = rows.find((r) => r.id === 'persona')
|
|
21
|
+
if (persona && persona.config) {
|
|
22
|
+
persona.config.prefix = 'You are a coding agent powered by the {{model}} model.'
|
|
23
|
+
delete persona.config.suffix
|
|
24
|
+
}
|
|
25
|
+
// 桥接行:第二参数由 build(scripts/build.mjs)注入裸包说明符,绝不在这里写死路径。
|
|
26
|
+
rows.push(bridgeRow('claude', deps && deps.bridgeName))
|
|
27
|
+
return rows
|
|
28
|
+
}
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
- id: persona
|
|
5
5
|
name: '@deepseek-ai/dsh-persona'
|
|
6
6
|
config:
|
|
7
|
-
suffix: 'Your working directory is {{cwd}}.'
|
|
8
7
|
prefix: 'You are a coding agent powered by the {{model}} model.'
|
|
9
8
|
- id: agent-instructions
|
|
10
9
|
name: '@deepseek-ai/dsh-agent-instructions'
|
|
@@ -86,20 +85,17 @@
|
|
|
86
85
|
provider: spawn
|
|
87
86
|
toolName: subagent
|
|
88
87
|
modelSelectionSettings: true
|
|
89
|
-
backgroundMode: continuable
|
|
90
88
|
- id: tool-subagent-fork
|
|
91
89
|
name: '@deepseek-ai/dsh-tool-subagent'
|
|
92
90
|
config:
|
|
93
91
|
provider: fork
|
|
94
92
|
toolName: subagent_fork
|
|
95
|
-
backgroundMode: continuable
|
|
96
93
|
- id: tool-subagent-codex
|
|
97
94
|
name: '@deepseek-ai/dsh-tool-subagent'
|
|
98
95
|
disabled: true
|
|
99
96
|
config:
|
|
100
97
|
provider: codex
|
|
101
98
|
toolName: subagent_codex
|
|
102
|
-
backgroundMode: one-shot
|
|
103
99
|
maxDepth: provider-managed
|
|
104
100
|
- id: tool-subagent-claude-code
|
|
105
101
|
name: '@deepseek-ai/dsh-tool-subagent'
|
|
@@ -107,7 +103,6 @@
|
|
|
107
103
|
config:
|
|
108
104
|
provider: claude-code
|
|
109
105
|
toolName: subagent_claude_code
|
|
110
|
-
backgroundMode: one-shot
|
|
111
106
|
maxDepth: provider-managed
|
|
112
107
|
- id: workflow-ptc
|
|
113
108
|
name: '@deepseek-ai/dsh-workflow-ptc'
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# 生成物 — 由 node scripts/build.mjs 从 preset/codex-first/plugin-list.mjs 生成,勿手改。
|
|
2
|
+
# legacy 目录形态($DSH_HOME/.agent-presets/codex-first/);新 DSH 走声明制
|
|
3
|
+
# (home-plugin/cli-bridge-indicator/lib/preset-declarations.mjs 直接 import 同一源)。
|
|
4
|
+
- id: persona
|
|
5
|
+
name: '@deepseek-ai/dsh-persona'
|
|
6
|
+
config:
|
|
7
|
+
prefix: 'You are a coding agent powered by the {{model}} model.'
|
|
8
|
+
- id: agent-instructions
|
|
9
|
+
name: '@deepseek-ai/dsh-agent-instructions'
|
|
10
|
+
config:
|
|
11
|
+
maxBytes: 65536
|
|
12
|
+
- id: tool-bash
|
|
13
|
+
name: '@deepseek-ai/dsh-tool-bash'
|
|
14
|
+
disabled: !!js 'process.platform === ''win32'''
|
|
15
|
+
- id: tool-pwsh
|
|
16
|
+
name: '@deepseek-ai/dsh-tool-pwsh'
|
|
17
|
+
disabled: !!js 'process.platform !== ''win32'''
|
|
18
|
+
- id: tool-fs
|
|
19
|
+
name: '@deepseek-ai/dsh-tool-fs'
|
|
20
|
+
- id: tool-fs-search
|
|
21
|
+
name: '@deepseek-ai/dsh-tool-fs-search'
|
|
22
|
+
config:
|
|
23
|
+
sampleOverCapGlobResults: false
|
|
24
|
+
- id: tool-jobs
|
|
25
|
+
name: '@deepseek-ai/dsh-tool-jobs'
|
|
26
|
+
- id: skill-filesystem
|
|
27
|
+
name: '@deepseek-ai/dsh-skill-filesystem'
|
|
28
|
+
- id: tool-skill
|
|
29
|
+
name: '@deepseek-ai/dsh-tool-skill'
|
|
30
|
+
- id: command-goal
|
|
31
|
+
name: '@deepseek-ai/dsh-command-goal'
|
|
32
|
+
- id: tool-goal
|
|
33
|
+
name: '@deepseek-ai/dsh-tool-goal'
|
|
34
|
+
- id: planning
|
|
35
|
+
name: 'cordis:group'
|
|
36
|
+
group: true
|
|
37
|
+
isolate:
|
|
38
|
+
planMode: true
|
|
39
|
+
config:
|
|
40
|
+
- id: plan-mode
|
|
41
|
+
name: '@deepseek-ai/dsh-plan-mode'
|
|
42
|
+
config:
|
|
43
|
+
section: |
|
|
44
|
+
You are in plan mode. Stay in plan mode until exit_plan_mode succeeds or the user switches the session mode. Imperative language to implement changes means plan the implementation, not execute it. A user's conversational agreement — including an answer confirming something you asked — approves nothing and does not end plan mode; fold the confirmed decision into the plan and submit it through exit_plan_mode.
|
|
45
|
+
|
|
46
|
+
Explore first. Use non-mutating reads, searches, static analysis, and checks to ground the plan in the actual repository. Do not edit or write files, change configuration, run formatters or code generation that rewrites tracked files, commit, or otherwise carry out the plan. Prefer existing functions and patterns over new machinery.
|
|
47
|
+
|
|
48
|
+
The tool catalog stays the same across modes for request-cache stability. These plan-mode rules override any later tool description or guidance that suggests using mutation tools; those tools remain listed to keep the tool catalog unchanged. Do not use todo_write to track this planning phase: it tracks implementation after an approved plan, while the plan itself belongs in exit_plan_mode.
|
|
49
|
+
|
|
50
|
+
Resolve discoverable facts by inspection. Use ask_user_question only for user-owned choices or material ambiguity that inspection cannot answer. Do not ask the user where code lives or how current behavior works when you can find out.
|
|
51
|
+
|
|
52
|
+
Make the plan decision-complete: state the goal and success criteria; group implementation changes by subsystem; identify public API, schema, and data-flow changes; cover edge cases, failure modes, tests, acceptance criteria, and explicit assumptions. Keep it concise enough to review but detailed enough that another engineer can implement it without making design decisions.
|
|
53
|
+
|
|
54
|
+
When ready, call exit_plan_mode with the complete plan markdown, starting with a # title. Make exit_plan_mode the only and final tool call in that assistant response: it presents the plan for approval, and implementation begins only in a later step after approval. Do not paste the final plan as a plain reply or ask "should I proceed?" through prose or ask_user_question. If review rejects it, incorporate the feedback and present again. If the review channel is unavailable or aborted, stay in plan mode and ask the user to switch modes manually; do not proceed with implementation.
|
|
55
|
+
- id: compaction
|
|
56
|
+
name: 'cordis:group'
|
|
57
|
+
group: true
|
|
58
|
+
isolate:
|
|
59
|
+
compaction: true
|
|
60
|
+
toolResultPruner: true
|
|
61
|
+
config:
|
|
62
|
+
- id: compaction-basic
|
|
63
|
+
name: '@deepseek-ai/dsh-compaction-basic'
|
|
64
|
+
- id: command-compact
|
|
65
|
+
name: '@deepseek-ai/dsh-command-compact'
|
|
66
|
+
- id: tool-result-pruner
|
|
67
|
+
name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
|
|
68
|
+
config:
|
|
69
|
+
thresholdChars: 8192
|
|
70
|
+
headChars: 4096
|
|
71
|
+
tailChars: 1024
|
|
72
|
+
- id: delegation
|
|
73
|
+
name: 'cordis:group'
|
|
74
|
+
group: true
|
|
75
|
+
isolate:
|
|
76
|
+
workflowEngine: true
|
|
77
|
+
config:
|
|
78
|
+
- id: tool-subagent-control
|
|
79
|
+
name: '@deepseek-ai/dsh-tool-subagent-control'
|
|
80
|
+
- id: tool-subagent-list-agents
|
|
81
|
+
name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
|
|
82
|
+
- id: tool-subagent
|
|
83
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
84
|
+
config:
|
|
85
|
+
provider: spawn
|
|
86
|
+
toolName: subagent
|
|
87
|
+
modelSelectionSettings: true
|
|
88
|
+
- id: tool-subagent-fork
|
|
89
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
90
|
+
config:
|
|
91
|
+
provider: fork
|
|
92
|
+
toolName: subagent_fork
|
|
93
|
+
- id: tool-subagent-codex
|
|
94
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
95
|
+
disabled: true
|
|
96
|
+
config:
|
|
97
|
+
provider: codex
|
|
98
|
+
toolName: subagent_codex
|
|
99
|
+
maxDepth: provider-managed
|
|
100
|
+
- id: tool-subagent-claude-code
|
|
101
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
102
|
+
disabled: true
|
|
103
|
+
config:
|
|
104
|
+
provider: claude-code
|
|
105
|
+
toolName: subagent_claude_code
|
|
106
|
+
maxDepth: provider-managed
|
|
107
|
+
- id: workflow-ptc
|
|
108
|
+
name: '@deepseek-ai/dsh-workflow-ptc'
|
|
109
|
+
config:
|
|
110
|
+
provider: spawn
|
|
111
|
+
- id: tool-workflow
|
|
112
|
+
name: '@deepseek-ai/dsh-tool-workflow'
|
|
113
|
+
- id: tool-ralph
|
|
114
|
+
name: '@deepseek-ai/dsh-tool-ralph'
|
|
115
|
+
disabled: true
|
|
116
|
+
config:
|
|
117
|
+
subagentProvider: spawn
|
|
118
|
+
maxRounds: 64
|
|
119
|
+
- id: tool-ask-user
|
|
120
|
+
name: '@deepseek-ai/dsh-tool-ask-user'
|
|
121
|
+
- id: tool-todo
|
|
122
|
+
name: '@deepseek-ai/dsh-tool-todo'
|
|
123
|
+
config:
|
|
124
|
+
allowParallelInProgress: true
|
|
125
|
+
- id: tool-web
|
|
126
|
+
name: '@deepseek-ai/dsh-tool-web'
|
|
127
|
+
config:
|
|
128
|
+
fetch: true
|
|
129
|
+
searchTimeoutMs: 60000
|
|
130
|
+
- id: present
|
|
131
|
+
name: '@deepseek-ai/dsh-tool-present'
|
|
132
|
+
- id: tool-plugin-manager
|
|
133
|
+
name: '@deepseek-ai/dsh-plugin-manager/tools'
|
|
134
|
+
disabled: true
|
|
135
|
+
- id: cli-bridge-codex
|
|
136
|
+
name: '@luchenglong/cli-bridge/preset-codex'
|