aiframe-agent-cli 1.0.2 → 1.0.4

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.
@@ -760,6 +760,24 @@ var WorkflowEngine = class {
760
760
  console.log(picocolors3.blue(` \u{1F504} Retry attempt ${retries}/${maxRetries} for step: ${step.name}`));
761
761
  }
762
762
  await this.runStepAction(step, retries, workingDir);
763
+ if (step.wait_for_file) {
764
+ const targetFile = this.resolveVariables(step.wait_for_file);
765
+ const timeout = step.wait_timeout || 6e5;
766
+ console.log(picocolors3.cyan(` \u23F3 Waiting for background agent to write file: ${targetFile} ...`));
767
+ const fileReady = await this.waitForFileStable(targetFile, timeout, workingDir || process.cwd());
768
+ if (!fileReady) {
769
+ console.log(picocolors3.red(` \u274C Timeout waiting for file: ${targetFile}`));
770
+ const errorOutput = `Timeout waiting for background agent output file: ${targetFile}`;
771
+ if (!this.state.errorHistory[this.state.currentStepIndex]) {
772
+ this.state.errorHistory[this.state.currentStepIndex] = [];
773
+ }
774
+ this.state.errorHistory[this.state.currentStepIndex].push(errorOutput);
775
+ retries++;
776
+ continue;
777
+ } else {
778
+ console.log(picocolors3.green(` \u2705 File stable: ${targetFile}`));
779
+ }
780
+ }
763
781
  if (step.validation) {
764
782
  const validationCmd = typeof step.validation === "string" ? step.validation : step.validation.command;
765
783
  const resolvedValCmd = this.resolveVariables(validationCmd);
@@ -947,6 +965,32 @@ Please correct the implementation to fix this error.`;
947
965
  throw error;
948
966
  }
949
967
  }
968
+ async waitForFileStable(targetFile, timeoutMs, cwd) {
969
+ const fullPath = path5.resolve(cwd, targetFile);
970
+ const checkInterval = 3e3;
971
+ let elapsed = 0;
972
+ let lastSize = -1;
973
+ let stableCount = 0;
974
+ while (elapsed < timeoutMs) {
975
+ if (fs5.existsSync(fullPath)) {
976
+ const stats = await fs5.stat(fullPath);
977
+ if (stats.size > 0) {
978
+ if (stats.size === lastSize) {
979
+ stableCount++;
980
+ if (stableCount >= 2) {
981
+ return true;
982
+ }
983
+ } else {
984
+ lastSize = stats.size;
985
+ stableCount = 0;
986
+ }
987
+ }
988
+ }
989
+ await new Promise((resolve) => setTimeout(resolve, checkInterval));
990
+ elapsed += checkInterval;
991
+ }
992
+ return false;
993
+ }
950
994
  };
951
995
 
952
996
  // src/commands/run.ts
package/dist/cli.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  initCommand,
4
4
  runCommand,
5
5
  uiCommand
6
- } from "./chunk-QJ52BUVU.js";
6
+ } from "./chunk-HAKBPCGG.js";
7
7
 
8
8
  // src/cli.ts
9
9
  import { Command } from "commander";
package/dist/index.d.ts CHANGED
@@ -49,6 +49,7 @@ declare class WorkflowEngine {
49
49
  private resolveTargetStepIndex;
50
50
  private parseCommand;
51
51
  private runStepAction;
52
+ private waitForFileStable;
52
53
  }
53
54
 
54
55
  declare function executeAgent(agentName: string, instruction: string, depth?: number, workflowOutputDir?: string, workingDir?: string): Promise<string>;
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  runCommand,
9
9
  startServer,
10
10
  uiCommand
11
- } from "./chunk-QJ52BUVU.js";
11
+ } from "./chunk-HAKBPCGG.js";
12
12
  export {
13
13
  WorkflowEngine,
14
14
  executeAgent,
@@ -1593,8 +1593,9 @@
1593
1593
  agentsList.innerHTML = '';
1594
1594
  agentsData.forEach(agent => {
1595
1595
  const name = agent.data?.name || agent.filename.replace('.yaml', '');
1596
+ const fileKey = agent.filename.replace('.yaml', '').replace('.yml', '');
1596
1597
  agentsList.innerHTML += `
1597
- <div class="draggable-item" draggable="true" data-type="sidebar-agent" data-payload="agent/${name}">
1598
+ <div class="draggable-item" draggable="true" data-type="sidebar-agent" data-payload="agent/${fileKey}">
1598
1599
  <span>${name}</span>
1599
1600
  <span class="badge badge-purple">Agent</span>
1600
1601
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiframe-agent-cli",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Enterprise Resilient AI Agent Framework",
5
5
  "main": "dist/index.js",
6
6
  "bin": {