ai_co_discuss 0.4.83 → 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 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 不支持。见 [外部成员](docs/runner.md#外部成员借用另一台电脑上的-ai)。
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
 
@@ -14,7 +14,7 @@ import time
14
14
  from datetime import datetime, timezone
15
15
 
16
16
  from . import free_room
17
- from .identity import AI_PLATFORMS, MAX_ROOM_AGENTS, is_ai
17
+ from .identity import AI_PLATFORMS, MAX_ROOM_AGENTS, PLATFORM_NICKNAMES, is_ai
18
18
  from .runtime import begin_write, require_owner, token_hash
19
19
  from .texts import Text, text_payload
20
20
 
@@ -290,10 +290,7 @@ def create_external(connection, room_id, token, payload, now):
290
290
  if duration not in ("1h", "today", "3d", "7d", "30d"):
291
291
  raise ValueError(Text("外部成员不存在"))
292
292
  connection.execute("UPDATE external_members SET claimed_at=0,invite_duration=? WHERE member_id=?", (duration, cursor.lastrowid))
293
- suffix = name.removeprefix("Custom-ext") if name.startswith("Custom-ext") else f"-{cursor.lastrowid}"
294
- connection.execute("""INSERT INTO member_labels(room_id,name,label,updated_at) VALUES(?,?,?,?)
295
- ON CONFLICT(room_id,name) DO UPDATE SET label=excluded.label,updated_at=excluded.updated_at""",
296
- (room_id, name, str(Text("另一台电脑{suffix}", suffix=suffix)), now))
293
+ save_label(connection, room_id, name, pending_label(name, cursor.lastrowid), now)
297
294
  free_room.queue_invited_expert(connection, room_id, name, now)
298
295
  free_room.sync_participants(connection, room_id)
299
296
  row = external_row(connection, room_id, cursor.lastrowid)
@@ -358,6 +355,7 @@ def seat_action(connection, row, payload, now):
358
355
  save_ai(connection, row["id"], payload, now)
359
356
  connection.execute("UPDATE external_members SET machine=?,machine_label=?,token_hash=?,expires_at=? WHERE member_id=?",
360
357
  (machine, label, hashed, expiry, row["id"]))
358
+ name_joined(connection, row, now)
361
359
  elif action == "activate":
362
360
  if not row["machine"]:
363
361
  raise FileExistsError(Text("外部成员不存在"))
@@ -369,6 +367,36 @@ def seat_action(connection, row, payload, now):
369
367
  return owner_view(connection, external_row(connection, row["room_id"], row["id"]))
370
368
 
371
369
 
370
+ def pending_label(name, member_id):
371
+ """The name a seat goes by until someone joins it: 外部专家, 外部专家2 … (the suffix of Custom-ext, Custom-ext2 …)."""
372
+ suffix = name.removeprefix("Custom-ext") if name.startswith("Custom-ext") else f"-{member_id}"
373
+ return str(Text("外部专家{suffix}", suffix=suffix))
374
+
375
+
376
+ def save_label(connection, room_id, name, label, now):
377
+ """Set one member's display label; its member name (ID) stays as it is."""
378
+ connection.execute("""INSERT INTO member_labels(room_id,name,label,updated_at) VALUES(?,?,?,?)
379
+ ON CONFLICT(room_id,name) DO UPDATE SET label=excluded.label,updated_at=excluded.updated_at""", (room_id, name, label, now))
380
+
381
+
382
+ def name_joined(connection, row, now):
383
+ """On first joining, a seat still under its pending name takes its AI's (外部 Claude, 外部 Claude2 …).
384
+
385
+ A name the owner gave is kept, and so is the pending one when the AI is unknown or a custom API, which has no
386
+ name of its own. Only the label changes; the member name that requests and records use stays.
387
+ """
388
+ platform = connection.execute("SELECT platform FROM external_members WHERE member_id=?", (row["id"],)).fetchone()[0]
389
+ current = free_room.member_labels(connection, row["room_id"]).get(row["name"])
390
+ legacy = "另一台电脑" + row["name"].removeprefix("Custom-ext")
391
+ if platform in ("", "Custom") or current not in (pending_label(row["name"], row["id"]), legacy):
392
+ return
393
+ nickname = PLATFORM_NICKNAMES.get(platform, platform)
394
+ taken = set(free_room.member_display_names(connection, row["room_id"]).values())
395
+ label = next(candidate for number in range(1, MAX_ROOM_AGENTS + 2)
396
+ if (candidate := f"外部 {nickname}{number if number > 1 else ''}") not in taken)
397
+ save_label(connection, row["room_id"], row["name"], label, now)
398
+
399
+
372
400
  def list_reads(connection, room_id, member_id, token, params):
373
401
  """The owner reads one external member's read records in order."""
374
402
  require_owner(connection, room_id, token)
@@ -557,6 +585,9 @@ def external_api(connection, parts, params, method, token, read_payload, hooks):
557
585
  if method == "GET" and route == ["view"]:
558
586
  return member_room_view(connection, room_id, member), 200
559
587
  if method == "GET" and route == ["messages"]:
588
+ # "Requests naming me" follows the room's records: the text says the name the owner gave it, not its member ID.
589
+ if reading.get("mention") == member["name"]:
590
+ reading = {**{key: value for key, value in reading.items() if key != "mention"}, "requested_of": member["id"]}
560
591
  return hooks["messages"](connection, room_id, reading, token), 200
561
592
  if method == "GET" and len(route) == 2 and route[0] == "messages" and route[1].isdigit():
562
593
  return hooks["message"](connection, room_id, int(route[1]), reading, token), 200
@@ -17,6 +17,8 @@ MAX_ROOM_AGENTS = 12
17
17
  INSTANCE_PATTERN = re.compile(rf"({'|'.join(AI_PLATFORMS)})(?:-[0-9A-Za-z_]{{1,{MAX_INSTANCE_SUFFIX}}})?")
18
18
  # The name people and AIs call a platform when it differs from its ID; web/app.js PLATFORM_IDENTITIES shows the same.
19
19
  PLATFORM_NICKNAMES = {"Antigravity": "Gemini", "Custom": "自定义 API"}
20
+ # What a joined external member is called after (外部 Claude); a custom API keeps its pending name.
21
+ JOINED_NICKNAMES = {PLATFORM_NICKNAMES.get(platform, platform) for platform in AI_PLATFORMS if platform != "Custom"}
20
22
 
21
23
 
22
24
  def is_ai(name):
@@ -44,8 +46,16 @@ def default_label(name):
44
46
 
45
47
  def default_label_text(name, label):
46
48
  """Return display metadata only for the unchanged Custom platform nickname."""
47
- if name.startswith("Custom-ext") and label == "另一台电脑" + name.removeprefix("Custom-ext"):
48
- return text_payload(Text("另一台电脑{suffix}", suffix=name.removeprefix("Custom-ext")))
49
+ if name.startswith("Custom-ext"):
50
+ suffix = name.removeprefix("Custom-ext")
51
+ if label == "外部专家" + suffix:
52
+ return text_payload(Text("外部专家{suffix}", suffix=suffix))
53
+ # Rooms invited before the pending name was renamed keep the label stored then.
54
+ if label == "另一台电脑" + suffix:
55
+ return text_payload(Text("另一台电脑{suffix}", suffix=suffix))
56
+ joined = re.fullmatch(r"外部 (\S+?)(\d*)", label or "")
57
+ if joined and joined[1] in JOINED_NICKNAMES:
58
+ return text_payload(Text("外部 {ai}{suffix}", ai=joined[1], suffix=joined[2]))
49
59
  if platform_of(name) == "Custom" and label == default_label(name):
50
60
  return text_payload(Text("自定义 API{suffix}", suffix=name[len("Custom"):]))
51
61
  return None
package/backend/server.py CHANGED
@@ -83,7 +83,7 @@ DIRECTORY_OPERATIONS = ("move", "folder")
83
83
  # Local entry commands for external members: the owner's invites (room credential) and this computer's invited records.
84
84
  INVITE_COMMANDS = ("room-invite", "room-invites", "room-invite-revoke")
85
85
  INVITED_COMMANDS = ("invited-list", "invited-join", "invited-trust", "invited-ai", "invited-pause", "invited-approve", "invited-refuse",
86
- "invited-leave", "invited-room")
86
+ "invited-leave", "invited-remove", "invited-room")
87
87
  ADMIN_OPERATIONS = ("rename", "archive", "restore", "delete")
88
88
  DIRECTORY_PICKER_TIMEOUT = 600 # the folder dialog waits for the person at the computer
89
89
  # Files are streamed to players in pieces of this size.
@@ -2002,6 +2002,10 @@ def message_filters(room_id, params):
2002
2002
  if mention:
2003
2003
  clauses.append("instr(messages.text, ?) > 0")
2004
2004
  values.append(f"@{mention}")
2005
+ if "requested_of" in params:
2006
+ # The requests the room recorded for this member, however the owner has renamed it in the text.
2007
+ clauses.append("messages.id IN (SELECT message_id FROM member_requests WHERE room_id=? AND member_id=?)")
2008
+ values.extend([room_id, int(params["requested_of"])])
2005
2009
  if "kind" in params:
2006
2010
  if params["kind"] not in ("opinion", "moderation", "receipt", "chat"):
2007
2011
  raise ValueError(Text('发言职责无效'))
package/docs/en/runner.md CHANGED
@@ -89,32 +89,30 @@ 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 the access and membership duration after check-in. "Can read 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, QR code or pairing 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.
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.
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, downgrade to discussion only, or revoke; revoking takes effect immediately.
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
- 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 or pairing code; or run `codiscuss join <link or code> --adapter TOOL`. A pairing code also needs the inviting site's address.
100
- 2. Pick the AI, model and effort, and a trust level:
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):
101
101
 
102
- | Trust level | When named | Local AI |
103
- | --- | --- | --- |
104
- | Default | 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" in the room | Limited to CoDiscuss commands, running in an empty temporary folder |
105
- | Full loan | Woken directly, within a wake count and time limit (20 wakes and 1 day by default); once used up it goes back to asking each time | Same as above |
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
- You can change the level and limits later in the invited room's right panel, or pause or leave; `codiscuss invited` offers the same commands. Trusted computer can be set only on the other computer itself; a paired phone or tablet can choose only Default or Full loan. The local service does the waking, so keep codiscuss running.
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**: Default and Full loan need 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), and so do model APIs, backed by unit tests; Codex and Antigravity do not support it and can serve only at the Trusted computer level; desktop apps cannot join as external members.
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
 
114
113
  **Keep in mind**:
115
114
  - What it reads cannot be taken back: it stays in the other AI's session and reaches the other side's model provider; revoking only stops later reads.
116
115
  - If someone else uses an invite first within its 10 minutes, they become a member, and only revoking after the notice fixes it. Send invites only to people you trust.
117
- - A pairing code carries no key fingerprint for your computer, so the other side cannot check it reached you; prefer the link or QR code.
118
116
  - At Trusted computer the other AI is unrestricted, and content in your room may lead it to read files on that computer; use it only between your own computers.
119
117
 
120
118
  ## API Access
package/docs/runner.md CHANGED
@@ -120,32 +120,30 @@ codiscuss local connect https://你的站点
120
120
  **前提**:两台电脑都安装共议并运行本机服务;你的电脑已[连接线上网站](#线上网页连接本机)并部署了中转,对方经这个网站的加密中转访问你的房间。你的电脑关机或 codiscuss 未运行时,对方什么也拿不到。
121
121
 
122
122
  **邀请(你的电脑)**:
123
- 1. 建房面板或右栏“邀请成员”里点“外部”一行的“外部专家 +”(可加多位),翻到卡片背面设置开放内容和签到后的有效期。选“可读项目”时开放本房间的全部项目目录。
124
- 2. 点“添加待签到席位”(建房时自动添加),右栏名单立即显示待签到成员;把席位的链接、二维码或配对码发给对方。链接 10 分钟有效,只能绑定一位成员;重新生成会立即作废旧链接。未绑定线上站点时显示“待生成链接”及原因,绑定站点后从席位菜单生成。待签到面板显示自动结束期限,可“移除席位”;签到后才显示用量、读取记录和授权调整。
123
+ 1. 建房面板或右栏“邀请成员”里点“外部”一行的“外部专家 +”(可加多位),翻到卡片背面设置“对方能看到”(房间消息 / 消息和项目)和签到后的有效期。选“消息和项目”时开放本房间的全部项目目录。
124
+ 2. 点“添加待签到席位”(建房时自动添加),右栏名单立即显示待签到成员;把席位的链接或二维码发给对方。链接 10 分钟有效,只能绑定一位成员;重新生成会立即作废旧链接。未绑定线上站点时显示“待生成链接”及原因,绑定站点后从席位菜单生成。待签到面板显示自动结束期限,可“移除席位”;签到后才显示用量、读取记录和授权调整。
125
125
  3. 对方兑换即完成签到,成员有效期从兑换时开始,**没有额外批准步骤**。未签到不收任务、不参与全体回应或讨论,7 天后自动结束;链接过期不会删除席位。
126
- 4. 在房间里 `@` 它,回答照常出现在对话中。成员菜单的“读取记录与权限”列出它读过的每个文件(由你的电脑记录),可延长、降为只讨论或撤销授权,撤销立即生效。
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
- | 信任等级 | 被点名后 | 本机 AI |
134
- | --- | --- | --- |
135
- | 默认 | 每次须你在右栏同意才唤醒;拒绝或 15 分钟未处理,对方看到“对方未同意” | 只能用共议命令,在空的临时目录运行 |
136
- | 完全借用 | 直接唤醒,受次数与期限上限(默认 20 次、1 天),用完退回每次询问 | 同上 |
137
- | 信任设备 | 直接唤醒,不设上限;之后这台电脑发来的邀请按此等级直接接受 | 不受限,可用本机文件与联网工具 |
133
+ | 设置 | 选项 |
134
+ | --- | --- |
135
+ | 被点名时 | 直接回答:不设次数与期限上限 · 先问我:每次在右栏同意才唤醒,拒绝或 15 分钟未处理,对方看到“对方未同意” |
136
+ | 在这台电脑上 | 只在房间里发言:只能用共议命令,在空的临时目录运行 · 不受限:可读本机文件、联网 |
138
137
 
139
- 等级与上限之后可在被邀请房间的右栏调整,也可暂停或退出;`codiscuss invited` 有同样的命令。“信任设备”只能在对方电脑本机设置,从已配对的手机或平板只能选“默认”或“完全借用”。唤醒由本机服务完成,请保持 codiscuss 运行。
138
+ 两项都按房间分别保存,之后可在被邀请房间的右栏调整,也可暂停或退出,房间结束后可删除这台电脑上的记录;`codiscuss invited` 有同样的命令,已配对的手机或平板也能设置全部选项。唤醒由本机服务完成,请保持 codiscuss 运行。
140
139
 
141
- **支持的软件**:默认与完全借用要求软件能限制为只用共议命令,目前支持 Claude Code(后台运行,已在 2.1.325 版实测,其他版本未逐一验证)与模型 API(以单元测试为据);Codex、Antigravity 不支持收窄,只能在“信任设备”等级下服务;桌面 App 不能作为外部成员加入。
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
 
145
144
  **须知**:
146
145
  - 读出去的内容收不回:它会留在对方 AI 的会话里,并发送给对方的模型服务商;撤销只阻止以后的读取。
147
146
  - 邀请若在 10 分钟内被别人抢先使用,对方即成为成员,只能靠你看到提示后撤销。只把邀请发给信任的人。
148
- - 配对码不含你电脑的密钥指纹,对方核对不了连到的是不是你;能用链接或二维码时优先用。
149
147
  - “信任设备”等级下对方的 AI 不受限,你房间里的内容可能诱导它读对方电脑上的文件,只在自己的电脑之间使用。
150
148
 
151
149
  ## API 接入
@@ -1,21 +1,33 @@
1
1
  {
2
2
  "对方未同意": "Not accepted by the other side",
3
3
  "被邀请的房间": "Invited rooms",
4
- "只讨论": "Discussion only",
5
- "只看房间里点名给它的请求并回答,不读项目文件": "Sees only the requests that name it and answers them; reads no project files",
6
- "可读项目": "Can read project",
7
- "另可列目录、读文件、搜索本房间的项目目录;不能写入或执行": "Can also list, read and search this room's project directories; cannot write or run anything",
8
- "只读项目": "Read-only project",
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,32 +43,26 @@
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",
47
56
  "消息会发给对方模型服务商": "Messages go to their model provider",
48
57
  "生成邀请需要本机服务,请在这台电脑打开本机网站。": "Creating an invitation needs the local service; open the local website on this computer.",
49
58
  "邀请二维码": "Invitation QR code",
50
- "把链接或二维码发给对方;对方也可以在自己的共议里输入配对码:": "Send the link or QR code to the other person; they can also enter the pairing code in their own CoDiscuss:",
51
- "复制配对码": "Copy pairing code",
52
- "配对码不含这台电脑的公钥指纹,优先发链接或二维码。": "The pairing code does not carry this computer's key fingerprint; prefer sending the link or QR code.",
59
+ "把链接或二维码发给对方。": "Send the link or QR code to the other person.",
53
60
  "立即生效:之后的请求与读取一律被拒,未完成的执行作废。": "Takes effect at once: later requests and reads are refused, and unfinished runs are voided.",
54
61
  "已经读出去的内容收不回,会留在对方 AI 的会话里。": "What was already read cannot be taken back; it stays in the other AI's session.",
55
62
  "外部成员 · {name}": "External member · {name}",
56
63
  "调整": "Adjust",
57
64
  "延长": "Extend",
58
65
  "已延长": "Extended",
59
- "降为只讨论": "Downgrade to discussion only",
60
66
  "已降为只讨论,之后不能再读项目文件": "Downgraded to discussion only; it can no longer read project files",
61
67
  "读取记录": "Read log",
62
68
  "还没有读取记录": "No reads yet",
@@ -84,13 +90,10 @@
84
90
  "AI 正在处理": "Your AI is working",
85
91
  "等待点名": "Waiting to be named",
86
92
  "被点名时不会启动": "It will not start when named",
87
- "这个 AI 软件只能在“信任设备”等级下服务。": "This AI software can serve only at the \"Trusted computer\" level.",
88
93
  "详情": "Details",
89
94
  "还没有人点名你的 AI。": "No one has named your AI yet.",
90
95
  "对方": "The other side",
91
96
  "你的 AI": "Your AI",
92
- "信任等级已更新": "Trust level updated",
93
- "已唤醒 {count} / {limit} 次": "Started {count} of {limit} times",
94
97
  "已唤醒 1 次": "Started once",
95
98
  "已唤醒 {count} 次": "Started {count} times",
96
99
  "在线": "Online",
@@ -105,36 +108,28 @@
105
108
  "同意并唤醒": "Approve and start",
106
109
  "拒绝": "Decline",
107
110
  "对方开放": "Opened by them",
108
- "信任等级": "Trust level",
109
111
  "(已暂停)": " (paused)",
110
- "借用至": "Loan ends",
111
112
  "剩余时间": "Time left",
112
113
  "连接": "Connection",
113
114
  "用配对码加入,未核对对方电脑的公钥指纹。": "Joined with a pairing code; the other computer's key fingerprint was not checked.",
114
- "信任等级按对方电脑记录:这台电脑邀请的所有房间一起生效。": "Trust is recorded per inviting computer: it applies to every room from that computer.",
115
- "调整信任等级": "Change trust level",
116
- "恢复后,对方点名按信任等级处理": "Once resumed, being named is handled by the trust level",
117
115
  "暂停期间不领取也不唤醒;已在等你确认的请求到时照常算作未同意": "While paused nothing is taken or started; requests already awaiting you still count as declined when they time out",
118
116
  "退出房间": "Leave room",
119
117
  "退出「{room}」": "Leave \"{room}\"",
120
- "用链接或配对码加入": "Join with a link or pairing code",
118
+ "用邀请链接加入": "Join with an invitation link",
121
119
  "被邀请的房间列表": "Invited room list",
122
- "{computer} · {trust}": "{computer} · {trust}",
123
120
  "未命名房间": "Untitled room",
124
121
  "{count} 待确认": "{count} awaiting you",
125
122
  "连接本机服务后查看": "Connect the local service to see them",
126
- "只讨论:只看点名给它的请求并回答": "Discussion only: sees only the requests that name it and answers them",
127
- "可读项目:另可读对方开放的目录,不能写入或执行": "Can read project: can also read the opened directories; cannot write or run anything",
128
123
  "加入共议房间 · AI CoDiscuss": "Join a CoDiscuss room · AI CoDiscuss",
129
124
  "没有邀请内容": "No invitation here",
130
- "请打开对方发来的完整链接,或在自己的共议里输入配对码。": "Open the complete link you were sent, or enter the pairing code in your own CoDiscuss.",
125
+ "请打开对方发来的完整链接。": "Open the complete link you were sent.",
131
126
  "邀请人的电脑": "Inviting computer",
132
127
  "开放": "Opens",
133
128
  "链接须在此前兑换": "Redeem the link before",
134
129
  "复制邀请链接": "Copy invitation link",
135
130
  "复制失败,请手动复制地址栏": "Copy failed; copy the address bar manually",
136
131
  "你被邀请让自己的 AI 加入一个共议房间": "You are invited to bring your own AI into a CoDiscuss room",
137
- "你的 AI 在你自己的电脑上运行,用你自己的账号与额度;对方点名后,默认先问你同意才唤醒。": "Your AI runs on your own computer with your own account and quota; by default you are asked before it starts each time it is named.",
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.",
138
133
  "对方开放的项目内容会经你的 AI 发送给它的模型服务商。": "Project content they open reaches your AI's model provider.",
139
134
  "用本机共议加入": "Join with CoDiscuss on this computer",
140
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.",
@@ -143,28 +138,30 @@
143
138
  "已加入「{room}」": "Joined \"{room}\"",
144
139
  "加入另一台电脑的房间": "Join a room on another computer",
145
140
  "你的 AI 在这台电脑上运行,只读对方开放的目录,在对方房间里回答。": "Your AI runs on this computer, reads only the directories they open, and answers in their room.",
146
- "邀请链接或配对码": "Invitation link or pairing code",
147
- "粘贴对方发来的链接,或输入配对码": "Paste the link you were sent, or enter the pairing code",
148
- "对方的线上站点": "Their online site",
149
- "配对码不含对方电脑的公钥指纹,无法核对连到的是不是对方;能用链接或扫码时优先用。": "A pairing code carries no key fingerprint of their computer, so it cannot be checked; use the link or QR code when you can.",
141
+ "邀请链接": "Invitation link",
142
+ "粘贴邀请链接或二维码截图": "Paste the invitation link or a screenshot of its QR code",
143
+ "选择二维码图片": "Choose a QR code image",
144
+ "加入中…": "Joining…",
145
+ "这张图片里没有识别到邀请二维码": "No invitation QR code was found in this image",
146
+ "这不是邀请链接,请粘贴对方发来的完整链接。": "This isn't an invitation link. Paste the complete link you were sent.",
150
147
  "派哪个 AI": "Which AI to send",
151
148
  "加入需要本机服务,请在运行 AI 的电脑打开本机网站。": "Joining needs the local service; open the local website on the computer that runs the AI.",
152
149
  "加入": "Join",
153
150
  "读取记录与权限": "Read log and access",
154
- "最多唤醒": "Start at most",
155
- "最多唤醒次数": "Maximum starts",
156
- "次,期限": "times, for",
157
- "期限": "Duration",
158
- "信任设备下 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.",
159
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",
160
152
  "权限由 App 决定,接入程序无法逐次收窄": "the App decides its permissions, so the runner cannot narrow them per task",
161
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",
162
154
  "不支持的软件适配器": "unsupported software adapter",
163
155
  "托管的已有会话沿用它自己的权限,无法收窄": "a taken-over existing session keeps its own permissions and cannot be narrowed",
164
156
  "不能收窄": "cannot be narrowed",
165
- "这个软件不能限制为只用共议命令({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.",
166
157
  "被对方撤销": "revoked by the other side",
167
158
  "你已退出": "you left",
159
+ "删除记录": "Delete record",
160
+ "删除「{room}」的记录": "Delete the record of \"{room}\"",
161
+ "记录已删除": "Record deleted",
162
+ "这台电脑上这个房间的记录、历史和运行文件会被删除,无法恢复。": "This room's record, history and run files on this computer will be deleted. This can't be undone.",
163
+ "对方房间不受影响,你的 AI 自己的会话也会保留。": "Their room isn't affected, and your AI's own session is kept.",
164
+ "退出通知还没送达对方电脑,送达后才能删除记录": "The other computer hasn't received your leave notice yet. You can delete the record once it arrives",
168
165
  "已结束:{reason}": "Ended: {reason}",
169
166
  "撤销授权": "Revoke",
170
167
  "已结束,未回答": "Ended without an answer",
@@ -174,12 +171,10 @@
174
171
  "结束于": "Ended at",
175
172
  "恢复唤醒": "Resume",
176
173
  "正文在对方房间,已无法读取": "The text is in their room and can no longer be read",
177
- "只能在这台电脑本机设置": "Can only be set on this computer itself",
178
174
  "这台电脑还没有可派出的 AI 软件,请先在设置里配置。": "This computer has no AI software to send yet. Set one up in Settings first.",
179
175
  "这个链接已过期,请让对方重新生成邀请。": "This link has expired. Ask them to create a new invitation.",
180
176
  "无法读取这个邀请链接": "This invitation link can't be read",
181
177
  "链接可能被截断或改动过。请让对方重新复制完整链接发给你。": "The link may have been cut off or changed. Ask them to copy the complete link and send it again.",
182
- "也可以在自己共议左栏“被邀请的房间”里输入对方给的配对码。": "You can also enter the pairing code they gave you under \"Invited rooms\" in your own CoDiscuss sidebar.",
183
178
  "对方电脑上的 AI,只读本房间开放的内容": "An AI on their computer; reads only what this room opens",
184
179
  "用量": "Usage",
185
180
  "这位外部成员已结束,不能再调整;需要时重新邀请。": "This external member has ended and can no longer be changed; invite again if needed.",
@@ -192,15 +187,15 @@
192
187
  "剩 {count} 小时": "{count}h",
193
188
  "剩 {count} 分": "{count}m",
194
189
  "{used} / {limit} · 本小时 {hour} / {hour_limit} · 被拒 {denied} 次": "{used} / {limit} · this hour {hour} / {hour_limit} · {denied} refused",
195
- "还没有选项目目录,只能选“只讨论”。": "No project directory chosen yet, so only \"Discuss only\" is available.",
196
190
  "外部专家 · 待签到": "External expert · Awaiting check-in",
197
191
  "待签到": "Awaiting check-in",
198
192
  "重新生成链接": "Regenerate link",
199
193
  "添加待签到席位": "Add a seat awaiting check-in",
200
194
  "待生成链接": "Waiting for a link",
201
- "邀请链接": "Invitation link",
202
195
  "{time} 前兑换有效,只能用一次。对方兑换后完成签到,你会收到提示,可随时撤销。": "Redeem before {time}, for one member only. Check-in completes on redemption; you will be notified and can revoke access anytime.",
203
196
  "另一台电脑{suffix}": "Another computer{suffix}",
197
+ "外部专家{suffix}": "External expert{suffix}",
198
+ "外部 {ai}{suffix}": "External {ai}{suffix}",
204
199
  "链接只在生成时显示;请重新生成。未绑定线上网站时,需先在设置中绑定。": "Links are shown only when generated. Generate a new one; if no online site is bound, bind one in Settings first.",
205
200
  "{count} 位外部专家待签到": "{count} external expert(s) awaiting check-in",
206
201
  "{count} 天内未签到自动结束": "Ends automatically if not checked in within {count} days",
@@ -35,6 +35,8 @@
35
35
  "重试": "Retry",
36
36
  "收起": "Collapse",
37
37
  "正在启动": "Starting",
38
+ "正在创建": "Creating",
39
+ "正在创建房间…": "Creating the room…",
38
40
  "显示更多": "Show more",
39
41
  "继续 Goal": "Continue Goal",
40
42
  "展开或收起详情": "Expand or collapse details",
@@ -318,6 +318,7 @@
318
318
  "从常用项目中选择": "Choose from saved projects",
319
319
  "选择常用项目": "Select a saved project",
320
320
  "添加常用项目": "Add saved project",
321
+ "移除后不再出现在列表里,文件夹和文件都会保留,正在使用它的房间不受影响。以后新建同名项目即可恢复。": "Removed projects leave this list, but their folders and files are kept and rooms using them are not affected. Create a project with the same name to bring one back.",
321
322
  "临时路径": "One-off path",
322
323
  "加入常用项目": "Add to saved projects",
323
324
  "粘贴或输入临时路径": "Paste or type a one-off path",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai_co_discuss",
3
- "version": "0.4.83",
3
+ "version": "0.4.85",
4
4
  "bin": {
5
5
  "codiscuss": "runner/codiscuss.mjs"
6
6
  },
@@ -10,7 +10,10 @@ import { createHash } from 'node:crypto';
10
10
  import { existsSync, mkdirSync, readdirSync, readFileSync, realpathSync } from 'node:fs';
11
11
  import { isAbsolute, join, relative, resolve } from 'node:path';
12
12
 
13
+ import { atomic_json } from './files.mjs';
14
+
13
15
  const SETTINGS_FILE = 'local-settings.json';
16
+ const HIDDEN_PROJECTS_FILE = 'hidden-projects.json';
14
17
  // A hosted account's instance writes the failures its runner judged here, one JSON line each; the owner's panel relays them.
15
18
  export const OPERATOR_EVENTS_FILE = 'operator-events.jsonl';
16
19
  const PROJECT_NAME_LIMIT = 80;
@@ -59,6 +62,44 @@ export function account_projects(root) {
59
62
  .map(entry => ({ id: createHash('sha256').update(entry.name).digest('hex').slice(0, 16), name: entry.name, path: join(root, entry.name) }));
60
63
  }
61
64
 
65
+ /** Names the account removed from its list; their folders stay on disk, so rooms using them keep working. */
66
+ function hidden_project_names(home) {
67
+ const path = join(home, HIDDEN_PROJECTS_FILE);
68
+ const names = existsSync(path) ? JSON.parse(readFileSync(path, 'utf8')) : [];
69
+ return Array.isArray(names) ? names.filter(name => typeof name === 'string') : [];
70
+ }
71
+
72
+ /** The projects an ordinary account sees in its list: its folders, without the ones it removed. */
73
+ export function listed_account_projects(home, root) {
74
+ const hidden = new Set(hidden_project_names(home));
75
+ return account_projects(root).filter(project => !hidden.has(project.name));
76
+ }
77
+
78
+ /**
79
+ * Take projects off an ordinary account's list without touching their folders; repeating a removal changes nothing.
80
+ *
81
+ * Args:
82
+ * home: The instance's service directory, which keeps the hidden names.
83
+ * root: The account's projects root.
84
+ * ids: The ids of the projects to remove, as `account_projects` reports them.
85
+ */
86
+ export function hide_account_projects(home, root, ids) {
87
+ const projects = new Map(account_projects(root).map(project => [project.id, project.name]));
88
+ const names = ids.map(id => projects.get(id));
89
+ if (names.includes(undefined)) throw new Error('项目不存在,请刷新后重试');
90
+ atomic_json(join(home, HIDDEN_PROJECTS_FILE), [...new Set([...hidden_project_names(home), ...names])]);
91
+ }
92
+
93
+ /** Create a project, or bring back the removed project of that name with its files. */
94
+ export function create_or_restore_account_project(home, root, name) {
95
+ const wanted = typeof name === 'string' ? name.trim() : '';
96
+ const hidden = hidden_project_names(home);
97
+ if (!hidden.includes(wanted)) return create_account_project(root, name);
98
+ atomic_json(join(home, HIDDEN_PROJECTS_FILE), hidden.filter(item => item !== wanted));
99
+ const folder = join(root, wanted);
100
+ return existsSync(folder) ? { name: wanted, path: folder } : create_account_project(root, name);
101
+ }
102
+
62
103
  /** Create one project folder directly under the projects root; a name that would nest or escape is refused. */
63
104
  export function create_account_project(root, name) {
64
105
  const wanted = typeof name === 'string' ? name.trim() : '';