@meiyukichan/dsh-sandore 0.1.0-rc.6
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 +201 -0
- package/cordis.patch.yml +39 -0
- package/dsh.plugin.json +16 -0
- package/lib/client/CommandEditor.d.ts +19 -0
- package/lib/client/DagEditor.d.ts +22 -0
- package/lib/client/DefinitionDetail.d.ts +13 -0
- package/lib/client/DefinitionList.d.ts +19 -0
- package/lib/client/DiscussionInput.d.ts +63 -0
- package/lib/client/DragHandle.d.ts +16 -0
- package/lib/client/EditorPane.d.ts +13 -0
- package/lib/client/FlowEditor.d.ts +31 -0
- package/lib/client/InstanceList.d.ts +24 -0
- package/lib/client/NewInstanceDialog.d.ts +19 -0
- package/lib/client/PreviewPanel.d.ts +13 -0
- package/lib/client/RunView.d.ts +79 -0
- package/lib/client/StepChatPanel.d.ts +34 -0
- package/lib/client/TreeNav.d.ts +27 -0
- package/lib/client/UnifiedTimeline.d.ts +11 -0
- package/lib/client/WorkflowButton.d.ts +11 -0
- package/lib/client/WorkflowList.d.ts +18 -0
- package/lib/client/WorkflowOverlay.d.ts +6 -0
- package/lib/client/chat/AssistantMarkdown.d.ts +22 -0
- package/lib/client/chat/CompactionItem.d.ts +24 -0
- package/lib/client/chat/ContextBody.d.ts +136 -0
- package/lib/client/chat/ContextInjectionRow.d.ts +25 -0
- package/lib/client/chat/GenericCommandCard.d.ts +10 -0
- package/lib/client/chat/MessageIconActions.d.ts +41 -0
- package/lib/client/chat/MessageItem.d.ts +65 -0
- package/lib/client/chat/ReasoningRow.d.ts +13 -0
- package/lib/client/chat/TurnTailNodeView.d.ts +29 -0
- package/lib/client/chat/UserMessageRow.d.ts +18 -0
- package/lib/client/chat/attachment/ImageLightbox.d.ts +26 -0
- package/lib/client/chat/attachment/MessageImage.d.ts +56 -0
- package/lib/client/chat/attachment/image-attachment.d.ts +41 -0
- package/lib/client/chat/attachment/image-labels.d.ts +21 -0
- package/lib/client/chat/message-chrome.d.ts +51 -0
- package/lib/client/chat/reference/ReferenceIcon.d.ts +20 -0
- package/lib/client/chat/turn-assistant.d.ts +12 -0
- package/lib/client/chat/turn-metrics.d.ts +42 -0
- package/lib/client/chat/use-calendar-day.d.ts +5 -0
- package/lib/client/chat/use-throttled-visual-update.d.ts +7 -0
- package/lib/client/chat-flow.d.ts +110 -0
- package/lib/client/composer-selects.d.ts +17 -0
- package/lib/client/dag-editor-model.d.ts +141 -0
- package/lib/client/describe-error.d.ts +9 -0
- package/lib/client/index.d.ts +6 -0
- package/lib/client/locales.d.ts +777 -0
- package/lib/client/model-faces.d.ts +156 -0
- package/lib/client/open-discussion.d.ts +24 -0
- package/lib/client/panel-model.d.ts +34 -0
- package/lib/client/remote.d.ts +34 -0
- package/lib/client/run-view-model.d.ts +304 -0
- package/lib/client/sandore-save.d.ts +41 -0
- package/lib/client/sandore-sse.d.ts +15 -0
- package/lib/client/step-chat-retry.d.ts +44 -0
- package/lib/client/tool/GenericToolCard.d.ts +28 -0
- package/lib/client/tool/ToolRow.d.ts +95 -0
- package/lib/client/tool/diff-card-model.d.ts +63 -0
- package/lib/client/tool/read-card-model.d.ts +67 -0
- package/lib/client/tool/search-card-model.d.ts +94 -0
- package/lib/client/tool/terminal-card-model.d.ts +86 -0
- package/lib/client/tool/tool-call-model.d.ts +74 -0
- package/lib/client/tool/web-card-model.d.ts +44 -0
- package/lib/client/use-focus-refresh.d.ts +1 -0
- package/lib/client/workflow-face.d.ts +68 -0
- package/lib/client/workflow-store.d.ts +80 -0
- package/lib/client/workspace-path.d.ts +15 -0
- package/lib/client.js +38389 -0
- package/lib/index.js +8854 -0
- package/lib/microflow/branch-evaluator.d.ts +290 -0
- package/lib/microflow/concurrency-limiter.d.ts +39 -0
- package/lib/microflow/errors.d.ts +39 -0
- package/lib/microflow/file-utils.d.ts +210 -0
- package/lib/microflow/finalize-manager.d.ts +414 -0
- package/lib/microflow/fork-session.d.ts +151 -0
- package/lib/microflow/index.d.ts +17 -0
- package/lib/microflow/internal.d.ts +56 -0
- package/lib/microflow/loop-manager.d.ts +127 -0
- package/lib/microflow/rules-resolver.d.ts +28 -0
- package/lib/microflow/stage-executor.d.ts +362 -0
- package/lib/microflow/step-navigator.d.ts +108 -0
- package/lib/microflow/step-runner.d.ts +190 -0
- package/lib/microflow/subagents.d.ts +380 -0
- package/lib/tool/index.d.ts +65 -0
- package/lib/typert.host.d.ts +16 -0
- package/lib/typert.host.js +25 -0
- package/lib/typert.remote-client.d.ts +114 -0
- package/lib/typert.remote-client.js +399 -0
- package/lib/workflow/ask-tool.d.ts +78 -0
- package/lib/workflow/dag-navigator.d.ts +136 -0
- package/lib/workflow/domain.d.ts +304 -0
- package/lib/workflow/engine-surface.d.ts +70 -0
- package/lib/workflow/errors.d.ts +13 -0
- package/lib/workflow/host-agent.d.ts +53 -0
- package/lib/workflow/index.d.ts +23 -0
- package/lib/workflow/interaction-manager.d.ts +170 -0
- package/lib/workflow/lifecycle-manager.d.ts +111 -0
- package/lib/workflow/persistence.d.ts +35 -0
- package/lib/workflow/plugin.d.ts +27 -0
- package/lib/workflow/reactive-state.d.ts +27 -0
- package/lib/workflow/recovery-manager.d.ts +158 -0
- package/lib/workflow/remote.d.ts +139 -0
- package/lib/workflow/schema.d.ts +1917 -0
- package/lib/workflow/seam.d.ts +254 -0
- package/lib/workflow/shell.d.ts +127 -0
- package/lib/workflow/sse.d.ts +16 -0
- package/lib/workflow/typert/typert.host.d.ts +16 -0
- package/lib/workflow/typert/typert.remote-client.d.ts +114 -0
- package/lib/workflow/types.d.ts +187 -0
- package/lib/workflow/wire.d.ts +256 -0
- package/lib/workflow/workflow-engine.d.ts +373 -0
- package/lib/workflow/yaml-error.d.ts +22 -0
- package/lib/workflow/yaml-parser.d.ts +23 -0
- package/package.json +140 -0
- package/packages/client/CommandEditor.tsx +73 -0
- package/packages/client/DagEditor.module.css +711 -0
- package/packages/client/DagEditor.tsx +1203 -0
- package/packages/client/DefinitionDetail.module.css +110 -0
- package/packages/client/DefinitionDetail.tsx +126 -0
- package/packages/client/DefinitionList.tsx +173 -0
- package/packages/client/DiscussionInput.tsx +763 -0
- package/packages/client/DragHandle.tsx +92 -0
- package/packages/client/EditorPane.tsx +70 -0
- package/packages/client/FlowEditor.tsx +227 -0
- package/packages/client/InstanceList.tsx +250 -0
- package/packages/client/NewInstanceDialog.module.css +244 -0
- package/packages/client/NewInstanceDialog.tsx +478 -0
- package/packages/client/PreviewPanel.tsx +55 -0
- package/packages/client/RunView.module.css +246 -0
- package/packages/client/RunView.tsx +314 -0
- package/packages/client/StepChatPanel.tsx +486 -0
- package/packages/client/TreeNav.tsx +294 -0
- package/packages/client/UnifiedTimeline.tsx +484 -0
- package/packages/client/WorkflowButton.module.css +72 -0
- package/packages/client/WorkflowButton.tsx +50 -0
- package/packages/client/WorkflowList.tsx +158 -0
- package/packages/client/WorkflowOverlay.module.css +390 -0
- package/packages/client/WorkflowOverlay.tsx +136 -0
- package/packages/client/WorkflowPanel.module.css +247 -0
- package/packages/client/chat/AssistantMarkdown.module.css +38 -0
- package/packages/client/chat/AssistantMarkdown.tsx +120 -0
- package/packages/client/chat/ChatView.module.css +198 -0
- package/packages/client/chat/CompactionItem.tsx +85 -0
- package/packages/client/chat/ContextBody.module.css +162 -0
- package/packages/client/chat/ContextBody.tsx +598 -0
- package/packages/client/chat/ContextInjectionRow.module.css +63 -0
- package/packages/client/chat/ContextInjectionRow.tsx +78 -0
- package/packages/client/chat/GenericCommandCard.module.css +87 -0
- package/packages/client/chat/GenericCommandCard.tsx +76 -0
- package/packages/client/chat/MessageIconActions.module.css +84 -0
- package/packages/client/chat/MessageIconActions.tsx +147 -0
- package/packages/client/chat/MessageItem.module.css +293 -0
- package/packages/client/chat/MessageItem.tsx +384 -0
- package/packages/client/chat/ReasoningRow.module.css +82 -0
- package/packages/client/chat/ReasoningRow.tsx +70 -0
- package/packages/client/chat/TurnTailNodeView.module.css +10 -0
- package/packages/client/chat/TurnTailNodeView.tsx +63 -0
- package/packages/client/chat/UserMessageRow.module.css +75 -0
- package/packages/client/chat/UserMessageRow.tsx +92 -0
- package/packages/client/chat/accessibility.module.css +9 -0
- package/packages/client/chat/attachment/ImageLightbox.module.css +45 -0
- package/packages/client/chat/attachment/ImageLightbox.tsx +70 -0
- package/packages/client/chat/attachment/MessageImage.module.css +70 -0
- package/packages/client/chat/attachment/MessageImage.tsx +136 -0
- package/packages/client/chat/attachment/image-attachment.ts +98 -0
- package/packages/client/chat/attachment/image-labels.ts +34 -0
- package/packages/client/chat/message-chrome.ts +96 -0
- package/packages/client/chat/reference/ReferenceIcon.tsx +40 -0
- package/packages/client/chat/turn-assistant.ts +15 -0
- package/packages/client/chat/turn-metrics.ts +102 -0
- package/packages/client/chat/use-calendar-day.ts +27 -0
- package/packages/client/chat/use-throttled-visual-update.ts +44 -0
- package/packages/client/chat-flow.spec.ts +357 -0
- package/packages/client/chat-flow.ts +278 -0
- package/packages/client/composer-selects.module.css +376 -0
- package/packages/client/composer-selects.tsx +531 -0
- package/packages/client/dag-editor-model.spec.ts +173 -0
- package/packages/client/dag-editor-model.ts +359 -0
- package/packages/client/describe-error.spec.ts +18 -0
- package/packages/client/describe-error.ts +12 -0
- package/packages/client/index.ts +144 -0
- package/packages/client/input.module.css +854 -0
- package/packages/client/is-conditional-check.spec.ts +34 -0
- package/packages/client/locales.ts +789 -0
- package/packages/client/model-faces.ts +225 -0
- package/packages/client/open-discussion.spec.ts +39 -0
- package/packages/client/open-discussion.ts +32 -0
- package/packages/client/panel-model.spec.ts +152 -0
- package/packages/client/panel-model.ts +72 -0
- package/packages/client/preview.module.css +95 -0
- package/packages/client/react-dom.d.ts +11 -0
- package/packages/client/reactflow-theme.css +91 -0
- package/packages/client/remote.spec.ts +41 -0
- package/packages/client/remote.ts +46 -0
- package/packages/client/run-view-model.spec.ts +641 -0
- package/packages/client/run-view-model.ts +636 -0
- package/packages/client/sandore-save.spec.ts +146 -0
- package/packages/client/sandore-save.ts +97 -0
- package/packages/client/sandore-sse.ts +59 -0
- package/packages/client/step-chat-retry.spec.ts +70 -0
- package/packages/client/step-chat-retry.ts +65 -0
- package/packages/client/timeline.module.css +503 -0
- package/packages/client/tool/GenericToolCard.tsx +99 -0
- package/packages/client/tool/ToolRow.module.css +308 -0
- package/packages/client/tool/ToolRow.tsx +328 -0
- package/packages/client/tool/diff-card-model.ts +103 -0
- package/packages/client/tool/read-card-model.ts +86 -0
- package/packages/client/tool/search-card-model.ts +166 -0
- package/packages/client/tool/terminal-card-model.ts +225 -0
- package/packages/client/tool/tool-call-model.ts +267 -0
- package/packages/client/tool/web-card-model.ts +80 -0
- package/packages/client/tree-nav.module.css +282 -0
- package/packages/client/use-focus-refresh.ts +23 -0
- package/packages/client/workflow-face.ts +72 -0
- package/packages/client/workflow-store.spec.ts +49 -0
- package/packages/client/workflow-store.ts +161 -0
- package/packages/client/workspace-path.ts +27 -0
- package/packages/css-modules.d.ts +6 -0
- package/packages/microflow/branch-evaluator.spec.ts +745 -0
- package/packages/microflow/branch-evaluator.ts +1037 -0
- package/packages/microflow/concurrency-limiter.ts +70 -0
- package/packages/microflow/errors.ts +64 -0
- package/packages/microflow/file-utils.spec.ts +604 -0
- package/packages/microflow/file-utils.ts +521 -0
- package/packages/microflow/finalize-manager.spec.ts +1977 -0
- package/packages/microflow/finalize-manager.ts +1464 -0
- package/packages/microflow/fork-session.spec.ts +184 -0
- package/packages/microflow/fork-session.ts +316 -0
- package/packages/microflow/index.ts +17 -0
- package/packages/microflow/internal.ts +166 -0
- package/packages/microflow/loop-manager.spec.ts +294 -0
- package/packages/microflow/loop-manager.ts +255 -0
- package/packages/microflow/rules-resolver.spec.ts +147 -0
- package/packages/microflow/rules-resolver.ts +58 -0
- package/packages/microflow/stage-executor.spec.ts +1577 -0
- package/packages/microflow/stage-executor.ts +1478 -0
- package/packages/microflow/step-navigator.spec.ts +301 -0
- package/packages/microflow/step-navigator.ts +300 -0
- package/packages/microflow/step-runner.spec.ts +1132 -0
- package/packages/microflow/step-runner.ts +752 -0
- package/packages/microflow/subagents.spec.ts +215 -0
- package/packages/microflow/subagents.ts +422 -0
- package/packages/tests/fixtures/test-workflow.yaml +128 -0
- package/packages/tests/mocks/agents.ts +206 -0
- package/packages/tests/mocks/llm.ts +46 -0
- package/packages/tests/mocks/session-title.ts +31 -0
- package/packages/tests/mocks/sessions.ts +131 -0
- package/packages/tests/mocks/shell.ts +60 -0
- package/packages/tests/mocks/storage-domain.ts +101 -0
- package/packages/tests/mocks/subagents.ts +197 -0
- package/packages/tests/mocks/subprocess.ts +59 -0
- package/packages/tests/mocks/user-questions.ts +33 -0
- package/packages/tests/mocks/workspace.ts +52 -0
- package/packages/tool/index.spec.ts +287 -0
- package/packages/tool/index.ts +348 -0
- package/packages/workflow/ask-tool.ts +173 -0
- package/packages/workflow/dag-navigator.spec.ts +236 -0
- package/packages/workflow/dag-navigator.ts +425 -0
- package/packages/workflow/domain.ts +26 -0
- package/packages/workflow/engine-surface.ts +71 -0
- package/packages/workflow/errors.ts +13 -0
- package/packages/workflow/host-agent.spec.ts +92 -0
- package/packages/workflow/host-agent.ts +62 -0
- package/packages/workflow/index.ts +25 -0
- package/packages/workflow/interaction-manager.spec.ts +390 -0
- package/packages/workflow/interaction-manager.ts +397 -0
- package/packages/workflow/lifecycle-manager.spec.ts +683 -0
- package/packages/workflow/lifecycle-manager.ts +288 -0
- package/packages/workflow/persistence.spec.ts +109 -0
- package/packages/workflow/persistence.ts +64 -0
- package/packages/workflow/plugin.ts +39 -0
- package/packages/workflow/reactive-state.spec.ts +69 -0
- package/packages/workflow/reactive-state.ts +52 -0
- package/packages/workflow/recovery-manager.spec.ts +606 -0
- package/packages/workflow/recovery-manager.ts +471 -0
- package/packages/workflow/remote.spec.ts +1045 -0
- package/packages/workflow/remote.ts +479 -0
- package/packages/workflow/schema.spec.ts +303 -0
- package/packages/workflow/schema.ts +562 -0
- package/packages/workflow/seam.ts +293 -0
- package/packages/workflow/shell.ts +142 -0
- package/packages/workflow/sse.ts +110 -0
- package/packages/workflow/typert/typert.host.d.ts +16 -0
- package/packages/workflow/typert/typert.host.js +25 -0
- package/packages/workflow/typert/typert.remote-client.d.ts +114 -0
- package/packages/workflow/typert/typert.remote-client.js +399 -0
- package/packages/workflow/types.ts +258 -0
- package/packages/workflow/wire.ts +267 -0
- package/packages/workflow/workflow-engine-e2e.spec.ts +262 -0
- package/packages/workflow/workflow-engine-real-e2e.spec.ts +922 -0
- package/packages/workflow/workflow-engine.spec.ts +4389 -0
- package/packages/workflow/workflow-engine.ts +2133 -0
- package/packages/workflow/yaml-error.ts +29 -0
- package/packages/workflow/yaml-parser.spec.ts +757 -0
- package/packages/workflow/yaml-parser.ts +287 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* composer 选择器的运行时注入面(模型目录 / 会话权限投影 / 命令执行)。
|
|
3
|
+
*
|
|
4
|
+
* 编译期不依赖 DSH 的 ui-model-selection / ui-permission-presets 包(沙盒仓库
|
|
5
|
+
* 未链接它们),这里按 harness 的 wire 形状自声明最小类型;运行时复用 dev 实例
|
|
6
|
+
* 已加载的 `ctx.modelDirectories` 服务、会话 projections 与 `remote.commands`,
|
|
7
|
+
* 行为与 DSH 主 session 的模型/权限选择完全一致(同一数据源、同一 RPC)。
|
|
8
|
+
* @module @deepseek-ai/dsh-client-ui-sandore/src/client/model-faces
|
|
9
|
+
*/
|
|
10
|
+
/** 可订阅快照面(对齐 runtime 的 `ObservableSnapshot`)。 */
|
|
11
|
+
export interface ObservableFace<T> {
|
|
12
|
+
getSnapshot(): T;
|
|
13
|
+
subscribe(fn: () => void): () => void;
|
|
14
|
+
}
|
|
15
|
+
/** 一个会话的完整模型选择。 */
|
|
16
|
+
export interface ModelSelection {
|
|
17
|
+
/** 注册的 provider 路由。 */
|
|
18
|
+
provider: string;
|
|
19
|
+
/** provider 属下的模型 id。 */
|
|
20
|
+
model: string;
|
|
21
|
+
/** 推理等级(缺省保留 provider/adapter 默认)。 */
|
|
22
|
+
reasoningEffort?: string;
|
|
23
|
+
}
|
|
24
|
+
/** adapter 属下的一个推理等级。 */
|
|
25
|
+
export interface ModelReasoningEffort {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
}
|
|
30
|
+
/** 单个精确模型路由的可选推理元数据。 */
|
|
31
|
+
export interface ModelReasoning {
|
|
32
|
+
efforts: ModelReasoningEffort[];
|
|
33
|
+
defaultEffort?: string;
|
|
34
|
+
}
|
|
35
|
+
/** provider 组内展示的一个模型。 */
|
|
36
|
+
export interface ModelCatalogModel {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
reasoning?: ModelReasoning;
|
|
41
|
+
}
|
|
42
|
+
/** 一个成功广告了模型的 provider 组。 */
|
|
43
|
+
export interface ModelProviderGroup {
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
models: ModelCatalogModel[];
|
|
47
|
+
}
|
|
48
|
+
/** 目录加载失败的 provider。 */
|
|
49
|
+
export interface ModelCatalogFailure {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
message: string;
|
|
53
|
+
}
|
|
54
|
+
/** 模型目录快照(对齐 ui-model-selection 的 `ModelDirectoryState`)。 */
|
|
55
|
+
export interface ModelDirectoryState {
|
|
56
|
+
current: ModelSelection | null;
|
|
57
|
+
routable: boolean | null;
|
|
58
|
+
groups: readonly ModelProviderGroup[];
|
|
59
|
+
failures: readonly ModelCatalogFailure[];
|
|
60
|
+
status: 'idle' | 'loading' | 'ready' | 'selecting' | 'error';
|
|
61
|
+
error: string | null;
|
|
62
|
+
}
|
|
63
|
+
/** 单个会话的共享模型目录控制面(对齐 `ModelDirectory`)。 */
|
|
64
|
+
export interface ModelDirectoryFace {
|
|
65
|
+
readonly store: ObservableFace<ModelDirectoryState>;
|
|
66
|
+
load(): Promise<unknown>;
|
|
67
|
+
select(selection: ModelSelection): Promise<void>;
|
|
68
|
+
dispose(): void;
|
|
69
|
+
}
|
|
70
|
+
/** `connection.api.sessions` 的最小模型 RPC 面(对齐 harness apiproxy sessions.ts)。 */
|
|
71
|
+
export interface SessionModelsWire {
|
|
72
|
+
current: ModelSelection;
|
|
73
|
+
routable: boolean;
|
|
74
|
+
groups: ModelProviderGroup[];
|
|
75
|
+
failures: ModelCatalogFailure[];
|
|
76
|
+
}
|
|
77
|
+
/** `connection.api.sessions.models/selectModel` 的最小面。 */
|
|
78
|
+
export interface SessionModelsApi {
|
|
79
|
+
models(input: {
|
|
80
|
+
sessionId: string;
|
|
81
|
+
}): Promise<{
|
|
82
|
+
result: {
|
|
83
|
+
ok: boolean;
|
|
84
|
+
value: SessionModelsWire;
|
|
85
|
+
error?: {
|
|
86
|
+
code: string;
|
|
87
|
+
message: string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
}>;
|
|
91
|
+
selectModel(input: {
|
|
92
|
+
sessionId: string;
|
|
93
|
+
provider: string;
|
|
94
|
+
model: string;
|
|
95
|
+
reasoningEffort?: string;
|
|
96
|
+
}): Promise<{
|
|
97
|
+
result: {
|
|
98
|
+
ok: boolean;
|
|
99
|
+
value: {
|
|
100
|
+
selected: ModelSelection;
|
|
101
|
+
};
|
|
102
|
+
error?: {
|
|
103
|
+
code: string;
|
|
104
|
+
message: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
}>;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* 轻量每会话模型目录(对齐 DSH ui-model-selection 的 `ModelDirectory`):
|
|
111
|
+
* 直接走 `connection.api.sessions.models/selectModel`(同一 RPC、同一行为),
|
|
112
|
+
* 不依赖 DSH 会话 scope(sandore 实例会话未必被 DSH 会话列表 staged)。
|
|
113
|
+
*/
|
|
114
|
+
export declare class SandoreModelDirectory implements ModelDirectoryFace {
|
|
115
|
+
private readonly api;
|
|
116
|
+
private readonly sessionId;
|
|
117
|
+
readonly store: ObservableFace<ModelDirectoryState>;
|
|
118
|
+
private state;
|
|
119
|
+
private readonly listeners;
|
|
120
|
+
private generation;
|
|
121
|
+
private disposed;
|
|
122
|
+
constructor(api: SessionModelsApi, sessionId: string);
|
|
123
|
+
/** 刷新目录(失败保留上次好数据;打开菜单时调用,行为同 DSH)。 */
|
|
124
|
+
load(): Promise<unknown>;
|
|
125
|
+
/** 选择完整 provider/model/推理等级(提交 `selectModel` 绑定会话)。 */
|
|
126
|
+
select(selection: ModelSelection): Promise<void>;
|
|
127
|
+
/** 会话 scope 拆除时调用(沙盒目录随组件卸载回收)。 */
|
|
128
|
+
dispose(): void;
|
|
129
|
+
private update;
|
|
130
|
+
}
|
|
131
|
+
/** 权限模式选项。 */
|
|
132
|
+
export interface PermissionOption {
|
|
133
|
+
value: string;
|
|
134
|
+
name: string;
|
|
135
|
+
description?: string;
|
|
136
|
+
}
|
|
137
|
+
/** 权限选择投影值(`projections.permissions`)。 */
|
|
138
|
+
export interface PermissionSelectValue {
|
|
139
|
+
options: PermissionOption[];
|
|
140
|
+
currentValue: string;
|
|
141
|
+
}
|
|
142
|
+
/** `remote.commands.execute` 的最小返回面。 */
|
|
143
|
+
export interface CommandExecuteResult {
|
|
144
|
+
ok: boolean;
|
|
145
|
+
value?: unknown;
|
|
146
|
+
error?: {
|
|
147
|
+
code: string;
|
|
148
|
+
message: string;
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* 解析 `/permission`(无参)命令报告文本:
|
|
153
|
+
* `current preset workspace-write (available: workspace-write, danger-full-access)`。
|
|
154
|
+
* 权限投影缺失时作为回退数据源(与 DSH 主 session 的权限选择同一命令路径)。
|
|
155
|
+
*/
|
|
156
|
+
export declare function parsePermissionReport(text: string): PermissionSelectValue | undefined;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RunView「打开讨论」按钮的接线 adapter(无 React 依赖,可单测)。
|
|
3
|
+
*
|
|
4
|
+
* `createOpenDiscussion` 把宿主 `ctx.sessions` 的打开面接成 RunView 的
|
|
5
|
+
* `openDiscussion` 回调:调用时经 `sessions.open(instanceId)` 跳转到宿主
|
|
6
|
+
* Session chat 视图(内含 `sandore-step` 讨论节点)。宿主 Session id ==
|
|
7
|
+
* instanceId,故 `instanceId` 可安全收窄为 `SessionId`(brand 仅编译期标记,
|
|
8
|
+
* 运行时就是同一字符串,无任何转换开销)。
|
|
9
|
+
* @module @deepseek-ai/dsh-client-ui-sandore/src/client/open-discussion
|
|
10
|
+
*/
|
|
11
|
+
import type { SessionId } from '@deepseek-ai/dsh-client-runtime/client';
|
|
12
|
+
/** `createOpenDiscussion` 所需的最小 sessions 打开面(`ctx.sessions` 结构满足)。 */
|
|
13
|
+
export interface SessionsOpenFace {
|
|
14
|
+
open(id: SessionId): void;
|
|
15
|
+
}
|
|
16
|
+
/** RunView 的「打开讨论」回调签名(无入参,点击后跳宿主会话)。 */
|
|
17
|
+
export type OpenDiscussion = () => void;
|
|
18
|
+
/**
|
|
19
|
+
* 构造「打开讨论」回调:调用时经 `sessions.open(instanceId)` 跳宿主会话。
|
|
20
|
+
* @param sessions - `ctx.sessions` 的最小打开面。
|
|
21
|
+
* @param instanceId - 目标工作流实例 id(宿主 Session id == instanceId)。
|
|
22
|
+
* @returns 供 RunView `openDiscussion` prop 直接使用的回调。
|
|
23
|
+
*/
|
|
24
|
+
export declare function createOpenDiscussion(sessions: SessionsOpenFace, instanceId: string): OpenDiscussion;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WorkflowPanel 列表派生纯逻辑(无 React 依赖,可单测)。
|
|
3
|
+
*
|
|
4
|
+
* 从 InstanceList / DefinitionList 抽出的共享纯函数:按工作区分组(`deriveGroups`)、
|
|
5
|
+
* 关键词过滤(`matchesInstanceQuery` / `matchesDefinitionQuery`)与时间戳格式化
|
|
6
|
+
* (`formatTimestamp`)。这些函数不触碰组件状态与 RPC,输入输出均为普通数据,
|
|
7
|
+
* 故独立成模块便于单元测试与复用。错误消息归一化见 `describe-error.ts`。
|
|
8
|
+
* @module @deepseek-ai/dsh-client-ui-sandore/src/client/panel-model
|
|
9
|
+
*/
|
|
10
|
+
import type { WorkspaceView } from '@deepseek-ai/dsh-client-runtime/client';
|
|
11
|
+
import type { InstanceSummary, WorkflowDefinitionEntry } from 'dsh-sandore/remote';
|
|
12
|
+
/** 未分组桶的稳定键(空串,对齐 DSH 的 UNGROUPED_KEY 惯例)。 */
|
|
13
|
+
export declare const UNGROUPED_KEY = "";
|
|
14
|
+
/** 一个工作区分组(含成员实例)。 */
|
|
15
|
+
export interface InstanceGroup {
|
|
16
|
+
readonly key: string;
|
|
17
|
+
readonly title: string;
|
|
18
|
+
readonly instances: readonly InstanceSummary[];
|
|
19
|
+
}
|
|
20
|
+
/** 把 ISO 时间戳格式化为 `YYYY-MM-DD HH:mm`(非法值原样返回)。 */
|
|
21
|
+
export declare function formatTimestamp(value: string): string;
|
|
22
|
+
/** 关键词过滤实例:大小写不敏感匹配 originalInput 或 workflowId。 */
|
|
23
|
+
export declare function matchesInstanceQuery(instance: InstanceSummary, query: string): boolean;
|
|
24
|
+
/** 关键词过滤定义:大小写不敏感匹配 name 或 id。 */
|
|
25
|
+
export declare function matchesDefinitionQuery(definition: WorkflowDefinitionEntry, query: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* 按工作区分组派生:每个工作区一个组(成员命中 `sessionIds`),未命中任何工作区的
|
|
28
|
+
* 实例归「未分组」桶(置末)。空工作区不渲染组头。
|
|
29
|
+
* @param instances - 实例摘要列表。
|
|
30
|
+
* @param workspaces - 工作区成员表(Host 稳定顺序)。
|
|
31
|
+
* @param ungroupedLabel - 未分组桶的本地化标题。
|
|
32
|
+
* @returns 有序分组列表。
|
|
33
|
+
*/
|
|
34
|
+
export declare function deriveGroups(instances: readonly InstanceSummary[], workspaces: readonly WorkspaceView[], ungroupedLabel: string): readonly InstanceGroup[];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sandore 远程客户端薄封装。
|
|
3
|
+
*
|
|
4
|
+
* 从 `dsh-sandore/remote` 默认导入生成的
|
|
5
|
+
* `TypertRemoteContribution`(供 `ctx.remote.$mount` 挂载),并暴露
|
|
6
|
+
* `RemoteResult` 解包薄封装:`ok:true` 取 `value`,`ok:false` 抛
|
|
7
|
+
* `SandoreRemoteError`(`RemoteFailure` 的 `Error` 子类包装,保留 code),
|
|
8
|
+
* 供组件层统一解包、不静默吞错。
|
|
9
|
+
* @module @deepseek-ai/dsh-client-ui-sandore/client/remote
|
|
10
|
+
*/
|
|
11
|
+
import type { RemoteFailure, RemoteResult } from '@deepseek-ai/dsh-typert-protocol';
|
|
12
|
+
import sandoreRemote from 'dsh-sandore/remote';
|
|
13
|
+
export { sandoreRemote };
|
|
14
|
+
export type { PingResponse } from 'dsh-sandore/remote';
|
|
15
|
+
/**
|
|
16
|
+
* 一次 sandore RPC 调用失败(`RemoteFailure` 的 `Error` 子类包装)。
|
|
17
|
+
*
|
|
18
|
+
* 保留 `code` 与 `details`,使失败分支可被统一捕获并按 code 路由,
|
|
19
|
+
* 而非静默吞掉或抛出裸对象。
|
|
20
|
+
*/
|
|
21
|
+
export declare class SandoreRemoteError extends Error {
|
|
22
|
+
/** Host 侧报错的稳定机器码。 */
|
|
23
|
+
readonly code: string;
|
|
24
|
+
/** Host 侧附加的错误详情(JSON 对象)。 */
|
|
25
|
+
readonly details: object;
|
|
26
|
+
constructor(failure: RemoteFailure);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 解包 `RemoteResult`:`ok:true` 取 `value`,`ok:false` 抛 `SandoreRemoteError`。
|
|
30
|
+
*
|
|
31
|
+
* 载波层故障已折叠进 `error` 分支,消费者无需 try/catch 恢复;仅装配性
|
|
32
|
+
* 故障(arity 不匹配、方法未挂载、缺 Context binder)仍 reject。
|
|
33
|
+
*/
|
|
34
|
+
export declare function unwrap<T>(result: RemoteResult<T>): T;
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RunView 的可测纯逻辑(无 React 依赖)。
|
|
3
|
+
*
|
|
4
|
+
* 从 `dsh-sandore/schema`(浏览器安全子路径)导入
|
|
5
|
+
* `WorkflowTaskState` 等 wire 类型,并以其派生 `DagRunStatus`/`StepStatus`/
|
|
6
|
+
* `ExecutedStep`/`StageInfo`(避免从包根 `types.ts` 导入带出 `dsh-llm` 依赖)。
|
|
7
|
+
* 此处提供:7 态 → StateDotState 穷尽映射、运行中/终态判定(驱动 5s 轮询)、
|
|
8
|
+
* pending 交互分类、retry message 校验与 `RetryMode` 词汇。
|
|
9
|
+
* @module @deepseek-ai/dsh-client-ui-sandore/src/client/run-view-model
|
|
10
|
+
*/
|
|
11
|
+
import type { StateDotState } from '@deepseek-ai/dsh-client-ui-primitives';
|
|
12
|
+
import type { PendingPermissionEntry, PendingQuestionEntry, WorkflowTaskState } from 'dsh-sandore/schema';
|
|
13
|
+
import type { RevertBoundaryOption } from 'dsh-sandore/types';
|
|
14
|
+
/** 实例生命周期状态(从 `WorkflowTaskState` 派生,避免 dsh-llm 依赖)。 */
|
|
15
|
+
export type DagRunStatus = WorkflowTaskState['status'];
|
|
16
|
+
/** 单个 Step/Stage 执行状态(从 `WorkflowTaskState` 派生)。 */
|
|
17
|
+
export type StepStatus = WorkflowTaskState['executedSteps'][number]['status'];
|
|
18
|
+
/** 已执行 Step 的快照(从 `WorkflowTaskState` 派生)。 */
|
|
19
|
+
export type ExecutedStep = WorkflowTaskState['executedSteps'][number];
|
|
20
|
+
/** Stage 状态快照(从 `WorkflowTaskState` 派生)。 */
|
|
21
|
+
export type StageInfo = WorkflowTaskState['stageInfos'][number];
|
|
22
|
+
/** 重试模式(对齐 `retryStep` 入参 `mode` 的 zod 枚举)。 */
|
|
23
|
+
export type RetryMode = 'continue' | 'revert' | 'fork';
|
|
24
|
+
/** revert 回退点候选(对齐 `listRevertBoundaries` 返回的 `RevertBoundaryOption`)。 */
|
|
25
|
+
export type { RevertBoundaryOption };
|
|
26
|
+
/** replyQuestion 单个问题的回答(对齐 Host 的 `AskUserQuestionAnswerItem`)。 */
|
|
27
|
+
export interface AnswerItem {
|
|
28
|
+
readonly id: string;
|
|
29
|
+
readonly selected: readonly string[];
|
|
30
|
+
readonly custom?: string;
|
|
31
|
+
}
|
|
32
|
+
/** 三种重试模式(供重试表单下拉/选项渲染)。 */
|
|
33
|
+
export declare const RETRY_MODES: readonly RetryMode[];
|
|
34
|
+
/**
|
|
35
|
+
* StepStatus 7 态 → StateDotState 4 态穷尽映射:
|
|
36
|
+
* `completed→done`、`failed→error`、`running→ongoing`,其余(等待用户注意的
|
|
37
|
+
* blocked/ready/interacting/paused)折入 `warning`。
|
|
38
|
+
* @param status - Step 执行状态。
|
|
39
|
+
* @returns 四态语义点。
|
|
40
|
+
*/
|
|
41
|
+
export declare function stepDotState(status: StepStatus): StateDotState;
|
|
42
|
+
/**
|
|
43
|
+
* DagRunStatus 7 态 → StateDotState 4 态穷尽映射:
|
|
44
|
+
* `completed→done`、`failed→error`、`running→ongoing`,其余(pending/interacting/
|
|
45
|
+
* aborted/paused)折入 `warning`。
|
|
46
|
+
* @param status - 实例生命周期状态。
|
|
47
|
+
* @returns 四态语义点。
|
|
48
|
+
*/
|
|
49
|
+
export declare function runDotState(status: DagRunStatus): StateDotState;
|
|
50
|
+
/**
|
|
51
|
+
* 实例是否处于「运行中」状态(`running`/`interacting`),决定是否启动 5s 轮询。
|
|
52
|
+
* @param status - 实例生命周期状态。
|
|
53
|
+
* @returns 运行中(需轮询)为 true。
|
|
54
|
+
*/
|
|
55
|
+
export declare function isRunningStatus(status: DagRunStatus): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* 实例是否已进入终态(`completed`/`failed`/`aborted`),终态停止轮询。
|
|
58
|
+
* @param status - 实例生命周期状态。
|
|
59
|
+
* @returns 终态为 true。
|
|
60
|
+
*/
|
|
61
|
+
export declare function isTerminalStatus(status: DagRunStatus): boolean;
|
|
62
|
+
/** pending 交互分类结果。 */
|
|
63
|
+
export interface PendingInteractionPartition {
|
|
64
|
+
/** 待答问题条目。 */
|
|
65
|
+
readonly questions: readonly PendingQuestionEntry[];
|
|
66
|
+
/** 待批权限条目。 */
|
|
67
|
+
readonly permissions: readonly PendingPermissionEntry[];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* 按 `kind` 把 `pendingInteractions` 分为问答与权限两组。
|
|
71
|
+
*
|
|
72
|
+
* 探索修正(2026-08):仅取 `status === 'pending'` 的条目——后端已只持久化 pending,
|
|
73
|
+
* 此处过滤是防御旧快照(含 replied/rejected 全量历史时避免讨论页复弹接管面板)。
|
|
74
|
+
* @param interactions - 实例的 pending 交互列表。
|
|
75
|
+
* @returns 问答与权限两个分组。
|
|
76
|
+
*/
|
|
77
|
+
export declare function partitionInteractions(interactions: readonly (PendingQuestionEntry | PendingPermissionEntry)[]): PendingInteractionPartition;
|
|
78
|
+
/**
|
|
79
|
+
* 判断字符串是否为空或仅含空白(用于 retry message 等必填文本校验)。
|
|
80
|
+
* @param value - 待校验文本。
|
|
81
|
+
* @returns 空白为 true。
|
|
82
|
+
*/
|
|
83
|
+
export declare function isBlank(value: string): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Step 对外交互标识:定义 `stepId` 优先,缺省回退唯一执行 `id`。
|
|
86
|
+
* 与引擎侧 `findStep`(先 `stepId` 后 `id` 反查)保持一致,供
|
|
87
|
+
* `pauseStep`/`resumeStep`/`retryStep` 入参使用。
|
|
88
|
+
* @param step - 含 `id` 与可选 `stepId` 的 Step 快照。
|
|
89
|
+
* @returns 可反查该 Step 的稳定标识。
|
|
90
|
+
*/
|
|
91
|
+
export declare function stepIdOf(step: {
|
|
92
|
+
readonly id: string;
|
|
93
|
+
readonly stepId?: string | undefined;
|
|
94
|
+
}): string;
|
|
95
|
+
/**
|
|
96
|
+
* 判定 Step 是否为可续接的子代理 Step(agent/skill/mcp/prompt),非 shell 合成 session。
|
|
97
|
+
*
|
|
98
|
+
* 对齐引擎侧 `recovery-manager.ts` 的 `isSubagentStep`:优先 `sessionMeta.command`
|
|
99
|
+
* (运行时 session 元数据),缺省回退 `command.type`(定义态命令类型)。shell
|
|
100
|
+
* 合成 session 无真实子代理,引擎对暂停/重试明确抛 `INVALID_OPERATION`,故 UI 不应
|
|
101
|
+
* 对其渲染 pause/resume/retry 控件;prompt 为真实子代理会话(决策 D3),与
|
|
102
|
+
* agent/skill/mcp 同语义。
|
|
103
|
+
* @param step - 已执行 Step 快照。
|
|
104
|
+
* @returns 子代理 Step(可暂停/恢复/重试)为 true。
|
|
105
|
+
*/
|
|
106
|
+
export declare function isSubagentStep(step: ExecutedStep): boolean;
|
|
107
|
+
/** 树形导航节点类型。 */
|
|
108
|
+
export type RunTreeNodeType = 'workflow' | 'stage' | 'step' | 'result' | 'artifact';
|
|
109
|
+
/** 树形导航节点。 */
|
|
110
|
+
export interface RunTreeNode {
|
|
111
|
+
readonly id: string;
|
|
112
|
+
readonly name: string;
|
|
113
|
+
readonly type: RunTreeNodeType;
|
|
114
|
+
/** 节点状态(workflow 为实例生命周期态;stage/step 为 Step 态;叶子无)。 */
|
|
115
|
+
readonly status?: StepStatus | DagRunStatus | undefined;
|
|
116
|
+
/** 归属 Step 的稳定标识(stepIdOf;供预览/操作反查)。 */
|
|
117
|
+
readonly stepId?: string | undefined;
|
|
118
|
+
/** 子代理会话 id(sessionMeta.childId,供「跳子会话」)。 */
|
|
119
|
+
readonly childId?: string | undefined;
|
|
120
|
+
/** 副信息(artifact 的 outputToId / 文件路径)。 */
|
|
121
|
+
readonly meta?: string | undefined;
|
|
122
|
+
/** 预览正文(result 的输出文本 / artifact 的文件路径)。 */
|
|
123
|
+
readonly text?: string | undefined;
|
|
124
|
+
readonly children?: readonly RunTreeNode[] | undefined;
|
|
125
|
+
}
|
|
126
|
+
/** agent 内嵌消息框的展示行(who + 正文 + 类型)。 */
|
|
127
|
+
export interface ChatLine {
|
|
128
|
+
/** 行归属(`{stepName} · agent` / `{stepName} · tool`)。 */
|
|
129
|
+
readonly who: string;
|
|
130
|
+
/** 行正文(pre-wrap)。 */
|
|
131
|
+
readonly text: string;
|
|
132
|
+
/** assistant 正文行 / tool mono 行。 */
|
|
133
|
+
readonly kind: 'assistant' | 'tool';
|
|
134
|
+
}
|
|
135
|
+
/** 统一时间线的 Step 卡片项。 */
|
|
136
|
+
export interface TimelineStepItem {
|
|
137
|
+
readonly kind: 'step';
|
|
138
|
+
readonly stepId: string;
|
|
139
|
+
readonly name: string;
|
|
140
|
+
readonly status: StepStatus;
|
|
141
|
+
/** 循环迭代标签(如 `#1.2`)。 */
|
|
142
|
+
readonly loopLabel?: string | undefined;
|
|
143
|
+
/** 段开始时间(ISO,createdAt 优先回退 updatedAt/startedAt;旧实例可能缺)。 */
|
|
144
|
+
readonly time?: string | undefined;
|
|
145
|
+
/** completed 态输出文本(text 块拼接)。 */
|
|
146
|
+
readonly outputText?: string | undefined;
|
|
147
|
+
/** failed 态错误详情。 */
|
|
148
|
+
readonly error?: string | undefined;
|
|
149
|
+
/** 收尾阶段(finalizeMeta.currentPhase:assess/ask/finalize/gate/completed;供状态按钮徽标)。 */
|
|
150
|
+
readonly finalizePhase?: string | undefined;
|
|
151
|
+
/** 收尾前一阶段(finalizeMeta.previousPhase;供 UI 展示阶段流转痕迹)。 */
|
|
152
|
+
readonly finalizePreviousPhase?: string | undefined;
|
|
153
|
+
/** 收尾错误详情(finalizeMeta.errorDetail,如门禁失败原因;failed 态附加展示)。 */
|
|
154
|
+
readonly finalizeErrorDetail?: string | undefined;
|
|
155
|
+
/** Phase B 收尾评估降级原因(finalizeMeta.assessResult.errorDetail;非 undefined 表示压缩降级,completed 态回退显示 output)。 */
|
|
156
|
+
readonly finalizeAssessErrorDetail?: string | undefined;
|
|
157
|
+
/** Phase B 收尾评估 fork 会话 id(finalizeMeta.assessResult.forkSessionId,供「收尾中」徽标点击打开)。 */
|
|
158
|
+
readonly finalizeAssessSessionId?: string | undefined;
|
|
159
|
+
/** Phase C 门禁 fork 会话 id(finalizeMeta.gateResult.gateSessionId,供「门禁中」徽标点击打开)。 */
|
|
160
|
+
readonly finalizeGateSessionId?: string | undefined;
|
|
161
|
+
/** Phase B 收尾评估结果(finalizeMeta.assessResult;completed 态展示 compressedOutput)。 */
|
|
162
|
+
readonly finalizeAssessResult?: {
|
|
163
|
+
readonly assessmentRaw: string;
|
|
164
|
+
readonly compressedOutput?: string;
|
|
165
|
+
readonly status?: 'running' | 'done';
|
|
166
|
+
} | undefined;
|
|
167
|
+
/** Phase C 门禁结果(finalizeMeta.gateResult)。 */
|
|
168
|
+
readonly finalizeGateResult?: {
|
|
169
|
+
readonly gatesPassed: boolean;
|
|
170
|
+
readonly status?: 'running' | 'done' | 'failed';
|
|
171
|
+
} | undefined;
|
|
172
|
+
/** Phase A ask 判定结果(finalizeMeta.askResult)。 */
|
|
173
|
+
readonly finalizeAskResult?: {
|
|
174
|
+
readonly hasAsk: boolean;
|
|
175
|
+
readonly askQuestion?: unknown;
|
|
176
|
+
readonly status?: 'running' | 'done';
|
|
177
|
+
} | undefined;
|
|
178
|
+
/** Phase D 路由判断结果(finalizeMeta.routingResult)。 */
|
|
179
|
+
readonly finalizeRoutingResult?: {
|
|
180
|
+
readonly branchMeta?: unknown;
|
|
181
|
+
readonly loopMeta?: unknown;
|
|
182
|
+
readonly status?: 'running' | 'done';
|
|
183
|
+
} | undefined;
|
|
184
|
+
/** Phase D 路由判断 fork 会话 id(finalizeMeta.routingResult.routingSessionId)。 */
|
|
185
|
+
readonly finalizeRoutingSessionId?: string | undefined;
|
|
186
|
+
readonly askStatus?: 'running' | 'done';
|
|
187
|
+
readonly assessStatus?: 'running' | 'done';
|
|
188
|
+
readonly gateStatus?: 'running' | 'done' | 'failed';
|
|
189
|
+
readonly routingStatus?: 'running' | 'done';
|
|
190
|
+
/** 子代理会话 id(跳「查看详情」)。 */
|
|
191
|
+
readonly childId?: string | undefined;
|
|
192
|
+
/** 命令类型(step.sessionMeta.command:'shell'/'prompt'/'agent'/'skill'/'mcp';shell completed 直接显示命令输出)。 */
|
|
193
|
+
readonly commandType?: string | undefined;
|
|
194
|
+
/** 是否合成会话(shell 无真实子代理,标题不可点击跳子代理页)。 */
|
|
195
|
+
readonly synthetic?: boolean | undefined;
|
|
196
|
+
/** sessionMessages 展示行(内嵌消息框 / 失败·暂停最近 N 条)。 */
|
|
197
|
+
readonly messages?: readonly ChatLine[] | undefined;
|
|
198
|
+
readonly visitCount: number;
|
|
199
|
+
/** 执行段序号(同 stepId 第几次执行段;0-based,缺省 0 = 首次执行)。 */
|
|
200
|
+
readonly attemptIndex?: number | undefined;
|
|
201
|
+
/** 暂停定格时间(paused 段展示暂停提示时用)。 */
|
|
202
|
+
readonly pausedAt?: string | undefined;
|
|
203
|
+
}
|
|
204
|
+
/** 统一时间线的用户气泡项。 */
|
|
205
|
+
export interface TimelineUserItem {
|
|
206
|
+
readonly kind: 'user';
|
|
207
|
+
readonly content: string;
|
|
208
|
+
/** 消息时间(ISO,createdAt)。 */
|
|
209
|
+
readonly time: string;
|
|
210
|
+
/** 消息种类(input/resume/retry/answer;旧实例可能缺,回退 input 语义)。 */
|
|
211
|
+
readonly messageKind?: string | undefined;
|
|
212
|
+
/** 目标:'broadcast' 或 Step 定义 id(定点);input 时为 ''。 */
|
|
213
|
+
readonly target?: string | undefined;
|
|
214
|
+
}
|
|
215
|
+
/** 统一时间线条目(Step 卡片 / 用户气泡,按时间顺序)。 */
|
|
216
|
+
export type TimelineItem = TimelineStepItem | TimelineUserItem;
|
|
217
|
+
/** 相对时间展示结果(由组件用字典文案渲染)。 */
|
|
218
|
+
export type RelativeTime = {
|
|
219
|
+
readonly kind: 'justNow';
|
|
220
|
+
} | {
|
|
221
|
+
readonly kind: 'minutes';
|
|
222
|
+
readonly count: number;
|
|
223
|
+
} | {
|
|
224
|
+
readonly kind: 'hours';
|
|
225
|
+
readonly count: number;
|
|
226
|
+
} | {
|
|
227
|
+
readonly kind: 'days';
|
|
228
|
+
readonly count: number;
|
|
229
|
+
} | {
|
|
230
|
+
readonly kind: 'date';
|
|
231
|
+
readonly text: string;
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* 计算相对时间(ISO → 刚刚 / N 分钟前 / N 小时前 / N 天前;跨 7 天回退短日期)。
|
|
235
|
+
* @param iso - 目标时间(ISO 串),undefined 返回 undefined。
|
|
236
|
+
* @param nowIso - 基准「现在」(ISO 串)。
|
|
237
|
+
* @returns 相对时间结果或 undefined。
|
|
238
|
+
*/
|
|
239
|
+
export declare function relativeTimeOf(iso: string | undefined, nowIso: string): RelativeTime | undefined;
|
|
240
|
+
/**
|
|
241
|
+
* 把 step 的 sessionMessages 派生为展示行(agent 内嵌消息框 / 失败列表用)。
|
|
242
|
+
* tool 消息 → `┌ tool\n└ 输出摘要`(mono 行);text/reasoning → 正文行。
|
|
243
|
+
* @param step - 已执行 Step 快照。
|
|
244
|
+
* @returns 展示行列表;无消息返回 undefined。
|
|
245
|
+
*/
|
|
246
|
+
export declare function chatLinesOf(step: ExecutedStep): ChatLine[] | undefined;
|
|
247
|
+
/**
|
|
248
|
+
* 把 `output: ContentBlock[]` 的 text 块拼接为纯文本(无 text 块返回 undefined)。
|
|
249
|
+
* @param output - Step 执行输出块(引擎在 step-completed 事件/快照中内联)。
|
|
250
|
+
* @returns 拼接文本或 undefined。
|
|
251
|
+
*/
|
|
252
|
+
export declare function outputTextOf(output: readonly {
|
|
253
|
+
readonly type: string;
|
|
254
|
+
readonly text?: string;
|
|
255
|
+
}[] | undefined): string | undefined;
|
|
256
|
+
/** 循环迭代路径 → 展示标签(`#1.2`),非循环返回 undefined。 */
|
|
257
|
+
export declare function loopLabelOf(loopIteration: readonly number[] | undefined): string | undefined;
|
|
258
|
+
/** 取文件路径的 basename(兼容 / 与 \ 分隔;无分隔符时原样返回)。 */
|
|
259
|
+
export declare function fileBaseName(file: string): string;
|
|
260
|
+
/**
|
|
261
|
+
* 从 `WorkflowTaskState` 构建树形导航数据:workflow → stage → step → result/artifact 叶子。
|
|
262
|
+
* result 叶子来自 step 输出文本;artifact 叶子来自 `stageContracts` 产物契约的 files。
|
|
263
|
+
*
|
|
264
|
+
* Round 26:**完全按 `state.executedSteps` 渲染**——
|
|
265
|
+
* ① `executedSteps` 里**每条执行段**都展示(含 paused/failed/同 stepId 多次 visit 的
|
|
266
|
+
* 每一段,不做 attemptIndex 聚合);
|
|
267
|
+
* ② step 按自身 `stageId` 归组到 stage 下;
|
|
268
|
+
* ③ **只展示「有 step 执行记录」的 stage**(空 stage / 尚未执行的 stage 不展示);
|
|
269
|
+
* ④ stage 与 step 均按**创建顺序**(executedSteps 数组序 = 引擎追加序)排列。
|
|
270
|
+
* ⑤ **返回结果按执行段挂载**(每段只挂自己这段的 output 文本);**产物按 step 级
|
|
271
|
+
* 归并、只挂到该 stepId 的「最后一段」**(loop 多次 visit 产出同一 outputTo 文件,
|
|
272
|
+
* 挂一次展示最新产物状态,避免每段重复)。
|
|
273
|
+
* 无 `stageId` 的异常段归入合成 stage「未分组」兜底(保证所有 step 可见)。
|
|
274
|
+
* @param state - 实例状态快照。
|
|
275
|
+
* @returns 树形导航根节点列表(单个 workflow 根)。
|
|
276
|
+
*/
|
|
277
|
+
export declare function buildRunTree(state: WorkflowTaskState): RunTreeNode[];
|
|
278
|
+
/** Round 26:无 stageId 的异常执行段归入的合成 stage id(名称「未分组」)。 */
|
|
279
|
+
export declare const UNASSIGNED_STAGE_ID = "_unassigned";
|
|
280
|
+
/**
|
|
281
|
+
* 段模型下按「最后活跃段」聚合 Step 列表(DiscussionInput @Step 定点恢复用)。
|
|
282
|
+
*
|
|
283
|
+
* 同 stepId 多次执行段(暂停续跑/重试/ask 续问)只保留 attemptIndex 最大的段,
|
|
284
|
+
* 避免 @Step 选择器重复展示同一 Step 的多个执行段。
|
|
285
|
+
* @param steps - 实例的 executedSteps(可能含同 stepId 多段)。
|
|
286
|
+
* @returns 按 stepId 去重后的 Step 快照列表(取最后活跃段;非子代理 Step 原样保留)。
|
|
287
|
+
*/
|
|
288
|
+
export declare function lastActiveSegmentsOf(steps: readonly ExecutedStep[]): ExecutedStep[];
|
|
289
|
+
/**
|
|
290
|
+
* 从 `WorkflowTaskState` 构建统一时间线(段模型 + 用户消息统一排序)。
|
|
291
|
+
*
|
|
292
|
+
* 三路来源严格按 `createdAt` 排序合并:
|
|
293
|
+
* 1. `userMessages`(input/resume/retry/message,含原始需求——初始 input 消息
|
|
294
|
+
* 由引擎 makeInitialState 写入,前端不再单独拼 `state.originalInput` 气泡;
|
|
295
|
+
* Round 26:**过滤 kind:'answer'**——Phase A ask 的回答是给子代理的内部闭环
|
|
296
|
+
* 消息,不注入 discussion 时间轴;历史实例已落盘的 answer 记录同样隐藏)
|
|
297
|
+
* 2. executedSteps 各**执行段**(`createdAt` 为段开始时间;同 stepId 多次执行段
|
|
298
|
+
* 各自成卡,`attemptIndex` 标注第几次)
|
|
299
|
+
* 3. running 卡无实时消息流(引擎不写 sessionMessages、无 step-message 事件),
|
|
300
|
+
* body 按状态展示输出文本 / 错误 / 运行中占位。
|
|
301
|
+
* @param state - 实例状态快照。
|
|
302
|
+
* @returns 时间线条目列表(按 createdAt 升序)。
|
|
303
|
+
*/
|
|
304
|
+
export declare function buildTimeline(state: WorkflowTaskState): TimelineItem[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DagEditor 保存流程的接线与错误归一化(无 React 依赖,可单测)。
|
|
3
|
+
*
|
|
4
|
+
* `createSandoreSave` 把 `ctx.remote.sandore` 的 RPC 面接成 DagEditor 的
|
|
5
|
+
* `save(id, yaml)` 回调:`id === undefined` 走 `createDefinition({ yaml })`,
|
|
6
|
+
* 否则走 `updateYaml(id, yaml)`,均经 `unwrap` 解包并返回保存后的 id。
|
|
7
|
+
* `describeSaveError` 把各类错误统一为含「校验详情」的 `SaveErrorInfo`,
|
|
8
|
+
* 供 DagEditor 的错误分支呈现,而非只回落 message 文案。
|
|
9
|
+
* @module @deepseek-ai/dsh-client-ui-sandore/src/client/sandore-save
|
|
10
|
+
*/
|
|
11
|
+
import type { RemoteResult } from '@deepseek-ai/dsh-typert-protocol';
|
|
12
|
+
import type { WorkflowDefinitionEntry } from 'dsh-sandore/remote';
|
|
13
|
+
/** `createSandoreSave` 所需的最小 remote 面(`ctx.remote.sandore` 结构满足)。 */
|
|
14
|
+
export interface SandoreSaveRemote {
|
|
15
|
+
createDefinition(input: {
|
|
16
|
+
yaml: string;
|
|
17
|
+
}): Promise<RemoteResult<WorkflowDefinitionEntry>>;
|
|
18
|
+
updateYaml(id: string, yaml: string): Promise<RemoteResult<WorkflowDefinitionEntry>>;
|
|
19
|
+
}
|
|
20
|
+
/** DagEditor 的保存回调签名:`id` 为 `undefined` 时新建,否则更新 YAML;返回保存后的 id。 */
|
|
21
|
+
export type SaveDefinition = (id: string | undefined, yaml: string) => Promise<string>;
|
|
22
|
+
/**
|
|
23
|
+
* 构造 save 回调:`id === undefined` 走 `createDefinition`,否则走 `updateYaml`,
|
|
24
|
+
* 返回持久化后的 id。新建首次 `createDefinition`、后续 `updateYaml` 的行为在此成可执行路径。
|
|
25
|
+
* @param remote - `ctx.remote.sandore` 的最小 RPC 面。
|
|
26
|
+
* @returns 供 DagEditor `save` prop 直接使用的回调。
|
|
27
|
+
*/
|
|
28
|
+
export declare function createSandoreSave(remote: SandoreSaveRemote): SaveDefinition;
|
|
29
|
+
/** 保存失败归一化结果:`details` 为可直接展示的校验详情文案(无详情时为 `undefined`)。 */
|
|
30
|
+
export interface SaveErrorInfo {
|
|
31
|
+
readonly message: string;
|
|
32
|
+
readonly details: string | undefined;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 把保存流程抛出的任意错误归一化为含校验详情的 `SaveErrorInfo`:
|
|
36
|
+
* `SandoreRemoteError` 取 `.details`、`WorkflowYamlError` 取 `.code`/`.cause`、
|
|
37
|
+
* zod 错误取 issues 摘要,其余回落 message。
|
|
38
|
+
* @param error - 保存流程 catch 到的未知抛错值。
|
|
39
|
+
* @returns 含统一 message 与可选校验详情的归一化结果。
|
|
40
|
+
*/
|
|
41
|
+
export declare function describeSaveError(error: unknown): SaveErrorInfo;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sandore SSE 客户端订阅器。
|
|
3
|
+
*
|
|
4
|
+
* 用 EventSource 连接 `/sandore/events`,接收引擎推送的 sandore/* 事件。
|
|
5
|
+
* 模块级单例(多个组件共享一个 EventSource 连接)。
|
|
6
|
+
*/
|
|
7
|
+
type EventListener = (type: string, data: unknown) => void;
|
|
8
|
+
/**
|
|
9
|
+
* 订阅 sandore SSE 事件。
|
|
10
|
+
*
|
|
11
|
+
* @param listener - 事件回调(type 事件名 + data 载荷对象)。
|
|
12
|
+
* @returns unsubscribe 函数。
|
|
13
|
+
*/
|
|
14
|
+
export declare function subscribeSandoreSse(listener: EventListener): () => void;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StepChatPanel 弹性化的可测纯函数:open 失败退避重试序列、binding 重解析序列、
|
|
3
|
+
* openError 展示格式化。
|
|
4
|
+
*
|
|
5
|
+
* Round 25:StepChatPanel 对子代理会话只 open 一次,`openState='error'` 后永久粘滞
|
|
6
|
+
* (挂载瞬间的瞬时失败——短 turn 子代理 settle/dispose 过渡窗口——无法自愈,面板
|
|
7
|
+
* 长期显示「子代理会话加载失败」且实时事件被丢弃)。这里定义有界退避序列供面板重试;
|
|
8
|
+
* 达上限后停在 error 占位并展示 openError(便于现场锁定确切错误码)。
|
|
9
|
+
*
|
|
10
|
+
* 另一个缺陷:子代理 settle/dispose 后 host 广播 `session-removed` → client 列表移除
|
|
11
|
+
* 该 child → `binding` 转 undefined → 面板停在「正在加载子代理会话…」。这里定义有界
|
|
12
|
+
* 列表重拉序列(host 列表包含持久化冷会话,`sessions.refresh()` 后 child 可重新绑定)。
|
|
13
|
+
*
|
|
14
|
+
* @module @deepseek-ai/dsh-client-ui-sandore/src/client/step-chat-retry
|
|
15
|
+
*/
|
|
16
|
+
/** open 失败重试的退避延迟(毫秒):1s → 3s → 10s 封顶;超出返回 undefined(停止重试)。 */
|
|
17
|
+
export declare const STEP_CHAT_RETRY_DELAYS_MS: readonly number[];
|
|
18
|
+
/**
|
|
19
|
+
* 第 `attempt` 次 open 重试前的延迟(0-based;`attempt=0` 表示首次失败后第一次重试)。
|
|
20
|
+
* @param attempt - 已失败/已重试次数。
|
|
21
|
+
* @returns 延迟毫秒;达上限返回 undefined(不再重试)。
|
|
22
|
+
*/
|
|
23
|
+
export declare function stepChatRetryDelayMs(attempt: number): number | undefined;
|
|
24
|
+
/** binding 缺失(settle 后 session-removed)时的列表重拉延迟序列(毫秒),有界。 */
|
|
25
|
+
export declare const STEP_CHAT_REBIND_DELAYS_MS: readonly number[];
|
|
26
|
+
/** binding 重解析最大次数(超出停在 loading 占位,避免对已删除 child 空转)。 */
|
|
27
|
+
export declare const STEP_CHAT_MAX_REBINDS: number;
|
|
28
|
+
/**
|
|
29
|
+
* 第 `attempt` 次 binding 重拉前的延迟(0-based)。
|
|
30
|
+
* @param attempt - 已重拉次数。
|
|
31
|
+
* @returns 延迟毫秒;达上限返回 undefined(停止重拉)。
|
|
32
|
+
*/
|
|
33
|
+
export declare function stepChatRebindDelayMs(attempt: number): number | undefined;
|
|
34
|
+
/** `snapshot.openError` 的最小结构面(DSH RpcError:code/message/details)。 */
|
|
35
|
+
export interface StepChatOpenErrorLike {
|
|
36
|
+
readonly code: string;
|
|
37
|
+
readonly message?: string | undefined;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* openError → 展示文案(`code: message`;无 message 时仅 code)。
|
|
41
|
+
* @param error - `snapshot.openError`(RpcError | null)。
|
|
42
|
+
* @returns 展示文案;null/undefined 返回 undefined(不展示)。
|
|
43
|
+
*/
|
|
44
|
+
export declare function formatOpenError(error: StepChatOpenErrorLike | null | undefined): string | undefined;
|