@scarn/sdk 0.8.15 → 0.8.18

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 (82) hide show
  1. package/dist/automations/index.js +4 -4
  2. package/dist/{chunk-4ggr8af6.js → chunk-098740f7.js} +1 -1
  3. package/dist/{chunk-1yb2h6t9.js → chunk-0c60x3v8.js} +53 -61
  4. package/dist/{chunk-y2pv8d6a.js → chunk-19brnwkp.js} +1 -1
  5. package/dist/{chunk-b8hxjwag.js → chunk-2tmrw253.js} +2 -2
  6. package/dist/{chunk-z25n32z0.js → chunk-3zp2qtf8.js} +88 -9
  7. package/dist/{chunk-k4y5qt4y.js → chunk-46wmsgv7.js} +1 -1
  8. package/dist/{chunk-ar6hcj1r.js → chunk-6tra3gw8.js} +7 -1
  9. package/dist/{chunk-zf4gwg0p.js → chunk-833ef6dg.js} +170 -269
  10. package/dist/{chunk-11hbmexe.js → chunk-9we3vqsv.js} +1 -1
  11. package/dist/{chunk-5zsavw98.js → chunk-aemxz9r7.js} +19 -3
  12. package/dist/{chunk-43y7tfn4.js → chunk-aknfw08j.js} +1 -1
  13. package/dist/chunk-e0pt5x0e.js +167 -0
  14. package/dist/{chunk-cnxaagfj.js → chunk-evb3hw48.js} +1 -1
  15. package/dist/chunk-mmy80pec.js +64 -0
  16. package/dist/chunk-mzj1j0p5.js +116 -0
  17. package/dist/{chunk-76d1bwwz.js → chunk-p1fs73bd.js} +2 -2
  18. package/dist/{chunk-e1h021kq.js → chunk-pqtd0hr7.js} +13 -3
  19. package/dist/chunk-qgkx89eg.js +210 -0
  20. package/dist/chunk-rphfy0fj.js +167 -0
  21. package/dist/chunk-t1dq2c2s.js +224 -0
  22. package/dist/{chunk-7bpy3w3z.js → chunk-tvjcfh6s.js} +5 -1
  23. package/dist/{chunk-63f90zky.js → chunk-y34zsgsw.js} +1 -1
  24. package/dist/{chunk-skzxcba3.js → chunk-yf15kdte.js} +7087 -1944
  25. package/dist/{chunk-efs789y2.js → chunk-ymywp5ht.js} +2 -2
  26. package/dist/client.js +8 -2
  27. package/dist/connectors/catalog.d.ts +49 -0
  28. package/dist/connectors/index.d.ts +45 -0
  29. package/dist/connectors/index.js +41 -0
  30. package/dist/contracts/artifacts.js +2 -2
  31. package/dist/contracts/automation-document/index.js +3 -3
  32. package/dist/contracts/pipeline-document/index.js +2 -2
  33. package/dist/contracts/step-artifact-submissions.js +2 -2
  34. package/dist/contracts/work-item-changes.js +1 -1
  35. package/dist/defaults/index.js +2 -2
  36. package/dist/definitions/automations/index.js +3 -3
  37. package/dist/definitions/environments/define-environment.d.ts +39 -0
  38. package/dist/definitions/environments/environments-client.d.ts +50 -0
  39. package/dist/definitions/environments/index.d.ts +6 -0
  40. package/dist/definitions/environments/index.js +97 -0
  41. package/dist/definitions/pipelines/index.js +3 -3
  42. package/dist/definitions/steps/compile-mcps.d.ts +8 -12
  43. package/dist/definitions/steps/define-code-step.d.ts +18 -11
  44. package/dist/definitions/steps/define-step.d.ts +14 -25
  45. package/dist/definitions/steps/env.d.ts +30 -8
  46. package/dist/definitions/steps/index.js +35 -18
  47. package/dist/definitions/steps/mcp-server-config.d.ts +19 -9
  48. package/dist/definitions/steps/repo.d.ts +56 -28
  49. package/dist/definitions/steps/runtime.d.ts +54 -39
  50. package/dist/definitions/steps/step-definitions-client.d.ts +222 -63
  51. package/dist/definitions/steps/step-handle.d.ts +8 -1
  52. package/dist/definitions/validation/index.js +10 -7
  53. package/dist/definitions/validation/validate-repo.d.ts +3 -7
  54. package/dist/definitions/validation/validate-runtime.d.ts +2 -7
  55. package/dist/devcontainer-config-path.js +2 -2
  56. package/dist/env-vars.d.ts +57 -1
  57. package/dist/env-vars.js +8 -2
  58. package/dist/environment.d.ts +564 -0
  59. package/dist/environment.js +46 -0
  60. package/dist/generated/index.d.ts +2 -2
  61. package/dist/generated/sdk.gen.d.ts +35 -10
  62. package/dist/generated/types.gen.d.ts +2151 -188
  63. package/dist/health-checks.d.ts +3 -3
  64. package/dist/health-checks.js +2 -2
  65. package/dist/index.d.ts +2 -0
  66. package/dist/index.js +100 -34
  67. package/dist/managed-runtimes.js +2 -2
  68. package/dist/opencode-mcp.d.ts +75 -4
  69. package/dist/opencode-mcp.js +3 -2
  70. package/dist/pipelines/index.js +3 -3
  71. package/dist/push/code-step-lookup.d.ts +6 -0
  72. package/dist/push/code-step-lookup.js +3 -1
  73. package/dist/push/collect-definitions.d.ts +13 -0
  74. package/dist/push/index.js +132 -20
  75. package/dist/push/push-from-directory.d.ts +11 -2
  76. package/dist/repo-config.d.ts +88 -30
  77. package/dist/repo-config.js +22 -6
  78. package/dist/resolve-environment.d.ts +19 -0
  79. package/dist/resolve-environment.js +19 -0
  80. package/dist/task-plane-client.d.ts +139 -22
  81. package/package.json +17 -1
  82. package/dist/chunk-xzx08r6y.js +0 -103
@@ -20,7 +20,43 @@ declare const buildStepDefinitionsClient: (stepDefinitions: StepDefinitions) =>
20
20
  entrypointJson: {
21
21
  sourceFile: string;
22
22
  } | null;
23
- executionMode: "workspace" | "no_workspace";
23
+ environment: {
24
+ kind: "named";
25
+ name: string;
26
+ } | {
27
+ kind: "inline";
28
+ runtime?: {
29
+ kind: "devcontainer";
30
+ config?: string;
31
+ } | {
32
+ kind: "managed";
33
+ id: "bun1" | "node24";
34
+ } | {
35
+ kind: "host";
36
+ };
37
+ envJson?: Array<{
38
+ name: string;
39
+ source: "value";
40
+ value: string;
41
+ secret: boolean;
42
+ applies: "agent" | "setup" | "both";
43
+ } | {
44
+ name: string;
45
+ source: "inherit";
46
+ from: string;
47
+ secret: boolean;
48
+ optional: boolean;
49
+ default?: string;
50
+ mcp?: string;
51
+ applies: "agent" | "setup" | "both";
52
+ } | {
53
+ name: string;
54
+ source: "secret";
55
+ secretName: string;
56
+ applies: "agent" | "setup" | "both";
57
+ }> | null;
58
+ connectors?: Array<string>;
59
+ } | null;
24
60
  inputSchemaJson: {
25
61
  [key: string]: unknown;
26
62
  };
@@ -84,6 +120,16 @@ declare const buildStepDefinitionsClient: (stepDefinitions: StepDefinitions) =>
84
120
  execution?: number;
85
121
  };
86
122
  protocol?: "legacy" | "auto" | "2026-07-28";
123
+ workerVars?: Array<{
124
+ name: string;
125
+ source: "inherit";
126
+ from: string;
127
+ secret: boolean;
128
+ optional: boolean;
129
+ default?: string;
130
+ mcp?: string;
131
+ applies: "agent";
132
+ }>;
87
133
  } | {
88
134
  type: "remote";
89
135
  url: string;
@@ -106,9 +152,29 @@ declare const buildStepDefinitionsClient: (stepDefinitions: StepDefinitions) =>
106
152
  execution?: number;
107
153
  };
108
154
  protocol?: "legacy" | "auto" | "2026-07-28";
155
+ workerVars?: Array<{
156
+ name: string;
157
+ source: "inherit";
158
+ from: string;
159
+ secret: boolean;
160
+ optional: boolean;
161
+ default?: string;
162
+ mcp?: string;
163
+ applies: "agent";
164
+ }>;
109
165
  } | {
110
166
  type: "ref";
111
167
  name?: string;
168
+ workerVars?: Array<{
169
+ name: string;
170
+ source: "inherit";
171
+ from: string;
172
+ secret: boolean;
173
+ optional: boolean;
174
+ default?: string;
175
+ mcp?: string;
176
+ applies: "agent";
177
+ }>;
112
178
  disabled?: boolean;
113
179
  codemode?: boolean;
114
180
  timeout?: {
@@ -139,34 +205,21 @@ declare const buildStepDefinitionsClient: (stepDefinitions: StepDefinitions) =>
139
205
  command: Array<string>;
140
206
  expectExitCode: number;
141
207
  }> | null;
142
- envJson: Array<{
143
- name: string;
144
- source: "value";
145
- value: string;
146
- secret: boolean;
147
- applies: "agent" | "setup" | "both";
148
- } | {
149
- name: string;
150
- source: "inherit";
151
- from: string;
152
- secret: boolean;
153
- optional: boolean;
154
- default?: string;
155
- mcp?: string;
156
- applies: "agent" | "setup" | "both";
157
- }> | null;
158
- devcontainerConfigPath: string | null;
159
- managedRuntime: "bun1" | "node24" | null;
160
208
  repo: {
161
- mode: "none";
162
- } | {
163
209
  mode: "readOnly";
164
210
  gitCredentials: "auto" | "none";
211
+ baseBranch: string | null;
165
212
  } | {
166
213
  mode: "readWrite";
167
214
  message: string | null;
168
215
  onPushFailure: "fail" | "warn";
169
216
  gitCredentials: "auto" | "none";
217
+ baseBranch: string | null;
218
+ workBranch: {
219
+ kind: "create";
220
+ } | {
221
+ kind: "base";
222
+ };
170
223
  };
171
224
  status: "draft" | "active" | "archived";
172
225
  createdAt: string;
@@ -184,7 +237,43 @@ declare const buildStepDefinitionsClient: (stepDefinitions: StepDefinitions) =>
184
237
  entrypointJson: {
185
238
  sourceFile: string;
186
239
  } | null;
187
- executionMode: "workspace" | "no_workspace";
240
+ environment: {
241
+ kind: "named";
242
+ name: string;
243
+ } | {
244
+ kind: "inline";
245
+ runtime?: {
246
+ kind: "devcontainer";
247
+ config?: string;
248
+ } | {
249
+ kind: "managed";
250
+ id: "bun1" | "node24";
251
+ } | {
252
+ kind: "host";
253
+ };
254
+ envJson?: Array<{
255
+ name: string;
256
+ source: "value";
257
+ value: string;
258
+ secret: boolean;
259
+ applies: "agent" | "setup" | "both";
260
+ } | {
261
+ name: string;
262
+ source: "inherit";
263
+ from: string;
264
+ secret: boolean;
265
+ optional: boolean;
266
+ default?: string;
267
+ mcp?: string;
268
+ applies: "agent" | "setup" | "both";
269
+ } | {
270
+ name: string;
271
+ source: "secret";
272
+ secretName: string;
273
+ applies: "agent" | "setup" | "both";
274
+ }> | null;
275
+ connectors?: Array<string>;
276
+ } | null;
188
277
  inputSchemaJson: {
189
278
  [key: string]: unknown;
190
279
  };
@@ -248,6 +337,16 @@ declare const buildStepDefinitionsClient: (stepDefinitions: StepDefinitions) =>
248
337
  execution?: number;
249
338
  };
250
339
  protocol?: "legacy" | "auto" | "2026-07-28";
340
+ workerVars?: Array<{
341
+ name: string;
342
+ source: "inherit";
343
+ from: string;
344
+ secret: boolean;
345
+ optional: boolean;
346
+ default?: string;
347
+ mcp?: string;
348
+ applies: "agent";
349
+ }>;
251
350
  } | {
252
351
  type: "remote";
253
352
  url: string;
@@ -270,9 +369,29 @@ declare const buildStepDefinitionsClient: (stepDefinitions: StepDefinitions) =>
270
369
  execution?: number;
271
370
  };
272
371
  protocol?: "legacy" | "auto" | "2026-07-28";
372
+ workerVars?: Array<{
373
+ name: string;
374
+ source: "inherit";
375
+ from: string;
376
+ secret: boolean;
377
+ optional: boolean;
378
+ default?: string;
379
+ mcp?: string;
380
+ applies: "agent";
381
+ }>;
273
382
  } | {
274
383
  type: "ref";
275
384
  name?: string;
385
+ workerVars?: Array<{
386
+ name: string;
387
+ source: "inherit";
388
+ from: string;
389
+ secret: boolean;
390
+ optional: boolean;
391
+ default?: string;
392
+ mcp?: string;
393
+ applies: "agent";
394
+ }>;
276
395
  disabled?: boolean;
277
396
  codemode?: boolean;
278
397
  timeout?: {
@@ -303,34 +422,21 @@ declare const buildStepDefinitionsClient: (stepDefinitions: StepDefinitions) =>
303
422
  command: Array<string>;
304
423
  expectExitCode: number;
305
424
  }> | null;
306
- envJson: Array<{
307
- name: string;
308
- source: "value";
309
- value: string;
310
- secret: boolean;
311
- applies: "agent" | "setup" | "both";
312
- } | {
313
- name: string;
314
- source: "inherit";
315
- from: string;
316
- secret: boolean;
317
- optional: boolean;
318
- default?: string;
319
- mcp?: string;
320
- applies: "agent" | "setup" | "both";
321
- }> | null;
322
- devcontainerConfigPath: string | null;
323
- managedRuntime: "bun1" | "node24" | null;
324
425
  repo: {
325
- mode: "none";
326
- } | {
327
426
  mode: "readOnly";
328
427
  gitCredentials: "auto" | "none";
428
+ baseBranch: string | null;
329
429
  } | {
330
430
  mode: "readWrite";
331
431
  message: string | null;
332
432
  onPushFailure: "fail" | "warn";
333
433
  gitCredentials: "auto" | "none";
434
+ baseBranch: string | null;
435
+ workBranch: {
436
+ kind: "create";
437
+ } | {
438
+ kind: "base";
439
+ };
334
440
  };
335
441
  status: "draft" | "active" | "archived";
336
442
  createdAt: string;
@@ -358,7 +464,43 @@ declare const buildStepDefinitionsClient: (stepDefinitions: StepDefinitions) =>
358
464
  entrypointJson: {
359
465
  sourceFile: string;
360
466
  } | null;
361
- executionMode: "workspace" | "no_workspace";
467
+ environment: {
468
+ kind: "named";
469
+ name: string;
470
+ } | {
471
+ kind: "inline";
472
+ runtime?: {
473
+ kind: "devcontainer";
474
+ config?: string;
475
+ } | {
476
+ kind: "managed";
477
+ id: "bun1" | "node24";
478
+ } | {
479
+ kind: "host";
480
+ };
481
+ envJson?: Array<{
482
+ name: string;
483
+ source: "value";
484
+ value: string;
485
+ secret: boolean;
486
+ applies: "agent" | "setup" | "both";
487
+ } | {
488
+ name: string;
489
+ source: "inherit";
490
+ from: string;
491
+ secret: boolean;
492
+ optional: boolean;
493
+ default?: string;
494
+ mcp?: string;
495
+ applies: "agent" | "setup" | "both";
496
+ } | {
497
+ name: string;
498
+ source: "secret";
499
+ secretName: string;
500
+ applies: "agent" | "setup" | "both";
501
+ }> | null;
502
+ connectors?: Array<string>;
503
+ } | null;
362
504
  inputSchemaJson: {
363
505
  [key: string]: unknown;
364
506
  };
@@ -422,6 +564,16 @@ declare const buildStepDefinitionsClient: (stepDefinitions: StepDefinitions) =>
422
564
  execution?: number;
423
565
  };
424
566
  protocol?: "legacy" | "auto" | "2026-07-28";
567
+ workerVars?: Array<{
568
+ name: string;
569
+ source: "inherit";
570
+ from: string;
571
+ secret: boolean;
572
+ optional: boolean;
573
+ default?: string;
574
+ mcp?: string;
575
+ applies: "agent";
576
+ }>;
425
577
  } | {
426
578
  type: "remote";
427
579
  url: string;
@@ -444,9 +596,29 @@ declare const buildStepDefinitionsClient: (stepDefinitions: StepDefinitions) =>
444
596
  execution?: number;
445
597
  };
446
598
  protocol?: "legacy" | "auto" | "2026-07-28";
599
+ workerVars?: Array<{
600
+ name: string;
601
+ source: "inherit";
602
+ from: string;
603
+ secret: boolean;
604
+ optional: boolean;
605
+ default?: string;
606
+ mcp?: string;
607
+ applies: "agent";
608
+ }>;
447
609
  } | {
448
610
  type: "ref";
449
611
  name?: string;
612
+ workerVars?: Array<{
613
+ name: string;
614
+ source: "inherit";
615
+ from: string;
616
+ secret: boolean;
617
+ optional: boolean;
618
+ default?: string;
619
+ mcp?: string;
620
+ applies: "agent";
621
+ }>;
450
622
  disabled?: boolean;
451
623
  codemode?: boolean;
452
624
  timeout?: {
@@ -477,34 +649,21 @@ declare const buildStepDefinitionsClient: (stepDefinitions: StepDefinitions) =>
477
649
  command: Array<string>;
478
650
  expectExitCode: number;
479
651
  }> | null;
480
- envJson: Array<{
481
- name: string;
482
- source: "value";
483
- value: string;
484
- secret: boolean;
485
- applies: "agent" | "setup" | "both";
486
- } | {
487
- name: string;
488
- source: "inherit";
489
- from: string;
490
- secret: boolean;
491
- optional: boolean;
492
- default?: string;
493
- mcp?: string;
494
- applies: "agent" | "setup" | "both";
495
- }> | null;
496
- devcontainerConfigPath: string | null;
497
- managedRuntime: "bun1" | "node24" | null;
498
652
  repo: {
499
- mode: "none";
500
- } | {
501
653
  mode: "readOnly";
502
654
  gitCredentials: "auto" | "none";
655
+ baseBranch: string | null;
503
656
  } | {
504
657
  mode: "readWrite";
505
658
  message: string | null;
506
659
  onPushFailure: "fail" | "warn";
507
660
  gitCredentials: "auto" | "none";
661
+ baseBranch: string | null;
662
+ workBranch: {
663
+ kind: "create";
664
+ } | {
665
+ kind: "base";
666
+ };
508
667
  };
509
668
  status: "draft" | "active" | "archived";
510
669
  createdAt: string;
@@ -1,5 +1,6 @@
1
1
  import type { PipelineStep } from "../../pipelines/types";
2
2
  import type { StepConcurrency, StepDefinitionSpec, StepRetryEntry } from "./define-step";
3
+ import type { EnvironmentHandle } from "../environments/define-environment";
3
4
  export type StepHandle<TInput = unknown, TResult = unknown, TErrors extends string = string> = PipelineStep<TInput, TResult, TErrors> & Omit<StepDefinitionSpec, "errors">;
4
5
  /**
5
6
  * Checks a step's declared error names: non-empty and unique, the same rules
@@ -23,8 +24,14 @@ export declare function compileStepConcurrency(stepKey: string, concurrency: Ste
23
24
  * Wraps a compiled spec in a callable handle. `name` is set with
24
25
  * `Object.defineProperty` because a function's own `name` is read-only. The
25
26
  * pipeline chain methods are non-enumerable, so they aren't spec fields.
27
+ *
28
+ * `environmentHandle` is the `defineEnvironment` handle the step was given,
29
+ * kept as a non-enumerable `environmentHandle` property so push can find
30
+ * environments that aren't exported. `toStepSpec` drops it.
26
31
  */
27
- export declare function toStepHandle(spec: StepDefinitionSpec): StepHandle;
32
+ export declare function toStepHandle(spec: StepDefinitionSpec, environmentHandle?: EnvironmentHandle): StepHandle;
33
+ /** The `defineEnvironment` handle a step handle was given, if any. */
34
+ export declare function stepEnvironmentHandle(step: unknown): EnvironmentHandle | undefined;
28
35
  /**
29
36
  * The plain, serializable spec behind a step handle: its own enumerable
30
37
  * fields, in a new object. Accepts a plain spec too, and copies it.
@@ -3,14 +3,17 @@ import {
3
3
  assertValidDefinitionSpecs,
4
4
  listPaths,
5
5
  validateDefinitionSpecs
6
- } from "../../chunk-1yb2h6t9.js";
7
- import"../../chunk-5zsavw98.js";
8
- import"../../chunk-4ggr8af6.js";
9
- import"../../chunk-k4y5qt4y.js";
10
- import"../../chunk-xzx08r6y.js";
6
+ } from "../../chunk-0c60x3v8.js";
7
+ import"../../chunk-rphfy0fj.js";
8
+ import"../../chunk-e0pt5x0e.js";
9
+ import"../../chunk-098740f7.js";
10
+ import"../../chunk-46wmsgv7.js";
11
+ import"../../chunk-qgkx89eg.js";
12
+ import"../../chunk-pqtd0hr7.js";
13
+ import"../../chunk-aemxz9r7.js";
11
14
  import"../../chunk-ngy1fdcx.js";
12
- import"../../chunk-y2pv8d6a.js";
13
- import"../../chunk-skzxcba3.js";
15
+ import"../../chunk-19brnwkp.js";
16
+ import"../../chunk-yf15kdte.js";
14
17
  import"../../chunk-y64skrwp.js";
15
18
  export {
16
19
  assertValidDefinitionSpecs,
@@ -2,12 +2,8 @@ import type { StepDefinitionSpec } from "../steps/define-step";
2
2
  import type { DefinitionValidationIssue } from "./validation-issue";
3
3
  /**
4
4
  * Check: a step's `repo` satisfies `repoConfigInputSchema` (shape, commit
5
- * message length, single line, `{{input.…}}` / `{{result.…}}` tokens only) and
6
- * suits its runtime: `readOnly` and `readWrite` need a clone, so they are
7
- * rejected on a host (`no_workspace`) step, and `none` is rejected on a
8
- * `workspace` step, which reads its devcontainer config from the clone. The
9
- * authoring helpers (`Repo`, `compileRepo`) and `StepEnvironment`'s types
10
- * already guard these at definition time; this catches hand-built or generated
11
- * specs that bypass them.
5
+ * message length, single line and allowed template tokens). Every runtime
6
+ * accepts `readOnly` and `readWrite`. This catches hand-built or generated
7
+ * specs that bypass the authoring helpers.
12
8
  */
13
9
  export declare function checkRepo(steps: readonly StepDefinitionSpec[]): DefinitionValidationIssue[];
@@ -1,12 +1,7 @@
1
1
  import type { StepDefinitionSpec } from "../steps/define-step";
2
2
  import type { DefinitionValidationIssue } from "./validation-issue";
3
3
  /**
4
- * Check: a step's `devcontainerConfigPath` satisfies the shared path schema and
5
- * is only set on a `workspace` step, a `code` step is not a host
6
- * (`no_workspace`) step, and a step's `managedRuntime` is valid (see
7
- * `checkManagedRuntime`). `Runtime` already makes host plus a config path
8
- * unrepresentable and guards the path at definition time, and `codeStep`'s
9
- * types exclude the host runtime; this catches hand-built or generated specs
10
- * that bypass them.
4
+ * Validates inline runtimes in hand-built or generated specs and rejects host
5
+ * execution for code steps, which require a container.
11
6
  */
12
7
  export declare function checkRuntime(steps: readonly StepDefinitionSpec[]): DefinitionValidationIssue[];
@@ -4,8 +4,8 @@ import {
4
4
  MAX_DEVCONTAINER_CONFIG_PATH_LENGTH,
5
5
  devcontainerConfigPathSchema,
6
6
  normalizeDevcontainerConfigPath
7
- } from "./chunk-4ggr8af6.js";
8
- import"./chunk-skzxcba3.js";
7
+ } from "./chunk-098740f7.js";
8
+ import"./chunk-yf15kdte.js";
9
9
  import"./chunk-y64skrwp.js";
10
10
  export {
11
11
  DEVCONTAINER_CONFIG_BASENAMES,
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  /**
3
3
  * Wire schema for a step's declared environment variables (`envJson`).
4
4
  *
5
- * A step declares each variable one of two ways, discriminated on `source`:
5
+ * A step declares each variable one of three ways, discriminated on `source`:
6
6
  *
7
7
  * - `value`: a literal or `{{input.…}}` template, stored in the definition
8
8
  * and rendered per run. `secret` only controls log masking.
@@ -10,6 +10,9 @@ import { z } from "zod";
10
10
  * then `process.env`). Only the variable *name* is stored. `mcp`, when set,
11
11
  * is the step's `opencodeMcpJson` key of the ref'd MCP server the variable
12
12
  * belongs to; absent means a plain step variable.
13
+ * - `secret`: a project secret saved in Scarn, looked up by `secretName` at
14
+ * run time (`.scarn/.env` on the worker, then Scarn; never `process.env`).
15
+ * Only the secret's name is stored. Always masked; never has a default.
13
16
  *
14
17
  * `applies` says which process a variable reaches (default `agent`):
15
18
  *
@@ -47,6 +50,30 @@ export declare function appliesToSetup(applies: EnvVarApplies): boolean;
47
50
  * must never be copied into a step's agent container.
48
51
  */
49
52
  export declare function isUninheritableWorkerEnvVarName(name: string): boolean;
53
+ export declare const inheritEnvVarSchema: z.ZodObject<{
54
+ name: z.ZodString;
55
+ source: z.ZodLiteral<"inherit">;
56
+ from: z.ZodString;
57
+ secret: z.ZodBoolean;
58
+ optional: z.ZodBoolean;
59
+ default: z.ZodOptional<z.ZodString>;
60
+ mcp: z.ZodOptional<z.ZodString>;
61
+ applies: z.ZodDefault<z.ZodEnum<{
62
+ agent: "agent";
63
+ setup: "setup";
64
+ both: "both";
65
+ }>>;
66
+ }, z.core.$strict>;
67
+ export declare const secretEnvVarSchema: z.ZodObject<{
68
+ name: z.ZodString;
69
+ source: z.ZodLiteral<"secret">;
70
+ secretName: z.ZodString;
71
+ applies: z.ZodDefault<z.ZodEnum<{
72
+ agent: "agent";
73
+ setup: "setup";
74
+ both: "both";
75
+ }>>;
76
+ }, z.core.$strict>;
50
77
  export declare const envVarSpecSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
51
78
  name: z.ZodString;
52
79
  source: z.ZodLiteral<"value">;
@@ -70,7 +97,18 @@ export declare const envVarSpecSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
70
97
  setup: "setup";
71
98
  both: "both";
72
99
  }>>;
100
+ }, z.core.$strict>, z.ZodObject<{
101
+ name: z.ZodString;
102
+ source: z.ZodLiteral<"secret">;
103
+ secretName: z.ZodString;
104
+ applies: z.ZodDefault<z.ZodEnum<{
105
+ agent: "agent";
106
+ setup: "setup";
107
+ both: "both";
108
+ }>>;
73
109
  }, z.core.$strict>], "source">;
110
+ /** True when the variable's value must be masked in logs. */
111
+ export declare function isMaskedEnvVar(entry: EnvVarSpec): boolean;
74
112
  /**
75
113
  * The full value of a step's `envJson`: a bounded list of uniquely named
76
114
  * entries.
@@ -98,6 +136,15 @@ export declare const envVarsSchema: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObj
98
136
  setup: "setup";
99
137
  both: "both";
100
138
  }>>;
139
+ }, z.core.$strict>, z.ZodObject<{
140
+ name: z.ZodString;
141
+ source: z.ZodLiteral<"secret">;
142
+ secretName: z.ZodString;
143
+ applies: z.ZodDefault<z.ZodEnum<{
144
+ agent: "agent";
145
+ setup: "setup";
146
+ both: "both";
147
+ }>>;
101
148
  }, z.core.$strict>], "source">>;
102
149
  /**
103
150
  * Read-side schema for `envJson` as persisted and served. Structural only:
@@ -130,6 +177,15 @@ export declare const storedEnvVarsSchema: z.ZodArray<z.ZodDiscriminatedUnion<[z.
130
177
  setup: "setup";
131
178
  both: "both";
132
179
  }>>;
180
+ }, z.core.$strip>, z.ZodObject<{
181
+ name: z.ZodString;
182
+ source: z.ZodLiteral<"secret">;
183
+ secretName: z.ZodString;
184
+ applies: z.ZodDefault<z.ZodEnum<{
185
+ agent: "agent";
186
+ setup: "setup";
187
+ both: "both";
188
+ }>>;
133
189
  }, z.core.$strip>], "source">>;
134
190
  export type EnvVarSpec = z.output<typeof envVarSpecSchema>;
135
191
  export type EnvVarSpecInput = z.input<typeof envVarSpecSchema>;
package/dist/env-vars.js CHANGED
@@ -12,11 +12,14 @@ import {
12
12
  envVarAppliesValues,
13
13
  envVarSpecSchema,
14
14
  envVarsSchema,
15
+ inheritEnvVarSchema,
16
+ isMaskedEnvVar,
15
17
  isReservedEnvVarName,
16
18
  isUninheritableWorkerEnvVarName,
19
+ secretEnvVarSchema,
17
20
  storedEnvVarsSchema
18
- } from "./chunk-5zsavw98.js";
19
- import"./chunk-skzxcba3.js";
21
+ } from "./chunk-aemxz9r7.js";
22
+ import"./chunk-yf15kdte.js";
20
23
  import"./chunk-y64skrwp.js";
21
24
  export {
22
25
  ENV_VAR_NAME_PATTERN,
@@ -31,7 +34,10 @@ export {
31
34
  envVarAppliesValues,
32
35
  envVarSpecSchema,
33
36
  envVarsSchema,
37
+ inheritEnvVarSchema,
38
+ isMaskedEnvVar,
34
39
  isReservedEnvVarName,
35
40
  isUninheritableWorkerEnvVarName,
41
+ secretEnvVarSchema,
36
42
  storedEnvVarsSchema
37
43
  };