@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.
Files changed (91) hide show
  1. package/dist/auth/index.js +15 -16
  2. package/dist/automations/index.js +14 -17
  3. package/dist/{chunk-6p340dd4.js → chunk-0bwsjn0b.js} +29 -29
  4. package/dist/{chunk-r3sbp2wn.js → chunk-0w13kxkr.js} +34 -31
  5. package/dist/{chunk-nkm31g10.js → chunk-3j5wf2t5.js} +44 -43
  6. package/dist/{chunk-0y2fy5en.js → chunk-4361gxk0.js} +7 -7
  7. package/dist/{chunk-8tmsvkmj.js → chunk-52520csz.js} +13 -12
  8. package/dist/chunk-5dnfgyx8.js +159 -0
  9. package/dist/{chunk-k57h6qke.js → chunk-5fa4arn1.js} +12 -8
  10. package/dist/{chunk-ngy1fdcx.js → chunk-631ffb6r.js} +10 -10
  11. package/dist/{chunk-01nfqm18.js → chunk-7anj08zc.js} +11 -9
  12. package/dist/{chunk-p74r4y6j.js → chunk-7dr4kybf.js} +481 -449
  13. package/dist/chunk-7mhr5aex.js +171 -0
  14. package/dist/chunk-7rywbqzz.js +27 -0
  15. package/dist/{chunk-xhpp6qz8.js → chunk-9ct3xypr.js} +2552 -3780
  16. package/dist/{chunk-azss2d1n.js → chunk-9geh4c3v.js} +153 -155
  17. package/dist/{chunk-8hsk6f6b.js → chunk-9qf0eg7m.js} +19 -19
  18. package/dist/{chunk-y11p1q7r.js → chunk-aqqywy8g.js} +4 -4
  19. package/dist/chunk-bcvx11fn.js +174 -0
  20. package/dist/{chunk-59arcerk.js → chunk-cyfeaz43.js} +86 -86
  21. package/dist/chunk-czq37rrt.js +286 -0
  22. package/dist/chunk-ec5z8bbq.js +126 -0
  23. package/dist/{chunk-rt9tq4j6.js → chunk-h9yxx0hd.js} +7 -7
  24. package/dist/{chunk-gasw078g.js → chunk-hma87efq.js} +40 -40
  25. package/dist/{chunk-5dny5jg1.js → chunk-hpv234hf.js} +11 -11
  26. package/dist/{chunk-y81cr6tp.js → chunk-k7xnsmp5.js} +158 -87
  27. package/dist/{chunk-zxzvketc.js → chunk-kbpkpxcn.js} +20 -19
  28. package/dist/{chunk-6tra3gw8.js → chunk-kjn1knb9.js} +7 -7
  29. package/dist/{chunk-0he2dx5n.js → chunk-p3s7cjfc.js} +15 -14
  30. package/dist/chunk-pq6hrtnb.js +49 -0
  31. package/dist/{chunk-mp2rqtcj.js → chunk-ptpy7nnm.js} +8 -8
  32. package/dist/{chunk-xqfj56m9.js → chunk-vn1rfxma.js} +8 -8
  33. package/dist/chunk-vyv8kvkv.js +113 -0
  34. package/dist/{chunk-h1v6w1fh.js → chunk-xe2zgyz7.js} +35 -35
  35. package/dist/chunk-y4dwmhn2.js +14 -0
  36. package/dist/{chunk-8kzaxz52.js → chunk-yypj3zn0.js} +8 -8
  37. package/dist/chunk-yzj1mfpr.js +1515 -0
  38. package/dist/client.js +62 -61
  39. package/dist/connectors/index.js +36 -37
  40. package/dist/contracts/artifact-markers.js +11 -12
  41. package/dist/contracts/artifacts.js +21 -23
  42. package/dist/contracts/automation-document/index.js +28 -30
  43. package/dist/contracts/pipeline-document/built-ins.d.ts +1 -1
  44. package/dist/contracts/pipeline-document/index.js +95 -97
  45. package/dist/contracts/step-artifact-submissions.js +20 -17
  46. package/dist/contracts/work-item-changes.js +8 -6
  47. package/dist/defaults/index.js +22 -23
  48. package/dist/definitions/automations/index.js +6 -8
  49. package/dist/definitions/environments/index.js +37 -38
  50. package/dist/definitions/pipelines/index.js +12 -14
  51. package/dist/definitions/steps/define-mcp.d.ts +2 -2
  52. package/dist/definitions/steps/index.js +93 -95
  53. package/dist/definitions/steps/mcp-server-config.d.ts +13 -3
  54. package/dist/definitions/steps/step-definitions-client.d.ts +18 -0
  55. package/dist/definitions/validation/index.js +17 -18
  56. package/dist/devcontainer-config-path.js +9 -11
  57. package/dist/env-vars.js +37 -39
  58. package/dist/environment.js +41 -42
  59. package/dist/eslint.js +0 -2
  60. package/dist/generated/index.d.ts +2 -2
  61. package/dist/generated/sdk.gen.d.ts +41 -1
  62. package/dist/generated/types.gen.d.ts +1801 -0
  63. package/dist/git-url/git-repo-identity.js +0 -2
  64. package/dist/health-checks.js +15 -17
  65. package/dist/index.js +364 -358
  66. package/dist/jsonc.js +7 -8
  67. package/dist/managed-connections.d.ts +16 -0
  68. package/dist/managed-connections.js +9 -0
  69. package/dist/managed-runtimes.js +9 -11
  70. package/dist/opencode-mcp.d.ts +55 -1
  71. package/dist/opencode-mcp.js +33 -28
  72. package/dist/pipelines/index.js +78 -81
  73. package/dist/push/code-step-lookup.js +9 -10
  74. package/dist/push/index.d.ts +1 -0
  75. package/dist/push/index.js +88 -59
  76. package/dist/push/push-from-directory.d.ts +3 -0
  77. package/dist/push/pushed-mcp-servers.d.ts +28 -0
  78. package/dist/repo-config.js +41 -43
  79. package/dist/resolve-environment.js +14 -15
  80. package/dist/scarn-config-parser.js +5 -6
  81. package/dist/task-plane-client.d.ts +137 -1
  82. package/package.json +6 -2
  83. package/dist/chunk-08gcnrzh.js +0 -96
  84. package/dist/chunk-5say64w8.js +0 -14
  85. package/dist/chunk-aph2js2v.js +0 -167
  86. package/dist/chunk-mrzn5tq4.js +0 -107
  87. package/dist/chunk-pwyj6qf3.js +0 -119
  88. package/dist/chunk-qt81x1pm.js +0 -275
  89. package/dist/chunk-vsp708vw.js +0 -167
  90. package/dist/chunk-y64skrwp.js +0 -17
  91. package/dist/chunk-y7ac1t9c.js +0 -39
@@ -0,0 +1,286 @@
1
+ // @bun
2
+ import {
3
+ toJSONSchema,
4
+ string,
5
+ number,
6
+ int,
7
+ array,
8
+ strictObject,
9
+ union,
10
+ discriminatedUnion,
11
+ record,
12
+ _enum,
13
+ literal,
14
+ json
15
+ } from "./chunk-9ct3xypr.js";
16
+
17
+ // src/contracts/pipeline-document/conditions/operators.ts
18
+ var COMPARISON_OPERATORS2 = [
19
+ "equal",
20
+ "notEqual",
21
+ "lessThan",
22
+ "lessThanInclusive",
23
+ "greaterThan",
24
+ "greaterThanInclusive"
25
+ ];
26
+ var CONDITION_OPERATORS2 = [
27
+ ...COMPARISON_OPERATORS2,
28
+ "exists",
29
+ "isEmpty",
30
+ "contains",
31
+ "startsWith",
32
+ "endsWith",
33
+ "matches",
34
+ "before",
35
+ "after",
36
+ "some",
37
+ "every",
38
+ "none"
39
+ ];
40
+ var COMPUTED_FUNCTIONS2 = [
41
+ "sum",
42
+ "avg",
43
+ "min",
44
+ "max",
45
+ "count"
46
+ ];
47
+ var ORDERING_OPERATORS2 = new Set([
48
+ "lessThan",
49
+ "lessThanInclusive",
50
+ "greaterThan",
51
+ "greaterThanInclusive"
52
+ ]);
53
+ var STRING_OPERATORS2 = new Set([
54
+ "startsWith",
55
+ "endsWith",
56
+ "matches"
57
+ ]);
58
+ var DATE_OPERATORS2 = new Set(["before", "after"]);
59
+ var LIST_OPERATORS2 = new Set(["some", "every", "none"]);
60
+
61
+ // src/contracts/pipeline-document/schema.ts
62
+ var NODE_ID_PATTERN2 = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
63
+ var ALIAS_PATTERN2 = /^[A-Za-z_][A-Za-z0-9_]*$/;
64
+ var nodeIdSchema = string().regex(NODE_ID_PATTERN2, "Node ids may only contain letters, digits, '_' and '-'");
65
+ var jsonValueSchema = json();
66
+ var literalSchema2 = strictObject({ value: jsonValueSchema });
67
+ var scalarArgSchema = union([string().min(1), literalSchema2]);
68
+ var listSchema2 = strictObject({ list: array(scalarArgSchema) });
69
+ var argValueSchema2 = union([
70
+ string().min(1),
71
+ literalSchema2,
72
+ listSchema2
73
+ ]);
74
+ var computedSourceSchema2 = union([
75
+ array(string().min(1)).min(1),
76
+ strictObject({
77
+ path: string().min(1),
78
+ field: string().min(1).optional(),
79
+ get where() {
80
+ return conditionSchema2.optional();
81
+ }
82
+ })
83
+ ]);
84
+ var LIST_OPS = new Set(["some", "every", "none"]);
85
+ var UNARY_OPS = new Set(["exists", "isEmpty"]);
86
+ var conditionSchema2 = strictObject({
87
+ get all() {
88
+ return array(conditionSchema2).min(1).optional();
89
+ },
90
+ get any() {
91
+ return array(conditionSchema2).min(1).optional();
92
+ },
93
+ get not() {
94
+ return conditionSchema2.optional();
95
+ },
96
+ path: string().min(1).optional(),
97
+ sum: computedSourceSchema2.optional(),
98
+ avg: computedSourceSchema2.optional(),
99
+ min: computedSourceSchema2.optional(),
100
+ max: computedSourceSchema2.optional(),
101
+ count: computedSourceSchema2.optional(),
102
+ weights: array(number()).min(1).optional(),
103
+ op: _enum(CONDITION_OPERATORS2).optional(),
104
+ value: jsonValueSchema.optional(),
105
+ ref: string().min(1).optional(),
106
+ get where() {
107
+ return conditionSchema2.optional();
108
+ }
109
+ }).superRefine((condition, ctx) => {
110
+ const combinators = ["all", "any", "not"].filter((key) => condition[key] !== undefined);
111
+ const lefts = ["path", ...COMPUTED_FUNCTIONS2].filter((key) => condition[key] !== undefined);
112
+ if (combinators.length > 0) {
113
+ const extras = Object.keys(condition).filter((key) => key !== combinators[0]);
114
+ if (combinators.length > 1 || extras.length > 0) {
115
+ ctx.addIssue({
116
+ code: "custom",
117
+ message: `A condition with "${String(combinators[0])}" can't have other keys (found ${[...combinators.slice(1), ...extras].map((key) => `"${key}"`).join(", ")})`
118
+ });
119
+ }
120
+ return;
121
+ }
122
+ if (lefts.length !== 1) {
123
+ ctx.addIssue({
124
+ code: "custom",
125
+ 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(", ")}`
126
+ });
127
+ return;
128
+ }
129
+ if (condition.op === undefined) {
130
+ ctx.addIssue({
131
+ code: "custom",
132
+ message: 'A condition needs "op"',
133
+ path: ["op"]
134
+ });
135
+ return;
136
+ }
137
+ const isList = LIST_OPS.has(condition.op);
138
+ const isUnary = UNARY_OPS.has(condition.op);
139
+ if (isList && condition.where === undefined) {
140
+ ctx.addIssue({
141
+ code: "custom",
142
+ message: `"${condition.op}" needs a "where" condition`,
143
+ path: ["where"]
144
+ });
145
+ }
146
+ if (!isList && condition.where !== undefined) {
147
+ ctx.addIssue({
148
+ code: "custom",
149
+ message: `"where" is only allowed with "some", "every" or "none", not "${condition.op}"`,
150
+ path: ["where"]
151
+ });
152
+ }
153
+ const hasValue = condition.value !== undefined;
154
+ const hasRef = condition.ref !== undefined;
155
+ if ((isList || isUnary) && (hasValue || hasRef)) {
156
+ ctx.addIssue({
157
+ code: "custom",
158
+ message: `"${condition.op}" takes no "value" or "ref"`,
159
+ path: [hasValue ? "value" : "ref"]
160
+ });
161
+ }
162
+ if (!isList && !isUnary && hasValue === hasRef) {
163
+ ctx.addIssue({
164
+ code: "custom",
165
+ message: `"${condition.op}" needs exactly one of "value" or "ref"`
166
+ });
167
+ }
168
+ if (condition.weights !== undefined && condition.avg === undefined) {
169
+ ctx.addIssue({
170
+ code: "custom",
171
+ message: '"weights" is only allowed with "avg"',
172
+ path: ["weights"]
173
+ });
174
+ }
175
+ });
176
+ var toleratedFailuresSchema2 = union([
177
+ strictObject({ count: int().nonnegative() }),
178
+ strictObject({ percent: number().min(0).max(100) })
179
+ ]);
180
+ var eachSchema2 = strictObject({
181
+ over: string().min(1),
182
+ maxConcurrency: int().positive().optional(),
183
+ toleratedFailures: toleratedFailuresSchema2.optional()
184
+ });
185
+ var routeShape = {
186
+ when: conditionSchema2.optional(),
187
+ to: nodeIdSchema,
188
+ pipeline: string().min(1).optional(),
189
+ args: record(string().min(1), argValueSchema2).optional(),
190
+ each: eachSchema2.optional(),
191
+ partial: literal(true).optional(),
192
+ label: string().min(1).max(80).optional(),
193
+ overridable: literal(true).optional()
194
+ };
195
+ function noPartialWithEach(route, ctx) {
196
+ if (route.each !== undefined && route.partial !== undefined) {
197
+ ctx.addIssue({
198
+ code: "custom",
199
+ message: `A route can't have both "each" and "partial"`,
200
+ path: ["partial"]
201
+ });
202
+ }
203
+ }
204
+ var routeSchema2 = strictObject(routeShape).superRefine(noPartialWithEach);
205
+ var otherwiseSchema2 = strictObject(routeShape).omit({ when: true }).superRefine(noPartialWithEach);
206
+ var startSchema2 = strictObject(routeShape).omit({ partial: true, label: true, overridable: true });
207
+ var MATCH_MODES2 = ["first", "all"];
208
+ var nextSchema2 = strictObject({
209
+ match: _enum(MATCH_MODES2).optional(),
210
+ routes: array(routeSchema2).min(1),
211
+ otherwise: otherwiseSchema2.optional(),
212
+ overridable: literal(true).optional()
213
+ });
214
+ var retrySchema2 = strictObject({
215
+ on: array(string().min(1)).min(1),
216
+ maxAttempts: int().positive(),
217
+ intervalSeconds: number().nonnegative().optional(),
218
+ backoffRate: number().positive().optional(),
219
+ maxDelaySeconds: number().nonnegative().optional()
220
+ });
221
+ var catchSchema2 = strictObject({
222
+ on: array(string().min(1)).min(1),
223
+ to: nodeIdSchema,
224
+ pipeline: string().min(1).optional(),
225
+ args: record(string().min(1), argValueSchema2).optional()
226
+ });
227
+ var stepNodeSchema2 = strictObject({
228
+ kind: literal("step"),
229
+ title: string().optional(),
230
+ step: string().min(1),
231
+ next: nextSchema2.optional(),
232
+ retry: array(retrySchema2).optional(),
233
+ catch: array(catchSchema2).optional(),
234
+ timeoutSeconds: int().positive().optional(),
235
+ heartbeatSeconds: int().positive().optional(),
236
+ maxRuns: int().positive().optional(),
237
+ maxTurns: int().nonnegative().optional()
238
+ });
239
+ var DEFAULT_MAX_TURNS2 = 2;
240
+ var DECISION_BODY_MODES2 = ["optional", "required"];
241
+ var decisionActionSchema2 = strictObject({
242
+ key: string().min(1),
243
+ label: string().min(1),
244
+ body: _enum(DECISION_BODY_MODES2).optional()
245
+ });
246
+ var waitNodeSchema2 = strictObject({
247
+ kind: literal("wait"),
248
+ title: string().optional(),
249
+ for: _enum(["decision", "reply", "event", "timer"]),
250
+ actions: array(decisionActionSchema2).optional(),
251
+ next: nextSchema2.optional(),
252
+ catch: array(catchSchema2).optional(),
253
+ timeoutSeconds: int().positive().optional(),
254
+ maxRuns: int().positive().optional()
255
+ });
256
+ var succeedNodeSchema2 = strictObject({
257
+ kind: literal("succeed"),
258
+ title: string().optional()
259
+ });
260
+ var failNodeSchema2 = strictObject({
261
+ kind: literal("fail"),
262
+ title: string().optional(),
263
+ error: string().min(1).optional(),
264
+ cause: string().optional()
265
+ });
266
+ var nodeSchema2 = discriminatedUnion("kind", [
267
+ stepNodeSchema2,
268
+ waitNodeSchema2,
269
+ succeedNodeSchema2,
270
+ failNodeSchema2
271
+ ]);
272
+ var pipelineDocumentSchema2 = strictObject({
273
+ $schema: string().optional(),
274
+ schemaVersion: literal(1),
275
+ key: string().min(1),
276
+ title: string().optional(),
277
+ timeoutSeconds: int().positive().optional(),
278
+ workItemFields: record(string().regex(ALIAS_PATTERN2, "Aliases must be identifiers (letters, digits, '_')"), string().min(1)).optional(),
279
+ start: startSchema2,
280
+ nodes: record(nodeIdSchema, nodeSchema2)
281
+ });
282
+ function pipelineDocumentJsonSchema2() {
283
+ return toJSONSchema(pipelineDocumentSchema2, { io: "input" });
284
+ }
285
+
286
+ export { COMPARISON_OPERATORS2, CONDITION_OPERATORS2, COMPUTED_FUNCTIONS2, ORDERING_OPERATORS2, STRING_OPERATORS2, DATE_OPERATORS2, LIST_OPERATORS2, NODE_ID_PATTERN2, ALIAS_PATTERN2, literalSchema2, listSchema2, argValueSchema2, computedSourceSchema2, conditionSchema2, toleratedFailuresSchema2, eachSchema2, routeSchema2, otherwiseSchema2, startSchema2, MATCH_MODES2, nextSchema2, retrySchema2, catchSchema2, stepNodeSchema2, DEFAULT_MAX_TURNS2, DECISION_BODY_MODES2, decisionActionSchema2, waitNodeSchema2, succeedNodeSchema2, failNodeSchema2, nodeSchema2, pipelineDocumentSchema2, pipelineDocumentJsonSchema2 };
@@ -0,0 +1,126 @@
1
+ // @bun
2
+ import {
3
+ argValueSchema2,
4
+ conditionSchema2,
5
+ MATCH_MODES2
6
+ } from "./chunk-czq37rrt.js";
7
+ import {
8
+ toJSONSchema,
9
+ string,
10
+ array,
11
+ strictObject,
12
+ discriminatedUnion,
13
+ record,
14
+ _enum,
15
+ literal
16
+ } from "./chunk-9ct3xypr.js";
17
+
18
+ // src/contracts/automation-document/schema.ts
19
+ var AUTOMATION_SCOPES2 = ["workItem", "project"];
20
+ var WORK_ITEM_AUTOMATION_EVENTS2 = [
21
+ "self.attached",
22
+ "child.created",
23
+ "child.ready",
24
+ "child.closed"
25
+ ];
26
+ var PROJECT_AUTOMATION_EVENTS2 = [
27
+ "workItem.created",
28
+ "workItem.ready",
29
+ "workItem.label.added"
30
+ ];
31
+ var AUTOMATION_EVENTS2 = [
32
+ ...WORK_ITEM_AUTOMATION_EVENTS2,
33
+ ...PROJECT_AUTOMATION_EVENTS2
34
+ ];
35
+ var AUTOMATION_SUBJECTS2 = ["workItem", "child"];
36
+ function scopeOfEvent2(event) {
37
+ return WORK_ITEM_AUTOMATION_EVENTS2.includes(event) ? "workItem" : "project";
38
+ }
39
+ function eventHasChild2(event) {
40
+ return event.startsWith("child.");
41
+ }
42
+ var keySchema = string().min(1);
43
+ var subjectSchema = _enum(AUTOMATION_SUBJECTS2);
44
+ var stepTargetShape = {
45
+ kind: literal("step"),
46
+ to: keySchema,
47
+ args: record(string().min(1), argValueSchema2).optional(),
48
+ on: subjectSchema
49
+ };
50
+ var pipelineTargetShape = {
51
+ kind: literal("pipeline"),
52
+ to: keySchema,
53
+ on: subjectSchema
54
+ };
55
+ var attachTargetShape = {
56
+ kind: literal("attach"),
57
+ automation: keySchema
58
+ };
59
+ var skipTargetShape = { kind: literal("skip") };
60
+ var automationTargetSchema2 = discriminatedUnion("kind", [
61
+ strictObject(stepTargetShape),
62
+ strictObject(pipelineTargetShape),
63
+ strictObject(attachTargetShape),
64
+ strictObject(skipTargetShape)
65
+ ]);
66
+ var when = { when: conditionSchema2.optional() };
67
+ var automationRouteSchema2 = discriminatedUnion("kind", [
68
+ strictObject({ ...when, ...stepTargetShape }),
69
+ strictObject({ ...when, ...pipelineTargetShape }),
70
+ strictObject({ ...when, ...attachTargetShape }),
71
+ strictObject({ ...when, ...skipTargetShape })
72
+ ]);
73
+ var automationNextSchema2 = strictObject({
74
+ match: _enum(MATCH_MODES2).optional(),
75
+ routes: array(automationRouteSchema2).min(1),
76
+ otherwise: automationTargetSchema2.optional()
77
+ });
78
+ var automationRuleSchema2 = strictObject({
79
+ event: _enum(AUTOMATION_EVENTS2),
80
+ next: automationNextSchema2
81
+ });
82
+ function targetsOf(rule) {
83
+ return [
84
+ ...rule.next.routes,
85
+ ...rule.next.otherwise === undefined ? [] : [rule.next.otherwise]
86
+ ];
87
+ }
88
+ var automationDocumentSchema2 = strictObject({
89
+ $schema: string().optional(),
90
+ kind: literal("automation"),
91
+ schemaVersion: literal(1),
92
+ key: keySchema,
93
+ title: string().optional(),
94
+ scope: _enum(AUTOMATION_SCOPES2),
95
+ rules: array(automationRuleSchema2)
96
+ }).superRefine((document, ctx) => {
97
+ document.rules.forEach((rule, index) => {
98
+ if (scopeOfEvent2(rule.event) !== document.scope) {
99
+ ctx.addIssue({
100
+ code: "custom",
101
+ message: `"${rule.event}" isn't an event of a ${document.scope === "workItem" ? "work-item" : "project"} automation`,
102
+ path: ["rules", index, "event"]
103
+ });
104
+ }
105
+ for (const target of targetsOf(rule)) {
106
+ if (target.kind === "attach" && document.scope !== "project") {
107
+ ctx.addIssue({
108
+ code: "custom",
109
+ message: "Only a project automation can attach automations",
110
+ path: ["rules", index, "next"]
111
+ });
112
+ }
113
+ if ((target.kind === "step" || target.kind === "pipeline") && target.on === "child" && !eventHasChild2(rule.event)) {
114
+ ctx.addIssue({
115
+ code: "custom",
116
+ message: `"${rule.event}" has no child work item, so a target can't be "on": "child"`,
117
+ path: ["rules", index, "next"]
118
+ });
119
+ }
120
+ }
121
+ });
122
+ });
123
+ function automationDocumentJsonSchema2() {
124
+ return toJSONSchema(automationDocumentSchema2, { io: "input" });
125
+ }
126
+ export { AUTOMATION_SCOPES2, WORK_ITEM_AUTOMATION_EVENTS2, PROJECT_AUTOMATION_EVENTS2, AUTOMATION_EVENTS2, AUTOMATION_SUBJECTS2, scopeOfEvent2, eventHasChild2, automationTargetSchema2, automationRouteSchema2, automationNextSchema2, automationRuleSchema2, automationDocumentSchema2, automationDocumentJsonSchema2 };
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  // src/jsonc.ts
3
- var stripJsoncComments = (content) => {
3
+ var stripJsoncComments2 = (content) => {
4
4
  let result = "";
5
5
  let inString = false;
6
6
  let escapeNextCharacter = false;
@@ -58,7 +58,7 @@ var stripJsoncComments = (content) => {
58
58
  }
59
59
  return result;
60
60
  };
61
- var stripTrailingCommas = (content) => {
61
+ var stripTrailingCommas2 = (content) => {
62
62
  let result = "";
63
63
  let inString = false;
64
64
  let escapeNextCharacter = false;
@@ -87,12 +87,12 @@ var stripTrailingCommas = (content) => {
87
87
  if (character === ",") {
88
88
  let lookaheadIndex = index + 1;
89
89
  while (lookaheadIndex < content.length) {
90
- const lookaheadCharacter2 = content.charAt(lookaheadIndex);
91
- if (/\s/u.test(lookaheadCharacter2)) {
90
+ const lookaheadCharacter = content.charAt(lookaheadIndex);
91
+ if (/\s/u.test(lookaheadCharacter)) {
92
92
  lookaheadIndex += 1;
93
93
  continue;
94
94
  }
95
- if (lookaheadCharacter2 === "}" || lookaheadCharacter2 === "]") {
95
+ if (lookaheadCharacter === "}" || lookaheadCharacter === "]") {
96
96
  break;
97
97
  }
98
98
  result += character;
@@ -111,6 +111,6 @@ var stripTrailingCommas = (content) => {
111
111
  }
112
112
  return result;
113
113
  };
114
- var parseJsonc = (content) => JSON.parse(stripTrailingCommas(stripJsoncComments(content)));
114
+ var parseJsonc2 = (content) => JSON.parse(stripTrailingCommas2(stripJsoncComments2(content)));
115
115
 
116
- export { stripJsoncComments, stripTrailingCommas, parseJsonc };
116
+ export { stripJsoncComments2, stripTrailingCommas2, parseJsonc2 };
@@ -1,25 +1,25 @@
1
1
  // @bun
2
2
  import {
3
- isEnvironmentHandle
4
- } from "./chunk-6tra3gw8.js";
3
+ devcontainerConfigPathSchema2
4
+ } from "./chunk-yypj3zn0.js";
5
5
  import {
6
- environmentNameSchema
7
- } from "./chunk-aph2js2v.js";
6
+ containsInputToken2
7
+ } from "./chunk-vyv8kvkv.js";
8
8
  import {
9
- devcontainerConfigPathSchema
10
- } from "./chunk-8kzaxz52.js";
9
+ MANAGED_RUNTIME_IDS2
10
+ } from "./chunk-y4dwmhn2.js";
11
11
  import {
12
- MANAGED_RUNTIME_IDS
13
- } from "./chunk-5say64w8.js";
12
+ connectorIdsSchema2
13
+ } from "./chunk-3j5wf2t5.js";
14
14
  import {
15
- connectorIdsSchema
16
- } from "./chunk-nkm31g10.js";
15
+ environmentNameSchema2
16
+ } from "./chunk-bcvx11fn.js";
17
17
  import {
18
- containsInputToken
19
- } from "./chunk-mrzn5tq4.js";
18
+ isEnvironmentHandle2
19
+ } from "./chunk-kjn1knb9.js";
20
20
 
21
21
  // src/definitions/steps/prompt-template.ts
22
- function createPromptInputProxy(path = []) {
22
+ function createPromptInputProxy2(path = []) {
23
23
  const token = () => path.length ? `{{${path.join(".")}}}` : "";
24
24
  return new Proxy(Object.freeze({}), {
25
25
  get(_, key) {
@@ -31,23 +31,23 @@ function createPromptInputProxy(path = []) {
31
31
  }
32
32
  if (typeof key !== "string")
33
33
  return;
34
- return createPromptInputProxy([...path, key]);
34
+ return createPromptInputProxy2([...path, key]);
35
35
  }
36
36
  });
37
37
  }
38
- function createPromptTemplateContext() {
38
+ function createPromptTemplateContext2() {
39
39
  return {
40
- input: createPromptInputProxy(["input"]),
41
- env: createPromptInputProxy(["env"]),
40
+ input: createPromptInputProxy2(["input"]),
41
+ env: createPromptInputProxy2(["env"]),
42
42
  scarn: {
43
- artifactsDir: createPromptInputProxy([
43
+ artifactsDir: createPromptInputProxy2([
44
44
  "scarn",
45
45
  "artifactsDir"
46
46
  ])
47
47
  }
48
48
  };
49
49
  }
50
- function renderPromptTemplate(template, contextJson) {
50
+ function renderPromptTemplate2(template, contextJson) {
51
51
  return template.replace(/\{\{([^}]+)\}\}/g, (_, path) => {
52
52
  const value = path.split(".").reduce((curr, key) => curr != null ? curr[key] : undefined, contextJson);
53
53
  return value != null ? String(value) : "";
@@ -56,7 +56,7 @@ function renderPromptTemplate(template, contextJson) {
56
56
 
57
57
  // src/definitions/steps/env.ts
58
58
  var SECRET_LOOKING_NAME = /SECRET|TOKEN|PASSWORD|PASSWD|API_?KEY|PRIVATE/i;
59
- function isSecretLookingEnvName(name) {
59
+ function isSecretLookingEnvName2(name) {
60
60
  return SECRET_LOOKING_NAME.test(name);
61
61
  }
62
62
  var helperEntries = new WeakSet;
@@ -64,7 +64,7 @@ function brand(entry) {
64
64
  helperEntries.add(entry);
65
65
  return entry;
66
66
  }
67
- var Env = {
67
+ var Env2 = {
68
68
  value(opts) {
69
69
  return brand({
70
70
  kind: "value",
@@ -96,12 +96,12 @@ function isHelperEntry(entry) {
96
96
  return typeof entry === "object" && helperEntries.has(entry);
97
97
  }
98
98
  function assertNotStaticSecret(name, value, flags) {
99
- if (containsInputToken(value))
99
+ if (containsInputToken2(value))
100
100
  return;
101
101
  if (flags.secret) {
102
102
  throw new Error(`Env "${name}": a secret must interpolate an input token; a static secret would be stored in plaintext. Use Env.inherit({ secret: true }) to read it from the worker.`);
103
103
  }
104
- if (isSecretLookingEnvName(name) && !flags.unsafeAllowStatic) {
104
+ if (isSecretLookingEnvName2(name) && !flags.unsafeAllowStatic) {
105
105
  throw new Error(`Env "${name}": a static value on a secret-looking name would be stored in plaintext. Use Env.inherit({ secret: true }) to read it from the worker, or Env.value({ value, unsafeAllowStatic: true }) if it is not actually secret.`);
106
106
  }
107
107
  }
@@ -145,22 +145,22 @@ function toEnvVarSpec(name, entry) {
145
145
  ...appliesField(entry.applies)
146
146
  };
147
147
  }
148
- function normalizeEnv(fn) {
148
+ function normalizeEnv2(fn) {
149
149
  if (!fn)
150
150
  return null;
151
- const record = typeof fn === "function" ? fn({ input: createPromptInputProxy(["input"]) }) : fn;
151
+ const record = typeof fn === "function" ? fn({ input: createPromptInputProxy2(["input"]) }) : fn;
152
152
  const specs = Object.entries(record).map(([name, entry]) => toEnvVarSpec(name, entry));
153
153
  return specs.length > 0 ? specs : null;
154
154
  }
155
155
 
156
156
  // src/definitions/steps/runtime.ts
157
- var managedRuntimeFactories = Object.fromEntries(MANAGED_RUNTIME_IDS.map((id) => [id, () => ({ kind: "managed", id })]));
158
- var Runtime = {
157
+ var managedRuntimeFactories = Object.fromEntries(MANAGED_RUNTIME_IDS2.map((id) => [id, () => ({ kind: "managed", id })]));
158
+ var Runtime2 = {
159
159
  managed: managedRuntimeFactories,
160
160
  devcontainer(opts) {
161
161
  if (opts?.config === undefined)
162
162
  return { kind: "devcontainer" };
163
- const parsed = devcontainerConfigPathSchema.safeParse(opts.config);
163
+ const parsed = devcontainerConfigPathSchema2.safeParse(opts.config);
164
164
  if (!parsed.success) {
165
165
  throw new Error(`Runtime.devcontainer config "${opts.config}": ${parsed.error.issues.map((issue) => issue.message).join("; ")}`);
166
166
  }
@@ -170,7 +170,7 @@ var Runtime = {
170
170
  return { kind: "host" };
171
171
  }
172
172
  };
173
- function assertNoSetupVarsOnHost(envJson, runtime, owner) {
173
+ function assertNoSetupVarsOnHost2(envJson, runtime, owner) {
174
174
  if (runtime?.kind !== "host")
175
175
  return;
176
176
  const setupVar = (envJson ?? []).find((entry) => (entry.applies ?? "agent") !== "agent");
@@ -178,10 +178,10 @@ function assertNoSetupVarsOnHost(envJson, runtime, owner) {
178
178
  return;
179
179
  throw new Error(`${owner ? `${owner} ` : ""}env "${setupVar.name}": applies "${String(setupVar.applies)}" needs a container to set up, but Runtime.host() has none. Use applies "agent" or Runtime.devcontainer().`);
180
180
  }
181
- function compileConnectors(connectors, owner) {
181
+ function compileConnectors2(connectors, owner) {
182
182
  if (connectors === undefined || connectors.length === 0)
183
183
  return;
184
- const parsed = connectorIdsSchema.safeParse([...connectors]);
184
+ const parsed = connectorIdsSchema2.safeParse([...connectors]);
185
185
  if (!parsed.success) {
186
186
  throw new Error(`${owner ? `${owner} ` : ""}environment connectors: ${parsed.error.issues.map((issue) => issue.message).join("; ")}`);
187
187
  }
@@ -190,18 +190,18 @@ function compileConnectors(connectors, owner) {
190
190
  function stepOwner(stepKey) {
191
191
  return stepKey === undefined ? undefined : `Step "${stepKey}"`;
192
192
  }
193
- function knownEnvironmentVars(environment, compiled) {
194
- if (isEnvironmentHandle(environment))
193
+ function knownEnvironmentVars2(environment, compiled) {
194
+ if (isEnvironmentHandle2(environment))
195
195
  return environment.content.vars ?? [];
196
196
  if (compiled?.kind === "named")
197
197
  return;
198
198
  return compiled?.envJson ?? [];
199
199
  }
200
- function compileEnvironment(environment, ctx = {}) {
200
+ function compileEnvironment2(environment, ctx = {}) {
201
201
  if (typeof environment === "string") {
202
- return { kind: "named", name: environmentNameSchema.parse(environment) };
202
+ return { kind: "named", name: environmentNameSchema2.parse(environment) };
203
203
  }
204
- if (isEnvironmentHandle(environment)) {
204
+ if (isEnvironmentHandle2(environment)) {
205
205
  return { kind: "named", name: environment.name };
206
206
  }
207
207
  if (environment === undefined && ctx.defaultRuntime === undefined)
@@ -210,9 +210,9 @@ function compileEnvironment(environment, ctx = {}) {
210
210
  throw new Error(`${stepOwner(ctx.stepKey) ?? "Inline environment"}: environments have no branch; use the step's repo baseBranch.`);
211
211
  }
212
212
  const runtime = environment?.runtime ?? ctx.defaultRuntime;
213
- const envJson = normalizeEnv(environment?.vars);
214
- assertNoSetupVarsOnHost(envJson, runtime, stepOwner(ctx.stepKey));
215
- const connectors = compileConnectors(environment !== undefined && "connectors" in environment ? environment.connectors : undefined, stepOwner(ctx.stepKey));
213
+ const envJson = normalizeEnv2(environment?.vars);
214
+ assertNoSetupVarsOnHost2(envJson, runtime, stepOwner(ctx.stepKey));
215
+ const connectors = compileConnectors2(environment !== undefined && "connectors" in environment ? environment.connectors : undefined, stepOwner(ctx.stepKey));
216
216
  return {
217
217
  kind: "inline",
218
218
  ...runtime === undefined ? {} : { runtime },
@@ -221,4 +221,4 @@ function compileEnvironment(environment, ctx = {}) {
221
221
  };
222
222
  }
223
223
 
224
- export { createPromptInputProxy, createPromptTemplateContext, renderPromptTemplate, isSecretLookingEnvName, Env, normalizeEnv, Runtime, assertNoSetupVarsOnHost, compileConnectors, knownEnvironmentVars, compileEnvironment };
224
+ export { createPromptInputProxy2, createPromptTemplateContext2, renderPromptTemplate2, isSecretLookingEnvName2, Env2, normalizeEnv2, Runtime2, assertNoSetupVarsOnHost2, compileConnectors2, knownEnvironmentVars2, compileEnvironment2 };