@bridge_gpt/mcp-server 0.2.71 → 0.2.72

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/README.md +55 -17
  2. package/build/agent-launchers/claude-executor-adapter.js +19 -3
  3. package/build/agent-notes.js +171 -95
  4. package/build/agents.generated.js +4 -4
  5. package/build/bridge-permissions.js +4 -0
  6. package/build/bridge-worktree-inspection.js +237 -0
  7. package/build/check-evidence.js +6 -0
  8. package/build/claude-review-workflow.js +1 -1
  9. package/build/cli-help.js +6 -0
  10. package/build/codex-auto-recovery.js +126 -0
  11. package/build/codex-skill-adapter.js +2 -0
  12. package/build/commands.generated.js +5 -5
  13. package/build/conductor/bridge-api-client.js +518 -23
  14. package/build/conductor/doctor.js +84 -10
  15. package/build/conductor/epic-implementer-cli.js +51 -2
  16. package/build/conductor/gate-discovery.js +136 -10
  17. package/build/conductor/gate-settings-review.js +305 -5
  18. package/build/conductor/git-hooks-uninstall.js +112 -0
  19. package/build/conductor/git-hooks.js +81 -15
  20. package/build/conductor/guided-repair.js +10 -1
  21. package/build/conductor/install-doctor.js +2 -4
  22. package/build/conductor/launch-plan.js +42 -2
  23. package/build/conductor/local-merge.js +12 -1
  24. package/build/conductor/merge-execution-contract.js +1 -1
  25. package/build/conductor/merged-child-check.js +2 -1
  26. package/build/conductor/prerequisite-inputs.js +379 -0
  27. package/build/conductor/readiness-assessment.js +78 -0
  28. package/build/conductor/readiness-cli.js +10 -0
  29. package/build/conductor/readiness-prerequisites.js +53 -0
  30. package/build/conductor/readiness-sections.js +21 -8
  31. package/build/conductor/readiness.js +20 -2
  32. package/build/conductor/recovery-cli.js +223 -13
  33. package/build/conductor/recovery-operations.js +34 -4
  34. package/build/conductor/repair-contract.js +33 -0
  35. package/build/conductor/tools.js +34 -3
  36. package/build/conductor/wait-run-attention.js +115 -0
  37. package/build/conductor/wait-run-cli.js +96 -3
  38. package/build/conductor/worker-database-doctor-inspector.js +1 -0
  39. package/build/credential-store.js +25 -20
  40. package/build/dependency-install-declarations.js +157 -0
  41. package/build/docs.generated.js +4 -4
  42. package/build/doctor.js +37 -5
  43. package/build/drive-epic-help.js +2 -2
  44. package/build/drive-epic.js +52 -11
  45. package/build/epic-implementer-bin.js +118 -43
  46. package/build/epic-launch-profile.js +1 -1
  47. package/build/executor/cli.js +2 -0
  48. package/build/executor/completion-contract.js +16 -0
  49. package/build/executor/credentials.js +1 -1
  50. package/build/executor/delivery-observations.js +113 -0
  51. package/build/executor/delivery-outcome.js +30 -0
  52. package/build/executor/dependency-refresh-runner.js +132 -0
  53. package/build/executor/dependency-refresh.js +530 -0
  54. package/build/executor/deps.js +4 -0
  55. package/build/executor/env.js +67 -2
  56. package/build/executor/harness-coverage.js +19 -0
  57. package/build/executor/http-client.js +35 -1
  58. package/build/executor/index.js +2 -1
  59. package/build/executor/install-preflight.js +1 -1
  60. package/build/executor/job-runner.js +246 -28
  61. package/build/executor/likely-tests.js +94 -97
  62. package/build/executor/prompt-spec.js +13 -3
  63. package/build/executor/required-verification.js +28 -0
  64. package/build/executor/required-work-diagnostics.js +30 -0
  65. package/build/executor/required-work-ledger.js +19 -1
  66. package/build/executor/results.js +42 -0
  67. package/build/executor/service-discovery.js +42 -0
  68. package/build/executor/service-lifecycle.js +109 -2
  69. package/build/executor/service-uninstall.js +205 -0
  70. package/build/executor/service-unit.js +5 -3
  71. package/build/executor/test-clock.js +3 -0
  72. package/build/executor/verification-hints.js +179 -0
  73. package/build/executor/worker-command.js +54 -2
  74. package/build/executor/worker-database.js +271 -31
  75. package/build/executor/worker-finalization.js +65 -10
  76. package/build/executor/worker-guard-hook.js +10 -2
  77. package/build/executor/worker-verification-guidance.js +37 -2
  78. package/build/executor/worktree-inspection.js +42 -0
  79. package/build/github-sign-in.js +1 -1
  80. package/build/index.js +679 -278
  81. package/build/init.js +3 -3
  82. package/build/install-bridge-conductor-gate.js +236 -42
  83. package/build/install-bridge-conductor-setup.js +115 -26
  84. package/build/install-bridge-conductor.js +448 -350
  85. package/build/install-bridge.js +418 -123
  86. package/build/install-maintenance.js +104 -0
  87. package/build/install-reexec.js +1 -1
  88. package/build/local-cleanup.js +59 -0
  89. package/build/mcp-install-state.js +68 -2
  90. package/build/merge-workflow-install.js +2 -2
  91. package/build/package-script-semantics.js +10 -0
  92. package/build/pipeline-utils.js +1 -1
  93. package/build/pipelines.generated.js +5 -5
  94. package/build/plan-execution-ledger.js +148 -2
  95. package/build/plane/plane-freshness.js +6 -7
  96. package/build/plane/terminal-run-cleanup.js +5 -1
  97. package/build/plane/terminal-run-status.js +4 -0
  98. package/build/printed-remedy-commands.js +24 -4
  99. package/build/readiness-check.js +1 -78
  100. package/build/readiness-prerequisites.generated.js +199 -0
  101. package/build/readme.generated.js +1 -1
  102. package/build/repository-toolchains.js +50 -8
  103. package/build/setup-change-policy.js +32 -0
  104. package/build/setup-epic.js +2 -2
  105. package/build/setup-question.js +62 -0
  106. package/build/start-tickets.js +4 -0
  107. package/build/test-command-detection.js +32 -88
  108. package/build/test-support/notes-fs.js +40 -0
  109. package/build/ticket-delivery-enrollment.js +21 -8
  110. package/build/ticket-delivery-run-scope.js +128 -0
  111. package/build/version.generated.js +3 -3
  112. package/build/worker-guard-hook-bin.js +2 -2
  113. package/build/worktrees.js +105 -0
  114. package/docs/EPIC-IMPLEMENTER.md +5 -0
  115. package/docs/epic-implementer/getting-started.md +40 -15
  116. package/package.json +1 -1
@@ -121,7 +121,41 @@ export const HANDOFF_CAUSES = [
121
121
  "toolchain_unavailable",
122
122
  "credential_unavailable",
123
123
  "mcp_unavailable",
124
+ "preexisting_at_base",
124
125
  ];
126
+ /**
127
+ * BAPI-1552: the one cause that is not a missing capability. The step ran and
128
+ * failed, and the same tests already fail at the base commit. Only this cause
129
+ * carries `base_reproduction`, and it must carry it. Mirrors
130
+ * `HANDOFF_CAUSE_PREEXISTING_AT_BASE` and its neighbours in
131
+ * `api/library/vcs/ticket_delivery_identity.py`, with identical wording.
132
+ */
133
+ export const HANDOFF_CAUSE_PREEXISTING_AT_BASE = "preexisting_at_base";
134
+ export const BASE_REPRODUCTION_FIELDS = [
135
+ "base_sha",
136
+ "command",
137
+ "failing_ids_head",
138
+ "failing_ids_base",
139
+ ];
140
+ export const MAX_BASE_REPRODUCTION_IDS = 200;
141
+ export const MAX_BASE_REPRODUCTION_ID_CHARS = 500;
142
+ export const REFUSAL_BASE_REPRODUCTION_INCOMPLETE = "base_reproduction_incomplete";
143
+ export const REFUSAL_HEAD_FAILURES_NOT_IN_BASE = "head_failures_not_in_base";
144
+ export const REFUSAL_BASE_SHA_NOT_BINDING_BASE = "base_sha_not_binding_base";
145
+ export const PREEXISTING_REFUSAL_CODES = [
146
+ REFUSAL_BASE_REPRODUCTION_INCOMPLETE,
147
+ REFUSAL_HEAD_FAILURES_NOT_IN_BASE,
148
+ REFUSAL_BASE_SHA_NOT_BINDING_BASE,
149
+ ];
150
+ export const PREEXISTING_INCOMPLETE_MESSAGE = "handoff preexisting_at_base needs the six handoff fields plus base_reproduction " +
151
+ "with exactly base_sha (a full commit SHA), a non-blank command, a non-empty " +
152
+ "failing_ids_head, and failing_ids_base; each list holds at most 200 non-blank " +
153
+ "test IDs of at most 500 characters";
154
+ export const PREEXISTING_RECORD_MESSAGE = "handoff preexisting_at_base is accepted only on an escalated pre_pr_verification record";
155
+ export const PREEXISTING_NOT_FAILED_MESSAGE = "handoff preexisting_at_base needs a step that ran and failed: name it in " +
156
+ "verification failures, or submit at the head of its recorded failure";
157
+ export const PREEXISTING_NOT_IN_BASE_MESSAGE = "handoff preexisting_at_base requires every failing_ids_head entry to also " +
158
+ "appear in failing_ids_base";
125
159
  export const HANDOFF_ELIGIBLE_CLASSES = ["unit_tests", "e2e_tests", "rendered_ui_review"];
126
160
  export const HANDOFF_FIELDS = [
127
161
  "cause",
@@ -186,9 +220,13 @@ export const PRE_PR_VERIFICATION_LIMITS = Object.freeze({
186
220
  /** The plan-authored rendered-UI remediation loop's hard cycle cap. */
187
221
  export const RENDERED_UI_MAX_CYCLES = 3;
188
222
  export class PlanLedgerError extends Error {
189
- constructor(message) {
223
+ /** BAPI-1552: a closed refusal code, set only by a `preexisting_at_base` refusal. */
224
+ code;
225
+ constructor(message, code) {
190
226
  super(message);
191
227
  this.name = "PlanLedgerError";
228
+ if (code !== undefined)
229
+ this.code = code;
192
230
  }
193
231
  }
194
232
  // ---------------------------------------------------------------------------
@@ -516,6 +554,14 @@ function validateRecordShape(record, metadata, phase) {
516
554
  if (!PLAN_STEP_DISPOSITIONS.includes(record.disposition)) {
517
555
  throw new PlanLedgerError(`step ${record.stepId} has unsupported disposition '${String(record.disposition)}'; expected one of ${PLAN_STEP_DISPOSITIONS.join(", ")}`);
518
556
  }
557
+ // BAPI-1552: mirrors the server, which refuses this cause on a non-escalated
558
+ // record before any generic disposition check can hide the closed code.
559
+ const handoffValue = record.handoff;
560
+ if (record.disposition !== "escalated" &&
561
+ isRecordObject(handoffValue) &&
562
+ handoffValue.cause === HANDOFF_CAUSE_PREEXISTING_AT_BASE) {
563
+ throw new PlanLedgerError(`step ${record.stepId}: ${PREEXISTING_RECORD_MESSAGE}`, REFUSAL_BASE_REPRODUCTION_INCOMPLETE);
564
+ }
519
565
  if (record.disposition === "adapted") {
520
566
  const adaptation = record.adaptation;
521
567
  if (!adaptation) {
@@ -608,6 +654,10 @@ export function validateHandoff(record, metadata, phase) {
608
654
  };
609
655
  const value = record.handoff;
610
656
  const isObject = typeof value === "object" && value !== null && !Array.isArray(value);
657
+ if (isObject && value.cause === HANDOFF_CAUSE_PREEXISTING_AT_BASE) {
658
+ validatePreexistingHandoff(record, metadata, phase);
659
+ return;
660
+ }
611
661
  const keys = isObject ? Object.keys(value).sort() : [];
612
662
  const expected = [...HANDOFF_FIELDS].sort();
613
663
  if (!isObject || keys.length !== expected.length || keys.some((k, i) => k !== expected[i])) {
@@ -643,10 +693,95 @@ export function validateHandoff(record, metadata, phase) {
643
693
  fail("handoff cannot be combined with prDependency");
644
694
  }
645
695
  }
696
+ function isRecordObject(value) {
697
+ return typeof value === "object" && value !== null && !Array.isArray(value);
698
+ }
699
+ function hasExactKeys(value, expected) {
700
+ const keys = Object.keys(value).sort();
701
+ const want = [...expected].sort();
702
+ return keys.length === want.length && keys.every((k, i) => k === want[i]);
703
+ }
704
+ /** Trimmed raw IDs, or null when the list breaks a rule. Mirrors `_raw_id_list`. */
705
+ function rawIdList(value, nonEmpty) {
706
+ if (!Array.isArray(value) || value.length > MAX_BASE_REPRODUCTION_IDS)
707
+ return null;
708
+ if (nonEmpty && value.length === 0)
709
+ return null;
710
+ const out = [];
711
+ for (const item of value) {
712
+ if (typeof item !== "string")
713
+ return null;
714
+ const text = item.trim();
715
+ if (text === "" || text.length > MAX_BASE_REPRODUCTION_ID_CHARS)
716
+ return null;
717
+ out.push(text);
718
+ }
719
+ return out;
720
+ }
721
+ /**
722
+ * BAPI-1552: the `preexisting_at_base` rules, mirroring the server's
723
+ * `_validate_preexisting_handoff` with the same wording, codes, and precedence:
724
+ * the existing `prDependency` refusal first, then `base_reproduction_incomplete`
725
+ * for any shape, proof, or record problem, then `head_failures_not_in_base`,
726
+ * decided on the trimmed raw IDs, case-sensitively. The class and
727
+ * "named in verification failures" gates do not apply to this cause. The
728
+ * ran-and-failed tie, the prior `remote_ci` refusal, and the head identity read
729
+ * server state, so the server decides them; redaction is server-side too.
730
+ */
731
+ function validatePreexistingHandoff(record, metadata, phase) {
732
+ const refuse = (reason, code) => {
733
+ throw new PlanLedgerError(`step ${record.stepId}: ${reason}`, code);
734
+ };
735
+ const incomplete = () => refuse(PREEXISTING_INCOMPLETE_MESSAGE, REFUSAL_BASE_REPRODUCTION_INCOMPLETE);
736
+ if (record.prDependency !== undefined) {
737
+ refuse("handoff cannot be combined with prDependency");
738
+ }
739
+ const handoff = record.handoff;
740
+ if (!hasExactKeys(handoff, [...HANDOFF_FIELDS, "base_reproduction"]))
741
+ incomplete();
742
+ for (const field of HANDOFF_TEXT_FIELDS) {
743
+ const text = handoff[field];
744
+ if (typeof text !== "string" || text.trim() === "")
745
+ incomplete();
746
+ }
747
+ const sha = handoff.observed_head_sha;
748
+ if (typeof sha !== "string" || !FULL_SHA_PATTERN.test(sha.trim().toLowerCase()))
749
+ incomplete();
750
+ const proof = handoff.base_reproduction;
751
+ if (!isRecordObject(proof) || !hasExactKeys(proof, BASE_REPRODUCTION_FIELDS))
752
+ incomplete();
753
+ const proofObject = proof;
754
+ const baseSha = proofObject.base_sha;
755
+ if (typeof baseSha !== "string" || !FULL_SHA_PATTERN.test(baseSha.trim().toLowerCase())) {
756
+ incomplete();
757
+ }
758
+ const command = proofObject.command;
759
+ if (typeof command !== "string" || command.trim() === "")
760
+ incomplete();
761
+ const headIds = rawIdList(proofObject.failing_ids_head, true);
762
+ const baseIds = rawIdList(proofObject.failing_ids_base, false);
763
+ if (headIds === null || baseIds === null)
764
+ incomplete();
765
+ const owningPart = metadata.parts.find((part) => record.stepId >= part.start_step && record.stepId <= part.end_step);
766
+ if (record.disposition !== "escalated" ||
767
+ phase !== "pre_pr_verification" ||
768
+ !owningPart ||
769
+ PLAN_CLASS_OWNERSHIP[owningPart.provenance_class] !== "pre_pr_verification") {
770
+ refuse(PREEXISTING_RECORD_MESSAGE, REFUSAL_BASE_REPRODUCTION_INCOMPLETE);
771
+ }
772
+ const baseSet = new Set(baseIds);
773
+ if (headIds.some((id) => !baseSet.has(id))) {
774
+ refuse(PREEXISTING_NOT_IN_BASE_MESSAGE, REFUSAL_HEAD_FAILURES_NOT_IN_BASE);
775
+ }
776
+ }
777
+ /** Trim, deduplicate, and sort IDs. Redaction stays server-side. */
778
+ function normalizeIdList(ids) {
779
+ return [...new Set(ids.map((id) => id.trim()))].sort();
780
+ }
646
781
  /** Trim, bound, and lowercase a validated hand-off the way the server stores it. */
647
782
  function normalizeHandoff(handoff) {
648
783
  const bound = (text) => text.trim().slice(0, HANDOFF_MAX_TEXT);
649
- return {
784
+ const normalized = {
650
785
  cause: handoff.cause,
651
786
  criterion: bound(handoff.criterion),
652
787
  observation: bound(handoff.observation),
@@ -654,6 +789,17 @@ function normalizeHandoff(handoff) {
654
789
  observed_head_sha: handoff.observed_head_sha.trim().toLowerCase(),
655
790
  next_action: bound(handoff.next_action),
656
791
  };
792
+ // BAPI-1552: carry the proof through explicitly, or the local ledger drops it.
793
+ const proof = handoff.base_reproduction;
794
+ if (proof !== undefined) {
795
+ normalized.base_reproduction = {
796
+ base_sha: proof.base_sha.trim().toLowerCase(),
797
+ command: bound(proof.command),
798
+ failing_ids_head: normalizeIdList(proof.failing_ids_head),
799
+ failing_ids_base: normalizeIdList(proof.failing_ids_base),
800
+ };
801
+ }
802
+ return normalized;
657
803
  }
658
804
  /**
659
805
  * Validate one phase's reported outcome against the steps it owns.
@@ -1,3 +1,4 @@
1
+ import { isTerminalRunCleanupStatus } from "./terminal-run-status.js";
1
2
  import { monotonicNow, elapsedMs } from "../conductor/precheck-timings.js";
2
3
  /**
3
4
  * Local-plane freshness evidence (BAPI-1476).
@@ -62,8 +63,6 @@ const BOUND_RUN_STATUSES = new Set([
62
63
  "abandoned",
63
64
  "done",
64
65
  ]);
65
- /** The run statuses after which nothing more will happen (as `wait-run` uses). */
66
- const BOUND_RUN_TERMINAL_STATUSES = new Set(["done", "abandoned"]);
67
66
  /** A run id is rendered only when it has a plain, bounded identifier shape. */
68
67
  const BOUND_RUN_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;
69
68
  /**
@@ -72,8 +71,8 @@ const BOUND_RUN_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;
72
71
  * - Non-terminal and unknown status: inspect the run and the plane. It NEVER
73
72
  * recommends `plane down`, because that would stop a run that may still be
74
73
  * working, and an unknown status is not evidence that it is finished.
75
- * - Terminal status (`done`/`abandoned`): the next local launch's guarded cleanup
76
- * tears the plane down; if that cleanup reports it was incomplete, inspect with
74
+ * - Terminal status (`done`/`abandoned`): this launch's create attempts guarded cleanup
75
+ * of the plane; if that cleanup reports it was incomplete, inspect with
77
76
  * `plane status` before any manual wind-down.
78
77
  *
79
78
  * Pure and secret-free: the output names only the run id and a closed status.
@@ -83,10 +82,10 @@ export function formatBoundPlaneStaleRemedy(input) {
83
82
  ? `run ${input.epicRunId}`
84
83
  : "its bound run";
85
84
  const status = typeof input.status === "string" && BOUND_RUN_STATUSES.has(input.status) ? input.status : null;
86
- if (status !== null && BOUND_RUN_TERMINAL_STATUSES.has(status)) {
85
+ if (isTerminalRunCleanupStatus(status)) {
87
86
  return (`this plane is bound to ${runLabel}, which is ${status}. Bring the main checkout up to ` +
88
- "`origin/main`; the next local launch's guarded cleanup then winds this plane down " +
89
- "and starts a fresh one. If that cleanup reports it was incomplete, inspect the plane " +
87
+ "`origin/main`; this launch's create attempts guarded cleanup of this plane " +
88
+ "before starting a fresh one. If that cleanup reports it was incomplete, inspect the plane " +
90
89
  "with `plane status` before winding it down by hand. This CLI does not update the " +
91
90
  `checkout. ${PLANE_BOUND_STALE_OVERRIDE_NOTE}`);
92
91
  }
@@ -1,3 +1,4 @@
1
+ import { isTerminalRunCleanupStatus } from "./terminal-run-status.js";
1
2
  /**
2
3
  * Terminal-run plane cleanup (BAPI-1496).
3
4
  *
@@ -133,7 +134,7 @@ export async function cleanupTerminalRunPlane(input, overrides = {}) {
133
134
  // Only the statuses after which nothing more will happen (the set `wait-run`
134
135
  // uses). Every other status, known or not, leaves the plane alone.
135
136
  const status = runState.state.status;
136
- if (status !== "done" && status !== "abandoned") {
137
+ if (!isTerminalRunCleanupStatus(status)) {
137
138
  return { kind: "ineligible", reason: "not-terminal" };
138
139
  }
139
140
  // The executor registry below is this checkout's only. A run launched from a
@@ -299,5 +300,8 @@ function runLabel(epicRunId) {
299
300
  }
300
301
  /** Exported for callers that render a cleanup outcome: the stderr line, or `null` when silent. */
301
302
  export function terminalRunCleanupStderrLine(result) {
303
+ if (result.kind === "completed") {
304
+ return `plane cleanup for finished ${runLabel(result.epicRunId)} completed; the plane manifest was cleared.`;
305
+ }
302
306
  return result.kind === "incomplete" || result.kind === "ownership_aborted" ? result.message : null;
303
307
  }
@@ -0,0 +1,4 @@
1
+ /** Cleanup eligibility, shared by preview and teardown. `stopped` is resumable. */
2
+ export function isTerminalRunCleanupStatus(status) {
3
+ return status === "done" || status === "abandoned";
4
+ }
@@ -37,7 +37,7 @@ export const CONSUMER_GUIDE_POINTER = `${CONSUMER_GUIDE_PATH} (write or refresh
37
37
  * confirmed gate (provider, local, mixed, or none) replaces the old "at least
38
38
  * one --required-check" rule; a provider check is still the common scripted form.
39
39
  */
40
- export const PRINTED_CONDUCTOR_INSTALL_COMMAND = `${LAUNCHER} install conductor --required-check "${EPIC_IMPLEMENTER_CI_CHECK_NAME}"`;
40
+ export const PRINTED_CONDUCTOR_INSTALL_COMMAND = `${LAUNCHER} install epic-implementer --required-check "${EPIC_IMPLEMENTER_CI_CHECK_NAME}"`;
41
41
  /** Conductor bootstrap that also provisions a repository-wide executor service. */
42
42
  export const PRINTED_CONDUCTOR_EXECUTOR_INSTALL_COMMAND = `${PRINTED_CONDUCTOR_INSTALL_COMMAND} --executor-id <id> --repo-wide`;
43
43
  /** Read-only readiness diagnostics. */
@@ -48,7 +48,7 @@ export const PRINTED_CONNECT_GITHUB_COMMAND = `${LAUNCHER} connect-github`;
48
48
  * BAPI-1536 — save or replace the repository's stored test command. The flag is
49
49
  * the consent for that one write; the placeholder is never filled in here.
50
50
  */
51
- export const PRINTED_TEST_COMMAND_INSTALL_COMMAND = `${LAUNCHER} install conductor --test-command "<command>"`;
51
+ export const PRINTED_TEST_COMMAND_INSTALL_COMMAND = `${LAUNCHER} install epic-implementer --test-command "<command>"`;
52
52
  /** Explains the `<command>` placeholder; print it beside the test-command remedy. */
53
53
  export const PRINTED_TEST_COMMAND_INSTRUCTION = "Replace <command> with the one command that runs your tests.";
54
54
  /** Explains the `<check-name>` placeholder; print it beside a conductor command. */
@@ -60,9 +60,9 @@ export const PRINTED_EXECUTOR_ID_INSTRUCTION = "Replace <id> with a name for the
60
60
  * qualification job and drain it with a short-lived repository-wide executor.
61
61
  * The remedy for `local_command_unqualified`.
62
62
  */
63
- export const PRINTED_QUALIFY_GATE_COMMAND = `${LAUNCHER} install-bridge conductor --qualify-gate`;
63
+ export const PRINTED_QUALIFY_GATE_COMMAND = `${LAUNCHER} install epic-implementer --qualify-gate`;
64
64
  /** A persistent repository-wide executor service, which also drains qualification jobs. */
65
- export const PRINTED_REPO_WIDE_EXECUTOR_COMMAND = `${LAUNCHER} install conductor --executor-id <id> --repo-wide`;
65
+ export const PRINTED_REPO_WIDE_EXECUTOR_COMMAND = `${LAUNCHER} install epic-implementer --executor-id <id> --repo-wide`;
66
66
  /** The lifecycle-free executor service-unit generator. */
67
67
  export const PRINTED_EXECUTOR_INSTALL_SERVICE_COMMAND = `${LAUNCHER} executor install-service`;
68
68
  /** Fixed public actions; generated into Python from this source at build time. */
@@ -79,3 +79,23 @@ export const READINESS_PREREQUISITE_FIXES = {
79
79
  github: `Run ${PRINTED_CONNECT_GITHUB_COMMAND}, then retry readiness.`,
80
80
  none: "",
81
81
  };
82
+ /** Structured explanations are descriptive and never grant effect consent. */
83
+ export function assessmentRemedyQuestion(remedy, evidence) {
84
+ const hosted = !['repository_admin', 'local_user', 'bridge_support', 'self_host_operator'].includes(remedy.audience ?? '') || remedy.audience === 'bridge_support' ||
85
+ (remedy.reference === 'self_host' && remedy.audience !== 'self_host_operator');
86
+ const actions = {
87
+ none: 'No action required.', retry: READINESS_PREREQUISITE_FIXES.retry,
88
+ setup: READINESS_PREREQUISITE_FIXES.setup, github: READINESS_PREREQUISITE_FIXES.github,
89
+ index: READINESS_PREREQUISITE_FIXES.no_index, workflow: READINESS_PREREQUISITE_FIXES.missing_workflow,
90
+ escalation: READINESS_PREREQUISITE_FIXES.escalation,
91
+ support: 'Contact Bridge support to investigate service availability.',
92
+ self_host: READINESS_PREREQUISITE_FIXES.self_host,
93
+ local_login: 'Sign in locally, then retry readiness.',
94
+ };
95
+ const action = hosted ? actions.support : actions[remedy.reference] ?? actions.support;
96
+ return { purpose: action, evidence: [...evidence],
97
+ options: [{ id: 'act', label: 'Review and perform the named remedy' }, { id: 'defer', label: 'Keep this prerequisite unresolved' }],
98
+ consequences: ['Performing the remedy may make fresh evidence available. Readiness will be checked again; this report does not authorize an operation or launch.'],
99
+ deferred: 'Independent completed work is retained. The affected prerequisite remains unresolved.',
100
+ recovery: 'Rerun setup or read-only readiness after the remedy. Existing consent checks still apply.' };
101
+ }
@@ -1,80 +1,3 @@
1
- /**
2
- * The canonical shared readiness-check contract (BAPI-1055, AC-6).
3
- *
4
- * Conductor prerequisite probing is spread across five loci — `bridge doctor`
5
- * ({@link file:./install-doctor.ts}), `epic-implementer doctor`
6
- * ({@link file:./conductor/doctor.ts}), `plane` preflight
7
- * ({@link file:./plane/preflight.ts}), the server `conductor-readiness`
8
- * collector, and the unified install doctor
9
- * ({@link file:./conductor/install-doctor.ts}) that already composes four of
10
- * them. Each speaks its own status vocabulary. This module is the ONE record
11
- * shape they are all projected into, so a consolidated report can say
12
- * pass/fail and name exactly one remediation per failure without any locus
13
- * having to abandon its own verdicts.
14
- *
15
- * DEPENDENCY-NEUTRAL LEAF. It imports nothing: no fs, no network, no CLI, no
16
- * sibling diagnostic. That is what makes it safe to import from every surface,
17
- * including ones pinned to issue zero probes.
18
- *
19
- * ## Exhaustive source-status mapping (the accepted four-state vocabulary)
20
- *
21
- * The shared vocabulary has FOUR states, not three, because four is the
22
- * minimum that lets every source verdict round-trip without a lossy merge.
23
- * Collapsing `degraded` onto `fail` would make a fallback npm channel read
24
- * identically to an unusable ledger, which would contradict the rule that each
25
- * section's own advisory semantics stay unchanged.
26
- *
27
- * | Source | Source verdict | Canonical |
28
- * | ----------------------------------- | ----------------------------- | --------- |
29
- * | `install-doctor` `InstallCheckStatus` | `PASS` | `pass` |
30
- * | `install-doctor` `InstallCheckStatus` | `WARN` | `warn` |
31
- * | `install-doctor` `InstallCheckStatus` | `SKIP` | `skip` |
32
- * | `install-doctor` `InstallCheckStatus` | `INFO` | see below |
33
- * | `conductor/install-doctor` section | `ok` | `pass` |
34
- * | `conductor/install-doctor` section | `degraded` | `warn` |
35
- * | `conductor/install-doctor` section | `fatal` | `fail` |
36
- * | `conductor/doctor` inspection | `degraded: true` | `warn` |
37
- * | `plane` diagnostic | `severity: "warning"` | `warn` |
38
- * | `plane` diagnostic | `severity: "blocking"` | `fail` |
39
- * | server readiness | unreadable / `null` / missing | `fail` |
40
- *
41
- * `INFO` never becomes a canonical status. It is informational by definition,
42
- * so its content is preserved in {@link ReadinessCheck.detail} while the check
43
- * takes `pass`, `warn`, or `skip` according to that check's own established
44
- * semantics — chosen per check id by the adapter, never guessed here.
45
- *
46
- * Three states are deliberately NOT interchangeable:
47
- *
48
- * - `fail` means a prerequisite is not satisfied, INCLUDING the case where its
49
- * state could not be established. An unreadable liveness read, a failed
50
- * permission probe, `executor.ready === null`, and a field a newer server
51
- * would have sent are all `fail` with a remediation for restoring the probe.
52
- * Uncertainty must never appear healthy.
53
- * - `warn` means the prerequisite is degraded but usable, or a launch-permitting
54
- * plane warning. It is not a soft failure and is never derived from silence.
55
- * - `skip` means the check genuinely did not apply or a dependency prevented it
56
- * from running. It is never used to hide an unknown.
57
- *
58
- * ## The failure/remediation invariant
59
- *
60
- * AC-6 requires exactly ONE named remediation on every failure, so the union
61
- * below makes that a property of the type: the `fail` variant REQUIRES one
62
- * non-empty scalar remediation and the `pass` variant PROHIBITS one. `warn` and
63
- * `skip` may each carry at most one, because an actionable warning and the
64
- * actionable deny-probe skip both have a named next step, while a
65
- * dependency-driven skip has none.
66
- *
67
- * ## Secret discipline
68
- *
69
- * Every `detail` and `remediation` is fixed prose plus non-secret facts: a
70
- * label, a closed enum, a count, a boolean, a timestamp, a relative identifier,
71
- * or an approved base/setup URL. The helpers here cap length, strip control
72
- * characters, and refuse obvious absolute paths — but they are a last line of
73
- * defence, NOT permission to pass a raw exception, subprocess output, a request
74
- * header, a response body, or a credential into the constructor. Projecting
75
- * source data into safe prose is the adapter's job; this module only refuses
76
- * the most obvious leaks.
77
- */
78
1
  /** Every valid status, for exhaustive validation and test enumeration. */
79
2
  export const READINESS_CHECK_STATUSES = [
80
3
  "pass",
@@ -281,7 +204,7 @@ export function createReadinessCheck(input) {
281
204
  /** Fixed prose for a check that had to be replaced because it was malformed. */
282
205
  export const READINESS_MALFORMED_CHECK_DETAIL = "this prerequisite reported a result that failed the readiness contract, so its real state is unknown";
283
206
  /** Fixed remediation for a replaced malformed check. */
284
- export const READINESS_MALFORMED_CHECK_REMEDIATION = "re-run `epic-implementer readiness`; if it persists, run `epic-implementer doctor` and `install conductor` to re-collect this locus.";
207
+ export const READINESS_MALFORMED_CHECK_REMEDIATION = "re-run `epic-implementer readiness`; if it persists, run `epic-implementer doctor` and `install epic-implementer` to re-collect this locus.";
285
208
  /** Fixed label for a replaced malformed check. */
286
209
  export const READINESS_MALFORMED_CHECK_LABEL = "Unreadable prerequisite";
287
210
  /**
@@ -530,3 +530,202 @@ export const READINESS_LEGACY_IDS = {
530
530
  "worktree_preparation": "conductor.worktree-preparation"
531
531
  };
532
532
  export const READINESS_PREREQUISITE_BY_ID = new Map(READINESS_PREREQUISITE_CATALOG.map(d => [d.id, d]));
533
+ export const READINESS_ASSESSMENT_V1 = {
534
+ "version": 1,
535
+ "applicability": [
536
+ "applicable",
537
+ "policy_inapplicable",
538
+ "unknown"
539
+ ],
540
+ "basis": [
541
+ "required",
542
+ "attended",
543
+ "no_feature_branch",
544
+ "auto_merge_disabled",
545
+ "review_not_required",
546
+ "stored_gate",
547
+ "no_ci_gate",
548
+ "policy_unreadable",
549
+ "context_not_required",
550
+ "legacy_gate"
551
+ ],
552
+ "states": [
553
+ "confirmed",
554
+ "absent",
555
+ "deficient",
556
+ "pending",
557
+ "unreadable",
558
+ "unverified",
559
+ "unknown"
560
+ ],
561
+ "impacts": [
562
+ "mandatory",
563
+ "advisory",
564
+ "optional"
565
+ ],
566
+ "blocking_effects": [
567
+ "none",
568
+ "blocker",
569
+ "unresolved"
570
+ ],
571
+ "scopes": [
572
+ "repository",
573
+ "service",
574
+ "canonical_index",
575
+ "parse_run",
576
+ "indexed_commit",
577
+ "default_branch",
578
+ "local"
579
+ ],
580
+ "reasons": [
581
+ "confirmed",
582
+ "absent",
583
+ "deficient",
584
+ "pending",
585
+ "unreadable",
586
+ "unverified",
587
+ "unknown",
588
+ "revision_unbound",
589
+ "policy_inapplicable"
590
+ ],
591
+ "remedies": [
592
+ "none",
593
+ "retry",
594
+ "setup",
595
+ "github",
596
+ "index",
597
+ "workflow",
598
+ "escalation",
599
+ "support",
600
+ "self_host",
601
+ "local_login"
602
+ ],
603
+ "audiences": [
604
+ "repository_admin",
605
+ "local_user",
606
+ "bridge_support",
607
+ "self_host_operator"
608
+ ],
609
+ "assessment_only_ids": [
610
+ "server.canonical-index",
611
+ "server.parse-progress"
612
+ ],
613
+ "coverage": [
614
+ {
615
+ "id": "server.supervisor-setup",
616
+ "scope": "repository"
617
+ },
618
+ {
619
+ "id": "server.supervisor-config",
620
+ "scope": "repository"
621
+ },
622
+ {
623
+ "id": "server.github-credentials",
624
+ "scope": "repository"
625
+ },
626
+ {
627
+ "id": "server.unattended-posture",
628
+ "scope": "repository"
629
+ },
630
+ {
631
+ "id": "server.database-migration-current",
632
+ "scope": "service"
633
+ },
634
+ {
635
+ "id": "server.worker-present",
636
+ "scope": "service"
637
+ },
638
+ {
639
+ "id": "server.single-transition-authority",
640
+ "scope": "service"
641
+ },
642
+ {
643
+ "id": "server.service-availability",
644
+ "scope": "service"
645
+ },
646
+ {
647
+ "id": "server.unattended-notify-default",
648
+ "scope": "repository"
649
+ },
650
+ {
651
+ "id": "server.test-command",
652
+ "scope": "repository"
653
+ },
654
+ {
655
+ "id": "server.canonical-index",
656
+ "scope": "canonical_index"
657
+ },
658
+ {
659
+ "id": "server.parse-progress",
660
+ "scope": "parse_run"
661
+ },
662
+ {
663
+ "id": "server.review-workflow",
664
+ "scope": "indexed_commit"
665
+ },
666
+ {
667
+ "id": "server.conductor-ci-workflow",
668
+ "scope": "indexed_commit"
669
+ },
670
+ {
671
+ "id": "server.review-workflow",
672
+ "scope": "default_branch"
673
+ },
674
+ {
675
+ "id": "server.conductor-ci-workflow",
676
+ "scope": "default_branch"
677
+ },
678
+ {
679
+ "id": "server.supervisor-required-checks",
680
+ "scope": "repository"
681
+ },
682
+ {
683
+ "id": "server.gate-profile",
684
+ "scope": "repository"
685
+ },
686
+ {
687
+ "id": "server.executor-readiness",
688
+ "scope": "repository"
689
+ }
690
+ ],
691
+ "identifier_max_length": 128,
692
+ "sha_pattern": "^[0-9a-f]{40}$",
693
+ "exemption_bases_by_id": {
694
+ "server.review-workflow": [
695
+ "attended",
696
+ "no_feature_branch",
697
+ "auto_merge_disabled",
698
+ "review_not_required"
699
+ ],
700
+ "server.conductor-ci-workflow": [
701
+ "attended",
702
+ "no_feature_branch",
703
+ "auto_merge_disabled",
704
+ "stored_gate",
705
+ "no_ci_gate"
706
+ ],
707
+ "server.canonical-index": [
708
+ "no_feature_branch"
709
+ ],
710
+ "server.unattended-posture": [
711
+ "attended"
712
+ ],
713
+ "server.unattended-notify-default": [
714
+ "attended"
715
+ ],
716
+ "server.test-command": [
717
+ "attended",
718
+ "no_feature_branch"
719
+ ],
720
+ "server.executor-readiness": [
721
+ "context_not_required"
722
+ ],
723
+ "server.supervisor-required-checks": [
724
+ "stored_gate",
725
+ "no_ci_gate"
726
+ ],
727
+ "server.gate-profile": [
728
+ "legacy_gate"
729
+ ]
730
+ }
731
+ };