@scarn/sdk 0.8.1 → 0.8.3

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 (66) hide show
  1. package/dist/automations/define-automation.d.ts +20 -0
  2. package/dist/automations/index.d.ts +8 -0
  3. package/dist/automations/index.js +21 -0
  4. package/dist/automations/targets.d.ts +36 -0
  5. package/dist/automations/types.d.ts +116 -0
  6. package/dist/{chunk-dp86pa6m.js → chunk-01nfqm18.js} +5 -1
  7. package/dist/chunk-0vzq22dj.js +73 -0
  8. package/dist/chunk-11hbmexe.js +250 -0
  9. package/dist/{chunk-700xe701.js → chunk-3gy0cb5f.js} +5 -1
  10. package/dist/{chunk-102vfpw4.js → chunk-43y7tfn4.js} +33 -414
  11. package/dist/chunk-61jf8b6s.js +53 -0
  12. package/dist/chunk-76d1bwwz.js +119 -0
  13. package/dist/chunk-8z1wa3kd.js +109 -0
  14. package/dist/{chunk-p7yrcmqm.js → chunk-cnxaagfj.js} +2 -52
  15. package/dist/{chunk-cdanncng.js → chunk-ejzfdm1z.js} +21 -5
  16. package/dist/{chunk-gds7w7zh.js → chunk-fgfhvsee.js} +1 -4
  17. package/dist/{chunk-3ctaaseb.js → chunk-fyfvp6jx.js} +48 -21
  18. package/dist/{chunk-mz53r914.js → chunk-jj9pezwb.js} +22 -119
  19. package/dist/{chunk-vfeytkqx.js → chunk-wnfj3wyx.js} +106 -33
  20. package/dist/chunk-x0hjhqrf.js +416 -0
  21. package/dist/chunk-y11p1q7r.js +159 -0
  22. package/dist/client.js +6 -4
  23. package/dist/contracts/automation-document/index.d.ts +5 -0
  24. package/dist/contracts/automation-document/index.js +34 -0
  25. package/dist/contracts/automation-document/schema.d.ts +363 -0
  26. package/dist/contracts/pipeline-document/built-ins.d.ts +1 -1
  27. package/dist/contracts/pipeline-document/index.js +9 -7
  28. package/dist/contracts/pipeline-document/schema.d.ts +3 -3
  29. package/dist/contracts/work-item-changes.d.ts +51 -0
  30. package/dist/contracts/work-item-changes.js +68 -0
  31. package/dist/defaults/index.js +2 -2
  32. package/dist/definitions/automations/automations-client.d.ts +178 -0
  33. package/dist/definitions/automations/index.d.ts +1 -0
  34. package/dist/definitions/automations/index.js +12 -0
  35. package/dist/definitions/pipelines/index.d.ts +0 -1
  36. package/dist/definitions/pipelines/index.js +4 -12
  37. package/dist/definitions/pipelines/work-item-fields.d.ts +11 -22
  38. package/dist/definitions/steps/define-code-step.d.ts +3 -1
  39. package/dist/definitions/steps/define-step.d.ts +29 -1
  40. package/dist/definitions/steps/index.js +12 -7
  41. package/dist/definitions/steps/repo.d.ts +11 -3
  42. package/dist/definitions/steps/runtime.d.ts +11 -12
  43. package/dist/definitions/steps/step-definitions-client.d.ts +18 -0
  44. package/dist/definitions/steps/step-features.d.ts +2 -2
  45. package/dist/definitions/steps/step-handle.d.ts +8 -1
  46. package/dist/definitions/validation/index.js +2 -2
  47. package/dist/generated/index.d.ts +2 -2
  48. package/dist/generated/sdk.gen.d.ts +66 -11
  49. package/dist/generated/types.gen.d.ts +5513 -3488
  50. package/dist/index.d.ts +1 -0
  51. package/dist/index.js +61 -49
  52. package/dist/pipelines/define-pipeline.d.ts +7 -7
  53. package/dist/pipelines/handles.d.ts +0 -5
  54. package/dist/pipelines/index.js +7 -4
  55. package/dist/pipelines/types.d.ts +13 -1
  56. package/dist/push/collect-definitions.d.ts +3 -8
  57. package/dist/push/collect-pipeline-documents.d.ts +13 -3
  58. package/dist/push/index.d.ts +2 -2
  59. package/dist/push/index.js +90 -127
  60. package/dist/push/push-from-directory.d.ts +10 -6
  61. package/dist/repo-config.d.ts +14 -4
  62. package/dist/repo-config.js +5 -1
  63. package/dist/task-plane-client.d.ts +42 -0
  64. package/package.json +17 -1
  65. package/dist/chunk-zm72ksz0.js +0 -256
  66. package/dist/definitions/pipelines/define-default-pipeline-assignment.d.ts +0 -263
@@ -0,0 +1,159 @@
1
+ // @bun
2
+ // src/pipelines/source.ts
3
+ var FRAME = /\(?((?:file:\/\/)?[^\s()]+):(\d+):(\d+)\)?\s*$/;
4
+ function sdkRoot() {
5
+ const here = new URL(import.meta.url).pathname;
6
+ const parts = here.split("/");
7
+ return parts.slice(0, -2).join("/") + "/";
8
+ }
9
+ var SDK_ROOT = sdkRoot();
10
+ function toPath(file) {
11
+ return file.startsWith("file://") ? new URL(file).pathname : file;
12
+ }
13
+ function parseFrame(frame) {
14
+ const match = FRAME.exec(frame.trim());
15
+ if (match === null) {
16
+ return null;
17
+ }
18
+ const [, file, line, column] = match;
19
+ if (file === undefined || line === undefined || column === undefined) {
20
+ return null;
21
+ }
22
+ return { file: toPath(file), line: Number(line), column: Number(column) };
23
+ }
24
+ function captureSite(stack = new Error().stack) {
25
+ for (const frame of (stack ?? "").split(`
26
+ `).slice(1)) {
27
+ const site = parseFrame(frame);
28
+ if (site !== null && !site.file.startsWith(SDK_ROOT) && !site.file.startsWith("node:") && site.file.includes("/")) {
29
+ return site;
30
+ }
31
+ }
32
+ return null;
33
+ }
34
+ function cwd() {
35
+ const proc = globalThis.process;
36
+ return typeof proc?.cwd === "function" ? proc.cwd() : null;
37
+ }
38
+ function formatSite(site) {
39
+ if (site === null) {
40
+ return "<unknown>";
41
+ }
42
+ const base = cwd();
43
+ const file = base !== null && site.file.startsWith(`${base}/`) ? site.file.slice(base.length + 1) : site.file;
44
+ return `${file}:${String(site.line)}`;
45
+ }
46
+
47
+ // src/pipelines/errors.ts
48
+ function formatIssue(issue) {
49
+ return `${formatSite(issue.site)} (${issue.pointer === "" ? "/" : issue.pointer}): ${issue.message}`;
50
+ }
51
+
52
+ class PipelineBuildError extends Error {
53
+ issues;
54
+ constructor(key, issues) {
55
+ super(`Pipeline "${key}" has ${String(issues.length)} build error${issues.length === 1 ? "" : "s"}:
56
+ ${issues.map((issue) => ` ${formatIssue(issue)}`).join(`
57
+ `)}`);
58
+ this.name = "PipelineBuildError";
59
+ this.issues = issues;
60
+ }
61
+ }
62
+
63
+ class AuthoringError extends Error {
64
+ site;
65
+ constructor(message, site = captureSite()) {
66
+ super(message);
67
+ this.name = "AuthoringError";
68
+ this.site = site;
69
+ }
70
+ }
71
+
72
+ // src/automations/targets.ts
73
+ var SUBJECT = Symbol("scarn.automation.subject");
74
+ var targets = new WeakMap;
75
+ function registerAutomationTarget(data) {
76
+ const value = Object.freeze({ _tag: "automation_target", kind: data.kind });
77
+ targets.set(value, data);
78
+ return value;
79
+ }
80
+ function automationTargetOf(value) {
81
+ return (typeof value === "object" || typeof value === "function") && value !== null ? targets.get(value) : undefined;
82
+ }
83
+ function markSubject(value, subject) {
84
+ Object.defineProperty(value, SUBJECT, { value: subject, enumerable: false });
85
+ return value;
86
+ }
87
+ function subjectOf(value) {
88
+ const subject = typeof value === "object" && value !== null && SUBJECT in value ? value[SUBJECT] : undefined;
89
+ if (subject === undefined) {
90
+ throw new AuthoringError(".on(...) takes the work item to start for: r.workItem, or r.child on child.* events");
91
+ }
92
+ return subject;
93
+ }
94
+ function stepOn(target) {
95
+ return (subject) => registerAutomationTarget({
96
+ kind: "step",
97
+ target,
98
+ on: subjectOf(subject),
99
+ site: captureSite()
100
+ });
101
+ }
102
+ function pipelineOn(pipeline) {
103
+ return (subject) => registerAutomationTarget({
104
+ kind: "pipeline",
105
+ pipeline,
106
+ on: subjectOf(subject),
107
+ site: captureSite()
108
+ });
109
+ }
110
+
111
+ // src/pipelines/registry.ts
112
+ var nodes = new WeakMap;
113
+ var targets2 = new WeakMap;
114
+ var eaches = new WeakMap;
115
+ var chains = new WeakMap;
116
+ var pendingChains = new Set;
117
+ function registerNode(value, node) {
118
+ nodes.set(value, node);
119
+ return value;
120
+ }
121
+ function registerTarget(value, target) {
122
+ targets2.set(value, target);
123
+ return value;
124
+ }
125
+ function registerEach(value, each) {
126
+ eaches.set(value, each);
127
+ return value;
128
+ }
129
+ function registerChain(value, chain) {
130
+ chains.set(value, chain);
131
+ if (chain.next !== undefined) {
132
+ pendingChains.add(chain);
133
+ }
134
+ return value;
135
+ }
136
+ function isObject(value) {
137
+ return (typeof value === "object" || typeof value === "function") && value !== null;
138
+ }
139
+ function nodeOf(value) {
140
+ return isObject(value) ? nodes.get(value) : undefined;
141
+ }
142
+ function targetOf(value) {
143
+ return isObject(value) ? targets2.get(value) : undefined;
144
+ }
145
+ function eachOf(value) {
146
+ return isObject(value) ? eaches.get(value) : undefined;
147
+ }
148
+ function chainOf(value) {
149
+ return isObject(value) ? chains.get(value) : undefined;
150
+ }
151
+ function requireNode(value, what) {
152
+ const node = nodeOf(value);
153
+ if (node === undefined) {
154
+ throw new AuthoringError(`${what} must be a step, decision or reply handle`);
155
+ }
156
+ return node;
157
+ }
158
+
159
+ export { captureSite, formatIssue, PipelineBuildError, AuthoringError, registerAutomationTarget, automationTargetOf, markSubject, stepOn, pipelineOn, pendingChains, registerNode, registerTarget, registerEach, registerChain, nodeOf, targetOf, eachOf, chainOf, requireNode };
package/dist/client.js CHANGED
@@ -2,12 +2,14 @@
2
2
  import {
3
3
  createScarnClient,
4
4
  createTaskPlaneClient
5
- } from "./chunk-700xe701.js";
5
+ } from "./chunk-3gy0cb5f.js";
6
6
  import {
7
7
  Api,
8
+ Automations,
8
9
  Billing,
9
10
  Conversations,
10
11
  GitHubIntegrations,
12
+ Inbox,
11
13
  NotificationRules,
12
14
  PipelineDefinitions,
13
15
  PipelineExecutions,
@@ -17,7 +19,6 @@ import {
17
19
  Projects,
18
20
  ScarnClient,
19
21
  Secrets,
20
- StepDefinitionTemplates,
21
22
  StepDefinitions,
22
23
  TaskRuns,
23
24
  Tasks,
@@ -27,13 +28,15 @@ import {
27
28
  WorkItemCommentDrafts,
28
29
  WorkItemComments,
29
30
  WorkItems
30
- } from "./chunk-vfeytkqx.js";
31
+ } from "./chunk-wnfj3wyx.js";
31
32
  import"./chunk-y64skrwp.js";
32
33
  export {
33
34
  Api,
35
+ Automations,
34
36
  Billing,
35
37
  Conversations,
36
38
  GitHubIntegrations,
39
+ Inbox,
37
40
  NotificationRules,
38
41
  PipelineDefinitions,
39
42
  PipelineExecutions,
@@ -43,7 +46,6 @@ export {
43
46
  Projects,
44
47
  ScarnClient,
45
48
  Secrets,
46
- StepDefinitionTemplates,
47
49
  StepDefinitions,
48
50
  TaskRuns,
49
51
  Tasks,
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The automation document contract: what an automation JSON document is.
3
+ * Conditions and args share the pipeline document's grammar.
4
+ */
5
+ export * from "./schema";
@@ -0,0 +1,34 @@
1
+ // @bun
2
+ import {
3
+ AUTOMATION_EVENTS,
4
+ AUTOMATION_SCOPES,
5
+ AUTOMATION_SUBJECTS,
6
+ PROJECT_AUTOMATION_EVENTS,
7
+ WORK_ITEM_AUTOMATION_EVENTS,
8
+ automationDocumentJsonSchema,
9
+ automationDocumentSchema,
10
+ automationNextSchema,
11
+ automationRouteSchema,
12
+ automationRuleSchema,
13
+ automationTargetSchema,
14
+ eventHasChild,
15
+ scopeOfEvent
16
+ } from "../../chunk-76d1bwwz.js";
17
+ import"../../chunk-cnxaagfj.js";
18
+ import"../../chunk-skzxcba3.js";
19
+ import"../../chunk-y64skrwp.js";
20
+ export {
21
+ AUTOMATION_EVENTS,
22
+ AUTOMATION_SCOPES,
23
+ AUTOMATION_SUBJECTS,
24
+ PROJECT_AUTOMATION_EVENTS,
25
+ WORK_ITEM_AUTOMATION_EVENTS,
26
+ automationDocumentJsonSchema,
27
+ automationDocumentSchema,
28
+ automationNextSchema,
29
+ automationRouteSchema,
30
+ automationRuleSchema,
31
+ automationTargetSchema,
32
+ eventHasChild,
33
+ scopeOfEvent
34
+ };
@@ -0,0 +1,363 @@
1
+ /**
2
+ * The zod schema for automation JSON documents (schema version 1): what
3
+ * `defineAutomation` compiles to and `scarn pipelines build` writes as
4
+ * `<key>.json`, next to the pipeline documents.
5
+ *
6
+ * ```json
7
+ * {
8
+ * "kind": "automation",
9
+ * "schemaVersion": 1,
10
+ * "key": "wayfinder",
11
+ * "title": "Wayfinder",
12
+ * "scope": "workItem",
13
+ * "rules": [
14
+ * {
15
+ * "event": "child.ready",
16
+ * "next": {
17
+ * "routes": [
18
+ * {
19
+ * "when": { "path": "event.child.labels", "op": "contains", "value": "wayfinder:research" },
20
+ * "kind": "step",
21
+ * "to": "research",
22
+ * "args": { "question": "event.child.title" },
23
+ * "on": "child"
24
+ * }
25
+ * ],
26
+ * "otherwise": { "kind": "skip" }
27
+ * }
28
+ * }
29
+ * ]
30
+ * }
31
+ * ```
32
+ *
33
+ * - `scope` limits `event`: work-item automations react to `self.attached`
34
+ * and `child.*`, project automations to `workItem.*`.
35
+ * - `next` has the shape of a pipeline node's `next`: `match` (`"first"`, the
36
+ * default, or `"all"`), `routes`, each with an optional `when`, and
37
+ * `otherwise`. A rule with one target compiles to one route without `when`.
38
+ * - Each route is a target: `step` (a step key, with args) or `pipeline` (a
39
+ * pipeline key), each started for the work item `on` names (`"workItem"`,
40
+ * the one the rule is about, or `"child"`, only on `child.*` events);
41
+ * `attach` (another automation's key, project scope only); or `skip`.
42
+ * - Refs in `when` and `args` read the event: `event.workItem.<prop>`,
43
+ * `event.child.<prop>` (on `child.*` events) and `event.label` (on
44
+ * `workItem.label.added`), where `<prop>` is `title`, `description`,
45
+ * `labels`, `state` or `fields.<name>`. Args use the pipeline arg format
46
+ * (a ref string, `{ "value": ... }` or `{ "list": [...] }`).
47
+ *
48
+ * The schema checks structure and that events fit the scope. Whether `to`
49
+ * names a known step or pipeline, and whether args fit its input, is checked
50
+ * when the automation is published.
51
+ */
52
+ import { z } from "zod";
53
+ export declare const AUTOMATION_SCOPES: readonly ["workItem", "project"];
54
+ /** Events of a work-item automation: about its own work item and its child work items. */
55
+ export declare const WORK_ITEM_AUTOMATION_EVENTS: readonly ["self.attached", "child.created", "child.ready", "child.closed"];
56
+ /** Events of a project automation: about any top-level work item in the project. */
57
+ export declare const PROJECT_AUTOMATION_EVENTS: readonly ["workItem.created", "workItem.ready", "workItem.label.added"];
58
+ export declare const AUTOMATION_EVENTS: readonly ["self.attached", "child.created", "child.ready", "child.closed", "workItem.created", "workItem.ready", "workItem.label.added"];
59
+ /** Which work item a started Task or pipeline run is for. */
60
+ export declare const AUTOMATION_SUBJECTS: readonly ["workItem", "child"];
61
+ export type AutomationScope = (typeof AUTOMATION_SCOPES)[number];
62
+ export type WorkItemAutomationEvent = (typeof WORK_ITEM_AUTOMATION_EVENTS)[number];
63
+ export type ProjectAutomationEvent = (typeof PROJECT_AUTOMATION_EVENTS)[number];
64
+ export type AutomationEvent = (typeof AUTOMATION_EVENTS)[number];
65
+ export type AutomationSubject = (typeof AUTOMATION_SUBJECTS)[number];
66
+ /** The scope whose automations react to `event`. */
67
+ export declare function scopeOfEvent(event: AutomationEvent): AutomationScope;
68
+ /** Whether `event` has a `child` work item. */
69
+ export declare function eventHasChild(event: AutomationEvent): boolean;
70
+ /** What a rule starts: a step's Task, a pipeline run, an attachment, or nothing. */
71
+ export declare const automationTargetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
72
+ kind: z.ZodLiteral<"step">;
73
+ to: z.ZodString;
74
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
75
+ value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
76
+ }, z.core.$strict>, z.ZodObject<{
77
+ list: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
78
+ value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
79
+ }, z.core.$strict>]>>;
80
+ }, z.core.$strict>]>>>;
81
+ on: z.ZodEnum<{
82
+ workItem: "workItem";
83
+ child: "child";
84
+ }>;
85
+ }, z.core.$strict>, z.ZodObject<{
86
+ kind: z.ZodLiteral<"pipeline">;
87
+ to: z.ZodString;
88
+ on: z.ZodEnum<{
89
+ workItem: "workItem";
90
+ child: "child";
91
+ }>;
92
+ }, z.core.$strict>, z.ZodObject<{
93
+ kind: z.ZodLiteral<"attach">;
94
+ automation: z.ZodString;
95
+ }, z.core.$strict>, z.ZodObject<{
96
+ kind: z.ZodLiteral<"skip">;
97
+ }, z.core.$strict>], "kind">;
98
+ /** One route: an optional `when`, then the target's keys. */
99
+ export declare const automationRouteSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
100
+ kind: z.ZodLiteral<"step">;
101
+ to: z.ZodString;
102
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
103
+ value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
104
+ }, z.core.$strict>, z.ZodObject<{
105
+ list: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
106
+ value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
107
+ }, z.core.$strict>]>>;
108
+ }, z.core.$strict>]>>>;
109
+ on: z.ZodEnum<{
110
+ workItem: "workItem";
111
+ child: "child";
112
+ }>;
113
+ when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
114
+ }, z.core.$strict>, z.ZodObject<{
115
+ kind: z.ZodLiteral<"pipeline">;
116
+ to: z.ZodString;
117
+ on: z.ZodEnum<{
118
+ workItem: "workItem";
119
+ child: "child";
120
+ }>;
121
+ when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
122
+ }, z.core.$strict>, z.ZodObject<{
123
+ kind: z.ZodLiteral<"attach">;
124
+ automation: z.ZodString;
125
+ when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
126
+ }, z.core.$strict>, z.ZodObject<{
127
+ kind: z.ZodLiteral<"skip">;
128
+ when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
129
+ }, z.core.$strict>], "kind">;
130
+ export declare const automationNextSchema: z.ZodObject<{
131
+ match: z.ZodOptional<z.ZodEnum<{
132
+ all: "all";
133
+ first: "first";
134
+ }>>;
135
+ routes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
136
+ kind: z.ZodLiteral<"step">;
137
+ to: z.ZodString;
138
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
139
+ value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
140
+ }, z.core.$strict>, z.ZodObject<{
141
+ list: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
142
+ value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
143
+ }, z.core.$strict>]>>;
144
+ }, z.core.$strict>]>>>;
145
+ on: z.ZodEnum<{
146
+ workItem: "workItem";
147
+ child: "child";
148
+ }>;
149
+ when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
150
+ }, z.core.$strict>, z.ZodObject<{
151
+ kind: z.ZodLiteral<"pipeline">;
152
+ to: z.ZodString;
153
+ on: z.ZodEnum<{
154
+ workItem: "workItem";
155
+ child: "child";
156
+ }>;
157
+ when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
158
+ }, z.core.$strict>, z.ZodObject<{
159
+ kind: z.ZodLiteral<"attach">;
160
+ automation: z.ZodString;
161
+ when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
162
+ }, z.core.$strict>, z.ZodObject<{
163
+ kind: z.ZodLiteral<"skip">;
164
+ when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
165
+ }, z.core.$strict>], "kind">>;
166
+ otherwise: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
167
+ kind: z.ZodLiteral<"step">;
168
+ to: z.ZodString;
169
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
170
+ value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
171
+ }, z.core.$strict>, z.ZodObject<{
172
+ list: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
173
+ value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
174
+ }, z.core.$strict>]>>;
175
+ }, z.core.$strict>]>>>;
176
+ on: z.ZodEnum<{
177
+ workItem: "workItem";
178
+ child: "child";
179
+ }>;
180
+ }, z.core.$strict>, z.ZodObject<{
181
+ kind: z.ZodLiteral<"pipeline">;
182
+ to: z.ZodString;
183
+ on: z.ZodEnum<{
184
+ workItem: "workItem";
185
+ child: "child";
186
+ }>;
187
+ }, z.core.$strict>, z.ZodObject<{
188
+ kind: z.ZodLiteral<"attach">;
189
+ automation: z.ZodString;
190
+ }, z.core.$strict>, z.ZodObject<{
191
+ kind: z.ZodLiteral<"skip">;
192
+ }, z.core.$strict>], "kind">>;
193
+ }, z.core.$strict>;
194
+ export declare const automationRuleSchema: z.ZodObject<{
195
+ event: z.ZodEnum<{
196
+ "self.attached": "self.attached";
197
+ "child.created": "child.created";
198
+ "child.ready": "child.ready";
199
+ "child.closed": "child.closed";
200
+ "workItem.created": "workItem.created";
201
+ "workItem.ready": "workItem.ready";
202
+ "workItem.label.added": "workItem.label.added";
203
+ }>;
204
+ next: z.ZodObject<{
205
+ match: z.ZodOptional<z.ZodEnum<{
206
+ all: "all";
207
+ first: "first";
208
+ }>>;
209
+ routes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
210
+ kind: z.ZodLiteral<"step">;
211
+ to: z.ZodString;
212
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
213
+ value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
214
+ }, z.core.$strict>, z.ZodObject<{
215
+ list: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
216
+ value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
217
+ }, z.core.$strict>]>>;
218
+ }, z.core.$strict>]>>>;
219
+ on: z.ZodEnum<{
220
+ workItem: "workItem";
221
+ child: "child";
222
+ }>;
223
+ when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
224
+ }, z.core.$strict>, z.ZodObject<{
225
+ kind: z.ZodLiteral<"pipeline">;
226
+ to: z.ZodString;
227
+ on: z.ZodEnum<{
228
+ workItem: "workItem";
229
+ child: "child";
230
+ }>;
231
+ when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
232
+ }, z.core.$strict>, z.ZodObject<{
233
+ kind: z.ZodLiteral<"attach">;
234
+ automation: z.ZodString;
235
+ when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
236
+ }, z.core.$strict>, z.ZodObject<{
237
+ kind: z.ZodLiteral<"skip">;
238
+ when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
239
+ }, z.core.$strict>], "kind">>;
240
+ otherwise: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
241
+ kind: z.ZodLiteral<"step">;
242
+ to: z.ZodString;
243
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
244
+ value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
245
+ }, z.core.$strict>, z.ZodObject<{
246
+ list: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
247
+ value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
248
+ }, z.core.$strict>]>>;
249
+ }, z.core.$strict>]>>>;
250
+ on: z.ZodEnum<{
251
+ workItem: "workItem";
252
+ child: "child";
253
+ }>;
254
+ }, z.core.$strict>, z.ZodObject<{
255
+ kind: z.ZodLiteral<"pipeline">;
256
+ to: z.ZodString;
257
+ on: z.ZodEnum<{
258
+ workItem: "workItem";
259
+ child: "child";
260
+ }>;
261
+ }, z.core.$strict>, z.ZodObject<{
262
+ kind: z.ZodLiteral<"attach">;
263
+ automation: z.ZodString;
264
+ }, z.core.$strict>, z.ZodObject<{
265
+ kind: z.ZodLiteral<"skip">;
266
+ }, z.core.$strict>], "kind">>;
267
+ }, z.core.$strict>;
268
+ }, z.core.$strict>;
269
+ type Target = z.infer<typeof automationTargetSchema>;
270
+ export declare const automationDocumentSchema: z.ZodObject<{
271
+ $schema: z.ZodOptional<z.ZodString>;
272
+ kind: z.ZodLiteral<"automation">;
273
+ schemaVersion: z.ZodLiteral<1>;
274
+ key: z.ZodString;
275
+ title: z.ZodOptional<z.ZodString>;
276
+ scope: z.ZodEnum<{
277
+ workItem: "workItem";
278
+ project: "project";
279
+ }>;
280
+ rules: z.ZodArray<z.ZodObject<{
281
+ event: z.ZodEnum<{
282
+ "self.attached": "self.attached";
283
+ "child.created": "child.created";
284
+ "child.ready": "child.ready";
285
+ "child.closed": "child.closed";
286
+ "workItem.created": "workItem.created";
287
+ "workItem.ready": "workItem.ready";
288
+ "workItem.label.added": "workItem.label.added";
289
+ }>;
290
+ next: z.ZodObject<{
291
+ match: z.ZodOptional<z.ZodEnum<{
292
+ all: "all";
293
+ first: "first";
294
+ }>>;
295
+ routes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
296
+ kind: z.ZodLiteral<"step">;
297
+ to: z.ZodString;
298
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
299
+ value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
300
+ }, z.core.$strict>, z.ZodObject<{
301
+ list: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
302
+ value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
303
+ }, z.core.$strict>]>>;
304
+ }, z.core.$strict>]>>>;
305
+ on: z.ZodEnum<{
306
+ workItem: "workItem";
307
+ child: "child";
308
+ }>;
309
+ when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
310
+ }, z.core.$strict>, z.ZodObject<{
311
+ kind: z.ZodLiteral<"pipeline">;
312
+ to: z.ZodString;
313
+ on: z.ZodEnum<{
314
+ workItem: "workItem";
315
+ child: "child";
316
+ }>;
317
+ when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
318
+ }, z.core.$strict>, z.ZodObject<{
319
+ kind: z.ZodLiteral<"attach">;
320
+ automation: z.ZodString;
321
+ when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
322
+ }, z.core.$strict>, z.ZodObject<{
323
+ kind: z.ZodLiteral<"skip">;
324
+ when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
325
+ }, z.core.$strict>], "kind">>;
326
+ otherwise: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
327
+ kind: z.ZodLiteral<"step">;
328
+ to: z.ZodString;
329
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
330
+ value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
331
+ }, z.core.$strict>, z.ZodObject<{
332
+ list: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
333
+ value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
334
+ }, z.core.$strict>]>>;
335
+ }, z.core.$strict>]>>>;
336
+ on: z.ZodEnum<{
337
+ workItem: "workItem";
338
+ child: "child";
339
+ }>;
340
+ }, z.core.$strict>, z.ZodObject<{
341
+ kind: z.ZodLiteral<"pipeline">;
342
+ to: z.ZodString;
343
+ on: z.ZodEnum<{
344
+ workItem: "workItem";
345
+ child: "child";
346
+ }>;
347
+ }, z.core.$strict>, z.ZodObject<{
348
+ kind: z.ZodLiteral<"attach">;
349
+ automation: z.ZodString;
350
+ }, z.core.$strict>, z.ZodObject<{
351
+ kind: z.ZodLiteral<"skip">;
352
+ }, z.core.$strict>], "kind">>;
353
+ }, z.core.$strict>;
354
+ }, z.core.$strict>>;
355
+ }, z.core.$strict>;
356
+ export type AutomationTargetJson = Target;
357
+ export type AutomationRoute = z.infer<typeof automationRouteSchema>;
358
+ export type AutomationNext = z.infer<typeof automationNextSchema>;
359
+ export type AutomationRule = z.infer<typeof automationRuleSchema>;
360
+ export type AutomationDocument = z.infer<typeof automationDocumentSchema>;
361
+ /** The JSON Schema for automation documents, for editors and external tools. */
362
+ export declare function automationDocumentJsonSchema(): Record<string, unknown>;
363
+ export {};
@@ -3,7 +3,7 @@
3
3
  * the input a `reply` wait takes, and caught errors.
4
4
  */
5
5
  import type { JsonSchema } from "./json";
6
- export declare const BUILT_IN_ERRORS: readonly ["Scarn.All", "Scarn.StepFailed", "Scarn.HealthCheckFailed", "Scarn.Timeout", "Scarn.HeartbeatTimeout", "Scarn.MaxRunsExceeded", "Scarn.MaxTurnsExceeded", "Scarn.ConditionError", "Scarn.ArgsError"];
6
+ export declare const BUILT_IN_ERRORS: readonly ["Scarn.All", "Scarn.StepFailed", "Scarn.HealthCheckFailed", "Scarn.Timeout", "Scarn.HeartbeatTimeout", "Scarn.MaxRunsExceeded", "Scarn.MaxTurnsExceeded", "Scarn.ConcurrencyGroupFull", "Scarn.ConditionError", "Scarn.ArgsError", "Scarn.LogArchiveFailed", "Scarn.WorkItemChangesInvalid", "Scarn.WorkItemNotNative"];
7
7
  /** The errors a wait node can raise, so the only names its `catch` may use. */
8
8
  export declare const WAIT_ERRORS: readonly ["Scarn.All", "Scarn.MaxRunsExceeded", "Scarn.ArgsError"];
9
9
  /**
@@ -1,4 +1,11 @@
1
1
  // @bun
2
+ import {
3
+ deepEqual,
4
+ isJsonObject,
5
+ jsonPointer,
6
+ routeAt,
7
+ routeEntries
8
+ } from "../../chunk-61jf8b6s.js";
2
9
  import {
3
10
  ALIAS_PATTERN,
4
11
  COMPARISON_OPERATORS,
@@ -17,11 +24,8 @@ import {
17
24
  computedSourceSchema,
18
25
  conditionSchema,
19
26
  decisionActionSchema,
20
- deepEqual,
21
27
  eachSchema,
22
28
  failNodeSchema,
23
- isJsonObject,
24
- jsonPointer,
25
29
  listSchema,
26
30
  literalSchema,
27
31
  nextSchema,
@@ -30,15 +34,13 @@ import {
30
34
  pipelineDocumentJsonSchema,
31
35
  pipelineDocumentSchema,
32
36
  retrySchema,
33
- routeAt,
34
- routeEntries,
35
37
  routeSchema,
36
38
  startSchema,
37
39
  stepNodeSchema,
38
40
  succeedNodeSchema,
39
41
  toleratedFailuresSchema,
40
42
  waitNodeSchema
41
- } from "../../chunk-p7yrcmqm.js";
43
+ } from "../../chunk-cnxaagfj.js";
42
44
  import {
43
45
  BUILT_IN_ERRORS,
44
46
  CONVERSATION_RESULT_SCHEMA,
@@ -47,7 +49,7 @@ import {
47
49
  REPLY_RESULT_SCHEMA,
48
50
  WAIT_ERRORS,
49
51
  decisionResultSchema
50
- } from "../../chunk-dp86pa6m.js";
52
+ } from "../../chunk-01nfqm18.js";
51
53
  import"../../chunk-skzxcba3.js";
52
54
  import"../../chunk-y64skrwp.js";
53
55
  export {