@testsprite/testsprite-cli 0.6.0 → 0.8.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 (96) hide show
  1. package/README.md +52 -31
  2. package/dist/commands/agent.js +91 -45
  3. package/dist/commands/ci.d.ts +88 -0
  4. package/dist/commands/ci.js +429 -0
  5. package/dist/commands/doctor.d.ts +1 -1
  6. package/dist/commands/doctor.js +104 -8
  7. package/dist/commands/init.js +8 -0
  8. package/dist/commands/project.d.ts +78 -0
  9. package/dist/commands/project.js +429 -5
  10. package/dist/commands/schedule.d.ts +120 -0
  11. package/dist/commands/schedule.js +487 -0
  12. package/dist/commands/test.d.ts +176 -2
  13. package/dist/commands/test.js +2235 -609
  14. package/dist/commands/testlist.d.ts +88 -0
  15. package/dist/commands/testlist.js +753 -0
  16. package/dist/commands/tunnel.d.ts +72 -0
  17. package/dist/commands/tunnel.js +367 -0
  18. package/dist/index.js +113 -40
  19. package/dist/lib/agent-targets.d.ts +13 -4
  20. package/dist/lib/agent-targets.js +11 -2
  21. package/dist/lib/conflict-reason.d.ts +30 -0
  22. package/dist/lib/conflict-reason.js +45 -0
  23. package/dist/lib/credentials.js +42 -1
  24. package/dist/lib/cron.d.ts +40 -0
  25. package/dist/lib/cron.js +190 -0
  26. package/dist/lib/dry-run/samples.d.ts +9 -0
  27. package/dist/lib/dry-run/samples.js +293 -55
  28. package/dist/lib/errors.d.ts +9 -0
  29. package/dist/lib/errors.js +11 -0
  30. package/dist/lib/gh-output.d.ts +33 -1
  31. package/dist/lib/gh-output.js +97 -27
  32. package/dist/lib/http.d.ts +119 -0
  33. package/dist/lib/http.js +243 -2
  34. package/dist/lib/interrupt.d.ts +38 -13
  35. package/dist/lib/interrupt.js +130 -15
  36. package/dist/lib/junit-report.d.ts +20 -2
  37. package/dist/lib/junit-report.js +38 -5
  38. package/dist/lib/local-target.d.ts +95 -0
  39. package/dist/lib/local-target.js +184 -0
  40. package/dist/lib/plan-poll.d.ts +171 -0
  41. package/dist/lib/plan-poll.js +442 -0
  42. package/dist/lib/plans.types.d.ts +130 -0
  43. package/dist/lib/plans.types.js +31 -0
  44. package/dist/lib/poll-support.d.ts +26 -0
  45. package/dist/lib/poll-support.js +65 -0
  46. package/dist/lib/poll.d.ts +1 -0
  47. package/dist/lib/poll.js +2 -40
  48. package/dist/lib/proxy.d.ts +16 -0
  49. package/dist/lib/proxy.js +19 -1
  50. package/dist/lib/response-schemas.d.ts +20 -0
  51. package/dist/lib/response-schemas.js +55 -1
  52. package/dist/lib/run-progress.d.ts +41 -0
  53. package/dist/lib/run-progress.js +56 -0
  54. package/dist/lib/runs.types.d.ts +32 -3
  55. package/dist/lib/secret-file.d.ts +15 -0
  56. package/dist/lib/secret-file.js +82 -0
  57. package/dist/lib/target-url-preflight.d.ts +91 -0
  58. package/dist/lib/target-url-preflight.js +259 -0
  59. package/dist/lib/target-url.d.ts +63 -9
  60. package/dist/lib/target-url.js +283 -62
  61. package/dist/lib/telemetry.d.ts +11 -0
  62. package/dist/lib/telemetry.js +1 -0
  63. package/dist/lib/testlist.types.d.ts +77 -0
  64. package/dist/lib/testlist.types.js +9 -0
  65. package/dist/lib/ticker.d.ts +8 -0
  66. package/dist/lib/ticker.js +3 -0
  67. package/dist/lib/tunnel-session.d.ts +129 -0
  68. package/dist/lib/tunnel-session.js +232 -0
  69. package/dist/lib/tunnel.types.d.ts +54 -0
  70. package/dist/lib/tunnel.types.js +8 -0
  71. package/dist/lib/v3-advisory.d.ts +35 -22
  72. package/dist/lib/v3-advisory.js +44 -24
  73. package/dist/lib/wait-exit.d.ts +29 -0
  74. package/dist/lib/wait-exit.js +103 -0
  75. package/dist/vendor/tunnel-client/client.d.ts +83 -0
  76. package/dist/vendor/tunnel-client/client.js +871 -0
  77. package/dist/vendor/tunnel-client/config.d.ts +41 -0
  78. package/dist/vendor/tunnel-client/config.js +42 -0
  79. package/dist/vendor/tunnel-client/index.d.ts +9 -0
  80. package/dist/vendor/tunnel-client/index.js +9 -0
  81. package/dist/vendor/tunnel-client/lodash-lite.d.ts +14 -0
  82. package/dist/vendor/tunnel-client/lodash-lite.js +24 -0
  83. package/dist/vendor/tunnel-client/protocol.d.ts +60 -0
  84. package/dist/vendor/tunnel-client/protocol.js +143 -0
  85. package/dist/vendor/tunnel-client/types.d.ts +96 -0
  86. package/dist/vendor/tunnel-client/types.js +10 -0
  87. package/dist/vendor/tunnel-client/ws-compat.d.ts +206 -0
  88. package/dist/vendor/tunnel-client/ws-compat.js +316 -0
  89. package/dist/version-guard.d.ts +10 -7
  90. package/dist/version-guard.js +37 -9
  91. package/dist/version.d.ts +1 -1
  92. package/dist/version.js +1 -1
  93. package/package.json +2 -1
  94. package/skills/testsprite-onboard.skill.md +60 -4
  95. package/skills/testsprite-verify.codex.md +22 -16
  96. package/skills/testsprite-verify.skill.md +27 -18
@@ -17,9 +17,14 @@
17
17
  */
18
18
  export interface CiRunRow {
19
19
  testId: string;
20
+ /** Human title for the Test column; falls back to `testId` when absent. */
21
+ title?: string;
20
22
  runId?: string;
21
23
  status: string;
24
+ /** Test-case page link — anchors the Test column title. */
22
25
  dashboardUrl?: string;
26
+ /** This run's execution-result page link — anchors the Run column. */
27
+ executionUrl?: string;
23
28
  error?: string;
24
29
  }
25
30
  export interface CiSummary {
@@ -42,7 +47,9 @@ export interface CiSummary {
42
47
  * with no annotation. (`skippedFrontend` / `skippedIntegration` are NOT folded
43
48
  * in — they exit 0 and are the Action layer's allow-partial concern.)
44
49
  */
45
- export declare function summarizeAcceptedPayload(capturedJson: string): CiSummary;
50
+ export declare function summarizeAcceptedPayload(capturedJson: string, opts?: {
51
+ notFoundNote?: string;
52
+ }): CiSummary;
46
53
  /**
47
54
  * Reduce a single `test run <test-id> --wait` result into the same CI summary
48
55
  * shape as the batch path, so `--gh-output` / `--summary-file` behave
@@ -52,9 +59,11 @@ export declare function summarizeAcceptedPayload(capturedJson: string): CiSummar
52
59
  */
53
60
  export declare function summarizeSingleRun(run: {
54
61
  testId?: string;
62
+ testTitle?: string | null;
55
63
  runId?: string;
56
64
  status?: string;
57
65
  dashboardUrl?: string | null;
66
+ executionUrl?: string | null;
58
67
  error?: string | null;
59
68
  }): CiSummary;
60
69
  /** Markdown table for the GitHub job summary. */
@@ -81,4 +90,27 @@ export declare function emitGithubOutputs(summary: CiSummary, env: NodeJS.Proces
81
90
  annotations?: (line: string) => void;
82
91
  }, opts?: {
83
92
  force?: boolean;
93
+ label?: string;
84
94
  }): void;
95
+ /**
96
+ * Emit the CI artifacts for a `--wait` run: the machine summary file (when
97
+ * `--summary-file` is set) and the GitHub-native annotations + job-summary table
98
+ * (when `--gh-output` or `GITHUB_ACTIONS=true`). One shared implementation for
99
+ * every `--wait` command — `test run` (single + `--all`), `test rerun`, and
100
+ * `testlist run` — so the four copies of this block can no longer drift (a
101
+ * per-copy fix like the `notFound` fold reaching only one of them is what this
102
+ * consolidates away). The caller reduces its own envelope to a `CiSummary` first
103
+ * (`summarizeAcceptedPayload` for a batch, `summarizeSingleRun` for one run);
104
+ * this owns only the two sinks and their best-effort writes. `label` names the
105
+ * command in the failure messages (`[run]` / `[rerun]` / `[testlist run]`).
106
+ * Both writes are best-effort — a sink throwing must never change the exit code.
107
+ */
108
+ export declare function emitCiArtifacts(summary: CiSummary, opts: {
109
+ ghOutput?: boolean;
110
+ summaryFile?: string;
111
+ output?: string;
112
+ }, io: {
113
+ env: NodeJS.ProcessEnv;
114
+ stdout: (line: string) => void;
115
+ stderr: (line: string) => void;
116
+ }, label: string): void;
@@ -1,20 +1,4 @@
1
- /**
2
- * CI-native output layer for the run path (issue #99, reshaped from
3
- * the withdrawn top-level `ci` command per the #264 review). Covers both a
4
- * single `test run <test-id> --wait` and the `test run --all --wait` batch.
5
- *
6
- * A `--wait` run presents its result in the formats CI consumes:
7
- * (a) a stable machine summary `{total, passed, failed, timedOut, runs[]}`
8
- * written to `--summary-file <path>` when requested,
9
- * (b) a Markdown results table appended to `$GITHUB_STEP_SUMMARY` when
10
- * running under GitHub Actions,
11
- * (c) one `::error::` workflow-command line per non-passed run so failures
12
- * annotate the PR checks tab.
13
- * Activation: `GITHUB_ACTIONS=true` in the environment, or the explicit
14
- * `--gh-output` flag (which forces the annotations even off-Actions, so the
15
- * behavior is previewable locally). All writes are best-effort: a broken
16
- * summary file must never mask the batch gate's exit code.
17
- */
1
+ import { appendFileSync, writeFileSync } from 'node:fs';
18
2
  /**
19
3
  * Reduce a non-dispatched bucket (`deferred` / `conflicts` / `notFound`) into
20
4
  * CI rows. Items are either bare testId strings (`notFound`) or
@@ -49,7 +33,7 @@ function bucketRows(bucket, status, note) {
49
33
  * with no annotation. (`skippedFrontend` / `skippedIntegration` are NOT folded
50
34
  * in — they exit 0 and are the Action layer's allow-partial concern.)
51
35
  */
52
- export function summarizeAcceptedPayload(capturedJson) {
36
+ export function summarizeAcceptedPayload(capturedJson, opts = {}) {
53
37
  let parsed;
54
38
  try {
55
39
  parsed = JSON.parse(capturedJson);
@@ -70,9 +54,11 @@ export function summarizeAcceptedPayload(capturedJson) {
70
54
  : undefined;
71
55
  return {
72
56
  testId: String(row.testId ?? ''),
57
+ ...(typeof row.testTitle === 'string' ? { title: row.testTitle } : {}),
73
58
  ...(typeof row.runId === 'string' ? { runId: row.runId } : {}),
74
59
  status: String(row.status ?? 'unknown'),
75
60
  ...(typeof row.dashboardUrl === 'string' ? { dashboardUrl: row.dashboardUrl } : {}),
61
+ ...(typeof row.executionUrl === 'string' ? { executionUrl: row.executionUrl } : {}),
76
62
  ...(typeof errorMessage === 'string' ? { error: errorMessage } : {}),
77
63
  };
78
64
  })
@@ -81,7 +67,11 @@ export function summarizeAcceptedPayload(capturedJson) {
81
67
  ...acceptedRows,
82
68
  ...bucketRows(payload.deferred, 'deferred', 'rate-deferred (not dispatched)'),
83
69
  ...bucketRows(payload.conflicts, 'conflict', 'already in flight (not dispatched)'),
84
- ...bucketRows(payload.notFound, 'not_found', 'no replayable run (not dispatched)'),
70
+ // Default note is `test rerun`'s cause (a not-found id has no replayable
71
+ // run). `testlist run` passes its own — a not-found `--case` id is one that
72
+ // is not a member of the list — so the annotation/artifact don't state the
73
+ // wrong reason on the surface this whole layer exists to serve.
74
+ ...bucketRows(payload.notFound, 'not_found', opts.notFoundNote ?? 'no replayable run (not dispatched)'),
85
75
  ];
86
76
  const passed = rows.filter(row => row.status === 'passed').length;
87
77
  const timedOut = rows.filter(row => row.status === 'timeout').length;
@@ -98,9 +88,11 @@ export function summarizeAcceptedPayload(capturedJson) {
98
88
  export function summarizeSingleRun(run) {
99
89
  const row = {
100
90
  testId: String(run.testId ?? ''),
91
+ ...(typeof run.testTitle === 'string' ? { title: run.testTitle } : {}),
101
92
  ...(typeof run.runId === 'string' ? { runId: run.runId } : {}),
102
93
  status: String(run.status ?? 'unknown'),
103
94
  ...(typeof run.dashboardUrl === 'string' ? { dashboardUrl: run.dashboardUrl } : {}),
95
+ ...(typeof run.executionUrl === 'string' ? { executionUrl: run.executionUrl } : {}),
104
96
  ...(typeof run.error === 'string' && run.error.length > 0 ? { error: run.error } : {}),
105
97
  };
106
98
  const passed = row.status === 'passed' ? 1 : 0;
@@ -113,9 +105,30 @@ export function summarizeSingleRun(run) {
113
105
  * layout and a CR/LF would inject extra Markdown lines (rows are newline-joined)
114
106
  * — the same injection class the annotation escaping guards against, on the
115
107
  * step-summary surface.
108
+ *
109
+ * Backslashes are escaped FIRST: GFM reads `\\` as a literal backslash, so a
110
+ * title's own trailing `\` would otherwise consume the `\` we insert before `|`
111
+ * (turning `\|` back into an unescaped column break). Doubling the value's own
112
+ * backslashes up front keeps every later insert a real escape.
116
113
  */
117
114
  function escapeTableCell(value) {
118
- return value.replace(/\|/g, '\\|').replace(/[\r\n]+/g, ' ');
115
+ return value
116
+ .replace(/\\/g, '\\\\')
117
+ .replace(/\|/g, '\\|')
118
+ .replace(/[\r\n]+/g, ' ');
119
+ }
120
+ /**
121
+ * Escape a value used as the TEXT half of a Markdown `[text](url)` link inside a
122
+ * table cell. On top of the cell escaping (backslashes, `|`, CR/LF), an unescaped
123
+ * `]` closes the link early — so a bracketed title like `x](https://evil) y` would
124
+ * retarget the visible link at the injected URL. Titles are workspace-authored and
125
+ * often LLM-generated, so brackets are realistic; escape `[` and `]` (backslash).
126
+ * `escapeTableCell` has already doubled the value's own backslashes, so the escape
127
+ * we insert before a bracket can't be consumed by a preceding `\`. Plain (unlinked)
128
+ * cells keep `escapeTableCell`.
129
+ */
130
+ function escapeMarkdownLinkText(value) {
131
+ return escapeTableCell(value).replace(/([[\]])/g, '\\$1');
119
132
  }
120
133
  /**
121
134
  * Escape a URL for a Markdown `[text](url)` link: a literal `)` closes the link
@@ -139,10 +152,24 @@ export function renderJobSummaryMarkdown(summary) {
139
152
  '| Test | Status | Run |',
140
153
  '| --- | --- | --- |',
141
154
  ...summary.runs.map(row => {
142
- const run = row.dashboardUrl
143
- ? `[dashboard](${escapeMarkdownUrl(row.dashboardUrl)})`
144
- : escapeTableCell(row.runId ?? '');
145
- return `| ${escapeTableCell(row.testId)} | ${escapeTableCell(row.status)} | ${run} |`;
155
+ // `|| ` not `?? `: an empty / whitespace-only title must fall back to the
156
+ // id (a blank Test cell is useless), matching JUnit's `name?.trim() || id`.
157
+ const label = row.title?.trim() || row.testId;
158
+ const runId = row.runId ?? '';
159
+ // Test cell links the human label to the TEST-CASE page (`dashboardUrl`);
160
+ // Run cell links to THIS RUN's result page (`executionUrl`). The two are
161
+ // distinct destinations — the run link is absent for a V2 run (no execution
162
+ // page), where the run cell degrades to the raw runId. The label sits in
163
+ // link-text position, so it uses the bracket-aware escaper.
164
+ const test = row.dashboardUrl
165
+ ? `[${escapeMarkdownLinkText(label)}](${escapeMarkdownUrl(row.dashboardUrl)})`
166
+ : escapeTableCell(label);
167
+ // Keep the run id as the link text (not a constant "result") so it stays
168
+ // scannable while being clickable.
169
+ const run = row.executionUrl && runId
170
+ ? `[${escapeMarkdownLinkText(runId)}](${escapeMarkdownUrl(row.executionUrl)})`
171
+ : escapeTableCell(runId);
172
+ return `| ${test} | ${escapeTableCell(row.status)} | ${run} |`;
146
173
  }),
147
174
  '',
148
175
  ].join('\n');
@@ -175,13 +202,14 @@ function escapeCommandProperty(value) {
175
202
  * Both writes are best-effort: a broken summary file must not mask the gate.
176
203
  */
177
204
  export function emitGithubOutputs(summary, env, sinks, opts = {}) {
205
+ const label = opts.label ?? 'run';
178
206
  const summaryPath = env.GITHUB_STEP_SUMMARY;
179
207
  if (typeof summaryPath === 'string' && summaryPath.length > 0) {
180
208
  try {
181
209
  sinks.appendFile(summaryPath, renderJobSummaryMarkdown(summary));
182
210
  }
183
211
  catch {
184
- sinks.stderr('[run] could not append to GITHUB_STEP_SUMMARY; continuing');
212
+ sinks.stderr(`[${label}] could not append to GITHUB_STEP_SUMMARY; continuing`);
185
213
  }
186
214
  }
187
215
  if (env.GITHUB_ACTIONS === 'true' || opts.force === true) {
@@ -190,13 +218,55 @@ export function emitGithubOutputs(summary, env, sinks, opts = {}) {
190
218
  if (row.status === 'passed')
191
219
  continue;
192
220
  const detail = row.error !== undefined ? ` ${row.error}` : '';
193
- const link = row.dashboardUrl !== undefined ? ` ${row.dashboardUrl}` : '';
221
+ // Prefer this run's result page over the test-case page — on a failure the
222
+ // result is what the reviewer wants to open. Falls back to the test-case
223
+ // link (V2 runs, which have no execution page), then to nothing.
224
+ const linkUrl = row.executionUrl ?? row.dashboardUrl;
225
+ const link = linkUrl !== undefined ? ` ${linkUrl}` : '';
194
226
  // Escape both halves: a raw multiline run error (or a testId) must not be
195
227
  // able to smuggle a second workflow command into the Actions stream.
196
- const title = `TestSprite ${escapeCommandProperty(row.testId)}`;
228
+ const title = `TestSprite ${escapeCommandProperty(row.title?.trim() || row.testId)}`;
197
229
  const message = escapeCommandData(`status=${row.status}${detail}${link}`);
198
230
  annotate(`::error title=${title}::${message}`);
199
231
  }
200
232
  }
201
233
  }
234
+ /**
235
+ * Emit the CI artifacts for a `--wait` run: the machine summary file (when
236
+ * `--summary-file` is set) and the GitHub-native annotations + job-summary table
237
+ * (when `--gh-output` or `GITHUB_ACTIONS=true`). One shared implementation for
238
+ * every `--wait` command — `test run` (single + `--all`), `test rerun`, and
239
+ * `testlist run` — so the four copies of this block can no longer drift (a
240
+ * per-copy fix like the `notFound` fold reaching only one of them is what this
241
+ * consolidates away). The caller reduces its own envelope to a `CiSummary` first
242
+ * (`summarizeAcceptedPayload` for a batch, `summarizeSingleRun` for one run);
243
+ * this owns only the two sinks and their best-effort writes. `label` names the
244
+ * command in the failure messages (`[run]` / `[rerun]` / `[testlist run]`).
245
+ * Both writes are best-effort — a sink throwing must never change the exit code.
246
+ */
247
+ export function emitCiArtifacts(summary, opts, io, label) {
248
+ const ghEnabled = opts.ghOutput === true || io.env.GITHUB_ACTIONS === 'true';
249
+ if (!ghEnabled && opts.summaryFile === undefined)
250
+ return;
251
+ if (opts.summaryFile !== undefined) {
252
+ try {
253
+ // eslint-disable-next-line security/detect-non-literal-fs-filename -- `--summary-file` is an explicit operator-supplied CI-artifact output path; best-effort in try/catch.
254
+ writeFileSync(opts.summaryFile, `${JSON.stringify(summary, null, 2)}\n`, 'utf8');
255
+ }
256
+ catch {
257
+ io.stderr(`[${label}] could not write --summary-file ${opts.summaryFile}; continuing`);
258
+ }
259
+ }
260
+ if (ghEnabled) {
261
+ emitGithubOutputs(summary, io.env, {
262
+ stdout: io.stdout,
263
+ stderr: io.stderr,
264
+ // eslint-disable-next-line security/detect-non-literal-fs-filename -- `path` is the CI-provided `$GITHUB_STEP_SUMMARY` env path, never external input.
265
+ appendFile: (path, content) => appendFileSync(path, content, 'utf8'),
266
+ // Under --output json the run envelope owns stdout; workflow commands go
267
+ // to stderr instead (the Actions runner parses both streams).
268
+ annotations: opts.output === 'json' ? io.stderr : io.stdout,
269
+ }, { force: opts.ghOutput === true, label });
270
+ }
271
+ }
202
272
  //# sourceMappingURL=gh-output.js.map
@@ -1,7 +1,10 @@
1
1
  import * as v from 'valibot';
2
2
  import type { ErrorCode } from './errors.js';
3
3
  import { ApiError } from './errors.js';
4
+ import type { CliTestListRunResponse } from './testlist.types.js';
4
5
  import type { TriggerRunBody, TriggerRunResponse, RunResponse, RerunRequest, RerunResponse, BatchRerunRequest, BatchRerunResponse, BatchRunFreshRequest, BatchRunFreshResponse, ListRunsQuery, ListRunsResponse, CancelRunResponse } from './runs.types.js';
6
+ import type { CliAcceptPlansResponse, CliGeneratePlansResponse, CliGetPlansResponse } from './plans.types.js';
7
+ import type { MintTunnelBody, TunnelMintResponse, TunnelStatusResponse } from './tunnel.types.js';
5
8
  export type FetchImpl = typeof globalThis.fetch;
6
9
  export type DebugEventKind = 'request' | 'response' | 'retry' | 'error';
7
10
  export interface DebugEvent {
@@ -87,11 +90,28 @@ export interface HttpClientOptions {
87
90
  * `globalShutdown.signal` via the client factory.
88
91
  */
89
92
  shutdownSignal?: AbortSignal;
93
+ /**
94
+ * Upper bound (bytes) on a successful JSON response body the client will
95
+ * buffer before parsing. A response whose declared `Content-Length` — or
96
+ * actual streamed size — exceeds this fails fast with a typed
97
+ * `PAYLOAD_TOO_LARGE` error instead of growing the heap without limit.
98
+ * Defaults to {@link MAX_RESPONSE_BYTES_DEFAULT} (64 MiB).
99
+ */
100
+ maxResponseBytes?: number;
90
101
  }
91
102
  export interface RequestOptions<T = unknown> {
92
103
  query?: Record<string, string | number | boolean | undefined>;
93
104
  signal?: AbortSignal;
94
105
  requestId?: string;
106
+ /**
107
+ * Accept an HTTP 204 as a successful response with no body.
108
+ *
109
+ * This is deliberately opt-in: the CLI's established response contract is
110
+ * JSON even for schema-less generic callers, so silently returning
111
+ * `undefined` would turn a server-side body regression into apparent
112
+ * success. Use only for endpoints whose documented success response is 204.
113
+ */
114
+ allowNoContent?: boolean;
95
115
  /**
96
116
  * Optional valibot schema for the parsed 2xx response body (issue #102).
97
117
  *
@@ -166,7 +186,13 @@ export declare class HttpClient {
166
186
  private readonly onServerVersion?;
167
187
  private readonly requestTimeoutMs;
168
188
  private readonly shutdownSignal?;
189
+ private readonly maxResponseBytes;
169
190
  constructor(options: HttpClientOptions);
191
+ /** The resolved facade base URL (trailing slash trimmed). Read-only —
192
+ * callers that bypass the client for a side-channel request (e.g. the
193
+ * presigned S3 PUT) use it to reason about the facade's locality
194
+ * (DEV-384 review F3). */
195
+ get resolvedBaseUrl(): string;
170
196
  /**
171
197
  * Read the backend's supported-floor header off a response and forward it to
172
198
  * `onServerVersion` when present. Never throws — a bad header must not break
@@ -253,6 +279,21 @@ export declare class HttpClient {
253
279
  idempotencyKey: string;
254
280
  signal?: AbortSignal;
255
281
  }): Promise<BatchRunFreshResponse>;
282
+ /**
283
+ * POST /api/cli/v1/testlist/{listId}/run
284
+ * Dispatch a test list's cases (optionally a `testIds` subset) per project
285
+ * with their configured environments; returns pollable runIds. `--wait` polls
286
+ * each `accepted[].runId`.
287
+ *
288
+ * `retryOnConflict: false` — a 409 here (every dispatched project is an
289
+ * MCP-mirrored view-only mirror) is a permanent condition, not a transient one.
290
+ */
291
+ triggerTestListRun(listId: string, body: {
292
+ testIds?: string[];
293
+ }, options: {
294
+ idempotencyKey: string;
295
+ signal?: AbortSignal;
296
+ }): Promise<CliTestListRunResponse>;
256
297
  /**
257
298
  * GET /api/cli/v1/tests/{testId}/runs
258
299
  * List a test's prior run history, newest-first.
@@ -280,6 +321,44 @@ export declare class HttpClient {
280
321
  includeSteps?: boolean;
281
322
  signal?: AbortSignal;
282
323
  }): Promise<RunResponse>;
324
+ /**
325
+ * POST /api/cli/v1/tunnel — mint a tunnel client for `test run --local`.
326
+ *
327
+ * The ONLY response on this surface that carries a secret. Deliberately NOT
328
+ * sent with an `Idempotency-Key`: the interceptor persists the response body
329
+ * for the whole replay window, so an idempotent mint would put a live
330
+ * credential in the idempotency store — the exact copy the server-side
331
+ * binding exists to avoid. The server rate-limits this route instead.
332
+ *
333
+ * `retryOnConflict: false` for the same reason `triggerRun` opts out: a 409
334
+ * here means the per-principal live-binding cap is reached, which is a
335
+ * standing condition, not a transient snapshot conflict.
336
+ */
337
+ mintTunnel(body: MintTunnelBody, options?: {
338
+ signal?: AbortSignal;
339
+ }): Promise<TunnelMintResponse>;
340
+ /**
341
+ * GET /api/cli/v1/tunnel/{clientId} — is this binding's client connected?
342
+ *
343
+ * A 404 covers unknown, another tenant's, and expired alike; the surface is
344
+ * deliberately not an existence oracle for client ids. Callers must not
345
+ * translate a transport failure or a non-200 into `offline` — "the tunnel is
346
+ * down" and "we could not reach TestSprite to ask" are different answers,
347
+ * and collapsing them is what DEV-1005 was.
348
+ */
349
+ getTunnelStatus(clientId: string, options?: {
350
+ signal?: AbortSignal;
351
+ }): Promise<TunnelStatusResponse>;
352
+ /**
353
+ * DELETE /api/cli/v1/tunnel/{clientId} — destroy a binding. 204, idempotent.
354
+ *
355
+ * No body, no `Idempotency-Key`: the operation is idempotent by definition
356
+ * and this is the call made from a `finally` block, including after a
357
+ * signal, where there is least room for extra ceremony.
358
+ */
359
+ deleteTunnel(clientId: string, options?: {
360
+ signal?: AbortSignal;
361
+ }): Promise<void>;
283
362
  /**
284
363
  * POST /api/cli/v1/runs/{runId}/cancel
285
364
  * User-initiated cancel of a queued/running run (DEV-331 piece 3). No
@@ -294,6 +373,46 @@ export declare class HttpClient {
294
373
  cancelRun(runId: string, options?: {
295
374
  signal?: AbortSignal;
296
375
  }): Promise<CancelRunResponse>;
376
+ /**
377
+ * POST /api/cli/v1/projects/{projectId}/plans/generate (DEV-384 V3-B)
378
+ * Start whichever generation stage the project is missing next. The body
379
+ * is empty by contract — the server decides which rung fires. 202 both
380
+ * for `accepted` (a stage started) and `nothing_to_start` (proposals are
381
+ * already staged; the facade's no-restart guard refuses a duplicate
382
+ * append because it would wipe the batch and re-bill 2 credits).
383
+ *
384
+ * `retryOnConflict: false` — a 409 here is `stage_in_flight`, a flow
385
+ * signal the ladder answers by attaching and polling, never a transient
386
+ * snapshot conflict to paper over with a retry.
387
+ */
388
+ generatePlans(projectId: string, options: {
389
+ idempotencyKey: string;
390
+ signal?: AbortSignal;
391
+ }): Promise<CliGeneratePlansResponse>;
392
+ /**
393
+ * GET /api/cli/v1/projects/{projectId}/plans (DEV-384 V3-B)
394
+ * Pure read: the facade-synthesized generation status, the staged
395
+ * proposal list (stable proposalIds — what `accept --only` consumes),
396
+ * and a best-effort credits block. When `waitSeconds` (1–25) is
397
+ * provided the server long-polls: one request per window, answered
398
+ * early on any change.
399
+ */
400
+ getPlans(projectId: string, options?: {
401
+ waitSeconds?: number;
402
+ signal?: AbortSignal;
403
+ }): Promise<CliGetPlansResponse>;
404
+ /**
405
+ * POST /api/cli/v1/projects/{projectId}/plans/accept (DEV-384 V3-B)
406
+ * Convert staged proposals into real test cases. `only` is ALWAYS an
407
+ * explicit, non-empty id list — the caller enforces the two §3.3 safety
408
+ * rules (full list when the user didn't subset; an empty selection is a
409
+ * client-side validation error because `[]` is server-destructive:
410
+ * it means "reject everything" and clears the staged batch).
411
+ */
412
+ acceptPlans(projectId: string, only: string[], options: {
413
+ idempotencyKey: string;
414
+ signal?: AbortSignal;
415
+ }): Promise<CliAcceptPlansResponse>;
297
416
  /**
298
417
  * Classify an error thrown while issuing OR reading a request. When it is an
299
418
  * abort/timeout and our per-request timeout signal fired (and the caller had