@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.
- package/CONDUCTOR.md +75 -0
- package/README.md +8 -5
- package/build/agent-capabilities/probe-context.js +13 -3
- package/build/agent-capabilities/probes.js +262 -11
- package/build/agent-capabilities/reporter.js +1 -0
- package/build/agents.generated.js +1 -1
- package/build/backend-warnings.js +44 -0
- package/build/claude-settings.js +129 -0
- package/build/commands.generated.js +5 -3
- package/build/conductor/bridge-api-client.js +7 -7
- package/build/conductor/cli.js +65 -12
- package/build/conductor/deny-enforcement-preflight.js +96 -0
- package/build/conductor/doctor.js +183 -2
- package/build/conductor/epic-reconcile.js +9 -1
- package/build/conductor/epic-runtime.js +403 -43
- package/build/conductor/epic-state.js +7 -0
- package/build/conductor/errors.js +115 -3
- package/build/conductor/event-accessors.js +28 -10
- package/build/conductor/local-merge.js +458 -95
- package/build/conductor/merge-ledger.js +6 -4
- package/build/conductor/pr-ci-producer.js +17 -2
- package/build/conductor/producer-ledger.js +1 -1
- package/build/conductor/store.js +161 -18
- package/build/conductor/supervisor-merge.js +32 -5
- package/build/conductor/taxonomy.js +8 -0
- package/build/conductor/tools.js +28 -6
- package/build/conductor/worker-ledger-cli.js +244 -0
- package/build/conductor-bin.js +1884 -6917
- package/build/doctor.js +8 -0
- package/build/estimate-epic.js +84 -0
- package/build/executor/cli.js +229 -0
- package/build/executor/credentials.js +65 -0
- package/build/executor/deps.js +117 -0
- package/build/executor/env.js +79 -0
- package/build/executor/heartbeat.js +59 -0
- package/build/executor/http-client.js +131 -0
- package/build/executor/index.js +10 -0
- package/build/executor/job-errors.js +55 -0
- package/build/executor/job-log-registry.js +110 -0
- package/build/executor/job-runner.js +822 -0
- package/build/executor/job-types.js +60 -0
- package/build/executor/merge-job.js +229 -0
- package/build/executor/observation.js +123 -0
- package/build/executor/permissions.js +79 -0
- package/build/executor/preflight.js +144 -0
- package/build/executor/process.js +81 -0
- package/build/executor/prompt-spec.js +235 -0
- package/build/executor/results.js +134 -0
- package/build/executor/resume-pre-spawn.js +179 -0
- package/build/executor/runner.js +98 -0
- package/build/executor/terminal-mutation.js +34 -0
- package/build/executor/test-clock.js +109 -0
- package/build/executor/types.js +18 -0
- package/build/executor/verdict-artifact.js +53 -0
- package/build/executor/viewer-tabs.js +78 -0
- package/build/executor/watch-cli.js +113 -0
- package/build/executor/worker-command.js +106 -0
- package/build/executor/worker-finalization.js +177 -0
- package/build/executor/worker-log.js +92 -0
- package/build/executor/worktree-gc.js +134 -0
- package/build/executor/worktree-inspection.js +86 -0
- package/build/executor/worktree.js +103 -0
- package/build/index.js +14534 -10416
- package/build/mcp-invoke.js +19 -3
- package/build/mcp-provisioning.js +31 -25
- package/build/mcp-registration-doctor.js +27 -7
- package/build/mcp-server-invocation.js +152 -0
- package/build/pipelines.generated.js +16 -20
- package/build/readme.generated.js +1 -1
- package/build/sfcc/client.js +192 -50
- package/build/sfcc/ocapi-write-faults.js +94 -0
- package/build/sfcc/permissions.js +7 -22
- package/build/sfcc/reads-site-preference.js +52 -19
- package/build/sfcc/register.js +9 -0
- package/build/sfcc/write-grants.js +80 -0
- package/build/sfcc/write-guard.js +39 -0
- package/build/sfcc/write-result.js +47 -0
- package/build/sfcc/write-tool-common.js +85 -0
- package/build/sfcc/writes-custom-object-def.js +141 -0
- package/build/sfcc/writes-object-attribute-payloads.js +97 -0
- package/build/sfcc/writes-site-preference-payloads.js +59 -0
- package/build/sfcc/writes-site-preference.js +96 -0
- package/build/sfcc/writes-system-object-payloads.js +213 -0
- package/build/sfcc/writes-system-object.js +348 -0
- package/build/sfcc/writes.js +66 -0
- package/build/start-tickets-conductor.js +25 -93
- package/build/start-tickets-prereqs.js +152 -1
- package/build/start-tickets.js +96 -158
- package/build/version.generated.js +1 -1
- package/build/visual-diff-worker.js +313 -0
- package/build/visual-diff.js +632 -0
- package/build/worktree-core.js +202 -0
- package/package.json +8 -4
- package/pipelines/idea-to-ticket.json +7 -0
- package/pipelines/review-ticket.json +5 -18
- package/public/css/main.min.css +1612 -107
- package/public/css/main.min.css.map +1 -1
- package/public/js/main.min.js +10267 -1
- package/public/js/main.min.js.map +1 -1
- 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
|
|
107
|
-
// store.ts. Surfaced as a retryable-shaped 503 with a fixed,
|
|
108
|
-
// so the caller learns persistence is unavailable instead of
|
|
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
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
* `
|
|
201
|
-
*
|
|
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;
|