ai_co_discuss 0.5.39 → 0.5.41

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.
Files changed (68) hide show
  1. package/.agents/skills/discuss-goal/SKILL.md +1 -1
  2. package/.agents/skills/discuss-host/references/room.md +4 -4
  3. package/.agents/skills/discuss-participant/SKILL.md +3 -1
  4. package/.agents/skills/discuss-participant/references/interactive-html.md +35 -8
  5. package/.agents/skills/discuss-participant/references/visual-examples.md +41 -18
  6. package/README.md +2 -2
  7. package/README.zh-CN.md +2 -2
  8. package/backend/analytics.py +24 -2
  9. package/backend/analytics_issues.py +210 -0
  10. package/backend/free_room.py +21 -9
  11. package/backend/questions.py +3 -2
  12. package/backend/room_import.py +3 -3
  13. package/backend/schema.sql +2 -0
  14. package/backend/server.py +73 -3
  15. package/docs/deployment.md +6 -2
  16. package/docs/en/deployment.md +6 -2
  17. package/docs/en/guide/admin.md +12 -8
  18. package/docs/en/guide/analytics.md +13 -18
  19. package/docs/en/guide/faq.md +1 -1
  20. package/docs/en/guide/goal.md +1 -1
  21. package/docs/en/guide/remote.md +2 -2
  22. package/docs/en/guide/rooms.md +4 -4
  23. package/docs/en/guide/scheduling.md +1 -1
  24. package/docs/en/guide/voice.md +5 -4
  25. package/docs/en/guide/working.md +1 -1
  26. package/docs/guide/admin.md +12 -8
  27. package/docs/guide/analytics.md +13 -18
  28. package/docs/guide/faq.md +1 -1
  29. package/docs/guide/goal.md +1 -1
  30. package/docs/guide/remote.md +2 -2
  31. package/docs/guide/rooms.md +4 -4
  32. package/docs/guide/scheduling.md +1 -1
  33. package/docs/guide/voice.md +5 -4
  34. package/docs/guide/working.md +1 -1
  35. package/frontend/locales/en/admin.json +48 -1
  36. package/frontend/locales/en/analytics.json +62 -42
  37. package/frontend/locales/en/backend.json +12 -2
  38. package/frontend/locales/en/backend_worker.json +5 -0
  39. package/frontend/locales/en/external.json +3 -0
  40. package/frontend/locales/en/room.json +30 -0
  41. package/frontend/locales/en/settings.json +17 -2
  42. package/package.json +1 -1
  43. package/runner/adapters/api.mjs +1 -1
  44. package/runner/admin_cli.mjs +19 -8
  45. package/runner/admin_maintenance.mjs +31 -0
  46. package/runner/admin_panel.mjs +54 -13
  47. package/runner/device_auth.mjs +5 -2
  48. package/runner/discuss.py +1 -1
  49. package/runner/discussion_launch.mjs +2 -2
  50. package/runner/external_gateway.mjs +2 -2
  51. package/runner/free_runner.mjs +11 -8
  52. package/runner/hosting_tunnel.mjs +3 -0
  53. package/runner/i18n_en.mjs +17 -10
  54. package/runner/relay_channel.mjs +2 -2
  55. package/runner/relay_health.mjs +2 -1
  56. package/runner/remote_launch.mjs +6 -1
  57. package/runner/scheduler.mjs +21 -15
  58. package/runner/session_driver.mjs +3 -1
  59. package/runner/share_shared.mjs +2 -1
  60. package/runner/weixin.mjs +32 -9
  61. package/web/admin.css +1 -1
  62. package/web/admin.js +8 -8
  63. package/web/app.js +28 -4
  64. package/web/backup.js +5 -3
  65. package/web/i18n.js +4 -4
  66. package/web/markdown.css +1 -1
  67. package/web/modern.css +1 -1
  68. package/web/modern.js +168 -91
@@ -523,22 +523,31 @@ def member_value(member):
523
523
 
524
524
 
525
525
  def batch_outcome(connection, room_id, batch_id):
526
- """How each member of a dispatch ended: display name, request status, execution, and a failure's reason and class."""
526
+ """How each member of a dispatch ended: display name, request status, execution, answer message, and a failure's reason and class."""
527
527
  names = member_display_names(connection, room_id)
528
- rows = connection.execute("""SELECT m.name,r.status,r.execution_id,e.status AS execution_status,e.result,f.failure_class,f.resets
528
+ rows = connection.execute("""SELECT m.name,r.status,r.execution_id,r.answer_id,e.status AS execution_status,e.result,f.failure_class,f.resets
529
529
  FROM member_requests r JOIN room_members m ON m.id=r.member_id LEFT JOIN member_executions e ON e.id=r.execution_id
530
530
  LEFT JOIN execution_failures f ON f.execution_id=r.execution_id
531
531
  WHERE r.room_id=? AND r.batch_id=? ORDER BY r.id""", (room_id, batch_id)).fetchall()
532
532
  return [{"member": names.get(row["name"], row["name"]), "status": row["status"], "execution_id": row["execution_id"],
533
+ **({"message_id": row["answer_id"]} if row["answer_id"] else {}),
533
534
  **({"reason": str(row["result"] or "")[:200]} if row["status"] in ("failed", "cancelled") else {}),
534
535
  **({"failure_class": row["failure_class"], "resets": row["resets"] or None} if row["failure_class"] else {})}
535
536
  for row in rows]
536
537
 
537
538
 
538
539
  def handoff_notice(connection, room_id, batch_id, retried):
539
- """The notice a hand-back reaches a still-working host with: who did not finish and their own reasons, when any."""
540
- failed = ";".join(f"{item['member']}({item.get('reason', '')})" for item in batch_outcome(connection, room_id, batch_id)
541
- if item["status"] in ("failed", "cancelled"))
540
+ """The notice a hand-back reaches a still-working host with: each answer by number, and who did not finish and why.
541
+
542
+ The answers are named so the host reads each one directly instead of paging the room to find them."""
543
+ outcome = batch_outcome(connection, room_id, batch_id)
544
+ failed = ";".join(f"{item['member']}({item.get('reason', '')})" for item in outcome if item["status"] in ("failed", "cancelled"))
545
+ answers = "、".join(f"{item['member']} #{item['message_id']}" for item in outcome if item.get("message_id"))
546
+ if answers:
547
+ facts = {"batch_id": batch_id, "answers": answers, "failed": failed}
548
+ if retried:
549
+ return Text("#{batch_id} 派出的工作重试后已结束,回答:{answers};其中未完成:{failed}。请主持人按编号读回答,接着处理。", **facts) if failed else Text("#{batch_id} 派出的工作重试后已结束,回答:{answers}。请主持人按编号读回答,接着处理。", **facts)
550
+ return Text("#{batch_id} 派出的工作已结束,回答:{answers};其中未完成:{failed}。请主持人按编号读回答,接着处理。", **facts) if failed else Text("#{batch_id} 派出的工作已结束,回答:{answers}。请主持人按编号读回答,接着处理。", **facts)
542
551
  if retried:
543
552
  return Text("#{batch_id} 派出的工作重试后已结束,其中未完成:{failed}。请主持人接着处理。", batch_id=batch_id, failed=failed) \
544
553
  if failed else Text("#{batch_id} 派出的工作重试后已结束,请主持人接着处理。", batch_id=batch_id)
@@ -2182,7 +2191,7 @@ def summarize_groups(connection, room_id):
2182
2191
  when the chain was halted; a room without a present host just drops the row.
2183
2192
  """
2184
2193
  for row in connection.execute("SELECT * FROM group_summaries WHERE room_id=?", (room_id,)).fetchall():
2185
- answers = connection.execute("""SELECT m.name,r.status FROM member_requests r JOIN room_members m ON m.id=r.member_id
2194
+ answers = connection.execute("""SELECT m.name,r.status,r.answer_id FROM member_requests r JOIN room_members m ON m.id=r.member_id
2186
2195
  WHERE r.message_id=? AND r.purpose='all' ORDER BY r.id""", (row["message_id"],)).fetchall()
2187
2196
  if any(answer["status"] not in TERMINAL for answer in answers):
2188
2197
  continue
@@ -2192,9 +2201,12 @@ def summarize_groups(connection, room_id):
2192
2201
  continue
2193
2202
  names = member_display_names(connection, room_id)
2194
2203
  unfinished = "、".join(names.get(answer["name"], answer["name"]) for answer in answers if answer["status"] != "completed")
2195
- facts = {"message_id": row["message_id"], "unfinished": unfinished}
2196
- text = Text("#{message_id} 全体成员已回答完毕,其中未完成:{unfinished}。请主持人读各成员的回答,汇总共识与分歧,需要时安排后续工作。", **facts) \
2197
- if unfinished else Text("#{message_id} 全体成员已回答完毕。请主持人读各成员的回答,汇总共识与分歧,需要时安排后续工作。", **facts)
2204
+ # The answers are named by number, so the host reads each one directly instead of paging the room to find them.
2205
+ answered = "、".join(f"{names.get(answer['name'], answer['name'])} #{answer['answer_id']}"
2206
+ for answer in answers if answer["status"] == "completed" and answer["answer_id"])
2207
+ facts = {"message_id": row["message_id"], "unfinished": unfinished, "answers": answered}
2208
+ text = Text("#{message_id} 全体成员已回答完毕,回答:{answers};其中未完成:{unfinished}。请主持人按编号读各成员的回答,汇总共识与分歧,需要时安排后续工作。", **facts) \
2209
+ if unfinished else Text("#{message_id} 全体成员已回答完毕,回答:{answers}。请主持人按编号读各成员的回答,汇总共识与分歧,需要时安排后续工作。", **facts)
2198
2210
  wake_host(connection, room_id, row["chain_id"], text, f"group:{row['message_id']}")
2199
2211
 
2200
2212
 
@@ -561,10 +561,11 @@ def answer_text(row, action, choices, text, customs=None):
561
561
  elif action == "delegate":
562
562
  head = Text("交给主持人决定(问题 #{id})", id=row["id"])
563
563
  else:
564
- picked = ";".join(f"{item['question'].rstrip('??::')}:" + "、".join(
564
+ lines = [f"{item['question'].rstrip('??::')}:" + "、".join(
565
565
  [f"{option['id']}({option['label']})" for option in item["options"] if option["id"] in choices.get(key, [])]
566
566
  + ([customs[key]] if key in customs else []))
567
- for key, item in items.items() if key in choices or key in customs)
567
+ for key, item in items.items() if key in choices or key in customs]
568
+ picked = "".join(f"\n- {line}" for line in lines) if len(lines) > 1 else "".join(lines)
568
569
  head = Text("回答问题 #{id}:{picked}", id=row["id"], picked=picked) if picked else Text("回答问题 #{id}", id=row["id"])
569
570
  return f"{head}\n\n{text.strip()}" if (text or "").strip() else str(head)
570
571
 
@@ -142,10 +142,10 @@ def record_statements(tables, room_id, maps):
142
142
  (messages[row["message_id"]], remap_text(row["text"], messages), row["author"])) for row in tables.get("message_summaries", [])]
143
143
  statements += [("INSERT INTO message_timings (message_id,elapsed_seconds) VALUES (?,?)", (messages[row["message_id"]], row["elapsed_seconds"]))
144
144
  for row in tables.get("message_timings", [])]
145
- statements += [("""INSERT INTO attachments (id,room_id,message_id,position,file_name,content_type,size,sha256,actor,submission_id,created_at)
146
- VALUES (?,?,?,?,?,?,?,?,?,?,?)""", (maps["attachments"][row["id"]], room_id, messages[row["message_id"]], row["position"], row["file_name"],
145
+ statements += [("""INSERT INTO attachments (id,room_id,message_id,position,file_name,content_type,size,sha256,actor,submission_id,created_at,cleared_at)
146
+ VALUES (?,?,?,?,?,?,?,?,?,?,?,?)""", (maps["attachments"][row["id"]], room_id, messages[row["message_id"]], row["position"], row["file_name"],
147
147
  row["content_type"], row["size"], row["sha256"], row["actor"], row["submission_id"],
148
- row["created_at"])) for row in tables.get("attachments", [])]
148
+ row["created_at"], row.get("cleared_at"))) for row in tables.get("attachments", [])]
149
149
  statements += [("""INSERT INTO member_requests (id,room_id,member_id,message_id,status,answer_id,created_at,chain_id,batch_id,purpose,created_by)
150
150
  VALUES (?,?,?,?,?,?,?,?,?,?,?)""", (requests[row["id"]], room_id, members[row["member_id"]], messages[row["message_id"]],
151
151
  "cancelled" if row["status"] in OPEN_REQUESTS else row["status"],
@@ -78,6 +78,8 @@ CREATE TABLE IF NOT EXISTS attachments (
78
78
  width INTEGER, height INTEGER,
79
79
  -- The type (image/webp or image/jpeg) of a smaller copy a page made for showing in messages; NULL when none.
80
80
  thumbnail_type TEXT,
81
+ -- When the owner cleared the original bytes to free space (the record and thumbnail stay); NULL while kept.
82
+ cleared_at TEXT,
81
83
  UNIQUE(room_id, submission_id)
82
84
  );
83
85
  CREATE INDEX IF NOT EXISTS attachments_message ON attachments(message_id, position);
package/backend/server.py CHANGED
@@ -603,6 +603,8 @@ def init_database(database, seed=True):
603
603
  connection.execute(f"ALTER TABLE attachments ADD COLUMN {name} INTEGER")
604
604
  if "thumbnail_type" not in attachment_columns:
605
605
  connection.execute("ALTER TABLE attachments ADD COLUMN thumbnail_type TEXT")
606
+ if "cleared_at" not in attachment_columns:
607
+ connection.execute("ALTER TABLE attachments ADD COLUMN cleared_at TEXT")
606
608
  if connection.execute("INSERT OR IGNORE INTO site_preferences (key,value) VALUES ('child_folders_migrated','1')").rowcount:
607
609
  connection.execute("""UPDATE room_folder_assignments AS child SET folder_id=parent.folder_id
608
610
  FROM room_links l JOIN room_folder_assignments parent ON parent.room_id=l.other_room_id
@@ -651,6 +653,9 @@ def require_room(connection, room_id):
651
653
  queued_files = sum(len(json.loads(row[0]).get("attachment_ids") or []) for row in
652
654
  connection.execute("SELECT payload FROM queued_messages WHERE room_id=?", (room_id,)))
653
655
  room["next_attachment_number"] = attachment_number_before(connection, room_id, None) + queued_files
656
+ # Bytes of this room's stored files (sent and not-yet-sent uploads), shown beside the draft meter on the room page.
657
+ room["attachment_bytes"] = connection.execute(
658
+ "SELECT COALESCE(SUM(size),0) FROM attachments WHERE room_id=? AND cleared_at IS NULL", (room_id,)).fetchone()[0]
654
659
  settings = connection.execute("SELECT host,background,boundaries,experts,focus FROM topic_settings WHERE room_id=?",
655
660
  (room_id,)).fetchone()
656
661
  room.update(dict(settings) if settings else topic_defaults())
@@ -2663,6 +2668,54 @@ def discard_attachment(connection, database, room_id, identifier, token):
2663
2668
  return {"discarded": identifier}
2664
2669
 
2665
2670
 
2671
+ def attachment_usage(connection, room_id, token):
2672
+ """List every sent file of the room with its size and state, for the owner choosing what to clear."""
2673
+ require_room(connection, room_id)
2674
+ require_owner(connection, room_id, token)
2675
+ rows = connection.execute("""SELECT * FROM attachments WHERE room_id=? AND message_id IS NOT NULL
2676
+ ORDER BY message_id,position,id""", (room_id,)).fetchall()
2677
+ files = [{**attachment_view(row), "number": index + 1} for index, row in enumerate(rows)]
2678
+ return {"attachments": files, "bytes": sum(item["size"] for item in files if not item["cleared_at"])}
2679
+
2680
+
2681
+ def clear_attachments(connection, database, room_id, payload, token):
2682
+ """Delete the original bytes of chosen sent files to free space; records, numbers and thumbnails stay.
2683
+
2684
+ Args:
2685
+ payload: ``{"ids": [attachment ID, ...]}``; IDs already cleared are skipped.
2686
+
2687
+ Returns:
2688
+ ``{"cleared": [IDs cleared now], "freed_bytes": int}``.
2689
+ """
2690
+ begin_write(connection)
2691
+ require_room(connection, room_id)
2692
+ require_owner(connection, room_id, token)
2693
+ identifiers = payload.get("ids")
2694
+ if not isinstance(identifiers, list) or not identifiers or not all(isinstance(item, str) for item in identifiers):
2695
+ raise ValueError(Text('ids 须为非空的附件 ID 列表'))
2696
+ marks = ",".join("?" * len(set(identifiers)))
2697
+ rows = connection.execute(f"""SELECT * FROM attachments WHERE room_id=? AND message_id IS NOT NULL
2698
+ AND cleared_at IS NULL AND id IN ({marks})""", (room_id, *set(identifiers))).fetchall()
2699
+ known = {row[0] for row in connection.execute(f"SELECT id FROM attachments WHERE room_id=? AND message_id IS NOT NULL AND id IN ({marks})",
2700
+ (room_id, *set(identifiers)))}
2701
+ missing = sorted(set(identifiers) - known)
2702
+ if missing:
2703
+ raise LookupError(Text('附件不存在:{ids}', ids="、".join(missing)))
2704
+ now = utc_iso_now()
2705
+ for row in rows:
2706
+ connection.execute("UPDATE attachments SET cleared_at=? WHERE id=?", (now, row["id"]))
2707
+ if rows:
2708
+ # Messages show the change, so the room's readers refresh as after an edited message.
2709
+ connection.execute("UPDATE room_revisions SET revision=(SELECT MAX(revision)+1 FROM room_revisions) WHERE room_id=?", (room_id,))
2710
+ connection.commit()
2711
+ for row in rows:
2712
+ try:
2713
+ attachment_path(database, row).unlink(missing_ok=True)
2714
+ except OSError:
2715
+ logging.warning("Could not remove cleared attachment %s", row["id"], exc_info=True)
2716
+ return {"cleared": [row["id"] for row in rows], "freed_bytes": sum(row["size"] for row in rows)}
2717
+
2718
+
2666
2719
  def check_message_attachments(connection, room_id, actor, identifiers):
2667
2720
  """Reject references to another room, uploader, or already published message."""
2668
2721
  for identifier in identifiers:
@@ -3212,6 +3265,9 @@ def query_messages(connection, room_id, params, token=""):
3212
3265
  # The spec keeps `max_chars` for an optional text-only sub-budget, which is not offered yet.
3213
3266
  raise ValueError(Text('max_chars(正文子预算)暂不支持;整体输出预算请用 max_output_chars'))
3214
3267
  if params.get("max_output_chars") not in (None, ""):
3268
+ # Agent reads drop empty fields first: most of a message's metadata is unused relay and link fields, which would
3269
+ # otherwise take about half the budget and end a page after a few answers.
3270
+ messages = [without_empty_fields(message) for message in messages]
3215
3271
  fitted = fit_messages(messages, output_budget(params["max_output_chars"]))
3216
3272
  budget_stopped, has_more = len(fitted) < len(messages) or fitted[-1:] != messages[-1:], has_more or len(fitted) < len(messages)
3217
3273
  messages = fitted
@@ -3255,6 +3311,11 @@ def compact_chars(value):
3255
3311
  return len(json.dumps(value, ensure_ascii=False, separators=(",", ":")))
3256
3312
 
3257
3313
 
3314
+ def without_empty_fields(message):
3315
+ """A message without its null, empty-string and empty-collection fields; the text stays even when empty, and 0 stays."""
3316
+ return {key: value for key, value in message.items() if key == "text" or value not in (None, "", [], {})}
3317
+
3318
+
3258
3319
  def fit_messages(messages, budget):
3259
3320
  """Keep whole messages while they fit the budget; a first message too long to fit becomes an honest preview."""
3260
3321
  kept, used = [], 0
@@ -3475,18 +3536,18 @@ def state_reading_text(room, language="zh"):
3475
3536
 
3476
3537
  def message_text(message, language="zh"):
3477
3538
  """Render an original message with its provenance and reply reference."""
3478
- reply = read_text(Text(" · 回复 #{reply_to}", reply_to=message["reply_to"]), language) if message["reply_to"] else ""
3539
+ reply = read_text(Text(" · 回复 #{reply_to}", reply_to=message.get("reply_to")), language) if message.get("reply_to") else ""
3479
3540
  role = read_text({"moderation": Text("主持发言"), "receipt": Text("运行回执"), "chat": Text("协作消息")}.get(
3480
3541
  message.get("kind"), Text("专家观点")), language)
3481
3542
  summary = (read_text(Text("\n回答摘要({summary_by}):\n{summary}\n\n完整正文:\n",
3482
- summary_by=reading_identity(message["summary_by"], language),
3543
+ summary_by=reading_identity(message.get("summary_by", ""), language),
3483
3544
  summary=reading_field(message, "summary", language)), language)
3484
3545
  if message.get("summary") else "\n")
3485
3546
  attachments = "".join(read_text(Text("\n附件:{file_name}({size} 字节;ID: {id})\n{download_url}", **item), language)
3486
3547
  for item in message.get("attachments", []))
3487
3548
  return read_text(Text("#{id} · {author} · {created_at}{reply}\n职责:{role};来源:{source};提交者:{submitted_by}{summary}{text}{attachments}",
3488
3549
  id=message["id"], author=reading_identity(message["author"], language), created_at=message["created_at"], reply=reply,
3489
- role=role, source=message["source"], submitted_by=reading_identity(message.get("submitted_by", "用户"), language),
3550
+ role=role, source=message.get("source", ""), submitted_by=reading_identity(message.get("submitted_by", "用户"), language),
3490
3551
  summary=summary, text=reading_field(message, "text", language), attachments=attachments), language)
3491
3552
 
3492
3553
 
@@ -4811,6 +4872,13 @@ class DiscussionHandler(BaseHTTPRequestHandler):
4811
4872
  def handle_attachments(self, connection, parts, params, method):
4812
4873
  """Handle bounded upload, discovery, metadata, and binary download."""
4813
4874
  room_id = parts[2]
4875
+ if parts[4:] == ["usage"] and method == "GET":
4876
+ return self.respond(attachment_usage(connection, room_id, self.headers.get("X-Discussion-Token", "")))
4877
+ if parts[4:] == ["clear"] and method == "POST":
4878
+ result = clear_attachments(connection, self.server.database, room_id, self.read_payload(),
4879
+ self.headers.get("X-Discussion-Token", ""))
4880
+ self.server.hub.notify_update(room_id)
4881
+ return self.respond(result)
4814
4882
  if len(parts) == 4:
4815
4883
  if method == "GET":
4816
4884
  return self.respond(query_attachments(connection, room_id, params, self.headers.get("X-Discussion-Token", "")))
@@ -4846,6 +4914,8 @@ class DiscussionHandler(BaseHTTPRequestHandler):
4846
4914
  content=len(parts) == 6)
4847
4915
  if len(parts) == 5:
4848
4916
  return self.respond(attachment)
4917
+ if parts[5] in ("content", "zip") and attachment.get("cleared_at"):
4918
+ raise LookupError(Text('附件已被清理'))
4849
4919
  if parts[5] == "content":
4850
4920
  return self.respond_attachment(attachment, params.get("download") == "1")
4851
4921
  if parts[5] == "thumbnail":
@@ -172,16 +172,20 @@ npx wrangler deploy --config deploy/updates.wrangler.jsonc
172
172
  开了托管管理、想让托管账号的使用者不用自有域名就能从外网登录时,再部署入口 Worker(在中转之后部署,它使用中转的 Durable Object):
173
173
 
174
174
  ```sh
175
- npx wrangler deploy --config deploy/entry.wrangler.jsonc
175
+ node scripts/entry_config.mjs
176
+ npx wrangler deploy --dry-run --config .wrangler/entry.json
177
+ npx wrangler deploy --config .wrangler/entry.json
176
178
  ```
177
179
 
180
+ 入口配置从 `.wrangler/deploy/wrangler.jsonc` 复制 Pages 的 DB 绑定(必须含 database_id),写入私有的 `.wrangler/entry.json`。演练输出应列出同一个 DB 和中转 RELAY,演练不会上传。
181
+
178
182
  它有自己的 `workers.dev` 地址(如 `https://codiscuss-entry.<账号子域>.workers.dev`),与线上站点不同源,托管账号的网页碰不到你已配对设备的密钥。把这个地址写进私有配置的 `vars`,重新部署 Pages,线上站点就会把它告诉来接入的托管电脑:
179
183
 
180
184
  ```json
181
185
  "vars": { "ENTRY_URL": "https://codiscuss-entry.<账号子域>.workers.dev" }
182
186
  ```
183
187
 
184
- 接入一台托管电脑:在你(部署线上站点的电脑)的管理面板“概览 → 登录入口 → 管理员入口 → 线上网站”点“生成接入码”,填部署配置路径与站点地址后生成(需已登录 wrangler;一次性,再生成会让未用过的作废);把接入码发给托管电脑,在它的“概览 → 登录入口 → 管理员入口 → 线上网站”点“绑定”粘贴,再到“登录入口 → 托管账号入口”打开“经线上网站中转”的开关,它会取得入口地址并启动所需服务(已开启的自有域名不受影响,两者可同时使用;命令行 `codiscuss admin entry join 接入码` 一步完成这些)。托管账号默认就能邀请外部专家:开着自有域名时经你的域名直连,否则由面板自动替账号绑定线上网站,都不需要接入码。面板给出的链接带电脑编号(`?m=…`),发给使用者即可。使用者的请求经入口 Worker 和中转到达这台电脑的登录入口,登录、会话与入口保护都在电脑上;Cloudflare 能看到这些往来内容(与自有域名隧道相同),每个页面的请求都计入 Workers 免费额度。
188
+ 接入一台托管电脑:在你(部署线上站点的电脑)的管理面板“概览 → 本机 → 自建中转”点“生成接入码”,填部署配置路径与线上网站地址后生成(需已登录 wrangler;一次性,再生成会让未用过的作废);把接入码发给托管电脑,在它的“概览 → 本机 → 自建中转”点“绑定”粘贴,再到“登录入口 → 托管账号入口”打开“自建中转”的开关,它会取得入口地址并启动所需服务(已开启的 Cloudflare 隧道不受影响,两者可同时使用;命令行 `codiscuss admin entry join 接入码` 一步完成这些)。托管账号默认就能邀请外部专家:开启 Cloudflare 隧道时经你的域名直连,否则由面板自动替账号绑定自建中转,都不需要接入码。面板给出的链接带电脑编号(`?m=…`),发给使用者即可。使用者的请求经入口 Worker 和中转到达这台电脑的登录入口,登录、会话与入口保护都在电脑上;Cloudflare 能看到这些往来内容(与 Cloudflare 隧道相同),每个页面的请求都计入 Workers 免费额度。
185
189
 
186
190
  ## 常见问题
187
191
 
@@ -170,16 +170,20 @@ Older versions also had the live-update object `DiscussionUpdates` (binding `UPD
170
170
  If you use hosting and want hosted accounts' users to sign in from outside without your own domain, also deploy the entry Worker (after the relay, since it uses the relay's Durable Object):
171
171
 
172
172
  ```sh
173
- npx wrangler deploy --config deploy/entry.wrangler.jsonc
173
+ node scripts/entry_config.mjs
174
+ npx wrangler deploy --dry-run --config .wrangler/entry.json
175
+ npx wrangler deploy --config .wrangler/entry.json
174
176
  ```
175
177
 
178
+ The generator copies the Pages DB binding, including its required database_id, from `.wrangler/deploy/wrangler.jsonc` into the private `.wrangler/entry.json`. Check that the dry run lists the same DB and the RELAY binding before deploying.
179
+
176
180
  It gets its own `workers.dev` address (such as `https://codiscuss-entry.<account-subdomain>.workers.dev`), on a different origin from the online site, so hosted accounts' pages can't reach your paired devices' keys. Put this address in the `vars` of your private configuration and redeploy Pages; the online site then hands it to hosted computers that connect:
177
181
 
178
182
  ```json
179
183
  "vars": { "ENTRY_URL": "https://codiscuss-entry.<account-subdomain>.workers.dev" }
180
184
  ```
181
185
 
182
- To connect a hosted computer: in the admin panel of your computer (the one that deployed the online site), go to **Overview → Sign-in entry → Administrator entry → Online site**, choose **Generate access code**, fill in the deployment config path and site address, and generate it (wrangler must be signed in; the code is single-use, and generating a new one voids unused ones). Send it to the hosted computer, paste it under **Overview → Sign-in entry → Administrator entry → Online site → Bind** there, then turn on **Through the online site** under **Sign-in entry → Hosted account entry**; it fetches the entry address and starts what it needs (an enabled own domain is unaffected and both can be on; `codiscuss admin entry join <code>` does all of this in one step). Hosted accounts can invite external experts by default: through your own domain when it is on, otherwise the panel binds each account to the online site for you; no access code is needed. The link the panel shows carries the computer's ID (`?m=…`); send it to the users. Their requests reach this computer's sign-in entry through the entry Worker and the relay, while sign-in, sessions and entry protection all stay on the computer. Cloudflare can see this traffic (as with a tunnel on your own domain), and every page request counts against the free Workers quota.
186
+ To connect a hosted computer: in the admin panel of your computer (the one that deployed the online site), go to **Overview → This computer → Self-hosted relay**, choose **Generate access code**, fill in the deployment config path and online site address, and generate it (wrangler must be signed in; the code is single-use, and generating a new one voids unused ones). Send it to the hosted computer, paste it under **Overview → This computer → Self-hosted relay → Bind** there, then turn on **Self-hosted relay** under **Sign-in entry → Hosted account entry**; it fetches the entry address and starts what it needs (an enabled Cloudflare Tunnel is unaffected and both can be on; `codiscuss admin entry join <code>` does all of this in one step). Hosted accounts can invite external experts by default: through your own domain when it is on, otherwise the panel binds each account to the online site for you; no access code is needed. The link the panel shows carries the computer's ID (`?m=…`); send it to the users. Their requests reach this computer's sign-in entry through the entry Worker and the relay, while sign-in, sessions and entry protection all stay on the computer. Cloudflare can see this traffic (as with a tunnel on your own domain), and every page request counts against the free Workers quota.
183
187
 
184
188
  ## Troubleshooting
185
189
 
@@ -7,13 +7,16 @@ Use the local management panel or the corresponding codiscuss admin commands to
7
7
  - **Open on Windows:** During codiscuss setup, select the option to create a CoDiscuss shortcut, or run codiscuss launcher later. Open the desktop shortcut. The CoDiscuss icon appears in the system tray. On first use, enable it under Windows Settings → Personalization → Taskbar → “其他系统托盘图标”. Left-click the tray icon to open the management panel, or run codiscuss panel in a terminal. Right-click to open the site, restart, or stop the service. The panel is available on this computer only.
8
8
  - **Overview:**
9
9
  - **This computer:** Check the CoDiscuss service status, start, restart, stop, or select **Open site**. When hosting is enabled, this page also shows **Program copies** used by isolated accounts.
10
- - **Administrator entry / Online site:** View the local and linked online site addresses. Select **Bind**, **Unbind**, or **Generate access code**.
11
- **Online site** and `codiscuss admin status` show **Relay connected** after a heartbeat reply on the current connection, explain disconnects, retries or consecutive HTTP failures, and show **Status unknown** if the service is stopped or its observations are stale. After 3 minutes without heartbeat confirmation, the service rebuilds that site’s connection. Select **Reconnect now** or run `codiscuss admin site reconnect` to request it immediately.
12
- - **Hosted account entry** (shown when hosting is enabled): Start or stop the **Sign-in entry**, enable **Through the online site**, or configure your **Own domain** using Cloudflare Tunnel.
10
+ - **This computer / Self-hosted relay:** View the local and linked online site addresses. Select **Bind**, **Unbind**, or **Generate access code**.
11
+ **Self-hosted relay** and `codiscuss admin status` show **Relay connected** after a heartbeat reply on the current connection, explain disconnects, retries or consecutive HTTP failures, and show **Status unknown** if the service is stopped or its observations are stale. After 3 minutes without heartbeat confirmation, the service rebuilds that site’s connection. Select **Reconnect now** or run `codiscuss admin site reconnect` to request it immediately.
12
+
13
+ On the right of Overview → This computer → Self-hosted relay, pick the region in the Relay region dropdown. The default is Asia Pacific. This setting applies to administrator access, hosted account sign-in through the relay, and external expert invitations. Automatic creates the object near the first party to connect, usually the computer’s network exit. Its location stays fixed after creation. Other values are location hints. After the service syncs the change, the computer and paired devices reconnect automatically. Run `codiscuss admin site region` to inspect the setting or `codiscuss admin site region weur` to select Western Europe.
14
+ - **Hosted account entry** (shown when hosting is enabled): Start or stop the **Sign-in entry**, enable **Self-hosted relay**, or configure the **Cloudflare Tunnel**.
13
15
  - **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
16
  - **Storage:**
15
17
  - 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
18
  - 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.
19
+ - **Room attachments** lists each room's sent, not-yet-cleared attachments, largest first. Select **Manage attachments** to expand the same attachment manager as on the room page (see “Storage and limits” in [Managing rooms](rooms.md)).
17
20
  - **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
21
  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
22
  - **Account:**
@@ -35,8 +38,8 @@ On Windows, open the panel from the tray. On macOS and Linux, use the command-li
35
38
  - **Why isolate:** Without isolation, the hosted account runs as your Windows user. Its AI can read your personal files, and the account shares your sign-ins and skills. Isolation gives it a separate Windows user, sign-ins, and folders.
36
39
  - **Entry protection:** This is enabled by default on the hosted account details page and is available on Windows only. It restricts site access to users authenticated by the sign-in entry and that account’s own AI, blocking direct access by other local programs.
37
40
  3. **Configure remote access** using either or both options:
38
- - **Through the online site, without your own domain:** Follow the [deployment guide](../deployment.md#entry-for-hosted-accounts-optional) to deploy the entry Worker. On the deployment computer, generate an access code under **Overview** → **This computer** → **Online site**. On this computer, bind the online site and turn on **Through the online site** under **Hosted account entry**. You can also run codiscuss admin entry join <access-code>.
39
- - **Own domain:** Under **Hosted account entry** → **Own domain**, authorize a Cloudflare tunnel and connect a domain hosted on Cloudflare. The CLI equivalent is codiscuss admin entry tunnel <domain>.
41
+ - **Self-hosted relay, without your own domain:** Follow the [deployment guide](../deployment.md#entry-for-hosted-accounts-optional) to deploy the entry Worker. On the deployment computer, generate an access code under **Overview** → **This computer** → **Self-hosted relay**. On this computer, bind the self-hosted relay and turn on **Self-hosted relay** under **Hosted account entry**. You can also run codiscuss admin entry join <access-code>.
42
+ - **Cloudflare Tunnel:** Under **Hosted account entry** → **Cloudflare Tunnel**, authorize a Cloudflare tunnel and connect a domain hosted on Cloudflare. The CLI equivalent is `codiscuss admin entry tunnel <domain>`. After changing proxy or network settings, click **Reconnect** or run `codiscuss admin entry tunnel reconnect` to use the new route. Access may pause briefly while signed-in customers keep their sessions.
40
43
  4. **Manage the account:** Start or stop its instance, enable, disable or remove the account, reset its password, and provide API keys. Users see **Provided by admin** for administrator-provided keys and cannot view or change them. To invite external experts, the account needs an online relay. The panel checks instances requested to run every minute and restarts them if their port refuses connections, up to 3 times in 10 minutes. After repeated failures, the account row shows the last error. Check `codiscuss admin status` for the latest attempt and start the instance manually after fixing the cause to resume recovery.
41
44
 
42
45
  ### Move an existing account’s project data to another drive
@@ -60,8 +63,9 @@ Every command in the table is prefixed by codiscuss admin and returns JSON. Thes
60
63
  | Start, exit, restart, or update (panel need not be running) | `codiscuss admin start`, `stop`, `restart`, `update [check]` |
61
64
  | Check status, control service, configure sign-in startup | `status [--full]`, `service start\|stop\|restart`, `autostart on\|off` |
62
65
  | Inspect storage usage and clear temporary run files | `storage`, `storage clean`, `storage repair` (preview), `storage repair logs --confirm` |
63
- | Link/unlink online site and create access code | `site status`, `site connect <access-code\|site>`, `site disconnect`, `entry code` |
64
- | Manage sign-in entry and tunnel | `entry start\|stop`, `entry join <access-code>`, `entry open\|close relay\|tunnel`, `entry tunnel <domain>` |
66
+ | View and clear attachments by room | `codiscuss admin storage attachments` (usage per room), `storage attachments ROOM` (list files), `storage attachments ROOM clear ID... --confirm` |
67
+ | Bind/unbind the self-hosted relay and create access code | `site status`, `site connect <access-code\|site>`, `site disconnect`, `entry code` |
68
+ | Manage sign-in entry and tunnel | `entry start\|stop`, `entry join <access-code>`, `entry open\|close relay\|tunnel`, `entry tunnel <domain>`, `entry tunnel reconnect` |
65
69
  | Manage hosted account lifecycle | `account list`, `account add <name>`, `account start\|stop\|disable\|enable\|remove\|password <name>`, `account isolate\|protect <name>` |
66
70
  | Manage sign-ins, keys, skills, workflows, and prompts | `login status <target>`, `key add <target> --base-url … --key …`, `skill install <target> <skill>`, `workflow install <target>`, `workflow update <target>`, `prompt set <target> --file …` |
67
71
 
@@ -72,4 +76,4 @@ Use owner as <target> for the administrator, or use a hosted account name. If ac
72
76
  - **admin stop leaves hosted instances running:** codiscuss admin stop exits the panel, tray icon, sign-in entry, tunnel, and administrator service. Already running hosted-account instances continue. To stop one, run codiscuss admin account stop <name>.
73
77
  - **Administrator approval:** Create or delete isolated Windows users from an administrator terminal or administrator SSH session. Otherwise, approve the UAC prompt on the computer.
74
78
  - **Panel-only actions:** Select **Initialize again** for an existing hosted account’s AI environment or change the management panel language in the panel.
75
- - **Remote traffic:** When hosted accounts connect through the online site or a Cloudflare Tunnel, login and session protection run on your computer, while traffic passes through Cloudflare and counts toward Workers usage.
79
+ - **Remote traffic:** When hosted accounts connect through the self-hosted relay or a Cloudflare Tunnel, login and session protection run on your computer, while traffic passes through Cloudflare and counts toward Workers usage.
@@ -10,30 +10,25 @@ See how your work is going across all rooms: how many tasks needed no further in
10
10
 
11
11
  ## What the page shows
12
12
 
13
- At the top, switch between "Today", "Last 7 days", "Last 30 days" and "All time" (split by your device's time zone, always including today; the first three are compared with the same length of time just before, "All time" has no comparison). The refresh icon reloads the data. When the page opens, the sections slide in one after another and the numbers count up from 0. If your system asks for reduced motion, or effects are turned off in CoDiscuss, the results appear at once.
14
-
15
- 1. **Overview** (titled with the selected period):
16
- - **Unassisted rate**: the share of finished tasks you never stopped, retracted or rolled back, with how many points it rose or fell from the previous period. Interjections, follow-ups and failure retries do not count as intervention.
17
- - **Finished tasks by start day**: tasks grouped by the day they were started, counting those that have finished, split into "Left alone" and "Stepped in", so you can see why the rate moved. Hover a bar for that day's numbers. A task started on Monday and finished on Wednesday counts on Monday. Hidden for "Today", where the three facts below sit side by side instead.
18
- - **Started**: messages you sent that a member handled (one `@all` counts once), the change from the previous period, and how many got a reply.
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
- - **Total AI execution time**: execution time summed across members, so it exceeds the time that passed when several run at once.
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". 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):
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".
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.
28
- - Messages queued right now and the oldest wait.
13
+ This page is for you alone and is meant to surface what needs attention; use the share image to show your work to others. At the top, switch between "Today", "Last 7 days", "Last 30 days" and "All time" (split by your device's time zone, always including today; the first three are compared with the same length of time just before). The refresh icon reloads the data. When the page opens, the sections slide in one after another and the numbers count up from 0. If your system asks for reduced motion, or effects are turned off in CoDiscuss, the results appear at once.
14
+
15
+ 1. **Overview**: a short line under the title sums up the period. Four figures follow: total AI work time, tasks moved forward, the most experts running at once (with rooms), and the share that needed no follow-up (with how often you stepped in), each with its change from the previous period ("Today" is not compared). Below is a timeline: blue is how many experts were running, and red marks under the same time axis are runs that did not finish; hover to read a time step. Where failures bunched up is visible at a glance.
16
+ 2. **Needs a look**: issues picked from this period's runs by fixed rules; the first 3 show by default. Runs that did not finish are grouped by reason, so one cause such as an expired lease is one item even when it hit several models, with the groups it touched, when it happened and its share of the related runs. Stops by you, permission blocks, runs marked failed that later answered, runs with no recorded model and negative smart-scheduling feedback are listed per member or room. An item is listed at 5% or more of the related runs or when it doubled from last period; it is red at 10% or more or when it doubled, grey otherwise. Items state what happened and do not judge which model is better.
17
+ - Expand an item to see its latest 30 runs with time, room, member and result. Click a run to open its room at the message that asked for it.
18
+ - With nothing to report, the page says "All clear: nothing needs you in this period".
19
+ 3. **Details** (projects and models open by default; click the other titles to expand):
20
+ - **Which projects take the time**: share of execution time, total time and started count per room's current folder; expand a folder to its rooms and click a room to open it.
21
+ - **Which models earn more work**: totals across all rooms per software, model and effort. Sort by clicking "Runs", "Outcome", "Duration" or "Stopped / retried"; the small bar by the completion rate splits runs into completed, failed, stopped by you, cancelled otherwise and running (hover for counts).
22
+ - **How workflows are used**: the share of runs inside workflows, and for each workflow its runs, rooms, completion rate, duration, stops and how often each card and sub-workflow was called.
23
+ - **Where things get stuck**: delivery, pickup wait, member work and rework durations ("usually" means half finish within it, "slower" nine in ten); the unassisted rate; corrections such as stops, retractions and rollbacks, follow-up interjections; and the current queue.
29
24
 
30
25
  The bottom of the page states the scope and time zone. When deleted rooms have statistics, click "Existing rooms only" or "Include deleted rooms" to choose whether they count (they do by default).
31
26
 
32
27
  ## Share image
33
28
 
34
- Click "Share image" at the top right. The browser draws a PNG report card locally; preview it, then "Save image" or "Copy image". Nothing is uploaded to any server.
29
+ Click "Share image" at the top right. The browser draws a PNG locally; preview it, then "Save image" or "Copy image". Nothing is uploaded to any server.
35
30
 
36
- The image shows the unassisted rate, tasks started, experts running at once and total AI execution time, with the date range, time zone and the same scope sentence as the page footer. It has no member names, room titles, folder names or message text.
31
+ The image tells the story of your AI team's work: the hours AI worked for you, the most experts running at once, and a curve of how many experts ran at the same time over the period, with tasks started, rooms pushed at once and the share that "needed no follow-up" below, and the same scope sentence as the page footer. It has no member names, room titles, folder names or message text.
37
32
 
38
33
  ## Things to note
39
34
 
@@ -79,6 +79,6 @@ To see what changed in this version, click the version number after "AI CoDiscus
79
79
  | Reading → Lines shown when folded | Fewer, Medium, More | A folded answer keeps about 0.35, 0.6 or 0.9 of the screen, converted to lines from the screen height, so phones, tablets and computers each differ. Medium is the default; the choice applies to this device only. |
80
80
  | Room preferences → Host's default access | Read-only, Can write, Automatic, Full access | The project access the first member added to a new room (the host by default) starts with; Read-only by default. If its software doesn't support the chosen level, it stays read-only. Saved in the local service, kept across updates; needs the local service connected. |
81
81
  | Speech | Text-to-speech service, General voice, voices by platform and for files, Speed, Tone, Voice input, Local process | [Local and cloud speech](voice.md#read-aloud-and-voice-input-local-and-cloud-options) |
82
- | WeChat notifications | Scan to link, Send test, Unlink | [WeChat notifications](voice.md#wechat-notifications) |
82
+ | Notifications | WeChat: Scan to link, Send test, Unlink | [WeChat notifications](voice.md#wechat-notifications) |
83
83
 
84
84
  The site controls animations for work status, member card flips, and opening, minimizing, or switching the layout of the file preview window. Your system's reduced-motion setting does not change these animations. The hosted sign-in page always plays its brand animation.
@@ -37,7 +37,7 @@ When you start or edit Goal, enter an objective. Limits are unlimited by default
37
37
 
38
38
  ### 5. Set up WeChat notifications
39
39
 
40
- If you do not want to watch the computer, open “Settings → WeChat notifications” on the local site and click “Scan to link.” Scan the code with your personal WeChat account. When Goal is “Awaiting your confirmation” and you have not replied in the room for five minutes, the local service sends a WeChat reminder. If the computer is bound to an online site, the message includes a room link. For setup, testing, and reply behavior, see [Voice and notifications](voice.md#wechat-notifications).
40
+ If you do not want to watch the computer, open “Settings → Notifications” on the local site and click “Scan to link” under “WeChat.” Scan the code with your personal WeChat account. When Goal is “Awaiting your confirmation” and you have not replied in the room for three minutes, the local service sends a WeChat reminder. If the computer is bound to an online site, the message includes a room link. For setup, testing, and reply behavior, see [Voice and notifications](voice.md#wechat-notifications).
41
41
 
42
42
  ## Things to know
43
43
 
@@ -19,7 +19,7 @@ On the computer running the AI, use either method:
19
19
  - **CLI:** In a terminal, run:
20
20
  `codiscuss local connect https://your-site`
21
21
  If this is also the computer where you deployed the site and wrangler login is configured, the command creates a one-time token and links it automatically. If the AI runs on another computer, run `codiscuss token` on the deployment computer, then run `codiscuss local connect https://your-site --setup-key <token>` on the AI computer.
22
- - **Management panel access code:** On the deployment computer, open the management panel and go to **Overview** → **This computer** → **Online site** → **Generate access code**, or run `codiscuss admin entry code`. On the AI computer, open its management panel, go to **Overview** → **This computer** → **Online site** → **Bind**, and paste the **Access code**.
22
+ - **Management panel access code:** On the deployment computer, open the management panel and go to **Overview** → **This computer** → **Self-hosted relay** → **Generate access code**, or run `codiscuss admin entry code`. On the AI computer, open its management panel, go to **Overview** → **This computer** → **Self-hosted relay** → **Bind**, and paste the **Access code**.
23
23
 
24
24
  To stop remote access, select **Unlink** in the management panel or run `codiscuss local disconnect https://your-site`.
25
25
 
@@ -59,4 +59,4 @@ Phones support portrait layout only. Tablets support both portrait and landscape
59
59
  - **Attachment cache:** Pictures and files viewed through the relay are cached in this device’s browser and cleared when you unpair on this device.
60
60
  - **Clearing browser data requires pairing again:** Clearing browser data removes the device key. The handoff command also expires after 10 minutes, so keep the phone's clock reasonably accurate.
61
61
 
62
- **View file relay timings.** On your phone, open Settings → Account → Paired devices and expand Recent relay timings (ms). The latest 12 file requests show response frame sizes in bytes and estimates for the phone link, site processing, computer link and local processing. The two location codes identify the phone request and computer connection ingress respectively. A dash means unavailable.
62
+ **Relay timing records.** Each file read through the relay is logged on the computer in `relay-timing.jsonl` in the service directory, with the time spent on the phone link, site processing, computer link and local processing, and the locations each end connected to. Paths, content and credentials are not recorded. Nothing is shown in the interface; you or an AI read this file when diagnosing slow remote access.
@@ -47,7 +47,7 @@ When viewing a project image through the relay on another device, supported imag
47
47
  “File changes” below an answer shows the number of changed files and lines added or removed. Lists of five files or fewer open by default. Select the file count to open a longer list. Read-only visitors can see the list, but only the room owner can view patches.
48
48
 
49
49
  - **Add or remove directories.** A room supports one primary directory and up to eight additional directories. After creating a room, open the “Room” tab at the top of the room and find “Project folder”. Add or remove additional directories there. Changes apply from each member’s next run and do not interrupt a session. A primary directory cannot be changed after it is set. If the room was created without one, you can set it once in the same section. Members can access all room directories subject to their individual project permissions.
50
- - **Open Files.** In the tabs at the top of the room, select “Files” to browse directories, file sizes, and modification times. Switch between the primary and additional directories at the top. A project directory is required. The “Icon view” button at the top right lays the folder out as tiles, with thumbnails for PNG, JPG, and WebP images; “List view” switches back. Thumbnails are made by the computer and currently only on Windows; other images and files show their icons.
50
+ - **Open Files.** In the tabs at the top of the room, select “Files” to browse directories, file sizes, and modification times. Switch between the primary and additional directories at the top. A project directory is required. The back and forward buttons at the left of the path bar move between the places you visited (folders, the project list, the recycle bin); on a computer, the mouse side buttons do the same. Phones show only the back button. On a phone you can also swipe anywhere on the page: swipe right to go back and left to go forward. In a file preview, swiping right closes the file and returns to its folder (swiping left does nothing there; image and media previews keep their own gestures). The “Icon view” button at the top right lays the folder out as tiles, with thumbnails for PNG, JPG, and WebP images; “List view” switches back. Thumbnails are made by the computer and currently only on Windows; other images and files show their icons.
51
51
  - **Preview files.** Select a file to open its floating preview. Supported previews include plain text, code, rendered Markdown, static HTML with a source view, zoomable and rotatable images, audio and video with speed and full-screen controls, CSV tables, subtitle timelines (SRT, VTT, ASS, LRC), read-only Word, Excel, PowerPoint and PDF, Premiere project XML, and zip archives listed like a folder, where selecting a file inside opens it in a new tab. Images in Markdown display inline the way message images do; select one to zoom. Paths are accepted as common editors accept them: relative paths, project paths starting with `/`, absolute paths inside the room's project directories (such as `D:\Project\art\a.png` or `file:///D:/Project/art/a.png`), and web addresses. Files outside the room's project directories are not read. Images load as you scroll near them; landscape images fill the width and portrait images fit the window height. Other devices get a copy the computer compressed. Opening a ZIP attachment or project file loads the directory first. Select an entry to read it (up to 64 MiB), or choose “Download” to save the archive.
52
52
  - **Tabs, split view, and collapse.** Open multiple files and switch between tabs. Use the preview controls to split the view on the right or use “File location” to return to the containing folder. HTML previews also offer “Open in new tab”. Select “Collapse” in the title bar to keep the preview as a floating button in the corner. It restores the same file and scroll position when you return to the room. Close it to clear the preview.
53
53
  - **Quote and annotate.** Select text in a Markdown preview or a member’s answer and choose “Add to conversation”. Enter a note and press Enter. The source is marked with a number and the composer shows the number of notes. On a computer, open the notes list, choose “Edit annotation”, and drag the bottom-right corner of the editor to resize it. Sending the message adds a file path and line number, the member and message ID, or for a message attachment its message ID and attachment ID. An `@` inside a quote does not wake a member.
@@ -57,7 +57,7 @@ When viewing a project image through the relay on another device, supported imag
57
57
 
58
58
  - **Attach files.** Paste or drag files into the composer, or use the paperclip button at the bottom-left. Each message can contain up to 10 files, 20 MiB each. Thumbnails appear above the composer. A placeholder such as `[Image #1]` or `[File #2]` is inserted at the cursor. Removing the thumbnail or deleting its placeholder with Backspace removes both. After sending, images first referenced in a paragraph or list item appear right below it in a two-column half-width grid (full width for a single image on phones, two columns for multiple, with `#n` badges when a message carries more than one image) and are not listed again below; other attachments stay listed under the message. Windows sites automatically generate smaller previews for eligible PNG uploads. Open the image to view the original. The site automatically clears uploads left unsent for more than 24 hours. Attachments in sent or queued messages are kept.
59
59
  - **View attachments.** After sending a message, select its placeholder or attachment card. Images can be enlarged full-screen, zoomed, rotated, and saved; when the room has several images, the side buttons, the left and right arrow keys, or a sideways swipe on a phone step between them (the side buttons hide when idle and return when you move the mouse or tap the image). Audio and video play in the message. Documents and code open in the file preview.
60
- - **Interactive visualizations.** A member can place a small web page you can operate (drag a slider, press a button, watch the result change) inside the answer text. It appears at that point in the answer, follows the room theme and light or dark mode, and also appears in place on a phone. It starts running when you scroll near it. The row below lets you “Collapse” it (your choice is remembered), view the “Source”, “Open larger preview” in the file preview, open it in a “New tab”, or “Download” it as an `.html` file. Read-only share pages, read-aloud, and collapsed message previews show a single “Interactive visualization” line instead, so rely on the member's written conclusion. `.html` attachments do not run inside messages; select the file card to open them in the preview or a new tab. Some visualizations are question panels: after you rank, allocate, or adjust and press the panel's submit button, the result is added above the message box as a quote rather than sent. You can edit or remove it, and it counts as your reply only when you send it. Submitting the same panel again replaces its earlier result.
60
+ - **Interactive visualizations.** A member can place a small web page you can operate (drag a slider, press a button, watch the result change) inside the answer text. It appears at that point in the answer, follows the room theme and light or dark mode, and also appears in place on a phone. It starts running when you scroll near it. On a computer, tool buttons appear in its top-right corner when you point at it: view the “Source”, “Open larger preview” in the file preview, open it in a “New tab”, “Download” it as an `.html` file, or “Collapse” it (your choice is remembered). On a phone the corner always shows a “…” menu and the collapse button. A collapsed visualization shows as one “Interactive visualization” line; select “Expand” to bring it back. Members add these on their own when you ask for an illustrated answer, or when they explain a structure, process, or data. Read-only share pages, read-aloud, and collapsed message previews show a single “Interactive visualization” line instead, so rely on the member's written conclusion. `.html` attachments do not run inside messages; select the file card to open them in the preview or a new tab. Some visualizations are question panels: after you rank, allocate, or adjust and press the panel's submit button, the result is added above the message box as a quote rather than sent. You can edit or remove it, and it counts as your reply only when you send it. Submitting the same panel again replaces its earlier result.
61
61
  - **Member access to attachments.** For supported automatic runs, the local service downloads the file and passes its information to the receiving member. Claude Code and Codex CLI can view images directly. For API members, enable “Images” on the member card to view images. UTF-8 text attachments can be read on request. Members will say when they cannot read a format such as PDF.
62
62
 
63
63
  ### 5. Export, import, and branch rooms
@@ -80,7 +80,7 @@ When viewing a project image through the relay on another device, supported imag
80
80
 
81
81
  ### 6. Contact another room’s host
82
82
 
83
- 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.
83
+ 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 onto the messages or 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.
84
84
 
85
85
  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.
86
86
 
@@ -89,7 +89,7 @@ A message from another room goes to this room's current host: an idle host takes
89
89
  - **Notice when a room's work ends.** When all work in another room ends (it changes from "Running" to idle) and stays ended for a few seconds, the page shows "Work in room \"Room name\" has ended" in the lower-right corner. The room you are viewing is not announced, and neither is work that stops and resumes at once, as with an interjection or a retry. The page must be open.
90
90
  - **Shared directories are not locked.** If members edit the same project file at once, the page shows a conflict notification while the room is open. It is not added to the message history and does not wake the host.
91
91
  - Read large assets and repositories in their project folders. Never copy them into a member’s draft folder or its `.scratch` subfolder, even when the project is read-only. If a writable copy is necessary, ask the owner to designate a writable project folder.
92
- - **Draft storage and limits.** When connected to the local service or a paired computer, the **Draft storage** section at the bottom of the **Room** tab (expanded by default) shows usage (1 GiB per room, 3 GiB across all drafts, and 10 GiB for local `.codiscuss` data excluding speech models). The bar and text turn amber at 80% and red when over the limit (pausing new runs); reaching 8 GiB across `.codiscuss` also shows a warning notice, and any permission-denied unreadable entries are called out separately; **Draft storage** only counts unreadable entries in this room's drafts, while the computer-wide count is on the management panel **Storage** page. The room owner can select **Clear temporary files** in the expanded section to remove confirmed finished execution `.scratch` folders. If older drafts block the room, run `$codiscuss-draft-cleanup` in an **AI chat outside the room** to audit and delete rebuildable copies after confirmation; room records and attachments (`local/`) are never deleted automatically and require destroying old rooms to free space. Limits rely on periodic sampling rather than a filesystem write-layer hard quota and cannot guarantee the disk will never fill.
92
+ - **Storage and limits.** When connected to the local service or a paired computer, the **Storage** section at the bottom of the **Room** tab (expanded by default) shows usage (1 GiB per room, 3 GiB across all drafts, and 10 GiB for local `.codiscuss` data excluding speech models). If the room has attachments, an **Attachments** row below shows how much space they take; attachments are stored with the room records, do not count toward the draft quota, and are not removed by **Clear temporary files**. The room owner can select **Manage attachments** at the bottom to free attachment space: filter by type (images, audio & video, archives, documents, other) and age (older than 7 or 30 days), sorted largest first; the footer shows how much the selection frees. Select **Clear selected**, then **Confirm clear (cannot be undone)**. Messages stay, and each cleared attachment keeps its name, size and image thumbnail and is marked **Cleared**, but the original can no longer be opened, downloaded or read by members, and share pages and export packages no longer include it. The bar and text turn amber at 80% and red when over the limit (pausing new runs); reaching 8 GiB across `.codiscuss` also shows a warning notice, and any permission-denied unreadable entries are called out separately; **Draft storage** only counts unreadable entries in this room's drafts, while the computer-wide count is on the management panel **Storage** page. The room owner can select **Clear temporary files** in the expanded section to remove confirmed finished execution `.scratch` folders. If older drafts block the room, run `$codiscuss-draft-cleanup` in an **AI chat outside the room** to audit and delete rebuildable copies after confirmation; room records and attachments (`local/`) are never deleted automatically; clear attachment originals with **Manage attachments**, or destroy old rooms to free space. Limits rely on periodic sampling rather than a filesystem write-layer hard quota and cannot guarantee the disk will never fill.
93
93
  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.
94
94
  - **Preview and transfer limits.** Text previews show at most the first 128 KB. When another device accesses media and documents through the computer, each file is limited to 64 MB. The web app first attempts to compress videos larger than 3 MiB. Links pointing outside a project directory appear disabled and are rejected.
95
95
  - **A branch does not copy project files.** Branched and original rooms share the same project directory. Branching requires a connection to the local service.
@@ -5,7 +5,7 @@ Connect a lightweight decision model to handle routine assignment and turn hando
5
5
  ## What it can and cannot do
6
6
 
7
7
  - **It can:**
8
- - Route an unnamed message directly to a member when the request is clearly addressed to them, ask everyone to answer together or in speaking order, or determine that no reply is needed. Uncertain decisions go back to the host.
8
+ - Route an unnamed message directly to a member when the request is clearly addressed to them, ask everyone to answer together or in speaking order, or suggest that no reply is needed. The host handles no-reply suggestions and uncertain decisions.
9
9
  - During a discussion, turn a local follow-up into an ordinary question that does not count as a discussion turn and preserves the discussion queue. It can also choose the next speaker between rounds.
10
10
  - During Goal, when the room is idle, determine whether a recent answer is waiting for your reply. If confident, it can hold off waking the host.
11
11
  - At the end of each loop in a recurring relay, determine whether the final member, such as a reviewer, explicitly requested rework. If confident, it can start another loop. Acceptance or a decision requiring judgment goes to the host.
@@ -42,21 +42,22 @@ WeChat notifications use Tencent’s iLink bot channel with your **personal WeCh
42
42
 
43
43
  ### Set up WeChat
44
44
 
45
- 1. Open “Settings → WeChat notifications” on the local site and click “Scan to link.”
45
+ 1. Open “Settings → Notifications” on the local site and click “Scan to link” under “WeChat.”
46
46
  2. Scan the code with your personal WeChat account and confirm the login.
47
47
  3. **Send a test message:** After scanning, send any message from your phone to the newly bound bot so it can establish the conversation.
48
48
  4. Return to the site and click “Send test.” Linking is complete when the site says “Test notification sent” and you receive the test in WeChat. Click “Unlink” if you no longer need it.
49
49
 
50
50
  ### Notifications and replies
51
51
 
52
- - **Goal awaiting confirmation for five minutes:** If the host marks Goal as “Awaiting your confirmation” and you do not reply in the room for five minutes, the local service sends a WeChat reminder. When the computer is bound to an online site, the message includes a room link. A direct reply goes to the room associated with the most recent notification. If several rooms are waiting, reply to the notification for the room you mean.
53
- - **A member’s question waiting for five minutes:** Whether or not Goal is active, the service sends the question and numbered options after a question card has waited five minutes. Recommended options are marked “(recommended).”
52
+ - **Goal awaiting confirmation for three minutes:** If the host marks Goal as “Awaiting your confirmation” and you do not reply in the room for three minutes, the local service sends a WeChat reminder. When the computer is bound to an online site, the message includes a room link. A direct reply goes to the room associated with the most recent notification. If several rooms are waiting, reply to the notification for the room you mean.
53
+ - **A member’s question waiting for three minutes:** Whether or not Goal is active, the service sends the question and numbered options after a question card has waited three minutes. Recommended options are marked “(recommended).”
54
54
  - Reply with an option number. For multiple selections, separate numbers with spaces or commas. For several questions, answer in order, for example 1 2. You can also reply with text that exactly matches an option. The answer goes directly to the member who asked.
55
55
  - Other text goes to the host, who interprets it or asks you a follow-up in the room.
56
56
  - If the question was answered, canceled, or updated, WeChat explains why and does not submit a stale answer.
57
+ - **When a notification cannot be sent:** If the room is waiting for your answer or Goal confirmation and the latest WeChat notification failed, a dashed line above the question card on the Messages page gives the reason and how to fix it. “Settings → Notifications” also shows the time and reason of the failure. The most common cause is not having messaged the bot in WeChat for a long time, after which WeChat stops accepting notifications; send the bot any message in WeChat to restore it.
57
58
 
58
59
  ## Things to know
59
60
 
60
61
  - **The local service must be online:** Read aloud, voice input, and WeChat notifications run through the local service. If the computer is off or the service is stopped, paired devices cannot use them.
61
- - **Expired WeChat login:** If the login expires after a long period without use, open “Settings → WeChat notifications” and click “Scan to link” again.
62
+ - **Expired WeChat login:** If the login expires after a long period without use, open “Settings → Notifications” and, under “WeChat,” click “Scan to link” again.
62
63
  - **Speech recognition can mishear identifiers:** Local Qwen3-ASR handles mixed Chinese and English, punctuation, and capitalization well. It may misrecognize letter-by-letter abbreviations such as N-P-M or code identifiers. Review the draft before sending.