@bridge_gpt/mcp-server 0.2.62 → 0.2.65

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 (80) hide show
  1. package/README.md +47 -8
  2. package/build/agent-launchers/claude-executor-adapter.js +134 -3
  3. package/build/agent-launchers/executor-adapter.js +54 -2
  4. package/build/agents.generated.js +10 -1
  5. package/build/bounded-wait.js +32 -1
  6. package/build/commands.generated.js +6 -5
  7. package/build/conductor/bridge-api-client.js +335 -22
  8. package/build/conductor/bring-up-facts.js +3 -1
  9. package/build/conductor/doctor.js +23 -14
  10. package/build/conductor/epic-child-continuation.js +324 -0
  11. package/build/conductor/epic-implementer-cli.js +142 -17
  12. package/build/conductor/git-hooks.js +529 -118
  13. package/build/conductor/hook-runtime-qualification.js +340 -0
  14. package/build/conductor/readiness-sections.js +5 -4
  15. package/build/conductor/readiness.js +22 -11
  16. package/build/conductor/recovery-cli.js +354 -13
  17. package/build/conductor/recovery-operations.js +251 -5
  18. package/build/conductor/repair-contract.js +8 -0
  19. package/build/conductor-bundle-artifacts.js +1 -0
  20. package/build/credential-store.js +50 -12
  21. package/build/docs.generated.js +2 -1
  22. package/build/doctor.js +77 -11
  23. package/build/drive-epic-key.js +12 -0
  24. package/build/drive-epic.js +1211 -116
  25. package/build/epic-coherence-input-cli.js +137 -0
  26. package/build/epic-coherence-input.js +920 -0
  27. package/build/epic-coherence-input.test-fixtures.js +175 -0
  28. package/build/epic-implementer-bin.js +35 -29
  29. package/build/epic-implementer-bundle-cli.js +14 -1
  30. package/build/epic-launch-profile.js +14 -5
  31. package/build/epic-run-status.js +5 -0
  32. package/build/epic-shared/bridge-client.js +46 -4
  33. package/build/executor/cli.js +39 -0
  34. package/build/executor/completion-contract.js +423 -0
  35. package/build/executor/completion-supervision.js +286 -0
  36. package/build/executor/credentials.js +3 -1
  37. package/build/executor/deps.js +65 -1
  38. package/build/executor/env.js +6 -0
  39. package/build/executor/heartbeat.js +13 -3
  40. package/build/executor/http-client.js +76 -4
  41. package/build/executor/job-errors.js +48 -0
  42. package/build/executor/job-runner.js +1294 -26
  43. package/build/executor/job-types.js +10 -2
  44. package/build/executor/preflight.js +99 -0
  45. package/build/executor/process-containment.js +756 -0
  46. package/build/executor/process.js +235 -5
  47. package/build/executor/prompt-spec.js +262 -1
  48. package/build/executor/provider-checks.js +69 -0
  49. package/build/executor/rebase-finalization.js +351 -0
  50. package/build/executor/reconcile-overlap-job.js +77 -84
  51. package/build/executor/required-verification.js +313 -0
  52. package/build/executor/required-work-ledger.js +1121 -0
  53. package/build/executor/results.js +142 -0
  54. package/build/executor/resume-pre-spawn.js +87 -4
  55. package/build/executor/runner.js +145 -0
  56. package/build/executor/test-declaration.js +20 -0
  57. package/build/executor/types.js +12 -0
  58. package/build/executor/worker-command.js +49 -13
  59. package/build/executor/worker-finalization.js +88 -11
  60. package/build/executor/worker-guard-hook.js +29 -4
  61. package/build/executor/worktree.js +13 -0
  62. package/build/executor-launch.js +658 -0
  63. package/build/index.js +537 -943
  64. package/build/install-bridge-conductor.js +231 -41
  65. package/build/merge-pull-request.js +1 -1
  66. package/build/pipelines.generated.js +8 -7
  67. package/build/plan-discovery.js +137 -0
  68. package/build/plan-epic-implementer-eligibility.js +2 -2
  69. package/build/plane/cli.js +37 -3
  70. package/build/plane/member-logs.js +3 -0
  71. package/build/plane/member-roster.js +7 -1
  72. package/build/plane/shutdown.js +59 -1
  73. package/build/plane/supervisor.js +142 -0
  74. package/build/readme.generated.js +1 -1
  75. package/build/scripts/executor-protocol-contract-driver.js +13 -3
  76. package/build/setup-epic.js +28 -17
  77. package/build/version.generated.js +3 -3
  78. package/build/worker-guard-hook-bin.js +2 -2
  79. package/docs/CONDUCTOR.md +116 -2
  80. package/package.json +2 -1
@@ -4,8 +4,10 @@
4
4
  * Single source of truth for which claimed job types the executor spawns and
5
5
  * which of those are RECOVERY jobs. Recovery jobs (`remediate`/`ci_fix`/`rebase`/
6
6
  * `reconcile_overlap`) resume the ticket's existing branch/PR rather than cutting
7
- * a fresh branch off base — the first three through the `/implement-ticket <KEY>
8
- * --auto` correction loop, `reconcile_overlap` through its own job body. Dispatch
7
+ * a fresh branch off base — `remediate`/`rebase` through the `/implement-ticket
8
+ * <KEY> --auto` correction loop, `ci_fix` through its focused prompt spec
9
+ * (BAPI-1296: never the full recipe), `reconcile_overlap` through its own job
10
+ * body. Dispatch
9
11
  * (`job-runner.ts` `runClaimedJob`), prompt synthesis (`worker-command.ts`
10
12
  * `resolveExecutorPrompt`), and worktree reuse (`job-runner.ts` `prepareSpawn` →
11
13
  * `worktree.ts` `ensureExecutorWorktree`) all read from here so the recovery /
@@ -22,6 +24,12 @@
22
24
  * `reconcile_overlap`). They work on the ticket's EXISTING branch/PR, so the
23
25
  * executor reuses that branch instead of cutting a fresh one off base.
24
26
  *
27
+ * BAPI-1296: `ci_fix` stays a recovery job — and an implementation-style job
28
+ * below — for branch reuse, the worktree lock, and finalization, but prompt
29
+ * selection no longer follows recovery membership for it: `worker-command.ts`
30
+ * refuses to synthesize `/implement-ticket` for `ci_fix`, and `job-runner.ts`
31
+ * renders its server-authored focused prompt spec instead.
32
+ *
25
33
  * BAPI-1152: `reconcile_overlap` is a recovery job for worktree reuse and prompt
26
34
  * resolution, but it does NOT re-enter `/implement-ticket`: it always carries an
27
35
  * explicit server-rendered `payload.prompt`, which wins over the synthesis in
@@ -1,8 +1,11 @@
1
1
  import { DEFAULT_PROBE_TIMEOUT_MS } from "../agent-capabilities/types.js";
2
2
  import { inspectExecutorAgentAdapter, inspectionForFailedResolution, } from "../agent-launchers/executor-adapter-inspection.js";
3
3
  import { resolveExecutorAgentAdapter } from "../agent-launchers/executor-adapter-registry.js";
4
+ import { resolveCompletionEvidenceCapability } from "../agent-launchers/executor-adapter.js";
5
+ import { COMPLETION_EVIDENCE_CAPABILITY, REQUIRED_VERIFICATION_CAPABILITY, runtimeMatchesSupported, } from "./completion-contract.js";
4
6
  import { resolveExecutorAgentId } from "./agent-identity.js";
5
7
  import { resolveAllExecutorApiAccess, resolveBaseUrl, EXECUTOR_BASE_URL_REQUIRED_MESSAGE, } from "./credentials.js";
8
+ import { FOCUSED_REBASE_CAPABILITY } from "./types.js";
6
9
  /**
7
10
  * Environment override for the deny probe's headless timeout (BAPI-722).
8
11
  *
@@ -80,6 +83,63 @@ export function createDenyProbeCache() {
80
83
  },
81
84
  };
82
85
  }
86
+ /** Bound on a completion-evidence refusal reason (it is logged every cycle). */
87
+ const COMPLETION_REFUSAL_MAX_CHARS = 200;
88
+ /**
89
+ * BAPI-1301 (D4a) — decide whether this executor may advertise
90
+ * `completion_evidence.v1`.
91
+ *
92
+ * Probes the installed runtime through the adapter's declared probe and compares
93
+ * it with BOTH the adapter's declared identity and the approved identity the
94
+ * executor's lifecycle parser was measured against. Every mismatched field is
95
+ * named in the bounded reason; values are safe by construction (a parsed version
96
+ * or the `unrecognized` placeholder, closed platform ids, fixed schema names).
97
+ * Never throws and never produces a fatal finding.
98
+ */
99
+ export async function evaluateCompletionEvidenceQualification(adapter, deps) {
100
+ const bounded = (text) => text.slice(0, COMPLETION_REFUSAL_MAX_CHARS);
101
+ const capability = resolveCompletionEvidenceCapability(adapter);
102
+ if (!capability.supported) {
103
+ return { qualified: false, refusal: bounded(capability.reason), runtime: null };
104
+ }
105
+ let probed;
106
+ try {
107
+ probed = await capability.value.probeRuntime({
108
+ runCommand: deps.runCommand,
109
+ platform: deps.platform,
110
+ // Absent → the adapter's default (`process.arch`); injectable for tests.
111
+ ...(deps.arch !== undefined ? { arch: deps.arch } : {}),
112
+ });
113
+ }
114
+ catch {
115
+ probed = null;
116
+ }
117
+ if (probed === null) {
118
+ return { qualified: false, refusal: "runtime identity probe did not run", runtime: null };
119
+ }
120
+ const declared = capability.value.runtime;
121
+ const mismatches = [];
122
+ for (const key of ["adapter", "cli_version", "platform", "event_schema"]) {
123
+ if (probed[key] !== declared[key]) {
124
+ mismatches.push(`${key} ${String(probed[key]).slice(0, 40)} != ${declared[key]}`);
125
+ }
126
+ }
127
+ if (mismatches.length > 0) {
128
+ return {
129
+ qualified: false,
130
+ refusal: bounded(`probed runtime differs from the approved identity: ${mismatches.join("; ")}`),
131
+ runtime: probed,
132
+ };
133
+ }
134
+ if (!runtimeMatchesSupported(probed)) {
135
+ return {
136
+ qualified: false,
137
+ refusal: "adapter-declared runtime is not the approved completion-evidence runtime",
138
+ runtime: probed,
139
+ };
140
+ }
141
+ return { qualified: true, refusal: null, runtime: probed };
142
+ }
83
143
  /** Fail-fast report shape for a preflight that refused before probing. */
84
144
  function refusedPreflight(fatalFindings, warnings, adapter) {
85
145
  return {
@@ -346,6 +406,16 @@ export async function collectExecutorPreflight(options, deps, seams = {}) {
346
406
  }
347
407
  }
348
408
  warnings.push(...adapterInspection.inspection.warnings);
409
+ // --- Completion-evidence qualification (never fatal, BAPI-1301) --------
410
+ // Last, and outside `fatalFindings` on purpose: an executor that cannot
411
+ // supervise required work to completion is still a correct executor for every
412
+ // other job. It simply omits `completion_evidence.v1` from its claim manifest,
413
+ // and the server's claim filter keeps covered work away from it. One bounded
414
+ // line says why, so an operator expecting covered work can see the cause.
415
+ const completion = await evaluateCompletionEvidenceQualification(adapter, deps);
416
+ if (!completion.qualified && completion.refusal !== null) {
417
+ warnings.push(`completion evidence not advertised: ${completion.refusal}`);
418
+ }
349
419
  return {
350
420
  ok: fatalFindings.length === 0,
351
421
  fatalFindings,
@@ -356,6 +426,9 @@ export async function collectExecutorPreflight(options, deps, seams = {}) {
356
426
  ghAuthed,
357
427
  denyEnforced,
358
428
  adapter: adapterInspection.inspection,
429
+ completionEvidenceQualified: completion.qualified,
430
+ completionEvidenceRefusal: completion.refusal,
431
+ completionRuntime: completion.runtime,
359
432
  };
360
433
  }
361
434
  /**
@@ -379,6 +452,15 @@ export async function collectExecutorPreflight(options, deps, seams = {}) {
379
452
  * `undefined`-valued. For the same reason `repo_wide` is never serialized as
380
453
  * `false`: `false` is the server's default and means "not an opt-out", so
381
454
  * sending it would add a key that carries no information.
455
+ *
456
+ * BAPI-1301 (D4a) adds a third optional key, `capabilities`, under the same
457
+ * rule: `["completion_evidence.v1"]` only when preflight qualified the runtime.
458
+ *
459
+ * BAPI-1311 makes `capabilities` ADDITIVE: `focused_rebase.v1` is advertised by
460
+ * every executor this function builds a manifest for — a manifest is only built
461
+ * once ordinary preflight permits claiming — independently of completion-evidence
462
+ * qualification. The completion tokens keep their exact conditional behavior and
463
+ * order; the focused token is appended after them.
382
464
  */
383
465
  export function buildClaimManifest(report, options, freeSlots) {
384
466
  return {
@@ -392,5 +474,22 @@ export function buildClaimManifest(report, options, freeSlots) {
392
474
  disk_free_gb: report.diskFreeGb ?? 0,
393
475
  ...(options.epicRunIds !== undefined ? { epic_run_ids: options.epicRunIds } : {}),
394
476
  ...(options.repoWide === true ? { repo_wide: true } : {}),
477
+ // BAPI-1301 (D4a): advertised ONLY when preflight qualified the exact
478
+ // runtime; otherwise the key is absent (never `[]`), keeping the manifest's
479
+ // `Object.keys()` shape for every unqualified executor and older server.
480
+ // BAPI-1302 (D4c): a qualified executor also runs declared checks itself
481
+ // (`required-verification.ts`), so it advertises that it can claim a job
482
+ // carrying a required-verification declaration. An older server drops the
483
+ // unknown token (`normalize_declared_capabilities`), so it is safe to send.
484
+ // BAPI-1311: the focused-rebase token rides every claiming manifest, after
485
+ // any completion tokens. It is NOT a completion-evidence statement — rebase is
486
+ // not a covered job type — so it never waits on that qualification. An older
487
+ // server drops the unknown token (`normalize_declared_capabilities`).
488
+ capabilities: [
489
+ ...(report.completionEvidenceQualified === true
490
+ ? [COMPLETION_EVIDENCE_CAPABILITY, REQUIRED_VERIFICATION_CAPABILITY]
491
+ : []),
492
+ FOCUSED_REBASE_CAPABILITY,
493
+ ],
395
494
  };
396
495
  }