Skip to content

A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.

Take DSH's /goal out of the desktop app

Fei24114559a604d453
diff --git a/app/package-lock.json b/app/package-lock.json
index e158d180..0e6cf732 100644
--- a/app/package-lock.json
+++ b/app/package-lock.json
@@ -10,6 +10,7 @@
"license": "Apache-2.0",
"dependencies": {
"@deepseek-ai/cordis-plugin-group": "1.0.5",
+ "@deepseek-ai/cordis-plugin-include": "1.0.10",
"@deepseek-ai/dsh": "0.2.1-rc.4",
"@deepseek-ai/dsh-anonymous-user-id": "0.2.1-rc.4",
"@deepseek-ai/dsh-app-boot": "0.2.1-rc.4",
@@ -48,6 +49,7 @@
"deep-view": "0.1.0",
"ds-bot": "file:../ds-bot",
"electron-updater": "6.8.10",
+ "js-yaml": "4.3.2",
"pnpm": "11.7.0",
"ws": "8.18.3",
"yaml": "2.9.1"
diff --git a/app/package.json b/app/package.json
index c8de7c39..198af7f0 100644
--- a/app/package.json
+++ b/app/package.json
@@ -24,6 +24,7 @@
},
"dependencies": {
"@deepseek-ai/cordis-plugin-group": "1.0.5",
+ "@deepseek-ai/cordis-plugin-include": "1.0.10",
"@deepseek-ai/dsh": "0.2.1-rc.4",
"@deepseek-ai/dsh-anonymous-user-id": "0.2.1-rc.4",
"@deepseek-ai/dsh-app-boot": "0.2.1-rc.4",
@@ -62,6 +63,7 @@
"deep-view": "0.1.0",
"ds-bot": "file:../ds-bot",
"electron-updater": "6.8.10",
+ "js-yaml": "4.3.2",
"pnpm": "11.7.0",
"ws": "8.18.3",
"yaml": "2.9.1"
diff --git a/app/src/goal-patch.mjs b/app/src/goal-patch.mjs
new file mode 100644
index 00000000..f7da131e
--- /dev/null
+++ b/app/src/goal-patch.mjs
@@ -0,0 +1,65 @@
+// Reconcile C2 / #133: Bots run DS Bot's own group goal, and DSH's session
+// goal does not survive conversation parts — in the app the `/goal` command,
+// and its tool are dead weight. Removing them needs
+// new rows in the bundled presets, which the app must not rewrite, so the
+// Host restates the preset rows without the goal rows through a `--patch`
+// overlay it writes into its own data area next to the profiles
+// (`<DSH_HOME>/profiles/goal.patch.yml`): DSH reads it only through
+// `patchFiles` and nothing scans this location. The composer's goal bar
+// stays — a DSH goal left from before must still be pausable, and no new
+// one can start without the command or the tool. Preset rows carry `!!js`
+// expressions; the overlay keeps them by writing through the same
+// entry-list dialect the include parses. This reconciliation runs on the
+// next launch.
+import { dirname, join } from 'node:path'
+import { rmSync, writeFileSync } from 'node:fs'
+import { composeEntries } from '@deepseek-ai/dsh-app-boot'
+import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
+import { dump } from 'js-yaml'
+
+export const GOAL_PATCH_NAME = 'goal.patch.yml'
+
+const PRESET = '@deepseek-ai/dsh-agent-preset'
+const GOAL_ROWS = new Set(['@deepseek-ai/dsh-command-goal', '@deepseek-ai/dsh-tool-goal'])
+
+// A group row keeps its child rows in `config`, a plain list.
+const hasGoalRow = (rows) => rows.some(row => GOAL_ROWS.has(row?.name)
+ || (row?.group === true && Array.isArray(row.config) && hasGoalRow(row.config)))
+
+const stripGoalRows = (rows) => rows
+ .map(row => (row?.group === true && Array.isArray(row.config)
+ ? { ...row, config: stripGoalRows(row.config) }
+ : row))
+ .filter(row => GOAL_ROWS.has(row?.name) === false)
+
+/**
+ * The overlay rows that restate every preset carrying goal rows without them,
+ * or `undefined` when no preset needs it. Composed over the bundles and the
+ * profile's own patch, so user edits to a preset survive — minus the rows.
+ * @param {import('@deepseek-ai/dsh-app-boot').Profile} profile
+ * @returns {import('@deepseek-ai/cordis-plugin-include').PatchOptions[] | undefined}
+ */
+export function goalPatch(profile) {
+ const entries = composeEntries([...profile.layers.map(layer => layer.patches), profile.patches])
+ const rows = entries
+ .filter(entry => entry.name === PRESET && Array.isArray(entry.config?.plugins) && hasGoalRow(entry.config.plugins))
+ .map(entry => ({ id: entry.id, name: entry.name, config: { ...entry.config, plugins: stripGoalRows(entry.config.plugins) } }))
+ return rows.length === 0 ? undefined : rows
+}
+
+/**
+ * Write the goal overlay next to the profiles and report it for `patchFiles`;
+ * when none is needed, drop a stale one from an earlier launch.
+ * @param {import('@deepseek-ai/dsh-app-boot').Profile} profile
+ * @returns {string[]} the `patchFiles` argument for this launch
+ */
+export function reconcileGoal(profile) {
+ const file = join(dirname(profile.dir), GOAL_PATCH_NAME)
+ const rows = goalPatch(profile)
+ if (rows === undefined) {
+ rmSync(file, { force: true })
+ return []
+ }
+ writeFileSync(file, dump(rows, { schema: entryListSchema }), 'utf8')
+ return [file]
+}
diff --git a/app/src/host.mjs b/app/src/host.mjs
index 18eafc3a..b7a763f3 100644
--- a/app/src/host.mjs
+++ b/app/src/host.mjs
@@ -7,6 +7,7 @@ import { inspect } from 'node:util'
import { loadLayeredEnv, reportSkippedBundles } from '@deepseek-ai/dsh-app-boot'
import { runProfile } from '@deepseek-ai/dsh/profile-boot'
import { CHECK_PROFILE, INSTALL_ANCHOR, loadAppProfile, loadCheckProfile, PROFILE } from './profile.mjs'
+import { reconcileGoal } from './goal-patch.mjs'
import { reconcileOfficeRuntime } from './office-patch.mjs'
import { reconcileSearchSelector } from './search-patch.mjs'
import { unreadableSessions } from './session-check.mjs'
@@ -32,7 +33,7 @@ async function main() {
environment: loadLayeredEnv('dsh'),
profile: check === undefined ? PROFILE : CHECK_PROFILE,
resolvedProfile: { profile, installAnchor: INSTALL_ANCHOR },
- patchFiles: check === undefined ? [...reconcileSearchSelector(profile), ...office.patchFiles] : [],
+ patchFiles: check === undefined ? [...reconcileSearchSelector(profile), ...reconcileGoal(profile), ...office.patchFiles] : [],
args: ['--no-open', '--port', process.env.DS_BOT_PORT || '0'],
...(pnpm === undefined ? {} : {
packageManager: { command: process.execPath, args: ['--expose-internals', pnpm], env: { ELECTRON_RUN_AS_NODE: '1' } },
diff --git a/app/test/goal-patch.test.mjs b/app/test/goal-patch.test.mjs
new file mode 100644
index 00000000..f78aab22
--- /dev/null
+++ b/app/test/goal-patch.test.mjs
@@ -0,0 +1,105 @@
+import assert from 'node:assert/strict'
+import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { dirname, join } from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { after, describe, test } from 'node:test'
+import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
+import { load } from 'js-yaml'
+import { GOAL_PATCH_NAME, goalPatch, reconcileGoal } from '../src/goal-patch.mjs'
+
+const PRESETS = fileURLToPath(new URL('presets/', import.meta.resolve('@deepseek-ai/dsh-web-app/package.json')))
+const GOAL_NAMES = new Set(['@deepseek-ai/dsh-command-goal', '@deepseek-ai/dsh-tool-goal'])
+
+// The dsh-web-app bundle's preset patches, as the app's own launch reads them.
+const realLayers = readdirSync(PRESETS).filter(name => name.endsWith('.patch.yml'))
+ .map(name => ({ packageName: '@deepseek-ai/dsh-web-app', packageDir: PRESETS, patchPaths: [], patches: load(readFileSync(join(PRESETS, name), 'utf8'), { schema: entryListSchema }) }))
+
+const flat = (patches) => patches.flatMap(patch => patch.insert ?? [patch])
+
+const countGoalRows = (rows) => rows.reduce((n, row) => n
+ + (GOAL_NAMES.has(row?.name) ? 1 : 0)
+ + (row?.group === true && Array.isArray(row.config) ? countGoalRows(row.config) : 0), 0)
+
+function profile({ layers = realLayers, patches = [] } = {}) {
+ const home = mkdtempSync(join(tmpdir(), 'ds-bot-goal-patch-'))
+ const dir = join(home, 'profiles', 'ds-bot')
+ mkdirSync(dir, { recursive: true })
+ return { name: 'ds-bot', dir, patchPath: join(dir, 'cordis.patch.yml'), skippedBundles: [], layers, patches, home }
+}
+
+describe('goalPatch', () => {
+ const made = []
+ const track = (...args) => { const p = profile(...args); made.push(p.home); return p }
+ after(() => { for (const dir of made) rmSync(dir, { recursive: true, force: true }) })
+
+ test('restates every real preset that carries goal rows, minus exactly those rows', () => {
+ const rows = goalPatch(track())
+ assert.ok(rows !== undefined)
+ const restated = new Map(rows.map(row => [row.id, row]))
+ // At least the standard, ptc and cordis presets carry goal rows.
+ assert.equal(restated.size >= 3, true)
+ for (const layer of realLayers) {
+ for (const patch of layer.patches) {
+ for (const preset of patch.insert ?? []) {
+ const source = preset.config?.plugins ?? []
+ if (countGoalRows(source) === 0) {
+ assert.equal(restated.has(preset.id), false)
+ continue
+ }
+ const row = restated.get(preset.id)
+ assert.equal(row.name, '@deepseek-ai/dsh-agent-preset')
+ // The restated plugins list is the source list minus the goal rows.
+ const stripped = source
+ .map(r => (r?.group === true && Array.isArray(r.config) ? { ...r, config: r.config.filter(c => !GOAL_NAMES.has(c?.name)) } : r))
+ .filter(r => !GOAL_NAMES.has(r?.name))
+ assert.equal(countGoalRows(row.config.plugins), 0)
+ assert.deepEqual(row.config.plugins, stripped)
+ assert.deepEqual({ ...row.config, plugins: source }, preset.config)
+ }
+ }
+ }
+ })
+
+ test('keeps !!js rows as expression objects the overlay writes back as !!js scalars', () => {
+ const p = track()
+ const [file] = reconcileGoal(p)
+ const content = readFileSync(file, 'utf8')
+ assert.match(content, /!!js process\.platform === 'win32'/)
+ assert.doesNotMatch(content, /__jsExpr/)
+ const parsed = load(content, { schema: entryListSchema })
+ const standard = parsed.find(row => row.id === 'preset-standard')
+ const bash = standard.config.plugins.find(row => row.id === 'tool-bash')
+ assert.deepEqual(bash.disabled, { __jsExpr: "process.platform === 'win32'" })
+ })
+
+ test('does nothing when no preset carries goal rows', () => {
+ const preset = { insert: [{ id: 'preset-free', name: '@deepseek-ai/dsh-agent-preset', config: { plugins: [{ id: 'tool-fs', name: '@deepseek-ai/dsh-tool-fs' }] } }] }
+ assert.equal(goalPatch(track({ layers: [{ packageName: 'x', packageDir: '', patchPaths: [], patches: [preset] }] })), undefined)
+ })
+
+ test('a profile-patch edit to a preset survives, minus the goal rows', () => {
+ const standard = realLayers.flatMap(layer => layer.patches).flatMap(patch => patch.insert ?? []).find(row => row.id === 'preset-standard')
+ const edited = standard.config.plugins.map(row => (row.id === 'tool-bash' ? { ...row, disabled: false } : row))
+ const rows = goalPatch(track({ patches: [{ id: 'preset-standard', config: { ...standard.config, plugins: edited } }] }))
+ const row = rows.find(r => r.id === 'preset-standard')
+ assert.equal(row.config.plugins.find(r => r.id === 'tool-bash').disabled, false)
+ assert.equal(countGoalRows(row.config.plugins), 0)
+ })
+})
+
+describe('reconcileGoal', () => {
+ test('writes the overlay next to the profiles and drops a stale one when satisfied', () => {
+ const p = profile()
+ try {
+ const [file] = reconcileGoal(p)
+ // Outside the profile directory itself, so DSH only reads it through patchFiles.
+ assert.equal(file, join(dirname(p.dir), GOAL_PATCH_NAME))
+ assert.notEqual(file, p.patchPath)
+ assert.equal(readFileSync(file, 'utf8').includes('command-goal') === false, true)
+ // A later launch with nothing to change drops the stale overlay.
+ assert.deepEqual(reconcileGoal({ ...p, layers: [], patches: [] }), [])
+ assert.equal(existsSync(file), false)
+ } finally { rmSync(p.home, { recursive: true, force: true }) }
+ })
+})
diff --git a/app/test/helpers/fake-app-boot.mjs b/app/test/helpers/fake-app-boot.mjs
index 87781fcb..46682438 100644
--- a/app/test/helpers/fake-app-boot.mjs
+++ b/app/test/helpers/fake-app-boot.mjs
@@ -1,5 +1,7 @@
// The boot of the profile, as a test double: the version of DSH the app reports, and the
// parts of a profile the app asks for. The app's own main process never calls them.
+import { applyEntryPatches } from '@deepseek-ai/cordis-plugin-include'
+
export const getDshRuntimeVersion = () => ({ release: { version: '0.2.1-rc.4' } })
export const loadLayeredEnv = () => ({})
export const reportSkippedBundles = () => {}
@@ -8,4 +10,7 @@ export const loadProfileDirectory = () => ({})
export const readProfileManifest = () => ({ dsh: { profile: { bundles: [] } } })
export const resolveProfileDir = (name) => name
export const writeProfileBundles = () => {}
-export const composeEntries = (entries) => entries.flat()
+// The real composeEntries applies each patch list by row id onto an empty entry
+// list; the doubles must keep that semantics so patches that restate rows
+// (search selector, goal presets) compose exactly like a launch.
+export const composeEntries = (entries) => applyEntryPatches([], structuredClone(entries.flat()), () => {})
diff --git a/docs/plans/2026-11-01-group-goal.md b/docs/plans/2026-11-01-group-goal.md
index c50b3df2..b4613d03 100644
--- a/docs/plans/2026-11-01-group-goal.md
+++ b/docs/plans/2026-11-01-group-goal.md
@@ -80,15 +80,16 @@ Goal 的内容:标题、目标(objective)、总验收方法(acceptance
### 界面
-- 群聊顶部的「灵动岛」(会话头胶囊)就是 Goal 的状态屏:有 Goal 时,胶囊变长,平时显示 Goal 的简短标题和进度;鼠标移上去(或键盘聚焦)才换回群名和打开详情的箭头。
-- 胶囊下方吊着一体的吊舱,和胶囊同宽、连成一个表面:显示当前阶段(或「对齐中」「已暂停」「等你」「已完成」「已终止」)、阶段进度和本阶段成员的头像状态。
-- 点吊舱,同一个表面用弹簧展开成面板:Goal 全文、总验收方法、约束、每个阶段和每个成员的分工与状态;按钮有暂停 / 继续、终止(再点一次确认)、完成或终止后的清除。
+- 群聊顶部的「灵动岛」(会话头胶囊)就是 Goal 的状态屏:有 Goal 时,胶囊变长,平时显示 Goal 的简短标题和「当前阶段/总数」;鼠标移上去(或键盘聚焦)才换回群名和打开详情的箭头。
+- 胶囊下方吊着一体的吊舱,和胶囊同宽、连成一个表面:显示当前阶段的标题(或「对齐中」「已暂停 · 阶段名」「验收中 · 阶段名」「等你 · 阶段名」「已达成」「已终止」「总验收」)、阶段进度条和本阶段成员的头像状态;面板打开时进度条和头像收起,只留圆点、标题和箭头。
+- 点吊舱,同一个表面用弹簧展开成面板,聚焦选中的阶段:顶部一行步骤点,每个阶段一个圆点(已过的绿勾、当前的描边数字、未到的空心),点一个阶段,下面就只显示它的验收方法、返工记录、证据和分工;选中别的阶段时标题行给出「回到当前阶段」。底部一行:左边「目标与验收」展开 Goal 全文、总验收方法和约束,右边是按钮——进行中是暂停 / 终止(再点一次确认),暂停时多个「同时停止当前工作」和继续,完成或终止后是清除,对齐中是取消。
+- 阶段不再逐个画卡片:状态只用图形表达(步骤点颜色),任务状态只在头像上(在做的转圈、已交回的绿勾、未开始的半透明)。
- 群里的对话流用事件行记录 Goal 的变化:设定、阶段通过、返工、修改、暂停、继续、完成、终止。
## 不做什么
- 不做单 Bot 私聊里的 Goal(数据结构不排除以后做)。
-- 不用 DSH 的会话级 Goal(`create_goal` 等工具在 Bot 会话里照旧隐藏)。
+- Bot 会话不跑 DSH 的会话级 Goal;桌面应用启动时去掉预设里的 goal 命令和工具(输入框上的 goal 条保留,以前留下的 DSH goal 还能暂停和清除);插件版的「/」菜单里 `/goal` 还在(DSH 没有按会话去掉命令的接口),用了会被挡下并提示用「设定目标」。
- 不设轮数或时长上限;防空转只靠「没有进展就停下等用户」。
- 阶段按顺序推进,不做阶段间的并行;同一阶段里的任务可以同时做。
@@ -98,3 +99,5 @@ Goal 的内容:标题、目标(objective)、总验收方法(acceptance
- DSH 重启后,Goal 不会自己恢复推进:下一次有人在群里说话、或被打断的工作恢复后,自动推进照常接上。
## 变更
+
+- 2026-11-01:面板改成聚焦单个阶段(步骤点 + 选中阶段 + 底行按钮),去掉面板头部和彩色标签;桌面应用启动时去掉 DSH 的 goal 命令和工具,插件的 `/goal` 提示改用「设定目标」。
diff --git a/ds-bot/src/host/tools.js b/ds-bot/src/host/tools.js
index 9060376e..ef22aa7d 100644
--- a/ds-bot/src/host/tools.js
+++ b/ds-bot/src/host/tools.js
@@ -14,10 +14,10 @@ import { checkShownView, showViewDescription, showViewParameters } from 'deep-vi
export const output = { schema: { type: 'string' }, render: (_args, value) => [{ type: 'text', text: String(value) }] }
export const GROUP_REF = { type: 'string', required: true, description: 'Exact group chat name from list_bots' }
const BLOCKING_QUESTION_TOOL = 'ask_user_question'
-// DS Bot carries no goal across conversation parts, so Bot Sessions do not run DSH goals.
+// DS Bot has its own group goals; DSH's session goal still does not survive conversation parts.
const GOAL_TOOLS = ['create_goal', 'update_goal', 'get_goal']
const HIDDEN_TOOLS = [BLOCKING_QUESTION_TOOL, ...GOAL_TOOLS]
-const GOAL_REFUSAL = 'DS Bot does not run goals. Ask the Bot in a message instead.'
+const GOAL_REFUSAL = 'Bot chats do not run /goal. To give a group a goal, use Set a goal in its + menu.'
const MODE_PARAM = {
type: 'string',
enum: ROOM_MODES,
diff --git a/ds-bot/test/blocking-question.test.js b/ds-bot/test/blocking-question.test.js
index ab789d8e..af8d6aab 100644
--- a/ds-bot/test/blocking-question.test.js
+++ b/ds-bot/test/blocking-question.test.js
@@ -195,7 +195,7 @@ test('a goal started in a Bot chat or a group is blocked; one elsewhere runs', a
await until(() => goals.blocked.length === 3)
await new Promise(resolve => setTimeout(resolve, 20))
assert.deepEqual(goals.blocked.map(entry => entry.sessionId), ['writer', 'room', 'room-writer'])
- for (const entry of goals.blocked) assert.deepEqual([entry.code, entry.message], ['not-supported', 'DS Bot does not run goals. Ask the Bot in a message instead.'])
+ for (const entry of goals.blocked) assert.deepEqual([entry.code, entry.message], ['not-supported', 'Bot chats do not run /goal. To give a group a goal, use Set a goal in its + menu.'])
assert.equal(goals.current.get('plain').phase, 'active')
})