@bridge_gpt/mcp-server 0.2.58 → 0.2.60

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 (127) hide show
  1. package/README.md +231 -113
  2. package/build/agent-guidance.generated.js +1 -1
  3. package/build/agent-notes.js +7 -1
  4. package/build/agent-registry.js +15 -0
  5. package/build/agent-utils.js +16 -8
  6. package/build/claude-user-config-doctor.js +1 -35
  7. package/build/codex-bridge-profile.js +1 -1
  8. package/build/commands.generated.js +7 -8
  9. package/build/conductor/bridge-api-client.js +202 -2
  10. package/build/conductor/bring-up-facts.js +1 -1
  11. package/build/conductor/claude-hook.js +16 -16
  12. package/build/conductor/doctor.js +279 -72
  13. package/build/conductor/epic-implementer-cli.js +38 -5
  14. package/build/conductor/epic-reconcile.js +1 -1
  15. package/build/conductor/epic-runtime.js +21 -12
  16. package/build/conductor/errors.js +3 -3
  17. package/build/conductor/file-scope-guard.js +4 -4
  18. package/build/conductor/git-ci-types.js +1 -1
  19. package/build/conductor/git-inspection.js +2 -2
  20. package/build/conductor/install-doctor.js +28 -6
  21. package/build/conductor/local-merge.js +319 -26
  22. package/build/conductor/merge-execution-contract.js +61 -0
  23. package/build/conductor/merge-execution-eligibility.js +129 -0
  24. package/build/conductor/merge-ledger.js +2 -2
  25. package/build/conductor/pr-ci-producer.js +6 -6
  26. package/build/conductor/pr-review-producer.js +2 -2
  27. package/build/conductor/producer-ledger.js +2 -0
  28. package/build/conductor/readiness-sections.js +166 -9
  29. package/build/conductor/readiness.js +97 -16
  30. package/build/conductor/recovery-cli.js +243 -12
  31. package/build/conductor/recovery-operations.js +64 -6
  32. package/build/conductor/repair-contract.js +38 -4
  33. package/build/conductor/spec-review-producer.js +6 -6
  34. package/build/conductor/store.js +10 -10
  35. package/build/conductor/supervisor-config.js +14 -14
  36. package/build/conductor/supervisor-ledger.js +2 -2
  37. package/build/conductor/supervisor-message-relay.js +2 -2
  38. package/build/conductor/worker-ledger-cli.js +19 -19
  39. package/build/conductor-bundle-artifacts.js +2 -2
  40. package/build/connect-bitbucket-api.js +6 -1
  41. package/build/connect-bitbucket.js +398 -88
  42. package/build/credential-store.js +16 -0
  43. package/build/docs.generated.js +2 -2
  44. package/build/doctor.js +199 -303
  45. package/build/drive-epic.js +88 -71
  46. package/build/epic-implementer-bin.js +22 -17
  47. package/build/epic-implementer-claude-hook-bin.js +4 -2
  48. package/build/epic-implementer-env.js +184 -0
  49. package/build/epic-integration-pr.js +2 -2
  50. package/build/executor/ci-rerun-job.js +269 -0
  51. package/build/executor/cli.js +31 -0
  52. package/build/executor/credentials.js +11 -0
  53. package/build/executor/env.js +79 -8
  54. package/build/executor/heartbeat.js +1 -1
  55. package/build/executor/index.js +21 -4
  56. package/build/executor/job-errors.js +3 -3
  57. package/build/executor/job-runner.js +127 -1
  58. package/build/executor/job-types.js +12 -2
  59. package/build/executor/merge-job.js +46 -5
  60. package/build/executor/observation.js +1 -1
  61. package/build/executor/preflight.js +1 -1
  62. package/build/executor/prompt-spec.js +1 -1
  63. package/build/executor/reconcile-overlap-job.js +10 -130
  64. package/build/executor/reconcile-overlap-types.js +1 -1
  65. package/build/executor/runner.js +1 -1
  66. package/build/executor/service-lifecycle.js +136 -0
  67. package/build/executor/service-unit.js +427 -9
  68. package/build/executor/types.js +5 -0
  69. package/build/index.js +320 -342
  70. package/build/init.js +20 -28
  71. package/build/install-bridge-conductor.js +208 -15
  72. package/build/install-bridge.js +555 -37
  73. package/build/mcp-host-entry-adapter.js +6 -0
  74. package/build/mcp-host-targets.js +2 -0
  75. package/build/mcp-install-state.js +42 -4
  76. package/build/mcp-invoke.js +5 -5
  77. package/build/mcp-profile.js +2 -2
  78. package/build/mcp-provisioning.js +2 -2
  79. package/build/mcp-server-invocation.js +3 -3
  80. package/build/merge-pull-request.js +118 -10
  81. package/build/merge-workflow-codeowners.js +224 -0
  82. package/build/merge-workflow-config.js +133 -0
  83. package/build/merge-workflow-drift.js +66 -0
  84. package/build/merge-workflow-install.js +638 -0
  85. package/build/merge-workflow.js +572 -0
  86. package/build/model-routing-host.js +25 -0
  87. package/build/model-routing-preferences.js +99 -0
  88. package/build/pipelines.generated.js +10 -10
  89. package/build/{plan-epic-conductor-eligibility.js → plan-epic-implementer-eligibility.js} +18 -16
  90. package/build/plan-execution-ledger.js +8 -0
  91. package/build/plane/cli.js +24 -2
  92. package/build/plane/member-roster.js +5 -5
  93. package/build/plane/preflight.js +68 -0
  94. package/build/plane/supervisor.js +1 -1
  95. package/build/plane/types.js +5 -5
  96. package/build/readiness-check.js +1 -1
  97. package/build/readme.generated.js +1 -1
  98. package/build/review-tickets.js +4 -4
  99. package/build/run-unit-tests-launcher.js +5 -0
  100. package/build/setup-epic.js +171 -17
  101. package/build/start-tickets-conductor.js +32 -32
  102. package/build/start-tickets-prereqs.js +4 -9
  103. package/build/start-tickets.js +475 -91
  104. package/build/version.generated.js +3 -3
  105. package/docs/CONDUCTOR.md +69 -18
  106. package/docs/install/mcp-tool-integrations.md +2 -1
  107. package/package.json +4 -4
  108. package/pipelines/implement-ticket.json +1 -1
  109. package/pipelines/plan-epic.json +2 -2
  110. package/build/conduct-epic/bridge-client.js +0 -773
  111. package/build/conduct-epic/checkpoint-store.js +0 -542
  112. package/build/conduct-epic/cli.js +0 -3145
  113. package/build/conduct-epic/cut-protocol.js +0 -392
  114. package/build/conduct-epic/lock.js +0 -302
  115. package/build/conduct-epic/pr-state.js +0 -286
  116. package/build/conduct-epic/spawn.js +0 -113
  117. package/build/conductor/cli.js +0 -1278
  118. package/build/conductor-bundle-cli.js +0 -256
  119. package/build/direct-ticket-tools.js +0 -70
  120. package/build/executor/reconcile-overlap-governance.js +0 -129
  121. package/build/implement-epic/checkpoint-store.js +0 -542
  122. package/build/implement-epic/cli.js +0 -3158
  123. package/build/implement-epic/lock.js +0 -302
  124. package/build/implement-epic/pr-state.js +0 -286
  125. package/build/implement-epic/spawn.js +0 -113
  126. /package/build/{implement-epic → epic-shared}/bridge-client.js +0 -0
  127. /package/build/{implement-epic → epic-shared}/cut-protocol.js +0 -0
@@ -0,0 +1,133 @@
1
+ /**
2
+ * Configuration names and the command-fetch contract the RENDERED merge workflow
3
+ * consumes (BAPI-1136).
4
+ *
5
+ * ## Why these live here and not in `conductor/merge-execution-contract.ts`
6
+ *
7
+ * That module documents itself as the byte-for-byte TypeScript MIRROR of
8
+ * `api/library/epic_implementer/merge_execution_contract.py`: every constant in
9
+ * it has a Python twin whose spelling must match exactly. None of the values
10
+ * below has one. They are the workflow's OWN runtime configuration — a GitHub
11
+ * Actions secret name, a GitHub Actions variable name, a fallback base URL, and
12
+ * the shape of an endpoint the rendered YAML calls — so keeping them in the
13
+ * mirror would have made that module two things at once.
14
+ *
15
+ * There is also a mechanical reason, and it is a good one: a static invariant
16
+ * forbids any `conductor/*.ts` except `bridge-api-client.ts` from containing the
17
+ * literal `BAPI_BASE_URL`, because conductor code must reach the Bridge API only
18
+ * through its dedicated sanitized client. This module reaches the Bridge API not
19
+ * at all — it names a string that the CUSTOMER's workflow reads from its own
20
+ * repository variables — but the guard is textual, and the right response to it
21
+ * was to put these values where they belong rather than to work around it.
22
+ */
23
+ import { MERGE_WORKFLOW_EXPECTED_VERSION } from "./conductor/merge-execution-contract.js";
24
+ /** Re-exported so a consumer needs one import for the workflow's whole contract. */
25
+ export { MERGE_WORKFLOW_EXPECTED_VERSION };
26
+ /**
27
+ * The ONE repository-level GitHub Actions secret the rendered workflow reads.
28
+ *
29
+ * Only the NAME lives here, and only the name ever appears in a rendered
30
+ * template, an installer message, or the README. The customer provisions the
31
+ * value themselves through GitHub's own secret UI or API; the installer never
32
+ * accepts, transmits, prints, or writes it (ratified review decision E-18).
33
+ *
34
+ * Repository-scoped rather than organization-scoped on purpose: a repository
35
+ * reviewer can create a repository secret, while an organization secret needs a
36
+ * second actor the install command cannot name in advance.
37
+ */
38
+ export const MERGE_WORKFLOW_API_KEY_SECRET_NAME = "BAPI_API_KEY";
39
+ /**
40
+ * The repository-level Actions VARIABLE (not a secret) that overrides the Bridge
41
+ * base URL the workflow calls back into.
42
+ *
43
+ * A variable, not a dispatch input: the two dispatch inputs are fixed at
44
+ * `action_key` and `lease_owner` (BAPI-1134), and a base URL supplied by whoever
45
+ * triggered the dispatch would let the caller choose which server authorizes the
46
+ * merge. Absent, the workflow uses {@link MERGE_WORKFLOW_DEFAULT_BASE_URL}.
47
+ */
48
+ export const MERGE_WORKFLOW_BASE_URL_VARIABLE_NAME = "BAPI_BASE_URL";
49
+ /** The hosted Bridge API the rendered workflow falls back to. */
50
+ export const MERGE_WORKFLOW_DEFAULT_BASE_URL = "https://bridgegpt-api.com";
51
+ /**
52
+ * The durable merge-command fetch contract the rendered workflow consumes.
53
+ *
54
+ * ## Why a named contract rather than a live route
55
+ *
56
+ * The SERVER half of this contract is not in the tree. BAPI-1134 shipped the
57
+ * dispatch emitter with its durable-command persistence resolved lazily
58
+ * (`api/library/epic_implementer/reconciler.py`'s
59
+ * `_resolve_durable_merge_command_store`, which imports
60
+ * `api.library.vcs.epic_implementer_merge_command_store.persist_merge_command`
61
+ * and returns `None` today), and recorded that store as "a slice of its own"
62
+ * blocked on an unnamed sibling. The BAPI-1136 review ratified carving that
63
+ * store and its fetch endpoint out as a separate A2 child that lands FIRST
64
+ * (decision E-14), with this child writing the workflow's fetch step against the
65
+ * named contract below.
66
+ *
67
+ * ## What that means operationally
68
+ *
69
+ * Until the sibling child lands, the endpoint answers 404 and the rendered
70
+ * workflow refuses with `merge_command_unavailable` before touching the pull
71
+ * request — no retry, no merge, no completion report. The merge lane is
72
+ * therefore INERT by construction rather than by a flag someone could flip: no
73
+ * dispatch is emitted at all while the command store is absent, and a dispatch
74
+ * that somehow arrived would be refused at the first step. That is the block on
75
+ * operational enablement; {@link MERGE_WORKFLOW_EXPECTED_VERSION} exact equality
76
+ * remains the SEPARATE deploy-ordering refusal it already was, and neither
77
+ * substitutes for the other.
78
+ *
79
+ * ## Shape
80
+ *
81
+ * Keyed by `action_key`, NOT by pull request number: the workflow learns the
82
+ * pull request FROM the command, so a PR-scoped route could not be called. That
83
+ * is also why a fetch failure cannot be reported through
84
+ * `POST /vcs/pull-requests/{pr}/merge/complete` — the path parameter is not yet
85
+ * resolved — and the lease's own expiry is the reconciler's backstop for that
86
+ * one window.
87
+ */
88
+ export const MERGE_COMMAND_FETCH_METHOD = "POST";
89
+ /** Root-mounted, repo-authorized path of the durable command fetch. */
90
+ export const MERGE_COMMAND_FETCH_PATH = "/vcs/merge-commands/fetch";
91
+ /**
92
+ * The request fields the fetch accepts, in the contract's own spelling.
93
+ *
94
+ * `lease_owner` is the per-attempt secret BAPI-1134 mints; it is presented here
95
+ * as PROOF that this dispatch is the live attempt, never echoed, and never a
96
+ * response field.
97
+ */
98
+ export const MERGE_COMMAND_FETCH_REQUEST_FIELDS = [
99
+ "repo_name",
100
+ "action_key",
101
+ "lease_owner",
102
+ ];
103
+ /**
104
+ * The separator and field position the Bridge repository name occupies inside a
105
+ * merge action key (`merge:{repo}:{pr}:{head_sha}:{gate_identity}`, built by
106
+ * `makeMergeActionKey`).
107
+ *
108
+ * The workflow derives `repo_name` from the key it was dispatched with rather
109
+ * than accepting a third dispatch input, so the Bridge-side identity and the
110
+ * attempt identity cannot disagree.
111
+ */
112
+ export const MERGE_ACTION_KEY_REPO_FIELD_INDEX = 1;
113
+ /**
114
+ * The response projection the workflow consumes, in the contract's own spelling.
115
+ *
116
+ * `lease_owner` is deliberately ABSENT: a response that echoed the live
117
+ * per-attempt secret would hand it to every log that captured the body.
118
+ *
119
+ * `github_repository` is the provider-side `owner/name` the command was issued
120
+ * against. The workflow compares it with `github.repository` before reading the
121
+ * pull request, so a command minted for a different repository cannot actuate
122
+ * here even if its key and lease were presented correctly.
123
+ */
124
+ export const MERGE_COMMAND_FETCH_RESPONSE_FIELDS = [
125
+ "action_key",
126
+ "repo_name",
127
+ "github_repository",
128
+ "pr_number",
129
+ "expected_head_sha",
130
+ "merge_method",
131
+ "execution",
132
+ "lease_expires_at",
133
+ ];
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Canonical byte identity for the Epic Implementer merge workflow (BAPI-1136).
3
+ *
4
+ * The merge workflow is the one file in a customer repository that can perform a
5
+ * privileged write on Bridge's behalf, so "is the installed copy the copy Bridge
6
+ * ships?" has to be answerable cheaply, in more than one place, and with one
7
+ * answer. This module is that one place.
8
+ *
9
+ * It follows `claude-review-workflow-drift.ts`'s shape deliberately: a leaf
10
+ * module with NO filesystem, network, or subprocess access, importing only the
11
+ * shared Git blob hash so two workflow-identity implementations cannot drift
12
+ * apart about what "the same file" means. Callers acquire bytes however their
13
+ * own layer already does and hand them in.
14
+ *
15
+ * Nothing here logs file content: a classification carries a path, a pair of
16
+ * SHAs, and a closed-vocabulary state — never bytes, never provider text.
17
+ */
18
+ import { computeGitBlobSha } from "./claude-review-workflow-drift.js";
19
+ import { MERGE_WORKFLOW_PATH } from "./conductor/merge-execution-contract.js";
20
+ import { renderEpicImplementerMergeWorkflow } from "./merge-workflow.js";
21
+ export { MERGE_WORKFLOW_PATH };
22
+ /**
23
+ * The Git blob SHA-1 of the workflow this build renders.
24
+ *
25
+ * Computed, never hardcoded. A checked-in literal would be a second byte source
26
+ * the renderer could silently diverge from — exactly the drift this module
27
+ * exists to make impossible.
28
+ */
29
+ export function canonicalMergeWorkflowSha() {
30
+ return computeGitBlobSha(Buffer.from(renderEpicImplementerMergeWorkflow(), "utf8"));
31
+ }
32
+ /**
33
+ * Every Bridge-published historical rendering of the merge workflow, by Git blob
34
+ * SHA, with the contract version it declared.
35
+ *
36
+ * Empty at contract version 1: there is no earlier published version to upgrade
37
+ * FROM. A future contract version adds its predecessor's SHA here, and only
38
+ * then can {@link classifyMergeWorkflowContent} return `managed_version_older`.
39
+ */
40
+ export const MANAGED_MERGE_WORKFLOW_HISTORY = new Map();
41
+ /**
42
+ * Classify an installed copy against the canonical bytes.
43
+ *
44
+ * `existing` is `null` for an absent file. The comparison is on RAW BYTES, not
45
+ * normalized text: a copy that differs only in line endings is still a copy this
46
+ * installer did not write, and treating it as identical would let a rewrite hide
47
+ * behind a whitespace-insensitive compare.
48
+ */
49
+ export function classifyMergeWorkflowContent(existing) {
50
+ if (existing === null)
51
+ return "not_installed";
52
+ const canonical = renderEpicImplementerMergeWorkflow();
53
+ if (existing === canonical)
54
+ return "identical";
55
+ const sha = computeGitBlobSha(Buffer.from(existing, "utf8"));
56
+ if (MANAGED_MERGE_WORKFLOW_HISTORY.has(sha))
57
+ return "managed_version_older";
58
+ return "modified_or_unrecognized";
59
+ }
60
+ /** Operator-facing gloss for each classification. Secret-free and path-only. */
61
+ export const MERGE_WORKFLOW_CLASSIFICATION_TEXT = {
62
+ not_installed: `${MERGE_WORKFLOW_PATH} is not installed`,
63
+ identical: `${MERGE_WORKFLOW_PATH} already matches the version this build ships`,
64
+ managed_version_older: `${MERGE_WORKFLOW_PATH} is an older Bridge-managed version and can be upgraded`,
65
+ modified_or_unrecognized: `${MERGE_WORKFLOW_PATH} has been modified or is not a version Bridge published`,
66
+ };