@xiaoso/dsh-workflow-lite 0.0.0-stage → 0.1.0
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/LICENSE +24 -0
- package/README.en.md +84 -0
- package/README.md +83 -2
- package/THIRD_PARTY_NOTICES.md +762 -0
- package/assets/icon-full.webp +0 -0
- package/assets/icon.webp +0 -0
- package/assets/wordmark.png +0 -0
- package/cordis.patch.yml +3 -0
- package/lib/client.js +127442 -0
- package/lib/index.mjs +9613 -0
- package/lib/types/client/app/addStep.d.ts +25 -0
- package/lib/types/client/app/desktop.d.ts +52 -0
- package/lib/types/client/app/host.d.ts +29 -0
- package/lib/types/client/app/sessions.d.ts +117 -0
- package/lib/types/client/app/theme.d.ts +27 -0
- package/lib/types/client/app/usePluginConfig.d.ts +59 -0
- package/lib/types/client/app/useRunFile.d.ts +24 -0
- package/lib/types/client/app/useRunGraph.d.ts +51 -0
- package/lib/types/client/app/useRunHistory.d.ts +21 -0
- package/lib/types/client/app/useRuns.d.ts +84 -0
- package/lib/types/client/app/useVersions.d.ts +50 -0
- package/lib/types/client/app/useWorkflow.d.ts +67 -0
- package/lib/types/client/app/viewport.d.ts +14 -0
- package/lib/types/client/i18n.d.ts +930 -0
- package/lib/types/client/index.d.ts +18 -0
- package/lib/types/client/model/connect.d.ts +44 -0
- package/lib/types/client/model/editor.d.ts +252 -0
- package/lib/types/client/model/fileKind.d.ts +15 -0
- package/lib/types/client/model/hostPath.d.ts +15 -0
- package/lib/types/client/model/htmlPreview.d.ts +24 -0
- package/lib/types/client/model/hubRuns.d.ts +45 -0
- package/lib/types/client/model/layout.d.ts +83 -0
- package/lib/types/client/model/library.d.ts +109 -0
- package/lib/types/client/model/nudge.d.ts +43 -0
- package/lib/types/client/model/pathSample.d.ts +26 -0
- package/lib/types/client/model/route.d.ts +121 -0
- package/lib/types/client/model/runDraft.d.ts +68 -0
- package/lib/types/client/model/runGraph.d.ts +15 -0
- package/lib/types/client/model/runHistory.d.ts +40 -0
- package/lib/types/client/model/themes.d.ts +87 -0
- package/lib/types/client/model/time.d.ts +7 -0
- package/lib/types/client/rpc.d.ts +42 -0
- package/lib/types/client/ui/AppearancePicker.d.ts +23 -0
- package/lib/types/client/ui/Canvas.d.ts +76 -0
- package/lib/types/client/ui/Confirm.d.ts +42 -0
- package/lib/types/client/ui/DocViewer.d.ts +67 -0
- package/lib/types/client/ui/Dock.d.ts +13 -0
- package/lib/types/client/ui/FileTag.d.ts +9 -0
- package/lib/types/client/ui/FileViewer.d.ts +30 -0
- package/lib/types/client/ui/FlowStreaks.d.ts +40 -0
- package/lib/types/client/ui/Handoff.d.ts +30 -0
- package/lib/types/client/ui/HostPicker.d.ts +31 -0
- package/lib/types/client/ui/HubDialog.d.ts +38 -0
- package/lib/types/client/ui/HubRunRow.d.ts +22 -0
- package/lib/types/client/ui/HubRuns.d.ts +19 -0
- package/lib/types/client/ui/HubSettings.d.ts +20 -0
- package/lib/types/client/ui/HubStorage.d.ts +18 -0
- package/lib/types/client/ui/HubWorkflowList.d.ts +21 -0
- package/lib/types/client/ui/HubWorkflowRow.d.ts +33 -0
- package/lib/types/client/ui/HubWorkflows.d.ts +26 -0
- package/lib/types/client/ui/HubWorkspacePicker.d.ts +16 -0
- package/lib/types/client/ui/Icon.d.ts +83 -0
- package/lib/types/client/ui/InputPanel.d.ts +37 -0
- package/lib/types/client/ui/InputsDialog.d.ts +22 -0
- package/lib/types/client/ui/Inspector.d.ts +51 -0
- package/lib/types/client/ui/Issues.d.ts +15 -0
- package/lib/types/client/ui/Launch.d.ts +30 -0
- package/lib/types/client/ui/Library.d.ts +23 -0
- package/lib/types/client/ui/LinkRow.d.ts +31 -0
- package/lib/types/client/ui/Markdown.d.ts +21 -0
- package/lib/types/client/ui/NodeHeads.d.ts +47 -0
- package/lib/types/client/ui/NoteDrawer.d.ts +21 -0
- package/lib/types/client/ui/OpenWith.d.ts +21 -0
- package/lib/types/client/ui/Outputs.d.ts +61 -0
- package/lib/types/client/ui/PanelHead.d.ts +21 -0
- package/lib/types/client/ui/PlanDialog.d.ts +18 -0
- package/lib/types/client/ui/PreviewCard.d.ts +38 -0
- package/lib/types/client/ui/QuickAdd.d.ts +30 -0
- package/lib/types/client/ui/ResourceItemDialog.d.ts +33 -0
- package/lib/types/client/ui/ResourceItems.d.ts +30 -0
- package/lib/types/client/ui/ResourcePanel.d.ts +26 -0
- package/lib/types/client/ui/Resources.d.ts +43 -0
- package/lib/types/client/ui/RunDraftBar.d.ts +35 -0
- package/lib/types/client/ui/RunEdge.d.ts +29 -0
- package/lib/types/client/ui/RunFiles.d.ts +24 -0
- package/lib/types/client/ui/RunInput.d.ts +26 -0
- package/lib/types/client/ui/RunItemDialog.d.ts +43 -0
- package/lib/types/client/ui/RunModeSwitch.d.ts +14 -0
- package/lib/types/client/ui/RunNav.d.ts +22 -0
- package/lib/types/client/ui/RunNodeState.d.ts +42 -0
- package/lib/types/client/ui/RunOverview.d.ts +27 -0
- package/lib/types/client/ui/RunPosition.d.ts +24 -0
- package/lib/types/client/ui/RunResource.d.ts +40 -0
- package/lib/types/client/ui/RunStatusMenu.d.ts +28 -0
- package/lib/types/client/ui/RunStep.d.ts +45 -0
- package/lib/types/client/ui/RunTopBar.d.ts +42 -0
- package/lib/types/client/ui/RunView.d.ts +43 -0
- package/lib/types/client/ui/SettingsDialog.d.ts +25 -0
- package/lib/types/client/ui/SettingsFields.d.ts +37 -0
- package/lib/types/client/ui/SkillPicker.d.ts +25 -0
- package/lib/types/client/ui/SkillPreview.d.ts +27 -0
- package/lib/types/client/ui/StepMark.d.ts +16 -0
- package/lib/types/client/ui/StepPanel.d.ts +26 -0
- package/lib/types/client/ui/ThemePicker.d.ts +13 -0
- package/lib/types/client/ui/TipLayer.d.ts +17 -0
- package/lib/types/client/ui/TopBar.d.ts +32 -0
- package/lib/types/client/ui/VersionList.d.ts +19 -0
- package/lib/types/client/ui/VersionRow.d.ts +19 -0
- package/lib/types/client/ui/VersionsDialog.d.ts +18 -0
- package/lib/types/client/ui/WorkflowRow.d.ts +32 -0
- package/lib/types/client/ui/WorkflowSwitcher.d.ts +20 -0
- package/lib/types/client/ui/WorkflowView.d.ts +27 -0
- package/lib/types/client/ui/lines.d.ts +13 -0
- package/lib/types/client/ui/primitives.d.ts +119 -0
- package/lib/types/client/ui/resourceUi.d.ts +49 -0
- package/lib/types/client/ui/stepIcons.d.ts +10 -0
- package/lib/types/host/authoringSkill.d.ts +17 -0
- package/lib/types/host/config.d.ts +54 -0
- package/lib/types/host/hostFs.d.ts +69 -0
- package/lib/types/host/plan.d.ts +68 -0
- package/lib/types/host/pluginConfig.d.ts +57 -0
- package/lib/types/host/rpc.d.ts +45 -0
- package/lib/types/host/runs/files.d.ts +37 -0
- package/lib/types/host/runs/notice.d.ts +21 -0
- package/lib/types/host/runs/service.d.ts +258 -0
- package/lib/types/host/runs/skill.d.ts +16 -0
- package/lib/types/host/runs/storage.d.ts +16 -0
- package/lib/types/host/runs/store.d.ts +56 -0
- package/lib/types/host/skillView.d.ts +22 -0
- package/lib/types/host/store/atomic.d.ts +34 -0
- package/lib/types/host/store/materialize.d.ts +19 -0
- package/lib/types/host/store/merge.d.ts +25 -0
- package/lib/types/host/store/paths.d.ts +86 -0
- package/lib/types/host/store/repository.d.ts +217 -0
- package/lib/types/host/store/versions.d.ts +38 -0
- package/lib/types/host/tool/tool.d.ts +432 -0
- package/lib/types/index.d.ts +35 -0
- package/lib/types/shared/appearance.d.ts +49 -0
- package/lib/types/shared/compile.d.ts +71 -0
- package/lib/types/shared/graph.d.ts +54 -0
- package/lib/types/shared/graphDiff.d.ts +29 -0
- package/lib/types/shared/inputs.d.ts +46 -0
- package/lib/types/shared/limits.d.ts +77 -0
- package/lib/types/shared/model.d.ts +122 -0
- package/lib/types/shared/naming.d.ts +59 -0
- package/lib/types/shared/outputPaths.d.ts +49 -0
- package/lib/types/shared/resources.d.ts +98 -0
- package/lib/types/shared/runCursor.d.ts +54 -0
- package/lib/types/shared/runState.d.ts +221 -0
- package/lib/types/shared/runSync.d.ts +24 -0
- package/lib/types/shared/types.d.ts +488 -0
- package/lib/types/shared/validate.d.ts +54 -0
- package/lib/types/shared/wire.d.ts +600 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +144 -4
|
@@ -0,0 +1,600 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-workflow-lite — 画布 ↔ host 的线格式。
|
|
3
|
+
*
|
|
4
|
+
* 画布与 host 走**共享 Connection 的 `/api` 通道**(与生态里其它插件同一条路):
|
|
5
|
+
* host 侧一个 endpoint 注册一条精确 Fetch 路由,客户端用 `connection.rpc.call` 调。
|
|
6
|
+
* 这里只放**名字与形状**,host 与 client 两边都 import 它,避免两处各写一套字面量。
|
|
7
|
+
*
|
|
8
|
+
* @module @xiaoso/dsh-workflow-lite/shared/wire
|
|
9
|
+
*/
|
|
10
|
+
import type { InstanceSummary, InstanceView, StateEdit } from './runState.ts';
|
|
11
|
+
import type { CompileResult, InputAnswer, ListResult, NodeData, NodeIndexEntry, PlanId, TemplateEntry, ToolWarning, ValidationProblem, VersionEntry, Viewport, WorkflowDocument, WorkflowNode } from './types.ts';
|
|
12
|
+
/**
|
|
13
|
+
* 共享 Connection 的通道名。
|
|
14
|
+
*
|
|
15
|
+
* **DSH 写死为 `/api`**:客户端载波在发请求前跑 `assertTarget`,通道必须匹配
|
|
16
|
+
* `/^\/[A-Za-z0-9._~-]+$/`(**带前导斜杠**),endpoint 的每一段必须匹配
|
|
17
|
+
* `/^[A-Za-z0-9_$.-]+$/`,然后 POST 到 `` `${channel}/${endpoint}`.slice(1) ``。
|
|
18
|
+
* 传别的值会当场 `invalid RPC target` —— 所以这个常量**不是可配置项**。
|
|
19
|
+
*
|
|
20
|
+
* @see {@link https://github.com/deepseek-ai/dsh-client-connection} `lib/types/client/rpc.ts`
|
|
21
|
+
*/
|
|
22
|
+
export declare const API_CHANNEL = "/api";
|
|
23
|
+
/** 本插件在 `/api` 下的命名空间(= `/api/<namespace>/<endpoint>` 里的那一段)。 */
|
|
24
|
+
export declare const WORKFLOW_LITE_CHANNEL = "workflow-lite";
|
|
25
|
+
/** 画布用到的端点。**只列画布真用得上的**——模型那条路走工具,不走 RPC。 */
|
|
26
|
+
export declare const WORKFLOW_LITE_ENDPOINTS: readonly ["graph/list", "graph/load", "graph/save", "graph/create", "graph/rename", "graph/delete", "graph/versions", "graph/versionSave", "graph/versionLoad", "graph/versionRestore", "graph/versionNote", "graph/versionDelete", "graph/templates", "graph/nodeTemplate", "graph/nodeTemplateCreate", "graph/nodeTemplateDraft", "graph/nodeTemplateSave", "graph/nodeTemplateDelete", "plan/build", "run/list", "run/load", "run/bind", "run/save", "run/delete", "run/storage", "run/start", "run/file", "host/list", "host/skills", "host/skill", "config/get", "config/set"];
|
|
27
|
+
export type WorkflowLiteEndpoint = (typeof WORKFLOW_LITE_ENDPOINTS)[number];
|
|
28
|
+
/**
|
|
29
|
+
* 线方法名(= RPC 信封里的 `method`,也是通道内的相对路径):`<namespace>/<endpoint>`。
|
|
30
|
+
*
|
|
31
|
+
* **不要再拼上通道名**:载波自己会把 `<channel>/<endpoint>` 拼起来,
|
|
32
|
+
* 这里多带一段就会变成 `workflow-lite/workflow-lite/graph/list` 而被拒。
|
|
33
|
+
*/
|
|
34
|
+
export declare function endpointName(endpoint: WorkflowLiteEndpoint): string;
|
|
35
|
+
/** 路由路径(host 侧注册用):`<channel>/<method>`。 */
|
|
36
|
+
export declare function routePath(endpoint: WorkflowLiteEndpoint): string;
|
|
37
|
+
/** 客户端调 RPC 用的 (channel, endpoint) 二元组——**唯一出处**,别处不许自己拼。 */
|
|
38
|
+
export declare function rpcTarget(endpoint: WorkflowLiteEndpoint): {
|
|
39
|
+
channel: string;
|
|
40
|
+
endpoint: string;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* 一条非阻塞信息(警告 / 提示)——就是工具侧的 `ToolWarning`,不另立一套,
|
|
44
|
+
* 否则两边的 `code` 会各自漂移(一边是 `ValidationCode`,一边是裸 `string`)。
|
|
45
|
+
*/
|
|
46
|
+
export type WireWarning = ToolWarning;
|
|
47
|
+
/** `graph/list` —— 顶部工作流选择器的数据源。 */
|
|
48
|
+
export interface GraphListRequest {
|
|
49
|
+
/** 预留:未来按需过滤。 */
|
|
50
|
+
filter?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* `graph/list` 的回执。
|
|
54
|
+
*
|
|
55
|
+
* 比工具侧的 `ListResult` 多一个 `limits`:画布要自己判「超 `maxNodes` ⇒ 只摆网格假位、
|
|
56
|
+
* 不跑自动布局」,而那条判据是活配置,只有 host 知道。
|
|
57
|
+
*/
|
|
58
|
+
export interface GraphListResponse extends ListResult {
|
|
59
|
+
limits: {
|
|
60
|
+
maxNodes: number;
|
|
61
|
+
saveDebounceMs: number;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** `graph/load` —— 打开一张图。 */
|
|
65
|
+
export interface GraphLoadRequest {
|
|
66
|
+
name: string;
|
|
67
|
+
}
|
|
68
|
+
export interface GraphLoadResponse {
|
|
69
|
+
name: string;
|
|
70
|
+
document: WorkflowDocument;
|
|
71
|
+
/** 加载时的内容哈希——保存时要拿它做写前比对。 */
|
|
72
|
+
hash: string;
|
|
73
|
+
/** 保存级问题。**非空时画布进只读错误态**,`document` 只是空壳。 */
|
|
74
|
+
problems: ValidationProblem[];
|
|
75
|
+
warnings: WireWarning[];
|
|
76
|
+
/** 解析失败时的原始文本(只读错误态展示用,受 `maxResultBytes` 约束)。 */
|
|
77
|
+
raw?: string;
|
|
78
|
+
}
|
|
79
|
+
/** `graph/save` —— 写回。**整文件重写 + 写前哈希比对 + 字段级合并。** */
|
|
80
|
+
export interface GraphSaveRequest {
|
|
81
|
+
name: string;
|
|
82
|
+
document: WorkflowDocument;
|
|
83
|
+
/** 加载时拿到的哈希。null = 新建后首次写。 */
|
|
84
|
+
baseHash: string | null;
|
|
85
|
+
/** 画布「保留我的」:合并出冲突也照写,冲突 id 以本地为准。**工具写路径不传**。 */
|
|
86
|
+
force?: boolean;
|
|
87
|
+
}
|
|
88
|
+
export interface GraphSaveResponse {
|
|
89
|
+
hash: string;
|
|
90
|
+
warnings: WireWarning[];
|
|
91
|
+
/** 成功路径上恒为空——真冲突走 `conflict` 错误(`detail.ids`),不写盘。 */
|
|
92
|
+
conflictIds: string[];
|
|
93
|
+
}
|
|
94
|
+
/** `graph/create` */
|
|
95
|
+
export interface GraphCreateRequest {
|
|
96
|
+
name: string;
|
|
97
|
+
}
|
|
98
|
+
export interface GraphCreateResponse {
|
|
99
|
+
/** 实际生成的名字(撞名会加序号)。 */
|
|
100
|
+
name: string;
|
|
101
|
+
warnings: WireWarning[];
|
|
102
|
+
}
|
|
103
|
+
/** `graph/rename` */
|
|
104
|
+
export interface GraphRenameRequest {
|
|
105
|
+
name: string;
|
|
106
|
+
to: string;
|
|
107
|
+
}
|
|
108
|
+
export interface GraphRenameResponse {
|
|
109
|
+
name: string;
|
|
110
|
+
warnings: WireWarning[];
|
|
111
|
+
}
|
|
112
|
+
/** `graph/delete` */
|
|
113
|
+
export interface GraphDeleteRequest {
|
|
114
|
+
name: string;
|
|
115
|
+
}
|
|
116
|
+
export interface GraphDeleteResponse {
|
|
117
|
+
warnings: WireWarning[];
|
|
118
|
+
}
|
|
119
|
+
/** `graph/versions` —— 一个工作流存下的版本,新的在前。 */
|
|
120
|
+
export interface GraphVersionsRequest {
|
|
121
|
+
name: string;
|
|
122
|
+
}
|
|
123
|
+
export interface GraphVersionsResponse {
|
|
124
|
+
versions: VersionEntry[];
|
|
125
|
+
}
|
|
126
|
+
/** `graph/versionSave` —— 把磁盘上现在的样子存成新版本。内容和已有版本一样时报 `invalid_args`(`detail.same`)。 */
|
|
127
|
+
export interface GraphVersionSaveRequest {
|
|
128
|
+
name: string;
|
|
129
|
+
note?: string;
|
|
130
|
+
}
|
|
131
|
+
export interface GraphVersionSaveResponse {
|
|
132
|
+
version: VersionEntry;
|
|
133
|
+
}
|
|
134
|
+
/** `graph/versionLoad` —— 读一个版本的整张图(切换前看会变什么)。 */
|
|
135
|
+
export interface GraphVersionLoadRequest {
|
|
136
|
+
name: string;
|
|
137
|
+
n: number;
|
|
138
|
+
}
|
|
139
|
+
export interface GraphVersionLoadResponse {
|
|
140
|
+
version: VersionEntry;
|
|
141
|
+
document: WorkflowDocument;
|
|
142
|
+
}
|
|
143
|
+
/** `graph/versionRestore` —— 切到某个版本;现在的内容没存成版本时先自动存一份(`saved`)。 */
|
|
144
|
+
export interface GraphVersionRestoreRequest {
|
|
145
|
+
name: string;
|
|
146
|
+
n: number;
|
|
147
|
+
}
|
|
148
|
+
export interface GraphVersionRestoreResponse {
|
|
149
|
+
/** 写回后的整图哈希。 */
|
|
150
|
+
hash: string;
|
|
151
|
+
saved: VersionEntry | null;
|
|
152
|
+
}
|
|
153
|
+
/** `graph/versionNote` —— 改版本说明。 */
|
|
154
|
+
export interface GraphVersionNoteRequest {
|
|
155
|
+
name: string;
|
|
156
|
+
n: number;
|
|
157
|
+
note: string;
|
|
158
|
+
}
|
|
159
|
+
export interface GraphVersionNoteResponse {
|
|
160
|
+
version: VersionEntry;
|
|
161
|
+
}
|
|
162
|
+
/** `graph/versionDelete` */
|
|
163
|
+
export interface GraphVersionDeleteRequest {
|
|
164
|
+
name: string;
|
|
165
|
+
n: number;
|
|
166
|
+
}
|
|
167
|
+
/** `graph/templates` —— 节点模板库(「我的步骤」)。 */
|
|
168
|
+
export type GraphTemplatesRequest = Record<string, never>;
|
|
169
|
+
export interface GraphTemplatesResponse {
|
|
170
|
+
nodes: TemplateEntry[];
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* `graph/nodeTemplate` —— 读一个**节点模板的 `data` 本体**,供画布拖入实例化。
|
|
174
|
+
*
|
|
175
|
+
* 为什么要单独一条:`graph/templates` 只列名字(工具 `list` 的口径),而
|
|
176
|
+
* 「拖入模板节点」= 复制模板的 `data` 本体 + 分配新 `id` + 新 `position`。
|
|
177
|
+
* 没有这条,磁盘模板在画布上就只是个点不动的名字。
|
|
178
|
+
*/
|
|
179
|
+
export interface GraphNodeTemplateRequest {
|
|
180
|
+
name: string;
|
|
181
|
+
}
|
|
182
|
+
export interface GraphNodeTemplateResponse {
|
|
183
|
+
name: string;
|
|
184
|
+
data: NodeData;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* `graph/nodeTemplateCreate` —— 在 `templates/nodes/` 下**新建**一个节点模板。
|
|
188
|
+
*
|
|
189
|
+
* 从前模板只能手写 JSON 丢进目录里;画布上「自定义 node」那一节的「+」磁贴要靠这条
|
|
190
|
+
* 把它建出来。名字是人在对话框里指着输的,所以**撞名报 `conflict`,既不覆盖也不自动加序号**
|
|
191
|
+
* (自动改名会让人找不到刚建的那个;覆盖别人的模板更不可接受)。
|
|
192
|
+
*/
|
|
193
|
+
export interface GraphNodeTemplateCreateRequest {
|
|
194
|
+
name: string;
|
|
195
|
+
/** 模板本体 = 节点的 `data`(`label` / `prompt` / `output`)。 */
|
|
196
|
+
data: NodeData;
|
|
197
|
+
}
|
|
198
|
+
export interface GraphNodeTemplateCreateResponse {
|
|
199
|
+
/** 实际写入的模板名(=入参;撞名会在写之前报错)。 */
|
|
200
|
+
name: string;
|
|
201
|
+
warnings: WireWarning[];
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* `graph/nodeTemplateDraft` —— 读一个节点模板给人**编辑**(「我的步骤」的属性面板)。
|
|
205
|
+
*
|
|
206
|
+
* 与 `graph/nodeTemplate` 的区别:那条是"拿去用",提示词还空着的半成品会被挡掉;
|
|
207
|
+
* 这条只挡文件本身坏了的,半成品正是要打开来改的。
|
|
208
|
+
*/
|
|
209
|
+
export interface GraphNodeTemplateDraftRequest {
|
|
210
|
+
name: string;
|
|
211
|
+
}
|
|
212
|
+
export type GraphNodeTemplateDraftResponse = GraphNodeTemplateResponse;
|
|
213
|
+
/**
|
|
214
|
+
* `graph/nodeTemplateSave` —— 覆盖保存一个**已存在**的节点模板。
|
|
215
|
+
* 给了 `from`(旧名字)且与 `name` 不同 = 改名并保存;新名字被占用报 `conflict`。
|
|
216
|
+
*/
|
|
217
|
+
export interface GraphNodeTemplateSaveRequest {
|
|
218
|
+
name: string;
|
|
219
|
+
data: NodeData;
|
|
220
|
+
from?: string;
|
|
221
|
+
}
|
|
222
|
+
export interface GraphNodeTemplateSaveResponse {
|
|
223
|
+
name: string;
|
|
224
|
+
warnings: WireWarning[];
|
|
225
|
+
}
|
|
226
|
+
/** `graph/nodeTemplateDelete` —— 删除一个节点模板。 */
|
|
227
|
+
export interface GraphNodeTemplateDeleteRequest {
|
|
228
|
+
name: string;
|
|
229
|
+
}
|
|
230
|
+
export interface GraphNodeTemplateDeleteResponse {
|
|
231
|
+
warnings: WireWarning[];
|
|
232
|
+
}
|
|
233
|
+
/** `plan/build` —— 画布上的编译预览(两个 tab)。 */
|
|
234
|
+
export interface PlanBuildRequest {
|
|
235
|
+
name: string;
|
|
236
|
+
/** true = 整卷版(内联正文);缺省 = 派发版。 */
|
|
237
|
+
full?: boolean;
|
|
238
|
+
goal?: string;
|
|
239
|
+
/** 执行者的工作区根(进 ⑤ 动态尾);缺省时渲染「工作区路径:未指定」。 */
|
|
240
|
+
cwd?: string;
|
|
241
|
+
}
|
|
242
|
+
export interface PlanBuildResponse {
|
|
243
|
+
plan: string;
|
|
244
|
+
planId: PlanId;
|
|
245
|
+
/** 只装编译级问题。 */
|
|
246
|
+
problems: ValidationProblem[];
|
|
247
|
+
warnings: WireWarning[];
|
|
248
|
+
}
|
|
249
|
+
export interface WorkflowLiteRpcMap {
|
|
250
|
+
'graph/list': {
|
|
251
|
+
args: GraphListRequest;
|
|
252
|
+
result: GraphListResponse;
|
|
253
|
+
};
|
|
254
|
+
'graph/load': {
|
|
255
|
+
args: GraphLoadRequest;
|
|
256
|
+
result: GraphLoadResponse;
|
|
257
|
+
};
|
|
258
|
+
'graph/save': {
|
|
259
|
+
args: GraphSaveRequest;
|
|
260
|
+
result: GraphSaveResponse;
|
|
261
|
+
};
|
|
262
|
+
'graph/create': {
|
|
263
|
+
args: GraphCreateRequest;
|
|
264
|
+
result: GraphCreateResponse;
|
|
265
|
+
};
|
|
266
|
+
'graph/rename': {
|
|
267
|
+
args: GraphRenameRequest;
|
|
268
|
+
result: GraphRenameResponse;
|
|
269
|
+
};
|
|
270
|
+
'graph/delete': {
|
|
271
|
+
args: GraphDeleteRequest;
|
|
272
|
+
result: GraphDeleteResponse;
|
|
273
|
+
};
|
|
274
|
+
'graph/versions': {
|
|
275
|
+
args: GraphVersionsRequest;
|
|
276
|
+
result: GraphVersionsResponse;
|
|
277
|
+
};
|
|
278
|
+
'graph/versionSave': {
|
|
279
|
+
args: GraphVersionSaveRequest;
|
|
280
|
+
result: GraphVersionSaveResponse;
|
|
281
|
+
};
|
|
282
|
+
'graph/versionLoad': {
|
|
283
|
+
args: GraphVersionLoadRequest;
|
|
284
|
+
result: GraphVersionLoadResponse;
|
|
285
|
+
};
|
|
286
|
+
'graph/versionRestore': {
|
|
287
|
+
args: GraphVersionRestoreRequest;
|
|
288
|
+
result: GraphVersionRestoreResponse;
|
|
289
|
+
};
|
|
290
|
+
'graph/versionNote': {
|
|
291
|
+
args: GraphVersionNoteRequest;
|
|
292
|
+
result: GraphVersionNoteResponse;
|
|
293
|
+
};
|
|
294
|
+
'graph/versionDelete': {
|
|
295
|
+
args: GraphVersionDeleteRequest;
|
|
296
|
+
result: {
|
|
297
|
+
removed: true;
|
|
298
|
+
};
|
|
299
|
+
};
|
|
300
|
+
'graph/templates': {
|
|
301
|
+
args: GraphTemplatesRequest;
|
|
302
|
+
result: GraphTemplatesResponse;
|
|
303
|
+
};
|
|
304
|
+
'graph/nodeTemplate': {
|
|
305
|
+
args: GraphNodeTemplateRequest;
|
|
306
|
+
result: GraphNodeTemplateResponse;
|
|
307
|
+
};
|
|
308
|
+
'graph/nodeTemplateCreate': {
|
|
309
|
+
args: GraphNodeTemplateCreateRequest;
|
|
310
|
+
result: GraphNodeTemplateCreateResponse;
|
|
311
|
+
};
|
|
312
|
+
'graph/nodeTemplateDraft': {
|
|
313
|
+
args: GraphNodeTemplateDraftRequest;
|
|
314
|
+
result: GraphNodeTemplateDraftResponse;
|
|
315
|
+
};
|
|
316
|
+
'graph/nodeTemplateSave': {
|
|
317
|
+
args: GraphNodeTemplateSaveRequest;
|
|
318
|
+
result: GraphNodeTemplateSaveResponse;
|
|
319
|
+
};
|
|
320
|
+
'graph/nodeTemplateDelete': {
|
|
321
|
+
args: GraphNodeTemplateDeleteRequest;
|
|
322
|
+
result: GraphNodeTemplateDeleteResponse;
|
|
323
|
+
};
|
|
324
|
+
'plan/build': {
|
|
325
|
+
args: PlanBuildRequest;
|
|
326
|
+
result: PlanBuildResponse;
|
|
327
|
+
};
|
|
328
|
+
'run/list': {
|
|
329
|
+
args: RunListRequest;
|
|
330
|
+
result: RunListResponse;
|
|
331
|
+
};
|
|
332
|
+
'run/load': {
|
|
333
|
+
args: RunLoadRequest;
|
|
334
|
+
result: RunLoadResponse;
|
|
335
|
+
};
|
|
336
|
+
'run/bind': {
|
|
337
|
+
args: RunBindRequest;
|
|
338
|
+
result: {
|
|
339
|
+
transferred: boolean;
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
'run/save': {
|
|
343
|
+
args: RunSaveRequest;
|
|
344
|
+
result: RunSaveResponse;
|
|
345
|
+
};
|
|
346
|
+
'run/delete': {
|
|
347
|
+
args: RunDeleteRequest;
|
|
348
|
+
result: {
|
|
349
|
+
removed: true;
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
'run/storage': {
|
|
353
|
+
args: RunStorageRequest;
|
|
354
|
+
result: StorageStats;
|
|
355
|
+
};
|
|
356
|
+
'run/start': {
|
|
357
|
+
args: RunStartRequest;
|
|
358
|
+
result: RunStartResponse;
|
|
359
|
+
};
|
|
360
|
+
'run/file': {
|
|
361
|
+
args: RunFileRequest;
|
|
362
|
+
result: RunFileResponse;
|
|
363
|
+
};
|
|
364
|
+
'host/list': {
|
|
365
|
+
args: HostListRequest;
|
|
366
|
+
result: HostListResponse;
|
|
367
|
+
};
|
|
368
|
+
'host/skills': {
|
|
369
|
+
args: HostSkillsRequest;
|
|
370
|
+
result: HostSkillsResponse;
|
|
371
|
+
};
|
|
372
|
+
'host/skill': {
|
|
373
|
+
args: HostSkillRequest;
|
|
374
|
+
result: HostSkillResponse;
|
|
375
|
+
};
|
|
376
|
+
'config/get': {
|
|
377
|
+
args: Record<string, never>;
|
|
378
|
+
result: PluginConfigView;
|
|
379
|
+
};
|
|
380
|
+
'config/set': {
|
|
381
|
+
args: PluginConfigWrite;
|
|
382
|
+
result: PluginConfigView;
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* `host/list`:列主机上一个目录里的东西(只给名字与是不是目录,不读内容)。
|
|
387
|
+
* `path` 缺省 = `cwd`(会话的工作区),再缺省 = 用户主目录。
|
|
388
|
+
*/
|
|
389
|
+
export interface HostListRequest {
|
|
390
|
+
path?: string;
|
|
391
|
+
cwd?: string;
|
|
392
|
+
}
|
|
393
|
+
export interface HostListEntry {
|
|
394
|
+
name: string;
|
|
395
|
+
dir: boolean;
|
|
396
|
+
}
|
|
397
|
+
export interface HostListResponse {
|
|
398
|
+
/** 实际列的目录(绝对路径,分隔符统一成 `/`)。 */
|
|
399
|
+
path: string;
|
|
400
|
+
/** 上一级目录;已经是根就是 `null`。 */
|
|
401
|
+
parent: string | null;
|
|
402
|
+
/** 目录在前、各自按名字排;隐藏项(`.` 开头)也列出来,由前端决定显不显示。 */
|
|
403
|
+
entries: HostListEntry[];
|
|
404
|
+
/** 列不全(条目太多)时为真。 */
|
|
405
|
+
truncated: boolean;
|
|
406
|
+
/** 可以跳去的根:工作区、主目录,Windows 上还有各个盘符。 */
|
|
407
|
+
places: {
|
|
408
|
+
label: string;
|
|
409
|
+
path: string;
|
|
410
|
+
}[];
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* `host/skills`:会话里的 agent 能用的 skill(只列模型能用的)。
|
|
414
|
+
* 给了 `session` 就按那个会话的 agent 预设看(本地 skill 挂在预设底下);不给按默认预设。
|
|
415
|
+
*/
|
|
416
|
+
export interface HostSkillsRequest {
|
|
417
|
+
cwd?: string;
|
|
418
|
+
session?: string;
|
|
419
|
+
}
|
|
420
|
+
/** 一个 skill 的摘要。`source`:从哪来(`project-dsh`、`user-agents`、`bundled`…)。 */
|
|
421
|
+
export interface HostSkillEntry {
|
|
422
|
+
name: string;
|
|
423
|
+
description: string;
|
|
424
|
+
source: string;
|
|
425
|
+
/** SKILL.md 的绝对路径(分隔符统一成 `/`);插件运行时注册的 skill 没有。 */
|
|
426
|
+
path?: string;
|
|
427
|
+
}
|
|
428
|
+
export interface HostSkillsResponse {
|
|
429
|
+
skills: HostSkillEntry[];
|
|
430
|
+
/** 没装 skill 服务时为假(前端只能手写名字)。 */
|
|
431
|
+
available: boolean;
|
|
432
|
+
}
|
|
433
|
+
/** `host/skill`:读一个 skill 的全文(预览用)。 */
|
|
434
|
+
export interface HostSkillRequest {
|
|
435
|
+
name: string;
|
|
436
|
+
cwd?: string;
|
|
437
|
+
session?: string;
|
|
438
|
+
}
|
|
439
|
+
export interface HostSkillResponse extends HostSkillEntry {
|
|
440
|
+
/** 什么时候该用它(SKILL.md 头部的 `when_to_use`)。 */
|
|
441
|
+
whenToUse?: string;
|
|
442
|
+
/** 正文(Markdown,已去掉头部元数据)。 */
|
|
443
|
+
content: string;
|
|
444
|
+
}
|
|
445
|
+
/** `run/list`:`session` 给了且 `all` 不为真时只列这个会话的。 */
|
|
446
|
+
export interface RunListRequest {
|
|
447
|
+
session?: string;
|
|
448
|
+
all?: boolean;
|
|
449
|
+
}
|
|
450
|
+
export interface RunListResponse {
|
|
451
|
+
instances: InstanceSummary[];
|
|
452
|
+
/** 请求方会话的当前实例。 */
|
|
453
|
+
current?: string;
|
|
454
|
+
}
|
|
455
|
+
/** `run/load`:`since` = 上次拿到的 `mtime`,文件没变就只回 `unchanged`。 */
|
|
456
|
+
export interface RunLoadRequest {
|
|
457
|
+
id: string;
|
|
458
|
+
session?: string;
|
|
459
|
+
since?: number;
|
|
460
|
+
}
|
|
461
|
+
export type RunLoadResponse = InstanceView | {
|
|
462
|
+
unchanged: true;
|
|
463
|
+
mtime: number;
|
|
464
|
+
};
|
|
465
|
+
/** `run/bind`:设会话的当前实例(实例属于别的会话时转过来)。 */
|
|
466
|
+
export interface RunBindRequest {
|
|
467
|
+
id: string;
|
|
468
|
+
session: string;
|
|
469
|
+
}
|
|
470
|
+
/** `run/save`:保存用户在画布上攒的改动,并通知模型。 */
|
|
471
|
+
export interface RunSaveRequest {
|
|
472
|
+
id: string;
|
|
473
|
+
session?: string;
|
|
474
|
+
edits: StateEdit[];
|
|
475
|
+
/** 给模型的说明(可选)。 */
|
|
476
|
+
note?: string;
|
|
477
|
+
/** `false` = 只保存、不通知模型(也不暂存通知);缺省通知。 */
|
|
478
|
+
notify?: boolean;
|
|
479
|
+
/** 改了图时:改之前那版的 planId 与改完的整张图(工作流设置不在实例里改,给了也不认)。 */
|
|
480
|
+
graph?: {
|
|
481
|
+
base: string;
|
|
482
|
+
document: WorkflowDocument;
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
export interface RunSaveResponse {
|
|
486
|
+
/** 通知送到模型了没有;没送到时模型下次调用工具会收到。 */
|
|
487
|
+
notified: boolean;
|
|
488
|
+
mtime: number;
|
|
489
|
+
/** 改了图时:新图的 planId。 */
|
|
490
|
+
planId?: string;
|
|
491
|
+
/** 没有通知模型:只改了不进计划的东西(挪卡片、描述),或者用户选了不通知。 */
|
|
492
|
+
quiet?: true;
|
|
493
|
+
}
|
|
494
|
+
/** `run/delete`:删实例记录与快照;`withState` 为真时连状态文件一起删。 */
|
|
495
|
+
export interface RunDeleteRequest {
|
|
496
|
+
id: string;
|
|
497
|
+
withState?: boolean;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* `run/start`:画布上的「执行」——用模板现在的样子建一个新实例,归到 `session`,
|
|
501
|
+
* 回一句要发进那个会话的话(前端走会话输入框的标准发送流程发出去)。
|
|
502
|
+
*/
|
|
503
|
+
export interface RunStartRequest {
|
|
504
|
+
workflow: string;
|
|
505
|
+
session: string;
|
|
506
|
+
/** 那个会话的工作区(状态文件建在这里、计划的 ⑤ 段也用它)。 */
|
|
507
|
+
cwd?: string;
|
|
508
|
+
/** 用户在「执行」前对输入节点的回答(输入 id → 回答);没回答的用默认值。 */
|
|
509
|
+
answers?: Record<string, InputAnswer>;
|
|
510
|
+
}
|
|
511
|
+
export interface RunStartResponse {
|
|
512
|
+
instance: InstanceSummary;
|
|
513
|
+
prompt: string;
|
|
514
|
+
}
|
|
515
|
+
/** `run/file` 整份带回正文的上限(字节);再大只回元信息。 */
|
|
516
|
+
export declare const RUN_FILE_TEXT_MAX: number;
|
|
517
|
+
/** 文件能怎么看:Markdown / HTML / 纯文本带正文;二进制、太大、不在、是个文件夹只有元信息。 */
|
|
518
|
+
export type RunFileKind = 'markdown' | 'html' | 'text' | 'binary' | 'tooLarge' | 'missing' | 'folder';
|
|
519
|
+
/**
|
|
520
|
+
* `run/file`:看实例里的一份文件。`node` + `item` = 快照里某个资源的第几项(文件);
|
|
521
|
+
* `path` = 实例工作区里的相对路径(状态文件 `outputs` 里写的)。工作区外的随手路径一律拒绝。
|
|
522
|
+
*/
|
|
523
|
+
export interface RunFileRequest {
|
|
524
|
+
id: string;
|
|
525
|
+
node?: string;
|
|
526
|
+
item?: number;
|
|
527
|
+
path?: string;
|
|
528
|
+
}
|
|
529
|
+
export interface RunFileResponse {
|
|
530
|
+
/** 绝对路径(交给系统程序打开用)。 */
|
|
531
|
+
path: string;
|
|
532
|
+
/** 给人看的路径(相对工作区)。 */
|
|
533
|
+
display: string;
|
|
534
|
+
exists: boolean;
|
|
535
|
+
size: number;
|
|
536
|
+
mtime: number;
|
|
537
|
+
kind: RunFileKind;
|
|
538
|
+
/** `markdown` / `html` / `text` 时才有。 */
|
|
539
|
+
text?: string;
|
|
540
|
+
limit: number;
|
|
541
|
+
}
|
|
542
|
+
/** `run/storage`:存储统计与清理。 */
|
|
543
|
+
export interface RunStorageRequest {
|
|
544
|
+
action?: 'stats' | 'clearDispatch' | 'clearFinished';
|
|
545
|
+
}
|
|
546
|
+
export interface StorageStats {
|
|
547
|
+
dataDir: string;
|
|
548
|
+
/** `workflows/` 下的文件数与字节数。 */
|
|
549
|
+
workflows: number;
|
|
550
|
+
workflowBytes: number;
|
|
551
|
+
/** 我的步骤(`templates/nodes/`)。 */
|
|
552
|
+
templates: number;
|
|
553
|
+
templateBytes: number;
|
|
554
|
+
/** 工作流版本(`versions/`)。 */
|
|
555
|
+
versions: number;
|
|
556
|
+
versionBytes: number;
|
|
557
|
+
instances: number;
|
|
558
|
+
/** 已结束(完成 / 已取消)的实例数。 */
|
|
559
|
+
finished: number;
|
|
560
|
+
/** 实例在数据目录里的占用(`runs/` 下的图快照与回答;工作区里的实例目录不算)。 */
|
|
561
|
+
instanceBytes: number;
|
|
562
|
+
/** 旧版本遗留的任务描述(`.dispatch/`),现在已不再读写。 */
|
|
563
|
+
dispatchFiles: number;
|
|
564
|
+
dispatchBytes: number;
|
|
565
|
+
/** 这次清理删掉了几项(只在清理动作里有)。 */
|
|
566
|
+
cleared?: number;
|
|
567
|
+
}
|
|
568
|
+
/** 设置页能改的几项(插件 Config 里给人用的那几个,`routePrefix` 这类接线细节不露)。 */
|
|
569
|
+
export declare const PLUGIN_CONFIG_KEYS: readonly ["dataDir", "maxNodes", "saveDebounceMs", "maxResultBytes", "installSkill"];
|
|
570
|
+
export type PluginConfigKey = (typeof PLUGIN_CONFIG_KEYS)[number];
|
|
571
|
+
export interface PluginConfigValues {
|
|
572
|
+
dataDir: string;
|
|
573
|
+
maxNodes: number;
|
|
574
|
+
saveDebounceMs: number;
|
|
575
|
+
maxResultBytes: number;
|
|
576
|
+
installSkill: boolean;
|
|
577
|
+
}
|
|
578
|
+
/** 要重启 DSH 才生效的几项(装配时定住的)。 */
|
|
579
|
+
export declare const RESTART_CONFIG_KEYS: readonly PluginConfigKey[];
|
|
580
|
+
/**
|
|
581
|
+
* `config/get` / `config/set` 的回答。`available: false` = 这个 DSH 没有设置服务,页面只读地显示现值。
|
|
582
|
+
* `defaults` 是去掉用户改动后的值(schema 默认值,或 profile 里更底层给的值),「恢复默认」就回到它。
|
|
583
|
+
*/
|
|
584
|
+
export interface PluginConfigView {
|
|
585
|
+
available: boolean;
|
|
586
|
+
writable: boolean;
|
|
587
|
+
revision: number;
|
|
588
|
+
values: PluginConfigValues;
|
|
589
|
+
defaults: PluginConfigValues;
|
|
590
|
+
/** 用户改过的那几项。 */
|
|
591
|
+
overridden: PluginConfigKey[];
|
|
592
|
+
}
|
|
593
|
+
/** `config/set`:改几项、把几项恢复默认;`revision` 是读到时的修订号,别人先改了就拒绝。 */
|
|
594
|
+
export interface PluginConfigWrite {
|
|
595
|
+
revision: number;
|
|
596
|
+
set?: Partial<PluginConfigValues>;
|
|
597
|
+
reset?: PluginConfigKey[];
|
|
598
|
+
}
|
|
599
|
+
/** 画布内部用的节点索引(host 的 `read` 索引与它同构)。 */
|
|
600
|
+
export type { CompileResult, NodeIndexEntry, Viewport, WorkflowNode };
|
package/locale/en.json
ADDED