@bridge_gpt/mcp-server 0.2.67 → 0.2.68

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 (114) hide show
  1. package/README.md +178 -15
  2. package/build/agent-launchers/claude-executor-adapter.js +27 -0
  3. package/build/agents.generated.js +22 -2
  4. package/build/bitbucket-workspace-remote.js +136 -0
  5. package/build/bootstrap-project-identity.js +24 -0
  6. package/build/bridge-permissions.js +829 -0
  7. package/build/claude-settings.js +18 -0
  8. package/build/cli-help.js +21 -0
  9. package/build/command-assets-doctor.js +24 -70
  10. package/build/command-provisioning.js +29 -5
  11. package/build/commands.generated.js +8 -8
  12. package/build/conductor/bridge-api-client.js +714 -0
  13. package/build/conductor/command-drift-production.js +92 -0
  14. package/build/conductor/command-drift.js +89 -0
  15. package/build/conductor/doctor.js +69 -26
  16. package/build/conductor/epic-branch-ci-inspection.js +1375 -0
  17. package/build/conductor/epic-implementer-cli.js +76 -22
  18. package/build/conductor/gate-discovery.js +890 -0
  19. package/build/conductor/install-doctor.js +15 -3
  20. package/build/conductor/json-output.js +63 -0
  21. package/build/conductor/readiness-cli.js +95 -10
  22. package/build/conductor/readiness-sections.js +369 -3
  23. package/build/conductor/readiness.js +211 -8
  24. package/build/conductor/recovery-cli.js +110 -4
  25. package/build/conductor/recovery-operations.js +99 -1
  26. package/build/connect-bitbucket-api.js +41 -6
  27. package/build/connect-bitbucket.js +106 -33
  28. package/build/credential-store.js +207 -47
  29. package/build/docs.generated.js +57 -3
  30. package/build/doctor.js +92 -1
  31. package/build/drive-epic.js +45 -8
  32. package/build/epic-coherence-input.test-fixtures.js +4 -3
  33. package/build/epic-implementer-bin.js +1374 -25
  34. package/build/epic-workarounds-path.js +39 -0
  35. package/build/executor/cli.js +30 -0
  36. package/build/executor/completion-contract.js +18 -5
  37. package/build/executor/deps.js +4 -1
  38. package/build/executor/gate-qualification-job.js +499 -0
  39. package/build/executor/guarded-fast-forward-push.js +129 -0
  40. package/build/executor/integration-job.js +122 -8
  41. package/build/executor/job-errors.js +8 -1
  42. package/build/executor/job-runner.js +589 -47
  43. package/build/executor/likely-tests.js +290 -0
  44. package/build/executor/live-worker-registry.js +1 -1
  45. package/build/executor/observation.js +31 -2
  46. package/build/executor/packaged-recipe.js +106 -0
  47. package/build/executor/permissions.js +115 -28
  48. package/build/executor/platform.js +1 -1
  49. package/build/executor/preflight.js +61 -12
  50. package/build/executor/process-containment.js +36 -12
  51. package/build/executor/process.js +15 -7
  52. package/build/executor/prompt-spec.js +33 -1
  53. package/build/executor/recently-failed-tests-file.js +71 -0
  54. package/build/executor/reconcile-overlap-job.js +41 -23
  55. package/build/executor/required-verification.js +1 -1
  56. package/build/executor/required-work-ledger.js +105 -17
  57. package/build/executor/retirement.js +69 -0
  58. package/build/executor/runner.js +114 -11
  59. package/build/executor/test-clock.js +15 -0
  60. package/build/executor/types.js +32 -0
  61. package/build/executor/viewer-tabs.js +58 -8
  62. package/build/executor/worker-command.js +23 -7
  63. package/build/executor/worker-diagnostics.js +37 -0
  64. package/build/executor/worker-finalization.js +31 -5
  65. package/build/executor/worker-guard-hook.js +179 -25
  66. package/build/executor/worker-log.js +4 -3
  67. package/build/executor/worker-verification-guidance.js +37 -0
  68. package/build/executor/worktree.js +88 -11
  69. package/build/first-build-advisory.js +97 -0
  70. package/build/generated-assets-advisory.js +14 -0
  71. package/build/generated-assets-catalog.js +66 -0
  72. package/build/generated-assets-context.js +46 -0
  73. package/build/generated-assets-dependencies.js +26 -0
  74. package/build/generated-assets-doctor.js +50 -0
  75. package/build/generated-assets-health.js +65 -0
  76. package/build/generated-assets-host.js +17 -0
  77. package/build/generated-assets-inventory.js +17 -0
  78. package/build/generated-assets-paths.js +60 -0
  79. package/build/generated-assets-publisher.js +133 -0
  80. package/build/generated-assets-remedy.js +25 -0
  81. package/build/generated-assets-repair.js +72 -0
  82. package/build/generated-assets-session.js +71 -0
  83. package/build/generated-assets-test-support.js +35 -0
  84. package/build/index.js +964 -768
  85. package/build/init.js +54 -177
  86. package/build/install-bridge-conductor-gate.js +1372 -0
  87. package/build/install-bridge-conductor.js +289 -36
  88. package/build/install-bridge.js +544 -37
  89. package/build/mcp-install-state.js +50 -4
  90. package/build/merge-workflow-install.js +3 -4
  91. package/build/pipeline-utils.js +6 -2
  92. package/build/pipelines.generated.js +22 -142
  93. package/build/plan-execution-ledger.js +2 -32
  94. package/build/plane/manifest.js +16 -1
  95. package/build/plane/preflight.js +54 -1
  96. package/build/printed-remedy-commands.js +16 -1
  97. package/build/readme.generated.js +1 -1
  98. package/build/repair-assets.js +93 -0
  99. package/build/run-unit-tests-launcher.js +130 -49
  100. package/build/secret-redaction.js +33 -0
  101. package/build/setup-epic.js +108 -3
  102. package/build/start-tickets-prereqs.js +70 -16
  103. package/build/start-tickets.js +29 -5
  104. package/build/tool-surface-gating.js +36 -0
  105. package/build/upgrade-cli.js +55 -1
  106. package/build/version.generated.js +3 -3
  107. package/build/worker-guard-hook-bin.js +3 -2
  108. package/build/worker-guard-hook-main.js +1 -1
  109. package/build/worktree-core.js +15 -2
  110. package/docs/EPIC-IMPLEMENTER-INSTALL.md +30 -12
  111. package/docs/EPIC-IMPLEMENTER.md +68 -2
  112. package/package.json +3 -3
  113. package/pipelines/greenfield-setup.json +4 -128
  114. package/pipelines/implement-ticket.json +3 -2
@@ -16,6 +16,7 @@
16
16
  * All filesystem access is through injected dependencies so the module is fully
17
17
  * unit-testable with in-memory fakes.
18
18
  */
19
+ import { validPackagedAssetInventory } from "./generated-assets-context.js";
19
20
  import { executorIdFromLaunchdFilename, executorIdFromSystemdFilename, } from "./executor/service-unit.js";
20
21
  import { HOST_PLATFORM_ORDER, isHostPlatformId, } from "./mcp-host-targets.js";
21
22
  /** Current on-disk schema version. */
@@ -217,8 +218,7 @@ export async function readMcpInstallState(cwd, deps) {
217
218
  catch (err) {
218
219
  if (isEnoent(err))
219
220
  return { status: "missing" };
220
- // A non-ENOENT read error is treated as missing state, not a crash.
221
- return { status: "missing" };
221
+ return { status: "unreadable" };
222
222
  }
223
223
  let parsed;
224
224
  try {
@@ -271,6 +271,9 @@ export async function readMcpInstallState(cwd, deps) {
271
271
  status: "valid",
272
272
  state: {
273
273
  version: MCP_INSTALL_STATE_VERSION,
274
+ ...(doc.packagedAssets === undefined ? {} : validPackagedAssetInventory(doc.packagedAssets)
275
+ ? { packagedAssets: doc.packagedAssets }
276
+ : { packagedAssetsStatus: (doc.packagedAssets && typeof doc.packagedAssets === "object" && doc.packagedAssets.version !== 1 ? "unsupported" : "invalid") }),
274
277
  selectedPlatforms: normalizePlatforms(rawPlatforms),
275
278
  projectConfigPaths: normalizeProjectPaths(projectConfigPaths),
276
279
  // Entries that are not generated-unit locators are DROPPED rather than
@@ -291,6 +294,7 @@ export function serializeMcpInstallState(state) {
291
294
  // Explicit key order — do not rely on object insertion order for stability.
292
295
  const ordered = {
293
296
  version: state.version,
297
+ ...(state.packagedAssets ? { packagedAssets: cleanAssetInventory(state.packagedAssets) } : {}),
294
298
  selectedPlatforms: state.selectedPlatforms,
295
299
  projectConfigPaths: state.projectConfigPaths,
296
300
  // Re-normalized at serialization time, not trusted from the input object:
@@ -315,10 +319,13 @@ export function serializeMcpInstallState(state) {
315
319
  */
316
320
  export async function writeMcpInstallState(cwd, input, deps) {
317
321
  const existing = await readMcpInstallState(cwd, deps);
322
+ if (!canPreserveAssetInventory(existing))
323
+ return { ok: false, error: "Existing installation state cannot be safely preserved." };
318
324
  const priorUnitPaths = existing.status === "valid" ? existing.state.executorServiceUnitPaths : [];
319
325
  const priorCapabilities = existing.status === "valid" ? (existing.state.capabilities ?? []) : [];
320
326
  const state = {
321
327
  version: MCP_INSTALL_STATE_VERSION,
328
+ ...(existing.status === "valid" && existing.state.packagedAssets ? { packagedAssets: existing.state.packagedAssets } : {}),
322
329
  selectedPlatforms: normalizePlatforms(input.selectedPlatforms),
323
330
  projectConfigPaths: normalizeProjectPaths(input.projectConfigPaths),
324
331
  executorServiceUnitPaths: normalizeExecutorServiceUnitPaths([
@@ -330,6 +337,11 @@ export async function writeMcpInstallState(cwd, input, deps) {
330
337
  // them (BAPI-775).
331
338
  capabilities: normalizeCapabilities(priorCapabilities),
332
339
  };
340
+ if (input.packagedAssets) {
341
+ if (!validPackagedAssetInventory(input.packagedAssets))
342
+ return { ok: false, error: "Invalid packaged-asset inventory." };
343
+ state.packagedAssets = cleanAssetInventory(input.packagedAssets);
344
+ }
333
345
  const finalPath = installStatePath(cwd);
334
346
  return persistMcpInstallState(cwd, state, finalPath, deps);
335
347
  }
@@ -351,8 +363,7 @@ async function persistMcpInstallState(cwd, state, finalPath, deps) {
351
363
  // Best-effort cleanup only; ignore secondary failures.
352
364
  }
353
365
  }
354
- const message = err instanceof Error ? err.message : String(err);
355
- return { ok: false, error: `failed to persist install state: ${message}` };
366
+ return { ok: false, error: "failed to persist install state" };
356
367
  }
357
368
  return { ok: true, path: finalPath, state };
358
369
  }
@@ -379,11 +390,14 @@ export async function recordInstalledProjectArtifact(cwd, relPath, deps) {
379
390
  };
380
391
  }
381
392
  const existing = await readMcpInstallState(cwd, deps);
393
+ if (!canPreserveAssetInventory(existing))
394
+ return { ok: false, error: "Existing installation state cannot be safely preserved." };
382
395
  const priorPlatforms = existing.status === "valid" ? existing.state.selectedPlatforms : [];
383
396
  const priorPaths = existing.status === "valid" ? existing.state.projectConfigPaths : [];
384
397
  const priorUnitPaths = existing.status === "valid" ? existing.state.executorServiceUnitPaths : [];
385
398
  const state = {
386
399
  version: MCP_INSTALL_STATE_VERSION,
400
+ ...(existing.status === "valid" && existing.state.packagedAssets ? { packagedAssets: existing.state.packagedAssets } : {}),
387
401
  selectedPlatforms: normalizePlatforms(priorPlatforms),
388
402
  projectConfigPaths: normalizeProjectPaths([...priorPaths, relPath]),
389
403
  // Preserved, not rebuilt: recording a workflow file must not drop the
@@ -417,11 +431,14 @@ export async function recordInstalledExecutorServiceUnit(cwd, unitPath, homeDir,
417
431
  };
418
432
  }
419
433
  const existing = await readMcpInstallState(cwd, deps);
434
+ if (!canPreserveAssetInventory(existing))
435
+ return { ok: false, error: "Existing installation state cannot be safely preserved." };
420
436
  const priorPlatforms = existing.status === "valid" ? existing.state.selectedPlatforms : [];
421
437
  const priorPaths = existing.status === "valid" ? existing.state.projectConfigPaths : [];
422
438
  const priorUnitPaths = existing.status === "valid" ? existing.state.executorServiceUnitPaths : [];
423
439
  const state = {
424
440
  version: MCP_INSTALL_STATE_VERSION,
441
+ ...(existing.status === "valid" && existing.state.packagedAssets ? { packagedAssets: existing.state.packagedAssets } : {}),
425
442
  selectedPlatforms: normalizePlatforms(priorPlatforms),
426
443
  projectConfigPaths: normalizeProjectPaths(priorPaths),
427
444
  executorServiceUnitPaths: normalizeExecutorServiceUnitPaths([...priorUnitPaths, locator]),
@@ -453,12 +470,15 @@ export async function recordInstalledConductorCapability(cwd, capability, deps)
453
470
  };
454
471
  }
455
472
  const existing = await readMcpInstallState(cwd, deps);
473
+ if (!canPreserveAssetInventory(existing))
474
+ return { ok: false, error: "Existing installation state cannot be safely preserved." };
456
475
  const priorPlatforms = existing.status === "valid" ? existing.state.selectedPlatforms : [];
457
476
  const priorPaths = existing.status === "valid" ? existing.state.projectConfigPaths : [];
458
477
  const priorUnitPaths = existing.status === "valid" ? existing.state.executorServiceUnitPaths : [];
459
478
  const priorCapabilities = existing.status === "valid" ? (existing.state.capabilities ?? []) : [];
460
479
  const state = {
461
480
  version: MCP_INSTALL_STATE_VERSION,
481
+ ...(existing.status === "valid" && existing.state.packagedAssets ? { packagedAssets: existing.state.packagedAssets } : {}),
462
482
  selectedPlatforms: normalizePlatforms(priorPlatforms),
463
483
  projectConfigPaths: normalizeProjectPaths(priorPaths),
464
484
  executorServiceUnitPaths: normalizeExecutorServiceUnitPaths(priorUnitPaths),
@@ -466,3 +486,29 @@ export async function recordInstalledConductorCapability(cwd, capability, deps)
466
486
  };
467
487
  return persistMcpInstallState(cwd, state, installStatePath(cwd), deps);
468
488
  }
489
+ function canPreserveAssetInventory(existing) {
490
+ return existing.status === "missing" || (existing.status === "valid" && !existing.state.packagedAssetsStatus);
491
+ }
492
+ function cleanAssetInventory(inventory) {
493
+ if (!validPackagedAssetInventory(inventory))
494
+ throw new Error("Invalid packaged-asset inventory.");
495
+ return { version: 1, packageVersion: inventory.packageVersion, rootBinding: inventory.rootBinding,
496
+ assets: inventory.assets.map(a => ({ id: a.id, destination: a.destination, host: a.host })) };
497
+ }
498
+ export async function recordPackagedAssetInventory(cwd, inventory, deps) {
499
+ if (!validPackagedAssetInventory(inventory))
500
+ return { ok: false, error: "Invalid packaged-asset inventory." };
501
+ const prior = await readMcpInstallState(cwd, deps);
502
+ if (!canPreserveAssetInventory(prior))
503
+ return { ok: false, error: "Existing installation state cannot be safely preserved." };
504
+ const state = prior.status === "valid" ? prior.state : undefined;
505
+ const records = new Map();
506
+ if (state?.packagedAssets?.rootBinding === inventory.rootBinding) {
507
+ for (const a of state.packagedAssets.assets)
508
+ records.set(`${a.host}:${a.id}`, a);
509
+ }
510
+ for (const a of inventory.assets)
511
+ records.set(`${a.host}:${a.id}`, a);
512
+ return writeMcpInstallState(cwd, { selectedPlatforms: state?.selectedPlatforms ?? [],
513
+ projectConfigPaths: state?.projectConfigPaths ?? [], packagedAssets: { ...inventory, assets: [...records.values()] } }, deps);
514
+ }
@@ -43,6 +43,7 @@
43
43
  * remediation sentence, because subprocess text is unbounded and can carry a
44
44
  * remote URL with an embedded token.
45
45
  */
46
+ import { resolve } from "node:path";
46
47
  import { MERGE_WORKFLOW_EXPECTED_VERSION, MERGE_WORKFLOW_PATH, } from "./conductor/merge-execution-contract.js";
47
48
  import { MERGE_WORKFLOW_API_KEY_SECRET_NAME, } from "./merge-workflow-config.js";
48
49
  import { MERGE_WORKFLOW_CLASSIFICATION_TEXT, classifyMergeWorkflowContent, } from "./merge-workflow-drift.js";
@@ -247,10 +248,8 @@ export async function runMergeWorkflowPreflight(deps, options) {
247
248
  if (!repositoryRoot)
248
249
  return { ok: false, result: fail("not_repository_root") };
249
250
  const normalizedCwd = deps.cwd.endsWith("/") ? deps.cwd.slice(0, -1) : deps.cwd;
250
- const normalizedRoot = repositoryRoot.endsWith("/")
251
- ? repositoryRoot.slice(0, -1)
252
- : repositoryRoot;
253
- if (normalizedRoot !== normalizedCwd) {
251
+ const normalizedRoot = repositoryRoot.endsWith("/") ? repositoryRoot.slice(0, -1) : repositoryRoot;
252
+ if (resolve(normalizedRoot) !== resolve(normalizedCwd)) {
254
253
  return { ok: false, result: fail("not_repository_root") };
255
254
  }
256
255
  deps.log(` repository root: ${normalizedRoot}`);
@@ -178,7 +178,7 @@ export const UPGRADE_ADVICE_SURFACING_INSTRUCTIONS = " Upgrade advice: when any
178
178
  export function resolveRecipe(pipeline, instructions, variables, skipSteps, autoApprove, options) {
179
179
  // Validate required variables are provided
180
180
  const declared = pipeline.variables ?? [];
181
- const missing = declared.filter((v) => !(v in variables));
181
+ const missing = declared.filter((v) => v !== "verification_scope" && !(v in variables));
182
182
  if (missing.length > 0) {
183
183
  throw new Error(`Missing required variable(s): ${missing.join(", ")}. ` +
184
184
  `Pipeline "${pipeline.name}" declares: [${declared.join(", ")}].`);
@@ -189,7 +189,11 @@ export function resolveRecipe(pipeline, instructions, variables, skipSteps, auto
189
189
  // `execution_mode` must not be able to make a phase believe an orchestrator is
190
190
  // watching when none is.
191
191
  const executionMode = options?.executionMode ?? "inline";
192
- variables = { ...variables, [EXECUTION_MODE_VARIABLE]: executionMode };
192
+ variables = {
193
+ ...variables,
194
+ verification_scope: variables.verification_scope === "targeted" ? "targeted" : "full",
195
+ [EXECUTION_MODE_VARIABLE]: executionMode,
196
+ };
193
197
  // Filter and resolve steps
194
198
  const resolvedSteps = [];
195
199
  let stepIndex = 1;