ai_co_discuss 0.5.42 → 0.5.44
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 +5 -1
- package/.agents/skills/discuss-host/references/control.md +1 -1
- package/.agents/skills/discuss-host/references/members.md +1 -1
- package/.agents/skills/discuss-host/references/room.md +1 -0
- package/.agents/skills/discuss-participant/SKILL.md +2 -3
- package/.agents/skills/discuss-participant/references/interactive-html.md +11 -10
- package/.agents/skills/discuss-participant/references/room.md +1 -0
- package/.agents/skills/discuss-session/references/host-closing.md +1 -1
- package/.agents/steward-skills/cloudflare-deploy/SKILL.md +31 -0
- package/.agents/steward-skills/codiscuss-draft-cleanup/SKILL.md +28 -0
- package/.agents/steward-skills/codiscuss-draft-cleanup/cleanup.py +138 -0
- package/.agents/steward-skills/codiscuss-draft-cleanup/scan.py +156 -0
- package/.agents/steward-skills/codiscuss-help/SKILL.md +20 -0
- package/.agents/{skills → steward-skills}/discuss-report/SKILL.md +5 -5
- package/.agents/steward-skills/dispatch-analysis/SKILL.md +37 -0
- package/.agents/steward-skills/moss-core/SKILL.md +40 -0
- package/.agents/steward-skills/notify-setup/SKILL.md +54 -0
- package/.agents/steward-skills/notify-setup/references/channels.md +41 -0
- package/.agents/steward-skills/notify-setup/references/onebot.md +48 -0
- package/.agents/steward-skills/rooms-overview/SKILL.md +14 -0
- package/README.md +46 -13
- package/README.zh-CN.md +47 -14
- package/backend/analytics.py +81 -9
- package/backend/analytics_dispatch.py +107 -0
- package/backend/analytics_issues.py +165 -8
- package/backend/analytics_live.py +135 -0
- package/backend/attachment_policy.json +1 -0
- package/backend/cloud_drive.py +683 -0
- package/backend/cloud_share_routes.mjs +16 -0
- package/backend/cloud_shares.py +315 -0
- package/backend/external_members.py +625 -1
- package/backend/free_room.py +384 -17
- package/backend/message_queue.py +7 -3
- package/backend/migrations/drop_legacy_discussion.sql +5 -0
- package/backend/moss_results.py +300 -0
- package/backend/object_storage.py +285 -0
- package/backend/room_import.py +13 -4
- package/backend/schema.sql +197 -2
- package/backend/server.py +1996 -133
- package/docs/deployment.md +2 -0
- package/docs/en/deployment.md +2 -0
- package/docs/en/guide/README.md +1 -0
- package/docs/en/guide/admin.md +49 -2
- package/docs/en/guide/analytics.md +12 -2
- package/docs/en/guide/cli.md +11 -1
- package/docs/en/guide/discussion.md +2 -4
- package/docs/en/guide/external-members.md +2 -0
- package/docs/en/guide/members.md +11 -2
- package/docs/en/guide/remote.md +35 -1
- package/docs/en/guide/rooms.md +25 -11
- package/docs/en/guide/steward.md +57 -0
- package/docs/en/guide/voice.md +16 -6
- package/docs/en/guide/workflows.md +1 -1
- package/docs/en/guide/working.md +2 -1
- package/docs/guide/README.md +1 -0
- package/docs/guide/admin.md +49 -2
- package/docs/guide/analytics.md +12 -2
- package/docs/guide/cli.md +11 -1
- package/docs/guide/discussion.md +3 -5
- package/docs/guide/external-members.md +2 -0
- package/docs/guide/members.md +11 -2
- package/docs/guide/remote.md +34 -1
- package/docs/guide/rooms.md +25 -11
- package/docs/guide/steward.md +57 -0
- package/docs/guide/voice.md +16 -6
- package/docs/guide/workflows.md +1 -1
- package/docs/guide/working.md +2 -1
- package/frontend/locales/en/admin.json +40 -5
- package/frontend/locales/en/analytics.json +67 -5
- package/frontend/locales/en/app.json +156 -3
- package/frontend/locales/en/backend.json +75 -3
- package/frontend/locales/en/core.json +2 -2
- package/frontend/locales/en/discussion.json +2 -1
- package/frontend/locales/en/external.json +1 -0
- package/frontend/locales/en/guest.json +127 -0
- package/frontend/locales/en/room.json +48 -5
- package/frontend/locales/en/settings.json +60 -8
- package/frontend/locales/en/steward.json +122 -0
- package/gateway/cloud_share.mjs +20 -0
- package/gateway/direct.mjs +44 -12
- package/gateway/gateway.mjs +36 -5
- package/package.json +21 -8
- package/runner/adapters/antigravity_app.mjs +2 -1
- package/runner/adapters/antigravity_cli.mjs +131 -7
- package/runner/adapters/api.mjs +41 -4
- package/runner/adapters/claude.mjs +95 -18
- package/runner/adapters/claude_lockdown_hook.mjs +90 -0
- package/runner/adapters/cli.mjs +17 -10
- package/runner/adapters/codex_app.mjs +23 -8
- package/runner/adapters/codex_cli.mjs +71 -1
- package/runner/adapters/index.mjs +64 -0
- package/runner/adapters/profiles.mjs +17 -2
- package/runner/admin_cli.mjs +108 -4
- package/runner/admin_panel.mjs +180 -17
- package/runner/attachment_policy.mjs +212 -0
- package/runner/channel_bot.mjs +121 -0
- package/runner/channel_discord.mjs +84 -0
- package/runner/channel_feishu.mjs +209 -0
- package/runner/channel_onebot.mjs +128 -0
- package/runner/channel_qq.mjs +185 -0
- package/runner/channel_telegram.mjs +54 -0
- package/runner/channels.mjs +336 -0
- package/runner/codiscuss.mjs +33 -3
- package/runner/device_auth.mjs +99 -15
- package/runner/direct_entry.mjs +75 -16
- package/runner/discuss.py +358 -26
- package/runner/discussion_api.mjs +6 -1
- package/runner/discussion_launch.mjs +554 -56
- package/runner/discussion_local.mjs +2 -1
- package/runner/discussion_service.mjs +66 -5
- package/runner/discussion_setup.mjs +7 -3
- package/runner/discussion_skills.mjs +64 -2
- package/runner/expert_prompts.mjs +15 -3
- package/runner/external_client.mjs +4 -8
- package/runner/external_gateway.mjs +198 -17
- package/runner/free_runner.mjs +350 -45
- package/runner/host_permissions.mjs +40 -0
- package/runner/i18n_en.mjs +205 -1
- package/runner/network_log.mjs +206 -0
- package/runner/notice_text.mjs +61 -0
- package/runner/object_storage_signer.mjs +209 -0
- package/runner/os_users.mjs +15 -3
- package/runner/project_cloud.mjs +381 -0
- package/runner/project_manage.mjs +15 -2
- package/runner/relay_channel.mjs +162 -69
- package/runner/relay_timing.mjs +1 -0
- package/runner/remote_launch.mjs +21 -14
- package/runner/share_shared.mjs +2 -1
- package/runner/site_deploy.mjs +25 -0
- package/runner/steward.mjs +240 -0
- package/runner/steward_proactive.mjs +150 -0
- package/runner/storage_guard.mjs +8 -8
- package/runner/stt.mjs +2 -1
- package/runner/tts.mjs +2 -1
- package/runner/tts_providers.mjs +12 -12
- package/runner/vendor/larksuite-ws/LICENSE +9 -0
- package/runner/vendor/larksuite-ws/SOURCE.md +5 -0
- package/runner/vendor/larksuite-ws/client.mjs +109 -0
- package/runner/vendor/larksuite-ws/frame.mjs +82 -0
- package/runner/vendor/node-telegram-bot-api/LICENSE.md +21 -0
- package/runner/vendor/node-telegram-bot-api/SOURCE.md +5 -0
- package/runner/vendor/node-telegram-bot-api/text.mjs +36 -0
- package/runner/vendor/oceanic/LICENSE +21 -0
- package/runner/vendor/oceanic/SOURCE.md +5 -0
- package/runner/vendor/oceanic/gateway.mjs +94 -0
- package/runner/vendor/qqbot-nodejs/LICENSE +21 -0
- package/runner/vendor/qqbot-nodejs/SOURCE.md +7 -0
- package/runner/vendor/qqbot-nodejs/codec.mjs +31 -0
- package/runner/vendor/qqbot-nodejs/constants.mjs +97 -0
- package/runner/vendor/qqbot-nodejs/errors.mjs +23 -0
- package/runner/vendor/qqbot-nodejs/event-dispatcher.mjs +51 -0
- package/runner/vendor/qqbot-nodejs/gateway-connection.mjs +473 -0
- package/runner/vendor/qqbot-nodejs/reconnect.mjs +164 -0
- package/runner/vendor/qqbot-nodejs/rest.mjs +102 -0
- package/runner/weixin.mjs +72 -174
- package/runner/workflows.mjs +26 -3
- package/web/admin.css +1 -1
- package/web/admin.js +12 -12
- package/web/app.js +782 -77
- package/web/guest/index.html +17 -0
- package/web/guest.css +2 -0
- package/web/guest.js +287 -0
- package/web/i18n.js +4 -4
- package/web/icons/external-user.svg +12 -0
- package/web/join.html +2 -1
- package/web/markdown.css +1 -1
- package/web/modern.css +1 -1
- package/web/modern.js +75 -72
- package/.agents/skills/codiscuss-draft-cleanup/SKILL.md +0 -16
- package/.agents/skills/codiscuss-draft-cleanup/cleanup.py +0 -70
- package/.agents/skills/codiscuss-draft-cleanup/scan.py +0 -70
- /package/.agents/{skills → steward-skills}/discuss-report/agents/openai.yaml +0 -0
- /package/.agents/{skills → steward-skills}/discuss-report/assets/Discussion_Report_Template.md +0 -0
- /package/.agents/{skills → steward-skills}/local-stt-setup/SKILL.md +0 -0
- /package/.agents/{skills → steward-skills}/local-tts-setup/SKILL.md +0 -0
- /package/.agents/{skills → steward-skills}/share-card/SKILL.md +0 -0
- /package/.agents/{skills → steward-skills}/share-card/references/share-card.md +0 -0
|
@@ -29,8 +29,12 @@ description: "AI CoDiscuss 的主持技能,仅主持人调用,且须同时
|
|
|
29
29
|
|
|
30
30
|
## 主持判断
|
|
31
31
|
|
|
32
|
+
父房间是 MOSS 时,遇到需要上一级决定的事,先用 `launch host-control room-post --room 父房间编号 --body-file FILE --expect reply` 问 MOSS,不直接向用户发提问卡。只有 MOSS 明确转达的用户答复才作为用户的决定。
|
|
33
|
+
|
|
34
|
+
**开工与提交分开判断。** 用户已经让你执行时,在既有授权内,有明确建议且可撤销的决定直接按建议做,回答末尾列出“我替你定了这几条,不同意随时改”(停下来等回话常常一等几个小时,可撤销的决定事后改代价小)。尚未获得明确授权时,提交、推送、部署、扩大权限、花钱、删除等有外部影响或不可撤销的操作必须停在该操作之前问用户。要问能不能提交,不妨碍先改文件、验证和准备交付。会改变任务方向的关键歧义也要问用户。更宽的常设授权由用户自己在“设置 → 系统提示词 → 主持人”里填写,不代改配置。
|
|
35
|
+
|
|
32
36
|
怎么规划由你判断;只在会改变方向的关键歧义处向用户确认。派活写清谁做什么、做到什么程度,怎么拆、按什么步骤做交给成员——他们背后的软件自己会规划。执行性工作(读长文、写汇总、核对证据、跑测试)派给成员,你做判断、裁定与汇总,上下文与额度留给整个房间的推进。用户的倾向、成员意见一致都不等于已验证事实。
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
用户没指定人选、要你自己挑人或挑模型时(分派、换模型或强度、邀请成员、组织讨论),参考你收到的“用户给本机房间主持人的提示”(用户自己的派活与选人偏好,如哪家额度多、谁擅长什么)、`room view` 的 `descriptions`(用户写的各成员擅长与分工)和 [成员分工参考](references/members.md)(各家模型的公开长短)。用户明确要你记下或改掉这类偏好时,先 `codiscuss launch prompts get host` 读出全文,改好后写进草稿,再 `codiscuss launch prompts set host --file 草稿` 整份保存,并在回答里写明改了什么;用户没要求不改。用户纠正你的派活(改派、换模型或强度、说“这类活别给某某”)且看得出是长期偏好、不只是这一次的安排时,照做之后在同一条回答末尾问一句要不要记进主持人提示词;同类纠正问过就不再问。(纠正不沉淀,下次照旧派错。)命令被拒(只读)就请用户到“设置 → 系统提示词 → 主持人”里改。成员带 `external` 字段的是外部成员,在另一台电脑上运行:点名后可能要等对方同意才开始,对方拒绝或超时时请求带 `external_outcome` 并被取消;它只能读 `external.directories` 里的目录、提交自己的回答,不能派活。出图、改图优先派给能看图的本机软件成员,它能下载附件自查效果;没有 `image` 字段时请用户在“协作设置”添加生图卡片。
|
|
35
39
|
|
|
36
40
|
任务带 `scheduler_suggestions` 时,那是智能调度说明某条消息或交接为何交给你(附置信度),不是用户指令,也未核实:按其中的 `request_id`、`message_id` 先读原文再决定是否采纳,需要依据时 `state decision ROOM DECISION_ID`。`applied:false` 表示未自动生效,`actual_action:unverified` 表示结果尚未核验;没有记录编号时不假定模型给过建议。
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
|
|
47
47
|
用 `launch host-control room-post --room 编号 --body-file FILE --expect reply` 交给对方主持人,普通通知用 `--expect none`;短消息可用 `--text`。对方忙时排队,只有父房间能用 `--interrupt` 打断子房间。达到互传上限时,请房主决定是否继续。
|
|
48
48
|
|
|
49
|
-
跨房请求用 `requests[].relay.reply` 中的命令回答:`launch host-control room-post --room 来源房编号 --reply-to 原消息编号 --body-file 回答.md`。先读原文,在本房权限内处理;发送或排队成功即完成该请求,本房发送卡片保留全文。若先派活,收尾时用原消息编号手动回传。若 `relay.expect` 为 `none
|
|
49
|
+
跨房请求用 `requests[].relay.reply` 中的命令回答:`launch host-control room-post --room 来源房编号 --reply-to 原消息编号 --body-file 回答.md`。先读原文,在本房权限内处理;发送或排队成功即完成该请求,本房发送卡片保留全文。若先派活,收尾时用原消息编号手动回传。若 `relay.expect` 为 `none`,读完即止。超出本房权限时在本房问用户,父房间是 MOSS 时按主持技能先问 MOSS。
|
|
50
50
|
|
|
51
51
|
## 定时检查
|
|
52
52
|
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
默认做法:在回答里用 `--to` 点名、写清分工,其余参数按需加;完整写法查 `message post --help-host`(普通 `--help` 只列成员能用的)。
|
|
29
29
|
|
|
30
30
|
- 需要他人时加 `--to 显示名`(可重复,不能点名自己),写明各自负责的文件或模块;不需要他人时不加,本次即结束。派活正文要能独立看懂:直接写要做的事、材料编号与完成标准,不写“同上”“见前文”。
|
|
31
|
+
- **写明分工理由**:人选、模型或强度是你自己挑的(用户没指定)时,派活正文末尾单独一行 `分工理由:…`,每位一句,写出依据的出处:主持人提示词的哪条、成员描述、本房间哪次表现(消息编号)或成员分工参考的哪项;不写“擅长代码”这类没有出处的话。用户已指定人选与模型时不写。(用户据此当场纠正;复盘按这一行统计。)
|
|
31
32
|
- **主线与支线**:你安排的发言顺序(`--sequential` 接力)是主线;你或用户直接点名某位成员是支线,不占发言顺序,与主线并行。被点名的成员空闲时立即开始,正忙时排在它手上的工作之后、不打断;轮到它的主线那一棒时若还在做支线,主线等它做完再继续。用户直接点名成员不会唤醒你,也不交回你;任务的 `branches` 列出这些仍在进行的支线(成员、消息编号),派活前先读,避开它们正在改的文件。
|
|
32
33
|
- 派出的工作无论点名几位,全部结束(含失败)后都交回你。只点名一位、它的回答足以直接给用户(简单问答、无需验收)时可加 `--no-handoff`(API 为 `no_handoff: true`),做完不再交回,失败仍交回你;要评审、验证或接着安排的不加。它仍占住房间(用户未点名的消息要排队),不是后台;要后台做、不等它,用 `--detach`(见 [接力](relay.md)“后台成员”)。
|
|
33
34
|
- 本次执行不便接着做、但还要继续时(等成员的结果之外还要复查、分几步推进),加 `--continue 继续做什么`(API 为 `continue`):房间没有其他进行中的工作时,程序再唤醒你一次;“进行中的工作”包括不交回你的成员(`--no-handoff`、`--detach` 派出的),它们做完之前不会唤醒你。派活后要自己马上接着做、不等它们,用 `--keep-working`(见 [接力](relay.md))。你下次回答不带它、或用户发了新消息就取消,仍需要就重新带上。不要用它等用户回复(需要用户决定时见参与技能 [回答房间请求](../../discuss-participant/references/room.md)“需要用户决定时”);Goal 进行中由 Goal 负责空闲续跑,不必加。
|
|
@@ -19,7 +19,6 @@ description: "AI CoDiscuss 的通用参与技能,所有参与者(包括主
|
|
|
19
19
|
| 写入结果不明、被拒、超长正文 | [写入与恢复](references/writing.md) |
|
|
20
20
|
| 接力(`sequence`)、向用户提问(`question`)、生图(`image`)、主动发言 | [按需场景](references/situations.md) |
|
|
21
21
|
| 用户要求“图文并茂”,或一张图、一个可操作的演示比文字讲得更清楚(交互式可视化,正文里的 `visual` 代码块) | [交付交互式可视化](references/interactive-html.md) |
|
|
22
|
-
| 为本房间或指定房间制作分享卡封面 | [share-card](../share-card/SKILL.md) |
|
|
23
22
|
|
|
24
23
|
## 硬约束
|
|
25
24
|
|
|
@@ -55,11 +54,11 @@ description: "AI CoDiscuss 的通用参与技能,所有参与者(包括主
|
|
|
55
54
|
|
|
56
55
|
用请求者使用的语言回答,结论先行;篇幅与结构由你按问题决定。正文约 300 字以上或分多段时写摘要:给只听语音播报的人,约 15 秒念完(不超过约 80 字),用能直接念出口的话、不用列表和编号。
|
|
57
56
|
|
|
58
|
-
|
|
57
|
+
**图文并茂**:讲结构、流程、对比、数据或参数影响时,可以主动配图,不必等用户要求;用户说“图文并茂”时一定配。怎么表现由你判断。房间里的事实:正文里的 `visual` 代码块(见 [交付交互式可视化](references/interactive-html.md))跟随房间深浅色、按屏幕宽度自适应、可以操作;图片附件是固定的像素和配色。
|
|
59
58
|
|
|
60
59
|
**给人看的成品默认作为附件交付**:这次新建或改出、请求者要看或要拿走的结果(文档、表格、幻灯片、PDF、图片、音视频、放不进正文的大网页,或它们的打包;要在正文里直接运行的页面写成 `visual` 代码块,不另附),上传为附件,正文用 `[文件 #n]`(图片 `[图片 #n]`)引用(n 是该文件在本条 `--attachment` 中的先后序号,从 1 起,不是附件 ID;提交后程序换成房间内的统一编号);改了已交付的成品就附上新版。(附件随消息保存、卡片内直接预览,分享页、其他设备和外部成员都看得到;项目文件之后会变,也只有能读这台电脑的人看得到。)项目源码与配置的修改、中间产物和日志不附(执行卡片已显示文件差异)。用户说了只放项目里的也不附,正文用反引号写出它的项目路径(如 `合同.docx`),回答下方会出现该文件的卡片。
|
|
61
60
|
|
|
62
|
-
附件先 `attachment upload ROOM --file FILE --submission-id 上传编号`,再 `message post --attachment ID`(最多 10
|
|
61
|
+
附件先 `attachment upload ROOM --file FILE --submission-id 上传编号`,再 `message post --attachment ID`(最多 10 个,单个大小上限由管理员设置、默认 50 MiB,须在执行资格结束前上传)。
|
|
63
62
|
|
|
64
63
|
**网站**:做出多文件网页(如构建出的 `dist/`)时,用 `site stage --dir 目录` 登记为待部署,回答下方会出现“部署为网站”卡片,由用户决定是否上线。只有请求者在本房间明确要求部署或发布时,才用 `site publish --dir 目录`(更新已有站点加 `--site 编号`)直接上线,并在回答里写出网址;预检拒绝时如实说明,不绕过。(上线即公开,任何拿到地址的人都能打开。)
|
|
65
64
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 交付交互式可视化
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
用于在回答正文里放图示或可操作的演示。画什么、要不要用由你决定;本页写房间网页怎样显示它、给了页面什么、有哪些限制。
|
|
4
4
|
|
|
5
5
|
## 写法:正文里的 `visual` 代码块
|
|
6
6
|
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
## 向用户收集选择
|
|
27
27
|
|
|
28
|
-
**问题卡能表达的都用问题卡**(见 [按需场景](situations.md)
|
|
28
|
+
**问题卡能表达的都用问题卡**(见 [按需场景](situations.md)“向用户提问”):单选、多选、逐条选一档、补一句说明,即使条目很多也一样,问题卡还能阻塞等待、答完交回提问者。问题卡做不到时才考虑把可视化做成提问面板,常见的是这三种:
|
|
29
29
|
|
|
30
30
|
1. 选项之间要联动计算:改一个值,结果、排名或总量当场变化,用户要看着结果做决定(如调权重看方案排名)。
|
|
31
31
|
2. 量是连续的:比例、权重、阈值、时间点。
|
|
@@ -38,12 +38,13 @@
|
|
|
38
38
|
- 优先用原生控件(滑块、复选框、下拉框);拖拽只作增强,同时提供上移、下移按钮。
|
|
39
39
|
- 面板里的得分、估算由你给出时,写明依据,凭判断的标“假设”;交回的结论带上前提(如“在这组得分下选 A”),别让精确的数字显得比依据更可靠。
|
|
40
40
|
|
|
41
|
-
##
|
|
41
|
+
## 外观
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
43
|
+
目标是读起来像正文里的插图,在电脑和手机竖屏、深浅两种主题下都好用(用户另有要求除外)。怎么画由你判断;下面是房间这边的事实:
|
|
44
|
+
|
|
45
|
+
- **宽度**:显示宽度等于正文栏,电脑上约 600–800px,手机约 340px。`cd-*` 布局类在窄屏会自动换行。SVG 加 `class="cd-chart"` 后图形随栏宽缩放,文字和线条保持屏幕上约 12px 不缩小,所以手机上图形变小而字不变:`viewBox` 太宽时图形会挤,文字周围要留余量。
|
|
46
|
+
- **颜色**:深浅色由房间决定,只有引用下表变量的颜色会跟着变;写死的颜色在另一套主题下可能看不清。
|
|
47
|
+
- **控件**:下面的统一样式已注入,用它们与站内控件一致,也省代码;表达不了时再写自己的 CSS。
|
|
47
48
|
|
|
48
49
|
## 统一样式
|
|
49
50
|
|
|
@@ -57,7 +58,7 @@
|
|
|
57
58
|
| `cd-stack` / `cd-row` / `cd-between` / `cd-grid` | 纵向间距 / 横排可换行 / 两端对齐可换行 / 自适应多列(窄屏变一列) |
|
|
58
59
|
| `cd-stats` + `cd-stat` | 关键数字行:`<div class="cd-stat"><b>40.8</b><span>射程 m</span></div>` |
|
|
59
60
|
| `cd-field` | 一行参数:`<label class="cd-field"><span>角度</span><input type="range"><output></output></label>`,手机上滑块自动换到下一行 |
|
|
60
|
-
| `cd-primary` |
|
|
61
|
+
| `cd-primary` | 主操作按钮(强调色淡底) |
|
|
61
62
|
| `cd-tabs` | 分段切换:内放 `button`,选中项写 `aria-pressed="true"` |
|
|
62
63
|
| `cd-card` | 需要与背景区分的色块(正文色的淡底,深浅色下都看得出) |
|
|
63
64
|
| `cd-muted` / `cd-hint` / `cd-accent` | 次要文字 / 提示小字 / 强调色文字 |
|
|
@@ -91,11 +92,11 @@
|
|
|
91
92
|
- **颜色只用变量,并写兜底值**:如 `var(--codiscuss-accent, #2563eb)`。放大的预览窗口、手机全屏和新标签页也注入房间主题,兜底值用于变量到达前或下载后直接打开时。不写 `prefers-color-scheme`,深浅色由房间决定。
|
|
92
93
|
- **颜色写在 CSS 里**(SVG 用 `fill`、`stroke` 引用变量),不在脚本里读一次存起来:变量晚于页面脚本到达,切换主题时还会变。
|
|
93
94
|
- **不写固定高度**:房间测量 `body` 的实际高度来定显示高度,内容多高就显示多高,框内不出现滚动条。不用 `100vh`、`height: 100%` 撑满:框的高度就是量到的内容高度,撑满后不会再缩回去;页面很长时考虑拆成几块或用分步切换。
|
|
94
|
-
- **不写固定宽度**:显示宽度等于正文栏,随窗口变化;预览窗口更宽。内容设宽度上限并居中,窄到 320px 时仍能用。字号用 `em
|
|
95
|
+
- **不写固定宽度**:显示宽度等于正文栏,随窗口变化;预览窗口更宽。内容设宽度上限并居中,窄到 320px 时仍能用。字号用 `em`,跟随房间字号。
|
|
95
96
|
- **没有网络**:外部脚本、样式、字体、图片和 `fetch` 都被拦截,CDN 上的库载不进来。CSS、JS、数据都写进代码块;图片用 data URL 或内联 SVG。
|
|
96
97
|
- **只能运行脚本**:`alert`、`confirm`、打开新窗口、提交表单都不可用。页面读不到房间、网站接口和 Cookie,`localStorage` 不可用(读写放进 `try`)。页面不能写回房间,也不能唤醒成员。
|
|
97
98
|
- **状态不会保存**:页面滚到附近才开始运行,之后一直保留;但收起、切换房间或刷新后会重新运行,用户调过的参数回到初始值。默认参数要能说明问题。
|
|
98
|
-
-
|
|
99
|
+
- **结论写在正文**:只读分享页和语音播报只显示“交互式可视化”一行,不运行页面;长回答折叠时只露出页面顶部。结论、关键数字、默认参数下看到的结果要写在正文文字里。
|
|
99
100
|
- **自查**:交付前读一遍代码,确认没有引用本机路径、没有写入密钥。
|
|
100
101
|
|
|
101
102
|
## 示例
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
## 需要用户决定时
|
|
13
13
|
|
|
14
14
|
- **要等这个回答才能继续(阻塞)**:用 `question ask`(写法见 [按需场景](situations.md)),程序会等用户,答案作为新请求交回你;Goal 进行中有未答的阻塞提问时,程序也不再空闲唤醒主持人。
|
|
15
|
+
- **回答本身就在等用户放行**(方案要拍板、几项决定一起问、等用户验收):提交回答时加 `--awaiting-user`。房主在本房间发消息即结束这次停等,满 3 分钟未回会经房主的默认消息渠道提醒一次。(不带标记的停顿,程序当作已经做完,用户收不到任何提醒。)已用阻塞提问或 Goal 待确认表达同一件事、仍有可推进的工作,或只是想听意见时不加。
|
|
15
16
|
- **顺带问一句、不等回答也能推进**:直接在回答里问,同时派出或完成不依赖答案的工作。
|
|
16
17
|
- Goal 主持人要等的是用户去做某件事(授权、登录、补材料)而不是回答一道题时,用 `goal state --state pending` 声明待用户确认(见 discuss-goal),同时在回答里写明要用户做什么。
|
|
17
18
|
|
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
3. 目标已完成且无阻碍时,用 `room limits ROOM --done --conclusion <revision> --as 本人` 收束(也可 `mode view ROOM` 取 revision 后 `mode done ROOM --revision <revision>`,效果相同)。到限则用 `room limits ROOM --check --as 本人`。有未处理留言、state 落后或仍有排队安排会被拒绝;状态变化后 revision 失效需重取。成功后讨论结束,本次执行随之完成,不再补 chat 回执。
|
|
17
17
|
4. 讨论期间用户交代了“讨论结束后”要做的事(派人实现、测试、写文档等)时,收束时加 `--continue "继续做什么"`:讨论结束、房间空闲后程序再唤醒你一次,届时按普通房间请求派活。不带它就没有人会再唤醒你,回过一句“收到”不算交接。
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
最终总结按议题组织结论、不同意见、重要条件与未验证影响,不强制固定栏目。用户需要独立归档报告时,可将房间与消息范围交给平台主理人;报告不表示建议已获采纳。
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cloudflare-deploy
|
|
3
|
+
description: "为用户自己的 Cloudflare 账号部署或更新 AI CoDiscuss 线上站点。Deploy or update the user's own AI CoDiscuss Cloudflare site for paired-device access."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 部署自己的 Cloudflare 线上站点 / Deploy your own Cloudflare site
|
|
7
|
+
|
|
8
|
+
仅部署用户自有的共议 Pages 站点、D1 和中转 Worker,不发布 npm、不操作官方分享站或托管服务。线上站点不保存房间,也不启动 AI;已配对设备经中转访问仍在本机运行的服务。
|
|
9
|
+
|
|
10
|
+
## 确定源码与目标 / Source and target
|
|
11
|
+
|
|
12
|
+
1. 需要 Node.js 24+、npm、用户自己的 Cloudflare 账号以及带 `backend/worker.mjs`、构建脚本和 `docs/deployment.md` 的源码工作目录。先核对目标是新建还是升级、目标版本和现有资源。使用选定源码版本的 `docs/deployment.md`(英语 `docs/en/deployment.md`)与 `.github/SECURITY.md`,不要把 npm 安装目录误当源码仓库。
|
|
13
|
+
2. 找不到合适源码时,核实当前 `codiscuss` 命令对应的安装包,从该包 `package.json` 的 `repository.url` 取得仓库地址(Git 命令去掉 `git+`)。产品版本取 `codiscuss local status --json` 的 `version`,并与该包 `package.json` 的 `version` 核对,一致时用 `v<版本>` 作标签;不一致(本机服务还在跑旧版)时向用户说明,由用户决定。`codiscuss --version` 是房间 CLI 的协议版本,不是产品版本,不要用它选标签。若连命令对应的安装包也不能确认,先解决版本冲突,不猜标签。列出仓库、标签、主理人工作目录下拟用的全新子目录与命令,**经用户同意后**,用 `git clone --branch <标签> --single-branch <仓库地址> <新目录>` 获取源码并核对标签和 `package.json` 版本。标签不存在或版本不符就停下,不回退到默认分支,也不切换或覆盖其他人正在使用的工作区。
|
|
14
|
+
3. 用户的私有部署配置和备份只放在选定源码下已被 Git 忽略的 `.wrangler/deploy/`。根目录 `wrangler.jsonc` 等已跟踪文件只作为模板。使用 Wrangler 直接部署构建出的页面,不连接 Git 自动构建。已有配置先确认归属与是否复用,不复述凭据或把它们写进房间、命令参数或跟踪文件。
|
|
15
|
+
|
|
16
|
+
If source is missing, obtain consent to clone the repository named in the installed package at the tag `v<version>`, where the version is the `version` from `codiscuss local status --json` and matches the installed package's `package.json`. `codiscuss --version` reports the room CLI protocol version, not the product version. Use an unused subdirectory of the steward's working directory. Keep private configuration and backups under `.wrangler/deploy/` in that checkout.
|
|
17
|
+
|
|
18
|
+
## 执行与确认 / Deploy and confirm
|
|
19
|
+
|
|
20
|
+
**每次写远端前**,列出实际 Cloudflare 账号、Pages 项目、D1 和中转 Worker(以该步涉及的资源为准)、完整命令及影响,等用户明确同意再执行。本次部署请求的确认不代替这些逐步确认。未能核对账号或目标就不写远端。使用房间参与技能的阻塞提问流程等待确认。
|
|
21
|
+
|
|
22
|
+
1. 在选定源码中运行 `npm ci`。需要登录时由用户完成 `npx wrangler login` 的浏览器授权,用 `npx wrangler whoami` 核对账号。说明站点访问边界,默认使用 `pages.dev`,不要求自定义域名。
|
|
23
|
+
2. **新建**:按部署文档创建 Pages 项目和 D1 数据库,已有就不重复创建。Wrangler 问是否改写根配置时选否。将模板复制到 `.wrangler/deploy/wrangler.jsonc`,填写实际项目、`DB` 的名称和 ID、`RELAY` 的脚本名,按文档修正相对路径。在执行 schema 前核对 `--config` 及数据库目标。
|
|
24
|
+
3. **升级**:在任何远端写入前先确认并导出 D1 备份。例:`npx wrangler d1 export DB --remote --config .wrangler/deploy/wrangler.jsonc --output .wrangler/deploy/d1-backup-<日期>.sql`。备份失败就不继续。按版本对应的部署文档判断是否需要迁移;涉及删表时,在副本验证并单独取得明确同意,不能把初始化命令当成升级方案直接重跑。
|
|
25
|
+
4. **发布**:一般先部署中转 Worker,再按文档发布 Pages(`npm run deploy -- --cwd .wrangler/deploy`);如有旧版绑定,遵循该版本部署文档的迁移顺序。自定义 Worker 配置也只放 `.wrangler/deploy/`,并按文件位置调整相对路径。未确认的可选资源不创建。任何步骤失败时停止后续写入,保留备份并报告已完成的步骤。
|
|
26
|
+
|
|
27
|
+
Get explicit approval before each remote write after showing the actual targets, exact command and impact. Back up existing D1 data before an update. Do not proceed after a failed backup or migration.
|
|
28
|
+
|
|
29
|
+
## 验收 / Verify
|
|
30
|
+
|
|
31
|
+
打开实际站点,核对 `/api/health` 返回 `ok: true`,再运行 `codiscuss health --site <实际网址>`。如用户也要求连接本机,运行 `codiscuss local connect <实际网址>`,由用户完成网页连接,再核对已配对设备能够读到本机房间。报告实际网址、部署版本、核验结果和备份位置(如有);仅首页可打开不算验收通过。未执行的连接或配对步骤如实说明。
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codiscuss-draft-cleanup
|
|
3
|
+
description: "盘点 AI CoDiscuss 的成员草稿、运行日志、工作流备份、房间附件与本机语音模型,并协助按用户批准的范围清理。不扫描整个磁盘。Inventory CoDiscuss drafts, logs, workflow backups, attachments and local speech models, and help clean up explicitly approved items."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 共议占用盘点与清理 / CoDiscuss storage inventory and cleanup
|
|
7
|
+
|
|
8
|
+
由平台主理人按请求读取,不装进各 AI 软件。管理面板“存储”中的“让平台主理人分析占用”默认只盘点。若存储限制让主理人也不能接单,请用户先从管理面板释放空间。只检查该共议账号的目录,不扫描整盘、项目目录或其他 AI 软件的数据。
|
|
9
|
+
|
|
10
|
+
The steward loads this skill on request. “Ask the platform steward to analyze storage” in the admin panel starts a read-only inventory. If storage limits prevent dispatch, ask the user to free space in the admin panel first. Limit the work to this CoDiscuss account, not the whole disk, project folders or other AI apps.
|
|
11
|
+
|
|
12
|
+
## 盘点 / Inventory
|
|
13
|
+
|
|
14
|
+
1. 用受影响账号运行 `codiscuss service status`,核对返回的 `home`、`drafts_root`;管理面板请求若给出账号目录,须与该实例一致。目录无法确认时不猜。运行 `python scan.py --home "<home>" --drafts-root "<drafts_root>"`(脚本路径相对本技能目录,Python 3.10+)。旧版无 `drafts_root` 时只传 `--home`。
|
|
15
|
+
2. 汇报五类占用、位置与不可读项。数字是逻辑字节,硬链接可能重复计数。附件另外按管理面板或 `codiscuss admin storage attachments` 核对房间及远端对象;本地盘点不会把远端对象算作可释放的磁盘空间。
|
|
16
|
+
3. 要清理时,先列精确候选路径或附件编号、大小、来源、运行状态和可恢复依据。唯一成品、未提交修改、重定向、不可读或来源不明的数据保留。先预览,用户逐项批准后才处理,清理后复查实际占用。只要求盘点就不删除。
|
|
17
|
+
|
|
18
|
+
Use the affected account's `codiscuss service status` to verify `home` and `drafts_root`. Use the exact paths and report logical bytes and unreadable entries. Present exact paths or attachment IDs, sizes, and evidence of eligibility or recoverability. Preview first and process only items the user approves. Recheck usage afterwards. An inventory request does not authorize deletion.
|
|
19
|
+
|
|
20
|
+
## 分类别处理 / Cleanup by category
|
|
21
|
+
|
|
22
|
+
| 类别 / Category | 做法 / Action |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| 成员草稿 / Drafts | 结束执行留下的可重建临时文件优先用房间或管理面板的清理功能。重复归档用 `cleanup.py --drafts-root "<drafts_root>" --keep "ROOM/MEMBER/original.zip" --drop "ROOM/MEMBER/copy.zip"` 比对 SHA-256。确保执行已结束,只对同一对用户批准的普通 tar、tgz 或 zip 追加 `--apply`。Use the built-in cleanup for eligible scratch files, or preview a verified duplicate and apply only to the exact approved pair. |
|
|
25
|
+
| 运行日志 / Run logs | 日志位于 `launches/*/runtime/`。只选已结束启动中明确可删的日志。运行锁仍在或状态不明就保留,不自行停服务或移除运行锁。逐个使用 `cleanup.py --home "<home>" --log "LAUNCH/runtime/FILE.log"` 先预览,获准后加 `--apply`。Never touch active or uncertain launches. Preview and apply to one approved log path at a time. |
|
|
26
|
+
| 工作流备份 / Workflow backups | 只选 `backups/workflow-*/` 中已确认可放弃的旧备份文件,不改正在使用的工作流或其他备份。逐个用 `cleanup.py --home "<home>" --workflow-backup "workflow-BACKUP/FILE"` 预览,获准后加 `--apply`。脚本不递归删除目录。Never touch live workflows, other backups, or recursively delete a backup directory. |
|
|
27
|
+
| 房间附件 / Attachments | 不直接删文件。请房主在房间用“管理附件”,或由管理员用 `codiscuss admin storage attachments ROOM clear ID... --confirm`。消息记录与缩略图保留。Use the room or admin attachment controls rather than unlinking the backing files. |
|
|
28
|
+
| 本机语音模型 / Local speech models | 仅盘点安装位置与大小。卸载另按主理人技能 `local-tts-setup` 或 `local-stt-setup` 的卸载步骤处理。Inventory only. Use the matching speech setup skill for uninstallation. |
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"""Preview or remove an explicitly selected CoDiscuss storage candidate."""
|
|
2
|
+
import argparse
|
|
3
|
+
import hashlib
|
|
4
|
+
import os
|
|
5
|
+
import shutil
|
|
6
|
+
import stat
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from scan import active_root, add_root_arguments, runtime_log, service_home, unredirected, workflow_backup
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def digest(stream):
|
|
13
|
+
"""Hash without loading a large archive into memory (Python 3.10+)."""
|
|
14
|
+
result = hashlib.sha256()
|
|
15
|
+
for block in iter(lambda: stream.read(1024 * 1024), b''):
|
|
16
|
+
result.update(block)
|
|
17
|
+
return result.digest()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def archive(root, value):
|
|
21
|
+
"""Resolve a relative archive path without traversing any redirected component."""
|
|
22
|
+
rel = Path(value)
|
|
23
|
+
if rel.anchor or '..' in rel.parts or ':' in value or len(rel.parts) < 3:
|
|
24
|
+
raise ValueError("Expected a room/member-relative path under drafts")
|
|
25
|
+
path = unredirected(root / rel)
|
|
26
|
+
if not path.is_file() or path.suffix.lower() not in {'.tar', '.zip', '.tgz'}:
|
|
27
|
+
raise ValueError("Expected a regular archive")
|
|
28
|
+
return path
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def signature(path):
|
|
32
|
+
"""Capture identity, length, timestamps and link count for a final consistency check."""
|
|
33
|
+
info = path.stat()
|
|
34
|
+
return info.st_dev, info.st_ino, info.st_size, info.st_mtime_ns, info.st_ctime_ns, info.st_nlink
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def clean_archive(args):
|
|
38
|
+
"""Delete only after comparing the exact named files; return observed free-space delta."""
|
|
39
|
+
root = active_root(args)
|
|
40
|
+
keep, drop = [archive(root, name) for name in (args.keep, args.drop)]
|
|
41
|
+
before = [signature(p) for p in (keep, drop)]
|
|
42
|
+
if keep.samefile(drop) or before[0][2] != before[1][2] or before[1][-1] != 1:
|
|
43
|
+
raise ValueError("Expected independent files of equal length with one link to the candidate")
|
|
44
|
+
with keep.open('rb') as retained, drop.open('rb') as candidate:
|
|
45
|
+
if digest(retained) != digest(candidate):
|
|
46
|
+
raise ValueError("Different content")
|
|
47
|
+
for index, name in enumerate((args.keep, args.drop)):
|
|
48
|
+
if signature(archive(root, name)) != before[index]:
|
|
49
|
+
raise ValueError("File changed during verification")
|
|
50
|
+
print(f"keep={keep}\ndrop={drop}\nlogical_bytes={before[1][2]}")
|
|
51
|
+
if args.apply:
|
|
52
|
+
free = shutil.disk_usage(root).free
|
|
53
|
+
drop.unlink()
|
|
54
|
+
if drop.exists() or signature(keep) != before[0]:
|
|
55
|
+
raise RuntimeError("Post-cleanup verification failed")
|
|
56
|
+
print(f"removed=1 free_space_delta={shutil.disk_usage(root).free - free}")
|
|
57
|
+
else:
|
|
58
|
+
print("preview only")
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def candidate_file(args):
|
|
62
|
+
"""Resolve one explicit log or workflow backup file under its fixed root."""
|
|
63
|
+
home = service_home(args)
|
|
64
|
+
value = args.log if args.log is not None else args.workflow_backup
|
|
65
|
+
relative = Path(value)
|
|
66
|
+
if relative.anchor or ".." in relative.parts or ":" in value:
|
|
67
|
+
raise ValueError("Expected a relative path inside the selected root / 需要清理根目录内的相对路径")
|
|
68
|
+
if args.log is not None and not runtime_log(relative):
|
|
69
|
+
raise ValueError("Expected a launch runtime log / 只允许启动运行目录内的日志")
|
|
70
|
+
if args.workflow_backup is not None and not workflow_backup(relative):
|
|
71
|
+
raise ValueError("Expected a workflow backup file / 只允许工作流备份文件")
|
|
72
|
+
root = home / ("launches" if args.log is not None else "backups")
|
|
73
|
+
path = unredirected(root / relative)
|
|
74
|
+
info = path.lstat()
|
|
75
|
+
if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1:
|
|
76
|
+
raise ValueError("Expected a regular file with one link / 只允许无额外硬链接的普通文件")
|
|
77
|
+
lock = root / relative.parts[0] / "runtime" / "runner.lock" if args.log is not None else None
|
|
78
|
+
return path, lock
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def ensure_inactive(lock):
|
|
82
|
+
"""Refuse live or uncertain launch ownership, including stale lock files."""
|
|
83
|
+
if lock is None:
|
|
84
|
+
return
|
|
85
|
+
try:
|
|
86
|
+
lock.lstat()
|
|
87
|
+
except FileNotFoundError:
|
|
88
|
+
return
|
|
89
|
+
raise ValueError("Launch has a runner lock; keep its logs / 启动存在运行锁,保留日志")
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def remove_candidate(path, before):
|
|
93
|
+
"""Unlink the exact file only if no component or file identity changed."""
|
|
94
|
+
if signature(unredirected(path)) != before:
|
|
95
|
+
raise ValueError("File changed during verification / 验证期间文件已变化")
|
|
96
|
+
path.unlink()
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def clean_candidate(args):
|
|
100
|
+
"""Preview by default; exclude a runner from the runtime while removing a log."""
|
|
101
|
+
path, lock = candidate_file(args)
|
|
102
|
+
ensure_inactive(lock)
|
|
103
|
+
before = signature(path)
|
|
104
|
+
print(f"drop={path}\nlogical_bytes={before[2]}")
|
|
105
|
+
if not args.apply:
|
|
106
|
+
print("preview only / 仅预览")
|
|
107
|
+
return
|
|
108
|
+
if lock is None:
|
|
109
|
+
remove_candidate(path, before)
|
|
110
|
+
else:
|
|
111
|
+
with lock.open("x", encoding="ascii") as stream:
|
|
112
|
+
stream.write(str(os.getpid()))
|
|
113
|
+
try:
|
|
114
|
+
remove_candidate(path, before)
|
|
115
|
+
finally:
|
|
116
|
+
lock.unlink()
|
|
117
|
+
print("removed=1")
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
if __name__ == '__main__':
|
|
121
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
122
|
+
add_root_arguments(parser)
|
|
123
|
+
choices = parser.add_mutually_exclusive_group(required=True)
|
|
124
|
+
choices.add_argument('--drop', help='Duplicate archive path relative to drafts; requires --keep')
|
|
125
|
+
choices.add_argument('--log', help='One log path relative to the launches directory')
|
|
126
|
+
choices.add_argument('--workflow-backup', help='One file path relative to the backups directory')
|
|
127
|
+
parser.add_argument('--keep', help='Retained archive path relative to drafts')
|
|
128
|
+
parser.add_argument('--apply', action='store_true')
|
|
129
|
+
args = parser.parse_args()
|
|
130
|
+
if (args.drop is not None) != (args.keep is not None):
|
|
131
|
+
parser.error("Use --drop and --keep together / --drop 与 --keep 必须成对使用")
|
|
132
|
+
try:
|
|
133
|
+
if args.drop is not None:
|
|
134
|
+
clean_archive(args)
|
|
135
|
+
else:
|
|
136
|
+
clean_candidate(args)
|
|
137
|
+
except (OSError, ValueError, RuntimeError) as error:
|
|
138
|
+
parser.error(str(error))
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"""Inventory CoDiscuss storage without modifying files."""
|
|
2
|
+
import argparse
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
import stat
|
|
6
|
+
import sys
|
|
7
|
+
from collections import Counter
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
REPARSE_POINT = 0x400
|
|
11
|
+
SPEECH_PROGRAMS = ("yovoice", "crispasr")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def add_root_arguments(parser):
|
|
15
|
+
"""Accept the account's service home and its optional exact drafts root."""
|
|
16
|
+
parser.add_argument("--drafts-root", type=Path, help="Exact drafts_root from service status")
|
|
17
|
+
parser.add_argument("--home", type=Path, help="Exact service home from service status")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def redirected(info):
|
|
21
|
+
"""Recognize symbolic links and Windows reparse points."""
|
|
22
|
+
return stat.S_ISLNK(info.st_mode) or bool(getattr(info, "st_file_attributes", 0) & REPARSE_POINT)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def unredirected(path):
|
|
26
|
+
"""Reject redirected components from the filesystem root through this path."""
|
|
27
|
+
for part in (*reversed(path.parents), path):
|
|
28
|
+
if redirected(part.lstat()):
|
|
29
|
+
raise ValueError(f"Redirected path / 重定向路径: {part}")
|
|
30
|
+
return path
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def service_home(args):
|
|
34
|
+
"""Resolve the explicitly selected account's home."""
|
|
35
|
+
if args.home is None or not args.home.is_absolute() or ".." in args.home.parts:
|
|
36
|
+
raise ValueError("Expected an absolute service home / 需要服务目录绝对路径")
|
|
37
|
+
home = args.home.resolve(strict=True)
|
|
38
|
+
if not home.is_dir():
|
|
39
|
+
raise ValueError("Service home unavailable / 服务目录不可用")
|
|
40
|
+
return home
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def active_root(args):
|
|
44
|
+
"""Use the exact draft path, resolving the legacy layout if necessary."""
|
|
45
|
+
root = args.drafts_root
|
|
46
|
+
if root is None:
|
|
47
|
+
home = service_home(args)
|
|
48
|
+
settings = home / "local-settings.json"
|
|
49
|
+
config = json.loads(settings.read_text(encoding="utf-8-sig")) if settings.is_file() else {}
|
|
50
|
+
root = Path(config.get("project_data_root") or home) / "drafts"
|
|
51
|
+
if not root.is_absolute() or root.name.lower() != "drafts" or ".." in root.parts:
|
|
52
|
+
raise ValueError("Expected the absolute, unredirected drafts directory / 需要未重定向的草稿目录绝对路径")
|
|
53
|
+
return root
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def scan(root, group_file):
|
|
57
|
+
"""Return logical sizes by group and the number of unreadable entries."""
|
|
58
|
+
sizes = Counter()
|
|
59
|
+
pending = [root]
|
|
60
|
+
errors = 0
|
|
61
|
+
while pending:
|
|
62
|
+
folder = pending.pop()
|
|
63
|
+
try:
|
|
64
|
+
with os.scandir(folder) as entries:
|
|
65
|
+
for entry in entries:
|
|
66
|
+
try:
|
|
67
|
+
info = entry.stat(follow_symlinks=False)
|
|
68
|
+
if redirected(info):
|
|
69
|
+
continue
|
|
70
|
+
path = Path(entry.path)
|
|
71
|
+
if stat.S_ISDIR(info.st_mode):
|
|
72
|
+
pending.append(path)
|
|
73
|
+
elif stat.S_ISREG(info.st_mode):
|
|
74
|
+
group = group_file(path.relative_to(root))
|
|
75
|
+
if group is not None:
|
|
76
|
+
sizes[group] += info.st_size
|
|
77
|
+
except OSError:
|
|
78
|
+
errors += 1
|
|
79
|
+
except OSError:
|
|
80
|
+
errors += 1
|
|
81
|
+
return sizes, errors
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def draft_group(relative):
|
|
85
|
+
"""Group drafts by room and member, separating per-execution scratch."""
|
|
86
|
+
parts = relative.parts
|
|
87
|
+
group = parts[:4] if parts[2:3] == (".scratch",) else (*parts[:2], "legacy")
|
|
88
|
+
return "/".join(group)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def runtime_log(relative):
|
|
92
|
+
"""Match a log inside one launch runtime; exclude task JSON and credentials."""
|
|
93
|
+
return len(relative.parts) >= 3 and relative.parts[1] == "runtime" and relative.suffix.lower() == ".log"
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def workflow_backup(relative):
|
|
97
|
+
"""Recognize files inside a workflow backup, not other backup types."""
|
|
98
|
+
return len(relative.parts) >= 2 and relative.parts[0].startswith("workflow-")
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def speech_roots(home):
|
|
102
|
+
"""Yield active and legacy speech directories, as the admin panel does."""
|
|
103
|
+
for program in SPEECH_PROGRAMS:
|
|
104
|
+
marker = home / f"{program}-root.txt"
|
|
105
|
+
try:
|
|
106
|
+
parent = unredirected(marker).read_text(encoding="utf-8-sig").strip()
|
|
107
|
+
except FileNotFoundError:
|
|
108
|
+
parent = ""
|
|
109
|
+
except (OSError, ValueError) as error:
|
|
110
|
+
print(error, file=sys.stderr)
|
|
111
|
+
parent = ""
|
|
112
|
+
if parent and (not Path(parent).is_absolute() or ".." in Path(parent).parts):
|
|
113
|
+
print(f"Invalid model parent / 语音模型位置无效: {marker}", file=sys.stderr)
|
|
114
|
+
parent = ""
|
|
115
|
+
yield from dict.fromkeys([Path(parent or home) / program, home / program])
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def storage_roots(home):
|
|
119
|
+
"""Yield the account's remaining CoDiscuss roots and grouping rules."""
|
|
120
|
+
yield "logs", home / "launches", lambda rel: rel.parts[0] if runtime_log(rel) else None
|
|
121
|
+
yield "workflow-backups", home / "backups", lambda rel: rel.parts[0] if workflow_backup(rel) else None
|
|
122
|
+
yield "attachments", home / "local" / "discuss.sqlite3.attachments", lambda _: "."
|
|
123
|
+
for root in speech_roots(home):
|
|
124
|
+
yield "speech", root, lambda _: "."
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def report(category, root, group_file):
|
|
128
|
+
"""Print one category's root, logical total and subdivisions."""
|
|
129
|
+
print(category, root, sep="\t")
|
|
130
|
+
try:
|
|
131
|
+
unredirected(root)
|
|
132
|
+
except FileNotFoundError:
|
|
133
|
+
print("total_bytes=0")
|
|
134
|
+
return 0
|
|
135
|
+
except (OSError, ValueError) as error:
|
|
136
|
+
print(error, file=sys.stderr)
|
|
137
|
+
return 1
|
|
138
|
+
sizes, errors = scan(root, group_file)
|
|
139
|
+
print(f"total_bytes={sum(sizes.values())}")
|
|
140
|
+
for group, total in sizes.most_common():
|
|
141
|
+
print(total, group, sep="\t")
|
|
142
|
+
return errors
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
if __name__ == "__main__":
|
|
146
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
147
|
+
add_root_arguments(parser)
|
|
148
|
+
args = parser.parse_args()
|
|
149
|
+
try:
|
|
150
|
+
home = service_home(args) if args.home is not None else None
|
|
151
|
+
errors = report("drafts", active_root(args), draft_group)
|
|
152
|
+
if home is not None:
|
|
153
|
+
errors += sum(report(*entry) for entry in storage_roots(home))
|
|
154
|
+
except (OSError, ValueError) as error:
|
|
155
|
+
parser.error(str(error))
|
|
156
|
+
print("Unreadable entries / 不可读条目:", errors, file=sys.stderr)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codiscuss-help
|
|
3
|
+
description: "用随包手册回答 AI CoDiscuss 使用问题,按房间事件、执行详情与运行日志只读排障。Answer AI CoDiscuss questions from the bundled guide and diagnose issues through read-only events, execution details and runtime logs."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 使用帮助与排障 / Help and troubleshooting
|
|
7
|
+
|
|
8
|
+
按用户的语言提供当前安装版本的用法或诊断。只读相关资料,不修改设置,不重试,不停止执行,不派活。
|
|
9
|
+
|
|
10
|
+
## 使用帮助
|
|
11
|
+
|
|
12
|
+
从本次任务文件的 `skills`,或 `steward_skill_catalog` 中 `codiscuss-help` 的 `path`,找到本技能的绝对路径。取 `.agents/steward-skills/codiscuss-help/SKILL.md` 之前的目录作为包根,直接读取该处 `package.json`,核对 `name` 为 `ai_co_discuss`。中文从 `docs/guide/README.md` 查对应手册,英文从 `docs/en/guide/README.md` 查,源码运行时同理。定位不运行命令。无法核实路径或手册缺失时说明限制,可看本次任务允许的 `codiscuss` 帮助,不把其他版本当成本机现状。
|
|
13
|
+
|
|
14
|
+
## 排障
|
|
15
|
+
|
|
16
|
+
1. 从用户给出的房间链接或编号确定范围。用 `codiscuss room events ROOM` 先看发生了什么,定位原始输入、处理或拒绝原因及对应结果。
|
|
17
|
+
2. 找到执行编号后,用 `codiscuss execution view ROOM ID` 查看 `diagnostics`,检查投递、心跳、活动和失败发生的阶段。事件与执行详情够用就到这里。
|
|
18
|
+
3. 仍需证据时,在当前账号的共议服务目录找 `launches/<启动>/runtime/` 下对应执行的 `<适配>-free-<执行编号>.log`,默认服务目录是 `~/.codiscuss`。根据执行编号只读相关片段,不读取凭据文件、不复述令牌或无关的私密内容。没有日志权限或日志缺失就标明。
|
|
19
|
+
|
|
20
|
+
说明“输入 → 结果”的因果关系,附房间链接、房间编号及消息或执行编号。区分确认的原因与待验证的推断。需要动手时告诉用户到哪个界面操作,或另发执行请求。
|
|
@@ -23,15 +23,15 @@ description: "将已结束或明确选定范围的真实讨论整理为独立可
|
|
|
23
23
|
|
|
24
24
|
### AI CoDiscuss 房间
|
|
25
25
|
|
|
26
|
-
从用户给定链接取得站点和房间 ID
|
|
26
|
+
从用户给定链接取得站点和房间 ID。使用本次任务指定的 `codiscuss` 入口;首次使用或字段不明确时读 CLI 帮助,字段以 `codiscuss schema <命令>` 为准。
|
|
27
27
|
|
|
28
28
|
本任务只使用读取命令,例如:
|
|
29
29
|
|
|
30
30
|
```text
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
codiscuss room view <房间ID> --site <实际站点>
|
|
32
|
+
codiscuss room brief <房间ID> --site <实际站点>
|
|
33
|
+
codiscuss state view <房间ID> --site <实际站点>
|
|
34
|
+
codiscuss message list <房间ID> --after 0 --site <实际站点>
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
默认 JSON 的 `ok=true` 与退出码 0 才表示读取成功。消息每页最多 20 条;使用 `--after` 时按实际返回的 `next_after` 续读,结合 `has_more` 核对是否覆盖固定截止编号。相关提问与安排通过 `turn list <房间ID> --page 1` 起读,按返回的 `page` / `pages` 递增页码覆盖相关安排,必要时用 `turn view` 补读。
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dispatch-analysis
|
|
3
|
+
description: "只读审查 AI CoDiscuss 主持人的派活反馈、改派、作废,或对比不同主持人模型、提示词与技能版本。Read-only review of host dispatch feedback, redirects, invalidations, and changes across versions."
|
|
4
|
+
---
|
|
5
|
+
# 主持人派活分析(dispatch-analysis)
|
|
6
|
+
|
|
7
|
+
只分析主持人怎样分派工作,不分析 Jev 的消息路由或接力判断。不修改房间、设置、提示词或技能,不依赖源码仓库。
|
|
8
|
+
|
|
9
|
+
## 范围与数据
|
|
10
|
+
|
|
11
|
+
- 按请求的房间、时间范围和时区分析。统计页有附带范围时沿用。接口不按日期或文件夹过滤,按时间和可确认的房间范围筛选。范围无从确认时不要用全站样本代替。
|
|
12
|
+
- 现有读取命令为 `codiscuss room dispatches [--room ROOM] [--after ID] [--view messages|chains]`,沿 `next_after` 分页。消息视图有分工理由、执行与作废原因、改派、反馈、版本与历史快照。链视图有结束状态、作废消息编号、用户介入、未处理失败、按执行去重的 token 和主持人版本。
|
|
13
|
+
- 用 `codiscuss message view ROOM ID` 核对可访问的原文。房间已销毁时只引用留存快照,标明原文不可查。
|
|
14
|
+
- 若当前执行无权读取,可以分析用户提供的合法导出。说明数据缺口,不读取管理员凭据或换身份绕过权限。不用汇总数字猜测某条派活的得失。
|
|
15
|
+
|
|
16
|
+
## 审查反馈
|
|
17
|
+
|
|
18
|
+
默认做反馈审查。优先读 👎、改派、作废,以及主持人自行选人但未写理由的案例。核对用户原始要求、主持人当时可知的资料、派活、成员回答和用户纠正。区分分工偏差、成员执行问题和证据不足,不能仅凭执行失败认定派错了人。总结共性时给出支持与相反例子。
|
|
19
|
+
|
|
20
|
+
## 版本对比
|
|
21
|
+
|
|
22
|
+
只统计已结束且有派活的任务链。按主持人模型和已记录的 `package_version`、`prompt_hash`、`skill_hash` 分组。无法归属的跨版本链与未记录版本单列,不重复计算。每组报告范围、链数和用量覆盖率。少于 10 条链只列数字,任一组证据偏少、差异可由波动解释或任务明显不可比时不下结论。不把同时改变多个因素后的差异归因给某一个。
|
|
23
|
+
|
|
24
|
+
| 指标 | 口径 |
|
|
25
|
+
| --- | --- |
|
|
26
|
+
| 作废派活率 | `host_withdraw`、`user_stop_or_retract`、`user_rewind`、`failed` 的派活消息编号取并集,除以派活消息数 |
|
|
27
|
+
| 用户改派率(下限) | 识别到改派或带 `should_be` 的 👎,按派活消息去重后除以派活消息数。直接点名、完工后另派或未撤回的改派可能漏记 |
|
|
28
|
+
| 用户介入率 | 有停止、撤回、回退或改派介入的链数除以链数;未处理失败另列 |
|
|
29
|
+
| 失败派活率 | `failed` 作废派活数除以派活消息数;`retried` 不等于失败 |
|
|
30
|
+
| 无效 token 占比 | `voided_dispatch` 与 `failed` 的 token 之和除以全部 token;同时报 `with_usage / executions`,从消息视图汇总时按 `execution_id` 去重 |
|
|
31
|
+
| 👍/👎 | 只计实时记录,房间销毁后的留存快照另列 |
|
|
32
|
+
|
|
33
|
+
字段缺失或分母为零时标明不可计算。若自算指标与统计页口径不同,注明差异。
|
|
34
|
+
|
|
35
|
+
## 交付
|
|
36
|
+
|
|
37
|
+
用请求者的语言,在平台主理人对话中按参与技能的规则一次交付正文或报告附件。标注**主理人实际使用的模型**,无法核实时写“未记录”,不要用被分析的主持人模型代替。先列范围、样本、事实指标,再单列 AI 判断。每项判断附房间与消息编号,版本对比注明组别的链编号范围和支撑结论的代表消息。交付前核对编号和数字,证据不足就不下结论。
|