@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,159 @@
1
+ // @bun
2
+ import {
3
+ MAX_ENV_VARS2,
4
+ inheritEnvVarSchema2
5
+ } from "./chunk-vyv8kvkv.js";
6
+ import {
7
+ managedConnectionNameSchema2,
8
+ normalizeMcpResourceUrl2
9
+ } from "./chunk-7rywbqzz.js";
10
+ import {
11
+ string,
12
+ int,
13
+ boolean,
14
+ array,
15
+ object,
16
+ strictObject,
17
+ union,
18
+ discriminatedUnion,
19
+ record,
20
+ _enum,
21
+ literal
22
+ } from "./chunk-9ct3xypr.js";
23
+
24
+ // src/opencode-mcp.ts
25
+ var mcpConnectionAuthSchema2 = strictObject({
26
+ connection: managedConnectionNameSchema2
27
+ });
28
+ var workerVarsSchema = array(inheritEnvVarSchema2.safeExtend({ applies: literal("agent") })).max(MAX_ENV_VARS2).refine((entries) => new Set(entries.map((entry) => entry.name)).size === entries.length, { message: "MCP worker variable names must be unique" });
29
+ var nonEmptyStringSchema = string().trim().min(1);
30
+ var mcpStringMapSchema = record(string(), string());
31
+ var positiveIntSchema = int().gt(0).max(Number.MAX_SAFE_INTEGER);
32
+ var openCodeMcpTimeoutSchema2 = object({
33
+ startup: positiveIntSchema.optional(),
34
+ catalog: positiveIntSchema.optional(),
35
+ execution: positiveIntSchema.optional()
36
+ }).strict();
37
+ var openCodeMcpProtocolSchema2 = _enum([
38
+ "legacy",
39
+ "auto",
40
+ "2026-07-28"
41
+ ]);
42
+ var sharedServerFields = {
43
+ disabled: boolean().optional(),
44
+ codemode: boolean().optional(),
45
+ timeout: openCodeMcpTimeoutSchema2.optional(),
46
+ protocol: openCodeMcpProtocolSchema2.optional()
47
+ };
48
+ var openCodeMcpLocalConfigSchema2 = object({
49
+ type: literal("local"),
50
+ command: array(nonEmptyStringSchema).min(1),
51
+ cwd: string().optional(),
52
+ environment: mcpStringMapSchema.optional(),
53
+ ...sharedServerFields
54
+ }).strict();
55
+ var openCodeMcpOAuthConfigSchema2 = object({
56
+ client_id: string().optional(),
57
+ client_secret: string().optional(),
58
+ scope: string().optional(),
59
+ callback_port: positiveIntSchema.optional(),
60
+ redirect_uri: string().optional(),
61
+ auth_server_metadata_url: string().optional()
62
+ }).strict();
63
+ var openCodeMcpRemoteConfigSchema2 = object({
64
+ type: literal("remote"),
65
+ url: string(),
66
+ headers: mcpStringMapSchema.optional(),
67
+ oauth: union([openCodeMcpOAuthConfigSchema2, literal(false)]).optional(),
68
+ ...sharedServerFields
69
+ }).strict();
70
+ var openCodeMcpRefConfigSchema2 = object({
71
+ type: literal("ref"),
72
+ name: nonEmptyStringSchema.optional(),
73
+ workerVars: workerVarsSchema.optional(),
74
+ auth: mcpConnectionAuthSchema2.optional(),
75
+ ...sharedServerFields
76
+ }).strict();
77
+ var openCodeResolvedMcpServerConfigSchema2 = discriminatedUnion("type", [openCodeMcpLocalConfigSchema2, openCodeMcpRemoteConfigSchema2]);
78
+ var openCodeResolvedMcpServersSchema2 = record(string(), openCodeResolvedMcpServerConfigSchema2);
79
+ function remoteConnectionAuthIssues2(entry) {
80
+ if (entry.auth === undefined)
81
+ return [];
82
+ const { connection } = entry.auth;
83
+ const issues = [];
84
+ if (normalizeMcpResourceUrl2(entry.url) === null) {
85
+ issues.push({
86
+ path: "url",
87
+ message: `must be an absolute http(s) URL with no query string, fragment or credentials when auth is set; the ${connection} connection authenticates the server`
88
+ });
89
+ }
90
+ for (const field of ["headers", "oauth", "workerVars"]) {
91
+ if (entry[field] === undefined)
92
+ continue;
93
+ issues.push({
94
+ path: field,
95
+ message: `must be absent when auth is set; the ${connection} connection authenticates the server`
96
+ });
97
+ }
98
+ return issues;
99
+ }
100
+ function refConnectionAuthIssues2(entry) {
101
+ if (entry.auth === undefined || entry.workerVars === undefined)
102
+ return [];
103
+ return [
104
+ {
105
+ path: "workerVars",
106
+ message: `must be absent when auth is set; the ${entry.auth.connection} connection authenticates the server`
107
+ }
108
+ ];
109
+ }
110
+ var addIssues = (issues, ctx) => {
111
+ for (const issue of issues) {
112
+ ctx.addIssue({
113
+ code: "custom",
114
+ path: [issue.path],
115
+ message: issue.message
116
+ });
117
+ }
118
+ };
119
+ var openCodeMcpServerConfigSchema2 = discriminatedUnion("type", [
120
+ openCodeMcpLocalConfigSchema2.extend({
121
+ workerVars: workerVarsSchema.optional()
122
+ }),
123
+ openCodeMcpRemoteConfigSchema2.extend({
124
+ workerVars: workerVarsSchema.optional(),
125
+ auth: mcpConnectionAuthSchema2.optional()
126
+ }).superRefine((entry, ctx) => {
127
+ addIssues(remoteConnectionAuthIssues2(entry), ctx);
128
+ }),
129
+ openCodeMcpRefConfigSchema2.superRefine((entry, ctx) => {
130
+ addIssues(refConnectionAuthIssues2(entry), ctx);
131
+ })
132
+ ]);
133
+ var openCodeMcpServersSchema2 = record(string(), openCodeMcpServerConfigSchema2);
134
+ var ENV_PLACEHOLDER_PATTERN = /\{env:[A-Za-z_][A-Za-z0-9_]*\}/gu;
135
+ var ENV_PLACEHOLDER_NAME_PATTERN = /\{env:([^}]+)\}/gu;
136
+ var AUTH_SCHEME_PATTERN = /^(?:bearer|basic|token)\s+/iu;
137
+ function isEnvPlaceholderValue2(value) {
138
+ if (value.match(ENV_PLACEHOLDER_PATTERN) === null)
139
+ return false;
140
+ return value.trim().replace(AUTH_SCHEME_PATTERN, "").replace(ENV_PLACEHOLDER_PATTERN, "").trim() === "";
141
+ }
142
+ function collectEnvPlaceholderNames2(value) {
143
+ const names = new Set;
144
+ const visit = (item) => {
145
+ if (typeof item === "string") {
146
+ for (const match of item.matchAll(ENV_PLACEHOLDER_NAME_PATTERN)) {
147
+ if (match[1] !== undefined)
148
+ names.add(match[1]);
149
+ }
150
+ } else if (typeof item === "object" && item !== null) {
151
+ for (const child of Object.values(item))
152
+ visit(child);
153
+ }
154
+ };
155
+ visit(value);
156
+ return [...names].sort();
157
+ }
158
+
159
+ export { mcpConnectionAuthSchema2, openCodeMcpTimeoutSchema2, openCodeMcpProtocolSchema2, openCodeMcpLocalConfigSchema2, openCodeMcpOAuthConfigSchema2, openCodeMcpRemoteConfigSchema2, openCodeMcpRefConfigSchema2, openCodeResolvedMcpServerConfigSchema2, openCodeResolvedMcpServersSchema2, remoteConnectionAuthIssues2, refConnectionAuthIssues2, openCodeMcpServerConfigSchema2, openCodeMcpServersSchema2, isEnvPlaceholderValue2, collectEnvPlaceholderNames2 };
@@ -1,16 +1,16 @@
1
1
  // @bun
2
2
  import {
3
- ScarnClient,
4
- TaskRuns,
3
+ TaskRuns2,
4
+ ScarnClient2,
5
5
  createApiClient
6
- } from "./chunk-y81cr6tp.js";
6
+ } from "./chunk-k7xnsmp5.js";
7
7
  // src/task-plane-client.ts
8
8
  function unwrap(result) {
9
9
  if (result.error)
10
10
  throw new Error(JSON.stringify(result.error));
11
11
  return result.data;
12
12
  }
13
- function createTaskPlaneClient(baseUrl, options) {
13
+ function createTaskPlaneClient2(baseUrl, options) {
14
14
  const client = createApiClient(baseUrl, {
15
15
  headers: options?.headers,
16
16
  fetch: options?.fetch
@@ -31,7 +31,7 @@ function createTaskPlaneClient(baseUrl, options) {
31
31
  return response;
32
32
  });
33
33
  }
34
- return buildTaskPlaneClient(new TaskRuns({ client }));
34
+ return buildTaskPlaneClient(new TaskRuns2({ client }));
35
35
  }
36
36
  var buildTaskPlaneClient = (taskRuns) => {
37
37
  return {
@@ -58,6 +58,10 @@ var buildTaskPlaneClient = (taskRuns) => {
58
58
  taskRunId,
59
59
  ...body
60
60
  }) => unwrap(await taskRuns.resolveTaskRunEnvironment({ path: { taskRunId }, body })),
61
+ registerTaskRunManagedLaunch: ({
62
+ taskRunId,
63
+ ...body
64
+ }) => taskRuns.registerTaskRunManagedLaunch({ path: { taskRunId }, body }),
61
65
  readTaskRunWorkItem: async ({
62
66
  taskRunId,
63
67
  ...body
@@ -133,9 +137,9 @@ var buildTaskPlaneClient = (taskRuns) => {
133
137
  };
134
138
 
135
139
  // src/client.ts
136
- function createScarnClient(baseUrl, options) {
140
+ function createScarnClient2(baseUrl, options) {
137
141
  const client = createApiClient(baseUrl, { fetch: options?.fetch });
138
- return new ScarnClient({ client });
142
+ return new ScarnClient2({ client });
139
143
  }
140
144
 
141
- export { createTaskPlaneClient, createScarnClient };
145
+ export { createTaskPlaneClient2, createScarnClient2 };
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  // src/contracts/artifact-markers.ts
3
- var ARTIFACT_MARKER_SCHEME = "artifact:";
3
+ var ARTIFACT_MARKER_SCHEME2 = "artifact:";
4
4
  var SIGNAL_REF_PREFIX = "signal/";
5
5
  var MARKER_PATTERN = /(!?)\[((?:\\.|[^\\\]\n])*)\]\((?:<artifact:((?:\\.|[^\\<>\n])*)>|artifact:((?:\\.|[^\\()\s])*))\)/g;
6
6
  var unescapeMarkerText = (value) => value.replace(/\\(.)/g, "$1");
@@ -10,11 +10,11 @@ var formatMarkerDestination = (rawRef) => {
10
10
  if (/[\n\r]/.test(rawRef)) {
11
11
  throw new Error("Artifact marker refs cannot contain line breaks.");
12
12
  }
13
- return `<${ARTIFACT_MARKER_SCHEME}${rawRef.replace(/[\\<>]/g, "\\$&")}>`;
13
+ return `<${ARTIFACT_MARKER_SCHEME2}${rawRef.replace(/[\\<>]/g, "\\$&")}>`;
14
14
  }
15
- return `${ARTIFACT_MARKER_SCHEME}${rawRef.replace(/[\\()]/g, "\\$&")}`;
15
+ return `${ARTIFACT_MARKER_SCHEME2}${rawRef.replace(/[\\()]/g, "\\$&")}`;
16
16
  };
17
- function parseArtifactMarkerRef(rawRef) {
17
+ function parseArtifactMarkerRef2(rawRef) {
18
18
  if (!rawRef.startsWith(SIGNAL_REF_PREFIX)) {
19
19
  return { type: "path", pattern: rawRef };
20
20
  }
@@ -26,18 +26,18 @@ function parseArtifactMarkerRef(rawRef) {
26
26
  signalKey: rest.slice(slash + 1)
27
27
  };
28
28
  }
29
- function formatArtifactMarkerRef(ref) {
29
+ function formatArtifactMarkerRef2(ref) {
30
30
  return ref.type === "signal" ? `${SIGNAL_REF_PREFIX}${ref.stepKey}/${ref.signalKey}` : ref.pattern;
31
31
  }
32
- function buildArtifactMarker(kind, ref, text) {
33
- const rawRef = formatArtifactMarkerRef(ref);
32
+ function buildArtifactMarker2(kind, ref, text) {
33
+ const rawRef = formatArtifactMarkerRef2(ref);
34
34
  if (rawRef.length === 0) {
35
35
  throw new Error("Artifact marker refs cannot be empty.");
36
36
  }
37
37
  const bang = kind === "embed" ? "!" : "";
38
38
  return `${bang}[${escapeMarkerText(text)}](${formatMarkerDestination(rawRef)})`;
39
39
  }
40
- function findArtifactMarkers(text) {
40
+ function findArtifactMarkers2(text) {
41
41
  const matches = [];
42
42
  for (const match of text.matchAll(MARKER_PATTERN)) {
43
43
  const [whole, bang, label, bracketedRef, bareRef] = match;
@@ -46,7 +46,7 @@ function findArtifactMarkers(text) {
46
46
  kind: bang === "!" ? "embed" : "link",
47
47
  text: unescapeMarkerText(label ?? ""),
48
48
  rawRef,
49
- ref: parseArtifactMarkerRef(rawRef),
49
+ ref: parseArtifactMarkerRef2(rawRef),
50
50
  start: match.index,
51
51
  end: match.index + whole.length
52
52
  });
@@ -54,4 +54,4 @@ function findArtifactMarkers(text) {
54
54
  return matches;
55
55
  }
56
56
 
57
- export { ARTIFACT_MARKER_SCHEME, parseArtifactMarkerRef, formatArtifactMarkerRef, buildArtifactMarker, findArtifactMarkers };
57
+ export { ARTIFACT_MARKER_SCHEME2, parseArtifactMarkerRef2, formatArtifactMarkerRef2, buildArtifactMarker2, findArtifactMarkers2 };
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  // src/contracts/pipeline-document/built-ins.ts
3
- var BUILT_IN_ERRORS = [
3
+ var BUILT_IN_ERRORS2 = [
4
4
  "Scarn.All",
5
5
  "Scarn.StepFailed",
6
6
  "Scarn.HealthCheckFailed",
@@ -13,14 +13,16 @@ var BUILT_IN_ERRORS = [
13
13
  "Scarn.ArgsError",
14
14
  "Scarn.LogArchiveFailed",
15
15
  "Scarn.WorkItemChangesInvalid",
16
- "Scarn.WorkItemNotNative"
16
+ "Scarn.WorkItemNotNative",
17
+ "ManagedConnectionAuthorityLost",
18
+ "ManagedConnectionNotReady"
17
19
  ];
18
- var WAIT_ERRORS = [
20
+ var WAIT_ERRORS2 = [
19
21
  "Scarn.All",
20
22
  "Scarn.MaxRunsExceeded",
21
23
  "Scarn.ArgsError"
22
24
  ];
23
- function decisionResultSchema(actions) {
25
+ function decisionResultSchema2(actions) {
24
26
  const keys = [...new Set(actions.map((action) => action.key))];
25
27
  return {
26
28
  title: "DecisionResult",
@@ -33,7 +35,7 @@ function decisionResultSchema(actions) {
33
35
  additionalProperties: false
34
36
  };
35
37
  }
36
- var REPLY_RESULT_SCHEMA = {
38
+ var REPLY_RESULT_SCHEMA2 = {
37
39
  title: "ReplyResult",
38
40
  type: "object",
39
41
  properties: {
@@ -44,7 +46,7 @@ var REPLY_RESULT_SCHEMA = {
44
46
  required: ["replied", "body", "commentId"],
45
47
  additionalProperties: false
46
48
  };
47
- var CONVERSATION_RESULT_SCHEMA = {
49
+ var CONVERSATION_RESULT_SCHEMA2 = {
48
50
  title: "ConversationResult",
49
51
  type: "object",
50
52
  properties: {
@@ -54,11 +56,11 @@ var CONVERSATION_RESULT_SCHEMA = {
54
56
  required: ["conversationId", "summary"],
55
57
  additionalProperties: false
56
58
  };
57
- var REPLY_INPUT_SCHEMA = {
59
+ var REPLY_INPUT_SCHEMA2 = {
58
60
  type: "array",
59
61
  items: { type: "string" }
60
62
  };
61
- var ERROR_SCHEMA = {
63
+ var ERROR_SCHEMA2 = {
62
64
  title: "Error",
63
65
  type: "object",
64
66
  properties: {
@@ -69,4 +71,4 @@ var ERROR_SCHEMA = {
69
71
  required: ["name", "message"]
70
72
  };
71
73
 
72
- export { BUILT_IN_ERRORS, WAIT_ERRORS, decisionResultSchema, REPLY_RESULT_SCHEMA, CONVERSATION_RESULT_SCHEMA, REPLY_INPUT_SCHEMA, ERROR_SCHEMA };
74
+ export { BUILT_IN_ERRORS2, WAIT_ERRORS2, decisionResultSchema2, REPLY_RESULT_SCHEMA2, CONVERSATION_RESULT_SCHEMA2, REPLY_INPUT_SCHEMA2, ERROR_SCHEMA2 };