@ai-setting/roy-agent-cli 1.5.115 → 1.5.117

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.
@@ -7427,7 +7427,7 @@ var require_dist = __commonJS((exports) => {
7427
7427
  var require_package = __commonJS((exports, module) => {
7428
7428
  module.exports = {
7429
7429
  name: "@ai-setting/roy-agent-cli",
7430
- version: "1.5.115",
7430
+ version: "1.5.117",
7431
7431
  type: "module",
7432
7432
  description: "CLI for roy-agent - Non-interactive command execution",
7433
7433
  main: "./dist/index.js",
@@ -19482,7 +19482,7 @@ var WorkflowGetCommand = {
19482
19482
  command: "get <identifier>",
19483
19483
  describe: "获取 Workflow 或 Run 详情",
19484
19484
  builder: (yargs) => yargs.positional("identifier", {
19485
- describe: "Workflow 名称或 Run ID",
19485
+ describe: "Workflow 名称或 Run ID (Task #1837: runId == sessionId)",
19486
19486
  type: "string",
19487
19487
  demandOption: true
19488
19488
  }).option("run-id", {
@@ -19528,7 +19528,7 @@ var WorkflowGetCommand = {
19528
19528
  }
19529
19529
  const service = workflowComponent.getService();
19530
19530
  const tool = createWorkflowGetTool(service);
19531
- const isRunId = args.runId || args.identifier.startsWith("run_");
19531
+ const isRunId = args.runId || args.identifier.startsWith("workflow_run_") || args.identifier.startsWith("workflow_") || args.identifier.startsWith("run_");
19532
19532
  if (isRunId) {
19533
19533
  const result = await tool.execute({ run_id: args.identifier }, {});
19534
19534
  if (!result.success) {
@@ -19868,42 +19868,23 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
19868
19868
  if (args.session) {
19869
19869
  const sessionId = args.session;
19870
19870
  output.log(chalk70.blue(`\uD83D\uDD04 Resuming workflow from session: ${sessionId}`));
19871
- const sessionComponent = workflowComponent.sessionComponent;
19872
- if (!sessionComponent) {
19873
- output.error("SessionComponent not available");
19874
- process.exit(1);
19875
- }
19876
- const session = await sessionComponent.get(sessionId);
19877
- if (!session) {
19878
- output.error(`Session not found: ${sessionId}`);
19879
- process.exit(1);
19880
- }
19881
- const metadata = session.metadata;
19882
- if (metadata?.type !== "workflow") {
19883
- output.error(`Session is not a workflow session: ${sessionId}`);
19884
- process.exit(1);
19885
- }
19886
- const workflowName = metadata.workflowName;
19887
- if (!workflowName) {
19888
- output.error("Workflow name not found in session metadata");
19889
- process.exit(1);
19890
- }
19891
- const workflow = service.getWorkflowByName(workflowName);
19892
- if (!workflow) {
19893
- output.error(`Workflow not found: ${workflowName}`);
19894
- process.exit(1);
19871
+ try {
19872
+ const resumeInput = typeof input === "string" ? { userQuery: input } : input;
19873
+ const result = await service.resumeSession(sessionId, {
19874
+ ...runOptions,
19875
+ ...resumeInput !== undefined ? { input: resumeInput } : {}
19876
+ });
19877
+ output.log(renderRunResult({
19878
+ runId: sessionId,
19879
+ status: result.status,
19880
+ output: result.output,
19881
+ error: result.error,
19882
+ durationMs: result.durationMs
19883
+ }));
19884
+ } catch (err) {
19885
+ const msg = err instanceof Error ? err.message : String(err);
19886
+ output.error(`Failed to resume session ${sessionId}: ${msg}`);
19895
19887
  }
19896
- const engine = service.engineFactory(workflow);
19897
- const result = await engine.run(sessionId, {
19898
- input: input || undefined
19899
- });
19900
- output.log(renderRunResult({
19901
- runId: sessionId,
19902
- status: result.status,
19903
- output: result.output,
19904
- error: result.error,
19905
- durationMs: result.durationMs
19906
- }));
19907
19888
  if (workflowSpan) {
19908
19889
  workflowSpan.end();
19909
19890
  }
@@ -19960,7 +19941,14 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
19960
19941
  timeout: args.timeout
19961
19942
  }, {});
19962
19943
  if (!toolResult.success) {
19944
+ const outAny = toolResult.output;
19945
+ const runId = typeof outAny === "object" && outAny !== null && "run_id" in outAny ? outAny.run_id : undefined;
19963
19946
  output.error(toolResult.error || `Failed to run workflow: ${args.identifier}`);
19947
+ if (runId) {
19948
+ output.error(`Run ID: ${runId}`);
19949
+ output.error(chalk70.gray(`
19950
+ \uD83D\uDCA1 Use "roy-agent workflow status ${runId}" to check progress, or "roy-agent workflow run ${args.identifier} --session ${runId}" to resume`));
19951
+ }
19964
19952
  process.exit(1);
19965
19953
  }
19966
19954
  const runData = toolResult.output;
@@ -20037,7 +20025,7 @@ var WorkflowRunCommand = {
20037
20025
  type: "string"
20038
20026
  }).option("session", {
20039
20027
  alias: "s",
20040
- describe: "从已有 session 恢复运行(支持 workflow pause/interrupt 恢复,session ID 必须以 workflow_ 开头)",
20028
+ describe: "从已有 session 恢复运行(支持 workflow pause/interrupt 恢复;runId == sessionId,传 workflow run 的 runId 即可)",
20041
20029
  type: "string"
20042
20030
  }),
20043
20031
  handler: runWorkflow
@@ -20082,7 +20070,7 @@ var WorkflowStopCommand = {
20082
20070
  command: "stop <runId>",
20083
20071
  describe: "停止运行中的 Workflow",
20084
20072
  builder: (yargs) => yargs.positional("runId", {
20085
- describe: "Run ID",
20073
+ describe: "Workflow run ID (== session ID, Task #1837)",
20086
20074
  type: "string",
20087
20075
  demandOption: true
20088
20076
  }).option("config", {
@@ -20099,7 +20087,7 @@ var WorkflowStatusCommand = {
20099
20087
  command: "status <runId>",
20100
20088
  describe: "查看 Workflow 运行状态",
20101
20089
  builder: (yargs) => yargs.positional("runId", {
20102
- describe: "Run ID",
20090
+ describe: "Workflow run ID (== session ID, Task #1837)",
20103
20091
  type: "string",
20104
20092
  demandOption: true
20105
20093
  }).option("watch", {
package/dist/index.js CHANGED
@@ -7426,7 +7426,7 @@ var require_dist = __commonJS((exports) => {
7426
7426
  var require_package = __commonJS((exports, module) => {
7427
7427
  module.exports = {
7428
7428
  name: "@ai-setting/roy-agent-cli",
7429
- version: "1.5.115",
7429
+ version: "1.5.117",
7430
7430
  type: "module",
7431
7431
  description: "CLI for roy-agent - Non-interactive command execution",
7432
7432
  main: "./dist/index.js",
@@ -19481,7 +19481,7 @@ var WorkflowGetCommand = {
19481
19481
  command: "get <identifier>",
19482
19482
  describe: "获取 Workflow 或 Run 详情",
19483
19483
  builder: (yargs) => yargs.positional("identifier", {
19484
- describe: "Workflow 名称或 Run ID",
19484
+ describe: "Workflow 名称或 Run ID (Task #1837: runId == sessionId)",
19485
19485
  type: "string",
19486
19486
  demandOption: true
19487
19487
  }).option("run-id", {
@@ -19527,7 +19527,7 @@ var WorkflowGetCommand = {
19527
19527
  }
19528
19528
  const service = workflowComponent.getService();
19529
19529
  const tool = createWorkflowGetTool(service);
19530
- const isRunId = args.runId || args.identifier.startsWith("run_");
19530
+ const isRunId = args.runId || args.identifier.startsWith("workflow_run_") || args.identifier.startsWith("workflow_") || args.identifier.startsWith("run_");
19531
19531
  if (isRunId) {
19532
19532
  const result = await tool.execute({ run_id: args.identifier }, {});
19533
19533
  if (!result.success) {
@@ -19867,42 +19867,23 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
19867
19867
  if (args.session) {
19868
19868
  const sessionId = args.session;
19869
19869
  output.log(chalk70.blue(`\uD83D\uDD04 Resuming workflow from session: ${sessionId}`));
19870
- const sessionComponent = workflowComponent.sessionComponent;
19871
- if (!sessionComponent) {
19872
- output.error("SessionComponent not available");
19873
- process.exit(1);
19874
- }
19875
- const session = await sessionComponent.get(sessionId);
19876
- if (!session) {
19877
- output.error(`Session not found: ${sessionId}`);
19878
- process.exit(1);
19879
- }
19880
- const metadata = session.metadata;
19881
- if (metadata?.type !== "workflow") {
19882
- output.error(`Session is not a workflow session: ${sessionId}`);
19883
- process.exit(1);
19884
- }
19885
- const workflowName = metadata.workflowName;
19886
- if (!workflowName) {
19887
- output.error("Workflow name not found in session metadata");
19888
- process.exit(1);
19889
- }
19890
- const workflow = service.getWorkflowByName(workflowName);
19891
- if (!workflow) {
19892
- output.error(`Workflow not found: ${workflowName}`);
19893
- process.exit(1);
19870
+ try {
19871
+ const resumeInput = typeof input === "string" ? { userQuery: input } : input;
19872
+ const result = await service.resumeSession(sessionId, {
19873
+ ...runOptions,
19874
+ ...resumeInput !== undefined ? { input: resumeInput } : {}
19875
+ });
19876
+ output.log(renderRunResult({
19877
+ runId: sessionId,
19878
+ status: result.status,
19879
+ output: result.output,
19880
+ error: result.error,
19881
+ durationMs: result.durationMs
19882
+ }));
19883
+ } catch (err) {
19884
+ const msg = err instanceof Error ? err.message : String(err);
19885
+ output.error(`Failed to resume session ${sessionId}: ${msg}`);
19894
19886
  }
19895
- const engine = service.engineFactory(workflow);
19896
- const result = await engine.run(sessionId, {
19897
- input: input || undefined
19898
- });
19899
- output.log(renderRunResult({
19900
- runId: sessionId,
19901
- status: result.status,
19902
- output: result.output,
19903
- error: result.error,
19904
- durationMs: result.durationMs
19905
- }));
19906
19887
  if (workflowSpan) {
19907
19888
  workflowSpan.end();
19908
19889
  }
@@ -19959,7 +19940,14 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
19959
19940
  timeout: args.timeout
19960
19941
  }, {});
19961
19942
  if (!toolResult.success) {
19943
+ const outAny = toolResult.output;
19944
+ const runId = typeof outAny === "object" && outAny !== null && "run_id" in outAny ? outAny.run_id : undefined;
19962
19945
  output.error(toolResult.error || `Failed to run workflow: ${args.identifier}`);
19946
+ if (runId) {
19947
+ output.error(`Run ID: ${runId}`);
19948
+ output.error(chalk70.gray(`
19949
+ \uD83D\uDCA1 Use "roy-agent workflow status ${runId}" to check progress, or "roy-agent workflow run ${args.identifier} --session ${runId}" to resume`));
19950
+ }
19963
19951
  process.exit(1);
19964
19952
  }
19965
19953
  const runData = toolResult.output;
@@ -20036,7 +20024,7 @@ var WorkflowRunCommand = {
20036
20024
  type: "string"
20037
20025
  }).option("session", {
20038
20026
  alias: "s",
20039
- describe: "从已有 session 恢复运行(支持 workflow pause/interrupt 恢复,session ID 必须以 workflow_ 开头)",
20027
+ describe: "从已有 session 恢复运行(支持 workflow pause/interrupt 恢复;runId == sessionId,传 workflow run 的 runId 即可)",
20040
20028
  type: "string"
20041
20029
  }),
20042
20030
  handler: runWorkflow
@@ -20081,7 +20069,7 @@ var WorkflowStopCommand = {
20081
20069
  command: "stop <runId>",
20082
20070
  describe: "停止运行中的 Workflow",
20083
20071
  builder: (yargs) => yargs.positional("runId", {
20084
- describe: "Run ID",
20072
+ describe: "Workflow run ID (== session ID, Task #1837)",
20085
20073
  type: "string",
20086
20074
  demandOption: true
20087
20075
  }).option("config", {
@@ -20098,7 +20086,7 @@ var WorkflowStatusCommand = {
20098
20086
  command: "status <runId>",
20099
20087
  describe: "查看 Workflow 运行状态",
20100
20088
  builder: (yargs) => yargs.positional("runId", {
20101
- describe: "Run ID",
20089
+ describe: "Workflow run ID (== session ID, Task #1837)",
20102
20090
  type: "string",
20103
20091
  demandOption: true
20104
20092
  }).option("watch", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-cli",
3
- "version": "1.5.115",
3
+ "version": "1.5.117",
4
4
  "type": "module",
5
5
  "description": "CLI for roy-agent - Non-interactive command execution",
6
6
  "main": "./dist/index.js",