@mutagent/cli 0.1.332 → 0.1.334
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/bin/cli.js +22 -2
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -8601,12 +8601,14 @@ async function* readSseEvents(body) {
|
|
|
8601
8601
|
// src/lib/sandbox-stream.ts
|
|
8602
8602
|
init_errors();
|
|
8603
8603
|
var DEFAULT_RETRY = { attempts: 3, baseDelayMs: 500 };
|
|
8604
|
+
var MAX_TOTAL_RECONNECTS = 12;
|
|
8604
8605
|
async function runStreamSession(options) {
|
|
8605
8606
|
const retry = options.retry ?? DEFAULT_RETRY;
|
|
8606
8607
|
const sleep2 = options.sleep ?? delay;
|
|
8607
8608
|
const { sink, signal } = options;
|
|
8608
8609
|
const onDisconnect = options.onDisconnect ?? "survives";
|
|
8609
8610
|
let lastSeq = options.since ?? 0;
|
|
8611
|
+
const floor = options.since ?? 0;
|
|
8610
8612
|
let exitCode = null;
|
|
8611
8613
|
let reconnects = 0;
|
|
8612
8614
|
let gaps = 0;
|
|
@@ -8628,6 +8630,8 @@ async function runStreamSession(options) {
|
|
|
8628
8630
|
});
|
|
8629
8631
|
const detached = () => outcome("detached");
|
|
8630
8632
|
const isAborted = () => signal.aborted;
|
|
8633
|
+
const withinTotalBudget = () => reconnects < MAX_TOTAL_RECONNECTS;
|
|
8634
|
+
const alreadyDelivered = (seq) => seq <= floor;
|
|
8631
8635
|
const noteSeq = (seq) => {
|
|
8632
8636
|
if (!options.filtered && seq > lastSeq + 1 && lastSeq > 0) {
|
|
8633
8637
|
gaps += 1;
|
|
@@ -8649,6 +8653,8 @@ async function runStreamSession(options) {
|
|
|
8649
8653
|
attempt += 1;
|
|
8650
8654
|
if (attempt > retry.attempts)
|
|
8651
8655
|
throw exhausted(lastSeq, error, onDisconnect);
|
|
8656
|
+
if (!withinTotalBudget())
|
|
8657
|
+
throw exhausted(lastSeq, error, onDisconnect);
|
|
8652
8658
|
reconnects += 1;
|
|
8653
8659
|
sink.notice(reconnectNotice(attempt, retry.attempts, lastSeq));
|
|
8654
8660
|
await sleep2(backoffMs(retry.baseDelayMs, attempt), signal);
|
|
@@ -8665,6 +8671,8 @@ async function runStreamSession(options) {
|
|
|
8665
8671
|
if (payload2.seq <= lastSeq)
|
|
8666
8672
|
continue;
|
|
8667
8673
|
noteSeq(payload2.seq);
|
|
8674
|
+
if (alreadyDelivered(payload2.seq))
|
|
8675
|
+
continue;
|
|
8668
8676
|
if (event.event === "stdout")
|
|
8669
8677
|
sink.stdout(payload2.text, payload2.seq);
|
|
8670
8678
|
else
|
|
@@ -8694,6 +8702,8 @@ async function runStreamSession(options) {
|
|
|
8694
8702
|
if (payload2.seq <= lastSeq)
|
|
8695
8703
|
continue;
|
|
8696
8704
|
noteSeq(payload2.seq);
|
|
8705
|
+
if (alreadyDelivered(payload2.seq))
|
|
8706
|
+
continue;
|
|
8697
8707
|
sink.rpc(payload2.text, payload2.seq);
|
|
8698
8708
|
continue;
|
|
8699
8709
|
}
|
|
@@ -8726,7 +8736,9 @@ async function runStreamSession(options) {
|
|
|
8726
8736
|
exited = true;
|
|
8727
8737
|
break;
|
|
8728
8738
|
}
|
|
8729
|
-
|
|
8739
|
+
if (!alreadyDelivered(payload2.seq)) {
|
|
8740
|
+
sink.notice(`Session ${payload2.sessionId} started.`);
|
|
8741
|
+
}
|
|
8730
8742
|
continue;
|
|
8731
8743
|
}
|
|
8732
8744
|
if (event.event === "live") {
|
|
@@ -8753,6 +8765,8 @@ async function runStreamSession(options) {
|
|
|
8753
8765
|
const payload2 = parseErrorPayload(event.data);
|
|
8754
8766
|
if (isGapError(payload2)) {
|
|
8755
8767
|
gaps += 1;
|
|
8768
|
+
if (payload2.to !== undefined)
|
|
8769
|
+
lastSeq = Math.max(lastSeq, payload2.to);
|
|
8756
8770
|
const range = payload2.from === undefined || payload2.to === undefined ? "" : ` (seq ${String(payload2.from)}–${String(payload2.to)}, inclusive)`;
|
|
8757
8771
|
sink.notice(`Output before this point is unavailable${range}: ${payload2.message}. ` + "What follows is not continuous with what came before.");
|
|
8758
8772
|
} else {
|
|
@@ -8765,6 +8779,8 @@ async function runStreamSession(options) {
|
|
|
8765
8779
|
const payload = parseOutputPayload(event.data);
|
|
8766
8780
|
if (payload) {
|
|
8767
8781
|
noteSeq(payload.seq);
|
|
8782
|
+
if (alreadyDelivered(payload.seq))
|
|
8783
|
+
continue;
|
|
8768
8784
|
sink.unrecognised(payload.text, payload.seq);
|
|
8769
8785
|
} else {
|
|
8770
8786
|
sink.unrecognised(event.data, 0);
|
|
@@ -8776,6 +8792,8 @@ async function runStreamSession(options) {
|
|
|
8776
8792
|
attempt += 1;
|
|
8777
8793
|
if (attempt > retry.attempts)
|
|
8778
8794
|
throw exhausted(lastSeq, error, onDisconnect);
|
|
8795
|
+
if (!withinTotalBudget())
|
|
8796
|
+
throw exhausted(lastSeq, error, onDisconnect);
|
|
8779
8797
|
reconnects += 1;
|
|
8780
8798
|
sink.notice(reconnectNotice(attempt, retry.attempts, lastSeq));
|
|
8781
8799
|
await sleep2(backoffMs(retry.baseDelayMs, attempt), signal);
|
|
@@ -8790,6 +8808,8 @@ async function runStreamSession(options) {
|
|
|
8790
8808
|
attempt += 1;
|
|
8791
8809
|
if (attempt > retry.attempts)
|
|
8792
8810
|
throw exhausted(lastSeq, null, onDisconnect);
|
|
8811
|
+
if (!withinTotalBudget())
|
|
8812
|
+
throw exhausted(lastSeq, null, onDisconnect);
|
|
8793
8813
|
reconnects += 1;
|
|
8794
8814
|
sink.notice(reconnectNotice(attempt, retry.attempts, lastSeq));
|
|
8795
8815
|
await sleep2(backoffMs(retry.baseDelayMs, attempt), signal);
|
|
@@ -12762,5 +12782,5 @@ var argvForCommander = execCommand === undefined ? rawArgs : protectBoxArgv(rawA
|
|
|
12762
12782
|
if (!helixHelpJson)
|
|
12763
12783
|
program.parse(argvForCommander, { from: "user" });
|
|
12764
12784
|
|
|
12765
|
-
//# debugId=
|
|
12785
|
+
//# debugId=383FC9FB725D595F64756E2164756E21
|
|
12766
12786
|
//# sourceMappingURL=cli.js.map
|
package/package.json
CHANGED