@ai-setting/roy-agent-cli 1.5.45 → 1.5.47

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.
@@ -7290,7 +7290,7 @@ var require_dist = __commonJS((exports) => {
7290
7290
  var require_package = __commonJS((exports, module) => {
7291
7291
  module.exports = {
7292
7292
  name: "@ai-setting/roy-agent-cli",
7293
- version: "1.5.45",
7293
+ version: "1.5.47",
7294
7294
  type: "module",
7295
7295
  description: "CLI for roy-agent - Non-interactive command execution",
7296
7296
  main: "./dist/index.js",
@@ -7316,9 +7316,9 @@ var require_package = __commonJS((exports, module) => {
7316
7316
  typecheck: "npx tsc --noEmit --skipLibCheck"
7317
7317
  },
7318
7318
  dependencies: {
7319
- "@ai-setting/roy-agent-coder-harness": "^1.5.45",
7320
- "@ai-setting/roy-agent-core": "^1.5.45",
7321
- "@ai-setting/roy-agent-ontology-harness": "^1.5.45",
7319
+ "@ai-setting/roy-agent-coder-harness": "^1.5.46",
7320
+ "@ai-setting/roy-agent-core": "^1.5.47",
7321
+ "@ai-setting/roy-agent-ontology-harness": "^1.5.46",
7322
7322
  chalk: "^5.6.2",
7323
7323
  commander: "^14.0.3",
7324
7324
  effect: "^3.21.2",
@@ -8273,6 +8273,14 @@ function buildActAgentContext(agentName) {
8273
8273
  }
8274
8274
  return { agentType: agentName };
8275
8275
  }
8276
+ function isWorkflowPausedActResult(result) {
8277
+ try {
8278
+ const parsed = JSON.parse(result);
8279
+ return parsed.status === "paused";
8280
+ } catch {
8281
+ return false;
8282
+ }
8283
+ }
8276
8284
 
8277
8285
  // src/commands/act.ts
8278
8286
  function createActCommand(externalEnvService) {
@@ -8503,7 +8511,11 @@ function createActCommand(externalEnvService) {
8503
8511
  "tool.error",
8504
8512
  "context.threshold_exceeded",
8505
8513
  "context.compacting",
8506
- "context.compacted"
8514
+ "context.compacted",
8515
+ "workflow.node.start",
8516
+ "workflow.node.completed",
8517
+ "workflow.completed",
8518
+ "workflow.failed"
8507
8519
  ], (event) => {
8508
8520
  if (event.type === "context.threshold_exceeded" && !quiet) {
8509
8521
  const payload = event.payload;
@@ -8516,6 +8528,22 @@ function createActCommand(externalEnvService) {
8516
8528
  const payload = event.payload;
8517
8529
  output.success(`✓ 已压缩 (${payload.checkpointId ?? "unknown"})`);
8518
8530
  }
8531
+ if (event.type === "workflow.node.start" && !quiet) {
8532
+ const payload = event.payload;
8533
+ output.info(`⚙ 工作流节点: ${payload.nodeId || ""}`);
8534
+ }
8535
+ if (event.type === "workflow.node.completed" && !quiet) {
8536
+ const payload = event.payload;
8537
+ output.success(`✓ 工作流节点完成: ${payload.nodeId || ""}`);
8538
+ }
8539
+ if (event.type === "workflow.completed" && !quiet) {
8540
+ output.success(`✓ 工作流执行完成`);
8541
+ }
8542
+ if (event.type === "workflow.failed" && !quiet) {
8543
+ const payload = event.payload;
8544
+ const msg = payload?.error?.message ?? "unknown error";
8545
+ output.error(`✗ 工作流失败: ${msg}`);
8546
+ }
8519
8547
  streamService.handleEvent(event);
8520
8548
  });
8521
8549
  if (!quiet) {
@@ -8560,8 +8588,15 @@ function createActCommand(externalEnvService) {
8560
8588
  provider.setGlobalContext(undefined);
8561
8589
  }
8562
8590
  unsubscribe();
8591
+ if (result && result.length > 0) {
8592
+ output.log(result);
8593
+ }
8563
8594
  if (!quiet) {
8564
- output.success("执行完成");
8595
+ if (isWorkflowPausedActResult(result)) {
8596
+ output.warn("工作流已暂停,等待用户输入(见上方 resume 提示)");
8597
+ } else {
8598
+ output.success("执行完成");
8599
+ }
8565
8600
  }
8566
8601
  } catch (error) {
8567
8602
  output.error(`执行失败: ${error instanceof Error ? error.message : String(error)}`);
@@ -12477,7 +12512,7 @@ var ListCommand4 = {
12477
12512
  builder: (yargs) => yargs.option("type", {
12478
12513
  alias: "t",
12479
12514
  type: "string",
12480
- choices: ["primary", "sub", "all"],
12515
+ choices: ["primary", "sub", "workflow", "all"],
12481
12516
  default: "all",
12482
12517
  description: "按类型筛选"
12483
12518
  }).option("json", {
@@ -12523,6 +12558,7 @@ var ListCommand4 = {
12523
12558
  name: a.name,
12524
12559
  type: a.type,
12525
12560
  description: a.description,
12561
+ workflow: a.workflow,
12526
12562
  systemPromptRef: a.systemPromptRef,
12527
12563
  hasInlinePrompt: !!a.systemPrompt
12528
12564
  })),
@@ -12534,22 +12570,24 @@ var ListCommand4 = {
12534
12570
  const header = [
12535
12571
  chalk28.bold("Name"),
12536
12572
  chalk28.bold("Type"),
12537
- chalk28.bold("Description"),
12538
- chalk28.bold("Source")
12573
+ chalk28.bold("Workflow"),
12574
+ chalk28.bold("Description")
12539
12575
  ].join(" | ");
12540
12576
  const typeColor = (type) => {
12541
- return type === "primary" ? chalk28.yellow : chalk28.blue;
12542
- };
12543
- const sourceColor = (agent) => {
12544
- return agent.systemPromptRef ? chalk28.green("[ref]") : chalk28.gray("[inline]");
12577
+ if (type === "primary")
12578
+ return chalk28.yellow;
12579
+ if (type === "workflow")
12580
+ return chalk28.magenta;
12581
+ return chalk28.blue;
12545
12582
  };
12546
12583
  const rows = agents.map((a) => {
12547
12584
  const desc = (a.description || "").length > 40 ? (a.description || "").slice(0, 37) + "..." : a.description || "-";
12585
+ const workflowDisplay = a.type === "workflow" && a.workflow ? chalk28.cyan(a.workflow.length > 30 ? a.workflow.slice(0, 27) + "..." : a.workflow) : chalk28.gray("-");
12548
12586
  return [
12549
12587
  chalk28.cyan(a.name),
12550
12588
  typeColor(a.type)(a.type),
12551
- desc,
12552
- sourceColor(a)
12589
+ workflowDisplay,
12590
+ desc
12553
12591
  ].join(" | ");
12554
12592
  });
12555
12593
  if (rows.length === 0) {
@@ -12624,6 +12662,7 @@ var GetCommand4 = {
12624
12662
  name: agent.name,
12625
12663
  type: agent.type,
12626
12664
  description: agent.description,
12665
+ workflow: agent.workflow,
12627
12666
  systemPromptRef: agent.systemPromptRef,
12628
12667
  systemPrompt: agent.systemPrompt,
12629
12668
  resolvedSystemPrompt,
@@ -12646,6 +12685,16 @@ var GetCommand4 = {
12646
12685
  output.log(` ${chalk29.cyan("description:")} ${agent.description}`);
12647
12686
  }
12648
12687
  output.log("");
12688
+ if (agent.type === "workflow") {
12689
+ output.log(chalk29.bold("Workflow:"));
12690
+ if (agent.workflow) {
12691
+ output.log(` ${chalk29.cyan("workflow:")} ${agent.workflow}`);
12692
+ output.log(` ${chalk29.gray("→")} ${chalk29.gray(`roy-agent workflow run ${agent.workflow} --input '{"query":"..."}'`)}`);
12693
+ } else {
12694
+ output.log(` ${chalk29.gray("(no workflow configured)")}`);
12695
+ }
12696
+ output.log("");
12697
+ }
12649
12698
  output.log(chalk29.bold("System Prompt:"));
12650
12699
  if (agent.systemPromptRef) {
12651
12700
  output.log(` ${chalk29.green("[ref]")} ${chalk29.cyan("systemPromptRef:")} ${agent.systemPromptRef}`);
@@ -12721,7 +12770,7 @@ var AddCommand = {
12721
12770
  }).option("type", {
12722
12771
  alias: "t",
12723
12772
  type: "string",
12724
- choices: ["primary", "sub"],
12773
+ choices: ["primary", "sub", "workflow"],
12725
12774
  default: "sub",
12726
12775
  description: "Agent 类型"
12727
12776
  }).option("description", {
@@ -12736,6 +12785,10 @@ var AddCommand = {
12736
12785
  }).option("model", {
12737
12786
  type: "string",
12738
12787
  description: "使用的模型"
12788
+ }).option("workflow", {
12789
+ alias: "w",
12790
+ type: "string",
12791
+ description: "关联的 workflow 名称(仅 type=workflow 时有效)"
12739
12792
  }).option("allowed-tools", {
12740
12793
  type: "string",
12741
12794
  description: "允许的工具(逗号分隔)"
@@ -12768,10 +12821,15 @@ var AddCommand = {
12768
12821
  output.error(`Agent already exists: ${args.name}`);
12769
12822
  process.exit(1);
12770
12823
  }
12824
+ if (args.type === "workflow" && !args.workflow) {
12825
+ output.error(`--workflow/-w is required when type is 'workflow'`);
12826
+ process.exit(1);
12827
+ }
12771
12828
  const agent = {
12772
12829
  name: args.name,
12773
12830
  type: args.type,
12774
12831
  description: args.description,
12832
+ workflow: args.workflow,
12775
12833
  systemPromptRef: args.systemPromptRef,
12776
12834
  systemPrompt: args.systemPrompt,
12777
12835
  model: args.model,
package/dist/index.js CHANGED
@@ -7289,7 +7289,7 @@ var require_dist = __commonJS((exports) => {
7289
7289
  var require_package = __commonJS((exports, module) => {
7290
7290
  module.exports = {
7291
7291
  name: "@ai-setting/roy-agent-cli",
7292
- version: "1.5.45",
7292
+ version: "1.5.47",
7293
7293
  type: "module",
7294
7294
  description: "CLI for roy-agent - Non-interactive command execution",
7295
7295
  main: "./dist/index.js",
@@ -7315,9 +7315,9 @@ var require_package = __commonJS((exports, module) => {
7315
7315
  typecheck: "npx tsc --noEmit --skipLibCheck"
7316
7316
  },
7317
7317
  dependencies: {
7318
- "@ai-setting/roy-agent-coder-harness": "^1.5.45",
7319
- "@ai-setting/roy-agent-core": "^1.5.45",
7320
- "@ai-setting/roy-agent-ontology-harness": "^1.5.45",
7318
+ "@ai-setting/roy-agent-coder-harness": "^1.5.46",
7319
+ "@ai-setting/roy-agent-core": "^1.5.47",
7320
+ "@ai-setting/roy-agent-ontology-harness": "^1.5.46",
7321
7321
  chalk: "^5.6.2",
7322
7322
  commander: "^14.0.3",
7323
7323
  effect: "^3.21.2",
@@ -8272,6 +8272,14 @@ function buildActAgentContext(agentName) {
8272
8272
  }
8273
8273
  return { agentType: agentName };
8274
8274
  }
8275
+ function isWorkflowPausedActResult(result) {
8276
+ try {
8277
+ const parsed = JSON.parse(result);
8278
+ return parsed.status === "paused";
8279
+ } catch {
8280
+ return false;
8281
+ }
8282
+ }
8275
8283
 
8276
8284
  // src/commands/act.ts
8277
8285
  function createActCommand(externalEnvService) {
@@ -8502,7 +8510,11 @@ function createActCommand(externalEnvService) {
8502
8510
  "tool.error",
8503
8511
  "context.threshold_exceeded",
8504
8512
  "context.compacting",
8505
- "context.compacted"
8513
+ "context.compacted",
8514
+ "workflow.node.start",
8515
+ "workflow.node.completed",
8516
+ "workflow.completed",
8517
+ "workflow.failed"
8506
8518
  ], (event) => {
8507
8519
  if (event.type === "context.threshold_exceeded" && !quiet) {
8508
8520
  const payload = event.payload;
@@ -8515,6 +8527,22 @@ function createActCommand(externalEnvService) {
8515
8527
  const payload = event.payload;
8516
8528
  output.success(`✓ 已压缩 (${payload.checkpointId ?? "unknown"})`);
8517
8529
  }
8530
+ if (event.type === "workflow.node.start" && !quiet) {
8531
+ const payload = event.payload;
8532
+ output.info(`⚙ 工作流节点: ${payload.nodeId || ""}`);
8533
+ }
8534
+ if (event.type === "workflow.node.completed" && !quiet) {
8535
+ const payload = event.payload;
8536
+ output.success(`✓ 工作流节点完成: ${payload.nodeId || ""}`);
8537
+ }
8538
+ if (event.type === "workflow.completed" && !quiet) {
8539
+ output.success(`✓ 工作流执行完成`);
8540
+ }
8541
+ if (event.type === "workflow.failed" && !quiet) {
8542
+ const payload = event.payload;
8543
+ const msg = payload?.error?.message ?? "unknown error";
8544
+ output.error(`✗ 工作流失败: ${msg}`);
8545
+ }
8518
8546
  streamService.handleEvent(event);
8519
8547
  });
8520
8548
  if (!quiet) {
@@ -8559,8 +8587,15 @@ function createActCommand(externalEnvService) {
8559
8587
  provider.setGlobalContext(undefined);
8560
8588
  }
8561
8589
  unsubscribe();
8590
+ if (result && result.length > 0) {
8591
+ output.log(result);
8592
+ }
8562
8593
  if (!quiet) {
8563
- output.success("执行完成");
8594
+ if (isWorkflowPausedActResult(result)) {
8595
+ output.warn("工作流已暂停,等待用户输入(见上方 resume 提示)");
8596
+ } else {
8597
+ output.success("执行完成");
8598
+ }
8564
8599
  }
8565
8600
  } catch (error) {
8566
8601
  output.error(`执行失败: ${error instanceof Error ? error.message : String(error)}`);
@@ -12476,7 +12511,7 @@ var ListCommand4 = {
12476
12511
  builder: (yargs) => yargs.option("type", {
12477
12512
  alias: "t",
12478
12513
  type: "string",
12479
- choices: ["primary", "sub", "all"],
12514
+ choices: ["primary", "sub", "workflow", "all"],
12480
12515
  default: "all",
12481
12516
  description: "按类型筛选"
12482
12517
  }).option("json", {
@@ -12522,6 +12557,7 @@ var ListCommand4 = {
12522
12557
  name: a.name,
12523
12558
  type: a.type,
12524
12559
  description: a.description,
12560
+ workflow: a.workflow,
12525
12561
  systemPromptRef: a.systemPromptRef,
12526
12562
  hasInlinePrompt: !!a.systemPrompt
12527
12563
  })),
@@ -12533,22 +12569,24 @@ var ListCommand4 = {
12533
12569
  const header = [
12534
12570
  chalk28.bold("Name"),
12535
12571
  chalk28.bold("Type"),
12536
- chalk28.bold("Description"),
12537
- chalk28.bold("Source")
12572
+ chalk28.bold("Workflow"),
12573
+ chalk28.bold("Description")
12538
12574
  ].join(" | ");
12539
12575
  const typeColor = (type) => {
12540
- return type === "primary" ? chalk28.yellow : chalk28.blue;
12541
- };
12542
- const sourceColor = (agent) => {
12543
- return agent.systemPromptRef ? chalk28.green("[ref]") : chalk28.gray("[inline]");
12576
+ if (type === "primary")
12577
+ return chalk28.yellow;
12578
+ if (type === "workflow")
12579
+ return chalk28.magenta;
12580
+ return chalk28.blue;
12544
12581
  };
12545
12582
  const rows = agents.map((a) => {
12546
12583
  const desc = (a.description || "").length > 40 ? (a.description || "").slice(0, 37) + "..." : a.description || "-";
12584
+ const workflowDisplay = a.type === "workflow" && a.workflow ? chalk28.cyan(a.workflow.length > 30 ? a.workflow.slice(0, 27) + "..." : a.workflow) : chalk28.gray("-");
12547
12585
  return [
12548
12586
  chalk28.cyan(a.name),
12549
12587
  typeColor(a.type)(a.type),
12550
- desc,
12551
- sourceColor(a)
12588
+ workflowDisplay,
12589
+ desc
12552
12590
  ].join(" | ");
12553
12591
  });
12554
12592
  if (rows.length === 0) {
@@ -12623,6 +12661,7 @@ var GetCommand4 = {
12623
12661
  name: agent.name,
12624
12662
  type: agent.type,
12625
12663
  description: agent.description,
12664
+ workflow: agent.workflow,
12626
12665
  systemPromptRef: agent.systemPromptRef,
12627
12666
  systemPrompt: agent.systemPrompt,
12628
12667
  resolvedSystemPrompt,
@@ -12645,6 +12684,16 @@ var GetCommand4 = {
12645
12684
  output.log(` ${chalk29.cyan("description:")} ${agent.description}`);
12646
12685
  }
12647
12686
  output.log("");
12687
+ if (agent.type === "workflow") {
12688
+ output.log(chalk29.bold("Workflow:"));
12689
+ if (agent.workflow) {
12690
+ output.log(` ${chalk29.cyan("workflow:")} ${agent.workflow}`);
12691
+ output.log(` ${chalk29.gray("→")} ${chalk29.gray(`roy-agent workflow run ${agent.workflow} --input '{"query":"..."}'`)}`);
12692
+ } else {
12693
+ output.log(` ${chalk29.gray("(no workflow configured)")}`);
12694
+ }
12695
+ output.log("");
12696
+ }
12648
12697
  output.log(chalk29.bold("System Prompt:"));
12649
12698
  if (agent.systemPromptRef) {
12650
12699
  output.log(` ${chalk29.green("[ref]")} ${chalk29.cyan("systemPromptRef:")} ${agent.systemPromptRef}`);
@@ -12720,7 +12769,7 @@ var AddCommand = {
12720
12769
  }).option("type", {
12721
12770
  alias: "t",
12722
12771
  type: "string",
12723
- choices: ["primary", "sub"],
12772
+ choices: ["primary", "sub", "workflow"],
12724
12773
  default: "sub",
12725
12774
  description: "Agent 类型"
12726
12775
  }).option("description", {
@@ -12735,6 +12784,10 @@ var AddCommand = {
12735
12784
  }).option("model", {
12736
12785
  type: "string",
12737
12786
  description: "使用的模型"
12787
+ }).option("workflow", {
12788
+ alias: "w",
12789
+ type: "string",
12790
+ description: "关联的 workflow 名称(仅 type=workflow 时有效)"
12738
12791
  }).option("allowed-tools", {
12739
12792
  type: "string",
12740
12793
  description: "允许的工具(逗号分隔)"
@@ -12767,10 +12820,15 @@ var AddCommand = {
12767
12820
  output.error(`Agent already exists: ${args.name}`);
12768
12821
  process.exit(1);
12769
12822
  }
12823
+ if (args.type === "workflow" && !args.workflow) {
12824
+ output.error(`--workflow/-w is required when type is 'workflow'`);
12825
+ process.exit(1);
12826
+ }
12770
12827
  const agent = {
12771
12828
  name: args.name,
12772
12829
  type: args.type,
12773
12830
  description: args.description,
12831
+ workflow: args.workflow,
12774
12832
  systemPromptRef: args.systemPromptRef,
12775
12833
  systemPrompt: args.systemPrompt,
12776
12834
  model: args.model,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-cli",
3
- "version": "1.5.45",
3
+ "version": "1.5.47",
4
4
  "type": "module",
5
5
  "description": "CLI for roy-agent - Non-interactive command execution",
6
6
  "main": "./dist/index.js",
@@ -26,9 +26,9 @@
26
26
  "typecheck": "npx tsc --noEmit --skipLibCheck"
27
27
  },
28
28
  "dependencies": {
29
- "@ai-setting/roy-agent-coder-harness": "^1.5.45",
30
- "@ai-setting/roy-agent-core": "^1.5.45",
31
- "@ai-setting/roy-agent-ontology-harness": "^1.5.45",
29
+ "@ai-setting/roy-agent-coder-harness": "^1.5.46",
30
+ "@ai-setting/roy-agent-core": "^1.5.47",
31
+ "@ai-setting/roy-agent-ontology-harness": "^1.5.46",
32
32
  "chalk": "^5.6.2",
33
33
  "commander": "^14.0.3",
34
34
  "effect": "^3.21.2",