@parcha/agentrun-computer 0.1.0-beta.67 → 0.1.0-beta.69

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 (83) hide show
  1. package/README.md +243 -9
  2. package/box/README.md +8 -0
  3. package/box/install.sh +60 -6
  4. package/dist/boxd.js +43 -8
  5. package/dist/computerd-linux-amd64 +0 -0
  6. package/dist/computerd-linux-arm64 +0 -0
  7. package/dist/computerd.json +1 -1
  8. package/dist/conformance/cli.d.ts +6 -0
  9. package/dist/conformance/cli.js +14 -3
  10. package/dist/conformance/instabox.d.ts +36 -0
  11. package/dist/conformance/instabox.js +43 -0
  12. package/dist/conformance/northflank.d.ts +44 -0
  13. package/dist/conformance/northflank.js +50 -0
  14. package/dist/conformance/sprites.d.ts +32 -0
  15. package/dist/conformance/sprites.js +40 -0
  16. package/dist/conformance/vercel.d.ts +35 -0
  17. package/dist/conformance/vercel.js +43 -0
  18. package/dist/descriptor.d.ts +6 -0
  19. package/dist/descriptor.js +2 -0
  20. package/dist/descriptors/agent37.d.ts +1 -0
  21. package/dist/descriptors/agent37.js +2 -0
  22. package/dist/descriptors/daytona.d.ts +1 -0
  23. package/dist/descriptors/daytona.js +2 -0
  24. package/dist/descriptors/e2b.d.ts +14 -0
  25. package/dist/descriptors/e2b.js +20 -3
  26. package/dist/descriptors/fly.d.ts +1 -0
  27. package/dist/descriptors/fly.js +2 -0
  28. package/dist/descriptors/groundbox.d.ts +1 -0
  29. package/dist/descriptors/groundbox.js +2 -0
  30. package/dist/descriptors/index.d.ts +106 -1
  31. package/dist/descriptors/index.js +8 -2
  32. package/dist/descriptors/instabox.d.ts +20 -0
  33. package/dist/descriptors/instabox.js +22 -0
  34. package/dist/descriptors/modal.d.ts +1 -0
  35. package/dist/descriptors/modal.js +2 -0
  36. package/dist/descriptors/northflank.d.ts +24 -0
  37. package/dist/descriptors/northflank.js +30 -0
  38. package/dist/descriptors/orgo.d.ts +1 -0
  39. package/dist/descriptors/orgo.js +2 -0
  40. package/dist/descriptors/render.d.ts +1 -0
  41. package/dist/descriptors/render.js +2 -0
  42. package/dist/descriptors/sprites.d.ts +19 -0
  43. package/dist/descriptors/sprites.js +19 -0
  44. package/dist/descriptors/vercel.d.ts +23 -0
  45. package/dist/descriptors/vercel.js +24 -0
  46. package/dist/docker/egress-main.js +17 -10
  47. package/dist/docker/egress-proxy.d.ts +7 -0
  48. package/dist/docker/egress-proxy.js +12 -0
  49. package/dist/docker/egress.d.ts +3 -1
  50. package/dist/docker/egress.js +11 -4
  51. package/dist/docker/image.d.ts +8 -2
  52. package/dist/docker/image.js +24 -3
  53. package/dist/docker.d.ts +6 -0
  54. package/dist/docker.js +15 -5
  55. package/dist/e2b.d.ts +25 -10
  56. package/dist/e2b.js +36 -16
  57. package/dist/groundbox.js +15 -2
  58. package/dist/hosted/download.d.ts +16 -0
  59. package/dist/hosted/download.js +108 -2
  60. package/dist/hosted/provider.js +25 -12
  61. package/dist/hosted/rest.js +23 -1
  62. package/dist/hosted/scripts.d.ts +2 -0
  63. package/dist/hosted/scripts.js +29 -0
  64. package/dist/hosted/ssh-exec.d.ts +17 -2
  65. package/dist/hosted/ssh-exec.js +17 -6
  66. package/dist/index.d.ts +2 -1
  67. package/dist/index.js +2 -1
  68. package/dist/instabox.d.ts +30 -0
  69. package/dist/instabox.js +424 -0
  70. package/dist/northflank.d.ts +44 -0
  71. package/dist/northflank.js +448 -0
  72. package/dist/orgo-desktop.js +2 -2
  73. package/dist/orgo-names.d.ts +15 -1
  74. package/dist/orgo-names.js +13 -0
  75. package/dist/orgo.d.ts +10 -0
  76. package/dist/orgo.js +64 -4
  77. package/dist/providers.d.ts +10 -4
  78. package/dist/render.js +4 -3
  79. package/dist/sprites.d.ts +37 -0
  80. package/dist/sprites.js +309 -0
  81. package/dist/vercel.d.ts +26 -0
  82. package/dist/vercel.js +262 -0
  83. package/package.json +22 -2
@@ -1,4 +1,5 @@
1
1
  import { type ProviderEnv } from "../providers.js";
2
+ import { type ExecStreamOptions } from "./exec-stream.js";
2
3
  import type { CdpDialer } from "./cdp.js";
3
4
  import type { Case, Clock } from "./types.js";
4
5
  /** A stream as main writes to it: done is called once the text is handed on, as Writable.write's callback is. */
@@ -25,6 +26,11 @@ export interface CliIo {
25
26
  providerOptions?: {
26
27
  env?: ProviderEnv;
27
28
  } & Record<string, unknown>;
29
+ /**
30
+ * --exec-stream's bounds, over its defaults (each named in ExecStreamOptions; longMs over --quick's too). A test gives
31
+ * shorter ones, so a pre-check of a good exec does not sit out the 10 s stdout is left unread.
32
+ */
33
+ execStreamBounds?: Pick<ExecStreamOptions, "longMs" | "stepMs" | "largeBytes" | "largeMs" | "unreadMs">;
28
34
  /** The clock the run reads, a TTI run's times among it; default the wall clock. A test gives one it moves. */
29
35
  clock?: Clock;
30
36
  }
@@ -266,7 +266,8 @@ export function plantSecrets(names) {
266
266
  /**
267
267
  * The provider a conformance module makes, its drifted twin and its run folders (mountFor) when it offers them, and what
268
268
  * it says of its run: conformanceImage(), the image when --image names none (asked only then: a module's may make or
269
- * register its image, so it is given the run's signal), and conformanceNotes, strings for the report.
269
+ * register its image, so it is given the run's signal), conformanceNotes, strings for the report, and
270
+ * conformanceClock, the clock its provider's timers run on.
270
271
  */
271
272
  async function load(label, module, options, { imageNamed, signal }, declared) {
272
273
  const { createProvider, createDriftedProvider, conformanceImage, mountFor, dialKit } = module;
@@ -309,6 +310,13 @@ async function load(label, module, options, { imageNamed, signal }, declared) {
309
310
  throw new Usage(`${label}: conformanceNotes is not an array of strings`);
310
311
  target.notes = notes;
311
312
  }
313
+ const clock = module.conformanceClock;
314
+ if (clock !== undefined) {
315
+ const { now, sleep } = (clock ?? {});
316
+ if (typeof now !== "function" || typeof sleep !== "function")
317
+ throw new Usage(`${label}: conformanceClock is not a clock: it has no now() and sleep(ms)`);
318
+ target.clock = clock;
319
+ }
312
320
  return target;
313
321
  }
314
322
  /**
@@ -338,6 +346,7 @@ async function execStreamMain(name, { machine, quick }, json, cwd, io) {
338
346
  }
339
347
  const report = await checkExecStream(host, machine, {
340
348
  longMs: quick ? QUICK_LONG_MS : DEFAULT_LONG_MS,
349
+ ...io.execStreamBounds,
341
350
  ...(signal ? { signal } : {}),
342
351
  ...(progress ? { onCheck: (check) => stderr.write(`${check.status === "pass" ? "✓" : "✗"} ${check.id}\n`) } : {}),
343
352
  });
@@ -378,6 +387,8 @@ export async function main(argv, io = {}) {
378
387
  }
379
388
  return 1;
380
389
  }
390
+ // The test's clock, else the module's, else the runner's wall clock.
391
+ const clock = io.clock ?? target.clock;
381
392
  const onResult = progress ? (r) => stderr.write(`${r.status === "pass" ? "✓" : r.status === "fail" ? "✗" : "-"} ${r.id}\n`) : undefined;
382
393
  if (args.tti !== undefined || args.burst !== undefined) {
383
394
  const report = await measureTti(target.provider, {
@@ -387,7 +398,7 @@ export async function main(argv, io = {}) {
387
398
  ...(args.run ? { run: args.run } : {}),
388
399
  ...(target.notes && target.notes.length > 0 ? { notes: target.notes } : {}),
389
400
  ...(signal ? { signal } : {}),
390
- ...(io.clock ? { clock: io.clock } : {}),
401
+ ...(clock ? { clock } : {}),
391
402
  ...(onResult ? { onResult } : {}),
392
403
  });
393
404
  if (providerNotes.length > 0)
@@ -415,7 +426,7 @@ export async function main(argv, io = {}) {
415
426
  ...(target.dial ? { dial: target.dial } : {}),
416
427
  ...(onResult ? { onResult } : {}),
417
428
  ...(io.cdp ? { cdp: io.cdp } : {}),
418
- ...(io.clock ? { clock: io.clock } : {}),
429
+ ...(clock ? { clock } : {}),
419
430
  });
420
431
  if (providerNotes.length > 0)
421
432
  report.providerNotes = providerNotes;
@@ -0,0 +1,36 @@
1
+ import { type InstaboxProvider, type InstaboxProviderOptions } from "../instabox.js";
2
+ import { type Env, type HostedModuleOptions } from "./module-kit.js";
3
+ export { CONFORMANCE_MAX_LIFETIME_MS } from "./module-kit.js";
4
+ export declare const INSTABOX_ENV: {
5
+ readonly live: "AGENTRUN_COMPUTER_LIVE_INSTABOX";
6
+ /** apiKey, required: the workspace's API key. */
7
+ readonly key: "COMPUTER_INSTABOX_API_KEY";
8
+ /** The template or snapshot every computer of the run starts from; default minimal. */
9
+ readonly image: "COMPUTER_INSTABOX_IMAGE";
10
+ /** apiUrl: the API's root; default https://api.instabox.sh. */
11
+ readonly apiUrl: "COMPUTER_INSTABOX_API_URL";
12
+ /** daemonPath: the daemon binary; default this package's dist/computerd-linux-amd64. */
13
+ readonly daemon: "COMPUTER_INSTABOX_DAEMON";
14
+ };
15
+ export declare const ENV: {
16
+ readonly live: "AGENTRUN_COMPUTER_LIVE_INSTABOX";
17
+ /** apiKey, required: the workspace's API key. */
18
+ readonly key: "COMPUTER_INSTABOX_API_KEY";
19
+ /** The template or snapshot every computer of the run starts from; default minimal. */
20
+ readonly image: "COMPUTER_INSTABOX_IMAGE";
21
+ /** apiUrl: the API's root; default https://api.instabox.sh. */
22
+ readonly apiUrl: "COMPUTER_INSTABOX_API_URL";
23
+ /** daemonPath: the daemon binary; default this package's dist/computerd-linux-amd64. */
24
+ readonly daemon: "COMPUTER_INSTABOX_DAEMON";
25
+ };
26
+ export type InstaboxSettings = Pick<InstaboxProviderOptions, "apiKey" | "apiUrl" | "daemonPath">;
27
+ /** The provider's options this module reads from env, each only when its name is set; throws in words without a key, never echoing it. */
28
+ export declare function settingsFromEnv(env?: Env): InstaboxSettings;
29
+ export declare const conformanceNotes: string[];
30
+ export interface InstaboxModuleOptions extends HostedModuleOptions, Pick<InstaboxProviderOptions, "ssh2" | "fetch" | "daemonPath" | "timeouts" | "onNote"> {
31
+ }
32
+ export declare const createProvider: (options?: InstaboxModuleOptions | undefined) => Promise<InstaboxProvider>, createDriftedProvider: (options?: InstaboxModuleOptions | undefined) => Promise<InstaboxProvider>, createHost: (options?: InstaboxModuleOptions | undefined) => Promise<import("../host.js").MachineHost>, sweepScope: (options?: {
33
+ env?: Env;
34
+ }) => string;
35
+ /** The image every computer of the run starts from: COMPUTER_INSTABOX_IMAGE, else the minimal template. */
36
+ export declare function conformanceImage({ env }?: Pick<InstaboxModuleOptions, "env">): Promise<string>;
@@ -0,0 +1,43 @@
1
+ // InstaBox for the conformance CLI: `npm run conformance -w @parcha/agentrun-computer -- --provider instabox`. It makes
2
+ // real machines, which bill while they run, so it runs only with AGENTRUN_COMPUTER_LIVE_INSTABOX=1 and a key for a
3
+ // workspace you can bill, on a paid plan (a computer switches off the idle pause, which the free plan refuses), under
4
+ // COMPUTER_INSTABOX_API_KEY (never INSTABOX_API_KEY, which may hold another workspace's key). Every computer of a run
5
+ // has a deadline of at most 30 minutes, which the janitor keeps, and InstaBox's delete timer at its backstop.
6
+ import { INSTABOX_IMAGE } from "../descriptors/instabox.js";
7
+ import { accountOf, create } from "../instabox.js";
8
+ import { hostedModule, requiredSecret, setOptions } from "./module-kit.js";
9
+ export { CONFORMANCE_MAX_LIFETIME_MS } from "./module-kit.js";
10
+ export const INSTABOX_ENV = {
11
+ live: "AGENTRUN_COMPUTER_LIVE_INSTABOX",
12
+ /** apiKey, required: the workspace's API key. */
13
+ key: "COMPUTER_INSTABOX_API_KEY",
14
+ /** The template or snapshot every computer of the run starts from; default minimal. */
15
+ image: "COMPUTER_INSTABOX_IMAGE",
16
+ /** apiUrl: the API's root; default https://api.instabox.sh. */
17
+ apiUrl: "COMPUTER_INSTABOX_API_URL",
18
+ /** daemonPath: the daemon binary; default this package's dist/computerd-linux-amd64. */
19
+ daemon: "COMPUTER_INSTABOX_DAEMON",
20
+ };
21
+ export const ENV = INSTABOX_ENV;
22
+ /** The provider's options this module reads from env, each only when its name is set; throws in words without a key, never echoing it. */
23
+ export function settingsFromEnv(env = process.env) {
24
+ const apiKey = requiredSecret(env, INSTABOX_ENV.key, "an InstaBox API key");
25
+ return { apiKey, ...setOptions(env, { apiUrl: INSTABOX_ENV.apiUrl, daemonPath: INSTABOX_ENV.daemon }) };
26
+ }
27
+ export const conformanceNotes = [
28
+ "instabox: every computer is an InstaBox machine (a Firecracker microVM) from the minimal template unless COMPUTER_INSTABOX_IMAGE names another or a snapshot, its idle pause and maximum run off, its delete timer at the backstop; the daemon is a child, started over SSH through InstaBox's gateway as a token the API mints per machine, the gateway's host key pinned to the fingerprint the token names, and every command goes over that SSH with the machine user's sudo; labels are packed into the machine's metadata; lifetime is the janitor's, by the deadline label, capped at 30 minutes for the run. Network none, open and a list are init's. No Archil mount and no desktop.",
29
+ ];
30
+ export const { createProvider, createDriftedProvider, createHost, sweepScope } = hostedModule({
31
+ live: { name: INSTABOX_ENV.live, what: "the InstaBox conformance module makes real machines, which bill while they run", whose: "a key for a workspace on a paid plan you can bill" },
32
+ settingsFromEnv,
33
+ create,
34
+ host: ["ssh2", "fetch", "timeouts", "onNote"],
35
+ run: [],
36
+ runDefined: ["daemonPath"],
37
+ // One key is one workspace, and one listing covers all of it.
38
+ scope: ({ apiKey, apiUrl }) => accountOf(apiKey, apiUrl),
39
+ });
40
+ /** The image every computer of the run starts from: COMPUTER_INSTABOX_IMAGE, else the minimal template. */
41
+ export async function conformanceImage({ env = process.env } = {}) {
42
+ return env[INSTABOX_ENV.image] || INSTABOX_IMAGE;
43
+ }
@@ -0,0 +1,44 @@
1
+ import { type NorthflankProvider, type NorthflankProviderOptions } from "../northflank.js";
2
+ import { type Env, type HostedModuleOptions } from "./module-kit.js";
3
+ export { CONFORMANCE_MAX_LIFETIME_MS } from "./module-kit.js";
4
+ export declare const NORTHFLANK_ENV: {
5
+ readonly live: "AGENTRUN_COMPUTER_LIVE_NORTHFLANK";
6
+ /** token, required: a Northflank API token that may manage services and run commands in the project. */
7
+ readonly key: "COMPUTER_NORTHFLANK_TOKEN";
8
+ /** projectId, required: your project the run's services live in. */
9
+ readonly project: "COMPUTER_NORTHFLANK_PROJECT_ID";
10
+ /** teamId: the team, for an organisation token alone. */
11
+ readonly team: "COMPUTER_NORTHFLANK_TEAM_ID";
12
+ /** apiUrl: the API's root; default https://api.northflank.com. */
13
+ readonly apiUrl: "COMPUTER_NORTHFLANK_API_URL";
14
+ /** daemonPath: the daemon binary; default this package's dist/computerd-linux-amd64. */
15
+ readonly daemon: "COMPUTER_NORTHFLANK_DAEMON";
16
+ /** The image every computer of the run starts from; default the box image's public tag. */
17
+ readonly image: "COMPUTER_NORTHFLANK_IMAGE";
18
+ };
19
+ export declare const ENV: {
20
+ readonly live: "AGENTRUN_COMPUTER_LIVE_NORTHFLANK";
21
+ /** token, required: a Northflank API token that may manage services and run commands in the project. */
22
+ readonly key: "COMPUTER_NORTHFLANK_TOKEN";
23
+ /** projectId, required: your project the run's services live in. */
24
+ readonly project: "COMPUTER_NORTHFLANK_PROJECT_ID";
25
+ /** teamId: the team, for an organisation token alone. */
26
+ readonly team: "COMPUTER_NORTHFLANK_TEAM_ID";
27
+ /** apiUrl: the API's root; default https://api.northflank.com. */
28
+ readonly apiUrl: "COMPUTER_NORTHFLANK_API_URL";
29
+ /** daemonPath: the daemon binary; default this package's dist/computerd-linux-amd64. */
30
+ readonly daemon: "COMPUTER_NORTHFLANK_DAEMON";
31
+ /** The image every computer of the run starts from; default the box image's public tag. */
32
+ readonly image: "COMPUTER_NORTHFLANK_IMAGE";
33
+ };
34
+ export type NorthflankSettings = Pick<NorthflankProviderOptions, "token" | "projectId" | "teamId" | "apiUrl" | "daemonPath">;
35
+ /** The provider's options this module reads from env, each only when its name is set; throws in words without the token or the project, never echoing the token. */
36
+ export declare function settingsFromEnv(env?: Env): NorthflankSettings;
37
+ export declare const conformanceNotes: string[];
38
+ export interface NorthflankModuleOptions extends HostedModuleOptions, Pick<NorthflankProviderOptions, "fetch" | "webSocket" | "daemonPath" | "timeouts" | "onNote"> {
39
+ }
40
+ export declare const createProvider: (options?: NorthflankModuleOptions | undefined) => Promise<NorthflankProvider>, createDriftedProvider: (options?: NorthflankModuleOptions | undefined) => Promise<NorthflankProvider>, createHost: (options?: NorthflankModuleOptions | undefined) => Promise<import("../host.js").MachineHost>, sweepScope: (options?: {
41
+ env?: Env;
42
+ }) => string;
43
+ /** The image every computer of the run starts from: COMPUTER_NORTHFLANK_IMAGE, else the box image's public tag. */
44
+ export declare function conformanceImage({ env }?: Pick<NorthflankModuleOptions, "env">): Promise<string>;
@@ -0,0 +1,50 @@
1
+ // Northflank for the conformance CLI: `npm run conformance -w @parcha/agentrun-computer -- --provider northflank`. It
2
+ // makes real services, which bill while they run, so it runs only with AGENTRUN_COMPUTER_LIVE_NORTHFLANK=1 and your own
3
+ // token, under COMPUTER_NORTHFLANK_TOKEN (never NORTHFLANK_API_TOKEN or NF_API_TOKEN, which may hold another team's),
4
+ // with your project under COMPUTER_NORTHFLANK_PROJECT_ID (never NF_PROJECT_ID, which Northflank injects into its own
5
+ // services, or NORTHFLANK_PROJECT_ID). Every computer of a run has a deadline of at most 30 minutes, which the janitor keeps.
6
+ import { boxImageRef } from "../box-image.js";
7
+ import { httpsBase } from "../hosted/rest.js";
8
+ import { create, DEFAULT_API_URL } from "../northflank.js";
9
+ import { hostedModule, keyPrint, requiredSecret, setOptions } from "./module-kit.js";
10
+ export { CONFORMANCE_MAX_LIFETIME_MS } from "./module-kit.js";
11
+ export const NORTHFLANK_ENV = {
12
+ live: "AGENTRUN_COMPUTER_LIVE_NORTHFLANK",
13
+ /** token, required: a Northflank API token that may manage services and run commands in the project. */
14
+ key: "COMPUTER_NORTHFLANK_TOKEN",
15
+ /** projectId, required: your project the run's services live in. */
16
+ project: "COMPUTER_NORTHFLANK_PROJECT_ID",
17
+ /** teamId: the team, for an organisation token alone. */
18
+ team: "COMPUTER_NORTHFLANK_TEAM_ID",
19
+ /** apiUrl: the API's root; default https://api.northflank.com. */
20
+ apiUrl: "COMPUTER_NORTHFLANK_API_URL",
21
+ /** daemonPath: the daemon binary; default this package's dist/computerd-linux-amd64. */
22
+ daemon: "COMPUTER_NORTHFLANK_DAEMON",
23
+ /** The image every computer of the run starts from; default the box image's public tag. */
24
+ image: "COMPUTER_NORTHFLANK_IMAGE",
25
+ };
26
+ export const ENV = NORTHFLANK_ENV;
27
+ /** The provider's options this module reads from env, each only when its name is set; throws in words without the token or the project, never echoing the token. */
28
+ export function settingsFromEnv(env = process.env) {
29
+ return {
30
+ token: requiredSecret(env, NORTHFLANK_ENV.key, "a Northflank API token"),
31
+ projectId: requiredSecret(env, NORTHFLANK_ENV.project, "the id of your Northflank project"),
32
+ ...setOptions(env, { teamId: NORTHFLANK_ENV.team, apiUrl: NORTHFLANK_ENV.apiUrl, daemonPath: NORTHFLANK_ENV.daemon }),
33
+ };
34
+ }
35
+ export const conformanceNotes = [
36
+ "northflank: every computer is a Northflank service (a Kata microVM on Northflank Cloud, amd64 unverified) in your project, from the box image, its command sleep infinity; the daemon is a child of a command on the command-exec WebSocket under the pid wrapper, its stdio the socket's latin1 text messages; labels are packed into the workload's annotations; lifetime is the janitor's, by the deadline label, capped at 30 minutes for the run, with the service's expiry at the backstop. Network none, open and a list are init's. No Archil mount and no desktop.",
37
+ ];
38
+ export const { createProvider, createDriftedProvider, createHost, sweepScope } = hostedModule({
39
+ live: { name: NORTHFLANK_ENV.live, what: "the Northflank conformance module makes real services, which bill while they run", whose: "your own token and project" },
40
+ settingsFromEnv,
41
+ create,
42
+ host: ["fetch", "webSocket", "daemonPath", "timeouts"],
43
+ run: ["onNote"],
44
+ // The project (and team), the token named by its sha256 prefix alone.
45
+ scope: ({ token, projectId, teamId, apiUrl }) => `the Northflank project ${projectId}${teamId === undefined ? "" : ` of team ${teamId}`} at ${httpsBase(apiUrl ?? DEFAULT_API_URL, `the Northflank API URL (${NORTHFLANK_ENV.apiUrl})`)}, by the token ${keyPrint(token)}`,
46
+ });
47
+ /** The image every computer of the run starts from: COMPUTER_NORTHFLANK_IMAGE, else the box image's public tag. */
48
+ export async function conformanceImage({ env = process.env } = {}) {
49
+ return env[NORTHFLANK_ENV.image] || boxImageRef();
50
+ }
@@ -0,0 +1,32 @@
1
+ import { type SpritesProvider, type SpritesProviderOptions } from "../sprites.js";
2
+ import { type Env, type HostedModuleOptions } from "./module-kit.js";
3
+ export { CONFORMANCE_MAX_LIFETIME_MS } from "./module-kit.js";
4
+ export declare const SPRITES_ENV: {
5
+ readonly live: "AGENTRUN_COMPUTER_LIVE_SPRITES";
6
+ /** token, required: a Sprites API token. */
7
+ readonly key: "COMPUTER_SPRITES_TOKEN";
8
+ /** apiUrl: the API's root; default https://api.sprites.dev. */
9
+ readonly apiUrl: "COMPUTER_SPRITES_API_URL";
10
+ /** daemonPath: the daemon binary; default this package's dist/computerd-linux-amd64. */
11
+ readonly daemon: "COMPUTER_SPRITES_DAEMON";
12
+ };
13
+ export declare const ENV: {
14
+ readonly live: "AGENTRUN_COMPUTER_LIVE_SPRITES";
15
+ /** token, required: a Sprites API token. */
16
+ readonly key: "COMPUTER_SPRITES_TOKEN";
17
+ /** apiUrl: the API's root; default https://api.sprites.dev. */
18
+ readonly apiUrl: "COMPUTER_SPRITES_API_URL";
19
+ /** daemonPath: the daemon binary; default this package's dist/computerd-linux-amd64. */
20
+ readonly daemon: "COMPUTER_SPRITES_DAEMON";
21
+ };
22
+ export type SpritesSettings = Pick<SpritesProviderOptions, "token" | "apiUrl" | "daemonPath">;
23
+ /** The provider's options this module reads from env, each only when its name is set; throws in words without the token, never echoing it. */
24
+ export declare function settingsFromEnv(env?: Env): SpritesSettings;
25
+ export declare const conformanceNotes: string[];
26
+ export interface SpritesModuleOptions extends HostedModuleOptions, Pick<SpritesProviderOptions, "fetch" | "webSocket" | "daemonPath" | "timeouts" | "onNote"> {
27
+ }
28
+ export declare const createProvider: (options?: SpritesModuleOptions | undefined) => Promise<SpritesProvider>, createDriftedProvider: (options?: SpritesModuleOptions | undefined) => Promise<SpritesProvider>, createHost: (options?: SpritesModuleOptions | undefined) => Promise<import("../host.js").MachineHost>, sweepScope: (options?: {
29
+ env?: Env;
30
+ }) => string;
31
+ /** The image every computer of the run starts from: Fly's own, the only one. */
32
+ export declare function conformanceImage(_options?: Pick<SpritesModuleOptions, "env">): Promise<string>;
@@ -0,0 +1,40 @@
1
+ // Fly Sprites for the conformance CLI: `npm run conformance -w @parcha/agentrun-computer -- --provider sprites`. It makes
2
+ // real sprites, which bill while they run and live until deleted, so it runs only with AGENTRUN_COMPUTER_LIVE_SPRITES=1
3
+ // and your own token, under COMPUTER_SPRITES_TOKEN (never SPRITES_TOKEN, which may hold another org's). Every computer
4
+ // of a run has a deadline of at most 30 minutes, which the janitor keeps.
5
+ import { httpsBase } from "../hosted/rest.js";
6
+ import { SPRITES_IMAGE } from "../descriptors/sprites.js";
7
+ import { create, DEFAULT_API_URL } from "../sprites.js";
8
+ import { hostedModule, keyPrint, requiredSecret, setOptions } from "./module-kit.js";
9
+ export { CONFORMANCE_MAX_LIFETIME_MS } from "./module-kit.js";
10
+ export const SPRITES_ENV = {
11
+ live: "AGENTRUN_COMPUTER_LIVE_SPRITES",
12
+ /** token, required: a Sprites API token. */
13
+ key: "COMPUTER_SPRITES_TOKEN",
14
+ /** apiUrl: the API's root; default https://api.sprites.dev. */
15
+ apiUrl: "COMPUTER_SPRITES_API_URL",
16
+ /** daemonPath: the daemon binary; default this package's dist/computerd-linux-amd64. */
17
+ daemon: "COMPUTER_SPRITES_DAEMON",
18
+ };
19
+ export const ENV = SPRITES_ENV;
20
+ /** The provider's options this module reads from env, each only when its name is set; throws in words without the token, never echoing it. */
21
+ export function settingsFromEnv(env = process.env) {
22
+ const token = requiredSecret(env, SPRITES_ENV.key, "a Sprites API token");
23
+ return { token, ...setOptions(env, { apiUrl: SPRITES_ENV.apiUrl, daemonPath: SPRITES_ENV.daemon }) };
24
+ }
25
+ export const conformanceNotes = [
26
+ "sprites: every computer is a Fly sprite (a Firecracker microVM, amd64 unverified) from Fly's own Ubuntu image; the daemon is a child of a command on the exec WebSocket, its stdio the socket's binary frames, its kill the session's kill call; labels are packed into the sprite's name=value strings; lifetime is the janitor's, by the deadline label, capped at 30 minutes for the run. Network none, open and a list are init's. No Archil mount and no desktop.",
27
+ ];
28
+ export const { createProvider, createDriftedProvider, createHost, sweepScope } = hostedModule({
29
+ live: { name: SPRITES_ENV.live, what: "the Sprites conformance module makes real sprites, which bill while they run", whose: "your own token" },
30
+ settingsFromEnv,
31
+ create,
32
+ host: ["fetch", "webSocket", "daemonPath", "timeouts"],
33
+ run: ["onNote"],
34
+ // The token's org, the token named by its sha256 prefix alone.
35
+ scope: ({ token, apiUrl }) => `the Sprites org of the token ${keyPrint(token)} at ${httpsBase(apiUrl ?? DEFAULT_API_URL, `the Sprites API URL (${SPRITES_ENV.apiUrl})`)}`,
36
+ });
37
+ /** The image every computer of the run starts from: Fly's own, the only one. */
38
+ export async function conformanceImage(_options = {}) {
39
+ return SPRITES_IMAGE;
40
+ }
@@ -0,0 +1,35 @@
1
+ import { type VercelProvider, type VercelProviderOptions } from "../vercel.js";
2
+ import { type Env, type HostedModuleOptions } from "./module-kit.js";
3
+ export { CONFORMANCE_MAX_LIFETIME_MS } from "./module-kit.js";
4
+ export declare const VERCEL_ENV: {
5
+ readonly live: "AGENTRUN_COMPUTER_LIVE_VERCEL";
6
+ /** token, required: a Vercel access token of the team. */
7
+ readonly key: "COMPUTER_VERCEL_TOKEN";
8
+ /** teamId, required. */
9
+ readonly team: "COMPUTER_VERCEL_TEAM_ID";
10
+ /** projectId, required: the project whose registry holds the box image. */
11
+ readonly project: "COMPUTER_VERCEL_PROJECT_ID";
12
+ /** The image every computer of the run starts from; default the box image (boxVercelImage). */
13
+ readonly image: "COMPUTER_VERCEL_IMAGE";
14
+ };
15
+ export declare const ENV: {
16
+ readonly live: "AGENTRUN_COMPUTER_LIVE_VERCEL";
17
+ /** token, required: a Vercel access token of the team. */
18
+ readonly key: "COMPUTER_VERCEL_TOKEN";
19
+ /** teamId, required. */
20
+ readonly team: "COMPUTER_VERCEL_TEAM_ID";
21
+ /** projectId, required: the project whose registry holds the box image. */
22
+ readonly project: "COMPUTER_VERCEL_PROJECT_ID";
23
+ /** The image every computer of the run starts from; default the box image (boxVercelImage). */
24
+ readonly image: "COMPUTER_VERCEL_IMAGE";
25
+ };
26
+ /** The provider's options this module reads from env; throws in words without one, never echoing the token. */
27
+ export declare function settingsFromEnv(env?: Env): Pick<VercelProviderOptions, "token" | "teamId" | "projectId">;
28
+ export declare const conformanceNotes: string[];
29
+ export interface VercelModuleOptions extends HostedModuleOptions, Pick<VercelProviderOptions, "fetch" | "daemonPath" | "timeouts" | "onNote"> {
30
+ }
31
+ export declare const createProvider: (options?: VercelModuleOptions | undefined) => Promise<VercelProvider>, createDriftedProvider: (options?: VercelModuleOptions | undefined) => Promise<VercelProvider>, createHost: (options?: VercelModuleOptions | undefined) => Promise<import("../host.js").MachineHost>, sweepScope: (options?: {
32
+ env?: Env;
33
+ }) => string;
34
+ /** The image every computer of the run starts from: COMPUTER_VERCEL_IMAGE, else the box image prepareImage() answers. */
35
+ export declare function conformanceImage({ env }?: Pick<VercelModuleOptions, "env">): Promise<string>;
@@ -0,0 +1,43 @@
1
+ // Vercel Sandbox for the conformance CLI: `npm run conformance -w @parcha/agentrun-computer -- --provider vercel`. It
2
+ // makes real sandboxes, which bill while they run, so it runs only with AGENTRUN_COMPUTER_LIVE_VERCEL=1 and your own
3
+ // token, under COMPUTER_VERCEL_TOKEN (never VERCEL_TOKEN, which may hold another team's), with the team and project
4
+ // under COMPUTER_VERCEL_TEAM_ID and COMPUTER_VERCEL_PROJECT_ID. Every computer of a run lives at most 30 minutes.
5
+ import { boxVercelImage, create } from "../vercel.js";
6
+ import { hostedModule, keyPrint, requiredSecret } from "./module-kit.js";
7
+ export { CONFORMANCE_MAX_LIFETIME_MS } from "./module-kit.js";
8
+ export const VERCEL_ENV = {
9
+ live: "AGENTRUN_COMPUTER_LIVE_VERCEL",
10
+ /** token, required: a Vercel access token of the team. */
11
+ key: "COMPUTER_VERCEL_TOKEN",
12
+ /** teamId, required. */
13
+ team: "COMPUTER_VERCEL_TEAM_ID",
14
+ /** projectId, required: the project whose registry holds the box image. */
15
+ project: "COMPUTER_VERCEL_PROJECT_ID",
16
+ /** The image every computer of the run starts from; default the box image (boxVercelImage). */
17
+ image: "COMPUTER_VERCEL_IMAGE",
18
+ };
19
+ export const ENV = VERCEL_ENV;
20
+ /** The provider's options this module reads from env; throws in words without one, never echoing the token. */
21
+ export function settingsFromEnv(env = process.env) {
22
+ return {
23
+ token: requiredSecret(env, VERCEL_ENV.key, "a Vercel access token"),
24
+ teamId: requiredSecret(env, VERCEL_ENV.team, "the Vercel team id"),
25
+ projectId: requiredSecret(env, VERCEL_ENV.project, "the Vercel project id"),
26
+ };
27
+ }
28
+ export const conformanceNotes = [
29
+ "vercel: every computer is a Vercel Sandbox (a Firecracker microVM, amd64) made with persistent false and its session timeout at the computer's lifetime; the daemon is a child of a detached command, its stdio the command's log stream and a stdin write per call; labels are packed into its 5 tags; lifetime is Vercel's timer, capped at 30 minutes for the run. Network none, open and a list are init's (vendor deny-all on none). No Archil mount and no desktop.",
30
+ ];
31
+ export const { createProvider, createDriftedProvider, createHost, sweepScope } = hostedModule({
32
+ live: { name: VERCEL_ENV.live, what: "the Vercel conformance module makes real sandboxes, which bill while they run", whose: "your own token" },
33
+ settingsFromEnv,
34
+ create,
35
+ host: ["fetch", "daemonPath", "timeouts"],
36
+ run: ["onNote"],
37
+ // The project of the team, the token named by its sha256 prefix alone.
38
+ scope: ({ token, teamId, projectId }) => `the Vercel project ${projectId} of team ${teamId}, by the token ${keyPrint(token)}`,
39
+ });
40
+ /** The image every computer of the run starts from: COMPUTER_VERCEL_IMAGE, else the box image prepareImage() answers. */
41
+ export async function conformanceImage({ env = process.env } = {}) {
42
+ return env[VERCEL_ENV.image] || boxVercelImage();
43
+ }
@@ -73,6 +73,12 @@ export interface ProviderDescriptor<Module extends ProviderModule = ProviderModu
73
73
  readonly settings?: readonly DescriptorSetting[];
74
74
  /** The vendor bills by time; prices are the vendor's page, not ours. */
75
75
  readonly metered: boolean;
76
+ /**
77
+ * Its create answers the size the vendor runs each computer at (CreatedComputer.resources: its CPUs and memory), on
78
+ * every create, the vendor's figure over the spec's. A metered provider's time is priced by that size, so one
79
+ * without it has its computer time unpriced, whatever its price setting says: time no one can measure is never $0.
80
+ */
81
+ readonly sized?: boolean;
76
82
  /**
77
83
  * The mount kinds its computers take beside the synced folder, bind or archil; [] for none. sync is never listed: it
78
84
  * is derived (syncs, derivedMounts), and capabilities().mount declares both.
@@ -25,6 +25,8 @@ export function descriptorProblems(value) {
25
25
  problems.push("label is not a name in words");
26
26
  if (typeof d.metered !== "boolean")
27
27
  problems.push("metered is not true or false");
28
+ if (d.sized !== undefined && typeof d.sized !== "boolean")
29
+ problems.push("sized is not true or false");
28
30
  if (typeof d.load !== "function")
29
31
  problems.push("load is not a function that imports the provider module");
30
32
  if (!Array.isArray(d.mounts) || d.mounts.some((kind) => kind !== "bind" && kind !== "archil"))
@@ -16,6 +16,7 @@ export declare const AGENT37: {
16
16
  readonly option: "secrets";
17
17
  };
18
18
  readonly metered: true;
19
+ readonly sized: true;
19
20
  readonly mounts: readonly ["archil"];
20
21
  readonly network: readonly ["none", "open", "allow"];
21
22
  readonly capabilities: readonly [import("../kinds.js").KindCapabilities, {
@@ -17,6 +17,8 @@ export const AGENT37 = defineProvider({
17
17
  // The SSH key the provider makes for itself, kept in the server's sealed store: one per server.
18
18
  secrets: { option: "secrets" },
19
19
  metered: true,
20
+ // Its create answers the size the vendor runs the computer at (resources), which its time is priced by.
21
+ sized: true,
20
22
  mounts: ["archil"],
21
23
  // None: its programs run in a network of their own, their loopback alone (isolation.ts), and the instance is made
22
24
  // deny-all. Open and a list: the instance is made allow-all, and its programs' one way out is init's egress proxy,
@@ -84,6 +84,7 @@ export declare const DAYTONA: {
84
84
  }];
85
85
  readonly connect: "either";
86
86
  readonly metered: true;
87
+ readonly sized: true;
87
88
  readonly mounts: readonly [];
88
89
  readonly unmounted: {
89
90
  readonly archil: "Archil mounts don't work on Daytona's hosted cloud, where Archil's client hangs on its sandboxes; a self-hosted Daytona target takes one once its operator sets DAYTONA_ARCHIL_EGRESS";
@@ -85,6 +85,8 @@ export const DAYTONA = defineProvider({
85
85
  settings: [{ name: "daytonaConnect", option: "connect" }],
86
86
  connect: "either",
87
87
  metered: true,
88
+ // Its create answers the size the vendor runs the computer at (resources), which its time is priced by.
89
+ sized: true,
88
90
  // No mount by default: on Daytona's hosted cloud, Archil's client (0.10.1) mounts on its container sandboxes, but
89
91
  // nothing reads its /dev/fuse after, so the first statx of the folder hangs, on every kernel and mount shape tried
90
92
  // (live, 11-14). An Archil mount is refused in these words, before any request. A self-hosted Daytona target whose
@@ -5,6 +5,18 @@ export declare const E2B: {
5
5
  readonly name: "E2B_API_KEY";
6
6
  readonly option: "apiKey";
7
7
  readonly required: true;
8
+ }, {
9
+ readonly name: "AGENTRUN_E2B_DOMAIN";
10
+ readonly option: "domain";
11
+ readonly required: false;
12
+ }, {
13
+ readonly name: "AGENTRUN_E2B_API_URL";
14
+ readonly option: "apiUrl";
15
+ readonly required: false;
16
+ }, {
17
+ readonly name: "AGENTRUN_E2B_TEMPLATE";
18
+ readonly option: "template";
19
+ readonly required: false;
8
20
  }];
9
21
  readonly settings: readonly [{
10
22
  readonly name: "e2bConnect";
@@ -12,9 +24,11 @@ export declare const E2B: {
12
24
  }];
13
25
  readonly connect: "either";
14
26
  readonly metered: true;
27
+ readonly sized: true;
15
28
  readonly mounts: readonly ["archil"];
16
29
  readonly network: readonly ["none", "open", "allow"];
17
30
  readonly capabilities: readonly [import("../kinds.js").KindCapabilities, import("../kinds.js").KindCapabilities];
18
31
  readonly prepareImage: true;
32
+ readonly imageEnv: "AGENTRUN_E2B_TEMPLATE";
19
33
  readonly load: () => Promise<typeof import("../e2b.js")>;
20
34
  };
@@ -1,23 +1,40 @@
1
1
  // E2B's descriptor: a sandbox or a desktop, the run's folder on an Archil disk. Both start from our box template, the
2
- // public E2B template its prepareImage() answers (box-image.ts boxE2bTemplate), which has Archil's client and a desktop.
2
+ // public E2B template its prepareImage() answers (box-image.ts boxE2bTemplate), which has Archil's client and a desktop,
3
+ // unless the operator names another (AGENTRUN_E2B_TEMPLATE).
3
4
  import { defineProvider } from "../descriptor.js";
4
5
  import { LINUX_DESKTOP, SANDBOX } from "./shared.js";
6
+ /** The operator's template for every E2B computer, in place of the box template: a key, and the descriptor's imageEnv. */
7
+ const E2B_TEMPLATE_ENV = "AGENTRUN_E2B_TEMPLATE";
5
8
  export const E2B = defineProvider({
6
9
  id: "e2b",
7
10
  label: "E2B",
8
- keys: [{ name: "E2B_API_KEY", option: "apiKey", required: true }],
11
+ // The key, then three operator settings, none a secret: the domain of a cloud that speaks E2B's API (its API is
12
+ // https://api.<domain> unless AGENTRUN_E2B_API_URL names another), and the template every computer starts from. The key
13
+ // is whichever cloud's the domain names.
14
+ keys: [
15
+ { name: "E2B_API_KEY", option: "apiKey", required: true },
16
+ { name: "AGENTRUN_E2B_DOMAIN", option: "domain", required: false },
17
+ { name: "AGENTRUN_E2B_API_URL", option: "apiUrl", required: false },
18
+ { name: E2B_TEMPLATE_ENV, option: "template", required: false },
19
+ ],
9
20
  // How the server reaches its machines: exec (the provider's default, when the server's settings name none), a bridge
10
21
  // through envd per connection, or dial, the machine dials the server (a sandbox or a desktop, as on exec).
11
22
  settings: [{ name: "e2bConnect", option: "connect" }],
12
23
  connect: "either",
13
24
  metered: true,
25
+ // Its create answers the size the vendor runs the computer at (resources), which its time is priced by.
26
+ sized: true,
14
27
  mounts: ["archil"],
15
28
  // None: its programs run in a network of their own, their loopback alone (isolation.ts), and the sandbox is made with
16
29
  // no internet access. Open and a list: the sandbox gets internet access, and its programs' one way out is init's egress
17
30
  // proxy, which reaches the public internet alone, and with a list its hosts alone (hosted/network.ts).
18
31
  network: ["none", "open", "allow"],
19
32
  capabilities: [SANDBOX, LINUX_DESKTOP],
20
- // No default image: every computer, sandbox or desktop, starts from the box template its prepareImage() answers.
33
+ // No default image: every computer, sandbox or desktop, starts from the template its prepareImage() answers, the box
34
+ // one or the operator's.
21
35
  prepareImage: true,
36
+ // The operator's template, as Daytona's AGENTRUN_DAYTONA_SNAPSHOT: serve reads it as the image of every E2B computer,
37
+ // and takes a computer.image that names it. A Mode 2 folder mounts Archil in it, so it needs box/Dockerfile's client.
38
+ imageEnv: E2B_TEMPLATE_ENV,
22
39
  load: () => import("../e2b.js"),
23
40
  });
@@ -11,6 +11,7 @@ export declare const FLY: {
11
11
  readonly required: true;
12
12
  }];
13
13
  readonly metered: true;
14
+ readonly sized: true;
14
15
  readonly connect: "dial";
15
16
  readonly mounts: readonly [];
16
17
  readonly network: readonly ["none", "open", "allow"];
@@ -14,6 +14,8 @@ export const FLY = defineProvider({
14
14
  { name: "FLY_APP", option: "app", required: true },
15
15
  ],
16
16
  metered: true,
17
+ // Its create answers the size the vendor runs the computer at (resources), which its time is priced by.
18
+ sized: true,
17
19
  // Its machines dial the server: Fly's exec answers only once the command ends, so nothing reaches into one.
18
20
  connect: "dial",
19
21
  // None: a machine that dials takes no Archil mount (mountsOf).
@@ -14,6 +14,7 @@ export declare const GROUNDBOX: {
14
14
  readonly required: true;
15
15
  }];
16
16
  readonly metered: true;
17
+ readonly sized: true;
17
18
  readonly mounts: readonly [];
18
19
  readonly network: readonly ["none", "open", "allow"];
19
20
  readonly capabilities: readonly [import("../kinds.js").KindCapabilities, {
@@ -16,6 +16,8 @@ export const GROUNDBOX = defineProvider({
16
16
  label: "Groundbox",
17
17
  keys: [{ name: "GROUNDBOX_API_KEY", option: "apiKey", required: true }],
18
18
  metered: true,
19
+ // Its create answers the size the vendor runs the computer at (resources), which its time is priced by.
20
+ sized: true,
19
21
  // None yet: the guest kernel has FUSE, and Archil's client there is untried.
20
22
  mounts: [],
21
23
  // All three are ours: root in the guest makes a network namespace, so init's fence holds none and its egress proxy