ai_co_discuss 0.4.84 → 0.4.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/docs/en/runner.md +9 -10
- package/docs/runner.md +9 -10
- package/frontend/locales/en/external.json +24 -37
- package/package.json +1 -1
- package/runner/adapters/antigravity_cli.mjs +47 -3
- package/runner/adapters/cli.mjs +1 -1
- package/runner/adapters/profiles.mjs +2 -2
- package/runner/external_client.mjs +45 -44
- package/runner/i18n_en.mjs +8 -6
- package/runner/remote_policy.mjs +0 -6
- package/web/backup.js +1 -1
- package/web/i18n.js +1 -1
- package/web/join.html +2 -2
- package/web/modern.css +1 -1
- package/web/modern.js +52 -51
package/README.md
CHANGED
|
@@ -110,7 +110,7 @@ Details: [Architecture](docs/en/architecture.md) · [Setup](docs/en/runner.md)
|
|
|
110
110
|
- **From a phone or tablet** — after connecting once and saving your usual projects on that computer, pair a phone or tablet with it once by scanning a QR code at the computer, then use the same site to create rooms whose agents that computer wakes. Folder paths stay on the computer. See [From other devices](docs/en/runner.md#from-other-devices).
|
|
111
111
|
- **From an AI chat** — ask a local agent to use the `discuss-host` and `discuss-participant` skills to create and host a room. See [From an AI chat](docs/en/runner.md#from-an-ai-chat).
|
|
112
112
|
- **Model APIs** — configure provider, base URL, protocol and model per member. See [API access](docs/en/runner.md#api-access).
|
|
113
|
-
- **Borrow an AI from another computer** — invite an agent running on someone else's computer (or another of yours) into your room as an external member: it reads only the project folders you open, answers in the room, and you can see every file it read and revoke it at any time. Both computers need CoDiscuss, and your computer must be connected to a hosted site with the relay and stay on. What it reads reaches that computer's model provider. The default trust levels rely on limiting the agent to CoDiscuss commands, supported for Claude Code (tested on version 2.1.325) and model APIs (backed by unit tests); Codex and Antigravity do not support it. See [External members](docs/en/runner.md#external-members-borrowing-an-ai-from-another-computer).
|
|
113
|
+
- **Borrow an AI from another computer** — invite an agent running on someone else's computer (or another of yours) into your room as an external member: it reads only the project folders you open, answers in the room, and you can see every file it read and revoke it at any time. Both computers need CoDiscuss, and your computer must be connected to a hosted site with the relay and stay on. What it reads reaches that computer's model provider. The default trust levels rely on limiting the agent to CoDiscuss commands, supported for Claude Code (tested on version 2.1.325), the Antigravity CLI (tested on version 1.5.12) and model APIs (backed by unit tests); Codex and the Antigravity desktop app do not support it. See [External members](docs/en/runner.md#external-members-borrowing-an-ai-from-another-computer).
|
|
114
114
|
|
|
115
115
|
## Deployment
|
|
116
116
|
|
package/README.zh-CN.md
CHANGED
|
@@ -104,7 +104,7 @@ flowchart LR
|
|
|
104
104
|
- **手机或平板建房**:在电脑上连接一次并保存常用项目后,在电脑前扫码配对一次手机或平板,之后用同一网站即可新建房间,由那台电脑唤醒 AI,项目路径只留在电脑上。见 [其他设备经已配对电脑建房](docs/runner.md#其他设备经已配对电脑建房)。
|
|
105
105
|
- **从 AI 对话发起**:让本地 AI 使用 `discuss-host` 和 `discuss-participant` 技能建房并主持。见 [从 AI 对话发起](docs/runner.md#从-ai-对话发起)。
|
|
106
106
|
- **模型 API**:按成员配置供应商、Base URL、请求协议与模型。见 [API 接入](docs/runner.md#api-接入)。
|
|
107
|
-
- **借用另一台电脑上的 AI**:邀请别人电脑(或你自己另一台电脑)上的 AI 作为外部成员进入你的房间,它只读你开放的项目目录、在房间里回答,你能看到它读过的每个文件并随时撤销。两台电脑都要安装共议,你的电脑须连接带中转的线上网站并保持开机;它读到的内容会发送给对方的模型服务商。默认的信任等级依赖把对方 AI 限制为只用共议命令,目前支持 Claude Code(已在 2.1.325 版实测)与模型 API(以单元测试为据),Codex 与 Antigravity
|
|
107
|
+
- **借用另一台电脑上的 AI**:邀请别人电脑(或你自己另一台电脑)上的 AI 作为外部成员进入你的房间,它只读你开放的项目目录、在房间里回答,你能看到它读过的每个文件并随时撤销。两台电脑都要安装共议,你的电脑须连接带中转的线上网站并保持开机;它读到的内容会发送给对方的模型服务商。默认的信任等级依赖把对方 AI 限制为只用共议命令,目前支持 Claude Code(已在 2.1.325 版实测)、Antigravity CLI(已在 1.5.12 版实测)与模型 API(以单元测试为据),Codex 与 Antigravity 桌面版不支持。见 [外部成员](docs/runner.md#外部成员借用另一台电脑上的-ai)。
|
|
108
108
|
|
|
109
109
|
## 部署
|
|
110
110
|
|
package/docs/en/runner.md
CHANGED
|
@@ -89,25 +89,24 @@ Invite an AI on another computer into your room: it reads only the project files
|
|
|
89
89
|
**Before you start**: both computers install CoDiscuss and run the local service; your computer is [connected to a hosted site](#from-a-hosted-site) with the relay deployed, and the other side reaches your room through that site's encrypted relay. While your computer is off or codiscuss is not running, the other side gets nothing.
|
|
90
90
|
|
|
91
91
|
**Invite (your computer)**:
|
|
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
|
|
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
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.
|
|
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
|
-
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,
|
|
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.
|
|
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
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,
|
|
100
|
+
2. Pick the AI, model and effort, then two settings (Answer at once · Room only by default, with no further confirmation after joining):
|
|
101
101
|
|
|
102
|
-
|
|
|
103
|
-
| --- | --- |
|
|
104
|
-
|
|
|
105
|
-
|
|
|
106
|
-
| Trusted computer | Woken directly, no limits; later invites from that computer are accepted at this level | Unrestricted: local files and network tools available |
|
|
102
|
+
| Setting | Options |
|
|
103
|
+
| --- | --- |
|
|
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 |
|
|
107
106
|
|
|
108
|
-
|
|
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.
|
|
109
108
|
|
|
110
|
-
**Supported tools**:
|
|
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.
|
|
111
110
|
|
|
112
111
|
**What it can read**: files Git tracks in the opened folders (including uncommitted changes, skipping files in `.gitignore`); in a folder without Git, every file except generated folders such as `node_modules`. `.env`-style files, private keys and certificates, credential files, `.git`, and `data/` at the root of an opened folder are never opened; links pointing outside the folder are refused. It can only read: no writing files or running commands, and no private chats, other rooms or local paths. Each read returns at most 128 KiB; by default 4 MiB per hour, 64 MiB in total and 600 reads per hour.
|
|
113
112
|
|
package/docs/runner.md
CHANGED
|
@@ -120,25 +120,24 @@ codiscuss local connect https://你的站点
|
|
|
120
120
|
**前提**:两台电脑都安装共议并运行本机服务;你的电脑已[连接线上网站](#线上网页连接本机)并部署了中转,对方经这个网站的加密中转访问你的房间。你的电脑关机或 codiscuss 未运行时,对方什么也拿不到。
|
|
121
121
|
|
|
122
122
|
**邀请(你的电脑)**:
|
|
123
|
-
1. 建房面板或右栏“邀请成员”里点“外部”一行的“外部专家
|
|
123
|
+
1. 建房面板或右栏“邀请成员”里点“外部”一行的“外部专家 +”(可加多位),翻到卡片背面设置“对方能看到”(房间消息 / 消息和项目)和签到后的有效期。选“消息和项目”时开放本房间的全部项目目录。
|
|
124
124
|
2. 点“添加待签到席位”(建房时自动添加),右栏名单立即显示待签到成员;把席位的链接或二维码发给对方。链接 10 分钟有效,只能绑定一位成员;重新生成会立即作废旧链接。未绑定线上站点时显示“待生成链接”及原因,绑定站点后从席位菜单生成。待签到面板显示自动结束期限,可“移除席位”;签到后才显示用量、读取记录和授权调整。
|
|
125
125
|
3. 对方兑换即完成签到,成员有效期从兑换时开始,**没有额外批准步骤**。未签到不收任务、不参与全体回应或讨论,7 天后自动结束;链接过期不会删除席位。
|
|
126
|
-
4. 在房间里 `@`
|
|
126
|
+
4. 在房间里 `@` 它,回答照常出现在对话中。成员菜单的“读取记录与权限”列出它读过的每个文件(由你的电脑记录),可延长、改为只看消息或撤销授权,撤销立即生效。
|
|
127
127
|
5. 签到后头像显示对方 AI 的厂家,“读取记录与权限”里可看到软件和模型;对方换 AI 后自动更新。这些信息由对方电脑自报,仅供辨认。自定义接口显示外部专家图标。
|
|
128
128
|
|
|
129
129
|
**加入(对方电脑)**:
|
|
130
130
|
1. 打开链接,点“用本机共议加入”跳到本机网页;或在左栏“被邀请的房间”点“+”粘贴链接,也可以用相机扫码、选择二维码图片或粘贴二维码截图;命令行为 `codiscuss join <链接> --adapter 软件`。
|
|
131
|
-
2. 选派哪个 AI
|
|
131
|
+
2. 选派哪个 AI、模型与强度,再选两项(默认“直接回答 · 只在房间里发言”,加入后无需再确认):
|
|
132
132
|
|
|
133
|
-
|
|
|
134
|
-
| --- | --- |
|
|
135
|
-
|
|
|
136
|
-
|
|
|
137
|
-
| 信任设备 | 直接唤醒,不设上限;之后这台电脑发来的邀请按此等级直接接受 | 不受限,可用本机文件与联网工具 |
|
|
133
|
+
| 设置 | 选项 |
|
|
134
|
+
| --- | --- |
|
|
135
|
+
| 被点名时 | 直接回答:不设次数与期限上限 · 先问我:每次在右栏同意才唤醒,拒绝或 15 分钟未处理,对方看到“对方未同意” |
|
|
136
|
+
| 在这台电脑上 | 只在房间里发言:只能用共议命令,在空的临时目录运行 · 不受限:可读本机文件、联网 |
|
|
138
137
|
|
|
139
|
-
|
|
138
|
+
两项都按房间分别保存,之后可在被邀请房间的右栏调整,也可暂停或退出,房间结束后可删除这台电脑上的记录;`codiscuss invited` 有同样的命令,已配对的手机或平板也能设置全部选项。唤醒由本机服务完成,请保持 codiscuss 运行。
|
|
140
139
|
|
|
141
|
-
|
|
140
|
+
**支持的软件**:“只在房间里发言”要求软件能限制为只用共议命令,目前支持 Claude Code(后台运行,已在 2.1.325 版实测,其他版本未逐一验证)、Antigravity CLI(已在 1.5.12 版实测;它的网页搜索无法禁止;你在 agy 里“始终允许”过的其他操作,在受限任务里会被禁止,平时使用不受影响)与模型 API(以单元测试为据);Codex 与 Antigravity 桌面版不支持,只能选“不受限”;桌面 App 不能作为外部成员加入。
|
|
142
141
|
|
|
143
142
|
**能读到什么**:开放目录中 Git 管理的文件(含未提交的改动,忽略 `.gitignore` 里的文件),非 Git 目录则是除 `node_modules` 等生成目录外的文件。`.env` 一类文件、私钥与证书、凭据文件、`.git`、开放目录根下的 `data/` 永不开放;指向目录外的链接被拒绝。它只能读,不能写文件或执行命令,也看不到私聊、其他房间和本机路径。每次最多读 128 KiB,默认每小时 4 MiB、总量 64 MiB、每小时 600 次。
|
|
144
143
|
|
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"对方未同意": "Not accepted by the other side",
|
|
3
3
|
"被邀请的房间": "Invited rooms",
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
4
|
+
"房间消息": "Room messages",
|
|
5
|
+
"只看点名给它的消息": "Sees only the messages naming it",
|
|
6
|
+
"消息和项目": "Messages and project",
|
|
7
|
+
"另可只读本房间的项目目录": "Can also read this room's project folders",
|
|
8
|
+
"直接回答": "Answer at once",
|
|
9
|
+
"先问我": "Ask me",
|
|
10
|
+
"只在房间里发言": "Room only",
|
|
11
|
+
"不受限": "Unrestricted",
|
|
12
|
+
"对方能看到": "They can see",
|
|
13
|
+
"消息和项目:{dirs}": "Messages and project: {dirs}",
|
|
14
|
+
"还没有选项目目录,只能选“房间消息”。": "No project folder chosen yet, so only Room messages is available.",
|
|
15
|
+
"本房间还没有项目目录,只能选“房间消息”。": "This room has no project folder yet, so only Room messages is available.",
|
|
16
|
+
"改为只看消息": "Messages only",
|
|
17
|
+
"设置已更新": "Settings updated",
|
|
18
|
+
"这个 AI 只能不受限运行。": "This AI can only run unrestricted.",
|
|
19
|
+
"被点名时": "When named",
|
|
20
|
+
"在这台电脑上": "On this computer",
|
|
21
|
+
"调整设置": "Change settings",
|
|
22
|
+
"恢复后,对方点名按设置处理": "Once resumed, being named follows these settings",
|
|
23
|
+
"房间消息:只看点名给它的消息": "Room messages: sees only the messages naming it",
|
|
24
|
+
"消息和项目:另可只读对方开放的目录": "Messages and project: can also read the folders they open",
|
|
25
|
+
"对方开放:{level}": "They open: {level}",
|
|
26
|
+
"可读本机文件、联网;对方房间的内容可能诱导它这样做。": "It can read local files and use the network; content in their room could lead it to.",
|
|
27
|
+
"等退出通知送达后可删除": "Can be deleted once the leave notice arrives",
|
|
9
28
|
"1 小时": "1 hour",
|
|
10
29
|
"今天": "Today",
|
|
11
|
-
"3 天": "3 days",
|
|
12
30
|
"30 天": "30 days",
|
|
13
|
-
"对方点名后先问你,同意才唤醒;AI 只能用共议命令": "When named, you are asked first and the AI starts only if you agree; it can only use CoDiscuss commands",
|
|
14
|
-
"完全借用": "Full loan",
|
|
15
|
-
"点名即唤醒,受下面的次数与期限上限;AI 只能用共议命令": "Starts as soon as it is named, within the limits below; the AI can only use CoDiscuss commands",
|
|
16
|
-
"信任设备": "Trusted computer",
|
|
17
|
-
"点名即唤醒,不设上限,按普通只读成员运行;这台电脑之后的邀请直接接受": "Starts as soon as it is named, without limits, as an ordinary read-only member; later invitations from this computer are accepted directly",
|
|
18
|
-
"1 天": "1 day",
|
|
19
31
|
"7 天": "7 days",
|
|
20
32
|
"已到期": "Expired",
|
|
21
33
|
"剩余 {count} 天": "{count} d left",
|
|
@@ -31,16 +43,13 @@
|
|
|
31
43
|
"已退出该房间": "Left the room",
|
|
32
44
|
"邀请外部专家": "Invite an external expert",
|
|
33
45
|
"外部专家": "External expert",
|
|
34
|
-
"可读:{dirs}": "Reads: {dirs}",
|
|
35
46
|
"移除这张卡片": "Remove this card",
|
|
36
|
-
"能做什么": "What it may do",
|
|
37
47
|
"对方的 AI": "Their AI",
|
|
38
48
|
"正在读取邀请": "Loading the invitation",
|
|
39
49
|
"{name}(对方自报)": "{name} (self-reported)",
|
|
40
50
|
"模型 API": "Model API",
|
|
41
51
|
"阿里云百炼": "Alibaba Cloud Model Studio",
|
|
42
52
|
"开放目录": "Open directories",
|
|
43
|
-
"本房间还没有项目目录,只能选“只讨论”。": "This room has no project directory yet, so only \"Discussion only\" is available.",
|
|
44
53
|
"只读:已跟踪与未忽略的文件,固定排除 .env、密钥、凭据、data/ 与 .git。": "Read-only: tracked and non-ignored files; .env, keys, credentials, data/ and .git are always excluded.",
|
|
45
54
|
"有效期": "Valid for",
|
|
46
55
|
"项目内容会发给对方模型服务商": "Project content goes to their model provider",
|
|
@@ -54,7 +63,6 @@
|
|
|
54
63
|
"调整": "Adjust",
|
|
55
64
|
"延长": "Extend",
|
|
56
65
|
"已延长": "Extended",
|
|
57
|
-
"降为只讨论": "Downgrade to discussion only",
|
|
58
66
|
"已降为只讨论,之后不能再读项目文件": "Downgraded to discussion only; it can no longer read project files",
|
|
59
67
|
"读取记录": "Read log",
|
|
60
68
|
"还没有读取记录": "No reads yet",
|
|
@@ -82,13 +90,10 @@
|
|
|
82
90
|
"AI 正在处理": "Your AI is working",
|
|
83
91
|
"等待点名": "Waiting to be named",
|
|
84
92
|
"被点名时不会启动": "It will not start when named",
|
|
85
|
-
"这个 AI 软件只能在“信任设备”等级下服务。": "This AI software can serve only at the \"Trusted computer\" level.",
|
|
86
93
|
"详情": "Details",
|
|
87
94
|
"还没有人点名你的 AI。": "No one has named your AI yet.",
|
|
88
95
|
"对方": "The other side",
|
|
89
96
|
"你的 AI": "Your AI",
|
|
90
|
-
"信任等级已更新": "Trust level updated",
|
|
91
|
-
"已唤醒 {count} / {limit} 次": "Started {count} of {limit} times",
|
|
92
97
|
"已唤醒 1 次": "Started once",
|
|
93
98
|
"已唤醒 {count} 次": "Started {count} times",
|
|
94
99
|
"在线": "Online",
|
|
@@ -103,26 +108,18 @@
|
|
|
103
108
|
"同意并唤醒": "Approve and start",
|
|
104
109
|
"拒绝": "Decline",
|
|
105
110
|
"对方开放": "Opened by them",
|
|
106
|
-
"信任等级": "Trust level",
|
|
107
111
|
"(已暂停)": " (paused)",
|
|
108
|
-
"借用至": "Loan ends",
|
|
109
112
|
"剩余时间": "Time left",
|
|
110
113
|
"连接": "Connection",
|
|
111
114
|
"用配对码加入,未核对对方电脑的公钥指纹。": "Joined with a pairing code; the other computer's key fingerprint was not checked.",
|
|
112
|
-
"信任等级按对方电脑记录:这台电脑邀请的所有房间一起生效。": "Trust is recorded per inviting computer: it applies to every room from that computer.",
|
|
113
|
-
"调整信任等级": "Change trust level",
|
|
114
|
-
"恢复后,对方点名按信任等级处理": "Once resumed, being named is handled by the trust level",
|
|
115
115
|
"暂停期间不领取也不唤醒;已在等你确认的请求到时照常算作未同意": "While paused nothing is taken or started; requests already awaiting you still count as declined when they time out",
|
|
116
116
|
"退出房间": "Leave room",
|
|
117
117
|
"退出「{room}」": "Leave \"{room}\"",
|
|
118
118
|
"用邀请链接加入": "Join with an invitation link",
|
|
119
119
|
"被邀请的房间列表": "Invited room list",
|
|
120
|
-
"{computer} · {trust}": "{computer} · {trust}",
|
|
121
120
|
"未命名房间": "Untitled room",
|
|
122
121
|
"{count} 待确认": "{count} awaiting you",
|
|
123
122
|
"连接本机服务后查看": "Connect the local service to see them",
|
|
124
|
-
"只讨论:只看点名给它的请求并回答": "Discussion only: sees only the requests that name it and answers them",
|
|
125
|
-
"可读项目:另可读对方开放的目录,不能写入或执行": "Can read project: can also read the opened directories; cannot write or run anything",
|
|
126
123
|
"加入共议房间 · AI CoDiscuss": "Join a CoDiscuss room · AI CoDiscuss",
|
|
127
124
|
"没有邀请内容": "No invitation here",
|
|
128
125
|
"请打开对方发来的完整链接。": "Open the complete link you were sent.",
|
|
@@ -133,7 +130,6 @@
|
|
|
133
130
|
"复制失败,请手动复制地址栏": "Copy failed; copy the address bar manually",
|
|
134
131
|
"你被邀请让自己的 AI 加入一个共议房间": "You are invited to bring your own AI into a CoDiscuss room",
|
|
135
132
|
"你的 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.",
|
|
136
|
-
"每次询问": "Ask each time",
|
|
137
133
|
"对方开放的项目内容会经你的 AI 发送给它的模型服务商。": "Project content they open reaches your AI's model provider.",
|
|
138
134
|
"用本机共议加入": "Join with CoDiscuss on this computer",
|
|
139
135
|
"按钮打开这台电脑上的共议(需已安装并运行 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.",
|
|
@@ -152,18 +148,12 @@
|
|
|
152
148
|
"加入需要本机服务,请在运行 AI 的电脑打开本机网站。": "Joining needs the local service; open the local website on the computer that runs the AI.",
|
|
153
149
|
"加入": "Join",
|
|
154
150
|
"读取记录与权限": "Read log and access",
|
|
155
|
-
"最多唤醒": "Start at most",
|
|
156
|
-
"最多唤醒次数": "Maximum starts",
|
|
157
|
-
"次,期限": "times, for",
|
|
158
|
-
"期限": "Duration",
|
|
159
|
-
"信任设备下 AI 不再受限,可用本机文件与联网工具;对方房间的内容可能诱导它读这台电脑上的文件。": "As a trusted computer the AI is no longer limited and can use local files and network tools; content in their room could lead it to read files on this computer.",
|
|
160
151
|
"沙箱只读档仍可读整个磁盘、运行任意只读命令,无法只放行 codiscuss 命令": "its read-only sandbox can still read the whole disk and run any read-only command, so it cannot be limited to codiscuss commands",
|
|
161
152
|
"权限由 App 决定,接入程序无法逐次收窄": "the App decides its permissions, so the runner cannot narrow them per task",
|
|
162
153
|
"文件读取、网页读取与搜索工具是否全部受权限规则约束尚未核实,无法保证只放行 codiscuss 命令": "it is not yet verified that its file, web-fetch and search tools all obey permission rules, so only codiscuss commands cannot be guaranteed",
|
|
163
154
|
"不支持的软件适配器": "unsupported software adapter",
|
|
164
155
|
"托管的已有会话沿用它自己的权限,无法收窄": "a taken-over existing session keeps its own permissions and cannot be narrowed",
|
|
165
156
|
"不能收窄": "cannot be narrowed",
|
|
166
|
-
"这个软件不能限制为只用共议命令({reason}),只能在“信任设备”等级下服务;其他等级下被点名时不会启动。": "This software cannot be limited to CoDiscuss commands ({reason}), so it can serve only at the \"Trusted computer\" level; at other levels it will not start when named.",
|
|
167
157
|
"被对方撤销": "revoked by the other side",
|
|
168
158
|
"你已退出": "you left",
|
|
169
159
|
"删除记录": "Delete record",
|
|
@@ -181,7 +171,6 @@
|
|
|
181
171
|
"结束于": "Ended at",
|
|
182
172
|
"恢复唤醒": "Resume",
|
|
183
173
|
"正文在对方房间,已无法读取": "The text is in their room and can no longer be read",
|
|
184
|
-
"只能在这台电脑本机设置": "Can only be set on this computer itself",
|
|
185
174
|
"这台电脑还没有可派出的 AI 软件,请先在设置里配置。": "This computer has no AI software to send yet. Set one up in Settings first.",
|
|
186
175
|
"这个链接已过期,请让对方重新生成邀请。": "This link has expired. Ask them to create a new invitation.",
|
|
187
176
|
"无法读取这个邀请链接": "This invitation link can't be read",
|
|
@@ -198,13 +187,11 @@
|
|
|
198
187
|
"剩 {count} 小时": "{count}h",
|
|
199
188
|
"剩 {count} 分": "{count}m",
|
|
200
189
|
"{used} / {limit} · 本小时 {hour} / {hour_limit} · 被拒 {denied} 次": "{used} / {limit} · this hour {hour} / {hour_limit} · {denied} refused",
|
|
201
|
-
"还没有选项目目录,只能选“只讨论”。": "No project directory chosen yet, so only \"Discuss only\" is available.",
|
|
202
190
|
"外部专家 · 待签到": "External expert · Awaiting check-in",
|
|
203
191
|
"待签到": "Awaiting check-in",
|
|
204
192
|
"重新生成链接": "Regenerate link",
|
|
205
193
|
"添加待签到席位": "Add a seat awaiting check-in",
|
|
206
194
|
"待生成链接": "Waiting for a link",
|
|
207
|
-
"邀请链接": "Invitation link",
|
|
208
195
|
"{time} 前兑换有效,只能用一次。对方兑换后完成签到,你会收到提示,可随时撤销。": "Redeem before {time}, for one member only. Check-in completes on redemption; you will be notified and can revoke access anytime.",
|
|
209
196
|
"另一台电脑{suffix}": "Another computer{suffix}",
|
|
210
197
|
"外部专家{suffix}": "External expert{suffix}",
|
package/package.json
CHANGED
|
@@ -60,6 +60,27 @@ function check_agy_shell(user_home) {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
/** Whether a saved allow rule only runs codiscuss: `command(codiscuss …)`, optionally after this tool's old access prefix. */
|
|
64
|
+
function codiscuss_only(rule) {
|
|
65
|
+
const body = /^command\((.*)\)$/s.exec(String(rule))?.[1];
|
|
66
|
+
if (!body) return false;
|
|
67
|
+
const text = body.replace(/^regex:\^?/, '').replace(/^\(\\\$env:DISCUSS_ACCESS[^)]*\)\?/, '').replace(/^\$env:DISCUSS_ACCESS\s*=\s*'[^']*';\s*/, '');
|
|
68
|
+
return /^codiscuss/.test(text);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* What the user allowed agy in its global and outside-of-project settings beyond the codiscuss commands. A confined
|
|
73
|
+
* task (`tool_lockdown`) denies each of them in its own session, since a deny rule wins over an allow (agy's documented
|
|
74
|
+
* order: deny > ask > allow); the user's settings are left as they are.
|
|
75
|
+
*/
|
|
76
|
+
function agy_saved_grants(user_home) {
|
|
77
|
+
const cli = read_json(join(user_home, '.gemini', 'antigravity-cli', 'settings.json'));
|
|
78
|
+
const shared = read_json(join(user_home, '.gemini', 'config', 'config.json'));
|
|
79
|
+
const outside = read_json(join(user_home, '.gemini', 'config', 'projects', `${AGY_OUTSIDE_PROJECT}.json`));
|
|
80
|
+
return [...(cli.permissions?.allow || []), ...(shared.userSettings?.globalPermissionGrants?.allow || []),
|
|
81
|
+
...(outside.permissionGrants?.permissionGrants?.allow || [])].filter(rule => typeof rule === 'string' && !codiscuss_only(rule));
|
|
82
|
+
}
|
|
83
|
+
|
|
63
84
|
/**
|
|
64
85
|
* Skill folders agy loads by itself: its own folder and every entry in its global skills.json. agy shows the model these
|
|
65
86
|
* skills' paths, so a run must be able to read them (1.5.3 refuses reads outside the added directories); agy leaves ~/
|
|
@@ -202,6 +223,7 @@ function agy_folders(config, task, root) {
|
|
|
202
223
|
* directories this member may only read are protected whatever its own access.
|
|
203
224
|
*/
|
|
204
225
|
function agy_project_grants(config, task, folders, user_home) {
|
|
226
|
+
if (task.tool_lockdown) return agy_lockdown_grants(task, user_home);
|
|
205
227
|
const read_only = (task.extra_directories || []).filter(item => item.access === 'read').map(item => item.path);
|
|
206
228
|
const projects = [...new Set([project_directory(config), ...folders].filter(directory => directory && !same_path(directory, task.draft_directory)
|
|
207
229
|
&& !read_only.some(path => same_path(path, directory))))];
|
|
@@ -220,6 +242,24 @@ function agy_project_grants(config, task, folders, user_home) {
|
|
|
220
242
|
deny: [...new Set(protected_paths.map(write_rule)), ...(full ? [] : ['mcp(*)'])] };
|
|
221
243
|
}
|
|
222
244
|
|
|
245
|
+
/**
|
|
246
|
+
* A confined task: only the codiscuss commands and writing its drafts; its runtime folder, skills, `~/.gemini` and its
|
|
247
|
+
* empty working folder stay unwritable, MCP tools and web page reads are refused, and the member's project, the room's
|
|
248
|
+
* other directories and the owner's allowed tools are ignored, and what the user allowed agy for itself is denied here.
|
|
249
|
+
* On agy 1.5.12 (2026-11-19, Ref_外部软件通信.md §7 实测
|
|
250
|
+
* 记录) reads outside the workspace, other commands, run_workflow, subagents and swarm workers were all refused; web
|
|
251
|
+
* search has no rule and stays available.
|
|
252
|
+
*/
|
|
253
|
+
function agy_lockdown_grants(task, user_home) {
|
|
254
|
+
const write_rule = directory => `write_file(${resolve(directory).replaceAll('\\', '/')})`;
|
|
255
|
+
const protected_paths = [task.member_directory, ...task.skill_directories, ...agy_skill_directories(user_home), join(user_home, '.gemini')];
|
|
256
|
+
if (protected_paths.some(directory => within_directory(directory, task.draft_directory))) {
|
|
257
|
+
throw new Error('agy 草稿目录不能位于运行目录、技能或 .gemini 配置目录中,未交付任务');
|
|
258
|
+
}
|
|
259
|
+
return { allow: [agy_rule(), write_rule(task.draft_directory)],
|
|
260
|
+
deny: [...new Set([...protected_paths.map(write_rule), 'mcp(*)', 'read_url(*)', ...agy_saved_grants(user_home)])] };
|
|
261
|
+
}
|
|
262
|
+
|
|
223
263
|
/** Initialize Antigravity's hidden placeholder project once on CLI-only setups; never overwrite an existing file. */
|
|
224
264
|
function ensure_outside_project(root) {
|
|
225
265
|
const path = join(root, 'projects', `${AGY_OUTSIDE_PROJECT}.json`);
|
|
@@ -244,7 +284,8 @@ export function prepare_agy_project(config, binding, task, user_home = homedir()
|
|
|
244
284
|
if (record.session_id && record.session_id !== binding.session_id) throw new Error('agy 项目记录与会话绑定不符,未交付讨论任务');
|
|
245
285
|
check_agy_shell(user_home);
|
|
246
286
|
const root = join(user_home, '.gemini', 'config');
|
|
247
|
-
|
|
287
|
+
// A confined task opens no project: only its own working folder, which holds nothing of this computer.
|
|
288
|
+
const directories = task.tool_lockdown ? [] : agy_folders(config, task, root);
|
|
248
289
|
const grants = agy_project_grants(config, task, directories, user_home);
|
|
249
290
|
if (record.project_id && record.project_id !== AGY_OUTSIDE_PROJECT && !/^[a-f0-9-]{36}$/.test(record.project_id)) {
|
|
250
291
|
throw new Error('agy 项目记录无效,未交付讨论任务');
|
|
@@ -283,6 +324,7 @@ export function remove_agy_projects(directory, user_home = homedir()) {
|
|
|
283
324
|
|
|
284
325
|
/** Native agy arguments; an expert the owner chose to host keeps its own conversation's project and permissions. */
|
|
285
326
|
function invocation(config, binding, task, user_home) {
|
|
327
|
+
if (task.tool_lockdown && config.session_id) throw new Error('托管的已有会话沿用它自己的权限,无法收窄,未交付任务');
|
|
286
328
|
const project = config.session_id ? null : prepare_agy_project(config, binding, task, user_home);
|
|
287
329
|
const cwd = launch_directory(config, task);
|
|
288
330
|
const extra = (project ? project.directories : (task.extra_directories || []).map(item => item.path))
|
|
@@ -294,13 +336,15 @@ function invocation(config, binding, task, user_home) {
|
|
|
294
336
|
...added.flatMap(directory => ['--add-dir', directory])];
|
|
295
337
|
// Headless agy refuses `--mode auto` ("not available for this account", 1.4.10–1.4.11) though its interactive window
|
|
296
338
|
// offers it; 全放开 uses the flag its own denial message suggests on top of the open session grants.
|
|
297
|
-
args.push('--mode', 'accept-edits', ...(config.project_access === 'full' ? ['--dangerously-skip-permissions'] : []),
|
|
339
|
+
args.push('--mode', 'accept-edits', ...(config.project_access === 'full' && !task.tool_lockdown ? ['--dangerously-skip-permissions'] : []),
|
|
298
340
|
...(project ? ['--project', project.project_id, '--settings', project.settings_path] : []));
|
|
299
341
|
if (binding.session_id) args.push('--conversation', binding.session_id);
|
|
300
342
|
if (config.model) args.push('--model', config.model);
|
|
301
343
|
if (config.effort) args.push('--effort', config.effort);
|
|
302
344
|
args.push('-p', task.prompt);
|
|
303
|
-
|
|
345
|
+
// The codiscuss CLI is told it runs confined, so its file arguments may name only the drafts.
|
|
346
|
+
const env = task.tool_lockdown ? { CODISCUSS_TOOL_LOCKDOWN: '1', CODISCUSS_LOCKDOWN_DIRECTORY: task.draft_directory } : null;
|
|
347
|
+
return { args, ...(env ? { env } : {}), ...(project ? { on_session: project.bind } : {}) };
|
|
304
348
|
}
|
|
305
349
|
|
|
306
350
|
/** Consume only documented lifecycle events, and remember refused operations so the page can name and allow them. */
|
package/runner/adapters/cli.mjs
CHANGED
|
@@ -135,7 +135,7 @@ export async function cli_delivery(adapter, config, binding, task, spawn_process
|
|
|
135
135
|
const launch = () => {
|
|
136
136
|
const child = spawn_process(invocation.executable || config.executable, invocation.args, {
|
|
137
137
|
cwd: launch_directory(config, task), windowsHide: true, shell: false, stdio: ['pipe', 'pipe', 'pipe'],
|
|
138
|
-
env: { ...process.env, DISCUSS_ACCESS_FILE: task.access_path },
|
|
138
|
+
env: { ...process.env, ...(invocation.env || {}), DISCUSS_ACCESS_FILE: task.access_path },
|
|
139
139
|
});
|
|
140
140
|
tree_killable(child);
|
|
141
141
|
const state = monitor_cli(adapter, child, binding, task, restart);
|
|
@@ -126,8 +126,8 @@ export const ADAPTER_PROFILES = {
|
|
|
126
126
|
unsupported_hints: { auto: 'agy 只在交互窗口提供自动模式,后台运行(-p)不支持' },
|
|
127
127
|
// Only a conversation this tool created gets its session rules; an existing one keeps its own project and permissions.
|
|
128
128
|
client: 'antigravity', adopt: 'session', host_existing: false, own_project_when_bound: true, browse_sessions: true,
|
|
129
|
-
|
|
130
|
-
capabilities: { delivery: PROCESS, rewind: 'cut', project: true, access_env: true, chat: true, capture: FINAL_REMARK, tool_lockdown:
|
|
129
|
+
// Confined by session rules that allow only the codiscuss commands and deny MCP and web reads (agy_lockdown_grants).
|
|
130
|
+
capabilities: { delivery: PROCESS, rewind: 'cut', project: true, access_env: true, chat: true, capture: FINAL_REMARK, tool_lockdown: true },
|
|
131
131
|
// A read-only agy session allows only codiscuss commands and headless agy ends the turn on a denied one; agy streams no
|
|
132
132
|
// thinking text, so without a word at each turning point the page cannot show how far it got.
|
|
133
133
|
task_rules: (cli, { runs_commands }) => (runs_commands ? ''
|
|
@@ -19,15 +19,14 @@ import { external_task_text, TASK_SUBCOMMANDS } from './expert_prompts.mjs';
|
|
|
19
19
|
import { atomic_json } from './files.mjs';
|
|
20
20
|
import { t } from './i18n.mjs';
|
|
21
21
|
|
|
22
|
-
export const
|
|
22
|
+
export const WAKES = ['auto', 'ask'];
|
|
23
|
+
// The single level records had before `wake` and `confined`, still accepted by `invited-trust` as a shorthand.
|
|
24
|
+
const LEGACY_TRUST = { default: { wake: 'ask', confined: true }, borrow: { wake: 'auto', confined: true }, trusted: { wake: 'auto', confined: false } };
|
|
23
25
|
export const APPROVAL_TIMEOUT_MS = 15 * 60000;
|
|
24
26
|
export const POLL_MS = 5000;
|
|
25
27
|
// The inviting room fails an execution whose lease lapses; renew it as the room runner does.
|
|
26
28
|
export const RENEW_MS = 30000;
|
|
27
29
|
// What “完全借用” allows when the owner sets no limit of their own.
|
|
28
|
-
export const BORROW_DEFAULTS = { max_wakes: 20, hours: 24 };
|
|
29
|
-
const MAX_WAKES_LIMIT = 1000;
|
|
30
|
-
const MAX_HOURS = 720;
|
|
31
30
|
const HISTORY_LIMIT = 50;
|
|
32
31
|
const MODEL_LIMIT = 120;
|
|
33
32
|
// What this computer keeps of each request its AI received and each answer it gave, so the history still reads after the
|
|
@@ -35,7 +34,6 @@ const MODEL_LIMIT = 120;
|
|
|
35
34
|
const TEXT_LIMIT = 4000;
|
|
36
35
|
// How often a pass also reads the member's current grant (`/view`) when nothing is woken; a wake and the room view always read it.
|
|
37
36
|
const VIEW_REFRESH_MS = 60000;
|
|
38
|
-
const HOUR_MS = 3600000;
|
|
39
37
|
// The website gives up on a relayed request after 9 seconds; ask for an answer within that.
|
|
40
38
|
const RELAY_WAIT_MS = 8000;
|
|
41
39
|
const REQUEST_TIMEOUT_MS = 15000;
|
|
@@ -155,12 +153,21 @@ function with_store(home, task) {
|
|
|
155
153
|
} finally { rmSync(lock, { force: true }); }
|
|
156
154
|
}
|
|
157
155
|
|
|
156
|
+
/**
|
|
157
|
+
* How a record treats being named, `{wake, confined}`: `wake` is `auto` (start at once) or
|
|
158
|
+
* `ask` (wait for the owner), `confined` whether the AI may run only the codiscuss commands. Each record keeps its own;
|
|
159
|
+
* one joined before these two settings follows the level its inviting computer had (default / borrow / trusted).
|
|
160
|
+
*/
|
|
161
|
+
function record_settings(record, store) {
|
|
162
|
+
if (WAKES.includes(record.wake)) return { wake: record.wake, confined: record.confined !== false };
|
|
163
|
+
return LEGACY_TRUST[store.machines[record.machine_fingerprint]?.trust] || LEGACY_TRUST.default;
|
|
164
|
+
}
|
|
165
|
+
|
|
158
166
|
/** A record as every command shows it: no key, no credential. */
|
|
159
167
|
export function record_view(record, store) {
|
|
160
|
-
const
|
|
161
|
-
const trust = TRUST_LEVELS.includes(machine.trust) ? machine.trust : 'default';
|
|
168
|
+
const settings = record_settings(record, store);
|
|
162
169
|
const { session_id, machine_key, ai_reported, ...shown } = record;
|
|
163
|
-
return { ...shown,
|
|
170
|
+
return { ...shown, ...settings, lockdown: settings.confined, approvals: (record.approvals || []).filter(item => item.status === 'waiting') };
|
|
164
171
|
}
|
|
165
172
|
|
|
166
173
|
function find_record(store, id) {
|
|
@@ -439,15 +446,15 @@ export async function join_invite(home, input, deps = {}) {
|
|
|
439
446
|
return with_store(home, (store, secrets, now) => {
|
|
440
447
|
const id = attempt.id;
|
|
441
448
|
const name = joined.machine?.name || keys.name || invite.machine_name;
|
|
442
|
-
// Accepting the invitation is the consent: a new
|
|
443
|
-
const machine = store.machines[keys.fingerprint] ||= {
|
|
449
|
+
// Accepting the invitation is the consent: a new record answers at once, confined.
|
|
450
|
+
const machine = store.machines[keys.fingerprint] ||= {};
|
|
444
451
|
Object.assign(machine, { machine: keys.id, site: invite.site, machine_name: name, updated_at: now });
|
|
445
452
|
store.records[id] = { id, site: invite.site, machine: keys.id, machine_name: name, machine_fingerprint: keys.fingerprint,
|
|
446
453
|
machine_key: keys.public_key, fingerprint_checked: Boolean(invite.fingerprint), room: joined.room.id, room_title: String(joined.room.name || invite.room_name),
|
|
447
454
|
member: joined.member.name, member_id: joined.member.id ?? null, key_id, open_level: joined.level || invite.level || 'read',
|
|
448
455
|
directories: Array.isArray(joined.directories) ? joined.directories : [],
|
|
449
|
-
expires_at: Number(joined.expires_at) ? Number(joined.expires_at) * 1000 : null, ai, ai_reported: JSON.stringify(identity),
|
|
450
|
-
limits:
|
|
456
|
+
expires_at: Number(joined.expires_at) ? Number(joined.expires_at) * 1000 : null, ai, ai_reported: JSON.stringify(identity), wake: 'auto', confined: true,
|
|
457
|
+
limits: null, wakes: 0, last_wake_at: null, paused: false,
|
|
451
458
|
status: 'active', contact: { at: now, state: 'online', error: '' }, approvals: [], history: [], running: null, joined_at: now };
|
|
452
459
|
secrets.get()[id] = { private_key: pair.private_key, token: joined.token };
|
|
453
460
|
secrets.changed = true;
|
|
@@ -455,34 +462,25 @@ export async function join_invite(home, input, deps = {}) {
|
|
|
455
462
|
});
|
|
456
463
|
}
|
|
457
464
|
|
|
458
|
-
function bounded(value, max, label) {
|
|
459
|
-
const number = Number(value);
|
|
460
|
-
if (!Number.isInteger(number) || number < 1 || number > max) throw failure('invalid_number', '{label} 须为 1–{max} 的整数', { label, max });
|
|
461
|
-
return number;
|
|
462
|
-
}
|
|
463
465
|
|
|
464
|
-
/**
|
|
465
|
-
|
|
466
|
-
|
|
466
|
+
/**
|
|
467
|
+
* Set how this record treats being named: `wake` (auto / ask) and `confined`, either of which may be left out, or the old
|
|
468
|
+
* single `trust` level. Answering at once has no wake count or time limit (2026-11-19, user); any a record had is dropped.
|
|
469
|
+
*/
|
|
470
|
+
export function set_trust(home, { id, trust, wake, confined }) {
|
|
471
|
+
if (trust !== undefined && !LEGACY_TRUST[trust]) throw failure('invalid_trust', '信任等级只能是 default、borrow 或 trusted');
|
|
472
|
+
if (wake !== undefined && !WAKES.includes(wake)) throw failure('invalid_wake', '被点名时只能是 auto 或 ask');
|
|
473
|
+
const chosen = trust !== undefined ? LEGACY_TRUST[trust] : { wake, confined: confined === undefined ? undefined : confined !== false && confined !== 'false' };
|
|
467
474
|
return change_record(home, id, (record, now, store) => {
|
|
468
|
-
const
|
|
469
|
-
Object.assign(
|
|
470
|
-
if (trust === 'borrow') {
|
|
471
|
-
const limit = max_wakes === undefined ? record.limits?.max_wakes ?? BORROW_DEFAULTS.max_wakes : bounded(max_wakes, MAX_WAKES_LIMIT, 'max_wakes');
|
|
472
|
-
const end = until !== undefined ? Number(until) : hours !== undefined ? now + bounded(hours, MAX_HOURS, 'hours') * HOUR_MS
|
|
473
|
-
: record.limits?.until > now ? record.limits.until : now + BORROW_DEFAULTS.hours * HOUR_MS;
|
|
474
|
-
if (!Number.isFinite(end) || end <= now) throw failure('invalid_deadline', '借用期限须晚于现在');
|
|
475
|
-
record.limits = { max_wakes: limit, until: end, used: 0 };
|
|
476
|
-
}
|
|
475
|
+
const current = record_settings(record, store);
|
|
476
|
+
Object.assign(record, { wake: chosen.wake ?? current.wake, confined: chosen.confined ?? current.confined, limits: null });
|
|
477
477
|
return { record: record_view(record, store) };
|
|
478
478
|
});
|
|
479
479
|
}
|
|
480
480
|
|
|
481
|
-
/** Whether a request may wake the AI without asking:
|
|
482
|
-
export function wakes_directly(record, store
|
|
483
|
-
|
|
484
|
-
if (trust === 'trusted') return true;
|
|
485
|
-
return trust === 'borrow' && Boolean(record.limits) && record.limits.used < record.limits.max_wakes && record.limits.until > now;
|
|
481
|
+
/** Whether a request may wake the AI without asking: the record answers at once. */
|
|
482
|
+
export function wakes_directly(record, store) {
|
|
483
|
+
return record_settings(record, store).wake === 'auto';
|
|
486
484
|
}
|
|
487
485
|
|
|
488
486
|
/**
|
|
@@ -654,7 +652,7 @@ export async function invited_command(home, action, input = {}, deps = {}) {
|
|
|
654
652
|
if (action === 'invited-list') {
|
|
655
653
|
const store = read_store(home);
|
|
656
654
|
return { records: Object.values(store.records).map(record => record_view(record, store)).sort((a, b) => b.joined_at - a.joined_at),
|
|
657
|
-
machines: Object.entries(store.machines).map(([fingerprint, item]) => ({ fingerprint,
|
|
655
|
+
machines: Object.entries(store.machines).map(([fingerprint, item]) => ({ fingerprint, machine_name: item.machine_name || '', site: item.site || '' })) };
|
|
658
656
|
}
|
|
659
657
|
if (action === 'invited-join') return join_invite(home, input, deps);
|
|
660
658
|
if (action === 'invited-trust') return set_trust(home, input);
|
|
@@ -1012,13 +1010,11 @@ function load_access(path) {
|
|
|
1012
1010
|
const integer = value => value === undefined ? undefined : Number(value);
|
|
1013
1011
|
|
|
1014
1012
|
function print_record(record) {
|
|
1015
|
-
const
|
|
1013
|
+
const wake = record.wake === 'ask' ? t('先问我') : t('直接回答');
|
|
1014
|
+
const scope = record.confined ? t('只在房间里发言') : t('不受限');
|
|
1016
1015
|
const contact = { online: t('在线'), offline: t('不在线'), error: t('出错'), unknown: t('未知') }[record.contact?.state || 'unknown'];
|
|
1017
1016
|
const lines = [t('{id} {room}({site})成员 {member}', { id: record.id, room: record.room_title || record.room, site: record.site, member: record.member }),
|
|
1018
|
-
t('
|
|
1019
|
-
if (record.trust === 'borrow' && record.limits) {
|
|
1020
|
-
lines.push(t(' 借用上限:{used}/{max} 次,至 {until}', { used: record.limits.used, max: record.limits.max_wakes, until: new Date(record.limits.until).toLocaleString() }));
|
|
1021
|
-
}
|
|
1017
|
+
t(' 被点名时:{wake};在这台电脑上:{scope};已唤醒 {wakes} 次;对方电脑:{contact}{paused}', { wake, scope, wakes: record.wakes, contact, paused: record.paused ? t(';已暂停') : '' })];
|
|
1022
1018
|
for (const item of record.approvals) lines.push(t(' 待确认 {approval}:消息 {messages}', { approval: item.id, messages: item.message_ids.map(n => `#${n}`).join(', ') }));
|
|
1023
1019
|
if (record.status === 'left') lines.push(t(' 已退出'));
|
|
1024
1020
|
if (record.status === 'ended') lines.push(t(' 对方已结束你的成员资格({reason})', { reason: record.end_reason }));
|
|
@@ -1030,7 +1026,7 @@ const HELP = () => t(`被邀请的房间(本机 AI 作为外部成员参加另
|
|
|
1030
1026
|
用法:
|
|
1031
1027
|
codiscuss join <链接|配对码> [--site 站点] [--machine 电脑编号] --adapter 软件 [--model M] [--effort E]
|
|
1032
1028
|
codiscuss invited list
|
|
1033
|
-
codiscuss invited trust ID
|
|
1029
|
+
codiscuss invited trust ID auto|ask [--unconfined|--confined]
|
|
1034
1030
|
codiscuss invited ai ID [--adapter 软件] [--model M] [--effort E]
|
|
1035
1031
|
codiscuss invited pause ID | resume ID
|
|
1036
1032
|
codiscuss invited approve ID 待确认编号 | refuse ID 待确认编号
|
|
@@ -1038,7 +1034,8 @@ const HELP = () => t(`被邀请的房间(本机 AI 作为外部成员参加另
|
|
|
1038
1034
|
codiscuss invited remove ID
|
|
1039
1035
|
codiscuss invited room ID
|
|
1040
1036
|
|
|
1041
|
-
|
|
1037
|
+
被点名时:auto 直接回答;ask 每次先问你。
|
|
1038
|
+
在这台电脑上:默认只在房间里发言(只能运行共议命令);--unconfined 不受限,可读本机文件、联网。
|
|
1042
1039
|
同意后由本机服务唤醒 AI,请保持 codiscuss 服务运行。加 --json 输出 JSON。
|
|
1043
1040
|
`);
|
|
1044
1041
|
|
|
@@ -1057,7 +1054,8 @@ export async function external_main(command, args, { home, deps = {}, write = te
|
|
|
1057
1054
|
const service = home || (await import('./discussion_service.mjs')).service_home();
|
|
1058
1055
|
const { values, positionals } = parseArgs({ args, allowPositionals: true, options: {
|
|
1059
1056
|
site: { type: 'string' }, machine: { type: 'string' }, adapter: { type: 'string' }, model: { type: 'string' }, effort: { type: 'string' },
|
|
1060
|
-
label: { type: 'string' },
|
|
1057
|
+
label: { type: 'string' }, json: { type: 'boolean' }, help: { type: 'boolean', short: 'h' },
|
|
1058
|
+
unconfined: { type: 'boolean' }, confined: { type: 'boolean' },
|
|
1061
1059
|
'access-file': { type: 'string' }, root: { type: 'string' }, offset: { type: 'string' }, limit: { type: 'string' }, 'max-bytes': { type: 'string' },
|
|
1062
1060
|
path: { type: 'string' }, 'case-sensitive': { type: 'boolean' }, 'max-results': { type: 'string' },
|
|
1063
1061
|
} });
|
|
@@ -1081,7 +1079,10 @@ export async function external_main(command, args, { home, deps = {}, write = te
|
|
|
1081
1079
|
const action = { list: 'invited-list', trust: 'invited-trust', ai: 'invited-ai', pause: 'invited-pause', resume: 'invited-pause', approve: 'invited-approve',
|
|
1082
1080
|
refuse: 'invited-refuse', leave: 'invited-leave', remove: 'invited-remove', room: 'invited-room' }[verb];
|
|
1083
1081
|
if (!action) return write(HELP());
|
|
1084
|
-
|
|
1082
|
+
// `trust ID auto|ask` sets how it answers; the old single levels (default / borrow / trusted) are still understood.
|
|
1083
|
+
const setting = !extra ? {} : LEGACY_TRUST[extra] ? { trust: extra } : { wake: extra };
|
|
1084
|
+
const scope = values.unconfined ? { confined: false } : values.confined ? { confined: true } : {};
|
|
1085
|
+
const input = { id, ...(verb === 'trust' ? { ...setting, ...scope } : {}),
|
|
1085
1086
|
...(verb === 'ai' ? ai : {}), ...(['pause', 'resume'].includes(verb) ? { paused: verb === 'pause' } : {}), ...(['approve', 'refuse'].includes(verb) ? { approval: extra } : {}) };
|
|
1086
1087
|
result = await invited_command(service, action, input, deps);
|
|
1087
1088
|
}
|