ai_co_discuss 0.4.92 → 0.4.93
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/backend/free_room.py +7 -5
- package/backend/schema.sql +2 -0
- package/frontend/locales/en/admin.json +2 -1
- package/frontend/locales/en/discussion.json +1 -0
- package/package.json +1 -1
- package/runner/admin_panel.mjs +5 -0
- package/runner/free_runner.mjs +11 -4
- package/web/admin.css +1 -1
- package/web/admin.js +1 -1
- package/web/i18n.js +2 -2
- package/web/modern.css +1 -1
- package/web/modern.js +3 -3
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",
|
|
@@ -3488,12 +3488,14 @@ def execution_action(connection, room_id, execution_id, token, payload, member=N
|
|
|
3488
3488
|
raise PermissionError(Text("只能报告自己执行的失败") if action == "fail" else Text("执行编号不属于本成员"))
|
|
3489
3489
|
now = int(time.time())
|
|
3490
3490
|
if action == "report":
|
|
3491
|
-
# Observed after the process ends, so the execution may already be complete; recorded once.
|
|
3492
|
-
|
|
3491
|
+
# Observed after the process ends, so the execution may already be complete; recorded once. A provisional report
|
|
3492
|
+
# (what had changed when the answer arrived, the software still closing its turn) is replaced by that final one.
|
|
3493
|
+
provisional = payload.get("provisional") is True
|
|
3494
|
+
if row["changes"] and (provisional or not row["changes_provisional"]):
|
|
3493
3495
|
raise FileExistsError(Text("本次执行的改动已记录"))
|
|
3494
3496
|
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))
|
|
3497
|
+
connection.execute("UPDATE member_executions SET changes=?,edited=?,diffs=?,changes_provisional=? WHERE id=?",
|
|
3498
|
+
(json.dumps(changes, ensure_ascii=False), edited_files(payload, changes), file_diffs(payload, changes), int(provisional), execution_id))
|
|
3497
3499
|
elif action == "denials":
|
|
3498
3500
|
# Like file changes, read from the software's output once its process ends; recorded once.
|
|
3499
3501
|
saved = connection.execute("INSERT OR IGNORE INTO execution_denials (execution_id,room_id,denials) VALUES (?,?,?)",
|
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 '',
|
|
@@ -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
|
}
|
|
@@ -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/package.json
CHANGED
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/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
|
}
|