@bridge_gpt/mcp-server 0.2.74 → 0.2.75

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 (62) hide show
  1. package/README.md +14 -7
  2. package/build/agent-launchers/prompt.js +9 -21
  3. package/build/agents.generated.js +2 -2
  4. package/build/authored-plan.js +542 -0
  5. package/build/bridge-permissions.js +8 -0
  6. package/build/commands.generated.js +5 -5
  7. package/build/conductor/bridge-api-client.js +666 -46
  8. package/build/conductor/epic-implementer-cli.js +337 -93
  9. package/build/conductor/gate-discovery.js +209 -9
  10. package/build/conductor/gate-settings-review.js +7 -11
  11. package/build/conductor/launch-plan.js +58 -12
  12. package/build/conductor/open-decision-phrases.js +50 -0
  13. package/build/conductor/prerequisite-inputs.js +181 -14
  14. package/build/connect-github-api.js +18 -0
  15. package/build/connect-github.js +35 -18
  16. package/build/docs.generated.js +2 -2
  17. package/build/drive-epic.js +387 -12
  18. package/build/epic-ci-workflow.js +3 -2
  19. package/build/epic-implementer-bin.js +152 -38
  20. package/build/epic-implementer-bundle-cli.js +61 -0
  21. package/build/epic-implementer-claude-hook-bin.js +1 -1
  22. package/build/epic-implementer-env.js +3 -4
  23. package/build/epic-integration-pr.js +5 -2
  24. package/build/executor/completion-contract.js +24 -1
  25. package/build/executor/gate-qualification-job.js +193 -23
  26. package/build/executor/gate-qualification-tests-ran.js +232 -0
  27. package/build/executor/job-runner.js +9 -722
  28. package/build/executor/job-type-wrappers.js +734 -0
  29. package/build/executor/preflight.js +6 -2
  30. package/build/executor/process-containment.js +8 -1
  31. package/build/executor/required-verification.js +28 -2
  32. package/build/executor/runner.js +4 -1
  33. package/build/executor/types.js +9 -0
  34. package/build/executor/worker-database.js +6 -1
  35. package/build/executor/worker-guard-hook.js +24 -2
  36. package/build/generated/ticket-status.js +20 -0
  37. package/build/index.js +391 -257
  38. package/build/install-bridge-conductor-answers.js +28 -1
  39. package/build/install-bridge-conductor-apply.js +11 -3
  40. package/build/install-bridge-conductor-assessment.js +114 -12
  41. package/build/install-bridge-conductor-compact.js +2 -0
  42. package/build/install-bridge-conductor-gate.js +257 -80
  43. package/build/install-bridge-conductor-setup.js +4 -4
  44. package/build/install-bridge-conductor-trial-report.js +170 -0
  45. package/build/install-bridge-conductor.js +303 -31
  46. package/build/pipelines.generated.js +7 -7
  47. package/build/plan-generation.js +17 -0
  48. package/build/printed-remedy-commands.js +54 -0
  49. package/build/readme.generated.js +1 -1
  50. package/build/repository-toolchains.js +11 -5
  51. package/build/scripts/saved-commands-config-field-driver.js +65 -0
  52. package/build/setup-epic.js +10 -1
  53. package/build/test-support/executor-source-files.js +1 -1
  54. package/build/v2-readiness-requirements.js +5 -1
  55. package/build/version.generated.js +3 -3
  56. package/build/worker-guard-hook-bin.js +2 -2
  57. package/docs/EPIC-IMPLEMENTER.md +4 -4
  58. package/docs/install/github-app.md +79 -92
  59. package/package.json +1 -1
  60. package/build/conductor/epic-reconcile.js +0 -603
  61. package/build/conductor/epic-runtime.js +0 -2020
  62. package/build/conductor/epic-state.js +0 -774
@@ -12,7 +12,7 @@ import { spawnSync } from "node:child_process";
12
12
  import { defaultResolveBinPath } from "../start-tickets-conductor.js";
13
13
  import { CORRECTION_INTENT_CAPABILITY } from "./correction-dispatch.js";
14
14
  import { resolveAllExecutorApiAccess, resolveBaseUrl, EXECUTOR_BASE_URL_REQUIRED_MESSAGE, } from "./credentials.js";
15
- import { FOCUSED_REBASE_CAPABILITY, GATE_QUALIFICATION_CAPABILITY, SCOPE_WAIT_CAPABILITY, } from "./types.js";
15
+ import { FOCUSED_REBASE_CAPABILITY, GATE_QUALIFICATION_CAPABILITY, GATE_QUALIFICATION_WORKER_DATABASE_CAPABILITY, SCOPE_WAIT_CAPABILITY, } from "./types.js";
16
16
  /**
17
17
  * Environment override for the deny probe's headless timeout (BAPI-722).
18
18
  *
@@ -674,7 +674,11 @@ export function buildClaimManifest(report, options, freeSlots) {
674
674
  // pick up repository-level qualification work it was never dedicated to.
675
675
  // Gating the token on `repoWide` keeps that work on the executor whose
676
676
  // operator chose the whole repository.
677
- ...(options.repoWide === true ? [GATE_QUALIFICATION_CAPABILITY] : []),
677
+ // BAPI-1698: the worker-database qualification capability rides the same
678
+ // repository-wide gate, beside the base token it extends.
679
+ ...(options.repoWide === true
680
+ ? [GATE_QUALIFICATION_CAPABILITY, GATE_QUALIFICATION_WORKER_DATABASE_CAPABILITY]
681
+ : []),
678
682
  ],
679
683
  // BAPI-1391: an optional job-type filter, present only when configured. An
680
684
  // older server rejects the key with a 422, so it must never appear by
@@ -6,7 +6,14 @@
6
6
  * process the job started is still running. This module produces that
7
7
  * confirmation as a closed `CompletionCleanup` verdict. The verdict is
8
8
  * SUCCESS-BLOCKING: anything other than `confirmed` with zero survivors refuses
9
- * success (`successRefusalReason` in `completion-contract.ts`).
9
+ * success (`successRefusalReason` in `completion-contract.ts`), with ONE
10
+ * exception (BAPI-1690): a `failed` verdict with a positive integer survivor
11
+ * count and exactly the single reason `survivors_detected` (`isAllStoppedCleanup`).
12
+ * That reason list is only produced when the sweep terminated every detected
13
+ * process and the confirmation sweep then found none remaining; any other
14
+ * reason (ownership_unverifiable, enumeration_failed, sweep_deadline_exhausted,
15
+ * not_run) means termination or confirmation is unproven and still blocks.
16
+ * The recorded verdict stays `failed`; the sweep logic is unchanged.
10
17
  *
11
18
  * WHAT THIS IS NOT. It is not the adapter's configuration lifecycle cleanup in
12
19
  * `agent-launchers/executor-adapter.ts` (temporary config files, isolation
@@ -111,9 +111,22 @@ export async function runRequiredVerificationCommands(input) {
111
111
  outcome = "cancelled";
112
112
  reason = input.ownershipHeld && !input.ownershipHeld() ? "ownership_lost" : "executor_cancelled";
113
113
  break;
114
- default:
114
+ case "killed_by_signal":
115
+ // BAPI-1698: the command ran and was killed by a signal nobody requested.
116
+ // A failure like any non-zero exit, so it keeps the non-zero stop rule.
117
+ outcome = "exited_nonzero";
118
+ reason = "killed_by_signal";
119
+ break;
120
+ case "launch_error":
121
+ outcome = "launch_error";
122
+ reason = "spawn_failed";
123
+ break;
124
+ default: {
125
+ const unhandled = launched.outcome;
126
+ void unhandled;
115
127
  outcome = "launch_error";
116
128
  reason = "spawn_failed";
129
+ }
117
130
  }
118
131
  facts.push({
119
132
  identity: command.identity,
@@ -276,12 +289,25 @@ export function createSupervisedCommandLauncher(input) {
276
289
  drainDeadlineMs: CHECK_DRAIN_BOUND_MS,
277
290
  });
278
291
  const output = `${result.stdoutExcerpt}\n${result.stderrExcerpt}`;
292
+ // BAPI-1698 — the order is load-bearing. Only an executor-side request
293
+ // (an abort, a timeout, a requested termination) is an interruption; a
294
+ // process that never started is a launch error; a started process killed
295
+ // by a signal nobody requested is a failure of the command.
279
296
  if (cancelled)
280
297
  return { outcome: { kind: "cancelled" }, output };
281
298
  if (result.classification === "timeout")
282
299
  return { outcome: { kind: "timed_out" }, output };
300
+ if (controller.isTerminationRequested())
301
+ return { outcome: { kind: "cancelled" }, output };
302
+ if (proc.pid === undefined && result.exitCode === null) {
303
+ // The spawn boundary reports a failed start (a missing program or
304
+ // folder) as no pid and no exit code — never inferred from exit 127.
305
+ return { outcome: { kind: "launch_error" }, output };
306
+ }
307
+ if (result.signal !== null)
308
+ return { outcome: { kind: "killed_by_signal" }, output };
283
309
  if (result.exitUnconfirmed || result.exitCode === null) {
284
- // Killed or vanished without an exit code we can trust: not an exit.
310
+ // Vanished without an exit code we can trust: not an exit.
285
311
  return { outcome: { kind: "cancelled" }, output };
286
312
  }
287
313
  return { outcome: { kind: "exited", exitCode: result.exitCode }, output };
@@ -360,7 +360,9 @@ export async function runExecutor(options, deps, httpClient, seams = {}) {
360
360
  * this requests the epic's existing draft integration pull request be
361
361
  * marked ready for review — it never creates a merge and never merges
362
362
  * anything; only a human merges an epic integration branch (see
363
- * `epic-integration-pr.ts`). Every failure here — a missing read
363
+ * `epic-integration-pr.ts`). It also never opens a pull request: `done`
364
+ * usually follows the integration PR's merge, so finding none open is the
365
+ * normal end of a run, not a gap to fill. Every failure here — a missing read
364
366
  * capability, a sanitized transport/validation failure, an invalid branch,
365
367
  * or an unexpected throw — is ADVISORY: it is logged (credential-free,
366
368
  * bounded) and never affects claiming, running jobs, or the runner's exit.
@@ -413,6 +415,7 @@ export async function runExecutor(options, deps, httpClient, seams = {}) {
413
415
  baseBranch: options.baseBranch,
414
416
  command: "executor wind-down",
415
417
  requestReady: true,
418
+ createIfAbsent: false,
416
419
  gh,
417
420
  cwd: deps.cwd,
418
421
  });
@@ -53,6 +53,15 @@ export const EXECUTOR_CLASSIFICATION_VALUES = [
53
53
  * `required_capabilities`, so only a claim declaring it can take such a job.
54
54
  */
55
55
  export const GATE_QUALIFICATION_CAPABILITY = "gate_qualification.v1";
56
+ /**
57
+ * BAPI-1698 — the capability a repository-wide executor declares when it can
58
+ * provision and drop a disposable worker database for a `gate_qualification`
59
+ * job whose sealed declaration carries `worker_database`. The server requires it
60
+ * only for such a job, so an older executor leaves the job queued for a newer
61
+ * one. Mirrors `GATE_QUALIFICATION_WORKER_DATABASE_CAPABILITY` in
62
+ * `src/python/llms/executor_completion_contract.py`.
63
+ */
64
+ export const GATE_QUALIFICATION_WORKER_DATABASE_CAPABILITY = "gate_qualification.worker_database.v1";
56
65
  /**
57
66
  * BAPI-1311 — the capability an executor declares when it can run a FOCUSED
58
67
  * merge-stage `rebase`: validate `payload.focused_rebase` before any worker
@@ -790,9 +790,13 @@ export function classifyWorkerDatabaseMigrationFailure(result) {
790
790
  function buildAlembicEnv(name, config, deps, workerEnvOption) {
791
791
  const env = buildExecutorBaseWorkerEnv({ PATH: deps.clientPath, HOME: deps.clientHome }, { workerDatabase: { name }, workerDatabaseConfig: config, legacyNotice: false, ...workerEnvOption });
792
792
  // Two worker-only switches the shared builder always sets; a migration never
793
- // needed them, and provisioning behavior is unchanged.
793
+ // needed them, and provisioning behavior is unchanged. A repository may also
794
+ // declare PYTHON_DOTENV_DISABLED in its worker_env for its workers; the
795
+ // migration runs from the operator checkout and may still read that
796
+ // checkout's `.env`, so it is dropped here too.
794
797
  delete env.BRIDGE_SKIP_PREPUSH;
795
798
  delete env.MAX_MCP_OUTPUT_TOKENS;
799
+ delete env.PYTHON_DOTENV_DISABLED;
796
800
  return env;
797
801
  }
798
802
  /**
@@ -1082,6 +1086,7 @@ function buildOfflineAlembicEnv(deps, options) {
1082
1086
  });
1083
1087
  delete env.BRIDGE_SKIP_PREPUSH;
1084
1088
  delete env.MAX_MCP_OUTPUT_TOKENS;
1089
+ delete env.PYTHON_DOTENV_DISABLED;
1085
1090
  return env;
1086
1091
  }
1087
1092
  /** Run one offline Alembic command and map interruption and failure to a row result. */
@@ -111,6 +111,12 @@ export function renderWorkerGuardReason(category, family, form) {
111
111
  "made outside the worker. Do not run regenerate-plan or call its route; record the " +
112
112
  "step escalated with its reason and continue.");
113
113
  }
114
+ if (category === "operator-verb" && (family === "reserve-council" || family === "record-decision")) {
115
+ return (`${WORKER_GUARD_REASON_PREFIX}: denied ${family} (${category}). ` +
116
+ "Convening or settling an open-decision council is the run driver's decision, " +
117
+ "made outside the worker. Do not run reserve-council or record-decision; record " +
118
+ "the open choice as an escalated step with its reason and continue.");
119
+ }
114
120
  if (category === "operator-verb" && family === "acknowledge-gaps") {
115
121
  return (`${WORKER_GUARD_REASON_PREFIX}: denied ${family} (${category}). ` +
116
122
  "Acknowledging the run's carried-gap list is the run owner's decision, made " +
@@ -1022,7 +1028,14 @@ function isClaudeWorkflowPrintLaunch(segment) {
1022
1028
  * the owner's one acknowledgement of the run's carried-gap list (route segment
1023
1029
  * `/acknowledge-gaps`), the same way.
1024
1030
  */
1025
- const OPERATOR_ONLY_VERBS = ["resolve-handoff", "regenerate-plan", "acknowledge-gaps"];
1031
+ // BAPI-1705: a worker never convenes or settles a driver council either.
1032
+ const OPERATOR_ONLY_VERBS = [
1033
+ "resolve-handoff",
1034
+ "regenerate-plan",
1035
+ "acknowledge-gaps",
1036
+ "reserve-council",
1037
+ "record-decision",
1038
+ ];
1026
1039
  /** The packaged MCP-server package token after `npx` (any version suffix). */
1027
1040
  const BRIDGE_PACKAGE_TOKEN = /^@bridge_gpt\/mcp-server(?:@\S+)?$/;
1028
1041
  /** Package runners whose package argument launches the packaged CLI. */
@@ -1070,7 +1083,16 @@ function namedOperatorOnlyRoute(token) {
1070
1083
  break;
1071
1084
  decoded = next;
1072
1085
  }
1073
- return OPERATOR_ONLY_VERBS.find((verb) => decoded.toLowerCase().includes(`/${verb}`) || token.toLowerCase().includes(`/${verb}`));
1086
+ const haystacks = [decoded.toLowerCase(), token.toLowerCase()];
1087
+ // BAPI-1705: the two council verbs share one route segment, `/driver-councils`.
1088
+ // A segment followed by a council row id is the settle (record-decision); the
1089
+ // bare collection is the reserve. Both are denied either way.
1090
+ for (const text of haystacks) {
1091
+ const council = /\/driver-councils(\/[^/?#\s"'`]+)?/.exec(text);
1092
+ if (council)
1093
+ return council[1] ? "record-decision" : "reserve-council";
1094
+ }
1095
+ return OPERATOR_ONLY_VERBS.find((verb) => haystacks.some((text) => text.includes(`/${verb}`)));
1074
1096
  }
1075
1097
  /** Node options whose next token is a value, not the script. */
1076
1098
  const NODE_VALUE_OPTIONS = new Set([
@@ -0,0 +1,20 @@
1
+ // Generated by scripts/generate_ticket_status_types.py. Do not edit.
2
+ export const EPIC_TICKET_STATUS_VALUES = [
3
+ "planned",
4
+ "ready",
5
+ "dispatched",
6
+ "running",
7
+ "blocked",
8
+ "abandoned",
9
+ "done",
10
+ "ready_for_review",
11
+ "reviewing",
12
+ "spec_review",
13
+ "implementing",
14
+ "ci",
15
+ "code_review",
16
+ "merging",
17
+ "parsing",
18
+ "smoke",
19
+ "needs_human",
20
+ ];