@scarn/sdk 0.0.0-stage → 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/dist/chunk-4361gxk0.js +166 -0
  2. package/dist/chunk-4vehh3dq.js +333 -0
  3. package/dist/chunk-56e4kp0a.js +162 -0
  4. package/dist/chunk-5mmj03ah.js +1074 -0
  5. package/dist/chunk-631ffb6r.js +57 -0
  6. package/dist/chunk-91p9vzcs.js +1453 -0
  7. package/dist/chunk-9s07v9r1.js +30 -0
  8. package/dist/chunk-b21233rt.js +78 -0
  9. package/dist/chunk-dnn39qt4.js +13539 -0
  10. package/dist/chunk-eg1hcvhb.js +300 -0
  11. package/dist/chunk-g0rdnn0r.js +95 -0
  12. package/dist/chunk-h9yxx0hd.js +116 -0
  13. package/dist/chunk-njd6npf0.js +35 -0
  14. package/dist/chunk-ny07ncb9.js +330 -0
  15. package/dist/chunk-p6kc9wq8.js +97 -0
  16. package/dist/chunk-qpw5wt1p.js +257 -0
  17. package/dist/chunk-rq3q8vg7.js +1094 -0
  18. package/dist/chunk-s0gap8r8.js +14 -0
  19. package/dist/chunk-tfm5hjzm.js +100 -0
  20. package/dist/chunk-ynk2bjae.js +1686 -0
  21. package/dist/chunk-zpqyjgb4.js +49 -0
  22. package/dist/client.d.ts +4 -0
  23. package/dist/client.js +57 -0
  24. package/dist/contracts/artifact-markers.d.ts +42 -0
  25. package/dist/contracts/artifact-markers.js +15 -0
  26. package/dist/contracts/artifacts.d.ts +67 -0
  27. package/dist/contracts/artifacts.js +25 -0
  28. package/dist/contracts/pipeline-document/built-ins.d.ts +23 -0
  29. package/dist/contracts/pipeline-document/conditions/operators.d.ts +8 -0
  30. package/dist/contracts/pipeline-document/index.d.ts +11 -0
  31. package/dist/contracts/pipeline-document/index.js +97 -0
  32. package/dist/contracts/pipeline-document/json.d.ts +35 -0
  33. package/dist/contracts/pipeline-document/routes.d.ts +16 -0
  34. package/dist/contracts/pipeline-document/schema.d.ts +780 -0
  35. package/dist/contracts/pipeline-document/step-contract.d.ts +11 -0
  36. package/dist/contracts/step-artifact-submissions.d.ts +71 -0
  37. package/dist/contracts/step-artifact-submissions.js +174 -0
  38. package/dist/defaults/atomic-json-file.d.ts +10 -0
  39. package/dist/defaults/auth-file.d.ts +14 -0
  40. package/dist/defaults/base-url.d.ts +1 -0
  41. package/dist/defaults/config-file.d.ts +46 -0
  42. package/dist/defaults/home-dir.d.ts +3 -0
  43. package/dist/defaults/index.d.ts +12 -0
  44. package/dist/defaults/index.js +1239 -0
  45. package/dist/defaults/legacy-config-migration.d.ts +27 -0
  46. package/dist/defaults/load-push-defaults.d.ts +25 -0
  47. package/dist/defaults/project-config.d.ts +32 -0
  48. package/dist/defaults/project-ref.d.ts +34 -0
  49. package/dist/definitions/artifacts/artifact.d.ts +62 -0
  50. package/dist/definitions/artifacts/index.d.ts +1 -0
  51. package/dist/definitions/pipelines/define-default-pipeline-assignment.d.ts +263 -0
  52. package/dist/definitions/pipelines/index.d.ts +3 -0
  53. package/dist/definitions/pipelines/index.js +24 -0
  54. package/dist/definitions/pipelines/pipeline-definitions-client.d.ts +208 -0
  55. package/dist/definitions/pipelines/work-item-fields.d.ts +93 -0
  56. package/dist/definitions/steps/compile-mcps.d.ts +34 -0
  57. package/dist/definitions/steps/define-code-step.d.ts +84 -0
  58. package/dist/definitions/steps/define-mcp.d.ts +79 -0
  59. package/dist/definitions/steps/define-step.d.ts +137 -0
  60. package/dist/definitions/steps/env.d.ts +136 -0
  61. package/dist/definitions/steps/index.d.ts +14 -0
  62. package/dist/definitions/steps/index.js +73 -0
  63. package/dist/definitions/steps/mcp-server-config.d.ts +102 -0
  64. package/dist/definitions/steps/prompt-template.d.ts +24 -0
  65. package/dist/definitions/steps/repo.d.ts +67 -0
  66. package/dist/definitions/steps/runtime.d.ts +115 -0
  67. package/dist/definitions/steps/step-definitions-client.d.ts +400 -0
  68. package/dist/definitions/steps/step-features.d.ts +109 -0
  69. package/dist/definitions/steps/step-handle.d.ts +25 -0
  70. package/dist/definitions/steps/step-ref.d.ts +19 -0
  71. package/dist/definitions/validation/index.d.ts +2 -0
  72. package/dist/definitions/validation/index.js +17 -0
  73. package/dist/definitions/validation/validate-artifact-markers.d.ts +3 -0
  74. package/dist/definitions/validation/validate-artifacts.d.ts +7 -0
  75. package/dist/definitions/validation/validate-definition-specs.d.ts +16 -0
  76. package/dist/definitions/validation/validate-env.d.ts +15 -0
  77. package/dist/definitions/validation/validate-repo.d.ts +13 -0
  78. package/dist/definitions/validation/validate-runtime.d.ts +12 -0
  79. package/dist/definitions/validation/validation-issue.d.ts +11 -0
  80. package/dist/devcontainer-config-path.d.ts +21 -0
  81. package/dist/devcontainer-config-path.js +13 -0
  82. package/dist/env-vars.d.ts +136 -0
  83. package/dist/env-vars.js +35 -0
  84. package/dist/eslint.d.ts +42 -0
  85. package/dist/eslint.js +125 -0
  86. package/dist/generated/client/client.gen.d.ts +2 -0
  87. package/dist/generated/client/index.d.ts +8 -0
  88. package/dist/generated/client/types.gen.d.ts +117 -0
  89. package/dist/generated/client/utils.gen.d.ts +33 -0
  90. package/dist/generated/client.gen.d.ts +12 -0
  91. package/dist/generated/core/auth.gen.d.ts +18 -0
  92. package/dist/generated/core/bodySerializer.gen.d.ts +25 -0
  93. package/dist/generated/core/params.gen.d.ts +43 -0
  94. package/dist/generated/core/pathSerializer.gen.d.ts +33 -0
  95. package/dist/generated/core/queryKeySerializer.gen.d.ts +18 -0
  96. package/dist/generated/core/serverSentEvents.gen.d.ts +71 -0
  97. package/dist/generated/core/types.gen.d.ts +78 -0
  98. package/dist/generated/core/utils.gen.d.ts +19 -0
  99. package/dist/generated/index.d.ts +2 -0
  100. package/dist/generated/sdk.gen.d.ts +302 -0
  101. package/dist/generated/types.gen.d.ts +18368 -0
  102. package/dist/git-url/git-remote.d.ts +30 -0
  103. package/dist/git-url/git-repo-identity.d.ts +44 -0
  104. package/dist/git-url/git-repo-identity.js +159 -0
  105. package/dist/git-url/parse-git-host.d.ts +23 -0
  106. package/dist/health-checks.d.ts +169 -0
  107. package/dist/health-checks.js +19 -0
  108. package/dist/index.d.ts +11 -0
  109. package/dist/index.js +293 -0
  110. package/dist/jsonc.d.ts +3 -0
  111. package/dist/jsonc.js +11 -0
  112. package/dist/managed-runtimes.d.ts +20 -0
  113. package/dist/managed-runtimes.js +13 -0
  114. package/dist/opencode-mcp.d.ts +313 -0
  115. package/dist/opencode-mcp.js +29 -0
  116. package/dist/pipelines/chain.d.ts +7 -0
  117. package/dist/pipelines/compile-args.d.ts +12 -0
  118. package/dist/pipelines/compile-chain.d.ts +9 -0
  119. package/dist/pipelines/compile-checks.d.ts +16 -0
  120. package/dist/pipelines/compile-state.d.ts +30 -0
  121. package/dist/pipelines/condition-data.d.ts +78 -0
  122. package/dist/pipelines/conditions.d.ts +47 -0
  123. package/dist/pipelines/context.d.ts +16 -0
  124. package/dist/pipelines/define-pipeline.d.ts +32 -0
  125. package/dist/pipelines/each.d.ts +5 -0
  126. package/dist/pipelines/errors.d.ts +26 -0
  127. package/dist/pipelines/handles.d.ts +29 -0
  128. package/dist/pipelines/index.d.ts +18 -0
  129. package/dist/pipelines/index.js +80 -0
  130. package/dist/pipelines/model.d.ts +103 -0
  131. package/dist/pipelines/nodes.d.ts +54 -0
  132. package/dist/pipelines/ref-types.d.ts +54 -0
  133. package/dist/pipelines/refs.d.ts +80 -0
  134. package/dist/pipelines/registry.d.ts +12 -0
  135. package/dist/pipelines/source.d.ts +17 -0
  136. package/dist/pipelines/types.d.ts +160 -0
  137. package/dist/push/code-step-lookup.d.ts +32 -0
  138. package/dist/push/code-step-lookup.js +11 -0
  139. package/dist/push/collect-definitions.d.ts +70 -0
  140. package/dist/push/collect-pipeline-documents.d.ts +14 -0
  141. package/dist/push/index.d.ts +6 -0
  142. package/dist/push/index.js +328 -0
  143. package/dist/push/push-from-directory.d.ts +37 -0
  144. package/dist/repo-config.d.ts +80 -0
  145. package/dist/repo-config.js +23 -0
  146. package/dist/scarn-config-parser.d.ts +29 -0
  147. package/dist/scarn-config-parser.js +9 -0
  148. package/dist/task-plane-client.d.ts +489 -0
  149. package/dist/z.d.ts +7 -0
  150. package/package.json +132 -4
  151. package/README.md +0 -3
@@ -0,0 +1,49 @@
1
+ // @bun
2
+ import {
3
+ string,
4
+ number,
5
+ int,
6
+ unknown,
7
+ array,
8
+ object,
9
+ discriminatedUnion,
10
+ record,
11
+ _enum,
12
+ literal,
13
+ preprocess
14
+ } from "./chunk-dnn39qt4.js";
15
+
16
+ // src/health-checks.ts
17
+ var healthCheckSeverityValues2 = ["required", "warn"];
18
+ var healthCheckBaseSchema = object({
19
+ name: string().trim().min(1).optional(),
20
+ severity: _enum(healthCheckSeverityValues2).default("required"),
21
+ timeoutSeconds: number().gt(0).max(3600).default(15),
22
+ serialGroup: string().trim().min(1).optional()
23
+ });
24
+ var toolHealthCheckSchema2 = healthCheckBaseSchema.extend({
25
+ kind: literal("tool").default("tool"),
26
+ tool: string().trim().min(1),
27
+ mcp: string().trim().min(1).optional(),
28
+ args: record(string(), unknown()).optional()
29
+ }).strict();
30
+ var cliHealthCheckSchema2 = healthCheckBaseSchema.extend({
31
+ kind: literal("cli"),
32
+ command: array(string().min(1)).min(1),
33
+ expectExitCode: int().default(0)
34
+ }).strict();
35
+ function injectDefaultKind(value) {
36
+ if (typeof value === "object" && value !== null && !("kind" in value)) {
37
+ return { ...value, kind: "tool" };
38
+ }
39
+ return value;
40
+ }
41
+ var healthCheckSchema2 = preprocess(injectDefaultKind, discriminatedUnion("kind", [toolHealthCheckSchema2, cliHealthCheckSchema2]));
42
+ var healthChecksSchema2 = array(healthCheckSchema2);
43
+ var stepToolHealthCheckSchema2 = toolHealthCheckSchema2.omit({ mcp: true }).strict();
44
+ var stepHealthChecksInputSchema2 = array(preprocess(injectDefaultKind, discriminatedUnion("kind", [
45
+ stepToolHealthCheckSchema2,
46
+ cliHealthCheckSchema2
47
+ ])));
48
+
49
+ export { healthCheckSeverityValues2, toolHealthCheckSchema2, cliHealthCheckSchema2, healthCheckSchema2, healthChecksSchema2, stepToolHealthCheckSchema2, stepHealthChecksInputSchema2 };
@@ -0,0 +1,4 @@
1
+ import { ScarnClient } from "./generated";
2
+ export * from "./task-plane-client";
3
+ export * from "./generated/";
4
+ export declare function createScarnClient(baseUrl: string): ScarnClient;
package/dist/client.js ADDED
@@ -0,0 +1,57 @@
1
+ // @bun
2
+ import {
3
+ createTaskPlaneClient2,
4
+ createScarnClient2
5
+ } from "./chunk-tfm5hjzm.js";
6
+ import {
7
+ Api2,
8
+ Projects2,
9
+ StepDefinitions2,
10
+ Tasks2,
11
+ TaskRuns2,
12
+ PipelineDefinitions2,
13
+ PipelineExecutions2,
14
+ WorkItems2,
15
+ Conversations2,
16
+ WorkItemComments2,
17
+ WorkItemCommentDrafts2,
18
+ WorkItemBlocks2,
19
+ ProjectArtifacts2,
20
+ UserNotifications2,
21
+ NotificationRules2,
22
+ StepDefinitionTemplates2,
23
+ ProjectIntegrations2,
24
+ GitHubIntegrations2,
25
+ ProjectInvites2,
26
+ Billing2,
27
+ Username2,
28
+ Secrets2,
29
+ ScarnClient2
30
+ } from "./chunk-ynk2bjae.js";
31
+ export {
32
+ Api2 as Api,
33
+ Billing2 as Billing,
34
+ Conversations2 as Conversations,
35
+ GitHubIntegrations2 as GitHubIntegrations,
36
+ NotificationRules2 as NotificationRules,
37
+ PipelineDefinitions2 as PipelineDefinitions,
38
+ PipelineExecutions2 as PipelineExecutions,
39
+ ProjectArtifacts2 as ProjectArtifacts,
40
+ ProjectIntegrations2 as ProjectIntegrations,
41
+ ProjectInvites2 as ProjectInvites,
42
+ Projects2 as Projects,
43
+ ScarnClient2 as ScarnClient,
44
+ Secrets2 as Secrets,
45
+ StepDefinitionTemplates2 as StepDefinitionTemplates,
46
+ StepDefinitions2 as StepDefinitions,
47
+ TaskRuns2 as TaskRuns,
48
+ Tasks2 as Tasks,
49
+ UserNotifications2 as UserNotifications,
50
+ Username2 as Username,
51
+ WorkItemBlocks2 as WorkItemBlocks,
52
+ WorkItemCommentDrafts2 as WorkItemCommentDrafts,
53
+ WorkItemComments2 as WorkItemComments,
54
+ WorkItems2 as WorkItems,
55
+ createScarnClient2 as createScarnClient,
56
+ createTaskPlaneClient2 as createTaskPlaneClient
57
+ };
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The artifact marker wire format, shared by the SDK (`Artifact.embed` /
3
+ * `Artifact.link` and definition validation) and core (draft resolution and
4
+ * rendering):
5
+ *
6
+ * - `![caption](artifact:signal/<stepKey>/<signalKey>)` / `[label](...)`
7
+ * point at a declared artifact signal and are required.
8
+ * - `![caption](artifact:<name-or-glob>)` / `[label](...)` point at any file
9
+ * under `artifactsDir` and are optional.
10
+ *
11
+ * Text inside `[...]` escapes `\`, `[` and `]` with a backslash. A ref with
12
+ * whitespace or `<`/`>` is wrapped in `<...>`; otherwise `\`, `(` and `)` are
13
+ * backslash-escaped.
14
+ */
15
+ export declare const ARTIFACT_MARKER_SCHEME = "artifact:";
16
+ export type ArtifactMarkerKind = "embed" | "link";
17
+ export type ArtifactMarkerRef = {
18
+ readonly type: "signal";
19
+ readonly stepKey: string;
20
+ readonly signalKey: string;
21
+ } | {
22
+ readonly type: "path";
23
+ readonly pattern: string;
24
+ };
25
+ /** A marker found in a piece of text. `start`/`end` are string offsets. */
26
+ export type ArtifactMarkerMatch = {
27
+ readonly kind: ArtifactMarkerKind;
28
+ /** The caption (embed) or label (link), unescaped. */
29
+ readonly text: string;
30
+ /** Everything after `artifact:`, unescaped. */
31
+ readonly rawRef: string;
32
+ readonly ref: ArtifactMarkerRef;
33
+ readonly start: number;
34
+ readonly end: number;
35
+ };
36
+ /** Splits the part after `artifact:` into a signal or path ref. */
37
+ export declare function parseArtifactMarkerRef(rawRef: string): ArtifactMarkerRef;
38
+ export declare function formatArtifactMarkerRef(ref: ArtifactMarkerRef): string;
39
+ /** Builds a marker string. `text` is the caption (embed) or label (link). */
40
+ export declare function buildArtifactMarker(kind: ArtifactMarkerKind, ref: ArtifactMarkerRef, text: string): string;
41
+ /** Every artifact marker in `text`, in order. Other links are ignored. */
42
+ export declare function findArtifactMarkers(text: string): ArtifactMarkerMatch[];
@@ -0,0 +1,15 @@
1
+ // @bun
2
+ import {
3
+ ARTIFACT_MARKER_SCHEME2,
4
+ parseArtifactMarkerRef2,
5
+ formatArtifactMarkerRef2,
6
+ buildArtifactMarker2,
7
+ findArtifactMarkers2
8
+ } from "../chunk-631ffb6r.js";
9
+ export {
10
+ ARTIFACT_MARKER_SCHEME2 as ARTIFACT_MARKER_SCHEME,
11
+ buildArtifactMarker2 as buildArtifactMarker,
12
+ findArtifactMarkers2 as findArtifactMarkers,
13
+ formatArtifactMarkerRef2 as formatArtifactMarkerRef,
14
+ parseArtifactMarkerRef2 as parseArtifactMarkerRef
15
+ };
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Artifact contract shared by the SDK, the opencode plugin, the worker and
3
+ * core. Everything here works on JSON Schema only (the `x-scarn-artifact`
4
+ * keyword), never on Zod schemas, so the server can use it without knowing
5
+ * how a step was authored.
6
+ */
7
+ import { z } from "zod";
8
+ export declare const artifactKindSchema: z.ZodEnum<{
9
+ generic: "generic";
10
+ "playwright-trace": "playwright-trace";
11
+ video: "video";
12
+ image: "image";
13
+ }>;
14
+ export type ArtifactKind = z.infer<typeof artifactKindSchema>;
15
+ export declare const ARTIFACT_SCHEMA_KEYWORD = "x-scarn-artifact";
16
+ export type ArtifactSchemaKeyword = {
17
+ readonly accept: readonly string[];
18
+ };
19
+ /** A JSON Schema node. `true` / `false` are the boolean schema forms. */
20
+ export type ArtifactJsonSchemaNode = boolean | {
21
+ readonly [key: string]: unknown;
22
+ };
23
+ /** A declared artifact field in a step's result schema. */
24
+ export type ArtifactField = {
25
+ /**
26
+ * Dot path of the field. Array items appear as `[]`, e.g. `shots[]` or
27
+ * `runs[].video`.
28
+ */
29
+ readonly path: string;
30
+ /** Lower-case extensions with a leading dot. Empty accepts any file. */
31
+ readonly accept: readonly string[];
32
+ readonly nullable: boolean;
33
+ readonly description: string | null;
34
+ /** True when the field sits inside an array, which v1 does not support. */
35
+ readonly inArray: boolean;
36
+ };
37
+ export declare const artifactPlatforms: readonly ["github", "jira", "bitbucket"];
38
+ export type ArtifactPlatform = (typeof artifactPlatforms)[number];
39
+ /**
40
+ * Extensions each platform can show inline in a comment. Anything else is
41
+ * linked to its Scarn artifact page. GitHub and Bitbucket link everything
42
+ * in v1.
43
+ */
44
+ export declare const EMBEDDABLE_ARTIFACT_EXTENSIONS: Readonly<Record<ArtifactPlatform, readonly string[]>>;
45
+ export declare function isEmbeddableArtifactExtension(platform: ArtifactPlatform, extension: string): boolean;
46
+ /** The lower-cased extension of a file name, with its dot; `""` when none. */
47
+ export declare function artifactFileExtension(fileName: string): string;
48
+ /** Whether a file name matches an `accept` list. An empty list accepts any file. */
49
+ export declare function artifactAcceptsFile(accept: readonly string[], fileName: string): boolean;
50
+ /** Reads the `x-scarn-artifact` keyword on this exact node. */
51
+ export declare function readArtifactKeyword(node: ArtifactJsonSchemaNode): ArtifactSchemaKeyword | null;
52
+ export type ArtifactNodeMatch = ArtifactSchemaKeyword & {
53
+ readonly nullable: boolean;
54
+ readonly description: string | null;
55
+ };
56
+ /**
57
+ * Matches a node that is an artifact field, either directly or as
58
+ * `anyOf: [<artifact>, { type: "null" }]` (Zod's `.nullable()`).
59
+ */
60
+ export declare function matchArtifactNode(node: ArtifactJsonSchemaNode): ArtifactNodeMatch | null;
61
+ /**
62
+ * Every artifact field declared in a result schema: walks object
63
+ * properties, `anyOf` / `oneOf` / `allOf` branches, local `$ref`s and array
64
+ * items. Fields inside arrays are returned with `inArray: true`; v1 rejects
65
+ * them at definition time.
66
+ */
67
+ export declare function findArtifactFields(schema: ArtifactJsonSchemaNode | null | undefined): ArtifactField[];
@@ -0,0 +1,25 @@
1
+ // @bun
2
+ import {
3
+ artifactKindSchema2,
4
+ ARTIFACT_SCHEMA_KEYWORD2,
5
+ artifactPlatforms2,
6
+ EMBEDDABLE_ARTIFACT_EXTENSIONS2,
7
+ isEmbeddableArtifactExtension2,
8
+ artifactFileExtension2,
9
+ artifactAcceptsFile2,
10
+ readArtifactKeyword2,
11
+ matchArtifactNode2,
12
+ findArtifactFields2
13
+ } from "../chunk-56e4kp0a.js";
14
+ export {
15
+ ARTIFACT_SCHEMA_KEYWORD2 as ARTIFACT_SCHEMA_KEYWORD,
16
+ EMBEDDABLE_ARTIFACT_EXTENSIONS2 as EMBEDDABLE_ARTIFACT_EXTENSIONS,
17
+ artifactAcceptsFile2 as artifactAcceptsFile,
18
+ artifactFileExtension2 as artifactFileExtension,
19
+ artifactKindSchema2 as artifactKindSchema,
20
+ artifactPlatforms2 as artifactPlatforms,
21
+ findArtifactFields2 as findArtifactFields,
22
+ isEmbeddableArtifactExtension2 as isEmbeddableArtifactExtension,
23
+ matchArtifactNode2 as matchArtifactNode,
24
+ readArtifactKeyword2 as readArtifactKeyword
25
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Built-in error names and the schemas of built-in values: wait results,
3
+ * the input a `reply` wait takes, and caught errors.
4
+ */
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"];
7
+ /** The errors a wait node can raise, so the only names its `catch` may use. */
8
+ export declare const WAIT_ERRORS: readonly ["Scarn.All", "Scarn.MaxRunsExceeded", "Scarn.ArgsError"];
9
+ /**
10
+ * The result of a `wait` node with `for: decision`: the chosen action's key
11
+ * and the person's text. With no actions (an invalid node) `action` is any
12
+ * string, so only the missing actions are reported.
13
+ */
14
+ export declare function decisionResultSchema(actions: readonly {
15
+ key: string;
16
+ }[]): JsonSchema;
17
+ /** The result of a `wait` node with `for: reply`; `replied: false` is "continue without reply". */
18
+ export declare const REPLY_RESULT_SCHEMA: JsonSchema;
19
+ /** The result of a conversation step (a step with no result schema): the conversation and the agent's last message. */
20
+ export declare const CONVERSATION_RESULT_SCHEMA: JsonSchema;
21
+ /** What every transition into a `reply` wait must pass. */
22
+ export declare const REPLY_INPUT_SCHEMA: JsonSchema;
23
+ export declare const ERROR_SCHEMA: JsonSchema;
@@ -0,0 +1,8 @@
1
+ /** Condition operator and computed-function names, shared by schema, evaluator and validator. */
2
+ export declare const COMPARISON_OPERATORS: readonly ["equal", "notEqual", "lessThan", "lessThanInclusive", "greaterThan", "greaterThanInclusive"];
3
+ export declare const CONDITION_OPERATORS: readonly ["equal", "notEqual", "lessThan", "lessThanInclusive", "greaterThan", "greaterThanInclusive", "exists", "isEmpty", "contains", "startsWith", "endsWith", "matches", "before", "after", "some", "every", "none"];
4
+ export declare const COMPUTED_FUNCTIONS: readonly ["sum", "avg", "min", "max", "count"];
5
+ export declare const ORDERING_OPERATORS: Set<string>;
6
+ export declare const STRING_OPERATORS: Set<string>;
7
+ export declare const DATE_OPERATORS: Set<string>;
8
+ export declare const LIST_OPERATORS: Set<string>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The pipeline document contract: what a pipeline JSON document is. Logic
3
+ * that works on documents (validation, evaluation) lives in
4
+ * `@scarn/shared-core/pipelines`.
5
+ */
6
+ export * from "./json";
7
+ export * from "./schema";
8
+ export * from "./routes";
9
+ export * from "./conditions/operators";
10
+ export * from "./step-contract";
11
+ export * from "./built-ins";
@@ -0,0 +1,97 @@
1
+ // @bun
2
+ import {
3
+ isJsonObject2,
4
+ jsonPointer2,
5
+ deepEqual2,
6
+ COMPARISON_OPERATORS2,
7
+ CONDITION_OPERATORS2,
8
+ COMPUTED_FUNCTIONS2,
9
+ ORDERING_OPERATORS2,
10
+ STRING_OPERATORS2,
11
+ DATE_OPERATORS2,
12
+ LIST_OPERATORS2,
13
+ NODE_ID_PATTERN2,
14
+ ALIAS_PATTERN2,
15
+ literalSchema2,
16
+ listSchema2,
17
+ argValueSchema2,
18
+ computedSourceSchema2,
19
+ conditionSchema2,
20
+ toleratedFailuresSchema2,
21
+ eachSchema2,
22
+ routeSchema2,
23
+ otherwiseSchema2,
24
+ startSchema2,
25
+ MATCH_MODES2,
26
+ nextSchema2,
27
+ retrySchema2,
28
+ catchSchema2,
29
+ stepNodeSchema2,
30
+ DEFAULT_MAX_TURNS2,
31
+ DECISION_BODY_MODES2,
32
+ decisionActionSchema2,
33
+ waitNodeSchema2,
34
+ succeedNodeSchema2,
35
+ failNodeSchema2,
36
+ nodeSchema2,
37
+ pipelineDocumentSchema2,
38
+ pipelineDocumentJsonSchema2,
39
+ routeEntries2,
40
+ routeAt2
41
+ } from "../../chunk-4vehh3dq.js";
42
+ import {
43
+ BUILT_IN_ERRORS2,
44
+ WAIT_ERRORS2,
45
+ decisionResultSchema2,
46
+ REPLY_RESULT_SCHEMA2,
47
+ CONVERSATION_RESULT_SCHEMA2,
48
+ REPLY_INPUT_SCHEMA2,
49
+ ERROR_SCHEMA2
50
+ } from "../../chunk-5mmj03ah.js";
51
+ export {
52
+ ALIAS_PATTERN2 as ALIAS_PATTERN,
53
+ BUILT_IN_ERRORS2 as BUILT_IN_ERRORS,
54
+ COMPARISON_OPERATORS2 as COMPARISON_OPERATORS,
55
+ COMPUTED_FUNCTIONS2 as COMPUTED_FUNCTIONS,
56
+ CONDITION_OPERATORS2 as CONDITION_OPERATORS,
57
+ CONVERSATION_RESULT_SCHEMA2 as CONVERSATION_RESULT_SCHEMA,
58
+ DATE_OPERATORS2 as DATE_OPERATORS,
59
+ DECISION_BODY_MODES2 as DECISION_BODY_MODES,
60
+ DEFAULT_MAX_TURNS2 as DEFAULT_MAX_TURNS,
61
+ ERROR_SCHEMA2 as ERROR_SCHEMA,
62
+ LIST_OPERATORS2 as LIST_OPERATORS,
63
+ MATCH_MODES2 as MATCH_MODES,
64
+ NODE_ID_PATTERN2 as NODE_ID_PATTERN,
65
+ ORDERING_OPERATORS2 as ORDERING_OPERATORS,
66
+ REPLY_INPUT_SCHEMA2 as REPLY_INPUT_SCHEMA,
67
+ REPLY_RESULT_SCHEMA2 as REPLY_RESULT_SCHEMA,
68
+ STRING_OPERATORS2 as STRING_OPERATORS,
69
+ WAIT_ERRORS2 as WAIT_ERRORS,
70
+ argValueSchema2 as argValueSchema,
71
+ catchSchema2 as catchSchema,
72
+ computedSourceSchema2 as computedSourceSchema,
73
+ conditionSchema2 as conditionSchema,
74
+ decisionActionSchema2 as decisionActionSchema,
75
+ decisionResultSchema2 as decisionResultSchema,
76
+ deepEqual2 as deepEqual,
77
+ eachSchema2 as eachSchema,
78
+ failNodeSchema2 as failNodeSchema,
79
+ isJsonObject2 as isJsonObject,
80
+ jsonPointer2 as jsonPointer,
81
+ listSchema2 as listSchema,
82
+ literalSchema2 as literalSchema,
83
+ nextSchema2 as nextSchema,
84
+ nodeSchema2 as nodeSchema,
85
+ otherwiseSchema2 as otherwiseSchema,
86
+ pipelineDocumentJsonSchema2 as pipelineDocumentJsonSchema,
87
+ pipelineDocumentSchema2 as pipelineDocumentSchema,
88
+ retrySchema2 as retrySchema,
89
+ routeAt2 as routeAt,
90
+ routeEntries2 as routeEntries,
91
+ routeSchema2 as routeSchema,
92
+ startSchema2 as startSchema,
93
+ stepNodeSchema2 as stepNodeSchema,
94
+ succeedNodeSchema2 as succeedNodeSchema,
95
+ toleratedFailuresSchema2 as toleratedFailuresSchema,
96
+ waitNodeSchema2 as waitNodeSchema
97
+ };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * JSON value and JSON Schema types shared across the package, plus small
3
+ * helpers for JSON pointers and structural equality.
4
+ */
5
+ export type JsonValue = null | boolean | number | string | JsonValue[] | {
6
+ [key: string]: JsonValue;
7
+ };
8
+ export type JsonObject = {
9
+ [key: string]: JsonValue;
10
+ };
11
+ export interface JsonSchemaObject {
12
+ type?: string | string[];
13
+ properties?: Record<string, JsonSchema>;
14
+ required?: string[];
15
+ additionalProperties?: JsonSchema;
16
+ items?: JsonSchema;
17
+ prefixItems?: JsonSchema[];
18
+ anyOf?: JsonSchema[];
19
+ oneOf?: JsonSchema[];
20
+ allOf?: JsonSchema[];
21
+ enum?: JsonValue[];
22
+ const?: JsonValue;
23
+ $ref?: string;
24
+ $defs?: Record<string, JsonSchema>;
25
+ definitions?: Record<string, JsonSchema>;
26
+ title?: string;
27
+ description?: string;
28
+ format?: string;
29
+ [key: string]: unknown;
30
+ }
31
+ export type JsonSchema = boolean | JsonSchemaObject;
32
+ export declare function isJsonObject(value: JsonValue | undefined): value is JsonObject;
33
+ /** Builds an RFC 6901 JSON pointer such as `/nodes/fix/next/routes/1/args/plan`. */
34
+ export declare function jsonPointer(segments: readonly (string | number)[]): string;
35
+ export declare function deepEqual(left: JsonValue | undefined, right: JsonValue | undefined): boolean;
@@ -0,0 +1,16 @@
1
+ /** Reading the routes of a node's `next` object. */
2
+ import type { Next, Otherwise, Route } from "./schema";
3
+ export type RouteKind = "route" | "otherwise";
4
+ /** One entry of a `next` object: a route, or the `otherwise` route. */
5
+ export interface RouteEntry {
6
+ kind: RouteKind;
7
+ /** The route's index in `routes`, or 0 for `otherwise`. */
8
+ index: number;
9
+ route: Route | Otherwise;
10
+ /** Where the entry sits inside the `next` object. */
11
+ pointer: ["routes", number] | ["otherwise"];
12
+ }
13
+ /** Every route of `next` in order, with `otherwise` last. */
14
+ export declare function routeEntries(next: Next | undefined): RouteEntry[];
15
+ /** The route a `kind` and `index` name, if `next` has it. */
16
+ export declare function routeAt(next: Next | undefined, kind: RouteKind, index: number): Route | Otherwise | undefined;