@scarn/sdk 0.8.17 → 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 (62) hide show
  1. package/dist/{chunk-g2mzg278.js → chunk-0c60x3v8.js} +51 -59
  2. package/dist/{chunk-dhqeg0wf.js → chunk-2tmrw253.js} +1 -1
  3. package/dist/{chunk-r03knh9j.js → chunk-3zp2qtf8.js} +80 -1
  4. package/dist/{chunk-ar6hcj1r.js → chunk-6tra3gw8.js} +7 -1
  5. package/dist/{chunk-a04phj60.js → chunk-833ef6dg.js} +121 -260
  6. package/dist/{chunk-2ekz6tr5.js → chunk-aemxz9r7.js} +18 -2
  7. package/dist/chunk-e0pt5x0e.js +167 -0
  8. package/dist/chunk-mmy80pec.js +64 -0
  9. package/dist/chunk-mzj1j0p5.js +116 -0
  10. package/dist/{chunk-cdj0yqgs.js → chunk-pqtd0hr7.js} +12 -2
  11. package/dist/chunk-qgkx89eg.js +210 -0
  12. package/dist/chunk-rphfy0fj.js +167 -0
  13. package/dist/chunk-t1dq2c2s.js +224 -0
  14. package/dist/{chunk-qs7p11rp.js → chunk-tvjcfh6s.js} +5 -1
  15. package/dist/{chunk-1wnv6rb2.js → chunk-ymywp5ht.js} +1 -1
  16. package/dist/client.js +8 -2
  17. package/dist/connectors/catalog.d.ts +49 -0
  18. package/dist/connectors/index.d.ts +45 -0
  19. package/dist/connectors/index.js +41 -0
  20. package/dist/defaults/index.js +2 -2
  21. package/dist/definitions/automations/index.js +2 -2
  22. package/dist/definitions/environments/define-environment.d.ts +39 -0
  23. package/dist/definitions/environments/environments-client.d.ts +50 -0
  24. package/dist/definitions/environments/index.d.ts +6 -0
  25. package/dist/definitions/environments/index.js +97 -0
  26. package/dist/definitions/pipelines/index.js +2 -2
  27. package/dist/definitions/steps/compile-mcps.d.ts +8 -12
  28. package/dist/definitions/steps/define-code-step.d.ts +18 -11
  29. package/dist/definitions/steps/define-step.d.ts +14 -25
  30. package/dist/definitions/steps/env.d.ts +30 -8
  31. package/dist/definitions/steps/index.js +30 -13
  32. package/dist/definitions/steps/mcp-server-config.d.ts +19 -9
  33. package/dist/definitions/steps/repo.d.ts +56 -28
  34. package/dist/definitions/steps/runtime.d.ts +54 -39
  35. package/dist/definitions/steps/step-definitions-client.d.ts +222 -63
  36. package/dist/definitions/steps/step-handle.d.ts +8 -1
  37. package/dist/definitions/validation/index.js +6 -3
  38. package/dist/definitions/validation/validate-repo.d.ts +3 -7
  39. package/dist/definitions/validation/validate-runtime.d.ts +2 -7
  40. package/dist/env-vars.d.ts +57 -1
  41. package/dist/env-vars.js +7 -1
  42. package/dist/environment.d.ts +564 -0
  43. package/dist/environment.js +46 -0
  44. package/dist/generated/index.d.ts +2 -2
  45. package/dist/generated/sdk.gen.d.ts +26 -1
  46. package/dist/generated/types.gen.d.ts +2090 -187
  47. package/dist/index.d.ts +2 -0
  48. package/dist/index.js +94 -28
  49. package/dist/opencode-mcp.d.ts +75 -4
  50. package/dist/opencode-mcp.js +2 -1
  51. package/dist/push/code-step-lookup.d.ts +6 -0
  52. package/dist/push/code-step-lookup.js +3 -1
  53. package/dist/push/collect-definitions.d.ts +13 -0
  54. package/dist/push/index.js +127 -15
  55. package/dist/push/push-from-directory.d.ts +11 -2
  56. package/dist/repo-config.d.ts +88 -30
  57. package/dist/repo-config.js +21 -5
  58. package/dist/resolve-environment.d.ts +19 -0
  59. package/dist/resolve-environment.js +19 -0
  60. package/dist/task-plane-client.d.ts +124 -22
  61. package/package.json +17 -1
  62. package/dist/chunk-2sk92cnd.js +0 -103
@@ -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,11 +3,14 @@ import {
3
3
  assertValidDefinitionSpecs,
4
4
  listPaths,
5
5
  validateDefinitionSpecs
6
- } from "../../chunk-g2mzg278.js";
7
- import"../../chunk-2ekz6tr5.js";
6
+ } from "../../chunk-0c60x3v8.js";
7
+ import"../../chunk-rphfy0fj.js";
8
+ import"../../chunk-e0pt5x0e.js";
8
9
  import"../../chunk-098740f7.js";
9
10
  import"../../chunk-46wmsgv7.js";
10
- import"../../chunk-2sk92cnd.js";
11
+ import"../../chunk-qgkx89eg.js";
12
+ import"../../chunk-pqtd0hr7.js";
13
+ import"../../chunk-aemxz9r7.js";
11
14
  import"../../chunk-ngy1fdcx.js";
12
15
  import"../../chunk-19brnwkp.js";
13
16
  import"../../chunk-yf15kdte.js";
@@ -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[];
@@ -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,10 +12,13 @@ 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-2ekz6tr5.js";
21
+ } from "./chunk-aemxz9r7.js";
19
22
  import"./chunk-yf15kdte.js";
20
23
  import"./chunk-y64skrwp.js";
21
24
  export {
@@ -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
  };