@parcha/agentrun-computer 0.1.0-beta.36 → 0.1.0-beta.38

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 (155) hide show
  1. package/NOTICE +2 -0
  2. package/README.md +547 -478
  3. package/box/Dockerfile +18 -1
  4. package/box/README.md +13 -0
  5. package/box/build-agent37.mjs +158 -0
  6. package/box/build-daytona.py +2 -2
  7. package/box/build-e2b.mjs +41 -18
  8. package/box/recipe.mjs +43 -0
  9. package/dist/agent37-ssh.d.ts +89 -0
  10. package/dist/agent37-ssh.js +445 -0
  11. package/dist/agent37.d.ts +104 -0
  12. package/dist/agent37.js +402 -0
  13. package/dist/attach.d.ts +146 -0
  14. package/dist/attach.js +469 -0
  15. package/dist/browserbase.d.ts +2 -10
  16. package/dist/browserbase.js +3 -6
  17. package/dist/client.d.ts +45 -4
  18. package/dist/client.js +92 -4
  19. package/dist/computerd-linux-amd64 +0 -0
  20. package/dist/computerd-linux-arm64 +0 -0
  21. package/dist/computerd.json +4 -0
  22. package/dist/conformance/agent37.d.ts +96 -0
  23. package/dist/conformance/agent37.js +154 -0
  24. package/dist/conformance/cases/apps.d.ts +11 -0
  25. package/dist/conformance/cases/apps.js +173 -73
  26. package/dist/conformance/cases/health.js +14 -0
  27. package/dist/conformance/cases/index.js +2 -0
  28. package/dist/conformance/cases/isolation.d.ts +7 -5
  29. package/dist/conformance/cases/isolation.js +44 -14
  30. package/dist/conformance/cases/mount.js +1 -1
  31. package/dist/conformance/cases/provider.js +27 -1
  32. package/dist/conformance/cases/screen.d.ts +3 -0
  33. package/dist/conformance/cases/screen.js +18 -0
  34. package/dist/conformance/cases/settings.d.ts +29 -23
  35. package/dist/conformance/cases/settings.js +76 -58
  36. package/dist/conformance/cases/touch.js +19 -17
  37. package/dist/conformance/cases/ui.d.ts +2 -0
  38. package/dist/conformance/cases/ui.js +475 -0
  39. package/dist/conformance/cli.d.ts +9 -0
  40. package/dist/conformance/cli.js +94 -9
  41. package/dist/conformance/daytona.d.ts +9 -20
  42. package/dist/conformance/daytona.js +12 -21
  43. package/dist/conformance/e2b.d.ts +6 -0
  44. package/dist/conformance/e2b.js +9 -2
  45. package/dist/conformance/exec-stream.d.ts +45 -0
  46. package/dist/conformance/exec-stream.js +486 -0
  47. package/dist/conformance/fixture.d.ts +1 -1
  48. package/dist/conformance/fixture.js +25 -1
  49. package/dist/conformance/modal.d.ts +17 -13
  50. package/dist/conformance/modal.js +18 -9
  51. package/dist/conformance/orgo.d.ts +3 -3
  52. package/dist/conformance/orgo.js +6 -8
  53. package/dist/conformance/phone-harness.d.ts +6 -2
  54. package/dist/conformance/phone-harness.js +21 -4
  55. package/dist/conformance/report.js +1 -1
  56. package/dist/conformance/runner.js +23 -4
  57. package/dist/conformance/sweep.d.ts +50 -0
  58. package/dist/conformance/sweep.js +187 -0
  59. package/dist/conformance/types.d.ts +13 -5
  60. package/dist/conformance/ui-fixture.d.ts +56 -0
  61. package/dist/conformance/ui-fixture.js +43 -0
  62. package/dist/create-requests.d.ts +51 -0
  63. package/dist/create-requests.js +121 -0
  64. package/dist/daytona.d.ts +20 -133
  65. package/dist/daytona.js +405 -1449
  66. package/dist/descriptor.d.ts +11 -1
  67. package/dist/descriptor.js +9 -0
  68. package/dist/descriptors/agent37.d.ts +41 -0
  69. package/dist/descriptors/agent37.js +28 -0
  70. package/dist/descriptors/daytona.d.ts +6 -5
  71. package/dist/descriptors/daytona.js +9 -5
  72. package/dist/descriptors/index.d.ts +42 -7
  73. package/dist/descriptors/index.js +4 -2
  74. package/dist/descriptors/orgo.d.ts +2 -1
  75. package/dist/descriptors/orgo.js +3 -2
  76. package/dist/descriptors/phone-harness.d.ts +1 -1
  77. package/dist/descriptors/phone-harness.js +2 -2
  78. package/dist/descriptors/shared.d.ts +1 -1
  79. package/dist/descriptors/shared.js +2 -2
  80. package/dist/desktop.d.ts +18 -4
  81. package/dist/desktop.js +89 -9
  82. package/dist/docker.d.ts +7 -10
  83. package/dist/docker.js +272 -34
  84. package/dist/drift.js +4 -4
  85. package/dist/e2b.d.ts +16 -290
  86. package/dist/e2b.js +230 -1393
  87. package/dist/fake-ui-driver.d.ts +97 -0
  88. package/dist/fake-ui-driver.js +717 -0
  89. package/dist/host.d.ts +201 -0
  90. package/dist/host.js +8 -0
  91. package/dist/hosted/process.d.ts +81 -0
  92. package/dist/hosted/process.js +259 -0
  93. package/dist/hosted/provider.d.ts +160 -0
  94. package/dist/hosted/provider.js +1415 -0
  95. package/dist/hosted/rest.d.ts +66 -0
  96. package/dist/hosted/rest.js +121 -0
  97. package/dist/hosted/scripts.d.ts +82 -0
  98. package/dist/{child.js → hosted/scripts.js} +118 -12
  99. package/dist/hosted/values.d.ts +5 -0
  100. package/dist/hosted/values.js +8 -0
  101. package/dist/index.d.ts +7 -3
  102. package/dist/index.js +7 -4
  103. package/dist/kernel.d.ts +2 -10
  104. package/dist/kernel.js +3 -6
  105. package/dist/kinds.d.ts +11 -2
  106. package/dist/kinds.js +20 -4
  107. package/dist/local-chrome.d.ts +2 -10
  108. package/dist/local-chrome.js +3 -6
  109. package/dist/modal.d.ts +22 -257
  110. package/dist/modal.js +183 -1280
  111. package/dist/mount-archil.d.ts +8 -4
  112. package/dist/mount-archil.js +22 -11
  113. package/dist/mount.d.ts +10 -4
  114. package/dist/mount.js +8 -4
  115. package/dist/orgo-channel.d.ts +3 -2
  116. package/dist/orgo-channel.js +5 -2
  117. package/dist/orgo-desktop.d.ts +9 -4
  118. package/dist/orgo-desktop.js +33 -13
  119. package/dist/orgo-workspaces.d.ts +47 -0
  120. package/dist/orgo-workspaces.js +94 -0
  121. package/dist/orgo.d.ts +10 -13
  122. package/dist/orgo.js +32 -21
  123. package/dist/phone-harness.d.ts +31 -28
  124. package/dist/phone-harness.js +510 -702
  125. package/dist/png.d.ts +4 -0
  126. package/dist/png.js +27 -0
  127. package/dist/protocol.d.ts +339 -33
  128. package/dist/protocol.js +97 -3
  129. package/dist/provider.d.ts +36 -8
  130. package/dist/provider.js +16 -0
  131. package/dist/providers.d.ts +11 -12
  132. package/dist/result.d.ts +1 -1
  133. package/dist/screen-watch.js +34 -6
  134. package/dist/surface/api.d.ts +260 -0
  135. package/dist/surface/api.js +1 -0
  136. package/dist/surface/core.d.ts +55 -0
  137. package/dist/surface/core.js +475 -0
  138. package/dist/surface/index.d.ts +5 -0
  139. package/dist/surface/index.js +3 -0
  140. package/dist/surface/outline.d.ts +10 -0
  141. package/dist/surface/outline.js +51 -0
  142. package/dist/surface/script.d.ts +10 -0
  143. package/dist/surface/script.js +94 -0
  144. package/dist/ui-engine.d.ts +114 -0
  145. package/dist/ui-engine.js +814 -0
  146. package/package.json +18 -3
  147. package/dist/child.d.ts +0 -42
  148. package/dist/conformance/daytona-sweep.d.ts +0 -18
  149. package/dist/conformance/daytona-sweep.js +0 -126
  150. package/dist/conformance/e2b-diagnose.d.ts +0 -16
  151. package/dist/conformance/e2b-diagnose.js +0 -61
  152. package/dist/conformance/e2b-sweep.d.ts +0 -18
  153. package/dist/conformance/e2b-sweep.js +0 -132
  154. package/dist/conformance/modal-sweep.d.ts +0 -22
  155. package/dist/conformance/modal-sweep.js +0 -213
@@ -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" | "gpu">): 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,37 +1,5 @@
1
- import type { KindCapabilities } from "./kinds.js";
2
- import { type MountKind } from "./mount.js";
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";
5
- import { type Result } from "./result.js";
6
- import { type ScreenWatch, type ScreenWatchHandlers, type WatchOptions } from "./screen-watch.js";
7
- /** The longest each kind of call may take, and the pauses between polls and retries. */
8
- export interface DaytonaTimeouts {
9
- /** One control-plane or toolbox call. */
10
- requestMs: number;
11
- /** POST /sandbox. */
12
- createMs: number;
13
- /** From the create's answer to a started sandbox. */
14
- startMs: number;
15
- /** One DELETE. */
16
- deleteMs: number;
17
- /** From the delete's answer to a sandbox Daytona reads as gone (404) and no longer lists. */
18
- goneMs: number;
19
- /** From the stop's answer to a sandbox Daytona reads, and lists, as stopped (or gone, when a stop deletes). */
20
- stopMs: number;
21
- /** The daemon's upload. */
22
- uploadMs: number;
23
- /** The install script. */
24
- execMs: number;
25
- /** From a connect's start to the daemon's hello, and each read-back call after it. */
26
- helloMs: number;
27
- pollMs: number;
28
- /** The first pause before a retry; each next one doubles. */
29
- retryMs: number;
30
- /** How long create waits for the listing to show the new computer steadily, and for how long it must. */
31
- listedMs: number;
32
- listedStableMs: number;
33
- }
34
- /** The parts of a WebSocket the provider uses: Node's global WebSocket, or a fake in tests. */
1
+ import { HostedProvider, type HostedOptions, type HostedTimeouts } from "./hosted/provider.js";
2
+ /** The parts of a WebSocket the host uses: Node's global WebSocket, or a stand-in in tests. */
35
3
  export interface WebSocketLike {
36
4
  binaryType: string;
37
5
  addEventListener(type: "open" | "message" | "close" | "error", listener: (event: {
@@ -45,38 +13,28 @@ export type WebSocketFactory = (url: string, init: {
45
13
  headers: Record<string, string>;
46
14
  protocols: string[];
47
15
  }) => WebSocketLike;
48
- export interface DaytonaProviderOptions {
16
+ /** The adapter's bounds, and Daytona's own: the first pause before a retried request (each next one doubles). */
17
+ export type DaytonaTimeouts = HostedTimeouts & {
18
+ retryMs: number;
19
+ };
20
+ /** The Daytona provider's options: the key and Daytona's own settings, then the shared adapter's (HostedOptions). */
21
+ export interface DaytonaProviderOptions extends Omit<HostedOptions, "kind" | "desktop" | "maxLifetimeMs" | "timeouts" | "archilEgress"> {
49
22
  /** The Daytona API key. The caller passes it; this provider never reads the environment and never puts it in a computer. */
50
23
  apiKey: string;
51
- /** Told what is no failure of the call it came from: a release that did not let an Archil folder go cleanly. */
52
- onNote?: ProviderNote;
53
24
  /** Default https://app.daytona.io/api. */
54
25
  apiUrl?: string;
55
- /** The daemon binary on this machine, for the sandboxes' architecture (dist/computerd-linux-<arch>). */
56
- daemonPath: string;
57
26
  /** Go's name for the sandboxes' architecture, which hello must report. Default amd64. */
58
- arch?: string;
27
+ arch?: "amd64" | "arm64";
59
28
  /** The class the snapshots this provider is given make: container (default) or linux-vm. */
60
29
  sandboxClass?: "container" | "linux-vm";
61
30
  /** The Daytona target (region); default the organization's. */
62
31
  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
32
  /**
70
33
  * The snapshot GPU computers are made from: one of ours, box/Dockerfile built with a GPU (box/build-daytona.py --gpu
71
34
  * H100 prints its name, agentrun-archil-gpu-h100-<hash>), whose user is root; its GPU is the one its name says.
72
35
  * Default Daytona's own daytona-gpu. Either way a GPU computer takes no mount: Daytona's GPU host gives no /dev/fuse.
73
36
  */
74
37
  gpuSnapshot?: string;
75
- /**
76
- * Who the daemon runs as, uid:gid in numbers, never root. Default 2510:2510 (TOOL_USER), a uid no process of Daytona's
77
- * holds: init refuses to start while another process does.
78
- */
79
- daemonUser?: string;
80
38
  /**
81
39
  * Daytona's autoStopInterval: minutes without outside activity after which Daytona stops the sandbox, whatever runs in
82
40
  * it; 0 (default) is never. A whole number, 0 or more.
@@ -92,99 +50,28 @@ export interface DaytonaProviderOptions {
92
50
  fetch?: typeof fetch;
93
51
  /** For tests: every log stream opens through it. Default Node's global WebSocket. */
94
52
  webSocket?: WebSocketFactory;
53
+ /** For tests: the pause before a request is tried again, given its ms and the call's signal. Default a timer. */
54
+ pause?: (ms: number, signal?: AbortSignal) => Promise<void>;
95
55
  timeouts?: Partial<DaytonaTimeouts>;
96
56
  }
97
- /**
98
- * The mount kinds a Daytona computer takes: an Archil mount of the run's folder (mount-archil.ts), made as root through
99
- * the toolbox, from a snapshot of box/Dockerfile, with the daemon user agentrun-tool (daemonUser "2510:2510").
100
- */
101
- export declare const MOUNT: readonly MountKind[];
102
- /** The machine kind, groups and GPUs of its one configuration (its descriptor's): a linux computer, with GPUs when asked. */
103
- export declare const CAPABILITIES: readonly KindCapabilities[];
104
- /** What create() takes: the provider's options, the daemon optional (default this package's build for the arch). */
105
- export type DaytonaCreateOptions = Omit<DaytonaProviderOptions, "daemonPath"> & {
106
- daemonPath?: string;
107
- };
108
57
  /**
109
58
  * A DaytonaProvider from its options alone; it reads no environment, so the key, the API URL (default Daytona's own) and
110
59
  * the target are the caller's: serve passes its DAYTONA_API_KEY, DAYTONA_API_URL and DAYTONA_TARGET, the conformance
111
60
  * module the settings it reads. Throws in words when an option is missing or wrong, never echoing the key.
112
61
  */
113
- export declare function create(options: DaytonaCreateOptions): DaytonaProvider;
62
+ export declare function create(options: DaytonaProviderOptions): DaytonaProvider;
114
63
  /** The conformance CLI's module for Daytona: the run's idle stop and auto-delete, its snapshot, notes and drifted twin. */
115
64
  export declare const conformance: () => Promise<typeof import("./conformance/daytona.js")>;
116
65
  /**
117
- * The three commands the provider sends into a sandbox, exactly: install (through /process/execute), init and stdio
118
- * (each a session command), the child daemon's commands (childCommands). Exported so a test can run them where Daytona
119
- * would, in a root container.
66
+ * Daytona's own path sockets outside /run: its D-Bus session bus, /tmp/dbus-<10 characters> (the live baseline's
67
+ * isolation.vendor-agent connected to /tmp/dbus-Y8OW6E3FDx as the tool user). Create closes them to the tool user.
120
68
  */
121
- export declare function daytonaCommands({ staging, deadline, user }?: {
122
- staging?: string;
123
- deadline?: string;
124
- user?: string;
125
- }): {
126
- install: string;
127
- init: string;
128
- stdio: string;
129
- };
69
+ export declare const DAYTONA_SOCKETS: readonly string[];
130
70
  /**
131
- * Computers that are Daytona sandboxes. A spec's image is a Daytona snapshot (its id or name), which gives the class and
132
- * the size. See the README's Daytona section for every call, and its citation.
71
+ * Computers that are Daytona sandboxes, on the shared adapter. A spec's image is a Daytona snapshot (its id or name),
72
+ * which gives the class and the size; "default" is Daytona's default snapshot. See the README's Daytona section for
73
+ * every call, and its citation.
133
74
  */
134
- export declare class DaytonaProvider implements ComputerProvider {
135
- #private;
136
- readonly id = "daytona";
137
- readonly version: string;
138
- constructor({ apiKey, onNote, apiUrl, daemonPath, arch, sandboxClass, target, archilEgress, gpuSnapshot, daemonUser, autoStopMinutes, autoDeleteMinutes, fetch: fetcher, webSocket, timeouts, }: DaytonaProviderOptions);
139
- /**
140
- * daemon child: Daytona's toolbox daemon is the sandbox's first process, and init is a command it runs in a session
141
- * (#prepare), so deleting that session ends init and leaves the sandbox. maxLifetimeMs is the 30 days check() has
142
- * always given; Daytona's TTL is in whole minutes and documents no cap of its own. The toolbox listens on 2280 on
143
- * every interface and runs commands for whoever reaches it, so init starts with --own-network, and network none is
144
- * all a computer takes until a proxy carries open and allowlists out of the daemon's own network.
145
- */
146
- capabilities(): ComputerCapabilities;
147
- check(spec: ComputerSpec): Refusal[];
148
- create(spec: ComputerSpec, { signal }?: {
149
- signal?: AbortSignal;
150
- }): Promise<Result<CreatedComputer>>;
151
- /** The live view: screen.watch on a connection of the watch's own (daemonWatch); a sandbox has no screen. */
152
- watch(ref: ComputerRef, handlers: ScreenWatchHandlers, options?: WatchOptions): Promise<Result<ScreenWatch>>;
153
- connect(ref: ComputerRef): Promise<Result<ComputerConnection>>;
154
- attach(ref: {
155
- id: string;
156
- } | {
157
- labels: Record<string, string>;
158
- }, { signal }?: CallContext): Promise<Result<AttachedComputer>>;
159
- /**
160
- * For the sweep after a live run: every sandbox Daytona lists with agentrun.computer=1, whatever its name or state, as
161
- * Daytona reports it, with its labels (the sweep deletes only a conformance run's). list() keeps only this provider's
162
- * computers; this keeps everything the label query returns.
163
- */
164
- listLabelled({ signal }?: CallContext): Promise<Result<Array<{
165
- id: string;
166
- name?: string;
167
- state?: string;
168
- labels: Record<string, string>;
169
- }>>>;
170
- /** For the sweep: GET /sandbox/{id} once, retried as every read is, and the status Daytona answered (404: none). */
171
- probe(id: string, { signal }?: CallContext): Promise<Result<{
172
- status: number;
173
- state?: string;
174
- }>>;
175
- /**
176
- * Settings' test: one page of the account's sandboxes by the provider's own label, which makes nothing. The count is
177
- * read from the listing, with no read of each sandbox: a busy account answers as fast, and one sandbox's read never
178
- * fails a working key. A further page is "or more".
179
- */
180
- testConnection({ signal }?: CallContext): Promise<Result<{
181
- detail: string;
182
- }>>;
183
- list(labels: Record<string, string>, { signal }?: CallContext): Promise<Result<ComputerInfo[]>>;
184
- network(ref: ComputerRef, policy?: NetworkSpec, { signal }?: CallContext): Promise<Result<NetworkPolicy>>;
185
- /**
186
- * Daytona answers a delete or a stop before the sandbox is gone or stopped, and its listing trails both: release
187
- * returns once Daytona reads the computer as release left it, or fails naming the last state it read.
188
- */
189
- release(ref: ComputerRef, how: ReleaseHow, { signal }?: CallContext): Promise<Result<void>>;
75
+ export declare class DaytonaProvider extends HostedProvider {
76
+ constructor(options: DaytonaProviderOptions);
190
77
  }