@miraland-labs/conduit-bridge 0.16.200 → 0.16.205

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.
@@ -16,7 +16,7 @@ export function isBoundedVerificationCommand(command) {
16
16
  // Cargo takes flags the same way: acme-sim registered `cargo clippy --all-targets -- -D warnings`
17
17
  // on 2026-09-25, the rule admitted only a bare `cargo test|check`, and five deliveries shipped
18
18
  // clippy failures because the gate was dropped before any attempt could run it.
19
- return /^(npm run [A-Za-z0-9][A-Za-z0-9._:-]*|pnpm [A-Za-z0-9][A-Za-z0-9._:-]*|yarn [A-Za-z0-9][A-Za-z0-9._:-]*|cargo (test|check|clippy)(?: [\w./=:-]+)*|go test(?: \.\/\.\.\.)?|make [A-Za-z0-9][A-Za-z0-9._-]*|python3? -m [A-Za-z0-9_][\w.]*(?: [\w./=:*-]+)*|pytest(?: [\w./=*-]+)?|python3? [\w./-]+\.py(?: [\w./=:-]+)*|(?:\.\/gradlew|gradle|\.\/mvnw|mvn) test|Rscript tests\/testthat\.R|Rscript -e testthat::test_local\(\))$/.test(command);
19
+ return /^(npm run [A-Za-z0-9][A-Za-z0-9._:-]*(?: --(?: [\w./=:-]+)+)?|pnpm [A-Za-z0-9][A-Za-z0-9._:-]*(?: --(?: [\w./=:-]+)+)?|yarn [A-Za-z0-9][A-Za-z0-9._:-]*(?: --(?: [\w./=:-]+)+)?|cargo (test|check|clippy)(?: [\w./=:-]+)*|go test(?: \.\/\.\.\.)?|make [A-Za-z0-9][A-Za-z0-9._-]*|python3? -m [A-Za-z0-9_][\w.]*(?: [\w./=:*-]+)*|pytest(?: [\w./=*-]+)?|python3? [\w./-]+\.py(?: [\w./=:-]+)*|(?:\.\/gradlew|gradle|\.\/mvnw|mvn) test|Rscript tests\/testthat\.R|Rscript -e testthat::test_local\(\))$/.test(command);
20
20
  }
21
21
  /** Shell commands each grant authorizes — mapped per driver so they cannot drift. */
22
22
  export const branchCreateCommands = [
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { redactSecrets, redactSecretsDeep } from "./secret-redaction.js";
9
9
  import { z } from "zod";
10
- import { boundedTail, runBoundedVerificationCommand } from "./ensure-test-evidence.js";
10
+ import { boundedTail, runBoundedVerificationCommand, VERIFICATION_TIMEOUT_MS } from "./ensure-test-evidence.js";
11
11
  import { markAttemptActive } from "./preflight.js";
12
12
  import { createAttemptWorktree, removeAttemptWorktree } from "./attempt-worktree.js";
13
13
  import { buildWorkspaceBrief, ensureCommitAvailable, normalizeRepositoryUrl } from "./brief.js";
@@ -106,7 +106,8 @@ const investigationBriefSchema = z.object({
106
106
  /** T122: a delivery verification is an investigation whose question carries this header. */
107
107
  export const DELIVERY_VERIFICATION_HEADER = "DELIVERY VERIFICATION";
108
108
  /** Owner-verbatim: the lane writes probe source; Bridge executes. Shown only when BRIEF KEYS are present. */
109
- export const DELIVERY_VERIFICATION_PROBE_INSTRUCTION = 'For every BRIEF KEY that states behaviour, add one entry to probes: either {"key":"[sN]","test":"<registered command that asserts it>","checks":"<one line: what it proves>"} or {"key":"[sN]","lang":"ts|py|sh","source":"<a short script run from the repository root that prints PROBE HOLDS as its last line and exits 0 when the key holds at this commit and prints PROBE FAILS as its last line and exits 1 when it does not; any other ending is recorded as broken; it may import repository modules by paths relative to the repository root>","checks":"<one line>"}. You do not run probes; Bridge runs them after you finish. Every other BRIEF KEY states no behaviour (wording, scope, docs): add it to no_behaviour as {"key":"[sN]","reason":"<one line: why it states no behaviour>"}. Name every BRIEF KEY once, in probes or in no_behaviour.';
109
+ export const DELIVERY_VERIFICATION_PROBE_ADMITTED_SHAPE = 'Admitted shape: npm run <script>, pnpm <script>, or yarn <script>, optionally followed by -- and plain tokens using only letters, digits, underscore, dot, slash, equals, colon, or hyphen; no quotes or shell syntax.';
110
+ export const DELIVERY_VERIFICATION_PROBE_INSTRUCTION = 'For every BRIEF KEY that states behaviour, add one entry to probes: either {"key":"[sN]","test":"<one of the REGISTERED COMMANDS verbatim, optionally narrowed with the admitted argument tail>","checks":"<one line: what it proves>"} or {"key":"[sN]","lang":"ts|py|sh","source":"<a short script run from the repository root that prints PROBE HOLDS as its last line and exits 0 when the key holds at this commit and prints PROBE FAILS as its last line and exits 1 when it does not; any other ending is recorded as broken; it may import repository modules by paths relative to the repository root>","checks":"<one line>"}. ' + DELIVERY_VERIFICATION_PROBE_ADMITTED_SHAPE + ' A filter that needs quotes must use a source probe instead. You do not run probes; Bridge runs them after you finish. Every other BRIEF KEY states no behaviour (wording, scope, docs): add it to no_behaviour as {"key":"[sN]","reason":"<one line: why it states no behaviour>"}. Name every BRIEF KEY once, in probes or in no_behaviour.';
110
111
  const BRIEF_JSON_EXAMPLE = '{"summary":"one paragraph: what the change does and whether it meets the criteria","findings":["grounded fact with file/symbol"],"verification":["command — result"],"limitations":["what you could not settle"],"criteria":[{"criterion":"c1","assessment":"supported|unsupported|unclear","reason":"what you saw"}],"command_failures":["command that exited non-zero — the decisive output line"],"files_read":0,"bytes_read":0,"commands_run":["command you actually ran"]}';
111
112
  const BRIEF_JSON_EXAMPLE_WITH_PROBES = '{"summary":"one paragraph: what the change does and whether it meets the criteria","findings":["grounded fact with file/symbol"],"verification":["command — result"],"limitations":["what you could not settle"],"criteria":[{"criterion":"c1","assessment":"supported|unsupported|unclear","reason":"what you saw"}],"command_failures":["command that exited non-zero — the decisive output line"],"probes":[],"no_behaviour":[],"files_read":0,"bytes_read":0,"commands_run":["command you actually ran"]}';
112
113
  /** Named in both prompts so the lane knows each list's maximum before it writes. */
@@ -418,6 +419,10 @@ export const BRIDGE_PACKAGE_NAME = "@miraland-labs/conduit-bridge";
418
419
  export const BRIDGE_SRC_PREFIX = "packages/conduit-bridge/src/";
419
420
  export const PROBE_RUN_ENTRY = "packages/conduit-bridge/src/probe-run.ts";
420
421
  export const DELIVERED_PROBE_SELF_CHECK_TAIL = "delivered probe instrument failed its self-check";
422
+ export const DELIVERED_PROBE_RUN_FAILED_TAIL = "delivered probe instrument failed its real run";
423
+ export function deliveredProbeTimeoutMs(probes) {
424
+ return probes.slice(0, PROBE_MAX).reduce((bound, probe) => bound + (probe.test?.trim() ? VERIFICATION_TIMEOUT_MS : PROBE_TIMEOUT_MS), PROBE_TIMEOUT_MS);
425
+ }
421
426
  export const KNOWN_ANSWER_PROBES = [
422
427
  { key: "[known-holds]", lang: "sh", source: "echo 'PROBE HOLDS'\nexit 0", checks: "known answer: holds" },
423
428
  { key: "[known-fails]", lang: "sh", source: "echo 'PROBE FAILS'\nexit 1", checks: "known answer: fails" },
@@ -567,10 +572,13 @@ export async function runDeliveryVerificationProbes(input) {
567
572
  const source = probe.source?.trim() ?? "";
568
573
  if (named) {
569
574
  if (!isRunnableVerificationCommand(named)) {
570
- witnesses.push(witnessRecord({
571
- key: probe.key, kind: "test", command: named, exitCode: -1, stdout: "", stderr: "not a registered command", checks,
572
- verdict: "broken",
573
- }));
575
+ witnesses.push({
576
+ ...witnessRecord({
577
+ key: probe.key, kind: "test", command: named, exitCode: -1, stdout: "", stderr: "", checks,
578
+ verdict: "broken",
579
+ }),
580
+ tail: `not a registered command: ${named} ${DELIVERY_VERIFICATION_PROBE_ADMITTED_SHAPE}`,
581
+ });
574
582
  continue;
575
583
  }
576
584
  let exitCode = -1;
@@ -640,8 +648,8 @@ const deliveredWitnessSchema = z.object({
640
648
  function stampInstrument(witnesses, instrument) {
641
649
  return witnesses.map((witness) => ({ ...witness, instrument }));
642
650
  }
643
- function markSelfCheckBroken(witnesses, reason) {
644
- const tail = boundedTail(`${DELIVERED_PROBE_SELF_CHECK_TAIL}: ${reason}`, PROBE_TAIL_CHARS);
651
+ function markDeliveredProbeBroken(witnesses, label, reason) {
652
+ const tail = `${label}: ${boundedTail(reason, PROBE_TAIL_CHARS - label.length - 2)}`;
645
653
  return stampInstrument(witnesses.map((witness) => ({
646
654
  ...witness,
647
655
  verdict: "broken",
@@ -683,7 +691,7 @@ async function execDeliveredProbeRun(argv, stdin, workspace, timeoutMs) {
683
691
  }
684
692
  export async function runDeliveredProbeInstrument(input) {
685
693
  const entry = join(input.workspace, PROBE_RUN_ENTRY);
686
- const timeoutMs = PROBE_TIMEOUT_MS * (input.probes.length + 1);
694
+ const timeoutMs = deliveredProbeTimeoutMs(input.probes);
687
695
  const stdin = JSON.stringify({ probes: input.probes });
688
696
  const argv = ["node", ...probeNodeFlags(), "--import", tsxLoader, entry];
689
697
  const result = await (input.exec ?? execDeliveredProbeRun)(argv, stdin, input.workspace, timeoutMs);
@@ -710,15 +718,23 @@ export async function runDeliveryVerificationProbesForAttempt(input) {
710
718
  let selfCheckDetail = null;
711
719
  try {
712
720
  const check = await runDelivered({ workspace: input.workspace, probes: KNOWN_ANSWER_PROBES });
713
- if (knownAnswerProbesPassed(check)) {
714
- return stampInstrument(await runDelivered({ workspace: input.workspace, probes: input.probes }), "delivered");
721
+ if (!knownAnswerProbesPassed(check)) {
722
+ selfCheckDetail = `gave ${check.map((witness) => witness.verdict).join(", ")}`;
715
723
  }
716
- selfCheckDetail = `gave ${check.map((witness) => witness.verdict).join(", ")}`;
717
724
  }
718
725
  catch (error) {
719
726
  selfCheckDetail = redactSecrets(error instanceof Error ? error.message : String(error));
720
727
  }
721
- return markSelfCheckBroken(await runRunning(), selfCheckDetail ?? "");
728
+ if (selfCheckDetail !== null) {
729
+ return markDeliveredProbeBroken(await runRunning(), DELIVERED_PROBE_SELF_CHECK_TAIL, selfCheckDetail);
730
+ }
731
+ try {
732
+ return stampInstrument(await runDelivered({ workspace: input.workspace, probes: input.probes }), "delivered");
733
+ }
734
+ catch (error) {
735
+ const detail = redactSecrets(error instanceof Error ? error.message : String(error));
736
+ return markDeliveredProbeBroken(await runRunning(), DELIVERED_PROBE_RUN_FAILED_TAIL, detail);
737
+ }
722
738
  }
723
739
  async function settle(client, investigationId, body) {
724
740
  await client.request(`/runner/v1/investigations/${investigationId}/settle`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miraland-labs/conduit-bridge",
3
- "version": "0.16.200",
3
+ "version": "0.16.205",
4
4
  "description": "Conduit Bridge CLI — 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": {