@scarn/sdk 0.0.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/{chunk-4361gxk0.js → chunk-0y2fy5en.js} +7 -7
  2. package/dist/{chunk-rq3q8vg7.js → chunk-102vfpw4.js} +74 -69
  3. package/dist/{chunk-91p9vzcs.js → chunk-3ctaaseb.js} +405 -402
  4. package/dist/{chunk-9s07v9r1.js → chunk-4ggr8af6.js} +8 -8
  5. package/dist/chunk-5zsavw98.js +91 -0
  6. package/dist/chunk-63f90zky.js +39 -0
  7. package/dist/{chunk-tfm5hjzm.js → chunk-700xe701.js} +9 -9
  8. package/dist/{chunk-njd6npf0.js → chunk-ar6hcj1r.js} +6 -6
  9. package/dist/chunk-cdanncng.js +74 -0
  10. package/dist/chunk-dp86pa6m.js +68 -0
  11. package/dist/chunk-e1h021kq.js +86 -0
  12. package/dist/{chunk-ny07ncb9.js → chunk-gds7w7zh.js} +35 -35
  13. package/dist/chunk-k4y5qt4y.js +14 -0
  14. package/dist/{chunk-eg1hcvhb.js → chunk-mz53r914.js} +16 -16
  15. package/dist/{chunk-631ffb6r.js → chunk-ngy1fdcx.js} +10 -10
  16. package/dist/chunk-p7yrcmqm.js +322 -0
  17. package/dist/{chunk-h9yxx0hd.js → chunk-rt9tq4j6.js} +7 -7
  18. package/dist/{chunk-dnn39qt4.js → chunk-skzxcba3.js} +2960 -2217
  19. package/dist/{chunk-ynk2bjae.js → chunk-vfeytkqx.js} +89 -88
  20. package/dist/{chunk-56e4kp0a.js → chunk-y2pv8d6a.js} +19 -19
  21. package/dist/chunk-y64skrwp.js +17 -0
  22. package/dist/{chunk-qpw5wt1p.js → chunk-zm72ksz0.js} +26 -27
  23. package/dist/client.js +53 -52
  24. package/dist/contracts/artifact-markers.js +12 -11
  25. package/dist/contracts/artifacts.js +23 -21
  26. package/dist/contracts/pipeline-document/index.js +94 -92
  27. package/dist/contracts/step-artifact-submissions.js +17 -20
  28. package/dist/defaults/index.js +140 -139
  29. package/dist/definitions/pipelines/index.js +22 -20
  30. package/dist/definitions/steps/index.js +70 -67
  31. package/dist/definitions/validation/index.js +15 -13
  32. package/dist/devcontainer-config-path.js +11 -9
  33. package/dist/env-vars.js +33 -31
  34. package/dist/eslint.js +2 -0
  35. package/dist/generated/types.gen.d.ts +7 -0
  36. package/dist/git-url/git-repo-identity.js +2 -0
  37. package/dist/health-checks.js +17 -15
  38. package/dist/index.js +280 -277
  39. package/dist/jsonc.js +8 -7
  40. package/dist/managed-runtimes.js +11 -9
  41. package/dist/opencode-mcp.js +27 -25
  42. package/dist/pipelines/index.js +78 -75
  43. package/dist/pipelines/nodes.d.ts +1 -0
  44. package/dist/push/code-step-lookup.js +8 -7
  45. package/dist/push/index.js +51 -52
  46. package/dist/repo-config.js +21 -19
  47. package/dist/scarn-config-parser.js +6 -5
  48. package/package.json +1 -1
  49. package/dist/chunk-4vehh3dq.js +0 -333
  50. package/dist/chunk-5mmj03ah.js +0 -1074
  51. package/dist/chunk-b21233rt.js +0 -78
  52. package/dist/chunk-g0rdnn0r.js +0 -95
  53. package/dist/chunk-p6kc9wq8.js +0 -97
  54. package/dist/chunk-s0gap8r8.js +0 -14
  55. package/dist/chunk-zpqyjgb4.js +0 -49
@@ -0,0 +1,14 @@
1
+ // @bun
2
+ import {
3
+ exports_external
4
+ } from "./chunk-skzxcba3.js";
5
+
6
+ // src/managed-runtimes.ts
7
+ var MANAGED_RUNTIME_IDS = ["bun1", "node24"];
8
+ var DEFAULT_CODE_STEP_RUNTIME_ID = "bun1";
9
+ var managedRuntimeIdSchema = exports_external.enum(MANAGED_RUNTIME_IDS);
10
+ function isManagedRuntimeId(value) {
11
+ return MANAGED_RUNTIME_IDS.includes(value);
12
+ }
13
+
14
+ export { MANAGED_RUNTIME_IDS, DEFAULT_CODE_STEP_RUNTIME_ID, managedRuntimeIdSchema, isManagedRuntimeId };
@@ -45,15 +45,15 @@ function formatSite(site) {
45
45
  }
46
46
 
47
47
  // src/pipelines/errors.ts
48
- function formatIssue2(issue) {
48
+ function formatIssue(issue) {
49
49
  return `${formatSite(issue.site)} (${issue.pointer === "" ? "/" : issue.pointer}): ${issue.message}`;
50
50
  }
51
51
 
52
- class PipelineBuildError2 extends Error {
52
+ class PipelineBuildError extends Error {
53
53
  issues;
54
54
  constructor(key, issues) {
55
55
  super(`Pipeline "${key}" has ${String(issues.length)} build error${issues.length === 1 ? "" : "s"}:
56
- ${issues.map((issue) => ` ${formatIssue2(issue)}`).join(`
56
+ ${issues.map((issue) => ` ${formatIssue(issue)}`).join(`
57
57
  `)}`);
58
58
  this.name = "PipelineBuildError";
59
59
  this.issues = issues;
@@ -69,18 +69,6 @@ class AuthoringError extends Error {
69
69
  }
70
70
  }
71
71
 
72
- // src/pipelines/model.ts
73
- function emptyChain(node) {
74
- return {
75
- node,
76
- settings: {},
77
- retry: [],
78
- catch: [],
79
- next: undefined,
80
- site: captureSite()
81
- };
82
- }
83
-
84
72
  // src/pipelines/registry.ts
85
73
  var nodes = new WeakMap;
86
74
  var targets = new WeakMap;
@@ -129,6 +117,18 @@ function requireNode(value, what) {
129
117
  return node;
130
118
  }
131
119
 
120
+ // src/pipelines/model.ts
121
+ function emptyChain(node) {
122
+ return {
123
+ node,
124
+ settings: {},
125
+ retry: [],
126
+ catch: [],
127
+ next: undefined,
128
+ site: captureSite()
129
+ };
130
+ }
131
+
132
132
  // src/pipelines/chain.ts
133
133
  function next(data, change) {
134
134
  return chainValue({ ...data, ...change, site: captureSite() });
@@ -297,4 +297,4 @@ function bareStepHandle(source, local) {
297
297
  return stepHandleFor(stepNode(source, local));
298
298
  }
299
299
 
300
- export { captureSite, formatIssue2, PipelineBuildError2, AuthoringError, pendingChains, registerNode, registerTarget, registerEach, nodeOf, targetOf, eachOf, chainOf, requireNode, makeHandle, stepNode, stepCall, waitHandle, bareStepHandle };
300
+ export { captureSite, formatIssue, PipelineBuildError, AuthoringError, pendingChains, registerNode, registerTarget, registerEach, nodeOf, targetOf, eachOf, chainOf, requireNode, makeHandle, stepNode, stepCall, waitHandle, bareStepHandle };
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  // src/contracts/artifact-markers.ts
3
- var ARTIFACT_MARKER_SCHEME2 = "artifact:";
3
+ var ARTIFACT_MARKER_SCHEME = "artifact:";
4
4
  var SIGNAL_REF_PREFIX = "signal/";
5
5
  var MARKER_PATTERN = /(!?)\[((?:\\.|[^\\\]\n])*)\]\((?:<artifact:((?:\\.|[^\\<>\n])*)>|artifact:((?:\\.|[^\\()\s])*))\)/g;
6
6
  var unescapeMarkerText = (value) => value.replace(/\\(.)/g, "$1");
@@ -10,11 +10,11 @@ var formatMarkerDestination = (rawRef) => {
10
10
  if (/[\n\r]/.test(rawRef)) {
11
11
  throw new Error("Artifact marker refs cannot contain line breaks.");
12
12
  }
13
- return `<${ARTIFACT_MARKER_SCHEME2}${rawRef.replace(/[\\<>]/g, "\\$&")}>`;
13
+ return `<${ARTIFACT_MARKER_SCHEME}${rawRef.replace(/[\\<>]/g, "\\$&")}>`;
14
14
  }
15
- return `${ARTIFACT_MARKER_SCHEME2}${rawRef.replace(/[\\()]/g, "\\$&")}`;
15
+ return `${ARTIFACT_MARKER_SCHEME}${rawRef.replace(/[\\()]/g, "\\$&")}`;
16
16
  };
17
- function parseArtifactMarkerRef2(rawRef) {
17
+ function parseArtifactMarkerRef(rawRef) {
18
18
  if (!rawRef.startsWith(SIGNAL_REF_PREFIX)) {
19
19
  return { type: "path", pattern: rawRef };
20
20
  }
@@ -26,18 +26,18 @@ function parseArtifactMarkerRef2(rawRef) {
26
26
  signalKey: rest.slice(slash + 1)
27
27
  };
28
28
  }
29
- function formatArtifactMarkerRef2(ref) {
29
+ function formatArtifactMarkerRef(ref) {
30
30
  return ref.type === "signal" ? `${SIGNAL_REF_PREFIX}${ref.stepKey}/${ref.signalKey}` : ref.pattern;
31
31
  }
32
- function buildArtifactMarker2(kind, ref, text) {
33
- const rawRef = formatArtifactMarkerRef2(ref);
32
+ function buildArtifactMarker(kind, ref, text) {
33
+ const rawRef = formatArtifactMarkerRef(ref);
34
34
  if (rawRef.length === 0) {
35
35
  throw new Error("Artifact marker refs cannot be empty.");
36
36
  }
37
37
  const bang = kind === "embed" ? "!" : "";
38
38
  return `${bang}[${escapeMarkerText(text)}](${formatMarkerDestination(rawRef)})`;
39
39
  }
40
- function findArtifactMarkers2(text) {
40
+ function findArtifactMarkers(text) {
41
41
  const matches = [];
42
42
  for (const match of text.matchAll(MARKER_PATTERN)) {
43
43
  const [whole, bang, label, bracketedRef, bareRef] = match;
@@ -46,7 +46,7 @@ function findArtifactMarkers2(text) {
46
46
  kind: bang === "!" ? "embed" : "link",
47
47
  text: unescapeMarkerText(label ?? ""),
48
48
  rawRef,
49
- ref: parseArtifactMarkerRef2(rawRef),
49
+ ref: parseArtifactMarkerRef(rawRef),
50
50
  start: match.index,
51
51
  end: match.index + whole.length
52
52
  });
@@ -54,4 +54,4 @@ function findArtifactMarkers2(text) {
54
54
  return matches;
55
55
  }
56
56
 
57
- export { ARTIFACT_MARKER_SCHEME2, parseArtifactMarkerRef2, formatArtifactMarkerRef2, buildArtifactMarker2, findArtifactMarkers2 };
57
+ export { ARTIFACT_MARKER_SCHEME, parseArtifactMarkerRef, formatArtifactMarkerRef, buildArtifactMarker, findArtifactMarkers };
@@ -0,0 +1,322 @@
1
+ // @bun
2
+ import {
3
+ exports_external
4
+ } from "./chunk-skzxcba3.js";
5
+
6
+ // src/contracts/pipeline-document/json.ts
7
+ function isJsonObject(value) {
8
+ return typeof value === "object" && value !== null && !Array.isArray(value);
9
+ }
10
+ function escapePointerSegment(segment) {
11
+ return String(segment).replaceAll("~", "~0").replaceAll("/", "~1");
12
+ }
13
+ function jsonPointer(segments) {
14
+ return segments.map((segment) => `/${escapePointerSegment(segment)}`).join("");
15
+ }
16
+ function deepEqual(left, right) {
17
+ if (left === right) {
18
+ return true;
19
+ }
20
+ if (Array.isArray(left)) {
21
+ return Array.isArray(right) && left.length === right.length && left.every((item, index) => deepEqual(item, right[index]));
22
+ }
23
+ if (isJsonObject(left) && isJsonObject(right)) {
24
+ const leftKeys = Object.keys(left);
25
+ const rightKeys = Object.keys(right);
26
+ return leftKeys.length === rightKeys.length && leftKeys.every((key) => Object.hasOwn(right, key) && deepEqual(left[key], right[key]));
27
+ }
28
+ return false;
29
+ }
30
+ // src/contracts/pipeline-document/conditions/operators.ts
31
+ var COMPARISON_OPERATORS = [
32
+ "equal",
33
+ "notEqual",
34
+ "lessThan",
35
+ "lessThanInclusive",
36
+ "greaterThan",
37
+ "greaterThanInclusive"
38
+ ];
39
+ var CONDITION_OPERATORS = [
40
+ ...COMPARISON_OPERATORS,
41
+ "exists",
42
+ "isEmpty",
43
+ "contains",
44
+ "startsWith",
45
+ "endsWith",
46
+ "matches",
47
+ "before",
48
+ "after",
49
+ "some",
50
+ "every",
51
+ "none"
52
+ ];
53
+ var COMPUTED_FUNCTIONS = [
54
+ "sum",
55
+ "avg",
56
+ "min",
57
+ "max",
58
+ "count"
59
+ ];
60
+ var ORDERING_OPERATORS = new Set([
61
+ "lessThan",
62
+ "lessThanInclusive",
63
+ "greaterThan",
64
+ "greaterThanInclusive"
65
+ ]);
66
+ var STRING_OPERATORS = new Set([
67
+ "startsWith",
68
+ "endsWith",
69
+ "matches"
70
+ ]);
71
+ var DATE_OPERATORS = new Set(["before", "after"]);
72
+ var LIST_OPERATORS = new Set(["some", "every", "none"]);
73
+
74
+ // src/contracts/pipeline-document/schema.ts
75
+ var NODE_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
76
+ var ALIAS_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
77
+ var nodeIdSchema = exports_external.string().regex(NODE_ID_PATTERN, "Node ids may only contain letters, digits, '_' and '-'");
78
+ var jsonValueSchema = exports_external.json();
79
+ var literalSchema = exports_external.strictObject({ value: jsonValueSchema });
80
+ var scalarArgSchema = exports_external.union([exports_external.string().min(1), literalSchema]);
81
+ var listSchema = exports_external.strictObject({ list: exports_external.array(scalarArgSchema) });
82
+ var argValueSchema = exports_external.union([
83
+ exports_external.string().min(1),
84
+ literalSchema,
85
+ listSchema
86
+ ]);
87
+ var computedSourceSchema = exports_external.union([
88
+ exports_external.array(exports_external.string().min(1)).min(1),
89
+ exports_external.strictObject({
90
+ path: exports_external.string().min(1),
91
+ field: exports_external.string().min(1).optional(),
92
+ get where() {
93
+ return conditionSchema.optional();
94
+ }
95
+ })
96
+ ]);
97
+ var LIST_OPS = new Set(["some", "every", "none"]);
98
+ var UNARY_OPS = new Set(["exists", "isEmpty"]);
99
+ var conditionSchema = exports_external.strictObject({
100
+ get all() {
101
+ return exports_external.array(conditionSchema).min(1).optional();
102
+ },
103
+ get any() {
104
+ return exports_external.array(conditionSchema).min(1).optional();
105
+ },
106
+ get not() {
107
+ return conditionSchema.optional();
108
+ },
109
+ path: exports_external.string().min(1).optional(),
110
+ sum: computedSourceSchema.optional(),
111
+ avg: computedSourceSchema.optional(),
112
+ min: computedSourceSchema.optional(),
113
+ max: computedSourceSchema.optional(),
114
+ count: computedSourceSchema.optional(),
115
+ weights: exports_external.array(exports_external.number()).min(1).optional(),
116
+ op: exports_external.enum(CONDITION_OPERATORS).optional(),
117
+ value: jsonValueSchema.optional(),
118
+ ref: exports_external.string().min(1).optional(),
119
+ get where() {
120
+ return conditionSchema.optional();
121
+ }
122
+ }).superRefine((condition, ctx) => {
123
+ const combinators = ["all", "any", "not"].filter((key) => condition[key] !== undefined);
124
+ const lefts = ["path", ...COMPUTED_FUNCTIONS].filter((key) => condition[key] !== undefined);
125
+ if (combinators.length > 0) {
126
+ const extras = Object.keys(condition).filter((key) => key !== combinators[0]);
127
+ if (combinators.length > 1 || extras.length > 0) {
128
+ ctx.addIssue({
129
+ code: "custom",
130
+ message: `A condition with "${String(combinators[0])}" can't have other keys (found ${[...combinators.slice(1), ...extras].map((key) => `"${key}"`).join(", ")})`
131
+ });
132
+ }
133
+ return;
134
+ }
135
+ if (lefts.length !== 1) {
136
+ ctx.addIssue({
137
+ code: "custom",
138
+ message: lefts.length === 0 ? 'A condition needs exactly one of "path", "sum", "avg", "min", "max", "count", or a combinator "all", "any", "not"' : `A condition can have only one of ${lefts.map((key) => `"${key}"`).join(", ")}`
139
+ });
140
+ return;
141
+ }
142
+ if (condition.op === undefined) {
143
+ ctx.addIssue({
144
+ code: "custom",
145
+ message: 'A condition needs "op"',
146
+ path: ["op"]
147
+ });
148
+ return;
149
+ }
150
+ const isList = LIST_OPS.has(condition.op);
151
+ const isUnary = UNARY_OPS.has(condition.op);
152
+ if (isList && condition.where === undefined) {
153
+ ctx.addIssue({
154
+ code: "custom",
155
+ message: `"${condition.op}" needs a "where" condition`,
156
+ path: ["where"]
157
+ });
158
+ }
159
+ if (!isList && condition.where !== undefined) {
160
+ ctx.addIssue({
161
+ code: "custom",
162
+ message: `"where" is only allowed with "some", "every" or "none", not "${condition.op}"`,
163
+ path: ["where"]
164
+ });
165
+ }
166
+ const hasValue = condition.value !== undefined;
167
+ const hasRef = condition.ref !== undefined;
168
+ if ((isList || isUnary) && (hasValue || hasRef)) {
169
+ ctx.addIssue({
170
+ code: "custom",
171
+ message: `"${condition.op}" takes no "value" or "ref"`,
172
+ path: [hasValue ? "value" : "ref"]
173
+ });
174
+ }
175
+ if (!isList && !isUnary && hasValue === hasRef) {
176
+ ctx.addIssue({
177
+ code: "custom",
178
+ message: `"${condition.op}" needs exactly one of "value" or "ref"`
179
+ });
180
+ }
181
+ if (condition.weights !== undefined && condition.avg === undefined) {
182
+ ctx.addIssue({
183
+ code: "custom",
184
+ message: '"weights" is only allowed with "avg"',
185
+ path: ["weights"]
186
+ });
187
+ }
188
+ });
189
+ var toleratedFailuresSchema = exports_external.union([
190
+ exports_external.strictObject({ count: exports_external.int().nonnegative() }),
191
+ exports_external.strictObject({ percent: exports_external.number().min(0).max(100) })
192
+ ]);
193
+ var eachSchema = exports_external.strictObject({
194
+ over: exports_external.string().min(1),
195
+ maxConcurrency: exports_external.int().positive().optional(),
196
+ toleratedFailures: toleratedFailuresSchema.optional()
197
+ });
198
+ var routeShape = {
199
+ when: conditionSchema.optional(),
200
+ to: nodeIdSchema,
201
+ pipeline: exports_external.string().min(1).optional(),
202
+ args: exports_external.record(exports_external.string().min(1), argValueSchema).optional(),
203
+ each: eachSchema.optional(),
204
+ partial: exports_external.literal(true).optional()
205
+ };
206
+ function noPartialWithEach(route, ctx) {
207
+ if (route.each !== undefined && route.partial !== undefined) {
208
+ ctx.addIssue({
209
+ code: "custom",
210
+ message: `A route can't have both "each" and "partial"`,
211
+ path: ["partial"]
212
+ });
213
+ }
214
+ }
215
+ var routeSchema = exports_external.strictObject(routeShape).superRefine(noPartialWithEach);
216
+ var otherwiseSchema = exports_external.strictObject(routeShape).omit({ when: true }).superRefine(noPartialWithEach);
217
+ var startSchema = exports_external.strictObject(routeShape).omit({ partial: true });
218
+ var MATCH_MODES = ["first", "all"];
219
+ var nextSchema = exports_external.strictObject({
220
+ match: exports_external.enum(MATCH_MODES).optional(),
221
+ routes: exports_external.array(routeSchema).min(1),
222
+ otherwise: otherwiseSchema.optional()
223
+ });
224
+ var retrySchema = exports_external.strictObject({
225
+ on: exports_external.array(exports_external.string().min(1)).min(1),
226
+ maxAttempts: exports_external.int().positive(),
227
+ intervalSeconds: exports_external.number().nonnegative().optional(),
228
+ backoffRate: exports_external.number().positive().optional(),
229
+ maxDelaySeconds: exports_external.number().nonnegative().optional()
230
+ });
231
+ var catchSchema = exports_external.strictObject({
232
+ on: exports_external.array(exports_external.string().min(1)).min(1),
233
+ to: nodeIdSchema,
234
+ pipeline: exports_external.string().min(1).optional(),
235
+ args: exports_external.record(exports_external.string().min(1), argValueSchema).optional()
236
+ });
237
+ var stepNodeSchema = exports_external.strictObject({
238
+ kind: exports_external.literal("step"),
239
+ title: exports_external.string().optional(),
240
+ step: exports_external.string().min(1),
241
+ next: nextSchema.optional(),
242
+ retry: exports_external.array(retrySchema).optional(),
243
+ catch: exports_external.array(catchSchema).optional(),
244
+ timeoutSeconds: exports_external.int().positive().optional(),
245
+ heartbeatSeconds: exports_external.int().positive().optional(),
246
+ maxRuns: exports_external.int().positive().optional(),
247
+ maxTurns: exports_external.int().nonnegative().optional()
248
+ });
249
+ var DEFAULT_MAX_TURNS = 2;
250
+ var DECISION_BODY_MODES = ["optional", "required"];
251
+ var decisionActionSchema = exports_external.strictObject({
252
+ key: exports_external.string().min(1),
253
+ label: exports_external.string().min(1),
254
+ body: exports_external.enum(DECISION_BODY_MODES).optional()
255
+ });
256
+ var waitNodeSchema = exports_external.strictObject({
257
+ kind: exports_external.literal("wait"),
258
+ title: exports_external.string().optional(),
259
+ for: exports_external.enum(["decision", "reply", "event", "timer"]),
260
+ actions: exports_external.array(decisionActionSchema).optional(),
261
+ next: nextSchema.optional(),
262
+ catch: exports_external.array(catchSchema).optional(),
263
+ timeoutSeconds: exports_external.int().positive().optional(),
264
+ maxRuns: exports_external.int().positive().optional()
265
+ });
266
+ var succeedNodeSchema = exports_external.strictObject({
267
+ kind: exports_external.literal("succeed"),
268
+ title: exports_external.string().optional()
269
+ });
270
+ var failNodeSchema = exports_external.strictObject({
271
+ kind: exports_external.literal("fail"),
272
+ title: exports_external.string().optional(),
273
+ error: exports_external.string().min(1).optional(),
274
+ cause: exports_external.string().optional()
275
+ });
276
+ var nodeSchema = exports_external.discriminatedUnion("kind", [
277
+ stepNodeSchema,
278
+ waitNodeSchema,
279
+ succeedNodeSchema,
280
+ failNodeSchema
281
+ ]);
282
+ var pipelineDocumentSchema = exports_external.strictObject({
283
+ $schema: exports_external.string().optional(),
284
+ schemaVersion: exports_external.literal(1),
285
+ key: exports_external.string().min(1),
286
+ title: exports_external.string().optional(),
287
+ timeoutSeconds: exports_external.int().positive().optional(),
288
+ workItemFields: exports_external.record(exports_external.string().regex(ALIAS_PATTERN, "Aliases must be identifiers (letters, digits, '_')"), exports_external.string().min(1)).optional(),
289
+ start: startSchema,
290
+ nodes: exports_external.record(nodeIdSchema, nodeSchema)
291
+ });
292
+ function pipelineDocumentJsonSchema() {
293
+ return exports_external.toJSONSchema(pipelineDocumentSchema, { io: "input" });
294
+ }
295
+ // src/contracts/pipeline-document/routes.ts
296
+ function routeEntries(next) {
297
+ if (next === undefined) {
298
+ return [];
299
+ }
300
+ const entries = next.routes.map((route, index) => ({
301
+ kind: "route",
302
+ index,
303
+ route,
304
+ pointer: ["routes", index]
305
+ }));
306
+ if (next.otherwise !== undefined) {
307
+ entries.push({
308
+ kind: "otherwise",
309
+ index: 0,
310
+ route: next.otherwise,
311
+ pointer: ["otherwise"]
312
+ });
313
+ }
314
+ return entries;
315
+ }
316
+ function routeAt(next, kind, index) {
317
+ if (next === undefined) {
318
+ return;
319
+ }
320
+ return kind === "otherwise" ? next.otherwise : next.routes[index];
321
+ }
322
+ export { isJsonObject, jsonPointer, deepEqual, COMPARISON_OPERATORS, CONDITION_OPERATORS, COMPUTED_FUNCTIONS, ORDERING_OPERATORS, STRING_OPERATORS, DATE_OPERATORS, LIST_OPERATORS, NODE_ID_PATTERN, ALIAS_PATTERN, literalSchema, listSchema, argValueSchema, computedSourceSchema, conditionSchema, toleratedFailuresSchema, eachSchema, routeSchema, otherwiseSchema, startSchema, MATCH_MODES, nextSchema, retrySchema, catchSchema, stepNodeSchema, DEFAULT_MAX_TURNS, DECISION_BODY_MODES, decisionActionSchema, waitNodeSchema, succeedNodeSchema, failNodeSchema, nodeSchema, pipelineDocumentSchema, pipelineDocumentJsonSchema, routeEntries, routeAt };
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  // src/jsonc.ts
3
- var stripJsoncComments2 = (content) => {
3
+ var stripJsoncComments = (content) => {
4
4
  let result = "";
5
5
  let inString = false;
6
6
  let escapeNextCharacter = false;
@@ -58,7 +58,7 @@ var stripJsoncComments2 = (content) => {
58
58
  }
59
59
  return result;
60
60
  };
61
- var stripTrailingCommas2 = (content) => {
61
+ var stripTrailingCommas = (content) => {
62
62
  let result = "";
63
63
  let inString = false;
64
64
  let escapeNextCharacter = false;
@@ -87,12 +87,12 @@ var stripTrailingCommas2 = (content) => {
87
87
  if (character === ",") {
88
88
  let lookaheadIndex = index + 1;
89
89
  while (lookaheadIndex < content.length) {
90
- const lookaheadCharacter = content.charAt(lookaheadIndex);
91
- if (/\s/u.test(lookaheadCharacter)) {
90
+ const lookaheadCharacter2 = content.charAt(lookaheadIndex);
91
+ if (/\s/u.test(lookaheadCharacter2)) {
92
92
  lookaheadIndex += 1;
93
93
  continue;
94
94
  }
95
- if (lookaheadCharacter === "}" || lookaheadCharacter === "]") {
95
+ if (lookaheadCharacter2 === "}" || lookaheadCharacter2 === "]") {
96
96
  break;
97
97
  }
98
98
  result += character;
@@ -111,6 +111,6 @@ var stripTrailingCommas2 = (content) => {
111
111
  }
112
112
  return result;
113
113
  };
114
- var parseJsonc2 = (content) => JSON.parse(stripTrailingCommas2(stripJsoncComments2(content)));
114
+ var parseJsonc = (content) => JSON.parse(stripTrailingCommas(stripJsoncComments(content)));
115
115
 
116
- export { stripJsoncComments2, stripTrailingCommas2, parseJsonc2 };
116
+ export { stripJsoncComments, stripTrailingCommas, parseJsonc };