@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,300 @@
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 formatIssue2(issue) {
49
+ return `${formatSite(issue.site)} (${issue.pointer === "" ? "/" : issue.pointer}): ${issue.message}`;
50
+ }
51
+
52
+ class PipelineBuildError2 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) => ` ${formatIssue2(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/pipelines/model.ts
73
+ function emptyChain(node) {
74
+ return {
75
+ node,
76
+ settings: {},
77
+ retry: [],
78
+ catch: [],
79
+ next: undefined,
80
+ site: captureSite()
81
+ };
82
+ }
83
+
84
+ // src/pipelines/registry.ts
85
+ var nodes = new WeakMap;
86
+ var targets = new WeakMap;
87
+ var eaches = new WeakMap;
88
+ var chains = new WeakMap;
89
+ var pendingChains = new Set;
90
+ function registerNode(value, node) {
91
+ nodes.set(value, node);
92
+ return value;
93
+ }
94
+ function registerTarget(value, target) {
95
+ targets.set(value, target);
96
+ return value;
97
+ }
98
+ function registerEach(value, each) {
99
+ eaches.set(value, each);
100
+ return value;
101
+ }
102
+ function registerChain(value, chain) {
103
+ chains.set(value, chain);
104
+ if (chain.next !== undefined) {
105
+ pendingChains.add(chain);
106
+ }
107
+ return value;
108
+ }
109
+ function isObject(value) {
110
+ return (typeof value === "object" || typeof value === "function") && value !== null;
111
+ }
112
+ function nodeOf(value) {
113
+ return isObject(value) ? nodes.get(value) : undefined;
114
+ }
115
+ function targetOf(value) {
116
+ return isObject(value) ? targets.get(value) : undefined;
117
+ }
118
+ function eachOf(value) {
119
+ return isObject(value) ? eaches.get(value) : undefined;
120
+ }
121
+ function chainOf(value) {
122
+ return isObject(value) ? chains.get(value) : undefined;
123
+ }
124
+ function requireNode(value, what) {
125
+ const node = nodeOf(value);
126
+ if (node === undefined) {
127
+ throw new AuthoringError(`${what} must be a step, decision or reply handle`);
128
+ }
129
+ return node;
130
+ }
131
+
132
+ // src/pipelines/chain.ts
133
+ function next(data, change) {
134
+ return chainValue({ ...data, ...change, site: captureSite() });
135
+ }
136
+ function assertOpen(data, method) {
137
+ if (data.next !== undefined) {
138
+ throw new AuthoringError(`.${method}() can't follow .next(): the chain for "${data.node.id}" is already finished`);
139
+ }
140
+ }
141
+ function isTargetSpec(value) {
142
+ return typeof value === "function" || nodeOf(value) !== undefined || targetOf(value) !== undefined || eachOf(value) !== undefined || chainOf(value) !== undefined;
143
+ }
144
+ function nextData(id, arg) {
145
+ const site = captureSite();
146
+ if (isTargetSpec(arg) || !("routes" in arg)) {
147
+ return {
148
+ match: undefined,
149
+ routes: [{ when: undefined, target: arg }],
150
+ otherwise: undefined,
151
+ site
152
+ };
153
+ }
154
+ const options = arg;
155
+ if (options.match !== undefined && options.match !== "first" && options.match !== "all") {
156
+ throw new AuthoringError(`.next() for "${id}": match "${options.match}" isn't supported; use "first" or "all"`);
157
+ }
158
+ if (options.routes === undefined || options.routes.length === 0) {
159
+ throw new AuthoringError(`.next() for "${id}" needs at least one route in "routes"`);
160
+ }
161
+ const routes = options.routes.map((route, index) => {
162
+ if (route.to === undefined) {
163
+ throw new AuthoringError(`.next() for "${id}": route ${String(index)} has no "to"`);
164
+ }
165
+ return { when: route.when, target: route.to };
166
+ });
167
+ return {
168
+ match: options.match === "all" ? "all" : undefined,
169
+ routes,
170
+ otherwise: options.otherwise,
171
+ site
172
+ };
173
+ }
174
+ function chainMethods(data) {
175
+ return {
176
+ settings: (settings) => {
177
+ const current = data();
178
+ assertOpen(current, "settings");
179
+ return next(current, { settings: { ...settings } });
180
+ },
181
+ retry: (options) => {
182
+ const current = data();
183
+ assertOpen(current, "retry");
184
+ if (current.node.kind !== "step") {
185
+ throw new AuthoringError(`"${current.node.id}" is a wait and can't retry`);
186
+ }
187
+ return next(current, {
188
+ retry: [
189
+ ...current.retry,
190
+ { on: [...options.on], maxAttempts: options.maxAttempts }
191
+ ]
192
+ });
193
+ },
194
+ catch: (on, target) => {
195
+ const current = data();
196
+ assertOpen(current, "catch");
197
+ return next(current, {
198
+ catch: [...current.catch, { on: [...on], target, site: captureSite() }]
199
+ });
200
+ },
201
+ next: (arg) => {
202
+ const current = data();
203
+ assertOpen(current, "next");
204
+ return next(current, { next: nextData(current.node.id, arg) });
205
+ }
206
+ };
207
+ }
208
+ function chainValue(data) {
209
+ return registerChain(Object.freeze({
210
+ _tag: "pipeline_chain",
211
+ node: data.node.id,
212
+ ...chainMethods(() => data)
213
+ }), data);
214
+ }
215
+ var HANDLE_METHODS = ["settings", "retry", "catch", "next"];
216
+ function attachChainMethods(handle, node) {
217
+ const methods = chainMethods(() => emptyChain(node));
218
+ for (const name of HANDLE_METHODS) {
219
+ if (node.kind !== "step" && name === "retry") {
220
+ continue;
221
+ }
222
+ Object.defineProperty(handle, name, {
223
+ value: methods[name],
224
+ enumerable: false,
225
+ configurable: true
226
+ });
227
+ }
228
+ }
229
+
230
+ // src/pipelines/handles.ts
231
+ function checkArgs(node, args) {
232
+ if (args !== undefined && (typeof args !== "object" || args === null)) {
233
+ throw new AuthoringError(`args for "${node.id}" must be an object`);
234
+ }
235
+ }
236
+ function targetFn(node) {
237
+ return (args) => {
238
+ checkArgs(node, args);
239
+ return registerTarget(Object.freeze({ _tag: "pipeline_target", to: node.id }), { node, args, site: captureSite() });
240
+ };
241
+ }
242
+ function partialFn(node) {
243
+ return (args) => {
244
+ checkArgs(node, args);
245
+ return registerTarget(Object.freeze({ _tag: "pipeline_partial", to: node.id }), { node, args, site: captureSite(), partial: true });
246
+ };
247
+ }
248
+ function makeHandle(handle, node) {
249
+ attachChainMethods(handle, node);
250
+ registerNode(handle, node);
251
+ Object.defineProperty(handle, "partial", {
252
+ value: partialFn(node),
253
+ enumerable: false,
254
+ configurable: true
255
+ });
256
+ if (node.kind === "step") {
257
+ Object.defineProperty(handle, "as", {
258
+ value: (id) => stepHandleFor({ ...node, id, site: captureSite() }),
259
+ enumerable: false,
260
+ configurable: true
261
+ });
262
+ }
263
+ return handle;
264
+ }
265
+ function stepHandleFor(node) {
266
+ const handle = targetFn(node);
267
+ if (node.kind === "step") {
268
+ Object.defineProperties(handle, {
269
+ key: { value: node.step, enumerable: true },
270
+ inputSchemaJson: { value: node.inputSchema, enumerable: true },
271
+ resultSchemaJson: { value: node.resultSchema, enumerable: true },
272
+ errors: { value: node.errors, enumerable: true }
273
+ });
274
+ }
275
+ return makeHandle(handle, node);
276
+ }
277
+ function stepNode(source, local = true) {
278
+ return {
279
+ kind: "step",
280
+ id: source.key,
281
+ step: source.key,
282
+ local,
283
+ inputSchema: source.inputSchemaJson ?? null,
284
+ resultSchema: source.resultSchemaJson ?? null,
285
+ conversation: local && source.kind !== "code" && source.resultSchemaJson === null,
286
+ errors: [...source.errors ?? []],
287
+ site: captureSite()
288
+ };
289
+ }
290
+ function stepCall(node) {
291
+ return targetFn(node);
292
+ }
293
+ function waitHandle(node) {
294
+ return makeHandle(targetFn(node), node);
295
+ }
296
+ function bareStepHandle(source, local) {
297
+ return stepHandleFor(stepNode(source, local));
298
+ }
299
+
300
+ export { captureSite, formatIssue2, PipelineBuildError2, AuthoringError, pendingChains, registerNode, registerTarget, registerEach, nodeOf, targetOf, eachOf, chainOf, requireNode, makeHandle, stepNode, stepCall, waitHandle, bareStepHandle };
@@ -0,0 +1,95 @@
1
+ // @bun
2
+ import {
3
+ string,
4
+ int,
5
+ boolean,
6
+ array,
7
+ object,
8
+ union,
9
+ discriminatedUnion,
10
+ record,
11
+ _enum,
12
+ literal
13
+ } from "./chunk-dnn39qt4.js";
14
+
15
+ // src/opencode-mcp.ts
16
+ var nonEmptyStringSchema = string().trim().min(1);
17
+ var mcpStringMapSchema = record(string(), string());
18
+ var positiveIntSchema = int().gt(0).max(Number.MAX_SAFE_INTEGER);
19
+ var openCodeMcpTimeoutSchema2 = object({
20
+ startup: positiveIntSchema.optional(),
21
+ catalog: positiveIntSchema.optional(),
22
+ execution: positiveIntSchema.optional()
23
+ }).strict();
24
+ var openCodeMcpProtocolSchema2 = _enum([
25
+ "legacy",
26
+ "auto",
27
+ "2026-07-28"
28
+ ]);
29
+ var sharedServerFields = {
30
+ disabled: boolean().optional(),
31
+ codemode: boolean().optional(),
32
+ timeout: openCodeMcpTimeoutSchema2.optional(),
33
+ protocol: openCodeMcpProtocolSchema2.optional()
34
+ };
35
+ var openCodeMcpLocalConfigSchema2 = object({
36
+ type: literal("local"),
37
+ command: array(nonEmptyStringSchema).min(1),
38
+ cwd: string().optional(),
39
+ environment: mcpStringMapSchema.optional(),
40
+ ...sharedServerFields
41
+ }).strict();
42
+ var openCodeMcpOAuthConfigSchema2 = object({
43
+ client_id: string().optional(),
44
+ client_secret: string().optional(),
45
+ scope: string().optional(),
46
+ callback_port: positiveIntSchema.optional(),
47
+ redirect_uri: string().optional(),
48
+ auth_server_metadata_url: string().optional()
49
+ }).strict();
50
+ var openCodeMcpRemoteConfigSchema2 = object({
51
+ type: literal("remote"),
52
+ url: string(),
53
+ headers: mcpStringMapSchema.optional(),
54
+ oauth: union([openCodeMcpOAuthConfigSchema2, literal(false)]).optional(),
55
+ ...sharedServerFields
56
+ }).strict();
57
+ var openCodeMcpRefConfigSchema2 = object({
58
+ type: literal("ref"),
59
+ name: nonEmptyStringSchema.optional(),
60
+ ...sharedServerFields
61
+ }).strict();
62
+ var openCodeResolvedMcpServerConfigSchema2 = discriminatedUnion("type", [openCodeMcpLocalConfigSchema2, openCodeMcpRemoteConfigSchema2]);
63
+ var openCodeResolvedMcpServersSchema2 = record(string(), openCodeResolvedMcpServerConfigSchema2);
64
+ var openCodeMcpServerConfigSchema2 = discriminatedUnion("type", [
65
+ openCodeMcpLocalConfigSchema2,
66
+ openCodeMcpRemoteConfigSchema2,
67
+ openCodeMcpRefConfigSchema2
68
+ ]);
69
+ var openCodeMcpServersSchema2 = record(string(), openCodeMcpServerConfigSchema2);
70
+ var ENV_PLACEHOLDER_PATTERN = /\{env:[A-Za-z_][A-Za-z0-9_]*\}/gu;
71
+ var ENV_PLACEHOLDER_NAME_PATTERN = /\{env:([^}]+)\}/gu;
72
+ var AUTH_SCHEME_PATTERN = /^(?:bearer|basic|token)\s+/iu;
73
+ function isEnvPlaceholderValue2(value) {
74
+ if (value.match(ENV_PLACEHOLDER_PATTERN) === null)
75
+ return false;
76
+ return value.trim().replace(AUTH_SCHEME_PATTERN, "").replace(ENV_PLACEHOLDER_PATTERN, "").trim() === "";
77
+ }
78
+ function collectEnvPlaceholderNames2(value) {
79
+ const names = new Set;
80
+ const visit = (item) => {
81
+ if (typeof item === "string") {
82
+ for (const match of item.matchAll(ENV_PLACEHOLDER_NAME_PATTERN)) {
83
+ if (match[1] !== undefined)
84
+ names.add(match[1]);
85
+ }
86
+ } else if (typeof item === "object" && item !== null) {
87
+ for (const child of Object.values(item))
88
+ visit(child);
89
+ }
90
+ };
91
+ visit(value);
92
+ return [...names].sort();
93
+ }
94
+
95
+ export { openCodeMcpTimeoutSchema2, openCodeMcpProtocolSchema2, openCodeMcpLocalConfigSchema2, openCodeMcpOAuthConfigSchema2, openCodeMcpRemoteConfigSchema2, openCodeMcpRefConfigSchema2, openCodeResolvedMcpServerConfigSchema2, openCodeResolvedMcpServersSchema2, openCodeMcpServerConfigSchema2, openCodeMcpServersSchema2, isEnvPlaceholderValue2, collectEnvPlaceholderNames2 };
@@ -0,0 +1,116 @@
1
+ // @bun
2
+ // src/jsonc.ts
3
+ var stripJsoncComments2 = (content) => {
4
+ let result = "";
5
+ let inString = false;
6
+ let escapeNextCharacter = false;
7
+ let lineComment = false;
8
+ let blockComment = false;
9
+ for (let index = 0;index < content.length; index += 1) {
10
+ const character = content.charAt(index);
11
+ const nextCharacter = content.charAt(index + 1);
12
+ if (lineComment) {
13
+ if (character === `
14
+ `) {
15
+ lineComment = false;
16
+ result += character;
17
+ }
18
+ continue;
19
+ }
20
+ if (blockComment) {
21
+ if (character === "*" && nextCharacter === "/") {
22
+ blockComment = false;
23
+ index += 1;
24
+ }
25
+ continue;
26
+ }
27
+ if (inString) {
28
+ result += character;
29
+ if (escapeNextCharacter) {
30
+ escapeNextCharacter = false;
31
+ continue;
32
+ }
33
+ if (character === "\\") {
34
+ escapeNextCharacter = true;
35
+ continue;
36
+ }
37
+ if (character === '"') {
38
+ inString = false;
39
+ }
40
+ continue;
41
+ }
42
+ if (character === '"') {
43
+ inString = true;
44
+ result += character;
45
+ continue;
46
+ }
47
+ if (character === "/" && nextCharacter === "/") {
48
+ lineComment = true;
49
+ index += 1;
50
+ continue;
51
+ }
52
+ if (character === "/" && nextCharacter === "*") {
53
+ blockComment = true;
54
+ index += 1;
55
+ continue;
56
+ }
57
+ result += character;
58
+ }
59
+ return result;
60
+ };
61
+ var stripTrailingCommas2 = (content) => {
62
+ let result = "";
63
+ let inString = false;
64
+ let escapeNextCharacter = false;
65
+ for (let index = 0;index < content.length; index += 1) {
66
+ const character = content.charAt(index);
67
+ if (inString) {
68
+ result += character;
69
+ if (escapeNextCharacter) {
70
+ escapeNextCharacter = false;
71
+ continue;
72
+ }
73
+ if (character === "\\") {
74
+ escapeNextCharacter = true;
75
+ continue;
76
+ }
77
+ if (character === '"') {
78
+ inString = false;
79
+ }
80
+ continue;
81
+ }
82
+ if (character === '"') {
83
+ inString = true;
84
+ result += character;
85
+ continue;
86
+ }
87
+ if (character === ",") {
88
+ let lookaheadIndex = index + 1;
89
+ while (lookaheadIndex < content.length) {
90
+ const lookaheadCharacter = content.charAt(lookaheadIndex);
91
+ if (/\s/u.test(lookaheadCharacter)) {
92
+ lookaheadIndex += 1;
93
+ continue;
94
+ }
95
+ if (lookaheadCharacter === "}" || lookaheadCharacter === "]") {
96
+ break;
97
+ }
98
+ result += character;
99
+ break;
100
+ }
101
+ if (lookaheadIndex >= content.length) {
102
+ continue;
103
+ }
104
+ const lookaheadCharacter = content.charAt(lookaheadIndex);
105
+ if (lookaheadCharacter === "}" || lookaheadCharacter === "]") {
106
+ continue;
107
+ }
108
+ continue;
109
+ }
110
+ result += character;
111
+ }
112
+ return result;
113
+ };
114
+ var parseJsonc2 = (content) => JSON.parse(stripTrailingCommas2(stripJsoncComments2(content)));
115
+
116
+ export { stripJsoncComments2, stripTrailingCommas2, parseJsonc2 };
@@ -0,0 +1,35 @@
1
+ // @bun
2
+ // src/push/code-step-lookup.ts
3
+ function isStepDefinitionSpec2(value) {
4
+ if (typeof value !== "object" && typeof value !== "function")
5
+ return false;
6
+ if (value === null)
7
+ return false;
8
+ const obj = value;
9
+ return typeof obj["key"] === "string" && typeof obj["name"] === "string" && typeof obj["version"] === "number" && (obj["kind"] === "user_defined" || obj["kind"] === "code");
10
+ }
11
+ function stepsInModule2(mod) {
12
+ const found = new Set;
13
+ for (const [exportName, value] of Object.entries(mod)) {
14
+ if (exportName !== "default" && isStepDefinitionSpec2(value)) {
15
+ found.add(value);
16
+ }
17
+ }
18
+ return [...found];
19
+ }
20
+ function findCodeStepInModule2(mod, key) {
21
+ const fns = new Set;
22
+ for (const spec of stepsInModule2(mod)) {
23
+ if (spec.kind !== "code" || spec.key !== key)
24
+ continue;
25
+ const fn = spec.entrypoint?.fn;
26
+ if (typeof fn === "function")
27
+ fns.add(fn);
28
+ }
29
+ if (fns.size > 1) {
30
+ throw new Error(`Code step "${key}" is ambiguous: ${String(fns.size)} distinct functions are registered under that key in the same module.`);
31
+ }
32
+ return fns.values().next().value;
33
+ }
34
+
35
+ export { isStepDefinitionSpec2, stepsInModule2, findCodeStepInModule2 };