aicomputer 0.1.9 → 0.1.10
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/README.md +6 -0
- package/dist/index.js +122 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,6 +15,8 @@ After installing, use the `computer` command:
|
|
|
15
15
|
```bash
|
|
16
16
|
computer login
|
|
17
17
|
computer login --api-key <ac_live_...>
|
|
18
|
+
computer claude-login
|
|
19
|
+
computer codex-login
|
|
18
20
|
computer whoami
|
|
19
21
|
computer create my-box
|
|
20
22
|
computer open my-box
|
|
@@ -29,6 +31,10 @@ computer fleet status
|
|
|
29
31
|
computer acp serve my-box --agent codex
|
|
30
32
|
```
|
|
31
33
|
|
|
34
|
+
`computer login` authenticates the CLI against Agent Computer. Use
|
|
35
|
+
`computer claude-login` and `computer codex-login` to install Claude Code or
|
|
36
|
+
Codex credentials onto a machine after the CLI is already logged in.
|
|
37
|
+
|
|
32
38
|
Run `computer ssh` without a handle in an interactive terminal to pick from your available machines.
|
|
33
39
|
|
|
34
40
|
Run `computer ssh --setup` once to register your SSH key and add a global alias:
|
package/dist/index.js
CHANGED
|
@@ -2321,7 +2321,7 @@ var getCommand = new Command5("get").description("Show computer details").argume
|
|
|
2321
2321
|
process.exit(1);
|
|
2322
2322
|
}
|
|
2323
2323
|
});
|
|
2324
|
-
var createCommand = new Command5("create").description("Create a computer").argument("[handle]", "Optional computer handle").option("--name <display-name>", "Display name").option("--
|
|
2324
|
+
var createCommand = new Command5("create").description("Create a computer").argument("[handle]", "Optional computer handle").option("--name <display-name>", "Display name").option("--interactive", "Prompt for runtime choices").option("--runtime-family <runtime-family>", "managed-worker or custom-machine").option("--source-kind <source-kind>", "none or oci-image").option("--image-family <family>", "Image family override").option("--image-ref <image>", "Resolved image override").option("--use-platform-default", "Use the AgentComputer platform default image").option("--primary-port <port>", "Primary app port").option("--primary-path <path>", "Primary app path").option("--healthcheck-type <type>", "http or tcp").option("--healthcheck-value <value>", "Health check path or port").option("--ssh-enabled", "Enable SSH access").option("--ssh-disabled", "Disable SSH access").option("--vnc-enabled", "Enable VNC access").option("--vnc-disabled", "Disable VNC access").action(async (handle, options) => {
|
|
2325
2325
|
let spinner;
|
|
2326
2326
|
let timer;
|
|
2327
2327
|
let startTime = 0;
|
|
@@ -2353,7 +2353,6 @@ var createCommand = new Command5("create").description("Create a computer").argu
|
|
|
2353
2353
|
const computer = await createComputer({
|
|
2354
2354
|
handle,
|
|
2355
2355
|
display_name: selectedOptions.name,
|
|
2356
|
-
tier: selectedOptions.tier,
|
|
2357
2356
|
runtime_family: runtimeFamily,
|
|
2358
2357
|
source_kind: parseSourceKindOption(selectedOptions.sourceKind),
|
|
2359
2358
|
image_family: selectedOptions.imageFamily,
|
|
@@ -2667,7 +2666,6 @@ _computer() {
|
|
|
2667
2666
|
create)
|
|
2668
2667
|
_arguments \\
|
|
2669
2668
|
'--name[Display name]:name:' \\
|
|
2670
|
-
'--tier[Tier override]:tier:' \\
|
|
2671
2669
|
'--interactive[Prompt for runtime choices]' \\
|
|
2672
2670
|
'--runtime-family[Runtime family]:family:(managed-worker custom-machine)' \\
|
|
2673
2671
|
'--source-kind[Source kind]:kind:(none oci-image)' \\
|
|
@@ -2832,7 +2830,7 @@ var BASH_SCRIPT = `_computer() {
|
|
|
2832
2830
|
COMPREPLY=($(compgen -W "--machine --keep-helper --skip-cross-check --verbose" -- "$cur"))
|
|
2833
2831
|
;;
|
|
2834
2832
|
create)
|
|
2835
|
-
COMPREPLY=($(compgen -W "--name --
|
|
2833
|
+
COMPREPLY=($(compgen -W "--name --interactive --runtime-family --source-kind --image-family --image-ref --use-platform-default --primary-port --primary-path --healthcheck-type --healthcheck-value --ssh-enabled --ssh-disabled --vnc-enabled --vnc-disabled" -- "$cur"))
|
|
2836
2834
|
;;
|
|
2837
2835
|
ls)
|
|
2838
2836
|
COMPREPLY=($(compgen -W "--json --verbose -v" -- "$cur"))
|
|
@@ -3399,29 +3397,40 @@ imageCommand.command("rm").description("Delete a machine image source").argument
|
|
|
3399
3397
|
}
|
|
3400
3398
|
});
|
|
3401
3399
|
function printMachineSourceSettings(settings) {
|
|
3402
|
-
console.log(` ${chalk8.dim("Default")} ${chalk8.white(
|
|
3400
|
+
console.log(` ${chalk8.dim("Default")} ${chalk8.white(summarizeDefaultMachineSource(settings))}`);
|
|
3403
3401
|
console.log();
|
|
3404
3402
|
if (settings.sources.length === 0) {
|
|
3405
3403
|
console.log(chalk8.dim(" No custom machine images configured yet."));
|
|
3406
3404
|
console.log();
|
|
3407
3405
|
return;
|
|
3408
3406
|
}
|
|
3409
|
-
|
|
3407
|
+
console.log(` ${chalk8.dim("Custom")} ${chalk8.white(formatMachineSourceCounts(settings.sources))}`);
|
|
3408
|
+
console.log();
|
|
3409
|
+
for (const source of sortMachineSources(settings.sources, settings.default_machine_source_id)) {
|
|
3410
3410
|
printMachineSourceCard(source, settings.default_machine_source_id === source.id);
|
|
3411
3411
|
}
|
|
3412
3412
|
}
|
|
3413
3413
|
function printMachineSourceCard(source, isDefault) {
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3414
|
+
const statusLabel = padEnd(formatMachineSourceStatus(source.status), 12);
|
|
3415
|
+
const meta = [
|
|
3416
|
+
source.kind === "oci-image" ? "oci-image" : "nix-git",
|
|
3417
|
+
`id ${source.id}`,
|
|
3418
|
+
`updated ${timeAgo(source.updated_at)}`
|
|
3419
|
+
];
|
|
3420
|
+
const extra = machineSourceExtraParts(source);
|
|
3421
|
+
console.log(
|
|
3422
|
+
` ${statusLabel}${chalk8.bold(machineSourceTitle(source))}${isDefault ? chalk8.green(" default") : ""}`
|
|
3423
|
+
);
|
|
3424
|
+
console.log(` ${chalk8.dim(meta.concat(extra).join(" | "))}`);
|
|
3425
|
+
console.log(` ${chalk8.dim(machineSourceStatusSummary(source))}`);
|
|
3418
3426
|
if (source.resolved_image_ref) {
|
|
3419
|
-
console.log(`
|
|
3427
|
+
console.log(` ${chalk8.dim("resolved")} ${source.resolved_image_ref}`);
|
|
3428
|
+
} else if (source.last_good_resolved_image_ref) {
|
|
3429
|
+
console.log(` ${chalk8.dim("last good")} ${source.last_good_resolved_image_ref}`);
|
|
3420
3430
|
}
|
|
3421
3431
|
if (source.error) {
|
|
3422
|
-
console.log(`
|
|
3432
|
+
console.log(` ${chalk8.red(source.error)}`);
|
|
3423
3433
|
}
|
|
3424
|
-
console.log(` ${chalk8.dim(" Source")} ${summarizeMachineSource(source)}`);
|
|
3425
3434
|
console.log();
|
|
3426
3435
|
}
|
|
3427
3436
|
function machineSourceTitle(source) {
|
|
@@ -3430,6 +3439,106 @@ function machineSourceTitle(source) {
|
|
|
3430
3439
|
}
|
|
3431
3440
|
return source.git_url || "Nix git source";
|
|
3432
3441
|
}
|
|
3442
|
+
function summarizeDefaultMachineSource(settings) {
|
|
3443
|
+
if (settings.platform_default || !settings.default_machine_source) {
|
|
3444
|
+
return "platform default";
|
|
3445
|
+
}
|
|
3446
|
+
return machineSourceTitle(settings.default_machine_source);
|
|
3447
|
+
}
|
|
3448
|
+
function formatMachineSourceCounts(sources) {
|
|
3449
|
+
const counts = {
|
|
3450
|
+
ready: 0,
|
|
3451
|
+
active: 0,
|
|
3452
|
+
failed: 0
|
|
3453
|
+
};
|
|
3454
|
+
for (const source of sources) {
|
|
3455
|
+
if (source.status === "ready") {
|
|
3456
|
+
counts.ready += 1;
|
|
3457
|
+
} else if (source.status === "failed") {
|
|
3458
|
+
counts.failed += 1;
|
|
3459
|
+
} else {
|
|
3460
|
+
counts.active += 1;
|
|
3461
|
+
}
|
|
3462
|
+
}
|
|
3463
|
+
const parts = [`${sources.length} total`, `${counts.ready} ready`];
|
|
3464
|
+
if (counts.active > 0) {
|
|
3465
|
+
parts.push(`${counts.active} in progress`);
|
|
3466
|
+
}
|
|
3467
|
+
if (counts.failed > 0) {
|
|
3468
|
+
parts.push(`${counts.failed} failed`);
|
|
3469
|
+
}
|
|
3470
|
+
return parts.join(" | ");
|
|
3471
|
+
}
|
|
3472
|
+
function sortMachineSources(sources, defaultMachineSourceID) {
|
|
3473
|
+
return [...sources].sort((left, right) => {
|
|
3474
|
+
const rankDelta = machineSourceSortRank(left, defaultMachineSourceID) - machineSourceSortRank(right, defaultMachineSourceID);
|
|
3475
|
+
if (rankDelta !== 0) {
|
|
3476
|
+
return rankDelta;
|
|
3477
|
+
}
|
|
3478
|
+
return new Date(right.updated_at).getTime() - new Date(left.updated_at).getTime();
|
|
3479
|
+
});
|
|
3480
|
+
}
|
|
3481
|
+
function machineSourceSortRank(source, defaultMachineSourceID) {
|
|
3482
|
+
if (source.id === defaultMachineSourceID) {
|
|
3483
|
+
return 0;
|
|
3484
|
+
}
|
|
3485
|
+
switch (source.status) {
|
|
3486
|
+
case "pending":
|
|
3487
|
+
case "resolving":
|
|
3488
|
+
case "building":
|
|
3489
|
+
return 1;
|
|
3490
|
+
case "failed":
|
|
3491
|
+
return 2;
|
|
3492
|
+
case "ready":
|
|
3493
|
+
return 3;
|
|
3494
|
+
default:
|
|
3495
|
+
return 4;
|
|
3496
|
+
}
|
|
3497
|
+
}
|
|
3498
|
+
function formatMachineSourceStatus(status) {
|
|
3499
|
+
const text = status.toUpperCase();
|
|
3500
|
+
switch (status) {
|
|
3501
|
+
case "ready":
|
|
3502
|
+
return chalk8.green(text);
|
|
3503
|
+
case "failed":
|
|
3504
|
+
return chalk8.red(text);
|
|
3505
|
+
case "pending":
|
|
3506
|
+
case "resolving":
|
|
3507
|
+
case "building":
|
|
3508
|
+
return chalk8.yellow(text);
|
|
3509
|
+
default:
|
|
3510
|
+
return text;
|
|
3511
|
+
}
|
|
3512
|
+
}
|
|
3513
|
+
function machineSourceExtraParts(source) {
|
|
3514
|
+
if (source.kind === "oci-image") {
|
|
3515
|
+
return ["digest-pinned registry image"];
|
|
3516
|
+
}
|
|
3517
|
+
const parts = [];
|
|
3518
|
+
if (source.git_ref) {
|
|
3519
|
+
parts.push(`ref ${source.git_ref}`);
|
|
3520
|
+
}
|
|
3521
|
+
if (source.git_subpath) {
|
|
3522
|
+
parts.push(`subpath ${source.git_subpath}`);
|
|
3523
|
+
}
|
|
3524
|
+
return parts;
|
|
3525
|
+
}
|
|
3526
|
+
function machineSourceStatusSummary(source) {
|
|
3527
|
+
switch (source.status) {
|
|
3528
|
+
case "ready":
|
|
3529
|
+
return "Ready to use for new managed machines.";
|
|
3530
|
+
case "pending":
|
|
3531
|
+
return "Queued to resolve or build.";
|
|
3532
|
+
case "resolving":
|
|
3533
|
+
return source.kind === "oci-image" ? "Resolving the requested image ref." : "Resolving the latest build result.";
|
|
3534
|
+
case "building":
|
|
3535
|
+
return "Build in progress. This source is not selectable yet.";
|
|
3536
|
+
case "failed":
|
|
3537
|
+
return source.last_good_resolved_image_ref ? "Latest build failed. Last good image is shown below." : "Build failed. Fix the source and rebuild.";
|
|
3538
|
+
default:
|
|
3539
|
+
return source.status;
|
|
3540
|
+
}
|
|
3541
|
+
}
|
|
3433
3542
|
function parseMachineSourceKind(value) {
|
|
3434
3543
|
switch (value) {
|
|
3435
3544
|
case void 0:
|