aicomputer 0.1.19 → 0.1.21

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.
@@ -0,0 +1,21 @@
1
+ type SupportedPlatform = "darwin" | "linux";
2
+ type BundledAutosshAsset = {
3
+ platform: SupportedPlatform;
4
+ version: string;
5
+ archiveName: string;
6
+ downloadUrl: string;
7
+ archiveSha256: string;
8
+ installDir: string;
9
+ executablePath: string;
10
+ };
11
+ declare const AGENTCOMPUTER_AUTOSSH_PATH_ENV = "AGENTCOMPUTER_AUTOSSH_PATH";
12
+ declare const AUTOSSH_SSH_PATH_ENV = "AUTOSSH_PATH";
13
+ declare function getBundledAutosshAsset(platform?: NodeJS.Platform, homeDirectory?: string): BundledAutosshAsset | null;
14
+ declare function hasBundledAutossh(): boolean;
15
+ declare function ensureAutosshCommandPath(env?: NodeJS.ProcessEnv): Promise<string>;
16
+ declare function ensureBundledAutosshInstalled(): Promise<string>;
17
+ declare function resolveAutosshCommandPath(env?: NodeJS.ProcessEnv): string;
18
+ declare function resolveAutosshSSHCommandPath(env?: NodeJS.ProcessEnv): string;
19
+ declare function getMissingOpenSSHClientMessage(platform?: NodeJS.Platform): string;
20
+
21
+ export { AGENTCOMPUTER_AUTOSSH_PATH_ENV, AUTOSSH_SSH_PATH_ENV, type BundledAutosshAsset, ensureAutosshCommandPath, ensureBundledAutosshInstalled, getBundledAutosshAsset, getMissingOpenSSHClientMessage, hasBundledAutossh, resolveAutosshCommandPath, resolveAutosshSSHCommandPath };
@@ -0,0 +1,23 @@
1
+ import {
2
+ AGENTCOMPUTER_AUTOSSH_PATH_ENV,
3
+ AUTOSSH_SSH_PATH_ENV,
4
+ ensureAutosshCommandPath,
5
+ ensureBundledAutosshInstalled,
6
+ getBundledAutosshAsset,
7
+ getMissingOpenSSHClientMessage,
8
+ hasBundledAutossh,
9
+ resolveAutosshCommandPath,
10
+ resolveAutosshSSHCommandPath
11
+ } from "../chunk-3ZF7JRBW.js";
12
+ import "../chunk-5Y2NWK5I.js";
13
+ export {
14
+ AGENTCOMPUTER_AUTOSSH_PATH_ENV,
15
+ AUTOSSH_SSH_PATH_ENV,
16
+ ensureAutosshCommandPath,
17
+ ensureBundledAutosshInstalled,
18
+ getBundledAutosshAsset,
19
+ getMissingOpenSSHClientMessage,
20
+ hasBundledAutossh,
21
+ resolveAutosshCommandPath,
22
+ resolveAutosshSSHCommandPath
23
+ };
@@ -10,8 +10,12 @@ interface MountServiceConfig {
10
10
  interface ManagedMountSnapshot {
11
11
  handle: string;
12
12
  mountPath: string;
13
- state: "mounted" | "reconnecting" | "degraded" | "pending" | "error";
13
+ state: "mounted" | "syncing" | "reconnecting" | "degraded" | "pending" | "error";
14
14
  message?: string;
15
+ status?: string;
16
+ progress?: string;
17
+ currentFile?: string;
18
+ etaSeconds?: number;
15
19
  updatedAt: string;
16
20
  }
17
21
  type MountStartupPhase = "starting" | "cleaning" | "syncing" | "ready";
@@ -20,6 +20,8 @@ interface OwnedMountSession {
20
20
  betaConnected: boolean;
21
21
  status?: string;
22
22
  lastError?: string;
23
+ stagingProgress?: string;
24
+ currentFile?: string;
23
25
  scanProblemCount: number;
24
26
  conflictCount: number;
25
27
  legacy: boolean;
@@ -8,9 +8,10 @@ import {
8
8
  listOwnedSessions,
9
9
  selectPreferredSession,
10
10
  terminateSession
11
- } from "../chunk-NN4GECN6.js";
11
+ } from "../chunk-TPFE3CC6.js";
12
12
  import "../chunk-KXLTHWW3.js";
13
- import "../chunk-MDSPJ57B.js";
13
+ import "../chunk-GD42GHW3.js";
14
+ import "../chunk-5Y2NWK5I.js";
14
15
  export {
15
16
  createHandleSession,
16
17
  ensureMutagenSshEnvironment,
@@ -3,10 +3,12 @@ import {
3
3
  planMountReconcile,
4
4
  reconcileMounts,
5
5
  teardownManagedSessions
6
- } from "../chunk-5JYMQXKN.js";
7
- import "../chunk-NN4GECN6.js";
6
+ } from "../chunk-36BZXAAX.js";
7
+ import "../chunk-TPFE3CC6.js";
8
8
  import "../chunk-KXLTHWW3.js";
9
- import "../chunk-MDSPJ57B.js";
9
+ import "../chunk-GD42GHW3.js";
10
+ import "../chunk-LOGK7YYJ.js";
11
+ import "../chunk-5Y2NWK5I.js";
10
12
  export {
11
13
  computeMountPlan,
12
14
  planMountReconcile,
@@ -12,10 +12,9 @@ type BundledMutagenAsset = {
12
12
  declare const AGENTCOMPUTER_MUTAGEN_PATH_ENV = "AGENTCOMPUTER_MUTAGEN_PATH";
13
13
  declare function getBundledMutagenAsset(platform?: NodeJS.Platform, arch?: string, homeDirectory?: string): BundledMutagenAsset | null;
14
14
  declare function hasBundledMutagen(): boolean;
15
- declare function resolveSystemCommandPath(command: string): string | null;
16
15
  declare function ensureMutagenCommandPath(): Promise<string>;
17
16
  declare function ensureBundledMutagenInstalled(): Promise<string>;
18
17
  declare function resolveMutagenCommandPath(): string;
19
18
  declare function resolveMutagenAssetArch(arch: string): SupportedAssetArch | null;
20
19
 
21
- export { AGENTCOMPUTER_MUTAGEN_PATH_ENV, type BundledMutagenAsset, ensureBundledMutagenInstalled, ensureMutagenCommandPath, getBundledMutagenAsset, hasBundledMutagen, resolveMutagenAssetArch, resolveMutagenCommandPath, resolveSystemCommandPath };
20
+ export { AGENTCOMPUTER_MUTAGEN_PATH_ENV, type BundledMutagenAsset, ensureBundledMutagenInstalled, ensureMutagenCommandPath, getBundledMutagenAsset, hasBundledMutagen, resolveMutagenAssetArch, resolveMutagenCommandPath };
@@ -5,9 +5,9 @@ import {
5
5
  getBundledMutagenAsset,
6
6
  hasBundledMutagen,
7
7
  resolveMutagenAssetArch,
8
- resolveMutagenCommandPath,
9
- resolveSystemCommandPath
10
- } from "../chunk-MDSPJ57B.js";
8
+ resolveMutagenCommandPath
9
+ } from "../chunk-GD42GHW3.js";
10
+ import "../chunk-5Y2NWK5I.js";
11
11
  export {
12
12
  AGENTCOMPUTER_MUTAGEN_PATH_ENV,
13
13
  ensureBundledMutagenInstalled,
@@ -15,6 +15,5 @@ export {
15
15
  getBundledMutagenAsset,
16
16
  hasBundledMutagen,
17
17
  resolveMutagenAssetArch,
18
- resolveMutagenCommandPath,
19
- resolveSystemCommandPath
18
+ resolveMutagenCommandPath
20
19
  };
@@ -0,0 +1,74 @@
1
+ type RuntimeFamily = "managed-worker" | "custom-machine";
2
+ type SourceKind = "none" | "oci-image";
3
+ type HealthcheckType = "http" | "tcp";
4
+ type FilesystemMode = "isolated" | "shared";
5
+ type ComputerDesiredPowerState = "on" | "off";
6
+ interface Computer {
7
+ id: string;
8
+ handle: string;
9
+ display_name: string;
10
+ status: string;
11
+ desired_power_state: ComputerDesiredPowerState;
12
+ tier: string;
13
+ runtime_family: RuntimeFamily;
14
+ source_kind: SourceKind;
15
+ build_status: "pending" | "building" | "ready" | "failed";
16
+ image_family: string;
17
+ image_ref: string;
18
+ resolved_image_ref: string;
19
+ source_repo_url?: string;
20
+ source_ref?: string;
21
+ source_subpath?: string;
22
+ user_source_id?: string;
23
+ primary_web_host: string;
24
+ primary_port: number;
25
+ primary_path: string;
26
+ healthcheck_type: HealthcheckType;
27
+ healthcheck_value?: string;
28
+ ssh_enabled: boolean;
29
+ vnc_enabled: boolean;
30
+ filesystem_mode: FilesystemMode;
31
+ filesystem_id?: string;
32
+ workspace_name?: string;
33
+ ssh_host: string;
34
+ ssh_port: number;
35
+ last_error?: string;
36
+ created_at: string;
37
+ updated_at: string;
38
+ }
39
+
40
+ declare const SSH_SERVER_ALIVE_INTERVAL_SECONDS = 30;
41
+ declare const SSH_SERVER_ALIVE_COUNT_MAX = 3;
42
+ type SSHConnection = {
43
+ computer: Computer;
44
+ commandPath: string;
45
+ command: string;
46
+ args: string[];
47
+ env: NodeJS.ProcessEnv;
48
+ };
49
+ type SSHConnectionOptions = {
50
+ extraArgs?: string[];
51
+ tmux?: boolean;
52
+ };
53
+ type SSHLaunchPlanInput = {
54
+ user: string;
55
+ host: string;
56
+ port: number;
57
+ identityFilePath: string;
58
+ commandPath?: string;
59
+ sshCommandPath?: string;
60
+ extraArgs?: string[];
61
+ tmux?: boolean;
62
+ };
63
+ type SSHLaunchPlan = Omit<SSHConnection, "computer">;
64
+ declare function prepareSSHConnection(computer: Computer, options?: SSHConnectionOptions): Promise<SSHConnection>;
65
+ declare function prepareSSHConnectionByIdentifier(identifier: string, options?: SSHConnectionOptions): Promise<SSHConnection>;
66
+ declare function openSSHConnection(connection: SSHConnection): Promise<void>;
67
+ declare function buildSSHLaunchPlan(input: SSHLaunchPlanInput): SSHLaunchPlan;
68
+ declare function getSSHResilienceOptionArgs(): string[];
69
+ declare function getSSHResilienceConfigLines(): string[];
70
+ declare function formatSSHCommand(user: string, host: string, port: number, extraArgs?: string[], options?: {
71
+ tmux?: boolean;
72
+ }): string;
73
+
74
+ export { type SSHConnection, type SSHConnectionOptions, type SSHLaunchPlan, type SSHLaunchPlanInput, SSH_SERVER_ALIVE_COUNT_MAX, SSH_SERVER_ALIVE_INTERVAL_SECONDS, buildSSHLaunchPlan, formatSSHCommand, getSSHResilienceConfigLines, getSSHResilienceOptionArgs, openSSHConnection, prepareSSHConnection, prepareSSHConnectionByIdentifier };
@@ -0,0 +1,25 @@
1
+ import {
2
+ SSH_SERVER_ALIVE_COUNT_MAX,
3
+ SSH_SERVER_ALIVE_INTERVAL_SECONDS,
4
+ buildSSHLaunchPlan,
5
+ formatSSHCommand,
6
+ getSSHResilienceConfigLines,
7
+ getSSHResilienceOptionArgs,
8
+ openSSHConnection,
9
+ prepareSSHConnection,
10
+ prepareSSHConnectionByIdentifier
11
+ } from "../chunk-4TE5XTYE.js";
12
+ import "../chunk-3ZF7JRBW.js";
13
+ import "../chunk-LOGK7YYJ.js";
14
+ import "../chunk-5Y2NWK5I.js";
15
+ export {
16
+ SSH_SERVER_ALIVE_COUNT_MAX,
17
+ SSH_SERVER_ALIVE_INTERVAL_SECONDS,
18
+ buildSSHLaunchPlan,
19
+ formatSSHCommand,
20
+ getSSHResilienceConfigLines,
21
+ getSSHResilienceOptionArgs,
22
+ openSSHConnection,
23
+ prepareSSHConnection,
24
+ prepareSSHConnectionByIdentifier
25
+ };
@@ -0,0 +1,14 @@
1
+ interface EnsureSSHAliasConfigOptions {
2
+ alias: string;
3
+ host: string;
4
+ port: number;
5
+ identityFilePath: string;
6
+ user?: string;
7
+ }
8
+ interface SSHAliasConfigResult {
9
+ configPath: string;
10
+ changed: boolean;
11
+ }
12
+ declare function ensureSSHAliasConfig(options: EnsureSSHAliasConfigOptions): Promise<SSHAliasConfigResult>;
13
+
14
+ export { type EnsureSSHAliasConfigOptions, type SSHAliasConfigResult, ensureSSHAliasConfig };
@@ -0,0 +1,10 @@
1
+ import {
2
+ ensureSSHAliasConfig
3
+ } from "../chunk-D3SAFNSI.js";
4
+ import "../chunk-4TE5XTYE.js";
5
+ import "../chunk-3ZF7JRBW.js";
6
+ import "../chunk-LOGK7YYJ.js";
7
+ import "../chunk-5Y2NWK5I.js";
8
+ export {
9
+ ensureSSHAliasConfig
10
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aicomputer",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "description": "Computer CLI - manage your Agent Computer machines from the terminal",
5
5
  "homepage": "https://agentcomputer.ai",
6
6
  "repository": {
@@ -18,8 +18,8 @@
18
18
  "registry": "https://registry.npmjs.org/"
19
19
  },
20
20
  "scripts": {
21
- "build": "tsup src/index.ts src/lib/mount-config.ts src/lib/mount-host.ts src/lib/mount-mutagen.ts src/lib/mount-reconcile.ts src/lib/mutagen-runtime.ts src/lib/upgrade-version.ts --format esm --dts",
22
- "dev": "tsup src/index.ts src/lib/mount-config.ts src/lib/mount-host.ts src/lib/mount-mutagen.ts src/lib/mount-reconcile.ts src/lib/mutagen-runtime.ts src/lib/upgrade-version.ts --format esm --watch",
21
+ "build": "tsup src/index.ts src/lib/autossh-runtime.ts src/lib/mount-config.ts src/lib/mount-host.ts src/lib/mount-mutagen.ts src/lib/mount-reconcile.ts src/lib/mutagen-runtime.ts src/lib/ssh-access.ts src/lib/ssh-config.ts src/lib/upgrade-version.ts --format esm --dts",
22
+ "dev": "tsup src/index.ts src/lib/autossh-runtime.ts src/lib/mount-config.ts src/lib/mount-host.ts src/lib/mount-mutagen.ts src/lib/mount-reconcile.ts src/lib/mutagen-runtime.ts src/lib/ssh-access.ts src/lib/ssh-config.ts src/lib/upgrade-version.ts --format esm --watch",
23
23
  "postinstall": "node ./scripts/postinstall.mjs",
24
24
  "prepack": "npm run build",
25
25
  "sync:nix": "../../scripts/cli/sync-nix-package.sh",
@@ -2,34 +2,47 @@ import { spawnSync } from "node:child_process";
2
2
  import { dirname, join } from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
 
5
- if (process.env.AICOMPUTER_SKIP_MUTAGEN_POSTINSTALL === "1") {
6
- process.exit(0);
7
- }
5
+ const supportedPlatform = ["darwin", "linux"].includes(process.platform);
6
+ const globalInstall = process.env.npm_config_global === "true";
8
7
 
9
- if (process.env.npm_config_global !== "true") {
10
- process.exit(0);
11
- }
12
-
13
- if (!["darwin", "linux"].includes(process.platform)) {
8
+ if (!supportedPlatform || !globalInstall) {
14
9
  process.exit(0);
15
10
  }
16
11
 
17
12
  const scriptsDir = dirname(fileURLToPath(import.meta.url));
18
13
  const entrypoint = join(scriptsDir, "..", "dist", "index.js");
19
- const install = spawnSync(
20
- process.execPath,
21
- [entrypoint, "internal-install-mutagen", "--quiet"],
22
- {
23
- stdio: "inherit",
24
- env: process.env,
25
- },
26
- );
27
-
28
- if (install.status === 0) {
29
- process.exit(0);
30
- }
31
14
 
32
- console.warn(
33
- "Agent Computer installed successfully, but bundled Mutagen did not finish installing. `computer mount` will retry on first use.",
34
- );
15
+ runBundledInstall({
16
+ command: "internal-install-mutagen",
17
+ skipEnvVar: "AICOMPUTER_SKIP_MUTAGEN_POSTINSTALL",
18
+ warning:
19
+ "Agent Computer installed successfully, but bundled Mutagen did not finish installing. `computer mount` will retry on first use.",
20
+ });
21
+
22
+ runBundledInstall({
23
+ command: "internal-install-autossh",
24
+ skipEnvVar: "AICOMPUTER_SKIP_AUTOSSH_POSTINSTALL",
25
+ warning:
26
+ "Agent Computer installed successfully, but bundled autossh did not finish installing. `computer ssh` will retry on first use.",
27
+ });
28
+
35
29
  process.exit(0);
30
+
31
+ function runBundledInstall({ command, skipEnvVar, warning }) {
32
+ if (process.env[skipEnvVar] === "1") {
33
+ return;
34
+ }
35
+
36
+ const install = spawnSync(
37
+ process.execPath,
38
+ [entrypoint, command, "--quiet"],
39
+ {
40
+ stdio: "inherit",
41
+ env: process.env,
42
+ },
43
+ );
44
+
45
+ if (install.status !== 0) {
46
+ console.warn(warning);
47
+ }
48
+ }