@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.
- package/README.md +51 -147
- package/dist/commands/agent.d.ts +12 -4
- package/dist/commands/agent.js +48 -63
- package/dist/commands/auth.d.ts +6 -10
- package/dist/commands/auth.js +38 -54
- package/dist/commands/ci.d.ts +23 -100
- package/dist/commands/ci.js +293 -487
- package/dist/commands/conversation.d.ts +27 -0
- package/dist/commands/conversation.js +702 -0
- package/dist/commands/doctor.d.ts +5 -1
- package/dist/commands/doctor.js +129 -34
- package/dist/commands/init.d.ts +4 -45
- package/dist/commands/init.js +108 -66
- package/dist/commands/project-env.d.ts +62 -2
- package/dist/commands/project-env.js +388 -37
- package/dist/commands/project-sign-in.d.ts +0 -48
- package/dist/commands/project-sign-in.js +1 -229
- package/dist/commands/project.d.ts +15 -186
- package/dist/commands/project.js +89 -924
- package/dist/commands/result.d.ts +10 -0
- package/dist/commands/result.js +215 -0
- package/dist/commands/schedule.d.ts +0 -29
- package/dist/commands/schedule.js +28 -87
- package/dist/commands/test.d.ts +301 -1816
- package/dist/commands/test.js +1951 -13902
- package/dist/commands/testlist.d.ts +128 -5
- package/dist/commands/testlist.js +269 -339
- package/dist/commands/tunnel.d.ts +2 -2
- package/dist/commands/tunnel.js +23 -19
- package/dist/commands/usage.d.ts +12 -45
- package/dist/commands/usage.js +50 -131
- package/dist/index.js +182 -104
- package/dist/lib/agent-detect.js +9 -5
- package/dist/lib/agent-targets.d.ts +21 -2
- package/dist/lib/agent-targets.js +88 -11
- package/dist/lib/args.d.ts +13 -0
- package/dist/lib/args.js +49 -0
- package/dist/lib/basic-auth.d.ts +3 -0
- package/dist/lib/basic-auth.js +15 -0
- package/dist/lib/billing-refusal.js +4 -3
- package/dist/lib/ci-linkage.d.ts +4 -82
- package/dist/lib/ci-linkage.js +4 -157
- package/dist/lib/ci-run.js +1 -1
- package/dist/lib/client-factory.d.ts +10 -2
- package/dist/lib/client-factory.js +38 -26
- package/dist/lib/commit-signal.d.ts +65 -0
- package/dist/lib/commit-signal.js +305 -0
- package/dist/lib/concurrency-limiter.d.ts +6 -0
- package/dist/lib/concurrency-limiter.js +29 -0
- package/dist/lib/config.js +10 -5
- package/dist/lib/conflict-reason.d.ts +9 -3
- package/dist/lib/conflict-reason.js +6 -3
- package/dist/lib/conversation/answers.d.ts +9 -0
- package/dist/lib/conversation/answers.js +49 -0
- package/dist/lib/conversation/api.d.ts +71 -0
- package/dist/lib/conversation/api.js +150 -0
- package/dist/lib/conversation/change.d.ts +31 -0
- package/dist/lib/conversation/change.js +124 -0
- package/dist/lib/conversation/context.d.ts +19 -0
- package/dist/lib/conversation/context.js +70 -0
- package/dist/lib/conversation/environment.d.ts +15 -0
- package/dist/lib/conversation/environment.js +33 -0
- package/dist/lib/conversation/follow.d.ts +24 -0
- package/dist/lib/conversation/follow.js +42 -0
- package/dist/lib/conversation/render.d.ts +33 -0
- package/dist/lib/conversation/render.js +315 -0
- package/dist/lib/conversation/title.d.ts +2 -0
- package/dist/lib/conversation/title.js +18 -0
- package/dist/lib/conversation/types.d.ts +156 -0
- package/dist/lib/conversation/types.js +6 -0
- package/dist/lib/credentials.js +67 -11
- package/dist/lib/cron.d.ts +1 -1
- package/dist/lib/cron.js +2 -2
- package/dist/lib/dispatch-stop.d.ts +20 -0
- package/dist/lib/dispatch-stop.js +30 -0
- package/dist/lib/download.d.ts +71 -0
- package/dist/lib/download.js +274 -0
- package/dist/lib/dry-run/fetch.d.ts +10 -0
- package/dist/lib/dry-run/fetch.js +20 -0
- package/dist/lib/dry-run/samples.d.ts +6 -34
- package/dist/lib/dry-run/samples.js +375 -747
- package/dist/lib/environment-tunnel.d.ts +16 -27
- package/dist/lib/environment-tunnel.js +161 -154
- package/dist/lib/errors.d.ts +20 -4
- package/dist/lib/errors.js +36 -16
- package/dist/lib/facade.d.ts +7 -29
- package/dist/lib/facade.js +7 -36
- package/dist/lib/failing-fe-resolver.d.ts +13 -58
- package/dist/lib/failing-fe-resolver.js +47 -132
- package/dist/lib/first-suite-hint.d.ts +16 -22
- package/dist/lib/first-suite-hint.js +38 -47
- package/dist/lib/gh-output.d.ts +76 -21
- package/dist/lib/gh-output.js +171 -90
- package/dist/lib/git-utils.d.ts +56 -0
- package/dist/lib/git-utils.js +212 -0
- package/dist/lib/github-context.d.ts +2 -0
- package/dist/lib/github-context.js +40 -8
- package/dist/lib/history-retention.d.ts +6 -2
- package/dist/lib/history-retention.js +10 -7
- package/dist/lib/http.d.ts +58 -134
- package/dist/lib/http.js +352 -289
- package/dist/lib/interrupt.d.ts +14 -8
- package/dist/lib/interrupt.js +28 -10
- package/dist/lib/junit-report.d.ts +57 -4
- package/dist/lib/junit-report.js +202 -32
- package/dist/lib/local-target.d.ts +3 -3
- package/dist/lib/local-target.js +3 -3
- package/dist/lib/output.d.ts +1 -40
- package/dist/lib/output.js +11 -49
- package/dist/lib/pagination.d.ts +2 -5
- package/dist/lib/pagination.js +2 -5
- package/dist/lib/presigned-url.d.ts +22 -0
- package/dist/lib/presigned-url.js +90 -0
- package/dist/lib/prompt.js +36 -2
- package/dist/lib/proxy.js +2 -1
- package/dist/lib/redact.d.ts +2 -2
- package/dist/lib/redact.js +3 -4
- package/dist/lib/removed-commands.d.ts +18 -0
- package/dist/lib/removed-commands.js +154 -0
- package/dist/lib/render-error.d.ts +31 -6
- package/dist/lib/render-error.js +88 -25
- package/dist/lib/response-schemas.d.ts +38 -30
- package/dist/lib/response-schemas.js +207 -207
- package/dist/lib/result/api.d.ts +24 -0
- package/dist/lib/result/api.js +28 -0
- package/dist/lib/result/evidence.d.ts +71 -0
- package/dist/lib/result/evidence.js +420 -0
- package/dist/lib/result/render.d.ts +20 -0
- package/dist/lib/result/render.js +194 -0
- package/dist/lib/result/types.d.ts +122 -0
- package/dist/lib/result/types.js +19 -0
- package/dist/lib/run-output.d.ts +275 -0
- package/dist/lib/run-output.js +227 -0
- package/dist/lib/run-render.d.ts +101 -0
- package/dist/lib/run-render.js +183 -0
- package/dist/lib/run-wait.d.ts +192 -0
- package/dist/lib/run-wait.js +452 -0
- package/dist/lib/runs.types.d.ts +118 -367
- package/dist/lib/runs.types.js +0 -14
- package/dist/lib/secret-file.d.ts +1 -1
- package/dist/lib/secret-file.js +11 -2
- package/dist/lib/skill-nudge.d.ts +7 -27
- package/dist/lib/skill-nudge.js +9 -37
- package/dist/lib/target-path.d.ts +15 -0
- package/dist/lib/target-path.js +35 -0
- package/dist/lib/target-url-advisory.d.ts +19 -0
- package/dist/lib/target-url-advisory.js +31 -0
- package/dist/lib/target-url-preflight.d.ts +9 -0
- package/dist/lib/target-url-preflight.js +214 -106
- package/dist/lib/target-url.d.ts +1 -1
- package/dist/lib/target-url.js +6 -16
- package/dist/lib/telemetry.d.ts +31 -11
- package/dist/lib/telemetry.js +37 -8
- package/dist/lib/terminal-text.d.ts +41 -0
- package/dist/lib/terminal-text.js +127 -0
- package/dist/lib/testlist.types.d.ts +16 -8
- package/dist/lib/testlist.types.js +1 -1
- package/dist/lib/text-equality.d.ts +2 -0
- package/dist/lib/text-equality.js +5 -0
- package/dist/lib/text-file.d.ts +16 -0
- package/dist/lib/text-file.js +41 -0
- package/dist/lib/text-table.d.ts +46 -0
- package/dist/lib/text-table.js +72 -4
- package/dist/lib/ticker.d.ts +9 -2
- package/dist/lib/ticker.js +16 -3
- package/dist/lib/transport-failure.d.ts +22 -0
- package/dist/lib/transport-failure.js +126 -0
- package/dist/lib/tunnel-session.d.ts +7 -1
- package/dist/lib/tunnel-session.js +22 -9
- package/dist/lib/update-check.js +3 -2
- package/dist/lib/url-template.d.ts +43 -0
- package/dist/lib/url-template.js +151 -0
- package/dist/lib/validate.d.ts +0 -64
- package/dist/lib/validate.js +2 -131
- package/dist/lib/version-notice.js +4 -3
- package/dist/lib/wait-exit.d.ts +37 -2
- package/dist/lib/wait-exit.js +88 -30
- package/dist/lib/workspace-status.js +10 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -3
- package/skills/testsprite-ci.skill.md +48 -18
- package/skills/testsprite-onboard.skill.md +66 -151
- package/skills/testsprite-verify.codex.md +50 -52
- package/skills/testsprite-verify.skill.md +184 -351
- package/dist/lib/browser.d.ts +0 -6
- package/dist/lib/browser.js +0 -54
- package/dist/lib/bundle.d.ts +0 -234
- package/dist/lib/bundle.js +0 -781
- package/dist/lib/deprecate.d.ts +0 -32
- package/dist/lib/deprecate.js +0 -39
- package/dist/lib/flaky.d.ts +0 -91
- package/dist/lib/flaky.js +0 -71
- package/dist/lib/plan-poll.d.ts +0 -171
- package/dist/lib/plan-poll.js +0 -441
- package/dist/lib/plans.types.d.ts +0 -130
- package/dist/lib/plans.types.js +0 -31
- package/dist/lib/poll.d.ts +0 -100
- package/dist/lib/poll.js +0 -290
- package/dist/lib/rate-throttle.d.ts +0 -49
- package/dist/lib/rate-throttle.js +0 -75
- package/dist/lib/run-progress.d.ts +0 -41
- package/dist/lib/run-progress.js +0 -56
- package/dist/lib/v3-advisory.d.ts +0 -55
- package/dist/lib/v3-advisory.js +0 -74
- package/schemas/plan.schema.json +0 -61
|
@@ -3,8 +3,8 @@ import { type ShutdownHandle } from './interrupt.js';
|
|
|
3
3
|
import { openTunnelSession, type TunnelClientHandle } from './tunnel-session.js';
|
|
4
4
|
import { type TunnelClientOptions } from '../vendor/tunnel-client/index.js';
|
|
5
5
|
import type { HttpClient } from './http.js';
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
6
|
+
import type { RunWaitSnapshot } from './run-wait.js';
|
|
7
|
+
import type { CliTestListRunResponse } from './testlist.types.js';
|
|
8
8
|
import { ApiError } from './errors.js';
|
|
9
9
|
import { type LoopbackHost, type StoredLocalTarget } from './local-target.js';
|
|
10
10
|
export interface RunTargetTest {
|
|
@@ -48,7 +48,6 @@ export declare function resolveEnvironmentRunTarget(args: {
|
|
|
48
48
|
stderr: (line: string) => void;
|
|
49
49
|
cache?: Map<string, Environment[] | undefined>;
|
|
50
50
|
}): Promise<ResolvedRunTarget | undefined>;
|
|
51
|
-
export declare function tunnelScopeError(err: unknown): unknown;
|
|
52
51
|
export declare function unsupportedTunnelError(command: string): ApiError;
|
|
53
52
|
export interface EnvironmentTunnelContext {
|
|
54
53
|
client: HttpClient;
|
|
@@ -57,47 +56,36 @@ export interface EnvironmentTunnelContext {
|
|
|
57
56
|
maxConcurrency: number;
|
|
58
57
|
deadlineMs: number;
|
|
59
58
|
session: Awaited<ReturnType<typeof openTunnelSession>>;
|
|
60
|
-
cancellation: (runId: string) => 'cancelled' | 'cancel-failed' | undefined;
|
|
59
|
+
cancellation: (runId: string) => 'cancelled' | 'cancel-failed' | 'already-terminal' | undefined;
|
|
60
|
+
cancelActive: () => Promise<void>;
|
|
61
61
|
skipped?: Array<{
|
|
62
62
|
testId: string;
|
|
63
63
|
reason: 'backend-test';
|
|
64
64
|
}>;
|
|
65
|
-
|
|
66
|
-
waitForCapacity: (incoming: number) => Promise<void>;
|
|
65
|
+
resultStatus: (resultId: string) => string | undefined;
|
|
67
66
|
confirm: (response: {
|
|
68
67
|
tunnelClientId?: string;
|
|
69
68
|
}, runIds: string[], requireEcho?: boolean) => Promise<void>;
|
|
70
|
-
|
|
71
|
-
runId: string;
|
|
72
|
-
status: string;
|
|
73
|
-
}) => void;
|
|
69
|
+
onRead: (snapshot: RunWaitSnapshot, signal: AbortSignal) => Promise<void>;
|
|
74
70
|
}
|
|
75
|
-
/**
|
|
71
|
+
/** Own tunnel lifecycle and executions, without a client-side dispatch capacity loop. */
|
|
76
72
|
export declare function withEnvironmentTunnel<T>(opts: CommonOptions & {
|
|
77
73
|
skipPreflight?: boolean;
|
|
78
74
|
maxConcurrency?: number;
|
|
79
75
|
timeoutSeconds?: number;
|
|
76
|
+
tunnelClientId?: string;
|
|
77
|
+
cancelOnInterrupt?: boolean;
|
|
80
78
|
}, deps: ClientFactoryDeps & {
|
|
81
79
|
shutdown?: ShutdownHandle;
|
|
82
80
|
createTunnelClient?: (options: TunnelClientOptions) => TunnelClientHandle;
|
|
83
81
|
sleep?: (ms: number) => Promise<void>;
|
|
84
82
|
}, targets: ResolvedRunTarget[], command: string, operation: (context: EnvironmentTunnelContext) => Promise<T>): Promise<T>;
|
|
85
83
|
/** Keep each dispatch on one verbatim loopback URL; public runs omit tunnel fields. */
|
|
86
|
-
export declare function groupEnvironmentTargets(ids: string[], targets: ReadonlyMap<string,
|
|
84
|
+
export declare function groupEnvironmentTargets(ids: string[], targets: ReadonlyMap<string, {
|
|
85
|
+
targetUrl: string;
|
|
86
|
+
}>): string[][];
|
|
87
87
|
export declare function quoteEnvironmentName(name: string): string;
|
|
88
|
-
export declare function emitEnvironmentDispatchPartial(responses:
|
|
89
|
-
accepted: Array<{
|
|
90
|
-
testId: string;
|
|
91
|
-
runId: string;
|
|
92
|
-
}>;
|
|
93
|
-
conflicts: Array<{
|
|
94
|
-
testId: string;
|
|
95
|
-
}>;
|
|
96
|
-
deferred: Array<{
|
|
97
|
-
testId: string;
|
|
98
|
-
}>;
|
|
99
|
-
notFound?: string[];
|
|
100
|
-
}>, testIds: string[], opts: CommonOptions & {
|
|
88
|
+
export declare function emitEnvironmentDispatchPartial(responses: readonly CliTestListRunResponse[], testIds: string[], opts: CommonOptions & {
|
|
101
89
|
report?: 'junit';
|
|
102
90
|
reportFile?: string;
|
|
103
91
|
reportSuiteName?: string;
|
|
@@ -105,6 +93,7 @@ export declare function emitEnvironmentDispatchPartial(responses: Array<{
|
|
|
105
93
|
summaryFile?: string;
|
|
106
94
|
}, deps: ClientFactoryDeps & {
|
|
107
95
|
stdout?: (line: string) => void;
|
|
108
|
-
|
|
109
|
-
|
|
96
|
+
}, label: string, error: unknown, context: EnvironmentTunnelContext,
|
|
97
|
+
/** The reason a `notFound` id was not dispatched (`run --testlist`: not a member of the list). */
|
|
98
|
+
notFoundNote?: string): Promise<void>;
|
|
110
99
|
export {};
|
|
@@ -1,22 +1,41 @@
|
|
|
1
|
+
import { isProxyAgentActive } from './proxy.js';
|
|
1
2
|
import { makeHttpClient, resolveRequestTimeoutMs, } from './client-factory.js';
|
|
2
3
|
import { globalShutdown } from './interrupt.js';
|
|
3
|
-
import { openTunnelSession, TunnelLostError } from './tunnel-session.js';
|
|
4
|
+
import { TUNNEL_DATA_PLANE_PROXY_BYPASS_DESCRIPTION, openTunnelSession, TunnelLostError, } from './tunnel-session.js';
|
|
4
5
|
import { TunnelClient } from '../vendor/tunnel-client/index.js';
|
|
5
6
|
import { assertLocalPortListening } from './local-target.js';
|
|
6
|
-
import { recordTelemetryTunnelOpened } from './telemetry.js';
|
|
7
|
+
import { recordTelemetryExtras, recordTelemetryTunnelOpened } from './telemetry.js';
|
|
7
8
|
import { Output } from './output.js';
|
|
8
|
-
import { emitCiArtifacts,
|
|
9
|
-
import { buildJUnitReport, writeJUnitReportFile } from './junit-report.js';
|
|
10
|
-
import {
|
|
9
|
+
import { emitCiArtifacts, isNonDispatchedStatus } from './gh-output.js';
|
|
10
|
+
import { buildJUnitReport, skippedRowFromSummary, writeJUnitReportFile } from './junit-report.js';
|
|
11
|
+
import { launchIds } from './run-render.js';
|
|
12
|
+
import { buildRunOutput, listResultReceipt, renderRunResults } from './run-output.js';
|
|
11
13
|
import { ApiError, InterruptError, RequestTimeoutError, localValidationError } from './errors.js';
|
|
12
14
|
import { buildLocalTargetUrl, DEFAULT_LOCAL_HOST, parseLoopbackTargetUrl, } from './local-target.js';
|
|
15
|
+
import { terminalSafeLine, terminalSafeWriter } from './terminal-text.js';
|
|
13
16
|
export const ENVIRONMENT_PREFLIGHT_TIMEOUT_MS = 5_000;
|
|
14
17
|
/** Advisory-only reads must not inherit the run's long wait or retry budget. */
|
|
15
18
|
export function readEnvironmentPreflight(client, path) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
// Abort with a RequestTimeoutError as the reason, not AbortSignal.timeout's
|
|
20
|
+
// raw DOMException: HttpClient passes a RequestTimeoutError through
|
|
21
|
+
// untouched, so a stalled preflight read surfaces as REQUEST_TIMEOUT
|
|
22
|
+
// (exit 7) instead of reaching the top-level catch as an uncaught
|
|
23
|
+
// exception. The 5s deadline here is fixed — --request-timeout does not
|
|
24
|
+
// govern it — so the message and nextAction name the preflight read
|
|
25
|
+
// rather than pointing at the flag.
|
|
26
|
+
const controller = new AbortController();
|
|
27
|
+
const timer = setTimeout(() => {
|
|
28
|
+
controller.abort(new RequestTimeoutError(ENVIRONMENT_PREFLIGHT_TIMEOUT_MS, 'local', {
|
|
29
|
+
message: `Environment preflight read timed out after ` +
|
|
30
|
+
`${ENVIRONMENT_PREFLIGHT_TIMEOUT_MS / 1000}s (client-side).`,
|
|
31
|
+
nextAction: 'The environment preflight read timed out. ' +
|
|
32
|
+
'Check that the backend is reachable and not overloaded, then retry.',
|
|
33
|
+
}));
|
|
34
|
+
}, ENVIRONMENT_PREFLIGHT_TIMEOUT_MS);
|
|
35
|
+
timer.unref?.();
|
|
36
|
+
return client
|
|
37
|
+
.get(path, { retry: false, signal: controller.signal })
|
|
38
|
+
.finally(() => clearTimeout(timer));
|
|
20
39
|
}
|
|
21
40
|
export function assertNoTunnelOptions(args) {
|
|
22
41
|
if (args.tunnelClientId !== undefined)
|
|
@@ -60,7 +79,7 @@ export async function resolveEnvironmentRunTarget(args) {
|
|
|
60
79
|
}
|
|
61
80
|
if (test?.type === 'backend' && !args.includeBackend) {
|
|
62
81
|
if (explicit)
|
|
63
|
-
throw localValidationError('local', `backend tests don't open a browser; the tunnel is not used. Run: testsprite
|
|
82
|
+
throw localValidationError('local', `backend tests don't open a browser; the tunnel is not used. Run: testsprite run ${args.testId}`);
|
|
64
83
|
return undefined;
|
|
65
84
|
}
|
|
66
85
|
const projectId = test?.projectId ?? args.projectId;
|
|
@@ -113,7 +132,7 @@ export async function resolveEnvironmentRunTarget(args) {
|
|
|
113
132
|
};
|
|
114
133
|
const explicitTarget = (target) => {
|
|
115
134
|
if (args.environment !== undefined && selected && !localOf(selected))
|
|
116
|
-
announce(`sign-in:${projectId}:${selected.name}:${target.targetUrl}`, `Using environment "${selected.name}" sign-in against ${target.targetUrl} through a tunnel.`);
|
|
135
|
+
announce(`sign-in:${projectId}:${selected.name}:${target.targetUrl}`, `Using environment "${terminalSafeLine(selected.name)}" sign-in against ${terminalSafeLine(target.targetUrl)} through a tunnel.`);
|
|
117
136
|
return target;
|
|
118
137
|
};
|
|
119
138
|
if (explicitUrl)
|
|
@@ -143,8 +162,8 @@ export async function resolveEnvironmentRunTarget(args) {
|
|
|
143
162
|
if (!args.tunnelClientId && test?.type !== 'backend') {
|
|
144
163
|
const key = `${projectId}:${selected.name}:${selected.url}`;
|
|
145
164
|
announce(key, args.dryRun
|
|
146
|
-
? `Would open a tunnel to ${selected.url} (environment "${selected.name}").`
|
|
147
|
-
: `Environment "${selected.name}" is on this machine (${selected.url}) — opening a tunnel.`);
|
|
165
|
+
? `Would open a tunnel to ${terminalSafeLine(selected.url)} (environment "${terminalSafeLine(selected.name)}").`
|
|
166
|
+
: `Environment "${terminalSafeLine(selected.name)}" is on this machine (${terminalSafeLine(selected.url)}) — opening a tunnel.`);
|
|
148
167
|
}
|
|
149
168
|
return {
|
|
150
169
|
...local,
|
|
@@ -153,30 +172,22 @@ export async function resolveEnvironmentRunTarget(args) {
|
|
|
153
172
|
environmentName: selected.name,
|
|
154
173
|
};
|
|
155
174
|
}
|
|
156
|
-
export function tunnelScopeError(err) {
|
|
157
|
-
if (!(err instanceof ApiError) || err.httpStatus !== 403)
|
|
158
|
-
return err;
|
|
159
|
-
return new ApiError({
|
|
160
|
-
code: err.code,
|
|
161
|
-
message: err.message,
|
|
162
|
-
requestId: err.requestId,
|
|
163
|
-
details: err.details,
|
|
164
|
-
nextAction: `${err.nextAction ?? ''} A tunnel is required for this environment; use an API key with run:tunnel permission.`,
|
|
165
|
-
}, err.httpStatus);
|
|
166
|
-
}
|
|
167
175
|
export function unsupportedTunnelError(command) {
|
|
168
176
|
return new ApiError({
|
|
169
177
|
code: 'UNSUPPORTED',
|
|
170
178
|
message: `This server did not confirm tunnel use for ${command}. Cancellation was attempted for the started runs; no tunnel-free result can be trusted.`,
|
|
171
|
-
nextAction: 'Update the server, or use testsprite
|
|
179
|
+
nextAction: 'Update the server, or use testsprite run <id> with the saved environment.',
|
|
172
180
|
requestId: 'local',
|
|
173
181
|
details: {},
|
|
174
182
|
});
|
|
175
183
|
}
|
|
176
|
-
/**
|
|
184
|
+
/** Own tunnel lifecycle and executions, without a client-side dispatch capacity loop. */
|
|
177
185
|
export async function withEnvironmentTunnel(opts, deps, targets, command, operation) {
|
|
178
|
-
const stderr = deps.stderr
|
|
186
|
+
const stderr = terminalSafeWriter(deps.stderr);
|
|
179
187
|
const shutdown = deps.shutdown ?? globalShutdown;
|
|
188
|
+
if (isProxyAgentActive())
|
|
189
|
+
stderr(`[advisory] An HTTP proxy is configured for this process. The tunnel control channel honours it, but ${TUNNEL_DATA_PLANE_PROXY_BYPASS_DESCRIPTION} — if the run cannot reach your machine, an egress proxy is the first thing to rule out.`);
|
|
190
|
+
recordTelemetryExtras({ localConcurrencyLimit: opts.maxConcurrency ?? 5 });
|
|
180
191
|
const seen = new Set();
|
|
181
192
|
for (const target of targets) {
|
|
182
193
|
if (seen.has(target.targetUrl))
|
|
@@ -198,130 +209,113 @@ export async function withEnvironmentTunnel(opts, deps, targets, command, operat
|
|
|
198
209
|
};
|
|
199
210
|
const cleanup = (operation) => request(10_000, operation);
|
|
200
211
|
const client = makeHttpClient(opts, { ...deps, shutdownSignal: shutdown.signal, shutdown });
|
|
212
|
+
const livenessClient = makeHttpClient({ ...opts, debug: false, verbose: false }, { ...deps, shutdownSignal: shutdown.signal, shutdown });
|
|
201
213
|
const active = new Set();
|
|
202
|
-
const
|
|
203
|
-
const getRun = client.getRun.bind(client);
|
|
204
|
-
client.getRun = async (runId, options) => {
|
|
205
|
-
const cached = terminalRuns.get(runId);
|
|
206
|
-
if (cached)
|
|
207
|
-
return cached;
|
|
208
|
-
const run = await getRun(runId, options);
|
|
209
|
-
if (isTerminalStatus(run.status))
|
|
210
|
-
terminalRuns.set(runId, run);
|
|
211
|
-
return run;
|
|
212
|
-
};
|
|
214
|
+
const statuses = new Map();
|
|
213
215
|
const cancellations = new Map();
|
|
214
216
|
let failure;
|
|
215
|
-
let
|
|
216
|
-
|
|
217
|
+
let session;
|
|
218
|
+
let ownerGone = false;
|
|
219
|
+
let lastLivenessRead = -Infinity;
|
|
220
|
+
const cancel = async (force = false) => {
|
|
221
|
+
if (!force && (opts.cancelOnInterrupt === false || (session?.adopted && !ownerGone)))
|
|
222
|
+
return;
|
|
217
223
|
for (const runId of active) {
|
|
218
224
|
try {
|
|
219
|
-
await cleanup(transport => transport.cancelRun(runId));
|
|
220
|
-
cancellations.set(runId, 'cancelled');
|
|
221
|
-
stderr(
|
|
225
|
+
const cancelled = await cleanup(transport => transport.cancelRun(runId));
|
|
226
|
+
cancellations.set(runId, cancelled.alreadyFinished ? 'already-terminal' : 'cancelled');
|
|
227
|
+
stderr(cancelled.alreadyFinished
|
|
228
|
+
? `[tunnel] Run ${terminalSafeLine(runId)} had already finished; no cancellation was needed.`
|
|
229
|
+
: `[tunnel] Cancellation requested for run ${terminalSafeLine(runId)}; its tunnel is closing.`);
|
|
230
|
+
for (const result of cancelled.results)
|
|
231
|
+
if (result.refund?.status === 'failed')
|
|
232
|
+
stderr(`[tunnel] Refund failed for result ${terminalSafeLine(result.resultId)}: inspect the cancellation response or contact support.`);
|
|
222
233
|
}
|
|
223
234
|
catch (err) {
|
|
224
|
-
cancellations.set(runId, 'failed');
|
|
225
|
-
stderr(`[tunnel] Could not cancel ${runId}: ${err instanceof Error ? err.message : String(err)}. Use testsprite
|
|
235
|
+
cancellations.set(runId, 'cancel-failed');
|
|
236
|
+
stderr(`[tunnel] Could not cancel run ${terminalSafeLine(runId)}: ${terminalSafeLine(err instanceof Error ? err.message : String(err))}. Use testsprite run cancel ${terminalSafeLine(runId)}.`);
|
|
226
237
|
}
|
|
227
238
|
active.delete(runId);
|
|
228
239
|
}
|
|
229
240
|
};
|
|
230
241
|
const disarm = shutdown.arm();
|
|
231
|
-
let session;
|
|
232
242
|
try {
|
|
233
243
|
try {
|
|
234
|
-
session = await openTunnelSession({
|
|
244
|
+
session = await openTunnelSession({
|
|
245
|
+
log: stderr,
|
|
246
|
+
onMinted: ({ clientId }) => stderr(`[tunnel] Minted tunnel client ${terminalSafeLine(clientId)}`),
|
|
247
|
+
logLevel: opts.debug ? 'debug' : opts.verbose ? 'info' : 'error',
|
|
248
|
+
...(opts.tunnelClientId
|
|
249
|
+
? { adopt: { clientId: opts.tunnelClientId, expiresAt: '' } }
|
|
250
|
+
: {}),
|
|
251
|
+
}, {
|
|
235
252
|
mint: ttlSeconds => request(requestTimeoutMs, transport => transport.mintTunnel({ ...(ttlSeconds ? { ttlSeconds } : {}) })),
|
|
236
253
|
destroy: clientId => cleanup(transport => transport.deleteTunnel(clientId)),
|
|
237
254
|
createClient: shutdownAwareTunnelClient(deps.createTunnelClient ?? (options => new TunnelClient(options)), shutdown.signal),
|
|
238
255
|
});
|
|
239
256
|
}
|
|
240
257
|
catch (err) {
|
|
241
|
-
|
|
258
|
+
if (shutdown.signal.aborted)
|
|
259
|
+
throw shutdown.signal.reason;
|
|
260
|
+
throw err;
|
|
242
261
|
}
|
|
243
|
-
recordTelemetryTunnelOpened(
|
|
244
|
-
|
|
245
|
-
throw shutdown.signal.reason;
|
|
246
|
-
const checkDispatch = () => {
|
|
262
|
+
recordTelemetryTunnelOpened(!session.adopted);
|
|
263
|
+
const dispatch = (operation) => {
|
|
247
264
|
if (shutdown.signal.aborted)
|
|
248
265
|
throw shutdown.signal.reason;
|
|
249
266
|
if (session.fatalReason())
|
|
250
|
-
throw new TunnelLostError(session.fatalReason(),
|
|
251
|
-
|
|
252
|
-
// Retain a charged response across the first interrupt, with a total retry deadline.
|
|
253
|
-
const dispatch = (operation) => {
|
|
254
|
-
checkDispatch();
|
|
267
|
+
throw new TunnelLostError(session.fatalReason(), {}, session.fatalMessage());
|
|
268
|
+
// Keep the response across the first interrupt so its owned run can be cancelled.
|
|
255
269
|
return request(requestTimeoutMs, operation);
|
|
256
270
|
};
|
|
257
|
-
client.
|
|
258
|
-
client.triggerBatchRerun = (...args) => dispatch(transport => transport.triggerBatchRerun(...args));
|
|
271
|
+
client.triggerProjectRun = (...args) => dispatch(transport => transport.triggerProjectRun(...args));
|
|
259
272
|
client.triggerTestListRun = (...args) => dispatch(transport => transport.triggerTestListRun(...args));
|
|
260
|
-
|
|
261
|
-
const deadlineMs = Date.now() + (opts.timeoutSeconds ?? 600) * 1000;
|
|
262
|
-
const assertCapacityDeadline = () => {
|
|
263
|
-
if (Date.now() >= deadlineMs)
|
|
264
|
-
throw new ApiError({
|
|
265
|
-
code: 'UNSUPPORTED',
|
|
266
|
-
message: `Timed out after ${opts.timeoutSeconds ?? 600}s waiting for tunnel batch capacity.`,
|
|
267
|
-
nextAction: 'The owned tunnel is closing; inspect cancellation with testsprite test cancel <run-id>.',
|
|
268
|
-
requestId: 'local',
|
|
269
|
-
details: {},
|
|
270
|
-
});
|
|
271
|
-
};
|
|
272
|
-
context = {
|
|
273
|
+
return await operation({
|
|
273
274
|
client,
|
|
274
275
|
session,
|
|
275
|
-
deadlineMs,
|
|
276
|
-
cancellation: id => {
|
|
277
|
-
const outcome = cancellations.get(id);
|
|
278
|
-
return outcome === 'failed' ? 'cancel-failed' : outcome;
|
|
279
|
-
},
|
|
280
276
|
clientId: session.clientId,
|
|
281
277
|
maxConcurrency: opts.maxConcurrency ?? 5,
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
278
|
+
deadlineMs: Date.now() + (opts.timeoutSeconds ?? 600) * 1000,
|
|
279
|
+
cancellation: runId => cancellations.get(runId),
|
|
280
|
+
cancelActive: () => cancel(),
|
|
281
|
+
resultStatus: resultId => statuses.get(resultId),
|
|
282
|
+
confirm: async (response, runIds, requireEcho = true) => {
|
|
283
|
+
for (const runId of runIds)
|
|
284
|
+
active.add(runId);
|
|
285
|
+
if (requireEcho && runIds.length > 0 && response.tunnelClientId !== session.clientId) {
|
|
286
|
+
await cancel(true);
|
|
287
|
+
throw unsupportedTunnelError(command);
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
onRead: async ({ run, results }, signal) => {
|
|
291
|
+
for (const result of results)
|
|
292
|
+
statuses.set(result.resultId, result.testStatus.toLowerCase());
|
|
293
|
+
if (run.status === 'finished') {
|
|
294
|
+
active.delete(run.runId);
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
if (!active.has(run.runId))
|
|
298
|
+
return;
|
|
299
|
+
const fatal = session.fatalReason();
|
|
300
|
+
if (fatal)
|
|
301
|
+
throw new TunnelLostError(fatal, { runId: run.runId }, session.fatalMessage());
|
|
302
|
+
if (session.adopted && Date.now() - lastLivenessRead >= 15_000) {
|
|
303
|
+
lastLivenessRead = Date.now();
|
|
287
304
|
try {
|
|
288
|
-
await
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
sleep: deps.sleep,
|
|
292
|
-
onTick: run => context.onPoll(run),
|
|
305
|
+
const observed = await livenessClient.getTunnelStatus(session.clientId, {
|
|
306
|
+
signal,
|
|
307
|
+
retry: false,
|
|
293
308
|
});
|
|
309
|
+
ownerGone = observed.status.toLowerCase() === 'offline';
|
|
294
310
|
}
|
|
295
311
|
catch (err) {
|
|
296
|
-
|
|
297
|
-
throw err;
|
|
298
|
-
throw new ApiError({
|
|
299
|
-
code: 'UNSUPPORTED',
|
|
300
|
-
message: err.message,
|
|
301
|
-
nextAction: `The owned tunnel is closing; inspect cancellation with testsprite test cancel ${runId}.`,
|
|
302
|
-
requestId: 'local',
|
|
303
|
-
details: { runId },
|
|
304
|
-
});
|
|
312
|
+
ownerGone = err instanceof ApiError && err.httpStatus === 404;
|
|
305
313
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
},
|
|
309
|
-
confirm: async (response, runIds, requireEcho = true) => {
|
|
310
|
-
for (const id of runIds)
|
|
311
|
-
active.add(id);
|
|
312
|
-
if (requireEcho && runIds.length && response.tunnelClientId !== session.clientId) {
|
|
313
|
-
await cancel();
|
|
314
|
-
throw unsupportedTunnelError(command);
|
|
314
|
+
if (ownerGone)
|
|
315
|
+
throw new TunnelLostError('owner-gone', { runId: run.runId });
|
|
315
316
|
}
|
|
316
317
|
},
|
|
317
|
-
|
|
318
|
-
if (['passed', 'failed', 'blocked', 'cancelled'].includes(run.status))
|
|
319
|
-
active.delete(run.runId);
|
|
320
|
-
else if (active.has(run.runId) && session.fatalReason())
|
|
321
|
-
throw new TunnelLostError(session.fatalReason(), run.runId, session.fatalMessage());
|
|
322
|
-
},
|
|
323
|
-
};
|
|
324
|
-
return await operation(context);
|
|
318
|
+
});
|
|
325
319
|
}
|
|
326
320
|
catch (err) {
|
|
327
321
|
failure = err;
|
|
@@ -330,18 +324,18 @@ export async function withEnvironmentTunnel(opts, deps, targets, command, operat
|
|
|
330
324
|
finally {
|
|
331
325
|
const closing = [...active];
|
|
332
326
|
await cancel();
|
|
333
|
-
if (failure instanceof InterruptError && closing.length) {
|
|
334
|
-
const
|
|
335
|
-
const
|
|
336
|
-
? '
|
|
337
|
-
: '
|
|
338
|
-
const retry = [...(context?.targets ?? [])]
|
|
339
|
-
.map(([id, target]) => `testsprite test run ${id}${target.environmentName ? ` --env ${quoteEnvironmentName(target.environmentName)}` : ''}`)
|
|
340
|
-
.join('; ') || 'testsprite test run <id>';
|
|
341
|
-
const nextAction = `The owned tunnel is closing; cancellation was ${cancelOutcome === 'cancelled' ? 'requested' : 'attempted'} for ${closing.join(' ')}. Inspect with testsprite test cancel ${closing.join(' ')}. Start a new run with ${retry}.`;
|
|
327
|
+
if (failure instanceof InterruptError && closing.length && (!session?.adopted || ownerGone)) {
|
|
328
|
+
const cancelled = closing.every(id => cancellations.get(id) === 'cancelled');
|
|
329
|
+
const nextAction = cancelled
|
|
330
|
+
? `The owned tunnel closed; cancellation was requested for runs ${closing.join(' ')}. Start a new run to test the local target again.`
|
|
331
|
+
: `The owned tunnel closed; cancellation was not confirmed. Stop the runs with testsprite run cancel ${closing.join(' ')}.`;
|
|
342
332
|
Object.assign(failure, {
|
|
343
333
|
runWaitContext: true,
|
|
344
|
-
tunnelDetach: {
|
|
334
|
+
tunnelDetach: {
|
|
335
|
+
runId: closing[0],
|
|
336
|
+
cancel: cancelled ? 'cancelled' : opts.cancelOnInterrupt === false ? 'skipped' : 'failed',
|
|
337
|
+
nextAction,
|
|
338
|
+
},
|
|
345
339
|
});
|
|
346
340
|
}
|
|
347
341
|
try {
|
|
@@ -379,7 +373,7 @@ function shutdownAwareTunnelClient(create, signal) {
|
|
|
379
373
|
};
|
|
380
374
|
}
|
|
381
375
|
/** Keep each dispatch on one verbatim loopback URL; public runs omit tunnel fields. */
|
|
382
|
-
export function groupEnvironmentTargets(ids, targets
|
|
376
|
+
export function groupEnvironmentTargets(ids, targets) {
|
|
383
377
|
const groups = new Map();
|
|
384
378
|
for (const id of ids) {
|
|
385
379
|
const key = targets.get(id)?.targetUrl;
|
|
@@ -387,28 +381,24 @@ export function groupEnvironmentTargets(ids, targets, maxLocalGroupSize = Infini
|
|
|
387
381
|
group.push(id);
|
|
388
382
|
groups.set(key, group);
|
|
389
383
|
}
|
|
390
|
-
return [...groups.values()]
|
|
391
|
-
if (!targets.has(group[0]) || !Number.isFinite(maxLocalGroupSize))
|
|
392
|
-
return [group];
|
|
393
|
-
const chunks = [];
|
|
394
|
-
for (let index = 0; index < group.length; index += maxLocalGroupSize)
|
|
395
|
-
chunks.push(group.slice(index, index + maxLocalGroupSize));
|
|
396
|
-
return chunks;
|
|
397
|
-
});
|
|
384
|
+
return [...groups.values()];
|
|
398
385
|
}
|
|
399
386
|
export function quoteEnvironmentName(name) {
|
|
400
387
|
return "'" + name.replaceAll("'", "'\\''") + "'";
|
|
401
388
|
}
|
|
402
|
-
export async function emitEnvironmentDispatchPartial(responses, testIds, opts, deps, label, error, context
|
|
389
|
+
export async function emitEnvironmentDispatchPartial(responses, testIds, opts, deps, label, error, context,
|
|
390
|
+
/** The reason a `notFound` id was not dispatched (`run --testlist`: not a member of the list). */
|
|
391
|
+
notFoundNote) {
|
|
403
392
|
const message = error instanceof Error ? error.message : String(error);
|
|
404
393
|
const timedOut = error instanceof RequestTimeoutError ||
|
|
405
394
|
(error instanceof ApiError && error.code === 'UNSUPPORTED' && message.startsWith('Timed out'));
|
|
406
395
|
const accepted = responses
|
|
407
396
|
.flatMap(response => response.accepted)
|
|
397
|
+
.map(listResultReceipt)
|
|
408
398
|
.map(row => ({
|
|
409
399
|
...row,
|
|
410
|
-
status: context.cancellation(row.runId) ??
|
|
411
|
-
context.
|
|
400
|
+
status: (row.runId ? context.cancellation(row.runId) : undefined) ??
|
|
401
|
+
context.resultStatus(row.resultId) ??
|
|
412
402
|
(timedOut ? 'timeout' : 'running'),
|
|
413
403
|
}));
|
|
414
404
|
const conflicts = responses.flatMap(response => response.conflicts);
|
|
@@ -418,24 +408,34 @@ export async function emitEnvironmentDispatchPartial(responses, testIds, opts, d
|
|
|
418
408
|
for (const id of notFound)
|
|
419
409
|
seen.add(id);
|
|
420
410
|
const notRunTestIds = testIds.filter(id => !seen.has(id));
|
|
421
|
-
const
|
|
422
|
-
accepted,
|
|
411
|
+
const buckets = {
|
|
423
412
|
conflicts,
|
|
424
413
|
deferred,
|
|
425
414
|
...(context.skipped?.length ? { skipped: context.skipped } : {}),
|
|
426
|
-
notRunTestIds,
|
|
427
415
|
...(responses.some(response => response.notFound) ? { notFound } : {}),
|
|
428
416
|
};
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
417
|
+
const { output, summary } = buildRunOutput({
|
|
418
|
+
receipts: launchIds(accepted).map(runId => ({ runId })),
|
|
419
|
+
dispatched: accepted,
|
|
420
|
+
wait: true,
|
|
421
|
+
failure: error,
|
|
422
|
+
requestTimedOut: timedOut,
|
|
423
|
+
incompleteDispatch: true,
|
|
424
|
+
cancellation: context.cancellation,
|
|
425
|
+
buckets: {
|
|
426
|
+
...buckets,
|
|
427
|
+
skipped: [
|
|
428
|
+
...(context.skipped ?? []),
|
|
429
|
+
...notRunTestIds.map(testId => ({
|
|
430
|
+
testId,
|
|
431
|
+
reason: 'not dispatched before the owned tunnel closed',
|
|
432
|
+
})),
|
|
433
|
+
],
|
|
434
|
+
},
|
|
435
|
+
notFoundNote,
|
|
436
|
+
});
|
|
437
|
+
const stderr = terminalSafeWriter(deps.stderr);
|
|
438
|
+
new Output(opts.output, { stdout: deps.stdout, stderr: deps.stderr }).print({ ...output, ...buckets, notRunTestIds }, () => renderRunResults(output.runs, output.results, summary));
|
|
439
439
|
emitCiArtifacts(summary, opts, {
|
|
440
440
|
env: deps.env ?? process.env,
|
|
441
441
|
stdout: deps.stdout ?? (line => process.stdout.write(`${line}\n`)),
|
|
@@ -446,12 +446,19 @@ export async function emitEnvironmentDispatchPartial(responses, testIds, opts, d
|
|
|
446
446
|
await writeJUnitReportFile(opts.reportFile, buildJUnitReport({
|
|
447
447
|
suiteName: opts.reportSuiteName ?? `testsprite:${label}`,
|
|
448
448
|
classname: label,
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
449
|
+
// A test that never dispatched is skipped with its own reason. A
|
|
450
|
+
// dispatched one keeps the status it reached (running, timeout, a
|
|
451
|
+
// verdict) and names the error that closed the tunnel, which is why
|
|
452
|
+
// this is not `junitRowsFromSummary`.
|
|
453
|
+
results: summary.results.map(row => isNonDispatchedStatus(row.status)
|
|
454
|
+
? skippedRowFromSummary(row)
|
|
455
|
+
: {
|
|
456
|
+
testId: row.testId ?? row.resultId ?? '(unknown)',
|
|
457
|
+
resultId: row.resultId,
|
|
458
|
+
runId: row.runId,
|
|
459
|
+
status: row.status,
|
|
460
|
+
error: { code: error instanceof ApiError ? error.code : 'UNSUPPORTED', message },
|
|
461
|
+
}),
|
|
455
462
|
}));
|
|
456
463
|
}
|
|
457
464
|
catch (err) {
|
package/dist/lib/errors.d.ts
CHANGED
|
@@ -168,13 +168,19 @@ export declare class ApiError extends CLIError {
|
|
|
168
168
|
* (e.g. `'... Remove --target-url.'`), and unconditionally appending a
|
|
169
169
|
* second period produced a doubled `..` at the end of the rendered message.
|
|
170
170
|
*/
|
|
171
|
-
export declare function localValidationError(field: string, reason: string, accepted?: unknown, kind?: 'flag' | 'field'): ApiError;
|
|
171
|
+
export declare function localValidationError(field: string, reason: string, accepted?: unknown, kind?: 'flag' | 'field' | 'argument'): ApiError;
|
|
172
|
+
export interface TransportErrorOptions {
|
|
173
|
+
/** Cause-specific remediation; defaults to the generic availability text. */
|
|
174
|
+
nextAction?: string;
|
|
175
|
+
/** Machine-readable cause, e.g. `{ cause: 'SELF_SIGNED_CERT_IN_CHAIN' }`. */
|
|
176
|
+
details?: Record<string, unknown>;
|
|
177
|
+
}
|
|
172
178
|
/**
|
|
173
179
|
* Network/transport failure not associated with a server envelope. Treated
|
|
174
180
|
* as `UNAVAILABLE` for exit-code purposes per design §8.2.
|
|
175
181
|
*/
|
|
176
182
|
export declare class TransportError extends ApiError {
|
|
177
|
-
constructor(message: string, requestId?: string);
|
|
183
|
+
constructor(message: string, requestId?: string, options?: TransportErrorOptions);
|
|
178
184
|
}
|
|
179
185
|
/**
|
|
180
186
|
* Client-side per-request timeout. The fetch was aborted because the
|
|
@@ -184,11 +190,21 @@ export declare class TransportError extends ApiError {
|
|
|
184
190
|
* as `TimeoutError` from the polling path. Use `--request-timeout <s>` or
|
|
185
191
|
* `TESTSPRITE_REQUEST_TIMEOUT_MS` to extend the deadline when targeting a
|
|
186
192
|
* slow backend.
|
|
193
|
+
*
|
|
194
|
+
* A caller working against a fixed internal deadline the `--request-timeout`
|
|
195
|
+
* flag does not govern (e.g. the environment preflight read) passes
|
|
196
|
+
* `message` / `nextAction` overrides so the rendered guidance names that
|
|
197
|
+
* deadline instead of pointing at the flag.
|
|
187
198
|
*/
|
|
188
199
|
export declare class RequestTimeoutError extends CLIError {
|
|
189
200
|
readonly requestId: string;
|
|
190
201
|
readonly timeoutMs: number;
|
|
191
|
-
|
|
202
|
+
/** Caller-specific envelope guidance; unset keeps the generic advice. */
|
|
203
|
+
readonly nextAction?: string;
|
|
204
|
+
constructor(timeoutMs: number, requestId?: string, options?: {
|
|
205
|
+
message?: string;
|
|
206
|
+
nextAction?: string;
|
|
207
|
+
});
|
|
192
208
|
}
|
|
193
209
|
/**
|
|
194
210
|
* The synthesized `nextAction` for an INSUFFICIENT_CREDITS refusal when the
|
|
@@ -197,7 +213,7 @@ export declare class RequestTimeoutError extends CLIError {
|
|
|
197
213
|
* prod portals live on different domains); an unknown host gets the route only —
|
|
198
214
|
* a hardcoded domain would point at the wrong environment.
|
|
199
215
|
*
|
|
200
|
-
*
|
|
216
|
+
* API keys are membership-bound: a key minted for a team org spends THAT
|
|
201
217
|
* org's wallet, not the holder's personal one, and there is no request-scoped
|
|
202
218
|
* signal at this layer to tell which kind of key just failed. So the hint
|
|
203
219
|
* deliberately does NOT assert "top up your (personal) credits" as the only
|