ai_co_discuss 0.4.63 → 0.4.65
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/.agents/skills/discuss-host/SKILL.md +1 -1
- package/.agents/skills/discuss-participant/SKILL.md +1 -0
- package/README.md +1 -0
- package/README.zh-CN.md +1 -0
- package/backend/external_members.py +529 -0
- package/backend/free_room.py +72 -15
- package/backend/schema.sql +48 -2
- package/backend/server.py +41 -2
- package/docs/architecture.md +1 -0
- package/docs/en/architecture.md +1 -0
- package/docs/en/runner.md +35 -1
- package/docs/runner.md +35 -1
- package/frontend/locales/en/backend.json +38 -1
- package/frontend/locales/en/external.json +189 -0
- package/package.json +2 -2
- package/runner/adapters/api.mjs +66 -7
- package/runner/adapters/claude.mjs +35 -3
- package/runner/adapters/index.mjs +12 -4
- package/runner/adapters/profiles.mjs +28 -6
- package/runner/codiscuss.mjs +11 -2
- package/runner/device_auth.mjs +9 -5
- package/runner/discuss.py +82 -3
- package/runner/discussion_launch.mjs +12 -1
- package/runner/discussion_service.mjs +2 -0
- package/runner/expert_prompts.mjs +21 -1
- package/runner/external_client.mjs +955 -0
- package/runner/external_gateway.mjs +475 -0
- package/runner/i18n_en.mjs +108 -2
- package/runner/relay_channel.mjs +13 -0
- package/runner/remote_launch.mjs +18 -9
- package/runner/remote_policy.mjs +21 -0
- package/runner/repo_read.mjs +351 -0
- package/runner/scheduler.mjs +3 -2
- package/web/admin.js +1 -1
- package/web/backup.js +1 -1
- package/web/i18n.js +1 -1
- package/web/join.html +138 -0
- package/web/modern.css +1 -1
- package/web/modern.js +246 -53
package/backend/free_room.py
CHANGED
|
@@ -116,6 +116,8 @@ MAX_DENIALS = 20
|
|
|
116
116
|
MAX_DENIAL_FIELD = 300
|
|
117
117
|
# A manual member's delivery is retried at most this often before the execution fails.
|
|
118
118
|
MAX_RETRIES = 3
|
|
119
|
+
# Requests one external member may claim by number at once (backend/external_members.py).
|
|
120
|
+
MAX_CLAIM_REQUESTS = 100
|
|
119
121
|
MAX_RETRY_REASON = 500
|
|
120
122
|
# One interjection the owner adds to a running execution, and how many one execution keeps.
|
|
121
123
|
MAX_INTERJECTION_LENGTH = 2000
|
|
@@ -144,7 +146,7 @@ MAX_CONTINUE_REASON = 300
|
|
|
144
146
|
# A host that left gives up the role; the first active runner member (else manual) then takes it.
|
|
145
147
|
RELEASE_HOST = "UPDATE room_members SET role='member' WHERE room_id=? AND role='host' AND status<>'active'"
|
|
146
148
|
ASSIGN_HOST = """UPDATE room_members SET role='host' WHERE id=(SELECT id FROM room_members WHERE room_id=? AND status='active'
|
|
147
|
-
ORDER BY access='runner' DESC, id LIMIT 1)
|
|
149
|
+
AND access<>'external' ORDER BY access='runner' DESC, id LIMIT 1)
|
|
148
150
|
AND NOT EXISTS (SELECT 1 FROM room_members WHERE room_id=? AND role='host' AND status='active')"""
|
|
149
151
|
TERMINAL = ("completed", "cancelled", "failed")
|
|
150
152
|
# A queued member has been asked once its request for that message exists.
|
|
@@ -939,7 +941,8 @@ def recent_executions(connection, room_id, span=None):
|
|
|
939
941
|
(SELECT MAX(answer_id) FROM member_requests WHERE execution_id=e.id) AS answer_id,
|
|
940
942
|
(SELECT MIN(message_id) FROM member_requests WHERE execution_id=e.id
|
|
941
943
|
OR id IN (SELECT request_id FROM retried_requests WHERE execution_id=e.id)) AS request_message_id,
|
|
942
|
-
|
|
944
|
+
-- Work on several requests started after the latest of them, so its card shows under the last message it answers.
|
|
945
|
+
(SELECT MAX({LAYOUT_AFTER_SQL}) FROM member_requests r WHERE r.execution_id=e.id
|
|
943
946
|
OR r.id IN (SELECT request_id FROM retried_requests WHERE execution_id=e.id)) AS layout_after,
|
|
944
947
|
EXISTS(SELECT 1 FROM retried_requests WHERE execution_id=e.id) AS retried,
|
|
945
948
|
(SELECT MIN({LAYOUT_AT_SQL}) FROM member_requests r WHERE r.execution_id=e.id) AS layout_at,
|
|
@@ -1073,6 +1076,8 @@ def free_view(connection, room_id):
|
|
|
1073
1076
|
(row["id"],)).fetchone()[0]
|
|
1074
1077
|
member["held_until"] = held_until(connection, row["id"])
|
|
1075
1078
|
member["quota_until"] = quota_held_until(connection, row["id"])
|
|
1079
|
+
if row["access"] == "external":
|
|
1080
|
+
member["external"] = external_members.room_view_field(connection, row["id"])
|
|
1076
1081
|
members.append(member)
|
|
1077
1082
|
names = {row["id"]: row["name"] for row in connection.execute("SELECT id,name FROM room_members WHERE room_id=?", (room_id,))}
|
|
1078
1083
|
requests = [{**dict(row), "member": names.get(row["member_id"], ""),
|
|
@@ -1080,6 +1085,7 @@ def free_view(connection, room_id):
|
|
|
1080
1085
|
} for row in connection.execute(
|
|
1081
1086
|
"""SELECT id,member_id,message_id,status,execution_id,answer_id,chain_id,batch_id,purpose,created_by,created_at,
|
|
1082
1087
|
(SELECT reason FROM request_cancel_reasons c WHERE c.request_id=member_requests.id) AS cancel_reason,
|
|
1088
|
+
(SELECT outcome FROM external_declines x WHERE x.request_id=member_requests.id) AS external_outcome,
|
|
1083
1089
|
(SELECT after_message_id FROM request_layout l WHERE l.request_id=member_requests.id) AS layout_after FROM member_requests
|
|
1084
1090
|
WHERE room_id=? ORDER BY id DESC LIMIT ?""", (room_id, RECENT_REQUESTS))]
|
|
1085
1091
|
chains = [dict(row) for row in connection.execute(
|
|
@@ -2664,6 +2670,10 @@ def stop_member_work(connection, member_id, reason, cancel_reason, keep_pending=
|
|
|
2664
2670
|
"""
|
|
2665
2671
|
for row in connection.execute("SELECT id FROM member_executions WHERE member_id=? AND status IN ('dispatched','started')",
|
|
2666
2672
|
(member_id,)).fetchall():
|
|
2673
|
+
# The interrupted turn's card stays under the message it was answering, marked stopped, after its requests move on.
|
|
2674
|
+
if requeue:
|
|
2675
|
+
connection.execute("INSERT OR IGNORE INTO retried_requests (execution_id,request_id) SELECT ?,id FROM member_requests WHERE execution_id=?",
|
|
2676
|
+
(row["id"], row["id"]))
|
|
2667
2677
|
finish_execution(connection, row["id"], "cancelled", reason, "pending" if requeue else "cancelled", "" if requeue else cancel_reason)
|
|
2668
2678
|
if not keep_pending:
|
|
2669
2679
|
record_cancel_reasons(connection, "member_id=? AND status='pending'", (member_id,), cancel_reason)
|
|
@@ -2801,6 +2811,7 @@ def inbox(connection, room_id, token):
|
|
|
2801
2811
|
require_owner(connection, room_id, token)
|
|
2802
2812
|
begin_write(connection)
|
|
2803
2813
|
enforce_session_limits(connection, room_id)
|
|
2814
|
+
external_members.expire_room(connection, room_id)
|
|
2804
2815
|
expire_executions(connection, room_id)
|
|
2805
2816
|
notice_stalled_executions(connection, room_id)
|
|
2806
2817
|
fire_host_checkin(connection, room_id)
|
|
@@ -2810,13 +2821,6 @@ def inbox(connection, room_id, token):
|
|
|
2810
2821
|
shown = member_display_names(connection, room_id)
|
|
2811
2822
|
# Manual members are never delivered to; the runner only reads them so smart scheduling can route to them too.
|
|
2812
2823
|
for row in connection.execute(f"SELECT * FROM room_members WHERE room_id=? AND status='active' AND {REGISTERED_MEMBER} ORDER BY id", (room_id,)):
|
|
2813
|
-
pending = [dict(item) for item in connection.execute("""SELECT r.id,r.message_id,r.purpose,r.batch_id,
|
|
2814
|
-
sr.id AS session_request_id,sr.session_id,sr.round,sr.position,sr.read_until,sr.question AS source_question,
|
|
2815
|
-
t.cause_kind,t.cause_message_id AS source_message_id,t.cause_request_id,
|
|
2816
|
-
(SELECT action FROM group_routes WHERE message_id=r.message_id) AS group_action
|
|
2817
|
-
FROM member_requests r LEFT JOIN session_requests sr ON sr.member_request_id=r.id
|
|
2818
|
-
LEFT JOIN task_message_sources t ON t.session_request_id=sr.id
|
|
2819
|
-
WHERE r.member_id=? AND r.status='pending' ORDER BY r.id""", (row["id"],))]
|
|
2820
2824
|
member_view = {key: row[key] for key in MEMBER_FIELDS}
|
|
2821
2825
|
member_view["label"] = shown.get(row["name"], row["name"])
|
|
2822
2826
|
member_view["review_capability"] = review_capability(connection, room_id, row["id"], token)
|
|
@@ -2828,8 +2832,7 @@ def inbox(connection, room_id, token):
|
|
|
2828
2832
|
# Private chat lines the runner still has to run in this member's session (backend/private_chat.py).
|
|
2829
2833
|
member_view["chats"] = [dict(item) for item in connection.execute(
|
|
2830
2834
|
"SELECT id,text,status FROM private_chats WHERE member_id=? AND status IN ('pending','running') ORDER BY id", (row["id"],))]
|
|
2831
|
-
pending =
|
|
2832
|
-
**questions.request_context(connection, request)} for request in pending]
|
|
2835
|
+
pending = pending_requests(connection, row["id"])
|
|
2833
2836
|
(members if row["access"] == "runner" else observers).append({**member_view, "pending": pending})
|
|
2834
2837
|
# Pending interjections ride along so the runner hands them to the running software at its next check.
|
|
2835
2838
|
# `continues`: the answered execution whose software turn this one carries on (keep_working); the runner moves it over.
|
|
@@ -2846,6 +2849,19 @@ def inbox(connection, room_id, token):
|
|
|
2846
2849
|
return {"room_id": room_id, "archived": bool(archived), "members": members, "observers": observers, "executions": executions}
|
|
2847
2850
|
|
|
2848
2851
|
|
|
2852
|
+
def pending_requests(connection, member_id):
|
|
2853
|
+
"""A member's pending requests with the context its software needs: discussion turn, review, relay, hand-back, question."""
|
|
2854
|
+
pending = [dict(item) for item in connection.execute("""SELECT r.id,r.message_id,r.purpose,r.batch_id,
|
|
2855
|
+
sr.id AS session_request_id,sr.session_id,sr.round,sr.position,sr.read_until,sr.question AS source_question,
|
|
2856
|
+
t.cause_kind,t.cause_message_id AS source_message_id,t.cause_request_id,
|
|
2857
|
+
(SELECT action FROM group_routes WHERE message_id=r.message_id) AS group_action
|
|
2858
|
+
FROM member_requests r LEFT JOIN session_requests sr ON sr.member_request_id=r.id
|
|
2859
|
+
LEFT JOIN task_message_sources t ON t.session_request_id=sr.id
|
|
2860
|
+
WHERE r.member_id=? AND r.status='pending' ORDER BY r.id""", (member_id,))]
|
|
2861
|
+
return [{**request, **review_request_context(connection, request), **sequence_request_context(connection, request), **handoff_outcome(connection, request),
|
|
2862
|
+
**questions.request_context(connection, request)} for request in pending]
|
|
2863
|
+
|
|
2864
|
+
|
|
2849
2865
|
def host_route_request(connection, message_id):
|
|
2850
2866
|
"""The host's request for one unnamed owner message, if the message was routed."""
|
|
2851
2867
|
return connection.execute("SELECT * FROM member_requests WHERE message_id=? AND purpose='route'", (message_id,)).fetchone()
|
|
@@ -3063,6 +3079,33 @@ def reserve_execution(connection, room_id, token, payload):
|
|
|
3063
3079
|
(room_id, payload.get("member_id"))).fetchone()
|
|
3064
3080
|
if not member:
|
|
3065
3081
|
raise LookupError(Text("成员不存在、已离开或为手动接入"))
|
|
3082
|
+
return open_execution(connection, room_id, member, payload)
|
|
3083
|
+
|
|
3084
|
+
|
|
3085
|
+
def claim_execution(connection, room_id, member, payload):
|
|
3086
|
+
"""An external member claims its own open requests as one execution; a retried client_id returns the same one."""
|
|
3087
|
+
begin_write(connection)
|
|
3088
|
+
client_id = str(payload.get("client_id", ""))
|
|
3089
|
+
if not 8 <= len(client_id) <= 100:
|
|
3090
|
+
raise ValueError(Text("client_id 须为 8–100 字符的本地投递编号"))
|
|
3091
|
+
previous = connection.execute("SELECT * FROM member_executions WHERE room_id=? AND client_id=?", (room_id, client_id)).fetchone()
|
|
3092
|
+
if previous:
|
|
3093
|
+
if previous["member_id"] != member["id"]:
|
|
3094
|
+
raise FileExistsError(Text("client_id 已被使用"))
|
|
3095
|
+
return execution_detail(connection, previous)
|
|
3096
|
+
request_ids = payload.get("request_ids")
|
|
3097
|
+
if request_ids is not None and (not isinstance(request_ids, list) or not 0 < len(request_ids) <= MAX_CLAIM_REQUESTS
|
|
3098
|
+
or any(type(item) is not int for item in request_ids) or len(set(request_ids)) != len(request_ids)):
|
|
3099
|
+
raise ValueError(Text("request_ids 须为 1–{limit} 个不重复的请求编号", limit=MAX_CLAIM_REQUESTS))
|
|
3100
|
+
expire_executions(connection, room_id)
|
|
3101
|
+
if connection.execute("SELECT archived FROM room_directory WHERE room_id=?", (room_id,)).fetchone()[0]:
|
|
3102
|
+
raise FileExistsError(Text("房间已存档,不再投递"))
|
|
3103
|
+
return open_execution(connection, room_id, member, payload, request_ids)
|
|
3104
|
+
|
|
3105
|
+
|
|
3106
|
+
def open_execution(connection, room_id, member, payload, request_ids=None):
|
|
3107
|
+
"""Open one execution over a checked member's pending requests, or only over `request_ids` among them."""
|
|
3108
|
+
client_id = str(payload.get("client_id", ""))
|
|
3066
3109
|
if connection.execute("SELECT 1 FROM member_executions WHERE member_id=? AND status IN ('dispatched','started')",
|
|
3067
3110
|
(member["id"],)).fetchone():
|
|
3068
3111
|
raise FileExistsError(Text("该成员已有进行中的执行;同一会话不并发续接"))
|
|
@@ -3073,6 +3116,12 @@ def reserve_execution(connection, room_id, token, payload):
|
|
|
3073
3116
|
# A group request waits for the runner to choose how everyone answers; it is never delivered itself.
|
|
3074
3117
|
pending = connection.execute("""SELECT id,purpose,EXISTS(SELECT 1 FROM review_plans WHERE review_batch_id=member_requests.message_id AND reviewer_id=member_requests.member_id) AS review FROM member_requests
|
|
3075
3118
|
WHERE member_id=? AND status='pending' AND purpose<>'group' ORDER BY id""", (member["id"],)).fetchall()
|
|
3119
|
+
if request_ids is not None:
|
|
3120
|
+
# An external member's computer agreed to these requests only; the others stay pending for its owner to decide.
|
|
3121
|
+
missing = sorted(set(request_ids) - {row["id"] for row in pending})
|
|
3122
|
+
if missing:
|
|
3123
|
+
raise FileExistsError(Text("请求 {request_id} 不属于本成员或已处理", request_id=missing[0]))
|
|
3124
|
+
pending = [row for row in pending if row["id"] in request_ids]
|
|
3076
3125
|
session_purpose = next((row["purpose"] for row in pending if row["purpose"] == "discuss"), None)
|
|
3077
3126
|
if not pending:
|
|
3078
3127
|
raise FileExistsError(Text("该成员没有待投递的请求"))
|
|
@@ -3084,6 +3133,9 @@ def reserve_execution(connection, room_id, token, payload):
|
|
|
3084
3133
|
else:
|
|
3085
3134
|
request_filter = "purpose<>'group' AND NOT EXISTS(SELECT 1 FROM review_plans WHERE review_batch_id=member_requests.message_id AND reviewer_id=member_requests.member_id)"
|
|
3086
3135
|
request_values = ()
|
|
3136
|
+
if request_ids is not None:
|
|
3137
|
+
request_filter += f" AND id IN ({','.join('?' * len(request_ids))})"
|
|
3138
|
+
request_values = (*request_values, *request_ids)
|
|
3087
3139
|
now = int(time.time())
|
|
3088
3140
|
cursor = connection.execute("""INSERT INTO member_executions (room_id,member_id,client_id,lease_until,created_at,cwd)
|
|
3089
3141
|
VALUES (?,?,?,?,?,?)""", (room_id, member["id"], client_id, now + LEASE_SECONDS, now, str(payload.get("cwd") or "")[:MAX_PATH_LENGTH]))
|
|
@@ -3303,13 +3355,15 @@ def execution_interjections(connection, execution_id, execution_status):
|
|
|
3303
3355
|
return items
|
|
3304
3356
|
|
|
3305
3357
|
|
|
3306
|
-
def execution_action(connection, room_id, execution_id, token, payload):
|
|
3358
|
+
def execution_action(connection, room_id, execution_id, token, payload, member=None):
|
|
3307
3359
|
"""Runner-side lifecycle: renew, fail, release undelivered work, report how the software was reached, whether a voided one stopped, or observed file changes."""
|
|
3308
3360
|
begin_write(connection)
|
|
3309
3361
|
action = payload.get("action")
|
|
3310
3362
|
duplicate = False
|
|
3311
|
-
member
|
|
3312
|
-
|
|
3363
|
+
if member:
|
|
3364
|
+
# An external member already authenticated by backend/external_members.py, acting on its own execution.
|
|
3365
|
+
pass
|
|
3366
|
+
elif action == "fail":
|
|
3313
3367
|
try:
|
|
3314
3368
|
require_owner(connection, room_id, token)
|
|
3315
3369
|
except PermissionError:
|
|
@@ -3322,7 +3376,7 @@ def execution_action(connection, room_id, execution_id, token, payload):
|
|
|
3322
3376
|
if not row:
|
|
3323
3377
|
raise LookupError(Text("执行不存在"))
|
|
3324
3378
|
if member and member["id"] != row["member_id"]:
|
|
3325
|
-
raise PermissionError(Text("只能报告自己执行的失败"))
|
|
3379
|
+
raise PermissionError(Text("只能报告自己执行的失败") if action == "fail" else Text("执行编号不属于本成员"))
|
|
3326
3380
|
now = int(time.time())
|
|
3327
3381
|
if action == "report":
|
|
3328
3382
|
# Observed after the process ends, so the execution may already be complete; recorded once.
|
|
@@ -3857,6 +3911,8 @@ def member_action(connection, room_id, member_id, token, payload):
|
|
|
3857
3911
|
"""
|
|
3858
3912
|
member = owned_member(connection, room_id, member_id, token)
|
|
3859
3913
|
action = payload.get("action")
|
|
3914
|
+
if member["access"] == "external" and action in ("role", "active", "adopt"):
|
|
3915
|
+
raise ValueError(Text("外部成员不能担任主持人或被请回;需要时重新邀请"))
|
|
3860
3916
|
routed = []
|
|
3861
3917
|
if action in ("away", "remove"):
|
|
3862
3918
|
if member["role"] == "host":
|
|
@@ -3918,3 +3974,4 @@ def member_action(connection, room_id, member_id, token, payload):
|
|
|
3918
3974
|
# Imported last: session_room imports helpers from this module, so both load in either order.
|
|
3919
3975
|
from . import session_room as discussion # noqa: E402
|
|
3920
3976
|
from . import questions # noqa: E402
|
|
3977
|
+
from . import external_members # noqa: E402
|
package/backend/schema.sql
CHANGED
|
@@ -350,8 +350,8 @@ CREATE TABLE IF NOT EXISTS execution_failures (
|
|
|
350
350
|
failed_at INTEGER NOT NULL,
|
|
351
351
|
reset_at INTEGER NOT NULL DEFAULT 0
|
|
352
352
|
);
|
|
353
|
-
-- The requests
|
|
354
|
-
-- message
|
|
353
|
+
-- The requests an execution carried before they moved to another: a failed one the owner retried, or a turn the owner
|
|
354
|
+
-- interrupted by sending a message at once. Its card keeps its place under their message. Not part of backups.
|
|
355
355
|
CREATE TABLE IF NOT EXISTS retried_requests (
|
|
356
356
|
execution_id INTEGER NOT NULL REFERENCES member_executions(id) ON DELETE CASCADE,
|
|
357
357
|
request_id INTEGER NOT NULL REFERENCES member_requests(id) ON DELETE CASCADE,
|
|
@@ -548,6 +548,52 @@ CREATE TABLE IF NOT EXISTS request_cancel_reasons (
|
|
|
548
548
|
request_id INTEGER PRIMARY KEY REFERENCES member_requests(id) ON DELETE CASCADE,
|
|
549
549
|
reason TEXT NOT NULL CHECK(reason IN ('user_stop','member_away','member_removed','rerouted','no_reply','archived'))
|
|
550
550
|
);
|
|
551
|
+
-- External members (backend/external_members.py): a room_members row with access='external' runs on another computer and
|
|
552
|
+
-- reaches this room only through the runner's gateway. Its grant, expiry and quota live here; `token_hash` repeats the
|
|
553
|
+
-- member's credential hash so every route can refuse that credential outside the member-scope routes. Ended members stay.
|
|
554
|
+
CREATE TABLE IF NOT EXISTS external_members (
|
|
555
|
+
member_id INTEGER PRIMARY KEY REFERENCES room_members(id) ON DELETE CASCADE,
|
|
556
|
+
room_id TEXT NOT NULL REFERENCES rooms(id) ON DELETE CASCADE,
|
|
557
|
+
token_hash TEXT NOT NULL,
|
|
558
|
+
machine TEXT NOT NULL,
|
|
559
|
+
machine_label TEXT NOT NULL DEFAULT '',
|
|
560
|
+
scope TEXT NOT NULL CHECK(scope IN ('discuss','read')),
|
|
561
|
+
directories TEXT NOT NULL DEFAULT '[]',
|
|
562
|
+
expires_at INTEGER NOT NULL,
|
|
563
|
+
hourly_bytes INTEGER NOT NULL,
|
|
564
|
+
total_bytes INTEGER NOT NULL,
|
|
565
|
+
hourly_reads INTEGER NOT NULL,
|
|
566
|
+
created_at INTEGER NOT NULL,
|
|
567
|
+
updated_at INTEGER NOT NULL,
|
|
568
|
+
ended_at INTEGER NOT NULL DEFAULT 0,
|
|
569
|
+
end_reason TEXT NOT NULL DEFAULT '' CHECK(end_reason IN ('','revoked','expired','left'))
|
|
570
|
+
);
|
|
571
|
+
CREATE INDEX IF NOT EXISTS external_member_credential ON external_members(token_hash);
|
|
572
|
+
-- Every read an external member asked for, allowed or not; quota counts come from here, so they survive restarts.
|
|
573
|
+
-- `at` is epoch milliseconds; `directory` is the opened directory's path at the time, shown to the owner only.
|
|
574
|
+
CREATE TABLE IF NOT EXISTS external_reads (
|
|
575
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
576
|
+
member_id INTEGER NOT NULL REFERENCES room_members(id) ON DELETE CASCADE,
|
|
577
|
+
room_id TEXT NOT NULL REFERENCES rooms(id) ON DELETE CASCADE,
|
|
578
|
+
at INTEGER NOT NULL,
|
|
579
|
+
op TEXT NOT NULL CHECK(op IN ('ls','read','grep')),
|
|
580
|
+
root INTEGER NOT NULL,
|
|
581
|
+
directory TEXT NOT NULL,
|
|
582
|
+
path TEXT NOT NULL,
|
|
583
|
+
bytes INTEGER NOT NULL,
|
|
584
|
+
allowed INTEGER NOT NULL,
|
|
585
|
+
code TEXT NOT NULL,
|
|
586
|
+
reason TEXT NOT NULL DEFAULT ''
|
|
587
|
+
);
|
|
588
|
+
CREATE INDEX IF NOT EXISTS external_reads_member ON external_reads(member_id,at);
|
|
589
|
+
-- A request the external member's computer declined or let time out; it is cancelled with reason 'no_reply' and the
|
|
590
|
+
-- page shows it as not agreed to.
|
|
591
|
+
CREATE TABLE IF NOT EXISTS external_declines (
|
|
592
|
+
request_id INTEGER PRIMARY KEY REFERENCES member_requests(id) ON DELETE CASCADE,
|
|
593
|
+
member_id INTEGER NOT NULL REFERENCES room_members(id) ON DELETE CASCADE,
|
|
594
|
+
outcome TEXT NOT NULL CHECK(outcome IN ('declined','timeout')),
|
|
595
|
+
at INTEGER NOT NULL
|
|
596
|
+
);
|
|
551
597
|
-- Messages the owner took back: a retracted one no member began to handle, or the history a rewind returned to before.
|
|
552
598
|
-- AI readers no longer see them; the page keeps each in place. No room column, so it never clashes with messages.room_id in joins.
|
|
553
599
|
CREATE TABLE IF NOT EXISTS message_withdrawals (
|
package/backend/server.py
CHANGED
|
@@ -38,6 +38,7 @@ from .free_room import (add_member, after_free_message, after_proactive, authori
|
|
|
38
38
|
from .free_room import convert_suggestion, message_suggestions, save_suggestions, sync_participants
|
|
39
39
|
from .free_room import adopt_recommendation, recommend_member, register_member, require_member
|
|
40
40
|
from .private_chat import chat_action, member_chat
|
|
41
|
+
from .external_members import external_api, guard_route as guard_external_route, is_external_path, owner_api as external_owner_api
|
|
41
42
|
from .free_room import describe_members, execution_notes, label_members, set_host_checkin, withdraw_dispatch, member_descriptions, member_display_names, member_handles, member_labels, reorder_speakers, resolve_member_fields, set_chain_rounds, speaking_order, stop_room, stop_room_work
|
|
42
43
|
from .free_room import (ADAPTER_VALUE, LAYOUT_AFTER_SQL, LAYOUT_AT_SQL, continue_chain, execution_timeline, group_route_plan, retract_message, rewind_plan, rewind_room,
|
|
43
44
|
room_event_log, withdrawals)
|
|
@@ -75,6 +76,10 @@ LOCAL_LAUNCH_TIMEOUT = 60
|
|
|
75
76
|
MACHINE_COMMAND_POLL_SECONDS = 0.5
|
|
76
77
|
# Ordering and filing a channel only rearrange the shared directory, like folder edits, so they need no room credential.
|
|
77
78
|
DIRECTORY_OPERATIONS = ("move", "folder")
|
|
79
|
+
# Local entry commands for external members: the owner's invites (room credential) and this computer's invited records.
|
|
80
|
+
INVITE_COMMANDS = ("room-invite", "room-invites", "room-invite-revoke")
|
|
81
|
+
INVITED_COMMANDS = ("invited-list", "invited-join", "invited-trust", "invited-ai", "invited-pause", "invited-approve", "invited-refuse",
|
|
82
|
+
"invited-leave", "invited-room")
|
|
78
83
|
ADMIN_OPERATIONS = ("rename", "archive", "restore", "delete")
|
|
79
84
|
DIRECTORY_PICKER_TIMEOUT = 600 # the folder dialog waits for the person at the computer
|
|
80
85
|
# Files are streamed to players in pieces of this size.
|
|
@@ -208,7 +213,7 @@ LEFT JOIN message_withdrawals AS withdrawn ON withdrawn.message_id=messages.id
|
|
|
208
213
|
LEFT JOIN message_summaries AS summaries ON summaries.message_id=messages.id
|
|
209
214
|
LEFT JOIN message_timings AS timing ON timing.message_id=messages.id
|
|
210
215
|
LEFT JOIN (SELECT r.answer_id, MIN(r.execution_id) AS execution_id, MIN(r.message_id) AS request_message_id,
|
|
211
|
-
|
|
216
|
+
MAX(""" + LAYOUT_AFTER_SQL + """) AS layout_after, MIN(""" + LAYOUT_AT_SQL + """) AS layout_at
|
|
212
217
|
FROM member_requests r WHERE r.answer_id IS NOT NULL AND r.execution_id IS NOT NULL GROUP BY r.answer_id) AS answered
|
|
213
218
|
ON answered.answer_id=messages.id"""
|
|
214
219
|
# Messages the owner took back leave AI reads; the page asks for them with withdrawn=include to keep them in place.
|
|
@@ -2475,6 +2480,13 @@ class DiscussionHandler(BaseHTTPRequestHandler):
|
|
|
2475
2480
|
try:
|
|
2476
2481
|
if self.entry_refused(method, parsed):
|
|
2477
2482
|
return None
|
|
2483
|
+
try:
|
|
2484
|
+
guard_external_route(lambda: connect_db(self.server.database), self.headers, parts)
|
|
2485
|
+
except PermissionError:
|
|
2486
|
+
# Read the unread body first, or the refusal can reach the gateway as a reset connection.
|
|
2487
|
+
self.rfile.read(min(int(self.headers.get("Content-Length") or 0), MAX_BODY_BYTES))
|
|
2488
|
+
self.close_connection = True
|
|
2489
|
+
raise
|
|
2478
2490
|
self.bridged = self.relay_bridge(parts)
|
|
2479
2491
|
if parts[:3] == ["api", "local", "media"] and len(parts) == 4 and method == "GET":
|
|
2480
2492
|
return self.serve_media_ticket(parts[3])
|
|
@@ -2488,6 +2500,8 @@ class DiscussionHandler(BaseHTTPRequestHandler):
|
|
|
2488
2500
|
if method == "GET" and parsed.path == "/robots.txt":
|
|
2489
2501
|
return self.respond("User-agent: *\nAllow: /\n", content_type="text/plain")
|
|
2490
2502
|
with closing(connect_db(self.server.database)) as connection, connection:
|
|
2503
|
+
if is_external_path(parts):
|
|
2504
|
+
return self.handle_external_api(connection, parts, params, method)
|
|
2491
2505
|
if text_mode and method == "GET":
|
|
2492
2506
|
return self.handle_text(connection, parts, params)
|
|
2493
2507
|
return self.handle_api(connection, parts, params, method)
|
|
@@ -2609,7 +2623,7 @@ class DiscussionHandler(BaseHTTPRequestHandler):
|
|
|
2609
2623
|
site = self.local_request_site(method)
|
|
2610
2624
|
route = parts[2:]
|
|
2611
2625
|
if method == "OPTIONS" and route in (["settings"], ["launch"], ["room-models"], ["room-skills"], ["room-files"], ["room-page"], ["room-media"], ["execution-details"], ["room-member"], ["room-member-access"], ["room-member-allow"], ["room-member-adapter"], ["room-member-model"], ["room-profiles"], ["room-restore"], ["room-fork"], ["models"], ["sessions"], ["api-key"], ["api-check"],
|
|
2612
|
-
["scheduler-check"], ["image-settings"], ["tts-settings"], ["tts"], ["tts-release"], ["local-speech"], ["stt"], ["weixin"], ["pick-directory"], ["browse-directory"], ["projects"], ["presets"], ["workflows"], ["room-workflow"], ["room-settings"], ["machine-link"], ["device-pairing"], ["devices"]):
|
|
2626
|
+
["scheduler-check"], ["image-settings"], ["tts-settings"], ["tts"], ["tts-release"], ["local-speech"], ["stt"], ["weixin"], ["pick-directory"], ["browse-directory"], ["projects"], ["presets"], ["workflows"], ["room-workflow"], ["room-settings"], ["machine-link"], ["device-pairing"], ["devices"]) or (method == "OPTIONS" and len(route) == 1 and route[0] in INVITE_COMMANDS + INVITED_COMMANDS):
|
|
2613
2627
|
return self.respond({"ok": True})
|
|
2614
2628
|
if route == ["settings"] and method in ("GET", "POST"):
|
|
2615
2629
|
command = "settings"
|
|
@@ -2652,6 +2666,10 @@ class DiscussionHandler(BaseHTTPRequestHandler):
|
|
|
2652
2666
|
command = route[0]
|
|
2653
2667
|
elif route == ["machine-link"] and method == "POST":
|
|
2654
2668
|
command = "machine-link"
|
|
2669
|
+
elif len(route) == 1 and route[0] in INVITE_COMMANDS + INVITED_COMMANDS and method == "POST":
|
|
2670
|
+
# Invites for members on other computers (runner/external_gateway.mjs) and the rooms this computer was invited to
|
|
2671
|
+
# (runner/external_client.mjs); the latter are this computer's own records and need no room credential.
|
|
2672
|
+
command = route[0]
|
|
2655
2673
|
else:
|
|
2656
2674
|
raise LookupError(Text('本机入口不存在'))
|
|
2657
2675
|
payload = None
|
|
@@ -2667,6 +2685,10 @@ class DiscussionHandler(BaseHTTPRequestHandler):
|
|
|
2667
2685
|
self.admin_as_owner(connection, payload.get("room_id", ""))
|
|
2668
2686
|
payload["token"] = self.headers.get("X-Discussion-Token", "")
|
|
2669
2687
|
# A fork from a browser without the source room's credential acts as its owner, as the commands above do.
|
|
2688
|
+
if command in INVITE_COMMANDS and not payload.get("token") and not self.bridge_origin:
|
|
2689
|
+
with closing(connect_db(self.server.database)) as connection:
|
|
2690
|
+
self.admin_as_owner(connection, payload.get("room_id", ""))
|
|
2691
|
+
payload["token"] = self.headers.get("X-Discussion-Token", "")
|
|
2670
2692
|
if command == "room-fork" and not payload.get("source_token") and not self.bridge_origin:
|
|
2671
2693
|
with closing(connect_db(self.server.database)) as connection:
|
|
2672
2694
|
self.admin_as_owner(connection, payload.get("source_room_id", ""))
|
|
@@ -2986,6 +3008,10 @@ class DiscussionHandler(BaseHTTPRequestHandler):
|
|
|
2986
3008
|
record_reported_session(connection, room_id, token, {"session_id": self.headers.get("X-Discussion-Session"),
|
|
2987
3009
|
"session_client": self.headers.get("X-Discussion-Session-Client")})
|
|
2988
3010
|
connection.commit()
|
|
3011
|
+
if parts[3:4] == ["external-members"]:
|
|
3012
|
+
result, status = external_owner_api(connection, room_id, parts[4:], params, method, token, self.read_payload)
|
|
3013
|
+
connection.commit()
|
|
3014
|
+
return self.respond(result, status)
|
|
2989
3015
|
if parts[3:] == ["discussion"]:
|
|
2990
3016
|
if method == "GET":
|
|
2991
3017
|
return self.respond(session_room(connection, room_id))
|
|
@@ -3364,6 +3390,19 @@ class DiscussionHandler(BaseHTTPRequestHandler):
|
|
|
3364
3390
|
raise LookupError(Text('地址不存在'))
|
|
3365
3391
|
return result
|
|
3366
3392
|
|
|
3393
|
+
def handle_external_api(self, connection, parts, params, method):
|
|
3394
|
+
"""Member-scope routes for an external member (backend/external_members.py); its only way into the room."""
|
|
3395
|
+
def answer(connection, room_id, payload, member):
|
|
3396
|
+
result = append_message(connection, room_id, payload, member)
|
|
3397
|
+
receipt = message_receipt(connection, room_id, result)
|
|
3398
|
+
return {**result, "receipt": receipt} if receipt else result
|
|
3399
|
+
hooks = {"messages": query_messages, "message": get_message, "answer": answer}
|
|
3400
|
+
result, status = external_api(connection, parts, params, method, self.headers.get("X-Discussion-Token", ""),
|
|
3401
|
+
self.read_payload, hooks)
|
|
3402
|
+
drain_room_queue(connection, parts[3])
|
|
3403
|
+
connection.commit()
|
|
3404
|
+
return self.respond(result, status)
|
|
3405
|
+
|
|
3367
3406
|
def handle_free_api(self, connection, parts, method):
|
|
3368
3407
|
"""Runner inbox, per-member executions and the owner's interrupt for free rooms."""
|
|
3369
3408
|
room_id = parts[2]
|
package/docs/architecture.md
CHANGED
|
@@ -49,6 +49,7 @@ AI 平台(Codex、Claude、Antigravity(界面显示为 Gemini)、DeepSeek
|
|
|
49
49
|
- CLI 通过纯文本页面 `/r/ROOM_ID` 按需读取,不一次性加载全部历史。
|
|
50
50
|
- 网站目前没有按用户隔离房间数据。独立观点阶段会临时限制匿名及普通成员读取后续观点,并要求完整导出使用房主或主持凭据;这不是整站访问控制,详见 [安全说明](../.github/SECURITY.md)。
|
|
51
51
|
- 本机路径、软件配置、会话绑定与 API 密钥只保存在本机服务目录。
|
|
52
|
+
- 外部成员(另一台电脑上的 AI)有自己的成员凭证和密钥,每条请求都带签名、经中转端到端加密;房间后端只允许它读本房间、领取点名给它的请求、提交自己的回答,读项目由本机服务的只读引擎按开放目录与固定排除执行,每次读取先记录再返回。见 [外部成员](runner.md#外部成员借用另一台电脑上的-ai)。
|
|
52
53
|
|
|
53
54
|
## 技术栈
|
|
54
55
|
|
package/docs/en/architecture.md
CHANGED
|
@@ -47,6 +47,7 @@ An AI platform (Codex, Claude, Antigravity (shown as Gemini), DeepSeek, Qwen, Gr
|
|
|
47
47
|
- The CLI reads through plain-text pages under `/r/ROOM_ID`, on demand rather than loading the full history.
|
|
48
48
|
- Room data is not isolated by user. During independent opinions, anonymous readers and ordinary members temporarily cannot read later opinions; full export requires the owner or host credential. This is not site-wide access control. See the [security policy](../../.github/SECURITY.md).
|
|
49
49
|
- Local paths, tool configuration, session bindings and API keys stay in the local service directory.
|
|
50
|
+
- An external member (an AI on another computer) has its own member credential and key; every request is signed and end-to-end encrypted through the relay. The room backend lets it only read its room, claim requests addressed to it and post its own answers; project reads go through the local service's read-only engine, limited to the opened folders minus fixed exclusions, and each read is recorded before anything is returned. See [External members](runner.md#external-members-borrowing-an-ai-from-another-computer).
|
|
50
51
|
|
|
51
52
|
## Tech Stack
|
|
52
53
|
|
package/docs/en/runner.md
CHANGED
|
@@ -75,11 +75,45 @@ It binds this computer to the site with a one-time token: generated automaticall
|
|
|
75
75
|
|
|
76
76
|
**Pairing** — each phone, tablet or other computer pairs once, in front of this computer; no account or password. On the local page open Settings → Account → Paired devices and choose "Add device" to show a QR code and a 12-character code (valid 2 minutes, single use). Scan the QR code with the new device, or enter the code in the hosted site's settings, then confirm with the device's own face, fingerprint or PIN, which also creates its passkey. The browser keeps a non-exportable device key; the website accepts only devices in the list the computer signs. Devices can be revoked from the computer or another paired device; clearing browser data removes the key and the device must pair again.
|
|
77
77
|
|
|
78
|
-
Once paired, the "协作房间" directory lists the rooms on the computer, the same as on the computer itself: send messages and attachments, manage members, export backups, with live updates. Conversations stay on the computer; the website only passes encrypted content. Project paths and keys never leave the computer.
|
|
78
|
+
Once paired, the "协作房间" directory lists the rooms on the computer, the same as on the computer itself: send messages and attachments, manage members, export backups, with live updates, and issue [external member](#external-members-borrowing-an-ai-from-another-computer) invites. Conversations stay on the computer; the website only passes encrypted content. Project paths and keys never leave the computer.
|
|
79
79
|
|
|
80
80
|
- Nothing is listed while the computer is off or codiscuss is not running; the directory heading says the computer is not connected or offline, and the page connects on its own once the computer is back.
|
|
81
81
|
- When the computer does not answer in time, the page reports the result as unconfirmed and never resends on its own; check the room before retrying.
|
|
82
82
|
|
|
83
|
+
### External Members: Borrowing an AI from Another Computer
|
|
84
|
+
|
|
85
|
+
Invite an AI on another computer into your room: it reads only the project files you open to it and answers in the room, while it keeps running on its own computer. Below, "your computer" holds the room and the project, and "the other computer" sends the AI; it works the same between two of your own computers.
|
|
86
|
+
|
|
87
|
+
**Before you start**: both computers install CoDiscuss and run the local service; your computer is [connected to a hosted site](#from-a-hosted-site) with the relay deployed, and the other side reaches your room through that site's encrypted relay. While your computer is off or codiscuss is not running, the other side gets nothing.
|
|
88
|
+
|
|
89
|
+
**Invite (your computer)**:
|
|
90
|
+
1. In the right panel's "Invite members" dialog, choose "Another computer" at the end of the add row, then pick what it may do (discussion only, or discussion + read-only project), which project folders to open (only folders this room already has), and how long it stays (1 hour, today or 3 days).
|
|
91
|
+
2. Choose "Create invitation" and send the link, QR code or pairing code. An invite works once within 10 minutes and can be revoked from the list below it. Paired phones and tablets can issue invites too.
|
|
92
|
+
3. Whoever redeems it becomes a member right away; **there is no approval step**. A notice in the lower right says someone joined by invite; if it was not your invite, choose "Revoke" in its member menu at once.
|
|
93
|
+
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.
|
|
94
|
+
|
|
95
|
+
**Join (the other computer)**:
|
|
96
|
+
1. Open the link and choose "Join with CoDiscuss on this computer" to go to the local page; or choose "+" under "Invited rooms" in the left panel and paste the link or pairing code; or run `codiscuss join <link or code> --adapter TOOL`. A pairing code also needs the inviting site's address.
|
|
97
|
+
2. Pick the AI, model and effort, and a trust level:
|
|
98
|
+
|
|
99
|
+
| Trust level | When named | Local AI |
|
|
100
|
+
| --- | --- | --- |
|
|
101
|
+
| Default | Woken only after you approve in the right panel each time; declining, or 15 minutes without an answer, shows "Not accepted by the other side" in the room | Limited to CoDiscuss commands, running in an empty temporary folder |
|
|
102
|
+
| 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 |
|
|
103
|
+
| Trusted computer | Woken directly, no limits; later invites from that computer are accepted at this level | Unrestricted: local files and network tools available |
|
|
104
|
+
|
|
105
|
+
You can change the level and limits later in the invited room's right panel, or pause or leave; `codiscuss invited` offers the same commands. Trusted computer can be set only on the other computer itself; a paired phone or tablet can choose only Default or Full loan. The local service does the waking, so keep codiscuss running.
|
|
106
|
+
|
|
107
|
+
**Supported tools**: Default and Full loan need a tool that can be limited to CoDiscuss commands. Claude Code (background runs) supports it, tested on version 2.1.325 (other versions not individually checked), and so do model APIs, backed by unit tests; Codex and Antigravity do not support it and can serve only at the Trusted computer level; desktop apps cannot join as external members.
|
|
108
|
+
|
|
109
|
+
**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.
|
|
110
|
+
|
|
111
|
+
**Keep in mind**:
|
|
112
|
+
- 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.
|
|
113
|
+
- 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.
|
|
114
|
+
- 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.
|
|
115
|
+
- 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.
|
|
116
|
+
|
|
83
117
|
## API Access
|
|
84
118
|
|
|
85
119
|
API members do their room work in [Pi](https://github.com/earendil-works/pi), which codiscuss installs during setup into its service folder. Its version is the one this codiscuss release was tested with and changes only when codiscuss is upgraded (a new version is used only once it starts correctly). To use your own build, point the `CODISCUSS_PI_CLI` environment variable at its `dist/bundle/cli.js`. Pi gets only the room and file tools codiscuss hands it and ignores your own Pi configuration. Each API member keeps its own session, so it remembers earlier work and its session rewinds with the conversation. Several API members can use models from different providers at the same time. Private chats do not go through Pi.
|
package/docs/runner.md
CHANGED
|
@@ -87,7 +87,7 @@ codiscuss local connect https://你的站点
|
|
|
87
87
|
|
|
88
88
|
### 在其他设备上远程控制
|
|
89
89
|
|
|
90
|
-
手机或平板与电脑配对后,只要这台电脑开机并运行 codiscuss,就能像在电脑上一样操作:建房、邀请与请回成员、翻开卡片设置软件、模型和权限、录入 API
|
|
90
|
+
手机或平板与电脑配对后,只要这台电脑开机并运行 codiscuss,就能像在电脑上一样操作:建房、邀请与请回成员、翻开卡片设置软件、模型和权限、录入 API 密钥、管理常用项目等。这些操作由网站转交给电脑执行,内容端到端加密,网站只经手密文。还可以签发[外部成员](#外部成员借用另一台电脑上的-ai)邀请。
|
|
91
91
|
|
|
92
92
|
其他设备能用的目录由电脑决定:只能选择**常用项目**及其中的文件夹。点项目目录栏末尾的文件夹按钮,可以逐层浏览常用项目中的文件夹(只显示文件夹名)。想让其他设备使用更大的范围,就在电脑上把上级目录加为常用项目。以下设置只能在电脑上修改:软件位置、常用项目范围之外的目录。转交的命令只执行一次,发出 10 分钟后作废,所以手机时间需要大致准确。
|
|
93
93
|
|
|
@@ -111,6 +111,40 @@ codiscuss local connect https://你的站点
|
|
|
111
111
|
- 电脑关机或 codiscuss 未运行时看不到房间,目录标题提示“电脑未连接”或“电脑离线”;电脑上线后页面自动连上。
|
|
112
112
|
- 电脑没有及时答复时,页面提示“结果待确认”,不会自动重发;请先查看房间确认是否已生效。
|
|
113
113
|
|
|
114
|
+
### 外部成员:借用另一台电脑上的 AI
|
|
115
|
+
|
|
116
|
+
请另一台电脑上的 AI 进你的房间帮忙:它只读你开放的项目文件,在房间里回答,自己不在你的电脑上运行。下文称有房间和项目的电脑为“你的电脑”,派出 AI 的电脑为“对方电脑”;自己的两台电脑之间同样适用。
|
|
117
|
+
|
|
118
|
+
**前提**:两台电脑都安装共议并运行本机服务;你的电脑已[连接线上网站](#线上网页连接本机)并部署了中转,对方经这个网站的加密中转访问你的房间。你的电脑关机或 codiscuss 未运行时,对方什么也拿不到。
|
|
119
|
+
|
|
120
|
+
**邀请(你的电脑)**:
|
|
121
|
+
1. 右栏“邀请成员”弹窗的添加行末尾点“另一台电脑”,选择能做什么(只讨论,或讨论 + 只读项目)、开放哪些项目目录(只能选本房间已有的)、有效期(1 小时、今天或 3 天)。
|
|
122
|
+
2. 点“生成邀请”,把链接、二维码或配对码发给对方。邀请 10 分钟内有效、只能用一次,可在下方列表撤销。已配对的手机或平板也能签发邀请。
|
|
123
|
+
3. 对方加入后直接成为成员,**没有批准步骤**:右下角会提示有人经邀请加入,不是你邀请的就立即在成员菜单里撤销授权。
|
|
124
|
+
4. 在房间里 `@` 它,回答照常出现在对话中。成员菜单的“读取记录与权限”列出它读过的每个文件(由你的电脑记录),可延长、降为只讨论或撤销授权,撤销立即生效。
|
|
125
|
+
|
|
126
|
+
**加入(对方电脑)**:
|
|
127
|
+
1. 打开链接,点“用本机共议加入”跳到本机网页;或在左栏“被邀请的房间”点“+”粘贴链接或配对码;命令行为 `codiscuss join <链接或配对码> --adapter 软件`。配对码另需填你的线上站点地址。
|
|
128
|
+
2. 选派哪个 AI、模型与强度,以及信任等级:
|
|
129
|
+
|
|
130
|
+
| 信任等级 | 被点名后 | 本机 AI |
|
|
131
|
+
| --- | --- | --- |
|
|
132
|
+
| 默认 | 每次须你在右栏同意才唤醒;拒绝或 15 分钟未处理,对方看到“对方未同意” | 只能用共议命令,在空的临时目录运行 |
|
|
133
|
+
| 完全借用 | 直接唤醒,受次数与期限上限(默认 20 次、1 天),用完退回每次询问 | 同上 |
|
|
134
|
+
| 信任设备 | 直接唤醒,不设上限;之后这台电脑发来的邀请按此等级直接接受 | 不受限,可用本机文件与联网工具 |
|
|
135
|
+
|
|
136
|
+
等级与上限之后可在被邀请房间的右栏调整,也可暂停或退出;`codiscuss invited` 有同样的命令。“信任设备”只能在对方电脑本机设置,从已配对的手机或平板只能选“默认”或“完全借用”。唤醒由本机服务完成,请保持 codiscuss 运行。
|
|
137
|
+
|
|
138
|
+
**支持的软件**:默认与完全借用要求软件能限制为只用共议命令,目前支持 Claude Code(后台运行,已在 2.1.325 版实测,其他版本未逐一验证)与模型 API(以单元测试为据);Codex、Antigravity 不支持收窄,只能在“信任设备”等级下服务;桌面 App 不能作为外部成员加入。
|
|
139
|
+
|
|
140
|
+
**能读到什么**:开放目录中 Git 管理的文件(含未提交的改动,忽略 `.gitignore` 里的文件),非 Git 目录则是除 `node_modules` 等生成目录外的文件。`.env` 一类文件、私钥与证书、凭据文件、`.git`、开放目录根下的 `data/` 永不开放;指向目录外的链接被拒绝。它只能读,不能写文件或执行命令,也看不到私聊、其他房间和本机路径。每次最多读 128 KiB,默认每小时 4 MiB、总量 64 MiB、每小时 600 次。
|
|
141
|
+
|
|
142
|
+
**须知**:
|
|
143
|
+
- 读出去的内容收不回:它会留在对方 AI 的会话里,并发送给对方的模型服务商;撤销只阻止以后的读取。
|
|
144
|
+
- 邀请若在 10 分钟内被别人抢先使用,对方即成为成员,只能靠你看到提示后撤销。只把邀请发给信任的人。
|
|
145
|
+
- 配对码不含你电脑的密钥指纹,对方核对不了连到的是不是你;能用链接或二维码时优先用。
|
|
146
|
+
- “信任设备”等级下对方的 AI 不受限,你房间里的内容可能诱导它读对方电脑上的文件,只在自己的电脑之间使用。
|
|
147
|
+
|
|
114
148
|
## API 接入
|
|
115
149
|
|
|
116
150
|
API 成员在房间里的工作由 [Pi](https://github.com/earendil-works/pi) 运行,codiscuss 在安装时把它装进服务目录,不用自己安装。Pi 的版本固定为这一版 codiscuss 测试过的版本,随 codiscuss 升级而更新(换版本前先确认新版能正常启动,否则继续用原来的)。要用自己构建的 Pi,用环境变量 `CODISCUSS_PI_CLI` 指向它的 `dist/bundle/cli.js`。Pi 只使用 codiscuss 交给它的房间与文件工具,不读你自己的 Pi 配置;每位 API 成员有自己的会话,记得之前做过的事,回退对话时它的会话同样回退。多位 API 成员可以同时使用不同厂商的模型。私聊不经 Pi。
|
|
@@ -772,5 +772,42 @@
|
|
|
772
772
|
"answers 须为 [{id, selected, custom?}],每道题最多一项": "answers must be [{id, selected, custom?}], at most one entry per question",
|
|
773
773
|
"answers 的 selected 须为选项列表": "selected in answers must be a list of options",
|
|
774
774
|
"第 {item} 题不接受自由回答": "Question {item} does not take a free answer",
|
|
775
|
-
"第 {item} 题是单选:选一个选项,或填写自由回答": "Question {item} takes one choice: choose an option or write a free answer"
|
|
775
|
+
"第 {item} 题是单选:选一个选项,或填写自由回答": "Question {item} takes one choice: choose an option or write a free answer",
|
|
776
|
+
"action 须为 update 或 revoke": "action must be update or revoke",
|
|
777
|
+
"bytes 须为 0–{limit} 的整数": "bytes must be an integer from 0 to {limit}",
|
|
778
|
+
"client_id 已被使用": "This client_id is already in use",
|
|
779
|
+
"directories 须为最多 {count} 个目录,每个不超过 {length} 字": "directories must list at most {count} directories of up to {length} characters each",
|
|
780
|
+
"expires_at 须为晚于现在、不超过 {days} 天的秒级时间": "expires_at must be a time in seconds later than now and within {days} days",
|
|
781
|
+
"op 须为 ls、read 或 grep,outcome 须为 ok 或 denied": "op must be ls, read or grep, and outcome must be ok or denied",
|
|
782
|
+
"outcome 须为 declined 或 timeout": "outcome must be declined or timeout",
|
|
783
|
+
"quota 只能包含 hourly_bytes、total_bytes、hourly_reads": "quota may only contain hourly_bytes, total_bytes and hourly_reads",
|
|
784
|
+
"reason 不超过 {limit} 字,outcome 为 denied 时必填": "reason must be at most {limit} characters and is required when outcome is denied",
|
|
785
|
+
"request_ids 须为 1–{limit} 个不重复的请求编号": "request_ids must be 1 to {limit} distinct request IDs",
|
|
786
|
+
"root 须为非负整数,path 不超过 {limit} 字": "root must be a non-negative integer and path at most {limit} characters",
|
|
787
|
+
"scope 须为 discuss 或 read": "scope must be discuss or read",
|
|
788
|
+
"{field} 须为不超过 {limit} 字的文本": "{field} must be text of at most {limit} characters",
|
|
789
|
+
"{name} 已是本房间成员": "{name} is already a member of this room",
|
|
790
|
+
"只讨论时不开放目录": "Discussion-only access opens no directories",
|
|
791
|
+
"只读项目须至少开放一个目录": "Read-only project access needs at least one directory",
|
|
792
|
+
"外部成员不存在": "External member not found",
|
|
793
|
+
"外部成员不能担任主持人或被请回;需要时重新邀请": "An external member cannot be the host or be brought back; invite it again if needed",
|
|
794
|
+
"外部成员只能使用成员范围接口": "External members can only use member-scope routes",
|
|
795
|
+
"外部成员已到期": "The external member has expired",
|
|
796
|
+
"外部成员已结束,不能再调整;需要时重新邀请": "The external member has ended and can no longer be changed; invite it again if needed",
|
|
797
|
+
"外部成员已被撤销": "The external member has been revoked",
|
|
798
|
+
"外部成员已退出": "The external member has left",
|
|
799
|
+
"外部成员的回答不能带这些字段:{fields}": "An external member's answer cannot carry these fields: {fields}",
|
|
800
|
+
"外部成员的执行只能 renew、segments、delivery、fail、release 或 quiet": "An external member's execution only accepts renew, segments, delivery, fail, release or quiet",
|
|
801
|
+
"外部成员请求不能经设备中转": "External member requests cannot go through the device relay",
|
|
802
|
+
"建立外部成员须先读取外部成员名单,并带上其中的 revision": "Read the external member list first and include its revision to add an external member",
|
|
803
|
+
"开放目录不能重复": "Opened directories cannot repeat",
|
|
804
|
+
"房间成员已变化,请重新读取外部成员名单后再提交": "The room's members have changed; read the external member list again before submitting",
|
|
805
|
+
"房间成员已满": "The room is full",
|
|
806
|
+
"本小时读取次数已达上限": "The hourly read count limit has been reached",
|
|
807
|
+
"本小时读取量已达上限": "The hourly read volume limit has been reached",
|
|
808
|
+
"该外部成员只讨论,未开放读取项目": "This external member is discussion-only and cannot read the project",
|
|
809
|
+
"该目录未对外部成员开放": "This directory is not open to the external member",
|
|
810
|
+
"读取总量已达上限": "The total read volume limit has been reached",
|
|
811
|
+
"配额 {key} 须为 1–{limit} 的整数": "Quota {key} must be an integer from 1 to {limit}",
|
|
812
|
+
"需要本房间外部成员的凭证": "This room's external member credential is required"
|
|
776
813
|
}
|