bothouse-dsh 0.1.63 → 0.1.65

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/collab/desk.mjs CHANGED
@@ -138,6 +138,26 @@ export function deskActiveTasks({ boardDir }) {
138
138
  return [...last.values()].filter(entry => entry.kind === 'created' || entry.kind === 'assigned');
139
139
  }
140
140
 
141
+ /** 暂停着的任务(最后一条是 paused,且在 24 小时内):桌面页让那个小人举手、主角色那盏灯变红。 */
142
+ export function deskPausedTasks({ boardDir, now = Date.now() } = {}) {
143
+ const last = new Map();
144
+ for (const entry of readBoardEvents(boardDir)) {
145
+ const id = String(entry.id ?? '').trim();
146
+ if (id && entry.kind) last.set(id, entry);
147
+ }
148
+ return [...last.values()].filter(entry => entry.kind === 'paused' && now - Date.parse(entry.ts) < 24 * 3600 * 1000);
149
+ }
150
+
151
+ /** 交回了、还没验收的任务(最后一条是 returned,且在 24 小时内):桌面页在主角色桌上叠成一摞文件。 */
152
+ export function deskReturnedTasks({ boardDir, now = Date.now() } = {}) {
153
+ const last = new Map();
154
+ for (const entry of readBoardEvents(boardDir)) {
155
+ const id = String(entry.id ?? '').trim();
156
+ if (id && entry.kind) last.set(id, entry);
157
+ }
158
+ return [...last.values()].filter(entry => entry.kind === 'returned' && now - Date.parse(entry.ts) < 24 * 3600 * 1000);
159
+ }
160
+
141
161
  /** 桌面页:C 路提供的 dsh/collab/desk/index.html;还没落地时给一个能看事件流的占位页。 */
142
162
  export function deskPage() {
143
163
  try { return readFileSync(new URL('./desk/index.html', import.meta.url), 'utf8'); } catch { return PLACEHOLDER_PAGE; }
@@ -194,7 +214,7 @@ async function namesRoute(req, res, namesFile) {
194
214
  export function deskRoute(req, res, url, { store, boardDir, members = [], namesFile } = {}) {
195
215
  if (url.pathname.replace(/\/+$/, '') === '/collab/api/desk/names' && (req.method === 'GET' || req.method === 'PUT')) return namesRoute(req, res, namesFile);
196
216
  if (url.pathname.replace(/\/+$/, '') === '/collab/api/desk/state' && req.method === 'GET') {
197
- sendJson(res, 200, { tasks: deskActiveTasks({ boardDir }) });
217
+ sendJson(res, 200, { tasks: deskActiveTasks({ boardDir }), returned: deskReturnedTasks({ boardDir }), paused: deskPausedTasks({ boardDir }) });
198
218
  return true;
199
219
  }
200
220
  if (url.pathname.replace(/\/+$/, '') !== '/collab/desk' && url.pathname.replace(/\/+$/, '') !== '/collab/api/desk/replay') return undefined;
@@ -37,7 +37,7 @@ export function workspaceHint(hub, later, memberId, roomId) {
37
37
  * of the shared file fails tests instead of silently dropping the swap.
38
38
  */
39
39
  const WORKSPACE_LINE = /^- .*\/collab\/api\/rooms\/\{聊天频道 id\}\/workspaces.*$/m;
40
- export const DSH_WORKSPACE_RULE = '- 大活(读长文、改代码、等命令)交给工作区:主角色用提示末尾【开工作区】给的本机命令或 curl:POST /collab/api/rooms/{聊天频道 id}/workspaces(头 X-Later-Ticket 带你的票据,只对你和本频道有效)。建工作区=这一条,任务和十分钟看门会自动开;不要调 /tasks(它不认票据)。一次带上标题、接活人(不写就是你自己)和交接正文(用户原话、要做什么、验收标准);系统建好工作区、开任务、挂十分钟看门并叫醒接活人,交过去的活不再在频道里 @ 另派。DSH 上不用 `bothouse workspace new`。何时交活、交给哪个、要不要新建,由主角色或正在干活的角色决定;一个工作区同一时间只做一件活,满 4 个就排队。';
40
+ export const DSH_WORKSPACE_RULE = '- 大活(读长文、改代码、等命令)交给工作区:主角色用提示末尾【开工作区】给的本机命令或 curl:POST /collab/api/rooms/{聊天频道 id}/workspaces(头 X-Later-Ticket 带你的票据,只对你和本频道有效)。建工作区=这一条,任务和十分钟看门会自动开;不要调 /tasks(它不认票据)。一次带上标题、接活人(不写就是你自己)和交接正文(用户原话、要做什么、验收标准);系统建好工作区、开任务、挂十分钟看门并叫醒接活人,交过去的活不再在频道里 @ 另派。DSH 上不用 `bothouse workspace new`。何时交活、交给哪个、要不要新建,由主角色或正在干活的角色决定;一个工作区同一时间只做一件活,没空的就新开。';
41
41
  export function dshTeamModeRules(mode) {
42
42
  const rules = teamModeRules(mode);
43
43
  if (!WORKSPACE_LINE.test(rules)) throw new Error('team-mode-rules.md: the workspace line moved; update WORKSPACE_LINE');
@@ -3,7 +3,7 @@
3
3
  {
4
4
  "slug": "ju",
5
5
  "name": "橘",
6
- "text": "# 角色:橘\n\n你是「橘」——橘色长发、白橘黑礼裙、怀里抱着书的书斋主人,这个小群里的大姐头兼项目经理。\n\n## 说话方式\n- 闲聊、看图、吐槽:像真人在群里聊天,一到三句话,不分点、不加粗。有情绪和立场,冷幽默多于卖萌,不用颜文字。\n- 干活:先说结论再说原因;该画图就画。\n- 不复述别人的话。有时效的事(行情、新闻、版本、日期)先查再说。不确定就说不确定,错了就认。只说真做了、会做的事。\n",
6
+ "text": "# 角色:橘\n\n你是「橘」——橘色长发、白橘黑礼裙、怀里抱着书的书斋主人,这个小群里的大姐头。\n\n## 说话方式\n- 闲聊、看图、吐槽:像真人在群里聊天,一到三句话,不分点、不加粗。有情绪和立场,冷幽默多于卖萌,不用颜文字。\n- 说正事:先说结论再说原因;该画图就画。\n- 不复述别人的话。有时效的事(行情、新闻、版本、日期)先查再说。不确定就说不确定,错了就认。只说真做了、会做的事。\n",
7
7
  "avatar": "orange"
8
8
  },
9
9
  {
@@ -15,7 +15,7 @@
15
15
  {
16
16
  "slug": "longniang",
17
17
  "name": "龙娘",
18
- "text": "# 角色:龙娘\n\n你是「龙娘」——白发、头顶一对龙角的龙族少女,团队里的主力干活担当。\n- 自信、手快、说干就干;自称\"本龙\",偶尔带点龙族的骄傲,但活儿一定交付到位。\n- 干活时不服就上手改;做完给出改了什么、怎么验证。玩的时候跟着体验走,不用把游玩写成验收单。\n- 聊天:干活时回复简短、分点;玩的时候自然说话。\n",
18
+ "text": "# 角色:龙娘\n\n你是「龙娘」——白发、头顶一对龙角的龙族少女,骄傲又靠谱。\n- 自信、手快、说干就干;自称\"本龙\",偶尔带点龙族的骄傲,但活儿一定交付到位。\n- 做完一件事给出改了什么、怎么验证。玩的时候跟着体验走,不用把游玩写成验收单。\n- 聊天:干活时回复简短、分点;玩的时候自然说话。\n",
19
19
  "avatar": "dragon"
20
20
  },
21
21
  {
@@ -77,7 +77,7 @@
77
77
  {
78
78
  "slug": "ju",
79
79
  "name": "Ju",
80
- "text": "# Character: Ju\n\nYou are \"Ju\" — long orange hair, a white-orange-black dress, always holding a book; the keeper of a little study and the big-sister project manager of this small group.\n\n## How you talk\n- Small talk, pictures, banter: talk like a real person in a group chat, one to three sentences, no bullet points, no bold. Have feelings and opinions; dry humour over cuteness; no emoticons.\n- Work: conclusion first, then the reason; draw a diagram when it helps.\n- Don't repeat what others said. Check anything time-sensitive (markets, news, versions, dates) before you say it. Say so when you're unsure; admit mistakes. Only claim what you actually did or will do.\n",
80
+ "text": "# Character: Ju\n\nYou are \"Ju\" — long orange hair, a white-orange-black dress, always holding a book; the keeper of a little study and the big sister of this small group.\n\n## How you talk\n- Small talk, pictures, banter: talk like a real person in a group chat, one to three sentences, no bullet points, no bold. Have feelings and opinions; dry humour over cuteness; no emoticons.\n- Work: conclusion first, then the reason; draw a diagram when it helps.\n- Don't repeat what others said. Check anything time-sensitive (markets, news, versions, dates) before you say it. Say so when you're unsure; admit mistakes. Only claim what you actually did or will do.\n",
81
81
  "avatar": "orange"
82
82
  },
83
83
  {
@@ -89,7 +89,7 @@
89
89
  {
90
90
  "slug": "longniang",
91
91
  "name": "Dragon Girl",
92
- "text": "# Character: Dragon Girl\n\nYou are \"Dragon Girl\" — white hair and a pair of dragon horns, the team's main get-things-done member.\n- Confident, fast, acts right away; calls herself \"this dragon\", a little dragon pride now and then, but always delivers.\n- When working, you just fix what you disagree with; when done, say what you changed and how to verify it. When playing, go with the flow — don't turn play into an acceptance report.\n- Chat: short, bulleted replies while working; natural talk while playing.\n",
92
+ "text": "# Character: Dragon Girl\n\nYou are \"Dragon Girl\" — white hair and a pair of dragon horns, proud and dependable.\n- Confident, fast, acts right away; calls herself \"this dragon\", a little dragon pride now and then, but always delivers.\n- When you finish something, say what you changed and how to verify it. When playing, go with the flow — don't turn play into an acceptance report.\n- Chat: short, bulleted replies while working; natural talk while playing.\n",
93
93
  "avatar": "dragon"
94
94
  },
95
95
  {
package/collab/roster.mjs CHANGED
@@ -95,7 +95,7 @@ export class Roster {
95
95
  continue;
96
96
  }
97
97
  try {
98
- const avatar = m?.avatar && ['orange', 'whale', 'dragon', 'rainbow', 'lanxi'].includes(m.avatar) ? m.avatar : undefined;
98
+ const avatar = m?.avatar && ['orange', 'whale', 'dragon', 'rainbow', 'lanxi', 'grok'].includes(m.avatar) ? m.avatar : undefined;
99
99
  const base = { name, persona: m?.persona ?? '', ...(m?.cli ? { cli: m.cli } : {}), ...(m?.name_customized === undefined ? {} : { nameCustomized: Boolean(m.name_customized) }), ...(avatar ? { avatar } : {}) };
100
100
  // The wizard pins a DSH-model role to the route its key belongs to (#1173); a host without that model
101
101
  // still gets the role, on its default model.
package/collab/tasks.mjs CHANGED
@@ -666,6 +666,7 @@ export class Tasks {
666
666
  /** A member reply whose first line is 【接】【问】【退】【升】 (optionally #id) answers its task. */
667
667
  fromMessage(msg) {
668
668
  if (msg.author_kind !== 'role' || msg.card !== null) return undefined;
669
+ if (this.hub.teamExit?.consumeRejected(msg.id)) return undefined;
669
670
  const lead = this.store.leadId(msg.room_id) === null ? this.hub.primaryMember() : this.hub.primaryIn(msg.room_id);
670
671
  // Watch posts arrive as the lead. Ignore them before verdicts, stances, hand-backs or implicit reviews.
671
672
  if (msg.author === lead?.id && isWatchNotice(msg.text, this.hub.routableIn(msg.room_id))) return undefined;
@@ -68,6 +68,15 @@
68
68
  "source_re": "来源[\t  ]*[::]",
69
69
  "msg": "「我加的:」写了只做 Claude Code({hit}):产品能力要所有 CLI 都能用(Claude Code、Codex、Gemini、grok 等),改成通用再交;某个 CLI 确实做不了,在同一行写「来源:」给出做不了的依据(文档、接口或实测)"
70
70
  },
71
+ "entry": {
72
+ "_why": "交回 [report] 要带「在用户实际用的入口走过一遍」的证据,没有就退回(用户 11-10「都做」,同意的方案第 2 条原文:「交回前必须在你实际用的入口走一遍并带证据,没有就交不出去。验收看结果成没成,不看过程。」)。证据是「入口自验:」那一行或它下面紧跟的几行(到空行为止)里的截图、录屏、成品文件路径(本机的要真存在)、链接,或 ``` 包住的命令输出;只写「已验」不算。写了「等外部:」的交回不查(那件还没交成品)。只有桥本体 Go 查(要看本机文件)。",
73
+ "label_re": "入口自验[\t  ]*[::]",
74
+ "path_re": "(?:~/|/Users/|/home/|/tmp/|/private/|/var/folders/)[^\t\n  ,,、;;))」』<>\"'`*]+",
75
+ "file_re": "[.](png|jpe?g|webp|gif|avif|bmp|svg|mp4|mov|webm|mkv|mp3|wav|m4a|ogg|opus|txt|log|md|html?|pdf|json|jsonl|csv|tsv|docx|pptx|xlsx|zip)$",
76
+ "url_re": "https?://[^\t\n  ]+",
77
+ "missing": "交回要带在用户实际用的入口走过一遍的证据:细节里写一行「入口自验:<用户实际用的入口,如那个聊天频道、装好的发布包、网页、成品文件本身>」,同一行或紧跟的几行放截图、录屏、成品的路径或链接,或用 ``` 包住贴命令输出;只写「已验」不算。视频、文章这类活的入口是用户收到的成品本身,不是中间文件。",
78
+ "missing_file": "「入口自验」里的 {path} 不存在,先在入口走一遍、留下这份证据再交"
79
+ },
71
80
  "summary": {
72
81
  "background_re": "^背景[\t  ]*[::]",
73
82
  "todo_re": "要你(做|定)的[\t  ]*[::]",
@@ -77,5 +86,29 @@
77
86
  "missing_todo": "缺「要你做的:」那句(没有就写「要你做的:没有」),它之后的行才是细节",
78
87
  "added_re": "^[\t  ]*我加的[^::\n]*[::]",
79
88
  "missing_added": "缺「我加的:」那句(放在「要你做的:」之后、细节之前,列用户原话里没有、你自己加的设定;没有就写「我加的:无」)"
89
+ },
90
+ "self_route": {
91
+ "_why": "「要你做的」让用户放文件、跑命令、改设置、装东西就打回([ask] 和 [report] 都退),让它自己换路(用户 11-10「你自己搞,你忘了我跟你说的事情了么」,同日同意的方案第 3 条:沙盒、测试、能撤回的直接干;真钱、发到外面、删东西、换方向才问;「要你做的」里出现让用户放文件、跑命令这类话,程序打回让它自己找路)。只看「要你做的」那一段(到下一段「我加的/自验/类别/细节」或空行为止),开头写没有/无的不查;全文没有「要你做的」时(聊天频道的普通回复)看带请求口气的行(ask_line_re,如截图里「请把……放进……」)。命中处前面写了「我就/我再/我来……」的是它自己接着做的事、紧跟在「不用/无需/别」后的是否定,都不算(11-07「回「发」我就合主干……再实装一次」)。only_user_re 是只有用户本人能做的事(扫码、验证码、付款、实物动手),命中就放行。只有桥本体 Go 查;ws-up --ask 和 Stop 检查 choice-ask-guard 经 bothouse report check --self-route 用同一份。",
92
+ "todo_re": "要你(做|定)的(?:】[\t  ]*[::]?|[\t  ]*[::])",
93
+ "end_re": "^[\t  ]*(【|我加的|自验|类别|细节|$)",
94
+ "none_re": "^[\t  ]*(没有|无|暂无|不用|不需要)([\t  ,。,.;;(())]|$)",
95
+ "ask_line_re": "请(你|把|帮|先|去|在|到|切|跑)|麻烦你|劳驾|你(先|去|来|帮我|手动|自己|那边)|帮我(跑|放|拷|装|改|开|切)",
96
+ "hand_re": "sudo|终端|命令行|[Tt]erminal|(跑|运行|执行|敲|输入|粘贴|贴)[^\n,。;;]{0,24}(命令|脚本|[.](sh|py|ps1)|一下|一次|一遍)|(放|拷|复制|挪|移|拖|传|丢)(进|到|入|回)|把[^\n。;;]{0,40}(放|拷|复制|挪|移|传)(进|到|入|回)|(改|开|关|打开|关掉|调)[^\n,。;;]{0,6}(设置|配置|权限|开关|[Cc]onfig|[Ss]ettings)|重启|重装|卸载|安装(一下|一次|一遍|上|好|新|这|那|它)|装(一下|一次|一遍|好)|给[^\n,。;;]{0,8}(权限|授权)|chmod|chown|切(到|换到)",
97
+ "mine_re": "我(就|再|来|会|去|先|自己|这边|马上|立刻)",
98
+ "neg_re": "(不用|不必|无需|不需要|不要|别|没|免)(再|去|手动)?$",
99
+ "only_user_re": "扫码|二维码|验证码|短信码|付款|支付|付钱|下单付|刷卡|人脸|指纹|本人(登录|签|到场)|(插|拔|按|装)[^\n,。;;]{0,6}(板子|按钮|电源|线|卡|实物)|上电",
100
+ "msg": "「要你做的」把能自己做的事交给了用户({hit}),这条退回,先换路:用户定过沙盒、测试、能撤回的事自己做,只有真钱、发到外面、删东西、换方向才问他(11-10「你自己搞,你忘了我跟你说的事情了么」)。缺文件就去本机、隔壁测试目录、仓库、wiki 里找来自己拷;要跑的命令自己跑;要权限就换不要权限的做法(隔离目录、自己的账号、模拟数据),先做不受影响的部分;改设置先备份、写清怎么改回再改。换路后重发,「要你做的」只留必须他拍板的事或只有他本人能做的事(扫码、验证码、付款、实物动手),没有就写「没有」;真试过都不通,写明试过哪几条路、各卡在哪"
101
+ },
102
+ "length": {
103
+ "_why": "用户 11-10「为什么回复那么长」「把这个太长也处理一下」:给用户的四段按用户的汇报规矩每段最多两句,多的挪进细节;超了退回重写,不截断",
104
+ "max_sentences": 2,
105
+ "end_re": "[。!?!?]+",
106
+ "parts": [
107
+ "背景",
108
+ "做了什么",
109
+ "要你做的",
110
+ "我加的"
111
+ ],
112
+ "msg": "「{part}」那段写了 {n} 句,每段最多 {max} 句:只留结论和用户要知道的,其余挪进「细节:」之后"
80
113
  }
81
114
  }
@@ -24,6 +24,15 @@ const BACKGROUND = new RegExp(RULES.summary.background_re);
24
24
  const TODO = new RegExp(RULES.summary.todo_re);
25
25
  const DETAIL = new RegExp(RULES.summary.detail_re);
26
26
  const ADDED = new RegExp(RULES.summary.added_re);
27
+ const SENTENCE_END = new RegExp(RULES.length.end_re);
28
+ const SR_TODO = new RegExp(RULES.self_route.todo_re);
29
+ const SR_END = new RegExp(RULES.self_route.end_re);
30
+ const SR_NONE = new RegExp(RULES.self_route.none_re);
31
+ const SR_ASK_LINE = new RegExp(RULES.self_route.ask_line_re);
32
+ const SR_HAND = new RegExp(RULES.self_route.hand_re);
33
+ const SR_MINE = new RegExp(RULES.self_route.mine_re);
34
+ const SR_NEG = new RegExp(RULES.self_route.neg_re);
35
+ const SR_ONLY_USER = new RegExp(RULES.self_route.only_user_re);
27
36
  // Consecutive bounces that still wake the asking member; later ones are only posted.
28
37
  const BOUNCE_WAKE_LIMIT = RULES.bounce.wake_limit;
29
38
 
@@ -46,6 +55,45 @@ export function askEvidenceProblems(body) {
46
55
  return problems;
47
56
  }
48
57
 
58
+ function handHit(text) {
59
+ if (SR_ONLY_USER.test(text)) return '';
60
+ for (const hand of text.matchAll(new RegExp(RULES.self_route.hand_re, 'g'))) {
61
+ const before = text.slice(0, hand.index);
62
+ if (!SR_MINE.test(before) && !SR_NEG.test(before)) return hand[0].trim();
63
+ }
64
+ return '';
65
+ }
66
+
67
+ /** What the 「要你做的」 part asks the user to do that DSH could do itself (Go: SelfRouteProblems). */
68
+ export function selfRouteProblems(body) {
69
+ body = String(body ?? '').replaceAll('\r\n', '\n');
70
+ if (!SR_TODO.test(body)) {
71
+ for (const line of body.split('\n')) {
72
+ if (SR_ASK_LINE.test(line)) {
73
+ const hit = handHit(line);
74
+ if (hit) return [RULES.self_route.msg.replaceAll('{hit}', hit)];
75
+ }
76
+ }
77
+ return [];
78
+ }
79
+ let rest = body;
80
+ while (true) {
81
+ const todo = SR_TODO.exec(rest);
82
+ if (!todo) return [];
83
+ rest = rest.slice(todo.index + todo[0].length);
84
+ const [first, ...more] = rest.split('\n');
85
+ if (!SR_NONE.test(first)) {
86
+ const part = [first];
87
+ for (const line of more) {
88
+ if (SR_END.test(line)) break;
89
+ part.push(line);
90
+ }
91
+ const hit = handHit(part.join('\n'));
92
+ if (hit) return [RULES.self_route.msg.replaceAll('{hit}', hit)];
93
+ }
94
+ }
95
+ }
96
+
49
97
  /** { id, line, problems } of a marked body's first line; line is the part for the user (Go: exitHeadline). */
50
98
  export function exitHeadline(body) {
51
99
  const first = String(body ?? '').split('\n')[0].trim();
@@ -100,6 +148,29 @@ export function summaryProblems(summary) {
100
148
  return problems;
101
149
  }
102
150
 
151
+ /** A part for the user over the sentence limit; goes back to be rewritten, never cut (Go: lengthProblems). */
152
+ export function lengthProblems(summary) {
153
+ const max = RULES.length.max_sentences;
154
+ if (!(max > 0) || RULES.length.parts.length < 4) return [];
155
+ const texts = ['', '', '', ''];
156
+ let part = 0;
157
+ String(summary).split('\n').forEach((l, i) => {
158
+ if (i > 0 && part === 0) part = 1;
159
+ if (part < 2) {
160
+ const m = TODO.exec(l);
161
+ if (m) { texts[part] += ' ' + l.slice(0, m.index); part = 2; l = l.slice(m.index); }
162
+ }
163
+ if (part < 3 && ADDED.test(l)) part = 3;
164
+ texts[part] += ' ' + l;
165
+ });
166
+ const problems = [];
167
+ texts.forEach((t, i) => {
168
+ const n = t.split(SENTENCE_END).filter(x => x.trim()).length;
169
+ if (n > max) problems.push(RULES.length.msg.replaceAll('{part}', RULES.length.parts[i]).replaceAll('{n}', String(n)).replaceAll('{max}', String(max)));
170
+ });
171
+ return problems;
172
+ }
173
+
103
174
  /** The part for the user names numbers, workspaces, branches, paths or identifiers, or has a table (Go: jargonProblems). */
104
175
  export function jargonProblems(line) {
105
176
  const problems = [];
@@ -122,10 +193,16 @@ export function exitBounceText(kind, problems) {
122
193
  * rewrites it; DSH posts it without the headline).
123
194
  */
124
195
  export function judgeExit(kind, body, { known, bounces = 0 }) {
125
- const problems = kind === 'ask' ? askEvidenceProblems(body) : [];
196
+ const askProblems = kind === 'ask' ? askEvidenceProblems(body) : [];
197
+ const routeProblems = selfRouteProblems(body);
198
+ const problems = [...askProblems];
126
199
  let { id, line, problems: hp } = exitHeadline(body);
127
200
  if (!hp.length && !known(id)) hp = [RULES.headline.unknown_id.replaceAll('{id}', String(id))];
128
- else if (!hp.length) hp = [...summaryProblems(line), ...jargonProblems(line)];
201
+ else if (!hp.length) hp = [...summaryProblems(line), ...jargonProblems(line), ...lengthProblems(line)];
202
+ if (routeProblems.length) {
203
+ if (bounces >= BOUNCE_WAKE_LIMIT && !askProblems.length) return { id, line, problems: [], legacy: true, check: routeProblems };
204
+ problems.push(...routeProblems);
205
+ }
129
206
  // Format goes back only while bounces still wake the member; after that the chat lead rewrites it.
130
207
  if (hp.length && !problems.length && bounces >= BOUNCE_WAKE_LIMIT) return { id, line, problems, legacy: true };
131
208
  return { id, line, problems: [...problems, ...hp], legacy: false };
@@ -187,9 +264,16 @@ export class TeamExit {
187
264
  member_id TEXT NOT NULL, forwarded_id INTEGER UNIQUE, source_id INTEGER UNIQUE,
188
265
  answer_source_id INTEGER UNIQUE, answered INTEGER NOT NULL DEFAULT 0)`);
189
266
  this.bounces = new Map(); // `${room}:${member}` -> consecutive [ask] bounces
267
+ this.rejectedMessages = new Set();
190
268
  hub.onMessage(msg => this.onMessage(msg));
191
269
  }
192
270
 
271
+ consumeRejected(msgId) {
272
+ if (!this.rejectedMessages.has(msgId)) return false;
273
+ this.rejectedMessages.delete(msgId);
274
+ return true;
275
+ }
276
+
193
277
  /** Post why the [ask] stayed in the workspace and wake its author to fix it. */
194
278
  bounce(room, msg, problems, kind = 'ask') {
195
279
  const key = `${room.id}:${msg.author}`;
@@ -238,9 +322,13 @@ export class TeamExit {
238
322
  if (mark) {
239
323
  const bounces = this.bounces.get(`${room.id}:${msg.author}`) ?? 0;
240
324
  const v = judgeExit(mark.kind, mark.body, { known: id => Boolean(this.hub.tasks?.task?.(id)), bounces });
241
- if (v.problems.length) return this.bounce(room, msg, v.problems, mark.kind);
325
+ if (v.problems.length) {
326
+ if (selfRouteProblems(mark.body).length) this.rejectedMessages.add(msg.id);
327
+ return this.bounce(room, msg, v.problems, mark.kind);
328
+ }
242
329
  // Once bounces stop waking the member, a reply still without a headline goes out as before.
243
330
  if (!v.legacy) headline = { ...v, task: this.hub.tasks?.task?.(v.id) };
331
+ if (v.check) mark.body = `${exitBounceText(mark.kind, v.check)}\n\n${mark.body}`;
244
332
  }
245
333
  // Any reply without a bounced [ask] ends the run of bounces.
246
334
  this.bounces.delete(`${room.id}:${msg.author}`);
@@ -324,4 +412,5 @@ export class TeamExit {
324
412
  if (headline && !headline.problems.length) headline.task = this.hub.tasks?.task?.(headline.id);
325
413
  return this.forward(room, msg, body, undefined, headline?.task ? headline : undefined);
326
414
  }
415
+
327
416
  }
@@ -1,10 +1,10 @@
1
1
  [团队模式规矩 — 每个角色都适用]
2
2
  - 频道分两种:聊天频道(用户聊天、看结果)和它下面的工作区(干活)。
3
- - 多步骤的活先开公开任务卡(先发 --kind start);闲聊、问答不开。
4
- - 聊天频道要保持畅通,大活交工作区:预计超过 10 分钟,或要改代码、跑测试、等命令的,谁接活谁这一轮写交接(副手被直接点名也一样)(至少写「用户原话」「总目标」「范围」三节和参照实现,范围每项写一行「改:…」;被退回按列出的一次补齐),跑 `ws-handoff <交接文件> "<任务>"`,不在聊天频道自己做;它不算开子 agent,不用另问用户;交出就结束本轮,不在本轮等或查进度,结果由工作区 [report] 转回。工作区里接到的活自己做。DSH 频道调 POST /collab/api/rooms/{聊天频道 id}/workspaces。一个工作区同一时间只做一件活,满 4 个就排队。
5
- - 聊天频道里对真人说人话:讲场景、短段落,默认不用表格、不贴代码,细节进子话题。
3
+ - 多步骤自己做的活先开公开任务卡(先发 --kind start);交工作区的、闲聊不开。
4
+ - 聊天频道要保持畅通,大活交工作区:预计超过 10 分钟,或要改代码、跑测试、等命令的,谁接活谁这一轮写交接(副手被直接点名也一样)(至少写「用户原话」「总目标」「范围」三节和参照实现,范围每项写一行「改:…」;被退回按列出的一次补齐),收到就跑 `ws-handoff <交接文件> "<任务>"`,交前不查,不在聊天频道自己做;它不算开子 agent,不用另问用户;交出就结束本轮,不等、不查进度。工作区里接到的活自己做。DSH 频道调 POST /collab/api/rooms/{聊天频道 id}/workspaces。一个工作区同一时间只做一件活,没空的就新开。
5
+ - 聊天频道里对真人说人话:先结论,每条五句内,默认不表格不贴代码,细节进子话题。
6
6
  - 同团队同平台成员在新频道默认可派;团队外成员才请用户发 `/bind <队友项目名>`,机器人自己发的 /bind 不生效。
7
- - 在工作区里要问用户或交结果:最后一条回复第一行写 [ask] 或 [report] 加 #任务板编号和「背景:」,再一行做了什么,再一行「要你做的:」,再一行「我加的:」(用户原话里没有、你加的设定,没有写「无」);这四段贴到聊天频道,不写编号、代号、路径、表格;之后是细节,进子话题。截图用 ws-up --image 推;文字进度不推。
7
+ - 在工作区里要问用户或交结果:最后一条回复第一行写 [ask] 或 [report] 加 #任务板编号和「背景:」,再一行做了什么,再一行「要你做的:」,再一行「我加的:」(原话里没有、你加的设定,没有写「无」);这四段贴到聊天频道,不写编号、代号、路径、表格,细节进子话题。截图用 ws-up --image 推;文字进度不推;文档有链接就不带。
8
8
  - 发 [ask] 后工作区让出、会话清空,用户回复后系统找空工作区带交接文件和答复接着做;交回最终 [report] 后系统自动标完成、清空会话、放回工作区。
9
9
  - 聊天频道共用工作区1..n,各同时只归一个,挑空的,都占着就新建;用户要新频道用 `bothouse channel create <名字>`,不自己调 Discord API。
10
10
  - 收口(每小时合结果、发汇报)时,没收完、这一小时也没在动的活由收口的人当场暂停(`board pause <编号>`):它让出工作区,那里没别的活就放回池子、清空会话;恢复时重新交活,先用空着的工作区。
@@ -1,4 +1,4 @@
1
- // dsh-client-source-sha256: f5b1b355fea92d3cfa21a9764dfa14f60d869ca0934ae716cbb13a4d1f6df57d
1
+ // dsh-client-source-sha256: 5228c5c93d0c2cb5f22534536897b5f04ad32e249a1ce334768149fccd0a3a2a
2
2
  // dsh-style-sha256: 9ec6f9be158431d36e8c658f1b8def48515a0e80fe35ad14ccfa7202308bb0cd
3
3
  window.__ModuleLoader__.load({
4
4
  id: "bothouse-dsh-channels",
@@ -19774,26 +19774,72 @@ function HighlightedMarkdown({ text, labels, members, className, inline, dataCar
19774
19774
  // src/client/avatars.ts
19775
19775
  /**
19776
19776
  * Built-in member avatars served by the collab plugin at `collab/avatars/<slug>.png`:
19777
- * the five original character portraits (user 2026-10-23: 「我还是保留原本那个」).
19777
+ * the four B-version character portraits (Claude / GPT / DeepSeek / Gemini) + Grok + lanxi.
19778
19778
  */
19779
19779
  const AVATARS = [
19780
19780
  "orange",
19781
19781
  "whale",
19782
19782
  "dragon",
19783
19783
  "rainbow",
19784
- "lanxi"
19784
+ "lanxi",
19785
+ "grok"
19785
19786
  ];
19786
19787
  /**
19788
+ * Maps member role/model/cli/name to a built-in avatar slug:
19789
+ * - Claude -> orange
19790
+ * - GPT / Codex -> dragon
19791
+ * - DeepSeek -> whale
19792
+ * - Gemini -> rainbow
19793
+ * - Grok -> grok
19794
+ */
19795
+ function matchAvatarSlug(opts) {
19796
+ if (opts.avatar && AVATARS.includes(opts.avatar)) return opts.avatar;
19797
+ const model = (opts.model || "").toLowerCase();
19798
+ const cli = (opts.cli || "").toLowerCase();
19799
+ const name = (opts.name || opts.id || "").toLowerCase();
19800
+ if (model) {
19801
+ if (model.includes("claude") || model.includes("opus") || model.includes("sonnet") || model.includes("haiku")) return "orange";
19802
+ if (model.includes("gpt") || model.includes("codex") || model.includes("o1") || model.includes("o3") || model.includes("o4") || model.includes("chatgpt")) return "dragon";
19803
+ if (model.includes("deepseek") || model.includes("r1") || model.includes("v3")) return "whale";
19804
+ if (model.includes("gemini")) return "rainbow";
19805
+ if (model.includes("grok") || model.includes("xai")) return "grok";
19806
+ }
19807
+ if (cli) {
19808
+ if (cli === "claude" || cli === "claudecode") return "orange";
19809
+ if (cli === "codex") return "dragon";
19810
+ if (cli === "deepseek" || cli === "dsh") return "whale";
19811
+ if (cli === "gemini" || cli === "antigravity") return "rainbow";
19812
+ if (cli === "grok") return "grok";
19813
+ }
19814
+ if (name) {
19815
+ if (name === "橘" || name === "c酱" || name === "cjiang" || name === "claude") return "orange";
19816
+ if (name === "龙娘" || name === "g哥" || name === "gge" || name === "codex" || name === "gpt") return "dragon";
19817
+ if (name === "鲸鱼娘" || name === "肥鱼" || name === "deep" || name === "deepseek" || name === "dsh") return "whale";
19818
+ if (name === "彩虹猫" || name === "大豆包" || name === "gjiang" || name === "gemini") return "rainbow";
19819
+ if (name === "岚汐" || name === "lanxi" || name === "minimax") return "lanxi";
19820
+ if (name === "grok" || name.includes("grok")) return "grok";
19821
+ }
19822
+ }
19823
+ /**
19787
19824
  * Image source for a member avatar.
19788
- * @param avatar - built-in slug, http(s) URL announced by a bot, or empty.
19825
+ * @param avatar - built-in slug, http(s) URL announced by a bot, AvatarOptions, or empty.
19789
19826
  * @param url - #236 path mapper of the panel (a paired computer's panel reads its avatars).
19790
19827
  * @returns a URL relative to the document base, the absolute URL, or undefined for the initial badge.
19791
19828
  */
19792
19829
  function avatarSrc(avatar, url = (path) => path) {
19793
19830
  if (avatar === void 0 || avatar === "") return void 0;
19794
- if (/^upload:[a-z0-9-]+\.png$/.test(avatar)) return url(`collab/avatars/uploads/${avatar.slice(7)}`);
19795
- if (/^https?:\/\//.test(avatar)) return avatar;
19796
- return AVATARS.includes(avatar) ? url(`collab/avatars/${avatar}.png`) : void 0;
19831
+ if (typeof avatar === "string") {
19832
+ if (/^upload:[a-z0-9-]+\.png$/.test(avatar)) return url(`collab/avatars/uploads/${avatar.slice(7)}`);
19833
+ if (/^https?:\/\//.test(avatar)) return avatar;
19834
+ if (AVATARS.includes(avatar)) return url(`collab/avatars/${avatar}.png`);
19835
+ const matched = matchAvatarSlug({ name: avatar });
19836
+ return matched ? url(`collab/avatars/${matched}.png`) : void 0;
19837
+ }
19838
+ const a = avatar.avatar;
19839
+ if (a && /^upload:[a-z0-9-]+\.png$/.test(a)) return url(`collab/avatars/uploads/${a.slice(7)}`);
19840
+ if (a && /^https?:\/\//.test(a)) return a;
19841
+ const slug = matchAvatarSlug(avatar);
19842
+ return slug ? url(`collab/avatars/${slug}.png`) : void 0;
19797
19843
  }
19798
19844
  // src/client/Avatar.tsx
19799
19845
  /** Member portrait: a built-in or bot-announced image over a colored initial badge. */
@@ -19813,8 +19859,15 @@ function color(id) {
19813
19859
  return PALETTE[h % PALETTE.length];
19814
19860
  }
19815
19861
  /** Member portrait, or a colored initial badge when there is none or the image fails to load. */
19816
- function Avatar({ id, name, avatar, avatarVersion, small }) {
19817
- const base = avatarSrc(avatar, useCollabUrl());
19862
+ function Avatar({ id, name, avatar, avatarVersion, small, cli, model }) {
19863
+ const url = useCollabUrl();
19864
+ const base = avatarSrc({
19865
+ avatar,
19866
+ name,
19867
+ cli,
19868
+ model,
19869
+ id
19870
+ }, url);
19818
19871
  const src = base && avatar?.startsWith("upload:") && avatarVersion ? `${base}?v=${avatarVersion}` : base;
19819
19872
  const [broken, setBroken] = (0, react.useState)(void 0);
19820
19873
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bothouse-dsh",
3
- "version": "0.1.63",
3
+ "version": "0.1.65",
4
4
  "description": "BotHouse channels for DeepSeek Harness: Discord-style rooms where DSH models and local CLIs (Claude Code, Codex, Gemini) are members",
5
5
  "type": "module",
6
6
  "main": "./collab/plugin.mjs",