ai_co_discuss 0.5.34 → 0.5.35

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.
@@ -275,6 +275,53 @@ def member_stats(rows, requests, revived, by_model=False):
275
275
  return list(groups.values())
276
276
 
277
277
 
278
+ def workflow_stats(connection, rows):
279
+ """Executions run under a room workflow, grouped by workflow ID (current rooms only).
280
+
281
+ The runner reports each delivery's workflow binding into the execution's diagnostics; an execution that reported
282
+ several keeps its last one. Card and sub-workflow counts say which parts of the workflow actually ran.
283
+ """
284
+ ids = [r["id"] for r in rows]
285
+ bound = {}
286
+ for offset in range(0, len(ids), 500):
287
+ chunk = ids[offset:offset + 500]
288
+ marks = ",".join("?" * len(chunk))
289
+ for execution_id, details in connection.execute(
290
+ f"SELECT execution_id,details FROM execution_diagnostics WHERE execution_id IN ({marks})", chunk):
291
+ try:
292
+ bindings = [item for item in json.loads(details).get("workflow_bindings") or [] if item]
293
+ except (TypeError, ValueError, AttributeError):
294
+ continue
295
+ if bindings:
296
+ bound[execution_id] = bindings[-1]
297
+ groups = {}
298
+ for r in rows:
299
+ binding = bound.get(r["id"])
300
+ if not binding:
301
+ continue
302
+ item = groups.setdefault(binding["id"], dict(id=binding["id"], executions=0, completed=0, failed=0, cancelled=0,
303
+ interrupted=0, rooms=set(), cards=Counter(), sub_workflows=Counter(),
304
+ durations=[]))
305
+ item["executions"] += 1
306
+ if r["status"] in ("completed", "failed", "cancelled"):
307
+ item[r["status"]] += 1
308
+ item["interrupted"] += r["status"] == "cancelled" and r["result"] in ("用户打断", "用户停止全部")
309
+ item["rooms"].add(r["room_id"])
310
+ if binding.get("card"):
311
+ item["cards"][binding["card"]] += 1
312
+ if binding.get("sub_workflow"):
313
+ item["sub_workflows"][binding["sub_workflow"]] += 1
314
+ if r["finished_at"] >= r["created_at"] and r["finished_at"]:
315
+ item["durations"].append(r["finished_at"] - r["created_at"])
316
+ result = []
317
+ for item in groups.values():
318
+ item["rooms"] = len(item["rooms"])
319
+ item["cards"], item["sub_workflows"] = dict(item["cards"]), dict(item["sub_workflows"])
320
+ item["duration"] = distribution(item.pop("durations"))
321
+ result.append(item)
322
+ return sorted(result, key=lambda item: (-item["executions"], item["id"]))
323
+
324
+
278
325
  def insights(connection, members, start, end):
279
326
  """Return observed counts with denominators and drill-down keys."""
280
327
  result = []
@@ -298,15 +345,17 @@ def time_stats(connection, requests, executions, bounds, now, sealed):
298
345
  """Summarize folder activity, observed waiting and the current message queue."""
299
346
  start, end = bounds
300
347
  counts, histograms = sealed
301
- folders, room_folder = {}, {}
302
- for room, folder, name in connection.execute("""SELECT r.id,f.id,f.name FROM rooms r
348
+ folders, room_folder, room_rows = {}, {}, {}
349
+ for room, title, folder, name in connection.execute("""SELECT r.id,r.title,f.id,f.name FROM rooms r
303
350
  LEFT JOIN room_folder_assignments a ON a.room_id=r.id LEFT JOIN topic_folders f ON f.id=a.folder_id"""):
304
351
  room_folder[room] = folder
305
352
  folders.setdefault(folder, dict(folder_id=folder, name=name, initiated=0, execution_seconds=0))
353
+ room_rows[room] = dict(room_id=room, title=title, folder_id=folder, initiated=0, execution_seconds=0)
306
354
  seen, waits = set(), []
307
355
  for r in requests:
308
356
  if r["initiated"] and start <= r["sent"] < end and r["message_id"] not in seen:
309
357
  folders[room_folder[r["room_id"]]]["initiated"] += 1
358
+ room_rows[r["room_id"]]["initiated"] += 1
310
359
  seen.add(r["message_id"])
311
360
  if start <= r["created_at"] < end and r["dispatched"] is not None and r["dispatched"] >= r["created_at"]:
312
361
  waits.append(r["dispatched"] - r["created_at"])
@@ -318,6 +367,7 @@ def time_stats(connection, requests, executions, bounds, now, sealed):
318
367
  spans[r["room_id"]].append((left, right))
319
368
  member_spans[(r["room_id"], r["name"])].append((left, right))
320
369
  folders[room_folder[r["room_id"]]]["execution_seconds"] += right-left
370
+ room_rows[r["room_id"]]["execution_seconds"] += right-left
321
371
  if start <= r["created_at"] and r["finished_at"] >= r["created_at"] and r["finished_at"]:
322
372
  duration = r["finished_at"] - r["created_at"]
323
373
  elapsed.append(duration)
@@ -327,7 +377,8 @@ def time_stats(connection, requests, executions, bounds, now, sealed):
327
377
  rooms, rooms_at = peak_concurrent(spans)
328
378
  members, members_at = peak_concurrent(member_spans)
329
379
  peak = {"rooms": rooms, "at": rooms_at, "members": members, "members_at": members_at}
330
- return {"folders": list(folders.values()), "peak": peak, "sealed_execution_seconds": counts["execution_seconds"],
380
+ active_rooms = [room for room in room_rows.values() if room["initiated"] or room["execution_seconds"]]
381
+ return {"folders": list(folders.values()), "rooms": active_rooms, "peak": peak, "sealed_execution_seconds": counts["execution_seconds"],
331
382
  "execution_seconds": sum(f["execution_seconds"] for f in folders.values()) + counts["execution_seconds"],
332
383
  "waiting": distribution(waits, histograms["waiting"]),
333
384
  "execution": distribution(elapsed, histograms["execution"]), "rework": distribution(rework, histograms["rework"]),
@@ -520,11 +571,12 @@ def snapshot(connection, params, cache, now):
520
571
  scope = {"mode": mode, "rooms": len(rooms), "sealed_rooms": retained, "included_rooms": len(rooms) + retained,
521
572
  "includes_archived": True, "sealed_day_tz": "UTC", "sealed_counts": SEALED_COUNTS,
522
573
  "sealed_distributions": SEALED_DISTRIBUTIONS,
523
- "current_only": ["folders", "peak", "queue", "affected_requests", "members", "models", "insights"]}
574
+ "current_only": ["folders", "rooms", "peak", "queue", "affected_requests", "members", "models", "workflows", "insights"]}
524
575
  result = dict(range=dates, scope=scope,
525
576
  overview=overview(facts, start, end, sealed), previous=overview(facts, previous, start, prior),
526
577
  time={**time_stats(connection, requests, executions, (start, end), now, sealed), **activity},
527
- members=members, models=models, insights=insights(connection, members, start, end))
578
+ members=members, models=models, workflows=workflow_stats(connection, attempts),
579
+ insights=insights(connection, members, start, end))
528
580
  result["overview"]["daily"] = daily_overview(dates, facts, executions, sealed_days, now)
529
581
  if len(cache) >= CACHE_ENTRIES:
530
582
  cache.clear()
@@ -13,7 +13,7 @@ Use the local management panel or the corresponding codiscuss admin commands to
13
13
  - **Settings:** View the installed version, select **Check for updates** or **Update and restart** (which also updates room skills and isolated accounts), enable **Start when signing in to Windows**, and change the panel language.
14
14
  - **Storage:**
15
15
  - View local `.codiscuss` data usage against the 10 GiB limit (excluding speech models), total drafts against 3 GiB (1 GiB per room), **Room records & attachments (`local/`)**, disk free space and safety reserve, per-room and per-member breakdowns, and any unreadable entries. Local TTS and STT models are listed separately and excluded from the 10 GiB cap (covering both legacy and custom model paths, including when the service home itself is a symlink or junction).
16
- - When `.codiscuss` data reaches the 8 GiB warning threshold, the **Storage** tab shows a warning dot and displays a notice; exceeding a limit or dropping below the disk safety reserve pauses new runs. Select **Clear temporary files** to remove only confirmed finished execution `.scratch` folders without touching room records, attachments, deliverables or old drafts.
16
+ - When `.codiscuss` data reaches the 8 GiB warning threshold, the **Storage** tab shows a warning dot and displays a notice; exceeding a limit or dropping below the disk safety reserve pauses new runs. The total is split into five named directories and Other. **Safe cleanup** removes registered failed scratch, speech cache entries, empty orphan directories, stale launches containing only setup records, and local execution files more than 24 hours after completion. After clearing the speech cache, replaying old content with cloud speech synthesizes it again and incurs a new charge. **Deep repair** estimates space before you select and confirm deletion of finished logs, including the last day.
17
17
  - **Recovery and limits:** While a room is blocked, its host cannot run either—to clean older drafts, run `$codiscuss-draft-cleanup` in an **AI chat outside the room** (it audits first and deletes rebuildable copies only after your confirmation). Room records and attachments in `local/` are never deleted automatically; export a backup and destroy old rooms to reclaim that space. Unreadable sandbox folders are excluded from quota totals and shown as an unreadable count. Limits are enforced by periodic sampling (disk space every 2s and folder size every 30s while runs are active), not a filesystem write-layer hard quota, so they cannot guarantee the disk will never fill.
18
18
  During active runs, the service checks free space on its own volume every two seconds. While part of the 10 GiB budget remains, a drop in free space as large as that remainder triggers an early scan. When a run ends, the service updates that member’s draft usage. A manual retry after cleanup rechecks the limit that blocked the run. If a machine-wide limit was exceeded, the service measures machine-wide usage again. If another program writes to the volume, runs continue when measured usage is within limits and the unreadable count is stable. If an early scan finds more unreadable entries, dispatch pauses and the service requests stops for stoppable runs. Dispatch resumes when a later scan finds a stable count, usage within limits and enough free disk space. The low-disk reserve applies independently. At 80% of the room draft limit, new runs without confirmed stop support are paused. Writes can continue between and during scans, and ongoing unstoppable runs can keep writing. Project files, system temporary files and third-party AI data outside the service directory are excluded. Follow the cleanup instructions on the failed run’s card, then select “Retry” on that card from the computer or a paired device.
19
19
  - **Account:**
@@ -59,7 +59,7 @@ Every command in the table is prefixed by codiscuss admin and returns JSON. Thes
59
59
  | --- | --- |
60
60
  | Start, exit, restart, or update (panel need not be running) | `codiscuss admin start`, `stop`, `restart`, `update [check]` |
61
61
  | Check status, control service, configure sign-in startup | `status [--full]`, `service start\|stop\|restart`, `autostart on\|off` |
62
- | Inspect storage usage and clear temporary run files | `storage`, `storage clean` |
62
+ | Inspect storage usage and clear temporary run files | `storage`, `storage clean`, `storage repair` (preview), `storage repair logs --confirm` |
63
63
  | Link/unlink online site and create access code | `site status`, `site connect <access-code\|site>`, `site disconnect`, `entry code` |
64
64
  | Manage sign-in entry and tunnel | `entry start\|stop`, `entry join <access-code>`, `entry open\|close relay\|tunnel`, `entry tunnel <domain>` |
65
65
  | Manage hosted account lifecycle | `account list`, `account add <name>`, `account start\|stop\|disable\|enable\|remove\|password <name>`, `account isolate\|protect <name>` |
@@ -19,9 +19,10 @@ At the top, switch between "Today", "Last 7 days", "Last 30 days" and "All time"
19
19
  - **Peak concurrency**: the most rooms and experts running at the same moment, and when the expert peak happened. For rooms, several members running in one room count as one room; for experts, every running member counts.
20
20
  - **Total AI execution time**: execution time summed across members, so it exceeds the time that passed when several run at once.
21
21
  2. **Worth a look**: anomalies picked by fixed rules (repeated failures, permission blocks, late answers after a failure, negative smart-scheduling feedback), listed only when they happen at least 3 times in at least 10 runs. Click an item to open its room.
22
- 3. **Where time went**: share of execution time, total time and started count per room's current folder. Up to 6 folders are listed individually and the rest are combined into "other".
23
- 4. **Member scorecard**: totals across all rooms per software, model and effort: runs, completion rate, duration ("usually" means half of the runs finish within it, "slower" nine in ten), stops and retries, and failure types. Rows are ordered by runs, not ranked, and file changes are not counted. The first 8 groups show by default; expand to see all. Click the ⓘ next to each heading to see how it is counted (tap it on phones and tablets).
24
- 5. **Time and friction** (collapsed by default; click to expand):
22
+ 3. **Where time went**: share of execution time, total time and started count per room's current folder. Up to 6 folders are listed individually and the rest are combined into "other". Click a folder to expand its rooms with each room's share of the folder, time and started count; the first 8 show, and "N more rooms" lists the rest. Click a room name to open it.
23
+ 4. **Member scorecard**: at the top, "Share of runs by model" draws each model (across software and effort) as a segment of one bar by number of runs; the 6 largest get their own colour and the rest are combined into "other". Below, the table totals all rooms per software, model and effort: runs, share of all runs, completion rate, duration ("usually" means half of the runs finish within it, "slower" nine in ten), stops and retries, and failure types. Rows are ordered by runs, not ranked, and file changes are not counted. The first 8 groups show by default; expand to see all. Click the ⓘ next to each heading to see how it is counted (tap it on phones and tablets).
24
+ 5. **Workflows**: how many runs happened inside a workflow (as a share of all runs), and for each workflow its runs, rooms, completion rate, duration, stops, and how often each card and sub-workflow was called. With no workflow runs, a single line says so.
25
+ 6. **Time and friction** (collapsed by default; click to expand):
25
26
  - Delivery time (from sending to all answers received), waiting for pickup, member work and the rework subset, each with "usually / slower" and a count. On each bar the dot marks "usually" and the band extends to "slower".
26
27
  - The three corrections (stops and interruptions, retracted messages, rollbacks with affected requests) are listed separately from follow-up interjections, which do not count as intervention.
27
28
  - Messages queued right now and the oldest wait.
@@ -78,7 +78,7 @@ Rooms created by a host inherit its folder. Select the arrow to the left of the
78
78
 
79
79
  ### 6. Contact another room’s host
80
80
 
81
- Give your host the target room’s title, ID or link and describe the work. On a computer, drag a room from the left sidebar onto the messages or the message box to insert “"Room title" (room ID)” at the cursor, so the host can find it by its ID. The other host answers with the reply command in its task. Sending or queuing the reply completes the request and keeps its full text on the sending card. If the other host delegates, it sends the final result back manually. A notification needs no reply.
81
+ Give your host the target room’s title, ID or link and describe the work. On a computer, drag a room from the left sidebar onto the messages or the message box to insert `[room Title #ID]` at the cursor, so the host can find it by its ID. Like an attachment placeholder, it is highlighted in the message box and one Backspace removes all of it; a member dragged from the right sidebar into the message box inserts `[member Name]`, which behaves the same way. The other host answers with the reply command in its task. Sending or queuing the reply completes the request and keeps its full text on the sending card. If the other host delegates, it sends the final result back manually. A notification needs no reply.
82
82
 
83
83
  A message from another room goes to this room's current host: an idle host takes it at once even while other members work; it queues only while the host is busy. The outgoing message shows whether it is queued, delivered or answered. Open it to read the original. Only a parent can interrupt a child. Set the linked-room message limit under Settings → Room preferences (0 means unlimited). The count resets when you speak in either room. The Parent and child rooms section shows these relationships even after a room is detached in the directory.
84
84
 
@@ -34,7 +34,7 @@ You can create or import a ZIP file or folder with the “+” on the Workflows
34
34
 
35
35
  - **Ask the host in a room:** Enable “Full host control,” then describe the division of work you want. You can also type / and choose “Create / edit workflow” under platform skills. The host uses the skill to create SKILL.md, role cards, and a canvas, validates them, saves, and enables the workflow. By default, it saves to the room’s main project when there is one, or to the global library otherwise. Ask the host to save it globally if you plan to reuse it across projects.
36
36
  - **Ask an AI in an external session:** In a Claude Code or Codex session with the CoDiscuss skills installed, ask it to create or edit a workflow with workflow-creator. It validates a folder with codiscuss launch workflow-check --dir <directory>. After you approve, it saves the workflow with codiscuss launch workflow-save --dir <directory>. If the library already has that ID, the save is refused unless it explicitly overwrites (--overwrite) or names the revision it read (--revision). For a project workflow, pass `--scope project --project <folder>` when validating and saving.
37
- - **Where workflows are stored.** Global workflows are available across projects and live in `~/.codiscuss/workflows/<id>/`. A project workflow lives in `<project-root>/.codiscuss/workflows/<id>/` and is available in rooms that use that project folder. In the sidebar, “Workflows” lists workflows under “Current project” before “Global”. On desktop, open a workflow to see its project name at the top of the editor. A room without a project shows global workflows only.
37
+ - **Where workflows are stored.** Global workflows are available across projects and live in `~/.codiscuss/workflows/<id>/`. A project workflow lives in `<project-root>/.codiscuss/workflows/<id>/` and is available in rooms that use that project folder. In the sidebar, “Workflows” lists workflows under “Current project” before “Global”. On desktop, open a workflow to see its project name at the top of the editor. A room without a project, or whose project has no workflows yet, shows global workflows only.
38
38
  - **Choose where to save.** Open “+” and select the new or import action for the destination, such as “New global workflow” or “New in project ‘name’”. On desktop, the editor header shows “Global” or “Project · name”, with a “Read-only” badge where applicable. You can open workflows from read-only projects and copy them to the global library.
39
39
  - **Move, copy, or export.** Open the project workflow’s “…” menu and choose “Move to global” or “Copy to global”. Moving requires a writable source, updates the current room’s binding, and is refused if the global library already has the same ID. Copying keeps the original. Use “Copy to current project” to copy a global workflow when there is one writable project. If several are writable, choose the matching “Copy to project ‘name’” action. Choose “Export” to download a ZIP. The export notice lists files skipped because they were too large or were not text.
40
40
 
@@ -18,7 +18,7 @@ Message a member or host, understand main and branch work and assignment labels,
18
18
 
19
19
  Once the site returns a message number, known recipients appear below the message. If an automatically connected member is busy and the request must wait for its current task to finish, a one-line notice with a clock shows the member’s name and the queued message number. Hover over the notice to see how long the request has waited. The working card takes its place when the member starts. If smart scheduling needs to choose the recipient, the page shows scheduling progress.
20
20
 
21
- Quick navigation on the left lists messages from users and members. Hover over a mark to preview the message or click to jump to its card. In the right sidebar's “Speaking order”, open a member row's “…” menu or right-click it and choose “Jump to latest message” (on a phone or tablet, tapping the row opens this menu; on a computer, the member card that appears when you hover over the row has the same button) to jump straight to that member's latest message or ongoing work card.
21
+ Quick navigation on the left lists messages from users and members. Hover over a mark to preview the message or click to jump to its card. In the right sidebar's “Speaking order”, open a member row's “…” menu or right-click it and choose “Jump to latest message” (on a phone or tablet, tapping the row opens this menu; on a computer, the member card that appears when you hover over the row has the same button) to jump straight to that member's latest message or ongoing work card. On a computer, drag a member row from the right sidebar's “Speaking order” into the composer to insert `[member Name]` where you drop it (without `@`, so it is not woken), for mentioning a member in a message without addressing it.
22
22
 
23
23
  ### 2. Understand main lines, branches, and assignment labels
24
24
 
@@ -13,7 +13,7 @@
13
13
  - **设置**:查看当前版本、“检查更新”与“更新并重启”(同步更新房间技能和隔离账号)、开关“登录 Windows 时自动启动”,以及切换管理面板语言。
14
14
  - **“存储”页**:
15
15
  - 查看本机 `.codiscuss` 数据总量(上限 10 GiB,不含语音模型)、全机草稿区占用(上限 3 GiB,单房间 1 GiB)、**房间记录与附件(`local/`)**占用、所在磁盘剩余空间与安全线,以及按房间与成员拆分的草稿占用和权限不可读条目计数;本机朗读与语音识别模型单独列出,不计入 10 GiB 上限(兼容旧目录与自定义模型目录,服务根目录为目录联接时也可正常计量)。
16
- - 当 `.codiscuss` 数据达到 8 GiB 预警线时,“存储”标签显示提示圆点并弹出警告;超过上限或磁盘低于安全线时停止新的派活。点“清理临时文件”仅回收已确认结束执行的 `.scratch` 临时目录,不会删除房间记录、附件、成品或旧草稿。
16
+ - 当 `.codiscuss` 数据达到 8 GiB 预警线时,“存储”标签显示提示圆点并弹出警告;超过上限或磁盘低于安全线时停止新的派活。总量分为五个具名目录和“其他”。“安全清理”回收已登记的失败执行临时目录、朗读缓存、无主空目录和仅剩登记文件的过期启动目录,以及本机站点已结束超过 24 小时的执行文件。清除朗读缓存后,用云端语音重听旧内容会重新合成并计费。“深度修理”先预估容量,勾选并确认后可删除含最近一天在内的已结束执行日志。
17
17
  - **超限脱困与边界**:房间被拦截时主持人也无法运行,清理历史旧草稿需在**房间外的 AI 对话**(如本机 Claude Code / Codex / Antigravity)中调用 `$codiscuss-draft-cleanup`(默认只盘点,经你确认才删除可重建副本);若由 `local/` 房间记录与附件占满,请先导出备份再在网页销毁旧房间。沙箱创建的不可读目录不计入配额,页面会标出数量;所有限额均为定期采样检查(有执行时每 2 秒查磁盘余量、每 30 秒扫描占用),并非文件系统写入层硬拦截,不能保证磁盘绝不写满。
18
18
  服务执行期间,每 2 秒检查服务目录所在卷的可用空间。10 GiB 预算还有余量时,卷上可用空间的下降量达到该余量就提前复扫。执行结束时更新相应成员的草稿占用。清理后手动重试会按原拦截原因复核;全机超限时重新统计全机用量。其他程序写盘时,若可测用量未超限且不可读项数量稳定,运行继续。提前复扫发现不可读项增多时暂停派活,并请求停止可停执行。后续扫描确认数量稳定且各项限额与磁盘余量正常时,恢复派活。低于磁盘安全线仍独立触发保护。房间草稿达到 80% 时,守卫提前暂停无法确认可停止的新执行。采样之间及扫描期间仍可写入,已运行的不可停成员可继续写入。项目目录、系统临时目录与第三方 AI 自身数据在服务目录外时不计入预算。按失败卡上的原因清理后,在卡片上点“重试”。本机和已配对设备都可手动重试。
19
19
  - **“账号”页**:
@@ -61,7 +61,7 @@ Windows 可以从托盘打开面板。macOS 和 Linux 的命令行入口见下
61
61
  | --- | --- |
62
62
  | 启动、退出、重启、更新(**无需面板已运行**) | `codiscuss admin start` / `stop` / `restart` / `update [check]` |
63
63
  | 查看状态、启停服务、开机自启 | `codiscuss admin status [--full]`、`service start\|stop\|restart`、`autostart on\|off` |
64
- | 查看存储占用与清理临时文件 | `codiscuss admin storage`、`storage clean` |
64
+ | 查看存储占用与清理临时文件 | `codiscuss admin storage`、`storage clean`、`storage repair`(预览)、`storage repair logs --confirm` |
65
65
  | 绑定/解绑线上网站、生成接入码 | `codiscuss admin site status`、`site connect <接入码\|站点>`、`site disconnect`、`entry code` |
66
66
  | 托管入口与隧道 | `codiscuss admin entry start\|stop`、`entry join <接入码>`、`entry open\|close relay\|tunnel`、`entry tunnel <域名>` |
67
67
  | 托管账号生命周期 | `codiscuss admin account list`、`account add <名>`、`account start\|stop\|disable\|enable\|remove\|password <名>`、`account isolate\|protect <名>` |
@@ -19,9 +19,10 @@
19
19
  - **同时并行峰值**:同一时刻最多有几个房间、几位专家在运行,以及专家峰值出现的时间。房间数里,同一房间几位成员同时运行只算一个房间;专家数里,每位正在运行的成员各算一位。
20
20
  - **AI 执行总时长**:各成员执行时长相加,几位成员同时运行时会超过实际经过的时间。
21
21
  2. **值得留意**:按固定规则筛出的异常(失败集中、权限拦截、失败后迟到补交、智能调度负评),至少 10 次运行里出现 3 次以上才会列出,点击条目跳到对应房间。
22
- 3. **时间去哪了**:按房间当前所在的文件夹,显示执行时长的占比、时长和发起次数;最多单列 6 个文件夹,其余合为“其他”。
23
- 4. **成员成绩单**:按软件、模型与强度汇总所有房间,列出运行次数、完成率、耗时(“通常”是一半运行在此以内结束,“较慢”是九成在此以内)、打断与重试次数、失败类型。按运行次数排列,不评名次,不统计改动文件数;默认显示前 8 组,可展开全部。点各段标题旁的 ⓘ 可查看统计口径(手机和平板同样点按)。
24
- 5. **耗时与卡点**(默认收起,点击展开):
22
+ 3. **时间去哪了**:按房间当前所在的文件夹,显示执行时长的占比、时长和发起次数;最多单列 6 个文件夹,其余合为“其他”。点文件夹可展开其中各房间在该文件夹里的占比、时长和发起次数,先列前 8 个,点“其余 N 个房间”看全部;点房间名进入该房间。
23
+ 4. **成员成绩单**:顶部是“各模型调用占比”,按运行次数把各模型(不分软件和强度)画成一条分段条,前 6 个各占一色,其余合为“其他”。下方表格按软件、模型与强度汇总所有房间,列出运行次数、占全部运行的比例、完成率、耗时(“通常”是一半运行在此以内结束,“较慢”是九成在此以内)、打断与重试次数、失败类型。按运行次数排列,不评名次,不统计改动文件数;默认显示前 8 组,可展开全部。点各段标题旁的 ⓘ 可查看统计口径(手机和平板同样点按)。
24
+ 5. **工作流**:这段时间有多少运行发生在工作流里(占全部运行的比例),以及每个工作流的运行次数、涉及房间数、完成率、耗时、打断次数,和各卡片、子工作流分别被调用了多少次。没有工作流运行时只显示一行提示。
25
+ 6. **耗时与卡点**(默认收起,点击展开):
25
26
  - 交付耗时(从发出到收齐回答)、等待接手、成员处理与“其中:返工”,各给出“通常 / 较慢”和次数;横条上圆点是“通常”,色段延伸到“较慢”。
26
27
  - 停止与打断、撤回消息、回退对话(附受影响的请求数)这三类纠正操作,与不计入介入的追加插话分开列出。
27
28
  - 当前正在排队的消息数和最久已等多久。
@@ -76,7 +76,7 @@
76
76
 
77
77
  ### 6. 联系其他房间的主持人
78
78
 
79
- 告诉本房主持人目标房间的标题、编号或链接,以及要对方处理的事。在电脑上,把左栏的房间拖到消息区或输入框,会在光标处插入“「房间标题」(房间 编号)”,主持人凭编号就能找到它。对方主持人用任务中的回传命令作答。发送或排队成功就完成该请求,发送卡片保留完整正文。若对方先派活,收尾时由主持人手动把结果发回。普通通知无需回传。
79
+ 告诉本房主持人目标房间的标题、编号或链接,以及要对方处理的事。在电脑上,把左栏的房间拖到消息区或输入框,会在光标处插入 `[房间 标题 #编号]`,主持人凭编号就能找到它。它和附件占位一样在输入框里高亮显示,退格一次删掉整个;右栏成员拖进输入框插入的 `[成员 名称]` 也是这样。对方主持人用任务中的回传命令作答。发送或排队成功就完成该请求,发送卡片保留完整正文。若对方先派活,收尾时由主持人手动把结果发回。普通通知无需回传。
80
80
 
81
81
  对方房间发来的消息默认交给本房当前主持人:主持人空闲就立即处理,其他成员在忙也不等;主持人正忙才排队。发送记录显示排队、送达或已回复。点开可读原文。只有父房间可以打断子房间。在“设置 → 房间偏好”中调整“关联房间互传上限”,0 表示不限;你在任一房间发言后重新计数。右栏“父子房间”可查看本房的父房间和子房间,即使已在左栏将房间设为独立也能查看。
82
82
 
@@ -34,7 +34,7 @@
34
34
 
35
35
  - **在房间里让主持人建**:打开“主持人完整权限”后,直接对主持人说你要什么分工(或说“把这个房间的做法存成工作流”),也可以在输入框打 `/` 选平台技能里的“新建 / 修改工作流”。主持人会调用 `workflow-creator` 生成 `SKILL.md`、角色卡片与画布,校验通过后保存并启用。房间有主项目时默认保存到主项目,否则保存到全局。需要跨项目使用时,可以明确请主持人保存到全局。
36
36
  - **在外部 AI 对话里建**:在任意已装好共议技能的 Claude Code / Codex 窗口,请它按 `workflow-creator` 技能为你新建或修改工作流。它先用 `codiscuss launch workflow-check --dir <目录>` 校验,待你确认后用 `codiscuss launch workflow-save --dir <目录>` 保存。库里已有同 ID 的工作流时,须明确选择覆盖(`--overwrite`)或带上读取时的修订号(`--revision`),否则不会保存。校验与保存项目工作流时,都加上 `--scope project --project <项目目录>`。
37
- - **存在哪里**。全局工作流可跨项目使用,位于 `~/.codiscuss/workflows/<ID>/`。项目工作流位于 `<项目根目录>/.codiscuss/workflows/<ID>/`,可在使用该目录的房间里选用。左栏“工作流”先显示“当前项目”下的工作流,再显示“全局”。桌面布局可在编辑器顶部查看所属项目。没有项目的房间只显示全局工作流。
37
+ - **存在哪里**。全局工作流可跨项目使用,位于 `~/.codiscuss/workflows/<ID>/`。项目工作流位于 `<项目根目录>/.codiscuss/workflows/<ID>/`,可在使用该目录的房间里选用。左栏“工作流”先显示“当前项目”下的工作流,再显示“全局”。桌面布局可在编辑器顶部查看所属项目。没有项目、或项目里还没有工作流的房间只显示全局工作流。
38
38
  - **选择保存位置**。点“+”后按目标位置选择新建或导入项,例如“新建全局工作流”或“新建到项目「项目名」”。桌面布局的编辑器顶部显示“全局”或“项目 · 项目名”,只读项目另标“只读”。只读项目的工作流可以打开查看或复制到全局。
39
39
  - **移动、复制与导出**。打开项目工作流的“…”菜单,选择“移至全局”或“复制到全局”。移动要求源项目可写,成功后当前房间的绑定也随之更新。若全局已有同 ID,移动会被拒绝。复制会保留原件。全局工作流可用“复制到本项目”复制到唯一的可写项目。有多个可写项目时,点对应的“复制到项目「项目名」”。点“导出”下载工作流压缩包,导出提示会列出因格式或大小跳过的文件。
40
40
 
@@ -18,7 +18,7 @@
18
18
 
19
19
  网站返回消息编号后,已确定的接收成员会显示在消息下方。自动接入的成员正忙并需等当前工作结束时,这里会显示带时钟图标的一行排队提示,列出成员名和等完要处理的消息编号。把鼠标移到提示上可看已等时长。成员开工后,执行卡会在原位置出现。需要智能调度决定接收者时,页面显示调度进度。
20
20
 
21
- 消息区左侧的快速导航只列出用户和成员的发言。悬停刻度可预览,点击可跳到对应卡片。在右栏“发言顺序”的成员行上点“…”或右键选“定位最新发言”(手机、平板上点一下成员行即弹出这份菜单;电脑上悬停成员行弹出的成员卡片里也有同名按钮),可直接跳到该成员的最新一条发言或正在进行中的执行卡片。
21
+ 消息区左侧的快速导航只列出用户和成员的发言。悬停刻度可预览,点击可跳到对应卡片。在右栏“发言顺序”的成员行上点“…”或右键选“定位最新发言”(手机、平板上点一下成员行即弹出这份菜单;电脑上悬停成员行弹出的成员卡片里也有同名按钮),可直接跳到该成员的最新一条发言或正在进行中的执行卡片。在电脑上把右栏“发言顺序”里的成员行拖到输入框,会在落点插入 `[成员 名称]`(不带 `@`,不会唤醒它),用于在消息里提到某位成员而不点名。
22
22
 
23
23
  ### 2. 看懂主线、支线与派活标签
24
24
 
@@ -1,4 +1,20 @@
1
1
  {
2
+ "清除朗读缓存后,用云端语音重听旧内容会重新合成并计费。": "After clearing the speech cache, replaying old content with cloud speech synthesizes it again and incurs a new charge.",
3
+ "有 {count} 处目录或文件因权限无法读取(例如沙箱创建的目录),未计入配额。深度修理也会保留这些目录;如需删除,请以管理员身份手动操作。": "{count} entries could not be read and are excluded from the quota. Deep repair leaves these directories in place. To remove them, delete them manually as an administrator.",
4
+ "无法核实不可读目录的大小、内容和当前使用者,已保留。": "Unreadable directories are retained because their size, contents and active users cannot be verified.",
5
+ "窗口配置占 {size}。无法确认所有窗口进程已退出,已保留登录和窗口数据。": "The panel profile uses {size}. Login and window data are retained because the exit of all browser processes cannot be verified.",
6
+ "房间记录与附件": "Room records and attachments",
7
+ "成员草稿": "Member drafts",
8
+ "运行日志与任务文件": "Run logs and task files",
9
+ "管理面板窗口缓存": "Panel browser profile",
10
+ "模型 API 运行环境": "Model API runtime",
11
+ "其他": "Other",
12
+ "确认删除所选日志?此操作无法撤销。": "Permanently delete the selected logs?",
13
+ "已释放 {size},跳过 {count} 项": "Released {size}. Skipped {count} items.",
14
+ "安全清理": "Safe cleanup",
15
+ "深度修理": "Deep repair",
16
+ "确认深度修理": "Confirm deep repair",
17
+ "删除已结束执行的日志(含最近 24 小时),之后无法排查这些执行。预计释放 {size}。": "Delete finished run logs, including the last 24 hours. These logs will no longer be available for troubleshooting. Estimated space: {size}.",
2
18
  "释放迁移备份": "Release migration backup",
3
19
  "确认释放": "Confirm release",
4
20
  "将停止实例,校验后删除备份 {path}({bytes} 字节)。": "Stop the instance, verify and delete the backup at {path} ({bytes} bytes).",
@@ -106,5 +106,22 @@
106
106
  "耗时(通常 · 较慢)": "Duration (usually · slower)",
107
107
  "每日发起的已结束任务": "Finished tasks by start day",
108
108
  "{date}:当天发起的任务中已结束 {ended} 个,插手 {count} 个": "{date}: of the tasks started this day, {ended} finished, stepped into {count}",
109
- "并行峰值、文件夹、成员、洞察只含现存房间": "Peak concurrency, folders, members and insights cover existing rooms only"
109
+ "{count} 个房间": "{count} rooms",
110
+ "打开房间": "Open room",
111
+ "占 {share}": "{share} of folder",
112
+ "其余 {count} 个房间": "{count} more rooms",
113
+ "{software} · 未知模型": "{software} · unknown model",
114
+ "其他 {count} 个模型": "{count} other models",
115
+ "各模型调用占比": "Share of runs by model",
116
+ "按运行次数": "By runs",
117
+ "占比": "Share",
118
+ "工作流": "Workflows",
119
+ "按房间启用的工作流统计成员的运行;卡片是这次运行所扮演的角色,子工作流是被调用的分支流程。只含现存房间。": "Member runs grouped by the workflow enabled in the room. A card is the role the run played; a sub-workflow is a branch it called. Existing rooms only.",
120
+ "工作流中的运行占全部运行的 {share}": "{share} of all runs happened inside a workflow",
121
+ "{inside} / {runs} 次": "{inside} / {runs} runs",
122
+ "房间": "Rooms",
123
+ "打断": "Stopped",
124
+ "卡片与子工作流": "Cards and sub-workflows",
125
+ "这段时间没有按工作流进行的运行。": "No runs inside a workflow in this period.",
126
+ "并行峰值、文件夹、成员、工作流、洞察只含现存房间": "Peak concurrency, folders, members, workflows and insights cover existing rooms only"
110
127
  }
@@ -24,7 +24,8 @@
24
24
  "{host} · 空闲": "{host} · Idle",
25
25
  "打开房间「{title}」": "Open the room “{title}”",
26
26
  "松开以引用房间「{title}」": "Release to reference the room “{title}”",
27
- "「{title}」(房间 {id})": "\"{title}\" (room {id})",
27
+ "[房间 {title} #{id}]": "[room {title} #{id}]",
28
+ "[成员 {name}]": "[member {name}]",
28
29
  "跨房发送": "Sent to another room",
29
30
  "展开或收起发出的消息正文": "Show or hide the sent message",
30
31
  "父房间": "parent room",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai_co_discuss",
3
- "version": "0.5.34",
3
+ "version": "0.5.35",
4
4
  "bin": {
5
5
  "codiscuss": "runner/codiscuss.mjs"
6
6
  },
@@ -871,7 +871,14 @@ function listen_schedules(file, pid, setup) {
871
871
  let offset = statSync(file).size, pending = Buffer.alloc(0), asking = false, held = [];
872
872
  const timer = setInterval(tick, setup.interval || WINDOW_POLL_MS);
873
873
  timer.unref();
874
- const listener = { crons, add: (id, cron) => crons.set(id, cron), adopt: next => Object.assign(setup, next), end };
874
+ setup.task.on_schedule_listener?.(true);
875
+ const listener = { crons, add: (id, cron) => crons.set(id, cron), adopt(next) {
876
+ if (setup.task.on_schedule_listener !== next.task.on_schedule_listener) {
877
+ next.task.on_schedule_listener?.(true);
878
+ setup.task.on_schedule_listener?.(false);
879
+ }
880
+ Object.assign(setup, next);
881
+ }, end };
875
882
  schedule_listeners.set(file, listener);
876
883
  return listener;
877
884
  function tick() {
@@ -940,7 +947,10 @@ function listen_schedules(file, pid, setup) {
940
947
  function end() {
941
948
  clearInterval(timer);
942
949
  crons.clear();
943
- if (schedule_listeners.get(file) === listener) schedule_listeners.delete(file);
950
+ if (schedule_listeners.get(file) === listener) {
951
+ schedule_listeners.delete(file);
952
+ setup.task.on_schedule_listener?.(false);
953
+ }
944
954
  }
945
955
  }
946
956
 
@@ -24,6 +24,7 @@
24
24
  * as a writer of the member's session and stops it, waiting for `close`, before anything resumes that session. An
25
25
  * adapter that does neither does not support follow-ups, and such reports are lost. Schedules: where a schedule the
26
26
  * member set in its own software is seen to fire (profile `schedule_reports`), the adapter calls
27
+ * `task.on_schedule_listener(active)` retains the original task files while an idle schedule listener holds them.
27
28
  * `task.on_schedule({id, schedule, prompt, set_at}, handle)` (`set_at`: when the schedule was set, ms) with the latest
28
29
  * room task's callbacks and follows that turn only on `true` (the runner opened a scheduled execution for a host);
29
30
  * `'drop'` forgets that schedule (set before the owner's last stop), `'stop'` ends its listening, anything else
@@ -87,7 +87,7 @@ API 密钥、技能、工作流、系统提示词(目标同上)
87
87
  prompt default get / prompt default set --file <文件> 新托管账号的默认系统提示词
88
88
 
89
89
  结果以 JSON 输出。--data 指定管理员服务目录(默认 ~/.codiscuss)。
90
- `) + t(' room-links A 查看父子房间') + '\n' + t(' storage [clean] 查看存储用量,或清理已确认结束的执行临时目录') + '\n'
90
+ `) + t(' room-links A 查看父子房间') + '\n' + t(' storage [clean | repair [logs --confirm]] 查看用量、安全清理或深度修理日志') + '\n'
91
91
  + t(' account add <名> --project-data-root <目录> 将新账号的项目、工作区和成员草稿放在指定目录') + '\n'
92
92
  + t(' account migrate-data <名> --project-data-root <目录> 停止实例并迁移项目数据') + '\n'
93
93
  + t(' account migration-backups <名> 查看各迁移备份的位置与字节数') + '\n'
@@ -431,6 +431,8 @@ export async function admin_cli(args, { client = panel_client, print = text => p
431
431
  const commands = {
432
432
  storage: () => {
433
433
  if (!rest.length) return call('storage');
434
+ if (rest.join(' ') === 'repair') return call('storage/repair', {});
435
+ if (rest.join(' ') === 'repair logs' && values.confirm) return call('storage/repair', { logs: true, confirm: true });
434
436
  if (rest.length === 1 && rest[0] === 'clean') return call('storage/clean', {});
435
437
  throw new Error(HELP);
436
438
  },
@@ -0,0 +1,95 @@
1
+ import { existsSync, lstatSync, readdirSync, readFileSync, realpathSync, unlinkSync } from 'node:fs';
2
+ import { dirname, join, relative, resolve } from 'node:path';
3
+ import { DatabaseSync } from 'node:sqlite';
4
+ import { storage_details, clean_storage } from './admin_storage.mjs';
5
+ import { execution_file_protection, read_registry, sweep_service_home } from './discussion_service.mjs';
6
+ import { t } from './i18n.mjs';
7
+ import { with_directory_breakdown } from './storage_guard.mjs';
8
+
9
+ function local_database(home, action) {
10
+ const path = join(home, 'local', 'discuss.sqlite3');
11
+ if (!existsSync(path)) return;
12
+ const db = new DatabaseSync(path, { readOnly: true });
13
+ try { action(db); } finally { db.close(); }
14
+ }
15
+
16
+ function matches_site(site, local) {
17
+ const url = new URL(site);
18
+ if (url.hostname === 'localhost') url.hostname = '127.0.0.1';
19
+ return url.href === new URL(local).href;
20
+ }
21
+
22
+ /** Return management-panel usage with disjoint directory totals and local room titles. */
23
+ export async function panel_storage(home, local) {
24
+ const report = await with_directory_breakdown(() => storage_details(home));
25
+ try {
26
+ local_database(home, db => {
27
+ const title = db.prepare('SELECT title FROM rooms WHERE id=?');
28
+ for (const room of report.rooms) if (room.site && matches_site(room.site, local)) room.title = title.get(room.room_id)?.title;
29
+ });
30
+ } catch { /* A room ID remains available when titles cannot be read. */ }
31
+ return report;
32
+ }
33
+
34
+ function account_file(path, apply, result) {
35
+ const stat = lstatSync(path, { throwIfNoEntry: false });
36
+ if (!stat?.isFile() || stat.nlink !== 1) return;
37
+ if (apply) unlinkSync(path);
38
+ result.removed++;
39
+ result.freed_bytes += stat.size;
40
+ }
41
+
42
+ function room_files(config, folder, ended, options, result) {
43
+ const root = resolve(config.data_directory || join(folder, 'discussion-' + config.room));
44
+ if (relative(root, realpathSync.native(root)) || !existsSync(join(root, 'runtime.sqlite3'))) { result.failed++; return; }
45
+ const protected_files = execution_file_protection(root, options.db, config.room);
46
+ const ids = new Set(ended.all(config.room, options.cutoff).map(row => row.id));
47
+ for (const id of protected_files.ids) ids.delete(id);
48
+ const members = join(root, 'members'), folders = [root];
49
+ if (lstatSync(members, { throwIfNoEntry: false })?.isDirectory())
50
+ for (const entry of readdirSync(members, { withFileTypes: true })) if (entry.isDirectory() && !protected_files.members.has(entry.name)) folders.push(join(members, entry.name));
51
+ for (const dir of folders) for (const name of readdirSync(dir)) {
52
+ const match = /^(?:[a-z_0-9]+-)?free-(\d+)\.(log|task\.json|access\.json)$/.exec(name);
53
+ if (!match || !ids.has(Number(match[1])) || (options.logs && match[2] !== 'log')) continue;
54
+ try { account_file(join(dir, name), options.apply, result); } catch { result.failed++; }
55
+ }
56
+ }
57
+
58
+ function finished_files(home, local, logs, apply) {
59
+ const result = { removed: 0, freed_bytes: 0, failed: 0 };
60
+ const cutoff = Math.floor(Date.now() / 1000) - (logs ? 0 : 86400);
61
+ local_database(home, db => {
62
+ const ended = db.prepare("SELECT id FROM member_executions WHERE room_id=? AND status IN ('completed','failed','cancelled') AND finished_at BETWEEN 1 AND ?");
63
+ for (const path of read_registry(home)) {
64
+ try {
65
+ const config = JSON.parse(readFileSync(path, 'utf8'));
66
+ if (matches_site(config.site, local)) room_files(config, dirname(path), ended, { cutoff, logs, apply, db }, result);
67
+ } catch { result.failed++; }
68
+ }
69
+ });
70
+ return result;
71
+ }
72
+
73
+ /** Clean confirmed temporary files globally, retaining scoped scratch cleanup for a single room. */
74
+ export async function panel_clean(home, local, filter = {}) {
75
+ const result = await clean_storage(home, filter);
76
+ if (filter.room_id || filter.room_key) return result;
77
+ const files = finished_files(home, local, false, true);
78
+ for (const key of Object.keys(result)) result[key] += files[key];
79
+ const orphans = sweep_service_home(home, Date.now(), undefined, true);
80
+ result.removed += orphans.launches.length + orphans.drafts.length;
81
+ result.failed += orphans.failures;
82
+ result.freed_bytes += orphans.freed_bytes;
83
+ const cache = join(home, 'tts-cache');
84
+ if (lstatSync(cache, { throwIfNoEntry: false })?.isDirectory())
85
+ for (const name of readdirSync(cache)) if (/^[a-f0-9]{64}\.json$/.test(name)) {
86
+ try { account_file(join(cache, name), true, result); } catch { result.failed++; }
87
+ }
88
+ return result;
89
+ }
90
+
91
+ /** Preview or explicitly confirm the removal of finished execution logs. */
92
+ export function panel_repair(home, local, body) {
93
+ if (Object.keys(body).length && !(body.logs === true && body.confirm === true)) throw new Error(t('深度修理须同时指定 logs 与 confirm。'));
94
+ return finished_files(home, local, true, body.confirm === true);
95
+ }
@@ -11,7 +11,7 @@ import { spawn, spawnSync } from 'node:child_process';
11
11
  import { randomBytes } from 'node:crypto';
12
12
  import { closeSync, copyFileSync, cpSync, existsSync, lstatSync, mkdirSync, mkdtempSync, openSync, realpathSync, readdirSync, readFileSync, readSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs';
13
13
  import http from 'node:http';
14
- import { clean_storage, storage_details } from './admin_storage.mjs';
14
+ import { panel_clean, panel_storage, panel_repair } from './admin_maintenance.mjs';
15
15
  import { homedir, tmpdir } from 'node:os';
16
16
  import tls from 'node:tls';
17
17
  import { dirname, extname, join, resolve } from 'node:path';
@@ -784,8 +784,9 @@ export function create_panel({ data, key, port, ops = {}, sessions = new Set() }
784
784
  if (!response.ok) throw new Error(result.error);
785
785
  return result;
786
786
  }
787
- if (path === '/api/storage' && method === 'GET') return storage_details(data);
788
- if (path === '/api/storage/clean' && method === 'POST') return clean_storage(data, body);
787
+ if (path === '/api/storage' && method === 'GET') return panel_storage(data, site_url(data));
788
+ if (path === '/api/storage/clean' && method === 'POST') return panel_clean(data, site_url(data), body);
789
+ if (path === '/api/storage/repair' && method === 'POST') return panel_repair(data, site_url(data), body);
789
790
  if (method === 'GET' && section === 'state') {
790
791
  const windows = process.platform === 'win32';
791
792
  const service = op.service_overview(data), bound = bound_site(data);