ai_co_discuss 0.4.83 → 0.4.84
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/backend/external_members.py +36 -5
- package/backend/identity.py +12 -2
- package/backend/server.py +5 -1
- package/docs/en/runner.md +6 -7
- package/docs/runner.md +6 -7
- package/frontend/locales/en/external.json +19 -11
- package/frontend/locales/en/room.json +2 -0
- package/frontend/locales/en/settings.json +1 -0
- package/package.json +1 -1
- package/runner/account_space.mjs +41 -0
- package/runner/discussion_launch.mjs +9 -4
- package/runner/expert_prompts.mjs +1 -1
- package/runner/external_client.mjs +43 -9
- package/runner/i18n_en.mjs +5 -2
- package/runner/remote_launch.mjs +1 -1
- package/web/app.js +8 -1
- package/web/i18n.js +1 -1
- package/web/join.html +4 -5
- package/web/modern.css +1 -1
- package/web/modern.js +59 -58
|
@@ -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
|
-
|
|
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
|
package/backend/identity.py
CHANGED
|
@@ -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")
|
|
48
|
-
|
|
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
|
@@ -90,31 +90,30 @@ 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 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
|
|
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
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.
|
|
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
|
|
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, and a trust level (a new computer starts at Full loan, with no further confirmation after joining):
|
|
101
101
|
|
|
102
102
|
| Trust level | When named | Local AI |
|
|
103
103
|
| --- | --- | --- |
|
|
104
|
-
|
|
|
104
|
+
| Ask each time | 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
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
106
|
| Trusted computer | Woken directly, no limits; later invites from that computer are accepted at this level | Unrestricted: local files and network tools available |
|
|
107
107
|
|
|
108
|
-
You can change the level and limits later in the invited room's right panel, or pause or leave
|
|
108
|
+
You can change the level and limits 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. Trusted computer can be set only on the other computer itself; a paired phone or tablet can choose only Ask each time or Full loan. The local service does the waking, so keep codiscuss running.
|
|
109
109
|
|
|
110
|
-
**Supported tools**:
|
|
110
|
+
**Supported tools**: Ask each time 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.
|
|
111
111
|
|
|
112
112
|
**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
113
|
|
|
114
114
|
**Keep in mind**:
|
|
115
115
|
- 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
116
|
- 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
117
|
- 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
118
|
|
|
120
119
|
## API Access
|
package/docs/runner.md
CHANGED
|
@@ -121,31 +121,30 @@ codiscuss local connect https://你的站点
|
|
|
121
121
|
|
|
122
122
|
**邀请(你的电脑)**:
|
|
123
123
|
1. 建房面板或右栏“邀请成员”里点“外部”一行的“外部专家 +”(可加多位),翻到卡片背面设置开放内容和签到后的有效期。选“可读项目”时开放本房间的全部项目目录。
|
|
124
|
-
2.
|
|
124
|
+
2. 点“添加待签到席位”(建房时自动添加),右栏名单立即显示待签到成员;把席位的链接或二维码发给对方。链接 10 分钟有效,只能绑定一位成员;重新生成会立即作废旧链接。未绑定线上站点时显示“待生成链接”及原因,绑定站点后从席位菜单生成。待签到面板显示自动结束期限,可“移除席位”;签到后才显示用量、读取记录和授权调整。
|
|
125
125
|
3. 对方兑换即完成签到,成员有效期从兑换时开始,**没有额外批准步骤**。未签到不收任务、不参与全体回应或讨论,7 天后自动结束;链接过期不会删除席位。
|
|
126
126
|
4. 在房间里 `@` 它,回答照常出现在对话中。成员菜单的“读取记录与权限”列出它读过的每个文件(由你的电脑记录),可延长、降为只讨论或撤销授权,撤销立即生效。
|
|
127
127
|
5. 签到后头像显示对方 AI 的厂家,“读取记录与权限”里可看到软件和模型;对方换 AI 后自动更新。这些信息由对方电脑自报,仅供辨认。自定义接口显示外部专家图标。
|
|
128
128
|
|
|
129
129
|
**加入(对方电脑)**:
|
|
130
|
-
1.
|
|
131
|
-
2. 选派哪个 AI
|
|
130
|
+
1. 打开链接,点“用本机共议加入”跳到本机网页;或在左栏“被邀请的房间”点“+”粘贴链接,也可以用相机扫码、选择二维码图片或粘贴二维码截图;命令行为 `codiscuss join <链接> --adapter 软件`。
|
|
131
|
+
2. 选派哪个 AI、模型与强度,以及信任等级(新电脑默认“完全借用”,加入后无需再确认):
|
|
132
132
|
|
|
133
133
|
| 信任等级 | 被点名后 | 本机 AI |
|
|
134
134
|
| --- | --- | --- |
|
|
135
|
-
|
|
|
135
|
+
| 每次询问 | 每次须你在右栏同意才唤醒;拒绝或 15 分钟未处理,对方看到“对方未同意” | 只能用共议命令,在空的临时目录运行 |
|
|
136
136
|
| 完全借用 | 直接唤醒,受次数与期限上限(默认 20 次、1 天),用完退回每次询问 | 同上 |
|
|
137
137
|
| 信任设备 | 直接唤醒,不设上限;之后这台电脑发来的邀请按此等级直接接受 | 不受限,可用本机文件与联网工具 |
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
等级与上限之后可在被邀请房间的右栏调整,也可暂停或退出,房间结束后可删除这台电脑上的记录;`codiscuss invited` 有同样的命令。“信任设备”只能在对方电脑本机设置,从已配对的手机或平板只能选“每次询问”或“完全借用”。唤醒由本机服务完成,请保持 codiscuss 运行。
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
**支持的软件**:每次询问与完全借用要求软件能限制为只用共议命令,目前支持 Claude Code(后台运行,已在 2.1.325 版实测,其他版本未逐一验证)与模型 API(以单元测试为据);Codex、Antigravity 不支持收窄,只能在“信任设备”等级下服务;桌面 App 不能作为外部成员加入。
|
|
142
142
|
|
|
143
143
|
**能读到什么**:开放目录中 Git 管理的文件(含未提交的改动,忽略 `.gitignore` 里的文件),非 Git 目录则是除 `node_modules` 等生成目录外的文件。`.env` 一类文件、私钥与证书、凭据文件、`.git`、开放目录根下的 `data/` 永不开放;指向目录外的链接被拒绝。它只能读,不能写文件或执行命令,也看不到私聊、其他房间和本机路径。每次最多读 128 KiB,默认每小时 4 MiB、总量 64 MiB、每小时 600 次。
|
|
144
144
|
|
|
145
145
|
**须知**:
|
|
146
146
|
- 读出去的内容收不回:它会留在对方 AI 的会话里,并发送给对方的模型服务商;撤销只阻止以后的读取。
|
|
147
147
|
- 邀请若在 10 分钟内被别人抢先使用,对方即成为成员,只能靠你看到提示后撤销。只把邀请发给信任的人。
|
|
148
|
-
- 配对码不含你电脑的密钥指纹,对方核对不了连到的是不是你;能用链接或二维码时优先用。
|
|
149
148
|
- “信任设备”等级下对方的 AI 不受限,你房间里的内容可能诱导它读对方电脑上的文件,只在自己的电脑之间使用。
|
|
150
149
|
|
|
151
150
|
## API 接入
|
|
@@ -47,9 +47,7 @@
|
|
|
47
47
|
"消息会发给对方模型服务商": "Messages go to their model provider",
|
|
48
48
|
"生成邀请需要本机服务,请在这台电脑打开本机网站。": "Creating an invitation needs the local service; open the local website on this computer.",
|
|
49
49
|
"邀请二维码": "Invitation QR code",
|
|
50
|
-
"
|
|
51
|
-
"复制配对码": "Copy pairing code",
|
|
52
|
-
"配对码不含这台电脑的公钥指纹,优先发链接或二维码。": "The pairing code does not carry this computer's key fingerprint; prefer sending the link or QR code.",
|
|
50
|
+
"把链接或二维码发给对方。": "Send the link or QR code to the other person.",
|
|
53
51
|
"立即生效:之后的请求与读取一律被拒,未完成的执行作废。": "Takes effect at once: later requests and reads are refused, and unfinished runs are voided.",
|
|
54
52
|
"已经读出去的内容收不回,会留在对方 AI 的会话里。": "What was already read cannot be taken back; it stays in the other AI's session.",
|
|
55
53
|
"外部成员 · {name}": "External member · {name}",
|
|
@@ -117,7 +115,7 @@
|
|
|
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
|
-
"
|
|
118
|
+
"用邀请链接加入": "Join with an invitation link",
|
|
121
119
|
"被邀请的房间列表": "Invited room list",
|
|
122
120
|
"{computer} · {trust}": "{computer} · {trust}",
|
|
123
121
|
"未命名房间": "Untitled room",
|
|
@@ -127,14 +125,15 @@
|
|
|
127
125
|
"可读项目:另可读对方开放的目录,不能写入或执行": "Can read project: can also read the opened directories; cannot write or run anything",
|
|
128
126
|
"加入共议房间 · AI CoDiscuss": "Join a CoDiscuss room · AI CoDiscuss",
|
|
129
127
|
"没有邀请内容": "No invitation here",
|
|
130
|
-
"
|
|
128
|
+
"请打开对方发来的完整链接。": "Open the complete link you were sent.",
|
|
131
129
|
"邀请人的电脑": "Inviting computer",
|
|
132
130
|
"开放": "Opens",
|
|
133
131
|
"链接须在此前兑换": "Redeem the link before",
|
|
134
132
|
"复制邀请链接": "Copy invitation link",
|
|
135
133
|
"复制失败,请手动复制地址栏": "Copy failed; copy the address bar manually",
|
|
136
134
|
"你被邀请让自己的 AI 加入一个共议房间": "You are invited to bring your own AI into a CoDiscuss room",
|
|
137
|
-
"你的 AI
|
|
135
|
+
"你的 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",
|
|
138
137
|
"对方开放的项目内容会经你的 AI 发送给它的模型服务商。": "Project content they open reaches your AI's model provider.",
|
|
139
138
|
"用本机共议加入": "Join with CoDiscuss on this computer",
|
|
140
139
|
"按钮打开这台电脑上的共议(需已安装并运行 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,10 +142,12 @@
|
|
|
143
142
|
"已加入「{room}」": "Joined \"{room}\"",
|
|
144
143
|
"加入另一台电脑的房间": "Join a room on another computer",
|
|
145
144
|
"你的 AI 在这台电脑上运行,只读对方开放的目录,在对方房间里回答。": "Your AI runs on this computer, reads only the directories they open, and answers in their room.",
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
"
|
|
145
|
+
"邀请链接": "Invitation link",
|
|
146
|
+
"粘贴邀请链接或二维码截图": "Paste the invitation link or a screenshot of its QR code",
|
|
147
|
+
"选择二维码图片": "Choose a QR code image",
|
|
148
|
+
"加入中…": "Joining…",
|
|
149
|
+
"这张图片里没有识别到邀请二维码": "No invitation QR code was found in this image",
|
|
150
|
+
"这不是邀请链接,请粘贴对方发来的完整链接。": "This isn't an invitation link. Paste the complete link you were sent.",
|
|
150
151
|
"派哪个 AI": "Which AI to send",
|
|
151
152
|
"加入需要本机服务,请在运行 AI 的电脑打开本机网站。": "Joining needs the local service; open the local website on the computer that runs the AI.",
|
|
152
153
|
"加入": "Join",
|
|
@@ -165,6 +166,12 @@
|
|
|
165
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.",
|
|
166
167
|
"被对方撤销": "revoked by the other side",
|
|
167
168
|
"你已退出": "you left",
|
|
169
|
+
"删除记录": "Delete record",
|
|
170
|
+
"删除「{room}」的记录": "Delete the record of \"{room}\"",
|
|
171
|
+
"记录已删除": "Record deleted",
|
|
172
|
+
"这台电脑上这个房间的记录、历史和运行文件会被删除,无法恢复。": "This room's record, history and run files on this computer will be deleted. This can't be undone.",
|
|
173
|
+
"对方房间不受影响,你的 AI 自己的会话也会保留。": "Their room isn't affected, and your AI's own session is kept.",
|
|
174
|
+
"退出通知还没送达对方电脑,送达后才能删除记录": "The other computer hasn't received your leave notice yet. You can delete the record once it arrives",
|
|
168
175
|
"已结束:{reason}": "Ended: {reason}",
|
|
169
176
|
"撤销授权": "Revoke",
|
|
170
177
|
"已结束,未回答": "Ended without an answer",
|
|
@@ -179,7 +186,6 @@
|
|
|
179
186
|
"这个链接已过期,请让对方重新生成邀请。": "This link has expired. Ask them to create a new invitation.",
|
|
180
187
|
"无法读取这个邀请链接": "This invitation link can't be read",
|
|
181
188
|
"链接可能被截断或改动过。请让对方重新复制完整链接发给你。": "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
189
|
"对方电脑上的 AI,只读本房间开放的内容": "An AI on their computer; reads only what this room opens",
|
|
184
190
|
"用量": "Usage",
|
|
185
191
|
"这位外部成员已结束,不能再调整;需要时重新邀请。": "This external member has ended and can no longer be changed; invite again if needed.",
|
|
@@ -201,6 +207,8 @@
|
|
|
201
207
|
"邀请链接": "Invitation link",
|
|
202
208
|
"{time} 前兑换有效,只能用一次。对方兑换后完成签到,你会收到提示,可随时撤销。": "Redeem before {time}, for one member only. Check-in completes on redemption; you will be notified and can revoke access anytime.",
|
|
203
209
|
"另一台电脑{suffix}": "Another computer{suffix}",
|
|
210
|
+
"外部专家{suffix}": "External expert{suffix}",
|
|
211
|
+
"外部 {ai}{suffix}": "External {ai}{suffix}",
|
|
204
212
|
"链接只在生成时显示;请重新生成。未绑定线上网站时,需先在设置中绑定。": "Links are shown only when generated. Generate a new one; if no online site is bound, bind one in Settings first.",
|
|
205
213
|
"{count} 位外部专家待签到": "{count} external expert(s) awaiting check-in",
|
|
206
214
|
"{count} 天内未签到自动结束": "Ends automatically if not checked in within {count} days",
|
|
@@ -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
package/runner/account_space.mjs
CHANGED
|
@@ -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() : '';
|
|
@@ -9,7 +9,7 @@ import { setTimeout as sleep } from 'node:timers/promises';
|
|
|
9
9
|
import { pathToFileURL } from 'node:url';
|
|
10
10
|
import { parseArgs } from 'node:util';
|
|
11
11
|
|
|
12
|
-
import { account_projects, account_space,
|
|
12
|
+
import { account_projects, account_space, create_or_restore_account_project, draft_folder, hide_account_projects, listed_account_projects } from './account_space.mjs';
|
|
13
13
|
import { atomic_json } from './files.mjs';
|
|
14
14
|
import { bundle_project_markdown, bundle_project_page, outside_directory, project_media, read_only_enforced, read_project_files, read_project_folders, room_directories, search_project_roots } from './project_files.mjs';
|
|
15
15
|
import { guard_remote_request, list_remote_directories, remote_allows, remote_roots } from './remote_policy.mjs';
|
|
@@ -677,7 +677,7 @@ const PROJECT_ID_PATTERN = /^[0-9a-f]{8,32}$/;
|
|
|
677
677
|
export function launch_projects(home) {
|
|
678
678
|
// An ordinary account's projects are the folders under its projects root; it keeps no list of its own.
|
|
679
679
|
const { projects_root } = account_space(home);
|
|
680
|
-
if (projects_root) return { projects:
|
|
680
|
+
if (projects_root) return { projects: listed_account_projects(home, projects_root), restricted: true };
|
|
681
681
|
const path = join(home, 'launch-projects.json');
|
|
682
682
|
return existsSync(path) ? JSON.parse(readFileSync(path, 'utf8')) : { projects: [] };
|
|
683
683
|
}
|
|
@@ -687,8 +687,12 @@ export function launch_projects(home) {
|
|
|
687
687
|
export function save_launch_projects(home, input) {
|
|
688
688
|
const { projects_root } = account_space(home);
|
|
689
689
|
if (projects_root) {
|
|
690
|
-
if (
|
|
691
|
-
|
|
690
|
+
if (Array.isArray(input.remove)) {
|
|
691
|
+
hide_account_projects(home, projects_root, input.remove);
|
|
692
|
+
return launch_projects(home);
|
|
693
|
+
}
|
|
694
|
+
if (typeof input.create !== 'string') throw new Error('此账号的项目只能在自己的项目文件夹内新建或移除:请提供 create(项目名称)或 remove(项目编号列表)');
|
|
695
|
+
const created = create_or_restore_account_project(home, projects_root, input.create);
|
|
692
696
|
return { ...launch_projects(home), created };
|
|
693
697
|
}
|
|
694
698
|
if (!Array.isArray(input.projects)) throw new Error('projects 必须为列表');
|
|
@@ -2298,6 +2302,7 @@ function granted_projects(home) {
|
|
|
2298
2302
|
const { projects_root, workspace } = account_space(home);
|
|
2299
2303
|
if (!projects_root) return launch_projects(home).projects;
|
|
2300
2304
|
mkdirSync(workspace, { recursive: true });
|
|
2305
|
+
// Removed projects stay granted: removing only shortens the list, and rooms working there must keep running.
|
|
2301
2306
|
return [...account_projects(projects_root), { name: '草稿空间', path: workspace }];
|
|
2302
2307
|
}
|
|
2303
2308
|
|
|
@@ -97,7 +97,7 @@ export function external_task_text({ name, messages, requests = [], cli, access_
|
|
|
97
97
|
const instructions = `你作为外部成员参加另一台电脑上的房间,只读对方开放的项目,不修改任何文件。命令只用 subcommands 列出的 ${cli} 子命令。${limits}${reading}`;
|
|
98
98
|
const prompt = `${wake_opening(requests, name)}(来自另一台电脑上的房间),对应消息 ${messages}。${instructions}`
|
|
99
99
|
+ `用 ${cli} message view 消息编号${access} 看原文,${cli} room read${access} 看房间概况。`
|
|
100
|
-
+ `做完用 ${cli} message post --body-file 草稿${access} 提交一次回答(简短回答可用 --body "回答"
|
|
100
|
+
+ `做完用 ${cli} message post --body-file 草稿${access} 提交一次回答(简短回答可用 --body "回答")。房间按 Markdown 显示回答,内容较多时用分段、标题或列表排版。先读任务文件 ${task_path} 与其中列出的技能。`;
|
|
101
101
|
return { instructions, prompt };
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -50,6 +50,8 @@ const SECRETS_FILE = 'secrets.json';
|
|
|
50
50
|
const LOCK_FILE = 'invited.lock';
|
|
51
51
|
const LOCK_WAIT_MS = 3000;
|
|
52
52
|
const LOCK_STALE_MS = 10000;
|
|
53
|
+
// Under the external home, one folder per record in each.
|
|
54
|
+
const RUN_FOLDERS = ['runtime', 'work', 'drafts'];
|
|
53
55
|
const CODE_PATTERN = /^[0-9A-Z]{12}$/;
|
|
54
56
|
const HEX32 = /^[0-9a-f]{32}$/;
|
|
55
57
|
const RECORD_ID = /^[0-9a-f]{16}$/;
|
|
@@ -437,13 +439,15 @@ export async function join_invite(home, input, deps = {}) {
|
|
|
437
439
|
return with_store(home, (store, secrets, now) => {
|
|
438
440
|
const id = attempt.id;
|
|
439
441
|
const name = joined.machine?.name || keys.name || invite.machine_name;
|
|
440
|
-
|
|
442
|
+
// Accepting the invitation is the consent: a new computer starts at 完全借用, within its limits.
|
|
443
|
+
const machine = store.machines[keys.fingerprint] ||= { trust: 'borrow' };
|
|
441
444
|
Object.assign(machine, { machine: keys.id, site: invite.site, machine_name: name, updated_at: now });
|
|
442
445
|
store.records[id] = { id, site: invite.site, machine: keys.id, machine_name: name, machine_fingerprint: keys.fingerprint,
|
|
443
446
|
machine_key: keys.public_key, fingerprint_checked: Boolean(invite.fingerprint), room: joined.room.id, room_title: String(joined.room.name || invite.room_name),
|
|
444
447
|
member: joined.member.name, member_id: joined.member.id ?? null, key_id, open_level: joined.level || invite.level || 'read',
|
|
445
448
|
directories: Array.isArray(joined.directories) ? joined.directories : [],
|
|
446
|
-
expires_at: Number(joined.expires_at) ? Number(joined.expires_at) * 1000 : null, ai, ai_reported: JSON.stringify(identity),
|
|
449
|
+
expires_at: Number(joined.expires_at) ? Number(joined.expires_at) * 1000 : null, ai, ai_reported: JSON.stringify(identity),
|
|
450
|
+
limits: machine.trust === 'borrow' ? { max_wakes: BORROW_DEFAULTS.max_wakes, until: now + BORROW_DEFAULTS.hours * HOUR_MS, used: 0 } : null, wakes: 0, last_wake_at: null, paused: false,
|
|
447
451
|
status: 'active', contact: { at: now, state: 'online', error: '' }, approvals: [], history: [], running: null, joined_at: now };
|
|
448
452
|
secrets.get()[id] = { private_key: pair.private_key, token: joined.token };
|
|
449
453
|
secrets.changed = true;
|
|
@@ -565,6 +569,29 @@ async function deliver_leave(home, id, deps = {}) {
|
|
|
565
569
|
return { leave_pending: false };
|
|
566
570
|
}
|
|
567
571
|
|
|
572
|
+
/**
|
|
573
|
+
* Delete an ended or left record from this computer: its history, key, credential and run files. Nothing is sent to the
|
|
574
|
+
* inviting room, and the trust given to that computer stays, since it covers all of that computer's rooms.
|
|
575
|
+
*/
|
|
576
|
+
export function remove_record(home, { id }, deps = {}) {
|
|
577
|
+
const record = with_store(home, (store, secrets) => {
|
|
578
|
+
const found = find_record(store, id);
|
|
579
|
+
if (found.status === 'active') throw failure('record_active', '这个房间还在进行中,请先退出再删除记录');
|
|
580
|
+
if (found.leave_pending) throw failure('leave_pending', '退出通知还没送达对方电脑,送达后才能删除记录');
|
|
581
|
+
delete store.records[found.id];
|
|
582
|
+
forget_keys(secrets, found.id);
|
|
583
|
+
return found;
|
|
584
|
+
});
|
|
585
|
+
// A run still going keeps its folders; they are only leftovers, so one that cannot be removed does not fail the delete.
|
|
586
|
+
if (!record.running) {
|
|
587
|
+
for (const folder of RUN_FOLDERS) {
|
|
588
|
+
try { rmSync(join(external_home(home), folder, record.id), { recursive: true, force: true }); }
|
|
589
|
+
catch (error) { deps.log?.(error.message); }
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
return { removed: record.id };
|
|
593
|
+
}
|
|
594
|
+
|
|
568
595
|
/** Keep the record in line with what the inviting room grants now (`/view` `me`): level, deadline and opened directories. */
|
|
569
596
|
function apply_grant(home, id, me, now = Date.now()) {
|
|
570
597
|
if (!me || typeof me !== 'object') return;
|
|
@@ -596,15 +623,19 @@ function kept_messages(record) {
|
|
|
596
623
|
}
|
|
597
624
|
|
|
598
625
|
/** The record with what the inviting room shows this member, when it can be reached. */
|
|
599
|
-
export async function room_view(home, { id }, deps = {}) {
|
|
626
|
+
export async function room_view(home, { id, cached = false }, deps = {}) {
|
|
600
627
|
const record = find_record(read_store(home), id);
|
|
628
|
+
// What this computer already knows, without the network: the page shows it at once while the real read is under way.
|
|
629
|
+
if (cached) return { record: record_view(record, read_store(home)), room: null, messages: kept_messages(record) };
|
|
601
630
|
let room = null, problem = null;
|
|
602
631
|
let messages = [];
|
|
603
632
|
try {
|
|
604
|
-
|
|
605
|
-
//
|
|
633
|
+
// What the page shows in the middle: requests naming this AI and this AI's own answers, oldest first. Sent together,
|
|
634
|
+
// since each one crosses the relay and in turn they outlast the page's refresh.
|
|
606
635
|
const query = field => `${MEMBER_API.messages(record.room)}?${new URLSearchParams({ [field]: record.member })}`;
|
|
607
|
-
const pages = await Promise.all([
|
|
636
|
+
const [view, ...pages] = await Promise.all([refresh_grant(home, id, deps),
|
|
637
|
+
...['mention', 'author'].map(field => member_api(home, id, 'GET', query(field), undefined, deps))]);
|
|
638
|
+
room = view;
|
|
608
639
|
const unique = new Map(pages.flatMap(page => page.messages || []).map(message => [message.id, message]));
|
|
609
640
|
messages = [...unique.values()].sort((a, b) => a.id - b.id);
|
|
610
641
|
} catch (error) { problem = error; messages = kept_messages(record); }
|
|
@@ -632,12 +663,13 @@ export async function invited_command(home, action, input = {}, deps = {}) {
|
|
|
632
663
|
if (action === 'invited-approve') return approve(home, input);
|
|
633
664
|
if (action === 'invited-refuse') return refuse_approval(home, input, deps);
|
|
634
665
|
if (action === 'invited-leave') return leave(home, input, deps);
|
|
666
|
+
if (action === 'invited-remove') return remove_record(home, input, deps);
|
|
635
667
|
if (action === 'invited-room') return room_view(home, input, deps);
|
|
636
668
|
throw failure('unknown_action', '未知的被邀请记录操作:{action}', { action });
|
|
637
669
|
}
|
|
638
670
|
|
|
639
671
|
export const INVITED_ACTIONS = new Set(['invited-list', 'invited-join', 'invited-trust', 'invited-ai', 'invited-pause', 'invited-approve',
|
|
640
|
-
'invited-refuse', 'invited-leave', 'invited-room']);
|
|
672
|
+
'invited-refuse', 'invited-leave', 'invited-remove', 'invited-room']);
|
|
641
673
|
|
|
642
674
|
// ---- Pulling and waking (in the service) ----
|
|
643
675
|
|
|
@@ -980,7 +1012,7 @@ function load_access(path) {
|
|
|
980
1012
|
const integer = value => value === undefined ? undefined : Number(value);
|
|
981
1013
|
|
|
982
1014
|
function print_record(record) {
|
|
983
|
-
const trust = { default: t('
|
|
1015
|
+
const trust = { default: t('每次询问(每次须你同意)'), borrow: t('完全借用'), trusted: t('信任设备') }[record.trust];
|
|
984
1016
|
const contact = { online: t('在线'), offline: t('不在线'), error: t('出错'), unknown: t('未知') }[record.contact?.state || 'unknown'];
|
|
985
1017
|
const lines = [t('{id} {room}({site})成员 {member}', { id: record.id, room: record.room_title || record.room, site: record.site, member: record.member }),
|
|
986
1018
|
t(' 信任等级:{trust};已唤醒 {wakes} 次;对方电脑:{contact}{paused}', { trust, wakes: record.wakes, contact, paused: record.paused ? t(';已暂停') : '' })];
|
|
@@ -1003,6 +1035,7 @@ const HELP = () => t(`被邀请的房间(本机 AI 作为外部成员参加另
|
|
|
1003
1035
|
codiscuss invited pause ID | resume ID
|
|
1004
1036
|
codiscuss invited approve ID 待确认编号 | refuse ID 待确认编号
|
|
1005
1037
|
codiscuss invited leave ID
|
|
1038
|
+
codiscuss invited remove ID
|
|
1006
1039
|
codiscuss invited room ID
|
|
1007
1040
|
|
|
1008
1041
|
信任等级:default 每次点名须你同意;borrow 直接唤醒,受次数与期限上限;trusted 直接唤醒、不设上限、不收窄。
|
|
@@ -1046,7 +1079,7 @@ export async function external_main(command, args, { home, deps = {}, write = te
|
|
|
1046
1079
|
else {
|
|
1047
1080
|
const [verb, id, extra] = positionals;
|
|
1048
1081
|
const action = { list: 'invited-list', trust: 'invited-trust', ai: 'invited-ai', pause: 'invited-pause', resume: 'invited-pause', approve: 'invited-approve',
|
|
1049
|
-
refuse: 'invited-refuse', leave: 'invited-leave', room: 'invited-room' }[verb];
|
|
1082
|
+
refuse: 'invited-refuse', leave: 'invited-leave', remove: 'invited-remove', room: 'invited-room' }[verb];
|
|
1050
1083
|
if (!action) return write(HELP());
|
|
1051
1084
|
const input = { id, ...(verb === 'trust' ? { trust: extra, ...(values['max-wakes'] ? { max_wakes: values['max-wakes'] } : {}), ...(values.hours ? { hours: values.hours } : {}) } : {}),
|
|
1052
1085
|
...(verb === 'ai' ? ai : {}), ...(['pause', 'resume'].includes(verb) ? { paused: verb === 'pause' } : {}), ...(['approve', 'refuse'].includes(verb) ? { approval: extra } : {}) };
|
|
@@ -1054,5 +1087,6 @@ export async function external_main(command, args, { home, deps = {}, write = te
|
|
|
1054
1087
|
}
|
|
1055
1088
|
if (values.json) return out(result);
|
|
1056
1089
|
if (result.records) return write(`${result.records.length ? result.records.map(print_record).join('\n') : t('还没有被邀请的房间')}\n`);
|
|
1090
|
+
if (result.removed) return write(`${t('已删除这条被邀请记录')}\n`);
|
|
1057
1091
|
return write(`${print_record(result.record)}${result.record?.leave_pending ? `\n${t('暂时连不上对方电脑,常驻服务会继续通知它;通知送达或成员资格到期后删除本机密钥')}` : ''}${result.error ? `\n${t('读不到对方房间:{reason}', { reason: result.error })}` : ''}\n`);
|
|
1058
1092
|
}
|
package/runner/i18n_en.mjs
CHANGED
|
@@ -444,9 +444,12 @@ export default {
|
|
|
444
444
|
"被邀请房间拉取停止:{reason}": "Pulling invited rooms stopped: {reason}",
|
|
445
445
|
"只有经另一台电脑加入的成员才能这样访问;请用任务给出的 --access-file": "Only a member that joined from another computer can access this; use the --access-file the task gives",
|
|
446
446
|
"已退出这个被邀请的房间": "You have left this invited room",
|
|
447
|
+
"这个房间还在进行中,请先退出再删除记录": "This room is still active. Leave it before deleting the record",
|
|
448
|
+
"退出通知还没送达对方电脑,送达后才能删除记录": "The other computer hasn't received your leave notice yet. You can delete the record once it arrives",
|
|
449
|
+
"已删除这条被邀请记录": "Deleted this invited room record",
|
|
447
450
|
"用法:codiscuss repo ls [目录] | read 文件 | grep 关键词": "Usage: codiscuss repo ls [directory] | read FILE | grep KEYWORD",
|
|
448
451
|
"读取被拒绝": "Reading was refused",
|
|
449
|
-
"
|
|
452
|
+
"每次询问(每次须你同意)": "Ask each time (your approval each time)",
|
|
450
453
|
"完全借用": "Full borrowing",
|
|
451
454
|
"信任设备": "Trusted device",
|
|
452
455
|
"在线": "online",
|
|
@@ -517,7 +520,7 @@ export default {
|
|
|
517
520
|
"{member} 会话已结束,但未提交本次回答": "{member}'s session ended without submitting an answer for this run",
|
|
518
521
|
"外部成员只能读本房间消息与概况、提交自己的回答": "An external member can only read this room's messages and overview and submit its own answer",
|
|
519
522
|
" 对方已结束你的成员资格({reason})": " The other side ended your membership ({reason})",
|
|
520
|
-
"被邀请的房间(本机 AI 作为外部成员参加另一台电脑上的房间)\n\n用法:\n codiscuss join <链接|配对码> [--site 站点] [--machine 电脑编号] --adapter 软件 [--model M] [--effort E]\n codiscuss invited list\n codiscuss invited trust ID default|borrow|trusted [--max-wakes N] [--hours N]\n codiscuss invited ai ID [--adapter 软件] [--model M] [--effort E]\n codiscuss invited pause ID | resume ID\n codiscuss invited approve ID 待确认编号 | refuse ID 待确认编号\n codiscuss invited leave ID\n codiscuss invited room ID\n\n信任等级:default 每次点名须你同意;borrow 直接唤醒,受次数与期限上限;trusted 直接唤醒、不设上限、不收窄。\n同意后由本机服务唤醒 AI,请保持 codiscuss 服务运行。加 --json 输出 JSON。\n": "Invited rooms (this computer's AI joins rooms on other computers as an external member)\n\nUsage:\n codiscuss join <link|code> [--site SITE] [--machine COMPUTER_ID] --adapter SOFTWARE [--model M] [--effort E]\n codiscuss invited list\n codiscuss invited trust ID default|borrow|trusted [--max-wakes N] [--hours N]\n codiscuss invited ai ID [--adapter SOFTWARE] [--model M] [--effort E]\n codiscuss invited pause ID | resume ID\n codiscuss invited approve ID PENDING_ID | refuse ID PENDING_ID\n codiscuss invited leave ID\n codiscuss invited room ID\n\nTrust levels: default asks for your approval each time it is named; borrow wakes directly within a count and time limit; trusted wakes directly with no limit and no restriction.\nAfter you approve, the local service wakes the AI, so keep the codiscuss service running. Add --json for JSON output.\n",
|
|
523
|
+
"被邀请的房间(本机 AI 作为外部成员参加另一台电脑上的房间)\n\n用法:\n codiscuss join <链接|配对码> [--site 站点] [--machine 电脑编号] --adapter 软件 [--model M] [--effort E]\n codiscuss invited list\n codiscuss invited trust ID default|borrow|trusted [--max-wakes N] [--hours N]\n codiscuss invited ai ID [--adapter 软件] [--model M] [--effort E]\n codiscuss invited pause ID | resume ID\n codiscuss invited approve ID 待确认编号 | refuse ID 待确认编号\n codiscuss invited leave ID\n codiscuss invited remove ID\n codiscuss invited room ID\n\n信任等级:default 每次点名须你同意;borrow 直接唤醒,受次数与期限上限;trusted 直接唤醒、不设上限、不收窄。\n同意后由本机服务唤醒 AI,请保持 codiscuss 服务运行。加 --json 输出 JSON。\n": "Invited rooms (this computer's AI joins rooms on other computers as an external member)\n\nUsage:\n codiscuss join <link|code> [--site SITE] [--machine COMPUTER_ID] --adapter SOFTWARE [--model M] [--effort E]\n codiscuss invited list\n codiscuss invited trust ID default|borrow|trusted [--max-wakes N] [--hours N]\n codiscuss invited ai ID [--adapter SOFTWARE] [--model M] [--effort E]\n codiscuss invited pause ID | resume ID\n codiscuss invited approve ID PENDING_ID | refuse ID PENDING_ID\n codiscuss invited leave ID\n codiscuss invited remove ID\n codiscuss invited room ID\n\nTrust levels: default asks for your approval each time it is named; borrow wakes directly within a count and time limit; trusted wakes directly with no limit and no restriction.\nAfter you approve, the local service wakes the AI, so keep the codiscuss service running. Add --json for JSON output.\n",
|
|
521
524
|
"只读查看对方电脑开放的项目(仅外部成员的任务中可用)\n\n用法:\n codiscuss repo ls 列出开放目录(序号即 --root)\n codiscuss repo ls [目录] --root N [--offset N] [--limit N]\n codiscuss repo read 文件 --root N [--offset N] [--max-bytes N]\n codiscuss repo grep 关键词 --root N [--path 路径] [--case-sensitive] [--max-results N]\n凭据取自 --access-file 或 DISCUSS_ACCESS_FILE。\n": "Read the project another computer opened to you (only in an external member's task)\n\nUsage:\n codiscuss repo ls List the opened directories (their numbers are --root)\n codiscuss repo ls [DIRECTORY] --root N [--offset N] [--limit N]\n codiscuss repo read FILE --root N [--offset N] [--max-bytes N]\n codiscuss repo grep KEYWORD --root N [--path PATH] [--case-sensitive] [--max-results N]\nCredentials come from --access-file or DISCUSS_ACCESS_FILE.\n",
|
|
522
525
|
"本次运行已收窄,不能使用 launch image(它会读取本机文件)": "This run is restricted and cannot use launch image (it reads local files)",
|
|
523
526
|
"本次运行已收窄,不能从标准输入读取;请先把内容写进草稿目录,再用文件参数传入": "This run is restricted and cannot read standard input; write the content in the draft folder and pass its path",
|