@cnc-tools/storm 0.10.0 → 0.11.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 (198) hide show
  1. package/dist/bin/storm.js +17 -9
  2. package/dist/build-info.js +1 -1
  3. package/dist/chunks/{chunk-YF3ICDBY.js → chunk-3ZZVZPMG.js} +1 -1
  4. package/dist/chunks/{chunk-JQ2HK4RN.js → chunk-4EU4AH7E.js} +141 -6
  5. package/dist/chunks/{chunk-ZJ2USLAT.js → chunk-4PRAB24Y.js} +2 -22
  6. package/dist/chunks/chunk-AMTYHUYB.js +257 -0
  7. package/dist/chunks/{chunk-WF4KJ7YG.js → chunk-ETCZ6WP7.js} +1 -1
  8. package/dist/chunks/chunk-FVMQKYTT.js +10 -0
  9. package/dist/chunks/{chunk-XHJGHJBW.js → chunk-GRMD7G4J.js} +33 -275
  10. package/dist/chunks/chunk-ICB4BZJX.js +22 -0
  11. package/dist/chunks/{chunk-AGWW3HDT.js → chunk-KR7WIYLG.js} +1826 -2201
  12. package/dist/chunks/{chunk-OVXD7GES.js → chunk-L4ZPMSKQ.js} +4 -37
  13. package/dist/chunks/chunk-NPPJ57W7.js +569 -0
  14. package/dist/chunks/{chunk-VJQLMGOH.js → chunk-O4BUT7BE.js} +361 -1716
  15. package/dist/chunks/chunk-OJOKQRM6.js +1457 -0
  16. package/dist/chunks/chunk-SLNKW4ZM.js +40 -0
  17. package/dist/chunks/{chunk-AKKNF3WZ.js → chunk-TRFEAYNC.js} +277 -348
  18. package/dist/chunks/chunk-VZZTHCBW.js +93 -0
  19. package/dist/chunks/chunk-WNIQA5J6.js +19 -0
  20. package/dist/chunks/chunk-WSIF7SR6.js +10 -0
  21. package/dist/chunks/{live-app-RIJM3QFD.js → live-app-LOGYUBKB.js} +52 -7
  22. package/dist/commands/exec/cleanup.d.ts +3 -3
  23. package/dist/commands/exec/cleanup.js +6 -2
  24. package/dist/commands/exec/command.d.ts +3 -3
  25. package/dist/commands/exec/command.js +17 -10
  26. package/dist/commands/exec/job-summary.d.ts +1 -1
  27. package/dist/commands/exec/job-summary.js +1 -1
  28. package/dist/commands/exec/live-view.js +5 -5
  29. package/dist/commands/exec/mint-failed.js +1 -1
  30. package/dist/commands/exec/outcomes.d.ts +2 -2
  31. package/dist/commands/exec/outcomes.js +7 -8
  32. package/dist/commands/exec/plan-run.d.ts +3 -5
  33. package/dist/commands/exec/progress.d.ts +3 -3
  34. package/dist/commands/exec/progress.js +6 -6
  35. package/dist/commands/exec/resource-refusals.d.ts +1 -1
  36. package/dist/commands/exec/resource-refusals.js +1 -1
  37. package/dist/commands/exec/run-command.d.ts +14 -9
  38. package/dist/commands/exec/run-command.js +91 -202
  39. package/dist/commands/exec/run-metadata.d.ts +2 -2
  40. package/dist/commands/exec/run-metadata.js +3 -3
  41. package/dist/commands/exec/test-plan.d.ts +1 -35
  42. package/dist/commands/exec/test-plan.js +4 -24
  43. package/dist/commands/exec/view.js +3 -3
  44. package/dist/commands/exec/waterfall.d.ts +3 -1
  45. package/dist/commands/exec/waterfall.js +18 -1
  46. package/dist/commands/runs/facts.d.ts +2 -1
  47. package/dist/commands/runs/facts.js +1 -1
  48. package/dist/commands/runs/list/command.js +10 -9
  49. package/dist/commands/runs/logs/command.js +14 -12
  50. package/dist/commands/runs/past-run.d.ts +3 -27
  51. package/dist/commands/runs/past-run.js +3 -37
  52. package/dist/commands/runs/show/command.js +24 -21
  53. package/dist/commands/runs/show/outcomes.js +2 -2
  54. package/dist/commands/vitest/command.d.ts +3 -3
  55. package/dist/commands/vitest/command.js +24 -17
  56. package/dist/commands/vitest/outcomes.d.ts +1 -1
  57. package/dist/commands/vitest/outcomes.js +1 -1
  58. package/dist/config/credential-resolver.d.ts +6 -3
  59. package/dist/config/credential-resolver.js +6 -5
  60. package/dist/context.d.ts +27 -9
  61. package/dist/context.js +19 -8
  62. package/dist/core/before-run.d.ts +5 -4
  63. package/dist/core/before-run.js +6 -6
  64. package/dist/core/definition-lookup.d.ts +22 -0
  65. package/dist/core/definition-lookup.js +34 -0
  66. package/dist/core/events.d.ts +5 -19
  67. package/dist/core/gateways.d.ts +22 -162
  68. package/dist/core/index.d.ts +10 -11
  69. package/dist/core/index.js +9 -11
  70. package/dist/core/launcher-supplies.js +2 -2
  71. package/dist/core/live/terminal-command-gateway.d.ts +8 -0
  72. package/dist/core/live/terminal-command-gateway.js +49 -0
  73. package/dist/core/presentations.d.ts +4 -3
  74. package/dist/core/presentations.js +4 -5
  75. package/dist/core/resource-registry.d.ts +35 -51
  76. package/dist/core/resource-registry.js +27 -54
  77. package/dist/core/resource-reports.d.ts +37 -4
  78. package/dist/core/resource-reports.js +34 -5
  79. package/dist/core/resources.d.ts +4 -3
  80. package/dist/core/resources.js +2 -4
  81. package/dist/core/run-state.d.ts +1 -1
  82. package/dist/core/run-state.js +1 -1
  83. package/dist/core/run.d.ts +19 -37
  84. package/dist/core/run.js +59 -114
  85. package/dist/core/timeline.js +2 -1
  86. package/dist/credential/events.d.ts +20 -0
  87. package/dist/credential/events.js +4 -0
  88. package/dist/credential/index.d.ts +2 -1
  89. package/dist/credential/index.js +6 -5
  90. package/dist/credential/source.d.ts +38 -26
  91. package/dist/credential/source.js +25 -34
  92. package/dist/extension-commands.d.ts +12 -6
  93. package/dist/extension-commands.js +18 -11
  94. package/dist/extensions/story/command-tree.d.ts +6 -0
  95. package/dist/extensions/story/command-tree.js +21 -0
  96. package/dist/extensions/story/commands/app.d.ts +23 -0
  97. package/dist/extensions/story/commands/app.js +5 -0
  98. package/dist/extensions/story/commands/run/command.d.ts +211 -0
  99. package/dist/extensions/story/commands/run/command.js +259 -0
  100. package/dist/extensions/story/commands/run/metadata.d.ts +4 -0
  101. package/dist/extensions/story/commands/run/metadata.js +8 -0
  102. package/dist/extensions/story/commands/run/outcomes.d.ts +101 -0
  103. package/dist/extensions/story/commands/run/outcomes.js +73 -0
  104. package/dist/extensions/story/commands/tree.d.ts +2 -0
  105. package/dist/extensions/story/commands/tree.js +6 -0
  106. package/dist/extensions/story/extension.d.ts +2 -0
  107. package/dist/extensions/story/extension.js +8 -0
  108. package/dist/extensions/testserver/command-tree.d.ts +1 -1
  109. package/dist/extensions/testserver/command-tree.js +0 -1
  110. package/dist/extensions/testserver/commands/pool/create/command.js +14 -8
  111. package/dist/extensions/testserver/commands/pool/list/command.js +8 -4
  112. package/dist/extensions/testserver/vitest/config.d.ts +7 -5
  113. package/dist/extensions/testserver/vitest/config.js +7 -5
  114. package/dist/extensions/testserver/vitest/fixtures.d.ts +2 -0
  115. package/dist/extensions/testserver/vitest/fixtures.js +36 -5
  116. package/dist/extensions.d.ts +12 -21
  117. package/dist/extensions.js +22 -34
  118. package/dist/forward-sigterm.d.ts +8 -0
  119. package/dist/forward-sigterm.js +18 -0
  120. package/dist/launcher-resolvers/index.d.ts +1 -0
  121. package/dist/launcher-resolvers/index.js +2 -1
  122. package/dist/launcher-resolvers/local-services.d.ts +57 -0
  123. package/dist/launcher-resolvers/local-services.js +7 -0
  124. package/dist/live-app.js +2 -1
  125. package/dist/local-services.d.ts +19 -0
  126. package/dist/local-services.js +37 -0
  127. package/dist/run-directory/gateways.d.ts +167 -0
  128. package/dist/run-directory/gateways.js +2 -0
  129. package/dist/run-directory/index.d.ts +8 -0
  130. package/dist/run-directory/index.js +13 -0
  131. package/dist/run-directory/plan.d.ts +35 -0
  132. package/dist/run-directory/plan.js +24 -0
  133. package/dist/run-directory/reader.d.ts +70 -0
  134. package/dist/run-directory/reader.js +51 -0
  135. package/dist/run-directory/recording.d.ts +92 -0
  136. package/dist/run-directory/recording.js +85 -0
  137. package/dist/{commands/exec → run-directory}/run-collector.d.ts +9 -8
  138. package/dist/{commands/exec → run-directory}/run-collector.js +8 -10
  139. package/dist/{core → run-directory}/run-directory.d.ts +3 -3
  140. package/dist/{core → run-directory}/run-directory.js +2 -2
  141. package/dist/{commands/exec → run-directory}/run-record.d.ts +29 -7
  142. package/dist/{commands/exec → run-directory}/run-record.js +79 -5
  143. package/dist/{commands/exec → run-directory}/timeline-facts.d.ts +4 -8
  144. package/dist/{commands/exec → run-directory}/timeline-facts.js +8 -24
  145. package/dist/runner/events.d.ts +6 -5
  146. package/dist/runner/index.d.ts +13 -17
  147. package/dist/runner/index.js +10 -14
  148. package/dist/runner/prepare.d.ts +28 -6
  149. package/dist/runner/prepare.js +15 -9
  150. package/dist/runner/recipe.d.ts +14 -0
  151. package/dist/runner/recipe.js +12 -0
  152. package/dist/runner/scope.d.ts +18 -11
  153. package/dist/runner/scope.js +12 -10
  154. package/dist/runner/session.d.ts +100 -0
  155. package/dist/runner/session.js +109 -0
  156. package/dist/runner/snapshot-save.d.ts +3 -2
  157. package/dist/runner/snapshot-save.js +6 -5
  158. package/dist/sdk/extension/ci.d.ts +2 -0
  159. package/dist/sdk/extension/ci.js +6 -0
  160. package/dist/sdk/extension/commands.d.ts +11 -13
  161. package/dist/sdk/extension/commands.js +5 -5
  162. package/dist/sdk/extension/index.d.ts +1 -0
  163. package/dist/sdk/extension/index.js +1 -0
  164. package/dist/sdk/extension/lifecycle.d.ts +4 -3
  165. package/dist/sdk/extension/progress.js +2 -2
  166. package/dist/sdk/extension/resource.js +1 -1
  167. package/dist/story/align.d.ts +1 -1
  168. package/dist/story/align.js +1 -1
  169. package/dist/story/command-line.d.ts +6 -16
  170. package/dist/story/command-line.js +11 -23
  171. package/dist/story/errors.d.ts +1 -1
  172. package/dist/story/errors.js +1 -1
  173. package/dist/story/host.d.ts +1 -1
  174. package/dist/story/host.js +2 -2
  175. package/dist/story/index.d.ts +2 -2
  176. package/dist/story/index.js +4 -3
  177. package/dist/story/launch.d.ts +70 -0
  178. package/dist/story/launch.js +77 -0
  179. package/dist/story/report.d.ts +2 -2
  180. package/dist/story/report.js +3 -4
  181. package/dist/story/settle.d.ts +7 -7
  182. package/dist/story/settle.js +5 -5
  183. package/dist/story/start.d.ts +2 -2
  184. package/dist/vendor/testserver-sdk/container/container.d.ts +11 -6
  185. package/dist/vendor/testserver-sdk/container/container.js +38 -16
  186. package/dist/vendor/testserver-sdk/testserver/failure.d.ts +4 -3
  187. package/dist/vendor/testserver-sdk/testserver/failure.js +4 -3
  188. package/package.json +1 -1
  189. package/skills/overview.md +3 -0
  190. package/skills/read-run-output.md +2 -2
  191. package/dist/chunks/chunk-H2VCSNVU.js +0 -351
  192. package/dist/chunks/chunk-J6ZNYUDV.js +0 -21
  193. package/dist/core/mint.d.ts +0 -10
  194. package/dist/core/mint.js +0 -14
  195. package/dist/story/mode.d.ts +0 -17
  196. package/dist/story/mode.js +0 -21
  197. /package/dist/{core → run-directory}/live/run-directory-gateway.d.ts +0 -0
  198. /package/dist/{core → run-directory}/live/run-directory-gateway.js +0 -0
@@ -1,351 +0,0 @@
1
- import {
2
- EXTENSIONS,
3
- RESOURCES,
4
- RESOURCE_PRESENTATIONS,
5
- formatPlan,
6
- sameRow
7
- } from "./chunk-AGWW3HDT.js";
8
- import {
9
- CONFIG_FILE_NAME
10
- } from "./chunk-VJQLMGOH.js";
11
- import {
12
- defaultResourceKey,
13
- optionKeyPath
14
- } from "./chunk-XHJGHJBW.js";
15
-
16
- // src/commands/exec/resource-flags.ts
17
- import { z } from "zod";
18
- function flagField(prefix, option) {
19
- return `${prefix}${option.charAt(0).toUpperCase()}${option.slice(1)}`;
20
- }
21
- function flagSpelling(field) {
22
- return `--${field.replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase()}`;
23
- }
24
- var RESOURCE_FLAGS = RESOURCES.flatMap((definition) => {
25
- const options = definition.options;
26
- return Object.entries(options).flatMap(([option, rule]) => {
27
- const help = rule.flag;
28
- if (help === void 0) return [];
29
- const field = flagField(definition.flagPrefix, option);
30
- return [
31
- {
32
- definition: definition.name,
33
- resource: defaultResourceKey(definition),
34
- option,
35
- field,
36
- flag: flagSpelling(field),
37
- rule,
38
- help
39
- }
40
- ];
41
- });
42
- });
43
- var RESOURCE_FLAG_HELP = Object.fromEntries(
44
- RESOURCE_FLAGS.map(({ field, help }) => [field, help])
45
- );
46
- var RESOURCE_USAGE_FLAGS = RESOURCE_FLAGS.map(({ flag, help, rule }) => {
47
- if (help.valueLabel !== void 0) return `[${flag} <${help.valueLabel}>]`;
48
- return rule.default === true ? `[${flag}=false]` : `[${flag}]`;
49
- }).join(" ");
50
- function resourceRunExamples(command) {
51
- return EXTENSIONS.flatMap((extension) => extension.examples?.[command] ?? []);
52
- }
53
- function baseType(schema, field) {
54
- let input = schema;
55
- while (input instanceof z.ZodPipe) input = input.in;
56
- if (input instanceof z.ZodNumber) return z.number();
57
- if (input instanceof z.ZodString) return z.string();
58
- if (input instanceof z.ZodBoolean) return z.boolean();
59
- if (input instanceof z.ZodEnum) return input;
60
- throw new Error(`The run flag ${field}'s option schema has no number, string, boolean or enum base`);
61
- }
62
- function resourceFlagFields(taken) {
63
- const fields = {};
64
- for (const { field, rule } of RESOURCE_FLAGS) {
65
- if (Object.hasOwn(fields, field) || taken.includes(field))
66
- throw new Error(`Two run flags share the request field ${field}`);
67
- fields[field] = baseType(rule.schema, field).optional();
68
- }
69
- return fields;
70
- }
71
- function readResourceFlags(request) {
72
- const values = {};
73
- const problems = [];
74
- for (const { definition, option, field, flag, rule } of RESOURCE_FLAGS) {
75
- const value = request[field];
76
- if (value === void 0) continue;
77
- const checked = rule.schema.safeParse(value);
78
- if (checked.success) values[definition] = { ...values[definition], [option]: checked.data };
79
- else problems.push(...checked.error.issues.map(({ message }) => ({ field, message: `${flag} ${message}.` })));
80
- }
81
- if (problems.length > 0) return { ok: false, problems };
82
- return { ok: true, values };
83
- }
84
- function resourceFlagProblems(request) {
85
- const read = readResourceFlags(request);
86
- return read.ok ? [] : read.problems;
87
- }
88
- function resourceFlagValues(request) {
89
- const read = readResourceFlags(request);
90
- if (!read.ok) throw new Error(`The flags should have been refused: ${read.problems.map((p) => p.message).join(" ")}`);
91
- return read.values;
92
- }
93
-
94
- // src/commands/exec/test-plan.ts
95
- import { z as z2 } from "zod";
96
- var planOptionSchema = z2.object({
97
- /** The option's key path, `resources.<key>.<option>`, under its resource key. */
98
- path: z2.string(),
99
- /** Its value. */
100
- value: z2.union([z2.string(), z2.number(), z2.boolean()]),
101
- /** Where the value came from: its flag (`flag`), storm.config.ts (`file`), or its default, given the test plan (`default`). */
102
- from: z2.enum(["flag", "file", "default"])
103
- });
104
- var planSchema = z2.object({
105
- /** How many tests `vitest list --json <args>` counted. */
106
- tests: z2.number().int().nonnegative(),
107
- /** How many distinct test files they are in. */
108
- files: z2.number().int().nonnegative(),
109
- /**
110
- * Each resource option whose default is a function of the test plan, with its value and where that came from; empty
111
- * when the run has none.
112
- */
113
- options: z2.array(planOptionSchema)
114
- });
115
- function recordedPlan(testPlan, options) {
116
- return testPlan.kind === "counted" ? { tests: testPlan.tests, files: testPlan.files, options: options.map((option) => ({ ...option })) } : void 0;
117
- }
118
- function testPlanLine(plan) {
119
- return `Running ${testPlanText(plan)}`;
120
- }
121
- function testPlanText(plan) {
122
- return [formatPlan(plan), ...plan.options.map(planOptionText)].join("; ");
123
- }
124
- function planOptionText({ path, value, from }) {
125
- return `${path} ${String(value)} (${fromText(path, from)})`;
126
- }
127
- function fromText(path, from) {
128
- switch (from) {
129
- case "flag":
130
- return RESOURCE_FLAGS.find(({ resource, option }) => optionKeyPath(resource, option) === path)?.flag ?? "a flag";
131
- case "file":
132
- return CONFIG_FILE_NAME;
133
- case "default":
134
- return "default";
135
- }
136
- }
137
-
138
- // src/commands/exec/run-record.ts
139
- import { z as z3 } from "zod";
140
- var testTotalsSchema = z3.object({
141
- passed: z3.number().int().nonnegative(),
142
- failed: z3.number().int().nonnegative(),
143
- skipped: z3.number().int().nonnegative()
144
- });
145
- var endedSchema = z3.object({
146
- outcome: z3.string(),
147
- exitCode: z3.number().int().nullable(),
148
- signal: z3.string().nullable(),
149
- ms: z3.number().nonnegative().nullable(),
150
- tests: testTotalsSchema.nullable(),
151
- testsIncomplete: z3.string().nullable(),
152
- resources: z3.record(z3.string(), z3.object({ definition: z3.string(), facts: z3.unknown() })).nullable(),
153
- resourceRows: z3.array(z3.tuple([z3.string(), z3.union([z3.string(), z3.array(z3.string())])]))
154
- });
155
- var snapshotSchema = z3.object({
156
- id: z3.string(),
157
- base: z3.string(),
158
- built: z3.boolean(),
159
- branch: z3.string().nullable(),
160
- head: z3.string().nullable()
161
- });
162
- var saveSchema = z3.discriminatedUnion("kind", [
163
- z3.object({
164
- /** It saved the runner sandbox as a branch snapshot. */
165
- kind: z3.literal("saved"),
166
- /** The runner snapshot it saved. */
167
- snapshotId: z3.string(),
168
- /** The base it is of: the base of the runner snapshot the run started from, a full SHA. */
169
- base: z3.string(),
170
- /** The local branch it is for. */
171
- branch: z3.string(),
172
- /** HEAD's commit as the run started, a full SHA. */
173
- head: z3.string(),
174
- /** How long the save took, in milliseconds, from the scrub's start until the snapshot was saved. */
175
- ms: z3.number(),
176
- /** The snapshot's size in bytes. */
177
- sizeBytes: z3.number(),
178
- /** Whether the runner snapshot cache recorded it; a later run on the branch starts from it only when it did. */
179
- entryWritten: z3.boolean()
180
- }),
181
- z3.object({
182
- /** It didn't save: HEAD was detached, so there is no branch to save for. */
183
- kind: z3.literal("skipped"),
184
- reason: z3.literal("detached-head")
185
- }),
186
- z3.object({
187
- /** It didn't save: the scrub or the save failed. */
188
- kind: z3.literal("failed"),
189
- step: z3.enum(["scrub", "save-snapshot"]),
190
- message: z3.string()
191
- }),
192
- z3.object({
193
- /** It didn't save, or recorded nothing: a signal stopped it. */
194
- kind: z3.literal("stopped")
195
- })
196
- ]);
197
- var whereSchema = z3.discriminatedUnion("kind", [
198
- z3.object({ kind: z3.literal("unsandboxed") }),
199
- z3.object({
200
- kind: z3.literal("runner"),
201
- team: z3.string(),
202
- project: z3.string(),
203
- region: z3.string(),
204
- runtime: z3.string(),
205
- vcpus: z3.number().int().positive(),
206
- base: z3.string(),
207
- baseRef: z3.string(),
208
- sandbox: z3.string().nullable(),
209
- snapshot: snapshotSchema.nullable(),
210
- keptUntil: z3.string().nullable(),
211
- save: saveSchema.nullable()
212
- })
213
- ]);
214
- var gitSchema = z3.object({ branch: z3.string().nullable(), commit: z3.string(), dirty: z3.boolean() });
215
- var runRecordSchema = z3.object({
216
- version: z3.literal(3),
217
- startedAt: z3.string(),
218
- cwd: z3.string(),
219
- configFile: z3.string().nullable(),
220
- argv: z3.array(z3.string()).readonly(),
221
- // Only a `storm vitest` run has one.
222
- plan: planSchema.exactOptional(),
223
- where: whereSchema,
224
- git: gitSchema.nullable(),
225
- ended: endedSchema.exactOptional()
226
- });
227
- function runRecordText(record) {
228
- return JSON.stringify(record);
229
- }
230
- function parseRunRecord(text) {
231
- if (text === void 0) return void 0;
232
- let json;
233
- try {
234
- json = JSON.parse(text);
235
- } catch {
236
- return void 0;
237
- }
238
- const parsed = runRecordSchema.safeParse(json);
239
- return parsed.success ? parsed.data : void 0;
240
- }
241
- function testTotals(events) {
242
- let passed = 0;
243
- let failed = 0;
244
- let skipped = 0;
245
- let any = false;
246
- for (const event of events) {
247
- if (event.kind !== "test-result") continue;
248
- any = true;
249
- if (event.state === "pass") passed += 1;
250
- else if (event.state === "fail") failed += 1;
251
- else skipped += 1;
252
- }
253
- return any ? { passed, failed, skipped } : null;
254
- }
255
-
256
- // src/commands/exec/timeline-facts.ts
257
- import { z as z4 } from "zod";
258
- var rowRefShape = {
259
- /** The row's name: `mint`, a resource lane's name, `runner`, `tests` or `cleanup`. */
260
- name: z4.string(),
261
- /** For a resource instance's lane, the resource key; null for every other row. */
262
- resource: z4.string().nullable()
263
- };
264
- var timelineOutcomeSchema = z4.enum(["done", "failed", "stopped", "unfinished"]);
265
- var timelineSchema = z4.object({
266
- /** When the run started, as an ISO time. */
267
- startedAt: z4.string(),
268
- /** From the run's start to its last event. */
269
- totalMs: z4.number(),
270
- /**
271
- * The lanes in order: mint, each resource instance's lane, runner, tests, cleanup; each only when the run got that
272
- * far.
273
- */
274
- rows: z4.array(
275
- z4.object({
276
- ...rowRefShape,
277
- /** The row's label, as the waterfall named it when the run ended, such as `credential` or `runner-setup`. */
278
- label: z4.string(),
279
- startMs: z4.number(),
280
- endMs: z4.number(),
281
- outcome: timelineOutcomeSchema,
282
- /** The lane's steps: a resource lane's, as its presentation named them, and the runner's snapshot, start, upload, apply, install and build. */
283
- steps: z4.array(
284
- z4.object({
285
- name: z4.string(),
286
- startMs: z4.number(),
287
- endMs: z4.number(),
288
- outcome: timelineOutcomeSchema
289
- })
290
- ),
291
- /** How long the lane, once ready, waited for the other before the command started. */
292
- idleMs: z4.number(),
293
- /** The runner lane's: whether it reused or built its runner snapshot. */
294
- snapshot: z4.enum(["reused", "built"]).optional(),
295
- /** A resource lane's that counts them: how many of the things it holds it reused, and how many it created. */
296
- sandboxes: z4.object({ reused: z4.number(), created: z4.number() }).optional()
297
- })
298
- ),
299
- /** The lanes the command waited on, then the command, each by its row; empty when the command didn't start. */
300
- criticalPath: z4.array(z4.object(rowRefShape))
301
- });
302
- function timelineFacts(timeline) {
303
- return {
304
- startedAt: timeline.startedAt,
305
- totalMs: timeline.totalMs,
306
- rows: timeline.rows.map((row) => ({
307
- ...row,
308
- label: laneLabel(row.name),
309
- steps: row.steps.map((step) => ({ ...step }))
310
- })),
311
- criticalPath: timeline.criticalPath.map((step) => ({ ...step }))
312
- };
313
- }
314
- var LANE_LABELS = [
315
- "credential",
316
- "runner-setup",
317
- "tests",
318
- "cleanup",
319
- ...RESOURCE_PRESENTATIONS.laneKinds.map(({ label }) => label)
320
- ];
321
- function laneLabel(name) {
322
- if (name === "mint") return "credential";
323
- if (name === "runner") return "runner-setup";
324
- return RESOURCE_PRESENTATIONS.laneKinds.find(({ lane }) => lane === name)?.label ?? name;
325
- }
326
- function criticalPathStep(step, timeline) {
327
- const row = timeline.rows.find((candidate) => sameRow(candidate, step));
328
- const label = row?.label ?? step.name;
329
- return row?.snapshot === void 0 ? label : `${label} (snapshot ${row.snapshot})`;
330
- }
331
-
332
- export {
333
- RESOURCE_FLAG_HELP,
334
- RESOURCE_USAGE_FLAGS,
335
- resourceRunExamples,
336
- resourceFlagFields,
337
- resourceFlagProblems,
338
- resourceFlagValues,
339
- planSchema,
340
- recordedPlan,
341
- testPlanLine,
342
- testPlanText,
343
- saveSchema,
344
- runRecordText,
345
- parseRunRecord,
346
- testTotals,
347
- timelineSchema,
348
- timelineFacts,
349
- LANE_LABELS,
350
- criticalPathStep
351
- };
@@ -1,21 +0,0 @@
1
- import {
2
- defineExtensionCommands,
3
- testserverCommands
4
- } from "./chunk-ZJ2USLAT.js";
5
-
6
- // src/extensions/testserver/command-tree.ts
7
- var testserverExtensionCommands = defineExtensionCommands({
8
- extension: "testserver",
9
- description: "Work with Vercel Testserver: the pool of Testserver sandboxes that runs lease.",
10
- tree: testserverCommands,
11
- directory: "extensions/testserver/commands",
12
- app: (launcherApp) => ({
13
- world: launcherApp.worlds.testserverPool,
14
- config: launcherApp.config,
15
- credentials: launcherApp.credentials
16
- })
17
- });
18
-
19
- export {
20
- testserverExtensionCommands
21
- };
@@ -1,10 +0,0 @@
1
- import { type CredentialGateway, type CredentialSource, type MintTarget } from "../credential/index.ts";
2
- import type { CredentialProgress } from "./events.ts";
3
- /** Mints for `target` through `context`, reporting the mint's start and end to `progress`. */
4
- export declare function mintReported(context: {
5
- readonly credentials: CredentialGateway;
6
- }, target: MintTarget, progress: CredentialProgress): Promise<Awaited<ReturnType<CredentialGateway["mint"]>>>;
7
- /** The mint for `target` as a credential source, reporting the mint's start and end to `progress`. */
8
- export declare function mintSourceReported(context: {
9
- readonly credentials: CredentialGateway;
10
- }, target: MintTarget, progress: CredentialProgress): CredentialSource;
package/dist/core/mint.js DELETED
@@ -1,14 +0,0 @@
1
- // A mint, reported: the run mints for its runner sandbox, or builds the credential source it settled from the mint for
2
- // its resources.
3
- import { mintSource } from "../credential/index.js";
4
- /** Mints for `target` through `context`, reporting the mint's start and end to `progress`. */
5
- export async function mintReported(context, target, progress) {
6
- await progress.emit({ kind: "minting", target });
7
- const minted = await context.credentials.mint(target);
8
- await progress.emit({ kind: "minted", target, ok: minted.ok });
9
- return minted;
10
- }
11
- /** The mint for `target` as a credential source, reporting the mint's start and end to `progress`. */
12
- export function mintSourceReported(context, target, progress) {
13
- return mintSource(target, () => mintReported(context, target, progress));
14
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * How much a story may change its recording:
3
- *
4
- * - `none` compares and writes nothing. A divergence or a stale entry fails the story.
5
- * - `stale` rewrites the recording so it fits the story again, when the only problems are stale entries. A divergence
6
- * still fails the story, and then nothing is written.
7
- * - `all` also accepts divergences, recording the new observations.
8
- */
9
- export type StoryRecordLevel = "none" | "stale" | "all";
10
- /** The variable that sets the level. */
11
- export declare const STORY_RECORD_VARIABLE = "STORY_RECORD";
12
- /**
13
- * The level `env` sets: `STORY_RECORD` when it is set and non-empty; otherwise `none` when `CI` is set and non-empty,
14
- * since CI must not change a recording, and `stale` elsewhere. Any other value of `STORY_RECORD` is a `TypeError`
15
- * naming it.
16
- */
17
- export declare function resolveStoryRecordLevel(env: Readonly<Record<string, string | undefined>>): StoryRecordLevel;
@@ -1,21 +0,0 @@
1
- // How much a story may change its recording, from `STORY_RECORD`. Pure.
2
- /** The variable that sets the level. */
3
- export const STORY_RECORD_VARIABLE = "STORY_RECORD";
4
- const LEVELS = ["none", "stale", "all"];
5
- /**
6
- * The level `env` sets: `STORY_RECORD` when it is set and non-empty; otherwise `none` when `CI` is set and non-empty,
7
- * since CI must not change a recording, and `stale` elsewhere. Any other value of `STORY_RECORD` is a `TypeError`
8
- * naming it.
9
- */
10
- export function resolveStoryRecordLevel(env) {
11
- const value = env[STORY_RECORD_VARIABLE];
12
- if (value === undefined || value === "") {
13
- const ci = env["CI"];
14
- return ci !== undefined && ci !== "" ? "none" : "stale";
15
- }
16
- const level = LEVELS.find((each) => each === value);
17
- if (level === undefined) {
18
- throw new TypeError(`story: ${STORY_RECORD_VARIABLE} must be none, stale or all, or unset, not ${JSON.stringify(value)}`);
19
- }
20
- return level;
21
- }