ai_co_discuss 0.5.38 → 0.5.40
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/room_import.py +3 -3
- package/backend/schema.sql +2 -0
- package/backend/server.py +62 -0
- package/docs/deployment.md +5 -1
- package/docs/en/deployment.md +5 -1
- package/docs/en/guide/admin.md +6 -2
- package/docs/en/guide/rooms.md +3 -3
- package/docs/guide/admin.md +6 -2
- package/docs/guide/rooms.md +3 -3
- package/frontend/locales/en/admin.json +22 -3
- package/frontend/locales/en/app.json +1 -1
- package/frontend/locales/en/backend.json +3 -0
- package/frontend/locales/en/backend_worker.json +1 -0
- package/frontend/locales/en/room.json +25 -0
- package/frontend/locales/en/settings.json +3 -0
- package/package.json +1 -1
- package/runner/admin_cli.mjs +11 -0
- package/runner/admin_maintenance.mjs +31 -0
- package/runner/admin_panel.mjs +46 -5
- package/runner/device_auth.mjs +5 -2
- package/runner/free_runner.mjs +2 -0
- package/runner/hosting_tunnel.mjs +3 -0
- package/runner/i18n_en.mjs +13 -7
- package/runner/relay_channel.mjs +2 -2
- package/runner/relay_health.mjs +2 -1
- package/runner/remote_launch.mjs +6 -1
- package/runner/share_shared.mjs +2 -1
- package/runner/storage_guard.mjs +4 -4
- package/web/admin.css +1 -1
- package/web/admin.js +8 -8
- package/web/app.js +29 -5
- package/web/backup.js +5 -3
- package/web/i18n.js +4 -4
- package/web/markdown.css +1 -1
- package/web/modern.css +1 -1
- package/web/modern.js +65 -63
package/backend/room_import.py
CHANGED
|
@@ -142,10 +142,10 @@ def record_statements(tables, room_id, maps):
|
|
|
142
142
|
(messages[row["message_id"]], remap_text(row["text"], messages), row["author"])) for row in tables.get("message_summaries", [])]
|
|
143
143
|
statements += [("INSERT INTO message_timings (message_id,elapsed_seconds) VALUES (?,?)", (messages[row["message_id"]], row["elapsed_seconds"]))
|
|
144
144
|
for row in tables.get("message_timings", [])]
|
|
145
|
-
statements += [("""INSERT INTO attachments (id,room_id,message_id,position,file_name,content_type,size,sha256,actor,submission_id,created_at)
|
|
146
|
-
VALUES (
|
|
145
|
+
statements += [("""INSERT INTO attachments (id,room_id,message_id,position,file_name,content_type,size,sha256,actor,submission_id,created_at,cleared_at)
|
|
146
|
+
VALUES (?,?,?,?,?,?,?,?,?,?,?,?)""", (maps["attachments"][row["id"]], room_id, messages[row["message_id"]], row["position"], row["file_name"],
|
|
147
147
|
row["content_type"], row["size"], row["sha256"], row["actor"], row["submission_id"],
|
|
148
|
-
row["created_at"])) for row in tables.get("attachments", [])]
|
|
148
|
+
row["created_at"], row.get("cleared_at"))) for row in tables.get("attachments", [])]
|
|
149
149
|
statements += [("""INSERT INTO member_requests (id,room_id,member_id,message_id,status,answer_id,created_at,chain_id,batch_id,purpose,created_by)
|
|
150
150
|
VALUES (?,?,?,?,?,?,?,?,?,?,?)""", (requests[row["id"]], room_id, members[row["member_id"]], messages[row["message_id"]],
|
|
151
151
|
"cancelled" if row["status"] in OPEN_REQUESTS else row["status"],
|
package/backend/schema.sql
CHANGED
|
@@ -78,6 +78,8 @@ CREATE TABLE IF NOT EXISTS attachments (
|
|
|
78
78
|
width INTEGER, height INTEGER,
|
|
79
79
|
-- The type (image/webp or image/jpeg) of a smaller copy a page made for showing in messages; NULL when none.
|
|
80
80
|
thumbnail_type TEXT,
|
|
81
|
+
-- When the owner cleared the original bytes to free space (the record and thumbnail stay); NULL while kept.
|
|
82
|
+
cleared_at TEXT,
|
|
81
83
|
UNIQUE(room_id, submission_id)
|
|
82
84
|
);
|
|
83
85
|
CREATE INDEX IF NOT EXISTS attachments_message ON attachments(message_id, position);
|
package/backend/server.py
CHANGED
|
@@ -603,6 +603,8 @@ def init_database(database, seed=True):
|
|
|
603
603
|
connection.execute(f"ALTER TABLE attachments ADD COLUMN {name} INTEGER")
|
|
604
604
|
if "thumbnail_type" not in attachment_columns:
|
|
605
605
|
connection.execute("ALTER TABLE attachments ADD COLUMN thumbnail_type TEXT")
|
|
606
|
+
if "cleared_at" not in attachment_columns:
|
|
607
|
+
connection.execute("ALTER TABLE attachments ADD COLUMN cleared_at TEXT")
|
|
606
608
|
if connection.execute("INSERT OR IGNORE INTO site_preferences (key,value) VALUES ('child_folders_migrated','1')").rowcount:
|
|
607
609
|
connection.execute("""UPDATE room_folder_assignments AS child SET folder_id=parent.folder_id
|
|
608
610
|
FROM room_links l JOIN room_folder_assignments parent ON parent.room_id=l.other_room_id
|
|
@@ -651,6 +653,9 @@ def require_room(connection, room_id):
|
|
|
651
653
|
queued_files = sum(len(json.loads(row[0]).get("attachment_ids") or []) for row in
|
|
652
654
|
connection.execute("SELECT payload FROM queued_messages WHERE room_id=?", (room_id,)))
|
|
653
655
|
room["next_attachment_number"] = attachment_number_before(connection, room_id, None) + queued_files
|
|
656
|
+
# Bytes of this room's stored files (sent and not-yet-sent uploads), shown beside the draft meter on the room page.
|
|
657
|
+
room["attachment_bytes"] = connection.execute(
|
|
658
|
+
"SELECT COALESCE(SUM(size),0) FROM attachments WHERE room_id=? AND cleared_at IS NULL", (room_id,)).fetchone()[0]
|
|
654
659
|
settings = connection.execute("SELECT host,background,boundaries,experts,focus FROM topic_settings WHERE room_id=?",
|
|
655
660
|
(room_id,)).fetchone()
|
|
656
661
|
room.update(dict(settings) if settings else topic_defaults())
|
|
@@ -2663,6 +2668,54 @@ def discard_attachment(connection, database, room_id, identifier, token):
|
|
|
2663
2668
|
return {"discarded": identifier}
|
|
2664
2669
|
|
|
2665
2670
|
|
|
2671
|
+
def attachment_usage(connection, room_id, token):
|
|
2672
|
+
"""List every sent file of the room with its size and state, for the owner choosing what to clear."""
|
|
2673
|
+
require_room(connection, room_id)
|
|
2674
|
+
require_owner(connection, room_id, token)
|
|
2675
|
+
rows = connection.execute("""SELECT * FROM attachments WHERE room_id=? AND message_id IS NOT NULL
|
|
2676
|
+
ORDER BY message_id,position,id""", (room_id,)).fetchall()
|
|
2677
|
+
files = [{**attachment_view(row), "number": index + 1} for index, row in enumerate(rows)]
|
|
2678
|
+
return {"attachments": files, "bytes": sum(item["size"] for item in files if not item["cleared_at"])}
|
|
2679
|
+
|
|
2680
|
+
|
|
2681
|
+
def clear_attachments(connection, database, room_id, payload, token):
|
|
2682
|
+
"""Delete the original bytes of chosen sent files to free space; records, numbers and thumbnails stay.
|
|
2683
|
+
|
|
2684
|
+
Args:
|
|
2685
|
+
payload: ``{"ids": [attachment ID, ...]}``; IDs already cleared are skipped.
|
|
2686
|
+
|
|
2687
|
+
Returns:
|
|
2688
|
+
``{"cleared": [IDs cleared now], "freed_bytes": int}``.
|
|
2689
|
+
"""
|
|
2690
|
+
begin_write(connection)
|
|
2691
|
+
require_room(connection, room_id)
|
|
2692
|
+
require_owner(connection, room_id, token)
|
|
2693
|
+
identifiers = payload.get("ids")
|
|
2694
|
+
if not isinstance(identifiers, list) or not identifiers or not all(isinstance(item, str) for item in identifiers):
|
|
2695
|
+
raise ValueError(Text('ids 须为非空的附件 ID 列表'))
|
|
2696
|
+
marks = ",".join("?" * len(set(identifiers)))
|
|
2697
|
+
rows = connection.execute(f"""SELECT * FROM attachments WHERE room_id=? AND message_id IS NOT NULL
|
|
2698
|
+
AND cleared_at IS NULL AND id IN ({marks})""", (room_id, *set(identifiers))).fetchall()
|
|
2699
|
+
known = {row[0] for row in connection.execute(f"SELECT id FROM attachments WHERE room_id=? AND message_id IS NOT NULL AND id IN ({marks})",
|
|
2700
|
+
(room_id, *set(identifiers)))}
|
|
2701
|
+
missing = sorted(set(identifiers) - known)
|
|
2702
|
+
if missing:
|
|
2703
|
+
raise LookupError(Text('附件不存在:{ids}', ids="、".join(missing)))
|
|
2704
|
+
now = utc_iso_now()
|
|
2705
|
+
for row in rows:
|
|
2706
|
+
connection.execute("UPDATE attachments SET cleared_at=? WHERE id=?", (now, row["id"]))
|
|
2707
|
+
if rows:
|
|
2708
|
+
# Messages show the change, so the room's readers refresh as after an edited message.
|
|
2709
|
+
connection.execute("UPDATE room_revisions SET revision=(SELECT MAX(revision)+1 FROM room_revisions) WHERE room_id=?", (room_id,))
|
|
2710
|
+
connection.commit()
|
|
2711
|
+
for row in rows:
|
|
2712
|
+
try:
|
|
2713
|
+
attachment_path(database, row).unlink(missing_ok=True)
|
|
2714
|
+
except OSError:
|
|
2715
|
+
logging.warning("Could not remove cleared attachment %s", row["id"], exc_info=True)
|
|
2716
|
+
return {"cleared": [row["id"] for row in rows], "freed_bytes": sum(row["size"] for row in rows)}
|
|
2717
|
+
|
|
2718
|
+
|
|
2666
2719
|
def check_message_attachments(connection, room_id, actor, identifiers):
|
|
2667
2720
|
"""Reject references to another room, uploader, or already published message."""
|
|
2668
2721
|
for identifier in identifiers:
|
|
@@ -4811,6 +4864,13 @@ class DiscussionHandler(BaseHTTPRequestHandler):
|
|
|
4811
4864
|
def handle_attachments(self, connection, parts, params, method):
|
|
4812
4865
|
"""Handle bounded upload, discovery, metadata, and binary download."""
|
|
4813
4866
|
room_id = parts[2]
|
|
4867
|
+
if parts[4:] == ["usage"] and method == "GET":
|
|
4868
|
+
return self.respond(attachment_usage(connection, room_id, self.headers.get("X-Discussion-Token", "")))
|
|
4869
|
+
if parts[4:] == ["clear"] and method == "POST":
|
|
4870
|
+
result = clear_attachments(connection, self.server.database, room_id, self.read_payload(),
|
|
4871
|
+
self.headers.get("X-Discussion-Token", ""))
|
|
4872
|
+
self.server.hub.notify_update(room_id)
|
|
4873
|
+
return self.respond(result)
|
|
4814
4874
|
if len(parts) == 4:
|
|
4815
4875
|
if method == "GET":
|
|
4816
4876
|
return self.respond(query_attachments(connection, room_id, params, self.headers.get("X-Discussion-Token", "")))
|
|
@@ -4846,6 +4906,8 @@ class DiscussionHandler(BaseHTTPRequestHandler):
|
|
|
4846
4906
|
content=len(parts) == 6)
|
|
4847
4907
|
if len(parts) == 5:
|
|
4848
4908
|
return self.respond(attachment)
|
|
4909
|
+
if parts[5] in ("content", "zip") and attachment.get("cleared_at"):
|
|
4910
|
+
raise LookupError(Text('附件已被清理'))
|
|
4849
4911
|
if parts[5] == "content":
|
|
4850
4912
|
return self.respond_attachment(attachment, params.get("download") == "1")
|
|
4851
4913
|
if parts[5] == "thumbnail":
|
package/docs/deployment.md
CHANGED
|
@@ -172,9 +172,13 @@ npx wrangler deploy --config deploy/updates.wrangler.jsonc
|
|
|
172
172
|
开了托管管理、想让托管账号的使用者不用自有域名就能从外网登录时,再部署入口 Worker(在中转之后部署,它使用中转的 Durable Object):
|
|
173
173
|
|
|
174
174
|
```sh
|
|
175
|
-
|
|
175
|
+
node scripts/entry_config.mjs
|
|
176
|
+
npx wrangler deploy --dry-run --config .wrangler/entry.json
|
|
177
|
+
npx wrangler deploy --config .wrangler/entry.json
|
|
176
178
|
```
|
|
177
179
|
|
|
180
|
+
入口配置从 `.wrangler/deploy/wrangler.jsonc` 复制 Pages 的 DB 绑定(必须含 database_id),写入私有的 `.wrangler/entry.json`。演练输出应列出同一个 DB 和中转 RELAY,演练不会上传。
|
|
181
|
+
|
|
178
182
|
它有自己的 `workers.dev` 地址(如 `https://codiscuss-entry.<账号子域>.workers.dev`),与线上站点不同源,托管账号的网页碰不到你已配对设备的密钥。把这个地址写进私有配置的 `vars`,重新部署 Pages,线上站点就会把它告诉来接入的托管电脑:
|
|
179
183
|
|
|
180
184
|
```json
|
package/docs/en/deployment.md
CHANGED
|
@@ -170,9 +170,13 @@ Older versions also had the live-update object `DiscussionUpdates` (binding `UPD
|
|
|
170
170
|
If you use hosting and want hosted accounts' users to sign in from outside without your own domain, also deploy the entry Worker (after the relay, since it uses the relay's Durable Object):
|
|
171
171
|
|
|
172
172
|
```sh
|
|
173
|
-
|
|
173
|
+
node scripts/entry_config.mjs
|
|
174
|
+
npx wrangler deploy --dry-run --config .wrangler/entry.json
|
|
175
|
+
npx wrangler deploy --config .wrangler/entry.json
|
|
174
176
|
```
|
|
175
177
|
|
|
178
|
+
The generator copies the Pages DB binding, including its required database_id, from `.wrangler/deploy/wrangler.jsonc` into the private `.wrangler/entry.json`. Check that the dry run lists the same DB and the RELAY binding before deploying.
|
|
179
|
+
|
|
176
180
|
It gets its own `workers.dev` address (such as `https://codiscuss-entry.<account-subdomain>.workers.dev`), on a different origin from the online site, so hosted accounts' pages can't reach your paired devices' keys. Put this address in the `vars` of your private configuration and redeploy Pages; the online site then hands it to hosted computers that connect:
|
|
177
181
|
|
|
178
182
|
```json
|
package/docs/en/guide/admin.md
CHANGED
|
@@ -9,11 +9,14 @@ Use the local management panel or the corresponding codiscuss admin commands to
|
|
|
9
9
|
- **This computer:** Check the CoDiscuss service status, start, restart, stop, or select **Open site**. When hosting is enabled, this page also shows **Program copies** used by isolated accounts.
|
|
10
10
|
- **Administrator entry / Online site:** View the local and linked online site addresses. Select **Bind**, **Unbind**, or **Generate access code**.
|
|
11
11
|
**Online site** and `codiscuss admin status` show **Relay connected** after a heartbeat reply on the current connection, explain disconnects, retries or consecutive HTTP failures, and show **Status unknown** if the service is stopped or its observations are stale. After 3 minutes without heartbeat confirmation, the service rebuilds that site’s connection. Select **Reconnect now** or run `codiscuss admin site reconnect` to request it immediately.
|
|
12
|
+
|
|
13
|
+
Under Overview → This computer → Online site, select Relay region. The default is Asia Pacific. Automatic creates the object near the first party to connect, usually the computer’s network exit. Its location stays fixed after creation. Other values are location hints. After the service syncs the change, the computer and paired devices reconnect automatically. Run `codiscuss admin site region` to inspect the setting or `codiscuss admin site region weur` to select Western Europe.
|
|
12
14
|
- **Hosted account entry** (shown when hosting is enabled): Start or stop the **Sign-in entry**, enable **Through the online site**, or configure your **Own domain** using Cloudflare Tunnel.
|
|
13
15
|
- **Settings:** View the installed version, select **Check for updates** or **Update and restart** (which also updates room skills and isolated accounts), enable **Start when signing in to Windows**, and change the panel language.
|
|
14
16
|
- **Storage:**
|
|
15
17
|
- View local `.codiscuss` data usage against the 10 GiB limit (excluding speech models), total drafts against 3 GiB (1 GiB per room), **Room records & attachments (`local/`)**, disk free space and safety reserve, per-room and per-member breakdowns, and any unreadable entries. Local TTS and STT models are listed separately and excluded from the 10 GiB cap (covering both legacy and custom model paths, including when the service home itself is a symlink or junction).
|
|
16
18
|
- When `.codiscuss` data reaches the 8 GiB warning threshold, the **Storage** tab shows a warning dot and displays a notice; exceeding a limit or dropping below the disk safety reserve pauses new runs. The total is split into five named directories and Other. **Safe cleanup** removes registered failed scratch, speech cache entries, empty orphan directories, stale launches containing only setup records, and local execution files more than 24 hours after completion. After clearing the speech cache, replaying old content with cloud speech synthesizes it again and incurs a new charge. **Deep repair** estimates space before you select and confirm deletion of finished logs, including the last day.
|
|
19
|
+
- **Room attachments** lists each room's sent, not-yet-cleared attachments, largest first. Select **Manage attachments** to expand the same attachment manager as on the room page (see “Draft storage and limits” in [Managing rooms](rooms.md)).
|
|
17
20
|
- **Recovery and limits:** While a room is blocked, its host cannot run either—to clean older drafts, run `$codiscuss-draft-cleanup` in an **AI chat outside the room** (it audits first and deletes rebuildable copies only after your confirmation). Room records and attachments in `local/` are never deleted automatically; export a backup and destroy old rooms to reclaim that space. Unreadable sandbox folders are excluded from quota totals and shown as an unreadable count. Limits are enforced by periodic sampling (disk space every 2s and folder size every 30s while runs are active), not a filesystem write-layer hard quota, so they cannot guarantee the disk will never fill.
|
|
18
21
|
During active runs, the service checks free space on its own volume every two seconds. While part of the 10 GiB budget remains, a drop in free space as large as that remainder triggers an early scan. When a run ends, the service updates that member’s draft usage. A manual retry after cleanup rechecks the limit that blocked the run. If a machine-wide limit was exceeded, the service measures machine-wide usage again. If another program writes to the volume, runs continue when measured usage is within limits and the unreadable count is stable. If an early scan finds more unreadable entries, dispatch pauses and the service requests stops for stoppable runs. Dispatch resumes when a later scan finds a stable count, usage within limits and enough free disk space. The low-disk reserve applies independently. At 80% of the room draft limit, new runs without confirmed stop support are paused. Writes can continue between and during scans, and ongoing unstoppable runs can keep writing. Project files, system temporary files and third-party AI data outside the service directory are excluded. Follow the cleanup instructions on the failed run’s card, then select “Retry” on that card from the computer or a paired device.
|
|
19
22
|
- **Account:**
|
|
@@ -36,7 +39,7 @@ On Windows, open the panel from the tray. On macOS and Linux, use the command-li
|
|
|
36
39
|
- **Entry protection:** This is enabled by default on the hosted account details page and is available on Windows only. It restricts site access to users authenticated by the sign-in entry and that account’s own AI, blocking direct access by other local programs.
|
|
37
40
|
3. **Configure remote access** using either or both options:
|
|
38
41
|
- **Through the online site, without your own domain:** Follow the [deployment guide](../deployment.md#entry-for-hosted-accounts-optional) to deploy the entry Worker. On the deployment computer, generate an access code under **Overview** → **This computer** → **Online site**. On this computer, bind the online site and turn on **Through the online site** under **Hosted account entry**. You can also run codiscuss admin entry join <access-code>.
|
|
39
|
-
- **Own domain:** Under **Hosted account entry** → **Own domain**, authorize a Cloudflare tunnel and connect a domain hosted on Cloudflare. The CLI equivalent is codiscuss admin entry tunnel <domain
|
|
42
|
+
- **Own domain:** Under **Hosted account entry** → **Own domain**, authorize a Cloudflare tunnel and connect a domain hosted on Cloudflare. The CLI equivalent is `codiscuss admin entry tunnel <domain>`. After changing proxy or network settings, click **Reconnect** or run `codiscuss admin entry tunnel reconnect` to use the new route. Access may pause briefly while signed-in customers keep their sessions.
|
|
40
43
|
4. **Manage the account:** Start or stop its instance, enable, disable or remove the account, reset its password, and provide API keys. Users see **Provided by admin** for administrator-provided keys and cannot view or change them. To invite external experts, the account needs an online relay. The panel checks instances requested to run every minute and restarts them if their port refuses connections, up to 3 times in 10 minutes. After repeated failures, the account row shows the last error. Check `codiscuss admin status` for the latest attempt and start the instance manually after fixing the cause to resume recovery.
|
|
41
44
|
|
|
42
45
|
### Move an existing account’s project data to another drive
|
|
@@ -60,8 +63,9 @@ Every command in the table is prefixed by codiscuss admin and returns JSON. Thes
|
|
|
60
63
|
| Start, exit, restart, or update (panel need not be running) | `codiscuss admin start`, `stop`, `restart`, `update [check]` |
|
|
61
64
|
| Check status, control service, configure sign-in startup | `status [--full]`, `service start\|stop\|restart`, `autostart on\|off` |
|
|
62
65
|
| Inspect storage usage and clear temporary run files | `storage`, `storage clean`, `storage repair` (preview), `storage repair logs --confirm` |
|
|
66
|
+
| View and clear attachments by room | `codiscuss admin storage attachments` (usage per room), `storage attachments ROOM` (list files), `storage attachments ROOM clear ID... --confirm` |
|
|
63
67
|
| Link/unlink online site and create access code | `site status`, `site connect <access-code\|site>`, `site disconnect`, `entry code` |
|
|
64
|
-
| Manage sign-in entry and tunnel | `entry start\|stop`, `entry join <access-code>`, `entry open\|close relay\|tunnel`, `entry tunnel <domain
|
|
68
|
+
| Manage sign-in entry and tunnel | `entry start\|stop`, `entry join <access-code>`, `entry open\|close relay\|tunnel`, `entry tunnel <domain>`, `entry tunnel reconnect` |
|
|
65
69
|
| Manage hosted account lifecycle | `account list`, `account add <name>`, `account start\|stop\|disable\|enable\|remove\|password <name>`, `account isolate\|protect <name>` |
|
|
66
70
|
| Manage sign-ins, keys, skills, workflows, and prompts | `login status <target>`, `key add <target> --base-url … --key …`, `skill install <target> <skill>`, `workflow install <target>`, `workflow update <target>`, `prompt set <target> --file …` |
|
|
67
71
|
|
package/docs/en/guide/rooms.md
CHANGED
|
@@ -47,11 +47,11 @@ When viewing a project image through the relay on another device, supported imag
|
|
|
47
47
|
“File changes” below an answer shows the number of changed files and lines added or removed. Lists of five files or fewer open by default. Select the file count to open a longer list. Read-only visitors can see the list, but only the room owner can view patches.
|
|
48
48
|
|
|
49
49
|
- **Add or remove directories.** A room supports one primary directory and up to eight additional directories. After creating a room, open the “Room” tab at the top of the room and find “Project folder”. Add or remove additional directories there. Changes apply from each member’s next run and do not interrupt a session. A primary directory cannot be changed after it is set. If the room was created without one, you can set it once in the same section. Members can access all room directories subject to their individual project permissions.
|
|
50
|
-
- **Open Files.** In the tabs at the top of the room, select “Files” to browse directories, file sizes, and modification times. Switch between the primary and additional directories at the top. A project directory is required. The “Icon view” button at the top right lays the folder out as tiles, with thumbnails for PNG, JPG, and WebP images; “List view” switches back. Thumbnails are made by the computer and currently only on Windows; other images and files show their icons.
|
|
50
|
+
- **Open Files.** In the tabs at the top of the room, select “Files” to browse directories, file sizes, and modification times. Switch between the primary and additional directories at the top. A project directory is required. The back and forward buttons at the left of the path bar move between the places you visited (folders, the project list, the recycle bin); on a computer, the mouse side buttons do the same. Phones show only the back button. On a phone you can also swipe anywhere on the page: swipe right to go back and left to go forward. In a file preview, swiping right closes the file and returns to its folder (swiping left does nothing there; image and media previews keep their own gestures). The “Icon view” button at the top right lays the folder out as tiles, with thumbnails for PNG, JPG, and WebP images; “List view” switches back. Thumbnails are made by the computer and currently only on Windows; other images and files show their icons.
|
|
51
51
|
- **Preview files.** Select a file to open its floating preview. Supported previews include plain text, code, rendered Markdown, static HTML with a source view, zoomable and rotatable images, audio and video with speed and full-screen controls, CSV tables, subtitle timelines (SRT, VTT, ASS, LRC), read-only Word, Excel, PowerPoint and PDF, Premiere project XML, and zip archives listed like a folder, where selecting a file inside opens it in a new tab. Images in Markdown display inline the way message images do; select one to zoom. Paths are accepted as common editors accept them: relative paths, project paths starting with `/`, absolute paths inside the room's project directories (such as `D:\Project\art\a.png` or `file:///D:/Project/art/a.png`), and web addresses. Files outside the room's project directories are not read. Images load as you scroll near them; landscape images fill the width and portrait images fit the window height. Other devices get a copy the computer compressed. Opening a ZIP attachment or project file loads the directory first. Select an entry to read it (up to 64 MiB), or choose “Download” to save the archive.
|
|
52
52
|
- **Tabs, split view, and collapse.** Open multiple files and switch between tabs. Use the preview controls to split the view on the right or use “File location” to return to the containing folder. HTML previews also offer “Open in new tab”. Select “Collapse” in the title bar to keep the preview as a floating button in the corner. It restores the same file and scroll position when you return to the room. Close it to clear the preview.
|
|
53
53
|
- **Quote and annotate.** Select text in a Markdown preview or a member’s answer and choose “Add to conversation”. Enter a note and press Enter. The source is marked with a number and the composer shows the number of notes. On a computer, open the notes list, choose “Edit annotation”, and drag the bottom-right corner of the editor to resize it. Sending the message adds a file path and line number, the member and message ID, or for a message attachment its message ID and attachment ID. An `@` inside a quote does not wake a member.
|
|
54
|
-
- **Manage project files.** Select “Project” at the start of the path bar to open your projects and drafts. Use the top controls to create folders and upload files (up to 20 MB each). File menus offer “Download” (“Download folder” for a folder, packed as a ZIP), “Rename”, “Copy”, “Cut”, and “Delete”. Paste into the destination folder. Deleted files and replaced versions go to “Recycle bin” for 30 days, where they can be restored. In source view, the pencil button edits text files up to 1 MB. Project and draft roots, and folders currently used as room project directories, cannot be renamed, moved, or deleted.
|
|
54
|
+
- **Manage project files.** Select “Project” at the start of the path bar to open your projects and drafts. Use the top controls to create folders and upload files (up to 20 MB each). File menus offer “Download” (“Download folder” for a folder, packed as a ZIP), “Rename”, “Copy”, “Cut”, and “Delete”. Paste into the destination folder. Deleted files and replaced versions go to “Recycle bin” for 30 days, where they can be restored (“More actions” → “Recycle bin” at the top right; “Refresh” is there too, though the list refreshes itself). In source view, the pencil button edits text files up to 1 MB. Project and draft roots, and folders currently used as room project directories, cannot be renamed, moved, or deleted.
|
|
55
55
|
|
|
56
56
|
### 4. Send and view attachments
|
|
57
57
|
|
|
@@ -89,7 +89,7 @@ A message from another room goes to this room's current host: an idle host takes
|
|
|
89
89
|
- **Notice when a room's work ends.** When all work in another room ends (it changes from "Running" to idle) and stays ended for a few seconds, the page shows "Work in room \"Room name\" has ended" in the lower-right corner. The room you are viewing is not announced, and neither is work that stops and resumes at once, as with an interjection or a retry. The page must be open.
|
|
90
90
|
- **Shared directories are not locked.** If members edit the same project file at once, the page shows a conflict notification while the room is open. It is not added to the message history and does not wake the host.
|
|
91
91
|
- Read large assets and repositories in their project folders. Never copy them into a member’s draft folder or its `.scratch` subfolder, even when the project is read-only. If a writable copy is necessary, ask the owner to designate a writable project folder.
|
|
92
|
-
- **Draft storage and limits.** When connected to the local service or a paired computer, the **Draft storage** section at the bottom of the **Room** tab (expanded by default) shows usage (1 GiB per room, 3 GiB across all drafts, and 10 GiB for local `.codiscuss` data excluding speech models). The bar and text turn amber at 80% and red when over the limit (pausing new runs); reaching 8 GiB across `.codiscuss` also shows a warning notice, and any permission-denied unreadable entries are called out separately; **Draft storage** only counts unreadable entries in this room's drafts, while the computer-wide count is on the management panel **Storage** page. The room owner can select **Clear temporary files** in the expanded section to remove confirmed finished execution `.scratch` folders. If older drafts block the room, run `$codiscuss-draft-cleanup` in an **AI chat outside the room** to audit and delete rebuildable copies after confirmation; room records and attachments (`local/`) are never deleted automatically
|
|
92
|
+
- **Draft storage and limits.** When connected to the local service or a paired computer, the **Draft storage** section at the bottom of the **Room** tab (expanded by default) shows usage (1 GiB per room, 3 GiB across all drafts, and 10 GiB for local `.codiscuss` data excluding speech models). If the room has attachments, a line below the bar shows how much space this room's attachments take; attachments are stored with the room records, do not count toward the draft quota, and are not removed by **Clear temporary files**. The room owner can select **Manage attachments** next to it to free attachment space: filter by type (images, audio & video, archives, documents, other) and age (older than 7 or 30 days), sorted largest first; the footer shows how much the selection frees. Select **Clear selected**, then **Confirm clear (cannot be undone)**. Messages stay, and each cleared attachment keeps its name, size and image thumbnail and is marked **Cleared**, but the original can no longer be opened, downloaded or read by members, and share pages and export packages no longer include it. The bar and text turn amber at 80% and red when over the limit (pausing new runs); reaching 8 GiB across `.codiscuss` also shows a warning notice, and any permission-denied unreadable entries are called out separately; **Draft storage** only counts unreadable entries in this room's drafts, while the computer-wide count is on the management panel **Storage** page. The room owner can select **Clear temporary files** in the expanded section to remove confirmed finished execution `.scratch` folders. If older drafts block the room, run `$codiscuss-draft-cleanup` in an **AI chat outside the room** to audit and delete rebuildable copies after confirmation; room records and attachments (`local/`) are never deleted automatically; clear attachment originals with **Manage attachments**, or destroy old rooms to free space. Limits rely on periodic sampling rather than a filesystem write-layer hard quota and cannot guarantee the disk will never fill.
|
|
93
93
|
During active runs, the service checks free space on its own volume every two seconds. While part of the 10 GiB budget remains, a drop in free space as large as that remainder triggers an early scan. When a run ends, the service updates that member’s draft usage. A manual retry after cleanup rechecks the limit that blocked the run. If a machine-wide limit was exceeded, the service measures machine-wide usage again. If another program writes to the volume, runs continue when measured usage is within limits and the unreadable count is stable. If an early scan finds more unreadable entries, dispatch pauses and the service requests stops for stoppable runs. Dispatch resumes when a later scan finds a stable count, usage within limits and enough free disk space. The low-disk reserve applies independently. At 80% of the room draft limit, new runs without confirmed stop support are paused. Writes can continue between and during scans, and ongoing unstoppable runs can keep writing. Project files, system temporary files and third-party AI data outside the service directory are excluded. Follow the cleanup instructions on the failed run’s card, then select “Retry” on that card from the computer or a paired device.
|
|
94
94
|
- **Preview and transfer limits.** Text previews show at most the first 128 KB. When another device accesses media and documents through the computer, each file is limited to 64 MB. The web app first attempts to compress videos larger than 3 MiB. Links pointing outside a project directory appear disabled and are rejected.
|
|
95
95
|
- **A branch does not copy project files.** Branched and original rooms share the same project directory. Branching requires a connection to the local service.
|
package/docs/guide/admin.md
CHANGED
|
@@ -9,11 +9,14 @@
|
|
|
9
9
|
- **本机**:查看“共议服务”运行状态,点启动、重启、停止或“打开网站”;开启托管管理后还显示供隔离账号使用的“程序副本”。
|
|
10
10
|
- **管理员入口 / 线上网站**:查看本地网页和已绑定的线上网站地址,可“绑定”、“解绑”或“生成接入码”。
|
|
11
11
|
“线上网站”和 `codiscuss admin status` 均在收到本次连接的心跳回应后显示“中转已连接”,遇到断线、重连或连续 HTTP 请求失败会说明原因,服务停止或记录过期时显示“状态未知”。中转连续 3 分钟未获心跳确认时,服务会重建该网站的连接。也可以点“立即重连”或运行 `codiscuss admin site reconnect`。
|
|
12
|
+
|
|
13
|
+
在“概览 → 本机 → 线上网站”的“中转地区”选择部署位置,默认亚太。选“自动”时,Cloudflare 在最先发起连接的一方附近创建对象,通常靠近电脑的网络出口,建好后位置固定;其他选项是位置提示。服务同步设置后,电脑和已配对设备自动重连。命令行用 `codiscuss admin site region` 查看,用 `codiscuss admin site region weur` 切换到欧洲西部。
|
|
12
14
|
- **托管账号入口**(开启托管管理后显示):启停“登录入口”,开关“经线上网站中转”或配置“自有域名”(Cloudflare Tunnel)。
|
|
13
15
|
- **设置**:查看当前版本、“检查更新”与“更新并重启”(同步更新房间技能和隔离账号)、开关“登录 Windows 时自动启动”,以及切换管理面板语言。
|
|
14
16
|
- **“存储”页**:
|
|
15
17
|
- 查看本机 `.codiscuss` 数据总量(上限 10 GiB,不含语音模型)、全机草稿区占用(上限 3 GiB,单房间 1 GiB)、**房间记录与附件(`local/`)**占用、所在磁盘剩余空间与安全线,以及按房间与成员拆分的草稿占用和权限不可读条目计数;本机朗读与语音识别模型单独列出,不计入 10 GiB 上限(兼容旧目录与自定义模型目录,服务根目录为目录联接时也可正常计量)。
|
|
16
18
|
- 当 `.codiscuss` 数据达到 8 GiB 预警线时,“存储”标签显示提示圆点并弹出警告;超过上限或磁盘低于安全线时停止新的派活。总量分为五个具名目录和“其他”。“安全清理”回收已登记的失败执行临时目录、朗读缓存、无主空目录和仅剩登记文件的过期启动目录,以及本机站点已结束超过 24 小时的执行文件。清除朗读缓存后,用云端语音重听旧内容会重新合成并计费。“深度修理”先预估容量,勾选并确认后可删除含最近一天在内的已结束执行日志。
|
|
19
|
+
- “房间附件”按占用从大到小列出各房间已发出、尚未清理的附件;点“管理附件”展开,与房间页的附件管理相同(见[管理房间](rooms.md)“草稿空间与存储上限”)。
|
|
17
20
|
- **超限脱困与边界**:房间被拦截时主持人也无法运行,清理历史旧草稿需在**房间外的 AI 对话**(如本机 Claude Code / Codex / Antigravity)中调用 `$codiscuss-draft-cleanup`(默认只盘点,经你确认才删除可重建副本);若由 `local/` 房间记录与附件占满,请先导出备份再在网页销毁旧房间。沙箱创建的不可读目录不计入配额,页面会标出数量;所有限额均为定期采样检查(有执行时每 2 秒查磁盘余量、每 30 秒扫描占用),并非文件系统写入层硬拦截,不能保证磁盘绝不写满。
|
|
18
21
|
服务执行期间,每 2 秒检查服务目录所在卷的可用空间。10 GiB 预算还有余量时,卷上可用空间的下降量达到该余量就提前复扫。执行结束时更新相应成员的草稿占用。清理后手动重试会按原拦截原因复核;全机超限时重新统计全机用量。其他程序写盘时,若可测用量未超限且不可读项数量稳定,运行继续。提前复扫发现不可读项增多时暂停派活,并请求停止可停执行。后续扫描确认数量稳定且各项限额与磁盘余量正常时,恢复派活。低于磁盘安全线仍独立触发保护。房间草稿达到 80% 时,守卫提前暂停无法确认可停止的新执行。采样之间及扫描期间仍可写入,已运行的不可停成员可继续写入。项目目录、系统临时目录与第三方 AI 自身数据在服务目录外时不计入预算。按失败卡上的原因清理后,在卡片上点“重试”。本机和已配对设备都可手动重试。
|
|
19
22
|
- **“账号”页**:
|
|
@@ -38,7 +41,7 @@ Windows 可以从托盘打开面板。macOS 和 Linux 的命令行入口见下
|
|
|
38
41
|
- **入口保护**:在托管账号详情页默认开启“入口保护”(仅支持 Windows),开启后只有经登录入口验证的使用者和它自己的 AI 能访问该实例网站,防止本机其他程序直接访问。
|
|
39
42
|
3. **配置外网入口(二选一或同时开启)**:
|
|
40
43
|
- **经线上网站中转(无需自有域名)**:先按[部署指南](../deployment.md#托管账号的入口可选)部署好入口 Worker;在部署电脑的“概览 → 本机 → 线上网站”生成接入码后,在这台电脑的管理面板“概览 → 线上网站”绑定并打开“托管账号入口”里的“经线上网站中转”(命令行一步完成:`codiscuss admin entry join <接入码>`)。
|
|
41
|
-
- **自有域名**:在“托管账号入口 → 自有域名”点配置,按提示授权 Cloudflare 隧道并绑定托管在 Cloudflare 上的域名(命令行 `codiscuss admin entry tunnel
|
|
44
|
+
- **自有域名**:在“托管账号入口 → 自有域名”点配置,按提示授权 Cloudflare 隧道并绑定托管在 Cloudflare 上的域名(命令行 `codiscuss admin entry tunnel <域名>`)。更改代理或网络设置后,点“重新连接”或运行 `codiscuss admin entry tunnel reconnect` 让隧道使用新路由。切换时访问可能短暂中断,已登录的客户保留会话。
|
|
42
45
|
4. **管理账号**:在托管账号页面可以启动/停止实例、停用/启用账号、重设密码、删除账号、配置由管理员提供的 API 密钥(对方界面只显示“管理员提供”,无法查看或更换),并复制登录地址与账号发给对方。邀请外部专家需要该实例具备可用的线上中转入口。面板每分钟检查已要求运行的实例,端口拒绝连接时自动重启,10 分钟内最多 3 次。达到上限仍失败时,账号行显示最后原因,`codiscuss admin status` 可查最近一次尝试。修好原因后手动启动可恢复巡检。
|
|
43
46
|
|
|
44
47
|
### 把已有账号的项目数据迁到另一块盘
|
|
@@ -62,8 +65,9 @@ Windows 可以从托盘打开面板。macOS 和 Linux 的命令行入口见下
|
|
|
62
65
|
| 启动、退出、重启、更新(**无需面板已运行**) | `codiscuss admin start` / `stop` / `restart` / `update [check]` |
|
|
63
66
|
| 查看状态、启停服务、开机自启 | `codiscuss admin status [--full]`、`service start\|stop\|restart`、`autostart on\|off` |
|
|
64
67
|
| 查看存储占用与清理临时文件 | `codiscuss admin storage`、`storage clean`、`storage repair`(预览)、`storage repair logs --confirm` |
|
|
68
|
+
| 按房间查看与清理附件 | `codiscuss admin storage attachments`(各房间占用)、`storage attachments ROOM`(列出附件)、`storage attachments ROOM clear ID... --confirm` |
|
|
65
69
|
| 绑定/解绑线上网站、生成接入码 | `codiscuss admin site status`、`site connect <接入码\|站点>`、`site disconnect`、`entry code` |
|
|
66
|
-
| 托管入口与隧道 | `codiscuss admin entry start\|stop`、`entry join <接入码>`、`entry open\|close relay\|tunnel`、`entry tunnel
|
|
70
|
+
| 托管入口与隧道 | `codiscuss admin entry start\|stop`、`entry join <接入码>`、`entry open\|close relay\|tunnel`、`entry tunnel <域名>`、`entry tunnel reconnect` |
|
|
67
71
|
| 托管账号生命周期 | `codiscuss admin account list`、`account add <名>`、`account start\|stop\|disable\|enable\|remove\|password <名>`、`account isolate\|protect <名>` |
|
|
68
72
|
| 登录、密钥、技能与提示词 | `codiscuss admin login status <对象>`、`key add <对象> --base-url … --key …`、`skill install <对象> <技能>`、`workflow install <对象>`、`workflow update <对象>`、`prompt set <对象> --file …` |
|
|
69
73
|
|
package/docs/guide/rooms.md
CHANGED
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
回答下方的“文件改动”显示已修改的文件数和增删行数。改动不超过 5 个文件时默认展开,超过时点击文件数查看清单。可读房间的访客也能看清单,只有房主能看补丁。
|
|
46
46
|
|
|
47
47
|
- **增删项目目录**:一个房间可有 1 个主项目目录和最多 8 个其他项目目录。建房后打开顶部“房间”页,在“项目目录”区域可增删其他目录,保存后从各成员下一次执行起生效,不中断会话。主目录设置后不能更改;建房时未设的,可在同一行补设一次。成员按各自项目权限读写全部目录。
|
|
48
|
-
-
|
|
48
|
+
- **打开“文件”页**:房间顶部的标签栏点“文件”,浏览目录、文件大小与修改时间,上方可切换主目录与其他项目目录。浏览文件需要已设置项目目录。路径栏最左边的返回、前进按钮可在走过的位置(文件夹、项目列表、回收区)间来回,电脑上也可用鼠标侧键;手机上只显示返回。手机上在页面任意位置左右滑动也可以:手指向右滑是返回,向左滑是前进;在文件预览里向右滑会关闭文件,回到它所在的文件夹(预览里向左滑不起作用,图片和音视频预览保留它们自己的手势)。右上角的“图标视图”按钮把列表换成图标排列,PNG、JPG、WebP 图片显示缩略图,再点“列表视图”换回;缩略图由这台电脑生成,目前只在 Windows 电脑上有,其他图片和文件显示图标。
|
|
49
49
|
- **预览文件**:点击文件打开悬浮预览,支持纯文本、代码、Markdown 渲染、HTML 静态渲染并可切换源码;图片可缩放、旋转;音视频带倍速与全屏直接播放;CSV 显示为表格,字幕(SRT、VTT、ASS、LRC)显示为时间轴;Word、Excel、PowerPoint 与 PDF 只读预览;Premiere 工程显示其 XML;zip 压缩包像文件夹一样列出其中的文件夹与文件,点击其中的文件在新标签中预览。Markdown 中的图片与消息里的图片显示方式相同,在正文中直接显示,点击可放大查看。支持常见编辑器的写法:相对路径、以 `/` 开头的项目内路径、房间项目目录内的绝对路径(如 `D:\项目\插图\a.png`、`file:///D:/项目/插图/a.png`)与网络地址;房间项目目录之外的文件不会读取。滚动到附近才载入,横图铺满宽度、竖图按窗口高度显示;在其他设备上看到的是电脑压缩过的版本。打开房间附件或项目中的 ZIP 时先显示目录,点包内文件才读取内容。单个文件最多预览 64 MiB,也可以点“下载”保存整个压缩包。
|
|
50
50
|
- **多标签、分屏与收起**:可同时打开多个文件以标签切换,在预览栏切换为右侧分屏、或点“文件位置”回到所在文件夹。HTML 预览还可以“在新标签页打开”。点标题栏“收起”缩成内容区角落的悬浮按钮,切到其他房间后点它即可回到原文件与滚动位置,关闭才清空。
|
|
51
51
|
- **摘录批注**:在 Markdown 预览或成员回答正文中选中文字点“添加到对话”,可输入批注并回车,原文标出编号,输入框上方显示“N 条注释”。在电脑上,打开注释列表,点“修改批注”,可拖动编辑框右下角调整宽高。发送时自动附带文件路径+行号、成员+消息编号,或消息附件所属的消息编号与附件 ID,引用中的 `@` 不会唤醒成员。
|
|
52
|
-
- **整理文件**:点路径栏最前面的“项目”,可以打开你所有的项目和草稿。上方按钮用于新建文件夹和上传文件(单个不超过 20 MB);每行的菜单里有“下载”(文件夹为“下载文件夹”,打包成 ZIP)、“重命名”、“复制”、“剪切”、“删除”,复制或剪切后到目标文件夹点“粘贴”。删除的文件和被替换掉的旧版放进“回收区”,保留 30
|
|
52
|
+
- **整理文件**:点路径栏最前面的“项目”,可以打开你所有的项目和草稿。上方按钮用于新建文件夹和上传文件(单个不超过 20 MB);每行的菜单里有“下载”(文件夹为“下载文件夹”,打包成 ZIP)、“重命名”、“复制”、“剪切”、“删除”,复制或剪切后到目标文件夹点“粘贴”。删除的文件和被替换掉的旧版放进“回收区”,保留 30 天,可以还原(右上角“更多操作”→“回收区”;“刷新”也在这里,平时列表会自动刷新)。在源码视图点铅笔按钮可以编辑文本文件(不超过 1 MB)。项目、草稿文件夹本身,以及房间正在用作项目目录的文件夹,都不能改名、移动或删除。
|
|
53
53
|
|
|
54
54
|
### 4. 发送与查看附件
|
|
55
55
|
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
- **房间工作结束时提示**:别的房间的工作全部结束(从“正在执行”变为空闲)并保持几秒后,网页右下角提示“房间「房间名」的工作已结束”;正在看的房间不提示,插话、重试这类停下又马上继续的情况也不提示。需要开着网页。
|
|
88
88
|
- **共享目录不加锁**:多位成员同时改动同一项目文件时,网页右下角会弹出冲突提示(仅在开着房间时触发,不写进消息记录,也不唤醒主持人)。
|
|
89
89
|
- 大型素材和仓库在项目目录中直接读取;禁止复制到成员草稿目录或其 `.scratch` 子目录,项目只读时同样如此。需要可写副本时,请房主指定可写的项目目录。
|
|
90
|
-
- **草稿空间与存储上限**:连接本机服务或已配对电脑后,在“房间”页底部的“草稿空间”(默认展开)可查看本房间的草稿占用(单房间上限 1 GiB,全机草稿 3 GiB,`.codiscuss` 数据总量 10 GiB
|
|
90
|
+
- **草稿空间与存储上限**:连接本机服务或已配对电脑后,在“房间”页底部的“草稿空间”(默认展开)可查看本房间的草稿占用(单房间上限 1 GiB,全机草稿 3 GiB,`.codiscuss` 数据总量 10 GiB,不含语音模型)。本房间有附件时,进度条下方另列“本房间附件”的占用:附件存在房间记录里,不计入草稿配额,也不会被“清理临时文件”删除。房主点旁边的“管理附件”可释放附件空间:按类型(图片、音视频、压缩包、文档、其他)和时间(7 天前、30 天前)筛选,按大小从大到小排列,勾选后底部显示将释放多少,点“清理所选”再点“确认清理(无法撤销)”。清理后消息仍在,附件卡片保留文件名、大小和图片缩略图并标“已清理”,原文件无法再打开、下载或被成员读取,分享页与导出资料包里也不含原文件。房间草稿达到 80% 时进度条与文字转为警示色,超限时转为红色并停止派活;本机数据达到 8 GiB 时右下角弹出警告提示,存在权限不可读条目时会一并标出;“草稿空间”里只标本房间草稿中因权限无法读取的条数,全机数字在管理面板“存储”页。房主可在展开后点“清理临时文件”回收已确认结束执行的 `.scratch` 目录;房间被旧草稿拦截时,请在**房间外的 AI 对话**中运行 `$codiscuss-draft-cleanup` 盘点并按授权清理;房间记录与附件(`local/`)永不自动删除,可用“管理附件”清理附件原件,或销毁旧房间释放空间。存储上限按周期采样检查,并非文件系统写入层硬拦截,不能保证磁盘绝不写满。
|
|
91
91
|
服务执行期间,每 2 秒检查服务目录所在卷的可用空间。10 GiB 预算还有余量时,卷上可用空间的下降量达到该余量就提前复扫。执行结束时更新相应成员的草稿占用。清理后手动重试会按原拦截原因复核;全机超限时重新统计全机用量。其他程序写盘时,若可测用量未超限且不可读项数量稳定,运行继续。提前复扫发现不可读项增多时暂停派活,并请求停止可停执行。后续扫描确认数量稳定且各项限额与磁盘余量正常时,恢复派活。低于磁盘安全线仍独立触发保护。房间草稿达到 80% 时,守卫提前暂停无法确认可停止的新执行。采样之间及扫描期间仍可写入,已运行的不可停成员可继续写入。项目目录、系统临时目录与第三方 AI 自身数据在服务目录外时不计入预算。按失败卡上的原因清理后,在卡片上点“重试”。本机和已配对设备都可手动重试。
|
|
92
92
|
- **预览与传输限额**:文本文件最多预览前 128 KB;其他设备经电脑查看媒体与文档时单个文件最多 64 MB,发送 3 MiB 以上视频时网页会先尝试压缩。指向项目目录外的链接会灰显并被拒绝。
|
|
93
93
|
- **分支不分叉文件**:分支出的新房间与原房间共用同一项目目录,文件系统不会复制;“从这里分支”需要连接本机服务。
|
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
{
|
|
2
|
+
"请先配置自有域名": "Configure the domain first.",
|
|
3
|
+
"请先开启自有域名": "Enable the domain first.",
|
|
4
|
+
"请先启动登录入口": "Start the sign-in entry first.",
|
|
5
|
+
"隧道已重新连接": "Tunnel reconnected.",
|
|
6
|
+
"隧道未在 30 秒内连通,请检查网络和 tunnel.log": "The tunnel did not connect within 30 seconds. Check the network and tunnel.log.",
|
|
7
|
+
"电脑和已配对设备会自动重连到新的中转位置": "The computer and paired devices will automatically reconnect to the new relay location.",
|
|
8
|
+
"请在没有操作进行时切换。": "Switch when no operations are in progress.",
|
|
9
|
+
"中转地区": "Relay region",
|
|
10
|
+
"中东": "Middle East",
|
|
11
|
+
"非洲": "Africa",
|
|
12
|
+
"南美洲": "South America",
|
|
13
|
+
"大洋洲": "Oceania",
|
|
14
|
+
"欧洲东部": "Eastern Europe",
|
|
15
|
+
"欧洲西部": "Western Europe",
|
|
16
|
+
"北美东部": "Eastern North America",
|
|
17
|
+
"北美西部": "Western North America",
|
|
18
|
+
"亚太东南部": "Southeast Asia Pacific",
|
|
19
|
+
"亚太东北部": "Northeast Asia Pacific",
|
|
20
|
+
"亚太": "Asia Pacific",
|
|
21
|
+
"自动": "Automatic",
|
|
2
22
|
"清除朗读缓存后,用云端语音重听旧内容会重新合成并计费。": "After clearing the speech cache, replaying old content with cloud speech synthesizes it again and incurs a new charge.",
|
|
3
23
|
"有 {count} 处目录或文件因权限无法读取(例如沙箱创建的目录),未计入配额。深度修理也会保留这些目录;如需删除,请以管理员身份手动操作。": "{count} entries could not be read and are excluded from the quota. Deep repair leaves these directories in place. To remove them, delete them manually as an administrator.",
|
|
4
24
|
"无法核实不可读目录的大小、内容和当前使用者,已保留。": "Unreadable directories are retained because their size, contents and active users cannot be verified.",
|
|
@@ -462,7 +482,7 @@
|
|
|
462
482
|
"共议数据": "CoDiscuss data",
|
|
463
483
|
"正在统计存储占用…": "Measuring storage usage…",
|
|
464
484
|
"读取存储占用失败:{reason}": "Could not read storage usage: {reason}",
|
|
465
|
-
"本机 .codiscuss 数据已占 {used}
|
|
485
|
+
"本机 .codiscuss 数据已占 {used},接近 {limit} 上限(预警线 {warn})。请及时清理临时文件或旧草稿。": "Local .codiscuss data uses {used} and is nearing the {limit} limit (warning at {warn}). Clear temporary files or old drafts.",
|
|
466
486
|
"本机 .codiscuss 数据": "Local .codiscuss data",
|
|
467
487
|
"{used} / {limit}": "{used} / {limit}",
|
|
468
488
|
"超过 {limit} 文件上限": "File limit of {limit} exceeded",
|
|
@@ -487,14 +507,13 @@
|
|
|
487
507
|
"已清理 {count} 个临时目录": "Cleared {count} temporary folders.",
|
|
488
508
|
"存储上限通过定期采样检查(有执行时每 2 秒查磁盘余量、每 30 秒扫描占用),并非文件系统写入层硬拦截,无法保证磁盘绝不写满。": "Storage limits are enforced by periodic sampling (disk space every 2s and folder size every 30s while runs are active), not by a filesystem write-layer hard quota, so they cannot guarantee the drive will never fill.",
|
|
489
509
|
"存储占用已超过上限或磁盘剩余空间低于安全线,新的派活已暂停。房间被拦截时请在房间外的 AI 对话中运行 $codiscuss-draft-cleanup 清理旧草稿,或清理下方临时文件;房间记录与附件需手动销毁旧房间。": "New runs are paused because storage exceeded a limit or disk free space fell below the safety reserve. While a room is blocked, run $codiscuss-draft-cleanup in an AI chat outside the room to clean old drafts, or clear temporary files below; room records and attachments are reclaimed by destroying old rooms.",
|
|
490
|
-
"本机 .codiscuss 数据已占 {used}
|
|
510
|
+
"本机 .codiscuss 数据已占 {used},接近 {limit} 上限(预警线 {warn})。请在房间外的 AI 对话中运行 $codiscuss-draft-cleanup 或清理临时文件。": "Local .codiscuss data uses {used}, approaching the {limit} limit (warning at {warn}). Run $codiscuss-draft-cleanup in an AI chat outside the room or clear temporary files.",
|
|
491
511
|
"有 {count} 处目录或文件因权限无法读取(例如沙箱创建的目录),未计入配额,清理按钮也无法删除;磁盘安全线仍会保护系统盘。": "{count} folders or files could not be read due to permissions (such as sandbox-created directories). They are excluded from quotas and cannot be removed by the clean button; the disk safety reserve still protects the drive.",
|
|
492
512
|
"{count} 处不可读": "{count} unreadable",
|
|
493
513
|
"草稿合计 {draft} / {draft_limit} · 房间记录与附件 {local}(不含语音模型)": "Drafts {draft} / {draft_limit} · Room records & attachments {local} (excluding speech models)",
|
|
494
514
|
"其中可回收执行临时文件 {size};单房间上限 {room_limit}。清理历史草稿请在房间外的 AI 对话中运行 $codiscuss-draft-cleanup。": "Includes {size} of reclaimable temporary run files; per-room limit is {room_limit}. To clean older drafts, run $codiscuss-draft-cleanup in an AI chat outside the room.",
|
|
495
515
|
"单房间草稿上限 {room_limit};历史草稿和成品不会自动删除,需要清理时请在房间外的 AI 对话中运行 $codiscuss-draft-cleanup。": "Per-room draft limit is {room_limit}; older drafts and deliverables are kept. To clean them, run $codiscuss-draft-cleanup in an AI chat outside the room.",
|
|
496
516
|
"房间记录与附件(local/)": "Room records & attachments (local/)",
|
|
497
|
-
"保存房间消息、事件与附件原件,计入 10 GiB 数据上限;程序不会自动删除,如需释放空间请先导出备份再销毁旧房间。": "Stores room messages, events and original attachments, counted toward the 10 GiB data limit. Never deleted automatically—export a backup and destroy old rooms to free space.",
|
|
498
517
|
"发给该账号由共议唤醒的所有成员,不写入 CLAUDE.md、AGENTS.md": "Sent to every member CoDiscuss wakes for this account; CLAUDE.md and AGENTS.md are not written",
|
|
499
518
|
"系统提示词已保存,下次唤醒成员起生效": "System prompt saved; it applies from the next wake-up"
|
|
500
519
|
}
|
|
@@ -646,7 +646,7 @@
|
|
|
646
646
|
"{count} 个文件 · {size}": "{count} files · {size}",
|
|
647
647
|
"第 {version} 版 · {count} 个文件 · {size}": "Version {version} · {count} files · {size}",
|
|
648
648
|
"{time} 到期": "expires {time}",
|
|
649
|
-
"本机 .codiscuss 数据已占 {used}
|
|
649
|
+
"本机 .codiscuss 数据已占 {used},接近 {limit} 上限,请在房间外的 AI 对话中运行 $codiscuss-draft-cleanup 或清理临时文件。": "Local .codiscuss data uses {used}, approaching the {limit} limit. Run $codiscuss-draft-cleanup in an AI chat outside the room or clear temporary files.",
|
|
650
650
|
"固定「{value1}」": "Pinning “{value1}”",
|
|
651
651
|
"取消固定「{value1}」": "Unpinning “{value1}”"
|
|
652
652
|
}
|
|
@@ -60,6 +60,9 @@
|
|
|
60
60
|
"文件名需为 1–{value1} 字,不能包含路径或控制字符": "Filename must be 1–{value1} characters, without paths or control characters",
|
|
61
61
|
"上传附件须声明有效的 actor": "Uploading attachments requires a valid actor",
|
|
62
62
|
"附件不存在": "Attachment not found",
|
|
63
|
+
"附件不存在:{ids}": "Attachments not found: {ids}",
|
|
64
|
+
"附件已被清理": "This attachment was cleared",
|
|
65
|
+
"ids 须为非空的附件 ID 列表": "ids must be a non-empty list of attachment IDs",
|
|
63
66
|
"回答摘要最多 {value1} 字": "Reply summary is limited to {value1} characters",
|
|
64
67
|
"摘要仅用于观点,撰写者须为原作者或实际提交者": "Summaries are only for opinions; the author must be the original author or actual submitter",
|
|
65
68
|
"回复的消息不在当前房间中": "The replied-to message is not in this room",
|
|
@@ -995,6 +995,31 @@
|
|
|
995
995
|
"定位最新发言": "Jump to latest message",
|
|
996
996
|
"草稿空间": "Draft storage",
|
|
997
997
|
"本房间草稿已达 80% 以上,接近上限时将停止派活。": "This room's drafts are at or above 80%; new runs will pause if the limit is exceeded.",
|
|
998
|
+
"本房间附件 {size},存于房间记录,不计入草稿配额。": "This room's attachments take {size}. They are stored with the room records and do not count toward the draft quota.",
|
|
999
|
+
"管理附件": "Manage attachments",
|
|
1000
|
+
"房间附件": "Room attachments",
|
|
1001
|
+
"{count} 个附件 · 最近 {date}": "{count} attachments · latest {date}",
|
|
1002
|
+
"保存房间消息、事件与附件原件,计入 10 GiB 数据上限;程序不会自动删除。可在下方按房间清理附件原件,或销毁旧房间。": "Stores room messages, events and original attachments, and counts toward the 10 GiB data limit. Nothing here is deleted automatically. Clear attachment originals by room below, or destroy old rooms.",
|
|
1003
|
+
"管理本房间附件": "Manage this room's attachments",
|
|
1004
|
+
"已释放 {size}": "Freed {size}",
|
|
1005
|
+
"清理后消息仍在,附件卡片保留文件名、大小和图片缩略图并标“已清理”,原文件无法再打开或下载,成员也读不到;此操作无法撤销。": "Messages stay. Each cleared attachment keeps its name, size and image thumbnail and is marked Cleared, but the original can no longer be opened or downloaded, and members cannot read it. This cannot be undone.",
|
|
1006
|
+
"按类型筛选": "Filter by type",
|
|
1007
|
+
"按时间筛选": "Filter by age",
|
|
1008
|
+
"音视频": "Audio & video",
|
|
1009
|
+
"压缩包": "Archives",
|
|
1010
|
+
"全部时间": "Any time",
|
|
1011
|
+
"7 天前": "Older than 7 days",
|
|
1012
|
+
"30 天前": "Older than 30 days",
|
|
1013
|
+
"正在读取附件…": "Loading attachments…",
|
|
1014
|
+
"没有符合条件的附件": "No attachments match",
|
|
1015
|
+
"本房间没有可清理的附件": "This room has no attachments to clear",
|
|
1016
|
+
"全选当前 {count} 项": "Select all {count} shown",
|
|
1017
|
+
"已清理 {count} 项": "{count} cleared",
|
|
1018
|
+
"已选 {count} 项,将释放 {size}": "{count} selected, frees {size}",
|
|
1019
|
+
"确认清理(无法撤销)": "Confirm clear (cannot be undone)",
|
|
1020
|
+
"清理所选": "Clear selected",
|
|
1021
|
+
"原文件已由房主清理以释放空间": "The owner cleared the original file to free space",
|
|
1022
|
+
"已清理 · {size}": "Cleared · {size}",
|
|
998
1023
|
"清理临时文件({size})": "Clean temp files ({size})",
|
|
999
1024
|
"本房间成员草稿与临时文件占用;按周期采样检查,并非写入层硬拦截,达到 80% 时提示,超过上限将停止派活": "Draft and temporary file usage for this room; checked by periodic sampling (not a filesystem write-layer hard quota), warns at 80% and pauses new runs above the limit",
|
|
1000
1025
|
"本房间草稿已超限,派活已暂停;请在房间外的 AI 对话中运行 $codiscuss-draft-cleanup,或点击下方清理临时文件。": "This room's drafts exceeded the limit and new runs are paused. Run $codiscuss-draft-cleanup in an AI chat outside the room, or clear temporary files below.",
|
|
@@ -481,6 +481,9 @@
|
|
|
481
481
|
"重新读取目录": "Reload folder",
|
|
482
482
|
"此文件夹为空": "This folder is empty",
|
|
483
483
|
"列表视图": "List view",
|
|
484
|
+
"返回上一个位置": "Back",
|
|
485
|
+
"前进": "Forward",
|
|
486
|
+
"返回文件夹": "Back to folder",
|
|
484
487
|
"图标视图": "Icon view",
|
|
485
488
|
"{value1} 项": "{value1} items",
|
|
486
489
|
",已显示 {value1} 项": "; {value1} shown",
|
package/package.json
CHANGED
package/runner/admin_cli.mjs
CHANGED
|
@@ -52,6 +52,7 @@ export const HELP = t(`用法:codiscuss admin <命令> [参数](与管理面
|
|
|
52
52
|
site status 本地网页与线上网站的地址
|
|
53
53
|
site connect <接入码|站点> [绑定令牌] 绑定线上网站(管理员外出、邀请外部专家用);在部署该网站的电脑上只填站点即可
|
|
54
54
|
site disconnect 解绑线上网站,已配对的设备不能再连到这台电脑
|
|
55
|
+
site region [地区] 查看或设置中转地区(auto、apac、apac-ne、apac-se、wnam、enam、weur、eeur、oc、sam、afr、me)
|
|
55
56
|
site reconnect 立即重连已绑定网站的中转
|
|
56
57
|
|
|
57
58
|
登录入口与访问方式(需打开托管管理)
|
|
@@ -60,6 +61,7 @@ export const HELP = t(`用法:codiscuss admin <命令> [参数](与管理面
|
|
|
60
61
|
entry join <接入码> 用接入码接入线上站点并开启线上网站
|
|
61
62
|
entry code [--config <wrangler.jsonc>] [--site <地址>] 在部署线上站点的电脑上生成接入码(不填用上次的)
|
|
62
63
|
entry tunnel <域名> [隧道名] 设置自有域名(Cloudflare 隧道),输出授权链接;域名须已托管在 Cloudflare
|
|
64
|
+
entry tunnel reconnect 重新连接隧道,保留登录会话
|
|
63
65
|
entry tunnel status 查看自有域名设置的进度
|
|
64
66
|
runtime sync 同步隔离账号的程序副本
|
|
65
67
|
drives restrict 只允许隔离账号用系统盘:其他固定磁盘对它们的 Windows 用户拒绝访问(需管理员权限,之后重启它们的实例)
|
|
@@ -88,6 +90,7 @@ API 密钥、技能、工作流、系统提示词(目标同上)
|
|
|
88
90
|
|
|
89
91
|
结果以 JSON 输出。--data 指定管理员服务目录(默认 ~/.codiscuss)。
|
|
90
92
|
`) + t(' room-links A 查看父子房间') + '\n' + t(' storage [clean | repair [logs --confirm]] 查看用量、安全清理或深度修理日志') + '\n'
|
|
93
|
+
+ t(' storage attachments [ROOM [clear ID... --confirm]] 按房间查看附件占用、列出某房间附件或清理所选附件原件') + '\n'
|
|
91
94
|
+ t(' account add <名> --project-data-root <目录> 将新账号的项目、工作区和成员草稿放在指定目录') + '\n'
|
|
92
95
|
+ t(' account migrate-data <名> --project-data-root <目录> 停止实例并迁移项目数据') + '\n'
|
|
93
96
|
+ t(' account migration-backups <名> 查看各迁移备份的位置与字节数') + '\n'
|
|
@@ -344,6 +347,7 @@ async function entry_command(call, [action, first, second], values) {
|
|
|
344
347
|
if (action === 'open' || action === 'close') return call('entry/way', { way: need(first, 'relay|tunnel'), enabled: action === 'open' });
|
|
345
348
|
if (action === 'join') return call('relay/join', { code: need(first, t('接入码')) });
|
|
346
349
|
if (action === 'code') return call('site/code', { config: values.config || '', site: values.site || '' });
|
|
350
|
+
if (action === 'tunnel' && first === 'reconnect') return call('tunnel/reconnect', {});
|
|
347
351
|
if (action === 'tunnel') return first === 'status' ? call('tunnel/setup') : setup_tunnel(call, need(first, t('域名')), second || '');
|
|
348
352
|
throw new Error(HELP);
|
|
349
353
|
}
|
|
@@ -356,6 +360,7 @@ async function site_command(call, [action, first, second]) {
|
|
|
356
360
|
}
|
|
357
361
|
if (action === 'connect') return call('site/connect', { site: need(first, t('站点')), setup_key: second || '' });
|
|
358
362
|
if (action === 'disconnect') return call('site/disconnect', {});
|
|
363
|
+
if (action === 'region') return call('site/region', first === undefined ? undefined : { region: first });
|
|
359
364
|
if (action === 'reconnect') return call('site/reconnect', {});
|
|
360
365
|
throw new Error(HELP);
|
|
361
366
|
}
|
|
@@ -434,6 +439,12 @@ export async function admin_cli(args, { client = panel_client, print = text => p
|
|
|
434
439
|
if (rest.join(' ') === 'repair') return call('storage/repair', {});
|
|
435
440
|
if (rest.join(' ') === 'repair logs' && values.confirm) return call('storage/repair', { logs: true, confirm: true });
|
|
436
441
|
if (rest.length === 1 && rest[0] === 'clean') return call('storage/clean', {});
|
|
442
|
+
if (rest[0] === 'attachments') {
|
|
443
|
+
const [, room_id, action, ...ids] = rest;
|
|
444
|
+
if (!room_id) return call('storage').then(report => report.attachment_rooms || []);
|
|
445
|
+
if (!action) return call('storage/attachments', { room_id });
|
|
446
|
+
if (action === 'clear' && ids.length && values.confirm) return call('storage/attachments/clear', { room_id, ids });
|
|
447
|
+
}
|
|
437
448
|
throw new Error(HELP);
|
|
438
449
|
},
|
|
439
450
|
status: async () => {
|
|
@@ -4,6 +4,7 @@ import { DatabaseSync } from 'node:sqlite';
|
|
|
4
4
|
import { storage_details, clean_storage } from './admin_storage.mjs';
|
|
5
5
|
import { execution_file_protection, read_registry, sweep_service_home } from './discussion_service.mjs';
|
|
6
6
|
import { t } from './i18n.mjs';
|
|
7
|
+
import { site_fetch } from './entry_client.mjs';
|
|
7
8
|
import { with_directory_breakdown } from './storage_guard.mjs';
|
|
8
9
|
|
|
9
10
|
function local_database(home, action) {
|
|
@@ -28,9 +29,39 @@ export async function panel_storage(home, local) {
|
|
|
28
29
|
for (const room of report.rooms) if (room.site && matches_site(room.site, local)) room.title = title.get(room.room_id)?.title;
|
|
29
30
|
});
|
|
30
31
|
} catch { /* A room ID remains available when titles cannot be read. */ }
|
|
32
|
+
try {
|
|
33
|
+
local_database(home, db => {
|
|
34
|
+
// Sent files still holding their bytes, per room, largest first: what clearing attachments can free.
|
|
35
|
+
report.attachment_rooms = db.prepare(`SELECT a.room_id,r.title,COUNT(*) AS count,SUM(a.size) AS bytes,MAX(a.created_at) AS latest_at
|
|
36
|
+
FROM attachments a JOIN rooms r ON r.id=a.room_id WHERE a.message_id IS NOT NULL AND a.cleared_at IS NULL
|
|
37
|
+
GROUP BY a.room_id ORDER BY bytes DESC`).all().map(row => ({ ...row }));
|
|
38
|
+
});
|
|
39
|
+
} catch { /* An older site without cleared files has no list; the page shows none. */ }
|
|
31
40
|
return report;
|
|
32
41
|
}
|
|
33
42
|
|
|
43
|
+
const ROOM_ID = /^[A-Za-z0-9_-]{1,64}$/;
|
|
44
|
+
|
|
45
|
+
/** Ask the local site, as this computer's administrator, for one room's attachments or to clear some of them. */
|
|
46
|
+
async function room_attachments_request(local, room_id, action, body) {
|
|
47
|
+
if (typeof room_id !== 'string' || !ROOM_ID.test(room_id)) throw new Error(t('房间编号无效'));
|
|
48
|
+
const response = await site_fetch(`${local}/api/rooms/${room_id}/attachments/${action}`, body === undefined ? {}
|
|
49
|
+
: { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
|
|
50
|
+
const result = await response.json().catch(() => ({}));
|
|
51
|
+
if (!response.ok) throw new Error(result.error || t('附件请求失败(HTTP {status})', { status: response.status }));
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** One room's sent files with sizes and cleared state, for picking what to clear. */
|
|
56
|
+
export function panel_room_attachments(local, body) {
|
|
57
|
+
return room_attachments_request(local, body.room_id, 'usage');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Clear the original bytes of the chosen files of one room; records and thumbnails stay. */
|
|
61
|
+
export function panel_clear_attachments(local, body) {
|
|
62
|
+
return room_attachments_request(local, body.room_id, 'clear', { ids: body.ids });
|
|
63
|
+
}
|
|
64
|
+
|
|
34
65
|
function account_file(path, apply, result) {
|
|
35
66
|
const stat = lstatSync(path, { throwIfNoEntry: false });
|
|
36
67
|
if (!stat?.isFile() || stat.nlink !== 1) return;
|