@ai-setting/roy-agent-cli 1.7.3 → 1.7.5

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.
@@ -9461,7 +9461,7 @@ class CliQuietModeService {
9461
9461
  // package.json
9462
9462
  var package_default = {
9463
9463
  name: "@ai-setting/roy-agent-cli",
9464
- version: "1.7.3",
9464
+ version: "1.7.5",
9465
9465
  type: "module",
9466
9466
  description: "CLI for roy-agent - Non-interactive command execution",
9467
9467
  main: "./dist/index.js",
@@ -10604,6 +10604,16 @@ async function runActShutdownCleanup(deps) {
10604
10604
  }
10605
10605
  }
10606
10606
 
10607
+ // src/commands/act-stdout-finalize.ts
10608
+ function finalizeActStdout(args) {
10609
+ const { result, streamService, output } = args;
10610
+ if (!result || result.length === 0)
10611
+ return;
10612
+ if (streamService.getFullText().length > 0)
10613
+ return;
10614
+ output.log(result);
10615
+ }
10616
+
10607
10617
  // src/commands/act.ts
10608
10618
  function detectWorkspaceRoot(cwd = process.cwd(), runGit = execFileSync) {
10609
10619
  try {
@@ -10771,13 +10781,16 @@ function createActCommand(externalEnvService) {
10771
10781
  if (!quiet) {
10772
10782
  output.info(`会话: ${session.title} (${sessionId})`);
10773
10783
  }
10774
- } else {
10775
- output.warn(`会话不存在: ${sessionId},将创建新会话`);
10784
+ } else if (!/^[a-zA-Z0-9_-]{1,128}$/.test(sessionId)) {
10785
+ output.warn(`会话 ID 格式非法: ${sessionId},将创建新会话`);
10776
10786
  sessionId = undefined;
10787
+ } else if (!quiet) {
10788
+ output.info(`会话 ID 合法但不存在,将使用此 ID 创建新会话: ${sessionId}`);
10777
10789
  }
10778
10790
  }
10779
- if (!sessionId) {
10791
+ if (!sessionId || !await sessionComponent.get(sessionId)) {
10780
10792
  const newSession = await sessionComponent.create({
10793
+ id: sessionId,
10781
10794
  title: `Session - ${new Date().toLocaleString("zh-CN")}`
10782
10795
  });
10783
10796
  sessionId = newSession.id;
@@ -10936,9 +10949,11 @@ function createActCommand(externalEnvService) {
10936
10949
  provider.setGlobalContext(undefined);
10937
10950
  }
10938
10951
  unsubscribe();
10939
- if (result && result.length > 0) {
10940
- output.log(result);
10941
- }
10952
+ finalizeActStdout({
10953
+ result,
10954
+ streamService,
10955
+ output
10956
+ });
10942
10957
  if (!quiet) {
10943
10958
  if (isWorkflowPausedActResult(result)) {
10944
10959
  output.warn("工作流已暂停,等待用户输入(见上方 resume 提示)");
@@ -13007,7 +13022,7 @@ ${COLORS.error("❌ 执行失败: " + error)}
13007
13022
  }
13008
13023
  const mainSessionIdEarly = this.options.sessionId;
13009
13024
  const hasActiveDescendant = mainSessionIdEarly ? hasActiveDescendants(this.env, mainSessionIdEarly) : false;
13010
- logger4.debug(`[Esc] handler entered: isExecuting=${this.isExecuting} hasActiveDescendant=${hasActiveDescendant} ${this.lastEscPressTime}`);
13025
+ logger4.debug(`[Esc] handler entered: isExecuting=${this.isExecuting} hasActiveDescendant=${hasActiveDescendant} lastEscPressTime=${this.lastEscPressTime}`);
13011
13026
  const now = Date.now();
13012
13027
  const isExecuting = this.isExecuting;
13013
13028
  const canCascade = isExecuting || hasActiveDescendant;
package/dist/index.js CHANGED
@@ -9460,7 +9460,7 @@ class CliQuietModeService {
9460
9460
  // package.json
9461
9461
  var package_default = {
9462
9462
  name: "@ai-setting/roy-agent-cli",
9463
- version: "1.7.3",
9463
+ version: "1.7.5",
9464
9464
  type: "module",
9465
9465
  description: "CLI for roy-agent - Non-interactive command execution",
9466
9466
  main: "./dist/index.js",
@@ -10603,6 +10603,16 @@ async function runActShutdownCleanup(deps) {
10603
10603
  }
10604
10604
  }
10605
10605
 
10606
+ // src/commands/act-stdout-finalize.ts
10607
+ function finalizeActStdout(args) {
10608
+ const { result, streamService, output } = args;
10609
+ if (!result || result.length === 0)
10610
+ return;
10611
+ if (streamService.getFullText().length > 0)
10612
+ return;
10613
+ output.log(result);
10614
+ }
10615
+
10606
10616
  // src/commands/act.ts
10607
10617
  function detectWorkspaceRoot(cwd = process.cwd(), runGit = execFileSync) {
10608
10618
  try {
@@ -10770,13 +10780,16 @@ function createActCommand(externalEnvService) {
10770
10780
  if (!quiet) {
10771
10781
  output.info(`会话: ${session.title} (${sessionId})`);
10772
10782
  }
10773
- } else {
10774
- output.warn(`会话不存在: ${sessionId},将创建新会话`);
10783
+ } else if (!/^[a-zA-Z0-9_-]{1,128}$/.test(sessionId)) {
10784
+ output.warn(`会话 ID 格式非法: ${sessionId},将创建新会话`);
10775
10785
  sessionId = undefined;
10786
+ } else if (!quiet) {
10787
+ output.info(`会话 ID 合法但不存在,将使用此 ID 创建新会话: ${sessionId}`);
10776
10788
  }
10777
10789
  }
10778
- if (!sessionId) {
10790
+ if (!sessionId || !await sessionComponent.get(sessionId)) {
10779
10791
  const newSession = await sessionComponent.create({
10792
+ id: sessionId,
10780
10793
  title: `Session - ${new Date().toLocaleString("zh-CN")}`
10781
10794
  });
10782
10795
  sessionId = newSession.id;
@@ -10935,9 +10948,11 @@ function createActCommand(externalEnvService) {
10935
10948
  provider.setGlobalContext(undefined);
10936
10949
  }
10937
10950
  unsubscribe();
10938
- if (result && result.length > 0) {
10939
- output.log(result);
10940
- }
10951
+ finalizeActStdout({
10952
+ result,
10953
+ streamService,
10954
+ output
10955
+ });
10941
10956
  if (!quiet) {
10942
10957
  if (isWorkflowPausedActResult(result)) {
10943
10958
  output.warn("工作流已暂停,等待用户输入(见上方 resume 提示)");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-cli",
3
- "version": "1.7.3",
3
+ "version": "1.7.5",
4
4
  "type": "module",
5
5
  "description": "CLI for roy-agent - Non-interactive command execution",
6
6
  "main": "./dist/index.js",