ai_co_discuss 0.5.5 → 0.5.6

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 (39) hide show
  1. package/.agents/skills/discuss-host/references/room.md +1 -1
  2. package/README.md +1 -1
  3. package/README.zh-CN.md +1 -1
  4. package/backend/free_room.py +28 -1
  5. package/backend/message_queue.py +7 -16
  6. package/backend/schema.sql +24 -0
  7. package/backend/server.py +328 -16
  8. package/docs/en/guide/rooms.md +5 -2
  9. package/docs/en/guide/working.md +8 -6
  10. package/docs/guide/rooms.md +5 -2
  11. package/docs/guide/working.md +8 -6
  12. package/frontend/locales/en/app.json +17 -3
  13. package/frontend/locales/en/backend.json +6 -1
  14. package/frontend/locales/en/core.json +49 -11
  15. package/frontend/locales/en/discussion.json +2 -0
  16. package/frontend/locales/en/room.json +8 -3
  17. package/frontend/locales/en/settings.json +5 -0
  18. package/package.json +1 -1
  19. package/runner/adapters/antigravity_app.mjs +4 -2
  20. package/runner/adapters/antigravity_cli.mjs +21 -2
  21. package/runner/adapters/api_pi.mjs +8 -2
  22. package/runner/adapters/claude.mjs +19 -2
  23. package/runner/adapters/codex_app.mjs +2 -2
  24. package/runner/adapters/codex_cli.mjs +21 -2
  25. package/runner/adapters/common.mjs +19 -1
  26. package/runner/adapters/index.mjs +47 -1
  27. package/runner/discussion_launch.mjs +58 -3
  28. package/runner/discussion_service.mjs +125 -1
  29. package/runner/entry_client.mjs +7 -3
  30. package/runner/os_users.mjs +7 -0
  31. package/runner/relay_channel.mjs +52 -8
  32. package/runner/remote_launch.mjs +1 -1
  33. package/runner/room_destruction.mjs +69 -0
  34. package/web/admin.js +1 -1
  35. package/web/app.js +485 -51
  36. package/web/backup.js +13 -4
  37. package/web/i18n.js +3 -3
  38. package/web/modern.css +1 -1
  39. package/web/modern.js +49 -49
@@ -18,7 +18,7 @@
18
18
  - `route`:用户未点名的消息,或全体调度交回的原问题,由你回答或分派;全体调度未代办时仍须读原文再安排。
19
19
  - `handoff`:你派出的成员都已结束(含失败)。交给其他成员或汇总给用户;成员的回答已完整时只用一两句说明完成,不复述。
20
20
  - `notice`:程序发现了要你处理的事(成员失败、某一棒失败、重试结果、你要求的续跑、定时检查、你自己失败),消息写明是什么,按 [房间控制与恢复](control.md) 处理。你已有待处理请求时,程序只把通知写进记录、不另建请求:处理任何请求时,新消息里作者为“系统”的通知同样要处理。
21
- - `all`:用户请全体成员各自回应一次,其他成员已同时收到;只回答自己的部分,不加 `--to`。
21
+ - `all`:用户请全体成员各自回应一次,其他成员已同时收到;先独立回答自己的部分,不加 `--to`。用户用 `@全体成员` 点名时,所有人答完后程序会再发一条 `notice` 请你汇总:读各成员回答,写共识、分歧与你的取舍,需要时再派活;回应很简单(如打招呼、报模型)时一两句收尾即可。
22
22
  - `goal_start`、`goal_continue`:按技能 [discuss-goal](../../discuss-goal/SKILL.md) 处理。
23
23
  - `discuss_start`:用户发了 `/discuss`。消息带文本时以原文为准,只整理措辞;没带时从最近对话提炼,提炼不出明确的讨论问题就不开启,直接回答并说明缺什么。开启:`run start ROOM --request 请求编号 --goal-file 草稿`,上限用房间默认值,你不设置;然后照常简短回答,之后程序会给你讨论主持任务。
24
24
  - 用户只点名你(旁问,如问近况、是否卡住):读进行中执行的详情(有接力时加 `sequence view`、`room events`)后直接回答,进行中的工作照常。旁问里的新任务涉及正在工作的成员或同一批文件时,等交回后再派,或先撤回原派活;互不相干的可以马上派。
package/README.md CHANGED
@@ -35,7 +35,7 @@ The [User Guide](docs/en/guide/README.md) covers each of these in full.
35
35
  - **Workflows** — save a fixed division of work among several agents and start it in a room with one click. See [Workflows](docs/en/guide/workflows.md).
36
36
  - **Smart Scheduling** — optionally let a decision model handle routine routing instead of waking the host; it uses your own key, and the room title and recent messages are sent to the provider. See [Smart Scheduling](docs/en/guide/scheduling.md).
37
37
  - **Mix any participant** — local CLIs and desktop apps, model APIs and manually connected sessions in one room; resume existing agent sessions and give each member read-only or writable access. See [Members](docs/en/guide/members.md).
38
- - **Shared projects and records** — point a room at project folders and browse them; attachments, export and import between sites, and branching. See [Rooms](docs/en/guide/rooms.md).
38
+ - **Shared projects and records** — point a room at project folders and browse them; attachments, export and import between sites, and branching; destroy a room, with its members’ AI sessions, at any time or after a set idle period. See [Rooms](docs/en/guide/rooms.md).
39
39
  - **Borrow an AI from another computer** — bring an agent on someone else's computer into your room, reading only the folders you open, revocable at any time. See [External members](docs/en/guide/external-members.md).
40
40
  - **Phone and away from your desk** — once your computer is bound to your own free Cloudflare site, pair a phone or tablet by scanning a code. See [Phone and remote use](docs/en/guide/remote.md).
41
41
  - **Voice and hosting** — read-aloud and voice input, which can run locally; the admin panel can create hosted accounts for others. See [Voice and notifications](docs/en/guide/voice.md) and [Admin panel and hosted accounts](docs/en/guide/admin.md).
package/README.zh-CN.md CHANGED
@@ -35,7 +35,7 @@
35
35
  - **工作流**:把固定的多人分工存成工作流,在房间里一键启用。见[工作流](docs/guide/workflows.md)。
36
36
  - **智能调度**:可选由决策模型处理日常分派,不必每次唤醒主持人;使用你自己的密钥,房间标题与最近消息会发给所选供应商。见[智能调度](docs/guide/scheduling.md)。
37
37
  - **混合接入**:本地 CLI 与桌面 App、模型 API、手动接入的会话同房协作;可续接已有的 AI 会话,为每位成员设置只读或可写。见[成员](docs/guide/members.md)。
38
- - **共享项目与记录**:为房间指定项目目录并在“文件”页浏览;附件、跨站点导出导入与分支。见[房间目录与建房](docs/guide/rooms.md)。
38
+ - **共享项目与记录**:为房间指定项目目录并在“文件”页浏览;附件、跨站点导出导入与分支;房间可随时或按设定期限销毁,连同成员的 AI 会话记录一起删除。见[房间目录与建房](docs/guide/rooms.md)。
39
39
  - **借用另一台电脑上的 AI**:把别人电脑上的 AI 请进你的房间,只读你开放的目录,随时撤销。见[跨电脑协作](docs/guide/external-members.md)。
40
40
  - **手机与外出**:电脑绑定自托管的免费 Cloudflare 站点后,手机或平板扫码配对即可远程使用。见[手机与外出](docs/guide/remote.md)。
41
41
  - **语音与托管**:朗读与语音输入,可在本机运行;管理面板可给别人开托管账号。见[语音与通知](docs/guide/voice.md)、[管理面板与托管账号](docs/guide/admin.md)。
@@ -152,7 +152,7 @@ TERMINAL = ("completed", "cancelled", "failed")
152
152
  # A queued member has been asked once its request for that message exists.
153
153
  QUEUE_ASKED = "EXISTS(SELECT 1 FROM member_requests r WHERE r.message_id={row}.message_id AND r.member_id={row}.member_id)"
154
154
  SESSION_MODES = ("new", "borrowed")
155
- FREE_OPERATIONS = ("messages", "attachments", "move", "folder", "rename", "archive", "restore", "delete")
155
+ FREE_OPERATIONS = ("messages", "attachments", "move", "folder", "rename", "archive", "restore", "delete", "auto-destroy")
156
156
  MEMBER_FIELDS = ("id", "name", "adapter", "role", "status", "access", "session_mode", "read_until")
157
157
  EXECUTION_FIELDS = ("id", "member_id", "status", "session_id", "lease_until", "created_at", "finished_at", "result",
158
158
  "activity", "activity_at", "paused_at", "model", "effort")
@@ -1975,11 +1975,35 @@ def settle_batches(connection, room_id):
1975
1975
  retried = connection.execute("SELECT MAX(id) FROM member_requests WHERE room_id=? AND batch_id=?", (room_id, batch["batch_id"])).fetchone()[0]
1976
1976
  wake_host(connection, room_id, batch["chain_id"], handoff_notice(connection, room_id, batch["batch_id"], True),
1977
1977
  f"retried:{batch['batch_id']}:{retried}")
1978
+ summarize_groups(connection, room_id)
1978
1979
  advance_queues(connection, room_id)
1979
1980
  resume_host(connection, room_id)
1980
1981
  wake_for_mentions(connection, room_id)
1981
1982
 
1982
1983
 
1984
+ def summarize_groups(connection, room_id):
1985
+ """Hand each @everyone message whose answers all ended to the host once, to sum them up and arrange what comes next.
1986
+
1987
+ Nothing is handed over when no one completed (all stopped or failed: failures already reach the host one by one) or
1988
+ when the chain was halted; a room without a present host just drops the row.
1989
+ """
1990
+ for row in connection.execute("SELECT * FROM group_summaries WHERE room_id=?", (room_id,)).fetchall():
1991
+ answers = connection.execute("""SELECT m.name,r.status FROM member_requests r JOIN room_members m ON m.id=r.member_id
1992
+ WHERE r.message_id=? AND r.purpose='all' ORDER BY r.id""", (row["message_id"],)).fetchall()
1993
+ if any(answer["status"] not in TERMINAL for answer in answers):
1994
+ continue
1995
+ connection.execute("DELETE FROM group_summaries WHERE message_id=?", (row["message_id"],))
1996
+ if not any(answer["status"] == "completed" for answer in answers) or connection.execute(
1997
+ "SELECT 1 FROM free_chains WHERE room_id=? AND chain_id=?", (room_id, row["chain_id"])).fetchone():
1998
+ continue
1999
+ names = member_display_names(connection, room_id)
2000
+ unfinished = "、".join(names.get(answer["name"], answer["name"]) for answer in answers if answer["status"] != "completed")
2001
+ facts = {"message_id": row["message_id"], "unfinished": unfinished}
2002
+ text = Text("#{message_id} 全体成员已回答完毕,其中未完成:{unfinished}。请主持人读各成员的回答,汇总共识与分歧,需要时安排后续工作。", **facts) \
2003
+ if unfinished else Text("#{message_id} 全体成员已回答完毕。请主持人读各成员的回答,汇总共识与分歧,需要时安排后续工作。", **facts)
2004
+ wake_host(connection, room_id, row["chain_id"], text, f"group:{row['message_id']}")
2005
+
2006
+
1983
2007
  def reopen_review_handoff(connection, room_id, batch_id, host_id):
1984
2008
  """Hand a batch with a review still to dispatch back to its host once more; returns whether it did.
1985
2009
 
@@ -3123,6 +3147,9 @@ def route_group(connection, room_id, group, payload):
3123
3147
  connection.execute(f"""INSERT OR IGNORE INTO member_requests (room_id,member_id,message_id,chain_id,purpose,created_by,created_at)
3124
3148
  SELECT room_id,id,?,?,'all','user',? FROM room_members WHERE room_id=? AND status='active' AND {REGISTERED_MEMBER} ORDER BY id""",
3125
3149
  (group["message_id"], group["chain_id"], int(time.time()), room_id))
3150
+ # The host answers its own share like everyone, then sums up once all answers end (2026-11-21 user decision).
3151
+ connection.execute("INSERT OR IGNORE INTO group_summaries (message_id,room_id,chain_id) VALUES (?,?,?)",
3152
+ (group["message_id"], room_id, group["chain_id"]))
3126
3153
  connection.execute("INSERT INTO group_routes (message_id,room_id,request_id,action) VALUES (?,?,?,?)",
3127
3154
  (group["message_id"], room_id, group["id"], action))
3128
3155
  return {"action": action, "request_id": group["id"], "message_id": group["message_id"]}
@@ -19,16 +19,12 @@ from .texts import Text, load_texts, save_text
19
19
 
20
20
  QUEUED_FIELDS = ("author", "text", "reply_to", "kind", "submitted_by", "to", "sequential", "order", "attachment_ids", "attachment_start",
21
21
  "submission_id", "message_id", "relay")
22
- QUEUE_ACTIONS = ("send", "edit", "delete", "reorder", "resume", "queueing")
22
+ # Queueing is always on (user 2026-11-21, #7060): the old site switch only left messages waiting on a busy member with
23
+ # nothing left to edit, and once off it could not be found again; `composer_settings.queueing` is no longer read.
24
+ QUEUE_ACTIONS = ("send", "edit", "delete", "reorder", "resume")
23
25
  QUEUE_ERRORS = (ValueError, TypeError, LookupError, PermissionError, FileExistsError)
24
26
 
25
27
 
26
- def queueing_enabled(connection):
27
- """Whether the site queues owner messages sent while members work; on unless the owner turned it off."""
28
- row = connection.execute("SELECT queueing FROM composer_settings WHERE id=1").fetchone()
29
- return row is None or bool(row[0])
30
-
31
-
32
28
  def room_busy(connection, room_id):
33
29
  """A member still has an open request, a one-after-another turn waits, or a discussion runs.
34
30
 
@@ -43,7 +39,7 @@ def room_busy(connection, room_id):
43
39
 
44
40
 
45
41
  def queue_view(connection, room_id):
46
- """The room's queued owner messages in order, whether the queue is paused, and the site's queueing switch.
42
+ """The room's queued owner messages in order and whether the queue is paused.
47
43
 
48
44
  The share of a message already posted carries `message_id` and `waiting_for` (the members it still waits for); its
49
45
  files went out with that message, so it lists none."""
@@ -64,7 +60,7 @@ def queue_view(connection, room_id):
64
60
  busy_members = [row["name"] for row in connection.execute("SELECT id,name FROM room_members WHERE room_id=? AND status='active'", (room_id,))
65
61
  if member_busy(connection, row["id"])]
66
62
  return {"items": items, "paused": paused and bool(items), "busy": room_busy(connection, room_id),
67
- "host_busy": host_busy(connection, room_id), "busy_members": busy_members, "queueing": queueing_enabled(connection)}
63
+ "host_busy": host_busy(connection, room_id), "busy_members": busy_members}
68
64
 
69
65
 
70
66
  def named_members(connection, room_id, payload):
@@ -308,7 +304,7 @@ def reorder(connection, room_id, ids):
308
304
 
309
305
 
310
306
  def queue_action(connection, room_id, token, payload, post, check, interrupt):
311
- """The owner acts on the queue: send one now, edit, delete, reorder, resume, or switch queueing for the site.
307
+ """The owner acts on the queue: send one now, edit, delete, reorder or resume it.
312
308
 
313
309
  `post(connection, room_id, payload, actor)` posts a message; `check(payload)` validates an edited one;
314
310
  `interrupt(connection, room_id, message_id)` stops the busy members a message sent now was given to, so it does not
@@ -334,12 +330,7 @@ def queue_action(connection, room_id, token, payload, post, check, interrupt):
334
330
  connection.execute("DELETE FROM queued_messages WHERE id=?", (queued_row(connection, room_id, payload.get("id"))["id"],))
335
331
  elif action == "reorder":
336
332
  reorder(connection, room_id, payload.get("ids"))
337
- elif action == "resume":
338
- connection.execute("DELETE FROM queued_message_pauses WHERE room_id=?", (room_id,))
339
333
  else:
340
- if not isinstance(payload.get("enabled"), bool):
341
- raise ValueError(Text('enabled 须为 true 或 false'))
342
- connection.execute("INSERT INTO composer_settings (id,queueing) VALUES (1,?) ON CONFLICT(id) DO UPDATE SET queueing=excluded.queueing",
343
- (int(payload["enabled"]),))
334
+ connection.execute("DELETE FROM queued_message_pauses WHERE room_id=?", (room_id,))
344
335
  drain(connection, room_id, post)
345
336
  return queue_view(connection, room_id)
@@ -473,6 +473,13 @@ CREATE TABLE IF NOT EXISTS group_routes (
473
473
  request_id INTEGER NOT NULL,
474
474
  action TEXT NOT NULL CHECK(action IN ('all','sequential','host'))
475
475
  );
476
+ -- An @everyone message answered at once in a room with a host: once every answer ends, the host is handed it once to
477
+ -- sum up and arrange what comes next. The row goes when that hand-over is decided.
478
+ CREATE TABLE IF NOT EXISTS group_summaries (
479
+ message_id INTEGER PRIMARY KEY REFERENCES messages(id) ON DELETE CASCADE,
480
+ room_id TEXT NOT NULL REFERENCES rooms(id) ON DELETE CASCADE,
481
+ chain_id INTEGER NOT NULL
482
+ );
476
483
  -- Visible record of each smart-scheduling decision in a discussion; it is not a message and moves no round or floor.
477
484
  CREATE TABLE IF NOT EXISTS scheduler_decisions (
478
485
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -1672,6 +1679,23 @@ CREATE TABLE IF NOT EXISTS stored_texts (
1672
1679
  PRIMARY KEY (owner, owner_id, field)
1673
1680
  );
1674
1681
  CREATE INDEX IF NOT EXISTS room_events_room ON room_events(room_id,id);
1682
+ -- A destroyed room's cleanup and its receipt; the room's own rows are already gone. While `cleaning`, the title and the
1683
+ -- owner credential's hash stay so the page can show the entry and the room's runner can report what it removed on its
1684
+ -- computer; once `done`, they and the session IDs are cleared and only the per-category counts remain.
1685
+ CREATE TABLE IF NOT EXISTS room_destructions (
1686
+ room_id TEXT PRIMARY KEY,
1687
+ title TEXT NOT NULL DEFAULT '',
1688
+ control_hash TEXT NOT NULL DEFAULT '',
1689
+ status TEXT NOT NULL CHECK(status IN ('cleaning','done')),
1690
+ expect_runner INTEGER NOT NULL DEFAULT 0,
1691
+ -- 1 when the room destroyed itself under its auto-destroy setting, not by its owner's hand.
1692
+ automatic INTEGER NOT NULL DEFAULT 0,
1693
+ items TEXT NOT NULL DEFAULT '[]',
1694
+ -- Every session ID the room's runner members ran in, by member: rewinds leave earlier sessions behind on that computer.
1695
+ sessions TEXT NOT NULL DEFAULT '{}',
1696
+ created_at TEXT NOT NULL,
1697
+ finished_at TEXT NOT NULL DEFAULT ''
1698
+ );
1675
1699
  DROP TRIGGER IF EXISTS event_message_posted;
1676
1700
  CREATE TRIGGER event_message_posted AFTER INSERT ON messages
1677
1701
  BEGIN