ai_co_discuss 0.5.21 → 0.5.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/discuss-host/references/control.md +2 -2
- package/backend/free_room.py +20 -4
- package/backend/message_queue.py +9 -0
- package/backend/schema.sql +2 -1
- package/backend/server.py +44 -6
- package/docs/en/guide/remote.md +1 -1
- package/docs/en/guide/rooms.md +7 -2
- package/docs/guide/remote.md +1 -1
- package/docs/guide/rooms.md +6 -2
- package/frontend/locales/en/app.json +1 -0
- package/frontend/locales/en/backend.json +4 -0
- package/frontend/locales/en/room.json +7 -0
- package/package.json +1 -1
- package/runner/discussion_launch.mjs +54 -18
- package/runner/free_runner.mjs +28 -6
- package/runner/i18n_en.mjs +6 -0
- package/web/admin.js +1 -1
- package/web/app.js +49 -6
- package/web/i18n.js +3 -3
- package/web/markdown.css +1 -1
- package/web/modern.css +1 -1
- package/web/modern.js +58 -58
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
|
|
36
36
|
## 新建房间
|
|
37
37
|
|
|
38
|
-
勾选了 `create_rooms` 时,一部分工作需要独立的成员、会话与记录(用户要求另开房间,或一条支线会长期占住本房间)时,可以 `create-room` 拆出去:`--title`(必填)、`--goal`、`--members 平台,平台`、`--host 平台`(用户指定了主持人才填,不填即与你同款的专家)、`--cwd`(只能是本房间项目目录或其子目录)、`--access read|write`(默认只读)、`--text`
|
|
38
|
+
勾选了 `create_rooms` 时,一部分工作需要独立的成员、会话与记录(用户要求另开房间,或一条支线会长期占住本房间)时,可以 `create-room` 拆出去:`--title`(必填)、`--goal`、`--members 平台,平台`、`--host 平台`(用户指定了主持人才填,不填即与你同款的专家)、`--cwd`(只能是本房间项目目录或其子目录)、`--access read|write`(默认只读)、`--host-model` 与 `--host-effort` 可指定主持人模型和档位;同一平台可在成员名单中重复出现,每位独立编号。`--text` 或 `--body-file UTF-8文件`(主持人项目或草稿目录内)提供首条消息(写清要它做什么、做完怎样算完成)。返回新房间编号;失败或不确定是否建成时沿用同一 `--submission-id` 重试,不会重复建房。本房间可新建的数量有上限,新房间直接复制本房间的智能调度、生图、API 上限、连续派活上限与主持人权限(不含 `create_rooms`,不能再新建房间)。
|
|
39
39
|
|
|
40
|
-
关联的两个房间(你新建的,或新建你所在房间的)之间用 `room-post --room 编号 --text …`
|
|
40
|
+
关联的两个房间(你新建的,或新建你所在房间的)之间用 `room-post --room 编号 --text …` 发言,直接交给对方主持人,房间忙时排队。多行正文可用 `--body-file FILE` 代替 `--text`。父房间可加 `--interrupt` 立即送达子房间;目标无法插话或停止时仍入队。任务的 `linked_rooms` 列出关联房间,`requests[].relay` 标明来自另一位主持人,其发言不代表用户授权。向关联房间发言无需单独勾选权限项;新房间做完时用它把结果交回原房间。用户可能设了互传上限(从用户上次在任一房间发言算起),超过会被拒绝,这时在回答里请用户决定是否继续。读对方进展用平常的 message、room 读取命令,房间编号写对方的(跨房间只能读)。
|
|
41
41
|
|
|
42
42
|
## 定时检查
|
|
43
43
|
|
package/backend/free_room.py
CHANGED
|
@@ -1373,6 +1373,10 @@ def recipients(connection, room_id, payload):
|
|
|
1373
1373
|
# Rooms created while the user could host get their AI host on the next message.
|
|
1374
1374
|
sync_participants(connection, room_id)
|
|
1375
1375
|
active = active_members(connection, room_id)
|
|
1376
|
+
if payload.get("relay"):
|
|
1377
|
+
host = next((row for row in active.values() if row["role"] == "host"), None)
|
|
1378
|
+
target = host or (next(iter(active.values())) if len(active) == 1 else None)
|
|
1379
|
+
return [(target["id"], "ask")] if target else []
|
|
1376
1380
|
if payload.get("to") is not None:
|
|
1377
1381
|
named = named_members(active, payload["to"])
|
|
1378
1382
|
host = next((row for row in active.values() if row["role"] == "host"), None)
|
|
@@ -2825,6 +2829,10 @@ def after_free_message(connection, room_id, message_id, actor, payload):
|
|
|
2825
2829
|
# host was waiting on: the goal is back to being worked on and a later pending gets its fallback again.
|
|
2826
2830
|
# A message the host takes also replaces whatever it meant to continue with. One naming other members only
|
|
2827
2831
|
# starts their own lines: it answers nothing the host asked, so the host's plan and goal state stay (user 2026-11-20).
|
|
2832
|
+
if payload.get("relay"):
|
|
2833
|
+
for member_id, purpose in recipients(connection, room_id, payload):
|
|
2834
|
+
insert_request(connection, room_id, member_id, message_id, message_id, purpose, "user")
|
|
2835
|
+
return
|
|
2828
2836
|
if reaches_host(connection, room_id, payload):
|
|
2829
2837
|
connection.execute("""UPDATE room_goals SET armed=1,phase='doing',phase_note='',phase_until=0,pending_fallback=0
|
|
2830
2838
|
WHERE room_id=? AND status='active'""", (room_id,))
|
|
@@ -3163,6 +3171,7 @@ def inbox(connection, room_id, token):
|
|
|
3163
3171
|
def pending_requests(connection, member_id):
|
|
3164
3172
|
"""A member's pending requests with the context its software needs: discussion turn, review, relay, hand-back, question."""
|
|
3165
3173
|
pending = [dict(item) for item in connection.execute("""SELECT r.id,r.message_id,r.purpose,r.batch_id,
|
|
3174
|
+
(SELECT source_room_id FROM message_relays WHERE message_id=r.message_id) AS relay_room,
|
|
3166
3175
|
sr.id AS session_request_id,sr.session_id,sr.round,sr.position,sr.read_until,sr.question AS source_question,
|
|
3167
3176
|
t.cause_kind,t.cause_message_id AS source_message_id,t.cause_request_id,
|
|
3168
3177
|
(SELECT action FROM group_routes WHERE message_id=r.message_id) AS group_action
|
|
@@ -4096,15 +4105,20 @@ def interrupt_for_message(connection, room_id, message_id):
|
|
|
4096
4105
|
if blocked:
|
|
4097
4106
|
raise FileExistsError(Text("{value1} 正在执行且无法打断,这条消息继续排队,等它答完后发送", value1='、'.join(blocked)))
|
|
4098
4107
|
now = int(time.time())
|
|
4108
|
+
source = connection.execute("""SELECT r.title FROM message_relays m JOIN rooms r ON r.id=m.source_room_id
|
|
4109
|
+
WHERE m.message_id=?""", (message_id,)).fetchone()
|
|
4110
|
+
notice = (Text("关联房间「{room}」的主持人刚发来消息 #{message_id},请先读原文。", room=source[0], message_id=message_id)
|
|
4111
|
+
if source else Text("用户刚发来消息 #{message_id},请先读原文,在这一轮的回答里一并处理。", message_id=message_id))
|
|
4099
4112
|
for row in steerable:
|
|
4100
4113
|
execution = connection.execute("SELECT * FROM member_executions WHERE id=?", (row["execution_id"],)).fetchone()
|
|
4101
|
-
add_interjection(connection, room_id, execution, {"text": str(
|
|
4114
|
+
add_interjection(connection, room_id, execution, {"text": str(notice),
|
|
4102
4115
|
"submission_id": f"queue-{message_id}-{row['member_id']}"}, now)
|
|
4103
4116
|
connection.execute("UPDATE member_requests SET status='delivering',execution_id=? WHERE id=?", (row["execution_id"], row["request_id"]))
|
|
4104
4117
|
for row in stopped:
|
|
4105
|
-
stop_member_work(connection, row["member_id"], Text("已打断:你立即发送了新消息,它会连同这条一起处理"), "user_stop", keep_pending=True, requeue=True)
|
|
4118
|
+
stop_member_work(connection, row["member_id"], notice if source else Text("已打断:你立即发送了新消息,它会连同这条一起处理"), "user_stop", keep_pending=True, requeue=True)
|
|
4106
4119
|
if stopped:
|
|
4107
4120
|
settle_batches(connection, room_id)
|
|
4121
|
+
return bool(busy)
|
|
4108
4122
|
|
|
4109
4123
|
|
|
4110
4124
|
def withdrawals(connection, room_id):
|
|
@@ -4118,7 +4132,7 @@ def owner_message(connection, room_id, message_id):
|
|
|
4118
4132
|
row = connection.execute("SELECT * FROM messages WHERE room_id=? AND id=?", (room_id, message_id)).fetchone()
|
|
4119
4133
|
if not row:
|
|
4120
4134
|
raise LookupError(Text("消息不存在"))
|
|
4121
|
-
if row["author"] != "用户":
|
|
4135
|
+
if row["author"] != "用户" or connection.execute("SELECT 1 FROM message_relays WHERE message_id=?", (message_id,)).fetchone():
|
|
4122
4136
|
raise ValueError(Text("只能撤回或编辑用户自己的消息"))
|
|
4123
4137
|
if connection.execute("SELECT 1 FROM room_directory WHERE room_id=? AND archived=1", (room_id,)).fetchone():
|
|
4124
4138
|
raise ValueError(Text("房间已存档;恢复后才能撤回或编辑"))
|
|
@@ -4367,6 +4381,8 @@ def check_relay(connection, room_id, relay):
|
|
|
4367
4381
|
if not isinstance(relay, dict):
|
|
4368
4382
|
raise ValueError(Text("relay 须为含 room_id 与 host 的对象"))
|
|
4369
4383
|
host = linked_room_values(connection, room_id, relay.get("room_id"), relay.get("host"))
|
|
4384
|
+
if not isinstance(relay.get("member", ""), str):
|
|
4385
|
+
raise ValueError(Text("relay.member 须为成员名称"))
|
|
4370
4386
|
source, limit = relay["room_id"], relay.get("limit", 0)
|
|
4371
4387
|
if type(limit) is not int or not 0 <= limit <= MAX_RELAY_LIMIT:
|
|
4372
4388
|
raise ValueError(Text("relay.limit 须为 0–100 的整数,0 表示不限"))
|
|
@@ -4386,7 +4402,7 @@ def check_relay(connection, room_id, relay):
|
|
|
4386
4402
|
def save_message_relay(connection, room_id, message_id, relay):
|
|
4387
4403
|
"""Label an owner-credential message the host of another room sent: `relay = {room_id, host}`."""
|
|
4388
4404
|
host = check_relay(connection, room_id, relay)
|
|
4389
|
-
connection.execute("INSERT INTO message_relays (message_id,source_room_id,host) VALUES (
|
|
4405
|
+
connection.execute("INSERT INTO message_relays (message_id,source_room_id,host,member) VALUES (?,?,?,?)", (message_id, relay["room_id"], host, relay.get("member", "")))
|
|
4390
4406
|
|
|
4391
4407
|
|
|
4392
4408
|
def record_model_change(connection, room_id, member, payload):
|
package/backend/message_queue.py
CHANGED
|
@@ -51,6 +51,13 @@ def queue_view(connection, room_id):
|
|
|
51
51
|
(room_id, json.dumps(payload.get("attachment_ids", []))))]
|
|
52
52
|
item = {"id": row["id"], "text": payload.get("text", ""), "attachments": files, "failure": row["failure"],
|
|
53
53
|
"texts": load_texts(connection, "queued_message", row["id"]), "created_at": row["created_at"]}
|
|
54
|
+
if relay := payload.get("relay"):
|
|
55
|
+
source = relay["room_id"]
|
|
56
|
+
details = connection.execute("""SELECT (SELECT title FROM rooms WHERE id=?) AS relay_title,
|
|
57
|
+
(SELECT relation FROM room_links WHERE room_id=? AND other_room_id=?) AS relay_relation,
|
|
58
|
+
COALESCE(NULLIF(?,''),(SELECT name FROM room_members WHERE room_id=? AND role='host' AND status='active')) AS relay_member""",
|
|
59
|
+
(source, room_id, source, relay.get("member", ""), source)).fetchone()
|
|
60
|
+
item.update(relay_room=source, relay_host=relay["host"], **dict(details))
|
|
54
61
|
if named_members(connection, room_id, payload) is not None:
|
|
55
62
|
item["to"] = payload["to"]
|
|
56
63
|
if payload.get("message_id"):
|
|
@@ -309,6 +316,8 @@ def queued_row(connection, room_id, item_id):
|
|
|
309
316
|
def edit_item(connection, row, text, check):
|
|
310
317
|
"""Replace a queued message's text; `check` validates the edited payload as a message would be."""
|
|
311
318
|
payload = json.loads(row["payload"])
|
|
319
|
+
if payload.get("relay"):
|
|
320
|
+
raise PermissionError(Text("只能编辑用户自己的消息"))
|
|
312
321
|
if payload.get("message_id"):
|
|
313
322
|
raise FileExistsError(Text('这条消息已发出,只是还在等忙碌的成员;可以删除后重新发送'))
|
|
314
323
|
payload["text"] = str(text if text is not None else "").strip()
|
package/backend/schema.sql
CHANGED
|
@@ -123,7 +123,8 @@ CREATE TABLE IF NOT EXISTS room_links (
|
|
|
123
123
|
CREATE TABLE IF NOT EXISTS message_relays (
|
|
124
124
|
message_id INTEGER PRIMARY KEY REFERENCES messages(id) ON DELETE CASCADE,
|
|
125
125
|
source_room_id TEXT NOT NULL,
|
|
126
|
-
host TEXT NOT NULL
|
|
126
|
+
host TEXT NOT NULL,
|
|
127
|
+
member TEXT NOT NULL DEFAULT ''
|
|
127
128
|
);
|
|
128
129
|
-- Site administrator account (single user) and its login sessions. Raw tokens and passwords are never stored.
|
|
129
130
|
CREATE TABLE IF NOT EXISTS site_admin (
|
package/backend/server.py
CHANGED
|
@@ -238,6 +238,8 @@ CASE WHEN messages.author='用户' THEN (
|
|
|
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
240
|
relay.source_room_id AS relay_room, relay.host AS relay_host,
|
|
241
|
+
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,
|
|
242
|
+
(SELECT relation FROM room_links WHERE room_id=messages.room_id AND other_room_id=relay.source_room_id) AS relay_relation,
|
|
241
243
|
(SELECT l.other_room_id FROM room_links l WHERE l.message_id=messages.id) AS link_room,
|
|
242
244
|
(SELECT l.relation FROM room_links l WHERE l.message_id=messages.id) AS link_relation,
|
|
243
245
|
(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,
|
|
@@ -520,6 +522,8 @@ def init_database(database, seed=True):
|
|
|
520
522
|
if name not in columns:
|
|
521
523
|
connection.execute(f"ALTER TABLE room_goals ADD COLUMN {name} {kind}")
|
|
522
524
|
connection.executescript(SCHEMA)
|
|
525
|
+
if 'member' not in {row[1] for row in connection.execute('PRAGMA table_info(message_relays)')}:
|
|
526
|
+
connection.execute("ALTER TABLE message_relays ADD COLUMN member TEXT NOT NULL DEFAULT ''")
|
|
523
527
|
share_columns = {row[1] for row in connection.execute("PRAGMA table_info(room_share_links)")}
|
|
524
528
|
for name in ("card_json", "card_edits"):
|
|
525
529
|
if name not in share_columns:
|
|
@@ -536,6 +540,11 @@ def init_database(database, seed=True):
|
|
|
536
540
|
for name in ("width", "height"):
|
|
537
541
|
if name not in attachment_columns:
|
|
538
542
|
connection.execute(f"ALTER TABLE attachments ADD COLUMN {name} INTEGER")
|
|
543
|
+
if connection.execute("INSERT OR IGNORE INTO site_preferences (key,value) VALUES ('child_folders_migrated','1')").rowcount:
|
|
544
|
+
connection.execute("""UPDATE room_folder_assignments AS child SET folder_id=parent.folder_id
|
|
545
|
+
FROM room_links l JOIN room_folder_assignments parent ON parent.room_id=l.other_room_id
|
|
546
|
+
WHERE l.relation='parent' AND child.room_id=l.room_id
|
|
547
|
+
AND child.folder_id IS NULL AND parent.folder_id IS NOT NULL""")
|
|
539
548
|
migrate_free_tables(connection)
|
|
540
549
|
if seed and is_new:
|
|
541
550
|
seed_demo(connection)
|
|
@@ -547,16 +556,20 @@ def room_display_texts(connection, room):
|
|
|
547
556
|
if field in room and str(Text(payload["template"], **payload["params"])) == room[field]}
|
|
548
557
|
|
|
549
558
|
|
|
559
|
+
PARENT_ROOM = """SELECT p.id FROM room_links l JOIN rooms p ON p.id=l.other_room_id
|
|
560
|
+
WHERE l.relation='parent' AND l.room_id=rooms.id ORDER BY l.message_id LIMIT 1"""
|
|
561
|
+
|
|
562
|
+
|
|
550
563
|
def require_room(connection, room_id):
|
|
551
564
|
"""Return a room and its current message count, or raise a lookup error."""
|
|
552
|
-
row = connection.execute("""SELECT rooms.*,
|
|
565
|
+
row = connection.execute(f"""SELECT rooms.*, ({PARENT_ROOM}) AS parent_room_id,
|
|
553
566
|
COALESCE(stats.message_count,0) AS message_count,COALESCE(stats.latest_id,0) AS latest_id
|
|
554
567
|
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
568
|
if row is None:
|
|
556
569
|
raise LookupError(Text('房间不存在'))
|
|
557
570
|
if enforce_session_limits(connection, room_id):
|
|
558
571
|
connection.commit()
|
|
559
|
-
row = connection.execute("""SELECT rooms.*,
|
|
572
|
+
row = connection.execute(f"""SELECT rooms.*, ({PARENT_ROOM}) AS parent_room_id,
|
|
560
573
|
COALESCE(stats.message_count,0) AS message_count,COALESCE(stats.latest_id,0) AS latest_id
|
|
561
574
|
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
575
|
room = dict(row)
|
|
@@ -946,7 +959,7 @@ def list_rooms(connection, params=None):
|
|
|
946
959
|
params = params or {}
|
|
947
960
|
identifier = submission_value(params["submission_id"]) if "submission_id" in params else None
|
|
948
961
|
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.*,
|
|
962
|
+
rows = connection.execute(f"""SELECT rooms.*, ({PARENT_ROOM}) AS parent_room_id,
|
|
950
963
|
COALESCE(stats.message_count,0) AS message_count,COALESCE(stats.latest_id,0) AS latest_id,
|
|
951
964
|
(SELECT created_at FROM messages WHERE id=stats.latest_id) AS latest_at,
|
|
952
965
|
(SELECT m.created_at FROM messages m WHERE m.room_id=rooms.id AND m.source<>'system'
|
|
@@ -2310,6 +2323,8 @@ def append_free_message(connection, room, payload, actor):
|
|
|
2310
2323
|
room_id = room["id"]
|
|
2311
2324
|
if actor == "用户" and (author != "用户" or payload.get("submitted_by", "用户") != "用户"):
|
|
2312
2325
|
raise PermissionError(Text('房间控制凭据只能以用户身份发言'))
|
|
2326
|
+
if payload.get("relay") is not None and not isinstance(payload["relay"], dict):
|
|
2327
|
+
raise ValueError(Text("relay 须为含 room_id 与 host 的对象"))
|
|
2313
2328
|
if payload.get("relay") is not None and actor != "用户":
|
|
2314
2329
|
# Another room's host speaks here through `host-control room-post`, only with the owner credential.
|
|
2315
2330
|
raise PermissionError(Text('只有房间控制凭据能代其他房间的主持人发言'))
|
|
@@ -2324,7 +2339,8 @@ def append_free_message(connection, room, payload, actor):
|
|
|
2324
2339
|
previous = connection.execute(f"{MESSAGE_QUERY} WHERE room_id=? AND submission_id=?", (room_id, submission_id)).fetchone()
|
|
2325
2340
|
if previous:
|
|
2326
2341
|
previous = message_with_attachments(connection, previous)
|
|
2327
|
-
if (
|
|
2342
|
+
if ((previous.get("relay_room") or None) != (payload.get("relay") or {}).get("room_id")
|
|
2343
|
+
or any(previous[key] != renumbered_expected(expected, payload, previous)[key] for key in ("author", "text", "reply_to", "kind", "submitted_by", "summary", "summary_by"))
|
|
2328
2344
|
or [item["id"] for item in previous["attachments"]] != identifiers):
|
|
2329
2345
|
raise FileExistsError(Text('这个提交编号已被另一条内容使用,请为新发言生成新编号'))
|
|
2330
2346
|
check_review_retry(connection, room_id, previous["id"], payload)
|
|
@@ -2336,7 +2352,7 @@ def append_free_message(connection, room, payload, actor):
|
|
|
2336
2352
|
check_message_references(connection, room_id, expected)
|
|
2337
2353
|
check_message_attachments(connection, room_id, submitted_by, identifiers)
|
|
2338
2354
|
# `/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
|
|
2355
|
+
mode_command = check_mode_command(connection, room_id, payload) if actor == "用户" and not payload.get("relay") else None
|
|
2340
2356
|
waiting = queue_split(connection, room_id, payload) if actor == "用户" and not mode_command else None
|
|
2341
2357
|
if waiting == "all":
|
|
2342
2358
|
return {**enqueue(connection, room_id, payload), "queue": queue_view(connection, room_id)}
|
|
@@ -2483,7 +2499,29 @@ def append_message(connection, room_id, payload, actor):
|
|
|
2483
2499
|
"""Atomically append an attributed message for the owner or one member, as authorized by `actor`."""
|
|
2484
2500
|
message_values(payload)
|
|
2485
2501
|
begin_write(connection)
|
|
2486
|
-
|
|
2502
|
+
room = require_room(connection, room_id)
|
|
2503
|
+
if not payload.get("relay"):
|
|
2504
|
+
return append_free_message(connection, room, payload, actor)
|
|
2505
|
+
if payload.get("interrupt") is not True:
|
|
2506
|
+
return append_free_message(connection, room, {**payload, "queue": True}, actor)
|
|
2507
|
+
relay = payload["relay"]
|
|
2508
|
+
if actor != "用户" or not isinstance(relay, dict) or not connection.execute(
|
|
2509
|
+
"SELECT 1 FROM room_links WHERE room_id=? AND other_room_id=? AND relation='parent'",
|
|
2510
|
+
(room_id, relay.get("room_id"))).fetchone():
|
|
2511
|
+
raise PermissionError(Text("仅父房间主持人可以打断子房间"))
|
|
2512
|
+
if connection.execute("SELECT 1 FROM queued_messages WHERE room_id=? AND submission_id=?",
|
|
2513
|
+
(room_id, payload["submission_id"])).fetchone():
|
|
2514
|
+
return {**enqueue(connection, room_id, payload), "interrupted": False}
|
|
2515
|
+
connection.execute("SAVEPOINT relay_send")
|
|
2516
|
+
result = append_free_message(connection, room, {**payload, "queue": False}, actor)
|
|
2517
|
+
try:
|
|
2518
|
+
interrupted = not result.get("duplicate") and interrupt_for_message(connection, room_id, result["message"]["id"])
|
|
2519
|
+
except FileExistsError as error:
|
|
2520
|
+
connection.execute("ROLLBACK TO relay_send")
|
|
2521
|
+
result = {**enqueue(connection, room_id, payload), "reason": str(error)}
|
|
2522
|
+
interrupted = False
|
|
2523
|
+
connection.execute("RELEASE relay_send")
|
|
2524
|
+
return {**result, "interrupted": interrupted}
|
|
2487
2525
|
|
|
2488
2526
|
|
|
2489
2527
|
def post_queued(connection, room_id, payload, actor):
|
package/docs/en/guide/remote.md
CHANGED
|
@@ -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
|
|
package/docs/en/guide/rooms.md
CHANGED
|
@@ -26,9 +26,14 @@ You can also send a message from the blank home page to create a room and send i
|
|
|
26
26
|
|
|
27
27
|
### 2. Organize the sidebar, folders, and archives
|
|
28
28
|
|
|
29
|
+
Rooms created by a host inherit its folder. Select the arrow beside the parent title to show or hide its children. Opening a child, starting work in it, or adding a child expands the parent. Manually collapsing it keeps it folded for this page session. Moving a child to another folder, archiving its parent, or deleting its parent lists the child independently.
|
|
30
|
+
|
|
29
31
|
- **Sort rooms.** Open the directory options in the top-right corner. Choose “Manual order” (drag items or use the arrow keys) or “Recent activity”.
|
|
30
32
|
- **Folders.** Select “New folder” to group rooms by project. A folder can have a default project directory, which is used for new rooms created inside it. Its menu offers “Edit”, “Move up”, “Move down”, “Archive folder”, and “Remove folder”. You can remove just the folder or delete its rooms as well.
|
|
31
|
-
- **Room actions.** Open a room’s menu to “Rename”, “Edit topic”, “Move to folder”, “Copy reading link”, “Refresh messages”, “Archive room”, or “Destroy room”. “Edit topic” and “Refresh messages” apply to the currently open room.
|
|
33
|
+
- **Room actions.** Open a room’s menu to “Rename”, “Edit topic”, “Move to folder”, “Copy reading link”, “Refresh messages”, “Archive room”, or “Destroy room”. “Edit topic” and “Refresh messages” apply to the currently open room. On desktop, double-click a room name in the sidebar to open “Rename”.
|
|
34
|
+
- Video attachments use the current theme’s background while loading. The preview appears as soon as the first frame is ready.
|
|
35
|
+
- When you return to a recent room, the speaking order shows the last known model and reasoning effort immediately. These update when the roster or executions change.
|
|
36
|
+
- In an existing room’s collaboration settings, the smart scheduling row keeps its height when toggled. After enabling it, select “Settings” to configure the decision model.
|
|
32
37
|
- **Destroy a room.** Select “Destroy room” in the room’s menu. The dialog lists what is deleted and what is kept. You can first select “Export package” to download a copy with messages, private chats, attachments, a “讨论记录.html” page that opens with a double click, and the files members wrote in their draft folders (in “草稿”; beyond 50 MB only their names are listed). After “Destroy now” and then “Destroy” in “Confirm destroying again” (every way of destroying asks twice), the room’s records, attachments, the AI sessions its members started in this room, and its run files and drafts are deleted from this computer: the room dissolves into particles at once (its sidebar row, and the middle pane when it is open) while deletion and checks go on in the background; a notice shows what was removed when they finish. The draft folder made when the room was created (under “Drafts” in “Project”) is deleted with its files too; the package keeps them in “草稿空间”. A project folder you chose is not deleted. Sessions taken over from your own windows or shared with other rooms are kept. Content already sent to model providers stays under their policies and cannot be deleted from here. A published share page is taken down first. If an item cannot be removed yet, a notice says so and you can follow and retry it in “Destruction records”. Files in members’ draft folders are deleted with the room; export the package first if you need them.
|
|
33
38
|
- **Destruction records and destroying all rooms.** Open “…” at the top right of the room list and select “Destruction records” to see what each destruction deleted and kept (the room name is cleared once it finishes). Select “Retry” on an unfinished one. “Destroy all rooms” at the bottom asks you to type a confirmation word, then destroys every room, archived ones included, one by one; project files are kept. A hosted account running as its own Windows user then also deletes every conversation in its AI software and the preferences the AI remembered, keeping logins. “Export all rooms” leaves drafts out; export rooms one at a time to include them.
|
|
34
39
|
- **Auto-destroy.** Choose it under “How to work (optional)” when creating a room, or later in the “Room” tab at the top of the room, set “Auto-destroy” to destroy the room after 1, 7, or 30 days without activity; the time left is shown beside it. The count starts when you set it and restarts with each new message or private chat. Archived rooms, rooms with members at work or queued work, an open question for you, or a published share page are not destroyed automatically. The page warns once when less than a day is left, and again after a room is destroyed. The default is “Keep”.
|
|
@@ -66,7 +71,7 @@ You can also send a message from the blank home page to create a room and send i
|
|
|
66
71
|
Attachments are left out by default, and attachment tags in messages read “not included in the share”. When the room has attachments, the confirmation offers “Include attachments”: ticked, every attachment (images, videos, web pages, documents and so on) goes into the page as it is, for readers to view and download; project files a member’s answer delivered (the file cards under the answer) come along too, as attachments of that answer. Text attachments are checked for keys and local folders too; the contents of images, videos and other files cannot be checked, so look through them yourself. A share link carries the attachments the page can preview — images, audio, video, PDF, Word/Excel/PowerPoint (docx, xlsx, pptx), text and code, zip archives, and web pages — for readers to open right in the page; scripts that run on a double click, such as js, bat and ps1, go with .txt added to their names. Programs and old doc/xls/ppt files stay off the share site and their messages read “not included in the share”, while a downloaded web page file still carries them. Web page attachments run on the share page as they do in the room, and demos a member’s answer refers to show inside the message; they run in an isolated frame that cannot read the share page, send requests or submit forms. Select “Filter files” to choose attachments by type or individually. The filters expand automatically above 300 MB. Files appear newest message first. Each file shows the message number, sender, time and size. Click its name or “Preview” and close the preview to continue selecting. Published links allow 5 MB of text plus up to 300 MB of attachments, with a 100 MB limit per file. The computer’s background service prepares and uploads the share even if you lock your phone, close the page or switch to another paired device. Under “Shared”, open “Share jobs” to review a draft, check uploaded files and bytes, cancel, retry or adjust attachments. After publication, use the live link below the jobs to open its card or copy the link. Cancel, retry and dismiss update the job immediately. If the operation fails, the job is restored and an error is shown. Opening a draft or share card shows the room title while its contents load. When the service is offline, keep the browser page open until the transfer finishes. A downloaded web page file carries at most 100 MB of attachments. If the room changes before download, review the updated contents in the confirmation dialog.
|
|
67
72
|
- **Import rooms.** In directory options or a folder menu, select “Import rooms” and choose a ZIP. Review the preview and confirm the rooms to import. A room marked “Already exists; skipped” is left as is. On the same computer, invite members back to resume their sessions. Claude Code members switch to manual connection on import. Re-register them from their original window to avoid splitting the session. Imported discussion history is kept, but discussions are not restarted and members are not woken automatically.
|
|
68
73
|
- **Branch from a message.** In an AI message menu, select “Branch from here” to create a room containing the history through that message. Connections that support session branching resume from the branched session in the new room. The original room is kept.
|
|
69
|
-
- **Let the host create rooms.** With “Create rooms” ticked in “Host permissions”, the host can move part of the work into a new room. Members use only software configured on this computer, with read-only project access by default and at most write. The project folder must be the original room’s folder or a folder inside it. Unless you name another host, the new room is hosted by the same expert as the original host. Each room gets a “Linked room” card; select “Open room” to go to the other one. The new room
|
|
74
|
+
- **Let the host create rooms.** With “Create rooms” ticked in “Host permissions”, the host can move part of the work into a new room. Members use only software configured on this computer, with read-only project access by default and at most write. The project folder must be the original room’s folder or a folder inside it. Unless you name another host, the new room is hosted by the same expert as the original host. Each room gets a “Linked room” card; select “Open room” to go to the other one. The new room inherits the original room’s smart scheduling, image generation, API limit, chain round limit and host permissions, except that it cannot create rooms. A room can create a limited number of rooms (3 by default, adjustable in “Host permissions”). The hosts of two linked rooms can speak in each other’s room; each message shows the sending host’s name, avatar and a link to the source room. Messages go directly to the receiving host and queue while the room is busy. A parent can interrupt its child to redirect work. If the child cannot accept an interjection or stop, the message stays queued. There is no limit by default. To cap it, set “Linked-room message limit” under “Advanced settings” in the new-room form (it applies to every linked room on this computer); counting from your last message in either room, messages beyond it are refused until you send a message.
|
|
70
75
|
|
|
71
76
|
## Notes
|
|
72
77
|
|
package/docs/guide/remote.md
CHANGED
|
@@ -48,7 +48,7 @@ npm 安装默认提供本机站点,没有随包可直接使用的公共线上
|
|
|
48
48
|
|
|
49
49
|
- 查看全部房间与实时更新、发消息、上传附件、语音输入与朗读、导出备份。
|
|
50
50
|
- 新建房间、邀请与请回成员、翻开卡片改模型与权限、录入 API 密钥、签发外部成员邀请。
|
|
51
|
-
- **目录范围受电脑控制**:外出设备只能选用你在电脑上保存的“常用项目”及其子文件夹(点项目目录栏末尾的文件夹按钮逐层浏览)。需要扩大范围时,在电脑上把上级目录加入“常用项目”。
|
|
51
|
+
- **目录范围受电脑控制**:外出设备只能选用你在电脑上保存的“常用项目”及其子文件夹(点项目目录栏末尾的文件夹按钮逐层浏览)。需要扩大范围时,在电脑上把上级目录加入“常用项目”。 在“管理项目…”中,拖动项目左侧的手柄,点“保存”即可更改选择菜单里的顺序。
|
|
52
52
|
|
|
53
53
|
## 要注意什么
|
|
54
54
|
|
package/docs/guide/rooms.md
CHANGED
|
@@ -28,7 +28,11 @@
|
|
|
28
28
|
|
|
29
29
|
- **排序**:点目录右上角选项,在“手动排序”(拖动或用上下方向键调序)和“最近发言”之间切换。
|
|
30
30
|
- **文件夹**:点“新建文件夹”按项目归集房间,可为文件夹设置默认项目目录,之后在该文件夹里建房会自动带入。点文件夹菜单可“编辑”、“上移”、“下移”、“存档文件夹”或“移除文件夹”(可选择仅移除文件夹,或连同其中房间一并删除)。
|
|
31
|
-
-
|
|
31
|
+
- **子房间**:主持人建的房间继承当前文件夹。点父房间标题右侧的箭头展开或收起,点标题进入父房间。打开子房间、子房间开始执行或新建子房间时自动展开;手动收起后,本次页面会话保留选择。子房间移到其他文件夹,或父房间存档、销毁后,子房间在所在文件夹独立显示。
|
|
32
|
+
- **房间操作**:点房间右侧菜单,可以“重命名”、“编辑议题”、“移至文件夹”、“复制阅读入口”、“刷新消息”、“存档房间”或“销毁房间”。“编辑议题”和“刷新消息”用于当前打开的房间。在电脑左栏双击房间名称,也能直接打开“重命名”。
|
|
33
|
+
- 消息里的视频正在读取首帧时,预览区使用当前主题的底色,画面就绪后自动显示。
|
|
34
|
+
- 切回最近打开的房间时,右栏“发言顺序”先显示上次读到的模型和思考强度。成员或执行变化后会自动更新。
|
|
35
|
+
- 在已有房间的“协作设置”中,切换“智能调度”时该行保持固定高度。开启后,点“设置”展开决策模型配置。
|
|
32
36
|
- **销毁房间**:在房间菜单点“销毁房间”。确认框列出会删除和保留的内容,可先点“导出资料包”下载一份:含消息、私聊、附件、可双击打开的“讨论记录.html”,以及成员写在草稿目录里的文件(“草稿”文件夹,超过 50 MB 的部分只列出文件名)。点“立即销毁”,再在“再次确认销毁”里点“确认销毁”后(所有销毁入口都要这样确认两次),这台电脑上的房间记录、附件、成员在本房间新建的 AI 会话记录、运行文件和草稿会被删除:房间立即化成粒子消散(左栏那一行和打开着的中间区域一起),删除与核验在后台继续,全部完成后右下角显示删除了多少。建房时自动创建的草稿文件夹(左侧“项目”里的“草稿”)连同其中文件也会删除,资料包里放在“草稿空间”文件夹;你选的项目文件夹不会删除;沿用你原有窗口的会话、与其他房间共用的会话会保留;已发给模型服务商的内容按其政策保留,无法从这里删除。房间发布过分享网页时,销毁前会先撤销它。某项暂时没删掉时,右下角会提示,可在“销毁记录”里查看并重试。成员草稿目录里的文件会随房间删除,需要的先导出资料包。
|
|
33
37
|
- **销毁记录与销毁全部房间**:点左栏房间目录右上角“…”里的“销毁记录”,查看每次销毁删除了什么、保留了什么(房间名在完成后清除),未完成的可点“重试”。底部“销毁全部房间”须输入“销毁全部”确认,会逐个销毁全部房间(含已存档),项目文件保留;以独立 Windows 用户运行的托管账号随后还会删除各 AI 软件里的全部会话记录和 AI 记住的偏好,登录信息保留。“导出全部房间”不含草稿,需要草稿请逐个房间导出。
|
|
34
38
|
- **自动销毁**:新建房间时在“协作方式(可选)”里选,或之后在房间顶部的“房间”页,把“自动销毁”设为无活动 1 天、7 天或 30 天后销毁,旁边显示还剩多久;从设定时起算,房间里有新消息或私聊会重新计时;已存档、有成员在工作或排队、有待你回答的提问、发布着分享网页的房间不会自动销毁。剩余不足一天时网页会提示一次,销毁后也会提示。默认“长期保留”。
|
|
@@ -66,7 +70,7 @@
|
|
|
66
70
|
附件默认不带,消息里的附件标记显示为“未包含在分享中”。房间有附件时,确认框里有“包含附件”,勾选后所有附件(图片、视频、网页、文档等)原样放进分享页,读者可以查看和下载;成员回答里交付的项目文件(回答下方的文件卡片)也会作为该条回答的附件一起带上。文本类附件会一并检查疑似密钥和本机目录;图片、视频等文件的内容程序查不了,请自己核对。发布链接带上页面能预览的附件:图片、音视频、PDF、Word/Excel/PowerPoint(docx、xlsx、pptx)、文本与代码、zip 压缩包和网页,读者在分享页里直接打开;js、bat、ps1 等双击就会运行的脚本改名为 .txt 后带上。程序和旧版 doc/xls/ppt 不放到分享站,消息里显示“未包含在分享中”,下载的网页文件仍会带上。网页附件在分享页里照常运行,成员回答里引用的演示直接显示在消息中;它在隔离的框架里运行,读不到分享页,也不能联网请求或提交表单。勾选后点“筛选附件”可按类型或逐个选择;合计超过 300 MB 时筛选自动展开。文件按最新消息在前排列。每项显示消息编号、发送者、时间及大小,点文件名或“预览”核对内容,关闭预览即可继续勾选。发布时文字最多 5 MB,每个附件最多 100 MB、附件合计最多 300 MB。电脑上的常驻服务负责整理和上传,手机锁屏、关闭页面或换一台已配对设备都可以继续。在左侧“已分享”的“分享任务”里可以打开确认、查看已传文件数和字节数、取消、重试或调整附件。发布完成后,从下方的有效链接查看分享卡或复制链接。取消、重试和清除会立即更新该任务;操作失败会恢复并提示原因。打开确认或分享卡时会先显示房间标题,再载入内容。常驻服务未运行时由浏览器处理,此时须保持页面打开。网页文件最多带 100 MB 附件。下载前房间内容若有更新,会重新显示确认框。
|
|
67
71
|
- **导入房间**:目录选项或文件夹菜单 → “导入房间”,选择 ZIP 文件,在预览中确认要导入的房间;标为“已存在,跳过”的房间会保留原样。在同一台电脑导入后,请回成员会续接原会话(Claude Code 成员会改为手动接入,请回后在原窗口重新注册,避免会话分叉)。导入保留历史讨论记录,不会自动继续原讨论或重新唤醒成员。
|
|
68
72
|
- **从某条消息分支**:AI 发言菜单 → “从这里分支”,新建一个保留截至该条发言记录的房间。支持会话分叉的接入方式会在新房间续接分叉后的会话;原房间保留。
|
|
69
|
-
-
|
|
73
|
+
- **让主持人新建房间**:在“主持人权限”里勾选“新建房间”后,主持人可以把一部分工作拆到新房间:成员只用本机已配置的软件,项目权限默认只读、最高可写,项目目录只能是原房间的目录或其子目录;你没指定时由与原主持人同款的专家主持。两个房间各留一张“关联房间”卡片,点“打开房间”互相跳转。新房间直接继承原房间的智能调度、生图、API 上限、连续派活上限与主持人权限,但不能再新建房间;一个房间可新建的数量有上限(默认 3 个,可在“主持人权限”里调整)。两个关联房间的主持人可以互相发言,跨房卡片显示来源主持人的名字、头像和房间,点房间徽章可跳转。消息直接交给目标主持人,忙时排队。父房间可立即发送以调整子房间的工作,目标无法插话或停止时继续排队;默认不限条数;担心两边来回不停,可在新建房间面板“高级设置”里设“关联房间互传上限”(对本机所有关联房间生效),从你上次在任一房间发言算起超过这个条数会被拒绝,你发一条消息即可让它们继续。
|
|
70
74
|
|
|
71
75
|
## 要注意什么
|
|
72
76
|
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
"裁剪预览": "Crop preview",
|
|
6
6
|
"选择保留的画面": "Choose the area to keep",
|
|
7
7
|
"使用此封面": "Use this cover",
|
|
8
|
+
"已使用上传的封面,可重新上传或切回自动封面。": "Using the uploaded cover. Upload another image or switch back to the automatic cover.",
|
|
8
9
|
"请选择 PNG、JPG 或 WebP 图片": "Choose a PNG, JPG or WebP image",
|
|
9
10
|
"房间内容已更新,请核对后下载网页文件。": "The room changed. Review the updated contents before downloading the web page.",
|
|
10
11
|
"需要管理员登录": "Sign in as an administrator.",
|
|
@@ -191,6 +191,10 @@
|
|
|
191
191
|
"这条排队消息已发出或已删除": "This queued message was sent or deleted",
|
|
192
192
|
"排队消息已变化,请刷新后再调整顺序": "Queued messages changed; refresh before reordering",
|
|
193
193
|
"点名的成员已不在房间": "The members it names are no longer in the room",
|
|
194
|
+
"关联房间「{room}」的主持人刚发来消息 #{message_id},请先读原文。": "The host of linked room “{room}” just sent message #{message_id}. Read the original message.",
|
|
195
|
+
"仅父房间主持人可以打断子房间": "Only the parent room’s host can interrupt a child room.",
|
|
196
|
+
"只能编辑用户自己的消息": "Only the user's own messages can be edited.",
|
|
197
|
+
"relay.member 须为成员名称": "relay.member must be a member name.",
|
|
194
198
|
"用户刚发来消息 #{message_id},请先读原文,在这一轮的回答里一并处理。": "The owner just sent message #{message_id}; read it and handle it in this turn's answer as well.",
|
|
195
199
|
"这条消息已发出,只是还在等忙碌的成员;可以删除后重新发送": "This message is already posted and only waits for busy members; delete it and send again instead",
|
|
196
200
|
"action 须为 {value1} 之一": "action must be one of {value1}",
|
|
@@ -42,6 +42,13 @@
|
|
|
42
42
|
"正在启动": "Starting",
|
|
43
43
|
"正在创建": "Creating",
|
|
44
44
|
"正在创建房间…": "Creating the room…",
|
|
45
|
+
"父房间主持 · {room}": "Parent host · {room}",
|
|
46
|
+
"子房间主持 · {room}": "Child host · {room}",
|
|
47
|
+
"关联房间 · {room}": "Linked room · {room}",
|
|
48
|
+
"父房间「{room}」主持 {host}": "{host}, host of parent room “{room}”",
|
|
49
|
+
"子房间「{room}」主持 {host}": "{host}, host of child room “{room}”",
|
|
50
|
+
"收起子房间": "Collapse child rooms",
|
|
51
|
+
"展开 {count} 个子房间": "Expand {count} child rooms",
|
|
45
52
|
"显示更多": "Show more",
|
|
46
53
|
"继续 Goal": "Continue Goal",
|
|
47
54
|
"展开或收起详情": "Expand or collapse details",
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@ import { atomic_json } from './files.mjs';
|
|
|
16
16
|
import { room_draft_space } from './room_destruction.mjs';
|
|
17
17
|
import { ISOLATED_ACCOUNT_VARIABLE } from './os_users.mjs';
|
|
18
18
|
import { read_store } from './external_client.mjs';
|
|
19
|
-
import { bundle_project_markdown, bundle_project_page, outside_directory, project_media, project_root, project_zip, read_only_enforced, read_project_files, read_project_folders, room_directories, search_project_roots } from './project_files.mjs';
|
|
19
|
+
import { bundle_project_markdown, bundle_project_page, inside_room, outside_directory, project_media, project_root, project_zip, read_only_enforced, read_project_files, read_project_folders, room_directories, search_project_roots } from './project_files.mjs';
|
|
20
20
|
import { delete_entry, make_folder, paste_entry, read_text, RecycleArea, rename_entry, save_text, upload_part } from './project_manage.mjs';
|
|
21
21
|
import { guard_remote_request, list_remote_directories, remote_allows, remote_roots } from './remote_policy.mjs';
|
|
22
22
|
import { list_devices, machine_fingerprint, revoke_device, start_pairing } from './device_auth.mjs';
|
|
@@ -34,7 +34,7 @@ import { open_project } from './adapters/api_files.mjs';
|
|
|
34
34
|
import { run_image_tool } from './adapters/api_images.mjs';
|
|
35
35
|
import { access_levels, BUILTIN_EXPERT_PRESETS, MAX_EXPERT_PROMPT, PROJECT_ACCESS } from './expert_prompts.mjs';
|
|
36
36
|
import { acquire_lock, api, check_extra_directories, DiscussionStore, service_drafts, validate_config } from './discussion_runner.mjs';
|
|
37
|
-
import { FreeRoomRunner, free_task_files } from './free_runner.mjs';
|
|
37
|
+
import { FreeRoomRunner, free_task_files, member_drafts, member_extra_directories } from './free_runner.mjs';
|
|
38
38
|
import { assert_workflow_enabled, bind_room_workflow, delete_workflow, get_workflow, list_workflows, load_room_workflow, parse_workflow_draft, preview_workflow, rename_workflow, save_workflow, set_workflow_disabled, workflow_cards, workflow_directory, workflow_member_list, WORKFLOW_ID_PATTERN,
|
|
39
39
|
card_folder, CARD_ID_PATTERN, expert_skills, experts_home, load_room_workflow as load_workflow_for_cards, parse_markdown, serialize_markdown, SKILL_FILE,
|
|
40
40
|
SKILL_NAME_PATTERN, SKILLS_DIRECTORY } from './workflows.mjs';
|
|
@@ -181,10 +181,10 @@ host-control 主持人代房主控制房间,须房主已为本房间勾选对
|
|
|
181
181
|
推进:order 读取发言顺序,order --order 甲,乙 --revision REV 调整尚未发言的部分;
|
|
182
182
|
discussion 读取讨论,discussion --do start --goal 目标 --revision REV 开启(上限用房间默认值),--do pause|resume|end --revision REV;
|
|
183
183
|
goal 读取 Goal,goal --do start --goal 目标 --revision REV 开启(预算用房主默认值,默认不限时为 8 次续跑、90 分钟),--do pause|resume|end --revision REV。
|
|
184
|
-
房间:create-room --title 标题 [--goal 目标] [--members 甲,乙] [--host 平台] [--cwd 子目录] [--access read|write] [--text 首条消息] [--submission-id ID]
|
|
184
|
+
${t("房间:create-room --title 标题 [--goal 目标] [--members 甲,乙] [--host 平台] [--host-model 模型] [--host-effort 档位] [--cwd 子目录] [--access read|write] [--text 首条消息 | --body-file FILE] [--submission-id ID]")}
|
|
185
185
|
新建一个房间分担工作:成员用本机已配置的软件,项目权限默认只读、最高可写,目录只能是本房间项目目录或其子目录;不填 --host 时由与你同款的专家主持;
|
|
186
|
-
|
|
187
|
-
room-post --room 房间编号 --text 话 [--submission-id ID]
|
|
186
|
+
新房间复制本房间的智能调度、生图、API 上限、连续派活上限与主持人权限(不含新建房间),本房间可新建的数量有上限;两边各留一张链接卡片;重试沿用同一 --submission-id;
|
|
187
|
+
${t("room-post --room 房间编号 (--text 话 | --body-file FILE) [--interrupt] [--submission-id ID] 在关联房间(你新建的,或新建本房间的)发言,空闲时直达主持人,忙时排队;仅父房间可用 --interrupt 打断子房间;自用户上次发言起两边互传的条数受本机“关联房间互传上限”限制(默认不限);读它用平常的读取命令、房间编号写新房间的(跨房间只能读)。")}
|
|
188
188
|
不开放:批准超出上限的轮数、项目权限高于可写或放行工具、改项目目录、撤回回退用户消息、私聊、对主持人自己的其他操作。
|
|
189
189
|
workflow-check 按导入规则校验工作流文件夹或单段草稿,返回预览,不保存;workflow-save 校验后保存进工作流库,卡片按声明的项目权限保存;库里已有同 ID 的工作流时须表明来意:--revision 写读取时的修订号(库在那之后被改过就拒绝,什么都不写),或 --overwrite 明确整份覆盖,两样都没有就拒绝。写法见 workflow-creator 技能。
|
|
190
190
|
JSON 指定 site、entry(conversation/web)、room(建房内容,含 submission_id)
|
|
@@ -2058,7 +2058,8 @@ async function perform_launch(home, context, options) {
|
|
|
2058
2058
|
const { input, config, minutes, draft, request_signature, directory, previous } = context;
|
|
2059
2059
|
// This is the creation input's start-discussion choice, not the persisted room model (always free).
|
|
2060
2060
|
const discussion = previous?.discussion ?? (input.room ? input.room.mode !== 'free' : Boolean(context.room.session && context.room.session.status !== 'concluded'));
|
|
2061
|
-
const record = previous || { token: config.token, signature: draft, request_signature, config, minutes, entry: input.entry, discussion
|
|
2061
|
+
const record = previous || { token: config.token, signature: draft, request_signature, config, minutes, entry: input.entry, discussion,
|
|
2062
|
+
...(options.inherited_folder ? { inherited_folder: options.inherited_folder } : {}) };
|
|
2062
2063
|
record.discussion = discussion;
|
|
2063
2064
|
const persist = () => atomic_json(join(directory, 'launch.json'), record);
|
|
2064
2065
|
if (!previous) persist();
|
|
@@ -2067,6 +2068,7 @@ async function perform_launch(home, context, options) {
|
|
|
2067
2068
|
let room = context.room;
|
|
2068
2069
|
if (!input.room_id) room = await site_request(input.site, '/api/rooms', config.token, {
|
|
2069
2070
|
...input.room,
|
|
2071
|
+
...(record.inherited_folder ? { folder_id: record.inherited_folder } : {}),
|
|
2070
2072
|
members: card_order(input.room.members, [...Object.keys(config.participants).map(name => ({ name, adapter: config.participants[name].adapter,
|
|
2071
2073
|
token: config.members[name].token, access: 'runner', session_mode: config.participants[name].session_id ? 'borrowed' : 'new' })),
|
|
2072
2074
|
// Manual members keep the credentials the browser generated; nothing local is configured for them.
|
|
@@ -2558,7 +2560,7 @@ async function host_room(home, access_file) {
|
|
|
2558
2560
|
if (!host || !roster.some(member => member.name === host && member.role === 'host' && member.status === 'active')) throw new Error('只有本房间的主持人能运行此命令');
|
|
2559
2561
|
// How the room shows each member (the owner's label, else its platform nickname), so the host names them as it sees them.
|
|
2560
2562
|
const labels = { ...Object.fromEntries((room.members || []).map(member => [member.name, member.label])), ...room.labels };
|
|
2561
|
-
return { path, config, roster, labels, host };
|
|
2563
|
+
return { path, config, roster, labels, host, folder_id: room.folder_id, max_rounds: room.free?.max_rounds };
|
|
2562
2564
|
}
|
|
2563
2565
|
|
|
2564
2566
|
const IMAGE_ACTIONS = { generate: 'generate_image', edit: 'edit_image' };
|
|
@@ -2968,18 +2970,37 @@ async function host_create_room(ctx, o) {
|
|
|
2968
2970
|
if (o.access && !HOST_CARD_ACCESS.includes(o.access)) throw new Error('新房间成员的项目权限只能是 read 或 write');
|
|
2969
2971
|
const access = o.access || 'read';
|
|
2970
2972
|
const host_name = o.host || platform_of(host);
|
|
2971
|
-
const
|
|
2973
|
+
const listed = (o.members || '').split(',').map(name => name.trim()).filter(Boolean);
|
|
2974
|
+
const names = [host_name];
|
|
2975
|
+
let includes_host = false;
|
|
2976
|
+
for (const name of listed) {
|
|
2977
|
+
if (name === host_name && !includes_host) { includes_host = true; continue; }
|
|
2978
|
+
names.push(names.includes(name) ? free_instance(name, new Set(names)) : name);
|
|
2979
|
+
}
|
|
2972
2980
|
const participants = Object.fromEntries(names.map(name => [name, host_invite_profile(home, name, { access })]));
|
|
2973
2981
|
if (!o.host) {
|
|
2974
2982
|
// The same expert as this host: its software, model and effort, in a new session and at the access asked for.
|
|
2975
2983
|
const { session_id, cwd, project_access, ...own } = config.participants?.[host] || {};
|
|
2984
|
+
const facts = adapter_profile(own.adapter);
|
|
2985
|
+
const effort = own.effort || launch_settings(home).participants?.[host_name]?.effort;
|
|
2986
|
+
if (effort && facts?.kind !== 'api' && !facts?.efforts?.includes(effort)) own.effort = '';
|
|
2976
2987
|
participants[host_name] = { ...own, project_access: access };
|
|
2977
2988
|
}
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
const
|
|
2989
|
+
if (o.host_model) participants[host_name].model = o.host_model;
|
|
2990
|
+
if (o.host_effort) participants[host_name].effort = o.host_effort;
|
|
2991
|
+
const permissions = without_host_item(host_permissions(config), 'create_rooms');
|
|
2992
|
+
const cwd = spawned_directory(config.cwd, o.cwd);
|
|
2993
|
+
let extra_directories;
|
|
2994
|
+
if (config.extra_directories?.length) {
|
|
2995
|
+
try { check_extra_directories(cwd, config.extra_directories); extra_directories = config.extra_directories; } catch {}
|
|
2996
|
+
}
|
|
2997
|
+
const receipt = await launch_discussion(home, { site: config.site, entry: 'web', cwd, participants,
|
|
2998
|
+
...(config.scheduler ? { scheduler: config.scheduler } : {}),
|
|
2999
|
+
...(config.image_generation ? { image_generation: true } : {}),
|
|
3000
|
+
...(config.api_max_requests !== undefined ? { api_max_requests: config.api_max_requests } : {}),
|
|
3001
|
+
...(extra_directories ? { extra_directories } : {}),
|
|
2981
3002
|
host_permissions: permissions, room: { title: o.title, goal: o.goal || '', mode: 'free', host: host_name, submission_id,
|
|
2982
|
-
members: names.map(name => ({ name, access: 'runner' })) } }, ctx.launch_options);
|
|
3003
|
+
members: names.map(name => ({ name, access: 'runner' })) } }, { ...ctx.launch_options, inherited_folder: ctx.folder_id });
|
|
2983
3004
|
const room_id = receipt.room.id;
|
|
2984
3005
|
const parent_path = registered_room_path(home, config.site, config.room);
|
|
2985
3006
|
if (!retry) edit_room_config(parent_path, saved => ({ ...saved, spawned_rooms: [...(saved.spawned_rooms || []), { room: room_id, submission_id }] }));
|
|
@@ -2988,6 +3009,9 @@ async function host_create_room(ctx, o) {
|
|
|
2988
3009
|
const registered = registered_room_config(home, config.site, room_id);
|
|
2989
3010
|
if (registered.config.spawned_from !== config.room) edit_room_config(registered.path, saved => ({ ...saved, spawned_from: config.room }));
|
|
2990
3011
|
const child = registered.config;
|
|
3012
|
+
if (!retry && typeof ctx.max_rounds === 'number') {
|
|
3013
|
+
await site_request(config.site, `/api/rooms/${room_id}/budget`, child.token, { max_rounds: ctx.max_rounds }, caller_only(ctx.headers));
|
|
3014
|
+
}
|
|
2991
3015
|
await site_request(config.site, `/api/rooms/${room_id}/room-link`, child.token, { relation: 'parent', room_id: config.room, host: label }, caller_only(ctx.headers));
|
|
2992
3016
|
const first = o.text ? await host_room_post({ ...ctx, config: configuration_snapshot(parent_path).config }, { room: room_id, text: o.text, submission_id: `${submission_id}-first` }) : null;
|
|
2993
3017
|
return { room_id, title: receipt.room.title, url: receipt.url, host: host_name, members: names, project_access: access,
|
|
@@ -3005,12 +3029,13 @@ async function host_room_post(ctx, o) {
|
|
|
3005
3029
|
if (!o.room || (o.room !== config.spawned_from && !(config.spawned_rooms || []).some(item => item.room === o.room))) {
|
|
3006
3030
|
throw new Error('只能在与本房间关联的房间里发言(本房间新建的房间,或新建本房间的房间);用 --room 指定其房间编号');
|
|
3007
3031
|
}
|
|
3008
|
-
if (!o.
|
|
3032
|
+
if (o.interrupt && !(config.spawned_rooms || []).some(item => item.room === o.room)) throw new Error(t('仅父房间主持人可以打断子房间'));
|
|
3033
|
+
if (!o.text) throw new Error(t('须用 --text 或 --body-file 写明要发的消息'));
|
|
3009
3034
|
const child = registered_room_config(home, config.site, o.room).config;
|
|
3010
3035
|
const result = await site_request(config.site, `/api/rooms/${o.room}/messages`, child.token, { author: '用户', text: o.text,
|
|
3011
|
-
submission_id: o.submission_id || randomUUID(), relay: { room_id: config.room, host: ctx.labels[host] || host,
|
|
3036
|
+
submission_id: o.submission_id || randomUUID(), queue: true, ...(o.interrupt ? { interrupt: true } : {}), relay: { room_id: config.room, member: host, host: ctx.labels[host] || host,
|
|
3012
3037
|
limit: launch_settings(home).create_preferences?.relay_rounds ?? 0 } }, caller_only(ctx.headers));
|
|
3013
|
-
return { room_id: o.room, message_id: result.message?.id ?? null, queued: result.queued ?? null };
|
|
3038
|
+
return { room_id: o.room, message_id: result.message?.id ?? null, queued: result.queued ?? null, interrupted: Boolean(result.interrupted), ...(result.reason ? { reason: result.reason } : {}) };
|
|
3014
3039
|
}
|
|
3015
3040
|
|
|
3016
3041
|
const HOST_CONTROLS = {
|
|
@@ -3069,15 +3094,25 @@ const HOST_CONTROLS = {
|
|
|
3069
3094
|
*/
|
|
3070
3095
|
export async function host_control(home, action, options, launch_options = {}) {
|
|
3071
3096
|
if (!Object.hasOwn(HOST_CONTROLS, action || '')) throw new Error(`操作须为 ${Object.keys(HOST_CONTROLS).join('、')} 之一`);
|
|
3072
|
-
const { config, roster, labels, host } = await host_room(home, options.access_file);
|
|
3097
|
+
const { config, roster, labels, host, folder_id, max_rounds } = await host_room(home, options.access_file);
|
|
3073
3098
|
const needed = HOST_ACTION_ITEMS[action];
|
|
3074
3099
|
if (needed && !host_allowed(config, needed)) throw new Error(host_refusal(needed));
|
|
3100
|
+
if (options.body_file && ['create-room', 'room-post'].includes(action)) {
|
|
3101
|
+
if (options.text !== undefined) throw new Error(t('--body-file 与 --text 只能选一项'));
|
|
3102
|
+
const profile = config.participants[host];
|
|
3103
|
+
const file = realpathSync(options.body_file);
|
|
3104
|
+
const roots = [member_drafts(config, host), profile.cwd || config.cwd, ...member_extra_directories(config, profile).map(item => item.path)];
|
|
3105
|
+
if (!inside_room({ extra_directories: roots.filter(root => root && existsSync(root)).map(root => realpathSync(root)) }, file)) {
|
|
3106
|
+
throw new Error(t('正文文件须位于主持人的项目或草稿目录'));
|
|
3107
|
+
}
|
|
3108
|
+
options = { ...options, text: readFileSync(file, 'utf8').replace(/^\uFEFF/, '') };
|
|
3109
|
+
}
|
|
3075
3110
|
// The User-Agent names the caller in the event log; the host's own credential is what lets the site label what it
|
|
3076
3111
|
// does as the host's (steer, stop) by its display name, since every write here carries the owner's credential.
|
|
3077
3112
|
const headers = { 'User-Agent': `AI-CoDiscuss-host:${host}`, 'X-Acting-Member-Token': config.members[host].token };
|
|
3078
3113
|
const owner = { site: config.site, room_id: config.room, token: config.token };
|
|
3079
3114
|
const call = (path, body) => site_request(config.site, `/api/rooms/${config.room}${path}`, config.token, body, headers);
|
|
3080
|
-
return HOST_CONTROLS[action]({ home, config, roster, labels, host, headers, owner, call, launch_options }, options);
|
|
3115
|
+
return HOST_CONTROLS[action]({ home, config, roster, labels, host, headers, owner, call, launch_options, folder_id, max_rounds }, options);
|
|
3081
3116
|
}
|
|
3082
3117
|
|
|
3083
3118
|
/** Cards as the host may bring them: any access above writing is lowered to it. */
|
|
@@ -3189,6 +3224,7 @@ export async function launch_main(args = process.argv.slice(2), input_text) {
|
|
|
3189
3224
|
draft: { type: 'string' }, 'access-file': { type: 'string' }, dir: { type: 'string' }, card: { type: 'string' }, sub: { type: 'string' }, id: { type: 'string' },
|
|
3190
3225
|
member: { type: 'string' }, order: { type: 'string' }, revision: { type: 'string' }, name: { type: 'string' }, access: { type: 'string' },
|
|
3191
3226
|
model: { type: 'string' }, effort: { type: 'string' }, do: { type: 'string' }, execution: { type: 'string' }, text: { type: 'string' },
|
|
3227
|
+
'host-model': { type: 'string' }, 'host-effort': { type: 'string' }, interrupt: { type: 'boolean' }, 'body-file': { type: 'string' },
|
|
3192
3228
|
goal: { type: 'string' }, label: { type: 'string' }, description: { type: 'string' }, adapter: { type: 'string' }, 'submission-id': { type: 'string' },
|
|
3193
3229
|
message: { type: 'string' }, minutes: { type: 'string' }, off: { type: 'boolean' }, list: { type: 'boolean' },
|
|
3194
3230
|
title: { type: 'string' }, members: { type: 'string' }, host: { type: 'string' }, cwd: { type: 'string' }, room: { type: 'string' },
|
|
@@ -3203,7 +3239,7 @@ export async function launch_main(args = process.argv.slice(2), input_text) {
|
|
|
3203
3239
|
const { member, order, revision, name, access, model, effort, execution, text, goal, label, description, adapter } = values;
|
|
3204
3240
|
const result = await host_control(service_home(), positionals[1], { member, order, revision, name, access, model, effort, execution, text, goal,
|
|
3205
3241
|
label, description, adapter, message: values.message, minutes: values.minutes, off: values.off, list: values.list, do: values.do, submission_id: values['submission-id'],
|
|
3206
|
-
title: values.title, members: values.members, host: values.host, cwd: values.cwd, room: values.room, access_file: values['access-file'] || process.env.DISCUSS_ACCESS_FILE });
|
|
3242
|
+
title: values.title, members: values.members, host: values.host, cwd: values.cwd, room: values.room, interrupt: values.interrupt, body_file: values['body-file'], host_model: values['host-model'], host_effort: values['host-effort'], access_file: values['access-file'] || process.env.DISCUSS_ACCESS_FILE });
|
|
3207
3243
|
return process.stdout.write(`${JSON.stringify(result)}
|
|
3208
3244
|
`);
|
|
3209
3245
|
}
|