agentlab 0.1.4 → 0.2.0
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/LICENSE +21 -0
- package/README.md +12 -7
- package/dist/agentlab.js +10 -0
- package/dist/cache.js +141 -0
- package/dist/cli.js +131 -386
- package/dist/manifest.js +84 -0
- package/dist/prepack.js +20 -0
- package/package.json +19 -18
- package/release-manifest.json +16 -0
package/dist/manifest.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const STABLE_VERSION_PATTERN = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/u;
|
|
2
|
+
const REPOSITORY_PATTERN = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/u;
|
|
3
|
+
const SHA256_PATTERN = /^[a-f0-9]{64}$/u;
|
|
4
|
+
const MAXIMUM_BINARY_SIZE = 512 * 1024 * 1024;
|
|
5
|
+
export const releaseTargetKeys = ["linux-x64", "mac-arm64"];
|
|
6
|
+
export function parseReleaseManifest(input) {
|
|
7
|
+
const manifest = expectRecord(input, "release manifest");
|
|
8
|
+
const version = expectString(manifest.version, "release manifest version");
|
|
9
|
+
if (!STABLE_VERSION_PATTERN.test(version)) {
|
|
10
|
+
throw new Error("Release manifest version must be MAJOR.MINOR.PATCH.");
|
|
11
|
+
}
|
|
12
|
+
const repository = expectString(manifest.repository, "release manifest repository");
|
|
13
|
+
if (!REPOSITORY_PATTERN.test(repository)) {
|
|
14
|
+
throw new Error("Release manifest repository must be an owner/name pair.");
|
|
15
|
+
}
|
|
16
|
+
const targetInput = expectRecord(manifest.targets, "release manifest targets");
|
|
17
|
+
const names = Object.keys(targetInput).sort();
|
|
18
|
+
if (names.join(",") !== [...releaseTargetKeys].sort().join(",")) {
|
|
19
|
+
throw new Error(`Release manifest targets must be exactly ${releaseTargetKeys.join(", ")}.`);
|
|
20
|
+
}
|
|
21
|
+
const targets = Object.fromEntries(releaseTargetKeys.map((key) => [key, parseReleaseTarget(targetInput[key], version, key)]));
|
|
22
|
+
return { repository, targets, version };
|
|
23
|
+
}
|
|
24
|
+
export function resolveRuntimeTarget(runtime) {
|
|
25
|
+
if (runtime.platform === "linux" && runtime.arch === "x64") {
|
|
26
|
+
if (runtime.glibcVersionRuntime === undefined || runtime.glibcVersionRuntime.length === 0) {
|
|
27
|
+
throw new Error("AgentLab requires glibc on Linux; musl is not supported.");
|
|
28
|
+
}
|
|
29
|
+
return "linux-x64";
|
|
30
|
+
}
|
|
31
|
+
if (runtime.platform === "darwin" && runtime.arch === "arm64")
|
|
32
|
+
return "mac-arm64";
|
|
33
|
+
throw new Error(`AgentLab does not support ${runtime.platform}-${runtime.arch}. Supported platforms are Linux x64 with glibc and macOS arm64.`);
|
|
34
|
+
}
|
|
35
|
+
export function currentRuntimePlatform() {
|
|
36
|
+
return {
|
|
37
|
+
arch: process.arch,
|
|
38
|
+
glibcVersionRuntime: readGlibcVersion(),
|
|
39
|
+
platform: process.platform
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export function releaseDownloadUrl(manifest, key) {
|
|
43
|
+
const target = manifest.targets[key];
|
|
44
|
+
return `https://github.com/${manifest.repository}/releases/download/v${manifest.version}/${target.asset}`;
|
|
45
|
+
}
|
|
46
|
+
function parseReleaseTarget(input, version, key) {
|
|
47
|
+
const target = expectRecord(input, `release target ${key}`);
|
|
48
|
+
const asset = expectString(target.asset, `release target ${key} asset`);
|
|
49
|
+
const expectedAsset = `agentlab-v${version}-${key}`;
|
|
50
|
+
if (asset !== expectedAsset) {
|
|
51
|
+
throw new Error(`Release target ${key} asset must be ${expectedAsset}.`);
|
|
52
|
+
}
|
|
53
|
+
const sha256 = expectString(target.sha256, `release target ${key} sha256`);
|
|
54
|
+
if (!SHA256_PATTERN.test(sha256)) {
|
|
55
|
+
throw new Error(`Release target ${key} sha256 must be 64 lowercase hexadecimal characters.`);
|
|
56
|
+
}
|
|
57
|
+
const size = target.size;
|
|
58
|
+
if (!Number.isSafeInteger(size) ||
|
|
59
|
+
typeof size !== "number" ||
|
|
60
|
+
size <= 0 ||
|
|
61
|
+
size > MAXIMUM_BINARY_SIZE) {
|
|
62
|
+
throw new Error(`Release target ${key} size is outside the supported range.`);
|
|
63
|
+
}
|
|
64
|
+
return { asset, sha256, size };
|
|
65
|
+
}
|
|
66
|
+
function readGlibcVersion() {
|
|
67
|
+
if (process.platform !== "linux")
|
|
68
|
+
return undefined;
|
|
69
|
+
const report = process.report.getReport();
|
|
70
|
+
const value = report?.header?.glibcVersionRuntime;
|
|
71
|
+
return typeof value === "string" ? value : undefined;
|
|
72
|
+
}
|
|
73
|
+
function expectRecord(value, label) {
|
|
74
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
75
|
+
throw new Error(`${label} must be an object.`);
|
|
76
|
+
}
|
|
77
|
+
return value;
|
|
78
|
+
}
|
|
79
|
+
function expectString(value, label) {
|
|
80
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
81
|
+
throw new Error(`${label} must be a non-empty string.`);
|
|
82
|
+
}
|
|
83
|
+
return value;
|
|
84
|
+
}
|
package/dist/prepack.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { access, readFile } from "node:fs/promises";
|
|
2
|
+
import { constants } from "node:fs";
|
|
3
|
+
import { dirname, resolve } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { parseReleaseManifest } from "./manifest.js";
|
|
6
|
+
const packageDirectory = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
7
|
+
const packageInput = JSON.parse(await readFile(resolve(packageDirectory, "package.json"), "utf8"));
|
|
8
|
+
if (typeof packageInput !== "object" || packageInput === null || Array.isArray(packageInput)) {
|
|
9
|
+
throw new Error("package.json must be an object.");
|
|
10
|
+
}
|
|
11
|
+
const packageJson = packageInput;
|
|
12
|
+
const manifestInput = JSON.parse(await readFile(resolve(packageDirectory, "release-manifest.json"), "utf8"));
|
|
13
|
+
const manifest = parseReleaseManifest(manifestInput);
|
|
14
|
+
if (packageJson.name !== "agentlab" || packageJson.version !== manifest.version) {
|
|
15
|
+
throw new Error("The AgentLab package and release manifest identities do not match.");
|
|
16
|
+
}
|
|
17
|
+
if (packageJson.private === true)
|
|
18
|
+
throw new Error("The generated AgentLab package must be public.");
|
|
19
|
+
await access(resolve(packageDirectory, "dist", "agentlab.js"), constants.R_OK);
|
|
20
|
+
process.stdout.write(`Validated agentlab@${manifest.version} npm package.\n`);
|
package/package.json
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentlab",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "One captain for all your coding agents in a fast local terminal UI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"agentlab": "dist/
|
|
7
|
+
"agentlab": "dist/agentlab.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
-
"dist"
|
|
10
|
+
"dist/*.js",
|
|
11
|
+
"release-manifest.json",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
11
14
|
],
|
|
12
15
|
"scripts": {
|
|
13
|
-
"
|
|
14
|
-
|
|
16
|
+
"prepack": "node dist/prepack.js"
|
|
17
|
+
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=20"
|
|
15
20
|
},
|
|
16
21
|
"license": "MIT",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/RiadMefti/agentlab.git"
|
|
20
25
|
},
|
|
21
|
-
"
|
|
22
|
-
"
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/RiadMefti/agentlab/issues"
|
|
23
28
|
},
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
"ink-spinner": "^5.0.0",
|
|
28
|
-
"ink-text-input": "^6.0.0",
|
|
29
|
-
"marked": "^17.0.3",
|
|
30
|
-
"react": "^19.2.4"
|
|
29
|
+
"homepage": "https://github.com/RiadMefti/agentlab#readme",
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
31
32
|
}
|
|
32
33
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"repository": "RiadMefti/agentlab",
|
|
3
|
+
"targets": {
|
|
4
|
+
"linux-x64": {
|
|
5
|
+
"asset": "agentlab-v0.2.0-linux-x64",
|
|
6
|
+
"sha256": "7366f538105ba0055d75db54e0a756de975018ca054613e09b0f8572a257beb2",
|
|
7
|
+
"size": 116298952
|
|
8
|
+
},
|
|
9
|
+
"mac-arm64": {
|
|
10
|
+
"asset": "agentlab-v0.2.0-mac-arm64",
|
|
11
|
+
"sha256": "1eafa0a448f2101fe6d7affe56ffe3963d84071737f4cbab14567c819109427f",
|
|
12
|
+
"size": 77351282
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"version": "0.2.0"
|
|
16
|
+
}
|