@ai-setting/roy-agent-core 1.7.10 → 1.7.13
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/env/index.js +4 -3
- package/dist/env/workflow/index.js +4 -3
- package/dist/env/workflow/service/index.js +2 -1
- package/dist/env/workflow/tools/index.js +3 -2
- package/dist/env/workflow/utils/index.js +6 -0
- package/dist/index.js +4 -3
- package/dist/shared/@ai-setting/{roy-agent-core-0phpmeqj.js → roy-agent-core-4ggqsnbg.js} +2 -2
- package/dist/shared/@ai-setting/roy-agent-core-7exqwax1.js +61 -0
- package/dist/shared/@ai-setting/{roy-agent-core-j9ybhwnq.js → roy-agent-core-8fcjcx67.js} +23 -16
- package/dist/shared/@ai-setting/{roy-agent-core-29ph0e2k.js → roy-agent-core-nxqk5smq.js} +1 -1
- package/package.json +1 -1
package/dist/env/index.js
CHANGED
|
@@ -29,20 +29,21 @@ import"../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
|
|
|
29
29
|
import"../shared/@ai-setting/roy-agent-core-skqt40yy.js";
|
|
30
30
|
import {
|
|
31
31
|
WorkflowComponent
|
|
32
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
32
|
+
} from "../shared/@ai-setting/roy-agent-core-4ggqsnbg.js";
|
|
33
33
|
import"../shared/@ai-setting/roy-agent-core-7xek618f.js";
|
|
34
34
|
import"../shared/@ai-setting/roy-agent-core-h0x19xgn.js";
|
|
35
35
|
import"../shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
36
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
36
|
+
import"../shared/@ai-setting/roy-agent-core-nxqk5smq.js";
|
|
37
37
|
import"../shared/@ai-setting/roy-agent-core-v13dq3nc.js";
|
|
38
38
|
import"../shared/@ai-setting/roy-agent-core-wgp3q62x.js";
|
|
39
39
|
import"../shared/@ai-setting/roy-agent-core-hhrg314p.js";
|
|
40
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
40
|
+
import"../shared/@ai-setting/roy-agent-core-8fcjcx67.js";
|
|
41
41
|
import"../shared/@ai-setting/roy-agent-core-wrjm9etv.js";
|
|
42
42
|
import"../shared/@ai-setting/roy-agent-core-6atd905e.js";
|
|
43
43
|
import"../shared/@ai-setting/roy-agent-core-ec4djnzd.js";
|
|
44
44
|
import"../shared/@ai-setting/roy-agent-core-hmqmznjc.js";
|
|
45
45
|
import"../shared/@ai-setting/roy-agent-core-1db4vpc6.js";
|
|
46
|
+
import"../shared/@ai-setting/roy-agent-core-7exqwax1.js";
|
|
46
47
|
import"../shared/@ai-setting/roy-agent-core-w8rv08d3.js";
|
|
47
48
|
import"../shared/@ai-setting/roy-agent-core-rfwshpd0.js";
|
|
48
49
|
import"../shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WorkflowComponent
|
|
3
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
3
|
+
} from "../../shared/@ai-setting/roy-agent-core-4ggqsnbg.js";
|
|
4
4
|
import"../../shared/@ai-setting/roy-agent-core-7xek618f.js";
|
|
5
5
|
import {
|
|
6
6
|
Edge,
|
|
@@ -14,16 +14,17 @@ import {
|
|
|
14
14
|
DecoratorNode,
|
|
15
15
|
init_decorator_node
|
|
16
16
|
} from "../../shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
17
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
17
|
+
import"../../shared/@ai-setting/roy-agent-core-nxqk5smq.js";
|
|
18
18
|
import"../../shared/@ai-setting/roy-agent-core-v13dq3nc.js";
|
|
19
19
|
import"../../shared/@ai-setting/roy-agent-core-wgp3q62x.js";
|
|
20
20
|
import"../../shared/@ai-setting/roy-agent-core-hhrg314p.js";
|
|
21
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
21
|
+
import"../../shared/@ai-setting/roy-agent-core-8fcjcx67.js";
|
|
22
22
|
import"../../shared/@ai-setting/roy-agent-core-wrjm9etv.js";
|
|
23
23
|
import"../../shared/@ai-setting/roy-agent-core-6atd905e.js";
|
|
24
24
|
import"../../shared/@ai-setting/roy-agent-core-ec4djnzd.js";
|
|
25
25
|
import"../../shared/@ai-setting/roy-agent-core-hmqmznjc.js";
|
|
26
26
|
import"../../shared/@ai-setting/roy-agent-core-1db4vpc6.js";
|
|
27
|
+
import"../../shared/@ai-setting/roy-agent-core-7exqwax1.js";
|
|
27
28
|
import"../../shared/@ai-setting/roy-agent-core-w8rv08d3.js";
|
|
28
29
|
import"../../shared/@ai-setting/roy-agent-core-rfwshpd0.js";
|
|
29
30
|
import"../../shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
|
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
} from "../../../shared/@ai-setting/roy-agent-core-hhrg314p.js";
|
|
6
6
|
import {
|
|
7
7
|
WorkflowService
|
|
8
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
8
|
+
} from "../../../shared/@ai-setting/roy-agent-core-8fcjcx67.js";
|
|
9
|
+
import"../../../shared/@ai-setting/roy-agent-core-7exqwax1.js";
|
|
9
10
|
import"../../../shared/@ai-setting/roy-agent-core-gb7pm9c0.js";
|
|
10
11
|
import"../../../shared/@ai-setting/roy-agent-core-kaq037np.js";
|
|
11
12
|
import"../../../shared/@ai-setting/roy-agent-core-1khp1m0r.js";
|
|
@@ -24,10 +24,10 @@ import {
|
|
|
24
24
|
getRunWorkflowTool,
|
|
25
25
|
initRunWorkflowTool,
|
|
26
26
|
resetRunWorkflowTool
|
|
27
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
27
|
+
} from "../../../shared/@ai-setting/roy-agent-core-nxqk5smq.js";
|
|
28
28
|
import"../../../shared/@ai-setting/roy-agent-core-v13dq3nc.js";
|
|
29
29
|
import"../../../shared/@ai-setting/roy-agent-core-wgp3q62x.js";
|
|
30
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
30
|
+
import"../../../shared/@ai-setting/roy-agent-core-8fcjcx67.js";
|
|
31
31
|
import {
|
|
32
32
|
WORKFLOW_SUBMIT_OUTPUT_TOOL_NAME,
|
|
33
33
|
WorkflowJsonOutputMarker,
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
init_submit_json_output_tool,
|
|
36
36
|
parseWorkflowJsonOutput
|
|
37
37
|
} from "../../../shared/@ai-setting/roy-agent-core-1db4vpc6.js";
|
|
38
|
+
import"../../../shared/@ai-setting/roy-agent-core-7exqwax1.js";
|
|
38
39
|
import"../../../shared/@ai-setting/roy-agent-core-w8rv08d3.js";
|
|
39
40
|
import"../../../shared/@ai-setting/roy-agent-core-0v74marc.js";
|
|
40
41
|
import"../../../shared/@ai-setting/roy-agent-core-jrj30vq3.js";
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sanitizeShellScript,
|
|
3
|
+
sanitizeWorkflowDefinition
|
|
4
|
+
} from "../../../shared/@ai-setting/roy-agent-core-7exqwax1.js";
|
|
1
5
|
import {
|
|
2
6
|
validateWorkflowDefinition
|
|
3
7
|
} from "../../../shared/@ai-setting/roy-agent-core-w8rv08d3.js";
|
|
@@ -456,6 +460,8 @@ __legacyDecorateClassTS([
|
|
|
456
460
|
], RecoveryValidator.prototype, "validateNestedWorkflows", null);
|
|
457
461
|
export {
|
|
458
462
|
validateWorkflowDefinition,
|
|
463
|
+
sanitizeWorkflowDefinition,
|
|
464
|
+
sanitizeShellScript,
|
|
459
465
|
resolveTemplates,
|
|
460
466
|
resolveTemplateString,
|
|
461
467
|
getFromMapWithNormalization,
|
package/dist/index.js
CHANGED
|
@@ -119,7 +119,7 @@ import {
|
|
|
119
119
|
} from "./shared/@ai-setting/roy-agent-core-skqt40yy.js";
|
|
120
120
|
import {
|
|
121
121
|
WorkflowComponent
|
|
122
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
122
|
+
} from "./shared/@ai-setting/roy-agent-core-4ggqsnbg.js";
|
|
123
123
|
import {
|
|
124
124
|
init_node_registry_helper,
|
|
125
125
|
registerDecoratorNodeType
|
|
@@ -132,7 +132,7 @@ import {
|
|
|
132
132
|
createWorkflowFromClass
|
|
133
133
|
} from "./shared/@ai-setting/roy-agent-core-h0x19xgn.js";
|
|
134
134
|
import"./shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
135
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
135
|
+
import"./shared/@ai-setting/roy-agent-core-nxqk5smq.js";
|
|
136
136
|
import {
|
|
137
137
|
SessionComponent
|
|
138
138
|
} from "./shared/@ai-setting/roy-agent-core-v13dq3nc.js";
|
|
@@ -140,12 +140,13 @@ import {
|
|
|
140
140
|
MemorySessionStore
|
|
141
141
|
} from "./shared/@ai-setting/roy-agent-core-wgp3q62x.js";
|
|
142
142
|
import"./shared/@ai-setting/roy-agent-core-hhrg314p.js";
|
|
143
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
143
|
+
import"./shared/@ai-setting/roy-agent-core-8fcjcx67.js";
|
|
144
144
|
import"./shared/@ai-setting/roy-agent-core-wrjm9etv.js";
|
|
145
145
|
import"./shared/@ai-setting/roy-agent-core-6atd905e.js";
|
|
146
146
|
import"./shared/@ai-setting/roy-agent-core-ec4djnzd.js";
|
|
147
147
|
import"./shared/@ai-setting/roy-agent-core-hmqmznjc.js";
|
|
148
148
|
import"./shared/@ai-setting/roy-agent-core-1db4vpc6.js";
|
|
149
|
+
import"./shared/@ai-setting/roy-agent-core-7exqwax1.js";
|
|
149
150
|
import"./shared/@ai-setting/roy-agent-core-w8rv08d3.js";
|
|
150
151
|
import"./shared/@ai-setting/roy-agent-core-rfwshpd0.js";
|
|
151
152
|
import"./shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
createWorkflowSearchTool,
|
|
14
14
|
createWorkflowTagListTool,
|
|
15
15
|
createWorkflowValidateTool
|
|
16
|
-
} from "./roy-agent-core-
|
|
16
|
+
} from "./roy-agent-core-nxqk5smq.js";
|
|
17
17
|
import {
|
|
18
18
|
WorkflowService
|
|
19
|
-
} from "./roy-agent-core-
|
|
19
|
+
} from "./roy-agent-core-8fcjcx67.js";
|
|
20
20
|
import {
|
|
21
21
|
WorkflowEngine,
|
|
22
22
|
exports_engine,
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// src/env/workflow/utils/workflow-sanitize.ts
|
|
2
|
+
function sanitizeWorkflowDefinition(definition) {
|
|
3
|
+
if (!definition || !Array.isArray(definition.nodes)) {
|
|
4
|
+
return definition;
|
|
5
|
+
}
|
|
6
|
+
return {
|
|
7
|
+
...definition,
|
|
8
|
+
nodes: definition.nodes.map((node) => sanitizeNode(node))
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function sanitizeNode(node) {
|
|
12
|
+
if (!node || typeof node !== "object")
|
|
13
|
+
return node;
|
|
14
|
+
const config = node.config;
|
|
15
|
+
if (!config || typeof config !== "object")
|
|
16
|
+
return node;
|
|
17
|
+
let mutated = false;
|
|
18
|
+
const nextConfig = { ...config };
|
|
19
|
+
for (const [key, value] of Object.entries(config)) {
|
|
20
|
+
const rewritten = sanitizeCommandLike(key, value);
|
|
21
|
+
if (rewritten !== value) {
|
|
22
|
+
nextConfig[key] = rewritten;
|
|
23
|
+
mutated = true;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (!mutated)
|
|
27
|
+
return node;
|
|
28
|
+
return { ...node, config: nextConfig };
|
|
29
|
+
}
|
|
30
|
+
function sanitizeCommandLike(key, value) {
|
|
31
|
+
if ((key === "command" || key === "message") && typeof value === "string") {
|
|
32
|
+
return sanitizeShellScript(value);
|
|
33
|
+
}
|
|
34
|
+
if (key === "inputs" || key === "input" || key === "args") {
|
|
35
|
+
if (!value || typeof value !== "object")
|
|
36
|
+
return value;
|
|
37
|
+
let mutated = false;
|
|
38
|
+
const next = { ...value };
|
|
39
|
+
for (const [innerKey, innerValue] of Object.entries(value)) {
|
|
40
|
+
if ((innerKey === "command" || innerKey === "message") && typeof innerValue === "string") {
|
|
41
|
+
const sanitized = sanitizeShellScript(innerValue);
|
|
42
|
+
if (sanitized !== innerValue) {
|
|
43
|
+
next[innerKey] = sanitized;
|
|
44
|
+
mutated = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return mutated ? next : value;
|
|
49
|
+
}
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
function sanitizeShellScript(script) {
|
|
53
|
+
if (typeof script !== "string" || script.length === 0)
|
|
54
|
+
return script;
|
|
55
|
+
let out = script;
|
|
56
|
+
out = out.replace(/(python3\s+-c\s+");\s?/g, "$1");
|
|
57
|
+
out = out.replace(/\$RANDOM(?![A-Za-z0-9_{:-])/g, "${RANDOM:-0}");
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { sanitizeWorkflowDefinition, sanitizeShellScript };
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sanitizeWorkflowDefinition
|
|
3
|
+
} from "./roy-agent-core-7exqwax1.js";
|
|
1
4
|
import {
|
|
2
5
|
TracedAs,
|
|
3
6
|
init_decorator
|
|
@@ -65,22 +68,23 @@ class WorkflowService {
|
|
|
65
68
|
return effective;
|
|
66
69
|
}
|
|
67
70
|
async createWorkflow(definition, options) {
|
|
68
|
-
const
|
|
69
|
-
const
|
|
71
|
+
const sanitized = sanitizeWorkflowDefinition(definition);
|
|
72
|
+
const effectiveTags = this.validateTags(options?.tags || sanitized.metadata?.tags);
|
|
73
|
+
const existing = this.workflowRepository.getByName(sanitized.name);
|
|
70
74
|
if (existing) {
|
|
71
75
|
if (options?.force !== true) {
|
|
72
76
|
throw new Error(`Workflow already exists: ${definition.name}`);
|
|
73
77
|
}
|
|
74
78
|
const oldTags = existing.tags;
|
|
75
79
|
const updated = this.workflowRepository.update(existing.id, {
|
|
76
|
-
name:
|
|
77
|
-
version:
|
|
78
|
-
description:
|
|
79
|
-
definition,
|
|
80
|
-
config:
|
|
80
|
+
name: sanitized.name,
|
|
81
|
+
version: sanitized.version,
|
|
82
|
+
description: sanitized.description || existing.description,
|
|
83
|
+
definition: sanitized,
|
|
84
|
+
config: sanitized.config || {},
|
|
81
85
|
metadata: {
|
|
82
|
-
...options.metadata ||
|
|
83
|
-
taskId: options.taskId ||
|
|
86
|
+
...options.metadata || sanitized.metadata || existing.metadata || {},
|
|
87
|
+
taskId: options.taskId || sanitized.metadata?.taskId || existing.metadata?.taskId
|
|
84
88
|
},
|
|
85
89
|
tags: effectiveTags
|
|
86
90
|
});
|
|
@@ -88,14 +92,14 @@ class WorkflowService {
|
|
|
88
92
|
return updated;
|
|
89
93
|
}
|
|
90
94
|
const workflow = {
|
|
91
|
-
name:
|
|
92
|
-
version:
|
|
93
|
-
description:
|
|
94
|
-
definition,
|
|
95
|
-
config:
|
|
95
|
+
name: sanitized.name,
|
|
96
|
+
version: sanitized.version,
|
|
97
|
+
description: sanitized.description,
|
|
98
|
+
definition: sanitized,
|
|
99
|
+
config: sanitized.config || {},
|
|
96
100
|
metadata: {
|
|
97
|
-
...options?.metadata ||
|
|
98
|
-
taskId: options?.taskId ||
|
|
101
|
+
...options?.metadata || sanitized.metadata || {},
|
|
102
|
+
taskId: options?.taskId || sanitized.metadata?.taskId
|
|
99
103
|
},
|
|
100
104
|
tags: effectiveTags
|
|
101
105
|
};
|
|
@@ -171,6 +175,9 @@ class WorkflowService {
|
|
|
171
175
|
if (options?.tags !== undefined) {
|
|
172
176
|
updateData.tags = options.tags;
|
|
173
177
|
}
|
|
178
|
+
if (updateData.definition) {
|
|
179
|
+
updateData.definition = sanitizeWorkflowDefinition(updateData.definition);
|
|
180
|
+
}
|
|
174
181
|
const updated = this.workflowRepository.update(workflow.id, updateData);
|
|
175
182
|
if (!updated) {
|
|
176
183
|
throw new Error(`Failed to update workflow: ${idOrName}`);
|