@ai-setting/roy-agent-cli 1.5.5 → 1.5.7
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/bin/roy-agent.js +60 -8
- package/dist/index.js +60 -8
- package/dist/roy-agent-linux-x64/bin/roy-agent +0 -0
- package/package.json +3 -3
package/dist/bin/roy-agent.js
CHANGED
|
@@ -7220,7 +7220,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
7220
7220
|
var require_package = __commonJS((exports, module) => {
|
|
7221
7221
|
module.exports = {
|
|
7222
7222
|
name: "@ai-setting/roy-agent-cli",
|
|
7223
|
-
version: "1.5.
|
|
7223
|
+
version: "1.5.6",
|
|
7224
7224
|
type: "module",
|
|
7225
7225
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
7226
7226
|
main: "./dist/index.js",
|
|
@@ -15565,6 +15565,8 @@ class WorkflowValidator {
|
|
|
15565
15565
|
errors.push(...depErrors);
|
|
15566
15566
|
const templateErrors = this.validateTemplateReferences(nodes, nodeIds);
|
|
15567
15567
|
errors.push(...templateErrors);
|
|
15568
|
+
const inputErrors = this.validateWorkflowInputs(nodes, workflow.inputs);
|
|
15569
|
+
errors.push(...inputErrors);
|
|
15568
15570
|
return {
|
|
15569
15571
|
valid: errors.length === 0,
|
|
15570
15572
|
errors,
|
|
@@ -15769,6 +15771,57 @@ class WorkflowValidator {
|
|
|
15769
15771
|
}
|
|
15770
15772
|
return errors;
|
|
15771
15773
|
}
|
|
15774
|
+
validateWorkflowInputs(nodes, inputs) {
|
|
15775
|
+
const errors = [];
|
|
15776
|
+
if (!inputs || !Array.isArray(inputs)) {
|
|
15777
|
+
return errors;
|
|
15778
|
+
}
|
|
15779
|
+
const definedInputs = new Set(inputs.map((i) => i.name));
|
|
15780
|
+
const inputTemplatePattern = /\{\{input\.([a-zA-Z_][a-zA-Z0-9_-]*)/g;
|
|
15781
|
+
const dollarInputPattern = /\$\{input\.([a-zA-Z_][a-zA-Z0-9_-]*)/g;
|
|
15782
|
+
const referencedInputs = new Set;
|
|
15783
|
+
for (const node of nodes) {
|
|
15784
|
+
if (!node.config)
|
|
15785
|
+
continue;
|
|
15786
|
+
const configStr = JSON.stringify(node.config);
|
|
15787
|
+
let match;
|
|
15788
|
+
inputTemplatePattern.lastIndex = 0;
|
|
15789
|
+
while ((match = inputTemplatePattern.exec(configStr)) !== null) {
|
|
15790
|
+
referencedInputs.add(match[1]);
|
|
15791
|
+
}
|
|
15792
|
+
dollarInputPattern.lastIndex = 0;
|
|
15793
|
+
while ((match = dollarInputPattern.exec(configStr)) !== null) {
|
|
15794
|
+
referencedInputs.add(match[1]);
|
|
15795
|
+
}
|
|
15796
|
+
}
|
|
15797
|
+
for (const ref of referencedInputs) {
|
|
15798
|
+
if (definedInputs.has(ref))
|
|
15799
|
+
continue;
|
|
15800
|
+
const hasDefault = this.inputHasDefaultFilter(ref, nodes);
|
|
15801
|
+
if (hasDefault)
|
|
15802
|
+
continue;
|
|
15803
|
+
errors.push({
|
|
15804
|
+
type: "UNDEFINED_INPUT_REFERENCE" /* UNDEFINED_INPUT_REFERENCE */,
|
|
15805
|
+
description: `Template references undefined input: "${ref}"`,
|
|
15806
|
+
expected: `Define "${ref}" in workflow inputs array or use default filter`,
|
|
15807
|
+
actual: `{{input.${ref}}}`,
|
|
15808
|
+
fix: `Add "${ref}" to the inputs array, e.g.: inputs: [{ name: "${ref}", type: "string", required: true }]`
|
|
15809
|
+
});
|
|
15810
|
+
}
|
|
15811
|
+
return errors;
|
|
15812
|
+
}
|
|
15813
|
+
inputHasDefaultFilter(inputName, nodes) {
|
|
15814
|
+
for (const node of nodes) {
|
|
15815
|
+
if (!node.config)
|
|
15816
|
+
continue;
|
|
15817
|
+
const configStr = JSON.stringify(node.config);
|
|
15818
|
+
const defaultFilterRegex = new RegExp("input\\." + inputName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "\\s*\\|\\s*default\\s*\\(", "g");
|
|
15819
|
+
if (defaultFilterRegex.test(configStr)) {
|
|
15820
|
+
return true;
|
|
15821
|
+
}
|
|
15822
|
+
}
|
|
15823
|
+
return false;
|
|
15824
|
+
}
|
|
15772
15825
|
}
|
|
15773
15826
|
|
|
15774
15827
|
// src/commands/workflow/commands/add.ts
|
|
@@ -16342,13 +16395,12 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
16342
16395
|
output.error('WorkflowService not initialized. Please run "roy-agent workflow init" first.');
|
|
16343
16396
|
process.exit(1);
|
|
16344
16397
|
}
|
|
16345
|
-
let input
|
|
16398
|
+
let input;
|
|
16346
16399
|
if (args.input) {
|
|
16347
16400
|
try {
|
|
16348
16401
|
input = JSON.parse(args.input);
|
|
16349
16402
|
} catch {
|
|
16350
|
-
|
|
16351
|
-
process.exit(1);
|
|
16403
|
+
input = undefined;
|
|
16352
16404
|
}
|
|
16353
16405
|
}
|
|
16354
16406
|
const runOptions = {
|
|
@@ -16386,7 +16438,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
16386
16438
|
}
|
|
16387
16439
|
const engine = service.engineFactory(workflow);
|
|
16388
16440
|
const result = await engine.run(sessionId, {
|
|
16389
|
-
input:
|
|
16441
|
+
input: input || undefined
|
|
16390
16442
|
});
|
|
16391
16443
|
output.log(renderRunResult({
|
|
16392
16444
|
runId: sessionId,
|
|
@@ -16441,7 +16493,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
16441
16493
|
}));
|
|
16442
16494
|
if (result.status === "paused") {
|
|
16443
16495
|
output.log(chalk55.gray(`
|
|
16444
|
-
\uD83D\uDCA1 Use "roy-agent workflow run -
|
|
16496
|
+
\uD83D\uDCA1 Use "roy-agent workflow run ${result.runId} --session-id ${result.runId} --input '<response>'" to resume`));
|
|
16445
16497
|
}
|
|
16446
16498
|
} else {
|
|
16447
16499
|
output.log(chalk55.blue(`\uD83D\uDE80 Running workflow: ${args.identifier}`));
|
|
@@ -16455,7 +16507,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
16455
16507
|
}));
|
|
16456
16508
|
if (result.status === "paused") {
|
|
16457
16509
|
output.log(chalk55.gray(`
|
|
16458
|
-
\uD83D\uDCA1 Use "roy-agent workflow run -
|
|
16510
|
+
\uD83D\uDCA1 Use "roy-agent workflow run ${result.runId} --session-id ${result.runId} --input '<response>'" to resume`));
|
|
16459
16511
|
}
|
|
16460
16512
|
}
|
|
16461
16513
|
if (workflowSpan) {
|
|
@@ -16486,7 +16538,7 @@ var WorkflowRunCommand = {
|
|
|
16486
16538
|
default: false
|
|
16487
16539
|
}).option("input", {
|
|
16488
16540
|
alias: "i",
|
|
16489
|
-
describe: "输入参数 (JSON
|
|
16541
|
+
describe: "输入参数 (JSON 格式用于新运行,字符串用于恢复暂停的 workflow)",
|
|
16490
16542
|
type: "string"
|
|
16491
16543
|
}).option("parallel-limit", {
|
|
16492
16544
|
describe: "并行限制",
|
package/dist/index.js
CHANGED
|
@@ -7219,7 +7219,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
7219
7219
|
var require_package = __commonJS((exports, module) => {
|
|
7220
7220
|
module.exports = {
|
|
7221
7221
|
name: "@ai-setting/roy-agent-cli",
|
|
7222
|
-
version: "1.5.
|
|
7222
|
+
version: "1.5.6",
|
|
7223
7223
|
type: "module",
|
|
7224
7224
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
7225
7225
|
main: "./dist/index.js",
|
|
@@ -15564,6 +15564,8 @@ class WorkflowValidator {
|
|
|
15564
15564
|
errors.push(...depErrors);
|
|
15565
15565
|
const templateErrors = this.validateTemplateReferences(nodes, nodeIds);
|
|
15566
15566
|
errors.push(...templateErrors);
|
|
15567
|
+
const inputErrors = this.validateWorkflowInputs(nodes, workflow.inputs);
|
|
15568
|
+
errors.push(...inputErrors);
|
|
15567
15569
|
return {
|
|
15568
15570
|
valid: errors.length === 0,
|
|
15569
15571
|
errors,
|
|
@@ -15768,6 +15770,57 @@ class WorkflowValidator {
|
|
|
15768
15770
|
}
|
|
15769
15771
|
return errors;
|
|
15770
15772
|
}
|
|
15773
|
+
validateWorkflowInputs(nodes, inputs) {
|
|
15774
|
+
const errors = [];
|
|
15775
|
+
if (!inputs || !Array.isArray(inputs)) {
|
|
15776
|
+
return errors;
|
|
15777
|
+
}
|
|
15778
|
+
const definedInputs = new Set(inputs.map((i) => i.name));
|
|
15779
|
+
const inputTemplatePattern = /\{\{input\.([a-zA-Z_][a-zA-Z0-9_-]*)/g;
|
|
15780
|
+
const dollarInputPattern = /\$\{input\.([a-zA-Z_][a-zA-Z0-9_-]*)/g;
|
|
15781
|
+
const referencedInputs = new Set;
|
|
15782
|
+
for (const node of nodes) {
|
|
15783
|
+
if (!node.config)
|
|
15784
|
+
continue;
|
|
15785
|
+
const configStr = JSON.stringify(node.config);
|
|
15786
|
+
let match;
|
|
15787
|
+
inputTemplatePattern.lastIndex = 0;
|
|
15788
|
+
while ((match = inputTemplatePattern.exec(configStr)) !== null) {
|
|
15789
|
+
referencedInputs.add(match[1]);
|
|
15790
|
+
}
|
|
15791
|
+
dollarInputPattern.lastIndex = 0;
|
|
15792
|
+
while ((match = dollarInputPattern.exec(configStr)) !== null) {
|
|
15793
|
+
referencedInputs.add(match[1]);
|
|
15794
|
+
}
|
|
15795
|
+
}
|
|
15796
|
+
for (const ref of referencedInputs) {
|
|
15797
|
+
if (definedInputs.has(ref))
|
|
15798
|
+
continue;
|
|
15799
|
+
const hasDefault = this.inputHasDefaultFilter(ref, nodes);
|
|
15800
|
+
if (hasDefault)
|
|
15801
|
+
continue;
|
|
15802
|
+
errors.push({
|
|
15803
|
+
type: "UNDEFINED_INPUT_REFERENCE" /* UNDEFINED_INPUT_REFERENCE */,
|
|
15804
|
+
description: `Template references undefined input: "${ref}"`,
|
|
15805
|
+
expected: `Define "${ref}" in workflow inputs array or use default filter`,
|
|
15806
|
+
actual: `{{input.${ref}}}`,
|
|
15807
|
+
fix: `Add "${ref}" to the inputs array, e.g.: inputs: [{ name: "${ref}", type: "string", required: true }]`
|
|
15808
|
+
});
|
|
15809
|
+
}
|
|
15810
|
+
return errors;
|
|
15811
|
+
}
|
|
15812
|
+
inputHasDefaultFilter(inputName, nodes) {
|
|
15813
|
+
for (const node of nodes) {
|
|
15814
|
+
if (!node.config)
|
|
15815
|
+
continue;
|
|
15816
|
+
const configStr = JSON.stringify(node.config);
|
|
15817
|
+
const defaultFilterRegex = new RegExp("input\\." + inputName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "\\s*\\|\\s*default\\s*\\(", "g");
|
|
15818
|
+
if (defaultFilterRegex.test(configStr)) {
|
|
15819
|
+
return true;
|
|
15820
|
+
}
|
|
15821
|
+
}
|
|
15822
|
+
return false;
|
|
15823
|
+
}
|
|
15771
15824
|
}
|
|
15772
15825
|
|
|
15773
15826
|
// src/commands/workflow/commands/add.ts
|
|
@@ -16341,13 +16394,12 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
16341
16394
|
output.error('WorkflowService not initialized. Please run "roy-agent workflow init" first.');
|
|
16342
16395
|
process.exit(1);
|
|
16343
16396
|
}
|
|
16344
|
-
let input
|
|
16397
|
+
let input;
|
|
16345
16398
|
if (args.input) {
|
|
16346
16399
|
try {
|
|
16347
16400
|
input = JSON.parse(args.input);
|
|
16348
16401
|
} catch {
|
|
16349
|
-
|
|
16350
|
-
process.exit(1);
|
|
16402
|
+
input = undefined;
|
|
16351
16403
|
}
|
|
16352
16404
|
}
|
|
16353
16405
|
const runOptions = {
|
|
@@ -16385,7 +16437,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
16385
16437
|
}
|
|
16386
16438
|
const engine = service.engineFactory(workflow);
|
|
16387
16439
|
const result = await engine.run(sessionId, {
|
|
16388
|
-
input:
|
|
16440
|
+
input: input || undefined
|
|
16389
16441
|
});
|
|
16390
16442
|
output.log(renderRunResult({
|
|
16391
16443
|
runId: sessionId,
|
|
@@ -16440,7 +16492,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
16440
16492
|
}));
|
|
16441
16493
|
if (result.status === "paused") {
|
|
16442
16494
|
output.log(chalk55.gray(`
|
|
16443
|
-
\uD83D\uDCA1 Use "roy-agent workflow run -
|
|
16495
|
+
\uD83D\uDCA1 Use "roy-agent workflow run ${result.runId} --session-id ${result.runId} --input '<response>'" to resume`));
|
|
16444
16496
|
}
|
|
16445
16497
|
} else {
|
|
16446
16498
|
output.log(chalk55.blue(`\uD83D\uDE80 Running workflow: ${args.identifier}`));
|
|
@@ -16454,7 +16506,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
16454
16506
|
}));
|
|
16455
16507
|
if (result.status === "paused") {
|
|
16456
16508
|
output.log(chalk55.gray(`
|
|
16457
|
-
\uD83D\uDCA1 Use "roy-agent workflow run -
|
|
16509
|
+
\uD83D\uDCA1 Use "roy-agent workflow run ${result.runId} --session-id ${result.runId} --input '<response>'" to resume`));
|
|
16458
16510
|
}
|
|
16459
16511
|
}
|
|
16460
16512
|
if (workflowSpan) {
|
|
@@ -16485,7 +16537,7 @@ var WorkflowRunCommand = {
|
|
|
16485
16537
|
default: false
|
|
16486
16538
|
}).option("input", {
|
|
16487
16539
|
alias: "i",
|
|
16488
|
-
describe: "输入参数 (JSON
|
|
16540
|
+
describe: "输入参数 (JSON 格式用于新运行,字符串用于恢复暂停的 workflow)",
|
|
16489
16541
|
type: "string"
|
|
16490
16542
|
}).option("parallel-limit", {
|
|
16491
16543
|
describe: "并行限制",
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-setting/roy-agent-cli",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLI for roy-agent - Non-interactive command execution",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"typecheck": "npx tsc --noEmit --skipLibCheck"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@ai-setting/roy-agent-coder-harness": "
|
|
30
|
-
"@ai-setting/roy-agent-core": "
|
|
29
|
+
"@ai-setting/roy-agent-coder-harness": "workspace:*",
|
|
30
|
+
"@ai-setting/roy-agent-core": "workspace:*",
|
|
31
31
|
"chalk": "^5.6.2",
|
|
32
32
|
"commander": "^14.0.3",
|
|
33
33
|
"pyright": "^1.1.409",
|