@bridge_gpt/mcp-server 0.2.75 → 0.2.77
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/README.md +8 -6
- package/build/agents.generated.js +5 -5
- package/build/cli-dispatch.js +333 -0
- package/build/codex-auto-recovery.js +25 -7
- package/build/commands.generated.js +8 -8
- package/build/conductor/bridge-api-client.js +193 -13
- package/build/conductor/declare-blocked.js +146 -7
- package/build/conductor/driver-pass.js +8 -0
- package/build/conductor/driver-register.js +8 -2
- package/build/conductor/epic-implementer-cli.js +15 -10
- package/build/conductor/epic-server-journal.js +52 -22
- package/build/conductor/epic-server-recipe.js +15 -5
- package/build/conductor/epic-server-runtime.js +163 -45
- package/build/conductor/epic-server.js +13 -6
- package/build/conductor/install-doctor.js +30 -2
- package/build/conductor/launch-plan.js +28 -7
- package/build/conductor/local-merge.js +55 -13
- package/build/conductor/pr-ci-producer.js +12 -3
- package/build/conductor/readiness-prerequisites.js +89 -2
- package/build/conductor/readiness-sections.js +46 -13
- package/build/conductor/readiness.js +3 -40
- package/build/conductor/recovery-cli.js +14 -12
- package/build/conductor/repository-workflow-remedy.js +147 -7
- package/build/conductor/ui-readiness.js +224 -0
- package/build/conductor/wait-run-attention.js +9 -4
- package/build/conductor/wait-run-cli.js +9 -2
- package/build/docs.generated.js +67 -4
- package/build/doctor.js +97 -1
- package/build/drive-epic.js +625 -33
- package/build/engine-paths.js +10 -0
- package/build/epic-coherence-input-cli.js +105 -10
- package/build/epic-coherence-input.js +877 -4
- package/build/epic-coherence-input.test-fixtures.js +117 -0
- package/build/epic-implementer-bin.js +947 -120
- package/build/epic-implementer-env.js +2 -2
- package/build/epic-launch-context.js +8 -1
- package/build/epic-shared/cut-protocol.js +55 -3
- package/build/executor/completion-contract.js +14 -1
- package/build/executor/failure-reason-codes.js +2 -0
- package/build/executor/guarded-fast-forward-push.js +25 -2
- package/build/executor/integration-job.js +56 -2
- package/build/executor/job-runner.js +87 -28
- package/build/executor/likely-tests.js +78 -6
- package/build/executor/merge-job.js +45 -1
- package/build/executor/permissions.js +187 -2
- package/build/executor/provider-checks.js +101 -5
- package/build/executor/rebase-finalization.js +29 -27
- package/build/executor/reconcile-overlap-job.js +70 -17
- package/build/executor/rename-aside.js +265 -0
- package/build/executor/required-work-ledger.js +89 -6
- package/build/executor/resume-pre-spawn.js +32 -8
- package/build/executor/runner.js +26 -4
- package/build/executor/types.js +121 -0
- package/build/executor/worktree.js +39 -2
- package/build/index.js +2500 -495
- package/build/init.js +16 -0
- package/build/install-bridge-conductor-answers.js +4 -0
- package/build/install-bridge-conductor-apply.js +10 -0
- package/build/install-bridge-conductor-assessment.js +84 -0
- package/build/install-bridge-conductor-contracts.js +9 -1
- package/build/install-bridge-conductor-setup.js +103 -3
- package/build/install-bridge-conductor.js +440 -812
- package/build/install-bridge.js +4 -11
- package/build/language-catalog.generated.js +2649 -0
- package/build/mcp-host-config.js +54 -37
- package/build/phase-context-git-probe.js +16 -0
- package/build/pipelines.generated.js +47 -19
- package/build/plan-execution-ledger.js +35 -0
- package/build/plan-generation.js +34 -0
- package/build/plane/build-freshness.js +6 -0
- package/build/plane/cli.js +12 -5
- package/build/plane/plane-freshness.js +43 -26
- package/build/printed-remedy-commands.js +17 -0
- package/build/readiness-prerequisites.generated.js +28 -0
- package/build/readme.generated.js +1 -1
- package/build/run-unit-tests-launcher.js +3 -1
- package/build/secret-redaction.js +3 -0
- package/build/server.js +7946 -0
- package/build/setup-epic.js +41 -8
- package/build/start-tickets-prereqs.js +3 -6
- package/build/test-support/console-guard.js +30 -0
- package/build/test-support/create-preview-world.js +232 -0
- package/build/test-support/module-imports.js +155 -0
- package/build/test-support/server-client.js +96 -0
- package/build/test-support/stdio-server.js +146 -0
- package/build/ticket-delivery.js +65 -0
- package/build/v2-readiness-requirements.js +39 -5
- package/build/version.generated.js +3 -3
- package/build/worktree-core.js +51 -7
- package/docs/EPIC-IMPLEMENTER.md +150 -2
- package/docs/epic-implementer/getting-started.md +5 -1
- package/package.json +3 -3
- package/pipelines/implement-ticket.json +2 -2
- package/pipelines/learn-repository.json +19 -1
package/build/init.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { writeFile, mkdir, readFile, stat, lstat, access, realpath } from "fs/promises";
|
|
13
13
|
import { execFile } from "child_process";
|
|
14
|
+
import { resolveProfiles } from "./mcp-profile.js";
|
|
14
15
|
import path from "path";
|
|
15
16
|
import os from "os";
|
|
16
17
|
import { buildPackagedAssetCatalog } from "./generated-assets-catalog.js";
|
|
@@ -271,6 +272,12 @@ export class DuplicateRegistrationError extends Error {
|
|
|
271
272
|
* half-updated with no record of what moved, which is the same all-or-nothing
|
|
272
273
|
* guarantee `runInit`'s preflight provides.
|
|
273
274
|
*
|
|
275
|
+
* BAPI-1719: an entry that already loads the group, resolved the way the runtime
|
|
276
|
+
* resolves it (`full` and any-case spellings count), is skipped and its file is
|
|
277
|
+
* not rewritten. The raw-token append below is unchanged: it extends the original
|
|
278
|
+
* comma-separated value (`sfcc` becomes `sfcc,epic_implementer`) and never
|
|
279
|
+
* serializes the resolver's expanded set.
|
|
280
|
+
*
|
|
274
281
|
* Returns the final resolved profile string (comma-joined) after merging, or an
|
|
275
282
|
* empty string if no config file was found or updated.
|
|
276
283
|
*
|
|
@@ -327,6 +334,15 @@ export async function mergeBridgeApiProfileToken(cwd, token) {
|
|
|
327
334
|
// ---- Pass 2: apply. Every target here was proven unambiguous above. ----
|
|
328
335
|
let lastProfile = "";
|
|
329
336
|
for (const { fullPath, parsed, entry } of pending) {
|
|
337
|
+
// BAPI-1719: an entry whose stored profile already RESOLVES the group (for
|
|
338
|
+
// example `full`, or any-case `Epic_Implementer`) is left untouched: no
|
|
339
|
+
// rewrite, so its bytes and whitespace are preserved. Uses `mcp-profile.js`
|
|
340
|
+
// directly; `mcp-host-config.ts` imports this file, so the reverse import
|
|
341
|
+
// would be a cycle.
|
|
342
|
+
const storedForCheck = entry.env?.BRIDGE_MCP_PROFILE;
|
|
343
|
+
if (resolveProfiles(typeof storedForCheck === "string" ? storedForCheck : undefined).has(token)) {
|
|
344
|
+
continue;
|
|
345
|
+
}
|
|
330
346
|
if (!entry.env)
|
|
331
347
|
entry.env = {};
|
|
332
348
|
const existing = entry.env.BRIDGE_MCP_PROFILE;
|
|
@@ -83,6 +83,10 @@ const OPTION_VOCABULARY = Object.freeze({
|
|
|
83
83
|
approval_exemption: ["approve", "decline", "keep"],
|
|
84
84
|
launch_profile: ["save", "skip"],
|
|
85
85
|
epic_ci_change: ["approve", "decline", "keep"],
|
|
86
|
+
// BAPI-1719: no DEPENDS_ON entry. It is a local write to existing MCP entries.
|
|
87
|
+
tool_visibility: ["approve", "decline", "keep"],
|
|
88
|
+
// BAPI-1526: no DEPENDS_ON entry. It qualifies the gate revision stored in this pass.
|
|
89
|
+
qualify_gate: ["approve", "decline"],
|
|
86
90
|
});
|
|
87
91
|
/** BAPI-1699 — the most commands one `commands` answer may carry, and the longest line. */
|
|
88
92
|
const TEST_COMMANDS_MAX = 4;
|
|
@@ -16,6 +16,16 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { isTrialPhase, presentTrialResult } from "./install-bridge-conductor-trial-report.js";
|
|
18
18
|
import { SETUP_RECORD_RELATIVE_PATH, } from "./install-bridge-conductor-contracts.js";
|
|
19
|
+
/**
|
|
20
|
+
* What counts as finished (BAPI-1718, the rule for an optional advisory write):
|
|
21
|
+
*
|
|
22
|
+
* - A deliberate skip or an owner's decline is complete. It is `declined` or
|
|
23
|
+
* `unchanged`, and it carries a `reason` that says why nothing was written.
|
|
24
|
+
* - A notice that plans no write adds no apply row, so it cannot affect completion.
|
|
25
|
+
* - A write the owner asked for that cannot finish is incomplete, and it needs an
|
|
26
|
+
* actionable `fix`. That includes a requested write whose required read failed
|
|
27
|
+
* (reported `unattempted`), because "nothing changed" there is not the owner's choice.
|
|
28
|
+
*/
|
|
19
29
|
const NOT_COMPLETED = new Set(["failed", "refused", "uncertain", "unattempted"]);
|
|
20
30
|
const COMPLETE = new Set(["written", "unchanged", "declined"]);
|
|
21
31
|
function unexpectedFailure(key, target) {
|
|
@@ -772,6 +772,65 @@ function epicCiChangeChoice(e) {
|
|
|
772
772
|
effects: { approve: effect },
|
|
773
773
|
};
|
|
774
774
|
}
|
|
775
|
+
/** The effect an approval of the tool-visibility write has. Its params are the approval's binding. */
|
|
776
|
+
export function toolVisibilityEffect(configPaths) {
|
|
777
|
+
return {
|
|
778
|
+
action: "merge_profile_group",
|
|
779
|
+
target: "host_mcp_profile",
|
|
780
|
+
// The group name and the supported config paths only: no stored profile, env, command, or credential.
|
|
781
|
+
params: { group: "epic_implementer", config_paths: [...configPaths].sort() },
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* BAPI-1719 — the local MCP profile merge, an optional-consent choice. Present only
|
|
786
|
+
* when `tool_visibility` is planned, so every proposal where no write is offered keeps
|
|
787
|
+
* its exact decisions, actions, and digest.
|
|
788
|
+
*/
|
|
789
|
+
function toolVisibilityChoice(e) {
|
|
790
|
+
if (e === null || e === undefined || !e.planned)
|
|
791
|
+
return null;
|
|
792
|
+
const where = e.configPaths.length > 0 ? ` in ${e.configPaths.join(", ")}` : "";
|
|
793
|
+
return {
|
|
794
|
+
id: "tool_visibility",
|
|
795
|
+
family: "tool_visibility",
|
|
796
|
+
answer_key: "tool_visibility",
|
|
797
|
+
current: "group_missing",
|
|
798
|
+
options: approveDecline(`Adds the epic_implementer group to the Bridge entry${where}, keeping every group already listed there. It changes only existing entries and creates no file. Restart your MCP client afterward so this session can see the Epic Implementer tools.`, "Leaves every MCP configuration untouched. The Epic Implementer tools stay hidden from your editor until you add the group yourself and restart your MCP client."),
|
|
799
|
+
recommended: "approve",
|
|
800
|
+
why_recommended: "Without this group your editor cannot see the tools that drive an epic, and the change only adds a group to an entry that already exists.",
|
|
801
|
+
consequential: false,
|
|
802
|
+
applicable: true,
|
|
803
|
+
selection: "single",
|
|
804
|
+
effects: { approve: toolVisibilityEffect(e.configPaths) },
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
/** BAPI-1526 — the effect an approval of the gate qualification has. No params: it qualifies the stored revision. */
|
|
808
|
+
export const QUALIFY_GATE_EFFECT = Object.freeze({
|
|
809
|
+
action: "qualify_stored_gate",
|
|
810
|
+
target: "repository_gate.qualification",
|
|
811
|
+
});
|
|
812
|
+
/**
|
|
813
|
+
* BAPI-1526 — run the stored local gate once under the executor, an optional-consent
|
|
814
|
+
* choice. Present only when `qualify_gate` is planned, so every proposal where it is
|
|
815
|
+
* not offered keeps its exact decisions, actions, and digest.
|
|
816
|
+
*/
|
|
817
|
+
function qualifyGateChoice(e) {
|
|
818
|
+
if (e === null || e === undefined || !e.planned)
|
|
819
|
+
return null;
|
|
820
|
+
return {
|
|
821
|
+
id: "qualify_gate",
|
|
822
|
+
family: "qualify_gate",
|
|
823
|
+
answer_key: "qualify_gate",
|
|
824
|
+
current: "unqualified",
|
|
825
|
+
options: approveDecline("Runs the stored local gate commands once now under a short-lived executor, on this machine. A pass qualifies the gate for its current revision; the server then admits unattended runs that rely on it.", "Runs nothing. The gate stays unqualified, so setup ends Not ready and unattended runs that rely on it are refused until it is qualified."),
|
|
826
|
+
recommended: "approve",
|
|
827
|
+
why_recommended: "The local gate must pass once under the executor before an unattended run is admitted, and running it now clears that without another setup pass.",
|
|
828
|
+
consequential: false,
|
|
829
|
+
applicable: true,
|
|
830
|
+
selection: "single",
|
|
831
|
+
effects: { approve: QUALIFY_GATE_EFFECT },
|
|
832
|
+
};
|
|
833
|
+
}
|
|
775
834
|
/**
|
|
776
835
|
* What choosing `include` means, by what is known. Never claims checks run or pass:
|
|
777
836
|
* confirmed coverage says a workflow is configured to start; otherwise it says plainly
|
|
@@ -1043,6 +1102,8 @@ const SETTING_LABEL = Object.freeze({
|
|
|
1043
1102
|
approval_exemption: "Approval rule",
|
|
1044
1103
|
launch_profile: "Launch profile",
|
|
1045
1104
|
epic_ci_change: "Epic-branch CI change",
|
|
1105
|
+
tool_visibility: "Epic Implementer tools",
|
|
1106
|
+
qualify_gate: "Gate qualification",
|
|
1046
1107
|
setup_record: "Setup record",
|
|
1047
1108
|
});
|
|
1048
1109
|
const INCOMPLETE_STATUS = new Set(["failed", "refused", "uncertain", "unattempted"]);
|
|
@@ -1072,6 +1133,16 @@ function asNextStep(fix) {
|
|
|
1072
1133
|
* A missing fix uses the read-only doctor check, and with no fix at all an unconfirmed
|
|
1073
1134
|
* verdict names that check too instead of recommending a run.
|
|
1074
1135
|
*/
|
|
1136
|
+
/** One row's named findings as a sentence: ID, severity, then gaps before unreadable names. */
|
|
1137
|
+
function findingRowSentence(row) {
|
|
1138
|
+
const severity = row.check_status === "unknown" ? "couldn't check" : row.impact === "blocking" ? "blocking" : "warning";
|
|
1139
|
+
const findings = [...(row.findings ?? [])].sort((a, b) => (a.status === b.status ? 0 : a.status === "not_met" ? -1 : 1));
|
|
1140
|
+
const parts = findings.map((f) => {
|
|
1141
|
+
const kind = f.status === "not_met" ? "gap" : "couldn't check";
|
|
1142
|
+
return `${kind} (${f.reason})${f.names.length ? `: ${f.names.join(", ")}` : ""}`;
|
|
1143
|
+
});
|
|
1144
|
+
return `${oneLine(row.label || row.id)} [${row.id}] — ${severity}; ${parts.join("; ")}.`;
|
|
1145
|
+
}
|
|
1075
1146
|
export function buildInstallVerdict(input) {
|
|
1076
1147
|
const { ready, blockers, results, protection } = input;
|
|
1077
1148
|
const settings = results
|
|
@@ -1108,6 +1179,9 @@ export function buildInstallVerdict(input) {
|
|
|
1108
1179
|
}
|
|
1109
1180
|
if (protection === "none" || protection === "watched_only")
|
|
1110
1181
|
parts.push(NO_TESTS_SENTENCE);
|
|
1182
|
+
const findingRows = (input.prerequisites ?? []).filter((p) => (p.check_status === "not_met" || p.check_status === "unknown") && (p.findings?.length ?? 0) > 0);
|
|
1183
|
+
if (findingRows.length > 0)
|
|
1184
|
+
parts.push(`Readiness findings: ${findingRows.map(findingRowSentence).join(" ")}`);
|
|
1111
1185
|
// BAPI-1701: the gate's own fix leads, so an optional setting's generic rerun cannot hide why no gate was stored.
|
|
1112
1186
|
const firstFix = (settings.find((s) => s.key === "gate") ?? settings[0])?.fix ?? blockers[0]?.fix;
|
|
1113
1187
|
// BAPI-1698: when the ONLY setting that did not take is a completed test trial that
|
|
@@ -1150,6 +1224,8 @@ const CHOICE_QUESTION = Object.freeze({
|
|
|
1150
1224
|
approval_exemption: "Should setup change your GitHub rule so epic work can merge into the epic branch without a person approving each merge?",
|
|
1151
1225
|
launch_profile: "Should setup save these launch settings so later runs can reuse them?",
|
|
1152
1226
|
epic_ci_change: "Should setup open a pull request so your checks also run on pull requests into epic branches?",
|
|
1227
|
+
tool_visibility: "Should setup add the Epic Implementer tools to your editor's MCP configuration (you restart your MCP client afterward)?",
|
|
1228
|
+
qualify_gate: "The local gate must pass once under the executor before an unattended run is admitted. Should setup run it now?",
|
|
1153
1229
|
});
|
|
1154
1230
|
/** Place the choice's question right after its answer key. */
|
|
1155
1231
|
function withQuestion(c) {
|
|
@@ -1258,6 +1334,14 @@ export function buildInstallChoices(d) {
|
|
|
1258
1334
|
const ciChange = epicCiChangeChoice(d.epicBranchCi);
|
|
1259
1335
|
if (ciChange !== null)
|
|
1260
1336
|
choices.push(ciChange);
|
|
1337
|
+
// BAPI-1719: the local profile merge, after the CI change, only when planned.
|
|
1338
|
+
const toolVisibility = toolVisibilityChoice(d.toolVisibility);
|
|
1339
|
+
if (toolVisibility !== null)
|
|
1340
|
+
choices.push(toolVisibility);
|
|
1341
|
+
// BAPI-1526: the gate qualification, after tool visibility, only when planned.
|
|
1342
|
+
const qualifyGate = qualifyGateChoice(d.qualifyGate);
|
|
1343
|
+
if (qualifyGate !== null)
|
|
1344
|
+
choices.push(qualifyGate);
|
|
1261
1345
|
const built = choices.map((c) => finalizeRecommendation(withQuestion(c)));
|
|
1262
1346
|
// The draft resolves against the complete proposed selection set (recommended approvals as proposals).
|
|
1263
1347
|
return resolveEpicBranchCiRecommendation(built, () => undefined, {
|
|
@@ -53,6 +53,14 @@ export const INSTALL_ANSWER_KEYS = Object.freeze([
|
|
|
53
53
|
// BAPI-1654 — appended last, so every earlier key keeps its apply position. An
|
|
54
54
|
// older CLI does not know it and refuses an answers file that carries it.
|
|
55
55
|
"epic_ci_change",
|
|
56
|
+
// BAPI-1719 — appended after `epic_ci_change`; every earlier key keeps its apply
|
|
57
|
+
// position and INSTALL_PROPOSAL_DIGEST_VERSION stays 1. An older CLI refuses an
|
|
58
|
+
// answers file that carries it.
|
|
59
|
+
"tool_visibility",
|
|
60
|
+
// BAPI-1526 — appended after `tool_visibility`; every earlier key keeps its apply
|
|
61
|
+
// position and INSTALL_PROPOSAL_DIGEST_VERSION stays 1. An older CLI refuses an
|
|
62
|
+
// answers file that carries it.
|
|
63
|
+
"qualify_gate",
|
|
56
64
|
]);
|
|
57
65
|
/** The worker-setup declarations stored with the gate, each with its own key. */
|
|
58
66
|
export const DECLARATION_ANSWER_KEYS = Object.freeze([
|
|
@@ -66,7 +74,7 @@ export const DECLARATION_ANSWER_KEYS = Object.freeze([
|
|
|
66
74
|
* always KNOWN keys: an answers file may carry them after the evidence moved on,
|
|
67
75
|
* and apply then refuses only the re-index write, never the whole file.
|
|
68
76
|
*/
|
|
69
|
-
export const CONDITIONAL_ANSWER_KEYS = Object.freeze(["reindex_branch", "reindex_retry", "epic_ci_change"]);
|
|
77
|
+
export const CONDITIONAL_ANSWER_KEYS = Object.freeze(["reindex_branch", "reindex_retry", "epic_ci_change", "tool_visibility", "qualify_gate"]);
|
|
70
78
|
export function isInstallAnswerKey(value) {
|
|
71
79
|
return INSTALL_ANSWER_KEYS.includes(value);
|
|
72
80
|
}
|
|
@@ -21,7 +21,8 @@ import { formatReadinessAssessment } from './conductor/readiness-prerequisites.j
|
|
|
21
21
|
* row for the same fact. An unmet blocking item is counted once.
|
|
22
22
|
*/
|
|
23
23
|
import { READINESS_PREREQUISITE_BY_ID, READINESS_PREREQUISITE_CATALOG, } from "./readiness-prerequisites.generated.js";
|
|
24
|
-
import { READINESS_PREREQUISITE_FIXES, assessmentRemedyQuestion, formatProfilePolicyRemedy, indexedWorkflowsDisplayRemedy, resolveReadinessRemedy, PRE_SETUP_READINESS_REMEDY, } from "./printed-remedy-commands.js";
|
|
24
|
+
import { READINESS_PREREQUISITE_FIXES, assessmentRemedyQuestion, formatProfilePolicyRemedy, indexedWorkflowsDisplayRemedy, resolveReadinessRemedy, PRE_SETUP_READINESS_REMEDY, CONDUCTOR_PROFILE_EMPTY_MERGE_REMEDIATION, PRINTED_QUALIFY_GATE_COMMAND, } from "./printed-remedy-commands.js";
|
|
25
|
+
import { DUPLICATE_REGISTRATION_GUIDANCE } from "./launcher-config-inspection.js";
|
|
25
26
|
import { COMMAND_DRIFT_DIVERGENT_REMEDIATION, COMMAND_DRIFT_UNASSESSABLE_REMEDIATION } from "./conductor/command-drift.js";
|
|
26
27
|
import { shellQuote } from "./epic-launch-profile.js";
|
|
27
28
|
import { decodeCanonicalProvenance } from "./conductor/bridge-api-client.js";
|
|
@@ -53,6 +54,12 @@ export const SETUP_ITEM_IDS = Object.freeze({
|
|
|
53
54
|
* the server catalog. It never changes the verdict.
|
|
54
55
|
*/
|
|
55
56
|
epicServer: "local.epic-server",
|
|
57
|
+
/**
|
|
58
|
+
* BAPI-1719: a LOCAL advisory item for whether the Epic Implementer MCP tools
|
|
59
|
+
* are loaded by the project's Bridge MCP entries. Never blocking, and
|
|
60
|
+
* deliberately not in the server readiness catalog.
|
|
61
|
+
*/
|
|
62
|
+
toolVisibility: "local.tool-visibility",
|
|
56
63
|
/** BAPI-1635: a LOCAL advisory item for default-branch index lag. Never blocking. */
|
|
57
64
|
indexFreshness: "local.index-freshness",
|
|
58
65
|
/** BAPI-1635: the committed-asset drift advisory, a catalog row labeled "Command versions". */
|
|
@@ -64,6 +71,10 @@ export const INDEX_FRESHNESS_ITEM_LABEL = "Repository index freshness";
|
|
|
64
71
|
export const MCP_GRANT_ITEM_LABEL = "Worker MCP servers (owner approval)";
|
|
65
72
|
/** BAPI-1546: the explicit label of the local epic-server item. */
|
|
66
73
|
export const EPIC_SERVER_ITEM_LABEL = "Epic server for UI checks (owner opt-in)";
|
|
74
|
+
/** BAPI-1719: the explicit label of the local tool-visibility item. */
|
|
75
|
+
export const TOOL_VISIBILITY_ITEM_LABEL = "Epic Implementer tools in your editor (MCP profile)";
|
|
76
|
+
/** BAPI-1719: the one remedy for a profile that setup can add (or could not re-check). */
|
|
77
|
+
export const TOOL_VISIBILITY_MERGE_REMEDY = "setup adds it; then restart your MCP client.";
|
|
67
78
|
/** The catalog label for an id, falling back to the id itself. */
|
|
68
79
|
export function catalogLabel(id) {
|
|
69
80
|
return READINESS_PREREQUISITE_BY_ID.get(id)?.label ?? id;
|
|
@@ -228,10 +239,21 @@ export function projectSetupItems(evidence) {
|
|
|
228
239
|
const epicServer = projectEpicServerItem(evidence.epicServer, evidence.path);
|
|
229
240
|
if (epicServer !== null)
|
|
230
241
|
upsert(items, epicServer);
|
|
242
|
+
// --- BAPI-1719: tool visibility (advisory, never the verdict) ------------
|
|
243
|
+
const toolVisibility = projectToolVisibilityItem(evidence.toolVisibility);
|
|
244
|
+
if (toolVisibility !== null)
|
|
245
|
+
upsert(items, toolVisibility);
|
|
231
246
|
// --- BAPI-1635: a known unmet row never keeps the generic retry -----------
|
|
232
247
|
// `fromServerPrerequisite` stays as it was; a blank wire fix is resolved here by ID.
|
|
233
248
|
for (const item of items)
|
|
234
249
|
normalizeKnownRemedy(item);
|
|
250
|
+
// BAPI-1526: an unqualified stored local gate names the qualification fix.
|
|
251
|
+
if (storedGateNeedsQualification(evidence.readiness)) {
|
|
252
|
+
for (const item of items) {
|
|
253
|
+
if (item.id === "server.gate-profile" && item.state === "needs_action")
|
|
254
|
+
item.remedy = QUALIFY_GATE_REMEDY;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
235
257
|
// --- Escalation channel: the selected launch profile's route, or its remedy -
|
|
236
258
|
applyNotificationEvidence(items, evidence);
|
|
237
259
|
// --- BAPI-1635: index lag and committed-asset drift (advisory, never the verdict) ---
|
|
@@ -483,6 +505,37 @@ export function projectEpicServerItem(state, path = "terminal") {
|
|
|
483
505
|
: "the epic-server record is unusable, so runs have no epic server; re-run setup to replace it");
|
|
484
506
|
}
|
|
485
507
|
}
|
|
508
|
+
/**
|
|
509
|
+
* BAPI-1719: the advisory tool-visibility item, one pure projection shared by
|
|
510
|
+
* both assessment paths. Non-blocking in every state, so it never changes the
|
|
511
|
+
* verdict, the remaining-step count, or the server readiness records.
|
|
512
|
+
*/
|
|
513
|
+
export function projectToolVisibilityItem(state) {
|
|
514
|
+
if (state === undefined)
|
|
515
|
+
return null;
|
|
516
|
+
const item = (s, remedy) => ({
|
|
517
|
+
id: SETUP_ITEM_IDS.toolVisibility,
|
|
518
|
+
label: TOOL_VISIBILITY_ITEM_LABEL,
|
|
519
|
+
state: s,
|
|
520
|
+
blocking: false,
|
|
521
|
+
remedy: s === "met" ? null : remedy,
|
|
522
|
+
});
|
|
523
|
+
switch (state.state) {
|
|
524
|
+
case "met":
|
|
525
|
+
return item("met", null);
|
|
526
|
+
case "needs_merge":
|
|
527
|
+
return item("needs_action", TOOL_VISIBILITY_MERGE_REMEDY);
|
|
528
|
+
case "duplicate_registration":
|
|
529
|
+
// Not a fix setup can make: Bridge never chooses which registration to keep.
|
|
530
|
+
return item("needs_action", `${state.configPaths.join(", ")}: ${DUPLICATE_REGISTRATION_GUIDANCE}`);
|
|
531
|
+
case "no_entry":
|
|
532
|
+
return item("needs_action", CONDUCTOR_PROFILE_EMPTY_MERGE_REMEDIATION);
|
|
533
|
+
case "unknown":
|
|
534
|
+
return item("unknown", state.reason === "verification"
|
|
535
|
+
? "the profile was written but could not be read back; restart your MCP client, then run `doctor` to confirm"
|
|
536
|
+
: "the MCP profile could not be checked; re-run setup");
|
|
537
|
+
}
|
|
538
|
+
}
|
|
486
539
|
function projectMergeCredential(state) {
|
|
487
540
|
const id = SETUP_ITEM_IDS.mergeCredential;
|
|
488
541
|
switch (state.state) {
|
|
@@ -502,6 +555,29 @@ function projectMergeCredential(state) {
|
|
|
502
555
|
return local(id, "unknown", true, "the merge token could not be checked right now; re-run setup later");
|
|
503
556
|
}
|
|
504
557
|
}
|
|
558
|
+
/**
|
|
559
|
+
* BAPI-1526: the server reports a STORED gate whose local command is not qualified
|
|
560
|
+
* for its current revision (unqualified or stale) — a proven denial. Never true for
|
|
561
|
+
* `unable_to_verify`, a malformed profile, a `none` or `provider` gate, or an older
|
|
562
|
+
* server that sends no gate-profile block.
|
|
563
|
+
*/
|
|
564
|
+
export function storedGateNeedsQualification(readiness) {
|
|
565
|
+
const profile = readiness?.gate_profile;
|
|
566
|
+
if (profile === undefined || profile === null)
|
|
567
|
+
return false;
|
|
568
|
+
return profile.source === "stored"
|
|
569
|
+
&& profile.stored_malformed === false
|
|
570
|
+
&& (profile.kind === "local" || profile.kind === "mixed")
|
|
571
|
+
&& profile.verdict === "denied"
|
|
572
|
+
&& profile.reason === "local_command_unqualified";
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* BAPI-1526: the `server.gate-profile` remedy for an unqualified stored local gate. It
|
|
576
|
+
* names the real fix, never the generic "plan the repository gate" text, which a
|
|
577
|
+
* re-run without the flag could not clear.
|
|
578
|
+
*/
|
|
579
|
+
export const QUALIFY_GATE_REMEDY = `re-run setup and approve qualifying the local gate, or run ${PRINTED_QUALIFY_GATE_COMMAND}; ` +
|
|
580
|
+
"the local gate must pass once under the executor before an unattended run is admitted.";
|
|
505
581
|
/**
|
|
506
582
|
* Pick the permitted fixes for the unmet items, in the order they must run.
|
|
507
583
|
*
|
|
@@ -552,6 +628,18 @@ export function planSetupFixes(evidence, context) {
|
|
|
552
628
|
(evidence.epicServer.state === "needs_action" || context.epicServerChangeRequested === true)) {
|
|
553
629
|
fixes.push("epic_server");
|
|
554
630
|
}
|
|
631
|
+
// BAPI-1719: the local MCP profile merge, last, behind its own consent. Planned
|
|
632
|
+
// only on a CONCLUSIVE needed merge; no-entry and unknown plan nothing, and the
|
|
633
|
+
// item itself stays outside the server readiness catalog.
|
|
634
|
+
if (evidence.toolVisibility?.state === "needs_merge")
|
|
635
|
+
fixes.push("tool_visibility");
|
|
636
|
+
// BAPI-1526: offer to qualify the local gate, from server facts only, behind its own
|
|
637
|
+
// consent. The verdict already blocks on it; this clears it inside setup. Not planned
|
|
638
|
+
// when `--qualify-gate` was passed: that flag qualifies with no question, as before.
|
|
639
|
+
if (context.qualifyGateRequested !== true
|
|
640
|
+
&& (storedGateNeedsQualification(evidence.readiness) || context.explicitLocalGateUnproven === true)) {
|
|
641
|
+
fixes.push("qualify_gate");
|
|
642
|
+
}
|
|
555
643
|
return fixes;
|
|
556
644
|
}
|
|
557
645
|
const SHA_RE = /^[0-9a-f]{40}$/;
|
|
@@ -705,7 +793,7 @@ const STATE_WORD = Object.freeze({
|
|
|
705
793
|
unknown: "could not verify",
|
|
706
794
|
});
|
|
707
795
|
/** The advisory findings setup adds beside the server's own rows. */
|
|
708
|
-
const ADVISORY_FINDING_IDS = new Set([SETUP_ITEM_IDS.indexFreshness, SETUP_ITEM_IDS.commandDrift]);
|
|
796
|
+
const ADVISORY_FINDING_IDS = new Set([SETUP_ITEM_IDS.indexFreshness, SETUP_ITEM_IDS.commandDrift, SETUP_ITEM_IDS.toolVisibility]);
|
|
709
797
|
/**
|
|
710
798
|
* BAPI-1635: the lines for the advisory findings setup adds (index lag, command
|
|
711
799
|
* versions) in the compact summary and in read-only runs, where the full assessment
|
|
@@ -713,7 +801,10 @@ const ADVISORY_FINDING_IDS = new Set([SETUP_ITEM_IDS.indexFreshness, SETUP_ITEM_
|
|
|
713
801
|
*/
|
|
714
802
|
export function advisoryFindingLines(items) {
|
|
715
803
|
// Only a finding (needs action, or indexing already running); an unreadable comparison is not advice.
|
|
716
|
-
|
|
804
|
+
// BAPI-1719: tool visibility also names its fixed unknown guidance; other findings do not.
|
|
805
|
+
const found = items.filter((i) => !i.blocking
|
|
806
|
+
&& (i.state === "needs_action" || i.state === "pending" || (i.state === "unknown" && i.id === SETUP_ITEM_IDS.toolVisibility))
|
|
807
|
+
&& ADVISORY_FINDING_IDS.has(i.id) && i.remedy !== null);
|
|
717
808
|
return found.length === 0 ? [] : ["", "Also worth doing (advisory)", ...found.map((i) => ` - ${i.label}: ${i.remedy}`)];
|
|
718
809
|
}
|
|
719
810
|
/**
|
|
@@ -885,6 +976,11 @@ function projectAssessmentSetupItems(evidence) {
|
|
|
885
976
|
const recordRemedy = (r) => {
|
|
886
977
|
if (r.blocking_effect === 'none')
|
|
887
978
|
return null;
|
|
979
|
+
// BAPI-1526: a proven-unqualified stored local gate names the qualification fix, not the
|
|
980
|
+
// generic gate-planning text a re-run without the flag could never clear.
|
|
981
|
+
if (r.id === 'server.gate-profile' && r.blocking_effect === 'blocker' && storedGateNeedsQualification(evidence.readiness)) {
|
|
982
|
+
return QUALIFY_GATE_REMEDY;
|
|
983
|
+
}
|
|
888
984
|
// BAPI-1657: only a known-missing gate with a readable basis and a planned write says approval stores it.
|
|
889
985
|
if (r.id === 'server.gate-profile' && r.observed_state === 'unknown' && r.basis !== undefined
|
|
890
986
|
&& r.basis !== 'policy_unreadable' && evidence.plannedGateWrite === true) {
|
|
@@ -943,6 +1039,10 @@ function projectAssessmentSetupItems(evidence) {
|
|
|
943
1039
|
const epicServerItem = projectEpicServerItem(evidence.epicServer, evidence.path);
|
|
944
1040
|
if (epicServerItem !== null)
|
|
945
1041
|
items.push(epicServerItem);
|
|
1042
|
+
// BAPI-1719: the same local tool-visibility projection as the legacy path; server records untouched.
|
|
1043
|
+
const toolVisibilityItem = projectToolVisibilityItem(evidence.toolVisibility);
|
|
1044
|
+
if (toolVisibilityItem !== null)
|
|
1045
|
+
items.push(toolVisibilityItem);
|
|
946
1046
|
// BAPI-1635: advisory findings beside the server's records; neither changes the verdict.
|
|
947
1047
|
const freshnessItem = projectFreshnessItem(evidence.freshness);
|
|
948
1048
|
if (freshnessItem !== null)
|