@scarn/sdk 0.8.20 → 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 (102) hide show
  1. package/dist/auth/api-token-cache.d.ts +24 -0
  2. package/dist/auth/api-token-source.d.ts +39 -0
  3. package/dist/auth/authenticated-fetch.d.ts +10 -0
  4. package/dist/auth/index.d.ts +3 -0
  5. package/dist/auth/index.js +19 -0
  6. package/dist/automations/index.js +14 -17
  7. package/dist/{chunk-habmdf89.js → chunk-0bwsjn0b.js} +29 -29
  8. package/dist/{chunk-mzj1j0p5.js → chunk-0w13kxkr.js} +34 -31
  9. package/dist/{chunk-qgkx89eg.js → chunk-3j5wf2t5.js} +44 -43
  10. package/dist/{chunk-0y2fy5en.js → chunk-4361gxk0.js} +7 -7
  11. package/dist/{chunk-n3ywwx7n.js → chunk-52520csz.js} +15 -14
  12. package/dist/chunk-5dnfgyx8.js +159 -0
  13. package/dist/{chunk-tr3v83cn.js → chunk-5fa4arn1.js} +18 -11
  14. package/dist/{chunk-ngy1fdcx.js → chunk-631ffb6r.js} +10 -10
  15. package/dist/{chunk-01nfqm18.js → chunk-7anj08zc.js} +11 -9
  16. package/dist/{chunk-yq0sf8sb.js → chunk-7dr4kybf.js} +483 -451
  17. package/dist/chunk-7mhr5aex.js +171 -0
  18. package/dist/chunk-7rywbqzz.js +27 -0
  19. package/dist/{chunk-yf15kdte.js → chunk-9ct3xypr.js} +2636 -3864
  20. package/dist/chunk-9geh4c3v.js +1034 -0
  21. package/dist/{chunk-19brnwkp.js → chunk-9qf0eg7m.js} +19 -19
  22. package/dist/{chunk-y11p1q7r.js → chunk-aqqywy8g.js} +4 -4
  23. package/dist/chunk-bcvx11fn.js +174 -0
  24. package/dist/{chunk-z4smq8qd.js → chunk-cyfeaz43.js} +86 -86
  25. package/dist/chunk-czq37rrt.js +286 -0
  26. package/dist/chunk-ec5z8bbq.js +126 -0
  27. package/dist/{chunk-rt9tq4j6.js → chunk-h9yxx0hd.js} +7 -7
  28. package/dist/{chunk-t1dq2c2s.js → chunk-hma87efq.js} +40 -40
  29. package/dist/{chunk-5dny5jg1.js → chunk-hpv234hf.js} +11 -11
  30. package/dist/{chunk-rq5k7m33.js → chunk-k7xnsmp5.js} +182 -97
  31. package/dist/{chunk-91f5gm5z.js → chunk-kbpkpxcn.js} +22 -21
  32. package/dist/{chunk-6tra3gw8.js → chunk-kjn1knb9.js} +7 -7
  33. package/dist/{chunk-g4j5cfpc.js → chunk-p3s7cjfc.js} +17 -16
  34. package/dist/chunk-pq6hrtnb.js +49 -0
  35. package/dist/{chunk-mp2rqtcj.js → chunk-ptpy7nnm.js} +8 -8
  36. package/dist/{chunk-xqfj56m9.js → chunk-vn1rfxma.js} +8 -8
  37. package/dist/chunk-vyv8kvkv.js +113 -0
  38. package/dist/{chunk-0c60x3v8.js → chunk-xe2zgyz7.js} +35 -35
  39. package/dist/chunk-y4dwmhn2.js +14 -0
  40. package/dist/{chunk-098740f7.js → chunk-yypj3zn0.js} +8 -8
  41. package/dist/chunk-yzj1mfpr.js +1515 -0
  42. package/dist/client.d.ts +5 -1
  43. package/dist/client.js +62 -61
  44. package/dist/connectors/index.js +36 -37
  45. package/dist/contracts/artifact-markers.js +11 -12
  46. package/dist/contracts/artifacts.js +21 -23
  47. package/dist/contracts/automation-document/index.js +28 -30
  48. package/dist/contracts/pipeline-document/built-ins.d.ts +1 -1
  49. package/dist/contracts/pipeline-document/index.js +95 -97
  50. package/dist/contracts/step-artifact-submissions.js +20 -17
  51. package/dist/contracts/work-item-changes.js +8 -6
  52. package/dist/create-api-client.d.ts +11 -0
  53. package/dist/defaults/index.js +44 -884
  54. package/dist/defaults/load-push-defaults.d.ts +11 -4
  55. package/dist/defaults/project-ref.d.ts +2 -4
  56. package/dist/definitions/automations/automations-client.d.ts +2 -1
  57. package/dist/definitions/automations/index.js +6 -8
  58. package/dist/definitions/environments/environments-client.d.ts +2 -1
  59. package/dist/definitions/environments/index.js +37 -38
  60. package/dist/definitions/pipelines/index.js +12 -14
  61. package/dist/definitions/pipelines/pipeline-definitions-client.d.ts +2 -1
  62. package/dist/definitions/steps/define-mcp.d.ts +2 -2
  63. package/dist/definitions/steps/index.js +93 -95
  64. package/dist/definitions/steps/mcp-server-config.d.ts +13 -3
  65. package/dist/definitions/steps/step-definitions-client.d.ts +20 -1
  66. package/dist/definitions/validation/index.js +17 -18
  67. package/dist/devcontainer-config-path.js +9 -11
  68. package/dist/env-vars.js +37 -39
  69. package/dist/environment.js +41 -42
  70. package/dist/eslint.js +0 -2
  71. package/dist/generated/index.d.ts +2 -2
  72. package/dist/generated/sdk.gen.d.ts +41 -1
  73. package/dist/generated/types.gen.d.ts +1801 -0
  74. package/dist/git-url/git-repo-identity.js +0 -2
  75. package/dist/health-checks.js +15 -17
  76. package/dist/index.js +364 -358
  77. package/dist/jsonc.js +7 -8
  78. package/dist/managed-connections.d.ts +16 -0
  79. package/dist/managed-connections.js +9 -0
  80. package/dist/managed-runtimes.js +9 -11
  81. package/dist/opencode-mcp.d.ts +55 -1
  82. package/dist/opencode-mcp.js +33 -28
  83. package/dist/pipelines/index.js +78 -81
  84. package/dist/push/code-step-lookup.js +9 -10
  85. package/dist/push/index.d.ts +1 -0
  86. package/dist/push/index.js +109 -79
  87. package/dist/push/push-from-directory.d.ts +9 -1
  88. package/dist/push/pushed-mcp-servers.d.ts +28 -0
  89. package/dist/repo-config.js +41 -43
  90. package/dist/resolve-environment.js +14 -15
  91. package/dist/scarn-config-parser.js +5 -6
  92. package/dist/task-plane-client.d.ts +143 -1
  93. package/package.json +11 -3
  94. package/dist/chunk-46wmsgv7.js +0 -14
  95. package/dist/chunk-a56zc4s5.js +0 -119
  96. package/dist/chunk-aemxz9r7.js +0 -107
  97. package/dist/chunk-b9ja6ss5.js +0 -275
  98. package/dist/chunk-e0pt5x0e.js +0 -167
  99. package/dist/chunk-pqtd0hr7.js +0 -96
  100. package/dist/chunk-rphfy0fj.js +0 -167
  101. package/dist/chunk-y34zsgsw.js +0 -39
  102. package/dist/chunk-y64skrwp.js +0 -17
@@ -1,36 +1,36 @@
1
1
  // @bun
2
2
  import {
3
- exports_external
4
- } from "./chunk-yf15kdte.js";
3
+ _enum
4
+ } from "./chunk-9ct3xypr.js";
5
5
 
6
6
  // src/contracts/artifacts.ts
7
- var artifactKindSchema = exports_external.enum([
7
+ var artifactKindSchema2 = _enum([
8
8
  "generic",
9
9
  "playwright-trace",
10
10
  "video",
11
11
  "image"
12
12
  ]);
13
- var ARTIFACT_SCHEMA_KEYWORD = "x-scarn-artifact";
14
- var artifactPlatforms = ["github", "jira", "bitbucket"];
15
- var EMBEDDABLE_ARTIFACT_EXTENSIONS = {
13
+ var ARTIFACT_SCHEMA_KEYWORD2 = "x-scarn-artifact";
14
+ var artifactPlatforms2 = ["github", "jira", "bitbucket"];
15
+ var EMBEDDABLE_ARTIFACT_EXTENSIONS2 = {
16
16
  jira: [".png", ".gif", ".mp4", ".webm"],
17
17
  github: [],
18
18
  bitbucket: []
19
19
  };
20
- function isEmbeddableArtifactExtension(platform, extension) {
21
- return EMBEDDABLE_ARTIFACT_EXTENSIONS[platform].includes(extension.toLowerCase());
20
+ function isEmbeddableArtifactExtension2(platform, extension) {
21
+ return EMBEDDABLE_ARTIFACT_EXTENSIONS2[platform].includes(extension.toLowerCase());
22
22
  }
23
- function artifactFileExtension(fileName) {
23
+ function artifactFileExtension2(fileName) {
24
24
  const base = fileName.slice(fileName.lastIndexOf("/") + 1);
25
25
  const dot = base.lastIndexOf(".");
26
26
  if (dot <= 0)
27
27
  return "";
28
28
  return base.slice(dot).toLowerCase();
29
29
  }
30
- function artifactAcceptsFile(accept, fileName) {
30
+ function artifactAcceptsFile2(accept, fileName) {
31
31
  if (accept.length === 0)
32
32
  return true;
33
- return accept.includes(artifactFileExtension(fileName));
33
+ return accept.includes(artifactFileExtension2(fileName));
34
34
  }
35
35
  function asRecord(node) {
36
36
  return typeof node === "object" ? node : null;
@@ -44,9 +44,9 @@ function schemaBranches(record, keyword) {
44
44
  return [];
45
45
  return value.filter((entry) => typeof entry === "boolean" || typeof entry === "object" && entry !== null && !Array.isArray(entry));
46
46
  }
47
- function readArtifactKeyword(node) {
47
+ function readArtifactKeyword2(node) {
48
48
  const record = asRecord(node);
49
- const keyword = asRecord(record?.[ARTIFACT_SCHEMA_KEYWORD]);
49
+ const keyword = asRecord(record?.[ARTIFACT_SCHEMA_KEYWORD2]);
50
50
  if (!keyword)
51
51
  return null;
52
52
  const accept = keyword["accept"];
@@ -58,8 +58,8 @@ function readDescription(node) {
58
58
  const description = asRecord(node)?.["description"];
59
59
  return typeof description === "string" ? description : null;
60
60
  }
61
- function matchArtifactNode(node) {
62
- const direct = readArtifactKeyword(node);
61
+ function matchArtifactNode2(node) {
62
+ const direct = readArtifactKeyword2(node);
63
63
  if (direct) {
64
64
  const types = asRecord(node)?.["type"];
65
65
  return {
@@ -77,7 +77,7 @@ function matchArtifactNode(node) {
77
77
  const [only] = nonNull;
78
78
  if (!only || nonNull.length !== 1 || branches.length !== 2)
79
79
  continue;
80
- const inner = readArtifactKeyword(only);
80
+ const inner = readArtifactKeyword2(only);
81
81
  if (!inner)
82
82
  continue;
83
83
  return {
@@ -104,7 +104,7 @@ function resolveLocalRef(root, ref) {
104
104
  }
105
105
  return typeof current === "object" && current !== null ? current : null;
106
106
  }
107
- function findArtifactFields(schema) {
107
+ function findArtifactFields2(schema) {
108
108
  if (schema === null || schema === undefined)
109
109
  return [];
110
110
  const root = schema;
@@ -122,7 +122,7 @@ function findArtifactFields(schema) {
122
122
  visit(target, path, inArray, hops + 1);
123
123
  return;
124
124
  }
125
- const match = path ? matchArtifactNode(node) : null;
125
+ const match = path ? matchArtifactNode2(node) : null;
126
126
  if (match) {
127
127
  if (!fields.has(path)) {
128
128
  fields.set(path, {
@@ -159,4 +159,4 @@ function findArtifactFields(schema) {
159
159
  return [...fields.values()];
160
160
  }
161
161
 
162
- export { artifactKindSchema, ARTIFACT_SCHEMA_KEYWORD, artifactPlatforms, EMBEDDABLE_ARTIFACT_EXTENSIONS, isEmbeddableArtifactExtension, artifactFileExtension, artifactAcceptsFile, readArtifactKeyword, matchArtifactNode, findArtifactFields };
162
+ export { artifactKindSchema2, ARTIFACT_SCHEMA_KEYWORD2, artifactPlatforms2, EMBEDDABLE_ARTIFACT_EXTENSIONS2, isEmbeddableArtifactExtension2, artifactFileExtension2, artifactAcceptsFile2, readArtifactKeyword2, matchArtifactNode2, findArtifactFields2 };
@@ -45,15 +45,15 @@ function formatSite(site) {
45
45
  }
46
46
 
47
47
  // src/pipelines/errors.ts
48
- function formatIssue(issue) {
48
+ function formatIssue2(issue) {
49
49
  return `${formatSite(issue.site)} (${issue.pointer === "" ? "/" : issue.pointer}): ${issue.message}`;
50
50
  }
51
51
 
52
- class PipelineBuildError extends Error {
52
+ class PipelineBuildError2 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) => ` ${formatIssue(issue)}`).join(`
56
+ ${issues.map((issue) => ` ${formatIssue2(issue)}`).join(`
57
57
  `)}`);
58
58
  this.name = "PipelineBuildError";
59
59
  this.issues = issues;
@@ -156,4 +156,4 @@ function requireNode(value, what) {
156
156
  return node;
157
157
  }
158
158
 
159
- export { captureSite, formatIssue, PipelineBuildError, AuthoringError, registerAutomationTarget, automationTargetOf, markSubject, stepOn, pipelineOn, pendingChains, registerNode, registerTarget, registerEach, registerChain, nodeOf, targetOf, eachOf, chainOf, requireNode };
159
+ export { captureSite, formatIssue2, PipelineBuildError2, AuthoringError, registerAutomationTarget, automationTargetOf, markSubject, stepOn, pipelineOn, pendingChains, registerNode, registerTarget, registerEach, registerChain, nodeOf, targetOf, eachOf, chainOf, requireNode };
@@ -0,0 +1,174 @@
1
+ // @bun
2
+ import {
3
+ devcontainerConfigPathSchema2
4
+ } from "./chunk-yypj3zn0.js";
5
+ import {
6
+ envVarsSchema2,
7
+ storedEnvVarsSchema2
8
+ } from "./chunk-vyv8kvkv.js";
9
+ import {
10
+ managedRuntimeIdSchema2
11
+ } from "./chunk-y4dwmhn2.js";
12
+ import {
13
+ connectorIdsSchema2,
14
+ findMissingConnectorVars2
15
+ } from "./chunk-3j5wf2t5.js";
16
+ import {
17
+ string,
18
+ number,
19
+ array,
20
+ object,
21
+ strictObject,
22
+ union,
23
+ discriminatedUnion,
24
+ literal
25
+ } from "./chunk-9ct3xypr.js";
26
+
27
+ // src/environment.ts
28
+ var environmentNameSchema2 = string().regex(/^[a-z0-9][a-z0-9-]*$/, "must match /^[a-z0-9][a-z0-9-]*$/");
29
+ var environmentRuntimeSchema2 = discriminatedUnion("kind", [
30
+ strictObject({
31
+ kind: literal("devcontainer"),
32
+ config: devcontainerConfigPathSchema2.optional()
33
+ }),
34
+ strictObject({
35
+ kind: literal("managed"),
36
+ id: managedRuntimeIdSchema2
37
+ }),
38
+ strictObject({ kind: literal("host") })
39
+ ]);
40
+ var rejectEnvironmentBranch2 = (issue) => issue.code === "unrecognized_keys" && issue.keys.includes("branch") ? "environments have no branch; use the step's repo baseBranch" : undefined;
41
+ var environmentFieldsSchema2 = strictObject({
42
+ runtime: environmentRuntimeSchema2.optional(),
43
+ vars: envVarsSchema2.optional(),
44
+ connectors: connectorIdsSchema2.optional()
45
+ }, { error: rejectEnvironmentBranch2 });
46
+ var findHostSetupVar2 = ({
47
+ runtime,
48
+ vars
49
+ }) => runtime?.kind === "host" ? (vars ?? []).find((entry) => entry.applies !== "agent") : undefined;
50
+ var hostSetupVarMessage2 = (entry) => `env var "${entry.name}" applies to '${entry.applies}', but runtime 'host' has no container to set up; use 'agent'`;
51
+ var environmentContentSchema2 = environmentFieldsSchema2.extend({ description: string().optional() }).superRefine((value, context) => {
52
+ const setupVar = findHostSetupVar2(value);
53
+ if (setupVar !== undefined) {
54
+ context.addIssue({
55
+ code: "custom",
56
+ path: ["vars"],
57
+ message: hostSetupVarMessage2(setupVar)
58
+ });
59
+ }
60
+ for (const { connector, vars } of findMissingConnectorVars2(value.connectors ?? [], value.vars ?? [])) {
61
+ context.addIssue({
62
+ code: "custom",
63
+ path: ["connectors"],
64
+ message: `connector "${connector}" needs ${vars.join(", ")}; add them to the environment's vars`
65
+ });
66
+ }
67
+ });
68
+ function rejectHostSetupVars(vars, ctx, path) {
69
+ for (const entry of vars) {
70
+ if (entry.applies !== "agent") {
71
+ ctx.addIssue({
72
+ code: "custom",
73
+ path: [...path, entry.name, "applies"],
74
+ message: `env "${entry.name}": applies "${entry.applies}" needs a container to set up; host has none`
75
+ });
76
+ }
77
+ }
78
+ }
79
+ var namedEnvironmentRefSchema = strictObject({
80
+ kind: literal("named"),
81
+ name: environmentNameSchema2
82
+ });
83
+ var inlineEnvironmentRefSchema = strictObject({
84
+ kind: literal("inline"),
85
+ runtime: environmentRuntimeSchema2.optional(),
86
+ envJson: envVarsSchema2.nullish(),
87
+ connectors: connectorIdsSchema2.optional()
88
+ }, { error: rejectEnvironmentBranch2 });
89
+ function rejectHostSetupRef(ref, ctx) {
90
+ if (ref.kind === "inline" && ref.runtime?.kind === "host") {
91
+ rejectHostSetupVars(ref.envJson ?? [], ctx, ["envJson"]);
92
+ }
93
+ }
94
+ var environmentRefSchema2 = discriminatedUnion("kind", [
95
+ namedEnvironmentRefSchema,
96
+ inlineEnvironmentRefSchema
97
+ ]).superRefine(rejectHostSetupRef).nullable();
98
+ var inlineEnvironmentRefReadSchema = inlineEnvironmentRefSchema.extend({
99
+ envJson: storedEnvVarsSchema2.nullish()
100
+ });
101
+ var environmentRefReadSchema2 = discriminatedUnion("kind", [
102
+ namedEnvironmentRefSchema,
103
+ inlineEnvironmentRefReadSchema
104
+ ]).superRefine(rejectHostSetupRef).nullable();
105
+ var inlineEnvironmentReadSchema2 = inlineEnvironmentRefReadSchema.superRefine(rejectHostSetupRef).nullable();
106
+ var storedEnvironmentRuntimeSchema2 = discriminatedUnion("kind", [
107
+ object({
108
+ kind: literal("devcontainer"),
109
+ config: string().optional()
110
+ }),
111
+ object({ kind: literal("managed"), id: managedRuntimeIdSchema2 }),
112
+ object({ kind: literal("host") })
113
+ ]);
114
+ var storedEnvironmentFieldsSchema2 = object({
115
+ runtime: storedEnvironmentRuntimeSchema2.optional(),
116
+ vars: storedEnvVarsSchema2.optional(),
117
+ connectors: array(string()).optional()
118
+ });
119
+ var storedEnvironmentContentSchema2 = storedEnvironmentFieldsSchema2.extend({
120
+ description: string().optional()
121
+ });
122
+ var resolvedEnvironmentRefSchema2 = union([
123
+ strictObject({
124
+ kind: literal("inline"),
125
+ runtime: environmentRuntimeSchema2.optional(),
126
+ envJson: storedEnvVarsSchema2.nullish(),
127
+ connectors: array(string()).optional()
128
+ }),
129
+ strictObject({
130
+ kind: literal("named"),
131
+ name: environmentNameSchema2,
132
+ version: number().int().positive(),
133
+ content: storedEnvironmentContentSchema2
134
+ }),
135
+ strictObject({
136
+ kind: literal("named"),
137
+ name: environmentNameSchema2,
138
+ notFound: literal(true)
139
+ })
140
+ ]).nullable();
141
+
142
+ class EnvironmentNotFound2 extends Error {
143
+ environmentName;
144
+ kind = "EnvironmentNotFound";
145
+ code = "SCARN_ENVIRONMENT_NOT_FOUND";
146
+ constructor(environmentName) {
147
+ super(`Environment not found: ${environmentName}`);
148
+ this.environmentName = environmentName;
149
+ }
150
+ }
151
+
152
+ class EnvironmentInvalid2 extends Error {
153
+ environment;
154
+ issues;
155
+ kind = "EnvironmentInvalid";
156
+ code = "SCARN_ENVIRONMENT_INVALID";
157
+ constructor(environment, issues) {
158
+ super(`Invalid ${environment ?? "environment reference"}: ${issues.map((issue) => `${issue.path.join(".") || "<root>"}: ${issue.message}`).join("; ")}`);
159
+ this.environment = environment;
160
+ this.issues = issues;
161
+ }
162
+ }
163
+
164
+ class BrokenDevcontainerReference2 extends Error {
165
+ configPath;
166
+ kind = "BrokenDevcontainerReference";
167
+ code = "SCARN_DEVCONTAINER_REFERENCE_BROKEN";
168
+ constructor(configPath, discoveryPaths) {
169
+ super(discoveryPaths ? `Devcontainer auto-discovery found no config; checked: ${discoveryPaths.join(", ")}` : `Devcontainer config not found: ${configPath}`);
170
+ this.configPath = configPath;
171
+ }
172
+ }
173
+
174
+ export { environmentNameSchema2, environmentRuntimeSchema2, rejectEnvironmentBranch2, environmentFieldsSchema2, findHostSetupVar2, hostSetupVarMessage2, environmentContentSchema2, environmentRefSchema2, environmentRefReadSchema2, inlineEnvironmentReadSchema2, storedEnvironmentRuntimeSchema2, storedEnvironmentFieldsSchema2, storedEnvironmentContentSchema2, resolvedEnvironmentRefSchema2, EnvironmentNotFound2, EnvironmentInvalid2, BrokenDevcontainerReference2 };
@@ -1,59 +1,59 @@
1
1
  // @bun
2
2
  import {
3
- ComputedData,
3
+ captureSite,
4
+ PipelineBuildError2,
5
+ AuthoringError,
6
+ pipelineOn,
7
+ pendingChains,
8
+ registerNode,
9
+ registerTarget,
10
+ registerEach,
11
+ nodeOf,
12
+ targetOf,
13
+ eachOf,
14
+ chainOf,
15
+ requireNode
16
+ } from "./chunk-aqqywy8g.js";
17
+ import {
18
+ withOwners,
19
+ withTracker,
20
+ rootPlaceholder,
21
+ refData,
22
+ useRef,
23
+ unusedReads,
4
24
  ConditionData,
5
- argEntries,
6
- attempt,
7
- compileArg,
8
- compileCondition,
25
+ ComputedData,
9
26
  conditionData,
27
+ requireRef,
28
+ compileCondition,
29
+ compileArg,
30
+ argEntries,
31
+ newState,
10
32
  issue,
11
33
  mapSource,
12
- newState,
13
- place,
14
- refData,
15
- requireRef,
16
- rootPlaceholder,
17
- unusedReads,
18
- useRef,
19
- withOwners,
20
- withTracker
21
- } from "./chunk-mp2rqtcj.js";
22
- import {
23
- bareStepHandle,
24
- waitHandle
25
- } from "./chunk-xqfj56m9.js";
34
+ attempt,
35
+ place
36
+ } from "./chunk-ptpy7nnm.js";
26
37
  import {
27
- AuthoringError,
28
- PipelineBuildError,
29
- captureSite,
30
- chainOf,
31
- eachOf,
32
- nodeOf,
33
- pendingChains,
34
- pipelineOn,
35
- registerEach,
36
- registerNode,
37
- registerTarget,
38
- requireNode,
39
- targetOf
40
- } from "./chunk-y11p1q7r.js";
38
+ waitHandle,
39
+ bareStepHandle
40
+ } from "./chunk-vn1rfxma.js";
41
41
  import {
42
- CONVERSATION_RESULT_SCHEMA,
43
- ERROR_SCHEMA,
44
- REPLY_INPUT_SCHEMA,
45
- REPLY_RESULT_SCHEMA,
46
- decisionResultSchema
47
- } from "./chunk-01nfqm18.js";
42
+ decisionResultSchema2,
43
+ REPLY_RESULT_SCHEMA2,
44
+ CONVERSATION_RESULT_SCHEMA2,
45
+ REPLY_INPUT_SCHEMA2,
46
+ ERROR_SCHEMA2
47
+ } from "./chunk-7anj08zc.js";
48
48
  import {
49
49
  toJSONSchema
50
- } from "./chunk-yf15kdte.js";
50
+ } from "./chunk-9ct3xypr.js";
51
51
 
52
52
  // src/pipelines/context.ts
53
53
  function schemaOf(node, source) {
54
54
  if (node.kind === "step") {
55
55
  if (source === "result" && node.conversation) {
56
- return CONVERSATION_RESULT_SCHEMA;
56
+ return CONVERSATION_RESULT_SCHEMA2;
57
57
  }
58
58
  return (source === "result" ? node.resultSchema : node.inputSchema) ?? undefined;
59
59
  }
@@ -89,7 +89,7 @@ function makeContext(node, kind) {
89
89
  });
90
90
  } else {
91
91
  Object.defineProperties(context, {
92
- error: owned("error", ERROR_SCHEMA),
92
+ error: owned("error", ERROR_SCHEMA2),
93
93
  input: owned("input", schemaOf(node, "input"))
94
94
  });
95
95
  }
@@ -225,8 +225,8 @@ function wireBody(state, chain, json) {
225
225
  }
226
226
  const catches = chain.catch.map((entry, index) => {
227
227
  const pointer = ["nodes", id, "catch", index];
228
- const context2 = makeContext(chain.node, "catch");
229
- const target = compileTransition(state, entry.target, context2, pointer, entry.site, "catch");
228
+ const context = makeContext(chain.node, "catch");
229
+ const target = compileTransition(state, entry.target, context, pointer, entry.site, "catch");
230
230
  return { on: [...entry.on], ...target };
231
231
  });
232
232
  if (catches.length > 0) {
@@ -242,9 +242,9 @@ function wireBody(state, chain, json) {
242
242
  const entry = {};
243
243
  const { when, target, label, overridable } = route;
244
244
  if (when !== undefined) {
245
- const compiled2 = attempt(state, [...pointer, "when"], next.site, () => withOwners([context], () => compileCondition(conditionData(when(context)))));
246
- if (compiled2 !== undefined) {
247
- entry["when"] = compiled2;
245
+ const compiled = attempt(state, [...pointer, "when"], next.site, () => withOwners([context], () => compileCondition(conditionData(when(context)))));
246
+ if (compiled !== undefined) {
247
+ entry["when"] = compiled;
248
248
  }
249
249
  }
250
250
  const compiled = compileTransition(state, target, context, pointer, next.site, "next");
@@ -434,7 +434,7 @@ function compile(config, site) {
434
434
  const fields = workItemFields(state);
435
435
  const warnings = unusedChainWarnings(state);
436
436
  if (state.issues.length > 0 || start === undefined) {
437
- throw new PipelineBuildError(config.key, state.issues);
437
+ throw new PipelineBuildError2(config.key, state.issues);
438
438
  }
439
439
  const nodes = {};
440
440
  for (const [id, placed] of orderedNodes(state)) {
@@ -465,14 +465,14 @@ function compile(config, site) {
465
465
  });
466
466
  return definition;
467
467
  }
468
- function definePipeline(config) {
468
+ function definePipeline2(config) {
469
469
  return compile(config, captureSite());
470
470
  }
471
471
  // src/pipelines/nodes.ts
472
472
  function inputSchemaJson(input) {
473
473
  return input === undefined ? null : toJSONSchema(input);
474
474
  }
475
- function decision(id, options) {
475
+ function decision2(id, options) {
476
476
  const actions = Object.entries(options.actions).map(([key, action]) => ({
477
477
  key,
478
478
  label: action.label,
@@ -484,11 +484,11 @@ function decision(id, options) {
484
484
  for: "decision",
485
485
  actions,
486
486
  inputSchema: inputSchemaJson(options.input),
487
- resultSchema: decisionResultSchema(actions),
487
+ resultSchema: decisionResultSchema2(actions),
488
488
  site: captureSite()
489
489
  });
490
490
  }
491
- function reply(id) {
491
+ function reply2(id) {
492
492
  return waitHandle({
493
493
  kind: "wait",
494
494
  id,
@@ -496,10 +496,10 @@ function reply(id) {
496
496
  actions: null,
497
497
  inputSchema: {
498
498
  type: "object",
499
- properties: { questions: REPLY_INPUT_SCHEMA },
499
+ properties: { questions: REPLY_INPUT_SCHEMA2 },
500
500
  required: ["questions"]
501
501
  },
502
- resultSchema: REPLY_RESULT_SCHEMA,
502
+ resultSchema: REPLY_RESULT_SCHEMA2,
503
503
  site: captureSite()
504
504
  });
505
505
  }
@@ -513,7 +513,7 @@ function terminal(node) {
513
513
  site: node.site
514
514
  });
515
515
  }
516
- function succeed(id, options = {}) {
516
+ function succeed2(id, options = {}) {
517
517
  return terminal({
518
518
  kind: "succeed",
519
519
  id,
@@ -522,7 +522,7 @@ function succeed(id, options = {}) {
522
522
  site: captureSite()
523
523
  });
524
524
  }
525
- function fail(id, options = {}) {
525
+ function fail2(id, options = {}) {
526
526
  return terminal({
527
527
  kind: "fail",
528
528
  id,
@@ -533,10 +533,10 @@ function fail(id, options = {}) {
533
533
  site: captureSite()
534
534
  });
535
535
  }
536
- function stepRef(key) {
536
+ function stepRef2(key) {
537
537
  return bareStepHandle({ key, inputSchemaJson: null, resultSchemaJson: null, errors: [] }, false);
538
538
  }
539
- var workItem = {
539
+ var workItem2 = {
540
540
  get title() {
541
541
  return rootPlaceholder("workItem.title", {
542
542
  type: "string"
@@ -548,13 +548,13 @@ var workItem = {
548
548
  });
549
549
  }
550
550
  };
551
- function workItemField(alias, label) {
551
+ function workItemField2(alias, label) {
552
552
  return rootPlaceholder(`workItem.fields.${alias}`, undefined, {
553
553
  field: { alias, label }
554
554
  });
555
555
  }
556
556
  // src/pipelines/each.ts
557
- function each(over, second, third) {
557
+ function each2(over, second, third) {
558
558
  const data = refData(over);
559
559
  if (data === undefined) {
560
560
  throw new AuthoringError("each needs an array reference to iterate over");
@@ -602,55 +602,55 @@ function compare(op, left, value) {
602
602
  right: value === NO_RIGHT ? { kind: "none" } : right(value)
603
603
  }));
604
604
  }
605
- function equal(left, value) {
605
+ function equal2(left, value) {
606
606
  return compare("equal", left, value);
607
607
  }
608
- function notEqual(left, value) {
608
+ function notEqual2(left, value) {
609
609
  return compare("notEqual", left, value);
610
610
  }
611
- function lessThan(left, value) {
611
+ function lessThan2(left, value) {
612
612
  return compare("lessThan", left, value);
613
613
  }
614
- function lessThanInclusive(left, value) {
614
+ function lessThanInclusive2(left, value) {
615
615
  return compare("lessThanInclusive", left, value);
616
616
  }
617
- function greaterThan(left, value) {
617
+ function greaterThan2(left, value) {
618
618
  return compare("greaterThan", left, value);
619
619
  }
620
- function greaterThanInclusive(left, value) {
620
+ function greaterThanInclusive2(left, value) {
621
621
  return compare("greaterThanInclusive", left, value);
622
622
  }
623
- function exists(left) {
623
+ function exists2(left) {
624
624
  return compare("exists", left, NO_RIGHT);
625
625
  }
626
- function isEmpty(left) {
626
+ function isEmpty2(left) {
627
627
  return compare("isEmpty", left, NO_RIGHT);
628
628
  }
629
- function contains(left, value) {
629
+ function contains2(left, value) {
630
630
  return compare("contains", left, value);
631
631
  }
632
- function startsWith(left, value) {
632
+ function startsWith2(left, value) {
633
633
  return compare("startsWith", left, value);
634
634
  }
635
- function endsWith(left, value) {
635
+ function endsWith2(left, value) {
636
636
  return compare("endsWith", left, value);
637
637
  }
638
- function matches(left, pattern) {
638
+ function matches2(left, pattern) {
639
639
  return compare("matches", left, pattern);
640
640
  }
641
- function before(left, date) {
641
+ function before2(left, date) {
642
642
  return compare("before", left, date);
643
643
  }
644
- function after(left, date) {
644
+ function after2(left, date) {
645
645
  return compare("after", left, date);
646
646
  }
647
- function all(...conditions) {
647
+ function all2(...conditions) {
648
648
  return toCondition(new ConditionData({ kind: "all", items: conditions.map(conditionData) }));
649
649
  }
650
- function any(...conditions) {
650
+ function any2(...conditions) {
651
651
  return toCondition(new ConditionData({ kind: "any", items: conditions.map(conditionData) }));
652
652
  }
653
- function not(condition) {
653
+ function not2(condition) {
654
654
  return toCondition(new ConditionData({ kind: "not", item: conditionData(condition) }));
655
655
  }
656
656
  function element(list) {
@@ -670,13 +670,13 @@ function list(op, over, where) {
670
670
  where: conditionData(where(item))
671
671
  }));
672
672
  }
673
- function some(over, where) {
673
+ function some2(over, where) {
674
674
  return list("some", over, where);
675
675
  }
676
- function every(over, where) {
676
+ function every2(over, where) {
677
677
  return list("every", over, where);
678
678
  }
679
- function none(over, where) {
679
+ function none2(over, where) {
680
680
  return list("none", over, where);
681
681
  }
682
682
  function reduce(fn, source, field, weights) {
@@ -694,19 +694,19 @@ function reduce(fn, source, field, weights) {
694
694
  field: requireRef(select(field, element(data)), `the field of "${fn}"`)
695
695
  }));
696
696
  }
697
- function sum(source, field) {
697
+ function sum2(source, field) {
698
698
  return reduce("sum", source, field);
699
699
  }
700
- function avg(source, second) {
700
+ function avg2(source, second) {
701
701
  return typeof second === "function" ? reduce("avg", source, second) : reduce("avg", source, undefined, second?.weights);
702
702
  }
703
- function min(source, field) {
703
+ function min2(source, field) {
704
704
  return reduce("min", source, field);
705
705
  }
706
- function max(source, field) {
706
+ function max2(source, field) {
707
707
  return reduce("max", source, field);
708
708
  }
709
- function count(source, where) {
709
+ function count2(source, where) {
710
710
  if (Array.isArray(source)) {
711
711
  const refs = source.map((value) => requireRef(value, 'each value of "count"'));
712
712
  return toComputed(new ComputedData({ fn: "count", refs }));
@@ -718,4 +718,4 @@ function count(source, where) {
718
718
  where: conditionData(select(where, element(data)))
719
719
  }));
720
720
  }
721
- export { definePipeline, decision, reply, succeed, fail, stepRef, workItem, workItemField, each, equal, notEqual, lessThan, lessThanInclusive, greaterThan, greaterThanInclusive, exists, isEmpty, contains, startsWith, endsWith, matches, before, after, all, any, not, some, every, none, sum, avg, min, max, count };
721
+ export { definePipeline2, decision2, reply2, succeed2, fail2, stepRef2, workItem2, workItemField2, each2, equal2, notEqual2, lessThan2, lessThanInclusive2, greaterThan2, greaterThanInclusive2, exists2, isEmpty2, contains2, startsWith2, endsWith2, matches2, before2, after2, all2, any2, not2, some2, every2, none2, sum2, avg2, min2, max2, count2 };