@parcha/agentrun-serve 0.0.0-stage → 0.1.0-beta.30
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/CHANGELOG.md +748 -0
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +2190 -2
- package/dist/adapters.d.ts +234 -0
- package/dist/adapters.js +585 -0
- package/dist/agents.d.ts +130 -0
- package/dist/agents.js +308 -0
- package/dist/app.d.ts +7 -0
- package/dist/app.js +384 -0
- package/dist/background.d.ts +28 -0
- package/dist/background.js +376 -0
- package/dist/bound-files.d.ts +4 -0
- package/dist/bound-files.js +164 -0
- package/dist/box/record.d.ts +6 -0
- package/dist/box/record.js +41 -0
- package/dist/box/sweep.d.ts +53 -0
- package/dist/box/sweep.js +193 -0
- package/dist/box-egress.d.ts +98 -0
- package/dist/box-egress.js +259 -0
- package/dist/box-image.d.ts +98 -0
- package/dist/box-image.js +285 -0
- package/dist/box-relay-vm.d.ts +80 -0
- package/dist/box-relay-vm.js +389 -0
- package/dist/box-relay.d.ts +45 -0
- package/dist/box-relay.js +227 -0
- package/dist/boxes.d.ts +72 -0
- package/dist/boxes.js +189 -0
- package/dist/browser-cost.d.ts +41 -0
- package/dist/browser-cost.js +158 -0
- package/dist/cap.d.ts +332 -0
- package/dist/cap.js +992 -0
- package/dist/catalog.d.ts +20 -0
- package/dist/catalog.js +53 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +167 -0
- package/dist/coding-tools.d.ts +35 -0
- package/dist/coding-tools.js +87 -0
- package/dist/console/THIRD-PARTY-NOTICES.txt +1721 -0
- package/dist/console/assets/index-34jfpIbQ.js +481 -0
- package/dist/console/assets/index-DUHbWcIP.css +1 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-400-normal-CIEtRijs.woff +0 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-600-normal-BB5xRk30.woff +0 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-600-normal-EVf6-Yzo.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-ext-400-normal-BHyURHCj.woff +0 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-ext-400-normal-C_uLvvQ5.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-ext-600-normal-Dj6eZy5f.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-ext-600-normal-DpeVePZf.woff +0 -0
- package/dist/console/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-greek-400-normal-CNojz0t3.woff +0 -0
- package/dist/console/assets/jetbrains-mono-greek-600-normal-3KAm9r92.woff +0 -0
- package/dist/console/assets/jetbrains-mono-greek-600-normal-H7WoG9Et.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-latin-400-normal-B11XCQ5g.woff +0 -0
- package/dist/console/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-latin-600-normal-DXv3JcnD.woff +0 -0
- package/dist/console/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-latin-ext-400-normal-DHMOLxAi.woff +0 -0
- package/dist/console/assets/jetbrains-mono-latin-ext-600-normal-BfB_LPfz.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-latin-ext-600-normal-DiQlUoE6.woff +0 -0
- package/dist/console/assets/jetbrains-mono-vietnamese-400-normal-BeU3T8wf.woff +0 -0
- package/dist/console/assets/jetbrains-mono-vietnamese-400-normal-ByoDsISC.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-vietnamese-600-normal-CSpzN4cI.woff +0 -0
- package/dist/console/assets/jetbrains-mono-vietnamese-600-normal-Dtizs43-.woff2 +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-400-normal-Cph9ettZ.woff2 +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-400-normal-DfGZKnlb.woff +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-600-normal-BGBUNdzT.woff2 +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-600-normal-COje25QW.woff +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-ext-400-normal-4l4lq8zr.woff2 +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-ext-400-normal-BGzXWJeR.woff +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-ext-600-normal-8_E36CQj.woff2 +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-ext-600-normal-C27an7Zc.woff +0 -0
- package/dist/console/index.html +15 -0
- package/dist/content-filter.d.ts +7 -0
- package/dist/content-filter.js +23 -0
- package/dist/daytona-api.d.ts +21 -0
- package/dist/daytona-api.js +101 -0
- package/dist/decision-rows.d.ts +19 -0
- package/dist/decision-rows.js +123 -0
- package/dist/decisions.d.ts +94 -0
- package/dist/decisions.js +184 -0
- package/dist/effort-guidance.d.ts +5 -0
- package/dist/effort-guidance.js +14 -0
- package/dist/environment.d.ts +5 -0
- package/dist/environment.js +11 -0
- package/dist/errors.d.ts +74 -0
- package/dist/errors.js +69 -0
- package/dist/exa-keyless.d.ts +35 -0
- package/dist/exa-keyless.js +202 -0
- package/dist/fetch-page.d.ts +114 -0
- package/dist/fetch-page.js +182 -0
- package/dist/files.d.ts +65 -0
- package/dist/files.js +158 -0
- package/dist/grade.d.ts +93 -0
- package/dist/grade.js +328 -0
- package/dist/graph-served.d.ts +23 -0
- package/dist/graph-served.js +75 -0
- package/dist/graph-view.d.ts +102 -0
- package/dist/graph-view.js +219 -0
- package/dist/harness-app.d.ts +40 -0
- package/dist/harness-app.js +708 -0
- package/dist/harness-opencode/adapter.d.ts +45 -0
- package/dist/harness-opencode/adapter.js +272 -0
- package/dist/harness-opencode/binary.d.ts +18 -0
- package/dist/harness-opencode/binary.js +87 -0
- package/dist/harness-opencode/config.d.ts +24 -0
- package/dist/harness-opencode/config.js +61 -0
- package/dist/harness-opencode/harness.d.ts +77 -0
- package/dist/harness-opencode/harness.js +620 -0
- package/dist/harness-opencode/host/mcp.d.ts +40 -0
- package/dist/harness-opencode/host/mcp.js +208 -0
- package/dist/harness-opencode/host/policy.d.ts +71 -0
- package/dist/harness-opencode/host/policy.js +419 -0
- package/dist/harness-opencode/host/server.d.ts +55 -0
- package/dist/harness-opencode/host/server.js +165 -0
- package/dist/harness-opencode/index.d.ts +9 -0
- package/dist/harness-opencode/index.js +6 -0
- package/dist/harness-opencode/verify.d.ts +32 -0
- package/dist/harness-opencode/verify.js +75 -0
- package/dist/harness-opencode/versions.d.ts +33 -0
- package/dist/harness-opencode/versions.js +64 -0
- package/dist/harness.d.ts +56 -0
- package/dist/harness.js +77 -0
- package/dist/home-path.d.ts +27 -0
- package/dist/home-path.js +78 -0
- package/dist/host-tools.d.ts +30 -0
- package/dist/host-tools.js +154 -0
- package/dist/host.d.ts +39 -0
- package/dist/host.js +85 -0
- package/dist/hosted-search.d.ts +27 -0
- package/dist/hosted-search.js +133 -0
- package/dist/import-sources.d.ts +104 -0
- package/dist/import-sources.js +629 -0
- package/dist/import-summary.d.ts +25 -0
- package/dist/import-summary.js +75 -0
- package/dist/import-worker.d.ts +26 -0
- package/dist/import-worker.js +41 -0
- package/dist/import.d.ts +145 -0
- package/dist/import.js +1222 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +6 -0
- package/dist/key-check.d.ts +37 -0
- package/dist/key-check.js +112 -0
- package/dist/key-refusal.d.ts +51 -0
- package/dist/key-refusal.js +191 -0
- package/dist/learn/check.d.ts +108 -0
- package/dist/learn/check.js +277 -0
- package/dist/learn/grade.d.ts +80 -0
- package/dist/learn/grade.js +445 -0
- package/dist/learn/index.d.ts +7 -0
- package/dist/learn/index.js +11 -0
- package/dist/learn/invisible.d.ts +5 -0
- package/dist/learn/invisible.js +42 -0
- package/dist/learn/notes.d.ts +59 -0
- package/dist/learn/notes.js +147 -0
- package/dist/learn/reflect.d.ts +49 -0
- package/dist/learn/reflect.js +213 -0
- package/dist/learn/secrets.d.ts +18 -0
- package/dist/learn/secrets.js +131 -0
- package/dist/learn/skills.d.ts +97 -0
- package/dist/learn/skills.js +271 -0
- package/dist/learned-workflow.d.ts +59 -0
- package/dist/learned-workflow.js +191 -0
- package/dist/learning-routes.d.ts +196 -0
- package/dist/learning-routes.js +609 -0
- package/dist/learning-run.d.ts +306 -0
- package/dist/learning-run.js +819 -0
- package/dist/learning-words.d.ts +76 -0
- package/dist/learning-words.js +174 -0
- package/dist/learning.d.ts +418 -0
- package/dist/learning.js +946 -0
- package/dist/llm.d.ts +40 -0
- package/dist/llm.js +37 -0
- package/dist/llms.txt +37 -0
- package/dist/mcp-servers.d.ts +118 -0
- package/dist/mcp-servers.js +450 -0
- package/dist/mcp.d.ts +51 -0
- package/dist/mcp.js +392 -0
- package/dist/model.d.ts +186 -0
- package/dist/model.js +485 -0
- package/dist/monid.d.ts +74 -0
- package/dist/monid.js +277 -0
- package/dist/openapi/agentrun-v2.openapi.json +4806 -0
- package/dist/openapi.d.ts +10 -0
- package/dist/openapi.js +1727 -0
- package/dist/owner.d.ts +55 -0
- package/dist/owner.js +222 -0
- package/dist/packs.d.ts +71 -0
- package/dist/packs.js +180 -0
- package/dist/page.d.ts +32 -0
- package/dist/page.js +133 -0
- package/dist/paid-calls.d.ts +50 -0
- package/dist/paid-calls.js +110 -0
- package/dist/pause.d.ts +70 -0
- package/dist/pause.js +97 -0
- package/dist/pdf-pages.d.ts +44 -0
- package/dist/pdf-pages.js +147 -0
- package/dist/place.d.ts +69 -0
- package/dist/place.js +137 -0
- package/dist/print.d.ts +20 -0
- package/dist/print.js +29 -0
- package/dist/propose.d.ts +40 -0
- package/dist/propose.js +112 -0
- package/dist/quiet-sqlite-warning.d.ts +1 -0
- package/dist/quiet-sqlite-warning.js +14 -0
- package/dist/request-start.d.ts +22 -0
- package/dist/request-start.js +350 -0
- package/dist/result.d.ts +3 -0
- package/dist/result.js +5 -0
- package/dist/rows.d.ts +46 -0
- package/dist/rows.js +121 -0
- package/dist/run-box.d.ts +186 -0
- package/dist/run-box.js +590 -0
- package/dist/run-manifest.d.ts +27 -0
- package/dist/run-manifest.js +60 -0
- package/dist/runnable.d.ts +83 -0
- package/dist/runnable.js +170 -0
- package/dist/runs.d.ts +1062 -0
- package/dist/runs.js +3020 -0
- package/dist/secret-cut.d.ts +27 -0
- package/dist/secret-cut.js +109 -0
- package/dist/secrets.d.ts +62 -0
- package/dist/secrets.js +158 -0
- package/dist/server-lock.d.ts +44 -0
- package/dist/server-lock.js +140 -0
- package/dist/server.d.ts +722 -0
- package/dist/server.js +2118 -0
- package/dist/sessions.d.ts +4 -0
- package/dist/sessions.js +105 -0
- package/dist/sign-ins.d.ts +99 -0
- package/dist/sign-ins.js +288 -0
- package/dist/skills.d.ts +43 -0
- package/dist/skills.js +96 -0
- package/dist/stats.d.ts +106 -0
- package/dist/stats.js +103 -0
- package/dist/tool-gate.d.ts +266 -0
- package/dist/tool-gate.js +554 -0
- package/dist/tool-keys.d.ts +187 -0
- package/dist/tool-keys.js +315 -0
- package/dist/tool-plane.d.ts +228 -0
- package/dist/tool-plane.js +400 -0
- package/dist/tools.d.ts +202 -0
- package/dist/tools.js +372 -0
- package/dist/trigger-secrets.d.ts +32 -0
- package/dist/trigger-secrets.js +143 -0
- package/dist/triggers.d.ts +439 -0
- package/dist/triggers.js +863 -0
- package/dist/turn-end.d.ts +24 -0
- package/dist/turn-end.js +15 -0
- package/dist/turns.d.ts +34 -0
- package/dist/turns.js +202 -0
- package/dist/uploads.d.ts +104 -0
- package/dist/uploads.js +474 -0
- package/dist/usage-lines.d.ts +26 -0
- package/dist/usage-lines.js +28 -0
- package/dist/usage.d.ts +29 -0
- package/dist/usage.js +58 -0
- package/dist/validate.d.ts +57 -0
- package/dist/validate.js +184 -0
- package/dist/web-fetch.d.ts +64 -0
- package/dist/web-fetch.js +262 -0
- package/dist/web-search.d.ts +54 -0
- package/dist/web-search.js +136 -0
- package/dist/webhooks.d.ts +189 -0
- package/dist/webhooks.js +503 -0
- package/dist/workspace-paths.d.ts +33 -0
- package/dist/workspace-paths.js +104 -0
- package/dist/workspace.d.ts +88 -0
- package/dist/workspace.js +369 -0
- package/launcher/agentrun-serve +109 -0
- package/package.json +100 -4
- package/skills/agentrun-serve/SKILL.md +128 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import type { Context } from "@earendil-works/chord";
|
|
2
|
+
import type { ExecutionEnv } from "@earendil-works/pi-durable/env";
|
|
3
|
+
import type { BoxProvider, BoxSpec } from "@parcha/pi-transport";
|
|
4
|
+
import type { PullReceipt } from "@parcha/pi-transport/sync";
|
|
5
|
+
import { type BoxEgress, type DockerNetwork, egressBlockedBy } from "./box-egress.js";
|
|
6
|
+
import { type Place } from "./place.js";
|
|
7
|
+
/** The label a run's box carries: the run's id. */
|
|
8
|
+
export declare const RUN_LABEL = "agentrun.run";
|
|
9
|
+
/** And, on a box made with a network list, this one: the list's hash (netLabelOf). A box with none carries no such label,
|
|
10
|
+
* so its `docker run` is as it was. */
|
|
11
|
+
export declare const NET_LABEL = "agentrun.net";
|
|
12
|
+
/** The network label's value for a list: the same hosts give the same label, in whatever order and case the setting
|
|
13
|
+
* names them, each once. */
|
|
14
|
+
export declare const netLabelOf: (allow: readonly string[]) => string;
|
|
15
|
+
/** And this one, the same on every run's box, which the start's sweep lists them by. */
|
|
16
|
+
export declare const KIND_LABEL = "agentrun.box";
|
|
17
|
+
/** The whole environment of a box's programs: a constant, never this process's. */
|
|
18
|
+
export declare const BOX_ENV: Readonly<Record<string, string>>;
|
|
19
|
+
/** How long a box lives whatever happens to the server: a bound on a leaked box, never its clean end. */
|
|
20
|
+
export declare const BOX_LIFETIME_MS: number;
|
|
21
|
+
/** A bash command's timeout when the model names none. */
|
|
22
|
+
export declare const BASH_TIMEOUT_MS = 300000;
|
|
23
|
+
/** The image a Docker box starts from (box-image.ts, where the server makes it ready). */
|
|
24
|
+
export { DEFAULT_DOCKER_IMAGE, DOCKER_IMAGE_ENV } from "./box-image.js";
|
|
25
|
+
/** The settings that bound a Docker box; unset, their defaults: enough for a build, and safe on a laptop, where one run's
|
|
26
|
+
* runaway build or fork bomb would otherwise starve everything else. */
|
|
27
|
+
export declare const BOX_CPUS_ENV = "AGENTRUN_BOX_CPUS";
|
|
28
|
+
export declare const BOX_MEMORY_ENV = "AGENTRUN_BOX_MEMORY";
|
|
29
|
+
export declare const BOX_PIDS_ENV = "AGENTRUN_BOX_PIDS";
|
|
30
|
+
/** 2 CPUs' time: a CFS quota (pi-transport's Docker provider), which holds whatever CPU count Docker's VM has. */
|
|
31
|
+
export declare const DEFAULT_BOX_CPUS = 2;
|
|
32
|
+
/** 4 GiB, swap included (--memory-swap the same). */
|
|
33
|
+
export declare const DEFAULT_BOX_MEMORY = "4g";
|
|
34
|
+
/** Processes and threads at once. */
|
|
35
|
+
export declare const DEFAULT_BOX_PIDS = 1024;
|
|
36
|
+
/** A Docker box's limits, as pi-transport's Docker provider takes them. */
|
|
37
|
+
export type BoxLimits = {
|
|
38
|
+
cpus: number;
|
|
39
|
+
memory: string;
|
|
40
|
+
pidsLimit: number;
|
|
41
|
+
};
|
|
42
|
+
/** A Docker box's limits from `env`: each setting's value, or its default when unset or empty. A value that is not one, or
|
|
43
|
+
* that every create would fail on (less than a 1 ms quota, less memory than Docker gives, more processes than the kernel
|
|
44
|
+
* allows), throws, naming its setting: the start checks them (startServe), so no run meets one. */
|
|
45
|
+
export declare function boxLimitsOf(env: NodeJS.ProcessEnv): BoxLimits;
|
|
46
|
+
/** The setting that names the hosts a box may reach: a comma list of hosts, each a name or `*.` and a name, which
|
|
47
|
+
* replaces the default list; `none` for no network at all. Unset or empty, the default. */
|
|
48
|
+
export declare const BOX_ALLOW_ENV = "AGENTRUN_BOX_ALLOW";
|
|
49
|
+
/** The hosts a box reaches when the setting names none: the package registries pip and npm (and yarn) install from, and
|
|
50
|
+
* GitHub for a clone or an archive. */
|
|
51
|
+
export declare const DEFAULT_BOX_ALLOW: readonly string[];
|
|
52
|
+
/** The most hosts the list may hold: Daytona's own limit on a sandbox's domain list. */
|
|
53
|
+
export declare const MAX_BOX_ALLOW = 100;
|
|
54
|
+
/** The hosts a box may reach, from `env`'s AGENTRUN_BOX_ALLOW: its list, lower-cased, each host once; the default list when
|
|
55
|
+
* unset or empty; `none` for no network. `*`, an IP address, a CIDR, a port, a URL, or more than 100 hosts throws, saying
|
|
56
|
+
* what the setting takes: the start checks it (startServe), so no run meets one. */
|
|
57
|
+
export declare function boxAllowOf(env: NodeJS.ProcessEnv): readonly string[] | "none";
|
|
58
|
+
/** What a server's Docker boxes reach, resolved once at its start: the setting's list (boxAllowOf) where egressBlockedBy
|
|
59
|
+
* (box-egress.ts) finds the daemon is this Linux machine's own, else none with the reason; `none` from the setting, with
|
|
60
|
+
* it as the reason. */
|
|
61
|
+
export declare function boxNetworkOf(env: NodeJS.ProcessEnv, options?: Parameters<typeof egressBlockedBy>[1]): Promise<DockerNetwork>;
|
|
62
|
+
/** Under `--faux` only: a module whose default export, given the data root, is the provider runs' boxes come from in
|
|
63
|
+
* place of Docker (the tests' faux box). */
|
|
64
|
+
export declare const FAUX_BOX_ENV = "AGENTRUN_SERVE_FAUX_BOX";
|
|
65
|
+
/** A remote box's sync mark in its run's directory: the box's id and the listing its seed or last pull left. The
|
|
66
|
+
* server alone writes it. */
|
|
67
|
+
export declare const BOX_SYNC_FILE = "box-sync.json";
|
|
68
|
+
/** What the run's process copied into its remote box after the seed (a file its host tools filed in work/): one JSON line
|
|
69
|
+
* per file, `{path, sha256, bytes}`, appended by that process alone. The mark has one writer, the server, so the
|
|
70
|
+
* process never writes it; a pull folds these lines into the mark it compares against, for paths the mark lacks, so
|
|
71
|
+
* the box's later edit of such a file comes back instead of reading as a change the server made. */
|
|
72
|
+
export declare const BOX_MIRRORED_FILE = "box-mirrored.jsonl";
|
|
73
|
+
type Mount = NonNullable<BoxSpec["mounts"]>[number];
|
|
74
|
+
/** `source`, when it is below `root` through no link and is its own canonical path; else a refusal naming the link.
|
|
75
|
+
* `root`, the data root, is canonical already (startServe), so a link above it is the operator's choice. */
|
|
76
|
+
export declare function mountSource(root: string, source: string): Promise<string>;
|
|
77
|
+
/** Every mount a run's box gets, each through mountSource: its work/ only, read-write, at BOX_WORK. A run's home joins
|
|
78
|
+
* this list (read-only parts included) when it comes; nothing else of the data root does. */
|
|
79
|
+
export declare function boxMounts(root: string, runDir: string, place: Place): Promise<Mount[]>;
|
|
80
|
+
/** The provider runs' boxes come from, what a create of its box waits on first (`ready`, run-box below), and, for a box
|
|
81
|
+
* that reaches the server's host list, where it finds its egress proxy (`egress`, box-egress.ts). */
|
|
82
|
+
export type RunBoxes = BoxProvider & {
|
|
83
|
+
ready?: BoxReady;
|
|
84
|
+
egress?: BoxEgress;
|
|
85
|
+
net?: string;
|
|
86
|
+
};
|
|
87
|
+
/** The provider runs' boxes come from: under `--faux` with a faux box, its module's; else Docker on this machine, run as
|
|
88
|
+
* this process's user (serve's: a run's process is its child), so what a box writes in work/ stays serve's, within the
|
|
89
|
+
* box limits the server's settings give (boxLimitsOf), and whose create first waits while the server pulls its image
|
|
90
|
+
* (box-image.ts). */
|
|
91
|
+
export declare function runBoxProvider(place: Place, env: NodeJS.ProcessEnv, root: string): Promise<RunBoxes>;
|
|
92
|
+
/** What a run's box create waits on first, `note` taking its one timeline row: the server's pull of the Docker image
|
|
93
|
+
* (box-image.ts). A faux box has no image, so none. */
|
|
94
|
+
export type BoxReady = (context: Context, note: (summary: string) => Promise<void> | void) => Promise<void>;
|
|
95
|
+
/** The tests' faux box provider, from its module. */
|
|
96
|
+
export declare const fauxBoxes: (module: string, root: string) => Promise<BoxProvider>;
|
|
97
|
+
/** A run's box, as its tools' environment: found by its label or made on the first call, once; made again on the call
|
|
98
|
+
* after it was lost. A box that cannot be had fails that call; nothing falls back to this machine. Before a local box is
|
|
99
|
+
* made, its provider's `ready` is waited on (its image), and the call that opens it gives the `note` for its timeline
|
|
100
|
+
* row; a remote box is the server's to make (ensureRemoteBox), and never waits on that. `mirror`, on a remote box: copies
|
|
101
|
+
* a file the run's host tools filed in work/ (at `path`, relative to it) into the box, now when the box is open, else at
|
|
102
|
+
* its open. */
|
|
103
|
+
export type RunBox = {
|
|
104
|
+
env(context: Context, note?: (summary: string) => Promise<void> | void): Promise<ExecutionEnv>;
|
|
105
|
+
hostWork: string;
|
|
106
|
+
bound(): Promise<boolean>;
|
|
107
|
+
leftEnded(context: Context): Promise<void>;
|
|
108
|
+
mirror?: (path: string, data: string | Uint8Array) => Promise<void>;
|
|
109
|
+
};
|
|
110
|
+
/** Where a run's box comes from: a provider of this process's own (Docker, or the tests' faux box), or, for a remote box,
|
|
111
|
+
* the server's relay in data root `relay`. A bare function is a provider of this process's own. */
|
|
112
|
+
export type BoxSource = {
|
|
113
|
+
provider: () => Promise<RunBoxes>;
|
|
114
|
+
} | {
|
|
115
|
+
relay: string;
|
|
116
|
+
};
|
|
117
|
+
export declare function runBox(given: BoxSource | (() => Promise<RunBoxes>), run: {
|
|
118
|
+
id: string;
|
|
119
|
+
root: string;
|
|
120
|
+
dir: string;
|
|
121
|
+
place: Place;
|
|
122
|
+
}): RunBox;
|
|
123
|
+
/** A remote box's limits, where its provider takes them (the VM box: CPUs and memory, from the same settings as a Docker
|
|
124
|
+
* box's, boxLimitsOf). */
|
|
125
|
+
export type RemoteLimits = {
|
|
126
|
+
cpus?: number;
|
|
127
|
+
memoryMb?: number;
|
|
128
|
+
};
|
|
129
|
+
/** A Docker size (boxLimitsOf's memory) in MiB, the fraction dropped. */
|
|
130
|
+
export declare const memoryMbOf: (memory: string) => number;
|
|
131
|
+
/** The server's side of a remote box: run `run`'s box, found by its label or made, with its work/ seeded once (its mark
|
|
132
|
+
* says so); its id, and whether it was made now. A box is made with the host list `allow` names, or with no network when
|
|
133
|
+
* it is `none`; a create the provider refuses for its list (NO_LIST) is said to `onNoList` at once, with its refusal's
|
|
134
|
+
* code and words (so a closed box or a seed that then fails leaves it said), and made again with no network, never open.
|
|
135
|
+
* A found box is kept when it has no network, or the list asked (the same hosts, in any order, as its provider reads
|
|
136
|
+
* them); any other (open, unknown, another list or one it does not say, or a list when `none` was asked) is copied back
|
|
137
|
+
* whole, then destroyed and made again, so a narrower list holds after a restart. One whose copy back fails or is not
|
|
138
|
+
* whole is kept, and the call fails. A box whose seed fails is destroyed, and the call fails. */
|
|
139
|
+
/** What ensureRemoteBox takes beyond the run: the wake of a box Daytona stopped, the hosts the box may reach (`none` for
|
|
140
|
+
* none), who hears a refused list, and the copy back a found box gets before it is replaced (pullRemoteBox). */
|
|
141
|
+
export type RemoteBoxOptions = {
|
|
142
|
+
wake?: () => Promise<number>;
|
|
143
|
+
allow?: readonly string[] | "none";
|
|
144
|
+
onNoList?: (code: string, message: string) => void;
|
|
145
|
+
pull?: (boxes: BoxProvider, run: {
|
|
146
|
+
id: string;
|
|
147
|
+
dir: string;
|
|
148
|
+
}, context: Context, wake?: () => Promise<number>) => Promise<unknown>;
|
|
149
|
+
/** The box's limits, where its provider takes them (remoteSpec). */
|
|
150
|
+
limits?: RemoteLimits;
|
|
151
|
+
};
|
|
152
|
+
export declare function ensureRemoteBox(boxes: BoxProvider, run: {
|
|
153
|
+
id: string;
|
|
154
|
+
dir: string;
|
|
155
|
+
}, context: Context, options?: RemoteBoxOptions): Promise<{
|
|
156
|
+
id: string;
|
|
157
|
+
made: boolean;
|
|
158
|
+
}>;
|
|
159
|
+
/** What a pull of a remote box brought back; undefined when the run has no box (none made, or it is gone). */
|
|
160
|
+
export type RemotePull = {
|
|
161
|
+
-readonly [K in "changed" | "files" | "bytes" | "removed"]: PullReceipt[K];
|
|
162
|
+
};
|
|
163
|
+
/** A pull that did not bring the box's work/ back whole: what it wrote is kept, with its mark, and the box must stay.
|
|
164
|
+
* `lasting`: a stop another pull will meet again (an archive the extractor cannot read, or a limit a pull that wrote
|
|
165
|
+
* nothing reached); else the copy failed, and a later pull may land. */
|
|
166
|
+
export declare class PullIncomplete extends Error {
|
|
167
|
+
readonly lasting: boolean;
|
|
168
|
+
/** The box that keeps what did not come back. */
|
|
169
|
+
readonly box: string;
|
|
170
|
+
constructor(message: string, lasting: boolean, box: string);
|
|
171
|
+
}
|
|
172
|
+
/** The server's side of a remote box: what changed in the box's work/ since its mark, pulled into the run's work/ by the
|
|
173
|
+
* safe extractor (nothing outside work/, no link, safe names only). A file this machine changed since the mark stays
|
|
174
|
+
* (`if_unchanged`), and what the box removed is removed here too. A pull a limit stopped after it wrote something is
|
|
175
|
+
* followed by another, which asks only for the rest. Throws when the copy fails (the mark kept), and PullIncomplete when
|
|
176
|
+
* it is not whole: a caller then keeps the box. */
|
|
177
|
+
export declare function pullRemoteBox(boxes: BoxProvider, run: {
|
|
178
|
+
id: string;
|
|
179
|
+
dir: string;
|
|
180
|
+
}, context: Context, wake?: () => Promise<number>): Promise<RemotePull | undefined>;
|
|
181
|
+
/** Destroys every box labelled with run `runId`; how many it destroyed. */
|
|
182
|
+
export declare function destroyRunBoxes(boxes: BoxProvider, runId: string, context: Context): Promise<number>;
|
|
183
|
+
/** The start's sweep: destroys every run's box whose run `ended` says is over, once `before` (a remote box's pull) for its
|
|
184
|
+
* run says it may go. A box of a run this server does not know is left to its lifetime: another server's, or one being
|
|
185
|
+
* made. */
|
|
186
|
+
export declare function sweepRunBoxes(boxes: BoxProvider, ended: (runId: string) => boolean, context: Context, before?: (runId: string, boxId: string) => Promise<boolean>): Promise<number>;
|