iteration-cli 0.14.0 → 0.14.1
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.js +44 -45
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -936,7 +936,7 @@ import { spawnSync } from "node:child_process";
|
|
|
936
936
|
import os9 from "node:os";
|
|
937
937
|
import path24 from "node:path";
|
|
938
938
|
import { promises as fs20 } from "node:fs";
|
|
939
|
-
import { createInterface as
|
|
939
|
+
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
940
940
|
import { parseArgs } from "node:util";
|
|
941
941
|
|
|
942
942
|
// ../../node_modules/.pnpm/zod@4.6.4/node_modules/zod/v4/core/util.js
|
|
@@ -10790,11 +10790,10 @@ async function cursorHookFiles(dataDirectory2) {
|
|
|
10790
10790
|
}
|
|
10791
10791
|
|
|
10792
10792
|
// src/storage.ts
|
|
10793
|
-
import { once } from "node:events";
|
|
10794
10793
|
import { createReadStream, createWriteStream as createWriteStream2, promises as fs13 } from "node:fs";
|
|
10795
10794
|
import os6 from "node:os";
|
|
10796
10795
|
import path13 from "node:path";
|
|
10797
|
-
import {
|
|
10796
|
+
import { pipeline as pipeline2 } from "node:stream/promises";
|
|
10798
10797
|
|
|
10799
10798
|
// ../../node_modules/.pnpm/@secretlint+core@13.0.6/node_modules/@secretlint/core/module/SecretLintSourceCodeImpl.js
|
|
10800
10799
|
var import_structured_source = __toESM(require_structured_source(), 1);
|
|
@@ -15711,6 +15710,32 @@ var healthSchema = object({
|
|
|
15711
15710
|
}).strict().nullable()
|
|
15712
15711
|
}).strict();
|
|
15713
15712
|
var redactionMarkerSchema = object({ version: literal(1) }).strict();
|
|
15713
|
+
async function* outboxLines(filename) {
|
|
15714
|
+
const input = createReadStream(filename);
|
|
15715
|
+
let parts = [];
|
|
15716
|
+
try {
|
|
15717
|
+
for await (const value of input) {
|
|
15718
|
+
const chunk = value;
|
|
15719
|
+
let start2 = 0;
|
|
15720
|
+
let newline = chunk.indexOf(10);
|
|
15721
|
+
while (newline !== -1) {
|
|
15722
|
+
const end = chunk.subarray(start2, newline);
|
|
15723
|
+
if (parts.length === 0) yield end.toString("utf8");
|
|
15724
|
+
else {
|
|
15725
|
+
parts.push(end);
|
|
15726
|
+
yield Buffer.concat(parts).toString("utf8");
|
|
15727
|
+
parts = [];
|
|
15728
|
+
}
|
|
15729
|
+
start2 = newline + 1;
|
|
15730
|
+
newline = chunk.indexOf(10, start2);
|
|
15731
|
+
}
|
|
15732
|
+
if (start2 < chunk.length) parts.push(chunk.subarray(start2));
|
|
15733
|
+
}
|
|
15734
|
+
if (parts.length > 0) yield Buffer.concat(parts).toString("utf8");
|
|
15735
|
+
} finally {
|
|
15736
|
+
input.destroy();
|
|
15737
|
+
}
|
|
15738
|
+
}
|
|
15714
15739
|
function parseOutboxEvent(line) {
|
|
15715
15740
|
let decoded;
|
|
15716
15741
|
try {
|
|
@@ -15925,13 +15950,7 @@ async function pendingEventIds(paths) {
|
|
|
15925
15950
|
if (size > MAX_OUTBOX_BYTES)
|
|
15926
15951
|
throw new Error("Trace outbox exceeds its configured capacity.");
|
|
15927
15952
|
try {
|
|
15928
|
-
const
|
|
15929
|
-
const stream = input.createReadStream({
|
|
15930
|
-
autoClose: true,
|
|
15931
|
-
encoding: "utf8"
|
|
15932
|
-
});
|
|
15933
|
-
const lines = createInterface2({ input: stream, crlfDelay: Infinity });
|
|
15934
|
-
for await (const line of lines) {
|
|
15953
|
+
for await (const line of outboxLines(paths.outbox)) {
|
|
15935
15954
|
ids.add(parseOutboxEvent(line).eventId);
|
|
15936
15955
|
}
|
|
15937
15956
|
} catch (error2) {
|
|
@@ -15988,11 +16007,7 @@ async function redactPendingOutbox(paths) {
|
|
|
15988
16007
|
const temporary = `${paths.outbox}.${process.pid}.redacting`;
|
|
15989
16008
|
const output = await fs13.open(temporary, "w", 384);
|
|
15990
16009
|
try {
|
|
15991
|
-
const
|
|
15992
|
-
input: createReadStream(paths.outbox, { encoding: "utf8" }),
|
|
15993
|
-
crlfDelay: Infinity
|
|
15994
|
-
});
|
|
15995
|
-
for await (const line of lines) {
|
|
16010
|
+
for await (const line of outboxLines(paths.outbox)) {
|
|
15996
16011
|
const event3 = await redactTraceEvent(parseOutboxEvent(line));
|
|
15997
16012
|
await output.writeFile(`${JSON.stringify(event3)}
|
|
15998
16013
|
`, "utf8");
|
|
@@ -16034,21 +16049,14 @@ async function nextBatch(paths, maxBytes) {
|
|
|
16034
16049
|
if (size === 0) return [];
|
|
16035
16050
|
if (size > MAX_OUTBOX_BYTES)
|
|
16036
16051
|
throw new Error("Trace outbox exceeds its configured capacity.");
|
|
16037
|
-
const input = await fs13.open(paths.outbox, "r");
|
|
16038
|
-
const stream = input.createReadStream({ autoClose: true, encoding: "utf8" });
|
|
16039
|
-
const lines = createInterface2({ input: stream, crlfDelay: Infinity });
|
|
16040
16052
|
const events = [];
|
|
16041
16053
|
let bytes = 0;
|
|
16042
|
-
for await (const line of
|
|
16054
|
+
for await (const line of outboxLines(paths.outbox)) {
|
|
16043
16055
|
const lineBytes = Buffer.byteLength(line, "utf8") + 1;
|
|
16044
16056
|
if (events.length >= MAX_TRACE_EVENTS_PER_BATCH || events.length > 0 && bytes + lineBytes > maxBytes) {
|
|
16045
|
-
lines.close();
|
|
16046
|
-
stream.destroy();
|
|
16047
16057
|
break;
|
|
16048
16058
|
}
|
|
16049
16059
|
if (lineBytes > maxBytes) {
|
|
16050
|
-
lines.close();
|
|
16051
|
-
stream.destroy();
|
|
16052
16060
|
throw new Error("A queued event exceeds the maximum upload batch size.");
|
|
16053
16061
|
}
|
|
16054
16062
|
events.push(parseOutboxEvent(line));
|
|
@@ -16057,28 +16065,20 @@ async function nextBatch(paths, maxBytes) {
|
|
|
16057
16065
|
return events;
|
|
16058
16066
|
}
|
|
16059
16067
|
async function acknowledgeEvents(acknowledgedIds, paths) {
|
|
16068
|
+
if (await outboxSize(paths) === 0) return;
|
|
16060
16069
|
const temporary = `${paths.outbox}.${process.pid}.tmp`;
|
|
16061
|
-
const input = await fs13.open(paths.outbox, "r").catch((error2) => {
|
|
16062
|
-
if (error2 instanceof Error && "code" in error2 && error2.code === "ENOENT")
|
|
16063
|
-
return null;
|
|
16064
|
-
throw error2;
|
|
16065
|
-
});
|
|
16066
|
-
if (input === null) return;
|
|
16067
|
-
const output = createWriteStream2(temporary, { flags: "w", mode: 384 });
|
|
16068
16070
|
try {
|
|
16069
|
-
|
|
16070
|
-
|
|
16071
|
-
|
|
16072
|
-
|
|
16073
|
-
|
|
16074
|
-
|
|
16075
|
-
|
|
16076
|
-
|
|
16077
|
-
|
|
16078
|
-
}
|
|
16079
|
-
|
|
16080
|
-
output.end();
|
|
16081
|
-
await once(output, "close");
|
|
16071
|
+
await pipeline2(
|
|
16072
|
+
outboxLines(paths.outbox),
|
|
16073
|
+
async function* (lines) {
|
|
16074
|
+
for await (const line of lines) {
|
|
16075
|
+
const event3 = parseOutboxEvent(line);
|
|
16076
|
+
if (!acknowledgedIds.has(event3.eventId)) yield `${line}
|
|
16077
|
+
`;
|
|
16078
|
+
}
|
|
16079
|
+
},
|
|
16080
|
+
createWriteStream2(temporary, { flags: "w", mode: 384 })
|
|
16081
|
+
);
|
|
16082
16082
|
const durable = await fs13.open(temporary, "r+");
|
|
16083
16083
|
try {
|
|
16084
16084
|
await durable.sync();
|
|
@@ -16087,7 +16087,6 @@ async function acknowledgeEvents(acknowledgedIds, paths) {
|
|
|
16087
16087
|
}
|
|
16088
16088
|
await fs13.rename(temporary, paths.outbox);
|
|
16089
16089
|
} catch (error2) {
|
|
16090
|
-
output.destroy();
|
|
16091
16090
|
await fs13.rm(temporary, { force: true });
|
|
16092
16091
|
throw error2;
|
|
16093
16092
|
}
|
|
@@ -19865,7 +19864,7 @@ Connect supported agents${safeName ? ` to ${safeName}` : " to the workspace you
|
|
|
19865
19864
|
"Run iteration connect interactively or pass --yes to approve uploads."
|
|
19866
19865
|
);
|
|
19867
19866
|
}
|
|
19868
|
-
const prompt =
|
|
19867
|
+
const prompt = createInterface2({
|
|
19869
19868
|
input: process.stdin,
|
|
19870
19869
|
output: process.stdout
|
|
19871
19870
|
});
|