dsh-task-mascot 2.1.1 → 2.1.2
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/README.md +10 -8
- package/lib/client.js +33 -15
- package/lib/index.js +6 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## 安装
|
|
11
11
|
|
|
12
|
-
> 已验证:**DSH 0.2.2-rc.
|
|
12
|
+
> 已验证:**DSH 0.2.2-rc.2**(npm `next`,2026-11-12,Linux · `dsh web`;此前 2.1.1 已在 0.2.2-rc.1 验证安装路径)。要求 dsh ≥ 0.2.0-rc.2、Node ≥ 22.19。
|
|
13
13
|
|
|
14
14
|
**`dsh web`(命令行)**
|
|
15
15
|
|
|
@@ -61,16 +61,18 @@ First match wins (`tool`/`ext` are regexes; `ext` = target file extension). Edit
|
|
|
61
61
|
|
|
62
62
|
| dsh 工具 / tools | 状态 / state | 大肥鱼实际动画 |
|
|
63
63
|
|---|---|---|
|
|
64
|
-
| `write` / `edit` / `str_replace_editor` 且目标是 md/txt/rst/doc/tex | `writingdoc` 写文档 | editing(回退)|
|
|
64
|
+
| `write` / `edit` / `str_replace_editor` / `apply_patch` 且目标是 md/txt/rst/doc/tex | `writingdoc` 写文档 | editing(回退)|
|
|
65
65
|
| `write` | `coding` 写代码 | coding |
|
|
66
|
-
| `edit`, `str_replace_editor` | `editing` 改代码 | editing |
|
|
67
|
-
| `read`, `read_image`, `read_mcp_resource`, `lsp` | `reading` 读文件 | reading |
|
|
66
|
+
| `edit`, `str_replace_editor`, `apply_patch` | `editing` 改代码 | editing |
|
|
67
|
+
| `read`, `read_image`, `read_mcp_resource`, `lsp`, `user_terminal_list`, `user_terminal_read` | `reading` 读文件 | reading |
|
|
68
68
|
| `glob`, `grep`, `session_*`, `web_search`, `web_fetch`, `stagehand_*` | `search` 搜索 | search |
|
|
69
69
|
| `bash`, `pwsh`, `terminal_*`, `job_*` | `cmd` 跑命令 | cmd |
|
|
70
|
-
| `run_code`, `workflow` | `data` 跑数据 | reading(回退)|
|
|
70
|
+
| `run_code`, `workflow`, `office_recalculate` | `data` 跑数据 | reading(回退)|
|
|
71
|
+
| `office_convert`, `office_render` | `writingdoc` 写文档 | editing(回退)|
|
|
71
72
|
| `todo_write`, `exit_plan_mode`, `*_goal`, `schedule_*` | `planning` 做计划 | planning |
|
|
72
|
-
| `subagent`, `send_message`, `list_agents`, `interrupt_agent`, `spawn_teammate`, `team_task_*`, `ralph` | `subagents` 派子代理 | subagents |
|
|
73
|
-
| `ask_user_question` | `waiting`
|
|
73
|
+
| `subagent`, `subagent_fork`, `subagent_oar`, `send_message`, `list_agents`, `interrupt_agent`, `spawn_teammate`, `wait_agent`, `team_task_*`, `ralph` | `subagents` 派子代理 | subagents |
|
|
74
|
+
| `ask_user_question`, `propose_action` | `waiting` 等你确认 | waiting |
|
|
75
|
+
| `list_mcp_resources`, `list_mcp_resource_templates`, `mcp__*` | `mcp` 调用 MCP | tools(回退)|
|
|
74
76
|
| `present` | `summary` 总结 | thinking(回退)|
|
|
75
77
|
| 其它 (MCP 等) / anything else | `tools` | cmd(回退)|
|
|
76
78
|
|
|
@@ -165,7 +167,7 @@ E2E 脚本在 `test/e2e/`(Playwright),截图输出到 `qa/`(已 gitignor
|
|
|
165
167
|
- Swappable character packs (ships Whale Girl 大肥鱼 and Claude娘) and an editable tool→animation mapping. ~13 MB.
|
|
166
168
|
- Runs fully locally; makes no external network calls.
|
|
167
169
|
|
|
168
|
-
Install (verified on **DSH 0.2.2-rc.
|
|
170
|
+
Install (verified on **DSH 0.2.2-rc.2**, Linux, `dsh web`; 2.1.1 was verified on 0.2.2-rc.1; requires dsh ≥ 0.2.0-rc.2, Node ≥ 22.19):
|
|
169
171
|
|
|
170
172
|
- `dsh web`: `dsh plugin --profile web add github:sherconan/dsh-task-mascot` (or the npm package `dsh-task-mascot`), then restart `dsh web`. Or in the UI: **Plugins → Add plugin → `dsh-task-mascot` → Install**, turn on the switch on its card, and refresh.
|
|
171
173
|
- DSH Desktop: Desktop owns its own `desktop` profile, so a `--profile web` install does **not** show up there. Install from Desktop's **Plugins → Add plugin**, or quit Desktop and run its bundled `dsh plugin --profile desktop add dsh-task-mascot`. (Per the [official Desktop docs](https://github.com/deepseek-ai/deepseek-harness/blob/master/apps/desktop/README.md#bundled-command-runtime); not yet tested on Desktop.)
|
package/lib/client.js
CHANGED
|
@@ -19,21 +19,22 @@ window.__ModuleLoader__.load({
|
|
|
19
19
|
{ tool: '^(bash|pwsh)$', cmd: '(^|[;&|]\\s*)(sudo\\s+)?((npm|pnpm|yarn|bun)\\s+(i|install|add|ci)|pip3?\\s+install|uv\\s+(add|pip\\s+install|sync)|apt(-get)?\\s+install|brew\\s+install|cargo\\s+(add|install)|go\\s+get|gem\\s+install|Install-Module)\\b', state: 'install' },
|
|
20
20
|
{ tool: '^(bash|pwsh)$', cmd: '(^|[;&|]\\s*)(curl|wget|aria2c|Invoke-WebRequest|iwr|scp|rsync)\\b', state: 'download' },
|
|
21
21
|
{ tool: '^(bash|pwsh)$', cmd: '(^|[;&|]\\s*)(sudo\\s+)?(rm|rmdir|unlink|del|Remove-Item|shred)\\b', state: 'delete' },
|
|
22
|
-
{ tool: '^(write|edit|str_replace_editor)$', ext: '^(md|mdx|txt|rst|adoc|docx?|tex)$', state: 'writingdoc' },
|
|
22
|
+
{ tool: '^(write|edit|str_replace_editor|apply_patch)$', ext: '^(md|mdx|txt|rst|adoc|docx?|tex)$', state: 'writingdoc' },
|
|
23
23
|
{ tool: '^write$', state: 'coding' },
|
|
24
|
-
{ tool: '^(edit|str_replace_editor)$', state: 'editing' },
|
|
24
|
+
{ tool: '^(edit|str_replace_editor|apply_patch)$', state: 'editing' },
|
|
25
25
|
{ tool: '^read_image$', state: 'media' },
|
|
26
|
-
{ tool: '^(mcp__.*|mcp[_-].*|list_mcp_resources|read_mcp_resource)$', state: 'mcp' },
|
|
27
|
-
{ tool: '^(read|lsp|cordis_inspect_
|
|
26
|
+
{ tool: '^(mcp__.*|mcp[_-].*|list_mcp_resources|read_mcp_resource|list_mcp_resource_templates)$', state: 'mcp' },
|
|
27
|
+
{ tool: '^(read|lsp|cordis_inspect_.*|user_terminal_list|user_terminal_read)$', state: 'reading' },
|
|
28
28
|
{ tool: '^session_.*$', state: 'memory' },
|
|
29
29
|
{ tool: '^(glob|grep)$', state: 'search' },
|
|
30
30
|
{ tool: '^(web_search|web_fetch|stagehand_.*)$', state: 'web' },
|
|
31
31
|
{ tool: '^(create_worktree|load_workspace_dependencies)$', state: 'git' },
|
|
32
32
|
{ tool: '^(bash|pwsh|terminal_.*|job_.*)$', state: 'cmd' },
|
|
33
|
-
{ tool: '^(run_code|workflow)$', state: 'data' },
|
|
33
|
+
{ tool: '^(run_code|workflow|office_recalculate)$', state: 'data' },
|
|
34
|
+
{ tool: '^(office_convert|office_render)$', state: 'writingdoc' },
|
|
34
35
|
{ tool: '^(todo_write|exit_plan_mode|create_goal|get_goal|update_goal|schedule_.*)$', state: 'planning' },
|
|
35
|
-
{ tool: '^(subagent|list_subagent_models|send_message|list_agents|interrupt_agent|spawn_teammate|team_task_.*|ralph)$', state: 'subagents' },
|
|
36
|
-
{ tool: '^ask_user_question$', state: 'waiting' },
|
|
36
|
+
{ tool: '^(subagent|subagent_fork|subagent_oar|list_subagent_models|send_message|list_agents|interrupt_agent|spawn_teammate|wait_agent|team_task_.*|ralph)$', state: 'subagents' },
|
|
37
|
+
{ tool: '^(ask_user_question|propose_action)$', state: 'waiting' },
|
|
37
38
|
{ tool: '^present$', state: 'summary' },
|
|
38
39
|
{ tool: '^(skill|plugin_manager|plugin_market|working_directory)$', state: 'tools' },
|
|
39
40
|
{ tool: '.*', state: 'tools' },
|
|
@@ -162,12 +163,21 @@ window.__ModuleLoader__.load({
|
|
|
162
163
|
const clip = (s, n) => { s = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); n = n || 48; return s.length > n ? s.slice(0, n - 1) + '…' : s; };
|
|
163
164
|
const shortPath = (p) => String(p || '').split(/[\\/]/).filter(Boolean).slice(-2).join('/');
|
|
164
165
|
const extOf = (p) => { const m = /\.([A-Za-z0-9]+)$/.exec(String(p || '')); return m ? m[1].toLowerCase() : undefined; };
|
|
166
|
+
/** Path from write/edit-style args, or from an apply_patch patch body. */
|
|
167
|
+
function toolPath(a) {
|
|
168
|
+
if (!a || typeof a !== 'object') return '';
|
|
169
|
+
const direct = a.file_path || a.path || a.notebook_path;
|
|
170
|
+
if (direct) return String(direct);
|
|
171
|
+
const raw = a.patch || a.input || a.diff || '';
|
|
172
|
+
const m = /\*\*\*\s+(?:Add|Update|Delete|Rename)\s+File:\s+(\S+)/.exec(String(raw));
|
|
173
|
+
return m ? m[1] : '';
|
|
174
|
+
}
|
|
165
175
|
/** Parse possibly-incomplete streamed JSON arguments; falls back to regex-extracting known string fields. */
|
|
166
176
|
function partialArgs(raw) {
|
|
167
177
|
if (raw && typeof raw === 'object') return raw;
|
|
168
178
|
try { const v = JSON.parse(raw); if (v && typeof v === 'object') return v; } catch (_e) { /* partial */ }
|
|
169
179
|
const o = {}; const src = String(raw || '');
|
|
170
|
-
for (const k of ['file_path', 'path', 'pattern', 'command', 'description', 'query', 'url', 'prompt', 'name', 'server', 'tool']) {
|
|
180
|
+
for (const k of ['file_path', 'path', 'pattern', 'command', 'description', 'query', 'url', 'prompt', 'name', 'server', 'tool', 'patch', 'input', 'uri', 'terminal']) {
|
|
171
181
|
const m = new RegExp('"' + k + '"\\s*:\\s*"((?:[^"\\\\]|\\\\.)*)"').exec(src);
|
|
172
182
|
if (m) { let v; try { v = JSON.parse('"' + m[1] + '"'); } catch (_e) { v = m[1].replace(/\\(["\\/])/g, '$1').replace(/\\[nrt]/g, ' '); } o[k] = v; }
|
|
173
183
|
}
|
|
@@ -176,13 +186,13 @@ window.__ModuleLoader__.load({
|
|
|
176
186
|
}
|
|
177
187
|
/** Chinese one-line description of what a tool call is doing (args stay in the browser). */
|
|
178
188
|
function actionText(tool, a) {
|
|
179
|
-
a = a || {}; const t = String(tool || ''); const f = shortPath(a
|
|
189
|
+
a = a || {}; const t = String(tool || ''); const f = shortPath(toolPath(a));
|
|
180
190
|
if (!t) return '准备调用工具…';
|
|
181
191
|
if (/^(mcp__|mcp[_-])/i.test(t)) { const parts = t.replace(/^mcp(__|[_-])/i, '').split(/__|\//); return '调用 MCP: ' + clip(parts.join(' · '), 40); }
|
|
182
192
|
switch (t) {
|
|
183
193
|
case 'read': case 'read_image': return '正在读 ' + (f || '文件');
|
|
184
194
|
case 'write': return '正在写 ' + (f || '文件');
|
|
185
|
-
case 'edit': case 'str_replace_editor': return '正在改 ' + (f || '文件');
|
|
195
|
+
case 'edit': case 'str_replace_editor': case 'apply_patch': return '正在改 ' + (f || '文件');
|
|
186
196
|
case 'grep': return '正在搜索 "' + clip(a.pattern, 30) + '"' + (a.path && a.path !== '.' ? ' @ ' + shortPath(a.path) : '');
|
|
187
197
|
case 'glob': return '正在查找文件 ' + clip(a.pattern, 36);
|
|
188
198
|
case 'web_search': return '正在联网搜索 "' + clip((a.queries && a.queries[0]) || a.query, 30) + '"';
|
|
@@ -190,13 +200,20 @@ window.__ModuleLoader__.load({
|
|
|
190
200
|
case 'bash': case 'pwsh': return a.command ? '运行 ' + clip(a.command, 44) : '准备运行命令…';
|
|
191
201
|
case 'session_search': case 'session_read': case 'session_list': return '翻看历史会话' + (a.query ? ' "' + clip(a.query, 24) + '"' : '');
|
|
192
202
|
case 'list_mcp_resources': return '列出 MCP 资源';
|
|
203
|
+
case 'list_mcp_resource_templates': return '列出 MCP 资源模板';
|
|
193
204
|
case 'read_mcp_resource': return '读取 MCP 资源 ' + clip(a.uri || a.server, 30);
|
|
194
205
|
case 'create_worktree': return '新建 Git worktree';
|
|
195
206
|
case 'wait_agent': return '等子代理回来';
|
|
196
207
|
case 'todo_write': return '正在更新待办' + (Array.isArray(a.todos) ? '(' + a.todos.length + ' 项)' : '');
|
|
197
|
-
case 'subagent': case 'spawn_teammate': return '派出子代理:' + clip(a.description || a.prompt, 36);
|
|
208
|
+
case 'subagent': case 'subagent_fork': case 'subagent_oar': case 'spawn_teammate': return '派出子代理:' + clip(a.description || a.prompt, 36);
|
|
198
209
|
case 'send_message': return '给子代理发消息';
|
|
199
210
|
case 'ask_user_question': return '正在向你提问';
|
|
211
|
+
case 'propose_action': return '正在等你确认';
|
|
212
|
+
case 'user_terminal_list': return '正在查看终端列表';
|
|
213
|
+
case 'user_terminal_read': return '正在读终端输出' + (a.terminal || a.name ? ' ' + clip(a.terminal || a.name, 24) : '');
|
|
214
|
+
case 'office_convert': return '正在转换文档' + (f ? ' ' + f : '');
|
|
215
|
+
case 'office_recalculate': return '正在重算表格' + (f ? ' ' + f : '');
|
|
216
|
+
case 'office_render': return '正在渲染文档' + (f ? ' ' + f : '');
|
|
200
217
|
case 'job_output': return '查看后台任务输出';
|
|
201
218
|
case 'present': return '正在展示交付物';
|
|
202
219
|
case 'lsp': return '查询代码索引';
|
|
@@ -208,6 +225,7 @@ window.__ModuleLoader__.load({
|
|
|
208
225
|
function shellFailed(st, m) {
|
|
209
226
|
if (!/^(bash|pwsh|powershell|shell)$/.test(st.tool)) return false;
|
|
210
227
|
const c = m.content; const txt = typeof c === 'string' ? c : Array.isArray(c) ? c.map((x) => (x && x.text) || '').join('\n') : '';
|
|
228
|
+
if (/\[sandbox: file access denied/i.test(txt)) return true;
|
|
211
229
|
const mm = /\[exit code: (\d+)\]\s*$/.exec(txt); if (!mm || mm[1] === '0') return false;
|
|
212
230
|
return !/^\s*(git\s+diff|diff|cmp|grep|rg|test|\[)\b/.test(String(st.args.command || ''));
|
|
213
231
|
}
|
|
@@ -260,7 +278,7 @@ function resultBrief(message) {
|
|
|
260
278
|
return [st, created];
|
|
261
279
|
}
|
|
262
280
|
function finishStep(st) {
|
|
263
|
-
const path = st.args
|
|
281
|
+
const path = toolPath(st.args);
|
|
264
282
|
let state = stateForTool(st.tool, { ext: extOf(path), command: st.args.command }, compiled);
|
|
265
283
|
// write to a path this session has never read/edited/written -> "create" (decided once, when the path is first known)
|
|
266
284
|
if (st.tool === 'write' && path && st.isNew === undefined) st.isNew = !S.seenPaths.has(path);
|
|
@@ -326,7 +344,7 @@ function resultBrief(message) {
|
|
|
326
344
|
const failed = !!m.isError || shellFailed(st, m);
|
|
327
345
|
st.status = failed ? 'error' : 'ok'; st.endAt = ctx.time; st.result = resultBrief(m) || (failed ? '失败' : '完成');
|
|
328
346
|
S.afterResult = true;
|
|
329
|
-
const path = st.args
|
|
347
|
+
const path = toolPath(st.args); if (path && /^(read|write|edit|str_replace_editor|apply_patch)$/.test(st.tool)) S.seenPaths.add(path);
|
|
330
348
|
if (failed) {
|
|
331
349
|
S.failStreak++; S.lastFail = { sig: sig(st), retry: st.retry || 0 };
|
|
332
350
|
const worried = S.failStreak >= o.worriedN;
|
|
@@ -334,7 +352,7 @@ function resultBrief(message) {
|
|
|
334
352
|
} else {
|
|
335
353
|
S.failStreak = 0; if (S.lastFail && S.lastFail.sig === sig(st)) S.lastFail = null;
|
|
336
354
|
let sub = null;
|
|
337
|
-
if (/^(subagent|spawn_teammate|wait_agent|team_task_(complete|done|update))$/.test(st.tool)) sub = '子任务完成:' + clip(st.args.description || st.args.prompt || st.result, 30);
|
|
355
|
+
if (/^(subagent|subagent_fork|subagent_oar|spawn_teammate|wait_agent|team_task_(complete|done|update))$/.test(st.tool)) sub = '子任务完成:' + clip(st.args.description || st.args.prompt || st.result, 30);
|
|
338
356
|
else if (st.tool === 'todo_write' && Array.isArray(st.args.todos)) {
|
|
339
357
|
const done = st.args.todos.filter((x) => x && /^(completed|done)$/i.test(x.status || '')).length;
|
|
340
358
|
if (done > S.todoDone) sub = '完成一项待办(' + done + '/' + st.args.todos.length + ')';
|
|
@@ -875,7 +893,7 @@ function resultBrief(message) {
|
|
|
875
893
|
}
|
|
876
894
|
exports.apply = apply;
|
|
877
895
|
exports.inject = inject;
|
|
878
|
-
exports.__internals = { DEFAULT_RULES, ALL_STATES, compileRules, stateForTool, resolveState, pickVariant, displayState, createMachine, createTracker, actionText, partialArgs, resultBrief, GLOBAL_FALLBACK, STATE_ZH, STATE_ICON, dexUnlock, dexLit, dexLoad, dex, dockShouldShow, dexToastText, DEFAULT_SETTINGS };
|
|
896
|
+
exports.__internals = { DEFAULT_RULES, ALL_STATES, compileRules, stateForTool, resolveState, pickVariant, displayState, createMachine, createTracker, actionText, partialArgs, resultBrief, toolPath, shellFailed, GLOBAL_FALLBACK, STATE_ZH, STATE_ICON, dexUnlock, dexLit, dexLoad, dex, dockShouldShow, dexToastText, DEFAULT_SETTINGS };
|
|
879
897
|
return module.exports;
|
|
880
898
|
},
|
|
881
899
|
});
|
package/lib/index.js
CHANGED
|
@@ -71,7 +71,12 @@ function summarizeArgs(a) {
|
|
|
71
71
|
if (a == null) return undefined;
|
|
72
72
|
if (typeof a === 'string') { try { a = JSON.parse(a); } catch { return undefined; } }
|
|
73
73
|
if (typeof a !== 'object') return undefined;
|
|
74
|
-
|
|
74
|
+
let p = a.path ?? a.file_path ?? a.filePath ?? a.target;
|
|
75
|
+
if (typeof p !== 'string') {
|
|
76
|
+
const raw = a.patch || a.input || a.diff || '';
|
|
77
|
+
const mm = /\*\*\*\s+(?:Add|Update|Delete|Rename)\s+File:\s+(\S+)/.exec(String(raw));
|
|
78
|
+
p = mm ? mm[1] : undefined;
|
|
79
|
+
}
|
|
75
80
|
if (typeof p !== 'string') return undefined;
|
|
76
81
|
const m = /\.([A-Za-z0-9]{1,8})$/.exec(p);
|
|
77
82
|
return m ? { ext: m[1].toLowerCase() } : undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-task-mascot",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "metsh · Task Mascot — 真跟着 Agent 每一步工具调用在动。A DeepSeek Harness Web plugin whose mascot acts out every live tool call (read / write / edit / search / run / plan / sub-agent / wait / error) with step cards in chat. Swappable character packs (大肥鱼, Claude娘).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|