@bridge_gpt/mcp-server 0.2.60 → 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 (89) hide show
  1. package/README.md +58 -11
  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 +8 -7
  7. package/build/conductor/bridge-api-client.js +678 -14
  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/merge-execution-contract.js +30 -5
  15. package/build/conductor/merge-execution-eligibility.js +10 -9
  16. package/build/conductor/readiness-sections.js +104 -20
  17. package/build/conductor/readiness.js +129 -25
  18. package/build/conductor/recovery-cli.js +354 -13
  19. package/build/conductor/recovery-operations.js +251 -5
  20. package/build/conductor/repair-contract.js +8 -0
  21. package/build/conductor-bundle-artifacts.js +1 -0
  22. package/build/credential-store.js +194 -0
  23. package/build/docs.generated.js +2 -1
  24. package/build/doctor.js +161 -7
  25. package/build/drive-epic-key.js +12 -0
  26. package/build/drive-epic.js +1318 -111
  27. package/build/epic-coherence-input-cli.js +137 -0
  28. package/build/epic-coherence-input.js +920 -0
  29. package/build/epic-coherence-input.test-fixtures.js +175 -0
  30. package/build/epic-implementer-bin.js +35 -29
  31. package/build/epic-implementer-bundle-cli.js +14 -1
  32. package/build/epic-integration-pr.js +61 -15
  33. package/build/epic-launch-profile.js +464 -0
  34. package/build/epic-run-status.js +5 -0
  35. package/build/epic-shared/bridge-client.js +46 -4
  36. package/build/executor/cli.js +48 -0
  37. package/build/executor/completion-contract.js +423 -0
  38. package/build/executor/completion-supervision.js +286 -0
  39. package/build/executor/credentials.js +19 -1
  40. package/build/executor/deps.js +65 -1
  41. package/build/executor/env.js +6 -0
  42. package/build/executor/heartbeat.js +13 -3
  43. package/build/executor/http-client.js +117 -1
  44. package/build/executor/integration-job.js +759 -0
  45. package/build/executor/job-errors.js +48 -0
  46. package/build/executor/job-runner.js +1386 -35
  47. package/build/executor/job-types.js +10 -2
  48. package/build/executor/observation.js +114 -7
  49. package/build/executor/preflight.js +99 -0
  50. package/build/executor/process-containment.js +756 -0
  51. package/build/executor/process.js +235 -5
  52. package/build/executor/prompt-spec.js +262 -1
  53. package/build/executor/provider-checks.js +69 -0
  54. package/build/executor/rebase-finalization.js +351 -0
  55. package/build/executor/reconcile-overlap-job.js +77 -84
  56. package/build/executor/required-verification.js +313 -0
  57. package/build/executor/required-work-ledger.js +1121 -0
  58. package/build/executor/results.js +142 -0
  59. package/build/executor/resume-pre-spawn.js +87 -4
  60. package/build/executor/runner.js +246 -1
  61. package/build/executor/test-declaration.js +20 -0
  62. package/build/executor/types.js +55 -0
  63. package/build/executor/worker-command.js +49 -13
  64. package/build/executor/worker-finalization.js +88 -11
  65. package/build/executor/worker-guard-hook.js +29 -4
  66. package/build/executor/worktree.js +13 -0
  67. package/build/executor-launch.js +658 -0
  68. package/build/index.js +772 -954
  69. package/build/install-bridge-conductor.js +622 -40
  70. package/build/install-bridge.js +92 -16
  71. package/build/merge-pull-request.js +1 -1
  72. package/build/merge-workflow-config.js +54 -0
  73. package/build/merge-workflow-drift.js +35 -4
  74. package/build/merge-workflow.js +386 -2
  75. package/build/pipelines.generated.js +9 -8
  76. package/build/plan-discovery.js +137 -0
  77. package/build/plan-epic-implementer-eligibility.js +2 -2
  78. package/build/plane/cli.js +37 -3
  79. package/build/plane/member-logs.js +3 -0
  80. package/build/plane/member-roster.js +7 -1
  81. package/build/plane/shutdown.js +59 -1
  82. package/build/plane/supervisor.js +148 -0
  83. package/build/readme.generated.js +1 -1
  84. package/build/scripts/executor-protocol-contract-driver.js +13 -3
  85. package/build/setup-epic.js +130 -48
  86. package/build/version.generated.js +3 -3
  87. package/build/worker-guard-hook-bin.js +2 -2
  88. package/docs/CONDUCTOR.md +116 -2
  89. package/package.json +2 -1
@@ -20,16 +20,19 @@
20
20
  * unchanged until S5.
21
21
  */
22
22
  import { readFileSync, unlinkSync } from "node:fs";
23
+ import { createRequire } from "node:module";
23
24
  import { ConductorValidationError, ConductorEpicTickV1FrozenError, toConductorErrorEnvelope, } from "./errors.js";
24
25
  import { emitConductorEvent, purgeConductorLedger, sendWorkerMessage, checkWorkerMessages, } from "./store.js";
25
26
  import { isDuplicateConstraintError } from "./producer-ledger.js";
26
27
  import { SEMANTIC_EVENT_TYPES } from "./taxonomy.js";
27
28
  import { DRIVER_CONTEXT_MAX_BYTES, POLICY_PATCH_MAX_BYTES } from "./repair-contract.js";
28
- import { installConductorGitHooks, resolveConductorHookBin } from "./git-hooks.js";
29
+ import { CONDUCTOR_BIN_UNRESOLVED_ERROR, installConductorGitHooks, resolveConductorHookBin, } from "./git-hooks.js";
30
+ import { HOOK_RUNTIME_PROBE_ACTION, HOOK_RUNTIME_PROBE_MARKER } from "./hook-runtime-qualification.js";
29
31
  import { runFileScopeGuardCli } from "./file-scope-guard.js";
30
32
  import { runPostCommitHookProducer, runReferenceTransactionHookProducer } from "./git-producer.js";
31
33
  import { buildConductorDoctorReport, formatConductorDoctorReport } from "./doctor.js";
32
34
  import { resolveSupervisorConfig } from "./supervisor-config.js";
35
+ import { VERSION } from "../version.generated.js";
33
36
  // `runSupervisor` is imported LAZILY inside runSuperviseCommand: it transitively
34
37
  // pulls in the SQLite store, and a static import here would force every
35
38
  // epic-implementer CLI invocation (and every test that mocks ./store.js for the
@@ -103,6 +106,12 @@ export function getConductorUsage() {
103
106
  " resume-run --epic-run-id <id> [--clear-quarantine] [--json]",
104
107
  " Resume a paused run (a quarantined one only with --clear-quarantine);",
105
108
  " activation is re-checked server-side. Active/no-control is a no-op.",
109
+ " continue-child --epic-run-id <id> --ticket-key <key> [--reason <text>] [--json]",
110
+ " Continue a parked child's CURRENT episode WITHOUT a reset: same attempt,",
111
+ " retained work, only the allowance left. At most one dispatch per episode.",
112
+ " continuation-receipt --epic-run-id <id> --ticket-key <key> [--request-id <id>] [--json]",
113
+ " Read-only: the child's current episode and whether a continuation",
114
+ " request's receipt proves it committed (use after a lost response).",
106
115
  "",
107
116
  "supervise options:",
108
117
  " --run-id <id> Run/session identifier to supervise (required)",
@@ -241,6 +250,10 @@ export function getConductorUsage() {
241
250
  " epic-implementer unpark --epic-run-id 3f9c2b7e-... --ticket-key BAPI-852",
242
251
  " # A human pushed directly to the PR and the ticket parked on head drift:",
243
252
  " epic-implementer adopt-current-head-and-unpark --epic-run-id 3f9c2b7e-... --ticket-key BAPI-852",
253
+ " # A child stopped mid-attempt and should carry on WITHOUT resetting its budget:",
254
+ " epic-implementer continue-child --epic-run-id 3f9c2b7e-... --ticket-key BAPI-852",
255
+ " # The continue-child response was lost — did it commit?",
256
+ " epic-implementer continuation-receipt --epic-run-id 3f9c2b7e-... --ticket-key BAPI-852",
244
257
  ].join("\n");
245
258
  }
246
259
  /**
@@ -253,6 +266,13 @@ export function getConductorUsage() {
253
266
  * output name is now a fixed migration stub and must never be selected here.
254
267
  */
255
268
  export const CONDUCTOR_HOOK_BIN_ACTION = "__hook-bin";
269
+ /**
270
+ * Private runtime probe (BAPI-1290): the bounded subprocess hook qualification
271
+ * runs as `node <entry> __hook-runtime-probe`. It reports the Node line, the
272
+ * native ABI, and whether `better-sqlite3` loads — never a path, never error
273
+ * text — and it never opens, creates, or migrates a ledger. Absent from usage.
274
+ */
275
+ export { HOOK_RUNTIME_PROBE_ACTION } from "./hook-runtime-qualification.js";
256
276
  const VALID_COMMANDS = new Set([
257
277
  "emit-event",
258
278
  "supervise",
@@ -282,10 +302,16 @@ const VALID_COMMANDS = new Set([
282
302
  "scope-catch-up",
283
303
  "patch-policy",
284
304
  "resume-run",
305
+ // BAPI-1300: CLI-only parked-child continuation pair — never registered as MCP tools.
306
+ "continue-child",
307
+ "continuation-receipt",
285
308
  // Private, and deliberately ABSENT from the usage text: `__hook-bin` exists as
286
309
  // the bundled-artifact regression guard for BAPI-772 (mirroring `plane
287
310
  // __entrypoint`), not as a supported operator workflow.
288
311
  CONDUCTOR_HOOK_BIN_ACTION,
312
+ // Private, like `__hook-bin`: the bounded runtime probe hook qualification
313
+ // spawns (BAPI-1290). Never advertised as an operator workflow.
314
+ HOOK_RUNTIME_PROBE_ACTION,
289
315
  ]);
290
316
  /**
291
317
  * Parse the top-level conductor argv into a subcommand (without a CLI
@@ -694,13 +720,17 @@ export async function runDoctorCommand(argv, deps = {}) {
694
720
  }
695
721
  /**
696
722
  * Run `install-git-hooks`: install/update the local managed `post-commit` and
697
- * `reference-transaction` hooks. Returns 0 even when the directory is not a git
698
- * worktree (degraded optional capability) — never a fatal failure.
723
+ * `reference-transaction` hooks. Returns 0 when the directory is not a git
724
+ * worktree (degraded optional capability) without claiming anything was
725
+ * provisioned.
699
726
  *
700
- * BAPI-772: an unresolvable `conductor-bin.js` IS fatal (exit 1). Writing a hook
701
- * that points at a nonexistent binary produced a hook that silently did nothing
702
- * on every commit, so the installer now refuses and this command reports the
703
- * refusal with the resolver's searched-layout remediation.
727
+ * BAPI-772: an unresolvable hook binary IS fatal (exit 1). BAPI-1290: so is an
728
+ * UNQUALIFIED runtime (an `npx` cache entry, an unsupported layout, a Node or
729
+ * native binding that does not load) — the refusal prints a fixed classification
730
+ * and action, never a probed path — and so is a planning refusal or a two-hook
731
+ * update that did not complete. A partial update prints each hook's outcome; it is
732
+ * never collapsed into success. None of these is an engine-admission failure:
733
+ * the hooks are optional local observability.
704
734
  */
705
735
  export function runInstallGitHooksCommand(argv) {
706
736
  const { bools } = tokenizeFlags(argv, new Set(), DIAGNOSTIC_BOOL_FLAGS);
@@ -711,14 +741,30 @@ export function runInstallGitHooksCommand(argv) {
711
741
  const result = installConductorGitHooks();
712
742
  if (!result.ok) {
713
743
  if (bools.has("--json")) {
714
- console.error(JSON.stringify({ error: result.error, reason: result.reason }));
744
+ console.error(JSON.stringify(result.error === CONDUCTOR_BIN_UNRESOLVED_ERROR
745
+ ? { error: result.error, classification: result.classification, reason: result.reason }
746
+ : {
747
+ error: result.error,
748
+ reason: result.reason,
749
+ refused: result.refused.map((r) => ({ name: r.name, warning: r.warning })),
750
+ }));
715
751
  return 1;
716
752
  }
717
- console.error(`Error: conductor git hooks were NOT installed (${result.error}): ${result.reason}`);
753
+ console.error(result.error === CONDUCTOR_BIN_UNRESOLVED_ERROR
754
+ ? `Error: conductor git hooks were NOT installed (${result.error}, ${result.classification}): ${result.reason}`
755
+ : `Error: conductor git hooks were NOT installed (${result.error}): ${result.reason}`);
756
+ console.error("Existing hooks were left unchanged. Hooks are optional local observability; " +
757
+ "engine admission is unaffected.");
718
758
  return 1;
719
759
  }
760
+ const incomplete = result.is_worktree && !result.complete;
720
761
  if (bools.has("--json")) {
721
- console.log(JSON.stringify(result));
762
+ const payload = JSON.stringify(result);
763
+ if (incomplete) {
764
+ console.error(payload);
765
+ return 1;
766
+ }
767
+ console.log(payload);
722
768
  return 0;
723
769
  }
724
770
  const lines = [
@@ -726,34 +772,101 @@ export function runInstallGitHooksCommand(argv) {
726
772
  "───────────────────────────",
727
773
  `is git worktree: ${result.is_worktree}`,
728
774
  `hooks dir: ${result.hooks_dir ?? "n/a"}`,
729
- `conductor bin: ${result.conductor_bin}`,
775
+ `hook runtime: ${result.conductor_bin}`,
776
+ `runtime evidence: ${result.runtime.package_name}@${result.runtime.package_version}, ` +
777
+ `node ${result.runtime.node_version} (ABI ${result.runtime.node_modules_abi}), ` +
778
+ `${result.runtime.native_module} ${result.runtime.native_module_version ?? "unknown"}, ${result.runtime.platform}`,
730
779
  ];
731
780
  for (const hook of result.installed) {
732
- lines.push(` ${hook.name}: ${hook.action}${hook.warning ? ` (${hook.warning})` : ""}`);
781
+ lines.push(` ${hook.name}: ${hook.outcome} (${hook.action}), usable=${hook.usable}` +
782
+ (hook.warning ? ` — ${hook.warning}` : ""));
783
+ }
784
+ if (result.is_worktree) {
785
+ lines.push(result.complete
786
+ ? "status: complete — both managed hooks are published and usable"
787
+ : result.partial
788
+ ? "status: PARTIAL — re-run `epic-implementer install-git-hooks` to converge"
789
+ : "status: NOT installed — no managed hook was changed");
790
+ }
791
+ else {
792
+ lines.push("status: not provisioned — not a git worktree");
733
793
  }
734
794
  if (result.warnings.length > 0) {
735
795
  lines.push("warnings:");
736
796
  for (const w of result.warnings)
737
797
  lines.push(` - ${w}`);
738
798
  }
799
+ if (incomplete) {
800
+ console.error(lines.join("\n"));
801
+ return 1;
802
+ }
739
803
  console.log(lines.join("\n"));
740
804
  return 0;
741
805
  }
742
806
  /**
743
- * Run the private `__hook-bin` diagnostic: resolve the hook binary from the
744
- * executing artifact and print ONLY that canonical path to stdout, so artifact-
745
- * level automation can consume it directly. A failed resolution prints the
746
- * sanitized resolver reason to stderr and returns 1 — never a stack trace.
807
+ * Run the private `__hook-bin` diagnostic: resolve and QUALIFY the hook entry
808
+ * for the executing artifact and print ONLY the stable launch path to stdout, so
809
+ * artifact-level automation can consume it directly. BAPI-1290: an existing but
810
+ * ephemeral or unqualified entry is NOT printed — the sanitized classification and
811
+ * action go to stderr and the command returns 1, never a stack trace or a path.
747
812
  */
748
813
  export function runHookBinDiagnosticCommand() {
749
814
  const resolution = resolveConductorHookBin();
750
815
  if (!resolution.ok) {
751
- console.error(`conductor hook bin UNRESOLVED: ${resolution.reason}`);
816
+ console.error(`conductor hook bin UNRESOLVED (${resolution.classification}): ${resolution.reason}`);
752
817
  return 1;
753
818
  }
754
819
  console.log(resolution.path);
755
820
  return 0;
756
821
  }
822
+ /**
823
+ * Run the private `__hook-runtime-probe` (BAPI-1290): print ONE JSON line with the
824
+ * Node version, the native ABI, and whether `better-sqlite3` loads for this Node.
825
+ * It reuses the ledger's own read-only native-load classification, so the hook
826
+ * qualification and `epic-implementer doctor` cannot disagree about the binding.
827
+ * It never opens, creates, or migrates the ledger, never writes a file, and never
828
+ * prints a path or error text. Exit 0 whenever it could answer.
829
+ */
830
+ export async function runHookRuntimeProbeCommand() {
831
+ let loads = false;
832
+ let failureKind = "unknown";
833
+ let abi = process.versions.modules ?? "unknown";
834
+ let moduleName = "better-sqlite3";
835
+ try {
836
+ const { inspectConductorLedgerNativeModuleLoad } = await import("./store.js");
837
+ const status = await inspectConductorLedgerNativeModuleLoad();
838
+ loads = status.loads;
839
+ failureKind = status.failure_kind;
840
+ abi = status.node_modules_abi;
841
+ moduleName = status.module;
842
+ }
843
+ catch {
844
+ loads = false;
845
+ failureKind = "unknown";
846
+ }
847
+ let nativeVersion = null;
848
+ if (loads) {
849
+ try {
850
+ const require = createRequire(import.meta.url);
851
+ const pkg = require(`${moduleName}/package.json`);
852
+ nativeVersion = typeof pkg.version === "string" ? pkg.version : null;
853
+ }
854
+ catch {
855
+ nativeVersion = null;
856
+ }
857
+ }
858
+ console.log(JSON.stringify({
859
+ probe: HOOK_RUNTIME_PROBE_MARKER,
860
+ node_version: process.version,
861
+ node_modules_abi: abi,
862
+ native_module: moduleName,
863
+ native_module_version: nativeVersion,
864
+ native_loads: loads,
865
+ failure_kind: failureKind,
866
+ package_version: VERSION,
867
+ }));
868
+ return 0;
869
+ }
757
870
  const GIT_HOOK_VALUE_FLAGS = new Set(["--phase", "--stdin-file"]);
758
871
  const GIT_HOOK_BOOL_FLAGS = new Set(["--help"]);
759
872
  /**
@@ -1265,6 +1378,10 @@ export async function runEpicImplementerCli(argv) {
1265
1378
  // Dispatched before any MCP server construction or store access: the
1266
1379
  // guard must be able to run against a bundle whose ledger is absent.
1267
1380
  return runHookBinDiagnosticCommand();
1381
+ case HOOK_RUNTIME_PROBE_ACTION:
1382
+ // Also dispatched before any MCP construction or store open: it only
1383
+ // imports the native binding, so it can answer on a host with no ledger.
1384
+ return await runHookRuntimeProbeCommand();
1268
1385
  case "file-scope-guard":
1269
1386
  // BAPI-507 (N-2): warn-only worker file-scope guard. Always exits 0.
1270
1387
  return runFileScopeGuardCli();
@@ -1314,6 +1431,14 @@ export async function runEpicImplementerCli(argv) {
1314
1431
  const { runResumeRunCommand } = await import("./recovery-cli.js");
1315
1432
  return await runResumeRunCommand(parsed.argv);
1316
1433
  }
1434
+ case "continue-child": {
1435
+ const { runContinueChildCommand } = await import("./recovery-cli.js");
1436
+ return await runContinueChildCommand(parsed.argv);
1437
+ }
1438
+ case "continuation-receipt": {
1439
+ const { runContinuationReceiptCommand } = await import("./recovery-cli.js");
1440
+ return await runContinuationReceiptCommand(parsed.argv);
1441
+ }
1317
1442
  default:
1318
1443
  console.error('Error: Unknown command. Run "epic-implementer --help" for usage.');
1319
1444
  return 1;