@scarn/sdk 0.8.2 → 0.8.3
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/automations/define-automation.d.ts +20 -0
- package/dist/automations/index.d.ts +8 -0
- package/dist/automations/index.js +21 -0
- package/dist/automations/targets.d.ts +36 -0
- package/dist/automations/types.d.ts +116 -0
- package/dist/{chunk-nb0nkt71.js → chunk-01nfqm18.js} +1 -0
- package/dist/chunk-0vzq22dj.js +73 -0
- package/dist/chunk-11hbmexe.js +250 -0
- package/dist/{chunk-2fn95pdd.js → chunk-3gy0cb5f.js} +5 -1
- package/dist/{chunk-qrasq5xe.js → chunk-43y7tfn4.js} +33 -414
- package/dist/chunk-61jf8b6s.js +53 -0
- package/dist/chunk-76d1bwwz.js +119 -0
- package/dist/chunk-8z1wa3kd.js +109 -0
- package/dist/{chunk-p7yrcmqm.js → chunk-cnxaagfj.js} +2 -52
- package/dist/{chunk-cdanncng.js → chunk-ejzfdm1z.js} +21 -5
- package/dist/{chunk-gds7w7zh.js → chunk-fgfhvsee.js} +1 -4
- package/dist/{chunk-x9788y82.js → chunk-fyfvp6jx.js} +30 -13
- package/dist/{chunk-mz53r914.js → chunk-jj9pezwb.js} +22 -119
- package/dist/{chunk-8pyhrdgy.js → chunk-wnfj3wyx.js} +55 -11
- package/dist/chunk-x0hjhqrf.js +416 -0
- package/dist/chunk-y11p1q7r.js +159 -0
- package/dist/client.js +4 -2
- package/dist/contracts/automation-document/index.d.ts +5 -0
- package/dist/contracts/automation-document/index.js +34 -0
- package/dist/contracts/automation-document/schema.d.ts +363 -0
- package/dist/contracts/pipeline-document/built-ins.d.ts +1 -1
- package/dist/contracts/pipeline-document/index.js +9 -7
- package/dist/contracts/pipeline-document/schema.d.ts +3 -3
- package/dist/contracts/work-item-changes.d.ts +6 -0
- package/dist/contracts/work-item-changes.js +1 -0
- package/dist/defaults/index.js +2 -2
- package/dist/definitions/automations/automations-client.d.ts +178 -0
- package/dist/definitions/automations/index.d.ts +1 -0
- package/dist/definitions/automations/index.js +12 -0
- package/dist/definitions/pipelines/index.d.ts +0 -1
- package/dist/definitions/pipelines/index.js +4 -12
- package/dist/definitions/pipelines/work-item-fields.d.ts +11 -22
- package/dist/definitions/steps/define-code-step.d.ts +3 -1
- package/dist/definitions/steps/define-step.d.ts +13 -0
- package/dist/definitions/steps/index.js +9 -6
- package/dist/definitions/steps/repo.d.ts +11 -3
- package/dist/definitions/steps/runtime.d.ts +11 -12
- package/dist/definitions/steps/step-definitions-client.d.ts +12 -0
- package/dist/definitions/steps/step-features.d.ts +2 -2
- package/dist/definitions/steps/step-handle.d.ts +6 -1
- package/dist/definitions/validation/index.js +2 -2
- package/dist/generated/index.d.ts +2 -2
- package/dist/generated/sdk.gen.d.ts +37 -5
- package/dist/generated/types.gen.d.ts +2756 -1875
- package/dist/index.d.ts +1 -0
- package/dist/index.js +40 -30
- package/dist/pipelines/define-pipeline.d.ts +7 -7
- package/dist/pipelines/handles.d.ts +0 -5
- package/dist/pipelines/index.js +7 -4
- package/dist/pipelines/types.d.ts +13 -1
- package/dist/push/collect-definitions.d.ts +3 -8
- package/dist/push/collect-pipeline-documents.d.ts +13 -3
- package/dist/push/index.d.ts +2 -2
- package/dist/push/index.js +87 -124
- package/dist/push/push-from-directory.d.ts +10 -6
- package/dist/repo-config.d.ts +14 -4
- package/dist/repo-config.js +5 -1
- package/dist/task-plane-client.d.ts +40 -0
- package/package.json +13 -1
- package/dist/chunk-ra53p0v8.js +0 -256
- package/dist/definitions/pipelines/define-default-pipeline-assignment.d.ts +0 -263
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
PipelineDefinitions,
|
|
4
|
+
createClient
|
|
5
|
+
} from "./chunk-wnfj3wyx.js";
|
|
6
|
+
import {
|
|
7
|
+
exports_external
|
|
8
|
+
} from "./chunk-skzxcba3.js";
|
|
9
|
+
|
|
10
|
+
// src/definitions/pipelines/pipeline-definitions-client.ts
|
|
11
|
+
var pipelineDocumentIssueSchema = exports_external.object({
|
|
12
|
+
code: exports_external.string(),
|
|
13
|
+
path: exports_external.string(),
|
|
14
|
+
message: exports_external.string(),
|
|
15
|
+
hint: exports_external.string().optional()
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
class PipelineDefinitionsApiError extends Error {
|
|
19
|
+
code;
|
|
20
|
+
issues;
|
|
21
|
+
constructor(error) {
|
|
22
|
+
super(error.detail ?? error.title ?? JSON.stringify(error));
|
|
23
|
+
this.name = "PipelineDefinitionsApiError";
|
|
24
|
+
this.code = error.code;
|
|
25
|
+
this.issues = documentIssuesOf(error.meta);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function documentIssuesOf(meta) {
|
|
29
|
+
const errors = meta?.["errors"];
|
|
30
|
+
if (!Array.isArray(errors))
|
|
31
|
+
return [];
|
|
32
|
+
return errors.flatMap((error) => {
|
|
33
|
+
const parsed = pipelineDocumentIssueSchema.safeParse(error);
|
|
34
|
+
return parsed.success ? [parsed.data] : [];
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function unwrap(result) {
|
|
38
|
+
if (result.error !== undefined) {
|
|
39
|
+
throw new PipelineDefinitionsApiError(result.error);
|
|
40
|
+
}
|
|
41
|
+
return result.data;
|
|
42
|
+
}
|
|
43
|
+
function createPipelineDefinitionsClient(baseUrl) {
|
|
44
|
+
const client = createClient({ baseUrl });
|
|
45
|
+
return buildPipelineDefinitionsClient(new PipelineDefinitions({ client }));
|
|
46
|
+
}
|
|
47
|
+
var buildPipelineDefinitionsClient = (pipelineDefinitions) => ({
|
|
48
|
+
listByProjectId: async (projectId, options) => unwrap(await pipelineDefinitions.listPipelineDefinitions({
|
|
49
|
+
path: { projectId },
|
|
50
|
+
headers: options?.headers
|
|
51
|
+
})),
|
|
52
|
+
get: async (pipelineDefinitionId, options) => unwrap(await pipelineDefinitions.getPipelineDefinition({
|
|
53
|
+
path: { pipelineDefinitionId },
|
|
54
|
+
headers: options?.headers
|
|
55
|
+
})),
|
|
56
|
+
create: async (input, options) => unwrap(await pipelineDefinitions.createPipelineDefinition({
|
|
57
|
+
body: input,
|
|
58
|
+
headers: options?.headers
|
|
59
|
+
})),
|
|
60
|
+
publishVersion: async (pipelineDefinitionId, document, options) => unwrap(await pipelineDefinitions.publishPipelineDefinitionVersion({
|
|
61
|
+
path: { pipelineDefinitionId },
|
|
62
|
+
body: { document },
|
|
63
|
+
headers: options?.headers
|
|
64
|
+
})),
|
|
65
|
+
activateVersion: async (pipelineDefinitionId, version, options) => unwrap(await pipelineDefinitions.activatePipelineDefinitionVersion({
|
|
66
|
+
path: { pipelineDefinitionId, version },
|
|
67
|
+
headers: options?.headers
|
|
68
|
+
})),
|
|
69
|
+
listVersions: async (pipelineDefinitionId, options) => unwrap(await pipelineDefinitions.listPipelineDefinitionVersions({
|
|
70
|
+
path: { pipelineDefinitionId },
|
|
71
|
+
headers: options?.headers
|
|
72
|
+
})),
|
|
73
|
+
getVersion: async (pipelineDefinitionId, version, options) => unwrap(await pipelineDefinitions.getPipelineDefinitionVersion({
|
|
74
|
+
path: { pipelineDefinitionId, version },
|
|
75
|
+
headers: options?.headers
|
|
76
|
+
}))
|
|
77
|
+
});
|
|
78
|
+
// src/definitions/pipelines/work-item-fields.ts
|
|
79
|
+
var WORK_ITEM_TOP_LEVEL_FIELDS = [
|
|
80
|
+
"id",
|
|
81
|
+
"projectId",
|
|
82
|
+
"platform",
|
|
83
|
+
"platformId",
|
|
84
|
+
"platformKey",
|
|
85
|
+
"url",
|
|
86
|
+
"title",
|
|
87
|
+
"description",
|
|
88
|
+
"sourceCreatedAt",
|
|
89
|
+
"sourceUpdatedAt",
|
|
90
|
+
"createdByUserId",
|
|
91
|
+
"parentWorkItemId",
|
|
92
|
+
"createdAt",
|
|
93
|
+
"updatedAt"
|
|
94
|
+
];
|
|
95
|
+
var WORK_ITEM_FIELDS_PATH_PREFIX = "fields.";
|
|
96
|
+
function resolveWorkItemFieldPath(record, path) {
|
|
97
|
+
if (typeof record !== "object" || record === null)
|
|
98
|
+
return;
|
|
99
|
+
const asRecord = record;
|
|
100
|
+
if (path.startsWith(WORK_ITEM_FIELDS_PATH_PREFIX)) {
|
|
101
|
+
const fieldName = path.slice(WORK_ITEM_FIELDS_PATH_PREFIX.length);
|
|
102
|
+
const fields = asRecord["fields"];
|
|
103
|
+
if (typeof fields !== "object" || fields === null)
|
|
104
|
+
return;
|
|
105
|
+
return fields[fieldName];
|
|
106
|
+
}
|
|
107
|
+
return asRecord[path];
|
|
108
|
+
}
|
|
109
|
+
export { PipelineDefinitionsApiError, createPipelineDefinitionsClient, WORK_ITEM_TOP_LEVEL_FIELDS, WORK_ITEM_FIELDS_PATH_PREFIX, resolveWorkItemFieldPath };
|
|
@@ -3,30 +3,6 @@ import {
|
|
|
3
3
|
exports_external
|
|
4
4
|
} from "./chunk-skzxcba3.js";
|
|
5
5
|
|
|
6
|
-
// src/contracts/pipeline-document/json.ts
|
|
7
|
-
function isJsonObject(value) {
|
|
8
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9
|
-
}
|
|
10
|
-
function escapePointerSegment(segment) {
|
|
11
|
-
return String(segment).replaceAll("~", "~0").replaceAll("/", "~1");
|
|
12
|
-
}
|
|
13
|
-
function jsonPointer(segments) {
|
|
14
|
-
return segments.map((segment) => `/${escapePointerSegment(segment)}`).join("");
|
|
15
|
-
}
|
|
16
|
-
function deepEqual(left, right) {
|
|
17
|
-
if (left === right) {
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
if (Array.isArray(left)) {
|
|
21
|
-
return Array.isArray(right) && left.length === right.length && left.every((item, index) => deepEqual(item, right[index]));
|
|
22
|
-
}
|
|
23
|
-
if (isJsonObject(left) && isJsonObject(right)) {
|
|
24
|
-
const leftKeys = Object.keys(left);
|
|
25
|
-
const rightKeys = Object.keys(right);
|
|
26
|
-
return leftKeys.length === rightKeys.length && leftKeys.every((key) => Object.hasOwn(right, key) && deepEqual(left[key], right[key]));
|
|
27
|
-
}
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
6
|
// src/contracts/pipeline-document/conditions/operators.ts
|
|
31
7
|
var COMPARISON_OPERATORS = [
|
|
32
8
|
"equal",
|
|
@@ -292,31 +268,5 @@ var pipelineDocumentSchema = exports_external.strictObject({
|
|
|
292
268
|
function pipelineDocumentJsonSchema() {
|
|
293
269
|
return exports_external.toJSONSchema(pipelineDocumentSchema, { io: "input" });
|
|
294
270
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
if (next === undefined) {
|
|
298
|
-
return [];
|
|
299
|
-
}
|
|
300
|
-
const entries = next.routes.map((route, index) => ({
|
|
301
|
-
kind: "route",
|
|
302
|
-
index,
|
|
303
|
-
route,
|
|
304
|
-
pointer: ["routes", index]
|
|
305
|
-
}));
|
|
306
|
-
if (next.otherwise !== undefined) {
|
|
307
|
-
entries.push({
|
|
308
|
-
kind: "otherwise",
|
|
309
|
-
index: 0,
|
|
310
|
-
route: next.otherwise,
|
|
311
|
-
pointer: ["otherwise"]
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
return entries;
|
|
315
|
-
}
|
|
316
|
-
function routeAt(next, kind, index) {
|
|
317
|
-
if (next === undefined) {
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
return kind === "otherwise" ? next.otherwise : next.routes[index];
|
|
321
|
-
}
|
|
322
|
-
export { isJsonObject, jsonPointer, deepEqual, COMPARISON_OPERATORS, CONDITION_OPERATORS, COMPUTED_FUNCTIONS, ORDERING_OPERATORS, STRING_OPERATORS, DATE_OPERATORS, LIST_OPERATORS, NODE_ID_PATTERN, ALIAS_PATTERN, literalSchema, listSchema, argValueSchema, computedSourceSchema, conditionSchema, toleratedFailuresSchema, eachSchema, routeSchema, otherwiseSchema, startSchema, MATCH_MODES, nextSchema, retrySchema, catchSchema, stepNodeSchema, DEFAULT_MAX_TURNS, DECISION_BODY_MODES, decisionActionSchema, waitNodeSchema, succeedNodeSchema, failNodeSchema, nodeSchema, pipelineDocumentSchema, pipelineDocumentJsonSchema, routeEntries, routeAt };
|
|
271
|
+
|
|
272
|
+
export { COMPARISON_OPERATORS, CONDITION_OPERATORS, COMPUTED_FUNCTIONS, ORDERING_OPERATORS, STRING_OPERATORS, DATE_OPERATORS, LIST_OPERATORS, NODE_ID_PATTERN, ALIAS_PATTERN, literalSchema, listSchema, argValueSchema, computedSourceSchema, conditionSchema, toleratedFailuresSchema, eachSchema, routeSchema, otherwiseSchema, startSchema, MATCH_MODES, nextSchema, retrySchema, catchSchema, stepNodeSchema, DEFAULT_MAX_TURNS, DECISION_BODY_MODES, decisionActionSchema, waitNodeSchema, succeedNodeSchema, failNodeSchema, nodeSchema, pipelineDocumentSchema, pipelineDocumentJsonSchema };
|
|
@@ -7,22 +7,38 @@ import {
|
|
|
7
7
|
var MAX_REPO_COMMIT_MESSAGE_LENGTH = 500;
|
|
8
8
|
var REPO_COMMIT_MESSAGE_TOKEN_ROOTS = [
|
|
9
9
|
"input",
|
|
10
|
-
"result"
|
|
10
|
+
"result",
|
|
11
|
+
"workItem"
|
|
11
12
|
];
|
|
13
|
+
var REPO_COMMIT_MESSAGE_WORK_ITEM_KEYS = [
|
|
14
|
+
"title",
|
|
15
|
+
"platformKey"
|
|
16
|
+
];
|
|
17
|
+
function commitMessageUsesWorkItem(message) {
|
|
18
|
+
for (const match of message.matchAll(TOKEN_PATTERN)) {
|
|
19
|
+
if ((match[1] ?? "").split(".")[0] === "workItem")
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
12
24
|
var TOKEN_PATTERN = /\{\{([^}]+)\}\}/g;
|
|
13
25
|
function findDisallowedCommitMessageTokenRoots(message) {
|
|
14
26
|
const disallowed = [];
|
|
15
27
|
for (const match of message.matchAll(TOKEN_PATTERN)) {
|
|
16
|
-
const
|
|
17
|
-
|
|
28
|
+
const path = match[1] ?? "";
|
|
29
|
+
const [root = "", ...rest] = path.split(".");
|
|
30
|
+
if (!REPO_COMMIT_MESSAGE_TOKEN_ROOTS.includes(root)) {
|
|
18
31
|
disallowed.push(root);
|
|
32
|
+
} else if (root === "workItem" && (rest.length !== 1 || !REPO_COMMIT_MESSAGE_WORK_ITEM_KEYS.includes(rest[0] ?? ""))) {
|
|
33
|
+
disallowed.push(path);
|
|
34
|
+
}
|
|
19
35
|
}
|
|
20
36
|
return disallowed;
|
|
21
37
|
}
|
|
22
38
|
var repoCommitMessageSchema = exports_external.string().max(MAX_REPO_COMMIT_MESSAGE_LENGTH).refine((message) => !/[\r\n]/.test(message), {
|
|
23
39
|
message: "must be a single line"
|
|
24
40
|
}).refine((message) => findDisallowedCommitMessageTokenRoots(message).length === 0, {
|
|
25
|
-
message: `may only use {{${
|
|
41
|
+
message: `may only use {{input.\u2026}}, {{result.\u2026}}, {{${REPO_COMMIT_MESSAGE_WORK_ITEM_KEYS.map((key) => `workItem.${key}`).join("}} and {{")}}} tokens`
|
|
26
42
|
});
|
|
27
43
|
var onPushFailureSchema = exports_external.enum(["fail", "warn"]);
|
|
28
44
|
var repoConfigInputSchema = exports_external.discriminatedUnion("mode", [
|
|
@@ -71,4 +87,4 @@ function resolveRepoConfig(executionMode, input) {
|
|
|
71
87
|
};
|
|
72
88
|
}
|
|
73
89
|
|
|
74
|
-
export { MAX_REPO_COMMIT_MESSAGE_LENGTH, REPO_COMMIT_MESSAGE_TOKEN_ROOTS, findDisallowedCommitMessageTokenRoots, repoCommitMessageSchema, repoConfigInputSchema, repoConfigSchema, REPO_RUNTIME_SUPPORT, repoRuntimeMismatch, resolveRepoConfig };
|
|
90
|
+
export { MAX_REPO_COMMIT_MESSAGE_LENGTH, REPO_COMMIT_MESSAGE_TOKEN_ROOTS, REPO_COMMIT_MESSAGE_WORK_ITEM_KEYS, commitMessageUsesWorkItem, findDisallowedCommitMessageTokenRoots, repoCommitMessageSchema, repoConfigInputSchema, repoConfigSchema, REPO_RUNTIME_SUPPORT, repoRuntimeMismatch, resolveRepoConfig };
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
repoConfigInputSchema,
|
|
14
14
|
repoRuntimeMismatch
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ejzfdm1z.js";
|
|
16
16
|
import {
|
|
17
17
|
findArtifactMarkers
|
|
18
18
|
} from "./chunk-ngy1fdcx.js";
|
|
@@ -250,9 +250,6 @@ function checkManagedRuntime(step) {
|
|
|
250
250
|
if (!isManagedRuntimeId(step.managedRuntime)) {
|
|
251
251
|
problems.push(`unknown managed runtime; expected one of ${MANAGED_RUNTIME_IDS.join(", ")}`);
|
|
252
252
|
}
|
|
253
|
-
if (step.kind !== "code") {
|
|
254
|
-
problems.push("managed runtimes are only supported for code steps. Use Runtime.devcontainer() or Runtime.host() for defineStep");
|
|
255
|
-
}
|
|
256
253
|
if (step.executionMode === "no_workspace") {
|
|
257
254
|
problems.push('a managed runtime needs a workspace, but the step runs on the host (executionMode "no_workspace")');
|
|
258
255
|
}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
collectEnvPlaceholderNames,
|
|
4
|
+
isEnvPlaceholderValue,
|
|
5
|
+
openCodeMcpLocalConfigSchema,
|
|
6
|
+
openCodeMcpRefConfigSchema,
|
|
7
|
+
openCodeMcpRemoteConfigSchema
|
|
8
|
+
} from "./chunk-e1h021kq.js";
|
|
2
9
|
import {
|
|
3
10
|
stepHealthChecksInputSchema,
|
|
4
11
|
toolHealthCheckSchema
|
|
@@ -7,7 +14,7 @@ import {
|
|
|
7
14
|
makeHandle,
|
|
8
15
|
stepCall,
|
|
9
16
|
stepNode
|
|
10
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-jj9pezwb.js";
|
|
11
18
|
import {
|
|
12
19
|
ENV_VAR_NAME_PATTERN,
|
|
13
20
|
containsInputToken,
|
|
@@ -23,18 +30,11 @@ import {
|
|
|
23
30
|
import {
|
|
24
31
|
repoConfigInputSchema,
|
|
25
32
|
repoRuntimeMismatch
|
|
26
|
-
} from "./chunk-
|
|
27
|
-
import {
|
|
28
|
-
collectEnvPlaceholderNames,
|
|
29
|
-
isEnvPlaceholderValue,
|
|
30
|
-
openCodeMcpLocalConfigSchema,
|
|
31
|
-
openCodeMcpRefConfigSchema,
|
|
32
|
-
openCodeMcpRemoteConfigSchema
|
|
33
|
-
} from "./chunk-e1h021kq.js";
|
|
33
|
+
} from "./chunk-ejzfdm1z.js";
|
|
34
34
|
import {
|
|
35
35
|
StepDefinitions,
|
|
36
36
|
createClient
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-wnfj3wyx.js";
|
|
38
38
|
import {
|
|
39
39
|
buildArtifactMarker
|
|
40
40
|
} from "./chunk-ngy1fdcx.js";
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
} from "./chunk-y2pv8d6a.js";
|
|
44
44
|
import {
|
|
45
45
|
BUILT_IN_ERRORS
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-01nfqm18.js";
|
|
47
47
|
import {
|
|
48
48
|
$brand,
|
|
49
49
|
$input,
|
|
@@ -736,7 +736,8 @@ function compileRepo(repo, runtime, ctx = {}) {
|
|
|
736
736
|
return;
|
|
737
737
|
const spec = typeof repo === "function" ? repo({
|
|
738
738
|
input: createPromptInputProxy(["input"]),
|
|
739
|
-
result: createPromptInputProxy(["result"])
|
|
739
|
+
result: createPromptInputProxy(["result"]),
|
|
740
|
+
workItem: createPromptInputProxy(["workItem"])
|
|
740
741
|
}) : repo;
|
|
741
742
|
const where = ctx.stepKey ? `Step "${ctx.stepKey}" repo` : "repo";
|
|
742
743
|
const executionMode = executionModeOf(runtime);
|
|
@@ -1180,6 +1181,15 @@ function compileStepMaxTurns(stepKey, maxTurns) {
|
|
|
1180
1181
|
}
|
|
1181
1182
|
return maxTurns;
|
|
1182
1183
|
}
|
|
1184
|
+
function compileStepConcurrency(stepKey, concurrency) {
|
|
1185
|
+
if (!Number.isInteger(concurrency.max) || concurrency.max < 1) {
|
|
1186
|
+
throw new Error(`Step "${stepKey}": concurrency max must be an integer of at least 1.`);
|
|
1187
|
+
}
|
|
1188
|
+
if (!Number.isInteger(concurrency.waiting) || concurrency.waiting < 0) {
|
|
1189
|
+
throw new Error(`Step "${stepKey}": concurrency waiting must be a non-negative integer.`);
|
|
1190
|
+
}
|
|
1191
|
+
return { max: concurrency.max, waiting: concurrency.waiting };
|
|
1192
|
+
}
|
|
1183
1193
|
function toStepHandle(spec) {
|
|
1184
1194
|
const node = stepNode(spec);
|
|
1185
1195
|
const call = stepCall(node);
|
|
@@ -1257,6 +1267,9 @@ ${feature._promptAddition}` : feature._promptAddition;
|
|
|
1257
1267
|
errors: compileStepErrors(config2.key, config2.errors),
|
|
1258
1268
|
retryJson: compileStepRetry(config2.key, config2.retry, config2.errors ?? []),
|
|
1259
1269
|
...config2.maxTurns !== undefined ? { maxTurns: compileStepMaxTurns(config2.key, config2.maxTurns) } : {},
|
|
1270
|
+
...config2.concurrency !== undefined ? {
|
|
1271
|
+
concurrency: compileStepConcurrency(config2.key, config2.concurrency)
|
|
1272
|
+
} : {},
|
|
1260
1273
|
...config2.workItemPermissions !== undefined ? { workItemPermissions: [...config2.workItemPermissions] } : {}
|
|
1261
1274
|
};
|
|
1262
1275
|
return toStepHandle(spec);
|
|
@@ -1297,6 +1310,9 @@ function codeStep(config2) {
|
|
|
1297
1310
|
...repo !== undefined ? { repo } : {},
|
|
1298
1311
|
errors: compileStepErrors(config2.key, config2.errors),
|
|
1299
1312
|
retryJson: compileStepRetry(config2.key, config2.retry, config2.errors ?? []),
|
|
1313
|
+
...config2.concurrency !== undefined ? {
|
|
1314
|
+
concurrency: compileStepConcurrency(config2.key, config2.concurrency)
|
|
1315
|
+
} : {},
|
|
1300
1316
|
entrypoint: { fn: config2.fn }
|
|
1301
1317
|
};
|
|
1302
1318
|
return toStepHandle(spec);
|
|
@@ -1352,6 +1368,7 @@ var buildStepDefinitionsClient = (stepDefinitions) => {
|
|
|
1352
1368
|
maxAttempts: entry.maxAttempts
|
|
1353
1369
|
})),
|
|
1354
1370
|
maxTurns: spec.maxTurns ?? null,
|
|
1371
|
+
concurrency: spec.concurrency ?? null,
|
|
1355
1372
|
workItemPermissions: [...spec.workItemPermissions ?? []],
|
|
1356
1373
|
status: spec.status,
|
|
1357
1374
|
projectId
|
|
@@ -1463,4 +1480,4 @@ var Notify = {
|
|
|
1463
1480
|
[NOTIFICATION_RESULT_KEY]: fragments.flatMap((fragment) => fragment[NOTIFICATION_RESULT_KEY])
|
|
1464
1481
|
})
|
|
1465
1482
|
};
|
|
1466
|
-
export { ARTIFACT_BRAND, ArtifactTypes, normalizeArtifactAccept, artifact, Artifact, exports_z, createPromptInputProxy, createPromptTemplateContext, renderPromptTemplate, isSecretLookingEnvName, Env, normalizeEnv, Repo, compileRepo, Runtime, compileEnvironment, isMcpHandle, defineMcp, resolveMcpChecks, compileMcps, compileStepErrors, compileStepRetry, compileStepMaxTurns, toStepHandle, toStepSpec, defineStep, codeStep, createStepDefinitionsClient, Features, Notify };
|
|
1483
|
+
export { ARTIFACT_BRAND, ArtifactTypes, normalizeArtifactAccept, artifact, Artifact, exports_z, createPromptInputProxy, createPromptTemplateContext, renderPromptTemplate, isSecretLookingEnvName, Env, normalizeEnv, Repo, compileRepo, Runtime, compileEnvironment, isMcpHandle, defineMcp, resolveMcpChecks, compileMcps, compileStepErrors, compileStepRetry, compileStepMaxTurns, compileStepConcurrency, toStepHandle, toStepSpec, defineStep, codeStep, createStepDefinitionsClient, Features, Notify };
|
|
@@ -1,121 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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 formatIssue(issue) {
|
|
49
|
-
return `${formatSite(issue.site)} (${issue.pointer === "" ? "/" : issue.pointer}): ${issue.message}`;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
class PipelineBuildError 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) => ` ${formatIssue(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/registry.ts
|
|
73
|
-
var nodes = new WeakMap;
|
|
74
|
-
var targets = new WeakMap;
|
|
75
|
-
var eaches = new WeakMap;
|
|
76
|
-
var chains = new WeakMap;
|
|
77
|
-
var pendingChains = new Set;
|
|
78
|
-
function registerNode(value, node) {
|
|
79
|
-
nodes.set(value, node);
|
|
80
|
-
return value;
|
|
81
|
-
}
|
|
82
|
-
function registerTarget(value, target) {
|
|
83
|
-
targets.set(value, target);
|
|
84
|
-
return value;
|
|
85
|
-
}
|
|
86
|
-
function registerEach(value, each) {
|
|
87
|
-
eaches.set(value, each);
|
|
88
|
-
return value;
|
|
89
|
-
}
|
|
90
|
-
function registerChain(value, chain) {
|
|
91
|
-
chains.set(value, chain);
|
|
92
|
-
if (chain.next !== undefined) {
|
|
93
|
-
pendingChains.add(chain);
|
|
94
|
-
}
|
|
95
|
-
return value;
|
|
96
|
-
}
|
|
97
|
-
function isObject(value) {
|
|
98
|
-
return (typeof value === "object" || typeof value === "function") && value !== null;
|
|
99
|
-
}
|
|
100
|
-
function nodeOf(value) {
|
|
101
|
-
return isObject(value) ? nodes.get(value) : undefined;
|
|
102
|
-
}
|
|
103
|
-
function targetOf(value) {
|
|
104
|
-
return isObject(value) ? targets.get(value) : undefined;
|
|
105
|
-
}
|
|
106
|
-
function eachOf(value) {
|
|
107
|
-
return isObject(value) ? eaches.get(value) : undefined;
|
|
108
|
-
}
|
|
109
|
-
function chainOf(value) {
|
|
110
|
-
return isObject(value) ? chains.get(value) : undefined;
|
|
111
|
-
}
|
|
112
|
-
function requireNode(value, what) {
|
|
113
|
-
const node = nodeOf(value);
|
|
114
|
-
if (node === undefined) {
|
|
115
|
-
throw new AuthoringError(`${what} must be a step, decision or reply handle`);
|
|
116
|
-
}
|
|
117
|
-
return node;
|
|
118
|
-
}
|
|
2
|
+
import {
|
|
3
|
+
AuthoringError,
|
|
4
|
+
captureSite,
|
|
5
|
+
chainOf,
|
|
6
|
+
eachOf,
|
|
7
|
+
nodeOf,
|
|
8
|
+
registerChain,
|
|
9
|
+
registerNode,
|
|
10
|
+
registerTarget,
|
|
11
|
+
stepOn,
|
|
12
|
+
targetOf
|
|
13
|
+
} from "./chunk-y11p1q7r.js";
|
|
119
14
|
|
|
120
15
|
// src/pipelines/model.ts
|
|
121
16
|
function emptyChain(node) {
|
|
@@ -236,7 +131,15 @@ function checkArgs(node, args) {
|
|
|
236
131
|
function targetFn(node) {
|
|
237
132
|
return (args) => {
|
|
238
133
|
checkArgs(node, args);
|
|
239
|
-
|
|
134
|
+
const data = { node, args, site: captureSite() };
|
|
135
|
+
const value = { _tag: "pipeline_target", to: node.id };
|
|
136
|
+
if (node.kind === "step") {
|
|
137
|
+
Object.defineProperty(value, "on", {
|
|
138
|
+
value: stepOn(data),
|
|
139
|
+
enumerable: false
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return registerTarget(Object.freeze(value), data);
|
|
240
143
|
};
|
|
241
144
|
}
|
|
242
145
|
function partialFn(node) {
|
|
@@ -297,4 +200,4 @@ function bareStepHandle(source, local) {
|
|
|
297
200
|
return stepHandleFor(stepNode(source, local));
|
|
298
201
|
}
|
|
299
202
|
|
|
300
|
-
export {
|
|
203
|
+
export { makeHandle, stepNode, stepCall, waitHandle, bareStepHandle };
|
|
@@ -862,6 +862,12 @@ class Projects extends HeyApiClient {
|
|
|
862
862
|
listProjectWorkItemFieldOptions(options) {
|
|
863
863
|
return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/work-item-field-options", ...options });
|
|
864
864
|
}
|
|
865
|
+
listProjectWorkItemLabels(options) {
|
|
866
|
+
return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/work-item-labels", ...options });
|
|
867
|
+
}
|
|
868
|
+
listProjectWorkItemStatuses(options) {
|
|
869
|
+
return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/work-item-statuses", ...options });
|
|
870
|
+
}
|
|
865
871
|
getProject(options) {
|
|
866
872
|
return (options.client ?? this.client).get({ url: "/api/projects/{projectId}", ...options });
|
|
867
873
|
}
|
|
@@ -881,16 +887,6 @@ class Projects extends HeyApiClient {
|
|
|
881
887
|
listProjectMembers(options) {
|
|
882
888
|
return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/members", ...options });
|
|
883
889
|
}
|
|
884
|
-
updateProjectDefaultPipelineAssignment(options) {
|
|
885
|
-
return (options.client ?? this.client).put({
|
|
886
|
-
url: "/api/projects/{projectId}/default-pipeline-assignment",
|
|
887
|
-
...options,
|
|
888
|
-
headers: {
|
|
889
|
-
"Content-Type": "application/json",
|
|
890
|
-
...options.headers
|
|
891
|
-
}
|
|
892
|
-
});
|
|
893
|
-
}
|
|
894
890
|
updateProjectMemberPermissions(options) {
|
|
895
891
|
return (options.client ?? this.client).put({ url: "/api/projects/{projectId}/members/{userId}/permissions", ...options });
|
|
896
892
|
}
|
|
@@ -1154,6 +1150,37 @@ class PipelineDefinitions extends HeyApiClient {
|
|
|
1154
1150
|
}
|
|
1155
1151
|
}
|
|
1156
1152
|
|
|
1153
|
+
class Automations extends HeyApiClient {
|
|
1154
|
+
listAutomations(options) {
|
|
1155
|
+
return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/automations", ...options });
|
|
1156
|
+
}
|
|
1157
|
+
listWorkItemAutomations(options) {
|
|
1158
|
+
return (options.client ?? this.client).get({ url: "/api/work-items/{workItemId}/automations", ...options });
|
|
1159
|
+
}
|
|
1160
|
+
publishAutomation(options) {
|
|
1161
|
+
return (options.client ?? this.client).put({
|
|
1162
|
+
url: "/api/projects/{projectId}/automations/{key}",
|
|
1163
|
+
...options,
|
|
1164
|
+
headers: {
|
|
1165
|
+
"Content-Type": "application/json",
|
|
1166
|
+
...options.headers
|
|
1167
|
+
}
|
|
1168
|
+
});
|
|
1169
|
+
}
|
|
1170
|
+
enableAutomation(options) {
|
|
1171
|
+
return (options.client ?? this.client).post({ url: "/api/projects/{projectId}/automations/{key}/enable", ...options });
|
|
1172
|
+
}
|
|
1173
|
+
disableAutomation(options) {
|
|
1174
|
+
return (options.client ?? this.client).post({ url: "/api/projects/{projectId}/automations/{key}/disable", ...options });
|
|
1175
|
+
}
|
|
1176
|
+
detachWorkItemAutomation(options) {
|
|
1177
|
+
return (options.client ?? this.client).delete({ url: "/api/work-items/{workItemId}/automations/{key}", ...options });
|
|
1178
|
+
}
|
|
1179
|
+
attachWorkItemAutomation(options) {
|
|
1180
|
+
return (options.client ?? this.client).post({ url: "/api/work-items/{workItemId}/automations/{key}", ...options });
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1157
1184
|
class PipelineExecutions extends HeyApiClient {
|
|
1158
1185
|
listPipelineExecutions(options) {
|
|
1159
1186
|
return (options.client ?? this.client).get({ url: "/api/pipeline-executions", ...options });
|
|
@@ -1251,6 +1278,9 @@ class WorkItems extends HeyApiClient {
|
|
|
1251
1278
|
listWorkItemChildren(options) {
|
|
1252
1279
|
return (options.client ?? this.client).get({ url: "/api/work-items/{workItemId}/children", ...options });
|
|
1253
1280
|
}
|
|
1281
|
+
listWorkItemActivity(options) {
|
|
1282
|
+
return (options.client ?? this.client).get({ url: "/api/work-items/{workItemId}/activity", ...options });
|
|
1283
|
+
}
|
|
1254
1284
|
createWorkItem(options) {
|
|
1255
1285
|
return (options.client ?? this.client).post({
|
|
1256
1286
|
url: "/api/work-items",
|
|
@@ -1301,6 +1331,16 @@ class WorkItems extends HeyApiClient {
|
|
|
1301
1331
|
}
|
|
1302
1332
|
});
|
|
1303
1333
|
}
|
|
1334
|
+
labelWorkItem(options) {
|
|
1335
|
+
return (options.client ?? this.client).patch({
|
|
1336
|
+
url: "/api/work-items/{workItemId}/labels",
|
|
1337
|
+
...options,
|
|
1338
|
+
headers: {
|
|
1339
|
+
"Content-Type": "application/json",
|
|
1340
|
+
...options.headers
|
|
1341
|
+
}
|
|
1342
|
+
});
|
|
1343
|
+
}
|
|
1304
1344
|
setWorkItemParent(options) {
|
|
1305
1345
|
return (options.client ?? this.client).patch({
|
|
1306
1346
|
url: "/api/work-items/{workItemId}/parent",
|
|
@@ -1647,6 +1687,10 @@ class ScarnClient extends HeyApiClient {
|
|
|
1647
1687
|
get pipelineDefinitions() {
|
|
1648
1688
|
return this._pipelineDefinitions ??= new PipelineDefinitions({ client: this.client });
|
|
1649
1689
|
}
|
|
1690
|
+
_automations;
|
|
1691
|
+
get automations() {
|
|
1692
|
+
return this._automations ??= new Automations({ client: this.client });
|
|
1693
|
+
}
|
|
1650
1694
|
_pipelineExecutions;
|
|
1651
1695
|
get pipelineExecutions() {
|
|
1652
1696
|
return this._pipelineExecutions ??= new PipelineExecutions({ client: this.client });
|
|
@@ -1713,4 +1757,4 @@ class ScarnClient extends HeyApiClient {
|
|
|
1713
1757
|
}
|
|
1714
1758
|
}
|
|
1715
1759
|
|
|
1716
|
-
export { createClient, Api, Projects, StepDefinitions, Tasks, TaskRuns, PipelineDefinitions, PipelineExecutions, WorkItems, Conversations, WorkItemComments, WorkItemCommentDrafts, WorkItemBlocks, ProjectArtifacts, UserNotifications, Inbox, NotificationRules, ProjectIntegrations, GitHubIntegrations, ProjectInvites, Billing, Username, Secrets, ScarnClient };
|
|
1760
|
+
export { createClient, Api, Projects, StepDefinitions, Tasks, TaskRuns, PipelineDefinitions, Automations, PipelineExecutions, WorkItems, Conversations, WorkItemComments, WorkItemCommentDrafts, WorkItemBlocks, ProjectArtifacts, UserNotifications, Inbox, NotificationRules, ProjectIntegrations, GitHubIntegrations, ProjectInvites, Billing, Username, Secrets, ScarnClient };
|