ai_co_discuss 0.4.60 → 0.4.62

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.
@@ -618,9 +618,15 @@ def failure_class_of(connection, execution_id):
618
618
 
619
619
 
620
620
  def quota_held_until(connection, member_id):
621
- """Until when a member out of quota waits: its latest execution failed on a usage limit and was not retried; else 0."""
621
+ """Until when a member out of quota waits: its latest execution failed on a usage limit and was not retried; else 0.
622
+
623
+ A new request the owner or the host gives it afterwards ends the wait and is tried at once: the reset time is only
624
+ the software's estimate (extra usage, another plan, another account signed in or an earlier reset lift it sooner),
625
+ and work nobody picks up is worse than one more quick failure, which holds the member again."""
622
626
  row = connection.execute("""SELECT f.failed_at,f.reset_at FROM execution_failures f
623
- WHERE f.failure_class='quota' AND f.execution_id=(SELECT MAX(id) FROM member_executions WHERE member_id=?)""", (member_id,)).fetchone()
627
+ WHERE f.failure_class='quota' AND f.execution_id=(SELECT MAX(id) FROM member_executions WHERE member_id=?)
628
+ AND NOT EXISTS(SELECT 1 FROM member_requests r WHERE r.member_id=? AND r.status='pending' AND r.created_by IN ('user','host')
629
+ AND r.created_at>=f.failed_at)""", (member_id, member_id)).fetchone()
624
630
  until = (row["reset_at"] or row["failed_at"] + QUOTA_HOLD_SECONDS) if row else 0
625
631
  return until if until > int(time.time()) else 0
626
632
 
@@ -931,8 +937,11 @@ def recent_executions(connection, room_id, span=None):
931
937
  query = f"""SELECT e.*,m.name AS member,
932
938
  (SELECT json_group_array(id) FROM member_requests WHERE execution_id=e.id) AS request_ids,
933
939
  (SELECT MAX(answer_id) FROM member_requests WHERE execution_id=e.id) AS answer_id,
934
- (SELECT MIN(message_id) FROM member_requests WHERE execution_id=e.id) AS request_message_id,
935
- (SELECT MIN({LAYOUT_AFTER_SQL}) FROM member_requests r WHERE r.execution_id=e.id) AS layout_after,
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,
936
945
  (SELECT MIN({LAYOUT_AT_SQL}) FROM member_requests r WHERE r.execution_id=e.id) AS layout_at,
937
946
  (SELECT COUNT(*) FROM execution_notes WHERE execution_id=e.id) AS note_count,
938
947
  (SELECT denials FROM execution_denials WHERE execution_id=e.id) AS denials,{CAPABILITY_COLUMNS},
@@ -957,6 +966,7 @@ def recent_executions(connection, room_id, span=None):
957
966
  "notes": row["note_count"], "denials": json.loads(row["denials"] or "[]"),
958
967
  "capabilities": reported_capabilities(row), "stop_result": row["stop_result"] or "",
959
968
  "late_answer": json.loads(row["late_answer"]) if row["late_answer"] else None, "background": bool(row["background"]),
969
+ "retried": bool(row["retried"]),
960
970
  "interjections": execution_interjections(connection, row["id"], row["status"]),
961
971
  "retry": execution_retry(connection, row["id"])})
962
972
  return executions
@@ -1062,6 +1072,7 @@ def free_view(connection, room_id):
1062
1072
  member["pending"] = connection.execute("SELECT COUNT(*) FROM member_requests WHERE member_id=? AND status='pending'",
1063
1073
  (row["id"],)).fetchone()[0]
1064
1074
  member["held_until"] = held_until(connection, row["id"])
1075
+ member["quota_until"] = quota_held_until(connection, row["id"])
1065
1076
  members.append(member)
1066
1077
  names = {row["id"]: row["name"] for row in connection.execute("SELECT id,name FROM room_members WHERE room_id=?", (room_id,))}
1067
1078
  requests = [{**dict(row), "member": names.get(row["member_id"], ""),
@@ -2643,15 +2654,17 @@ def hand_over_routes(connection, room_id, routes, departed_id):
2643
2654
  VALUES (?,?,?,?,?,'user',?)""", (room_id, host["id"], message_id, message_id, purpose, int(time.time())))
2644
2655
 
2645
2656
 
2646
- def stop_member_work(connection, member_id, reason, cancel_reason, keep_pending=False):
2657
+ def stop_member_work(connection, member_id, reason, cancel_reason, keep_pending=False, requeue=False):
2647
2658
  """Void a member's live execution and, unless `keep_pending`, every open request, so nothing restarts by itself.
2648
2659
 
2649
2660
  The owner's stop keeps the requests that arrived while the member worked: like interrupting a turn, the member then
2650
- goes on to the messages sent after it, while a member that leaves drops them all.
2661
+ goes on to the messages sent after it, while a member that leaves drops them all. With `requeue` (the owner sending
2662
+ a message at once) the interrupted turn's own requests go back to pending too, so the next delivery carries them with
2663
+ the new message and nothing the owner asked is left unanswered.
2651
2664
  """
2652
2665
  for row in connection.execute("SELECT id FROM member_executions WHERE member_id=? AND status IN ('dispatched','started')",
2653
2666
  (member_id,)).fetchall():
2654
- finish_execution(connection, row["id"], "cancelled", reason, "cancelled", cancel_reason)
2667
+ finish_execution(connection, row["id"], "cancelled", reason, "pending" if requeue else "cancelled", "" if requeue else cancel_reason)
2655
2668
  if not keep_pending:
2656
2669
  record_cancel_reasons(connection, "member_id=? AND status='pending'", (member_id,), cancel_reason)
2657
2670
  connection.execute("UPDATE member_requests SET status='cancelled' WHERE member_id=? AND status='pending'", (member_id,))
@@ -2808,6 +2821,7 @@ def inbox(connection, room_id, token):
2808
2821
  member_view["label"] = shown.get(row["name"], row["name"])
2809
2822
  member_view["review_capability"] = review_capability(connection, room_id, row["id"], token)
2810
2823
  member_view["held_until"] = held_until(connection, row["id"])
2824
+ member_view["quota_until"] = quota_held_until(connection, row["id"])
2811
2825
  # The runner compares this with its adapter's effect and reports a change.
2812
2826
  reported = connection.execute("SELECT rewind,image_model FROM member_capabilities WHERE member_id=?", (row["id"],)).fetchone()
2813
2827
  member_view["rewind"], member_view["image_model"] = (reported[0], reported[1]) if reported else ("", "")
@@ -3486,6 +3500,8 @@ def retry_failed(connection, room_id, execution):
3486
3500
  raise FileExistsError(Text("这次执行没有可重试的请求:已重试过,或是讨论发言(由主持人重新安排)"))
3487
3501
  if not connection.execute("SELECT 1 FROM room_members WHERE id=? AND status='active'", (execution["member_id"],)).fetchone():
3488
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])
3489
3505
  connection.execute(f"UPDATE member_requests SET status='pending',execution_id=NULL WHERE id IN ({','.join('?' * len(requests))})",
3490
3506
  [request["id"] for request in requests])
3491
3507
  reopen_batches(connection, room_id, requests)
@@ -3584,7 +3600,7 @@ def interrupt_for_message(connection, room_id, message_id):
3584
3600
  if blocked:
3585
3601
  raise FileExistsError(Text("{value1} 正在执行且无法打断,这条消息继续排队,等它答完后发送", value1='、'.join(blocked)))
3586
3602
  for row in busy:
3587
- stop_member_work(connection, row["member_id"], Text("用户立即发送"), "user_stop", keep_pending=True)
3603
+ stop_member_work(connection, row["member_id"], Text("已打断:你立即发送了新消息,它会连同这条一起处理"), "user_stop", keep_pending=True, requeue=True)
3588
3604
  if busy:
3589
3605
  settle_batches(connection, room_id)
3590
3606
 
@@ -25,8 +25,13 @@ def queueing_enabled(connection):
25
25
 
26
26
 
27
27
  def room_busy(connection, room_id):
28
- """A member still has an open request, a one-after-another turn waits, or a discussion runs."""
29
- return connection.execute("""SELECT 1 FROM member_requests WHERE room_id=? AND status IN ('pending','delivering')
28
+ """A member still has an open request, a one-after-another turn waits, or a discussion runs.
29
+
30
+ Work the host left running in the background (sent without a handoff, or kept working beside it, as in
31
+ free_room.BACKGROUND_SQL) does not hold the owner's messages: the room goes on without waiting for it."""
32
+ return connection.execute("""SELECT 1 FROM member_requests r WHERE r.room_id=? AND r.status IN ('pending','delivering')
33
+ AND NOT (r.purpose='ask' AND r.created_by='host' AND (r.batch_id=0 OR EXISTS(
34
+ SELECT 1 FROM member_requests k WHERE k.message_id=r.message_id AND k.purpose='keep_working')))
30
35
  UNION ALL SELECT 1 FROM free_queue_waiting WHERE room_id=?
31
36
  UNION ALL SELECT 1 FROM discussion_sessions WHERE room_id=? AND status='active' LIMIT 1""",
32
37
  (room_id, room_id, room_id)).fetchone() is not None
@@ -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,
@@ -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
  讨论中新邀请的专家排在本轮队尾。
@@ -534,7 +534,7 @@
534
534
  "用户取消讨论安排": "The user cancelled the discussion plan.",
535
535
  "评审未投递:{reason}": "Review was not delivered: {reason}",
536
536
  "专家 {name} 的讨论请求失败:{reason}。请决定跳过、重排或暂停。": "The discussion request for expert {name} failed: {reason}. Decide whether to skip, reorder, or pause.",
537
- "用户立即发送": "The user sent a message immediately.",
537
+ "已打断:你立即发送了新消息,它会连同这条一起处理": "Interrupted: you sent a new message right away; it takes this one up again together with it",
538
538
  "成员已离开": "The member left.",
539
539
  "成员已移除": "The member was removed.",
540
540
  "主持人已更换": "The host changed.",
@@ -747,5 +747,8 @@
747
747
  "这个会话的末尾没有可显示的对话。": "The end of this session has no messages to show.",
748
748
  "正在读取会话预览…": "Loading the session preview…",
749
749
  "在左侧选择一个会话查看预览。": "Select a session on the left to preview it.",
750
- "接入此会话": "Resume this session"
750
+ "接入此会话": "Resume this session",
751
+ "额度已用尽,预计 {value1} 恢复;给它发新消息会立即再试": "Out of quota, expected back at {value1}; a new message to it is tried at once",
752
+ "保存(Enter)": "Save (Enter)",
753
+ "已重试,新的执行接在下方": "Retried; the new run follows below"
751
754
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai_co_discuss",
3
- "version": "0.4.60",
3
+ "version": "0.4.62",
4
4
  "bin": {
5
5
  "codiscuss": "runner/codiscuss.mjs"
6
6
  },
@@ -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
- const messages = entries.map(message).filter(Boolean);
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; only a manual agy expert the owner chose to host (input.adopt) keeps its own.
903
- if (!facts?.host_existing && profile.session_id && !input.adopt) throw new Error(`${name}:${facts?.label || profile.adapter} 不能绑定已有会话或从当前对话主持全自动讨论;请从网页或其他软件发起,它会由讨论服务新建会话`);
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/web/app.js CHANGED
@@ -1071,7 +1071,10 @@ async function refresh_room_content(room_id, version, versions) {
1071
1071
  cache_room_entry(room_views, room_id, room);
1072
1072
  state.room = merge_room_folder(room, versions.folder, versions.archive, versions.directory);
1073
1073
  render_room();
1074
- publish_view();
1074
+ // With a transcript already shown, the new room state waits for the new transcript and both show in one snapshot:
1075
+ // the room's requests and working cards laid out against the old messages, then again against the new ones, made
1076
+ // the page collapse and refill for a moment after every send. A room opened for the first time shows at once.
1077
+ if (!history_read || !state.messages.length) publish_view();
1075
1078
  load_room_models();
1076
1079
  });
1077
1080
  const history_read = state.tab === "discussion" ? load_message_history(room_id, version).then((result) => {
@@ -1082,6 +1085,7 @@ async function refresh_room_content(room_id, version, versions) {
1082
1085
  if (history_read && !state.messages.length && state.message_history?.key !== history_key) { state.messages_loading = true; publish_view(); }
1083
1086
  try {
1084
1087
  await Promise.all([room_read, history_read]);
1088
+ if (current()) publish_view();
1085
1089
  } catch (error) {
1086
1090
  if (current()) { state.messages_loading = false; state.messages_failure = error.message; publish_view(); }
1087
1091
  throw error;
@@ -1779,14 +1783,21 @@ async function finish_message(result, room_id, drafts) {
1779
1783
  element("search-input").value = "";
1780
1784
  element("mention-filter").setAttribute("aria-pressed", "false");
1781
1785
  state.page = 1;
1782
- state.sending_preview = null;
1783
- // Show the saved message at once; the room, its requests and other new messages follow from a background refresh,
1784
- // so the composer does not wait for further round-trips on a slow connection.
1785
- if (!state.messages.some(message => message.id === result.message.id)) {
1786
- render_messages({ messages: [...state.messages, { ...result.message, just_sent: true }], total: state.message_total + 1, page: 1, pages: 1 });
1787
- }
1788
- element("messages").scrollTop = element("messages").scrollHeight;
1789
- run_action(refresh_room);
1786
+ // The sending card stays, now showing the saved number, until the room is read again: the saved card then takes its
1787
+ // place in the same render as the room's other changes (its request, the host's working card). Swapping it in first
1788
+ // and the rest a moment later laid the transcript out twice, and on a phone the page jumped and flashed in between.
1789
+ const saved_id = result.message.id;
1790
+ if (state.sending_preview) state.sending_preview = { ...state.sending_preview, saved_id };
1791
+ publish_view();
1792
+ refresh_room().catch(() => {}).finally(() => {
1793
+ if (state.sending_preview?.saved_id !== saved_id) return;
1794
+ release_files(state.sending_preview.release || []);
1795
+ state.sending_preview = null;
1796
+ if (state.room?.id === room_id && !state.messages.some(message => message.id === saved_id)) {
1797
+ render_messages({ messages: [...state.messages, { ...result.message, just_sent: true }], total: state.message_total + 1, page: 1, pages: 1 });
1798
+ }
1799
+ publish_view();
1800
+ });
1790
1801
  }
1791
1802
 
1792
1803
  /** A message the site queued: clear the composer; it waits above the composer until the room is idle. */
@@ -1924,7 +1935,8 @@ async function send_message(event) {
1924
1935
  const only_host = named.size === 1 && (state.room.free?.members || []).some(member => named.has(member.name) && member.role === "host" && member.status === "active");
1925
1936
  const likely_queued = payload.queue && !only_host && (queue?.busy || queue?.items?.length);
1926
1937
  state.sending_preview = likely_queued ? null : preview;
1927
- state.queueing_preview = likely_queued ? preview : null;
1938
+ // The rows already queued, so the first snapshot listing a new one swaps it in for this row (see publish_view).
1939
+ state.queueing_preview = likely_queued ? { ...preview, queued_ids: (queue.items || []).map(item => item.id) } : null;
1928
1940
  let sent;
1929
1941
  state.sending_done = new Promise(resolve => { sent = resolve; });
1930
1942
  publish_view();
@@ -1952,11 +1964,14 @@ async function send_message(event) {
1952
1964
  throw error;
1953
1965
  } finally {
1954
1966
  state.sending_message = false;
1967
+ // A saved message's card stays until the saved card replaces it (finish_message), and keeps its file previews till then.
1968
+ const kept = saved && state.sending_preview?.saved_id ? state.sending_preview : null;
1969
+ if (kept) kept.release = drafts;
1955
1970
  // Previews of files not kept by a failed card are no longer shown anywhere.
1956
- if (!state.failed_sends.some((failed) => failed.drafts === drafts)) release_files(drafts);
1971
+ else if (!state.failed_sends.some((failed) => failed.drafts === drafts)) release_files(drafts);
1957
1972
  if (state.sending_drafts === drafts) state.sending_drafts = null;
1958
1973
  sent(saved);
1959
- state.sending_preview = null;
1974
+ if (!kept) state.sending_preview = null;
1960
1975
  state.queueing_preview = null;
1961
1976
  state.upload_status = "";
1962
1977
  element("send-message").disabled = false;
@@ -5450,6 +5465,15 @@ async function initialize() {
5450
5465
 
5451
5466
  /** Publish a presentation snapshot shared by the legacy and Vue renderers. */
5452
5467
  function publish_view() {
5468
+ // A sent message's card gives way in the same snapshot that first holds the saved message.
5469
+ if (state.sending_preview?.saved_id && state.messages.some(message => message.id === state.sending_preview.saved_id)) {
5470
+ release_files(state.sending_preview.release || []);
5471
+ state.sending_preview = null;
5472
+ }
5473
+ // Likewise a queued message's row gives way in the first snapshot listing it in the queue: a room refresh started by
5474
+ // a live update can bring it before the site's answer to the send, and both rows showed until that answer came.
5475
+ const queueing = state.queueing_preview;
5476
+ if (queueing && state.room?.free?.queued_messages?.items?.some(item => !queueing.queued_ids.includes(item.id))) state.queueing_preview = null;
5453
5477
  document.dispatchEvent(new CustomEvent("discuss:view"));
5454
5478
  }
5455
5479
 
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:便于离线阅读的资料、消息原文与发言安排,正文以文本块原样保留。