@cortexkit/aft-bridge 0.57.2 → 0.58.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.
Files changed (116) hide show
  1. package/dist/bash-format.d.ts +7 -0
  2. package/dist/bash-format.d.ts.map +1 -1
  3. package/dist/bash-format.js +9 -0
  4. package/dist/bash-format.js.map +1 -1
  5. package/dist/bash-hints.d.ts +31 -3
  6. package/dist/bash-hints.d.ts.map +1 -1
  7. package/dist/bash-hints.js +40 -9
  8. package/dist/bash-hints.js.map +1 -1
  9. package/dist/bash-host-fallback.js +1 -1
  10. package/dist/bash-host-fallback.js.map +1 -1
  11. package/dist/binary-identity.d.ts +109 -0
  12. package/dist/binary-identity.d.ts.map +1 -0
  13. package/dist/binary-identity.js +295 -0
  14. package/dist/binary-identity.js.map +1 -0
  15. package/dist/bridge.d.ts +10 -1
  16. package/dist/bridge.d.ts.map +1 -1
  17. package/dist/bridge.js +74 -24
  18. package/dist/bridge.js.map +1 -1
  19. package/dist/child-process.d.ts +39 -0
  20. package/dist/child-process.d.ts.map +1 -0
  21. package/dist/child-process.js +64 -0
  22. package/dist/child-process.js.map +1 -0
  23. package/dist/coerce.d.ts +2 -0
  24. package/dist/coerce.d.ts.map +1 -1
  25. package/dist/coerce.js +29 -0
  26. package/dist/coerce.js.map +1 -1
  27. package/dist/config-error.d.ts +71 -0
  28. package/dist/config-error.d.ts.map +1 -0
  29. package/dist/config-error.js +112 -0
  30. package/dist/config-error.js.map +1 -0
  31. package/dist/config-watch.d.ts +170 -0
  32. package/dist/config-watch.d.ts.map +1 -0
  33. package/dist/config-watch.js +479 -0
  34. package/dist/config-watch.js.map +1 -0
  35. package/dist/downloader.d.ts +4 -2
  36. package/dist/downloader.d.ts.map +1 -1
  37. package/dist/downloader.js +41 -20
  38. package/dist/downloader.js.map +1 -1
  39. package/dist/durable-log.d.ts +11 -0
  40. package/dist/durable-log.d.ts.map +1 -1
  41. package/dist/durable-log.js +81 -5
  42. package/dist/durable-log.js.map +1 -1
  43. package/dist/edit-summary.d.ts +8 -0
  44. package/dist/edit-summary.d.ts.map +1 -1
  45. package/dist/edit-summary.js +7 -0
  46. package/dist/edit-summary.js.map +1 -1
  47. package/dist/feature-config.d.ts +192 -0
  48. package/dist/feature-config.d.ts.map +1 -0
  49. package/dist/feature-config.js +657 -0
  50. package/dist/feature-config.js.map +1 -0
  51. package/dist/index.d.ts +19 -8
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +19 -7
  54. package/dist/index.js.map +1 -1
  55. package/dist/message-detach.d.ts +25 -0
  56. package/dist/message-detach.d.ts.map +1 -0
  57. package/dist/message-detach.js +34 -0
  58. package/dist/message-detach.js.map +1 -0
  59. package/dist/migration-notices.d.ts +29 -0
  60. package/dist/migration-notices.d.ts.map +1 -0
  61. package/dist/migration-notices.js +114 -0
  62. package/dist/migration-notices.js.map +1 -0
  63. package/dist/migration.d.ts +1 -1
  64. package/dist/migration.d.ts.map +1 -1
  65. package/dist/migration.js +1 -1
  66. package/dist/migration.js.map +1 -1
  67. package/dist/npm-resolver.d.ts +1 -1
  68. package/dist/npm-resolver.d.ts.map +1 -1
  69. package/dist/npm-resolver.js +1 -1
  70. package/dist/npm-resolver.js.map +1 -1
  71. package/dist/onnx-probe.d.ts +44 -0
  72. package/dist/onnx-probe.d.ts.map +1 -0
  73. package/dist/onnx-probe.js +167 -0
  74. package/dist/onnx-probe.js.map +1 -0
  75. package/dist/onnx-runtime.d.ts +19 -4
  76. package/dist/onnx-runtime.d.ts.map +1 -1
  77. package/dist/onnx-runtime.js +146 -34
  78. package/dist/onnx-runtime.js.map +1 -1
  79. package/dist/path-lookup.d.ts +22 -0
  80. package/dist/path-lookup.d.ts.map +1 -0
  81. package/dist/path-lookup.js +51 -0
  82. package/dist/path-lookup.js.map +1 -0
  83. package/dist/resolver.d.ts +47 -21
  84. package/dist/resolver.d.ts.map +1 -1
  85. package/dist/resolver.js +254 -159
  86. package/dist/resolver.js.map +1 -1
  87. package/dist/revivable-transport.d.ts.map +1 -1
  88. package/dist/revivable-transport.js +12 -0
  89. package/dist/revivable-transport.js.map +1 -1
  90. package/dist/semantic-status.d.ts +10 -1
  91. package/dist/semantic-status.d.ts.map +1 -1
  92. package/dist/semantic-status.js +50 -2
  93. package/dist/semantic-status.js.map +1 -1
  94. package/dist/storage-paths.d.ts +9 -0
  95. package/dist/storage-paths.d.ts.map +1 -1
  96. package/dist/storage-paths.js +18 -1
  97. package/dist/storage-paths.js.map +1 -1
  98. package/dist/subc-transport.d.ts +58 -1
  99. package/dist/subc-transport.d.ts.map +1 -1
  100. package/dist/subc-transport.js +378 -50
  101. package/dist/subc-transport.js.map +1 -1
  102. package/dist/tar-executable.js +1 -1
  103. package/dist/tar-executable.js.map +1 -1
  104. package/dist/transport-factory.d.ts +14 -2
  105. package/dist/transport-factory.d.ts.map +1 -1
  106. package/dist/transport-factory.js +24 -16
  107. package/dist/transport-factory.js.map +1 -1
  108. package/dist/version-probe.d.ts +33 -0
  109. package/dist/version-probe.d.ts.map +1 -0
  110. package/dist/version-probe.js +108 -0
  111. package/dist/version-probe.js.map +1 -0
  112. package/package.json +2 -2
  113. package/dist/bash-timeout.d.ts +0 -19
  114. package/dist/bash-timeout.d.ts.map +0 -1
  115. package/dist/bash-timeout.js +0 -26
  116. package/dist/bash-timeout.js.map +0 -1
@@ -0,0 +1,295 @@
1
+ /**
2
+ * Identity sidecars for binaries in AFT's versioned cache.
3
+ *
4
+ * Plugin hosts (OpenCode, Pi) run every plugin on one JavaScript thread. Asking
5
+ * a cached `aft` binary for its version means executing it, and on macOS the
6
+ * host thread stays inside `posix_spawn` until the child image is paged in and
7
+ * assessed. For an 85 MB binary under memory pressure that has been measured
8
+ * at close to a minute, and the same file goes cold again during the day, so
9
+ * the cost is not paid only once. The host froze for that long on every
10
+ * instance boot.
11
+ *
12
+ * Instead of executing the binary, every writer of the versioned cache records
13
+ * what it installed in a small JSON file next to the binary
14
+ * (`<binary>.identity.json`): the version, byte size, modification time, inode
15
+ * and a SHA-256 of the bytes. Resolution then trusts a cached binary when its
16
+ * sidecar exists and the file's size, mtime and inode still match — a `stat`
17
+ * and a tiny read, never an exec and never a hash. Any mismatch (the file was
18
+ * replaced, touched, or copied over) makes the entry untrusted again.
19
+ *
20
+ * The SHA-256 is never computed on the resolve path, because hashing 85 MB
21
+ * synchronously would block the host thread just like the exec did. It is
22
+ * what a running bridge compares against later to notice that the binary on
23
+ * disk was replaced (see {@link peekBinaryContentHash}).
24
+ */
25
+ import { createHash } from "node:crypto";
26
+ import { createReadStream, readFileSync, renameSync, statSync, unlinkSync, writeFileSync, } from "node:fs";
27
+ import { warn } from "./active-logger.js";
28
+ const SIDECAR_SCHEMA = 1;
29
+ function bareVersion(version) {
30
+ return version.startsWith("v") ? version.slice(1) : version;
31
+ }
32
+ /** Path of the identity sidecar for `binaryPath`. */
33
+ export function identitySidecarPath(binaryPath) {
34
+ return `${binaryPath}.identity.json`;
35
+ }
36
+ function stampOf(binaryPath) {
37
+ const stat = statSync(binaryPath, { bigint: true });
38
+ // Some filesystems (notably FAT volumes on Windows) report inode 0; treat it
39
+ // as unknown rather than as a value every file shares.
40
+ const ino = stat.ino > 0n ? stat.ino.toString() : null;
41
+ return { size: stat.size.toString(), mtimeNs: stat.mtimeNs.toString(), ino };
42
+ }
43
+ function sameStamp(a, b) {
44
+ return a.size === b.size && a.mtimeNs === b.mtimeNs && a.ino === b.ino;
45
+ }
46
+ function parseIdentity(raw) {
47
+ try {
48
+ const value = JSON.parse(raw);
49
+ if (value.schema !== SIDECAR_SCHEMA ||
50
+ typeof value.version !== "string" ||
51
+ typeof value.size !== "string" ||
52
+ typeof value.mtimeNs !== "string" ||
53
+ !(value.ino === null || typeof value.ino === "string") ||
54
+ typeof value.sha256 !== "string") {
55
+ return null;
56
+ }
57
+ return value;
58
+ }
59
+ catch {
60
+ return null;
61
+ }
62
+ }
63
+ /** Read and validate the sidecar for `binaryPath`; null when absent or malformed. */
64
+ export function readBinaryIdentity(binaryPath) {
65
+ let raw;
66
+ try {
67
+ raw = readFileSync(identitySidecarPath(binaryPath), "utf8");
68
+ }
69
+ catch {
70
+ return null;
71
+ }
72
+ return parseIdentity(raw);
73
+ }
74
+ /**
75
+ * Decide whether the binary at `binaryPath` is still the file its sidecar
76
+ * describes. Uses `stat` only: no exec and no hash, so it is safe on a host's
77
+ * main thread.
78
+ */
79
+ export function checkBinaryIdentity(binaryPath) {
80
+ const identity = readBinaryIdentity(binaryPath);
81
+ if (!identity)
82
+ return { status: "missing" };
83
+ let stamp;
84
+ try {
85
+ stamp = stampOf(binaryPath);
86
+ }
87
+ catch {
88
+ return { status: "mismatch", reason: "binary is missing or unreadable" };
89
+ }
90
+ if (stamp.size !== identity.size) {
91
+ return { status: "mismatch", reason: `size ${stamp.size} != recorded ${identity.size}` };
92
+ }
93
+ if (stamp.mtimeNs !== identity.mtimeNs) {
94
+ return { status: "mismatch", reason: `mtime ${stamp.mtimeNs} != recorded ${identity.mtimeNs}` };
95
+ }
96
+ // A sidecar written where the inode was unknown cannot vouch for it either
97
+ // way; size and mtime still have to match.
98
+ if (identity.ino !== null && stamp.ino !== identity.ino) {
99
+ return { status: "mismatch", reason: `inode ${stamp.ino} != recorded ${identity.ino}` };
100
+ }
101
+ return { status: "trusted", version: identity.version };
102
+ }
103
+ /**
104
+ * True when `binaryPath` has a matching sidecar that records `expectedVersion`
105
+ * (with or without a leading `v`). Stat-only; see {@link checkBinaryIdentity}.
106
+ */
107
+ export function isTrustedCachedBinary(binaryPath, expectedVersion) {
108
+ const check = checkBinaryIdentity(binaryPath);
109
+ return check.status === "trusted" && bareVersion(check.version) === bareVersion(expectedVersion);
110
+ }
111
+ function writeSidecarAtomically(binaryPath, identity) {
112
+ const sidecar = identitySidecarPath(binaryPath);
113
+ const tmp = `${sidecar}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`;
114
+ try {
115
+ writeFileSync(tmp, `${JSON.stringify(identity)}\n`, "utf8");
116
+ if (process.platform === "win32") {
117
+ // renameSync cannot replace an existing file on Windows.
118
+ try {
119
+ unlinkSync(sidecar);
120
+ }
121
+ catch {
122
+ // Absent is fine; a real failure surfaces from renameSync below.
123
+ }
124
+ }
125
+ renameSync(tmp, sidecar);
126
+ }
127
+ catch (err) {
128
+ try {
129
+ unlinkSync(tmp);
130
+ }
131
+ catch {
132
+ // The temp file may never have been created.
133
+ }
134
+ throw err;
135
+ }
136
+ }
137
+ /**
138
+ * Record the identity of a binary that is already in its final place, with a
139
+ * SHA-256 the caller has already computed (for example while verifying a
140
+ * download against the release checksum). Writes the sidecar atomically
141
+ * (temp file + rename). Synchronous and cheap: one stat and one small write.
142
+ */
143
+ export function writeBinaryIdentitySidecar(binaryPath, version, sha256) {
144
+ const identity = {
145
+ schema: SIDECAR_SCHEMA,
146
+ version: bareVersion(version),
147
+ ...stampOf(binaryPath),
148
+ sha256,
149
+ };
150
+ writeSidecarAtomically(binaryPath, identity);
151
+ return identity;
152
+ }
153
+ /** Remove the sidecar of `binaryPath`, if any, before that binary is replaced. */
154
+ export function removeBinaryIdentitySidecar(binaryPath) {
155
+ try {
156
+ unlinkSync(identitySidecarPath(binaryPath));
157
+ }
158
+ catch {
159
+ // Absent sidecars are the common case.
160
+ }
161
+ }
162
+ /**
163
+ * SHA-256 of a file, streamed. The reads run on libuv's thread pool and the
164
+ * digest is fed in small chunks, so the event loop keeps turning while an
165
+ * 85 MB binary is hashed.
166
+ */
167
+ export function sha256File(path) {
168
+ return new Promise((resolve, reject) => {
169
+ const hash = createHash("sha256");
170
+ const stream = createReadStream(path);
171
+ stream.on("data", (chunk) => hash.update(chunk));
172
+ stream.on("error", reject);
173
+ stream.on("end", () => resolve(hash.digest("hex")));
174
+ });
175
+ }
176
+ const pendingIdentityWrites = new Set();
177
+ /**
178
+ * Hash `binaryPath` without blocking the event loop and write its sidecar.
179
+ * The file is stat-ed before and after hashing; if it changed in between, no
180
+ * sidecar is written (the hash would describe a file that no longer exists).
181
+ * Never throws; resolves to whether a sidecar was written.
182
+ */
183
+ export function recordBinaryIdentity(binaryPath, version) {
184
+ const task = (async () => {
185
+ try {
186
+ const before = stampOf(binaryPath);
187
+ const sha256 = await sha256File(binaryPath);
188
+ const after = stampOf(binaryPath);
189
+ if (!sameStamp(before, after)) {
190
+ warn(`Binary at ${binaryPath} changed while it was being hashed; identity not recorded`);
191
+ return false;
192
+ }
193
+ writeSidecarAtomically(binaryPath, {
194
+ schema: SIDECAR_SCHEMA,
195
+ version: bareVersion(version),
196
+ ...after,
197
+ sha256,
198
+ });
199
+ return true;
200
+ }
201
+ catch (err) {
202
+ warn(`Could not record identity for ${binaryPath}: ${err instanceof Error ? err.message : String(err)}`);
203
+ return false;
204
+ }
205
+ })();
206
+ pendingIdentityWrites.add(task);
207
+ void task.finally(() => pendingIdentityWrites.delete(task));
208
+ return task;
209
+ }
210
+ /** Test helper: wait for every identity write started by {@link recordBinaryIdentity}. */
211
+ export async function __waitForIdentityWritesForTests() {
212
+ while (pendingIdentityWrites.size > 0) {
213
+ await Promise.all([...pendingIdentityWrites]);
214
+ }
215
+ }
216
+ /**
217
+ * A key for the file's current size, mtime and inode, or null when the file
218
+ * cannot be stat-ed. Two equal keys mean the file has not been replaced or
219
+ * rewritten in between (as far as stat can tell).
220
+ */
221
+ export function binaryStampKey(binaryPath) {
222
+ try {
223
+ const stamp = stampOf(binaryPath);
224
+ return `${stamp.size}:${stamp.mtimeNs}:${stamp.ino ?? "-"}`;
225
+ }
226
+ catch {
227
+ return null;
228
+ }
229
+ }
230
+ /** Content hashes already computed, keyed by path, valid while the stamp key is unchanged. */
231
+ const contentHashCache = new Map();
232
+ /** Content hashes being computed, keyed by path and stamp key. */
233
+ const contentHashInFlight = new Map();
234
+ /**
235
+ * SHA-256 of `binaryPath`'s bytes, computed by streaming the file so the event
236
+ * loop keeps running. Resolves to null when the file is unreadable, or when it
237
+ * changes while being hashed. With `expectedStampKey`, also resolves to null
238
+ * unless the file still has that stamp, so the hash can only describe that
239
+ * exact file. Results are cached until the file's stamp changes.
240
+ */
241
+ export function binaryContentHash(binaryPath, expectedStampKey) {
242
+ const stampKey = binaryStampKey(binaryPath);
243
+ if (stampKey === null)
244
+ return Promise.resolve(null);
245
+ if (expectedStampKey !== undefined && stampKey !== expectedStampKey) {
246
+ return Promise.resolve(null);
247
+ }
248
+ const cached = contentHashCache.get(binaryPath);
249
+ if (cached && cached.stampKey === stampKey)
250
+ return Promise.resolve(cached.sha256);
251
+ const flightKey = `${binaryPath}\0${stampKey}`;
252
+ const existing = contentHashInFlight.get(flightKey);
253
+ if (existing)
254
+ return existing;
255
+ const task = (async () => {
256
+ try {
257
+ const sha256 = await sha256File(binaryPath);
258
+ if (binaryStampKey(binaryPath) !== stampKey)
259
+ return null;
260
+ contentHashCache.set(binaryPath, { stampKey, sha256 });
261
+ return sha256;
262
+ }
263
+ catch {
264
+ return null;
265
+ }
266
+ finally {
267
+ contentHashInFlight.delete(flightKey);
268
+ }
269
+ })();
270
+ contentHashInFlight.set(flightKey, task);
271
+ return task;
272
+ }
273
+ /**
274
+ * The content hash of `binaryPath` if it is known without reading the file,
275
+ * else null. Known means: a matching identity sidecar (stat check only) or a
276
+ * hash computed earlier for the file's current stamp. On a miss, a streamed
277
+ * hash starts in the background so a later call can answer. Never reads or
278
+ * hashes the file synchronously, so it is safe on a host's main thread.
279
+ */
280
+ export function peekBinaryContentHash(binaryPath) {
281
+ if (checkBinaryIdentity(binaryPath).status === "trusted") {
282
+ const sha256 = readBinaryIdentity(binaryPath)?.sha256;
283
+ if (sha256)
284
+ return sha256;
285
+ }
286
+ const stampKey = binaryStampKey(binaryPath);
287
+ if (stampKey === null)
288
+ return null;
289
+ const cached = contentHashCache.get(binaryPath);
290
+ if (cached && cached.stampKey === stampKey)
291
+ return cached.sha256;
292
+ void binaryContentHash(binaryPath);
293
+ return null;
294
+ }
295
+ //# sourceMappingURL=binary-identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary-identity.js","sourceRoot":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IAAI,mBAAmB,CAAC,UAAU,CAAC,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACzD,MAAM,MAAM,GAAG,kBAAkB,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QACtD,IAAI,MAAM;YAAE,OAAO,MAAM,CAAC;IAC5B,CAAC;IACD,MAAM,QAAQ,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;IAC5C,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACnC,MAAM,MAAM,GAAG,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAChD,IAAI,MAAM,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,MAAM,CAAC;IACjE,KAAK,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACnC,OAAO,IAAI,CAAC;AACd,CAAC"}
package/dist/bridge.d.ts CHANGED
@@ -274,10 +274,19 @@ export declare class BinaryBridge implements AftProjectTransport {
274
274
  private invalidateTransportProcess;
275
275
  hasPendingRequests(): boolean;
276
276
  hasOutstandingBackgroundTasks(): boolean;
277
+ /**
278
+ * Fingerprint the binary this child was spawned from, without reading it on
279
+ * the host thread. When the fingerprint is not known yet, it is hashed in the
280
+ * background and adopted only if the file still has the stamp it had at
281
+ * spawn and this is still the same child, so the fingerprint always
282
+ * describes the bytes the running child came from.
283
+ */
284
+ private recordSpawnedBinaryFingerprint;
277
285
  /**
278
286
  * Idle-window maintenance hook: when the on-disk binary changed since this
279
287
  * child spawned, stop routing new work to this bridge so the pool can let it
280
- * drain and retire it.
288
+ * drain and retire it. A fingerprint that is still being computed counts as
289
+ * unchanged; the next check sees the result.
281
290
  */
282
291
  maybeScheduleRespawnForUpdatedBinary(checkIntervalMs: number, now?: number): boolean;
283
292
  /** Project root this bridge was spawned/configured for. */
@@ -1 +1 @@
1
- {"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AASA,OAAO,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,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IA8B/B,gGAAgG;YAClF,YAAY;YAuCZ,oBAAoB;IAgClC,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,YAAY;IA+KpB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,YAAY;IA6BpB,OAAO,CAAC,iBAAiB;IASzB;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,YAAY;IAoCpB,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,iBAAiB;IAyEzB,OAAO,CAAC,0BAA0B;IAkBlC,OAAO,CAAC,aAAa;IAsDrB,OAAO,CAAC,WAAW;IAgEnB,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,yBAAyB;IAQjC,OAAO,CAAC,sBAAsB;CAM/B"}
package/dist/bridge.js CHANGED
@@ -1,10 +1,9 @@
1
- import { spawn } from "node:child_process";
2
- import { createHash } from "node:crypto";
3
- import { readFileSync } from "node:fs";
4
1
  import { homedir } from "node:os";
5
2
  import { join } from "node:path";
6
3
  import { StringDecoder } from "node:string_decoder";
7
4
  import { error, getActiveLogger, getLogFilePath, log, warn } from "./active-logger.js";
5
+ import { binaryContentHash, binaryStampKey, peekBinaryContentHash } from "./binary-identity.js";
6
+ import { spawn } from "./child-process.js";
8
7
  import { isPassiveCommand, PASSIVE_COMMAND_TIMEOUT_MS } from "./command-timeouts.js";
9
8
  import { withPathPrepended } from "./path-env.js";
10
9
  const DEFAULT_BRIDGE_TIMEOUT_MS = 30_000;
@@ -35,15 +34,22 @@ function bashTaskIdFrom(response) {
35
34
  return camelCase;
36
35
  return undefined;
37
36
  }
38
- function hashBinaryOnDisk(binaryPath) {
39
- try {
40
- return createHash("sha256").update(readFileSync(binaryPath)).digest("hex");
41
- }
42
- catch {
43
- return null;
44
- }
37
+ /**
38
+ * The bridge fingerprints its binary's bytes at spawn and compares that with
39
+ * the file on disk during idle maintenance, so a bridge whose binary was
40
+ * replaced (an upgrade or a local rebuild) retires and the next call respawns
41
+ * onto the new binary. Hashing the ~85 MB binary synchronously stalled the
42
+ * host thread on every spawn and every check, so the default reader never
43
+ * reads the file itself: it answers from the identity sidecar or an earlier
44
+ * hash of the same stamp, and otherwise starts a streamed hash and reports
45
+ * "unknown for now".
46
+ */
47
+ function peekBinaryFingerprint(binaryPath) {
48
+ return peekBinaryContentHash(binaryPath);
45
49
  }
46
- let binaryFingerprintReader = hashBinaryOnDisk;
50
+ let binaryFingerprintReader = peekBinaryFingerprint;
51
+ /** Off-thread fingerprint used when the spawn-time peek had no answer yet. */
52
+ let binaryFingerprintAsyncReader = binaryContentHash;
47
53
  function readBinaryFingerprint(binaryPath) {
48
54
  try {
49
55
  const fingerprint = binaryFingerprintReader(binaryPath);
@@ -55,7 +61,13 @@ function readBinaryFingerprint(binaryPath) {
55
61
  }
56
62
  /** Test seam: replace the on-disk binary fingerprint reader without fs module mocks. */
57
63
  export function __setBinaryFingerprintForTests(impl) {
58
- binaryFingerprintReader = impl ?? hashBinaryOnDisk;
64
+ binaryFingerprintReader = impl ?? peekBinaryFingerprint;
65
+ binaryFingerprintAsyncReader = impl
66
+ ? async (binaryPath) => {
67
+ const fingerprint = impl(binaryPath);
68
+ return typeof fingerprint === "string" && fingerprint.length > 0 ? fingerprint : null;
69
+ }
70
+ : binaryContentHash;
59
71
  }
60
72
  // ## Note on TypeScript `as` type assertions
61
73
  //
@@ -399,10 +411,34 @@ export class BinaryBridge {
399
411
  hasOutstandingBackgroundTasks() {
400
412
  return this.outstandingBackgroundTaskIds.size > 0;
401
413
  }
414
+ /**
415
+ * Fingerprint the binary this child was spawned from, without reading it on
416
+ * the host thread. When the fingerprint is not known yet, it is hashed in the
417
+ * background and adopted only if the file still has the stamp it had at
418
+ * spawn and this is still the same child, so the fingerprint always
419
+ * describes the bytes the running child came from.
420
+ */
421
+ recordSpawnedBinaryFingerprint() {
422
+ this.spawnedBinaryFingerprint = readBinaryFingerprint(this.binaryPath);
423
+ if (this.spawnedBinaryFingerprint)
424
+ return;
425
+ const spawnStampKey = binaryStampKey(this.binaryPath);
426
+ if (spawnStampKey === null)
427
+ return;
428
+ const generation = this.processGeneration;
429
+ void binaryFingerprintAsyncReader(this.binaryPath, spawnStampKey).then((fingerprint) => {
430
+ if (fingerprint &&
431
+ this.processGeneration === generation &&
432
+ this.spawnedBinaryFingerprint === null) {
433
+ this.spawnedBinaryFingerprint = fingerprint;
434
+ }
435
+ }, () => { });
436
+ }
402
437
  /**
403
438
  * Idle-window maintenance hook: when the on-disk binary changed since this
404
439
  * child spawned, stop routing new work to this bridge so the pool can let it
405
- * drain and retire it.
440
+ * drain and retire it. A fingerprint that is still being computed counts as
441
+ * unchanged; the next check sees the result.
406
442
  */
407
443
  maybeScheduleRespawnForUpdatedBinary(checkIntervalMs, now = Date.now()) {
408
444
  if (this._shuttingDown || this._retiringDueToBinaryChange || !this.isAlive())
@@ -1092,7 +1128,7 @@ export class BinaryBridge {
1092
1128
  });
1093
1129
  this.process = child;
1094
1130
  this.processGeneration += 1;
1095
- this.spawnedBinaryFingerprint = readBinaryFingerprint(this.binaryPath);
1131
+ this.recordSpawnedBinaryFingerprint();
1096
1132
  this.lastBinaryFingerprintCheckAt = Date.now();
1097
1133
  this.stdoutBuffer = "";
1098
1134
  this.stdoutReadOffset = 0;
@@ -1110,16 +1146,30 @@ export class BinaryBridge {
1110
1146
  }
1111
1147
  }
1112
1148
  onStderrData(data) {
1113
- this.stderrBuffer += data;
1114
- let newlineIdx;
1115
- while ((newlineIdx = this.stderrBuffer.indexOf("\n")) !== -1) {
1116
- const line = this.stderrBuffer.slice(0, newlineIdx).replace(/\r$/, "");
1117
- this.stderrBuffer = this.stderrBuffer.slice(newlineIdx + 1);
1118
- if (!line || !shouldSurfaceStderrLine(line))
1119
- continue;
1120
- const tagged = tagStderrLine(line);
1121
- this.logVia(tagged);
1122
- this.pushStderrLine(tagged);
1149
+ // Search each incoming segment once; never concatenate an unbounded partial record.
1150
+ const partialLimit = 64 * 1024;
1151
+ let offset = 0;
1152
+ while (offset < data.length) {
1153
+ const newline = data.indexOf("\n", offset);
1154
+ const end = newline < 0 ? data.length : newline;
1155
+ while (offset < end) {
1156
+ const count = Math.min(partialLimit - this.stderrBuffer.length, end - offset);
1157
+ this.stderrBuffer += data.slice(offset, offset + count);
1158
+ offset += count;
1159
+ if (this.stderrBuffer.length === partialLimit) {
1160
+ const last = this.stderrBuffer.charCodeAt(this.stderrBuffer.length - 1);
1161
+ const carry = last >= 0xd800 && last <= 0xdbff ? this.stderrBuffer.slice(-1) : "";
1162
+ const fragment = carry ? this.stderrBuffer.slice(0, -1) : this.stderrBuffer;
1163
+ const tagged = tagStderrLine(`${fragment} [stderr record truncated into bounded fragments; ${Buffer.byteLength(fragment)} bytes shown, continuation follows]`);
1164
+ this.stderrBuffer = carry;
1165
+ this.logVia(tagged);
1166
+ this.pushStderrLine(tagged);
1167
+ }
1168
+ }
1169
+ if (newline < 0)
1170
+ break;
1171
+ this.flushStderrBuffer();
1172
+ offset = newline + 1;
1123
1173
  }
1124
1174
  }
1125
1175
  flushStderrBuffer() {