@miraland-labs/conduit-bridge 0.16.111 → 0.16.112

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.
@@ -18,11 +18,20 @@ import { diffStatSince } from "./git-witness.js";
18
18
  import { switchManagedWorkspace } from "./on-shift-apply.js";
19
19
  import { execFile } from "node:child_process";
20
20
  import { mkdtemp, rm, writeFile } from "node:fs/promises";
21
+ import { createRequire } from "node:module";
21
22
  import { tmpdir } from "node:os";
22
23
  import { join } from "node:path";
23
24
  import { promisify } from "node:util";
24
25
  import { isRunnableVerificationCommand } from "./execution-class.js";
25
26
  const execFileAsync = promisify(execFile);
27
+ const tsxLoader = (() => {
28
+ try {
29
+ return createRequire(import.meta.url).resolve("tsx");
30
+ }
31
+ catch {
32
+ return "tsx";
33
+ }
34
+ })();
26
35
  const budgetSchema = z.object({
27
36
  max_files: z.number().int().min(1).max(24).optional().default(8),
28
37
  max_duration_ms: z.number().int().min(10_000).max(15 * 60_000).optional().default(5 * 60_000),
@@ -265,6 +274,29 @@ const PROBE_MAX = 20;
265
274
  const PROBE_COMMAND_MAX = 300;
266
275
  const PROBE_CHECKS_MAX = 500;
267
276
  const PROBE_KEY_MAX = 40;
277
+ const PROBE_HOLDS_LINE = "PROBE HOLDS";
278
+ const PROBE_FAILS_LINE = "PROBE FAILS";
279
+ function lastNonEmptyLine(text) {
280
+ const lines = text.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
281
+ return lines.at(-1) ?? "";
282
+ }
283
+ function sourceProbeVerdict(exitCode, stdout) {
284
+ const last = lastNonEmptyLine(stdout);
285
+ if (exitCode === 0 && last === PROBE_HOLDS_LINE)
286
+ return "holds";
287
+ if (exitCode === 1 && last === PROBE_FAILS_LINE)
288
+ return "fails";
289
+ return "broken";
290
+ }
291
+ function testProbeVerdict(ran, exitCode) {
292
+ if (!ran)
293
+ return "broken";
294
+ return exitCode === 0 ? "holds" : "fails";
295
+ }
296
+ function probeTail(stderr, stdout) {
297
+ const stderrTail = stderr.length > PROBE_TAIL_CHARS ? stderr.slice(stderr.length - PROBE_TAIL_CHARS) : stderr;
298
+ return boundedTail(`${stderrTail}\n${stdout}`, PROBE_TAIL_CHARS);
299
+ }
268
300
  function probeEnv() {
269
301
  const env = {};
270
302
  if (process.env.PATH !== undefined)
@@ -282,14 +314,14 @@ function probeInterpreter(language) {
282
314
  }
283
315
  function probeFilename(language) {
284
316
  if (language === "ts")
285
- return "probe.ts";
317
+ return "probe.mts";
286
318
  if (language === "py")
287
319
  return "probe.py";
288
320
  return "probe.sh";
289
321
  }
290
322
  function probeArgv(language, file) {
291
323
  if (language === "ts")
292
- return ["node", "--import", "tsx", file];
324
+ return ["node", "--import", tsxLoader, file];
293
325
  if (language === "py")
294
326
  return ["python3", file];
295
327
  return ["bash", file];
@@ -314,9 +346,11 @@ async function execProbe(argv, workspace) {
314
346
  const err = error;
315
347
  if (typeof err.code === "string")
316
348
  throw error;
349
+ const stdout = String(err.stdout ?? "");
350
+ const stderr = String(err.stderr ?? "");
317
351
  return {
318
- stdout: String(err.stdout ?? ""),
319
- stderr: String(err.stderr || err.message || "probe failed"),
352
+ stdout,
353
+ stderr: stdout === "" && stderr === "" ? String(err.message || "probe failed") : stderr,
320
354
  code: err.killed === true || typeof err.code !== "number" ? -1 : err.code,
321
355
  };
322
356
  }
@@ -327,8 +361,9 @@ function witnessRecord(input) {
327
361
  kind: input.kind,
328
362
  command: clipWitnessField(input.command, PROBE_COMMAND_MAX),
329
363
  exit_code: input.exitCode,
330
- tail: boundedTail(`${input.stderr.trim()}\n${input.stdout.trim()}`.trim(), PROBE_TAIL_CHARS),
364
+ tail: probeTail(input.stderr, input.stdout),
331
365
  checks: clipWitnessField(input.checks, PROBE_CHECKS_MAX),
366
+ verdict: input.verdict,
332
367
  };
333
368
  }
334
369
  /**
@@ -346,17 +381,20 @@ export async function runDeliveryVerificationProbes(input) {
346
381
  if (!isRunnableVerificationCommand(named)) {
347
382
  witnesses.push(witnessRecord({
348
383
  key: probe.key, kind: "test", command: named, exitCode: -1, stdout: "", stderr: "not a registered command", checks,
384
+ verdict: "broken",
349
385
  }));
350
386
  continue;
351
387
  }
352
388
  let exitCode = -1;
353
389
  let stdout = "";
354
390
  let stderr = "";
391
+ let ran = false;
355
392
  try {
356
393
  const result = await (input.runCommand ?? runBoundedVerificationCommand)(named, input.workspace);
357
394
  exitCode = result.code;
358
395
  stdout = result.stdout;
359
396
  stderr = result.stderr;
397
+ ran = true;
360
398
  }
361
399
  catch (error) {
362
400
  stderr = error instanceof Error ? error.message : String(error);
@@ -364,6 +402,7 @@ export async function runDeliveryVerificationProbes(input) {
364
402
  }
365
403
  witnesses.push(witnessRecord({
366
404
  key: probe.key, kind: "test", command: named, exitCode, stdout, stderr, checks,
405
+ verdict: testProbeVerdict(ran, exitCode),
367
406
  }));
368
407
  continue;
369
408
  }
@@ -394,6 +433,7 @@ export async function runDeliveryVerificationProbes(input) {
394
433
  }
395
434
  witnesses.push(witnessRecord({
396
435
  key: probe.key, kind: "probe", command, exitCode, stdout, stderr, checks,
436
+ verdict: sourceProbeVerdict(exitCode, stdout),
397
437
  }));
398
438
  }
399
439
  return witnesses;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miraland-labs/conduit-bridge",
3
- "version": "0.16.111",
3
+ "version": "0.16.112",
4
4
  "description": "Conduit Bridge CLI \u2014 join, connect, disconnect, multi-driver lanes, and run Claude Code / Codex / Cursor / OpenCode / Pi / Kiro / Antigravity / Grok Build agents for a Conduit organization",
5
5
  "type": "module",
6
6
  "bin": {