reeval 0.0.1
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/LICENSE +202 -0
- package/THIRD_PARTY_NOTICES.md +2160 -0
- package/assets/package.json +9 -0
- package/assets/pnpm-lock.yaml +1336 -0
- package/dist/agent-DVHkx8aT.js +532 -0
- package/dist/agent-DVHkx8aT.js.map +1 -0
- package/dist/analysis-CxSCt1YY.js +16 -0
- package/dist/analysis-CxSCt1YY.js.map +1 -0
- package/dist/assemble-B-nmz8oH.js +695 -0
- package/dist/assemble-B-nmz8oH.js.map +1 -0
- package/dist/assemble-CmRVDZ2Q.js +2 -0
- package/dist/attempt-BdRQ9jKX.js +176 -0
- package/dist/attempt-BdRQ9jKX.js.map +1 -0
- package/dist/bridge/index.mjs +1911 -0
- package/dist/bridge/package.json +13 -0
- package/dist/bridge/pnpm-lock.yaml +1041 -0
- package/dist/bridge/pnpm-workspace.yaml +2 -0
- package/dist/budget-DBUrH4jX.js +8 -0
- package/dist/budget-DBUrH4jX.js.map +1 -0
- package/dist/cli--CQ3Iy9q.js +1865 -0
- package/dist/cli--CQ3Iy9q.js.map +1 -0
- package/dist/cli-spec-DKAu09Gi.js +478 -0
- package/dist/cli-spec-DKAu09Gi.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +8 -0
- package/dist/cli.js.map +1 -0
- package/dist/colors-QV9dFVhN.js +34 -0
- package/dist/colors-QV9dFVhN.js.map +1 -0
- package/dist/command-BSJzHMtP.js +280 -0
- package/dist/command-BSJzHMtP.js.map +1 -0
- package/dist/command-CEm8PZ1N.js +1043 -0
- package/dist/command-CEm8PZ1N.js.map +1 -0
- package/dist/command-D-jnQWVG.js +673 -0
- package/dist/command-D-jnQWVG.js.map +1 -0
- package/dist/command-DQAvbG7d.js +432 -0
- package/dist/command-DQAvbG7d.js.map +1 -0
- package/dist/commands-A4udfyKZ.js +2 -0
- package/dist/commands-CF8mOfiu.js +207 -0
- package/dist/commands-CF8mOfiu.js.map +1 -0
- package/dist/config-Cuj0kVYj.js +415 -0
- package/dist/config-Cuj0kVYj.js.map +1 -0
- package/dist/context-loi9OCZv.js +106 -0
- package/dist/context-loi9OCZv.js.map +1 -0
- package/dist/core-tLN-z1Be.js +96 -0
- package/dist/core-tLN-z1Be.js.map +1 -0
- package/dist/db-Cjj2ZsfQ.js +2 -0
- package/dist/db-DxDzMhtB.js +827 -0
- package/dist/db-DxDzMhtB.js.map +1 -0
- package/dist/debug-D24NOQH1.js +89 -0
- package/dist/debug-D24NOQH1.js.map +1 -0
- package/dist/debug-SEmW4w8f.js +2 -0
- package/dist/dist-BZXYHN2X.js +1673 -0
- package/dist/dist-BZXYHN2X.js.map +1 -0
- package/dist/docker-DQDZWXF9.js +20 -0
- package/dist/docker-DQDZWXF9.js.map +1 -0
- package/dist/docker-DnWAVdEm.js +2 -0
- package/dist/docker-oSbCExHL.js +153 -0
- package/dist/docker-oSbCExHL.js.map +1 -0
- package/dist/doctor-CxlH1pDM.js +525 -0
- package/dist/doctor-CxlH1pDM.js.map +1 -0
- package/dist/egress-73SQfKdx.js +619 -0
- package/dist/egress-73SQfKdx.js.map +1 -0
- package/dist/env-BQqj93gu.js +21 -0
- package/dist/env-BQqj93gu.js.map +1 -0
- package/dist/environment-Mz7wvrtD.js +552 -0
- package/dist/environment-Mz7wvrtD.js.map +1 -0
- package/dist/errors-C9w_ud7g.js +160 -0
- package/dist/errors-C9w_ud7g.js.map +1 -0
- package/dist/errors-CSxfJ4qu.js +11 -0
- package/dist/errors-CSxfJ4qu.js.map +1 -0
- package/dist/files--6CEUXm7.js +2 -0
- package/dist/files-BLlrhU4-.js +62 -0
- package/dist/files-BLlrhU4-.js.map +1 -0
- package/dist/files-Bd25OAQH.js +2 -0
- package/dist/files-BvHCFWgD.js +2 -0
- package/dist/files-D2-qn_Dl.js +275 -0
- package/dist/files-D2-qn_Dl.js.map +1 -0
- package/dist/files-bF2fPuT9.js +99 -0
- package/dist/files-bF2fPuT9.js.map +1 -0
- package/dist/git-D6hMeieS.js +44 -0
- package/dist/git-D6hMeieS.js.map +1 -0
- package/dist/harness-ls5aX1UO.js +131 -0
- package/dist/harness-ls5aX1UO.js.map +1 -0
- package/dist/harness.d.ts +74 -0
- package/dist/harness.js +2 -0
- package/dist/header-DzFDoMCI.js +78 -0
- package/dist/header-DzFDoMCI.js.map +1 -0
- package/dist/ids-Bp6ut7ZD.js +49 -0
- package/dist/ids-Bp6ut7ZD.js.map +1 -0
- package/dist/images-Cc1-coFc.js +286 -0
- package/dist/images-Cc1-coFc.js.map +1 -0
- package/dist/index.d.ts +97 -0
- package/dist/index.js +1959 -0
- package/dist/index.js.map +1 -0
- package/dist/init-CFljS8BJ.js +344 -0
- package/dist/init-CFljS8BJ.js.map +1 -0
- package/dist/init-z2ZPn9Tj.js +2 -0
- package/dist/invocations-rXktgSAn.js +157 -0
- package/dist/invocations-rXktgSAn.js.map +1 -0
- package/dist/jiti-BOLXpKyG.js +46 -0
- package/dist/jiti-BOLXpKyG.js.map +1 -0
- package/dist/judge-D8Uf4dA9.js +146 -0
- package/dist/judge-D8Uf4dA9.js.map +1 -0
- package/dist/judge.d.ts +21 -0
- package/dist/judge.js +19 -0
- package/dist/judge.js.map +1 -0
- package/dist/live-Bs3LReMV.js +98 -0
- package/dist/live-Bs3LReMV.js.map +1 -0
- package/dist/matchers-DyLvm7EG.js +374 -0
- package/dist/matchers-DyLvm7EG.js.map +1 -0
- package/dist/model-BdO79gWz.js +44 -0
- package/dist/model-BdO79gWz.js.map +1 -0
- package/dist/model-CDL98xue.js +725 -0
- package/dist/model-CDL98xue.js.map +1 -0
- package/dist/model-v-0_Ik7S.js +2 -0
- package/dist/node-kG64XxdE.js +506 -0
- package/dist/node-kG64XxdE.js.map +1 -0
- package/dist/opencode-providers-DZuD_oYt.js +3149 -0
- package/dist/opencode-providers-DZuD_oYt.js.map +1 -0
- package/dist/options-CAQhu--C.js +452 -0
- package/dist/options-CAQhu--C.js.map +1 -0
- package/dist/patch-BkKje4cp.js +69 -0
- package/dist/patch-BkKje4cp.js.map +1 -0
- package/dist/paths-CBvm6pap.js +72 -0
- package/dist/paths-CBvm6pap.js.map +1 -0
- package/dist/plan-gwk6dJ8c.js +237 -0
- package/dist/plan-gwk6dJ8c.js.map +1 -0
- package/dist/preflight-BtubXKQ8.js +2 -0
- package/dist/preflight-BypZMNBG.js +185 -0
- package/dist/preflight-BypZMNBG.js.map +1 -0
- package/dist/prepare-Cwv0bHs_.js +3 -0
- package/dist/prepare-D6Uzcubb.js +213 -0
- package/dist/prepare-D6Uzcubb.js.map +1 -0
- package/dist/provenance-Dfb8YY5Y.js +129 -0
- package/dist/provenance-Dfb8YY5Y.js.map +1 -0
- package/dist/provider-BDbNOQhQ.js +2 -0
- package/dist/provider-CmAYTQQs.js +14 -0
- package/dist/provider-CmAYTQQs.js.map +1 -0
- package/dist/providers-2p3ylMHI.js +107 -0
- package/dist/providers-2p3ylMHI.js.map +1 -0
- package/dist/providers-BUOxitcT.js +2 -0
- package/dist/query-CFATHZmV.js +91 -0
- package/dist/query-CFATHZmV.js.map +1 -0
- package/dist/query-DR4m6CXf.js +2 -0
- package/dist/record-DQ8wzyco.js +99 -0
- package/dist/record-DQ8wzyco.js.map +1 -0
- package/dist/redact-C4fL_bZP.js +167 -0
- package/dist/redact-C4fL_bZP.js.map +1 -0
- package/dist/results-CeXb8Wde.js +37 -0
- package/dist/results-CeXb8Wde.js.map +1 -0
- package/dist/root-CFDjpWuc.js +110 -0
- package/dist/root-CFDjpWuc.js.map +1 -0
- package/dist/sandbox-By2gkdkC.js +133 -0
- package/dist/sandbox-By2gkdkC.js.map +1 -0
- package/dist/sandbox.d.ts +41 -0
- package/dist/sandbox.js +2 -0
- package/dist/server-Bi61uiY0.js +350 -0
- package/dist/server-Bi61uiY0.js.map +1 -0
- package/dist/server-CsSBL8NC.js +2 -0
- package/dist/source-BXzrmof5.js +2 -0
- package/dist/source-Bsfa3LZH.js +40 -0
- package/dist/source-Bsfa3LZH.js.map +1 -0
- package/dist/src-55j1zNHH.js +3 -0
- package/dist/src-AEwxd1UP.js +602 -0
- package/dist/src-AEwxd1UP.js.map +1 -0
- package/dist/src-BDwSuyIo.js +3 -0
- package/dist/src-BQyMiWri.js +490 -0
- package/dist/src-BQyMiWri.js.map +1 -0
- package/dist/src-C-LHyTSV.js +3 -0
- package/dist/src-Cmp-7YrD.js +1136 -0
- package/dist/src-Cmp-7YrD.js.map +1 -0
- package/dist/src-D0RdqpNb.js +252 -0
- package/dist/src-D0RdqpNb.js.map +1 -0
- package/dist/src-D8KYzxBX.js +793 -0
- package/dist/src-D8KYzxBX.js.map +1 -0
- package/dist/src-DEgff9Z7.js +4 -0
- package/dist/src-DXx_29pq.js +567 -0
- package/dist/src-DXx_29pq.js.map +1 -0
- package/dist/src-DwwiVLqv.js +2937 -0
- package/dist/src-DwwiVLqv.js.map +1 -0
- package/dist/src-N7E_mfcZ.js +2 -0
- package/dist/src-W9g-y5X5.js +3 -0
- package/dist/src-daS0wKH2.js +3 -0
- package/dist/state-Cyw3QTsN.js +2 -0
- package/dist/state-DZ7eqb1F.js +167 -0
- package/dist/state-DZ7eqb1F.js.map +1 -0
- package/dist/stats-BNAHlNMD.js +114 -0
- package/dist/stats-BNAHlNMD.js.map +1 -0
- package/dist/studio-app/assets/index-D6XyfFSH.js +58 -0
- package/dist/studio-app/assets/index-xwzWdcE_.css +2 -0
- package/dist/studio-app/favicon.svg +1 -0
- package/dist/studio-app/index.html +15 -0
- package/dist/summary-D7Ttky0z.js +166 -0
- package/dist/summary-D7Ttky0z.js.map +1 -0
- package/dist/text-gEcKjAyp.js +29 -0
- package/dist/text-gEcKjAyp.js.map +1 -0
- package/dist/types-C5vI3g1C.js +9 -0
- package/dist/types-C5vI3g1C.js.map +1 -0
- package/dist/types-DLec-6Cx.d.ts +1535 -0
- package/dist/usage-DsYUqIUM.js +24 -0
- package/dist/usage-DsYUqIUM.js.map +1 -0
- package/dist/view/index.d.ts +645 -0
- package/dist/view/index.js +8 -0
- package/dist/views-BrHOv6wg.js +220 -0
- package/dist/views-BrHOv6wg.js.map +1 -0
- package/dist/views-CwCWLWqo.js +3 -0
- package/dist/worker-entry-DnYkANPG.js +506 -0
- package/dist/worker-entry-DnYkANPG.js.map +1 -0
- package/dist/workspace-C2S0Z6gl.js +327 -0
- package/dist/workspace-C2S0Z6gl.js.map +1 -0
- package/dist/workspace-CyoXG6CY.js +2 -0
- package/docker/Dockerfile +19 -0
- package/package.json +79 -0
|
@@ -0,0 +1,552 @@
|
|
|
1
|
+
import { t as UsageError } from "./errors-CSxfJ4qu.js";
|
|
2
|
+
import { n as SECRET_NAME } from "./redact-C4fL_bZP.js";
|
|
3
|
+
import { i as PACKAGE_DIR, n as COMPILED } from "./root-CFDjpWuc.js";
|
|
4
|
+
import { dirname, isAbsolute, join, normalize, resolve, sep } from "node:path";
|
|
5
|
+
import { isIP } from "node:net";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
//#region src/duration.ts
|
|
8
|
+
const UNITS = {
|
|
9
|
+
ms: 1,
|
|
10
|
+
s: 1e3,
|
|
11
|
+
m: 6e4,
|
|
12
|
+
h: 36e5
|
|
13
|
+
};
|
|
14
|
+
/** A duration in milliseconds, more than zero: `90s`, `15m` or a number of milliseconds. */
|
|
15
|
+
function parseDuration(value) {
|
|
16
|
+
let ms = value;
|
|
17
|
+
if (typeof value === "string") {
|
|
18
|
+
const match = /^(\d+(?:\.\d+)?)(ms|s|m|h)$/.exec(value);
|
|
19
|
+
if (!match) throw new UsageError(`Invalid duration "${value}". Use e.g. "90s" or "15m".`);
|
|
20
|
+
ms = Number(match[1]) * UNITS[match[2]];
|
|
21
|
+
}
|
|
22
|
+
if (!(ms > 0 && Number.isFinite(ms))) {
|
|
23
|
+
const shown = typeof value === "string" ? `"${value}"` : String(value);
|
|
24
|
+
throw new UsageError(`Invalid duration ${shown}. A duration is more than zero: use e.g. "90s" or "15m".`);
|
|
25
|
+
}
|
|
26
|
+
return ms;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/environment.ts
|
|
30
|
+
var DefinitionError = class extends Error {
|
|
31
|
+
name = "DefinitionError";
|
|
32
|
+
};
|
|
33
|
+
const NAME = /^[A-Za-z0-9][A-Za-z0-9._@+-]*$/;
|
|
34
|
+
const VAR = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
35
|
+
const SPEC_KEYS = [
|
|
36
|
+
"workspace",
|
|
37
|
+
"env",
|
|
38
|
+
"egress",
|
|
39
|
+
"files",
|
|
40
|
+
"rules",
|
|
41
|
+
"setup",
|
|
42
|
+
"skills",
|
|
43
|
+
"mcp"
|
|
44
|
+
];
|
|
45
|
+
/** Image fields that belong on the sandbox, not the environment. */
|
|
46
|
+
const SANDBOX_KEYS = [
|
|
47
|
+
"image",
|
|
48
|
+
"install",
|
|
49
|
+
"dockerfile",
|
|
50
|
+
"from"
|
|
51
|
+
];
|
|
52
|
+
const SPEC_HINTS = {
|
|
53
|
+
exec: "setup",
|
|
54
|
+
steps: "setup",
|
|
55
|
+
run: "setup",
|
|
56
|
+
vars: "env",
|
|
57
|
+
secrets: "env",
|
|
58
|
+
network: "egress",
|
|
59
|
+
networkPolicy: "egress",
|
|
60
|
+
skill: "skills",
|
|
61
|
+
file: "files",
|
|
62
|
+
agents: "rules",
|
|
63
|
+
use: "extend",
|
|
64
|
+
repo: "workspace",
|
|
65
|
+
git: "workspace",
|
|
66
|
+
template: "workspace"
|
|
67
|
+
};
|
|
68
|
+
const isSecret = (value) => typeof value === "object" && value !== null && value.kind === "secret";
|
|
69
|
+
const isSecretTemplate = (value) => typeof value === "object" && value !== null && value.kind === "secret-template";
|
|
70
|
+
const isHostFile = (value) => typeof value === "object" && value !== null && value.kind === "file";
|
|
71
|
+
const isEnvironment = (value) => typeof value === "object" && value !== null && value.kind === "environment" && Array.isArray(value.layers);
|
|
72
|
+
const OWN_DIRS = COMPILED ? [join(PACKAGE_DIR, sep)] : ["src", "dist"].map((dir) => join(PACKAGE_DIR, dir, sep));
|
|
73
|
+
/** The directory of the file that called into reeval, from the stack; relative paths resolve here. */
|
|
74
|
+
function callerDir() {
|
|
75
|
+
const limit = Error.stackTraceLimit;
|
|
76
|
+
Error.stackTraceLimit = 30;
|
|
77
|
+
const stack = (/* @__PURE__ */ new Error()).stack ?? "";
|
|
78
|
+
Error.stackTraceLimit = limit;
|
|
79
|
+
for (const line of stack.split("\n").slice(1)) {
|
|
80
|
+
const match = /(?:\(|at )((?:file:\/\/)?\/[^()]*?|[A-Za-z]:[\\/][^()]*?):\d+:\d+\)?\s*$/.exec(line);
|
|
81
|
+
if (!match?.[1]) continue;
|
|
82
|
+
const file = normalize(match[1].startsWith("file://") ? fileURLToPath(match[1]) : match[1]);
|
|
83
|
+
if (OWN_DIRS.some((d) => file.startsWith(d)) || file.includes(`${sep}node_modules${sep}`)) continue;
|
|
84
|
+
return dirname(file);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const toPath = (value, base) => {
|
|
88
|
+
const path = value instanceof URL ? fileURLToPath(value) : value;
|
|
89
|
+
return isAbsolute(path) ? path : resolve(base, path);
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* A tarball or folder spec (`./x.tgz`, `../pkg`, `/abs`, `file:…`) as an absolute path, resolved
|
|
93
|
+
* like `file()`; npm resolves relative ones against its working directory, reeval's cache.
|
|
94
|
+
*/
|
|
95
|
+
const localNpmSpec = (spec, base) => {
|
|
96
|
+
const path = spec.startsWith("file:") ? spec.slice(5) : spec;
|
|
97
|
+
return /^\.{1,2}(?:\/|$)/.test(path) || isAbsolute(path) ? toPath(path, base) : spec;
|
|
98
|
+
};
|
|
99
|
+
/** A host name, or `*.` and a domain for its subdomains. */
|
|
100
|
+
const HOST = /^(?:\*\.)?[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*$/i;
|
|
101
|
+
const SUBSTITUTE_IN = [
|
|
102
|
+
"header",
|
|
103
|
+
"query",
|
|
104
|
+
"body"
|
|
105
|
+
];
|
|
106
|
+
/** Why `host` isn't a host name or `*.` pattern, or undefined when it is one. */
|
|
107
|
+
function badHost(host) {
|
|
108
|
+
if (typeof host === "string" && HOST.test(host)) {
|
|
109
|
+
const name = host.replace(/^\*\./, "");
|
|
110
|
+
if (/(?:^|\.)\d+$/.test(name) && (name !== host || isIP(name) !== 4)) return `'${host}' isn't a host name or an IPv4 address, and a *. pattern never matches an address.`;
|
|
111
|
+
if (name !== host && !name.includes(".")) return `'${host}' would allow every host under .${name}; name the domain, e.g. '*.example.${name}'.`;
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (typeof host === "string" && /^[a-z]+:\/\//i.test(host)) return `hosts are host names, not URLs: use '${new URL(host).hostname}' (got '${host}')`;
|
|
115
|
+
if (typeof host === "string" && /^[^:/]+:\d+$/.test(host)) return `hosts are host names without a port: use '${host.split(":")[0]}' (got '${host}')`;
|
|
116
|
+
return `${JSON.stringify(host)} isn't a host. Use a name like 'api.example.com', or '*.example.com' for its subdomains.`;
|
|
117
|
+
}
|
|
118
|
+
/** Throws unless `value` is `'allow-all'`, `'deny-all'` or `{ allow: [hosts] }`. */
|
|
119
|
+
function checkEgress(value, where, Err = DefinitionError) {
|
|
120
|
+
if (value === "allow-all" || value === "deny-all") return;
|
|
121
|
+
const shape = `egress is 'allow-all' (the default), 'deny-all', or { allow: ['api.example.com', '*.example.org'] }`;
|
|
122
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
123
|
+
const list = Array.isArray(value) ? ` For a list of hosts, use { allow: ${JSON.stringify(value)} }.` : "";
|
|
124
|
+
throw new Err(`${shape} (got ${JSON.stringify(value)}) in ${where}.${list}`);
|
|
125
|
+
}
|
|
126
|
+
for (const key of Object.keys(value)) {
|
|
127
|
+
if (key === "allow") continue;
|
|
128
|
+
throw new Err(`Unknown egress key "${key}" in ${where}.${key === "deny" ? " A policy lists what's allowed; everything else is refused." : key === "hosts" || key === "allowedHosts" ? " Did you mean \"allow\"?" : ""}`);
|
|
129
|
+
}
|
|
130
|
+
const allow = value.allow;
|
|
131
|
+
if (!Array.isArray(allow)) throw new Err(`${shape} (got ${JSON.stringify(value)}) in ${where}`);
|
|
132
|
+
for (const host of allow) {
|
|
133
|
+
const bad = badHost(host);
|
|
134
|
+
if (bad) throw new Err(`egress.allow in ${where}: ${bad}`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const SECRET_HOSTS = Object.freeze({
|
|
138
|
+
gemini: Object.freeze(["generativelanguage.googleapis.com"]),
|
|
139
|
+
openai: Object.freeze(["api.openai.com"]),
|
|
140
|
+
anthropic: Object.freeze(["api.anthropic.com"]),
|
|
141
|
+
github: Object.freeze(["api.github.com", "uploads.github.com"])
|
|
142
|
+
});
|
|
143
|
+
function secretOptions(options, what) {
|
|
144
|
+
const to = options.to ?? "agent";
|
|
145
|
+
if (to !== "agent" && to !== "checks") throw new DefinitionError(`${what}: to must be 'agent' or 'checks'`);
|
|
146
|
+
const { hosts } = options;
|
|
147
|
+
if (hosts !== void 0) {
|
|
148
|
+
if (!Array.isArray(hosts) || hosts.length === 0) throw new DefinitionError(`${what}: hosts must list the hosts the secret is sent to, e.g. hosts: ['api.example.com'] or secret.hosts.gemini (got ${JSON.stringify(hosts)})`);
|
|
149
|
+
for (const host of hosts) {
|
|
150
|
+
const bad = badHost(host);
|
|
151
|
+
if (bad) throw new DefinitionError(`${what}: ${bad}`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (options.in !== void 0) {
|
|
155
|
+
if (hosts === void 0) throw new DefinitionError(`${what}: in only applies to a brokered secret; add hosts, e.g. { hosts: ['api.example.com'], in: ${JSON.stringify(options.in)} }`);
|
|
156
|
+
if ((Array.isArray(options.in) ? options.in.filter((i) => !SUBSTITUTE_IN.includes(i)) : [options.in]).length || options.in.length === 0) throw new DefinitionError(`${what}: in lists where the gateway substitutes: 'header', 'query' and/or 'body' (got ${JSON.stringify(options.in)})`);
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
...options.optional ? { optional: true } : {},
|
|
160
|
+
...to === "checks" ? { to } : {},
|
|
161
|
+
...hosts ? { hosts: [...hosts] } : {},
|
|
162
|
+
...options.in ? { in: [...new Set(options.in)] } : {}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
/** Where an MCP server's header secrets are brokered to by default: its own host, over HTTPS. */
|
|
166
|
+
function mcpHosts(url) {
|
|
167
|
+
try {
|
|
168
|
+
const u = new URL(url);
|
|
169
|
+
return u.protocol === "https:" ? [u.hostname] : void 0;
|
|
170
|
+
} catch {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Every secret among `env` and the layers' env and MCP servers, layered as the attempt resolves
|
|
176
|
+
* them: a later layer's variable or MCP server replaces an earlier one of the same name.
|
|
177
|
+
*/
|
|
178
|
+
function plannedSecrets(env, layers) {
|
|
179
|
+
const vars = { ...env };
|
|
180
|
+
const servers = /* @__PURE__ */ new Map();
|
|
181
|
+
for (const { spec } of layers) {
|
|
182
|
+
Object.assign(vars, spec.env);
|
|
183
|
+
for (const [name, server] of Object.entries(spec.mcp ?? {})) servers.set(name, server);
|
|
184
|
+
}
|
|
185
|
+
const out = /* @__PURE__ */ new Map();
|
|
186
|
+
const add = (label, from, hosts, checksOnly = false, optional = false) => out.set(`${label}\0${from}`, {
|
|
187
|
+
label,
|
|
188
|
+
from,
|
|
189
|
+
...hosts ? { hosts } : {},
|
|
190
|
+
...checksOnly ? { checksOnly } : {},
|
|
191
|
+
...optional ? { optional } : {}
|
|
192
|
+
});
|
|
193
|
+
const fromVars = (values, prefix) => {
|
|
194
|
+
for (const [name, value] of Object.entries(values)) if (isSecret(value)) add(`${prefix}${name}`, value.from ?? name, value.hosts, value.to === "checks", value.optional === true);
|
|
195
|
+
};
|
|
196
|
+
fromVars(vars, "");
|
|
197
|
+
for (const [server, s] of servers) {
|
|
198
|
+
if (s.transport === "stdio") {
|
|
199
|
+
fromVars(s.env, `mcp.${server}.env.`);
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
const own = mcpHosts(s.url);
|
|
203
|
+
for (const [header, value] of Object.entries(s.headers)) {
|
|
204
|
+
const label = `mcp.${server}.headers.${header}`;
|
|
205
|
+
if (isSecret(value)) add(label, value.from ?? header, value.hosts ?? own);
|
|
206
|
+
if (isSecretTemplate(value)) for (const [, name] of value.template.matchAll(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g)) add(label, name, own);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return [...out.values()];
|
|
210
|
+
}
|
|
211
|
+
/** The secrets the sandbox gets as real values: no `hosts`, and none implied by an MCP URL. */
|
|
212
|
+
const unbrokeredSecrets = (env, layers) => plannedSecrets(env, layers).flatMap(({ hosts, ...s }) => hosts ? [] : [s]);
|
|
213
|
+
function secretHelper() {
|
|
214
|
+
const secret = ((options = {}) => ({
|
|
215
|
+
kind: "secret",
|
|
216
|
+
...secretOptions(options, "secret()")
|
|
217
|
+
}));
|
|
218
|
+
secret.fromEnv = (host, options = {}) => {
|
|
219
|
+
if (typeof host !== "string" || !VAR.test(host)) throw new DefinitionError(`secret.fromEnv(${JSON.stringify(host)}) needs a host variable name`);
|
|
220
|
+
return {
|
|
221
|
+
kind: "secret",
|
|
222
|
+
from: host,
|
|
223
|
+
...secretOptions(options, `secret.fromEnv("${host}")`)
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
secret.template = (template) => ({
|
|
227
|
+
kind: "secret-template",
|
|
228
|
+
template
|
|
229
|
+
});
|
|
230
|
+
secret.hosts = SECRET_HOSTS;
|
|
231
|
+
return secret;
|
|
232
|
+
}
|
|
233
|
+
const MOVING = /^(?:main|master|HEAD|trunk|develop|dev|latest)$/;
|
|
234
|
+
/** A git ref that isn't a commit SHA or a version-like tag. */
|
|
235
|
+
const isMovingRef = (ref) => ref === void 0 || MOVING.test(ref) || !/^(?:[0-9a-f]{7,40}|v?\d+(?:\.\d+)*(?:[-+].*)?)$/.test(ref);
|
|
236
|
+
/** `github:owner/repo` and GitHub `/tree/<ref>/<path>` URLs, as a clone URL plus ref and path. */
|
|
237
|
+
function parseGitRepo(repo) {
|
|
238
|
+
const short = /^github:([\w.-]+\/[\w.-]+?)(?:\.git)?$/.exec(repo);
|
|
239
|
+
if (short) return { url: `https://github.com/${short[1]}.git` };
|
|
240
|
+
const tree = /^https:\/\/github\.com\/([\w.-]+\/[\w.-]+)\/tree\/([^/]+)(?:\/(.+))?$/.exec(repo);
|
|
241
|
+
if (tree) return {
|
|
242
|
+
url: `https://github.com/${tree[1]}.git`,
|
|
243
|
+
ref: tree[2],
|
|
244
|
+
path: tree[3]
|
|
245
|
+
};
|
|
246
|
+
return { url: repo };
|
|
247
|
+
}
|
|
248
|
+
/** `repo#ref:path`, as the plan and the record name a git workspace. */
|
|
249
|
+
const workspaceLabel = (w) => `${w.repo}${w.ref ? `#${w.ref}` : ""}${w.path ? `:${w.path}` : ""}`;
|
|
250
|
+
/** The workspace an attempt starts as: the last layer that sets one. */
|
|
251
|
+
const workspaceOf = (layers) => layers.findLast((l) => l.spec.workspace)?.spec.workspace;
|
|
252
|
+
/** A URL with its password (or an https username, which is where tokens go) masked. */
|
|
253
|
+
function credentialsIn(repo) {
|
|
254
|
+
if (!URL.canParse(repo)) return void 0;
|
|
255
|
+
const u = new URL(repo);
|
|
256
|
+
if (!u.password && !(u.username && /^https?:$/.test(u.protocol))) return void 0;
|
|
257
|
+
u.username = u.username && "***";
|
|
258
|
+
u.password = u.password && "***";
|
|
259
|
+
return u.href;
|
|
260
|
+
}
|
|
261
|
+
const GIT_OPTIONS = [
|
|
262
|
+
"ref",
|
|
263
|
+
"path",
|
|
264
|
+
"init",
|
|
265
|
+
"token"
|
|
266
|
+
];
|
|
267
|
+
const isLocalPath = (repo) => /^\.{1,2}(?:\/|$)/.test(repo) || isAbsolute(repo);
|
|
268
|
+
function gitHelper(base) {
|
|
269
|
+
return (repo, options = {}) => {
|
|
270
|
+
const written = repo instanceof URL ? repo.href : repo;
|
|
271
|
+
if (typeof written !== "string" || !written.trim()) throw new DefinitionError(`git() needs a repository: a URL, github:owner/repo or a local path (got ${JSON.stringify(repo)})`);
|
|
272
|
+
const what = `git(${JSON.stringify(written)})`;
|
|
273
|
+
const masked = credentialsIn(written);
|
|
274
|
+
if (masked) throw new DefinitionError(`git(${JSON.stringify(masked)}): the URL has a password or token in it. reeval fetches the repository on the host with your own git credentials (a credential helper, gh auth setup-git or an SSH key), and the sandbox never gets them; remove it from the URL.`);
|
|
275
|
+
if (typeof options !== "object" || options === null || Array.isArray(options)) throw new DefinitionError(`${what}: options are { ref?, path? }`);
|
|
276
|
+
const extra = Object.keys(options).filter((k) => !GIT_OPTIONS.includes(k));
|
|
277
|
+
if (extra.length) {
|
|
278
|
+
const hint = extra.includes("branch") || extra.includes("tag") ? " Use ref for a branch, tag or commit." : "";
|
|
279
|
+
throw new DefinitionError(`${what}: unknown option "${extra.join("\", \"")}"; it takes ${GIT_OPTIONS.slice(0, -1).join(", ")} and ${GIT_OPTIONS.at(-1)}.${hint}`);
|
|
280
|
+
}
|
|
281
|
+
const local = repo instanceof URL ? repo.protocol === "file:" : isLocalPath(written);
|
|
282
|
+
const parsed = local ? { url: toPath(repo, base) } : parseGitRepo(written);
|
|
283
|
+
const ref = options.ref ?? parsed.ref;
|
|
284
|
+
if (ref !== void 0 && (typeof ref !== "string" || !ref.trim() || ref.startsWith("-"))) throw new DefinitionError(`${what}: ref is a branch, tag or commit SHA (got ${JSON.stringify(ref)})`);
|
|
285
|
+
const path = options.path ?? parsed.path;
|
|
286
|
+
if (path !== void 0) {
|
|
287
|
+
const clean = typeof path === "string" ? path.replace(/\/+$/, "") : path;
|
|
288
|
+
if (typeof clean !== "string" || !clean || clean.includes("\\") || clean.startsWith("/") || clean.split("/").some((p) => p === ".." || p === "." || p === "")) throw new DefinitionError(`${what}: path is a directory in the repository, relative, with forward slashes and no . or .. (got ${JSON.stringify(path)})`);
|
|
289
|
+
}
|
|
290
|
+
const cleanPath = path?.replace(/\/+$/, "");
|
|
291
|
+
const { init, token } = options;
|
|
292
|
+
if (init !== void 0 && typeof init !== "boolean") throw new DefinitionError(`${what}: init is true or false (got ${JSON.stringify(init)})`);
|
|
293
|
+
if (token !== void 0) {
|
|
294
|
+
if (typeof token !== "string" || !VAR.test(token) || /^(?:gh[opsur]_|github_pat_)/.test(token)) throw new DefinitionError(`${what}: token names the host variable that holds the token, e.g. token: 'GITHUB_TOKEN'. Don't put the token itself in the eval.`);
|
|
295
|
+
if (local || !/^https?:\/\//.test(parsed.url)) throw new DefinitionError(`${what}: token only works with an https:// URL; for SSH or a local repository, git uses this machine's own credentials`);
|
|
296
|
+
}
|
|
297
|
+
return {
|
|
298
|
+
kind: "git",
|
|
299
|
+
repo: "ref" in parsed || "path" in parsed ? parsed.url.replace(/\.git$/, "") : written,
|
|
300
|
+
url: parsed.url,
|
|
301
|
+
...ref ? { ref } : {},
|
|
302
|
+
...cleanPath ? { path: cleanPath } : {},
|
|
303
|
+
...init ? { init } : {},
|
|
304
|
+
...token ? { token } : {}
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* What a skill directory leaves out of the sandbox unless `exclude` says otherwise: eval material
|
|
310
|
+
* (skill-creator keeps `evals/` in the skill), run history and reeval eval files. `.git` is always left out.
|
|
311
|
+
*/
|
|
312
|
+
const DEFAULT_SKILL_EXCLUDE = [
|
|
313
|
+
"/evals/",
|
|
314
|
+
".history/",
|
|
315
|
+
"*.eval.ts"
|
|
316
|
+
];
|
|
317
|
+
function skillHelper(base) {
|
|
318
|
+
const placement = (p) => {
|
|
319
|
+
if (p === void 0 || p === "harness" || p === "workspace") return p ?? "harness";
|
|
320
|
+
throw new DefinitionError(`skill placement must be 'harness' or 'workspace' (got ${p})`);
|
|
321
|
+
};
|
|
322
|
+
const exclude = (e) => {
|
|
323
|
+
if (e === void 0) return {};
|
|
324
|
+
if (!Array.isArray(e) || e.some((p) => typeof p !== "string" || !p.replace(/\//g, ""))) throw new DefinitionError(`skill exclude must be an array of paths or globs, e.g. ['/evals/', '*.eval.ts'] (got ${JSON.stringify(e)})`);
|
|
325
|
+
return { exclude: [...e] };
|
|
326
|
+
};
|
|
327
|
+
return {
|
|
328
|
+
local: (path, o = {}) => ({
|
|
329
|
+
kind: "skill",
|
|
330
|
+
source: "local",
|
|
331
|
+
path: toPath(path, base),
|
|
332
|
+
...o.only ? { only: [...o.only] } : {},
|
|
333
|
+
...exclude(o.exclude),
|
|
334
|
+
placement: placement(o.placement)
|
|
335
|
+
}),
|
|
336
|
+
git: (repo, o = {}) => {
|
|
337
|
+
if (typeof repo !== "string" || !repo) throw new DefinitionError("skill.git() needs a repository URL");
|
|
338
|
+
const parsed = parseGitRepo(repo);
|
|
339
|
+
const ref = o.ref ?? parsed.ref;
|
|
340
|
+
const path = o.path ?? parsed.path;
|
|
341
|
+
return {
|
|
342
|
+
kind: "skill",
|
|
343
|
+
source: "git",
|
|
344
|
+
repo,
|
|
345
|
+
...ref ? { ref } : {},
|
|
346
|
+
...path ? { path } : {},
|
|
347
|
+
...o.only ? { only: [...o.only] } : {},
|
|
348
|
+
...exclude(o.exclude),
|
|
349
|
+
placement: placement(o.placement)
|
|
350
|
+
};
|
|
351
|
+
},
|
|
352
|
+
registry: (id, o = {}) => {
|
|
353
|
+
if (!/^[\w.-]+\/[\w.-]+@[a-z0-9-]+$/.test(id)) throw new DefinitionError(`skill.registry("${id}") needs an id like owner/repo@skill`);
|
|
354
|
+
return {
|
|
355
|
+
kind: "skill",
|
|
356
|
+
source: "registry",
|
|
357
|
+
id,
|
|
358
|
+
...o.version ? { version: o.version } : {},
|
|
359
|
+
placement: placement(o.placement)
|
|
360
|
+
};
|
|
361
|
+
},
|
|
362
|
+
npm: (spec, o = {}) => ({
|
|
363
|
+
kind: "skill",
|
|
364
|
+
source: "npm",
|
|
365
|
+
spec: localNpmSpec(spec, base),
|
|
366
|
+
path: o.path ?? "skills",
|
|
367
|
+
...o.only ? { only: [...o.only] } : {},
|
|
368
|
+
...exclude(o.exclude),
|
|
369
|
+
placement: placement(o.placement)
|
|
370
|
+
}),
|
|
371
|
+
inline: (skill, o = {}) => ({
|
|
372
|
+
kind: "skill",
|
|
373
|
+
source: "inline",
|
|
374
|
+
name: skill.name,
|
|
375
|
+
description: skill.description,
|
|
376
|
+
content: skill.content,
|
|
377
|
+
files: { ...skill.files },
|
|
378
|
+
placement: placement(o.placement)
|
|
379
|
+
})
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
const mcpHelper = {
|
|
383
|
+
stdio: (command, args = [], o = {}) => {
|
|
384
|
+
if (typeof command !== "string" || !command) throw new DefinitionError("mcp.stdio() needs a command");
|
|
385
|
+
return {
|
|
386
|
+
kind: "mcp",
|
|
387
|
+
transport: "stdio",
|
|
388
|
+
command,
|
|
389
|
+
args: [...args],
|
|
390
|
+
env: { ...o.env }
|
|
391
|
+
};
|
|
392
|
+
},
|
|
393
|
+
http: (url, o = {}) => ({
|
|
394
|
+
kind: "mcp",
|
|
395
|
+
transport: "http",
|
|
396
|
+
url,
|
|
397
|
+
headers: { ...o.headers }
|
|
398
|
+
}),
|
|
399
|
+
sse: (url, o = {}) => ({
|
|
400
|
+
kind: "mcp",
|
|
401
|
+
transport: "sse",
|
|
402
|
+
url,
|
|
403
|
+
headers: { ...o.headers }
|
|
404
|
+
})
|
|
405
|
+
};
|
|
406
|
+
/** The helpers a callback gets, with relative paths resolving against `base`. */
|
|
407
|
+
function helpersFor(base) {
|
|
408
|
+
return {
|
|
409
|
+
secret: secretHelper(),
|
|
410
|
+
skill: skillHelper(base),
|
|
411
|
+
mcp: mcpHelper,
|
|
412
|
+
file: (path) => ({
|
|
413
|
+
kind: "file",
|
|
414
|
+
path: toPath(path, base)
|
|
415
|
+
}),
|
|
416
|
+
git: gitHelper(base)
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
/** Throws on env variables that aren't strings or secrets, or look like literal secrets. */
|
|
420
|
+
function checkEnv(env, where, Err = DefinitionError) {
|
|
421
|
+
if (typeof env !== "object" || env === null || Array.isArray(env)) throw new Err(`env must be an object of variables in ${where}`);
|
|
422
|
+
for (const [name, value] of Object.entries(env)) {
|
|
423
|
+
if (!VAR.test(name)) throw new Err(`env.${name} in ${where} isn't a valid variable name`);
|
|
424
|
+
if (isSecret(value)) continue;
|
|
425
|
+
if (typeof value !== "string") throw new Err(`env.${name} in ${where} must be a string or secret.fromEnv()`);
|
|
426
|
+
if (SECRET_NAME.test(name)) throw new Err(`env.${name} in ${where} is a literal string. Pass secrets with secret.fromEnv() so they're redacted and never recorded.`);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
const stepCommand = (step) => typeof step === "string" ? step : step.run;
|
|
430
|
+
function checkSpec(spec, where) {
|
|
431
|
+
if (typeof spec !== "object" || spec === null || Array.isArray(spec)) throw new DefinitionError(`${where} must be an object or a callback that returns one`);
|
|
432
|
+
for (const key of Object.keys(spec)) {
|
|
433
|
+
if (SPEC_KEYS.includes(key)) continue;
|
|
434
|
+
if (SANDBOX_KEYS.includes(key)) {
|
|
435
|
+
const value = spec[key];
|
|
436
|
+
throw new DefinitionError(`"${key}" isn't an environment field (${where}). What's baked into the image is the sandbox's: docker({ ${key === "image" ? typeof value === "string" ? "from" : "install" : key}: … }). An environment only runs setup steps, in every attempt, with its secrets.`);
|
|
437
|
+
}
|
|
438
|
+
throw new DefinitionError(`Unknown field "${key}" in ${where}.${SPEC_HINTS[key] ? ` Did you mean "${SPEC_HINTS[key]}"?` : ""}`);
|
|
439
|
+
}
|
|
440
|
+
const s = spec;
|
|
441
|
+
if (s.workspace !== void 0 && s.workspace?.kind !== "git") throw new DefinitionError(`workspace in ${where} must come from the git helper, e.g. workspace: git('https://github.com/acme/app', { ref: 'v1.0.0' }) (got ${JSON.stringify(s.workspace)})`);
|
|
442
|
+
if (s.env !== void 0) checkEnv(s.env, where);
|
|
443
|
+
if (s.egress !== void 0) checkEgress(s.egress, where);
|
|
444
|
+
const list = (key) => {
|
|
445
|
+
const value = s[key];
|
|
446
|
+
if (value !== void 0 && !Array.isArray(value)) throw new DefinitionError(`${key} in ${where} must be a list`);
|
|
447
|
+
return value ?? [];
|
|
448
|
+
};
|
|
449
|
+
for (const step of list("setup")) {
|
|
450
|
+
const shape = `Steps in ${where} are strings or { run, timeout?, cwd? } objects`;
|
|
451
|
+
const run = typeof step === "string" ? step : step?.run;
|
|
452
|
+
if (typeof run !== "string" || !run.trim()) throw new DefinitionError(shape);
|
|
453
|
+
if (typeof step === "string") continue;
|
|
454
|
+
const extra = Object.keys(step).filter((k) => ![
|
|
455
|
+
"run",
|
|
456
|
+
"timeout",
|
|
457
|
+
"cwd"
|
|
458
|
+
].includes(k));
|
|
459
|
+
if (extra.length) throw new DefinitionError(`${shape} (got "${extra.join("\", \"")}")`);
|
|
460
|
+
const { cwd, timeout } = step;
|
|
461
|
+
if (timeout !== void 0) try {
|
|
462
|
+
parseDuration(timeout);
|
|
463
|
+
} catch (error) {
|
|
464
|
+
throw new DefinitionError(`setup step "${run}" in ${where}: ${error.message}`);
|
|
465
|
+
}
|
|
466
|
+
if (cwd !== void 0 && (typeof cwd !== "string" || !cwd.trim())) throw new DefinitionError(`setup step "${run}" in ${where}: cwd must be a directory path, relative to the workspace or absolute (got ${JSON.stringify(cwd)})`);
|
|
467
|
+
}
|
|
468
|
+
for (const skill of list("skills")) if (skill?.kind !== "skill") throw new DefinitionError(`skills in ${where} must come from the skill helper, e.g. skills: [skill.local('./skills')] (got ${JSON.stringify(skill)})`);
|
|
469
|
+
for (const [name, server] of Object.entries(s.mcp ?? {})) if (server?.kind !== "mcp") throw new DefinitionError(`mcp.${name} in ${where} must come from the mcp helper, e.g. mcp.stdio('npx', ['-y', 'server'])`);
|
|
470
|
+
for (const [path, value] of Object.entries(s.files ?? {})) {
|
|
471
|
+
const key = `files[${JSON.stringify(path)}] in ${where}`;
|
|
472
|
+
if (path.includes("\\")) throw new DefinitionError(`${key}: use forward slashes (${path.replaceAll("\\", "/")})`);
|
|
473
|
+
const rest = path.startsWith("~/") ? path.slice(2) : path;
|
|
474
|
+
if (!rest || isAbsolute(rest) || rest.split("/").includes("..")) throw new DefinitionError(`${key}: paths are relative to the workspace, or start with ~/ for the home directory, and never use ..`);
|
|
475
|
+
if (typeof value !== "string" && !isHostFile(value)) throw new DefinitionError(`${key} must be a string or file(path)`);
|
|
476
|
+
}
|
|
477
|
+
if (s.rules !== void 0 && typeof s.rules !== "string" && !isHostFile(s.rules)) throw new DefinitionError(`rules in ${where} must be markdown or file(path)`);
|
|
478
|
+
return structuredClone(s);
|
|
479
|
+
}
|
|
480
|
+
function buildSpec(input, where, base) {
|
|
481
|
+
const spec = typeof input === "function" ? input(helpersFor(base)) : input;
|
|
482
|
+
if (spec instanceof Promise || typeof spec?.then === "function") throw new DefinitionError(`${where} returned a Promise. The callback runs once at definition time and must return the environment synchronously; fetch remote content in a setup step instead.`);
|
|
483
|
+
return checkSpec(spec, where);
|
|
484
|
+
}
|
|
485
|
+
function makeEnvironment(name, layers) {
|
|
486
|
+
const env = {
|
|
487
|
+
kind: "environment",
|
|
488
|
+
name,
|
|
489
|
+
layers: Object.freeze(layers)
|
|
490
|
+
};
|
|
491
|
+
Object.defineProperty(env, "extend", {
|
|
492
|
+
enumerable: false,
|
|
493
|
+
value(child, input) {
|
|
494
|
+
checkName(child, `${name}.extend`);
|
|
495
|
+
const where = `${name}.extend("${child}")`;
|
|
496
|
+
const base = callerDir() ?? process.cwd();
|
|
497
|
+
return makeEnvironment(child, [...layers, {
|
|
498
|
+
name: child,
|
|
499
|
+
spec: buildSpec(input, where, base)
|
|
500
|
+
}]);
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
return Object.freeze(env);
|
|
504
|
+
}
|
|
505
|
+
function checkName(name, what) {
|
|
506
|
+
if (typeof name !== "string" || !NAME.test(name)) throw new DefinitionError(`${what} needs a name of letters, digits, ".", "_", "@", "+" or "-" (got ${JSON.stringify(name)})`);
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* What an eval runs in: skills, MCP servers, files, rules, variables, secrets and setup steps.
|
|
510
|
+
* Pass a spec, or a callback that destructures the typed helpers it needs:
|
|
511
|
+
*
|
|
512
|
+
* defineEnvironment('genkit', ({ secret, skill }) => ({
|
|
513
|
+
* env: { GOOGLE_GENAI_API_KEY: secret.fromEnv('GOOGLE_GENERATIVE_AI_API_KEY') },
|
|
514
|
+
* skills: [skill.local('../skills/genkit')],
|
|
515
|
+
* }))
|
|
516
|
+
*
|
|
517
|
+
* The callback runs once, synchronously. Relative paths resolve against the calling file.
|
|
518
|
+
*/
|
|
519
|
+
function defineEnvironment(name, input) {
|
|
520
|
+
checkName(name, "defineEnvironment");
|
|
521
|
+
const base = callerDir() ?? process.cwd();
|
|
522
|
+
return makeEnvironment(name, [{
|
|
523
|
+
name,
|
|
524
|
+
spec: buildSpec(input, `defineEnvironment("${name}")`, base)
|
|
525
|
+
}]);
|
|
526
|
+
}
|
|
527
|
+
function applied(env) {
|
|
528
|
+
if (!env) return {
|
|
529
|
+
name: "-",
|
|
530
|
+
parent: null,
|
|
531
|
+
layers: []
|
|
532
|
+
};
|
|
533
|
+
return {
|
|
534
|
+
name: env.name,
|
|
535
|
+
parent: env.layers.at(-2)?.name ?? null,
|
|
536
|
+
layers: [...env.layers]
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
/** `control.extend(variant)`: the variant's own layers on the control's, skipping shared ones. */
|
|
540
|
+
function layered(control, variant) {
|
|
541
|
+
const base = control?.layers ?? [];
|
|
542
|
+
const seen = new Set(base.map((l) => JSON.stringify(l)));
|
|
543
|
+
return {
|
|
544
|
+
name: variant.name,
|
|
545
|
+
parent: control?.name ?? null,
|
|
546
|
+
layers: [...base, ...variant.layers.filter((l) => !seen.has(JSON.stringify(l)))]
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
//#endregion
|
|
550
|
+
export { stepCommand as _, checkEnv as a, workspaceOf as b, isEnvironment as c, isSecret as d, isSecretTemplate as f, plannedSecrets as g, parseGitRepo as h, checkEgress as i, isHostFile as l, mcpHosts as m, applied as n, defineEnvironment as o, layered as p, callerDir as r, helpersFor as s, DEFAULT_SKILL_EXCLUDE as t, isMovingRef as u, unbrokeredSecrets as v, parseDuration as x, workspaceLabel as y };
|
|
551
|
+
|
|
552
|
+
//# sourceMappingURL=environment-Mz7wvrtD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment-Mz7wvrtD.js","names":[],"sources":["../src/duration.ts","../src/environment.ts"],"mappings":";;;;;;;AAGA,MAAM,QAAQ;CAAE,IAAI;CAAG,GAAG;CAAO,GAAG;CAAQ,GAAG;AAAU;;AAGzD,SAAgB,cAAc,OAAyB;CACrD,IAAI,KAAK;CACT,IAAI,OAAO,UAAU,UAAU;EAC7B,MAAM,QAAQ,8BAA8B,KAAK,KAAK;EACtD,IAAI,CAAC,OAAO,MAAM,IAAI,WAAW,qBAAqB,MAAM,4BAA4B;EACxF,KAAK,OAAO,MAAM,EAAE,IAAI,MAAM,MAAM;CACtC;CACA,IAAI,EAAE,KAAK,KAAK,OAAO,SAAS,EAAE,IAAI;EACpC,MAAM,QAAQ,OAAO,UAAU,WAAW,IAAI,MAAM,KAAK,OAAO,KAAK;EACrE,MAAM,IAAI,WACR,oBAAoB,MAAM,yDAC5B;CACF;CACA,OAAO;AACT;;;ACUA,IAAa,kBAAb,cAAqC,MAAM;CACzC,OAAgB;AAClB;AAEA,MAAM,OAAO;AACb,MAAM,MAAM;AACZ,MAAM,YAAY;CAAC;CAAa;CAAO;CAAU;CAAS;CAAS;CAAS;CAAU;AAAK;;AAE3F,MAAM,eAAe;CAAC;CAAS;CAAW;CAAc;AAAM;AAC9D,MAAM,aAAqC;CACzC,MAAM;CACN,OAAO;CACP,KAAK;CACL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