@bridge_gpt/mcp-server 0.2.34 → 0.2.36

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 (49) hide show
  1. package/README.md +456 -370
  2. package/build/agent-capabilities/probe-context.js +8 -1
  3. package/build/agent-capabilities/probes.js +7 -1
  4. package/build/agents.generated.js +1 -1
  5. package/build/claude-review-workflow.js +264 -0
  6. package/build/cli-release.js +53 -0
  7. package/build/commands.generated.js +4 -4
  8. package/build/conductor/bridge-api-client.js +215 -0
  9. package/build/conductor/deny-enforcement-preflight.js +1 -0
  10. package/build/conductor/done-gate.js +44 -5
  11. package/build/conductor/epic-reconcile.js +6 -0
  12. package/build/conductor/install-doctor.js +462 -0
  13. package/build/conductor-bin.js +3 -3
  14. package/build/conductor-bundle-artifacts.js +30 -9
  15. package/build/doctor.js +234 -1
  16. package/build/executor/cli.js +32 -5
  17. package/build/executor/credentials.js +45 -11
  18. package/build/executor/deps.js +14 -0
  19. package/build/executor/env.js +23 -6
  20. package/build/executor/index.js +4 -0
  21. package/build/executor/job-runner.js +119 -9
  22. package/build/executor/permissions.js +12 -2
  23. package/build/executor/preflight.js +95 -8
  24. package/build/executor/prompt-spec.js +51 -0
  25. package/build/executor/runner.js +15 -2
  26. package/build/executor/service-unit.js +876 -0
  27. package/build/executor/test-clock.js +8 -0
  28. package/build/executor/types.js +0 -17
  29. package/build/executor/worker-command.js +62 -9
  30. package/build/index.js +575 -143
  31. package/build/init.js +153 -51
  32. package/build/install-bridge-conductor.js +491 -0
  33. package/build/install-bridge.js +628 -175
  34. package/build/install-reexec.js +233 -0
  35. package/build/mcp-host-config.js +11 -1
  36. package/build/mcp-install-state.js +32 -0
  37. package/build/mcp-provisioning.js +22 -6
  38. package/build/pipelines.generated.js +14 -8
  39. package/build/readme.generated.js +1 -1
  40. package/build/run-unit-tests-launcher.js +257 -0
  41. package/build/setup-epic.js +117 -8
  42. package/build/upgrade-cli.js +1 -15
  43. package/build/version.generated.js +1 -1
  44. package/docs/CONDUCTOR.md +115 -4
  45. package/docs/install/mcp-tool-integrations.md +29 -21
  46. package/package.json +8 -5
  47. package/pipelines/implement-ticket.json +6 -1
  48. package/build/conductor/supervisor-judgment-python.js +0 -141
  49. package/build/conductor/supervisor-judgment.js +0 -215
@@ -92,6 +92,11 @@ export function makeFakeExecutorDeps(clock, overrides = {}) {
92
92
  fetch: async () => ({ status: 204, text: async () => "" }),
93
93
  log: () => { },
94
94
  errorLog: () => { },
95
+ mcpServerInvocation: {
96
+ form: "absolute-build-path",
97
+ nodeExecutable: "node",
98
+ serverEntryPath: "/repo/mcp_server/build/index.js",
99
+ },
95
100
  };
96
101
  return { ...base, ...overrides };
97
102
  }
@@ -111,6 +116,9 @@ export function makeTestOptions(overrides = {}) {
111
116
  baseBranch: "main",
112
117
  advisoryParserEnabled: false,
113
118
  defaultJobTimeoutSeconds: 1200,
119
+ // The executor requires an explicit base URL (BAPI-676) — supply a fake one
120
+ // so preflight-driven tests are not fatal on the URL prerequisite.
121
+ baseUrl: "http://localhost:8002",
114
122
  ...overrides,
115
123
  };
116
124
  }
@@ -1,18 +1 @@
1
- /**
2
- * Epic Conductor v2 executor — core type/boundary definitions (BAPI-534, TDD §7).
3
- *
4
- * ARCHITECTURE BOUNDARY (TDD §12, Req 1): files under `mcp_server/src/executor/`
5
- * are a dumb, pull-based local worker. They MUST NOT import from the v1
6
- * conductor event/ledger graph — `conductor/store.ts`, `conductor/taxonomy.ts`,
7
- * `conductor/event-accessors.ts`, `conductor/epic-runtime.ts`,
8
- * `conductor/epic-reconcile.ts`, `conductor/epic-state.ts`, or any conductor
9
- * producer / supervisor-runtime module. Allowed conductor reuse is limited to
10
- * read-only / deterministic helpers — the deny-enforcement preflight
11
- * (`conductor/deny-enforcement-preflight.ts`), and (BAPI-535 T3b) the local merge
12
- * executor (`conductor/local-merge.ts`) plus the read-only Bridge API access +
13
- * merge request/response types (`conductor/bridge-api-client.ts`) for the
14
- * deterministic `merge` job.
15
- * All subprocess / HTTP / filesystem / clock access is behind injected deps so
16
- * every requirement is unit-testable on Linux CI with no real I/O.
17
- */
18
1
  export {};
@@ -6,6 +6,7 @@
6
6
  * MCP config is ever added. When no safe alias is available, `--model` is omitted.
7
7
  */
8
8
  import { resolveAgentSpec, resolveModelAlias, isModelTier, isValidModelAlias, } from "../agent-registry.js";
9
+ import { ExecutorNamedError } from "./job-errors.js";
9
10
  import { isRecoveryJobType } from "./job-types.js";
10
11
  /**
11
12
  * Resolve the Claude model alias from a job payload. Accepts a direct
@@ -38,13 +39,17 @@ export function resolveExecutorModelAlias(payload) {
38
39
  * `implement` and the recovery jobs, builds the conservative
39
40
  * `/implement-ticket <ticket_key> --auto` prompt.
40
41
  *
41
- * Structured `payload.prompt_spec` rendering (the `spec_review` path) is NOT done
42
- * here: it needs the prepared worktree/git state, so `job-runner.ts` renders it
43
- * in the prepared-spawn path AFTER worktree preparation. `spec_review` therefore
44
- * returns `ok:false` from this function by design — that non-ok result is the
45
- * signal for the runner to fall through to prompt-spec rendering, not a terminal
46
- * failure. A real spawn job with neither an explicit prompt, a synthesis path,
47
- * nor a `prompt_spec` is the genuine contract failure.
42
+ * Structured `payload.prompt_spec` rendering is NOT done here: it needs the
43
+ * prepared worktree/git state, so `job-runner.ts` renders it in the prepared-spawn
44
+ * path AFTER worktree preparation. A job with a `prompt_spec` and no explicit
45
+ * prompt therefore returns `ok:false` from this function by design — that non-ok
46
+ * result is the signal for the runner to fall through to prompt-spec rendering,
47
+ * not a terminal failure. A real spawn job with neither an explicit prompt, a
48
+ * synthesis path, nor a `prompt_spec` is the genuine contract failure.
49
+ *
50
+ * BAPI-725: `spec_review` now arrives with an explicit server-built
51
+ * `payload.prompt` and so resolves on the first branch, like `implement` with an
52
+ * explicit prompt. It no longer depends on the prompt-spec fall-through.
48
53
  */
49
54
  /**
50
55
  * True for the job types that synthesize `/implement-ticket <KEY> --auto` when no
@@ -90,16 +95,64 @@ export function resolveExecutorPrompt(job) {
90
95
  error: `no usable prompt for job_type '${job.job_type}' (no payload.prompt and no ticket_key)`,
91
96
  };
92
97
  }
98
+ /** The ratified default — the pre-BAPI-725 behavior for every job. */
99
+ export const DEFAULT_WORKER_PERMISSION_POSTURE = "skip_permissions";
100
+ const WORKER_PERMISSION_POSTURES = [
101
+ "skip_permissions",
102
+ "accept_edits",
103
+ ];
104
+ /**
105
+ * Resolve the permission posture at the payload boundary.
106
+ *
107
+ * - ABSENT (`undefined`/`null`) → the ratified `skip_permissions` default, so
108
+ * legacy jobs enqueued before BAPI-725 keep working unchanged.
109
+ * - a supported value → returned as-is.
110
+ * - present but unsupported → THROWS a named contract error before argv
111
+ * construction, so the job fails loudly instead of spawning under a posture
112
+ * nobody chose.
113
+ *
114
+ * The thrown message names the FIELD and nothing else. An operator can paste a
115
+ * credential into a policy value by mistake, and this error text travels to the
116
+ * server through `/fail` — so echoing the supplied value would turn a typo into
117
+ * an exfiltration path.
118
+ */
119
+ export function resolveWorkerPermissionPosture(payload) {
120
+ const p = payload && typeof payload === "object" ? payload : {};
121
+ const raw = p.worker_permission_posture;
122
+ if (raw === undefined || raw === null) {
123
+ return DEFAULT_WORKER_PERMISSION_POSTURE;
124
+ }
125
+ if (typeof raw === "string" &&
126
+ WORKER_PERMISSION_POSTURES.includes(raw)) {
127
+ return raw;
128
+ }
129
+ throw new ExecutorNamedError("ContractError.PermissionPosture", "job payload worker_permission_posture is present but is not a supported posture " +
130
+ "(expected 'skip_permissions' or 'accept_edits').");
131
+ }
93
132
  /**
94
133
  * Build the exact headless Claude argv. `--model <alias>` is included only when
95
134
  * an alias is provided. No MCP config arguments are ever emitted.
135
+ *
136
+ * Exactly ONE permission form is emitted, selected by `posture`:
137
+ * `--dangerously-skip-permissions` for `skip_permissions`, or the two adjacent
138
+ * entries `--permission-mode acceptEdits` for `accept_edits`. They are mutually
139
+ * exclusive by construction — emitting both would let the skip flag win silently
140
+ * and make the policy key look effective while doing nothing.
141
+ *
142
+ * The posture changes how Claude PROMPTS, not what it may do: the deny layer is
143
+ * provisioned by `job-runner.ts` before the spawn in both postures.
96
144
  */
97
- export function buildClaudeExecutorArgv(prompt, alias) {
145
+ export function buildClaudeExecutorArgv(prompt, alias, posture = DEFAULT_WORKER_PERMISSION_POSTURE) {
98
146
  const argv = ["-p", prompt, "--output-format", "stream-json", "--verbose"];
99
147
  if (alias) {
100
148
  argv.push("--model", alias);
101
149
  }
102
- argv.push("--dangerously-skip-permissions");
150
+ if (posture === "accept_edits") {
151
+ argv.push("--permission-mode", "acceptEdits");
152
+ }
153
+ else {
154
+ argv.push("--dangerously-skip-permissions");
155
+ }
103
156
  return argv;
104
157
  }
105
158
  /** The worker executable is always exactly `claude`. */