@cat-factory/local-server 0.7.2 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +9 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +47 -0
- package/dist/config.js.map +1 -0
- package/dist/container.d.ts +4 -0
- package/dist/container.d.ts.map +1 -0
- package/dist/container.js +94 -0
- package/dist/container.js.map +1 -0
- package/dist/github.d.ts +36 -0
- package/dist/github.d.ts.map +1 -0
- package/dist/github.js +174 -0
- package/dist/github.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/installations.d.ts +31 -0
- package/dist/installations.d.ts.map +1 -0
- package/dist/installations.js +76 -0
- package/dist/installations.js.map +1 -0
- package/dist/link-repo.d.ts +2 -0
- package/dist/link-repo.d.ts.map +1 -0
- package/dist/link-repo.js +21 -0
- package/dist/link-repo.js.map +1 -0
- package/dist/linkRepo.d.ts +31 -0
- package/dist/linkRepo.d.ts.map +1 -0
- package/dist/linkRepo.js +113 -0
- package/dist/linkRepo.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +10 -0
- package/dist/main.js.map +1 -0
- 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 +8 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +100 -0
- package/dist/server.js.map +1 -0
- package/package.json +7 -7
|
@@ -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,qBAAqB,EACrB,YAAY,EACZ,aAAa,EACb,eAAe,EAChB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAG7B,MAAM,qBAAqB,CAAA;AA4B5B,mFAAmF;AACnF,YAAY,EAAE,aAAa,EA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Ef;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/Local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,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
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AppConfig } from '@cat-factory/server';
|
|
2
|
+
/**
|
|
3
|
+
* Apply local-mode env defaults onto a copy of {@link env}. Idempotent: an explicitly
|
|
4
|
+
* set value is always preserved, so calling it twice (loader + container) is safe.
|
|
5
|
+
*/
|
|
6
|
+
export declare function applyLocalDefaults(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
7
|
+
/** The shared {@link AppConfig} with local-mode defaults applied. */
|
|
8
|
+
export declare function loadLocalConfig(env: NodeJS.ProcessEnv): AppConfig;
|
|
9
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
2
|
+
import { loadNodeConfig } from '@cat-factory/node-server';
|
|
3
|
+
import { resolveHostAlias } from './runtimes/index.js';
|
|
4
|
+
// Local mode is a single developer running the whole product on their own machine.
|
|
5
|
+
// It reuses the Node facade's config loader verbatim and only changes the defaults
|
|
6
|
+
// that would otherwise force cloud-style setup:
|
|
7
|
+
// - the auth gate defaults OPEN (no GitHub OAuth app to register) — never in a
|
|
8
|
+
// production ENVIRONMENT (`loadNodeConfig` enforces that);
|
|
9
|
+
// - a session secret is generated if absent (it only signs the short-lived LLM-proxy
|
|
10
|
+
// tokens the local container uses; a per-process value is fine for dev);
|
|
11
|
+
// - PUBLIC_URL defaults to `host.docker.internal:<PORT>` so a job's container can
|
|
12
|
+
// reach this service's LLM proxy from inside Docker.
|
|
13
|
+
// Every default is overridable: setting the corresponding env var wins.
|
|
14
|
+
const DEFAULT_PORT = '8787';
|
|
15
|
+
/**
|
|
16
|
+
* Apply local-mode env defaults onto a copy of {@link env}. Idempotent: an explicitly
|
|
17
|
+
* set value is always preserved, so calling it twice (loader + container) is safe.
|
|
18
|
+
*/
|
|
19
|
+
export function applyLocalDefaults(env) {
|
|
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);
|
|
25
|
+
return {
|
|
26
|
+
...env,
|
|
27
|
+
// `|| 'true'` (not `??`) so an explicit empty `AUTH_DEV_OPEN=` still defaults open,
|
|
28
|
+
// consistent with the other fields here; set `AUTH_DEV_OPEN=false` to close the gate.
|
|
29
|
+
AUTH_DEV_OPEN: env.AUTH_DEV_OPEN?.trim() || 'true',
|
|
30
|
+
// Stable within a process; only signs short-lived proxy tokens for local jobs.
|
|
31
|
+
AUTH_SESSION_SECRET: env.AUTH_SESSION_SECRET?.trim() || randomBytes(32).toString('hex'),
|
|
32
|
+
// The shared key backing credential encryption at rest (document/task/runner/slack
|
|
33
|
+
// integrations, personal subscriptions). `loadNodeConfig` requires it, so generate a
|
|
34
|
+
// per-process key when absent — enough to boot and run a pipeline. Set ENCRYPTION_KEY
|
|
35
|
+
// explicitly to keep encrypted-at-rest credentials decryptable across restarts.
|
|
36
|
+
ENCRYPTION_KEY: env.ENCRYPTION_KEY?.trim() || randomBytes(32).toString('base64'),
|
|
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}`,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** The shared {@link AppConfig} with local-mode defaults applied. */
|
|
44
|
+
export function loadLocalConfig(env) {
|
|
45
|
+
return loadNodeConfig(applyLocalDefaults(env));
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +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;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;A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BAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,eAAe,CAiFlF"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { DrizzleGitHubInstallationRepository, buildNodeContainer, loadNodeConfig, } from '@cat-factory/node-server';
|
|
2
|
+
import { applyLocalDefaults } from './config.js';
|
|
3
|
+
import { createLocalGitHubClient, fetchPatAccount, githubPatCreationUrl } from './github.js';
|
|
4
|
+
import { AutoProvisioningInstallationRepository } from './installations.js';
|
|
5
|
+
import { createLocalContainerTransportFromEnv, } from './LocalContainerRunnerTransport.js';
|
|
6
|
+
import { createRuntimeAdapter } from './runtimes/index.js';
|
|
7
|
+
// The local-mode composition root. It is intentionally thin: the ENTIRE Drizzle/
|
|
8
|
+
// Postgres persistence, pg-boss durable execution, gateways and model provisioning
|
|
9
|
+
// come from `buildNodeContainer` unchanged. Local mode only swaps the two
|
|
10
|
+
// differentiators behind the seams `buildNodeContainer` exposes:
|
|
11
|
+
// - the runner backend → a per-run local container (LocalContainerRunnerTransport,
|
|
12
|
+
// Docker/Podman/OrbStack/Colima/Apple `container`) instead of a self-hosted pool;
|
|
13
|
+
// - the push/clone token → a static GitHub PAT (`GITHUB_PAT`) instead of a GitHub
|
|
14
|
+
// App installation token.
|
|
15
|
+
// Repo resolution is unchanged: the executor still resolves a block's repo from the
|
|
16
|
+
// `github_repos` / `github_installations` projection (seed those rows for a target
|
|
17
|
+
// repo with the link helper). So a developer can run coder/mocker/playwright/
|
|
18
|
+
// blueprints/ci-fixer/merger jobs entirely locally, pushing real branches and opening
|
|
19
|
+
// real PRs on github.com via the PAT.
|
|
20
|
+
export function buildLocalContainer(options) {
|
|
21
|
+
const env = applyLocalDefaults(options.env ?? process.env);
|
|
22
|
+
const pat = env.GITHUB_PAT?.trim();
|
|
23
|
+
const base = options.config ?? loadNodeConfig(env);
|
|
24
|
+
// Tag the config as local mode and, when no PAT is set, carry the (scopes-preselected)
|
|
25
|
+
// creation URL so the SPA can surface it as a dismissible banner — the server-side warn
|
|
26
|
+
// log alone is easy to miss in a dev terminal. With a PAT, force the GitHub integration
|
|
27
|
+
// ON: the Node loader only enables it for a configured GitHub App, but local mode reaches
|
|
28
|
+
// GitHub through the PAT-backed client, so the read/link endpoints (connection, available
|
|
29
|
+
// repos, "add from existing repo") should be served the same way.
|
|
30
|
+
const config = {
|
|
31
|
+
...base,
|
|
32
|
+
...(pat ? { github: { ...base.github, enabled: true } } : {}),
|
|
33
|
+
localMode: {
|
|
34
|
+
enabled: true,
|
|
35
|
+
...(pat ? {} : { githubPatSetupUrl: githubPatCreationUrl() }),
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
// Local mode has no GitHub-App connect flow, so a workspace's installation is conjured
|
|
39
|
+
// from the PAT on first read (see AutoProvisioningInstallationRepository): the synthetic
|
|
40
|
+
// row makes `getConnection` report connected and gives the sync service an installation
|
|
41
|
+
// id to list/link repos under. The PAT account is fetched once and shared across
|
|
42
|
+
// workspaces (a single developer's token).
|
|
43
|
+
let accountPromise;
|
|
44
|
+
const resolveAccount = () => (accountPromise ??= fetchPatAccount(env));
|
|
45
|
+
const githubInstallationRepository = pat && options.db
|
|
46
|
+
? new AutoProvisioningInstallationRepository(new DrizzleGitHubInstallationRepository(options.db), resolveAccount)
|
|
47
|
+
: undefined;
|
|
48
|
+
// The Docker transport is constructed LAZILY on first container-job dispatch, so the
|
|
49
|
+
// service still boots to serve the board (and inline kinds) when LOCAL_HARNESS_IMAGE
|
|
50
|
+
// is unset — only repo-operating kinds then fail, loudly and with a clear message,
|
|
51
|
+
// mirroring how the Node facade treats a missing runner backend.
|
|
52
|
+
let transport;
|
|
53
|
+
const resolveTransport = () => {
|
|
54
|
+
transport ??= createLocalContainerTransportFromEnv(env);
|
|
55
|
+
return Promise.resolve(transport);
|
|
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;
|
|
64
|
+
return buildNodeContainer({
|
|
65
|
+
...options,
|
|
66
|
+
env,
|
|
67
|
+
config,
|
|
68
|
+
// Always dispatch container jobs to the local Docker transport (a constant
|
|
69
|
+
// resolver, ignoring workspace — local mode has no per-workspace runner pools).
|
|
70
|
+
resolveTransport,
|
|
71
|
+
// Authenticate git with the developer's PAT when present. Absent → the executor
|
|
72
|
+
// falls back to the GitHub App path (and is null without it), so container kinds
|
|
73
|
+
// fail loudly rather than silently mis-running.
|
|
74
|
+
...(pat ? { mintInstallationToken: async () => pat } : {}),
|
|
75
|
+
// The PAT-backed GitHub client wires the CI gate + merge / mergeability providers,
|
|
76
|
+
// so a local pipeline gates on real GitHub Actions CI and merges the PR for real, AND
|
|
77
|
+
// serves the read/link endpoints (it lists repos via /user/repos, the PAT analogue of
|
|
78
|
+
// the App-only /installation/repositories).
|
|
79
|
+
...(pat ? { githubClient: createLocalGitHubClient(env) } : {}),
|
|
80
|
+
// Auto-provision the synthetic per-workspace installation so the integration reports
|
|
81
|
+
// connected with no manual connect step.
|
|
82
|
+
...(githubInstallationRepository ? { githubInstallationRepository } : {}),
|
|
83
|
+
overrides: {
|
|
84
|
+
...options.overrides,
|
|
85
|
+
// The local PAT carries `workflow` scope (the creation URL pre-selects it), so the
|
|
86
|
+
// connection isn't missing workflows: write — report it granted to suppress the
|
|
87
|
+
// advisory banner. (The App-permissions probe this normally uses needs an app JWT.)
|
|
88
|
+
...(pat ? { workflowsGranted: async () => true } : {}),
|
|
89
|
+
// Gate the Tester's local-infra mode on the runtime's Docker-in-Docker support.
|
|
90
|
+
localTestInfraSupported,
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=container.js.map
|
|
@@ -0,0 +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,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,MAAM,UAAU,mBAAmB,CAAC,OAA6B;IAC/D,MAAM,GAAG,GAAG,kBAAkB,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,CAAA;IAC1D,MAAM,GAAG,GAAG,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,CAAA;IAClC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,IAAI,cAAc,CAAC,GAAG,CAAC,CAAA;IAClD,uFAAuF;IACvF,wFAAwF;IACxF,wFAAwF;IACxF,0FAA0F;IAC1F,0FAA0F;IAC1F,kEAAkE;IAClE,MAAM,MAAM,GAAc;QACxB,GAAG,IAAI;QACP,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE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qB,EAAE,KAAK,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1D,mFAAmF;QACnF,sFAAsF;QACtF,sFAAsF;QACtF,4CAA4C;QAC5C,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,uBAAuB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,qFAAqF;QACrF,yCAAyC;QACzC,GAAG,CAAC,4BAA4B,CAAC,CAAC,CAAC,EAAE,4BAA4B,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzE,SAAS,EAAE;YACT,GAAG,OAAO,CAAC,SAAS;YACpB,mFAAmF;YACnF,gFAAgF;YAChF,oFAAoF;YACpF,GAAG,CAAC,GAAG,CAAC,CAAC,CAAE,EAAE,gBAAgB,EAAE,KAAK,IAAI,EAAE,CAAC,IAAI,EAAuC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5F,gFAAgF;YAChF,uBAAuB;SACY;KACtC,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/github.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { GitHubClient } from '@cat-factory/kernel';
|
|
2
|
+
import { type AppTokenSource } from '@cat-factory/server';
|
|
3
|
+
import type { PatAccount } from './installations.js';
|
|
4
|
+
/**
|
|
5
|
+
* A GitHub "new personal access token (classic)" URL with the scopes local mode needs
|
|
6
|
+
* pre-selected, so a developer without a PAT can click straight through to create one.
|
|
7
|
+
* Classic tokens are used (not fine-grained) because only the classic form accepts the
|
|
8
|
+
* `scopes` query param for pre-selection.
|
|
9
|
+
*/
|
|
10
|
+
export declare function githubPatCreationUrl(): string;
|
|
11
|
+
/** An {@link AppTokenSource} that returns a fixed PAT for every installation call. */
|
|
12
|
+
export declare class StaticTokenAppRegistry implements AppTokenSource {
|
|
13
|
+
private readonly token;
|
|
14
|
+
readonly defaultAppId = "";
|
|
15
|
+
constructor(token: string);
|
|
16
|
+
apps(): readonly {
|
|
17
|
+
appId: string;
|
|
18
|
+
}[];
|
|
19
|
+
authForApp(): {
|
|
20
|
+
appJwt(): Promise<string>;
|
|
21
|
+
};
|
|
22
|
+
installationToken(): Promise<string>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Read the PAT's own account (`GET /user`) so a synthetic installation can be attributed
|
|
26
|
+
* to it in the connect UI. Best-effort: a failed/forbidden call falls back to an empty
|
|
27
|
+
* login (the link flow only needs the installation row to exist, not its account label).
|
|
28
|
+
*/
|
|
29
|
+
export declare function fetchPatAccount(env: NodeJS.ProcessEnv): Promise<PatAccount>;
|
|
30
|
+
/**
|
|
31
|
+
* Build a {@link GitHubClient} that authenticates with the PAT, for the CI / merge /
|
|
32
|
+
* mergeability gates AND the repo-link / board "add from repo" flows. Returns undefined
|
|
33
|
+
* when no PAT is configured (the gates then pass through, like the Node default).
|
|
34
|
+
*/
|
|
35
|
+
export declare function createLocalGitHubClient(env: NodeJS.ProcessEnv): GitHubClient | undefined;
|
|
36
|
+
//# sourceMappingURL=github.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,YAAY,EAMb,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,KAAK,cAAc,EAAqB,MAAM,qBAAqB,CAAA;AAC5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAgBpD;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAM7C;AAED,sFAAsF;AACtF,qBAAa,sBAAuB,YAAW,cAAc;IAE/C,OAAO,CAAC,QAAQ,CAAC,KAAK;IADlC,QAAQ,CAAC,YAAY,MAAK;IAC1B,YAA6B,KAAK,EAAE,MAAM,EAAI;IAE9C,IAAI,IAAI,SAAS;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAEnC;IAED,UAAU,IAAI;QAAE,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;KAAE,CAK1C;IAED,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAEnC;CACF;AAoGD;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAiBjF;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,YAAY,GAAG,SAAS,CAgBxF"}
|