@longzai-intelligence-workflow/core 0.0.1 → 0.0.5

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.
Files changed (48) hide show
  1. package/.turbo/turbo-build.log +5 -0
  2. package/.turbo/turbo-lint.log +1305 -0
  3. package/.turbo/turbo-typecheck.log +12 -0
  4. package/CHANGELOG.md +24 -1
  5. package/coverage/.lcov.info.09bb1f2a9aba2380.tmp +169 -0
  6. package/coverage/.lcov.info.0e095d78ac9192b0.tmp +329 -0
  7. package/coverage/.lcov.info.53a7ebfa7c8664ce.tmp +12 -0
  8. package/coverage/.lcov.info.6ea86c7cbc796fe0.tmp +12 -0
  9. package/coverage/.lcov.info.8f2985e5b3ad22cc.tmp +329 -0
  10. package/coverage/.lcov.info.a6ce2b7c3df2438b.tmp +228 -0
  11. package/coverage/.lcov.info.cc45f2f81aa7e02f.tmp +12 -0
  12. package/coverage/.lcov.info.cd0e8c028b2d5097.tmp +329 -0
  13. package/coverage/.lcov.info.dae76ebcf998e663.tmp +12 -0
  14. package/coverage/.lcov.info.e3bdb201eb5ce330.tmp +170 -0
  15. package/coverage/.lcov.info.e54e42fa06f69854.tmp +12 -0
  16. package/coverage/.lcov.info.f3e7537ac7b81e07.tmp +12 -0
  17. package/coverage/.lcov.info.fbb8af17757faa2d.tmp +329 -0
  18. package/coverage/lcov.info +208 -48
  19. package/dist/index.d.ts +3 -29
  20. package/dist/index.js +3 -3
  21. package/docs/overview.md +1 -1
  22. package/package.json +2 -1
  23. package/src/__tests__/unit/constants.test.ts +75 -30
  24. package/src/__tests__/unit/utils.test.ts +110 -38
  25. package/src/__tests__/work-item-rules.test.ts +18 -5
  26. package/src/index.ts +19 -5
  27. package/src/ports/action-executor.port.ts +2 -1
  28. package/src/ports/feed-event.port.ts +1 -1
  29. package/src/ports/index.ts +1 -0
  30. package/src/schemas/action-executor.schema.ts +2 -1
  31. package/src/schemas/definition.schema.ts +1 -1
  32. package/src/schemas/feed-event-trigger.schema.ts +1 -1
  33. package/src/schemas/index.ts +7 -0
  34. package/src/schemas/instance.schema.ts +1 -1
  35. package/src/schemas/monitoring.schema.ts +1 -1
  36. package/src/schemas/trigger.schema.ts +1 -1
  37. package/src/schemas/workflow-doc.schema.ts +4 -2
  38. package/src/types/action-executor.ts +1 -1
  39. package/src/types/feed-event-trigger.ts +1 -1
  40. package/src/types/index.ts +5 -0
  41. package/src/utils/dag.utils.ts +14 -93
  42. package/src/utils/index.ts +4 -2
  43. package/src/utils/work-item-rules.utils.ts +28 -7
  44. package/tsconfig/.cache/build.tsbuildinfo +1 -1
  45. package/tsconfig/.cache/node.tsbuildinfo +1 -1
  46. package/tsconfig/.cache/test.tsbuildinfo +1 -1
  47. package/tsconfig/node.json +1 -1
  48. package/tsconfig.json +9 -1
@@ -0,0 +1,329 @@
1
+ TN:
2
+ SF:src/__tests__/helpers/setup.ts
3
+ FNF:3
4
+ FNH:3
5
+ DA:1,58
6
+ DA:3,32
7
+ DA:5,18
8
+ DA:7,17
9
+ DA:9,17
10
+ LF:5
11
+ LH:5
12
+ end_of_record
13
+ TN:
14
+ SF:src/constants/workflow.ts
15
+ FNF:1
16
+ FNH:1
17
+ DA:4,28
18
+ DA:5,15
19
+ DA:6,13
20
+ DA:7,13
21
+ DA:8,16
22
+ DA:9,21
23
+ DA:10,20
24
+ DA:11,21
25
+ DA:12,15
26
+ DA:13,15
27
+ DA:14,15
28
+ DA:15,14
29
+ DA:16,2
30
+ DA:21,35
31
+ DA:22,12
32
+ DA:23,12
33
+ DA:24,11
34
+ DA:25,14
35
+ DA:26,14
36
+ DA:27,9
37
+ DA:28,2
38
+ DA:33,41
39
+ DA:34,12
40
+ DA:35,12
41
+ DA:36,14
42
+ DA:37,11
43
+ DA:38,10
44
+ DA:39,2
45
+ DA:44,73
46
+ DA:51,34
47
+ DA:55,18
48
+ DA:60,19
49
+ DA:65,18
50
+ DA:70,20
51
+ DA:71,2
52
+ DA:76,73
53
+ DA:88,30
54
+ DA:89,19
55
+ DA:90,19
56
+ DA:91,17
57
+ DA:92,15
58
+ DA:93,2
59
+ DA:98,30
60
+ DA:99,17
61
+ DA:100,17
62
+ DA:101,17
63
+ DA:102,17
64
+ DA:103,17
65
+ DA:104,2
66
+ DA:109,36
67
+ DA:114,32
68
+ LF:51
69
+ LH:51
70
+ end_of_record
71
+ TN:
72
+ SF:src/schemas/workflow-doc.schema.ts
73
+ FNF:4
74
+ FNH:3
75
+ DA:9,25
76
+ DA:14,82
77
+ DA:24,51
78
+ DA:29,113
79
+ DA:34,36
80
+ DA:35,107
81
+ DA:36,3
82
+ DA:41,97
83
+ DA:46,25
84
+ DA:47,137
85
+ DA:52,82
86
+ DA:142,61
87
+ DA:146,38
88
+ DA:151,27
89
+ DA:156,63
90
+ DA:161,29
91
+ DA:166,60
92
+ DA:171,38
93
+ DA:172,3
94
+ DA:185,15
95
+ DA:189,47
96
+ DA:190,18
97
+ DA:191,11
98
+ DA:192,2
99
+ DA:197,24
100
+ DA:202,27
101
+ DA:207,25
102
+ DA:212,28
103
+ DA:213,89
104
+ DA:214,0
105
+ DA:215,2
106
+ DA:220,59
107
+ DA:225,64
108
+ DA:226,27
109
+ DA:227,0
110
+ DA:228,2
111
+ DA:229,54
112
+ DA:238,0
113
+ DA:239,0
114
+ DA:240,0
115
+ DA:241,0
116
+ DA:242,0
117
+ DA:243,0
118
+ DA:244,0
119
+ DA:245,0
120
+ DA:246,0
121
+ DA:247,0
122
+ DA:248,0
123
+ DA:249,0
124
+ DA:250,0
125
+ DA:251,0
126
+ DA:252,0
127
+ DA:253,0
128
+ DA:254,0
129
+ DA:255,0
130
+ DA:256,0
131
+ DA:257,0
132
+ DA:258,0
133
+ DA:259,1
134
+ DA:268,18
135
+ DA:272,52
136
+ DA:273,13
137
+ DA:274,0
138
+ DA:275,2
139
+ DA:280,42
140
+ DA:281,25
141
+ DA:282,0
142
+ DA:283,2
143
+ DA:288,91
144
+ DA:293,66
145
+ DA:294,27
146
+ DA:295,0
147
+ DA:296,2
148
+ DA:301,31
149
+ DA:306,30
150
+ DA:307,12
151
+ DA:308,34
152
+ DA:309,49
153
+ DA:310,41
154
+ DA:311,2
155
+ DA:320,15
156
+ DA:324,47
157
+ DA:325,18
158
+ DA:326,11
159
+ DA:327,2
160
+ DA:332,24
161
+ DA:337,26
162
+ DA:342,26
163
+ DA:347,35
164
+ DA:348,96
165
+ DA:349,0
166
+ DA:350,2
167
+ DA:355,48
168
+ DA:356,20
169
+ DA:357,0
170
+ DA:358,2
171
+ DA:359,34
172
+ DA:365,104
173
+ LF:98
174
+ LH:70
175
+ end_of_record
176
+ TN:
177
+ SF:src/utils/dag.utils.ts
178
+ FNF:1
179
+ FNH:1
180
+ DA:4,196
181
+ LF:1
182
+ LH:1
183
+ end_of_record
184
+ TN:
185
+ SF:src/utils/declaration-frontmatter.utils.ts
186
+ FNF:3
187
+ FNH:0
188
+ DA:34,0
189
+ DA:35,0
190
+ DA:36,0
191
+ DA:37,0
192
+ DA:38,0
193
+ DA:39,0
194
+ DA:40,0
195
+ DA:50,0
196
+ DA:51,0
197
+ DA:52,0
198
+ DA:53,0
199
+ DA:54,0
200
+ DA:55,0
201
+ DA:56,0
202
+ DA:57,0
203
+ DA:58,0
204
+ DA:59,0
205
+ DA:60,0
206
+ DA:61,0
207
+ DA:62,1
208
+ DA:71,0
209
+ DA:72,0
210
+ DA:73,0
211
+ DA:74,0
212
+ DA:75,0
213
+ DA:76,0
214
+ DA:77,0
215
+ DA:78,0
216
+ DA:79,0
217
+ DA:80,0
218
+ DA:81,0
219
+ DA:82,0
220
+ DA:83,0
221
+ DA:84,0
222
+ DA:85,0
223
+ DA:86,0
224
+ DA:87,0
225
+ DA:88,0
226
+ DA:89,0
227
+ DA:90,0
228
+ DA:91,0
229
+ DA:92,0
230
+ DA:93,0
231
+ DA:94,0
232
+ DA:95,0
233
+ DA:96,0
234
+ DA:97,0
235
+ DA:98,0
236
+ DA:99,0
237
+ DA:100,0
238
+ DA:101,0
239
+ DA:102,0
240
+ DA:103,0
241
+ DA:104,0
242
+ DA:105,0
243
+ DA:106,0
244
+ DA:107,0
245
+ DA:108,0
246
+ DA:109,0
247
+ DA:110,0
248
+ DA:111,0
249
+ DA:112,0
250
+ DA:113,0
251
+ DA:114,0
252
+ DA:115,0
253
+ DA:116,0
254
+ DA:117,0
255
+ DA:118,0
256
+ DA:119,0
257
+ DA:120,0
258
+ DA:121,0
259
+ DA:122,0
260
+ DA:123,0
261
+ DA:124,0
262
+ DA:125,0
263
+ DA:126,0
264
+ DA:127,0
265
+ DA:128,0
266
+ DA:129,0
267
+ DA:130,0
268
+ DA:131,0
269
+ DA:132,0
270
+ DA:133,0
271
+ DA:134,0
272
+ DA:135,0
273
+ DA:136,0
274
+ LF:86
275
+ LH:1
276
+ end_of_record
277
+ TN:
278
+ SF:src/utils/work-item-rules.utils.ts
279
+ FNF:10
280
+ FNH:10
281
+ DA:7,65
282
+ DA:14,44
283
+ DA:15,40
284
+ DA:16,40
285
+ DA:17,40
286
+ DA:18,28
287
+ DA:19,18
288
+ DA:20,2
289
+ DA:44,19
290
+ DA:48,51
291
+ DA:49,26
292
+ DA:50,0
293
+ DA:51,2
294
+ DA:52,31
295
+ DA:53,164
296
+ DA:54,2
297
+ DA:55,11
298
+ DA:138,12
299
+ DA:139,49
300
+ DA:149,6
301
+ DA:150,7
302
+ DA:151,7
303
+ DA:152,7
304
+ DA:153,3
305
+ DA:157,93
306
+ DA:162,139
307
+ DA:167,38
308
+ DA:171,61
309
+ DA:173,14
310
+ DA:174,18
311
+ DA:175,26
312
+ DA:176,14
313
+ DA:177,64
314
+ DA:178,81
315
+ DA:179,1
316
+ DA:180,4
317
+ DA:185,29
318
+ DA:186,87
319
+ DA:187,19
320
+ DA:188,35
321
+ DA:189,16
322
+ DA:190,20
323
+ DA:191,20
324
+ DA:192,34
325
+ DA:193,5
326
+ DA:195,39
327
+ LF:46
328
+ LH:45
329
+ end_of_record
@@ -11,6 +11,64 @@ LF:5
11
11
  LH:5
12
12
  end_of_record
13
13
  TN:
14
+ SF:src/constants/workflow.ts
15
+ FNF:1
16
+ FNH:1
17
+ DA:4,28
18
+ DA:5,15
19
+ DA:6,13
20
+ DA:7,13
21
+ DA:8,16
22
+ DA:9,21
23
+ DA:10,20
24
+ DA:11,21
25
+ DA:12,15
26
+ DA:13,15
27
+ DA:14,15
28
+ DA:15,14
29
+ DA:16,2
30
+ DA:21,35
31
+ DA:22,12
32
+ DA:23,12
33
+ DA:24,11
34
+ DA:25,14
35
+ DA:26,14
36
+ DA:27,9
37
+ DA:28,2
38
+ DA:33,41
39
+ DA:34,12
40
+ DA:35,12
41
+ DA:36,14
42
+ DA:37,11
43
+ DA:38,10
44
+ DA:39,2
45
+ DA:44,73
46
+ DA:51,34
47
+ DA:55,18
48
+ DA:60,19
49
+ DA:65,18
50
+ DA:70,20
51
+ DA:71,2
52
+ DA:76,73
53
+ DA:88,30
54
+ DA:89,19
55
+ DA:90,19
56
+ DA:91,17
57
+ DA:92,15
58
+ DA:93,2
59
+ DA:98,30
60
+ DA:99,17
61
+ DA:100,17
62
+ DA:101,17
63
+ DA:102,17
64
+ DA:103,17
65
+ DA:104,2
66
+ DA:109,36
67
+ DA:114,32
68
+ LF:51
69
+ LH:51
70
+ end_of_record
71
+ TN:
14
72
  SF:src/schemas/workflow-doc.schema.ts
15
73
  FNF:4
16
74
  FNH:3
@@ -116,54 +174,156 @@ LF:98
116
174
  LH:70
117
175
  end_of_record
118
176
  TN:
177
+ SF:src/utils/dag.utils.ts
178
+ FNF:1
179
+ FNH:1
180
+ DA:4,196
181
+ LF:1
182
+ LH:1
183
+ end_of_record
184
+ TN:
185
+ SF:src/utils/declaration-frontmatter.utils.ts
186
+ FNF:3
187
+ FNH:0
188
+ DA:34,0
189
+ DA:35,0
190
+ DA:36,0
191
+ DA:37,0
192
+ DA:38,0
193
+ DA:39,0
194
+ DA:40,0
195
+ DA:50,0
196
+ DA:51,0
197
+ DA:52,0
198
+ DA:53,0
199
+ DA:54,0
200
+ DA:55,0
201
+ DA:56,0
202
+ DA:57,0
203
+ DA:58,0
204
+ DA:59,0
205
+ DA:60,0
206
+ DA:61,0
207
+ DA:62,1
208
+ DA:71,0
209
+ DA:72,0
210
+ DA:73,0
211
+ DA:74,0
212
+ DA:75,0
213
+ DA:76,0
214
+ DA:77,0
215
+ DA:78,0
216
+ DA:79,0
217
+ DA:80,0
218
+ DA:81,0
219
+ DA:82,0
220
+ DA:83,0
221
+ DA:84,0
222
+ DA:85,0
223
+ DA:86,0
224
+ DA:87,0
225
+ DA:88,0
226
+ DA:89,0
227
+ DA:90,0
228
+ DA:91,0
229
+ DA:92,0
230
+ DA:93,0
231
+ DA:94,0
232
+ DA:95,0
233
+ DA:96,0
234
+ DA:97,0
235
+ DA:98,0
236
+ DA:99,0
237
+ DA:100,0
238
+ DA:101,0
239
+ DA:102,0
240
+ DA:103,0
241
+ DA:104,0
242
+ DA:105,0
243
+ DA:106,0
244
+ DA:107,0
245
+ DA:108,0
246
+ DA:109,0
247
+ DA:110,0
248
+ DA:111,0
249
+ DA:112,0
250
+ DA:113,0
251
+ DA:114,0
252
+ DA:115,0
253
+ DA:116,0
254
+ DA:117,0
255
+ DA:118,0
256
+ DA:119,0
257
+ DA:120,0
258
+ DA:121,0
259
+ DA:122,0
260
+ DA:123,0
261
+ DA:124,0
262
+ DA:125,0
263
+ DA:126,0
264
+ DA:127,0
265
+ DA:128,0
266
+ DA:129,0
267
+ DA:130,0
268
+ DA:131,0
269
+ DA:132,0
270
+ DA:133,0
271
+ DA:134,0
272
+ DA:135,0
273
+ DA:136,0
274
+ LF:86
275
+ LH:1
276
+ end_of_record
277
+ TN:
119
278
  SF:src/utils/work-item-rules.utils.ts
120
- FNF:12
121
- FNH:12
122
- DA:12,44
123
- DA:13,40
124
- DA:14,40
279
+ FNF:10
280
+ FNH:10
281
+ DA:7,65
282
+ DA:14,44
125
283
  DA:15,40
126
- DA:16,28
127
- DA:17,18
128
- DA:18,2
129
- DA:42,19
130
- DA:46,51
131
- DA:47,26
132
- DA:48,0
133
- DA:49,2
134
- DA:50,31
135
- DA:51,164
136
- DA:52,2
137
- DA:53,11
138
- DA:136,12
139
- DA:137,49
140
- DA:147,6
141
- DA:148,7
142
- DA:149,7
143
- DA:150,7
144
- DA:151,3
145
- DA:155,93
146
- DA:160,139
147
- DA:165,38
148
- DA:169,100
149
- DA:171,14
150
- DA:172,18
151
- DA:173,26
152
- DA:174,14
153
- DA:175,64
154
- DA:176,81
155
- DA:177,1
156
- DA:178,4
157
- DA:183,29
158
- DA:184,87
159
- DA:185,19
160
- DA:186,35
161
- DA:187,16
162
- DA:188,20
163
- DA:189,20
164
- DA:190,34
165
- DA:191,5
166
- DA:193,39
167
- LF:45
168
- LH:44
284
+ DA:16,40
285
+ DA:17,40
286
+ DA:18,28
287
+ DA:19,18
288
+ DA:20,2
289
+ DA:44,19
290
+ DA:48,51
291
+ DA:49,26
292
+ DA:50,0
293
+ DA:51,2
294
+ DA:52,31
295
+ DA:53,164
296
+ DA:54,2
297
+ DA:55,11
298
+ DA:139,12
299
+ DA:140,49
300
+ DA:151,6
301
+ DA:152,7
302
+ DA:153,7
303
+ DA:154,7
304
+ DA:155,3
305
+ DA:159,93
306
+ DA:164,139
307
+ DA:169,38
308
+ DA:173,61
309
+ DA:175,14
310
+ DA:176,18
311
+ DA:177,26
312
+ DA:178,14
313
+ DA:179,64
314
+ DA:180,81
315
+ DA:181,1
316
+ DA:182,4
317
+ DA:187,29
318
+ DA:188,87
319
+ DA:189,19
320
+ DA:190,35
321
+ DA:191,16
322
+ DA:192,20
323
+ DA:193,20
324
+ DA:194,34
325
+ DA:195,5
326
+ DA:197,39
327
+ LF:46
328
+ LH:45
169
329
  end_of_record
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { 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 } from "./schemas.js";
2
+ import { DependencyEdge, EdgeIssue, areAllDependenciesMet, dependenciesMet, detectCycle, detectCycles, downstreamOf, nodesOf, topologicalLevels, topologicalSort, validateEdges } from "@longzai-intelligence-dag/core";
2
3
  import { z } from "zod";
3
4
  //#region src/types/definition.d.ts
4
5
  type DefinitionDTO = {
@@ -333,34 +334,6 @@ type ParsedDeclaration = {
333
334
  */
334
335
  declare function parseDeclaration(documentText: string): ParsedDeclaration;
335
336
  //#endregion
336
- //#region src/utils/dag.utils.d.ts
337
- /**
338
- * DAG 机件(环检测 + 拓扑分层 + 依赖满足判定)
339
- *
340
- * 共享基础(设计对齐 scheduler workflow 域已验证机件;真源归本包,禁止再镜像)。
341
- */
342
- /**
343
- * 依赖边(from 完成后 to 可启)
344
- */
345
- type DependencyEdge = {
346
- readonly from: string;
347
- readonly to: string;
348
- };
349
- /**
350
- * 环检测(DFS 三色标记;返回首个环路径,无环为 null)
351
- *
352
- * @param edges - 依赖边集合
353
- */
354
- declare function detectCycle(edges: readonly DependencyEdge[]): readonly string[] | null;
355
- /**
356
- * 依赖满足判定(全部前置达完成/验收才算满足;无前置视为满足)
357
- *
358
- * @param node - 目标工作项 id
359
- * @param edges - 依赖边集合
360
- * @param settled - 已闭环(完成/验收)的工作项集合
361
- */
362
- declare function dependenciesMet(node: string, edges: readonly DependencyEdge[], settled: ReadonlySet<string>): boolean;
363
- //#endregion
364
337
  //#region src/utils/work-item-rules.utils.d.ts
365
338
  /**
366
339
  * 工作项合法状态转移表(状态机唯一注册点;供编辑工具与判定器共用的规则真源)
@@ -456,6 +429,7 @@ type WorkflowView = {
456
429
  * @param items - 工作项清单(声明档现状)
457
430
  * @param edges - 依赖边清单
458
431
  * @param gates - 裁定门清单(含裁定事实)
432
+ * @returns 工作流声明视图,含全部工作项视图与未决裁定清单
459
433
  */
460
434
  declare function deriveWorkflowView(items: readonly WorkflowItem[], edges: readonly WorkflowEdge[], gates: readonly WorkflowGate[]): WorkflowView;
461
435
  //#endregion
@@ -574,4 +548,4 @@ type ActionExecutorPort = {
574
548
  */
575
549
  declare const ACTION_EXECUTOR_PORT_TOKEN: unique symbol;
576
550
  //#endregion
577
- export { ACTION_EXECUTOR_PORT_TOKEN, ACTION_TYPES, ALERT_TYPES, ALLOWED_STATUS_TRANSITIONS, Action, ActionContext, ActionExecutorPort, ActionHandler, ActionResult, ActionType, AlertDTO, AlertTypeDTO, AuditLogDTO, CreateDefinitionInput, CreateInstanceInput, CreateTriggerInput, DEFAULT_PAGE_SIZE, DefinitionDTO, DependencyEdge, FEED_EVENT_NAMES, FEED_EVENT_PORT_TOKEN, FeedApplyTagsAction, FeedEventFilter, FeedEventHandler, FeedEventName, FeedEventPayload, FeedEventPort, FeedEventSubscription, FeedEventTrigger, FeedSummarizeAction, GateRuling, INSTANCE_STATUSES, InstanceDTO, InstanceQueryParams, InstanceStatusDTO, InvalidTransitionError, LlmCompleteAction, MAX_PAGE_SIZE, METRIC_TYPES, MetricTypeDTO, MonitoringDashboardDTO, NODE_EXECUTION_STATUSES, NODE_TYPES, NodeExecutionDTO, NodeExecutionStatusDTO, ParsedDeclaration, PendingRulingView, PerformanceMetricDTO, StateTransitionDTO, TRIGGER_TYPES, TrendPointDTO, TriggerDTO, TriggerTypeDTO, UpdateDefinitionInput, UpdateTriggerInput, WORKFLOW_REF_PATTERN, WORK_ITEM_STATUSES, WebhookSendAction, WorkItemStatus, WorkItemView, WorkflowDocFrontmatter, WorkflowDocFrontmatterSchema, WorkflowEdge, WorkflowEdgeDTO, WorkflowGate, WorkflowItem, WorkflowNodeDTO, WorkflowView, actionContextSchema, actionResultSchema, actionSchema, actionTypeSchema, alertDtoSchema, alertTypeDtoSchema, auditLogDtoSchema, checkStatusTransition, createDefinitionInputSchema, createInstanceInputSchema, createTriggerInputSchema, definitionDtoSchema, dependenciesMet, deriveWorkflowView, detectCycle, feedApplyTagsActionSchema, feedEventFilterSchema, feedEventNameSchema, feedEventPayloadSchema, feedEventTriggerSchema, feedSummarizeActionSchema, formatDate, getPagination, getTotalPages, instanceDtoSchema, instanceQueryParamsSchema, instanceStatusDtoSchema, llmCompleteActionSchema, metricTypeDtoSchema, monitoringDashboardDtoSchema, nodeExecutionDtoSchema, nodeExecutionStatusDtoSchema, parseDeclaration, parseEdgeLine, parseGateLine, parseGateRuling, parseItemLine, performanceMetricDtoSchema, stateTransitionDtoSchema, trendPointDtoSchema, triggerDtoSchema, triggerTypeDtoSchema, updateDefinitionInputSchema, updateTriggerInputSchema, webhookSendActionSchema, workflowEdgeDtoSchema, workflowNodeDtoSchema };
551
+ export { ACTION_EXECUTOR_PORT_TOKEN, ACTION_TYPES, ALERT_TYPES, ALLOWED_STATUS_TRANSITIONS, Action, ActionContext, ActionExecutorPort, ActionHandler, ActionResult, ActionType, AlertDTO, AlertTypeDTO, AuditLogDTO, CreateDefinitionInput, CreateInstanceInput, CreateTriggerInput, DEFAULT_PAGE_SIZE, DefinitionDTO, type DependencyEdge, type EdgeIssue, FEED_EVENT_NAMES, FEED_EVENT_PORT_TOKEN, FeedApplyTagsAction, FeedEventFilter, FeedEventHandler, FeedEventName, FeedEventPayload, FeedEventPort, FeedEventSubscription, FeedEventTrigger, FeedSummarizeAction, GateRuling, INSTANCE_STATUSES, InstanceDTO, InstanceQueryParams, InstanceStatusDTO, InvalidTransitionError, LlmCompleteAction, MAX_PAGE_SIZE, METRIC_TYPES, MetricTypeDTO, MonitoringDashboardDTO, NODE_EXECUTION_STATUSES, NODE_TYPES, NodeExecutionDTO, NodeExecutionStatusDTO, ParsedDeclaration, PendingRulingView, PerformanceMetricDTO, StateTransitionDTO, TRIGGER_TYPES, TrendPointDTO, TriggerDTO, TriggerTypeDTO, UpdateDefinitionInput, UpdateTriggerInput, WORKFLOW_REF_PATTERN, WORK_ITEM_STATUSES, WebhookSendAction, WorkItemStatus, WorkItemView, WorkflowDocFrontmatter, WorkflowDocFrontmatterSchema, WorkflowEdge, WorkflowEdgeDTO, WorkflowGate, WorkflowItem, WorkflowNodeDTO, WorkflowView, actionContextSchema, actionResultSchema, actionSchema, actionTypeSchema, alertDtoSchema, alertTypeDtoSchema, areAllDependenciesMet, auditLogDtoSchema, checkStatusTransition, createDefinitionInputSchema, createInstanceInputSchema, createTriggerInputSchema, definitionDtoSchema, dependenciesMet, deriveWorkflowView, detectCycle, detectCycles, downstreamOf, feedApplyTagsActionSchema, feedEventFilterSchema, feedEventNameSchema, feedEventPayloadSchema, feedEventTriggerSchema, feedSummarizeActionSchema, formatDate, getPagination, getTotalPages, instanceDtoSchema, instanceQueryParamsSchema, instanceStatusDtoSchema, llmCompleteActionSchema, metricTypeDtoSchema, monitoringDashboardDtoSchema, nodeExecutionDtoSchema, nodeExecutionStatusDtoSchema, nodesOf, parseDeclaration, parseEdgeLine, parseGateLine, parseGateRuling, parseItemLine, performanceMetricDtoSchema, stateTransitionDtoSchema, topologicalLevels, topologicalSort, trendPointDtoSchema, triggerDtoSchema, triggerTypeDtoSchema, updateDefinitionInputSchema, updateTriggerInputSchema, validateEdges, webhookSendActionSchema, workflowEdgeDtoSchema, workflowNodeDtoSchema };
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import{A as e,B as t,C as n,D as r,E as i,F as a,G as o,H as s,I as ee,J as te,K as c,L as l,M as u,N as d,O as f,P as p,Q as m,R as h,S as g,T as _,U as v,V as y,W as b,X as x,Y as S,Z as C,_ as w,a as T,b as E,c as D,d as O,f as k,g as A,h as j,i as M,j as N,k as P,l as F,m as ne,n as I,o as L,p as R,q as z,r as B,s as V,t as H,u as U,v as W,w as G,x as K,y as q,z as J}from"./schemas-D0Zuq8_5.js";function Y(e){return e.length>=2&&e.startsWith(`"`)&&e.endsWith(`"`)?e.slice(1,-1):e}function X(e){if(!e.startsWith(`---
1
+ import{A as e,B as t,C as n,D as r,E as i,F as a,G as o,H as ee,I as te,J as ne,K as s,L as c,M as l,N as u,O as d,P as f,Q as p,R as m,S as h,T as g,U as _,V as v,W as y,X as b,Y as x,Z as S,_ as C,a as w,b as T,c as E,d as D,f as O,g as k,h as A,i as j,j as M,k as N,l as P,m as F,n as I,o as L,p as R,q as z,r as B,s as V,t as H,u as re,v as U,w as W,x as G,y as K,z as q}from"./schemas-D0Zuq8_5.js";import{areAllDependenciesMet as J,dependenciesMet as Y,dependenciesMet as X,detectCycle as ie,detectCycles as ae,downstreamOf as oe,nodesOf as se,topologicalLevels as ce,topologicalSort as le,validateEdges as ue}from"@longzai-intelligence-dag/core";function Z(e){return e.length>=2&&e.startsWith(`"`)&&e.endsWith(`"`)?e.slice(1,-1):e}function de(e){if(!e.startsWith(`---
2
2
  `))return e;let t=e.indexOf(`
3
3
  ---
4
- `,4);return t===-1?e:e.slice(t+5)}function Z(e){let t={},n={},r=X(e);if(!e.startsWith(`---
4
+ `,4);return t===-1?e:e.slice(t+5)}function fe(e){let t={},n={},r=de(e);if(!e.startsWith(`---
5
5
  `))return{head:t,arrays:n,body:r};let i=e.indexOf(`
6
6
  ---
7
7
  `,4);if(i===-1)return{head:t,arrays:n,body:r};let a=e.slice(4,i).split(`
8
- `),o=null;for(let e of a){if(e.startsWith(` - `)&&o!==null){let t=Y(e.slice(4).trim());n[o]=[...n[o]??[],t];continue}if(o=null,e.endsWith(`: []`)){o=e.slice(0,-4),n[o]=[];continue}if(e.endsWith(`:`)){o=e.slice(0,-1),n[o]=[];continue}let r=e.indexOf(`: `);r>0&&!e.startsWith(` `)&&(t[e.slice(0,r)]=Y(e.slice(r+2)))}return{head:t,arrays:n,body:r}}function re(e){let t=new Map;for(let n of e)t.set(n.from,[...t.get(n.from)??[],n.to]);let n=new Map,r=[],i=e=>{let a=n.get(e)??0;if(a===1){let t=r.indexOf(e);return[...r.slice(t),e]}if(a===2)return null;n.set(e,1),r.push(e);for(let n of t.get(e)??[]){let e=i(n);if(e!==null)return e}return r.pop(),n.set(e,2),null},a=[...new Set(e.flatMap(e=>[e.from,e.to]))].sort((e,t)=>e<t?-1:1);for(let e of a){let t=i(e);if(t!==null)return t}return null}function ie(e,t,n){return t.filter(t=>t.to===e).every(e=>n.has(e.from))}const Q={todo:[`doing`,`blocked`,`dropped`],doing:[`blocked`,`done`,`dropped`],blocked:[`todo`,`doing`,`dropped`],done:[`todo`,`dropped`],dropped:[`todo`]};function ae(e,t){let n=Q[e];return n===void 0?{code:`INVALID_TRANSITION`,message:`未知状态:${e}`}:n.includes(t)?null:{code:`INVALID_TRANSITION`,message:`非法转移:${e} → ${t}(合法后继:${n.join(` / `)})`}}function oe(e){return e===`done`||e===`dropped`}function $(e,t,n){let r=new Set(e.filter(e=>oe(e.status)).map(e=>e.id)),i=new Set(n.filter(e=>e.ruling.status!==`approved`&&e.at!==`workflow`).map(e=>e.at));return{items:e.map(e=>{let n=t.filter(t=>t.to===e.id).every(e=>r.has(e.from));return{id:e.id,status:e.status,depsMet:n,blockedOnPrerequisite:e.status===`todo`&&!n,canStart:e.status===`todo`&&n&&!i.has(e.id)}}),pendingRulings:n.filter(e=>e.ruling.status===`pending`||e.ruling.status===`escalated`).map(e=>({key:`${e.at}:${e.kind}`,at:e.at,kind:e.kind,note:e.note,rulingStatus:e.ruling.status}))}}function se(e,t){let n=Math.min(t??20,100);return{offset:(Math.max(e??1,1)-1)*n,limit:n}}function ce(e,t){return Math.ceil(e/t)}function le(e){return new Date(e).toISOString()}const ue=Symbol(`FEED_EVENT_PORT_TOKEN`),de=Symbol(`ACTION_EXECUTOR_PORT_TOKEN`);export{de as ACTION_EXECUTOR_PORT_TOKEN,v as ACTION_TYPES,b as ALERT_TYPES,Q as ALLOWED_STATUS_TRANSITIONS,o as DEFAULT_PAGE_SIZE,c as FEED_EVENT_NAMES,ue as FEED_EVENT_PORT_TOKEN,z as INSTANCE_STATUSES,te as MAX_PAGE_SIZE,S as METRIC_TYPES,x as NODE_EXECUTION_STATUSES,C as NODE_TYPES,m as TRIGGER_TYPES,e as WORKFLOW_REF_PATTERN,N as WORK_ITEM_STATUSES,u as WorkflowDocFrontmatterSchema,H as actionContextSchema,I as actionResultSchema,B as actionSchema,M as actionTypeSchema,R as alertDtoSchema,ne as alertTypeDtoSchema,j as auditLogDtoSchema,ae as checkStatusTransition,l as createDefinitionInputSchema,G as createInstanceInputSchema,E as createTriggerInputSchema,h as definitionDtoSchema,ie as dependenciesMet,$ as deriveWorkflowView,re as detectCycle,T as feedApplyTagsActionSchema,F as feedEventFilterSchema,U as feedEventNameSchema,O as feedEventPayloadSchema,k as feedEventTriggerSchema,L as feedSummarizeActionSchema,le as formatDate,se as getPagination,ce as getTotalPages,_ as instanceDtoSchema,i as instanceQueryParamsSchema,r as instanceStatusDtoSchema,V as llmCompleteActionSchema,A as metricTypeDtoSchema,w as monitoringDashboardDtoSchema,f as nodeExecutionDtoSchema,P as nodeExecutionStatusDtoSchema,Z as parseDeclaration,d as parseEdgeLine,p as parseGateLine,a as parseGateRuling,ee as parseItemLine,W as performanceMetricDtoSchema,J as stateTransitionDtoSchema,q as trendPointDtoSchema,K as triggerDtoSchema,g as triggerTypeDtoSchema,t as updateDefinitionInputSchema,n as updateTriggerInputSchema,D as webhookSendActionSchema,y as workflowEdgeDtoSchema,s as workflowNodeDtoSchema};
8
+ `),o=null;for(let e of a){if(e.startsWith(` - `)&&o!==null){let t=Z(e.slice(4).trim());n[o]=[...n[o]??[],t];continue}if(o=null,e.endsWith(`: []`)){o=e.slice(0,-4),n[o]=[];continue}if(e.endsWith(`:`)){o=e.slice(0,-1),n[o]=[];continue}let r=e.indexOf(`: `);r>0&&!e.startsWith(` `)&&(t[e.slice(0,r)]=Z(e.slice(r+2)))}return{head:t,arrays:n,body:r}}const Q={todo:[`doing`,`blocked`,`dropped`],doing:[`blocked`,`done`,`dropped`],blocked:[`todo`,`doing`,`dropped`],done:[`todo`,`dropped`],dropped:[`todo`]};function pe(e,t){let n=Q[e];return n===void 0?{code:`INVALID_TRANSITION`,message:`未知状态:${e}`}:n.includes(t)?null:{code:`INVALID_TRANSITION`,message:`非法转移:${e} → ${t}(合法后继:${n.join(` / `)})`}}function $(e){return e===`done`||e===`dropped`}function me(e,t,n){let r=new Set(e.filter(e=>$(e.status)).map(e=>e.id)),i=new Set(n.filter(e=>e.ruling.status!==`approved`&&e.at!==`workflow`).map(e=>e.at));return{items:e.map(e=>{let n=X(e.id,t,r);return{id:e.id,status:e.status,depsMet:n,blockedOnPrerequisite:e.status===`todo`&&!n,canStart:e.status===`todo`&&n&&!i.has(e.id)}}),pendingRulings:n.filter(e=>e.ruling.status===`pending`||e.ruling.status===`escalated`).map(e=>({key:`${e.at}:${e.kind}`,at:e.at,kind:e.kind,note:e.note,rulingStatus:e.ruling.status}))}}function he(e,t){let n=Math.min(t??20,100);return{offset:(Math.max(e??1,1)-1)*n,limit:n}}function ge(e,t){return Math.ceil(e/t)}function _e(e){return new Date(e).toISOString()}const ve=Symbol(`FEED_EVENT_PORT_TOKEN`),ye=Symbol(`ACTION_EXECUTOR_PORT_TOKEN`);export{ye as ACTION_EXECUTOR_PORT_TOKEN,_ as ACTION_TYPES,y as ALERT_TYPES,Q as ALLOWED_STATUS_TRANSITIONS,o as DEFAULT_PAGE_SIZE,s as FEED_EVENT_NAMES,ve as FEED_EVENT_PORT_TOKEN,z as INSTANCE_STATUSES,ne as MAX_PAGE_SIZE,x as METRIC_TYPES,b as NODE_EXECUTION_STATUSES,S as NODE_TYPES,p as TRIGGER_TYPES,e as WORKFLOW_REF_PATTERN,M as WORK_ITEM_STATUSES,l as WorkflowDocFrontmatterSchema,H as actionContextSchema,I as actionResultSchema,B as actionSchema,j as actionTypeSchema,R as alertDtoSchema,F as alertTypeDtoSchema,J as areAllDependenciesMet,A as auditLogDtoSchema,pe as checkStatusTransition,c as createDefinitionInputSchema,W as createInstanceInputSchema,T as createTriggerInputSchema,m as definitionDtoSchema,Y as dependenciesMet,me as deriveWorkflowView,ie as detectCycle,ae as detectCycles,oe as downstreamOf,w as feedApplyTagsActionSchema,P as feedEventFilterSchema,re as feedEventNameSchema,D as feedEventPayloadSchema,O as feedEventTriggerSchema,L as feedSummarizeActionSchema,_e as formatDate,he as getPagination,ge as getTotalPages,g as instanceDtoSchema,i as instanceQueryParamsSchema,r as instanceStatusDtoSchema,V as llmCompleteActionSchema,k as metricTypeDtoSchema,C as monitoringDashboardDtoSchema,d as nodeExecutionDtoSchema,N as nodeExecutionStatusDtoSchema,se as nodesOf,fe as parseDeclaration,u as parseEdgeLine,f as parseGateLine,a as parseGateRuling,te as parseItemLine,U as performanceMetricDtoSchema,q as stateTransitionDtoSchema,ce as topologicalLevels,le as topologicalSort,K as trendPointDtoSchema,G as triggerDtoSchema,h as triggerTypeDtoSchema,t as updateDefinitionInputSchema,n as updateTriggerInputSchema,ue as validateEdges,E as webhookSendActionSchema,v as workflowEdgeDtoSchema,ee as workflowNodeDtoSchema};
package/docs/overview.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## 定位(承接)
6
6
 
7
- 位于项目分层架构的最底层,不依赖任何技术框架,仅依赖共享内核与 Zod。被四个领域 contract 与 API 契约层(packages/api/core)引用,作为整个项目共享类型与端口定义的单一事实来源。(整改前 README 所列被 packages/sdk、packages/elysia、packages/adapters/memory 引用为历史形态,上述包已不在当前结构中,按当前依赖面更正留痕。)
7
+ 位于项目分层架构的最底层,不依赖任何技术框架,仅依赖共享内核与 Zod。被四个领域 contract 引用,作为整个项目共享类型与端口定义的单一事实来源。(整改前 README 所列被 packages/sdk、packages/elysia、packages/adapters/memory 引用为历史形态,上述包已不在当前结构中,按当前依赖面更正留痕。四层 API 契约层 packages/api 已整体退役,对外 API 定义面由各域定义包与生成客户端承载,本次退役按当前依赖面更正留痕。)
8
8
 
9
9
  ## 实现情况(承接)
10
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longzai-intelligence-workflow/core",
3
- "version": "0.0.1",
3
+ "version": "0.0.5",
4
4
  "license": "UNLICENSED",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -31,6 +31,7 @@
31
31
  "clean": "lzi-dev-cli clean"
32
32
  },
33
33
  "dependencies": {
34
+ "@longzai-intelligence-dag/core": "^0.0.2",
34
35
  "@longzai-intelligence-shared-kernel/core": "^0.1.4",
35
36
  "zod": "^4.4.3"
36
37
  },