@bridge_gpt/mcp-server 0.2.75 → 0.2.77

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 (94) hide show
  1. package/README.md +8 -6
  2. package/build/agents.generated.js +5 -5
  3. package/build/cli-dispatch.js +333 -0
  4. package/build/codex-auto-recovery.js +25 -7
  5. package/build/commands.generated.js +8 -8
  6. package/build/conductor/bridge-api-client.js +193 -13
  7. package/build/conductor/declare-blocked.js +146 -7
  8. package/build/conductor/driver-pass.js +8 -0
  9. package/build/conductor/driver-register.js +8 -2
  10. package/build/conductor/epic-implementer-cli.js +15 -10
  11. package/build/conductor/epic-server-journal.js +52 -22
  12. package/build/conductor/epic-server-recipe.js +15 -5
  13. package/build/conductor/epic-server-runtime.js +163 -45
  14. package/build/conductor/epic-server.js +13 -6
  15. package/build/conductor/install-doctor.js +30 -2
  16. package/build/conductor/launch-plan.js +28 -7
  17. package/build/conductor/local-merge.js +55 -13
  18. package/build/conductor/pr-ci-producer.js +12 -3
  19. package/build/conductor/readiness-prerequisites.js +89 -2
  20. package/build/conductor/readiness-sections.js +46 -13
  21. package/build/conductor/readiness.js +3 -40
  22. package/build/conductor/recovery-cli.js +14 -12
  23. package/build/conductor/repository-workflow-remedy.js +147 -7
  24. package/build/conductor/ui-readiness.js +224 -0
  25. package/build/conductor/wait-run-attention.js +9 -4
  26. package/build/conductor/wait-run-cli.js +9 -2
  27. package/build/docs.generated.js +67 -4
  28. package/build/doctor.js +97 -1
  29. package/build/drive-epic.js +625 -33
  30. package/build/engine-paths.js +10 -0
  31. package/build/epic-coherence-input-cli.js +105 -10
  32. package/build/epic-coherence-input.js +877 -4
  33. package/build/epic-coherence-input.test-fixtures.js +117 -0
  34. package/build/epic-implementer-bin.js +947 -120
  35. package/build/epic-implementer-env.js +2 -2
  36. package/build/epic-launch-context.js +8 -1
  37. package/build/epic-shared/cut-protocol.js +55 -3
  38. package/build/executor/completion-contract.js +14 -1
  39. package/build/executor/failure-reason-codes.js +2 -0
  40. package/build/executor/guarded-fast-forward-push.js +25 -2
  41. package/build/executor/integration-job.js +56 -2
  42. package/build/executor/job-runner.js +87 -28
  43. package/build/executor/likely-tests.js +78 -6
  44. package/build/executor/merge-job.js +45 -1
  45. package/build/executor/permissions.js +187 -2
  46. package/build/executor/provider-checks.js +101 -5
  47. package/build/executor/rebase-finalization.js +29 -27
  48. package/build/executor/reconcile-overlap-job.js +70 -17
  49. package/build/executor/rename-aside.js +265 -0
  50. package/build/executor/required-work-ledger.js +89 -6
  51. package/build/executor/resume-pre-spawn.js +32 -8
  52. package/build/executor/runner.js +26 -4
  53. package/build/executor/types.js +121 -0
  54. package/build/executor/worktree.js +39 -2
  55. package/build/index.js +2500 -495
  56. package/build/init.js +16 -0
  57. package/build/install-bridge-conductor-answers.js +4 -0
  58. package/build/install-bridge-conductor-apply.js +10 -0
  59. package/build/install-bridge-conductor-assessment.js +84 -0
  60. package/build/install-bridge-conductor-contracts.js +9 -1
  61. package/build/install-bridge-conductor-setup.js +103 -3
  62. package/build/install-bridge-conductor.js +440 -812
  63. package/build/install-bridge.js +4 -11
  64. package/build/language-catalog.generated.js +2649 -0
  65. package/build/mcp-host-config.js +54 -37
  66. package/build/phase-context-git-probe.js +16 -0
  67. package/build/pipelines.generated.js +47 -19
  68. package/build/plan-execution-ledger.js +35 -0
  69. package/build/plan-generation.js +34 -0
  70. package/build/plane/build-freshness.js +6 -0
  71. package/build/plane/cli.js +12 -5
  72. package/build/plane/plane-freshness.js +43 -26
  73. package/build/printed-remedy-commands.js +17 -0
  74. package/build/readiness-prerequisites.generated.js +28 -0
  75. package/build/readme.generated.js +1 -1
  76. package/build/run-unit-tests-launcher.js +3 -1
  77. package/build/secret-redaction.js +3 -0
  78. package/build/server.js +7946 -0
  79. package/build/setup-epic.js +41 -8
  80. package/build/start-tickets-prereqs.js +3 -6
  81. package/build/test-support/console-guard.js +30 -0
  82. package/build/test-support/create-preview-world.js +232 -0
  83. package/build/test-support/module-imports.js +155 -0
  84. package/build/test-support/server-client.js +96 -0
  85. package/build/test-support/stdio-server.js +146 -0
  86. package/build/ticket-delivery.js +65 -0
  87. package/build/v2-readiness-requirements.js +39 -5
  88. package/build/version.generated.js +3 -3
  89. package/build/worktree-core.js +51 -7
  90. package/docs/EPIC-IMPLEMENTER.md +150 -2
  91. package/docs/epic-implementer/getting-started.md +5 -1
  92. package/package.json +3 -3
  93. package/pipelines/implement-ticket.json +2 -2
  94. package/pipelines/learn-repository.json +19 -1
@@ -27,12 +27,14 @@
27
27
  * existing byte), and DECLINE (`manual-required`) an existing Bridge table
28
28
  * rather than reserialize unrelated content.
29
29
  */
30
+ import { readFile as fsReadFile } from "fs/promises";
30
31
  import { VERSION } from "./version.generated.js";
31
32
  import { codexHome } from "./codex-home.js";
32
33
  import { refreshBridgeApiPackageSpec } from "./init.js";
33
34
  import { hostAdapterForTarget, } from "./mcp-host-targets.js";
34
35
  import { adaptBridgeEntryForHostTarget, } from "./mcp-host-entry-adapter.js";
35
36
  export { adaptBridgeEntryForHostTarget, } from "./mcp-host-entry-adapter.js";
37
+ import { resolveProfiles } from "./mcp-profile.js";
36
38
  import { LEGACY_SERVER_NAMES, MCP_SERVER_NAME, MCP_PACKAGE_NAME, RECOGNIZED_SERVER_NAMES, resolveRegistrationKey, } from "./mcp-identity.js";
37
39
  /**
38
40
  * The secret-free, repair-oriented detail every duplicate-registration outcome
@@ -464,54 +466,46 @@ export const BRIDGE_PROFILE_TOKEN_CONFIGS = [
464
466
  { path: ".cursor/mcp.json", topLevelKey: "mcpServers" },
465
467
  ];
466
468
  /**
467
- * Split a stored `BRIDGE_MCP_PROFILE` value into tokens exactly the way
468
- * `mergeBridgeApiProfileToken` does — raw comma splitting with trimming, and
469
- * deliberately NOT `resolveProfiles`, which force-injects the implicit `core`
470
- * group the stored value never contains.
469
+ * The raw stored `BRIDGE_MCP_PROFILE` string on one registration entry, or
470
+ * `undefined` when none is stored. Null when the entry is not an object.
471
471
  */
472
- function storedProfileTokens(value) {
473
- if (typeof value !== "string")
474
- return [];
475
- return value
476
- .split(",")
477
- .map((t) => t.trim())
478
- .filter((t) => t.length > 0);
479
- }
480
- /** The `BRIDGE_MCP_PROFILE` tokens stored on one registration entry, if any. */
481
- function entryProfileTokens(entry) {
472
+ function entryStoredProfile(entry) {
482
473
  if (!entry || typeof entry !== "object" || Array.isArray(entry))
483
474
  return null;
484
475
  const env = entry.env;
485
476
  const stored = env && typeof env === "object" && !Array.isArray(env)
486
477
  ? env.BRIDGE_MCP_PROFILE
487
478
  : undefined;
488
- return storedProfileTokens(stored);
479
+ return { stored: typeof stored === "string" ? stored : undefined };
480
+ }
481
+ /** Whether a stored profile loads `token`, resolved exactly as the runtime does. */
482
+ function storedProfileLoads(stored, token) {
483
+ return resolveProfiles(stored).has(token);
489
484
  }
490
485
  /**
491
- * Inspect one supported host config for a Bridge entry carrying `token`.
486
+ * Inspect one supported host config for Bridge entries loading `token`.
492
487
  *
493
- * BAPI-807: the entry is looked up under EVERY recognized registration key, not
488
+ * BAPI-807: entries are looked up under EVERY recognized registration key, not
494
489
  * the `bridge-api` literal alone. A fresh install writes `bridge`, so reading
495
- * only the legacy key would report `no-bridge-entry` for every current install
496
- * and send the operator to re-run the base install that already ran.
490
+ * only the legacy key would report `no-bridge-entry` for every current install.
497
491
  *
498
- * A config carrying BOTH keys is read as one presence question, not resolved:
499
- * this function only answers "does a Bridge entry here carry the token", and
500
- * either entry carrying it makes that true. Choosing WHICH duplicate wins is a
501
- * write-path decision, and the write path refuses it loudly
502
- * (`DuplicateRegistrationError`) rather than guessing.
492
+ * BAPI-1719: group availability is the RESOLVED set (`resolveProfiles`), so
493
+ * `full` and any-case `Epic_Implementer` count as loaded, and the config is
494
+ * `token-present` only when EVERY inspected entry loads it. A config carrying
495
+ * both keys is flagged `duplicateRegistration`; choosing which duplicate wins is
496
+ * a write-path decision the writer refuses loudly.
503
497
  *
504
- * Every failure mode is an explicit state rather than a thrown error: a missing
505
- * file is the ordinary case (the writer never creates one), and a malformed or
506
- * unreadable file is a diagnosable outcome the operator can act on. Neither may
507
- * surface a filesystem message or JSON parser text.
498
+ * Every failure mode is an explicit state rather than a thrown error. Neither a
499
+ * filesystem message nor JSON parser text may escape.
508
500
  */
509
501
  async function inspectOneProfileConfig(projectRoot, target, token, deps) {
510
502
  const read = await readJsonHostConfig(joinPath(projectRoot, target.path), deps);
511
- if (read.state === "missing")
503
+ if (read.state === "missing") {
512
504
  return { path: target.path, state: "absent" };
513
- if (read.state !== "valid")
505
+ }
506
+ if (read.state !== "valid") {
514
507
  return { path: target.path, state: "unreadable" };
508
+ }
515
509
  const root = read.value[target.topLevelKey];
516
510
  if (!root || typeof root !== "object" || Array.isArray(root)) {
517
511
  return { path: target.path, state: "no-bridge-entry" };
@@ -519,16 +513,22 @@ async function inspectOneProfileConfig(projectRoot, target, token, deps) {
519
513
  const servers = root;
520
514
  // Own properties only, for the same reason `resolveRegistrationKey` insists on
521
515
  // it: a `bridge` inherited from a polluted prototype is not a registration.
522
- const tokenSets = RECOGNIZED_SERVER_NAMES.filter((name) => Object.prototype.hasOwnProperty.call(servers, name))
523
- .map((name) => entryProfileTokens(servers[name]))
524
- .filter((tokens) => tokens !== null);
525
- if (tokenSets.length === 0)
516
+ const present = RECOGNIZED_SERVER_NAMES.filter((name) => Object.prototype.hasOwnProperty.call(servers, name));
517
+ const profiles = present
518
+ .map((name) => entryStoredProfile(servers[name]))
519
+ .filter((p) => p !== null);
520
+ if (profiles.length === 0) {
526
521
  return { path: target.path, state: "no-bridge-entry" };
527
- // Only a boolean derived from the token set escapes this function — the env
528
- // object itself is read here and nowhere else.
522
+ }
523
+ // Only booleans derived from the stored profiles escape this function — the
524
+ // env object itself is read here and nowhere else.
529
525
  return {
530
526
  path: target.path,
531
- state: tokenSets.some((tokens) => tokens.includes(token)) ? "token-present" : "token-absent",
527
+ state: profiles.every((p) => storedProfileLoads(p.stored, token))
528
+ ? "token-present"
529
+ : "token-absent",
530
+ // Present only when true, so every earlier-shaped inspection keeps its exact keys.
531
+ ...(present.length > 1 ? { duplicateRegistration: true } : {}),
532
532
  };
533
533
  }
534
534
  /**
@@ -551,6 +551,23 @@ export async function inspectBridgeApiProfileToken(projectRoot, token, deps) {
551
551
  bridgeEntryPresent: configs.some((c) => c.state === "token-present" || c.state === "token-absent"),
552
552
  };
553
553
  }
554
+ /**
555
+ * BAPI-1356 / BAPI-1719: whether `mergeBridgeApiProfileToken` has anything to do
556
+ * for `token`, from an inspection already in hand.
557
+ *
558
+ * True when any inspected Bridge entry lacks the group, and also when a config
559
+ * carries BOTH registration keys — the writer is what refuses that loudly, so a
560
+ * satisfied registration must never hide it. Absent, no-entry, and unreadable
561
+ * configs are excluded, exactly as the writer skips them. Setup and doctor both
562
+ * decide through this one function.
563
+ */
564
+ export function profileMergeNeededFrom(inspection) {
565
+ return inspection.configs.some((c) => c.state === "token-absent" || c.duplicateRegistration === true);
566
+ }
567
+ /** Read-only: whether the writer has anything to do for `token` under `projectRoot`. */
568
+ export async function profileMergeNeeded(projectRoot, token, deps = { readFile: (p) => fsReadFile(p, "utf-8") }) {
569
+ return profileMergeNeededFrom(await inspectBridgeApiProfileToken(projectRoot, token, deps));
570
+ }
554
571
  /**
555
572
  * Whether a vendor kind's secret-delivery contract is VERIFIED. Only verified
556
573
  * contracts are ever invoked; an uncertain contract falls back to a direct
@@ -66,3 +66,19 @@ export async function evaluateCheckpointReachability(options) {
66
66
  return { head, reachable: "unknown", reason: classifyGitFailure(err) };
67
67
  }
68
68
  }
69
+ /**
70
+ * BAPI-1733 — choose the directory a checkpoint-reachability probe runs in.
71
+ *
72
+ * - A run-scoped call that names a worktree probes only that worktree's canonical
73
+ * verified path. The raw supplied path is never accepted as evidence.
74
+ * - The same call without a verified worktree returns `undefined`: the caller must
75
+ * make no git call and report an unknown head, never fall back to another checkout.
76
+ * - Every other call (unscoped, or a run id with no supplied path) probes the
77
+ * project root.
78
+ */
79
+ export function selectCheckpointProbeRoot(options) {
80
+ if (options.epicRunId !== undefined && options.worktreePath !== undefined) {
81
+ return options.verifiedWorktree?.path;
82
+ }
83
+ return options.projectRoot;
84
+ }