ai_co_discuss 0.5.31 → 0.5.33
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 +1 -1
- package/backend/free_room.py +5 -0
- package/backend/server.py +59 -2
- package/docs/en/guide/discussion.md +1 -1
- package/docs/en/guide/rooms.md +2 -2
- package/docs/guide/discussion.md +1 -1
- package/docs/guide/rooms.md +2 -2
- package/frontend/locales/en/app.json +1 -0
- package/frontend/locales/en/backend.json +1 -0
- package/frontend/locales/en/discussion.json +3 -1
- package/package.json +1 -1
- package/runner/discussion_launch.mjs +6 -5
- package/runner/expert_prompts.mjs +4 -2
- package/runner/free_runner.mjs +6 -5
- package/runner/i18n_en.mjs +3 -2
- package/web/i18n.js +2 -2
- package/web/modern.css +1 -1
- package/web/modern.js +55 -53
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
|
|
47
47
|
用 `launch host-control room-post --room 编号 --body-file FILE --expect reply` 交给对方主持人,普通通知用 `--expect none`;短消息可用 `--text`。对方忙时排队,只有父房间能用 `--interrupt` 打断子房间。达到互传上限时,请房主决定是否继续。
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
跨房请求用 `requests[].relay.reply` 中的命令回答:`launch host-control room-post --room 来源房编号 --reply-to 原消息编号 --body-file 回答.md`。先读原文,在本房权限内处理;发送或排队成功即完成该请求,本房发送卡片保留全文。若先派活,收尾时用原消息编号手动回传。若 `relay.expect` 为 `none`,读完即止。需要超出本房权限时在本房问用户。
|
|
50
50
|
|
|
51
51
|
## 定时检查
|
|
52
52
|
|
package/backend/free_room.py
CHANGED
|
@@ -4597,6 +4597,11 @@ def linked_room_values(connection, room_id, other, host):
|
|
|
4597
4597
|
def record_relay_send(connection, room_id, token, payload):
|
|
4598
4598
|
"""Record one successful linked-room send in the sending room without creating a member request."""
|
|
4599
4599
|
require_owner(connection, room_id, token)
|
|
4600
|
+
return save_relay_receipt(connection, room_id, payload)
|
|
4601
|
+
|
|
4602
|
+
|
|
4603
|
+
def save_relay_receipt(connection, room_id, payload):
|
|
4604
|
+
"""Save the sending room’s receipt for a host-to-host message."""
|
|
4600
4605
|
begin_write(connection)
|
|
4601
4606
|
target = payload.get("target_room_id")
|
|
4602
4607
|
host = linked_room_values(connection, room_id, target, payload.get("host"))
|
package/backend/server.py
CHANGED
|
@@ -56,6 +56,7 @@ from .visual_fences import fold_message_visuals
|
|
|
56
56
|
from .identity import MAX_ROOM_AGENTS, PARTICIPANTS, default_label_text, is_ai, is_participant
|
|
57
57
|
from .message_queue import drain as drain_queue, enqueue, enqueue_share, queue_action, queue_split, queue_view
|
|
58
58
|
from .room_import import import_room, imported_attachment
|
|
59
|
+
from .free_room import save_relay_receipt
|
|
59
60
|
from .room_links import list_links
|
|
60
61
|
from .free_room import require_owner_or_host
|
|
61
62
|
from .runtime import (begin_write, limit_values, owner_proxy_token, require_owner, token_hash,
|
|
@@ -2839,6 +2840,60 @@ def append_message(connection, room_id, payload, actor):
|
|
|
2839
2840
|
message_values(payload)
|
|
2840
2841
|
begin_write(connection)
|
|
2841
2842
|
room = require_room(connection, room_id)
|
|
2843
|
+
return append_room_message(connection, room, payload, actor)
|
|
2844
|
+
|
|
2845
|
+
|
|
2846
|
+
def post_host_relay(connection, host, target, payload, execution_id):
|
|
2847
|
+
"""Send a cross-room message and bind its local receipt when it answers this host's request."""
|
|
2848
|
+
incoming = payload["relay"]
|
|
2849
|
+
room_id = incoming["room_id"]
|
|
2850
|
+
if execution_id is not None and type(execution_id) is not int:
|
|
2851
|
+
raise ValueError(Text("成员回答须关联本次执行编号 execution_id"))
|
|
2852
|
+
payload["text"] = message_values(payload)[1]
|
|
2853
|
+
begin_write(connection)
|
|
2854
|
+
room = require_room(connection, target)
|
|
2855
|
+
begin_write(connection)
|
|
2856
|
+
request = connection.execute("""SELECT r.id,r.answer_id,m.submission_id,m.text,s.target_message_id,s.queued_id,s.interrupted FROM member_requests r
|
|
2857
|
+
JOIN message_relays relay ON relay.message_id=r.message_id
|
|
2858
|
+
LEFT JOIN messages m ON m.id=r.answer_id LEFT JOIN room_relay_sends s ON s.message_id=r.answer_id
|
|
2859
|
+
WHERE r.room_id=? AND r.member_id=? AND r.execution_id=? AND r.message_id=?
|
|
2860
|
+
AND relay.source_room_id=? AND relay.expect='reply'""",
|
|
2861
|
+
(room_id, host["id"], execution_id, incoming.get("reply_to"), target)).fetchone()
|
|
2862
|
+
if not request:
|
|
2863
|
+
return append_room_message(connection, room, payload, "用户")
|
|
2864
|
+
# Use the CLI's existing receipt key so a retry produces the same card.
|
|
2865
|
+
signature = json.dumps([target, payload["submission_id"]], separators=(",", ":"), ensure_ascii=False)
|
|
2866
|
+
key = "sent-" + hashlib.sha256(signature.encode()).hexdigest()
|
|
2867
|
+
answer = {"execution_id": execution_id, "text": payload["text"]}
|
|
2868
|
+
if request["answer_id"]:
|
|
2869
|
+
if request["submission_id"] != key:
|
|
2870
|
+
raise FileExistsError(Text("这个请求已回答"))
|
|
2871
|
+
if request["text"] != payload["text"]:
|
|
2872
|
+
raise FileExistsError(Text("这个提交编号已被另一条内容使用,请为新发言生成新编号"))
|
|
2873
|
+
delivery = ({"message": {"id": request["target_message_id"]}} if request["target_message_id"]
|
|
2874
|
+
else {"queued": request["queued_id"]})
|
|
2875
|
+
return {**delivery, "answer_id": request["answer_id"], "interrupted": bool(request["interrupted"])}
|
|
2876
|
+
check_answer(connection, room_id, host, answer)
|
|
2877
|
+
incoming["expect"] = "none"
|
|
2878
|
+
result = append_room_message(connection, room, payload, "用户")
|
|
2879
|
+
sent = result.get("message") or {}
|
|
2880
|
+
if sent and sent.get("relay_reply_to") != incoming["reply_to"]:
|
|
2881
|
+
raise FileExistsError(Text("这个提交编号已被另一条内容使用,请为新发言生成新编号"))
|
|
2882
|
+
receipt = save_relay_receipt(connection, room_id, dict(target_room_id=target, host=incoming["host"],
|
|
2883
|
+
member=host["name"], text=payload["text"], submission_id=key, target_submission_id=payload["submission_id"],
|
|
2884
|
+
target_message_id=(result.get("message") or {}).get("id"), queued_id=result.get("queued"),
|
|
2885
|
+
interrupted=result.get("interrupted", False)))
|
|
2886
|
+
# Other questions bundled in this execution still need their own answer.
|
|
2887
|
+
connection.execute("""UPDATE member_requests SET status='pending',execution_id=NULL
|
|
2888
|
+
WHERE execution_id=? AND status='delivering' AND id<>?""", (execution_id, request["id"]))
|
|
2889
|
+
after_free_message(connection, room_id, receipt["message_id"], host, answer)
|
|
2890
|
+
drain_room_queue(connection, room_id)
|
|
2891
|
+
return {**result, "answer_id": receipt["message_id"]}
|
|
2892
|
+
|
|
2893
|
+
|
|
2894
|
+
def append_room_message(connection, room, payload, actor):
|
|
2895
|
+
"""Append to a resolved room under the current write lock."""
|
|
2896
|
+
room_id = room["id"]
|
|
2842
2897
|
if not payload.get("relay"):
|
|
2843
2898
|
return append_free_message(connection, room, payload, actor)
|
|
2844
2899
|
if room["archived"]:
|
|
@@ -4418,11 +4473,13 @@ class DiscussionHandler(BaseHTTPRequestHandler):
|
|
|
4418
4473
|
relay.update(room_id=room_id, member=host["name"], host=member_display_names(connection, room_id)[host["name"]])
|
|
4419
4474
|
payload = dict(author="用户", text=body.get("text"), submission_id=body.get("submission_id"),
|
|
4420
4475
|
interrupt=body.get("interrupt", False), relay=relay)
|
|
4421
|
-
result =
|
|
4476
|
+
result = post_host_relay(connection, host, target, payload, body.get("execution_id"))
|
|
4422
4477
|
drain_room_queue(connection, target)
|
|
4423
4478
|
connection.commit()
|
|
4424
4479
|
self.server.hub.notify_update(target)
|
|
4425
|
-
|
|
4480
|
+
if result.get("answer_id"):
|
|
4481
|
+
self.server.hub.notify_update(room_id)
|
|
4482
|
+
receipt = {key: result[key] for key in ("queued", "interrupted", "reason", "answer_id") if key in result}
|
|
4426
4483
|
if result.get("message"):
|
|
4427
4484
|
receipt["message"] = {"id": result["message"]["id"]}
|
|
4428
4485
|
return self.respond(receipt)
|
|
@@ -15,7 +15,7 @@ There are three ways to start:
|
|
|
15
15
|
When starting from the sidebar, fill in these fields in the dialog and select “Start discussion”. The slash command uses the room’s default limits.
|
|
16
16
|
|
|
17
17
|
1. **Discussion objective.** Describe the question to resolve, the background, or your concerns.
|
|
18
|
-
2. **Round limit** and **Time limit.** The dialog fills in the room’s saved defaults.
|
|
18
|
+
2. **Round limit** and **Time limit.** The dialog fills in the room’s saved defaults. Changes in this dialog apply only to this discussion.
|
|
19
19
|
3. **Individual follow-ups** (optional). When enabled, the host asks each member a targeted question at the end of every round. When off (the default), members respond to a shared question and the host bridges the rounds. Smart scheduling can handle the between-round decision when enabled.
|
|
20
20
|
|
|
21
21
|
After starting, the host breaks down the topic and schedules speaking turns. Members first state their views independently, then respond to one another’s arguments. The right sidebar shows progress and “Speaking order”. Drag members who have not spoken to change their order.
|
package/docs/en/guide/rooms.md
CHANGED
|
@@ -30,7 +30,7 @@ Rooms created by a host inherit its folder. Select the arrow to the left of the
|
|
|
30
30
|
- **Sort rooms.** Open the directory options in the top-right corner. Choose “Manual order” (drag items or use the arrow keys) or “Recent activity”.
|
|
31
31
|
- **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.
|
|
32
32
|
- **Child rooms.** A room the host creates stays in the current folder, nested under its parent room. Select the arrow left of the parent’s title to expand or collapse it. A child room moved to another folder, or whose parent is archived or destroyed, is listed on its own. To keep a child room in the same folder but list it like an ordinary room, open its menu and select “Make standalone room”. The link between the two rooms is kept, and “Nest under parent room” puts it back.
|
|
33
|
-
- **Room actions.** Open a room’s menu to “Rename”, “
|
|
33
|
+
- **Room actions.** Open a room’s menu to “Rename”, “Share” (with “Share room”, “Copy share link”, “Revoke share link”, and “Export conversation”), “Move to folder”, “Pin room”, “Archive room”, or “Destroy room”. To reorder rooms, drag the handle on the left of a room. On a phone, selecting “Archive room” closes the menu and keeps the sidebar open. Continue organizing rooms or tap “Undo” in the notification. “Rename” turns the name into a text box in place: press Enter or click elsewhere to save, or Esc to cancel. On desktop, you can also double-click a room name in the sidebar. Use the panel icon at the right of the header to open or close the room panel.
|
|
34
34
|
- **Pin a room.** Select “Pin room” in the room’s menu. A pin appears after its name and message count; it keeps its place (it is not moved to the top). A pinned room cannot be archived or destroyed, is never auto-destroyed, and is skipped by “Archive folder”. Select “Unpin” to undo.
|
|
35
35
|
- Video attachments use the current theme’s background while loading. The preview appears as soon as the first frame is ready.
|
|
36
36
|
- 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.
|
|
@@ -76,7 +76,7 @@ Rooms created by a host inherit its folder. Select the arrow to the left of the
|
|
|
76
76
|
|
|
77
77
|
### 6. Contact another room’s host
|
|
78
78
|
|
|
79
|
-
Give your host the target room’s title, ID or link and describe the work. On a computer, drag a room from the left sidebar onto the messages or the message box to insert “"Room title" (room ID)” at the cursor, so the host can find it by its ID. The other host
|
|
79
|
+
Give your host the target room’s title, ID or link and describe the work. On a computer, drag a room from the left sidebar onto the messages or the message box to insert “"Room title" (room ID)” at the cursor, so the host can find it by its ID. The other host answers with the reply command in its task. Sending or queuing the reply completes the request and keeps its full text on the sending card. If the other host delegates, it sends the final result back manually. A notification needs no reply.
|
|
80
80
|
|
|
81
81
|
A message from another room goes to this room's current host: an idle host takes it at once even while other members work; it queues only while the host is busy. The outgoing message shows whether it is queued, delivered or answered. Open it to read the original. Only a parent can interrupt a child. Set the linked-room message limit under Settings → Room preferences (0 means unlimited). The count resets when you speak in either room. The Parent and child rooms section shows these relationships even after a room is detached in the directory.
|
|
82
82
|
|
package/docs/guide/discussion.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
从右栏开启时,在弹窗中填写以下选项,再点“开始讨论”。输入框命令由主持人按房间的默认上限处理。
|
|
16
16
|
|
|
17
17
|
1. **“讨论目标”**:写清要解决的问题、背景或顾虑。
|
|
18
|
-
2.
|
|
18
|
+
2. **“轮次上限”与“时长上限”**:弹窗会预填房间保存的默认上限,弹窗里改动只对本场生效。
|
|
19
19
|
3. **“点名追问”**(可选):开启后,每轮结束由主持人给每位成员写针对性追问;关闭(默认)时,成员按统一问题互相回应,轮间由主持人衔接(开启智能调度后可由决策模型代办)。
|
|
20
20
|
|
|
21
21
|
开启后你会看到:主持人先拆题并安排发言顺序,成员先独立提出观点,再回应彼此论证。右栏会显示本场讨论的进度与“发言顺序”,拖动尚未发言的成员可调整先后顺序。
|
package/docs/guide/rooms.md
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
- **排序**:点目录右上角选项,在“手动排序”(拖动或用上下方向键调序)和“最近发言”之间切换。
|
|
29
29
|
- **文件夹**:点“新建文件夹”按项目归集房间,可为文件夹设置默认项目目录,之后在该文件夹里建房会自动带入。点文件夹菜单可“编辑”、“上移”、“下移”、“存档文件夹”或“移除文件夹”(可选择仅移除文件夹,或连同其中房间一并删除)。
|
|
30
30
|
- **子房间**:主持人建的房间继承当前文件夹。点父房间标题左侧的箭头展开或收起,点标题进入父房间。打开子房间、子房间开始执行或新建子房间时自动展开;手动收起后,本次页面会话保留选择。子房间移到其他文件夹,或父房间存档、销毁后,子房间在所在文件夹独立显示。想让子房间和父房间留在同一文件夹、又像普通房间一样显示,点它右侧菜单的“设为独立房间”;两个房间的关联不变,之后可点“放回父房间”恢复。
|
|
31
|
-
-
|
|
31
|
+
- **房间操作**:点房间右侧菜单,可以“重命名”、“分享”(含“分享房间”、“复制分享链接”、“撤销分享链接”、“导出对话”)、“移至文件夹”、“固定房间”、“存档房间”或“销毁房间”。调整顺序请拖动房间左侧的抓手。在手机上点“存档房间”后,菜单收起,左栏保持打开,可继续整理房间,也可点提示里的“撤销”。“重命名”会把房间名原地变成输入框,按 Enter 或点别处保存,按 Esc 取消;在电脑左栏双击房间名称也能直接改名。点顶栏最右侧的面板图标可展开或收起房间面板。
|
|
32
32
|
- **固定房间**:在房间菜单点“固定房间”,房间名后(消息数之后)出现图钉,位置不变(不会置顶)。已固定的房间不能存档或销毁,也不会自动销毁,“存档文件夹”会跳过它;点“取消固定”后恢复。
|
|
33
33
|
- 消息里的视频正在读取首帧时,预览区使用当前主题的底色,画面就绪后自动显示。
|
|
34
34
|
- 切回最近打开的房间时,右栏“发言顺序”先显示上次读到的模型和思考强度。成员或执行变化后会自动更新。
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
|
|
75
75
|
### 6. 联系其他房间的主持人
|
|
76
76
|
|
|
77
|
-
告诉本房主持人目标房间的标题、编号或链接,以及要对方处理的事。在电脑上,把左栏的房间拖到消息区或输入框,会在光标处插入“「房间标题」(房间
|
|
77
|
+
告诉本房主持人目标房间的标题、编号或链接,以及要对方处理的事。在电脑上,把左栏的房间拖到消息区或输入框,会在光标处插入“「房间标题」(房间 编号)”,主持人凭编号就能找到它。对方主持人用任务中的回传命令作答。发送或排队成功就完成该请求,发送卡片保留完整正文。若对方先派活,收尾时由主持人手动把结果发回。普通通知无需回传。
|
|
78
78
|
|
|
79
79
|
对方房间发来的消息默认交给本房当前主持人:主持人空闲就立即处理,其他成员在忙也不等;主持人正忙才排队。发送记录显示排队、送达或已回复。点开可读原文。只有父房间可以打断子房间。在“设置 → 房间偏好”中调整“关联房间互传上限”,0 表示不限;你在任一房间发言后重新计数。右栏“父子房间”可查看本房的父房间和子房间,即使已在左栏将房间设为独立也能查看。
|
|
80
80
|
|
|
@@ -462,6 +462,7 @@
|
|
|
462
462
|
"未能确认这条排队消息的状态,内容已保留在输入框,请确认未发出后再发送": "Couldn't confirm this queued message's status. Its text is kept in the composer. Check that it wasn't sent before sending it again.",
|
|
463
463
|
"请先登录": "Please sign in",
|
|
464
464
|
"分享": "Share",
|
|
465
|
+
"分享房间": "Share room",
|
|
465
466
|
"用自己的 AI 开一个房间": "Start a room with your own AIs",
|
|
466
467
|
"{title} · CoDiscuss": "{title} · CoDiscuss",
|
|
467
468
|
"这是只读的分享页面,不能修改房间": "This is a read-only shared page; the room cannot be changed here",
|
|
@@ -94,6 +94,7 @@
|
|
|
94
94
|
"附件已随消息发出或正在排队,不能撤下": "This attachment was already sent with a message or is queued, so it cannot be taken back",
|
|
95
95
|
"附件已用于其他消息,或不属于本次实际提交者": "Attachment belongs to another message or another actual submitter",
|
|
96
96
|
"主持说明不能声明评审授权、依次接力或申请轮数;请在派活时提交": "Host notes cannot grant review access, relay work or request rounds; submit those when assigning work",
|
|
97
|
+
"这个请求已回答": "This request has already been answered",
|
|
97
98
|
"这个提交编号已被另一条内容使用,请为新发言生成新编号": "This submission ID was used for different content; generate a new ID for a new message",
|
|
98
99
|
"手动主持说明须关联有效的主持请求 request_ids": "Manual host notes must link valid host request_ids",
|
|
99
100
|
"主持说明只能关联当前有效的主持请求": "Host notes can only link currently valid host requests",
|
|
@@ -360,5 +360,7 @@
|
|
|
360
360
|
"下次 {value1}": "next {value1}",
|
|
361
361
|
"进行中 · 已 {value1}": "Running · {value1}",
|
|
362
362
|
"后台工作": "Background work",
|
|
363
|
-
"成员在自己的软件里设的定时;到点后的结果暂不进入房间": "A schedule the member set in its own software; what it does when it fires does not reach the room yet"
|
|
363
|
+
"成员在自己的软件里设的定时;到点后的结果暂不进入房间": "A schedule the member set in its own software; what it does when it fires does not reach the room yet",
|
|
364
|
+
"{value1} 项后台工作已结束": "{value1} background tasks ended",
|
|
365
|
+
"{value1} 项后台工作已结束,{value2} 项失败": "{value1} background tasks ended, {value2} failed"
|
|
364
366
|
}
|
package/package.json
CHANGED
|
@@ -190,7 +190,7 @@ ${t("host-control 主持人代房主控制房间,须房主已为本房间勾
|
|
|
190
190
|
${t("新建一个房间分担工作:成员用本机已配置的软件,项目权限默认只读,目录只能是本房间项目目录或其子目录;不填 --host 时由与你同款的专家主持;")}
|
|
191
191
|
${t("新房间复制本房间的智能调度、生图、API 上限、连续派活上限与主持人权限(不含新建房间),本房间可新建的数量有上限;两边各留一张链接卡片;重试沿用同一 --submission-id;")}
|
|
192
192
|
${t("rooms 查看父子房间;room list --query 标题片段 查找站点中的其他房间。")}
|
|
193
|
-
${t("room-post --room 房间编号 (--text 正文 | --body-file FILE) [--expect reply|none] [--reply-to 消息编号] [--interrupt] [--submission-id ID]
|
|
193
|
+
${t("room-post --room 房间编号 (--text 正文 | --body-file FILE) [--expect reply|none] [--reply-to 消息编号] [--interrupt] [--submission-id ID] 向同站点房间的主持人发言。回复本次执行的跨房请求即完成该请求;只有父房间可打断子房间。")}
|
|
194
194
|
${t("不开放:批准超出上限的轮数、放行工具、改项目目录、撤回回退用户消息、私聊、对主持人自己的其他操作。")}
|
|
195
195
|
workflow-check 按导入规则校验工作流文件夹或单段草稿,返回预览,不保存;workflow-save 校验后保存进工作流库,卡片按声明的项目权限保存;库里已有同 ID 的工作流时须表明来意:--revision 写读取时的修订号(库在那之后被改过就拒绝,什么都不写),或 --overwrite 明确整份覆盖,两样都没有就拒绝。写法见 workflow-creator 技能。
|
|
196
196
|
JSON 指定 site、entry(conversation/web)、room(建房内容,含 submission_id)
|
|
@@ -2773,7 +2773,7 @@ async function host_room(home, access_file) {
|
|
|
2773
2773
|
if (!host || !roster.some(member => member.name === host && member.role === 'host' && member.status === 'active')) throw new Error('只有本房间的主持人能运行此命令');
|
|
2774
2774
|
// How the room shows each member (the owner's label, else its platform nickname), so the host names them as it sees them.
|
|
2775
2775
|
const labels = { ...Object.fromEntries((room.members || []).map(member => [member.name, member.label])), ...room.labels };
|
|
2776
|
-
return { path, config, roster, labels, host, folder_id: room.folder_id, max_rounds: room.free?.max_rounds };
|
|
2776
|
+
return { path, config, roster, labels, host, execution_id: access.execution_id, folder_id: room.folder_id, max_rounds: room.free?.max_rounds };
|
|
2777
2777
|
}
|
|
2778
2778
|
|
|
2779
2779
|
const IMAGE_ACTIONS = { generate: 'generate_image', edit: 'edit_image' };
|
|
@@ -3265,10 +3265,11 @@ async function host_room_post(ctx, o) {
|
|
|
3265
3265
|
const label = ctx.labels[host] || host;
|
|
3266
3266
|
const result = await ctx.call('/host-room-post', { target_room_id: o.room, text: o.text, submission_id,
|
|
3267
3267
|
interrupt: Boolean(o.interrupt), expect: o.expect || (o.reply_to ? 'none' : 'reply'),
|
|
3268
|
-
...(o.reply_to !== undefined ? { reply_to: Number(o.reply_to) } : {}),
|
|
3268
|
+
...(o.reply_to !== undefined ? { reply_to: Number(o.reply_to), execution_id: ctx.execution_id } : {}),
|
|
3269
3269
|
limit: launch_settings(home).create_preferences?.relay_rounds ?? 0 });
|
|
3270
3270
|
const receipt = { room_id: o.room, message_id: result.message?.id ?? null, queued: result.queued ?? null,
|
|
3271
3271
|
interrupted: Boolean(result.interrupted), ...(result.reason ? { reason: result.reason } : {}) };
|
|
3272
|
+
if (result.answer_id) return { ...receipt, answer_id: result.answer_id, submission_id };
|
|
3272
3273
|
const key = createHash('sha256').update(JSON.stringify([o.room, submission_id])).digest('hex');
|
|
3273
3274
|
try {
|
|
3274
3275
|
await ctx.call('/room-relay-sent', { target_room_id: o.room, target_message_id: receipt.message_id,
|
|
@@ -3339,7 +3340,7 @@ const HOST_CONTROLS = {
|
|
|
3339
3340
|
*/
|
|
3340
3341
|
export async function host_control(home, action, options, launch_options = {}) {
|
|
3341
3342
|
if (!Object.hasOwn(HOST_CONTROLS, action || '')) throw new Error(`操作须为 ${Object.keys(HOST_CONTROLS).join('、')} 之一`);
|
|
3342
|
-
const { config, roster, labels, host, folder_id, max_rounds } = await host_room(home, options.access_file);
|
|
3343
|
+
const { config, roster, labels, host, execution_id, folder_id, max_rounds } = await host_room(home, options.access_file);
|
|
3343
3344
|
const needed = HOST_ACTION_ITEMS[action];
|
|
3344
3345
|
if (needed && !host_allowed(config, needed)) throw new Error(host_refusal(needed));
|
|
3345
3346
|
if (options.body_file && ['create-room', 'room-post'].includes(action)) {
|
|
@@ -3357,7 +3358,7 @@ export async function host_control(home, action, options, launch_options = {}) {
|
|
|
3357
3358
|
const headers = { 'User-Agent': `AI-CoDiscuss-host:${host}`, 'X-Acting-Member-Token': config.members[host].token };
|
|
3358
3359
|
const owner = { site: config.site, room_id: config.room, token: config.token };
|
|
3359
3360
|
const call = (path, body) => site_request(config.site, `/api/rooms/${config.room}${path}`, config.token, body, headers);
|
|
3360
|
-
const ctx = { home, config, roster, labels, host, headers, owner, call, launch_options, folder_id, max_rounds };
|
|
3361
|
+
const ctx = { home, config, roster, labels, host, execution_id, headers, owner, call, launch_options, folder_id, max_rounds };
|
|
3361
3362
|
const result = await HOST_CONTROLS[action](ctx, options);
|
|
3362
3363
|
await record_host_action(ctx, action, options, result);
|
|
3363
3364
|
return result;
|
|
@@ -225,8 +225,10 @@ export function free_task_text({ name, discussion, discussion_request, profile,
|
|
|
225
225
|
const route = workflow ? '本房间启用了工作流:派活或改文件之前,先读 workflow.skill_path,把这次请求对照主线和 workflow.sub_workflows 每一项的 description;命中就读它的 SKILL.md 并照做,不问要不要用,回答开头用一句话写明走的哪条;都不命中就按普通请求处理,回答里不必说明。' : '';
|
|
226
226
|
// A message with files is never a mere greeting: the quick path would skip them (2026-11-14, #3143); nor is a
|
|
227
227
|
// hand-back, notice, Goal or host assignment, so the shortcut only goes with a user's own message (#3145 四.5).
|
|
228
|
-
const
|
|
229
|
-
|
|
228
|
+
const relay_commands = requests.filter(request => request.relay?.reply)
|
|
229
|
+
.map(request => `${request.relay.reply} — ${request.relay.note}`).join('\n');
|
|
230
|
+
const prompt = relay_commands || files || !from_user(requests)
|
|
231
|
+
? `${relay_commands ? relay_commands + '\n' : ''}${opening}先读任务文件 ${task_path},按其中列出的技能处理并提交一次回答。${route}${read_rule}${files}`
|
|
230
232
|
: `${opening}${quick}其他请求先读任务文件 ${task_path},按其中列出的技能处理并提交一次回答。${route}${read_rule}`;
|
|
231
233
|
return { instructions, prompt };
|
|
232
234
|
}
|
package/runner/free_runner.mjs
CHANGED
|
@@ -273,9 +273,8 @@ export async function user_request_texts(config, execution) {
|
|
|
273
273
|
for (const request of execution.requests.filter(item => item.message_id === message_id)) {
|
|
274
274
|
request.relay = { from_room: message.relay_room, title: message.relay_title, host: message.relay_host,
|
|
275
275
|
relation: message.relay_relation, expect: message.relay_expect || 'reply', message_id,
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
: t('按本房已有授权处理;超出授权时在本房问用户。完成后用 reply 命令加正文,一次性回传结果。') };
|
|
276
|
+
note: t(message.relay_expect === 'none' ? '这是通知,读完即止,不用回传。'
|
|
277
|
+
: '用这条命令回答,发出即完成本次请求。', {}, process.env.CODISCUSS_LANG || 'zh-CN') };
|
|
279
278
|
}
|
|
280
279
|
} else if (message.author === '用户' && message.text) texts.push(message.text);
|
|
281
280
|
} catch { /* The host still reads the message itself. */ }
|
|
@@ -417,8 +416,10 @@ export function free_task_files(config, member, execution, binding, { session =
|
|
|
417
416
|
const bound_access = process_access && !inbox && Boolean(adapter?.capabilities.access_env);
|
|
418
417
|
const messages = execution.requests.map(item => `#${item.message_id}`).join('、');
|
|
419
418
|
const requests = execution.requests || [];
|
|
420
|
-
for (const
|
|
421
|
-
if (
|
|
419
|
+
for (const { relay } of requests) {
|
|
420
|
+
if (relay?.expect !== 'reply') continue;
|
|
421
|
+
const access = bound_access ? '' : ` --access-file "${access_path}"`;
|
|
422
|
+
relay.reply = `${cli} launch host-control room-post --room ${relay.from_room} --reply-to ${relay.message_id} --body-file "${t('回答.md', {}, process.env.CODISCUSS_LANG || 'zh-CN')}"${access}`;
|
|
422
423
|
}
|
|
423
424
|
const discussion_request = requests.find(item => item.session_request_id && ['discuss', 'discuss_host'].includes(item.purpose)) || null;
|
|
424
425
|
const direct_question = Boolean(session?.status === 'active' && requests.some(item => item.purpose === 'ask'));
|
package/runner/i18n_en.mjs
CHANGED
|
@@ -18,11 +18,12 @@ export default {
|
|
|
18
18
|
"codiscuss launch host-control ACTION [选项] [--access-file FILE]": "codiscuss launch host-control ACTION [options] [--access-file FILE]",
|
|
19
19
|
"用法:{command}": "Usage: {command}",
|
|
20
20
|
"这是通知,读完即止,不用回传。": "This is a notification. Read it without sending an acknowledgement.",
|
|
21
|
-
"
|
|
21
|
+
"用这条命令回答,发出即完成本次请求。": "Answer with this command. Sending the reply completes this request.",
|
|
22
|
+
"回答.md": "answer.md",
|
|
22
23
|
"房间编号无效": "Invalid room ID",
|
|
23
24
|
" room-links A 查看父子房间": " room-links A List parent and child rooms",
|
|
24
25
|
"rooms 查看父子房间;room list --query 标题片段 查找站点中的其他房间。": "rooms lists parent and child rooms. Use room list --query TITLE to find other rooms on the site.",
|
|
25
|
-
"room-post --room 房间编号 (--text 正文 | --body-file FILE) [--expect reply|none] [--reply-to 消息编号] [--interrupt] [--submission-id ID]
|
|
26
|
+
"room-post --room 房间编号 (--text 正文 | --body-file FILE) [--expect reply|none] [--reply-to 消息编号] [--interrupt] [--submission-id ID] 向同站点房间的主持人发言。回复本次执行的跨房请求即完成该请求;只有父房间可打断子房间。": "room-post --room ROOM (--text TEXT | --body-file FILE) [--expect reply|none] [--reply-to MESSAGE_ID] [--interrupt] [--submission-id ID] sends to another host on the same site. Replying to a cross-room request in this execution completes that request. Only a parent may interrupt its child.",
|
|
26
27
|
" account migration-backups <名> 查看各迁移备份的位置与字节数": " account migration-backups <name> Show the path and byte count of each migration backup",
|
|
27
28
|
" account release-backup <名> <迁移编号> <目录类别> --confirm 停止实例并释放指定备份": " account release-backup <name> <migration-id> <kind> --confirm Stop the instance and release the selected backup",
|
|
28
29
|
"已有账号使用不同的数据目录,请用 account migrate-data 显式迁移。": "The existing account uses a different data directory. Use account migrate-data to move it explicitly.",
|