@skrr-ai/cli 0.1.25 → 0.1.27

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.
Files changed (80) hide show
  1. package/dist/base-command.js +29 -5
  2. package/dist/commands/code/install.js +13 -0
  3. package/dist/commands/harnesses/leases/billing.d.ts +9 -6
  4. package/dist/commands/harnesses/leases/billing.js +19 -24
  5. package/dist/commands/machines/dedicated/attach.d.ts +28 -0
  6. package/dist/commands/machines/dedicated/attach.js +76 -0
  7. package/dist/commands/machines/dedicated/catalog.d.ts +17 -0
  8. package/dist/commands/machines/dedicated/catalog.js +75 -0
  9. package/dist/commands/machines/dedicated/cp.d.ts +22 -0
  10. package/dist/commands/machines/dedicated/cp.js +76 -0
  11. package/dist/commands/machines/dedicated/create.d.ts +6 -2
  12. package/dist/commands/machines/dedicated/create.js +29 -20
  13. package/dist/commands/machines/dedicated/current.d.ts +19 -0
  14. package/dist/commands/machines/dedicated/current.js +49 -0
  15. package/dist/commands/machines/dedicated/destroy.d.ts +6 -2
  16. package/dist/commands/machines/dedicated/destroy.js +43 -25
  17. package/dist/commands/machines/dedicated/exec.d.ts +32 -0
  18. package/dist/commands/machines/dedicated/exec.js +122 -0
  19. package/dist/commands/machines/dedicated/grow.d.ts +6 -2
  20. package/dist/commands/machines/dedicated/grow.js +16 -20
  21. package/dist/commands/machines/dedicated/health-check.d.ts +2 -2
  22. package/dist/commands/machines/dedicated/health-check.js +18 -15
  23. package/dist/commands/machines/dedicated/incident-close.d.ts +3 -2
  24. package/dist/commands/machines/dedicated/incident-close.js +13 -15
  25. package/dist/commands/machines/dedicated/index.js +39 -16
  26. package/dist/commands/machines/dedicated/list.d.ts +2 -2
  27. package/dist/commands/machines/dedicated/list.js +28 -17
  28. package/dist/commands/machines/dedicated/restart.d.ts +5 -2
  29. package/dist/commands/machines/dedicated/restart.js +10 -20
  30. package/dist/commands/machines/dedicated/restore.d.ts +26 -0
  31. package/dist/commands/machines/dedicated/restore.js +64 -0
  32. package/dist/commands/machines/dedicated/show.d.ts +2 -2
  33. package/dist/commands/machines/dedicated/show.js +30 -31
  34. package/dist/commands/machines/dedicated/sign-in.d.ts +19 -0
  35. package/dist/commands/machines/dedicated/sign-in.js +49 -0
  36. package/dist/commands/machines/dedicated/snapshot.d.ts +5 -2
  37. package/dist/commands/machines/dedicated/snapshot.js +13 -20
  38. package/dist/commands/machines/dedicated/spending-limit.d.ts +22 -0
  39. package/dist/commands/machines/dedicated/spending-limit.js +51 -0
  40. package/dist/commands/machines/dedicated/start.d.ts +5 -2
  41. package/dist/commands/machines/dedicated/start.js +10 -20
  42. package/dist/commands/machines/dedicated/stop.d.ts +5 -2
  43. package/dist/commands/machines/dedicated/stop.js +10 -20
  44. package/dist/commands/machines/dedicated/terminal.d.ts +22 -0
  45. package/dist/commands/machines/dedicated/terminal.js +42 -0
  46. package/dist/commands/tasks/list.js +27 -0
  47. package/dist/lib/daemonBroker.d.ts +8 -0
  48. package/dist/lib/daemonBroker.js +2 -2
  49. package/dist/lib/dedicated-copy.d.ts +22 -0
  50. package/dist/lib/dedicated-copy.js +115 -0
  51. package/dist/lib/dedicated-exec.d.ts +80 -0
  52. package/dist/lib/dedicated-exec.js +271 -0
  53. package/dist/lib/dedicated-lease-command.d.ts +59 -0
  54. package/dist/lib/dedicated-lease-command.js +181 -0
  55. package/dist/lib/dedicated-machines.d.ts +337 -12
  56. package/dist/lib/dedicated-machines.js +502 -25
  57. package/dist/lib/dedicated-terminal.d.ts +89 -0
  58. package/dist/lib/dedicated-terminal.js +275 -0
  59. package/dist/lib/dedicated-wait.d.ts +72 -0
  60. package/dist/lib/dedicated-wait.js +195 -0
  61. package/dist/lib/edge-error-page.d.ts +49 -0
  62. package/dist/lib/edge-error-page.js +120 -0
  63. package/dist/lib/harnesses.d.ts +15 -1
  64. package/dist/lib/harnesses.js +20 -2
  65. package/dist/lib/hosted-machines.js +7 -0
  66. package/dist/lib/node-adapter.js +1 -1
  67. package/dist/lib/sky-code.d.ts +30 -1
  68. package/dist/lib/sky-code.js +44 -2
  69. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +1 -1
  70. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +2 -1
  71. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.d.ts +10 -0
  72. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.js +17 -1
  73. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +1 -1
  74. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +1 -1
  75. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.d.ts +10 -0
  76. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.js +16 -0
  77. package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
  78. package/dist/node_modules/@skrr-ai/data-provider/index.js +2625 -2608
  79. package/oclif.manifest.json +27851 -26936
  80. package/package.json +1 -1
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
- const base_command_1 = require("../../../base-command");
4
+ const dedicated_lease_command_1 = require("../../../lib/dedicated-lease-command");
5
5
  const format_1 = require("../../../lib/format");
6
6
  const dedicated_machines_1 = require("../../../lib/dedicated-machines");
7
- class DedicatedMachinesList extends base_command_1.BaseCommand {
7
+ class DedicatedMachinesList extends dedicated_lease_command_1.DedicatedLeaseCommand {
8
8
  static description = 'List Dedicated Runtime leases';
9
9
  static examples = [
10
10
  '<%= config.bin %> machines dedicated list',
11
- '<%= config.bin %> machines dedicated list --json',
11
+ '<%= config.bin %> machines dedicated list --state stopped',
12
+ '<%= config.bin %> machines dedicated list --workspace <workspace-id> --json',
12
13
  ];
13
14
  static flags = {
14
15
  json: core_1.Flags.boolean({ description: 'Output as JSON' }),
@@ -18,38 +19,48 @@ class DedicatedMachinesList extends base_command_1.BaseCommand {
18
19
  async run() {
19
20
  this.requireAuth();
20
21
  const { flags } = await this.parse(DedicatedMachinesList);
21
- let response;
22
- try {
23
- response = await (0, dedicated_machines_1.listDedicatedRuntimes)({
24
- limit: flags.limit,
25
- state: flags.state,
26
- });
27
- }
28
- catch (err) {
29
- const message = (0, dedicated_machines_1.formatDedicatedRuntimeApiError)(err);
30
- if (message)
31
- this.error(message, { exit: 1 });
32
- this.handleApiError(err);
33
- }
22
+ const response = await this.callDedicated(() => (0, dedicated_machines_1.listDedicatedRuntimes)({
23
+ limit: flags.limit,
24
+ state: flags.state,
25
+ ...this.scopeFrom(flags),
26
+ }));
34
27
  if (flags.json) {
35
28
  this.log(JSON.stringify(response, null, 2));
36
29
  return;
37
30
  }
38
31
  const leases = response?.leases ?? [];
39
32
  if (leases.length === 0) {
40
- this.log('No Dedicated Runtime leases.');
33
+ // An empty filtered list and an empty account are different facts, and a
34
+ // scope that sees nothing is the usual reason a machine "disappeared".
35
+ this.log(flags.state
36
+ ? `No Dedicated Runtime leases in state "${flags.state}".`
37
+ : 'No Dedicated Runtime leases.');
38
+ if (!flags.workspace) {
39
+ this.log('Machines created in a workspace are listed with --workspace <id>.');
40
+ }
41
41
  return;
42
42
  }
43
43
  (0, format_1.renderTable)(leases.map((lease) => ({
44
44
  id: (0, format_1.formatCell)((0, dedicated_machines_1.dedicatedLeaseId)(lease)),
45
45
  status: (0, format_1.formatCell)((0, dedicated_machines_1.dedicatedLeaseState)(lease)),
46
46
  name: (0, format_1.formatCell)((0, dedicated_machines_1.dedicatedLeaseDisplayName)(lease)),
47
+ size: (0, format_1.formatCell)([
48
+ lease.resources?.sizePreset,
49
+ lease.resources?.storageGb ? `${lease.resources.storageGb}G` : '',
50
+ ]
51
+ .filter(Boolean)
52
+ .join(' ') || '-'),
53
+ spend: (0, format_1.formatCell)(lease.billing
54
+ ? `${(0, dedicated_machines_1.formatUsdCents)(lease.billing.currentMonthSpendCents)}/${(0, dedicated_machines_1.formatUsdCents)(lease.billing.monthlySpendLimitCents)}${lease.billing.spendingLimitExceeded ? ' OVER' : ''}`
55
+ : '-'),
47
56
  retention: (0, format_1.formatCell)(lease.storage?.retentionClass || '-'),
48
57
  backup: (0, format_1.formatCell)(lease.storage?.lastBackupAt || '-'),
49
58
  })), [
50
59
  { key: 'id', header: 'ID' },
51
60
  { key: 'status', header: 'STATUS' },
52
61
  { key: 'name', header: 'NAME', maxWidth: 28 },
62
+ { key: 'size', header: 'SIZE', maxWidth: 18 },
63
+ { key: 'spend', header: 'MONTH/CAP', maxWidth: 24 },
53
64
  { key: 'retention', header: 'RETENTION', maxWidth: 14 },
54
65
  { key: 'backup', header: 'LAST BACKUP', maxWidth: 24 },
55
66
  ], (line) => this.log(line));
@@ -1,11 +1,14 @@
1
- import { BaseCommand } from '../../../base-command';
2
- export default class DedicatedMachinesRestart extends BaseCommand {
1
+ import { DedicatedLeaseCommand } from '../../../lib/dedicated-lease-command';
2
+ export default class DedicatedMachinesRestart extends DedicatedLeaseCommand {
3
3
  static description: string;
4
4
  static examples: string[];
5
5
  static args: {
6
6
  lease: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
7
7
  };
8
8
  static flags: {
9
+ wait: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
+ timeout: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ interval: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
9
12
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
13
  };
11
14
  run(): Promise<void>;
@@ -1,42 +1,32 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
- const base_command_1 = require("../../../base-command");
4
+ const dedicated_lease_command_1 = require("../../../lib/dedicated-lease-command");
5
5
  const dedicated_machines_1 = require("../../../lib/dedicated-machines");
6
- class DedicatedMachinesRestart extends base_command_1.BaseCommand {
7
- static description = 'Restart a Dedicated Runtime lease';
6
+ class DedicatedMachinesRestart extends dedicated_lease_command_1.DedicatedLeaseCommand {
7
+ static description = 'Restart a Dedicated Runtime to recover availability. Files survive; memory, shells and background jobs do not.';
8
8
  static examples = [
9
9
  '<%= config.bin %> machines dedicated restart <lease-id>',
10
- '<%= config.bin %> machines dedicated restart <lease-id> --json',
10
+ '<%= config.bin %> machines dedicated restart <lease-id> --wait',
11
+ '<%= config.bin %> machines dedicated restart <lease-id> --wait --timeout 10m --json',
11
12
  ];
12
13
  static args = {
13
14
  lease: core_1.Args.string({
14
- description: 'Dedicated Runtime lease id',
15
+ description: dedicated_lease_command_1.DEDICATED_LEASE_ARG_DESCRIPTION,
15
16
  required: true,
16
17
  ignoreStdin: true,
17
18
  }),
18
19
  };
19
20
  static flags = {
20
21
  json: core_1.Flags.boolean({ description: 'Output as JSON' }),
22
+ ...dedicated_lease_command_1.dedicatedWaitFlags,
21
23
  };
22
24
  async run() {
23
25
  this.requireAuth();
24
26
  const { args, flags } = await this.parse(DedicatedMachinesRestart);
25
- let response;
26
- try {
27
- response = await (0, dedicated_machines_1.performDedicatedLeaseAction)(args.lease, 'restart');
28
- }
29
- catch (err) {
30
- const message = (0, dedicated_machines_1.formatDedicatedRuntimeApiError)(err);
31
- if (message)
32
- this.error(message, { exit: 1 });
33
- this.handleApiError(err);
34
- }
35
- if (flags.json) {
36
- this.log(JSON.stringify(response, null, 2));
37
- return;
38
- }
39
- this.log(`Dedicated Runtime ${(0, dedicated_machines_1.dedicatedLeaseId)(response?.lease)} ${(0, dedicated_machines_1.dedicatedLeaseState)(response?.lease)}.`);
27
+ const leaseId = await this.resolveLeaseArg(args.lease);
28
+ const response = await this.callDedicated(() => (0, dedicated_machines_1.performDedicatedLeaseAction)(leaseId, 'restart', this.scopeFrom(flags)));
29
+ await this.reportLeaseAction(response, flags, { kind: 'running' }, 'Restarting');
40
30
  }
41
31
  }
42
32
  exports.default = DedicatedMachinesRestart;
@@ -0,0 +1,26 @@
1
+ import { DedicatedLeaseCommand } from '../../../lib/dedicated-lease-command';
2
+ /**
3
+ * `skrr machines dedicated restore` — bring back a deleted Dedicated Runtime.
4
+ *
5
+ * Deleting a workspace keeps one final recovery point for a window (seven days
6
+ * by default), because whoever deleted it may have been an agent acting with
7
+ * the owner's authority. This builds a NEW machine from that point, with the
8
+ * deleted one's files; the deleted lease stays deleted.
9
+ */
10
+ export default class DedicatedMachinesRestore extends DedicatedLeaseCommand {
11
+ static description: string;
12
+ static examples: string[];
13
+ static args: {
14
+ lease: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
15
+ };
16
+ static flags: {
17
+ wait: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
18
+ timeout: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
19
+ interval: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
20
+ name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
21
+ 'spending-limit-cents': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
22
+ 'request-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
23
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
24
+ };
25
+ run(): Promise<void>;
26
+ }
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const node_crypto_1 = require("node:crypto");
5
+ const dedicated_lease_command_1 = require("../../../lib/dedicated-lease-command");
6
+ const dedicated_machines_1 = require("../../../lib/dedicated-machines");
7
+ /**
8
+ * `skrr machines dedicated restore` — bring back a deleted Dedicated Runtime.
9
+ *
10
+ * Deleting a workspace keeps one final recovery point for a window (seven days
11
+ * by default), because whoever deleted it may have been an agent acting with
12
+ * the owner's authority. This builds a NEW machine from that point, with the
13
+ * deleted one's files; the deleted lease stays deleted.
14
+ */
15
+ class DedicatedMachinesRestore extends dedicated_lease_command_1.DedicatedLeaseCommand {
16
+ static description = 'Restore a deleted Dedicated Runtime into a new machine, from the recovery point its deletion kept. Only inside the recovery window, and once.';
17
+ static examples = [
18
+ '<%= config.bin %> machines dedicated restore <deleted-lease-id>',
19
+ '<%= config.bin %> machines dedicated restore <deleted-lease-id> --name research-box --wait',
20
+ ];
21
+ static args = {
22
+ lease: core_1.Args.string({
23
+ description: 'The deleted Dedicated Runtime lease id (see `machines dedicated show`)',
24
+ required: true,
25
+ ignoreStdin: true,
26
+ }),
27
+ };
28
+ static flags = {
29
+ name: core_1.Flags.string({
30
+ description: 'Display name for the new machine (defaults to the deleted one, "(restored)")',
31
+ }),
32
+ 'spending-limit-cents': core_1.Flags.integer({
33
+ description: "Monthly spending cap for the new machine (defaults to the deleted machine's)",
34
+ min: 1,
35
+ }),
36
+ 'request-id': core_1.Flags.string({
37
+ description: 'Idempotency key. Reuse it to safely retry the same restore.',
38
+ }),
39
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
40
+ ...dedicated_lease_command_1.dedicatedWaitFlags,
41
+ };
42
+ async run() {
43
+ this.requireAuth();
44
+ const { args, flags } = await this.parse(DedicatedMachinesRestore);
45
+ const requestId = flags['request-id'] || `dedicated-restore:${Date.now()}:${(0, node_crypto_1.randomBytes)(6).toString('hex')}`;
46
+ const response = await this.callDedicated(() => (0, dedicated_machines_1.restoreDeletedDedicatedRuntime)(args.lease, {
47
+ ...this.scopeFrom(flags),
48
+ requestId,
49
+ ...(flags.name ? { displayName: flags.name } : {}),
50
+ ...(flags['spending-limit-cents'] !== undefined
51
+ ? { monthlySpendingLimitCents: flags['spending-limit-cents'] }
52
+ : {}),
53
+ }));
54
+ if (!flags.json) {
55
+ const lease = response?.lease;
56
+ this.log(`Restoring ${args.lease} into ${(0, dedicated_machines_1.dedicatedLeaseDisplayName)(lease)} (${(0, dedicated_machines_1.dedicatedLeaseId)(lease) || 'unknown'}).`);
57
+ if (flags.wait && !flags['request-id']) {
58
+ process.stderr.write(`Request id ${requestId} (reuse it with --request-id to retry safely)\n`);
59
+ }
60
+ }
61
+ await this.reportLeaseAction(response, flags, { kind: 'running' }, 'Restoring');
62
+ }
63
+ }
64
+ exports.default = DedicatedMachinesRestore;
@@ -1,5 +1,5 @@
1
- import { BaseCommand } from '../../../base-command';
2
- export default class DedicatedMachinesShow extends BaseCommand {
1
+ import { DedicatedLeaseCommand } from '../../../lib/dedicated-lease-command';
2
+ export default class DedicatedMachinesShow extends DedicatedLeaseCommand {
3
3
  static description: string;
4
4
  static examples: string[];
5
5
  static args: {
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
- const base_command_1 = require("../../../base-command");
4
+ const dedicated_lease_command_1 = require("../../../lib/dedicated-lease-command");
5
5
  const dedicated_machines_1 = require("../../../lib/dedicated-machines");
6
- class DedicatedMachinesShow extends base_command_1.BaseCommand {
7
- static description = 'Show one Dedicated Runtime lease';
6
+ const harnesses_1 = require("../../../lib/harnesses");
7
+ class DedicatedMachinesShow extends dedicated_lease_command_1.DedicatedLeaseCommand {
8
+ static description = 'Show one Dedicated Runtime lease: state, size, workspace, spend against the cap, health, deletion clock and the engines its daemon registered';
8
9
  static examples = [
9
10
  '<%= config.bin %> machines dedicated show <lease-id>',
10
11
  '<%= config.bin %> machines dedicated show <lease-id> --json',
@@ -12,47 +13,45 @@ class DedicatedMachinesShow extends base_command_1.BaseCommand {
12
13
  static args = {
13
14
  lease: core_1.Args.string({
14
15
  ignoreStdin: true,
15
- description: 'Dedicated Runtime lease id',
16
+ description: dedicated_lease_command_1.DEDICATED_LEASE_ARG_DESCRIPTION,
16
17
  required: true,
17
18
  }),
18
19
  };
19
- static flags = { json: core_1.Flags.boolean({ description: 'Output as JSON' }) };
20
+ static flags = {
21
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
22
+ };
20
23
  async run() {
21
24
  this.requireAuth();
22
25
  const { args, flags } = await this.parse(DedicatedMachinesShow);
23
- let response;
24
- try {
25
- response = await (0, dedicated_machines_1.getDedicatedRuntime)(args.lease);
26
- }
27
- catch (err) {
28
- const message = (0, dedicated_machines_1.formatDedicatedRuntimeApiError)(err);
29
- if (message)
30
- this.error(message, { exit: 1 });
31
- this.handleApiError(err);
32
- }
26
+ const leaseId = await this.resolveLeaseArg(args.lease);
27
+ const response = await this.callDedicated(() => (0, dedicated_machines_1.getDedicatedRuntime)(leaseId, this.scopeFrom(flags)));
33
28
  const lease = response?.lease;
34
29
  if (!lease) {
35
30
  this.error('Dedicated Runtime lease not found.', { exit: 1 });
36
31
  }
37
- if (flags.json) {
38
- this.log(JSON.stringify(response, null, 2));
39
- return;
40
- }
41
- this.log((0, dedicated_machines_1.dedicatedLeaseDisplayName)(lease));
42
- this.log(` id ${(0, dedicated_machines_1.dedicatedLeaseId)(lease)}`);
43
- this.log(` status ${(0, dedicated_machines_1.dedicatedLeaseState)(lease)}`);
44
- if (lease.storage?.retentionClass) {
45
- this.log(` retention ${lease.storage.retentionClass}`);
46
- }
47
- if (lease.storage?.backupProfile) {
48
- this.log(` backup ${lease.storage.backupProfile}`);
32
+ // The harness rows are what an agent attaches to and what a terminal opens
33
+ // on, and the lease payload deliberately names no daemon. Best-effort: a
34
+ // failed harness read must not hide the lease the caller asked for.
35
+ let harnesses = [];
36
+ try {
37
+ const listed = (await (0, harnesses_1.listHarnesses)());
38
+ harnesses = Array.isArray(listed) ? listed : (listed?.harnesses ?? []);
49
39
  }
50
- if (lease.storage?.lastBackupAt) {
51
- this.log(` last backup ${lease.storage.lastBackupAt}`);
40
+ catch {
41
+ harnesses = [];
52
42
  }
53
- if (lease.billing?.monthlySpendLimitCents != null) {
54
- this.log(` monthly cap ${lease.billing.monthlySpendLimitCents} cents`);
43
+ if (flags.json) {
44
+ const engines = (0, dedicated_machines_1.dedicatedLeaseHarnesses)(lease, harnesses).map((harness) => ({
45
+ harnessId: harness._id,
46
+ provider: harness.provider,
47
+ status: harness.status,
48
+ lastSeenAt: harness.lastSeenAt,
49
+ }));
50
+ this.log(JSON.stringify({ ...response, harnesses: engines }, null, 2));
51
+ return;
55
52
  }
53
+ for (const line of (0, dedicated_machines_1.describeDedicatedLease)(lease, harnesses))
54
+ this.log(line);
56
55
  }
57
56
  }
58
57
  exports.default = DedicatedMachinesShow;
@@ -0,0 +1,19 @@
1
+ import { DedicatedLeaseCommand } from '../../../lib/dedicated-lease-command';
2
+ /**
3
+ * `skrr machines dedicated sign-in` — the lease card's Sign in menu.
4
+ *
5
+ * Opens the machine's terminal and types the tool's sign-in command once the
6
+ * shell is ready. The commands are the SAME fixed strings the web offers,
7
+ * declared once in `@skrr-ai/data-provider`; each is a device-code or
8
+ * paste-a-code flow, because the machine has no browser.
9
+ */
10
+ export default class DedicatedMachinesSignIn extends DedicatedLeaseCommand {
11
+ static description: string;
12
+ static examples: string[];
13
+ static args: {
14
+ lease: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
15
+ tool: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
16
+ };
17
+ static flags: {};
18
+ run(): Promise<void>;
19
+ }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const data_provider_1 = require("@skrr-ai/data-provider");
5
+ const dedicated_lease_command_1 = require("../../../lib/dedicated-lease-command");
6
+ const TOOLS = data_provider_1.DEDICATED_RUNTIME_SIGN_IN_PRESETS.map((preset) => preset.tool);
7
+ /**
8
+ * `skrr machines dedicated sign-in` — the lease card's Sign in menu.
9
+ *
10
+ * Opens the machine's terminal and types the tool's sign-in command once the
11
+ * shell is ready. The commands are the SAME fixed strings the web offers,
12
+ * declared once in `@skrr-ai/data-provider`; each is a device-code or
13
+ * paste-a-code flow, because the machine has no browser.
14
+ */
15
+ class DedicatedMachinesSignIn extends dedicated_lease_command_1.DedicatedLeaseCommand {
16
+ static description = 'Sign in to GitHub CLI, Claude Code or Codex on a Dedicated Runtime, in an interactive terminal. The sign-in is shared by everything that runs on the machine, agents included.';
17
+ static examples = [
18
+ '<%= config.bin %> machines dedicated sign-in <lease-id> github',
19
+ '<%= config.bin %> machines dedicated sign-in <lease-id> claude',
20
+ '<%= config.bin %> machines dedicated sign-in <lease-id> codex',
21
+ ];
22
+ static args = {
23
+ lease: core_1.Args.string({
24
+ description: 'Dedicated Runtime lease id',
25
+ required: true,
26
+ ignoreStdin: true,
27
+ }),
28
+ tool: core_1.Args.string({
29
+ description: `What to sign in to: ${TOOLS.join(', ')}`,
30
+ required: true,
31
+ options: TOOLS,
32
+ ignoreStdin: true,
33
+ }),
34
+ };
35
+ static flags = {};
36
+ async run() {
37
+ this.requireAuth();
38
+ const { args, flags } = await this.parse(DedicatedMachinesSignIn);
39
+ const preset = data_provider_1.DEDICATED_RUNTIME_SIGN_IN_PRESETS.find((candidate) => candidate.tool === args.tool);
40
+ if (!preset) {
41
+ this.error(`Unknown tool "${args.tool}". Choose one of: ${TOOLS.join(', ')}.`, { exit: 2 });
42
+ }
43
+ // Said before, not after: once the code is entered the credential already
44
+ // sits on the workspace volume, in every later snapshot.
45
+ process.stderr.write(`${preset.label} sign-in is stored on the workspace volume and shared by everything running as skrr-workload on this machine, including agents. Prefer a narrowly-scoped account or token.\n`);
46
+ await this.openDedicatedTerminal(args.lease, flags, preset.command);
47
+ }
48
+ }
49
+ exports.default = DedicatedMachinesSignIn;
@@ -1,11 +1,14 @@
1
- import { BaseCommand } from '../../../base-command';
2
- export default class DedicatedMachinesSnapshot extends BaseCommand {
1
+ import { DedicatedLeaseCommand } from '../../../lib/dedicated-lease-command';
2
+ export default class DedicatedMachinesSnapshot extends DedicatedLeaseCommand {
3
3
  static description: string;
4
4
  static examples: string[];
5
5
  static args: {
6
6
  lease: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
7
7
  };
8
8
  static flags: {
9
+ wait: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
+ timeout: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ interval: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
9
12
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
13
  };
11
14
  run(): Promise<void>;
@@ -1,42 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
- const base_command_1 = require("../../../base-command");
4
+ const dedicated_lease_command_1 = require("../../../lib/dedicated-lease-command");
5
5
  const dedicated_machines_1 = require("../../../lib/dedicated-machines");
6
- class DedicatedMachinesSnapshot extends base_command_1.BaseCommand {
7
- static description = 'Snapshot a Dedicated Runtime lease workspace';
6
+ class DedicatedMachinesSnapshot extends dedicated_lease_command_1.DedicatedLeaseCommand {
7
+ static description = 'Take a recovery point of a Dedicated Runtime workspace before something risky. With --wait, succeeds only once a new recovery point is recorded.';
8
8
  static examples = [
9
9
  '<%= config.bin %> machines dedicated snapshot <lease-id>',
10
- '<%= config.bin %> machines dedicated snapshot <lease-id> --json',
10
+ '<%= config.bin %> machines dedicated snapshot <lease-id> --wait',
11
+ '<%= config.bin %> machines dedicated snapshot <lease-id> --wait --json',
11
12
  ];
12
13
  static args = {
13
14
  lease: core_1.Args.string({
14
- description: 'Dedicated Runtime lease id',
15
+ description: dedicated_lease_command_1.DEDICATED_LEASE_ARG_DESCRIPTION,
15
16
  required: true,
16
17
  ignoreStdin: true,
17
18
  }),
18
19
  };
19
20
  static flags = {
20
21
  json: core_1.Flags.boolean({ description: 'Output as JSON' }),
22
+ ...dedicated_lease_command_1.dedicatedWaitFlags,
21
23
  };
22
24
  async run() {
23
25
  this.requireAuth();
24
26
  const { args, flags } = await this.parse(DedicatedMachinesSnapshot);
25
- let response;
26
- try {
27
- response = await (0, dedicated_machines_1.performDedicatedLeaseAction)(args.lease, 'snapshot');
28
- }
29
- catch (err) {
30
- const message = (0, dedicated_machines_1.formatDedicatedRuntimeApiError)(err);
31
- if (message)
32
- this.error(message, { exit: 1 });
33
- this.handleApiError(err);
34
- }
35
- if (flags.json) {
36
- this.log(JSON.stringify(response, null, 2));
37
- return;
38
- }
39
- this.log(`Dedicated Runtime ${(0, dedicated_machines_1.dedicatedLeaseId)(response?.lease)} ${(0, dedicated_machines_1.dedicatedLeaseState)(response?.lease)}.`);
27
+ const leaseId = await this.resolveLeaseArg(args.lease);
28
+ const response = await this.callDedicated(() => (0, dedicated_machines_1.performDedicatedLeaseAction)(leaseId, 'snapshot', this.scopeFrom(flags)));
29
+ // A snapshot returns the lease to the state it left, so the state cannot say
30
+ // whether it worked. The recovery point's timestamp can: the 202 carries the
31
+ // previous one, and success is a newer one.
32
+ await this.reportLeaseAction(response, flags, { kind: 'snapshot', previousBackupAt: response?.lease?.storage?.lastBackupAt ?? null }, 'Snapshotting');
40
33
  }
41
34
  }
42
35
  exports.default = DedicatedMachinesSnapshot;
@@ -0,0 +1,22 @@
1
+ import { DedicatedLeaseCommand } from '../../../lib/dedicated-lease-command';
2
+ /**
3
+ * `skrr machines dedicated spending-limit` — change the monthly cap after create.
4
+ *
5
+ * The cap is the ONE guardrail on a machine with no wall-clock TTL: when a
6
+ * month's spend reaches it, the platform stops compute and keeps the workspace.
7
+ * It could be set at create and changed from the web lease card, but not from
8
+ * here — so an operator who hit it at 2am had to find a browser to raise it,
9
+ * and an agent watching its own machine could not lower it.
10
+ */
11
+ export default class DedicatedMachinesSpendingLimit extends DedicatedLeaseCommand {
12
+ static description: string;
13
+ static examples: string[];
14
+ static args: {
15
+ lease: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
16
+ };
17
+ static flags: {
18
+ cents: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
19
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
20
+ };
21
+ run(): Promise<void>;
22
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const dedicated_lease_command_1 = require("../../../lib/dedicated-lease-command");
5
+ const dedicated_machines_1 = require("../../../lib/dedicated-machines");
6
+ /**
7
+ * `skrr machines dedicated spending-limit` — change the monthly cap after create.
8
+ *
9
+ * The cap is the ONE guardrail on a machine with no wall-clock TTL: when a
10
+ * month's spend reaches it, the platform stops compute and keeps the workspace.
11
+ * It could be set at create and changed from the web lease card, but not from
12
+ * here — so an operator who hit it at 2am had to find a browser to raise it,
13
+ * and an agent watching its own machine could not lower it.
14
+ */
15
+ class DedicatedMachinesSpendingLimit extends dedicated_lease_command_1.DedicatedLeaseCommand {
16
+ static description = 'Change the monthly spending cap of a Dedicated Runtime. At the cap, compute stops and the workspace is kept.';
17
+ static examples = [
18
+ '<%= config.bin %> machines dedicated spending-limit <lease-id> --cents 30000',
19
+ '<%= config.bin %> machines dedicated spending-limit <lease-id> --cents 5000 --json',
20
+ ];
21
+ static args = {
22
+ lease: core_1.Args.string({
23
+ description: dedicated_lease_command_1.DEDICATED_LEASE_ARG_DESCRIPTION,
24
+ required: true,
25
+ ignoreStdin: true,
26
+ }),
27
+ };
28
+ static flags = {
29
+ cents: core_1.Flags.integer({
30
+ description: 'New monthly cap in cents (30000 = $300). Refused below what this month has already spent or is projected to.',
31
+ required: true,
32
+ min: 1,
33
+ }),
34
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
35
+ };
36
+ async run() {
37
+ this.requireAuth();
38
+ const { args, flags } = await this.parse(DedicatedMachinesSpendingLimit);
39
+ const leaseId = await this.resolveLeaseArg(args.lease);
40
+ const response = await this.callDedicated(() => (0, dedicated_machines_1.setDedicatedRuntimeSpendingLimit)(leaseId, flags.cents, this.scopeFrom(flags)));
41
+ if (flags.json) {
42
+ this.log(JSON.stringify(response, null, 2));
43
+ return;
44
+ }
45
+ const lease = response?.lease;
46
+ this.log(`Dedicated Runtime ${(0, dedicated_machines_1.dedicatedLeaseId)(lease) || leaseId} spending cap updated.`);
47
+ if (lease)
48
+ this.log(` ${(0, dedicated_machines_1.dedicatedSpendSummary)(lease)}`);
49
+ }
50
+ }
51
+ exports.default = DedicatedMachinesSpendingLimit;
@@ -1,11 +1,14 @@
1
- import { BaseCommand } from '../../../base-command';
2
- export default class DedicatedMachinesStart extends BaseCommand {
1
+ import { DedicatedLeaseCommand } from '../../../lib/dedicated-lease-command';
2
+ export default class DedicatedMachinesStart extends DedicatedLeaseCommand {
3
3
  static description: string;
4
4
  static examples: string[];
5
5
  static args: {
6
6
  lease: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
7
7
  };
8
8
  static flags: {
9
+ wait: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
+ timeout: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ interval: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
9
12
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
13
  };
11
14
  run(): Promise<void>;
@@ -1,42 +1,32 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
- const base_command_1 = require("../../../base-command");
4
+ const dedicated_lease_command_1 = require("../../../lib/dedicated-lease-command");
5
5
  const dedicated_machines_1 = require("../../../lib/dedicated-machines");
6
- class DedicatedMachinesStart extends base_command_1.BaseCommand {
7
- static description = 'Start a Dedicated Runtime lease';
6
+ class DedicatedMachinesStart extends dedicated_lease_command_1.DedicatedLeaseCommand {
7
+ static description = 'Start a stopped Dedicated Runtime. Files under /workspace are as you left them; nothing that was running is.';
8
8
  static examples = [
9
9
  '<%= config.bin %> machines dedicated start <lease-id>',
10
- '<%= config.bin %> machines dedicated start <lease-id> --json',
10
+ '<%= config.bin %> machines dedicated start <lease-id> --wait',
11
+ '<%= config.bin %> machines dedicated start <lease-id> --wait --timeout 10m --json',
11
12
  ];
12
13
  static args = {
13
14
  lease: core_1.Args.string({
14
- description: 'Dedicated Runtime lease id',
15
+ description: dedicated_lease_command_1.DEDICATED_LEASE_ARG_DESCRIPTION,
15
16
  required: true,
16
17
  ignoreStdin: true,
17
18
  }),
18
19
  };
19
20
  static flags = {
20
21
  json: core_1.Flags.boolean({ description: 'Output as JSON' }),
22
+ ...dedicated_lease_command_1.dedicatedWaitFlags,
21
23
  };
22
24
  async run() {
23
25
  this.requireAuth();
24
26
  const { args, flags } = await this.parse(DedicatedMachinesStart);
25
- let response;
26
- try {
27
- response = await (0, dedicated_machines_1.performDedicatedLeaseAction)(args.lease, 'start');
28
- }
29
- catch (err) {
30
- const message = (0, dedicated_machines_1.formatDedicatedRuntimeApiError)(err);
31
- if (message)
32
- this.error(message, { exit: 1 });
33
- this.handleApiError(err);
34
- }
35
- if (flags.json) {
36
- this.log(JSON.stringify(response, null, 2));
37
- return;
38
- }
39
- this.log(`Dedicated Runtime ${(0, dedicated_machines_1.dedicatedLeaseId)(response?.lease)} ${(0, dedicated_machines_1.dedicatedLeaseState)(response?.lease)}.`);
27
+ const leaseId = await this.resolveLeaseArg(args.lease);
28
+ const response = await this.callDedicated(() => (0, dedicated_machines_1.performDedicatedLeaseAction)(leaseId, 'start', this.scopeFrom(flags)));
29
+ await this.reportLeaseAction(response, flags, { kind: 'running' }, 'Starting');
40
30
  }
41
31
  }
42
32
  exports.default = DedicatedMachinesStart;