@parcha/agentrun-computer 0.1.0-beta.39 → 0.1.0-beta.41

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 (57) hide show
  1. package/README.md +56 -21
  2. package/box/Dockerfile +11 -58
  3. package/box/README.md +15 -2
  4. package/box/build-daytona.py +4 -2
  5. package/box/build-e2b.mjs +1 -1
  6. package/box/install.sh +148 -0
  7. package/box/recipe.mjs +12 -10
  8. package/dist/agent37.js +2 -1
  9. package/dist/attach.d.ts +46 -1
  10. package/dist/attach.js +48 -4
  11. package/dist/box-image.d.ts +2 -0
  12. package/dist/box-image.js +10 -0
  13. package/dist/computerd-linux-amd64 +0 -0
  14. package/dist/computerd-linux-arm64 +0 -0
  15. package/dist/computerd.json +2 -2
  16. package/dist/conformance/cases/isolation.js +17 -1
  17. package/dist/conformance/cases/lifetime.js +30 -0
  18. package/dist/conformance/cases/provider.js +63 -1
  19. package/dist/conformance/cli.js +27 -5
  20. package/dist/conformance/daytona.d.ts +25 -0
  21. package/dist/conformance/daytona.js +26 -1
  22. package/dist/conformance/exec-stream.d.ts +37 -7
  23. package/dist/conformance/exec-stream.js +349 -89
  24. package/dist/conformance/report.js +3 -0
  25. package/dist/conformance/runner.js +134 -12
  26. package/dist/conformance/sweep.d.ts +7 -2
  27. package/dist/conformance/sweep.js +17 -7
  28. package/dist/conformance/types.d.ts +42 -0
  29. package/dist/daytona.d.ts +8 -1
  30. package/dist/daytona.js +126 -101
  31. package/dist/descriptor.d.ts +22 -1
  32. package/dist/descriptor.js +18 -0
  33. package/dist/descriptors/daytona.d.ts +12 -3
  34. package/dist/descriptors/daytona.js +15 -7
  35. package/dist/descriptors/index.d.ts +8 -1
  36. package/dist/e2b.js +1 -1
  37. package/dist/host.d.ts +91 -26
  38. package/dist/host.js +5 -0
  39. package/dist/hosted/framed-exec.d.ts +38 -0
  40. package/dist/hosted/framed-exec.js +119 -0
  41. package/dist/hosted/process.d.ts +13 -5
  42. package/dist/hosted/process.js +39 -14
  43. package/dist/hosted/provider.d.ts +48 -6
  44. package/dist/hosted/provider.js +435 -64
  45. package/dist/hosted/rest.d.ts +29 -0
  46. package/dist/hosted/rest.js +91 -6
  47. package/dist/hosted/scripts.d.ts +58 -0
  48. package/dist/hosted/scripts.js +138 -1
  49. package/dist/hosted/ssh-exec.d.ts +7 -6
  50. package/dist/hosted/ssh-exec.js +35 -52
  51. package/dist/hosted/values.d.ts +1 -1
  52. package/dist/index.d.ts +2 -2
  53. package/dist/index.js +2 -2
  54. package/dist/kinds.d.ts +2 -0
  55. package/dist/modal.js +21 -8
  56. package/dist/providers.d.ts +4 -2
  57. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ export { checkActions, isKey } from "./actions.js";
9
9
  export { pullTar, pullTarStream, pushTar, readFile, writeFile } from "./files.js";
10
10
  export { listProcesses, readAll } from "./processes.js";
11
11
  export { createActionMapper, daemonWatch, redactWords, ScreenWatchError, toAction, watchEndCode, watchScreen, } from "./screen-watch.js";
12
- export { HostedProvider } from "./hosted/provider.js";
12
+ export { HostedProvider, hostedDaemonPath } from "./hosted/provider.js";
13
13
  // The provider classes and their option types are not here: each provider loads by its id through the registry
14
14
  // (providerFor), or from its own subpath (@parcha/agentrun-computer/docker, /daytona, /modal, /e2b, /agent37, /orgo,
15
15
  // /phone-harness, /browserbase, /kernel, /local: each the provider file's name).
@@ -27,7 +27,7 @@ export { releaseOlder, sweep } from "./janitor.js";
27
27
  export { EPOCH_LABEL, epochOf, epochProblem, IDLE_TTL_LABEL, OWNER_LABEL, OWNER_SERVER_LABEL, ownerFilter, ownerLabels, ownerOf, RUN_HASH_LABEL, RUN_LABEL, runHash, runLabels, runProblem } from "./labels.js";
28
28
  export { waitUntil } from "./wait.js";
29
29
  export { descriptorOf, isProviderId, providerFor, providerIds, providerModule, providers, } from "./providers.js";
30
- export { defineProvider, descriptorProblems } from "./descriptor.js";
30
+ export { defineProvider, descriptorProblems, mountsOf } from "./descriptor.js";
31
31
  export { AGENT37, AGENT37_BASE_TEMPLATE, BROWSER_IMAGE, BROWSERBASE, DAYTONA, DAYTONA_DEFAULT_SNAPSHOT, DAYTONA_GPU_SNAPSHOT, DESCRIPTORS, daytonaGpu, daytonaGpuSnapshot, DOCKER, E2B, KERNEL, LOCAL, MODAL, ORGO, ORGO_BASE_IMAGE, PHONE_GROUPS, PHONE_HARNESS, PHONE_IMAGE, } from "./descriptors/index.js";
32
32
  export { configurationOf, entryOf, imagesOf, kindOf, kindServed, PROVIDERS, SETTING_KIND_NAMES, SETTING_KINDS, serves, servingRefusals, } from "./kinds.js";
33
33
  export * from "./conformance/index.js";
package/dist/kinds.d.ts CHANGED
@@ -68,6 +68,8 @@ export interface ProviderEntry {
68
68
  readonly mounts: readonly MountKind[];
69
69
  /** Why its computers take none of these mount kinds, each in one sentence (descriptor.ts). */
70
70
  readonly unmounted?: Unmounted;
71
+ /** Mount kinds its computers take only where the operator sets the key named, by kind (descriptor.ts, mountsOf). */
72
+ readonly mountsWith?: Readonly<Partial<Record<MountKind, string>>>;
71
73
  /**
72
74
  * The network forms its computers make, its descriptor's: ["none"], a remote computer whose programs run in a network
73
75
  * of their own; ["open"], the vendor's own network, which no allowlist of this server reaches; Docker's all three.
package/dist/modal.js CHANGED
@@ -3,6 +3,7 @@ import { MODAL } from "./descriptors/modal.js";
3
3
  import { DEFAULT_CPUS, DEFAULT_MEMORY_MB, WORK } from "./drift.js";
4
4
  import { HostError } from "./host.js";
5
5
  import { HostedProvider } from "./hosted/provider.js";
6
+ import { PID_WRAPPER, pidKill, pidStderr } from "./hosted/scripts.js";
6
7
  import { isWhole } from "./hosted/values.js";
7
8
  import { ok } from "./result.js";
8
9
  /** A GPU as the SDK takes it: the type, then :count past one ("T4", "H100:8"). */
@@ -287,21 +288,33 @@ class ModalHost {
287
288
  }
288
289
  }
289
290
  /**
290
- * exec in binary mode, as root (Modal containers always run as root), outside computerd. Modal has no kill for an
291
- * exec: kill closes its stdin, which ends the stdio bridge and anything else that reads it.
291
+ * exec in binary mode, as root (Modal containers always run as root), outside computerd, under PID_WRAPPER
292
+ * (./hosted/scripts.ts): Modal has no kill for an exec, so kill runs pidKill in an exec of its own, which ends the
293
+ * process and every process under it, then closes its stdin. Not once wait() read its exit: its pid may be another's.
292
294
  */
293
295
  async exec(id, argv, ctx) {
294
- void ctx;
295
296
  const sandbox = await this.#sandbox(id);
296
- const program = await sandbox.exec([...argv], { mode: "binary" });
297
- const close = () => program.stdin.close().catch(() => { });
297
+ const program = await sandbox.exec([...PID_WRAPPER, ...argv], { mode: "binary" });
298
+ const { stderr, pid } = pidStderr(program.stderr);
299
+ let exited = false;
300
+ let waited;
298
301
  return {
299
302
  stdout: program.stdout,
300
- stderr: program.stderr,
303
+ stderr,
301
304
  write: (bytes) => program.stdin.writeBytes(bytes),
302
305
  end: () => program.stdin.close(),
303
- wait: () => program.wait(),
304
- kill: async () => void (await close()),
306
+ wait: () => (waited ??= program.wait().then((code) => ((exited = true), code))),
307
+ kill: async () => {
308
+ try {
309
+ const target = exited ? undefined : await pid(ctx.timeoutMs);
310
+ if (target !== undefined && !exited)
311
+ await (await sandbox.exec(pidKill(target), { mode: "binary" })).wait();
312
+ }
313
+ catch {
314
+ // Best effort: kill never throws.
315
+ }
316
+ await program.stdin.close().catch(() => { });
317
+ },
305
318
  };
306
319
  }
307
320
  }
@@ -1,4 +1,4 @@
1
- import type { RunFolder } from "./conformance/types.js";
1
+ import type { DialKit, RunFolder } from "./conformance/types.js";
2
2
  import type { ProviderDescriptor } from "./descriptor.js";
3
3
  import { DESCRIPTORS } from "./descriptors/index.js";
4
4
  import type { MachineHost } from "./host.js";
@@ -9,7 +9,7 @@ export type ProviderEnv = Readonly<Record<string, string | undefined>>;
9
9
  /**
10
10
  * What a conformance module exports, the CLI's contract for a module given by path too: createProvider(), and optionally
11
11
  * createDriftedProvider() for the drift case, conformanceImage() for a run that names no image, conformanceNotes for
12
- * the report, mountFor() for the mount cases, and settingsFromEnv(env), the provider's options it reads from the
12
+ * the report, mountFor() for the mount cases, dialKit() for a dial host, and settingsFromEnv(env), the provider's options it reads from the
13
13
  * environment by its COMPUTER_<ID>_* names, with ENV, those names by role. The CLI passes each function its options,
14
14
  * which a module may ignore.
15
15
  */
@@ -23,6 +23,8 @@ export interface ConformanceModule {
23
23
  signal?: AbortSignal;
24
24
  }): string | Promise<string>;
25
25
  conformanceNotes?: string[];
26
+ /** For a host whose machines dial (facts.connect "dial"): the server they dial, for provider.dial-token. */
27
+ dialKit?(options?: object): DialKit | Promise<DialKit>;
26
28
  /**
27
29
  * A provider on the shared adapter: its MachineHost from the same settings, with no live switch, since it makes
28
30
  * nothing by itself. The live sweep lists and deletes through it, and the exec pre-check (--exec-stream) calls its
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcha/agentrun-computer",
3
- "version": "0.1.0-beta.39",
3
+ "version": "0.1.0-beta.41",
4
4
  "description": "The open platform's computer protocol: a daemon in every computer, and one provisioner per vendor, starting with Docker.",
5
5
  "keywords": [
6
6
  "agentrun",