@bridge_gpt/mcp-server 0.2.76 → 0.2.77

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 (58) hide show
  1. package/README.md +8 -6
  2. package/build/agents.generated.js +3 -3
  3. package/build/cli-dispatch.js +333 -0
  4. package/build/commands.generated.js +5 -5
  5. package/build/conductor/bridge-api-client.js +52 -7
  6. package/build/conductor/declare-blocked.js +142 -7
  7. package/build/conductor/driver-register.js +8 -2
  8. package/build/conductor/epic-implementer-cli.js +11 -7
  9. package/build/conductor/epic-server-journal.js +39 -22
  10. package/build/conductor/launch-plan.js +28 -7
  11. package/build/conductor/local-merge.js +1 -1
  12. package/build/conductor/readiness-prerequisites.js +89 -2
  13. package/build/conductor/recovery-cli.js +2 -0
  14. package/build/docs.generated.js +67 -4
  15. package/build/doctor.js +97 -1
  16. package/build/drive-epic.js +223 -6
  17. package/build/engine-paths.js +10 -0
  18. package/build/epic-coherence-input-cli.js +105 -10
  19. package/build/epic-coherence-input.js +877 -4
  20. package/build/epic-coherence-input.test-fixtures.js +117 -0
  21. package/build/epic-implementer-bin.js +901 -94
  22. package/build/epic-implementer-env.js +2 -2
  23. package/build/executor/completion-contract.js +14 -1
  24. package/build/executor/guarded-fast-forward-push.js +25 -2
  25. package/build/executor/job-runner.js +83 -27
  26. package/build/executor/likely-tests.js +78 -6
  27. package/build/executor/provider-checks.js +73 -0
  28. package/build/executor/rebase-finalization.js +29 -27
  29. package/build/executor/rename-aside.js +265 -0
  30. package/build/executor/required-work-ledger.js +82 -4
  31. package/build/executor/types.js +121 -0
  32. package/build/executor/worktree.js +27 -1
  33. package/build/index.js +2449 -386
  34. package/build/install-bridge-conductor-assessment.js +13 -0
  35. package/build/install-bridge-conductor.js +60 -776
  36. package/build/install-bridge.js +4 -11
  37. package/build/language-catalog.generated.js +2649 -0
  38. package/build/pipelines.generated.js +45 -17
  39. package/build/plan-execution-ledger.js +8 -0
  40. package/build/plan-generation.js +34 -0
  41. package/build/plane/build-freshness.js +6 -0
  42. package/build/plane/cli.js +12 -5
  43. package/build/printed-remedy-commands.js +9 -0
  44. package/build/readiness-prerequisites.generated.js +28 -0
  45. package/build/readme.generated.js +1 -1
  46. package/build/run-unit-tests-launcher.js +3 -1
  47. package/build/server.js +7946 -0
  48. package/build/start-tickets-prereqs.js +3 -6
  49. package/build/test-support/console-guard.js +30 -0
  50. package/build/test-support/module-imports.js +155 -0
  51. package/build/test-support/server-client.js +96 -0
  52. package/build/test-support/stdio-server.js +146 -0
  53. package/build/v2-readiness-requirements.js +31 -2
  54. package/build/version.generated.js +3 -3
  55. package/docs/EPIC-IMPLEMENTER.md +71 -2
  56. package/docs/epic-implementer/getting-started.md +4 -0
  57. package/package.json +3 -3
  58. package/pipelines/learn-repository.json +19 -1
@@ -923,6 +923,14 @@ export function validatePhaseResult(result, metadata, phase, accepted) {
923
923
  if (!result || typeof result !== "object") {
924
924
  throw new PlanLedgerError("phase result is missing");
925
925
  }
926
+ // BAPI-1769: name the right key when a caller copied the on-disk artifact's
927
+ // `artifact_version` into the envelope. It is never accepted as an alias.
928
+ if (result.version === undefined &&
929
+ Object.prototype.hasOwnProperty.call(result, "artifact_version")) {
930
+ throw new PlanLedgerError("phase result envelope has 'artifact_version' but no 'version'; the envelope key is " +
931
+ `'version' (expected ${PLAN_METADATA_VERSION}). 'artifact_version' belongs to the ` +
932
+ "on-disk phase-result artifact.");
933
+ }
926
934
  if (result.version !== PLAN_METADATA_VERSION) {
927
935
  throw new PlanLedgerError(`unsupported phase result version ${String(result.version)}; expected ${PLAN_METADATA_VERSION}`);
928
936
  }
@@ -25,6 +25,12 @@
25
25
  * planned child runs one at a time, in the selected order, and no node carries
26
26
  * `touched_files` (an omitted field is the server's opt-out; `[]` would claim
27
27
  * "touches nothing", which is not known).
28
+ *
29
+ * BAPI-1782: key-order generation stays available, so a preview can still show
30
+ * the fallback plan as evidence. But a generated plan that runs more than one
31
+ * planned child in key order cannot pass launch admission
32
+ * ({@link needsPlanOrder}): ticket-key order can start a child before the work it
33
+ * needs, and a live run's plan cannot be changed.
28
34
  */
29
35
  import { EPIC_KEY_PATTERN } from "./drive-epic-key.js";
30
36
  /** The generation policy's version. Bump it when any rule here changes. */
@@ -78,6 +84,34 @@ export const RECOGNIZED_STATUS_CATEGORIES = ["new", "indeterminate", "done"];
78
84
  /** Ticket keys in stored text. */
79
85
  const TICKET_KEY_IN_TEXT = /\b[A-Z][A-Z0-9_]{0,19}-[0-9]+\b/g;
80
86
  // ---------------------------------------------------------------------------
87
+ // Launch admission (BAPI-1782)
88
+ // ---------------------------------------------------------------------------
89
+ /** The refusal reason id for a generated plan whose order cannot be trusted. */
90
+ export const PLAN_ORDER_NEEDED_REASON_ID = "plan_order_needed";
91
+ /** The remedy every `plan_order_needed` refusal carries. Names each way out. */
92
+ export const PLAN_ORDER_NEEDED_REMEDY = "Add a `## Ordered child manifest` section to the epic, one line per child: " +
93
+ "`{KEY} depends_on: {KEY, KEY}` or `{KEY} depends_on: none`; or pass `--plan-file` with a plan " +
94
+ "whose dependencies come from the tickets. `/drive-epic-run` writes that plan for you. " +
95
+ "Nothing was created or started.";
96
+ /**
97
+ * The one launch-admission rule for a GENERATED plan, shared by the preview and
98
+ * every real-create path so the two can never disagree.
99
+ *
100
+ * True when more than one node is `planned` and the order did not come from the
101
+ * epic's manifest: the summary says `key_order`, or the summary is null. Callers
102
+ * apply it ONLY to generated plans. A null summary here means a found generated
103
+ * plan whose stored provenance failed the fixed-vocabulary check, so its order
104
+ * cannot be shown to come from a manifest; it is not a judgement on authored
105
+ * plans. `serialized_reason` is deliberately ignored: `unknown_touched_files`
106
+ * can accompany a key-order fallback.
107
+ */
108
+ export function needsPlanOrder(nodes, summary) {
109
+ const planned = nodes.filter((node) => node.status === "planned").length;
110
+ if (planned <= 1)
111
+ return false;
112
+ return summary === null || summary.order_source === "key_order";
113
+ }
114
+ // ---------------------------------------------------------------------------
81
115
  // Key ordering
82
116
  // ---------------------------------------------------------------------------
83
117
  /**
@@ -13,6 +13,7 @@
13
13
  * can be older than a rebuild that overwrote files in place.
14
14
  */
15
15
  import path from "path";
16
+ import { isEngineTestFile } from "../engine-paths.js";
16
17
  import { planeCheckFinding, planeCheckPassed, planeCheckSkipped } from "./types.js";
17
18
  /** Remediation text embedded in every blocking build diagnostic. */
18
19
  export const PLANE_BUILD_REMEDIATION = "cd mcp_server && npm run build";
@@ -22,6 +23,9 @@ export const PLANE_BUILD_REMEDIATION = "cd mcp_server && npm run build";
22
23
  * `*.generated.ts` files are written by the bundle scripts during the SAME
23
24
  * `npm run build` that produces `build/index.js`, so they are always newer than
24
25
  * a tsc run that preceded them and would stale every build immediately.
26
+ *
27
+ * BAPI-1782 — `*.test.ts` files (the shared {@link isEngineTestFile} rule) are
28
+ * not executor runtime code, so a newer test alone never stales the build.
25
29
  */
26
30
  const EXCLUDED_DIR_NAMES = new Set(["node_modules", "build"]);
27
31
  function isRelevantSourceFile(name) {
@@ -29,6 +33,8 @@ function isRelevantSourceFile(name) {
29
33
  return false;
30
34
  if (name.endsWith(".generated.ts"))
31
35
  return false;
36
+ if (isEngineTestFile(name))
37
+ return false;
32
38
  return true;
33
39
  }
34
40
  /** BAPI-1595 — fixed detail for the executor-build check skipped outside a Bridge checkout. */
@@ -763,12 +763,19 @@ export function formatPlaneLaunchFailure(launch) {
763
763
  return lines;
764
764
  }
765
765
  /** Claim the manifest, print the banner, then run the detached supervisor. */
766
- async function launchPlane(preflight, executors, planeId, sinks, env, launchOptions = {}) {
766
+ export async function launchPlane(preflight, executors, planeId, sinks, env, launchOptions = {}) {
767
767
  const fs = createPlaneFsDeps();
768
768
  const clock = createPlaneClock();
769
769
  const snapshotDeps = createCodeSnapshotDeps();
770
770
  let context = preflight.context;
771
771
  const nodeExecutable = resolveNodeExecutable();
772
+ const steps = {
773
+ prepareCodeSnapshot,
774
+ checkAlembicHead,
775
+ checkSchemaCompatibility,
776
+ claimPlaneManifest,
777
+ ...launchOptions.steps,
778
+ };
772
779
  // BAPI-1362 — pin the code the Python members will run BEFORE anything is
773
780
  // claimed or spawned. Preflight has already passed (checkout prerequisites and
774
781
  // the existing-plane ownership check both run there, read-only), so this is the
@@ -776,7 +783,7 @@ async function launchPlane(preflight, executors, planeId, sinks, env, launchOpti
776
783
  // exactly as it found it apart from a snapshot directory a later bring-up
777
784
  // reuses. A caller that already carries a snapshot (a test seam) is trusted.
778
785
  if (context.snapshot === undefined) {
779
- const prepared = await prepareCodeSnapshot(context.repoRoot, snapshotDeps);
786
+ const prepared = await steps.prepareCodeSnapshot(context.repoRoot, snapshotDeps);
780
787
  if (!prepared.ok) {
781
788
  return {
782
789
  ok: false,
@@ -788,7 +795,7 @@ async function launchPlane(preflight, executors, planeId, sinks, env, launchOpti
788
795
  // `alembic.ini` and migrations and the operator's virtualenv. Preflight ran
789
796
  // the same check against the checkout; the two agree at launch, and only
790
797
  // this one survives the checkout moving later.
791
- const alembic = await checkAlembicHead(context.repoRoot, {
798
+ const alembic = await steps.checkAlembicHead(context.repoRoot, {
792
799
  execFile: createPlaneExecFile(),
793
800
  fileExists: async (filePath) => planeFileExistsSync(filePath),
794
801
  platform: process.platform,
@@ -803,7 +810,7 @@ async function launchPlane(preflight, executors, planeId, sinks, env, launchOpti
803
810
  // interpreter the Python members will use. Still before any claim or spawn:
804
811
  // only a proven-missing object refuses; anything unverifiable warns.
805
812
  sinks.stdout("Verifying local launch-critical schema…");
806
- const schema = await checkSchemaCompatibility(resolvePythonExecutable(env, operatorVenvLookup(context.repoRoot)), prepared.snapshot.path, { execFile: createPlaneExecFile() });
813
+ const schema = await steps.checkSchemaCompatibility(resolvePythonExecutable(env, operatorVenvLookup(context.repoRoot)), prepared.snapshot.path, { execFile: createPlaneExecFile() });
807
814
  if (schema.diagnostic?.severity === "blocking") {
808
815
  return { ok: false, error: schema.diagnostic.message, startup: null };
809
816
  }
@@ -830,7 +837,7 @@ async function launchPlane(preflight, executors, planeId, sinks, env, launchOpti
830
837
  ...(launchOptions.claimScope ? { claimScope: launchOptions.claimScope } : {}),
831
838
  });
832
839
  const timestamp = clock.now().toISOString();
833
- const claim = await claimPlaneManifest({
840
+ const claim = await steps.claimPlaneManifest({
834
841
  manifest: {
835
842
  schemaVersion: PLANE_MANIFEST_SCHEMA_VERSION,
836
843
  planeId,
@@ -112,6 +112,11 @@ export const READINESS_PREREQUISITE_FIXES = {
112
112
  profile_policy: "Declare notify.webhook_url in a run policy, then save a profile that uses it with --launch-profile <name> --policy-file <path>.",
113
113
  asset_refresh: "Refresh the committed command and agent files, review the changes, then commit them or mark them as customized.",
114
114
  reindex_manual: "Re-index the repository (/parse-repository).",
115
+ // BAPI-1747 — run-path remedies. Client-resolved by ID; the wire sends the empty fix.
116
+ run_tools_visible: `Run ${PRINTED_CONDUCTOR_INSTALL_COMMAND} and accept the tool-visibility fix so MCP sessions load the epic_implementer tools, then restart the session and retry readiness.`,
117
+ ci_check_config: "Run the resolve_ci_checks MCP tool for this repository so the run can poll CI, then retry readiness.",
118
+ epic_branch_triggers: "Add epic/** to the pull_request branches of each named check's workflow, merge that change, then retry readiness.",
119
+ worker_environment: `Run ${PRINTED_CONDUCTOR_INSTALL_COMMAND} and declare the worker database and worker environment variables for the test gate, then retry readiness.`,
115
120
  none: "",
116
121
  };
117
122
  /**
@@ -229,6 +234,9 @@ export const READINESS_PREREQUISITE_FIXES_BY_ID = {
229
234
  'server.single-transition-authority': 'self_host',
230
235
  'server.indexed-workflows': 'reindex_manual',
231
236
  'server.integration-branch-unset': 'install_setup',
237
+ 'server.ci-poll-readable': 'ci_check_config',
238
+ 'server.epic-branch-check-triggers': 'epic_branch_triggers',
239
+ 'server.worker-environment': 'worker_environment',
232
240
  'server.service-availability': 'support',
233
241
  'install.claude-login': 'local_login',
234
242
  'install.identity': 'install_guided',
@@ -238,6 +246,7 @@ export const READINESS_PREREQUISITE_FIXES_BY_ID = {
238
246
  'install.integrations': 'install_guided',
239
247
  'install.github': 'github',
240
248
  'install.indexing': 'reindex_manual',
249
+ 'install.run-tools-visible': 'run_tools_visible',
241
250
  'conductor.ledger': 'install_setup',
242
251
  'conductor.git-hooks': 'install_setup',
243
252
  'conductor.mcp-profile': 'install_setup',
@@ -24,6 +24,9 @@ export const READINESS_PREREQUISITE_FIXES_BY_ID = {
24
24
  "server.single-transition-authority": "self_host",
25
25
  "server.indexed-workflows": "reindex_manual",
26
26
  "server.integration-branch-unset": "install_setup",
27
+ "server.ci-poll-readable": "ci_check_config",
28
+ "server.epic-branch-check-triggers": "epic_branch_triggers",
29
+ "server.worker-environment": "worker_environment",
27
30
  "server.service-availability": "support",
28
31
  "install.claude-login": "local_login",
29
32
  "install.identity": "install_guided",
@@ -33,6 +36,7 @@ export const READINESS_PREREQUISITE_FIXES_BY_ID = {
33
36
  "install.integrations": "install_guided",
34
37
  "install.github": "github",
35
38
  "install.indexing": "reindex_manual",
39
+ "install.run-tools-visible": "run_tools_visible",
36
40
  "conductor.ledger": "install_setup",
37
41
  "conductor.git-hooks": "install_setup",
38
42
  "conductor.mcp-profile": "install_setup",
@@ -245,6 +249,24 @@ export const READINESS_PREREQUISITE_CATALOG = [
245
249
  "impact": "warning",
246
250
  "scope": "customer"
247
251
  },
252
+ {
253
+ "id": "server.ci-poll-readable",
254
+ "label": "CI status readable by the run",
255
+ "impact": "warning",
256
+ "scope": "customer"
257
+ },
258
+ {
259
+ "id": "server.epic-branch-check-triggers",
260
+ "label": "Watched checks run on epic branches",
261
+ "impact": "warning",
262
+ "scope": "customer"
263
+ },
264
+ {
265
+ "id": "server.worker-environment",
266
+ "label": "Worker environment declarations",
267
+ "impact": "warning",
268
+ "scope": "customer"
269
+ },
248
270
  {
249
271
  "id": "server.service-availability",
250
272
  "label": "Service availability",
@@ -299,6 +321,12 @@ export const READINESS_PREREQUISITE_CATALOG = [
299
321
  "impact": "warning",
300
322
  "scope": "customer"
301
323
  },
324
+ {
325
+ "id": "install.run-tools-visible",
326
+ "label": "Run tools visible in MCP sessions",
327
+ "impact": "warning",
328
+ "scope": "customer"
329
+ },
302
330
  {
303
331
  "id": "conductor.ledger",
304
332
  "label": "Conductor event ledger",