@a5c-ai/genty-runtime 5.1.1-staging.5e92128884d3
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/README.md +69 -0
- package/dist/apiResult.d.ts +19 -0
- package/dist/apiResult.d.ts.map +1 -0
- package/dist/apiResult.js +16 -0
- package/dist/background/state.d.ts +20 -0
- package/dist/background/state.d.ts.map +1 -0
- package/dist/background/state.js +52 -0
- package/dist/backgroundProcessRegistry.d.ts +124 -0
- package/dist/backgroundProcessRegistry.d.ts.map +1 -0
- package/dist/backgroundProcessRegistry.js +427 -0
- package/dist/cost/claudeCodeParser.d.ts +81 -0
- package/dist/cost/claudeCodeParser.d.ts.map +1 -0
- package/dist/cost/claudeCodeParser.js +232 -0
- package/dist/cost/collector.d.ts +42 -0
- package/dist/cost/collector.d.ts.map +1 -0
- package/dist/cost/collector.js +105 -0
- package/dist/cost/effectCost.d.ts +23 -0
- package/dist/cost/effectCost.d.ts.map +1 -0
- package/dist/cost/effectCost.js +26 -0
- package/dist/cost/index.d.ts +19 -0
- package/dist/cost/index.d.ts.map +1 -0
- package/dist/cost/index.js +39 -0
- package/dist/cost/journal.d.ts +40 -0
- package/dist/cost/journal.d.ts.map +1 -0
- package/dist/cost/journal.js +137 -0
- package/dist/cost/types.d.ts +164 -0
- package/dist/cost/types.d.ts.map +1 -0
- package/dist/cost/types.js +228 -0
- package/dist/daemon/automationExecutor.d.ts +16 -0
- package/dist/daemon/automationExecutor.d.ts.map +1 -0
- package/dist/daemon/automationExecutor.js +222 -0
- package/dist/daemon/config.d.ts +8 -0
- package/dist/daemon/config.d.ts.map +1 -0
- package/dist/daemon/config.js +245 -0
- package/dist/daemon/daemonLog.d.ts +30 -0
- package/dist/daemon/daemonLog.d.ts.map +1 -0
- package/dist/daemon/daemonLog.js +140 -0
- package/dist/daemon/durableQueue.d.ts +41 -0
- package/dist/daemon/durableQueue.d.ts.map +1 -0
- package/dist/daemon/durableQueue.js +183 -0
- package/dist/daemon/fileWatcher.d.ts +9 -0
- package/dist/daemon/fileWatcher.d.ts.map +1 -0
- package/dist/daemon/fileWatcher.js +144 -0
- package/dist/daemon/index.d.ts +15 -0
- package/dist/daemon/index.d.ts.map +1 -0
- package/dist/daemon/index.js +25 -0
- package/dist/daemon/lifecycle.d.ts +13 -0
- package/dist/daemon/lifecycle.d.ts.map +1 -0
- package/dist/daemon/lifecycle.js +320 -0
- package/dist/daemon/loop.d.ts +27 -0
- package/dist/daemon/loop.d.ts.map +1 -0
- package/dist/daemon/loop.js +387 -0
- package/dist/daemon/timerScheduler.d.ts +13 -0
- package/dist/daemon/timerScheduler.d.ts.map +1 -0
- package/dist/daemon/timerScheduler.js +212 -0
- package/dist/daemon/types.d.ts +122 -0
- package/dist/daemon/types.d.ts.map +1 -0
- package/dist/daemon/types.js +25 -0
- package/dist/daemon/webhookListener.d.ts +6 -0
- package/dist/daemon/webhookListener.d.ts.map +1 -0
- package/dist/daemon/webhookListener.js +132 -0
- package/dist/execution/index.d.ts +10 -0
- package/dist/execution/index.d.ts.map +1 -0
- package/dist/execution/index.js +20 -0
- package/dist/execution/modes/docker.d.ts +26 -0
- package/dist/execution/modes/docker.d.ts.map +1 -0
- package/dist/execution/modes/docker.js +183 -0
- package/dist/execution/modes/index.d.ts +10 -0
- package/dist/execution/modes/index.d.ts.map +1 -0
- package/dist/execution/modes/index.js +14 -0
- package/dist/execution/modes/kubernetes.d.ts +46 -0
- package/dist/execution/modes/kubernetes.d.ts.map +1 -0
- package/dist/execution/modes/kubernetes.js +334 -0
- package/dist/execution/modes/local.d.ts +23 -0
- package/dist/execution/modes/local.d.ts.map +1 -0
- package/dist/execution/modes/local.js +117 -0
- package/dist/execution/modes/ssh.d.ts +23 -0
- package/dist/execution/modes/ssh.d.ts.map +1 -0
- package/dist/execution/modes/ssh.js +144 -0
- package/dist/execution/policy.d.ts +15 -0
- package/dist/execution/policy.d.ts.map +1 -0
- package/dist/execution/policy.js +121 -0
- package/dist/execution/provider.d.ts +32 -0
- package/dist/execution/provider.d.ts.map +1 -0
- package/dist/execution/provider.js +90 -0
- package/dist/execution/types.d.ts +189 -0
- package/dist/execution/types.d.ts.map +1 -0
- package/dist/execution/types.js +9 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/observability/diagnostics.d.ts +25 -0
- package/dist/observability/diagnostics.d.ts.map +1 -0
- package/dist/observability/diagnostics.js +98 -0
- package/dist/observability/health.d.ts +19 -0
- package/dist/observability/health.d.ts.map +1 -0
- package/dist/observability/health.js +145 -0
- package/dist/observability/index.d.ts +7 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +25 -0
- package/dist/observability/runStatus.d.ts +44 -0
- package/dist/observability/runStatus.d.ts.map +1 -0
- package/dist/observability/runStatus.js +169 -0
- package/dist/observability/timeline.d.ts +11 -0
- package/dist/observability/timeline.d.ts.map +1 -0
- package/dist/observability/timeline.js +176 -0
- package/dist/observability/types.d.ts +65 -0
- package/dist/observability/types.d.ts.map +1 -0
- package/dist/observability/types.js +8 -0
- package/dist/observability/webhooks.d.ts +68 -0
- package/dist/observability/webhooks.d.ts.map +1 -0
- package/dist/observability/webhooks.js +132 -0
- package/dist/resources/budget-tracker.d.ts +56 -0
- package/dist/resources/budget-tracker.d.ts.map +1 -0
- package/dist/resources/budget-tracker.js +131 -0
- package/dist/resources/concurrency-guard.d.ts +55 -0
- package/dist/resources/concurrency-guard.d.ts.map +1 -0
- package/dist/resources/concurrency-guard.js +132 -0
- package/dist/resources/index.d.ts +12 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +20 -0
- package/dist/resources/manager.d.ts +52 -0
- package/dist/resources/manager.d.ts.map +1 -0
- package/dist/resources/manager.js +150 -0
- package/dist/resources/timeout-cascade.d.ts +56 -0
- package/dist/resources/timeout-cascade.d.ts.map +1 -0
- package/dist/resources/timeout-cascade.js +145 -0
- package/dist/resources/types.d.ts +130 -0
- package/dist/resources/types.d.ts.map +1 -0
- package/dist/resources/types.js +9 -0
- package/dist/session/context.d.ts +22 -0
- package/dist/session/context.d.ts.map +1 -0
- package/dist/session/context.js +113 -0
- package/dist/session/continuityState.d.ts +39 -0
- package/dist/session/continuityState.d.ts.map +1 -0
- package/dist/session/continuityState.js +164 -0
- package/dist/session/cost.d.ts +63 -0
- package/dist/session/cost.d.ts.map +1 -0
- package/dist/session/cost.js +194 -0
- package/dist/session/discovery.d.ts +22 -0
- package/dist/session/discovery.d.ts.map +1 -0
- package/dist/session/discovery.js +35 -0
- package/dist/session/history.d.ts +30 -0
- package/dist/session/history.d.ts.map +1 -0
- package/dist/session/history.js +143 -0
- package/dist/session/index.d.ts +20 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +78 -0
- package/dist/session/memoryExtraction.d.ts +65 -0
- package/dist/session/memoryExtraction.d.ts.map +1 -0
- package/dist/session/memoryExtraction.js +201 -0
- package/dist/session/parse.d.ts +45 -0
- package/dist/session/parse.d.ts.map +1 -0
- package/dist/session/parse.js +170 -0
- package/dist/session/persistence.d.ts +46 -0
- package/dist/session/persistence.d.ts.map +1 -0
- package/dist/session/persistence.js +180 -0
- package/dist/session/types.d.ts +267 -0
- package/dist/session/types.d.ts.map +1 -0
- package/dist/session/types.js +45 -0
- package/dist/session/write.d.ts +61 -0
- package/dist/session/write.d.ts.map +1 -0
- package/dist/session/write.js +213 -0
- package/dist/shellInvocation.d.ts +6 -0
- package/dist/shellInvocation.d.ts.map +1 -0
- package/dist/shellInvocation.js +8 -0
- package/dist/shellInvocation.test.d.ts +2 -0
- package/dist/shellInvocation.test.d.ts.map +1 -0
- package/dist/shellInvocation.test.js +18 -0
- package/dist/telemetry/audit-log.d.ts +56 -0
- package/dist/telemetry/audit-log.d.ts.map +1 -0
- package/dist/telemetry/audit-log.js +59 -0
- package/dist/telemetry/exporters.d.ts +35 -0
- package/dist/telemetry/exporters.d.ts.map +1 -0
- package/dist/telemetry/exporters.js +141 -0
- package/dist/telemetry/index.d.ts +12 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +25 -0
- package/dist/telemetry/provider.d.ts +57 -0
- package/dist/telemetry/provider.d.ts.map +1 -0
- package/dist/telemetry/provider.js +261 -0
- package/dist/telemetry/span-tree.d.ts +46 -0
- package/dist/telemetry/span-tree.d.ts.map +1 -0
- package/dist/telemetry/span-tree.js +93 -0
- package/dist/telemetry/traceContext.d.ts +10 -0
- package/dist/telemetry/traceContext.d.ts.map +1 -0
- package/dist/telemetry/traceContext.js +43 -0
- package/dist/telemetry/types.d.ts +109 -0
- package/dist/telemetry/types.d.ts.map +1 -0
- package/dist/telemetry/types.js +21 -0
- package/package.json +98 -0
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* KubernetesExecutor — kubectl-backed Kubernetes Job execution.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.KubernetesExecutor = void 0;
|
|
7
|
+
const node_child_process_1 = require("node:child_process");
|
|
8
|
+
const node_crypto_1 = require("node:crypto");
|
|
9
|
+
const policy_1 = require("../policy");
|
|
10
|
+
class KubernetesExecutor {
|
|
11
|
+
entries = new Map();
|
|
12
|
+
kubectl;
|
|
13
|
+
pollIntervalMs;
|
|
14
|
+
constructor(options) {
|
|
15
|
+
this.kubectl = options?.kubectl ?? createKubectlInvoker(options?.kubectlPath ?? "kubectl");
|
|
16
|
+
this.pollIntervalMs = options?.pollIntervalMs ?? 1_000;
|
|
17
|
+
}
|
|
18
|
+
async spawn(command, args, config) {
|
|
19
|
+
const id = (0, node_crypto_1.randomUUID)();
|
|
20
|
+
const jobName = `babysitter-${id.slice(0, 8)}`;
|
|
21
|
+
const manifest = this._buildManifest(jobName, command, args, config);
|
|
22
|
+
const handle = {
|
|
23
|
+
id,
|
|
24
|
+
mode: "kubernetes",
|
|
25
|
+
status: "running",
|
|
26
|
+
};
|
|
27
|
+
const entry = { handle, config, manifest, jobName };
|
|
28
|
+
try {
|
|
29
|
+
await this.kubectl(["apply", "-f", "-"], { input: manifest, timeoutMs: config.kubectlTimeoutMs });
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
handle.status = "failed";
|
|
33
|
+
throw normalizeKubectlError("kubectl apply failed", error);
|
|
34
|
+
}
|
|
35
|
+
this.entries.set(id, entry);
|
|
36
|
+
return this._toPublicHandle(entry);
|
|
37
|
+
}
|
|
38
|
+
async attach(id) {
|
|
39
|
+
const entry = this.entries.get(id);
|
|
40
|
+
if (!entry)
|
|
41
|
+
return undefined;
|
|
42
|
+
return this._toPublicHandle(entry);
|
|
43
|
+
}
|
|
44
|
+
list() {
|
|
45
|
+
return [...this.entries.values()].map((e) => this._toPublicHandle(e));
|
|
46
|
+
}
|
|
47
|
+
async destroy(id) {
|
|
48
|
+
const entry = this.entries.get(id);
|
|
49
|
+
if (!entry)
|
|
50
|
+
return;
|
|
51
|
+
try {
|
|
52
|
+
await this.kubectl([
|
|
53
|
+
"delete",
|
|
54
|
+
"job",
|
|
55
|
+
entry.jobName,
|
|
56
|
+
"-n",
|
|
57
|
+
entry.config.namespace,
|
|
58
|
+
"--ignore-not-found=true",
|
|
59
|
+
], { timeoutMs: entry.config.kubectlTimeoutMs });
|
|
60
|
+
entry.handle.status = "stopped";
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
entry.handle.status = "failed";
|
|
64
|
+
throw normalizeKubectlError("kubectl delete failed", error);
|
|
65
|
+
}
|
|
66
|
+
finally {
|
|
67
|
+
this.entries.delete(id);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async waitForCompletion(id) {
|
|
71
|
+
const entry = this.entries.get(id);
|
|
72
|
+
if (!entry) {
|
|
73
|
+
throw new Error(`Unknown Kubernetes execution handle: ${id}`);
|
|
74
|
+
}
|
|
75
|
+
const deadline = Date.now() + (entry.config.timeoutMs ?? 300_000);
|
|
76
|
+
while (Date.now() < deadline) {
|
|
77
|
+
const status = await this.readJobStatus(entry);
|
|
78
|
+
if ((status.succeeded ?? 0) > 0) {
|
|
79
|
+
entry.handle.status = "stopped";
|
|
80
|
+
if (entry.config.cleanupAfterCompletion)
|
|
81
|
+
await this.destroy(id);
|
|
82
|
+
return this._toPublicHandle(entry);
|
|
83
|
+
}
|
|
84
|
+
if ((status.failed ?? 0) > 0) {
|
|
85
|
+
entry.handle.status = "failed";
|
|
86
|
+
if (entry.config.cleanupAfterCompletion) {
|
|
87
|
+
await this.destroy(id);
|
|
88
|
+
entry.handle.status = "failed";
|
|
89
|
+
}
|
|
90
|
+
throw new Error(`Kubernetes job ${entry.jobName} failed`);
|
|
91
|
+
}
|
|
92
|
+
const remainingMs = deadline - Date.now();
|
|
93
|
+
if (remainingMs <= 0)
|
|
94
|
+
break;
|
|
95
|
+
await sleep(Math.min(this.pollIntervalMs, remainingMs));
|
|
96
|
+
}
|
|
97
|
+
entry.handle.status = "failed";
|
|
98
|
+
if (entry.config.cleanupAfterCompletion) {
|
|
99
|
+
await this.destroy(id);
|
|
100
|
+
entry.handle.status = "failed";
|
|
101
|
+
}
|
|
102
|
+
throw new Error(`Kubernetes job ${entry.jobName} timed out`);
|
|
103
|
+
}
|
|
104
|
+
_buildManifest(jobName, command, args, config) {
|
|
105
|
+
(0, policy_1.validateFilesystemMounts)(config.policy);
|
|
106
|
+
const resourceBlock = this._resourcesFromConfig(config)
|
|
107
|
+
? this._resourcesYaml(this._resourcesFromConfig(config))
|
|
108
|
+
: "";
|
|
109
|
+
const serviceAccountLine = config.serviceAccount
|
|
110
|
+
? ` serviceAccountName: ${config.serviceAccount}\n`
|
|
111
|
+
: "";
|
|
112
|
+
const commandYaml = ` command: ${JSON.stringify([command, ...args])}`;
|
|
113
|
+
const envBlock = this._envYaml((0, policy_1.resolveExecutionEnvironment)(config.env, config.policy));
|
|
114
|
+
const securityContextBlock = this._securityContextYaml(config);
|
|
115
|
+
const volumeMountBlock = this._volumeMountsYaml(config);
|
|
116
|
+
const volumesBlock = this._volumesYaml(config);
|
|
117
|
+
return [
|
|
118
|
+
"apiVersion: batch/v1",
|
|
119
|
+
"kind: Job",
|
|
120
|
+
"metadata:",
|
|
121
|
+
` name: ${jobName}`,
|
|
122
|
+
` namespace: ${config.namespace}`,
|
|
123
|
+
" labels:",
|
|
124
|
+
" app.kubernetes.io/managed-by: babysitter",
|
|
125
|
+
` babysitter.a5c.ai/execution-id: ${jobName}`,
|
|
126
|
+
"spec:",
|
|
127
|
+
" backoffLimit: 0",
|
|
128
|
+
" template:",
|
|
129
|
+
" metadata:",
|
|
130
|
+
" labels:",
|
|
131
|
+
` babysitter.a5c.ai/execution-id: ${jobName}`,
|
|
132
|
+
" spec:",
|
|
133
|
+
serviceAccountLine ? serviceAccountLine.trimEnd() : null,
|
|
134
|
+
" restartPolicy: Never",
|
|
135
|
+
" containers:",
|
|
136
|
+
" - name: main",
|
|
137
|
+
` image: ${config.image}`,
|
|
138
|
+
commandYaml,
|
|
139
|
+
envBlock || null,
|
|
140
|
+
volumeMountBlock || null,
|
|
141
|
+
securityContextBlock,
|
|
142
|
+
resourceBlock || null,
|
|
143
|
+
volumesBlock || null,
|
|
144
|
+
]
|
|
145
|
+
.filter((line) => line !== null)
|
|
146
|
+
.join("\n");
|
|
147
|
+
}
|
|
148
|
+
async streamLogs(entry) {
|
|
149
|
+
const result = await this.kubectl([
|
|
150
|
+
"logs",
|
|
151
|
+
`job/${entry.jobName}`,
|
|
152
|
+
"-n",
|
|
153
|
+
entry.config.namespace,
|
|
154
|
+
"--all-containers=true",
|
|
155
|
+
], { timeoutMs: entry.config.kubectlTimeoutMs });
|
|
156
|
+
entry.logs = redactText(result.stdout);
|
|
157
|
+
}
|
|
158
|
+
async readJobStatus(entry) {
|
|
159
|
+
try {
|
|
160
|
+
const result = await this.kubectl([
|
|
161
|
+
"get",
|
|
162
|
+
"job",
|
|
163
|
+
entry.jobName,
|
|
164
|
+
"-n",
|
|
165
|
+
entry.config.namespace,
|
|
166
|
+
"-o",
|
|
167
|
+
"json",
|
|
168
|
+
], { timeoutMs: entry.config.kubectlTimeoutMs });
|
|
169
|
+
const parsed = JSON.parse(result.stdout);
|
|
170
|
+
return parsed.status ?? {};
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
entry.handle.status = "failed";
|
|
174
|
+
throw normalizeKubectlError("kubectl get job failed", error);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
_resourcesYaml(resources) {
|
|
178
|
+
const lines = Object.entries(resources).map(([key, value]) => ` ${key}: "${value}"`);
|
|
179
|
+
return [
|
|
180
|
+
" resources:",
|
|
181
|
+
" requests:",
|
|
182
|
+
...lines,
|
|
183
|
+
" limits:",
|
|
184
|
+
...lines,
|
|
185
|
+
].join("\n");
|
|
186
|
+
}
|
|
187
|
+
_resourcesFromConfig(config) {
|
|
188
|
+
const resources = { ...(config.resources ?? {}) };
|
|
189
|
+
if (config.policy?.resources?.cpuCount !== undefined) {
|
|
190
|
+
resources.cpu = String(config.policy.resources.cpuCount);
|
|
191
|
+
}
|
|
192
|
+
if (config.policy?.resources?.memoryBytes !== undefined) {
|
|
193
|
+
resources.memory = String(config.policy.resources.memoryBytes);
|
|
194
|
+
}
|
|
195
|
+
return Object.keys(resources).length > 0 ? resources : undefined;
|
|
196
|
+
}
|
|
197
|
+
_envYaml(env) {
|
|
198
|
+
const entries = Object.entries(env);
|
|
199
|
+
if (entries.length === 0) {
|
|
200
|
+
return "";
|
|
201
|
+
}
|
|
202
|
+
return [
|
|
203
|
+
` env:`,
|
|
204
|
+
...entries.flatMap(([key, value]) => [
|
|
205
|
+
` - name: ${key}`,
|
|
206
|
+
` value: ${JSON.stringify(redactEnvValue(key, value))}`,
|
|
207
|
+
]),
|
|
208
|
+
].join("\n");
|
|
209
|
+
}
|
|
210
|
+
_volumeMountsYaml(config) {
|
|
211
|
+
const mounts = config.policy?.filesystem?.mounts ?? [];
|
|
212
|
+
if (mounts.length === 0) {
|
|
213
|
+
return "";
|
|
214
|
+
}
|
|
215
|
+
return [
|
|
216
|
+
` volumeMounts:`,
|
|
217
|
+
...mounts.flatMap((mount, index) => [
|
|
218
|
+
` - name: policy-mount-${index}`,
|
|
219
|
+
` mountPath: ${mount.containerPath}`,
|
|
220
|
+
` readOnly: ${mount.readOnly ?? true}`,
|
|
221
|
+
]),
|
|
222
|
+
].join("\n");
|
|
223
|
+
}
|
|
224
|
+
_volumesYaml(config) {
|
|
225
|
+
const mounts = config.policy?.filesystem?.mounts ?? [];
|
|
226
|
+
if (mounts.length === 0) {
|
|
227
|
+
return "";
|
|
228
|
+
}
|
|
229
|
+
return [
|
|
230
|
+
` volumes:`,
|
|
231
|
+
...mounts.flatMap((mount, index) => [
|
|
232
|
+
` - name: policy-mount-${index}`,
|
|
233
|
+
` hostPath:`,
|
|
234
|
+
` path: ${mount.hostPath}`,
|
|
235
|
+
]),
|
|
236
|
+
].join("\n");
|
|
237
|
+
}
|
|
238
|
+
_securityContextYaml(config) {
|
|
239
|
+
const policy = config.policy?.kubernetes;
|
|
240
|
+
return [
|
|
241
|
+
` securityContext:`,
|
|
242
|
+
` runAsNonRoot: ${policy?.runAsNonRoot ?? true}`,
|
|
243
|
+
` readOnlyRootFilesystem: ${policy?.readOnlyRootFilesystem ?? true}`,
|
|
244
|
+
` allowPrivilegeEscalation: ${policy?.allowPrivilegeEscalation ?? false}`,
|
|
245
|
+
].join("\n");
|
|
246
|
+
}
|
|
247
|
+
// ---------- Handle --------------------------------------------------------
|
|
248
|
+
_toPublicHandle(entry) {
|
|
249
|
+
const self = this;
|
|
250
|
+
return {
|
|
251
|
+
get id() {
|
|
252
|
+
return entry.handle.id;
|
|
253
|
+
},
|
|
254
|
+
get mode() {
|
|
255
|
+
return entry.handle.mode;
|
|
256
|
+
},
|
|
257
|
+
get status() {
|
|
258
|
+
return entry.handle.status;
|
|
259
|
+
},
|
|
260
|
+
get manifest() {
|
|
261
|
+
return entry.manifest;
|
|
262
|
+
},
|
|
263
|
+
get jobName() {
|
|
264
|
+
return entry.jobName;
|
|
265
|
+
},
|
|
266
|
+
get logs() {
|
|
267
|
+
return entry.logs;
|
|
268
|
+
},
|
|
269
|
+
async attach() {
|
|
270
|
+
await self.streamLogs(entry);
|
|
271
|
+
},
|
|
272
|
+
async destroy() {
|
|
273
|
+
await self.destroy(entry.handle.id);
|
|
274
|
+
},
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
exports.KubernetesExecutor = KubernetesExecutor;
|
|
279
|
+
function createKubectlInvoker(kubectlPath) {
|
|
280
|
+
return (args, options) => new Promise((resolve, reject) => {
|
|
281
|
+
const child = (0, node_child_process_1.spawn)(kubectlPath, args, { stdio: ["pipe", "pipe", "pipe"] });
|
|
282
|
+
let stdout = "";
|
|
283
|
+
let stderr = "";
|
|
284
|
+
const timeout = options?.timeoutMs
|
|
285
|
+
? setTimeout(() => {
|
|
286
|
+
child.kill("SIGKILL");
|
|
287
|
+
reject(new Error(`kubectl timed out after ${options.timeoutMs}ms`));
|
|
288
|
+
}, options.timeoutMs)
|
|
289
|
+
: null;
|
|
290
|
+
child.stdout?.on("data", (chunk) => {
|
|
291
|
+
stdout += String(chunk);
|
|
292
|
+
});
|
|
293
|
+
child.stderr?.on("data", (chunk) => {
|
|
294
|
+
stderr += String(chunk);
|
|
295
|
+
});
|
|
296
|
+
child.on("error", (error) => {
|
|
297
|
+
if (timeout)
|
|
298
|
+
clearTimeout(timeout);
|
|
299
|
+
reject(error);
|
|
300
|
+
});
|
|
301
|
+
child.on("exit", (code) => {
|
|
302
|
+
if (timeout)
|
|
303
|
+
clearTimeout(timeout);
|
|
304
|
+
if (code === 0) {
|
|
305
|
+
resolve({ stdout, stderr });
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
reject(new Error(`kubectl exited with code ${code}: ${stderr.trim()}`));
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
if (options?.input) {
|
|
312
|
+
child.stdin?.end(options.input);
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
child.stdin?.end();
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
function normalizeKubectlError(prefix, error) {
|
|
320
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
321
|
+
return new Error(`${prefix}: ${redactText(message)}`);
|
|
322
|
+
}
|
|
323
|
+
function sleep(ms) {
|
|
324
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
325
|
+
}
|
|
326
|
+
function redactEnvValue(name, value) {
|
|
327
|
+
return isSecretKey(name) ? "[REDACTED]" : value;
|
|
328
|
+
}
|
|
329
|
+
function redactText(value) {
|
|
330
|
+
return value.replace(/(token|secret|password|api[_-]?key)=\S+/gi, "$1=[REDACTED]");
|
|
331
|
+
}
|
|
332
|
+
function isSecretKey(key) {
|
|
333
|
+
return /(token|secret|password|api[_-]?key|credential)/i.test(key);
|
|
334
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LocalExecutor — spawns processes on the host machine via child_process.
|
|
3
|
+
*
|
|
4
|
+
* This is the fully-functional executor: it creates real child processes,
|
|
5
|
+
* tracks them by handle ID, and supports attach (reconnect to streams)
|
|
6
|
+
* and destroy (kill process) operations.
|
|
7
|
+
*/
|
|
8
|
+
import type { ExecutionHandle, LocalExecutionConfig } from "../types";
|
|
9
|
+
export interface Executor<C> {
|
|
10
|
+
spawn(command: string, args: string[], config: C): Promise<ExecutionHandle>;
|
|
11
|
+
attach(id: string): Promise<ExecutionHandle | undefined>;
|
|
12
|
+
list(): ExecutionHandle[];
|
|
13
|
+
destroy(id: string): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare class LocalExecutor implements Executor<LocalExecutionConfig> {
|
|
16
|
+
private readonly processes;
|
|
17
|
+
spawn(command: string, args: string[], config: LocalExecutionConfig): Promise<ExecutionHandle>;
|
|
18
|
+
attach(id: string): Promise<ExecutionHandle | undefined>;
|
|
19
|
+
list(): ExecutionHandle[];
|
|
20
|
+
destroy(id: string): Promise<void>;
|
|
21
|
+
private _toPublicHandle;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=local.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../../src/execution/modes/local.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACrB,MAAM,UAAU,CAAC;AA0BlB,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC5E,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAAC;IACzD,IAAI,IAAI,eAAe,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAMD,qBAAa,aAAc,YAAW,QAAQ,CAAC,oBAAoB,CAAC;IAClE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmC;IAEvD,KAAK,CACT,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,eAAe,CAAC;IA2CrB,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;IAM9D,IAAI,IAAI,eAAe,EAAE;IAInB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA8BxC,OAAO,CAAC,eAAe;CA0BxB"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* LocalExecutor — spawns processes on the host machine via child_process.
|
|
4
|
+
*
|
|
5
|
+
* This is the fully-functional executor: it creates real child processes,
|
|
6
|
+
* tracks them by handle ID, and supports attach (reconnect to streams)
|
|
7
|
+
* and destroy (kill process) operations.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.LocalExecutor = void 0;
|
|
11
|
+
const node_child_process_1 = require("node:child_process");
|
|
12
|
+
const node_crypto_1 = require("node:crypto");
|
|
13
|
+
const policy_1 = require("../policy");
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// LocalExecutor
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
class LocalExecutor {
|
|
18
|
+
processes = new Map();
|
|
19
|
+
async spawn(command, args, config) {
|
|
20
|
+
(0, policy_1.validateLocalExecutionPolicy)(config);
|
|
21
|
+
const id = (0, node_crypto_1.randomUUID)();
|
|
22
|
+
const child = (0, node_child_process_1.spawn)(command, args, {
|
|
23
|
+
cwd: config.cwd,
|
|
24
|
+
env: (0, policy_1.resolveExecutionEnvironment)(config.env, config.policy),
|
|
25
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
26
|
+
});
|
|
27
|
+
const timeoutMs = config.policy?.resources?.timeoutMs;
|
|
28
|
+
let timeout;
|
|
29
|
+
if (timeoutMs !== undefined) {
|
|
30
|
+
timeout = setTimeout(() => {
|
|
31
|
+
if (!child.killed && child.exitCode === null) {
|
|
32
|
+
child.kill("SIGTERM");
|
|
33
|
+
}
|
|
34
|
+
}, timeoutMs);
|
|
35
|
+
}
|
|
36
|
+
const handle = {
|
|
37
|
+
id,
|
|
38
|
+
mode: "local",
|
|
39
|
+
status: "running",
|
|
40
|
+
};
|
|
41
|
+
const entry = { handle, process: child, config };
|
|
42
|
+
this.processes.set(id, entry);
|
|
43
|
+
// Update status when the child exits.
|
|
44
|
+
child.on("exit", (code) => {
|
|
45
|
+
if (timeout)
|
|
46
|
+
clearTimeout(timeout);
|
|
47
|
+
handle.status = code === 0 ? "stopped" : "failed";
|
|
48
|
+
});
|
|
49
|
+
child.on("error", () => {
|
|
50
|
+
if (timeout)
|
|
51
|
+
clearTimeout(timeout);
|
|
52
|
+
handle.status = "failed";
|
|
53
|
+
});
|
|
54
|
+
return this._toPublicHandle(entry);
|
|
55
|
+
}
|
|
56
|
+
async attach(id) {
|
|
57
|
+
const entry = this.processes.get(id);
|
|
58
|
+
if (!entry)
|
|
59
|
+
return undefined;
|
|
60
|
+
return this._toPublicHandle(entry);
|
|
61
|
+
}
|
|
62
|
+
list() {
|
|
63
|
+
return [...this.processes.values()].map((e) => this._toPublicHandle(e));
|
|
64
|
+
}
|
|
65
|
+
async destroy(id) {
|
|
66
|
+
const entry = this.processes.get(id);
|
|
67
|
+
if (!entry)
|
|
68
|
+
return;
|
|
69
|
+
const child = entry.process;
|
|
70
|
+
if (!child.killed && child.exitCode === null) {
|
|
71
|
+
child.kill("SIGTERM");
|
|
72
|
+
// Give the process a short window to exit gracefully before SIGKILL.
|
|
73
|
+
await new Promise((resolve) => {
|
|
74
|
+
const timeout = setTimeout(() => {
|
|
75
|
+
if (!child.killed && child.exitCode === null) {
|
|
76
|
+
child.kill("SIGKILL");
|
|
77
|
+
}
|
|
78
|
+
resolve();
|
|
79
|
+
}, 3_000);
|
|
80
|
+
child.on("exit", () => {
|
|
81
|
+
clearTimeout(timeout);
|
|
82
|
+
resolve();
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
entry.handle.status = "stopped";
|
|
87
|
+
this.processes.delete(id);
|
|
88
|
+
}
|
|
89
|
+
// ---------- Helpers -------------------------------------------------------
|
|
90
|
+
_toPublicHandle(entry) {
|
|
91
|
+
const self = this;
|
|
92
|
+
return {
|
|
93
|
+
get id() {
|
|
94
|
+
return entry.handle.id;
|
|
95
|
+
},
|
|
96
|
+
get mode() {
|
|
97
|
+
return entry.handle.mode;
|
|
98
|
+
},
|
|
99
|
+
get status() {
|
|
100
|
+
return entry.handle.status;
|
|
101
|
+
},
|
|
102
|
+
async attach() {
|
|
103
|
+
// Re-attach to stdout/stderr by piping to the current process streams.
|
|
104
|
+
if (entry.process.stdout) {
|
|
105
|
+
entry.process.stdout.pipe(process.stdout, { end: false });
|
|
106
|
+
}
|
|
107
|
+
if (entry.process.stderr) {
|
|
108
|
+
entry.process.stderr.pipe(process.stderr, { end: false });
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
async destroy() {
|
|
112
|
+
await self.destroy(entry.handle.id);
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
exports.LocalExecutor = LocalExecutor;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SshExecutor — constructs `ssh` commands from SshExecutionConfig and
|
|
3
|
+
* spawns them via child_process.
|
|
4
|
+
*
|
|
5
|
+
* This is a structural stub: it correctly assembles the SSH CLI invocation
|
|
6
|
+
* but the host must have an SSH client installed and the target must be
|
|
7
|
+
* reachable for it to work at runtime.
|
|
8
|
+
*/
|
|
9
|
+
import type { ExecutionHandle, SshExecutionConfig } from "../types";
|
|
10
|
+
import type { Executor } from "./local";
|
|
11
|
+
export declare class SshExecutor implements Executor<SshExecutionConfig> {
|
|
12
|
+
private readonly processes;
|
|
13
|
+
spawn(command: string, args: string[], config: SshExecutionConfig): Promise<ExecutionHandle>;
|
|
14
|
+
attach(id: string): Promise<ExecutionHandle | undefined>;
|
|
15
|
+
list(): ExecutionHandle[];
|
|
16
|
+
destroy(id: string): Promise<void>;
|
|
17
|
+
/** Build the full `ssh` argument list. */
|
|
18
|
+
_buildSshArgs(command: string, args: string[], config: SshExecutionConfig): string[];
|
|
19
|
+
/** Minimal shell escaping for remote command construction. */
|
|
20
|
+
private _shellEscape;
|
|
21
|
+
private _toPublicHandle;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=ssh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssh.d.ts","sourceRoot":"","sources":["../../../src/execution/modes/ssh.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAsBxC,qBAAa,WAAY,YAAW,QAAQ,CAAC,kBAAkB,CAAC;IAC9D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiC;IAErD,KAAK,CACT,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,eAAe,CAAC;IA2BrB,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;IAM9D,IAAI,IAAI,eAAe,EAAE;IAInB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA2BxC,0CAA0C;IAC1C,aAAa,CACX,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,kBAAkB,GACzB,MAAM,EAAE;IA4CX,8DAA8D;IAC9D,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,eAAe;CAyBxB"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* SshExecutor — constructs `ssh` commands from SshExecutionConfig and
|
|
4
|
+
* spawns them via child_process.
|
|
5
|
+
*
|
|
6
|
+
* This is a structural stub: it correctly assembles the SSH CLI invocation
|
|
7
|
+
* but the host must have an SSH client installed and the target must be
|
|
8
|
+
* reachable for it to work at runtime.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.SshExecutor = void 0;
|
|
12
|
+
const node_child_process_1 = require("node:child_process");
|
|
13
|
+
const node_crypto_1 = require("node:crypto");
|
|
14
|
+
const policy_1 = require("../policy");
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
// SshExecutor
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
class SshExecutor {
|
|
19
|
+
processes = new Map();
|
|
20
|
+
async spawn(command, args, config) {
|
|
21
|
+
const id = (0, node_crypto_1.randomUUID)();
|
|
22
|
+
const sshArgs = this._buildSshArgs(command, args, config);
|
|
23
|
+
const child = (0, node_child_process_1.spawn)("ssh", sshArgs, {
|
|
24
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
25
|
+
});
|
|
26
|
+
const handle = {
|
|
27
|
+
id,
|
|
28
|
+
mode: "ssh",
|
|
29
|
+
status: "running",
|
|
30
|
+
};
|
|
31
|
+
const entry = { handle, process: child, config };
|
|
32
|
+
this.processes.set(id, entry);
|
|
33
|
+
child.on("exit", (code) => {
|
|
34
|
+
handle.status = code === 0 ? "stopped" : "failed";
|
|
35
|
+
});
|
|
36
|
+
child.on("error", () => {
|
|
37
|
+
handle.status = "failed";
|
|
38
|
+
});
|
|
39
|
+
return this._toPublicHandle(entry);
|
|
40
|
+
}
|
|
41
|
+
async attach(id) {
|
|
42
|
+
const entry = this.processes.get(id);
|
|
43
|
+
if (!entry)
|
|
44
|
+
return undefined;
|
|
45
|
+
return this._toPublicHandle(entry);
|
|
46
|
+
}
|
|
47
|
+
list() {
|
|
48
|
+
return [...this.processes.values()].map((e) => this._toPublicHandle(e));
|
|
49
|
+
}
|
|
50
|
+
async destroy(id) {
|
|
51
|
+
const entry = this.processes.get(id);
|
|
52
|
+
if (!entry)
|
|
53
|
+
return;
|
|
54
|
+
const child = entry.process;
|
|
55
|
+
if (!child.killed && child.exitCode === null) {
|
|
56
|
+
child.kill("SIGTERM");
|
|
57
|
+
await new Promise((resolve) => {
|
|
58
|
+
const timeout = setTimeout(() => {
|
|
59
|
+
if (!child.killed && child.exitCode === null) {
|
|
60
|
+
child.kill("SIGKILL");
|
|
61
|
+
}
|
|
62
|
+
resolve();
|
|
63
|
+
}, 3_000);
|
|
64
|
+
child.on("exit", () => {
|
|
65
|
+
clearTimeout(timeout);
|
|
66
|
+
resolve();
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
entry.handle.status = "stopped";
|
|
71
|
+
this.processes.delete(id);
|
|
72
|
+
}
|
|
73
|
+
// ---------- Helpers -------------------------------------------------------
|
|
74
|
+
/** Build the full `ssh` argument list. */
|
|
75
|
+
_buildSshArgs(command, args, config) {
|
|
76
|
+
const sshArgs = [];
|
|
77
|
+
// Identity file.
|
|
78
|
+
if (config.keyPath) {
|
|
79
|
+
sshArgs.push("-i", config.keyPath);
|
|
80
|
+
}
|
|
81
|
+
// Port.
|
|
82
|
+
if (config.port && config.port !== 22) {
|
|
83
|
+
sshArgs.push("-p", String(config.port));
|
|
84
|
+
}
|
|
85
|
+
const sshPolicy = config.policy?.ssh;
|
|
86
|
+
if (sshPolicy?.insecureSkipHostKeyChecking) {
|
|
87
|
+
sshArgs.push("-o", "StrictHostKeyChecking=no");
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
sshArgs.push("-o", `StrictHostKeyChecking=${sshPolicy?.strictHostKeyChecking ?? "yes"}`);
|
|
91
|
+
if (sshPolicy?.knownHostsFile) {
|
|
92
|
+
sshArgs.push("-o", `UserKnownHostsFile=${sshPolicy.knownHostsFile}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
sshArgs.push("-o", "BatchMode=yes");
|
|
96
|
+
// Target: user@host.
|
|
97
|
+
sshArgs.push(`${config.user}@${config.host}`);
|
|
98
|
+
// Build the remote command string.
|
|
99
|
+
// Prepend env vars if provided.
|
|
100
|
+
let remoteCommand = "";
|
|
101
|
+
const env = (0, policy_1.resolveExecutionEnvironment)(config.env, config.policy);
|
|
102
|
+
if (Object.keys(env).length > 0) {
|
|
103
|
+
const envPrefix = Object.entries(env)
|
|
104
|
+
.map(([k, v]) => `${k}=${this._shellEscape(v)}`)
|
|
105
|
+
.join(" ");
|
|
106
|
+
remoteCommand = `${envPrefix} `;
|
|
107
|
+
}
|
|
108
|
+
remoteCommand += [command, ...args].map((a) => this._shellEscape(a)).join(" ");
|
|
109
|
+
sshArgs.push("--", remoteCommand);
|
|
110
|
+
return sshArgs;
|
|
111
|
+
}
|
|
112
|
+
/** Minimal shell escaping for remote command construction. */
|
|
113
|
+
_shellEscape(s) {
|
|
114
|
+
if (/^[a-zA-Z0-9_/.:=-]+$/.test(s))
|
|
115
|
+
return s;
|
|
116
|
+
return `'${s.replace(/'/g, "'\\''")}'`;
|
|
117
|
+
}
|
|
118
|
+
_toPublicHandle(entry) {
|
|
119
|
+
const self = this;
|
|
120
|
+
return {
|
|
121
|
+
get id() {
|
|
122
|
+
return entry.handle.id;
|
|
123
|
+
},
|
|
124
|
+
get mode() {
|
|
125
|
+
return entry.handle.mode;
|
|
126
|
+
},
|
|
127
|
+
get status() {
|
|
128
|
+
return entry.handle.status;
|
|
129
|
+
},
|
|
130
|
+
async attach() {
|
|
131
|
+
if (entry.process.stdout) {
|
|
132
|
+
entry.process.stdout.pipe(process.stdout, { end: false });
|
|
133
|
+
}
|
|
134
|
+
if (entry.process.stderr) {
|
|
135
|
+
entry.process.stderr.pipe(process.stderr, { end: false });
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
async destroy() {
|
|
139
|
+
await self.destroy(entry.handle.id);
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
exports.SshExecutor = SshExecutor;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ExecutionPolicy, LocalExecutionConfig, NormalizedResourceLimits } from "./types";
|
|
2
|
+
export interface ResourceAdmission {
|
|
3
|
+
readonly accepted: boolean;
|
|
4
|
+
readonly osLimits: NormalizedResourceLimits;
|
|
5
|
+
readonly unsupported: string[];
|
|
6
|
+
readonly warnings: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare function resolveExecutionEnvironment(explicitEnv?: Record<string, string>, policy?: ExecutionPolicy, parentEnv?: NodeJS.ProcessEnv): Record<string, string>;
|
|
9
|
+
export declare function validateFilesystemPolicy(cwd: string, policy?: ExecutionPolicy): void;
|
|
10
|
+
export declare function validateFilesystemMounts(policy?: ExecutionPolicy): void;
|
|
11
|
+
export declare function validateLocalExecutionPolicy(config: LocalExecutionConfig): void;
|
|
12
|
+
export declare function normalizeResourceLimits(policy?: ExecutionPolicy): NormalizedResourceLimits;
|
|
13
|
+
export declare function admitExecutionPolicy(policy?: ExecutionPolicy): ResourceAdmission;
|
|
14
|
+
export declare function shouldInheritParentEnv(policy?: ExecutionPolicy): boolean;
|
|
15
|
+
//# sourceMappingURL=policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/execution/policy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAC5C,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED,wBAAgB,2BAA2B,CACzC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,MAAM,CAAC,EAAE,eAAe,EACxB,SAAS,GAAE,MAAM,CAAC,UAAwB,GACzC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA0BxB;AAED,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,IAAI,CAUpF;AAED,wBAAgB,wBAAwB,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,IAAI,CAavE;AAaD,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAsC/E;AAED,wBAAgB,uBAAuB,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,wBAAwB,CAU1F;AAED,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,iBAAiB,CAgBhF;AAED,wBAAgB,sBAAsB,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,OAAO,CAExE"}
|