@lukstei/dsh-yaml-workflow 0.0.0-stage → 0.2.2-rc.5.3
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 +21 -0
- package/README.md +452 -2
- package/cordis.patch.yml +4 -0
- package/dist/client.js +1746 -0
- package/dist/index.js +3495 -0
- package/examples/gate.yml +4 -0
- package/examples/parametrized-wf.yml +20 -0
- package/examples/wf.yml +3 -0
- package/package.json +114 -3
- package/src/boolean.ts +96 -0
- package/src/client/WorkflowCommandCard.tsx +217 -0
- package/src/client/WorkflowErrorCard.tsx +99 -0
- package/src/client/WorkflowMarkdown.tsx +28 -0
- package/src/client/WorkflowMarkdownResult.tsx +86 -0
- package/src/client/WorkflowPrintStep.tsx +46 -0
- package/src/client/WorkflowResumeButton.tsx +159 -0
- package/src/client/WorkflowStepRow.tsx +106 -0
- package/src/client/WorkflowStyles.tsx +10 -0
- package/src/client/actions.ts +113 -0
- package/src/client/context.ts +30 -0
- package/src/client/dsh.d.ts +33 -0
- package/src/client/icons.tsx +91 -0
- package/src/client/index.tsx +186 -0
- package/src/client/store.ts +655 -0
- package/src/client/styles.ts +340 -0
- package/src/effects.ts +696 -0
- package/src/fold.ts +201 -0
- package/src/index.ts +468 -0
- package/src/parser.ts +1146 -0
- package/src/requests.ts +85 -0
- package/src/rules.ts +647 -0
- package/src/runner.ts +1955 -0
- package/src/skill.ts +67 -0
- package/src/transitions.ts +357 -0
- package/src/types.ts +604 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PURPOSE: Cordis client plugin entrypoint registering workflow slots and state sync.
|
|
3
|
+
* ALLOWED: Slot injection, effect registration, client service binding.
|
|
4
|
+
* FORBIDDEN: Inline execution loops, raw DOM queries.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { Context as ClientContext } from "@deepseek-ai/cordis";
|
|
8
|
+
import type { ChatNodeViewProps } from "@deepseek-ai/dsh-client-ui-chat/client";
|
|
9
|
+
import type { PropsRenderFactories } from "@deepseek-ai/dsh-client-ui-slots";
|
|
10
|
+
import { WORKFLOW_EVENT_NAME } from "../fold.ts";
|
|
11
|
+
import {
|
|
12
|
+
WorkflowClientContext,
|
|
13
|
+
type WorkflowClientContext as WorkflowClientContextType,
|
|
14
|
+
} from "./context.ts";
|
|
15
|
+
import { registerWorkflowChatNodes } from "./store.ts";
|
|
16
|
+
import { WorkflowCommandCard } from "./WorkflowCommandCard.tsx";
|
|
17
|
+
import { WorkflowErrorCard } from "./WorkflowErrorCard.tsx";
|
|
18
|
+
import { WorkflowMarkdownResult } from "./WorkflowMarkdownResult.tsx";
|
|
19
|
+
import { WorkflowPrintStep } from "./WorkflowPrintStep.tsx";
|
|
20
|
+
import {
|
|
21
|
+
WorkflowResumeButton,
|
|
22
|
+
type WorkflowResumeButtonProps,
|
|
23
|
+
} from "./WorkflowResumeButton.tsx";
|
|
24
|
+
import { WorkflowStepRow } from "./WorkflowStepRow.tsx";
|
|
25
|
+
|
|
26
|
+
export const inject = [
|
|
27
|
+
"slots",
|
|
28
|
+
"conversation",
|
|
29
|
+
"uiConversation",
|
|
30
|
+
"sessions",
|
|
31
|
+
] as const;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Applies workflow runner client plugin to the Cordis client container.
|
|
35
|
+
* CONTRACT:
|
|
36
|
+
* - Input: Cordis ClientContext instance with injected slots, conversation, uiConversation, and sessions services.
|
|
37
|
+
* - Output: void (registers slots and effects).
|
|
38
|
+
*/
|
|
39
|
+
export function apply(ctx: ClientContext): void {
|
|
40
|
+
// Wire chat node definitions (wf/state, wf/step, and wf/print)
|
|
41
|
+
ctx.effect(
|
|
42
|
+
() => registerWorkflowChatNodes(ctx),
|
|
43
|
+
"workflow-runner: chat-nodes",
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
// Register custom chat nodes
|
|
47
|
+
ctx.effect(
|
|
48
|
+
() =>
|
|
49
|
+
ctx.slots.inject("conversation.chat.node", () => {
|
|
50
|
+
const unregisterState = ctx.slots.register(
|
|
51
|
+
{
|
|
52
|
+
name: "conversation.chat.node",
|
|
53
|
+
key: "wf-state",
|
|
54
|
+
},
|
|
55
|
+
WorkflowCommandCard,
|
|
56
|
+
);
|
|
57
|
+
const unregisterStep = ctx.slots.register(
|
|
58
|
+
{
|
|
59
|
+
name: "conversation.chat.node",
|
|
60
|
+
key: "wf-step",
|
|
61
|
+
},
|
|
62
|
+
WorkflowStepRow,
|
|
63
|
+
);
|
|
64
|
+
const unregisterPrint = ctx.slots.register(
|
|
65
|
+
{
|
|
66
|
+
name: "conversation.chat.node",
|
|
67
|
+
key: "wf-print",
|
|
68
|
+
},
|
|
69
|
+
WorkflowPrintStep,
|
|
70
|
+
);
|
|
71
|
+
const unregisterError = ctx.slots.register(
|
|
72
|
+
{
|
|
73
|
+
name: "conversation.chat.node",
|
|
74
|
+
key: "wf-error",
|
|
75
|
+
},
|
|
76
|
+
WorkflowErrorCard,
|
|
77
|
+
);
|
|
78
|
+
const unregisterList = ctx.slots.register(
|
|
79
|
+
{
|
|
80
|
+
name: "conversation.chat.node",
|
|
81
|
+
key: "wf-list",
|
|
82
|
+
},
|
|
83
|
+
(
|
|
84
|
+
props: Pick<ChatNodeViewProps<"wf-list">, "node"> &
|
|
85
|
+
PropsRenderFactories,
|
|
86
|
+
) => (
|
|
87
|
+
<WorkflowMarkdownResult
|
|
88
|
+
node={props.node.data}
|
|
89
|
+
renderFactorySlot={props.renderFactorySlot}
|
|
90
|
+
/>
|
|
91
|
+
),
|
|
92
|
+
);
|
|
93
|
+
return () => {
|
|
94
|
+
unregisterState();
|
|
95
|
+
unregisterStep();
|
|
96
|
+
unregisterPrint();
|
|
97
|
+
unregisterError();
|
|
98
|
+
unregisterList();
|
|
99
|
+
};
|
|
100
|
+
}),
|
|
101
|
+
"workflow-runner: chat.node",
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
// Suppress execution command cards and share Markdown output for informational commands.
|
|
105
|
+
ctx.effect(
|
|
106
|
+
() =>
|
|
107
|
+
ctx.slots.inject("conversation.chat.commandview", () => {
|
|
108
|
+
const unregisterWf = ctx.slots.register(
|
|
109
|
+
{
|
|
110
|
+
name: "conversation.chat.commandview",
|
|
111
|
+
key: "wf",
|
|
112
|
+
},
|
|
113
|
+
() => null,
|
|
114
|
+
);
|
|
115
|
+
const unregisterResume = ctx.slots.register(
|
|
116
|
+
{
|
|
117
|
+
name: "conversation.chat.commandview",
|
|
118
|
+
key: "wf-resume",
|
|
119
|
+
},
|
|
120
|
+
() => null,
|
|
121
|
+
);
|
|
122
|
+
const unregisterAbort = ctx.slots.register(
|
|
123
|
+
{
|
|
124
|
+
name: "conversation.chat.commandview",
|
|
125
|
+
key: "wf-abort",
|
|
126
|
+
},
|
|
127
|
+
() => null,
|
|
128
|
+
);
|
|
129
|
+
const unregisterEvent = ctx.slots.register(
|
|
130
|
+
{
|
|
131
|
+
name: "conversation.chat.commandview",
|
|
132
|
+
key: WORKFLOW_EVENT_NAME,
|
|
133
|
+
},
|
|
134
|
+
() => null,
|
|
135
|
+
);
|
|
136
|
+
const unregisterList = ctx.slots.register(
|
|
137
|
+
{
|
|
138
|
+
name: "conversation.chat.commandview",
|
|
139
|
+
key: "wf-list",
|
|
140
|
+
},
|
|
141
|
+
() => null,
|
|
142
|
+
);
|
|
143
|
+
const unregisterValidate = ctx.slots.register(
|
|
144
|
+
{
|
|
145
|
+
name: "conversation.chat.commandview",
|
|
146
|
+
key: "wf-validate",
|
|
147
|
+
},
|
|
148
|
+
WorkflowMarkdownResult,
|
|
149
|
+
);
|
|
150
|
+
return () => {
|
|
151
|
+
unregisterWf();
|
|
152
|
+
unregisterResume();
|
|
153
|
+
unregisterAbort();
|
|
154
|
+
unregisterEvent();
|
|
155
|
+
unregisterList();
|
|
156
|
+
unregisterValidate();
|
|
157
|
+
};
|
|
158
|
+
}),
|
|
159
|
+
"workflow-runner: commandview-custom",
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
// Register composer resume button in trailing input toolbar
|
|
163
|
+
ctx.effect(
|
|
164
|
+
() =>
|
|
165
|
+
ctx.slots.inject("conversation.input.right", () => {
|
|
166
|
+
const unregisterResume = ctx.slots.register(
|
|
167
|
+
{
|
|
168
|
+
name: "conversation.input.right",
|
|
169
|
+
id: "wf-resume",
|
|
170
|
+
order: 50,
|
|
171
|
+
},
|
|
172
|
+
(props: WorkflowResumeButtonProps) => (
|
|
173
|
+
<WorkflowClientContext.Provider
|
|
174
|
+
value={ctx as unknown as WorkflowClientContextType}
|
|
175
|
+
>
|
|
176
|
+
<WorkflowResumeButton {...props} />
|
|
177
|
+
</WorkflowClientContext.Provider>
|
|
178
|
+
),
|
|
179
|
+
);
|
|
180
|
+
return () => {
|
|
181
|
+
unregisterResume();
|
|
182
|
+
};
|
|
183
|
+
}),
|
|
184
|
+
"workflow-runner: input.right",
|
|
185
|
+
);
|
|
186
|
+
}
|