ai_co_discuss 0.5.21 → 0.5.23

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 (85) hide show
  1. package/.agents/skills/codiscuss-draft-cleanup/SKILL.md +16 -0
  2. package/.agents/skills/codiscuss-draft-cleanup/cleanup.py +70 -0
  3. package/.agents/skills/codiscuss-draft-cleanup/scan.py +70 -0
  4. package/.agents/skills/discuss-host/references/control.md +2 -2
  5. package/.agents/skills/discuss-host/references/workflow.md +4 -2
  6. package/.agents/skills/discuss-participant/SKILL.md +2 -0
  7. package/.agents/skills/local-stt-setup/SKILL.md +9 -8
  8. package/.agents/skills/local-tts-setup/SKILL.md +10 -9
  9. package/.agents/skills/share-card/SKILL.md +7 -6
  10. package/.agents/skills/share-card/references/share-card.md +34 -8
  11. package/.agents/skills/workflow-creator/SKILL.md +22 -14
  12. package/README.md +2 -0
  13. package/README.zh-CN.md +2 -0
  14. package/backend/free_room.py +64 -8
  15. package/backend/message_queue.py +9 -0
  16. package/backend/schema.sql +13 -1
  17. package/backend/server.py +289 -59
  18. package/docs/en/guide/admin.md +18 -0
  19. package/docs/en/guide/members.md +7 -1
  20. package/docs/en/guide/remote.md +1 -1
  21. package/docs/en/guide/rooms.md +14 -6
  22. package/docs/en/guide/voice.md +2 -0
  23. package/docs/en/guide/workflows.md +9 -5
  24. package/docs/en/guide/working.md +6 -4
  25. package/docs/guide/admin.md +18 -0
  26. package/docs/guide/members.md +7 -1
  27. package/docs/guide/remote.md +1 -1
  28. package/docs/guide/rooms.md +13 -6
  29. package/docs/guide/voice.md +2 -0
  30. package/docs/guide/workflows.md +9 -5
  31. package/docs/guide/working.md +6 -4
  32. package/frontend/locales/en/admin.json +58 -1
  33. package/frontend/locales/en/app.json +18 -1
  34. package/frontend/locales/en/backend.json +6 -0
  35. package/frontend/locales/en/core.json +4 -2
  36. package/frontend/locales/en/discussion.json +4 -1
  37. package/frontend/locales/en/room.json +85 -1
  38. package/gateway/gateway.mjs +49 -9
  39. package/package.json +3 -1
  40. package/runner/account_space.mjs +10 -0
  41. package/runner/adapters/antigravity_app.mjs +31 -4
  42. package/runner/adapters/antigravity_cli.mjs +9 -2
  43. package/runner/adapters/api.mjs +3 -2
  44. package/runner/adapters/api_pi.mjs +3 -2
  45. package/runner/adapters/api_pi_extension.mjs +5 -3
  46. package/runner/adapters/claude.mjs +32 -9
  47. package/runner/adapters/cli.mjs +2 -2
  48. package/runner/adapters/codex_app.mjs +192 -69
  49. package/runner/adapters/codex_cli.mjs +10 -5
  50. package/runner/adapters/common.mjs +414 -11
  51. package/runner/adapters/index.mjs +6 -0
  52. package/runner/admin_cli.mjs +22 -5
  53. package/runner/admin_panel.mjs +118 -5
  54. package/runner/admin_storage.mjs +105 -0
  55. package/runner/discussion_launch.mjs +328 -128
  56. package/runner/discussion_runner.mjs +12 -3
  57. package/runner/discussion_service.mjs +224 -37
  58. package/runner/discussion_skills.mjs +1 -1
  59. package/runner/expert_prompts.mjs +2 -2
  60. package/runner/experts.mjs +227 -0
  61. package/runner/file_diff.mjs +1 -1
  62. package/runner/free_runner.mjs +236 -51
  63. package/runner/i18n_en.mjs +39 -0
  64. package/runner/os_users.mjs +33 -1
  65. package/runner/project_files.mjs +7 -1
  66. package/runner/project_migration.mjs +245 -0
  67. package/runner/relay_channel.mjs +1 -1
  68. package/runner/remote_launch.mjs +4 -3
  69. package/runner/share_card.mjs +17 -1
  70. package/runner/share_shared.mjs +26 -9
  71. package/runner/site_deploy.mjs +2 -1
  72. package/runner/slash_names.mjs +12 -1
  73. package/runner/speech_directories.mjs +20 -0
  74. package/runner/storage_guard.mjs +383 -0
  75. package/runner/tts_providers.mjs +22 -21
  76. package/runner/workflows.mjs +211 -57
  77. package/web/admin.css +1 -1
  78. package/web/admin.js +8 -8
  79. package/web/app.js +589 -80
  80. package/web/i18n.js +4 -4
  81. package/web/markdown.css +1 -1
  82. package/web/modern.css +1 -1
  83. package/web/modern.js +68 -66
  84. package/workflows/decision-council/flow.json +216 -25
  85. package/workflows/trpg-classic/flow.json +151 -21
package/backend/server.py CHANGED
@@ -43,7 +43,7 @@ from .free_room import convert_suggestion, message_suggestions, save_suggestions
43
43
  from .free_room import adopt_recommendation, recommend_member, register_member, require_member
44
44
  from .private_chat import chat_action, member_chat
45
45
  from .external_members import external_api, guard_route as guard_external_route, is_external_path, owner_api as external_owner_api
46
- from .free_room import describe_members, execution_notes, label_members, check_relay, record_room_link, save_message_relay, set_host_checkin, withdraw_dispatch, member_descriptions, member_display_names, member_handles, member_labels, reorder_speakers, resolve_member_fields, set_chain_rounds, speaking_order, stop_room, stop_room_work
46
+ from .free_room import describe_members, execution_notes, label_members, check_relay, record_relay_send, record_room_link, save_message_relay, set_host_checkin, withdraw_dispatch, member_descriptions, member_display_names, member_handles, member_labels, reorder_speakers, resolve_member_fields, set_chain_rounds, speaking_order, stop_room, stop_room_work
47
47
  from .free_room import (ADAPTER_VALUE, LAYOUT_AFTER_SQL, LAYOUT_AT_SQL, continue_chain, execution_segments, execution_timeline, group_route_plan, retract_message, rewind_plan, rewind_room,
48
48
  host_event, host_hidden_event, room_event_log, withdrawals)
49
49
  from .room_trace import message_trace
@@ -237,12 +237,20 @@ CASE WHEN messages.author='用户' THEN (
237
237
  WHERE target.message_id=messages.id)
238
238
  ) END AS interjection_parent_id,
239
239
  EXISTS(SELECT 1 FROM proactive_messages p WHERE p.message_id=messages.id) AS proactive,
240
+ sent.target_room_id AS relay_sent_room, sent.host AS relay_sent_host, sent.target_message_id AS relay_sent_message_id,
241
+ sent.queued_id AS relay_sent_queued_id, sent.interrupted AS relay_sent_interrupted,
242
+ (SELECT r.title FROM rooms r WHERE r.id=sent.target_room_id) AS relay_sent_title,
243
+ (SELECT relation FROM room_links WHERE room_id=messages.room_id AND other_room_id=sent.target_room_id) AS relay_sent_relation,
240
244
  relay.source_room_id AS relay_room, relay.host AS relay_host,
245
+ COALESCE(NULLIF(relay.member,''),(SELECT name FROM room_members WHERE room_id=relay.source_room_id AND role='host' AND status='active')) AS relay_member,
246
+ (SELECT relation FROM room_links WHERE room_id=messages.room_id AND other_room_id=relay.source_room_id) AS relay_relation,
241
247
  (SELECT l.other_room_id FROM room_links l WHERE l.message_id=messages.id) AS link_room,
242
248
  (SELECT l.relation FROM room_links l WHERE l.message_id=messages.id) AS link_relation,
243
249
  (SELECT r.title FROM room_links l JOIN rooms r ON r.id=l.other_room_id WHERE l.message_id=messages.id) AS link_title,
244
250
  (SELECT r.title FROM rooms r WHERE r.id=relay.source_room_id) AS relay_title
245
251
  FROM messages LEFT JOIN message_details AS details ON details.message_id=messages.id
252
+ LEFT JOIN (SELECT message_id,target_room_id,host,target_message_id,queued_id,interrupted FROM room_relay_sends) AS sent
253
+ ON sent.message_id=messages.id
246
254
  LEFT JOIN message_relays AS relay ON relay.message_id=messages.id
247
255
  LEFT JOIN message_withdrawals AS withdrawn ON withdrawn.message_id=messages.id
248
256
  LEFT JOIN message_summaries AS summaries ON summaries.message_id=messages.id
@@ -498,47 +506,63 @@ def init_database(database, seed=True):
498
506
  database = Path(database)
499
507
  is_new = not database.exists()
500
508
  database.parent.mkdir(parents=True, exist_ok=True)
501
- with closing(connect_db(database)) as connection, connection:
502
- connection.execute("PRAGMA journal_mode = WAL")
503
- tables = {row[0] for row in connection.execute("SELECT name FROM sqlite_master WHERE type='table'")}
504
- if "room_members" in tables:
505
- columns = {row[1] for row in connection.execute("PRAGMA table_info(room_members)")}
506
- if "access" not in columns:
507
- connection.execute("ALTER TABLE room_members ADD COLUMN access TEXT NOT NULL DEFAULT 'runner'")
508
- if "session_mode" not in columns:
509
- connection.execute("ALTER TABLE room_members ADD COLUMN session_mode TEXT NOT NULL DEFAULT 'new'")
510
- migrate_legacy_discussion(connection, tables)
511
- # The recent-changes partial index needs this early column before schema is applied.
512
- if "member_executions" in tables:
513
- columns = {row[1] for row in connection.execute("PRAGMA table_info(member_executions)")}
514
- if "changes" not in columns:
515
- connection.execute("ALTER TABLE member_executions ADD COLUMN changes TEXT NOT NULL DEFAULT ''")
516
- # The goal-changed trigger in the schema reads these columns, so they must exist before it is created.
517
- if "room_goals" in tables:
518
- columns = {row[1] for row in connection.execute("PRAGMA table_info(room_goals)")}
519
- for name, kind in GOAL_PHASE_COLUMNS:
520
- if name not in columns:
521
- connection.execute(f"ALTER TABLE room_goals ADD COLUMN {name} {kind}")
522
- connection.executescript(SCHEMA)
523
- share_columns = {row[1] for row in connection.execute("PRAGMA table_info(room_share_links)")}
524
- for name in ("card_json", "card_edits"):
525
- if name not in share_columns:
526
- connection.execute(f"ALTER TABLE room_share_links ADD COLUMN {name} TEXT NOT NULL DEFAULT '{{}}'")
527
- directory_columns = {row[1] for row in connection.execute("PRAGMA table_info(room_directory)")}
528
- if "destroy_after_days" not in directory_columns:
529
- connection.execute("ALTER TABLE room_directory ADD COLUMN destroy_after_days INTEGER NOT NULL DEFAULT 0")
530
- if "destroy_set_at" not in directory_columns:
531
- connection.execute("ALTER TABLE room_directory ADD COLUMN destroy_set_at TEXT NOT NULL DEFAULT ''")
532
- if "directories" not in {row[1] for row in connection.execute("PRAGMA table_info(topic_folders)")}:
533
- connection.execute("ALTER TABLE topic_folders ADD COLUMN directories TEXT NOT NULL DEFAULT '[]'")
534
- # Images stored before sizes were recorded keep NULL here and are measured when first read (with_image_sizes).
535
- attachment_columns = {row[1] for row in connection.execute("PRAGMA table_info(attachments)")}
536
- for name in ("width", "height"):
537
- if name not in attachment_columns:
538
- connection.execute(f"ALTER TABLE attachments ADD COLUMN {name} INTEGER")
539
- migrate_free_tables(connection)
540
- if seed and is_new:
541
- seed_demo(connection)
509
+ with closing(connect_db(database)) as connection:
510
+ with connection:
511
+ if is_new:
512
+ connection.execute("PRAGMA auto_vacuum = INCREMENTAL")
513
+ connection.execute("PRAGMA journal_mode = WAL")
514
+ tables = {row[0] for row in connection.execute("SELECT name FROM sqlite_master WHERE type='table'")}
515
+ if "room_members" in tables:
516
+ columns = {row[1] for row in connection.execute("PRAGMA table_info(room_members)")}
517
+ if "access" not in columns:
518
+ connection.execute("ALTER TABLE room_members ADD COLUMN access TEXT NOT NULL DEFAULT 'runner'")
519
+ if "session_mode" not in columns:
520
+ connection.execute("ALTER TABLE room_members ADD COLUMN session_mode TEXT NOT NULL DEFAULT 'new'")
521
+ migrate_legacy_discussion(connection, tables)
522
+ # The recent-changes partial index needs this early column before schema is applied.
523
+ if "member_executions" in tables:
524
+ columns = {row[1] for row in connection.execute("PRAGMA table_info(member_executions)")}
525
+ if "changes" not in columns:
526
+ connection.execute("ALTER TABLE member_executions ADD COLUMN changes TEXT NOT NULL DEFAULT ''")
527
+ # The goal-changed trigger in the schema reads these columns, so they must exist before it is created.
528
+ if "room_goals" in tables:
529
+ columns = {row[1] for row in connection.execute("PRAGMA table_info(room_goals)")}
530
+ for name, kind in GOAL_PHASE_COLUMNS:
531
+ if name not in columns:
532
+ connection.execute(f"ALTER TABLE room_goals ADD COLUMN {name} {kind}")
533
+ connection.executescript(SCHEMA)
534
+ if 'member' not in {row[1] for row in connection.execute('PRAGMA table_info(message_relays)')}:
535
+ connection.execute("ALTER TABLE message_relays ADD COLUMN member TEXT NOT NULL DEFAULT ''")
536
+ share_columns = {row[1] for row in connection.execute("PRAGMA table_info(room_share_links)")}
537
+ for name in ("card_json", "card_edits"):
538
+ if name not in share_columns:
539
+ connection.execute(f"ALTER TABLE room_share_links ADD COLUMN {name} TEXT NOT NULL DEFAULT '{{}}'")
540
+ directory_columns = {row[1] for row in connection.execute("PRAGMA table_info(room_directory)")}
541
+ if "destroy_after_days" not in directory_columns:
542
+ connection.execute("ALTER TABLE room_directory ADD COLUMN destroy_after_days INTEGER NOT NULL DEFAULT 0")
543
+ if "destroy_set_at" not in directory_columns:
544
+ connection.execute("ALTER TABLE room_directory ADD COLUMN destroy_set_at TEXT NOT NULL DEFAULT ''")
545
+ if "directories" not in {row[1] for row in connection.execute("PRAGMA table_info(topic_folders)")}:
546
+ connection.execute("ALTER TABLE topic_folders ADD COLUMN directories TEXT NOT NULL DEFAULT '[]'")
547
+ # Images stored before sizes were recorded keep NULL here and are measured when first read (with_image_sizes).
548
+ attachment_columns = {row[1] for row in connection.execute("PRAGMA table_info(attachments)")}
549
+ for name in ("width", "height"):
550
+ if name not in attachment_columns:
551
+ connection.execute(f"ALTER TABLE attachments ADD COLUMN {name} INTEGER")
552
+ if connection.execute("INSERT OR IGNORE INTO site_preferences (key,value) VALUES ('child_folders_migrated','1')").rowcount:
553
+ connection.execute("""UPDATE room_folder_assignments AS child SET folder_id=parent.folder_id
554
+ FROM room_links l JOIN room_folder_assignments parent ON parent.room_id=l.other_room_id
555
+ WHERE l.relation='parent' AND child.room_id=l.room_id
556
+ AND child.folder_id IS NULL AND parent.folder_id IS NOT NULL""")
557
+ migrate_free_tables(connection)
558
+ if seed and is_new:
559
+ seed_demo(connection)
560
+ if not is_new:
561
+ try:
562
+ if reclaim_database_space(connection):
563
+ connection.execute("PRAGMA wal_checkpoint(TRUNCATE)")
564
+ except sqlite3.OperationalError:
565
+ logging.warning("Database space reclamation skipped on startup", exc_info=True)
542
566
 
543
567
 
544
568
  def room_display_texts(connection, room):
@@ -547,16 +571,20 @@ def room_display_texts(connection, room):
547
571
  if field in room and str(Text(payload["template"], **payload["params"])) == room[field]}
548
572
 
549
573
 
574
+ PARENT_ROOM = """SELECT p.id FROM room_links l JOIN rooms p ON p.id=l.other_room_id
575
+ WHERE l.relation='parent' AND l.room_id=rooms.id ORDER BY l.message_id LIMIT 1"""
576
+
577
+
550
578
  def require_room(connection, room_id):
551
579
  """Return a room and its current message count, or raise a lookup error."""
552
- row = connection.execute("""SELECT rooms.*,
580
+ row = connection.execute(f"""SELECT rooms.*, ({PARENT_ROOM}) AS parent_room_id,
553
581
  COALESCE(stats.message_count,0) AS message_count,COALESCE(stats.latest_id,0) AS latest_id
554
582
  FROM rooms LEFT JOIN room_message_stats stats ON stats.room_id=rooms.id WHERE rooms.id=? GROUP BY rooms.id""", (room_id,)).fetchone()
555
583
  if row is None:
556
584
  raise LookupError(Text('房间不存在'))
557
585
  if enforce_session_limits(connection, room_id):
558
586
  connection.commit()
559
- row = connection.execute("""SELECT rooms.*,
587
+ row = connection.execute(f"""SELECT rooms.*, ({PARENT_ROOM}) AS parent_room_id,
560
588
  COALESCE(stats.message_count,0) AS message_count,COALESCE(stats.latest_id,0) AS latest_id
561
589
  FROM rooms LEFT JOIN room_message_stats stats ON stats.room_id=rooms.id WHERE rooms.id=? GROUP BY rooms.id""", (room_id,)).fetchone()
562
590
  room = dict(row)
@@ -946,7 +974,7 @@ def list_rooms(connection, params=None):
946
974
  params = params or {}
947
975
  identifier = submission_value(params["submission_id"]) if "submission_id" in params else None
948
976
  where = "WHERE EXISTS (SELECT 1 FROM room_creations WHERE room_id=rooms.id AND submission_id=?)" if identifier else ""
949
- rows = connection.execute(f"""SELECT rooms.*,
977
+ rows = connection.execute(f"""SELECT rooms.*, ({PARENT_ROOM}) AS parent_room_id,
950
978
  COALESCE(stats.message_count,0) AS message_count,COALESCE(stats.latest_id,0) AS latest_id,
951
979
  (SELECT created_at FROM messages WHERE id=stats.latest_id) AS latest_at,
952
980
  (SELECT m.created_at FROM messages m WHERE m.room_id=rooms.id AND m.source<>'system'
@@ -1018,19 +1046,157 @@ def save_share_link(connection, room_id, payload):
1018
1046
  return share_link_record(connection, room_id)
1019
1047
 
1020
1048
 
1049
+ SHARE_CARD_RECEIPT = re.compile(
1050
+ r"^(?:(?:回答问题\s*#?\d+|Answer to question #\d+)(?:[::]|$)"
1051
+ r"|(?:请主持人先讨论并给推荐|交给主持人决定)(问题 #\d+)$"
1052
+ r"|(?:Host, please discuss and recommend first|Leaving it to the host to decide) \(question #\d+\)$)",
1053
+ re.IGNORECASE,
1054
+ )
1055
+ SHARE_CARD_SHORT_ACK = re.compile(
1056
+ r"^/?(?:继续|好的?|行|ok|yes|收到|同意|开始|可以|确认|嗯|明白|go|continue)[。.!!,,\s]*$",
1057
+ re.IGNORECASE,
1058
+ )
1059
+ SHARE_CARD_SLASH = re.compile(r"^/(?:goal|discuss)\b", re.IGNORECASE)
1060
+ SHARE_CARD_SENTENCE = re.compile(r"[^。!?.!?]+(?:[。!?]|[.!?](?=\s|$)|$)")
1061
+ SHARE_CARD_COPY_FENCE = re.compile(r"```share-copy[ \t]*\r?\n([\s\S]*?)\r?\n```")
1062
+ SHARE_CARD_SENSITIVE = re.compile(
1063
+ r"\bsk[-_](?:live_)?[A-Za-z0-9_-]{20,}|\bgh[pousr]_[A-Za-z0-9]{30,}|\bAIza[0-9A-Za-z_-]{30,}"
1064
+ r"|-----BEGIN [A-Z ]*PRIVATE KEY-----|\bBearer\s+[A-Za-z0-9._~+/-]{20,}"
1065
+ r"|\b[\w.+-]+@[\w-]+\.[\w.-]+\b|(?<!\d)1[3-9]\d{9}(?!\d)"
1066
+ )
1067
+
1068
+
1069
+ def _is_share_question_receipt(text):
1070
+ """Identify question-card receipts that should not be used as the room's opening question."""
1071
+ heading = str(text or "").lstrip().split("\n", 1)[0].rstrip()
1072
+ return bool(SHARE_CARD_RECEIPT.match(heading))
1073
+
1074
+
1075
+ def _share_card_lead(text, max_chars=160):
1076
+ """Extract one concise lead sentence (or two short ones) from the opening paragraph."""
1077
+ raw = str(text or "").replace("\r\n", "\n").strip()
1078
+ if not raw or SHARE_CARD_SENSITIVE.search(raw):
1079
+ return ""
1080
+ first_para = re.split(r"\n\s*\n|\n\s*(?:[-*•]|\d+[.)、])\s+", raw, maxsplit=1)[0]
1081
+ plain = re.sub(r"```[\s\S]*?```", " ", first_para)
1082
+ plain = re.sub(r"!?\[([^\]]*)\]\([^)]*\)", r"\1", plain)
1083
+ plain = re.sub(r"[`*_>#|~-]+", " ", plain)
1084
+ plain = re.sub(r"\s+", " ", plain).strip()
1085
+ plain = re.sub(r"^(?:@\S+\s+)+", "", plain).strip()
1086
+ if not plain:
1087
+ return ""
1088
+ sentences = [match.group(0).strip() for match in SHARE_CARD_SENTENCE.finditer(plain) if match.group(0).strip()]
1089
+ if not sentences:
1090
+ return plain[:max_chars]
1091
+ first = sentences[0]
1092
+ if len(first) < 10 and len(sentences) > 1:
1093
+ joiner = " " if re.search(r"[a-zA-Z0-9.!?]$", first) else ""
1094
+ two = f"{first}{joiner}{sentences[1]}"
1095
+ if len(two) <= max_chars:
1096
+ return two
1097
+ return first[:max_chars]
1098
+
1099
+
1100
+ def _extract_share_copy(text):
1101
+ """Return the companion ```share-copy``` block from a room message, or empty string."""
1102
+ match = SHARE_CARD_COPY_FENCE.search(str(text or ""))
1103
+ return match.group(1).strip() if match else ""
1104
+
1105
+
1106
+ def _auto_share_card_defaults(connection, room_id):
1107
+ """Compute fresh, clean automatic share-card text from the room's non-withdrawn public messages."""
1108
+ room = connection.execute("SELECT title FROM rooms WHERE id=?", (room_id,)).fetchone()
1109
+ title = room["title"] if room else ""
1110
+ member_rows = connection.execute(
1111
+ "SELECT name FROM room_members WHERE room_id=? AND status!='removed' ORDER BY id",
1112
+ (room_id,),
1113
+ ).fetchall()
1114
+ members = [row["name"] for row in member_rows]
1115
+ msg_rows = connection.execute(
1116
+ """SELECT m.id, m.author, COALESCE(md.kind, 'chat') AS kind, m.text, COALESCE(ms.text, '') AS summary
1117
+ FROM messages m
1118
+ LEFT JOIN message_details md ON md.message_id=m.id
1119
+ LEFT JOIN message_summaries ms ON ms.message_id=m.id
1120
+ WHERE m.room_id=? AND COALESCE(md.kind, 'chat')!='system' AND COALESCE(m.text,'')!=''
1121
+ AND NOT EXISTS (SELECT 1 FROM message_withdrawals w WHERE w.message_id=m.id)
1122
+ ORDER BY m.id ASC""",
1123
+ (room_id,),
1124
+ ).fetchall()
1125
+ question_msg = None
1126
+ for msg in msg_rows:
1127
+ if msg["author"] != "用户":
1128
+ continue
1129
+ body = (msg["text"] or "").strip()
1130
+ if not body or _is_share_question_receipt(body) or SHARE_CARD_SLASH.match(body) or SHARE_CARD_SHORT_ACK.match(body):
1131
+ continue
1132
+ question_msg = msg
1133
+ break
1134
+ after_id = question_msg["id"] if question_msg else 0
1135
+ answers = [msg for msg in msg_rows if msg["author"] not in ("用户", "系统") and msg["id"] > after_id]
1136
+ outcome_msg = next((msg for msg in reversed(answers) if (msg["summary"] or "").strip()), None) or (answers[-1] if answers else None)
1137
+ runs_row = connection.execute("SELECT COUNT(*) FROM member_executions WHERE room_id=?", (room_id,)).fetchone()
1138
+ runs = int(runs_row[0]) if runs_row else 0
1139
+ return {
1140
+ "title": title,
1141
+ "members": members,
1142
+ "question": _share_card_lead(question_msg["text"], 160) if question_msg else "",
1143
+ "outcome": _share_card_lead(outcome_msg["summary"] or outcome_msg["text"], 200) if outcome_msg else "",
1144
+ "stats": f"{len(members)} 位 AI · {len(msg_rows)} 条消息 · {runs} 次执行",
1145
+ "card_version": 2,
1146
+ }
1147
+
1148
+
1021
1149
  def read_share_card(connection, room_id):
1022
- """Read the live link's cover and the room images the owner can choose."""
1150
+ """Read the live link's cover, upgraded automatic defaults, active product sites and room images."""
1151
+ now_iso = utc_iso_now()
1023
1152
  row = connection.execute("""SELECT share_id,url,expires_at,card_json,card_edits FROM room_share_links
1024
- WHERE room_id=? AND expires_at>?""", (room_id, utc_iso_now())).fetchone()
1153
+ WHERE room_id=? AND expires_at>?""", (room_id, now_iso)).fetchone()
1025
1154
  if not row:
1026
1155
  raise LookupError(Text("分享链接已失效"))
1027
- images = connection.execute("""SELECT a.id,a.file_name,a.message_id,a.room_id FROM attachments a
1156
+ saved_card = json.loads(row["card_json"]) if row["card_json"] else {}
1157
+ saved_edits = json.loads(row["card_edits"]) if row["card_edits"] else {}
1158
+ auto = _auto_share_card_defaults(connection, room_id)
1159
+ base_card = dict(saved_card)
1160
+ old_version = int(saved_card.get("card_version") or 0) < 2
1161
+ saved_question = str(saved_card.get("question") or "").strip()
1162
+ if auto["question"] and (old_version or not saved_question or _is_share_question_receipt(saved_question)):
1163
+ base_card["question"] = auto["question"]
1164
+ if auto["outcome"] and (old_version or not str(saved_card.get("outcome") or "").strip()):
1165
+ base_card["outcome"] = auto["outcome"]
1166
+ if auto["question"] or auto["outcome"]:
1167
+ if not base_card.get("title") and auto["title"]:
1168
+ base_card["title"] = auto["title"]
1169
+ if not base_card.get("members") and auto["members"]:
1170
+ base_card["members"] = auto["members"]
1171
+ if not base_card.get("stats") and auto["stats"]:
1172
+ base_card["stats"] = auto["stats"]
1173
+ images_rows = connection.execute("""SELECT a.id,a.file_name,a.message_id,a.room_id,m.text AS message_text
1174
+ FROM attachments a
1175
+ LEFT JOIN messages m ON m.id=a.message_id
1028
1176
  WHERE a.room_id=? AND a.message_id IS NOT NULL AND a.content_type IN ('image/png','image/jpeg','image/webp')
1029
1177
  AND NOT EXISTS (SELECT 1 FROM message_withdrawals w WHERE w.message_id=a.message_id)
1030
1178
  ORDER BY a.message_id DESC,a.position""", (room_id,))
1179
+ images = []
1180
+ for image in images_rows:
1181
+ item = {"id": image["id"], "file_name": image["file_name"],
1182
+ "message_id": image["message_id"], "room_id": image["room_id"]}
1183
+ copy_text = _extract_share_copy(image["message_text"])
1184
+ if copy_text:
1185
+ item["share_copy"] = copy_text
1186
+ images.append(item)
1187
+ site_rows = connection.execute(
1188
+ "SELECT * FROM room_sites WHERE room_id=? ORDER BY updated_at DESC", (room_id,)
1189
+ )
1190
+ sites = [
1191
+ {"site_id": s["site_id"], "title": s["title"], "url": s["url"], "expires_at": s["expires_at"]}
1192
+ for s in (_site_public_row(r, now_iso) for r in site_rows)
1193
+ if s["status"] == "active"
1194
+ ]
1031
1195
  return {"share_id": row["share_id"], "url": row["url"], "expires_at": row["expires_at"],
1032
- "card": {**json.loads(row["card_json"]), **json.loads(row["card_edits"])},
1033
- "images": [dict(image) for image in images]}
1196
+ "card": {**base_card, **saved_edits},
1197
+ "defaults": {"question": auto["question"], "outcome": auto["outcome"]},
1198
+ "sites": sites,
1199
+ "images": images}
1034
1200
 
1035
1201
 
1036
1202
  def edit_share_card(connection, room_id, payload):
@@ -1038,10 +1204,13 @@ def edit_share_card(connection, room_id, payload):
1038
1204
  if "publication" in payload:
1039
1205
  return finish_share_card_upload(connection, room_id, payload)
1040
1206
  edits = payload.get("edits")
1041
- if not isinstance(edits, dict) or not edits or edits.keys() - {"question", "outcome", "cover"}:
1207
+ if not isinstance(edits, dict) or not edits or edits.keys() - {"question", "outcome", "cover", "copy"}:
1042
1208
  raise ValueError(Text("分享卡格式不正确"))
1043
1209
  for key, value in edits.items():
1044
- if not isinstance(value, str) or (key != "cover" and len(value) > 2000):
1210
+ if value is None and key in ("question", "outcome", "copy"):
1211
+ continue
1212
+ limit = 4000 if key == "copy" else 2000
1213
+ if not isinstance(value, str) or (key != "cover" and len(value) > limit):
1045
1214
  raise ValueError(Text("分享卡格式不正确"))
1046
1215
  if key == "cover" and value and not re.fullmatch(r"data:image/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+=*",
1047
1216
  value):
@@ -1586,8 +1755,30 @@ def report_destruction(connection, room_id, token, payload):
1586
1755
  return destruction_view(connection, room_id)
1587
1756
 
1588
1757
 
1758
+ RECLAIM_VACUUM_MIN_BYTES = 1024 * 1024
1759
+
1760
+
1761
+ def reclaim_database_space(connection, min_vacuum_bytes=RECLAIM_VACUUM_MIN_BYTES):
1762
+ """Return freed SQLite pages to the OS: incrementally when enabled, or via a one-time VACUUM upgrade."""
1763
+ free_pages = connection.execute("PRAGMA freelist_count").fetchone()[0]
1764
+ if not free_pages:
1765
+ return False
1766
+ if connection.execute("PRAGMA auto_vacuum").fetchone()[0] == 2:
1767
+ # incremental_vacuum steps one page per row; exhausting the cursor reclaims every free page.
1768
+ connection.execute("PRAGMA incremental_vacuum").fetchall()
1769
+ return True
1770
+ page_size = connection.execute("PRAGMA page_size").fetchone()[0]
1771
+ if free_pages * page_size < min_vacuum_bytes:
1772
+ return False
1773
+ # Existing databases default to auto_vacuum=0; switching to INCREMENTAL takes effect on one VACUUM,
1774
+ # after which future room destructions reclaim pages incrementally without rewriting the whole file.
1775
+ connection.execute("PRAGMA auto_vacuum = INCREMENTAL")
1776
+ connection.execute("VACUUM")
1777
+ return True
1778
+
1779
+
1589
1780
  def finish_destruction_files(database, room_id):
1590
- """After the records commit: remove the attachment files, check they are gone, and truncate the write-ahead log.
1781
+ """After the records commit: remove the attachment files, reclaim freed database pages, and truncate the WAL.
1591
1782
 
1592
1783
  A file still held or a log still in use leaves its item failed; the page shows it and the service retries it.
1593
1784
  """
@@ -1606,6 +1797,10 @@ def finish_destruction_files(database, room_id):
1606
1797
  logging.exception("Attachment cleanup failed: %s", file_id)
1607
1798
  if path.exists():
1608
1799
  left.append(file_id)
1800
+ try:
1801
+ reclaim_database_space(connection)
1802
+ except sqlite3.OperationalError:
1803
+ logging.warning("Database space reclamation skipped: %s", room_id, exc_info=True)
1609
1804
  # Deleted pages are already zeroed (secure_delete); truncating the log drops its copies of the old rows.
1610
1805
  busy = connection.execute("PRAGMA wal_checkpoint(TRUNCATE)").fetchone()[0]
1611
1806
  with connection:
@@ -2310,6 +2505,8 @@ def append_free_message(connection, room, payload, actor):
2310
2505
  room_id = room["id"]
2311
2506
  if actor == "用户" and (author != "用户" or payload.get("submitted_by", "用户") != "用户"):
2312
2507
  raise PermissionError(Text('房间控制凭据只能以用户身份发言'))
2508
+ if payload.get("relay") is not None and not isinstance(payload["relay"], dict):
2509
+ raise ValueError(Text("relay 须为含 room_id 与 host 的对象"))
2313
2510
  if payload.get("relay") is not None and actor != "用户":
2314
2511
  # Another room's host speaks here through `host-control room-post`, only with the owner credential.
2315
2512
  raise PermissionError(Text('只有房间控制凭据能代其他房间的主持人发言'))
@@ -2324,7 +2521,8 @@ def append_free_message(connection, room, payload, actor):
2324
2521
  previous = connection.execute(f"{MESSAGE_QUERY} WHERE room_id=? AND submission_id=?", (room_id, submission_id)).fetchone()
2325
2522
  if previous:
2326
2523
  previous = message_with_attachments(connection, previous)
2327
- if (any(previous[key] != renumbered_expected(expected, payload, previous)[key] for key in ("author", "text", "reply_to", "kind", "submitted_by", "summary", "summary_by"))
2524
+ if ((previous.get("relay_room") or None) != (payload.get("relay") or {}).get("room_id")
2525
+ or any(previous[key] != renumbered_expected(expected, payload, previous)[key] for key in ("author", "text", "reply_to", "kind", "submitted_by", "summary", "summary_by"))
2328
2526
  or [item["id"] for item in previous["attachments"]] != identifiers):
2329
2527
  raise FileExistsError(Text('这个提交编号已被另一条内容使用,请为新发言生成新编号'))
2330
2528
  check_review_retry(connection, room_id, previous["id"], payload)
@@ -2336,7 +2534,7 @@ def append_free_message(connection, room, payload, actor):
2336
2534
  check_message_references(connection, room_id, expected)
2337
2535
  check_message_attachments(connection, room_id, submitted_by, identifiers)
2338
2536
  # `/goal` and `/discuss` are commands: checked before saving, never queued, and not routed to members.
2339
- mode_command = check_mode_command(connection, room_id, payload) if actor == "用户" else None
2537
+ mode_command = check_mode_command(connection, room_id, payload) if actor == "用户" and not payload.get("relay") else None
2340
2538
  waiting = queue_split(connection, room_id, payload) if actor == "用户" and not mode_command else None
2341
2539
  if waiting == "all":
2342
2540
  return {**enqueue(connection, room_id, payload), "queue": queue_view(connection, room_id)}
@@ -2483,7 +2681,29 @@ def append_message(connection, room_id, payload, actor):
2483
2681
  """Atomically append an attributed message for the owner or one member, as authorized by `actor`."""
2484
2682
  message_values(payload)
2485
2683
  begin_write(connection)
2486
- return append_free_message(connection, require_room(connection, room_id), payload, actor)
2684
+ room = require_room(connection, room_id)
2685
+ if not payload.get("relay"):
2686
+ return append_free_message(connection, room, payload, actor)
2687
+ if payload.get("interrupt") is not True:
2688
+ return append_free_message(connection, room, {**payload, "queue": True}, actor)
2689
+ relay = payload["relay"]
2690
+ if actor != "用户" or not isinstance(relay, dict) or not connection.execute(
2691
+ "SELECT 1 FROM room_links WHERE room_id=? AND other_room_id=? AND relation='parent'",
2692
+ (room_id, relay.get("room_id"))).fetchone():
2693
+ raise PermissionError(Text("仅父房间主持人可以打断子房间"))
2694
+ if connection.execute("SELECT 1 FROM queued_messages WHERE room_id=? AND submission_id=?",
2695
+ (room_id, payload["submission_id"])).fetchone():
2696
+ return {**enqueue(connection, room_id, payload), "interrupted": False}
2697
+ connection.execute("SAVEPOINT relay_send")
2698
+ result = append_free_message(connection, room, {**payload, "queue": False}, actor)
2699
+ try:
2700
+ interrupted = not result.get("duplicate") and interrupt_for_message(connection, room_id, result["message"]["id"])
2701
+ except FileExistsError as error:
2702
+ connection.execute("ROLLBACK TO relay_send")
2703
+ result = {**enqueue(connection, room_id, payload), "reason": str(error)}
2704
+ interrupted = False
2705
+ connection.execute("RELEASE relay_send")
2706
+ return {**result, "interrupted": interrupted}
2487
2707
 
2488
2708
 
2489
2709
  def post_queued(connection, room_id, payload, actor):
@@ -3395,6 +3615,9 @@ class DiscussionHandler(BaseHTTPRequestHandler):
3395
3615
  except (ValueError, TypeError) as error:
3396
3616
  return self.respond(self.plain_error(error) if text_mode else error_body(error), 400,
3397
3617
  "text/plain" if text_mode else "application/json")
3618
+ except (IndexError, KeyError):
3619
+ logging.exception("Request failed")
3620
+ return self.respond(error_body(Text("服务器内部错误")), 500)
3398
3621
  except LookupError as error:
3399
3622
  return self.respond(self.plain_error(error) if text_mode else error_body(error), 404,
3400
3623
  "text/plain" if text_mode else "application/json")
@@ -3512,6 +3735,11 @@ class DiscussionHandler(BaseHTTPRequestHandler):
3512
3735
  return self.respond({"ok": True})
3513
3736
  if route == ["settings"] and method in ("GET", "POST"):
3514
3737
  command = "settings"
3738
+ elif (route == ["storage"] and method in ("GET", "POST")) or (route == ["storage-clean"] and method == "POST"):
3739
+ with closing(connect_db(self.server.database)) as connection:
3740
+ if self.bridge_origin or self.entry_member_request() or not self.admin_session(connection):
3741
+ raise PermissionError(Text('需要管理员登录'))
3742
+ command = route[0]
3515
3743
  elif route == ["launch"] and method == "POST":
3516
3744
  command = "start"
3517
3745
  elif route == ["room-config"] and method == "POST" and not self.bridge_origin:
@@ -3730,7 +3958,7 @@ class DiscussionHandler(BaseHTTPRequestHandler):
3730
3958
 
3731
3959
  The runner holds one bridge token per paired website and this site keeps only its hash. A bridged request acts
3732
3960
  as the administrator, so it is accepted only from this computer's loopback, on a loopback-only site, and only
3733
- for room, folder and revision routes.
3961
+ for room, folder, revision and published-site routes.
3734
3962
  """
3735
3963
  credential = self.headers.get("X-CoDiscuss-Bridge")
3736
3964
  if credential is None:
@@ -3741,7 +3969,7 @@ class DiscussionHandler(BaseHTTPRequestHandler):
3741
3969
  if (not self.server.local_site or self.client_address[0] != "127.0.0.1" or not isinstance(expected, str)
3742
3970
  or not re.fullmatch(r"[a-f0-9]{64}", credential) or not hmac.compare_digest(token_hash(credential), expected)):
3743
3971
  raise PermissionError(Text('本机中转凭据无效,请在电脑上重新连接网站'))
3744
- if parts[:1] != ["api"] or parts[1:2] not in (["rooms"], ["folders"], ["revisions"]):
3972
+ if parts[:1] != ["api"] or parts[1:2] not in (["rooms"], ["folders"], ["revisions"], ["sites"]):
3745
3973
  raise PermissionError(Text('本机中转不允许访问该地址'))
3746
3974
  return True
3747
3975
 
@@ -4065,7 +4293,7 @@ class DiscussionHandler(BaseHTTPRequestHandler):
4065
4293
  result = queue_action(connection, room_id, token, self.read_payload(), post_queued, check_queued, interrupt_for_message)
4066
4294
  connection.commit()
4067
4295
  return self.respond(result)
4068
- if parts[3:4] in (["inbox"], ["executions"], ["members"], ["chats"], ["suggestions"], ["recommendations"], ["stop"], ["dispatches"], ["host-checkin"], ["room-link"]):
4296
+ if parts[3:4] in (["inbox"], ["executions"], ["members"], ["chats"], ["suggestions"], ["recommendations"], ["stop"], ["dispatches"], ["host-checkin"], ["room-link"], ["room-relay-sent"]):
4069
4297
  return self.handle_free_api(connection, parts, method)
4070
4298
  if parts[3:4] == ["attachments"]:
4071
4299
  return self.handle_attachments(connection, parts, params, method)
@@ -4424,6 +4652,8 @@ class DiscussionHandler(BaseHTTPRequestHandler):
4424
4652
  result = withdraw_dispatch(connection, room_id, token, int(parts[4]))
4425
4653
  elif parts[3:] == ["host-checkin"] and method == "POST":
4426
4654
  result = set_host_checkin(connection, room_id, token, self.read_payload())
4655
+ elif parts[3:] == ["room-relay-sent"] and method == "POST":
4656
+ result = record_relay_send(connection, room_id, token, self.read_payload())
4427
4657
  elif parts[3:] == ["room-link"] and method == "POST":
4428
4658
  result = record_room_link(connection, room_id, token, self.read_payload())
4429
4659
  else:
@@ -11,12 +11,21 @@ Use the local management panel or the corresponding codiscuss admin commands to
11
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
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.
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
+ - **Storage:**
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.
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
+ 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.
14
19
  - **Account:**
15
20
  - **Local account** is listed by default. When hosting is enabled, the page also lists **Hosted accounts** and a **New account** button.
16
21
  - Select the administrator or a hosted account to manage its **CLI sign-ins** (Claude Code, Codex, and Gemini status, sign-in method, or sign-out; Setup Token is recommended for Claude Code), **API keys**, **Skills** (select from **Skill library** or import a ZIP/folder), **bundled workflows**, and **system prompt**. Updating the program leaves installed workflows unchanged; the workflows section works like the update check on the overview page. A tag next to the title shows **Up to date** or how many workflows can be synced; the button in the top-right corner is **Check shipped workflows** while everything matches, and turns blue as **Sync to latest** once something differs. After you confirm, it installs the missing ones and replaces those that differ (each replaced copy is first backed up to `backups/workflows` in that account's service folder, and changes made there are replaced too).
17
22
 
18
23
  ## Hosted accounts for other people
19
24
 
25
+ When creating an account, fill in **Project data directory (optional)** or run `codiscuss admin account add alice --project-data-root "D:\CoDiscussData\alice"`. The parent must exist. CoDiscuss creates the account directory with `projects`, `workspace` for rooms without a project, and `drafts` for member drafts. Configuration, credentials, room databases and attachments stay in the account's service directory. Leave the field empty for the default layout.
26
+
27
+ Storage accounting includes service data and member drafts. Projects and workspaces are outside the draft quota. When the directories use different volumes, each must meet its own free-space reserve. The management panel cleans the configured draft location. With the updated cleanup skill, pass the exact `drafts_root` from the affected account’s `codiscuss service status` to `--drafts-root` for both scripts. With an older service that reports only `home`, pass `--home "<home>"`. Older scripts that only accept `--home` take the parent of the reported `drafts_root`. Cross-volume project storage and **Restrict other drives** are mutually exclusive. The isolated Windows account needs access to the project volume.
28
+
20
29
  On Windows, open the panel from the tray. On macOS and Linux, use the command-line panel controls below. Most personal setups do not need hosting. Enable it when family or coworkers need to sign in from a browser outside your network and use the AI on this computer.
21
30
 
22
31
  ### Set it up
@@ -30,6 +39,14 @@ On Windows, open the panel from the tray. On macOS and Linux, use the command-li
30
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>.
31
40
  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.
32
41
 
42
+ ### Move an existing account’s project data to another drive
43
+
44
+ Finish the account’s running tasks and close external programs writing its files. In the account detail view enter a new absolute path under an existing administrator-controlled directory and choose **Stop instance and move data**. From the CLI run `codiscuss admin account migrate-data <account> --project-data-root <new-directory>`. The target volume needs space for a complete copy and the isolated account needs access to it.
45
+
46
+ The move covers projects, room workspaces and member drafts. It stops the instance, verifies each file with SHA-256 and creates junctions so existing rooms can use their original paths. Start the instance manually afterward. After a rolled-back copy failure, choose a fresh destination. If the panel was interrupted, retry with the same destination. Links and special files stop the copy. Cross-drive storage and the option to restrict other drives are mutually exclusive. Choose an allowed volume when drive restrictions are active.
47
+
48
+ Backups still use space on the original volume, outside the directories counted toward the runtime quota. In the account details choose **View migration backups** to see each registered path and its current file byte count and allocated disk space. Choose **Release migration backup** and confirm to stop the instance and remove the selected backup after verification. You can add, edit or delete files in the active project or drafts after migration. Release requires the original destination directory, the old junction pointing to it, and a backup matching the migration receipt. A failed check keeps the backup in place. Confirm the same item again after an interruption. Older directories without verification records require manual review. In the CLI, run `codiscuss admin account migration-backups <account>`, then `codiscuss admin account release-backup <account> <migration-id> <kind> --confirm`.
49
+
33
50
  ### macOS and Linux
34
51
 
35
52
  macOS and Linux have a management-panel service and code paths for non-isolated accounts. Start the background panel with codiscuss panel start, then create one with codiscuss admin account add <name> --no-isolate. The instance runs as the service’s operating-system user, so accounts do not have OS-level isolation. The complete workflow from account creation to external sign-in has not yet been tested on those systems. Separate Windows users, entry protection, the tray icon, and startup at Windows sign-in are Windows features.
@@ -42,6 +59,7 @@ Every command in the table is prefixed by codiscuss admin and returns JSON. Thes
42
59
  | --- | --- |
43
60
  | Start, exit, restart, or update (panel need not be running) | `codiscuss admin start`, `stop`, `restart`, `update [check]` |
44
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` |
45
63
  | Link/unlink online site and create access code | `site status`, `site connect <access-code\|site>`, `site disconnect`, `entry code` |
46
64
  | Manage sign-in entry and tunnel | `entry start\|stop`, `entry join <access-code>`, `entry open\|close relay\|tunnel`, `entry tunnel <domain>` |
47
65
  | Manage hosted account lifecycle | `account list`, `account add <name>`, `account start\|stop\|disable\|enable\|remove\|password <name>`, `account isolate\|protect <name>` |
@@ -9,12 +9,18 @@ On the Room tab you can update several members in succession. Access, model and
9
9
  ### Steps
10
10
 
11
11
  1. **Add a local app.** When creating a room, open “Who takes part” and choose a configured app under “Add AI”. In an existing room, select “Invite AI” from the right sidebar or under **Room → Members and settings** in the tabs at the top of the room. Choose one or more members and select “Invite”. You can add several members from the same app. Each has its own session.
12
- 2. **Add a role preset.** Choose a preset in the “Presets” row below “Add AI”. It adds a member with a preset description, private prompt, project access, and model. Built-in presets include `Codex-review`, `Gemini-docs`, and `OpenAI-image`. On the back of a member card, select the bookmark to “Save as preset”. Select “Manage” at the end of the presets row to delete presets.
12
+ 2. **Add a role preset.** Choose a preset from “Presets” below “Add AI”. When creating a room with a project or inviting members into a room with project folders, use “Project presets” to choose a preset from the main project or an extra folder. A preset supplies the description, private prompt, project access, and model. Select “Manage” to remove unused presets from a writable location.
13
13
  3. **Add a model API.** Under “Add AI”, choose Claude, Gemini, DeepSeek, Qwen, Grok, OpenAI, or “Custom”. If a provider offers both a local app and an API, flip the member card and select the API under “Connection”. Official presets fill in the service address. Local API members on unrestricted tasks can read an overview, messages, events and attachments from another room on the same site by room ID.
14
14
  An API member can spend up to 45 minutes on a room task. It also stops after 15 minutes without model or tool progress. The execution card shows the reason.
15
15
  To troubleshoot, open “Runs” in the room sidebar, choose “Waterfall”, and open “Run diagnostics” for the run. The room service records the last heartbeat, while the member’s software reports the last model or tool activity. Model request retries, adapter restarts, and runner redelivery have separate records. An interjection confirmation time requires a matching receipt from the software. Older runs and software without the relevant data show “Unknown”.
16
16
  4. **Configure and check the API.** Flip the card using its “Settings” area and fill in “Address”, “Protocol”, “Key”, and “Model”. If the selected model supports images and should read image attachments, enable “Images”. Select the lightning button to check the configuration. “Check passed: the model responded” means it is ready. Select “Done” to return to the front of the card.
17
17
 
18
+ ### Save and reuse project presets
19
+
20
+ On the back of a member card, select the bookmark to “Save as preset”. In “Save as expert preset”, under “Save to”, choose “Global” to reuse it across projects or “Current project” to keep it with a project. If several folders are writable, choose one under “Target project”. On a card added from a preset, select “Update preset” to save changes. To edit the skills of a preset that has them, open “Advanced settings” on the card.
21
+
22
+ A preset from an untrusted project that requests write access is added as read-only by default. Review the requested access before allowing it on the card. You can use presets from read-only project folders and save changes to a writable location.
23
+
18
24
  ## Resume an existing session
19
25
 
20
26
  Use “History” to bring context from an existing local AI conversation into a room. This is supported by Claude Code, Codex, and Gemini (the Antigravity CLI, `agy`).
@@ -47,7 +47,7 @@ While your computer is on and its local service is running, paired phones and ta
47
47
 
48
48
  - View rooms and live updates, send messages, upload attachments, use voice input and read-aloud, and export backups.
49
49
  - Create rooms; invite or recall members; change models and permissions; add API keys; and create external-member invitations.
50
- - **Project folders remain scoped by the computer:** Remote devices can choose folders inside **Saved projects** on the computer. Use the folder button at the end of the project path field to browse. To allow a wider scope, add the parent folder to Saved projects on the computer.
50
+ - **Project folders remain scoped by the computer:** Remote devices can choose folders inside **Saved projects** on the computer. Use the folder button at the end of the project path field to browse. To allow a wider scope, add the parent folder to Saved projects on the computer. In “Manage projects…”, drag a project by its left handle and select “Save” to update the order in the picker.
51
51
 
52
52
  ## Things to keep in mind
53
53