@parcha/agentrun-computer 0.1.0-beta.58 → 0.1.0-beta.60

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 (143) hide show
  1. package/README.md +285 -81
  2. package/box/Dockerfile +4 -3
  3. package/box/install.sh +57 -11
  4. package/dist/agent37.d.ts +11 -4
  5. package/dist/agent37.js +217 -19
  6. package/dist/attach.d.ts +24 -4
  7. package/dist/attach.js +50 -19
  8. package/dist/boxd.js +22 -9
  9. package/dist/browser.d.ts +56 -11
  10. package/dist/browser.js +76 -17
  11. package/dist/browserbase.d.ts +20 -5
  12. package/dist/browserbase.js +186 -21
  13. package/dist/child-env.d.ts +11 -0
  14. package/dist/child-env.js +22 -0
  15. package/dist/chrome.d.ts +5 -2
  16. package/dist/chrome.js +5 -2
  17. package/dist/cloudflare.d.ts +2 -0
  18. package/dist/cloudflare.js +5 -3
  19. package/dist/computerd-linux-amd64 +0 -0
  20. package/dist/computerd-linux-arm64 +0 -0
  21. package/dist/computerd.json +1 -1
  22. package/dist/conformance/agent37.d.ts +20 -40
  23. package/dist/conformance/agent37.js +31 -118
  24. package/dist/conformance/archil.d.ts +13 -3
  25. package/dist/conformance/archil.js +22 -17
  26. package/dist/conformance/boxd.d.ts +8 -31
  27. package/dist/conformance/boxd.js +19 -74
  28. package/dist/conformance/browserbase.d.ts +3 -6
  29. package/dist/conformance/browserbase.js +6 -17
  30. package/dist/conformance/cases/health.js +6 -3
  31. package/dist/conformance/cases/provider.js +4 -1
  32. package/dist/conformance/cli.d.ts +3 -1
  33. package/dist/conformance/cli.js +69 -9
  34. package/dist/conformance/cloudflare.d.ts +3 -6
  35. package/dist/conformance/cloudflare.js +7 -15
  36. package/dist/conformance/daytona.d.ts +6 -20
  37. package/dist/conformance/daytona.js +22 -57
  38. package/dist/conformance/dial-only.d.ts +4 -3
  39. package/dist/conformance/dial-only.js +3 -3
  40. package/dist/conformance/docker.d.ts +4 -5
  41. package/dist/conformance/docker.js +8 -14
  42. package/dist/conformance/e2b.d.ts +10 -36
  43. package/dist/conformance/e2b.js +27 -84
  44. package/dist/conformance/fly.d.ts +3 -6
  45. package/dist/conformance/fly.js +2 -6
  46. package/dist/conformance/groundbox.d.ts +7 -23
  47. package/dist/conformance/groundbox.js +16 -56
  48. package/dist/conformance/index.d.ts +1 -0
  49. package/dist/conformance/index.js +1 -0
  50. package/dist/conformance/kernel.d.ts +3 -6
  51. package/dist/conformance/kernel.js +5 -15
  52. package/dist/conformance/kind.d.ts +0 -6
  53. package/dist/conformance/kind.js +0 -4
  54. package/dist/conformance/local-chrome.d.ts +5 -7
  55. package/dist/conformance/local-chrome.js +7 -11
  56. package/dist/conformance/modal.d.ts +10 -38
  57. package/dist/conformance/modal.js +27 -74
  58. package/dist/conformance/module-kit.d.ts +87 -0
  59. package/dist/conformance/module-kit.js +88 -0
  60. package/dist/conformance/morph.d.ts +7 -23
  61. package/dist/conformance/morph.js +20 -66
  62. package/dist/conformance/orgo.d.ts +5 -10
  63. package/dist/conformance/orgo.js +15 -27
  64. package/dist/conformance/phone-harness.d.ts +3 -5
  65. package/dist/conformance/phone-harness.js +3 -11
  66. package/dist/conformance/runner.d.ts +13 -3
  67. package/dist/conformance/runner.js +32 -11
  68. package/dist/conformance/smolcloud.d.ts +7 -23
  69. package/dist/conformance/smolcloud.js +16 -49
  70. package/dist/conformance/sweep.d.ts +10 -5
  71. package/dist/conformance/sweep.js +91 -38
  72. package/dist/conformance/tti.d.ts +69 -0
  73. package/dist/conformance/tti.js +205 -0
  74. package/dist/conformance/types.d.ts +9 -2
  75. package/dist/daytona.js +60 -20
  76. package/dist/descriptor.d.ts +37 -0
  77. package/dist/descriptor.js +9 -0
  78. package/dist/descriptors/agent37.d.ts +4 -1
  79. package/dist/descriptors/agent37.js +5 -2
  80. package/dist/descriptors/browserbase.d.ts +3 -0
  81. package/dist/descriptors/browserbase.js +4 -0
  82. package/dist/descriptors/docker.d.ts +2 -0
  83. package/dist/descriptors/docker.js +5 -0
  84. package/dist/descriptors/env-names.d.ts +32 -0
  85. package/dist/descriptors/env-names.js +60 -0
  86. package/dist/descriptors/index.d.ts +14 -3
  87. package/dist/descriptors/kernel.d.ts +3 -0
  88. package/dist/descriptors/kernel.js +2 -0
  89. package/dist/descriptors/local-chrome.d.ts +1 -1
  90. package/dist/descriptors/local-chrome.js +5 -3
  91. package/dist/descriptors/phone-harness.d.ts +1 -1
  92. package/dist/descriptors/phone-harness.js +4 -2
  93. package/dist/docker/egress.d.ts +7 -0
  94. package/dist/docker/egress.js +8 -0
  95. package/dist/docker/image.d.ts +5 -1
  96. package/dist/docker/image.js +12 -8
  97. package/dist/docker.d.ts +52 -13
  98. package/dist/docker.js +166 -92
  99. package/dist/drift.js +6 -6
  100. package/dist/e2b.d.ts +2 -2
  101. package/dist/e2b.js +2 -3
  102. package/dist/groundbox.js +6 -6
  103. package/dist/host.d.ts +23 -0
  104. package/dist/hosted/download.d.ts +23 -0
  105. package/dist/hosted/download.js +144 -0
  106. package/dist/hosted/process.d.ts +5 -0
  107. package/dist/hosted/process.js +20 -0
  108. package/dist/hosted/provider.js +120 -48
  109. package/dist/hosted/rest.d.ts +19 -8
  110. package/dist/hosted/rest.js +47 -14
  111. package/dist/hosted/scripts.d.ts +10 -0
  112. package/dist/hosted/scripts.js +23 -2
  113. package/dist/hosted/ssh-exec.d.ts +7 -1
  114. package/dist/hosted/ssh-exec.js +19 -14
  115. package/dist/hosted/ssh-key.d.ts +18 -0
  116. package/dist/hosted/ssh-key.js +36 -0
  117. package/dist/index.d.ts +5 -3
  118. package/dist/index.js +4 -2
  119. package/dist/janitor.d.ts +7 -1
  120. package/dist/janitor.js +2 -2
  121. package/dist/kernel.d.ts +14 -4
  122. package/dist/kernel.js +141 -18
  123. package/dist/local-chrome.d.ts +12 -3
  124. package/dist/local-chrome.js +108 -10
  125. package/dist/local-supervisor.js +1 -0
  126. package/dist/modal.d.ts +6 -5
  127. package/dist/modal.js +7 -7
  128. package/dist/morph.js +5 -8
  129. package/dist/orgo-channel.d.ts +3 -2
  130. package/dist/orgo-channel.js +3 -3
  131. package/dist/orgo-desktop.js +2 -4
  132. package/dist/orgo.d.ts +6 -0
  133. package/dist/orgo.js +158 -15
  134. package/dist/phone-harness.d.ts +7 -5
  135. package/dist/phone-harness.js +60 -61
  136. package/dist/protocol.d.ts +10 -0
  137. package/dist/protocol.js +17 -0
  138. package/dist/provider.d.ts +6 -2
  139. package/dist/screen-watch.d.ts +6 -1
  140. package/dist/screen-watch.js +166 -12
  141. package/dist/vendor-sdk.d.ts +9 -0
  142. package/dist/vendor-sdk.js +26 -0
  143. package/package.json +8 -1
@@ -1,31 +1,16 @@
1
1
  // Agent37 for the conformance CLI: `npm run conformance -w @parcha/agentrun-computer -- --provider agent37`.
2
2
  // It makes real instances, which bill per minute until deleted, so it runs only with AGENTRUN_COMPUTER_LIVE_AGENT37=1
3
- // and a key for an account you can bill, under COMPUTER_AGENT37_API_KEY, beside COMPUTER_AGENT37_SSH_KEY, the private half (its
4
- // contents) of an SSH key registered on the same workspace. The provider reads no environment: this module reads its
5
- // own COMPUTER_AGENT37_* names (never AGENT37_API_KEY, which may hold another team's key) and passes each to create()
6
- // as its option. The live switch is checked first, before any other setting is read. The live sweep (sweep.ts,
7
- // --provider agent37) reads the same names through createHost, which needs no live switch: it makes nothing.
8
- //
9
- // The daemon is uploaded into each instance over SSH (dist/computerd-linux-amd64, `npm run build:daemon`), so a run
10
- // publishes nothing. The drifted provider uploads a daemon built with Go as version <version>-drift. Agent37 never
11
- // ends an instance on its own: every computer of a run lives at most 30 minutes, by init's deadline and the janitor's
12
- // label, and the run's sweep deletes what is left.
13
- //
14
- // COMPUTER_AGENT37_KIND=desktop runs the desktop's cases (screen, input) on the box template, agentrun-box-<recipe
15
- // hash>, which the run registers in the key's workspace first through the provider's prepareImage() (from the public
16
- // image the release publishes), or on another with an X server named in COMPUTER_AGENT37_TEMPLATE.
17
- //
18
- // For the mount cases, mountFor("archil") makes a fresh run folder on the Archil disk COMPUTER_ARCHIL_DISK names, as
19
- // the E2B module does (./archil.ts); with no disk named it makes none, and the cases are skipped. An Archil computer
20
- // needs a provider whose daemon user is the tool user: COMPUTER_AGENT37_USER=2510:2510, the default.
3
+ // and a key for an account you can bill, under COMPUTER_AGENT37_API_KEY (never AGENT37_API_KEY, which may hold another
4
+ // team's key). Agent37 never ends an instance on its own: every computer of a run lives at most 30 minutes, by init's
5
+ // deadline and the janitor's label, and the run's sweep deletes what is left. An Archil computer (mountFor("archil"),
6
+ // ./archil.ts) needs a provider whose daemon user is the tool user: COMPUTER_AGENT37_USER=2510:2510, the default.
21
7
  import { create, workspaceOf } from "../agent37.js";
22
8
  import { AGENT37_BASE_TEMPLATE } from "../descriptors/agent37.js";
23
- import { archilRunFolder, archilSettings } from "./archil.js";
24
- import { buildDriftDaemon, DRIFT_VERSION } from "./drift-daemon.js";
25
- import { kindFrom } from "./kind.js";
9
+ import { archilMountFor } from "./archil.js";
10
+ import { hostedModule, kindFrom, lifetimeFromEnv, preparedImage, requiredSecret, setOptions } from "./module-kit.js";
11
+ export { CONFORMANCE_MAX_LIFETIME_MS } from "./module-kit.js";
26
12
  /** The Archil disk's settings for the mount cases, by name (COMPUTER_ARCHIL_*: all five, or none). */
27
13
  export { ARCHIL_ENV } from "./archil.js";
28
- /** The environment this module reads, by name, each for the option its comment names, the live switch and the run's template. */
29
14
  export const AGENT37_ENV = {
30
15
  live: "AGENTRUN_COMPUTER_LIVE_AGENT37",
31
16
  /** The template every computer of the run starts from; default agent37-base, or the box template for kind desktop. */
@@ -34,7 +19,11 @@ export const AGENT37_ENV = {
34
19
  kind: "COMPUTER_AGENT37_KIND",
35
20
  /** apiKey, required: the workspace's API key. */
36
21
  key: "COMPUTER_AGENT37_API_KEY",
37
- /** sshKey, required: the private SSH key registered on the workspace, its contents. */
22
+ /**
23
+ * sshKey, optional: the private half of an SSH key already registered on the workspace, its contents. Unset, the run
24
+ * makes a key of its own, kept in its process's memory, and registers it on the workspace (POST /v1/ssh-keys), where
25
+ * it stays: delete the agentrun-<hash> keys a run leaves (DELETE /v1/ssh-keys/{id}) before the workspace reaches 20.
26
+ */
38
27
  sshKey: "COMPUTER_AGENT37_SSH_KEY",
39
28
  /** type: vm (default) or default. */
40
29
  type: "COMPUTER_AGENT37_TYPE",
@@ -49,51 +38,31 @@ export const AGENT37_ENV = {
49
38
  /** daemonUser: uid:gid the daemon runs as; default 2510:2510. */
50
39
  user: "COMPUTER_AGENT37_USER",
51
40
  };
52
- /** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
53
41
  export const ENV = AGENT37_ENV;
54
42
  /**
55
43
  * The provider's options this module reads from env, each only when its name is set; throws in words without a key,
56
- * or on a value it cannot read, never echoing a key. create() checks the rest.
44
+ * or on a value it cannot read, never echoing a key.
57
45
  */
58
46
  export function settingsFromEnv(env = process.env) {
59
- const apiKey = env[AGENT37_ENV.key];
60
- if (apiKey === undefined || apiKey === "")
61
- throw new Error(`set ${AGENT37_ENV.key} to an Agent37 API key: the conformance module reads it there and nowhere else, never from AGENT37_API_KEY`);
62
- const sshKey = env[AGENT37_ENV.sshKey];
63
- if (sshKey === undefined || sshKey === "")
64
- throw new Error(`set ${AGENT37_ENV.sshKey} to the private SSH key registered on the Agent37 workspace (its contents, never a path)`);
65
- const lifetime = env[AGENT37_ENV.maxLifetimeMs] || undefined;
66
- if (lifetime !== undefined && !/^\d+$/.test(lifetime))
67
- throw new Error(`${AGENT37_ENV.maxLifetimeMs} is a whole number of milliseconds, such as 86400000`);
68
- const type = env[AGENT37_ENV.type] || undefined;
69
- const region = env[AGENT37_ENV.region] || undefined;
70
- const apiUrl = env[AGENT37_ENV.apiUrl] || undefined;
71
- const daemonPath = env[AGENT37_ENV.daemon] || undefined;
72
- const daemonUser = env[AGENT37_ENV.user] || undefined;
73
- return {
74
- apiKey,
75
- sshKey,
76
- // create() refuses any other type or region in words.
77
- ...(type === undefined ? {} : { type: type }),
78
- ...(region === undefined ? {} : { region: region }),
79
- ...kindFrom(env, AGENT37_ENV.kind),
80
- ...(apiUrl === undefined ? {} : { apiUrl }),
81
- ...(daemonPath === undefined ? {} : { daemonPath }),
82
- ...(lifetime === undefined ? {} : { maxLifetimeMs: Number(lifetime) }),
83
- ...(daemonUser === undefined ? {} : { daemonUser }),
84
- };
47
+ const apiKey = requiredSecret(env, AGENT37_ENV.key, "an Agent37 API key");
48
+ const lifetime = lifetimeFromEnv(env, AGENT37_ENV.maxLifetimeMs, "86400000");
49
+ const set = setOptions(env, { sshKey: AGENT37_ENV.sshKey, type: AGENT37_ENV.type, region: AGENT37_ENV.region, apiUrl: AGENT37_ENV.apiUrl, daemonPath: AGENT37_ENV.daemon, daemonUser: AGENT37_ENV.user });
50
+ return { apiKey, ...set, ...kindFrom(env, AGENT37_ENV.kind), ...lifetime };
85
51
  }
86
- /** The longest lifetime a computer of a run may ask for: init ends it at its deadline, the sweep deletes it. */
87
- export const CONFORMANCE_MAX_LIFETIME_MS = 30 * 60_000;
88
- /** For the run's report: what this configuration means for the suite. */
89
52
  export const conformanceNotes = [
90
- "agent37: every computer is an instance (type vm by default), made with network deny-all, auto-sleep off and no public port, read back from Agent37 and probed from inside; the daemon is a child, started over SSH through the platform's sshd (port 22022; it and the platform's web terminal on 7681 are declared as the vendor's agent), and every command goes over that SSH as root. Agent37 never ends an instance on its own: lifetime janitor, capped at 30 minutes for the run. No stream() (a screen is streamed through agentrun), so screen.stream is skipped. Kind desktop (COMPUTER_AGENT37_KIND=desktop) starts from agentrun-box-<recipe hash>, our box image registered as a template of the key's workspace (prepareImage), with Xvfb on :0 started through the daemon as the tool user.",
53
+ "agent37: every computer is an instance (type vm by default), made with network deny-all, auto-sleep off and no public port, read back from Agent37 and probed from inside; the daemon is a child, started over SSH through the platform's sshd (port 22022; it and the platform's web terminal on 7681 are declared as the vendor's agent), and every command goes over that SSH as root. Agent37 never ends an instance on its own: lifetime janitor, capped at 30 minutes for the run. No stream() (a screen is streamed through agentrun), so screen.stream is skipped. Kind desktop (COMPUTER_AGENT37_KIND=desktop) starts from agentrun-box-<recipe hash>, our box image registered as a template of the key's workspace (prepareImage), with Xvfb on :0 started through the daemon as the tool user. With no COMPUTER_AGENT37_SSH_KEY, the run makes an ed25519 key for its process and registers it on the workspace (agentrun-<hash>) before its first instance; the key stays there, one more of the workspace's 20.",
91
54
  ];
92
- function live(env) {
93
- if (env[AGENT37_ENV.live] !== "1") {
94
- throw new Error(`the Agent37 conformance module makes real instances, which bill until deleted: set ${AGENT37_ENV.live}=1, with a key for an account you can bill, to run it`);
95
- }
96
- }
55
+ const agent37 = hostedModule({
56
+ live: { name: AGENT37_ENV.live, what: "the Agent37 conformance module makes real instances, which bill until deleted", whose: "a key for an account you can bill" },
57
+ settingsFromEnv,
58
+ create,
59
+ host: ["ssh2", "fetch", "WebSocket", "timeouts", "onNote"],
60
+ run: [],
61
+ runDefined: ["daemonPath"],
62
+ // One key is one workspace, and one listing covers all of it, every region and type (docs: instances/list).
63
+ scope: ({ apiKey, apiUrl }) => workspaceOf(apiKey, apiUrl),
64
+ });
65
+ export const { createProvider, createDriftedProvider, createHost, sweepScope } = agent37;
97
66
  /**
98
67
  * The template every computer of the run starts from: COMPUTER_AGENT37_TEMPLATE, else agent37-base, else for kind
99
68
  * desktop the box template, which the run's provider registers in the key's workspace first (prepareImage, live).
@@ -105,62 +74,6 @@ export async function conformanceImage(options = {}, { signal } = {}) {
105
74
  return named;
106
75
  if (env[AGENT37_ENV.kind] !== "desktop")
107
76
  return AGENT37_BASE_TEMPLATE;
108
- const ready = await (await createProvider(options)).prepareImage(signal ? { signal } : {});
109
- if (!ready.ok)
110
- throw new Error(`the Agent37 box template: ${ready.error.message}`);
111
- return ready.value;
112
- }
113
- /** The test doubles a caller hands in, each only when given. */
114
- const doubles = ({ ssh2, fetch, WebSocket, timeouts, onNote }) => ({
115
- ...(ssh2 ? { ssh2 } : {}),
116
- ...(fetch ? { fetch } : {}),
117
- ...(WebSocket ? { WebSocket } : {}),
118
- ...(timeouts ? { timeouts } : {}),
119
- ...(onNote ? { onNote } : {}),
120
- });
121
- /** A run's cap: COMPUTER_AGENT37_MAX_LIFETIME_MS when it is shorter, else CONFORMANCE_MAX_LIFETIME_MS. */
122
- const runCap = (settings) => Math.min(settings.maxLifetimeMs ?? CONFORMANCE_MAX_LIFETIME_MS, CONFORMANCE_MAX_LIFETIME_MS);
123
- /** The provider the CLI runs; throws in words without the live switch, or when a setting is missing or wrong. */
124
- export async function createProvider(options = {}) {
125
- const { env = process.env, daemonPath } = options;
126
- live(env);
127
- const settings = settingsFromEnv(env);
128
- return create({ ...settings, ...doubles(options), ...(daemonPath === undefined ? {} : { daemonPath }), maxLifetimeMs: runCap(settings) });
129
- }
130
- /** The same provider uploading a daemon that reports version <version>-drift, for the drift.version case. */
131
- export async function createDriftedProvider(options = {}) {
132
- const { env = process.env, buildDaemon = (version) => buildDriftDaemon("amd64", version) } = options;
133
- live(env);
134
- const settings = settingsFromEnv(env);
135
- const daemonPath = await buildDaemon(DRIFT_VERSION);
136
- return create({ ...settings, ...doubles(options), daemonPath, maxLifetimeMs: runCap(settings) });
137
- }
138
- /**
139
- * A run folder for an Archil mount, and none for any other kind (an Agent37 computer takes no bind): a fresh folder on
140
- * the disk the COMPUTER_ARCHIL_* names name (archilSettings), none when they name none. Reaching it is a call to
141
- * Archil, so it needs the live switch.
142
- */
143
- export async function mountFor(kind, { env = process.env, archil = {} } = {}) {
144
- if (kind !== "archil")
145
- return undefined;
146
- const settings = archilSettings(env);
147
- if (settings === undefined)
148
- return undefined;
149
- live(env);
150
- return archilRunFolder({ ...settings, ...archil });
151
- }
152
- /**
153
- * The Agent37 host the live sweep (sweep.ts) lists and deletes through, from the same settings; it needs no live
154
- * switch, since the sweep makes nothing, and it calls nothing until the sweep does.
155
- */
156
- export async function createHost(options = {}) {
157
- return (await create({ ...settingsFromEnv(options.env ?? process.env), ...doubles(options) })).host;
158
- }
159
- /**
160
- * Where the host lists, in words: one key is one workspace, and one listing covers all of it, every region and type
161
- * (docs: instances/list). The key is named by its sha256 prefix alone, so a before file of another key is refused.
162
- */
163
- export function sweepScope({ env = process.env } = {}) {
164
- const { apiKey, apiUrl } = settingsFromEnv(env);
165
- return workspaceOf(apiKey, apiUrl);
77
+ return preparedImage(await createProvider(options), signal, "the Agent37 box template");
166
78
  }
79
+ export const mountFor = archilMountFor(agent37.live);
@@ -1,3 +1,4 @@
1
+ import type { MountKind } from "../mount.js";
1
2
  import type { RunFolder } from "./types.js";
2
3
  /** The settings of the Archil mount cases, by the names a conformance module reads them from. */
3
4
  export declare const ARCHIL_ENV: {
@@ -48,10 +49,8 @@ export interface ArchilRunFolderOptions {
48
49
  s3BaseUrl?: string;
49
50
  /** Another control plane than the region's, for the SDK's client. */
50
51
  baseUrl?: string;
51
- /** The SDK's Archil client; default the host's `disk` package's. */
52
+ /** The SDK's Archil client; default the `disk` package's. */
52
53
  Archil?: ArchilConstructor;
53
- /** For tests: the package the SDK's client is imported from; default `disk`. */
54
- sdkPackage?: string;
55
54
  }
56
55
  /**
57
56
  * The Archil mount cases' settings from the COMPUTER_ARCHIL_* names (ARCHIL_ENV); undefined when none is set. Some set
@@ -66,3 +65,14 @@ export declare function archilSettings(env: Record<string, string | undefined>):
66
65
  * the case read back), and the folder's other keys are the disk's to keep.
67
66
  */
68
67
  export declare function archilRunFolder(options: ArchilRunFolderOptions): Promise<RunFolder>;
68
+ /** What a module's mountFor takes: where the settings are read, and the object API or client in place of the SDK's. */
69
+ export interface ArchilMountOptions {
70
+ env?: Record<string, string | undefined>;
71
+ /** For mountFor("archil"): the disk's object API, or the SDK's Archil client, in place of the `disk` package's. */
72
+ archil?: Pick<ArchilRunFolderOptions, "objects" | "Archil" | "baseUrl">;
73
+ }
74
+ /**
75
+ * A module's mountFor: a fresh run folder for an Archil mount on the disk the COMPUTER_ARCHIL_* names name, none for any
76
+ * other kind or when they name none. Reaching it is a call to Archil, so it needs the module's live switch.
77
+ */
78
+ export declare function archilMountFor(live: (env: Record<string, string | undefined>) => void): (kind: MountKind, options?: ArchilMountOptions) => Promise<RunFolder | undefined>;
@@ -1,7 +1,7 @@
1
- // The Archil run folder for the mount cases, shared by every remote provider's conformance module (Daytona, Modal,
2
- // E2B): a fresh agents/<agent>/runs/<run>/work on the owner's disk, the mount that reaches it from inside a computer,
3
- // and its outside, read and written through the disk's object API. The object API is given, or the host's own Archil
4
- // SDK (the npm package `disk`, not a dependency of this package, imported only here and only when asked): `new Archil({
1
+ // The Archil run folder for the mount cases, shared by every remote provider's conformance module: a fresh
2
+ // agents/<agent>/runs/<run>/work on the owner's disk, the mount that reaches it from inside a computer,
3
+ // and its outside, read and written through the disk's object API. The object API is given, or Archil's Node SDK (the
4
+ // npm package `disk`, an optional dependency of this package, loaded only here and only when asked): `new Archil({
5
5
  // apiKey, region, s3BaseUrl })`, then `disks.get(disk)`, whose disk has getObject, putObject and deleteObject with keys
6
6
  // relative to the disk's root, and rejects with the HTTP `status` when there was an answer (404: not there). Every
7
7
  // setting is passed to the SDK, so it reads none of its own from the environment.
@@ -11,6 +11,7 @@
11
11
  // module reads them from the COMPUTER_ARCHIL_* names ARCHIL_ENV lists (archilSettings).
12
12
  import { randomBytes } from "node:crypto";
13
13
  import { ARCHIL_REGION } from "../mount-archil.js";
14
+ import { vendorSdk } from "../vendor-sdk.js";
14
15
  /** The settings of the Archil mount cases, by the names a conformance module reads them from. */
15
16
  export const ARCHIL_ENV = {
16
17
  /** The disk the run folders are made on: dsk-<16 hex digits>, or owner/name. */
@@ -24,8 +25,6 @@ export const ARCHIL_ENV = {
24
25
  /** The disk's S3-compatible endpoint, https on an Archil host of the region: the key goes to it. */
25
26
  archilS3Url: "COMPUTER_ARCHIL_S3_URL",
26
27
  };
27
- /** Not a literal, so no type checker or bundler resolves the SDK from this package. */
28
- const ARCHIL_PACKAGE = "disk";
29
28
  // The shapes the root helper takes (box/agentrun-archil), so a run folder is one a computer can mount.
30
29
  const DISK = /^(?:dsk-[0-9a-f]{16}|[A-Za-z0-9][A-Za-z0-9._@+-]{0,127}\/[A-Za-z0-9][A-Za-z0-9._-]{0,127})$/;
31
30
  const REGION = new RegExp(`^${ARCHIL_REGION}$`);
@@ -79,19 +78,10 @@ function failure(what, error, apiKey) {
79
78
  return Object.assign(new Error(`${what}: ${message}`), typeof status === "number" ? { status } : {});
80
79
  }
81
80
  /** The disk's object API from the SDK's client: every setting given, the disk looked up once. */
82
- async function sdkObjects({ disk, region, apiKey, s3BaseUrl, baseUrl, Archil, sdkPackage = ARCHIL_PACKAGE }) {
81
+ async function sdkObjects({ disk, region, apiKey, s3BaseUrl, baseUrl, Archil }) {
83
82
  if (!apiKey || !s3BaseUrl)
84
83
  throw new Error(`the Archil run folder reaches its disk through the object API: give objects, or apiKey and s3BaseUrl (${ARCHIL_ENV.archilKey}, ${ARCHIL_ENV.archilS3Url})`);
85
- let Client = Archil;
86
- if (Client === undefined) {
87
- try {
88
- Client = (await import(sdkPackage)).Archil;
89
- }
90
- catch (error) {
91
- const why = (error instanceof Error ? error.message : String(error)).replaceAll(apiKey, "[key]").slice(0, 200);
92
- throw new Error(`the Archil run folder needs Archil's Node SDK, the package ${JSON.stringify(sdkPackage)}: it is serve's dependency, pinned in the lockfile, so npm ci at the repository root installs it (${why})`);
93
- }
94
- }
84
+ const Client = Archil ?? (await vendorSdk("Archil", "disk")).Archil;
95
85
  try {
96
86
  return await new Client({ apiKey, region, s3BaseUrl, ...(baseUrl === undefined ? {} : { baseUrl }) }).disks.get(disk);
97
87
  }
@@ -150,3 +140,18 @@ export async function archilRunFolder(options) {
150
140
  },
151
141
  };
152
142
  }
143
+ /**
144
+ * A module's mountFor: a fresh run folder for an Archil mount on the disk the COMPUTER_ARCHIL_* names name, none for any
145
+ * other kind or when they name none. Reaching it is a call to Archil, so it needs the module's live switch.
146
+ */
147
+ export function archilMountFor(live) {
148
+ return async (kind, { env = process.env, archil = {} } = {}) => {
149
+ if (kind !== "archil")
150
+ return undefined;
151
+ const settings = archilSettings(env);
152
+ if (settings === undefined)
153
+ return undefined;
154
+ live(env);
155
+ return archilRunFolder({ ...settings, ...archil });
156
+ };
157
+ }
@@ -1,6 +1,6 @@
1
1
  import { type BoxdOptions, type BoxdProvider } from "../boxd.js";
2
- import type { MachineHost } from "../host.js";
3
- /** The environment this module reads, by name, each for the option its comment names, the live switch and the run's image. */
2
+ import { type Env, type HostedModuleOptions } from "./module-kit.js";
3
+ export { CONFORMANCE_MAX_LIFETIME_MS } from "./module-kit.js";
4
4
  export declare const BOXD_ENV: {
5
5
  readonly live: "AGENTRUN_COMPUTER_LIVE_BOXD";
6
6
  /** The image every computer of the run starts from: "default" (boxd's own), or a snapshot's name; unset, a desktop's is the desktop snapshot. */
@@ -18,7 +18,6 @@ export declare const BOXD_ENV: {
18
18
  /** daemonUser: uid:gid the daemon runs as; default 2510:2510. */
19
19
  readonly user: "COMPUTER_BOXD_USER";
20
20
  };
21
- /** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
22
21
  export declare const ENV: {
23
22
  readonly live: "AGENTRUN_COMPUTER_LIVE_BOXD";
24
23
  /** The image every computer of the run starts from: "default" (boxd's own), or a snapshot's name; unset, a desktop's is the desktop snapshot. */
@@ -38,21 +37,14 @@ export declare const ENV: {
38
37
  };
39
38
  /** What this module reads from the environment: the key, and each other option whose name is set. */
40
39
  export type BoxdSettings = Pick<BoxdOptions, "apiKey" | "org" | "region" | "daemonPath" | "kind" | "daemonUser">;
41
- /**
42
- * The provider's options this module reads from env, each only when its name is set; throws in words without the key,
43
- * never echoing it. create() checks the rest.
44
- */
45
- export declare function settingsFromEnv(env?: Record<string, string | undefined>): BoxdSettings;
46
- /** The longest lifetime a computer of a run may ask for. */
47
- export declare const CONFORMANCE_MAX_LIFETIME_MS: number;
48
- /** For the run's report: what this configuration means for the suite. */
40
+ /** The provider's options this module reads from env, each only when its name is set; throws in words without the key, never echoing it. */
41
+ export declare function settingsFromEnv(env?: Env): BoxdSettings;
49
42
  export declare const conformanceNotes: string[];
50
- export interface BoxdModuleOptions extends Pick<BoxdOptions, "Boxd" | "daemonPath" | "timeouts"> {
51
- /** Where the settings are read; default process.env. */
52
- env?: Record<string, string | undefined>;
53
- /** Builds this package's daemon for linux/amd64 stamped with version, and gives its path; default go build. */
54
- buildDaemon?: (version: string) => Promise<string>;
43
+ export interface BoxdModuleOptions extends HostedModuleOptions, Pick<BoxdOptions, "Boxd" | "daemonPath" | "timeouts" | "onNote"> {
55
44
  }
45
+ export declare const createProvider: (options?: BoxdModuleOptions | undefined) => Promise<BoxdProvider>, createDriftedProvider: (options?: BoxdModuleOptions | undefined) => Promise<BoxdProvider>, createHost: (options?: BoxdModuleOptions | undefined) => Promise<import("../host.js").MachineHost>, sweepScope: (options?: {
46
+ env?: Env;
47
+ }) => string;
56
48
  /**
57
49
  * The image every computer of the run starts from: COMPUTER_BOXD_IMAGE, else boxd's own, else for kind desktop the
58
50
  * desktop snapshot, which the run's provider finds or builds in the key's org first (prepareImage, live).
@@ -60,18 +52,3 @@ export interface BoxdModuleOptions extends Pick<BoxdOptions, "Boxd" | "daemonPat
60
52
  export declare function conformanceImage(options?: BoxdModuleOptions, { signal }?: {
61
53
  signal?: AbortSignal;
62
54
  }): Promise<string>;
63
- /** The provider the CLI runs; throws in words without the live switch, or when a setting is missing or wrong. */
64
- export declare function createProvider({ env, Boxd, daemonPath, timeouts }?: BoxdModuleOptions): Promise<BoxdProvider>;
65
- /**
66
- * The boxd host the live sweep (sweep.ts) lists and deletes through, from the same settings; it needs no live switch,
67
- * since the sweep makes nothing, and it calls nothing until the sweep does.
68
- */
69
- export declare function createHost({ env, Boxd }?: Pick<BoxdModuleOptions, "env" | "Boxd">): Promise<MachineHost>;
70
- /**
71
- * Where the sweep lists, in words: the org and region the settings name, under the key named by its sha256 prefix alone.
72
- * A before file listed with another key, org or region would make every computer there read as new, so the sweep
73
- * refuses it.
74
- */
75
- export declare function sweepScope({ env }?: Pick<BoxdModuleOptions, "env">): string;
76
- /** The same provider uploading a daemon that reports version <version>-drift, for the drift.version case. */
77
- export declare function createDriftedProvider({ env, Boxd, timeouts, buildDaemon }?: BoxdModuleOptions): Promise<BoxdProvider>;
@@ -1,20 +1,11 @@
1
1
  // boxd for the conformance CLI: `npm run conformance -w @parcha/agentrun-computer -- --provider boxd [--image <snapshot>]`.
2
2
  // It makes real machines, so it runs only with AGENTRUN_COMPUTER_LIVE_BOXD=1 and your own key, under
3
- // COMPUTER_BOXD_API_KEY. The provider reads no environment: this module reads its own COMPUTER_BOXD_* names (never
4
- // BOXD_API_KEY, which may hold another account's key) and passes each to create() as its option. The live switch is
5
- // checked first, before any other setting is read. The live sweep (sweep.ts, --provider boxd) reads the same names
6
- // through createHost, which needs no live switch: it makes nothing; sweepScope names the key, org and region a before
7
- // file must have been listed from.
8
- //
9
- // The daemon is uploaded into each machine (dist/computerd-linux-amd64, `npm run build:daemon`), so a run publishes
10
- // nothing. The drifted provider uploads a daemon built with Go as version <version>-drift. Every computer of a run has
11
- // a deadline of at most 30 minutes, and the runner sweeps the run's computers by its label when it ends.
12
- import { createHash } from "node:crypto";
13
- import { BOXD_DEFAULT_IMAGE } from "../descriptors/boxd.js";
3
+ // COMPUTER_BOXD_API_KEY (never BOXD_API_KEY, which may hold another account's key). Every computer of a run has a
4
+ // deadline of at most 30 minutes, and the runner sweeps the run's computers by its label when it ends.
14
5
  import { create } from "../boxd.js";
15
- import { buildDriftDaemon, DRIFT_VERSION } from "./drift-daemon.js";
16
- import { kindFrom } from "./kind.js";
17
- /** The environment this module reads, by name, each for the option its comment names, the live switch and the run's image. */
6
+ import { BOXD_DEFAULT_IMAGE } from "../descriptors/boxd.js";
7
+ import { hostedModule, keyPrint, kindFrom, preparedImage, requiredSecret, setOptions } from "./module-kit.js";
8
+ export { CONFORMANCE_MAX_LIFETIME_MS } from "./module-kit.js";
18
9
  export const BOXD_ENV = {
19
10
  live: "AGENTRUN_COMPUTER_LIVE_BOXD",
20
11
  /** The image every computer of the run starts from: "default" (boxd's own), or a snapshot's name; unset, a desktop's is the desktop snapshot. */
@@ -32,39 +23,25 @@ export const BOXD_ENV = {
32
23
  /** daemonUser: uid:gid the daemon runs as; default 2510:2510. */
33
24
  user: "COMPUTER_BOXD_USER",
34
25
  };
35
- /** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
36
26
  export const ENV = BOXD_ENV;
37
- /**
38
- * The provider's options this module reads from env, each only when its name is set; throws in words without the key,
39
- * never echoing it. create() checks the rest.
40
- */
27
+ /** The provider's options this module reads from env, each only when its name is set; throws in words without the key, never echoing it. */
41
28
  export function settingsFromEnv(env = process.env) {
42
- const apiKey = env[BOXD_ENV.key];
43
- if (apiKey === undefined || apiKey === "")
44
- throw new Error(`set ${BOXD_ENV.key} to a boxd API key: the conformance module reads it there and nowhere else, never from BOXD_API_KEY`);
45
- const org = env[BOXD_ENV.org] || undefined;
46
- const region = env[BOXD_ENV.region] || undefined;
47
- const daemonPath = env[BOXD_ENV.daemon] || undefined;
48
- const daemonUser = env[BOXD_ENV.user] || undefined;
49
- return {
50
- apiKey,
51
- ...(org === undefined ? {} : { org }),
52
- ...(region === undefined ? {} : { region }),
53
- ...(daemonPath === undefined ? {} : { daemonPath }),
54
- ...kindFrom(env, BOXD_ENV.kind),
55
- ...(daemonUser === undefined ? {} : { daemonUser }),
56
- };
29
+ const apiKey = requiredSecret(env, BOXD_ENV.key, "a boxd API key");
30
+ return { apiKey, ...setOptions(env, { org: BOXD_ENV.org, region: BOXD_ENV.region, daemonPath: BOXD_ENV.daemon, daemonUser: BOXD_ENV.user }), ...kindFrom(env, BOXD_ENV.kind) };
57
31
  }
58
- /** The longest lifetime a computer of a run may ask for. */
59
- export const CONFORMANCE_MAX_LIFETIME_MS = 30 * 60_000;
60
- /** For the run's report: what this configuration means for the suite. */
61
32
  export const conformanceNotes = [
62
33
  "boxd: every computer is an isolated boxd machine with the egress allowlist none, no standby and no hibernation; the daemon is a child of boxd's own agent, started as a detached root command; lifetime is the janitor's, by the deadline label, capped at 30 minutes for the run; no stream() (a screen is streamed through agentrun), so screen.stream is skipped. Kind desktop (COMPUTER_BOXD_KIND=desktop) starts from agentrun-desktop-<recipe hash>, boxd's own image with Xfce's text editor added, a snapshot the run's provider finds or builds in the key's org first (prepareImage), with Xvfb on :0 started through the daemon as the tool user.",
63
34
  ];
64
- function live(env) {
65
- if (env[BOXD_ENV.live] !== "1")
66
- throw new Error(`the boxd conformance module makes real machines: set ${BOXD_ENV.live}=1, with your own key, to run it`);
67
- }
35
+ export const { createProvider, createDriftedProvider, createHost, sweepScope } = hostedModule({
36
+ live: { name: BOXD_ENV.live, what: "the boxd conformance module makes real machines", whose: "your own key" },
37
+ settingsFromEnv,
38
+ create,
39
+ host: ["Boxd"],
40
+ run: ["timeouts", "onNote"],
41
+ runDefined: ["daemonPath"],
42
+ // A before file listed with another key, org or region would make every computer there read as new, so the sweep refuses it.
43
+ scope: ({ apiKey, org, region }) => `the boxd org ${org ?? "of the key"} in the region ${region ?? "home"}, with the key ${keyPrint(apiKey)}`,
44
+ });
68
45
  /**
69
46
  * The image every computer of the run starts from: COMPUTER_BOXD_IMAGE, else boxd's own, else for kind desktop the
70
47
  * desktop snapshot, which the run's provider finds or builds in the key's org first (prepareImage, live).
@@ -76,37 +53,5 @@ export async function conformanceImage(options = {}, { signal } = {}) {
76
53
  return named;
77
54
  if (env[BOXD_ENV.kind] !== "desktop")
78
55
  return BOXD_DEFAULT_IMAGE;
79
- const ready = await (await createProvider(options)).prepareImage(signal ? { signal } : {});
80
- if (!ready.ok)
81
- throw new Error(ready.error.message);
82
- return ready.value;
83
- }
84
- /** The provider the CLI runs; throws in words without the live switch, or when a setting is missing or wrong. */
85
- export async function createProvider({ env = process.env, Boxd, daemonPath, timeouts } = {}) {
86
- live(env);
87
- return create({ ...settingsFromEnv(env), ...(Boxd ? { Boxd } : {}), ...(daemonPath === undefined ? {} : { daemonPath }), ...(timeouts ? { timeouts } : {}), maxLifetimeMs: CONFORMANCE_MAX_LIFETIME_MS });
88
- }
89
- /**
90
- * The boxd host the live sweep (sweep.ts) lists and deletes through, from the same settings; it needs no live switch,
91
- * since the sweep makes nothing, and it calls nothing until the sweep does.
92
- */
93
- export async function createHost({ env = process.env, Boxd } = {}) {
94
- return (await create({ ...settingsFromEnv(env), ...(Boxd ? { Boxd } : {}) })).host;
95
- }
96
- /**
97
- * Where the sweep lists, in words: the org and region the settings name, under the key named by its sha256 prefix alone.
98
- * A before file listed with another key, org or region would make every computer there read as new, so the sweep
99
- * refuses it.
100
- */
101
- export function sweepScope({ env = process.env } = {}) {
102
- const { apiKey, org, region } = settingsFromEnv(env);
103
- const key = createHash("sha256").update(apiKey, "utf8").digest("hex").slice(0, 12);
104
- return `the boxd org ${org ?? "of the key"} in the region ${region ?? "home"}, with the key sha256:${key}`;
105
- }
106
- /** The same provider uploading a daemon that reports version <version>-drift, for the drift.version case. */
107
- export async function createDriftedProvider({ env = process.env, Boxd, timeouts, buildDaemon = (version) => buildDriftDaemon("amd64", version) } = {}) {
108
- live(env);
109
- const settings = settingsFromEnv(env);
110
- const daemonPath = await buildDaemon(DRIFT_VERSION);
111
- return create({ ...settings, ...(Boxd ? { Boxd } : {}), ...(timeouts ? { timeouts } : {}), daemonPath, maxLifetimeMs: CONFORMANCE_MAX_LIFETIME_MS });
56
+ return preparedImage(await createProvider(options), signal);
112
57
  }
@@ -1,5 +1,5 @@
1
1
  import { type BrowserbaseProvider, type BrowserbaseProviderOptions } from "../browserbase.js";
2
- /** The environment this module reads, by name, each for the option its comment names, and the live switch. */
2
+ import { type Env } from "./module-kit.js";
3
3
  export declare const BROWSERBASE_ENV: {
4
4
  readonly live: "AGENTRUN_COMPUTER_LIVE_BROWSERBASE";
5
5
  /** apiKey, required: the Browserbase API key. */
@@ -9,7 +9,6 @@ export declare const BROWSERBASE_ENV: {
9
9
  /** apiUrl: Browserbase's API; default https://api.browserbase.com. */
10
10
  readonly url: "COMPUTER_BROWSERBASE_API_URL";
11
11
  };
12
- /** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
13
12
  export declare const ENV: {
14
13
  readonly live: "AGENTRUN_COMPUTER_LIVE_BROWSERBASE";
15
14
  /** apiKey, required: the Browserbase API key. */
@@ -22,12 +21,10 @@ export declare const ENV: {
22
21
  /** What this module reads from the environment: the key, and each other option whose name is set. */
23
22
  export type BrowserbaseSettings = Pick<BrowserbaseProviderOptions, "apiKey" | "projectId" | "apiUrl">;
24
23
  /** The provider's options this module reads from env, each only when its name is set; throws in words without the key, never echoing one. */
25
- export declare function settingsFromEnv(env?: Record<string, string | undefined>): BrowserbaseSettings;
26
- /** For the run's report: what this configuration means for the suite. */
24
+ export declare function settingsFromEnv(env?: Env): BrowserbaseSettings;
27
25
  export declare const conformanceNotes: string[];
28
26
  export interface BrowserbaseModuleOptions extends Pick<BrowserbaseProviderOptions, "fetch" | "sleep" | "confirm"> {
29
- /** Where the settings are read; default process.env. */
30
- env?: Record<string, string | undefined>;
27
+ env?: Env;
31
28
  }
32
29
  /** The image every computer of the run asks for: the vendor's Chromium. */
33
30
  export declare function conformanceImage(): string;
@@ -1,12 +1,10 @@
1
1
  // Browserbase for the conformance CLI: `npm run conformance -w @parcha/agentrun-computer -- --provider browserbase`.
2
2
  // It makes a real, billed Browserbase session, so it runs only with AGENTRUN_COMPUTER_LIVE_BROWSERBASE=1 and a key for
3
- // an account you can bill, under COMPUTER_BROWSERBASE_API_KEY (and COMPUTER_BROWSERBASE_PROJECT_ID for a direct key). The provider
4
- // reads no environment: this module reads its own COMPUTER_BROWSERBASE_* names (never BROWSERBASE_API_KEY, which may
5
- // hold another project's key) and passes each to create() as its option. The live switch is checked first, before any
6
- // other setting is read. The run makes one session, shared by every case, and releases it.
3
+ // an account you can bill, under COMPUTER_BROWSERBASE_API_KEY (and COMPUTER_BROWSERBASE_PROJECT_ID for a direct key),
4
+ // never BROWSERBASE_API_KEY, which may hold another project's key.
7
5
  import { BROWSER_IMAGE } from "../descriptors/shared.js";
8
6
  import { create } from "../browserbase.js";
9
- /** The environment this module reads, by name, each for the option its comment names, and the live switch. */
7
+ import { requiredSecret, requireLive, setOptions } from "./module-kit.js";
10
8
  export const BROWSERBASE_ENV = {
11
9
  live: "AGENTRUN_COMPUTER_LIVE_BROWSERBASE",
12
10
  /** apiKey, required: the Browserbase API key. */
@@ -16,19 +14,12 @@ export const BROWSERBASE_ENV = {
16
14
  /** apiUrl: Browserbase's API; default https://api.browserbase.com. */
17
15
  url: "COMPUTER_BROWSERBASE_API_URL",
18
16
  };
19
- /** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
20
17
  export const ENV = BROWSERBASE_ENV;
21
18
  /** The provider's options this module reads from env, each only when its name is set; throws in words without the key, never echoing one. */
22
19
  export function settingsFromEnv(env = process.env) {
23
- const apiKey = env[BROWSERBASE_ENV.key];
24
- if (apiKey === undefined || apiKey === "") {
25
- throw new Error(`set ${BROWSERBASE_ENV.key} to a Browserbase API key: the conformance module reads it there and nowhere else, never from BROWSERBASE_API_KEY`);
26
- }
27
- const projectId = env[BROWSERBASE_ENV.project] || undefined;
28
- const apiUrl = env[BROWSERBASE_ENV.url] || undefined;
29
- return { apiKey, ...(projectId === undefined ? {} : { projectId }), ...(apiUrl === undefined ? {} : { apiUrl }) };
20
+ const apiKey = requiredSecret(env, BROWSERBASE_ENV.key, "a Browserbase API key");
21
+ return { apiKey, ...setOptions(env, { projectId: BROWSERBASE_ENV.project, apiUrl: BROWSERBASE_ENV.url }) };
30
22
  }
31
- /** For the run's report: what this configuration means for the suite. */
32
23
  export const conformanceNotes = [
33
24
  "browserbase: one session for the whole run, released by its last case (browser.release) and again at the run's end; Browserbase bills at least one minute of it. Browserbase keeps a session's downloads and recordings; the suite does not test them.",
34
25
  ];
@@ -38,8 +29,6 @@ export function conformanceImage() {
38
29
  }
39
30
  /** The provider the CLI runs; throws in words without the live switch, or when the key is missing. */
40
31
  export async function createProvider({ env = process.env, ...transport } = {}) {
41
- if (env[BROWSERBASE_ENV.live] !== "1") {
42
- throw new Error(`the Browserbase conformance module makes a real, billed session: set ${BROWSERBASE_ENV.live}=1, with a key for an account you can bill, to run it`);
43
- }
32
+ requireLive(env, BROWSERBASE_ENV.live, "the Browserbase conformance module makes a real, billed session", "a key for an account you can bill");
44
33
  return create({ ...settingsFromEnv(env), ...transport });
45
34
  }
@@ -1,6 +1,6 @@
1
1
  // The daemon answers: hello, ping, and an error in words for a method it does not have; the computer is the kind it
2
- // says it is; what the provider declares of itself, its capabilities() and each hello agree, at this protocol's
3
- // version; and no error the provider answers holds a key.
2
+ // says it is; what the provider declares of itself, its capabilities() and each hello agree, at exactly the suite's
3
+ // protocol version; and no error the provider answers holds a key.
4
4
  import { GROUPS, PROTOCOL_VERSION } from "../../protocol.js";
5
5
  import { kindServed } from "../../kinds.js";
6
6
  import { kindRefusals } from "../../provider.js";
@@ -93,7 +93,10 @@ export const healthCases = [
93
93
  group: "health",
94
94
  needs: [],
95
95
  async run(t) {
96
- t.equal(t.hello.protocol, PROTOCOL_VERSION, `hello carries the protocol version this suite speaks, ${PROTOCOL_VERSION}`);
96
+ // A provider is certified by the suite of its own version, so its computers speak that version exactly: the
97
+ // tolerance of a later minor (helloProblem) is the wire's, between a server and a driver built apart.
98
+ const protocol = t.hello.protocol;
99
+ t.assert(protocol === PROTOCOL_VERSION, `hello: the computer speaks protocol ${protocol === undefined || protocol === null ? "none" : String(protocol)}, and this suite ${PROTOCOL_VERSION}`);
97
100
  const declared = t.declared;
98
101
  if (declared === undefined) {
99
102
  return t.skip("the run was given no declaration of the provider: its descriptor, its PROVIDERS entry, or its module's CAPABILITIES");
@@ -185,7 +185,10 @@ export const providerCases = [
185
185
  const made = t.ok(first, "create");
186
186
  t.deepEqual(refOf(t.ok(early, "the same create again while the first starts")), refOf(made), "the computer a create retried while it starts answers");
187
187
  t.deepEqual(refOf(t.ok(await t.attempt(spec, t.provider, requestId), "the same create again once it is up")), refOf(made), "the computer a create retried once it is up answers");
188
- t.equal(made.name, computerNameFor(requestId), "the computer's name, computer-<12 hex of sha256(request id)>");
188
+ // The request's name (computerNameFor) is the computer's, or begins it before a dash: a vendor whose name also
189
+ // carries what list reads (Orgo's deadline) puts that after it.
190
+ const request = computerNameFor(requestId);
191
+ t.assert(made.name === request || made.name.startsWith(`${request}-`), `the computer's name is ${request} (computer-<12 hex of sha256(request id)>), or begins with it and a dash: got ${made.name}`);
189
192
  t.deepEqual(await names(t, labels), [made.name], "the computers three creates of one request made");
190
193
  const other = t.refused(await t.attempt(t.spec({ labels: { ...labels, role: "other" } }), t.provider, requestId), "the same request id with other labels", ["exists"]);
191
194
  t.assert(other.message.includes(made.name), `the refusal names the request's computer ${made.name}: ${other.message}`);
@@ -1,6 +1,6 @@
1
1
  import { type ProviderEnv } from "../providers.js";
2
2
  import type { CdpDialer } from "./cdp.js";
3
- import type { Case } from "./types.js";
3
+ import type { Case, Clock } from "./types.js";
4
4
  /** A stream as main writes to it: done is called once the text is handed on, as Writable.write's callback is. */
5
5
  export interface Writer {
6
6
  write(text: string, done?: (error?: Error | null) => void): unknown;
@@ -25,6 +25,8 @@ export interface CliIo {
25
25
  providerOptions?: {
26
26
  env?: ProviderEnv;
27
27
  } & Record<string, unknown>;
28
+ /** The clock the run reads, a TTI run's times among it; default the wall clock. A test gives one it moves. */
29
+ clock?: Clock;
28
30
  }
29
31
  /**
30
32
  * A fresh planted value for each secret name, and the text to hunt for in answers. A `*_SSH_KEY` name takes a throwaway