ai_co_discuss 0.4.23 → 0.4.25
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/references/room.md +2 -2
- package/backend/free_room.py +15 -10
- package/backend/room_import.py +5 -0
- package/backend/server.py +1 -1
- package/docs/runner.md +4 -0
- package/package.json +106 -106
- package/runner/account_space.mjs +80 -0
- package/runner/adapters/api.mjs +1 -1
- package/runner/adapters/api_images.mjs +13 -3
- package/runner/adapters/api_pi.mjs +13 -2
- package/runner/adapters/profiles.mjs +4 -2
- package/runner/admin_panel.mjs +356 -0
- package/runner/codiscuss.mjs +4 -0
- package/runner/discussion_api.mjs +16 -2
- package/runner/discussion_launch.mjs +2310 -2271
- package/runner/discussion_local.mjs +16 -0
- package/runner/discussion_runner.mjs +3 -1
- package/runner/launcher.mjs +336 -0
- package/runner/os_users.mjs +288 -0
- package/runner/tray.mjs +169 -0
- package/web/admin.css +3 -0
- package/web/admin.html +17 -0
- package/web/admin.js +32 -0
- package/web/app.js +5409 -5253
- package/web/backup.js +1 -1
- package/web/mark-tile.svg +1 -0
- package/web/mark.svg +1 -0
- package/web/modern.css +1 -1
- package/web/modern.js +51 -51
- package/workflows/story-serial/SKILL.md +37 -10
- package/workflows/story-serial/agents/reader.md +2 -1
- package/workflows/story-serial/agents/writer.md +1 -0
- package/workflows/story-serial/flow.json +17 -0
- package/workflows/story-serial/templates/README.md +1 -1
- package/workflows/story-serial/templates//345/267/245/344/275/234/345/217/260.md +45 -0
- package/workflows/story-serial/workflows/aigc-reduce/SKILL.md +87 -0
- package/workflows/story-serial/workflows/aigc-reduce/flow.json +107 -0
- package/workflows/story-serial/workflows/aigc-reduce/references//347/237/245/350/257/206/345/272/223.md +151 -0
- package/workflows/story-serial/workflows/aigc-reduce/scripts/zhuque.py +226 -0
- package/workflows/story-serial/workflows/revise-episodes/SKILL.md +24 -0
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
- `route`:用户未点名的消息,或全体调度交回的原问题,由你回答或分派;全体调度未代办时仍须读取原文,再决定安排。
|
|
10
10
|
- `handoff`:你派出的成员都已结束(含失败),据结果决定下一步。
|
|
11
|
-
- `notice`:程序发现了要你处理的事,请求所在消息写明是什么:成员执行失败、依次派活某一棒失败、重试后的结果,或你上次要求的续跑。先读相关原文和 `room view`,再决定重试、改派、核实修正,或告诉用户需要他定什么。你已有待处理请求时,程序只把通知写进记录、不另建请求:处理任何请求时,新消息里作者为“系统”的通知同样要处理。成员改了同一文件不发通知,需要时看 `room view` 的 `free.conflicts
|
|
11
|
+
- `notice`:程序发现了要你处理的事,请求所在消息写明是什么:成员执行失败、依次派活某一棒失败、重试后的结果,或你上次要求的续跑。先读相关原文和 `room view`,再决定重试、改派、核实修正,或告诉用户需要他定什么。你已有待处理请求时,程序只把通知写进记录、不另建请求:处理任何请求时,新消息里作者为“系统”的通知同样要处理。成员改了同一文件不发通知,需要时看 `room view` 的 `free.conflicts`(只列双方都用编辑工具写过的文件)。
|
|
12
12
|
- `all`:用户请全体成员各自回应一次,其他成员已同时收到;你只回答自己的部分,不加 `--to`。
|
|
13
13
|
- `goal_start`、`goal_continue`:用户开启了 Goal,按技能 [discuss-goal](../../discuss-goal/SKILL.md) 处理。
|
|
14
14
|
- `discuss_start`:用户发了 `/discuss`,等你补全讨论目标后开启讨论。消息带了文本时以原文为准,只整理措辞;没带时从最近对话提炼,提炼不出明确的讨论问题就不开启,直接回答并说明缺什么。开启:`run start ROOM --request 请求编号 --goal-file 草稿`,上限用房间默认值,你不设置。然后照常简短回答;之后程序会给你讨论主持任务,按技能 [discuss-session](../../discuss-session/SKILL.md) 的 [讨论主持](../../discuss-session/references/host.md) 安排发言。
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
- 偏了方向或要补充:`steer --member 成员 --text 话` 向它进行中的执行插话;不需要打断时优先用它。
|
|
43
43
|
- 卡住或做错:`stop --member 成员` 打断(之后到的请求留到它下一次执行);`stop-all` 停止全部执行、请求与接力(讨论进行中时用 `discussion`)。
|
|
44
44
|
- 偶发失败(网络、超时、软件崩溃):`retry --execution 编号` 重试。
|
|
45
|
-
- 模型限流或不可用:`model --member 成员 --model M [--effort E]`
|
|
45
|
+
- 模型限流或不可用:`model --member 成员 --model M [--effort E]` 换模型(CLI 与 API 成员可改,API 成员只改强度时省略 `--model`;App 成员在 App 内设置);Codex 等软件的 App 卡住时 `adapter --member 成员 --adapter ID` 切到同一会话的 CLI(成员空闲时才能切)。
|
|
46
46
|
- 成员无法恢复:`remove` 后 `invite` 换一位。
|
|
47
47
|
- 撤回自己派出的活(接力或循环停不下来、方向错了、用户改了主意):`withdraw --message 派活消息编号`,接力或循环立即停下,未开始的请求取消,进行中的那一棒停止,不再交回你。
|
|
48
48
|
- 收到“执行 #N 已 X 分钟没有新输出”的系统通知时,先 `details` 判断它是在跑长任务还是卡住,再决定等待、插话、打断或重试。
|
package/backend/free_room.py
CHANGED
|
@@ -665,6 +665,12 @@ def note_count(connection, execution_id):
|
|
|
665
665
|
return connection.execute("SELECT COUNT(*) FROM execution_notes WHERE execution_id=?", (execution_id,)).fetchone()[0]
|
|
666
666
|
|
|
667
667
|
|
|
668
|
+
def step_count(connection, execution_id):
|
|
669
|
+
"""How many actions (commands, tool calls, file edits) an execution has reported, so its card shows it is working."""
|
|
670
|
+
return connection.execute("""SELECT COUNT(*) FROM execution_segments WHERE source='free' AND execution_id=?
|
|
671
|
+
AND phase IN ('command','tool','editing')""", (execution_id,)).fetchone()[0]
|
|
672
|
+
|
|
673
|
+
|
|
668
674
|
def execution_notes(connection, room_id, execution_id, token=""):
|
|
669
675
|
"""Read one execution's progress notes in order, with the same access as the room view."""
|
|
670
676
|
execution = connection.execute("SELECT member_id FROM member_executions WHERE room_id=? AND id=?", (room_id, execution_id)).fetchone()
|
|
@@ -798,12 +804,11 @@ def session_request_source(connection, member_request_id, message_id):
|
|
|
798
804
|
|
|
799
805
|
|
|
800
806
|
def possible_conflicts(connection, room_id, names):
|
|
801
|
-
"""Report files that executions of different members with overlapping time windows
|
|
807
|
+
"""Report files that executions of different members with overlapping time windows both wrote.
|
|
802
808
|
|
|
803
|
-
A working-tree snapshot sees every change made while an execution ran, including another member's
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
sides' edit tools wrote. Writes made through commands are not in `edited`, and writes outside the scanned working
|
|
809
|
+
A working-tree snapshot sees every change made while an execution ran, including another member's, so it cannot
|
|
810
|
+
tell who wrote a file. A file counts only when both sides reported `edited` (the files the agent's own edit tools
|
|
811
|
+
wrote) and both named it. Writes made through commands are not in `edited`, and writes outside the scanned working
|
|
807
812
|
directory are not seen at all.
|
|
808
813
|
"""
|
|
809
814
|
now = int(time.time())
|
|
@@ -821,13 +826,12 @@ def possible_conflicts(connection, room_id, names):
|
|
|
821
826
|
continue
|
|
822
827
|
if first["created_at"] > second["end"] or second["created_at"] > first["end"]:
|
|
823
828
|
continue
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
829
|
+
if first["edited"] is None or second["edited"] is None:
|
|
830
|
+
continue
|
|
831
|
+
files = sorted(first["files"] & second["files"] & first["edited"] & second["edited"])
|
|
827
832
|
if files:
|
|
828
|
-
confirmed = [path for path in files if all(row["edited"] is not None for row in pair)]
|
|
829
833
|
conflicts.append({"members": [names.get(second["member_id"], ""), names.get(first["member_id"], "")],
|
|
830
|
-
"executions": [second["id"], first["id"]], "files": files
|
|
834
|
+
"executions": [second["id"], first["id"]], "files": files})
|
|
831
835
|
return conflicts
|
|
832
836
|
|
|
833
837
|
|
|
@@ -868,6 +872,7 @@ def free_view(connection, room_id):
|
|
|
868
872
|
if latest and latest["status"] in ACTIVE:
|
|
869
873
|
member["execution"]["stale"] = latest["lease_until"] <= now
|
|
870
874
|
member["execution"]["notes"] = note_count(connection, latest["id"])
|
|
875
|
+
member["execution"]["steps"] = step_count(connection, latest["id"])
|
|
871
876
|
member["execution"]["retry"] = execution_retry(connection, latest["id"])
|
|
872
877
|
member["pending"] = connection.execute("SELECT COUNT(*) FROM member_requests WHERE member_id=? AND status='pending'",
|
|
873
878
|
(row["id"],)).fetchone()[0]
|
package/backend/room_import.py
CHANGED
|
@@ -85,6 +85,11 @@ def member_statements(tables, room_id, maps):
|
|
|
85
85
|
uuid.uuid4().hex * 2, remap_until(member.get("read_until"), maps["messages"]),
|
|
86
86
|
member["created_at"], "manual" if member.get("access") == "online" else member.get("access") or "manual",
|
|
87
87
|
member.get("session_mode") or "new")))
|
|
88
|
+
# The owner's display labels and descriptions, by member name; older backups have neither.
|
|
89
|
+
statements += [("INSERT INTO member_labels (room_id,name,label,updated_at) VALUES (?,?,?,?)",
|
|
90
|
+
(room_id, row["name"], row["label"], row["updated_at"])) for row in tables.get("member_labels", [])]
|
|
91
|
+
statements += [("INSERT INTO member_descriptions (room_id,name,description,updated_at) VALUES (?,?,?,?)",
|
|
92
|
+
(room_id, row["name"], row["description"], row["updated_at"])) for row in tables.get("member_descriptions", [])]
|
|
88
93
|
return statements
|
|
89
94
|
|
|
90
95
|
|
package/backend/server.py
CHANGED
|
@@ -158,7 +158,7 @@ ROOM_BACKUP_QUERIES = {
|
|
|
158
158
|
"rooms": "SELECT * FROM rooms WHERE id=?",
|
|
159
159
|
**{table: f"SELECT * FROM {table} WHERE room_id=?" for table in (
|
|
160
160
|
"room_directory", "room_folder_assignments", "room_creations", "room_briefs", "room_user_requests",
|
|
161
|
-
"topic_settings", "discussion_limits")},
|
|
161
|
+
"topic_settings", "discussion_limits", "member_labels", "member_descriptions")},
|
|
162
162
|
"scheduler_decisions": f"{DECISION_SELECT} WHERE d.room_id=? ORDER BY d.id",
|
|
163
163
|
"topic_folders": "SELECT * FROM topic_folders WHERE id IN (SELECT folder_id FROM room_folder_assignments WHERE room_id=?)",
|
|
164
164
|
"messages": "SELECT * FROM messages WHERE room_id=? ORDER BY id",
|
package/docs/runner.md
CHANGED
|
@@ -39,6 +39,10 @@ codiscuss setup
|
|
|
39
39
|
|
|
40
40
|
话题名称、项目目录和本次成员每次重新填写;智能调度、协作方式、讨论与 Goal 上限、连续派活轮数等选项自动记住上一次选择,取消建房也保留。偏好保存在运行服务的电脑上,其他已配对设备使用同一份;讨论与 Goal 的目标仍需每次填写。工作流只记住浏览选中项,不会因此启动。
|
|
41
41
|
|
|
42
|
+
不选项目目录时,房间使用**草稿空间**:程序在草稿空间里为这个房间单独建一个文件夹(房间名加短编号)并作为它的项目目录,成员生成的文件存在这里,“文件”页可以浏览,成员也可以设为可写。草稿空间默认在服务目录旁(`~/.codiscuss-workspace`)。房间画的图除了作为附件随消息发出,成员对项目目录可写时、或房间在草稿空间时,还会在该目录的 `images/` 下留一份。
|
|
43
|
+
|
|
44
|
+
Windows 上可运行 `codiscuss launcher` 生成“共议”程序,桌面和开始菜单各有一个快捷方式,双击即可启动服务并打开网站。服务运行时任务栏右下角有共议图标:左键打开**管理面板**,右键可打开共议、重启或关闭服务(也可运行 `codiscuss panel`)。第一次需要在“设置 → 个性化 → 任务栏 → 其他系统托盘图标”里打开“共议”,图标才会常驻任务栏。面板只在这台电脑上打开,用来管理托管的用户、为每个用户建立独立的 Windows 用户、登录 Claude Code / Codex / Antigravity 命令行,以及给用户配置 API 密钥。
|
|
45
|
+
|
|
42
46
|
### 浏览项目文件
|
|
43
47
|
|
|
44
48
|
房间设置了项目目录后,左栏“房间”下方的“文件”页可浏览电脑上的文件夹与文件,查看大小和修改时间。点击文件打开悬浮预览,支持文本、Markdown 渲染与 HTML 静态渲染,并可切换源码。图片可缩放、旋转(聊天里点开图片附件也一样);视频和音频用带倍速、全屏的播放器直接播放(聊天里的音视频附件同样)(浏览器解不了的格式如 AVI、WMV 请下载后用本机软件打开);CSV 显示为表格,字幕(SRT、VTT、ASS、LRC)显示为时间轴;Word、Excel、PowerPoint 与 PDF 文档只读预览(Word 和 PDF 按窗口宽度显示整页)(Excel 只显示数值,不含样式与图表;PowerPoint 的还原度因文件而异);Premiere 工程解压后显示其 XML,fcpxml 等文本格式的剪辑工程按文本显示。在其他设备上经电脑查看时,图片、音视频和文档整份传过去再显示,单个文件最多 64 MB。Markdown 里用相对路径引用的项目图片(PNG、JPEG、GIF 动图、WebP、SVG 等)会直接显示,其他设备经电脑查看时同样能看到;找不到或在项目目录外的图片在预览顶部列出。可同时打开多个文件,以标签切换;标题栏的“收起”(手机上也可按住标签栏下拉,或正文在顶部时下拉)把预览缩成内容区左上角的悬浮按钮,悬浮按钮可拖到左侧或右侧;切到其他频道或其他房间后点它回到原处(打开的文件、模式和滚动位置都保留),关闭才清空。未设置项目目录时入口灰显。
|
package/package.json
CHANGED
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ai_co_discuss",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"bin": {
|
|
5
|
-
"codiscuss": "runner/codiscuss.mjs"
|
|
6
|
-
},
|
|
7
|
-
"scripts": {
|
|
8
|
-
"dev": "npm run build && wrangler pages dev --ip 127.0.0.1 --port 8787",
|
|
9
|
-
"db:local": "wrangler d1 execute DB --local --file backend/schema.sql",
|
|
10
|
-
"db:remote": "wrangler d1 execute DB --remote --file backend/schema.sql",
|
|
11
|
-
"check": "node --check backend/worker.mjs && node --check web/app.js && node --check runner/admin_account.mjs && node --check runner/codiscuss.mjs && node --check runner/discussion_api.mjs && node --check runner/discussion_launch.mjs && node --check runner/discussion_local.mjs && node --check runner/discussion_runner.mjs && node --check runner/discussion_service.mjs && node --check runner/discussion_setup.mjs && node --check runner/discussion_sidecar.mjs && node --check runner/discussion_skills.mjs && node --check runner/discussion_tui.mjs && node --check runner/execution_progress.mjs && node --check runner/expert_prompts.mjs && node --check runner/files.mjs && node --check runner/free_runner.mjs && node --check runner/remote_launch.mjs && node --check runner/remote_policy.mjs && node --check runner/device_auth.mjs && node --check runner/webauthn.mjs && node --check runner/scheduler.mjs && node --check runner/session_driver.mjs && node --check runner/workflows.mjs && node --check runner/workflow_flow.mjs && node --check runner/weixin.mjs && node --check runner/adapters/antigravity_app.mjs && node --check runner/adapters/antigravity_cli.mjs && node --check runner/adapters/antigravity_sidecar.mjs && node --check runner/adapters/api.mjs && node --check runner/adapters/claude.mjs && node --check runner/adapters/cli.mjs && node --check runner/adapters/codex_app.mjs && node --check runner/adapters/codex_app_client.mjs && node --check runner/adapters/codex_cli.mjs && node --check runner/adapters/common.mjs && node --check runner/adapters/index.mjs && node --check runner/adapters/profiles.mjs",
|
|
12
|
-
"runner": "node runner/discussion_runner.mjs",
|
|
13
|
-
"service": "node runner/discussion_service.mjs",
|
|
14
|
-
"build:ui": "vite build --config frontend/vite.config.mjs --mode markdown && vite build --config frontend/vite.config.mjs --mode backup && vite build --config frontend/vite.config.mjs --mode office && vite build --config frontend/vite.config.mjs",
|
|
15
|
-
"test:markdown": "node --test tests/test_markdown.mjs",
|
|
16
|
-
"build": "npm run check && npm run build:ui && node scripts/build_pages.mjs",
|
|
17
|
-
"test:pages": "node --test tests/test_pages.mjs",
|
|
18
|
-
"deploy": "npm run build && wrangler pages deploy --branch main --commit-dirty=true",
|
|
19
|
-
"deploy:pages": "npm run deploy",
|
|
20
|
-
"test": "npm run test:python && npm run test:js",
|
|
21
|
-
"test:python": "python -m unittest discover -s tests -p test_*.py",
|
|
22
|
-
"test:js": "node --test tests/test_*.mjs",
|
|
23
|
-
"test:install": "node --test tests/test_setup.mjs tests/test_local.mjs tests/test_package.mjs"
|
|
24
|
-
},
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"@earendil-works/pi-coding-agent": "1.5.2",
|
|
27
|
-
"@iconify-json/lucide": "1.2.144",
|
|
28
|
-
"@mdit/plugin-katex": "1.1.3",
|
|
29
|
-
"@nuxt/ui": "4.11.3",
|
|
30
|
-
"@silurus/ooxml": "0.89.9",
|
|
31
|
-
"@tailwindcss/vite": "4.3.3",
|
|
32
|
-
"@videojs/core": "10.3.0",
|
|
33
|
-
"@videojs/html": "10.3.0",
|
|
34
|
-
"@vitejs/plugin-vue": "6.0.10",
|
|
35
|
-
"@vue-flow/background": "1.3.2",
|
|
36
|
-
"@vue-flow/controls": "1.1.3",
|
|
37
|
-
"@vue-flow/core": "1.48.2",
|
|
38
|
-
"@vue-flow/minimap": "1.5.4",
|
|
39
|
-
"docx-preview": "0.4.1",
|
|
40
|
-
"fflate": "0.8.3",
|
|
41
|
-
"jsqr": "1.4.0",
|
|
42
|
-
"katex": "0.18.10",
|
|
43
|
-
"markdown-it": "15.0.3",
|
|
44
|
-
"markdown-it-cjk-friendly": "3.0.0",
|
|
45
|
-
"motion-v": "2.7.0",
|
|
46
|
-
"papaparse": "5.7.0",
|
|
47
|
-
"pdfjs-dist": "6.4.299",
|
|
48
|
-
"uqr": "0.1.2",
|
|
49
|
-
"viewerjs": "1.15.2",
|
|
50
|
-
"vite": "8.3.4",
|
|
51
|
-
"vue": "3.5.44",
|
|
52
|
-
"wrangler": "4.151.0",
|
|
53
|
-
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
|
|
54
|
-
},
|
|
55
|
-
"description": "让不同 AI 在各自软件中协作的共享讨论空间",
|
|
56
|
-
"keywords": [
|
|
57
|
-
"ai",
|
|
58
|
-
"multi-agent",
|
|
59
|
-
"discussion",
|
|
60
|
-
"cli",
|
|
61
|
-
"codex",
|
|
62
|
-
"claude",
|
|
63
|
-
"gemini"
|
|
64
|
-
],
|
|
65
|
-
"homepage": "https://github.com/huyan1458/ai_co_discuss#readme",
|
|
66
|
-
"repository": {
|
|
67
|
-
"type": "git",
|
|
68
|
-
"url": "git+https://github.com/huyan1458/ai_co_discuss.git"
|
|
69
|
-
},
|
|
70
|
-
"bugs": {
|
|
71
|
-
"url": "https://github.com/huyan1458/ai_co_discuss/issues"
|
|
72
|
-
},
|
|
73
|
-
"author": "huyan1458",
|
|
74
|
-
"license": "MIT",
|
|
75
|
-
"engines": {
|
|
76
|
-
"node": ">=24"
|
|
77
|
-
},
|
|
78
|
-
"overrides": {
|
|
79
|
-
"fontless": {
|
|
80
|
-
"esbuild": "0.28.2"
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
"files": [
|
|
84
|
-
"runner/*.mjs",
|
|
85
|
-
"runner/adapters/*.mjs",
|
|
86
|
-
"runner/*.py",
|
|
87
|
-
"backend/*.py",
|
|
88
|
-
"backend/schema.sql",
|
|
89
|
-
"backend/migrations/*.sql",
|
|
90
|
-
"server.py",
|
|
91
|
-
"web/**",
|
|
92
|
-
".agents/skills/discuss-host/**",
|
|
93
|
-
".agents/skills/discuss-participant/**",
|
|
94
|
-
".agents/skills/discuss-goal/**",
|
|
95
|
-
".agents/skills/discuss-session/**",
|
|
96
|
-
".agents/skills/discuss-report/**",
|
|
97
|
-
".agents/skills/workflow-creator/**",
|
|
98
|
-
".agents/skills/local-tts-setup/**",
|
|
99
|
-
".agents/skills/local-stt-setup/**",
|
|
100
|
-
"workflows/**",
|
|
101
|
-
".github/SECURITY.md",
|
|
102
|
-
"docs/**",
|
|
103
|
-
"!**/*.log",
|
|
104
|
-
"LICENSE"
|
|
105
|
-
]
|
|
106
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "ai_co_discuss",
|
|
3
|
+
"version": "0.4.25",
|
|
4
|
+
"bin": {
|
|
5
|
+
"codiscuss": "runner/codiscuss.mjs"
|
|
6
|
+
},
|
|
7
|
+
"scripts": {
|
|
8
|
+
"dev": "npm run build && wrangler pages dev --ip 127.0.0.1 --port 8787",
|
|
9
|
+
"db:local": "wrangler d1 execute DB --local --file backend/schema.sql",
|
|
10
|
+
"db:remote": "wrangler d1 execute DB --remote --file backend/schema.sql",
|
|
11
|
+
"check": "node --check backend/worker.mjs && node --check web/app.js && node --check runner/account_space.mjs && node --check runner/admin_account.mjs && node --check runner/admin_panel.mjs && node --check runner/os_users.mjs && node --check runner/tray.mjs && node --check runner/launcher.mjs && node --check runner/codiscuss.mjs && node --check runner/discussion_api.mjs && node --check runner/discussion_launch.mjs && node --check runner/discussion_local.mjs && node --check runner/discussion_runner.mjs && node --check runner/discussion_service.mjs && node --check runner/discussion_setup.mjs && node --check runner/discussion_sidecar.mjs && node --check runner/discussion_skills.mjs && node --check runner/discussion_tui.mjs && node --check runner/execution_progress.mjs && node --check runner/expert_prompts.mjs && node --check runner/files.mjs && node --check runner/free_runner.mjs && node --check runner/remote_launch.mjs && node --check runner/remote_policy.mjs && node --check runner/device_auth.mjs && node --check runner/webauthn.mjs && node --check runner/scheduler.mjs && node --check runner/session_driver.mjs && node --check runner/workflows.mjs && node --check runner/workflow_flow.mjs && node --check runner/weixin.mjs && node --check runner/adapters/antigravity_app.mjs && node --check runner/adapters/antigravity_cli.mjs && node --check runner/adapters/antigravity_sidecar.mjs && node --check runner/adapters/api.mjs && node --check runner/adapters/claude.mjs && node --check runner/adapters/cli.mjs && node --check runner/adapters/codex_app.mjs && node --check runner/adapters/codex_app_client.mjs && node --check runner/adapters/codex_cli.mjs && node --check runner/adapters/common.mjs && node --check runner/adapters/index.mjs && node --check runner/adapters/profiles.mjs",
|
|
12
|
+
"runner": "node runner/discussion_runner.mjs",
|
|
13
|
+
"service": "node runner/discussion_service.mjs",
|
|
14
|
+
"build:ui": "vite build --config frontend/vite.config.mjs --mode markdown && vite build --config frontend/vite.config.mjs --mode backup && vite build --config frontend/vite.config.mjs --mode office && vite build --config frontend/vite.config.mjs --mode admin && vite build --config frontend/vite.config.mjs",
|
|
15
|
+
"test:markdown": "node --test tests/test_markdown.mjs",
|
|
16
|
+
"build": "npm run check && npm run build:ui && node scripts/build_pages.mjs",
|
|
17
|
+
"test:pages": "node --test tests/test_pages.mjs",
|
|
18
|
+
"deploy": "npm run build && wrangler pages deploy --branch main --commit-dirty=true",
|
|
19
|
+
"deploy:pages": "npm run deploy",
|
|
20
|
+
"test": "npm run test:python && npm run test:js",
|
|
21
|
+
"test:python": "python -m unittest discover -s tests -p test_*.py",
|
|
22
|
+
"test:js": "node --test tests/test_*.mjs",
|
|
23
|
+
"test:install": "node --test tests/test_setup.mjs tests/test_local.mjs tests/test_package.mjs"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@earendil-works/pi-coding-agent": "1.5.2",
|
|
27
|
+
"@iconify-json/lucide": "1.2.144",
|
|
28
|
+
"@mdit/plugin-katex": "1.1.3",
|
|
29
|
+
"@nuxt/ui": "4.11.3",
|
|
30
|
+
"@silurus/ooxml": "0.89.9",
|
|
31
|
+
"@tailwindcss/vite": "4.3.3",
|
|
32
|
+
"@videojs/core": "10.3.0",
|
|
33
|
+
"@videojs/html": "10.3.0",
|
|
34
|
+
"@vitejs/plugin-vue": "6.0.10",
|
|
35
|
+
"@vue-flow/background": "1.3.2",
|
|
36
|
+
"@vue-flow/controls": "1.1.3",
|
|
37
|
+
"@vue-flow/core": "1.48.2",
|
|
38
|
+
"@vue-flow/minimap": "1.5.4",
|
|
39
|
+
"docx-preview": "0.4.1",
|
|
40
|
+
"fflate": "0.8.3",
|
|
41
|
+
"jsqr": "1.4.0",
|
|
42
|
+
"katex": "0.18.10",
|
|
43
|
+
"markdown-it": "15.0.3",
|
|
44
|
+
"markdown-it-cjk-friendly": "3.0.0",
|
|
45
|
+
"motion-v": "2.7.0",
|
|
46
|
+
"papaparse": "5.7.0",
|
|
47
|
+
"pdfjs-dist": "6.4.299",
|
|
48
|
+
"uqr": "0.1.2",
|
|
49
|
+
"viewerjs": "1.15.2",
|
|
50
|
+
"vite": "8.3.4",
|
|
51
|
+
"vue": "3.5.44",
|
|
52
|
+
"wrangler": "4.151.0",
|
|
53
|
+
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
|
|
54
|
+
},
|
|
55
|
+
"description": "让不同 AI 在各自软件中协作的共享讨论空间",
|
|
56
|
+
"keywords": [
|
|
57
|
+
"ai",
|
|
58
|
+
"multi-agent",
|
|
59
|
+
"discussion",
|
|
60
|
+
"cli",
|
|
61
|
+
"codex",
|
|
62
|
+
"claude",
|
|
63
|
+
"gemini"
|
|
64
|
+
],
|
|
65
|
+
"homepage": "https://github.com/huyan1458/ai_co_discuss#readme",
|
|
66
|
+
"repository": {
|
|
67
|
+
"type": "git",
|
|
68
|
+
"url": "git+https://github.com/huyan1458/ai_co_discuss.git"
|
|
69
|
+
},
|
|
70
|
+
"bugs": {
|
|
71
|
+
"url": "https://github.com/huyan1458/ai_co_discuss/issues"
|
|
72
|
+
},
|
|
73
|
+
"author": "huyan1458",
|
|
74
|
+
"license": "MIT",
|
|
75
|
+
"engines": {
|
|
76
|
+
"node": ">=24"
|
|
77
|
+
},
|
|
78
|
+
"overrides": {
|
|
79
|
+
"fontless": {
|
|
80
|
+
"esbuild": "0.28.2"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"files": [
|
|
84
|
+
"runner/*.mjs",
|
|
85
|
+
"runner/adapters/*.mjs",
|
|
86
|
+
"runner/*.py",
|
|
87
|
+
"backend/*.py",
|
|
88
|
+
"backend/schema.sql",
|
|
89
|
+
"backend/migrations/*.sql",
|
|
90
|
+
"server.py",
|
|
91
|
+
"web/**",
|
|
92
|
+
".agents/skills/discuss-host/**",
|
|
93
|
+
".agents/skills/discuss-participant/**",
|
|
94
|
+
".agents/skills/discuss-goal/**",
|
|
95
|
+
".agents/skills/discuss-session/**",
|
|
96
|
+
".agents/skills/discuss-report/**",
|
|
97
|
+
".agents/skills/workflow-creator/**",
|
|
98
|
+
".agents/skills/local-tts-setup/**",
|
|
99
|
+
".agents/skills/local-stt-setup/**",
|
|
100
|
+
"workflows/**",
|
|
101
|
+
".github/SECURITY.md",
|
|
102
|
+
"docs/**",
|
|
103
|
+
"!**/*.log",
|
|
104
|
+
"LICENSE"
|
|
105
|
+
]
|
|
106
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where an instance keeps what its rooms produce.
|
|
3
|
+
*
|
|
4
|
+
* Every instance has a draft space: a room created without a project directory works in its own sub-folder there. An
|
|
5
|
+
* instance whose settings name a projects root belongs to an ordinary account, which may only use folders created
|
|
6
|
+
* directly under that root. Both sit beside the service directory, never inside it, because everything inside the
|
|
7
|
+
* service directory is private to the runner.
|
|
8
|
+
*/
|
|
9
|
+
import { createHash } from 'node:crypto';
|
|
10
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, realpathSync } from 'node:fs';
|
|
11
|
+
import { isAbsolute, join, relative, resolve } from 'node:path';
|
|
12
|
+
|
|
13
|
+
const SETTINGS_FILE = 'local-settings.json';
|
|
14
|
+
const PROJECT_NAME_LIMIT = 80;
|
|
15
|
+
const DRAFT_TITLE_LIMIT = 40;
|
|
16
|
+
// Characters Windows refuses in a file name, plus control characters.
|
|
17
|
+
const UNSAFE_NAME = /[<>:"/\\|?*\u0000-\u001f]/g;
|
|
18
|
+
const RESERVED_NAME = /^(con|prn|aux|nul|com\d|lpt\d)$/i;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Read this instance's draft space and, for an ordinary account, its projects root.
|
|
22
|
+
*
|
|
23
|
+
* Returns:
|
|
24
|
+
* { workspace, projects_root }; projects_root is null for the computer owner's instance, which may use any folder.
|
|
25
|
+
*/
|
|
26
|
+
export function account_space(home) {
|
|
27
|
+
const path = join(home, SETTINGS_FILE);
|
|
28
|
+
const settings = existsSync(path) ? JSON.parse(readFileSync(path, 'utf8')) : {};
|
|
29
|
+
const absolute = value => typeof value === 'string' && isAbsolute(value) ? resolve(value) : null;
|
|
30
|
+
return { workspace: absolute(settings.workspace) || `${resolve(home)}-workspace`, projects_root: absolute(settings.projects_root) };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function safe_name(text, limit) {
|
|
34
|
+
const name = String(text || '').replace(UNSAFE_NAME, ' ').replace(/\s+/g, ' ').trim().replace(/[. ]+$/, '').slice(0, limit).trim();
|
|
35
|
+
return RESERVED_NAME.test(name) ? '' : name;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Create the draft folder of one new room and return its path.
|
|
40
|
+
*
|
|
41
|
+
* Args:
|
|
42
|
+
* title: The room's name, used so a person can recognise the folder.
|
|
43
|
+
* key: A value fixed for this creation (its submission), so a retried creation reuses the same folder.
|
|
44
|
+
*/
|
|
45
|
+
export function draft_folder(home, title, key) {
|
|
46
|
+
const suffix = createHash('sha256').update(String(key)).digest('hex').slice(0, 6);
|
|
47
|
+
const folder = join(account_space(home).workspace, `${safe_name(title, DRAFT_TITLE_LIMIT) || '房间'}-${suffix}`);
|
|
48
|
+
mkdirSync(folder, { recursive: true });
|
|
49
|
+
return folder;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The projects of an ordinary account: the folders directly under its projects root. */
|
|
53
|
+
export function account_projects(root) {
|
|
54
|
+
if (!existsSync(root)) return [];
|
|
55
|
+
return readdirSync(root, { withFileTypes: true }).filter(entry => entry.isDirectory())
|
|
56
|
+
.sort((left, right) => left.name.localeCompare(right.name, 'zh-CN', { numeric: true }))
|
|
57
|
+
.map(entry => ({ id: createHash('sha256').update(entry.name).digest('hex').slice(0, 16), name: entry.name, path: join(root, entry.name) }));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Create one project folder directly under the projects root; a name that would nest or escape is refused. */
|
|
61
|
+
export function create_account_project(root, name) {
|
|
62
|
+
const wanted = typeof name === 'string' ? name.trim() : '';
|
|
63
|
+
if (!wanted || wanted.length > PROJECT_NAME_LIMIT || wanted !== safe_name(wanted, PROJECT_NAME_LIMIT) || wanted.startsWith('.')) {
|
|
64
|
+
throw new Error(`项目名称须为 1–${PROJECT_NAME_LIMIT} 字,不能含 \\ / : * ? " < > | 等符号,不能以点开头或结尾`);
|
|
65
|
+
}
|
|
66
|
+
const folder = join(root, wanted);
|
|
67
|
+
if (existsSync(folder)) throw new Error(`项目已存在:${wanted}`);
|
|
68
|
+
mkdirSync(root, { recursive: true });
|
|
69
|
+
mkdirSync(folder);
|
|
70
|
+
return { name: wanted, path: folder };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Whether a folder is one of this instance's draft folders, where the runner itself may keep what a room produced. */
|
|
74
|
+
export function in_draft_space(home, folder) {
|
|
75
|
+
let workspace = account_space(home).workspace, target = resolve(folder);
|
|
76
|
+
// Compare real paths, so a short or linked spelling of the same folder still matches.
|
|
77
|
+
try { workspace = realpathSync(workspace); target = realpathSync(target); } catch { return false; }
|
|
78
|
+
const path = relative(workspace, target);
|
|
79
|
+
return Boolean(path) && !path.startsWith('..') && !isAbsolute(path);
|
|
80
|
+
}
|
package/runner/adapters/api.mjs
CHANGED
|
@@ -367,7 +367,7 @@ async function task_prompt(context) {
|
|
|
367
367
|
}
|
|
368
368
|
|
|
369
369
|
// The member's profile fields the extension needs; the key travels only in the Pi process's environment.
|
|
370
|
-
const PROFILE_FIELDS = ['adapter', 'base_url', 'api_protocol', 'model'];
|
|
370
|
+
const PROFILE_FIELDS = ['adapter', 'base_url', 'api_protocol', 'model', 'effort'];
|
|
371
371
|
|
|
372
372
|
/** Rebuild an execution's tool context inside the Pi process from the setup the runner wrote. */
|
|
373
373
|
export function extension_context(setup, key) {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { createHash, randomUUID } from 'node:crypto';
|
|
10
10
|
import { readFileSync, writeFileSync } from 'node:fs';
|
|
11
11
|
import { join } from 'node:path';
|
|
12
|
+
import { in_draft_space } from '../account_space.mjs';
|
|
12
13
|
import { read_project_bytes, write_new_project_file } from './api_files.mjs';
|
|
13
14
|
|
|
14
15
|
// Complex prompts, GIF frames and the higher qualities can take minutes.
|
|
@@ -22,6 +23,8 @@ const MAX_DATA_URL_CHARS = 20_971_520;
|
|
|
22
23
|
const MAX_INPUT_BYTES = 50 * 1024 * 1024;
|
|
23
24
|
const MAX_INPUT_IMAGES = 16;
|
|
24
25
|
export const MAX_MESSAGE_ATTACHMENTS = 10;
|
|
26
|
+
// Where a writing member's images are also kept inside its project (or its room's folder of the draft space).
|
|
27
|
+
const IMAGE_FOLDER = 'images';
|
|
25
28
|
const ERROR_EXCERPT_CHARS = 600;
|
|
26
29
|
const ATTACHMENT_ID = /^[a-f0-9]{32}$/;
|
|
27
30
|
const EXTENSIONS = { png: 'png', jpeg: 'jpg', webp: 'webp', gif: 'gif', svg: 'svg' };
|
|
@@ -218,6 +221,11 @@ export async function run_image_tool(context, name, args) {
|
|
|
218
221
|
const images = [];
|
|
219
222
|
try {
|
|
220
223
|
if (args.save_path !== undefined && !context.project?.writable) throw new Error('save_path 需要可写的项目目录');
|
|
224
|
+
// Without a requested path, a copy is kept under images/ so the room's files hold what was drawn: by a member that
|
|
225
|
+
// may write its project, and in a room's own folder of the draft space whatever the member's access.
|
|
226
|
+
const main = context.project?.roots[0];
|
|
227
|
+
const keeper = main?.writable ? context.project
|
|
228
|
+
: main && context.home && in_draft_space(context.home, main.root) ? { ...context.project, writable: true, roots: [{ ...main, writable: true }] } : null;
|
|
221
229
|
const body = await image_body(context, name, args);
|
|
222
230
|
const data = await images_request(context, name, name === 'edit_image' ? '/images/edits' : '/images/generations', body);
|
|
223
231
|
const format = data.output_format || body.output_format || 'png';
|
|
@@ -225,12 +233,14 @@ export async function run_image_tool(context, name, args) {
|
|
|
225
233
|
for (const [index, item] of data.data.entries()) {
|
|
226
234
|
const bytes = Buffer.from(item.b64_json, 'base64');
|
|
227
235
|
const image = { size: bytes.length };
|
|
228
|
-
|
|
229
|
-
|
|
236
|
+
const name = file_name(args, index, data.data.length, extension);
|
|
237
|
+
const kept = args.save_path ? numbered_path(args.save_path, index, data.data.length, extension) : keeper ? `${IMAGE_FOLDER}/${randomUUID().slice(0, 6)}-${name}` : '';
|
|
238
|
+
if (kept) {
|
|
239
|
+
const saved = write_new_project_file(args.save_path ? context.project : keeper, kept, bytes);
|
|
230
240
|
context.on_edits?.([saved.path]);
|
|
231
241
|
image.saved_path = saved.shown;
|
|
232
242
|
}
|
|
233
|
-
const attachment = await upload(context,
|
|
243
|
+
const attachment = await upload(context, name, bytes);
|
|
234
244
|
context.generated_attachments.push(attachment.id);
|
|
235
245
|
save_unsent(context, [...unsent_images(context), { attachment_id: attachment.id, file_name: attachment.file_name, created_at: new Date().toISOString() }]);
|
|
236
246
|
images.push({ ...image, attachment_id: attachment.id, file_name: attachment.file_name, ...(item.revised_prompt ? { revised_prompt: item.revised_prompt } : {}) });
|
|
@@ -19,6 +19,7 @@ import { dirname, join, resolve } from 'node:path';
|
|
|
19
19
|
import { fileURLToPath } from 'node:url';
|
|
20
20
|
import { marked, prompt_text, tree_killable } from './common.mjs';
|
|
21
21
|
import { WRITE_TOOLS } from './api_files.mjs';
|
|
22
|
+
import { adapter_profile } from './profiles.mjs';
|
|
22
23
|
|
|
23
24
|
// The provider our extension registers; the model ID is passed to Pi unchanged.
|
|
24
25
|
export const PI_PROVIDER = 'codiscuss';
|
|
@@ -43,14 +44,23 @@ export function pi_home(service_home) {
|
|
|
43
44
|
return { agent: join(root, 'agent'), sessions: join(root, 'sessions') };
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
/**
|
|
48
|
+
* The thinking level Pi is started with: the member's effort when it is one the API profile offers, else '' so no
|
|
49
|
+
* reasoning parameter is sent and the provider's own default applies. Pi maps the level to each protocol's parameter.
|
|
50
|
+
*/
|
|
51
|
+
export function pi_thinking(profile) {
|
|
52
|
+
return adapter_profile('api').efforts.includes(profile.effort) ? profile.effort : '';
|
|
53
|
+
}
|
|
54
|
+
|
|
46
55
|
/** The provider our extension registers for one member: its Base URL, protocol and model, its key from the environment. */
|
|
47
56
|
export function pi_provider(profile, base_url) {
|
|
48
57
|
const api = PI_APIS[profile.api_protocol];
|
|
49
58
|
if (!api) throw new Error('不支持的 API 请求协议');
|
|
50
59
|
// Pi's Anthropic SDK adds /v1 itself; the other protocols take the root including the version, as we store it.
|
|
51
60
|
const url = profile.api_protocol === 'anthropic' ? base_url.replace(/\/v1$/, '') : base_url;
|
|
61
|
+
// Pi drops the thinking level for a model not marked as reasoning, so only a chosen effort marks it.
|
|
52
62
|
return { name: 'CoDiscuss', baseUrl: url, apiKey: '$CODISCUSS_PI_KEY', api, models: [{ id: profile.model, name: profile.model,
|
|
53
|
-
reasoning:
|
|
63
|
+
reasoning: Boolean(pi_thinking(profile)), input: ['text'], cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, contextWindow: CONTEXT_WINDOW,
|
|
54
64
|
maxTokens: MAX_OUTPUT_TOKENS }] };
|
|
55
65
|
}
|
|
56
66
|
|
|
@@ -166,7 +176,8 @@ export function pi_delivery({ cli, profile, key, binding, task, context_file, sy
|
|
|
166
176
|
const args = [cli, '--mode', 'rpc', '--no-builtin-tools', '--no-context-files', '--no-skills', '--no-prompt-templates',
|
|
167
177
|
'--no-themes', '--no-mcp', '--no-approve', '-e', EXTENSION, '--session-dir', dirs.sessions,
|
|
168
178
|
...(existing ? ['--session', existing] : ['--session-id', session_id]),
|
|
169
|
-
'--provider', PI_PROVIDER, '--model', profile.model, '--
|
|
179
|
+
'--provider', PI_PROVIDER, '--model', profile.model, ...(pi_thinking(profile) ? ['--thinking', pi_thinking(profile)] : []),
|
|
180
|
+
'--system-prompt', system_file];
|
|
170
181
|
// Pi tells the model its working directory, so it is the project root our file tools resolve relative paths against;
|
|
171
182
|
// without a project, Pi's own directory. Never the room's: Windows cannot remove a running process's directory.
|
|
172
183
|
const child = tree_killable(spawn_process(process.execPath, args, { cwd: project_root || dirs.agent, windowsHide: true, shell: false,
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - `location`: the config field locating the installed software (`executable`, `ipc_directory`), or '' when none.
|
|
10
10
|
* - `fields`: further config fields the user may set for it.
|
|
11
11
|
* - `efforts`: thinking levels it accepts, or null when chosen inside the App; `efforts_per_model`: the levels are read
|
|
12
|
-
* from the software for the chosen model. `models`: whether its CLI lists models.
|
|
12
|
+
* from the software for the chosen model. `models`: whether its CLI lists models (an API member's model is a typed ID).
|
|
13
13
|
* - `access_levels`: project access levels it can enforce per run, or null when the App or API decides; `access_hints`
|
|
14
14
|
* says what each level does in it (measured headless on Claude Code 2.1.312, Codex CLI 0.163, agy 1.4.10; not yet
|
|
15
15
|
* rechecked on Claude Code 2.1.319 or agy 1.5.2) and
|
|
@@ -112,7 +112,9 @@ export const ADAPTER_PROFILES = {
|
|
|
112
112
|
},
|
|
113
113
|
api: {
|
|
114
114
|
platform: '', label: '模型 API', kind: 'api', location: '', fields: ['base_url', 'api_protocol', 'api_key_ref'],
|
|
115
|
-
|
|
115
|
+
// Pi passes the level as each protocol's own reasoning parameter; it clamps xhigh / max to high without a per-model map,
|
|
116
|
+
// so only the three levels every protocol takes are offered. A chat endpoint without a reasoning parameter ignores it.
|
|
117
|
+
efforts: ['low', 'medium', 'high'], models: false, access_levels: ['read', 'write'], per_tool_allow: false, adopt: '', host_existing: false,
|
|
116
118
|
access_hints: { read: '用接入程序的文件工具读取、搜索项目文件,可运行工作流登记的只读命令',
|
|
117
119
|
write: '还可新建、覆盖、局部编辑项目文件,可运行工作流登记的全部命令;没有通用命令行' },
|
|
118
120
|
unsupported_hints: { auto: 'API 成员没有通用命令行,没有需要软件审批的操作', full: 'API 成员没有通用命令行,没有需要软件审批的操作' },
|