@longzai-intelligence-workflow/core 0.0.1
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/CHANGELOG.md +20 -0
- package/README.md +14 -0
- package/coverage/.lcov.info.0d8fc8c4f6acaa77.tmp +159 -0
- package/coverage/.lcov.info.1ca0aee1c681607a.tmp +61 -0
- package/coverage/.lcov.info.5a9690152fb62c73.tmp +159 -0
- package/coverage/.lcov.info.984d9ad89a4b1598.tmp +12 -0
- package/coverage/.lcov.info.a607374a9831c63e.tmp +61 -0
- package/coverage/.lcov.info.b58246c9a6df7fc5.tmp +167 -0
- package/coverage/.lcov.info.b5f068b7c1d63f36.tmp +12 -0
- package/coverage/.lcov.info.bbac83a4ec8a1294.tmp +159 -0
- package/coverage/.lcov.info.bf3e6cf9d98abfc0.tmp +159 -0
- package/coverage/.lcov.info.fb2d882b78dc47d4.tmp +169 -0
- package/coverage/lcov.info +169 -0
- package/dist/index.d.ts +577 -0
- package/dist/index.js +8 -0
- package/dist/schemas-D0Zuq8_5.js +1 -0
- package/dist/schemas.d.ts +684 -0
- package/dist/schemas.js +1 -0
- package/docs/overview.md +17 -0
- package/lzi-builder.config.ts +13 -0
- package/lzi-dev.config.ts +7 -0
- package/oxlint.config.ts +6 -0
- package/package.json +38 -0
- package/src/__tests__/helpers/setup.ts +9 -0
- package/src/__tests__/unit/constants.test.ts +129 -0
- package/src/__tests__/unit/utils.test.ts +156 -0
- package/src/__tests__/work-item-rules.test.ts +90 -0
- package/src/constants/index.ts +1 -0
- package/src/constants/workflow.ts +114 -0
- package/src/index.ts +16 -0
- package/src/ports/action-executor.port.ts +73 -0
- package/src/ports/feed-event.port.ts +74 -0
- package/src/ports/index.ts +9 -0
- package/src/schemas/action-executor.schema.ts +209 -0
- package/src/schemas/api.schema.ts +11 -0
- package/src/schemas/definition.schema.ts +53 -0
- package/src/schemas/feed-event-trigger.schema.ts +102 -0
- package/src/schemas/index.ts +8 -0
- package/src/schemas/instance.schema.ts +47 -0
- package/src/schemas/monitoring.schema.ts +53 -0
- package/src/schemas/trigger.schema.ts +26 -0
- package/src/schemas/workflow-doc.schema.ts +365 -0
- package/src/types/action-executor.ts +64 -0
- package/src/types/api.ts +10 -0
- package/src/types/definition.ts +49 -0
- package/src/types/feed-event-trigger.ts +38 -0
- package/src/types/index.ts +6 -0
- package/src/types/instance.ts +49 -0
- package/src/types/monitoring.ts +54 -0
- package/src/types/trigger.ts +39 -0
- package/src/utils/dag.utils.ts +95 -0
- package/src/utils/declaration-frontmatter.utils.ts +138 -0
- package/src/utils/index.ts +19 -0
- package/src/utils/work-item-rules.utils.ts +194 -0
- package/tsconfig/.cache/build.tsbuildinfo +1 -0
- package/tsconfig/.cache/node.tsbuildinfo +1 -0
- package/tsconfig/.cache/test.tsbuildinfo +1 -0
- package/tsconfig/app.json +12 -0
- package/tsconfig/build.json +15 -0
- package/tsconfig/node.json +12 -0
- package/tsconfig/test.json +15 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,684 @@
|
|
|
1
|
+
import * as z$1 from "zod";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/schemas/definition.schema.d.ts
|
|
4
|
+
declare const workflowNodeDtoSchema: z.ZodObject<{
|
|
5
|
+
nodeId: z.ZodString;
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
type: z.ZodEnum<{
|
|
8
|
+
EndEvent: "EndEvent";
|
|
9
|
+
ErrorEvent: "ErrorEvent";
|
|
10
|
+
ExclusiveGateway: "ExclusiveGateway";
|
|
11
|
+
InclusiveGateway: "InclusiveGateway";
|
|
12
|
+
ParallelGateway: "ParallelGateway";
|
|
13
|
+
ServiceTask: "ServiceTask";
|
|
14
|
+
SignalEvent: "SignalEvent";
|
|
15
|
+
StartEvent: "StartEvent";
|
|
16
|
+
SubProcess: "SubProcess";
|
|
17
|
+
TimerEvent: "TimerEvent";
|
|
18
|
+
UserTask: "UserTask";
|
|
19
|
+
}>;
|
|
20
|
+
properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
21
|
+
position: z.ZodObject<{
|
|
22
|
+
x: z.ZodNumber;
|
|
23
|
+
y: z.ZodNumber;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
declare const workflowEdgeDtoSchema: z.ZodObject<{
|
|
27
|
+
edgeId: z.ZodString;
|
|
28
|
+
sourceNodeId: z.ZodString;
|
|
29
|
+
targetNodeId: z.ZodString;
|
|
30
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
31
|
+
label: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
declare const stateTransitionDtoSchema: z.ZodObject<{
|
|
34
|
+
from: z.ZodString;
|
|
35
|
+
to: z.ZodString;
|
|
36
|
+
event: z.ZodString;
|
|
37
|
+
guard: z.ZodOptional<z.ZodString>;
|
|
38
|
+
action: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
declare const createDefinitionInputSchema: z.ZodObject<{
|
|
41
|
+
name: z.ZodString;
|
|
42
|
+
description: z.ZodOptional<z.ZodString>;
|
|
43
|
+
nodes: z.ZodArray<z.ZodObject<{
|
|
44
|
+
nodeId: z.ZodString;
|
|
45
|
+
name: z.ZodString;
|
|
46
|
+
type: z.ZodEnum<{
|
|
47
|
+
EndEvent: "EndEvent";
|
|
48
|
+
ErrorEvent: "ErrorEvent";
|
|
49
|
+
ExclusiveGateway: "ExclusiveGateway";
|
|
50
|
+
InclusiveGateway: "InclusiveGateway";
|
|
51
|
+
ParallelGateway: "ParallelGateway";
|
|
52
|
+
ServiceTask: "ServiceTask";
|
|
53
|
+
SignalEvent: "SignalEvent";
|
|
54
|
+
StartEvent: "StartEvent";
|
|
55
|
+
SubProcess: "SubProcess";
|
|
56
|
+
TimerEvent: "TimerEvent";
|
|
57
|
+
UserTask: "UserTask";
|
|
58
|
+
}>;
|
|
59
|
+
properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
60
|
+
position: z.ZodObject<{
|
|
61
|
+
x: z.ZodNumber;
|
|
62
|
+
y: z.ZodNumber;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
}, z.core.$strip>>;
|
|
65
|
+
edges: z.ZodArray<z.ZodObject<{
|
|
66
|
+
edgeId: z.ZodString;
|
|
67
|
+
sourceNodeId: z.ZodString;
|
|
68
|
+
targetNodeId: z.ZodString;
|
|
69
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
70
|
+
label: z.ZodOptional<z.ZodString>;
|
|
71
|
+
}, z.core.$strip>>;
|
|
72
|
+
initialState: z.ZodString;
|
|
73
|
+
states: z.ZodArray<z.ZodString>;
|
|
74
|
+
transitions: z.ZodArray<z.ZodObject<{
|
|
75
|
+
from: z.ZodString;
|
|
76
|
+
to: z.ZodString;
|
|
77
|
+
event: z.ZodString;
|
|
78
|
+
guard: z.ZodOptional<z.ZodString>;
|
|
79
|
+
action: z.ZodOptional<z.ZodString>;
|
|
80
|
+
}, z.core.$strip>>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
declare const updateDefinitionInputSchema: z.ZodObject<{
|
|
83
|
+
name: z.ZodOptional<z.ZodString>;
|
|
84
|
+
description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
85
|
+
nodes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
86
|
+
nodeId: z.ZodString;
|
|
87
|
+
name: z.ZodString;
|
|
88
|
+
type: z.ZodEnum<{
|
|
89
|
+
EndEvent: "EndEvent";
|
|
90
|
+
ErrorEvent: "ErrorEvent";
|
|
91
|
+
ExclusiveGateway: "ExclusiveGateway";
|
|
92
|
+
InclusiveGateway: "InclusiveGateway";
|
|
93
|
+
ParallelGateway: "ParallelGateway";
|
|
94
|
+
ServiceTask: "ServiceTask";
|
|
95
|
+
SignalEvent: "SignalEvent";
|
|
96
|
+
StartEvent: "StartEvent";
|
|
97
|
+
SubProcess: "SubProcess";
|
|
98
|
+
TimerEvent: "TimerEvent";
|
|
99
|
+
UserTask: "UserTask";
|
|
100
|
+
}>;
|
|
101
|
+
properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
102
|
+
position: z.ZodObject<{
|
|
103
|
+
x: z.ZodNumber;
|
|
104
|
+
y: z.ZodNumber;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
}, z.core.$strip>>>;
|
|
107
|
+
edges: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
108
|
+
edgeId: z.ZodString;
|
|
109
|
+
sourceNodeId: z.ZodString;
|
|
110
|
+
targetNodeId: z.ZodString;
|
|
111
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
112
|
+
label: z.ZodOptional<z.ZodString>;
|
|
113
|
+
}, z.core.$strip>>>;
|
|
114
|
+
initialState: z.ZodOptional<z.ZodString>;
|
|
115
|
+
states: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
116
|
+
transitions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
117
|
+
from: z.ZodString;
|
|
118
|
+
to: z.ZodString;
|
|
119
|
+
event: z.ZodString;
|
|
120
|
+
guard: z.ZodOptional<z.ZodString>;
|
|
121
|
+
action: z.ZodOptional<z.ZodString>;
|
|
122
|
+
}, z.core.$strip>>>;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
declare const definitionDtoSchema: z.ZodObject<{
|
|
125
|
+
id: z.ZodString;
|
|
126
|
+
name: z.ZodString;
|
|
127
|
+
description: z.ZodNullable<z.ZodString>;
|
|
128
|
+
version: z.ZodNumber;
|
|
129
|
+
nodes: z.ZodArray<z.ZodObject<{
|
|
130
|
+
nodeId: z.ZodString;
|
|
131
|
+
name: z.ZodString;
|
|
132
|
+
type: z.ZodEnum<{
|
|
133
|
+
EndEvent: "EndEvent";
|
|
134
|
+
ErrorEvent: "ErrorEvent";
|
|
135
|
+
ExclusiveGateway: "ExclusiveGateway";
|
|
136
|
+
InclusiveGateway: "InclusiveGateway";
|
|
137
|
+
ParallelGateway: "ParallelGateway";
|
|
138
|
+
ServiceTask: "ServiceTask";
|
|
139
|
+
SignalEvent: "SignalEvent";
|
|
140
|
+
StartEvent: "StartEvent";
|
|
141
|
+
SubProcess: "SubProcess";
|
|
142
|
+
TimerEvent: "TimerEvent";
|
|
143
|
+
UserTask: "UserTask";
|
|
144
|
+
}>;
|
|
145
|
+
properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
146
|
+
position: z.ZodObject<{
|
|
147
|
+
x: z.ZodNumber;
|
|
148
|
+
y: z.ZodNumber;
|
|
149
|
+
}, z.core.$strip>;
|
|
150
|
+
}, z.core.$strip>>;
|
|
151
|
+
edges: z.ZodArray<z.ZodObject<{
|
|
152
|
+
edgeId: z.ZodString;
|
|
153
|
+
sourceNodeId: z.ZodString;
|
|
154
|
+
targetNodeId: z.ZodString;
|
|
155
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
156
|
+
label: z.ZodOptional<z.ZodString>;
|
|
157
|
+
}, z.core.$strip>>;
|
|
158
|
+
initialState: z.ZodString;
|
|
159
|
+
states: z.ZodArray<z.ZodString>;
|
|
160
|
+
publishedAt: z.ZodNullable<z.ZodString>;
|
|
161
|
+
createdAt: z.ZodString;
|
|
162
|
+
updatedAt: z.ZodString;
|
|
163
|
+
}, z.core.$strip>;
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/schemas/workflow-doc.schema.d.ts
|
|
166
|
+
/**
|
|
167
|
+
* 工作项执行状态枚举(对齐台账家族词汇;执行状态归声明档,属主手改)
|
|
168
|
+
*/
|
|
169
|
+
declare const WORK_ITEM_STATUSES: readonly ['todo', 'doing', 'blocked', 'done', 'dropped'];
|
|
170
|
+
/**
|
|
171
|
+
* 工作项执行状态类型
|
|
172
|
+
*/
|
|
173
|
+
type WorkItemStatus = (typeof WORK_ITEM_STATUSES)[number];
|
|
174
|
+
/**
|
|
175
|
+
* 工作项(解析后形态)
|
|
176
|
+
*/
|
|
177
|
+
type WorkflowItem = {
|
|
178
|
+
/**
|
|
179
|
+
* 工作项 id(工作流内唯一)
|
|
180
|
+
*/
|
|
181
|
+
readonly id: string;
|
|
182
|
+
/**
|
|
183
|
+
* 标题(人读)
|
|
184
|
+
*/
|
|
185
|
+
readonly title: string;
|
|
186
|
+
/**
|
|
187
|
+
* 指针(task 台账引用或 ref 路径引用)
|
|
188
|
+
*/
|
|
189
|
+
readonly ref: string;
|
|
190
|
+
/**
|
|
191
|
+
* 执行状态(声明档承载,属主维护)
|
|
192
|
+
*/
|
|
193
|
+
readonly status: WorkItemStatus;
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* 依赖边(解析后形态)
|
|
197
|
+
*/
|
|
198
|
+
type WorkflowEdge = {
|
|
199
|
+
/**
|
|
200
|
+
* 前置工作项 id
|
|
201
|
+
*/
|
|
202
|
+
readonly from: string;
|
|
203
|
+
/**
|
|
204
|
+
* 后继工作项 id
|
|
205
|
+
*/
|
|
206
|
+
readonly to: string;
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* 裁定事实(裁定段解析形态)
|
|
210
|
+
*/
|
|
211
|
+
type GateRuling = {
|
|
212
|
+
/**
|
|
213
|
+
* 裁定状态(pending 未裁;approved/rejected/escalated 已裁)
|
|
214
|
+
*/
|
|
215
|
+
readonly status: 'pending' | 'approved' | 'rejected' | 'escalated';
|
|
216
|
+
/**
|
|
217
|
+
* 决定者(已裁时携带)
|
|
218
|
+
*/
|
|
219
|
+
readonly decidedBy?: string;
|
|
220
|
+
/**
|
|
221
|
+
* 凭据指针(裁决记录文件路径等)
|
|
222
|
+
*/
|
|
223
|
+
readonly evidence?: string;
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* 裁定门(解析后形态)
|
|
227
|
+
*/
|
|
228
|
+
type WorkflowGate = {
|
|
229
|
+
/**
|
|
230
|
+
* 挂靠位置(工作项 id 或 `workflow` 工作流级)
|
|
231
|
+
*/
|
|
232
|
+
readonly at: string;
|
|
233
|
+
/**
|
|
234
|
+
* 门类型(如 ruling = 人类裁定门)
|
|
235
|
+
*/
|
|
236
|
+
readonly kind: string;
|
|
237
|
+
/**
|
|
238
|
+
* 说明(禁含管道符)
|
|
239
|
+
*/
|
|
240
|
+
readonly note: string;
|
|
241
|
+
/**
|
|
242
|
+
* 裁定事实(归声明档,裁定人维护)
|
|
243
|
+
*/
|
|
244
|
+
readonly ruling: GateRuling;
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* workflow 声明档 frontmatter schema(方言字符串数组 + 行内结构形态执法)
|
|
248
|
+
*/
|
|
249
|
+
declare const WorkflowDocFrontmatterSchema: z$1.ZodObject<{
|
|
250
|
+
id: z$1.ZodString;
|
|
251
|
+
title: z$1.ZodString;
|
|
252
|
+
status: z$1.ZodEnum<{
|
|
253
|
+
active: "active";
|
|
254
|
+
archived: "archived";
|
|
255
|
+
completed: "completed";
|
|
256
|
+
draft: "draft";
|
|
257
|
+
}>;
|
|
258
|
+
items: z$1.ZodArray<z$1.ZodString>;
|
|
259
|
+
edges: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
260
|
+
gates: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
261
|
+
}, z$1.core.$strict>;
|
|
262
|
+
/**
|
|
263
|
+
* 声明档 frontmatter 形态(schema 推断)
|
|
264
|
+
*/
|
|
265
|
+
type WorkflowDocFrontmatter = z$1.infer<typeof WorkflowDocFrontmatterSchema>;
|
|
266
|
+
/**
|
|
267
|
+
* 解析工作项行(四段制)
|
|
268
|
+
*
|
|
269
|
+
* @param line - 行内方言文本
|
|
270
|
+
* @returns 解析成功时为工作项形态,失败时为 null
|
|
271
|
+
*/
|
|
272
|
+
declare function parseItemLine(line: string): WorkflowItem | null;
|
|
273
|
+
/**
|
|
274
|
+
* 解析依赖边行
|
|
275
|
+
*
|
|
276
|
+
* @param line - 行内方言文本
|
|
277
|
+
* @returns 解析成功时为依赖边形态,失败时为 null
|
|
278
|
+
*/
|
|
279
|
+
declare function parseEdgeLine(line: string): WorkflowEdge | null;
|
|
280
|
+
/**
|
|
281
|
+
* 解析裁定段(`pending` 或 `<结果>:<决定者>:<凭据>`)
|
|
282
|
+
*
|
|
283
|
+
* @param segment - 裁定段文本
|
|
284
|
+
* @returns 解析成功时为裁定事实形态,失败时为 null
|
|
285
|
+
*/
|
|
286
|
+
declare function parseGateRuling(segment: string): GateRuling | null;
|
|
287
|
+
/**
|
|
288
|
+
* 解析裁定门行(四段制)
|
|
289
|
+
*
|
|
290
|
+
* @param line - 行内方言文本
|
|
291
|
+
* @returns 解析成功时为裁定门形态,失败时为 null
|
|
292
|
+
*/
|
|
293
|
+
declare function parseGateLine(line: string): WorkflowGate | null;
|
|
294
|
+
/**
|
|
295
|
+
* 家族引用(条目档 frontmatter 的 ref 字段值)
|
|
296
|
+
*/
|
|
297
|
+
declare const WORKFLOW_REF_PATTERN: RegExp;
|
|
298
|
+
//#endregion
|
|
299
|
+
//#region src/schemas/instance.schema.d.ts
|
|
300
|
+
declare const instanceStatusDtoSchema: z.ZodEnum<{
|
|
301
|
+
cancelled: "cancelled";
|
|
302
|
+
completed: "completed";
|
|
303
|
+
failed: "failed";
|
|
304
|
+
paused: "paused";
|
|
305
|
+
pending: "pending";
|
|
306
|
+
running: "running";
|
|
307
|
+
}>;
|
|
308
|
+
declare const nodeExecutionStatusDtoSchema: z.ZodEnum<{
|
|
309
|
+
completed: "completed";
|
|
310
|
+
failed: "failed";
|
|
311
|
+
pending: "pending";
|
|
312
|
+
running: "running";
|
|
313
|
+
skipped: "skipped";
|
|
314
|
+
}>;
|
|
315
|
+
declare const nodeExecutionDtoSchema: z.ZodObject<{
|
|
316
|
+
id: z.ZodString;
|
|
317
|
+
instanceId: z.ZodString;
|
|
318
|
+
nodeId: z.ZodString;
|
|
319
|
+
nodeName: z.ZodString;
|
|
320
|
+
nodeType: z.ZodString;
|
|
321
|
+
status: z.ZodEnum<{
|
|
322
|
+
completed: "completed";
|
|
323
|
+
failed: "failed";
|
|
324
|
+
pending: "pending";
|
|
325
|
+
running: "running";
|
|
326
|
+
skipped: "skipped";
|
|
327
|
+
}>;
|
|
328
|
+
startedAt: z.ZodNullable<z.ZodString>;
|
|
329
|
+
completedAt: z.ZodNullable<z.ZodString>;
|
|
330
|
+
error: z.ZodNullable<z.ZodString>;
|
|
331
|
+
createdAt: z.ZodString;
|
|
332
|
+
}, z.core.$strip>;
|
|
333
|
+
declare const instanceDtoSchema: z.ZodObject<{
|
|
334
|
+
id: z.ZodString;
|
|
335
|
+
definitionId: z.ZodString;
|
|
336
|
+
definitionVersion: z.ZodNumber;
|
|
337
|
+
status: z.ZodEnum<{
|
|
338
|
+
cancelled: "cancelled";
|
|
339
|
+
completed: "completed";
|
|
340
|
+
failed: "failed";
|
|
341
|
+
paused: "paused";
|
|
342
|
+
pending: "pending";
|
|
343
|
+
running: "running";
|
|
344
|
+
}>;
|
|
345
|
+
currentState: z.ZodString;
|
|
346
|
+
previousState: z.ZodNullable<z.ZodString>;
|
|
347
|
+
currentNodeId: z.ZodNullable<z.ZodString>;
|
|
348
|
+
variables: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
349
|
+
startedAt: z.ZodNullable<z.ZodString>;
|
|
350
|
+
completedAt: z.ZodNullable<z.ZodString>;
|
|
351
|
+
createdAt: z.ZodString;
|
|
352
|
+
updatedAt: z.ZodString;
|
|
353
|
+
}, z.core.$strip>;
|
|
354
|
+
declare const createInstanceInputSchema: z.ZodObject<{
|
|
355
|
+
definitionId: z.ZodString;
|
|
356
|
+
input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
357
|
+
}, z.core.$strip>;
|
|
358
|
+
declare const instanceQueryParamsSchema: z.ZodObject<{
|
|
359
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
360
|
+
cancelled: "cancelled";
|
|
361
|
+
completed: "completed";
|
|
362
|
+
failed: "failed";
|
|
363
|
+
paused: "paused";
|
|
364
|
+
pending: "pending";
|
|
365
|
+
running: "running";
|
|
366
|
+
}>>;
|
|
367
|
+
definitionId: z.ZodOptional<z.ZodString>;
|
|
368
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
369
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
370
|
+
}, z.core.$strip>;
|
|
371
|
+
//#endregion
|
|
372
|
+
//#region src/schemas/trigger.schema.d.ts
|
|
373
|
+
declare const triggerTypeDtoSchema: z.ZodEnum<{
|
|
374
|
+
event: "event";
|
|
375
|
+
"feed.event": "feed.event";
|
|
376
|
+
timer: "timer";
|
|
377
|
+
webhook: "webhook";
|
|
378
|
+
}>;
|
|
379
|
+
declare const triggerDtoSchema: z.ZodObject<{
|
|
380
|
+
id: z.ZodString;
|
|
381
|
+
definitionId: z.ZodString;
|
|
382
|
+
name: z.ZodString;
|
|
383
|
+
type: z.ZodEnum<{
|
|
384
|
+
event: "event";
|
|
385
|
+
"feed.event": "feed.event";
|
|
386
|
+
timer: "timer";
|
|
387
|
+
webhook: "webhook";
|
|
388
|
+
}>;
|
|
389
|
+
config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
390
|
+
enabled: z.ZodBoolean;
|
|
391
|
+
lastTriggeredAt: z.ZodNullable<z.ZodString>;
|
|
392
|
+
createdAt: z.ZodString;
|
|
393
|
+
updatedAt: z.ZodString;
|
|
394
|
+
}, z.core.$strip>;
|
|
395
|
+
declare const createTriggerInputSchema: z.ZodObject<{
|
|
396
|
+
definitionId: z.ZodString;
|
|
397
|
+
name: z.ZodString;
|
|
398
|
+
type: z.ZodEnum<{
|
|
399
|
+
event: "event";
|
|
400
|
+
"feed.event": "feed.event";
|
|
401
|
+
timer: "timer";
|
|
402
|
+
webhook: "webhook";
|
|
403
|
+
}>;
|
|
404
|
+
config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
405
|
+
}, z.core.$strip>;
|
|
406
|
+
declare const updateTriggerInputSchema: z.ZodObject<{
|
|
407
|
+
definitionId: z.ZodOptional<z.ZodString>;
|
|
408
|
+
name: z.ZodOptional<z.ZodString>;
|
|
409
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
410
|
+
event: "event";
|
|
411
|
+
"feed.event": "feed.event";
|
|
412
|
+
timer: "timer";
|
|
413
|
+
webhook: "webhook";
|
|
414
|
+
}>>;
|
|
415
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
416
|
+
}, z.core.$strip>;
|
|
417
|
+
//#endregion
|
|
418
|
+
//#region src/schemas/monitoring.schema.d.ts
|
|
419
|
+
declare const alertTypeDtoSchema: z.ZodEnum<{
|
|
420
|
+
failure_rate: "failure_rate";
|
|
421
|
+
slow_execution: "slow_execution";
|
|
422
|
+
timeout: "timeout";
|
|
423
|
+
}>;
|
|
424
|
+
declare const metricTypeDtoSchema: z.ZodEnum<{
|
|
425
|
+
avg_duration: "avg_duration";
|
|
426
|
+
failure_rate: "failure_rate";
|
|
427
|
+
instance_count: "instance_count";
|
|
428
|
+
success_rate: "success_rate";
|
|
429
|
+
timeout_rate: "timeout_rate";
|
|
430
|
+
}>;
|
|
431
|
+
declare const auditLogDtoSchema: z.ZodObject<{
|
|
432
|
+
id: z.ZodString;
|
|
433
|
+
instanceId: z.ZodString;
|
|
434
|
+
nodeId: z.ZodNullable<z.ZodString>;
|
|
435
|
+
action: z.ZodString;
|
|
436
|
+
fromStatus: z.ZodNullable<z.ZodString>;
|
|
437
|
+
toStatus: z.ZodString;
|
|
438
|
+
operator: z.ZodNullable<z.ZodString>;
|
|
439
|
+
detail: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
440
|
+
createdAt: z.ZodString;
|
|
441
|
+
}, z.core.$strip>;
|
|
442
|
+
declare const alertDtoSchema: z.ZodObject<{
|
|
443
|
+
id: z.ZodString;
|
|
444
|
+
definitionId: z.ZodString;
|
|
445
|
+
type: z.ZodEnum<{
|
|
446
|
+
failure_rate: "failure_rate";
|
|
447
|
+
slow_execution: "slow_execution";
|
|
448
|
+
timeout: "timeout";
|
|
449
|
+
}>;
|
|
450
|
+
threshold: z.ZodNumber;
|
|
451
|
+
notifyConfig: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
452
|
+
enabled: z.ZodBoolean;
|
|
453
|
+
lastTriggeredAt: z.ZodNullable<z.ZodString>;
|
|
454
|
+
createdAt: z.ZodString;
|
|
455
|
+
updatedAt: z.ZodString;
|
|
456
|
+
}, z.core.$strip>;
|
|
457
|
+
declare const performanceMetricDtoSchema: z.ZodObject<{
|
|
458
|
+
id: z.ZodString;
|
|
459
|
+
definitionId: z.ZodString;
|
|
460
|
+
metricType: z.ZodEnum<{
|
|
461
|
+
avg_duration: "avg_duration";
|
|
462
|
+
failure_rate: "failure_rate";
|
|
463
|
+
instance_count: "instance_count";
|
|
464
|
+
success_rate: "success_rate";
|
|
465
|
+
timeout_rate: "timeout_rate";
|
|
466
|
+
}>;
|
|
467
|
+
value: z.ZodNumber;
|
|
468
|
+
period: z.ZodString;
|
|
469
|
+
calculatedAt: z.ZodString;
|
|
470
|
+
}, z.core.$strip>;
|
|
471
|
+
declare const trendPointDtoSchema: z.ZodObject<{
|
|
472
|
+
date: z.ZodString;
|
|
473
|
+
value: z.ZodNumber;
|
|
474
|
+
}, z.core.$strip>;
|
|
475
|
+
declare const monitoringDashboardDtoSchema: z.ZodObject<{
|
|
476
|
+
runningInstances: z.ZodNumber;
|
|
477
|
+
successRate: z.ZodNumber;
|
|
478
|
+
avgDuration: z.ZodNumber;
|
|
479
|
+
failureAlerts: z.ZodNumber;
|
|
480
|
+
trend: z.ZodArray<z.ZodObject<{
|
|
481
|
+
date: z.ZodString;
|
|
482
|
+
value: z.ZodNumber;
|
|
483
|
+
}, z.core.$strip>>;
|
|
484
|
+
}, z.core.$strip>;
|
|
485
|
+
//#endregion
|
|
486
|
+
//#region src/schemas/feed-event-trigger.schema.d.ts
|
|
487
|
+
/**
|
|
488
|
+
* feed 事件名称 Schema
|
|
489
|
+
*
|
|
490
|
+
* 枚举 feed 项目暴露的可订阅事件名称。
|
|
491
|
+
*/
|
|
492
|
+
declare const feedEventNameSchema: z.ZodEnum<{
|
|
493
|
+
"industry.detected": "industry.detected";
|
|
494
|
+
"item.filtered": "item.filtered";
|
|
495
|
+
"item.ingested": "item.ingested";
|
|
496
|
+
"source.fetched": "source.fetched";
|
|
497
|
+
}>;
|
|
498
|
+
/**
|
|
499
|
+
* feed 事件过滤条件 Schema
|
|
500
|
+
*
|
|
501
|
+
* 用于在订阅 feed 事件时按信息源、订阅、行业、标签过滤,
|
|
502
|
+
* 仅匹配的事件才会触发工作流。
|
|
503
|
+
*/
|
|
504
|
+
declare const feedEventFilterSchema: z.ZodOptional<z.ZodObject<{
|
|
505
|
+
sourceId: z.ZodOptional<z.ZodString>;
|
|
506
|
+
subscriptionId: z.ZodOptional<z.ZodString>;
|
|
507
|
+
industry: z.ZodOptional<z.ZodString>;
|
|
508
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
509
|
+
}, z.core.$strip>>;
|
|
510
|
+
/**
|
|
511
|
+
* feed 事件触发器配置 Schema
|
|
512
|
+
*
|
|
513
|
+
* 工作流 trigger.type 为 'feed.event' 时的配置结构,
|
|
514
|
+
* 描述订阅的事件名称与可选过滤条件。
|
|
515
|
+
*/
|
|
516
|
+
declare const feedEventTriggerSchema: z.ZodObject<{
|
|
517
|
+
type: z.ZodLiteral<"feed.event">;
|
|
518
|
+
eventName: z.ZodEnum<{
|
|
519
|
+
"industry.detected": "industry.detected";
|
|
520
|
+
"item.filtered": "item.filtered";
|
|
521
|
+
"item.ingested": "item.ingested";
|
|
522
|
+
"source.fetched": "source.fetched";
|
|
523
|
+
}>;
|
|
524
|
+
filter: z.ZodOptional<z.ZodObject<{
|
|
525
|
+
sourceId: z.ZodOptional<z.ZodString>;
|
|
526
|
+
subscriptionId: z.ZodOptional<z.ZodString>;
|
|
527
|
+
industry: z.ZodOptional<z.ZodString>;
|
|
528
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
529
|
+
}, z.core.$strip>>;
|
|
530
|
+
}, z.core.$strip>;
|
|
531
|
+
/**
|
|
532
|
+
* feed 事件 payload Schema
|
|
533
|
+
*
|
|
534
|
+
* feed 项目 F-2 在事件触发时传递给工作流上下文的事件数据结构。
|
|
535
|
+
*/
|
|
536
|
+
declare const feedEventPayloadSchema: z.ZodObject<{
|
|
537
|
+
eventName: z.ZodEnum<{
|
|
538
|
+
"industry.detected": "industry.detected";
|
|
539
|
+
"item.filtered": "item.filtered";
|
|
540
|
+
"item.ingested": "item.ingested";
|
|
541
|
+
"source.fetched": "source.fetched";
|
|
542
|
+
}>;
|
|
543
|
+
itemId: z.ZodOptional<z.ZodString>;
|
|
544
|
+
sourceId: z.ZodOptional<z.ZodString>;
|
|
545
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
546
|
+
}, z.core.$strip>;
|
|
547
|
+
//#endregion
|
|
548
|
+
//#region src/schemas/action-executor.schema.d.ts
|
|
549
|
+
/**
|
|
550
|
+
* action 类型 Schema
|
|
551
|
+
*
|
|
552
|
+
* 内置 action 类型枚举。
|
|
553
|
+
*/
|
|
554
|
+
declare const actionTypeSchema: z.ZodEnum<{
|
|
555
|
+
"feed.applyTags": "feed.applyTags";
|
|
556
|
+
"feed.summarize": "feed.summarize";
|
|
557
|
+
"llm.complete": "llm.complete";
|
|
558
|
+
"webhook.send": "webhook.send";
|
|
559
|
+
}>;
|
|
560
|
+
/**
|
|
561
|
+
* feed.applyTags action 输入 Schema
|
|
562
|
+
*
|
|
563
|
+
* 调用 feed F-2 applyTags 为指定条目打标签。
|
|
564
|
+
*/
|
|
565
|
+
declare const feedApplyTagsActionSchema: z.ZodObject<{
|
|
566
|
+
type: z.ZodLiteral<"feed.applyTags">;
|
|
567
|
+
itemId: z.ZodString;
|
|
568
|
+
tags: z.ZodArray<z.ZodString>;
|
|
569
|
+
source: z.ZodOptional<z.ZodEnum<{
|
|
570
|
+
manual: "manual";
|
|
571
|
+
rule: "rule";
|
|
572
|
+
workflow: "workflow";
|
|
573
|
+
}>>;
|
|
574
|
+
}, z.core.$strip>;
|
|
575
|
+
/**
|
|
576
|
+
* feed.summarize action 输入 Schema
|
|
577
|
+
*
|
|
578
|
+
* 调用 feed F-3 summarize 生成指定条目的摘要。
|
|
579
|
+
*/
|
|
580
|
+
declare const feedSummarizeActionSchema: z.ZodObject<{
|
|
581
|
+
type: z.ZodLiteral<"feed.summarize">;
|
|
582
|
+
itemId: z.ZodString;
|
|
583
|
+
level: z.ZodEnum<{
|
|
584
|
+
micro: "micro";
|
|
585
|
+
short: "short";
|
|
586
|
+
structured: "structured";
|
|
587
|
+
}>;
|
|
588
|
+
}, z.core.$strip>;
|
|
589
|
+
/**
|
|
590
|
+
* llm.complete action 输入 Schema
|
|
591
|
+
*
|
|
592
|
+
* 调用 agent LlmCompletePort 完成文本生成。
|
|
593
|
+
* D-07 决策:默认走 anthropic provider。
|
|
594
|
+
*/
|
|
595
|
+
declare const llmCompleteActionSchema: z.ZodObject<{
|
|
596
|
+
type: z.ZodLiteral<"llm.complete">;
|
|
597
|
+
prompt: z.ZodString;
|
|
598
|
+
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
599
|
+
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
600
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
601
|
+
}, z.core.$strip>;
|
|
602
|
+
/**
|
|
603
|
+
* webhook.send action 输入 Schema
|
|
604
|
+
*
|
|
605
|
+
* 调用 webhook 项目发送 webhook 请求。
|
|
606
|
+
*/
|
|
607
|
+
declare const webhookSendActionSchema: z.ZodObject<{
|
|
608
|
+
type: z.ZodLiteral<"webhook.send">;
|
|
609
|
+
url: z.ZodString;
|
|
610
|
+
method: z.ZodOptional<z.ZodEnum<{
|
|
611
|
+
DELETE: "DELETE";
|
|
612
|
+
GET: "GET";
|
|
613
|
+
PATCH: "PATCH";
|
|
614
|
+
POST: "POST";
|
|
615
|
+
PUT: "PUT";
|
|
616
|
+
}>>;
|
|
617
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
618
|
+
body: z.ZodOptional<z.ZodUnknown>;
|
|
619
|
+
}, z.core.$strip>;
|
|
620
|
+
/**
|
|
621
|
+
* action 联合类型 Schema
|
|
622
|
+
*
|
|
623
|
+
* 通过 discriminatedUnion 按 type 字段区分具体 action 类型。
|
|
624
|
+
*/
|
|
625
|
+
declare const actionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
626
|
+
type: z.ZodLiteral<"feed.applyTags">;
|
|
627
|
+
itemId: z.ZodString;
|
|
628
|
+
tags: z.ZodArray<z.ZodString>;
|
|
629
|
+
source: z.ZodOptional<z.ZodEnum<{
|
|
630
|
+
manual: "manual";
|
|
631
|
+
rule: "rule";
|
|
632
|
+
workflow: "workflow";
|
|
633
|
+
}>>;
|
|
634
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
635
|
+
type: z.ZodLiteral<"feed.summarize">;
|
|
636
|
+
itemId: z.ZodString;
|
|
637
|
+
level: z.ZodEnum<{
|
|
638
|
+
micro: "micro";
|
|
639
|
+
short: "short";
|
|
640
|
+
structured: "structured";
|
|
641
|
+
}>;
|
|
642
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
643
|
+
type: z.ZodLiteral<"llm.complete">;
|
|
644
|
+
prompt: z.ZodString;
|
|
645
|
+
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
646
|
+
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
647
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
648
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
649
|
+
type: z.ZodLiteral<"webhook.send">;
|
|
650
|
+
url: z.ZodString;
|
|
651
|
+
method: z.ZodOptional<z.ZodEnum<{
|
|
652
|
+
DELETE: "DELETE";
|
|
653
|
+
GET: "GET";
|
|
654
|
+
PATCH: "PATCH";
|
|
655
|
+
POST: "POST";
|
|
656
|
+
PUT: "PUT";
|
|
657
|
+
}>>;
|
|
658
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
659
|
+
body: z.ZodOptional<z.ZodUnknown>;
|
|
660
|
+
}, z.core.$strip>], "type">;
|
|
661
|
+
/**
|
|
662
|
+
* action 执行上下文 Schema
|
|
663
|
+
*
|
|
664
|
+
* 工作流引擎在执行 action 节点时传入的上下文信息。
|
|
665
|
+
*/
|
|
666
|
+
declare const actionContextSchema: z.ZodObject<{
|
|
667
|
+
instanceId: z.ZodString;
|
|
668
|
+
definitionId: z.ZodString;
|
|
669
|
+
nodeId: z.ZodString;
|
|
670
|
+
variables: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
671
|
+
input: z.ZodUnknown;
|
|
672
|
+
}, z.core.$strip>;
|
|
673
|
+
/**
|
|
674
|
+
* action 执行结果 Schema
|
|
675
|
+
*
|
|
676
|
+
* action handler 执行完成后返回的结果。
|
|
677
|
+
*/
|
|
678
|
+
declare const actionResultSchema: z.ZodObject<{
|
|
679
|
+
success: z.ZodBoolean;
|
|
680
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
681
|
+
error: z.ZodOptional<z.ZodString>;
|
|
682
|
+
}, z.core.$strip>;
|
|
683
|
+
//#endregion
|
|
684
|
+
export { GateRuling, WORKFLOW_REF_PATTERN, WORK_ITEM_STATUSES, WorkItemStatus, WorkflowDocFrontmatter, WorkflowDocFrontmatterSchema, WorkflowEdge, WorkflowGate, WorkflowItem, actionContextSchema, actionResultSchema, actionSchema, actionTypeSchema, alertDtoSchema, alertTypeDtoSchema, auditLogDtoSchema, createDefinitionInputSchema, createInstanceInputSchema, createTriggerInputSchema, definitionDtoSchema, feedApplyTagsActionSchema, feedEventFilterSchema, feedEventNameSchema, feedEventPayloadSchema, feedEventTriggerSchema, feedSummarizeActionSchema, instanceDtoSchema, instanceQueryParamsSchema, instanceStatusDtoSchema, llmCompleteActionSchema, metricTypeDtoSchema, monitoringDashboardDtoSchema, nodeExecutionDtoSchema, nodeExecutionStatusDtoSchema, parseEdgeLine, parseGateLine, parseGateRuling, parseItemLine, performanceMetricDtoSchema, stateTransitionDtoSchema, trendPointDtoSchema, triggerDtoSchema, triggerTypeDtoSchema, updateDefinitionInputSchema, updateTriggerInputSchema, webhookSendActionSchema, workflowEdgeDtoSchema, workflowNodeDtoSchema };
|
package/dist/schemas.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as e,B as t,C as n,D as r,E as i,F as a,H as o,I as s,L as c,M as l,N as u,O as d,P as f,R as p,S as m,T as h,V as g,_,a as v,b as y,c as b,d as x,f as S,g as C,h as w,i as T,j as E,k as D,l as O,m as k,n as A,o as j,p as M,r as N,s as P,t as F,u as I,v as L,w as R,x as z,y as B,z as V}from"./schemas-D0Zuq8_5.js";export{e as WORKFLOW_REF_PATTERN,E as WORK_ITEM_STATUSES,l as WorkflowDocFrontmatterSchema,F as actionContextSchema,A as actionResultSchema,N as actionSchema,T as actionTypeSchema,M as alertDtoSchema,k as alertTypeDtoSchema,w as auditLogDtoSchema,c as createDefinitionInputSchema,R as createInstanceInputSchema,y as createTriggerInputSchema,p as definitionDtoSchema,v as feedApplyTagsActionSchema,O as feedEventFilterSchema,I as feedEventNameSchema,x as feedEventPayloadSchema,S as feedEventTriggerSchema,j as feedSummarizeActionSchema,h as instanceDtoSchema,i as instanceQueryParamsSchema,r as instanceStatusDtoSchema,P as llmCompleteActionSchema,C as metricTypeDtoSchema,_ as monitoringDashboardDtoSchema,d as nodeExecutionDtoSchema,D as nodeExecutionStatusDtoSchema,u as parseEdgeLine,f as parseGateLine,a as parseGateRuling,s as parseItemLine,L as performanceMetricDtoSchema,V as stateTransitionDtoSchema,B as trendPointDtoSchema,z as triggerDtoSchema,m as triggerTypeDtoSchema,t as updateDefinitionInputSchema,n as updateTriggerInputSchema,b as webhookSendActionSchema,g as workflowEdgeDtoSchema,o as workflowNodeDtoSchema};
|
package/docs/overview.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# 仓内概述(workflow core overview)
|
|
2
|
+
|
|
3
|
+
> 承接自 README 的介绍细节(README 发布口径精简迁移);本文件为仓内内部文档,不随包发布,仓内互链合法。
|
|
4
|
+
|
|
5
|
+
## 定位(承接)
|
|
6
|
+
|
|
7
|
+
位于项目分层架构的最底层,不依赖任何技术框架,仅依赖共享内核与 Zod。被四个领域 contract 与 API 契约层(packages/api/core)引用,作为整个项目共享类型与端口定义的单一事实来源。(整改前 README 所列被 packages/sdk、packages/elysia、packages/adapters/memory 引用为历史形态,上述包已不在当前结构中,按当前依赖面更正留痕。)
|
|
8
|
+
|
|
9
|
+
## 实现情况(承接)
|
|
10
|
+
|
|
11
|
+
已实现全部共享类型、Schema、常量与端口导出;纯类型与常量层包,随领域演进持续补充。
|
|
12
|
+
|
|
13
|
+
## 实现细节(承接)
|
|
14
|
+
|
|
15
|
+
- 校验 Schema 基于 Zod 构建,静态类型与运行时校验同源。
|
|
16
|
+
- 运行时依赖:`@longzai-intelligence-shared-kernel/core` 与 `zod`(见本包 package.json)。
|
|
17
|
+
- 导出入口分 `.` 与 `./schemas` 两个子路径,Schema 可单独按需引入。
|