@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.
- package/dist/computerd-linux-amd64 +0 -0
- package/dist/computerd-linux-arm64 +0 -0
- package/dist/computerd.json +1 -1
- package/dist/docker.d.ts +11 -2
- package/dist/docker.js +16 -7
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
package/dist/computerd.json
CHANGED
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
|
|
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
|
|
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
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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.
|
|
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",
|