@ai-setting/roy-agent-core 1.5.42 → 1.5.44
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/agent/index.js +2 -2
- package/dist/env/index.js +11 -10
- package/dist/env/task/delegate/index.js +3 -2
- package/dist/env/task/index.js +3 -3
- package/dist/env/tool/built-in/index.js +1 -1
- package/dist/env/tool/index.js +2 -2
- package/dist/env/workflow/decorators/index.js +1 -1
- package/dist/env/workflow/engine/index.js +4 -3
- package/dist/env/workflow/index.js +34 -19
- package/dist/env/workflow/nodes/index.js +5 -1
- package/dist/env/workflow/types/index.js +16 -2
- package/dist/env/workflow/utils/index.js +15 -196
- package/dist/index.js +13 -12
- package/dist/shared/@ai-setting/{roy-agent-core-9q6sa7m3.js → roy-agent-core-1zq3p19q.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-ffb9fq4v.js → roy-agent-core-23gw9c4s.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-bmr6bdfb.js → roy-agent-core-2ms7296b.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-2jnzv9at.js → roy-agent-core-38dkek2y.js} +319 -189
- package/dist/shared/@ai-setting/roy-agent-core-6vxg2gmr.js +321 -0
- 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-xz22rmak.js → roy-agent-core-9p43ap7h.js} +21 -7
- package/dist/shared/@ai-setting/{roy-agent-core-7t05apnp.js → roy-agent-core-fg3j215p.js} +26 -0
- 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-qnrf2aw6.js +441 -0
- package/dist/shared/@ai-setting/{roy-agent-core-ek6gk3wk.js → roy-agent-core-r6rwsr54.js} +42 -3
- package/dist/shared/@ai-setting/roy-agent-core-v002ynpa.js +435 -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/package.json +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-5x94xmt6.js +0 -350
- package/dist/shared/@ai-setting/roy-agent-core-jvatggbb.js +0 -603
- /package/dist/shared/@ai-setting/{roy-agent-core-e130w7mv.js → roy-agent-core-ryw3ckfy.js} +0 -0
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_types,
|
|
3
|
+
nodeNotFound,
|
|
4
|
+
pathNotFound,
|
|
5
|
+
unresolvedVariable
|
|
6
|
+
} from "./roy-agent-core-qnrf2aw6.js";
|
|
7
|
+
import {
|
|
8
|
+
TracedAs,
|
|
9
|
+
init_decorator
|
|
10
|
+
} from "./roy-agent-core-q5qj0fes.js";
|
|
11
|
+
import {
|
|
12
|
+
__esm,
|
|
13
|
+
__legacyDecorateClassTS
|
|
14
|
+
} from "./roy-agent-core-fs0mn2jk.js";
|
|
15
|
+
|
|
16
|
+
// src/env/workflow/utils/template-resolver.ts
|
|
17
|
+
function resolveTemplates(input, context) {
|
|
18
|
+
const resolver = TemplateResolver.fromContext(context);
|
|
19
|
+
return resolver.resolveValue(input);
|
|
20
|
+
}
|
|
21
|
+
function resolveTemplateString(template, context) {
|
|
22
|
+
const resolver = TemplateResolver.fromContext(context);
|
|
23
|
+
return resolver.resolveString(template);
|
|
24
|
+
}
|
|
25
|
+
var TemplateResolver;
|
|
26
|
+
var init_template_resolver = __esm(() => {
|
|
27
|
+
init_decorator();
|
|
28
|
+
init_types();
|
|
29
|
+
TemplateResolver = class TemplateResolver {
|
|
30
|
+
input;
|
|
31
|
+
previousOutputs;
|
|
32
|
+
constructor(options = {}) {
|
|
33
|
+
this.input = options.input ?? {};
|
|
34
|
+
this.previousOutputs = options.previousOutputs ?? new Map;
|
|
35
|
+
}
|
|
36
|
+
static fromContext(context) {
|
|
37
|
+
return new TemplateResolver({
|
|
38
|
+
input: context.workflowInput ?? context.input,
|
|
39
|
+
previousOutputs: context.previousOutputs
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
resolveValue(input) {
|
|
43
|
+
if (input === null || input === undefined) {
|
|
44
|
+
return input;
|
|
45
|
+
}
|
|
46
|
+
if (typeof input === "string") {
|
|
47
|
+
const pureTemplate = this.extractPureTemplate(input);
|
|
48
|
+
if (pureTemplate) {
|
|
49
|
+
return this.resolvePureTemplate(pureTemplate);
|
|
50
|
+
}
|
|
51
|
+
return this.resolveString(input);
|
|
52
|
+
}
|
|
53
|
+
if (Array.isArray(input)) {
|
|
54
|
+
return input.map((item) => this.resolveValue(item));
|
|
55
|
+
}
|
|
56
|
+
if (typeof input === "object") {
|
|
57
|
+
const resolved = {};
|
|
58
|
+
for (const [key, value] of Object.entries(input)) {
|
|
59
|
+
resolved[key] = this.resolveValue(value);
|
|
60
|
+
}
|
|
61
|
+
return resolved;
|
|
62
|
+
}
|
|
63
|
+
return input;
|
|
64
|
+
}
|
|
65
|
+
extractPureTemplate(str) {
|
|
66
|
+
const trimmed = str.trim();
|
|
67
|
+
if (trimmed.startsWith("{{") && trimmed.endsWith("}}") && trimmed.length > 4) {
|
|
68
|
+
const content = trimmed.slice(2, -2).trim();
|
|
69
|
+
if (!content.includes("{{") && !content.includes("}}")) {
|
|
70
|
+
return content;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
resolvePureTemplate(templateContent) {
|
|
76
|
+
const value = this.resolveTemplateContent(templateContent);
|
|
77
|
+
return value;
|
|
78
|
+
}
|
|
79
|
+
resolveTemplateContent(templateContent) {
|
|
80
|
+
const trimmed = templateContent.trim();
|
|
81
|
+
if (trimmed.startsWith("input.")) {
|
|
82
|
+
return this.getNestedValue(this.input, trimmed.slice(6));
|
|
83
|
+
}
|
|
84
|
+
if (trimmed.startsWith("inputs.")) {
|
|
85
|
+
return this.getNestedValue(this.input, trimmed.slice(7));
|
|
86
|
+
}
|
|
87
|
+
if (trimmed.startsWith("nodes.")) {
|
|
88
|
+
return this.resolveNodePath(trimmed.slice(6));
|
|
89
|
+
}
|
|
90
|
+
if (trimmed !== "input" && trimmed !== "inputs" && trimmed !== "nodes") {
|
|
91
|
+
const segments = trimmed.split(".");
|
|
92
|
+
const nodeId = segments[0];
|
|
93
|
+
const restPath = segments.slice(1).join(".") || undefined;
|
|
94
|
+
return this.resolveNodePath(`${nodeId}${restPath ? "." + restPath : ""}`);
|
|
95
|
+
}
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
resolveString(template) {
|
|
99
|
+
if (!template || typeof template !== "string") {
|
|
100
|
+
return template;
|
|
101
|
+
}
|
|
102
|
+
let resolved = template;
|
|
103
|
+
resolved = resolved.replace(/\{\{inputs\./g, "{{input.");
|
|
104
|
+
resolved = resolved.replace(/\{\{input\.([^}]+)\}\}/g, (match, path) => {
|
|
105
|
+
const value = this.getNestedValue(this.input, path);
|
|
106
|
+
return this.stringify(value, match);
|
|
107
|
+
});
|
|
108
|
+
resolved = resolved.replace(/\{\{nodes\.([^}]+)\}\}/g, (match, path) => {
|
|
109
|
+
const value = this.resolveNodePath(path);
|
|
110
|
+
return this.stringify(value, match);
|
|
111
|
+
});
|
|
112
|
+
resolved = resolved.replace(/\{\{([a-zA-Z_][a-zA-Z0-9_-]*)(?:\.([^}]+))?\}\}/g, (match, nodeId, path) => {
|
|
113
|
+
if (nodeId === "input") {
|
|
114
|
+
return match;
|
|
115
|
+
}
|
|
116
|
+
if (nodeId === "nodes") {
|
|
117
|
+
return match;
|
|
118
|
+
}
|
|
119
|
+
const value = this.resolveNodePath(`${nodeId}${path ? "." + path : ""}`);
|
|
120
|
+
return this.stringify(value, match);
|
|
121
|
+
});
|
|
122
|
+
return resolved;
|
|
123
|
+
}
|
|
124
|
+
resolveNodePath(path) {
|
|
125
|
+
const segments = path.split(".");
|
|
126
|
+
const nodeId = segments[0];
|
|
127
|
+
if (!nodeId) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
let value = this.previousOutputs.get(nodeId);
|
|
131
|
+
if (value === undefined) {
|
|
132
|
+
const normalizedUnderscore = nodeId.replace(/-/g, "_");
|
|
133
|
+
const normalizedHyphen = nodeId.replace(/_/g, "-");
|
|
134
|
+
if (normalizedUnderscore !== nodeId) {
|
|
135
|
+
value = this.previousOutputs.get(normalizedUnderscore);
|
|
136
|
+
}
|
|
137
|
+
if (value === undefined && normalizedHyphen !== nodeId) {
|
|
138
|
+
value = this.previousOutputs.get(normalizedHyphen);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (value === undefined) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (segments.length === 1) {
|
|
145
|
+
if (value && typeof value === "object" && "result" in value && !("nodes" in value)) {
|
|
146
|
+
value = value.result;
|
|
147
|
+
}
|
|
148
|
+
return value;
|
|
149
|
+
}
|
|
150
|
+
const secondSegment = segments[1];
|
|
151
|
+
if (secondSegment === "result" || secondSegment === "output") {
|
|
152
|
+
if (value && typeof value === "object" && "result" in value) {
|
|
153
|
+
value = value.result;
|
|
154
|
+
if (segments.length === 2) {
|
|
155
|
+
return value;
|
|
156
|
+
}
|
|
157
|
+
for (let i = 2;i < segments.length; i++) {
|
|
158
|
+
if (value === null || value === undefined) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
value = value[segments[i]];
|
|
162
|
+
}
|
|
163
|
+
return value;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
for (let i = 1;i < segments.length; i++) {
|
|
167
|
+
if (value === null || value === undefined) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
value = value[segments[i]];
|
|
171
|
+
}
|
|
172
|
+
return value;
|
|
173
|
+
}
|
|
174
|
+
getNestedValue(obj, path) {
|
|
175
|
+
if (!obj || !path) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const segments = path.split(".");
|
|
179
|
+
let current = obj;
|
|
180
|
+
for (const segment of segments) {
|
|
181
|
+
if (current === null || current === undefined) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
if (typeof current !== "object") {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
current = current[segment];
|
|
188
|
+
}
|
|
189
|
+
return current;
|
|
190
|
+
}
|
|
191
|
+
stringify(value, originalTemplate) {
|
|
192
|
+
if (value === undefined) {
|
|
193
|
+
return originalTemplate;
|
|
194
|
+
}
|
|
195
|
+
if (typeof value === "string") {
|
|
196
|
+
return value;
|
|
197
|
+
}
|
|
198
|
+
if (value === null) {
|
|
199
|
+
return "null";
|
|
200
|
+
}
|
|
201
|
+
return JSON.stringify(value);
|
|
202
|
+
}
|
|
203
|
+
containsTemplates(str) {
|
|
204
|
+
if (typeof str !== "string") {
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
return /\{\{[^}]+\}\}/.test(str);
|
|
208
|
+
}
|
|
209
|
+
extractTemplates(str) {
|
|
210
|
+
if (typeof str !== "string") {
|
|
211
|
+
return [];
|
|
212
|
+
}
|
|
213
|
+
const matches = str.match(/\{\{[^}]+\}\}/g);
|
|
214
|
+
return matches ?? [];
|
|
215
|
+
}
|
|
216
|
+
resolveAndValidate(input) {
|
|
217
|
+
const unresolved = [];
|
|
218
|
+
const resolved = this.resolveValueWithTracking(input, unresolved);
|
|
219
|
+
return { resolved, unresolved };
|
|
220
|
+
}
|
|
221
|
+
resolveValueWithTracking(input, unresolved) {
|
|
222
|
+
if (input === null || input === undefined) {
|
|
223
|
+
return input;
|
|
224
|
+
}
|
|
225
|
+
if (typeof input === "string") {
|
|
226
|
+
const pureTemplate = this.extractPureTemplate(input);
|
|
227
|
+
if (pureTemplate) {
|
|
228
|
+
const value = this.resolvePureTemplate(pureTemplate);
|
|
229
|
+
if (value === undefined) {
|
|
230
|
+
unresolved.push(input);
|
|
231
|
+
return input;
|
|
232
|
+
}
|
|
233
|
+
return value;
|
|
234
|
+
}
|
|
235
|
+
return this.resolveStringWithTracking(input, unresolved);
|
|
236
|
+
}
|
|
237
|
+
if (Array.isArray(input)) {
|
|
238
|
+
return input.map((item) => this.resolveValueWithTracking(item, unresolved));
|
|
239
|
+
}
|
|
240
|
+
if (typeof input === "object") {
|
|
241
|
+
const result = {};
|
|
242
|
+
for (const [key, value] of Object.entries(input)) {
|
|
243
|
+
result[key] = this.resolveValueWithTracking(value, unresolved);
|
|
244
|
+
}
|
|
245
|
+
return result;
|
|
246
|
+
}
|
|
247
|
+
return input;
|
|
248
|
+
}
|
|
249
|
+
resolveStringWithTracking(str, unresolved) {
|
|
250
|
+
const templates = this.extractTemplates(str);
|
|
251
|
+
let resolved = str;
|
|
252
|
+
for (const template of templates) {
|
|
253
|
+
const pureContent = template.slice(2, -2).trim();
|
|
254
|
+
const value = this.resolveTemplateContent(pureContent);
|
|
255
|
+
if (value === undefined) {
|
|
256
|
+
unresolved.push(template);
|
|
257
|
+
} else {
|
|
258
|
+
const resolvedValue = this.stringify(value, template);
|
|
259
|
+
resolved = resolved.replace(template, resolvedValue);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return resolved;
|
|
263
|
+
}
|
|
264
|
+
resolveStrict(input, nodeId) {
|
|
265
|
+
const result = this.resolveAndValidate(input);
|
|
266
|
+
if (result.unresolved.length > 0) {
|
|
267
|
+
for (const template of result.unresolved) {
|
|
268
|
+
const path = template.replace(/^\{\{|\}\}$/g, "");
|
|
269
|
+
if (path.startsWith("input.")) {
|
|
270
|
+
const inputKey = path.slice(6);
|
|
271
|
+
const value = this.getNestedValue(this.input, inputKey);
|
|
272
|
+
if (value === undefined) {
|
|
273
|
+
throw unresolvedVariable(template, inputKey);
|
|
274
|
+
}
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
if (path.startsWith("inputs.")) {
|
|
278
|
+
const inputKey = path.slice(7);
|
|
279
|
+
const value = this.getNestedValue(this.input, inputKey);
|
|
280
|
+
if (value === undefined) {
|
|
281
|
+
throw unresolvedVariable(template, inputKey);
|
|
282
|
+
}
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
if (path.startsWith("nodes.")) {
|
|
286
|
+
const afterPrefix = path.slice(6);
|
|
287
|
+
const nodeParts = afterPrefix.split(".");
|
|
288
|
+
const refNodeId = nodeParts[0];
|
|
289
|
+
if (!this.previousOutputs.has(refNodeId)) {
|
|
290
|
+
throw nodeNotFound(refNodeId, [template]);
|
|
291
|
+
}
|
|
292
|
+
if (nodeParts.length > 1) {
|
|
293
|
+
const refPath = nodeParts.slice(1).join(".");
|
|
294
|
+
const nodeValue = this.previousOutputs.get(refNodeId);
|
|
295
|
+
const nestedValue = this.getNestedValue(nodeValue, refPath);
|
|
296
|
+
if (nestedValue === undefined) {
|
|
297
|
+
throw pathNotFound(refNodeId, refPath, template);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
if (path.includes(".")) {
|
|
303
|
+
const [refNodeId, ...pathParts] = path.split(".");
|
|
304
|
+
if (this.previousOutputs.has(refNodeId)) {
|
|
305
|
+
const refPath = pathParts.join(".");
|
|
306
|
+
const nodeValue = this.previousOutputs.get(refNodeId);
|
|
307
|
+
const nestedValue = this.getNestedValue(nodeValue, refPath);
|
|
308
|
+
if (nestedValue === undefined) {
|
|
309
|
+
throw pathNotFound(refNodeId, refPath, template);
|
|
310
|
+
}
|
|
311
|
+
} else {
|
|
312
|
+
throw nodeNotFound(refNodeId, [template]);
|
|
313
|
+
}
|
|
314
|
+
} else {
|
|
315
|
+
if (!this.previousOutputs.has(path)) {
|
|
316
|
+
throw nodeNotFound(path, [template]);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
throw unresolvedVariable(result.unresolved[0], result.unresolved.join(", "));
|
|
321
|
+
}
|
|
322
|
+
return result.resolved;
|
|
323
|
+
}
|
|
324
|
+
evaluateCondition(condition) {
|
|
325
|
+
const resolved = this.resolveString(condition);
|
|
326
|
+
return this.parseCondition(resolved);
|
|
327
|
+
}
|
|
328
|
+
parseCondition(condition) {
|
|
329
|
+
const expr = condition.trim();
|
|
330
|
+
if (expr === "true")
|
|
331
|
+
return true;
|
|
332
|
+
if (expr === "false")
|
|
333
|
+
return false;
|
|
334
|
+
if (expr.startsWith("!")) {
|
|
335
|
+
return !this.parseCondition(expr.slice(1).trim());
|
|
336
|
+
}
|
|
337
|
+
const orParts = this.splitByOperator(expr, "||");
|
|
338
|
+
if (orParts.length > 1) {
|
|
339
|
+
return orParts.some((p) => this.parseCondition(p.trim()));
|
|
340
|
+
}
|
|
341
|
+
const andParts = this.splitByOperator(expr, "&&");
|
|
342
|
+
if (andParts.length > 1) {
|
|
343
|
+
return andParts.every((p) => this.parseCondition(p.trim()));
|
|
344
|
+
}
|
|
345
|
+
const comparisonPatterns = [
|
|
346
|
+
{ pattern: /^(.+)\s*===\s*(.+)$/, op: "===" },
|
|
347
|
+
{ pattern: /^(.+)\s*!==\s*(.+)$/, op: "!==" },
|
|
348
|
+
{ pattern: /^(.+)\s*==\s*(.+)$/, op: "==" },
|
|
349
|
+
{ pattern: /^(.+)\s*!=\s*(.+)$/, op: "!=" },
|
|
350
|
+
{ pattern: /^(.+)\s*>=\s*(.+)$/, op: ">=" },
|
|
351
|
+
{ pattern: /^(.+)\s*<=\s*(.+)$/, op: "<=" },
|
|
352
|
+
{ pattern: /^(.+)\s*>\s*(.+)$/, op: ">" },
|
|
353
|
+
{ pattern: /^(.+)\s*<\s*(.+)$/, op: "<" }
|
|
354
|
+
];
|
|
355
|
+
for (const { pattern, op } of comparisonPatterns) {
|
|
356
|
+
const match = expr.match(pattern);
|
|
357
|
+
if (match) {
|
|
358
|
+
const left = this.evaluateValue(match[1].trim());
|
|
359
|
+
const right = this.evaluateValue(match[2].trim());
|
|
360
|
+
return this.compare(left, right, op);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
return Boolean(this.evaluateValue(expr));
|
|
364
|
+
}
|
|
365
|
+
splitByOperator(expr, op) {
|
|
366
|
+
const parts = [];
|
|
367
|
+
let current = "";
|
|
368
|
+
let inQuotes = null;
|
|
369
|
+
for (let i = 0;i < expr.length; i++) {
|
|
370
|
+
const char = expr[i];
|
|
371
|
+
if (char === '"' || char === "'") {
|
|
372
|
+
if (inQuotes === char) {
|
|
373
|
+
inQuotes = null;
|
|
374
|
+
} else if (inQuotes === null) {
|
|
375
|
+
inQuotes = char;
|
|
376
|
+
}
|
|
377
|
+
current += char;
|
|
378
|
+
} else if (inQuotes) {
|
|
379
|
+
current += char;
|
|
380
|
+
} else if (expr.slice(i, i + op.length) === op) {
|
|
381
|
+
parts.push(current);
|
|
382
|
+
current = "";
|
|
383
|
+
i += op.length - 1;
|
|
384
|
+
} else {
|
|
385
|
+
current += char;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
if (current) {
|
|
389
|
+
parts.push(current);
|
|
390
|
+
}
|
|
391
|
+
return parts;
|
|
392
|
+
}
|
|
393
|
+
evaluateValue(value) {
|
|
394
|
+
const v = value.trim();
|
|
395
|
+
if (v === "true")
|
|
396
|
+
return true;
|
|
397
|
+
if (v === "false")
|
|
398
|
+
return false;
|
|
399
|
+
if (!isNaN(Number(v)))
|
|
400
|
+
return Number(v);
|
|
401
|
+
if (v.startsWith('"') && v.endsWith('"') || v.startsWith("'") && v.endsWith("'")) {
|
|
402
|
+
return v.slice(1, -1);
|
|
403
|
+
}
|
|
404
|
+
return v;
|
|
405
|
+
}
|
|
406
|
+
compare(left, right, op) {
|
|
407
|
+
switch (op) {
|
|
408
|
+
case "===":
|
|
409
|
+
case "==":
|
|
410
|
+
return left === right;
|
|
411
|
+
case "!==":
|
|
412
|
+
case "!=":
|
|
413
|
+
return left !== right;
|
|
414
|
+
case ">":
|
|
415
|
+
return Number(left) > Number(right);
|
|
416
|
+
case "<":
|
|
417
|
+
return Number(left) < Number(right);
|
|
418
|
+
case ">=":
|
|
419
|
+
return Number(left) >= Number(right);
|
|
420
|
+
case "<=":
|
|
421
|
+
return Number(left) <= Number(right);
|
|
422
|
+
default:
|
|
423
|
+
return false;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
__legacyDecorateClassTS([
|
|
428
|
+
TracedAs("workflow.template.resolveAndValidate", { log: true })
|
|
429
|
+
], TemplateResolver.prototype, "resolveAndValidate", null);
|
|
430
|
+
__legacyDecorateClassTS([
|
|
431
|
+
TracedAs("workflow.template.resolveStrict", { log: true })
|
|
432
|
+
], TemplateResolver.prototype, "resolveStrict", null);
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
export { TemplateResolver, resolveTemplates, resolveTemplateString, init_template_resolver };
|
|
@@ -287,16 +287,13 @@ var bashTool = {
|
|
|
287
287
|
};
|
|
288
288
|
|
|
289
289
|
// src/env/tool/built-in/echo.ts
|
|
290
|
+
import { z as z2 } from "zod";
|
|
290
291
|
var echoTool = {
|
|
291
292
|
name: "echo",
|
|
292
293
|
description: "Echo a message to the console. Useful for logging in workflows.",
|
|
293
|
-
parameters: {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
type: "string",
|
|
297
|
-
description: "The message to echo"
|
|
298
|
-
}
|
|
299
|
-
},
|
|
294
|
+
parameters: z2.object({
|
|
295
|
+
message: z2.string().optional().describe("The message to echo")
|
|
296
|
+
}),
|
|
300
297
|
execute: async (args, _ctx) => {
|
|
301
298
|
const message = args?.message || "(no message)";
|
|
302
299
|
return {
|
|
@@ -310,18 +307,18 @@ var echoTool = {
|
|
|
310
307
|
};
|
|
311
308
|
|
|
312
309
|
// src/env/tool/built-in/glob.ts
|
|
313
|
-
import { z as
|
|
310
|
+
import { z as z3 } from "zod";
|
|
314
311
|
import { glob as globAsync } from "glob";
|
|
315
312
|
import { stat } from "fs/promises";
|
|
316
313
|
import path from "path";
|
|
317
314
|
var globTool = {
|
|
318
315
|
name: "glob",
|
|
319
316
|
description: "Search for files matching a glob pattern. Use this to find files by name patterns like **/*.ts or **/*.md.",
|
|
320
|
-
parameters:
|
|
321
|
-
pattern:
|
|
322
|
-
cwd:
|
|
323
|
-
maxResults:
|
|
324
|
-
ignore:
|
|
317
|
+
parameters: z3.object({
|
|
318
|
+
pattern: z3.string().min(1).describe("Glob pattern to match (e.g., **/*.ts, **/*.md)"),
|
|
319
|
+
cwd: z3.string().optional().describe("Working directory to search in"),
|
|
320
|
+
maxResults: z3.number().int().positive().default(100).optional().describe("Maximum number of results to return"),
|
|
321
|
+
ignore: z3.array(z3.string()).optional().describe("Patterns to ignore")
|
|
325
322
|
}),
|
|
326
323
|
sandbox: {
|
|
327
324
|
enabled: true
|
|
@@ -415,17 +412,17 @@ var globTool = {
|
|
|
415
412
|
};
|
|
416
413
|
|
|
417
414
|
// src/env/tool/built-in/read-file.ts
|
|
418
|
-
import { z as
|
|
415
|
+
import { z as z4 } from "zod";
|
|
419
416
|
import { readFile, stat as stat2 } from "fs/promises";
|
|
420
417
|
import path2 from "path";
|
|
421
418
|
var readFileTool = {
|
|
422
419
|
name: "read_file",
|
|
423
420
|
description: "Read the contents of a file. Use this to read source code, configuration files, or any text files.",
|
|
424
|
-
parameters:
|
|
425
|
-
path:
|
|
426
|
-
offset:
|
|
427
|
-
limit:
|
|
428
|
-
encoding:
|
|
421
|
+
parameters: z4.object({
|
|
422
|
+
path: z4.string().describe("The file path to read"),
|
|
423
|
+
offset: z4.number().int().nonnegative().optional().describe("Line offset to start reading from"),
|
|
424
|
+
limit: z4.number().int().positive().optional().describe("Number of lines to read"),
|
|
425
|
+
encoding: z4.enum(["utf-8", "base64"]).default("utf-8").optional().describe("File encoding")
|
|
429
426
|
}),
|
|
430
427
|
sandbox: {
|
|
431
428
|
enabled: true,
|
|
@@ -530,17 +527,17 @@ var readFileTool = {
|
|
|
530
527
|
};
|
|
531
528
|
|
|
532
529
|
// src/env/tool/built-in/write-file.ts
|
|
533
|
-
import { z as
|
|
530
|
+
import { z as z5 } from "zod";
|
|
534
531
|
import { writeFile, mkdir, stat as stat3 } from "fs/promises";
|
|
535
532
|
import path3 from "path";
|
|
536
533
|
var writeFileTool = {
|
|
537
534
|
name: "write_file",
|
|
538
535
|
description: "Write content to a file. Use this to create new files or overwrite existing ones.",
|
|
539
|
-
parameters:
|
|
540
|
-
path:
|
|
541
|
-
content:
|
|
542
|
-
createDirs:
|
|
543
|
-
append:
|
|
536
|
+
parameters: z5.object({
|
|
537
|
+
path: z5.string().describe("The file path to write to"),
|
|
538
|
+
content: z5.string().describe("The content to write"),
|
|
539
|
+
createDirs: z5.boolean().default(false).optional().describe("Create parent directories if they don't exist"),
|
|
540
|
+
append: z5.boolean().default(false).optional().describe("Append to file instead of overwrite")
|
|
544
541
|
}),
|
|
545
542
|
sandbox: {
|
|
546
543
|
enabled: true,
|
|
@@ -620,18 +617,18 @@ var writeFileTool = {
|
|
|
620
617
|
};
|
|
621
618
|
|
|
622
619
|
// src/env/tool/built-in/edit-file.ts
|
|
623
|
-
import { z as
|
|
620
|
+
import { z as z6 } from "zod";
|
|
624
621
|
import { readFile as readFile2, writeFile as writeFile2, stat as stat4, unlink } from "fs/promises";
|
|
625
622
|
import path4 from "path";
|
|
626
623
|
import { randomUUID } from "crypto";
|
|
627
624
|
var editFileTool = {
|
|
628
625
|
name: "edit_file",
|
|
629
626
|
description: "Edit a file by replacing specific text. Use this to make targeted changes to files by specifying what to find and what to replace.",
|
|
630
|
-
parameters:
|
|
631
|
-
path:
|
|
632
|
-
oldString:
|
|
633
|
-
newString:
|
|
634
|
-
replaceAll:
|
|
627
|
+
parameters: z6.object({
|
|
628
|
+
path: z6.string().describe("The file path to edit"),
|
|
629
|
+
oldString: z6.string().describe("The text to find and replace"),
|
|
630
|
+
newString: z6.string().describe("The replacement text"),
|
|
631
|
+
replaceAll: z6.boolean().default(false).optional().describe("Replace all occurrences instead of just the first")
|
|
635
632
|
}),
|
|
636
633
|
sandbox: {
|
|
637
634
|
enabled: true,
|
|
@@ -736,7 +733,7 @@ function escapeRegExp(string) {
|
|
|
736
733
|
}
|
|
737
734
|
|
|
738
735
|
// src/env/tool/built-in/grep.ts
|
|
739
|
-
import { z as
|
|
736
|
+
import { z as z7 } from "zod";
|
|
740
737
|
import { readFile as readFile3, stat as stat5 } from "fs/promises";
|
|
741
738
|
import { glob as globAsync2 } from "glob";
|
|
742
739
|
import path5 from "path";
|
|
@@ -751,13 +748,13 @@ function isBinaryContent(content) {
|
|
|
751
748
|
var grepTool = {
|
|
752
749
|
name: "grep",
|
|
753
750
|
description: "Search for text patterns in files. Use this to find specific strings, code patterns, or content across multiple files.",
|
|
754
|
-
parameters:
|
|
755
|
-
pattern:
|
|
756
|
-
path:
|
|
757
|
-
include:
|
|
758
|
-
caseSensitive:
|
|
759
|
-
maxResults:
|
|
760
|
-
showLineNumbers:
|
|
751
|
+
parameters: z7.object({
|
|
752
|
+
pattern: z7.string().min(1).describe("The pattern to search for"),
|
|
753
|
+
path: z7.string().optional().describe("File or directory path to search in"),
|
|
754
|
+
include: z7.string().optional().describe("Glob pattern for files to include (e.g., *.ts, *.js)"),
|
|
755
|
+
caseSensitive: z7.boolean().default(true).optional().describe("Whether the search should be case sensitive"),
|
|
756
|
+
maxResults: z7.number().int().positive().default(50).optional().describe("Maximum number of results"),
|
|
757
|
+
showLineNumbers: z7.boolean().default(true).optional().describe("Show line numbers in results")
|
|
761
758
|
}),
|
|
762
759
|
sandbox: {
|
|
763
760
|
enabled: true
|
|
@@ -3,8 +3,12 @@ import {
|
|
|
3
3
|
hasDecoratorNodes,
|
|
4
4
|
init_node_registry_helper,
|
|
5
5
|
registerDecoratorNodeType
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-9bmtxmp6.js";
|
|
7
7
|
import"./roy-agent-core-1ce3fqrk.js";
|
|
8
|
+
import"./roy-agent-core-q5qj0fes.js";
|
|
9
|
+
import"./roy-agent-core-10n2jh7p.js";
|
|
10
|
+
import"./roy-agent-core-58k274fg.js";
|
|
11
|
+
import"./roy-agent-core-c6592r3c.js";
|
|
8
12
|
import"./roy-agent-core-fs0mn2jk.js";
|
|
9
13
|
init_node_registry_helper();
|
|
10
14
|
|