@scarn/sdk 0.8.20 → 0.8.22

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 (102) hide show
  1. package/dist/auth/api-token-cache.d.ts +24 -0
  2. package/dist/auth/api-token-source.d.ts +39 -0
  3. package/dist/auth/authenticated-fetch.d.ts +10 -0
  4. package/dist/auth/index.d.ts +3 -0
  5. package/dist/auth/index.js +19 -0
  6. package/dist/automations/index.js +14 -17
  7. package/dist/{chunk-habmdf89.js → chunk-0bwsjn0b.js} +29 -29
  8. package/dist/{chunk-mzj1j0p5.js → chunk-0w13kxkr.js} +34 -31
  9. package/dist/{chunk-qgkx89eg.js → chunk-3j5wf2t5.js} +44 -43
  10. package/dist/{chunk-0y2fy5en.js → chunk-4361gxk0.js} +7 -7
  11. package/dist/{chunk-n3ywwx7n.js → chunk-52520csz.js} +15 -14
  12. package/dist/chunk-5dnfgyx8.js +159 -0
  13. package/dist/{chunk-tr3v83cn.js → chunk-5fa4arn1.js} +18 -11
  14. package/dist/{chunk-ngy1fdcx.js → chunk-631ffb6r.js} +10 -10
  15. package/dist/{chunk-01nfqm18.js → chunk-7anj08zc.js} +11 -9
  16. package/dist/{chunk-yq0sf8sb.js → chunk-7dr4kybf.js} +483 -451
  17. package/dist/chunk-7mhr5aex.js +171 -0
  18. package/dist/chunk-7rywbqzz.js +27 -0
  19. package/dist/{chunk-yf15kdte.js → chunk-9ct3xypr.js} +2636 -3864
  20. package/dist/chunk-9geh4c3v.js +1034 -0
  21. package/dist/{chunk-19brnwkp.js → chunk-9qf0eg7m.js} +19 -19
  22. package/dist/{chunk-y11p1q7r.js → chunk-aqqywy8g.js} +4 -4
  23. package/dist/chunk-bcvx11fn.js +174 -0
  24. package/dist/{chunk-z4smq8qd.js → chunk-cyfeaz43.js} +86 -86
  25. package/dist/chunk-czq37rrt.js +286 -0
  26. package/dist/chunk-ec5z8bbq.js +126 -0
  27. package/dist/{chunk-rt9tq4j6.js → chunk-h9yxx0hd.js} +7 -7
  28. package/dist/{chunk-t1dq2c2s.js → chunk-hma87efq.js} +40 -40
  29. package/dist/{chunk-5dny5jg1.js → chunk-hpv234hf.js} +11 -11
  30. package/dist/{chunk-rq5k7m33.js → chunk-k7xnsmp5.js} +182 -97
  31. package/dist/{chunk-91f5gm5z.js → chunk-kbpkpxcn.js} +22 -21
  32. package/dist/{chunk-6tra3gw8.js → chunk-kjn1knb9.js} +7 -7
  33. package/dist/{chunk-g4j5cfpc.js → chunk-p3s7cjfc.js} +17 -16
  34. package/dist/chunk-pq6hrtnb.js +49 -0
  35. package/dist/{chunk-mp2rqtcj.js → chunk-ptpy7nnm.js} +8 -8
  36. package/dist/{chunk-xqfj56m9.js → chunk-vn1rfxma.js} +8 -8
  37. package/dist/chunk-vyv8kvkv.js +113 -0
  38. package/dist/{chunk-0c60x3v8.js → chunk-xe2zgyz7.js} +35 -35
  39. package/dist/chunk-y4dwmhn2.js +14 -0
  40. package/dist/{chunk-098740f7.js → chunk-yypj3zn0.js} +8 -8
  41. package/dist/chunk-yzj1mfpr.js +1515 -0
  42. package/dist/client.d.ts +5 -1
  43. package/dist/client.js +62 -61
  44. package/dist/connectors/index.js +36 -37
  45. package/dist/contracts/artifact-markers.js +11 -12
  46. package/dist/contracts/artifacts.js +21 -23
  47. package/dist/contracts/automation-document/index.js +28 -30
  48. package/dist/contracts/pipeline-document/built-ins.d.ts +1 -1
  49. package/dist/contracts/pipeline-document/index.js +95 -97
  50. package/dist/contracts/step-artifact-submissions.js +20 -17
  51. package/dist/contracts/work-item-changes.js +8 -6
  52. package/dist/create-api-client.d.ts +11 -0
  53. package/dist/defaults/index.js +44 -884
  54. package/dist/defaults/load-push-defaults.d.ts +11 -4
  55. package/dist/defaults/project-ref.d.ts +2 -4
  56. package/dist/definitions/automations/automations-client.d.ts +2 -1
  57. package/dist/definitions/automations/index.js +6 -8
  58. package/dist/definitions/environments/environments-client.d.ts +2 -1
  59. package/dist/definitions/environments/index.js +37 -38
  60. package/dist/definitions/pipelines/index.js +12 -14
  61. package/dist/definitions/pipelines/pipeline-definitions-client.d.ts +2 -1
  62. package/dist/definitions/steps/define-mcp.d.ts +2 -2
  63. package/dist/definitions/steps/index.js +93 -95
  64. package/dist/definitions/steps/mcp-server-config.d.ts +13 -3
  65. package/dist/definitions/steps/step-definitions-client.d.ts +20 -1
  66. package/dist/definitions/validation/index.js +17 -18
  67. package/dist/devcontainer-config-path.js +9 -11
  68. package/dist/env-vars.js +37 -39
  69. package/dist/environment.js +41 -42
  70. package/dist/eslint.js +0 -2
  71. package/dist/generated/index.d.ts +2 -2
  72. package/dist/generated/sdk.gen.d.ts +41 -1
  73. package/dist/generated/types.gen.d.ts +1801 -0
  74. package/dist/git-url/git-repo-identity.js +0 -2
  75. package/dist/health-checks.js +15 -17
  76. package/dist/index.js +364 -358
  77. package/dist/jsonc.js +7 -8
  78. package/dist/managed-connections.d.ts +16 -0
  79. package/dist/managed-connections.js +9 -0
  80. package/dist/managed-runtimes.js +9 -11
  81. package/dist/opencode-mcp.d.ts +55 -1
  82. package/dist/opencode-mcp.js +33 -28
  83. package/dist/pipelines/index.js +78 -81
  84. package/dist/push/code-step-lookup.js +9 -10
  85. package/dist/push/index.d.ts +1 -0
  86. package/dist/push/index.js +109 -79
  87. package/dist/push/push-from-directory.d.ts +9 -1
  88. package/dist/push/pushed-mcp-servers.d.ts +28 -0
  89. package/dist/repo-config.js +41 -43
  90. package/dist/resolve-environment.js +14 -15
  91. package/dist/scarn-config-parser.js +5 -6
  92. package/dist/task-plane-client.d.ts +143 -1
  93. package/package.json +11 -3
  94. package/dist/chunk-46wmsgv7.js +0 -14
  95. package/dist/chunk-a56zc4s5.js +0 -119
  96. package/dist/chunk-aemxz9r7.js +0 -107
  97. package/dist/chunk-b9ja6ss5.js +0 -275
  98. package/dist/chunk-e0pt5x0e.js +0 -167
  99. package/dist/chunk-pqtd0hr7.js +0 -96
  100. package/dist/chunk-rphfy0fj.js +0 -167
  101. package/dist/chunk-y34zsgsw.js +0 -39
  102. package/dist/chunk-y64skrwp.js +0 -17
@@ -1,322 +1,325 @@
1
1
  // @bun
2
2
  import {
3
- stepHealthChecksInputSchema,
4
- toolHealthCheckSchema
5
- } from "./chunk-y34zsgsw.js";
3
+ ARTIFACT_SCHEMA_KEYWORD2
4
+ } from "./chunk-9qf0eg7m.js";
6
5
  import {
7
- Runtime,
8
- compileEnvironment,
9
- createPromptInputProxy,
10
- createPromptTemplateContext,
11
- knownEnvironmentVars
12
- } from "./chunk-t1dq2c2s.js";
6
+ buildArtifactMarker2
7
+ } from "./chunk-631ffb6r.js";
13
8
  import {
14
- isEnvironmentHandle
15
- } from "./chunk-6tra3gw8.js";
9
+ toolHealthCheckSchema2,
10
+ stepHealthChecksInputSchema2
11
+ } from "./chunk-pq6hrtnb.js";
16
12
  import {
17
- makeHandle,
18
- stepCall,
19
- stepNode
20
- } from "./chunk-xqfj56m9.js";
13
+ ENV_VAR_NAME_PATTERN2,
14
+ isReservedEnvVarName2
15
+ } from "./chunk-vyv8kvkv.js";
21
16
  import {
22
- describeBaseBranchEnvProblem,
23
- findBaseBranchEnvProblems,
24
- repoConfigInputSchema
25
- } from "./chunk-rphfy0fj.js";
17
+ DEFAULT_CODE_STEP_RUNTIME_ID2
18
+ } from "./chunk-y4dwmhn2.js";
26
19
  import {
27
- DEFAULT_CODE_STEP_RUNTIME_ID
28
- } from "./chunk-46wmsgv7.js";
20
+ mcpConnectionAuthSchema2,
21
+ openCodeMcpLocalConfigSchema2,
22
+ openCodeMcpRemoteConfigSchema2,
23
+ openCodeMcpRefConfigSchema2,
24
+ remoteConnectionAuthIssues2,
25
+ refConnectionAuthIssues2,
26
+ isEnvPlaceholderValue2,
27
+ collectEnvPlaceholderNames2
28
+ } from "./chunk-5dnfgyx8.js";
29
29
  import {
30
- connectorMcpCollisionMessage,
31
- findConnectorMcpCollisions
32
- } from "./chunk-qgkx89eg.js";
30
+ findConnectorMcpCollisions2,
31
+ connectorMcpCollisionMessage2
32
+ } from "./chunk-3j5wf2t5.js";
33
33
  import {
34
- collectEnvPlaceholderNames,
35
- isEnvPlaceholderValue,
36
- openCodeMcpLocalConfigSchema,
37
- openCodeMcpRefConfigSchema,
38
- openCodeMcpRemoteConfigSchema
39
- } from "./chunk-pqtd0hr7.js";
34
+ createPromptInputProxy2,
35
+ createPromptTemplateContext2,
36
+ Runtime2,
37
+ knownEnvironmentVars2,
38
+ compileEnvironment2
39
+ } from "./chunk-hma87efq.js";
40
40
  import {
41
- ENV_VAR_NAME_PATTERN,
42
- isReservedEnvVarName
43
- } from "./chunk-aemxz9r7.js";
41
+ isEnvironmentHandle2
42
+ } from "./chunk-kjn1knb9.js";
44
43
  import {
45
- StepDefinitions,
46
- createClient
47
- } from "./chunk-rq5k7m33.js";
44
+ findBaseBranchEnvProblems2,
45
+ describeBaseBranchEnvProblem2,
46
+ repoConfigInputSchema2
47
+ } from "./chunk-7mhr5aex.js";
48
48
  import {
49
- buildArtifactMarker
50
- } from "./chunk-ngy1fdcx.js";
49
+ StepDefinitions2,
50
+ createApiClient
51
+ } from "./chunk-k7xnsmp5.js";
51
52
  import {
52
- ARTIFACT_SCHEMA_KEYWORD
53
- } from "./chunk-19brnwkp.js";
53
+ makeHandle,
54
+ stepNode,
55
+ stepCall
56
+ } from "./chunk-vn1rfxma.js";
54
57
  import {
55
- BUILT_IN_ERRORS
56
- } from "./chunk-01nfqm18.js";
58
+ BUILT_IN_ERRORS2
59
+ } from "./chunk-7anj08zc.js";
57
60
  import {
61
+ ZodIssueCode,
62
+ setErrorMap,
63
+ getErrorMap,
64
+ ZodFirstPartyTypeKind,
65
+ exports_iso,
66
+ fromJSONSchema,
67
+ deepPartial,
68
+ input,
69
+ output,
70
+ exports_coerce,
71
+ exports_external
72
+ } from "./chunk-yzj1mfpr.js";
73
+ import {
74
+ __export,
75
+ toZod,
76
+ clone,
77
+ exports_util,
78
+ NEVER,
58
79
  $brand,
59
- $input,
80
+ config,
81
+ flattenError,
82
+ formatError,
83
+ treeifyError,
84
+ prettifyError,
85
+ validate,
86
+ validateAsync,
87
+ exports_regexes,
88
+ getDiscriminatedOption,
89
+ memoizer,
90
+ exports_locales,
60
91
  $output,
92
+ $input,
93
+ registry,
94
+ globalRegistry,
61
95
  INVALID,
62
- NEVER,
63
- TimePrecision,
64
- ZodAny,
65
- ZodArray,
66
- ZodBase64,
67
- ZodBase64URL,
68
- ZodBigInt,
69
- ZodBigIntFormat,
70
- ZodBoolean,
71
- ZodCIDRv4,
72
- ZodCIDRv6,
73
- ZodCUID,
74
- ZodCUID2,
75
- ZodCatch,
76
- ZodCodec,
77
96
  ZodCompileAsyncError,
78
97
  ZodCompileUnsupportedError,
79
- ZodCreditCard,
80
- ZodCustom,
81
- ZodCustomStringFormat,
82
- ZodDate,
83
- ZodDefault,
84
- ZodDiscriminatedUnion,
85
- ZodE164,
86
- ZodEmail,
87
- ZodEmoji,
88
- ZodEnum,
89
- ZodError,
90
- ZodExactOptional,
91
- ZodFile,
92
- ZodFirstPartyTypeKind,
93
- ZodFunction,
94
- ZodGUID,
95
- ZodIBAN,
96
- ZodIPv4,
97
- ZodIPv6,
98
- ZodISODate,
99
- ZodISODateTime,
100
- ZodISODuration,
101
- ZodISOTime,
102
- ZodInstanceOf,
103
- ZodIntersection,
104
- ZodIssueCode,
105
- ZodJWT,
106
- ZodKSUID,
107
- ZodLazy,
108
- ZodLiteral,
109
- ZodMAC,
110
- ZodMap,
111
- ZodNaN,
112
- ZodNanoID,
113
- ZodNever,
114
- ZodNonOptional,
115
- ZodNull,
116
- ZodNullable,
117
- ZodNumber,
118
- ZodNumberFormat,
119
- ZodObject,
120
- ZodOptional,
121
- ZodPipe,
122
- ZodPrefault,
123
- ZodPreprocess,
124
- ZodPromise,
125
- ZodReadonly,
126
- ZodRealError,
127
- ZodRecord,
128
- ZodSet,
129
- ZodString,
130
- ZodStringFormat,
131
- ZodSuccess,
132
- ZodSymbol,
133
- ZodTemplateLiteral,
134
- ZodTransform,
135
- ZodTuple,
136
- ZodType,
137
- ZodULID,
138
- ZodURL,
139
- ZodUUID,
140
- ZodUndefined,
141
- ZodUnion,
142
- ZodUnknown,
143
- ZodVoid,
144
- ZodXID,
145
- ZodXor,
146
- _ZodString,
147
- _catch,
148
- _default,
149
- _endsWith,
150
- _enum,
151
- _function,
152
- _gt,
153
- _gte,
154
- _includes,
155
- _instanceof,
156
- _length,
157
- _lowercase,
98
+ compile,
99
+ withParser,
100
+ TimePrecision,
158
101
  _lt,
159
102
  _lte,
160
- _maxLength,
161
- _maxSize,
162
- _mime,
163
- _minLength,
164
- _minSize,
165
- _multipleOf,
103
+ _gt,
104
+ _gte,
105
+ _positive,
166
106
  _negative,
167
- _nonnegative,
168
107
  _nonpositive,
169
- _normalize,
170
- _null,
171
- _overwrite,
172
- _positive,
173
- _properties,
174
- _property,
175
- _regex,
108
+ _nonnegative,
109
+ _multipleOf,
110
+ _maxSize,
111
+ _minSize,
176
112
  _size,
177
- _slugify,
113
+ _maxLength,
114
+ _minLength,
115
+ _length,
116
+ _regex,
117
+ _lowercase,
118
+ _uppercase,
119
+ _includes,
178
120
  _startsWith,
121
+ _endsWith,
122
+ _property,
123
+ _properties,
124
+ _mime,
125
+ _overwrite,
126
+ _normalize,
127
+ _trim,
179
128
  _toLowerCase,
180
129
  _toUpperCase,
181
- _trim,
182
- _undefined,
183
- _uppercase,
184
- _void,
185
- any,
186
- array,
187
- base64,
188
- base64url,
189
- bigint,
190
- boolean,
191
- check,
192
- cidrv4,
193
- cidrv6,
194
- clone,
195
- codec,
196
- compile,
197
- config,
198
- creditCard,
199
- cuid,
200
- cuid2,
201
- currencyCode,
202
- custom,
203
- date,
130
+ _slugify,
131
+ toJSONSchema,
132
+ exports_core,
133
+ ZodError,
134
+ ZodRealError,
135
+ parse2,
136
+ parseAsync,
137
+ safeParse,
138
+ safeParseAsync,
139
+ encode,
204
140
  decode,
141
+ encodeAsync,
205
142
  decodeAsync,
206
- deepPartial,
207
- describe,
208
- discriminatedUnion,
209
- e164,
143
+ safeEncode,
144
+ safeDecode,
145
+ safeEncodeAsync,
146
+ safeDecodeAsync,
147
+ ZodType,
148
+ _ZodString,
149
+ ZodString,
150
+ string,
151
+ ZodStringFormat,
152
+ ZodISODateTime,
153
+ ZodISODate,
154
+ ZodISOTime,
155
+ ZodISODuration,
156
+ ZodEmail,
210
157
  email,
211
- emoji,
212
- encode,
213
- encodeAsync,
214
- exactOptional,
215
- exports_coerce,
216
- exports_core,
217
- exports_external,
218
- exports_iso,
219
- exports_locales,
220
- exports_regexes,
221
- exports_util,
222
- file,
223
- flattenError,
224
- float32,
225
- float64,
226
- formatError,
227
- fromJSONSchema,
228
- getDiscriminatedOption,
229
- getErrorMap,
230
- globalRegistry,
158
+ ZodGUID,
231
159
  guid,
232
- hash,
233
- hex,
234
- hostname,
160
+ ZodUUID,
161
+ uuid,
162
+ uuidv4,
163
+ uuidv6,
164
+ uuidv7,
165
+ ZodURL,
166
+ url,
235
167
  httpUrl,
168
+ ZodEmoji,
169
+ emoji,
170
+ ZodNanoID,
171
+ nanoid,
172
+ ZodCUID,
173
+ cuid,
174
+ ZodCUID2,
175
+ cuid2,
176
+ ZodULID,
177
+ ulid,
178
+ ZodXID,
179
+ xid,
180
+ ZodKSUID,
181
+ ksuid,
182
+ ZodIPv4,
183
+ ipv4,
184
+ ZodMAC,
185
+ mac,
186
+ ZodIPv6,
187
+ ipv6,
188
+ ZodCIDRv4,
189
+ cidrv4,
190
+ ZodCIDRv6,
191
+ cidrv6,
192
+ ZodBase64,
193
+ base64,
194
+ ZodBase64URL,
195
+ base64url,
196
+ ZodE164,
197
+ e164,
198
+ ZodCreditCard,
199
+ creditCard,
200
+ ZodIBAN,
236
201
  iban,
237
- input,
202
+ ZodJWT,
203
+ jwt,
204
+ ZodCustomStringFormat,
205
+ stringFormat,
206
+ hostname,
207
+ hex,
208
+ currencyCode,
209
+ hash,
210
+ ZodNumber,
211
+ number,
212
+ ZodNumberFormat,
238
213
  int,
214
+ float32,
215
+ float64,
239
216
  int32,
217
+ uint32,
218
+ ZodBoolean,
219
+ boolean,
220
+ ZodBigInt,
221
+ bigint,
222
+ ZodBigIntFormat,
240
223
  int64,
241
- intersection,
242
- invertCodec,
243
- ipv4,
244
- ipv6,
245
- json,
246
- jwt,
224
+ uint64,
225
+ ZodSymbol,
226
+ symbol,
227
+ ZodUndefined,
228
+ _undefined,
229
+ ZodNull,
230
+ _null,
231
+ ZodAny,
232
+ any3,
233
+ ZodUnknown,
234
+ unknown,
235
+ ZodNever,
236
+ never,
237
+ ZodVoid,
238
+ _void,
239
+ ZodDate,
240
+ date,
241
+ ZodArray,
242
+ array,
247
243
  keyof,
248
- ksuid,
249
- lazy,
250
- literal,
244
+ ZodObject,
245
+ object,
246
+ strictObject,
251
247
  looseObject,
248
+ ZodUnion,
249
+ union,
250
+ ZodXor,
251
+ xor,
252
+ ZodDiscriminatedUnion,
253
+ discriminatedUnion,
254
+ ZodIntersection,
255
+ intersection,
256
+ ZodTuple,
257
+ tuple,
258
+ ZodRecord,
259
+ record,
260
+ partialRecord,
252
261
  looseRecord,
253
- mac,
262
+ ZodMap,
254
263
  map,
255
- memoizer,
256
- meta,
257
- nan,
258
- nanoid,
264
+ ZodSet,
265
+ set,
266
+ ZodEnum,
267
+ _enum,
259
268
  nativeEnum,
260
- never,
261
- nonoptional,
269
+ ZodLiteral,
270
+ literal,
271
+ ZodFile,
272
+ file,
273
+ ZodTransform,
274
+ transform,
275
+ ZodOptional,
276
+ optional,
277
+ ZodExactOptional,
278
+ exactOptional,
279
+ ZodNullable,
262
280
  nullable,
263
281
  nullish,
264
- number,
265
- object,
266
- optional,
267
- output,
268
- parse,
269
- parseAsync,
270
- partialRecord,
271
- pipe,
282
+ ZodDefault,
283
+ _default,
284
+ ZodPrefault,
272
285
  prefault,
273
- preprocess,
274
- prettifyError,
275
- promise,
286
+ ZodNonOptional,
287
+ nonoptional,
288
+ ZodSuccess,
289
+ success,
290
+ ZodCatch,
291
+ _catch,
292
+ ZodNaN,
293
+ nan,
294
+ ZodPipe,
295
+ pipe,
296
+ ZodCodec,
297
+ codec,
298
+ invertCodec,
299
+ ZodPreprocess,
300
+ ZodReadonly,
276
301
  readonly,
277
- record,
302
+ ZodTemplateLiteral,
303
+ templateLiteral,
304
+ ZodLazy,
305
+ lazy,
306
+ ZodPromise,
307
+ promise,
308
+ ZodFunction,
309
+ _function,
310
+ ZodCustom,
311
+ check,
312
+ custom,
278
313
  refine,
279
- registry,
280
- safeDecode,
281
- safeDecodeAsync,
282
- safeEncode,
283
- safeEncodeAsync,
284
- safeParse,
285
- safeParseAsync,
286
- set,
287
- setErrorMap,
288
- strictObject,
289
- string,
290
- stringFormat,
291
- stringbool,
292
- success,
293
314
  superRefine,
294
- symbol,
295
- templateLiteral,
296
- toJSONSchema,
297
- toZod,
298
- transform,
299
- treeifyError,
300
- tuple,
301
- uint32,
302
- uint64,
303
- ulid,
304
- union,
305
- unknown,
306
- url,
307
- uuid,
308
- uuidv4,
309
- uuidv6,
310
- uuidv7,
311
- validate,
312
- validateAsync,
313
- withParser,
314
- xid,
315
- xor
316
- } from "./chunk-yf15kdte.js";
317
- import {
318
- __export
319
- } from "./chunk-y64skrwp.js";
315
+ describe,
316
+ meta,
317
+ ZodInstanceOf,
318
+ _instanceof,
319
+ stringbool,
320
+ json,
321
+ preprocess
322
+ } from "./chunk-9ct3xypr.js";
320
323
 
321
324
  // src/z.ts
322
325
  var exports_z = {};
@@ -412,9 +415,9 @@ __export(exports_z, {
412
415
  _ZodString: () => _ZodString,
413
416
  _default: () => _default,
414
417
  _function: () => _function,
415
- any: () => any,
418
+ any: () => any3,
416
419
  array: () => array,
417
- artifact: () => artifact,
420
+ artifact: () => artifact2,
418
421
  base64: () => base64,
419
422
  base64url: () => base64url,
420
423
  bigint: () => bigint,
@@ -517,7 +520,7 @@ __export(exports_z, {
517
520
  optional: () => optional,
518
521
  output: () => output,
519
522
  overwrite: () => _overwrite,
520
- parse: () => parse,
523
+ parse: () => parse2,
521
524
  parseAsync: () => parseAsync,
522
525
  partialRecord: () => partialRecord,
523
526
  pipe: () => pipe,
@@ -582,10 +585,9 @@ __export(exports_z, {
582
585
  xor: () => xor,
583
586
  z: () => exports_external
584
587
  });
585
-
586
588
  // src/definitions/artifacts/artifact.ts
587
- var ARTIFACT_BRAND = "ScarnArtifact";
588
- var ArtifactTypes = {
589
+ var ARTIFACT_BRAND2 = "ScarnArtifact";
590
+ var ArtifactTypes2 = {
589
591
  video: [".mp4", ".webm", ".mov"],
590
592
  image: [".png", ".jpg", ".jpeg", ".gif", ".svg"]
591
593
  };
@@ -594,7 +596,7 @@ function describeEntry(entry) {
594
596
  const cleaned = entry.trim().toLowerCase().replace(/^\*?\.?/, "");
595
597
  return cleaned && EXTENSION_PATTERN.test(`.${cleaned}`) ? ` Did you mean \`.${cleaned}\`?` : "";
596
598
  }
597
- function normalizeArtifactAccept(accept) {
599
+ function normalizeArtifactAccept2(accept) {
598
600
  if (accept === undefined)
599
601
  return [];
600
602
  const problems = [];
@@ -624,30 +626,30 @@ function normalizeArtifactAccept(accept) {
624
626
  }
625
627
  return out;
626
628
  }
627
- function artifact(options = {}) {
629
+ function artifact2(options = {}) {
628
630
  const keyword = {
629
- accept: normalizeArtifactAccept(options.accept)
631
+ accept: normalizeArtifactAccept2(options.accept)
630
632
  };
631
- return exports_external.string().brand().meta({ [ARTIFACT_SCHEMA_KEYWORD]: keyword });
633
+ return string().brand().meta({ [ARTIFACT_SCHEMA_KEYWORD2]: keyword });
632
634
  }
633
635
  var toMarkerRef = (target) => typeof target === "string" ? { type: "path", pattern: target } : {
634
636
  type: "signal",
635
637
  stepKey: target.step.key,
636
638
  signalKey: target.path
637
639
  };
638
- var Artifact = {
640
+ var Artifact2 = {
639
641
  path(relativePath) {
640
642
  return relativePath;
641
643
  },
642
644
  embed(target, options) {
643
- return buildArtifactMarker("embed", toMarkerRef(target), options.caption);
645
+ return buildArtifactMarker2("embed", toMarkerRef(target), options.caption);
644
646
  },
645
647
  link(target, options) {
646
- return buildArtifactMarker("link", toMarkerRef(target), options.label);
648
+ return buildArtifactMarker2("link", toMarkerRef(target), options.label);
647
649
  }
648
650
  };
649
651
  // src/definitions/steps/repo.ts
650
- var Repo = {
652
+ var Repo2 = {
651
653
  readOnly(opts) {
652
654
  return { mode: "readOnly", ...opts };
653
655
  },
@@ -655,7 +657,7 @@ var Repo = {
655
657
  return { mode: "readWrite", ...opts };
656
658
  }
657
659
  };
658
- var WorkBranch = {
660
+ var WorkBranch2 = {
659
661
  create() {
660
662
  return { kind: "create" };
661
663
  },
@@ -663,22 +665,22 @@ var WorkBranch = {
663
665
  return { kind: "base" };
664
666
  }
665
667
  };
666
- function compileRepo(repo, ctx = {}) {
668
+ function compileRepo2(repo, ctx = {}) {
667
669
  if (repo === undefined)
668
670
  return;
669
671
  const spec = typeof repo === "function" ? repo({
670
- input: createPromptInputProxy(["input"]),
671
- result: createPromptInputProxy(["result"]),
672
- workItem: createPromptInputProxy(["workItem"]),
673
- env: createPromptInputProxy(["env"])
672
+ input: createPromptInputProxy2(["input"]),
673
+ result: createPromptInputProxy2(["result"]),
674
+ workItem: createPromptInputProxy2(["workItem"]),
675
+ env: createPromptInputProxy2(["env"])
674
676
  }) : repo;
675
677
  const where = ctx.stepKey ? `Step "${ctx.stepKey}" repo` : "repo";
676
- const config2 = toRepoConfigInput(spec);
677
- const parsed = repoConfigInputSchema.safeParse(config2);
678
+ const config = toRepoConfigInput(spec);
679
+ const parsed = repoConfigInputSchema2.safeParse(config);
678
680
  if (!parsed.success) {
679
681
  throw new Error(`${where}: ${parsed.error.issues.map((issue) => `${issue.path.join(".") || "mode"} ${issue.message}`).join("; ")}`);
680
682
  }
681
- return config2;
683
+ return config;
682
684
  }
683
685
  function toRepoConfigInput(spec) {
684
686
  switch (spec.mode) {
@@ -693,15 +695,15 @@ function toRepoConfigInput(spec) {
693
695
  }
694
696
  throw new Error("repo mode must be readOnly or readWrite");
695
697
  }
696
- function assertBaseBranchFitsEnvironment(repo, vars, ctx = {}) {
698
+ function assertBaseBranchFitsEnvironment2(repo, vars, ctx = {}) {
697
699
  const baseBranch = repo?.baseBranch;
698
700
  if (baseBranch == null || vars === undefined)
699
701
  return;
700
- const problems = findBaseBranchEnvProblems(baseBranch, vars);
702
+ const problems = findBaseBranchEnvProblems2(baseBranch, vars);
701
703
  if (problems.length === 0)
702
704
  return;
703
705
  const where = ctx.stepKey ? `Step "${ctx.stepKey}" repo` : "repo";
704
- throw new Error(`${where}: baseBranch ${problems.map(describeBaseBranchEnvProblem).join("; ")}`);
706
+ throw new Error(`${where}: baseBranch ${problems.map(describeBaseBranchEnvProblem2).join("; ")}`);
705
707
  }
706
708
  function gitCredentialsOf(spec) {
707
709
  return spec.gitCredentials !== undefined ? { gitCredentials: spec.gitCredentials } : {};
@@ -726,12 +728,12 @@ function toReadWriteConfig(spec) {
726
728
 
727
729
  // src/definitions/steps/mcp-server-config.ts
728
730
  var ownedFields = { type: true, disabled: true };
729
- var refFieldsSchema = openCodeMcpRefConfigSchema.omit({
731
+ var refFieldsSchema = openCodeMcpRefConfigSchema2.omit({
730
732
  ...ownedFields,
731
733
  name: true
732
734
  });
733
- var localFieldsSchema = openCodeMcpLocalConfigSchema.omit(ownedFields);
734
- var remoteFieldsSchema = openCodeMcpRemoteConfigSchema.omit(ownedFields);
735
+ var localFieldsSchema = openCodeMcpLocalConfigSchema2.omit(ownedFields);
736
+ var remoteFieldsSchema = openCodeMcpRemoteConfigSchema2.omit(ownedFields).extend({ auth: mcpConnectionAuthSchema2.optional() });
735
737
  var commonConfigKeys = new Set([
736
738
  "type",
737
739
  "name",
@@ -742,56 +744,70 @@ var commonConfigKeys = new Set([
742
744
  function formatIssues(error) {
743
745
  return error.issues.map((issue) => issue.path.length > 0 ? `${issue.path.map(String).join(".")}: ${issue.message}` : issue.message).join("; ");
744
746
  }
745
- function parseFields(name, schema, config2) {
746
- const fields = Object.fromEntries(Object.entries(config2).filter(([key]) => !commonConfigKeys.has(key)));
747
+ function parseFields(name, schema, config) {
748
+ const fields = Object.fromEntries(Object.entries(config).filter(([key]) => !commonConfigKeys.has(key)));
747
749
  const parsed = schema.safeParse(fields);
748
750
  if (!parsed.success) {
749
751
  throw new Error(`defineMcp "${name}": ${formatIssues(parsed.error)}`);
750
752
  }
751
753
  return parsed.data;
752
754
  }
755
+ function assertConnectionAuth(name, issues) {
756
+ if (issues.length === 0)
757
+ return;
758
+ throw new Error(`defineMcp "${name}": ${issues.map((issue) => `${issue.path}: ${issue.message}`).join("; ")}`);
759
+ }
760
+ function assertRemoteConnectionAuth(name, config) {
761
+ const auth = mcpConnectionAuthSchema2.safeParse(config.auth);
762
+ if (!auth.success)
763
+ return;
764
+ if (typeof config.url !== "string") {
765
+ throw new Error(`defineMcp "${name}": url is required with auth; write the ${auth.data.connection} connection's resource URL explicitly.`);
766
+ }
767
+ assertConnectionAuth(name, remoteConnectionAuthIssues2({ ...config, auth: auth.data }));
768
+ }
753
769
  function assertPlaceholders(name, field, values) {
754
770
  for (const [key, value] of Object.entries(values ?? {})) {
755
- if (isEnvPlaceholderValue(value))
771
+ if (isEnvPlaceholderValue2(value))
756
772
  continue;
757
773
  throw new Error(`defineMcp "${name}": ${field}.${key} must be written as {env:VAR}; a literal ${field} value would be stored in plaintext.`);
758
774
  }
759
775
  }
760
776
  function inferredMcpEnv(definition) {
761
- return definition.type === "ref" ? [] : collectEnvPlaceholderNames(definition.server);
777
+ return definition.type === "ref" ? [] : collectEnvPlaceholderNames2(definition.server);
762
778
  }
763
779
  function assertInferredEnv(definition) {
764
780
  for (const variable of inferredMcpEnv(definition)) {
765
- if (!ENV_VAR_NAME_PATTERN.test(variable)) {
766
- throw new Error(`defineMcp "${definition.name}": {env:${variable}} must name a variable matching ${String(ENV_VAR_NAME_PATTERN)}.`);
781
+ if (!ENV_VAR_NAME_PATTERN2.test(variable)) {
782
+ throw new Error(`defineMcp "${definition.name}": {env:${variable}} must name a variable matching ${String(ENV_VAR_NAME_PATTERN2)}.`);
767
783
  }
768
- if (isReservedEnvVarName(variable)) {
784
+ if (isReservedEnvVarName2(variable)) {
769
785
  throw new Error(`defineMcp "${definition.name}": {env:${variable}} reads a variable reserved for Scarn.`);
770
786
  }
771
787
  }
772
788
  }
773
- function parseMcpServer(config2) {
774
- if (typeof config2.name !== "string" || config2.name.trim().length === 0) {
789
+ function parseMcpServer(config) {
790
+ if (typeof config.name !== "string" || config.name.trim().length === 0) {
775
791
  throw new Error("defineMcp: name must be a non-empty string.");
776
792
  }
777
- const { name } = config2;
793
+ const { name } = config;
778
794
  let definition;
779
- switch (config2.type) {
780
- case "ref":
781
- definition = {
782
- type: "ref",
783
- name,
784
- server: parseFields(name, refFieldsSchema, config2)
785
- };
795
+ switch (config.type) {
796
+ case "ref": {
797
+ const server = parseFields(name, refFieldsSchema, config);
798
+ assertConnectionAuth(name, refConnectionAuthIssues2(server));
799
+ definition = { type: "ref", name, server };
786
800
  break;
801
+ }
787
802
  case "local": {
788
- const server = parseFields(name, localFieldsSchema, config2);
803
+ const server = parseFields(name, localFieldsSchema, config);
789
804
  assertPlaceholders(name, "environment", server.environment);
790
805
  definition = { type: "local", name, server };
791
806
  break;
792
807
  }
793
808
  case "remote": {
794
- const server = parseFields(name, remoteFieldsSchema, config2);
809
+ assertRemoteConnectionAuth(name, config);
810
+ const server = parseFields(name, remoteFieldsSchema, config);
795
811
  assertPlaceholders(name, "headers", server.headers);
796
812
  definition = { type: "remote", name, server };
797
813
  break;
@@ -804,8 +820,8 @@ function parseMcpServer(config2) {
804
820
  }
805
821
 
806
822
  // src/definitions/steps/define-mcp.ts
807
- var mcpCheckInputSchema = toolHealthCheckSchema.omit({ kind: true, mcp: true, name: true }).extend({ enabled: exports_external.boolean().optional() }).strict();
808
- var mcpCheckPatchSchema = toolHealthCheckSchema.pick({
823
+ var mcpCheckInputSchema = toolHealthCheckSchema2.omit({ kind: true, mcp: true, name: true }).extend({ enabled: boolean().optional() }).strict();
824
+ var mcpCheckPatchSchema = toolHealthCheckSchema2.pick({
809
825
  tool: true,
810
826
  args: true,
811
827
  timeoutSeconds: true,
@@ -813,7 +829,7 @@ var mcpCheckPatchSchema = toolHealthCheckSchema.pick({
813
829
  serialGroup: true
814
830
  }).partial().strict();
815
831
  var handles = new WeakSet;
816
- function isMcpHandle(value) {
832
+ function isMcpHandle2(value) {
817
833
  return typeof value === "object" && value !== null && handles.has(value);
818
834
  }
819
835
  function deepFreeze(value) {
@@ -835,9 +851,9 @@ function assertCheckName(label, name) {
835
851
  throw new Error(`defineMcp "${label}": health check name "${name}" must be non-empty and contain no ".".`);
836
852
  }
837
853
  }
838
- function assertCheckInput(label, name, check2) {
854
+ function assertCheckInput(label, name, check) {
839
855
  assertCheckName(label, name);
840
- const parsed = mcpCheckInputSchema.safeParse(check2);
856
+ const parsed = mcpCheckInputSchema.safeParse(check);
841
857
  if (!parsed.success) {
842
858
  throw new Error(`defineMcp "${label}" health check "${name}": ${formatIssues2(parsed.error)}`);
843
859
  }
@@ -845,10 +861,10 @@ function assertCheckInput(label, name, check2) {
845
861
  function assertEnvNames(label, env, optionalEnv) {
846
862
  const seen = new Set;
847
863
  for (const name of [...env, ...optionalEnv]) {
848
- if (!ENV_VAR_NAME_PATTERN.test(name)) {
849
- throw new Error(`defineMcp "${label}": env var "${name}" must match ${String(ENV_VAR_NAME_PATTERN)}.`);
864
+ if (!ENV_VAR_NAME_PATTERN2.test(name)) {
865
+ throw new Error(`defineMcp "${label}": env var "${name}" must match ${String(ENV_VAR_NAME_PATTERN2)}.`);
850
866
  }
851
- if (isReservedEnvVarName(name)) {
867
+ if (isReservedEnvVarName2(name)) {
852
868
  throw new Error(`defineMcp "${label}": env var "${name}" is reserved for Scarn.`);
853
869
  }
854
870
  if (seen.has(name)) {
@@ -857,6 +873,15 @@ function assertEnvNames(label, env, optionalEnv) {
857
873
  seen.add(name);
858
874
  }
859
875
  }
876
+ function connectionOf(state) {
877
+ return state.type === "local" ? undefined : state.server.auth?.connection;
878
+ }
879
+ function assertConnectionAuthFree(state, what) {
880
+ const connection = connectionOf(state);
881
+ if (connection === undefined)
882
+ return;
883
+ throw new Error(`defineMcp "${state.name}": ${what} must be absent when auth is set; the ${connection} connection authenticates the server.`);
884
+ }
860
885
  function knownCheckNames(state) {
861
886
  const names = new Set(Object.keys(state.checks));
862
887
  for (const op of state.overrides) {
@@ -900,26 +925,31 @@ function createHandle(state) {
900
925
  assertKnownCheck(state, "enableCheck", name);
901
926
  return withOp(state, { op: "enable", name });
902
927
  },
903
- addCheck: (name, check2) => {
904
- assertCheckInput(state.name, name, check2);
928
+ addCheck: (name, check) => {
929
+ assertCheckInput(state.name, name, check);
905
930
  if (knownCheckNames(state).has(name)) {
906
931
  throw new Error(`defineMcp "${state.name}".addCheck: health check "${name}" already exists; use overrideCheck to change it.`);
907
932
  }
908
- return withOp(state, { op: "add", name, check: structuredClone(check2) });
933
+ return withOp(state, { op: "add", name, check: structuredClone(check) });
909
934
  },
910
935
  disableAllChecks: () => withOp(state, { op: "disableAll" })
911
936
  };
912
937
  handles.add(handle);
913
938
  return Object.freeze(handle);
914
939
  }
915
- function defineMcp(config2) {
916
- const definition = parseMcpServer(config2);
917
- const env = config2.env ?? [];
918
- const optionalEnv = config2.optionalEnv ?? [];
940
+ function defineMcp2(config) {
941
+ const definition = parseMcpServer(config);
942
+ if (config.env !== undefined)
943
+ assertConnectionAuthFree(definition, "env");
944
+ if (config.optionalEnv !== undefined) {
945
+ assertConnectionAuthFree(definition, "optionalEnv");
946
+ }
947
+ const env = config.env ?? [];
948
+ const optionalEnv = config.optionalEnv ?? [];
919
949
  assertEnvNames(definition.name, env, optionalEnv);
920
- const checks = config2.healthChecks ?? {};
921
- for (const [name, check2] of Object.entries(checks)) {
922
- assertCheckInput(definition.name, name, check2);
950
+ const checks = config.healthChecks ?? {};
951
+ for (const [name, check] of Object.entries(checks)) {
952
+ assertCheckInput(definition.name, name, check);
923
953
  }
924
954
  return createHandle({
925
955
  ...frozenCopy(definition),
@@ -929,10 +959,10 @@ function defineMcp(config2) {
929
959
  overrides: Object.freeze([])
930
960
  });
931
961
  }
932
- function resolveMcpChecks(handle) {
962
+ function resolveMcpChecks2(handle) {
933
963
  const resolved = new Map;
934
- for (const [name, check2] of Object.entries(handle.checks)) {
935
- resolved.set(name, { check: { ...check2 }, enabled: check2.enabled ?? true });
964
+ for (const [name, check] of Object.entries(handle.checks)) {
965
+ resolved.set(name, { check: { ...check }, enabled: check.enabled ?? true });
936
966
  }
937
967
  for (const op of handle.overrides) {
938
968
  if (op.op === "add") {
@@ -953,9 +983,9 @@ function resolveMcpChecks(handle) {
953
983
  entry.enabled = op.op === "enable";
954
984
  }
955
985
  }
956
- return [...resolved].map(([name, { check: check2, enabled }]) => ({
986
+ return [...resolved].map(([name, { check, enabled }]) => ({
957
987
  name,
958
- check: check2,
988
+ check,
959
989
  enabled
960
990
  }));
961
991
  }
@@ -979,24 +1009,26 @@ function compileServer(key, handle) {
979
1009
  }
980
1010
  }
981
1011
  function compileChecks(key, handle) {
982
- return resolveMcpChecks(handle).filter((resolved) => resolved.enabled).map(({ name, check: check2 }) => ({
1012
+ return resolveMcpChecks2(handle).filter((resolved) => resolved.enabled).map(({ name, check }) => ({
983
1013
  kind: "tool",
984
1014
  mcp: key,
985
1015
  name: `${key}.${name}`,
986
- tool: check2.tool,
987
- ...check2.args !== undefined ? { args: check2.args } : {},
988
- ...check2.timeoutSeconds !== undefined ? { timeoutSeconds: check2.timeoutSeconds } : {},
989
- serialGroup: check2.serialGroup ?? key,
990
- severity: check2.severity ?? "required"
1016
+ tool: check.tool,
1017
+ ...check.args !== undefined ? { args: check.args } : {},
1018
+ ...check.timeoutSeconds !== undefined ? { timeoutSeconds: check.timeoutSeconds } : {},
1019
+ serialGroup: check.serialGroup ?? key,
1020
+ severity: check.severity ?? "required"
991
1021
  }));
992
1022
  }
993
1023
  function compileEnv(key, handle) {
994
- const entry = (name, optional2) => ({
1024
+ if (handle.type !== "local" && handle.server.auth !== undefined)
1025
+ return [];
1026
+ const entry = (name, optional) => ({
995
1027
  source: "inherit",
996
1028
  name,
997
1029
  from: name,
998
1030
  secret: true,
999
- optional: optional2,
1031
+ optional,
1000
1032
  mcp: key,
1001
1033
  applies: "agent"
1002
1034
  });
@@ -1008,13 +1040,13 @@ function compileEnv(key, handle) {
1008
1040
  ...handle.optionalEnv.map((name) => entry(name, true))
1009
1041
  ];
1010
1042
  }
1011
- function compileMcps(mcps, stepKey) {
1043
+ function compileMcps2(mcps, stepKey) {
1012
1044
  const compiled = {
1013
1045
  opencodeMcpJson: {},
1014
1046
  healthChecks: []
1015
1047
  };
1016
1048
  for (const [key, handle] of Object.entries(mcps)) {
1017
- if (!isMcpHandle(handle)) {
1049
+ if (!isMcpHandle2(handle)) {
1018
1050
  throw new Error(`Step "${stepKey}" mcps.${key}: expected a handle from defineMcp().`);
1019
1051
  }
1020
1052
  compiled.opencodeMcpJson[key] = compileServer(key, handle);
@@ -1023,37 +1055,37 @@ function compileMcps(mcps, stepKey) {
1023
1055
  return compiled;
1024
1056
  }
1025
1057
  function assertNoConnectorMcpCollisions(stepKey, environment, mcps) {
1026
- if (!isEnvironmentHandle(environment) || mcps === undefined)
1058
+ if (!isEnvironmentHandle2(environment) || mcps === undefined)
1027
1059
  return;
1028
- const collisions = findConnectorMcpCollisions(environment.content.connectors ?? [], Object.keys(mcps));
1060
+ const collisions = findConnectorMcpCollisions2(environment.content.connectors ?? [], Object.keys(mcps));
1029
1061
  if (collisions.length === 0)
1030
1062
  return;
1031
- throw new Error(`Step "${stepKey}" environment "${environment.name}": ${connectorMcpCollisionMessage(collisions)}`);
1063
+ throw new Error(`Step "${stepKey}" environment "${environment.name}": ${connectorMcpCollisionMessage2(collisions)}`);
1032
1064
  }
1033
1065
  function nonEmpty(items) {
1034
1066
  return items.length > 0 ? items : null;
1035
1067
  }
1036
- function mergeStepMcps(stepKey, input2) {
1037
- if (!input2.mcps || Object.keys(input2.mcps).length === 0) {
1068
+ function mergeStepMcps(stepKey, input) {
1069
+ if (!input.mcps || Object.keys(input.mcps).length === 0) {
1038
1070
  return {
1039
1071
  opencodeMcpJson: null,
1040
- healthChecksJson: input2.healthChecks ?? null,
1041
- envJson: input2.envJson
1072
+ healthChecksJson: input.healthChecks ?? null,
1073
+ envJson: input.envJson
1042
1074
  };
1043
1075
  }
1044
- const compiled = compileMcps(input2.mcps, stepKey);
1076
+ const compiled = compileMcps2(input.mcps, stepKey);
1045
1077
  return {
1046
1078
  opencodeMcpJson: compiled.opencodeMcpJson,
1047
1079
  healthChecksJson: nonEmpty([
1048
1080
  ...compiled.healthChecks,
1049
- ...input2.healthChecks ?? []
1081
+ ...input.healthChecks ?? []
1050
1082
  ]),
1051
- envJson: input2.envJson
1083
+ envJson: input.envJson
1052
1084
  };
1053
1085
  }
1054
1086
 
1055
1087
  // src/definitions/steps/step-handle.ts
1056
- function compileStepErrors(stepKey, errors) {
1088
+ function compileStepErrors2(stepKey, errors) {
1057
1089
  const names = [...errors ?? []];
1058
1090
  const seen = new Set;
1059
1091
  for (const name of names) {
@@ -1067,15 +1099,15 @@ function compileStepErrors(stepKey, errors) {
1067
1099
  }
1068
1100
  return names;
1069
1101
  }
1070
- function compileStepRetry(stepKey, retry, errors) {
1071
- const known = new Set([...BUILT_IN_ERRORS, ...errors]);
1102
+ function compileStepRetry2(stepKey, retry, errors) {
1103
+ const known = new Set([...BUILT_IN_ERRORS2, ...errors]);
1072
1104
  return (retry ?? []).map((entry) => {
1073
1105
  if (entry.on.length === 0) {
1074
1106
  throw new Error(`Step "${stepKey}": each retry must name an error.`);
1075
1107
  }
1076
- const unknown2 = entry.on.find((name) => !known.has(name));
1077
- if (unknown2 !== undefined) {
1078
- throw new Error(`Step "${stepKey}": retry names "${unknown2}", which is neither a built-in error nor one the step declares.`);
1108
+ const unknown = entry.on.find((name) => !known.has(name));
1109
+ if (unknown !== undefined) {
1110
+ throw new Error(`Step "${stepKey}": retry names "${unknown}", which is neither a built-in error nor one the step declares.`);
1079
1111
  }
1080
1112
  if (!Number.isInteger(entry.maxAttempts) || entry.maxAttempts <= 0) {
1081
1113
  throw new Error(`Step "${stepKey}": retry maxAttempts must be a positive integer.`);
@@ -1083,13 +1115,13 @@ function compileStepRetry(stepKey, retry, errors) {
1083
1115
  return { on: [...entry.on], maxAttempts: entry.maxAttempts };
1084
1116
  });
1085
1117
  }
1086
- function compileStepMaxTurns(stepKey, maxTurns) {
1118
+ function compileStepMaxTurns2(stepKey, maxTurns) {
1087
1119
  if (!Number.isInteger(maxTurns) || maxTurns <= 0) {
1088
1120
  throw new Error(`Step "${stepKey}": maxTurns must be a positive integer.`);
1089
1121
  }
1090
1122
  return maxTurns;
1091
1123
  }
1092
- function compileStepConcurrency(stepKey, concurrency) {
1124
+ function compileStepConcurrency2(stepKey, concurrency) {
1093
1125
  if (!Number.isInteger(concurrency.max) || concurrency.max < 1) {
1094
1126
  throw new Error(`Step "${stepKey}": concurrency max must be an integer of at least 1.`);
1095
1127
  }
@@ -1098,7 +1130,7 @@ function compileStepConcurrency(stepKey, concurrency) {
1098
1130
  }
1099
1131
  return { max: concurrency.max, waiting: concurrency.waiting };
1100
1132
  }
1101
- function toStepHandle(spec, environmentHandle) {
1133
+ function toStepHandle2(spec, environmentHandle) {
1102
1134
  const node = stepNode(spec);
1103
1135
  const call = stepCall(node);
1104
1136
  const { name, ...rest } = spec;
@@ -1115,30 +1147,30 @@ function toStepHandle(spec, environmentHandle) {
1115
1147
  }
1116
1148
  return makeHandle(call, node);
1117
1149
  }
1118
- function stepEnvironmentHandle(step) {
1150
+ function stepEnvironmentHandle2(step) {
1119
1151
  if (typeof step !== "function" && typeof step !== "object")
1120
1152
  return;
1121
1153
  if (step === null)
1122
1154
  return;
1123
1155
  const handle = step.environmentHandle;
1124
- return isEnvironmentHandle(handle) ? handle : undefined;
1156
+ return isEnvironmentHandle2(handle) ? handle : undefined;
1125
1157
  }
1126
- function toStepSpec(step) {
1158
+ function toStepSpec2(step) {
1127
1159
  return { ...step };
1128
1160
  }
1129
1161
 
1130
1162
  // src/definitions/steps/define-step.ts
1131
- function assertStepMcpInput(config2) {
1132
- if ("mcpServers" in config2) {
1133
- throw new Error(`Step "${config2.key}": mcpServers is not supported. Declare each MCP server with defineMcp({ type: "ref" | "local" | "remote", ... }) and list it under mcps.`);
1163
+ function assertStepMcpInput(config) {
1164
+ if ("mcpServers" in config) {
1165
+ throw new Error(`Step "${config.key}": mcpServers is not supported. Declare each MCP server with defineMcp({ type: "ref" | "local" | "remote", ... }) and list it under mcps.`);
1134
1166
  }
1135
- if (config2.healthChecks == null)
1167
+ if (config.healthChecks == null)
1136
1168
  return;
1137
- const parsed = stepHealthChecksInputSchema.safeParse(config2.healthChecks);
1169
+ const parsed = stepHealthChecksInputSchema2.safeParse(config.healthChecks);
1138
1170
  if (parsed.success)
1139
1171
  return;
1140
1172
  const issues = parsed.error.issues.map((issue) => issue.path.length > 0 ? `${issue.path.map(String).join(".")}: ${issue.message}` : issue.message).join("; ");
1141
- throw new Error(`Step "${config2.key}" healthChecks: ${issues}. MCP health checks are declared on the server with defineMcp({ healthChecks }).`);
1173
+ throw new Error(`Step "${config.key}" healthChecks: ${issues}. MCP health checks are declared on the server with defineMcp({ healthChecks }).`);
1142
1174
  }
1143
1175
  function collectGrants(stepKey, features) {
1144
1176
  const grants = [];
@@ -1156,16 +1188,16 @@ function collectGrants(stepKey, features) {
1156
1188
  }
1157
1189
  return grants;
1158
1190
  }
1159
- function defineStep(config2) {
1160
- const features = config2.features ?? [];
1161
- const grants = collectGrants(config2.key, features);
1162
- let effectiveResult = config2.result;
1191
+ function defineStep2(config) {
1192
+ const features = config.features ?? [];
1193
+ const grants = collectGrants(config.key, features);
1194
+ let effectiveResult = config.result;
1163
1195
  for (const feature of features) {
1164
1196
  if (!feature._resultExtension)
1165
1197
  continue;
1166
1198
  effectiveResult = effectiveResult ? effectiveResult.extend(feature._resultExtension.shape) : feature._resultExtension;
1167
1199
  }
1168
- const basePrompt = typeof config2.agentPrompt === "function" ? config2.agentPrompt(createPromptTemplateContext()) : config2.agentPrompt;
1200
+ const basePrompt = typeof config.agentPrompt === "function" ? config.agentPrompt(createPromptTemplateContext2()) : config.agentPrompt;
1169
1201
  let effectivePrompt = basePrompt;
1170
1202
  for (const feature of features) {
1171
1203
  if (feature._promptAddition) {
@@ -1174,90 +1206,90 @@ function defineStep(config2) {
1174
1206
  ${feature._promptAddition}` : feature._promptAddition;
1175
1207
  }
1176
1208
  }
1177
- const environment = compileEnvironment(config2.environment, {
1178
- stepKey: config2.key
1209
+ const environment = compileEnvironment2(config.environment, {
1210
+ stepKey: config.key
1179
1211
  });
1180
- const repo = compileRepo(config2.repo, { stepKey: config2.key });
1181
- assertBaseBranchFitsEnvironment(repo, knownEnvironmentVars(config2.environment, environment), { stepKey: config2.key });
1182
- assertStepMcpInput(config2);
1183
- assertNoConnectorMcpCollisions(config2.key, config2.environment, config2.mcps);
1184
- const mcpFields = mergeStepMcps(config2.key, {
1185
- mcps: config2.mcps,
1186
- healthChecks: config2.healthChecks,
1212
+ const repo = compileRepo2(config.repo, { stepKey: config.key });
1213
+ assertBaseBranchFitsEnvironment2(repo, knownEnvironmentVars2(config.environment, environment), { stepKey: config.key });
1214
+ assertStepMcpInput(config);
1215
+ assertNoConnectorMcpCollisions(config.key, config.environment, config.mcps);
1216
+ const mcpFields = mergeStepMcps(config.key, {
1217
+ mcps: config.mcps,
1218
+ healthChecks: config.healthChecks,
1187
1219
  envJson: environment?.kind === "inline" ? environment.envJson : null
1188
1220
  });
1189
1221
  const resultSchemaJson = effectiveResult ? toJSONSchema(effectiveResult) : null;
1190
1222
  const spec = {
1191
- key: config2.key,
1192
- name: config2.name,
1193
- description: config2.description ?? null,
1194
- version: config2.version ?? 1,
1223
+ key: config.key,
1224
+ name: config.name,
1225
+ description: config.description ?? null,
1226
+ version: config.version ?? 1,
1195
1227
  kind: "user_defined",
1196
- status: config2.status ?? "active",
1228
+ status: config.status ?? "active",
1197
1229
  environment,
1198
1230
  prompt: effectivePrompt,
1199
- inputSchemaJson: config2.input ? toJSONSchema(config2.input) : null,
1231
+ inputSchemaJson: config.input ? toJSONSchema(config.input) : null,
1200
1232
  resultSchemaJson,
1201
1233
  opencodeMcpJson: mcpFields.opencodeMcpJson,
1202
1234
  healthChecksJson: mcpFields.healthChecksJson,
1203
1235
  ...repo !== undefined ? { repo } : {},
1204
- errors: compileStepErrors(config2.key, config2.errors),
1205
- retryJson: compileStepRetry(config2.key, config2.retry, config2.errors ?? []),
1206
- ...config2.maxTurns !== undefined ? { maxTurns: compileStepMaxTurns(config2.key, config2.maxTurns) } : {},
1207
- ...config2.concurrency !== undefined ? {
1208
- concurrency: compileStepConcurrency(config2.key, config2.concurrency)
1236
+ errors: compileStepErrors2(config.key, config.errors),
1237
+ retryJson: compileStepRetry2(config.key, config.retry, config.errors ?? []),
1238
+ ...config.maxTurns !== undefined ? { maxTurns: compileStepMaxTurns2(config.key, config.maxTurns) } : {},
1239
+ ...config.concurrency !== undefined ? {
1240
+ concurrency: compileStepConcurrency2(config.key, config.concurrency)
1209
1241
  } : {},
1210
1242
  ...grants.length > 0 ? { grants } : {}
1211
1243
  };
1212
- return toStepHandle(spec, isEnvironmentHandle(config2.environment) ? config2.environment : undefined);
1244
+ return toStepHandle2(spec, isEnvironmentHandle2(config.environment) ? config.environment : undefined);
1213
1245
  }
1214
1246
  // src/definitions/steps/define-code-step.ts
1215
- function codeStep(config2) {
1216
- const features = config2.features ?? [];
1217
- let effectiveResult = config2.resultSchema;
1247
+ function codeStep2(config) {
1248
+ const features = config.features ?? [];
1249
+ let effectiveResult = config.resultSchema;
1218
1250
  for (const feature of features) {
1219
1251
  if (!feature._resultExtension)
1220
1252
  continue;
1221
1253
  effectiveResult = effectiveResult ? effectiveResult.extend(feature._resultExtension.shape) : feature._resultExtension;
1222
1254
  }
1223
- const environmentHandle = isEnvironmentHandle(config2.environment) ? config2.environment : undefined;
1255
+ const environmentHandle = isEnvironmentHandle2(config.environment) ? config.environment : undefined;
1224
1256
  if (environmentHandle?.content.runtime?.kind === "host") {
1225
- throw new Error(`Step "${config2.key}" environment "${environmentHandle.name}": a code step needs a container, but the environment's runtime is Runtime.host(). Use Runtime.managed.bun1() or Runtime.devcontainer().`);
1257
+ throw new Error(`Step "${config.key}" environment "${environmentHandle.name}": a code step needs a container, but the environment's runtime is Runtime.host(). Use Runtime.managed.bun1() or Runtime.devcontainer().`);
1226
1258
  }
1227
- const environment = compileEnvironment(config2.environment, {
1228
- stepKey: config2.key,
1229
- defaultRuntime: Runtime.managed[DEFAULT_CODE_STEP_RUNTIME_ID]()
1259
+ const environment = compileEnvironment2(config.environment, {
1260
+ stepKey: config.key,
1261
+ defaultRuntime: Runtime2.managed[DEFAULT_CODE_STEP_RUNTIME_ID2]()
1230
1262
  });
1231
- const repo = compileRepo(config2.repo, { stepKey: config2.key });
1232
- assertBaseBranchFitsEnvironment(repo, knownEnvironmentVars(config2.environment, environment), { stepKey: config2.key });
1263
+ const repo = compileRepo2(config.repo, { stepKey: config.key });
1264
+ assertBaseBranchFitsEnvironment2(repo, knownEnvironmentVars2(config.environment, environment), { stepKey: config.key });
1233
1265
  const spec = {
1234
- key: config2.key,
1235
- name: config2.name,
1236
- description: config2.description ?? null,
1237
- version: config2.version ?? 1,
1266
+ key: config.key,
1267
+ name: config.name,
1268
+ description: config.description ?? null,
1269
+ version: config.version ?? 1,
1238
1270
  kind: "code",
1239
- status: config2.status ?? "active",
1271
+ status: config.status ?? "active",
1240
1272
  environment,
1241
1273
  prompt: null,
1242
- inputSchemaJson: config2.inputSchema ? toJSONSchema(config2.inputSchema) : null,
1274
+ inputSchemaJson: config.inputSchema ? toJSONSchema(config.inputSchema) : null,
1243
1275
  resultSchemaJson: effectiveResult ? toJSONSchema(effectiveResult) : null,
1244
1276
  opencodeMcpJson: null,
1245
1277
  healthChecksJson: null,
1246
1278
  ...repo !== undefined ? { repo } : {},
1247
- errors: compileStepErrors(config2.key, config2.errors),
1248
- retryJson: compileStepRetry(config2.key, config2.retry, config2.errors ?? []),
1249
- ...config2.concurrency !== undefined ? {
1250
- concurrency: compileStepConcurrency(config2.key, config2.concurrency)
1279
+ errors: compileStepErrors2(config.key, config.errors),
1280
+ retryJson: compileStepRetry2(config.key, config.retry, config.errors ?? []),
1281
+ ...config.concurrency !== undefined ? {
1282
+ concurrency: compileStepConcurrency2(config.key, config.concurrency)
1251
1283
  } : {},
1252
- entrypoint: { fn: config2.fn }
1284
+ entrypoint: { fn: config.fn }
1253
1285
  };
1254
- return toStepHandle(spec, environmentHandle);
1286
+ return toStepHandle2(spec, environmentHandle);
1255
1287
  }
1256
1288
  // src/definitions/steps/step-definitions-client.ts
1257
1289
  var ANY_OBJECT_SCHEMA = { type: "object" };
1258
- function createStepDefinitionsClient(baseUrl) {
1259
- const client = createClient({ baseUrl });
1260
- return buildStepDefinitionsClient(new StepDefinitions({ client }));
1290
+ function createStepDefinitionsClient2(baseUrl, options) {
1291
+ const client = createApiClient(baseUrl, { fetch: options?.fetch });
1292
+ return buildStepDefinitionsClient(new StepDefinitions2({ client }));
1261
1293
  }
1262
1294
  var buildStepDefinitionsClient = (stepDefinitions) => {
1263
1295
  return {
@@ -1280,7 +1312,7 @@ var buildStepDefinitionsClient = (stepDefinitions) => {
1280
1312
  return result.data;
1281
1313
  },
1282
1314
  upsertFromSpec: async (projectId, step, options) => {
1283
- const spec = toStepSpec(step);
1315
+ const spec = toStepSpec2(step);
1284
1316
  const body = {
1285
1317
  key: spec.key,
1286
1318
  name: spec.name,
@@ -1317,7 +1349,7 @@ var buildStepDefinitionsClient = (stepDefinitions) => {
1317
1349
  };
1318
1350
  };
1319
1351
  // src/definitions/steps/step-features.ts
1320
- var grantActionValues = [
1352
+ var grantActionValues2 = [
1321
1353
  "read",
1322
1354
  "update",
1323
1355
  "comment",
@@ -1326,16 +1358,16 @@ var grantActionValues = [
1326
1358
  "close",
1327
1359
  "create"
1328
1360
  ];
1329
- var grantScopeValues = ["self", "children", "project"];
1330
- var notificationKindSchema = exports_external.enum([
1361
+ var grantScopeValues2 = ["self", "children", "project"];
1362
+ var notificationKindSchema = _enum([
1331
1363
  "feedback_request",
1332
1364
  "status_update",
1333
1365
  "blocked",
1334
1366
  "result_ready",
1335
1367
  "warning"
1336
1368
  ]);
1337
- var notificationPrioritySchema = exports_external.enum(["low", "normal", "high", "urgent"]);
1338
- var notificationChannelSchema = exports_external.enum([
1369
+ var notificationPrioritySchema = _enum(["low", "normal", "high", "urgent"]);
1370
+ var notificationChannelSchema = _enum([
1339
1371
  "in_app",
1340
1372
  "work_item_platform_comment",
1341
1373
  "email",
@@ -1343,17 +1375,17 @@ var notificationChannelSchema = exports_external.enum([
1343
1375
  ]);
1344
1376
  var NOTIFICATION_RESULT_KEY = "$scarn_notifications_v1";
1345
1377
  var DEFAULT_NOTIFICATION_KIND = "status_update";
1346
- var notificationItemSchema = exports_external.object({
1378
+ var notificationItemSchema = object({
1347
1379
  kind: notificationKindSchema.describe("The kind of user notification."),
1348
- title: exports_external.string().optional().describe("Short, human-readable notification title."),
1349
- body: exports_external.string().describe("The notification body / details."),
1380
+ title: string().optional().describe("Short, human-readable notification title."),
1381
+ body: string().describe("The notification body / details."),
1350
1382
  priority: notificationPrioritySchema.describe("How important this notification is for the user."),
1351
- suggestedChannels: exports_external.array(notificationChannelSchema).optional().describe("Channels the agent thinks are worth using. The platform policy decides the final channels."),
1352
- payload: exports_external.record(exports_external.string(), exports_external.unknown()).optional().describe('Kind-specific structured data. For "feedback_request": { category, urgency }.')
1383
+ suggestedChannels: array(notificationChannelSchema).optional().describe("Channels the agent thinks are worth using. The platform policy decides the final channels."),
1384
+ payload: record(string(), unknown()).optional().describe('Kind-specific structured data. For "feedback_request": { category, urgency }.')
1353
1385
  }).describe("A single user notification emitted by the agent.");
1354
1386
  var notificationsFeature = {
1355
- _resultExtension: exports_external.object({
1356
- [NOTIFICATION_RESULT_KEY]: exports_external.array(notificationItemSchema).optional()
1387
+ _resultExtension: object({
1388
+ [NOTIFICATION_RESULT_KEY]: array(notificationItemSchema).optional()
1357
1389
  }),
1358
1390
  _promptAddition: [
1359
1391
  "## User Notifications",
@@ -1381,8 +1413,8 @@ var notificationsFeature = {
1381
1413
  `)
1382
1414
  };
1383
1415
  var feedbackRequestsFeature = {
1384
- _resultExtension: exports_external.object({
1385
- [NOTIFICATION_RESULT_KEY]: exports_external.array(notificationItemSchema.extend({ kind: exports_external.literal("feedback_request") })).optional()
1416
+ _resultExtension: object({
1417
+ [NOTIFICATION_RESULT_KEY]: array(notificationItemSchema.extend({ kind: literal("feedback_request") })).optional()
1386
1418
  }),
1387
1419
  _promptAddition: [
1388
1420
  "## Feedback Requests",
@@ -1478,16 +1510,16 @@ var workItems = {
1478
1510
  labels: [...labels]
1479
1511
  })
1480
1512
  };
1481
- var Features = {
1513
+ var Features2 = {
1482
1514
  notifications: () => notificationsFeature,
1483
1515
  feedbackRequests: () => feedbackRequestsFeature,
1484
1516
  workItems
1485
1517
  };
1486
- var Notify = {
1518
+ var Notify2 = {
1487
1519
  create: (item) => ({
1488
1520
  [NOTIFICATION_RESULT_KEY]: [item]
1489
1521
  }),
1490
- inApp: (title, body, priority, options) => Notify.create({
1522
+ inApp: (title, body, priority, options) => Notify2.create({
1491
1523
  kind: options?.kind ?? DEFAULT_NOTIFICATION_KIND,
1492
1524
  title,
1493
1525
  body,
@@ -1495,7 +1527,7 @@ var Notify = {
1495
1527
  suggestedChannels: ["in_app"],
1496
1528
  ...options?.payload ? { payload: options.payload } : {}
1497
1529
  }),
1498
- feedbackRequest: (question, category, urgency) => Notify.create({
1530
+ feedbackRequest: (question, category, urgency) => Notify2.create({
1499
1531
  kind: "feedback_request",
1500
1532
  title: question,
1501
1533
  body: question,
@@ -1506,4 +1538,4 @@ var Notify = {
1506
1538
  [NOTIFICATION_RESULT_KEY]: fragments.flatMap((fragment) => fragment[NOTIFICATION_RESULT_KEY])
1507
1539
  })
1508
1540
  };
1509
- export { ARTIFACT_BRAND, ArtifactTypes, normalizeArtifactAccept, artifact, Artifact, exports_z, Repo, WorkBranch, compileRepo, assertBaseBranchFitsEnvironment, isMcpHandle, defineMcp, resolveMcpChecks, compileMcps, compileStepErrors, compileStepRetry, compileStepMaxTurns, compileStepConcurrency, toStepHandle, stepEnvironmentHandle, toStepSpec, defineStep, codeStep, createStepDefinitionsClient, grantActionValues, grantScopeValues, Features, Notify };
1541
+ export { ARTIFACT_BRAND2, ArtifactTypes2, normalizeArtifactAccept2, artifact2, Artifact2, exports_z, Repo2, WorkBranch2, compileRepo2, assertBaseBranchFitsEnvironment2, isMcpHandle2, defineMcp2, resolveMcpChecks2, compileMcps2, compileStepErrors2, compileStepRetry2, compileStepMaxTurns2, compileStepConcurrency2, toStepHandle2, stepEnvironmentHandle2, toStepSpec2, defineStep2, codeStep2, createStepDefinitionsClient2, grantActionValues2, grantScopeValues2, Features2, Notify2 };