ai_co_discuss 0.5.16 → 0.5.17

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.
@@ -59,7 +59,7 @@ You can also send a message from the blank home page to create a room and send i
59
59
 
60
60
  Either way, readers see the room’s **Messages** and **Runs** views from the beginning, as they look here: cards and run details open; each time **Runs** is opened it replays the session from the start, and “End replay” returns to the final state. The other tabs, such as **Private**, **Room** and **Files**, are dimmed and show only a sample; but nothing can be sent or changed, and the page shows the room as it was when it was made. Private chats, the event log, scheduling decisions, refused actions, queued messages, paths on this computer, session IDs and credentials are left out, as are retracted or rewound messages; failure reasons read only “Run failed”, and the room’s project folders are rewritten in message text as paths inside the project. The rest of the message text is shared as written, so check it before sending.
61
61
 
62
- Attachments are left out by default, and attachment tags in messages read “not included in the share”. When the room has attachments, the confirmation offers “Include attachments”: ticked, every attachment (images, videos, web pages, documents and so on) goes into the page as it is, for readers to view and download; project files a member’s answer delivered (the file cards under the answer) come along too, as attachments of that answer. Text attachments are checked for keys and local folders too; the contents of images, videos and other files cannot be checked, so look through them yourself. A share link carries the attachments the page can preview — images, audio, video, PDF, Word/Excel/PowerPoint (docx, xlsx, pptx), text and code, zip archives, and web pages — for readers to open right in the page; scripts that run on a double click, such as js, bat and ps1, go with .txt added to their names. Programs and old doc/xls/ppt files stay off the share site and their messages read “not included in the share”, while a downloaded web page file still carries them. Web page attachments run on the share page as they do in the room, and demos a member’s answer refers to show inside the message; they run in an isolated frame that cannot read the share page, send requests or submit forms. Attachments do not count toward the 5 MB of text: a share link uploads them one by one, up to 100 MB in all, with the publish button showing the progress; above that, untick them or use the web page file, which also carries at most 100 MB of attachments.
62
+ Attachments are left out by default, and attachment tags in messages read “not included in the share”. When the room has attachments, the confirmation offers “Include attachments”: ticked, every attachment (images, videos, web pages, documents and so on) goes into the page as it is, for readers to view and download; project files a member’s answer delivered (the file cards under the answer) come along too, as attachments of that answer. Text attachments are checked for keys and local folders too; the contents of images, videos and other files cannot be checked, so look through them yourself. A share link carries the attachments the page can preview — images, audio, video, PDF, Word/Excel/PowerPoint (docx, xlsx, pptx), text and code, zip archives, and web pages — for readers to open right in the page; scripts that run on a double click, such as js, bat and ps1, go with .txt added to their names. Programs and old doc/xls/ppt files stay off the share site and their messages read “not included in the share”, while a downloaded web page file still carries them. Web page attachments run on the share page as they do in the room, and demos a member’s answer refers to show inside the message; they run in an isolated frame that cannot read the share page, send requests or submit forms. Once ticked, the attachments are listed by kind (archives, video, audio, images, documents, web pages, text and code) with their count and size; untick a whole kind, or click “Choose files” to unfold it and tick files one by one (largest first), and its tags in messages read “not included in the share”. Attachments do not count toward the 5 MB of text: a share link uploads them one by one, up to 300 MB in all (100 MB per file), with the publish button showing the progress; above that, untick some attachments. A downloaded web page file carries at most 100 MB of attachments.
63
63
  - **Import rooms.** In directory options or a folder menu, select “Import rooms” and choose a ZIP. Review the preview and confirm the rooms to import. A room marked “Already exists; skipped” is left as is. On the same computer, invite members back to resume their sessions. Claude Code members switch to manual connection on import. Re-register them from their original window to avoid splitting the session. Imported discussion history is kept, but discussions are not restarted and members are not woken automatically.
64
64
  - **Branch from a message.** In an AI message menu, select “Branch from here” to create a room containing the history through that message. Connections that support session branching resume from the branched session in the new room. The original room is kept.
65
65
  - **Let the host create rooms.** With “Create rooms” ticked in “Host permissions”, the host can move part of the work into a new room. Members use only software configured on this computer, with read-only project access by default and at most write. The project folder must be the original room’s folder or a folder inside it. Unless you name another host, the new room is hosted by the same expert as the original host. Each room gets a “Linked room” card; select “Open room” to go to the other one. The new room takes your default host permissions, except that it cannot create rooms. A room can create a limited number of rooms (3 by default, adjustable in “Host permissions”). The hosts of two linked rooms can speak in each other’s room; those messages are labelled “From host … of room "…"” and wake the other room like your own messages. There is no limit by default. To cap it, set “Linked-room message limit” under “Advanced settings” in the new-room form (it applies to every linked room on this computer); counting from your last message in either room, messages beyond it are refused until you send a message.
@@ -59,7 +59,7 @@
59
59
 
60
60
  两种方式看到的都是这个房间的“消息”和“执行”两页,从头阅读,外观与本机一致,卡片和执行详情都能点开;每次进入“执行”都会从头自动回放协作过程,点“结束回放”回到最终状态。“私聊”“房间”“文件”等标签灰显,只展示示意。但不能发消息或做任何操作;内容停在生成那一刻。私聊、事件记录、调度决策、被拒操作、排队消息、本机路径、会话编号与凭据不会写进去,已撤回或回退的消息也不带;失败原因只写“执行失败”,房间项目目录在正文里改写成项目内的相对路径。消息正文其余部分原样公开,发出前请核对。
61
61
 
62
- 附件默认不带,消息里的附件标记显示为“未包含在分享中”。房间有附件时,确认框里有“包含附件”,勾选后所有附件(图片、视频、网页、文档等)原样放进分享页,读者可以查看和下载;成员回答里交付的项目文件(回答下方的文件卡片)也会作为该条回答的附件一起带上。文本类附件会一并检查疑似密钥和本机目录;图片、视频等文件的内容程序查不了,请自己核对。发布链接带上页面能预览的附件:图片、音视频、PDF、Word/Excel/PowerPoint(docx、xlsx、pptx)、文本与代码、zip 压缩包和网页,读者在分享页里直接打开;js、bat、ps1 等双击就会运行的脚本改名为 .txt 后带上。程序和旧版 doc/xls/ppt 不放到分享站,消息里显示“未包含在分享中”,下载的网页文件仍会带上。网页附件在分享页里照常运行,成员回答里引用的演示直接显示在消息中;它在隔离的框架里运行,读不到分享页,也不能联网请求或提交表单。附件不计入文字的 5 MB,发布链接时逐个上传,合计最多 100 MB,发布按钮会显示上传进度;超过时取消勾选或改用网页文件(同样最多带 100 MB 附件)。
62
+ 附件默认不带,消息里的附件标记显示为“未包含在分享中”。房间有附件时,确认框里有“包含附件”,勾选后所有附件(图片、视频、网页、文档等)原样放进分享页,读者可以查看和下载;成员回答里交付的项目文件(回答下方的文件卡片)也会作为该条回答的附件一起带上。文本类附件会一并检查疑似密钥和本机目录;图片、视频等文件的内容程序查不了,请自己核对。发布链接带上页面能预览的附件:图片、音视频、PDF、Word/Excel/PowerPoint(docx、xlsx、pptx)、文本与代码、zip 压缩包和网页,读者在分享页里直接打开;js、bat、ps1 等双击就会运行的脚本改名为 .txt 后带上。程序和旧版 doc/xls/ppt 不放到分享站,消息里显示“未包含在分享中”,下载的网页文件仍会带上。网页附件在分享页里照常运行,成员回答里引用的演示直接显示在消息中;它在隔离的框架里运行,读不到分享页,也不能联网请求或提交表单。勾选后下方按类型(压缩包、视频、音频、图片、文档、网页、文本与代码)列出数量和大小,可取消整类,也可点“逐个选择”展开该类、按文件勾选(大的在前),取消的附件在消息里显示“未包含在分享中”。附件不计入文字的 5 MB,发布链接时逐个上传,合计最多 300 MB(单个最多 100 MB),发布按钮会显示上传进度;超过时取消勾选部分附件。网页文件最多带 100 MB 附件。
63
63
  - **导入房间**:目录选项或文件夹菜单 → “导入房间”,选择 ZIP 文件,在预览中确认要导入的房间;标为“已存在,跳过”的房间会保留原样。在同一台电脑导入后,请回成员会续接原会话(Claude Code 成员会改为手动接入,请回后在原窗口重新注册,避免会话分叉)。导入保留历史讨论记录,不会自动继续原讨论或重新唤醒成员。
64
64
  - **从某条消息分支**:AI 发言菜单 → “从这里分支”,新建一个保留截至该条发言记录的房间。支持会话分叉的接入方式会在新房间续接分叉后的会话;原房间保留。
65
65
  - **让主持人新建房间**:在“主持人权限”里勾选“新建房间”后,主持人可以把一部分工作拆到新房间:成员只用本机已配置的软件,项目权限默认只读、最高可写,项目目录只能是原房间的目录或其子目录;你没指定时由与原主持人同款的专家主持。两个房间各留一张“关联房间”卡片,点“打开房间”互相跳转。新房间的主持人权限按你的默认设置,但不能再新建房间;一个房间可新建的数量有上限(默认 3 个,可在“主持人权限”里调整)。两个关联房间的主持人可以互相发言,这些消息标注“来自房间「…」的主持人 …”,按你的消息唤醒对方房间;默认不限条数;担心两边来回不停,可在新建房间面板“高级设置”里设“关联房间互传上限”(对本机所有关联房间生效),从你上次在任一房间发言算起超过这个条数会被拒绝,你发一条消息即可让它们继续。
@@ -447,17 +447,22 @@
447
447
  "附件原样公开。文本类附件已一并检查;图片、视频和其他文件的内容程序查不了,请自己核对。": "Attachments are published as they are. Text attachments were checked too; the contents of images, videos and other files cannot be checked, so look through them yourself.",
448
448
  "不包含时,消息里的附件标记显示为“未包含在分享中”。": "Without them, attachment tags in messages read “not included in the share”.",
449
449
  "正在检查文本类附件…": "Checking text attachments…",
450
+ "{kind} {count} 个 · {size}": "{kind} · {count} · {size}",
451
+ "已选 {size};发布链接最多带 300 MB 附件(单个 100 MB),网页文件最多 100 MB。": "{size} selected; a share link carries at most 300 MB of attachments (100 MB per file), and a web page file at most 100 MB.",
452
+ "文本与代码": "Text and code",
453
+ "逐个选择": "Choose files",
450
454
  "附件读取失败({status})": "Could not read the attachment ({status})",
451
455
  "附件 {name} 在发布期间有变化,请重新打开“分享为网页…”再发布": "The attachment {name} changed while publishing; open “Share as web page…” again and publish",
452
456
  "附件 {name} 上传失败:{value1}": "Uploading the attachment {name} failed: {value1}",
453
- "附件合计 {size},超过分享链接 100 MB 的上限;请取消“包含附件”,或改用“下载网页文件”。": "The attachments total {size}, more than the 100 MB a share link can carry; untick “Include attachments” or use “Download web page file”.",
457
+ "附件 {name} 有 {size},超过分享链接单个附件 100 MB 的上限;请取消勾选它。": "The attachment {name} is {size}, over the 100 MB per-file limit for share links; untick it.",
458
+ "附件合计 {size},超过分享链接 300 MB 的上限;请取消勾选部分附件。": "The attachments total {size}, more than the 300 MB a share link can carry; untick some attachments.",
454
459
  "这个房间的文字整理后有 {size},超过分享链接 5 MB 的上限;请改用“下载网页文件”。": "The room’s text comes to {size} after cleaning, more than the 5 MB a share link can carry; use “Download web page file” instead.",
455
460
  "链接已发布,但附件没有传完,读者会看到“附件读取失败”;可再点“更新链接”重传。{value1}": "The link is published, but not all attachments were sent, so readers will see “Could not read the attachment”; click “Update link” to send them again. {value1}",
456
461
  "正在上传附件 {done}/{total}": "Uploading attachments {done}/{total}",
457
462
  "{names} 不能放到分享站:发布链接时不带,消息里显示“未包含在分享中”;下载网页文件仍会带上。": "{names} cannot go on the share site: a published link leaves them out and their messages read “not included in the share”; a downloaded web page file still carries them.",
458
463
  " 等 {count} 个": " and others, {count} in all",
459
464
  "读取失败,没能检查,请自己核对": "Could not be read or checked; look through it yourself",
460
- "附件共 {size},超过网页文件能带的 100 MB;请取消“包含附件”,附件另行发送。": "The attachments total {size}, more than the 100 MB a page file can carry; untick “Include attachments” and send them separately.",
465
+ "附件共 {size},超过网页文件能带的 100 MB;请取消勾选部分附件,或改用“发布链接”。": "The attachments total {size}, more than the 100 MB a page file can carry; untick some attachments or use “Publish link”.",
461
466
  "这个房间连同附件整理后有 {size},超过分享链接 5 MB 的上限;请取消“包含附件”,或改用“下载网页文件”。": "This room with its attachments comes to {size}, over the 5 MB limit for share links; untick “Include attachments” or use “Download web page” instead.",
462
467
  "#{id} 的附件 {name}": "Attachment {name} of #{id}",
463
468
  "分享页面不包含这个附件": "This shared page does not include this attachment",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai_co_discuss",
3
- "version": "0.5.16",
3
+ "version": "0.5.17",
4
4
  "bin": {
5
5
  "codiscuss": "runner/codiscuss.mjs"
6
6
  },
@@ -484,7 +484,7 @@ export function browse_sessions(raw, { accept = null, list = software_sessions,
484
484
  if (!adapter_of(input.adapter)) throw new Error(`适配器只能为 ${ADAPTER_IDS.join('/')}`);
485
485
  if (input.action === 'preview') {
486
486
  const result = preview(input.adapter, input.session_id);
487
- if (accept && !accept(result.cwd)) throw new Error('电脑未允许其他设备查看这个目录里的会话;请在电脑上把该目录加入常用项目');
487
+ if (accept && !accept(result.cwd)) throw new Error(t('出于安全考虑,其他设备只能查看这台电脑“常用项目”目录里的会话,「{path}」不在其中。请回到这台电脑上打开共议网页,在“新建房间”的项目目录里填入这个路径并点“加入常用项目”,之后再试。', { path: result.cwd || '' }));
488
488
  return { adapter: input.adapter, ...result };
489
489
  }
490
490
  if (input.action !== undefined && input.action !== 'list') throw new Error('action 只能为 list 或 preview');
@@ -29,6 +29,7 @@ export default {
29
29
  "正在连接 {host}。": "Connecting to {host}.",
30
30
  "心跳超过 {seconds} 秒未回应": "no heartbeat response for {seconds} seconds",
31
31
  "连接已断开,关闭代码 {code}": "connection closed with code {code}",
32
+ "请求 {address} 失败({code})": "Request to {address} failed ({code})",
32
33
  "连接被重置,请检查本机网络或代理": "connection reset; check this computer’s network or proxy",
33
34
  "连接超时,请检查本机网络或代理": "connection timed out; check this computer’s network or proxy",
34
35
  "无法解析网站域名": "website hostname could not be resolved",
@@ -605,5 +606,7 @@ export default {
605
606
  "本机尚未注册发布身份,无法操作该站点": "This computer has not registered a publishing identity yet and cannot manage this site",
606
607
  "未知的站点命令:{command}": "Unknown site command: {command}",
607
608
  "AI CoDiscuss 网站部署\n\n注意:发布到公网须有用户在本房间的明确授权;未经用户明确要求发布时,仅使用 stage 在本机预检登记。\n\n用法:\n codiscuss site stage (--dir 目录 | --file 文件.html) [--room 房间] [--title 标题] [--exclude 路径]\n codiscuss site publish (--dir 目录 | --file 文件.html | --stage 编号) [--site 站点编号] [--room 房间] [--title 标题] [--exclude 路径]\n codiscuss site list [--room 房间]\n codiscuss site renew <站点编号> [--room 房间]\n codiscuss site rollback <站点编号> [--version 版本号] [--room 房间]\n codiscuss site revoke <站点编号> [--room 房间]\n\n选项:\n --access-file FILE 任务凭据文件(默认读取 DISCUSS_ACCESS_FILE)\n --room ROOM 房间编号(凭据绑定时自动补齐)\n --url SITE 本机/房间网站地址(凭据绑定时自动补齐)\n --dir PATH 要发布的本机构建目录\n --file PATH 要发布的单个 HTML 文件\n --stage ID 对已预检的待部署编号执行发布\n --site ID 更新已有 10 位站点编号\n --title TEXT 站点标题\n --exclude PATH 排除的相对文件路径(可重复传多次)\n --version N 回滚目标版本号(省略则回滚到上一版)\n --json 以 JSON 输出(默认)\n -h, --help 显示帮助\n": "AI CoDiscuss Website Deployment\n\nNotice: publishing to the public internet requires explicit user authorization in this room; without it, only run `stage` for local preflight.\n\nUsage:\n codiscuss site stage (--dir DIR | --file FILE.html) [--room ROOM] [--title TITLE] [--exclude PATH]\n codiscuss site publish (--dir DIR | --file FILE.html | --stage ID) [--site SITE_ID] [--room ROOM] [--title TITLE] [--exclude PATH]\n codiscuss site list [--room ROOM]\n codiscuss site renew <SITE_ID> [--room ROOM]\n codiscuss site rollback <SITE_ID> [--version N] [--room ROOM]\n codiscuss site revoke <SITE_ID> [--room ROOM]\n\nOptions:\n --access-file FILE Task credential file (defaults to DISCUSS_ACCESS_FILE)\n --room ROOM Room ID (auto-filled when bound by credential)\n --url SITE Local/room site URL (auto-filled when bound by credential)\n --dir PATH Local build directory to deploy\n --file PATH Single HTML file to deploy\n --stage ID Publish a previously staged record\n --site ID Update an existing 10-character site ID\n --title TEXT Site title\n --exclude PATH Relative file path to exclude (repeatable)\n --version N Target version for rollback (defaults to previous version)\n --json Output JSON (default)\n -h, --help Show help\n",
608
- "未知子命令:{sub};运行 codiscuss site --help 查看用法": "Unknown subcommand: {sub}; run `codiscuss site --help` for usage"
609
+ "未知子命令:{sub};运行 codiscuss site --help 查看用法": "Unknown subcommand: {sub}; run `codiscuss site --help` for usage",
610
+ "出于安全考虑,手机、平板等其他设备只能使用这台电脑“常用项目”里的目录,「{path}」不在其中,所以没有执行。请回到这台电脑上打开共议网页:在“新建房间”的项目目录里填入这个路径,点路径右侧的“加入常用项目”,之后其他设备就能直接选它;也可以加入它的上级目录。": "For security, phones, tablets and other devices can only use folders in this computer's “Saved projects”, and “{path}” is not one of them, so nothing was done. On this computer, open CoDiscuss, enter this path as the project folder under “New room”, then click “Add to saved projects” next to it; other devices can then pick it. You can also add a parent folder.",
611
+ "出于安全考虑,其他设备只能查看这台电脑“常用项目”目录里的会话,「{path}」不在其中。请回到这台电脑上打开共议网页,在“新建房间”的项目目录里填入这个路径并点“加入常用项目”,之后再试。": "For security, other devices can only view sessions in this computer's “Saved projects” folders, and “{path}” is not one of them. On this computer, open CoDiscuss, enter this path as the project folder under “New room”, click “Add to saved projects”, then try again.",
609
612
  };
@@ -56,7 +56,8 @@ export function remote_roots(projects) {
56
56
  * service's own directory. Returns the real path.
57
57
  */
58
58
  export function remote_directory(path, { roots, home }) {
59
- const refused = new Error(`电脑未允许其他设备使用这个目录:${typeof path === 'string' ? path : ''}。请在电脑上把它(或它的上级目录)加入常用项目`);
59
+ // Say why and exactly how to allow it: the device asking cannot change the list itself (Design_远程访问安全.md).
60
+ const refused = new Error(t('出于安全考虑,手机、平板等其他设备只能使用这台电脑“常用项目”里的目录,「{path}」不在其中,所以没有执行。请回到这台电脑上打开共议网页:在“新建房间”的项目目录里填入这个路径,点路径右侧的“加入常用项目”,之后其他设备就能直接选它;也可以加入它的上级目录。', { path: typeof path === 'string' ? path : '' }));
60
61
  if (!plain_absolute(path)) throw refused;
61
62
  let real;
62
63
  try { real = realpathSync(path); } catch { throw refused; }
@@ -370,6 +370,21 @@ export function scan_site_source(real_target, kind, exclude = []) {
370
370
  };
371
371
  }
372
372
 
373
+ /** Annotate transport failures without exposing credentials or query parameters. */
374
+ async function deployment_fetch(fetcher, url, init) {
375
+ try {
376
+ return await fetcher(url, init);
377
+ } catch (error) {
378
+ const target = new URL(url);
379
+ const address = target.origin + target.pathname;
380
+ const code = error.cause?.code || error.cause?.errors?.find(item => item.code)?.code || error.code;
381
+ if (!code && error.message !== 'fetch failed') throw error;
382
+ throw new SiteCommandError(t('请求 {address} 失败({code})', { address, code: code || 'NETWORK_ERROR' }), {
383
+ code: 'network_error', http_status: 503,
384
+ });
385
+ }
386
+ }
387
+
373
388
  /** Keep private device_token exclusively inside `~/.codiscuss/site-devices.json` (mode 0600). */
374
389
  async function ensure_device_identity(home, origin, fetcher = fetch) {
375
390
  mkdirSync(home, { recursive: true, mode: 0o700 });
@@ -378,7 +393,7 @@ async function ensure_device_identity(home, origin, fetcher = fetch) {
378
393
  if (store[origin]?.device_id && store[origin]?.device_token) {
379
394
  return store[origin];
380
395
  }
381
- const res = await fetcher(`${origin}/api/devices`, {
396
+ const res = await deployment_fetch(fetcher, `${origin}/api/devices`, {
382
397
  method: 'POST',
383
398
  headers: { 'Content-Type': 'application/json', 'Accept-Language': 'zh-CN' },
384
399
  body: '{}',
@@ -426,7 +441,7 @@ async function room_api_request(site, path, { method = 'GET', token = '', body =
426
441
  if (body !== undefined) headers['Content-Type'] = 'application/json';
427
442
  // A protected local site only accepts requests that pass the entry handshake (entry_client.mjs).
428
443
  const send = fetcher === fetch ? site_fetch : fetcher;
429
- const res = await send(`${site.replace(/\/+$/, '')}${path}`, {
444
+ const res = await deployment_fetch(send, `${site.replace(/\/+$/, '')}${path}`, {
430
445
  method,
431
446
  headers,
432
447
  ...(body !== undefined ? { body: JSON.stringify(body) } : {}),
@@ -446,7 +461,7 @@ async function worker_api(origin, path, { method = 'GET', token = '', body = und
446
461
  } else if (body !== undefined) {
447
462
  headers['Content-Type'] = 'application/json';
448
463
  }
449
- const res = await fetcher(`${origin}${path}`, {
464
+ const res = await deployment_fetch(fetcher, `${origin}${path}`, {
450
465
  method,
451
466
  headers,
452
467
  ...(raw_body !== undefined ? { body: raw_body } : body !== undefined ? { body: JSON.stringify(body) } : {}),