ai_co_discuss 0.5.21 → 0.5.23
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/codiscuss-draft-cleanup/SKILL.md +16 -0
- package/.agents/skills/codiscuss-draft-cleanup/cleanup.py +70 -0
- package/.agents/skills/codiscuss-draft-cleanup/scan.py +70 -0
- package/.agents/skills/discuss-host/references/control.md +2 -2
- package/.agents/skills/discuss-host/references/workflow.md +4 -2
- package/.agents/skills/discuss-participant/SKILL.md +2 -0
- package/.agents/skills/local-stt-setup/SKILL.md +9 -8
- package/.agents/skills/local-tts-setup/SKILL.md +10 -9
- package/.agents/skills/share-card/SKILL.md +7 -6
- package/.agents/skills/share-card/references/share-card.md +34 -8
- package/.agents/skills/workflow-creator/SKILL.md +22 -14
- package/README.md +2 -0
- package/README.zh-CN.md +2 -0
- package/backend/free_room.py +64 -8
- package/backend/message_queue.py +9 -0
- package/backend/schema.sql +13 -1
- package/backend/server.py +289 -59
- package/docs/en/guide/admin.md +18 -0
- package/docs/en/guide/members.md +7 -1
- package/docs/en/guide/remote.md +1 -1
- package/docs/en/guide/rooms.md +14 -6
- package/docs/en/guide/voice.md +2 -0
- package/docs/en/guide/workflows.md +9 -5
- package/docs/en/guide/working.md +6 -4
- package/docs/guide/admin.md +18 -0
- package/docs/guide/members.md +7 -1
- package/docs/guide/remote.md +1 -1
- package/docs/guide/rooms.md +13 -6
- package/docs/guide/voice.md +2 -0
- package/docs/guide/workflows.md +9 -5
- package/docs/guide/working.md +6 -4
- package/frontend/locales/en/admin.json +58 -1
- package/frontend/locales/en/app.json +18 -1
- package/frontend/locales/en/backend.json +6 -0
- package/frontend/locales/en/core.json +4 -2
- package/frontend/locales/en/discussion.json +4 -1
- package/frontend/locales/en/room.json +85 -1
- package/gateway/gateway.mjs +49 -9
- package/package.json +3 -1
- package/runner/account_space.mjs +10 -0
- package/runner/adapters/antigravity_app.mjs +31 -4
- package/runner/adapters/antigravity_cli.mjs +9 -2
- package/runner/adapters/api.mjs +3 -2
- package/runner/adapters/api_pi.mjs +3 -2
- package/runner/adapters/api_pi_extension.mjs +5 -3
- package/runner/adapters/claude.mjs +32 -9
- package/runner/adapters/cli.mjs +2 -2
- package/runner/adapters/codex_app.mjs +192 -69
- package/runner/adapters/codex_cli.mjs +10 -5
- package/runner/adapters/common.mjs +414 -11
- package/runner/adapters/index.mjs +6 -0
- package/runner/admin_cli.mjs +22 -5
- package/runner/admin_panel.mjs +118 -5
- package/runner/admin_storage.mjs +105 -0
- package/runner/discussion_launch.mjs +328 -128
- package/runner/discussion_runner.mjs +12 -3
- package/runner/discussion_service.mjs +224 -37
- package/runner/discussion_skills.mjs +1 -1
- package/runner/expert_prompts.mjs +2 -2
- package/runner/experts.mjs +227 -0
- package/runner/file_diff.mjs +1 -1
- package/runner/free_runner.mjs +236 -51
- package/runner/i18n_en.mjs +39 -0
- package/runner/os_users.mjs +33 -1
- package/runner/project_files.mjs +7 -1
- package/runner/project_migration.mjs +245 -0
- package/runner/relay_channel.mjs +1 -1
- package/runner/remote_launch.mjs +4 -3
- package/runner/share_card.mjs +17 -1
- package/runner/share_shared.mjs +26 -9
- package/runner/site_deploy.mjs +2 -1
- package/runner/slash_names.mjs +12 -1
- package/runner/speech_directories.mjs +20 -0
- package/runner/storage_guard.mjs +383 -0
- package/runner/tts_providers.mjs +22 -21
- package/runner/workflows.mjs +211 -57
- package/web/admin.css +1 -1
- package/web/admin.js +8 -8
- package/web/app.js +589 -80
- package/web/i18n.js +4 -4
- package/web/markdown.css +1 -1
- package/web/modern.css +1 -1
- package/web/modern.js +68 -66
- package/workflows/decision-council/flow.json +216 -25
- package/workflows/trpg-classic/flow.json +151 -21
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"释放迁移备份": "Release migration backup",
|
|
3
|
+
"确认释放": "Confirm release",
|
|
4
|
+
"将停止实例,校验后删除备份 {path}({bytes} 字节)。": "Stop the instance, verify and delete the backup at {path} ({bytes} bytes).",
|
|
5
|
+
"已释放迁移备份": "Migration backup released",
|
|
6
|
+
"查看迁移备份": "View migration backups",
|
|
7
|
+
"没有已登记的迁移备份": "No registered migration backups",
|
|
8
|
+
"文件 {bytes} 字节,磁盘占用 {allocated} 字节": "{bytes} bytes in files, {allocated} bytes on disk",
|
|
9
|
+
"项目数据目录": "Project data directory",
|
|
10
|
+
"项目数据已迁移,实例已停止": "Project data moved. The instance is stopped.",
|
|
11
|
+
"新的绝对路径": "New absolute path",
|
|
12
|
+
"停止实例并迁移": "Stop instance and move data",
|
|
2
13
|
"自动重启失败:{reason}": "Automatic restart failed: {reason}",
|
|
3
14
|
"实例端口拒绝连接": "The instance port refused the connection",
|
|
4
15
|
"立即重连": "Reconnect now",
|
|
@@ -272,6 +283,9 @@
|
|
|
272
283
|
"启动实例": "Start instance",
|
|
273
284
|
"账号 {value1} 已建好": "Account {value1} created",
|
|
274
285
|
"新建托管账号": "New hosted account",
|
|
286
|
+
"使用 2–17 位小写字母、数字、下划线或短横线,对方用这个账号名登录。": "Use 2–17 lowercase letters, digits, underscores or hyphens. This is the name the user signs in with.",
|
|
287
|
+
"项目数据目录(可选)": "Project data directory (optional)",
|
|
288
|
+
"填写尚未创建的账号专用目录的绝对路径,父目录须已存在。项目、工作区和成员草稿存入此处。": "Enter the absolute path of a new directory for this account under an existing parent. It will hold projects, workspaces and member drafts.",
|
|
275
289
|
"账号名": "Account name",
|
|
276
290
|
"例如 zhang": "e.g. alex",
|
|
277
291
|
"2–17 位小写字母、数字、下划线或短横线,对方用它登录。会建立文件夹 ~\\.codiscuss-账号名,里面是它的项目、草稿和数据。": "2–17 lowercase letters, numbers, underscores or hyphens; used to sign in. Creates ~\\.codiscuss-accountname for its projects, drafts and data.",
|
|
@@ -423,5 +437,48 @@
|
|
|
423
437
|
"在外面用其他设备使用这台电脑、邀请外部专家时需要": "Needed to use this computer from other devices while away, and to invite external experts",
|
|
424
438
|
"只供你自己在外面使用这台电脑、邀请外部专家;托管账号走自有域名,不经过它": "Only for you, to use this computer while away and to invite external experts; hosted accounts go through your own domain, not this",
|
|
425
439
|
"你在外面使用这台电脑,以及托管账号的登录和邀请外部专家,都经过它": "You using this computer while away, and hosted accounts signing in and inviting external experts, all go through this",
|
|
426
|
-
"你在外面使用这台电脑、邀请外部专家时经过它;托管账号默认走自有域名,也可以经它登录": "You use this when away from this computer and when inviting external experts; hosted accounts use your own domain by default but can also sign in through it"
|
|
440
|
+
"你在外面使用这台电脑、邀请外部专家时经过它;托管账号默认走自有域名,也可以经它登录": "You use this when away from this computer and when inviting external experts; hosted accounts use your own domain by default but can also sign in through it",
|
|
441
|
+
"存储": "Storage",
|
|
442
|
+
"本机 .codiscuss 数据占用接近 10 GiB 上限,请到“存储”页清理临时文件或旧草稿。": "Local .codiscuss data is nearing the 10 GiB limit. Open Storage to clear temporary files or old drafts.",
|
|
443
|
+
"存储占用接近上限": "Storage nearing its limit",
|
|
444
|
+
"已清理 {count} 个临时目录,释放 {size};另有 {skipped} 项暂无法清理": "Cleared {count} temporary folders and freed {size}. {skipped} items could not be cleared.",
|
|
445
|
+
"已清理 {count} 个临时目录,释放 {size}": "Cleared {count} temporary folders and freed {size}.",
|
|
446
|
+
"没有可立即清理的已结束临时目录;有 {skipped} 项暂无法清理": "No temporary folders from finished runs could be cleared now. {skipped} items were skipped.",
|
|
447
|
+
"没有可清理的已结束执行临时文件": "No temporary files from finished runs to clear.",
|
|
448
|
+
"共议数据": "CoDiscuss data",
|
|
449
|
+
"正在统计存储占用…": "Measuring storage usage…",
|
|
450
|
+
"读取存储占用失败:{reason}": "Could not read storage usage: {reason}",
|
|
451
|
+
"本机 .codiscuss 数据已占 {used}(不含语音模型),接近 {limit} 上限(预警线 {warn})。请及时清理临时文件或旧草稿。": "Local .codiscuss data uses {used}, excluding speech models. It is nearing the {limit} limit, with a warning threshold of {warn}. Clear temporary files or old drafts.",
|
|
452
|
+
"本机 .codiscuss 数据": "Local .codiscuss data",
|
|
453
|
+
"{used} / {limit}": "{used} / {limit}",
|
|
454
|
+
"超过 {limit} 文件上限": "File limit of {limit} exceeded",
|
|
455
|
+
"所在磁盘剩余 {free}(安全线 {reserve})": "Free space on the drive: {free} (reserve: {reserve})",
|
|
456
|
+
"仅删除已确认结束执行的 .scratch 临时目录,不删除房间记录、成品或旧草稿": "Clear only .scratch folders from confirmed finished runs. Room records, deliverables and old drafts are kept.",
|
|
457
|
+
"清理中…": "Clearing…",
|
|
458
|
+
"清理临时文件": "Clear temporary files",
|
|
459
|
+
"全机草稿区": "Drafts on this computer",
|
|
460
|
+
"语音模型(不计入 10 GiB 上限)": "Speech models (excluded from the 10 GiB limit)",
|
|
461
|
+
"本机语音模型": "Local speech models",
|
|
462
|
+
"朗读与语音识别模型单独统计,不计入 10 GiB 共议数据上限。": "Text-to-speech and speech recognition models are counted separately from the 10 GiB CoDiscuss data limit.",
|
|
463
|
+
"语音模型": "Speech models",
|
|
464
|
+
"按房间与成员拆分": "By room and member",
|
|
465
|
+
"当前没有房间草稿占用": "No room drafts are using storage.",
|
|
466
|
+
"临时 {size}": "Temporary files: {size}",
|
|
467
|
+
"房间编号 {id} · 草稿目录 {key}": "Room {id} · Draft folder {key}",
|
|
468
|
+
"草稿目录 {key}": "Draft folder {key}",
|
|
469
|
+
"收起成员": "Hide members",
|
|
470
|
+
"成员({count})": "Members ({count})",
|
|
471
|
+
"含临时 {size}": "Includes {size} of temporary files",
|
|
472
|
+
"已清理 {count} 个临时目录;另有 {skipped} 项暂无法清理": "Cleared {count} temporary folders; {skipped} items could not be cleared.",
|
|
473
|
+
"已清理 {count} 个临时目录": "Cleared {count} temporary folders.",
|
|
474
|
+
"存储上限通过定期采样检查(有执行时每 2 秒查磁盘余量、每 30 秒扫描占用),并非文件系统写入层硬拦截,无法保证磁盘绝不写满。": "Storage limits are enforced by periodic sampling (disk space every 2s and folder size every 30s while runs are active), not by a filesystem write-layer hard quota, so they cannot guarantee the drive will never fill.",
|
|
475
|
+
"存储占用已超过上限或磁盘剩余空间低于安全线,新的派活已暂停。房间被拦截时请在房间外的 AI 对话中运行 $codiscuss-draft-cleanup 清理旧草稿,或清理下方临时文件;房间记录与附件需手动销毁旧房间。": "New runs are paused because storage exceeded a limit or disk free space fell below the safety reserve. While a room is blocked, run $codiscuss-draft-cleanup in an AI chat outside the room to clean old drafts, or clear temporary files below; room records and attachments are reclaimed by destroying old rooms.",
|
|
476
|
+
"本机 .codiscuss 数据已占 {used}(不含语音模型),接近 {limit} 上限(预警线 {warn})。请在房间外的 AI 对话中运行 $codiscuss-draft-cleanup 或清理临时文件。": "Local .codiscuss data uses {used} (excluding speech models), approaching the {limit} limit (warning at {warn}). Run $codiscuss-draft-cleanup in an AI chat outside the room or clear temporary files.",
|
|
477
|
+
"有 {count} 处目录或文件因权限无法读取(例如沙箱创建的目录),未计入配额,清理按钮也无法删除;磁盘安全线仍会保护系统盘。": "{count} folders or files could not be read due to permissions (such as sandbox-created directories). They are excluded from quotas and cannot be removed by the clean button; the disk safety reserve still protects the drive.",
|
|
478
|
+
"{count} 处不可读": "{count} unreadable",
|
|
479
|
+
"草稿合计 {draft} / {draft_limit} · 房间记录与附件 {local}(不含语音模型)": "Drafts {draft} / {draft_limit} · Room records & attachments {local} (excluding speech models)",
|
|
480
|
+
"其中可回收执行临时文件 {size};单房间上限 {room_limit}。清理历史草稿请在房间外的 AI 对话中运行 $codiscuss-draft-cleanup。": "Includes {size} of reclaimable temporary run files; per-room limit is {room_limit}. To clean older drafts, run $codiscuss-draft-cleanup in an AI chat outside the room.",
|
|
481
|
+
"单房间草稿上限 {room_limit};历史草稿和成品不会自动删除,需要清理时请在房间外的 AI 对话中运行 $codiscuss-draft-cleanup。": "Per-room draft limit is {room_limit}; older drafts and deliverables are kept. To clean them, run $codiscuss-draft-cleanup in an AI chat outside the room.",
|
|
482
|
+
"房间记录与附件(local/)": "Room records & attachments (local/)",
|
|
483
|
+
"保存房间消息、事件与附件原件,计入 10 GiB 数据上限;程序不会自动删除,如需释放空间请先导出备份再销毁旧房间。": "Stores room messages, events and original attachments, counted toward the 10 GiB data limit. Never deleted automatically—export a backup and destroy old rooms to free space."
|
|
427
484
|
}
|
|
@@ -5,6 +5,22 @@
|
|
|
5
5
|
"裁剪预览": "Crop preview",
|
|
6
6
|
"选择保留的画面": "Choose the area to keep",
|
|
7
7
|
"使用此封面": "Use this cover",
|
|
8
|
+
"已使用上传的封面,可重新上传或切回自动封面。": "Using the uploaded cover. Upload another image or switch back to the automatic cover.",
|
|
9
|
+
"分享文案": "Share copy",
|
|
10
|
+
"复制文案": "Copy text",
|
|
11
|
+
"基础文案": "Default copy",
|
|
12
|
+
"配套文案": "Matched copy",
|
|
13
|
+
"已自定义": "Edited",
|
|
14
|
+
"恢复默认": "Reset",
|
|
15
|
+
"恢复自动提取": "Restore auto-extracted",
|
|
16
|
+
"含文案": "Copy",
|
|
17
|
+
"已填入这张封面的配套分享文案": "Loaded the matching share copy for this cover.",
|
|
18
|
+
"【{title}】": "[{title}]",
|
|
19
|
+
"成果:{outcome}": "Outcome: {outcome}",
|
|
20
|
+
"{label}:{url}": "{label}: {url}",
|
|
21
|
+
"在线体验:{url}": "Live demo: {url}",
|
|
22
|
+
"完整协作记录:{url}": "Full session: {url}",
|
|
23
|
+
"可直接粘贴到小红书、朋友圈或群聊的图文分享文案": "Ready-to-paste copy for social posts or chats",
|
|
8
24
|
"请选择 PNG、JPG 或 WebP 图片": "Choose a PNG, JPG or WebP image",
|
|
9
25
|
"房间内容已更新,请核对后下载网页文件。": "The room changed. Review the updated contents before downloading the web page.",
|
|
10
26
|
"需要管理员登录": "Sign in as an administrator.",
|
|
@@ -619,5 +635,6 @@
|
|
|
619
635
|
"待部署": "Ready to deploy",
|
|
620
636
|
"{count} 个文件 · {size}": "{count} files · {size}",
|
|
621
637
|
"第 {version} 版 · {count} 个文件 · {size}": "Version {version} · {count} files · {size}",
|
|
622
|
-
"{time} 到期": "expires {time}"
|
|
638
|
+
"{time} 到期": "expires {time}",
|
|
639
|
+
"本机 .codiscuss 数据已占 {used}(不含语音模型),接近 {limit} 上限,请在房间外的 AI 对话中运行 $codiscuss-draft-cleanup 或清理临时文件。": "Local .codiscuss data uses {used} (excluding speech models), approaching the {limit} limit. Run $codiscuss-draft-cleanup in an AI chat outside the room or clear temporary files."
|
|
623
640
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
+
"发信留痕须包含有效的正文与成员名称": "A send record requires valid text and a member name.",
|
|
3
|
+
"发信留痕的送达或排队状态无效": "Invalid delivery or queue status for the send record.",
|
|
2
4
|
"无法读取 ZIP 压缩包": "Could not read the ZIP archive",
|
|
3
5
|
"无法读取这个压缩包条目": "Could not read this archive entry",
|
|
4
6
|
"压缩包内单个文件最多预览 64 MiB": "Individual archive entries can be previewed up to 64 MiB",
|
|
@@ -191,6 +193,10 @@
|
|
|
191
193
|
"这条排队消息已发出或已删除": "This queued message was sent or deleted",
|
|
192
194
|
"排队消息已变化,请刷新后再调整顺序": "Queued messages changed; refresh before reordering",
|
|
193
195
|
"点名的成员已不在房间": "The members it names are no longer in the room",
|
|
196
|
+
"关联房间「{room}」的主持人刚发来消息 #{message_id},请先读原文。": "The host of linked room “{room}” just sent message #{message_id}. Read the original message.",
|
|
197
|
+
"仅父房间主持人可以打断子房间": "Only the parent room’s host can interrupt a child room.",
|
|
198
|
+
"只能编辑用户自己的消息": "Only the user's own messages can be edited.",
|
|
199
|
+
"relay.member 须为成员名称": "relay.member must be a member name.",
|
|
194
200
|
"用户刚发来消息 #{message_id},请先读原文,在这一轮的回答里一并处理。": "The owner just sent message #{message_id}; read it and handle it in this turn's answer as well.",
|
|
195
201
|
"这条消息已发出,只是还在等忙碌的成员;可以删除后重新发送": "This message is already posted and only waits for busy members; delete it and send again instead",
|
|
196
202
|
"action 须为 {value1} 之一": "action must be one of {value1}",
|
|
@@ -341,7 +341,6 @@
|
|
|
341
341
|
"依据、已处理内容、未决问题与下一步": "Sources, what's been handled, open questions and next steps",
|
|
342
342
|
"暂无房间,新建讨论后在这里查看进度与参与者。": "No rooms yet. Create one to see progress and members here.",
|
|
343
343
|
"{count} 条记录": "{count} messages",
|
|
344
|
-
"执行状态:{status};{action}": "Run status: {status}; {action}",
|
|
345
344
|
"删除工作流「{name}」": "Delete workflow “{name}”",
|
|
346
345
|
"依据消息截止 #{id}": "Based on messages up to #{id}",
|
|
347
346
|
"整理至 #{id}": "Updated to #{id}",
|
|
@@ -515,7 +514,10 @@
|
|
|
515
514
|
"下载文件夹": "Download folder",
|
|
516
515
|
"查看记录、恢复房间或销毁。": "Read records, restore rooms, or destroy them.",
|
|
517
516
|
"全部销毁({count})": "Destroy all ({count})",
|
|
518
|
-
"
|
|
517
|
+
"销毁已存档房间": "Destroy archived rooms",
|
|
518
|
+
"当前筛选的 {count} 个已存档房间": "{count} matching archived rooms",
|
|
519
|
+
"全部 {count} 个已存档房间": "All {count} archived rooms",
|
|
520
|
+
"删除:消息、私聊、附件、这些房间新建的 AI 会话与草稿。": "Deleted: messages, private chats, attachments, and new AI sessions and drafts from these rooms.",
|
|
519
521
|
"销毁 {name}": "Destroy {name}",
|
|
520
522
|
"销毁「{name}」的记录、附件、AI 会话与草稿(项目文件保留),无法恢复。": "Destroy “{name}”'s records, attachments, AI sessions and drafts (project files kept). This cannot be undone.",
|
|
521
523
|
"也可以连同其中的 {count} 个房间一起销毁(项目文件保留),无法恢复。": "You can also destroy its {count} rooms (project files kept). This cannot be undone.",
|
|
@@ -344,5 +344,8 @@
|
|
|
344
344
|
"交互式可视化 · {value1}": "Interactive visualization · {value1}",
|
|
345
345
|
"可视化提交的内容超过 {value1} 字,没有放进输入框。": "The visualization's submission is over {value1} characters, so it wasn't added to the message box.",
|
|
346
346
|
"已放到输入框上方,确认后发送。": "Added above the message box. Review it, then send.",
|
|
347
|
-
"已更新输入框上方的可视化结果。": "Updated the visualization's result above the message box."
|
|
347
|
+
"已更新输入框上方的可视化结果。": "Updated the visualization's result above the message box.",
|
|
348
|
+
"正在定位到 {value1}…": "Locating {value1}…",
|
|
349
|
+
"正在查找 {value1} 的最新发言…": "Finding {value1}'s latest message…",
|
|
350
|
+
"{value1} 在本房间还没有发言": "{value1} has not spoken in this room yet"
|
|
348
351
|
}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
+
"主持人 {host} 向{relation}「{title}」发送了消息 #{id}": "Host {host} sent message #{id} to the {relation} “{title}”",
|
|
3
|
+
"主持人 {host} 向{relation}「{title}」发送了消息": "Host {host} sent a message to the {relation} “{title}”",
|
|
4
|
+
"主持人 {host} 向{relation}「{title}」立即发送了消息 #{id}": "Host {host} sent message #{id} immediately to the {relation} “{title}”",
|
|
5
|
+
"主持人 {host} 向{relation}「{title}」立即发送了消息": "Host {host} sent a message immediately to the {relation} “{title}”",
|
|
6
|
+
"主持人 {host} 向{relation}「{title}」发送了消息(已排队)": "Host {host} sent a message to the {relation} “{title}” (queued)",
|
|
7
|
+
"跨房发送": "Sent to linked room",
|
|
8
|
+
"展开或收起发出的消息正文": "Show or hide the sent message",
|
|
9
|
+
"父房间": "parent room",
|
|
10
|
+
"子房间": "child room",
|
|
2
11
|
"{count} 位{status}": "{count} {status}",
|
|
3
12
|
"刷新模型列表与思考强度": "Refresh models and thinking levels",
|
|
4
13
|
"模型列表已更新": "Model list updated",
|
|
@@ -42,6 +51,13 @@
|
|
|
42
51
|
"正在启动": "Starting",
|
|
43
52
|
"正在创建": "Creating",
|
|
44
53
|
"正在创建房间…": "Creating the room…",
|
|
54
|
+
"父房间主持 · {room}": "Parent host · {room}",
|
|
55
|
+
"子房间主持 · {room}": "Child host · {room}",
|
|
56
|
+
"关联房间 · {room}": "Linked room · {room}",
|
|
57
|
+
"父房间「{room}」主持 {host}": "{host}, host of parent room “{room}”",
|
|
58
|
+
"子房间「{room}」主持 {host}": "{host}, host of child room “{room}”",
|
|
59
|
+
"收起子房间": "Collapse child rooms",
|
|
60
|
+
"展开 {count} 个子房间": "Expand {count} child rooms",
|
|
45
61
|
"显示更多": "Show more",
|
|
46
62
|
"继续 Goal": "Continue Goal",
|
|
47
63
|
"展开或收起详情": "Expand or collapse details",
|
|
@@ -885,5 +901,73 @@
|
|
|
885
901
|
"还剩 {count} 小时": "{count} hours left",
|
|
886
902
|
"自动销毁": "Auto-destroy",
|
|
887
903
|
"可随时在左侧房间菜单中销毁": "Can be destroyed anytime from the room menu on the left",
|
|
888
|
-
"暂不计时:房间里还有未完成的工作、待你回答的提问或分享网页": "Paused: the room still has unfinished work, a question for you, or a share page"
|
|
904
|
+
"暂不计时:房间里还有未完成的工作、待你回答的提问或分享网页": "Paused: the room still has unfinished work, a question for you, or a share page",
|
|
905
|
+
"本项目工作流": "Project workflows",
|
|
906
|
+
"全局工作流": "Global workflows",
|
|
907
|
+
"已信任项目工作流「{name}」": "Trusted project workflow “{name}”",
|
|
908
|
+
"待信任": "Untrusted",
|
|
909
|
+
"信任项目工作流「{name}」": "Trust project workflow “{name}”",
|
|
910
|
+
"这个项目工作流来自项目目录,尚未在这台电脑上确认信任。启用前请核对以下权限与命令:": "This project workflow comes from a project folder and has not been trusted on this computer yet. Review these permissions and commands before enabling:",
|
|
911
|
+
"所属项目:{name}": "Project: {name}",
|
|
912
|
+
"高权限成员卡片": "Elevated member cards",
|
|
913
|
+
"登记的命令(commands.json)": "Registered commands (commands.json)",
|
|
914
|
+
"确认后将记录在这台电脑的信任清单中;若工作流内容发生变更,会再次要求确认。": "Once confirmed, this computer remembers your trust choice. You will be asked again if the workflow changes.",
|
|
915
|
+
"信任并继续": "Trust and continue",
|
|
916
|
+
"信任并启用": "Trust and enable",
|
|
917
|
+
"当前项目 · {name}": "Current project · {name}",
|
|
918
|
+
"当前项目": "Current project",
|
|
919
|
+
"只读目录": "Read-only folder",
|
|
920
|
+
"暂无项目工作流": "No project workflows yet",
|
|
921
|
+
"全局": "Global",
|
|
922
|
+
"暂无全局工作流": "No global workflows yet",
|
|
923
|
+
"导入到当前项目({name})": "Import to current project ({name})",
|
|
924
|
+
"导入到全局": "Import to global",
|
|
925
|
+
"导出「{value1}」(项目)": "Export “{value1}” (Project)",
|
|
926
|
+
"项目预设": "Project presets",
|
|
927
|
+
"未信任目录的高权限预设,加入后默认只读,可在卡片背面确认放开": "Elevated preset from an untrusted folder; starts read-only until confirmed on the card's back",
|
|
928
|
+
"项目专家预设": "Project expert preset",
|
|
929
|
+
"添加项目预设 {name}": "Add project preset {name}",
|
|
930
|
+
"{current}(请求{requested},未信任)": "{current} (requests {requested}, untrusted)",
|
|
931
|
+
"已信任项目预设「{name}」并放开权限": "Trusted project preset “{name}” and granted access",
|
|
932
|
+
"预设名称会显示在“项目预设”行和房间里,可以不带平台前缀。": "This name shows in the Project presets row and the room; the platform prefix is optional.",
|
|
933
|
+
"该项目预设请求“{access}”权限,未信任目录默认只读;勾选以信任并放开": "This project preset requests “{access}” access and starts read-only in an untrusted folder; tick to trust and grant it",
|
|
934
|
+
"存下描述、提示词、项目权限、模型与强度,之后在“预设”或“项目预设”行一键加入。": "Saves the description, prompt, project access, model and effort so it can be added from Presets or Project presets in one click.",
|
|
935
|
+
"保存位置": "Save to",
|
|
936
|
+
"预设保存位置": "Preset save location",
|
|
937
|
+
"目标项目": "Target project",
|
|
938
|
+
"项目 · {name}": "Project · {name}",
|
|
939
|
+
"新建到当前项目({name})": "New in current project ({name})",
|
|
940
|
+
"新建全局工作流": "New global workflow",
|
|
941
|
+
"新建到项目「{name}」": "New in project “{name}”",
|
|
942
|
+
"只读项目目录中的工作流不能修改": "Workflows in a read-only project folder cannot be edited",
|
|
943
|
+
"已将「{value1}」移至全局工作流": "Moved “{value1}” to global workflows",
|
|
944
|
+
"已将「{value1}」移至项目工作流": "Moved “{value1}” to project workflows",
|
|
945
|
+
"已将「{value1}」复制到全局工作流": "Copied “{value1}” to global workflows",
|
|
946
|
+
"已将「{value1}」复制到项目「{value2}」": "Copied “{value1}” to project “{value2}”",
|
|
947
|
+
"已将「{value1}」复制到本项目": "Copied “{value1}” to current project",
|
|
948
|
+
"复制到全局": "Copy to global",
|
|
949
|
+
"移至全局": "Move to global",
|
|
950
|
+
"复制到本项目": "Copy to current project",
|
|
951
|
+
"复制到项目「{name}」": "Copy to project “{name}”",
|
|
952
|
+
"存为项目预设({name})": "Save as project preset ({name})",
|
|
953
|
+
"存为全局预设": "Save as global preset",
|
|
954
|
+
"只读项目目录中的工作流技能不能修改": "Workflow skills in a read-only project folder cannot be edited",
|
|
955
|
+
"只读项目目录中的专家技能不可修改": "Expert skills in a read-only project folder cannot be edited",
|
|
956
|
+
"只读项目目录,不能直接保存": "Read-only project folder; cannot save directly",
|
|
957
|
+
"保存归属:{scope}": "Save scope: {scope}",
|
|
958
|
+
"选择保存位置:当前项目或全局": "Choose where to save: current project or global",
|
|
959
|
+
"项目工作流:{name}": "Project workflow: {name}",
|
|
960
|
+
"全局工作流:所有房间可用": "Global workflow: available in every room",
|
|
961
|
+
"只读项目目录,不可修改": "Read-only project folder; cannot be edited",
|
|
962
|
+
"来自只读项目目录,不能直接修改;可复制到全局工作流后编辑": "From a read-only project folder and cannot be edited directly; copy to global workflows to edit",
|
|
963
|
+
"已存为项目预设「{value1}」": "Saved as project preset “{value1}”",
|
|
964
|
+
"定位最新发言": "Jump to latest message",
|
|
965
|
+
"草稿空间": "Draft storage",
|
|
966
|
+
"本房间草稿已达 80% 以上,接近上限时将停止派活。": "This room's drafts are at or above 80%; new runs will pause if the limit is exceeded.",
|
|
967
|
+
"清理临时文件({size})": "Clean temp files ({size})",
|
|
968
|
+
"本房间成员草稿与临时文件占用;按周期采样检查,并非写入层硬拦截,达到 80% 时提示,超过上限将停止派活": "Draft and temporary file usage for this room; checked by periodic sampling (not a filesystem write-layer hard quota), warns at 80% and pauses new runs above the limit",
|
|
969
|
+
"本房间草稿已超限,派活已暂停;请在房间外的 AI 对话中运行 $codiscuss-draft-cleanup,或点击下方清理临时文件。": "This room's drafts exceeded the limit and new runs are paused. Run $codiscuss-draft-cleanup in an AI chat outside the room, or clear temporary files below.",
|
|
970
|
+
"本机数据已占 {used} / {limit}(含房间记录与附件 {local}),建议清理临时文件或销毁旧房间。": "Local data uses {used} / {limit} (including {local} of room records and attachments). Clear temporary files or destroy old rooms.",
|
|
971
|
+
"本机数据已占 {used} / {limit},建议清理临时文件或在房间外运行 $codiscuss-draft-cleanup。": "Local data uses {used} / {limit}. Clear temporary files or run $codiscuss-draft-cleanup outside the room.",
|
|
972
|
+
"另有 {count} 处因权限无法读取,未计入配额。": "{count} entries could not be read due to permissions and are excluded from quotas."
|
|
889
973
|
}
|
package/gateway/gateway.mjs
CHANGED
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { spawn } from 'node:child_process';
|
|
11
11
|
import { createHash, randomBytes, scryptSync, timingSafeEqual } from 'node:crypto';
|
|
12
|
-
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, realpathSync, renameSync, writeFileSync } from 'node:fs';
|
|
12
|
+
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, realpathSync, renameSync, rmdirSync, writeFileSync } from 'node:fs';
|
|
13
13
|
import http from 'node:http';
|
|
14
14
|
import net from 'node:net';
|
|
15
15
|
import { homedir } from 'node:os';
|
|
16
|
-
import { dirname, join, resolve } from 'node:path';
|
|
16
|
+
import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
17
17
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
18
18
|
import { parseArgs } from 'node:util';
|
|
19
19
|
|
|
20
20
|
import { ENTRY_KEY_PATTERN, verified_connection } from '../runner/entry_client.mjs';
|
|
21
|
-
import { clear_instance_flag, read_os_users } from '../runner/os_users.mjs';
|
|
21
|
+
import { clear_instance_flag, read_os_users, secure_project_root } from '../runner/os_users.mjs';
|
|
22
22
|
import { create_direct } from './direct.mjs';
|
|
23
23
|
import { login_page } from './login_page.mjs';
|
|
24
24
|
|
|
@@ -87,12 +87,14 @@ function read_json(path) {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
/** Give a new instance its port, its folders, and the administrator's Python and program locations. */
|
|
90
|
-
function prepare_instance(data, name, port) {
|
|
90
|
+
function prepare_instance(data, name, port, project_data_root) {
|
|
91
91
|
const home = account_home(data, name), service = instance_home(data, name);
|
|
92
|
-
const
|
|
92
|
+
const root = project_data_root || home;
|
|
93
|
+
const folders = { workspace: join(root, 'workspace'), projects_root: join(root, 'projects') };
|
|
93
94
|
for (const folder of Object.values(folders)) mkdirSync(folder, { recursive: true });
|
|
95
|
+
if (project_data_root) mkdirSync(join(root, 'drafts'), { recursive: true });
|
|
94
96
|
const python = read_json(join(data, 'local-settings.json')).python;
|
|
95
|
-
write_json(join(service, 'local-settings.json'), { port, ...(python ? { python } : {}), ...folders });
|
|
97
|
+
write_json(join(service, 'local-settings.json'), { port, ...(python ? { python } : {}), ...folders, ...(project_data_root ? { project_data_root } : {}) });
|
|
96
98
|
const participants = Object.entries(read_json(join(data, 'launch-settings.json')).participants || {}).map(([member, profile]) =>
|
|
97
99
|
[member, Object.fromEntries(SOFTWARE_FIELDS.filter(field => profile?.[field]).map(field => [field, profile[field]]))]);
|
|
98
100
|
if (participants.length) write_json(join(service, 'launch-settings.json'), { participants: Object.fromEntries(participants) });
|
|
@@ -107,6 +109,42 @@ export function read_accounts(data) {
|
|
|
107
109
|
return existsSync(path) ? JSON.parse(readFileSync(path, 'utf8')) : {};
|
|
108
110
|
}
|
|
109
111
|
|
|
112
|
+
/** Store migration state in the administrator's registry, outside the hosted user's write access. */
|
|
113
|
+
export function set_project_migration(data, name, migration, project_data_root, backup_job) {
|
|
114
|
+
const accounts = read_accounts(data);
|
|
115
|
+
if (!accounts[name]) throw new Error('Unknown account / 账号不存在');
|
|
116
|
+
if (migration) accounts[name].project_migration = migration;
|
|
117
|
+
else delete accounts[name].project_migration;
|
|
118
|
+
if (project_data_root) accounts[name].project_data_root = project_data_root;
|
|
119
|
+
if (backup_job) accounts[name].migration_backups = [...(accounts[name].migration_backups || []), backup_job];
|
|
120
|
+
write_json(accounts_path(data), accounts);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Persist confirmed release intent before unlinking, so the same operation can resume. */
|
|
124
|
+
export function mark_backup_release(data, name, id, kind, done) {
|
|
125
|
+
const accounts = read_accounts(data);
|
|
126
|
+
const job = accounts[name].migration_backups.find(row => row.id === id);
|
|
127
|
+
if (done) delete job.kinds[kind];
|
|
128
|
+
else job.kinds[kind] = 'releasing';
|
|
129
|
+
accounts[name].migration_backups = accounts[name].migration_backups.filter(row => Object.keys(row.kinds).length);
|
|
130
|
+
write_json(accounts_path(data), accounts);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** Reserve an unused directory, outside the administrator's and other tenants' storage. */
|
|
134
|
+
export function reserve_project_root(data, name, path, user = '') {
|
|
135
|
+
if (!isAbsolute(path)) throw new Error('项目数据目录必须为绝对路径 / Project data directory must be absolute');
|
|
136
|
+
const requested = resolve(path), parent = realpathSync.native(dirname(requested));
|
|
137
|
+
const target = resolve(parent, relative(dirname(requested), requested));
|
|
138
|
+
const protected_paths = [data, account_home(data, name), ...Object.entries(read_accounts(data)).flatMap(([id, account]) =>
|
|
139
|
+
[account_home(data, id), account.project_data_root, account.project_migration?.target].filter(Boolean))];
|
|
140
|
+
const inside = base => { const rel = relative(existsSync(base) ? realpathSync.native(base) : base, target); return !rel || (rel !== '..' && !rel.startsWith('..' + sep) && !isAbsolute(rel)); };
|
|
141
|
+
if (protected_paths.some(inside)) throw new Error('项目数据目录与账号目录重叠 / Project data directory overlaps an account directory');
|
|
142
|
+
mkdirSync(target, { mode: 0o700 });
|
|
143
|
+
try { secure_project_root(target, user); }
|
|
144
|
+
catch (error) { try { rmdirSync(target); } catch { /* Keep the original ACL error. */ } throw error; }
|
|
145
|
+
return target;
|
|
146
|
+
}
|
|
147
|
+
|
|
110
148
|
/** Remember an explicit start or stop for hosted instances that run as the owner. */
|
|
111
149
|
export function set_instance_wanted(data, name, wanted) {
|
|
112
150
|
const accounts = read_accounts(data), account = accounts[name];
|
|
@@ -137,7 +175,7 @@ function new_credentials() {
|
|
|
137
175
|
* Returns:
|
|
138
176
|
* { name, port, password }; the password is shown once and only its hash is stored.
|
|
139
177
|
*/
|
|
140
|
-
export function add_account(data, name, port) {
|
|
178
|
+
export function add_account(data, name, port, project_data_root = '') {
|
|
141
179
|
if (!NAME_PATTERN.test(name || '')) throw new Error('账号须为 2–32 位小写字母、数字、下划线或短横线,且以字母或数字开头');
|
|
142
180
|
if (RESERVED_NAMES.has(name)) throw new Error(`“${name}”不能作为入口账号:管理员使用这台电脑的默认实例,只能在本机或已配对的设备上访问`);
|
|
143
181
|
const accounts = read_accounts(data);
|
|
@@ -148,8 +186,9 @@ export function add_account(data, name, port) {
|
|
|
148
186
|
if (!Number.isInteger(chosen) || chosen < 1024 || chosen > 65535) throw new Error('实例端口须为 1024–65535 的整数');
|
|
149
187
|
if (used.includes(chosen)) throw new Error(`端口 ${chosen} 已分配给其他账号`);
|
|
150
188
|
const { password, salt, hash } = new_credentials();
|
|
151
|
-
|
|
152
|
-
|
|
189
|
+
if (project_data_root) project_data_root = reserve_project_root(data, name, project_data_root);
|
|
190
|
+
prepare_instance(data, name, chosen, project_data_root);
|
|
191
|
+
write_json(accounts_path(data), { ...accounts, [name]: { salt, hash, port: chosen, ...(project_data_root ? { project_data_root } : {}) } });
|
|
153
192
|
return { name, port: chosen, password };
|
|
154
193
|
}
|
|
155
194
|
|
|
@@ -695,6 +734,7 @@ async function main(args) {
|
|
|
695
734
|
if (command === 'disable' || command === 'enable') return print((set_account_disabled(data, name, command === 'disable'), { name, disabled: command === 'disable' }));
|
|
696
735
|
// A protected account starts only from the panel, which gives the instance its key file; started here it would run
|
|
697
736
|
// without its protection.
|
|
737
|
+
if (command === 'start' && read_accounts(data)[name]?.project_migration) throw new Error('请先完成数据迁移 / Finish the pending data migration first');
|
|
698
738
|
if (command === 'start' && read_accounts(data)[name]?.protected === true) throw new Error(`账号 ${name} 开启了入口保护,请从管理面板启动它的实例`);
|
|
699
739
|
if (command === 'start' || command === 'stop') return run_instance(data, name, command);
|
|
700
740
|
throw new Error(HELP);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai_co_discuss",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.23",
|
|
4
4
|
"bin": {
|
|
5
5
|
"codiscuss": "runner/codiscuss.mjs"
|
|
6
6
|
},
|
|
@@ -87,6 +87,8 @@
|
|
|
87
87
|
"gateway/*.mjs",
|
|
88
88
|
"runner/adapters/*.mjs",
|
|
89
89
|
"runner/*.py",
|
|
90
|
+
".agents/skills/codiscuss-draft-cleanup/*.py",
|
|
91
|
+
".agents/skills/codiscuss-draft-cleanup/SKILL.md",
|
|
90
92
|
"backend/*.py",
|
|
91
93
|
"backend/schema.sql",
|
|
92
94
|
"backend/migrations/*.sql",
|
package/runner/account_space.mjs
CHANGED
|
@@ -35,6 +35,16 @@ export function account_space(home) {
|
|
|
35
35
|
return { workspace: absolute(settings.workspace) || `${resolve(home)}-workspace`, projects_root: absolute(settings.projects_root) };
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
/** Directory containing room-keyed member drafts for this instance. */
|
|
39
|
+
export function drafts_root(home) {
|
|
40
|
+
const file = join(home, SETTINGS_FILE);
|
|
41
|
+
const root = existsSync(file) && JSON.parse(readFileSync(file, 'utf8')).project_data_root;
|
|
42
|
+
if (root && (!isAbsolute(root) || relative(join(root, 'drafts'), realpathSync.native(join(root, 'drafts'))))) {
|
|
43
|
+
throw new Error('项目草稿目录路径已重定向 / Project drafts path was redirected');
|
|
44
|
+
}
|
|
45
|
+
return join(root || home, 'drafts');
|
|
46
|
+
}
|
|
47
|
+
|
|
38
48
|
function safe_name(text, limit) {
|
|
39
49
|
const name = String(text || '').replace(UNSAFE_NAME, ' ').replace(/\s+/g, ' ').trim().replace(/[. ]+$/, '').slice(0, limit).trim();
|
|
40
50
|
return RESERVED_NAME.test(name) ? '' : name;
|
|
@@ -14,7 +14,7 @@ import { setTimeout as sleep } from 'node:timers/promises';
|
|
|
14
14
|
import { fileURLToPath } from 'node:url';
|
|
15
15
|
import { atomic_json } from '../files.mjs';
|
|
16
16
|
import { agy_skills, antigravity_project, conversation_history, database_settings, remove_conversation } from './antigravity_cli.mjs';
|
|
17
|
-
import { bind_access, EDIT_TOOLS, not_sent } from './common.mjs';
|
|
17
|
+
import { bind_access, EDIT_TOOLS, not_sent, shell_written_paths } from './common.mjs';
|
|
18
18
|
|
|
19
19
|
const IN_APP = { stoppable: false, progress: false };
|
|
20
20
|
const FOLLOWED = { stoppable: true, progress: true };
|
|
@@ -70,13 +70,33 @@ function language_server(ready) {
|
|
|
70
70
|
// the App lets the room deliver again at once. Tests shorten these.
|
|
71
71
|
export const ROOM_TIMING = { poll_ms: 2000, wait_ms: 2 * 60 * 60 * 1000, read_failures: 10 };
|
|
72
72
|
|
|
73
|
+
/** Extract written file paths from one finished Antigravity App step; running, failed or canceled steps claim nothing. */
|
|
74
|
+
function app_step_edits(step) {
|
|
75
|
+
if (!step || step.status !== 'CORTEX_STEP_STATUS_DONE') return [];
|
|
76
|
+
if (step.type === 'CORTEX_STEP_TYPE_RUN_COMMAND') {
|
|
77
|
+
const command = step.runCommand || {};
|
|
78
|
+
return (command.exitCode ?? 0) === 0 ? shell_written_paths(command.commandLine) : [];
|
|
79
|
+
}
|
|
80
|
+
if (step.type !== 'CORTEX_STEP_TYPE_PLANNER_RESPONSE') return [];
|
|
81
|
+
const paths = [];
|
|
82
|
+
for (const call of step.plannerResponse?.toolCalls || []) {
|
|
83
|
+
if (!EDIT_TOOLS.test(call.name || '')) continue;
|
|
84
|
+
let args = null;
|
|
85
|
+
try { args = JSON.parse(call.argumentsJson || '{}'); } catch { continue; }
|
|
86
|
+
const path = args?.Path ?? args?.AbsolutePath ?? args?.TargetFile ?? args?.file_path ?? args?.path;
|
|
87
|
+
if (typeof path === 'string' && path) paths.push(path);
|
|
88
|
+
}
|
|
89
|
+
return paths;
|
|
90
|
+
}
|
|
91
|
+
|
|
73
92
|
/**
|
|
74
93
|
* Wait for the Sidecar's receipt (a new conversation's id), then read the conversation until it goes idle with new steps
|
|
75
|
-
* and nothing pending, and
|
|
76
|
-
* ceiling; the room then falls back to the site's hold.
|
|
94
|
+
* and nothing pending, reporting finished step edits along the way and `on_turn_end` when done. Gives up quietly on a
|
|
95
|
+
* refused delivery, an unreadable App or the ceiling; the room then falls back to the site's hold.
|
|
77
96
|
*/
|
|
78
97
|
export async function watch_room_turn(config, server, { session_id, start }, task) {
|
|
79
|
-
const finished = new Map(), until = Date.now() + ROOM_TIMING.wait_ms;
|
|
98
|
+
const finished = new Map(), reported = new Set(), until = Date.now() + ROOM_TIMING.wait_ms;
|
|
99
|
+
task.on_edits?.([]);
|
|
80
100
|
let failures = 0;
|
|
81
101
|
while (Date.now() < until) {
|
|
82
102
|
await sleep(ROOM_TIMING.poll_ms);
|
|
@@ -90,6 +110,13 @@ export async function watch_room_turn(config, server, { session_id, start }, tas
|
|
|
90
110
|
try { conversation = await read_conversation(server, session_id); failures = 0; }
|
|
91
111
|
catch { if (++failures >= ROOM_TIMING.read_failures) return; continue; }
|
|
92
112
|
const steps = conversation.steps.slice(start);
|
|
113
|
+
for (const [offset, step] of steps.entries()) {
|
|
114
|
+
const index = start + offset;
|
|
115
|
+
if (step?.status !== 'CORTEX_STEP_STATUS_DONE' || reported.has(index)) continue;
|
|
116
|
+
reported.add(index);
|
|
117
|
+
const paths = app_step_edits(step);
|
|
118
|
+
if (paths.length) task.on_edits?.(paths);
|
|
119
|
+
}
|
|
93
120
|
if (steps.length && conversation.idle && !turn_pending(steps, finished)) return task.on_turn_end?.();
|
|
94
121
|
}
|
|
95
122
|
}
|
|
@@ -429,8 +429,15 @@ const events = {
|
|
|
429
429
|
edits(event) {
|
|
430
430
|
const step = event.step_update;
|
|
431
431
|
if (step?.step_type !== 'tool' || step.state !== 'DONE') return [];
|
|
432
|
-
const
|
|
433
|
-
if (
|
|
432
|
+
const info = step.tool_info || {};
|
|
433
|
+
if (info.error) return [];
|
|
434
|
+
const parameters = info.parameters || {};
|
|
435
|
+
if (step.tool_name === 'run_command') {
|
|
436
|
+
// agy marks a non-zero command step DONE without tool_info.error, reporting the exit code in output.
|
|
437
|
+
const exit = String(info.output || '').match(/^Command exited with code (\d+)\./m);
|
|
438
|
+
if (exit && Number(exit[1]) !== 0) return [];
|
|
439
|
+
return shell_written_paths(parameters.CommandLine);
|
|
440
|
+
}
|
|
434
441
|
if (!EDIT_TOOLS.test(step.tool_name || '')) return [];
|
|
435
442
|
const path = parameters.Path ?? parameters.AbsolutePath ?? parameters.TargetFile;
|
|
436
443
|
return typeof path === 'string' && path ? [path] : [];
|
package/runner/adapters/api.mjs
CHANGED
|
@@ -66,7 +66,8 @@ function brief_free(free) {
|
|
|
66
66
|
const recent = executions.length - RECENT_EXECUTIONS;
|
|
67
67
|
return { ...free, requests: (free.requests || []).filter(item => !TERMINAL_STATUSES.includes(item.status)),
|
|
68
68
|
executions: executions.filter((item, index) => index >= recent || !TERMINAL_STATUSES.includes(item.status))
|
|
69
|
-
.map(item => Object.fromEntries(EXECUTION_FIELDS.filter(field => field in item)
|
|
69
|
+
.map(item => Object.fromEntries(EXECUTION_FIELDS.filter(field => field in item)
|
|
70
|
+
.map(field => [field, field === 'changes' ? item.edited ?? [] : item[field]]))) };
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
/** Describe a room tool with an explicit input schema. */
|
|
@@ -426,7 +427,7 @@ async function run_tool(context, call) {
|
|
|
426
427
|
}
|
|
427
428
|
if (is_file_tool(call.name)) {
|
|
428
429
|
const result = run_file_tool(context.project, call.name, args);
|
|
429
|
-
if (WRITE_TOOLS.includes(call.name) && typeof args.file_path === 'string') context.on_edits?.([resolve(context.project.root, args.file_path)]);
|
|
430
|
+
if (WRITE_TOOLS.includes(call.name) && !result?.error && typeof args.file_path === 'string') context.on_edits?.([resolve(context.project.root, args.file_path)]);
|
|
430
431
|
return { result };
|
|
431
432
|
}
|
|
432
433
|
if (is_command_tool(call.name)) return { result: await run_command(context.project, context.commands, args, context.signal) };
|
|
@@ -292,15 +292,16 @@ export function pi_delivery({ cli, profile, key, binding, task, context_file, sy
|
|
|
292
292
|
state.tools.delete(event.toolCallId);
|
|
293
293
|
const outcome = event.result?.details?.codiscuss || {};
|
|
294
294
|
if (outcome.fatal) fail(outcome.fatal);
|
|
295
|
+
if (Array.isArray(outcome.edits) && outcome.edits.length) task.on_edits?.(outcome.edits);
|
|
295
296
|
if (outcome.terminal && !state.terminal) {
|
|
296
297
|
state.terminal = true;
|
|
297
298
|
// An interjection still queued would make the model answer again after its answer was saved.
|
|
298
299
|
send({ type: 'clear_queue' });
|
|
299
300
|
}
|
|
300
|
-
// Our write tools name `file_path`, Pi's own `path`; a bash command that writes claims
|
|
301
|
+
// Our write tools name `file_path`, Pi's own `path`; a bash command that writes claims only its write targets when it succeeded.
|
|
301
302
|
const path = call?.args?.file_path ?? call?.args?.path;
|
|
302
303
|
if (call && WRITE_TOOLS.includes(call.name) && !event.isError && typeof path === 'string' && project_root) task.on_edits?.([resolve(project_root, path)]);
|
|
303
|
-
if (call?.name === 'bash' && project_root) {
|
|
304
|
+
if (call?.name === 'bash' && !event.isError && project_root) {
|
|
304
305
|
const written = shell_written_paths(call.args?.command).map(item => resolve(project_root, item));
|
|
305
306
|
if (written.length) task.on_edits?.(written);
|
|
306
307
|
}
|
|
@@ -34,12 +34,14 @@ export default function codiscuss_room(pi) {
|
|
|
34
34
|
// Room writes and file edits keep the order the model gave them, as the in-runner loop ran them.
|
|
35
35
|
executionMode: 'sequential',
|
|
36
36
|
async execute(_id, params, signal, _on_update, ctx) {
|
|
37
|
-
|
|
37
|
+
const edits = [];
|
|
38
|
+
const call_context = { ...context, signal: signal || NEVER, on_edits: paths => edits.push(...paths) };
|
|
38
39
|
try {
|
|
39
|
-
const outcome = await execute_tool(
|
|
40
|
+
const outcome = await execute_tool(call_context, { name: definition.name, arguments: params }, definitions);
|
|
40
41
|
const terminal = Boolean(outcome.terminal);
|
|
41
42
|
// An image read on demand goes with the result, through the same image input as the task's images.
|
|
42
|
-
return { content: [{ type: 'text', text: redact(result_text(outcome.result)) }, ...(outcome.images || [])],
|
|
43
|
+
return { content: [{ type: 'text', text: redact(result_text(outcome.result)) }, ...(outcome.images || [])],
|
|
44
|
+
details: { codiscuss: { terminal, ...(edits.length ? { edits } : {}) } },
|
|
43
45
|
isError: Boolean(outcome.result?.error), terminate: terminal };
|
|
44
46
|
} catch (error) {
|
|
45
47
|
if (signal?.aborted) throw error;
|