@testsprite/testsprite-cli 0.15.0 → 0.17.0

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 (207) hide show
  1. package/README.md +53 -141
  2. package/dist/commands/agent.d.ts +12 -4
  3. package/dist/commands/agent.js +55 -65
  4. package/dist/commands/auth.d.ts +6 -10
  5. package/dist/commands/auth.js +44 -56
  6. package/dist/commands/ci.d.ts +23 -100
  7. package/dist/commands/ci.js +297 -489
  8. package/dist/commands/completion.js +2 -1
  9. package/dist/commands/conversation.d.ts +27 -0
  10. package/dist/commands/conversation.js +702 -0
  11. package/dist/commands/doctor.d.ts +5 -1
  12. package/dist/commands/doctor.js +130 -34
  13. package/dist/commands/init.d.ts +4 -45
  14. package/dist/commands/init.js +116 -68
  15. package/dist/commands/project-env.d.ts +62 -2
  16. package/dist/commands/project-env.js +426 -53
  17. package/dist/commands/project-sign-in.d.ts +0 -48
  18. package/dist/commands/project-sign-in.js +1 -224
  19. package/dist/commands/project.d.ts +15 -186
  20. package/dist/commands/project.js +93 -921
  21. package/dist/commands/result.d.ts +10 -0
  22. package/dist/commands/result.js +215 -0
  23. package/dist/commands/schedule.d.ts +0 -29
  24. package/dist/commands/schedule.js +47 -97
  25. package/dist/commands/test.d.ts +315 -1824
  26. package/dist/commands/test.js +1962 -13733
  27. package/dist/commands/testlist.d.ts +128 -5
  28. package/dist/commands/testlist.js +269 -329
  29. package/dist/commands/tunnel.d.ts +2 -2
  30. package/dist/commands/tunnel.js +43 -41
  31. package/dist/commands/usage.d.ts +12 -45
  32. package/dist/commands/usage.js +51 -131
  33. package/dist/index.js +189 -108
  34. package/dist/lib/agent-detect.js +9 -5
  35. package/dist/lib/agent-targets.d.ts +21 -2
  36. package/dist/lib/agent-targets.js +88 -11
  37. package/dist/lib/args.d.ts +13 -0
  38. package/dist/lib/args.js +49 -0
  39. package/dist/lib/basic-auth.d.ts +3 -0
  40. package/dist/lib/basic-auth.js +15 -0
  41. package/dist/lib/billing-refusal.js +4 -3
  42. package/dist/lib/ci-linkage.d.ts +4 -82
  43. package/dist/lib/ci-linkage.js +4 -157
  44. package/dist/lib/ci-run.js +1 -1
  45. package/dist/lib/client-factory.d.ts +10 -2
  46. package/dist/lib/client-factory.js +38 -26
  47. package/dist/lib/commit-signal.d.ts +65 -0
  48. package/dist/lib/commit-signal.js +305 -0
  49. package/dist/lib/concurrency-limiter.d.ts +6 -0
  50. package/dist/lib/concurrency-limiter.js +29 -0
  51. package/dist/lib/config.js +10 -5
  52. package/dist/lib/conflict-reason.d.ts +31 -4
  53. package/dist/lib/conflict-reason.js +38 -4
  54. package/dist/lib/conversation/answers.d.ts +9 -0
  55. package/dist/lib/conversation/answers.js +49 -0
  56. package/dist/lib/conversation/api.d.ts +71 -0
  57. package/dist/lib/conversation/api.js +150 -0
  58. package/dist/lib/conversation/change.d.ts +31 -0
  59. package/dist/lib/conversation/change.js +124 -0
  60. package/dist/lib/conversation/context.d.ts +19 -0
  61. package/dist/lib/conversation/context.js +70 -0
  62. package/dist/lib/conversation/environment.d.ts +15 -0
  63. package/dist/lib/conversation/environment.js +33 -0
  64. package/dist/lib/conversation/follow.d.ts +24 -0
  65. package/dist/lib/conversation/follow.js +42 -0
  66. package/dist/lib/conversation/render.d.ts +33 -0
  67. package/dist/lib/conversation/render.js +315 -0
  68. package/dist/lib/conversation/title.d.ts +2 -0
  69. package/dist/lib/conversation/title.js +18 -0
  70. package/dist/lib/conversation/types.d.ts +156 -0
  71. package/dist/lib/conversation/types.js +6 -0
  72. package/dist/lib/credentials.js +67 -11
  73. package/dist/lib/cron.d.ts +1 -1
  74. package/dist/lib/cron.js +2 -2
  75. package/dist/lib/dispatch-stop.d.ts +20 -0
  76. package/dist/lib/dispatch-stop.js +30 -0
  77. package/dist/lib/download.d.ts +71 -0
  78. package/dist/lib/download.js +274 -0
  79. package/dist/lib/dry-run/fetch.d.ts +10 -0
  80. package/dist/lib/dry-run/fetch.js +20 -0
  81. package/dist/lib/dry-run/samples.d.ts +6 -34
  82. package/dist/lib/dry-run/samples.js +389 -751
  83. package/dist/lib/environment-tunnel.d.ts +16 -26
  84. package/dist/lib/environment-tunnel.js +161 -157
  85. package/dist/lib/errors.d.ts +20 -4
  86. package/dist/lib/errors.js +36 -16
  87. package/dist/lib/facade.d.ts +7 -29
  88. package/dist/lib/facade.js +7 -36
  89. package/dist/lib/failing-fe-resolver.d.ts +13 -58
  90. package/dist/lib/failing-fe-resolver.js +47 -132
  91. package/dist/lib/first-suite-hint.d.ts +16 -22
  92. package/dist/lib/first-suite-hint.js +38 -47
  93. package/dist/lib/gh-output.d.ts +76 -21
  94. package/dist/lib/gh-output.js +171 -90
  95. package/dist/lib/git-utils.d.ts +56 -0
  96. package/dist/lib/git-utils.js +212 -0
  97. package/dist/lib/github-context.d.ts +2 -0
  98. package/dist/lib/github-context.js +40 -8
  99. package/dist/lib/history-retention.d.ts +6 -2
  100. package/dist/lib/history-retention.js +10 -7
  101. package/dist/lib/http.d.ts +58 -134
  102. package/dist/lib/http.js +352 -271
  103. package/dist/lib/interrupt.d.ts +14 -8
  104. package/dist/lib/interrupt.js +28 -10
  105. package/dist/lib/junit-report.d.ts +60 -4
  106. package/dist/lib/junit-report.js +209 -32
  107. package/dist/lib/local-target.d.ts +3 -3
  108. package/dist/lib/local-target.js +3 -3
  109. package/dist/lib/output.d.ts +0 -29
  110. package/dist/lib/output.js +10 -33
  111. package/dist/lib/pagination.d.ts +2 -5
  112. package/dist/lib/pagination.js +2 -5
  113. package/dist/lib/presigned-url.d.ts +22 -0
  114. package/dist/lib/presigned-url.js +90 -0
  115. package/dist/lib/prompt.js +36 -2
  116. package/dist/lib/proxy.js +2 -1
  117. package/dist/lib/redact.d.ts +2 -2
  118. package/dist/lib/redact.js +3 -4
  119. package/dist/lib/removed-commands.d.ts +18 -0
  120. package/dist/lib/removed-commands.js +154 -0
  121. package/dist/lib/render-error.d.ts +31 -6
  122. package/dist/lib/render-error.js +88 -25
  123. package/dist/lib/response-schemas.d.ts +38 -30
  124. package/dist/lib/response-schemas.js +210 -207
  125. package/dist/lib/result/api.d.ts +24 -0
  126. package/dist/lib/result/api.js +28 -0
  127. package/dist/lib/result/evidence.d.ts +71 -0
  128. package/dist/lib/result/evidence.js +420 -0
  129. package/dist/lib/result/render.d.ts +20 -0
  130. package/dist/lib/result/render.js +194 -0
  131. package/dist/lib/result/types.d.ts +122 -0
  132. package/dist/lib/result/types.js +19 -0
  133. package/dist/lib/run-output.d.ts +275 -0
  134. package/dist/lib/run-output.js +227 -0
  135. package/dist/lib/run-render.d.ts +101 -0
  136. package/dist/lib/run-render.js +183 -0
  137. package/dist/lib/run-wait.d.ts +192 -0
  138. package/dist/lib/run-wait.js +452 -0
  139. package/dist/lib/runs.types.d.ts +134 -367
  140. package/dist/lib/runs.types.js +0 -14
  141. package/dist/lib/secret-file.d.ts +1 -1
  142. package/dist/lib/secret-file.js +11 -2
  143. package/dist/lib/skill-nudge.d.ts +7 -27
  144. package/dist/lib/skill-nudge.js +9 -37
  145. package/dist/lib/target-path.d.ts +15 -0
  146. package/dist/lib/target-path.js +35 -0
  147. package/dist/lib/target-url-advisory.d.ts +19 -0
  148. package/dist/lib/target-url-advisory.js +31 -0
  149. package/dist/lib/target-url-preflight.d.ts +9 -0
  150. package/dist/lib/target-url-preflight.js +214 -106
  151. package/dist/lib/target-url.d.ts +1 -1
  152. package/dist/lib/target-url.js +6 -16
  153. package/dist/lib/telemetry.d.ts +32 -12
  154. package/dist/lib/telemetry.js +39 -8
  155. package/dist/lib/terminal-text.d.ts +41 -0
  156. package/dist/lib/terminal-text.js +127 -0
  157. package/dist/lib/testlist.types.d.ts +16 -8
  158. package/dist/lib/testlist.types.js +1 -1
  159. package/dist/lib/text-equality.d.ts +2 -0
  160. package/dist/lib/text-equality.js +5 -0
  161. package/dist/lib/text-file.d.ts +16 -0
  162. package/dist/lib/text-file.js +41 -0
  163. package/dist/lib/text-table.d.ts +46 -0
  164. package/dist/lib/text-table.js +72 -4
  165. package/dist/lib/ticker.d.ts +9 -2
  166. package/dist/lib/ticker.js +16 -3
  167. package/dist/lib/transport-failure.d.ts +22 -0
  168. package/dist/lib/transport-failure.js +126 -0
  169. package/dist/lib/tunnel-session.d.ts +7 -1
  170. package/dist/lib/tunnel-session.js +22 -9
  171. package/dist/lib/update-check.js +3 -2
  172. package/dist/lib/url-template.d.ts +43 -0
  173. package/dist/lib/url-template.js +151 -0
  174. package/dist/lib/validate.d.ts +0 -64
  175. package/dist/lib/validate.js +2 -131
  176. package/dist/lib/version-notice.js +4 -3
  177. package/dist/lib/wait-exit.d.ts +37 -2
  178. package/dist/lib/wait-exit.js +88 -30
  179. package/dist/lib/workspace-status.js +10 -2
  180. package/dist/version.d.ts +1 -1
  181. package/dist/version.js +1 -1
  182. package/package.json +3 -4
  183. package/skills/testsprite-ci.skill.md +48 -18
  184. package/skills/testsprite-onboard.skill.md +66 -151
  185. package/skills/testsprite-verify.codex.md +54 -56
  186. package/skills/testsprite-verify.skill.md +194 -358
  187. package/dist/lib/browser.d.ts +0 -6
  188. package/dist/lib/browser.js +0 -54
  189. package/dist/lib/bundle.d.ts +0 -234
  190. package/dist/lib/bundle.js +0 -781
  191. package/dist/lib/deprecate.d.ts +0 -10
  192. package/dist/lib/deprecate.js +0 -13
  193. package/dist/lib/flaky.d.ts +0 -91
  194. package/dist/lib/flaky.js +0 -71
  195. package/dist/lib/plan-poll.d.ts +0 -171
  196. package/dist/lib/plan-poll.js +0 -441
  197. package/dist/lib/plans.types.d.ts +0 -130
  198. package/dist/lib/plans.types.js +0 -31
  199. package/dist/lib/poll.d.ts +0 -100
  200. package/dist/lib/poll.js +0 -290
  201. package/dist/lib/rate-throttle.d.ts +0 -49
  202. package/dist/lib/rate-throttle.js +0 -75
  203. package/dist/lib/run-progress.d.ts +0 -41
  204. package/dist/lib/run-progress.js +0 -56
  205. package/dist/lib/v3-advisory.d.ts +0 -55
  206. package/dist/lib/v3-advisory.js +0 -74
  207. package/schemas/plan.schema.json +0 -61
@@ -1,10 +1,8 @@
1
1
  /**
2
- * Types for M3.3 piece-3 — `test run` / `test wait` commands.
3
- * Extended by M3.4 piece-3 — `test rerun` command.
4
- * Extended by M3.4 piece-5 — `test result --history` command.
5
-
2
+ * Wire types for the run surfaces: `run`, `run wait`, `run cancel`,
3
+ * `run --testlist` and `ci run`.
6
4
  */
7
- import type { ConflictReason, RunConflict } from './conflict-reason.js';
5
+ import type { RunConflict } from './conflict-reason.js';
8
6
  /** Literal body sent to `POST /api/cli/v1/tests/{testId}/runs`. */
9
7
  export interface TriggerRunBody {
10
8
  /** Fixed source literal for CLI-triggered runs. */
@@ -22,21 +20,6 @@ export interface TriggerRunBody {
22
20
  * dropping the field.
23
21
  */
24
22
  tunnelClientId?: string;
25
- /**
26
- * May the agent re-author this test when its stored code no longer
27
- * executes?
28
- *
29
- * OMITTED on purpose whenever auto-heal is on. The field is tri-state on the
30
- * wire and the CLI only ever sends one of its three states: `false`, for
31
- * `--no-auto-heal`. Absent means "heal, but replay a user-authored body
32
- * rather than rewriting it" — the server-side default — and sending an
33
- * explicit `true` would mean something DIFFERENT and worse here: an
34
- * unconditional heal that re-authors code the user wrote. So the default is
35
- * expressed by saying nothing, which also means an older backend (the field
36
- * is stripped by `whitelist: true`, never 400'd) behaves exactly as it does
37
- * today for the default case.
38
- */
39
- autoHeal?: false;
40
23
  /**
41
24
  * The NAME of the project environment whose credentials, auto-auth and OTP
42
25
  * settings this run should use (`unique(project_id, name)` server side).
@@ -45,6 +28,12 @@ export interface TriggerRunBody {
45
28
  * this picks WHOSE credentials it logs in with.
46
29
  */
47
30
  environment?: string;
31
+ /**
32
+ * BE only: run just the named test without expanding the producer/teardown
33
+ * closure. Sent only when the caller asked for it (never `false`); an older
34
+ * backend strips the field, so omitting it is the default on the wire.
35
+ */
36
+ skipDependencies?: boolean;
48
37
  }
49
38
  /** The environment a run resolved to — its credentials, its config, its address. */
50
39
  export interface RunEnvironmentRef {
@@ -53,172 +42,23 @@ export interface RunEnvironmentRef {
53
42
  /** Environment name at seed time; null on an id-only row. */
54
43
  name: string | null;
55
44
  }
56
- /**
57
- * Body sent to `POST /api/cli/v1/tests/{testId}/runs/rerun`.
58
- * Tunnel replay includes the saved environment URL verbatim; ordinary replay
59
- * uses the configured URL.
60
- * `source` must be "cli" (not "cli-rerun" — that is not a valid RUN_SOURCES value).
61
- */
62
- export interface RerunRequest {
63
- tunnelClientId?: string;
64
- targetUrl?: string;
65
- source: 'cli';
66
- /** Opt into AI heal-on-drift. Paid + FE only. Server tier-gates and echoes effective value. */
67
- autoHeal?: boolean;
68
- /** BE only: rerun only the named test without expanding the producer/teardown closure. */
69
- skipDependencies?: boolean;
70
- /** See `TriggerRunBody.environment` — the named environment to replay against. */
71
- environment?: string;
72
- }
73
- /** One closure member returned in `RerunResponse.closure.members[]`. */
74
- export interface RerunClosureMember {
75
- testId: string;
76
- /** The runId minted synchronously (claimRunSlotOrThrow) for this member. Never null. */
77
- runId: string;
78
- /** Role of this test in the closure: 'selected' | 'producer' | 'teardown'. */
79
- role: 'selected' | 'producer' | 'teardown';
80
- }
81
- /** Closure breakdown returned for BE reruns. */
82
- export interface RerunClosure {
83
- members: RerunClosureMember[];
84
- addedProducers: string[];
85
- addedTeardowns: string[];
86
- clearedCaptured: number;
87
- }
88
- /**
89
- * A machine-readable note that a requested option was forwarded to the
90
- * execution engine but is not yet honored there. Emitted ONLY on a
91
- * V3-routed rerun when the caller explicitly requested `autoHeal:false` —
92
- * absent otherwise, including every V2 response and every V3 response that
93
- * did not request an opt-out.
94
- */
95
- export interface RerunAdvisory {
96
- /** Machine-readable feature name the advisory concerns (e.g. "autoHeal"). */
97
- feature: string;
98
- /** Human-readable explanation of the current limitation. */
99
- message: string;
100
- }
101
- /**
102
- * Response from `POST /api/cli/v1/tests/{testId}/runs/rerun`.
103
- * FE shape: no `closure`. BE shape: includes `closure` with per-member runIds.
104
- * `runId` is always non-null (minted synchronously before async invoke).
105
- */
106
- export interface RerunResponse {
107
- tunnelClientId?: string;
108
- /** The named test's runId (minted synchronously before async Lambda invoke). */
109
- runId: string;
110
- status: 'queued';
111
- enqueuedAt: string;
112
- codeVersion: string;
113
- /** Effective autoHeal value after the server tier-gate (Free → always false). */
114
- autoHeal: boolean;
115
- /**
116
- * Present for BE reruns only. Contains per-member runIds.
117
- * G1c: backend always sends this field; FE reruns send `null`.
118
- * `undefined` means pre-G1c backend (treated identically to `null` —
119
- * the `!!closure` truthy check in the CLI already handles both).
120
- */
121
- closure?: RerunClosure | null;
122
- /**
123
- * Present only when this rerun was routed to V3 execution AND the caller
124
- * explicitly requested `autoHeal:false` (see {@link RerunAdvisory}). Absent
125
- * on every other response, including older backends that predate the field.
126
- */
127
- advisories?: RerunAdvisory[];
128
- /** See `TriggerRunResponse.dashboardUrl` — same present-or-absent contract. */
129
- dashboardUrl?: string;
130
- /** See `TriggerRunResponse.executionUrl` — same present-or-absent contract. */
131
- executionUrl?: string;
132
- }
133
- /**
134
- * Body sent to `POST /api/cli/v1/tests/batch/rerun`.
135
- * Mixed FE/BE testIds allowed; BE closure deduped server-side per project.
136
- */
137
- export interface BatchRerunRequest {
138
- tunnelClientId?: string;
139
- targetUrl?: string;
140
- source: 'cli';
141
- testIds: string[];
142
- autoHeal?: boolean;
143
- skipDependencies?: boolean;
144
- /** See `TriggerRunBody.environment` — applied to every test in the batch. */
145
- environment?: string;
146
- }
147
- /** One accepted run in the batch rerun response. */
148
- export interface BatchRerunAccepted {
149
- testId: string;
150
- /** runId minted synchronously (claimRunSlotOrThrow). Never null. */
151
- runId: string;
152
- enqueuedAt: string;
153
- }
154
- /** One rate-deferred testId in the batch rerun response. */
155
- export interface BatchRerunDeferred {
156
- testId: string;
157
- reason: string;
158
- }
159
- /**
160
- * One testId in the batch rerun response that did not dispatch.
161
- *
162
- * `currentRunId` is present only when the refusal points at a run already in
163
- * flight; otherwise `reason` says why it did not start.
164
- */
165
- export interface BatchRerunConflict {
166
- testId: string;
167
- currentRunId?: string;
168
- reason?: ConflictReason;
169
- message?: string;
170
- }
171
- /** Per-project closure summary in the batch rerun response. */
172
- export interface BatchRerunClosureByProject {
173
- projectId: string;
174
- testIds: string[];
175
- addedProducers: string[];
176
- addedTeardowns: string[];
177
- clearedCaptured: number;
178
- }
179
- export interface BatchRerunClosure {
180
- byProject: BatchRerunClosureByProject[];
181
- }
182
- /**
183
- * Response from `POST /api/cli/v1/tests/batch/rerun`.
184
- * `accepted` carries one entry per dispatched run (incl. BE closure members), each with its runId.
185
- * `deferred` = rate-limited this window; retry later (C1).
186
- * `conflicts` = already in-flight, skipped.
187
- * `notFound` = ids that were unknown, cross-tenant, or never completed a clean run (D2-CLI).
188
- * Present when the server supports partial-accept (SOME ids bad → 200 with accepted+notFound).
189
- * When ALL ids are bad the server returns 404 (caught separately in the catch block).
190
- * Optional for back-compat with older backends that don't send this field.
191
- * `advisories` = present only when at least one FE test in the batch was routed to V3
192
- * execution AND explicitly requested `autoHeal:false` (see {@link RerunAdvisory}).
193
- * Absent on every other response. The CLI aggregates + dedupes this field across
194
- * chunked dispatch requests (see `dedupeRerunAdvisories` in `commands/test.ts`).
195
- */
196
- export interface BatchRerunResponse {
197
- tunnelClientId?: string;
198
- accepted: BatchRerunAccepted[];
199
- deferred: BatchRerunDeferred[];
200
- conflicts: BatchRerunConflict[];
201
- closure: BatchRerunClosure;
202
- notFound?: string[];
203
- advisories?: RerunAdvisory[];
204
- }
205
45
  /**
206
46
  * Response from `POST /api/cli/v1/tests/{testId}/runs`.
207
- * All fields are stamped at trigger time and cannot change for this runId.
47
+ * All fields are stamped at trigger time and cannot change for this resultId.
208
48
  */
209
49
  export interface TriggerRunResponse {
210
50
  tunnelClientId?: string;
211
- runId: string;
51
+ resultId: string;
52
+ /** The launch this result belongs to. Absent on an older backend. */
53
+ runId?: string;
212
54
  status: 'queued';
213
55
  enqueuedAt: string;
214
56
  /**
215
57
  * The EFFECTIVE heal decision the server made for this run.
216
58
  *
217
- * OPTIONAL on purpose, and the absence is the load-bearing case: the backend
218
- * runs `whitelist: true`, so a CLI sending `autoHeal` to a server that
219
- * predates the field has it silently STRIPPED and the run heals anyway. An
220
- * absent echo is how the CLI learns it is talking to such a server and that
221
- * `--no-auto-heal` did nothing — without it the opt-out is unfalsifiable.
59
+ * OPTIONAL on purpose: a server that predates the field echoes nothing. The
60
+ * CLI sends no request for it (the server decides per run; code a person
61
+ * wrote is never re-authored), so the echo is informational.
222
62
  */
223
63
  autoHeal?: boolean;
224
64
  /** codeVersion resolved at trigger time from the test row. */
@@ -231,17 +71,21 @@ export interface TriggerRunResponse {
231
71
  */
232
72
  environment?: RunEnvironmentRef | null;
233
73
  /**
234
- * Portal deep link for the run's test, built by the server for the store
235
- * that dispatched it. Present-or-absent (never null): an older backend, a
236
- * V3 run while the server's org-link flag is off, or one with no resolvable
237
- * workspace all OMIT it, and the CLI prints nothing rather than guessing.
74
+ * Portal deep link for the run's test, built by the server. Present-or-absent
75
+ * (never null): an older backend, or a run with no resolvable workspace,
76
+ * OMITS it, and the CLI prints nothing rather than guessing.
238
77
  */
239
78
  dashboardUrl?: string;
240
79
  /**
241
- * Portal deep link to THIS run's result page — V3-served runs only (a V2
242
- * run has no execution page). Same present-or-absent contract.
80
+ * Portal deep link to THIS run's result page. Same present-or-absent contract.
243
81
  */
244
82
  executionUrl?: string;
83
+ /**
84
+ * `true` exactly when the request carried `skipDependencies: true` and this
85
+ * backend handled it; otherwise OMITTED. A CLI that sent the flag and gets no
86
+ * echo was served by a backend that stripped it and ran the full closure.
87
+ */
88
+ skipDependencies?: boolean;
245
89
  }
246
90
  /**
247
91
  * Public run-status values.
@@ -249,8 +93,8 @@ export interface TriggerRunResponse {
249
93
  */
250
94
  export type RunStatus = 'queued' | 'running' | 'passed' | 'failed' | 'blocked' | 'cancelled';
251
95
  /**
252
- * Lightweight step summary returned inside `GET /api/cli/v1/runs/{runId}`.
253
- * Full step records arrive via `/runs/{runId}/failure`.
96
+ * Lightweight step summary returned inside `GET /api/cli/v1/runs/{resultId}`.
97
+ * Full step records come from `GET /api/cli/v1/results/{resultId}` (`result get`).
254
98
  */
255
99
  export interface RunStepSummary {
256
100
  total: number;
@@ -259,29 +103,12 @@ export interface RunStepSummary {
259
103
  failedCount: number;
260
104
  }
261
105
  /**
262
- * One step row returned when `GET /api/cli/v1/runs/{runId}?includeSteps=true`.
263
- * Mirrors the backend's `RunStepDto` / `TestRunStepEntity` public fields.
264
- *
265
- * Note: `stepIndex` is a zero-padded string on the wire (SK of `TestRunStep`);
266
- * parse with `parseInt` when a numeric index is needed. `createdAt` is the
267
- * timestamp the step was recorded (no separate `updatedAt` for run-scoped steps).
268
- */
269
- export interface RunStepDto {
270
- stepIndex: string;
271
- type: 'action' | 'assertion';
272
- action: string;
273
- status: 'passed' | 'failed' | null;
274
- description: string | null;
275
- error: string | null;
276
- screenshotUrl: string | null;
277
- htmlSnapshotUrl: string | null;
278
- createdAt: string;
279
- }
280
- /**
281
- * Response from `GET /api/cli/v1/runs/{runId}`.
106
+ * Response from `GET /api/cli/v1/runs/{resultId}`.
282
107
  */
283
108
  export interface RunResponse {
284
- runId: string;
109
+ resultId: string;
110
+ /** The launch this result belongs to. Absent on an older backend. */
111
+ runId?: string;
285
112
  testId: string;
286
113
  /**
287
114
  * The test's human title, for CI output. `null`/absent on older servers or
@@ -309,8 +136,8 @@ export interface RunResponse {
309
136
  */
310
137
  targetUrl: string | null;
311
138
  /**
312
- * The environment this run resolved to. Absent on an older backend (or a
313
- * V2-served run); `null` when the row names no environment.
139
+ * The environment this run resolved to. Absent on an older backend; `null`
140
+ * when the row names no environment.
314
141
  */
315
142
  environment?: RunEnvironmentRef | null;
316
143
  createdFrom: string | null;
@@ -333,160 +160,55 @@ export interface RunResponse {
333
160
  /** Optional hint from the server; honored by the polling loop. */
334
161
  retryAfterSeconds?: number;
335
162
  /**
336
- * Portal deep link for this run's test.
337
- *
338
- * **Server-provided when present, client-synthesized otherwise.** Newer
339
- * backends send this field on `GET /runs/{runId}` because only the server
340
- * knows which store answered the read (a V3-served run's page is a different
341
- * route family, and the V2 route it replaces cannot render for a V3-native
342
- * project) and only the server can resolve the portal origin outside prod.
163
+ * Portal deep link for this run's test. **Server-built only**: the server
164
+ * alone knows the workspace that owns the project and the portal origin
165
+ * outside prod, so the CLI never builds one itself.
343
166
  *
344
167
  * A server `null` means "no correct link exists for this run" — the CLI
345
- * treats it as absent for rendering and does NOT substitute its own guess.
346
- * A missing field (older backend) reopens the client path: `resolvePortalUrl`
347
- * from projectId+testId when the endpoint maps to a known portal host. See
168
+ * treats it like an absent field and prints nothing. See
348
169
  * `withRunDashboardUrl` in `commands/test.ts`.
349
170
  */
350
171
  dashboardUrl?: string | null;
351
172
  /**
352
- * Portal deep link to THIS RUN's result page (`…/projects/{pid}/execution/{eid}`),
353
- * the run-scoped companion to `dashboardUrl` (which opens the test case). Same
354
- * server-built / omit-not-null contract as `dashboardUrl`: **V3-served runs
355
- * only** — a V2 run has no execution page, so the field is absent there and the
356
- * CLI keeps `dashboardUrl` (the test-case link) for the run cell.
173
+ * Portal deep link to this result's own page, the companion to
174
+ * `dashboardUrl` (which opens the test case). Same server-built /
175
+ * omit-not-null contract as `dashboardUrl`; when it is absent the job
176
+ * summary's Result cell shows the bare result id, and an annotation links
177
+ * the test case instead.
357
178
  */
358
179
  executionUrl?: string | null;
359
- /**
360
- * Full ordered step list. Only present when the request includes
361
- * `?includeSteps=true`. Absent (undefined) when the flag was not sent.
362
- * Null means the server returned the field explicitly as null (treated
363
- * the same as absent for rendering purposes).
364
- *
365
- * Per M3.4 piece-4: default (absent/false) is byte-identical to the M3.3
366
- * summary shape — the cheap `test wait` polling path is unaffected.
367
- */
368
- steps?: RunStepDto[] | null;
369
180
  }
370
- /** Credit outcome returned when cancellation applies V3 frontend billing rules. */
181
+ /** Credit outcome returned when cancellation applies frontend billing rules. */
371
182
  export interface CancelRunRefund {
372
183
  status: 'refunded' | 'not_charged' | 'failed';
373
184
  /** Original charged amount returned to the workspace. Present when refunded. */
374
185
  amount?: number;
375
186
  }
376
187
  /**
377
- * Response from `POST /api/cli/v1/runs/{runId}/cancel`.
378
- * Same shape as `GET /runs/{runId}` (`status: "cancelled"`, verdict
188
+ * Response from `POST /api/cli/v1/runs/{resultId}/cancel`.
189
+ * Same shape as `GET /runs/{resultId}` (`status: "cancelled"`, verdict
379
190
  * untouched) plus `alreadyCancelled` distinguishing a fresh cancel
380
191
  * (naturally idempotent) from a no-op re-cancel.
381
192
  */
382
- export interface CancelRunResponse extends RunResponse {
193
+ export interface CancelRunResult {
194
+ resultId: string;
195
+ runId: string | null;
196
+ testId: string | null;
197
+ title: string;
198
+ status: RunStatus;
383
199
  alreadyCancelled: boolean;
384
- /**
385
- * Present only when the server evaluated a V3 frontend run refund. Older
386
- * backends, V2 runs, and backend-test runs omit it.
387
- */
200
+ alreadyFinished: boolean;
388
201
  refund?: CancelRunRefund;
389
202
  }
203
+ export interface CancelRunResponse {
204
+ runId: string;
205
+ alreadyCancelled: boolean;
206
+ alreadyFinished: boolean;
207
+ results: CancelRunResult[];
208
+ }
390
209
  /** Terminal states from the RunStatus union. */
391
210
  export declare const TERMINAL_RUN_STATUSES: ReadonlySet<RunStatus>;
392
211
  export declare function isTerminalStatus(status: RunStatus): boolean;
393
- /**
394
- * Valid trigger source values for filtering run history.
395
- * "cli-rerun" is NOT a valid source — reruns have source="cli" and
396
- * createdFrom starting with "rerun:" (surfaced as `isRerun: true`).
397
- */
398
- export type RunSource = 'cli' | 'portal' | 'mcp' | 'schedule' | 'github_action';
399
- /** The valid RUN_SOURCES values as an array for CLI flag validation. */
400
- export declare const RUN_SOURCES: ReadonlyArray<RunSource>;
401
- /**
402
- * One row in a `GET /api/cli/v1/tests/{testId}/runs` response.
403
- *
404
- * `isRerun` is a derived field: `createdFrom?.startsWith('rerun:')` on the
405
- * backend. Reruns always have `source: 'cli'`; the `isRerun` flag + the
406
- * `createdFrom` lineage string together identify them.
407
- */
408
- export interface RunHistoryItem {
409
- runId: string;
410
- status: RunStatus;
411
- source: RunSource;
412
- /** Derived by backend: true when `createdFrom` starts with "rerun:". */
413
- isRerun: boolean;
414
- /** Lineage pointer; `null` for fresh runs. For reruns: `"rerun:<priorRunId>"`. */
415
- createdFrom: string | null;
416
- createdAt: string;
417
- /** May be null — backend doesn't always stamp it. */
418
- startedAt: string | null;
419
- finishedAt: string | null;
420
- /** May be null — not stamped on pre-M3.2 rows or on tests with no code body. */
421
- codeVersion: string | null;
422
- /** Null when the run passed. */
423
- failureKind: string | null;
424
- /**
425
- * G1b — the resolved target URL for this specific run. `null` when the
426
- * backend could not determine the URL (pre-G1b rows, or `targetUrlSource`
427
- * is `'unresolved'`). Optional on the wire for back-compat with older
428
- * backends that don't ship the field.
429
- */
430
- targetUrl?: string | null;
431
- /**
432
- * G1b — provenance of `targetUrl`.
433
- * - `'run'`: stamped at run-trigger time (authoritative; V2).
434
- * - `'unresolved'`: backend could not resolve a URL for this run.
435
- * - `null`: a V3 run — the environment in `environment` IS the target and
436
- * `targetUrl` is its address, so there is no separate provenance.
437
- * - absent: pre-G1b backend; treat as unknown.
438
- */
439
- targetUrlSource?: 'run' | 'unresolved' | null;
440
- /** The environment this run resolved to. Absent on older backends. */
441
- environment?: RunEnvironmentRef | null;
442
- }
443
- /**
444
- * Pre-cutover metadata block present when the test has no CLI-tracked
445
- * history (created before 2026-05-14).
446
- */
447
- export interface RunHistoryMeta {
448
- testKind?: 'frontend' | 'backend';
449
- /**
450
- * ISO date the history window starts at.
451
- * Present on pre-cutover responses (when `runs` is empty because no
452
- * TestRun rows exist for this test).
453
- */
454
- historyStartsAt?: string;
455
- /**
456
- * Human-readable note from the backend.
457
- * Rendered in CLI text mode instead of a blank table for pre-cutover tests.
458
- */
459
- note?: string;
460
- /** Portal URL where older run history can be viewed. */
461
- portalUrl?: string;
462
- /** Plan-limited history details; absent on older backends and V2. */
463
- tier?: string;
464
- retentionDays?: number | null;
465
- hiddenCount?: number;
466
- billingUrl?: string;
467
- }
468
- /**
469
- * Response from `GET /api/cli/v1/tests/{testId}/runs`.
470
- *
471
- * Pre-cutover shape: `runs: []`, `nextCursor: null`, `meta` has
472
- * `historyStartsAt` + `note` + `portalUrl`.
473
- */
474
- export interface ListRunsResponse {
475
- runs: RunHistoryItem[];
476
- /** Opaque cursor for the next page; `null` when no more pages. */
477
- nextCursor: string | null;
478
- meta: RunHistoryMeta;
479
- }
480
- /** Query parameters for `GET /api/cli/v1/tests/{testId}/runs`. */
481
- export interface ListRunsQuery {
482
- cursor?: string;
483
- pageSize?: number;
484
- source?: RunSource;
485
- /** ISO timestamp (after client-side duration parsing). */
486
- since?: string;
487
- /** Only runs whose credentials came from this environment (by name). */
488
- environment?: string;
489
- }
490
212
  /**
491
213
  * Body sent to `POST /api/cli/v1/tests/batch/run`.
492
214
  * BE-only engine — FE tests in the set are skipped server-side (advisory only).
@@ -508,12 +230,20 @@ export interface BatchRunFreshRequest {
508
230
  projectId: string;
509
231
  testIds?: string[];
510
232
  source: 'cli';
511
- /** See `TriggerRunBody.autoHeal`, including why `true` is never sent. */
512
- autoHeal?: false;
513
233
  /** See `TriggerRunBody.environment` — applied to every test in the batch. */
514
234
  environment?: string;
235
+ /** See `TriggerRunBody.skipDependencies` — applies to every BE test in the batch. */
236
+ skipDependencies?: boolean;
515
237
  /** Per-run URL override for the batch; echoed when the backend honors it. */
516
238
  targetUrl?: string;
239
+ /** See `TriggerRunBody.tunnelClientId`; carries every test of the request. Echoed when used. */
240
+ tunnelClientId?: string;
241
+ /**
242
+ * The most frontend tests of each run this request starts that execute at
243
+ * once (the server also caps a tunnelled run). Echoed with the cap it
244
+ * applied when a frontend run was started.
245
+ */
246
+ maxConcurrency?: number;
517
247
  /**
518
248
  * `'all'`: the server seeds every selected case into one execution and
519
249
  * paces dispatch itself (as for a GitHub App run) instead of cutting the
@@ -525,46 +255,76 @@ export interface BatchRunFreshRequest {
525
255
  previewName?: string;
526
256
  githubTrigger?: CiGithubTrigger;
527
257
  }
258
+ /** Strict body of POST /projects/:projectId/runs. Pacing belongs to the server. */
259
+ export interface ProjectRunRequest {
260
+ testIds?: string[];
261
+ environment?: string;
262
+ targetUrl?: string;
263
+ tunnelClientId?: string;
264
+ skipDependencies?: boolean;
265
+ maxConcurrency?: number;
266
+ admission?: 'all';
267
+ previewName?: string;
268
+ githubTrigger?: CiGithubTrigger;
269
+ }
270
+ /** One project launch. Result identities are read from GET /results?run=. */
271
+ export interface ProjectRunResponse {
272
+ runId: string;
273
+ projectId: string;
274
+ enqueuedAt: string;
275
+ total: number;
276
+ autoHeal: boolean;
277
+ maxConcurrency?: number;
278
+ environment: RunEnvironmentRef | null;
279
+ targetUrl: string | null;
280
+ tunnelClientId?: string;
281
+ dashboardUrl?: string;
282
+ blocked: Array<{
283
+ testId: string;
284
+ resultId: string;
285
+ reason: string;
286
+ message?: string;
287
+ }>;
288
+ held: Array<{
289
+ testId: string;
290
+ runId: string;
291
+ resultId: string;
292
+ }>;
293
+ }
528
294
  /** One accepted run in the batch fresh-run response. */
529
295
  export interface BatchRunFreshAccepted {
530
296
  /**
531
- * The `test_execution.id` this run was dispatched under (V3-served runs
532
- * only; absent on a V2 backend). One execution usually covers the whole
533
- * batch — `ci run` de-duplicates it to read the execution report.
297
+ * The `test_execution.id` this run was dispatched under (absent on an
298
+ * older backend). One execution usually covers the whole batch — `ci run`
299
+ * de-duplicates it to read the execution report.
534
300
  */
535
- executionId?: string;
301
+ runId?: string;
536
302
  testId: string;
537
303
  /**
538
- * runId minted synchronously by `claimRunSlotOrThrow`. The backend partitions
304
+ * resultId minted synchronously by `claimRunSlotOrThrow`. The backend partitions
539
305
  * any member whose slot-claim failed into `conflicts[]`, so every entry that
540
- * lands in `accepted[]` always carries a real runId (never undefined). The CLI
306
+ * lands in `accepted[]` always carries a real resultId (never undefined). The CLI
541
307
  * polls each one under `--wait`.
542
308
  */
543
- runId: string;
309
+ resultId: string;
544
310
  enqueuedAt: string;
545
- /**
546
- * CLIENT-synthesized Portal deep link — never sent by the server. Added by
547
- * `test run --all` (projectId from the request, testId per item) when the
548
- * API endpoint maps to a known portal host.
549
- */
550
- dashboardUrl?: string;
551
311
  }
552
312
  /**
553
313
  * Response from `POST /api/cli/v1/tests/batch/run`.
554
- * `accepted` carries per-test runIds. `conflicts`/`deferred`/`skippedFrontend`/
555
- * `skippedIntegration` enumerate everything NOT dispatched, so a JSON consumer
556
- * reading `accepted` alone can never silently undercount.
557
- * - `conflicts` — BE test already executing (slot-claim conflict)
314
+ * `accepted` carries per-test runIds. `conflicts`/`deferred` enumerate
315
+ * everything NOT dispatched, so a JSON consumer reading `accepted` alone can
316
+ * never silently undercount.
317
+ * - `conflicts` — test already executing (slot-claim conflict)
558
318
  * - `deferred` — per-key run budget exhausted this window; retry later
559
- * - `skippedFrontend` — FE tests in the set (BE-only wave engine)
560
- * - `skippedIntegration` — assembled integration tests (run via the portal)
319
+ * - `skippedFrontend` / `skippedIntegration` — always empty (every case
320
+ * runs); kept on the wire, and in the CLI's JSON, for older consumers.
561
321
  */
562
322
  export interface BatchRunFreshResponse {
563
323
  accepted: BatchRunFreshAccepted[];
564
324
  /** See `TriggerRunResponse.autoHeal`; absence means the same thing. */
565
325
  autoHeal?: boolean;
566
326
  /**
567
- * A run-slot conflict. `currentRunId`, when present, is the id of the run
327
+ * A run-slot conflict. `currentResultId`, when present, is the id of the run
568
328
  * ALREADY in flight for this test — under `--wait` the CLI polls it to a
569
329
  * verdict (auto-resume) instead of failing the batch. Absent ⇒ a hard
570
330
  * conflict with no resolvable in-flight run (still fails the batch).
@@ -589,13 +349,10 @@ export interface BatchRunFreshResponse {
589
349
  mayGenerate: boolean;
590
350
  };
591
351
  /**
592
- * Project-level portal link the batch closes with ("watch it here"). Same
593
- * absent-vs-present contract as the per-run `dashboardUrl`: ABSENT ⇒ an older
594
- * backend (or the V2 engine, whose live page is the CLI's own
595
- * `/dashboard/tests/{projectId}` template) — compute the legacy link
596
- * client-side; a string ⇒ print it verbatim; `null` ⇒ the server knows no
597
- * correct page exists (several sibling projects, no owning org) — print
598
- * nothing rather than a dead link.
352
+ * Project-level portal link the batch closes with ("watch it here"),
353
+ * server-built: a string ⇒ print it verbatim; `null` or absent ⇒ no correct
354
+ * page exists (several sibling projects, no owning org, or an older
355
+ * backend) — print nothing rather than a dead link.
599
356
  */
600
357
  dashboardUrl?: string | null;
601
358
  /**
@@ -607,6 +364,16 @@ export interface BatchRunFreshResponse {
607
364
  /** Echoes, same contract as `targetUrl`: absent means this backend never read the field. */
608
365
  admission?: 'budget' | 'all';
609
366
  previewName?: string;
367
+ /** See `TriggerRunResponse.skipDependencies`; same present-or-omitted contract. */
368
+ skipDependencies?: boolean;
369
+ /** The request's tunnel, echoed once a test was started through it. */
370
+ tunnelClientId?: string;
371
+ /**
372
+ * The cap the server applied to each run it started (the highest when the
373
+ * request spans projects), echoed when the request sent `maxConcurrency`
374
+ * and a frontend run was started.
375
+ */
376
+ maxConcurrency?: number;
610
377
  }
611
378
  /** One row of an execution report — one `test_result` of that execution. */
612
379
  export interface ExecutionReportTest {
@@ -631,7 +398,7 @@ export interface ExecutionReportTest {
631
398
  */
632
399
  export interface ExecutionReport {
633
400
  projectId: string;
634
- executionId: string;
401
+ runId: string;
635
402
  projectName: string;
636
403
  orgId: string | null;
637
404
  stats: {