@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.
- package/dist/auth/index.js +15 -16
- package/dist/automations/index.js +14 -17
- package/dist/{chunk-6p340dd4.js → chunk-0bwsjn0b.js} +29 -29
- package/dist/{chunk-r3sbp2wn.js → chunk-0w13kxkr.js} +34 -31
- package/dist/{chunk-nkm31g10.js → chunk-3j5wf2t5.js} +44 -43
- package/dist/{chunk-0y2fy5en.js → chunk-4361gxk0.js} +7 -7
- package/dist/{chunk-8tmsvkmj.js → chunk-52520csz.js} +13 -12
- package/dist/chunk-5dnfgyx8.js +159 -0
- package/dist/{chunk-k57h6qke.js → chunk-5fa4arn1.js} +12 -8
- package/dist/{chunk-ngy1fdcx.js → chunk-631ffb6r.js} +10 -10
- package/dist/{chunk-01nfqm18.js → chunk-7anj08zc.js} +11 -9
- package/dist/{chunk-p74r4y6j.js → chunk-7dr4kybf.js} +481 -449
- package/dist/chunk-7mhr5aex.js +171 -0
- package/dist/chunk-7rywbqzz.js +27 -0
- package/dist/{chunk-xhpp6qz8.js → chunk-9ct3xypr.js} +2552 -3780
- package/dist/{chunk-azss2d1n.js → chunk-9geh4c3v.js} +153 -155
- package/dist/{chunk-8hsk6f6b.js → chunk-9qf0eg7m.js} +19 -19
- package/dist/{chunk-y11p1q7r.js → chunk-aqqywy8g.js} +4 -4
- package/dist/chunk-bcvx11fn.js +174 -0
- package/dist/{chunk-59arcerk.js → chunk-cyfeaz43.js} +86 -86
- package/dist/chunk-czq37rrt.js +286 -0
- package/dist/chunk-ec5z8bbq.js +126 -0
- package/dist/{chunk-rt9tq4j6.js → chunk-h9yxx0hd.js} +7 -7
- package/dist/{chunk-gasw078g.js → chunk-hma87efq.js} +40 -40
- package/dist/{chunk-5dny5jg1.js → chunk-hpv234hf.js} +11 -11
- package/dist/{chunk-y81cr6tp.js → chunk-k7xnsmp5.js} +158 -87
- package/dist/{chunk-zxzvketc.js → chunk-kbpkpxcn.js} +20 -19
- package/dist/{chunk-6tra3gw8.js → chunk-kjn1knb9.js} +7 -7
- package/dist/{chunk-0he2dx5n.js → chunk-p3s7cjfc.js} +15 -14
- package/dist/chunk-pq6hrtnb.js +49 -0
- package/dist/{chunk-mp2rqtcj.js → chunk-ptpy7nnm.js} +8 -8
- package/dist/{chunk-xqfj56m9.js → chunk-vn1rfxma.js} +8 -8
- package/dist/chunk-vyv8kvkv.js +113 -0
- package/dist/{chunk-h1v6w1fh.js → chunk-xe2zgyz7.js} +35 -35
- package/dist/chunk-y4dwmhn2.js +14 -0
- package/dist/{chunk-8kzaxz52.js → chunk-yypj3zn0.js} +8 -8
- package/dist/chunk-yzj1mfpr.js +1515 -0
- package/dist/client.js +62 -61
- package/dist/connectors/index.js +36 -37
- package/dist/contracts/artifact-markers.js +11 -12
- package/dist/contracts/artifacts.js +21 -23
- package/dist/contracts/automation-document/index.js +28 -30
- package/dist/contracts/pipeline-document/built-ins.d.ts +1 -1
- package/dist/contracts/pipeline-document/index.js +95 -97
- package/dist/contracts/step-artifact-submissions.js +20 -17
- package/dist/contracts/work-item-changes.js +8 -6
- package/dist/defaults/index.js +22 -23
- package/dist/definitions/automations/index.js +6 -8
- package/dist/definitions/environments/index.js +37 -38
- package/dist/definitions/pipelines/index.js +12 -14
- package/dist/definitions/steps/define-mcp.d.ts +2 -2
- package/dist/definitions/steps/index.js +93 -95
- package/dist/definitions/steps/mcp-server-config.d.ts +13 -3
- package/dist/definitions/steps/step-definitions-client.d.ts +18 -0
- package/dist/definitions/validation/index.js +17 -18
- package/dist/devcontainer-config-path.js +9 -11
- package/dist/env-vars.js +37 -39
- package/dist/environment.js +41 -42
- package/dist/eslint.js +0 -2
- package/dist/generated/index.d.ts +2 -2
- package/dist/generated/sdk.gen.d.ts +41 -1
- package/dist/generated/types.gen.d.ts +1801 -0
- package/dist/git-url/git-repo-identity.js +0 -2
- package/dist/health-checks.js +15 -17
- package/dist/index.js +364 -358
- package/dist/jsonc.js +7 -8
- package/dist/managed-connections.d.ts +16 -0
- package/dist/managed-connections.js +9 -0
- package/dist/managed-runtimes.js +9 -11
- package/dist/opencode-mcp.d.ts +55 -1
- package/dist/opencode-mcp.js +33 -28
- package/dist/pipelines/index.js +78 -81
- package/dist/push/code-step-lookup.js +9 -10
- package/dist/push/index.d.ts +1 -0
- package/dist/push/index.js +88 -59
- package/dist/push/push-from-directory.d.ts +3 -0
- package/dist/push/pushed-mcp-servers.d.ts +28 -0
- package/dist/repo-config.js +41 -43
- package/dist/resolve-environment.js +14 -15
- package/dist/scarn-config-parser.js +5 -6
- package/dist/task-plane-client.d.ts +137 -1
- package/package.json +6 -2
- package/dist/chunk-08gcnrzh.js +0 -96
- package/dist/chunk-5say64w8.js +0 -14
- package/dist/chunk-aph2js2v.js +0 -167
- package/dist/chunk-mrzn5tq4.js +0 -107
- package/dist/chunk-pwyj6qf3.js +0 -119
- package/dist/chunk-qt81x1pm.js +0 -275
- package/dist/chunk-vsp708vw.js +0 -167
- package/dist/chunk-y64skrwp.js +0 -17
- package/dist/chunk-y7ac1t9c.js +0 -39
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
PipelineDefinitions2,
|
|
4
4
|
createApiClient
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-k7xnsmp5.js";
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
string,
|
|
8
|
+
object
|
|
9
|
+
} from "./chunk-9ct3xypr.js";
|
|
9
10
|
|
|
10
11
|
// src/definitions/pipelines/pipeline-definitions-client.ts
|
|
11
|
-
var pipelineDocumentIssueSchema =
|
|
12
|
-
code:
|
|
13
|
-
path:
|
|
14
|
-
message:
|
|
15
|
-
hint:
|
|
12
|
+
var pipelineDocumentIssueSchema = object({
|
|
13
|
+
code: string(),
|
|
14
|
+
path: string(),
|
|
15
|
+
message: string(),
|
|
16
|
+
hint: string().optional()
|
|
16
17
|
});
|
|
17
18
|
|
|
18
|
-
class
|
|
19
|
+
class PipelineDefinitionsApiError2 extends Error {
|
|
19
20
|
code;
|
|
20
21
|
issues;
|
|
21
22
|
constructor(error) {
|
|
@@ -36,13 +37,13 @@ function documentIssuesOf(meta) {
|
|
|
36
37
|
}
|
|
37
38
|
function unwrap(result) {
|
|
38
39
|
if (result.error !== undefined) {
|
|
39
|
-
throw new
|
|
40
|
+
throw new PipelineDefinitionsApiError2(result.error);
|
|
40
41
|
}
|
|
41
42
|
return result.data;
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
+
function createPipelineDefinitionsClient2(baseUrl, options) {
|
|
44
45
|
const client = createApiClient(baseUrl, { fetch: options?.fetch });
|
|
45
|
-
return buildPipelineDefinitionsClient(new
|
|
46
|
+
return buildPipelineDefinitionsClient(new PipelineDefinitions2({ client }));
|
|
46
47
|
}
|
|
47
48
|
var buildPipelineDefinitionsClient = (pipelineDefinitions) => ({
|
|
48
49
|
listByProjectId: async (projectId, options) => unwrap(await pipelineDefinitions.listPipelineDefinitions({
|
|
@@ -76,7 +77,7 @@ var buildPipelineDefinitionsClient = (pipelineDefinitions) => ({
|
|
|
76
77
|
}))
|
|
77
78
|
});
|
|
78
79
|
// src/definitions/pipelines/work-item-fields.ts
|
|
79
|
-
var
|
|
80
|
+
var WORK_ITEM_TOP_LEVEL_FIELDS2 = [
|
|
80
81
|
"id",
|
|
81
82
|
"projectId",
|
|
82
83
|
"platform",
|
|
@@ -92,13 +93,13 @@ var WORK_ITEM_TOP_LEVEL_FIELDS = [
|
|
|
92
93
|
"createdAt",
|
|
93
94
|
"updatedAt"
|
|
94
95
|
];
|
|
95
|
-
var
|
|
96
|
-
function
|
|
96
|
+
var WORK_ITEM_FIELDS_PATH_PREFIX2 = "fields.";
|
|
97
|
+
function resolveWorkItemFieldPath2(record, path) {
|
|
97
98
|
if (typeof record !== "object" || record === null)
|
|
98
99
|
return;
|
|
99
100
|
const asRecord = record;
|
|
100
|
-
if (path.startsWith(
|
|
101
|
-
const fieldName = path.slice(
|
|
101
|
+
if (path.startsWith(WORK_ITEM_FIELDS_PATH_PREFIX2)) {
|
|
102
|
+
const fieldName = path.slice(WORK_ITEM_FIELDS_PATH_PREFIX2.length);
|
|
102
103
|
const fields = asRecord["fields"];
|
|
103
104
|
if (typeof fields !== "object" || fields === null)
|
|
104
105
|
return;
|
|
@@ -106,4 +107,4 @@ function resolveWorkItemFieldPath(record, path) {
|
|
|
106
107
|
}
|
|
107
108
|
return asRecord[path];
|
|
108
109
|
}
|
|
109
|
-
export {
|
|
110
|
+
export { PipelineDefinitionsApiError2, createPipelineDefinitionsClient2, WORK_ITEM_TOP_LEVEL_FIELDS2, WORK_ITEM_FIELDS_PATH_PREFIX2, resolveWorkItemFieldPath2 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/push/code-step-lookup.ts
|
|
3
|
-
function
|
|
3
|
+
function isStepDefinitionSpec2(value) {
|
|
4
4
|
if (typeof value !== "object" && typeof value !== "function")
|
|
5
5
|
return false;
|
|
6
6
|
if (value === null)
|
|
@@ -8,24 +8,24 @@ function isStepDefinitionSpec(value) {
|
|
|
8
8
|
const obj = value;
|
|
9
9
|
return typeof obj["key"] === "string" && typeof obj["name"] === "string" && typeof obj["version"] === "number" && (obj["kind"] === "user_defined" || obj["kind"] === "code");
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function isEnvironmentHandle2(value) {
|
|
12
12
|
if (typeof value !== "object" || value === null)
|
|
13
13
|
return false;
|
|
14
14
|
const obj = value;
|
|
15
15
|
return obj["kind"] === "environment" && typeof obj["name"] === "string" && typeof obj["content"] === "object" && obj["content"] !== null;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function stepsInModule2(mod) {
|
|
18
18
|
const found = new Set;
|
|
19
19
|
for (const [exportName, value] of Object.entries(mod)) {
|
|
20
|
-
if (exportName !== "default" &&
|
|
20
|
+
if (exportName !== "default" && isStepDefinitionSpec2(value)) {
|
|
21
21
|
found.add(value);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
return [...found];
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function findCodeStepInModule2(mod, key) {
|
|
27
27
|
const fns = new Set;
|
|
28
|
-
for (const spec of
|
|
28
|
+
for (const spec of stepsInModule2(mod)) {
|
|
29
29
|
if (spec.kind !== "code" || spec.key !== key)
|
|
30
30
|
continue;
|
|
31
31
|
const fn = spec.entrypoint?.fn;
|
|
@@ -38,4 +38,4 @@ function findCodeStepInModule(mod, key) {
|
|
|
38
38
|
return fns.values().next().value;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export {
|
|
41
|
+
export { isStepDefinitionSpec2, isEnvironmentHandle2, stepsInModule2, findCodeStepInModule2 };
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
Automations2,
|
|
4
4
|
createApiClient
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-k7xnsmp5.js";
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
string,
|
|
8
|
+
object
|
|
9
|
+
} from "./chunk-9ct3xypr.js";
|
|
9
10
|
|
|
10
11
|
// src/definitions/automations/automations-client.ts
|
|
11
|
-
var automationDocumentIssueSchema =
|
|
12
|
-
code:
|
|
13
|
-
path:
|
|
14
|
-
message:
|
|
15
|
-
hint:
|
|
12
|
+
var automationDocumentIssueSchema = object({
|
|
13
|
+
code: string(),
|
|
14
|
+
path: string(),
|
|
15
|
+
message: string(),
|
|
16
|
+
hint: string().optional()
|
|
16
17
|
});
|
|
17
18
|
|
|
18
|
-
class
|
|
19
|
+
class AutomationsApiError2 extends Error {
|
|
19
20
|
code;
|
|
20
21
|
issues;
|
|
21
22
|
constructor(error) {
|
|
@@ -31,13 +32,13 @@ class AutomationsApiError extends Error {
|
|
|
31
32
|
}
|
|
32
33
|
function unwrap(result) {
|
|
33
34
|
if (result.error !== undefined) {
|
|
34
|
-
throw new
|
|
35
|
+
throw new AutomationsApiError2(result.error);
|
|
35
36
|
}
|
|
36
37
|
return result.data;
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function createAutomationsClient2(baseUrl, options) {
|
|
39
40
|
const client = createApiClient(baseUrl, { fetch: options?.fetch });
|
|
40
|
-
return buildAutomationsClient(new
|
|
41
|
+
return buildAutomationsClient(new Automations2({ client }));
|
|
41
42
|
}
|
|
42
43
|
var buildAutomationsClient = (automations) => ({
|
|
43
44
|
listByProjectId: async (projectId, options) => unwrap(await automations.listAutomations({
|
|
@@ -70,4 +71,4 @@ var buildAutomationsClient = (automations) => ({
|
|
|
70
71
|
headers: options?.headers
|
|
71
72
|
}))
|
|
72
73
|
});
|
|
73
|
-
export {
|
|
74
|
+
export { AutomationsApiError2, createAutomationsClient2 };
|
|
@@ -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-9ct3xypr.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 };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
captureSite,
|
|
4
|
+
AuthoringError
|
|
5
|
+
} from "./chunk-aqqywy8g.js";
|
|
5
6
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from "./chunk-y11p1q7r.js";
|
|
7
|
+
jsonPointer2
|
|
8
|
+
} from "./chunk-hpv234hf.js";
|
|
9
9
|
|
|
10
10
|
// src/pipelines/refs.ts
|
|
11
11
|
var REF = Symbol("scarn.ref");
|
|
@@ -370,17 +370,17 @@ function newState() {
|
|
|
370
370
|
};
|
|
371
371
|
}
|
|
372
372
|
function issue(state, site, pointer, message) {
|
|
373
|
-
state.issues.push({ site, pointer:
|
|
373
|
+
state.issues.push({ site, pointer: jsonPointer2(pointer), message });
|
|
374
374
|
}
|
|
375
375
|
function mapSource(state, pointer, site) {
|
|
376
|
-
const key =
|
|
376
|
+
const key = jsonPointer2(pointer);
|
|
377
377
|
if (site !== null && state.sourceMap[key] === undefined) {
|
|
378
378
|
state.sourceMap[key] = site;
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
381
|
function attempt(state, pointer, site, run) {
|
|
382
382
|
const previous = state.tracker.pointer;
|
|
383
|
-
setTrackerPointer(
|
|
383
|
+
setTrackerPointer(jsonPointer2(pointer));
|
|
384
384
|
try {
|
|
385
385
|
return run();
|
|
386
386
|
} catch (error) {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
AuthoringError,
|
|
4
3
|
captureSite,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
nodeOf,
|
|
8
|
-
registerChain,
|
|
4
|
+
AuthoringError,
|
|
5
|
+
stepOn,
|
|
9
6
|
registerNode,
|
|
10
7
|
registerTarget,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
registerChain,
|
|
9
|
+
nodeOf,
|
|
10
|
+
targetOf,
|
|
11
|
+
eachOf,
|
|
12
|
+
chainOf
|
|
13
|
+
} from "./chunk-aqqywy8g.js";
|
|
14
14
|
|
|
15
15
|
// src/pipelines/model.ts
|
|
16
16
|
function emptyChain(node) {
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
string,
|
|
4
|
+
boolean,
|
|
5
|
+
array,
|
|
6
|
+
object,
|
|
7
|
+
discriminatedUnion,
|
|
8
|
+
_enum,
|
|
9
|
+
literal
|
|
10
|
+
} from "./chunk-9ct3xypr.js";
|
|
11
|
+
|
|
12
|
+
// src/env-vars.ts
|
|
13
|
+
var ENV_VAR_NAME_PATTERN2 = /^[A-Z_][A-Z0-9_]*$/;
|
|
14
|
+
var RESERVED_ENV_VAR_NAMES2 = [
|
|
15
|
+
"HOME",
|
|
16
|
+
"XDG_CONFIG_HOME",
|
|
17
|
+
"XDG_DATA_HOME",
|
|
18
|
+
"OPENCODE_CONFIG_CONTENT",
|
|
19
|
+
"npm_config_cache"
|
|
20
|
+
];
|
|
21
|
+
var RESERVED_ENV_VAR_PREFIX2 = "SCARN_";
|
|
22
|
+
var MAX_ENV_VARS2 = 64;
|
|
23
|
+
var MAX_ENV_VAR_NAME_LENGTH2 = 128;
|
|
24
|
+
var MAX_ENV_VAR_VALUE_LENGTH2 = 4096;
|
|
25
|
+
var INPUT_TOKEN_PATTERN = /\{\{input\.[^}]+\}\}/;
|
|
26
|
+
function containsInputToken2(value) {
|
|
27
|
+
return INPUT_TOKEN_PATTERN.test(value);
|
|
28
|
+
}
|
|
29
|
+
function isReservedEnvVarName2(name) {
|
|
30
|
+
return name.startsWith(RESERVED_ENV_VAR_PREFIX2) || RESERVED_ENV_VAR_NAMES2.includes(name);
|
|
31
|
+
}
|
|
32
|
+
var envVarNameSchema = string().max(MAX_ENV_VAR_NAME_LENGTH2).regex(ENV_VAR_NAME_PATTERN2, "must match /^[A-Z_][A-Z0-9_]*$/").refine((name) => !isReservedEnvVarName2(name), {
|
|
33
|
+
message: `is reserved (SCARN_*, ${RESERVED_ENV_VAR_NAMES2.join(", ")})`
|
|
34
|
+
});
|
|
35
|
+
var envVarValueSchema = string().max(MAX_ENV_VAR_VALUE_LENGTH2);
|
|
36
|
+
var envVarAppliesValues2 = ["agent", "setup", "both"];
|
|
37
|
+
var envVarAppliesSchema = _enum(envVarAppliesValues2).default("agent");
|
|
38
|
+
function appliesToAgent2(applies) {
|
|
39
|
+
return applies !== "setup";
|
|
40
|
+
}
|
|
41
|
+
function appliesToSetup2(applies) {
|
|
42
|
+
return applies === "setup" || applies === "both";
|
|
43
|
+
}
|
|
44
|
+
function isUninheritableWorkerEnvVarName2(name) {
|
|
45
|
+
return name.toUpperCase().startsWith(RESERVED_ENV_VAR_PREFIX2);
|
|
46
|
+
}
|
|
47
|
+
var valueEnvVarSchema = object({
|
|
48
|
+
name: envVarNameSchema,
|
|
49
|
+
source: literal("value"),
|
|
50
|
+
value: envVarValueSchema,
|
|
51
|
+
secret: boolean(),
|
|
52
|
+
applies: envVarAppliesSchema
|
|
53
|
+
}).strict().refine((entry) => !entry.secret || containsInputToken2(entry.value), {
|
|
54
|
+
path: ["value"],
|
|
55
|
+
message: "a secret value must contain an {{input.\u2026}} token; a static secret would be stored in plaintext. Use Env.inherit({ secret: true }) instead"
|
|
56
|
+
});
|
|
57
|
+
var inheritEnvVarSchema2 = object({
|
|
58
|
+
name: envVarNameSchema,
|
|
59
|
+
source: literal("inherit"),
|
|
60
|
+
from: string().max(MAX_ENV_VAR_NAME_LENGTH2).regex(/^[A-Za-z_][A-Za-z0-9_]*$/, "must be a valid environment variable name").refine((from) => !isUninheritableWorkerEnvVarName2(from), {
|
|
61
|
+
message: `cannot read worker variables starting with ${RESERVED_ENV_VAR_PREFIX2}`
|
|
62
|
+
}),
|
|
63
|
+
secret: boolean(),
|
|
64
|
+
optional: boolean(),
|
|
65
|
+
default: envVarValueSchema.optional(),
|
|
66
|
+
mcp: string().min(1).optional(),
|
|
67
|
+
applies: envVarAppliesSchema
|
|
68
|
+
}).strict().refine((entry) => !(entry.secret && entry.default !== undefined), {
|
|
69
|
+
path: ["default"],
|
|
70
|
+
message: "a secret cannot carry a default; it would be stored in plaintext"
|
|
71
|
+
});
|
|
72
|
+
var secretEnvVarSchema2 = object({
|
|
73
|
+
name: envVarNameSchema,
|
|
74
|
+
source: literal("secret"),
|
|
75
|
+
secretName: envVarNameSchema,
|
|
76
|
+
applies: envVarAppliesSchema
|
|
77
|
+
}).strict();
|
|
78
|
+
var envVarSpecSchema2 = discriminatedUnion("source", [
|
|
79
|
+
valueEnvVarSchema,
|
|
80
|
+
inheritEnvVarSchema2,
|
|
81
|
+
secretEnvVarSchema2
|
|
82
|
+
]);
|
|
83
|
+
function isMaskedEnvVar2(entry) {
|
|
84
|
+
return entry.source === "secret" || entry.secret;
|
|
85
|
+
}
|
|
86
|
+
var envVarsSchema2 = array(envVarSpecSchema2).max(MAX_ENV_VARS2).refine((entries) => new Set(entries.map((entry) => entry.name)).size === entries.length, { message: "environment variable names must be unique" });
|
|
87
|
+
var storedEnvVarsSchema2 = array(discriminatedUnion("source", [
|
|
88
|
+
object({
|
|
89
|
+
name: string(),
|
|
90
|
+
source: literal("value"),
|
|
91
|
+
value: string(),
|
|
92
|
+
secret: boolean(),
|
|
93
|
+
applies: _enum(envVarAppliesValues2).default("agent")
|
|
94
|
+
}),
|
|
95
|
+
object({
|
|
96
|
+
name: string(),
|
|
97
|
+
source: literal("inherit"),
|
|
98
|
+
from: string(),
|
|
99
|
+
secret: boolean(),
|
|
100
|
+
optional: boolean(),
|
|
101
|
+
default: string().optional(),
|
|
102
|
+
mcp: string().optional(),
|
|
103
|
+
applies: _enum(envVarAppliesValues2).default("agent")
|
|
104
|
+
}),
|
|
105
|
+
object({
|
|
106
|
+
name: string(),
|
|
107
|
+
source: literal("secret"),
|
|
108
|
+
secretName: string(),
|
|
109
|
+
applies: _enum(envVarAppliesValues2).default("agent")
|
|
110
|
+
})
|
|
111
|
+
]));
|
|
112
|
+
|
|
113
|
+
export { ENV_VAR_NAME_PATTERN2, RESERVED_ENV_VAR_NAMES2, RESERVED_ENV_VAR_PREFIX2, MAX_ENV_VARS2, MAX_ENV_VAR_NAME_LENGTH2, MAX_ENV_VAR_VALUE_LENGTH2, containsInputToken2, isReservedEnvVarName2, envVarAppliesValues2, appliesToAgent2, appliesToSetup2, isUninheritableWorkerEnvVarName2, inheritEnvVarSchema2, secretEnvVarSchema2, envVarSpecSchema2, isMaskedEnvVar2, envVarsSchema2, storedEnvVarsSchema2 };
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
artifactPlatforms2,
|
|
4
|
+
EMBEDDABLE_ARTIFACT_EXTENSIONS2,
|
|
5
|
+
findArtifactFields2
|
|
6
|
+
} from "./chunk-9qf0eg7m.js";
|
|
5
7
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from "./chunk-aph2js2v.js";
|
|
8
|
+
findArtifactMarkers2
|
|
9
|
+
} from "./chunk-631ffb6r.js";
|
|
9
10
|
import {
|
|
10
|
-
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
envVarsSchema2
|
|
12
|
+
} from "./chunk-vyv8kvkv.js";
|
|
12
13
|
import {
|
|
13
|
-
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
repoConfigInputSchema2
|
|
15
|
+
} from "./chunk-7mhr5aex.js";
|
|
15
16
|
import {
|
|
16
|
-
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
devcontainerConfigPathSchema2
|
|
18
|
+
} from "./chunk-yypj3zn0.js";
|
|
18
19
|
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} from "./chunk-8hsk6f6b.js";
|
|
20
|
+
environmentNameSchema2,
|
|
21
|
+
environmentRuntimeSchema2
|
|
22
|
+
} from "./chunk-bcvx11fn.js";
|
|
23
23
|
|
|
24
24
|
// src/definitions/validation/validate-artifacts.ts
|
|
25
25
|
function checkArtifactFields(steps) {
|
|
26
26
|
const issues = [];
|
|
27
27
|
for (const step of steps) {
|
|
28
|
-
for (const field of
|
|
28
|
+
for (const field of findArtifactFields2(step.resultSchemaJson ?? null)) {
|
|
29
29
|
if (!field.inArray)
|
|
30
30
|
continue;
|
|
31
31
|
issues.push({
|
|
@@ -39,7 +39,7 @@ function checkArtifactFields(steps) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
// src/definitions/validation/validation-issue.ts
|
|
42
|
-
function
|
|
42
|
+
function listPaths2(paths, limit = 24) {
|
|
43
43
|
if (paths.length === 0)
|
|
44
44
|
return "";
|
|
45
45
|
if (paths.length <= limit)
|
|
@@ -52,7 +52,7 @@ var isPlaceholder = (key) => /^<[^<>]*>$/.test(key);
|
|
|
52
52
|
function stepMarkers(step) {
|
|
53
53
|
if (!step.prompt)
|
|
54
54
|
return [];
|
|
55
|
-
return
|
|
55
|
+
return findArtifactMarkers2(step.prompt).flatMap((marker) => marker.ref.type === "signal" && !isPlaceholder(marker.ref.stepKey) && !isPlaceholder(marker.ref.signalKey) ? [
|
|
56
56
|
{
|
|
57
57
|
kind: marker.kind,
|
|
58
58
|
stepKey: marker.ref.stepKey,
|
|
@@ -63,8 +63,8 @@ function stepMarkers(step) {
|
|
|
63
63
|
var markerLabel = (marker) => `${marker.kind === "embed" ? "Artifact.embed" : "Artifact.link"}(` + `"signal/${marker.stepKey}/${marker.resultPath}")`;
|
|
64
64
|
function checkMarkerTargets(steps, stepsByKey) {
|
|
65
65
|
const issues = [];
|
|
66
|
-
const embeddable = new Set(
|
|
67
|
-
...
|
|
66
|
+
const embeddable = new Set(artifactPlatforms2.flatMap((platform) => [
|
|
67
|
+
...EMBEDDABLE_ARTIFACT_EXTENSIONS2[platform]
|
|
68
68
|
]));
|
|
69
69
|
for (const step of steps) {
|
|
70
70
|
for (const marker of stepMarkers(step)) {
|
|
@@ -75,14 +75,14 @@ function checkMarkerTargets(steps, stepsByKey) {
|
|
|
75
75
|
for (const target of targets) {
|
|
76
76
|
if (!target.resultSchemaJson)
|
|
77
77
|
continue;
|
|
78
|
-
const fields =
|
|
78
|
+
const fields = findArtifactFields2(target.resultSchemaJson);
|
|
79
79
|
const field = fields.find((candidate) => candidate.path === marker.resultPath);
|
|
80
80
|
if (!field) {
|
|
81
81
|
const declared = fields.map((candidate) => candidate.path);
|
|
82
82
|
issues.push({
|
|
83
83
|
check: "artifact-marker",
|
|
84
84
|
severity: "error",
|
|
85
|
-
message: `${where}, but step "${target.key}" has no artifact field at ` + `"${marker.resultPath}". Artifact fields on "${target.key}": ` + `${declared.length > 0 ?
|
|
85
|
+
message: `${where}, but step "${target.key}" has no artifact field at ` + `"${marker.resultPath}". Artifact fields on "${target.key}": ` + `${declared.length > 0 ? listPaths2(declared) : "(none)"}.`
|
|
86
86
|
});
|
|
87
87
|
continue;
|
|
88
88
|
}
|
|
@@ -116,7 +116,7 @@ function checkEnv(steps) {
|
|
|
116
116
|
continue;
|
|
117
117
|
issues.push(...checkEnvMcpOwners(step));
|
|
118
118
|
issues.push(...checkEnvApplies(step));
|
|
119
|
-
const result =
|
|
119
|
+
const result = envVarsSchema2.safeParse(envJson);
|
|
120
120
|
if (result.success)
|
|
121
121
|
continue;
|
|
122
122
|
for (const issue of result.error.issues) {
|
|
@@ -145,7 +145,7 @@ function checkEnvMcpOwners(step) {
|
|
|
145
145
|
issues.push({
|
|
146
146
|
check: "env-var-mcp",
|
|
147
147
|
severity: "error",
|
|
148
|
-
message: `Step "${step.key}" env var #${String(index + 1)} ("${entry.name}") ` + `belongs to MCP server "${entry.mcp}", but the step declares no MCP ` + `server with that key. Declared servers: ` + `${serverKeys.length > 0 ?
|
|
148
|
+
message: `Step "${step.key}" env var #${String(index + 1)} ("${entry.name}") ` + `belongs to MCP server "${entry.mcp}", but the step declares no MCP ` + `server with that key. Declared servers: ` + `${serverKeys.length > 0 ? listPaths2(serverKeys) : "(none)"}.`
|
|
149
149
|
});
|
|
150
150
|
});
|
|
151
151
|
return issues;
|
|
@@ -185,7 +185,7 @@ function checkRepo(steps) {
|
|
|
185
185
|
if (!step.repo)
|
|
186
186
|
continue;
|
|
187
187
|
const where = `Step "${step.key}" repo`;
|
|
188
|
-
const parsed =
|
|
188
|
+
const parsed = repoConfigInputSchema2.safeParse(step.repo);
|
|
189
189
|
if (!parsed.success) {
|
|
190
190
|
for (const issue of parsed.error.issues) {
|
|
191
191
|
const field = issue.path.map(String).join(".");
|
|
@@ -205,9 +205,9 @@ function checkRuntime(steps) {
|
|
|
205
205
|
const issues = [];
|
|
206
206
|
for (const step of steps) {
|
|
207
207
|
if (step.environment?.kind === "named") {
|
|
208
|
-
const
|
|
209
|
-
if (!
|
|
210
|
-
for (const issue of
|
|
208
|
+
const result = environmentNameSchema2.safeParse(step.environment.name);
|
|
209
|
+
if (!result.success) {
|
|
210
|
+
for (const issue of result.error.issues) {
|
|
211
211
|
issues.push({
|
|
212
212
|
check: "runtime",
|
|
213
213
|
severity: "error",
|
|
@@ -223,7 +223,7 @@ function checkRuntime(steps) {
|
|
|
223
223
|
if (runtime === undefined)
|
|
224
224
|
continue;
|
|
225
225
|
if (runtime.kind !== "devcontainer" && "config" in runtime) {
|
|
226
|
-
const config =
|
|
226
|
+
const config = devcontainerConfigPathSchema2.safeParse(runtime.config);
|
|
227
227
|
if (!config.success) {
|
|
228
228
|
for (const issue of config.error.issues) {
|
|
229
229
|
issues.push({
|
|
@@ -241,7 +241,7 @@ function checkRuntime(steps) {
|
|
|
241
241
|
message: `Step "${step.key}": code steps need a container, so Runtime.host() is not supported for codeStep. Use Runtime.managed.<id>() or Runtime.devcontainer(), or drop the runtime.`
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
|
-
const result =
|
|
244
|
+
const result = environmentRuntimeSchema2.safeParse(runtime);
|
|
245
245
|
if (result.success)
|
|
246
246
|
continue;
|
|
247
247
|
for (const issue of result.error.issues) {
|
|
@@ -275,14 +275,14 @@ function checkHealthChecks(steps) {
|
|
|
275
275
|
issues.push({
|
|
276
276
|
check: "health-check-mcp-server",
|
|
277
277
|
severity: "error",
|
|
278
|
-
message: `${where} names MCP server "${check.mcp}", but the step declares no ` + `such server in mcps. Declared servers: ${mcpServerKeys.length > 0 ?
|
|
278
|
+
message: `${where} names MCP server "${check.mcp}", but the step declares no ` + `such server in mcps. Declared servers: ${mcpServerKeys.length > 0 ? listPaths2([...mcpServerKeys].sort()) : "(none)"}.`
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
281
|
});
|
|
282
282
|
}
|
|
283
283
|
return issues;
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function validateDefinitionSpecs2(steps) {
|
|
286
286
|
const stepsByKey = new Map;
|
|
287
287
|
for (const step of steps) {
|
|
288
288
|
const existing = stepsByKey.get(step.key);
|
|
@@ -300,12 +300,12 @@ function validateDefinitionSpecs(steps) {
|
|
|
300
300
|
...checkRepo(steps)
|
|
301
301
|
];
|
|
302
302
|
}
|
|
303
|
-
function
|
|
304
|
-
const issues =
|
|
303
|
+
function assertValidDefinitionSpecs2(steps) {
|
|
304
|
+
const issues = validateDefinitionSpecs2(steps).filter((issue) => issue.severity === "error");
|
|
305
305
|
if (issues.length === 0)
|
|
306
306
|
return;
|
|
307
307
|
const header = issues.length === 1 ? "Definition validation failed:" : `Definition validation failed with ${String(issues.length)} problems:`;
|
|
308
308
|
throw new Error([header, ...issues.map((issue) => ` \u2022 ${issue.message}`)].join(`
|
|
309
309
|
`));
|
|
310
310
|
}
|
|
311
|
-
export {
|
|
311
|
+
export { listPaths2, validateDefinitionSpecs2, assertValidDefinitionSpecs2 };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
_enum
|
|
4
|
+
} from "./chunk-9ct3xypr.js";
|
|
5
|
+
|
|
6
|
+
// src/managed-runtimes.ts
|
|
7
|
+
var MANAGED_RUNTIME_IDS2 = ["bun1", "node24"];
|
|
8
|
+
var DEFAULT_CODE_STEP_RUNTIME_ID2 = "bun1";
|
|
9
|
+
var managedRuntimeIdSchema2 = _enum(MANAGED_RUNTIME_IDS2);
|
|
10
|
+
function isManagedRuntimeId2(value) {
|
|
11
|
+
return MANAGED_RUNTIME_IDS2.includes(value);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { MANAGED_RUNTIME_IDS2, DEFAULT_CODE_STEP_RUNTIME_ID2, managedRuntimeIdSchema2, isManagedRuntimeId2 };
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./chunk-
|
|
3
|
+
string
|
|
4
|
+
} from "./chunk-9ct3xypr.js";
|
|
5
5
|
|
|
6
6
|
// src/devcontainer-config-path.ts
|
|
7
|
-
var
|
|
8
|
-
var
|
|
7
|
+
var MAX_DEVCONTAINER_CONFIG_PATH_LENGTH2 = 255;
|
|
8
|
+
var DEVCONTAINER_CONFIG_BASENAMES2 = [
|
|
9
9
|
"devcontainer.json",
|
|
10
10
|
".devcontainer.json"
|
|
11
11
|
];
|
|
12
12
|
var LEADING_CURRENT_DIR = /^(?:\.\/)+/;
|
|
13
13
|
var DRIVE_LETTER = /^[A-Za-z]:/;
|
|
14
|
-
function
|
|
14
|
+
function normalizeDevcontainerConfigPath2(path) {
|
|
15
15
|
return path.replace(LEADING_CURRENT_DIR, "");
|
|
16
16
|
}
|
|
17
17
|
function basenameOf(path) {
|
|
18
18
|
return path.slice(Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\")) + 1);
|
|
19
19
|
}
|
|
20
|
-
var
|
|
20
|
+
var devcontainerConfigPathSchema2 = string().max(MAX_DEVCONTAINER_CONFIG_PATH_LENGTH2).overwrite(normalizeDevcontainerConfigPath2).refine((path) => !path.includes("\\"), {
|
|
21
21
|
message: "must use forward slashes, not backslashes"
|
|
22
22
|
}).refine((path) => !path.startsWith("/") && !DRIVE_LETTER.test(path), {
|
|
23
23
|
message: "must be relative to the repository root, not absolute"
|
|
24
24
|
}).refine((path) => !path.split("/").includes(".."), {
|
|
25
25
|
message: 'must not contain a ".." segment'
|
|
26
|
-
}).refine((path) =>
|
|
26
|
+
}).refine((path) => DEVCONTAINER_CONFIG_BASENAMES2.includes(basenameOf(path)), {
|
|
27
27
|
message: 'must end in "devcontainer.json" or ".devcontainer.json"'
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
export {
|
|
30
|
+
export { MAX_DEVCONTAINER_CONFIG_PATH_LENGTH2, DEVCONTAINER_CONFIG_BASENAMES2, normalizeDevcontainerConfigPath2, devcontainerConfigPathSchema2 };
|