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

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.
Binary file
Binary file
@@ -1,4 +1,4 @@
1
1
  {
2
- "version": "0.1.0-beta.57",
2
+ "version": "0.1.0-beta.58",
3
3
  "source": "sha256:724f889fc95233b98e71e6ff4456498fb220f704db4ca2caed5772e3984ba4de"
4
4
  }
package/dist/docker.d.ts CHANGED
@@ -76,10 +76,19 @@ export interface DockerCreateOptions extends Partial<DockerProviderOptions> {
76
76
  * CLI runs with this process's environment, as every call of the provider does, so it asks the Docker the provider uses.
77
77
  */
78
78
  export declare function dockerArch({ docker, timeoutMs }?: Pick<DockerCreateOptions, "docker" | "timeoutMs">): Promise<string>;
79
+ /**
80
+ * The daemon a Docker computer binds for Docker's architecture `arch` (dockerArch): computerd-linux-<arch> in `dir`,
81
+ * default this package's own build, and, when no such file is there, why, with the command that builds it. create()
82
+ * takes its daemon here, and so does a server's start check of Docker, so the two can't disagree.
83
+ */
84
+ export declare function dockerDaemonOf(arch: string, dir?: string): {
85
+ path: string;
86
+ missing?: string;
87
+ };
79
88
  /**
80
89
  * A DockerProvider from its options alone; it reads no environment. Without options.daemonPath it asks Docker its
81
- * architecture and takes this package's daemon for it, and says when that daemon is not built. The image is an option
82
- * too (default the provider's own recipe): no image name is read from the environment.
90
+ * architecture and takes this package's daemon for it (dockerDaemonOf), and says when that daemon is not built. The image
91
+ * is an option too (default the provider's own recipe): no image name is read from the environment.
83
92
  */
84
93
  export declare function create(options?: DockerCreateOptions): Promise<DockerProvider>;
85
94
  /** The conformance CLI's module for Docker: the drifted twin. */
package/dist/docker.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { execFile, spawn } from "node:child_process";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { readFileSync, statSync } from "node:fs";
5
- import { resolve } from "node:path";
5
+ import { join, resolve } from "node:path";
6
6
  import { setTimeout as sleep } from "node:timers/promises";
7
7
  import { fileURLToPath } from "node:url";
8
8
  import { DaemonClient } from "./client.js";
@@ -40,19 +40,28 @@ export function dockerArch({ docker = "docker", timeoutMs = 30_000 } = {}) {
40
40
  });
41
41
  });
42
42
  }
43
+ /**
44
+ * The daemon a Docker computer binds for Docker's architecture `arch` (dockerArch): computerd-linux-<arch> in `dir`,
45
+ * default this package's own build, and, when no such file is there, why, with the command that builds it. create()
46
+ * takes its daemon here, and so does a server's start check of Docker, so the two can't disagree.
47
+ */
48
+ export function dockerDaemonOf(arch, dir = fileURLToPath(new URL(".", import.meta.url))) {
49
+ const path = join(dir, `computerd-linux-${arch}`);
50
+ return fileMode(path) === undefined ? { path, missing: `no daemon for Docker's ${arch} at ${path}: run npm run build:daemon -w @parcha/agentrun-computer` } : { path };
51
+ }
43
52
  /**
44
53
  * A DockerProvider from its options alone; it reads no environment. Without options.daemonPath it asks Docker its
45
- * architecture and takes this package's daemon for it, and says when that daemon is not built. The image is an option
46
- * too (default the provider's own recipe): no image name is read from the environment.
54
+ * architecture and takes this package's daemon for it (dockerDaemonOf), and says when that daemon is not built. The image
55
+ * is an option too (default the provider's own recipe): no image name is read from the environment.
47
56
  */
48
57
  export async function create(options = {}) {
49
58
  const { timeoutMs, ...given } = options;
50
59
  let daemonPath = given.daemonPath || undefined;
51
60
  if (daemonPath === undefined) {
52
- const arch = await dockerArch({ ...(given.docker ? { docker: given.docker } : {}), ...(timeoutMs === undefined ? {} : { timeoutMs }) });
53
- daemonPath = fileURLToPath(new URL(`./computerd-linux-${arch}`, import.meta.url));
54
- if (fileMode(daemonPath) === undefined)
55
- throw new Error(`no daemon for Docker's ${arch} at ${daemonPath}: run npm run build:daemon -w @parcha/agentrun-computer`);
61
+ const daemon = dockerDaemonOf(await dockerArch({ ...(given.docker ? { docker: given.docker } : {}), ...(timeoutMs === undefined ? {} : { timeoutMs }) }));
62
+ if (daemon.missing !== undefined)
63
+ throw new Error(daemon.missing);
64
+ daemonPath = daemon.path;
56
65
  }
57
66
  return new DockerProvider({ ...given, daemonPath });
58
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcha/agentrun-computer",
3
- "version": "0.1.0-beta.57",
3
+ "version": "0.1.0-beta.58",
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",