ai_co_discuss 0.5.55 → 0.5.56
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/backend/private_chat.py +4 -1
- package/docs/en/guide/members.md +1 -1
- package/docs/en/guide/steward.md +4 -3
- package/docs/en/guide/workflows.md +1 -2
- package/docs/guide/members.md +1 -1
- package/docs/guide/steward.md +4 -3
- package/docs/guide/workflows.md +1 -2
- package/frontend/locales/en/app.json +2 -1
- package/frontend/locales/en/discussion.json +2 -1
- package/frontend/locales/en/room.json +1 -16
- package/frontend/locales/en/settings.json +0 -4
- package/frontend/locales/en/steward.json +2 -2
- package/package.json +1 -1
- package/runner/codiscuss.mjs +6 -1
- package/runner/discussion_launch.mjs +20 -30
- package/runner/discussion_service.mjs +4 -3
- package/runner/experts.mjs +7 -40
- package/runner/free_runner.mjs +36 -18
- package/runner/i18n_en.mjs +2 -3
- package/runner/workflows.mjs +10 -70
- package/web/app.js +31 -75
- package/web/i18n.js +2 -2
- package/web/modern.css +1 -1
- package/web/modern.js +66 -66
package/backend/private_chat.py
CHANGED
|
@@ -81,8 +81,11 @@ def member_chat(connection, room_id, member_id, token, payload=None):
|
|
|
81
81
|
now = int(time.time())
|
|
82
82
|
# A room execution that takes interjections (mid-turn, or by a pause and resume) hears it now; one that cannot
|
|
83
83
|
# waits, like a turn already running.
|
|
84
|
+
# A MOSS group's public execution must never receive the owner's private line as an interjection.
|
|
84
85
|
execution = connection.execute("""SELECT e.* FROM member_executions e JOIN execution_capabilities c ON c.execution_id=e.id
|
|
85
|
-
WHERE e.member_id=? AND e.status IN ('dispatched','started') AND (c.steer=1 OR c.resume=1)
|
|
86
|
+
WHERE e.member_id=? AND e.status IN ('dispatched','started') AND (c.steer=1 OR c.resume=1)
|
|
87
|
+
AND NOT EXISTS(SELECT 1 FROM room_directory d WHERE d.room_id=e.room_id AND d.system_kind='steward_group')
|
|
88
|
+
ORDER BY e.id DESC LIMIT 1""",
|
|
86
89
|
(member["id"],)).fetchone()
|
|
87
90
|
status, execution_id = "pending", None
|
|
88
91
|
if execution:
|
package/docs/en/guide/members.md
CHANGED
|
@@ -19,7 +19,7 @@ On the Room tab you can update several members in succession. Access, model and
|
|
|
19
19
|
|
|
20
20
|
On the back of a member card, select the bookmark to “Save as preset”. In “Save as expert preset”, under “Save to”, choose “Global” to reuse it across projects or “Current project” to keep it with a project. If several folders are writable, choose one under “Target project”. On a card added from a preset, select “Update preset” to save changes. To edit the skills of a preset that has them, open “Advanced settings” on the card.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
Presets carry no project permission: a member added from a preset starts read-only like any other, and you raise it on the card when needed. You can use presets from read-only project folders and save changes to a writable location.
|
|
23
23
|
|
|
24
24
|
## Resume an existing session
|
|
25
25
|
|
package/docs/en/guide/steward.md
CHANGED
|
@@ -33,6 +33,8 @@ Tasks MOSS sends to its own child rooms appear on the handoff card. “Completed
|
|
|
33
33
|
- **Private chat**: your direct messages across linked channels arrive here, and answers go back to the original channel. A quoted reply to a proactive report goes to the Steward window. A quoted reply to another room's notice goes to that room. The Steward and Private chat windows have separate new messages, AI sessions, and settings. Older history stays where it is.
|
|
34
34
|
- **Group**: each enabled group has its own window. You can read the record on the website but cannot send a message to the group from it. On a phone, the top row of the header is a tab for each window; swipe sideways to switch, and a group waiting on you has a brighter dot. To see each window’s latest message and today’s usage, choose “All windows” at the end of the filter button’s menu at the top right, or press and hold any tab.
|
|
35
35
|
|
|
36
|
+
Each of the three windows has a “Private chat” tab, as an ordinary room does, where you can talk to MOSS on your own (see [Private chat and interruptions during a run](working.md#5-private-chat-and-interruptions-during-a-run)); it is not the Private chat window above. In a group window, the private chat stays on the website and is never sent to the group; while MOSS is replying in the group, it waits until that reply is done.
|
|
37
|
+
|
|
36
38
|
The first time you click “Private chat” on the website, choose its software, model, and effort, then click “Start conversation”; after that, private messages from your channels go straight to this window. If a channel message arrives before private chat has software, MOSS replies with a link that opens this same page. Private chat is read-only by default and can be set to “Automatic” independently. It can create rooms and pass messages between them. Platform skills are not listed, and the CLI blocks platform-changing commands. If you raise access, the local process may still be able to call local interfaces or edit configuration files directly. Use the Steward window for platform changes. Private chat restrictions are not a local sandbox.
|
|
37
39
|
|
|
38
40
|
There is no separate acknowledgment for successful direct messages. You’ll see a notice if a message is queued, MOSS isn’t configured, or delivery fails. Replies are split to fit the channel’s message limit. Above three messages, MOSS sends an overview and a web link.
|
|
@@ -43,13 +45,12 @@ New messages wait in the queue while MOSS is busy. If the AI app supports live i
|
|
|
43
45
|
|
|
44
46
|
Group windows currently support QQ groups linked through a personal account using OneBot. They receive text and can send images and files. This is an unofficial protocol, and QQ may restrict or ban the account. Enable it only in groups where you have agreed to record messages.
|
|
45
47
|
|
|
46
|
-
First add the QQ account used by MOSS to the group in QQ
|
|
48
|
+
First add the QQ account used by MOSS to the group in QQ, then turn it on from the website. Adding it to the group does not turn it on, and neither does @mentioning MOSS:
|
|
47
49
|
|
|
48
50
|
- **Collapse the window list**: on a computer the window list sits left of the conversation. The button beside “Windows” folds it into a column of pictures; select it again to expand.
|
|
49
51
|
- **On the website**: select “Join a group” at the bottom of the MOSS window list to see MOSS’s QQ number. Search for the group and confirm the settings. If a group you just joined is missing, refresh the list. The dialog warns you if it can verify that your linked owner account is not a member. If membership cannot be verified, it shows no warning. The option to post an introduction is off by default.
|
|
50
|
-
- **In the QQ group**: from the linked owner account, @mention MOSS and write `开始工作` (“start working”). MOSS confirms in the group or explains why it cannot start. Defaults are “Do small things,” 30 wake-ups and 5 delegations per day, with no readable folder or skills selected. The command checks the linked account ID. Other accounts cannot use it, even with the owner's display name.
|
|
51
52
|
|
|
52
|
-
To stop MOSS, turn off the group in its website settings, or @mention MOSS from the
|
|
53
|
+
To stop MOSS, turn off the group in its website settings, or @mention MOSS from the linked owner account in QQ and write `停止工作` (“stop working”); other accounts cannot use it, even with the owner's display name. MOSS confirms a successful in-group command. It stops receiving and replying to new messages, keeps the existing record, and does not leave the QQ group.
|
|
53
54
|
|
|
54
55
|
If a configured scheduler request fails, MOSS still handles direct mentions and messages from the owner. Existing limits and permissions apply, and MOSS decides whether to reply. Other messages are recorded without waking MOSS. The group settings show the latest failure.
|
|
55
56
|
|
|
@@ -62,9 +62,8 @@ Select a card on the Workflows page. The canvas opens in the center, and its SKI
|
|
|
62
62
|
|
|
63
63
|
## Things to know
|
|
64
64
|
|
|
65
|
-
- **First use of a workflow from a repository.** A project workflow from an unfamiliar repository requires confirmation the first time you enable it if it registers local commands or includes cards with more than read-only access. You can also choose a workflow through “Invite AI” in the room sidebar. Review the elevated member cards and registered commands in the “Trust project workflow” dialog. From the `/` menu select “Trust and continue”, then add and send your request. From the invitation flow select “Trust and enable”. Without opening a room, click “Untrusted” on the card on the Workflows page, or “Trust…” in the card’s “…” menu, and select “Trust” in the same dialog. Trust is stored on the computer. Later edits to SKILL.md, card prompts, references or the canvas do not ask again; adding or changing commands or their scripts, or raising a card’s access, asks again.
|
|
66
65
|
|
|
67
66
|
- **Changes reach active rooms:** Rooms using a workflow read its latest instructions and member prompts on their next run. Existing members’ models, effort, and project access remain room settings.
|
|
68
|
-
- **Review imported workflows:** Importing a ZIP or folder shows a canvas preview. Cards
|
|
67
|
+
- **Review imported workflows:** Importing a ZIP or folder shows a canvas preview. Cards keep the project permission written in the workflow; it is only the members’ starting permission, and you or the host can change it at any time. If a workflow includes commands.json to register local commands for read-only API members, the editor shows the full commands. They run only after you enable “Allow these commands to run on this computer.” The host cannot add or remove local commands while drafting or editing a workflow.
|
|
69
68
|
- **Allow only part of it:** Expand “Items” under “Full host control” and tick them one by one: “Handle execution problems”, “Adjust member settings”, “Change project access”, “Manage the member list”, “How work proceeds”, “Workflows” and “Create rooms”. Saving and enabling workflows needs “Workflows”; an action whose item is not ticked is refused, and the host is told which item is missing.
|
|
70
69
|
- **You keep key decisions:** Even with “Full host control,” only you can change the host, approve assignment rounds above the limit, allow refused tools, change project folders, withdraw your messages, or use private chat.
|
package/docs/guide/members.md
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
点成员卡背面的书签图标“存为预设”。在“存为专家预设”的“保存位置”中,跨项目复用时选“全局”,要随项目保存时选“当前项目”。有多个可写目录时,从“目标项目”中选具体位置。从预设添加的卡片可以用“更新预设”保存修改。带技能的预设可在卡片的“高级配置”中编辑技能。
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
预设不带项目权限:从预设加入的成员和其他成员一样从只读起,需要时在卡片上调高。只读目录的预设可以使用,修改后的配置可另存到可写位置。
|
|
23
23
|
|
|
24
24
|
## 续接已有会话
|
|
25
25
|
|
package/docs/guide/steward.md
CHANGED
|
@@ -33,6 +33,8 @@ MOSS 发给自己子房间的任务显示在发送卡上。“已完成”表示
|
|
|
33
33
|
- **私聊**:已绑定渠道的房主私聊汇到这里,回复发回原渠道。引用主动汇报的回复仍回主理人,引用其他房间通知的回复仍回通知所属房间。私聊与主理人的新记录、AI 会话和设置各自独立,已有记录不迁移。
|
|
34
34
|
- **群**:每个已开启的群有独立窗口,网页里可以看记录,不能从这里向群发消息。手机上,顶栏第一行就是各个窗口的标签,左右滑动切换,在等你答复的群圆点更醒目;想看每个窗口的最近消息和今天用量,点右上角筛选按钮菜单最后的“全部窗口”,或长按任一标签。
|
|
35
35
|
|
|
36
|
+
三种窗口都和普通房间一样有“私聊”标签,可以单独和 MOSS 说话(见[私聊与执行中插话](working.md#5-私聊与执行中插话));它和上面的“私聊”窗口是两回事。群窗口里的私聊只在网页上,不会发到群;MOSS 正在群里回复时,私聊会等它回复完再处理。
|
|
37
|
+
|
|
36
38
|
第一次在网页点“私聊”时,先为私聊选软件、模型和强度,再点“开始对话”;之后渠道私聊会直接进这个窗口。渠道消息先到、私聊还没选软件时,MOSS 会回一条带链接的提示,点开就是这个选择页。私聊默认只读,可以独立调到“自动”。它可以建房和传话,但平台类技能不出现在清单里,CLI 会拒绝改平台的命令。若调高权限,本机进程可能仍能直接访问本机接口或改配置文件。需要改平台时用主理人,不把私聊的限制当作本机沙箱。
|
|
37
39
|
|
|
38
40
|
渠道私聊正常送达不会单独回执,排队、尚未配置或发送失败时会提示。回答按单条上限分段发送,超过三段则发概述和网页链接。
|
|
@@ -43,13 +45,12 @@ MOSS 忙时,新消息会排队。支持实时插话且当前请求也来自同
|
|
|
43
45
|
|
|
44
46
|
目前只支持已绑定的 QQ 个人号(OneBot)群。接收群消息时只取文字,回发可含图片和文件。使用非官方协议有账号被限制或封禁的风险。只在你同意记录消息的群里开启。
|
|
45
47
|
|
|
46
|
-
先在 QQ 里把 MOSS 使用的 QQ
|
|
48
|
+
先在 QQ 里把 MOSS 使用的 QQ 号拉进群,再在网页开启。只拉进群不会开启,在群里 @ MOSS 也不会:
|
|
47
49
|
|
|
48
50
|
- **窗口列表可以收起**:电脑上,窗口列表在对话左边;点“窗口”右侧的按钮可以把它收成一列头像,再点展开。
|
|
49
51
|
- **在网页开启**:点 MOSS 窗口列表底部的“加入群”,弹窗会显示 MOSS 的 QQ 号。搜索并选择群,确认设置后开启。刚加入的群没出现时,刷新群列表。能核实群成员时,弹窗会提醒你绑定的房主账号是否不在群里。查不到时不作判断。“进群后说一句自我介绍”默认不勾选。
|
|
50
|
-
- **在 QQ 群里开启**:用已绑定的房主本人账号 @ MOSS,正文写“开始工作”。MOSS 会在群里确认,或说明不能开启的原因。默认“小事直接做”,每天唤醒上限 30、委托上限 5,不选可读目录或技能。其他人发同样的话或改成房主的昵称都无效,程序只认绑定的账号。
|
|
51
52
|
|
|
52
|
-
|
|
53
|
+
停止时,可以在网页的群设置中关闭开关,或由已绑定的房主本人账号在群里 @ MOSS,正文写“停止工作”(其他人发同样的话或改成房主的昵称都无效)。群里操作成功后会收到确认。停止后不再接收或回复新消息,已有记录保留,QQ 号不会退群。
|
|
53
54
|
|
|
54
55
|
如果已配置的智能调度请求失败,@ MOSS 的消息和房主本人的消息仍按原有限额和权限交给 MOSS,由它决定是否回复。其他消息只记录。失败原因可在群设置的最近失败中查看。
|
|
55
56
|
|
package/docs/guide/workflows.md
CHANGED
|
@@ -62,9 +62,8 @@
|
|
|
62
62
|
|
|
63
63
|
## 要注意什么
|
|
64
64
|
|
|
65
|
-
- **首次启用陌生仓库的工作流**。项目工作流登记了本机命令或包含高于只读权限的卡片时,首次启用需要确认。也可以从房间右栏的“邀请 AI 加入”选择工作流。在“信任项目工作流”弹窗核对高权限成员卡片和登记的命令。通过 `/` 选用时点“信任并继续”,随后补充请求并发送。通过邀请入口启用时点“信任并启用”。不想进房间时,也可以在“工作流”页点卡片上的“待信任”,或卡片“…”菜单里的“信任…”,在同一个弹窗里点“信任”。信任记录保存在本机。之后修改 SKILL.md、卡片提示词、参考资料或画布不需要再确认;新增或修改命令及其脚本、调高卡片权限时需要重新确认。
|
|
66
65
|
|
|
67
66
|
- **改一次作用于全部房间**:修改并保存工作流后,已启用它的房间在下一次执行时读取最新流程说明与角色提示词。已有成员的模型、强度和权限仍取房间设置。
|
|
68
|
-
- **导入别人工作流时的安全检查**:导入 `.zip`
|
|
67
|
+
- **导入别人工作流时的安全检查**:导入 `.zip` 或文件夹时会先上画布预览,卡片按工作流里写的项目权限导入,这只是成员启用时的初始权限,之后你和主持人随时可改;若工作流包含给只读 API 成员登记本机命令的 `commands.json`,编辑页会列出完整命令,勾选“允许这些命令在本机运行”才会生效。主持人起草或修改工作流时不能增删本机命令。
|
|
69
68
|
- **只放开一部分**:展开“主持人完整权限”下的“具体权限”,按项勾选:“处理执行问题”“调整成员配置”“改项目权限”“管理成员名单”“推进方式”“工作流”“新建房间”。主持人保存和启用工作流需要其中的“工作流”;没勾选的操作会被拒绝,并告诉主持人缺哪一项。
|
|
70
69
|
- **仍由你掌控的边界**:即使开了“主持人完整权限”,更换主持人、批准超出上限的轮数、放行被拒绝的工具、改项目目录、撤回你的消息和私聊仍只由你决定。
|
|
@@ -843,5 +843,6 @@
|
|
|
843
843
|
"云上临时文件:已删除 {deleted} 个,待清理 {pending} 个": "Temporary cloud files: {deleted} deleted, {pending} remaining",
|
|
844
844
|
"上传文件(单个不超过 2 GiB)": "Upload files (up to 2 GiB each)",
|
|
845
845
|
"{done} / {total}": "{done} / {total}",
|
|
846
|
-
"无法连接分享站": "Could not reach the share site"
|
|
846
|
+
"无法连接分享站": "Could not reach the share site",
|
|
847
|
+
"引用文件": "File references"
|
|
847
848
|
}
|
|
@@ -396,5 +396,6 @@
|
|
|
396
396
|
"esc 关闭 · 单项后台工作不能在这里停止": "esc to close · a single background task cannot be stopped here",
|
|
397
397
|
"后台": "Background",
|
|
398
398
|
"后台还有 {value1} 项工作在运行,明细见私聊": "{value1} background tasks still running; see the private chat for details",
|
|
399
|
-
"{member} 排队中:做完当前这件后接 #{message}": "{member} is queued to take #{message} after finishing the current task"
|
|
399
|
+
"{member} 排队中:做完当前这件后接 #{message}": "{member} is queued to take #{message} after finishing the current task",
|
|
400
|
+
"找不到 {value1} 所在的项目目录": "Could not find the project directory that holds {value1}"
|
|
400
401
|
}
|
|
@@ -627,6 +627,7 @@
|
|
|
627
627
|
"未能{value1}": "Could not {value1}",
|
|
628
628
|
"和": "With",
|
|
629
629
|
"用它在房间里的同一个会话回答,记录只有你看得到": "Uses the same session as the room; only you can see this chat",
|
|
630
|
+
"私聊只在这里,不会发到群;MOSS 正在群里回复时,私聊会等它回复完再处理": "This chat stays here and is never sent to the group; while MOSS is replying in the group, it waits until that reply is done",
|
|
630
631
|
"正在读取私聊": "Loading private chat",
|
|
631
632
|
"回复于": "Replied at",
|
|
632
633
|
"未能读取过程:{value1}": "Could not load progress: {value1}",
|
|
@@ -954,19 +955,7 @@
|
|
|
954
955
|
"暂不计时:房间里还有未完成的工作、待你回答的提问或分享网页": "Paused: the room still has unfinished work, a question for you, or a share page",
|
|
955
956
|
"本项目工作流": "Project workflows",
|
|
956
957
|
"全局工作流": "Global workflows",
|
|
957
|
-
"已信任项目工作流「{name}」": "Trusted project workflow “{name}”",
|
|
958
|
-
"待信任": "Untrusted",
|
|
959
|
-
"信任项目工作流「{name}」": "Trust project workflow “{name}”",
|
|
960
|
-
"这个项目工作流来自项目目录,尚未在这台电脑上确认信任。启用前请核对以下权限与命令:": "This project workflow comes from a project folder and has not been trusted on this computer yet. Review these permissions and commands before enabling:",
|
|
961
|
-
"所属项目:{name}": "Project: {name}",
|
|
962
|
-
"高权限成员卡片": "Elevated member cards",
|
|
963
|
-
"登记的命令(commands.json)": "Registered commands (commands.json)",
|
|
964
|
-
"确认后将记录在这台电脑的信任清单中;若工作流内容发生变更,会再次要求确认。": "Once confirmed, this computer remembers your trust choice. You will be asked again if the workflow changes.",
|
|
965
|
-
"信任并继续": "Trust and continue",
|
|
966
|
-
"信任并启用": "Trust and enable",
|
|
967
958
|
"信任": "Trust",
|
|
968
|
-
"信任…": "Trust…",
|
|
969
|
-
"查看并信任": "Review and trust",
|
|
970
959
|
"当前项目": "Current project",
|
|
971
960
|
"只读目录": "Read-only folder",
|
|
972
961
|
"全局": "Global",
|
|
@@ -974,13 +963,9 @@
|
|
|
974
963
|
"导入到全局": "Import to global",
|
|
975
964
|
"导出「{value1}」(项目)": "Export “{value1}” (Project)",
|
|
976
965
|
"项目预设": "Project presets",
|
|
977
|
-
"未信任目录的高权限预设,加入后默认只读,可在卡片背面确认放开": "Elevated preset from an untrusted folder; starts read-only until confirmed on the card's back",
|
|
978
966
|
"项目专家预设": "Project expert preset",
|
|
979
967
|
"添加项目预设 {name}": "Add project preset {name}",
|
|
980
|
-
"{current}(请求{requested},未信任)": "{current} (requests {requested}, untrusted)",
|
|
981
|
-
"已信任项目预设「{name}」并放开权限": "Trusted project preset “{name}” and granted access",
|
|
982
968
|
"预设名称会显示在“项目预设”行和房间里,可以不带平台前缀。": "This name shows in the Project presets row and the room; the platform prefix is optional.",
|
|
983
|
-
"该项目预设请求“{access}”权限,未信任目录默认只读;勾选以信任并放开": "This project preset requests “{access}” access and starts read-only in an untrusted folder; tick to trust and grant it",
|
|
984
969
|
"存下描述、提示词、项目权限、模型与强度,之后在“预设”或“项目预设”行一键加入。": "Saves the description, prompt, project access, model and effort so it can be added from Presets or Project presets in one click.",
|
|
985
970
|
"保存位置": "Save to",
|
|
986
971
|
"预设保存位置": "Preset save location",
|
|
@@ -584,7 +584,6 @@
|
|
|
584
584
|
"导入专家(文件夹)": "Import expert (folder)",
|
|
585
585
|
"导出「{value1}」": "Export “{value1}”",
|
|
586
586
|
"已导入专家「{value1}」": "Imported expert “{value1}”",
|
|
587
|
-
"它要求的项目权限“{value1}”已降为只读,需要时在预设里改": "The project access it asked for (“{value1}”) was lowered to read-only; change it in the preset if needed",
|
|
588
587
|
"已忽略:{value1}": "Ignored: {value1}",
|
|
589
588
|
"导入导出专家": "Import / export experts",
|
|
590
589
|
"本机已有这位专家的知识库,已保留本机的": "This computer already has this expert’s knowledge; it was kept",
|
|
@@ -600,7 +599,6 @@
|
|
|
600
599
|
"进入": "Open",
|
|
601
600
|
"从画布移除子工作流节点": "Remove sub-workflow node from canvas",
|
|
602
601
|
"按住拖动": "Hold to drag",
|
|
603
|
-
"允许「{value1}」": "Allow “{value1}”",
|
|
604
602
|
"说明,如“返工”": "Label, e.g. “Revise”",
|
|
605
603
|
"这条连线的说明": "Connection label",
|
|
606
604
|
"删除这条连线": "Delete this connection",
|
|
@@ -730,7 +728,6 @@
|
|
|
730
728
|
"{value1} 的模型": "Model for {value1}",
|
|
731
729
|
"{value1} 的强度": "Effort for {value1}",
|
|
732
730
|
"{value1} 的项目权限": "Project access for {value1}",
|
|
733
|
-
"导入的卡片先在画布上授予它要求的权限": "Grant the imported card's requested access on the canvas first",
|
|
734
731
|
"这个工作流还没有成员卡片。": "This workflow has no member cards yet.",
|
|
735
732
|
"画布或工作流说明": "Canvas or workflow instructions",
|
|
736
733
|
"画布:成员卡片与示意连线": "Canvas: member cards and illustrative connections",
|
|
@@ -849,7 +846,6 @@
|
|
|
849
846
|
"专家包(.md)": "Expert package (.md)",
|
|
850
847
|
"专家包(压缩包)": "Expert package (zip)",
|
|
851
848
|
"专家包(文件夹)": "Expert package (folder)",
|
|
852
|
-
"它要求的项目权限“{value1}”已降为只读,需要时在这里改": "The project access it asked for, “{value1}”, was lowered to read-only; change it here if needed",
|
|
853
849
|
"先保存这页的修改": "Save this page’s changes first",
|
|
854
850
|
"放进「{value1}」": "Into “{value1}”",
|
|
855
851
|
"导入专家包": "Import expert package",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"未指定,将使用第一位本机已配置的 AI": "Not set; the first AI configured on this computer will be used",
|
|
88
88
|
"先给 MOSS 选一个软件": "Choose software for MOSS first",
|
|
89
89
|
"先给私聊选一个软件": "Choose software for private chat first",
|
|
90
|
-
"
|
|
90
|
+
"微信、QQ 里私聊 MOSS 的消息都在这里,由你选的软件回复。": "Private messages to MOSS on WeChat or QQ land here, answered by the software you choose.",
|
|
91
91
|
"MOSS 用你选的 AI 软件工作。选好后点“开始对话”,它会先说说现在各房间的情况。": "MOSS works through the AI software you choose. Pick one and select “Start conversation”; it will begin by telling you how your rooms are doing.",
|
|
92
92
|
"告诉你各房间现在怎么样、哪里在等你。": "Tell you how each room is doing and where you're needed.",
|
|
93
93
|
"直接办平台的事:安装、部署、配置、排障。": "Handle platform tasks itself: installing, deploying, configuring and troubleshooting.",
|
|
@@ -218,7 +218,7 @@
|
|
|
218
218
|
"MOSS 在「{name}」里能做什么": "What MOSS may do in “{name}”",
|
|
219
219
|
"先在 QQ 里把 MOSS 的号 {id} 拉进群,它在群里才收得到消息。": "First add MOSS's account {id} to the group in QQ; only then does it receive the group's messages.",
|
|
220
220
|
"先在 QQ 里把 MOSS 的号拉进群,它在群里才收得到消息。": "First add MOSS's account to the group in QQ; only then does it receive the group's messages.",
|
|
221
|
-
"
|
|
221
|
+
"只能在这里开启;要停下,可以在群里 @MOSS 说“停止工作”,只认你本人的账号。": "A group can only be turned on here. To stop, @MOSS “停止工作” (stop work) in the group; only your own account counts.",
|
|
222
222
|
"还没有绑定 QQ 个人号,绑定后才能选群。": "No personal QQ account is bound yet; bind one to choose a group.",
|
|
223
223
|
"还没有能进群的聊天渠道;目前只有 QQ 个人号(OneBot)可以。": "No chat channel can join groups yet; for now only a personal QQ account (OneBot) can.",
|
|
224
224
|
"搜索群名或群号": "Search group name or number",
|
package/package.json
CHANGED
package/runner/codiscuss.mjs
CHANGED
|
@@ -174,10 +174,15 @@ async function moss_window_guard(args) {
|
|
|
174
174
|
const file = process.env.DISCUSS_ACCESS_FILE || (flag >= 0 ? args[flag].split(/=(.*)/s)[1] ?? args[flag + 1] : '');
|
|
175
175
|
if (!file) return;
|
|
176
176
|
const { readFileSync } = await import('node:fs');
|
|
177
|
-
const { window } = JSON.parse(readFileSync(file, 'utf8').replace(/^\uFEFF/, ''));
|
|
177
|
+
const { window, private_chat } = JSON.parse(readFileSync(file, 'utf8').replace(/^\uFEFF/, ''));
|
|
178
178
|
if (!['private', 'group'].includes(window)) return;
|
|
179
179
|
lockdown_access_guard(args, { CODISCUSS_TOOL_LOCKDOWN: '1', DISCUSS_ACCESS_FILE: file, DISCUSS_ACCESS: process.env.DISCUSS_ACCESS });
|
|
180
180
|
const [command, sub, action] = args;
|
|
181
|
+
if (window === 'group' && private_chat) {
|
|
182
|
+
if (['help', '--help', '-h'].includes(command) || (command === 'room' && sub === 'view') ||
|
|
183
|
+
(command === 'message' && ['view', 'list'].includes(sub))) return;
|
|
184
|
+
throw new Error(t('群窗口的私聊只能读取房间和消息,不能从命令行发言或修改房间。'));
|
|
185
|
+
}
|
|
181
186
|
const input = args.some(arg => /^--(?:file|stdin)(?:=|$)/.test(arg));
|
|
182
187
|
const status = !input && (['settings', 'object-storage-settings', 'presets', 'projects', 'image-settings', 'tts-settings',
|
|
183
188
|
'local-speech', 'weixin', 'devices', 'browse-directory'].includes(sub) ||
|
|
@@ -40,7 +40,7 @@ import { access_levels, BUILTIN_EXPERT_PRESETS, MAX_EXPERT_PROMPT, PROJECT_ACCES
|
|
|
40
40
|
import { acquire_lock, api, check_extra_directories, DiscussionStore, service_drafts, validate_config } from './discussion_runner.mjs';
|
|
41
41
|
import { FreeRoomRunner, free_task_files, member_drafts, member_extra_directories } from './free_runner.mjs';
|
|
42
42
|
import { skill_digest } from './discussion_skills.mjs';
|
|
43
|
-
import { transfer_workflow, bound_workflow, room_workflow_store,
|
|
43
|
+
import { transfer_workflow, bound_workflow, room_workflow_store, assert_workflow_enabled, bind_room_workflow, delete_workflow, get_workflow, list_workflows, load_room_workflow, parse_workflow_draft, preview_workflow, rename_workflow, save_workflow, set_workflow_disabled, workflow_cards, workflow_directory, workflow_member_list, WORKFLOW_ID_PATTERN,
|
|
44
44
|
card_folder, expert_disk_key, CARD_ID_PATTERN, expert_skills, experts_home, load_room_workflow as load_workflow_for_cards, parse_markdown, serialize_markdown, SKILL_FILE,
|
|
45
45
|
SKILL_NAME_PATTERN, SKILLS_DIRECTORY, workflow_part_files, write_workflow_part_file, delete_workflow_part_file } from './workflows.mjs';
|
|
46
46
|
import { assert_shared_home, CONNECTION_FIELDS, configuration_snapshot, read_registry, registered_identity, register_room, service_home, service_pid, start_service } from './discussion_service.mjs';
|
|
@@ -2516,7 +2516,7 @@ export function presets_command(home, input = {}, restricted = false) {
|
|
|
2516
2516
|
if (input.scope && !['project', 'global'].includes(input.scope)) throw new Error('专家作用域无效');
|
|
2517
2517
|
const roots = library_projects(home, input, restricted);
|
|
2518
2518
|
let global;
|
|
2519
|
-
if (input.scope === 'project'
|
|
2519
|
+
if (input.scope === 'project') {
|
|
2520
2520
|
const root = roots.find(item => input.project_id ? item.id === input.project_id : item.primary);
|
|
2521
2521
|
if (!root) throw new Error('找不到已授权的项目目录');
|
|
2522
2522
|
if (input.action !== 'list') change_project_expert(home, root, input, validate_preset);
|
|
@@ -2536,7 +2536,6 @@ export function presets_command(home, input = {}, restricted = false) {
|
|
|
2536
2536
|
/** The workflow library: list, read, save, rename, disable or enable, delete, preview an import, or read a room's member cards. */
|
|
2537
2537
|
export function workflows_command(home, input = {}, restricted = false) {
|
|
2538
2538
|
const action = input.action || 'list';
|
|
2539
|
-
if (action === 'trust') input = { ...input, scope: 'project' };
|
|
2540
2539
|
if (restricted && input.folder) throw new Error('其他设备请选择 zip 或文件夹导入工作流');
|
|
2541
2540
|
if (input.scope && !['global', 'project'].includes(input.scope)) throw new Error('工作流作用域无效');
|
|
2542
2541
|
const roots = action === 'list' && input.all_projects === true ? saved_workflow_projects(home, restricted)
|
|
@@ -2551,7 +2550,7 @@ export function workflows_command(home, input = {}, restricted = false) {
|
|
|
2551
2550
|
const root = input.scope === 'project' ? roots.find(item => input.project_id ? item.id === input.project_id : item.primary) : null;
|
|
2552
2551
|
if (input.scope === 'project' && !root) throw new Error('找不到已授权的项目目录');
|
|
2553
2552
|
const store = root ? project_store(home, root) : home;
|
|
2554
|
-
if (root?.readonly && !['get', 'export', 'preview', 'skills', 'files', 'export-expert', '
|
|
2553
|
+
if (root?.readonly && !['get', 'export', 'preview', 'skills', 'files', 'export-expert', 'copy'].includes(action)) throw new Error('项目目录只读');
|
|
2555
2554
|
const fields = scope_fields(root);
|
|
2556
2555
|
const present = workflow => {
|
|
2557
2556
|
const result = { ...workflow, ...fields };
|
|
@@ -2583,10 +2582,6 @@ export function workflows_command(home, input = {}, restricted = false) {
|
|
|
2583
2582
|
return { ...result, ...scope_fields(target), room_updated };
|
|
2584
2583
|
} finally { if (release) release(); }
|
|
2585
2584
|
}
|
|
2586
|
-
if (action === 'trust' && root) {
|
|
2587
|
-
trust_workflow(store, input.id);
|
|
2588
|
-
return { ...fields, ok: true, id: input.id, trusted: true };
|
|
2589
|
-
}
|
|
2590
2585
|
if (action === 'get') return present(get_workflow(store, input.id));
|
|
2591
2586
|
if (action === 'save') return present(save_workflow(store, input.workflow, validate_preset, { base_revision: input.base_revision, overwrite: input.overwrite === true }));
|
|
2592
2587
|
if (action === 'delete') return { ...delete_workflow(store, input.id), ...fields };
|
|
@@ -2626,7 +2621,8 @@ export function workflows_command(home, input = {}, restricted = false) {
|
|
|
2626
2621
|
// Exporting and importing an expert (user 2026-11-22): a definition `<id>.md` in the card format (front matter, prompt
|
|
2627
2622
|
// as body), and, for an expert with knowledge, `skills/<skill>/` beside it. The page and the command line send the
|
|
2628
2623
|
// same files map; only text files under skills/ and the one definition are taken.
|
|
2629
|
-
|
|
2624
|
+
// No project access: it is a member's setting in a room, not part of an expert (user 2026-11-29, #17320).
|
|
2625
|
+
const EXPERT_FILE_FIELDS = ['label', 'description', 'model', 'effort'];
|
|
2630
2626
|
const MAX_EXPERT_FILE_BYTES = 1000000;
|
|
2631
2627
|
const EXPERT_SEGMENT = /^[^./\\:*?"<>|\x00-\x1f][^/\\:*?"<>|\x00-\x1f]{0,99}$/;
|
|
2632
2628
|
const utf8_strict = new TextDecoder('utf-8', { fatal: true });
|
|
@@ -2842,24 +2838,24 @@ export function read_expert_source(path) {
|
|
|
2842
2838
|
* zip or folder into these; the command line a .md or folder). The one top-level .md is the definition; skills/<skill>/
|
|
2843
2839
|
* files with a SKILL.md become its knowledge; anything else is ignored and listed. Nothing is replaced silently: a preset
|
|
2844
2840
|
* of that name needs `overwrite_preset`, and existing knowledge is kept unless `replace_knowledge`, which first moves
|
|
2845
|
-
* the old one into backups/.
|
|
2841
|
+
* the old one into backups/.
|
|
2846
2842
|
*/
|
|
2847
2843
|
export function import_expert(home, { files = {}, ignored: unread = [], overwrite_preset = false, replace_knowledge = false } = {}) {
|
|
2848
|
-
const { preset, key,
|
|
2844
|
+
const { preset, key, skills, ignored } = expert_package(files, unread);
|
|
2849
2845
|
const current = expert_presets(home);
|
|
2850
2846
|
const taken = current.presets.some(item => item.name === preset.name);
|
|
2851
2847
|
if (taken && overwrite_preset !== true) throw expert_failure('expert_preset_exists', '面板上已有预设「{name}」;要用导入的替换它,请明确选择覆盖', { name: preset.name });
|
|
2852
2848
|
// The preset is saved first: a full list or a bad field stops the import before any knowledge is written.
|
|
2853
2849
|
change_project_expert(home.service_home || home, home.root, { action: 'save', preset, overwrite: overwrite_preset }, validate_preset);
|
|
2854
2850
|
const { knowledge, backup } = install_knowledge(home, key && expert_disk_key(experts_home(home), platform_of(preset.name), key), skills, replace_knowledge === true);
|
|
2855
|
-
return { preset, ...
|
|
2851
|
+
return { preset, ...expert_readiness(home, preset), knowledge, skills: Object.keys(skills).sort(),
|
|
2856
2852
|
...(backup ? { backup } : {}), ignored: [...new Set(ignored)].sort() };
|
|
2857
2853
|
}
|
|
2858
2854
|
|
|
2859
2855
|
/**
|
|
2860
2856
|
* Read an expert package `{relative path: text}`: the one top-level .md is the definition, `skills/<skill>/` files of a
|
|
2861
|
-
* skill with a SKILL.md its knowledge; anything else is ignored.
|
|
2862
|
-
* Returns the preset, its key (the definition's name),
|
|
2857
|
+
* skill with a SKILL.md its knowledge; anything else is ignored.
|
|
2858
|
+
* Returns the preset, its key (the definition's name), `{skill: {path: text}}` and the ignored.
|
|
2863
2859
|
*/
|
|
2864
2860
|
function expert_package(files, unread = []) {
|
|
2865
2861
|
const ignored = [...unread];
|
|
@@ -2872,8 +2868,6 @@ function expert_package(files, unread = []) {
|
|
|
2872
2868
|
const preset = { name: key ? `${platform}-${key}` : platform,
|
|
2873
2869
|
...Object.fromEntries(EXPERT_FILE_FIELDS.filter(field => typeof fields[field] === 'string' && fields[field]).map(field => [field, fields[field]])),
|
|
2874
2870
|
...(body ? { system_prompt: body } : {}) };
|
|
2875
|
-
const requested = preset.project_access && preset.project_access !== 'read' ? preset.project_access : '';
|
|
2876
|
-
if (requested) preset.project_access = 'read';
|
|
2877
2871
|
validate_preset(preset);
|
|
2878
2872
|
// Skills: only text files below skills/<skill>/ whose skill has a SKILL.md, and paths that stay inside it.
|
|
2879
2873
|
const skills = {};
|
|
@@ -2888,7 +2882,7 @@ function expert_package(files, unread = []) {
|
|
|
2888
2882
|
if (!Object.hasOwn(content, SKILL_FILE)) { ignored.push(...Object.keys(content).map(path => `${SKILLS_DIRECTORY}/${skill}/${path}`)); delete skills[skill]; }
|
|
2889
2883
|
}
|
|
2890
2884
|
if (Object.keys(skills).length && !key) throw new Error('带技能的专家须有编号(定义文件的 name)');
|
|
2891
|
-
return { preset, key,
|
|
2885
|
+
return { preset, key, skills, ignored };
|
|
2892
2886
|
}
|
|
2893
2887
|
|
|
2894
2888
|
/**
|
|
@@ -2929,10 +2923,10 @@ function install_knowledge(home, key, skills, replace) {
|
|
|
2929
2923
|
* Import an expert package as a card of a saved workflow (`expert-import --workflow ID [--sub SUB]`): into the main
|
|
2930
2924
|
* flow's agents/ or a sub-workflow's, a folder card with its skills when the package has any, else a card file. A card
|
|
2931
2925
|
* ID the workflow already uses anywhere is refused, never replaced. The save names the revision just read, so it keeps
|
|
2932
|
-
* every other card's skills as they are.
|
|
2926
|
+
* every other card's skills as they are.
|
|
2933
2927
|
*/
|
|
2934
2928
|
export function import_expert_to_workflow(home, { files = {}, ignored: unread = [], workflow: id, sub } = {}) {
|
|
2935
|
-
const { preset, key,
|
|
2929
|
+
const { preset, key, skills, ignored } = expert_package(files, unread);
|
|
2936
2930
|
if (!key) throw new Error('导入到工作流的专家须有编号(定义文件的 name),它就是卡片 ID');
|
|
2937
2931
|
const workflow = get_workflow(home, id);
|
|
2938
2932
|
if (workflow_cards(workflow).some(agent => agent.card.toLowerCase() === key.toLowerCase())) {
|
|
@@ -2946,7 +2940,7 @@ export function import_expert_to_workflow(home, { files = {}, ignored: unread =
|
|
|
2946
2940
|
subs = subs.map(item => item.id === sub ? { ...item, agents: [...item.agents, card] } : item);
|
|
2947
2941
|
} else agents = [...agents, card];
|
|
2948
2942
|
const saved = save_workflow(home, { ...workflow, agents, sub_workflows: subs }, validate_preset, { base_revision: workflow.revision });
|
|
2949
|
-
return { workflow: saved.id, ...(sub ? { sub } : {}), card: key, revision: saved.revision,
|
|
2943
|
+
return { workflow: saved.id, ...(sub ? { sub } : {}), card: key, revision: saved.revision,
|
|
2950
2944
|
...expert_readiness(home, preset), skills: Object.keys(skills).sort(), ignored: [...new Set(ignored)].sort() };
|
|
2951
2945
|
}
|
|
2952
2946
|
|
|
@@ -3022,7 +3016,6 @@ export async function room_workflow(home, raw) {
|
|
|
3022
3016
|
if (input.action === 'enable') {
|
|
3023
3017
|
const binding = input.workflow || {};
|
|
3024
3018
|
const store = room_workflow_store(home, config, binding);
|
|
3025
|
-
if (store.project_id && input.trust === true) trust_workflow(store, binding.id);
|
|
3026
3019
|
const next = bind_room_workflow(config, { ...binding, project_id: store.project_id, enabled: true });
|
|
3027
3020
|
bound_workflow(home, next);
|
|
3028
3021
|
validate_config({ ...next, api_home: home }, dirname(path));
|
|
@@ -3981,9 +3974,7 @@ export function check_or_save_workflow(home, { dir, draft, revision, overwrite,
|
|
|
3981
3974
|
const preview = workflows_command(home, { action: 'preview', ...source });
|
|
3982
3975
|
if (scope === 'project' && !library_projects(home, { cwd: project }).length) throw new Error('找不到项目目录');
|
|
3983
3976
|
if (!save) return preview;
|
|
3984
|
-
|
|
3985
|
-
const sub_workflows = preview.sub_workflows?.map(sub => ({ ...sub, agents: declared(sub.agents) }));
|
|
3986
|
-
return workflows_command(home, { action: 'save', scope, cwd: project, workflow: { ...preview, agents: declared(preview.agents), ...(sub_workflows ? { sub_workflows } : {}) },
|
|
3977
|
+
return workflows_command(home, { action: 'save', scope, cwd: project, workflow: preview,
|
|
3987
3978
|
base_revision: revision, overwrite: overwrite === true });
|
|
3988
3979
|
}
|
|
3989
3980
|
|
|
@@ -4249,16 +4240,15 @@ async function introduce_moss_group(home, channel, group, key, log = () => {}) {
|
|
|
4249
4240
|
}
|
|
4250
4241
|
}
|
|
4251
4242
|
|
|
4252
|
-
/**
|
|
4253
|
-
export async function
|
|
4243
|
+
/** The owner's 停止工作 in a group: the web page's group-disable, then quote the command. Turning on is web-only (#17310). */
|
|
4244
|
+
export async function moss_group_channel_stop(home, channel, item) {
|
|
4254
4245
|
let reply;
|
|
4255
4246
|
try {
|
|
4256
|
-
await moss_group_command(home, { action:
|
|
4247
|
+
await moss_group_command(home, { action: 'group-disable', channel: channel.id, chat_id: item.chat.id },
|
|
4257
4248
|
{ channels: [channel], start_service: async () => ({ running: true }) });
|
|
4258
|
-
reply =
|
|
4249
|
+
reply = t('MOSS 已停止在本群工作,群记录保留。');
|
|
4259
4250
|
} catch (error) {
|
|
4260
|
-
reply =
|
|
4261
|
-
: t('MOSS 未能在本群停止工作:{reason}', { reason: error.message });
|
|
4251
|
+
reply = t('MOSS 未能在本群停止工作:{reason}', { reason: error.message });
|
|
4262
4252
|
}
|
|
4263
4253
|
await channel.deliver(home, reply, { chat: item.chat, reply_to: item.message_id });
|
|
4264
4254
|
}
|
|
@@ -886,9 +886,10 @@ export class DiscussionService {
|
|
|
886
886
|
const owner = channel.owner_id?.(this.home);
|
|
887
887
|
if (owner && item.sender?.id === owner && item.mentioned === true) {
|
|
888
888
|
const text = item.text?.trim();
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
889
|
+
// Only stopping works from the group; a group is turned on from the web page alone (user #17310).
|
|
890
|
+
if (text === '停止工作' && window?.enabled) {
|
|
891
|
+
const { moss_group_channel_stop } = await import('./discussion_launch.mjs');
|
|
892
|
+
return moss_group_channel_stop(this.home, channel, item);
|
|
892
893
|
}
|
|
893
894
|
}
|
|
894
895
|
if (!window?.enabled) return;
|
package/runner/experts.mjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { BUILTIN_EXPERT_PRESETS } from './expert_prompts.mjs';
|
|
2
|
-
import {
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
3
|
import { cpSync, existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
|
|
4
|
-
import {
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
5
|
import { DatabaseSync } from 'node:sqlite';
|
|
6
6
|
import { atomic_json } from './files.mjs';
|
|
7
7
|
import { expert_disk_key, expert_skills, parse_markdown, serialize_markdown } from './workflows.mjs';
|
|
8
8
|
|
|
9
9
|
const ID = /^[a-zA-Z0-9_]{1,16}$/;
|
|
10
|
-
|
|
10
|
+
// Project access is a member's setting in a room (the user or host gives it), never part of an expert's definition.
|
|
11
|
+
const FIELDS = ['label', 'description', 'model', 'effort'];
|
|
11
12
|
|
|
12
13
|
function checked(...paths) {
|
|
13
14
|
for (const path of paths) {
|
|
@@ -30,36 +31,10 @@ function location(directory, id) {
|
|
|
30
31
|
return existsSync(folder) ? checked(join(folder, id + '.md')) : flat;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
function read_trust(home) {
|
|
36
|
-
const path = join(home, 'project-trust.json');
|
|
37
|
-
return existsSync(path) ? JSON.parse(readFileSync(path, 'utf8')) : {};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function digest(path) {
|
|
41
|
-
const hash = createHash('sha256').update(readFileSync(path));
|
|
42
|
-
const skills = join(dirname(path), 'skills');
|
|
43
|
-
function visit(directory, prefix) {
|
|
44
|
-
for (const item of readdirSync(directory, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
45
|
-
const file = checked(join(directory, item.name)), key = prefix + item.name;
|
|
46
|
-
if (item.isDirectory()) visit(file, key + '/');
|
|
47
|
-
else if (item.isFile()) hash.update(key).update('\0').update(readFileSync(file)).update('\0');
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (path === join(dirname(path), basename(dirname(path)) + '.md') && existsSync(checked(skills))) visit(skills, '');
|
|
51
|
-
return hash.digest('hex');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function record_trust(home, root, id, path) {
|
|
55
|
-
atomic_json(join(home, 'project-trust.json'), { ...read_trust(home), [trust_key(root, id)]: digest(path) });
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** Read standalone project experts, preserving requested access for owner approval. */
|
|
34
|
+
/** Read the experts saved in a project (or, without a root, the global library). */
|
|
59
35
|
export function project_experts(home, root, validate) {
|
|
60
36
|
const directory = root_path(root, home);
|
|
61
37
|
if (!existsSync(directory)) return [];
|
|
62
|
-
const records = root ? read_trust(home) : {};
|
|
63
38
|
const result = [];
|
|
64
39
|
for (const item of readdirSync(directory, { withFileTypes: true })) {
|
|
65
40
|
const disk = item.isDirectory() ? item.name : item.name.replace(/\.md$/, '');
|
|
@@ -72,17 +47,15 @@ export function project_experts(home, root, validate) {
|
|
|
72
47
|
const preset = { name: fields.name ? fields.platform + '-' + id : fields.platform, system_prompt: body };
|
|
73
48
|
for (const key of FIELDS) if (fields[key]) preset[key] = fields[key];
|
|
74
49
|
validate?.(preset);
|
|
75
|
-
const trusted = !root || records[trust_key(root, disk)] === digest(path);
|
|
76
50
|
const skills = checked(join(directory, disk), join(directory, disk, 'skills'));
|
|
77
51
|
if (existsSync(skills)) for (const entry of readdirSync(skills)) checked(join(skills, entry), join(skills, entry, 'SKILL.md'));
|
|
78
52
|
result.push({ ...preset, id, platform: fields.platform, scope: root ? 'project' : 'global',
|
|
79
|
-
...(root ? { project_id: root.id, project_name: root.name, readonly: root.readonly
|
|
80
|
-
...(!trusted && preset.project_access && preset.project_access !== 'read' ? { project_access: 'read', requested_access: preset.project_access } : {}) });
|
|
53
|
+
...(root ? { project_id: root.id, project_name: root.name, readonly: root.readonly } : {}), skills: expert_skills(join(directory, disk)) });
|
|
81
54
|
}
|
|
82
55
|
return result;
|
|
83
56
|
}
|
|
84
57
|
|
|
85
|
-
/** Edit one project preset under the
|
|
58
|
+
/** Edit one project preset under the local workflow lock. */
|
|
86
59
|
export function change_project_expert(home, root, input, validate) {
|
|
87
60
|
return with_expert_lock(home, () => update_definition(home, root, input, validate));
|
|
88
61
|
}
|
|
@@ -105,11 +78,6 @@ function update_definition(home, root, input, validate) {
|
|
|
105
78
|
const platform = name ? name.split('-')[0] : entries[0].platform;
|
|
106
79
|
const disk = expert_disk_key(directory, platform, id);
|
|
107
80
|
const path = location(directory, disk);
|
|
108
|
-
if (input.action === 'trust') {
|
|
109
|
-
if (!existsSync(path)) throw new Error('找不到项目专家');
|
|
110
|
-
if (root) record_trust(home, root, disk, path);
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
81
|
if (root?.readonly) throw new Error('项目目录只读');
|
|
114
82
|
if (input.action === 'delete') {
|
|
115
83
|
const current = project_experts(home, root, validate).find(item => item.id === id && (!name || item.name === name));
|
|
@@ -137,7 +105,6 @@ function update_definition(home, root, input, validate) {
|
|
|
137
105
|
writeFileSync(tmp, serialize_markdown({ name: name === platform ? '' : id, platform, ...fields }, preset.system_prompt));
|
|
138
106
|
renameSync(tmp, path);
|
|
139
107
|
} finally { rmSync(tmp, { force: true }); }
|
|
140
|
-
if (root) record_trust(home, root, disk, path);
|
|
141
108
|
}
|
|
142
109
|
|
|
143
110
|
function update_templates(home, templates) {
|