ai_co_discuss 0.4.61 → 0.4.63
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 +8 -2
- package/backend/schema.sql +7 -0
- package/docs/en/workflow.md +1 -1
- package/docs/workflow.md +1 -1
- package/frontend/locales/en/room.json +2 -1
- package/package.json +1 -1
- package/runner/adapters/antigravity_cli.mjs +90 -4
- package/runner/adapters/common.mjs +5 -1
- package/runner/adapters/profiles.mjs +3 -2
- package/runner/discussion_launch.mjs +5 -2
- package/runner/relay_channel.mjs +21 -3
- package/web/app.js +51 -6
- package/web/backup.js +1 -1
- package/web/i18n.js +1 -1
- package/web/modern.css +1 -1
- package/web/modern.js +42 -40
package/backend/free_room.py
CHANGED
|
@@ -937,8 +937,11 @@ def recent_executions(connection, room_id, span=None):
|
|
|
937
937
|
query = f"""SELECT e.*,m.name AS member,
|
|
938
938
|
(SELECT json_group_array(id) FROM member_requests WHERE execution_id=e.id) AS request_ids,
|
|
939
939
|
(SELECT MAX(answer_id) FROM member_requests WHERE execution_id=e.id) AS answer_id,
|
|
940
|
-
(SELECT MIN(message_id) FROM member_requests WHERE execution_id=e.id
|
|
941
|
-
|
|
940
|
+
(SELECT MIN(message_id) FROM member_requests WHERE execution_id=e.id
|
|
941
|
+
OR id IN (SELECT request_id FROM retried_requests WHERE execution_id=e.id)) AS request_message_id,
|
|
942
|
+
(SELECT MIN({LAYOUT_AFTER_SQL}) FROM member_requests r WHERE r.execution_id=e.id
|
|
943
|
+
OR r.id IN (SELECT request_id FROM retried_requests WHERE execution_id=e.id)) AS layout_after,
|
|
944
|
+
EXISTS(SELECT 1 FROM retried_requests WHERE execution_id=e.id) AS retried,
|
|
942
945
|
(SELECT MIN({LAYOUT_AT_SQL}) FROM member_requests r WHERE r.execution_id=e.id) AS layout_at,
|
|
943
946
|
(SELECT COUNT(*) FROM execution_notes WHERE execution_id=e.id) AS note_count,
|
|
944
947
|
(SELECT denials FROM execution_denials WHERE execution_id=e.id) AS denials,{CAPABILITY_COLUMNS},
|
|
@@ -963,6 +966,7 @@ def recent_executions(connection, room_id, span=None):
|
|
|
963
966
|
"notes": row["note_count"], "denials": json.loads(row["denials"] or "[]"),
|
|
964
967
|
"capabilities": reported_capabilities(row), "stop_result": row["stop_result"] or "",
|
|
965
968
|
"late_answer": json.loads(row["late_answer"]) if row["late_answer"] else None, "background": bool(row["background"]),
|
|
969
|
+
"retried": bool(row["retried"]),
|
|
966
970
|
"interjections": execution_interjections(connection, row["id"], row["status"]),
|
|
967
971
|
"retry": execution_retry(connection, row["id"])})
|
|
968
972
|
return executions
|
|
@@ -3496,6 +3500,8 @@ def retry_failed(connection, room_id, execution):
|
|
|
3496
3500
|
raise FileExistsError(Text("这次执行没有可重试的请求:已重试过,或是讨论发言(由主持人重新安排)"))
|
|
3497
3501
|
if not connection.execute("SELECT 1 FROM room_members WHERE id=? AND status='active'", (execution["member_id"],)).fetchone():
|
|
3498
3502
|
raise FileExistsError(Text("该成员已离开或暂离,无法重试"))
|
|
3503
|
+
connection.executemany("INSERT OR IGNORE INTO retried_requests (execution_id,request_id) VALUES (?,?)",
|
|
3504
|
+
[(execution["id"], request["id"]) for request in requests])
|
|
3499
3505
|
connection.execute(f"UPDATE member_requests SET status='pending',execution_id=NULL WHERE id IN ({','.join('?' * len(requests))})",
|
|
3500
3506
|
[request["id"] for request in requests])
|
|
3501
3507
|
reopen_batches(connection, room_id, requests)
|
package/backend/schema.sql
CHANGED
|
@@ -350,6 +350,13 @@ CREATE TABLE IF NOT EXISTS execution_failures (
|
|
|
350
350
|
failed_at INTEGER NOT NULL,
|
|
351
351
|
reset_at INTEGER NOT NULL DEFAULT 0
|
|
352
352
|
);
|
|
353
|
+
-- The requests a failed execution carried before the owner retried it: the failed card keeps its place under their
|
|
354
|
+
-- message, and the retry's card follows it there. Not part of backups.
|
|
355
|
+
CREATE TABLE IF NOT EXISTS retried_requests (
|
|
356
|
+
execution_id INTEGER NOT NULL REFERENCES member_executions(id) ON DELETE CASCADE,
|
|
357
|
+
request_id INTEGER NOT NULL REFERENCES member_requests(id) ON DELETE CASCADE,
|
|
358
|
+
PRIMARY KEY (execution_id, request_id)
|
|
359
|
+
);
|
|
353
360
|
CREATE TABLE IF NOT EXISTS execution_retries (
|
|
354
361
|
execution_id INTEGER PRIMARY KEY REFERENCES member_executions(id) ON DELETE CASCADE,
|
|
355
362
|
room_id TEXT NOT NULL REFERENCES rooms(id) ON DELETE CASCADE,
|
package/docs/en/workflow.md
CHANGED
|
@@ -90,7 +90,7 @@ From the member panel you can:
|
|
|
90
90
|
|
|
91
91
|
- **Invite** members. A member card offers three ways to start:
|
|
92
92
|
- **Automatic start**: this computer starts a new, empty session.
|
|
93
|
-
- **History** (Claude Code, Codex): opens a window listing that software's past sessions by time, like `claude -r` or Codex's `/resume`. Search it, show this project's sessions or all of them, and preview the latest messages of the selected one. The program then resumes the picked session in the background, so it joins with the context it already has. While it is working, do not keep using it in its original window.
|
|
93
|
+
- **History** (Claude Code, Codex, Antigravity CLI): opens a window listing that software's past sessions by time, like `claude -r` or Codex's `/resume`. Search it, show this project's sessions or all of them, and preview the latest messages of the selected one. The program then resumes the picked session in the background, so it joins with the context it already has. While it is working, do not keep using it in its original window. An Antigravity CLI session keeps its own project and agy permissions; the room's project access does not apply to it.
|
|
94
94
|
- **Manual start**: run the start instruction in a conversation you already have open; room tasks are then delivered into that window where possible.
|
|
95
95
|
|
|
96
96
|
Experts invited during a discussion join the end of the current round.
|
package/docs/workflow.md
CHANGED
|
@@ -92,7 +92,7 @@ Goal 不扩大权限:主持人仍受成员项目权限和连续派活轮数限
|
|
|
92
92
|
|
|
93
93
|
- **邀请**成员。成员卡上有三种启动方式:
|
|
94
94
|
- **程序启动**:由本机新建一个空白会话。
|
|
95
|
-
- **历史会话**(Claude Code、Codex):弹出该软件的历史会话窗口,像 `claude -r`、Codex 的 `/resume` 那样按时间列出会话,可搜索、只看本项目或全部,右侧预览选中会话最近的对话;选定后由程序在后台续接这个会话,它带着已有上下文加入。它工作时不要在原窗口继续操作。
|
|
95
|
+
- **历史会话**(Claude Code、Codex、Antigravity CLI):弹出该软件的历史会话窗口,像 `claude -r`、Codex 的 `/resume` 那样按时间列出会话,可搜索、只看本项目或全部,右侧预览选中会话最近的对话;选定后由程序在后台续接这个会话,它带着已有上下文加入。它工作时不要在原窗口继续操作。Antigravity CLI 的会话沿用它原来的项目与 agy 权限,房间的项目权限对它不生效。
|
|
96
96
|
- **手动启动**:在你已打开的对话里执行启动指令注册,之后房间的任务会尽量送进那个窗口。
|
|
97
97
|
|
|
98
98
|
讨论中新邀请的专家排在本轮队尾。
|
|
@@ -749,5 +749,6 @@
|
|
|
749
749
|
"在左侧选择一个会话查看预览。": "Select a session on the left to preview it.",
|
|
750
750
|
"接入此会话": "Resume this session",
|
|
751
751
|
"额度已用尽,预计 {value1} 恢复;给它发新消息会立即再试": "Out of quota, expected back at {value1}; a new message to it is tried at once",
|
|
752
|
-
"保存(Enter)": "Save (Enter)"
|
|
752
|
+
"保存(Enter)": "Save (Enter)",
|
|
753
|
+
"已重试,新的执行接在下方": "Retried; the new run follows below"
|
|
753
754
|
}
|
package/package.json
CHANGED
|
@@ -4,20 +4,22 @@
|
|
|
4
4
|
* Sessions are conversation databases, branched by copying them (not an official interface; tested on agy 1.4.9).
|
|
5
5
|
*/
|
|
6
6
|
import { createHash, randomUUID } from 'node:crypto';
|
|
7
|
-
import { closeSync, copyFileSync, existsSync, mkdirSync, openSync, readFileSync, readdirSync, readSync, rmSync } from 'node:fs';
|
|
7
|
+
import { closeSync, copyFileSync, existsSync, mkdirSync, openSync, readFileSync, readdirSync, readSync, rmSync, statSync } from 'node:fs';
|
|
8
8
|
import { homedir } from 'node:os';
|
|
9
9
|
import { dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
10
10
|
import { fileURLToPath } from 'node:url';
|
|
11
11
|
import { DatabaseSync } from 'node:sqlite';
|
|
12
12
|
import { atomic_json } from '../files.mjs';
|
|
13
13
|
import { cli_delivery } from './cli.mjs';
|
|
14
|
-
import { DENIAL_FIELD, EDIT_TOOLS, json_line, launch_directory, MAX_DENIALS, model_entry, MODEL_PATTERN, not_sent, project_directory,
|
|
15
|
-
query_catalog, read_json, same_path, TASK_SUBCOMMANDS } from './common.mjs';
|
|
14
|
+
import { DENIAL_FIELD, EDIT_TOOLS, json_line, launch_directory, MAX_DENIALS, model_entry, MODEL_PATTERN, not_sent, page_sessions, project_directory,
|
|
15
|
+
prompt_title, query_catalog, read_json, same_path, TASK_SUBCOMMANDS, trim_preview } from './common.mjs';
|
|
16
16
|
|
|
17
17
|
// agy stores its generation settings as protobuf; field 28 (tag bytes 0xe2 0x01) holds the model actually used.
|
|
18
18
|
const AGY_MODEL_TAG = [0xe2, 0x01];
|
|
19
19
|
const AGY_OUTSIDE_PROJECT = 'outside-of-project';
|
|
20
20
|
const SKILL_HEADER_BYTES = 64 * 1024;
|
|
21
|
+
// A preview reads at most this many prompt and reply steps from the end of a conversation.
|
|
22
|
+
const PREVIEW_STEP_LIMIT = 200;
|
|
21
23
|
|
|
22
24
|
/**
|
|
23
25
|
* One operation a headless agy run refused, from the failed tool step, with the project grant that would allow it.
|
|
@@ -388,6 +390,89 @@ export function session_exists(session_id, { env = process.env, home = homedir()
|
|
|
388
390
|
return Boolean(session_id && session_path(session_id, env, home));
|
|
389
391
|
}
|
|
390
392
|
|
|
393
|
+
/** Each field of one protobuf message as `[field, value]`: a number for a varint, bytes for a length-delimited value. */
|
|
394
|
+
function* proto_fields(bytes) {
|
|
395
|
+
let at = 0;
|
|
396
|
+
const varint = () => {
|
|
397
|
+
let value = 0, scale = 1, byte;
|
|
398
|
+
do { byte = bytes[at++]; value += (byte & 127) * scale; scale *= 128; } while (byte & 128 && at < bytes.length);
|
|
399
|
+
return value;
|
|
400
|
+
};
|
|
401
|
+
while (at < bytes.length) {
|
|
402
|
+
const key = varint(), wire = key % 8, field = Math.floor(key / 8);
|
|
403
|
+
if (wire === 0) yield [field, varint()];
|
|
404
|
+
else if (wire === 1) at += 8;
|
|
405
|
+
else if (wire === 5) at += 4;
|
|
406
|
+
else if (wire === 2) { const length = varint(); yield [field, bytes.subarray(at, at + length)]; at += length; }
|
|
407
|
+
else return;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/** The first value at a field path through nested protobuf messages, or null. */
|
|
412
|
+
function proto_value(bytes, ...path) {
|
|
413
|
+
let value = bytes;
|
|
414
|
+
for (const wanted of path) {
|
|
415
|
+
if (!(value instanceof Uint8Array)) return null;
|
|
416
|
+
let found = null;
|
|
417
|
+
for (const [field, item] of proto_fields(value)) if (field === wanted) { found = item; break; }
|
|
418
|
+
if (found === null) return null;
|
|
419
|
+
value = found;
|
|
420
|
+
}
|
|
421
|
+
return value;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* The conversations the owner started in agy, from agy's own index (`conversation_summaries.db`, read on agy 1.5.9; not an
|
|
426
|
+
* official interface): only top-level CLI ones whose database is still here. Those this tool made for room members sit in
|
|
427
|
+
* the hidden `outside-of-project` and are left out: their directories are not recorded, and resumed they would lose
|
|
428
|
+
* the room rules they were made with.
|
|
429
|
+
*/
|
|
430
|
+
function agy_conversations(home) {
|
|
431
|
+
const root = join(home, '.gemini', 'antigravity-cli');
|
|
432
|
+
const index = join(root, 'conversation_summaries.db');
|
|
433
|
+
if (!existsSync(index)) return [];
|
|
434
|
+
const db = new DatabaseSync(index, { readOnly: true });
|
|
435
|
+
let rows;
|
|
436
|
+
try {
|
|
437
|
+
rows = db.prepare(`SELECT conversation_id id, title, preview, workspace_uris workspaces FROM conversation_summaries
|
|
438
|
+
WHERE app_data_dir='antigravity-cli' AND nesting_depth=0 AND parent_conversation_id='' AND agent_name='' AND project_id!=?`).all(AGY_OUTSIDE_PROJECT);
|
|
439
|
+
} finally { db.close(); }
|
|
440
|
+
const conversations = [];
|
|
441
|
+
for (const row of rows) {
|
|
442
|
+
const file = join(root, 'conversations', `${row.id}.db`);
|
|
443
|
+
let info, cwd = '';
|
|
444
|
+
try { info = statSync(file); } catch { continue; }
|
|
445
|
+
// agy lists the conversation's folders in name order without marking where it started; the first stands for it.
|
|
446
|
+
try { cwd = fileURLToPath(JSON.parse(row.workspaces)[0] || ''); } catch { /* No folder recorded. */ }
|
|
447
|
+
conversations.push({ file, id: row.id, title: prompt_title(row.title || row.preview), cwd, updated_at: info.mtime.toISOString(), size: info.size });
|
|
448
|
+
}
|
|
449
|
+
return conversations.sort((left, right) => right.updated_at.localeCompare(left.updated_at));
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/** One page of the owner's agy conversations, newest first; `cwd` keeps one directory's. */
|
|
453
|
+
function list_sessions({ cwd = '', env = process.env, home = homedir(), ...page } = {}) {
|
|
454
|
+
const accept = found => (!cwd || same_path(found, cwd)) && (!page.accept || page.accept(found));
|
|
455
|
+
return page_sessions(agy_conversations(home), ({ file, ...conversation }) => conversation, { ...page, accept });
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/** The last prompts and replies of one agy conversation: user input steps (type 14) and agent replies (type 15). */
|
|
459
|
+
function preview_session(session_id, { env = process.env, home = homedir() } = {}) {
|
|
460
|
+
const found = agy_conversations(home).find(conversation => conversation.id === session_id);
|
|
461
|
+
if (!found) throw new Error(`本机找不到可续接的 agy 会话 ${session_id}`);
|
|
462
|
+
const db = new DatabaseSync(found.file, { readOnly: true });
|
|
463
|
+
let rows;
|
|
464
|
+
try { rows = db.prepare('SELECT step_type,step_payload FROM steps WHERE step_type IN (14,15) ORDER BY idx DESC LIMIT ?').all(PREVIEW_STEP_LIMIT); }
|
|
465
|
+
finally { db.close(); }
|
|
466
|
+
const messages = rows.reverse().map(({ step_type, step_payload }) => {
|
|
467
|
+
const payload = Buffer.from(step_payload || []);
|
|
468
|
+
const text = Buffer.from(proto_value(payload, ...(step_type === 14 ? [19, 2] : [20, 1])) || []).toString('utf8').trim();
|
|
469
|
+
const seconds = proto_value(payload, 5, 1, 1);
|
|
470
|
+
return text ? { role: step_type === 14 ? 'user' : 'assistant', text, at: typeof seconds === 'number' ? new Date(seconds * 1000).toISOString() : '' } : null;
|
|
471
|
+
}).filter(Boolean);
|
|
472
|
+
const { file, ...described } = found;
|
|
473
|
+
return { ...described, ...trim_preview(messages, rows.length === PREVIEW_STEP_LIMIT) };
|
|
474
|
+
}
|
|
475
|
+
|
|
391
476
|
/** Copy the conversation database under a new ID, without the steps from the first marked one on. */
|
|
392
477
|
function branch(profile, session_id, markers, { always, home }) {
|
|
393
478
|
const file = session_path(session_id, process.env, home);
|
|
@@ -574,7 +659,8 @@ export const antigravity_cli = {
|
|
|
574
659
|
cleanup: remove_agy_projects, sweep: sweep_legacy_agy_projects,
|
|
575
660
|
deliver,
|
|
576
661
|
invocation, lifecycle, events, failure_class: agy_failure_class,
|
|
577
|
-
session: { path: session_path, exists: session_exists, owns: session_exists, branch, settings: session_settings
|
|
662
|
+
session: { path: session_path, exists: session_exists, owns: session_exists, branch, settings: session_settings,
|
|
663
|
+
list: list_sessions, preview: preview_session },
|
|
578
664
|
models: { list: models, effort, defaults, defaults_stamp },
|
|
579
665
|
skills: agy_skills,
|
|
580
666
|
};
|
|
@@ -228,7 +228,11 @@ export function preview_messages(file, message) {
|
|
|
228
228
|
partial = length < size;
|
|
229
229
|
entries = range_entries(fd, size - length, length);
|
|
230
230
|
} finally { closeSync(fd); }
|
|
231
|
-
|
|
231
|
+
return trim_preview(entries.map(message).filter(Boolean), partial);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** The last preview messages, each cut to a readable length; `partial` says earlier ones were not read at all. */
|
|
235
|
+
export function trim_preview(messages, partial = false) {
|
|
232
236
|
return { truncated: partial || messages.length > PREVIEW_MESSAGES, messages: messages.slice(-PREVIEW_MESSAGES).map(item => item.text.length > PREVIEW_TEXT_LIMIT
|
|
233
237
|
? { ...item, text: item.text.slice(0, PREVIEW_TEXT_LIMIT), cut: true } : item) };
|
|
234
238
|
}
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
* away from its original window).
|
|
24
24
|
* `resume_command(session_id)`: a command the owner can copy to reopen a restored manual conversation.
|
|
25
25
|
* `browse_sessions`: its stored conversations can be listed and previewed on this machine, so the owner picks the one a
|
|
26
|
-
* new member resumes from a browsing window instead of typing its ID
|
|
26
|
+
* new member resumes from a browsing window instead of typing its ID; a picked conversation may be bound even without
|
|
27
|
+
* `host_existing`.
|
|
27
28
|
* - `defaults_by_query`: its default model is read by running it (seconds), so a quick read leaves it for later.
|
|
28
29
|
* - `capabilities`: `delivery` `{stoppable, progress}` of a usual delivery (each delivery reports its own); `rewind`: `cut`
|
|
29
30
|
* (the runner cuts the session), `fresh` (context rebuilt each time) or `kept` (cannot be cut here); `project` (works in
|
|
@@ -107,7 +108,7 @@ export const ADAPTER_PROFILES = {
|
|
|
107
108
|
full: '跳过全部权限确认(--dangerously-skip-permissions),并放开沙箱外命令与 MCP 工具' },
|
|
108
109
|
unsupported_hints: { auto: 'agy 只在交互窗口提供自动模式,后台运行(-p)不支持' },
|
|
109
110
|
// Only a conversation this tool created gets its session rules; an existing one keeps its own project and permissions.
|
|
110
|
-
client: 'antigravity', adopt: 'session', host_existing: false, own_project_when_bound: true,
|
|
111
|
+
client: 'antigravity', adopt: 'session', host_existing: false, own_project_when_bound: true, browse_sessions: true,
|
|
111
112
|
capabilities: { delivery: PROCESS, rewind: 'cut', project: true, access_env: true, chat: true, capture: FINAL_REMARK },
|
|
112
113
|
// A read-only agy session allows only codiscuss commands and headless agy ends the turn on a denied one; agy streams no
|
|
113
114
|
// thinking text, so without a word at each turning point the page cannot show how far it got.
|
|
@@ -899,8 +899,11 @@ export function participant_profile(name, defaults, input, current_host) {
|
|
|
899
899
|
const cwd = profile.cwd || input.cwd;
|
|
900
900
|
if (cwd && (!existsSync(cwd) || !statSync(cwd).isDirectory())) throw new Error(`${name}:工作目录不存在或不是文件夹,请核对本次目录配置`);
|
|
901
901
|
if (input.entry === 'conversation' && current_host) profile.session_id = input.current_session_id;
|
|
902
|
-
// A new agy conversation always gets this tool's discussion project;
|
|
903
|
-
|
|
902
|
+
// A new agy conversation always gets this tool's discussion project; a manual agy expert the owner chose to host
|
|
903
|
+
// (input.adopt) or a stored conversation the owner picked keeps its own. Hosting from the very conversation that is
|
|
904
|
+
// running stays refused: its open window would overwrite the turns run from outside.
|
|
905
|
+
const picked = facts?.browse_sessions && !(input.entry === 'conversation' && current_host);
|
|
906
|
+
if (!facts?.host_existing && profile.session_id && !input.adopt && !picked) throw new Error(`${name}:${facts?.label || profile.adapter} 不能绑定已有会话或从当前对话主持全自动讨论;请从网页或其他软件发起,它会由讨论服务新建会话`);
|
|
904
907
|
return profile;
|
|
905
908
|
}
|
|
906
909
|
|
package/runner/relay_channel.mjs
CHANGED
|
@@ -33,6 +33,13 @@ const EVENT_RETRY_MS = 3000;
|
|
|
33
33
|
const SLOW_REQUEST_MS = 3000;
|
|
34
34
|
// A WebSocket frame on the website is at most 1 MiB; leave room for the envelope around the ciphertext.
|
|
35
35
|
const RESPONSE_MAX_BYTES = 700 * 1024;
|
|
36
|
+
// The website closes the whole connection on a frame over 1 MiB, failing every request on it; a larger answer is
|
|
37
|
+
// replaced by an error so only that request fails.
|
|
38
|
+
const FRAME_MAX_BYTES = 1024 * 1024 - 1024;
|
|
39
|
+
// Diagnostics: answers left unsent beyond this are written to the service log, at most once a minute; a connection
|
|
40
|
+
// filled with large answers (images) holds back every other answer and the heartbeat behind them.
|
|
41
|
+
const BACKLOG_LOG_BYTES = 4 * 1024 * 1024;
|
|
42
|
+
const BACKLOG_LOG_MS = 60000;
|
|
36
43
|
const ROOM_API_PATH = /^\/api\/(rooms|folders|revisions)(\/[A-Za-z0-9_.~-]+)*(\?[A-Za-z0-9_.~%=&,:+-]*)?$/;
|
|
37
44
|
// Attachment uploads arrive in parts and are sent to the local website whole, as one browser upload would be.
|
|
38
45
|
const UPLOAD_PATH = /^\/api\/rooms\/[A-Za-z0-9_-]+\/attachments(\/[A-Za-z0-9_-]+\/import)?(\?[A-Za-z0-9_.~%=&,:+-]*)?$/;
|
|
@@ -212,7 +219,11 @@ export async function answer_request(home, site, link, frame, { run = run_launch
|
|
|
212
219
|
}
|
|
213
220
|
// Only what kind of request it was and how it ended: never its content or query.
|
|
214
221
|
report?.({ action: request.action, route: typeof request.payload?.path === 'string' ? request.payload.path.split('?')[0] : '', status: response.status });
|
|
215
|
-
|
|
222
|
+
const answer = { type: 'response', id, envelope: await seal_compressed(key, response, `${id}:response`) };
|
|
223
|
+
if (JSON.stringify(answer).length <= FRAME_MAX_BYTES) return answer;
|
|
224
|
+
report?.({ action: request.action, route: typeof request.payload?.path === 'string' ? request.payload.path.split('?')[0] : '', status: 413 });
|
|
225
|
+
return { type: 'response', id, oversized: true,
|
|
226
|
+
envelope: await seal_compressed(key, { status: 413, body: { error: '回应超过中转单帧上限,未能送出' } }, `${id}:response`) };
|
|
216
227
|
}
|
|
217
228
|
|
|
218
229
|
/** Pass the local website's change notices to the devices while the relay is connected. */
|
|
@@ -327,7 +338,7 @@ async function hold_channel(home, site, { connected, log, signal }) {
|
|
|
327
338
|
};
|
|
328
339
|
// Only a pong proves both directions work: requests can keep arriving while this computer's answers are stuck.
|
|
329
340
|
// A website that never answers pings is not judged by them.
|
|
330
|
-
let opened = false, awaiting_pong = false, pong_seen = false;
|
|
341
|
+
let opened = false, awaiting_pong = false, pong_seen = false, backlog_logged = 0;
|
|
331
342
|
socket.addEventListener('open', () => {
|
|
332
343
|
opened = true;
|
|
333
344
|
connected.add(site);
|
|
@@ -363,8 +374,15 @@ async function hold_channel(home, site, { connected, log, signal }) {
|
|
|
363
374
|
const answer = await answer_request(home, site, link, frame, { report: value => { kind = value; } });
|
|
364
375
|
const answered = Date.now();
|
|
365
376
|
const open = socket.readyState === WebSocket.OPEN;
|
|
366
|
-
|
|
377
|
+
const { oversized, ...frame_out } = answer;
|
|
378
|
+
if (open) socket.send(JSON.stringify(frame_out));
|
|
367
379
|
const label = `${kind.action}${kind.route ? ` ${kind.route}` : ''} → ${kind.status}`;
|
|
380
|
+
if (oversized) log(`${site}: 中转回应超过单帧上限,已改为报错:${label}`);
|
|
381
|
+
const backlog = socket.bufferedAmount || 0;
|
|
382
|
+
if (open && backlog > BACKLOG_LOG_BYTES && answered - backlog_logged > BACKLOG_LOG_MS) {
|
|
383
|
+
backlog_logged = answered;
|
|
384
|
+
log(`${site}: 中转发送积压 ${(backlog / 1048576).toFixed(1)} MB(最近:${label})`);
|
|
385
|
+
}
|
|
368
386
|
if (!open) log(`${site}: 中转回应未送出(连接已断开):${label},处理 ${answered - received} ms`);
|
|
369
387
|
else if (answered - received > SLOW_REQUEST_MS) log(`${site}: 中转请求较慢:${label},处理 ${answered - received} ms`);
|
|
370
388
|
} catch (error) { log(`${site}: 中转请求 ${frame.id} 无法处理(${Date.now() - received} ms):${error.message}`); }
|
package/web/app.js
CHANGED
|
@@ -76,12 +76,22 @@ const ROOM_RELAY_PATH = /^\/api\/(rooms|folders|revisions)(\/|\?|$)/;
|
|
|
76
76
|
// One part is base64-encoded, encrypted and base64-encoded again (about 16/9 of its size), and the sealed request
|
|
77
77
|
// must stay inside the hosted site's 512 KiB request limit (backend/worker.mjs MAX_BODY_BYTES).
|
|
78
78
|
const RELAY_UPLOAD_PART_BYTES = 256 * 1024;
|
|
79
|
+
// Files of the computer's rooms come back in frames of about 1 MB over the one relay connection that also carries every
|
|
80
|
+
// room read: only this many are read at once, so a room full of images cannot hold back its messages until they time out
|
|
81
|
+
// (2026-11-16: opening a room with 51 screenshots read 46 MB at once; message reads and sends timed out, and the retried
|
|
82
|
+
// parts were sent again).
|
|
83
|
+
const RELAY_FILE_CONCURRENCY = 2;
|
|
84
|
+
// Images and media of the computer's rooms are read once they come this near the screen, not all when a room opens.
|
|
85
|
+
const RELAY_MEDIA_MARGIN = "1000px 0px";
|
|
79
86
|
const COMPUTER_UNREACHABLE = t('电脑未连接:请先与电脑配对,并确认电脑开机且运行 codiscuss');
|
|
80
87
|
let local_connection = null;
|
|
81
88
|
let computer_connecting = false;
|
|
82
89
|
let relay_machine = null;
|
|
83
90
|
// Object URLs of files read from the computer's rooms, by their room route.
|
|
84
91
|
const relay_files = new Map();
|
|
92
|
+
// Relay file reads waiting for a free slot, and how many are running (RELAY_FILE_CONCURRENCY).
|
|
93
|
+
const relay_file_queue = [];
|
|
94
|
+
let relay_file_running = 0;
|
|
85
95
|
// The room list and room views last read, with their ETags, by route; an unchanged read is answered 304 and reuses them.
|
|
86
96
|
const ROOM_READ_PATH = /^\/api\/rooms(\/[^/?]+)?$/;
|
|
87
97
|
const room_reads = new Map();
|
|
@@ -2310,7 +2320,7 @@ function close_attachment_preview() {
|
|
|
2310
2320
|
*/
|
|
2311
2321
|
async function attachment_url(file) {
|
|
2312
2322
|
const path = `/api/rooms/${encodeURIComponent(file.room_id)}/attachments/${encodeURIComponent(file.id)}/content`;
|
|
2313
|
-
return state.remote_rooms ? relay_file_url(path) : path;
|
|
2323
|
+
return state.remote_rooms ? relay_file_url(path, { urgent: true }) : path;
|
|
2314
2324
|
}
|
|
2315
2325
|
|
|
2316
2326
|
async function preview_attachment(input) {
|
|
@@ -3064,8 +3074,9 @@ async function relay_exchange(action, payload, wait) {
|
|
|
3064
3074
|
const { key, envelope } = await seal_relay_request(machine, id, { action, payload, ...target });
|
|
3065
3075
|
const result = await request_json(`/api/machines/${encodeURIComponent(machine.id)}/relay`, { id, envelope, ...(wait ? { wait } : {}) })
|
|
3066
3076
|
.catch(error => {
|
|
3067
|
-
// A request given up in the network may still have reached the computer, so its outcome is unconfirmed.
|
|
3068
|
-
|
|
3077
|
+
// A request given up in the network may still have reached the computer, so its outcome is unconfirmed. Safari
|
|
3078
|
+
// reports the timeout as a plain AbortError ("Fetch is aborted"); the timeout is this request's only abort.
|
|
3079
|
+
if (error.name === "TimeoutError" || error.name === "AbortError") throw Object.assign(new Error(t('结果待确认:电脑「{value1}」未在限时内答复,请稍后查看房间,确认是否已生效后再重试', { value1: machine.name })),
|
|
3069
3080
|
{ unconfirmed: true, launch: { stage: "unconfirmed" } });
|
|
3070
3081
|
throw error.status === 401 ? Object.assign(error, { need: "pairing" }) : error;
|
|
3071
3082
|
});
|
|
@@ -3201,24 +3212,58 @@ async function read_room_file(path) {
|
|
|
3201
3212
|
return new Uint8Array(await response.arrayBuffer());
|
|
3202
3213
|
}
|
|
3203
3214
|
|
|
3215
|
+
/** Run one relay file read when a slot is free; a file the user opened (`urgent`) goes ahead of images on the page. */
|
|
3216
|
+
function queue_relay_file(read, urgent) {
|
|
3217
|
+
return new Promise((resolve, reject) => {
|
|
3218
|
+
const job = () => {
|
|
3219
|
+
relay_file_running += 1;
|
|
3220
|
+
read().then(resolve, reject).finally(() => { relay_file_running -= 1; relay_file_queue.shift()?.(); });
|
|
3221
|
+
};
|
|
3222
|
+
if (relay_file_running < RELAY_FILE_CONCURRENCY) job();
|
|
3223
|
+
else if (urgent) relay_file_queue.unshift(job);
|
|
3224
|
+
else relay_file_queue.push(job);
|
|
3225
|
+
});
|
|
3226
|
+
}
|
|
3227
|
+
|
|
3204
3228
|
/** Read one file of the computer's rooms through the relay once, and keep it as an object URL for this page. */
|
|
3205
|
-
function relay_file_url(path) {
|
|
3229
|
+
function relay_file_url(path, { urgent = false } = {}) {
|
|
3206
3230
|
if (!relay_files.has(path)) {
|
|
3207
|
-
relay_files.set(path, relay_room_bytes(path).then(blob => URL.createObjectURL(blob))
|
|
3231
|
+
relay_files.set(path, queue_relay_file(() => relay_room_bytes(path), urgent).then(blob => URL.createObjectURL(blob))
|
|
3208
3232
|
.catch(error => { relay_files.delete(path); throw error; }));
|
|
3209
3233
|
}
|
|
3210
3234
|
return relay_files.get(path);
|
|
3211
3235
|
}
|
|
3212
3236
|
|
|
3237
|
+
/** Read a relayed image or media file once it nears the screen. */
|
|
3238
|
+
const relay_media_observer = typeof IntersectionObserver === "function" ? new IntersectionObserver((entries) => {
|
|
3239
|
+
for (const entry of entries) {
|
|
3240
|
+
if (!entry.isIntersecting) continue;
|
|
3241
|
+
relay_media_observer.unobserve(entry.target);
|
|
3242
|
+
load_relay_media(entry.target);
|
|
3243
|
+
}
|
|
3244
|
+
}, { rootMargin: RELAY_MEDIA_MARGIN }) : null;
|
|
3245
|
+
|
|
3246
|
+
/** Give one relayed image or media element its file; one that cannot be read keeps its name. */
|
|
3247
|
+
function load_relay_media(media) {
|
|
3248
|
+
if (!media.isConnected || media.getAttribute("src")) return;
|
|
3249
|
+
relay_file_url(media.dataset.relaySrc).then(url => { media.src = url; }).catch(() => { media.dataset.relayFailed = "1"; });
|
|
3250
|
+
}
|
|
3251
|
+
|
|
3213
3252
|
/** Show images of the computer's rooms as they appear; one that cannot be read keeps its name. */
|
|
3214
3253
|
// Only the added nodes are searched: a whole-document query on every change walks the entire transcript.
|
|
3215
3254
|
function show_relay_images(records) {
|
|
3216
3255
|
const selector = ":is(img, video, audio)[data-relay-src]:not([src]):not([data-relay-failed])";
|
|
3217
3256
|
for (const record of records) {
|
|
3257
|
+
// A node taken off the page before it neared the screen is no longer watched.
|
|
3258
|
+
if (relay_media_observer) for (const node of record.removedNodes) {
|
|
3259
|
+
if (node.nodeType !== Node.ELEMENT_NODE) continue;
|
|
3260
|
+
for (const image of node.matches("[data-relay-src]") ? [node] : node.querySelectorAll("[data-relay-src]")) relay_media_observer.unobserve(image);
|
|
3261
|
+
}
|
|
3218
3262
|
for (const node of record.addedNodes) {
|
|
3219
3263
|
if (node.nodeType !== Node.ELEMENT_NODE || !node.isConnected) continue;
|
|
3220
3264
|
for (const image of node.matches(selector) ? [node] : node.querySelectorAll(selector)) {
|
|
3221
|
-
|
|
3265
|
+
if (relay_media_observer) relay_media_observer.observe(image);
|
|
3266
|
+
else load_relay_media(image);
|
|
3222
3267
|
}
|
|
3223
3268
|
}
|
|
3224
3269
|
}
|
package/web/backup.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var discuss_backup=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t={},n=(function(e,n,r,i,a){var o=new Worker(t[n]||(t[n]=URL.createObjectURL(new Blob([e+`;addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})`],{type:`text/javascript`}))));return o.onmessage=function(e){var t=e.data,n=t.$e$;if(n){var r=Error(n[0]);r.code=n[1],r.stack=n[2],a(r,null)}else a(null,t)},o.postMessage(r,i),o}),r=Uint8Array,i=Uint16Array,a=Int32Array,o=new r([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),s=new r([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),c=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),l=function(e,t){for(var n=new i(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var o=new a(n[30]),r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)o[s]=s-n[r]<<5|r;return{b:n,r:o}},u=l(o,2),d=u.b,f=u.r;d[28]=258,f[258]=28;for(var p=l(s,0),m=p.b,h=p.r,g=new i(32768),_=0;_<32768;++_){var v=(_&43690)>>1|(_&21845)<<1;v=(v&52428)>>2|(v&13107)<<2,v=(v&61680)>>4|(v&3855)<<4,g[_]=((v&65280)>>8|(v&255)<<8)>>1}for(var y=(function(e,t,n){for(var r=e.length,a=0,o=new i(t);a<r;++a)e[a]&&++o[e[a]-1];var s=new i(t);for(a=1;a<t;++a)s[a]=s[a-1]+o[a-1]<<1;var c;if(n){c=new i(1<<t);var l=15-t;for(a=0;a<r;++a)if(e[a])for(var u=a<<4|e[a],d=t-e[a],f=s[e[a]-1]++<<d,p=f|(1<<d)-1;f<=p;++f)c[g[f]>>l]=u}else for(c=new i(r),a=0;a<r;++a)e[a]&&(c[a]=g[s[e[a]-1]++]>>15-e[a]);return c}),b=new r(288),_=0;_<144;++_)b[_]=8;for(var _=144;_<256;++_)b[_]=9;for(var _=256;_<280;++_)b[_]=7;for(var _=280;_<288;++_)b[_]=8;for(var x=new r(32),_=0;_<32;++_)x[_]=5;var S=y(b,9,0),C=y(b,9,1),w=y(x,5,0),ee=y(x,5,1),te=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},T=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},E=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},ne=function(e){return(e+7)/8|0},D=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new r(e.subarray(t,n))},O=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],k=function(e,t,n){var r=Error(t||O[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,k),!n)throw r;return r},A=function(e,t,n,i){var a=e.length,l=i?i.length:0;if(!a||t.f&&!t.l)return n||new r(0);var u=!n,f=u||t.i!=2,p=t.i;u&&(n=new r(a*3));var h=function(e){var t=n.length;if(e>t){var i=new r(Math.max(t*2,e));i.set(n),n=i}},g=t.f||0,_=t.p||0,v=t.b||0,b=t.l,x=t.d,S=t.m,w=t.n,O=a*8;do{if(!b){g=T(e,_,1);var A=T(e,_+1,3);if(_+=3,!A){var j=ne(_)+4,M=e[j-4]|e[j-3]<<8,N=j+M;if(N>a){p&&k(0);break}f&&h(v+M),n.set(e.subarray(j,N),v),t.b=v+=M,t.p=_=N*8,t.f=g;continue}if(A==1)b=C,x=ee,S=9,w=5;else if(A==2){var P=T(e,_,31)+257,re=T(e,_+10,15)+4,F=P+T(e,_+5,31)+1;_+=14;for(var ie=new r(F),I=new r(19),L=0;L<re;++L)I[c[L]]=T(e,_+L*3,7);_+=re*3;for(var R=te(I),ae=(1<<R)-1,z=y(I,R,1),L=0;L<F;){var B=z[T(e,_,ae)];_+=B&15;var j=B>>4;if(j<16)ie[L++]=j;else{var V=0,H=0;for(j==16?(H=3+T(e,_,3),_+=2,V=ie[L-1]):j==17?(H=3+T(e,_,7),_+=3):j==18&&(H=11+T(e,_,127),_+=7);H--;)ie[L++]=V}}var U=ie.subarray(0,P),W=ie.subarray(P);S=te(U),w=te(W),b=y(U,S,1),x=y(W,w,1)}else k(1);if(_>O){p&&k(0);break}}f&&h(v+131072);for(var oe=(1<<S)-1,se=(1<<w)-1,G=_;;G=_){var V=b[E(e,_)&oe],K=V>>4;if(_+=V&15,_>O){p&&k(0);break}if(V||k(2),K<256)n[v++]=K;else if(K==256){G=_,b=null;break}else{var q=K-254;if(K>264){var L=K-257,J=o[L];q=T(e,_,(1<<J)-1)+d[L],_+=J}var Y=x[E(e,_)&se],X=Y>>4;Y||k(3),_+=Y&15;var W=m[X];if(X>3){var J=s[X];W+=E(e,_)&(1<<J)-1,_+=J}if(_>O){p&&k(0);break}f&&h(v+131072);var Z=v+q;if(v<W){var ce=l-W,Q=Math.min(W,Z);for(ce+v<0&&k(3);v<Q;++v)n[v]=i[ce+v]}for(;v<Z;++v)n[v]=n[v-W]}}t.l=b,t.p=G,t.b=v,t.f=g,b&&(g=1,t.m=S,t.d=x,t.n=w)}while(!g);return v!=n.length&&u?D(n,0,v):n.subarray(0,v)},j=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},M=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},N=function(e,t){for(var n=[],a=0;a<e.length;++a)e[a]&&n.push({s:a,f:e[a]});var o=n.length,s=n.slice();if(!o)return{t:R,l:0};if(o==1){var c=new r(n[0].s+1);return c[n[0].s]=1,{t:c,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var l=n[0],u=n[1],d=0,f=1,p=2;for(n[0]={s:-1,f:l.f+u.f,l,r:u};f!=o-1;)l=n[n[d].f<n[p].f?d++:p++],u=n[d!=f&&n[d].f<n[p].f?d++:p++],n[f++]={s:-1,f:l.f+u.f,l,r:u};for(var m=s[0].s,a=1;a<o;++a)s[a].s>m&&(m=s[a].s);var h=new i(m+1),g=P(n[f-1],h,0);if(g>t){var a=0,_=0,v=g-t,y=1<<v;for(s.sort(function(e,t){return h[t.s]-h[e.s]||e.f-t.f});a<o;++a){var b=s[a].s;if(h[b]>t)_+=y-(1<<g-h[b]),h[b]=t;else break}for(_>>=v;_>0;){var x=s[a].s;h[x]<t?_-=1<<t-h[x]++-1:++a}for(;a>=0&&_;--a){var S=s[a].s;h[S]==t&&(--h[S],++_)}g=t}return{t:new r(h),l:g}},P=function(e,t,n){return e.s==-1?Math.max(P(e.l,t,n+1),P(e.r,t,n+1)):t[e.s]=n},re=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new i(++t),r=0,a=e[0],o=1,s=function(e){n[r++]=e},c=1;c<=t;++c)if(e[c]==a&&c!=t)++o;else{if(!a&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(a),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(a);o=1,a=e[c]}return{c:n.subarray(0,r),n:t}},F=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},ie=function(e,t,n){var r=n.length,i=ne(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},I=function(e,t,n,r,a,l,u,d,f,p,m){j(t,m++,n),++a[256];for(var h=N(a,15),g=h.t,_=h.l,v=N(l,15),C=v.t,ee=v.l,te=re(g),T=te.c,E=te.n,ne=re(C),D=ne.c,O=ne.n,k=new i(19),A=0;A<T.length;++A)++k[T[A]&31];for(var A=0;A<D.length;++A)++k[D[A]&31];for(var P=N(k,7),I=P.t,L=P.l,R=19;R>4&&!I[c[R-1]];--R);var ae=p+5<<3,z=F(a,b)+F(l,x)+u,B=F(a,g)+F(l,C)+u+14+3*R+F(k,I)+2*k[16]+3*k[17]+7*k[18];if(f>=0&&ae<=z&&ae<=B)return ie(t,m,e.subarray(f,f+p));var V,H,U,W;if(j(t,m,1+(B<z)),m+=2,B<z){V=y(g,_,0),H=g,U=y(C,ee,0),W=C;var oe=y(I,L,0);j(t,m,E-257),j(t,m+5,O-1),j(t,m+10,R-4),m+=14;for(var A=0;A<R;++A)j(t,m+3*A,I[c[A]]);m+=3*R;for(var se=[T,D],G=0;G<2;++G)for(var K=se[G],A=0;A<K.length;++A){var q=K[A]&31;j(t,m,oe[q]),m+=I[q],q>15&&(j(t,m,K[A]>>5&127),m+=K[A]>>12)}}else V=S,H=b,U=w,W=x;for(var A=0;A<d;++A){var J=r[A];if(J>255){var q=J>>18&31;M(t,m,V[q+257]),m+=H[q+257],q>7&&(j(t,m,J>>23&31),m+=o[q]);var Y=J&31;M(t,m,U[Y]),m+=W[Y],Y>3&&(M(t,m,J>>5&8191),m+=s[Y])}else M(t,m,V[J]),m+=H[J]}return M(t,m,V[256]),m+H[256]},L=new a([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),R=new r(0),ae=function(e,t,n,c,l,u){var d=u.z||e.length,p=new r(c+d+5*(1+Math.ceil(d/7e3))+l),m=p.subarray(c,p.length-l),g=u.l,_=(u.r||0)&7;if(t){_&&(m[0]=u.r>>3);for(var v=L[t-1],y=v>>13,b=v&8191,x=(1<<n)-1,S=u.p||new i(32768),C=u.h||new i(x+1),w=Math.ceil(n/3),ee=2*w,te=function(t){return(e[t]^e[t+1]<<w^e[t+2]<<ee)&x},T=new a(25e3),E=new i(288),O=new i(32),k=0,A=0,j=u.i||0,M=0,N=u.w||0,P=0;j+2<d;++j){var re=te(j),F=j&32767,R=C[re];if(S[F]=R,C[re]=F,N<=j){var ae=d-j;if((k>7e3||M>24576)&&(ae>423||!g)){_=I(e,m,0,T,E,O,A,M,P,j-P,_),M=k=A=0,P=j;for(var z=0;z<286;++z)E[z]=0;for(var z=0;z<30;++z)O[z]=0}var B=2,V=0,H=b,U=F-R&32767;if(ae>2&&re==te(j-U))for(var W=Math.min(y,ae)-1,oe=Math.min(32767,j),se=Math.min(258,ae);U<=oe&&--H&&F!=R;){if(e[j+B]==e[j+B-U]){for(var G=0;G<se&&e[j+G]==e[j+G-U];++G);if(G>B){if(B=G,V=U,G>W)break;for(var K=Math.min(U,G-2),q=0,z=0;z<K;++z){var J=j-U+z&32767,Y=J-S[J]&32767;Y>q&&(q=Y,R=J)}}}F=R,R=S[F],U+=F-R&32767}if(V){T[M++]=268435456|f[B]<<18|h[V];var X=f[B]&31,Z=h[V]&31;A+=o[X]+s[Z],++E[257+X],++O[Z],N=j+B,++k}else T[M++]=e[j],++E[e[j]]}}for(j=Math.max(j,N);j<d;++j)T[M++]=e[j],++E[e[j]];_=I(e,m,g,T,E,O,A,M,P,j-P,_),g||(u.r=_&7|m[_/8|0]<<3,_-=7,u.h=C,u.p=S,u.i=j,u.w=N)}else{for(var j=u.w||0;j<d+g;j+=65535){var ce=j+65535;ce>=d&&(m[_/8|0]=g,ce=d),_=ie(m,_+1,e.subarray(j,ce))}u.i=d}return D(p,0,c+ne(_)+l)},z=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),B=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=z[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},V=function(e,t,n,i,a){if(!a&&(a={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new r(o.length+e.length);s.set(o),s.set(e,o.length),e=s,a.w=o.length}return ae(e,t.level==null?6:t.level,t.mem==null?a.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,i,a)},H=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},U=function(e,t,n){for(var r=e(),i=e.toString(),a=i.slice(i.indexOf(`[`)+1,i.lastIndexOf(`]`)).replace(/\s+/g,``).split(`,`),o=0;o<r.length;++o){var s=r[o],c=a[o];if(typeof s==`function`){t+=`;`+c+`=`;var l=s.toString();if(s.prototype){if(l.indexOf(`[native code]`)!=-1){var u=l.indexOf(` `,8)+1;t+=l.slice(u,l.indexOf(`(`,u))}else for(var d in t+=l,s.prototype)t+=`;`+c+`.prototype.`+d+`=`+s.prototype[d].toString()}else t+=l}else n[c]=s}return t},W=[],oe=function(e){var t=[];for(var n in e)e[n].buffer&&t.push((e[n]=new e[n].constructor(e[n])).buffer);return t},se=function(e,t,r,i){if(!W[r]){for(var a=``,o={},s=e.length-1,c=0;c<s;++c)a=U(e[c],a,o);W[r]={c:U(e[s],a,o),e:o}}var l=H({},W[r].e);return n(W[r].c+`;onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=`+t.toString()+`}`,r,l,oe(l),i)},G=function(){return[r,i,a,o,s,c,d,m,C,ee,g,O,y,te,T,E,ne,D,k,A,fe,q,J]},K=function(){return[r,i,a,o,s,c,f,h,S,b,w,x,g,L,R,y,j,M,N,P,re,F,ie,I,ne,D,ae,V,ue,q]},q=function(e){return postMessage(e,[e.buffer])},J=function(e){return e&&{out:e.size&&new r(e.size),dictionary:e.dictionary}},Y=function(e,t,n,r,i,a){var o=se(n,r,i,function(e,t){o.terminate(),a(e,t)});return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},X=function(e,t){return e[t]|e[t+1]<<8},Z=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},ce=function(e,t){return Z(e,t)+Z(e,t+4)*4294967296},Q=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function le(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&k(7),Y(e,t,[K],function(e){return q(ue(e.data[0],e.data[1]))},0,n)}function ue(e,t){return V(e,t||{},0,0)}function de(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&k(7),Y(e,t,[G],function(e){return q(fe(e.data[0],J(e.data[1])))},1,n)}function fe(e,t){return A(e,{i:2},t&&t.out,t&&t.dictionary)}var pe=function(e,t,n,i){for(var a in e){var o=e[a],s=t+a,c=i;Array.isArray(o)&&(c=H(i,o[1]),o=o[0]),ArrayBuffer.isView(o)?n[s]=[o,c]:(n[s+=`/`]=[new r(0),c],pe(o,s,n,i))}},me=typeof TextEncoder<`u`&&new TextEncoder,he=typeof TextDecoder<`u`&&new TextDecoder;try{he.decode(R,{stream:!0})}catch{}var ge=function(e){for(var t=``,n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:D(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function _e(e,t){if(t){for(var n=new r(e.length),i=0;i<e.length;++i)n[i]=e.charCodeAt(i);return n}if(me)return me.encode(e);for(var a=e.length,o=new r(e.length+(e.length>>1)),s=0,c=function(e){o[s++]=e},i=0;i<a;++i){if(s+5>o.length){var l=new r(s+8+(a-i<<1));l.set(o),o=l}var u=e.charCodeAt(i);u<128||t?c(u):u<2048?(c(192|u>>6),c(128|u&63)):u>55295&&u<57344?(u=65536+(u&1047552)|e.charCodeAt(++i)&1023,c(240|u>>18),c(128|u>>12&63),c(128|u>>6&63),c(128|u&63)):(c(224|u>>12),c(128|u>>6&63),c(128|u&63))}return D(o,0,s)}function ve(e,t){if(t){for(var n=``,r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}if(he)return he.decode(e);var i=ge(e),a=i.s,n=i.r;return n.length&&k(8),a}var ye=function(e,t){return t+30+X(e,t+26)+X(e,t+28)},be=function(e,t,n){var r=X(e,t+28),i=X(e,t+30),a=ve(e.subarray(t+46,t+46+r),!(X(e,t+8)&2048)),o=t+46+r,s=xe(e,o,i,n,Z(e,t+20),Z(e,t+24),Z(e,t+42)),c=s[0],l=s[1],u=s[2];return[X(e,t+10),c,l,a,o+i+X(e,t+32),u]},xe=function(e,t,n,r,i,a,o){var s=i==4294967295,c=a==4294967295,l=o==4294967295,u=t+n,d=s+c+l;if(r&&d){for(;t+4<u;t+=4+X(e,t+2))if(X(e,t)==1)return[s?ce(e,t+4+8*c):i,c?ce(e,t+4):a,l?ce(e,t+4+8*(c+s)):o,1];r<2&&k(13)}return[i,a,o,0]},Se=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&k(9),t+=r+4}return t},Ce=function(e,t,n,r,i,a,o,s){var c=r.length,l=n.extra,u=s&&s.length,d=Se(l);Q(e,t,o==null?67324752:33639248),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(a<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&k(10),Q(e,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,a!=-1&&(Q(e,t,n.crc),Q(e,t+4,a<0?-a-2:a),Q(e,t+8,n.size)),Q(e,t+12,c),Q(e,t+14,d),t+=16,o!=null&&(Q(e,t,u),Q(e,t+6,n.attrs),Q(e,t+10,o),t+=14),e.set(r,t),t+=c,d)for(var m in l){var h=l[m],g=h.length;Q(e,t,+m),Q(e,t+2,g),e.set(h,t+4),t+=4+g}return u&&(e.set(s,t),t+=u),t},we=function(e,t,n,r,i){Q(e,t,101010256),Q(e,t+8,n),Q(e,t+10,n),Q(e,t+12,r),Q(e,t+16,i)};function Te(e,t,n){n||(n=t,t={}),typeof n!=`function`&&k(7);var i={};pe(e,``,i,t);var a=Object.keys(i),o=a.length,s=0,c=0,l=o,u=Array(o),d=[],f=function(){for(var e=0;e<d.length;++e)d[e]()},p=function(e,t){Ee(function(){n(e,t)})};Ee(function(){p=n});var m=function(){var e=new r(c+22),t=s,n=c-s;c=0;for(var i=0;i<l;++i){var a=u[i];try{var o=a.c.length;Ce(e,c,a,a.f,a.u,o);var d=30+a.f.length+Se(a.extra),f=c+d;e.set(a.c,f),Ce(e,s,a,a.f,a.u,o,c,a.m),s+=16+d+(a.m?a.m.length:0),c=f+o}catch(e){return p(e,null)}}we(e,s,u.length,n,t),p(null,e)};o||m();for(var h=function(e){var t=a[e],n=i[t],r=n[0],l=n[1],h=B(),g=r.length;h.p(r);var _=_e(t),v=_.length,y=l.comment,b=y&&_e(y),x=b&&b.length,S=Se(l.extra),C=l.level==0?0:8,w=function(n,r){if(n)f(),p(n,null);else{var i=r.length;u[e]=H(l,{size:g,crc:h.d(),c:r,f:_,m:b,u:v!=t.length||b&&y.length!=x,compression:C}),s+=30+v+S+i,c+=76+2*(v+S)+(x||0)+i,--o||m()}};if(v>65535&&w(k(11,0,1),null),!C)w(null,r);else if(g<16e4)try{w(null,ue(r,l))}catch(e){w(e,null)}else d.push(le(r,l,w))},g=0;g<l;++g)h(g);return f}var Ee=typeof queueMicrotask==`function`?queueMicrotask:typeof setTimeout==`function`?setTimeout:function(e){e()};function De(e,t,n){n||(n=t,t={}),typeof n!=`function`&&k(7);var i=[],a=function(){for(var e=0;e<i.length;++e)i[e]()},o={},s=function(e,t){Ee(function(){n(e,t)})};Ee(function(){s=n});for(var c=e.length-22;Z(e,c)!=101010256;--c)if(!c||e.length-c>65558)return s(k(13,0,1),null),a;var l=X(e,c+8);if(l){var u=l,d=Z(e,c+16),f=Z(e,c-20)==117853008;if(f){var p=Z(e,c-12);f=Z(e,p)==101075792,f&&(u=l=Z(e,p+32),d=Z(e,p+48))}for(var m=t&&t.filter,h=function(t){var n=be(e,d,f),c=n[0],u=n[1],p=n[2],h=n[3],g=n[4],_=n[5],v=ye(e,_);d=g;var y=function(e,t){e?(a(),s(e,null)):(t&&(o[h]=t),--l||s(null,o))};if(!m||m({name:h,size:u,originalSize:p,compression:c})){if(!c)y(null,D(e,v,v+u));else if(c==8){var b=e.subarray(v,v+u);if(p<524288||u>.8*p)try{y(null,fe(b,{out:new r(p)}))}catch(e){y(e,null)}else i.push(de(b,{size:p},y))}else y(k(14,`unknown compression type `+c,1),null)}else y(null,null)},g=0;g<u;++g)h(g)}else s(null,{});return a}var Oe=[`read`,`write`,`auto`,`full`],ke={stoppable:!0,progress:!0},Ae={stoppable:!1,progress:!1},je=`final_remark`,Me={codex_cli:{platform:`Codex`,label:`Codex CLI`,kind:`cli`,location:`executable`,fields:[`project_id`,`project_name`],efforts:[`low`,`medium`,`high`,`xhigh`,`max`,`ultra`],models:!0,access_levels:Oe,per_tool_allow:!1,access_hints:{read:`只读沙箱`,write:`项目可写的沙箱,命令在沙箱内运行、可联网`,auto:`沙箱外的操作由模型申请提权,Codex 自动审核代替人工批准`,full:`无沙箱、无审批(--dangerously-bypass-approvals-and-sandbox)`},client:`codex`,adopt:`session`,host_existing:!0,session_family:`codex`,browse_sessions:!0,capabilities:{delivery:ke,rewind:`cut`,project:!0,access_env:!0,enforces_read_only:!0,limits_directories:!0,ripgrep:!0,chat:!0,resume:!0,images:!0,capture:je,close_grace_ms:1500}},codex:{platform:`Codex`,label:`Codex App`,kind:`app`,location:`executable`,fields:[`source_thread_id`,`project_id`,`project_name`],efforts:null,models:!1,access_levels:null,per_tool_allow:!1,client:`codex`,adopt:`session`,host_existing:!0,session_family:`codex`,browse_sessions:!0,capabilities:{delivery:Ae,rewind:`cut`,project:!0,chat:!0,capture:!1}},claude:{platform:`Claude`,label:`Claude Code`,kind:`cli`,location:`executable`,fields:[`allowed_tools`],efforts:[`low`,`medium`,`high`,`xhigh`,`max`],models:!0,access_levels:Oe,per_tool_allow:!0,access_hints:{read:`只放行网站命令与草稿,不改项目文件、不跑其他命令`,write:`可改项目文件,Bash / PowerShell 命令全部放行(无沙箱)`,auto:`Claude auto 模式:由分类器判断,实测项目外写入和联网都会放行`,full:`bypassPermissions:跳过全部权限检查`},client:`claude`,adopt:`own_cwd`,host_existing:!0,restore_manual:!0,browse_sessions:!0,resume_command:e=>`claude --resume ${e}`,windows_command:`codiscuss`,capabilities:{delivery:ke,rewind:`cut`,project:!0,access_env:!0,chat:!0,resume:!0,images:!0,capture:je}},antigravity_cli:{platform:`Antigravity`,label:`Antigravity CLI`,kind:`cli`,location:`executable`,fields:[`project_id`,`project_name`],efforts:[`low`,`medium`,`high`,`xhigh`,`max`],efforts_per_model:!0,models:!0,defaults_by_query:!0,access_levels:[`read`,`write`,`full`],per_tool_allow:!0,access_hints:{read:`只放行网站命令;碰到未放行的命令会直接结束本轮`,write:`可写项目,命令全部放行(在 agy 沙箱内)`,full:`跳过全部权限确认(--dangerously-skip-permissions),并放开沙箱外命令与 MCP 工具`},unsupported_hints:{auto:`agy 只在交互窗口提供自动模式,后台运行(-p)不支持`},client:`antigravity`,adopt:`session`,host_existing:!1,own_project_when_bound:!0,capabilities:{delivery:ke,rewind:`cut`,project:!0,access_env:!0,chat:!0,capture:je},task_rules:(e,{runs_commands:t})=>(t?``:`无人值守下 run_command 只能运行 ${e} 的 subcommands 子命令,其他命令会被自动拒绝并使会话直接结束;列目录、搜索或读取文件用你环境自带的文件工具,不要经 run_command。`)+`多步任务中,在关键转折处用一句话写出进展再继续:agy 不输出思考过程,网页只能靠这些话显示你做到哪一步。`},antigravity:{platform:`Antigravity`,label:`Antigravity App`,kind:`app`,location:`ipc_directory`,fields:[`project_id`,`project_name`],efforts:null,models:!1,access_levels:null,per_tool_allow:!1,client:`antigravity`,adopt:`session`,host_existing:!0,capabilities:{delivery:Ae,rewind:`kept`,project:!0,chat:!0,capture:!1}},api:{platform:``,label:`模型 API`,kind:`api`,location:``,fields:[`base_url`,`api_protocol`,`api_key_ref`,`image_input`],efforts:[`low`,`medium`,`high`],models:!1,access_levels:[`read`,`write`],per_tool_allow:!1,adopt:``,host_existing:!1,access_hints:{read:`用接入程序的文件工具读取、搜索项目文件,可运行工作流登记的只读命令`,write:`还可新建、覆盖、局部编辑项目文件,可运行工作流登记的全部命令;没有通用命令行`},unsupported_hints:{auto:`API 成员没有通用命令行,没有需要软件审批的操作`,full:`API 成员没有通用命令行,没有需要软件审批的操作`},capabilities:{delivery:ke,rewind:`cut`,project:!0,file_tools:!0,limits_directories:!0,chat:!0,images:`configured`,capture:!1}}};Object.keys(Me);function Ne(e){let t=Me[e];return t?{id:e,session_family:e,windows_command:`codiscuss.cmd`,...t}:null}var Pe=6e4,Fe=80,Ie=`AI CoDiscuss 聊天室备份
|
|
1
|
+
var discuss_backup=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t={},n=(function(e,n,r,i,a){var o=new Worker(t[n]||(t[n]=URL.createObjectURL(new Blob([e+`;addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})`],{type:`text/javascript`}))));return o.onmessage=function(e){var t=e.data,n=t.$e$;if(n){var r=Error(n[0]);r.code=n[1],r.stack=n[2],a(r,null)}else a(null,t)},o.postMessage(r,i),o}),r=Uint8Array,i=Uint16Array,a=Int32Array,o=new r([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),s=new r([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),c=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),l=function(e,t){for(var n=new i(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var o=new a(n[30]),r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)o[s]=s-n[r]<<5|r;return{b:n,r:o}},u=l(o,2),d=u.b,f=u.r;d[28]=258,f[258]=28;for(var p=l(s,0),m=p.b,h=p.r,g=new i(32768),_=0;_<32768;++_){var v=(_&43690)>>1|(_&21845)<<1;v=(v&52428)>>2|(v&13107)<<2,v=(v&61680)>>4|(v&3855)<<4,g[_]=((v&65280)>>8|(v&255)<<8)>>1}for(var y=(function(e,t,n){for(var r=e.length,a=0,o=new i(t);a<r;++a)e[a]&&++o[e[a]-1];var s=new i(t);for(a=1;a<t;++a)s[a]=s[a-1]+o[a-1]<<1;var c;if(n){c=new i(1<<t);var l=15-t;for(a=0;a<r;++a)if(e[a])for(var u=a<<4|e[a],d=t-e[a],f=s[e[a]-1]++<<d,p=f|(1<<d)-1;f<=p;++f)c[g[f]>>l]=u}else for(c=new i(r),a=0;a<r;++a)e[a]&&(c[a]=g[s[e[a]-1]++]>>15-e[a]);return c}),b=new r(288),_=0;_<144;++_)b[_]=8;for(var _=144;_<256;++_)b[_]=9;for(var _=256;_<280;++_)b[_]=7;for(var _=280;_<288;++_)b[_]=8;for(var x=new r(32),_=0;_<32;++_)x[_]=5;var S=y(b,9,0),C=y(b,9,1),w=y(x,5,0),ee=y(x,5,1),te=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},T=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},E=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},ne=function(e){return(e+7)/8|0},D=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new r(e.subarray(t,n))},O=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],k=function(e,t,n){var r=Error(t||O[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,k),!n)throw r;return r},A=function(e,t,n,i){var a=e.length,l=i?i.length:0;if(!a||t.f&&!t.l)return n||new r(0);var u=!n,f=u||t.i!=2,p=t.i;u&&(n=new r(a*3));var h=function(e){var t=n.length;if(e>t){var i=new r(Math.max(t*2,e));i.set(n),n=i}},g=t.f||0,_=t.p||0,v=t.b||0,b=t.l,x=t.d,S=t.m,w=t.n,O=a*8;do{if(!b){g=T(e,_,1);var A=T(e,_+1,3);if(_+=3,!A){var j=ne(_)+4,M=e[j-4]|e[j-3]<<8,N=j+M;if(N>a){p&&k(0);break}f&&h(v+M),n.set(e.subarray(j,N),v),t.b=v+=M,t.p=_=N*8,t.f=g;continue}if(A==1)b=C,x=ee,S=9,w=5;else if(A==2){var P=T(e,_,31)+257,re=T(e,_+10,15)+4,F=P+T(e,_+5,31)+1;_+=14;for(var ie=new r(F),I=new r(19),L=0;L<re;++L)I[c[L]]=T(e,_+L*3,7);_+=re*3;for(var R=te(I),ae=(1<<R)-1,z=y(I,R,1),L=0;L<F;){var B=z[T(e,_,ae)];_+=B&15;var j=B>>4;if(j<16)ie[L++]=j;else{var V=0,H=0;for(j==16?(H=3+T(e,_,3),_+=2,V=ie[L-1]):j==17?(H=3+T(e,_,7),_+=3):j==18&&(H=11+T(e,_,127),_+=7);H--;)ie[L++]=V}}var U=ie.subarray(0,P),W=ie.subarray(P);S=te(U),w=te(W),b=y(U,S,1),x=y(W,w,1)}else k(1);if(_>O){p&&k(0);break}}f&&h(v+131072);for(var oe=(1<<S)-1,se=(1<<w)-1,G=_;;G=_){var V=b[E(e,_)&oe],K=V>>4;if(_+=V&15,_>O){p&&k(0);break}if(V||k(2),K<256)n[v++]=K;else if(K==256){G=_,b=null;break}else{var q=K-254;if(K>264){var L=K-257,J=o[L];q=T(e,_,(1<<J)-1)+d[L],_+=J}var Y=x[E(e,_)&se],X=Y>>4;Y||k(3),_+=Y&15;var W=m[X];if(X>3){var J=s[X];W+=E(e,_)&(1<<J)-1,_+=J}if(_>O){p&&k(0);break}f&&h(v+131072);var Z=v+q;if(v<W){var ce=l-W,Q=Math.min(W,Z);for(ce+v<0&&k(3);v<Q;++v)n[v]=i[ce+v]}for(;v<Z;++v)n[v]=n[v-W]}}t.l=b,t.p=G,t.b=v,t.f=g,b&&(g=1,t.m=S,t.d=x,t.n=w)}while(!g);return v!=n.length&&u?D(n,0,v):n.subarray(0,v)},j=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},M=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},N=function(e,t){for(var n=[],a=0;a<e.length;++a)e[a]&&n.push({s:a,f:e[a]});var o=n.length,s=n.slice();if(!o)return{t:R,l:0};if(o==1){var c=new r(n[0].s+1);return c[n[0].s]=1,{t:c,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var l=n[0],u=n[1],d=0,f=1,p=2;for(n[0]={s:-1,f:l.f+u.f,l,r:u};f!=o-1;)l=n[n[d].f<n[p].f?d++:p++],u=n[d!=f&&n[d].f<n[p].f?d++:p++],n[f++]={s:-1,f:l.f+u.f,l,r:u};for(var m=s[0].s,a=1;a<o;++a)s[a].s>m&&(m=s[a].s);var h=new i(m+1),g=P(n[f-1],h,0);if(g>t){var a=0,_=0,v=g-t,y=1<<v;for(s.sort(function(e,t){return h[t.s]-h[e.s]||e.f-t.f});a<o;++a){var b=s[a].s;if(h[b]>t)_+=y-(1<<g-h[b]),h[b]=t;else break}for(_>>=v;_>0;){var x=s[a].s;h[x]<t?_-=1<<t-h[x]++-1:++a}for(;a>=0&&_;--a){var S=s[a].s;h[S]==t&&(--h[S],++_)}g=t}return{t:new r(h),l:g}},P=function(e,t,n){return e.s==-1?Math.max(P(e.l,t,n+1),P(e.r,t,n+1)):t[e.s]=n},re=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new i(++t),r=0,a=e[0],o=1,s=function(e){n[r++]=e},c=1;c<=t;++c)if(e[c]==a&&c!=t)++o;else{if(!a&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(a),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(a);o=1,a=e[c]}return{c:n.subarray(0,r),n:t}},F=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},ie=function(e,t,n){var r=n.length,i=ne(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},I=function(e,t,n,r,a,l,u,d,f,p,m){j(t,m++,n),++a[256];for(var h=N(a,15),g=h.t,_=h.l,v=N(l,15),C=v.t,ee=v.l,te=re(g),T=te.c,E=te.n,ne=re(C),D=ne.c,O=ne.n,k=new i(19),A=0;A<T.length;++A)++k[T[A]&31];for(var A=0;A<D.length;++A)++k[D[A]&31];for(var P=N(k,7),I=P.t,L=P.l,R=19;R>4&&!I[c[R-1]];--R);var ae=p+5<<3,z=F(a,b)+F(l,x)+u,B=F(a,g)+F(l,C)+u+14+3*R+F(k,I)+2*k[16]+3*k[17]+7*k[18];if(f>=0&&ae<=z&&ae<=B)return ie(t,m,e.subarray(f,f+p));var V,H,U,W;if(j(t,m,1+(B<z)),m+=2,B<z){V=y(g,_,0),H=g,U=y(C,ee,0),W=C;var oe=y(I,L,0);j(t,m,E-257),j(t,m+5,O-1),j(t,m+10,R-4),m+=14;for(var A=0;A<R;++A)j(t,m+3*A,I[c[A]]);m+=3*R;for(var se=[T,D],G=0;G<2;++G)for(var K=se[G],A=0;A<K.length;++A){var q=K[A]&31;j(t,m,oe[q]),m+=I[q],q>15&&(j(t,m,K[A]>>5&127),m+=K[A]>>12)}}else V=S,H=b,U=w,W=x;for(var A=0;A<d;++A){var J=r[A];if(J>255){var q=J>>18&31;M(t,m,V[q+257]),m+=H[q+257],q>7&&(j(t,m,J>>23&31),m+=o[q]);var Y=J&31;M(t,m,U[Y]),m+=W[Y],Y>3&&(M(t,m,J>>5&8191),m+=s[Y])}else M(t,m,V[J]),m+=H[J]}return M(t,m,V[256]),m+H[256]},L=new a([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),R=new r(0),ae=function(e,t,n,c,l,u){var d=u.z||e.length,p=new r(c+d+5*(1+Math.ceil(d/7e3))+l),m=p.subarray(c,p.length-l),g=u.l,_=(u.r||0)&7;if(t){_&&(m[0]=u.r>>3);for(var v=L[t-1],y=v>>13,b=v&8191,x=(1<<n)-1,S=u.p||new i(32768),C=u.h||new i(x+1),w=Math.ceil(n/3),ee=2*w,te=function(t){return(e[t]^e[t+1]<<w^e[t+2]<<ee)&x},T=new a(25e3),E=new i(288),O=new i(32),k=0,A=0,j=u.i||0,M=0,N=u.w||0,P=0;j+2<d;++j){var re=te(j),F=j&32767,R=C[re];if(S[F]=R,C[re]=F,N<=j){var ae=d-j;if((k>7e3||M>24576)&&(ae>423||!g)){_=I(e,m,0,T,E,O,A,M,P,j-P,_),M=k=A=0,P=j;for(var z=0;z<286;++z)E[z]=0;for(var z=0;z<30;++z)O[z]=0}var B=2,V=0,H=b,U=F-R&32767;if(ae>2&&re==te(j-U))for(var W=Math.min(y,ae)-1,oe=Math.min(32767,j),se=Math.min(258,ae);U<=oe&&--H&&F!=R;){if(e[j+B]==e[j+B-U]){for(var G=0;G<se&&e[j+G]==e[j+G-U];++G);if(G>B){if(B=G,V=U,G>W)break;for(var K=Math.min(U,G-2),q=0,z=0;z<K;++z){var J=j-U+z&32767,Y=J-S[J]&32767;Y>q&&(q=Y,R=J)}}}F=R,R=S[F],U+=F-R&32767}if(V){T[M++]=268435456|f[B]<<18|h[V];var X=f[B]&31,Z=h[V]&31;A+=o[X]+s[Z],++E[257+X],++O[Z],N=j+B,++k}else T[M++]=e[j],++E[e[j]]}}for(j=Math.max(j,N);j<d;++j)T[M++]=e[j],++E[e[j]];_=I(e,m,g,T,E,O,A,M,P,j-P,_),g||(u.r=_&7|m[_/8|0]<<3,_-=7,u.h=C,u.p=S,u.i=j,u.w=N)}else{for(var j=u.w||0;j<d+g;j+=65535){var ce=j+65535;ce>=d&&(m[_/8|0]=g,ce=d),_=ie(m,_+1,e.subarray(j,ce))}u.i=d}return D(p,0,c+ne(_)+l)},z=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),B=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=z[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},V=function(e,t,n,i,a){if(!a&&(a={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new r(o.length+e.length);s.set(o),s.set(e,o.length),e=s,a.w=o.length}return ae(e,t.level==null?6:t.level,t.mem==null?a.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,i,a)},H=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},U=function(e,t,n){for(var r=e(),i=e.toString(),a=i.slice(i.indexOf(`[`)+1,i.lastIndexOf(`]`)).replace(/\s+/g,``).split(`,`),o=0;o<r.length;++o){var s=r[o],c=a[o];if(typeof s==`function`){t+=`;`+c+`=`;var l=s.toString();if(s.prototype){if(l.indexOf(`[native code]`)!=-1){var u=l.indexOf(` `,8)+1;t+=l.slice(u,l.indexOf(`(`,u))}else for(var d in t+=l,s.prototype)t+=`;`+c+`.prototype.`+d+`=`+s.prototype[d].toString()}else t+=l}else n[c]=s}return t},W=[],oe=function(e){var t=[];for(var n in e)e[n].buffer&&t.push((e[n]=new e[n].constructor(e[n])).buffer);return t},se=function(e,t,r,i){if(!W[r]){for(var a=``,o={},s=e.length-1,c=0;c<s;++c)a=U(e[c],a,o);W[r]={c:U(e[s],a,o),e:o}}var l=H({},W[r].e);return n(W[r].c+`;onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=`+t.toString()+`}`,r,l,oe(l),i)},G=function(){return[r,i,a,o,s,c,d,m,C,ee,g,O,y,te,T,E,ne,D,k,A,fe,q,J]},K=function(){return[r,i,a,o,s,c,f,h,S,b,w,x,g,L,R,y,j,M,N,P,re,F,ie,I,ne,D,ae,V,ue,q]},q=function(e){return postMessage(e,[e.buffer])},J=function(e){return e&&{out:e.size&&new r(e.size),dictionary:e.dictionary}},Y=function(e,t,n,r,i,a){var o=se(n,r,i,function(e,t){o.terminate(),a(e,t)});return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},X=function(e,t){return e[t]|e[t+1]<<8},Z=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},ce=function(e,t){return Z(e,t)+Z(e,t+4)*4294967296},Q=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function le(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&k(7),Y(e,t,[K],function(e){return q(ue(e.data[0],e.data[1]))},0,n)}function ue(e,t){return V(e,t||{},0,0)}function de(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&k(7),Y(e,t,[G],function(e){return q(fe(e.data[0],J(e.data[1])))},1,n)}function fe(e,t){return A(e,{i:2},t&&t.out,t&&t.dictionary)}var pe=function(e,t,n,i){for(var a in e){var o=e[a],s=t+a,c=i;Array.isArray(o)&&(c=H(i,o[1]),o=o[0]),ArrayBuffer.isView(o)?n[s]=[o,c]:(n[s+=`/`]=[new r(0),c],pe(o,s,n,i))}},me=typeof TextEncoder<`u`&&new TextEncoder,he=typeof TextDecoder<`u`&&new TextDecoder;try{he.decode(R,{stream:!0})}catch{}var ge=function(e){for(var t=``,n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:D(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function _e(e,t){if(t){for(var n=new r(e.length),i=0;i<e.length;++i)n[i]=e.charCodeAt(i);return n}if(me)return me.encode(e);for(var a=e.length,o=new r(e.length+(e.length>>1)),s=0,c=function(e){o[s++]=e},i=0;i<a;++i){if(s+5>o.length){var l=new r(s+8+(a-i<<1));l.set(o),o=l}var u=e.charCodeAt(i);u<128||t?c(u):u<2048?(c(192|u>>6),c(128|u&63)):u>55295&&u<57344?(u=65536+(u&1047552)|e.charCodeAt(++i)&1023,c(240|u>>18),c(128|u>>12&63),c(128|u>>6&63),c(128|u&63)):(c(224|u>>12),c(128|u>>6&63),c(128|u&63))}return D(o,0,s)}function ve(e,t){if(t){for(var n=``,r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}if(he)return he.decode(e);var i=ge(e),a=i.s,n=i.r;return n.length&&k(8),a}var ye=function(e,t){return t+30+X(e,t+26)+X(e,t+28)},be=function(e,t,n){var r=X(e,t+28),i=X(e,t+30),a=ve(e.subarray(t+46,t+46+r),!(X(e,t+8)&2048)),o=t+46+r,s=xe(e,o,i,n,Z(e,t+20),Z(e,t+24),Z(e,t+42)),c=s[0],l=s[1],u=s[2];return[X(e,t+10),c,l,a,o+i+X(e,t+32),u]},xe=function(e,t,n,r,i,a,o){var s=i==4294967295,c=a==4294967295,l=o==4294967295,u=t+n,d=s+c+l;if(r&&d){for(;t+4<u;t+=4+X(e,t+2))if(X(e,t)==1)return[s?ce(e,t+4+8*c):i,c?ce(e,t+4):a,l?ce(e,t+4+8*(c+s)):o,1];r<2&&k(13)}return[i,a,o,0]},Se=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&k(9),t+=r+4}return t},Ce=function(e,t,n,r,i,a,o,s){var c=r.length,l=n.extra,u=s&&s.length,d=Se(l);Q(e,t,o==null?67324752:33639248),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(a<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&k(10),Q(e,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,a!=-1&&(Q(e,t,n.crc),Q(e,t+4,a<0?-a-2:a),Q(e,t+8,n.size)),Q(e,t+12,c),Q(e,t+14,d),t+=16,o!=null&&(Q(e,t,u),Q(e,t+6,n.attrs),Q(e,t+10,o),t+=14),e.set(r,t),t+=c,d)for(var m in l){var h=l[m],g=h.length;Q(e,t,+m),Q(e,t+2,g),e.set(h,t+4),t+=4+g}return u&&(e.set(s,t),t+=u),t},we=function(e,t,n,r,i){Q(e,t,101010256),Q(e,t+8,n),Q(e,t+10,n),Q(e,t+12,r),Q(e,t+16,i)};function Te(e,t,n){n||(n=t,t={}),typeof n!=`function`&&k(7);var i={};pe(e,``,i,t);var a=Object.keys(i),o=a.length,s=0,c=0,l=o,u=Array(o),d=[],f=function(){for(var e=0;e<d.length;++e)d[e]()},p=function(e,t){Ee(function(){n(e,t)})};Ee(function(){p=n});var m=function(){var e=new r(c+22),t=s,n=c-s;c=0;for(var i=0;i<l;++i){var a=u[i];try{var o=a.c.length;Ce(e,c,a,a.f,a.u,o);var d=30+a.f.length+Se(a.extra),f=c+d;e.set(a.c,f),Ce(e,s,a,a.f,a.u,o,c,a.m),s+=16+d+(a.m?a.m.length:0),c=f+o}catch(e){return p(e,null)}}we(e,s,u.length,n,t),p(null,e)};o||m();for(var h=function(e){var t=a[e],n=i[t],r=n[0],l=n[1],h=B(),g=r.length;h.p(r);var _=_e(t),v=_.length,y=l.comment,b=y&&_e(y),x=b&&b.length,S=Se(l.extra),C=l.level==0?0:8,w=function(n,r){if(n)f(),p(n,null);else{var i=r.length;u[e]=H(l,{size:g,crc:h.d(),c:r,f:_,m:b,u:v!=t.length||b&&y.length!=x,compression:C}),s+=30+v+S+i,c+=76+2*(v+S)+(x||0)+i,--o||m()}};if(v>65535&&w(k(11,0,1),null),!C)w(null,r);else if(g<16e4)try{w(null,ue(r,l))}catch(e){w(e,null)}else d.push(le(r,l,w))},g=0;g<l;++g)h(g);return f}var Ee=typeof queueMicrotask==`function`?queueMicrotask:typeof setTimeout==`function`?setTimeout:function(e){e()};function De(e,t,n){n||(n=t,t={}),typeof n!=`function`&&k(7);var i=[],a=function(){for(var e=0;e<i.length;++e)i[e]()},o={},s=function(e,t){Ee(function(){n(e,t)})};Ee(function(){s=n});for(var c=e.length-22;Z(e,c)!=101010256;--c)if(!c||e.length-c>65558)return s(k(13,0,1),null),a;var l=X(e,c+8);if(l){var u=l,d=Z(e,c+16),f=Z(e,c-20)==117853008;if(f){var p=Z(e,c-12);f=Z(e,p)==101075792,f&&(u=l=Z(e,p+32),d=Z(e,p+48))}for(var m=t&&t.filter,h=function(t){var n=be(e,d,f),c=n[0],u=n[1],p=n[2],h=n[3],g=n[4],_=n[5],v=ye(e,_);d=g;var y=function(e,t){e?(a(),s(e,null)):(t&&(o[h]=t),--l||s(null,o))};if(!m||m({name:h,size:u,originalSize:p,compression:c})){if(!c)y(null,D(e,v,v+u));else if(c==8){var b=e.subarray(v,v+u);if(p<524288||u>.8*p)try{y(null,fe(b,{out:new r(p)}))}catch(e){y(e,null)}else i.push(de(b,{size:p},y))}else y(k(14,`unknown compression type `+c,1),null)}else y(null,null)},g=0;g<u;++g)h(g)}else s(null,{});return a}var Oe=[`read`,`write`,`auto`,`full`],ke={stoppable:!0,progress:!0},Ae={stoppable:!1,progress:!1},je=`final_remark`,Me={codex_cli:{platform:`Codex`,label:`Codex CLI`,kind:`cli`,location:`executable`,fields:[`project_id`,`project_name`],efforts:[`low`,`medium`,`high`,`xhigh`,`max`,`ultra`],models:!0,access_levels:Oe,per_tool_allow:!1,access_hints:{read:`只读沙箱`,write:`项目可写的沙箱,命令在沙箱内运行、可联网`,auto:`沙箱外的操作由模型申请提权,Codex 自动审核代替人工批准`,full:`无沙箱、无审批(--dangerously-bypass-approvals-and-sandbox)`},client:`codex`,adopt:`session`,host_existing:!0,session_family:`codex`,browse_sessions:!0,capabilities:{delivery:ke,rewind:`cut`,project:!0,access_env:!0,enforces_read_only:!0,limits_directories:!0,ripgrep:!0,chat:!0,resume:!0,images:!0,capture:je,close_grace_ms:1500}},codex:{platform:`Codex`,label:`Codex App`,kind:`app`,location:`executable`,fields:[`source_thread_id`,`project_id`,`project_name`],efforts:null,models:!1,access_levels:null,per_tool_allow:!1,client:`codex`,adopt:`session`,host_existing:!0,session_family:`codex`,browse_sessions:!0,capabilities:{delivery:Ae,rewind:`cut`,project:!0,chat:!0,capture:!1}},claude:{platform:`Claude`,label:`Claude Code`,kind:`cli`,location:`executable`,fields:[`allowed_tools`],efforts:[`low`,`medium`,`high`,`xhigh`,`max`],models:!0,access_levels:Oe,per_tool_allow:!0,access_hints:{read:`只放行网站命令与草稿,不改项目文件、不跑其他命令`,write:`可改项目文件,Bash / PowerShell 命令全部放行(无沙箱)`,auto:`Claude auto 模式:由分类器判断,实测项目外写入和联网都会放行`,full:`bypassPermissions:跳过全部权限检查`},client:`claude`,adopt:`own_cwd`,host_existing:!0,restore_manual:!0,browse_sessions:!0,resume_command:e=>`claude --resume ${e}`,windows_command:`codiscuss`,capabilities:{delivery:ke,rewind:`cut`,project:!0,access_env:!0,chat:!0,resume:!0,images:!0,capture:je}},antigravity_cli:{platform:`Antigravity`,label:`Antigravity CLI`,kind:`cli`,location:`executable`,fields:[`project_id`,`project_name`],efforts:[`low`,`medium`,`high`,`xhigh`,`max`],efforts_per_model:!0,models:!0,defaults_by_query:!0,access_levels:[`read`,`write`,`full`],per_tool_allow:!0,access_hints:{read:`只放行网站命令;碰到未放行的命令会直接结束本轮`,write:`可写项目,命令全部放行(在 agy 沙箱内)`,full:`跳过全部权限确认(--dangerously-skip-permissions),并放开沙箱外命令与 MCP 工具`},unsupported_hints:{auto:`agy 只在交互窗口提供自动模式,后台运行(-p)不支持`},client:`antigravity`,adopt:`session`,host_existing:!1,own_project_when_bound:!0,browse_sessions:!0,capabilities:{delivery:ke,rewind:`cut`,project:!0,access_env:!0,chat:!0,capture:je},task_rules:(e,{runs_commands:t})=>(t?``:`无人值守下 run_command 只能运行 ${e} 的 subcommands 子命令,其他命令会被自动拒绝并使会话直接结束;列目录、搜索或读取文件用你环境自带的文件工具,不要经 run_command。`)+`多步任务中,在关键转折处用一句话写出进展再继续:agy 不输出思考过程,网页只能靠这些话显示你做到哪一步。`},antigravity:{platform:`Antigravity`,label:`Antigravity App`,kind:`app`,location:`ipc_directory`,fields:[`project_id`,`project_name`],efforts:null,models:!1,access_levels:null,per_tool_allow:!1,client:`antigravity`,adopt:`session`,host_existing:!0,capabilities:{delivery:Ae,rewind:`kept`,project:!0,chat:!0,capture:!1}},api:{platform:``,label:`模型 API`,kind:`api`,location:``,fields:[`base_url`,`api_protocol`,`api_key_ref`,`image_input`],efforts:[`low`,`medium`,`high`],models:!1,access_levels:[`read`,`write`],per_tool_allow:!1,adopt:``,host_existing:!1,access_hints:{read:`用接入程序的文件工具读取、搜索项目文件,可运行工作流登记的只读命令`,write:`还可新建、覆盖、局部编辑项目文件,可运行工作流登记的全部命令;没有通用命令行`},unsupported_hints:{auto:`API 成员没有通用命令行,没有需要软件审批的操作`,full:`API 成员没有通用命令行,没有需要软件审批的操作`},capabilities:{delivery:ke,rewind:`cut`,project:!0,file_tools:!0,limits_directories:!0,chat:!0,images:`configured`,capture:!1}}};Object.keys(Me);function Ne(e){let t=Me[e];return t?{id:e,session_family:e,windows_command:`codiscuss.cmd`,...t}:null}var Pe=6e4,Fe=80,Ie=`AI CoDiscuss 聊天室备份
|
|
2
2
|
|
|
3
3
|
完整数据.json:指定聊天室在导出时的数据库快照,保留全部原始字段、编号和关联。
|
|
4
4
|
讨论记录.md:便于离线阅读的资料、消息原文与发言安排,正文以文本块原样保留。
|