@cat-factory/local-server 0.6.0 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/dist/LocalContainerRunnerTransport.d.ts +83 -0
- package/dist/LocalContainerRunnerTransport.d.ts.map +1 -0
- package/dist/LocalContainerRunnerTransport.js +247 -0
- package/dist/LocalContainerRunnerTransport.js.map +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +9 -4
- package/dist/config.js.map +1 -1
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +14 -4
- package/dist/container.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/runtimes/appleContainerRuntime.d.ts +21 -0
- package/dist/runtimes/appleContainerRuntime.d.ts.map +1 -0
- package/dist/runtimes/appleContainerRuntime.js +191 -0
- package/dist/runtimes/appleContainerRuntime.js.map +1 -0
- package/dist/runtimes/containerRuntime.d.ts +96 -0
- package/dist/runtimes/containerRuntime.d.ts.map +1 -0
- package/dist/runtimes/containerRuntime.js +99 -0
- package/dist/runtimes/containerRuntime.js.map +1 -0
- package/dist/runtimes/dockerRuntime.d.ts +27 -0
- package/dist/runtimes/dockerRuntime.d.ts.map +1 -0
- package/dist/runtimes/dockerRuntime.js +124 -0
- package/dist/runtimes/dockerRuntime.js.map +1 -0
- package/dist/runtimes/index.d.ts +13 -0
- package/dist/runtimes/index.d.ts.map +1 -0
- package/dist/runtimes/index.js +33 -0
- package/dist/runtimes/index.js.map +1 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +67 -17
- package/dist/server.js.map +1 -1
- package/package.json +13 -8
- package/dist/LocalDockerRunnerTransport.d.ts +0 -95
- package/dist/LocalDockerRunnerTransport.d.ts.map +0 -1
- package/dist/LocalDockerRunnerTransport.js +0 -342
- package/dist/LocalDockerRunnerTransport.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Igor Savin
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Igor Savin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { RunnerDispatchKind, RunnerDispatchOptions, RunnerJobRef, RunnerJobView, RunnerTransport } from '@cat-factory/kernel';
|
|
2
|
+
import { type ContainerExec, type ContainerRuntimeAdapter } from './runtimes/index.js';
|
|
3
|
+
/** Injectable CLI runner — overridable in tests. Re-exported for callers/tests. */
|
|
4
|
+
export type { ContainerExec } from './runtimes/index.js';
|
|
5
|
+
export interface LocalContainerRunnerTransportOptions {
|
|
6
|
+
/** The executor-harness image ref (a GHCR pull or a locally built tag). */
|
|
7
|
+
image: string;
|
|
8
|
+
/**
|
|
9
|
+
* The container runtime adapter (Docker-family or Apple). Defaults to the Docker-CLI
|
|
10
|
+
* adapter (`docker` binary) so existing callers/tests keep working.
|
|
11
|
+
*/
|
|
12
|
+
adapter?: ContainerRuntimeAdapter;
|
|
13
|
+
/**
|
|
14
|
+
* Shared secret injected as `HARNESS_SHARED_SECRET` and sent as the
|
|
15
|
+
* `x-harness-secret` header on every call. Defaults to a random per-process value.
|
|
16
|
+
*/
|
|
17
|
+
sharedSecret?: string;
|
|
18
|
+
/** Optional `--network` for the container (docker family only). */
|
|
19
|
+
network?: string;
|
|
20
|
+
/** Extra `-e KEY=VALUE` env passed into the container (rarely needed). */
|
|
21
|
+
env?: Record<string, string>;
|
|
22
|
+
/** Injectable CLI exec — defaults to running the adapter's binary via execFile. */
|
|
23
|
+
exec?: ContainerExec;
|
|
24
|
+
/** Injectable fetch — defaults to the global. */
|
|
25
|
+
fetchImpl?: typeof fetch;
|
|
26
|
+
/** How long to wait for the container's endpoint + `/health` after start. Default 60s. */
|
|
27
|
+
readyTimeoutMs?: number;
|
|
28
|
+
/** Per-HTTP-call timeout. Default 30s. */
|
|
29
|
+
requestTimeoutMs?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Run the Tester (`test`) job container privileged so its in-container
|
|
32
|
+
* Docker-in-Docker daemon can start and the Tester can `docker compose up` the
|
|
33
|
+
* service's local infra. Only honoured by a runtime that supports DinD (the Apple
|
|
34
|
+
* adapter ignores it — it has no nested-container path; the engine refuses local-infra
|
|
35
|
+
* Tester runs there). Default true; set false to fall back to the harness's
|
|
36
|
+
* best-effort rootless daemon (e.g. under rootless Podman).
|
|
37
|
+
*/
|
|
38
|
+
privilegedTestJobs?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export declare class LocalContainerRunnerTransport implements RunnerTransport {
|
|
41
|
+
private readonly adapter;
|
|
42
|
+
private readonly image;
|
|
43
|
+
private readonly sharedSecret;
|
|
44
|
+
private readonly network?;
|
|
45
|
+
private readonly extraEnv;
|
|
46
|
+
private readonly exec;
|
|
47
|
+
private readonly fetchImpl;
|
|
48
|
+
private readonly readyTimeoutMs;
|
|
49
|
+
private readonly requestTimeoutMs;
|
|
50
|
+
private readonly privilegedTestJobs;
|
|
51
|
+
/** runId → resolved container handle, to spare a CLI lookup on the hot poll path. */
|
|
52
|
+
private readonly cache;
|
|
53
|
+
constructor(options: LocalContainerRunnerTransportOptions);
|
|
54
|
+
/** The runtime's capabilities (e.g. whether local Docker-in-Docker testing is possible). */
|
|
55
|
+
get capabilities(): import("./runtimes/containerRuntime.js").RuntimeCapabilities;
|
|
56
|
+
dispatch(ref: RunnerJobRef, spec: Record<string, unknown>, kind?: RunnerDispatchKind, options?: RunnerDispatchOptions): Promise<void>;
|
|
57
|
+
poll(ref: RunnerJobRef): Promise<RunnerJobView>;
|
|
58
|
+
/**
|
|
59
|
+
* Reclaim the per-RUN container now rather than leaving it idle — this tears down the
|
|
60
|
+
* whole run's container (and with it any step still running in it). Best-effort and
|
|
61
|
+
* idempotent: removing an already-gone container is a no-op.
|
|
62
|
+
*/
|
|
63
|
+
release(ref: RunnerJobRef): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Reap exited per-run containers this transport manages — orphans a crash or hard
|
|
66
|
+
* kill left behind (release() never ran for them). Best-effort; returns the count
|
|
67
|
+
* removed. Call once at boot, before any job is in flight.
|
|
68
|
+
*/
|
|
69
|
+
reapExited(): Promise<number>;
|
|
70
|
+
private url;
|
|
71
|
+
/** The container handle for a run from the cache, else rediscovered via the runtime. */
|
|
72
|
+
private resolve;
|
|
73
|
+
private waitForEndpoint;
|
|
74
|
+
private waitForHealth;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Build a {@link LocalContainerRunnerTransport} from the process environment. The image
|
|
78
|
+
* ref (`LOCAL_HARNESS_IMAGE`) is required; the runtime adapter is selected by
|
|
79
|
+
* `LOCAL_CONTAINER_RUNTIME` (docker | podman | orbstack | colima | apple); everything
|
|
80
|
+
* else has sane local defaults.
|
|
81
|
+
*/
|
|
82
|
+
export declare function createLocalContainerTransportFromEnv(env: NodeJS.ProcessEnv): LocalContainerRunnerTransport;
|
|
83
|
+
//# sourceMappingURL=LocalContainerRunnerTransport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalContainerRunnerTransport.d.ts","sourceRoot":"","sources":["../src/LocalContainerRunnerTransport.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,kBAAkB,EAClB,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,CAAQ;IACzC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAS;IAE5C,qFAAqF;IACrF,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiE;IAEvF,YAAY,OAAO,EAAE,oCAAoC,EAqBxD;IAED,4FAA4F;IAC5F,IAAI,YAAY,iEAEf;IAEK,QAAQ,CACZ,GAAG,EAAE,YAAY,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,IAAI,GAAE,kBAA0B,EAChC,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,IAAI,CAAC,CA6Cf;IAEK,IAAI,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAgCpD;IAED;;;;OAIG;IACG,OAAO,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAM9C;IAED;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAElC;IAID,OAAO,CAAC,GAAG;IAIX,wFAAwF;YAC1E,OAAO;YAcP,eAAe;YAYf,aAAa;CAoB5B;AAUD;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAClD,GAAG,EAAE,MAAM,CAAC,UAAU,GACrB,6BAA6B,CAkB/B"}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { randomBytes } from 'node:crypto';
|
|
3
|
+
import { promisify } from 'node:util';
|
|
4
|
+
import { resolveDockerResources } from '@cat-factory/contracts';
|
|
5
|
+
import { createRuntimeAdapter, DockerRuntimeAdapter, } from './runtimes/index.js';
|
|
6
|
+
const execFileAsync = promisify(execFile);
|
|
7
|
+
// The local-mode runner backend: each RUN gets its OWN local container — the SAME
|
|
8
|
+
// executor-harness image the Cloudflare Worker runs per-run Containers from — which
|
|
9
|
+
// hosts that run's whole sequence of step jobs. It is the local analogue of
|
|
10
|
+
// `CloudflareContainerTransport` (a per-run Cloudflare Container) and of
|
|
11
|
+
// `RunnerPoolTransport` (an org's self-hosted pool): the ContainerAgentExecutor drives
|
|
12
|
+
// all three identically through the `RunnerTransport` port, addressed by a
|
|
13
|
+
// {@link RunnerJobRef} — the run id (which container) plus the per-step job id.
|
|
14
|
+
//
|
|
15
|
+
// HOW it talks to the runtime is delegated to a {@link ContainerRuntimeAdapter}, so this
|
|
16
|
+
// transport supports Docker, Podman, OrbStack, Colima (the Docker-CLI adapter) and
|
|
17
|
+
// Apple's `container` (its own adapter, VM-per-container, connect-by-IP) without forking.
|
|
18
|
+
// This class owns only the runtime-agnostic lifecycle: start a container per RUN, cache
|
|
19
|
+
// its endpoint, re-attach the run's later steps to it, poll the harness over HTTP, and
|
|
20
|
+
// reap it. The harness reaches this service's LLM proxy at the runtime's host alias and
|
|
21
|
+
// clones/pushes to github.com directly with the per-job token in the request body.
|
|
22
|
+
// The failed-poll error the engine classifies as a container eviction (matched by
|
|
23
|
+
// orchestration `isContainerEvictionError`, also used by the bootstrap flow). A
|
|
24
|
+
// vanished/exited local container maps to it so the run stops and the stale-run
|
|
25
|
+
// sweeper can re-drive it — mirroring the Worker transport's 404 mapping.
|
|
26
|
+
const EVICTION_ERROR = 'Job not found (container evicted or crashed)';
|
|
27
|
+
const SECRET_HEADER = 'x-harness-secret';
|
|
28
|
+
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
29
|
+
export class LocalContainerRunnerTransport {
|
|
30
|
+
adapter;
|
|
31
|
+
image;
|
|
32
|
+
sharedSecret;
|
|
33
|
+
network;
|
|
34
|
+
extraEnv;
|
|
35
|
+
exec;
|
|
36
|
+
fetchImpl;
|
|
37
|
+
readyTimeoutMs;
|
|
38
|
+
requestTimeoutMs;
|
|
39
|
+
privilegedTestJobs;
|
|
40
|
+
/** runId → resolved container handle, to spare a CLI lookup on the hot poll path. */
|
|
41
|
+
cache = new Map();
|
|
42
|
+
constructor(options) {
|
|
43
|
+
this.adapter =
|
|
44
|
+
options.adapter ??
|
|
45
|
+
new DockerRuntimeAdapter({
|
|
46
|
+
id: 'docker',
|
|
47
|
+
binary: 'docker',
|
|
48
|
+
hostAlias: 'host.docker.internal',
|
|
49
|
+
addHostGateway: true,
|
|
50
|
+
localDind: true,
|
|
51
|
+
});
|
|
52
|
+
this.image = options.image;
|
|
53
|
+
this.sharedSecret = options.sharedSecret ?? randomBytes(24).toString('hex');
|
|
54
|
+
this.network = options.network;
|
|
55
|
+
this.extraEnv = options.env ?? {};
|
|
56
|
+
this.exec =
|
|
57
|
+
options.exec ??
|
|
58
|
+
((args) => execFileAsync(this.adapter.binary, args, { maxBuffer: 16 * 1024 * 1024 }));
|
|
59
|
+
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
60
|
+
this.readyTimeoutMs = options.readyTimeoutMs ?? 60_000;
|
|
61
|
+
this.requestTimeoutMs = options.requestTimeoutMs ?? 30_000;
|
|
62
|
+
this.privilegedTestJobs = options.privilegedTestJobs ?? true;
|
|
63
|
+
}
|
|
64
|
+
/** The runtime's capabilities (e.g. whether local Docker-in-Docker testing is possible). */
|
|
65
|
+
get capabilities() {
|
|
66
|
+
return this.adapter.capabilities;
|
|
67
|
+
}
|
|
68
|
+
async dispatch(ref, spec, kind = 'run', options) {
|
|
69
|
+
// The container is per-RUN: a run's first step starts it, later steps re-attach to
|
|
70
|
+
// it (resolved by the run id), and the harness keys each step's job by the per-step
|
|
71
|
+
// `ref.jobId` carried in the spec body.
|
|
72
|
+
const runId = ref.runId;
|
|
73
|
+
let resolved = await this.resolve(runId);
|
|
74
|
+
if (!resolved) {
|
|
75
|
+
// A prior attempt may have left an exited/dead container under this run (resolve()
|
|
76
|
+
// returns undefined for one whose endpoint is gone). Remove any such container
|
|
77
|
+
// first so it can't shadow the fresh one in later lookups.
|
|
78
|
+
await this.adapter.removeRun(this.exec, runId);
|
|
79
|
+
const containerId = await this.adapter.run(this.exec, {
|
|
80
|
+
runId,
|
|
81
|
+
image: this.image,
|
|
82
|
+
sharedSecret: this.sharedSecret,
|
|
83
|
+
// The Tester stands its infra up with `docker compose` INSIDE the job container
|
|
84
|
+
// (Docker-in-Docker), so run that one kind privileged. Runtimes without DinD
|
|
85
|
+
// ignore it (and the engine never asks them to run local-infra Tester jobs).
|
|
86
|
+
privileged: kind === 'test' && this.privilegedTestJobs,
|
|
87
|
+
network: this.network,
|
|
88
|
+
env: this.extraEnv,
|
|
89
|
+
instanceSize: options?.instanceSize
|
|
90
|
+
? resolveDockerResources(options.instanceSize)
|
|
91
|
+
: undefined,
|
|
92
|
+
});
|
|
93
|
+
const endpoint = await this.waitForEndpoint(containerId);
|
|
94
|
+
resolved = { containerId, ...endpoint };
|
|
95
|
+
this.cache.set(runId, resolved);
|
|
96
|
+
await this.waitForHealth(endpoint);
|
|
97
|
+
}
|
|
98
|
+
// POST the job to the single harness endpoint, with the kind in the body. Idempotent:
|
|
99
|
+
// re-attaching to an already-running container re-POSTs, which the harness's per-id
|
|
100
|
+
// registry treats as a re-attach.
|
|
101
|
+
const res = await this.fetchImpl(this.url(resolved, '/jobs'), {
|
|
102
|
+
method: 'POST',
|
|
103
|
+
headers: { 'content-type': 'application/json', [SECRET_HEADER]: this.sharedSecret },
|
|
104
|
+
body: JSON.stringify({ ...spec, kind }),
|
|
105
|
+
signal: AbortSignal.timeout(this.requestTimeoutMs),
|
|
106
|
+
});
|
|
107
|
+
if (!res.ok) {
|
|
108
|
+
throw new Error(`Local container dispatch failed (HTTP ${res.status}): ${await safeText(res)}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
async poll(ref) {
|
|
112
|
+
const resolved = await this.resolve(ref.runId);
|
|
113
|
+
// No container for this run at all → it was evicted/reaped (or never started).
|
|
114
|
+
if (!resolved)
|
|
115
|
+
return { state: 'failed', error: EVICTION_ERROR };
|
|
116
|
+
let res;
|
|
117
|
+
try {
|
|
118
|
+
// Address the per-RUN container, but read the per-step job by its own id.
|
|
119
|
+
res = await this.fetchImpl(this.url(resolved, `/jobs/${encodeURIComponent(ref.jobId)}`), {
|
|
120
|
+
method: 'GET',
|
|
121
|
+
headers: { [SECRET_HEADER]: this.sharedSecret },
|
|
122
|
+
signal: AbortSignal.timeout(this.requestTimeoutMs),
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
catch (err) {
|
|
126
|
+
// Connection refused / DNS gone: the container most likely exited. Confirm via
|
|
127
|
+
// the runtime — if it is no longer running, report an eviction so the run stops;
|
|
128
|
+
// otherwise surface the transient error so the caller can retry.
|
|
129
|
+
if (!(await this.adapter.isRunning(this.exec, resolved.containerId))) {
|
|
130
|
+
this.cache.delete(ref.runId);
|
|
131
|
+
return { state: 'failed', error: EVICTION_ERROR };
|
|
132
|
+
}
|
|
133
|
+
throw err;
|
|
134
|
+
}
|
|
135
|
+
// The container is up but the harness no longer knows this job id (it was reaped
|
|
136
|
+
// after completion, or the container was recreated): treat as an eviction.
|
|
137
|
+
if (res.status === 404)
|
|
138
|
+
return { state: 'failed', error: EVICTION_ERROR };
|
|
139
|
+
if (!res.ok) {
|
|
140
|
+
throw new Error(`Local container job poll failed (HTTP ${res.status}): ${await safeText(res)}`);
|
|
141
|
+
}
|
|
142
|
+
return (await res.json());
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Reclaim the per-RUN container now rather than leaving it idle — this tears down the
|
|
146
|
+
* whole run's container (and with it any step still running in it). Best-effort and
|
|
147
|
+
* idempotent: removing an already-gone container is a no-op.
|
|
148
|
+
*/
|
|
149
|
+
async release(ref) {
|
|
150
|
+
const containerId = this.cache.get(ref.runId)?.containerId ?? (await this.adapter.find(this.exec, ref.runId));
|
|
151
|
+
this.cache.delete(ref.runId);
|
|
152
|
+
if (!containerId)
|
|
153
|
+
return;
|
|
154
|
+
await this.adapter.remove(this.exec, containerId);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Reap exited per-run containers this transport manages — orphans a crash or hard
|
|
158
|
+
* kill left behind (release() never ran for them). Best-effort; returns the count
|
|
159
|
+
* removed. Call once at boot, before any job is in flight.
|
|
160
|
+
*/
|
|
161
|
+
async reapExited() {
|
|
162
|
+
return this.adapter.reapExited(this.exec);
|
|
163
|
+
}
|
|
164
|
+
// --- internals ----------------------------------------------------------
|
|
165
|
+
url(endpoint, path) {
|
|
166
|
+
return `http://${endpoint.host}:${endpoint.port}${path}`;
|
|
167
|
+
}
|
|
168
|
+
/** The container handle for a run from the cache, else rediscovered via the runtime. */
|
|
169
|
+
async resolve(runId) {
|
|
170
|
+
const cached = this.cache.get(runId);
|
|
171
|
+
if (cached)
|
|
172
|
+
return cached;
|
|
173
|
+
const containerId = await this.adapter.find(this.exec, runId);
|
|
174
|
+
if (!containerId)
|
|
175
|
+
return undefined;
|
|
176
|
+
const endpoint = await this.adapter.endpoint(this.exec, containerId);
|
|
177
|
+
if (!endpoint)
|
|
178
|
+
return undefined;
|
|
179
|
+
const resolved = { containerId, ...endpoint };
|
|
180
|
+
this.cache.set(runId, resolved);
|
|
181
|
+
return resolved;
|
|
182
|
+
}
|
|
183
|
+
async waitForEndpoint(containerId) {
|
|
184
|
+
const deadline = Date.now() + this.readyTimeoutMs;
|
|
185
|
+
for (;;) {
|
|
186
|
+
const endpoint = await this.adapter.endpoint(this.exec, containerId).catch(() => undefined);
|
|
187
|
+
if (endpoint)
|
|
188
|
+
return endpoint;
|
|
189
|
+
if (Date.now() >= deadline) {
|
|
190
|
+
throw new Error(`Timed out waiting for container ${containerId} to expose its endpoint`);
|
|
191
|
+
}
|
|
192
|
+
await delay(250);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
async waitForHealth(endpoint) {
|
|
196
|
+
const deadline = Date.now() + this.readyTimeoutMs;
|
|
197
|
+
for (;;) {
|
|
198
|
+
try {
|
|
199
|
+
const res = await this.fetchImpl(this.url(endpoint, '/health'), {
|
|
200
|
+
method: 'GET',
|
|
201
|
+
signal: AbortSignal.timeout(Math.min(this.requestTimeoutMs, 5_000)),
|
|
202
|
+
});
|
|
203
|
+
if (res.ok)
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
catch {
|
|
207
|
+
// not up yet
|
|
208
|
+
}
|
|
209
|
+
if (Date.now() >= deadline) {
|
|
210
|
+
throw new Error(`Timed out waiting for the harness at ${endpoint.host}:${endpoint.port} to become healthy`);
|
|
211
|
+
}
|
|
212
|
+
await delay(300);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
async function safeText(res) {
|
|
217
|
+
try {
|
|
218
|
+
return (await res.text()).slice(0, 500);
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
return '(no body)';
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Build a {@link LocalContainerRunnerTransport} from the process environment. The image
|
|
226
|
+
* ref (`LOCAL_HARNESS_IMAGE`) is required; the runtime adapter is selected by
|
|
227
|
+
* `LOCAL_CONTAINER_RUNTIME` (docker | podman | orbstack | colima | apple); everything
|
|
228
|
+
* else has sane local defaults.
|
|
229
|
+
*/
|
|
230
|
+
export function createLocalContainerTransportFromEnv(env) {
|
|
231
|
+
const image = env.LOCAL_HARNESS_IMAGE?.trim();
|
|
232
|
+
if (!image) {
|
|
233
|
+
throw new Error('LOCAL_HARNESS_IMAGE is required for local mode: set it to the executor-harness image ref ' +
|
|
234
|
+
'(a GHCR pull or a tag built from backend/internal/executor-harness/Dockerfile).');
|
|
235
|
+
}
|
|
236
|
+
return new LocalContainerRunnerTransport({
|
|
237
|
+
image,
|
|
238
|
+
adapter: createRuntimeAdapter(env),
|
|
239
|
+
sharedSecret: env.HARNESS_SHARED_SECRET?.trim() || undefined,
|
|
240
|
+
network: env.LOCAL_DOCKER_NETWORK?.trim() || undefined,
|
|
241
|
+
// Default on: the Tester stands its docker-compose infra up via Docker-in-Docker,
|
|
242
|
+
// which needs a privileged job container. Set to `false` for runtimes that run
|
|
243
|
+
// nested containers without it (e.g. rootless Podman).
|
|
244
|
+
privilegedTestJobs: env.LOCAL_DOCKER_PRIVILEGED_TEST_JOBS?.trim() !== 'false',
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=LocalContainerRunnerTransport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalContainerRunnerTransport.js","sourceRoot":"","sources":["../src/LocalContainerRunnerTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAQrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,EAIL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,qBAAqB,CAAA;AAE5B,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAA;AAEzC,kFAAkF;AAClF,oFAAoF;AACpF,4EAA4E;AAC5E,yEAAyE;AACzE,uFAAuF;AACvF,2EAA2E;AAC3E,gFAAgF;AAChF,EAAE;AACF,yFAAyF;AACzF,mFAAmF;AACnF,0FAA0F;AAC1F,wFAAwF;AACxF,uFAAuF;AACvF,wFAAwF;AACxF,mFAAmF;AAEnF,kFAAkF;AAClF,gFAAgF;AAChF,gFAAgF;AAChF,0EAA0E;AAC1E,MAAM,cAAc,GAAG,8CAA8C,CAAA;AAErE,MAAM,aAAa,GAAG,kBAAkB,CAAA;AAyCxC,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;AAErF,MAAM,OAAO,6BAA6B;IACvB,OAAO,CAAyB;IAChC,KAAK,CAAQ;IACb,YAAY,CAAQ;IACpB,OAAO,CAAS;IAChB,QAAQ,CAAwB;IAChC,IAAI,CAAe;IACnB,SAAS,CAAc;IACvB,cAAc,CA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CAAC,CAAA;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,WAAW,CAAA;IACpB,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oCAAoC,CAClD,GAAsB;IAEtB,MAAM,KAAK,GAAG,GAAG,CAAC,mBAAmB,EAAE,IAAI,EAAE,CAAA;IAC7C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,2FAA2F;YACzF,iFAAiF,CACpF,CAAA;IACH,CAAC;IACD,OAAO,IAAI,6BAA6B,CAAC;QACvC,KAAK;QACL,OAAO,EAAE,oBAAoB,CAAC,GAAG,CAAC;QAClC,YAAY,EAAE,GAAG,CAAC,qBAAqB,EAAE,IAAI,EAAE,IAAI,SAAS;QAC5D,OAAO,EAAE,GAAG,CAAC,oBAAoB,EAAE,IAAI,EAAE,IAAI,SAAS;QACtD,kFAAkF;QAClF,+EAA+E;QAC/E,uDAAuD;QACvD,kBAAkB,EAAE,GAAG,CAAC,iCAAiC,EAAE,IAAI,EAAE,KAAK,OAAO;KAC9E,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAgBpD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAuB5E;AAED,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,SAAS,CAEjE"}
|
package/dist/config.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { randomBytes } from 'node:crypto';
|
|
2
2
|
import { loadNodeConfig } from '@cat-factory/node-server';
|
|
3
|
+
import { resolveHostAlias } from './runtimes/index.js';
|
|
3
4
|
// Local mode is a single developer running the whole product on their own machine.
|
|
4
5
|
// It reuses the Node facade's config loader verbatim and only changes the defaults
|
|
5
6
|
// that would otherwise force cloud-style setup:
|
|
@@ -17,6 +18,10 @@ const DEFAULT_PORT = '8787';
|
|
|
17
18
|
*/
|
|
18
19
|
export function applyLocalDefaults(env) {
|
|
19
20
|
const port = env.PORT?.trim() || DEFAULT_PORT;
|
|
21
|
+
// The host alias the harness uses to reach this service depends on the runtime:
|
|
22
|
+
// `host.docker.internal` (Docker/Podman/OrbStack), `host.lima.internal` (Colima), or
|
|
23
|
+
// the vmnet gateway (Apple). An explicit LOCAL_HARNESS_HOST_ALIAS / PUBLIC_URL wins.
|
|
24
|
+
const hostAlias = resolveHostAlias(env);
|
|
20
25
|
return {
|
|
21
26
|
...env,
|
|
22
27
|
// `|| 'true'` (not `??`) so an explicit empty `AUTH_DEV_OPEN=` still defaults open,
|
|
@@ -29,10 +34,10 @@ export function applyLocalDefaults(env) {
|
|
|
29
34
|
// per-process key when absent — enough to boot and run a pipeline. Set ENCRYPTION_KEY
|
|
30
35
|
// explicitly to keep encrypted-at-rest credentials decryptable across restarts.
|
|
31
36
|
ENCRYPTION_KEY: env.ENCRYPTION_KEY?.trim() || randomBytes(32).toString('base64'),
|
|
32
|
-
// The harness (inside
|
|
33
|
-
// routes back to this service on the host. The transport
|
|
34
|
-
//
|
|
35
|
-
PUBLIC_URL: env.PUBLIC_URL?.trim() || `http
|
|
37
|
+
// The harness (inside the container) posts to `${PUBLIC_URL}/v1`; the runtime's host
|
|
38
|
+
// alias routes back to this service on the host. The docker-family transport
|
|
39
|
+
// publishes that alias on Linux via `--add-host=<alias>:host-gateway`.
|
|
40
|
+
PUBLIC_URL: env.PUBLIC_URL?.trim() || `http://${hostAlias}:${port}`,
|
|
36
41
|
};
|
|
37
42
|
}
|
|
38
43
|
/** The shared {@link AppConfig} with local-mode defaults applied. */
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAEzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD,mFAAmF;AACnF,mFAAmF;AACnF,gDAAgD;AAChD,iFAAiF;AACjF,+DAA+D;AAC/D,uFAAuF;AACvF,6EAA6E;AAC7E,oFAAoF;AACpF,yDAAyD;AACzD,wEAAwE;AAExE,MAAM,YAAY,GAAG,MAAM,CAAA;AAE3B;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAsB;IACvD,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,YAAY,CAAA;IAC7C,gFAAgF;IAChF,qFAAqF;IACrF,qFAAqF;IACrF,MAAM,SAAS,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAA;IACvC,OAAO;QACL,GAAG,GAAG;QACN,oFAAoF;QACpF,sFAAsF;QACtF,aAAa,EAAE,GAAG,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,MAAM;QAClD,+EAA+E;QAC/E,mBAAmB,EAAE,GAAG,CAAC,mBAAmB,EAAE,IAAI,EAAE,IAAI,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;QACvF,mFAAmF;QACnF,qFAAqF;QACrF,sFAAsF;QACtF,gFAAgF;QAChF,cAAc,EAAE,GAAG,CAAC,cAAc,EAAE,IAAI,EAAE,IAAI,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAChF,qFAAqF;QACrF,6EAA6E;QAC7E,uEAAuE;QACvE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,UAAU,SAAS,IAAI,IAAI,EAAE;KACpE,CAAA;AACH,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,eAAe,CAAC,GAAsB;IACpD,OAAO,cAAc,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAA;AAChD,CAAC"}
|
package/dist/container.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AACpE,OAAO,KAAK,EAAqC,eAAe,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AACpE,OAAO,KAAK,EAAqC,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAyB7F,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,eAAe,CAiFlF"}
|
package/dist/container.js
CHANGED
|
@@ -2,13 +2,14 @@ import { DrizzleGitHubInstallationRepository, buildNodeContainer, loadNodeConfig
|
|
|
2
2
|
import { applyLocalDefaults } from './config.js';
|
|
3
3
|
import { createLocalGitHubClient, fetchPatAccount, githubPatCreationUrl } from './github.js';
|
|
4
4
|
import { AutoProvisioningInstallationRepository } from './installations.js';
|
|
5
|
-
import {
|
|
5
|
+
import { createLocalContainerTransportFromEnv, } from './LocalContainerRunnerTransport.js';
|
|
6
|
+
import { createRuntimeAdapter } from './runtimes/index.js';
|
|
6
7
|
// The local-mode composition root. It is intentionally thin: the ENTIRE Drizzle/
|
|
7
8
|
// Postgres persistence, pg-boss durable execution, gateways and model provisioning
|
|
8
9
|
// come from `buildNodeContainer` unchanged. Local mode only swaps the two
|
|
9
10
|
// differentiators behind the seams `buildNodeContainer` exposes:
|
|
10
|
-
// - the runner backend → a per-
|
|
11
|
-
// instead of a self-hosted
|
|
11
|
+
// - the runner backend → a per-run local container (LocalContainerRunnerTransport,
|
|
12
|
+
// Docker/Podman/OrbStack/Colima/Apple `container`) instead of a self-hosted pool;
|
|
12
13
|
// - the push/clone token → a static GitHub PAT (`GITHUB_PAT`) instead of a GitHub
|
|
13
14
|
// App installation token.
|
|
14
15
|
// Repo resolution is unchanged: the executor still resolves a block's repo from the
|
|
@@ -50,9 +51,16 @@ export function buildLocalContainer(options) {
|
|
|
50
51
|
// mirroring how the Node facade treats a missing runner backend.
|
|
51
52
|
let transport;
|
|
52
53
|
const resolveTransport = () => {
|
|
53
|
-
transport ??=
|
|
54
|
+
transport ??= createLocalContainerTransportFromEnv(env);
|
|
54
55
|
return Promise.resolve(transport);
|
|
55
56
|
};
|
|
57
|
+
// The selected runtime decides whether the Tester's LOCAL docker-compose infra (run
|
|
58
|
+
// via Docker-in-Docker) is possible: Docker/Podman/OrbStack/Colima can nest a daemon,
|
|
59
|
+
// Apple `container` (one VM per container) cannot. Surface that capability to the
|
|
60
|
+
// engine so it refuses a local-infra Tester run on an incapable runtime ("limited
|
|
61
|
+
// mode") instead of dispatching a job that can't stand its dependencies up. Building
|
|
62
|
+
// the adapter is pure (no IO), so this is cheap even though the transport stays lazy.
|
|
63
|
+
const localTestInfraSupported = createRuntimeAdapter(env).capabilities.localDind;
|
|
56
64
|
return buildNodeContainer({
|
|
57
65
|
...options,
|
|
58
66
|
env,
|
|
@@ -78,6 +86,8 @@ export function buildLocalContainer(options) {
|
|
|
78
86
|
// connection isn't missing workflows: write — report it granted to suppress the
|
|
79
87
|
// advisory banner. (The App-permissions probe this normally uses needs an app JWT.)
|
|
80
88
|
...(pat ? { workflowsGranted: async () => true } : {}),
|
|
89
|
+
// Gate the Tester's local-infra mode on the runtime's Docker-in-Docker support.
|
|
90
|
+
localTestInfraSupported,
|
|
81
91
|
},
|
|
82
92
|
});
|
|
83
93
|
}
|
package/dist/container.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.js","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EACnC,kBAAkB,EAClB,cAAc,GACf,MAAM,0BAA0B,CAAA;AAIjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAC5F,OAAO,EAAE,sCAAsC,EAAmB,MAAM,oBAAoB,CAAA;AAC5F,OAAO,EAEL,
|
|
1
|
+
{"version":3,"file":"container.js","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EACnC,kBAAkB,EAClB,cAAc,GACf,MAAM,0BAA0B,CAAA;AAIjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAC5F,OAAO,EAAE,sCAAsC,EAAmB,MAAM,oBAAoB,CAAA;AAC5F,OAAO,EAEL,oCAAoC,GACrC,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAE1D,iFAAiF;AACjF,mFAAmF;AACnF,0EAA0E;AAC1E,iEAAiE;AACjE,qFAAqF;AACrF,sFAAsF;AACtF,oFAAoF;AACpF,8BAA8B;AAC9B,oFAAoF;AACpF,mFAAmF;AACnF,8EAA8E;AAC9E,sFAAsF;AACtF,sCAAsC;AAEtC,M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Local } from './server.js';
|
|
2
2
|
export { buildLocalContainer } from './container.js';
|
|
3
3
|
export { loadLocalConfig, applyLocalDefaults } from './config.js';
|
|
4
|
-
export {
|
|
4
|
+
export { LocalContainerRunnerTransport, createLocalContainerTransportFromEnv, type LocalContainerRunnerTransportOptions, } from './LocalContainerRunnerTransport.js';
|
|
5
|
+
export { type ContainerRuntimeAdapter, type ContainerExec, type RuntimeId, createRuntimeAdapter, resolveRuntimeId, runtimeProfile, resolveHostAlias, DockerRuntimeAdapter, AppleContainerRuntimeAdapter, } from './runtimes/index.js';
|
|
5
6
|
export { linkRepo, type LinkRepoOptions, type LinkedRepo } from './linkRepo.js';
|
|
6
7
|
export { createLocalGitHubClient, StaticTokenAppRegistry } from './github.js';
|
|
7
8
|
export { registerAgentKind, registerAgentKinds, clearRegisteredAgentKinds, type AgentKindDefinition, } from '@cat-factory/agents';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,EACL,6BAA6B,EAC7B,oCAAoC,EACpC,KAAK,oCAAoC,GAC1C,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,qBAAqB,CAAA;AAI5B,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/E,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAI7E,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,yBAAyB,EACzB,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
// @cat-factory/local-server — the local-mode runtime facade. It is the Node.js
|
|
2
2
|
// facade (@cat-factory/node-server: shared Hono app + Drizzle/Postgres + pg-boss)
|
|
3
3
|
// with two differentiators so a developer can run the whole product on their own
|
|
4
|
-
// machine: agent jobs run as per-
|
|
4
|
+
// machine: agent jobs run as per-run local containers (Docker/Podman/OrbStack/Colima/
|
|
5
|
+
// Apple `container`, selected by LOCAL_CONTAINER_RUNTIME), and GitHub is
|
|
5
6
|
// reached via a personal access token (no GitHub App). `startLocal()` boots the
|
|
6
7
|
// service; `buildLocalContainer()` is the composition root.
|
|
7
8
|
export { startLocal } from './server.js';
|
|
8
9
|
export { buildLocalContainer } from './container.js';
|
|
9
10
|
export { loadLocalConfig, applyLocalDefaults } from './config.js';
|
|
10
|
-
export {
|
|
11
|
+
export { LocalContainerRunnerTransport, createLocalContainerTransportFromEnv, } from './LocalContainerRunnerTransport.js';
|
|
12
|
+
export { createRuntimeAdapter, resolveRuntimeId, runtimeProfile, resolveHostAlias, DockerRuntimeAdapter, AppleContainerRuntimeAdapter, } from './runtimes/index.js';
|
|
11
13
|
// Seed the github_installations/github_repos projection so container agent steps can
|
|
12
14
|
// resolve a target repo in local mode (no GitHub App connect flow). Also a CLI:
|
|
13
15
|
// `node dist/link-repo.js <workspaceId> <frameBlockId> <owner/repo>`.
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,kFAAkF;AAClF,iFAAiF;AACjF,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,kFAAkF;AAClF,iFAAiF;AACjF,sFAAsF;AACtF,yEAAyE;AACzE,gFAAgF;AAChF,4DAA4D;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,EACL,6BAA6B,EAC7B,oCAAoC,GAErC,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EAIL,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,qBAAqB,CAAA;AAC5B,qFAAqF;AACrF,gFAAgF;AAChF,sEAAsE;AACtE,OAAO,EAAE,QAAQ,EAAyC,MAAM,eAAe,CAAA;AAC/E,6EAA6E;AAC7E,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAE7E,sFAAsF;AACtF,wFAAwF;AACxF,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,yBAAyB,GAE1B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ContainerEndpoint, type ContainerExec, type ContainerRuntimeAdapter, type RunContainerSpec } from './containerRuntime.js';
|
|
2
|
+
export declare class AppleContainerRuntimeAdapter implements ContainerRuntimeAdapter {
|
|
3
|
+
readonly id: 'apple';
|
|
4
|
+
readonly binary: string;
|
|
5
|
+
readonly hostAlias: string;
|
|
6
|
+
readonly capabilities: {
|
|
7
|
+
localDind: boolean;
|
|
8
|
+
};
|
|
9
|
+
constructor(options: {
|
|
10
|
+
binary?: string;
|
|
11
|
+
hostAlias: string;
|
|
12
|
+
});
|
|
13
|
+
run(exec: ContainerExec, spec: RunContainerSpec): Promise<string>;
|
|
14
|
+
find(exec: ContainerExec, runId: string): Promise<string | undefined>;
|
|
15
|
+
endpoint(exec: ContainerExec, containerId: string): Promise<ContainerEndpoint | undefined>;
|
|
16
|
+
isRunning(exec: ContainerExec, containerId: string): Promise<boolean>;
|
|
17
|
+
remove(exec: ContainerExec, containerId: string): Promise<void>;
|
|
18
|
+
removeRun(exec: ContainerExec, runId: string): Promise<void>;
|
|
19
|
+
reapExited(exec: ContainerExec): Promise<number>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=appleContainerRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appleContainerRuntime.d.ts","sourceRoot":"","sources":["../../src/runtimes/appleContainerRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAE5B,KAAK,gBAAgB,EACtB,MAAM,uBAAuB,CAAA;AA0H9B,qBAAa,4BAA6B,YAAW,uBAAuB;IAC1E,QAAQ,CAAC,EAAE,EAAG,OAAO,CAAS;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,YAAY;QAAK,SAAS;MAAS;IAE5C,YAAY,OAAO,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,EAG1D;IAEK,GAAG,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAqBtE;IAEK,IAAI,CAAC,IAAI,EAAE,aAAa,EAAE,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