@bridge_gpt/mcp-server 0.2.16 → 0.2.19
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 +2 -2
- 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 +3 -3
- package/build/backend-warnings.js +44 -0
- package/build/claude-settings.js +129 -0
- package/build/commands.generated.js +7 -6
- package/build/conductor/bridge-api-client.js +198 -18
- package/build/conductor/claude-hook.js +22 -4
- package/build/conductor/cli.js +76 -25
- package/build/conductor/deny-enforcement-preflight.js +96 -0
- package/build/conductor/doctor.js +183 -2
- package/build/conductor/done-gate.js +5 -0
- package/build/conductor/epic-reconcile.js +71 -14
- package/build/conductor/epic-runtime.js +839 -67
- package/build/conductor/epic-state.js +524 -63
- package/build/conductor/errors.js +156 -3
- package/build/conductor/event-accessors.js +252 -0
- package/build/conductor/file-scope-guard.js +201 -0
- package/build/conductor/github-mergeability.js +85 -0
- package/build/conductor/local-merge.js +47 -1
- package/build/conductor/merge-identity.js +41 -0
- package/build/conductor/merge-ledger.js +19 -72
- package/build/conductor/plan.js +12 -2
- package/build/conductor/pr-ci-producer.js +17 -2
- package/build/conductor/pr-discovery.js +11 -1
- package/build/conductor/producer-ledger.js +1 -1
- package/build/conductor/store.js +161 -18
- package/build/conductor/supervisor-config.js +4 -39
- package/build/conductor/supervisor-escalation.js +10 -26
- package/build/conductor/supervisor-ledger.js +5 -12
- package/build/conductor/supervisor-merge.js +32 -5
- package/build/conductor/supervisor-message-relay.js +2 -5
- package/build/conductor/supervisor-notification.js +1 -1
- package/build/conductor/supervisor-runtime.js +12 -54
- package/build/conductor/supervisor-state.js +4 -18
- package/build/conductor/supervisor-types.js +2 -2
- package/build/conductor/taxonomy.js +12 -0
- package/build/conductor/tools.js +28 -6
- package/build/conductor/worker-ledger-cli.js +244 -0
- package/build/conductor-bin.js +1800 -5166
- package/build/conductor-claude-hook-bin.js +4 -2
- package/build/doctor.js +40 -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 +688 -0
- package/build/executor/job-types.js +60 -0
- package/build/executor/merge-job.js +155 -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 +97 -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 +13950 -9669
- package/build/install-bridge.js +25 -8
- package/build/install-doctor.js +387 -0
- 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 +31 -6
- package/build/readme.generated.js +1 -1
- package/build/regression-check.js +53 -1
- package/build/review-tickets.js +175 -21
- package/build/sfcc/reads-site-preference.js +52 -19
- package/build/start-tickets-conductor.js +47 -99
- package/build/start-tickets-prereqs.js +185 -4
- package/build/start-tickets.js +218 -180
- 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 +10 -6
- package/pipelines/review-ticket.json +24 -2
- package/public/css/main.min.css +3311 -1
- package/public/css/main.min.css.map +1 -1
- package/public/js/main.min.js +7924 -1
- package/public/js/main.min.js.map +1 -1
- package/smoke-test/SMOKE-TEST.md +5 -2
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared, dependency-injected model for how a dispatched worker launches the
|
|
3
|
+
* Bridge MCP `mcp-invoke` shim (BAPI-526, Change A).
|
|
4
|
+
*
|
|
5
|
+
* The conductor used to register each dispatched worktree's `.mcp.json` against
|
|
6
|
+
* an EXACT npm version (`npx -y @bridge_gpt/mcp-server@<VERSION> mcp-invoke …`).
|
|
7
|
+
* When that version was built but not yet published, `npx` returned ETARGET/404
|
|
8
|
+
* and the worker had NO Bridge MCP tools. This module lets provisioning instead
|
|
9
|
+
* invoke the conductor's own on-disk build by ABSOLUTE PATH
|
|
10
|
+
* (`node <abs>/mcp_server/build/index.js mcp-invoke …`) — removing the
|
|
11
|
+
* npm-registry publish dependency and guaranteeing the worker runs the exact MCP
|
|
12
|
+
* code the conductor is running. A resolvable npm-channel spec remains the
|
|
13
|
+
* fallback when an on-disk build entry cannot be resolved (published-package
|
|
14
|
+
* install).
|
|
15
|
+
*
|
|
16
|
+
* SCOPE BOUNDARY (BAPI-526 is detection/registration only): this selects WHICH
|
|
17
|
+
* server file is invoked (`node <absPath>/index.js` vs `npx @…`). It does NOT
|
|
18
|
+
* change WHICH Node binary runs that file — the `nodeExecutable` field is kept as
|
|
19
|
+
* a single substitutable value (never string-concatenated into the command) so
|
|
20
|
+
* the later Ticket 3 (P2) work can point it at `CONDUCTOR_NODE_PATH` without
|
|
21
|
+
* re-plumbing argv construction.
|
|
22
|
+
*/
|
|
23
|
+
import path from "node:path";
|
|
24
|
+
export const MCP_SERVER_PACKAGE_NAME = "@bridge_gpt/mcp-server";
|
|
25
|
+
/**
|
|
26
|
+
* Resolvable npm-channel fallback spec. Deliberately a moving channel (`@latest`)
|
|
27
|
+
* rather than an exact generated version pin, so the fallback path can never
|
|
28
|
+
* reintroduce the ETARGET/404 failure the absolute-path form exists to remove.
|
|
29
|
+
*/
|
|
30
|
+
export const DEFAULT_MCP_SERVER_NPM_CHANNEL_SPEC = "@bridge_gpt/mcp-server@latest";
|
|
31
|
+
/**
|
|
32
|
+
* Build the concrete `{ command, args }` launch pair for a target + worktree from
|
|
33
|
+
* a structured invocation. Pure — no filesystem or process access. The
|
|
34
|
+
* `nodeExecutable` is returned as the standalone `command`, never concatenated
|
|
35
|
+
* with the server entry path, so `CONDUCTOR_NODE_PATH` can substitute it later.
|
|
36
|
+
*/
|
|
37
|
+
export function buildMcpShimCommand(invocation, target, absoluteWorktreePath) {
|
|
38
|
+
if (invocation.form === "absolute-build-path") {
|
|
39
|
+
return {
|
|
40
|
+
command: invocation.nodeExecutable,
|
|
41
|
+
args: [
|
|
42
|
+
invocation.serverEntryPath,
|
|
43
|
+
"mcp-invoke",
|
|
44
|
+
"--target",
|
|
45
|
+
target,
|
|
46
|
+
"--project-root",
|
|
47
|
+
absoluteWorktreePath,
|
|
48
|
+
],
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
command: "npx",
|
|
53
|
+
args: [
|
|
54
|
+
"-y",
|
|
55
|
+
invocation.packageSpec,
|
|
56
|
+
"mcp-invoke",
|
|
57
|
+
"--target",
|
|
58
|
+
target,
|
|
59
|
+
"--project-root",
|
|
60
|
+
absoluteWorktreePath,
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Secret-free, path-free audit label for summaries and diagnostics. Returns ONLY
|
|
66
|
+
* the registration form; never the server entry path, username, argv, or package
|
|
67
|
+
* cache path (any of which can leak a username through a filesystem path).
|
|
68
|
+
*/
|
|
69
|
+
export function formatMcpShimInvocationForAudit(invocation) {
|
|
70
|
+
return invocation.form;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Resolve the package root from a module URL by walking the module file path and
|
|
74
|
+
* locating the nearest `src` or `build` path segment; the package root is the
|
|
75
|
+
* portion BEFORE that segment. Returns forward-slash form so it is deterministic
|
|
76
|
+
* across platforms (Node accepts forward slashes on Windows). Does NOT consult
|
|
77
|
+
* `process.cwd()`. Returns `null` when neither `src` nor `build` appears.
|
|
78
|
+
*/
|
|
79
|
+
export function resolvePackageRootFromModuleUrl(moduleUrl) {
|
|
80
|
+
// Parse the URL's pathname directly rather than via fileURLToPath: on Windows,
|
|
81
|
+
// fileURLToPath throws ERR_INVALID_FILE_URL_PATH for a drive-less `file:///…`
|
|
82
|
+
// URL, whereas the pathname (`/repo/mcp_server/…`) is available on every
|
|
83
|
+
// platform. This keeps resolution deterministic across POSIX and Windows.
|
|
84
|
+
let pathname;
|
|
85
|
+
try {
|
|
86
|
+
pathname = decodeURIComponent(new URL(moduleUrl).pathname);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
// A real Windows `import.meta.url` is `file:///C:/…`, whose pathname is
|
|
92
|
+
// `/C:/…`; strip the leading slash so the drive letter leads (Node accepts
|
|
93
|
+
// forward slashes on Windows). Drive-less POSIX pathnames are left unchanged.
|
|
94
|
+
if (/^\/[A-Za-z]:/.test(pathname)) {
|
|
95
|
+
pathname = pathname.slice(1);
|
|
96
|
+
}
|
|
97
|
+
// Split on both separators so a Windows-materialized path (backslashes) and a
|
|
98
|
+
// posix path both segment identically.
|
|
99
|
+
const segments = pathname.split(/[\\/]/);
|
|
100
|
+
let markerIndex = -1;
|
|
101
|
+
for (let i = segments.length - 1; i >= 0; i--) {
|
|
102
|
+
if (segments[i] === "src" || segments[i] === "build") {
|
|
103
|
+
markerIndex = i;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (markerIndex <= 0)
|
|
108
|
+
return null;
|
|
109
|
+
return segments.slice(0, markerIndex).join("/");
|
|
110
|
+
}
|
|
111
|
+
/** Manual basename that tolerates either path separator. */
|
|
112
|
+
function basenameAnySep(filePath) {
|
|
113
|
+
const segments = filePath.split(/[\\/]/);
|
|
114
|
+
return segments[segments.length - 1] ?? "";
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Resolve how the worker MCP shim should be launched, preferring the conductor's
|
|
118
|
+
* own on-disk build by absolute path and falling back to a resolvable npm channel.
|
|
119
|
+
*
|
|
120
|
+
* Resolution order (never uses `process.cwd()`):
|
|
121
|
+
* 1. `<packageRoot>/build/index.js` derived from `deps.moduleUrl`.
|
|
122
|
+
* 2. `deps.argv1` when it is absolute, exists, and its basename is `index.js`.
|
|
123
|
+
* 3. npm-channel fallback (`deps.npmPackageSpec ?? DEFAULT_MCP_SERVER_NPM_CHANNEL_SPEC`).
|
|
124
|
+
*
|
|
125
|
+
* NOTE (scope boundary): this ticket changes WHICH server file is invoked, not
|
|
126
|
+
* WHICH Node runtime runs it. `nodeExecutable` defaults to `"node"` (NOT
|
|
127
|
+
* `process.execPath`) to preserve today's worker runtime selection; Ticket 3 (P2)
|
|
128
|
+
* can later inject `CONDUCTOR_NODE_PATH` into this single field.
|
|
129
|
+
*/
|
|
130
|
+
export function resolveMcpShimInvocationForRuntime(deps) {
|
|
131
|
+
const nodeExecutable = deps.nodeExecutable ?? "node";
|
|
132
|
+
const packageRoot = resolvePackageRootFromModuleUrl(deps.moduleUrl);
|
|
133
|
+
if (packageRoot) {
|
|
134
|
+
const candidate = `${packageRoot}/build/index.js`;
|
|
135
|
+
if (deps.fileExists(candidate)) {
|
|
136
|
+
return { form: "absolute-build-path", nodeExecutable, serverEntryPath: candidate };
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const argv1 = deps.argv1;
|
|
140
|
+
if (typeof argv1 === "string" &&
|
|
141
|
+
argv1.length > 0 &&
|
|
142
|
+
path.isAbsolute(argv1) &&
|
|
143
|
+
basenameAnySep(argv1) === "index.js" &&
|
|
144
|
+
deps.fileExists(argv1)) {
|
|
145
|
+
return { form: "absolute-build-path", nodeExecutable, serverEntryPath: argv1 };
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
form: "npm-channel",
|
|
149
|
+
command: "npx",
|
|
150
|
+
packageSpec: deps.npmPackageSpec ?? DEFAULT_MCP_SERVER_NPM_CHANNEL_SPEC,
|
|
151
|
+
};
|
|
152
|
+
}
|