@scarn/sdk 0.8.21 → 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.
- package/dist/auth/index.js +15 -16
- package/dist/automations/index.js +14 -17
- package/dist/{chunk-6p340dd4.js → chunk-0bwsjn0b.js} +29 -29
- package/dist/{chunk-r3sbp2wn.js → chunk-0w13kxkr.js} +34 -31
- package/dist/{chunk-nkm31g10.js → chunk-3j5wf2t5.js} +44 -43
- package/dist/{chunk-0y2fy5en.js → chunk-4361gxk0.js} +7 -7
- package/dist/{chunk-8tmsvkmj.js → chunk-52520csz.js} +13 -12
- package/dist/chunk-5dnfgyx8.js +159 -0
- package/dist/{chunk-k57h6qke.js → chunk-5fa4arn1.js} +12 -8
- package/dist/{chunk-ngy1fdcx.js → chunk-631ffb6r.js} +10 -10
- package/dist/{chunk-01nfqm18.js → chunk-7anj08zc.js} +11 -9
- package/dist/{chunk-p74r4y6j.js → chunk-7dr4kybf.js} +481 -449
- package/dist/chunk-7mhr5aex.js +171 -0
- package/dist/chunk-7rywbqzz.js +27 -0
- package/dist/{chunk-xhpp6qz8.js → chunk-9ct3xypr.js} +2552 -3780
- package/dist/{chunk-azss2d1n.js → chunk-9geh4c3v.js} +153 -155
- package/dist/{chunk-8hsk6f6b.js → chunk-9qf0eg7m.js} +19 -19
- package/dist/{chunk-y11p1q7r.js → chunk-aqqywy8g.js} +4 -4
- package/dist/chunk-bcvx11fn.js +174 -0
- package/dist/{chunk-59arcerk.js → chunk-cyfeaz43.js} +86 -86
- package/dist/chunk-czq37rrt.js +286 -0
- package/dist/chunk-ec5z8bbq.js +126 -0
- package/dist/{chunk-rt9tq4j6.js → chunk-h9yxx0hd.js} +7 -7
- package/dist/{chunk-gasw078g.js → chunk-hma87efq.js} +40 -40
- package/dist/{chunk-5dny5jg1.js → chunk-hpv234hf.js} +11 -11
- package/dist/{chunk-y81cr6tp.js → chunk-k7xnsmp5.js} +158 -87
- package/dist/{chunk-zxzvketc.js → chunk-kbpkpxcn.js} +20 -19
- package/dist/{chunk-6tra3gw8.js → chunk-kjn1knb9.js} +7 -7
- package/dist/{chunk-0he2dx5n.js → chunk-p3s7cjfc.js} +15 -14
- package/dist/chunk-pq6hrtnb.js +49 -0
- package/dist/{chunk-mp2rqtcj.js → chunk-ptpy7nnm.js} +8 -8
- package/dist/{chunk-xqfj56m9.js → chunk-vn1rfxma.js} +8 -8
- package/dist/chunk-vyv8kvkv.js +113 -0
- package/dist/{chunk-h1v6w1fh.js → chunk-xe2zgyz7.js} +35 -35
- package/dist/chunk-y4dwmhn2.js +14 -0
- package/dist/{chunk-8kzaxz52.js → chunk-yypj3zn0.js} +8 -8
- package/dist/chunk-yzj1mfpr.js +1515 -0
- package/dist/client.js +62 -61
- package/dist/connectors/index.js +36 -37
- package/dist/contracts/artifact-markers.js +11 -12
- package/dist/contracts/artifacts.js +21 -23
- package/dist/contracts/automation-document/index.js +28 -30
- package/dist/contracts/pipeline-document/built-ins.d.ts +1 -1
- package/dist/contracts/pipeline-document/index.js +95 -97
- package/dist/contracts/step-artifact-submissions.js +20 -17
- package/dist/contracts/work-item-changes.js +8 -6
- package/dist/defaults/index.js +22 -23
- package/dist/definitions/automations/index.js +6 -8
- package/dist/definitions/environments/index.js +37 -38
- package/dist/definitions/pipelines/index.js +12 -14
- package/dist/definitions/steps/define-mcp.d.ts +2 -2
- package/dist/definitions/steps/index.js +93 -95
- package/dist/definitions/steps/mcp-server-config.d.ts +13 -3
- package/dist/definitions/steps/step-definitions-client.d.ts +18 -0
- package/dist/definitions/validation/index.js +17 -18
- package/dist/devcontainer-config-path.js +9 -11
- package/dist/env-vars.js +37 -39
- package/dist/environment.js +41 -42
- package/dist/eslint.js +0 -2
- package/dist/generated/index.d.ts +2 -2
- package/dist/generated/sdk.gen.d.ts +41 -1
- package/dist/generated/types.gen.d.ts +1801 -0
- package/dist/git-url/git-repo-identity.js +0 -2
- package/dist/health-checks.js +15 -17
- package/dist/index.js +364 -358
- package/dist/jsonc.js +7 -8
- package/dist/managed-connections.d.ts +16 -0
- package/dist/managed-connections.js +9 -0
- package/dist/managed-runtimes.js +9 -11
- package/dist/opencode-mcp.d.ts +55 -1
- package/dist/opencode-mcp.js +33 -28
- package/dist/pipelines/index.js +78 -81
- package/dist/push/code-step-lookup.js +9 -10
- package/dist/push/index.d.ts +1 -0
- package/dist/push/index.js +88 -59
- package/dist/push/push-from-directory.d.ts +3 -0
- package/dist/push/pushed-mcp-servers.d.ts +28 -0
- package/dist/repo-config.js +41 -43
- package/dist/resolve-environment.js +14 -15
- package/dist/scarn-config-parser.js +5 -6
- package/dist/task-plane-client.d.ts +137 -1
- package/package.json +6 -2
- package/dist/chunk-08gcnrzh.js +0 -96
- package/dist/chunk-5say64w8.js +0 -14
- package/dist/chunk-aph2js2v.js +0 -167
- package/dist/chunk-mrzn5tq4.js +0 -107
- package/dist/chunk-pwyj6qf3.js +0 -119
- package/dist/chunk-qt81x1pm.js +0 -275
- package/dist/chunk-vsp708vw.js +0 -167
- package/dist/chunk-y64skrwp.js +0 -17
- package/dist/chunk-y7ac1t9c.js +0 -39
|
@@ -1,322 +1,325 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "./chunk-y7ac1t9c.js";
|
|
3
|
+
ARTIFACT_SCHEMA_KEYWORD2
|
|
4
|
+
} from "./chunk-9qf0eg7m.js";
|
|
6
5
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
createPromptInputProxy,
|
|
10
|
-
createPromptTemplateContext,
|
|
11
|
-
knownEnvironmentVars
|
|
12
|
-
} from "./chunk-gasw078g.js";
|
|
6
|
+
buildArtifactMarker2
|
|
7
|
+
} from "./chunk-631ffb6r.js";
|
|
13
8
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
toolHealthCheckSchema2,
|
|
10
|
+
stepHealthChecksInputSchema2
|
|
11
|
+
} from "./chunk-pq6hrtnb.js";
|
|
16
12
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
ENV_VAR_NAME_PATTERN2,
|
|
14
|
+
isReservedEnvVarName2
|
|
15
|
+
} from "./chunk-vyv8kvkv.js";
|
|
16
|
+
import {
|
|
17
|
+
DEFAULT_CODE_STEP_RUNTIME_ID2
|
|
18
|
+
} from "./chunk-y4dwmhn2.js";
|
|
21
19
|
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
mcpConnectionAuthSchema2,
|
|
21
|
+
openCodeMcpLocalConfigSchema2,
|
|
22
|
+
openCodeMcpRemoteConfigSchema2,
|
|
23
|
+
openCodeMcpRefConfigSchema2,
|
|
24
|
+
remoteConnectionAuthIssues2,
|
|
25
|
+
refConnectionAuthIssues2,
|
|
26
|
+
isEnvPlaceholderValue2,
|
|
27
|
+
collectEnvPlaceholderNames2
|
|
28
|
+
} from "./chunk-5dnfgyx8.js";
|
|
26
29
|
import {
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
findConnectorMcpCollisions2,
|
|
31
|
+
connectorMcpCollisionMessage2
|
|
32
|
+
} from "./chunk-3j5wf2t5.js";
|
|
29
33
|
import {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
createPromptInputProxy2,
|
|
35
|
+
createPromptTemplateContext2,
|
|
36
|
+
Runtime2,
|
|
37
|
+
knownEnvironmentVars2,
|
|
38
|
+
compileEnvironment2
|
|
39
|
+
} from "./chunk-hma87efq.js";
|
|
33
40
|
import {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
openCodeMcpLocalConfigSchema,
|
|
37
|
-
openCodeMcpRefConfigSchema,
|
|
38
|
-
openCodeMcpRemoteConfigSchema
|
|
39
|
-
} from "./chunk-08gcnrzh.js";
|
|
41
|
+
isEnvironmentHandle2
|
|
42
|
+
} from "./chunk-kjn1knb9.js";
|
|
40
43
|
import {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
findBaseBranchEnvProblems2,
|
|
45
|
+
describeBaseBranchEnvProblem2,
|
|
46
|
+
repoConfigInputSchema2
|
|
47
|
+
} from "./chunk-7mhr5aex.js";
|
|
44
48
|
import {
|
|
45
|
-
|
|
49
|
+
StepDefinitions2,
|
|
46
50
|
createApiClient
|
|
47
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-k7xnsmp5.js";
|
|
48
52
|
import {
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
makeHandle,
|
|
54
|
+
stepNode,
|
|
55
|
+
stepCall
|
|
56
|
+
} from "./chunk-vn1rfxma.js";
|
|
51
57
|
import {
|
|
52
|
-
|
|
53
|
-
} from "./chunk-
|
|
58
|
+
BUILT_IN_ERRORS2
|
|
59
|
+
} from "./chunk-7anj08zc.js";
|
|
54
60
|
import {
|
|
55
|
-
|
|
56
|
-
|
|
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";
|
|
57
73
|
import {
|
|
74
|
+
__export,
|
|
75
|
+
toZod,
|
|
76
|
+
clone,
|
|
77
|
+
exports_util,
|
|
78
|
+
NEVER,
|
|
58
79
|
$brand,
|
|
59
|
-
|
|
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
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
_minLength,
|
|
164
|
-
_minSize,
|
|
165
|
-
_multipleOf,
|
|
103
|
+
_gt,
|
|
104
|
+
_gte,
|
|
105
|
+
_positive,
|
|
166
106
|
_negative,
|
|
167
|
-
_nonnegative,
|
|
168
107
|
_nonpositive,
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
_properties,
|
|
174
|
-
_property,
|
|
175
|
-
_regex,
|
|
108
|
+
_nonnegative,
|
|
109
|
+
_multipleOf,
|
|
110
|
+
_maxSize,
|
|
111
|
+
_minSize,
|
|
176
112
|
_size,
|
|
177
|
-
|
|
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
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
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
|
-
|
|
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
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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
|
-
|
|
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
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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
|
-
|
|
249
|
-
|
|
250
|
-
|
|
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
|
-
|
|
262
|
+
ZodMap,
|
|
254
263
|
map,
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
264
|
+
ZodSet,
|
|
265
|
+
set,
|
|
266
|
+
ZodEnum,
|
|
267
|
+
_enum,
|
|
259
268
|
nativeEnum,
|
|
260
|
-
|
|
261
|
-
|
|
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
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
output,
|
|
268
|
-
parse,
|
|
269
|
-
parseAsync,
|
|
270
|
-
partialRecord,
|
|
271
|
-
pipe,
|
|
282
|
+
ZodDefault,
|
|
283
|
+
_default,
|
|
284
|
+
ZodPrefault,
|
|
272
285
|
prefault,
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
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
|
-
|
|
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
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
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-xhpp6qz8.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: () =>
|
|
418
|
+
any: () => any3,
|
|
416
419
|
array: () => array,
|
|
417
|
-
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: () =>
|
|
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
|
|
588
|
-
var
|
|
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
|
|
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
|
|
629
|
+
function artifact2(options = {}) {
|
|
628
630
|
const keyword = {
|
|
629
|
-
accept:
|
|
631
|
+
accept: normalizeArtifactAccept2(options.accept)
|
|
630
632
|
};
|
|
631
|
-
return
|
|
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
|
|
640
|
+
var Artifact2 = {
|
|
639
641
|
path(relativePath) {
|
|
640
642
|
return relativePath;
|
|
641
643
|
},
|
|
642
644
|
embed(target, options) {
|
|
643
|
-
return
|
|
645
|
+
return buildArtifactMarker2("embed", toMarkerRef(target), options.caption);
|
|
644
646
|
},
|
|
645
647
|
link(target, options) {
|
|
646
|
-
return
|
|
648
|
+
return buildArtifactMarker2("link", toMarkerRef(target), options.label);
|
|
647
649
|
}
|
|
648
650
|
};
|
|
649
651
|
// src/definitions/steps/repo.ts
|
|
650
|
-
var
|
|
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
|
|
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
|
|
668
|
+
function compileRepo2(repo, ctx = {}) {
|
|
667
669
|
if (repo === undefined)
|
|
668
670
|
return;
|
|
669
671
|
const spec = typeof repo === "function" ? repo({
|
|
670
|
-
input:
|
|
671
|
-
result:
|
|
672
|
-
workItem:
|
|
673
|
-
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
|
|
677
|
-
const parsed =
|
|
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
|
|
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
|
|
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 =
|
|
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(
|
|
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 =
|
|
731
|
+
var refFieldsSchema = openCodeMcpRefConfigSchema2.omit({
|
|
730
732
|
...ownedFields,
|
|
731
733
|
name: true
|
|
732
734
|
});
|
|
733
|
-
var localFieldsSchema =
|
|
734
|
-
var remoteFieldsSchema =
|
|
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,
|
|
746
|
-
const fields = Object.fromEntries(Object.entries(
|
|
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 (
|
|
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" ? [] :
|
|
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 (!
|
|
766
|
-
throw new Error(`defineMcp "${definition.name}": {env:${variable}} must name a variable matching ${String(
|
|
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 (
|
|
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(
|
|
774
|
-
if (typeof
|
|
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 } =
|
|
793
|
+
const { name } = config;
|
|
778
794
|
let definition;
|
|
779
|
-
switch (
|
|
780
|
-
case "ref":
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
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,
|
|
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
|
-
|
|
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 =
|
|
808
|
-
var mcpCheckPatchSchema =
|
|
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
|
|
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,
|
|
854
|
+
function assertCheckInput(label, name, check) {
|
|
839
855
|
assertCheckName(label, name);
|
|
840
|
-
const parsed = mcpCheckInputSchema.safeParse(
|
|
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 (!
|
|
849
|
-
throw new Error(`defineMcp "${label}": env var "${name}" must match ${String(
|
|
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 (
|
|
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,
|
|
904
|
-
assertCheckInput(state.name, name,
|
|
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(
|
|
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
|
|
916
|
-
const definition = parseMcpServer(
|
|
917
|
-
|
|
918
|
-
|
|
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 =
|
|
921
|
-
for (const [name,
|
|
922
|
-
assertCheckInput(definition.name, name,
|
|
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
|
|
962
|
+
function resolveMcpChecks2(handle) {
|
|
933
963
|
const resolved = new Map;
|
|
934
|
-
for (const [name,
|
|
935
|
-
resolved.set(name, { check: { ...
|
|
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
|
|
986
|
+
return [...resolved].map(([name, { check, enabled }]) => ({
|
|
957
987
|
name,
|
|
958
|
-
check
|
|
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
|
|
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:
|
|
987
|
-
...
|
|
988
|
-
...
|
|
989
|
-
serialGroup:
|
|
990
|
-
severity:
|
|
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
|
-
|
|
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
|
|
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
|
|
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 (!
|
|
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 (!
|
|
1058
|
+
if (!isEnvironmentHandle2(environment) || mcps === undefined)
|
|
1027
1059
|
return;
|
|
1028
|
-
const collisions =
|
|
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}": ${
|
|
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,
|
|
1037
|
-
if (!
|
|
1068
|
+
function mergeStepMcps(stepKey, input) {
|
|
1069
|
+
if (!input.mcps || Object.keys(input.mcps).length === 0) {
|
|
1038
1070
|
return {
|
|
1039
1071
|
opencodeMcpJson: null,
|
|
1040
|
-
healthChecksJson:
|
|
1041
|
-
envJson:
|
|
1072
|
+
healthChecksJson: input.healthChecks ?? null,
|
|
1073
|
+
envJson: input.envJson
|
|
1042
1074
|
};
|
|
1043
1075
|
}
|
|
1044
|
-
const compiled =
|
|
1076
|
+
const compiled = compileMcps2(input.mcps, stepKey);
|
|
1045
1077
|
return {
|
|
1046
1078
|
opencodeMcpJson: compiled.opencodeMcpJson,
|
|
1047
1079
|
healthChecksJson: nonEmpty([
|
|
1048
1080
|
...compiled.healthChecks,
|
|
1049
|
-
...
|
|
1081
|
+
...input.healthChecks ?? []
|
|
1050
1082
|
]),
|
|
1051
|
-
envJson:
|
|
1083
|
+
envJson: input.envJson
|
|
1052
1084
|
};
|
|
1053
1085
|
}
|
|
1054
1086
|
|
|
1055
1087
|
// src/definitions/steps/step-handle.ts
|
|
1056
|
-
function
|
|
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
|
|
1071
|
-
const known = new Set([...
|
|
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
|
|
1077
|
-
if (
|
|
1078
|
-
throw new Error(`Step "${stepKey}": retry names "${
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
1156
|
+
return isEnvironmentHandle2(handle) ? handle : undefined;
|
|
1125
1157
|
}
|
|
1126
|
-
function
|
|
1158
|
+
function toStepSpec2(step) {
|
|
1127
1159
|
return { ...step };
|
|
1128
1160
|
}
|
|
1129
1161
|
|
|
1130
1162
|
// src/definitions/steps/define-step.ts
|
|
1131
|
-
function assertStepMcpInput(
|
|
1132
|
-
if ("mcpServers" in
|
|
1133
|
-
throw new Error(`Step "${
|
|
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 (
|
|
1167
|
+
if (config.healthChecks == null)
|
|
1136
1168
|
return;
|
|
1137
|
-
const parsed =
|
|
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 "${
|
|
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
|
|
1160
|
-
const features =
|
|
1161
|
-
const grants = collectGrants(
|
|
1162
|
-
let effectiveResult =
|
|
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
|
|
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 =
|
|
1178
|
-
stepKey:
|
|
1209
|
+
const environment = compileEnvironment2(config.environment, {
|
|
1210
|
+
stepKey: config.key
|
|
1179
1211
|
});
|
|
1180
|
-
const repo =
|
|
1181
|
-
|
|
1182
|
-
assertStepMcpInput(
|
|
1183
|
-
assertNoConnectorMcpCollisions(
|
|
1184
|
-
const mcpFields = mergeStepMcps(
|
|
1185
|
-
mcps:
|
|
1186
|
-
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:
|
|
1192
|
-
name:
|
|
1193
|
-
description:
|
|
1194
|
-
version:
|
|
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:
|
|
1228
|
+
status: config.status ?? "active",
|
|
1197
1229
|
environment,
|
|
1198
1230
|
prompt: effectivePrompt,
|
|
1199
|
-
inputSchemaJson:
|
|
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:
|
|
1205
|
-
retryJson:
|
|
1206
|
-
...
|
|
1207
|
-
...
|
|
1208
|
-
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
|
|
1244
|
+
return toStepHandle2(spec, isEnvironmentHandle2(config.environment) ? config.environment : undefined);
|
|
1213
1245
|
}
|
|
1214
1246
|
// src/definitions/steps/define-code-step.ts
|
|
1215
|
-
function
|
|
1216
|
-
const features =
|
|
1217
|
-
let effectiveResult =
|
|
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 =
|
|
1255
|
+
const environmentHandle = isEnvironmentHandle2(config.environment) ? config.environment : undefined;
|
|
1224
1256
|
if (environmentHandle?.content.runtime?.kind === "host") {
|
|
1225
|
-
throw new Error(`Step "${
|
|
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 =
|
|
1228
|
-
stepKey:
|
|
1229
|
-
defaultRuntime:
|
|
1259
|
+
const environment = compileEnvironment2(config.environment, {
|
|
1260
|
+
stepKey: config.key,
|
|
1261
|
+
defaultRuntime: Runtime2.managed[DEFAULT_CODE_STEP_RUNTIME_ID2]()
|
|
1230
1262
|
});
|
|
1231
|
-
const repo =
|
|
1232
|
-
|
|
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:
|
|
1235
|
-
name:
|
|
1236
|
-
description:
|
|
1237
|
-
version:
|
|
1266
|
+
key: config.key,
|
|
1267
|
+
name: config.name,
|
|
1268
|
+
description: config.description ?? null,
|
|
1269
|
+
version: config.version ?? 1,
|
|
1238
1270
|
kind: "code",
|
|
1239
|
-
status:
|
|
1271
|
+
status: config.status ?? "active",
|
|
1240
1272
|
environment,
|
|
1241
1273
|
prompt: null,
|
|
1242
|
-
inputSchemaJson:
|
|
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:
|
|
1248
|
-
retryJson:
|
|
1249
|
-
...
|
|
1250
|
-
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:
|
|
1284
|
+
entrypoint: { fn: config.fn }
|
|
1253
1285
|
};
|
|
1254
|
-
return
|
|
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
|
|
1290
|
+
function createStepDefinitionsClient2(baseUrl, options) {
|
|
1259
1291
|
const client = createApiClient(baseUrl, { fetch: options?.fetch });
|
|
1260
|
-
return buildStepDefinitionsClient(new
|
|
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 =
|
|
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
|
|
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
|
|
1330
|
-
var notificationKindSchema =
|
|
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 =
|
|
1338
|
-
var notificationChannelSchema =
|
|
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 =
|
|
1378
|
+
var notificationItemSchema = object({
|
|
1347
1379
|
kind: notificationKindSchema.describe("The kind of user notification."),
|
|
1348
|
-
title:
|
|
1349
|
-
body:
|
|
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:
|
|
1352
|
-
payload:
|
|
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:
|
|
1356
|
-
[NOTIFICATION_RESULT_KEY]:
|
|
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:
|
|
1385
|
-
[NOTIFICATION_RESULT_KEY]:
|
|
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
|
|
1513
|
+
var Features2 = {
|
|
1482
1514
|
notifications: () => notificationsFeature,
|
|
1483
1515
|
feedbackRequests: () => feedbackRequestsFeature,
|
|
1484
1516
|
workItems
|
|
1485
1517
|
};
|
|
1486
|
-
var
|
|
1518
|
+
var Notify2 = {
|
|
1487
1519
|
create: (item) => ({
|
|
1488
1520
|
[NOTIFICATION_RESULT_KEY]: [item]
|
|
1489
1521
|
}),
|
|
1490
|
-
inApp: (title, body, priority, options) =>
|
|
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) =>
|
|
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 {
|
|
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 };
|