@scarn/sdk 0.0.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-4361gxk0.js → chunk-0y2fy5en.js} +7 -7
- package/dist/{chunk-rq3q8vg7.js → chunk-102vfpw4.js} +74 -69
- package/dist/{chunk-91p9vzcs.js → chunk-3ctaaseb.js} +405 -402
- package/dist/{chunk-9s07v9r1.js → chunk-4ggr8af6.js} +8 -8
- package/dist/chunk-5zsavw98.js +91 -0
- package/dist/chunk-63f90zky.js +39 -0
- package/dist/{chunk-tfm5hjzm.js → chunk-700xe701.js} +9 -9
- package/dist/{chunk-njd6npf0.js → chunk-ar6hcj1r.js} +6 -6
- package/dist/chunk-cdanncng.js +74 -0
- package/dist/chunk-dp86pa6m.js +68 -0
- package/dist/chunk-e1h021kq.js +86 -0
- package/dist/{chunk-ny07ncb9.js → chunk-gds7w7zh.js} +35 -35
- package/dist/chunk-k4y5qt4y.js +14 -0
- package/dist/{chunk-eg1hcvhb.js → chunk-mz53r914.js} +16 -16
- package/dist/{chunk-631ffb6r.js → chunk-ngy1fdcx.js} +10 -10
- package/dist/chunk-p7yrcmqm.js +322 -0
- package/dist/{chunk-h9yxx0hd.js → chunk-rt9tq4j6.js} +7 -7
- package/dist/{chunk-dnn39qt4.js → chunk-skzxcba3.js} +2960 -2217
- package/dist/{chunk-ynk2bjae.js → chunk-vfeytkqx.js} +89 -88
- package/dist/{chunk-56e4kp0a.js → chunk-y2pv8d6a.js} +19 -19
- package/dist/chunk-y64skrwp.js +17 -0
- package/dist/{chunk-qpw5wt1p.js → chunk-zm72ksz0.js} +26 -27
- package/dist/client.js +53 -52
- package/dist/contracts/artifact-markers.js +12 -11
- package/dist/contracts/artifacts.js +23 -21
- package/dist/contracts/pipeline-document/index.js +94 -92
- package/dist/contracts/step-artifact-submissions.js +17 -20
- package/dist/defaults/index.js +140 -139
- package/dist/definitions/pipelines/index.js +22 -20
- package/dist/definitions/steps/index.js +70 -67
- package/dist/definitions/validation/index.js +15 -13
- package/dist/devcontainer-config-path.js +11 -9
- package/dist/env-vars.js +33 -31
- package/dist/eslint.js +2 -0
- package/dist/generated/types.gen.d.ts +7 -0
- package/dist/git-url/git-repo-identity.js +2 -0
- package/dist/health-checks.js +17 -15
- package/dist/index.js +280 -277
- package/dist/jsonc.js +8 -7
- package/dist/managed-runtimes.js +11 -9
- package/dist/opencode-mcp.js +27 -25
- package/dist/pipelines/index.js +78 -75
- package/dist/pipelines/nodes.d.ts +1 -0
- package/dist/push/code-step-lookup.js +8 -7
- package/dist/push/index.js +51 -52
- package/dist/repo-config.js +21 -19
- package/dist/scarn-config-parser.js +6 -5
- package/package.json +1 -1
- package/dist/chunk-4vehh3dq.js +0 -333
- package/dist/chunk-5mmj03ah.js +0 -1074
- package/dist/chunk-b21233rt.js +0 -78
- package/dist/chunk-g0rdnn0r.js +0 -95
- package/dist/chunk-p6kc9wq8.js +0 -97
- package/dist/chunk-s0gap8r8.js +0 -14
- package/dist/chunk-zpqyjgb4.js +0 -49
|
@@ -1,290 +1,292 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
makeHandle,
|
|
4
|
+
stepCall,
|
|
5
|
+
stepNode
|
|
6
|
+
} from "./chunk-mz53r914.js";
|
|
5
7
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
ENV_VAR_NAME_PATTERN,
|
|
9
|
+
containsInputToken,
|
|
10
|
+
isReservedEnvVarName
|
|
11
|
+
} from "./chunk-5zsavw98.js";
|
|
8
12
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from "./chunk-zpqyjgb4.js";
|
|
13
|
+
devcontainerConfigPathSchema
|
|
14
|
+
} from "./chunk-4ggr8af6.js";
|
|
12
15
|
import {
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
DEFAULT_CODE_STEP_RUNTIME_ID,
|
|
17
|
+
MANAGED_RUNTIME_IDS
|
|
18
|
+
} from "./chunk-k4y5qt4y.js";
|
|
15
19
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} from "./chunk-
|
|
20
|
+
repoConfigInputSchema,
|
|
21
|
+
repoRuntimeMismatch
|
|
22
|
+
} from "./chunk-cdanncng.js";
|
|
19
23
|
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
collectEnvPlaceholderNames,
|
|
25
|
+
isEnvPlaceholderValue,
|
|
26
|
+
openCodeMcpLocalConfigSchema,
|
|
27
|
+
openCodeMcpRefConfigSchema,
|
|
28
|
+
openCodeMcpRemoteConfigSchema
|
|
29
|
+
} from "./chunk-e1h021kq.js";
|
|
24
30
|
import {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} from "./chunk-
|
|
31
|
+
stepHealthChecksInputSchema,
|
|
32
|
+
toolHealthCheckSchema
|
|
33
|
+
} from "./chunk-63f90zky.js";
|
|
28
34
|
import {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
openCodeMcpRefConfigSchema2,
|
|
32
|
-
isEnvPlaceholderValue2,
|
|
33
|
-
collectEnvPlaceholderNames2
|
|
34
|
-
} from "./chunk-g0rdnn0r.js";
|
|
35
|
+
buildArtifactMarker
|
|
36
|
+
} from "./chunk-ngy1fdcx.js";
|
|
35
37
|
import {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
stepCall
|
|
39
|
-
} from "./chunk-eg1hcvhb.js";
|
|
38
|
+
ARTIFACT_SCHEMA_KEYWORD
|
|
39
|
+
} from "./chunk-y2pv8d6a.js";
|
|
40
40
|
import {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
} from "./chunk-ynk2bjae.js";
|
|
41
|
+
BUILT_IN_ERRORS
|
|
42
|
+
} from "./chunk-dp86pa6m.js";
|
|
44
43
|
import {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
ZodFirstPartyTypeKind,
|
|
49
|
-
fromJSONSchema,
|
|
50
|
-
exports_coerce,
|
|
51
|
-
exports_external,
|
|
52
|
-
BUILT_IN_ERRORS2
|
|
53
|
-
} from "./chunk-5mmj03ah.js";
|
|
44
|
+
StepDefinitions,
|
|
45
|
+
createClient
|
|
46
|
+
} from "./chunk-vfeytkqx.js";
|
|
54
47
|
import {
|
|
55
|
-
__export,
|
|
56
|
-
NEVER,
|
|
57
48
|
$brand,
|
|
58
|
-
config,
|
|
59
|
-
clone,
|
|
60
|
-
exports_util,
|
|
61
|
-
flattenError,
|
|
62
|
-
formatError,
|
|
63
|
-
treeifyError,
|
|
64
|
-
prettifyError,
|
|
65
|
-
exports_regexes,
|
|
66
|
-
exports_locales,
|
|
67
|
-
$output,
|
|
68
49
|
$input,
|
|
69
|
-
|
|
70
|
-
|
|
50
|
+
$output,
|
|
51
|
+
NEVER,
|
|
71
52
|
TimePrecision,
|
|
72
|
-
|
|
73
|
-
|
|
53
|
+
ZodAny,
|
|
54
|
+
ZodArray,
|
|
55
|
+
ZodBase64,
|
|
56
|
+
ZodBase64URL,
|
|
57
|
+
ZodBigInt,
|
|
58
|
+
ZodBigIntFormat,
|
|
59
|
+
ZodBoolean,
|
|
60
|
+
ZodCIDRv4,
|
|
61
|
+
ZodCIDRv6,
|
|
62
|
+
ZodCUID,
|
|
63
|
+
ZodCUID2,
|
|
64
|
+
ZodCatch,
|
|
65
|
+
ZodCodec,
|
|
66
|
+
ZodCustom,
|
|
67
|
+
ZodCustomStringFormat,
|
|
68
|
+
ZodDate,
|
|
69
|
+
ZodDefault,
|
|
70
|
+
ZodDiscriminatedUnion,
|
|
71
|
+
ZodE164,
|
|
72
|
+
ZodEmail,
|
|
73
|
+
ZodEmoji,
|
|
74
|
+
ZodEnum,
|
|
75
|
+
ZodError,
|
|
76
|
+
ZodExactOptional,
|
|
77
|
+
ZodFile,
|
|
78
|
+
ZodFirstPartyTypeKind,
|
|
79
|
+
ZodFunction,
|
|
80
|
+
ZodGUID,
|
|
81
|
+
ZodIPv4,
|
|
82
|
+
ZodIPv6,
|
|
83
|
+
ZodISODate,
|
|
84
|
+
ZodISODateTime,
|
|
85
|
+
ZodISODuration,
|
|
86
|
+
ZodISOTime,
|
|
87
|
+
ZodIntersection,
|
|
88
|
+
ZodIssueCode,
|
|
89
|
+
ZodJWT,
|
|
90
|
+
ZodKSUID,
|
|
91
|
+
ZodLazy,
|
|
92
|
+
ZodLiteral,
|
|
93
|
+
ZodMAC,
|
|
94
|
+
ZodMap,
|
|
95
|
+
ZodNaN,
|
|
96
|
+
ZodNanoID,
|
|
97
|
+
ZodNever,
|
|
98
|
+
ZodNonOptional,
|
|
99
|
+
ZodNull,
|
|
100
|
+
ZodNullable,
|
|
101
|
+
ZodNumber,
|
|
102
|
+
ZodNumberFormat,
|
|
103
|
+
ZodObject,
|
|
104
|
+
ZodOptional,
|
|
105
|
+
ZodPipe,
|
|
106
|
+
ZodPrefault,
|
|
107
|
+
ZodPreprocess,
|
|
108
|
+
ZodPromise,
|
|
109
|
+
ZodReadonly,
|
|
110
|
+
ZodRealError,
|
|
111
|
+
ZodRecord,
|
|
112
|
+
ZodSet,
|
|
113
|
+
ZodString,
|
|
114
|
+
ZodStringFormat,
|
|
115
|
+
ZodSuccess,
|
|
116
|
+
ZodSymbol,
|
|
117
|
+
ZodTemplateLiteral,
|
|
118
|
+
ZodTransform,
|
|
119
|
+
ZodTuple,
|
|
120
|
+
ZodType,
|
|
121
|
+
ZodULID,
|
|
122
|
+
ZodURL,
|
|
123
|
+
ZodUUID,
|
|
124
|
+
ZodUndefined,
|
|
125
|
+
ZodUnion,
|
|
126
|
+
ZodUnknown,
|
|
127
|
+
ZodVoid,
|
|
128
|
+
ZodXID,
|
|
129
|
+
ZodXor,
|
|
130
|
+
_ZodString,
|
|
131
|
+
_catch,
|
|
132
|
+
_default,
|
|
133
|
+
_endsWith,
|
|
134
|
+
_enum,
|
|
135
|
+
_function,
|
|
74
136
|
_gt,
|
|
75
137
|
_gte,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
_nonpositive,
|
|
79
|
-
_nonnegative,
|
|
80
|
-
_multipleOf,
|
|
81
|
-
_maxSize,
|
|
82
|
-
_minSize,
|
|
83
|
-
_size,
|
|
84
|
-
_maxLength,
|
|
85
|
-
_minLength,
|
|
138
|
+
_includes,
|
|
139
|
+
_instanceof,
|
|
86
140
|
_length,
|
|
87
|
-
_regex,
|
|
88
141
|
_lowercase,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
_property,
|
|
142
|
+
_lt,
|
|
143
|
+
_lte,
|
|
144
|
+
_maxLength,
|
|
145
|
+
_maxSize,
|
|
94
146
|
_mime,
|
|
95
|
-
|
|
147
|
+
_minLength,
|
|
148
|
+
_minSize,
|
|
149
|
+
_multipleOf,
|
|
150
|
+
_negative,
|
|
151
|
+
_nonnegative,
|
|
152
|
+
_nonpositive,
|
|
96
153
|
_normalize,
|
|
97
|
-
|
|
154
|
+
_null,
|
|
155
|
+
_overwrite,
|
|
156
|
+
_positive,
|
|
157
|
+
_property,
|
|
158
|
+
_regex,
|
|
159
|
+
_size,
|
|
160
|
+
_slugify,
|
|
161
|
+
_startsWith,
|
|
98
162
|
_toLowerCase,
|
|
99
163
|
_toUpperCase,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
164
|
+
_trim,
|
|
165
|
+
_undefined,
|
|
166
|
+
_uppercase,
|
|
167
|
+
_void,
|
|
168
|
+
any,
|
|
169
|
+
array,
|
|
170
|
+
base64,
|
|
171
|
+
base64url,
|
|
172
|
+
bigint,
|
|
173
|
+
boolean,
|
|
174
|
+
check,
|
|
175
|
+
cidrv4,
|
|
176
|
+
cidrv6,
|
|
177
|
+
clone,
|
|
178
|
+
codec,
|
|
179
|
+
config,
|
|
180
|
+
cuid,
|
|
181
|
+
cuid2,
|
|
182
|
+
custom,
|
|
183
|
+
date,
|
|
115
184
|
decode,
|
|
116
|
-
encodeAsync,
|
|
117
185
|
decodeAsync,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
safeDecodeAsync,
|
|
122
|
-
ZodType,
|
|
123
|
-
_ZodString,
|
|
124
|
-
ZodString,
|
|
125
|
-
string,
|
|
126
|
-
ZodStringFormat,
|
|
127
|
-
ZodEmail,
|
|
186
|
+
describe,
|
|
187
|
+
discriminatedUnion,
|
|
188
|
+
e164,
|
|
128
189
|
email,
|
|
129
|
-
ZodGUID,
|
|
130
|
-
guid,
|
|
131
|
-
ZodUUID,
|
|
132
|
-
uuid,
|
|
133
|
-
uuidv4,
|
|
134
|
-
uuidv6,
|
|
135
|
-
uuidv7,
|
|
136
|
-
ZodURL,
|
|
137
|
-
url,
|
|
138
|
-
httpUrl,
|
|
139
|
-
ZodEmoji,
|
|
140
190
|
emoji,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
ZodIPv4,
|
|
154
|
-
ipv4,
|
|
155
|
-
ZodMAC,
|
|
156
|
-
mac,
|
|
157
|
-
ZodIPv6,
|
|
158
|
-
ipv6,
|
|
159
|
-
ZodCIDRv4,
|
|
160
|
-
cidrv4,
|
|
161
|
-
ZodCIDRv6,
|
|
162
|
-
cidrv6,
|
|
163
|
-
ZodBase64,
|
|
164
|
-
base64,
|
|
165
|
-
ZodBase64URL,
|
|
166
|
-
base64url,
|
|
167
|
-
ZodE164,
|
|
168
|
-
e164,
|
|
169
|
-
ZodJWT,
|
|
170
|
-
jwt,
|
|
171
|
-
ZodCustomStringFormat,
|
|
172
|
-
stringFormat,
|
|
173
|
-
hostname,
|
|
174
|
-
hex,
|
|
175
|
-
hash,
|
|
176
|
-
ZodNumber,
|
|
177
|
-
number,
|
|
178
|
-
ZodNumberFormat,
|
|
179
|
-
int,
|
|
191
|
+
encode,
|
|
192
|
+
encodeAsync,
|
|
193
|
+
exactOptional,
|
|
194
|
+
exports_coerce,
|
|
195
|
+
exports_core,
|
|
196
|
+
exports_external,
|
|
197
|
+
exports_iso,
|
|
198
|
+
exports_locales,
|
|
199
|
+
exports_regexes,
|
|
200
|
+
exports_util,
|
|
201
|
+
file,
|
|
202
|
+
flattenError,
|
|
180
203
|
float32,
|
|
181
204
|
float64,
|
|
205
|
+
formatError,
|
|
206
|
+
fromJSONSchema,
|
|
207
|
+
getErrorMap,
|
|
208
|
+
globalRegistry,
|
|
209
|
+
guid,
|
|
210
|
+
hash,
|
|
211
|
+
hex,
|
|
212
|
+
hostname,
|
|
213
|
+
httpUrl,
|
|
214
|
+
int,
|
|
182
215
|
int32,
|
|
183
|
-
uint32,
|
|
184
|
-
ZodBoolean,
|
|
185
|
-
boolean,
|
|
186
|
-
ZodBigInt,
|
|
187
|
-
bigint,
|
|
188
|
-
ZodBigIntFormat,
|
|
189
216
|
int64,
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
_null,
|
|
197
|
-
ZodAny,
|
|
198
|
-
any3,
|
|
199
|
-
ZodUnknown,
|
|
200
|
-
unknown,
|
|
201
|
-
ZodNever,
|
|
202
|
-
never,
|
|
203
|
-
ZodVoid,
|
|
204
|
-
_void,
|
|
205
|
-
ZodDate,
|
|
206
|
-
date,
|
|
207
|
-
ZodArray,
|
|
208
|
-
array,
|
|
217
|
+
intersection,
|
|
218
|
+
invertCodec,
|
|
219
|
+
ipv4,
|
|
220
|
+
ipv6,
|
|
221
|
+
json,
|
|
222
|
+
jwt,
|
|
209
223
|
keyof,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
224
|
+
ksuid,
|
|
225
|
+
lazy,
|
|
226
|
+
literal,
|
|
213
227
|
looseObject,
|
|
214
|
-
ZodUnion,
|
|
215
|
-
union,
|
|
216
|
-
ZodXor,
|
|
217
|
-
xor,
|
|
218
|
-
ZodDiscriminatedUnion,
|
|
219
|
-
discriminatedUnion,
|
|
220
|
-
ZodIntersection,
|
|
221
|
-
intersection,
|
|
222
|
-
ZodTuple,
|
|
223
|
-
tuple,
|
|
224
|
-
ZodRecord,
|
|
225
|
-
record,
|
|
226
|
-
partialRecord,
|
|
227
228
|
looseRecord,
|
|
228
|
-
|
|
229
|
+
mac,
|
|
229
230
|
map,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
_enum,
|
|
231
|
+
meta,
|
|
232
|
+
nan,
|
|
233
|
+
nanoid,
|
|
234
234
|
nativeEnum,
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
ZodFile,
|
|
238
|
-
file,
|
|
239
|
-
ZodTransform,
|
|
240
|
-
transform,
|
|
241
|
-
ZodOptional,
|
|
242
|
-
optional,
|
|
243
|
-
ZodExactOptional,
|
|
244
|
-
exactOptional,
|
|
245
|
-
ZodNullable,
|
|
235
|
+
never,
|
|
236
|
+
nonoptional,
|
|
246
237
|
nullable,
|
|
247
238
|
nullish,
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
ZodSuccess,
|
|
255
|
-
success,
|
|
256
|
-
ZodCatch,
|
|
257
|
-
_catch,
|
|
258
|
-
ZodNaN,
|
|
259
|
-
nan,
|
|
260
|
-
ZodPipe,
|
|
239
|
+
number,
|
|
240
|
+
object,
|
|
241
|
+
optional,
|
|
242
|
+
parse,
|
|
243
|
+
parseAsync,
|
|
244
|
+
partialRecord,
|
|
261
245
|
pipe,
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
ZodPreprocess,
|
|
266
|
-
ZodReadonly,
|
|
267
|
-
readonly,
|
|
268
|
-
ZodTemplateLiteral,
|
|
269
|
-
templateLiteral,
|
|
270
|
-
ZodLazy,
|
|
271
|
-
lazy,
|
|
272
|
-
ZodPromise,
|
|
246
|
+
prefault,
|
|
247
|
+
preprocess,
|
|
248
|
+
prettifyError,
|
|
273
249
|
promise,
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
ZodCustom,
|
|
277
|
-
check,
|
|
278
|
-
custom,
|
|
250
|
+
readonly,
|
|
251
|
+
record,
|
|
279
252
|
refine,
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
253
|
+
registry,
|
|
254
|
+
safeDecode,
|
|
255
|
+
safeDecodeAsync,
|
|
256
|
+
safeEncode,
|
|
257
|
+
safeEncodeAsync,
|
|
258
|
+
safeParse,
|
|
259
|
+
safeParseAsync,
|
|
260
|
+
set,
|
|
261
|
+
setErrorMap,
|
|
262
|
+
strictObject,
|
|
263
|
+
string,
|
|
264
|
+
stringFormat,
|
|
284
265
|
stringbool,
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
266
|
+
success,
|
|
267
|
+
superRefine,
|
|
268
|
+
symbol,
|
|
269
|
+
templateLiteral,
|
|
270
|
+
toJSONSchema,
|
|
271
|
+
transform,
|
|
272
|
+
treeifyError,
|
|
273
|
+
tuple,
|
|
274
|
+
uint32,
|
|
275
|
+
uint64,
|
|
276
|
+
ulid,
|
|
277
|
+
union,
|
|
278
|
+
unknown,
|
|
279
|
+
url,
|
|
280
|
+
uuid,
|
|
281
|
+
uuidv4,
|
|
282
|
+
uuidv6,
|
|
283
|
+
uuidv7,
|
|
284
|
+
xid,
|
|
285
|
+
xor
|
|
286
|
+
} from "./chunk-skzxcba3.js";
|
|
287
|
+
import {
|
|
288
|
+
__export
|
|
289
|
+
} from "./chunk-y64skrwp.js";
|
|
288
290
|
|
|
289
291
|
// src/z.ts
|
|
290
292
|
var exports_z = {};
|
|
@@ -374,9 +376,9 @@ __export(exports_z, {
|
|
|
374
376
|
_ZodString: () => _ZodString,
|
|
375
377
|
_default: () => _default,
|
|
376
378
|
_function: () => _function,
|
|
377
|
-
any: () =>
|
|
379
|
+
any: () => any,
|
|
378
380
|
array: () => array,
|
|
379
|
-
artifact: () =>
|
|
381
|
+
artifact: () => artifact,
|
|
380
382
|
base64: () => base64,
|
|
381
383
|
base64url: () => base64url,
|
|
382
384
|
bigint: () => bigint,
|
|
@@ -530,9 +532,10 @@ __export(exports_z, {
|
|
|
530
532
|
xor: () => xor,
|
|
531
533
|
z: () => exports_external
|
|
532
534
|
});
|
|
535
|
+
|
|
533
536
|
// src/definitions/artifacts/artifact.ts
|
|
534
|
-
var
|
|
535
|
-
var
|
|
537
|
+
var ARTIFACT_BRAND = "ScarnArtifact";
|
|
538
|
+
var ArtifactTypes = {
|
|
536
539
|
video: [".mp4", ".webm", ".mov"],
|
|
537
540
|
image: [".png", ".jpg", ".jpeg", ".gif", ".svg"]
|
|
538
541
|
};
|
|
@@ -541,7 +544,7 @@ function describeEntry(entry) {
|
|
|
541
544
|
const cleaned = entry.trim().toLowerCase().replace(/^\*?\.?/, "");
|
|
542
545
|
return cleaned && EXTENSION_PATTERN.test(`.${cleaned}`) ? ` Did you mean \`.${cleaned}\`?` : "";
|
|
543
546
|
}
|
|
544
|
-
function
|
|
547
|
+
function normalizeArtifactAccept(accept) {
|
|
545
548
|
if (accept === undefined)
|
|
546
549
|
return [];
|
|
547
550
|
const problems = [];
|
|
@@ -571,30 +574,30 @@ function normalizeArtifactAccept2(accept) {
|
|
|
571
574
|
}
|
|
572
575
|
return out;
|
|
573
576
|
}
|
|
574
|
-
function
|
|
577
|
+
function artifact(options = {}) {
|
|
575
578
|
const keyword = {
|
|
576
|
-
accept:
|
|
579
|
+
accept: normalizeArtifactAccept(options.accept)
|
|
577
580
|
};
|
|
578
|
-
return string().brand().meta({ [
|
|
581
|
+
return exports_external.string().brand().meta({ [ARTIFACT_SCHEMA_KEYWORD]: keyword });
|
|
579
582
|
}
|
|
580
583
|
var toMarkerRef = (target) => typeof target === "string" ? { type: "path", pattern: target } : {
|
|
581
584
|
type: "signal",
|
|
582
585
|
stepKey: target.step.key,
|
|
583
586
|
signalKey: target.path
|
|
584
587
|
};
|
|
585
|
-
var
|
|
588
|
+
var Artifact = {
|
|
586
589
|
path(relativePath) {
|
|
587
590
|
return relativePath;
|
|
588
591
|
},
|
|
589
592
|
embed(target, options) {
|
|
590
|
-
return
|
|
593
|
+
return buildArtifactMarker("embed", toMarkerRef(target), options.caption);
|
|
591
594
|
},
|
|
592
595
|
link(target, options) {
|
|
593
|
-
return
|
|
596
|
+
return buildArtifactMarker("link", toMarkerRef(target), options.label);
|
|
594
597
|
}
|
|
595
598
|
};
|
|
596
599
|
// src/definitions/steps/prompt-template.ts
|
|
597
|
-
function
|
|
600
|
+
function createPromptInputProxy(path = []) {
|
|
598
601
|
const token = () => path.length ? `{{${path.join(".")}}}` : "";
|
|
599
602
|
return new Proxy(Object.freeze({}), {
|
|
600
603
|
get(_, key) {
|
|
@@ -606,23 +609,23 @@ function createPromptInputProxy2(path = []) {
|
|
|
606
609
|
}
|
|
607
610
|
if (typeof key !== "string")
|
|
608
611
|
return;
|
|
609
|
-
return
|
|
612
|
+
return createPromptInputProxy([...path, key]);
|
|
610
613
|
}
|
|
611
614
|
});
|
|
612
615
|
}
|
|
613
|
-
function
|
|
616
|
+
function createPromptTemplateContext() {
|
|
614
617
|
return {
|
|
615
|
-
input:
|
|
616
|
-
env:
|
|
618
|
+
input: createPromptInputProxy(["input"]),
|
|
619
|
+
env: createPromptInputProxy(["env"]),
|
|
617
620
|
scarn: {
|
|
618
|
-
artifactsDir:
|
|
621
|
+
artifactsDir: createPromptInputProxy([
|
|
619
622
|
"scarn",
|
|
620
623
|
"artifactsDir"
|
|
621
624
|
])
|
|
622
625
|
}
|
|
623
626
|
};
|
|
624
627
|
}
|
|
625
|
-
function
|
|
628
|
+
function renderPromptTemplate(template, contextJson) {
|
|
626
629
|
return template.replace(/\{\{([^}]+)\}\}/g, (_, path) => {
|
|
627
630
|
const value = path.split(".").reduce((curr, key) => curr != null ? curr[key] : undefined, contextJson);
|
|
628
631
|
return value != null ? String(value) : "";
|
|
@@ -631,7 +634,7 @@ function renderPromptTemplate2(template, contextJson) {
|
|
|
631
634
|
|
|
632
635
|
// src/definitions/steps/env.ts
|
|
633
636
|
var SECRET_LOOKING_NAME = /SECRET|TOKEN|PASSWORD|PASSWD|API_?KEY|PRIVATE/i;
|
|
634
|
-
function
|
|
637
|
+
function isSecretLookingEnvName(name) {
|
|
635
638
|
return SECRET_LOOKING_NAME.test(name);
|
|
636
639
|
}
|
|
637
640
|
var helperEntries = new WeakSet;
|
|
@@ -639,7 +642,7 @@ function brand(entry) {
|
|
|
639
642
|
helperEntries.add(entry);
|
|
640
643
|
return entry;
|
|
641
644
|
}
|
|
642
|
-
var
|
|
645
|
+
var Env = {
|
|
643
646
|
value(opts) {
|
|
644
647
|
return brand({
|
|
645
648
|
kind: "value",
|
|
@@ -664,12 +667,12 @@ function isHelperEntry(entry) {
|
|
|
664
667
|
return typeof entry === "object" && helperEntries.has(entry);
|
|
665
668
|
}
|
|
666
669
|
function assertNotStaticSecret(name, value, flags) {
|
|
667
|
-
if (
|
|
670
|
+
if (containsInputToken(value))
|
|
668
671
|
return;
|
|
669
672
|
if (flags.secret) {
|
|
670
673
|
throw new Error(`Env "${name}": a secret must interpolate an input token; a static secret would be stored in plaintext. Use Env.inherit({ secret: true }) to read it from the worker.`);
|
|
671
674
|
}
|
|
672
|
-
if (
|
|
675
|
+
if (isSecretLookingEnvName(name) && !flags.unsafeAllowStatic) {
|
|
673
676
|
throw new Error(`Env "${name}": a static value on a secret-looking name would be stored in plaintext. Use Env.inherit({ secret: true }) to read it from the worker, or Env.value({ value, unsafeAllowStatic: true }) if it is not actually secret.`);
|
|
674
677
|
}
|
|
675
678
|
}
|
|
@@ -705,16 +708,16 @@ function toEnvVarSpec(name, entry) {
|
|
|
705
708
|
...appliesField(entry.applies)
|
|
706
709
|
};
|
|
707
710
|
}
|
|
708
|
-
function
|
|
711
|
+
function normalizeEnv(fn) {
|
|
709
712
|
if (!fn)
|
|
710
713
|
return null;
|
|
711
|
-
const
|
|
712
|
-
const specs = Object.entries(
|
|
714
|
+
const record2 = fn({ input: createPromptInputProxy(["input"]) });
|
|
715
|
+
const specs = Object.entries(record2).map(([name, entry]) => toEnvVarSpec(name, entry));
|
|
713
716
|
return specs.length > 0 ? specs : null;
|
|
714
717
|
}
|
|
715
718
|
|
|
716
719
|
// src/definitions/steps/repo.ts
|
|
717
|
-
var
|
|
720
|
+
var Repo = {
|
|
718
721
|
none() {
|
|
719
722
|
return { mode: "none" };
|
|
720
723
|
},
|
|
@@ -728,25 +731,25 @@ var Repo2 = {
|
|
|
728
731
|
function executionModeOf(runtime) {
|
|
729
732
|
return runtime?.kind === "host" ? "no_workspace" : "workspace";
|
|
730
733
|
}
|
|
731
|
-
function
|
|
734
|
+
function compileRepo(repo, runtime, ctx = {}) {
|
|
732
735
|
if (repo === undefined)
|
|
733
736
|
return;
|
|
734
737
|
const spec = typeof repo === "function" ? repo({
|
|
735
|
-
input:
|
|
736
|
-
result:
|
|
738
|
+
input: createPromptInputProxy(["input"]),
|
|
739
|
+
result: createPromptInputProxy(["result"])
|
|
737
740
|
}) : repo;
|
|
738
741
|
const where = ctx.stepKey ? `Step "${ctx.stepKey}" repo` : "repo";
|
|
739
742
|
const executionMode = executionModeOf(runtime);
|
|
740
|
-
const mismatch =
|
|
743
|
+
const mismatch = repoRuntimeMismatch(executionMode, spec.mode);
|
|
741
744
|
if (mismatch !== null) {
|
|
742
745
|
throw new Error(`${where} "${spec.mode}" cannot be used with executionMode "${executionMode}": ${mismatch}.`);
|
|
743
746
|
}
|
|
744
|
-
const
|
|
745
|
-
const parsed =
|
|
747
|
+
const config2 = spec.mode === "readWrite" ? toReadWriteConfig(spec) : { mode: spec.mode };
|
|
748
|
+
const parsed = repoConfigInputSchema.safeParse(config2);
|
|
746
749
|
if (!parsed.success) {
|
|
747
750
|
throw new Error(`${where}: ${parsed.error.issues.map((issue) => `${issue.path.join(".") || "mode"} ${issue.message}`).join("; ")}`);
|
|
748
751
|
}
|
|
749
|
-
return
|
|
752
|
+
return config2;
|
|
750
753
|
}
|
|
751
754
|
function toReadWriteConfig(spec) {
|
|
752
755
|
return {
|
|
@@ -759,13 +762,13 @@ function toReadWriteConfig(spec) {
|
|
|
759
762
|
}
|
|
760
763
|
|
|
761
764
|
// src/definitions/steps/runtime.ts
|
|
762
|
-
var managedRuntimeFactories = Object.fromEntries(
|
|
763
|
-
var
|
|
765
|
+
var managedRuntimeFactories = Object.fromEntries(MANAGED_RUNTIME_IDS.map((id) => [id, () => ({ kind: "managed", id })]));
|
|
766
|
+
var Runtime = {
|
|
764
767
|
managed: managedRuntimeFactories,
|
|
765
768
|
devcontainer(opts) {
|
|
766
769
|
if (opts?.config === undefined)
|
|
767
770
|
return { kind: "devcontainer" };
|
|
768
|
-
const parsed =
|
|
771
|
+
const parsed = devcontainerConfigPathSchema.safeParse(opts.config);
|
|
769
772
|
if (!parsed.success) {
|
|
770
773
|
throw new Error(`Runtime.devcontainer config "${opts.config}": ${parsed.error.issues.map((issue) => issue.message).join("; ")}`);
|
|
771
774
|
}
|
|
@@ -783,27 +786,27 @@ function assertNoSetupVarsOnHost(envJson, runtime, stepKey) {
|
|
|
783
786
|
return;
|
|
784
787
|
throw new Error(`${stepKey ? `Step "${stepKey}" ` : ""}env "${setupVar.name}": applies "${String(setupVar.applies)}" needs a container to set up, but Runtime.host() has none. Use applies "agent" or Runtime.devcontainer().`);
|
|
785
788
|
}
|
|
786
|
-
function
|
|
789
|
+
function compileEnvironment(environment, ctx = {}) {
|
|
787
790
|
const runtime = environment?.runtime ?? ctx.defaultRuntime;
|
|
788
|
-
const envJson =
|
|
791
|
+
const envJson = normalizeEnv(environment?.vars);
|
|
789
792
|
assertNoSetupVarsOnHost(envJson, runtime, ctx.stepKey);
|
|
790
793
|
return {
|
|
791
794
|
executionMode: runtime?.kind === "host" ? "no_workspace" : "workspace",
|
|
792
795
|
devcontainerConfigPath: runtime?.kind === "devcontainer" ? runtime.config ?? null : null,
|
|
793
796
|
managedRuntime: runtime?.kind === "managed" ? runtime.id : null,
|
|
794
797
|
envJson,
|
|
795
|
-
repo:
|
|
798
|
+
repo: compileRepo(environment?.repo, runtime, ctx)
|
|
796
799
|
};
|
|
797
800
|
}
|
|
798
801
|
|
|
799
802
|
// src/definitions/steps/mcp-server-config.ts
|
|
800
803
|
var ownedFields = { type: true, disabled: true };
|
|
801
|
-
var refFieldsSchema =
|
|
804
|
+
var refFieldsSchema = openCodeMcpRefConfigSchema.omit({
|
|
802
805
|
...ownedFields,
|
|
803
806
|
name: true
|
|
804
807
|
});
|
|
805
|
-
var localFieldsSchema =
|
|
806
|
-
var remoteFieldsSchema =
|
|
808
|
+
var localFieldsSchema = openCodeMcpLocalConfigSchema.omit(ownedFields);
|
|
809
|
+
var remoteFieldsSchema = openCodeMcpRemoteConfigSchema.omit(ownedFields);
|
|
807
810
|
var commonConfigKeys = new Set([
|
|
808
811
|
"type",
|
|
809
812
|
"name",
|
|
@@ -814,8 +817,8 @@ var commonConfigKeys = new Set([
|
|
|
814
817
|
function formatIssues(error) {
|
|
815
818
|
return error.issues.map((issue) => issue.path.length > 0 ? `${issue.path.map(String).join(".")}: ${issue.message}` : issue.message).join("; ");
|
|
816
819
|
}
|
|
817
|
-
function parseFields(name, schema,
|
|
818
|
-
const fields = Object.fromEntries(Object.entries(
|
|
820
|
+
function parseFields(name, schema, config2) {
|
|
821
|
+
const fields = Object.fromEntries(Object.entries(config2).filter(([key]) => !commonConfigKeys.has(key)));
|
|
819
822
|
const parsed = schema.safeParse(fields);
|
|
820
823
|
if (!parsed.success) {
|
|
821
824
|
throw new Error(`defineMcp "${name}": ${formatIssues(parsed.error)}`);
|
|
@@ -824,46 +827,46 @@ function parseFields(name, schema, config) {
|
|
|
824
827
|
}
|
|
825
828
|
function assertPlaceholders(name, field, values) {
|
|
826
829
|
for (const [key, value] of Object.entries(values ?? {})) {
|
|
827
|
-
if (
|
|
830
|
+
if (isEnvPlaceholderValue(value))
|
|
828
831
|
continue;
|
|
829
832
|
throw new Error(`defineMcp "${name}": ${field}.${key} must be written as {env:VAR}; a literal ${field} value would be stored in plaintext.`);
|
|
830
833
|
}
|
|
831
834
|
}
|
|
832
835
|
function inferredMcpEnv(definition) {
|
|
833
|
-
return definition.type === "ref" ? [] :
|
|
836
|
+
return definition.type === "ref" ? [] : collectEnvPlaceholderNames(definition.server);
|
|
834
837
|
}
|
|
835
838
|
function assertInferredEnv(definition) {
|
|
836
839
|
for (const variable of inferredMcpEnv(definition)) {
|
|
837
|
-
if (!
|
|
838
|
-
throw new Error(`defineMcp "${definition.name}": {env:${variable}} must name a variable matching ${String(
|
|
840
|
+
if (!ENV_VAR_NAME_PATTERN.test(variable)) {
|
|
841
|
+
throw new Error(`defineMcp "${definition.name}": {env:${variable}} must name a variable matching ${String(ENV_VAR_NAME_PATTERN)}.`);
|
|
839
842
|
}
|
|
840
|
-
if (
|
|
843
|
+
if (isReservedEnvVarName(variable)) {
|
|
841
844
|
throw new Error(`defineMcp "${definition.name}": {env:${variable}} reads a variable reserved for Scarn.`);
|
|
842
845
|
}
|
|
843
846
|
}
|
|
844
847
|
}
|
|
845
|
-
function parseMcpServer(
|
|
846
|
-
if (typeof
|
|
848
|
+
function parseMcpServer(config2) {
|
|
849
|
+
if (typeof config2.name !== "string" || config2.name.trim().length === 0) {
|
|
847
850
|
throw new Error("defineMcp: name must be a non-empty string.");
|
|
848
851
|
}
|
|
849
|
-
const { name } =
|
|
852
|
+
const { name } = config2;
|
|
850
853
|
let definition;
|
|
851
|
-
switch (
|
|
854
|
+
switch (config2.type) {
|
|
852
855
|
case "ref":
|
|
853
856
|
definition = {
|
|
854
857
|
type: "ref",
|
|
855
858
|
name,
|
|
856
|
-
server: parseFields(name, refFieldsSchema,
|
|
859
|
+
server: parseFields(name, refFieldsSchema, config2)
|
|
857
860
|
};
|
|
858
861
|
break;
|
|
859
862
|
case "local": {
|
|
860
|
-
const server = parseFields(name, localFieldsSchema,
|
|
863
|
+
const server = parseFields(name, localFieldsSchema, config2);
|
|
861
864
|
assertPlaceholders(name, "environment", server.environment);
|
|
862
865
|
definition = { type: "local", name, server };
|
|
863
866
|
break;
|
|
864
867
|
}
|
|
865
868
|
case "remote": {
|
|
866
|
-
const server = parseFields(name, remoteFieldsSchema,
|
|
869
|
+
const server = parseFields(name, remoteFieldsSchema, config2);
|
|
867
870
|
assertPlaceholders(name, "headers", server.headers);
|
|
868
871
|
definition = { type: "remote", name, server };
|
|
869
872
|
break;
|
|
@@ -876,8 +879,8 @@ function parseMcpServer(config) {
|
|
|
876
879
|
}
|
|
877
880
|
|
|
878
881
|
// src/definitions/steps/define-mcp.ts
|
|
879
|
-
var mcpCheckInputSchema =
|
|
880
|
-
var mcpCheckPatchSchema =
|
|
882
|
+
var mcpCheckInputSchema = toolHealthCheckSchema.omit({ kind: true, mcp: true, name: true }).extend({ enabled: exports_external.boolean().optional() }).strict();
|
|
883
|
+
var mcpCheckPatchSchema = toolHealthCheckSchema.pick({
|
|
881
884
|
tool: true,
|
|
882
885
|
args: true,
|
|
883
886
|
timeoutSeconds: true,
|
|
@@ -885,7 +888,7 @@ var mcpCheckPatchSchema = toolHealthCheckSchema2.pick({
|
|
|
885
888
|
serialGroup: true
|
|
886
889
|
}).partial().strict();
|
|
887
890
|
var handles = new WeakSet;
|
|
888
|
-
function
|
|
891
|
+
function isMcpHandle(value) {
|
|
889
892
|
return typeof value === "object" && value !== null && handles.has(value);
|
|
890
893
|
}
|
|
891
894
|
function deepFreeze(value) {
|
|
@@ -907,9 +910,9 @@ function assertCheckName(label, name) {
|
|
|
907
910
|
throw new Error(`defineMcp "${label}": health check name "${name}" must be non-empty and contain no ".".`);
|
|
908
911
|
}
|
|
909
912
|
}
|
|
910
|
-
function assertCheckInput(label, name,
|
|
913
|
+
function assertCheckInput(label, name, check2) {
|
|
911
914
|
assertCheckName(label, name);
|
|
912
|
-
const parsed = mcpCheckInputSchema.safeParse(
|
|
915
|
+
const parsed = mcpCheckInputSchema.safeParse(check2);
|
|
913
916
|
if (!parsed.success) {
|
|
914
917
|
throw new Error(`defineMcp "${label}" health check "${name}": ${formatIssues2(parsed.error)}`);
|
|
915
918
|
}
|
|
@@ -917,10 +920,10 @@ function assertCheckInput(label, name, check) {
|
|
|
917
920
|
function assertEnvNames(label, env, optionalEnv) {
|
|
918
921
|
const seen = new Set;
|
|
919
922
|
for (const name of [...env, ...optionalEnv]) {
|
|
920
|
-
if (!
|
|
921
|
-
throw new Error(`defineMcp "${label}": env var "${name}" must match ${String(
|
|
923
|
+
if (!ENV_VAR_NAME_PATTERN.test(name)) {
|
|
924
|
+
throw new Error(`defineMcp "${label}": env var "${name}" must match ${String(ENV_VAR_NAME_PATTERN)}.`);
|
|
922
925
|
}
|
|
923
|
-
if (
|
|
926
|
+
if (isReservedEnvVarName(name)) {
|
|
924
927
|
throw new Error(`defineMcp "${label}": env var "${name}" is reserved for Scarn.`);
|
|
925
928
|
}
|
|
926
929
|
if (seen.has(name)) {
|
|
@@ -972,26 +975,26 @@ function createHandle(state) {
|
|
|
972
975
|
assertKnownCheck(state, "enableCheck", name);
|
|
973
976
|
return withOp(state, { op: "enable", name });
|
|
974
977
|
},
|
|
975
|
-
addCheck: (name,
|
|
976
|
-
assertCheckInput(state.name, name,
|
|
978
|
+
addCheck: (name, check2) => {
|
|
979
|
+
assertCheckInput(state.name, name, check2);
|
|
977
980
|
if (knownCheckNames(state).has(name)) {
|
|
978
981
|
throw new Error(`defineMcp "${state.name}".addCheck: health check "${name}" already exists; use overrideCheck to change it.`);
|
|
979
982
|
}
|
|
980
|
-
return withOp(state, { op: "add", name, check: structuredClone(
|
|
983
|
+
return withOp(state, { op: "add", name, check: structuredClone(check2) });
|
|
981
984
|
},
|
|
982
985
|
disableAllChecks: () => withOp(state, { op: "disableAll" })
|
|
983
986
|
};
|
|
984
987
|
handles.add(handle);
|
|
985
988
|
return Object.freeze(handle);
|
|
986
989
|
}
|
|
987
|
-
function
|
|
988
|
-
const definition = parseMcpServer(
|
|
989
|
-
const env =
|
|
990
|
-
const optionalEnv =
|
|
990
|
+
function defineMcp(config2) {
|
|
991
|
+
const definition = parseMcpServer(config2);
|
|
992
|
+
const env = config2.env ?? [];
|
|
993
|
+
const optionalEnv = config2.optionalEnv ?? [];
|
|
991
994
|
assertEnvNames(definition.name, env, optionalEnv);
|
|
992
|
-
const checks =
|
|
993
|
-
for (const [name,
|
|
994
|
-
assertCheckInput(definition.name, name,
|
|
995
|
+
const checks = config2.healthChecks ?? {};
|
|
996
|
+
for (const [name, check2] of Object.entries(checks)) {
|
|
997
|
+
assertCheckInput(definition.name, name, check2);
|
|
995
998
|
}
|
|
996
999
|
return createHandle({
|
|
997
1000
|
...frozenCopy(definition),
|
|
@@ -1001,10 +1004,10 @@ function defineMcp2(config) {
|
|
|
1001
1004
|
overrides: Object.freeze([])
|
|
1002
1005
|
});
|
|
1003
1006
|
}
|
|
1004
|
-
function
|
|
1007
|
+
function resolveMcpChecks(handle) {
|
|
1005
1008
|
const resolved = new Map;
|
|
1006
|
-
for (const [name,
|
|
1007
|
-
resolved.set(name, { check: { ...
|
|
1009
|
+
for (const [name, check2] of Object.entries(handle.checks)) {
|
|
1010
|
+
resolved.set(name, { check: { ...check2 }, enabled: check2.enabled ?? true });
|
|
1008
1011
|
}
|
|
1009
1012
|
for (const op of handle.overrides) {
|
|
1010
1013
|
if (op.op === "add") {
|
|
@@ -1025,9 +1028,9 @@ function resolveMcpChecks2(handle) {
|
|
|
1025
1028
|
entry.enabled = op.op === "enable";
|
|
1026
1029
|
}
|
|
1027
1030
|
}
|
|
1028
|
-
return [...resolved].map(([name, { check, enabled }]) => ({
|
|
1031
|
+
return [...resolved].map(([name, { check: check2, enabled }]) => ({
|
|
1029
1032
|
name,
|
|
1030
|
-
check,
|
|
1033
|
+
check: check2,
|
|
1031
1034
|
enabled
|
|
1032
1035
|
}));
|
|
1033
1036
|
}
|
|
@@ -1048,24 +1051,24 @@ function compileServer(key, handle) {
|
|
|
1048
1051
|
}
|
|
1049
1052
|
}
|
|
1050
1053
|
function compileChecks(key, handle) {
|
|
1051
|
-
return
|
|
1054
|
+
return resolveMcpChecks(handle).filter((resolved) => resolved.enabled).map(({ name, check: check2 }) => ({
|
|
1052
1055
|
kind: "tool",
|
|
1053
1056
|
mcp: key,
|
|
1054
1057
|
name: `${key}.${name}`,
|
|
1055
|
-
tool:
|
|
1056
|
-
...
|
|
1057
|
-
...
|
|
1058
|
-
serialGroup:
|
|
1059
|
-
severity:
|
|
1058
|
+
tool: check2.tool,
|
|
1059
|
+
...check2.args !== undefined ? { args: check2.args } : {},
|
|
1060
|
+
...check2.timeoutSeconds !== undefined ? { timeoutSeconds: check2.timeoutSeconds } : {},
|
|
1061
|
+
serialGroup: check2.serialGroup ?? key,
|
|
1062
|
+
severity: check2.severity ?? "required"
|
|
1060
1063
|
}));
|
|
1061
1064
|
}
|
|
1062
1065
|
function compileEnv(key, handle) {
|
|
1063
|
-
const entry = (name,
|
|
1066
|
+
const entry = (name, optional2) => ({
|
|
1064
1067
|
source: "inherit",
|
|
1065
1068
|
name,
|
|
1066
1069
|
from: name,
|
|
1067
1070
|
secret: true,
|
|
1068
|
-
optional,
|
|
1071
|
+
optional: optional2,
|
|
1069
1072
|
mcp: key,
|
|
1070
1073
|
applies: "agent"
|
|
1071
1074
|
});
|
|
@@ -1096,14 +1099,14 @@ function dedupeEnv(entries) {
|
|
|
1096
1099
|
}
|
|
1097
1100
|
return [...byName.values()];
|
|
1098
1101
|
}
|
|
1099
|
-
function
|
|
1102
|
+
function compileMcps(mcps, stepKey) {
|
|
1100
1103
|
const compiled = {
|
|
1101
1104
|
opencodeMcpJson: {},
|
|
1102
1105
|
healthChecks: [],
|
|
1103
1106
|
envEntries: []
|
|
1104
1107
|
};
|
|
1105
1108
|
for (const [key, handle] of Object.entries(mcps)) {
|
|
1106
|
-
if (!
|
|
1109
|
+
if (!isMcpHandle(handle)) {
|
|
1107
1110
|
throw new Error(`Step "${stepKey}" mcps.${key}: expected a handle from defineMcp().`);
|
|
1108
1111
|
}
|
|
1109
1112
|
compiled.opencodeMcpJson[key] = compileServer(key, handle);
|
|
@@ -1124,7 +1127,7 @@ function mergeStepMcps(stepKey, input) {
|
|
|
1124
1127
|
envJson: input.envJson
|
|
1125
1128
|
};
|
|
1126
1129
|
}
|
|
1127
|
-
const compiled =
|
|
1130
|
+
const compiled = compileMcps(input.mcps, stepKey);
|
|
1128
1131
|
const stepVars = input.envJson ?? [];
|
|
1129
1132
|
const stepVarNames = new Set(stepVars.map((entry) => entry.name));
|
|
1130
1133
|
return {
|
|
@@ -1141,7 +1144,7 @@ function mergeStepMcps(stepKey, input) {
|
|
|
1141
1144
|
}
|
|
1142
1145
|
|
|
1143
1146
|
// src/definitions/steps/step-handle.ts
|
|
1144
|
-
function
|
|
1147
|
+
function compileStepErrors(stepKey, errors) {
|
|
1145
1148
|
const names = [...errors ?? []];
|
|
1146
1149
|
const seen = new Set;
|
|
1147
1150
|
for (const name of names) {
|
|
@@ -1155,15 +1158,15 @@ function compileStepErrors2(stepKey, errors) {
|
|
|
1155
1158
|
}
|
|
1156
1159
|
return names;
|
|
1157
1160
|
}
|
|
1158
|
-
function
|
|
1159
|
-
const known = new Set([...
|
|
1161
|
+
function compileStepRetry(stepKey, retry, errors) {
|
|
1162
|
+
const known = new Set([...BUILT_IN_ERRORS, ...errors]);
|
|
1160
1163
|
return (retry ?? []).map((entry) => {
|
|
1161
1164
|
if (entry.on.length === 0) {
|
|
1162
1165
|
throw new Error(`Step "${stepKey}": each retry must name an error.`);
|
|
1163
1166
|
}
|
|
1164
|
-
const
|
|
1165
|
-
if (
|
|
1166
|
-
throw new Error(`Step "${stepKey}": retry names "${
|
|
1167
|
+
const unknown2 = entry.on.find((name) => !known.has(name));
|
|
1168
|
+
if (unknown2 !== undefined) {
|
|
1169
|
+
throw new Error(`Step "${stepKey}": retry names "${unknown2}", which is neither a built-in error nor one the step declares.`);
|
|
1167
1170
|
}
|
|
1168
1171
|
if (!Number.isInteger(entry.maxAttempts) || entry.maxAttempts <= 0) {
|
|
1169
1172
|
throw new Error(`Step "${stepKey}": retry maxAttempts must be a positive integer.`);
|
|
@@ -1171,7 +1174,7 @@ function compileStepRetry2(stepKey, retry, errors) {
|
|
|
1171
1174
|
return { on: [...entry.on], maxAttempts: entry.maxAttempts };
|
|
1172
1175
|
});
|
|
1173
1176
|
}
|
|
1174
|
-
function
|
|
1177
|
+
function toStepHandle(spec) {
|
|
1175
1178
|
const node = stepNode(spec);
|
|
1176
1179
|
const call = stepCall(node);
|
|
1177
1180
|
const { name, ...rest } = spec;
|
|
@@ -1182,30 +1185,30 @@ function toStepHandle2(spec) {
|
|
|
1182
1185
|
Object.assign(call, rest);
|
|
1183
1186
|
return makeHandle(call, node);
|
|
1184
1187
|
}
|
|
1185
|
-
function
|
|
1188
|
+
function toStepSpec(step) {
|
|
1186
1189
|
return { ...step };
|
|
1187
1190
|
}
|
|
1188
1191
|
|
|
1189
1192
|
// src/definitions/steps/define-step.ts
|
|
1190
|
-
function assertStepMcpInput(
|
|
1191
|
-
if ("mcpServers" in
|
|
1192
|
-
throw new Error(`Step "${
|
|
1193
|
+
function assertStepMcpInput(config2) {
|
|
1194
|
+
if ("mcpServers" in config2) {
|
|
1195
|
+
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.`);
|
|
1193
1196
|
}
|
|
1194
|
-
if (
|
|
1197
|
+
if (config2.healthChecks == null)
|
|
1195
1198
|
return;
|
|
1196
|
-
const parsed =
|
|
1199
|
+
const parsed = stepHealthChecksInputSchema.safeParse(config2.healthChecks);
|
|
1197
1200
|
if (parsed.success)
|
|
1198
1201
|
return;
|
|
1199
1202
|
const issues = parsed.error.issues.map((issue) => issue.path.length > 0 ? `${issue.path.map(String).join(".")}: ${issue.message}` : issue.message).join("; ");
|
|
1200
|
-
throw new Error(`Step "${
|
|
1203
|
+
throw new Error(`Step "${config2.key}" healthChecks: ${issues}. MCP health checks are declared on the server with defineMcp({ healthChecks }).`);
|
|
1201
1204
|
}
|
|
1202
|
-
function
|
|
1203
|
-
const features =
|
|
1204
|
-
let effectiveResult =
|
|
1205
|
+
function defineStep(config2) {
|
|
1206
|
+
const features = config2.features ?? [];
|
|
1207
|
+
let effectiveResult = config2.result;
|
|
1205
1208
|
for (const feature of features) {
|
|
1206
1209
|
effectiveResult = effectiveResult ? effectiveResult.extend(feature._resultExtension.shape) : feature._resultExtension;
|
|
1207
1210
|
}
|
|
1208
|
-
const basePrompt = typeof
|
|
1211
|
+
const basePrompt = typeof config2.agentPrompt === "function" ? config2.agentPrompt(createPromptTemplateContext()) : config2.agentPrompt;
|
|
1209
1212
|
let effectivePrompt = basePrompt;
|
|
1210
1213
|
for (const feature of features) {
|
|
1211
1214
|
if (feature._promptAddition) {
|
|
@@ -1220,40 +1223,40 @@ ${feature._promptAddition}` : feature._promptAddition;
|
|
|
1220
1223
|
managedRuntime,
|
|
1221
1224
|
envJson,
|
|
1222
1225
|
repo
|
|
1223
|
-
} =
|
|
1224
|
-
assertStepMcpInput(
|
|
1225
|
-
const mcpFields = mergeStepMcps(
|
|
1226
|
-
mcps:
|
|
1227
|
-
healthChecks:
|
|
1226
|
+
} = compileEnvironment(config2.environment, { stepKey: config2.key });
|
|
1227
|
+
assertStepMcpInput(config2);
|
|
1228
|
+
const mcpFields = mergeStepMcps(config2.key, {
|
|
1229
|
+
mcps: config2.mcps,
|
|
1230
|
+
healthChecks: config2.healthChecks,
|
|
1228
1231
|
envJson
|
|
1229
1232
|
});
|
|
1230
1233
|
const resultSchemaJson = effectiveResult ? toJSONSchema(effectiveResult) : null;
|
|
1231
1234
|
const spec = {
|
|
1232
|
-
key:
|
|
1233
|
-
name:
|
|
1234
|
-
description:
|
|
1235
|
-
version:
|
|
1235
|
+
key: config2.key,
|
|
1236
|
+
name: config2.name,
|
|
1237
|
+
description: config2.description ?? null,
|
|
1238
|
+
version: config2.version ?? 1,
|
|
1236
1239
|
kind: "user_defined",
|
|
1237
|
-
status:
|
|
1240
|
+
status: config2.status ?? "active",
|
|
1238
1241
|
executionMode,
|
|
1239
1242
|
devcontainerConfigPath,
|
|
1240
1243
|
...managedRuntime !== null ? { managedRuntime } : {},
|
|
1241
1244
|
prompt: effectivePrompt,
|
|
1242
|
-
inputSchemaJson:
|
|
1245
|
+
inputSchemaJson: config2.additionalInput ? toJSONSchema(config2.additionalInput) : null,
|
|
1243
1246
|
resultSchemaJson,
|
|
1244
1247
|
opencodeMcpJson: mcpFields.opencodeMcpJson,
|
|
1245
1248
|
healthChecksJson: mcpFields.healthChecksJson,
|
|
1246
1249
|
envJson: mcpFields.envJson,
|
|
1247
1250
|
...repo !== undefined ? { repo } : {},
|
|
1248
|
-
errors:
|
|
1249
|
-
retryJson:
|
|
1251
|
+
errors: compileStepErrors(config2.key, config2.errors),
|
|
1252
|
+
retryJson: compileStepRetry(config2.key, config2.retry, config2.errors ?? [])
|
|
1250
1253
|
};
|
|
1251
|
-
return
|
|
1254
|
+
return toStepHandle(spec);
|
|
1252
1255
|
}
|
|
1253
1256
|
// src/definitions/steps/define-code-step.ts
|
|
1254
|
-
function
|
|
1255
|
-
const features =
|
|
1256
|
-
let effectiveResult =
|
|
1257
|
+
function codeStep(config2) {
|
|
1258
|
+
const features = config2.features ?? [];
|
|
1259
|
+
let effectiveResult = config2.resultSchema;
|
|
1257
1260
|
for (const feature of features) {
|
|
1258
1261
|
effectiveResult = effectiveResult ? effectiveResult.extend(feature._resultExtension.shape) : feature._resultExtension;
|
|
1259
1262
|
}
|
|
@@ -1263,38 +1266,38 @@ function codeStep2(config) {
|
|
|
1263
1266
|
managedRuntime,
|
|
1264
1267
|
envJson,
|
|
1265
1268
|
repo
|
|
1266
|
-
} =
|
|
1267
|
-
stepKey:
|
|
1268
|
-
defaultRuntime:
|
|
1269
|
+
} = compileEnvironment(config2.environment, {
|
|
1270
|
+
stepKey: config2.key,
|
|
1271
|
+
defaultRuntime: Runtime.managed[DEFAULT_CODE_STEP_RUNTIME_ID]()
|
|
1269
1272
|
});
|
|
1270
1273
|
const spec = {
|
|
1271
|
-
key:
|
|
1272
|
-
name:
|
|
1273
|
-
description:
|
|
1274
|
-
version:
|
|
1274
|
+
key: config2.key,
|
|
1275
|
+
name: config2.name,
|
|
1276
|
+
description: config2.description ?? null,
|
|
1277
|
+
version: config2.version ?? 1,
|
|
1275
1278
|
kind: "code",
|
|
1276
|
-
status:
|
|
1279
|
+
status: config2.status ?? "active",
|
|
1277
1280
|
executionMode,
|
|
1278
1281
|
devcontainerConfigPath,
|
|
1279
1282
|
managedRuntime,
|
|
1280
1283
|
prompt: null,
|
|
1281
|
-
inputSchemaJson:
|
|
1284
|
+
inputSchemaJson: config2.inputSchema ? toJSONSchema(config2.inputSchema) : null,
|
|
1282
1285
|
resultSchemaJson: effectiveResult ? toJSONSchema(effectiveResult) : null,
|
|
1283
1286
|
opencodeMcpJson: null,
|
|
1284
1287
|
healthChecksJson: null,
|
|
1285
1288
|
envJson,
|
|
1286
1289
|
...repo !== undefined ? { repo } : {},
|
|
1287
|
-
errors:
|
|
1288
|
-
retryJson:
|
|
1289
|
-
entrypoint: { fn:
|
|
1290
|
+
errors: compileStepErrors(config2.key, config2.errors),
|
|
1291
|
+
retryJson: compileStepRetry(config2.key, config2.retry, config2.errors ?? []),
|
|
1292
|
+
entrypoint: { fn: config2.fn }
|
|
1290
1293
|
};
|
|
1291
|
-
return
|
|
1294
|
+
return toStepHandle(spec);
|
|
1292
1295
|
}
|
|
1293
1296
|
// src/definitions/steps/step-definitions-client.ts
|
|
1294
1297
|
var ANY_OBJECT_SCHEMA = { type: "object" };
|
|
1295
|
-
function
|
|
1298
|
+
function createStepDefinitionsClient(baseUrl) {
|
|
1296
1299
|
const client = createClient({ baseUrl });
|
|
1297
|
-
return buildStepDefinitionsClient(new
|
|
1300
|
+
return buildStepDefinitionsClient(new StepDefinitions({ client }));
|
|
1298
1301
|
}
|
|
1299
1302
|
var buildStepDefinitionsClient = (stepDefinitions) => {
|
|
1300
1303
|
return {
|
|
@@ -1317,7 +1320,7 @@ var buildStepDefinitionsClient = (stepDefinitions) => {
|
|
|
1317
1320
|
return result.data;
|
|
1318
1321
|
},
|
|
1319
1322
|
upsertFromSpec: async (projectId, step, options) => {
|
|
1320
|
-
const spec =
|
|
1323
|
+
const spec = toStepSpec(step);
|
|
1321
1324
|
const body = {
|
|
1322
1325
|
key: spec.key,
|
|
1323
1326
|
name: spec.name,
|
|
@@ -1354,15 +1357,15 @@ var buildStepDefinitionsClient = (stepDefinitions) => {
|
|
|
1354
1357
|
};
|
|
1355
1358
|
};
|
|
1356
1359
|
// src/definitions/steps/step-features.ts
|
|
1357
|
-
var notificationKindSchema =
|
|
1360
|
+
var notificationKindSchema = exports_external.enum([
|
|
1358
1361
|
"feedback_request",
|
|
1359
1362
|
"status_update",
|
|
1360
1363
|
"blocked",
|
|
1361
1364
|
"result_ready",
|
|
1362
1365
|
"warning"
|
|
1363
1366
|
]);
|
|
1364
|
-
var notificationPrioritySchema =
|
|
1365
|
-
var notificationChannelSchema =
|
|
1367
|
+
var notificationPrioritySchema = exports_external.enum(["low", "normal", "high", "urgent"]);
|
|
1368
|
+
var notificationChannelSchema = exports_external.enum([
|
|
1366
1369
|
"in_app",
|
|
1367
1370
|
"work_item_platform_comment",
|
|
1368
1371
|
"email",
|
|
@@ -1370,17 +1373,17 @@ var notificationChannelSchema = _enum([
|
|
|
1370
1373
|
]);
|
|
1371
1374
|
var NOTIFICATION_RESULT_KEY = "$scarn_notifications_v1";
|
|
1372
1375
|
var DEFAULT_NOTIFICATION_KIND = "status_update";
|
|
1373
|
-
var notificationItemSchema = object({
|
|
1376
|
+
var notificationItemSchema = exports_external.object({
|
|
1374
1377
|
kind: notificationKindSchema.describe("The kind of user notification."),
|
|
1375
|
-
title: string().optional().describe("Short, human-readable notification title."),
|
|
1376
|
-
body: string().describe("The notification body / details."),
|
|
1378
|
+
title: exports_external.string().optional().describe("Short, human-readable notification title."),
|
|
1379
|
+
body: exports_external.string().describe("The notification body / details."),
|
|
1377
1380
|
priority: notificationPrioritySchema.describe("How important this notification is for the user."),
|
|
1378
|
-
suggestedChannels: array(notificationChannelSchema).optional().describe("Channels the agent thinks are worth using. The platform policy decides the final channels."),
|
|
1379
|
-
payload: record(string(), unknown()).optional().describe('Kind-specific structured data. For "feedback_request": { category, urgency }.')
|
|
1381
|
+
suggestedChannels: exports_external.array(notificationChannelSchema).optional().describe("Channels the agent thinks are worth using. The platform policy decides the final channels."),
|
|
1382
|
+
payload: exports_external.record(exports_external.string(), exports_external.unknown()).optional().describe('Kind-specific structured data. For "feedback_request": { category, urgency }.')
|
|
1380
1383
|
}).describe("A single user notification emitted by the agent.");
|
|
1381
1384
|
var notificationsFeature = {
|
|
1382
|
-
_resultExtension: object({
|
|
1383
|
-
[NOTIFICATION_RESULT_KEY]: array(notificationItemSchema).optional()
|
|
1385
|
+
_resultExtension: exports_external.object({
|
|
1386
|
+
[NOTIFICATION_RESULT_KEY]: exports_external.array(notificationItemSchema).optional()
|
|
1384
1387
|
}),
|
|
1385
1388
|
_promptAddition: [
|
|
1386
1389
|
"## User Notifications",
|
|
@@ -1408,8 +1411,8 @@ var notificationsFeature = {
|
|
|
1408
1411
|
`)
|
|
1409
1412
|
};
|
|
1410
1413
|
var feedbackRequestsFeature = {
|
|
1411
|
-
_resultExtension: object({
|
|
1412
|
-
[NOTIFICATION_RESULT_KEY]: array(notificationItemSchema.extend({ kind: literal("feedback_request") })).optional()
|
|
1414
|
+
_resultExtension: exports_external.object({
|
|
1415
|
+
[NOTIFICATION_RESULT_KEY]: exports_external.array(notificationItemSchema.extend({ kind: exports_external.literal("feedback_request") })).optional()
|
|
1413
1416
|
}),
|
|
1414
1417
|
_promptAddition: [
|
|
1415
1418
|
"## Feedback Requests",
|
|
@@ -1423,15 +1426,15 @@ var feedbackRequestsFeature = {
|
|
|
1423
1426
|
].join(`
|
|
1424
1427
|
`)
|
|
1425
1428
|
};
|
|
1426
|
-
var
|
|
1429
|
+
var Features = {
|
|
1427
1430
|
notifications: () => notificationsFeature,
|
|
1428
1431
|
feedbackRequests: () => feedbackRequestsFeature
|
|
1429
1432
|
};
|
|
1430
|
-
var
|
|
1433
|
+
var Notify = {
|
|
1431
1434
|
create: (item) => ({
|
|
1432
1435
|
[NOTIFICATION_RESULT_KEY]: [item]
|
|
1433
1436
|
}),
|
|
1434
|
-
inApp: (title, body, priority, options) =>
|
|
1437
|
+
inApp: (title, body, priority, options) => Notify.create({
|
|
1435
1438
|
kind: options?.kind ?? DEFAULT_NOTIFICATION_KIND,
|
|
1436
1439
|
title,
|
|
1437
1440
|
body,
|
|
@@ -1439,7 +1442,7 @@ var Notify2 = {
|
|
|
1439
1442
|
suggestedChannels: ["in_app"],
|
|
1440
1443
|
...options?.payload ? { payload: options.payload } : {}
|
|
1441
1444
|
}),
|
|
1442
|
-
feedbackRequest: (question, category, urgency) =>
|
|
1445
|
+
feedbackRequest: (question, category, urgency) => Notify.create({
|
|
1443
1446
|
kind: "feedback_request",
|
|
1444
1447
|
title: question,
|
|
1445
1448
|
body: question,
|
|
@@ -1450,4 +1453,4 @@ var Notify2 = {
|
|
|
1450
1453
|
[NOTIFICATION_RESULT_KEY]: fragments.flatMap((fragment) => fragment[NOTIFICATION_RESULT_KEY])
|
|
1451
1454
|
})
|
|
1452
1455
|
};
|
|
1453
|
-
export {
|
|
1456
|
+
export { ARTIFACT_BRAND, ArtifactTypes, normalizeArtifactAccept, artifact, Artifact, exports_z, createPromptInputProxy, createPromptTemplateContext, renderPromptTemplate, isSecretLookingEnvName, Env, normalizeEnv, Repo, compileRepo, Runtime, compileEnvironment, isMcpHandle, defineMcp, resolveMcpChecks, compileMcps, compileStepErrors, compileStepRetry, toStepHandle, toStepSpec, defineStep, codeStep, createStepDefinitionsClient, Features, Notify };
|