@scarn/sdk 0.0.0-stage → 0.8.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.
- package/dist/chunk-0y2fy5en.js +166 -0
- package/dist/chunk-3ctaaseb.js +1456 -0
- package/dist/chunk-4ggr8af6.js +30 -0
- package/dist/chunk-5zsavw98.js +91 -0
- package/dist/chunk-63f90zky.js +39 -0
- package/dist/chunk-700xe701.js +100 -0
- package/dist/chunk-ar6hcj1r.js +35 -0
- package/dist/chunk-cdanncng.js +74 -0
- package/dist/chunk-dp86pa6m.js +68 -0
- package/dist/chunk-e1h021kq.js +86 -0
- package/dist/chunk-gds7w7zh.js +330 -0
- package/dist/chunk-k4y5qt4y.js +14 -0
- package/dist/chunk-mz53r914.js +300 -0
- package/dist/chunk-ngy1fdcx.js +57 -0
- package/dist/chunk-p7yrcmqm.js +322 -0
- package/dist/chunk-rt9tq4j6.js +116 -0
- package/dist/chunk-skzxcba3.js +14282 -0
- package/dist/chunk-vfeytkqx.js +1687 -0
- package/dist/chunk-y2pv8d6a.js +162 -0
- package/dist/chunk-y64skrwp.js +17 -0
- package/dist/chunk-yjtaq94c.js +1094 -0
- package/dist/chunk-zm72ksz0.js +256 -0
- package/dist/client.d.ts +4 -0
- package/dist/client.js +58 -0
- package/dist/contracts/artifact-markers.d.ts +42 -0
- package/dist/contracts/artifact-markers.js +16 -0
- package/dist/contracts/artifacts.d.ts +67 -0
- package/dist/contracts/artifacts.js +27 -0
- package/dist/contracts/pipeline-document/built-ins.d.ts +23 -0
- package/dist/contracts/pipeline-document/conditions/operators.d.ts +8 -0
- package/dist/contracts/pipeline-document/index.d.ts +11 -0
- package/dist/contracts/pipeline-document/index.js +99 -0
- package/dist/contracts/pipeline-document/json.d.ts +35 -0
- package/dist/contracts/pipeline-document/routes.d.ts +16 -0
- package/dist/contracts/pipeline-document/schema.d.ts +780 -0
- package/dist/contracts/pipeline-document/step-contract.d.ts +11 -0
- package/dist/contracts/step-artifact-submissions.d.ts +71 -0
- package/dist/contracts/step-artifact-submissions.js +171 -0
- package/dist/defaults/atomic-json-file.d.ts +10 -0
- package/dist/defaults/auth-file.d.ts +14 -0
- package/dist/defaults/base-url.d.ts +1 -0
- package/dist/defaults/config-file.d.ts +46 -0
- package/dist/defaults/home-dir.d.ts +3 -0
- package/dist/defaults/index.d.ts +12 -0
- package/dist/defaults/index.js +1240 -0
- package/dist/defaults/legacy-config-migration.d.ts +27 -0
- package/dist/defaults/load-push-defaults.d.ts +25 -0
- package/dist/defaults/project-config.d.ts +32 -0
- package/dist/defaults/project-ref.d.ts +34 -0
- package/dist/definitions/artifacts/artifact.d.ts +62 -0
- package/dist/definitions/artifacts/index.d.ts +1 -0
- package/dist/definitions/pipelines/define-default-pipeline-assignment.d.ts +263 -0
- package/dist/definitions/pipelines/index.d.ts +3 -0
- package/dist/definitions/pipelines/index.js +26 -0
- package/dist/definitions/pipelines/pipeline-definitions-client.d.ts +208 -0
- package/dist/definitions/pipelines/work-item-fields.d.ts +93 -0
- package/dist/definitions/steps/compile-mcps.d.ts +34 -0
- package/dist/definitions/steps/define-code-step.d.ts +84 -0
- package/dist/definitions/steps/define-mcp.d.ts +79 -0
- package/dist/definitions/steps/define-step.d.ts +137 -0
- package/dist/definitions/steps/env.d.ts +136 -0
- package/dist/definitions/steps/index.d.ts +14 -0
- package/dist/definitions/steps/index.js +76 -0
- package/dist/definitions/steps/mcp-server-config.d.ts +102 -0
- package/dist/definitions/steps/prompt-template.d.ts +24 -0
- package/dist/definitions/steps/repo.d.ts +67 -0
- package/dist/definitions/steps/runtime.d.ts +115 -0
- package/dist/definitions/steps/step-definitions-client.d.ts +400 -0
- package/dist/definitions/steps/step-features.d.ts +109 -0
- package/dist/definitions/steps/step-handle.d.ts +25 -0
- package/dist/definitions/steps/step-ref.d.ts +19 -0
- package/dist/definitions/validation/index.d.ts +2 -0
- package/dist/definitions/validation/index.js +19 -0
- package/dist/definitions/validation/validate-artifact-markers.d.ts +3 -0
- package/dist/definitions/validation/validate-artifacts.d.ts +7 -0
- package/dist/definitions/validation/validate-definition-specs.d.ts +16 -0
- package/dist/definitions/validation/validate-env.d.ts +15 -0
- package/dist/definitions/validation/validate-repo.d.ts +13 -0
- package/dist/definitions/validation/validate-runtime.d.ts +12 -0
- package/dist/definitions/validation/validation-issue.d.ts +11 -0
- package/dist/devcontainer-config-path.d.ts +21 -0
- package/dist/devcontainer-config-path.js +15 -0
- package/dist/env-vars.d.ts +136 -0
- package/dist/env-vars.js +37 -0
- package/dist/eslint.d.ts +42 -0
- package/dist/eslint.js +127 -0
- package/dist/generated/client/client.gen.d.ts +2 -0
- package/dist/generated/client/index.d.ts +8 -0
- package/dist/generated/client/types.gen.d.ts +117 -0
- package/dist/generated/client/utils.gen.d.ts +33 -0
- package/dist/generated/client.gen.d.ts +12 -0
- package/dist/generated/core/auth.gen.d.ts +18 -0
- package/dist/generated/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/core/params.gen.d.ts +43 -0
- package/dist/generated/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/core/types.gen.d.ts +78 -0
- package/dist/generated/core/utils.gen.d.ts +19 -0
- package/dist/generated/index.d.ts +2 -0
- package/dist/generated/sdk.gen.d.ts +302 -0
- package/dist/generated/types.gen.d.ts +18375 -0
- package/dist/git-url/git-remote.d.ts +30 -0
- package/dist/git-url/git-repo-identity.d.ts +44 -0
- package/dist/git-url/git-repo-identity.js +161 -0
- package/dist/git-url/parse-git-host.d.ts +23 -0
- package/dist/health-checks.d.ts +169 -0
- package/dist/health-checks.js +21 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +296 -0
- package/dist/jsonc.d.ts +3 -0
- package/dist/jsonc.js +12 -0
- package/dist/managed-runtimes.d.ts +20 -0
- package/dist/managed-runtimes.js +15 -0
- package/dist/opencode-mcp.d.ts +313 -0
- package/dist/opencode-mcp.js +31 -0
- package/dist/pipelines/chain.d.ts +7 -0
- package/dist/pipelines/compile-args.d.ts +12 -0
- package/dist/pipelines/compile-chain.d.ts +9 -0
- package/dist/pipelines/compile-checks.d.ts +16 -0
- package/dist/pipelines/compile-state.d.ts +30 -0
- package/dist/pipelines/condition-data.d.ts +78 -0
- package/dist/pipelines/conditions.d.ts +47 -0
- package/dist/pipelines/context.d.ts +16 -0
- package/dist/pipelines/define-pipeline.d.ts +32 -0
- package/dist/pipelines/each.d.ts +5 -0
- package/dist/pipelines/errors.d.ts +26 -0
- package/dist/pipelines/handles.d.ts +29 -0
- package/dist/pipelines/index.d.ts +18 -0
- package/dist/pipelines/index.js +83 -0
- package/dist/pipelines/model.d.ts +103 -0
- package/dist/pipelines/nodes.d.ts +54 -0
- package/dist/pipelines/ref-types.d.ts +54 -0
- package/dist/pipelines/refs.d.ts +80 -0
- package/dist/pipelines/registry.d.ts +12 -0
- package/dist/pipelines/source.d.ts +17 -0
- package/dist/pipelines/types.d.ts +160 -0
- package/dist/push/code-step-lookup.d.ts +32 -0
- package/dist/push/code-step-lookup.js +12 -0
- package/dist/push/collect-definitions.d.ts +70 -0
- package/dist/push/collect-pipeline-documents.d.ts +14 -0
- package/dist/push/index.d.ts +6 -0
- package/dist/push/index.js +327 -0
- package/dist/push/push-from-directory.d.ts +37 -0
- package/dist/repo-config.d.ts +80 -0
- package/dist/repo-config.js +25 -0
- package/dist/scarn-config-parser.d.ts +29 -0
- package/dist/scarn-config-parser.js +10 -0
- package/dist/task-plane-client.d.ts +489 -0
- package/dist/z.d.ts +7 -0
- package/package.json +132 -4
- 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,19 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
assertValidDefinitionSpecs,
|
|
4
|
+
listPaths,
|
|
5
|
+
validateDefinitionSpecs
|
|
6
|
+
} from "../../chunk-gds7w7zh.js";
|
|
7
|
+
import"../../chunk-5zsavw98.js";
|
|
8
|
+
import"../../chunk-4ggr8af6.js";
|
|
9
|
+
import"../../chunk-k4y5qt4y.js";
|
|
10
|
+
import"../../chunk-cdanncng.js";
|
|
11
|
+
import"../../chunk-ngy1fdcx.js";
|
|
12
|
+
import"../../chunk-y2pv8d6a.js";
|
|
13
|
+
import"../../chunk-skzxcba3.js";
|
|
14
|
+
import"../../chunk-y64skrwp.js";
|
|
15
|
+
export {
|
|
16
|
+
assertValidDefinitionSpecs,
|
|
17
|
+
listPaths,
|
|
18
|
+
validateDefinitionSpecs
|
|
19
|
+
};
|
|
@@ -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;
|