@alan-ai-hq/agent-manager 0.1.127 → 0.1.129

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/install.cjs ADDED
@@ -0,0 +1,18 @@
1
+ // @ts-check
2
+ "use strict";
3
+
4
+ const { installRuntime } = require("./lib/runtime.cjs");
5
+
6
+ // Never fail `npm install`: the `alan-agent` bin installs the runtime on first use instead.
7
+ try {
8
+ const result = installRuntime();
9
+ if (result.status !== 0) {
10
+ process.stderr.write(
11
+ `alan-agent: installing the runtime failed (exit ${result.status ?? result.signal}); it will be retried on first run\n`
12
+ );
13
+ }
14
+ } catch (error) {
15
+ process.stderr.write(
16
+ `alan-agent: runtime not installed yet (${error instanceof Error ? error.message : String(error)}); it will be retried on first run\n`
17
+ );
18
+ }
@@ -0,0 +1,127 @@
1
+ // @ts-check
2
+ "use strict";
3
+
4
+ // Runs on whatever Node npm used (>= 18): no dependencies, CommonJS only.
5
+ const { spawnSync } = require("node:child_process");
6
+ const { existsSync } = require("node:fs");
7
+ const { homedir } = require("node:os");
8
+ const { dirname, join } = require("node:path");
9
+
10
+ const WRAPPER_ROOT = join(__dirname, "..");
11
+ const PLATFORM_PACKAGE_PREFIX = "@alan-ai-hq/agent-manager-";
12
+ const TARGETS = [
13
+ "darwin-arm64",
14
+ "darwin-x64",
15
+ "linux-x64",
16
+ "linux-arm64",
17
+ "win32-x64",
18
+ "win32-arm64",
19
+ ];
20
+
21
+ /**
22
+ * @typedef {object} CommandResult
23
+ * @property {number | null} status
24
+ * @property {NodeJS.Signals | null} signal
25
+ */
26
+
27
+ /**
28
+ * Same rule as the runtime's own config: ALAN_RUNTIME_INSTALL_DIR, else the per-user data folder.
29
+ * @param {NodeJS.ProcessEnv} env
30
+ * @param {NodeJS.Platform} platform
31
+ * @param {string} home
32
+ * @returns {string}
33
+ */
34
+ function installDir(env, platform, home) {
35
+ if (env.ALAN_RUNTIME_INSTALL_DIR) return env.ALAN_RUNTIME_INSTALL_DIR;
36
+ if (platform === "win32") {
37
+ return join(env.LOCALAPPDATA ?? join(home, "AppData", "Local"), "Alan", "runtime");
38
+ }
39
+ return join(env.XDG_DATA_HOME ?? join(home, ".local", "share"), "alan", "runtime");
40
+ }
41
+
42
+ /**
43
+ * @param {NodeJS.Platform} platform
44
+ * @returns {string}
45
+ */
46
+ function launcherName(platform) {
47
+ return platform === "win32" ? "alan-agent.cmd" : "alan-agent";
48
+ }
49
+
50
+ /** @returns {string} */
51
+ function installedLauncher() {
52
+ return join(
53
+ installDir(process.env, process.platform, homedir()),
54
+ "bin",
55
+ launcherName(process.platform)
56
+ );
57
+ }
58
+
59
+ /** @returns {string} */
60
+ function platformPackageDir() {
61
+ const target = `${process.platform}-${process.arch}`;
62
+ if (!TARGETS.includes(target)) throw new Error(`Alan does not ship a runtime for ${target}`);
63
+ const manifest = require.resolve(`${PLATFORM_PACKAGE_PREFIX}${target}/package.json`, {
64
+ paths: [WRAPPER_ROOT],
65
+ });
66
+ return dirname(manifest);
67
+ }
68
+
69
+ /**
70
+ * @param {string} value
71
+ * @returns {string}
72
+ */
73
+ function quoteForCmd(value) {
74
+ return `"${value.replace(/"/g, '""')}"`;
75
+ }
76
+
77
+ /**
78
+ * Windows launchers are .cmd files, which only cmd.exe runs; arguments are quoted for it.
79
+ * @param {string} command
80
+ * @param {readonly string[]} args
81
+ * @returns {CommandResult}
82
+ */
83
+ function run(command, args) {
84
+ const result =
85
+ process.platform === "win32"
86
+ ? spawnSync(
87
+ process.env.ComSpec ?? "cmd.exe",
88
+ ["/d", "/s", "/c", `"${[command, ...args].map(quoteForCmd).join(" ")}"`],
89
+ { stdio: "inherit", windowsVerbatimArguments: true }
90
+ )
91
+ : spawnSync(command, [...args], { stdio: "inherit" });
92
+ if (result.error) throw result.error;
93
+ return { status: result.status, signal: result.signal };
94
+ }
95
+
96
+ /**
97
+ * Installs this wrapper's platform package into the install folder, unless the installed
98
+ * runtime is already the same or newer. npm already checked the platform package against the
99
+ * registry's integrity when it installed it.
100
+ * @returns {CommandResult}
101
+ */
102
+ function installRuntime() {
103
+ const packageDir = platformPackageDir();
104
+ const installed = installedLauncher();
105
+ const runner = existsSync(installed)
106
+ ? installed
107
+ : join(packageDir, launcherName(process.platform));
108
+ return run(runner, ["upgrade", "--from", packageDir, "--if-newer"]);
109
+ }
110
+
111
+ /**
112
+ * `alan-agent …` from npm, and v1 service definitions that still run `dist/index.cjs daemon`:
113
+ * install on first use (npm may have skipped postinstall), then hand over to the installed launcher.
114
+ * @param {readonly string[]} args
115
+ * @returns {never}
116
+ */
117
+ function execRuntime(args) {
118
+ if (!existsSync(installedLauncher())) {
119
+ const install = installRuntime();
120
+ if (install.status !== 0) process.exit(install.status ?? 1);
121
+ }
122
+ const result = run(installedLauncher(), args);
123
+ if (result.signal) process.kill(process.pid, result.signal);
124
+ process.exit(result.status ?? 1);
125
+ }
126
+
127
+ module.exports = { execRuntime, installDir, installRuntime, installedLauncher, platformPackageDir };
package/package.json CHANGED
@@ -1,46 +1,32 @@
1
1
  {
2
- "name": "@alan-ai-hq/agent-manager",
3
- "version": "0.1.127",
2
+ "description": "Alan machine runtime (alan-agent CLI). Installs the runtime for this platform into its own versioned folder.",
4
3
  "license": "SEE LICENSE IN LICENSE",
5
- "type": "module",
6
- "description": "Alan agent runtime — cloud sandbox and local daemon (alan-agent CLI)",
4
+ "homepage": "https://tryalan.ai",
7
5
  "bin": {
8
- "alan-agent": "./dist/index.cjs"
6
+ "alan-agent": "dist/index.cjs"
7
+ },
8
+ "scripts": {
9
+ "postinstall": "node install.cjs"
9
10
  },
10
11
  "files": [
11
- "dist/"
12
+ "dist/index.cjs",
13
+ "lib/runtime.cjs",
14
+ "install.cjs"
12
15
  ],
16
+ "engines": {
17
+ "node": ">=18"
18
+ },
13
19
  "publishConfig": {
14
20
  "access": "public"
15
21
  },
16
- "dependencies": {
17
- "semver": "7.8.5",
18
- "smol-toml": "^1.6.1",
19
- "tar-stream": "3.2.0"
20
- },
21
- "devDependencies": {
22
- "@types/node": "^22.0.0",
23
- "@types/semver": "7.7.1",
24
- "@types/tar-stream": "3.1.4",
25
- "socket.io": "^4.8.0",
26
- "socket.io-client": "^4.8.0",
27
- "tsup": "^8.5.1",
28
- "tsx": "^4.19.0",
29
- "typescript": "~5.9.3",
30
- "@alan-ai/agent-core": "0.1.0",
31
- "@alan-ai/sandbox-runtime-spec": "0.1.0",
32
- "@alan-ai/shared": "0.1.0"
33
- },
34
- "scripts": {
35
- "build": "tsup",
36
- "dev": "tsx src/index.ts",
37
- "lint": "biome check .",
38
- "lint:fix": "biome check --write .",
39
- "format": "biome format --write .",
40
- "test": "vitest run",
41
- "test:coverage": "vitest run --coverage",
42
- "test:watch": "vitest",
43
- "type-check": "tsc --noEmit",
44
- "publish:npm": "node ../../scripts/publish-agent-manager.mjs"
22
+ "name": "@alan-ai-hq/agent-manager",
23
+ "version": "0.1.129",
24
+ "optionalDependencies": {
25
+ "@alan-ai-hq/agent-manager-darwin-arm64": "0.1.129",
26
+ "@alan-ai-hq/agent-manager-darwin-x64": "0.1.129",
27
+ "@alan-ai-hq/agent-manager-linux-x64": "0.1.129",
28
+ "@alan-ai-hq/agent-manager-linux-arm64": "0.1.129",
29
+ "@alan-ai-hq/agent-manager-win32-x64": "0.1.129",
30
+ "@alan-ai-hq/agent-manager-win32-arm64": "0.1.129"
45
31
  }
46
- }
32
+ }
package/LICENSE DELETED
@@ -1,88 +0,0 @@
1
- Alan Code — Proprietary License
2
-
3
- Copyright (c) 2026 Supatest AI Inc. All rights reserved.
4
-
5
- This license governs your use of the Alan Code command-line interface and its
6
- terminal user interface (the "Software"). It does not govern the Alan service
7
- (the "Service"), which is provided under separate terms.
8
-
9
- 1. License grant
10
-
11
- Subject to these terms, Supatest AI Inc. ("we", "us") grants you a
12
- non-exclusive, non-transferable, non-sublicensable, royalty-free license to
13
- install and run unmodified copies of the Software, for your internal business
14
- or personal use, for as long as you comply with this license.
15
-
16
- 2. Redistribution
17
-
18
- You may reproduce and redistribute unmodified copies of the Software only if
19
- all of the following are true:
20
-
21
- (a) the Software is distributed only in unmodified form;
22
- (b) it is redistributed solely as part of an application or service that
23
- provides material functionality beyond the Software itself;
24
- (c) it is not distributed on a standalone basis or as a primary product;
25
- (d) you include a copy of this license and retain all copyright, trademark,
26
- and attribution notices; and
27
- (e) your application or service is licensed independently of the Software.
28
-
29
- Nothing in this license restricts your choice of license for your own
30
- application or service, including distributing it under an open source license.
31
- This license applies solely to the Software and does not modify or supersede
32
- the license terms governing your own application.
33
-
34
- 3. Restrictions
35
-
36
- This license does not grant you the right to:
37
-
38
- (a) modify, adapt, translate, or create derivative works of the Software;
39
- (b) redistribute the Software except as expressly permitted in section 2;
40
- (c) remove, alter, or obscure any proprietary notices included in the
41
- Software;
42
- (d) reverse engineer, decompile, or disassemble the Software, except to the
43
- extent that restriction is prohibited by applicable law; or
44
- (e) use our trademarks, logos, or branding except as necessary to identify
45
- the Software.
46
-
47
- 4. Reservation of rights
48
-
49
- We and our licensors retain all right, title, and interest in and to the
50
- Software. All rights not expressly granted by this license are reserved.
51
-
52
- 5. The Alan service
53
-
54
- The Software is a client for the Service and requires a valid Alan account.
55
- Your use of the Service — including any code, prompts, or other content
56
- transmitted through it — is governed by the agreement under which you obtained
57
- that account, not by this license. This license grants no right to access or
58
- use the Service or any other third-party service.
59
-
60
- 6. Automatic updates
61
-
62
- The Software may check for and install updates automatically. By installing and
63
- running the Software you consent to those updates, which are covered by this
64
- license. You can turn them off; see the documentation.
65
-
66
- 7. No warranty
67
-
68
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS,
69
- IMPLIED, OR STATUTORY, INCLUDING WITHOUT LIMITATION WARRANTIES OF
70
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THE
71
- ENTIRE RISK ARISING OUT OF USE OF THE SOFTWARE REMAINS WITH YOU.
72
-
73
- 8. Limitation of liability
74
-
75
- TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL WE OR OUR LICENSORS
76
- BE LIABLE FOR ANY DAMAGES ARISING OUT OF OR RELATING TO THIS LICENSE OR THE USE
77
- OR DISTRIBUTION OF THE SOFTWARE, WHETHER IN CONTRACT, TORT, OR OTHERWISE.
78
-
79
- 9. Termination
80
-
81
- This license terminates automatically if you fail to comply with its terms.
82
- Upon termination you must cease all use and distribution of the Software.
83
-
84
- 10. Third-party components
85
-
86
- The Software installs and uses third-party open-source packages, each governed
87
- by its own license. Those licenses are included with the installed packages and
88
- are not modified by this license.