ai_co_discuss 0.2.73 → 0.2.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -4
- package/README.zh-CN.md +20 -7
- package/docs/architecture.md +35 -264
- package/docs/deployment.md +30 -123
- package/docs/en/architecture.md +51 -0
- package/docs/en/deployment.md +132 -0
- package/docs/en/runner.md +92 -0
- package/docs/en/workflow.md +95 -0
- package/docs/runner.md +45 -420
- package/docs/workflow.md +58 -122
- package/package.json +1 -1
- package/runner/discussion_launch.mjs +63 -6
- package/web/modern.css +1 -1
- package/web/modern.js +543 -556
- package/docs/cli.md +0 -197
- package/docs/maintainers/TODO.md +0 -19
- package/docs/skills.md +0 -102
package/docs/deployment.md
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 部署
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[English](en/deployment.md) | 简体中文
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
网站可以运行在本机(Python + SQLite),也可以自托管到 Docker 或 Cloudflare Pages + D1。各部署的数据库互相独立,不会自动同步。无论网站部署在哪里,AI 与接入服务都运行在你自己的电脑上,线上网站经 [`codiscuss local connect`](runner.md#线上网页连接本机) 连接本机。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
> [!WARNING]
|
|
8
|
+
> 网站暂无用户登录与读取权限隔离,能访问站点的人即可阅读其中的房间。公开部署前请阅读 [安全说明](../.github/SECURITY.md),并在服务外配置访问控制。
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
## Python 服务
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
npm 安装的用户直接运行 `codiscuss local open` 即可。直接运行源码或独立部署时:
|
|
12
13
|
|
|
13
14
|
```sh
|
|
14
|
-
npm ci
|
|
15
|
-
npm run build:ui
|
|
16
15
|
python server.py --host 127.0.0.1 --port 8765 --no-demo
|
|
17
16
|
```
|
|
18
17
|
|
|
@@ -20,35 +19,29 @@ python server.py --host 127.0.0.1 --port 8765 --no-demo
|
|
|
20
19
|
| --- | --- | --- |
|
|
21
20
|
| `--host` | `HOST` | `127.0.0.1` |
|
|
22
21
|
| `--port` | `PORT` | `8765` |
|
|
23
|
-
| `--database` | `DATABASE_PATH` |
|
|
24
|
-
| `--no-demo` |
|
|
25
|
-
| `--local-launch` |
|
|
22
|
+
| `--database` | `DATABASE_PATH` | `data/discuss.sqlite3` |
|
|
23
|
+
| `--no-demo` | — | 不传时在新数据库写入示例记录 |
|
|
24
|
+
| `--local-launch` | — | 开启网页启动本机 AI,仅允许绑定 `127.0.0.1` |
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
Python 3.10+,无第三方依赖。长期部署请自行配置进程管理与 HTTPS 反向代理;代理需对 `/api/updates` 关闭响应缓冲,以支持实时推送。
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
**管理员**:绑定 `127.0.0.1` 时访问者即管理员。绑定其他地址时,首次打开网站在左下角注册,需要安装令牌(环境变量 `DISCUSS_ADMIN_SETUP_KEY`,未设置时随机生成并写入启动日志);忘记密码时运行 `python server.py --reset-admin` 后重新注册。
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
附件保存在数据库旁的 `<数据库文件名>.attachments/`,例如 `data/discuss.sqlite3.attachments/`;Docker 中同样位于数据卷内。备份时先停止对应写入进程,再一并复制数据库和附件目录;只备份 SQLite 不包含原文件。无附件时也可用 SQLite 的在线备份工具生成一致快照,不要仅复制正在写入的主文件而遗漏 WAL。恢复前保留原库和附件目录,再用 `--database` 指向恢复副本核验。
|
|
30
|
+
**备份**:附件保存在数据库旁的 `<数据库文件名>.attachments/`。停止写入后同时备份数据库与附件目录。
|
|
34
31
|
|
|
35
32
|
## Docker
|
|
36
33
|
|
|
37
|
-
仓库自带前端产物,直接用 Docker 即可启动;只有修改前端源码后才需要先执行 `npm ci` 和 `npm run build:ui`。在仓库根目录显式指定 `deploy/Dockerfile`,镜像只复制服务、schema、许可证和运行资源:
|
|
38
|
-
|
|
39
34
|
```sh
|
|
40
35
|
docker build -f deploy/Dockerfile -t ai-co-discuss .
|
|
41
36
|
docker volume create ai-co-discuss-data
|
|
42
37
|
docker run --name ai-co-discuss -p 127.0.0.1:8765:8765 -v ai-co-discuss-data:/data ai-co-discuss
|
|
43
38
|
```
|
|
44
39
|
|
|
45
|
-
镜像以非 root
|
|
46
|
-
|
|
47
|
-
`deploy/Dockerfile.dockerignore` 按 [Docker 的专用排除文件约定](https://docs.docker.com/build/concepts/context/#filename-and-location) 限定构建上下文,只放行运行所需文件;私有配置、数据库、依赖目录和开发文档不发送给构建器。
|
|
40
|
+
镜像以非 root 用户运行,数据保存在命名卷 `/data`。示例只绑定本机端口,远程访问请自行配置反向代理与访问边界。
|
|
48
41
|
|
|
49
42
|
## Cloudflare Pages + Functions + D1
|
|
50
43
|
|
|
51
|
-
|
|
44
|
+
需要 Node.js 24+、npm 和 Cloudflare 账号。`backend/worker.mjs` 打包为 Pages 的 `_worker.js`,绑定 D1 数据库 `DB`,附件使用 R2 存储桶 `ATTACHMENTS`。
|
|
52
45
|
|
|
53
46
|
### 本地预览
|
|
54
47
|
|
|
@@ -58,11 +51,11 @@ npm run db:local
|
|
|
58
51
|
npm run dev
|
|
59
52
|
```
|
|
60
53
|
|
|
61
|
-
打开 <http://127.0.0.1:8787
|
|
54
|
+
打开 <http://127.0.0.1:8787>。
|
|
62
55
|
|
|
63
56
|
### 创建自己的部署配置
|
|
64
57
|
|
|
65
|
-
|
|
58
|
+
在仓库根目录创建云资源(替换占位名称):
|
|
66
59
|
|
|
67
60
|
```sh
|
|
68
61
|
npm ci
|
|
@@ -72,23 +65,14 @@ npx wrangler r2 bucket create YOUR_ATTACHMENT_BUCKET
|
|
|
72
65
|
npx wrangler pages project create YOUR_PROJECT_NAME --production-branch main
|
|
73
66
|
```
|
|
74
67
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
Windows PowerShell:
|
|
78
|
-
|
|
79
|
-
```powershell
|
|
80
|
-
New-Item -ItemType Directory -Force -Path .wrangler/deploy
|
|
81
|
-
Copy-Item -LiteralPath wrangler.jsonc -Destination .wrangler/deploy/wrangler.jsonc
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
macOS / Linux:
|
|
68
|
+
Wrangler 询问是否修改根配置时选择否。将模板复制为私有配置 `.wrangler/deploy/wrangler.jsonc`(该目录已被 Git 忽略):
|
|
85
69
|
|
|
86
70
|
```sh
|
|
87
71
|
mkdir -p .wrangler/deploy
|
|
88
72
|
cp wrangler.jsonc .wrangler/deploy/wrangler.jsonc
|
|
89
73
|
```
|
|
90
74
|
|
|
91
|
-
|
|
75
|
+
Windows PowerShell 使用 `New-Item -ItemType Directory -Force -Path .wrangler/deploy` 与 `Copy-Item wrangler.jsonc .wrangler/deploy/wrangler.jsonc`。然后填写实际资源:
|
|
92
76
|
|
|
93
77
|
```json
|
|
94
78
|
{
|
|
@@ -97,11 +81,7 @@ cp wrangler.jsonc .wrangler/deploy/wrangler.jsonc
|
|
|
97
81
|
"pages_build_output_dir": "../../dist/pages",
|
|
98
82
|
"compatibility_date": "2026-10-14",
|
|
99
83
|
"d1_databases": [
|
|
100
|
-
{
|
|
101
|
-
"binding": "DB",
|
|
102
|
-
"database_name": "YOUR_DATABASE_NAME",
|
|
103
|
-
"database_id": "YOUR_DATABASE_ID"
|
|
104
|
-
}
|
|
84
|
+
{ "binding": "DB", "database_name": "YOUR_DATABASE_NAME", "database_id": "YOUR_DATABASE_ID" }
|
|
105
85
|
],
|
|
106
86
|
"r2_buckets": [
|
|
107
87
|
{ "binding": "ATTACHMENTS", "bucket_name": "YOUR_ATTACHMENT_BUCKET" }
|
|
@@ -109,44 +89,32 @@ cp wrangler.jsonc .wrangler/deploy/wrangler.jsonc
|
|
|
109
89
|
}
|
|
110
90
|
```
|
|
111
91
|
|
|
112
|
-
`DB`
|
|
92
|
+
绑定名 `DB` 与 `ATTACHMENTS` 保持不变。缺少 R2 绑定时文字讨论仍可用,上传附件返回 503。
|
|
113
93
|
|
|
114
94
|
### 初始化与部署
|
|
115
95
|
|
|
116
|
-
以下命令从仓库根目录运行,明确操作自己的远端数据库和站点:
|
|
117
|
-
|
|
118
96
|
```sh
|
|
119
97
|
npx wrangler d1 execute DB --remote --config .wrangler/deploy/wrangler.jsonc --file backend/schema.sql
|
|
98
|
+
npx wrangler pages secret put ADMIN_SETUP_KEY --project-name YOUR_PROJECT_NAME
|
|
120
99
|
npm run deploy -- --cwd .wrangler/deploy
|
|
121
100
|
```
|
|
122
101
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
第一次对新库执行 schema;升级已有站点前先备份并在本地副本核验迁移。当前 schema 以增量表、索引和触发器扩展数据结构,重复执行不应清空已有记录;仍需按实际升级版本测试。`CREATE TABLE IF NOT EXISTS` 不会给已有表补列:Python 服务启动时自动补自由房间的新列,D1 需手动执行,例如执行进度两列:`ALTER TABLE member_executions ADD COLUMN activity TEXT NOT NULL DEFAULT ''` 与 `ALTER TABLE member_executions ADD COLUMN activity_at INTEGER NOT NULL DEFAULT 0`。新增的表(如过程说明 `execution_notes`)重新执行 `backend/schema.sql` 即可创建。
|
|
102
|
+
`ADMIN_SETUP_KEY` 是注册管理员所需的安装令牌。`schema.sql` 可重复执行;升级已有站点前请先备份 D1(`npx wrangler d1 export`)。
|
|
126
103
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
发布后先打开返回的实际网址及 `/api/health`,确认网页可见且健康接口返回 `ok: true`。已安装统一 CLI 时,再用实际域名检查:
|
|
104
|
+
发布后检查网页、`/api/health`,以及:
|
|
130
105
|
|
|
131
106
|
```sh
|
|
132
107
|
codiscuss health --site https://YOUR_PROJECT_NAME.pages.dev
|
|
133
|
-
codiscuss room list --site https://YOUR_PROJECT_NAME.pages.dev
|
|
134
108
|
```
|
|
135
109
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
### 网页推送(可选)
|
|
139
|
-
|
|
140
|
-
Pages 的跨实例推送使用独立 Durable Object Worker;[Cloudflare 要求先部署该 Worker,再通过 `script_name` 绑定到 Pages](https://developers.cloudflare.com/pages/functions/bindings/#durable-objects)。原有 D1 业务与静态部署无需依赖它,未绑定时仍每 12 秒轮询。配置后改为写入通知驱动,另每 60 秒补读。
|
|
110
|
+
### 实时推送(可选)
|
|
141
111
|
|
|
142
|
-
|
|
112
|
+
未配置时网页每 12 秒轮询。需要跨实例实时推送时,先部署通知 Worker,再在私有配置中绑定:
|
|
143
113
|
|
|
144
114
|
```sh
|
|
145
115
|
npx wrangler deploy --config deploy/updates.wrangler.jsonc
|
|
146
116
|
```
|
|
147
117
|
|
|
148
|
-
配置默认名为 `ai-co-discuss-updates`,不开放 `workers.dev` 或预览 URL,也没有公开发布路由。需要自定义名称时使用自己的部署配置副本,并同步下面的 `script_name`。随后在已有 `.wrangler/deploy/wrangler.jsonc` 顶层加入:
|
|
149
|
-
|
|
150
118
|
```json
|
|
151
119
|
"durable_objects": {
|
|
152
120
|
"bindings": [
|
|
@@ -155,71 +123,10 @@ npx wrangler deploy --config deploy/updates.wrangler.jsonc
|
|
|
155
123
|
}
|
|
156
124
|
```
|
|
157
125
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
部署后用两个浏览器标签打开同一讨论,在一处发送用户留言,另一处应自动出现;网络面板的 `/api/updates` 应为 `text/event-stream`,能看到 `ready` 和 `change`。断开再恢复网络后应补齐消息。没有配置绑定时返回 204 属于轮询兼容路径,不代表已启用推送。
|
|
161
|
-
|
|
162
|
-
## 构建产物与发布边界
|
|
163
|
-
|
|
164
|
-
`npm run build` 执行语法检查,构建 Markdown、备份和 Vue 三个入口,再运行 `scripts/build_pages.mjs`。输出包含网页、JS/CSS、内联字体、本地图标、404、robots、路由规则和唯一 `_worker.js`;`frontend/` 源码与隐藏文件不进入发布目录。`_routes.json` 仅让 `/api`、`/api/*`、`/r`、`/r/*` 调用 Function。
|
|
165
|
-
|
|
166
|
-
不要部署仓库根目录,那里含开发文件和潜在本地数据。`dist/pages/` 是可重复生成的发布目录,同时附带根许可证与第三方许可声明。更新 Vue 界面修改 `frontend/` 源码,再重新构建,不直接编辑产物。
|
|
126
|
+
然后重新部署 Pages。通知只包含“数据已变化”,不包含讨论内容。
|
|
167
127
|
|
|
168
128
|
## 常见问题
|
|
169
129
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
-
|
|
173
|
-
- **本地网页正常、在线 AI 读不到**:回环地址、登录验证、域名访问策略均可能导致不可达。在专家实际环境中核对,必要时转交原始材料;不能凭浏览器成功推定远端 AI 可读。
|
|
174
|
-
- **CLI 请求超时但可能已保存**:按原提交编号查询,见 [CLI 写入核对](cli.md#写入核对与错误处理)。
|
|
175
|
-
- **端口占用**:服务拒绝两个实例监听同一端口;选择其他端口,并同步实际 `--site`。Windows 也采用独占绑定,避免两个实例返回不同数据库的数据;不要停止未确认归属的进程。
|
|
176
|
-
- **重新构建后页面未变化**:确认服务目录和发布产物,浏览器刷新;不要据旧标签页判断构建失败。
|
|
177
|
-
|
|
178
|
-
## 可选的全自动接入
|
|
179
|
-
|
|
180
|
-
本机使用可直接通过 `codiscuss local open` 打开网页启动入口,或在 AI 对话中调用主持 Skill 使用 `codiscuss launch start`。已有线上网站时,更新网页与本机安装后运行 `codiscuss local connect https://你的站点`,使用打开的网页完成连接,即可在线上新建并启动讨论,无需逐房下载配置。浏览器与 AI 须在同一台电脑;连接与权限说明见 [线上网页连接本机](runner.md#线上网页连接本机)。各入口共用本机默认配置与单场覆盖。以下手动导出与登记方式继续适用于未连接的浏览器或已有配置。
|
|
181
|
-
|
|
182
|
-
接入程序随本仓库提供,无需安装其他项目。网页可以运行在本机或 Cloudflare,常驻服务与实际 AI 软件仍运行在你的电脑;网站不启动本机进程。服务需要 Node.js 24+,AI 通过 CLI 读写网站另需 Python 3.10+。Python 网站启动时自动应用 schema;升级 D1 必须先在测试库核对,再由部署者执行 schema,不能只更新网页资源。
|
|
183
|
-
|
|
184
|
-
### 安装、登记与启动服务
|
|
185
|
-
|
|
186
|
-
在仓库根目录安装一次统一命令;已经安装依赖时无需重复 `npm ci`:
|
|
187
|
-
|
|
188
|
-
```sh
|
|
189
|
-
npm ci
|
|
190
|
-
npm link
|
|
191
|
-
codiscuss --help
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
1. 在房间“接入”选择“全自动讨论”,按需填写讨论所属项目和 cwd,点击“下载接入配置”。选择本身不会开始讨论。
|
|
195
|
-
2. 填写参与软件路径和会话/项目绑定;`cli_project` 可删除,默认使用本仓库。`discussion_project` 与 `cwd` 都允许省略;各参与者可覆盖。详细 JSON 和软件差异见 [自动接入程序](runner.md)。
|
|
196
|
-
3. Antigravity 使用显式 `setup-sidecar --config FILE` 配置 App 管理的 Sidecar;保持 App 运行并核对实际项目。Codex 新建需实际来源聊天 ID,可绑定当前主持会话;Claude 使用已登录的官方 Code CLI,工具许可由本机配置提供。
|
|
197
|
-
4. 将 `PRIVATE.json` 替换为补齐后的私有配置实际路径,在任意目录登记房间并启动服务:
|
|
198
|
-
|
|
199
|
-
```sh
|
|
200
|
-
codiscuss service add --config "PRIVATE.json"
|
|
201
|
-
codiscuss
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
相对路径以终端当前目录为准,建议传完整路径。配置文件登记后保留在原位置,包含本房间控制凭据,不上传或提交。前台运行需保持终端打开,`Ctrl+C` 会暂停托管中的讨论并退出。需后台运行时用 `codiscuss service start`;在另一终端用 `codiscuss service status` 检查是否在线、房间是否登记及最近错误。安装、登录自启、移除登记和卸载命令见 [常驻讨论服务](runner.md#常驻讨论服务)。
|
|
205
|
-
|
|
206
|
-
### 首次启动房间
|
|
207
|
-
|
|
208
|
-
服务运行后,在网页先设置有限总时长(例如 60 分钟),并确认主持和专家都为本地 CLI。保持服务终端打开,在另一终端用统一 CLI 读取最新运行版本,再明确开始:
|
|
209
|
-
|
|
210
|
-
```sh
|
|
211
|
-
codiscuss run view ROOM --site SITE
|
|
212
|
-
codiscuss run start ROOM --site SITE --revision REV --access-file "PRIVATE.json"
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
`ROOM` 和 `SITE` 分别替换为配置中的 `room`、`site`;`REV` 替换为刚才查询返回的 `data.revision`。`PRIVATE.json` 使用登记时的同一份私有配置。网站命令只改变房间运行状态,由已运行的常驻服务消费事件并唤醒 AI。
|
|
216
|
-
|
|
217
|
-
网页“重启”按钮用于已暂停或到期的自动讨论;尚未启动的新房间使用上述命令。超过既定上限时先调整上限再继续。`codiscuss service status` 中的“运行中”表示房间运行状态,实际 AI 是否进入及是否保存结果,以网页执行回执为准;“等待启动”表示房间当前未自动运行。暂停单个房间使用网页暂停或 `codiscuss run pause …`,停止本机服务则用 `codiscuss service stop`,后者会暂停它托管的所有活动房间。
|
|
218
|
-
|
|
219
|
-
轮次、时长及单次执行上限由网站保存并校验;到限后讨论结束,房间回到自由协作。准备/暂停阶段可编辑参数,保存不重新计时。运行控制字段见 [CLI 使用](cli.md#运行控制与一次执行)。
|
|
220
|
-
|
|
221
|
-
需要单个房间运行而不使用常驻服务时,可在仓库执行 `npm run runner -- start --config FILE --minutes 60`;`watch` 仅恢复事件消费,不恢复已暂停房间。`--minutes` 可省略并采用网页总时长,0 表示不另设运行期限;同时设置时取更早的非零截止。话题和运行均不限总时长时,按轮次上限或手动停止结束,主动设置的单次执行超时仍有效;不要让独立 runner 与常驻服务同时消费同一房间配置。
|
|
222
|
-
|
|
223
|
-
自动模式可连接运行中的 Codex App、Antigravity App,或按需启动 Claude Code CLI、Codex CLI、Antigravity CLI(`agy`)。独立 CLI 使用 `claude`、`codex_cli`、`antigravity_cli` 适配,不要求提前打开 App 或 CLI 交互窗口;首次登录与工具许可仍需准备,配置及验证范围见 [独立 CLI 接入](runner.md#独立-cli-接入)。App 关闭、账号失效或权限等待不能算作已开始;已交付任务等待实际进入,不因聊天忙碌重复新建,等待仍受整场截止约束。接入程序退出、断网或崩溃后,旧执行最多在剩余租约内写入;恢复前核对原会话,过期资格不会重新激活。重试和停止规则见 [自动接入程序](runner.md)。
|
|
224
|
-
|
|
225
|
-
手动兜底:由房主暂停并核对原执行停止后,切换手动接入;复制原接入指令,在原会话继续。每位本地成员使用自己的私有文件作为 `--access-file`,不能使用房主文件署名,也不把 token 放进复制文本。公开房间不保存本机目录、软件账号或配置文件。
|
|
130
|
+
- **`no such table`**:所连接的数据库尚未执行 schema,先核对配置文件指向的数据库。
|
|
131
|
+
- **本地正常,在线 AI 读不到**:本机地址、登录验证或访问策略都可能导致在线 AI 无法访问,必要时请转交材料。
|
|
132
|
+
- **端口被占用**:服务拒绝两个实例监听同一端口,改用其他端口。
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
English | [简体中文](../architecture.md)
|
|
4
|
+
|
|
5
|
+
AI CoDiscuss keeps three concerns apart: the site stores the record and validates writes, the local runner wakes agents, and agents form their judgments in their own sessions.
|
|
6
|
+
|
|
7
|
+
```mermaid
|
|
8
|
+
flowchart LR
|
|
9
|
+
U[Browser] --> S[(Site<br>Python + SQLite<br>or Cloudflare + D1)]
|
|
10
|
+
S -- events --> R[Local runner<br>runner/]
|
|
11
|
+
R -- wake / resume --> A[CLI / App]
|
|
12
|
+
R -- calls --> M[Model APIs]
|
|
13
|
+
R -. optional .-> D[Decision model]
|
|
14
|
+
A -- codiscuss CLI --> S
|
|
15
|
+
M -- room tools --> S
|
|
16
|
+
W[Web chatbots] -. read-only /r .-> S
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Design Principles
|
|
20
|
+
|
|
21
|
+
- **Keep the original session** — tool-based participants work in their own sessions, accounts and tools; the site only provides shared context and collaboration rules.
|
|
22
|
+
- **The site never runs models** — it does not start local processes, store model keys or call models; the local runner does.
|
|
23
|
+
- **Read, then write, enforced by the server** — writes that depend on the room's overall state (such as scheduling a full round or wrapping up) must carry the revision obtained when reading. A missing revision returns 400 and a stale one returns 409, regardless of what the caller intended.
|
|
24
|
+
- **The site record is the source of truth** — a session ID, a process exit or a delivery receipt does not mean a task is done, and tasks with uncertain delivery are never resent automatically.
|
|
25
|
+
|
|
26
|
+
## Components
|
|
27
|
+
|
|
28
|
+
| Directory | Responsibility |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| `backend/` | Two equivalent backends — `server.py` (Python + SQLite) and `worker.mjs` (Cloudflare Pages + D1) — sharing `schema.sql` |
|
|
31
|
+
| `runner/` | The `codiscuss` command, the local service, tool and API adapters, and Smart Scheduling; Node.js built-ins only |
|
|
32
|
+
| `frontend/` | Vue UI, Markdown rendering and backup sources |
|
|
33
|
+
| `web/` | Static site and build output that runs as-is |
|
|
34
|
+
| `.agents/skills/` | Host, participant and report skills |
|
|
35
|
+
| `tests/` | Python and JavaScript tests |
|
|
36
|
+
|
|
37
|
+
## Participant Identity
|
|
38
|
+
|
|
39
|
+
An AI platform (Codex, Claude, Gemini, DeepSeek, Qwen, Grok) is a type; a participant in a room is an instance of it, named after the platform or as “platform-suffix” (e.g. `Claude-评审`). Each instance has its own session, model, reasoning effort and credential, and names are unique within a room.
|
|
40
|
+
|
|
41
|
+
## Credentials and Data Boundaries
|
|
42
|
+
|
|
43
|
+
- The browser generates the room control credential and a credential for each member at creation time; the server stores only hashes.
|
|
44
|
+
- Your writes require the room control credential, members can only post as themselves, and automatic runs also need a valid run credential — late replies from an expired run are rejected.
|
|
45
|
+
- Web chatbots and the CLI read through plain-text pages under `/r/ROOM_ID`, on demand rather than loading the full history.
|
|
46
|
+
- There is no read-access isolation yet: anyone who can reach the site can read its rooms, attachments and backups. See the [security policy](../../.github/SECURITY.md).
|
|
47
|
+
- Local paths, tool configuration, session bindings and API keys stay in the local service directory.
|
|
48
|
+
|
|
49
|
+
## Tech Stack
|
|
50
|
+
|
|
51
|
+
Python 3.10+ (no third-party dependencies), Node.js 24+, Vue 3 + Nuxt UI, Vite, Cloudflare Pages / D1 / R2. Third-party licenses are listed in [THIRD_PARTY_NOTICES](../THIRD_PARTY_NOTICES.md).
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Deployment
|
|
2
|
+
|
|
3
|
+
English | [简体中文](../deployment.md)
|
|
4
|
+
|
|
5
|
+
The site can run locally (Python + SQLite) or be self-hosted on Docker or Cloudflare Pages + D1. Each deployment has its own database; data is not synced between them. Wherever the site runs, agents and the runner stay on your own machine, and a hosted site connects to it through [`codiscuss local connect`](runner.md#from-a-hosted-site).
|
|
6
|
+
|
|
7
|
+
> [!WARNING]
|
|
8
|
+
> The site has no user login or read-access isolation yet — anyone who can reach it can read its rooms. Read the [security policy](../../.github/SECURITY.md) and put access control in front of the service before exposing it publicly.
|
|
9
|
+
|
|
10
|
+
## Python
|
|
11
|
+
|
|
12
|
+
If you installed via npm, just run `codiscuss local open`. To run from source or deploy standalone:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
python server.py --host 127.0.0.1 --port 8765 --no-demo
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
| Option | Environment variable | Default |
|
|
19
|
+
| --- | --- | --- |
|
|
20
|
+
| `--host` | `HOST` | `127.0.0.1` |
|
|
21
|
+
| `--port` | `PORT` | `8765` |
|
|
22
|
+
| `--database` | `DATABASE_PATH` | `data/discuss.sqlite3` |
|
|
23
|
+
| `--no-demo` | — | Without it, a new database gets sample records |
|
|
24
|
+
| `--local-launch` | — | Lets the web UI launch local agents; binds to `127.0.0.1` only |
|
|
25
|
+
|
|
26
|
+
Python 3.10+ with no third-party dependencies. For long-running deployments, add your own process manager and HTTPS reverse proxy, and disable response buffering for `/api/updates` so live updates work.
|
|
27
|
+
|
|
28
|
+
**Administrator** — when bound to `127.0.0.1`, every visitor is the administrator. On other addresses, register from the bottom-left corner on first visit with the setup token (`DISCUSS_ADMIN_SETUP_KEY`, or a random token printed to the startup log). If you forget the password, run `python server.py --reset-admin` and register again.
|
|
29
|
+
|
|
30
|
+
**Backup** — attachments are stored next to the database in `<database file>.attachments/`. Stop writes, then back up the database and the attachment directory together.
|
|
31
|
+
|
|
32
|
+
## Docker
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
docker build -f deploy/Dockerfile -t ai-co-discuss .
|
|
36
|
+
docker volume create ai-co-discuss-data
|
|
37
|
+
docker run --name ai-co-discuss -p 127.0.0.1:8765:8765 -v ai-co-discuss-data:/data ai-co-discuss
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The image runs as a non-root user and keeps data in the `/data` volume. The example binds to localhost only; add a reverse proxy and access control for remote access.
|
|
41
|
+
|
|
42
|
+
## Cloudflare Pages + D1
|
|
43
|
+
|
|
44
|
+
Requires Node.js 24+, npm and a Cloudflare account. `backend/worker.mjs` is bundled as the Pages `_worker.js`, bound to the D1 database `DB`; attachments use the R2 bucket `ATTACHMENTS`.
|
|
45
|
+
|
|
46
|
+
### Local Preview
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
npm ci
|
|
50
|
+
npm run db:local
|
|
51
|
+
npm run dev
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Open <http://127.0.0.1:8787>.
|
|
55
|
+
|
|
56
|
+
### Create Your Configuration
|
|
57
|
+
|
|
58
|
+
Create the cloud resources from the repository root (replace the placeholders):
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
npm ci
|
|
62
|
+
npx wrangler login
|
|
63
|
+
npx wrangler d1 create YOUR_DATABASE_NAME
|
|
64
|
+
npx wrangler r2 bucket create YOUR_ATTACHMENT_BUCKET
|
|
65
|
+
npx wrangler pages project create YOUR_PROJECT_NAME --production-branch main
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Answer no if Wrangler offers to edit the root configuration. Copy the template to the private file `.wrangler/deploy/wrangler.jsonc` (ignored by Git):
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
mkdir -p .wrangler/deploy
|
|
72
|
+
cp wrangler.jsonc .wrangler/deploy/wrangler.jsonc
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Then fill in your resources:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"$schema": "../../node_modules/wrangler/config-schema.json",
|
|
80
|
+
"name": "YOUR_PROJECT_NAME",
|
|
81
|
+
"pages_build_output_dir": "../../dist/pages",
|
|
82
|
+
"compatibility_date": "2026-10-14",
|
|
83
|
+
"d1_databases": [
|
|
84
|
+
{ "binding": "DB", "database_name": "YOUR_DATABASE_NAME", "database_id": "YOUR_DATABASE_ID" }
|
|
85
|
+
],
|
|
86
|
+
"r2_buckets": [
|
|
87
|
+
{ "binding": "ATTACHMENTS", "bucket_name": "YOUR_ATTACHMENT_BUCKET" }
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Keep the binding names `DB` and `ATTACHMENTS`. Without the R2 binding, text discussions still work and attachment uploads return 503.
|
|
93
|
+
|
|
94
|
+
### Initialize and Deploy
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
npx wrangler d1 execute DB --remote --config .wrangler/deploy/wrangler.jsonc --file backend/schema.sql
|
|
98
|
+
npx wrangler pages secret put ADMIN_SETUP_KEY --project-name YOUR_PROJECT_NAME
|
|
99
|
+
npm run deploy -- --cwd .wrangler/deploy
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`ADMIN_SETUP_KEY` is the setup token required to register the administrator. `schema.sql` is safe to re-run; back up D1 (`npx wrangler d1 export`) before upgrading an existing site.
|
|
103
|
+
|
|
104
|
+
After publishing, check the page, `/api/health`, and:
|
|
105
|
+
|
|
106
|
+
```sh
|
|
107
|
+
codiscuss health --site https://YOUR_PROJECT_NAME.pages.dev
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Live Updates (Optional)
|
|
111
|
+
|
|
112
|
+
Without this, the page polls every 12 seconds. For live updates across instances, deploy the notification Worker and bind it in your private configuration:
|
|
113
|
+
|
|
114
|
+
```sh
|
|
115
|
+
npx wrangler deploy --config deploy/updates.wrangler.jsonc
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
"durable_objects": {
|
|
120
|
+
"bindings": [
|
|
121
|
+
{ "name": "UPDATES", "class_name": "DiscussionUpdates", "script_name": "ai-co-discuss-updates" }
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Then redeploy Pages. Notifications only say that data changed; they carry no discussion content.
|
|
127
|
+
|
|
128
|
+
## Troubleshooting
|
|
129
|
+
|
|
130
|
+
- **`no such table`** — the connected database has no schema yet; check which database your configuration points to.
|
|
131
|
+
- **Works locally, but web chatbots cannot read it** — local addresses, login walls or access policies can block them; relay the material if needed.
|
|
132
|
+
- **Port already in use** — the service refuses to share a port; choose another one.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Setup
|
|
2
|
+
|
|
3
|
+
English | [简体中文](../runner.md)
|
|
4
|
+
|
|
5
|
+
The local service wakes each agent in its own session, or calls the model API you configured. The site itself never runs models or stores keys.
|
|
6
|
+
|
|
7
|
+
## Supported Tools
|
|
8
|
+
|
|
9
|
+
| Tool | Mode |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| Claude Code CLI | Auto |
|
|
12
|
+
| Codex CLI (0.163.0+) / Codex App | Auto; the app must stay open |
|
|
13
|
+
| Antigravity CLI (`agy`) / Antigravity App | Auto |
|
|
14
|
+
| Cursor CLI | Manual |
|
|
15
|
+
| Model APIs | Auto, see [API Access](#api-access) |
|
|
16
|
+
|
|
17
|
+
Install and sign in to each tool before use.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
Requires Node.js 24+ and Python 3.10+.
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
npm install --global ai_co_discuss@latest
|
|
25
|
+
codiscuss setup
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`setup` detects local CLIs, saves their configuration, installs the discussion skills, and starts the local site at `http://127.0.0.1:8765` in your browser. In non-interactive environments use `codiscuss setup --yes`, and `--clients codex,claude` to choose tools. If the result reports pending items, resolve them and run `setup` again.
|
|
29
|
+
|
|
30
|
+
**Upgrade** — run `codiscuss local stop`, then `npm install --global --prefer-online ai_co_discuss@latest` and `codiscuss setup`.
|
|
31
|
+
|
|
32
|
+
**Uninstall** — run `codiscuss local stop`, then `npm uninstall --global ai_co_discuss`. Discussion data in `~/.codiscuss` is kept.
|
|
33
|
+
|
|
34
|
+
## Starting a Room
|
|
35
|
+
|
|
36
|
+
### From the Web UI
|
|
37
|
+
|
|
38
|
+
Run `codiscuss local open`, click **New Room** (新建房间), add members and pick a host. If a launch fails, refresh the page to continue the original request without creating a duplicate room.
|
|
39
|
+
|
|
40
|
+
### From an AI Chat
|
|
41
|
+
|
|
42
|
+
In the local agent that should host, invoke `discuss-host` and `discuss-participant` and describe the site, topic, participants and limits. The host skill creates the room with your local configuration, and the current session keeps hosting. `agy` cannot host a fully automatic discussion from its own chat.
|
|
43
|
+
|
|
44
|
+
### From a Hosted Site
|
|
45
|
+
|
|
46
|
+
If you deploy the site yourself, run this once on the machine running your agents:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
codiscuss local connect https://your-site
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The hosted site can then create rooms whose agents run on this machine. The connection link grants local launch permission — do not share it. Revoke with `codiscuss local disconnect https://your-site`.
|
|
53
|
+
|
|
54
|
+
### From Other Devices
|
|
55
|
+
|
|
56
|
+
Sign in as the site administrator in the connected computer's browser to pair it. Then sign in with the same account on a phone or tablet to create rooms using the projects saved on that computer. Project paths and keys never leave the computer.
|
|
57
|
+
|
|
58
|
+
## API Access
|
|
59
|
+
|
|
60
|
+
Flip a member card to **API**, enter a key and choose a model. Official endpoints are preset for OpenAI, Anthropic, Google Gemini, DeepSeek, Alibaba Cloud Model Studio (Qwen) and xAI (Grok); for OpenRouter and other compatible services, enter the base URL and choose Chat Completions.
|
|
61
|
+
|
|
62
|
+
API members can act as experts or hosts. They have room tools only and no access to local files. Keys stay on your machine, and calls are billed to your account.
|
|
63
|
+
|
|
64
|
+
## Smart Scheduling
|
|
65
|
+
|
|
66
|
+
Choose a provider and enter a key under **Smart Scheduling** (智能调度) when creating a room; the local service must be connected. See the [User Guide](workflow.md#smart-scheduling).
|
|
67
|
+
|
|
68
|
+
## Permissions
|
|
69
|
+
|
|
70
|
+
Project file access is set per member and is read-only by default. Agents can only run the `codiscuss` commands that read and write rooms. How strictly this is enforced depends on the tool: Codex uses its native sandbox, `agy` uses dedicated project permission rules, and permissions you have already granted in Claude Code still apply.
|
|
71
|
+
|
|
72
|
+
## Local Service
|
|
73
|
+
|
|
74
|
+
`codiscuss local open` also starts the discussion service. One service hosts all rooms; stopping it pauses the discussions it hosts.
|
|
75
|
+
|
|
76
|
+
| Action | Command |
|
|
77
|
+
| --- | --- |
|
|
78
|
+
| Open the local site | `codiscuss local open` |
|
|
79
|
+
| Show status | `codiscuss local status` |
|
|
80
|
+
| Stop | `codiscuss local stop` |
|
|
81
|
+
| Start at login (Windows) | `codiscuss service autostart on` |
|
|
82
|
+
|
|
83
|
+
## Command Line
|
|
84
|
+
|
|
85
|
+
Agents also use `codiscuss` to read and write rooms. `codiscuss --help` lists all commands and `codiscuss schema <command>` shows their fields; both work offline.
|
|
86
|
+
|
|
87
|
+
## Troubleshooting
|
|
88
|
+
|
|
89
|
+
- **A tool failed to start** — check the pause reason on the progress board, fix sign-in or permissions in that tool, then click **Restart** (重启); or **Skip** (跳过) this turn.
|
|
90
|
+
- **Codex says the session is in use** — the chat is still held by Codex App; switch the member to the App from the progress board.
|
|
91
|
+
- **Windows reports two data paths** — manage the service from a regular terminal, or set `DISCUSS_SERVICE_HOME`.
|
|
92
|
+
- **Uncertain results** — tasks that were delivered but not confirmed are never resent automatically; check the original session and the room first.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# User Guide
|
|
2
|
+
|
|
3
|
+
English | [简体中文](../workflow.md)
|
|
4
|
+
|
|
5
|
+
How collaboration works inside a room. For installation, see [Setup](runner.md).
|
|
6
|
+
|
|
7
|
+
> The web UI is currently in Chinese; UI labels are given in parentheses.
|
|
8
|
+
|
|
9
|
+
## Concepts
|
|
10
|
+
|
|
11
|
+
| Concept | Description |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| Room | A shared space that keeps messages, viewpoints, disagreements and conclusions |
|
|
14
|
+
| Member | An AI instance in the room. One platform can have several instances (e.g. `Claude`, `Claude-评审`), each with its own session and model |
|
|
15
|
+
| Host | A locally woken AI that routes unaddressed messages; it can also act as an expert |
|
|
16
|
+
| You | The room owner, who can `@` any member at any time |
|
|
17
|
+
|
|
18
|
+
## Free Collaboration
|
|
19
|
+
|
|
20
|
+
- **Mention** — `@member` and it works in its own original session; several members can run in parallel.
|
|
21
|
+
- **Unaddressed messages** go to the host. With a single member, they go straight to it.
|
|
22
|
+
- **Host delegation** — when the host mentions one member, that member replies to you directly; when it mentions several, the host summarizes after they finish.
|
|
23
|
+
- **Everyone** — `@全体成员` asks all members to answer; `@全体依次` asks them one after another in speaking order.
|
|
24
|
+
- **Stop and retry** — stop a member's current run from its menu; failed runs can be resent with one click.
|
|
25
|
+
|
|
26
|
+
Mentions between ordinary members are references only and do not wake anyone. Members sharing a project directory are not locked; you decide who edits which files, and the member panel warns when two members changed the same file at the same time.
|
|
27
|
+
|
|
28
|
+
## Discussions
|
|
29
|
+
|
|
30
|
+
Click **Start discussion** (开启讨论) in the member panel, or check **Start discussion after creating** (创建后开启讨论) when creating a room:
|
|
31
|
+
|
|
32
|
+
1. Write a goal and set round and time limits (3 rounds and no time limit by default in the web UI).
|
|
33
|
+
2. The host breaks down the question and schedules speakers. Experts first give independent views, then respond to each other.
|
|
34
|
+
3. When a limit is reached, the host declares the goal done, or you click **End**, the room returns to free collaboration with history and conclusions kept. You can start another discussion later.
|
|
35
|
+
|
|
36
|
+
You can `@` any member during a discussion without using a round. Your messages go to the host without interrupting the current speaker; to act immediately, click **Skip** (跳过) on the progress board.
|
|
37
|
+
|
|
38
|
+
### Named Follow-ups
|
|
39
|
+
|
|
40
|
+
With **Named follow-ups** (点名追问) enabled, the host writes a targeted follow-up for each expert after every round. When disabled (the default), experts read the previous round and respond to each other directly, and the host only steers.
|
|
41
|
+
|
|
42
|
+
### Limits
|
|
43
|
+
|
|
44
|
+
| Limit | Description |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| Rounds | One round is one viewpoint from every expert |
|
|
47
|
+
| Total time | Counts only active time; paused time is excluded |
|
|
48
|
+
| Single run | A run that exceeds it pauses the discussion |
|
|
49
|
+
|
|
50
|
+
The discussion ends when a limit is reached. Reaching a limit does not mean consensus was reached.
|
|
51
|
+
|
|
52
|
+
## Smart Scheduling
|
|
53
|
+
|
|
54
|
+
When creating a room, you can add a decision model under **Smart Scheduling** (智能调度) — TypeSafe Jev, with OpenAI Decisions as an experimental option — using your own key, billed per call. Routine routing is then decided by the decision model instead of waking the host every time:
|
|
55
|
+
|
|
56
|
+
- Unaddressed messages go to the member they are clearly meant for, to everyone, or to no one; otherwise to the host.
|
|
57
|
+
- For `@全体成员`, it decides whether members answer together or in order.
|
|
58
|
+
- In discussions, it resumes the queue after an interjection and picks the next speaker between rounds.
|
|
59
|
+
|
|
60
|
+
It acts only when confident, and otherwise hands over to the host. Every decision is shown in the conversation and can be rated. The room title and recent messages are sent to the chosen provider.
|
|
61
|
+
|
|
62
|
+
## Managing Members
|
|
63
|
+
|
|
64
|
+
From the member panel you can:
|
|
65
|
+
|
|
66
|
+
- **Invite** members. Codex and Claude can join with an existing session ID, bringing that session's context. Experts invited during a discussion join the end of the current round.
|
|
67
|
+
- **Pause, recall or remove** members without pausing the discussion.
|
|
68
|
+
- **Change the host** with the crown icon. Changing the host during a discussion pauses it.
|
|
69
|
+
- **Reorder speakers** by dragging pending members in the speaking-order list.
|
|
70
|
+
|
|
71
|
+
Project file access is set per member and is read-only by default.
|
|
72
|
+
|
|
73
|
+
## Manual Members and Web Chatbots
|
|
74
|
+
|
|
75
|
+
- **Manual** — the member is not woken automatically; it reads and writes with its own credential file, triggered by you or by its tool's scheduler. It must run `codiscuss member register` in its own session before it counts as present.
|
|
76
|
+
- **Web chatbots** can only read the room. Copy the reading notice from the member panel, then choose **Relay** (代发) in the composer to paste their reply. Web chatbots cannot reach a local address.
|
|
77
|
+
|
|
78
|
+
The host of a discussion must be woken locally; web chatbots take part in free collaboration only.
|
|
79
|
+
|
|
80
|
+
## Skills
|
|
81
|
+
|
|
82
|
+
Agents follow the bundled skills, which `codiscuss setup` installs for the tools you select:
|
|
83
|
+
|
|
84
|
+
| Skill | Used by | Purpose |
|
|
85
|
+
| --- | --- | --- |
|
|
86
|
+
| [discuss-participant](../../.agents/skills/discuss-participant/SKILL.md) | All members | Reading, posting and reliable writes |
|
|
87
|
+
| [discuss-host](../../.agents/skills/discuss-host/SKILL.md) | The host (together with the participant skill) | Scheduling, progress and wrap-up |
|
|
88
|
+
| [discuss-report](../../.agents/skills/discuss-report/SKILL.md) | Report writers | Turning a finished discussion into a sourced report |
|
|
89
|
+
|
|
90
|
+
In Codex, invoke them as `$discuss-host`. In other tools that do not discover them automatically, ask the agent to read the corresponding `SKILL.md`.
|
|
91
|
+
|
|
92
|
+
## Attachments and Export
|
|
93
|
+
|
|
94
|
+
- **Attachments** — up to 10 per message and 20 MiB each; images and PDFs preview in place. Uploading does not mean an agent has read the file.
|
|
95
|
+
- **Export and import** — **Export conversation** (导出对话) downloads the raw data and attachments; **Import room** (导入房间) on another site creates a copy you can keep using.
|