@scarn/sdk 0.0.0-stage → 0.8.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.
- package/dist/chunk-0y2fy5en.js +166 -0
- package/dist/chunk-3ctaaseb.js +1456 -0
- package/dist/chunk-4ggr8af6.js +30 -0
- package/dist/chunk-5zsavw98.js +91 -0
- package/dist/chunk-63f90zky.js +39 -0
- package/dist/chunk-700xe701.js +100 -0
- package/dist/chunk-ar6hcj1r.js +35 -0
- package/dist/chunk-cdanncng.js +74 -0
- package/dist/chunk-dp86pa6m.js +68 -0
- package/dist/chunk-e1h021kq.js +86 -0
- package/dist/chunk-gds7w7zh.js +330 -0
- package/dist/chunk-k4y5qt4y.js +14 -0
- package/dist/chunk-mz53r914.js +300 -0
- package/dist/chunk-ngy1fdcx.js +57 -0
- package/dist/chunk-p7yrcmqm.js +322 -0
- package/dist/chunk-rt9tq4j6.js +116 -0
- package/dist/chunk-skzxcba3.js +14282 -0
- package/dist/chunk-vfeytkqx.js +1687 -0
- package/dist/chunk-y2pv8d6a.js +162 -0
- package/dist/chunk-y64skrwp.js +17 -0
- package/dist/chunk-yjtaq94c.js +1094 -0
- package/dist/chunk-zm72ksz0.js +256 -0
- package/dist/client.d.ts +4 -0
- package/dist/client.js +58 -0
- package/dist/contracts/artifact-markers.d.ts +42 -0
- package/dist/contracts/artifact-markers.js +16 -0
- package/dist/contracts/artifacts.d.ts +67 -0
- package/dist/contracts/artifacts.js +27 -0
- package/dist/contracts/pipeline-document/built-ins.d.ts +23 -0
- package/dist/contracts/pipeline-document/conditions/operators.d.ts +8 -0
- package/dist/contracts/pipeline-document/index.d.ts +11 -0
- package/dist/contracts/pipeline-document/index.js +99 -0
- package/dist/contracts/pipeline-document/json.d.ts +35 -0
- package/dist/contracts/pipeline-document/routes.d.ts +16 -0
- package/dist/contracts/pipeline-document/schema.d.ts +780 -0
- package/dist/contracts/pipeline-document/step-contract.d.ts +11 -0
- package/dist/contracts/step-artifact-submissions.d.ts +71 -0
- package/dist/contracts/step-artifact-submissions.js +171 -0
- package/dist/defaults/atomic-json-file.d.ts +10 -0
- package/dist/defaults/auth-file.d.ts +14 -0
- package/dist/defaults/base-url.d.ts +1 -0
- package/dist/defaults/config-file.d.ts +46 -0
- package/dist/defaults/home-dir.d.ts +3 -0
- package/dist/defaults/index.d.ts +12 -0
- package/dist/defaults/index.js +1240 -0
- package/dist/defaults/legacy-config-migration.d.ts +27 -0
- package/dist/defaults/load-push-defaults.d.ts +25 -0
- package/dist/defaults/project-config.d.ts +32 -0
- package/dist/defaults/project-ref.d.ts +34 -0
- package/dist/definitions/artifacts/artifact.d.ts +62 -0
- package/dist/definitions/artifacts/index.d.ts +1 -0
- package/dist/definitions/pipelines/define-default-pipeline-assignment.d.ts +263 -0
- package/dist/definitions/pipelines/index.d.ts +3 -0
- package/dist/definitions/pipelines/index.js +26 -0
- package/dist/definitions/pipelines/pipeline-definitions-client.d.ts +208 -0
- package/dist/definitions/pipelines/work-item-fields.d.ts +93 -0
- package/dist/definitions/steps/compile-mcps.d.ts +34 -0
- package/dist/definitions/steps/define-code-step.d.ts +84 -0
- package/dist/definitions/steps/define-mcp.d.ts +79 -0
- package/dist/definitions/steps/define-step.d.ts +137 -0
- package/dist/definitions/steps/env.d.ts +136 -0
- package/dist/definitions/steps/index.d.ts +14 -0
- package/dist/definitions/steps/index.js +76 -0
- package/dist/definitions/steps/mcp-server-config.d.ts +102 -0
- package/dist/definitions/steps/prompt-template.d.ts +24 -0
- package/dist/definitions/steps/repo.d.ts +67 -0
- package/dist/definitions/steps/runtime.d.ts +115 -0
- package/dist/definitions/steps/step-definitions-client.d.ts +400 -0
- package/dist/definitions/steps/step-features.d.ts +109 -0
- package/dist/definitions/steps/step-handle.d.ts +25 -0
- package/dist/definitions/steps/step-ref.d.ts +19 -0
- package/dist/definitions/validation/index.d.ts +2 -0
- package/dist/definitions/validation/index.js +19 -0
- package/dist/definitions/validation/validate-artifact-markers.d.ts +3 -0
- package/dist/definitions/validation/validate-artifacts.d.ts +7 -0
- package/dist/definitions/validation/validate-definition-specs.d.ts +16 -0
- package/dist/definitions/validation/validate-env.d.ts +15 -0
- package/dist/definitions/validation/validate-repo.d.ts +13 -0
- package/dist/definitions/validation/validate-runtime.d.ts +12 -0
- package/dist/definitions/validation/validation-issue.d.ts +11 -0
- package/dist/devcontainer-config-path.d.ts +21 -0
- package/dist/devcontainer-config-path.js +15 -0
- package/dist/env-vars.d.ts +136 -0
- package/dist/env-vars.js +37 -0
- package/dist/eslint.d.ts +42 -0
- package/dist/eslint.js +127 -0
- package/dist/generated/client/client.gen.d.ts +2 -0
- package/dist/generated/client/index.d.ts +8 -0
- package/dist/generated/client/types.gen.d.ts +117 -0
- package/dist/generated/client/utils.gen.d.ts +33 -0
- package/dist/generated/client.gen.d.ts +12 -0
- package/dist/generated/core/auth.gen.d.ts +18 -0
- package/dist/generated/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/core/params.gen.d.ts +43 -0
- package/dist/generated/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/core/types.gen.d.ts +78 -0
- package/dist/generated/core/utils.gen.d.ts +19 -0
- package/dist/generated/index.d.ts +2 -0
- package/dist/generated/sdk.gen.d.ts +302 -0
- package/dist/generated/types.gen.d.ts +18375 -0
- package/dist/git-url/git-remote.d.ts +30 -0
- package/dist/git-url/git-repo-identity.d.ts +44 -0
- package/dist/git-url/git-repo-identity.js +161 -0
- package/dist/git-url/parse-git-host.d.ts +23 -0
- package/dist/health-checks.d.ts +169 -0
- package/dist/health-checks.js +21 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +296 -0
- package/dist/jsonc.d.ts +3 -0
- package/dist/jsonc.js +12 -0
- package/dist/managed-runtimes.d.ts +20 -0
- package/dist/managed-runtimes.js +15 -0
- package/dist/opencode-mcp.d.ts +313 -0
- package/dist/opencode-mcp.js +31 -0
- package/dist/pipelines/chain.d.ts +7 -0
- package/dist/pipelines/compile-args.d.ts +12 -0
- package/dist/pipelines/compile-chain.d.ts +9 -0
- package/dist/pipelines/compile-checks.d.ts +16 -0
- package/dist/pipelines/compile-state.d.ts +30 -0
- package/dist/pipelines/condition-data.d.ts +78 -0
- package/dist/pipelines/conditions.d.ts +47 -0
- package/dist/pipelines/context.d.ts +16 -0
- package/dist/pipelines/define-pipeline.d.ts +32 -0
- package/dist/pipelines/each.d.ts +5 -0
- package/dist/pipelines/errors.d.ts +26 -0
- package/dist/pipelines/handles.d.ts +29 -0
- package/dist/pipelines/index.d.ts +18 -0
- package/dist/pipelines/index.js +83 -0
- package/dist/pipelines/model.d.ts +103 -0
- package/dist/pipelines/nodes.d.ts +54 -0
- package/dist/pipelines/ref-types.d.ts +54 -0
- package/dist/pipelines/refs.d.ts +80 -0
- package/dist/pipelines/registry.d.ts +12 -0
- package/dist/pipelines/source.d.ts +17 -0
- package/dist/pipelines/types.d.ts +160 -0
- package/dist/push/code-step-lookup.d.ts +32 -0
- package/dist/push/code-step-lookup.js +12 -0
- package/dist/push/collect-definitions.d.ts +70 -0
- package/dist/push/collect-pipeline-documents.d.ts +14 -0
- package/dist/push/index.d.ts +6 -0
- package/dist/push/index.js +327 -0
- package/dist/push/push-from-directory.d.ts +37 -0
- package/dist/repo-config.d.ts +80 -0
- package/dist/repo-config.js +25 -0
- package/dist/scarn-config-parser.d.ts +29 -0
- package/dist/scarn-config-parser.js +10 -0
- package/dist/task-plane-client.d.ts +489 -0
- package/dist/z.d.ts +7 -0
- package/package.json +132 -4
- package/README.md +0 -3
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal remote-URL parsing shared by the `git-url` helpers. Not exported
|
|
3
|
+
* from the SDK entry. No `node:` imports: Next client components use it.
|
|
4
|
+
*
|
|
5
|
+
* Scp form (`git@host:path`), `ssh://`, `git+ssh://`, `ssh+git://`, `git://`,
|
|
6
|
+
* `http://` and `https://` are accepted; local paths, `file://` and anything
|
|
7
|
+
* else unrecognised yield `null`. The host is lowercased; the path is kept
|
|
8
|
+
* verbatim apart from dropping any query and fragment.
|
|
9
|
+
*
|
|
10
|
+
* Parsing follows `packages/worker/src/runtime/runtime-service/domain/git-mirror-key.ts`,
|
|
11
|
+
* which deliberately keeps the scheme and is not shared.
|
|
12
|
+
*/
|
|
13
|
+
export declare const DEFAULT_PORTS: Readonly<Record<string, string>>;
|
|
14
|
+
export type ParsedRemote = {
|
|
15
|
+
scheme: string;
|
|
16
|
+
host: string;
|
|
17
|
+
port: string | null;
|
|
18
|
+
path: string;
|
|
19
|
+
};
|
|
20
|
+
export type UrlFormParts = {
|
|
21
|
+
scheme: string;
|
|
22
|
+
prefix: string;
|
|
23
|
+
userinfo: string | null;
|
|
24
|
+
hostPort: string;
|
|
25
|
+
remainder: string;
|
|
26
|
+
};
|
|
27
|
+
export declare function parseRemote(rawUrl: string): ParsedRemote | null;
|
|
28
|
+
export declare function hasDefaultPort(remote: ParsedRemote): boolean;
|
|
29
|
+
export declare function splitUrlForm(value: string): UrlFormParts | null;
|
|
30
|
+
export declare function normalisePath(path: string): string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers for comparing and displaying git remote URLs. No `node:`
|
|
3
|
+
* imports: Next client components use this module.
|
|
4
|
+
*
|
|
5
|
+
* A repository's **identity key** is `host[:port]/path`, so every spelling of
|
|
6
|
+
* the same remote compares equal:
|
|
7
|
+
* - scp form (`git@host:path`), `ssh://`, `git+ssh://`, `ssh+git://`,
|
|
8
|
+
* `git://`, `http://` and `https://` are accepted;
|
|
9
|
+
* - the scheme, userinfo, query, fragment and default ports are dropped;
|
|
10
|
+
* - the host is lowercased, and a trailing `/` and `.git` are stripped;
|
|
11
|
+
* - the path is lowercased for `github.com` only, whose paths are
|
|
12
|
+
* case-insensitive;
|
|
13
|
+
* - local paths, `file://` and anything else unrecognised yield `null`.
|
|
14
|
+
*
|
|
15
|
+
* The identity key is for comparison only. A stored `gitUrl` is never
|
|
16
|
+
* rewritten to it, because workers clone the stored URL verbatim.
|
|
17
|
+
*/
|
|
18
|
+
export { parseGitHost } from "./parse-git-host";
|
|
19
|
+
export type { GitHost, GitHostKind } from "./parse-git-host";
|
|
20
|
+
/**
|
|
21
|
+
* The identity key for `rawUrl` (e.g. `"github.com/acme/repo"`), or `null`
|
|
22
|
+
* when it is a local path, a `file://` URL, or not a recognised remote.
|
|
23
|
+
*/
|
|
24
|
+
export declare function gitRepoIdentity(rawUrl: string): string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Whether two remote URLs point at the same repository: their identity keys
|
|
27
|
+
* match, or — when either has no identity key — the raw strings are equal.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isSameGitRepo(a: string, b: string): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* `rawUrl` with any credential removed, safe to print or put in a link. For
|
|
32
|
+
* `http(s)` the whole userinfo goes, since a bare username there is often a
|
|
33
|
+
* token; for other URL schemes only a `:password` part goes, keeping an
|
|
34
|
+
* ssh-style `git@`. Anything not in URL form is returned unchanged.
|
|
35
|
+
*/
|
|
36
|
+
export declare function stripGitUrlCredentials(rawUrl: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* The GitHub `owner`/`name` of `rawUrl`, in the casing the URL uses, or `null`
|
|
39
|
+
* when it is not a `github.com/<owner>/<name>` remote.
|
|
40
|
+
*/
|
|
41
|
+
export declare function parseGitHubRepo(rawUrl: string): {
|
|
42
|
+
owner: string;
|
|
43
|
+
name: string;
|
|
44
|
+
} | null;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import"../chunk-y64skrwp.js";
|
|
3
|
+
|
|
4
|
+
// src/git-url/git-remote.ts
|
|
5
|
+
var DEFAULT_PORTS = {
|
|
6
|
+
http: "80",
|
|
7
|
+
https: "443",
|
|
8
|
+
ssh: "22",
|
|
9
|
+
"git+ssh": "22",
|
|
10
|
+
"ssh+git": "22",
|
|
11
|
+
git: "9418"
|
|
12
|
+
};
|
|
13
|
+
var URL_FORM = /^([a-zA-Z][a-zA-Z0-9+.-]*):\/\/(.*)$/s;
|
|
14
|
+
var SCP_FORM = /^(?:([^@/:\s]+)@)?([^@/:\s[\]]+):(?!:)(.+)$/;
|
|
15
|
+
var HOST_PORT = /^(\[[^\]]+\]|[^:[\]]+)(?::(\d*))?$/;
|
|
16
|
+
function parseRemote(rawUrl) {
|
|
17
|
+
const trimmed = rawUrl.trim();
|
|
18
|
+
if (trimmed === "") {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const urlForm = splitUrlForm(trimmed);
|
|
22
|
+
if (urlForm !== null) {
|
|
23
|
+
return parseUrlForm(urlForm);
|
|
24
|
+
}
|
|
25
|
+
if (URL_FORM.test(trimmed) || trimmed.startsWith("/")) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return parseScpForm(trimmed);
|
|
29
|
+
}
|
|
30
|
+
function hasDefaultPort(remote) {
|
|
31
|
+
return remote.port === null || remote.port === DEFAULT_PORTS[remote.scheme];
|
|
32
|
+
}
|
|
33
|
+
function splitUrlForm(value) {
|
|
34
|
+
const match = URL_FORM.exec(value);
|
|
35
|
+
if (!match) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const [, rawScheme = "", rest = ""] = match;
|
|
39
|
+
const scheme = rawScheme.toLowerCase();
|
|
40
|
+
if (!(scheme in DEFAULT_PORTS)) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
const authorityEnd = rest.search(/[/?#]/);
|
|
44
|
+
const authority = authorityEnd === -1 ? rest : rest.slice(0, authorityEnd);
|
|
45
|
+
const remainder = authorityEnd === -1 ? "" : rest.slice(authorityEnd);
|
|
46
|
+
const at = authority.lastIndexOf("@");
|
|
47
|
+
return {
|
|
48
|
+
scheme,
|
|
49
|
+
prefix: `${rawScheme}://`,
|
|
50
|
+
userinfo: at === -1 ? null : authority.slice(0, at),
|
|
51
|
+
hostPort: at === -1 ? authority : authority.slice(at + 1),
|
|
52
|
+
remainder
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function normalisePath(path) {
|
|
56
|
+
return path.replace(/^\/+/, "").replace(/\/+$/, "").replace(/\.git$/, "").replace(/\/+$/, "");
|
|
57
|
+
}
|
|
58
|
+
function parseUrlForm(parts) {
|
|
59
|
+
const match = HOST_PORT.exec(parts.hostPort);
|
|
60
|
+
if (!match) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
const [, host = "", port = ""] = match;
|
|
64
|
+
return {
|
|
65
|
+
scheme: parts.scheme,
|
|
66
|
+
host: host.toLowerCase(),
|
|
67
|
+
port: port === "" ? null : port,
|
|
68
|
+
path: parts.remainder.replace(/[?#].*$/s, "")
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function parseScpForm(value) {
|
|
72
|
+
const match = SCP_FORM.exec(value);
|
|
73
|
+
if (!match) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
const [, , host = "", path = ""] = match;
|
|
77
|
+
if (host.length === 1) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
return { scheme: "ssh", host: host.toLowerCase(), port: null, path };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// src/git-url/parse-git-host.ts
|
|
84
|
+
var OTHER = { host: "other" };
|
|
85
|
+
function parseGitHost(rawUrl) {
|
|
86
|
+
const parsed = parseRemote(rawUrl);
|
|
87
|
+
if (parsed === null || !hasDefaultPort(parsed)) {
|
|
88
|
+
return OTHER;
|
|
89
|
+
}
|
|
90
|
+
const segments = normalisePath(parsed.path).split("/");
|
|
91
|
+
if (segments.length !== 2) {
|
|
92
|
+
return OTHER;
|
|
93
|
+
}
|
|
94
|
+
const [first = "", second = ""] = segments;
|
|
95
|
+
if (first === "" || second === "") {
|
|
96
|
+
return OTHER;
|
|
97
|
+
}
|
|
98
|
+
switch (parsed.host) {
|
|
99
|
+
case "github.com":
|
|
100
|
+
return {
|
|
101
|
+
host: "github",
|
|
102
|
+
owner: first,
|
|
103
|
+
name: second,
|
|
104
|
+
webUrl: `https://github.com/${first}/${second}`
|
|
105
|
+
};
|
|
106
|
+
case "bitbucket.org":
|
|
107
|
+
return {
|
|
108
|
+
host: "bitbucket",
|
|
109
|
+
workspace: first,
|
|
110
|
+
slug: second,
|
|
111
|
+
webUrl: `https://bitbucket.org/${first}/${second}`
|
|
112
|
+
};
|
|
113
|
+
default:
|
|
114
|
+
return OTHER;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// src/git-url/git-repo-identity.ts
|
|
119
|
+
var HTTP_SCHEMES = new Set(["http", "https"]);
|
|
120
|
+
var CASE_INSENSITIVE_PATH_HOSTS = new Set(["github.com"]);
|
|
121
|
+
function gitRepoIdentity(rawUrl) {
|
|
122
|
+
const parsed = parseRemote(rawUrl);
|
|
123
|
+
if (parsed === null) {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
const path = normalisePath(parsed.path);
|
|
127
|
+
if (path === "") {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
const port = parsed.port === null || hasDefaultPort(parsed) ? "" : `:${parsed.port}`;
|
|
131
|
+
const caseFoldedPath = CASE_INSENSITIVE_PATH_HOSTS.has(parsed.host) ? path.toLowerCase() : path;
|
|
132
|
+
return `${parsed.host}${port}/${caseFoldedPath}`;
|
|
133
|
+
}
|
|
134
|
+
function isSameGitRepo(a, b) {
|
|
135
|
+
const left = gitRepoIdentity(a);
|
|
136
|
+
const right = gitRepoIdentity(b);
|
|
137
|
+
if (left === null || right === null) {
|
|
138
|
+
return a === b;
|
|
139
|
+
}
|
|
140
|
+
return left === right;
|
|
141
|
+
}
|
|
142
|
+
function stripGitUrlCredentials(rawUrl) {
|
|
143
|
+
const parts = splitUrlForm(rawUrl.trim());
|
|
144
|
+
if (parts === null || parts.userinfo === null) {
|
|
145
|
+
return rawUrl;
|
|
146
|
+
}
|
|
147
|
+
const keptUser = HTTP_SCHEMES.has(parts.scheme) ? "" : parts.userinfo.split(":")[0] ?? "";
|
|
148
|
+
const userPart = keptUser === "" ? "" : `${keptUser}@`;
|
|
149
|
+
return `${parts.prefix}${userPart}${parts.hostPort}${parts.remainder}`;
|
|
150
|
+
}
|
|
151
|
+
function parseGitHubRepo(rawUrl) {
|
|
152
|
+
const repo = parseGitHost(rawUrl);
|
|
153
|
+
return repo.host === "github" ? { owner: repo.owner, name: repo.name } : null;
|
|
154
|
+
}
|
|
155
|
+
export {
|
|
156
|
+
gitRepoIdentity,
|
|
157
|
+
isSameGitRepo,
|
|
158
|
+
parseGitHost,
|
|
159
|
+
parseGitHubRepo,
|
|
160
|
+
stripGitUrlCredentials
|
|
161
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detects which supported repo host a git remote URL points at. No `node:`
|
|
3
|
+
* imports: Next client components use this module.
|
|
4
|
+
*
|
|
5
|
+
* Only `github.com/<owner>/<name>` and `bitbucket.org/<workspace>/<slug>` on
|
|
6
|
+
* the default port are recognised; every other remote, local path or
|
|
7
|
+
* unparseable string is `other`. Path segments keep the casing the URL uses.
|
|
8
|
+
*/
|
|
9
|
+
export type GitHost = {
|
|
10
|
+
host: "github";
|
|
11
|
+
owner: string;
|
|
12
|
+
name: string;
|
|
13
|
+
webUrl: string;
|
|
14
|
+
} | {
|
|
15
|
+
host: "bitbucket";
|
|
16
|
+
workspace: string;
|
|
17
|
+
slug: string;
|
|
18
|
+
webUrl: string;
|
|
19
|
+
} | {
|
|
20
|
+
host: "other";
|
|
21
|
+
};
|
|
22
|
+
export type GitHostKind = GitHost["host"];
|
|
23
|
+
export declare function parseGitHost(rawUrl: string): GitHost;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Severity of a step-declared health check.
|
|
4
|
+
*
|
|
5
|
+
* `required` (default) fails the step immediately if the check fails.
|
|
6
|
+
* `warn` is advisory — it is reported but never fails the step.
|
|
7
|
+
*/
|
|
8
|
+
export declare const healthCheckSeverityValues: readonly ["required", "warn"];
|
|
9
|
+
export type HealthCheckSeverity = (typeof healthCheckSeverityValues)[number];
|
|
10
|
+
/**
|
|
11
|
+
* A health check verified by forcing a real OpenCode tool call against the
|
|
12
|
+
* launched environment before the agent starts working.
|
|
13
|
+
*
|
|
14
|
+
* `tool` is a bare tool name when `mcp` is set (resolved at runtime to
|
|
15
|
+
* `${mcp}_${tool}`, matching OpenCode's MCP tool-naming convention), or a flat
|
|
16
|
+
* tool id otherwise (plugin tools, standalone tools, built-ins already share
|
|
17
|
+
* one flat namespace, so no qualifier applies).
|
|
18
|
+
*/
|
|
19
|
+
export declare const toolHealthCheckSchema: z.ZodObject<{
|
|
20
|
+
name: z.ZodOptional<z.ZodString>;
|
|
21
|
+
severity: z.ZodDefault<z.ZodEnum<{
|
|
22
|
+
required: "required";
|
|
23
|
+
warn: "warn";
|
|
24
|
+
}>>;
|
|
25
|
+
timeoutSeconds: z.ZodDefault<z.ZodNumber>;
|
|
26
|
+
serialGroup: z.ZodOptional<z.ZodString>;
|
|
27
|
+
kind: z.ZodDefault<z.ZodLiteral<"tool">>;
|
|
28
|
+
tool: z.ZodString;
|
|
29
|
+
mcp: z.ZodOptional<z.ZodString>;
|
|
30
|
+
args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
/**
|
|
33
|
+
* A health check verified by running a command through OpenCode's `bash`
|
|
34
|
+
* tool inside the step's actual execution environment, and reading the real
|
|
35
|
+
* exit code back out of the tool result (not just call-completion status —
|
|
36
|
+
* see `force-and-verify-cli-health-check.ts`).
|
|
37
|
+
*/
|
|
38
|
+
export declare const cliHealthCheckSchema: z.ZodObject<{
|
|
39
|
+
name: z.ZodOptional<z.ZodString>;
|
|
40
|
+
severity: z.ZodDefault<z.ZodEnum<{
|
|
41
|
+
required: "required";
|
|
42
|
+
warn: "warn";
|
|
43
|
+
}>>;
|
|
44
|
+
timeoutSeconds: z.ZodDefault<z.ZodNumber>;
|
|
45
|
+
serialGroup: z.ZodOptional<z.ZodString>;
|
|
46
|
+
kind: z.ZodLiteral<"cli">;
|
|
47
|
+
command: z.ZodArray<z.ZodString>;
|
|
48
|
+
expectExitCode: z.ZodDefault<z.ZodInt>;
|
|
49
|
+
}, z.core.$strict>;
|
|
50
|
+
export declare const healthCheckSchema: z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
51
|
+
name: z.ZodOptional<z.ZodString>;
|
|
52
|
+
severity: z.ZodDefault<z.ZodEnum<{
|
|
53
|
+
required: "required";
|
|
54
|
+
warn: "warn";
|
|
55
|
+
}>>;
|
|
56
|
+
timeoutSeconds: z.ZodDefault<z.ZodNumber>;
|
|
57
|
+
serialGroup: z.ZodOptional<z.ZodString>;
|
|
58
|
+
kind: z.ZodDefault<z.ZodLiteral<"tool">>;
|
|
59
|
+
tool: z.ZodString;
|
|
60
|
+
mcp: z.ZodOptional<z.ZodString>;
|
|
61
|
+
args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
62
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
63
|
+
name: z.ZodOptional<z.ZodString>;
|
|
64
|
+
severity: z.ZodDefault<z.ZodEnum<{
|
|
65
|
+
required: "required";
|
|
66
|
+
warn: "warn";
|
|
67
|
+
}>>;
|
|
68
|
+
timeoutSeconds: z.ZodDefault<z.ZodNumber>;
|
|
69
|
+
serialGroup: z.ZodOptional<z.ZodString>;
|
|
70
|
+
kind: z.ZodLiteral<"cli">;
|
|
71
|
+
command: z.ZodArray<z.ZodString>;
|
|
72
|
+
expectExitCode: z.ZodDefault<z.ZodInt>;
|
|
73
|
+
}, z.core.$strict>], "kind">>;
|
|
74
|
+
/**
|
|
75
|
+
* The full value of a step's `healthChecks` field.
|
|
76
|
+
*/
|
|
77
|
+
export declare const healthChecksSchema: z.ZodArray<z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
78
|
+
name: z.ZodOptional<z.ZodString>;
|
|
79
|
+
severity: z.ZodDefault<z.ZodEnum<{
|
|
80
|
+
required: "required";
|
|
81
|
+
warn: "warn";
|
|
82
|
+
}>>;
|
|
83
|
+
timeoutSeconds: z.ZodDefault<z.ZodNumber>;
|
|
84
|
+
serialGroup: z.ZodOptional<z.ZodString>;
|
|
85
|
+
kind: z.ZodDefault<z.ZodLiteral<"tool">>;
|
|
86
|
+
tool: z.ZodString;
|
|
87
|
+
mcp: z.ZodOptional<z.ZodString>;
|
|
88
|
+
args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
89
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
90
|
+
name: z.ZodOptional<z.ZodString>;
|
|
91
|
+
severity: z.ZodDefault<z.ZodEnum<{
|
|
92
|
+
required: "required";
|
|
93
|
+
warn: "warn";
|
|
94
|
+
}>>;
|
|
95
|
+
timeoutSeconds: z.ZodDefault<z.ZodNumber>;
|
|
96
|
+
serialGroup: z.ZodOptional<z.ZodString>;
|
|
97
|
+
kind: z.ZodLiteral<"cli">;
|
|
98
|
+
command: z.ZodArray<z.ZodString>;
|
|
99
|
+
expectExitCode: z.ZodDefault<z.ZodInt>;
|
|
100
|
+
}, z.core.$strict>], "kind">>>;
|
|
101
|
+
export type ToolHealthCheck = z.infer<typeof toolHealthCheckSchema>;
|
|
102
|
+
export type CliHealthCheck = z.infer<typeof cliHealthCheckSchema>;
|
|
103
|
+
export type HealthCheck = z.infer<typeof healthCheckSchema>;
|
|
104
|
+
export type HealthChecks = z.infer<typeof healthChecksSchema>;
|
|
105
|
+
/**
|
|
106
|
+
* The pre-parse authoring shape of a single health check — what a step
|
|
107
|
+
* author actually writes in `defineStep({ healthChecks: [...] })` — as
|
|
108
|
+
* opposed to `HealthCheck`, the post-parse output shape `packages/worker`'s
|
|
109
|
+
* runner narrows on (`kind` always present, defaulted).
|
|
110
|
+
*
|
|
111
|
+
* Derived from the two arm schemas directly (`z.input<typeof
|
|
112
|
+
* toolHealthCheckSchema | typeof cliHealthCheckSchema>`), not from
|
|
113
|
+
* `healthCheckSchema`/`healthChecksSchema` — those are `z.preprocess`-wrapped,
|
|
114
|
+
* and a preprocessed schema's `z.input` type collapses to `unknown` (the
|
|
115
|
+
* preprocess function's own input is unconstrained), so it can't back a
|
|
116
|
+
* real authoring-time type. `kind` is optional on the tool arm (it
|
|
117
|
+
* defaults to `"tool"` — decision ledger #2's "omit `kind` for a tool
|
|
118
|
+
* check" ergonomics apply at the authoring layer too, not just to legacy
|
|
119
|
+
* persisted rows) and a required literal `"cli"` on the cli arm (no
|
|
120
|
+
* default exists for it).
|
|
121
|
+
*/
|
|
122
|
+
export type HealthCheckInput = z.input<typeof toolHealthCheckSchema> | z.input<typeof cliHealthCheckSchema>;
|
|
123
|
+
/** The pre-parse authoring shape of a step's `healthChecks` field. */
|
|
124
|
+
export type HealthChecksInput = HealthCheckInput[];
|
|
125
|
+
/**
|
|
126
|
+
* A `tool` check as written in `defineStep({ healthChecks })`: a plugin or
|
|
127
|
+
* built-in tool, never an MCP tool. MCP health checks are declared on the
|
|
128
|
+
* server with `defineMcp`, which compiles them to wire checks carrying `mcp`.
|
|
129
|
+
*/
|
|
130
|
+
export declare const stepToolHealthCheckSchema: z.ZodObject<{
|
|
131
|
+
name: z.ZodOptional<z.ZodString>;
|
|
132
|
+
args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
133
|
+
kind: z.ZodDefault<z.ZodLiteral<"tool">>;
|
|
134
|
+
severity: z.ZodDefault<z.ZodEnum<{
|
|
135
|
+
required: "required";
|
|
136
|
+
warn: "warn";
|
|
137
|
+
}>>;
|
|
138
|
+
timeoutSeconds: z.ZodDefault<z.ZodNumber>;
|
|
139
|
+
serialGroup: z.ZodOptional<z.ZodString>;
|
|
140
|
+
tool: z.ZodString;
|
|
141
|
+
}, z.core.$strict>;
|
|
142
|
+
/** The value of `defineStep({ healthChecks })`: `cli` and non-MCP `tool` checks. */
|
|
143
|
+
export declare const stepHealthChecksInputSchema: z.ZodArray<z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
144
|
+
name: z.ZodOptional<z.ZodString>;
|
|
145
|
+
args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
146
|
+
kind: z.ZodDefault<z.ZodLiteral<"tool">>;
|
|
147
|
+
severity: z.ZodDefault<z.ZodEnum<{
|
|
148
|
+
required: "required";
|
|
149
|
+
warn: "warn";
|
|
150
|
+
}>>;
|
|
151
|
+
timeoutSeconds: z.ZodDefault<z.ZodNumber>;
|
|
152
|
+
serialGroup: z.ZodOptional<z.ZodString>;
|
|
153
|
+
tool: z.ZodString;
|
|
154
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
155
|
+
name: z.ZodOptional<z.ZodString>;
|
|
156
|
+
severity: z.ZodDefault<z.ZodEnum<{
|
|
157
|
+
required: "required";
|
|
158
|
+
warn: "warn";
|
|
159
|
+
}>>;
|
|
160
|
+
timeoutSeconds: z.ZodDefault<z.ZodNumber>;
|
|
161
|
+
serialGroup: z.ZodOptional<z.ZodString>;
|
|
162
|
+
kind: z.ZodLiteral<"cli">;
|
|
163
|
+
command: z.ZodArray<z.ZodString>;
|
|
164
|
+
expectExitCode: z.ZodDefault<z.ZodInt>;
|
|
165
|
+
}, z.core.$strict>], "kind">>>;
|
|
166
|
+
/** The pre-parse authoring shape of one `defineStep({ healthChecks })` entry. */
|
|
167
|
+
export type StepHealthCheckInput = z.input<typeof stepToolHealthCheckSchema> | z.input<typeof cliHealthCheckSchema>;
|
|
168
|
+
/** The pre-parse authoring shape of `defineStep({ healthChecks })`. */
|
|
169
|
+
export type StepHealthChecksInput = StepHealthCheckInput[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
cliHealthCheckSchema,
|
|
4
|
+
healthCheckSchema,
|
|
5
|
+
healthCheckSeverityValues,
|
|
6
|
+
healthChecksSchema,
|
|
7
|
+
stepHealthChecksInputSchema,
|
|
8
|
+
stepToolHealthCheckSchema,
|
|
9
|
+
toolHealthCheckSchema
|
|
10
|
+
} from "./chunk-63f90zky.js";
|
|
11
|
+
import"./chunk-skzxcba3.js";
|
|
12
|
+
import"./chunk-y64skrwp.js";
|
|
13
|
+
export {
|
|
14
|
+
cliHealthCheckSchema,
|
|
15
|
+
healthCheckSchema,
|
|
16
|
+
healthCheckSeverityValues,
|
|
17
|
+
healthChecksSchema,
|
|
18
|
+
stepHealthChecksInputSchema,
|
|
19
|
+
stepToolHealthCheckSchema,
|
|
20
|
+
toolHealthCheckSchema
|
|
21
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * as z from "./z";
|
|
2
|
+
export * from "./client";
|
|
3
|
+
export * from "./contracts/artifacts";
|
|
4
|
+
export * from "./contracts/artifact-markers";
|
|
5
|
+
export * from "./definitions/steps";
|
|
6
|
+
export * from "./definitions/pipelines";
|
|
7
|
+
export * from "./pipelines";
|
|
8
|
+
export type { PipelineDefinition } from "./pipelines";
|
|
9
|
+
export * from "./opencode-mcp";
|
|
10
|
+
export * from "./jsonc";
|
|
11
|
+
export * from "./scarn-config-parser";
|