@ai-setting/roy-agent-core 1.5.43 → 1.5.45
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/dist/config/index.js +5 -5
- package/dist/env/agent/index.js +5 -5
- package/dist/env/commands/index.js +5 -5
- package/dist/env/context/index.js +4 -1
- package/dist/env/debug/index.js +5 -5
- package/dist/env/event-source/index.js +7 -7
- package/dist/env/hook/index.js +3 -3
- package/dist/env/index.js +24 -20
- package/dist/env/llm/index.js +5 -5
- package/dist/env/log-trace/index.js +5 -5
- package/dist/env/mcp/index.js +20 -6
- package/dist/env/memory/index.js +5 -5
- package/dist/env/plugin/index.js +5 -5
- package/dist/env/prompt/index.js +5 -5
- package/dist/env/session/index.js +6 -6
- package/dist/env/session/storage/index.js +1 -1
- package/dist/env/skill/index.js +5 -5
- package/dist/env/task/delegate/index.js +3 -3
- package/dist/env/task/index.js +6 -6
- package/dist/env/task/plugins/index.js +2 -2
- package/dist/env/tool/built-in/index.js +1 -1
- package/dist/env/tool/index.js +6 -6
- package/dist/env/workflow/decorators/index.js +1 -1
- package/dist/env/workflow/engine/index.js +10 -4
- package/dist/env/workflow/index.js +42 -24
- package/dist/env/workflow/nodes/index.js +5 -1
- package/dist/env/workflow/tools/index.js +14 -0
- package/dist/env/workflow/types/index.js +16 -2
- package/dist/env/workflow/utils/index.js +15 -196
- package/dist/index.js +35 -31
- package/dist/shared/@ai-setting/{roy-agent-core-kajktp3d.js → roy-agent-core-20fm423j.js} +47 -26
- package/dist/shared/@ai-setting/{roy-agent-core-ffb9fq4v.js → roy-agent-core-2vhsccvz.js} +54 -12
- package/dist/shared/@ai-setting/{roy-agent-core-69jskqjg.js → roy-agent-core-44g4dhzg.js} +75 -7
- package/dist/shared/@ai-setting/{roy-agent-core-e9fdm13a.js → roy-agent-core-4gmxjdhn.js} +4 -2
- package/dist/shared/@ai-setting/{roy-agent-core-b4wd9tn6.js → roy-agent-core-4k9a823d.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-68qy97r3.js +31 -0
- package/dist/shared/@ai-setting/roy-agent-core-6atd905e.js +42 -0
- package/dist/shared/@ai-setting/{roy-agent-core-4jqq077c.js → roy-agent-core-6e3wz81d.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-pwkk12p4.js → roy-agent-core-6mcb7nqa.js} +60 -0
- package/dist/shared/@ai-setting/roy-agent-core-6vxg2gmr.js +321 -0
- package/dist/shared/@ai-setting/{roy-agent-core-9p43ap7h.js → roy-agent-core-8y804aat.js} +4 -2
- package/dist/shared/@ai-setting/{roy-agent-core-0rtxwr28.js → roy-agent-core-9bmtxmp6.js} +77 -120
- package/dist/shared/@ai-setting/{roy-agent-core-r6rwsr54.js → roy-agent-core-9p604xjf.js} +29 -9
- package/dist/shared/@ai-setting/{roy-agent-core-z1xf2fdk.js → roy-agent-core-a67e90d1.js} +6 -4
- package/dist/shared/@ai-setting/{roy-agent-core-xkb264a8.js → roy-agent-core-bp3xggmb.js} +192 -26
- package/dist/shared/@ai-setting/{roy-agent-core-zrja5v78.js → roy-agent-core-ce9w0j8n.js} +10 -2
- package/dist/shared/@ai-setting/{roy-agent-core-bmr6bdfb.js → roy-agent-core-cr8xer31.js} +15 -8
- package/dist/shared/@ai-setting/roy-agent-core-dbxm76wf.js +190 -0
- package/dist/shared/@ai-setting/{roy-agent-core-nj8yerg9.js → roy-agent-core-eftqdsy5.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-7fgf85wc.js → roy-agent-core-h0x19xgn.js} +6 -7
- package/dist/shared/@ai-setting/{roy-agent-core-psvwzdhj.js → roy-agent-core-hdszq729.js} +9 -5
- package/dist/shared/@ai-setting/{roy-agent-core-dxbsc1zy.js → roy-agent-core-ja9qhg6d.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-cevpwnq7.js → roy-agent-core-mjbfgqen.js} +5 -3
- package/dist/shared/@ai-setting/roy-agent-core-nhfy3p8q.js +132 -0
- package/dist/shared/@ai-setting/{roy-agent-core-2jnzv9at.js → roy-agent-core-nn9dmffw.js} +629 -288
- package/dist/shared/@ai-setting/roy-agent-core-qnrf2aw6.js +441 -0
- package/dist/shared/@ai-setting/{roy-agent-core-ee6nnnqw.js → roy-agent-core-r9hq4cjx.js} +8 -1
- package/dist/shared/@ai-setting/{roy-agent-core-jqy2mdyq.js → roy-agent-core-rgj6hq15.js} +52 -41
- package/dist/shared/@ai-setting/{roy-agent-core-z33en0cz.js → roy-agent-core-rm3hay00.js} +15 -2
- package/dist/shared/@ai-setting/{roy-agent-core-e130w7mv.js → roy-agent-core-rx74rye7.js} +5 -3
- package/dist/shared/@ai-setting/{roy-agent-core-pxcrzyv9.js → roy-agent-core-sk535ft2.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-v002ynpa.js +435 -0
- package/dist/shared/@ai-setting/{roy-agent-core-2dhd60aw.js → roy-agent-core-vdwvamre.js} +10 -0
- package/dist/shared/@ai-setting/{roy-agent-core-1zq3p19q.js → roy-agent-core-w64zachx.js} +8 -4
- package/dist/shared/@ai-setting/roy-agent-core-ye0z728h.js +18 -0
- package/dist/shared/@ai-setting/{roy-agent-core-rsybkb38.js → roy-agent-core-ysvh8er9.js} +36 -39
- package/dist/shared/@ai-setting/{roy-agent-core-9yxb3ty9.js → roy-agent-core-z5sxe4p7.js} +5 -1
- package/dist/shared/@ai-setting/{roy-agent-core-eg6nv09z.js → roy-agent-core-ztx5eh72.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-nqgrjja0.js → roy-agent-core-zwq6vhpj.js} +1 -1
- package/package.json +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-5x94xmt6.js +0 -350
- package/dist/shared/@ai-setting/roy-agent-core-dh9d7a3m.js +0 -11
- package/dist/shared/@ai-setting/roy-agent-core-jvatggbb.js +0 -603
|
@@ -1,17 +1,35 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WorkflowComponent
|
|
3
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
4
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
5
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
6
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
3
|
+
} from "../../shared/@ai-setting/roy-agent-core-cr8xer31.js";
|
|
4
|
+
import"../../shared/@ai-setting/roy-agent-core-9bmtxmp6.js";
|
|
5
|
+
import"../../shared/@ai-setting/roy-agent-core-nn9dmffw.js";
|
|
6
|
+
import"../../shared/@ai-setting/roy-agent-core-6atd905e.js";
|
|
7
|
+
import"../../shared/@ai-setting/roy-agent-core-44g4dhzg.js";
|
|
8
|
+
import"../../shared/@ai-setting/roy-agent-core-dbxm76wf.js";
|
|
7
9
|
import"../../shared/@ai-setting/roy-agent-core-4t40mkpv.js";
|
|
8
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
10
|
+
import"../../shared/@ai-setting/roy-agent-core-6vxg2gmr.js";
|
|
11
|
+
import"../../shared/@ai-setting/roy-agent-core-0vbdz0x7.js";
|
|
12
|
+
import"../../shared/@ai-setting/roy-agent-core-nhfy3p8q.js";
|
|
13
|
+
import {
|
|
14
|
+
Edge,
|
|
15
|
+
NodeAs,
|
|
16
|
+
Workflow,
|
|
17
|
+
WorkflowConverter,
|
|
18
|
+
WorkflowEdges,
|
|
19
|
+
createWorkflowFromClass
|
|
20
|
+
} from "../../shared/@ai-setting/roy-agent-core-h0x19xgn.js";
|
|
21
|
+
import {
|
|
22
|
+
DecoratorNode,
|
|
23
|
+
init_decorator_node
|
|
24
|
+
} from "../../shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
25
|
+
import"../../shared/@ai-setting/roy-agent-core-v002ynpa.js";
|
|
9
26
|
import {
|
|
10
27
|
BaseEventSchema,
|
|
11
28
|
ControlPauseEventSchema,
|
|
12
29
|
ControlResumeEventSchema,
|
|
13
30
|
ControlStopEventSchema,
|
|
14
31
|
DependsOnSchema,
|
|
32
|
+
EdgeDefinitionSchema,
|
|
15
33
|
InputParameterSchema,
|
|
16
34
|
NodeAddedEventSchema,
|
|
17
35
|
NodeCompletedEventSchema,
|
|
@@ -28,10 +46,12 @@ import {
|
|
|
28
46
|
OutputDefinitionSchema,
|
|
29
47
|
RetryConfigSchema,
|
|
30
48
|
RunStatusSchema,
|
|
49
|
+
TemplateUnresolvedError,
|
|
31
50
|
WorkflowAskUserEventSchema,
|
|
32
51
|
WorkflowCompletedEventSchema,
|
|
33
52
|
WorkflowConfigSchema,
|
|
34
53
|
WorkflowDefinitionSchema,
|
|
54
|
+
WorkflowError,
|
|
35
55
|
WorkflowEventSchema,
|
|
36
56
|
WorkflowFailedEventSchema,
|
|
37
57
|
WorkflowInputsSchema,
|
|
@@ -42,37 +62,28 @@ import {
|
|
|
42
62
|
WorkflowResumedEventSchema,
|
|
43
63
|
WorkflowStartedEventSchema,
|
|
44
64
|
WorkflowStoppedEventSchema,
|
|
65
|
+
WorkflowValidationError,
|
|
45
66
|
createNodeExecutionContext,
|
|
46
67
|
createWorkflowEvent,
|
|
47
68
|
getWorkflowSessionStatus,
|
|
48
69
|
init_types,
|
|
49
70
|
isWorkflowSessionMetadata,
|
|
71
|
+
nodeNotFound,
|
|
50
72
|
parseWorkflowFile,
|
|
51
|
-
parseWorkflowFileSync
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
Edge,
|
|
56
|
-
NodeAs,
|
|
57
|
-
Workflow,
|
|
58
|
-
WorkflowConverter,
|
|
59
|
-
WorkflowEdges,
|
|
60
|
-
createWorkflowFromClass
|
|
61
|
-
} from "../../shared/@ai-setting/roy-agent-core-7fgf85wc.js";
|
|
62
|
-
import {
|
|
63
|
-
DecoratorNode,
|
|
64
|
-
init_decorator_node
|
|
65
|
-
} from "../../shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
73
|
+
parseWorkflowFileSync,
|
|
74
|
+
pathNotFound,
|
|
75
|
+
unresolvedVariable
|
|
76
|
+
} from "../../shared/@ai-setting/roy-agent-core-qnrf2aw6.js";
|
|
66
77
|
import {
|
|
67
78
|
AskUserError,
|
|
68
79
|
createNodeInterruptEvent,
|
|
69
80
|
createWorkflowAskUserEvent
|
|
70
81
|
} from "../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
71
82
|
import"../../shared/@ai-setting/roy-agent-core-q5qj0fes.js";
|
|
72
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
73
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
74
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
75
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
83
|
+
import"../../shared/@ai-setting/roy-agent-core-6e3wz81d.js";
|
|
84
|
+
import"../../shared/@ai-setting/roy-agent-core-vdwvamre.js";
|
|
85
|
+
import"../../shared/@ai-setting/roy-agent-core-rgj6hq15.js";
|
|
86
|
+
import"../../shared/@ai-setting/roy-agent-core-rm3hay00.js";
|
|
76
87
|
import"../../shared/@ai-setting/roy-agent-core-10n2jh7p.js";
|
|
77
88
|
import"../../shared/@ai-setting/roy-agent-core-58k274fg.js";
|
|
78
89
|
import"../../shared/@ai-setting/roy-agent-core-c6592r3c.js";
|
|
@@ -82,8 +93,11 @@ import"../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
|
82
93
|
init_decorator_node();
|
|
83
94
|
init_types();
|
|
84
95
|
export {
|
|
96
|
+
unresolvedVariable,
|
|
97
|
+
pathNotFound,
|
|
85
98
|
parseWorkflowFileSync,
|
|
86
99
|
parseWorkflowFile,
|
|
100
|
+
nodeNotFound,
|
|
87
101
|
isWorkflowSessionMetadata,
|
|
88
102
|
getWorkflowSessionStatus,
|
|
89
103
|
createWorkflowFromClass,
|
|
@@ -91,6 +105,7 @@ export {
|
|
|
91
105
|
createWorkflowAskUserEvent,
|
|
92
106
|
createNodeInterruptEvent,
|
|
93
107
|
createNodeExecutionContext,
|
|
108
|
+
WorkflowValidationError,
|
|
94
109
|
WorkflowStoppedEventSchema,
|
|
95
110
|
WorkflowStartedEventSchema,
|
|
96
111
|
WorkflowResumedEventSchema,
|
|
@@ -101,6 +116,7 @@ export {
|
|
|
101
116
|
WorkflowInputsSchema,
|
|
102
117
|
WorkflowFailedEventSchema,
|
|
103
118
|
WorkflowEventSchema,
|
|
119
|
+
WorkflowError,
|
|
104
120
|
WorkflowEdges,
|
|
105
121
|
WorkflowDefinitionSchema,
|
|
106
122
|
WorkflowConverter,
|
|
@@ -109,6 +125,7 @@ export {
|
|
|
109
125
|
WorkflowCompletedEventSchema,
|
|
110
126
|
WorkflowAskUserEventSchema,
|
|
111
127
|
Workflow,
|
|
128
|
+
TemplateUnresolvedError,
|
|
112
129
|
RunStatusSchema,
|
|
113
130
|
RetryConfigSchema,
|
|
114
131
|
OutputDefinitionSchema,
|
|
@@ -126,6 +143,7 @@ export {
|
|
|
126
143
|
NodeAs,
|
|
127
144
|
NodeAddedEventSchema,
|
|
128
145
|
InputParameterSchema,
|
|
146
|
+
EdgeDefinitionSchema,
|
|
129
147
|
Edge,
|
|
130
148
|
DependsOnSchema,
|
|
131
149
|
DecoratorNode,
|
|
@@ -5,7 +5,11 @@ import {
|
|
|
5
5
|
init_skill_node,
|
|
6
6
|
init_tool_node,
|
|
7
7
|
init_workflow_node
|
|
8
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
8
|
+
} from "../../../shared/@ai-setting/roy-agent-core-6vxg2gmr.js";
|
|
9
|
+
import"../../../shared/@ai-setting/roy-agent-core-q5qj0fes.js";
|
|
10
|
+
import"../../../shared/@ai-setting/roy-agent-core-10n2jh7p.js";
|
|
11
|
+
import"../../../shared/@ai-setting/roy-agent-core-58k274fg.js";
|
|
12
|
+
import"../../../shared/@ai-setting/roy-agent-core-c6592r3c.js";
|
|
9
13
|
import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
10
14
|
|
|
11
15
|
// src/env/workflow/nodes/index.ts
|
|
@@ -3,6 +3,13 @@ import {
|
|
|
3
3
|
askUserTool,
|
|
4
4
|
askUserToolInstance
|
|
5
5
|
} from "../../../shared/@ai-setting/roy-agent-core-0vbdz0x7.js";
|
|
6
|
+
import {
|
|
7
|
+
WORKFLOW_SUBMIT_OUTPUT_TOOL_NAME,
|
|
8
|
+
WorkflowJsonOutputMarker,
|
|
9
|
+
createSubmitJsonOutputTool,
|
|
10
|
+
init_submit_json_output_tool,
|
|
11
|
+
parseWorkflowJsonOutput
|
|
12
|
+
} from "../../../shared/@ai-setting/roy-agent-core-nhfy3p8q.js";
|
|
6
13
|
import"../../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
7
14
|
import {
|
|
8
15
|
createLogger,
|
|
@@ -147,13 +154,20 @@ function resetRunWorkflowTool() {
|
|
|
147
154
|
_runWorkflowTool = null;
|
|
148
155
|
_workflowService = null;
|
|
149
156
|
}
|
|
157
|
+
|
|
158
|
+
// src/env/workflow/tools/index.ts
|
|
159
|
+
init_submit_json_output_tool();
|
|
150
160
|
export {
|
|
151
161
|
resetRunWorkflowTool,
|
|
162
|
+
parseWorkflowJsonOutput,
|
|
152
163
|
initRunWorkflowTool,
|
|
153
164
|
getRunWorkflowTool,
|
|
165
|
+
createSubmitJsonOutputTool,
|
|
154
166
|
createRunWorkflowTool,
|
|
155
167
|
askUserToolInstance,
|
|
156
168
|
askUserTool,
|
|
169
|
+
WorkflowJsonOutputMarker,
|
|
170
|
+
WORKFLOW_SUBMIT_OUTPUT_TOOL_NAME,
|
|
157
171
|
RunWorkflowInputSchema,
|
|
158
172
|
AskUserInputSchema
|
|
159
173
|
};
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
ControlResumeEventSchema,
|
|
5
5
|
ControlStopEventSchema,
|
|
6
6
|
DependsOnSchema,
|
|
7
|
+
EdgeDefinitionSchema,
|
|
7
8
|
InputParameterSchema,
|
|
8
9
|
NodeAddedEventSchema,
|
|
9
10
|
NodeCompletedEventSchema,
|
|
@@ -20,10 +21,12 @@ import {
|
|
|
20
21
|
OutputDefinitionSchema,
|
|
21
22
|
RetryConfigSchema,
|
|
22
23
|
RunStatusSchema,
|
|
24
|
+
TemplateUnresolvedError,
|
|
23
25
|
WorkflowAskUserEventSchema,
|
|
24
26
|
WorkflowCompletedEventSchema,
|
|
25
27
|
WorkflowConfigSchema,
|
|
26
28
|
WorkflowDefinitionSchema,
|
|
29
|
+
WorkflowError,
|
|
27
30
|
WorkflowEventSchema,
|
|
28
31
|
WorkflowFailedEventSchema,
|
|
29
32
|
WorkflowInputsSchema,
|
|
@@ -34,14 +37,18 @@ import {
|
|
|
34
37
|
WorkflowResumedEventSchema,
|
|
35
38
|
WorkflowStartedEventSchema,
|
|
36
39
|
WorkflowStoppedEventSchema,
|
|
40
|
+
WorkflowValidationError,
|
|
37
41
|
createNodeExecutionContext,
|
|
38
42
|
createWorkflowEvent,
|
|
39
43
|
getWorkflowSessionStatus,
|
|
40
44
|
init_types,
|
|
41
45
|
isWorkflowSessionMetadata,
|
|
46
|
+
nodeNotFound,
|
|
42
47
|
parseWorkflowFile,
|
|
43
|
-
parseWorkflowFileSync
|
|
44
|
-
|
|
48
|
+
parseWorkflowFileSync,
|
|
49
|
+
pathNotFound,
|
|
50
|
+
unresolvedVariable
|
|
51
|
+
} from "../../../shared/@ai-setting/roy-agent-core-qnrf2aw6.js";
|
|
45
52
|
import {
|
|
46
53
|
AskUserError,
|
|
47
54
|
createNodeInterruptEvent,
|
|
@@ -51,14 +58,18 @@ import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
|
51
58
|
init_types();
|
|
52
59
|
|
|
53
60
|
export {
|
|
61
|
+
unresolvedVariable,
|
|
62
|
+
pathNotFound,
|
|
54
63
|
parseWorkflowFileSync,
|
|
55
64
|
parseWorkflowFile,
|
|
65
|
+
nodeNotFound,
|
|
56
66
|
isWorkflowSessionMetadata,
|
|
57
67
|
getWorkflowSessionStatus,
|
|
58
68
|
createWorkflowEvent,
|
|
59
69
|
createWorkflowAskUserEvent,
|
|
60
70
|
createNodeInterruptEvent,
|
|
61
71
|
createNodeExecutionContext,
|
|
72
|
+
WorkflowValidationError,
|
|
62
73
|
WorkflowStoppedEventSchema,
|
|
63
74
|
WorkflowStartedEventSchema,
|
|
64
75
|
WorkflowResumedEventSchema,
|
|
@@ -69,10 +80,12 @@ export {
|
|
|
69
80
|
WorkflowInputsSchema,
|
|
70
81
|
WorkflowFailedEventSchema,
|
|
71
82
|
WorkflowEventSchema,
|
|
83
|
+
WorkflowError,
|
|
72
84
|
WorkflowDefinitionSchema,
|
|
73
85
|
WorkflowConfigSchema,
|
|
74
86
|
WorkflowCompletedEventSchema,
|
|
75
87
|
WorkflowAskUserEventSchema,
|
|
88
|
+
TemplateUnresolvedError,
|
|
76
89
|
RunStatusSchema,
|
|
77
90
|
RetryConfigSchema,
|
|
78
91
|
OutputDefinitionSchema,
|
|
@@ -89,6 +102,7 @@ export {
|
|
|
89
102
|
NodeCompletedEventSchema,
|
|
90
103
|
NodeAddedEventSchema,
|
|
91
104
|
InputParameterSchema,
|
|
105
|
+
EdgeDefinitionSchema,
|
|
92
106
|
DependsOnSchema,
|
|
93
107
|
ControlStopEventSchema,
|
|
94
108
|
ControlResumeEventSchema,
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TemplateResolver,
|
|
3
|
+
init_template_resolver,
|
|
4
|
+
resolveTemplateString,
|
|
5
|
+
resolveTemplates
|
|
6
|
+
} from "../../../shared/@ai-setting/roy-agent-core-v002ynpa.js";
|
|
7
|
+
import"../../../shared/@ai-setting/roy-agent-core-qnrf2aw6.js";
|
|
8
|
+
import"../../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
1
9
|
import {
|
|
2
10
|
TracedAs,
|
|
3
11
|
init_decorator
|
|
@@ -9,199 +17,9 @@ import {
|
|
|
9
17
|
__legacyDecorateClassTS
|
|
10
18
|
} from "../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
11
19
|
|
|
12
|
-
// src/env/workflow/utils/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
previousOutputs;
|
|
16
|
-
constructor(options = {}) {
|
|
17
|
-
this.input = options.input ?? {};
|
|
18
|
-
this.previousOutputs = options.previousOutputs ?? new Map;
|
|
19
|
-
}
|
|
20
|
-
static fromContext(context) {
|
|
21
|
-
return new TemplateResolver({
|
|
22
|
-
input: context.input,
|
|
23
|
-
previousOutputs: context.previousOutputs
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
resolveValue(input) {
|
|
27
|
-
if (input === null || input === undefined) {
|
|
28
|
-
return input;
|
|
29
|
-
}
|
|
30
|
-
if (typeof input === "string") {
|
|
31
|
-
const pureTemplate = this.extractPureTemplate(input);
|
|
32
|
-
if (pureTemplate) {
|
|
33
|
-
return this.resolvePureTemplate(pureTemplate);
|
|
34
|
-
}
|
|
35
|
-
return this.resolveString(input);
|
|
36
|
-
}
|
|
37
|
-
if (Array.isArray(input)) {
|
|
38
|
-
return input.map((item) => this.resolveValue(item));
|
|
39
|
-
}
|
|
40
|
-
if (typeof input === "object") {
|
|
41
|
-
const resolved = {};
|
|
42
|
-
for (const [key, value] of Object.entries(input)) {
|
|
43
|
-
resolved[key] = this.resolveValue(value);
|
|
44
|
-
}
|
|
45
|
-
return resolved;
|
|
46
|
-
}
|
|
47
|
-
return input;
|
|
48
|
-
}
|
|
49
|
-
extractPureTemplate(str) {
|
|
50
|
-
const trimmed = str.trim();
|
|
51
|
-
if (trimmed.startsWith("{{") && trimmed.endsWith("}}") && trimmed.length > 4) {
|
|
52
|
-
const content = trimmed.slice(2, -2).trim();
|
|
53
|
-
if (!content.includes("{{") && !content.includes("}}")) {
|
|
54
|
-
return content;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
resolvePureTemplate(templateContent) {
|
|
60
|
-
const value = this.resolveTemplateContent(templateContent);
|
|
61
|
-
return value;
|
|
62
|
-
}
|
|
63
|
-
resolveTemplateContent(templateContent) {
|
|
64
|
-
const trimmed = templateContent.trim();
|
|
65
|
-
if (trimmed.startsWith("input.")) {
|
|
66
|
-
return this.getNestedValue(this.input, trimmed.slice(6));
|
|
67
|
-
}
|
|
68
|
-
if (trimmed.startsWith("nodes.")) {
|
|
69
|
-
return this.resolveNodePath(trimmed.slice(6));
|
|
70
|
-
}
|
|
71
|
-
if (trimmed !== "input" && trimmed !== "nodes") {
|
|
72
|
-
const segments = trimmed.split(".");
|
|
73
|
-
const nodeId = segments[0];
|
|
74
|
-
const restPath = segments.slice(1).join(".") || undefined;
|
|
75
|
-
return this.resolveNodePath(`${nodeId}${restPath ? "." + restPath : ""}`);
|
|
76
|
-
}
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
resolveString(template) {
|
|
80
|
-
if (!template || typeof template !== "string") {
|
|
81
|
-
return template;
|
|
82
|
-
}
|
|
83
|
-
let resolved = template;
|
|
84
|
-
resolved = resolved.replace(/\{\{input\.([^}]+)\}\}/g, (match, path) => {
|
|
85
|
-
const value = this.getNestedValue(this.input, path);
|
|
86
|
-
return this.stringify(value, match);
|
|
87
|
-
});
|
|
88
|
-
resolved = resolved.replace(/\{\{nodes\.([^}]+)\}\}/g, (match, path) => {
|
|
89
|
-
const value = this.resolveNodePath(path);
|
|
90
|
-
return this.stringify(value, match);
|
|
91
|
-
});
|
|
92
|
-
resolved = resolved.replace(/\{\{([a-zA-Z_][a-zA-Z0-9_-]*)(?:\.([^}]+))?\}\}/g, (match, nodeId, path) => {
|
|
93
|
-
if (nodeId === "input") {
|
|
94
|
-
return match;
|
|
95
|
-
}
|
|
96
|
-
if (nodeId === "nodes") {
|
|
97
|
-
return match;
|
|
98
|
-
}
|
|
99
|
-
const value = this.resolveNodePath(`${nodeId}${path ? "." + path : ""}`);
|
|
100
|
-
return this.stringify(value, match);
|
|
101
|
-
});
|
|
102
|
-
return resolved;
|
|
103
|
-
}
|
|
104
|
-
resolveNodePath(path) {
|
|
105
|
-
const segments = path.split(".");
|
|
106
|
-
const nodeId = segments[0];
|
|
107
|
-
if (!nodeId) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
let value = this.previousOutputs.get(nodeId);
|
|
111
|
-
if (value === undefined) {
|
|
112
|
-
const normalizedUnderscore = nodeId.replace(/-/g, "_");
|
|
113
|
-
const normalizedHyphen = nodeId.replace(/_/g, "-");
|
|
114
|
-
if (normalizedUnderscore !== nodeId) {
|
|
115
|
-
value = this.previousOutputs.get(normalizedUnderscore);
|
|
116
|
-
}
|
|
117
|
-
if (value === undefined && normalizedHyphen !== nodeId) {
|
|
118
|
-
value = this.previousOutputs.get(normalizedHyphen);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
if (value === undefined) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
if (segments.length === 1) {
|
|
125
|
-
if (value && typeof value === "object" && "result" in value && !("nodes" in value)) {
|
|
126
|
-
value = value.result;
|
|
127
|
-
}
|
|
128
|
-
return value;
|
|
129
|
-
}
|
|
130
|
-
const secondSegment = segments[1];
|
|
131
|
-
if (secondSegment === "result" || secondSegment === "output") {
|
|
132
|
-
if (value && typeof value === "object" && "result" in value) {
|
|
133
|
-
value = value.result;
|
|
134
|
-
if (segments.length === 2) {
|
|
135
|
-
return value;
|
|
136
|
-
}
|
|
137
|
-
for (let i = 2;i < segments.length; i++) {
|
|
138
|
-
if (value === null || value === undefined) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
value = value[segments[i]];
|
|
142
|
-
}
|
|
143
|
-
return value;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
for (let i = 1;i < segments.length; i++) {
|
|
147
|
-
if (value === null || value === undefined) {
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
value = value[segments[i]];
|
|
151
|
-
}
|
|
152
|
-
return value;
|
|
153
|
-
}
|
|
154
|
-
getNestedValue(obj, path) {
|
|
155
|
-
if (!obj || !path) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
const segments = path.split(".");
|
|
159
|
-
let current = obj;
|
|
160
|
-
for (const segment of segments) {
|
|
161
|
-
if (current === null || current === undefined) {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
if (typeof current !== "object") {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
current = current[segment];
|
|
168
|
-
}
|
|
169
|
-
return current;
|
|
170
|
-
}
|
|
171
|
-
stringify(value, originalTemplate) {
|
|
172
|
-
if (value === undefined) {
|
|
173
|
-
return originalTemplate;
|
|
174
|
-
}
|
|
175
|
-
if (typeof value === "string") {
|
|
176
|
-
return value;
|
|
177
|
-
}
|
|
178
|
-
if (value === null) {
|
|
179
|
-
return "null";
|
|
180
|
-
}
|
|
181
|
-
return JSON.stringify(value);
|
|
182
|
-
}
|
|
183
|
-
containsTemplates(str) {
|
|
184
|
-
if (typeof str !== "string") {
|
|
185
|
-
return false;
|
|
186
|
-
}
|
|
187
|
-
return /\{\{[^}]+\}\}/.test(str);
|
|
188
|
-
}
|
|
189
|
-
extractTemplates(str) {
|
|
190
|
-
if (typeof str !== "string") {
|
|
191
|
-
return [];
|
|
192
|
-
}
|
|
193
|
-
const matches = str.match(/\{\{[^}]+\}\}/g);
|
|
194
|
-
return matches ?? [];
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
function resolveTemplates(input, context) {
|
|
198
|
-
const resolver = TemplateResolver.fromContext(context);
|
|
199
|
-
return resolver.resolveValue(input);
|
|
200
|
-
}
|
|
201
|
-
function resolveTemplateString(template, context) {
|
|
202
|
-
const resolver = TemplateResolver.fromContext(context);
|
|
203
|
-
return resolver.resolveString(template);
|
|
204
|
-
}
|
|
20
|
+
// src/env/workflow/utils/index.ts
|
|
21
|
+
init_template_resolver();
|
|
22
|
+
|
|
205
23
|
// src/env/workflow/utils/recovery-validator.ts
|
|
206
24
|
init_decorator();
|
|
207
25
|
|
|
@@ -461,9 +279,10 @@ class RecoveryValidator {
|
|
|
461
279
|
validateConditionBranches(state, definition) {
|
|
462
280
|
const errors = [];
|
|
463
281
|
const edges = definition.edges || definition.connections || [];
|
|
464
|
-
const conditionalEdges = edges.filter((e) => e.condition);
|
|
282
|
+
const conditionalEdges = edges.filter((e) => e.when || e.condition);
|
|
465
283
|
for (const edge of conditionalEdges) {
|
|
466
|
-
const
|
|
284
|
+
const condition = edge.when || edge.condition;
|
|
285
|
+
const conditionVars = this.extractVariableRefs(condition);
|
|
467
286
|
for (const varRef of conditionVars) {
|
|
468
287
|
if (!state.nodeOutputs.has(varRef) && !state.variables.has(varRef)) {
|
|
469
288
|
errors.push({
|
|
@@ -471,7 +290,7 @@ class RecoveryValidator {
|
|
|
471
290
|
nodeId: edge.target || edge.to,
|
|
472
291
|
description: `条件分支无法确定:变量 ${varRef} 不存在`,
|
|
473
292
|
suggestedAction: "CONFIRM" /* CONFIRM */,
|
|
474
|
-
context: { variable: varRef, condition
|
|
293
|
+
context: { variable: varRef, condition }
|
|
475
294
|
});
|
|
476
295
|
}
|
|
477
296
|
}
|