@bridge_gpt/mcp-server 0.2.71 → 0.2.73
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 +55 -17
- package/build/agent-launchers/claude-executor-adapter.js +22 -3
- package/build/agent-notes.js +171 -95
- package/build/agents.generated.js +7 -7
- package/build/bridge-permissions.js +31 -0
- package/build/bridge-worktree-inspection.js +237 -0
- package/build/check-evidence.js +6 -0
- package/build/ci-system-detection.js +50 -0
- package/build/ci-trigger-adapters.js +631 -0
- package/build/ci-trigger-install.js +106 -0
- package/build/claude-review-workflow.js +1 -1
- package/build/cli-help.js +6 -0
- package/build/codex-auto-recovery.js +126 -0
- package/build/codex-launcher-pin.js +33 -2
- package/build/codex-skill-adapter.js +5 -1
- package/build/command-host.js +33 -0
- package/build/commands.generated.js +7 -6
- package/build/conductor/bridge-api-client.js +1352 -50
- package/build/conductor/bring-up-facts.js +18 -5
- package/build/conductor/command-drift-production.js +42 -17
- package/build/conductor/command-drift.js +47 -0
- package/build/conductor/declare-blocked.js +554 -0
- package/build/conductor/doctor.js +187 -28
- package/build/conductor/driver-commands.js +141 -0
- package/build/conductor/driver-guard.js +277 -0
- package/build/conductor/driver-lapse.js +321 -0
- package/build/conductor/driver-register.js +176 -0
- package/build/conductor/driver-release.js +174 -0
- package/build/conductor/driver-session-state.js +315 -0
- package/build/conductor/epic-branch-ci-inspection.js +222 -29
- package/build/conductor/epic-implementer-cli.js +213 -13
- package/build/conductor/epic-server-database.js +162 -0
- package/build/conductor/epic-server-guidance.js +278 -0
- package/build/conductor/epic-server-journal.js +239 -0
- package/build/conductor/epic-server-processes.js +324 -0
- package/build/conductor/epic-server-recipe.js +397 -0
- package/build/conductor/epic-server-runtime.js +1207 -0
- package/build/conductor/epic-server-sfcc.js +107 -0
- package/build/conductor/epic-server-state.js +427 -0
- package/build/conductor/epic-server.js +594 -0
- package/build/conductor/gate-discovery.js +281 -10
- package/build/conductor/gate-settings-review.js +525 -5
- package/build/conductor/git-hooks-uninstall.js +112 -0
- package/build/conductor/git-hooks.js +81 -15
- package/build/conductor/guided-repair.js +10 -1
- package/build/conductor/install-doctor.js +2 -4
- package/build/conductor/launch-need-probes.js +6 -53
- package/build/conductor/launch-plan.js +318 -121
- package/build/conductor/local-merge.js +12 -1
- package/build/conductor/merge-execution-contract.js +1 -1
- package/build/conductor/merged-child-check.js +2 -1
- package/build/conductor/prerequisite-inputs.js +1213 -0
- package/build/conductor/readiness-assessment.js +93 -0
- package/build/conductor/readiness-cli.js +30 -9
- package/build/conductor/readiness-prerequisites.js +77 -5
- package/build/conductor/readiness-sections.js +146 -126
- package/build/conductor/readiness.js +21 -3
- package/build/conductor/recovery-cli.js +236 -15
- package/build/conductor/recovery-operations.js +34 -4
- package/build/conductor/repair-contract.js +33 -0
- package/build/conductor/tools.js +36 -4
- package/build/conductor/wait-run-attention.js +115 -0
- package/build/conductor/wait-run-cli.js +300 -21
- package/build/conductor/worker-database-doctor-inspector.js +34 -2
- package/build/conductor/worker-setup-tally.js +27 -0
- package/build/credential-store.js +96 -21
- package/build/dependency-install-declarations.js +212 -0
- package/build/docs.generated.js +4 -4
- package/build/doctor.js +91 -8
- package/build/drive-epic-help.js +23 -4
- package/build/drive-epic.js +1841 -340
- package/build/engine-paths.js +20 -0
- package/build/epic-branch-ci-summary.js +140 -0
- package/build/epic-capability-statement.js +107 -0
- package/build/epic-ci-workflow-drift.js +30 -15
- package/build/epic-ci-workflow-install.js +110 -42
- package/build/epic-ci-workflow-v2.js +274 -0
- package/build/epic-ci-workflow.js +38 -12
- package/build/epic-implementer-bin.js +2184 -52
- package/build/epic-launch-context.js +607 -0
- package/build/epic-launch-profile.js +1 -1
- package/build/epic-server-record.js +273 -0
- package/build/epic-shared/bridge-client.js +11 -3
- package/build/escalation-reachability.js +43 -0
- package/build/executor/ci-fix-test-runs.js +334 -0
- package/build/executor/cli.js +2 -0
- package/build/executor/completion-contract.js +24 -1
- package/build/executor/credentials.js +1 -1
- package/build/executor/delivery-observations.js +113 -0
- package/build/executor/delivery-outcome.js +30 -0
- package/build/executor/dependency-refresh-runner.js +132 -0
- package/build/executor/dependency-refresh.js +530 -0
- package/build/executor/deps.js +4 -0
- package/build/executor/env.js +119 -17
- package/build/executor/epic-server-context.js +141 -0
- package/build/executor/gate-qualification-job.js +127 -26
- package/build/executor/harness-coverage.js +19 -0
- package/build/executor/http-client.js +87 -6
- package/build/executor/index.js +2 -1
- package/build/executor/install-preflight.js +1 -1
- package/build/executor/job-runner.js +659 -87
- package/build/executor/likely-tests.js +94 -97
- package/build/executor/observation.js +8 -0
- package/build/executor/pre-pr-checks.js +363 -0
- package/build/executor/prompt-spec.js +127 -5
- package/build/executor/reconcile-overlap-job.js +5 -3
- package/build/executor/required-verification.js +28 -0
- package/build/executor/required-work-diagnostics.js +32 -0
- package/build/executor/required-work-ledger.js +955 -39
- package/build/executor/results.js +100 -0
- package/build/executor/service-discovery.js +42 -0
- package/build/executor/service-lifecycle.js +109 -2
- package/build/executor/service-uninstall.js +205 -0
- package/build/executor/service-unit.js +5 -3
- package/build/executor/terminal-mutation.js +8 -0
- package/build/executor/test-clock.js +3 -0
- package/build/executor/verification-hints.js +179 -0
- package/build/executor/worker-command.js +126 -5
- package/build/executor/worker-database-config.js +281 -0
- package/build/executor/worker-database-target.js +16 -12
- package/build/executor/worker-database.js +575 -116
- package/build/executor/worker-finalization.js +71 -10
- package/build/executor/worker-guard-hook.js +10 -2
- package/build/executor/worker-resources.js +25 -3
- package/build/executor/worker-verification-guidance.js +55 -5
- package/build/executor/worktree-inspection.js +42 -0
- package/build/executor/worktree.js +20 -1
- package/build/executor-launch.js +54 -2
- package/build/generated-assets-catalog.js +2 -2
- package/build/github-sign-in.js +1 -1
- package/build/index.js +1111 -381
- package/build/init.js +29 -14
- package/build/install-bridge-conductor-answers.js +465 -0
- package/build/install-bridge-conductor-apply.js +259 -0
- package/build/install-bridge-conductor-assessment.js +895 -0
- package/build/install-bridge-conductor-compact.js +161 -0
- package/build/install-bridge-conductor-contracts.js +63 -0
- package/build/install-bridge-conductor-gate.js +1383 -188
- package/build/install-bridge-conductor-setup.js +637 -92
- package/build/install-bridge-conductor.js +3163 -740
- package/build/install-bridge.js +601 -128
- package/build/install-maintenance.js +127 -0
- package/build/install-reexec.js +1 -1
- package/build/launcher-config-inspection.js +162 -1
- package/build/local-cleanup.js +59 -0
- package/build/mcp-grant-candidates.js +767 -0
- package/build/mcp-grant-doctor.js +63 -0
- package/build/mcp-grant.js +288 -0
- package/build/mcp-host-targets.js +8 -0
- package/build/mcp-identity.js +23 -0
- package/build/mcp-install-state.js +68 -2
- package/build/mcp-invoke.js +126 -13
- package/build/mcp-presets.js +107 -0
- package/build/mcp-provisioning.js +134 -2
- package/build/mcp-registration-doctor.js +31 -2
- package/build/mcp-server-invocation.js +6 -1
- package/build/merge-workflow-install.js +236 -111
- package/build/package-script-semantics.js +10 -0
- package/build/pipeline-utils.js +1 -1
- package/build/pipelines.generated.js +6 -6
- package/build/plan-discovery.js +97 -4
- package/build/plan-execution-ledger.js +248 -9
- package/build/plan-generation-io.js +262 -0
- package/build/plan-generation.js +424 -0
- package/build/plane/build-freshness.js +6 -1
- package/build/plane/cli.js +75 -9
- package/build/plane/plane-freshness.js +23 -7
- package/build/plane/preflight.js +50 -10
- package/build/plane/shutdown.js +19 -0
- package/build/plane/terminal-run-cleanup.js +23 -5
- package/build/plane/terminal-run-status.js +4 -0
- package/build/printed-remedy-commands.js +229 -15
- package/build/readiness-check.js +1 -1
- package/build/readiness-prerequisites.generated.js +311 -4
- package/build/readme.generated.js +1 -1
- package/build/repository-state-paths.js +38 -0
- package/build/repository-toolchains.js +50 -8
- package/build/run-unit-tests-launcher.js +8 -1
- package/build/setup-change-policy.js +32 -0
- package/build/setup-epic.js +1192 -198
- package/build/setup-progress.js +44 -0
- package/build/setup-question.js +180 -0
- package/build/start-tickets.js +4 -0
- package/build/test-command-detection.js +32 -88
- package/build/test-support/notes-fs.js +40 -0
- package/build/third-party-mcp-targets.js +30 -0
- package/build/ticket-delivery-enrollment.js +30 -8
- package/build/ticket-delivery-run-scope.js +128 -0
- package/build/upgrade-cli.js +85 -2
- package/build/v2-readiness-requirements.js +28 -1
- package/build/version.generated.js +3 -3
- package/build/worker-guard-hook-bin.js +2 -2
- package/build/worktrees.js +105 -0
- package/docs/EPIC-IMPLEMENTER-INSTALL.md +9 -1
- package/docs/EPIC-IMPLEMENTER.md +5 -0
- package/docs/epic-implementer/getting-started.md +42 -15
- package/docs/epic-implementer/self-hosting.md +14 -1
- package/package.json +2 -2
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/** Explicit advisory evidence. This module performs no I/O or authorization. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { READINESS_ASSESSMENT_V1 as C } from '../readiness-prerequisites.generated.js';
|
|
4
|
+
export function assessmentBlockingEffect(app, state, impact) {
|
|
5
|
+
if (impact !== 'mandatory' || app === 'policy_inapplicable')
|
|
6
|
+
return 'none';
|
|
7
|
+
if (app === 'unknown' || ['pending', 'unreadable', 'unverified', 'unknown'].includes(state))
|
|
8
|
+
return 'unresolved';
|
|
9
|
+
return state === 'confirmed' ? 'none' : 'blocker';
|
|
10
|
+
}
|
|
11
|
+
const remedy = z.strictObject({ reference: z.enum(C.remedies), audience: z.enum(C.audiences) }).refine(r => (r.reference !== 'self_host' || r.audience === 'self_host_operator') &&
|
|
12
|
+
(r.audience !== 'bridge_support' || ['none', 'retry', 'support'].includes(r.reference)));
|
|
13
|
+
const context = z.strictObject({
|
|
14
|
+
kind: z.enum(['repository_preview', 'selected_run']),
|
|
15
|
+
repo_name: z.string().min(1).max(128).regex(/^[A-Za-z0-9_.:/-]+$/),
|
|
16
|
+
epic_run_id: z.string().min(1).max(128).regex(/^[A-Za-z0-9_.:-]+$/).nullable(),
|
|
17
|
+
stage: z.enum(['pre_create', 'first_approval', 'approved_run', 'auto_merge', 'unknown']),
|
|
18
|
+
policy_read_status: z.enum(['confirmed', 'missing', 'malformed', 'unreadable']),
|
|
19
|
+
observed_at: z.string().max(40).regex(/^\d{4}-\d{2}-\d{2}T[0-9:.+Z-]+$/),
|
|
20
|
+
}).refine(c => (c.kind === 'selected_run') === (c.epic_run_id !== null));
|
|
21
|
+
const exemptionBases = C.exemption_bases_by_id;
|
|
22
|
+
const record = z.strictObject({
|
|
23
|
+
id: z.string().min(1).max(128), scope: z.enum(C.scopes),
|
|
24
|
+
applicability: z.enum(C.applicability), basis: z.enum(C.basis),
|
|
25
|
+
observed_state: z.enum(C.states), impact: z.enum(C.impacts),
|
|
26
|
+
blocking_effect: z.enum(C.blocking_effects), inspected_sha: z.string().regex(/^[0-9a-f]{40}$/).nullable(),
|
|
27
|
+
reason: z.enum(C.reasons), remedy,
|
|
28
|
+
}).refine(r => C.coverage.some(c => c.id === r.id && c.scope === r.scope)
|
|
29
|
+
&& (r.applicability !== 'unknown' || r.basis === 'policy_unreadable')
|
|
30
|
+
&& (r.applicability !== 'applicable' || r.basis === 'required')
|
|
31
|
+
&& (r.applicability !== 'policy_inapplicable' || exemptionBases[r.id]?.includes(r.basis) === true)
|
|
32
|
+
&& r.blocking_effect === assessmentBlockingEffect(r.applicability, r.observed_state, r.impact)
|
|
33
|
+
&& (!['indexed_commit', 'default_branch'].includes(r.scope) || r.inspected_sha !== null || !['confirmed', 'absent', 'deficient'].includes(r.observed_state)));
|
|
34
|
+
export const readinessAssessmentSchema = z.strictObject({ version: z.literal(1), context, records: z.array(record) }).refine(a => {
|
|
35
|
+
const identities = a.records.map(r => `${r.scope}:${r.id}`);
|
|
36
|
+
return identities.length === C.coverage.length && new Set(identities).size === identities.length
|
|
37
|
+
&& C.coverage.every(c => identities.includes(`${c.scope}:${c.id}`))
|
|
38
|
+
&& a.records.every(r => r.impact === (r.id === 'server.parse-progress' ? 'advisory' : 'mandatory'));
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* BAPI-1602 — assessment rows an OLDER server may still send after this build
|
|
42
|
+
* retired them. They are removed, and only they, BEFORE schema and coverage
|
|
43
|
+
* validation, so one retired row cannot make the whole assessment unavailable.
|
|
44
|
+
* Every other record keeps strict coverage validation.
|
|
45
|
+
*/
|
|
46
|
+
const RETIRED_ASSESSMENT_IDS = ['server.test-command'];
|
|
47
|
+
function withoutRetiredAssessmentRecords(assessment) {
|
|
48
|
+
if (typeof assessment !== 'object' || assessment === null || Array.isArray(assessment))
|
|
49
|
+
return assessment;
|
|
50
|
+
const records = assessment.records;
|
|
51
|
+
if (!Array.isArray(records))
|
|
52
|
+
return assessment;
|
|
53
|
+
return { ...assessment, records: records.filter(r => !(typeof r === 'object' && r !== null && RETIRED_ASSESSMENT_IDS.includes(r.id))) };
|
|
54
|
+
}
|
|
55
|
+
export function parseAssessmentNegotiation(body) {
|
|
56
|
+
if (!Object.hasOwn(body, 'assessment'))
|
|
57
|
+
return { status: 'unsupported' };
|
|
58
|
+
const result = readinessAssessmentSchema.safeParse(withoutRetiredAssessmentRecords(body.assessment));
|
|
59
|
+
return result.success ? { status: 'available', assessment: result.data } : { status: 'unavailable' };
|
|
60
|
+
}
|
|
61
|
+
export function composeReadinessAssessment(negotiation, local = []) {
|
|
62
|
+
if (negotiation.status === 'available') {
|
|
63
|
+
const parsed = readinessAssessmentSchema.safeParse(negotiation.assessment);
|
|
64
|
+
negotiation = parsed.success ? { status: 'available', assessment: parsed.data } : { status: 'unavailable' };
|
|
65
|
+
}
|
|
66
|
+
// Local observations live in a separate namespace. They cannot replace even
|
|
67
|
+
// one server record, its applicability, or its mandatory impact.
|
|
68
|
+
const facts = new Map(local.map(f => [f.id, Object.freeze({ ...f,
|
|
69
|
+
impact: f.id === 'local.executor-installation' ? 'optional' : f.impact })]));
|
|
70
|
+
return Object.freeze({ negotiation: negotiation.status,
|
|
71
|
+
context: negotiation.status === 'available' ? negotiation.assessment.context : null,
|
|
72
|
+
records: negotiation.status === 'available' ? negotiation.assessment.records : [],
|
|
73
|
+
local: [...facts.values()] });
|
|
74
|
+
}
|
|
75
|
+
export function assessmentGroups(assessment) {
|
|
76
|
+
const blockers = assessment.records.filter(r => r.blocking_effect === 'blocker');
|
|
77
|
+
const unresolved = assessment.records.filter(r => r.blocking_effect === 'unresolved');
|
|
78
|
+
const localBlockers = assessment.local.filter(f => f.impact === 'mandatory' && ['absent', 'deficient'].includes(f.observed_state));
|
|
79
|
+
const localUnresolved = assessment.local.filter(f => f.impact === 'mandatory' && !['confirmed', 'absent', 'deficient'].includes(f.observed_state));
|
|
80
|
+
return { blockers, unresolved, localBlockers, localUnresolved };
|
|
81
|
+
}
|
|
82
|
+
export function deriveAdvisoryVerdict(assessment) {
|
|
83
|
+
const g = assessmentGroups(assessment);
|
|
84
|
+
if (g.blockers.length || g.localBlockers.length)
|
|
85
|
+
return 'Not ready';
|
|
86
|
+
if (assessment.negotiation !== 'available' || g.unresolved.length || g.localUnresolved.length)
|
|
87
|
+
return 'Readiness not confirmed';
|
|
88
|
+
return 'Ready';
|
|
89
|
+
}
|
|
90
|
+
export function assessmentContextLabel(assessment) {
|
|
91
|
+
const c = assessment.context;
|
|
92
|
+
return c ? `${c.kind === 'selected_run' ? `selected run ${c.epic_run_id}` : 'repository preview'} (${c.repo_name}; ${c.stage})` : 'assessment context unavailable';
|
|
93
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { composeReadinessAssessment, deriveAdvisoryVerdict } from './readiness-assessment.js';
|
|
2
|
+
import { localReadinessFacts } from './readiness.js';
|
|
1
3
|
/**
|
|
2
4
|
* The `epic-implementer readiness` command surface (BAPI-1055, AC-6).
|
|
3
5
|
*
|
|
@@ -43,6 +45,8 @@ import { claudeReviewWorkflowPath } from "../claude-review-workflow.js";
|
|
|
43
45
|
import { runDefaultPlanePreflight } from "../plane/cli.js";
|
|
44
46
|
import { planeNotApplicableForTarget } from "../plane/endpoint.js";
|
|
45
47
|
import { resolvePlaneServerEndpoint } from "../plane/member-roster.js";
|
|
48
|
+
import { classifyBridgeCheckout, } from "../plane/preflight.js";
|
|
49
|
+
import { createPlaneFsDeps } from "../plane/defaults.js";
|
|
46
50
|
/** Fixed notice emitted to stderr when a source could not be collected. */
|
|
47
51
|
export const READINESS_COLLECTION_NOTICE = "one or more readiness sources could not be collected; the affected prerequisites are reported as warnings.";
|
|
48
52
|
/** Usage text for `epic-implementer readiness`. */
|
|
@@ -157,14 +161,7 @@ export async function resolveReadinessReviewPolicySource(access, fetchImpl) {
|
|
|
157
161
|
return "verdict_protocol";
|
|
158
162
|
}
|
|
159
163
|
}
|
|
160
|
-
|
|
161
|
-
* Build the production report for `repoRoot`.
|
|
162
|
-
*
|
|
163
|
-
* Every seam is a real, READ-ONLY one: the install doctor's own GET, the
|
|
164
|
-
* epic-implementer doctor's local inspections, and the same plane preflight
|
|
165
|
-
* `plane up` and `drive-epic` run. Nothing is re-implemented here.
|
|
166
|
-
*/
|
|
167
|
-
async function collectProductionReport(repoRoot, env, baseUrl, epicRunId) {
|
|
164
|
+
export async function collectProductionReport(repoRoot, env, baseUrl, epicRunId, seams = {}) {
|
|
168
165
|
const { reportEnv, resolverEnv } = readinessEndpointEnvironments(env, baseUrl);
|
|
169
166
|
const accessResult = baseUrl === undefined
|
|
170
167
|
? await resolveConductorBridgeApiAccess({ env: reportEnv, cwd: repoRoot })
|
|
@@ -183,6 +180,22 @@ async function collectProductionReport(repoRoot, env, baseUrl, epicRunId) {
|
|
|
183
180
|
});
|
|
184
181
|
}
|
|
185
182
|
const access = accessResult.ok ? accessResult.access : null;
|
|
183
|
+
// BAPI-1595 — Bridge-only plane checks (the repository root, the migration head,
|
|
184
|
+
// the executor build) apply to a Bridge checkout. The shared classifier
|
|
185
|
+
// decides: only a checkout with all four markers proven absent is skipped, and
|
|
186
|
+
// an unreadable one stays distinct from that, so its checks still run.
|
|
187
|
+
let applicability = "unknown";
|
|
188
|
+
if (planeNotApplicable === null) {
|
|
189
|
+
try {
|
|
190
|
+
applicability = await (seams.classifyCheckout ??
|
|
191
|
+
((root) => classifyBridgeCheckout(root, createPlaneFsDeps())))(repoRoot);
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
applicability = "unknown";
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// Legacy rows retain their confirmed repository default. Version-1
|
|
198
|
+
// applicability is carried independently by the negotiated assessment.
|
|
186
199
|
const reviewPolicySource = await resolveReadinessReviewPolicySource(access);
|
|
187
200
|
return collectConductorReadinessGate({
|
|
188
201
|
// Never guessed: an unresolved identity is reported as such rather than
|
|
@@ -197,6 +210,7 @@ async function collectProductionReport(repoRoot, env, baseUrl, epicRunId) {
|
|
|
197
210
|
// `verdict_protocol` whenever that cannot be established. This is a
|
|
198
211
|
// prospective assessment, not a prediction or authorization of any run.
|
|
199
212
|
reviewPolicySource,
|
|
213
|
+
assessmentVersion: 1,
|
|
200
214
|
// BAPI-1465: an explicit run id also scopes the effective-review-mode row.
|
|
201
215
|
...(epicRunId !== undefined ? { epicRunId } : {}),
|
|
202
216
|
readWorkflowFile: () => fsReadFile(claudeReviewWorkflowPath(repoRoot), "utf-8"),
|
|
@@ -223,7 +237,9 @@ async function collectProductionReport(repoRoot, env, baseUrl, epicRunId) {
|
|
|
223
237
|
// are skipped without any probe.
|
|
224
238
|
...(planeNotApplicable === null
|
|
225
239
|
? {
|
|
226
|
-
runPlanePreflight: () =>
|
|
240
|
+
runPlanePreflight: () => seams.runPlanePreflight !== undefined
|
|
241
|
+
? seams.runPlanePreflight(repoRoot, reportEnv, applicability)
|
|
242
|
+
: runDefaultPlanePreflight(repoRoot, reportEnv, applicability),
|
|
227
243
|
// BAPI-1397 (F4): only for an applicable local plane.
|
|
228
244
|
...(epicRunId !== undefined ? { epicRunId } : {}),
|
|
229
245
|
}
|
|
@@ -255,6 +271,11 @@ export async function runConductorReadinessCommand(argv, deps = {}) {
|
|
|
255
271
|
const collect = deps.collect ??
|
|
256
272
|
((repoRoot) => collectProductionReport(repoRoot, env, parsed.baseUrl, parsed.epicRunId));
|
|
257
273
|
const report = await collect(cwd);
|
|
274
|
+
report.assessmentNegotiation ??= { status: 'unavailable' };
|
|
275
|
+
if (report.assessmentNegotiation.status === 'available') {
|
|
276
|
+
report.assessment = report.assessmentNegotiation.assessment;
|
|
277
|
+
report.advisoryVerdict = deriveAdvisoryVerdict(composeReadinessAssessment(report.assessmentNegotiation, localReadinessFacts(report.checks)));
|
|
278
|
+
}
|
|
258
279
|
// Fixed, sanitized, and stderr-only: never a credential, exception, header,
|
|
259
280
|
// body, subprocess output, or absolute path. It fires on a COLLECTION gap,
|
|
260
281
|
// not on a failed prerequisite — a report that says "a source is missing"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Canonical merging and bounded rendering; provider details never become public text. */
|
|
2
2
|
import { READINESS_PREREQUISITE_BY_ID, READINESS_LEGACY_IDS, READINESS_PREREQUISITE_CATALOG } from '../readiness-prerequisites.generated.js';
|
|
3
|
-
import {
|
|
3
|
+
import { resolveReadinessRemedy } from '../printed-remedy-commands.js';
|
|
4
4
|
import { createReadinessCheckSafely } from '../readiness-check.js';
|
|
5
5
|
export function mergeReadinessPrerequisites(checks, server = []) {
|
|
6
6
|
const rows = new Map();
|
|
@@ -14,15 +14,31 @@ export function mergeReadinessPrerequisites(checks, server = []) {
|
|
|
14
14
|
const unknown = check.status === 'warn' || (check.status === 'fail' && /unknown|unread|unavailable|could not|unreported|unreachable/i.test(check.detail ?? ''));
|
|
15
15
|
const status = check.status === 'pass' ? 'met' : check.status === 'skip' ? 'not_applicable' : unknown ? 'unknown' : 'not_met';
|
|
16
16
|
const impact = status === 'met' || status === 'not_applicable' ? 'info' : unknown || check.blocking !== true ? 'warning' : descriptor.impact;
|
|
17
|
-
|
|
17
|
+
// BAPI-1635: a known unmet check gets its per-ID remedy; only an unreadable one retries.
|
|
18
|
+
const fix = impact === 'info' ? '' : resolveReadinessRemedy({ id, state: status, scope: descriptor.scope });
|
|
18
19
|
const item = { ...descriptor, check_status: status, impact, fix };
|
|
19
20
|
const previous = rows.get(id);
|
|
20
21
|
if (!previous || previous.check_status === 'met')
|
|
21
22
|
rows.set(id, item);
|
|
22
23
|
}
|
|
23
|
-
for
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
// A server row stays authoritative for status, impact, scope, and order. Only its
|
|
25
|
+
// blank fix is filled, by prerequisite ID, so a wire-compatible empty fix still
|
|
26
|
+
// shows the remedy for the state the server reported.
|
|
27
|
+
for (const item of server) {
|
|
28
|
+
// A blank fix on an unmet row is filled by ID: a known state gets its per-ID remedy, and only an
|
|
29
|
+
// unknown one gets the retry. Status, impact, scope and a non-blank fix are never touched.
|
|
30
|
+
const blankUnmet = item.fix === '' && (item.check_status === 'not_met' || item.check_status === 'unknown');
|
|
31
|
+
rows.set(item.id, blankUnmet && READINESS_PREREQUISITE_BY_ID.has(item.id)
|
|
32
|
+
? { ...item, fix: resolveReadinessRemedy({ id: item.id, state: item.check_status === 'unknown' ? 'unknown' : 'not_met', scope: item.scope, impact: item.impact }) }
|
|
33
|
+
: item);
|
|
34
|
+
}
|
|
35
|
+
// BAPI-1602 — a row this build no longer lists (an older server's retired row)
|
|
36
|
+
// is shown after the catalog rows with the server's own text, never dropped.
|
|
37
|
+
const known = new Set(READINESS_PREREQUISITE_CATALOG.map(d => d.id));
|
|
38
|
+
return [
|
|
39
|
+
...READINESS_PREREQUISITE_CATALOG.flatMap(d => rows.has(d.id) ? [rows.get(d.id)] : []),
|
|
40
|
+
...[...rows.values()].filter(row => !known.has(row.id)),
|
|
41
|
+
];
|
|
26
42
|
}
|
|
27
43
|
export function prerequisiteChecks(items) {
|
|
28
44
|
return items.map(p => createReadinessCheckSafely({ id: p.id, source: 'server', label: p.label,
|
|
@@ -39,3 +55,59 @@ export function formatReadinessPrerequisites(items, options = {}) {
|
|
|
39
55
|
const state = { met: 'Met', not_met: 'Not met', unknown: "Couldn't check", not_applicable: 'Not applicable' };
|
|
40
56
|
return [verdict, ...selected.flatMap(p => [` ${p.label}: ${state[p.check_status]}`, ...(p.fix && ['not_met', 'unknown'].includes(p.check_status) ? [` ${p.fix}`] : [])])];
|
|
41
57
|
}
|
|
58
|
+
/** The explicit assessment path never derives policy from legacy text. */
|
|
59
|
+
export { composeReadinessAssessment, deriveAdvisoryVerdict } from './readiness-assessment.js';
|
|
60
|
+
import { assessmentGroups, assessmentContextLabel, deriveAdvisoryVerdict as advisoryVerdict } from './readiness-assessment.js';
|
|
61
|
+
import { assessmentRemedyQuestion } from '../printed-remedy-commands.js';
|
|
62
|
+
import { renderSetupQuestion } from '../setup-question.js';
|
|
63
|
+
export function formatReadinessAssessment(assessment, options = {}) {
|
|
64
|
+
const lines = [`Assessment: ${assessmentContextLabel(assessment)} (advisory only)`];
|
|
65
|
+
if (assessment.negotiation !== 'available')
|
|
66
|
+
lines.push(assessment.negotiation === 'unsupported'
|
|
67
|
+
? 'Version-1 assessment unsupported. Upgrade the Bridge backend or contact Bridge support; mandatory coverage remains unconfirmed.'
|
|
68
|
+
: 'Assessment unavailable. Retry readiness or contact Bridge support; mandatory coverage remains unconfirmed.');
|
|
69
|
+
const g = assessmentGroups(assessment);
|
|
70
|
+
const label = (id) => READINESS_PREREQUISITE_BY_ID.get(id)?.label ?? { 'server.canonical-index': 'Canonical index validity', 'server.parse-progress': 'Parse progress' }[id] ?? id;
|
|
71
|
+
const render = (record) => {
|
|
72
|
+
const evidence = `${label(record.id)} [${record.scope}${record.inspected_sha ? ` @ ${record.inspected_sha}` : '; revision unknown'}]: ${record.applicability === 'policy_inapplicable' ? `policy-inapplicable (${record.basis})` : `${record.observed_state}; ${record.applicability} (${record.basis})`}`;
|
|
73
|
+
lines.push(` ${evidence}`);
|
|
74
|
+
if (!options.initial && record.blocking_effect !== 'none') {
|
|
75
|
+
const question = assessmentRemedyQuestion(record.remedy, [evidence]);
|
|
76
|
+
const override = options.remedyTextForRecord?.(record);
|
|
77
|
+
lines.push(renderSetupQuestion(override === undefined ? question : { ...question, purpose: override }));
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
if (options.initial) {
|
|
81
|
+
lines.push('Current observations; setup work is in progress.');
|
|
82
|
+
assessment.records.forEach(render);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
if (g.blockers.length || g.localBlockers.length) {
|
|
86
|
+
lines.push('Mandatory blockers');
|
|
87
|
+
g.blockers.forEach(render);
|
|
88
|
+
g.localBlockers.forEach(f => lines.push(f.remedy ? ` ${f.id}: ${f.observed_state}. ${f.remedy}` : ` ${f.id}: ${f.observed_state}. Sign in or resolve this local fact, or defer and leave it unresolved; then rerun setup.`));
|
|
89
|
+
}
|
|
90
|
+
if (g.unresolved.length || g.localUnresolved.length) {
|
|
91
|
+
lines.push('Unresolved mandatory evidence');
|
|
92
|
+
g.unresolved.forEach(render);
|
|
93
|
+
g.localUnresolved.forEach(f => lines.push(f.remedy ? ` ${f.id}: ${f.observed_state}. ${f.remedy}` : ` ${f.id}: ${f.observed_state}. Retry this local observation, or defer and keep readiness unconfirmed.`));
|
|
94
|
+
}
|
|
95
|
+
const rest = assessment.records.filter(r => r.blocking_effect === 'none' && (options.all || r.applicability === 'policy_inapplicable' || r.id === 'server.parse-progress'));
|
|
96
|
+
if (rest.length) {
|
|
97
|
+
lines.push('Evidence and diagnostic progress');
|
|
98
|
+
rest.forEach(render);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const indexed = assessment.records.find(r => r.scope === 'indexed_commit')?.inspected_sha;
|
|
102
|
+
const current = assessment.records.find(r => r.scope === 'default_branch')?.inspected_sha;
|
|
103
|
+
lines.push(indexed && current ? (indexed === current ? `Workflow observations share revision ${indexed}.` : `Workflow revision mismatch: indexed ${indexed}; default branch ${current}.`) : 'Workflow revision comparison is unknown.');
|
|
104
|
+
const diagnostics = assessment.local.filter(f => f.impact === 'advisory');
|
|
105
|
+
if (diagnostics.length)
|
|
106
|
+
lines.push('Local maintenance observations (not server proof)', ...diagnostics.map(f => ` ${f.id}: ${f.observed_state}`));
|
|
107
|
+
const optional = assessment.local.filter(f => f.impact === 'optional');
|
|
108
|
+
if (!options.initial && optional.length)
|
|
109
|
+
lines.push('Optional capability', ...optional.map(f => ` ${f.id}: ${f.observed_state}. Install a persistent executor for background work, or defer it. Launch still checks its required executor capability independently.`));
|
|
110
|
+
if (!options.initial)
|
|
111
|
+
lines.push(`${advisoryVerdict(assessment)} — ${assessmentContextLabel(assessment)}; advisory only.`);
|
|
112
|
+
return lines;
|
|
113
|
+
}
|