@bridge_gpt/mcp-server 0.2.73 → 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 (123) hide show
  1. package/README.md +14 -7
  2. package/build/agent-launchers/claude-executor-adapter.js +12 -0
  3. package/build/agent-launchers/prompt.js +9 -21
  4. package/build/agents.generated.js +4 -4
  5. package/build/authored-plan.js +542 -0
  6. package/build/bridge-config.js +7 -1
  7. package/build/bridge-permissions.js +11 -0
  8. package/build/command-provisioning.js +4 -3
  9. package/build/commands.generated.js +6 -6
  10. package/build/conductor/bridge-api-client.js +692 -47
  11. package/build/conductor/command-drift.js +1 -1
  12. package/build/conductor/declared-extras.js +335 -0
  13. package/build/conductor/doctor.js +2 -0
  14. package/build/conductor/driver-pass-output.js +104 -0
  15. package/build/conductor/driver-pass.js +571 -0
  16. package/build/conductor/epic-branch-ci-inspection.js +61 -16
  17. package/build/conductor/epic-implementer-cli.js +370 -93
  18. package/build/conductor/epic-server-sfcc-upload.js +1567 -0
  19. package/build/conductor/epic-server-sfcc.js +58 -80
  20. package/build/conductor/epic-server.js +57 -4
  21. package/build/conductor/gate-discovery.js +253 -13
  22. package/build/conductor/gate-settings-review.js +58 -25
  23. package/build/conductor/launch-plan.js +58 -12
  24. package/build/conductor/open-decision-phrases.js +50 -0
  25. package/build/conductor/prerequisite-inputs.js +181 -14
  26. package/build/connect-github-api.js +18 -0
  27. package/build/connect-github.js +35 -18
  28. package/build/credential-delivery.js +280 -0
  29. package/build/credential-launch-safety.js +142 -0
  30. package/build/credential-materialization.js +91 -16
  31. package/build/credential-references-node-deps.js +29 -0
  32. package/build/credential-references.js +1394 -0
  33. package/build/credential-references.test-fixtures.js +211 -0
  34. package/build/credential-scan-conventions.js +145 -0
  35. package/build/credential-scan.js +517 -0
  36. package/build/credential-store.js +50 -0
  37. package/build/credentials-cli.js +252 -3
  38. package/build/dependency-install-declarations.js +47 -1
  39. package/build/docs.generated.js +8 -1
  40. package/build/doctor.js +41 -0
  41. package/build/drive-epic.js +684 -49
  42. package/build/epic-branch-ci-summary.js +18 -1
  43. package/build/epic-capability-statement.js +71 -3
  44. package/build/epic-ci-workflow-drift.js +52 -13
  45. package/build/epic-ci-workflow-install.js +31 -6
  46. package/build/epic-ci-workflow-v3.js +273 -0
  47. package/build/epic-ci-workflow.js +129 -7
  48. package/build/epic-implementer-bin.js +288 -83
  49. package/build/epic-implementer-bundle-cli.js +61 -0
  50. package/build/epic-implementer-claude-hook-bin.js +1 -1
  51. package/build/epic-implementer-env.js +3 -4
  52. package/build/epic-integration-pr.js +5 -2
  53. package/build/epic-launch-context.js +102 -7
  54. package/build/epic-server-record.js +30 -15
  55. package/build/executor/completion-contract.js +24 -1
  56. package/build/executor/credential-delivery-step.js +168 -0
  57. package/build/executor/deps.js +3 -1
  58. package/build/executor/env.js +39 -1
  59. package/build/executor/epic-server-context.js +23 -7
  60. package/build/executor/gate-qualification-job.js +193 -23
  61. package/build/executor/gate-qualification-tests-ran.js +232 -0
  62. package/build/executor/guarded-fast-forward-push.js +13 -8
  63. package/build/executor/job-runner.js +167 -738
  64. package/build/executor/job-type-wrappers.js +734 -0
  65. package/build/executor/permissions.js +85 -3
  66. package/build/executor/preflight.js +6 -2
  67. package/build/executor/process-containment.js +8 -1
  68. package/build/executor/prompt-spec.js +37 -3
  69. package/build/executor/required-verification.js +28 -2
  70. package/build/executor/runner.js +4 -1
  71. package/build/executor/types.js +9 -0
  72. package/build/executor/worker-database.js +6 -1
  73. package/build/executor/worker-guard-hook.js +24 -2
  74. package/build/executor-launch.js +4 -2
  75. package/build/generated/ticket-status.js +20 -0
  76. package/build/git-exclude-lock.js +187 -0
  77. package/build/index.js +589 -326
  78. package/build/install-bridge-conductor-answers.js +112 -22
  79. package/build/install-bridge-conductor-apply.js +38 -1
  80. package/build/install-bridge-conductor-assessment.js +482 -53
  81. package/build/install-bridge-conductor-compact.js +29 -2
  82. package/build/install-bridge-conductor-contracts.js +10 -1
  83. package/build/install-bridge-conductor-gate.js +379 -89
  84. package/build/install-bridge-conductor-setup.js +46 -8
  85. package/build/install-bridge-conductor-trial-report.js +170 -0
  86. package/build/install-bridge-conductor.js +925 -141
  87. package/build/install-bridge.js +88 -11
  88. package/build/install-doctor.js +38 -8
  89. package/build/install-sfcc-detection.js +120 -0
  90. package/build/install-sfcc-setup.js +185 -0
  91. package/build/mcp-grant-candidates.js +108 -96
  92. package/build/mcp-invoke.js +168 -4
  93. package/build/mcp-provisioning.js +21 -4
  94. package/build/mcp-server-invocation.js +13 -0
  95. package/build/merge-workflow-install.js +9 -1
  96. package/build/pipelines.generated.js +8 -7
  97. package/build/plan-generation.js +17 -0
  98. package/build/plane/status.js +8 -2
  99. package/build/printed-remedy-commands.js +59 -0
  100. package/build/project-root.js +40 -0
  101. package/build/readme.generated.js +1 -1
  102. package/build/repository-state-paths.js +5 -2
  103. package/build/repository-toolchains.js +16 -7
  104. package/build/scripts/saved-commands-config-field-driver.js +65 -0
  105. package/build/setup-epic.js +126 -16
  106. package/build/sfcc/credentials.js +3 -2
  107. package/build/sfcc/hostname.js +98 -2
  108. package/build/sfcc/tool-wrapper.js +6 -95
  109. package/build/start-tickets.js +193 -29
  110. package/build/test-support/executor-source-files.js +200 -0
  111. package/build/testing-config-client.js +25 -2
  112. package/build/third-party-mcp-targets.js +35 -4
  113. package/build/v2-readiness-requirements.js +5 -1
  114. package/build/version.generated.js +3 -3
  115. package/build/with-credentials.js +208 -0
  116. package/build/worker-guard-hook-bin.js +2 -2
  117. package/build/worktree-credential-delivery.js +340 -0
  118. package/docs/EPIC-IMPLEMENTER.md +4 -4
  119. package/docs/install/github-app.md +79 -92
  120. package/package.json +1 -1
  121. package/build/conductor/epic-reconcile.js +0 -603
  122. package/build/conductor/epic-runtime.js +0 -2020
  123. package/build/conductor/epic-state.js +0 -774
@@ -21,6 +21,7 @@
21
21
  import { createHash } from "node:crypto";
22
22
  import { CONDITIONAL_ANSWER_KEYS, INSTALL_ANSWER_KEYS, INSTALL_PROPOSAL_DIGEST_VERSION, isInstallAnswerKey, } from "./install-bridge-conductor-contracts.js";
23
23
  import { REINDEX_BRANCH_EFFECTS, REINDEX_RETRY_EFFECTS, choiceFor, resolveEpicBranchCiRecommendation, } from "./install-bridge-conductor-assessment.js";
24
+ import { DEPENDENCY_INSTALL_UNSAFE_MESSAGE, isUnsafeDependencyInstallEntry, parseDependencyInstallStrict, } from "./dependency-install-declarations.js";
24
25
  import { isValidCredentialReference, isValidSfccSandboxId, normalizeStorefrontOrigin } from "./epic-server-record.js";
25
26
  /** The largest answers file read. A setup answers object is a few kilobytes. */
26
27
  export const MAX_ANSWERS_BYTES = 256 * 1024;
@@ -83,6 +84,9 @@ const OPTION_VOCABULARY = Object.freeze({
83
84
  launch_profile: ["save", "skip"],
84
85
  epic_ci_change: ["approve", "decline", "keep"],
85
86
  });
87
+ /** BAPI-1699 — the most commands one `commands` answer may carry, and the longest line. */
88
+ const TEST_COMMANDS_MAX = 4;
89
+ const TEST_COMMAND_MAX_CHARS = 500;
86
90
  function isPlainObject(value) {
87
91
  return value !== null && typeof value === "object" && !Array.isArray(value);
88
92
  }
@@ -121,25 +125,69 @@ export function parseAnswerValue(key, raw) {
121
125
  }
122
126
  return bad("invalid_value", 'Use "decline", "keep", or a list of offered option ids ([] approves none).');
123
127
  }
128
+ if (key === "test_command" && isPlainObject(raw) && Object.hasOwn(raw, "commands")) {
129
+ // BAPI-1699: the whole list or a refusal. The detail is position-based and never
130
+ // echoes a submitted value, and accepted strings are kept exactly as given.
131
+ const shape = 'Use {"commands": ["<one line>", ...]} with one to four commands.';
132
+ if (Object.keys(raw).length !== 1 || !Array.isArray(raw.commands))
133
+ return bad("invalid_value", shape);
134
+ const list = raw.commands;
135
+ if (list.length < 1 || list.length > TEST_COMMANDS_MAX) {
136
+ return bad("invalid_value", `Give between 1 and ${TEST_COMMANDS_MAX} commands.`);
137
+ }
138
+ for (let i = 0; i < list.length; i += 1) {
139
+ const entry = list[i];
140
+ if (typeof entry !== "string" || entry.trim().length === 0 || entry.length > TEST_COMMAND_MAX_CHARS || /[\r\n]/.test(entry)) {
141
+ return bad("invalid_value", `Command ${i + 1} must be one non-blank line of at most ${TEST_COMMAND_MAX_CHARS} characters.`);
142
+ }
143
+ }
144
+ return { ok: true, decision: { kind: "commands", commands: [...list] } };
145
+ }
124
146
  if (key === "test_command" && isPlainObject(raw)) {
125
147
  if (onlyKeys(raw, ["command"]) && typeof raw.command === "string" && raw.command.trim().length > 0 && raw.command.length <= 500 && !/[\r\n]/.test(raw.command)) {
126
148
  return { ok: true, decision: { kind: "command", command: raw.command.trim() } };
127
149
  }
128
- return bad("invalid_value", 'Use "learn", "skip", "keep", or {"command": "<one line>"}.');
150
+ return bad("invalid_value", 'Use "learn", "skip", "keep", {"command": "<one line>"}, or {"commands": ["<one line>", ...]}.');
151
+ }
152
+ if (key === "dependency_install" && isPlainObject(raw)) {
153
+ const shape = 'Use "approve", "decline", "keep", or {"entries": [{"cwd": ".", "argv": ["..."], "lockfiles": ["..."]}]}.';
154
+ if (Object.keys(raw).length !== 1 || !Array.isArray(raw.entries))
155
+ return bad("invalid_value", shape);
156
+ // The whole list or a refusal. Neither refusal carries any part of the submitted list.
157
+ if (raw.entries.some(isUnsafeDependencyInstallEntry))
158
+ return bad("literal_credential", DEPENDENCY_INSTALL_UNSAFE_MESSAGE);
159
+ const entries = parseDependencyInstallStrict(raw.entries);
160
+ if (entries === null)
161
+ return bad("invalid_value", shape);
162
+ return { ok: true, decision: { kind: "dependency_install_entries", entries } };
129
163
  }
130
164
  if (key === "epic_server" && isPlainObject(raw)) {
131
- if (!onlyKeys(raw, ["mode", "sandbox_id", "credential_ref", "storefront_origin"]) || raw.mode !== "sfcc_shared_active") {
132
- return bad("invalid_value", 'Use "keep", "none", "local", or an sfcc_shared_active object.');
165
+ const mode = raw.mode;
166
+ if (!onlyKeys(raw, ["mode", "sandbox_id", "credential_ref", "storefront_origin"]) || (mode !== "sfcc_shared_active" && mode !== "local" && mode !== "none")) {
167
+ return bad("invalid_value", 'Use "keep", "none", "local", an sfcc_shared_active object, or a local or none object with a sandbox.');
133
168
  }
134
- const origin = normalizeStorefrontOrigin(raw.storefront_origin);
135
- if (!isValidSfccSandboxId(raw.sandbox_id) || !isValidCredentialReference(raw.credential_ref) || origin === null) {
136
- return bad("invalid_value", "The sfcc_shared_active answer needs a valid sandbox_id, credential_ref, and storefront_origin.");
169
+ const originGiven = raw.storefront_origin !== undefined;
170
+ const origin = originGiven || mode === "sfcc_shared_active" ? normalizeStorefrontOrigin(raw.storefront_origin) : null;
171
+ if (mode === "sfcc_shared_active") {
172
+ if (!isValidSfccSandboxId(raw.sandbox_id) || !isValidCredentialReference(raw.credential_ref) || origin === null) {
173
+ return bad("invalid_value", "The sfcc_shared_active answer needs a valid sandbox_id, credential_ref, and storefront_origin.");
174
+ }
175
+ return {
176
+ ok: true,
177
+ decision: {
178
+ kind: "epic_server_sfcc",
179
+ value: { mode, sandbox_id: raw.sandbox_id, credential_ref: raw.credential_ref, storefront_origin: origin },
180
+ },
181
+ };
182
+ }
183
+ if (!isValidSfccSandboxId(raw.sandbox_id) || !isValidCredentialReference(raw.credential_ref) || (originGiven && origin === null)) {
184
+ return bad("invalid_value", `The ${mode} sandbox answer needs a valid sandbox_id and credential_ref, and any storefront_origin must be valid.`);
137
185
  }
138
186
  return {
139
187
  ok: true,
140
188
  decision: {
141
189
  kind: "epic_server_sfcc",
142
- value: { mode: "sfcc_shared_active", sandbox_id: raw.sandbox_id, credential_ref: raw.credential_ref, storefront_origin: origin },
190
+ value: { mode, sandbox_id: raw.sandbox_id, credential_ref: raw.credential_ref, ...(origin !== null ? { storefront_origin: origin } : {}) },
143
191
  },
144
192
  };
145
193
  }
@@ -212,12 +260,16 @@ function effectFor(key, choice, decision) {
212
260
  return effects.reference !== undefined ? { ...effects.reference, params: { reference: decision.reference } } : null;
213
261
  case "command":
214
262
  return { action: "qualify_owner_test_command", target: "repository_gate.local_commands", params: { command: decision.command }, condition: "only_if_check_passes" };
263
+ case "commands":
264
+ return { action: "qualify_saved_test_commands", target: "repository_gate.local_commands", params: { commands: decision.commands }, condition: "only_if_check_passes" };
215
265
  case "epic_server_sfcc":
216
- return effects.sfcc_shared_active !== undefined
217
- ? { ...effects.sfcc_shared_active, params: { ...decision.value } }
266
+ return effects[decision.value.mode] !== undefined
267
+ ? { ...effects[decision.value.mode], params: { ...decision.value } }
218
268
  : null;
219
269
  case "profile":
220
270
  return { action: "write_launch_profile", target: "launch_profile", params: { name: decision.name } };
271
+ case "dependency_install_entries":
272
+ return { action: "store_declaration", target: "repository_gate.dependency_install", params: { value: decision.entries } };
221
273
  }
222
274
  }
223
275
  function intentOf(decision, effect) {
@@ -233,7 +285,7 @@ function consequenceOf(choice, decision) {
233
285
  const id = decision.kind === "option" ? decision.option
234
286
  : decision.kind === "decline" ? "decline"
235
287
  : decision.kind === "reference" ? "reference"
236
- : decision.kind === "epic_server_sfcc" ? "sfcc_shared_active"
288
+ : decision.kind === "epic_server_sfcc" ? decision.value.mode
237
289
  : null;
238
290
  if (decision.kind === "selection") {
239
291
  return decision.ids.length === 0
@@ -242,6 +294,15 @@ function consequenceOf(choice, decision) {
242
294
  }
243
295
  if (decision.kind === "command")
244
296
  return "Bridge proves your command with one bounded check and stores it only if it passes.";
297
+ if (decision.kind === "commands") {
298
+ const lines = decision.commands.map((command) => `\`${command}\``).join(", ");
299
+ return `Saves your ${decision.commands.length} test command${decision.commands.length === 1 ? "" : "s"} right away, in the order you gave: ${lines}. They are not relied on for the guard until they passed the trial run in a clean checkout.`;
300
+ }
301
+ if (decision.kind === "dependency_install_entries") {
302
+ return decision.entries.length === 0
303
+ ? "Stores an empty list: workers and the test trial run no declared install, and managed CI uses its normal toolchain install."
304
+ : `Stores your ${decision.entries.length} install command${decision.entries.length === 1 ? "" : "s"} in place of the whole list, in the order you gave. Workers, the test trial, and managed CI all use exactly these.`;
305
+ }
245
306
  return choice.options.find((o) => o.id === id)?.consequence ?? "Nothing changes.";
246
307
  }
247
308
  const DEPENDS_ON = Object.freeze({
@@ -257,6 +318,30 @@ const DEPENDS_ON = Object.freeze({
257
318
  // BAPI-1659: `epic_ci_change` has no dependency. It opens its own pull request, so a declined
258
319
  // setup pull request never blocks it, and the test-command dependency stays on `setup_pr` alone.
259
320
  });
321
+ /**
322
+ * The digest refusal. BAPI-1677: a stale approval also names the answers it may have
323
+ * approved something else for. The digest cannot say which input moved, so each key
324
+ * whose approved write depends on repository facts is named. The digest is still
325
+ * compared strictly: naming a key refuses the file, it never lets the file through.
326
+ */
327
+ function digestMismatchReason(actions, ciOmitted = false) {
328
+ const writes = (key) => actions.some((a) => a.key === key && a.intent === "write");
329
+ const named = [
330
+ ["dependency_install", "The install commands setup would store may have changed."],
331
+ ["epic_ci_change", "The CI change setup would make may have changed."],
332
+ ];
333
+ const affected = named.filter(([key]) => writes(key));
334
+ return {
335
+ reason: "digest_mismatch",
336
+ keys: ["proposal_digest", ...(ciOmitted ? ["epic_branch_ci"] : []), ...affected.map(([key]) => key)],
337
+ detail: "The answers no longer match what setup would do now: the repository, destination, credential binding, " +
338
+ "an offered option, or a target changed since the proposal was shown." +
339
+ (ciOmitted
340
+ ? " The epic_branch_ci answer was omitted, so its recommendation was resolved again from your other answers; state it to keep it."
341
+ : "") +
342
+ affected.map(([, text]) => ` ${text}`).join(""),
343
+ };
344
+ }
260
345
  /**
261
346
  * Validate the whole answers object against the assessment, merge the flags,
262
347
  * and build the normalized proposal and its digest. Nothing here writes.
@@ -294,7 +379,7 @@ export function normalizeInstallAnswers(input) {
294
379
  if (choice !== undefined) {
295
380
  const d = parsed.decision;
296
381
  const optionId = d.kind === "option" ? d.option : d.kind === "decline" ? "decline" : d.kind === "reference" ? "reference"
297
- : d.kind === "epic_server_sfcc" ? "sfcc_shared_active" : null;
382
+ : d.kind === "epic_server_sfcc" ? d.value.mode : null;
298
383
  if (optionId !== null && !acceptsOption(choice, optionId)) {
299
384
  add("option_not_offered", rawKey, "This option is not one the assessment offers for this key.");
300
385
  continue;
@@ -383,30 +468,35 @@ export function normalizeInstallAnswers(input) {
383
468
  const digest = computeProposalDigest(proposal);
384
469
  if (input.mode === "apply") {
385
470
  const supplied = envelope.proposal_digest;
471
+ // An omitted epic_branch_ci takes the current recommendation, which the answers around it
472
+ // can change. Name it, so the owner knows to state it; omission is never approval of the
473
+ // newly resolved decision.
474
+ const ciOmitted = !stated.has("epic_branch_ci") && flags.epic_branch_ci === undefined;
386
475
  if (supplied === undefined) {
387
476
  reasons.push({ reason: "digest_missing", keys: ["proposal_digest"], detail: "An answers apply needs the proposal_digest proposal mode returned." });
388
477
  }
389
478
  else if (typeof supplied !== "string" || !DIGEST_RE.test(supplied)) {
390
479
  reasons.push({ reason: "invalid_value", keys: ["proposal_digest"], detail: "proposal_digest must be the 64-character hex digest proposal mode returned." });
391
480
  }
392
- else if (supplied !== digest && reasons.every((r) => r.reason === "missing_consequential" && r.keys.includes("epic_ci_change"))) {
481
+ else if (supplied !== digest &&
482
+ reasons.every((r) => r.reason === "missing_consequential" && r.keys.includes("epic_ci_change") && !r.keys.includes("dependency_install"))) {
393
483
  // BAPI-1659: a saved envelope from before the CI change was independently offered cannot
394
484
  // name it. It is stale, not incomplete: refuse it as a digest mismatch so nothing is
395
- // prompted for, defaulted, or inferred from the setup answer.
485
+ // prompted for, defaulted, or inferred from the setup answer. BAPI-1677: this never
486
+ // clears a missing install answer, which must stay named.
396
487
  reasons.length = 0;
397
- reasons.push({
398
- reason: "digest_mismatch",
399
- keys: ["proposal_digest"],
400
- detail: "The answers no longer match what setup would do now: the repository, destination, credential binding, " +
401
- "an offered option, or a target changed since the proposal was shown.",
402
- });
488
+ reasons.push(digestMismatchReason(actions, ciOmitted));
403
489
  }
404
490
  else if (supplied !== digest && reasons.length === 0) {
491
+ reasons.push(digestMismatchReason(actions, ciOmitted));
492
+ }
493
+ else if (supplied !== digest && actions.some((a) => a.key === "dependency_install" && a.intent === "write")) {
494
+ // BAPI-1677: other reasons are named too, but a stale approval of install commands is
495
+ // always named, so the owner learns the commands may have changed.
405
496
  reasons.push({
406
497
  reason: "digest_mismatch",
407
- keys: ["proposal_digest"],
408
- detail: "The answers no longer match what setup would do now: the repository, destination, credential binding, " +
409
- "an offered option, or a target changed since the proposal was shown.",
498
+ keys: ["dependency_install"],
499
+ detail: "The install commands setup would store may have changed since these answers approved them.",
410
500
  });
411
501
  }
412
502
  }
@@ -14,6 +14,7 @@
14
14
  * `unattempted`; independent ones still run. Nothing is rolled back.
15
15
  * - The setup record is written here and nowhere else, only after approval.
16
16
  */
17
+ import { isTrialPhase, presentTrialResult } from "./install-bridge-conductor-trial-report.js";
17
18
  import { SETUP_RECORD_RELATIVE_PATH, } from "./install-bridge-conductor-contracts.js";
18
19
  const NOT_COMPLETED = new Set(["failed", "refused", "uncertain", "unattempted"]);
19
20
  const COMPLETE = new Set(["written", "unchanged", "declined"]);
@@ -135,12 +136,46 @@ export function renderSetupRecord(proposal, digest, results) {
135
136
  continue;
136
137
  }
137
138
  const inPlace = r.status === "written" || r.status === "unchanged";
139
+ // BAPI-1679: the stored decision differs from the approved one, so "in place" would be false.
140
+ if (r.key === "epic_branch_ci" && inPlace && r.reason !== undefined) {
141
+ lines.push(`| ${r.key} | recorded ${String(r.read_back?.decision)} | ${r.target} | ${r.reason.replace(/\|/g, "\\|")} |`);
142
+ continue;
143
+ }
138
144
  const shown = inPlace ? "in place" : r.status;
139
145
  const target = inPlace ? proposal?.actions.find((a) => a.key === r.key)?.effect?.target ?? r.target : r.target;
140
146
  const shownDetail = inPlace ? "" : detail;
141
147
  lines.push(`| ${r.key} | ${shown} | ${target} | ${shownDetail.replace(/\|/g, "\\|")} |`);
142
148
  }
143
149
  lines.push("");
150
+ // BAPI-1677: the approved install commands, once they are confirmed in place. The text comes
151
+ // from the approved proposal, so a replay that finds them unchanged leaves the record alone.
152
+ // An install that worked is not a test command that passed the trial run, and a failed trial is not a failed install.
153
+ const installResult = results.find((r) => r.key === "dependency_install");
154
+ const installValue = proposal?.actions.find((a) => a.key === "dependency_install")?.effect?.params?.value;
155
+ if (Array.isArray(installValue) && (installResult?.status === "written" || installResult?.status === "unchanged")) {
156
+ lines.push("## Install commands", "");
157
+ if (installValue.length === 0)
158
+ lines.push("None declared. Workers and the test trial run no declared install, and managed CI uses its normal toolchain install.");
159
+ for (const entry of installValue) {
160
+ lines.push(`- \`${entry.argv.join(" ").replace(/`/g, "'")}\` in \`${entry.cwd}\`; runs in each fresh worker worktree, and again only when ${entry.lockfiles.join(", ")} changes.`);
161
+ }
162
+ lines.push("");
163
+ }
164
+ const trial = results.find((r) => r.key === "test_command");
165
+ const ran = trial?.read_back?.ran;
166
+ if (Array.isArray(ran) && (trial?.status === "written" || trial?.status === "unchanged")) {
167
+ // The command the server reports, never the one Bridge expected to try.
168
+ lines.push("## Test trial", "", `Passed the trial run. The test command is ${ran.map((c) => `\`${c.replace(/`/g, "'")}\``).join(", ")}.`, "");
169
+ }
170
+ else if (trial?.status === "failed" && trial.phase != null) {
171
+ // BAPI-1698: the same phase-specific presentation every setup path uses.
172
+ const presentation = presentTrialResult({
173
+ phase: isTrialPhase(trial.phase) ? trial.phase : null,
174
+ dependencyInstallDeclared: null,
175
+ });
176
+ lines.push("## Test trial", "", `${presentation.headline}. ${presentation.explanation} No test command was stored. The install commands are unaffected.` +
177
+ (presentation.remedy !== null ? ` Next: ${presentation.remedy}` : ""), "");
178
+ }
144
179
  return lines.join("\n");
145
180
  }
146
181
  /**
@@ -170,8 +205,10 @@ function describeDecision(decision) {
170
205
  case "selection": return decision.ids.length === 0 ? "none selected" : `${decision.ids.length} selected`;
171
206
  case "reference": return decision.reference.kind === "env" ? `reference env:${decision.reference.name}` : `reference credential_store:${decision.reference.target}`;
172
207
  case "command": return "owner command";
173
- case "epic_server_sfcc": return "sfcc_shared_active";
208
+ case "commands": return `${decision.commands.length} test command${decision.commands.length === 1 ? "" : "s"} given`;
209
+ case "epic_server_sfcc": return decision.value.mode;
174
210
  case "profile": return `profile ${decision.name}`;
211
+ case "dependency_install_entries": return decision.entries.length === 0 ? "empty install list" : `${decision.entries.length} install command${decision.entries.length === 1 ? "" : "s"} given`;
175
212
  }
176
213
  }
177
214
  async function writeSetupRecord(input, results, writer) {