@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
@@ -1,5 +1,5 @@
1
1
  import type { ComputerSettingKind, KindCapabilities } from "./kinds.js";
2
- import type { MountKind } from "./mount.js";
2
+ import type { MountKind, Unmounted } from "./mount.js";
3
3
  import type { NetworkForm } from "./provider.js";
4
4
  import type { ProviderModule } from "./providers.js";
5
5
  /** One key a provider takes in Settings: its serve-side name, the create() option it fills, and whether it is needed. */
@@ -9,6 +9,11 @@ export interface DescriptorKey {
9
9
  /** The create() option it fills (apiKey). */
10
10
  readonly option: string;
11
11
  readonly required: boolean;
12
+ /**
13
+ * A person picks its value from the vendor's own list rather than typing it (Orgo's workspace, by name): Settings
14
+ * offers what the built provider's keyChoices(option) reads with the other keys. Absent: typed.
15
+ */
16
+ readonly picked?: boolean;
12
17
  }
13
18
  /** A setting that is no key but fills a create() option, with the value used when the server names none. */
14
19
  export interface DescriptorSetting {
@@ -55,6 +60,11 @@ export interface ProviderDescriptor<Module extends ProviderModule = ProviderModu
55
60
  readonly metered: boolean;
56
61
  /** The mount kinds its computers take, as its providers' capabilities().mount declare them; [] for none. */
57
62
  readonly mounts: readonly MountKind[];
63
+ /**
64
+ * Mount kinds its computers don't take though a caller would ask for them, each with why in one sentence: check()
65
+ * refuses such a mount in these words, and serve says them where the run's folder can't be had (Daytona's archil).
66
+ */
67
+ readonly unmounted?: Unmounted;
58
68
  /**
59
69
  * The network forms its computers make, as its providers' capabilities().network declare them: ["none"], a remote
60
70
  * computer whose programs run in a network of their own; ["open"], the vendor's own network, which no allowlist of
@@ -26,6 +26,13 @@ export function descriptorProblems(value) {
26
26
  problems.push("load is not a function that imports the provider module");
27
27
  if (!Array.isArray(d.mounts) || d.mounts.some((kind) => kind !== "bind" && kind !== "archil"))
28
28
  problems.push("mounts is not a list of mount kinds (bind, archil)");
29
+ if (d.unmounted !== undefined) {
30
+ const entries = typeof d.unmounted === "object" && d.unmounted !== null && !Array.isArray(d.unmounted) ? Object.entries(d.unmounted) : undefined;
31
+ if (entries === undefined || entries.some(([kind, why]) => (kind !== "bind" && kind !== "archil") || typeof why !== "string" || why.trim() === ""))
32
+ problems.push("unmounted maps mount kinds (bind, archil) to why, in words");
33
+ else if (Array.isArray(d.mounts) && entries.some(([kind]) => d.mounts?.includes(kind)))
34
+ problems.push("unmounted names a mount kind that mounts declares");
35
+ }
29
36
  if (!Array.isArray(d.network) || d.network.length === 0 || d.network.some((form) => form !== "none" && form !== "open" && form !== "allow"))
30
37
  problems.push("network is not a list of the network forms its computers make (none, open, allow)");
31
38
  if (!Array.isArray(d.capabilities) || d.capabilities.length === 0)
@@ -67,6 +74,8 @@ export function descriptorProblems(value) {
67
74
  named(d.settings, "settings");
68
75
  if (Array.isArray(d.keys) && d.keys.some((key) => typeof key?.required !== "boolean"))
69
76
  problems.push("each key says whether it is required");
77
+ if (Array.isArray(d.keys) && d.keys.some((key) => key?.picked !== undefined && typeof key.picked !== "boolean"))
78
+ problems.push("a key's picked is true or false");
70
79
  if (d.ledger !== undefined && (typeof d.ledger?.option !== "string" || d.ledger.option === ""))
71
80
  problems.push("ledger names the option it fills");
72
81
  if (d.imageEnv !== undefined && (typeof d.imageEnv !== "string" || !/^[A-Z][A-Z0-9_]*$/.test(d.imageEnv)))
@@ -0,0 +1,41 @@
1
+ /** Agent37's plain Linux template: a sandbox when its setting names no image. */
2
+ export declare const AGENT37_BASE_TEMPLATE = "agent37-base";
3
+ /**
4
+ * Our box image (box/Dockerfile, its desktop included) as a template of the key's own workspace, which box/build-agent37.mjs builds
5
+ * and publishes under this one name: a desktop when its setting names no image.
6
+ */
7
+ export declare const AGENT37_BOX_TEMPLATE = "agentrun-box";
8
+ export declare const AGENT37: {
9
+ readonly id: "agent37";
10
+ readonly label: "Agent37";
11
+ readonly keys: readonly [{
12
+ readonly name: "AGENT37_API_KEY";
13
+ readonly option: "apiKey";
14
+ readonly required: true;
15
+ }, {
16
+ readonly name: "AGENT37_SSH_KEY";
17
+ readonly option: "sshKey";
18
+ readonly required: true;
19
+ }];
20
+ readonly metered: true;
21
+ readonly mounts: readonly ["archil"];
22
+ readonly network: readonly ["none"];
23
+ readonly capabilities: readonly [import("../kinds.js").KindCapabilities, {
24
+ readonly options: {
25
+ readonly kind: "desktop";
26
+ };
27
+ readonly kind: import("../protocol.js").ComputerKind;
28
+ readonly groups: import("../protocol.js").Group[];
29
+ readonly gpu?: import("../provider.js").GpuCapability;
30
+ readonly persistence?: {
31
+ keepsState: true;
32
+ resume: boolean;
33
+ };
34
+ readonly image?: string;
35
+ }];
36
+ readonly defaultImage: {
37
+ readonly sandbox: "agent37-base";
38
+ readonly desktop: "agentrun-box";
39
+ };
40
+ readonly load: () => Promise<typeof import("../agent37.js")>;
41
+ };
@@ -0,0 +1,28 @@
1
+ // Agent37's descriptor: a Linux sandbox or a Linux desktop on an Agent37 instance (a VM by default), the run's folder on
2
+ // an Archil disk. The desktop starts from our box image built as a workspace template (box/build-agent37.mjs).
3
+ import { defineProvider } from "../descriptor.js";
4
+ import { LINUX_DESKTOP, SANDBOX } from "./shared.js";
5
+ /** Agent37's plain Linux template: a sandbox when its setting names no image. */
6
+ export const AGENT37_BASE_TEMPLATE = "agent37-base";
7
+ /**
8
+ * Our box image (box/Dockerfile, its desktop included) as a template of the key's own workspace, which box/build-agent37.mjs builds
9
+ * and publishes under this one name: a desktop when its setting names no image.
10
+ */
11
+ export const AGENT37_BOX_TEMPLATE = "agentrun-box";
12
+ export const AGENT37 = defineProvider({
13
+ id: "agent37",
14
+ label: "Agent37",
15
+ keys: [
16
+ { name: "AGENT37_API_KEY", option: "apiKey", required: true },
17
+ // The private half of the SSH key registered on the workspace: every command reaches the machine over SSH.
18
+ { name: "AGENT37_SSH_KEY", option: "sshKey", required: true },
19
+ ],
20
+ metered: true,
21
+ mounts: ["archil"],
22
+ // None: its programs run in a network of their own (isolation.ts OWN_NETWORK_ONLY).
23
+ network: ["none"],
24
+ // Each configuration built by its own create() options: kind linux is the provider's default.
25
+ capabilities: [SANDBOX, { ...LINUX_DESKTOP, options: { kind: "desktop" } }],
26
+ defaultImage: { sandbox: AGENT37_BASE_TEMPLATE, desktop: AGENT37_BOX_TEMPLATE },
27
+ load: () => import("../agent37.js"),
28
+ });
@@ -1,4 +1,6 @@
1
1
  import type { GpuCapability } from "../provider.js";
2
+ /** Why a Daytona computer takes no Archil mount: check() refuses one in these words. */
3
+ export declare const DAYTONA_NO_ARCHIL = "Archil mounts don't work on Daytona yet: Archil's client hangs on its sandboxes";
2
4
  /** The image a Daytona computer starts from when its spec names "default": Daytona's own default snapshot. */
3
5
  export declare const DAYTONA_DEFAULT_SNAPSHOT = "default";
4
6
  /** The one region Daytona runs a GPU sandbox in, whatever the provider's target. */
@@ -56,13 +58,12 @@ export declare const DAYTONA: {
56
58
  readonly name: "DAYTONA_TARGET";
57
59
  readonly option: "target";
58
60
  readonly required: false;
59
- }, {
60
- readonly name: "DAYTONA_ARCHIL_EGRESS";
61
- readonly option: "archilEgress";
62
- readonly required: false;
63
61
  }];
64
62
  readonly metered: true;
65
- readonly mounts: readonly ["archil"];
63
+ readonly mounts: readonly [];
64
+ readonly unmounted: {
65
+ readonly archil: "Archil mounts don't work on Daytona yet: Archil's client hangs on its sandboxes";
66
+ };
66
67
  readonly network: readonly ["none"];
67
68
  readonly capabilities: readonly [{
68
69
  readonly gpu: Readonly<GpuCapability>;
@@ -1,6 +1,8 @@
1
- // Daytona's descriptor: a sandbox on Daytona's cloud, the run's folder on an Archil disk, with GPUs when asked.
1
+ // Daytona's descriptor: a sandbox on Daytona's cloud, with GPUs when asked; no mount of the run's folder yet.
2
2
  import { defineProvider } from "../descriptor.js";
3
3
  import { SANDBOX } from "./shared.js";
4
+ /** Why a Daytona computer takes no Archil mount: check() refuses one in these words. */
5
+ export const DAYTONA_NO_ARCHIL = "Archil mounts don't work on Daytona yet: Archil's client hangs on its sandboxes";
4
6
  /** The image a Daytona computer starts from when its spec names "default": Daytona's own default snapshot. */
5
7
  export const DAYTONA_DEFAULT_SNAPSHOT = "default";
6
8
  /** The one region Daytona runs a GPU sandbox in, whatever the provider's target. */
@@ -65,17 +67,19 @@ export const DAYTONA = defineProvider({
65
67
  { name: "DAYTONA_API_KEY", option: "apiKey", required: true },
66
68
  { name: "DAYTONA_API_URL", option: "apiUrl", required: false },
67
69
  { name: "DAYTONA_TARGET", option: "target", required: false },
68
- { name: "DAYTONA_ARCHIL_EGRESS", option: "archilEgress", required: false },
69
70
  ],
70
71
  metered: true,
71
- mounts: ["archil"],
72
+ // No mount: Archil's client (0.10.1) mounts on Daytona's container sandboxes, but nothing reads its /dev/fuse after,
73
+ // so the first statx of the folder hangs, on every kernel and mount shape tried (live, 11-14), and Daytona offered
74
+ // no linux-vm class to try instead. An Archil mount is refused in these words, before any request.
75
+ mounts: [],
76
+ unmounted: { archil: DAYTONA_NO_ARCHIL },
72
77
  // None: its programs run in a network of their own (isolation.ts OWN_NETWORK_ONLY).
73
78
  network: ["none"],
74
79
  // A linux computer, with GPUs when asked.
75
80
  capabilities: [{ ...SANDBOX, gpu: DAYTONA_GPU }],
76
81
  defaultImage: { sandbox: DAYTONA_DEFAULT_SNAPSHOT },
77
- // A Daytona computer that mounts the run's folder from Archil needs a snapshot of box/Dockerfile (build-daytona.py
78
- // builds one and prints its name): the operator names it here, and the default snapshot stands while unset.
82
+ // The operator's own snapshot for every Daytona computer, named here; the default snapshot stands while unset.
79
83
  imageEnv: "AGENTRUN_DAYTONA_SNAPSHOT",
80
84
  load: () => import("../daytona.js"),
81
85
  });
@@ -1,3 +1,4 @@
1
+ import { AGENT37 } from "./agent37.js";
1
2
  import { BROWSERBASE } from "./browserbase.js";
2
3
  import { DAYTONA } from "./daytona.js";
3
4
  import { DOCKER } from "./docker.js";
@@ -33,13 +34,12 @@ export declare const DESCRIPTORS: readonly [{
33
34
  readonly name: "DAYTONA_TARGET";
34
35
  readonly option: "target";
35
36
  readonly required: false;
36
- }, {
37
- readonly name: "DAYTONA_ARCHIL_EGRESS";
38
- readonly option: "archilEgress";
39
- readonly required: false;
40
37
  }];
41
38
  readonly metered: true;
42
- readonly mounts: readonly ["archil"];
39
+ readonly mounts: readonly [];
40
+ readonly unmounted: {
41
+ readonly archil: "Archil mounts don't work on Daytona yet: Archil's client hangs on its sandboxes";
42
+ };
43
43
  readonly network: readonly ["none"];
44
44
  readonly capabilities: readonly [{
45
45
  readonly gpu: Readonly<import("../provider.js").GpuCapability>;
@@ -109,6 +109,39 @@ export declare const DESCRIPTORS: readonly [{
109
109
  readonly desktop: "desktop";
110
110
  };
111
111
  readonly load: () => Promise<typeof import("../e2b.js")>;
112
+ }, {
113
+ readonly id: "agent37";
114
+ readonly label: "Agent37";
115
+ readonly keys: readonly [{
116
+ readonly name: "AGENT37_API_KEY";
117
+ readonly option: "apiKey";
118
+ readonly required: true;
119
+ }, {
120
+ readonly name: "AGENT37_SSH_KEY";
121
+ readonly option: "sshKey";
122
+ readonly required: true;
123
+ }];
124
+ readonly metered: true;
125
+ readonly mounts: readonly ["archil"];
126
+ readonly network: readonly ["none"];
127
+ readonly capabilities: readonly [import("../kinds.js").KindCapabilities, {
128
+ readonly options: {
129
+ readonly kind: "desktop";
130
+ };
131
+ readonly kind: import("../protocol.js").ComputerKind;
132
+ readonly groups: import("../protocol.js").Group[];
133
+ readonly gpu?: import("../provider.js").GpuCapability;
134
+ readonly persistence?: {
135
+ keepsState: true;
136
+ resume: boolean;
137
+ };
138
+ readonly image?: string;
139
+ }];
140
+ readonly defaultImage: {
141
+ readonly sandbox: "agent37-base";
142
+ readonly desktop: "agentrun-box";
143
+ };
144
+ readonly load: () => Promise<typeof import("../agent37.js")>;
112
145
  }, {
113
146
  readonly id: "orgo";
114
147
  readonly label: "Orgo";
@@ -119,7 +152,8 @@ export declare const DESCRIPTORS: readonly [{
119
152
  }, {
120
153
  readonly name: "ORGO_WORKSPACE_ID";
121
154
  readonly option: "workspaceId";
122
- readonly required: true;
155
+ readonly required: false;
156
+ readonly picked: true;
123
157
  }];
124
158
  readonly metered: true;
125
159
  readonly mounts: readonly [];
@@ -247,7 +281,8 @@ export declare const DESCRIPTORS: readonly [{
247
281
  readonly hostEnv: readonly ["PI_BROWSER_CHROME", "CHROME_PATH", "PATH"];
248
282
  readonly load: () => Promise<typeof import("../local-chrome.js")>;
249
283
  }];
250
- export { BROWSERBASE, DAYTONA, DOCKER, E2B, KERNEL, LOCAL, MODAL, ORGO, PHONE_HARNESS };
284
+ export { AGENT37, BROWSERBASE, DAYTONA, DOCKER, E2B, KERNEL, LOCAL, MODAL, ORGO, PHONE_HARNESS };
285
+ export { AGENT37_BASE_TEMPLATE, AGENT37_BOX_TEMPLATE } from "./agent37.js";
251
286
  export { DAYTONA_DEFAULT_SNAPSHOT, DAYTONA_GPU_SNAPSHOT, type DaytonaGpuSnapshot, daytonaGpu, daytonaGpuSnapshot } from "./daytona.js";
252
287
  export { E2B_BASE_TEMPLATE, E2B_DESKTOP_TEMPLATE } from "./e2b.js";
253
288
  export { MODAL_DEFAULT_IMAGE } from "./modal.js";
@@ -1,5 +1,6 @@
1
1
  // Every built-in provider's descriptor, in the order Settings shows them. Importing this loads descriptors (data) alone:
2
2
  // each provider module loads only when its descriptor's load() is called.
3
+ import { AGENT37 } from "./agent37.js";
3
4
  import { BROWSERBASE } from "./browserbase.js";
4
5
  import { DAYTONA } from "./daytona.js";
5
6
  import { DOCKER } from "./docker.js";
@@ -9,8 +10,9 @@ import { LOCAL } from "./local-chrome.js";
9
10
  import { MODAL } from "./modal.js";
10
11
  import { ORGO } from "./orgo.js";
11
12
  import { PHONE_HARNESS } from "./phone-harness.js";
12
- export const DESCRIPTORS = [DOCKER, DAYTONA, MODAL, E2B, ORGO, PHONE_HARNESS, BROWSERBASE, KERNEL, LOCAL];
13
- export { BROWSERBASE, DAYTONA, DOCKER, E2B, KERNEL, LOCAL, MODAL, ORGO, PHONE_HARNESS };
13
+ export const DESCRIPTORS = [DOCKER, DAYTONA, MODAL, E2B, AGENT37, ORGO, PHONE_HARNESS, BROWSERBASE, KERNEL, LOCAL];
14
+ export { AGENT37, BROWSERBASE, DAYTONA, DOCKER, E2B, KERNEL, LOCAL, MODAL, ORGO, PHONE_HARNESS };
15
+ export { AGENT37_BASE_TEMPLATE, AGENT37_BOX_TEMPLATE } from "./agent37.js";
14
16
  export { DAYTONA_DEFAULT_SNAPSHOT, DAYTONA_GPU_SNAPSHOT, daytonaGpu, daytonaGpuSnapshot } from "./daytona.js";
15
17
  export { E2B_BASE_TEMPLATE, E2B_DESKTOP_TEMPLATE } from "./e2b.js";
16
18
  export { MODAL_DEFAULT_IMAGE } from "./modal.js";
@@ -56,7 +56,8 @@ export declare const ORGO: {
56
56
  }, {
57
57
  readonly name: "ORGO_WORKSPACE_ID";
58
58
  readonly option: "workspaceId";
59
- readonly required: true;
59
+ readonly required: false;
60
+ readonly picked: true;
60
61
  }];
61
62
  readonly metered: true;
62
63
  readonly mounts: readonly [];
@@ -30,10 +30,11 @@ export const ORGO_PARKED = [
30
30
  export const ORGO = defineProvider({
31
31
  id: "orgo",
32
32
  label: "Orgo",
33
- // The workspace this server's computers live in: every Orgo provider is built in one, and lists only it.
33
+ // The workspace this server's computers live in: every Orgo provider lists only it. Unsaved, it is the key's account's
34
+ // one workspace; with several, a person picks one by name in Settings (orgo-workspaces.ts).
34
35
  keys: [
35
36
  { name: "ORGO_API_KEY", option: "apiKey", required: true },
36
- { name: "ORGO_WORKSPACE_ID", option: "workspaceId", required: true },
37
+ { name: "ORGO_WORKSPACE_ID", option: "workspaceId", required: false, picked: true },
37
38
  ],
38
39
  metered: true,
39
40
  // None yet: an Archil mount needs an Orgo template that bakes the helper.
@@ -1,5 +1,5 @@
1
1
  import type { Group } from "../protocol.js";
2
- /** The groups a phone harness phone offers. */
2
+ /** The groups a phone harness phone offers: phoned's, the driver it runs (daemon-android/), in its hello's order. */
3
3
  export declare const PHONE_GROUPS: readonly Group[];
4
4
  /** The phone harness's Android: a phone computer when its setting names no image. */
5
5
  export declare const PHONE_IMAGE = "android";
@@ -1,7 +1,7 @@
1
1
  // The phone harness's descriptor: a cloud Android over adb, its sessions in a ledger the server keeps.
2
2
  import { defineProvider } from "../descriptor.js";
3
- /** The groups a phone harness phone offers. */
4
- export const PHONE_GROUPS = ["screen", "input.touch", "input.keys", "apps", "apps.ui_tree"];
3
+ /** The groups a phone harness phone offers: phoned's, the driver it runs (daemon-android/), in its hello's order. */
4
+ export const PHONE_GROUPS = ["exec", "screen", "input.keys", "input.touch", "apps", "ui"];
5
5
  /** The phone harness's Android: a phone computer when its setting names no image. */
6
6
  export const PHONE_IMAGE = "android";
7
7
  export const PHONE_HARNESS = defineProvider({
@@ -1,7 +1,7 @@
1
1
  import type { KindCapabilities } from "../kinds.js";
2
2
  /** A Linux shell: exec, files and processes. */
3
3
  export declare const SANDBOX: KindCapabilities;
4
- /** A Linux desktop: a shell, and the screen, pointer and keys of an X display. */
4
+ /** A Linux desktop: a shell, the screen, pointer and keys of an X display, and its apps (its .desktop files). */
5
5
  export declare const LINUX_DESKTOP: KindCapabilities;
6
6
  /** The image every browser computer runs: its vendor's own Chromium. */
7
7
  export declare const BROWSER_IMAGE = "chromium";
@@ -1,6 +1,6 @@
1
1
  /** A Linux shell: exec, files and processes. */
2
2
  export const SANDBOX = { kind: "linux", groups: ["exec", "files", "processes"] };
3
- /** A Linux desktop: a shell, and the screen, pointer and keys of an X display. */
4
- export const LINUX_DESKTOP = { kind: "desktop", groups: ["exec", "files", "processes", "screen", "input.pointer", "input.keys"] };
3
+ /** A Linux desktop: a shell, the screen, pointer and keys of an X display, and its apps (its .desktop files). */
4
+ export const LINUX_DESKTOP = { kind: "desktop", groups: ["exec", "files", "processes", "screen", "input.pointer", "input.keys", "apps"] };
5
5
  /** The image every browser computer runs: its vendor's own Chromium. */
6
6
  export const BROWSER_IMAGE = "chromium";
package/dist/desktop.d.ts CHANGED
@@ -8,17 +8,31 @@ export interface DesktopOptions {
8
8
  /** How long create waits for the display to answer after starting the server. Default 30 s. */
9
9
  timeoutMs?: number;
10
10
  }
11
- /** The groups a desktop declares besides exec, files and processes. */
12
- export declare const DESKTOP_GROUPS: readonly ["screen", "input.pointer", "input.keys"];
11
+ /** The groups a desktop declares besides exec, files and processes: apps is computerd's, from the desktop's .desktop files. */
12
+ export declare const DESKTOP_GROUPS: readonly ["screen", "input.pointer", "input.keys", "apps"];
13
+ /**
14
+ * The window manager a host's desktops run where its facts say so (HostFacts.windowManager: E2B's and Agent37's), once
15
+ * the display answers: it frames, stacks and focuses the windows apps.launch opens. xfwm4, which both images have, with
16
+ * no compositor and no session manager. It reads its settings from xfconfd over a session bus, and exits at once
17
+ * without one ("Xfconf could not be initialized"). So it runs in a session bus of its own (dbus-run-session, WINDOW_MANAGER_BUS, written to a file of
18
+ * its own under /tmp), in a user namespace (the same uid) and a network namespace of its own: a program of the
19
+ * computer's user reaches no socket of that bus, unless it joins those namespaces (nsenter), as the same uid may
20
+ * ptrace xfwm4. xfwm4 reaches the display as any program does, by its path. First, xsetroot paints the screen behind
21
+ * every window one slate colour, so a desktop with no window open is not a black screen a person reads as broken; a
22
+ * paint that fails starts xfwm4 all the same.
23
+ */
24
+ export declare const WINDOW_MANAGER: readonly string[];
13
25
  /** The desktop options with their defaults, or a throw in words. */
14
26
  export declare function desktopOf({ display, server, timeoutMs }: DesktopOptions): Required<DesktopOptions>;
15
27
  /**
16
28
  * Starts the desktop's X server through the daemon (process.start) and waits until hello declares the display: the
17
29
  * server ending first, or the bound passing, is a failure in words, with the server's own last words, as the vendor's
18
- * (code vendor, vendor the provider's id). version is the client's, sent with each hello.
30
+ * (code vendor, vendor the provider's id). version is the client's, sent with each hello. windowManager: the host's
31
+ * desktops run WINDOW_MANAGER (HostFacts.windowManager), started once the display answers.
19
32
  */
20
- export declare function startDisplay(client: ComputerClient, desktop: Required<DesktopOptions>, { version, vendor, signal }: {
33
+ export declare function startDisplay(client: ComputerClient, desktop: Required<DesktopOptions>, { version, vendor, signal, windowManager }: {
21
34
  version: string;
22
35
  vendor: string;
23
36
  signal?: AbortSignal | undefined;
37
+ windowManager?: boolean;
24
38
  }): Promise<Result<void>>;
package/dist/desktop.js CHANGED
@@ -1,14 +1,61 @@
1
1
  // A desktop on an X server computerd starts itself: the provider gives init DISPLAY, then starts the X server through
2
2
  // the daemon with process.start, as any program, so the server is in init's process table and ends with the computer.
3
- // The daemon reaches the display once it answers, and hello declares screen, input.pointer and input.keys from then on
4
- // (hello re-checks the display on each call). Docker's desktops and E2B's start the display this way.
3
+ // The daemon reaches the display once it answers, and hello declares screen, input.pointer, input.keys and apps from then
4
+ // on (hello re-checks the display on each call). A window manager, when the desktop has one, starts next, the same way.
5
+ // Docker's desktops, E2B's and Agent37's start the display this way.
5
6
  import { setTimeout as sleep } from "node:timers/promises";
6
7
  import { fail, ok, vendorFail } from "./result.js";
7
- /** The groups a desktop declares besides exec, files and processes. */
8
- export const DESKTOP_GROUPS = ["screen", "input.pointer", "input.keys"];
8
+ /** The groups a desktop declares besides exec, files and processes: apps is computerd's, from the desktop's .desktop files. */
9
+ export const DESKTOP_GROUPS = ["screen", "input.pointer", "input.keys", "apps"];
10
+ /**
11
+ * The session bus the window manager reads its settings over: dbus's own session config, but listening on an abstract
12
+ * name, which only a program in the bus's own network namespace reaches. dbus's unix:tmpdir is a socket under /tmp
13
+ * with dbus 1.16 (Agent37's box), which every program of the user reaches.
14
+ */
15
+ const WINDOW_MANAGER_BUS = `<busconfig>
16
+ <type>session</type>
17
+ <keep_umask/>
18
+ <listen>unix:abstract=/agentrun/window-manager</listen>
19
+ <auth>EXTERNAL</auth>
20
+ <standard_session_servicedirs/>
21
+ <policy context="default">
22
+ <allow send_destination="*" eavesdrop="true"/>
23
+ <allow eavesdrop="true"/>
24
+ <allow own="*"/>
25
+ </policy>
26
+ </busconfig>`;
27
+ /**
28
+ * The window manager a host's desktops run where its facts say so (HostFacts.windowManager: E2B's and Agent37's), once
29
+ * the display answers: it frames, stacks and focuses the windows apps.launch opens. xfwm4, which both images have, with
30
+ * no compositor and no session manager. It reads its settings from xfconfd over a session bus, and exits at once
31
+ * without one ("Xfconf could not be initialized"). So it runs in a session bus of its own (dbus-run-session, WINDOW_MANAGER_BUS, written to a file of
32
+ * its own under /tmp), in a user namespace (the same uid) and a network namespace of its own: a program of the
33
+ * computer's user reaches no socket of that bus, unless it joins those namespaces (nsenter), as the same uid may
34
+ * ptrace xfwm4. xfwm4 reaches the display as any program does, by its path. First, xsetroot paints the screen behind
35
+ * every window one slate colour, so a desktop with no window open is not a black screen a person reads as broken; a
36
+ * paint that fails starts xfwm4 all the same.
37
+ */
38
+ export const WINDOW_MANAGER = [
39
+ "unshare",
40
+ "--user",
41
+ "--map-current-user",
42
+ "--net",
43
+ "--",
44
+ "sh",
45
+ "-c",
46
+ 'xsetroot -solid "#3b4b5c"; bus=$(mktemp) && printf "%s" "$1" > "$bus" && exec dbus-run-session --config-file="$bus" -- xfwm4 --compositor=off --sm-client-disable',
47
+ "sh",
48
+ WINDOW_MANAGER_BUS,
49
+ ];
50
+ /** WINDOW_MANAGER as create's errors name it: what runs, without the shell line and the bus's config. */
51
+ const WINDOW_MANAGER_WORDS = "unshare --user --map-current-user --net -- dbus-run-session -- xfwm4 --compositor=off --sm-client-disable";
9
52
  const DISPLAY = /^:\d{1,5}(\.\d{1,5})?$/;
10
53
  /** How often create asks the daemon whether the display is up yet. */
11
54
  const DISPLAY_POLL_MS = 100;
55
+ /** How long create watches a window manager it started: one that ends within it (it could not take the display) fails create. */
56
+ const WM_SETTLE_MS = 1_000;
57
+ /** The longest create gives a window manager's start and that watch, apart from the display's own timeoutMs. */
58
+ const WM_BOUND_MS = 15_000;
12
59
  /** The longest a Node timer or AbortSignal.timeout holds. */
13
60
  const MAX_TIMER_MS = 2 ** 31 - 1;
14
61
  /** The desktop options with their defaults, or a throw in words. */
@@ -16,9 +63,9 @@ export function desktopOf({ display = ":0", server, timeoutMs = 30_000 }) {
16
63
  if (typeof display !== "string" || !DISPLAY.test(display))
17
64
  throw new Error(`the desktop's display ${JSON.stringify(display)} must be a local X display, such as :0`);
18
65
  const argv = server ?? ["Xvfb", display, "-screen", "0", "1280x800x24", "-nolisten", "tcp"];
19
- if (!Array.isArray(argv) || argv.length === 0 || !argv.every((arg) => typeof arg === "string" && !arg.includes("\0")) || argv[0] === "") {
66
+ const program = (list) => Array.isArray(list) && list.length > 0 && list.every((arg) => typeof arg === "string" && !arg.includes("\0")) && list[0] !== "";
67
+ if (!program(argv))
20
68
  throw new Error("the desktop's server must be a program and its arguments, such as [\"Xvfb\", \":0\"]");
21
- }
22
69
  // AbortSignal.timeout and Node's timers hold at most 2^31 - 1 ms (a longer one throws or fires at once), so a longer
23
70
  // bound is refused here, before any computer exists, not in create after the computer is made.
24
71
  if (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > MAX_TIMER_MS) {
@@ -29,9 +76,10 @@ export function desktopOf({ display = ":0", server, timeoutMs = 30_000 }) {
29
76
  /**
30
77
  * Starts the desktop's X server through the daemon (process.start) and waits until hello declares the display: the
31
78
  * server ending first, or the bound passing, is a failure in words, with the server's own last words, as the vendor's
32
- * (code vendor, vendor the provider's id). version is the client's, sent with each hello.
79
+ * (code vendor, vendor the provider's id). version is the client's, sent with each hello. windowManager: the host's
80
+ * desktops run WINDOW_MANAGER (HostFacts.windowManager), started once the display answers.
33
81
  */
34
- export async function startDisplay(client, desktop, { version, vendor, signal }) {
82
+ export async function startDisplay(client, desktop, { version, vendor, signal, windowManager = false }) {
35
83
  const server = desktop.server.join(" ");
36
84
  // Every call takes a signal that ends at the bound, so a hello the X connection setup holds, or a daemon that stops
37
85
  // answering, cannot outwait it. A call that failed because the bound passed is the timeout; the caller's own abort
@@ -49,7 +97,7 @@ export async function startDisplay(client, desktop, { version, vendor, signal })
49
97
  if (!hello.ok)
50
98
  return timedOut() ? late() : hello;
51
99
  if (Array.isArray(hello.value.groups) && hello.value.groups.includes("screen"))
52
- return ok(undefined);
100
+ return windowManager ? await startWindowManager(client, desktop, vendor, signal) : ok(undefined);
53
101
  const waited = await client.call("process.wait", { id, timeoutMs: 0 }, { signal: either });
54
102
  if (waited.ok && !waited.value.running) {
55
103
  const read = await client.call("process.read", { id, stream: "stderr", offset: 0 }, { signal: either });
@@ -66,3 +114,35 @@ export async function startDisplay(client, desktop, { version, vendor, signal })
66
114
  return fail("aborted", "create was aborted while the display came up");
67
115
  }
68
116
  }
117
+ /**
118
+ * Starts WINDOW_MANAGER on the display that answers. A manager that cannot start, or ends
119
+ * within WM_SETTLE_MS (xfwm4 with no session bus, or no display it may open), fails create with its last words. It has
120
+ * its own bound, WM_BOUND_MS, not what is left of the display's: a display that came up late still gets its manager's
121
+ * full second. The caller's abort still ends it.
122
+ */
123
+ async function startWindowManager(client, desktop, vendor, caller) {
124
+ const manager = WINDOW_MANAGER_WORDS;
125
+ const bound = AbortSignal.timeout(WM_BOUND_MS);
126
+ const signal = caller ? AbortSignal.any([caller, bound]) : bound;
127
+ const stopped = (code, message) => caller?.aborted
128
+ ? fail("aborted", "create was aborted while the window manager started")
129
+ : bound.aborted
130
+ ? fail("timeout", `the window manager (${manager}) did not start on ${desktop.display} within ${WM_BOUND_MS / 1000} s`)
131
+ : fail(code, message);
132
+ // NO_AT_BRIDGE: GTK (xfwm4's toolkit) asks its session bus for no accessibility bus. On E2B Desktop, which has
133
+ // at-spi2-core, that bus is an at-spi-bus-launcher and a socket of the user's under its home (~/.cache/at-spi/bus_0).
134
+ const env = { DISPLAY: desktop.display, NO_AT_BRIDGE: "1" };
135
+ const started = await client.call("process.start", { argv: [...WINDOW_MANAGER], env }, { signal });
136
+ if (!started.ok)
137
+ return stopped(started.error.code, `the window manager (${manager}) did not start on ${desktop.display}: ${started.error.message}`);
138
+ const { id } = started.value;
139
+ const waited = await client.call("process.wait", { id, timeoutMs: WM_SETTLE_MS }, { signal });
140
+ if (!waited.ok)
141
+ return stopped(waited.error.code, `the window manager (${manager}) could not be waited on: ${waited.error.message}`);
142
+ if (waited.value.running)
143
+ return ok(undefined);
144
+ const read = await client.call("process.read", { id, stream: "stderr", offset: 0 }, { signal });
145
+ const words = read.ok ? Buffer.from(read.value.data, "base64").toString("utf8").trim().split("\n").slice(-5).join("; ") : "";
146
+ const how = waited.value.signal ? `signal ${waited.value.signal}` : `exit code ${waited.value.exitCode}`;
147
+ return vendorFail(vendor, `the window manager (${manager}) ended with ${how} within ${WM_SETTLE_MS / 1000} s of starting on ${desktop.display}${words ? `: ${words}` : ""}`);
148
+ }
package/dist/docker.d.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  import { type DesktopOptions } from "./desktop.js";
2
2
  import { type DockerHost } from "./docker/inspect.js";
3
3
  import { type EnsureImageOptions, type ImageSource } from "./docker/image.js";
4
- import type { KindCapabilities } from "./kinds.js";
5
- import { type MountKind } from "./mount.js";
6
- import { type AttachedComputer, type CallContext, type ComputerCapabilities, type ComputerConnection, type ComputerInfo, type ComputerProvider, type ComputerRef, type ComputerSpec, type NetworkPolicy, type NetworkSpec, type Refusal, type ReleaseHow } from "./provider.js";
4
+ import { type AttachedComputer, type CallContext, type CreateContext, type ComputerCapabilities, type ComputerConnection, type ComputerInfo, type ComputerProvider, type ComputerRef, type ComputerSpec, type NetworkPolicy, type NetworkSpec, type Refusal, type ReleaseHow } from "./provider.js";
7
5
  import { type Result } from "./result.js";
8
6
  import { type ScreenWatch, type ScreenWatchHandlers, type WatchOptions } from "./screen-watch.js";
9
7
  /**
@@ -68,10 +66,6 @@ export interface DockerProviderOptions {
68
66
  root: string;
69
67
  };
70
68
  }
71
- /** The mount kinds a Docker computer takes, as capabilities().mount declares them: a bind of a folder on this host. */
72
- export declare const MOUNT: readonly MountKind[];
73
- /** The machine kind and groups of each configuration (its descriptor's): a linux computer, and a desktop. */
74
- export declare const CAPABILITIES: readonly KindCapabilities[];
75
69
  /** What create() takes: the provider's options, the daemon optional. */
76
70
  export interface DockerCreateOptions extends Partial<DockerProviderOptions> {
77
71
  /** The longest `docker version` may take, when create asks Docker its architecture; default 30 s. */
@@ -114,9 +108,12 @@ export declare class DockerProvider implements ComputerProvider {
114
108
  /** The spec's refusals, and the host's once create, attach or host() has read it: its problems, a bind or an
115
109
  * allowlist on a host that remaps user ids, and an allowlist on a Docker host this provider does not run on. */
116
110
  check(spec: ComputerSpec): Refusal[];
117
- create(spec: ComputerSpec, { signal }?: {
118
- signal?: AbortSignal;
119
- }): Promise<Result<ComputerRef>>;
111
+ /**
112
+ * Makes a computer, once per request (provider.md, Idempotent create): context.requestId names the container
113
+ * (computerNameFor). A request Docker holds a container for already answers that one (#taken); one whose computer
114
+ * was deleted here is refused exists; a create of a request in flight here waits for the first (CreateRequests).
115
+ */
116
+ create(spec: ComputerSpec, context: CreateContext): Promise<Result<ComputerRef>>;
120
117
  /** The Docker host's architecture and enforcement (hostOf), read by docker info once per provider. */
121
118
  host({ signal }?: CallContext): Promise<Result<DockerHost>>;
122
119
  /** The live view: screen.watch on a connection of the watch's own (daemonWatch); a linux computer has no screen. */