ai_co_discuss 0.4.92 → 0.4.94
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/.agents/skills/discuss-host/references/members.md +11 -2
- package/.agents/skills/discuss-participant/references/situations.md +1 -1
- package/backend/free_room.py +42 -16
- package/backend/schema.sql +2 -0
- package/backend/server.py +1 -1
- package/frontend/locales/en/admin.json +2 -1
- package/frontend/locales/en/app.json +2 -1
- package/frontend/locales/en/backend.json +9 -4
- package/frontend/locales/en/discussion.json +1 -0
- package/gateway/gateway.mjs +13 -5
- package/package.json +1 -1
- package/runner/adapters/claude.mjs +21 -3
- package/runner/admin_panel.mjs +5 -0
- package/runner/discuss.py +8 -2
- package/runner/discussion_launch.mjs +7 -6
- package/runner/file_diff.mjs +8 -4
- package/runner/free_runner.mjs +11 -4
- package/web/admin.css +1 -1
- package/web/admin.js +1 -1
- package/web/app.js +26 -2
- package/web/i18n.js +3 -3
- package/web/modern.css +1 -1
- package/web/modern.js +8 -8
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
|
|
40
40
|
## 主动发言
|
|
41
41
|
|
|
42
|
-
需要主动说明或派活时(定时检查发现问题、用户在你自己的窗口里要你发言、你自己失效的执行要补交),用参与技能 [按需场景](../../discuss-participant/references/situations.md)“主动发言”一节的 `--proactive`,可同时 `--to` 派活或 `--continue`。
|
|
42
|
+
需要主动说明或派活时(定时检查发现问题、用户在你自己的窗口里要你发言、你自己失效的执行要补交),用参与技能 [按需场景](../../discuss-participant/references/situations.md)“主动发言”一节的 `--proactive`,可同时 `--to` 派活或 `--continue`。还有待处理的请求时默认被拒:通常等本机服务把请求交给你再一并回答;请求迟迟没有交来时,发言就是某条普通请求的回答就加 `--also-request 请求编号` 关闭它,与它们无关又必须现在说就加 `--force`。
|
|
43
43
|
|
|
44
44
|
## 你自己失败时
|
|
45
45
|
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|---|---|---|---|
|
|
20
20
|
| Claude(Claude Code) | `claude-fable-5-2`、`claude-opus-5-5`、`claude-sonnet-5-5`、`claude-haiku-5-5` | Opus 主刀长任务、前端设计与审美;Fable 审计、诊断、卡住的难题;Sonnet 常规代码初审 | Fable 额度消耗约为 Opus 的 3–4 倍 |
|
|
21
21
|
| GPT(Codex) | `gpt-6.2-astra`、`gpt-6.2-sol`、`gpt-6.1-terra`、`gpt-6-luna` | 推理、审查挑错、复杂排障;Astra 做前端版式与 3D;小修用 Sol | 易思考过度,强度从中档起步;中文常带防御腔,面向用户的中文让别家润色 |
|
|
22
|
-
| Gemini(Antigravity) | `gemini-4-carbon`、`gemini-4-neon`、`gemini-4-argon`、`gemini-4-hydrogen` | 写小说、长篇中文用 Argon 或 Carbon
|
|
22
|
+
| Gemini(Antigravity) | `gemini-4-carbon`、`gemini-4-neon`、`gemini-4-argon`、`gemini-4-hydrogen` | 写小说、长篇中文用 Argon 或 Carbon,Hydrogen 可作便宜备选;Neon 快、前端和长任务强,是写作以外的日常首选,但写作偏平;Hydrogen 便宜跑量;幻觉低、超长文本强 | 执行慢,显示掉登录或额度耗尽多半是假的,多重试;输出排版差;`/swarm` 很费额度 |
|
|
23
23
|
| DeepSeek | `deepseek-flash` | 便宜快速,多步执行稳,适合量大的简单活 | 复杂长链条任务容易原地打转;强度用 high 即可;`deepseek-v4-pro` 停在 8 月版本、比 Flash 旧,现阶段不用 |
|
|
24
24
|
| Kimi | — | 规划、前端还原、多步工具调用 | 慢、贵、常限流;跑分有人称有水分 |
|
|
25
25
|
| GLM | — | 后端逻辑少出错,中文古风文笔好 | 慢 |
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
| 代码能否被合并(FrontierCode 2.0) | Fable 5.2(49%) | Opus 5.5、6.2 Astra、6.2 Sol 在 44–46% |
|
|
38
38
|
| 综合(AA 智能指数,转述) | Fable 5.2、6.2 Astra、Neon、Carbon、Opus 5.5(59–65) | 6.2 Sol 57,Hydrogen 54 |
|
|
39
39
|
| 专项 | 行业推理:Fable 5.2、Neon、Sonnet 5.5;超长文本:Neon;3D 建模:6.2 Astra | 幻觉率:Hydrogen 8%,Sonnet 5.5 43% |
|
|
40
|
+
| 成本与速度(Vals Index 同一套题,每套成本 / 耗时) | 便宜又快:6.2 Sol $3 / 42 分钟,Neon $7 / 31 分钟,Hydrogen $10 / 32 分钟 | Carbon $11 / 48 分钟,Argon $13 / 45 分钟,Fable 5.2 $18 / 44 分钟;Sonnet 5.5 $16、Opus 5.5 $25,都要约 1.4 小时 |
|
|
40
41
|
|
|
41
42
|
## 生图模型
|
|
42
43
|
|
|
@@ -50,4 +51,12 @@
|
|
|
50
51
|
|
|
51
52
|
## 决策模型
|
|
52
53
|
|
|
53
|
-
只做是非、选择、打分并给出概率,用于批量判断与分流。
|
|
54
|
+
只做是非、选择、打分并给出概率,用于批量判断与分流。
|
|
55
|
+
|
|
56
|
+
| 模型 | AA 决策指数 | 成本 | 特点 |
|
|
57
|
+
|---|---|---|---|
|
|
58
|
+
| Drex Max v1.1(Nace.AI) | 73(并列第一) | 每百万任务 $103,约为 Gemini Decision 1 的三分之一 | — |
|
|
59
|
+
| GLiDE v1.2(Fastino) | 73(并列第一) | 未查 | — |
|
|
60
|
+
| Jev 1.14 | 66 | 比 Gemini Decision 1 便宜 | — |
|
|
61
|
+
| `gemini-decision-1`(Google) | 66 | 输入 $0.10/百万 token,输出免费;每百万任务 $345 | 能处理音频和视频,知识推理强,分类与信息提取一般 |
|
|
62
|
+
| OpenAI Decisions API、Microsoft-Decision-1 | 低于 66 | 与 Gemini Decision 1 同价(OpenAI) | — |
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
|
|
21
21
|
## 主动发言
|
|
22
22
|
|
|
23
|
-
不是房间派来的任务、而是用户在你自己的窗口里要你在房间发言时(主持人另外可在需要主动说明、派活或补交失效执行的结果时自行使用),用 `message post ROOM --proactive --body-file 草稿.md --access-file FILE` 提交(凭据用你最近一次任务的 access_file
|
|
23
|
+
不是房间派来的任务、而是用户在你自己的窗口里要你在房间发言时(主持人另外可在需要主动说明、派活或补交失效执行的结果时自行使用),用 `message post ROOM --proactive --body-file 草稿.md --access-file FILE` 提交(凭据用你最近一次任务的 access_file;转为本机托管后还没收到任务时,用原手动凭证发言会被拒,报错里给出本机服务写给你的主动发言凭据路径,改用它)。它不关联执行或请求,房间里标为“主动发言”;你有进行中的执行时改用本次执行回答;还有待处理的请求时默认被拒(手动接入的用 `--request` 回答,程序启动的通常等本机服务交给你):这次发言就是其中某条普通请求的回答时,加 `--also-request 请求编号` 一并关闭它(编号在拒绝提示里;主持人交回、接力、评审类请求不能这样关);发言与它们无关、又必须现在说时,主持人可加 `--force`,这些请求不关闭、之后仍会交给你;讨论进行中不可用。普通成员的主动发言不能派活;主持人可以同时 `--to` 派活或 `--continue`,从这条消息起算一条新任务链,同样受轮数上限约束。
|
package/backend/free_room.py
CHANGED
|
@@ -190,7 +190,7 @@ def reported_capabilities(row):
|
|
|
190
190
|
LATER_COLUMNS = {"room_members": {"access": "TEXT NOT NULL DEFAULT 'runner'", "session_mode": "TEXT NOT NULL DEFAULT 'new'"},
|
|
191
191
|
"external_members": {"platform": "TEXT NOT NULL DEFAULT ''", "model": "TEXT NOT NULL DEFAULT ''"},
|
|
192
192
|
"member_executions": {"changes": "TEXT NOT NULL DEFAULT ''", "edited": "TEXT NOT NULL DEFAULT ''", "cwd": "TEXT NOT NULL DEFAULT ''",
|
|
193
|
-
"diffs": "TEXT NOT NULL DEFAULT ''",
|
|
193
|
+
"diffs": "TEXT NOT NULL DEFAULT ''", "changes_provisional": "INTEGER NOT NULL DEFAULT 0",
|
|
194
194
|
"activity": "TEXT NOT NULL DEFAULT ''", "activity_at": "INTEGER NOT NULL DEFAULT 0",
|
|
195
195
|
"paused_at": "INTEGER NOT NULL DEFAULT 0"},
|
|
196
196
|
"member_requests": {"chain_id": "INTEGER NOT NULL DEFAULT 0", "batch_id": "INTEGER NOT NULL DEFAULT 0",
|
|
@@ -1316,7 +1316,9 @@ def check_proactive(connection, room_id, member, payload):
|
|
|
1316
1316
|
"""A member speaking on its own, e.g. its user asked in its own window, bound to no request or execution.
|
|
1317
1317
|
|
|
1318
1318
|
The host's may dispatch and ask to continue, starting a chain of its own; other members' only speak. Refused while
|
|
1319
|
-
the member has a live execution (it answers through that, so the round limit holds)
|
|
1319
|
+
the member has a live execution (it answers through that, so the round limit holds), a discussion runs, or requests
|
|
1320
|
+
still wait for the member. A waiting request the post answers is named in `also_request_ids` and closed with it;
|
|
1321
|
+
only the host may speak past the others with `force`, and those stay pending.
|
|
1320
1322
|
"""
|
|
1321
1323
|
if payload["proactive"] is not True:
|
|
1322
1324
|
raise ValueError(Text("proactive 的值须为 true"))
|
|
@@ -1327,14 +1329,28 @@ def check_proactive(connection, room_id, member, payload):
|
|
|
1327
1329
|
else Text("主动发言不关联请求,普通成员也不能派活,不能带:{fields}", fields="、".join(carried)))
|
|
1328
1330
|
if connection.execute("SELECT 1 FROM member_executions WHERE member_id=? AND status IN ('dispatched','started')", (member["id"],)).fetchone():
|
|
1329
1331
|
raise FileExistsError(Text("你有进行中的执行,请用本次执行回答,不能主动发言"))
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1332
|
+
force, answered = payload.get("force"), payload.get("also_request_ids")
|
|
1333
|
+
if force not in (None, False) and (force is not True or member["role"] != "host"):
|
|
1334
|
+
raise ValueError(Text("force 只能由主持人使用,值为 true"))
|
|
1335
|
+
# Requests this post answers (`also_request_ids`, closed with it) do not hold it back; the rest do, unless the host
|
|
1336
|
+
# says the post is none of their answer (`force`): they may stay undelivered for long, and the room must still hear it.
|
|
1337
|
+
waiting = [row for row in connection.execute("SELECT id,message_id FROM member_requests WHERE member_id=? AND status='pending' ORDER BY id",
|
|
1338
|
+
(member["id"],)) if not isinstance(answered, list) or row["id"] not in answered]
|
|
1339
|
+
if waiting and force is not True:
|
|
1333
1340
|
# Otherwise the same question is answered here and again when the request is delivered.
|
|
1334
|
-
requests = "、".join(f"
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1341
|
+
requests = "、".join(f"{row['id']}/#{row['message_id']}" for row in waiting)
|
|
1342
|
+
if member["access"] == "manual":
|
|
1343
|
+
raise FileExistsError(Text("你还有待处理的请求(请求编号/消息编号:{requests}),不能主动发言;用 --request 关闭它们后回答", requests=requests))
|
|
1344
|
+
# Name the ones this post may close, so one refusal is enough to write the right options.
|
|
1345
|
+
open_ids = {row["id"] for row in waiting}
|
|
1346
|
+
closable = "、".join(str(item["id"]) for item in queued_requests(connection, member["id"]) if item["id"] in open_ids)
|
|
1347
|
+
if member["role"] == "host" and closable:
|
|
1348
|
+
raise FileExistsError(Text("你还有待处理的请求(请求编号/消息编号:{requests}),本机服务会把它们交给你,届时一并回答;这次发言就是请求 {closable} 的回答时,用 --also-request 请求编号 一并关闭(其余是交回、接力或评审类,不能这样关闭);与待处理请求无关而确需现在说时加 --force,没关闭的请求仍会交给你", requests=requests, closable=closable))
|
|
1349
|
+
if member["role"] == "host":
|
|
1350
|
+
raise FileExistsError(Text("你还有待处理的请求(请求编号/消息编号:{requests}),本机服务会把它们交给你,届时一并回答;它们是交回、接力或评审类,不能由主动发言关闭;确需现在说时加 --force,这些请求仍会交给你", requests=requests))
|
|
1351
|
+
if closable:
|
|
1352
|
+
raise FileExistsError(Text("你还有待处理的请求(请求编号/消息编号:{requests}),本机服务会把它们交给你,届时一并回答;这次发言就是请求 {closable} 的回答时,用 --also-request 请求编号 一并关闭", requests=requests, closable=closable))
|
|
1353
|
+
raise FileExistsError(Text("你还有待处理的请求(请求编号/消息编号:{requests}),不能主动发言;本机服务会把它们交给你,届时一并回答", requests=requests))
|
|
1338
1354
|
if discussion.current_session(connection, room_id, active_only=True):
|
|
1339
1355
|
raise FileExistsError(Text("讨论进行中,不能主动发言;按主持人的安排发言"))
|
|
1340
1356
|
if payload.get("to"):
|
|
@@ -1349,6 +1365,8 @@ def check_proactive(connection, room_id, member, payload):
|
|
|
1349
1365
|
def after_proactive(connection, room_id, message_id, member, payload):
|
|
1350
1366
|
"""Record a proactive post; the host's dispatch or continue starts a new chain at it, under the usual round limit."""
|
|
1351
1367
|
connection.execute("INSERT INTO proactive_messages (message_id) VALUES (?)", (message_id,))
|
|
1368
|
+
# The member's own waiting requests this post answers are closed with it, so they are not delivered and answered again.
|
|
1369
|
+
close_also_requests(connection, room_id, member, message_id, payload.get("also_request_ids"))
|
|
1352
1370
|
if member["role"] != "host":
|
|
1353
1371
|
settle_batches(connection, room_id)
|
|
1354
1372
|
return
|
|
@@ -1370,8 +1388,6 @@ def check_answer(connection, room_id, member, payload):
|
|
|
1370
1388
|
Only the AI host dispatches work; other members' targets remain suggestions. A proactive post is checked apart.
|
|
1371
1389
|
"""
|
|
1372
1390
|
if payload.get("proactive") is not None:
|
|
1373
|
-
if payload.get("also_request_ids") is not None:
|
|
1374
|
-
raise ValueError(Text("主动发言不关联执行,不能一并交付排队请求(also_request_ids)"))
|
|
1375
1391
|
check_proactive(connection, room_id, member, payload)
|
|
1376
1392
|
return None
|
|
1377
1393
|
if payload.get("to") is not None:
|
|
@@ -3488,12 +3504,14 @@ def execution_action(connection, room_id, execution_id, token, payload, member=N
|
|
|
3488
3504
|
raise PermissionError(Text("只能报告自己执行的失败") if action == "fail" else Text("执行编号不属于本成员"))
|
|
3489
3505
|
now = int(time.time())
|
|
3490
3506
|
if action == "report":
|
|
3491
|
-
# Observed after the process ends, so the execution may already be complete; recorded once.
|
|
3492
|
-
|
|
3507
|
+
# Observed after the process ends, so the execution may already be complete; recorded once. A provisional report
|
|
3508
|
+
# (what had changed when the answer arrived, the software still closing its turn) is replaced by that final one.
|
|
3509
|
+
provisional = payload.get("provisional") is True
|
|
3510
|
+
if row["changes"] and (provisional or not row["changes_provisional"]):
|
|
3493
3511
|
raise FileExistsError(Text("本次执行的改动已记录"))
|
|
3494
3512
|
changes = changed_files(payload)
|
|
3495
|
-
connection.execute("UPDATE member_executions SET changes=?,edited=?,diffs=? WHERE id=?",
|
|
3496
|
-
(json.dumps(changes, ensure_ascii=False), edited_files(payload, changes), file_diffs(payload, changes), execution_id))
|
|
3513
|
+
connection.execute("UPDATE member_executions SET changes=?,edited=?,diffs=?,changes_provisional=? WHERE id=?",
|
|
3514
|
+
(json.dumps(changes, ensure_ascii=False), edited_files(payload, changes), file_diffs(payload, changes), int(provisional), execution_id))
|
|
3497
3515
|
elif action == "denials":
|
|
3498
3516
|
# Like file changes, read from the software's output once its process ends; recorded once.
|
|
3499
3517
|
saved = connection.execute("INSERT OR IGNORE INTO execution_denials (execution_id,room_id,denials) VALUES (?,?,?)",
|
|
@@ -3981,7 +3999,15 @@ def record_model_change(connection, room_id, member, payload):
|
|
|
3981
3999
|
if not all(isinstance(value, str) and 0 < len(value.strip()) <= MODEL_TEXT_LIMIT for value in (before, after)):
|
|
3982
4000
|
raise ValueError(Text("from 与 to 须为 1–100 字的模型说明"))
|
|
3983
4001
|
name = member_display_names(connection, room_id).get(member["name"], member["name"])
|
|
3984
|
-
|
|
4002
|
+
# Who changed it is part of the record: the host through host-control (named by the site from its credential), or
|
|
4003
|
+
# else the owner (user 2026-11-19, #5682: a bare record left the owner asking whether the host meant it).
|
|
4004
|
+
host = payload.get("by_host") or ""
|
|
4005
|
+
if host == name:
|
|
4006
|
+
text = Text("主持人 {host} 把自己的模型从 {before} 换为 {after},下次执行起生效。", host=host, before=before.strip(), after=after.strip())
|
|
4007
|
+
elif host:
|
|
4008
|
+
text = Text("主持人 {host} 把 {name} 的模型从 {before} 换为 {after},下次执行起生效。", host=host, name=name, before=before.strip(), after=after.strip())
|
|
4009
|
+
else:
|
|
4010
|
+
text = Text("用户把 {name} 的模型从 {before} 换为 {after},下次执行起生效。", name=name, before=before.strip(), after=after.strip())
|
|
3985
4011
|
message_id = connection.execute("INSERT INTO messages(room_id,author,text,source,submission_id,created_at) VALUES(?,?,?,?,?,?)",
|
|
3986
4012
|
(room_id, NOTICE_AUTHOR, text, "notice", f"model-{member['id']}-{uuid.uuid4().hex}",
|
|
3987
4013
|
time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()))).lastrowid
|
package/backend/schema.sql
CHANGED
|
@@ -297,6 +297,8 @@ CREATE TABLE IF NOT EXISTS member_executions (
|
|
|
297
297
|
finished_at INTEGER NOT NULL DEFAULT 0,
|
|
298
298
|
result TEXT NOT NULL DEFAULT '',
|
|
299
299
|
changes TEXT NOT NULL DEFAULT '',
|
|
300
|
+
-- 1 while `changes` is what had changed when the answer arrived; the report after the software exits replaces it.
|
|
301
|
+
changes_provisional INTEGER NOT NULL DEFAULT 0,
|
|
300
302
|
-- The changed files the member's own edit tools wrote; '' when its software could not tell (see possible_conflicts).
|
|
301
303
|
edited TEXT NOT NULL DEFAULT '',
|
|
302
304
|
cwd TEXT NOT NULL DEFAULT '',
|
package/backend/server.py
CHANGED
|
@@ -3629,7 +3629,7 @@ class DiscussionHandler(BaseHTTPRequestHandler):
|
|
|
3629
3629
|
elif parts[3:] == ["members"] and method == "POST":
|
|
3630
3630
|
result = add_member(connection, room_id, token, self.read_payload(), utc_now())
|
|
3631
3631
|
elif len(parts) == 5 and parts[3] == "members" and method == "POST":
|
|
3632
|
-
result = member_action(connection, room_id, int(parts[4]), token, self.read_payload())
|
|
3632
|
+
result = member_action(connection, room_id, int(parts[4]), token, {**self.read_payload(), "by_host": self.acting_host(connection, room_id)})
|
|
3633
3633
|
elif len(parts) == 6 and parts[3] == "members" and parts[5] == "interrupt" and method == "POST":
|
|
3634
3634
|
result = interrupt_member(connection, room_id, int(parts[4]), token, self.acting_host(connection, room_id))
|
|
3635
3635
|
elif len(parts) == 6 and parts[3] == "members" and parts[5] == "chat" and method in ("GET", "POST"):
|
|
@@ -384,5 +384,6 @@
|
|
|
384
384
|
"绑定共议线上网站(形如 https://xxx.pages.dev),不是你的自有域名": "Bind the CoDiscuss online site (like https://xxx.pages.dev), not your own domain",
|
|
385
385
|
"在部署线上网站的电脑上生成(它的管理面板“本机 → 线上网站 → 生成接入码”,或运行 codiscuss admin entry code),只能用一次。就在那台电脑上绑定时,只填站点地址即可。": "Generate it on the computer that deployed the online site (its management panel: This computer → Online site → Generate access code, or run codiscuss admin entry code); each code works once. On that computer itself, the site address alone is enough.",
|
|
386
386
|
"发给要绑定的电脑,在它的管理面板“本机 → 线上网站 → 绑定”里粘贴。只能用一次;再生成一个会让之前没用过的作废。": "Send it to the computer to bind and paste it in its management panel under This computer → Online site → Bind. It works once; generating another voids any unused earlier one.",
|
|
387
|
-
"不需要域名:经共议线上网站中转到这台电脑,手机和外地的电脑都能打开。": "No domain needed: relayed through the CoDiscuss online site to this computer, so phones and computers elsewhere can open it."
|
|
387
|
+
"不需要域名:经共议线上网站中转到这台电脑,手机和外地的电脑都能打开。": "No domain needed: relayed through the CoDiscuss online site to this computer, so phones and computers elsewhere can open it.",
|
|
388
|
+
"密码仅在重设时显示一次": "The password is shown only when it is reset"
|
|
388
389
|
}
|
|
@@ -394,5 +394,6 @@
|
|
|
394
394
|
"这条排队消息已发出或已删除": "This queued message was already sent or deleted.",
|
|
395
395
|
"未能编辑,消息仍在排队:{value1}": "Couldn't edit it. The message is still queued: {value1}",
|
|
396
396
|
"消息仍在排队,输入框里是副本,发送前请先删除排队中的原消息": "The message is still queued and the composer holds a copy. Delete the queued original before sending.",
|
|
397
|
-
"未能确认这条排队消息的状态,内容已保留在输入框,请确认未发出后再发送": "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."
|
|
397
|
+
"未能确认这条排队消息的状态,内容已保留在输入框,请确认未发出后再发送": "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.",
|
|
398
|
+
"请先登录": "Please sign in"
|
|
398
399
|
}
|
|
@@ -201,7 +201,9 @@
|
|
|
201
201
|
"主持人 {name} 额度已用尽,处理 {messages} 的执行 #{execution_id} 失败,重置时间:{resets}。房间暂停推进:可等重置后重试这次执行,或在另一位成员卡片上点“设为主持人”换人。": "The host {name} is out of quota: execution #{execution_id} for {messages} failed. Resets at: {resets}. The room has stopped moving: retry this execution after the reset, or click “Make host” on another member's card to hand the role over.",
|
|
202
202
|
"主持人 {name} 额度已用尽,处理 {messages} 的执行 #{execution_id} 失败,重置时间未知。房间暂停推进:可等额度恢复后重试这次执行,或在另一位成员卡片上点“设为主持人”换人。": "The host {name} is out of quota: execution #{execution_id} for {messages} failed. The reset time is unknown. The room has stopped moving: retry this execution once the quota is back, or click “Make host” on another member's card to hand the role over.",
|
|
203
203
|
"from 与 to 须为 1–100 字的模型说明": "from and to must each describe a model in 1–100 characters",
|
|
204
|
-
"{name}
|
|
204
|
+
"用户把 {name} 的模型从 {before} 换为 {after},下次执行起生效。": "The user changed {name}'s model from {before} to {after}, effective from its next execution.",
|
|
205
|
+
"主持人 {host} 把 {name} 的模型从 {before} 换为 {after},下次执行起生效。": "Host {host} changed {name}'s model from {before} to {after}, effective from its next execution.",
|
|
206
|
+
"主持人 {host} 把自己的模型从 {before} 换为 {after},下次执行起生效。": "Host {host} changed its own model from {before} to {after}, effective from its next execution.",
|
|
205
207
|
"action 须为 done;宣告 Goal 卡住用 goal block": "action must be done. Use goal block to declare a blocked Goal",
|
|
206
208
|
"action 须为 renew、fail、release、report、segments、interject、interjection、retry_wait、retry_start、retry_now、retry_stop 或 retry": "action must be renew, fail, release, report, segments, interject, interjection, retry_wait, retry_start, retry_now, retry_stop, or retry",
|
|
207
209
|
"action 须为 start、continue、wait、state、done、block、pause、resume、clear 或 update": "action must be start, continue, wait, state, done, block, pause, resume, clear, or update",
|
|
@@ -282,8 +284,12 @@
|
|
|
282
284
|
"任务链剩余额度不足,需用户续额或主持人另行处理": "The task chain has insufficient remaining capacity. The user must extend it or the host must handle this separately",
|
|
283
285
|
"会话阶段须为 initial 或 discussing": "The session phase must be initial or discussing",
|
|
284
286
|
"你有进行中的执行,请用本次执行回答,不能主动发言": "You have an active run. Reply through that run instead of posting a proactive message",
|
|
285
|
-
"
|
|
286
|
-
"
|
|
287
|
+
"你还有待处理的请求(请求编号/消息编号:{requests}),本机服务会把它们交给你,届时一并回答;这次发言就是请求 {closable} 的回答时,用 --also-request 请求编号 一并关闭(其余是交回、接力或评审类,不能这样关闭);与待处理请求无关而确需现在说时加 --force,没关闭的请求仍会交给你": "You still have pending requests (request id/message id: {requests}). The local service will deliver them to you so you can answer together. If this post is the answer to request {closable}, close it with --also-request REQUEST_ID (the others are hand-backs, relay steps or reviews and cannot be closed this way); if it is unrelated to the pending requests and you must speak now, add --force, and the requests left open will still be delivered to you",
|
|
288
|
+
"你还有待处理的请求(请求编号/消息编号:{requests}),本机服务会把它们交给你,届时一并回答;它们是交回、接力或评审类,不能由主动发言关闭;确需现在说时加 --force,这些请求仍会交给你": "You still have pending requests (request id/message id: {requests}). The local service will deliver them to you so you can answer together. They are hand-backs, relay steps or reviews and cannot be closed by a proactive post; if you must speak now, add --force, and those requests will still be delivered to you",
|
|
289
|
+
"你还有待处理的请求(请求编号/消息编号:{requests}),本机服务会把它们交给你,届时一并回答;这次发言就是请求 {closable} 的回答时,用 --also-request 请求编号 一并关闭": "You still have pending requests (request id/message id: {requests}). The local service will deliver them to you so you can answer together. If this post is the answer to request {closable}, close it with --also-request REQUEST_ID",
|
|
290
|
+
"你还有待处理的请求(请求编号/消息编号:{requests}),不能主动发言;本机服务会把它们交给你,届时一并回答": "You still have pending requests (request id/message id: {requests}) and cannot post a proactive message. The local service will deliver them to you so you can answer together",
|
|
291
|
+
"force 只能由主持人使用,值为 true": "force may only be used by the host, with the value true",
|
|
292
|
+
"你还有待处理的请求(请求编号/消息编号:{requests}),不能主动发言;用 --request 关闭它们后回答": "You still have pending requests (request id/message id: {requests}) and cannot post a proactive message. Close them with --request when replying",
|
|
287
293
|
"依次接力不存在": "Relay not found",
|
|
288
294
|
"依次接力不能同时声明预授权评审;评审者直接排进顺序即可": "A relay cannot also declare a preauthorized review. Include the reviewer directly in the sequence",
|
|
289
295
|
"依次接力须用 to 按顺序点名至少两位不同成员,每位只出现一次": "A relay requires at least two distinct members named in order in to, each appearing once",
|
|
@@ -767,7 +773,6 @@
|
|
|
767
773
|
"正文已变化,请从头重读,不要与先前读到的片段拼接": "The text has changed; read it again from the start and do not join it with parts read earlier",
|
|
768
774
|
"该附件所在的消息超出本请求读取上界 #{until}": "The message this attachment belongs to is past this request's reading boundary #{until}",
|
|
769
775
|
"本请求只能读到 #{until},房间最新消息为 #{latest};之后的消息在独立观点阶段结束后才能读": "This request can read only up to #{until}; the room's latest message is #{latest}, and later messages can be read once the independent-opinion stage ends",
|
|
770
|
-
"主动发言不关联执行,不能一并交付排队请求(also_request_ids)": "A proactive post is bound to no execution, so it cannot deliver queued requests (also_request_ids)",
|
|
771
776
|
"用户已回答问题 #{question_id}(消息 #{message_id}),但依次派活 #{relay} 后面没有可接手的在场成员(或主持人已更换),接力已停下。请主持人决定接下来怎么做。": "The user answered question #{question_id} (message #{message_id}), but relay #{relay} has no member present to take the next step (or its host changed), so the relay stopped. Host: decide what comes next.",
|
|
772
777
|
"multiSelect 与 free_text 须为布尔值": "multiSelect and free_text must be booleans",
|
|
773
778
|
"header 须为最多 {limit} 字的短标签": "header must be a short label of at most {limit} characters",
|
|
@@ -216,6 +216,7 @@
|
|
|
216
216
|
"主持人答完后再请 {value1}": "Ask {value1} after the host replies",
|
|
217
217
|
"取消采纳": "Cancel acceptance",
|
|
218
218
|
"执行报告 #{value1}": "Run report #{value1}",
|
|
219
|
+
"正在统计文件改动…": "Counting file changes…",
|
|
219
220
|
"执行 #{value1} · {value2}": "Run #{value1} · {value2}",
|
|
220
221
|
"文件变化:{value1}": "File changes: {value1}",
|
|
221
222
|
"重发": "Resend",
|
package/gateway/gateway.mjs
CHANGED
|
@@ -347,6 +347,9 @@ async function read_form(request) {
|
|
|
347
347
|
function cross_origin(request) {
|
|
348
348
|
const origin = request.headers.origin;
|
|
349
349
|
if (!origin) return false;
|
|
350
|
+
// The instance's pages send no referrer, so their own forms post `Origin: null`; the browser still says it is the
|
|
351
|
+
// same site (#5688: signing out failed as "from another website").
|
|
352
|
+
if (origin === 'null' && request.headers['sec-fetch-site'] === 'same-origin') return false;
|
|
350
353
|
try { return new URL(origin).host !== request.headers.host; } catch { return true; }
|
|
351
354
|
}
|
|
352
355
|
|
|
@@ -437,17 +440,20 @@ export function create_gateway({ data, now = Date.now }) {
|
|
|
437
440
|
async function login(request, response) {
|
|
438
441
|
const form = await read_form(request);
|
|
439
442
|
const name = String(form.get('name') || '').trim().toLowerCase();
|
|
440
|
-
|
|
443
|
+
// Counted per name and source: a stranger who knows the name only locks themselves out, not the account (#5696).
|
|
444
|
+
const source = String(request.headers['cf-connecting-ip'] || request.socket.remoteAddress || 'unknown');
|
|
445
|
+
const failure_key = `${name}|${source}`;
|
|
446
|
+
const failed = failures.get(failure_key);
|
|
441
447
|
if (failed && failed.until > now()) return send(response, 429, { 'Content-Type': 'text/html; charset=utf-8' }, login_page({ action: LOGIN_PATH, refusal: 'locked', name }));
|
|
442
448
|
// One snapshot both checks the password and fixes the session to it: a reset made meanwhile by the panel leaves this
|
|
443
449
|
// session on the old version, so it never grants access.
|
|
444
450
|
const account = NAME_PATTERN.test(name) ? read_accounts(data)[name] : null;
|
|
445
451
|
if (!password_matches(account, form.get('password'))) {
|
|
446
452
|
const count = (failed?.count || 0) + 1;
|
|
447
|
-
if (NAME_PATTERN.test(name)) failures.set(
|
|
453
|
+
if (NAME_PATTERN.test(name)) failures.set(failure_key, { count, until: count >= MAX_FAILURES ? now() + LOCK_MS : 0 });
|
|
448
454
|
return send(response, 401, { 'Content-Type': 'text/html; charset=utf-8' }, login_page({ action: LOGIN_PATH, refusal: 'wrong', name }));
|
|
449
455
|
}
|
|
450
|
-
failures.delete(
|
|
456
|
+
failures.delete(failure_key);
|
|
451
457
|
if (account.disabled) return send(response, 403, { 'Content-Type': 'text/html; charset=utf-8' }, login_page({ action: LOGIN_PATH, refusal: 'disabled', name }));
|
|
452
458
|
const token = randomBytes(32).toString('hex');
|
|
453
459
|
sessions.set(token_key(token), { name, expires: now() + SESSION_SECONDS * 1000, hash: account.hash, version: session_version(account) });
|
|
@@ -467,10 +473,12 @@ export function create_gateway({ data, now = Date.now }) {
|
|
|
467
473
|
const account = account_of(request);
|
|
468
474
|
if (await direct(request, response, Boolean(account))) return;
|
|
469
475
|
// The site asks this to tell a page opened through the entry from one opened at the instance itself.
|
|
470
|
-
|
|
476
|
+
// It also names the account, so the site shows who is signed in when no display name was set (#5688).
|
|
477
|
+
if (path === SESSION_PATH && request.method === 'GET') return account ? send_json(response, 200, { signed_in: true, account: account.name }) : send_json(response, 401, { error: '请先登录', code: 'entry_login' });
|
|
471
478
|
if (account) return forward(request, response, account.port, { protected: account.protected === true, key: account.protected === true ? instance_key(data, account.name) : '' });
|
|
472
479
|
const page = request.method === 'GET' && String(request.headers.accept || '').includes('text/html');
|
|
473
|
-
|
|
480
|
+
// A page goes to the sign-in; the site's own requests are told so, and it goes there itself (#5688).
|
|
481
|
+
return page ? send(response, 302, { Location: LOGIN_PATH }) : send_json(response, 401, { error: '请先登录', code: 'entry_login' });
|
|
474
482
|
}
|
|
475
483
|
|
|
476
484
|
return http.createServer((request, response) => {
|
package/package.json
CHANGED
|
@@ -508,7 +508,7 @@ function window_state(pid, env = process.env) {
|
|
|
508
508
|
|
|
509
509
|
/**
|
|
510
510
|
* Follow a message posted into an open window through the session log, from `offset` on, until the turn that took it
|
|
511
|
-
* ends (`system/turn_duration
|
|
511
|
+
* ends (`system/turn_duration`, or the window's registry staying idle after the turn's last assistant message) or the window closes: report the API error that turn ended on as a failure, otherwise its
|
|
512
512
|
* end. For a room task it notes once when the window has not taken it by `unstarted_after`; an answer it never submitted
|
|
513
513
|
* then fails the execution. Given a `log_path`, it reports the turn's steps there and its texts as notes. It waits past a
|
|
514
514
|
* turn end while a background agent the turn launched has not reported. For a `chat` turn it waits also for every interjection `expect`ed, and fails with the reason when the window does not take the message in time,
|
|
@@ -524,7 +524,7 @@ export function watch_window_turn({ file, offset, pid, marker, session_id = '',
|
|
|
524
524
|
stop_poll = STOP_POLL_MS, stop_tool_wait = STOP_TOOL_WAIT_MS, stop_end_wait = STOP_END_WAIT_MS } = options;
|
|
525
525
|
const since = Date.now(), awaited = new Set([marker]), open_tools = new Set(), background = new Set();
|
|
526
526
|
let pending = Buffer.alloc(0), taken = false, noted = false, error = null, done = false, waiting_since = 0;
|
|
527
|
-
let stop_asked = 0, stop_sent = 0, stop_timer = null;
|
|
527
|
+
let stop_asked = 0, stop_sent = 0, stop_timer = null, last_message = null, idle_since = 0;
|
|
528
528
|
// `ended` says why a room task's turn ended without finishing (interrupted, window closed): it is an exit, not a
|
|
529
529
|
// failure to retry, and its last remark is not an answer.
|
|
530
530
|
const finish = (reason = '', ended = '') => {
|
|
@@ -539,7 +539,8 @@ export function watch_window_turn({ file, offset, pid, marker, session_id = '',
|
|
|
539
539
|
};
|
|
540
540
|
const tick = () => {
|
|
541
541
|
if (done) return;
|
|
542
|
-
|
|
542
|
+
const entries = read_appended();
|
|
543
|
+
for (const entry of entries) {
|
|
543
544
|
for (const item of awaited) if (takes(entry, item)) { awaited.delete(item); taken = true; }
|
|
544
545
|
if (!taken) continue;
|
|
545
546
|
if (entry.type === 'user' && INTERRUPTED.test(prompt_text(entry.message?.content).trim())) {
|
|
@@ -551,7 +552,21 @@ export function watch_window_turn({ file, offset, pid, marker, session_id = '',
|
|
|
551
552
|
if (!entry.isSidechain) { track_tools(entry); track_background(entry); }
|
|
552
553
|
// A turn that left a background agent running ends while the window waits for it; its report starts the next turn.
|
|
553
554
|
if (entry.type === 'system' && entry.subtype === 'turn_duration' && !awaited.size && !background.size) return finish();
|
|
555
|
+
// Only the turn's own messages count: bookkeeping entries (hook summaries, queue operations) may be stamped later.
|
|
556
|
+
if (!entry.isSidechain && ['assistant', 'user'].includes(entry.type) && entry.message) {
|
|
557
|
+
last_message = { type: entry.type, at: Date.parse(entry.timestamp) || 0 };
|
|
558
|
+
}
|
|
554
559
|
}
|
|
560
|
+
// Claude Code after 2.1.322 records no `turn_duration`: the window's registry (`status`, `updatedAt` in ms) going idle
|
|
561
|
+
// after the turn's last message ends it too. That message must be the assistant's (a tool result is always followed
|
|
562
|
+
// by one), an idle state older than it is the one before the window took the message, and the state must hold for
|
|
563
|
+
// one poll interval with nothing new in the log, so a message still being written or a brief idle state ends nothing.
|
|
564
|
+
// (Counted in time, not polls: a requested stop polls every `stop_poll`.)
|
|
565
|
+
const resting = taken && !awaited.size && !background.size && !open_tools.size && last_message?.type === 'assistant'
|
|
566
|
+
? window_state(pid, env) : null;
|
|
567
|
+
const idle = resting?.status === 'idle' && last_message.at > 0 && resting.updatedAt >= last_message.at;
|
|
568
|
+
if (!idle || entries.length) idle_since = idle ? Date.now() : 0;
|
|
569
|
+
else if (Date.now() - idle_since >= interval) return finish();
|
|
555
570
|
if (!process_alive(pid)) return chat ? finish('这位成员的 Claude 窗口在这轮私聊结束前关闭了') : finish('', '所在的原窗口在这一轮结束前关闭了');
|
|
556
571
|
if (stop_asked) return try_stop();
|
|
557
572
|
const elapsed = Date.now() - since;
|
|
@@ -653,6 +668,9 @@ export function watch_window_turn({ file, offset, pid, marker, session_id = '',
|
|
|
653
668
|
clearInterval(stop_timer);
|
|
654
669
|
stop_timer = null; stop_asked = 0; stop_sent = 0;
|
|
655
670
|
if (log_path) task.on_output?.(log_path, `${JSON.stringify({ type: 'codiscuss.stop', sent: false, reason })}\n`);
|
|
671
|
+
// Nothing is left to stop in a window that sits idle with no tool running: the turn is over even when the log shows
|
|
672
|
+
// no end the watch knows (a later Claude Code may record turns differently), so the member is not held busy for good.
|
|
673
|
+
if (taken && !open_tools.size && window_state(pid, env)?.status === 'idle') finish('', '停止时原窗口已空闲');
|
|
656
674
|
}
|
|
657
675
|
return {
|
|
658
676
|
get done() { return done; },
|
package/runner/admin_panel.mjs
CHANGED
|
@@ -844,6 +844,11 @@ export function create_panel({ data, key, port, ops = {}, sessions = new Set() }
|
|
|
844
844
|
const file = join(WEB, name);
|
|
845
845
|
if (!existsSync(file)) return send_json(response, 404, error_body(panel_error('页面尚未构建,请运行 npm run build')));
|
|
846
846
|
response.writeHead(200, { 'Content-Type': TYPES[extname(file)] || 'application/octet-stream', 'Cache-Control': 'no-store' });
|
|
847
|
+
// The page names its own version and asks for its scripts by version, so a page left open across an update
|
|
848
|
+
// can tell it is old and nothing cached is taken for the new one (user 2026-11-19, #5679).
|
|
849
|
+
if (name === 'admin.html') return response.end(readFileSync(file, 'utf8').replace('<head>', `<head>
|
|
850
|
+
<meta name="codiscuss-version" content="${VERSION}">`)
|
|
851
|
+
.replace(/(href|src)="\/(admin\.css|i18n\.js|admin\.js)"/g, `$1="/$2?v=${VERSION}"`));
|
|
847
852
|
response.end(readFileSync(file));
|
|
848
853
|
} catch (error) {
|
|
849
854
|
if (response.headersSent) response.destroy();
|
package/runner/discuss.py
CHANGED
|
@@ -271,7 +271,7 @@ def add_topic(parser, create=False):
|
|
|
271
271
|
|
|
272
272
|
# `message post` options only the host may use: plain `--help` folds them so a member sees what it can use (B6);
|
|
273
273
|
# `--help-host` and `schema` still show all of them.
|
|
274
|
-
HOST_POST_OPTIONS = ("--handoff", "--no-handoff", "--keep-working", "--continue", "--sequential", "--loop", "--checkpoint",
|
|
274
|
+
HOST_POST_OPTIONS = ("--handoff", "--no-handoff", "--keep-working", "--force", "--continue", "--sequential", "--loop", "--checkpoint",
|
|
275
275
|
"--repeat", "--wait-user", "--detach", "--with", "--need-rounds", "--rounds-reason", "--next-review",
|
|
276
276
|
"--review-scope", "--review-roster")
|
|
277
277
|
|
|
@@ -381,6 +381,8 @@ def message_commands(subcommands, registry):
|
|
|
381
381
|
"做完照常回答(沿用本次凭据),派出的工作结束时以通知交回你;不能与 --continue、--sequential、--next-review 同用")
|
|
382
382
|
post.add_argument("--proactive", action="store_true",
|
|
383
383
|
help="自由房间成员:不是房间派来的任务、而是你的用户在你自己的窗口里要你发言时用(主持人也可在需要主动说明、派活或补交失效执行的结果时自行使用);不关联执行或请求,有进行中的执行或讨论进行中不可用;主持人还可同时 --to 派活或 --continue,从这条消息起算新任务链")
|
|
384
|
+
post.add_argument("--force", action="store_true",
|
|
385
|
+
help="自由房间主持人:与 --proactive 同用,这次发言与等着你的请求无关、又必须现在说时用:还有待处理的请求也照样发言,这些请求不关闭,之后仍会交给你;发言就是某条普通请求的回答时改用 --also-request 关闭它")
|
|
384
386
|
post.add_argument("--continue", dest="continue_reason", metavar="REASON",
|
|
385
387
|
help="自由房间主持人:房间没有其他进行中的工作时再唤醒你一次,写明继续做什么(≤300 字);算本链一轮,用户发新消息或你下次回答不带它即取消")
|
|
386
388
|
post.add_argument("--sequential", action="store_true",
|
|
@@ -395,7 +397,7 @@ def message_commands(subcommands, registry):
|
|
|
395
397
|
help="与 --sequential 同用:MEMBER 所在那一棒结束后等用户回答问题,不交回你;MEMBER 用 question ask(contract=handoff)交候选并出题,"
|
|
396
398
|
"用户回答该问题后接着往下一棒走,写了 =START 则从 START 所在那一棒再来一圈(最后一棒之后须写 START),答案交给下一棒先读;普通聊天不推进;可重复")
|
|
397
399
|
post.add_argument("--also-request", dest="also_requests", type=positive_int, action="append", default=[], metavar="REQUEST",
|
|
398
|
-
help="执行中又排队给你的普通请求(execution view 的 queued_requests
|
|
400
|
+
help="执行中又排队给你的普通请求(execution view 的 queued_requests)与本次任务相关、这条回答已一并交付时,用它同时关闭;与 --proactive 同用时,关闭这次主动发言已回答的、还没交给你的普通请求(编号见被拒时的提示或 room view 的 free.requests);可重复")
|
|
399
401
|
post.add_argument("--detach", type=member_handle, action="append", default=[], metavar="MEMBER",
|
|
400
402
|
help="自由房间主持人:点名一位在后台工作、不等它的成员:不交回你、不占住房间(用户发消息不排队),也不计入交回或下一棒的等待;可单独用,也可与 --to 同用;它失败时程序通知你;可重复")
|
|
401
403
|
post.add_argument("--with", dest="to", type=member_handle, action=JoinPreviousStep, metavar="MEMBER",
|
|
@@ -858,8 +860,12 @@ def plan_message(args):
|
|
|
858
860
|
payload["handoff"] = True
|
|
859
861
|
if args.continue_reason is not None:
|
|
860
862
|
payload["continue"] = args.continue_reason
|
|
863
|
+
if args.force and not args.proactive:
|
|
864
|
+
raise CliError("--force 只与 --proactive 同用")
|
|
861
865
|
if args.proactive:
|
|
862
866
|
payload["proactive"] = True
|
|
867
|
+
if args.force:
|
|
868
|
+
payload["force"] = True
|
|
863
869
|
if args.no_handoff:
|
|
864
870
|
payload["no_handoff"] = True
|
|
865
871
|
if args.keep_working:
|
|
@@ -1153,7 +1153,7 @@ export async function room_member_access(home, raw) {
|
|
|
1153
1153
|
* its session. An empty value goes back to the software's default; an API member has no default model, so an empty
|
|
1154
1154
|
* model keeps its current one.
|
|
1155
1155
|
*/
|
|
1156
|
-
export async function room_member_model(home, raw) {
|
|
1156
|
+
export async function room_member_model(home, raw, headers = {}) {
|
|
1157
1157
|
const { input, path } = await member_room_context(home, raw);
|
|
1158
1158
|
const { name } = input;
|
|
1159
1159
|
const model = typeof input.model === 'string' ? input.model.trim() : '';
|
|
@@ -1177,22 +1177,23 @@ export async function room_member_model(home, raw) {
|
|
|
1177
1177
|
validate_config(updated, dirname(path));
|
|
1178
1178
|
atomic_json(path, updated);
|
|
1179
1179
|
const label = item => [item.model || '默认', item.effort].filter(Boolean).join(' · ');
|
|
1180
|
-
const recorded = label(profile) === label(next) ? null : await record_model_change(input, name, label(profile), label(next));
|
|
1180
|
+
const recorded = label(profile) === label(next) ? null : await record_model_change(input, name, label(profile), label(next), headers);
|
|
1181
1181
|
return { room_id: input.room_id, member: name, model: next.model || '', effort, ...(recorded ? { notice_id: recorded } : {}) };
|
|
1182
1182
|
} finally { release(); }
|
|
1183
1183
|
}
|
|
1184
1184
|
|
|
1185
1185
|
/**
|
|
1186
1186
|
* Leave the room a system record of a model change (COVERAGE 9); the change is already saved, so a failed record only
|
|
1187
|
-
* leaves it unrecorded and is said in the log, never undone.
|
|
1187
|
+
* leaves it unrecorded and is said in the log, never undone. `headers` are host-control's, by which the site names the
|
|
1188
|
+
* host as the one who changed it.
|
|
1188
1189
|
*/
|
|
1189
|
-
async function record_model_change(input, name, from, to) {
|
|
1190
|
+
async function record_model_change(input, name, from, to, headers = {}) {
|
|
1190
1191
|
try {
|
|
1191
1192
|
const room = await site_request(input.site, `/api/rooms/${input.room_id}`, input.token);
|
|
1192
1193
|
const member = (room.free?.members || room.members || []).find(item => item.name === name);
|
|
1193
1194
|
if (!member) return null;
|
|
1194
1195
|
return (await site_request(input.site, `/api/rooms/${input.room_id}/members/${member.id}`, input.token,
|
|
1195
|
-
{ action: 'model_changed', from, to })).message_id || null;
|
|
1196
|
+
{ action: 'model_changed', from, to }, headers)).message_id || null;
|
|
1196
1197
|
} catch (error) {
|
|
1197
1198
|
console.error(`换模型已保存,但房间记录未写入:${error.message}`);
|
|
1198
1199
|
return null;
|
|
@@ -2193,7 +2194,7 @@ const HOST_CONTROLS = {
|
|
|
2193
2194
|
},
|
|
2194
2195
|
back: (ctx, o) => room_member(ctx.home, { ...ctx.owner, action: 'rejoin', name: host_target(ctx, o.member).name }, false, ctx.headers),
|
|
2195
2196
|
model: (ctx, o) => o.list ? host_model_list(ctx, o)
|
|
2196
|
-
: room_member_model(ctx.home, { ...ctx.owner, name: host_target(ctx, o.member, { self: true }).name, model: o.model || '', effort: o.effort || '' }),
|
|
2197
|
+
: room_member_model(ctx.home, { ...ctx.owner, name: host_target(ctx, o.member, { self: true }).name, model: o.model || '', effort: o.effort || '' }, ctx.headers),
|
|
2197
2198
|
access: (ctx, o) => {
|
|
2198
2199
|
if (!HOST_CARD_ACCESS.includes(o.access)) throw new Error('主持人只能把成员的项目权限设为 read 或 write');
|
|
2199
2200
|
return room_member_access(ctx.home, { ...ctx.owner, name: host_target(ctx, o.member).name, project_access: o.access });
|
package/runner/file_diff.mjs
CHANGED
|
@@ -20,10 +20,14 @@ const GIT_TIMEOUT_MS = 15_000;
|
|
|
20
20
|
|
|
21
21
|
/** A file's text, or a marker why it has no lines: missing, too large, or binary. */
|
|
22
22
|
function read_text(file) {
|
|
23
|
-
let
|
|
24
|
-
try {
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
let stat;
|
|
24
|
+
try { stat = statSync(file); } catch { return { missing: true }; }
|
|
25
|
+
// Git lists a changed submodule by its directory; like anything else that is not a readable file it has no line diff
|
|
26
|
+
// (reading it threw EISDIR, which failed every delivery in a project with a modified submodule, 2026-11-19 #5719).
|
|
27
|
+
if (!stat.isFile()) return { skipped: 'binary' };
|
|
28
|
+
if (stat.size > MAX_DIFF_BYTES) return { skipped: 'large' };
|
|
29
|
+
let bytes;
|
|
30
|
+
try { bytes = readFileSync(file); } catch { return { skipped: 'binary' }; }
|
|
27
31
|
return bytes.includes(0) ? { skipped: 'binary' } : { text: bytes.toString('utf8') };
|
|
28
32
|
}
|
|
29
33
|
|
package/runner/free_runner.mjs
CHANGED
|
@@ -1575,11 +1575,18 @@ export class FreeRoomRunner {
|
|
|
1575
1575
|
return false;
|
|
1576
1576
|
}
|
|
1577
1577
|
}
|
|
1578
|
-
/**
|
|
1578
|
+
/**
|
|
1579
|
+
* Report observed file changes once an execution has ended. Its software is often still closing its turn then (the
|
|
1580
|
+
* answer is posted from inside it), so what has changed so far is reported at once as provisional, for the answer's
|
|
1581
|
+
* card to list without the wait (user 2026-11-19, #5669); the report after its processes have exited replaces it.
|
|
1582
|
+
*/
|
|
1579
1583
|
async report_finished(active) {
|
|
1580
1584
|
for (const [execution_id, snapshot] of this.snapshots) {
|
|
1581
|
-
if (active.has(execution_id)
|
|
1582
|
-
this.
|
|
1585
|
+
if (active.has(execution_id)) continue;
|
|
1586
|
+
const running = this.execution_processes.get(execution_id)?.size > 0;
|
|
1587
|
+
if (running && snapshot.reported_early) continue;
|
|
1588
|
+
if (running) snapshot.reported_early = true;
|
|
1589
|
+
else this.snapshots.delete(execution_id);
|
|
1583
1590
|
const after = snapshot.before ? workspace_snapshot(snapshot.directory) : null;
|
|
1584
1591
|
if (!after && !snapshot.extras?.length) continue;
|
|
1585
1592
|
const extra = (snapshot.extras || []).flatMap(item => {
|
|
@@ -1593,7 +1600,7 @@ export class FreeRoomRunner {
|
|
|
1593
1600
|
// Line counts and patches of the files in the member's own working tree, for the card's "edited N files".
|
|
1594
1601
|
let diffs = [];
|
|
1595
1602
|
try { diffs = file_diffs(snapshot.directory, own.slice(0, 200), snapshot.base); } catch { /* The card then lists names only. */ }
|
|
1596
|
-
try { await api(this.config, `/executions/${execution_id}`, { action: 'report', changes, ...edited, ...(diffs.length ? { diffs } : {}) }); }
|
|
1603
|
+
try { await api(this.config, `/executions/${execution_id}`, { action: 'report', ...(running ? { provisional: true } : {}), changes, ...edited, ...(diffs.length ? { diffs } : {}) }); }
|
|
1597
1604
|
catch (error) { if (!/HTTP (404|409)/.test(error.message)) throw error; }
|
|
1598
1605
|
}
|
|
1599
1606
|
}
|