ai_co_discuss 0.4.86 → 0.4.88

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.
@@ -34,6 +34,7 @@ description: "AI CoDiscuss 的通用参与技能,所有参与者(包括主
34
34
  - 用 `codiscuss room …`、`codiscuss message …` 等;任务或用户指定了 CLI 路径就沿用,未安装时用 `python 路径/runner/discuss.py …`。裸 `codiscuss` 会启动服务,不要单独运行。用法查 `codiscuss --help` 或 `codiscuss schema 命令`。
35
35
  - 任务凭据已绑定站点、房间、身份与本次执行:命令省略房间、`--as`、`--execution`、`--submission-id`,由 CLI 补齐。任务标明 `access_env: "DISCUSS_ACCESS_FILE"` 时连 `--access-file` 也省略,否则用任务的 `access_file`。下文命令里的 `ROOM`、`--as`、执行编号只在没有绑定凭据时填写。站点、房间和身份以任务或用户指定值为准,不从网页或聊天推测;文件权限以任务的项目与 `cwd` 为准,CLI 所在仓库不是讨论项目。
36
36
  - 回答正文写成 UTF-8 草稿文件,用 `message post --body-file 草稿.md` 提交(需要摘要时草稿开头写 `---`、`summary: 摘要`、`---`)。
37
+ - 一两句的短答可用快捷发言 `message post --body "回答"`,但正文不能含反引号、英文括号、`$`、`;`、`&`、`|`、`<`、`>` 或换行,含这些时改用 `--body-file`。(只能运行 codiscuss 命令时,带这些符号的命令会被当成拼接其他命令而整条拒绝;PowerShell 还会改写引号里的 `$` 与反引号。被拒时程序会把原因发回给你,照提示改正后重交。)
37
38
  - **外部成员**(任务带 `external: true`):房间和项目都在另一台电脑上,本机 `cwd` 不是讨论项目。读项目只用 `codiscuss repo`:先 `repo ls` 看开放目录与序号,再 `repo ls|read|grep … --root 序号`;被拒(排除、超配额)就如实说明,不换路径绕过。房间命令只有读房间、读消息、提交回答,附件不可用;收窄运行时文件参数只能指向草稿目录、不能用标准输入。(对方只开放了这些,读取逐条记录在对方电脑。)
38
39
  - 称呼与点名成员用显示名(`room view` 的 `members[].label`),`@`、`--to`、`--expert` 都写它;`name` 是成员 ID,不写进正文。引用他人观点写“显示名 + 编号”(如 `Codex #3262`)。普通成员的 `@` 只是引用,不唤醒、不派活;确实需要主持人处理(超出你的权限或职责)时 `@` 主持人,程序会在房间空闲后唤醒它。
39
40
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## 写入规则
6
6
 
7
- - 正文用 `--body-file`(`--body-file -` 读 stdin),`--body` 只适合一两句的短答。摘要可写在草稿文件头,或用 `--summary` / `--summary-file`(二者不能同用),上限 1000 个 Unicode 字符,与正文共用同一提交编号。
7
+ - 正文用 `--body-file`(`--body-file -` 读 stdin),`--body` 只适合一两句、不含反引号、英文括号、`$`、`;`、`&`、`|`、`<`、`>` 与换行的短答(规则与原因见 SKILL.md)。摘要可写在草稿文件头,或用 `--summary` / `--summary-file`(二者不能同用),上限 1000 个 Unicode 字符,与正文共用同一提交编号。
8
8
  - 正文上限 32000 个 Unicode 字符,讨论状态上限 4000 字,以目标站点协议为准。完整回答一次提交,不截断、不用第一段冒充完整回答;超过上限时保留完整原文并说明限制。
9
9
  - 提交编号为 8–100 位字母、数字、下划线或连字符,可用 UUID;先保存编号与原文再发请求,中断后才能核对。`message post` 省略编号时 CLI 生成(`auto-` 开头),草稿文件就是原文记录。
10
10
  - 结果取决于房间状态的写入(如 `turn create` / `turn continue`)先读对应入口(`turn roster`)再带 `revision` 提交。
package/docs/en/runner.md CHANGED
@@ -90,21 +90,21 @@ Invite an AI on another computer into your room: it reads only the project files
90
90
 
91
91
  **Invite (your computer)**:
92
92
  1. In the new-room panel or Invite members, click "External expert +" on the External row (once per expert), then on the card's back select what they can see (Room messages / Messages and project) and the membership duration after check-in. "Messages and project" opens all of the room's project folders.
93
- 2. Choose Add a seat awaiting check-in (automatic when creating the room). The seat appears immediately in the right-hand roster; share its link or QR code. The link lasts 10 minutes and binds one member; regenerating it invalidates the previous link. Without a connected hosted site, the seat shows that it is waiting for a link and explains why; generate it from the seat menu after connecting. Before check-in, the panel shows the automatic expiry deadline and Remove seat. Usage, read logs and access adjustments appear after check-in.
93
+ 2. Choose Invite (automatic when creating the room). The seat appears immediately in the right-hand roster. Above the message box, "External expert · awaiting check-in" offers Copy invitation link, or Invitation details for the QR code; share either. The link lasts 10 minutes and binds one member; regenerating it invalidates the previous link. While Invitation details is open, an expired link is replaced with a new one automatically. Without a connected hosted site, the seat shows that it is waiting for a link and explains why; generate it from the seat menu after connecting. Before check-in, the panel shows the automatic expiry deadline and Remove seat. Usage, read logs and access adjustments appear after check-in.
94
94
  3. Redemption completes check-in and starts the membership duration, with **no extra approval step**. Pending seats receive no work and do not participate in group replies or discussions; they end automatically after 7 days. An expired link leaves the seat intact.
95
95
  4. `@` it in the room; its answers appear in the conversation as usual. "Read log and access" in the member menu lists every file it read (recorded by your computer) and lets you extend, switch to messages only, or revoke; revoking takes effect immediately. Once a member has ended (expired, left or revoked) it stays dimmed below the roster with the reason; Invite back makes a new link that brings the same member back, keeping its name and history in the room. If the other side still keeps its invited-room record, that record and its settings carry on; if it was deleted, a new one starts.
96
96
  5. After check-in, its avatar shows the vendor of the other side's AI, and "Read log and access" shows the software and model; both update when the other side switches AI. The other computer reports this itself, so treat it as identification only. A custom endpoint shows the external expert icon.
97
97
 
98
98
  **Join (the other computer)**:
99
- 1. Open the link and choose "Join with CoDiscuss on this computer" to go to the local page; or choose "+" under "Invited rooms" in the left panel and paste the link, scan the QR code with the camera, choose a QR code image, or paste a screenshot of it; or run `codiscuss join <link> --adapter TOOL`.
100
- 2. Pick the AI, model and effort, then two settings (Answer at once · Room only by default, with no further confirmation after joining):
99
+ 1. Open the link and choose "Join with CoDiscuss on this computer" to go to the local page; or choose "+" under "External rooms" in the left panel and paste the link, scan the QR code with the camera, choose a QR code image, or paste a screenshot of it; or run `codiscuss join <link> --adapter TOOL`.
100
+ 2. Pick the AI and set it up on its expert card: a new conversation or one this software already holds (joining with its context; manual start is unavailable), model and effort, its own prompt, and the two settings below (Room only · Answer at once by default, with no further confirmation after joining):
101
101
 
102
102
  | Setting | Options |
103
103
  | --- | --- |
104
104
  | When named | Answer at once: no wake count or time limit · Ask me: woken only after you approve in the right panel each time; declining, or 15 minutes without an answer, shows "Not accepted by the other side" |
105
- | On this computer | Room only: limited to CoDiscuss commands, running in an empty temporary folder · Unrestricted: can read local files and use the network |
105
+ | Local access | Room only: limited to CoDiscuss commands, running in an empty temporary folder · Unrestricted: can read local files and use the network |
106
106
 
107
- Both are kept per room; you can change them later in the invited room's right panel, or pause or leave. Once the room has ended, you can delete its record from this computer. `codiscuss invited` offers the same commands, and a paired phone or tablet can set every option. The local service does the waking, so keep codiscuss running.
107
+ The external room page shows the other room's chat like a room's messages, read only (scroll up for earlier messages); the requests to your AI carry how they went on this computer. The other room's private chats, runs, settings and files are not available there. Both settings are kept per room; you can change them later in the external room's right panel, or pause or leave. Once the room has ended, you can delete its record from this computer. `codiscuss invited` offers the same commands, and a paired phone or tablet can set every option. The local service does the waking, so keep codiscuss running. When the AI ends without submitting an answer, the external room page shows the end of its run output on this computer under the failure reason (kept here only, never sent to the other side); `codiscuss external room ID --json` shows it too.
108
108
 
109
109
  **Supported tools**: Room only needs a tool that can be limited to CoDiscuss commands. Claude Code (background runs) supports it, tested on version 2.1.325 (other versions not individually checked), so does the Antigravity CLI, tested on version 1.5.12 (its web search cannot be turned off; anything else you always allowed in agy is denied in these tasks, while your own use of agy is unchanged), and so do model APIs, backed by unit tests; Codex and the Antigravity desktop app do not support it and can only run Unrestricted; desktop apps cannot join as external members.
110
110
 
package/docs/runner.md CHANGED
@@ -121,21 +121,21 @@ codiscuss local connect https://你的站点
121
121
 
122
122
  **邀请(你的电脑)**:
123
123
  1. 建房面板或右栏“邀请成员”里点“外部”一行的“外部专家 +”(可加多位),翻到卡片背面设置“对方能看到”(房间消息 / 消息和项目)和签到后的有效期。选“消息和项目”时开放本房间的全部项目目录。
124
- 2. 点“添加待签到席位”(建房时自动添加),右栏名单立即显示待签到成员;把席位的链接或二维码发给对方。链接 10 分钟有效,只能绑定一位成员;重新生成会立即作废旧链接。未绑定线上站点时显示“待生成链接”及原因,绑定站点后从席位菜单生成。待签到面板显示自动结束期限,可“移除席位”;签到后才显示用量、读取记录和授权调整。
124
+ 2. 点“邀请”(建房时自动添加),右栏名单立即显示待签到成员。输入框上方会出现“外部专家 · 待签到”,点“复制邀请链接”直接复制,或点“邀请详情”查看二维码,发给对方。链接 10 分钟有效,只能绑定一位成员;重新生成会立即作废旧链接。“邀请详情”开着时,链接到期会自动换成新的。未绑定线上站点时显示“待生成链接”及原因,绑定站点后从席位菜单生成。待签到面板显示自动结束期限,可“移除席位”;签到后才显示用量、读取记录和授权调整。
125
125
  3. 对方兑换即完成签到,成员有效期从兑换时开始,**没有额外批准步骤**。未签到不收任务、不参与全体回应或讨论,7 天后自动结束;链接过期不会删除席位。
126
126
  4. 在房间里 `@` 它,回答照常出现在对话中。成员菜单的“读取记录与权限”列出它读过的每个文件(由你的电脑记录),可延长、改为只看消息或撤销授权,撤销立即生效。成员结束后(到期、对方退出或撤销)仍灰显在名单下方并写明原因,点“重新邀请”可生成新链接把原成员请回:名字和房间里的历史不变;对方若还保留那条被邀请记录,记录与设置也接着用,删了则新建。
127
127
  5. 签到后头像显示对方 AI 的厂家,“读取记录与权限”里可看到软件和模型;对方换 AI 后自动更新。这些信息由对方电脑自报,仅供辨认。自定义接口显示外部专家图标。
128
128
 
129
129
  **加入(对方电脑)**:
130
- 1. 打开链接,点“用本机共议加入”跳到本机网页;或在左栏“被邀请的房间”点“+”粘贴链接,也可以用相机扫码、选择二维码图片或粘贴二维码截图;命令行为 `codiscuss join <链接> --adapter 软件`。
131
- 2. 选派哪个 AI、模型与强度,再选两项(默认“直接回答 · 只在房间里发言”,加入后无需再确认):
130
+ 1. 打开链接,点“用本机共议加入”跳到本机网页;或在左栏“外部房间”点“+”粘贴链接,也可以用相机扫码、选择二维码图片或粘贴二维码截图;命令行为 `codiscuss join <链接> --adapter 软件`。
131
+ 2. 选派哪个 AI,在它的专家卡片上设置:新会话或续接这个软件已有的会话(带着原上下文加入;手动启动不可用)、模型与强度、专属提示词,以及下面两项(默认“只在房间里发言 · 直接回答”,加入后无需再确认):
132
132
 
133
133
  | 设置 | 选项 |
134
134
  | --- | --- |
135
135
  | 被点名时 | 直接回答:不设次数与期限上限 · 先问我:每次在右栏同意才唤醒,拒绝或 15 分钟未处理,对方看到“对方未同意” |
136
- | 在这台电脑上 | 只在房间里发言:只能用共议命令,在空的临时目录运行 · 不受限:可读本机文件、联网 |
136
+ | 本机权限 | 只在房间里发言:只能用共议命令,在空的临时目录运行 · 不受限:可读本机文件、联网 |
137
137
 
138
- 两项都按房间分别保存,之后可在被邀请房间的右栏调整,也可暂停或退出,房间结束后可删除这台电脑上的记录;`codiscuss invited` 有同样的命令,已配对的手机或平板也能设置全部选项。唤醒由本机服务完成,请保持 codiscuss 运行。
138
+ 外部房间的页面像房间消息页一样显示对方房间的聊天记录(只读,往上滚动可看更早的消息),点名你 AI 的请求标有在这台电脑上的处理结果;对方房间的私聊、执行、房间设置与文件都不开放。两项设置都按房间分别保存,之后可在外部房间的右栏调整,也可暂停或退出,房间结束后可删除这台电脑上的记录;`codiscuss invited` 有同样的命令,已配对的手机或平板也能设置全部选项。唤醒由本机服务完成,请保持 codiscuss 运行。AI 没提交回答就结束时,外部房间的页面会在失败原因下列出这台电脑上运行输出的末尾(只存在本机,不发给对方),`codiscuss invited room ID --json` 也能看到。
139
139
 
140
140
  **支持的软件**:“只在房间里发言”要求软件能限制为只用共议命令,目前支持 Claude Code(后台运行,已在 2.1.325 版实测,其他版本未逐一验证)、Antigravity CLI(已在 1.5.12 版实测;它的网页搜索无法禁止;你在 agy 里“始终允许”过的其他操作,在受限任务里会被禁止,平时使用不受影响)与模型 API(以单元测试为据);Codex 与 Antigravity 桌面版不支持,只能选“不受限”;桌面 App 不能作为外部成员加入。
141
141
 
@@ -149,6 +149,7 @@
149
149
  "本机连接链接无效或无法保存,请重新运行连接命令;尚未发送启动请求": "The local connection link is invalid or could not be saved. Run the connection command again. No launch request was sent.",
150
150
  "无法连接本机服务:请在这台电脑运行 codiscuss local open,并允许浏览器访问本机网络,再重试原请求": "Cannot connect to the local service. Run codiscuss local open on this computer, allow the browser to access the local network, then retry the original request.",
151
151
  "本机启动请求失败": "Local launch request failed",
152
+ "本机服务返回了无法识别的内容(HTTP {status}):{excerpt}": "The local service returned an unrecognized response (HTTP {status}): {excerpt}",
152
153
  "未知设备": "Unknown device",
153
154
  "请在已配对的设备上操作": "Use a paired device",
154
155
  "网站上还没有绑定电脑,或电脑的 codiscuss 版本过旧": "No computer is bound to this site, or its codiscuss version is too old",
@@ -110,6 +110,7 @@
110
110
  "{value1} 条结果": "{value1} results",
111
111
  "清除筛选": "Clear filters",
112
112
  "发言快速导航": "Quick message navigation",
113
+ "{value1} 正在处理": "{value1} is working",
113
114
  "· 主持人": "· Host",
114
115
  "· 运行回执": "· Run receipt",
115
116
  "把选中的文字作为注释添加到对话": "Add selected text to the conversation as a note",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "对方未同意": "Not accepted by the other side",
3
- "被邀请的房间": "Invited rooms",
3
+ "外部房间": "External rooms",
4
4
  "已离开的外部专家": "External experts who left",
5
5
  "重新邀请": "Invite back",
6
6
  "重新邀请 {name}": "Invite {name} back",
@@ -24,7 +24,10 @@
24
24
  "设置已更新": "Settings updated",
25
25
  "这个 AI 只能不受限运行。": "This AI can only run unrestricted.",
26
26
  "被点名时": "When named",
27
- "在这台电脑上": "On this computer",
27
+ "本机权限": "Local access",
28
+ "这台电脑上的运行输出(末尾)": "Run output on this computer (end)",
29
+ "加入另一台电脑的房间时由本机服务唤醒,不能手动启动": "When joining a room on another computer, this computer's service wakes it; it cannot be started manually",
30
+ "你的 AI 在这台电脑上能做什么:只用共议命令在对方房间里发言,或像平时一样读写本机文件、联网。": "What your AI may do on this computer: only speak in their room through CoDiscuss commands, or read and write local files and go online as usual.",
28
31
  "调整设置": "Change settings",
29
32
  "恢复后,对方点名按设置处理": "Once resumed, being named follows these settings",
30
33
  "房间消息:只看点名给它的消息": "Room messages: sees only the messages naming it",
@@ -80,7 +83,7 @@
80
83
  "已撤销,对方之后的请求都会被拒绝": "Revoked; its later requests will all be refused",
81
84
  "已结束:不能再领取请求或读取文件": "Ended: can no longer take requests or read files",
82
85
  "已到期:不能再领取请求或读取文件": "Expired: can no longer take requests or read files",
83
- "{name} 经邀请加入了房间(外部 · {level});不是你邀请的就在成员菜单里撤销": "{name} joined the room by invitation ({level}); if you did not invite it, revoke it from its member menu",
86
+ "{name} 已加入房间,非你邀请可撤销": "{name} joined the room; revoke it if you did not invite it",
84
87
  "等你同意": "Waiting for you",
85
88
  "你未同意": "You declined",
86
89
  "超时未确认": "Timed out",
@@ -88,17 +91,18 @@
88
91
  "这个软件不能限制为只用共议命令,未启动": "This software cannot be limited to CoDiscuss commands; not started",
89
92
  "对方房主": "Room owner",
90
93
  "对方主持人": "Room host",
91
- "只显示点名给你的 AI 的请求和它的回答": "Only requests that name your AI, and its answers, appear here",
94
+ "对方房间的聊天记录,只读;你只能管理自己的 AI": "The other room's chat, read only; you manage only your own AI",
95
+ "正在读取更早的消息…": "Reading earlier messages…",
92
96
  "暂时读不到对方房间": "Cannot read the other room right now",
93
97
  "正在自动重试,下面是这台电脑记下的处理结果。": "Retrying automatically. Below is what this computer recorded.",
94
98
  "正在自动重试。": "Retrying automatically.",
95
- "对方点名它后,请求和回答会显示在这里。": "When the other side names it, the request and the answer appear here.",
99
+ "有人发言或点名你的 AI 后,会显示在这里。": "Messages appear here once someone speaks or names your AI.",
96
100
  "{count} 个请求待确认": "{count} requests to confirm",
97
101
  "AI 正在处理": "Your AI is working",
98
102
  "等待点名": "Waiting to be named",
99
103
  "被点名时不会启动": "It will not start when named",
100
104
  "详情": "Details",
101
- "还没有人点名你的 AI。": "No one has named your AI yet.",
105
+ "对方房间还没有消息。": "The other room has no messages yet.",
102
106
  "对方": "The other side",
103
107
  "你的 AI": "Your AI",
104
108
  "已唤醒 1 次": "Started once",
@@ -123,7 +127,7 @@
123
127
  "退出房间": "Leave room",
124
128
  "退出「{room}」": "Leave \"{room}\"",
125
129
  "用邀请链接加入": "Join with an invitation link",
126
- "被邀请的房间列表": "Invited room list",
130
+ "外部房间列表": "External room list",
127
131
  "未命名房间": "Untitled room",
128
132
  "{count} 待确认": "{count} awaiting you",
129
133
  "连接本机服务后查看": "Connect the local service to see them",
@@ -139,13 +143,14 @@
139
143
  "你的 AI 在你自己的电脑上运行,用你自己的账号与额度;加入后对方点名即唤醒,受次数与期限上限约束。": "Your AI runs on your own computer with your own account and quota; once you join, it starts when named, within a wake count and time limit.",
140
144
  "对方开放的项目内容会经你的 AI 发送给它的模型服务商。": "Project content they open reaches your AI's model provider.",
141
145
  "用本机共议加入": "Join with CoDiscuss on this computer",
142
- "按钮打开这台电脑上的共议(需已安装并运行 codiscuss)。也可以复制链接,在共议左栏“被邀请的房间”里粘贴,或运行 codiscuss join。": "The button opens CoDiscuss on this computer (codiscuss must be installed and running). You can also copy the link and paste it under \"Invited rooms\" in the left sidebar, or run codiscuss join.",
146
+ "按钮打开这台电脑上的共议(需已安装并运行 codiscuss)。也可以复制链接,在共议左栏“外部房间”里粘贴,或运行 codiscuss join。": "The button opens CoDiscuss on this computer (codiscuss must be installed and running). You can also copy the link and paste it under \"External rooms\" in the left sidebar, or run codiscuss join.",
143
147
  "邀请内容只在地址的 # 之后,浏览器不会把它发给网站。": "The invitation lives only after the # in the address; browsers never send it to the website.",
144
148
  "派 {name} 加入": "Send {name}",
145
149
  "已加入「{room}」": "Joined \"{room}\"",
146
150
  "加入另一台电脑的房间": "Join a room on another computer",
147
151
  "你的 AI 在这台电脑上运行,只读对方开放的目录,在对方房间里回答。": "Your AI runs on this computer, reads only the directories they open, and answers in their room.",
148
152
  "邀请链接": "Invitation link",
153
+ "邀请详情": "Invitation details",
149
154
  "粘贴邀请链接或二维码截图": "Paste the invitation link or a screenshot of its QR code",
150
155
  "选择二维码图片": "Choose a QR code image",
151
156
  "加入中…": "Joining…",
@@ -493,6 +493,8 @@
493
493
  "保留全部记录;需要总结时可直接请主持人写一份。": "Keep all records; ask the host directly if you need a summary.",
494
494
  "房间里还没有 AI 成员": "No AI members in this room yet",
495
495
  "这位成员是手动接入的,请在它自己的窗口里对话": "This member is connected manually; talk in its own window",
496
+ "外部专家在对方电脑上运行,不能在这里私聊": "This external expert runs on the other computer; it cannot be chatted with privately here",
497
+ "它在对方电脑上运行,这里只显示它在房间里收到的任务和回答": "It runs on the other computer; only the room tasks it received and its answers show here",
496
498
  "这位成员的接入方式看不到它的输出,暂不支持私聊窗": "This connection does not expose output, so private chat is unavailable",
497
499
  "打断": "Interrupt",
498
500
  "{value1} · 空闲": "{value1} · Idle",
@@ -137,6 +137,8 @@
137
137
  "扫描电脑本机网页 设置 → 添加设备 的二维码,或输入配对码。": "Scan the QR code under Settings → Add device on the computer's local site, or enter the pairing code.",
138
138
  "配对码": "Pairing code",
139
139
  "扫码": "Scan code",
140
+ "这台设备没有相机,请输入配对码": "This device has no camera. Enter the pairing code.",
141
+ "这台设备没有相机,可选择或粘贴二维码图片": "This device has no camera. Pick or paste a QR code image.",
140
142
  "正在打开相机…": "Opening camera…",
141
143
  "相机画面": "Camera view",
142
144
  "取消": "Cancel",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai_co_discuss",
3
- "version": "0.4.86",
3
+ "version": "0.4.88",
4
4
  "bin": {
5
5
  "codiscuss": "runner/codiscuss.mjs"
6
6
  },
@@ -39,7 +39,23 @@ export function agy_denial(step) {
39
39
  }
40
40
  const command = String(parameters.CommandLine || '');
41
41
  const rule = `${kind === 'unsandboxed' ? 'unsandboxed_command' : 'command'}(${command})`;
42
- return { tool: step.tool_name || 'run_command', detail: command.slice(0, DENIAL_FIELD), rule: command && rule.length <= DENIAL_FIELD ? rule : '' };
42
+ return { tool: step.tool_name || 'run_command', detail: command.slice(0, DENIAL_FIELD), rule: command && rule.length <= DENIAL_FIELD ? rule : '',
43
+ ...symbol_hint(command) };
44
+ }
45
+
46
+ // What `agy_rule` refuses inside a codiscuss command: shell separators and expressions, and line breaks.
47
+ const SHELL_SYMBOLS = /[;&|<>$`()\r\n]/g;
48
+
49
+ /**
50
+ * A codiscuss command refused only for the shell symbols in it, most often an inline --body answer carrying backticks or
51
+ * brackets: `retry_hint` tells the member what to change, so the runner can let it correct the command (2026-11-19).
52
+ */
53
+ function symbol_hint(command) {
54
+ if (!/^codiscuss(\.cmd)?\s/.test(command)) return {};
55
+ const symbols = [...new Set(command.match(SHELL_SYMBOLS) || [])].map(item => (item === '\n' || item === '\r' ? '换行' : item));
56
+ if (!symbols.length) return {};
57
+ return { retry_hint: `命令含有 ${[...new Set(symbols)].join(' ')},codiscuss 命令里不能出现反引号、英文括号、$、;、&、|、<、> 或换行,`
58
+ + '会被当作拼接其他命令而拒绝。若是 --body 的正文含这些符号,把正文写进草稿目录的文件,改用 --body-file 提交;其他参数去掉这些符号再运行。' };
43
59
  }
44
60
 
45
61
  /** Allow only the discussion website commands, without shell separators or expressions. */
@@ -414,6 +414,8 @@ export async function admin_cli(args, { client = panel_client, print = text => p
414
414
  const commands = {
415
415
  status: async () => {
416
416
  const { login_methods: _methods, providers: _providers, ...state } = await call('state');
417
+ // The state leaves out the entry's checks over the network; they are asked apart.
418
+ if (state.hosting) state.entry = await call('entry');
417
419
  return values.full ? state : summary(state);
418
420
  },
419
421
  service: () => call(`service/${need(rest[0], 'start|stop|restart')}`, {}),
@@ -666,9 +666,11 @@ export function create_panel({ data, key, port, ops = {}, sessions = new Set() }
666
666
  const windows = process.platform === 'win32';
667
667
  return { hosting, version: VERSION, service: op.service_overview(data), online_site: bound_site(data)?.site || '', platform: process.platform,
668
668
  launcher: windows && existsSync(launcher_path(data)), autostart: windows && op.autostart_enabled(), login_methods: LOGIN_METHODS, providers: API_PROVIDERS,
669
- ...(hosting ? { accounts: await op.list_accounts(data), clis: op.shared_cli_state(), entry: await op.entry_overview(data) }
669
+ ...(hosting ? { accounts: await op.list_accounts(data), clis: op.shared_cli_state(), entry: await op.entry_overview(data, { reach: false }) }
670
670
  : { accounts: [], clis: {}, entry: null }) };
671
671
  }
672
+ // The entry with what needs the network (the relay's reach, the tunnel's connection), asked apart so the state is quick.
673
+ if (method === 'GET' && section === 'entry' && !name) return hosting ? op.entry_overview(data) : null;
672
674
  // This computer: the owner's own service, its updates and login autostart.
673
675
  // The owner's site opens in the default browser (not the panel's own window), through a signed link while it is protected.
674
676
  if (method === 'POST' && section === 'service' && name === 'open') { open_browser(signed_site_url(site_url(data), data)); return { ok: true }; }
@@ -865,16 +867,20 @@ function relay_problem(relay, entry_running, service_running) {
865
867
  return '';
866
868
  }
867
869
 
868
- async function entry_overview(data) {
870
+ /**
871
+ * The entry and its ways from outside. With `reach` off it leaves out what needs asking the relay over the network and
872
+ * cloudflared (`checked: false`), so the panel's state answers at once; the page then asks `GET entry` for the rest.
873
+ */
874
+ async function entry_overview(data, { reach = true } = {}) {
869
875
  const { port, public_url, tunnel, relay_enabled, tunnel_enabled, relay_url } = entry_settings(data), status = await entry_status(data);
870
876
  const bound = bound_site(data);
871
877
  const relay = { url: relay_url, site: bound?.site || '', link: relay_url && bound ? `${relay_url}/?m=${bound.machine}` : '',
872
- ...(relay_enabled && relay_url && bound ? await relay_status(relay_url, bound.machine) : {}) };
873
- if (relay_enabled) relay.problem = relay_problem(relay, status.running, Boolean(local_status(data).running));
878
+ ...(reach && relay_enabled && relay_url && bound ? await relay_status(relay_url, bound.machine) : {}) };
879
+ if (reach && relay_enabled) relay.problem = relay_problem(relay, status.running, Boolean(local_status(data).running));
874
880
  // The address handed to people: the owner's domain when it is on (direct, and outside the Workers quota), else the relay.
875
881
  const address = tunnel_enabled && public_url ? public_url : relay_enabled ? relay.link : '';
876
- return { running: status.running, port: status.running ? status.port : port, public_url, relay_enabled, tunnel_enabled, address, relay,
877
- tunnel: tunnel ? { host: tunnel.host, name: tunnel.name, ...(await tunnel_status(data)) } : null };
882
+ return { running: status.running, port: status.running ? status.port : port, public_url, relay_enabled, tunnel_enabled, address, relay, checked: reach,
883
+ tunnel: tunnel ? { host: tunnel.host, name: tunnel.name, ...(reach ? await tunnel_status(data) : {}) } : null };
878
884
  }
879
885
 
880
886
  /** Make sure what a way from outside needs is there before it is turned on. */
@@ -35,7 +35,7 @@ const HELP = t(`AI CoDiscuss CLI
35
35
  schema [COMMAND] 离线查看命令与参数
36
36
  api PATH 访问尚未封装的网站接口
37
37
  join LINK|CODE 用本机 AI 加入另一台电脑上的房间(外部成员)
38
- invited COMMAND 查看被邀请的房间,调整信任等级、同意或拒绝唤醒、退出
38
+ invited COMMAND 查看外部房间,调整信任等级、同意或拒绝唤醒、退出
39
39
  repo COMMAND 外部成员只读查看对方电脑开放的项目
40
40
 
41
41
  codiscuss service --help
@@ -81,6 +81,34 @@ export function access_label(level) { return level === 'own' ? '自行决定' :
81
81
  */
82
82
  export const TASK_SUBCOMMANDS = ['room', 'message', 'turn', 'state', 'goal', 'mode', 'review', 'sequence', 'question', 'execution', 'health', 'schema', 'launch workflow-adopt', 'launch workflow-join', 'launch workflow-leave', 'launch host-control', 'attachment', 'launch image', 'repo'];
83
83
 
84
+ /**
85
+ * The limit on a quick answer given inline with --body: a run allowed only codiscuss commands refuses a command line
86
+ * carrying shell symbols, and PowerShell rewrites `$` and backticks inside quotes. The participant skill says the same.
87
+ */
88
+ export const INLINE_BODY_RULE = '--body 的正文不能含反引号、英文括号、$、;、&、|、<、> 或换行,含这些时写草稿再用 --body-file';
89
+
90
+ // How many times one execution is resumed to correct commands it can fix itself (2026-11-19 user: three).
91
+ export const MAX_REFUSAL_RETRIES = 3;
92
+ const REFUSED_COMMAND_SHOWN = 200;
93
+
94
+ /**
95
+ * Which refusals a member can correct itself: the adapter's denials carrying a `retry_hint`, as `{command, hint}`.
96
+ */
97
+ export const correctable_refusals = denials => (denials || []).filter(item => item.retry_hint)
98
+ .map(item => ({ command: String(item.detail || '').slice(0, REFUSED_COMMAND_SHOWN), hint: item.retry_hint }));
99
+
100
+ /**
101
+ * What a member hears when the program resumes its session after refused commands: every refusal so far in this
102
+ * execution, oldest first, each with what to change, and how many corrections are left.
103
+ */
104
+ export function refusal_retry_prompt(execution_id, refusals, attempt = 1) {
105
+ const listed = refusals.map((item, index) => `${index + 1}. 命令「${item.command}」被拒:${item.hint}`).join('\n');
106
+ const left = MAX_REFUSAL_RETRIES - attempt;
107
+ return `你在这次房间任务(执行 #${execution_id},仍在进行)里的命令被本机安全规则拒绝,回答还没有提交(第 ${attempt} 次提醒,`
108
+ + `${left ? `之后还有 ${left} 次改正机会` : '这是最后一次改正机会'}):\n\n${listed}\n\n`
109
+ + '按上面改正后接着完成,已经做完的部分不必重做,最后提交这次执行的回答。';
110
+ }
111
+
84
112
  /**
85
113
  * The task text for a member woken on this computer for a room on another computer (an external member): the project
86
114
  * lives over there and is read only through `repo`; a locked-down run (`lockdown`) may run only codiscuss subcommands and
@@ -96,8 +124,8 @@ export function external_task_text({ name, messages, requests = [], cli, access_
96
124
  const limits = lockdown ? `本次只能运行 ${cli} 子命令,只能在 ${draft_directory} 写草稿,不能读写其他本机文件或联网。` : '';
97
125
  const instructions = `你作为外部成员参加另一台电脑上的房间,只读对方开放的项目,不修改任何文件。命令只用 subcommands 列出的 ${cli} 子命令。${limits}${reading}`;
98
126
  const prompt = `${wake_opening(requests, name)}(来自另一台电脑上的房间),对应消息 ${messages}。${instructions}`
99
- + `用 ${cli} message view 消息编号${access} 看原文,${cli} room read${access} 看房间概况。`
100
- + `做完用 ${cli} message post --body-file 草稿${access} 提交一次回答(简短回答可用 --body "回答")。房间按 Markdown 显示回答,内容较多时用分段、标题或列表排版。先读任务文件 ${task_path} 与其中列出的技能。`;
127
+ + `用 ${cli} message view 消息编号${access} 看原文,${cli} room view${access} 看房间概况。`
128
+ + `做完用 ${cli} message post --body-file 草稿${access} 提交一次回答(简短回答可用 --body "回答";${INLINE_BODY_RULE})。房间按 Markdown 显示回答,内容较多时用分段、标题或列表排版。先读任务文件 ${task_path} 与其中列出的技能。`;
101
129
  return { instructions, prompt };
102
130
  }
103
131
 
@@ -158,10 +186,10 @@ export function free_task_text({ name, discussion, discussion_request, profile,
158
186
  }
159
187
  // A greeting deserves a quick answer, and reading the skills first costs it one or two model rounds.
160
188
  const access = access_file ? ` --access-file ${access_file}` : '';
161
- // A one-line answer goes inline: a draft file guards long or quoted text and retries, which a greeting does not need.
162
189
  // The credential already names the room, the member and this execution, so the commands carry only what changes.
163
190
  // The message numbers are already known, so the original is one `message view` away instead of a list (#3129).
164
- const quick = `问候、致谢等简单消息可跳过技能:${cli} message view 上面的消息编号${access} 看原文,${cli} message post --body "回答"${access} 回复(正文含引号时先写草稿再用 --body-file)。`;
191
+ // A one-line answer goes inline: a draft file guards long or symbol-laden text and retries, which a greeting does not need.
192
+ const quick = `问候、致谢等简单消息可跳过技能:${cli} message view 上面的消息编号${access} 看原文,${cli} message post --body "回答"${access} 回复(${INLINE_BODY_RULE})。`;
165
193
  const opening = `${wake_opening(requests, name, discussion)},对应消息 ${messages}。`;
166
194
  // Choosing a sub-workflow was left to the host's memory and got skipped, so every host task now asks for it (#4487).
167
195
  const route = workflow ? '本房间启用了工作流:派活或改文件之前,先读 workflow.skill_path,把这次请求对照主线和 workflow.sub_workflows 每一项的 description;命中就读它的 SKILL.md 并照做,不问要不要用,回答开头写明走的哪条;都不命中就写明按普通请求处理。' : '';