@bridge_gpt/mcp-server 0.2.62 → 0.2.66

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 (113) hide show
  1. package/README.md +66 -15
  2. package/build/agent-launchers/claude-executor-adapter.js +145 -20
  3. package/build/agent-launchers/executor-adapter.js +81 -2
  4. package/build/agents.generated.js +10 -1
  5. package/build/bounded-wait.js +32 -1
  6. package/build/bridge-config.js +104 -0
  7. package/build/codex-bridge-profile.js +10 -1
  8. package/build/commands.generated.js +7 -6
  9. package/build/conductor/bridge-api-client.js +565 -32
  10. package/build/conductor/bring-up-facts.js +3 -1
  11. package/build/conductor/doctor.js +23 -14
  12. package/build/conductor/epic-child-continuation.js +351 -0
  13. package/build/conductor/epic-implementer-cli.js +154 -17
  14. package/build/conductor/git-hooks.js +529 -118
  15. package/build/conductor/guided-repair.js +323 -0
  16. package/build/conductor/hook-runtime-qualification.js +340 -0
  17. package/build/conductor/readiness-cli.js +30 -9
  18. package/build/conductor/readiness-sections.js +5 -4
  19. package/build/conductor/readiness.js +45 -12
  20. package/build/conductor/recovery-cli.js +859 -27
  21. package/build/conductor/recovery-operations.js +574 -5
  22. package/build/conductor/repair-contract.js +69 -3
  23. package/build/conductor-bundle-artifacts.js +1 -0
  24. package/build/credential-store.js +52 -13
  25. package/build/diagnostic-text.js +36 -0
  26. package/build/docs.generated.js +3 -2
  27. package/build/doctor.js +147 -21
  28. package/build/drive-epic-key.js +12 -0
  29. package/build/drive-epic.js +1537 -125
  30. package/build/epic-coherence-input-cli.js +137 -0
  31. package/build/epic-coherence-input.js +920 -0
  32. package/build/epic-coherence-input.test-fixtures.js +175 -0
  33. package/build/epic-implementer-bin.js +41 -33
  34. package/build/epic-implementer-bundle-cli.js +14 -1
  35. package/build/epic-launch-diagnostic.js +31 -0
  36. package/build/epic-launch-profile.js +58 -19
  37. package/build/epic-run-status.js +5 -0
  38. package/build/epic-shared/bridge-client.js +46 -4
  39. package/build/executor/cli.js +39 -0
  40. package/build/executor/completion-contract.js +423 -0
  41. package/build/executor/completion-supervision.js +291 -0
  42. package/build/executor/correction-dispatch.js +60 -0
  43. package/build/executor/credentials.js +3 -1
  44. package/build/executor/deps.js +65 -1
  45. package/build/executor/env.js +12 -0
  46. package/build/executor/heartbeat.js +13 -3
  47. package/build/executor/http-client.js +91 -4
  48. package/build/executor/integration-job.js +6 -1
  49. package/build/executor/job-errors.js +61 -4
  50. package/build/executor/job-log-registry.js +340 -73
  51. package/build/executor/job-runner.js +1550 -55
  52. package/build/executor/job-types.js +9 -6
  53. package/build/executor/preflight.js +189 -1
  54. package/build/executor/process-containment.js +756 -0
  55. package/build/executor/process.js +235 -5
  56. package/build/executor/prompt-spec.js +366 -1
  57. package/build/executor/provider-checks.js +69 -0
  58. package/build/executor/rebase-finalization.js +351 -0
  59. package/build/executor/reconcile-overlap-job.js +77 -84
  60. package/build/executor/required-verification.js +313 -0
  61. package/build/executor/required-work-ledger.js +1121 -0
  62. package/build/executor/results.js +142 -0
  63. package/build/executor/resume-pre-spawn.js +87 -4
  64. package/build/executor/runner.js +168 -0
  65. package/build/executor/stale-artifacts.js +5 -4
  66. package/build/executor/test-declaration.js +20 -0
  67. package/build/executor/types.js +13 -0
  68. package/build/executor/watch-cli.js +35 -8
  69. package/build/executor/worker-command.js +70 -34
  70. package/build/executor/worker-finalization.js +168 -26
  71. package/build/executor/worker-guard-hook.js +75 -14
  72. package/build/executor/worker-log.js +137 -70
  73. package/build/executor/worktree-gc.js +30 -6
  74. package/build/executor/worktree.js +13 -0
  75. package/build/executor-launch.js +658 -0
  76. package/build/index.js +594 -1152
  77. package/build/init.js +107 -4
  78. package/build/install-bridge-conductor.js +231 -41
  79. package/build/install-bridge.js +284 -20
  80. package/build/install-doctor.js +172 -30
  81. package/build/install-reexec.js +69 -7
  82. package/build/macos-terminal-permission-guidance.js +16 -0
  83. package/build/merge-pull-request.js +1 -1
  84. package/build/model-thresholds-tool.js +185 -0
  85. package/build/pipelines.generated.js +9 -8
  86. package/build/plan-discovery.js +137 -0
  87. package/build/plan-epic-implementer-eligibility.js +2 -2
  88. package/build/plane/cli.js +37 -3
  89. package/build/plane/member-logs.js +3 -0
  90. package/build/plane/member-roster.js +7 -1
  91. package/build/plane/shutdown.js +59 -1
  92. package/build/plane/status.js +4 -0
  93. package/build/plane/supervisor.js +146 -0
  94. package/build/plane/worker-exit-code.js +2 -0
  95. package/build/project-root.js +99 -0
  96. package/build/readme.generated.js +1 -1
  97. package/build/review-tickets.js +156 -13
  98. package/build/scripts/executor-protocol-contract-driver.js +13 -3
  99. package/build/setup-epic.js +208 -125
  100. package/build/sfcc/setup-status.js +2 -0
  101. package/build/sfcc/tool-wrapper.js +2 -0
  102. package/build/sfcc/tools-configured.js +96 -0
  103. package/build/start-tickets.js +163 -58
  104. package/build/upgrade-cli.js +109 -24
  105. package/build/version.generated.js +3 -3
  106. package/build/windows-npm-entry.js +103 -0
  107. package/build/worker-guard-hook-bin.js +5 -4
  108. package/build/worktree-core.js +6 -5
  109. package/docs/CONDUCTOR.md +116 -2
  110. package/docs/install/mcp-tool-integrations.md +1 -0
  111. package/docs/install/sfcc-integration.md +12 -7
  112. package/package.json +2 -1
  113. package/pipelines/implement-ticket.json +1 -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,15 @@ 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).",
115
+ " resume-ci --epic-run-id <id> --ticket-key <key> [--json]",
116
+ " Resume a child parked on a qualified CI stop once CI is green: CI",
117
+ " returns to evaluation with NO new wait, job, or repair allowance.",
106
118
  "",
107
119
  "supervise options:",
108
120
  " --run-id <id> Run/session identifier to supervise (required)",
@@ -241,6 +253,12 @@ export function getConductorUsage() {
241
253
  " epic-implementer unpark --epic-run-id 3f9c2b7e-... --ticket-key BAPI-852",
242
254
  " # A human pushed directly to the PR and the ticket parked on head drift:",
243
255
  " epic-implementer adopt-current-head-and-unpark --epic-run-id 3f9c2b7e-... --ticket-key BAPI-852",
256
+ " # A child stopped mid-attempt and should carry on WITHOUT resetting its budget:",
257
+ " epic-implementer continue-child --epic-run-id 3f9c2b7e-... --ticket-key BAPI-852",
258
+ " # The continue-child response was lost — did it commit?",
259
+ " epic-implementer continuation-receipt --epic-run-id 3f9c2b7e-... --ticket-key BAPI-852",
260
+ " # CI finished green after the child parked on an expired CI wait:",
261
+ " epic-implementer resume-ci --epic-run-id 3f9c2b7e-... --ticket-key BAPI-852",
244
262
  ].join("\n");
245
263
  }
246
264
  /**
@@ -253,6 +271,13 @@ export function getConductorUsage() {
253
271
  * output name is now a fixed migration stub and must never be selected here.
254
272
  */
255
273
  export const CONDUCTOR_HOOK_BIN_ACTION = "__hook-bin";
274
+ /**
275
+ * Private runtime probe (BAPI-1290): the bounded subprocess hook qualification
276
+ * runs as `node <entry> __hook-runtime-probe`. It reports the Node line, the
277
+ * native ABI, and whether `better-sqlite3` loads — never a path, never error
278
+ * text — and it never opens, creates, or migrates a ledger. Absent from usage.
279
+ */
280
+ export { HOOK_RUNTIME_PROBE_ACTION } from "./hook-runtime-qualification.js";
256
281
  const VALID_COMMANDS = new Set([
257
282
  "emit-event",
258
283
  "supervise",
@@ -282,10 +307,18 @@ const VALID_COMMANDS = new Set([
282
307
  "scope-catch-up",
283
308
  "patch-policy",
284
309
  "resume-run",
310
+ // BAPI-1300: CLI-only parked-child continuation pair — never registered as MCP tools.
311
+ "continue-child",
312
+ "continuation-receipt",
313
+ // BAPI-1326: CLI-only allowance-preserving CI resume — never an MCP tool.
314
+ "resume-ci",
285
315
  // Private, and deliberately ABSENT from the usage text: `__hook-bin` exists as
286
316
  // the bundled-artifact regression guard for BAPI-772 (mirroring `plane
287
317
  // __entrypoint`), not as a supported operator workflow.
288
318
  CONDUCTOR_HOOK_BIN_ACTION,
319
+ // Private, like `__hook-bin`: the bounded runtime probe hook qualification
320
+ // spawns (BAPI-1290). Never advertised as an operator workflow.
321
+ HOOK_RUNTIME_PROBE_ACTION,
289
322
  ]);
290
323
  /**
291
324
  * Parse the top-level conductor argv into a subcommand (without a CLI
@@ -694,13 +727,17 @@ export async function runDoctorCommand(argv, deps = {}) {
694
727
  }
695
728
  /**
696
729
  * 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.
730
+ * `reference-transaction` hooks. Returns 0 when the directory is not a git
731
+ * worktree (degraded optional capability) without claiming anything was
732
+ * provisioned.
699
733
  *
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.
734
+ * BAPI-772: an unresolvable hook binary IS fatal (exit 1). BAPI-1290: so is an
735
+ * UNQUALIFIED runtime (an `npx` cache entry, an unsupported layout, a Node or
736
+ * native binding that does not load) — the refusal prints a fixed classification
737
+ * and action, never a probed path — and so is a planning refusal or a two-hook
738
+ * update that did not complete. A partial update prints each hook's outcome; it is
739
+ * never collapsed into success. None of these is an engine-admission failure:
740
+ * the hooks are optional local observability.
704
741
  */
705
742
  export function runInstallGitHooksCommand(argv) {
706
743
  const { bools } = tokenizeFlags(argv, new Set(), DIAGNOSTIC_BOOL_FLAGS);
@@ -711,14 +748,30 @@ export function runInstallGitHooksCommand(argv) {
711
748
  const result = installConductorGitHooks();
712
749
  if (!result.ok) {
713
750
  if (bools.has("--json")) {
714
- console.error(JSON.stringify({ error: result.error, reason: result.reason }));
751
+ console.error(JSON.stringify(result.error === CONDUCTOR_BIN_UNRESOLVED_ERROR
752
+ ? { error: result.error, classification: result.classification, reason: result.reason }
753
+ : {
754
+ error: result.error,
755
+ reason: result.reason,
756
+ refused: result.refused.map((r) => ({ name: r.name, warning: r.warning })),
757
+ }));
715
758
  return 1;
716
759
  }
717
- console.error(`Error: conductor git hooks were NOT installed (${result.error}): ${result.reason}`);
760
+ console.error(result.error === CONDUCTOR_BIN_UNRESOLVED_ERROR
761
+ ? `Error: conductor git hooks were NOT installed (${result.error}, ${result.classification}): ${result.reason}`
762
+ : `Error: conductor git hooks were NOT installed (${result.error}): ${result.reason}`);
763
+ console.error("Existing hooks were left unchanged. Hooks are optional local observability; " +
764
+ "engine admission is unaffected.");
718
765
  return 1;
719
766
  }
767
+ const incomplete = result.is_worktree && !result.complete;
720
768
  if (bools.has("--json")) {
721
- console.log(JSON.stringify(result));
769
+ const payload = JSON.stringify(result);
770
+ if (incomplete) {
771
+ console.error(payload);
772
+ return 1;
773
+ }
774
+ console.log(payload);
722
775
  return 0;
723
776
  }
724
777
  const lines = [
@@ -726,34 +779,101 @@ export function runInstallGitHooksCommand(argv) {
726
779
  "───────────────────────────",
727
780
  `is git worktree: ${result.is_worktree}`,
728
781
  `hooks dir: ${result.hooks_dir ?? "n/a"}`,
729
- `conductor bin: ${result.conductor_bin}`,
782
+ `hook runtime: ${result.conductor_bin}`,
783
+ `runtime evidence: ${result.runtime.package_name}@${result.runtime.package_version}, ` +
784
+ `node ${result.runtime.node_version} (ABI ${result.runtime.node_modules_abi}), ` +
785
+ `${result.runtime.native_module} ${result.runtime.native_module_version ?? "unknown"}, ${result.runtime.platform}`,
730
786
  ];
731
787
  for (const hook of result.installed) {
732
- lines.push(` ${hook.name}: ${hook.action}${hook.warning ? ` (${hook.warning})` : ""}`);
788
+ lines.push(` ${hook.name}: ${hook.outcome} (${hook.action}), usable=${hook.usable}` +
789
+ (hook.warning ? ` — ${hook.warning}` : ""));
790
+ }
791
+ if (result.is_worktree) {
792
+ lines.push(result.complete
793
+ ? "status: complete — both managed hooks are published and usable"
794
+ : result.partial
795
+ ? "status: PARTIAL — re-run `epic-implementer install-git-hooks` to converge"
796
+ : "status: NOT installed — no managed hook was changed");
797
+ }
798
+ else {
799
+ lines.push("status: not provisioned — not a git worktree");
733
800
  }
734
801
  if (result.warnings.length > 0) {
735
802
  lines.push("warnings:");
736
803
  for (const w of result.warnings)
737
804
  lines.push(` - ${w}`);
738
805
  }
806
+ if (incomplete) {
807
+ console.error(lines.join("\n"));
808
+ return 1;
809
+ }
739
810
  console.log(lines.join("\n"));
740
811
  return 0;
741
812
  }
742
813
  /**
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.
814
+ * Run the private `__hook-bin` diagnostic: resolve and QUALIFY the hook entry
815
+ * for the executing artifact and print ONLY the stable launch path to stdout, so
816
+ * artifact-level automation can consume it directly. BAPI-1290: an existing but
817
+ * ephemeral or unqualified entry is NOT printed — the sanitized classification and
818
+ * action go to stderr and the command returns 1, never a stack trace or a path.
747
819
  */
748
820
  export function runHookBinDiagnosticCommand() {
749
821
  const resolution = resolveConductorHookBin();
750
822
  if (!resolution.ok) {
751
- console.error(`conductor hook bin UNRESOLVED: ${resolution.reason}`);
823
+ console.error(`conductor hook bin UNRESOLVED (${resolution.classification}): ${resolution.reason}`);
752
824
  return 1;
753
825
  }
754
826
  console.log(resolution.path);
755
827
  return 0;
756
828
  }
829
+ /**
830
+ * Run the private `__hook-runtime-probe` (BAPI-1290): print ONE JSON line with the
831
+ * Node version, the native ABI, and whether `better-sqlite3` loads for this Node.
832
+ * It reuses the ledger's own read-only native-load classification, so the hook
833
+ * qualification and `epic-implementer doctor` cannot disagree about the binding.
834
+ * It never opens, creates, or migrates the ledger, never writes a file, and never
835
+ * prints a path or error text. Exit 0 whenever it could answer.
836
+ */
837
+ export async function runHookRuntimeProbeCommand() {
838
+ let loads = false;
839
+ let failureKind = "unknown";
840
+ let abi = process.versions.modules ?? "unknown";
841
+ let moduleName = "better-sqlite3";
842
+ try {
843
+ const { inspectConductorLedgerNativeModuleLoad } = await import("./store.js");
844
+ const status = await inspectConductorLedgerNativeModuleLoad();
845
+ loads = status.loads;
846
+ failureKind = status.failure_kind;
847
+ abi = status.node_modules_abi;
848
+ moduleName = status.module;
849
+ }
850
+ catch {
851
+ loads = false;
852
+ failureKind = "unknown";
853
+ }
854
+ let nativeVersion = null;
855
+ if (loads) {
856
+ try {
857
+ const require = createRequire(import.meta.url);
858
+ const pkg = require(`${moduleName}/package.json`);
859
+ nativeVersion = typeof pkg.version === "string" ? pkg.version : null;
860
+ }
861
+ catch {
862
+ nativeVersion = null;
863
+ }
864
+ }
865
+ console.log(JSON.stringify({
866
+ probe: HOOK_RUNTIME_PROBE_MARKER,
867
+ node_version: process.version,
868
+ node_modules_abi: abi,
869
+ native_module: moduleName,
870
+ native_module_version: nativeVersion,
871
+ native_loads: loads,
872
+ failure_kind: failureKind,
873
+ package_version: VERSION,
874
+ }));
875
+ return 0;
876
+ }
757
877
  const GIT_HOOK_VALUE_FLAGS = new Set(["--phase", "--stdin-file"]);
758
878
  const GIT_HOOK_BOOL_FLAGS = new Set(["--help"]);
759
879
  /**
@@ -1265,6 +1385,10 @@ export async function runEpicImplementerCli(argv) {
1265
1385
  // Dispatched before any MCP server construction or store access: the
1266
1386
  // guard must be able to run against a bundle whose ledger is absent.
1267
1387
  return runHookBinDiagnosticCommand();
1388
+ case HOOK_RUNTIME_PROBE_ACTION:
1389
+ // Also dispatched before any MCP construction or store open: it only
1390
+ // imports the native binding, so it can answer on a host with no ledger.
1391
+ return await runHookRuntimeProbeCommand();
1268
1392
  case "file-scope-guard":
1269
1393
  // BAPI-507 (N-2): warn-only worker file-scope guard. Always exits 0.
1270
1394
  return runFileScopeGuardCli();
@@ -1314,6 +1438,19 @@ export async function runEpicImplementerCli(argv) {
1314
1438
  const { runResumeRunCommand } = await import("./recovery-cli.js");
1315
1439
  return await runResumeRunCommand(parsed.argv);
1316
1440
  }
1441
+ case "continue-child": {
1442
+ const { runContinueChildCommand } = await import("./recovery-cli.js");
1443
+ return await runContinueChildCommand(parsed.argv);
1444
+ }
1445
+ case "continuation-receipt": {
1446
+ const { runContinuationReceiptCommand } = await import("./recovery-cli.js");
1447
+ return await runContinuationReceiptCommand(parsed.argv);
1448
+ }
1449
+ case "resume-ci": {
1450
+ // BAPI-1326: delegates only to the pinned CI recovery operation.
1451
+ const { runResumeCiCommand } = await import("./recovery-cli.js");
1452
+ return await runResumeCiCommand(parsed.argv);
1453
+ }
1317
1454
  default:
1318
1455
  console.error('Error: Unknown command. Run "epic-implementer --help" for usage.');
1319
1456
  return 1;