@cnc-tools/storm 0.7.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/dist/build-info.js +1 -1
  2. package/dist/commands/exec/cleanup.d.ts +3 -3
  3. package/dist/commands/exec/cleanup.js +1 -1
  4. package/dist/commands/exec/command.d.ts +771 -1
  5. package/dist/commands/exec/command.js +1 -1
  6. package/dist/commands/exec/live-view.js +3 -2
  7. package/dist/commands/exec/metadata.d.ts +1 -1
  8. package/dist/commands/exec/metadata.js +4 -0
  9. package/dist/commands/exec/mint-failed.d.ts +28 -0
  10. package/dist/commands/exec/outcomes.d.ts +476 -0
  11. package/dist/commands/exec/progress.js +3 -5
  12. package/dist/commands/exec/run-command.d.ts +2 -2
  13. package/dist/commands/exec/run-metadata.d.ts +1 -1
  14. package/dist/commands/exec/run-metadata.js +1 -1
  15. package/dist/commands/exec/tests-summary.d.ts +1 -1
  16. package/dist/commands/exec/tests-summary.js +1 -1
  17. package/dist/commands/runs/facts.d.ts +2 -2
  18. package/dist/commands/runs/facts.js +1 -1
  19. package/dist/commands/runs/list/command.d.ts +129 -1
  20. package/dist/commands/runs/list/command.js +1 -1
  21. package/dist/commands/runs/list/outcomes.d.ts +16 -0
  22. package/dist/commands/runs/list/outcomes.js +1 -1
  23. package/dist/commands/runs/logs/command.d.ts +263 -1
  24. package/dist/commands/runs/logs/command.js +1 -1
  25. package/dist/commands/runs/logs/outcomes.d.ts +105 -0
  26. package/dist/commands/runs/logs/outcomes.js +1 -1
  27. package/dist/commands/runs/show/command.d.ts +329 -1
  28. package/dist/commands/runs/show/command.js +1 -1
  29. package/dist/commands/runs/show/outcomes.d.ts +71 -0
  30. package/dist/commands/runs/show/outcomes.js +3 -3
  31. package/dist/commands/vitest/command.d.ts +886 -1
  32. package/dist/commands/vitest/command.js +1 -1
  33. package/dist/commands/vitest/metadata.d.ts +1 -1
  34. package/dist/commands/vitest/metadata.js +4 -0
  35. package/dist/commands/vitest/outcomes.d.ts +295 -0
  36. package/dist/config/errors.d.ts +73 -0
  37. package/dist/config/schema.d.ts +1 -1
  38. package/dist/config-file/define.d.ts +4 -3
  39. package/dist/config-file/define.js +1 -1
  40. package/dist/config-file/toolchain.js +1 -1
  41. package/dist/core/command-slots.d.ts +8 -2
  42. package/dist/core/command-slots.js +6 -2
  43. package/dist/core/index.d.ts +1 -1
  44. package/dist/credential/index.d.ts +1 -0
  45. package/dist/credential/index.js +1 -0
  46. package/dist/credential/settle.d.ts +20 -0
  47. package/dist/credential/target.d.ts +6 -0
  48. package/dist/credential/target.js +7 -0
  49. package/dist/resources/github/command.d.ts +54 -2
  50. package/dist/resources/github/config.js +1 -1
  51. package/dist/resources/github/index.js +1 -1
  52. package/dist/resources/github/resource.js +2 -2
  53. package/dist/resources/testserver/command.d.ts +208 -10
  54. package/dist/resources/testserver/command.js +7 -0
  55. package/dist/resources/testserver/commands/create/command.d.ts +810 -1
  56. package/dist/resources/testserver/commands/create/command.js +73 -23
  57. package/dist/resources/testserver/commands/create/metadata.js +6 -2
  58. package/dist/resources/testserver/commands/create/outcomes.d.ts +347 -0
  59. package/dist/resources/testserver/commands/create/outcomes.js +14 -1
  60. package/dist/resources/testserver/commands/list/command.d.ts +84 -1
  61. package/dist/resources/testserver/commands/list/command.js +1 -1
  62. package/dist/resources/testserver/commands/list/outcomes.d.ts +16 -0
  63. package/dist/resources/testserver/config.js +14 -4
  64. package/dist/resources/testserver/events.d.ts +11 -0
  65. package/dist/resources/testserver/index.js +8 -7
  66. package/dist/resources/testserver/lane.js +1 -0
  67. package/dist/resources/testserver/live/gateways.d.ts +2 -0
  68. package/dist/resources/testserver/live/gateways.js +16 -3
  69. package/dist/resources/testserver/pool/channels.d.ts +5 -2
  70. package/dist/resources/testserver/pool/channels.js +1 -1
  71. package/dist/resources/testserver/pool/create.d.ts +9 -2
  72. package/dist/resources/testserver/pool/create.js +8 -5
  73. package/dist/resources/testserver/pool/gateways.d.ts +6 -0
  74. package/dist/resources/testserver/pool/index.d.ts +1 -0
  75. package/dist/resources/testserver/pool/index.js +1 -0
  76. package/dist/resources/testserver/pool/live/pool-records.js +6 -2
  77. package/dist/resources/testserver/pool/pull-request.d.ts +96 -0
  78. package/dist/resources/testserver/pool/pull-request.js +118 -0
  79. package/dist/resources/testserver/pr-build-facts.d.ts +130 -0
  80. package/dist/resources/testserver/pr-build-facts.js +261 -0
  81. package/dist/resources/testserver/presentation.d.ts +2 -2
  82. package/dist/resources/testserver/presentation.js +13 -3
  83. package/dist/resources/testserver/provider.d.ts +16 -6
  84. package/dist/resources/testserver/provider.js +55 -16
  85. package/dist/resources/testserver/pull-request/gateways.d.ts +117 -0
  86. package/dist/resources/testserver/pull-request/gateways.js +5 -0
  87. package/dist/resources/testserver/pull-request/index.d.ts +5 -0
  88. package/dist/resources/testserver/pull-request/index.js +6 -0
  89. package/dist/resources/testserver/pull-request/live/github-rest.d.ts +28 -0
  90. package/dist/resources/testserver/pull-request/live/github-rest.js +114 -0
  91. package/dist/resources/testserver/pull-request/live/github-token-gateway.d.ts +12 -0
  92. package/dist/resources/testserver/pull-request/live/github-token-gateway.js +39 -0
  93. package/dist/resources/testserver/pull-request/live/pull-request-gateway.d.ts +10 -0
  94. package/dist/resources/testserver/pull-request/live/pull-request-gateway.js +27 -0
  95. package/dist/resources/testserver/pull-request/live/testserver-workflow-gateway.d.ts +21 -0
  96. package/dist/resources/testserver/pull-request/live/testserver-workflow-gateway.js +64 -0
  97. package/dist/resources/testserver/ran.d.ts +5 -0
  98. package/dist/resources/testserver/ran.js +19 -3
  99. package/dist/resources/testserver/resource.d.ts +5 -1
  100. package/dist/resources/testserver/resource.js +2 -2
  101. package/dist/resources/testserver/sandbox/build-reference.d.ts +38 -0
  102. package/dist/resources/testserver/sandbox/build-reference.js +79 -0
  103. package/dist/resources/testserver/sandbox/index.d.ts +1 -0
  104. package/dist/resources/testserver/sandbox/index.js +1 -0
  105. package/dist/resources.d.ts +265 -15
  106. package/dist/sdk/index.js +2 -2
  107. package/dist/story/command-line.d.ts +34 -0
  108. package/dist/story/command-line.js +100 -0
  109. package/dist/story/index.d.ts +1 -0
  110. package/dist/story/index.js +3 -2
  111. package/dist/vercel-cli/context.js +1 -1
  112. package/dist/vercel-cli/index.js +1 -1
  113. package/dist/vitest/config.js +2 -2
  114. package/dist/vitest/fixtures.d.ts +1 -1
  115. package/dist/vitest/fixtures.js +1 -1
  116. package/dist/vitest/index.js +3 -3
  117. package/dist/vitest/plan.js +1 -1
  118. package/package.json +2 -3
  119. package/skills/overview.md +2 -0
  120. package/skills/testserver-builds.md +82 -0
@@ -5,7 +5,11 @@
5
5
  export interface TestserverPoolOptions {
6
6
  /** How many Testserver sandboxes a run gets: 1 to 32; 1 by default. */
7
7
  readonly sandboxes?: number;
8
- /** A build name, or the build channel `stable` or `latest_main`; `stable` by default. */
8
+ /**
9
+ * A build name, the build channel `stable` or `latest_main`, or a vercel/api pull request as `pr:<N>` or its URL
10
+ * (`https://github.com/vercel/api/pull/<N>`); `stable` by default. A pull request runs on the newest Testserver build
11
+ * made from its head commit, which storm reads from GitHub on the host, or the run refuses.
12
+ */
9
13
  readonly build?: string;
10
14
  /** The least time left a Testserver sandbox from the pool needs, such as `30m` or `2h`; `30m` by default. */
11
15
  readonly minTimeLeft?: string;
@@ -1,5 +1,5 @@
1
- // The Testserver pool resource's published surface, `@cnc-tools/storm/testserver`. A user's `storm.config.ts`
2
- // imports it, so, like `@cnc-tools/storm/config`, it imports nothing at run time: loading a config file pulls in no
1
+ // The Testserver pool resource's published surface, `@vercel/storm/testserver`. A user's `storm.config.ts`
2
+ // imports it, so, like `@vercel/storm/config`, it imports nothing at run time: loading a config file pulls in no
3
3
  // Clinkr, zod or CLI code.
4
4
  /**
5
5
  * The Testserver pool resource for `resources.testserverPool` in `storm.config.ts`. Its presence gives a run a
@@ -0,0 +1,38 @@
1
+ import { type BuildChannel } from "./channels.ts";
2
+ /** The one repository whose pull requests have Testserver builds: its PR builds. */
3
+ export declare const TESTSERVER_REPO = "vercel/api";
4
+ /**
5
+ * What a `build` value names: a build channel, a vercel/api pull request (a PR build reference, `pr:<N>` or the PR's
6
+ * URL), or a build named directly.
7
+ */
8
+ export type BuildReference = {
9
+ readonly kind: "channel";
10
+ readonly channel: BuildChannel;
11
+ } | {
12
+ readonly kind: "pull-request";
13
+ readonly number: number;
14
+ } | {
15
+ readonly kind: "named";
16
+ readonly build: string;
17
+ };
18
+ /**
19
+ * What `text` names, or the problem with it, worded to follow the option's key as an option rule's problem is:
20
+ *
21
+ * - `pr:<N>`, N a positive whole number with no sign or leading zero, is a PR build reference;
22
+ * - an `http` or `https` URL on `github.com` or `www.github.com` whose path is `/vercel/api/pull/<N>`, with any
23
+ * further segments (`/files`, `/checks`, `/commits/<sha>`), a trailing slash, a query or a fragment, is one too;
24
+ * the owner and repository match in any case;
25
+ * - another `github.com` pull request URL, another `github.com` URL, or a bad `pr:` number is a problem;
26
+ * - `stable` and `latest_main` are build channels, and anything else is a build named directly.
27
+ */
28
+ export declare function parseBuildReference(text: string): {
29
+ readonly ok: true;
30
+ readonly reference: BuildReference;
31
+ } | {
32
+ readonly ok: false;
33
+ readonly problem: string;
34
+ };
35
+ /** How a reference is written once settled: the channel, `pr:<N>` or the build's name. */
36
+ export declare function buildReferenceText(reference: BuildReference): string;
37
+ /** A commit's short form, as GitHub shows it: its first 7 characters. */
38
+ export declare function shortSha(sha: string): string;
@@ -0,0 +1,79 @@
1
+ import { isBuildChannel } from "./channels.js";
2
+ /** The one repository whose pull requests have Testserver builds: its PR builds. */
3
+ export const TESTSERVER_REPO = "vercel/api";
4
+ /** A pull request number as written: a positive whole number with no sign or leading zero. */
5
+ const PR_NUMBER = /^[1-9][0-9]*$/;
6
+ /**
7
+ * What `text` names, or the problem with it, worded to follow the option's key as an option rule's problem is:
8
+ *
9
+ * - `pr:<N>`, N a positive whole number with no sign or leading zero, is a PR build reference;
10
+ * - an `http` or `https` URL on `github.com` or `www.github.com` whose path is `/vercel/api/pull/<N>`, with any
11
+ * further segments (`/files`, `/checks`, `/commits/<sha>`), a trailing slash, a query or a fragment, is one too;
12
+ * the owner and repository match in any case;
13
+ * - another `github.com` pull request URL, another `github.com` URL, or a bad `pr:` number is a problem;
14
+ * - `stable` and `latest_main` are build channels, and anything else is a build named directly.
15
+ */
16
+ export function parseBuildReference(text) {
17
+ if (isBuildChannel(text))
18
+ return { ok: true, reference: { kind: "channel", channel: text } };
19
+ if (text.startsWith("pr:")) {
20
+ const number = pullRequestNumber(text.slice("pr:".length));
21
+ return number === undefined
22
+ ? {
23
+ ok: false,
24
+ problem: `must name a pull request number after pr:, such as pr:104196, not ${JSON.stringify(text)}`,
25
+ }
26
+ : { ok: true, reference: { kind: "pull-request", number } };
27
+ }
28
+ const url = gitHubUrl(text);
29
+ if (url === undefined)
30
+ return { ok: true, reference: { kind: "named", build: text } };
31
+ const [owner, repo, pull, number] = url.pathname.split("/").slice(1);
32
+ const parsed = pull === "pull" && number !== undefined ? pullRequestNumber(number) : undefined;
33
+ if (owner === undefined || repo === undefined || parsed === undefined)
34
+ return {
35
+ ok: false,
36
+ problem: `must be a ${TESTSERVER_REPO} pull request URL, such as https://github.com/${TESTSERVER_REPO}/pull/104196, not ${JSON.stringify(text)}`,
37
+ };
38
+ if (`${owner}/${repo}`.toLowerCase() !== TESTSERVER_REPO)
39
+ return {
40
+ ok: false,
41
+ problem: `must be a ${TESTSERVER_REPO} pull request: only ${TESTSERVER_REPO} pull requests have Testserver builds, not ${owner}/${repo}`,
42
+ };
43
+ return { ok: true, reference: { kind: "pull-request", number: parsed } };
44
+ }
45
+ /** How a reference is written once settled: the channel, `pr:<N>` or the build's name. */
46
+ export function buildReferenceText(reference) {
47
+ switch (reference.kind) {
48
+ case "channel":
49
+ return reference.channel;
50
+ case "pull-request":
51
+ return `pr:${reference.number}`;
52
+ case "named":
53
+ return reference.build;
54
+ }
55
+ }
56
+ /** A commit's short form, as GitHub shows it: its first 7 characters. */
57
+ export function shortSha(sha) {
58
+ return sha.slice(0, 7);
59
+ }
60
+ /** `text` as a pull request number, or undefined when it isn't one. */
61
+ function pullRequestNumber(text) {
62
+ if (!PR_NUMBER.test(text))
63
+ return undefined;
64
+ const number = Number(text);
65
+ return Number.isSafeInteger(number) ? number : undefined;
66
+ }
67
+ /** `text` as an `http` or `https` URL on GitHub's web host, or undefined when it isn't one. */
68
+ function gitHubUrl(text) {
69
+ let url;
70
+ try {
71
+ url = new URL(text);
72
+ }
73
+ catch {
74
+ return undefined;
75
+ }
76
+ if (url.protocol !== "https:" && url.protocol !== "http:")
77
+ return undefined;
78
+ return url.hostname === "github.com" || url.hostname === "www.github.com" ? url : undefined;
79
+ }
@@ -1,3 +1,4 @@
1
+ export { type BuildReference, buildReferenceText, parseBuildReference, shortSha, TESTSERVER_REPO, } from "./build-reference.ts";
1
2
  export { BUILD_CHANNELS, type BuildChannel, isBuildChannel, resolveChannel } from "./channels.ts";
2
3
  export { CREATE_ATTEMPTS, createSandbox, DEFAULT_TTL_MINUTES, describeTtl, invalidTtlMessage } from "./create.ts";
3
4
  export { createFailureText, describeCreateFailure, mayLeaveSandbox } from "./create-failure.ts";
@@ -1,5 +1,6 @@
1
1
  // The Testserver folder's `sandbox/` barrel, for the other files in `resources/testserver/`. Code outside that folder
2
2
  // imports `resources/testserver/index.ts` instead.
3
+ export { buildReferenceText, parseBuildReference, shortSha, TESTSERVER_REPO, } from "./build-reference.js";
3
4
  export { BUILD_CHANNELS, isBuildChannel, resolveChannel } from "./channels.js";
4
5
  export { CREATE_ATTEMPTS, createSandbox, DEFAULT_TTL_MINUTES, describeTtl, invalidTtlMessage } from "./create.js";
5
6
  export { createFailureText, describeCreateFailure, mayLeaveSandbox } from "./create-failure.js";
@@ -21,13 +21,39 @@ export declare const PROVIDERS: readonly [import("./core/provider.ts").Provider<
21
21
  set: "set";
22
22
  }>;
23
23
  }, import("zod/v4/core").$strip>;
24
+ }, {
25
+ readonly githubTokenMissing: {
26
+ readonly exitCode: 2;
27
+ readonly description: "The run holds resources.githubFixtureRepo, required (optional is false: in the file, by --set resources.githubFixtureRepo.optional=false, or by default), and the host environment variable its tokenEnv names is unset or empty, so the run didn't start.";
28
+ readonly schema: import("zod").ZodObject<{
29
+ tokenEnv: import("zod").ZodString;
30
+ repo: import("zod").ZodString;
31
+ configFile: import("zod").ZodNullable<import("zod").ZodString>;
32
+ requiredBy: import("zod").ZodEnum<{
33
+ config: "config";
34
+ set: "set";
35
+ }>;
36
+ }, import("zod/v4/core").$strip>;
37
+ readonly render: ({ tokenEnv, repo, requiredBy }: {
38
+ tokenEnv: string;
39
+ repo: string;
40
+ configFile: string | null;
41
+ requiredBy: "config" | "set";
42
+ }) => {
43
+ message: string;
44
+ next: {
45
+ type: "text";
46
+ text: string;
47
+ }[];
48
+ };
49
+ };
24
50
  }>;
25
51
  refusalErrors: {
26
52
  readonly githubFixtureRepoUnavailable: import("@vercel/clinkr").DataErrorDefinition<import("zod").ZodObject<{
27
53
  repo: import("zod").ZodString;
28
54
  status: import("zod").ZodNullable<import("zod").ZodNumber>;
29
55
  message: import("zod").ZodString;
30
- }, import("zod/v4/core").$strip>>;
56
+ }, import("zod/v4/core").$strip>, readonly []>;
31
57
  };
32
58
  settle: ({ options, env, configFile }: import("./core/command-provider.ts").ResourceSettleInput<import("./resources/github/provider.ts").GitHubFixtureRepoKind>) => {
33
59
  readonly ok: false;
@@ -56,12 +82,82 @@ export declare const PROVIDERS: readonly [import("./core/provider.ts").Provider<
56
82
  path: import("zod").ZodString;
57
83
  message: import("zod").ZodString;
58
84
  }, import("zod/v4/core").$strip>;
85
+ }, {
86
+ readonly poolUnavailable: {
87
+ readonly exitCode: 1;
88
+ readonly description: "storm couldn't use the pool, so it minted no credential and didn't run the command.";
89
+ readonly schema: import("zod").ZodObject<{
90
+ path: import("zod").ZodString;
91
+ message: import("zod").ZodString;
92
+ }, import("zod/v4/core").$strip>;
93
+ readonly render: ({ path, message }: {
94
+ path: string;
95
+ message: string;
96
+ }) => {
97
+ message: string;
98
+ rows: [string, string][];
99
+ next: {
100
+ type: "text";
101
+ text: string;
102
+ }[];
103
+ };
104
+ };
59
105
  }>;
60
106
  refusalErrors: {
107
+ readonly pullRequestUnreadable: import("@vercel/clinkr").DataErrorDefinition<import("zod").ZodObject<{
108
+ pr: import("zod").ZodNumber;
109
+ repo: import("zod").ZodString;
110
+ kind: import("zod").ZodEnum<{
111
+ "connect-failed": "connect-failed";
112
+ "http-error": "http-error";
113
+ malformed: "malformed";
114
+ "no-token": "no-token";
115
+ "not-found": "not-found";
116
+ rejected: "rejected";
117
+ timeout: "timeout";
118
+ }>;
119
+ status: import("zod").ZodNullable<import("zod").ZodNumber>;
120
+ message: import("zod").ZodNullable<import("zod").ZodString>;
121
+ tokenOrigin: import("zod").ZodNullable<import("zod").ZodEnum<{
122
+ GH_TOKEN: "GH_TOKEN";
123
+ GITHUB_TOKEN: "GITHUB_TOKEN";
124
+ "gh auth token": "gh auth token";
125
+ }>>;
126
+ }, import("zod/v4/core").$strip>, readonly []>;
127
+ readonly prBuildsUnlisted: import("@vercel/clinkr").DataErrorDefinition<import("zod").ZodObject<{
128
+ pr: import("zod").ZodNumber;
129
+ failure: import("zod").ZodObject<{
130
+ kind: import("zod").ZodEnum<{
131
+ "connect-failed": "connect-failed";
132
+ "http-error": "http-error";
133
+ malformed: "malformed";
134
+ "not-found": "not-found";
135
+ rejected: "rejected";
136
+ timeout: "timeout";
137
+ }>;
138
+ status: import("zod").ZodNullable<import("zod").ZodNumber>;
139
+ detail: import("zod").ZodString;
140
+ }, import("zod/v4/core").$strip>;
141
+ }, import("zod/v4/core").$strip>, readonly []>;
142
+ readonly prBuildNotReady: import("@vercel/clinkr").DataErrorDefinition<import("zod").ZodObject<{
143
+ pr: import("zod").ZodNumber;
144
+ headSha: import("zod").ZodString;
145
+ newest: import("zod").ZodNullable<import("zod").ZodObject<{
146
+ build: import("zod").ZodString;
147
+ headSha: import("zod").ZodString;
148
+ createdAt: import("zod").ZodString;
149
+ }, import("zod/v4/core").$strip>>;
150
+ }, import("zod/v4/core").$strip>, readonly []>;
151
+ readonly prBuildExpired: import("@vercel/clinkr").DataErrorDefinition<import("zod").ZodObject<{
152
+ pr: import("zod").ZodNumber;
153
+ headSha: import("zod").ZodString;
154
+ build: import("zod").ZodString;
155
+ expiresAt: import("zod").ZodString;
156
+ }, import("zod/v4/core").$strip>, readonly []>;
61
157
  readonly poolUnreadable: import("@vercel/clinkr").DataErrorDefinition<import("zod").ZodObject<{
62
158
  path: import("zod").ZodString;
63
159
  message: import("zod").ZodString;
64
- }, import("zod/v4/core").$strip>>;
160
+ }, import("zod/v4/core").$strip>, readonly []>;
65
161
  readonly tokenRequestFailed: import("@vercel/clinkr").DataErrorDefinition<import("zod").ZodObject<{
66
162
  cause: import("zod").ZodEnum<{
67
163
  "request-failed": "request-failed";
@@ -89,7 +185,7 @@ export declare const PROVIDERS: readonly [import("./core/provider.ts").Provider<
89
185
  detail: import("zod").ZodNullable<import("zod").ZodString>;
90
186
  }, import("zod/v4/core").$strip>>;
91
187
  sandboxMayExist: import("zod").ZodBoolean;
92
- }, import("zod/v4/core").$strip>>;
188
+ }, import("zod/v4/core").$strip>, readonly []>;
93
189
  readonly credentialRejected: import("@vercel/clinkr").DataErrorDefinition<import("zod").ZodObject<{
94
190
  origin: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
95
191
  source: import("zod").ZodLiteral<"mint">;
@@ -124,7 +220,7 @@ export declare const PROVIDERS: readonly [import("./core/provider.ts").Provider<
124
220
  message: import("zod").ZodString;
125
221
  }, import("zod/v4/core").$strip>>;
126
222
  sandboxMayExist: import("zod").ZodBoolean;
127
- }, import("zod/v4/core").$strip>>;
223
+ }, import("zod/v4/core").$strip>, readonly []>;
128
224
  readonly noSandboxes: import("@vercel/clinkr").DataErrorDefinition<import("zod").ZodObject<{
129
225
  requested: import("zod").ZodNumber;
130
226
  ttlMinutes: import("zod").ZodNumber;
@@ -141,11 +237,11 @@ export declare const PROVIDERS: readonly [import("./core/provider.ts").Provider<
141
237
  detail: import("zod").ZodNullable<import("zod").ZodString>;
142
238
  }, import("zod/v4/core").$strip>>;
143
239
  sandboxMayExist: import("zod").ZodBoolean;
144
- }, import("zod/v4/core").$strip>>;
240
+ }, import("zod/v4/core").$strip>, readonly []>;
145
241
  readonly noUsableSandboxes: import("@vercel/clinkr").DataErrorDefinition<import("zod").ZodObject<{
146
242
  requested: import("zod").ZodNumber;
147
243
  build: import("zod").ZodString;
148
- }, import("zod/v4/core").$strip>>;
244
+ }, import("zod/v4/core").$strip>, readonly []>;
149
245
  };
150
246
  settle: ({ options }: import("./core/command-provider.ts").ResourceSettleInput<import("./resources/testserver/provider.ts").TestserverPoolKind>) => {
151
247
  ok: true;
@@ -158,6 +254,64 @@ export declare const PROVIDERS: readonly [import("./core/provider.ts").Provider<
158
254
  readonly failure: import("./resources/testserver/pool/gateways.ts").PoolStoreFailure;
159
255
  }) => import("@vercel/clinkr").CommandError<"pool_unavailable">;
160
256
  refusalFacts: (refusal: import("./resources/testserver/provider.ts").TestserverRefusal) => {
257
+ readonly key: "pullRequestUnreadable";
258
+ readonly data: import("zod").input<import("zod").ZodObject<{
259
+ pr: import("zod").ZodNumber;
260
+ repo: import("zod").ZodString;
261
+ kind: import("zod").ZodEnum<{
262
+ "connect-failed": "connect-failed";
263
+ "http-error": "http-error";
264
+ malformed: "malformed";
265
+ "no-token": "no-token";
266
+ "not-found": "not-found";
267
+ rejected: "rejected";
268
+ timeout: "timeout";
269
+ }>;
270
+ status: import("zod").ZodNullable<import("zod").ZodNumber>;
271
+ message: import("zod").ZodNullable<import("zod").ZodString>;
272
+ tokenOrigin: import("zod").ZodNullable<import("zod").ZodEnum<{
273
+ GH_TOKEN: "GH_TOKEN";
274
+ GITHUB_TOKEN: "GITHUB_TOKEN";
275
+ "gh auth token": "gh auth token";
276
+ }>>;
277
+ }, import("zod/v4/core").$strip>>;
278
+ } | {
279
+ readonly key: "prBuildsUnlisted";
280
+ readonly data: import("zod").input<import("zod").ZodObject<{
281
+ pr: import("zod").ZodNumber;
282
+ failure: import("zod").ZodObject<{
283
+ kind: import("zod").ZodEnum<{
284
+ "connect-failed": "connect-failed";
285
+ "http-error": "http-error";
286
+ malformed: "malformed";
287
+ "not-found": "not-found";
288
+ rejected: "rejected";
289
+ timeout: "timeout";
290
+ }>;
291
+ status: import("zod").ZodNullable<import("zod").ZodNumber>;
292
+ detail: import("zod").ZodString;
293
+ }, import("zod/v4/core").$strip>;
294
+ }, import("zod/v4/core").$strip>>;
295
+ } | {
296
+ readonly key: "prBuildNotReady";
297
+ readonly data: import("zod").input<import("zod").ZodObject<{
298
+ pr: import("zod").ZodNumber;
299
+ headSha: import("zod").ZodString;
300
+ newest: import("zod").ZodNullable<import("zod").ZodObject<{
301
+ build: import("zod").ZodString;
302
+ headSha: import("zod").ZodString;
303
+ createdAt: import("zod").ZodString;
304
+ }, import("zod/v4/core").$strip>>;
305
+ }, import("zod/v4/core").$strip>>;
306
+ } | {
307
+ readonly key: "prBuildExpired";
308
+ readonly data: import("zod").input<import("zod").ZodObject<{
309
+ pr: import("zod").ZodNumber;
310
+ headSha: import("zod").ZodString;
311
+ build: import("zod").ZodString;
312
+ expiresAt: import("zod").ZodString;
313
+ }, import("zod/v4/core").$strip>>;
314
+ } | {
161
315
  key: "poolUnreadable";
162
316
  data: {
163
317
  path: string;
@@ -302,12 +456,62 @@ export declare const RESOURCE_ERRORS: import("./commands/exec/cleanup.ts").WithC
302
456
  repo: import("zod").ZodString;
303
457
  status: import("zod").ZodNullable<import("zod").ZodNumber>;
304
458
  message: import("zod").ZodString;
305
- }, import("zod/v4/core").$strip>>;
459
+ }, import("zod/v4/core").$strip>, readonly []>;
306
460
  } & {
461
+ readonly pullRequestUnreadable: import("@vercel/clinkr").DataErrorDefinition<import("zod").ZodObject<{
462
+ pr: import("zod").ZodNumber;
463
+ repo: import("zod").ZodString;
464
+ kind: import("zod").ZodEnum<{
465
+ "connect-failed": "connect-failed";
466
+ "http-error": "http-error";
467
+ malformed: "malformed";
468
+ "no-token": "no-token";
469
+ "not-found": "not-found";
470
+ rejected: "rejected";
471
+ timeout: "timeout";
472
+ }>;
473
+ status: import("zod").ZodNullable<import("zod").ZodNumber>;
474
+ message: import("zod").ZodNullable<import("zod").ZodString>;
475
+ tokenOrigin: import("zod").ZodNullable<import("zod").ZodEnum<{
476
+ GH_TOKEN: "GH_TOKEN";
477
+ GITHUB_TOKEN: "GITHUB_TOKEN";
478
+ "gh auth token": "gh auth token";
479
+ }>>;
480
+ }, import("zod/v4/core").$strip>, readonly []>;
481
+ readonly prBuildsUnlisted: import("@vercel/clinkr").DataErrorDefinition<import("zod").ZodObject<{
482
+ pr: import("zod").ZodNumber;
483
+ failure: import("zod").ZodObject<{
484
+ kind: import("zod").ZodEnum<{
485
+ "connect-failed": "connect-failed";
486
+ "http-error": "http-error";
487
+ malformed: "malformed";
488
+ "not-found": "not-found";
489
+ rejected: "rejected";
490
+ timeout: "timeout";
491
+ }>;
492
+ status: import("zod").ZodNullable<import("zod").ZodNumber>;
493
+ detail: import("zod").ZodString;
494
+ }, import("zod/v4/core").$strip>;
495
+ }, import("zod/v4/core").$strip>, readonly []>;
496
+ readonly prBuildNotReady: import("@vercel/clinkr").DataErrorDefinition<import("zod").ZodObject<{
497
+ pr: import("zod").ZodNumber;
498
+ headSha: import("zod").ZodString;
499
+ newest: import("zod").ZodNullable<import("zod").ZodObject<{
500
+ build: import("zod").ZodString;
501
+ headSha: import("zod").ZodString;
502
+ createdAt: import("zod").ZodString;
503
+ }, import("zod/v4/core").$strip>>;
504
+ }, import("zod/v4/core").$strip>, readonly []>;
505
+ readonly prBuildExpired: import("@vercel/clinkr").DataErrorDefinition<import("zod").ZodObject<{
506
+ pr: import("zod").ZodNumber;
507
+ headSha: import("zod").ZodString;
508
+ build: import("zod").ZodString;
509
+ expiresAt: import("zod").ZodString;
510
+ }, import("zod/v4/core").$strip>, readonly []>;
307
511
  readonly poolUnreadable: import("@vercel/clinkr").DataErrorDefinition<import("zod").ZodObject<{
308
512
  path: import("zod").ZodString;
309
513
  message: import("zod").ZodString;
310
- }, import("zod/v4/core").$strip>>;
514
+ }, import("zod/v4/core").$strip>, readonly []>;
311
515
  readonly tokenRequestFailed: import("@vercel/clinkr").DataErrorDefinition<import("zod").ZodObject<{
312
516
  cause: import("zod").ZodEnum<{
313
517
  "request-failed": "request-failed";
@@ -335,7 +539,7 @@ export declare const RESOURCE_ERRORS: import("./commands/exec/cleanup.ts").WithC
335
539
  detail: import("zod").ZodNullable<import("zod").ZodString>;
336
540
  }, import("zod/v4/core").$strip>>;
337
541
  sandboxMayExist: import("zod").ZodBoolean;
338
- }, import("zod/v4/core").$strip>>;
542
+ }, import("zod/v4/core").$strip>, readonly []>;
339
543
  readonly credentialRejected: import("@vercel/clinkr").DataErrorDefinition<import("zod").ZodObject<{
340
544
  origin: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
341
545
  source: import("zod").ZodLiteral<"mint">;
@@ -370,7 +574,7 @@ export declare const RESOURCE_ERRORS: import("./commands/exec/cleanup.ts").WithC
370
574
  message: import("zod").ZodString;
371
575
  }, import("zod/v4/core").$strip>>;
372
576
  sandboxMayExist: import("zod").ZodBoolean;
373
- }, import("zod/v4/core").$strip>>;
577
+ }, import("zod/v4/core").$strip>, readonly []>;
374
578
  readonly noSandboxes: import("@vercel/clinkr").DataErrorDefinition<import("zod").ZodObject<{
375
579
  requested: import("zod").ZodNumber;
376
580
  ttlMinutes: import("zod").ZodNumber;
@@ -387,11 +591,11 @@ export declare const RESOURCE_ERRORS: import("./commands/exec/cleanup.ts").WithC
387
591
  detail: import("zod").ZodNullable<import("zod").ZodString>;
388
592
  }, import("zod/v4/core").$strip>>;
389
593
  sandboxMayExist: import("zod").ZodBoolean;
390
- }, import("zod/v4/core").$strip>>;
594
+ }, import("zod/v4/core").$strip>, readonly []>;
391
595
  readonly noUsableSandboxes: import("@vercel/clinkr").DataErrorDefinition<import("zod").ZodObject<{
392
596
  requested: import("zod").ZodNumber;
393
597
  build: import("zod").ZodString;
394
- }, import("zod/v4/core").$strip>>;
598
+ }, import("zod/v4/core").$strip>, readonly []>;
395
599
  }> & import("@vercel/clinkr").SharedErrors<{
396
600
  githubTokenMissing: import("zod").ZodObject<{
397
601
  tokenEnv: import("zod").ZodString;
@@ -402,11 +606,57 @@ export declare const RESOURCE_ERRORS: import("./commands/exec/cleanup.ts").WithC
402
606
  set: "set";
403
607
  }>;
404
608
  }, import("zod/v4/core").$strip>;
609
+ }, {
610
+ readonly githubTokenMissing: {
611
+ readonly exitCode: 2;
612
+ readonly description: "The run holds resources.githubFixtureRepo, required (optional is false: in the file, by --set resources.githubFixtureRepo.optional=false, or by default), and the host environment variable its tokenEnv names is unset or empty, so the run didn't start.";
613
+ readonly schema: import("zod").ZodObject<{
614
+ tokenEnv: import("zod").ZodString;
615
+ repo: import("zod").ZodString;
616
+ configFile: import("zod").ZodNullable<import("zod").ZodString>;
617
+ requiredBy: import("zod").ZodEnum<{
618
+ config: "config";
619
+ set: "set";
620
+ }>;
621
+ }, import("zod/v4/core").$strip>;
622
+ readonly render: ({ tokenEnv, repo, requiredBy }: {
623
+ tokenEnv: string;
624
+ repo: string;
625
+ configFile: string | null;
626
+ requiredBy: "config" | "set";
627
+ }) => {
628
+ message: string;
629
+ next: {
630
+ type: "text";
631
+ text: string;
632
+ }[];
633
+ };
634
+ };
405
635
  }> & import("@vercel/clinkr").SharedErrors<{
406
636
  poolUnavailable: import("zod").ZodObject<{
407
637
  path: import("zod").ZodString;
408
638
  message: import("zod").ZodString;
409
639
  }, import("zod/v4/core").$strip>;
640
+ }, {
641
+ readonly poolUnavailable: {
642
+ readonly exitCode: 1;
643
+ readonly description: "storm couldn't use the pool, so it minted no credential and didn't run the command.";
644
+ readonly schema: import("zod").ZodObject<{
645
+ path: import("zod").ZodString;
646
+ message: import("zod").ZodString;
647
+ }, import("zod/v4/core").$strip>;
648
+ readonly render: ({ path, message }: {
649
+ path: string;
650
+ message: string;
651
+ }) => {
652
+ message: string;
653
+ rows: [string, string][];
654
+ next: {
655
+ type: "text";
656
+ text: string;
657
+ }[];
658
+ };
659
+ };
410
660
  }>;
411
661
  /**
412
662
  * Every resource's command half, bound to its name: what `exec` and `vitest` settle and report through, and
@@ -414,12 +664,12 @@ export declare const RESOURCE_ERRORS: import("./commands/exec/cleanup.ts").WithC
414
664
  * cleanup.
415
665
  */
416
666
  export declare const RESOURCE_COMMANDS: {
417
- settle(options: import("./core/resource.ts").ResourceOptions<Resources>, env: Readonly<Record<string, string | undefined>>, configFile: string | null): import("@vercel/clinkr").Refusable<import("./core/command-slots.ts").ResourcesSettlement<Resources>, import("@vercel/clinkr").CommandError<"credential_rejected" | "github_fixture_repo_unavailable" | "github_token_missing" | "no_sandboxes" | "no_usable_sandboxes" | "pool_unavailable" | "pool_unreadable" | "token_request_failed">>;
667
+ settle(options: import("./core/resource.ts").ResourceOptions<Resources>, env: Readonly<Record<string, string | undefined>>, configFile: string | null): import("@vercel/clinkr").Refusable<import("./core/command-slots.ts").ResourcesSettlement<Resources>, import("@vercel/clinkr").CommandError<"credential_rejected"> | import("@vercel/clinkr").CommandError<"github_fixture_repo_unavailable"> | import("@vercel/clinkr").CommandError<"github_token_missing"> | import("@vercel/clinkr").CommandError<"no_sandboxes"> | import("@vercel/clinkr").CommandError<"no_usable_sandboxes"> | import("@vercel/clinkr").CommandError<"pool_unavailable"> | import("@vercel/clinkr").CommandError<"pool_unreadable"> | import("@vercel/clinkr").CommandError<"pr_build_expired"> | import("@vercel/clinkr").CommandError<"pr_build_not_ready"> | import("@vercel/clinkr").CommandError<"pr_builds_unlisted"> | import("@vercel/clinkr").CommandError<"pull_request_unreadable"> | import("@vercel/clinkr").CommandError<"token_request_failed">>;
418
668
  takesCredential(options: import("./core/resource.ts").ResourceOptions<Resources>): boolean;
419
669
  refusalFacts(outcome: ResourceRefusal<Resources>): import("./core/command-provider.ts").RefusalFact;
420
- unpreparedError(outcome: import("./core/resource.ts").ResourceUnprepared<Resources>): import("@vercel/clinkr").CommandError<"credential_rejected" | "github_fixture_repo_unavailable" | "github_token_missing" | "no_sandboxes" | "no_usable_sandboxes" | "pool_unavailable" | "pool_unreadable" | "token_request_failed">;
670
+ unpreparedError(outcome: import("./core/resource.ts").ResourceUnprepared<Resources>): import("@vercel/clinkr").CommandError<"credential_rejected"> | import("@vercel/clinkr").CommandError<"github_fixture_repo_unavailable"> | import("@vercel/clinkr").CommandError<"github_token_missing"> | import("@vercel/clinkr").CommandError<"no_sandboxes"> | import("@vercel/clinkr").CommandError<"no_usable_sandboxes"> | import("@vercel/clinkr").CommandError<"pool_unavailable"> | import("@vercel/clinkr").CommandError<"pool_unreadable"> | import("@vercel/clinkr").CommandError<"pr_build_expired"> | import("@vercel/clinkr").CommandError<"pr_build_not_ready"> | import("@vercel/clinkr").CommandError<"pr_builds_unlisted"> | import("@vercel/clinkr").CommandError<"pull_request_unreadable"> | import("@vercel/clinkr").CommandError<"token_request_failed">;
421
671
  canceledLines(resources: import("./core/resource.ts").ResourceCanceledFacts<Resources>, cleanup: ResourceCleanup<Resources>): readonly string[];
422
- refusedError: (outcome: ResourceRefusal<Resources>, cleanup: StormCleanupFacts) => import("@vercel/clinkr").CommandError<"credential_rejected" | "github_fixture_repo_unavailable" | "no_sandboxes" | "no_usable_sandboxes" | "pool_unreadable" | "token_request_failed">;
672
+ refusedError: (outcome: ResourceRefusal<Resources>, cleanup: StormCleanupFacts) => import("@vercel/clinkr").CommandError<"credential_rejected"> | import("@vercel/clinkr").CommandError<"github_fixture_repo_unavailable"> | import("@vercel/clinkr").CommandError<"no_sandboxes"> | import("@vercel/clinkr").CommandError<"no_usable_sandboxes"> | import("@vercel/clinkr").CommandError<"pool_unreadable"> | import("@vercel/clinkr").CommandError<"pr_build_expired"> | import("@vercel/clinkr").CommandError<"pr_build_not_ready"> | import("@vercel/clinkr").CommandError<"pr_builds_unlisted"> | import("@vercel/clinkr").CommandError<"pull_request_unreadable"> | import("@vercel/clinkr").CommandError<"token_request_failed">;
423
673
  };
424
674
  /** Every resource's command tree's mount, which `application.ts` mounts beside the host's own commands. */
425
675
  export declare const RESOURCE_MOUNTS: readonly CommandMount[];
package/dist/sdk/index.js CHANGED
@@ -1,8 +1,8 @@
1
- // The storm SDK's published surface, exported as `@cnc-tools/storm/sdk`: only what a command uses. A command
1
+ // The storm SDK's published surface, exported as `@vercel/storm/sdk`: only what a command uses. A command
2
2
  // running under a storm run uses it to read the run payload, start containers, seed them through factories or
3
3
  // the seeder's entity-level calls, send them API requests, warm their services, read their logs, and proxy clients
4
4
  // that can't send a test id. The gateway seams the SDK's own tests and fakes need live on each SDK module's
5
- // `index.ts`, not here. The Vitest adapter (`src/vitest/`, `@cnc-tools/storm/vitest`) builds on this surface;
5
+ // `index.ts`, not here. The Vitest adapter (`src/vitest/`, `@vercel/storm/vitest`) builds on this surface;
6
6
  // nothing here imports it. Everything
7
7
  // under `src/sdk/` depends only on Node builtins and `zod`, and on nothing outside this directory, so the tree can
8
8
  // move into its own package; `tsconfig.sdk.json` and `.oxlintrc.json` check it.
@@ -0,0 +1,34 @@
1
+ /** A command line the harness can't split into words: the story or the variable wrote it. */
2
+ export declare class InvalidCommandLine extends Error {
3
+ readonly name = "InvalidCommandLine";
4
+ }
5
+ /**
6
+ * `command` split into words as a POSIX shell splits them: whitespace separates words; single quotes keep everything
7
+ * up to the next single quote; double quotes keep everything up to the next unescaped double quote, where a backslash
8
+ * escapes `"`, `\`, `$` and a backtick; a backslash outside quotes escapes the next character. A shell operator or
9
+ * expansion outside quotes (`|`, `&`, `;`, `<`, `>`, `(`, `)`, `$`, a backtick, `*`, `?`, `[`, `~`, `#`) and an
10
+ * unclosed quote throw `InvalidCommandLine`, since the harness runs no shell.
11
+ */
12
+ export declare function splitCommandLine(command: string): readonly string[];
13
+ /** A program and the words it gets before a story's own arguments. */
14
+ export interface StoryExecutable {
15
+ readonly file: string;
16
+ readonly args: readonly string[];
17
+ }
18
+ /** Where `storyExecutable` reads the executable a harness invokes. */
19
+ export interface StoryExecutableOptions {
20
+ /** The environment variable that names another executable, such as `SLOT_STORY_BIN`. */
21
+ readonly variable: string;
22
+ readonly env: Readonly<Record<string, string | undefined>>;
23
+ /** The executable when the variable is unset or empty: the package's own. */
24
+ readonly fallback: StoryExecutable;
25
+ /** The directory a relative program word resolves against: the one the tests run from, never a story's cwd. */
26
+ readonly base: string;
27
+ }
28
+ /**
29
+ * The executable `variable`'s value in `env` names, or `fallback` when it is unset or empty. The value is split as
30
+ * `splitCommandLine` splits a story's command: its first word is the program, and the rest come before the story's
31
+ * arguments. A program word with a `/` that isn't absolute resolves against `base`; a word without one is looked up on
32
+ * `PATH`. A value that doesn't split, or holds only whitespace, throws an error that names the variable.
33
+ */
34
+ export declare function storyExecutable({ variable, env, fallback, base }: StoryExecutableOptions): StoryExecutable;