@parcha/agentrun-computer 0.1.0-beta.35 → 0.1.0-beta.37

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.
Files changed (148) hide show
  1. package/NOTICE +2 -0
  2. package/README.md +423 -323
  3. package/box/Dockerfile +3 -1
  4. package/box/agentrun-archil +59 -7
  5. package/box/build-agent37.mjs +177 -0
  6. package/box/build-daytona.py +20 -4
  7. package/dist/agent37.d.ts +165 -0
  8. package/dist/agent37.js +759 -0
  9. package/dist/attach.d.ts +146 -0
  10. package/dist/attach.js +469 -0
  11. package/dist/browser.d.ts +61 -10
  12. package/dist/browser.js +125 -3
  13. package/dist/browserbase.d.ts +46 -23
  14. package/dist/browserbase.js +162 -17
  15. package/dist/chrome.d.ts +3 -4
  16. package/dist/chrome.js +6 -11
  17. package/dist/client.d.ts +33 -1
  18. package/dist/client.js +53 -0
  19. package/dist/computerd-linux-amd64 +0 -0
  20. package/dist/computerd-linux-arm64 +0 -0
  21. package/dist/conformance/agent37.d.ts +96 -0
  22. package/dist/conformance/agent37.js +154 -0
  23. package/dist/conformance/cases/apps.d.ts +5 -0
  24. package/dist/conformance/cases/apps.js +160 -73
  25. package/dist/conformance/cases/health.js +14 -0
  26. package/dist/conformance/cases/index.js +2 -0
  27. package/dist/conformance/cases/provider.js +27 -1
  28. package/dist/conformance/cases/screen.d.ts +3 -0
  29. package/dist/conformance/cases/screen.js +18 -0
  30. package/dist/conformance/cases/settings.d.ts +29 -23
  31. package/dist/conformance/cases/settings.js +76 -58
  32. package/dist/conformance/cases/touch.js +19 -17
  33. package/dist/conformance/cases/ui.d.ts +2 -0
  34. package/dist/conformance/cases/ui.js +475 -0
  35. package/dist/conformance/cli.d.ts +9 -0
  36. package/dist/conformance/cli.js +28 -3
  37. package/dist/conformance/daytona.d.ts +4 -0
  38. package/dist/conformance/daytona.js +5 -0
  39. package/dist/conformance/e2b.d.ts +6 -0
  40. package/dist/conformance/e2b.js +9 -2
  41. package/dist/conformance/fixture.d.ts +1 -1
  42. package/dist/conformance/fixture.js +25 -1
  43. package/dist/conformance/modal.d.ts +17 -13
  44. package/dist/conformance/modal.js +18 -9
  45. package/dist/conformance/orgo.d.ts +3 -3
  46. package/dist/conformance/orgo.js +6 -8
  47. package/dist/conformance/phone-harness.d.ts +6 -2
  48. package/dist/conformance/phone-harness.js +21 -4
  49. package/dist/conformance/report.js +1 -1
  50. package/dist/conformance/runner.js +23 -4
  51. package/dist/conformance/sweep.d.ts +50 -0
  52. package/dist/conformance/sweep.js +187 -0
  53. package/dist/conformance/types.d.ts +11 -3
  54. package/dist/conformance/ui-fixture.d.ts +56 -0
  55. package/dist/conformance/ui-fixture.js +43 -0
  56. package/dist/create-requests.d.ts +51 -0
  57. package/dist/create-requests.js +121 -0
  58. package/dist/daytona.d.ts +15 -5
  59. package/dist/daytona.js +58 -38
  60. package/dist/descriptor.d.ts +29 -2
  61. package/dist/descriptor.js +13 -0
  62. package/dist/descriptors/agent37.d.ts +41 -0
  63. package/dist/descriptors/agent37.js +28 -0
  64. package/dist/descriptors/browserbase.d.ts +1 -0
  65. package/dist/descriptors/browserbase.js +2 -0
  66. package/dist/descriptors/daytona.d.ts +23 -2
  67. package/dist/descriptors/daytona.js +34 -2
  68. package/dist/descriptors/index.d.ts +66 -3
  69. package/dist/descriptors/index.js +5 -3
  70. package/dist/descriptors/kernel.d.ts +1 -0
  71. package/dist/descriptors/kernel.js +2 -0
  72. package/dist/descriptors/modal.d.ts +4 -0
  73. package/dist/descriptors/modal.js +11 -1
  74. package/dist/descriptors/orgo.d.ts +13 -1
  75. package/dist/descriptors/orgo.js +9 -3
  76. package/dist/descriptors/phone-harness.d.ts +6 -1
  77. package/dist/descriptors/phone-harness.js +5 -2
  78. package/dist/docker/egress.d.ts +4 -3
  79. package/dist/docker/egress.js +7 -6
  80. package/dist/docker.d.ts +7 -4
  81. package/dist/docker.js +278 -34
  82. package/dist/e2b.d.ts +9 -165
  83. package/dist/e2b.js +282 -1342
  84. package/dist/fake-ui-driver.d.ts +97 -0
  85. package/dist/fake-ui-driver.js +717 -0
  86. package/dist/host.d.ts +182 -0
  87. package/dist/host.js +1 -0
  88. package/dist/hosted/process.d.ts +67 -0
  89. package/dist/hosted/process.js +228 -0
  90. package/dist/hosted/provider.d.ts +146 -0
  91. package/dist/hosted/provider.js +1364 -0
  92. package/dist/hosted/scripts.d.ts +76 -0
  93. package/dist/{child.js → hosted/scripts.js} +93 -12
  94. package/dist/index.d.ts +11 -7
  95. package/dist/index.js +10 -7
  96. package/dist/janitor.d.ts +5 -4
  97. package/dist/janitor.js +1 -1
  98. package/dist/kernel.d.ts +17 -27
  99. package/dist/kernel.js +94 -18
  100. package/dist/kinds.d.ts +17 -5
  101. package/dist/kinds.js +20 -4
  102. package/dist/labels.d.ts +10 -2
  103. package/dist/labels.js +30 -7
  104. package/dist/local-chrome.d.ts +5 -5
  105. package/dist/local-chrome.js +10 -5
  106. package/dist/modal.d.ts +23 -181
  107. package/dist/modal.js +273 -1232
  108. package/dist/mount-archil.d.ts +25 -3
  109. package/dist/mount-archil.js +39 -8
  110. package/dist/orgo-channel.d.ts +3 -2
  111. package/dist/orgo-channel.js +5 -2
  112. package/dist/orgo-desktop.d.ts +23 -9
  113. package/dist/orgo-desktop.js +328 -66
  114. package/dist/orgo-names.d.ts +129 -3
  115. package/dist/orgo-names.js +211 -8
  116. package/dist/orgo-workspaces.d.ts +47 -0
  117. package/dist/orgo-workspaces.js +94 -0
  118. package/dist/orgo.d.ts +27 -10
  119. package/dist/orgo.js +411 -81
  120. package/dist/phone-harness.d.ts +31 -21
  121. package/dist/phone-harness.js +510 -681
  122. package/dist/png.d.ts +4 -0
  123. package/dist/png.js +27 -0
  124. package/dist/protocol.d.ts +338 -30
  125. package/dist/protocol.js +96 -3
  126. package/dist/provider.d.ts +97 -7
  127. package/dist/provider.js +24 -3
  128. package/dist/result.d.ts +1 -1
  129. package/dist/surface/api.d.ts +248 -0
  130. package/dist/surface/api.js +1 -0
  131. package/dist/surface/core.d.ts +42 -0
  132. package/dist/surface/core.js +393 -0
  133. package/dist/surface/index.d.ts +5 -0
  134. package/dist/surface/index.js +3 -0
  135. package/dist/surface/outline.d.ts +8 -0
  136. package/dist/surface/outline.js +50 -0
  137. package/dist/surface/script.d.ts +10 -0
  138. package/dist/surface/script.js +92 -0
  139. package/dist/ui-engine.d.ts +114 -0
  140. package/dist/ui-engine.js +798 -0
  141. package/package.json +17 -1
  142. package/dist/child.d.ts +0 -42
  143. package/dist/conformance/e2b-diagnose.d.ts +0 -16
  144. package/dist/conformance/e2b-diagnose.js +0 -61
  145. package/dist/conformance/e2b-sweep.d.ts +0 -18
  146. package/dist/conformance/e2b-sweep.js +0 -132
  147. package/dist/conformance/modal-sweep.d.ts +0 -22
  148. package/dist/conformance/modal-sweep.js +0 -213
@@ -9,7 +9,7 @@ import type { KindVerdict } from "./kind.js";
9
9
  /** Core: what a computer of its kind must do. Full: an optional capability, tested only where it is declared. */
10
10
  export type Level = "core" | "full";
11
11
  /** The suite's own grouping of its cases, the first part of each case id; not the protocol's Group. */
12
- export type CaseGroup = "health" | "exec" | "files" | "process" | "provider" | "drift" | "isolation" | "mount" | "screen" | "input" | "touch" | "apps" | "lifetime" | "browser" | "gpu";
12
+ export type CaseGroup = "health" | "exec" | "files" | "process" | "provider" | "drift" | "isolation" | "mount" | "screen" | "input" | "touch" | "apps" | "ui" | "lifetime" | "browser" | "gpu";
13
13
  /**
14
14
  * What a case needs: a group (declared by both the provider's capabilities().groups and the computer's hello), a
15
15
  * network the provider declares, the janitor as the keeper of deadlines, a spec.user the provider takes, a release that
@@ -76,8 +76,9 @@ export interface CaseContext {
76
76
  /**
77
77
  * Calls create with this whole spec, through by (default the provider), and gives its result as it is. The runner
78
78
  * waits for it: a computer it makes is deleted when the case ends, or as it comes after that, named in cleanup.late.
79
+ * Each attempt is a new request (a fresh request id) unless requestId names one, as a retry of the same request does.
79
80
  */
80
- attempt(spec: ComputerSpec, by?: ComputerProvider): Promise<Result<ComputerRef>>;
81
+ attempt(spec: ComputerSpec, by?: ComputerProvider, requestId?: string): Promise<Result<ComputerRef>>;
81
82
  /** A computer the case made through another provider (the drifted one): deleted through it when the case ends. */
82
83
  track(ref: ComputerRef, by?: ComputerProvider): void;
83
84
  /** A further connection, to the case's computer or another; fails the case when connect refuses. */
@@ -202,13 +203,20 @@ export interface ConformanceReport {
202
203
  undeclared: Capability[];
203
204
  /**
204
205
  * The computers of this run deleted, those still there after it, what went wrong, and the computers a provider gave
205
- * after their case had ended (each deleted as it came).
206
+ * after their case had ended (each deleted as it came). sweep: for a provider on the shared machine-host adapter, the
207
+ * live sweep of the run's label at its end (conformance/sweep.ts): nothing left behind is stillThere empty.
206
208
  */
207
209
  cleanup: {
208
210
  deleted: string[];
209
211
  left: string[];
210
212
  errors: string[];
211
213
  late: string[];
214
+ sweep?: {
215
+ swept: number;
216
+ gone: number;
217
+ stillThere: string[];
218
+ leftAlone: number;
219
+ };
212
220
  };
213
221
  /** What the provider module says of its configuration, for whoever reads the report; absent when it says nothing. */
214
222
  notes?: string[];
@@ -0,0 +1,56 @@
1
+ import type { Rect, UiFlag, UiRole, UiRoute } from "../protocol.js";
2
+ /**
3
+ * What pressing an element does, `after` ms later: go opens a screen in its window (through a transition of
4
+ * animateMs), open opens a new window of the app on that screen, in front, and close closes the window it is in.
5
+ */
6
+ export interface FakeEffect {
7
+ go?: string;
8
+ open?: string;
9
+ close?: true;
10
+ after?: number;
11
+ animateMs?: number;
12
+ }
13
+ /** One element of a scripted app. The same key on two screens is the same element (its ref survives the change). */
14
+ export interface FakeElement {
15
+ key: string;
16
+ role: UiRole;
17
+ name?: string;
18
+ value?: string;
19
+ desc?: string;
20
+ id?: string;
21
+ /** In window points. */
22
+ bounds: Rect;
23
+ /** The key of the element above it, which comes before it. */
24
+ parent?: string;
25
+ flags?: UiFlag[];
26
+ actions?: string[];
27
+ press?: FakeEffect;
28
+ /** What enter does while this element has the focus. */
29
+ enter?: FakeEffect;
30
+ /** The best route that reaches it; default semantic. Only foreground input reaches a foreground element. */
31
+ route?: UiRoute;
32
+ /** Its value is the number of clicks that reached it, so a driver can read back whether one landed. */
33
+ counts?: boolean;
34
+ /** A set into it is taken back this many ms later: its value returns to what it was. */
35
+ takesBack?: number;
36
+ }
37
+ export interface FakeScreen {
38
+ title?: string;
39
+ elements: FakeElement[];
40
+ }
41
+ /** A scripted app: its screens, the first one shown, and its window's size in points. */
42
+ export interface FakeApp {
43
+ id: string;
44
+ name: string;
45
+ start: string;
46
+ size: [number, number];
47
+ screens: Record<string, FakeScreen>;
48
+ }
49
+ export declare const SAVED_MS = 300;
50
+ export declare const NEXT_MS = 200;
51
+ export declare const NEXT_ANIMATE_MS = 300;
52
+ export declare const NEW_WINDOW_MS = 300;
53
+ /** Well inside SET_HOLD_MS, so an act that set the Code field reads it taken back before it answers. */
54
+ export declare const TAKES_BACK_MS = 150;
55
+ /** The fixture's app, as the fake ui driver runs it. */
56
+ export declare const UI_FIXTURE: FakeApp;
@@ -0,0 +1,43 @@
1
+ export const SAVED_MS = 300;
2
+ export const NEXT_MS = 200;
3
+ export const NEXT_ANIMATE_MS = 300;
4
+ export const NEW_WINDOW_MS = 300;
5
+ /** Well inside SET_HOLD_MS, so an act that set the Code field reads it taken back before it answers. */
6
+ export const TAKES_BACK_MS = 150;
7
+ const home = [
8
+ { key: "title", role: "heading", name: "UI fixture", bounds: [16, 16, 300, 24] },
9
+ { key: "name", role: "textbox", name: "Name", value: "", id: "name", bounds: [16, 56, 200, 28], actions: ["AXConfirm"] },
10
+ { key: "wifi", role: "switch", name: "Wi-Fi", desc: "Networks nearby", id: "wifi", bounds: [16, 96, 60, 28], actions: ["AXPress"] },
11
+ { key: "save", role: "button", name: "Save", id: "save", bounds: [16, 136, 80, 28], actions: ["AXPress"], press: { go: "saved", after: SAVED_MS } },
12
+ { key: "next", role: "button", name: "Next", id: "next", bounds: [112, 136, 80, 28], actions: ["AXPress"], press: { go: "second", after: NEXT_MS, animateMs: NEXT_ANIMATE_MS } },
13
+ { key: "canvas", role: "image", name: "Canvas", id: "canvas", value: "0", bounds: [16, 180, 200, 100], route: "foreground", counts: true },
14
+ { key: "open", role: "button", name: "New window", id: "open", bounds: [92, 96, 104, 28], actions: ["AXPress"], press: { open: "another", after: NEW_WINDOW_MS } },
15
+ { key: "close", role: "button", name: "Close", id: "close", bounds: [208, 96, 80, 28], actions: ["AXPress"], press: { close: true } },
16
+ { key: "code", role: "textbox", name: "Code", value: "", id: "code", bounds: [228, 56, 76, 28], takesBack: TAKES_BACK_MS },
17
+ ];
18
+ /** The fixture's app, as the fake ui driver runs it. */
19
+ export const UI_FIXTURE = {
20
+ // A valid Android package name and macOS bundle id alike (no hyphen), in a window that fits a small phone's portrait.
21
+ id: "ai.agentrun.uifixture",
22
+ name: "UI fixture",
23
+ start: "home",
24
+ size: [320, 320],
25
+ screens: {
26
+ home: { title: "UI fixture", elements: home },
27
+ saved: { title: "UI fixture", elements: [...home, { key: "saved", role: "text", name: "Saved", bounds: [208, 136, 80, 28] }] },
28
+ second: {
29
+ title: "Second page",
30
+ elements: [
31
+ { key: "title2", role: "heading", name: "Second page", bounds: [16, 16, 300, 24] },
32
+ { key: "back", role: "button", name: "Back", id: "back", bounds: [16, 56, 80, 28], actions: ["AXPress"], press: { go: "home" } },
33
+ ],
34
+ },
35
+ another: {
36
+ title: "Another window",
37
+ elements: [
38
+ { key: "title3", role: "heading", name: "Another window", bounds: [16, 16, 300, 24] },
39
+ { key: "close", role: "button", name: "Close", id: "close", bounds: [16, 56, 80, 28], actions: ["AXPress"], press: { close: true } },
40
+ ],
41
+ },
42
+ },
43
+ };
@@ -0,0 +1,51 @@
1
+ import { type ComputerSpec, type CreateContext, type CreatedComputer, type ReadBackSpec } from "./provider.js";
2
+ import type { ComputerErrorCode, Result } from "./result.js";
3
+ /** How a provider refuses, in its own words and with its own vendor. */
4
+ export type Refuse = (code: ComputerErrorCode, message: string) => Result<never>;
5
+ /** The words of a request whose computer has ended (provider.md). */
6
+ export declare const endedWords: (name: string) => string;
7
+ /** The words of a request whose computer is another spec's. */
8
+ export declare const otherSpecWords: (name: string, seen: "is being made" | "was made", differ: string[]) => string;
9
+ /** How two label sets differ, in words: each key asked with another value or none, and each key have holds that was never asked. Empty when they match. */
10
+ export declare function labelsDiffer(asked: Record<string, string>, have: Record<string, string>, seen: string): string[];
11
+ /**
12
+ * How asked differs from have, the spec of another create of the same request, in words: every field but lifetimeMs
13
+ * (each create counts its own lifetime from its start), the labels exactly, and the user as the provider resolves it
14
+ * (userOf: an unset user is the provider's default). seen says where have is from: "in flight" for a create still
15
+ * running, "read back" for a computer whose vendor holds its whole spec (the fake's). Empty when they are the same.
16
+ */
17
+ export declare function specDiffer(asked: ComputerSpec, have: ComputerSpec, { userOf, seen }?: {
18
+ userOf?: (spec: ComputerSpec) => string | undefined;
19
+ seen?: string;
20
+ }): string[];
21
+ /**
22
+ * How asked differs from what the vendor reads back of its request's computer (attach's spec), in words, over the
23
+ * fields this provider reads back as they were asked: each one asked, or read back, with another value. A size the
24
+ * spec left out is the vendor's default, so it differs from none. Labels are the provider's to compare, by its own.
25
+ */
26
+ export declare function readBackDiffer(asked: ComputerSpec, have: ReadBackSpec, fields: ReadonlyArray<"image" | "network" | "user" | "cpus" | "memoryMb" | "pids">): string[];
27
+ export interface CreateOnce {
28
+ refuse: Refuse;
29
+ /** Why the provider does not serve the spec, in words, when it does not: refused once the request id is checked. */
30
+ refused?: string;
31
+ /** The user a spec's computer runs as, as the provider resolves it (its default for none): what specDiffer compares. */
32
+ userOf?(spec: ComputerSpec): string | undefined;
33
+ /** The provider's create by the request's name: it finds the computer a vendor holds under it, or makes one. */
34
+ make(name: string): Promise<Result<CreatedComputer>>;
35
+ }
36
+ export declare class CreateRequests {
37
+ #private;
38
+ /**
39
+ * Makes a computer once per request: a request id that is none is invalid; a create of a request already in flight
40
+ * waits for the first and answers what it does when it asks the same, and is refused exists when it asks another
41
+ * spec (specDiffer); a request whose computer this provider ended is refused exists; anything else is make's, under
42
+ * the name.
43
+ */
44
+ create(spec: ComputerSpec, context: CreateContext, { refuse, refused, userOf, make }: CreateOnce): Promise<Result<CreatedComputer>>;
45
+ /** A request's computer given up on or deleted: its name remembered, the oldest let go past ENDED_MAX. */
46
+ end(name: string): void;
47
+ /** A computer made under the name: its request is no longer ended. */
48
+ made(name: string): void;
49
+ /** Whether this provider ended the computer of the request with this name. */
50
+ ended(name: string): boolean;
51
+ }
@@ -0,0 +1,121 @@
1
+ // Idempotent create's in-process half (spec/computer/provider.md, Idempotent create), one per provider instance and the
2
+ // same for every provider: the request id checked, the computer's name from it (computerNameFor), a second create of a
3
+ // request still in flight sharing the first's answer, and the names of the computers this provider ended, refused as
4
+ // exists once the vendor forgets them. What a vendor can still show (a machine by that name, starting, up or stopped) is
5
+ // the provider's own to read, in the make it passes.
6
+ import { isDeepStrictEqual } from "node:util";
7
+ import { computerNameFor, requestIdProblem } from "./provider.js";
8
+ /** The most request names one provider remembers as ended, the oldest let go first: a bound, not a ledger. */
9
+ const ENDED_MAX = 4_096;
10
+ /** The words of a request whose computer has ended (provider.md). */
11
+ export const endedWords = (name) => `${name} was made for this request and has ended: create with a new request id`;
12
+ /** The words of a request whose computer is another spec's. */
13
+ export const otherSpecWords = (name, seen, differ) => `${name} ${seen} for this request with another spec, so it is not returned: ${differ.join("; ")}; create with a new request id`;
14
+ /** How two label sets differ, in words: each key asked with another value or none, and each key have holds that was never asked. Empty when they match. */
15
+ export function labelsDiffer(asked, have, seen) {
16
+ const differ = Object.entries(asked)
17
+ .filter(([key, value]) => have[key] !== value)
18
+ .map(([key, value]) => `label ${key}: asked ${JSON.stringify(value)}, ${seen} ${have[key] === undefined ? "nothing" : JSON.stringify(have[key])}`);
19
+ const unasked = Object.keys(have).filter((key) => !Object.hasOwn(asked, key));
20
+ if (unasked.length > 0)
21
+ differ.push(`labels ${unasked.join(", ")}: ${seen}, never asked for`);
22
+ return differ;
23
+ }
24
+ /**
25
+ * How asked differs from have, the spec of another create of the same request, in words: every field but lifetimeMs
26
+ * (each create counts its own lifetime from its start), the labels exactly, and the user as the provider resolves it
27
+ * (userOf: an unset user is the provider's default). seen says where have is from: "in flight" for a create still
28
+ * running, "read back" for a computer whose vendor holds its whole spec (the fake's). Empty when they are the same.
29
+ */
30
+ export function specDiffer(asked, have, { userOf = (spec) => spec.user, seen = "in flight" } = {}) {
31
+ const differ = labelsDiffer(asked.labels ?? {}, have.labels ?? {}, seen);
32
+ const fields = new Set([...Object.keys(asked), ...Object.keys(have)]);
33
+ for (const field of fields) {
34
+ if (field === "lifetimeMs" || field === "labels" || field === "user")
35
+ continue;
36
+ if (!isDeepStrictEqual(asked[field], have[field]))
37
+ differ.push(`${field}: asked ${show(asked[field])}, ${seen} ${show(have[field])}`);
38
+ }
39
+ const [user, held] = [userOf(asked), userOf(have)];
40
+ if (user !== held)
41
+ differ.push(`user: asked ${user ?? "the default"}, ${seen} ${held ?? "the default"}`);
42
+ return differ;
43
+ }
44
+ /**
45
+ * How asked differs from what the vendor reads back of its request's computer (attach's spec), in words, over the
46
+ * fields this provider reads back as they were asked: each one asked, or read back, with another value. A size the
47
+ * spec left out is the vendor's default, so it differs from none. Labels are the provider's to compare, by its own.
48
+ */
49
+ export function readBackDiffer(asked, have, fields) {
50
+ const sized = new Set(["cpus", "memoryMb", "pids"]);
51
+ return fields
52
+ .filter((field) => !(sized.has(field) && asked[field] === undefined) && !isDeepStrictEqual(asked[field], have[field]))
53
+ .map((field) => `${field}: asked ${show(asked[field])}, read back ${show(have[field])}`);
54
+ }
55
+ const show = (value) => (value === undefined ? "nothing" : JSON.stringify(value));
56
+ export class CreateRequests {
57
+ #creating = new Map();
58
+ #ended = new Set();
59
+ /**
60
+ * Makes a computer once per request: a request id that is none is invalid; a create of a request already in flight
61
+ * waits for the first and answers what it does when it asks the same, and is refused exists when it asks another
62
+ * spec (specDiffer); a request whose computer this provider ended is refused exists; anything else is make's, under
63
+ * the name.
64
+ */
65
+ async create(spec, context, { refuse, refused, userOf, make }) {
66
+ const problem = requestIdProblem(context?.requestId);
67
+ if (problem !== undefined)
68
+ return refuse("invalid", problem);
69
+ if (refused !== undefined)
70
+ return refuse("refused", refused);
71
+ const name = computerNameFor(context.requestId);
72
+ const inFlight = this.#creating.get(name);
73
+ if (inFlight !== undefined) {
74
+ const differs = specDiffer(spec, inFlight.spec, userOf === undefined ? {} : { userOf });
75
+ if (differs.length > 0)
76
+ return refuse("exists", otherSpecWords(name, "is being made", differs));
77
+ // The wait is this caller's to cut off by its own signal: aborted then, and the first create, and the computer
78
+ // it makes, go on untouched.
79
+ const signal = context.signal;
80
+ if (signal === undefined)
81
+ return inFlight.result;
82
+ const cut = () => refuse("aborted", `create was aborted while another create of this request made ${name}, which goes on`);
83
+ if (signal.aborted)
84
+ return cut();
85
+ return new Promise((resolve, reject) => {
86
+ const onAbort = () => resolve(cut());
87
+ signal.addEventListener("abort", onAbort, { once: true });
88
+ inFlight.result.then((result) => (signal.removeEventListener("abort", onAbort), resolve(result)), (error) => (signal.removeEventListener("abort", onAbort), reject(error)));
89
+ });
90
+ }
91
+ if (this.#ended.has(name))
92
+ return refuse("exists", endedWords(name));
93
+ const creating = { spec, result: make(name) };
94
+ this.#creating.set(name, creating);
95
+ try {
96
+ return await creating.result;
97
+ }
98
+ finally {
99
+ if (this.#creating.get(name) === creating)
100
+ this.#creating.delete(name);
101
+ }
102
+ }
103
+ /** A request's computer given up on or deleted: its name remembered, the oldest let go past ENDED_MAX. */
104
+ end(name) {
105
+ this.#ended.delete(name);
106
+ this.#ended.add(name);
107
+ for (const oldest of this.#ended) {
108
+ if (this.#ended.size <= ENDED_MAX)
109
+ break;
110
+ this.#ended.delete(oldest);
111
+ }
112
+ }
113
+ /** A computer made under the name: its request is no longer ended. */
114
+ made(name) {
115
+ this.#ended.delete(name);
116
+ }
117
+ /** Whether this provider ended the computer of the request with this name. */
118
+ ended(name) {
119
+ return this.#ended.has(name);
120
+ }
121
+ }
package/dist/daytona.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { KindCapabilities } from "./kinds.js";
2
2
  import { type MountKind } from "./mount.js";
3
3
  import { type ProviderNote } from "./mount-archil.js";
4
- import { type AttachedComputer, type CallContext, type ComputerCapabilities, type ComputerConnection, type ComputerInfo, type ComputerProvider, type ComputerRef, type ComputerSpec, type CreatedComputer, type NetworkPolicy, type NetworkSpec, type Refusal, type ReleaseHow } from "./provider.js";
4
+ import { type AttachedComputer, type CallContext, type ComputerCapabilities, type ComputerConnection, type ComputerInfo, type ComputerProvider, type ComputerRef, type ComputerSpec, type CreateContext, type CreatedComputer, type NetworkPolicy, type NetworkSpec, type Refusal, type ReleaseHow } from "./provider.js";
5
5
  import { type Result } from "./result.js";
6
6
  import { type ScreenWatch, type ScreenWatchHandlers, type WatchOptions } from "./screen-watch.js";
7
7
  /** The longest each kind of call may take, and the pauses between polls and retries. */
@@ -60,6 +60,18 @@ export interface DaytonaProviderOptions {
60
60
  sandboxClass?: "container" | "linux-vm";
61
61
  /** The Daytona target (region); default the organization's. */
62
62
  target?: string;
63
+ /**
64
+ * The egress gateway an Archil computer's archil client reaches Archil through, `<IPv4 gateway>:<mount lane>:<data
65
+ * lane>` such as 10.60.0.40:18100:42050 (parcha-proxy's archil-egress): for a target whose runners reach Archil only
66
+ * through it. Unset, the client reaches Archil as the sandbox's network allows, as before.
67
+ */
68
+ archilEgress?: string;
69
+ /**
70
+ * The snapshot GPU computers are made from: one of ours, box/Dockerfile built with a GPU (box/build-daytona.py --gpu
71
+ * H100 prints its name, agentrun-archil-gpu-h100-<hash>), whose user is root; its GPU is the one its name says.
72
+ * Default Daytona's own daytona-gpu. Either way a GPU computer takes no mount: Daytona's GPU host gives no /dev/fuse.
73
+ */
74
+ gpuSnapshot?: string;
63
75
  /**
64
76
  * Who the daemon runs as, uid:gid in numbers, never root. Default 2510:2510 (TOOL_USER), a uid no process of Daytona's
65
77
  * holds: init refuses to start while another process does.
@@ -123,7 +135,7 @@ export declare class DaytonaProvider implements ComputerProvider {
123
135
  #private;
124
136
  readonly id = "daytona";
125
137
  readonly version: string;
126
- constructor({ apiKey, onNote, apiUrl, daemonPath, arch, sandboxClass, target, daemonUser, autoStopMinutes, autoDeleteMinutes, fetch: fetcher, webSocket, timeouts, }: DaytonaProviderOptions);
138
+ constructor({ apiKey, onNote, apiUrl, daemonPath, arch, sandboxClass, target, archilEgress, gpuSnapshot, daemonUser, autoStopMinutes, autoDeleteMinutes, fetch: fetcher, webSocket, timeouts, }: DaytonaProviderOptions);
127
139
  /**
128
140
  * daemon child: Daytona's toolbox daemon is the sandbox's first process, and init is a command it runs in a session
129
141
  * (#prepare), so deleting that session ends init and leaves the sandbox. maxLifetimeMs is the 30 days check() has
@@ -133,9 +145,7 @@ export declare class DaytonaProvider implements ComputerProvider {
133
145
  */
134
146
  capabilities(): ComputerCapabilities;
135
147
  check(spec: ComputerSpec): Refusal[];
136
- create(spec: ComputerSpec, { signal }?: {
137
- signal?: AbortSignal;
138
- }): Promise<Result<CreatedComputer>>;
148
+ create(spec: ComputerSpec, context: CreateContext): Promise<Result<CreatedComputer>>;
139
149
  /** The live view: screen.watch on a connection of the watch's own (daemonWatch); a sandbox has no screen. */
140
150
  watch(ref: ComputerRef, handlers: ScreenWatchHandlers, options?: WatchOptions): Promise<Result<ScreenWatch>>;
141
151
  connect(ref: ComputerRef): Promise<Result<ComputerConnection>>;
package/dist/daytona.js CHANGED
@@ -1,4 +1,4 @@
1
- // The Daytona provisioner, over Daytona's v0 REST API with fetch (no SDK), as pi-transport's Daytona box does. The daemon
1
+ // The Daytona provisioner, over Daytona's v0 REST API with fetch (no SDK). The daemon
2
2
  // goes in through the toolbox's file upload and starts as a session command, dropped to a user with no capabilities;
3
3
  // connect() carries stdio over a session command's input calls and its log stream. Every Daytona fact used here is cited
4
4
  // in the README's Daytona section.
@@ -7,15 +7,15 @@ import { readFileSync } from "node:fs";
7
7
  import { resolve } from "node:path";
8
8
  import { PassThrough, Writable } from "node:stream";
9
9
  import { fileURLToPath } from "node:url";
10
- import { childCommands, daemonDrift, installerOf, shellCommand } from "./child.js";
10
+ import { childCommands, daemonDrift, installerOf, shellCommand } from "./hosted/scripts.js";
11
11
  import { OWN_NETWORK_ONLY, readOwnNetwork, TOOL_USER } from "./isolation.js";
12
12
  import { DaemonClient } from "./client.js";
13
- import { DAYTONA, DAYTONA_DEFAULT_SNAPSHOT, DAYTONA_GPU, DAYTONA_GPU_REGION, DAYTONA_GPU_SNAPSHOT, DAYTONA_GPU_SNAPSHOT_GPU } from "./descriptors/daytona.js";
13
+ import { DAYTONA, DAYTONA_DEFAULT_SNAPSHOT, DAYTONA_GPU_REGION, DAYTONA_GPU_SNAPSHOT, daytonaGpu, daytonaGpuSnapshot } from "./descriptors/daytona.js";
14
14
  import { COMPUTER_LABEL, DEADLINE_LABEL, helloDrift, WORK } from "./drift.js";
15
15
  import { releaseOlder } from "./janitor.js";
16
16
  import { epochOf, RUN_LABEL } from "./labels.js";
17
17
  import { checkMount, readBackOf } from "./mount.js";
18
- import { ARCHIL_MOUNT_LABEL, ARCHIL_TOOL_UID, archilLabels, archilMount, archilRefusals, archilRelease, mountDrift, readArchilMount, recordedMount, syncingClient, } from "./mount-archil.js";
18
+ import { ARCHIL_MOUNT_LABEL, ARCHIL_TOOL_UID, archilEgressOf, archilLabels, archilMount, archilRefusals, archilRelease, mountDrift, readArchilMount, recordedMount, syncingClient, } from "./mount-archil.js";
19
19
  import { MAX_LINE_BYTES } from "./protocol.js";
20
20
  import { checkGpu, checkTenure, runLifetimeMs, } from "./provider.js";
21
21
  import { errorOf, failFor, ok, vendorFail } from "./result.js";
@@ -29,13 +29,6 @@ const fail = failFor("daytona");
29
29
  * the toolbox, from a snapshot of box/Dockerfile, with the daemon user agentrun-tool (daemonUser "2510:2510").
30
30
  */
31
31
  export const MOUNT = DAYTONA.mounts;
32
- /** A copy of its descriptor's DAYTONA_GPU, so no caller can change the provider's own. */
33
- const daytonaGpuCapability = () => ({
34
- ...DAYTONA_GPU,
35
- types: [...DAYTONA_GPU.types],
36
- perGpu: { ...DAYTONA_GPU.perGpu },
37
- mounts: [],
38
- });
39
32
  /** The machine kind, groups and GPUs of its one configuration (its descriptor's): a linux computer, with GPUs when asked. */
40
33
  export const CAPABILITIES = DAYTONA.capabilities;
41
34
  /**
@@ -356,7 +349,7 @@ class Rest {
356
349
  signal: signal ? AbortSignal.any([signal, timeout]) : timeout,
357
350
  });
358
351
  const bytes = new Uint8Array(await response.arrayBuffer());
359
- if (response.ok || (init.anyStatus === true && response.status < 500 && response.status !== 429))
352
+ if (response.ok || response.status === init.answerStatus || (init.anyStatus === true && response.status < 500 && response.status !== 429))
360
353
  return ok({ status: response.status, bytes });
361
354
  const text = decoder.decode(bytes).replace(/\s+/g, " ").slice(0, 300);
362
355
  retryable = response.status === 429 || response.status >= 500;
@@ -394,11 +387,12 @@ class Rest {
394
387
  function sandboxDrift(spec, sb, expected) {
395
388
  const found = [];
396
389
  const mismatch = (field, declared, actual) => found.push(`${field}: declared ${show(declared)}, read back ${show(actual)}`);
397
- // A GPU computer is made from daytona-gpu, whatever image named it. Daytona's default snapshot is whichever it names: a
398
- // computer made from it is not held to a name.
390
+ // A GPU computer is made from the provider's GPU snapshot, whatever image named it. Daytona's default snapshot is
391
+ // whichever it names: a computer made from it is not held to a name.
392
+ const gpu = expected.gpu;
399
393
  if (spec.gpu !== undefined) {
400
- if (sb.snapshot !== DAYTONA_GPU_SNAPSHOT)
401
- mismatch("snapshot", DAYTONA_GPU_SNAPSHOT, sb.snapshot);
394
+ if (sb.snapshot !== gpu.snapshot)
395
+ mismatch("snapshot", gpu.snapshot, sb.snapshot);
402
396
  }
403
397
  else if (spec.image !== DAYTONA_DEFAULT_SNAPSHOT && sb.snapshot !== spec.image)
404
398
  mismatch("snapshot", spec.image, sb.snapshot);
@@ -430,12 +424,12 @@ function sandboxDrift(spec, sb, expected) {
430
424
  mismatch("public", false, sb.public);
431
425
  if (sb.kvm === true)
432
426
  mismatch("kvm", false, sb.kvm);
433
- // The GPUs read back, held to the snapshot's own (a create sends none): daytona-gpu's for a GPU computer, none else.
434
- const gpus = spec.gpu === undefined ? 0 : DAYTONA_GPU_SNAPSHOT_GPU.count;
427
+ // The GPUs read back, held to the GPU snapshot's own (a create sends none) for a GPU computer, none else.
428
+ const gpus = spec.gpu === undefined ? 0 : gpu.count;
435
429
  if ((sb.gpu ?? 0) !== gpus)
436
430
  mismatch("gpu", gpus, sb.gpu);
437
- if (spec.gpu !== undefined && sb.gpuType !== DAYTONA_GPU_SNAPSHOT_GPU.type)
438
- mismatch("gpuType", DAYTONA_GPU_SNAPSHOT_GPU.type, sb.gpuType);
431
+ if (spec.gpu !== undefined && sb.gpuType !== gpu.type)
432
+ mismatch("gpuType", gpu.type, sb.gpuType);
439
433
  if (Array.isArray(sb.volumes) ? sb.volumes.length > 0 : sb.volumes !== undefined && sb.volumes !== null)
440
434
  mismatch("volumes", [], sb.volumes);
441
435
  if (typeof sb.linkedSandboxId === "string" && sb.linkedSandboxId !== "")
@@ -537,6 +531,9 @@ export class DaytonaProvider {
537
531
  #arch;
538
532
  #class;
539
533
  #target;
534
+ #archilEgress;
535
+ /** The snapshot its GPU computers are made from, their GPU, and the mounts they take. */
536
+ #gpu;
540
537
  #uid;
541
538
  #gid;
542
539
  #webSocket;
@@ -544,7 +541,7 @@ export class DaytonaProvider {
544
541
  #autoStop;
545
542
  #autoDelete;
546
543
  #onNote;
547
- constructor({ apiKey, onNote, apiUrl = DEFAULT_API_URL, daemonPath, arch = "amd64", sandboxClass = "container", target, daemonUser = TOOL_USER, autoStopMinutes = 0, autoDeleteMinutes, fetch: fetcher, webSocket, timeouts, }) {
544
+ constructor({ apiKey, onNote, apiUrl = DEFAULT_API_URL, daemonPath, arch = "amd64", sandboxClass = "container", target, archilEgress, gpuSnapshot, daemonUser = TOOL_USER, autoStopMinutes = 0, autoDeleteMinutes, fetch: fetcher, webSocket, timeouts, }) {
548
545
  this.#onNote = onNote;
549
546
  if (typeof apiKey !== "string" || apiKey === "")
550
547
  throw new Error("a Daytona API key is required");
@@ -574,6 +571,8 @@ export class DaytonaProvider {
574
571
  this.#arch = arch;
575
572
  this.#class = sandboxClass;
576
573
  this.#target = target;
574
+ this.#archilEgress = archilEgress === undefined || archilEgress === "" ? undefined : archilEgressOf(archilEgress);
575
+ this.#gpu = daytonaGpuSnapshot(gpuSnapshot);
577
576
  [this.#uid, this.#gid] = [String(Number(user[1])), String(Number(user[2]))];
578
577
  this.#webSocket = webSocket ?? ((url, init) => new WebSocket(url, init));
579
578
  }
@@ -600,14 +599,14 @@ export class DaytonaProvider {
600
599
  mount: [...MOUNT],
601
600
  vendorAgentPorts: [TOOLBOX_PORT],
602
601
  // A GPU sandbox's limits are stated in gpu: its stop deletes it, it runs in region earth, its size is per GPU.
603
- gpu: daytonaGpuCapability(),
602
+ gpu: daytonaGpu(this.#gpu.snapshot === DAYTONA_GPU_SNAPSHOT ? undefined : this.#gpu.snapshot),
604
603
  };
605
604
  }
606
605
  check(spec) {
607
606
  const refusals = [];
608
607
  const refuse = (field, message) => refusals.push({ field, message });
609
608
  const given = (typeof spec === "object" && spec !== null ? spec : {});
610
- const { image, lifetimeMs, network, labels } = given;
609
+ const { image, network, labels } = given;
611
610
  if (typeof image !== "string" || image.trim() === "")
612
611
  refuse("image", `an image is required: the id or name of a Daytona snapshot, or "${DAYTONA_DEFAULT_SNAPSHOT}" for Daytona's default snapshot`);
613
612
  else if (/[\0-\x1f]/.test(image))
@@ -632,12 +631,13 @@ export class DaytonaProvider {
632
631
  refuse("mount", `an Archil mount's tools run as agentrun-tool, ${tool}:${tool}, and this provider's daemon user is ${this.#uid}:${this.#gid}: give it daemonUser "${tool}:${tool}"`);
633
632
  }
634
633
  }
635
- // The GPU is the snapshot's (a create sends none): daytona-gpu's type and count alone, and no mount (DAYTONA_GPU).
634
+ // The GPU is the GPU snapshot's (a create sends none): its type and count alone, and the mounts it takes.
636
635
  const gpuRefused = checkGpu(given.gpu, this.capabilities(), given.mount);
637
636
  refusals.push(...gpuRefused);
638
- // A GPU computer is made from daytona-gpu: a spec names it, or Daytona's default, never another snapshot.
639
- if (given.gpu !== undefined && gpuRefused.length === 0 && typeof image === "string" && image !== DAYTONA_DEFAULT_SNAPSHOT && image !== DAYTONA_GPU_SNAPSHOT) {
640
- refuse("image", `a Daytona GPU computer is made from Daytona's GPU snapshot ${DAYTONA_GPU_SNAPSHOT} alone, not ${JSON.stringify(image)}: give "${DAYTONA_GPU_SNAPSHOT}" or "${DAYTONA_DEFAULT_SNAPSHOT}"; no other snapshot is proven to give a GPU computer`);
637
+ // A GPU computer is made from the provider's GPU snapshot: a spec names it, or Daytona's default, never another.
638
+ const gpuSnapshot = this.#gpu.snapshot;
639
+ if (given.gpu !== undefined && gpuRefused.length === 0 && typeof image === "string" && image !== DAYTONA_DEFAULT_SNAPSHOT && image !== gpuSnapshot) {
640
+ refuse("image", `a Daytona GPU computer here is made from the GPU snapshot ${gpuSnapshot} alone, not ${JSON.stringify(image)}: give "${gpuSnapshot}" or "${DAYTONA_DEFAULT_SNAPSHOT}"; no other snapshot is proven to give a GPU computer`);
641
641
  }
642
642
  for (const [field, value] of Object.entries(given)) {
643
643
  if (SPEC_FIELDS.has(field) || value === undefined)
@@ -653,7 +653,8 @@ export class DaytonaProvider {
653
653
  }
654
654
  return refusals;
655
655
  }
656
- async create(spec, { signal } = {}) {
656
+ async create(spec, context) {
657
+ const signal = context?.signal;
657
658
  const refusals = this.check(spec);
658
659
  if (refusals.length > 0)
659
660
  return fail("refused", refusals.map(({ field, message }) => `${field}: ${message}`).join("; "));
@@ -672,9 +673,9 @@ export class DaytonaProvider {
672
673
  const archil = archilOf(spec);
673
674
  const body = {
674
675
  name,
675
- // A GPU sandbox is made from daytona-gpu (check() took "default" or that name). Otherwise "default" sends no
676
- // snapshot, and Daytona makes the sandbox from its default snapshot.
677
- ...(spec.gpu !== undefined ? { snapshot: DAYTONA_GPU_SNAPSHOT } : spec.image === DAYTONA_DEFAULT_SNAPSHOT ? {} : { snapshot: spec.image }),
676
+ // A GPU sandbox is made from the provider's GPU snapshot (check() took "default" or that name). Otherwise
677
+ // "default" sends no snapshot, and Daytona makes the sandbox from its default snapshot.
678
+ ...(spec.gpu !== undefined ? { snapshot: this.#gpu.snapshot } : spec.image === DAYTONA_DEFAULT_SNAPSHOT ? {} : { snapshot: spec.image }),
678
679
  // An Archil computer carries its mount as a label: kind and source, never the token.
679
680
  labels: { ...spec.labels, ...(archil ? archilLabels(archil) : {}), [COMPUTER_LABEL]: "1", [DEADLINE_LABEL]: deadline, [IMAGE_LABEL]: spec.image },
680
681
  env: {},
@@ -741,9 +742,7 @@ export class DaytonaProvider {
741
742
  if (!toolbox.ok)
742
743
  return toolbox;
743
744
  const staging = `${STAGING}${randomBytes(8).toString("hex")}`;
744
- const form = new FormData();
745
- form.append("file", new Blob([new Uint8Array(daemon)]), "computerd");
746
- const uploaded = await this.#rest.call("POST", `${toolbox.value}/files/upload-v2?${new URLSearchParams({ path: staging })}`, { form, retry: true, timeoutMs: this.#timeouts.uploadMs }, signal);
745
+ const uploaded = await this.#upload(toolbox.value, staging, daemon, signal);
747
746
  if (!uploaded.ok)
748
747
  return fail(uploaded.error.code, `the daemon's upload was refused: ${uploaded.error.message}`);
749
748
  // Init's flags are built here (childCommands): every remote computer, an Archil one included, starts init with
@@ -773,6 +772,7 @@ export class DaytonaProvider {
773
772
  self: ref,
774
773
  releaseOlder: () => releaseOlder(this, run, epoch, signal ? { signal } : {}),
775
774
  timeoutMs: this.#timeouts.execMs,
775
+ ...(this.#archilEgress ? { egress: this.#archilEgress } : {}),
776
776
  ...(signal ? { signal } : {}),
777
777
  });
778
778
  if (!mounted.ok)
@@ -870,7 +870,7 @@ export class DaytonaProvider {
870
870
  };
871
871
  }
872
872
  #sandboxExpected(deadline, gpu = false) {
873
- return { deadline, sandboxClass: this.#class, autoStopInterval: this.#autoStop, autoDeleteInterval: this.#autoDeleteFor(gpu) };
873
+ return { deadline, sandboxClass: this.#class, autoStopInterval: this.#autoStop, autoDeleteInterval: this.#autoDeleteFor(gpu), gpu: this.#gpu };
874
874
  }
875
875
  /** The autoDeleteInterval a sandbox is made and read back with: 0 for a GPU sandbox, which a stop deletes; else the option's. */
876
876
  #autoDeleteFor(gpu) {
@@ -904,7 +904,7 @@ export class DaytonaProvider {
904
904
  }
905
905
  }
906
906
  /**
907
- * Daytona's label listing trails a create (pi-transport measured 0.7 to 1.6 s, with flaps), and list() must show a
907
+ * Daytona's label listing trails a create (measured 0.7 to 1.6 s, with flaps), and list() must show a
908
908
  * computer once create returns: create waits until the listing has shown it, without a miss, for listedStableMs.
909
909
  */
910
910
  async #waitListed(id, signal) {
@@ -950,6 +950,26 @@ export class DaytonaProvider {
950
950
  return vendorFail("daytona", `the toolbox URL Daytona gave is not https (${url.protocol}), so the key is not sent to it`);
951
951
  return ok(`${url.href.replace(/\/+$/, "")}/${encodeURIComponent(sb.id)}`);
952
952
  }
953
+ /**
954
+ * A file's bytes to `path` in the sandbox: files/upload-v2, else files/upload. An older toolbox, as a self-hosted
955
+ * Daytona's runners may run (the open daemon's routes, daytonaio/daytona@b5a5d9e7 apps/daemon/pkg/toolbox/server.go),
956
+ * has no files/upload-v2 and answers it 404; its files/upload takes the same form (a path query, the bytes as
957
+ * "file"). A 404 alone moves to the older route, so a refusal of any other kind is never sent twice.
958
+ */
959
+ async #upload(toolbox, path, bytes, signal) {
960
+ const query = new URLSearchParams({ path });
961
+ const send = (route, answerStatus) => {
962
+ const form = new FormData();
963
+ form.append("file", new Blob([new Uint8Array(bytes)]), "computerd");
964
+ return this.#rest.call("POST", `${toolbox}/${route}?${query}`, { form, retry: true, timeoutMs: this.#timeouts.uploadMs, ...(answerStatus === undefined ? {} : { answerStatus }) }, signal);
965
+ };
966
+ const current = await send("files/upload-v2", 404);
967
+ if (!current.ok || current.value.status !== 404)
968
+ return current;
969
+ const missing = `POST ${new URL(`${toolbox}/files/upload-v2`).pathname}: 404 ${decoder.decode(current.value.bytes).replace(/\s+/g, " ").trim().slice(0, 300)}`;
970
+ const older = await send("files/upload");
971
+ return older.ok ? older : fail(older.error.code, `${missing}, then ${older.error.message}`);
972
+ }
953
973
  async #execute(toolbox, command, signal) {
954
974
  const seconds = Math.ceil(this.#timeouts.execMs / 1000);
955
975
  const ran = await this.#rest.json("POST", `${toolbox}/process/execute`, { json: { command, timeout: seconds }, timeoutMs: this.#timeouts.execMs + 15_000 }, signal);
@@ -1204,7 +1224,7 @@ export class DaytonaProvider {
1204
1224
  },
1205
1225
  });
1206
1226
  }
1207
- /** Every sandbox with this provider's label, all pages: one label query, the way pi-transport asks. */
1227
+ /** Every sandbox with this provider's label, all pages: one label query. */
1208
1228
  async #listOwn(signal) {
1209
1229
  const found = [];
1210
1230
  const seen = new Set();
@@ -1519,7 +1539,7 @@ export class DaytonaProvider {
1519
1539
  return "failed" in waited.value ? waited.value.failed : ok(undefined);
1520
1540
  }
1521
1541
  /**
1522
- * Deletes a sandbox and makes sure it is going, as pi-transport does: a DELETE that fails counts as done only when the
1542
+ * Deletes a sandbox and makes sure it is going: a DELETE that fails counts as done only when the
1523
1543
  * sandbox is gone or being destroyed; a forced stop comes before the last attempt. Never signalled: a delete that
1524
1544
  * cleans up after an abort must outlive it.
1525
1545
  */