@bridge_gpt/mcp-server 0.2.71 → 0.2.73

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 (198) hide show
  1. package/README.md +55 -17
  2. package/build/agent-launchers/claude-executor-adapter.js +22 -3
  3. package/build/agent-notes.js +171 -95
  4. package/build/agents.generated.js +7 -7
  5. package/build/bridge-permissions.js +31 -0
  6. package/build/bridge-worktree-inspection.js +237 -0
  7. package/build/check-evidence.js +6 -0
  8. package/build/ci-system-detection.js +50 -0
  9. package/build/ci-trigger-adapters.js +631 -0
  10. package/build/ci-trigger-install.js +106 -0
  11. package/build/claude-review-workflow.js +1 -1
  12. package/build/cli-help.js +6 -0
  13. package/build/codex-auto-recovery.js +126 -0
  14. package/build/codex-launcher-pin.js +33 -2
  15. package/build/codex-skill-adapter.js +5 -1
  16. package/build/command-host.js +33 -0
  17. package/build/commands.generated.js +7 -6
  18. package/build/conductor/bridge-api-client.js +1352 -50
  19. package/build/conductor/bring-up-facts.js +18 -5
  20. package/build/conductor/command-drift-production.js +42 -17
  21. package/build/conductor/command-drift.js +47 -0
  22. package/build/conductor/declare-blocked.js +554 -0
  23. package/build/conductor/doctor.js +187 -28
  24. package/build/conductor/driver-commands.js +141 -0
  25. package/build/conductor/driver-guard.js +277 -0
  26. package/build/conductor/driver-lapse.js +321 -0
  27. package/build/conductor/driver-register.js +176 -0
  28. package/build/conductor/driver-release.js +174 -0
  29. package/build/conductor/driver-session-state.js +315 -0
  30. package/build/conductor/epic-branch-ci-inspection.js +222 -29
  31. package/build/conductor/epic-implementer-cli.js +213 -13
  32. package/build/conductor/epic-server-database.js +162 -0
  33. package/build/conductor/epic-server-guidance.js +278 -0
  34. package/build/conductor/epic-server-journal.js +239 -0
  35. package/build/conductor/epic-server-processes.js +324 -0
  36. package/build/conductor/epic-server-recipe.js +397 -0
  37. package/build/conductor/epic-server-runtime.js +1207 -0
  38. package/build/conductor/epic-server-sfcc.js +107 -0
  39. package/build/conductor/epic-server-state.js +427 -0
  40. package/build/conductor/epic-server.js +594 -0
  41. package/build/conductor/gate-discovery.js +281 -10
  42. package/build/conductor/gate-settings-review.js +525 -5
  43. package/build/conductor/git-hooks-uninstall.js +112 -0
  44. package/build/conductor/git-hooks.js +81 -15
  45. package/build/conductor/guided-repair.js +10 -1
  46. package/build/conductor/install-doctor.js +2 -4
  47. package/build/conductor/launch-need-probes.js +6 -53
  48. package/build/conductor/launch-plan.js +318 -121
  49. package/build/conductor/local-merge.js +12 -1
  50. package/build/conductor/merge-execution-contract.js +1 -1
  51. package/build/conductor/merged-child-check.js +2 -1
  52. package/build/conductor/prerequisite-inputs.js +1213 -0
  53. package/build/conductor/readiness-assessment.js +93 -0
  54. package/build/conductor/readiness-cli.js +30 -9
  55. package/build/conductor/readiness-prerequisites.js +77 -5
  56. package/build/conductor/readiness-sections.js +146 -126
  57. package/build/conductor/readiness.js +21 -3
  58. package/build/conductor/recovery-cli.js +236 -15
  59. package/build/conductor/recovery-operations.js +34 -4
  60. package/build/conductor/repair-contract.js +33 -0
  61. package/build/conductor/tools.js +36 -4
  62. package/build/conductor/wait-run-attention.js +115 -0
  63. package/build/conductor/wait-run-cli.js +300 -21
  64. package/build/conductor/worker-database-doctor-inspector.js +34 -2
  65. package/build/conductor/worker-setup-tally.js +27 -0
  66. package/build/credential-store.js +96 -21
  67. package/build/dependency-install-declarations.js +212 -0
  68. package/build/docs.generated.js +4 -4
  69. package/build/doctor.js +91 -8
  70. package/build/drive-epic-help.js +23 -4
  71. package/build/drive-epic.js +1841 -340
  72. package/build/engine-paths.js +20 -0
  73. package/build/epic-branch-ci-summary.js +140 -0
  74. package/build/epic-capability-statement.js +107 -0
  75. package/build/epic-ci-workflow-drift.js +30 -15
  76. package/build/epic-ci-workflow-install.js +110 -42
  77. package/build/epic-ci-workflow-v2.js +274 -0
  78. package/build/epic-ci-workflow.js +38 -12
  79. package/build/epic-implementer-bin.js +2184 -52
  80. package/build/epic-launch-context.js +607 -0
  81. package/build/epic-launch-profile.js +1 -1
  82. package/build/epic-server-record.js +273 -0
  83. package/build/epic-shared/bridge-client.js +11 -3
  84. package/build/escalation-reachability.js +43 -0
  85. package/build/executor/ci-fix-test-runs.js +334 -0
  86. package/build/executor/cli.js +2 -0
  87. package/build/executor/completion-contract.js +24 -1
  88. package/build/executor/credentials.js +1 -1
  89. package/build/executor/delivery-observations.js +113 -0
  90. package/build/executor/delivery-outcome.js +30 -0
  91. package/build/executor/dependency-refresh-runner.js +132 -0
  92. package/build/executor/dependency-refresh.js +530 -0
  93. package/build/executor/deps.js +4 -0
  94. package/build/executor/env.js +119 -17
  95. package/build/executor/epic-server-context.js +141 -0
  96. package/build/executor/gate-qualification-job.js +127 -26
  97. package/build/executor/harness-coverage.js +19 -0
  98. package/build/executor/http-client.js +87 -6
  99. package/build/executor/index.js +2 -1
  100. package/build/executor/install-preflight.js +1 -1
  101. package/build/executor/job-runner.js +659 -87
  102. package/build/executor/likely-tests.js +94 -97
  103. package/build/executor/observation.js +8 -0
  104. package/build/executor/pre-pr-checks.js +363 -0
  105. package/build/executor/prompt-spec.js +127 -5
  106. package/build/executor/reconcile-overlap-job.js +5 -3
  107. package/build/executor/required-verification.js +28 -0
  108. package/build/executor/required-work-diagnostics.js +32 -0
  109. package/build/executor/required-work-ledger.js +955 -39
  110. package/build/executor/results.js +100 -0
  111. package/build/executor/service-discovery.js +42 -0
  112. package/build/executor/service-lifecycle.js +109 -2
  113. package/build/executor/service-uninstall.js +205 -0
  114. package/build/executor/service-unit.js +5 -3
  115. package/build/executor/terminal-mutation.js +8 -0
  116. package/build/executor/test-clock.js +3 -0
  117. package/build/executor/verification-hints.js +179 -0
  118. package/build/executor/worker-command.js +126 -5
  119. package/build/executor/worker-database-config.js +281 -0
  120. package/build/executor/worker-database-target.js +16 -12
  121. package/build/executor/worker-database.js +575 -116
  122. package/build/executor/worker-finalization.js +71 -10
  123. package/build/executor/worker-guard-hook.js +10 -2
  124. package/build/executor/worker-resources.js +25 -3
  125. package/build/executor/worker-verification-guidance.js +55 -5
  126. package/build/executor/worktree-inspection.js +42 -0
  127. package/build/executor/worktree.js +20 -1
  128. package/build/executor-launch.js +54 -2
  129. package/build/generated-assets-catalog.js +2 -2
  130. package/build/github-sign-in.js +1 -1
  131. package/build/index.js +1111 -381
  132. package/build/init.js +29 -14
  133. package/build/install-bridge-conductor-answers.js +465 -0
  134. package/build/install-bridge-conductor-apply.js +259 -0
  135. package/build/install-bridge-conductor-assessment.js +895 -0
  136. package/build/install-bridge-conductor-compact.js +161 -0
  137. package/build/install-bridge-conductor-contracts.js +63 -0
  138. package/build/install-bridge-conductor-gate.js +1383 -188
  139. package/build/install-bridge-conductor-setup.js +637 -92
  140. package/build/install-bridge-conductor.js +3163 -740
  141. package/build/install-bridge.js +601 -128
  142. package/build/install-maintenance.js +127 -0
  143. package/build/install-reexec.js +1 -1
  144. package/build/launcher-config-inspection.js +162 -1
  145. package/build/local-cleanup.js +59 -0
  146. package/build/mcp-grant-candidates.js +767 -0
  147. package/build/mcp-grant-doctor.js +63 -0
  148. package/build/mcp-grant.js +288 -0
  149. package/build/mcp-host-targets.js +8 -0
  150. package/build/mcp-identity.js +23 -0
  151. package/build/mcp-install-state.js +68 -2
  152. package/build/mcp-invoke.js +126 -13
  153. package/build/mcp-presets.js +107 -0
  154. package/build/mcp-provisioning.js +134 -2
  155. package/build/mcp-registration-doctor.js +31 -2
  156. package/build/mcp-server-invocation.js +6 -1
  157. package/build/merge-workflow-install.js +236 -111
  158. package/build/package-script-semantics.js +10 -0
  159. package/build/pipeline-utils.js +1 -1
  160. package/build/pipelines.generated.js +6 -6
  161. package/build/plan-discovery.js +97 -4
  162. package/build/plan-execution-ledger.js +248 -9
  163. package/build/plan-generation-io.js +262 -0
  164. package/build/plan-generation.js +424 -0
  165. package/build/plane/build-freshness.js +6 -1
  166. package/build/plane/cli.js +75 -9
  167. package/build/plane/plane-freshness.js +23 -7
  168. package/build/plane/preflight.js +50 -10
  169. package/build/plane/shutdown.js +19 -0
  170. package/build/plane/terminal-run-cleanup.js +23 -5
  171. package/build/plane/terminal-run-status.js +4 -0
  172. package/build/printed-remedy-commands.js +229 -15
  173. package/build/readiness-check.js +1 -1
  174. package/build/readiness-prerequisites.generated.js +311 -4
  175. package/build/readme.generated.js +1 -1
  176. package/build/repository-state-paths.js +38 -0
  177. package/build/repository-toolchains.js +50 -8
  178. package/build/run-unit-tests-launcher.js +8 -1
  179. package/build/setup-change-policy.js +32 -0
  180. package/build/setup-epic.js +1192 -198
  181. package/build/setup-progress.js +44 -0
  182. package/build/setup-question.js +180 -0
  183. package/build/start-tickets.js +4 -0
  184. package/build/test-command-detection.js +32 -88
  185. package/build/test-support/notes-fs.js +40 -0
  186. package/build/third-party-mcp-targets.js +30 -0
  187. package/build/ticket-delivery-enrollment.js +30 -8
  188. package/build/ticket-delivery-run-scope.js +128 -0
  189. package/build/upgrade-cli.js +85 -2
  190. package/build/v2-readiness-requirements.js +28 -1
  191. package/build/version.generated.js +3 -3
  192. package/build/worker-guard-hook-bin.js +2 -2
  193. package/build/worktrees.js +105 -0
  194. package/docs/EPIC-IMPLEMENTER-INSTALL.md +9 -1
  195. package/docs/EPIC-IMPLEMENTER.md +5 -0
  196. package/docs/epic-implementer/getting-started.md +42 -15
  197. package/docs/epic-implementer/self-hosting.md +14 -1
  198. package/package.json +2 -2
@@ -8,8 +8,8 @@
8
8
  * logged and never included in any error string.
9
9
  */
10
10
  import { RECONCILER_LIVENESS_VALUES } from "./types.js";
11
- import { EXECUTOR_REPORTABLE_END_CAUSE_VALUES, } from "./completion-contract.js";
12
- import { readEpicRunCompletionState, } from "../conductor/bridge-api-client.js";
11
+ import { EXECUTOR_REPORTABLE_END_CAUSE_VALUES, MAX_VERIFICATION_OBSERVATIONS, } from "./completion-contract.js";
12
+ import { EPIC_CAPABILITY_STATEMENT_READ_TIMEOUT_MS, readEpicCapabilityStatement, readEpicRunCompletionState, } from "../conductor/bridge-api-client.js";
13
13
  /** BAPI-1258 — the server's stable `error_code` for refused capacity evidence. */
14
14
  export const UNSUPPORTED_TERMINAL_CAPACITY_ERROR_CODE = "UNSUPPORTED_TERMINAL_CAPACITY";
15
15
  /**
@@ -56,9 +56,11 @@ function readDetailErrorCode(bodyText) {
56
56
  *
57
57
  * Mirrors {@link isCapacityEvidenceRefusal}'s shape, but is exported and NOT
58
58
  * wired into `mapMutationResponse`: the mutation mapping stays unchanged (a 409
59
- * still maps to `stale_claim` for every caller that does not ask), and the job
60
- * runner — which holds the envelope — decides to re-report as `/fail`. A 409
61
- * `STALE_CLAIM` is never a refusal: the claim is gone and a re-send cannot help.
59
+ * still maps to `stale_claim` for every other response). BAPI-1590: `complete()`
60
+ * alone asks, and marks the result `completionEvidenceRefused` so the job runner —
61
+ * which holds the envelope — can re-report once as `/fail` (the runner-owned
62
+ * `/fail` decision). A 409 `STALE_CLAIM` is never a refusal: the claim is gone and a
63
+ * re-send cannot help.
62
64
  */
63
65
  export function isCompletionEvidenceRefusal(status, bodyText) {
64
66
  if (status !== 409)
@@ -128,6 +130,33 @@ export function envelopeForClaim(job, envelope) {
128
130
  const { end_cause: _omitted, ...rest } = envelope;
129
131
  return rest;
130
132
  }
133
+ /**
134
+ * BAPI-1563 — normalize a claim's `delivery_observations_capability`. Only the
135
+ * exact `{protocol_version: 1}` is admitted; absent, null, or anything else (an
136
+ * older server, a future protocol) reads as no capability.
137
+ */
138
+ export function normalizeDeliveryObservationsCapability(value) {
139
+ if (value === null || typeof value !== "object" || Array.isArray(value))
140
+ return null;
141
+ return value.protocol_version === 1 ? { protocol_version: 1 } : null;
142
+ }
143
+ /**
144
+ * BAPI-1563 — the observation fields of a terminal report, present ONLY when the
145
+ * claim advertised the capability. Without it both are omitted, so an older
146
+ * server's strict schema never sees an unknown key. This governs serialization
147
+ * and nothing else: no permission or success decision is derived from it, and a
148
+ * rejection is never parsed or resent.
149
+ */
150
+ function deliveryObservationFields(job, report) {
151
+ if (normalizeDeliveryObservationsCapability(job.delivery_observations_capability) === null)
152
+ return {};
153
+ return {
154
+ ...(report.observed_pr !== undefined ? { observed_pr: report.observed_pr } : {}),
155
+ ...(report.verification_observations !== undefined && report.verification_observations.length > 0
156
+ ? { verification_observations: report.verification_observations.slice(0, MAX_VERIFICATION_OBSERVATIONS) }
157
+ : {}),
158
+ };
159
+ }
131
160
  /** Bound a server-provided diagnostic snippet included in error strings. */
132
161
  function boundedDetail(text) {
133
162
  const trimmed = (text ?? "").trim();
@@ -295,6 +324,24 @@ export function createExecutorHttpClient(config) {
295
324
  // stay assignable) purely for the claim path's liveness annotation.
296
325
  return { status: res.status, text, headers: res.headers };
297
326
  }
327
+ /**
328
+ * BAPI-1590: `/complete` only. The exact 409 completion-evidence refusal is
329
+ * returned marked (carrier outcome `invalid_job_result`: terminal and never
330
+ * retried) instead of being read as a lost claim; every other response maps as
331
+ * before. Nothing from the response is retained.
332
+ */
333
+ async function completeMutation(pathSuffix, body, repoName) {
334
+ try {
335
+ const { status, text } = await post(pathSuffix, body, repoName);
336
+ if (isCompletionEvidenceRefusal(status, text)) {
337
+ return { outcome: "invalid_job_result", completionEvidenceRefused: true };
338
+ }
339
+ return mapMutationResponse(status, text, true);
340
+ }
341
+ catch {
342
+ return { outcome: "fatal_http_error" };
343
+ }
344
+ }
298
345
  async function mutate(pathSuffix, body, allowInvalidResult, repoName) {
299
346
  try {
300
347
  const { status, text } = await post(pathSuffix, body, repoName);
@@ -347,6 +394,11 @@ export function createExecutorHttpClient(config) {
347
394
  // BAPI-1421 (F4): only recognized executor-reportable end causes are
348
395
  // kept; an older server's absent key becomes an empty list.
349
396
  job.end_cause_capability = normalizeEndCauseCapability(job.end_cause_capability);
397
+ // BAPI-1563: the observation capability is normalized in place only when
398
+ // the server sent the key, so an older server's claim keeps its shape.
399
+ if ("delivery_observations_capability" in job) {
400
+ job.delivery_observations_capability = normalizeDeliveryObservationsCapability(job.delivery_observations_capability);
401
+ }
350
402
  job.prior_attempt_head_sha = normalizePriorAttemptHeadSha(job.prior_attempt_head_sha, () => (config.warn ?? ((message) => console.error(message)))(`executor: ignoring malformed prior attempt head in the claim for job ${String(job.id)}; ` +
351
403
  `treating it as a first dispatch.`));
352
404
  return { kind: "claimed", job, reconcilerLiveness };
@@ -504,8 +556,9 @@ export function createExecutorHttpClient(config) {
504
556
  last_commit_sha: completion.last_commit_sha,
505
557
  telemetry: completion.telemetry,
506
558
  ...completionContractFields(job, completion),
559
+ ...deliveryObservationFields(job, completion),
507
560
  };
508
- return mutate(`/${job.id}/complete`, body, true, job.repo_name);
561
+ return completeMutation(`/${job.id}/complete`, body, job.repo_name);
509
562
  },
510
563
  async fail(job, failure) {
511
564
  const body = {
@@ -521,6 +574,7 @@ export function createExecutorHttpClient(config) {
521
574
  last_commit_sha: failure.last_commit_sha,
522
575
  telemetry: failure.telemetry,
523
576
  ...completionContractFields(job, failure),
577
+ ...deliveryObservationFields(job, failure),
524
578
  };
525
579
  if (failure.capacity_evidence === undefined) {
526
580
  return mutate(`/${job.id}/fail`, body, false, job.repo_name);
@@ -566,5 +620,32 @@ export function createExecutorHttpClient(config) {
566
620
  return { ok: false, reason: "network" };
567
621
  }
568
622
  },
623
+ /**
624
+ * BAPI-1545: the advisory capability statement, read once per
625
+ * implement-worker spawn. The adapted transport ignores the abort signal, so
626
+ * the short advisory timeout is enforced here with a race. Never throws;
627
+ * every failure is a reason the runner turns into "append nothing".
628
+ */
629
+ async readEpicCapabilityStatement(repoName) {
630
+ const access = {
631
+ repoName,
632
+ apiKey: keyForRepo(repoName),
633
+ baseUrl: config.baseUrl,
634
+ };
635
+ let timer;
636
+ const timeout = new Promise((resolve) => {
637
+ timer = setTimeout(() => resolve({ ok: false, reason: "timeout" }), EPIC_CAPABILITY_STATEMENT_READ_TIMEOUT_MS);
638
+ });
639
+ try {
640
+ return await Promise.race([
641
+ readEpicCapabilityStatement(access, toConductorGetFetch(config.fetch)).catch(() => ({ ok: false, reason: "network" })),
642
+ timeout,
643
+ ]);
644
+ }
645
+ finally {
646
+ if (timer !== undefined)
647
+ clearTimeout(timer);
648
+ }
649
+ },
569
650
  };
570
651
  }
@@ -17,7 +17,7 @@ export { runExecutor } from "./runner.js";
17
17
  // imports the generator still cannot start a persistent daemon.
18
18
  export { runExecutorInstallServiceCli, getExecutorInstallServiceUsage, buildExecutorServiceArtifact, writeExecutorServiceArtifact, inspectExecutorServiceArtifact, executorLaunchdDirForHome, executorSystemdDirForHome, executorIdFromLaunchdFilename, executorIdFromSystemdFilename,
19
19
  // Programmatic, lifecycle-free plan/write seam (BAPI-779) — how
20
- // `install conductor` reaches the generator without shelling out to the CLI.
20
+ // `install epic-implementer` reaches the generator without shelling out to the CLI.
21
21
  planExecutorServiceInstall, writeExecutorServicePlan, resolvePackagedExecutorInvocation,
22
22
  // Durable-host credential declaration contract (BAPI-1137, R-4). doctor needs
23
23
  // the shared inspector and the postcondition helper so its diagnostic and the
@@ -25,6 +25,7 @@ planExecutorServiceInstall, writeExecutorServicePlan, resolvePackagedExecutorInv
25
25
  // and the argument-contract predicate keeps the contract locally auditable
26
26
  // rather than discoverable only by reading the renderer.
27
27
  inspectExecutorServiceCredentialDeclaration, assertExecutorServiceCredentialPostcondition, checkExecutorServiceArgumentContract, isAllowedExecutorServiceUnitEnvKey, executorLaunchdLogPathsForId, EXECUTOR_SERVICE_BASE_URL_ENV, EXECUTOR_SERVICE_PATH_ENV, EXECUTOR_SERVICE_UNIT_ENV_ALLOWLIST, EXECUTOR_SERVICE_UNIT_FILE_MODE, } from "./service-unit.js";
28
+ export { discoverExecutorServiceUnits } from "./service-discovery.js";
28
29
  // Consented lifecycle (BAPI-779, R-1). Deliberately a SEPARATE module from the
29
30
  // generator above: importing the writer never grants the ability to start a
30
31
  // persistent daemon.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Executor installation preflight for `install conductor` (BAPI-779).
2
+ * Executor installation preflight for `install epic-implementer` (BAPI-779).
3
3
  *
4
4
  * This is the gate that runs BEFORE the installer writes a service unit or
5
5
  * starts anything: it answers "can this host actually run a conductor executor?"