ai_co_discuss 0.5.7 → 0.5.8
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/workflow-creator/SKILL.md +1 -1
- package/docs/en/guide/admin.md +1 -1
- package/docs/en/guide/rooms.md +3 -3
- package/docs/en/guide/workflows.md +2 -2
- package/docs/guide/admin.md +1 -1
- package/docs/guide/rooms.md +3 -3
- package/docs/guide/workflows.md +2 -2
- package/frontend/locales/en/admin.json +6 -2
- package/frontend/locales/en/app.json +9 -1
- package/frontend/locales/en/backend.json +2 -0
- package/frontend/locales/en/settings.json +4 -0
- package/package.json +1 -1
- package/runner/discussion_launch.mjs +12 -8
- package/runner/project_files.mjs +3 -1
- package/runner/workflows.mjs +50 -4
- package/web/admin.css +1 -1
- package/web/admin.js +3 -3
- package/web/app.js +11 -8
- package/web/i18n.js +4 -4
- package/web/modern.css +1 -1
- package/web/modern.js +96 -94
- package/workflows/story-serial/SKILL.md +5 -1
- package/workflows/story-serial/flow.json +102 -32
- package/workflows/story-serial/workflows/jack-sparrow/SKILL.md +30 -0
- package/workflows/story-serial/workflows/jack-sparrow/agents/jack_sparrow.md +29 -0
- package/workflows/story-serial/workflows/jack-sparrow/flow.json +63 -0
- package/workflows/story-serial/workflows/jack-sparrow/references/catamaran-and-crew.md +29 -0
- package/workflows/story-serial/workflows/jack-sparrow/references/emergency-and-navigation.md +35 -0
- package/workflows/story-serial/workflows/jack-sparrow/references/resources-and-systems.md +29 -0
- package/workflows/story-serial/workflows/jack-sparrow/references/weather-and-anchoring.md +29 -0
- package/workflows/story-serial/workflows/jack-sparrow/references//347/233/256/345/275/225.md +10 -0
- package/workflows/story-serial/workflows/luke-nichols/SKILL.md +30 -0
- package/workflows/story-serial/workflows/luke-nichols/agents/luke_nichols.md +30 -0
- package/workflows/story-serial/workflows/luke-nichols/flow.json +63 -0
- package/workflows/story-serial/workflows/luke-nichols/references/fire-and-fuel.md +43 -0
- package/workflows/story-serial/workflows/luke-nichols/references/luke-videos.md +152 -0
- package/workflows/story-serial/workflows/luke-nichols/references/shelter-and-warmth.md +64 -0
- package/workflows/story-serial/workflows/luke-nichols/references/travel-and-ice.md +43 -0
- package/workflows/story-serial/workflows/luke-nichols/references//347/233/256/345/275/225.md +10 -0
|
@@ -136,7 +136,7 @@ project_access: write
|
|
|
136
136
|
|---|---|
|
|
137
137
|
| 房间主持人,任务里有 `host_workflows: true` | 房主已允许你自建:把草稿写成一个文件(下方“草稿格式”,只用一段 `1/1`),放在任务的 `draft_directory` 下,运行 `<cli> launch workflow-adopt --draft <文件> --access-file <本次任务的 access_file>`。程序校验、保存、在本房间启用并邀请缺少的卡片成员(离开的请回),返回 `members`(卡片 ID → 成员名),本次执行里就能点名派活。只能更新本房间绑定的工作流;卡片权限最高 write。 |
|
|
138
138
|
| 房间主持人,任务里没有该字段 | 你不能保存。告诉用户:在“成员与设置 → 协作设置”的“主持人权限”里勾选“工作流”后,你就能自己保存并启用;用户打开后再按上一行做。 |
|
|
139
|
-
| 不在房间里,用户直接让你建 | 先在一个临时文件夹里按“格式”写好,运行 `codiscuss launch workflow-check --dir <文件夹>` 校验;用户确认后运行 `codiscuss launch workflow-save --dir <文件夹>`
|
|
139
|
+
| 不在房间里,用户直接让你建 | 先在一个临时文件夹里按“格式”写好,运行 `codiscuss launch workflow-check --dir <文件夹>` 校验;用户确认后运行 `codiscuss launch workflow-save --dir <文件夹>` 保存进工作流库。库里已有同 ID 的工作流时,保存会被拒绝,须表明来意:改的是你读过的那一版,就加 `--revision <读取时的修订号>`(库在那之后被改过就拒绝,什么都不写,重新读取后再改);要整份覆盖,就先告诉用户、得到同意后加 `--overwrite`。修订号是整个文件夹的内容摘要,`codiscuss launch workflows` 的 get 返回的 `revision` 就是它。 |
|
|
140
140
|
|
|
141
141
|
不要直接写入本机服务目录的 `workflows/`:那样会跳过校验和写入锁,格式错的文件会让启用它的房间读不到工作流。命令失败时按报错修正,不要绕过。
|
|
142
142
|
|
package/docs/en/guide/admin.md
CHANGED
|
@@ -13,7 +13,7 @@ Use the local management panel or the corresponding codiscuss admin commands to
|
|
|
13
13
|
- **Settings:** View the installed version, select **Check for updates** or **Update and restart** (which also updates room skills and isolated accounts), enable **Start when signing in to Windows**, and change the panel language.
|
|
14
14
|
- **Account:**
|
|
15
15
|
- **Local account** is listed by default. When hosting is enabled, the page also lists **Hosted accounts** and a **New account** button.
|
|
16
|
-
- Select the administrator or a hosted account to manage its **CLI sign-ins** (Claude Code, Codex, and Gemini status, sign-in method, or sign-out; Setup Token is recommended for Claude Code), **API keys**, **Skills** (select from **Skill library** or import a ZIP/folder), **bundled workflows**, and **system prompt**. Updating the program leaves installed workflows unchanged; the workflows section
|
|
16
|
+
- Select the administrator or a hosted account to manage its **CLI sign-ins** (Claude Code, Codex, and Gemini status, sign-in method, or sign-out; Setup Token is recommended for Claude Code), **API keys**, **Skills** (select from **Skill library** or import a ZIP/folder), **bundled workflows**, and **system prompt**. Updating the program leaves installed workflows unchanged; the workflows section works like the update check on the overview page. A tag next to the title shows **Up to date** or how many workflows can be synced; the button in the top-right corner is **Check shipped workflows** while everything matches, and turns blue as **Sync to latest** once something differs. After you confirm, it installs the missing ones and replaces those that differ (each replaced copy is first backed up to `backups/workflows` in that account's service folder, and changes made there are replaced too).
|
|
17
17
|
|
|
18
18
|
## Hosted accounts for other people
|
|
19
19
|
|
package/docs/en/guide/rooms.md
CHANGED
|
@@ -38,7 +38,7 @@ You can also send a message from the blank home page to create a room and send i
|
|
|
38
38
|
|
|
39
39
|
- **Add or remove directories.** A room supports one primary directory and up to eight additional directories. After creating a room, open the “Room” tab at the top of the room and find “Project folder”. Add or remove additional directories there. Changes apply from each member’s next run and do not interrupt a session. A primary directory cannot be changed after it is set. If the room was created without one, you can set it once in the same section. Members can access all room directories subject to their individual project permissions.
|
|
40
40
|
- **Open Files.** In the tabs at the top of the room, select “Files” to browse directories, file sizes, and modification times. Switch between the primary and additional directories at the top. A project directory is required.
|
|
41
|
-
- **Preview files.** Select a file to open its floating preview. Supported previews include plain text, code, rendered Markdown, static HTML with a source view, zoomable and rotatable images, audio and video with speed and full-screen controls, CSV tables, subtitle timelines (SRT, VTT, ASS, LRC), read-only Word, Excel, PowerPoint and PDF,
|
|
41
|
+
- **Preview files.** Select a file to open its floating preview. Supported previews include plain text, code, rendered Markdown, static HTML with a source view, zoomable and rotatable images, audio and video with speed and full-screen controls, CSV tables, subtitle timelines (SRT, VTT, ASS, LRC), read-only Word, Excel, PowerPoint and PDF, Premiere project XML, and zip archives listed like a folder, where selecting a file inside opens it in a new tab. Relative project images in Markdown display inline.
|
|
42
42
|
- **Tabs, split view, and collapse.** Open multiple files and switch between tabs. Use the preview controls to split the view on the right or use “File location” to return to the containing folder. HTML previews also offer “Open in new tab”. Select “Collapse” in the title bar to keep the preview as a floating button in the corner. It restores the same file and scroll position when you return to the room. Close it to clear the preview.
|
|
43
43
|
- **Quote and annotate.** Select text in a Markdown preview or a member’s answer and choose “Add to conversation”. Enter a note and press Enter. The source is marked with a number and the composer shows the number of notes. Sending the message adds a file path and line number, the member and message ID, or for a message attachment its message ID and attachment ID. An `@` inside a quote does not wake a member.
|
|
44
44
|
- **Manage project files.** Select “Project” at the start of the path bar to open your projects and drafts. Use the top controls to create folders and upload files (up to 20 MB each). File menus offer “Download” (“Download folder” for a folder, packed as a ZIP), “Rename”, “Copy”, “Cut”, and “Delete”. Paste into the destination folder. Deleted files and replaced versions go to “Recycle bin” for 30 days, where they can be restored. In source view, the pencil button edits text files up to 1 MB. Project and draft roots, and folders currently used as room project directories, cannot be renamed, moved, or deleted.
|
|
@@ -57,9 +57,9 @@ You can also send a message from the blank home page to create a room and send i
|
|
|
57
57
|
- “Download web page” gives you a single `.html` file that opens in any browser. Once sent, it cannot expire or be taken back.
|
|
58
58
|
- “Publish link” uploads it to the official share site and copies the link. Choose whether it expires in 1, 3 or 7 days; it is deleted when it expires. “Shared” then appears below the room list, listing every live share link with its time left, to copy, open, renew (same content, a new lifetime from now) or revoke. The room’s menu also offers “Copy share link” and “Revoke share link”, and “Share as web page…” again offers “Update link” to show the latest content. Links are kept with the room on the computer, so paired phones and tablets can manage them too. Rooms over 5 MB after cleaning need the web page file instead.
|
|
59
59
|
|
|
60
|
-
Either way, readers see the room’s **Messages** and **Runs** views from the beginning, as they look here: cards
|
|
60
|
+
Either way, readers see the room’s **Messages** and **Runs** views from the beginning, as they look here: cards and run details open; each time **Runs** is opened it replays the session from the start, and “End replay” returns to the final state. The other tabs, such as **Private**, **Room** and **Files**, are dimmed and show only a sample; but nothing can be sent or changed, and the page shows the room as it was when it was made. Private chats, the event log, scheduling decisions, refused actions, queued messages, paths on this computer, session IDs and credentials are left out, as are retracted or rewound messages; failure reasons read only “Run failed”, and the room’s project folders are rewritten in message text as paths inside the project. The rest of the message text is shared as written, so check it before sending.
|
|
61
61
|
|
|
62
|
-
Attachments are left out by default, and attachment tags in messages read “not included in the share”. When the room has attachments, the confirmation offers “Include attachments”: ticked, every attachment (images, videos, web pages, documents and so on) goes into the page as it is, for readers to view and download. Text attachments are checked for keys and local folders too; the contents of images, videos and other files cannot be checked, so look through them yourself. A share link carries the attachments the page can preview — images, audio, video, PDF, Word/Excel/PowerPoint (docx, xlsx, pptx), text and code, and web pages — for readers to open right in the page; scripts that run on a double click, such as js, bat and ps1, go with .txt added to their names. Archives, programs and old doc/xls/ppt files stay off the share site and their messages read “not included in the share”, while a downloaded web page file still carries them.
|
|
62
|
+
Attachments are left out by default, and attachment tags in messages read “not included in the share”. When the room has attachments, the confirmation offers “Include attachments”: ticked, every attachment (images, videos, web pages, documents and so on) goes into the page as it is, for readers to view and download. Text attachments are checked for keys and local folders too; the contents of images, videos and other files cannot be checked, so look through them yourself. A share link carries the attachments the page can preview — images, audio, video, PDF, Word/Excel/PowerPoint (docx, xlsx, pptx), text and code, and web pages — for readers to open right in the page; scripts that run on a double click, such as js, bat and ps1, go with .txt added to their names. Archives, programs and old doc/xls/ppt files stay off the share site and their messages read “not included in the share”, while a downloaded web page file still carries them. Web page attachments run on the share page as they do in the room, and demos a member’s answer refers to show inside the message; they run in an isolated frame that cannot read the share page, send requests or submit forms. Attachments count toward the 5 MB limit for share links; above it, untick them or use the web page file. A web page file carries at most 100 MB of attachments.
|
|
63
63
|
- **Import rooms.** In directory options or a folder menu, select “Import rooms…” and choose a ZIP. Review the preview and confirm the rooms to import. A room marked “Already exists; skipped” is left as is. On the same computer, invite members back to resume their sessions. Claude Code members switch to manual connection on import. Re-register them from their original window to avoid splitting the session. Imported discussion history is kept, but discussions are not restarted and members are not woken automatically.
|
|
64
64
|
- **Branch from a message.** In an AI message menu, select “Branch from here” to create a room containing the history through that message. Connections that support session branching resume from the branched session in the new room. The original room is kept.
|
|
65
65
|
- **Let the host create rooms.** With “Create rooms” ticked in “Host permissions”, the host can move part of the work into a new room. Members use only software configured on this computer, with read-only project access by default and at most write. The project folder must be the original room’s folder or a folder inside it. Unless you name another host, the new room is hosted by the same expert as the original host. Each room gets a “Linked room” card; select “Open room” to go to the other one. The new room takes your default host permissions, except that it cannot create rooms. A room can create a limited number of rooms (3 by default, adjustable in “Host permissions”). The hosts of two linked rooms can speak in each other’s room; those messages are labelled “From host … of room "…"” and wake the other room like your own messages. There is no limit by default. To cap it, set “Linked-room message limit” under “Advanced settings” in the new-room form (it applies to every linked room on this computer); counting from your last message in either room, messages beyond it are refused until you send a message.
|
|
@@ -33,12 +33,12 @@ Rerunning setup replaces selected bundled workflows with the package versions. B
|
|
|
33
33
|
You can create or import a ZIP file or folder with the “+” on the Workflows page. You can also ask an AI with the bundled workflow-creator skill to draft and validate a workflow:
|
|
34
34
|
|
|
35
35
|
- **Ask the host in a room:** Enable “Full host control,” then describe the division of work you want. You can also type / and choose “Create / edit workflow” under platform skills. The host uses the skill to create SKILL.md, role cards, and a canvas, validates them, saves, and enables the workflow.
|
|
36
|
-
- **Ask an AI in an external session:** In a Claude Code or Codex session with the CoDiscuss skills installed, ask it to create or edit a workflow with workflow-creator. It validates a folder with codiscuss launch workflow-check --dir <directory>. After you approve, it saves the workflow with codiscuss launch workflow-save --dir <directory>.
|
|
36
|
+
- **Ask an AI in an external session:** In a Claude Code or Codex session with the CoDiscuss skills installed, ask it to create or edit a workflow with workflow-creator. It validates a folder with codiscuss launch workflow-check --dir <directory>. After you approve, it saves the workflow with codiscuss launch workflow-save --dir <directory>. If the library already has that ID, the save is refused unless it explicitly overwrites (--overwrite) or names the revision it read (--revision).
|
|
37
37
|
- **Where workflows are stored:** The local service keeps them under ~/.codiscuss/workflows/<workflow-id>/. On the Workflows page, open the “…” menu and choose “Copy folder path” to locate or share one.
|
|
38
38
|
|
|
39
39
|
### 4. The canvas and SKILL.md
|
|
40
40
|
|
|
41
|
-
Select a workflow on the Workflows page. The canvas opens in the center, and its SKILL.md appears on the right. Click “Edit,” then “Save” or press Ctrl+S to save changes.
|
|
41
|
+
Select a workflow on the Workflows page. The canvas opens in the center, and its SKILL.md appears on the right. Click “Edit,” then “Save” or press Ctrl+S to save changes. If the workflow was changed elsewhere after you opened it, saving is refused and the page says “The workflow was changed elsewhere; reload it”; “Reload” reads the new version and first asks before discarding unsaved edits. An imported workflow whose ID is already in the library is saved only after you choose “Save and replace.”
|
|
42
42
|
|
|
43
43
|
- **The canvas is a diagram:** You can move cards, add host nodes, connect nodes to show order or loops, add notes to connections, or choose “Auto arrange.” Click a connection or its note to select it before editing; once a gold loop is selected, drag it up or down to change its height. Dragging an unselected connection or note just pans the canvas. The program does not execute canvas connections, and the host cannot see the canvas.
|
|
44
44
|
- **The host follows SKILL.md:** The skill file defines order, parallel work, when to return to the host, and when to revise. The host follows those written instructions. When workflow-creator creates or edits a workflow, it updates the canvas to reflect the skill file.
|
package/docs/guide/admin.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
- **设置**:查看当前版本、“检查更新”与“更新并重启”(同步更新房间技能和隔离账号)、开关“登录 Windows 时自动启动”,以及切换管理面板语言。
|
|
14
14
|
- **“账号”页**:
|
|
15
15
|
- 左侧默认有“管理员(本机账号)”,开启托管管理后下方列出所有“托管账号”和“新建账号”按钮。
|
|
16
|
-
- 选中“管理员”或某个托管账号,可统一管理它的**命令行登录**(Claude Code / Codex / Gemini 登录状态、切换登录方式或退出,Claude Code 推荐 Setup Token)、**API 密钥**、**技能**(从“技能库”勾选安装或拖入 `.zip
|
|
16
|
+
- 选中“管理员”或某个托管账号,可统一管理它的**命令行登录**(Claude Code / Codex / Gemini 登录状态、切换登录方式或退出,Claude Code 推荐 Setup Token)、**API 密钥**、**技能**(从“技能库”勾选安装或拖入 `.zip`/文件夹导入)、**随包工作流**与**系统提示词**。程序更新不会改动已装的工作流;工作流区的用法同概览页的检查更新:标题旁标出“已是最新”或可同步的数量;右上角按钮在一致时是“检查随包工作流”,有差异时变为蓝色的“同步到最新版”,确认后补装缺少的、用最新版替换不同的(被替换的旧版先备份到该账号服务目录的 `backups/workflows`,在这里做过的修改也会被替换)。
|
|
17
17
|
|
|
18
18
|
## 托管账号:给别人开账号用这台电脑上的 AI
|
|
19
19
|
|
package/docs/guide/rooms.md
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
|
|
39
39
|
- **增删项目目录**:一个房间可有 1 个主项目目录和最多 8 个其他项目目录。建房后打开顶部“房间”页,在“项目目录”区域可增删其他目录,保存后从各成员下一次执行起生效,不中断会话。主目录设置后不能更改;建房时未设的,可在同一行补设一次。成员按各自项目权限读写全部目录。
|
|
40
40
|
- **打开“文件”页**:房间顶部的标签栏点“文件”,浏览目录、文件大小与修改时间,上方可切换主目录与其他项目目录。浏览文件需要已设置项目目录。
|
|
41
|
-
- **预览文件**:点击文件打开悬浮预览,支持纯文本、代码、Markdown 渲染、HTML 静态渲染并可切换源码;图片可缩放、旋转;音视频带倍速与全屏直接播放;CSV 显示为表格,字幕(SRT、VTT、ASS、LRC)显示为时间轴;Word、Excel、PowerPoint 与 PDF 只读预览;Premiere 工程显示其 XML
|
|
41
|
+
- **预览文件**:点击文件打开悬浮预览,支持纯文本、代码、Markdown 渲染、HTML 静态渲染并可切换源码;图片可缩放、旋转;音视频带倍速与全屏直接播放;CSV 显示为表格,字幕(SRT、VTT、ASS、LRC)显示为时间轴;Word、Excel、PowerPoint 与 PDF 只读预览;Premiere 工程显示其 XML;zip 压缩包像文件夹一样列出其中的文件夹与文件,点击其中的文件在新标签中预览。Markdown 中用相对路径引用的项目图片会直接显示。
|
|
42
42
|
- **多标签、分屏与收起**:可同时打开多个文件以标签切换,在预览栏切换为右侧分屏、或点“文件位置”回到所在文件夹。HTML 预览还可以“在新标签页打开”。点标题栏“收起”缩成内容区角落的悬浮按钮,切到其他房间后点它即可回到原文件与滚动位置,关闭才清空。
|
|
43
43
|
- **摘录批注**:在 Markdown 预览或成员回答正文中选中文字点“添加到对话”,可输入批注并回车,原文标出编号,输入框上方显示“N 条注释”。发送时自动附带文件路径+行号、成员+消息编号,或消息附件所属的消息编号与附件 ID,引用中的 `@` 不会唤醒成员。
|
|
44
44
|
- **整理文件**:点路径栏最前面的“项目”,可以打开你所有的项目和草稿。上方按钮用于新建文件夹和上传文件(单个不超过 20 MB);每行的菜单里有“下载”(文件夹为“下载文件夹”,打包成 ZIP)、“重命名”、“复制”、“剪切”、“删除”,复制或剪切后到目标文件夹点“粘贴”。删除的文件和被替换掉的旧版放进“回收区”,保留 30 天,可以还原。在源码视图点铅笔按钮可以编辑文本文件(不超过 1 MB)。项目、草稿文件夹本身,以及房间正在用作项目目录的文件夹,都不能改名、移动或删除。
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
- “下载网页文件”:得到一个单独的 `.html` 文件,用浏览器直接打开即可,发出去后无法过期或撤回。
|
|
58
58
|
- “发布链接”:上传到官方分享站,得到一个链接并自动复制,选 1、3 或 7 天后过期,到期自动删除。之后左侧房间列表下方出现“已分享”,列出所有有效的分享链接和剩余时间,可以复制、打开、续期(内容不变,有效期从现在重新计算)或撤销;房间菜单里也有“复制分享链接”“撤销分享链接”,再次“分享为网页…”可“更新链接”换成最新内容。链接跟着房间保存在电脑上,已配对的手机和平板也能管理;整理后超过 5 MB 的房间请改用网页文件。
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
两种方式看到的都是这个房间的“消息”和“执行”两页,从头阅读,外观与本机一致,卡片和执行详情都能点开;每次进入“执行”都会从头自动回放协作过程,点“结束回放”回到最终状态。“私聊”“房间”“文件”等标签灰显,只展示示意。但不能发消息或做任何操作;内容停在生成那一刻。私聊、事件记录、调度决策、被拒操作、排队消息、本机路径、会话编号与凭据不会写进去,已撤回或回退的消息也不带;失败原因只写“执行失败”,房间项目目录在正文里改写成项目内的相对路径。消息正文其余部分原样公开,发出前请核对。
|
|
61
61
|
|
|
62
|
-
附件默认不带,消息里的附件标记显示为“未包含在分享中”。房间有附件时,确认框里有“包含附件”,勾选后所有附件(图片、视频、网页、文档等)原样放进分享页,读者可以查看和下载。文本类附件会一并检查疑似密钥和本机目录;图片、视频等文件的内容程序查不了,请自己核对。发布链接带上页面能预览的附件:图片、音视频、PDF、Word/Excel/PowerPoint(docx、xlsx、pptx)、文本与代码和网页,读者在分享页里直接打开;js、bat、ps1 等双击就会运行的脚本改名为 .txt 后带上。压缩包、程序和旧版 doc/xls/ppt
|
|
62
|
+
附件默认不带,消息里的附件标记显示为“未包含在分享中”。房间有附件时,确认框里有“包含附件”,勾选后所有附件(图片、视频、网页、文档等)原样放进分享页,读者可以查看和下载。文本类附件会一并检查疑似密钥和本机目录;图片、视频等文件的内容程序查不了,请自己核对。发布链接带上页面能预览的附件:图片、音视频、PDF、Word/Excel/PowerPoint(docx、xlsx、pptx)、文本与代码和网页,读者在分享页里直接打开;js、bat、ps1 等双击就会运行的脚本改名为 .txt 后带上。压缩包、程序和旧版 doc/xls/ppt 不放到分享站,消息里显示“未包含在分享中”,下载的网页文件仍会带上。网页附件在分享页里照常运行,成员回答里引用的演示直接显示在消息中;它在隔离的框架里运行,读不到分享页,也不能联网请求或提交表单。附件计入发布链接 5 MB 的上限,超过时取消勾选或改用网页文件;网页文件最多带 100 MB 附件。
|
|
63
63
|
- **导入房间**:目录选项或文件夹菜单 → “导入房间…”,选择 ZIP 文件,在预览中确认要导入的房间;标为“已存在,跳过”的房间会保留原样。在同一台电脑导入后,请回成员会续接原会话(Claude Code 成员会改为手动接入,请回后在原窗口重新注册,避免会话分叉)。导入保留历史讨论记录,不会自动继续原讨论或重新唤醒成员。
|
|
64
64
|
- **从某条消息分支**:AI 发言菜单 → “从这里分支”,新建一个保留截至该条发言记录的房间。支持会话分叉的接入方式会在新房间续接分叉后的会话;原房间保留。
|
|
65
65
|
- **让主持人新建房间**:在“主持人权限”里勾选“新建房间”后,主持人可以把一部分工作拆到新房间:成员只用本机已配置的软件,项目权限默认只读、最高可写,项目目录只能是原房间的目录或其子目录;你没指定时由与原主持人同款的专家主持。两个房间各留一张“关联房间”卡片,点“打开房间”互相跳转。新房间的主持人权限按你的默认设置,但不能再新建房间;一个房间可新建的数量有上限(默认 3 个,可在“主持人权限”里调整)。两个关联房间的主持人可以互相发言,这些消息标注“来自房间「…」的主持人 …”,按你的消息唤醒对方房间;默认不限条数;担心两边来回不停,可在新建房间面板“高级设置”里设“关联房间互传上限”(对本机所有关联房间生效),从你上次在任一房间发言算起超过这个条数会被拒绝,你发一条消息即可让它们继续。
|
package/docs/guide/workflows.md
CHANGED
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
你既可以在左栏“工作流”点“+”手动新建或导入 `.zip`/文件夹,也可以直接让 AI 用随包安装的 `workflow-creator` 技能帮你起草和校验:
|
|
34
34
|
|
|
35
35
|
- **在房间里让主持人建**:打开“主持人完整权限”后,直接对主持人说你要什么分工(或说“把这个房间的做法存成工作流”),也可以在输入框打 `/` 选平台技能里的“新建 / 修改工作流”。主持人会调用 `workflow-creator` 生成 `SKILL.md`、角色卡片与画布,校验通过后保存并启用。
|
|
36
|
-
- **在外部 AI 对话里建**:在任意已装好共议技能的 Claude Code / Codex 窗口,请它按 `workflow-creator` 技能为你新建或修改工作流。它先用 `codiscuss launch workflow-check --dir <目录>` 校验,待你确认后用 `codiscuss launch workflow-save --dir <目录>`
|
|
36
|
+
- **在外部 AI 对话里建**:在任意已装好共议技能的 Claude Code / Codex 窗口,请它按 `workflow-creator` 技能为你新建或修改工作流。它先用 `codiscuss launch workflow-check --dir <目录>` 校验,待你确认后用 `codiscuss launch workflow-save --dir <目录>` 保存。库里已有同 ID 的工作流时,须明确选择覆盖(`--overwrite`)或带上读取时的修订号(`--revision`),否则不会保存。
|
|
37
37
|
- **存在哪里**:所有工作流都保存在本机服务目录的 `workflows/` 文件夹下(默认 `~/.codiscuss/workflows/<工作流ID>/`),一个工作流一个文件夹。在左栏工作流列表点“…” → “复制文件夹路径”可直接定位文件夹并打包分享给别人。
|
|
38
38
|
|
|
39
39
|
### 4. 画布与 `SKILL.md` 的分工
|
|
40
40
|
|
|
41
|
-
在左栏“工作流”列表点一项,中间打开流程画布,右侧显示它的 `SKILL.md`(点“编辑”可修改,点“保存”或 `Ctrl+S`
|
|
41
|
+
在左栏“工作流”列表点一项,中间打开流程画布,右侧显示它的 `SKILL.md`(点“编辑”可修改,点“保存”或 `Ctrl+S` 保存。工作流在你打开之后被别处改过时,保存会被拒绝,页面提示“工作流已被修改,请重新载入”,点“重新载入”读取新版,未保存的修改会先询问是否放弃;导入的工作流和库里已有的同 ID 时,要点“覆盖保存”才会整份替换):
|
|
42
42
|
|
|
43
43
|
- **画布只帮你看懂**:你可以拖动卡片、添加主持人节点、从节点右侧圆点拖线表示先后或循环(金色虚线表示循环)、写连线说明,或点“自动整理”。连线和说明要先单击选中才能编辑;选中金色循环线后,按住它上下拖动可调整高度。没选中时,在连线或说明上拖动只会平移画布。**程序不执行画布连线,主持人也看不到画布。**
|
|
44
44
|
- **主持人按 `SKILL.md` 派活**:谁先谁后、哪些成员并行、什么时候交回主持人把关、什么条件返工,都由 `SKILL.md` 写明并由主持人照做。用 `workflow-creator` 生成或修改工作流时,AI 会按 `SKILL.md` 同步更新画布。
|
|
@@ -165,9 +165,13 @@
|
|
|
165
165
|
"与随包最新版不同:{value1}": "Differs from the latest bundled version: {value1}",
|
|
166
166
|
"检查随包工作流": "Check shipped workflows",
|
|
167
167
|
"同步到最新版": "Sync to latest",
|
|
168
|
-
"
|
|
168
|
+
"工作流已是随包最新版": "Workflows are up to date with the bundled versions",
|
|
169
|
+
"{value1} 个可同步": "{value1} to sync",
|
|
170
|
+
"同步随包工作流": "Sync bundled workflows",
|
|
171
|
+
"补装:{value1}": "Install: {value1}",
|
|
172
|
+
"替换为最新版:{value1}": "Replace with latest: {value1}",
|
|
173
|
+
"被替换的旧版先备份到该账号服务目录的 backups/workflows,在这里做过的修改也会被替换。": "Each replaced copy is first backed up to backups/workflows in this account's service folder; changes made there are replaced too.",
|
|
169
174
|
"工作流已同步到随包最新版,被替换的旧版已备份": "Workflows synced to the latest bundled versions; replaced copies were backed up",
|
|
170
|
-
"补装缺少的随包工作流,并用最新版替换不同的;被替换的旧版先备份到该账号服务目录的 backups/workflows,在这里做过的修改也会被替换": "Installs the missing bundled workflows and replaces those that differ with the latest version; each replaced copy is first backed up to backups/workflows in the account's service folder, and changes made here are replaced too",
|
|
171
175
|
"概览": "Overview",
|
|
172
176
|
"已刷新": "Refreshed",
|
|
173
177
|
"共议": "CoDiscuss",
|
|
@@ -114,6 +114,14 @@
|
|
|
114
114
|
"文本": "Text",
|
|
115
115
|
"代码": "Code",
|
|
116
116
|
"压缩包": "Archive",
|
|
117
|
+
"正在读取压缩包…": "Reading the archive…",
|
|
118
|
+
"无法读取压缩包:{value1}": "Can't read the archive: {value1}",
|
|
119
|
+
"压缩包内的位置": "Location in the archive",
|
|
120
|
+
"{value1}(已加密,无法预览)": "{value1} (encrypted, can't be previewed)",
|
|
121
|
+
"{value1}({value2} 个文件)": "{value1} ({value2} files)",
|
|
122
|
+
"压缩包是空的": "The archive is empty",
|
|
123
|
+
"{value1} 个文件,解压后共 {value2}": "{value1} files, {value2} unpacked",
|
|
124
|
+
"无法解压 {value1}:{value2}": "Can't unpack {value1}: {value2}",
|
|
117
125
|
"文件": "Files",
|
|
118
126
|
"每条消息最多 10 个附件": "Up to 10 attachments per message",
|
|
119
127
|
"单个附件最多 20 MiB": "Up to 20 MiB per attachment",
|
|
@@ -476,7 +484,7 @@
|
|
|
476
484
|
"{members} 位 AI · {messages} 条消息 · {runs} 次执行": "{members} AIs · {messages} messages · {runs} runs",
|
|
477
485
|
"{time} 前有效": "Valid until {time}",
|
|
478
486
|
"等 {count} 位": "{count} in all",
|
|
479
|
-
"
|
|
487
|
+
"结束回放": "End replay",
|
|
480
488
|
"回放协作过程": "Replay the session",
|
|
481
489
|
"这是只读分享,不能在这里发消息": "This is a read-only share; messages cannot be sent here",
|
|
482
490
|
"在自己的房间里,可以单独和某个 AI 私聊,看它这次执行的每一步,不打扰其他成员。分享页不包含私聊。": "In a room of your own you can chat privately with one AI and see every step of its run without disturbing the others. Shares leave private chats out.",
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
+
"工作流「{id}」已被修改,请重新载入后再保存": "Workflow “{id}” was changed since you loaded it; reload it before saving",
|
|
3
|
+
"工作流库里已有「{id}」;要整份覆盖它,请明确选择覆盖": "The library already has “{id}”; choose to overwrite it explicitly to replace it",
|
|
2
4
|
"尚未绑定线上网站": "No online site is bound yet",
|
|
3
5
|
"请先启动共议服务,再重连中转": "Start the CoDiscuss service before reconnecting the relay",
|
|
4
6
|
"会话上下文压缩失败({reason}),下次执行将改用新会话;请缩短输入或拆分任务后重试": "Context compaction failed ({reason}). The next run will use a new session; shorten the input or split the task before retrying",
|
|
@@ -568,6 +568,10 @@
|
|
|
568
568
|
"{value1} 位成员": "{value1} members",
|
|
569
569
|
"进入这个子工作流(也可双击)": "Open this sub-workflow (or double-click)",
|
|
570
570
|
"挂靠:{value1}": "Attached: {value1}",
|
|
571
|
+
"工作流库里已有同 ID 的工作流,保存会整份覆盖它": "The library already has a workflow with this ID; saving replaces it entirely",
|
|
572
|
+
"工作流已被修改,请重新载入": "The workflow was changed elsewhere; reload it",
|
|
573
|
+
"覆盖保存": "Save and replace",
|
|
574
|
+
"重新载入": "Reload",
|
|
571
575
|
"进入": "Open",
|
|
572
576
|
"从画布移除子工作流节点": "Remove sub-workflow node from canvas",
|
|
573
577
|
"按住拖动": "Hold to drag",
|
package/package.json
CHANGED
|
@@ -113,7 +113,7 @@ const HELP = `用法:codiscuss launch settings [--file FILE]
|
|
|
113
113
|
codiscuss launch workflow-leave (--sub SUB | --member 成员) [--access-file FILE]
|
|
114
114
|
codiscuss launch host-control ACTION [选项] [--access-file FILE]
|
|
115
115
|
codiscuss launch workflow-check (--dir DIR | --draft FILE)
|
|
116
|
-
codiscuss launch workflow-save (--dir DIR | --draft FILE)
|
|
116
|
+
codiscuss launch workflow-save (--dir DIR | --draft FILE) [--revision REV | --overwrite]
|
|
117
117
|
|
|
118
118
|
settings 读取本机软件默认配置;指定文件时保存,不启动 AI。
|
|
119
119
|
start 使用启动 JSON 创建或接入房间并启动;--dry-run 只校验和预览。
|
|
@@ -175,7 +175,7 @@ host-control 主持人代房主控制房间,须房主已为本房间勾选对
|
|
|
175
175
|
新房间的主持人权限取本机默认值但不能再新建房间,本房间可新建的数量有上限;两边各留一张链接卡片;重试沿用同一 --submission-id;
|
|
176
176
|
room-post --room 房间编号 --text 话 [--submission-id ID] 在关联房间(你新建的,或新建本房间的)发言,按房主消息唤醒该房间、标注来自本房间;自用户上次发言起两边互传的条数受本机“关联房间互传上限”限制(默认不限);读它用平常的读取命令、房间编号写新房间的(跨房间只能读)。
|
|
177
177
|
不开放:批准超出上限的轮数、项目权限高于可写或放行工具、改项目目录、撤回回退用户消息、私聊、对主持人自己的其他操作。
|
|
178
|
-
workflow-check 按导入规则校验工作流文件夹或单段草稿,返回预览,不保存;workflow-save
|
|
178
|
+
workflow-check 按导入规则校验工作流文件夹或单段草稿,返回预览,不保存;workflow-save 校验后保存进工作流库,卡片按声明的项目权限保存;库里已有同 ID 的工作流时须表明来意:--revision 写读取时的修订号(库在那之后被改过就拒绝,什么都不写),或 --overwrite 明确整份覆盖,两样都没有就拒绝。写法见 workflow-creator 技能。
|
|
179
179
|
JSON 指定 site、entry(conversation/web)、room(建房内容,含 submission_id)
|
|
180
180
|
或 room_id(已有房间)、participants(本次软件覆盖配置)。
|
|
181
181
|
conversation 还须 current_session_id,当前会话接手首个主持任务。
|
|
@@ -1979,7 +1979,8 @@ export function workflows_command(home, input = {}) {
|
|
|
1979
1979
|
const action = input.action || 'list';
|
|
1980
1980
|
if (action === 'list') return workflow_library(home);
|
|
1981
1981
|
if (action === 'get') return get_workflow(home, input.id);
|
|
1982
|
-
|
|
1982
|
+
// The page names the revision it loaded (`base_revision`), or `overwrite` after the user chose to replace an entry.
|
|
1983
|
+
if (action === 'save') return save_workflow(home, input.workflow, validate_preset, { base_revision: input.base_revision, overwrite: input.overwrite === true });
|
|
1983
1984
|
if (action === 'delete') return delete_workflow(home, input.id);
|
|
1984
1985
|
if (action === 'rename') return rename_workflow(home, input.id, input.label);
|
|
1985
1986
|
if (action === 'disable' || action === 'enable') return set_workflow_disabled(home, input.id, action === 'disable');
|
|
@@ -2632,7 +2633,9 @@ export async function adopt_workflow(home, { access_file, draft_file, workflow_i
|
|
|
2632
2633
|
throw new Error(`本机没有配置这些卡片的软件或 API Key:${missing.join('、')};卡片的 platform 只能用本机已配置的平台 ID:${ready.join('、')}`);
|
|
2633
2634
|
}
|
|
2634
2635
|
workflow = workflow_id ? { ...workflow, agents: host_cards(workflow.agents) }
|
|
2635
|
-
|
|
2636
|
+
// The host's draft replaces the room's own workflow on purpose (another one is refused above); a draft carries no
|
|
2637
|
+
// sub-workflows or other files, so those are kept as saved.
|
|
2638
|
+
: save_workflow(home, { ...workflow, agents: host_cards(workflow.agents) }, validate_preset, { overwrite: true });
|
|
2636
2639
|
const owner = { site: config.site, room_id: config.room, token: config.token };
|
|
2637
2640
|
const members = await join_workflow_cards(home, config, roster, workflow, bound === workflow.id ? config.workflow.members || {} : {});
|
|
2638
2641
|
const enabled = await room_workflow(home, { ...owner, action: 'enable', workflow: { id: workflow.id, members } });
|
|
@@ -2643,14 +2646,15 @@ export async function adopt_workflow(home, { access_file, draft_file, workflow_i
|
|
|
2643
2646
|
* Check a workflow folder or one-part draft as an import would, and optionally save it. A local AI uses this outside
|
|
2644
2647
|
* rooms with its user present, so the cards keep the project access they declare.
|
|
2645
2648
|
*/
|
|
2646
|
-
export function check_or_save_workflow(home, { dir, draft }, save = false) {
|
|
2649
|
+
export function check_or_save_workflow(home, { dir, draft, revision, overwrite }, save = false) {
|
|
2647
2650
|
if (!dir === !draft) throw new Error('须提供 --dir 工作流文件夹或 --draft 草稿文件之一');
|
|
2648
2651
|
const source = dir ? { folder: dir } : { parts: [readFileSync(resolve(draft), 'utf8')] };
|
|
2649
2652
|
const preview = workflows_command(home, { action: 'preview', ...source });
|
|
2650
2653
|
if (!save) return preview;
|
|
2651
2654
|
const declared = list => list.map(({ requested_access, ...agent }) => requested_access ? { ...agent, project_access: requested_access } : agent);
|
|
2652
2655
|
const sub_workflows = preview.sub_workflows?.map(sub => ({ ...sub, agents: declared(sub.agents) }));
|
|
2653
|
-
return save_workflow(home, { ...preview, agents: declared(preview.agents), ...(sub_workflows ? { sub_workflows } : {}) }, validate_preset
|
|
2656
|
+
return save_workflow(home, { ...preview, agents: declared(preview.agents), ...(sub_workflows ? { sub_workflows } : {}) }, validate_preset,
|
|
2657
|
+
{ base_revision: revision, overwrite: overwrite === true });
|
|
2654
2658
|
}
|
|
2655
2659
|
|
|
2656
2660
|
const WRITING_ACCESS = new Set(['write', 'auto', 'full', 'own']);
|
|
@@ -2703,7 +2707,7 @@ export function command_help(action) {
|
|
|
2703
2707
|
export async function launch_main(args = process.argv.slice(2), input_text) {
|
|
2704
2708
|
const { values, positionals } = parseArgs({ args, allowPositionals: true, options: {
|
|
2705
2709
|
file: { type: 'string' }, 'dry-run': { type: 'boolean' }, browser: { type: 'boolean' }, remote: { type: 'boolean' }, device: { type: 'string' },
|
|
2706
|
-
'configuration-locked': { type: 'boolean' }, help: { type: 'boolean', short: 'h' },
|
|
2710
|
+
'configuration-locked': { type: 'boolean' }, help: { type: 'boolean', short: 'h' }, overwrite: { type: 'boolean' },
|
|
2707
2711
|
draft: { type: 'string' }, 'access-file': { type: 'string' }, dir: { type: 'string' }, card: { type: 'string' }, sub: { type: 'string' }, id: { type: 'string' },
|
|
2708
2712
|
member: { type: 'string' }, order: { type: 'string' }, revision: { type: 'string' }, name: { type: 'string' }, access: { type: 'string' },
|
|
2709
2713
|
model: { type: 'string' }, effort: { type: 'string' }, do: { type: 'string' }, execution: { type: 'string' }, text: { type: 'string' },
|
|
@@ -2743,7 +2747,7 @@ export async function launch_main(args = process.argv.slice(2), input_text) {
|
|
|
2743
2747
|
return process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
2744
2748
|
}
|
|
2745
2749
|
if (['workflow-check', 'workflow-save'].includes(positionals[0])) {
|
|
2746
|
-
const result = check_or_save_workflow(service_home(), { dir: values.dir, draft: values.draft }, positionals[0] === 'workflow-save');
|
|
2750
|
+
const result = check_or_save_workflow(service_home(), { dir: values.dir, draft: values.draft, revision: values.revision, overwrite: values.overwrite === true }, positionals[0] === 'workflow-save');
|
|
2747
2751
|
return process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
2748
2752
|
}
|
|
2749
2753
|
const input = input_text === undefined ? (values.file ? JSON.parse(readFileSync(values.file, 'utf8').replace(/^\uFEFF/, '')) : null) : JSON.parse(input_text);
|
package/runner/project_files.mjs
CHANGED
|
@@ -405,6 +405,8 @@ export const MEDIA_TYPES = {
|
|
|
405
405
|
ods: 'application/vnd.oasis.opendocument.spreadsheet',
|
|
406
406
|
pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation', prproj: 'application/gzip',
|
|
407
407
|
pdf: 'application/pdf',
|
|
408
|
+
// A zip archive, listed and unpacked by the page's preview.
|
|
409
|
+
zip: 'application/zip',
|
|
408
410
|
};
|
|
409
411
|
|
|
410
412
|
/**
|
|
@@ -416,7 +418,7 @@ export function project_media(cwd, path, { download = false } = {}) {
|
|
|
416
418
|
const root = project_root(cwd);
|
|
417
419
|
const target = project_path(root, path);
|
|
418
420
|
const content_type = MEDIA_TYPES[posix.extname(target.replaceAll('\\', '/')).slice(1).toLowerCase()] || (download ? 'application/octet-stream' : '');
|
|
419
|
-
if (!content_type) throw new Error('只能打开图片、音视频、Office
|
|
421
|
+
if (!content_type) throw new Error('只能打开图片、音视频、Office 文档、剪辑工程或压缩包');
|
|
420
422
|
const info = statSync(target);
|
|
421
423
|
if (!info.isFile()) throw new Error('只能预览普通文件');
|
|
422
424
|
return { file: target, size: info.size, content_type, modified_at: info.mtime.toISOString(), version: `${info.mtimeMs}:${info.size}` };
|
package/runner/workflows.mjs
CHANGED
|
@@ -12,6 +12,8 @@ import { flow_in_use, normalize_flow } from './workflow_flow.mjs';
|
|
|
12
12
|
export const WORKFLOW_ID_PATTERN = /^(?=.{1,40}$)[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
13
13
|
// Characters of a SKILL.md hash the host compares to know whether its earlier reading is still current.
|
|
14
14
|
const REVISION_LENGTH = 12;
|
|
15
|
+
// Characters of a whole workflow folder's hash a save names to show which version it edited.
|
|
16
|
+
const FOLDER_REVISION_LENGTH = 16;
|
|
15
17
|
// A card ID becomes the member name's suffix (`platform-card`), which has no hyphen of its own.
|
|
16
18
|
export const CARD_ID_PATTERN = /^[a-z0-9_]{1,16}$/;
|
|
17
19
|
export const MAX_WORKFLOW_SKILL = 20000;
|
|
@@ -579,13 +581,53 @@ export function rename_workflow(home, id, label) {
|
|
|
579
581
|
});
|
|
580
582
|
}
|
|
581
583
|
|
|
582
|
-
/**
|
|
584
|
+
/**
|
|
585
|
+
* The whole folder's revision as saved on disk: every file under it (SKILL.md, cards, canvases, sub-workflows and
|
|
586
|
+
* their files, templates, scripts), by relative path and bytes. Any change anywhere changes it. Call under the lock.
|
|
587
|
+
*/
|
|
588
|
+
export function folder_revision(directory) {
|
|
589
|
+
const hash = createHash('sha256');
|
|
590
|
+
const walk = relative => {
|
|
591
|
+
for (const name of readdirSync(join(directory, relative)).sort()) {
|
|
592
|
+
const path = relative ? `${relative}/${name}` : name;
|
|
593
|
+
if (lstatSync(join(directory, path)).isDirectory()) walk(path);
|
|
594
|
+
else hash.update(`${path}\0`).update(readFileSync(join(directory, path))).update('\0');
|
|
595
|
+
}
|
|
596
|
+
};
|
|
597
|
+
walk('');
|
|
598
|
+
return hash.digest('hex').slice(0, FOLDER_REVISION_LENGTH);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
/** Read a library entry while its caller holds the publication lock; `revision` is the folder's, which a save must name. */
|
|
583
602
|
function read_saved_workflow(home, id) {
|
|
584
603
|
const directory = workflow_directory(home, id);
|
|
585
604
|
if (!existsSync(directory)) throw new Error(`工作流不存在:${id}`);
|
|
586
605
|
const { workflow } = read_workflow_folder(directory);
|
|
587
606
|
workflow_cards(workflow);
|
|
588
|
-
return { ...workflow, id, directory, commands: workflow_commands(workflow.resources) };
|
|
607
|
+
return { ...workflow, id, directory, commands: workflow_commands(workflow.resources), revision: folder_revision(directory) };
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/** A refusal the page shows in its own language (template and parameters) with a stable code. */
|
|
611
|
+
function workflow_failure(code, template, params) {
|
|
612
|
+
const message = template.replace(/\{(\w+)\}/g, (match, name) => Object.hasOwn(params, name) ? String(params[name]) : match);
|
|
613
|
+
return Object.assign(new Error(message), { code, error_text: { template, params } });
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Before a save replaces a library entry: a save that edits it names the revision it was read at (`base_revision`), and
|
|
618
|
+
* one that means to replace whatever is there says so (`overwrite`). A changed or vanished entry is refused, as is one
|
|
619
|
+
* that exists when the save names neither, so a stale copy never replaces newer files. Call under the lock.
|
|
620
|
+
*/
|
|
621
|
+
function check_save_base(directory, id, { base_revision, overwrite } = {}) {
|
|
622
|
+
const exists = existsSync(directory);
|
|
623
|
+
if (overwrite === true) return;
|
|
624
|
+
if (base_revision) {
|
|
625
|
+
if (!exists || folder_revision(directory) !== base_revision) {
|
|
626
|
+
throw workflow_failure('workflow_changed', '工作流「{id}」已被修改,请重新载入后再保存', { id });
|
|
627
|
+
}
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
if (exists) throw workflow_failure('workflow_exists', '工作流库里已有「{id}」;要整份覆盖它,请明确选择覆盖', { id });
|
|
589
631
|
}
|
|
590
632
|
|
|
591
633
|
/** One workflow in full, as the editor shows it. */
|
|
@@ -613,10 +655,14 @@ export function install_workflow_folder(home, id, source) {
|
|
|
613
655
|
with_workflow_lock(home, () => publish_directory(home, id, staging => cpSync(source, staging, { recursive: true })));
|
|
614
656
|
}
|
|
615
657
|
|
|
616
|
-
/**
|
|
617
|
-
|
|
658
|
+
/**
|
|
659
|
+
* Write a checked workflow as files, publishing a complete directory with crash recovery. Replacing an existing entry
|
|
660
|
+
* needs `base.base_revision` (the revision it was read at, refused when the folder changed since) or `base.overwrite`.
|
|
661
|
+
*/
|
|
662
|
+
export function save_workflow(home, input, validate_card, base = {}) {
|
|
618
663
|
const workflow = validate_workflow(input, validate_card);
|
|
619
664
|
return with_workflow_lock(home, () => {
|
|
665
|
+
check_save_base(workflow_directory(home, workflow.id), workflow.id, base);
|
|
620
666
|
publish_directory(home, workflow.id, (staging, directory) => {
|
|
621
667
|
mkdirSync(join(staging, 'agents'), { recursive: true });
|
|
622
668
|
writeFileSync(join(staging, 'SKILL.md'), serialize_markdown(skill_fields(workflow.id, workflow.label, workflow.description), workflow.skill));
|