bothouse-dsh 0.1.64 → 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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bothouse-dsh",
3
- "version": "0.1.64",
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",