@scarn/sdk 0.8.17 → 0.8.18

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 (62) hide show
  1. package/dist/{chunk-g2mzg278.js → chunk-0c60x3v8.js} +51 -59
  2. package/dist/{chunk-dhqeg0wf.js → chunk-2tmrw253.js} +1 -1
  3. package/dist/{chunk-r03knh9j.js → chunk-3zp2qtf8.js} +80 -1
  4. package/dist/{chunk-ar6hcj1r.js → chunk-6tra3gw8.js} +7 -1
  5. package/dist/{chunk-a04phj60.js → chunk-833ef6dg.js} +121 -260
  6. package/dist/{chunk-2ekz6tr5.js → chunk-aemxz9r7.js} +18 -2
  7. package/dist/chunk-e0pt5x0e.js +167 -0
  8. package/dist/chunk-mmy80pec.js +64 -0
  9. package/dist/chunk-mzj1j0p5.js +116 -0
  10. package/dist/{chunk-cdj0yqgs.js → chunk-pqtd0hr7.js} +12 -2
  11. package/dist/chunk-qgkx89eg.js +210 -0
  12. package/dist/chunk-rphfy0fj.js +167 -0
  13. package/dist/chunk-t1dq2c2s.js +224 -0
  14. package/dist/{chunk-qs7p11rp.js → chunk-tvjcfh6s.js} +5 -1
  15. package/dist/{chunk-1wnv6rb2.js → chunk-ymywp5ht.js} +1 -1
  16. package/dist/client.js +8 -2
  17. package/dist/connectors/catalog.d.ts +49 -0
  18. package/dist/connectors/index.d.ts +45 -0
  19. package/dist/connectors/index.js +41 -0
  20. package/dist/defaults/index.js +2 -2
  21. package/dist/definitions/automations/index.js +2 -2
  22. package/dist/definitions/environments/define-environment.d.ts +39 -0
  23. package/dist/definitions/environments/environments-client.d.ts +50 -0
  24. package/dist/definitions/environments/index.d.ts +6 -0
  25. package/dist/definitions/environments/index.js +97 -0
  26. package/dist/definitions/pipelines/index.js +2 -2
  27. package/dist/definitions/steps/compile-mcps.d.ts +8 -12
  28. package/dist/definitions/steps/define-code-step.d.ts +18 -11
  29. package/dist/definitions/steps/define-step.d.ts +14 -25
  30. package/dist/definitions/steps/env.d.ts +30 -8
  31. package/dist/definitions/steps/index.js +30 -13
  32. package/dist/definitions/steps/mcp-server-config.d.ts +19 -9
  33. package/dist/definitions/steps/repo.d.ts +56 -28
  34. package/dist/definitions/steps/runtime.d.ts +54 -39
  35. package/dist/definitions/steps/step-definitions-client.d.ts +222 -63
  36. package/dist/definitions/steps/step-handle.d.ts +8 -1
  37. package/dist/definitions/validation/index.js +6 -3
  38. package/dist/definitions/validation/validate-repo.d.ts +3 -7
  39. package/dist/definitions/validation/validate-runtime.d.ts +2 -7
  40. package/dist/env-vars.d.ts +57 -1
  41. package/dist/env-vars.js +7 -1
  42. package/dist/environment.d.ts +564 -0
  43. package/dist/environment.js +46 -0
  44. package/dist/generated/index.d.ts +2 -2
  45. package/dist/generated/sdk.gen.d.ts +26 -1
  46. package/dist/generated/types.gen.d.ts +2090 -187
  47. package/dist/index.d.ts +2 -0
  48. package/dist/index.js +94 -28
  49. package/dist/opencode-mcp.d.ts +75 -4
  50. package/dist/opencode-mcp.js +2 -1
  51. package/dist/push/code-step-lookup.d.ts +6 -0
  52. package/dist/push/code-step-lookup.js +3 -1
  53. package/dist/push/collect-definitions.d.ts +13 -0
  54. package/dist/push/index.js +127 -15
  55. package/dist/push/push-from-directory.d.ts +11 -2
  56. package/dist/repo-config.d.ts +88 -30
  57. package/dist/repo-config.js +21 -5
  58. package/dist/resolve-environment.d.ts +19 -0
  59. package/dist/resolve-environment.js +19 -0
  60. package/dist/task-plane-client.d.ts +124 -22
  61. package/package.json +17 -1
  62. package/dist/chunk-2sk92cnd.js +0 -103
@@ -1,5 +1,5 @@
1
1
  import { TaskRuns } from "./generated/sdk.gen";
2
- import type { GetApiTaskRunsByTaskRunIdLogsData, PostApiTaskRunsByTaskRunIdArtifactFailuresData, PostApiTaskRunsByTaskRunIdArtifactUploadUrlData, PostApiTaskRunsByTaskRunIdArtifactsData, PostApiTaskRunsByTaskRunIdBaseCommitData, PostApiTaskRunsByTaskRunIdCompletionsData, PostApiTaskRunsByTaskRunIdLogFeedTokenData, PostApiTaskRunsByTaskRunIdLogsData, PostApiTaskRunsByTaskRunIdSessionUploadUrlData, PostApiTaskRunsByTaskRunIdYieldsData, PostApiTaskRunsClaimsData } from "./generated/types.gen";
2
+ import type { GetApiTaskRunsByTaskRunIdLogsData, PostApiTaskRunsByTaskRunIdArtifactFailuresData, PostApiTaskRunsByTaskRunIdArtifactUploadUrlData, PostApiTaskRunsByTaskRunIdArtifactsData, PostApiTaskRunsByTaskRunIdBaseCommitData, PostApiTaskRunsByTaskRunIdCompletionsData, PostApiTaskRunsByTaskRunIdEnvironmentData, PostApiTaskRunsByTaskRunIdLogFeedTokenData, PostApiTaskRunsByTaskRunIdLogsData, PostApiTaskRunsByTaskRunIdSessionUploadUrlData, PostApiTaskRunsByTaskRunIdYieldsData, PostApiTaskRunsClaimsData } from "./generated/types.gen";
3
3
  type TaskRunRef = {
4
4
  taskRunId: string;
5
5
  };
@@ -409,36 +409,98 @@ declare const buildTaskPlaneClient: (taskRuns: TaskRuns) => {
409
409
  }>;
410
410
  };
411
411
  runtime: {
412
- executionMode: "workspace" | "no_workspace";
413
- devcontainerConfigPath: string | null;
414
- managedRuntime: "bun1" | "node24" | null;
415
- repo: {
416
- mode: "none";
412
+ environment: {
413
+ kind: "inline";
414
+ runtime?: {
415
+ kind: "devcontainer";
416
+ config?: string;
417
+ } | {
418
+ kind: "managed";
419
+ id: "bun1" | "node24";
420
+ } | {
421
+ kind: "host";
422
+ };
423
+ envJson?: Array<{
424
+ name: string;
425
+ source: "value";
426
+ value: string;
427
+ secret: boolean;
428
+ applies: "agent" | "setup" | "both";
429
+ } | {
430
+ name: string;
431
+ source: "inherit";
432
+ from: string;
433
+ secret: boolean;
434
+ optional: boolean;
435
+ default?: string;
436
+ mcp?: string;
437
+ applies: "agent" | "setup" | "both";
438
+ } | {
439
+ name: string;
440
+ source: "secret";
441
+ secretName: string;
442
+ applies: "agent" | "setup" | "both";
443
+ }> | null;
444
+ connectors?: Array<string>;
417
445
  } | {
446
+ kind: "named";
447
+ name: string;
448
+ version: number;
449
+ content: {
450
+ runtime?: {
451
+ kind: "devcontainer";
452
+ config?: string;
453
+ } | {
454
+ kind: "managed";
455
+ id: "bun1" | "node24";
456
+ } | {
457
+ kind: "host";
458
+ };
459
+ vars?: Array<{
460
+ name: string;
461
+ source: "value";
462
+ value: string;
463
+ secret: boolean;
464
+ applies: "agent" | "setup" | "both";
465
+ } | {
466
+ name: string;
467
+ source: "inherit";
468
+ from: string;
469
+ secret: boolean;
470
+ optional: boolean;
471
+ default?: string;
472
+ mcp?: string;
473
+ applies: "agent" | "setup" | "both";
474
+ } | {
475
+ name: string;
476
+ source: "secret";
477
+ secretName: string;
478
+ applies: "agent" | "setup" | "both";
479
+ }>;
480
+ connectors?: Array<string>;
481
+ description?: string;
482
+ };
483
+ } | {
484
+ kind: "named";
485
+ name: string;
486
+ notFound: true;
487
+ } | null;
488
+ repo: {
418
489
  mode: "readOnly";
419
490
  gitCredentials: "auto" | "none";
491
+ baseBranch: string | null;
420
492
  } | {
421
493
  mode: "readWrite";
422
494
  message: string | null;
423
495
  onPushFailure: "fail" | "warn";
424
496
  gitCredentials: "auto" | "none";
497
+ baseBranch: string | null;
498
+ workBranch: {
499
+ kind: "create";
500
+ } | {
501
+ kind: "base";
502
+ };
425
503
  };
426
- envJson: Array<{
427
- name: string;
428
- source: "value";
429
- value: string;
430
- secret: boolean;
431
- applies: "agent" | "setup" | "both";
432
- } | {
433
- name: string;
434
- source: "inherit";
435
- from: string;
436
- secret: boolean;
437
- optional: boolean;
438
- default?: string;
439
- mcp?: string;
440
- applies: "agent" | "setup" | "both";
441
- }> | null;
442
504
  healthChecksJson: Array<{
443
505
  name?: string;
444
506
  severity: "required" | "warn";
@@ -475,6 +537,16 @@ declare const buildTaskPlaneClient: (taskRuns: TaskRuns) => {
475
537
  execution?: number;
476
538
  };
477
539
  protocol?: "legacy" | "auto" | "2026-07-28";
540
+ workerVars?: Array<{
541
+ name: string;
542
+ source: "inherit";
543
+ from: string;
544
+ secret: boolean;
545
+ optional: boolean;
546
+ default?: string;
547
+ mcp?: string;
548
+ applies: "agent";
549
+ }>;
478
550
  } | {
479
551
  type: "remote";
480
552
  url: string;
@@ -497,9 +569,29 @@ declare const buildTaskPlaneClient: (taskRuns: TaskRuns) => {
497
569
  execution?: number;
498
570
  };
499
571
  protocol?: "legacy" | "auto" | "2026-07-28";
572
+ workerVars?: Array<{
573
+ name: string;
574
+ source: "inherit";
575
+ from: string;
576
+ secret: boolean;
577
+ optional: boolean;
578
+ default?: string;
579
+ mcp?: string;
580
+ applies: "agent";
581
+ }>;
500
582
  } | {
501
583
  type: "ref";
502
584
  name?: string;
585
+ workerVars?: Array<{
586
+ name: string;
587
+ source: "inherit";
588
+ from: string;
589
+ secret: boolean;
590
+ optional: boolean;
591
+ default?: string;
592
+ mcp?: string;
593
+ applies: "agent";
594
+ }>;
503
595
  disabled?: boolean;
504
596
  codemode?: boolean;
505
597
  timeout?: {
@@ -533,6 +625,16 @@ declare const buildTaskPlaneClient: (taskRuns: TaskRuns) => {
533
625
  baseCommit: string;
534
626
  baseBranch: string | null;
535
627
  }>;
628
+ /** Project secret values for a claimed run; values are never logged. */
629
+ resolveTaskRunEnvironment: ({ taskRunId, ...body }: TaskRunRef & PostApiTaskRunsByTaskRunIdEnvironmentData["body"]) => Promise<{
630
+ secrets: {
631
+ [key: string]: {
632
+ value: string;
633
+ expiresAt: string | null;
634
+ };
635
+ };
636
+ missing: Array<string>;
637
+ }>;
536
638
  readTaskRunWorkItem: ({ taskRunId, ...body }: TaskRunRef & {
537
639
  claimToken: string;
538
640
  workItemId: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@scarn/sdk",
4
- "version": "0.8.17",
4
+ "version": "0.8.18",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
@@ -36,6 +36,10 @@
36
36
  "import": "./dist/definitions/steps/index.js",
37
37
  "types": "./dist/definitions/steps/index.d.ts"
38
38
  },
39
+ "./definitions/environments": {
40
+ "import": "./dist/definitions/environments/index.js",
41
+ "types": "./dist/definitions/environments/index.d.ts"
42
+ },
39
43
  "./definitions/pipelines": {
40
44
  "import": "./dist/definitions/pipelines/index.js",
41
45
  "types": "./dist/definitions/pipelines/index.d.ts"
@@ -80,6 +84,10 @@
80
84
  "import": "./dist/opencode-mcp.js",
81
85
  "types": "./dist/opencode-mcp.d.ts"
82
86
  },
87
+ "./connectors": {
88
+ "import": "./dist/connectors/index.js",
89
+ "types": "./dist/connectors/index.d.ts"
90
+ },
83
91
  "./health-checks": {
84
92
  "import": "./dist/health-checks.js",
85
93
  "types": "./dist/health-checks.d.ts"
@@ -88,6 +96,14 @@
88
96
  "import": "./dist/env-vars.js",
89
97
  "types": "./dist/env-vars.d.ts"
90
98
  },
99
+ "./environment": {
100
+ "import": "./dist/environment.js",
101
+ "types": "./dist/environment.d.ts"
102
+ },
103
+ "./resolve-environment": {
104
+ "import": "./dist/resolve-environment.js",
105
+ "types": "./dist/resolve-environment.d.ts"
106
+ },
91
107
  "./devcontainer-config-path": {
92
108
  "import": "./dist/devcontainer-config-path.js",
93
109
  "types": "./dist/devcontainer-config-path.d.ts"
@@ -1,103 +0,0 @@
1
- // @bun
2
- import {
3
- exports_external
4
- } from "./chunk-yf15kdte.js";
5
-
6
- // src/repo-config.ts
7
- var MAX_REPO_COMMIT_MESSAGE_LENGTH = 500;
8
- var REPO_COMMIT_MESSAGE_TOKEN_ROOTS = [
9
- "input",
10
- "result",
11
- "workItem"
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
- }
24
- var TOKEN_PATTERN = /\{\{([^}]+)\}\}/g;
25
- function findDisallowedCommitMessageTokenRoots(message) {
26
- const disallowed = [];
27
- for (const match of message.matchAll(TOKEN_PATTERN)) {
28
- const path = match[1] ?? "";
29
- const [root = "", ...rest] = path.split(".");
30
- if (!REPO_COMMIT_MESSAGE_TOKEN_ROOTS.includes(root)) {
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
- }
35
- }
36
- return disallowed;
37
- }
38
- var repoCommitMessageSchema = exports_external.string().max(MAX_REPO_COMMIT_MESSAGE_LENGTH).refine((message) => !/[\r\n]/.test(message), {
39
- message: "must be a single line"
40
- }).refine((message) => findDisallowedCommitMessageTokenRoots(message).length === 0, {
41
- message: `may only use {{input.\u2026}}, {{result.\u2026}}, {{${REPO_COMMIT_MESSAGE_WORK_ITEM_KEYS.map((key) => `workItem.${key}`).join("}} and {{")}}} tokens`
42
- });
43
- var onPushFailureSchema = exports_external.enum(["fail", "warn"]);
44
- var repoGitCredentialsSchema = exports_external.enum(["auto", "none"]);
45
- var repoConfigInputSchema = exports_external.discriminatedUnion("mode", [
46
- exports_external.object({ mode: exports_external.literal("none") }).strict(),
47
- exports_external.object({
48
- mode: exports_external.literal("readOnly"),
49
- gitCredentials: repoGitCredentialsSchema.optional()
50
- }).strict(),
51
- exports_external.object({
52
- mode: exports_external.literal("readWrite"),
53
- message: repoCommitMessageSchema.nullish(),
54
- onPushFailure: onPushFailureSchema.optional(),
55
- gitCredentials: repoGitCredentialsSchema.optional()
56
- }).strict()
57
- ]);
58
- var repoConfigSchema = exports_external.discriminatedUnion("mode", [
59
- exports_external.object({ mode: exports_external.literal("none") }).strict(),
60
- exports_external.object({
61
- mode: exports_external.literal("readOnly"),
62
- gitCredentials: repoGitCredentialsSchema
63
- }).strict(),
64
- exports_external.object({
65
- mode: exports_external.literal("readWrite"),
66
- message: repoCommitMessageSchema.nullable(),
67
- onPushFailure: onPushFailureSchema,
68
- gitCredentials: repoGitCredentialsSchema
69
- }).strict()
70
- ]);
71
- var REPO_RUNTIME_SUPPORT = {
72
- workspace: {
73
- modes: ["readOnly", "readWrite"],
74
- default: "readWrite",
75
- unsupportedBecause: "a devcontainer step reads its config from the clone"
76
- },
77
- no_workspace: {
78
- modes: ["none"],
79
- default: "none",
80
- unsupportedBecause: "a host step has no clone"
81
- }
82
- };
83
- function repoRuntimeMismatch(executionMode, mode) {
84
- const support = REPO_RUNTIME_SUPPORT[executionMode];
85
- return support.modes.includes(mode) ? null : support.unsupportedBecause;
86
- }
87
- function resolveRepoConfig(executionMode, input) {
88
- const mode = input?.mode ?? REPO_RUNTIME_SUPPORT[executionMode].default;
89
- if (mode === "none")
90
- return { mode };
91
- const gitCredentials = (input && "gitCredentials" in input ? input.gitCredentials : undefined) ?? "auto";
92
- if (mode === "readOnly")
93
- return { mode, gitCredentials };
94
- const readWrite = input?.mode === "readWrite" ? input : undefined;
95
- return {
96
- mode,
97
- message: readWrite?.message ?? null,
98
- onPushFailure: readWrite?.onPushFailure ?? "fail",
99
- gitCredentials
100
- };
101
- }
102
-
103
- export { MAX_REPO_COMMIT_MESSAGE_LENGTH, REPO_COMMIT_MESSAGE_TOKEN_ROOTS, REPO_COMMIT_MESSAGE_WORK_ITEM_KEYS, commitMessageUsesWorkItem, findDisallowedCommitMessageTokenRoots, repoCommitMessageSchema, repoGitCredentialsSchema, repoConfigInputSchema, repoConfigSchema, REPO_RUNTIME_SUPPORT, repoRuntimeMismatch, resolveRepoConfig };