@bridge_gpt/mcp-server 0.2.18 → 0.2.20

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 (100) hide show
  1. package/CONDUCTOR.md +75 -0
  2. package/README.md +8 -5
  3. package/build/agent-capabilities/probe-context.js +13 -3
  4. package/build/agent-capabilities/probes.js +262 -11
  5. package/build/agent-capabilities/reporter.js +1 -0
  6. package/build/agents.generated.js +1 -1
  7. package/build/backend-warnings.js +44 -0
  8. package/build/claude-settings.js +129 -0
  9. package/build/commands.generated.js +5 -3
  10. package/build/conductor/bridge-api-client.js +7 -7
  11. package/build/conductor/cli.js +65 -12
  12. package/build/conductor/deny-enforcement-preflight.js +96 -0
  13. package/build/conductor/doctor.js +183 -2
  14. package/build/conductor/epic-reconcile.js +9 -1
  15. package/build/conductor/epic-runtime.js +403 -43
  16. package/build/conductor/epic-state.js +7 -0
  17. package/build/conductor/errors.js +115 -3
  18. package/build/conductor/event-accessors.js +28 -10
  19. package/build/conductor/local-merge.js +458 -95
  20. package/build/conductor/merge-ledger.js +6 -4
  21. package/build/conductor/pr-ci-producer.js +17 -2
  22. package/build/conductor/producer-ledger.js +1 -1
  23. package/build/conductor/store.js +161 -18
  24. package/build/conductor/supervisor-merge.js +32 -5
  25. package/build/conductor/taxonomy.js +8 -0
  26. package/build/conductor/tools.js +28 -6
  27. package/build/conductor/worker-ledger-cli.js +244 -0
  28. package/build/conductor-bin.js +1884 -6917
  29. package/build/doctor.js +8 -0
  30. package/build/estimate-epic.js +84 -0
  31. package/build/executor/cli.js +229 -0
  32. package/build/executor/credentials.js +65 -0
  33. package/build/executor/deps.js +117 -0
  34. package/build/executor/env.js +79 -0
  35. package/build/executor/heartbeat.js +59 -0
  36. package/build/executor/http-client.js +131 -0
  37. package/build/executor/index.js +10 -0
  38. package/build/executor/job-errors.js +55 -0
  39. package/build/executor/job-log-registry.js +110 -0
  40. package/build/executor/job-runner.js +822 -0
  41. package/build/executor/job-types.js +60 -0
  42. package/build/executor/merge-job.js +229 -0
  43. package/build/executor/observation.js +123 -0
  44. package/build/executor/permissions.js +79 -0
  45. package/build/executor/preflight.js +144 -0
  46. package/build/executor/process.js +81 -0
  47. package/build/executor/prompt-spec.js +235 -0
  48. package/build/executor/results.js +134 -0
  49. package/build/executor/resume-pre-spawn.js +179 -0
  50. package/build/executor/runner.js +98 -0
  51. package/build/executor/terminal-mutation.js +34 -0
  52. package/build/executor/test-clock.js +109 -0
  53. package/build/executor/types.js +18 -0
  54. package/build/executor/verdict-artifact.js +53 -0
  55. package/build/executor/viewer-tabs.js +78 -0
  56. package/build/executor/watch-cli.js +113 -0
  57. package/build/executor/worker-command.js +106 -0
  58. package/build/executor/worker-finalization.js +177 -0
  59. package/build/executor/worker-log.js +92 -0
  60. package/build/executor/worktree-gc.js +134 -0
  61. package/build/executor/worktree-inspection.js +86 -0
  62. package/build/executor/worktree.js +103 -0
  63. package/build/index.js +14534 -10416
  64. package/build/mcp-invoke.js +19 -3
  65. package/build/mcp-provisioning.js +31 -25
  66. package/build/mcp-registration-doctor.js +27 -7
  67. package/build/mcp-server-invocation.js +152 -0
  68. package/build/pipelines.generated.js +16 -20
  69. package/build/readme.generated.js +1 -1
  70. package/build/sfcc/client.js +192 -50
  71. package/build/sfcc/ocapi-write-faults.js +94 -0
  72. package/build/sfcc/permissions.js +7 -22
  73. package/build/sfcc/reads-site-preference.js +52 -19
  74. package/build/sfcc/register.js +9 -0
  75. package/build/sfcc/write-grants.js +80 -0
  76. package/build/sfcc/write-guard.js +39 -0
  77. package/build/sfcc/write-result.js +47 -0
  78. package/build/sfcc/write-tool-common.js +85 -0
  79. package/build/sfcc/writes-custom-object-def.js +141 -0
  80. package/build/sfcc/writes-object-attribute-payloads.js +97 -0
  81. package/build/sfcc/writes-site-preference-payloads.js +59 -0
  82. package/build/sfcc/writes-site-preference.js +96 -0
  83. package/build/sfcc/writes-system-object-payloads.js +213 -0
  84. package/build/sfcc/writes-system-object.js +348 -0
  85. package/build/sfcc/writes.js +66 -0
  86. package/build/start-tickets-conductor.js +25 -93
  87. package/build/start-tickets-prereqs.js +152 -1
  88. package/build/start-tickets.js +96 -158
  89. package/build/version.generated.js +1 -1
  90. package/build/visual-diff-worker.js +313 -0
  91. package/build/visual-diff.js +632 -0
  92. package/build/worktree-core.js +202 -0
  93. package/package.json +8 -4
  94. package/pipelines/idea-to-ticket.json +7 -0
  95. package/pipelines/review-ticket.json +5 -18
  96. package/public/css/main.min.css +1612 -107
  97. package/public/css/main.min.css.map +1 -1
  98. package/public/js/main.min.js +10267 -1
  99. package/public/js/main.min.js.map +1 -1
  100. package/smoke-test/SMOKE-TEST.md +2 -1
@@ -61,6 +61,76 @@ export class ConductorStoreError extends Error {
61
61
  this.name = "ConductorStoreError";
62
62
  }
63
63
  }
64
+ /**
65
+ * Raised when the frozen v1 `conductor epic-tick` entrypoint is invoked
66
+ * (BAPI-534, Epic Conductor v2 slice 0). The v1 local reconciler/ledger tick is
67
+ * frozen: Epic Conductor v2 replaces it with a server-side reconciler plus the
68
+ * local executor (`mcp-server executor`). The message points operators at the v2
69
+ * path and is path-free / secret-free.
70
+ */
71
+ export class ConductorEpicTickV1FrozenError extends Error {
72
+ constructor() {
73
+ super("The v1 `conductor epic-tick` path is frozen (EPIC_TICK_V1_FROZEN). Epic " +
74
+ "Conductor v2 replaces the local epic tick with a server-side reconciler " +
75
+ "plus the local executor — run `mcp-server executor` instead.");
76
+ this.name = "ConductorEpicTickV1FrozenError";
77
+ }
78
+ }
79
+ /**
80
+ * Raised (BAPI-527) when the worker-side ledger subprocess boundary cannot run.
81
+ *
82
+ * Worker-facing ledger operations (`check_messages`, `wait_for_done_gate` event
83
+ * emission) MUST execute through `conductor-bin.js` under the captured conductor
84
+ * Node (`CONDUCTOR_NODE_PATH`) so the worker Node never loads the `better-sqlite3`
85
+ * native binary. When that runtime is missing or invalid, this error makes the
86
+ * failure LOUD and structured rather than silently falling back to the worker
87
+ * Node. The carried `reason`/`envVar` are the ONLY diagnostic surface — both are
88
+ * fixed, non-secret, path-free tokens. No caught error, path, argv, stdout,
89
+ * stderr, or credential value is ever attached.
90
+ */
91
+ export class ConductorLedgerSubprocessRuntimeError extends Error {
92
+ reason;
93
+ envVar;
94
+ constructor(reason, envVar) {
95
+ // Single-line, path-free, secret-free (the committed CLI-stderr invariant in
96
+ // security-regressions.test.ts requires it). Names only the reason token.
97
+ super(`Conductor worker ledger subprocess is unavailable (reason: ${reason}).`);
98
+ this.name = "ConductorLedgerSubprocessRuntimeError";
99
+ this.reason = reason;
100
+ this.envVar = envVar;
101
+ }
102
+ }
103
+ /**
104
+ * Structural guard for a native-module-load failure raised by the conductor
105
+ * store (BAPI-526). Detected structurally (by `name` + a valid `details` object)
106
+ * rather than by importing `ConductorNativeModuleLoadError` from `store.ts`, so
107
+ * `errors.ts` avoids a runtime import cycle with the store.
108
+ */
109
+ export function isConductorNativeModuleLoadError(error) {
110
+ if (!(error instanceof Error))
111
+ return false;
112
+ if (error.name !== "ConductorNativeModuleLoadError")
113
+ return false;
114
+ const details = error.details;
115
+ if (!details || typeof details !== "object" || Array.isArray(details))
116
+ return false;
117
+ const d = details;
118
+ return (typeof d.node_version === "string" &&
119
+ typeof d.node_modules_abi === "string" &&
120
+ typeof d.module === "string");
121
+ }
122
+ /**
123
+ * Copy ONLY the three allowlisted native-load detail fields. Never spreads
124
+ * arbitrary properties from the error, so a secret/path smuggled onto the error
125
+ * object cannot round-trip into the client envelope.
126
+ */
127
+ function nativeModuleDetailsEnvelope(details) {
128
+ return {
129
+ node_version: details.node_version,
130
+ node_modules_abi: details.node_modules_abi,
131
+ module: details.module,
132
+ };
133
+ }
64
134
  /**
65
135
  * Heuristically detect SQLite busy/locked failures so they can be surfaced as a
66
136
  * retryable 503 rather than an opaque 500. Matches the `better-sqlite3` error
@@ -101,11 +171,37 @@ function isSqliteBusyError(error) {
101
171
  * the raw error text, stack, and any secret material are discarded.
102
172
  */
103
173
  export function toConductorErrorEnvelope(error) {
174
+ // v1 epic-tick freeze (BAPI-534): the frozen entrypoint maps to a stable,
175
+ // named 400 pointing operators at Epic Conductor v2 (server-side reconciler +
176
+ // local executor). Checked first — it is a fail-loud guard, not a runtime fault.
177
+ if (error instanceof ConductorEpicTickV1FrozenError) {
178
+ return {
179
+ error: "EPIC_TICK_V1_FROZEN",
180
+ status: 400,
181
+ message: error.message,
182
+ };
183
+ }
184
+ // Native-module LOAD failure (BAPI-526): `better-sqlite3` is present but fails
185
+ // to load for this Node runtime (ABI/dlopen mismatch). Checked BEFORE the
186
+ // generic persistence-unavailable branch below (the native-load error subclasses
187
+ // it) so an ABI/dlopen failure surfaces as a distinct, machine-readable kind
188
+ // carrying node_version/ABI — never masked as INTERNAL_ERROR or the
189
+ // undifferentiated PERSISTENCE_UNAVAILABLE. `details` is a fixed three-field
190
+ // allowlist copied explicitly, never spread from the error object.
191
+ if (isConductorNativeModuleLoadError(error)) {
192
+ return {
193
+ error: "LEDGER_NATIVE_MODULE_LOAD_FAILED",
194
+ status: 500,
195
+ message: "Conductor ledger native module failed to load for this Node runtime.",
196
+ details: nativeModuleDetailsEnvelope(error.details),
197
+ };
198
+ }
104
199
  // Optional-native-binding degradation (BAPI-451): the conductor `store.ts`
105
200
  // throws ConductorPersistenceUnavailableError when `better-sqlite3` could not be
106
- // loaded. Detected by name (not instanceof) to avoid an import cycle with
107
- // store.ts. Surfaced as a retryable-shaped 503 with a fixed, secret-free message
108
- // so the caller learns persistence is unavailable instead of getting an opaque 500.
201
+ // loaded (or is not installed). Detected by name (not instanceof) to avoid an
202
+ // import cycle with store.ts. Surfaced as a retryable-shaped 503 with a fixed,
203
+ // secret-free message so the caller learns persistence is unavailable instead of
204
+ // getting an opaque 500.
109
205
  if (error instanceof Error && error.name === "ConductorPersistenceUnavailableError") {
110
206
  return {
111
207
  error: "PERSISTENCE_UNAVAILABLE",
@@ -113,6 +209,22 @@ export function toConductorErrorEnvelope(error) {
113
209
  message: "Conductor persistence is unavailable (the optional better-sqlite3 native module is not loaded). Conductor coordination features are disabled; core tools are unaffected.",
114
210
  };
115
211
  }
212
+ // Worker-ledger subprocess runtime failure (BAPI-527): CONDUCTOR_NODE_PATH /
213
+ // BAPI_CONDUCTOR_CLI_FILE is missing or invalid so the worker cannot reach the
214
+ // local ledger through the captured conductor Node. Surfaced as a retryable-
215
+ // shaped 503 with a fixed, secret-free message plus a small non-secret details
216
+ // bag (env_var + stable reason). NOTHING path/secret-bearing is echoed. This is
217
+ // distinct from LEDGER_NATIVE_MODULE_LOAD_FAILED / PERSISTENCE_UNAVAILABLE,
218
+ // which cover conductor-owned processes that still load better-sqlite3 directly.
219
+ if (error instanceof ConductorLedgerSubprocessRuntimeError) {
220
+ return {
221
+ error: "LEDGER_SUBPROCESS_RUNTIME_UNAVAILABLE",
222
+ status: 503,
223
+ message: "Conductor worker ledger subprocess is unavailable; the worker Node cannot reach the local ledger. " +
224
+ "The dispatched conductor Node runtime is missing or invalid — conductor worker coordination is degraded; core tools are unaffected.",
225
+ details: { env_var: error.envVar, reason: error.reason },
226
+ };
227
+ }
116
228
  if (error instanceof ConductorValidationError) {
117
229
  // Validation messages are conductor-authored and name the offending field,
118
230
  // never its value — but redact defensively so an adversarial/secret-bearing
@@ -161,6 +161,9 @@ const EVENT_PARSERS = {
161
161
  "spec_review.passed": parseSpecReview,
162
162
  "spec_review.changes_requested": parseSpecReview,
163
163
  "parse.triggered": parseEmpty,
164
+ // BAPI-527: parse-after-merge terminal markers (details-less typed payload).
165
+ "parse.succeeded": parseEmpty,
166
+ "parse.failed": parseEmpty,
164
167
  };
165
168
  // ---------------------------------------------------------------------------
166
169
  // Public accessors
@@ -193,20 +196,35 @@ export function getHeadSha(event) {
193
196
  return normalizeEventHeadSha(details.head_sha);
194
197
  }
195
198
  /**
196
- * Resolve the immutable {@link MergeActionIdentity} from a worker-scoped `gate.met`
197
- * event. Returns `null` unless the event is a `gate.met` carrying a complete PR
198
- * binding (repo, pr_number, head_sha, gate_name) and a non-empty `worker_id`.
199
- * Run-level or incomplete events yield `null`. Preserves the historical
200
- * `required_checks` dual path (top-level then nested `ci_check_status`) and never
201
- * throws. Branch-name fields, if present, are ignored.
199
+ * Read and normalize a PR number from the CANONICAL `event.data.details.pr_number`
200
+ * path only (BAPI-525). Returns a positive integer PR number or `null` for
201
+ * missing/non-object details or a malformed value. Fail-closed. Used by the
202
+ * dispatched-backstop's local-first PR binding resolver to bind a ticket's PR from
203
+ * ledger events (e.g. `gate.met`) that carry both `pr_number` and `head_sha`,
204
+ * before falling back to a `gh` lookup.
205
+ */
206
+ export function getPrNumber(event) {
207
+ const details = getRawEventDetails(event);
208
+ if (!details)
209
+ return null;
210
+ return normalizePrNumber(details.pr_number);
211
+ }
212
+ /**
213
+ * Resolve the immutable {@link MergeActionIdentity} from a PR-bound `gate.met`
214
+ * event. The true merge identity is `(repo, pr_number, head_sha, gate_name)`;
215
+ * `worker_id` is attribution metadata only and is NOT required for identity
216
+ * extraction (BAPI-525 Change A). Returns `null` unless the event is a `gate.met`
217
+ * carrying a complete PR binding (repo, pr_number, head_sha, gate_name) — an
218
+ * incomplete PR binding remains fail-closed regardless of `worker_id`. A
219
+ * worker_id-less `gate.met` produced by the autonomous git-hook chain therefore
220
+ * yields the SAME non-null identity (and byte-identical `action_key`) as its
221
+ * worker-stamped twin. Preserves the historical `required_checks` dual path
222
+ * (top-level then nested `ci_check_status`) and never throws. Branch-name fields,
223
+ * if present, are ignored.
202
224
  */
203
225
  export function getMergeIdentity(event) {
204
226
  if (event.type !== "gate.met")
205
227
  return null;
206
- // Worker scope is required — a run-level gate.met never binds a specific worker.
207
- if (typeof event.worker_id !== "string" || event.worker_id.trim().length === 0) {
208
- return null;
209
- }
210
228
  const details = getEventDetails(event, "gate.met");
211
229
  if (details === null)
212
230
  return null;