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