aiframe-agent-cli 1.0.3 → 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.
- package/dist/{chunk-QJ52BUVU.js → chunk-HAKBPCGG.js} +44 -0
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -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
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