@skyramp/mcp 0.3.8 → 0.4.0-rc.1

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 (229) hide show
  1. package/build/commands/commandLibrary.d.ts +1 -1
  2. package/build/commands/commandLibrary.js +3 -3
  3. package/build/commands/recommendTestsAndExecuteCommand.d.ts +1 -1
  4. package/build/commands/recommendTestsAndExecuteCommand.js +35 -20
  5. package/build/commands/testThisEndpointCommand.js +35 -19
  6. package/build/index.js +9 -3
  7. package/build/playwright/blueprintDigest.d.ts +15 -0
  8. package/build/playwright/blueprintDigest.js +152 -0
  9. package/build/playwright/blueprintDigestStore.d.ts +31 -0
  10. package/build/playwright/blueprintDigestStore.js +117 -0
  11. package/build/playwright/registerPlaywrightTools.js +60 -12
  12. package/build/playwright/traceRecordingPrompt.js +8 -7
  13. package/build/prompts/enhance-assertions/sharedAssertionRules.js +9 -8
  14. package/build/prompts/enhance-assertions/uiAssertionsPrompt.js +24 -2
  15. package/build/prompts/promptAssets.d.ts +20 -0
  16. package/build/prompts/promptAssets.js +55 -0
  17. package/build/prompts/sut-setup/modes/dockerComposePrompt.js +19 -5
  18. package/build/prompts/test-maintenance/actionsInstructions.d.ts +4 -0
  19. package/build/prompts/test-maintenance/actionsInstructions.js +14 -2
  20. package/build/prompts/test-maintenance/drift-analysis-prompt.d.ts +0 -10
  21. package/build/prompts/test-maintenance/drift-analysis-prompt.js +2 -11
  22. package/build/prompts/test-maintenance/uiDriftAnalysisSections.js +8 -4
  23. package/build/prompts/test-recommendation/diffExecutionPlan.d.ts +5 -22
  24. package/build/prompts/test-recommendation/diffExecutionPlan.js +37 -465
  25. package/build/prompts/test-recommendation/recommendationSections.d.ts +7 -17
  26. package/build/prompts/test-recommendation/recommendationSections.js +67 -309
  27. package/build/prompts/test-recommendation/recommendationShared.d.ts +19 -47
  28. package/build/prompts/test-recommendation/recommendationShared.js +49 -155
  29. package/build/prompts/test-recommendation/registerRecommendTestsPrompt.d.ts +0 -5
  30. package/build/prompts/test-recommendation/registerRecommendTestsPrompt.js +10 -153
  31. package/build/prompts/test-recommendation/test-recommendation-prompt.d.ts +2 -29
  32. package/build/prompts/test-recommendation/test-recommendation-prompt.js +32 -457
  33. package/build/prompts/testbot/planDeclarations.d.ts +6 -0
  34. package/build/prompts/testbot/planDeclarations.js +9 -0
  35. package/build/prompts/testbot/testbot-prompts.d.ts +8 -0
  36. package/build/prompts/testbot/testbot-prompts.js +256 -381
  37. package/build/recommendation/answers.d.ts +35 -0
  38. package/build/recommendation/answers.js +96 -0
  39. package/build/recommendation/registerPlan.d.ts +49 -0
  40. package/build/recommendation/registerPlan.js +117 -0
  41. package/build/recommendation/runVerifiers.d.ts +10 -0
  42. package/build/recommendation/runVerifiers.js +49 -0
  43. package/build/recommendation/subjectStep.d.ts +42 -0
  44. package/build/recommendation/subjectStep.js +86 -0
  45. package/build/recommendation/types.d.ts +163 -0
  46. package/build/recommendation/types.js +20 -0
  47. package/build/recommendation/verifierContracts.d.ts +382 -0
  48. package/build/recommendation/verifierContracts.js +263 -0
  49. package/build/recommendation/verifiers/changedFile.d.ts +2 -0
  50. package/build/recommendation/verifiers/changedFile.js +82 -0
  51. package/build/recommendation/verifiers/citedPath.d.ts +12 -0
  52. package/build/recommendation/verifiers/citedPath.js +35 -0
  53. package/build/recommendation/verifiers/coverage.d.ts +7 -0
  54. package/build/recommendation/verifiers/coverage.js +617 -0
  55. package/build/recommendation/verifiers/deliveredMatchesPlan.d.ts +11 -0
  56. package/build/recommendation/verifiers/deliveredMatchesPlan.js +33 -0
  57. package/build/recommendation/verifiers/endpointGrounded.d.ts +17 -0
  58. package/build/recommendation/verifiers/endpointGrounded.js +128 -0
  59. package/build/recommendation/verifiers/existingCoverage.d.ts +6 -0
  60. package/build/recommendation/verifiers/existingCoverage.js +51 -0
  61. package/build/recommendation/verifiers/expectedOutcome.d.ts +31 -0
  62. package/build/recommendation/verifiers/expectedOutcome.js +105 -0
  63. package/build/recommendation/verifiers/removedElementGuarded.d.ts +2 -0
  64. package/build/recommendation/verifiers/removedElementGuarded.js +57 -0
  65. package/build/recommendation/verifiers/reportedCategory.d.ts +26 -0
  66. package/build/recommendation/verifiers/reportedCategory.js +84 -0
  67. package/build/recommendation/verifiers/screenRoute.d.ts +10 -0
  68. package/build/recommendation/verifiers/screenRoute.js +118 -0
  69. package/build/recommendation/verifiers/statedDifference.d.ts +6 -0
  70. package/build/recommendation/verifiers/statedDifference.js +140 -0
  71. package/build/recommendation/verifiers/uiElementGrounded.d.ts +7 -0
  72. package/build/recommendation/verifiers/uiElementGrounded.js +318 -0
  73. package/build/resources/analysisResources.js +1 -114
  74. package/build/resources/testbotResource.js +23 -13
  75. package/build/services/ModularizationService.js +2 -1
  76. package/build/services/TestDiscoveryService.d.ts +3 -72
  77. package/build/services/TestDiscoveryService.js +10 -303
  78. package/build/services/containerEnv.d.ts +1 -1
  79. package/build/services/containerEnv.js +12 -0
  80. package/build/skills/fixTestImportErrorsSkill.d.ts +13 -0
  81. package/build/skills/fixTestImportErrorsSkill.js +20 -0
  82. package/build/toolNames.d.ts +1 -0
  83. package/build/toolNames.js +1 -0
  84. package/build/tools/code-refactor/enhanceAssertionsTool.js +3 -3
  85. package/build/tools/code-refactor/modularizationTool.js +2 -1
  86. package/build/tools/executeSkyrampTestTool.d.ts +80 -0
  87. package/build/tools/executeSkyrampTestTool.js +246 -19
  88. package/build/tools/generate-tests/generateBatchScenarioRestTool.js +6 -0
  89. package/build/tools/generate-tests/generateContractRestTool.js +3 -3
  90. package/build/tools/generate-tests/planGuard.d.ts +2 -2
  91. package/build/tools/generate-tests/planGuard.js +78 -18
  92. package/build/tools/one-click/oneClickTool.d.ts +0 -1
  93. package/build/tools/one-click/oneClickTool.js +0 -5
  94. package/build/tools/submitReportTool.d.ts +48 -42
  95. package/build/tools/submitReportTool.js +576 -193
  96. package/build/tools/test-management/actionsTool.js +72 -4
  97. package/build/tools/test-management/analyzeChangesTool.d.ts +144 -48
  98. package/build/tools/test-management/analyzeChangesTool.js +212 -1219
  99. package/build/tools/test-management/analyzeTestHealthTool.js +13 -24
  100. package/build/tools/test-management/index.d.ts +1 -0
  101. package/build/tools/test-management/index.js +1 -0
  102. package/build/tools/test-management/registerTestPlanTool.d.ts +795 -172
  103. package/build/tools/test-management/registerTestPlanTool.js +609 -542
  104. package/build/tools/test-management/resolveScreenTool.d.ts +75 -0
  105. package/build/tools/test-management/resolveScreenTool.js +289 -0
  106. package/build/types/BlueprintDigest.d.ts +34 -0
  107. package/build/types/BlueprintDigest.js +1 -0
  108. package/build/types/RepositoryAnalysis.d.ts +20 -1559
  109. package/build/types/RepositoryAnalysis.js +2 -58
  110. package/build/types/StepMethod.d.ts +40 -0
  111. package/build/types/StepMethod.js +77 -0
  112. package/build/types/TestAnalysis.d.ts +12 -0
  113. package/build/types/TestExecution.d.ts +4 -0
  114. package/build/types/TestRecommendation.d.ts +24 -24
  115. package/build/types/TestRecommendation.js +91 -89
  116. package/build/types/TestbotPromptOptions.d.ts +0 -4
  117. package/build/types/TestbotReport.d.ts +64 -2
  118. package/build/utils/AnalysisStateManager.d.ts +79 -113
  119. package/build/utils/AnalysisStateManager.js +147 -57
  120. package/build/utils/assertion-verify/api-shared-lints.js +1 -1
  121. package/build/utils/assertion-verify/metrics.js +85 -36
  122. package/build/utils/assertion-verify/ui-lints.d.ts +0 -5
  123. package/build/utils/assertion-verify/ui-lints.js +32 -0
  124. package/build/utils/branchDiff.d.ts +63 -31
  125. package/build/utils/branchDiff.js +242 -94
  126. package/build/utils/containedPath.d.ts +18 -0
  127. package/build/utils/containedPath.js +73 -0
  128. package/build/utils/dartRouteExtractor.d.ts +18 -34
  129. package/build/utils/dartRouteExtractor.js +101 -173
  130. package/build/utils/featureFlags.d.ts +12 -0
  131. package/build/utils/featureFlags.js +14 -0
  132. package/build/utils/frontendSelectors.d.ts +48 -27
  133. package/build/utils/frontendSelectors.js +241 -80
  134. package/build/utils/pathMatching.d.ts +2 -4
  135. package/build/utils/pathMatching.js +2 -4
  136. package/build/utils/planMatchKeys.d.ts +38 -47
  137. package/build/utils/planMatchKeys.js +143 -81
  138. package/build/utils/rebaselineSnapshots.d.ts +24 -0
  139. package/build/utils/rebaselineSnapshots.js +65 -0
  140. package/build/utils/removedUiElements.d.ts +22 -0
  141. package/build/utils/removedUiElements.js +106 -0
  142. package/build/utils/reportVerification.d.ts +2 -6
  143. package/build/utils/reportVerification.js +61 -2
  144. package/build/utils/screenRoutes.d.ts +66 -0
  145. package/build/utils/screenRoutes.js +727 -0
  146. package/build/utils/sourceRouteExtractor.js +320 -112
  147. package/build/utils/testFileClassification.d.ts +11 -2
  148. package/build/utils/testFileClassification.js +44 -2
  149. package/build/utils/testFixtures.d.ts +5 -0
  150. package/build/utils/testFixtures.js +13 -0
  151. package/build/utils/utils.d.ts +0 -1
  152. package/build/utils/utils.js +0 -11
  153. package/build/utils/versions.d.ts +3 -3
  154. package/build/utils/versions.js +1 -1
  155. package/build/workspace/workspace.d.ts +12 -12
  156. package/node_modules/playwright/lib/mcp/skyramp/assertHiddenTool.js +56 -0
  157. package/node_modules/playwright/lib/mcp/skyramp/assertTool.js +2 -1
  158. package/node_modules/playwright/lib/mcp/skyramp/loadTraceTool.js +10 -0
  159. package/node_modules/playwright/lib/mcp/skyramp/skyRampImport.js +4 -1
  160. package/node_modules/playwright/lib/mcp/skyramp/traceRecordingBackend.js +160 -1
  161. package/node_modules/playwright/lib/mcp/test/skyRampExport.js +4 -2
  162. package/node_modules/playwright/node_modules/playwright-core/lib/server/codegen/skyramp/jsonlReader.js +1 -0
  163. package/node_modules/playwright/node_modules/playwright-core/lib/server/recorder/recorderSignalProcessor.js +2 -0
  164. package/node_modules/playwright/node_modules/playwright-core/lib/server/recorder.js +5 -1
  165. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/{index.-Id052Lr.js → index.B7KbSQcC.js} +1 -1
  166. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/index.html +1 -1
  167. package/node_modules/playwright/node_modules/playwright-core/package.json +1 -1
  168. package/node_modules/playwright/node_modules/playwright-core/src/server/codegen/skyramp/jsonlReader.ts +1 -1
  169. package/node_modules/playwright/node_modules/playwright-core/src/server/recorder/recorderSignalProcessor.ts +7 -0
  170. package/node_modules/playwright/node_modules/playwright-core/src/server/recorder.ts +6 -1
  171. package/node_modules/playwright/package.json +1 -1
  172. package/package.json +4 -3
  173. package/plugin/.claude-plugin/plugin.json +8 -0
  174. package/plugin/plugin.json +6 -0
  175. package/plugin/prompts/declaring-a-plan.md +20 -0
  176. package/plugin/prompts/generate-tests/context-fetching.md +4 -0
  177. package/plugin/prompts/generate-tests/execution-plan.md +63 -0
  178. package/plugin/prompts/generate-tests/generation.md +108 -0
  179. package/plugin/prompts/generate-tests/path-parameters.md +1 -0
  180. package/plugin/prompts/generate-tests/reasoning-protocol.md +17 -0
  181. package/plugin/prompts/generate-tests/tool-workflow-variants.md +61 -0
  182. package/plugin/prompts/generate-tests/tool-workflows.md +65 -0
  183. package/plugin/prompts/plan-tests.md +42 -0
  184. package/plugin/prompts/testbot-task1.md +82 -0
  185. package/plugin/skills/fix-test-import-errors/SKILL.md +98 -0
  186. package/build/prompts/test-recommendation/analysisOutputPrompt.d.ts +0 -84
  187. package/build/prompts/test-recommendation/analysisOutputPrompt.js +0 -369
  188. package/build/prompts/test-recommendation/fullRepoCatalog.d.ts +0 -7
  189. package/build/prompts/test-recommendation/fullRepoCatalog.js +0 -283
  190. package/build/prompts/test-recommendation/scopeAssessment.d.ts +0 -81
  191. package/build/prompts/test-recommendation/scopeAssessment.js +0 -359
  192. package/build/recommendation/budgeters/diversityBalancedBudgeter.d.ts +0 -7
  193. package/build/recommendation/budgeters/diversityBalancedBudgeter.js +0 -105
  194. package/build/recommendation/budgeters/fixedNBudgeter.d.ts +0 -7
  195. package/build/recommendation/budgeters/fixedNBudgeter.js +0 -11
  196. package/build/recommendation/budgeters/shared.d.ts +0 -32
  197. package/build/recommendation/budgeters/shared.js +0 -246
  198. package/build/recommendation/discriminators.d.ts +0 -37
  199. package/build/recommendation/discriminators.js +0 -379
  200. package/build/recommendation/diversity.d.ts +0 -47
  201. package/build/recommendation/diversity.js +0 -101
  202. package/build/recommendation/planRanker.d.ts +0 -65
  203. package/build/recommendation/planRanker.js +0 -83
  204. package/build/recommendation/testFixtures.d.ts +0 -25
  205. package/build/recommendation/testFixtures.js +0 -45
  206. package/build/types/FrontendIntegration.d.ts +0 -28
  207. package/build/types/FrontendIntegration.js +0 -22
  208. package/build/types/Recommendation.d.ts +0 -146
  209. package/build/types/Recommendation.js +0 -74
  210. package/build/utils/changedRoutes.d.ts +0 -29
  211. package/build/utils/changedRoutes.js +0 -87
  212. package/build/utils/frontendIntegration.d.ts +0 -9
  213. package/build/utils/frontendIntegration.js +0 -243
  214. package/build/utils/importerHop.d.ts +0 -135
  215. package/build/utils/importerHop.js +0 -489
  216. package/build/utils/pathAffinityClassification.d.ts +0 -49
  217. package/build/utils/pathAffinityClassification.js +0 -180
  218. package/build/utils/pythonMountPrefixes.d.ts +0 -25
  219. package/build/utils/pythonMountPrefixes.js +0 -347
  220. package/build/utils/repoScanner.d.ts +0 -34
  221. package/build/utils/repoScanner.js +0 -300
  222. package/build/utils/routeParsers.d.ts +0 -95
  223. package/build/utils/routeParsers.js +0 -951
  224. package/build/utils/scenarioDrafting.d.ts +0 -92
  225. package/build/utils/scenarioDrafting.js +0 -951
  226. package/build/utils/subjectEndpoints.d.ts +0 -19
  227. package/build/utils/subjectEndpoints.js +0 -98
  228. package/build/utils/uiPageEnumerator.d.ts +0 -172
  229. package/build/utils/uiPageEnumerator.js +0 -474
@@ -1,8 +1,9 @@
1
1
  import type { DriftAction } from "./TestAnalysis.js";
2
2
  import type { TestExecutionStatus } from "./TestExecution.js";
3
- import type { HttpMethod, TestType } from "./TestTypes.js";
3
+ import type { TestType } from "./TestTypes.js";
4
4
  import type { ReuseOutcome } from "./ReuseOutcome.js";
5
5
  import type { AssertionOutcome } from "./AssertionOutcome.js";
6
+ import type { StepMethod } from "./StepMethod.js";
6
7
  /** Classification of an issuesFound entry. Bug is a product/code defect; the
7
8
  * other values are tooling noise that the Testbot report renders in its
8
9
  * Configuration Errors section instead of Issues Found. */
@@ -23,6 +24,11 @@ export interface TestbotReport {
23
24
  businessCaseAnalysis: string;
24
25
  newTestsCreated: {
25
26
  testId: string;
27
+ /** Recommendation v2: the id of the plan entry this test was approved under.
28
+ * Required by the submit schema whenever v2 is on, on every entry including
29
+ * UI, because it is the exact key the report is joined back to the plan on.
30
+ * Absent in reports from a v1 run, which has no plan to take an id from. */
31
+ plannedTestId?: string;
26
32
  testType: TestType;
27
33
  endpoint: string;
28
34
  fileName: string;
@@ -34,6 +40,11 @@ export interface TestbotReport {
34
40
  scenarioFile?: string;
35
41
  traceFile?: string;
36
42
  frontendTrace?: string;
43
+ /** True when the plan entry this test was approved under expected it to FAIL:
44
+ * its category is `bug_caught` or it declared `fail`. Server-derived from the
45
+ * plan by `plannedTestId`, because the report enum has no `bug_caught` value.
46
+ * Absent when it is not one, when no plan exists, or when the id matches none. */
47
+ expectedToFail?: boolean;
37
48
  /** UI tests only: POM code-reuse outcome, present when skyramp_reuse_code ran
38
49
  * for this test. Server-derived — imported from its source of truth rather
39
50
  * than re-declared, since that module already exports a plain interface (the
@@ -54,6 +65,11 @@ export interface TestbotReport {
54
65
  testType: TestType;
55
66
  endpoint: string;
56
67
  fileName: string;
68
+ /** The file the maintenance edit actually landed in, when that is not
69
+ * `fileName` — a page object the spec delegates its selectors to. `fileName`
70
+ * stays the SPEC, which is what ran and what `beforeStatus`/`afterStatus`
71
+ * describe. Absent when the edit landed in the spec, the normal case. */
72
+ editedFileName?: string;
57
73
  description: string;
58
74
  action: DriftAction;
59
75
  beforeStatus: TestExecutionStatus;
@@ -81,7 +97,11 @@ export interface TestbotReport {
81
97
  primaryEndpoint?: string;
82
98
  scenarioName?: string;
83
99
  steps: {
84
- method?: HttpMethod;
100
+ /** An HTTP method for a request, one of the page interactions for a UI step,
101
+ * or `OPERATION` for a call with no HTTP verb, whose own name goes in `path`.
102
+ * Three closed sets rather than a string: `HttpMethod` alone refused a UI
103
+ * recommendation, and `HttpMethod | UiVerb` would refuse every operation. */
104
+ method?: StepMethod;
85
105
  path?: string;
86
106
  description: string;
87
107
  expectedStatusCode?: number;
@@ -99,6 +119,10 @@ export interface TestbotReport {
99
119
  }[];
100
120
  issuesFound: {
101
121
  description: string;
122
+ /** The planned test this issue is about, when it is about one — set on the
123
+ * issue that writes up a `requirement_conflict` so the conflict names the
124
+ * test that asserts it. Absent on an issue about no particular test. */
125
+ plannedTestId?: string;
102
126
  severity?: "critical" | "high" | "medium" | "low";
103
127
  /** Required by the submit_report schema since 0.3.4; absent in reports
104
128
  * written by older MCP versions. Readers treat absence as Bug. */
@@ -116,5 +140,43 @@ export interface TestbotReport {
116
140
  repository?: string;
117
141
  }[];
118
142
  nextSteps: string[];
143
+ /** Recommendation v2 only. Every change the plan declared, with the tests
144
+ * delivered against it and the agent's answer where it planned none. This is
145
+ * the line a developer reads: every change the diff makes is tested,
146
+ * or has a reason. Absent for a v1 run, and for a v2 run whose plan declared
147
+ * no changes. */
148
+ changes?: {
149
+ id: string;
150
+ text: string;
151
+ source: string;
152
+ /** `plannedTestId` of each delivered test citing this change. Empty where the
153
+ * agent answered instead of planning one. */
154
+ testedBy: string[];
155
+ /** The agent's answer to `coverage:change:<id>`, where it gave one. */
156
+ answer?: string;
157
+ }[];
158
+ /** Recommendation v2 only. Every plan-time objection, then those raised when the
159
+ * report was submitted, `stage` saying which. All a record, not a gate: the
160
+ * tests exist by the time any is raised. Absent for a v1 run and for a v2 run
161
+ * whose agent never registered a plan. */
162
+ objections?: {
163
+ objectionId: string;
164
+ verifier: string;
165
+ /** Absent for a plan-level objection such as `coverage:noChanges`. */
166
+ plannedTestId?: string;
167
+ message: string;
168
+ evidence: string;
169
+ suggestion: string;
170
+ stage: "plan" | "post-execution";
171
+ /** The agent's answer, where it answered — at plan time through
172
+ * `skyramp_register_test_plan`, after execution through `skyramp_submit_report`.
173
+ * Any non-blank text closes an objection and the server does not judge it, so
174
+ * the answer travels with the objection and the reader decides. */
175
+ answer?: string;
176
+ /** Set on an objection a LATER report call stopped raising: the agent fixed what
177
+ * it named instead of answering. Says which call noticed. Absent on every
178
+ * objection still raised, answered or not — the two are different outcomes. */
179
+ resolvedBy?: string;
180
+ }[];
119
181
  commitMessage: string;
120
182
  }
@@ -3,25 +3,21 @@ import type { AssertionRecord } from "../types/AssertionOutcome.js";
3
3
  import { TestAnalysisResult, MaintenanceActionCore } from "../types/TestAnalysis.js";
4
4
  import { RepositoryAnalysis, AnalysisScope } from "../types/RepositoryAnalysis.js";
5
5
  import { PRTestContext } from "./pr-comment-parser.js";
6
- import { ParsedDiffEndpoint } from "./routeParsers.js";
7
- import type { CandidateUiPage } from "./uiPageEnumerator.js";
8
- import type { FrontendFileIntegration } from "../types/FrontendIntegration.js";
9
- import type { ApprovedPlanItem } from "../types/Recommendation.js";
6
+ import type { RemovedUiElement } from "./removedUiElements.js";
10
7
  import type { ExternalTestRunRecord } from "../types/ExternalTestExecution.js";
11
8
  import type { VideoRecord } from "../types/TestExecution.js";
12
9
  import type { RepoCheckout } from "./reportVerification.js";
13
- export type { CandidateUiPage } from "./uiPageEnumerator.js";
10
+ import type { Plan } from "../recommendation/registerPlan.js";
11
+ import type { Objection } from "../recommendation/types.js";
14
12
  export declare function setTestsRepoDir(dir: string | undefined): void;
15
13
  /**
16
14
  * Record the run's tests repo without ever clearing a known value.
17
15
  *
18
16
  * The tests repo is a RUN-scoped fact, but analyze_changes is called once per
19
17
  * repository and only the PRIMARY call carries `testsRepoDir` — a related
20
- * repo's call omits it. An unconditional set therefore wiped the primary's
21
- * value on the second call of every multi-repo run, and by report time the
22
- * tests repo was unknown: a UI test generated there looked unbacked by any
23
- * working tree and the agent demoted it out of newTestsCreated (SKYR-4204,
24
- * run 32536569467). Callers that mean to clear it use setTestsRepoDir.
18
+ * repo's call omits it. An unconditional set therefore wipes the primary's
19
+ * value on the second call of every multi-repo run, leaving the tests repo
20
+ * unknown by report time. Callers that mean to clear it use setTestsRepoDir.
25
21
  */
26
22
  export declare function rememberTestsRepoDir(dir: string | undefined): void;
27
23
  export declare function getTestsRepoDir(): string | undefined;
@@ -29,6 +25,9 @@ export declare function getTestsRepoDir(): string | undefined;
29
25
  * Single-sourced so the constructor that WRITES there and `resolveRunStatePath`
30
26
  * which LOOKS there cannot drift apart. */
31
27
  export declare const RUN_STATE_FILE_NAME = "analyze-changes-state.json";
28
+ /** Filename of the pointer that carries the multi-repo anchor across a server
29
+ * restart. It holds one line: the absolute path of the run's state file. */
30
+ export declare const RUN_STATE_POINTER_FILE_NAME = "run-state-path";
32
31
  /**
33
32
  * Directory holding this run's Skyramp artifacts — the state file, and the report written
34
33
  * beside it (SKYR-4147) — or undefined outside a run.
@@ -37,15 +36,13 @@ export declare const RUN_STATE_FILE_NAME = "analyze-changes-state.json";
37
36
  * work it out from the environment on their own. So neither has to tell the other where
38
37
  * the run's files live, and the path never passes through the model.
39
38
  *
40
- * The GitHub Action is the only caller customers run, and GitHub sets `RUNNER_TEMP` for
41
- * it; the eval harness sets it itself. Nothing customers run is on another CI system, so
42
- * the GitHub-specific name is only a naming problem — it does not break anything today.
43
- * If a caller on another CI system is added, rename this then, or let it read that
44
- * system's variable. Do not add a second variable for a caller that does not exist.
39
+ * The GitHub Action is the only caller customers run and GitHub sets `RUNNER_TEMP` for it;
40
+ * the eval harness sets it itself. If a caller on another CI system is added, rename this
41
+ * then, or let it read that system's variable. Do not add a second variable for a caller
42
+ * that does not exist.
45
43
  *
46
- * Kept in one place for the same reason `RUN_STATE_FILE_NAME` is: the directory used to be
47
- * written out at three call sites, so only the filename was safe from the three copies
48
- * drifting apart. testbot keeps its matching copy in one place too, in `skyrampTempDir()`.
44
+ * Kept in ONE place, like `RUN_STATE_FILE_NAME`: written out per call site, the copies
45
+ * drift. testbot keeps its matching copy in `skyrampTempDir()`.
49
46
  */
50
47
  export declare function runArtifactDir(): string | undefined;
51
48
  export declare function setActiveRunStatePath(stateFilePath: string): void;
@@ -57,15 +54,15 @@ export declare function clearActiveRunStatePath(): void;
57
54
  * agent naming it.
58
55
  *
59
56
  * `setActiveRunStatePath` is only called by skyramp_analyze_changes on multi-repo
60
- * runs (the ones carrying a `repository` param), but a single-repo Testbot run's
61
- * path is still deterministic in CI: the StateManager constructor above roots
62
- * "analysis" state under `runArtifactDir()`. Falling back to that covers
63
- * single-repo runs without a new anchor mechanism. Standalone/IDE usage has no
64
- * RUNNER_TEMP and resolves to undefined — correct, since there is no run state.
57
+ * runs (the ones carrying a `repository` param). It is read back two ways: from
58
+ * memory in this process, and from the pointer file a previous stage of the same
59
+ * run wrote — a staged run starts a fresh server per stage, so memory alone would
60
+ * send later stages to the wrong file.
65
61
  *
66
- * Lives here rather than in each caller so the convention has one home: this is
67
- * the module that decides where the file goes, so it is the module that should
68
- * decide where to look for it.
62
+ * A single-repo Testbot run's path is still deterministic in CI: the StateManager
63
+ * constructor above roots "analysis" state under `runArtifactDir()`. Falling back
64
+ * to that covers single-repo runs. Standalone/IDE usage has no RUNNER_TEMP and
65
+ * resolves to undefined — correct, since there is no run state.
69
66
  */
70
67
  export declare function resolveRunStatePath(explicitPath?: string): string | undefined;
71
68
  /**
@@ -79,7 +76,7 @@ export declare function resolveRunStatePath(explicitPath?: string): string | und
79
76
  * write to a file that holds no run data is already a no-op.
80
77
  *
81
78
  * Returns the path rather than a boolean so a caller can also key per-run state on
82
- * it, and lives here because this is the module that decides where the file goes.
79
+ * it. It lives here because this is the module that decides where the file goes.
83
80
  */
84
81
  export declare function currentRunStateFile(): string | undefined;
85
82
  export declare function registerSession(sessionId: string, stateFilePath: string): void;
@@ -122,65 +119,12 @@ type TestTypeScores = Record<string, number>;
122
119
  */
123
120
  type TestTypeMapping = Record<string, string | string[]>;
124
121
  export interface UiAnalysisContext {
125
- /** Frontend source files changed in this diff. */
126
- changedFrontendFiles: string[];
127
122
  /**
128
- * Candidate pages for blueprint capture, enumerated from route analysis.
129
- * Empty when no resolvable frontend baseUrl — agent falls back to prose-driven enumeration.
123
+ * data-testids the diff removed from files whose page survives (SKYR-4305).
124
+ * Present only when non-empty. The testbot records a removal guard
125
+ * (`toBeHidden()` on the id + a positive sibling assertion) for each entry.
130
126
  */
131
- candidateUiPages: CandidateUiPage[];
132
- /**
133
- * Per-file production-importer check (SKYR-3855) — server-computed so the
134
- * "is this component actually integrated?" skip decision doesn't rely on
135
- * the agent running its own grep mid-task. Same order as changedFrontendFiles.
136
- */
137
- frontendFileIntegration?: FrontendFileIntegration[];
138
- }
139
- /**
140
- * SKYR-3879 Path B — the server-side selection checkpoint's persisted result.
141
- * Written by skyramp_register_test_plan (and pre-seeded by skyramp_analyze_changes
142
- * when it has its own pre-ranked GENERATE items). `generate` is the mandated,
143
- * final list generation tools gate against (see planGuard.ts); `additional` is
144
- * report-only; `demotions` carries discriminator claims that failed structural
145
- * verification — the demotion drops the CLAIM, never the candidate, but it does
146
- * not keep the candidate either: budgeting can still cut it, so the same id may
147
- * appear in both `demotions` and `dropped`;
148
- * `dropped` carries candidates the selection stage removed outright from
149
- * `generate`/`additional` (SKYR-4214) — the visible record of what got cut
150
- * and why, since neither list says anything about what is missing from it.
151
- */
152
- export interface ApprovedPlan {
153
- planId: string;
154
- createdAt: string;
155
- generate: ApprovedPlanItem[];
156
- additional: ApprovedPlanItem[];
157
- demotions: Array<{
158
- candidateId: string;
159
- reason: string;
160
- }>;
161
- dropped: Array<{
162
- candidateId: string;
163
- reason: string;
164
- }>;
165
- }
166
- /**
167
- * Budget inputs computed once by skyramp_analyze_changes (from the same
168
- * classification the Execution Plan prompt is built from) and reused by
169
- * skyramp_register_test_plan, so re-ranking the agent's candidates never
170
- * drifts from the budget the agent was shown. Persisted even when no
171
- * `approvedPlan` is pre-seeded (e.g. no pre-drafted scenarios) so a
172
- * register_test_plan call with only agent-drafted candidates still budgets
173
- * against the correct maxGenerate/maxTotal/UI split.
174
- */
175
- export interface PlanBudgetContext {
176
- maxGenerate: number;
177
- maxTotal: number;
178
- isUIOnlyPR: boolean;
179
- hasFrontendChanges: boolean;
180
- /** Serialized form of the BudgetContext.externalCoverage Set. */
181
- externalCoverageKeys: string[];
182
- /** Whether the PR diff changes any test file; see BudgetContext. */
183
- diffChangesTestFiles?: boolean;
127
+ removedElements?: RemovedUiElement[];
184
128
  }
185
129
  /** A pre-existing Skyramp-generated test the reuse pass edited to import from a
186
130
  * shared utils file (STEP 5c / the sibling-inline advisory). Keyed by ABSOLUTE
@@ -209,7 +153,6 @@ export interface UnifiedAnalysisState {
209
153
  testTypeScores?: TestTypeScores;
210
154
  testTypeMapping?: TestTypeMapping;
211
155
  analysisScope: AnalysisScope;
212
- newEndpoints: ParsedDiffEndpoint[];
213
156
  /**
214
157
  * UI-specific state populated when the diff contains frontend files.
215
158
  * Absent on backend-only PRs.
@@ -220,17 +163,6 @@ export interface UnifiedAnalysisState {
220
163
  /** Maintenance actions applied via skyramp_actions — skyramp_submit_report derives
221
164
  * testMaintenance from this. */
222
165
  maintenanceVerdicts?: MaintenanceActionCore[];
223
- /**
224
- * Raw branch-diff text, size-capped (~200KB), persisted so
225
- * skyramp_register_test_plan can verify a discriminator's `changedCodeAnchor`
226
- * occurs verbatim in the actual diff. Absent when the analysis wasn't
227
- * diff-scoped or no diff content was produced.
228
- */
229
- diffText?: string;
230
- /** SKYR-3879 Path B — see {@link PlanBudgetContext}. */
231
- planBudgetContext?: PlanBudgetContext;
232
- /** SKYR-3879 Path B — see {@link ApprovedPlan}. */
233
- approvedPlan?: ApprovedPlan;
234
166
  /**
235
167
  * External (repo-owned) test runs recorded by skyramp_run_existing_tests, one
236
168
  * record per confirm/verify invocation. Drift analysis and the report fold in
@@ -264,6 +196,41 @@ export interface UnifiedAnalysisState {
264
196
  * the earlier attempt's now-stale directory.
265
197
  */
266
198
  executionVideos?: Record<string, VideoRecord>;
199
+ /** The registered plan with its answered and open objections. Run-wide, so it
200
+ * lives at the ROOT whichever repository the registration names, and the newest
201
+ * registration REPLACES it. No fallback: no registration means no plan.
202
+ * skyramp_submit_report and eval-framework both read this key by name. */
203
+ plan?: Plan;
204
+ /** How many v2 registrations this run has had. The tool owns the number — it is
205
+ * what makes `PlanInput.registrationNumber` independent of the agent. */
206
+ registrationCount?: number;
207
+ /** The answers to REPORT-stage objections, written by skyramp_submit_report.
208
+ * Separate from `plan`'s lists because a plan registration replaces that
209
+ * whole object. Only the answers: the objections are recomputed every call, and
210
+ * each answer carries its objection so the pair matches on wording as well. */
211
+ reportObjections?: {
212
+ answeredObjections: Array<{
213
+ objection: Objection;
214
+ answer: string;
215
+ }>;
216
+ /** The post-execution objections the LAST call raised, and the submission
217
+ * number it was. A later call that no longer raises one is how the server
218
+ * learns the agent FIXED it rather than answered it — without this the
219
+ * objection simply vanishes and only the log shows it ever fired. */
220
+ raisedObjections?: Array<{
221
+ objection: Objection;
222
+ submission: number;
223
+ }>;
224
+ /** Objections a later submission stopped raising, kept so they stay in every
225
+ * report after the one that noticed. Dropped again if the objection comes
226
+ * back. */
227
+ resolvedObjections?: Array<{
228
+ objection: Objection;
229
+ resolvedBy: string;
230
+ }>;
231
+ /** How many times `skyramp_submit_report` has been called this run. */
232
+ submissionCount?: number;
233
+ };
267
234
  /** Assertion-enhancement baseline + verify verdict per test file, keyed by
268
235
  * CANONICAL ABSOLUTE PATH (path.resolve — unlike `reuseOutcomes`, nothing
269
236
  * here matches report rows, and path keying removes basename collisions and
@@ -313,14 +280,6 @@ type StateFile<T> = T & {
313
280
  metadata: StateMetadata;
314
281
  relatedRepos?: Record<string, RepoStateSection<T>>;
315
282
  };
316
- /**
317
- * Generic State Manager for persisting workflow data
318
- * Reduces token usage by storing intermediate results in filesystem
319
- *
320
- * Supports two state types:
321
- * - analysis: Test maintenance workflow (discovery, drift, execution, health)
322
- * - recommendation: Test recommendation workflow (analyze repo, map tests, recommendations)
323
- */
324
283
  export declare class StateManager<T = any> {
325
284
  private stateFile;
326
285
  private sessionId;
@@ -360,23 +319,31 @@ export declare class StateManager<T = any> {
360
319
  * Preserved when omitted. */
361
320
  repository?: string;
362
321
  }): Promise<void>;
363
- /** Is `repo` the primary section? Primary when `repo` is falsy (single-repo /
364
- * legacy callers), when no state file exists yet (the FIRST write of a run is
365
- * the primary — the testbot prompt mandates the primary is analyzed first), or
366
- * when `repo` matches the `repo` recorded on the root metadata. A non-empty
367
- * `repo` that doesn't match an already-recorded root is a RELATED repo. */
322
+ /** Is `repo` the primary section? By NAME when the caller declares one: the run
323
+ * says which repo is primary, so whichever call lands first cannot decide it.
324
+ * Otherwise the legacy rule — falsy `repo` (single-repo callers), the first
325
+ * write of the run, or a `repo` matching the root metadata (SKYR-4333: a
326
+ * docs-only primary diff let the related repo write first and take the root). */
368
327
  private isPrimaryRepo;
369
328
  /**
370
329
  * Write one repo's analysis into the run-scoped state file. The primary repo
371
- * (repo absent, or matching the root's recorded repo, or the first write of the
372
- * run) is written to the root via writeData(); a related repo is upserted into
330
+ * (repo absent, matching the declared `primaryRepo`, matching the root's
331
+ * recorded repo, or the first write of a run that declares no primary) is
332
+ * written to the root via writeData(); a related repo is upserted into
373
333
  * `relatedRepos[repo]`, preserving the primary + other sections. Used by
374
334
  * skyramp_analyze_changes — every repo in the run writes the SAME stateFile path.
375
335
  */
336
+ /** Fields another tool owns, carried forward when this caller's payload omits
337
+ * them: `writeData` rebuilds the root from its payload, and an analyze call that
338
+ * did so deleted the plan the agent had registered. NAMED rather than "keep
339
+ * everything omitted", which would resurrect fields a re-analysis clears. */
376
340
  writeRepoData(data: T, options: {
377
341
  repo?: string;
378
342
  repositoryPath?: string;
379
343
  step?: string;
344
+ /** The run's declared primary, passed on EVERY call of a multi-repo run.
345
+ * Given it, write order decides nothing. */
346
+ primaryRepo?: string;
380
347
  }): Promise<void>;
381
348
  /**
382
349
  * Read one repo's analysis payload from the run-scoped state file. `repo`
@@ -405,8 +372,6 @@ export declare class StateManager<T = any> {
405
372
  getStateType(): StateType;
406
373
  exists(): boolean;
407
374
  delete(): Promise<void>;
408
- getSize(): Promise<number>;
409
- getSizeFormatted(): Promise<string>;
410
375
  /**
411
376
  * Cleanup old state files
412
377
  * @param maxAgeHours Maximum age in hours
@@ -416,3 +381,4 @@ export declare class StateManager<T = any> {
416
381
  */
417
382
  static cleanupOldFiles(maxAgeHours?: number, stateDir?: string, stateTypes?: StateType[]): Promise<number>;
418
383
  }
384
+ export {};