@agimon-ai/po-workflow 0.0.0-alpha.91 → 0.0.0-alpha.93
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/cli.cjs +35 -34
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +35 -34
- package/dist/cli.mjs.map +1 -1
- package/package.json +8 -8
package/dist/cli.cjs
CHANGED
|
@@ -528,6 +528,40 @@ function createHostRunCommand(dependencies = {}) {
|
|
|
528
528
|
}
|
|
529
529
|
const hostRunCommand = createHostRunCommand();
|
|
530
530
|
//#endregion
|
|
531
|
+
//#region src/bin/workflowCommands/flushStdout.ts
|
|
532
|
+
/**
|
|
533
|
+
* Stdout Flush Utility
|
|
534
|
+
*
|
|
535
|
+
* DESIGN PATTERNS:
|
|
536
|
+
* - Small awaitable wrapper around a stream write callback
|
|
537
|
+
*
|
|
538
|
+
* CODING STANDARDS:
|
|
539
|
+
* - Resolve rather than reject so a closed pipe cannot fail a successful command
|
|
540
|
+
*
|
|
541
|
+
* AVOID:
|
|
542
|
+
* - Calling process.exit() straight after writing a large payload to stdout
|
|
543
|
+
*/
|
|
544
|
+
const EMPTY_CHUNK = "";
|
|
545
|
+
/**
|
|
546
|
+
* Wait for pending stdout writes to reach the OS before the process exits.
|
|
547
|
+
*
|
|
548
|
+
* Node buffers stdout asynchronously when it is a pipe (but writes synchronously
|
|
549
|
+
* to files and TTYs). `process.exit()` discards whatever is still buffered, so a
|
|
550
|
+
* command that writes a large payload and exits immediately silently truncates
|
|
551
|
+
* its output at the pipe buffer size (64KB on macOS) and emits invalid JSON.
|
|
552
|
+
* Writing an empty chunk and awaiting its flush callback guarantees every earlier
|
|
553
|
+
* write has drained.
|
|
554
|
+
*
|
|
555
|
+
* A write error (for example EPIPE when the reader closed early, as `| head`
|
|
556
|
+
* does) resolves instead of rejecting: the command already produced its output
|
|
557
|
+
* and must not be reported as failed.
|
|
558
|
+
*/
|
|
559
|
+
async function flushStdout(stream = process.stdout) {
|
|
560
|
+
await new Promise((resolve) => {
|
|
561
|
+
stream.write(EMPTY_CHUNK, () => resolve());
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
//#endregion
|
|
531
565
|
//#region src/bin/workflowCommands/inspectWorkflow.ts
|
|
532
566
|
function parseFormat$1(value) {
|
|
533
567
|
if (value !== "json") throw new commander.InvalidArgumentError("Expected \"json\".");
|
|
@@ -564,6 +598,7 @@ function createInspectWorkflowCommand(dependencies = {}) {
|
|
|
564
598
|
definition,
|
|
565
599
|
jobOrder
|
|
566
600
|
})}\n`);
|
|
601
|
+
await flushStdout();
|
|
567
602
|
exit(0);
|
|
568
603
|
} catch (error) {
|
|
569
604
|
writeStderr(`Error inspecting workflow: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
@@ -596,40 +631,6 @@ function createLaunchProcessCommand(dependencies = {}) {
|
|
|
596
631
|
}
|
|
597
632
|
const launchProcessCommand = createLaunchProcessCommand();
|
|
598
633
|
//#endregion
|
|
599
|
-
//#region src/bin/workflowCommands/flushStdout.ts
|
|
600
|
-
/**
|
|
601
|
-
* Stdout Flush Utility
|
|
602
|
-
*
|
|
603
|
-
* DESIGN PATTERNS:
|
|
604
|
-
* - Small awaitable wrapper around a stream write callback
|
|
605
|
-
*
|
|
606
|
-
* CODING STANDARDS:
|
|
607
|
-
* - Resolve rather than reject so a closed pipe cannot fail a successful command
|
|
608
|
-
*
|
|
609
|
-
* AVOID:
|
|
610
|
-
* - Calling process.exit() straight after writing a large payload to stdout
|
|
611
|
-
*/
|
|
612
|
-
const EMPTY_CHUNK = "";
|
|
613
|
-
/**
|
|
614
|
-
* Wait for pending stdout writes to reach the OS before the process exits.
|
|
615
|
-
*
|
|
616
|
-
* Node buffers stdout asynchronously when it is a pipe (but writes synchronously
|
|
617
|
-
* to files and TTYs). `process.exit()` discards whatever is still buffered, so a
|
|
618
|
-
* command that writes a large payload and exits immediately silently truncates
|
|
619
|
-
* its output at the pipe buffer size (64KB on macOS) and emits invalid JSON.
|
|
620
|
-
* Writing an empty chunk and awaiting its flush callback guarantees every earlier
|
|
621
|
-
* write has drained.
|
|
622
|
-
*
|
|
623
|
-
* A write error (for example EPIPE when the reader closed early, as `| head`
|
|
624
|
-
* does) resolves instead of rejecting: the command already produced its output
|
|
625
|
-
* and must not be reported as failed.
|
|
626
|
-
*/
|
|
627
|
-
async function flushStdout(stream = process.stdout) {
|
|
628
|
-
await new Promise((resolve) => {
|
|
629
|
-
stream.write(EMPTY_CHUNK, () => resolve());
|
|
630
|
-
});
|
|
631
|
-
}
|
|
632
|
-
//#endregion
|
|
633
634
|
//#region src/bin/workflowCommands/listWorkflows.ts
|
|
634
635
|
const DEFAULT_PAGE$1 = 1;
|
|
635
636
|
const DEFAULT_PAGE_SIZE$1 = 20;
|