@bridge_gpt/mcp-server 0.2.69 → 0.2.71

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 (164) hide show
  1. package/README.md +140 -292
  2. package/build/agent-launchers/claude-executor-adapter.js +27 -5
  3. package/build/agent-registry.js +5 -5
  4. package/build/agents.generated.js +15 -5
  5. package/build/artifact-diff.js +110 -0
  6. package/build/bin-entrypoint.js +36 -0
  7. package/build/bounded-wait.js +9 -1
  8. package/build/bridge-permissions.js +36 -9
  9. package/build/claude-review-workflow-drift.js +3 -3
  10. package/build/codex-bridge-profile.js +1 -1
  11. package/build/commands.generated.js +6 -6
  12. package/build/conductor/bridge-api-client.js +858 -21
  13. package/build/conductor/bring-up-facts.js +9 -9
  14. package/build/conductor/command-drift-production.js +7 -2
  15. package/build/conductor/doctor.js +472 -18
  16. package/build/conductor/epic-child-continuation.js +54 -3
  17. package/build/conductor/epic-implementer-cli.js +136 -34
  18. package/build/conductor/epic-runtime.js +2 -2
  19. package/build/conductor/epic-state.js +1 -1
  20. package/build/conductor/gate-discovery.js +524 -10
  21. package/build/conductor/gate-settings-review.js +451 -0
  22. package/build/conductor/hook-runtime-qualification.js +1 -1
  23. package/build/conductor/install-doctor.js +4 -2
  24. package/build/conductor/launch-need-probes.js +342 -0
  25. package/build/conductor/launch-plan.js +145 -0
  26. package/build/conductor/local-merge.js +241 -56
  27. package/build/conductor/merge-credential.js +172 -0
  28. package/build/conductor/merge-execution-eligibility.js +1 -1
  29. package/build/conductor/merged-child-check.js +95 -0
  30. package/build/conductor/plan-trim.js +30 -0
  31. package/build/conductor/pr-ci-producer.js +1 -1
  32. package/build/conductor/precheck-timings.js +14 -0
  33. package/build/conductor/preview-observations.js +10 -0
  34. package/build/conductor/readiness-cli.js +11 -6
  35. package/build/conductor/readiness-prerequisites.js +41 -0
  36. package/build/conductor/readiness-sections.js +348 -55
  37. package/build/conductor/readiness.js +99 -87
  38. package/build/conductor/recovery-cli.js +665 -23
  39. package/build/conductor/recovery-operations.js +350 -8
  40. package/build/conductor/repair-contract.js +47 -2
  41. package/build/conductor/repository-workflow-remedy.js +8 -6
  42. package/build/conductor/stored-merge-credential.js +76 -0
  43. package/build/conductor/stored-merge-token-probe.js +28 -0
  44. package/build/conductor/temporary-plan.js +50 -0
  45. package/build/conductor/wait-run-cli.js +759 -0
  46. package/build/conductor/worker-database-doctor-inspector.js +49 -0
  47. package/build/conductor-bin.js +2 -2
  48. package/build/conductor-claude-hook-bin.js +2 -2
  49. package/build/conductor-claude-hook-removed-stub-bin.js +2 -5
  50. package/build/conductor-removed-stub-bin.js +2 -5
  51. package/build/credential-store.js +356 -13
  52. package/build/docs.generated.js +26 -13
  53. package/build/doctor.js +94 -32
  54. package/build/drive-epic-help.js +212 -0
  55. package/build/drive-epic.js +1989 -379
  56. package/build/epic-ci-workflow-drift.js +125 -0
  57. package/build/epic-ci-workflow-install.js +240 -0
  58. package/build/epic-ci-workflow-v1.js +132 -0
  59. package/build/epic-ci-workflow.js +318 -0
  60. package/build/epic-contract-context.js +326 -0
  61. package/build/epic-implementer-bin.js +58 -42
  62. package/build/epic-implementer-claude-hook-bin.js +2 -2
  63. package/build/escalation-reachability.js +134 -0
  64. package/build/executor/ci-rerun-job.js +220 -14
  65. package/build/executor/cleanup-report.js +99 -0
  66. package/build/executor/cli.js +12 -1
  67. package/build/executor/completion-contract.js +66 -11
  68. package/build/executor/completion-supervision.js +99 -0
  69. package/build/executor/delivery-outcome.js +179 -0
  70. package/build/executor/deps.js +3 -0
  71. package/build/executor/env.js +276 -1
  72. package/build/executor/failure-reason-codes.js +126 -0
  73. package/build/executor/gate-qualification-job.js +20 -5
  74. package/build/executor/heartbeat.js +38 -0
  75. package/build/executor/http-client.js +72 -0
  76. package/build/executor/integration-job.js +298 -5
  77. package/build/executor/job-errors.js +36 -6
  78. package/build/executor/job-runner.js +830 -45
  79. package/build/executor/likely-tests.js +42 -3
  80. package/build/executor/merge-job.js +145 -2
  81. package/build/executor/observation.js +73 -4
  82. package/build/executor/permissions.js +193 -97
  83. package/build/executor/preflight.js +19 -3
  84. package/build/executor/process-containment.js +46 -2
  85. package/build/executor/prompt-spec.js +113 -9
  86. package/build/executor/rebase-finalization.js +38 -3
  87. package/build/executor/reconcile-overlap-job.js +41 -8
  88. package/build/executor/required-work-ledger.js +236 -81
  89. package/build/executor/resume-pre-spawn.js +38 -1
  90. package/build/executor/runner.js +91 -3
  91. package/build/executor/test-clock.js +8 -0
  92. package/build/executor/types.js +37 -2
  93. package/build/executor/worker-cli-launcher.js +259 -0
  94. package/build/executor/worker-command.js +177 -5
  95. package/build/executor/worker-database-target.js +91 -0
  96. package/build/executor/worker-database.js +927 -0
  97. package/build/executor/worker-finalization.js +106 -0
  98. package/build/executor/worker-guard-hook.js +203 -0
  99. package/build/executor/worker-resources.js +58 -0
  100. package/build/executor/worker-verification-guidance.js +44 -2
  101. package/build/executor/worktree.js +303 -15
  102. package/build/executor-launch.js +11 -1
  103. package/build/generated-assets-doctor.js +9 -1
  104. package/build/generated-assets-health.js +13 -4
  105. package/build/generated-assets-legacy.js +39 -0
  106. package/build/generated-assets-paths.js +12 -1
  107. package/build/generated-assets-repair.js +4 -1
  108. package/build/generated-assets-test-support.js +12 -0
  109. package/build/github-remote.js +33 -0
  110. package/build/github-sign-in.js +62 -0
  111. package/build/index.js +1133 -546
  112. package/build/init.js +39 -1
  113. package/build/install-bridge-conductor-gate.js +270 -11
  114. package/build/install-bridge-conductor-setup.js +427 -0
  115. package/build/install-bridge-conductor.js +1545 -268
  116. package/build/install-bridge.js +376 -60
  117. package/build/mcp-install-state.js +8 -2
  118. package/build/merge-pull-request.js +6 -0
  119. package/build/merge-workflow-install.js +782 -344
  120. package/build/phase-result-artifacts.js +75 -20
  121. package/build/pipeline-orchestrator.js +247 -4
  122. package/build/pipelines.generated.js +35 -35
  123. package/build/plan-discovery.js +15 -2
  124. package/build/plan-execution-ledger.js +321 -17
  125. package/build/plan-phase-routing.js +48 -13
  126. package/build/plane/cli.js +105 -51
  127. package/build/plane/defaults.js +3 -0
  128. package/build/plane/plane-freshness.js +298 -0
  129. package/build/plane/preflight.js +19 -0
  130. package/build/plane/schema-compatibility.js +137 -0
  131. package/build/plane/shutdown-deps.js +38 -0
  132. package/build/plane/shutdown.js +83 -8
  133. package/build/plane/terminal-run-cleanup.js +303 -0
  134. package/build/printed-remedy-commands.js +33 -4
  135. package/build/readiness-check.js +6 -2
  136. package/build/readiness-prerequisites.generated.js +532 -0
  137. package/build/readme.generated.js +1 -1
  138. package/build/repository-toolchains.js +581 -0
  139. package/build/setup-epic.js +421 -34
  140. package/build/shared-resources.generated.js +5 -0
  141. package/build/start-tickets.js +28 -15
  142. package/build/test-command-detection.js +284 -0
  143. package/build/test-command-validation.js +73 -0
  144. package/build/testing-config-client.js +150 -0
  145. package/build/ticket-delivery-artifacts.js +265 -0
  146. package/build/ticket-delivery-enrollment.js +369 -0
  147. package/build/ticket-delivery.js +205 -0
  148. package/build/ticket-review-summary.js +14 -0
  149. package/build/upgrade-cli.js +13 -0
  150. package/build/v2-readiness-requirements.js +552 -0
  151. package/build/version.generated.js +3 -3
  152. package/build/worker-guard-hook-bin.js +2 -2
  153. package/build/worktree-core.js +22 -7
  154. package/docs/BRIDGE-DIRECTORY-README.md +48 -0
  155. package/docs/EPIC-IMPLEMENTER-INSTALL.md +12 -867
  156. package/docs/EPIC-IMPLEMENTER.md +142 -63
  157. package/docs/epic-implementer/getting-started.md +187 -0
  158. package/docs/epic-implementer/self-hosting.md +133 -0
  159. package/package.json +4 -4
  160. package/pipelines/idea-to-ticket.json +1 -1
  161. package/pipelines/implement-ticket.json +8 -8
  162. package/pipelines/review-ticket.json +2 -2
  163. package/design-assets/favicon/favicon-32x32.png +0 -0
  164. package/design-assets/just-logo-rough-draft.png +0 -0
@@ -27,8 +27,10 @@
27
27
  * rule 3).
28
28
  */
29
29
  import { ExecutorNamedError, FocusedRebaseContext } from "./job-errors.js";
30
+ import { readRequiredVerification } from "./completion-supervision.js";
30
31
  import { allRequiredChecksGreen, anyRequiredCheckFailed, ProviderChecksUnobservable, } from "./provider-checks.js";
31
32
  import { FOCUSED_REBASE_CAPABILITY, FOCUSED_REBASE_CONTEXT_VERSION, } from "./types.js";
33
+ import { deliveryRenewedWithRemoteCiDeferrals } from "./delivery-outcome.js";
32
34
  /** The job type the focused context is valid on. */
33
35
  export const FOCUSED_REBASE_JOB_TYPE = "rebase";
34
36
  /** The payload key the server writes the context under. */
@@ -120,6 +122,12 @@ export function validateFocusedRebaseContext(job) {
120
122
  const required = Array.isArray(job.required_capabilities) ? job.required_capabilities : [];
121
123
  if (!required.includes(FOCUSED_REBASE_CAPABILITY))
122
124
  return fail("capability_not_required");
125
+ if (required.includes("required_verification.ci_deferral.v2")) {
126
+ const declaration = readRequiredVerification(payload);
127
+ if (ctx.verification_policy_version !== 2 || !["renewal", "conflict"].includes(String(ctx.mode)) ||
128
+ declaration.kind !== "ok" || declaration.declaration.policyVersion !== 2)
129
+ return fail("version_unsupported");
130
+ }
123
131
  const prompt = payload.prompt;
124
132
  if (typeof prompt !== "string" || prompt.trim().length === 0)
125
133
  return fail("prompt_missing");
@@ -233,6 +241,11 @@ function boundedRace(work, ms, signal) {
233
241
  * explicitly empty server-derived check set is satisfied vacuously, but only once
234
242
  * every pull-request condition holds.
235
243
  *
244
+ * BAPI-1473: while checks are pending with none failed, `readDelivery` (when
245
+ * given) is consulted; a server decision of `awaiting_post_pr` at exactly the
246
+ * pushed head with only `remote_ci` deferrals also ends `ready` (`ciDeferred`).
247
+ * Missing renewal, mixed dependencies, or an unavailable read stay pending.
248
+ *
236
249
  * Proven failures stop at once: a required check concluded red, the pull request
237
250
  * closed or reads `CONFLICTING`, or its number, head, head branch, or base moved.
238
251
  * Running or missing checks, `UNKNOWN` mergeability, and unavailable reads stay
@@ -297,6 +310,19 @@ export async function waitForFocusedRebase(input) {
297
310
  return { kind: "stopped", reason: "required_check_failed" };
298
311
  if (allRequiredChecksGreen(poll, ctx.requiredChecks))
299
312
  return { kind: "ready", ciVacuous: false };
313
+ // BAPI-1473: checks are pending and none failed. A rebase that renewed its
314
+ // evidence and deferred CI-only steps may end here, once the server confirms
315
+ // it at exactly the pushed head; the server's completion contract re-checks.
316
+ if (input.readDelivery && budget() > 0) {
317
+ const delivery = await boundedRace(input.readDelivery(), Math.min(readMax, budget()), input.signal);
318
+ if (delivery === "aborted")
319
+ return "aborted";
320
+ if (delivery !== "timeout" &&
321
+ !(delivery instanceof ProviderChecksUnobservable) &&
322
+ deliveryRenewedWithRemoteCiDeferrals(delivery, pushed)) {
323
+ return { kind: "ready", ciVacuous: false, ciDeferred: true };
324
+ }
325
+ }
300
326
  return { kind: "pending", reason: "checks_pending" };
301
327
  };
302
328
  const unverifiedReason = () => {
@@ -321,10 +347,19 @@ export async function waitForFocusedRebase(input) {
321
347
  if (reading === "timeout")
322
348
  continue;
323
349
  if (reading.kind === "ready") {
350
+ const checksText = reading.ciDeferred
351
+ ? "required checks pending; renewed evidence with CI deferrals"
352
+ : reading.ciVacuous
353
+ ? "no required checks are configured (vacuous CI)"
354
+ : "every required check is green";
324
355
  input.errorLog(`[executor] Ready: focused rebase evidence current — pushed work at the pull request head is mergeable ` +
325
- `and ${reading.ciVacuous ? "no required checks are configured (vacuous CI)" : "every required check is green"}; ` +
326
- `submitting completion once; ${ids}; elapsed=${secs()}`);
327
- return { kind: "ready", ciVacuous: reading.ciVacuous, elapsedMs: elapsed() };
356
+ `and ${checksText}; submitting completion once; ${ids}; elapsed=${secs()}`);
357
+ return {
358
+ kind: "ready",
359
+ ciVacuous: reading.ciVacuous,
360
+ ...(reading.ciDeferred ? { ciDeferred: true } : {}),
361
+ elapsedMs: elapsed(),
362
+ };
328
363
  }
329
364
  if (reading.kind === "stopped") {
330
365
  input.errorLog(`[executor] Stopped: ${reading.reason} — pushed work preserved, no further repair launched; ${ids}; elapsed=${secs()}`);
@@ -40,6 +40,7 @@ import { guardedFastForwardPush, PUSH_AUTH_FAILURE_RE } from "./guarded-fast-for
40
40
  * refuses the push is reported as `ReconcileOverlapPushUnauthorized`.
41
41
  */
42
42
  import path from "node:path";
43
+ import { readRequiredVerification } from "./completion-supervision.js";
43
44
  import { normalizeRepoRelativePath } from "../conductor/file-scope-guard.js";
44
45
  // BAPI-1311: the read-only poller and predicates moved to `provider-checks.ts` so
45
46
  // the focused rebase wait shares them; re-exported here for existing importers.
@@ -169,16 +170,24 @@ function verificationCommands(value, field) {
169
170
  return { name: name.slice(0, RECONCILE_CHECK_NAME_MAX_CHARS), argv: argv, timeoutSeconds: timeout };
170
171
  });
171
172
  }
172
- function ticketContext(value, field) {
173
+ function ticketContext(value, field, policyVersion = false) {
173
174
  const entry = asRecord(value, field);
174
175
  const ticketKey = typeof entry.ticket_key === "string" ? entry.ticket_key.trim() : "";
175
176
  if (!ticketKey)
176
177
  throw new PayloadError(`${field}.ticket_key is missing or blank`);
178
+ const required = readRequiredVerification(entry);
179
+ if (policyVersion && (required.kind !== "ok" || required.declaration.policyVersion !== 2))
180
+ throw new PayloadError(`${field}.required_verification is invalid`);
181
+ if (!policyVersion && required.kind !== "none")
182
+ throw new PayloadError(`${field}.required_verification requires schema 2`);
183
+ if (policyVersion && entry.required_verification.ticket_key !== ticketKey)
184
+ throw new PayloadError(`${field}.coverage ticket mismatch`);
177
185
  return {
178
186
  ticketKey,
179
187
  changedFiles: pathList(entry.changed_files, `${field}.changed_files`, MAX_CHANGED_FILES),
180
188
  declaredTouchedFiles: pathList(entry.declared_touched_files ?? [], `${field}.declared_touched_files`, MAX_CHANGED_FILES),
181
189
  verificationCommands: verificationCommands(entry.verification_commands, `${field}.verification_commands`),
190
+ ...(required.kind === "ok" ? { requiredVerification: required.declaration } : {}),
182
191
  };
183
192
  }
184
193
  /**
@@ -188,7 +197,7 @@ function ticketContext(value, field) {
188
197
  export function validateReconcileOverlapPayload(job) {
189
198
  try {
190
199
  const payload = asRecord(job.payload, "payload");
191
- if (payload.schema_version !== RECONCILE_OVERLAP_PAYLOAD_SCHEMA_VERSION) {
200
+ if (payload.schema_version !== RECONCILE_OVERLAP_PAYLOAD_SCHEMA_VERSION && payload.schema_version !== 2) {
192
201
  throw new PayloadError(`payload.schema_version must be ${RECONCILE_OVERLAP_PAYLOAD_SCHEMA_VERSION}`);
193
202
  }
194
203
  const childHead = requiredSha(payload.child_head, "payload.child_head");
@@ -207,8 +216,15 @@ export function validateReconcileOverlapPayload(job) {
207
216
  const requiredChecks = requiredChecksRaw
208
217
  .filter((c) => typeof c === "string" && c.trim().length > 0)
209
218
  .map((c) => c.trim());
210
- const child = ticketContext(payload.child, "payload.child");
211
- const peer = payload.peer === null || payload.peer === undefined ? null : ticketContext(payload.peer, "payload.peer");
219
+ const child = ticketContext(payload.child, "payload.child", payload.schema_version === 2);
220
+ const peer = payload.peer === null || payload.peer === undefined ? null : ticketContext(payload.peer, "payload.peer", payload.schema_version === 2);
221
+ verificationCommandUnion(child, peer); // reject conflicting typed metadata before any effects
222
+ if (payload.schema_version === 2) {
223
+ const covering = [...new Set([child, ...(peer ? [peer] : [])].flatMap(s => s.requiredVerification?.obligations?.filter(o => o.classification === "ci_deferred").flatMap(o => o.covering_checks) ?? []))].sort();
224
+ if (!Array.isArray(payload.approved_covering_checks) || JSON.stringify(payload.approved_covering_checks) !== JSON.stringify(covering) || covering.length > 64 ||
225
+ !covering.every(c => requiredChecks.includes(c)) || requiredChecks.length !== requiredChecksRaw.length)
226
+ throw new PayloadError("approved covering check union is inconsistent");
227
+ }
212
228
  // BAPI-1215 — `payload.governance` is retired. A server that predates the
213
229
  // retirement still sends it: it is accepted when present and never read, so
214
230
  // this executor consumes both payload shapes at schema version 1.
@@ -227,7 +243,7 @@ export function validateReconcileOverlapPayload(job) {
227
243
  return {
228
244
  ok: true,
229
245
  value: {
230
- schemaVersion: RECONCILE_OVERLAP_PAYLOAD_SCHEMA_VERSION,
246
+ schemaVersion: payload.schema_version,
231
247
  childHead,
232
248
  requiredEpicSha,
233
249
  epicBranch,
@@ -240,6 +256,9 @@ export function validateReconcileOverlapPayload(job) {
240
256
  conflictReportPath,
241
257
  prompt,
242
258
  reconcileGeneration: generation,
259
+ workerEnvOption: Object.prototype.hasOwnProperty.call(payload, "worker_env")
260
+ ? { workerEnv: payload.worker_env }
261
+ : {},
243
262
  },
244
263
  };
245
264
  }
@@ -277,10 +296,16 @@ const OVERLAP_CONCLUSIONS = {
277
296
  export function verificationCommandUnion(child, peer) {
278
297
  const seen = new Set();
279
298
  const out = [];
280
- for (const command of [...child.verificationCommands, ...(peer?.verificationCommands ?? [])]) {
299
+ const commands = (side) => side.requiredVerification
300
+ ? side.requiredVerification.checks.map(c => ({ name: `${side.ticketKey}:${c.identity}`, originalName: c.name, argv: c.argv, timeoutSeconds: c.timeoutSeconds })) : side.verificationCommands;
301
+ for (const command of [...commands(child), ...(peer ? commands(peer) : [])]) {
281
302
  const key = JSON.stringify(command.argv);
282
- if (seen.has(key))
303
+ if (seen.has(key)) {
304
+ const previous = out.find(c => JSON.stringify(c.argv) === key);
305
+ if ((child.requiredVerification || peer?.requiredVerification) && (previous?.timeoutSeconds !== command.timeoutSeconds || previous?.originalName !== command.originalName))
306
+ throw new PayloadError("conflicting local command metadata");
283
307
  continue;
308
+ }
284
309
  seen.add(key);
285
310
  out.push(command);
286
311
  }
@@ -310,6 +335,12 @@ export function buildReconcileEnvelope(payload, facts, extra = {}) {
310
335
  if (value !== undefined)
311
336
  envelope[key] = value;
312
337
  }
338
+ if (payload.schemaVersion === 2 && payload.child) {
339
+ const sides = [payload.child, ...(payload.peer ? [payload.peer] : [])];
340
+ envelope.verification_policy = { version: 2, declaration_digests: sides.map(s => s.requiredVerification.digest),
341
+ deferred_obligation_identities: sides.flatMap(s => s.requiredVerification.deferredIdentities ?? []),
342
+ tested_head_sha: extra.resulting_head ?? null };
343
+ }
313
344
  return envelope;
314
345
  }
315
346
  // ---------------------------------------------------------------------------
@@ -333,7 +364,9 @@ export function createReconcileOverlapDriver(job, payload, seams) {
333
364
  editedReasons: new Map(),
334
365
  };
335
366
  const commands = verificationCommandUnion(payload.child, payload.peer);
336
- const workerEnv = buildExecutorBaseWorkerEnv(seams.env);
367
+ // BAPI-1521: the root payload's declaration, with presence kept (absent for an
368
+ // older payload, which keeps the compatibility constants).
369
+ const workerEnv = buildExecutorBaseWorkerEnv(seams.env, payload.workerEnvOption);
337
370
  const git = async (ctx, args, timeoutMs = GIT_TIMEOUT_MS, env) => {
338
371
  if (ctx.signal?.aborted)
339
372
  throw new ReconcileOverlapAborted("reconciliation phase aborted");