@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,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-workflow-lite — 往图里加东西、复制一个节点:模板编辑与实例视图共用。
|
|
3
|
+
*
|
|
4
|
+
* @module @xiaoso/dsh-workflow-lite/client/app/addStep
|
|
5
|
+
*/
|
|
6
|
+
import type { NodeData, Point, WorkflowDocument } from '../../shared/types.ts';
|
|
7
|
+
import type { T } from '../i18n.ts';
|
|
8
|
+
import { type Edit } from '../model/editor.ts';
|
|
9
|
+
import { type StepSource } from '../model/library.ts';
|
|
10
|
+
export interface AddContext {
|
|
11
|
+
t: T;
|
|
12
|
+
doc: WorkflowDocument | null;
|
|
13
|
+
edit(edit: Edit): void;
|
|
14
|
+
/** 读「我的步骤」里的一个节点模板;读不到回 `null`。 */
|
|
15
|
+
loadTemplate(name: string): Promise<NodeData | null>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 按来源加一个节点:步骤(空白 / 内置 / 我的步骤)接在 `from` 后面;资源从步骤的「+」加就是这一步写的产出文件;
|
|
19
|
+
* 输入从步骤的「+」加就是这一步要的输入。加完的节点接管选中。
|
|
20
|
+
*/
|
|
21
|
+
export declare function addFromSource(ctx: AddContext, source: StepSource, position: Point, from?: string): Promise<void>;
|
|
22
|
+
/** 就地添加菜单从哪儿来:步骤的「+」、资源卡拖出来的线、输入,或空白处。 */
|
|
23
|
+
export declare function addOrigin(doc: WorkflowDocument | null, from: string | undefined): 'step' | 'resource' | 'input' | 'none';
|
|
24
|
+
/** 复制一个节点的改动(落在原处右下方一点);节点不在就是 `null`。 */
|
|
25
|
+
export declare function duplicateEdit(doc: WorkflowDocument | null, id: string): Edit | null;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-workflow-lite — 用系统里的程序打开文件(和 DSH 文档预览右上角那个按钮同一套能力)。
|
|
3
|
+
*
|
|
4
|
+
* 借宿主的 Session Remote:`canOpenWorkspacePath`(这台宿主有没有桌面)、
|
|
5
|
+
* `workspacePathApplications`(这类文件注册了哪些程序、哪个是默认)、`openWorkspacePath`
|
|
6
|
+
* (用某个程序打开,或在文件管理器里显示)。服务可选:没接上就不显示「用其他程序打开」。
|
|
7
|
+
*
|
|
8
|
+
* @module @xiaoso/dsh-workflow-lite/client/app/desktop
|
|
9
|
+
*/
|
|
10
|
+
/** 能打开这份文件的一个程序。 */
|
|
11
|
+
export interface DesktopApp {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
default: boolean;
|
|
15
|
+
/** PNG / SVG 的 data URL;系统没给图标时为 `null`。 */
|
|
16
|
+
icon: string | null;
|
|
17
|
+
}
|
|
18
|
+
type RemoteResult<T> = {
|
|
19
|
+
ok: true;
|
|
20
|
+
value: T;
|
|
21
|
+
} | {
|
|
22
|
+
ok: false;
|
|
23
|
+
};
|
|
24
|
+
/** `ctx.remote.session` 用到的部分。 */
|
|
25
|
+
export interface SessionRemote {
|
|
26
|
+
canOpenWorkspacePath(): Promise<RemoteResult<boolean>>;
|
|
27
|
+
workspacePathApplications(request: {
|
|
28
|
+
path: string;
|
|
29
|
+
}, signal?: AbortSignal): Promise<RemoteResult<readonly DesktopApp[]>>;
|
|
30
|
+
openWorkspacePath(request: {
|
|
31
|
+
path: string;
|
|
32
|
+
action?: 'reveal';
|
|
33
|
+
application?: string;
|
|
34
|
+
}): Promise<RemoteResult<unknown>>;
|
|
35
|
+
}
|
|
36
|
+
export interface Desktop {
|
|
37
|
+
/** 宿主能不能把文件交给系统程序(一页只问一次)。 */
|
|
38
|
+
available(): Promise<boolean>;
|
|
39
|
+
/** 这份文件能用哪些程序打开;查不到回 `null`。 */
|
|
40
|
+
applications(path: string, signal: AbortSignal): Promise<readonly DesktopApp[] | null>;
|
|
41
|
+
/** 用默认程序 / 指定程序打开,或在文件管理器里显示。成功回 `true`。 */
|
|
42
|
+
open(path: string, how: {
|
|
43
|
+
reveal: true;
|
|
44
|
+
} | {
|
|
45
|
+
application?: string;
|
|
46
|
+
}): Promise<boolean>;
|
|
47
|
+
}
|
|
48
|
+
export declare function createDesktop(): Desktop & {
|
|
49
|
+
attach(remote: SessionRemote): void;
|
|
50
|
+
detach(): void;
|
|
51
|
+
};
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-workflow-lite — 画布看主机:给资源选文件、文件夹、Skill 时列出主机上有什么。
|
|
3
|
+
*
|
|
4
|
+
* 都走 RPC(`host/list`、`host/skills`、`host/skill`)。Skill 清单按「会话 + 工作区」记一份,
|
|
5
|
+
* 一页里只问一次——选 Skill 是顺手的事,不该每点一下都等一趟。看某个 skill 的全文时才去读它。
|
|
6
|
+
* 顺带捎上桌面能力(用系统程序打开 SKILL.md、在文件管理器里显示)。
|
|
7
|
+
*
|
|
8
|
+
* @module @xiaoso/dsh-workflow-lite/client/app/host
|
|
9
|
+
*/
|
|
10
|
+
import type { HostListResponse, HostSkillResponse, HostSkillsResponse } from '../../shared/wire.ts';
|
|
11
|
+
import type { WorkflowLiteRpc } from '../rpc.ts';
|
|
12
|
+
import type { Desktop } from './desktop.ts';
|
|
13
|
+
export interface HostAccess {
|
|
14
|
+
/** 会话的工作区(列目录的起点,相对路径按它解析);不知道就是 `undefined`。 */
|
|
15
|
+
cwd: string | undefined;
|
|
16
|
+
/** 用系统程序打开文件;宿主没有桌面能力时为 `undefined`。 */
|
|
17
|
+
desktop: Desktop | undefined;
|
|
18
|
+
/** 列一个目录;不给就是工作区。 */
|
|
19
|
+
list(path?: string): Promise<HostListResponse>;
|
|
20
|
+
/** 会话里的 agent 能用的 skill。 */
|
|
21
|
+
skills(): Promise<HostSkillsResponse>;
|
|
22
|
+
/** 读一个 skill 的全文。 */
|
|
23
|
+
skill(name: string): Promise<HostSkillResponse>;
|
|
24
|
+
}
|
|
25
|
+
export declare function createHostAccess(rpc: WorkflowLiteRpc, where: {
|
|
26
|
+
cwd?: string | undefined;
|
|
27
|
+
session?: string | undefined;
|
|
28
|
+
desktop?: Desktop | undefined;
|
|
29
|
+
}): HostAccess;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-workflow-lite — 会话桥:画布上的「执行」要列出同一工作区的会话、在同一工作区新建会话、
|
|
3
|
+
* 往选中的会话里发一句话,发完跳过去。
|
|
4
|
+
*
|
|
5
|
+
* 都借宿主现成的东西,不自己造:
|
|
6
|
+
* - 会话列表与新建:Session Controller 的 `sessions.list` / `sessions.create`(和侧栏同一份数据);
|
|
7
|
+
* 新建时按 Workspace Controller 找到本会话所在的工作区,新会话归在同一组里;
|
|
8
|
+
* - 发消息:会话输入框的标准发送流程(`conversation.input.for(会话 ctx)` 的 `setDraft` + `submit`),
|
|
9
|
+
* 和用户自己敲回车一模一样——会话正忙时按用户的设置排队或插话;
|
|
10
|
+
* - 跳过去:`uiWorkspace.openSession`(和点侧栏一样)。
|
|
11
|
+
*
|
|
12
|
+
* 这些服务都是**可选**的:入口用 `ctx.inject` 的子上下文接上,缺了只是对应的能力用不了,视图照常。
|
|
13
|
+
* 宿主的类型包不在依赖里,这里只声明用到的那几个成员。
|
|
14
|
+
*
|
|
15
|
+
* @module @xiaoso/dsh-workflow-lite/client/app/sessions
|
|
16
|
+
*/
|
|
17
|
+
/** 列表里的一个会话(侧栏那份数据的子集)。 */
|
|
18
|
+
export interface SessionRow {
|
|
19
|
+
id: string;
|
|
20
|
+
title: string;
|
|
21
|
+
cwd?: string;
|
|
22
|
+
running: boolean;
|
|
23
|
+
updatedAt: number;
|
|
24
|
+
/** 还没说过话的新会话。 */
|
|
25
|
+
blank: boolean;
|
|
26
|
+
/** 子代理会话(不在侧栏里列,也不给选)。 */
|
|
27
|
+
subagent: boolean;
|
|
28
|
+
}
|
|
29
|
+
interface Observable<T> {
|
|
30
|
+
getSnapshot(): T;
|
|
31
|
+
subscribe(fn: () => void): () => void;
|
|
32
|
+
}
|
|
33
|
+
interface InputSnapshot {
|
|
34
|
+
draft: string;
|
|
35
|
+
phase: 'plain' | 'adjudicating' | 'claimed' | 'submitting';
|
|
36
|
+
}
|
|
37
|
+
interface SessionInput {
|
|
38
|
+
setDraft(text: string): void;
|
|
39
|
+
submit(): void;
|
|
40
|
+
readonly state: Observable<InputSnapshot>;
|
|
41
|
+
}
|
|
42
|
+
/** `ctx.conversation` 用到的部分。 */
|
|
43
|
+
export interface ConversationService {
|
|
44
|
+
input: {
|
|
45
|
+
for(ctx: unknown): SessionInput;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
interface SessionSummary {
|
|
49
|
+
id: string;
|
|
50
|
+
title?: string;
|
|
51
|
+
displayTitle?: string;
|
|
52
|
+
cwd?: string;
|
|
53
|
+
origin?: string;
|
|
54
|
+
running?: boolean;
|
|
55
|
+
blank?: boolean;
|
|
56
|
+
updatedAt?: number;
|
|
57
|
+
}
|
|
58
|
+
/** `ctx.sessions` 用到的部分。 */
|
|
59
|
+
export interface SessionsService {
|
|
60
|
+
list: Observable<{
|
|
61
|
+
ids: readonly string[];
|
|
62
|
+
byId: Readonly<Record<string, SessionSummary>>;
|
|
63
|
+
}>;
|
|
64
|
+
create(opts?: {
|
|
65
|
+
workspaceId?: string;
|
|
66
|
+
cwd?: string;
|
|
67
|
+
}): Promise<string>;
|
|
68
|
+
using<T>(target: string, options: {
|
|
69
|
+
source: string;
|
|
70
|
+
}, operation: (reference: {
|
|
71
|
+
binding: {
|
|
72
|
+
ctx: unknown;
|
|
73
|
+
};
|
|
74
|
+
}) => T | Promise<T>): Promise<T>;
|
|
75
|
+
}
|
|
76
|
+
/** `ctx.workspaces` 用到的部分。 */
|
|
77
|
+
export interface WorkspacesService {
|
|
78
|
+
list: Observable<{
|
|
79
|
+
items: readonly {
|
|
80
|
+
workspaceId: string;
|
|
81
|
+
path: string;
|
|
82
|
+
sessionIds: readonly string[];
|
|
83
|
+
}[];
|
|
84
|
+
}>;
|
|
85
|
+
}
|
|
86
|
+
/** `ctx.uiWorkspace` 用到的部分。 */
|
|
87
|
+
export interface UiWorkspaceService {
|
|
88
|
+
openSession(target: string): void;
|
|
89
|
+
}
|
|
90
|
+
/** 视图拿到的会话桥。 */
|
|
91
|
+
export interface SessionBridge {
|
|
92
|
+
/** 服务接上了没有(没接上 = 「执行」不可用)。 */
|
|
93
|
+
available(): boolean;
|
|
94
|
+
rows(): readonly SessionRow[];
|
|
95
|
+
subscribe(fn: () => void): () => void;
|
|
96
|
+
/** 往会话里发一句话;没发出去就抛错(错误信息给人看)。 */
|
|
97
|
+
deliver(session: string, text: string): Promise<void>;
|
|
98
|
+
/** 能不能新建会话。 */
|
|
99
|
+
canCreate(): boolean;
|
|
100
|
+
/** 在 `from` 所在的工作区新建一个会话(拿不到工作区就按 `cwd` 建),回新会话的 id。 */
|
|
101
|
+
create(from: string, cwd: string | undefined): Promise<string>;
|
|
102
|
+
/** 跳到一个会话(宿主没有导航能力时什么也不做,回 `false`)。 */
|
|
103
|
+
open(session: string): boolean;
|
|
104
|
+
}
|
|
105
|
+
/** 入口里建一个,服务接上 / 断开时调 `attach` / `detach`。 */
|
|
106
|
+
export declare function createSessionBridge(): SessionBridge & {
|
|
107
|
+
attach(sessions: SessionsService, conversation: ConversationService): void;
|
|
108
|
+
detach(): void;
|
|
109
|
+
attachWorkspaces(workspaces: WorkspacesService | undefined, ui: UiWorkspaceService | undefined): void;
|
|
110
|
+
};
|
|
111
|
+
/** 同一个工作区:路径大小写、分隔符不同也算同一个(Windows)。 */
|
|
112
|
+
export declare function sameDir(a: string | undefined, b: string | undefined): boolean;
|
|
113
|
+
/** 能选的会话:本会话在最前,其余是同一工作区里说过话的主会话,新的在前。 */
|
|
114
|
+
export declare function pickable(rows: readonly SessionRow[], session: string | undefined): SessionRow[];
|
|
115
|
+
/** 订阅会话列表。 */
|
|
116
|
+
export declare function useSessionRows(bridge: SessionBridge | undefined): readonly SessionRow[];
|
|
117
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-workflow-lite — 选了哪套配色主题:亮色一套、暗色一套,记在浏览器里。
|
|
3
|
+
*
|
|
4
|
+
* 只是看起来的样子,不改工作流、也不用存进 profile:和视口、步骤库开关一样记在 localStorage。
|
|
5
|
+
* 同一个页面里几处一起订阅(视图根节点、设置页),换了马上都跟着变;别的标签页改了也跟着变。
|
|
6
|
+
*
|
|
7
|
+
* @module @xiaoso/dsh-workflow-lite/client/app/theme
|
|
8
|
+
*/
|
|
9
|
+
import { type DarkThemeId, type LightThemeId, type ThemeMode } from '../model/themes.ts';
|
|
10
|
+
export interface ThemeChoice {
|
|
11
|
+
light: LightThemeId;
|
|
12
|
+
dark: DarkThemeId;
|
|
13
|
+
}
|
|
14
|
+
/** 读记下的选择;没记过、记坏了、存储不可用都按默认(坏掉的那一半单独按默认)。 */
|
|
15
|
+
export declare function readThemeChoice(): ThemeChoice;
|
|
16
|
+
export declare function getThemeChoice(): ThemeChoice;
|
|
17
|
+
/** 换一套(只换给出的那一半)。两套都是默认时把记录删掉。 */
|
|
18
|
+
export declare function setThemeChoice(next: Partial<ThemeChoice>): void;
|
|
19
|
+
export declare function useThemeChoice(): ThemeChoice;
|
|
20
|
+
/** 测试用:丢掉缓存,下次从存储重新读。 */
|
|
21
|
+
export declare function resetThemeCache(): void;
|
|
22
|
+
/**
|
|
23
|
+
* 此刻是亮还是暗:宿主把 `color-scheme` 写在 `<html>` 上;写的是 `light dark`(跟系统)时看系统设置。
|
|
24
|
+
* 只用来在设置页标「正在用」,配色本身由 CSS 的 `light-dark()` 自己挑。
|
|
25
|
+
*/
|
|
26
|
+
export declare function currentScheme(): ThemeMode;
|
|
27
|
+
export declare function useColorScheme(): ThemeMode;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-workflow-lite — 工作流中心「设置」页的状态:读插件设置、在草稿上改、一次保存。
|
|
3
|
+
*
|
|
4
|
+
* - 输入框里的数字先按文字存(打字途中可以是空的),保存时才换成数;「读取上限」给人看 KB,存的是字节。
|
|
5
|
+
* - 保存时只送改了的几项:改回默认值的发「恢复」(删掉 profile 里那一项),其余发「设成」。
|
|
6
|
+
* - 别处先改过(修订号对不上):重新读一遍,草稿留着,告诉人再保存一次。
|
|
7
|
+
*
|
|
8
|
+
* @module @xiaoso/dsh-workflow-lite/client/app/usePluginConfig
|
|
9
|
+
*/
|
|
10
|
+
import { type PluginConfigKey, type PluginConfigValues, type PluginConfigView } from '../../shared/wire.ts';
|
|
11
|
+
import type { T } from '../i18n.ts';
|
|
12
|
+
import { type WorkflowLiteRpc } from '../rpc.ts';
|
|
13
|
+
/** 草稿:文字框里的原样。 */
|
|
14
|
+
export interface ConfigDraft {
|
|
15
|
+
dataDir: string;
|
|
16
|
+
maxNodes: string;
|
|
17
|
+
saveDebounceMs: string;
|
|
18
|
+
/** 以 KB 计。 */
|
|
19
|
+
maxResultBytes: string;
|
|
20
|
+
installSkill: boolean;
|
|
21
|
+
}
|
|
22
|
+
export type ConfigErrors = Partial<Record<PluginConfigKey, string>>;
|
|
23
|
+
export interface PluginConfigState {
|
|
24
|
+
view: PluginConfigView | null;
|
|
25
|
+
draft: ConfigDraft | null;
|
|
26
|
+
/** 读不出来时的原因。 */
|
|
27
|
+
loadError: string | null;
|
|
28
|
+
errors: ConfigErrors;
|
|
29
|
+
/** 和已保存的值不一样的几项。 */
|
|
30
|
+
dirty: PluginConfigKey[];
|
|
31
|
+
busy: boolean;
|
|
32
|
+
notice: {
|
|
33
|
+
tone: 'ok' | 'error';
|
|
34
|
+
text: string;
|
|
35
|
+
} | null;
|
|
36
|
+
edit<K extends keyof ConfigDraft>(key: K, value: ConfigDraft[K]): void;
|
|
37
|
+
/** 草稿里这一项换回默认值(保存后生效)。 */
|
|
38
|
+
toDefault(key: PluginConfigKey): void;
|
|
39
|
+
discard(): void;
|
|
40
|
+
save(): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
export declare function toDraft(values: PluginConfigValues): ConfigDraft;
|
|
43
|
+
/**
|
|
44
|
+
* 草稿 → 值。`saved` 用来认「读取上限没动过」:KB 四舍五入回去和原来的字节数对不上时,原值照留。
|
|
45
|
+
* @returns 有错的项给出原因;没错的项给出值。
|
|
46
|
+
*/
|
|
47
|
+
export declare function fromDraft(draft: ConfigDraft, saved: PluginConfigValues, t: T): {
|
|
48
|
+
values: PluginConfigValues;
|
|
49
|
+
errors: ConfigErrors;
|
|
50
|
+
};
|
|
51
|
+
export declare function usePluginConfig(rpc: WorkflowLiteRpc, t: T, onSaved: () => void): PluginConfigState;
|
|
52
|
+
/** 各项的名字(提示里拼「数据目录、给模型的使用指南要重启」用)。 */
|
|
53
|
+
export declare const LABEL: {
|
|
54
|
+
readonly dataDir: "cfg.dataDir";
|
|
55
|
+
readonly maxNodes: "cfg.maxNodes";
|
|
56
|
+
readonly saveDebounceMs: "cfg.saveDebounce";
|
|
57
|
+
readonly maxResultBytes: "cfg.maxResult";
|
|
58
|
+
readonly installSkill: "cfg.skill";
|
|
59
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-workflow-lite — 读实例里的一份产出文件(文件面板的预览、查看框)。
|
|
3
|
+
*
|
|
4
|
+
* @module @xiaoso/dsh-workflow-lite/client/app/useRunFile
|
|
5
|
+
*/
|
|
6
|
+
import type { RunFileResponse } from '../../shared/wire.ts';
|
|
7
|
+
import { type WorkflowLiteRpc } from '../rpc.ts';
|
|
8
|
+
/** 要看哪份:快照里某个资源的第几项,或实例工作区里的相对路径。 */
|
|
9
|
+
export type FileTarget = {
|
|
10
|
+
node: string;
|
|
11
|
+
item: number;
|
|
12
|
+
} | {
|
|
13
|
+
path: string;
|
|
14
|
+
};
|
|
15
|
+
export interface RunFile {
|
|
16
|
+
file: RunFileResponse | null;
|
|
17
|
+
error: string | null;
|
|
18
|
+
loading: boolean;
|
|
19
|
+
reload(): void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @param version - 变了就重读(文件面板拿"文件在不在 + 状态文件修改时间"当版本:模型写完文件通常也会更新状态)。
|
|
23
|
+
*/
|
|
24
|
+
export declare function useRunFile(rpc: WorkflowLiteRpc, instance: string, target: FileTarget | null, version?: string | number): RunFile;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-workflow-lite — 实例视图里改图:一份只在本地的编辑器(和模板编辑同一个状态机),不自动存。
|
|
3
|
+
*
|
|
4
|
+
* 图的改动和状态的改动攒在同一条草稿栏里(「已改 x 处」),用户点「保存并通知模型」才一起交给 host。
|
|
5
|
+
* 改到一半切走再回来接着改:改过的图按实例存在浏览器里,基线(planId)对不上就作废。
|
|
6
|
+
*
|
|
7
|
+
* 检查和模板用同一套规则(`shared/validate.ts` 的四级):顶栏的检查结果列全部,画布按它标卡片;
|
|
8
|
+
* 挡保存的只有保存级、编译级,而且只在改过图时才挡(没改过就是建实例时那张,不该拦着改状态)。
|
|
9
|
+
*
|
|
10
|
+
* @module @xiaoso/dsh-workflow-lite/client/app/useRunGraph
|
|
11
|
+
*/
|
|
12
|
+
import { type GraphChange } from '../../shared/graphDiff.ts';
|
|
13
|
+
import type { ValidationProblem, WorkflowDocument } from '../../shared/types.ts';
|
|
14
|
+
import { type Edit, type Selection } from '../model/editor.ts';
|
|
15
|
+
import type { SideHistory } from '../model/runHistory.ts';
|
|
16
|
+
export interface RunGraph {
|
|
17
|
+
/** 改到现在的图;基线还没到时是 `null`。 */
|
|
18
|
+
doc: WorkflowDocument | null;
|
|
19
|
+
/** 改之前那版。 */
|
|
20
|
+
base: WorkflowDocument | null;
|
|
21
|
+
/** 改之前那版的 planId(保存时交给 host 核对)。 */
|
|
22
|
+
basePlan: string | null;
|
|
23
|
+
selection: Selection;
|
|
24
|
+
/** 比基线改了什么(一处一项,按 `shared/graphDiff.ts` 数)。 */
|
|
25
|
+
changes: GraphChange[];
|
|
26
|
+
/** 改完的图保存不了的问题(保存级、编译级;没改过图时为空):保存按钮按住。 */
|
|
27
|
+
problems: ValidationProblem[];
|
|
28
|
+
/** 这张图的全部检查结果(四级,和模板同一套规则):顶栏的检查结果、画布上的标记。 */
|
|
29
|
+
report: ValidationProblem[];
|
|
30
|
+
/** 图的撤销栈。 */
|
|
31
|
+
history: SideHistory;
|
|
32
|
+
edit(edit: Edit): void;
|
|
33
|
+
select(selection: Selection): void;
|
|
34
|
+
seal(): void;
|
|
35
|
+
undo(): void;
|
|
36
|
+
redo(): void;
|
|
37
|
+
/** 丢掉重做栈(状态那边有了新的一步)。 */
|
|
38
|
+
dropRedo(): void;
|
|
39
|
+
/** 单独撤回清单里的一处。 */
|
|
40
|
+
revert(change: GraphChange): void;
|
|
41
|
+
/** 放弃图的全部改动。 */
|
|
42
|
+
discard(): void;
|
|
43
|
+
/** 存好了:改到现在的图就是新的基线(`planId` 是 host 回的新图的)。 */
|
|
44
|
+
commit(planId: string): void;
|
|
45
|
+
}
|
|
46
|
+
export declare function useRunGraph(id: string,
|
|
47
|
+
/** host 给的快照(已补好位置)与它的 planId;还没读回来是 `null`。 */
|
|
48
|
+
source: {
|
|
49
|
+
planId: string;
|
|
50
|
+
doc: WorkflowDocument;
|
|
51
|
+
} | null, workflow: string | undefined): RunGraph;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-workflow-lite — 实例视图的撤销 / 重做:把图的撤销栈和状态草稿的撤销栈排成一条
|
|
3
|
+
* (顺序怎么对齐见 `model/runHistory.ts`)。顶栏的两个按钮和 Ctrl+Z / Ctrl+Shift+Z 都走这里。
|
|
4
|
+
*
|
|
5
|
+
* @module @xiaoso/dsh-workflow-lite/client/app/useRunHistory
|
|
6
|
+
*/
|
|
7
|
+
import { type HistorySide, type SideHistory } from '../model/runHistory.ts';
|
|
8
|
+
/** 一边要交给这里的东西。 */
|
|
9
|
+
export interface HistorySource {
|
|
10
|
+
history: SideHistory;
|
|
11
|
+
undo(): void;
|
|
12
|
+
redo(): void;
|
|
13
|
+
dropRedo(): void;
|
|
14
|
+
}
|
|
15
|
+
export interface RunHistory {
|
|
16
|
+
canUndo: boolean;
|
|
17
|
+
canRedo: boolean;
|
|
18
|
+
undo(): void;
|
|
19
|
+
redo(): void;
|
|
20
|
+
}
|
|
21
|
+
export declare function useRunHistory(sources: Record<HistorySide, HistorySource>): RunHistory;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-workflow-lite — 工作流实例的两只钩子:
|
|
3
|
+
* - {@link useRuns}:本会话(或全部)的实例列表与当前实例;
|
|
4
|
+
* - {@link useRun}:正在看的那一个实例——轮询状态文件、攒草稿、冲突、保存并通知模型。
|
|
5
|
+
*
|
|
6
|
+
* 只有实例视图轮询(每 2 秒带上次的 mtime 问一次,没变就只回"没变");模板编辑照旧不轮询。
|
|
7
|
+
*
|
|
8
|
+
* @module @xiaoso/dsh-workflow-lite/client/app/useRuns
|
|
9
|
+
*/
|
|
10
|
+
import { type InstanceSummary, type InstanceView, type NodeStatus, type RunState, type StateEdit } from '../../shared/runState.ts';
|
|
11
|
+
import type { WorkflowDocument } from '../../shared/types.ts';
|
|
12
|
+
import type { RunSaveResponse } from '../../shared/wire.ts';
|
|
13
|
+
import type { T } from '../i18n.ts';
|
|
14
|
+
import { type DraftConflict } from '../model/runDraft.ts';
|
|
15
|
+
import type { SideHistory } from '../model/runHistory.ts';
|
|
16
|
+
import { type WorkflowLiteRpc } from '../rpc.ts';
|
|
17
|
+
/** 实例视图轮询的间隔。 */
|
|
18
|
+
export declare const RUN_POLL_MS = 2000;
|
|
19
|
+
export interface Runs {
|
|
20
|
+
/** 本会话的实例(新的在前)。 */
|
|
21
|
+
list: InstanceSummary[];
|
|
22
|
+
/** 本会话的当前实例。 */
|
|
23
|
+
current: string | undefined;
|
|
24
|
+
/** 第一次拉完没有。 */
|
|
25
|
+
loaded: boolean;
|
|
26
|
+
refresh(): Promise<void>;
|
|
27
|
+
/** 设本会话的当前实例(别的会话的实例会被转过来)。 */
|
|
28
|
+
bind(id: string): Promise<boolean>;
|
|
29
|
+
remove(id: string, withState: boolean): Promise<boolean>;
|
|
30
|
+
/** 列全部会话的实例(工作流中心用)。 */
|
|
31
|
+
all(): Promise<InstanceSummary[]>;
|
|
32
|
+
}
|
|
33
|
+
export declare function useRuns(rpc: WorkflowLiteRpc, session: string | undefined): Runs;
|
|
34
|
+
export interface RunToast {
|
|
35
|
+
id: number;
|
|
36
|
+
tone: 'ok' | 'error';
|
|
37
|
+
text: string;
|
|
38
|
+
}
|
|
39
|
+
export interface Run {
|
|
40
|
+
/** 最近一次读到的实例(含快照与校验结论);第一次读回来之前是 `null`。 */
|
|
41
|
+
view: InstanceView | null;
|
|
42
|
+
/** 上一次合法的状态(文件写坏时画布保留它)。 */
|
|
43
|
+
lastGood: RunState | null;
|
|
44
|
+
/** 叠上草稿之后的状态:画布与面板显示的就是它。 */
|
|
45
|
+
shown: RunState | null;
|
|
46
|
+
draft: StateEdit[];
|
|
47
|
+
conflicts: DraftConflict[];
|
|
48
|
+
/** 保存后又被模型改回去的字段(提示"你的修改可能被模型覆盖了")。 */
|
|
49
|
+
overwritten: string[][];
|
|
50
|
+
note: string;
|
|
51
|
+
setNote(note: string): void;
|
|
52
|
+
/** 保存时通知模型没有(默认通知;关掉就只保存)。 */
|
|
53
|
+
notify: boolean;
|
|
54
|
+
setNotify(notify: boolean): void;
|
|
55
|
+
saving: boolean;
|
|
56
|
+
error: string | null;
|
|
57
|
+
toast: RunToast | null;
|
|
58
|
+
/** 在实例视图底部弹一句话。 */
|
|
59
|
+
flash(tone: RunToast['tone'], text: string): void;
|
|
60
|
+
setField(path: string[], to: StateEdit['to']): void;
|
|
61
|
+
setStatus(id: string, status: NodeStatus): void;
|
|
62
|
+
/** 一次改几个步骤的状态。 */
|
|
63
|
+
setStatuses(ids: readonly string[], status: NodeStatus): void;
|
|
64
|
+
rerun(ids: readonly string[]): void;
|
|
65
|
+
undoEdit(path: readonly string[]): void;
|
|
66
|
+
resolve(conflict: DraftConflict, keep: 'mine' | 'theirs'): void;
|
|
67
|
+
/** 状态草稿的撤销栈(图的在 useRunGraph;两边由 useRunHistory 排成一条)。 */
|
|
68
|
+
draftHistory: SideHistory;
|
|
69
|
+
undoDraft(): void;
|
|
70
|
+
redoDraft(): void;
|
|
71
|
+
/** 丢掉重做栈(图那边有了新的一步)。 */
|
|
72
|
+
dropDraftRedo(): void;
|
|
73
|
+
discard(): void;
|
|
74
|
+
/**
|
|
75
|
+
* 保存草稿并通知模型。改了图就把改完的整张图一起交上去(草稿里删掉了的步骤的状态改动不交);
|
|
76
|
+
* 存好了回 host 的回执,没存成回 `null`。
|
|
77
|
+
*/
|
|
78
|
+
save(graph?: {
|
|
79
|
+
base: string;
|
|
80
|
+
document: WorkflowDocument;
|
|
81
|
+
}): Promise<RunSaveResponse | null>;
|
|
82
|
+
reload(): Promise<void>;
|
|
83
|
+
}
|
|
84
|
+
export declare function useRun(rpc: WorkflowLiteRpc, id: string, session: string | undefined, t: T, onSaved?: () => void): Run;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-workflow-lite — 一个工作流的版本:列、存、切、改说明、删,外加「切到这一版会变什么」。
|
|
3
|
+
*
|
|
4
|
+
* 编辑页的「版本」对话框和工作流中心的「工作流」页共用它。版本存的是**磁盘上**那份:
|
|
5
|
+
* 动手之前先调 `before()`(编辑页正开着这张图时把还没写下去的改动存掉);
|
|
6
|
+
* 切换写回了工作流之后调 `onRestored()`(正开着就按磁盘重新加载)。
|
|
7
|
+
*
|
|
8
|
+
* @module @xiaoso/dsh-workflow-lite/client/app/useVersions
|
|
9
|
+
*/
|
|
10
|
+
import { type GraphChange } from '../../shared/graphDiff.ts';
|
|
11
|
+
import type { VersionEntry, WorkflowDocument } from '../../shared/types.ts';
|
|
12
|
+
import type { T } from '../i18n.ts';
|
|
13
|
+
import { type WorkflowLiteRpc } from '../rpc.ts';
|
|
14
|
+
export interface VersionNotice {
|
|
15
|
+
tone: 'ok' | 'error';
|
|
16
|
+
text: string;
|
|
17
|
+
/** 每条提示一个新值:同样的字再出现一次也要重新淡入。 */
|
|
18
|
+
seq: number;
|
|
19
|
+
}
|
|
20
|
+
/** 切到某一版会变什么:`base` = 现在,`next` = 那一版。 */
|
|
21
|
+
export interface VersionDiff {
|
|
22
|
+
changes: GraphChange[];
|
|
23
|
+
settings: boolean;
|
|
24
|
+
base: WorkflowDocument;
|
|
25
|
+
next: WorkflowDocument;
|
|
26
|
+
}
|
|
27
|
+
export interface Versions {
|
|
28
|
+
/** `null` = 还在读。 */
|
|
29
|
+
list: VersionEntry[] | null;
|
|
30
|
+
/** 正在做的那件事(按钮按住)。 */
|
|
31
|
+
busy: boolean;
|
|
32
|
+
notice: VersionNotice | null;
|
|
33
|
+
refresh(): Promise<void>;
|
|
34
|
+
save(note: string): Promise<boolean>;
|
|
35
|
+
restore(n: number): Promise<boolean>;
|
|
36
|
+
setNote(n: number, note: string): Promise<boolean>;
|
|
37
|
+
remove(n: number): Promise<boolean>;
|
|
38
|
+
diff(n: number): Promise<VersionDiff | null>;
|
|
39
|
+
}
|
|
40
|
+
export declare function useVersions(options: {
|
|
41
|
+
t: T;
|
|
42
|
+
rpc: WorkflowLiteRpc;
|
|
43
|
+
name: string;
|
|
44
|
+
/** 动手前(存掉编辑页还没写下去的改动);回 `false` 就不做了。 */
|
|
45
|
+
before?: () => Promise<boolean>;
|
|
46
|
+
/** 切换写回了工作流之后。 */
|
|
47
|
+
onRestored?: () => void;
|
|
48
|
+
/** 版本数变了(列表里的「N 个版本」跟上)。 */
|
|
49
|
+
onChanged?: () => void;
|
|
50
|
+
}): Versions;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-workflow-lite — 编辑器的"发动机":加载、自动保存、冲突、目录。
|
|
3
|
+
*
|
|
4
|
+
* 状态放在一个 ref 里同步推进,再镜像进 React state 触发渲染。**不能只靠 React state**:
|
|
5
|
+
* 改完文档要立刻判断"该不该排一次保存",而 React 的 state 要等下一次渲染才更新——
|
|
6
|
+
* 读到旧值就会把这次排期整个丢掉(改动永远不落盘)。
|
|
7
|
+
*
|
|
8
|
+
* 保存规则:
|
|
9
|
+
* - 改动 → 防抖后写一次;保存中不重入,保存期间来的改动在这笔写完后补排;
|
|
10
|
+
* - 换图 / 页面隐藏 / 卸载 → 立即写,不等防抖;
|
|
11
|
+
* - `broken` 态绝不写盘。
|
|
12
|
+
*
|
|
13
|
+
* @module @xiaoso/dsh-workflow-lite/client/app/useWorkflow
|
|
14
|
+
*/
|
|
15
|
+
import { type GraphAnalysis } from '../../shared/graph.ts';
|
|
16
|
+
import type { NodeData } from '../../shared/types.ts';
|
|
17
|
+
import type { GraphListResponse, PlanBuildResponse } from '../../shared/wire.ts';
|
|
18
|
+
import type { T } from '../i18n.ts';
|
|
19
|
+
import { type Edit, type EditorState, type Selection } from '../model/editor.ts';
|
|
20
|
+
import { type WorkflowLiteRpc } from '../rpc.ts';
|
|
21
|
+
export interface Toast {
|
|
22
|
+
id: number;
|
|
23
|
+
text: string;
|
|
24
|
+
tone: 'info' | 'error';
|
|
25
|
+
}
|
|
26
|
+
export interface Workflow {
|
|
27
|
+
state: EditorState;
|
|
28
|
+
analysis: GraphAnalysis | null;
|
|
29
|
+
catalog: GraphListResponse | null;
|
|
30
|
+
/** 磁盘上的版本与本地改动冲突时的冲突 id 清单;`null` = 没有冲突。 */
|
|
31
|
+
conflict: string[] | null;
|
|
32
|
+
/** 本地有改动、磁盘又被别处改过。 */
|
|
33
|
+
external: boolean;
|
|
34
|
+
toast: Toast | null;
|
|
35
|
+
/** 刚建好的工作流名字:顶栏据此直接进入改名。读完即清。 */
|
|
36
|
+
fresh: string | null;
|
|
37
|
+
clearFresh(): void;
|
|
38
|
+
edit(edit: Edit): void;
|
|
39
|
+
select(selection: Selection): void;
|
|
40
|
+
undo(): void;
|
|
41
|
+
redo(): void;
|
|
42
|
+
/** 一次连续输入结束:断开撤销合并。 */
|
|
43
|
+
seal(): void;
|
|
44
|
+
open(name: string): Promise<void>;
|
|
45
|
+
create(): Promise<void>;
|
|
46
|
+
/** 改名:`from` 可以是任意一张(不必先打开);改的是正开着的这张时顶栏跟着换名字。 */
|
|
47
|
+
rename(from: string, to: string): Promise<boolean>;
|
|
48
|
+
/** 回 `false` = 没删成(已经提示过了)。 */
|
|
49
|
+
remove(name: string): Promise<boolean>;
|
|
50
|
+
reload(): void;
|
|
51
|
+
retrySave(): void;
|
|
52
|
+
keepMine(): void;
|
|
53
|
+
refreshCatalog(): Promise<void>;
|
|
54
|
+
/** 预览计划;`cwd` = 执行时的工作区(计划里的工作区路径、任务描述路径按它写)。 */
|
|
55
|
+
buildPlan(full: boolean, cwd?: string): Promise<PlanBuildResponse>;
|
|
56
|
+
/** 把待写的改动立刻存下去(「执行」之前:实例要拿磁盘上的那份做快照)。存不下去回 `false`。 */
|
|
57
|
+
flush(): Promise<boolean>;
|
|
58
|
+
loadTemplate(name: string): Promise<NodeData | null>;
|
|
59
|
+
saveTemplate(name: string, data: NodeData): Promise<boolean>;
|
|
60
|
+
/** 读「我的步骤」给人编辑(提示词空着的半成品也能读)。 */
|
|
61
|
+
loadTemplateDraft(name: string): Promise<NodeData | null>;
|
|
62
|
+
/** 覆盖保存「我的步骤」;`name` 与 `from` 不同就是改名。成功返回保存后的名字。 */
|
|
63
|
+
updateTemplate(name: string, data: NodeData, from: string): Promise<string | null>;
|
|
64
|
+
deleteTemplate(name: string): Promise<boolean>;
|
|
65
|
+
notify(text: string, tone?: Toast['tone']): void;
|
|
66
|
+
}
|
|
67
|
+
export declare function useWorkflow(rpc: WorkflowLiteRpc, t: T): Workflow;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-workflow-lite — 每张图上次看到哪(视口)记在浏览器里,不写进图文件。
|
|
3
|
+
*
|
|
4
|
+
* 视口是看图的人自己的状态:拖动、缩放只是浏览,不该让图变成「待保存」,
|
|
5
|
+
* 更不该因为一次平移就整图写盘、和模型正在做的改动撞车。图文件里的 `viewport` 只读不写,
|
|
6
|
+
* 浏览器里没记过(第一次打开、换了浏览器)时拿它兜底。
|
|
7
|
+
*
|
|
8
|
+
* @module @xiaoso/dsh-workflow-lite/client/app/viewport
|
|
9
|
+
*/
|
|
10
|
+
import type { Viewport } from '../../shared/types.ts';
|
|
11
|
+
/** 这张图上次的视口;没记过、记坏了或存储不可用就是 `null`。 */
|
|
12
|
+
export declare function recallViewport(workflow: string): Viewport | null;
|
|
13
|
+
/** 记下这张图的视口(尽力而为)。 */
|
|
14
|
+
export declare function rememberViewport(workflow: string, viewport: Viewport): void;
|