@scarn/sdk 0.0.0-stage → 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/dist/chunk-4361gxk0.js +166 -0
  2. package/dist/chunk-4vehh3dq.js +333 -0
  3. package/dist/chunk-56e4kp0a.js +162 -0
  4. package/dist/chunk-5mmj03ah.js +1074 -0
  5. package/dist/chunk-631ffb6r.js +57 -0
  6. package/dist/chunk-91p9vzcs.js +1453 -0
  7. package/dist/chunk-9s07v9r1.js +30 -0
  8. package/dist/chunk-b21233rt.js +78 -0
  9. package/dist/chunk-dnn39qt4.js +13539 -0
  10. package/dist/chunk-eg1hcvhb.js +300 -0
  11. package/dist/chunk-g0rdnn0r.js +95 -0
  12. package/dist/chunk-h9yxx0hd.js +116 -0
  13. package/dist/chunk-njd6npf0.js +35 -0
  14. package/dist/chunk-ny07ncb9.js +330 -0
  15. package/dist/chunk-p6kc9wq8.js +97 -0
  16. package/dist/chunk-qpw5wt1p.js +257 -0
  17. package/dist/chunk-rq3q8vg7.js +1094 -0
  18. package/dist/chunk-s0gap8r8.js +14 -0
  19. package/dist/chunk-tfm5hjzm.js +100 -0
  20. package/dist/chunk-ynk2bjae.js +1686 -0
  21. package/dist/chunk-zpqyjgb4.js +49 -0
  22. package/dist/client.d.ts +4 -0
  23. package/dist/client.js +57 -0
  24. package/dist/contracts/artifact-markers.d.ts +42 -0
  25. package/dist/contracts/artifact-markers.js +15 -0
  26. package/dist/contracts/artifacts.d.ts +67 -0
  27. package/dist/contracts/artifacts.js +25 -0
  28. package/dist/contracts/pipeline-document/built-ins.d.ts +23 -0
  29. package/dist/contracts/pipeline-document/conditions/operators.d.ts +8 -0
  30. package/dist/contracts/pipeline-document/index.d.ts +11 -0
  31. package/dist/contracts/pipeline-document/index.js +97 -0
  32. package/dist/contracts/pipeline-document/json.d.ts +35 -0
  33. package/dist/contracts/pipeline-document/routes.d.ts +16 -0
  34. package/dist/contracts/pipeline-document/schema.d.ts +780 -0
  35. package/dist/contracts/pipeline-document/step-contract.d.ts +11 -0
  36. package/dist/contracts/step-artifact-submissions.d.ts +71 -0
  37. package/dist/contracts/step-artifact-submissions.js +174 -0
  38. package/dist/defaults/atomic-json-file.d.ts +10 -0
  39. package/dist/defaults/auth-file.d.ts +14 -0
  40. package/dist/defaults/base-url.d.ts +1 -0
  41. package/dist/defaults/config-file.d.ts +46 -0
  42. package/dist/defaults/home-dir.d.ts +3 -0
  43. package/dist/defaults/index.d.ts +12 -0
  44. package/dist/defaults/index.js +1239 -0
  45. package/dist/defaults/legacy-config-migration.d.ts +27 -0
  46. package/dist/defaults/load-push-defaults.d.ts +25 -0
  47. package/dist/defaults/project-config.d.ts +32 -0
  48. package/dist/defaults/project-ref.d.ts +34 -0
  49. package/dist/definitions/artifacts/artifact.d.ts +62 -0
  50. package/dist/definitions/artifacts/index.d.ts +1 -0
  51. package/dist/definitions/pipelines/define-default-pipeline-assignment.d.ts +263 -0
  52. package/dist/definitions/pipelines/index.d.ts +3 -0
  53. package/dist/definitions/pipelines/index.js +24 -0
  54. package/dist/definitions/pipelines/pipeline-definitions-client.d.ts +208 -0
  55. package/dist/definitions/pipelines/work-item-fields.d.ts +93 -0
  56. package/dist/definitions/steps/compile-mcps.d.ts +34 -0
  57. package/dist/definitions/steps/define-code-step.d.ts +84 -0
  58. package/dist/definitions/steps/define-mcp.d.ts +79 -0
  59. package/dist/definitions/steps/define-step.d.ts +137 -0
  60. package/dist/definitions/steps/env.d.ts +136 -0
  61. package/dist/definitions/steps/index.d.ts +14 -0
  62. package/dist/definitions/steps/index.js +73 -0
  63. package/dist/definitions/steps/mcp-server-config.d.ts +102 -0
  64. package/dist/definitions/steps/prompt-template.d.ts +24 -0
  65. package/dist/definitions/steps/repo.d.ts +67 -0
  66. package/dist/definitions/steps/runtime.d.ts +115 -0
  67. package/dist/definitions/steps/step-definitions-client.d.ts +400 -0
  68. package/dist/definitions/steps/step-features.d.ts +109 -0
  69. package/dist/definitions/steps/step-handle.d.ts +25 -0
  70. package/dist/definitions/steps/step-ref.d.ts +19 -0
  71. package/dist/definitions/validation/index.d.ts +2 -0
  72. package/dist/definitions/validation/index.js +17 -0
  73. package/dist/definitions/validation/validate-artifact-markers.d.ts +3 -0
  74. package/dist/definitions/validation/validate-artifacts.d.ts +7 -0
  75. package/dist/definitions/validation/validate-definition-specs.d.ts +16 -0
  76. package/dist/definitions/validation/validate-env.d.ts +15 -0
  77. package/dist/definitions/validation/validate-repo.d.ts +13 -0
  78. package/dist/definitions/validation/validate-runtime.d.ts +12 -0
  79. package/dist/definitions/validation/validation-issue.d.ts +11 -0
  80. package/dist/devcontainer-config-path.d.ts +21 -0
  81. package/dist/devcontainer-config-path.js +13 -0
  82. package/dist/env-vars.d.ts +136 -0
  83. package/dist/env-vars.js +35 -0
  84. package/dist/eslint.d.ts +42 -0
  85. package/dist/eslint.js +125 -0
  86. package/dist/generated/client/client.gen.d.ts +2 -0
  87. package/dist/generated/client/index.d.ts +8 -0
  88. package/dist/generated/client/types.gen.d.ts +117 -0
  89. package/dist/generated/client/utils.gen.d.ts +33 -0
  90. package/dist/generated/client.gen.d.ts +12 -0
  91. package/dist/generated/core/auth.gen.d.ts +18 -0
  92. package/dist/generated/core/bodySerializer.gen.d.ts +25 -0
  93. package/dist/generated/core/params.gen.d.ts +43 -0
  94. package/dist/generated/core/pathSerializer.gen.d.ts +33 -0
  95. package/dist/generated/core/queryKeySerializer.gen.d.ts +18 -0
  96. package/dist/generated/core/serverSentEvents.gen.d.ts +71 -0
  97. package/dist/generated/core/types.gen.d.ts +78 -0
  98. package/dist/generated/core/utils.gen.d.ts +19 -0
  99. package/dist/generated/index.d.ts +2 -0
  100. package/dist/generated/sdk.gen.d.ts +302 -0
  101. package/dist/generated/types.gen.d.ts +18368 -0
  102. package/dist/git-url/git-remote.d.ts +30 -0
  103. package/dist/git-url/git-repo-identity.d.ts +44 -0
  104. package/dist/git-url/git-repo-identity.js +159 -0
  105. package/dist/git-url/parse-git-host.d.ts +23 -0
  106. package/dist/health-checks.d.ts +169 -0
  107. package/dist/health-checks.js +19 -0
  108. package/dist/index.d.ts +11 -0
  109. package/dist/index.js +293 -0
  110. package/dist/jsonc.d.ts +3 -0
  111. package/dist/jsonc.js +11 -0
  112. package/dist/managed-runtimes.d.ts +20 -0
  113. package/dist/managed-runtimes.js +13 -0
  114. package/dist/opencode-mcp.d.ts +313 -0
  115. package/dist/opencode-mcp.js +29 -0
  116. package/dist/pipelines/chain.d.ts +7 -0
  117. package/dist/pipelines/compile-args.d.ts +12 -0
  118. package/dist/pipelines/compile-chain.d.ts +9 -0
  119. package/dist/pipelines/compile-checks.d.ts +16 -0
  120. package/dist/pipelines/compile-state.d.ts +30 -0
  121. package/dist/pipelines/condition-data.d.ts +78 -0
  122. package/dist/pipelines/conditions.d.ts +47 -0
  123. package/dist/pipelines/context.d.ts +16 -0
  124. package/dist/pipelines/define-pipeline.d.ts +32 -0
  125. package/dist/pipelines/each.d.ts +5 -0
  126. package/dist/pipelines/errors.d.ts +26 -0
  127. package/dist/pipelines/handles.d.ts +29 -0
  128. package/dist/pipelines/index.d.ts +18 -0
  129. package/dist/pipelines/index.js +80 -0
  130. package/dist/pipelines/model.d.ts +103 -0
  131. package/dist/pipelines/nodes.d.ts +54 -0
  132. package/dist/pipelines/ref-types.d.ts +54 -0
  133. package/dist/pipelines/refs.d.ts +80 -0
  134. package/dist/pipelines/registry.d.ts +12 -0
  135. package/dist/pipelines/source.d.ts +17 -0
  136. package/dist/pipelines/types.d.ts +160 -0
  137. package/dist/push/code-step-lookup.d.ts +32 -0
  138. package/dist/push/code-step-lookup.js +11 -0
  139. package/dist/push/collect-definitions.d.ts +70 -0
  140. package/dist/push/collect-pipeline-documents.d.ts +14 -0
  141. package/dist/push/index.d.ts +6 -0
  142. package/dist/push/index.js +328 -0
  143. package/dist/push/push-from-directory.d.ts +37 -0
  144. package/dist/repo-config.d.ts +80 -0
  145. package/dist/repo-config.js +23 -0
  146. package/dist/scarn-config-parser.d.ts +29 -0
  147. package/dist/scarn-config-parser.js +9 -0
  148. package/dist/task-plane-client.d.ts +489 -0
  149. package/dist/z.d.ts +7 -0
  150. package/package.json +132 -4
  151. package/README.md +0 -3
@@ -0,0 +1,400 @@
1
+ import { StepDefinitions } from "../../generated/sdk.gen";
2
+ import type { PostApiStepDefinitionsData, PutApiStepDefinitionsData } from "../../generated/types.gen";
3
+ import type { StepDefinitionSpec } from "./define-step";
4
+ type RequestOptions = {
5
+ headers?: Record<string, unknown> | undefined;
6
+ };
7
+ export type CreateStepDefinitionInput = PostApiStepDefinitionsData["body"];
8
+ export type UpsertStepDefinitionInput = PutApiStepDefinitionsData["body"];
9
+ export declare function createStepDefinitionsClient(baseUrl: string): ReturnType<typeof buildStepDefinitionsClient>;
10
+ declare const buildStepDefinitionsClient: (stepDefinitions: StepDefinitions) => {
11
+ listByProjectId: (projectId: string, options?: RequestOptions) => Promise<{
12
+ id: string;
13
+ projectId: string;
14
+ key: string;
15
+ name: string;
16
+ description: string | unknown;
17
+ prompt: string | unknown;
18
+ version: number;
19
+ kind: "built_in" | "user_defined" | "code";
20
+ entrypointJson: {
21
+ sourceFile: string;
22
+ } | unknown;
23
+ executionMode: "workspace" | "no_workspace";
24
+ inputSchemaJson: {
25
+ [key: string]: unknown;
26
+ };
27
+ resultSchemaJson: {
28
+ [key: string]: unknown;
29
+ } | unknown;
30
+ errors: Array<string>;
31
+ retry: Array<{
32
+ on: Array<string>;
33
+ maxAttempts: number;
34
+ }>;
35
+ opencodeMcpJson: {
36
+ [key: string]: {
37
+ type: string;
38
+ command: Array<string>;
39
+ cwd?: string;
40
+ environment?: {
41
+ [key: string]: string;
42
+ };
43
+ disabled?: boolean;
44
+ codemode?: boolean;
45
+ timeout?: {
46
+ startup?: number;
47
+ catalog?: number;
48
+ execution?: number;
49
+ };
50
+ protocol?: "legacy" | "auto" | "2026-07-28";
51
+ } | {
52
+ type: string;
53
+ url: string;
54
+ headers?: {
55
+ [key: string]: string;
56
+ };
57
+ oauth?: {
58
+ client_id?: string;
59
+ client_secret?: string;
60
+ scope?: string;
61
+ callback_port?: number;
62
+ redirect_uri?: string;
63
+ auth_server_metadata_url?: string;
64
+ } | boolean;
65
+ disabled?: boolean;
66
+ codemode?: boolean;
67
+ timeout?: {
68
+ startup?: number;
69
+ catalog?: number;
70
+ execution?: number;
71
+ };
72
+ protocol?: "legacy" | "auto" | "2026-07-28";
73
+ } | {
74
+ type: string;
75
+ name?: string;
76
+ disabled?: boolean;
77
+ codemode?: boolean;
78
+ timeout?: {
79
+ startup?: number;
80
+ catalog?: number;
81
+ execution?: number;
82
+ };
83
+ protocol?: "legacy" | "auto" | "2026-07-28";
84
+ };
85
+ } | unknown;
86
+ healthChecksJson: Array<{
87
+ name?: string;
88
+ severity: "required" | "warn";
89
+ timeoutSeconds: number;
90
+ serialGroup?: string;
91
+ kind: string;
92
+ tool: string;
93
+ mcp?: string;
94
+ args?: {
95
+ [key: string]: unknown;
96
+ };
97
+ } | {
98
+ name?: string;
99
+ severity: "required" | "warn";
100
+ timeoutSeconds: number;
101
+ serialGroup?: string;
102
+ kind: string;
103
+ command: Array<string>;
104
+ expectExitCode: number;
105
+ }> | unknown;
106
+ envJson: Array<{
107
+ name: string;
108
+ source: string;
109
+ value: string;
110
+ secret: boolean;
111
+ applies: "agent" | "setup" | "both";
112
+ } | {
113
+ name: string;
114
+ source: string;
115
+ from: string;
116
+ secret: boolean;
117
+ optional: boolean;
118
+ default?: string;
119
+ mcp?: string;
120
+ applies: "agent" | "setup" | "both";
121
+ }> | unknown;
122
+ devcontainerConfigPath: string | unknown;
123
+ managedRuntime: "bun1" | "node24" | unknown;
124
+ repo: {
125
+ mode: string;
126
+ } | {
127
+ mode: string;
128
+ } | {
129
+ mode: string;
130
+ message: string | unknown;
131
+ onPushFailure: "fail" | "warn";
132
+ };
133
+ status: "draft" | "active" | "archived";
134
+ createdAt: string;
135
+ updatedAt: string;
136
+ }[]>;
137
+ create: (body: CreateStepDefinitionInput, options?: RequestOptions) => Promise<{
138
+ id: string;
139
+ projectId: string;
140
+ key: string;
141
+ name: string;
142
+ description: string | unknown;
143
+ prompt: string | unknown;
144
+ version: number;
145
+ kind: "built_in" | "user_defined" | "code";
146
+ entrypointJson: {
147
+ sourceFile: string;
148
+ } | unknown;
149
+ executionMode: "workspace" | "no_workspace";
150
+ inputSchemaJson: {
151
+ [key: string]: unknown;
152
+ };
153
+ resultSchemaJson: {
154
+ [key: string]: unknown;
155
+ } | unknown;
156
+ errors: Array<string>;
157
+ retry: Array<{
158
+ on: Array<string>;
159
+ maxAttempts: number;
160
+ }>;
161
+ opencodeMcpJson: {
162
+ [key: string]: {
163
+ type: string;
164
+ command: Array<string>;
165
+ cwd?: string;
166
+ environment?: {
167
+ [key: string]: string;
168
+ };
169
+ disabled?: boolean;
170
+ codemode?: boolean;
171
+ timeout?: {
172
+ startup?: number;
173
+ catalog?: number;
174
+ execution?: number;
175
+ };
176
+ protocol?: "legacy" | "auto" | "2026-07-28";
177
+ } | {
178
+ type: string;
179
+ url: string;
180
+ headers?: {
181
+ [key: string]: string;
182
+ };
183
+ oauth?: {
184
+ client_id?: string;
185
+ client_secret?: string;
186
+ scope?: string;
187
+ callback_port?: number;
188
+ redirect_uri?: string;
189
+ auth_server_metadata_url?: string;
190
+ } | boolean;
191
+ disabled?: boolean;
192
+ codemode?: boolean;
193
+ timeout?: {
194
+ startup?: number;
195
+ catalog?: number;
196
+ execution?: number;
197
+ };
198
+ protocol?: "legacy" | "auto" | "2026-07-28";
199
+ } | {
200
+ type: string;
201
+ name?: string;
202
+ disabled?: boolean;
203
+ codemode?: boolean;
204
+ timeout?: {
205
+ startup?: number;
206
+ catalog?: number;
207
+ execution?: number;
208
+ };
209
+ protocol?: "legacy" | "auto" | "2026-07-28";
210
+ };
211
+ } | unknown;
212
+ healthChecksJson: Array<{
213
+ name?: string;
214
+ severity: "required" | "warn";
215
+ timeoutSeconds: number;
216
+ serialGroup?: string;
217
+ kind: string;
218
+ tool: string;
219
+ mcp?: string;
220
+ args?: {
221
+ [key: string]: unknown;
222
+ };
223
+ } | {
224
+ name?: string;
225
+ severity: "required" | "warn";
226
+ timeoutSeconds: number;
227
+ serialGroup?: string;
228
+ kind: string;
229
+ command: Array<string>;
230
+ expectExitCode: number;
231
+ }> | unknown;
232
+ envJson: Array<{
233
+ name: string;
234
+ source: string;
235
+ value: string;
236
+ secret: boolean;
237
+ applies: "agent" | "setup" | "both";
238
+ } | {
239
+ name: string;
240
+ source: string;
241
+ from: string;
242
+ secret: boolean;
243
+ optional: boolean;
244
+ default?: string;
245
+ mcp?: string;
246
+ applies: "agent" | "setup" | "both";
247
+ }> | unknown;
248
+ devcontainerConfigPath: string | unknown;
249
+ managedRuntime: "bun1" | "node24" | unknown;
250
+ repo: {
251
+ mode: string;
252
+ } | {
253
+ mode: string;
254
+ } | {
255
+ mode: string;
256
+ message: string | unknown;
257
+ onPushFailure: "fail" | "warn";
258
+ };
259
+ status: "draft" | "active" | "archived";
260
+ createdAt: string;
261
+ updatedAt: string;
262
+ }>;
263
+ /**
264
+ * Upserts a step definition keyed by (projectId, key, version). Accepts a
265
+ * step handle from `defineStep()`/`codeStep()` or a plain spec directly —
266
+ * no separate fetch-existing/branch-on-id step needed.
267
+ *
268
+ * The request body is built field by field so the spec's transient
269
+ * `entrypoint.fn` (a live, unserializable function reference — present
270
+ * only if a caller bypasses `collect-definitions.ts`'s own strip step)
271
+ * is never included.
272
+ */
273
+ upsertFromSpec: (projectId: string, step: StepDefinitionSpec, options?: RequestOptions) => Promise<{
274
+ id: string;
275
+ projectId: string;
276
+ key: string;
277
+ name: string;
278
+ description: string | unknown;
279
+ prompt: string | unknown;
280
+ version: number;
281
+ kind: "built_in" | "user_defined" | "code";
282
+ entrypointJson: {
283
+ sourceFile: string;
284
+ } | unknown;
285
+ executionMode: "workspace" | "no_workspace";
286
+ inputSchemaJson: {
287
+ [key: string]: unknown;
288
+ };
289
+ resultSchemaJson: {
290
+ [key: string]: unknown;
291
+ } | unknown;
292
+ errors: Array<string>;
293
+ retry: Array<{
294
+ on: Array<string>;
295
+ maxAttempts: number;
296
+ }>;
297
+ opencodeMcpJson: {
298
+ [key: string]: {
299
+ type: string;
300
+ command: Array<string>;
301
+ cwd?: string;
302
+ environment?: {
303
+ [key: string]: string;
304
+ };
305
+ disabled?: boolean;
306
+ codemode?: boolean;
307
+ timeout?: {
308
+ startup?: number;
309
+ catalog?: number;
310
+ execution?: number;
311
+ };
312
+ protocol?: "legacy" | "auto" | "2026-07-28";
313
+ } | {
314
+ type: string;
315
+ url: string;
316
+ headers?: {
317
+ [key: string]: string;
318
+ };
319
+ oauth?: {
320
+ client_id?: string;
321
+ client_secret?: string;
322
+ scope?: string;
323
+ callback_port?: number;
324
+ redirect_uri?: string;
325
+ auth_server_metadata_url?: string;
326
+ } | boolean;
327
+ disabled?: boolean;
328
+ codemode?: boolean;
329
+ timeout?: {
330
+ startup?: number;
331
+ catalog?: number;
332
+ execution?: number;
333
+ };
334
+ protocol?: "legacy" | "auto" | "2026-07-28";
335
+ } | {
336
+ type: string;
337
+ name?: string;
338
+ disabled?: boolean;
339
+ codemode?: boolean;
340
+ timeout?: {
341
+ startup?: number;
342
+ catalog?: number;
343
+ execution?: number;
344
+ };
345
+ protocol?: "legacy" | "auto" | "2026-07-28";
346
+ };
347
+ } | unknown;
348
+ healthChecksJson: Array<{
349
+ name?: string;
350
+ severity: "required" | "warn";
351
+ timeoutSeconds: number;
352
+ serialGroup?: string;
353
+ kind: string;
354
+ tool: string;
355
+ mcp?: string;
356
+ args?: {
357
+ [key: string]: unknown;
358
+ };
359
+ } | {
360
+ name?: string;
361
+ severity: "required" | "warn";
362
+ timeoutSeconds: number;
363
+ serialGroup?: string;
364
+ kind: string;
365
+ command: Array<string>;
366
+ expectExitCode: number;
367
+ }> | unknown;
368
+ envJson: Array<{
369
+ name: string;
370
+ source: string;
371
+ value: string;
372
+ secret: boolean;
373
+ applies: "agent" | "setup" | "both";
374
+ } | {
375
+ name: string;
376
+ source: string;
377
+ from: string;
378
+ secret: boolean;
379
+ optional: boolean;
380
+ default?: string;
381
+ mcp?: string;
382
+ applies: "agent" | "setup" | "both";
383
+ }> | unknown;
384
+ devcontainerConfigPath: string | unknown;
385
+ managedRuntime: "bun1" | "node24" | unknown;
386
+ repo: {
387
+ mode: string;
388
+ } | {
389
+ mode: string;
390
+ } | {
391
+ mode: string;
392
+ message: string | unknown;
393
+ onPushFailure: "fail" | "warn";
394
+ };
395
+ status: "draft" | "active" | "archived";
396
+ createdAt: string;
397
+ updatedAt: string;
398
+ }>;
399
+ };
400
+ export {};
@@ -0,0 +1,109 @@
1
+ import { z } from "zod";
2
+ import type { ZodObject, ZodRawShape } from "zod";
3
+ export type StepFeature<TResultExtension extends Record<string, unknown> = Record<string, unknown>> = {
4
+ readonly _resultExtension: ZodObject<ZodRawShape>;
5
+ readonly _promptAddition: string;
6
+ readonly __resultExtension?: TResultExtension;
7
+ };
8
+ export type AnyStepFeature = StepFeature;
9
+ type UnionToIntersection<U> = (U extends unknown ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
10
+ export type FeatureResultExtensions<TFeatures extends readonly AnyStepFeature[]> = [TFeatures[number]] extends [never] ? Record<never, never> : UnionToIntersection<TFeatures[number] extends StepFeature<infer R> ? R : never>;
11
+ declare const notificationKindSchema: z.ZodEnum<{
12
+ feedback_request: "feedback_request";
13
+ status_update: "status_update";
14
+ blocked: "blocked";
15
+ result_ready: "result_ready";
16
+ warning: "warning";
17
+ }>;
18
+ export type NotificationKind = z.infer<typeof notificationKindSchema>;
19
+ declare const notificationPrioritySchema: z.ZodEnum<{
20
+ high: "high";
21
+ low: "low";
22
+ normal: "normal";
23
+ urgent: "urgent";
24
+ }>;
25
+ export type NotificationPriority = z.infer<typeof notificationPrioritySchema>;
26
+ declare const notificationChannelSchema: z.ZodEnum<{
27
+ in_app: "in_app";
28
+ work_item_platform_comment: "work_item_platform_comment";
29
+ email: "email";
30
+ slack: "slack";
31
+ }>;
32
+ export type NotificationChannel = z.infer<typeof notificationChannelSchema>;
33
+ export type FeedbackRequestUrgency = "blocking" | "clarification" | "assumption" | "informational";
34
+ declare const NOTIFICATION_RESULT_KEY: "$scarn_notifications_v1";
35
+ declare const notificationItemSchema: z.ZodObject<{
36
+ kind: z.ZodEnum<{
37
+ feedback_request: "feedback_request";
38
+ status_update: "status_update";
39
+ blocked: "blocked";
40
+ result_ready: "result_ready";
41
+ warning: "warning";
42
+ }>;
43
+ title: z.ZodOptional<z.ZodString>;
44
+ body: z.ZodString;
45
+ priority: z.ZodEnum<{
46
+ high: "high";
47
+ low: "low";
48
+ normal: "normal";
49
+ urgent: "urgent";
50
+ }>;
51
+ suggestedChannels: z.ZodOptional<z.ZodArray<z.ZodEnum<{
52
+ in_app: "in_app";
53
+ work_item_platform_comment: "work_item_platform_comment";
54
+ email: "email";
55
+ slack: "slack";
56
+ }>>>;
57
+ payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
58
+ }, z.core.$strip>;
59
+ /** A single notification. Inferred from `notificationItemSchema` — the
60
+ * schema is the source of truth; this type can never drift from what's
61
+ * actually validated and pushed as JSON Schema. */
62
+ export type NotificationItem = z.infer<typeof notificationItemSchema>;
63
+ /**
64
+ * The shape `Notify.*` returns: a step result fragment carrying one or more
65
+ * notifications. Spread it into a larger result object, or return it
66
+ * directly if the notification *is* the step's whole result — either way it
67
+ * slots into the same `$scarn_notifications_v1` field `Features.notifications()`
68
+ * adds to the step's result.
69
+ */
70
+ export type NotificationResultFragment = {
71
+ readonly [NOTIFICATION_RESULT_KEY]: NotificationItem[];
72
+ };
73
+ type NotificationsFeature = StepFeature<{
74
+ [NOTIFICATION_RESULT_KEY]?: NotificationItem[];
75
+ }>;
76
+ export type FeedbackRequestItem = {
77
+ question: string;
78
+ category: string;
79
+ urgency: FeedbackRequestUrgency;
80
+ };
81
+ export declare const Features: {
82
+ readonly notifications: () => NotificationsFeature;
83
+ /**
84
+ * A real specialization of `notifications()`, not an alias: narrows every
85
+ * emitted item to `kind: "feedback_request"` and swaps in a
86
+ * feedback-request-specific prompt section. Writes the same
87
+ * `$scarn_notifications_v1` result field.
88
+ */
89
+ readonly feedbackRequests: () => NotificationsFeature;
90
+ };
91
+ export declare const Notify: {
92
+ /** The one generic constructor. Field names match `NotificationItem`
93
+ * exactly, so a new optional field never forces a call-site rewrite. */
94
+ readonly create: (item: NotificationItem) => NotificationResultFragment;
95
+ /** Build a notification for the in-app inbox — the one channel the
96
+ * platform always delivers, so it's the safest default when the caller
97
+ * doesn't need a specific channel. */
98
+ readonly inApp: (title: string, body: string, priority: NotificationPriority, options?: {
99
+ kind?: NotificationKind;
100
+ payload?: Record<string, unknown>;
101
+ }) => NotificationResultFragment;
102
+ /** Build a `kind: "feedback_request"` notification — the value-builder
103
+ * counterpart to `Features.feedbackRequests()`. */
104
+ readonly feedbackRequest: (question: string, category: string, urgency: FeedbackRequestUrgency) => NotificationResultFragment;
105
+ /** Combine several notification result fragments (e.g. more than one
106
+ * `Notify.*` call) into a single result value. */
107
+ readonly merge: (...fragments: NotificationResultFragment[]) => NotificationResultFragment;
108
+ };
109
+ export {};
@@ -0,0 +1,25 @@
1
+ import type { PipelineStep } from "../../pipelines/types";
2
+ import type { StepDefinitionSpec, StepRetryEntry } from "./define-step";
3
+ export type StepHandle<TInput = unknown, TResult = unknown, TErrors extends string = string> = PipelineStep<TInput, TResult, TErrors> & Omit<StepDefinitionSpec, "errors">;
4
+ /**
5
+ * Checks a step's declared error names: non-empty and unique, the same rules
6
+ * the server applies on upsert.
7
+ */
8
+ export declare function compileStepErrors(stepKey: string, errors: readonly string[] | undefined): string[];
9
+ /**
10
+ * Checks a step's `retry` policy the way the server does on upsert: each
11
+ * entry names at least one built-in or declared error, and `maxAttempts`
12
+ * is a positive integer.
13
+ */
14
+ export declare function compileStepRetry(stepKey: string, retry: readonly StepRetryEntry[] | undefined, errors: readonly string[]): StepRetryEntry[];
15
+ /**
16
+ * Wraps a compiled spec in a callable handle. `name` is set with
17
+ * `Object.defineProperty` because a function's own `name` is read-only. The
18
+ * pipeline chain methods are non-enumerable, so they aren't spec fields.
19
+ */
20
+ export declare function toStepHandle(spec: StepDefinitionSpec): StepHandle;
21
+ /**
22
+ * The plain, serializable spec behind a step handle: its own enumerable
23
+ * fields, in a new object. Accepts a plain spec too, and copies it.
24
+ */
25
+ export declare function toStepSpec(step: StepDefinitionSpec): StepDefinitionSpec;
@@ -0,0 +1,19 @@
1
+ import type { JsonSchema } from "../../contracts/pipeline-document";
2
+ /**
3
+ * What a pipeline needs to know about a step: its key, its input and result
4
+ * schemas, the error names it declares, and its input and result types.
5
+ *
6
+ * Every `defineStep` / `codeStep` handle satisfies this structurally. It is the
7
+ * only step type the pipeline authoring SDK depends on, so the rest of a
8
+ * step's definition (prompt, runtime, MCPs, ...) can change without touching
9
+ * pipelines. `__input` and `__result` are phantom fields: they exist only in
10
+ * the type, never at runtime.
11
+ */
12
+ export type StepRef<TInput, TResult, TErrors extends string = string> = {
13
+ key: string;
14
+ inputSchemaJson: JsonSchema | null;
15
+ resultSchemaJson: JsonSchema | null;
16
+ errors: readonly TErrors[];
17
+ readonly __input: TInput;
18
+ readonly __result: TResult;
19
+ };
@@ -0,0 +1,2 @@
1
+ export * from "./validate-definition-specs";
2
+ export * from "./validation-issue";
@@ -0,0 +1,17 @@
1
+ // @bun
2
+ import {
3
+ listPaths2,
4
+ validateDefinitionSpecs2,
5
+ assertValidDefinitionSpecs2
6
+ } from "../../chunk-ny07ncb9.js";
7
+ import"../../chunk-p6kc9wq8.js";
8
+ import"../../chunk-9s07v9r1.js";
9
+ import"../../chunk-s0gap8r8.js";
10
+ import"../../chunk-b21233rt.js";
11
+ import"../../chunk-631ffb6r.js";
12
+ import"../../chunk-56e4kp0a.js";
13
+ export {
14
+ assertValidDefinitionSpecs2 as assertValidDefinitionSpecs,
15
+ listPaths2 as listPaths,
16
+ validateDefinitionSpecs2 as validateDefinitionSpecs
17
+ };
@@ -0,0 +1,3 @@
1
+ import type { StepDefinitionSpec } from "../steps/define-step";
2
+ import { type DefinitionValidationIssue } from "./validation-issue";
3
+ export declare function checkArtifactMarkers(steps: readonly StepDefinitionSpec[], stepsByKey: Map<string, readonly StepDefinitionSpec[]>): DefinitionValidationIssue[];
@@ -0,0 +1,7 @@
1
+ import type { StepDefinitionSpec } from "../steps/define-step";
2
+ import type { DefinitionValidationIssue } from "./validation-issue";
3
+ /**
4
+ * Check: artifact fields (`x-scarn-artifact`) never sit inside an array.
5
+ * v1 has no way to say which array item a submitted file belongs to.
6
+ */
7
+ export declare function checkArtifactFields(steps: readonly StepDefinitionSpec[]): DefinitionValidationIssue[];
@@ -0,0 +1,16 @@
1
+ import type { StepDefinitionSpec } from "../steps/define-step";
2
+ import { type DefinitionValidationIssue } from "./validation-issue";
3
+ /**
4
+ * Runs every offline check over a batch of step definitions and returns the
5
+ * issues found, in check order. An empty array means the batch is clean.
6
+ */
7
+ export declare function validateDefinitionSpecs(steps: readonly StepDefinitionSpec[]): DefinitionValidationIssue[];
8
+ /**
9
+ * `validateDefinitionSpecs`, but throws a single aggregated error.
10
+ *
11
+ * Only counts and lists `severity: "error"` issues — `"warning"`-tier issues
12
+ * (an embed marker no platform can embed) never block a push and are dropped
13
+ * here. They're still present in `validateDefinitionSpecs`'s own return value
14
+ * for any caller that wants to surface them.
15
+ */
16
+ export declare function assertValidDefinitionSpecs(steps: readonly StepDefinitionSpec[]): void;
@@ -0,0 +1,15 @@
1
+ import type { StepDefinitionSpec } from "../steps/define-step";
2
+ import { type DefinitionValidationIssue } from "./validation-issue";
3
+ /**
4
+ * Checks a step's declared env vars:
5
+ *
6
+ * - they satisfy the `envVarsSchema` wire schema (names, reserved names,
7
+ * secret rules, size caps). The authoring helpers (`Env`, `normalizeEnv`)
8
+ * already guard the common mistakes at definition time; this catches
9
+ * hand-built or generated specs that bypass them.
10
+ * - an inherit entry's `mcp` names a server in the step's `opencodeMcpJson`.
11
+ * - `applies: "setup"` or `"both"` only on a `workspace` step (a host step has
12
+ * no container to set up) and never on an MCP variable (MCP servers run
13
+ * inside the agent).
14
+ */
15
+ export declare function checkEnv(steps: readonly StepDefinitionSpec[]): DefinitionValidationIssue[];
@@ -0,0 +1,13 @@
1
+ import type { StepDefinitionSpec } from "../steps/define-step";
2
+ import type { DefinitionValidationIssue } from "./validation-issue";
3
+ /**
4
+ * Check: a step's `repo` satisfies `repoConfigInputSchema` (shape, commit
5
+ * message length, single line, `{{input.…}}` / `{{result.…}}` tokens only) and
6
+ * suits its runtime: `readOnly` and `readWrite` need a clone, so they are
7
+ * rejected on a host (`no_workspace`) step, and `none` is rejected on a
8
+ * `workspace` step, which reads its devcontainer config from the clone. The
9
+ * authoring helpers (`Repo`, `compileRepo`) and `StepEnvironment`'s types
10
+ * already guard these at definition time; this catches hand-built or generated
11
+ * specs that bypass them.
12
+ */
13
+ export declare function checkRepo(steps: readonly StepDefinitionSpec[]): DefinitionValidationIssue[];
@@ -0,0 +1,12 @@
1
+ import type { StepDefinitionSpec } from "../steps/define-step";
2
+ import type { DefinitionValidationIssue } from "./validation-issue";
3
+ /**
4
+ * Check: a step's `devcontainerConfigPath` satisfies the shared path schema and
5
+ * is only set on a `workspace` step, a `code` step is not a host
6
+ * (`no_workspace`) step, and a step's `managedRuntime` is valid (see
7
+ * `checkManagedRuntime`). `Runtime` already makes host plus a config path
8
+ * unrepresentable and guards the path at definition time, and `codeStep`'s
9
+ * types exclude the host runtime; this catches hand-built or generated specs
10
+ * that bypass them.
11
+ */
12
+ export declare function checkRuntime(steps: readonly StepDefinitionSpec[]): DefinitionValidationIssue[];
@@ -0,0 +1,11 @@
1
+ export type DefinitionValidationIssue = {
2
+ readonly check: "health-check-mcp-server" | "health-check-double-qualified" | "env-var" | "env-var-mcp" | "env-var-applies" | "runtime" | "repo" | "artifact-field" | "artifact-marker";
3
+ /**
4
+ * Whether this issue blocks a push. Only `assertValidDefinitionSpecs`
5
+ * treats the tiers differently: it blocks a push on `"error"` alone.
6
+ */
7
+ readonly severity: "error" | "warning" | "info";
8
+ readonly message: string;
9
+ };
10
+ /** Formats a path list for an error message, capped so it stays readable. */
11
+ export declare function listPaths(paths: readonly string[], limit?: number): string;