@skrr-ai/cli 0.1.24 → 0.1.26
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/dist/base-command.d.ts +4 -4
- package/dist/base-command.js +11 -10
- package/dist/commands/code/install.js +13 -0
- package/dist/commands/harnesses/leases/billing.d.ts +9 -6
- package/dist/commands/harnesses/leases/billing.js +19 -24
- package/dist/commands/machines/dedicated/attach.d.ts +28 -0
- package/dist/commands/machines/dedicated/attach.js +75 -0
- package/dist/commands/machines/dedicated/catalog.d.ts +17 -0
- package/dist/commands/machines/dedicated/catalog.js +75 -0
- package/dist/commands/machines/dedicated/cp.d.ts +22 -0
- package/dist/commands/machines/dedicated/cp.js +76 -0
- package/dist/commands/machines/dedicated/create.d.ts +6 -2
- package/dist/commands/machines/dedicated/create.js +29 -20
- package/dist/commands/machines/dedicated/destroy.d.ts +6 -2
- package/dist/commands/machines/dedicated/destroy.js +41 -24
- package/dist/commands/machines/dedicated/exec.d.ts +28 -0
- package/dist/commands/machines/dedicated/exec.js +105 -0
- package/dist/commands/machines/dedicated/grow.d.ts +6 -2
- package/dist/commands/machines/dedicated/grow.js +14 -19
- package/dist/commands/machines/dedicated/health-check.d.ts +2 -2
- package/dist/commands/machines/dedicated/health-check.js +16 -14
- package/dist/commands/machines/dedicated/incident-close.d.ts +3 -2
- package/dist/commands/machines/dedicated/incident-close.js +11 -14
- package/dist/commands/machines/dedicated/index.js +37 -16
- package/dist/commands/machines/dedicated/list.d.ts +2 -2
- package/dist/commands/machines/dedicated/list.js +28 -17
- package/dist/commands/machines/dedicated/restart.d.ts +5 -2
- package/dist/commands/machines/dedicated/restart.js +8 -19
- package/dist/commands/machines/dedicated/show.d.ts +2 -2
- package/dist/commands/machines/dedicated/show.js +28 -30
- package/dist/commands/machines/dedicated/sign-in.d.ts +19 -0
- package/dist/commands/machines/dedicated/sign-in.js +49 -0
- package/dist/commands/machines/dedicated/snapshot.d.ts +5 -2
- package/dist/commands/machines/dedicated/snapshot.js +11 -19
- package/dist/commands/machines/dedicated/spending-limit.d.ts +22 -0
- package/dist/commands/machines/dedicated/spending-limit.js +50 -0
- package/dist/commands/machines/dedicated/start.d.ts +5 -2
- package/dist/commands/machines/dedicated/start.js +8 -19
- package/dist/commands/machines/dedicated/stop.d.ts +5 -2
- package/dist/commands/machines/dedicated/stop.js +8 -19
- package/dist/commands/machines/dedicated/terminal.d.ts +22 -0
- package/dist/commands/machines/dedicated/terminal.js +42 -0
- package/dist/commands/spaces/auto-executor/preview.d.ts +8 -0
- package/dist/commands/spaces/auto-executor/preview.js +41 -0
- package/dist/commands/spaces/task-rollups.d.ts +14 -0
- package/dist/commands/spaces/task-rollups.js +66 -0
- package/dist/commands/spaces/work-sync/telemetry.js +22 -0
- package/dist/commands/tasks/assign.js +1 -1
- package/dist/commands/tasks/create.js +10 -4
- package/dist/commands/tasks/list.js +27 -0
- package/dist/lib/api-fetch.js +9 -1
- package/dist/lib/assignee-resolver.d.ts +7 -6
- package/dist/lib/daemonBroker.d.ts +28 -0
- package/dist/lib/daemonBroker.js +60 -19
- package/dist/lib/dedicated-copy.d.ts +22 -0
- package/dist/lib/dedicated-copy.js +115 -0
- package/dist/lib/dedicated-lease-command.d.ts +50 -0
- package/dist/lib/dedicated-lease-command.js +158 -0
- package/dist/lib/dedicated-machines.d.ts +248 -12
- package/dist/lib/dedicated-machines.js +385 -25
- package/dist/lib/dedicated-terminal.d.ts +89 -0
- package/dist/lib/dedicated-terminal.js +275 -0
- package/dist/lib/dedicated-wait.d.ts +72 -0
- package/dist/lib/dedicated-wait.js +195 -0
- package/dist/lib/harnesses.d.ts +6 -0
- package/dist/lib/idempotency-scope.d.ts +10 -0
- package/dist/lib/idempotency-scope.js +16 -0
- package/dist/lib/node-adapter.d.ts +1 -1
- package/dist/lib/node-adapter.js +13 -11
- package/dist/lib/sky-code.d.ts +30 -1
- package/dist/lib/sky-code.js +44 -2
- package/dist/lib/triggers.js +7 -0
- package/dist/lib/work-sync.d.ts +35 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/kek/linux.js +71 -21
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.d.ts +10 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.js +17 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/kek/linux.js +71 -21
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.d.ts +10 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.js +16 -0
- package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +2657 -2596
- package/oclif.manifest.json +5075 -4294
- package/package.json +1 -1
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DedicatedLeaseCommand = exports.dedicatedWaitFlags = void 0;
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const base_command_1 = require("../base-command");
|
|
6
|
+
const dedicated_machines_1 = require("./dedicated-machines");
|
|
7
|
+
const dedicated_terminal_1 = require("./dedicated-terminal");
|
|
8
|
+
const harnesses_1 = require("./harnesses");
|
|
9
|
+
const dedicated_wait_1 = require("./dedicated-wait");
|
|
10
|
+
const hosted_machines_1 = require("./hosted-machines");
|
|
11
|
+
/**
|
|
12
|
+
* Lifecycle calls answer 202 with the lease already in its transitional state.
|
|
13
|
+
* `--wait` watches it to the END of the operation, which for snapshot and grow
|
|
14
|
+
* is a field, not a state (see `dedicated-wait.ts`).
|
|
15
|
+
*/
|
|
16
|
+
exports.dedicatedWaitFlags = {
|
|
17
|
+
wait: core_1.Flags.boolean({
|
|
18
|
+
description: 'Wait until the operation has finished. Exits 124 if --timeout passes first; the operation keeps running.',
|
|
19
|
+
}),
|
|
20
|
+
timeout: core_1.Flags.string({
|
|
21
|
+
description: `How long --wait watches, such as 10m (default ${dedicated_wait_1.DEDICATED_WAIT_DEFAULT_TIMEOUT_MS / 60000}m)`,
|
|
22
|
+
dependsOn: ['wait'],
|
|
23
|
+
}),
|
|
24
|
+
interval: core_1.Flags.integer({
|
|
25
|
+
description: `Seconds between checks while waiting (default ${dedicated_wait_1.DEDICATED_WAIT_DEFAULT_INTERVAL_MS / 1000})`,
|
|
26
|
+
dependsOn: ['wait'],
|
|
27
|
+
min: 1,
|
|
28
|
+
}),
|
|
29
|
+
};
|
|
30
|
+
const TERMINAL_READY_STATES = new Set(['ready', 'active', 'idle']);
|
|
31
|
+
class DedicatedLeaseCommand extends base_command_1.BaseCommand {
|
|
32
|
+
/**
|
|
33
|
+
* `--workspace` is a BaseCommand flag every command already accepts (it sets
|
|
34
|
+
* `X-Workspace-Id` for the whole invocation). It is also passed as the scope
|
|
35
|
+
* query, the way `create`, `exec` and `cp` always have, so the scope a request
|
|
36
|
+
* was made in is visible in the request itself.
|
|
37
|
+
*/
|
|
38
|
+
scopeFrom(flags) {
|
|
39
|
+
return flags.workspace ? { workspaceId: flags.workspace } : {};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Open an interactive terminal on a lease's machine and run it to the end,
|
|
43
|
+
* exiting with the shell's own code.
|
|
44
|
+
*
|
|
45
|
+
* Every refusal is decided BEFORE the socket opens where it can be — a stopped
|
|
46
|
+
* machine, a daemon that is not connected, stdin that is not a terminal — so
|
|
47
|
+
* the caller gets a sentence that says what to do instead of a start that
|
|
48
|
+
* hangs and times out.
|
|
49
|
+
*/
|
|
50
|
+
async openDedicatedTerminal(leaseId, flags, initialCommand) {
|
|
51
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
52
|
+
this.error('An interactive terminal needs a terminal on both ends. For scripts use `skrr machines dedicated exec`; an agent on the machine uses its terminal_* tools.', { exit: 2 });
|
|
53
|
+
}
|
|
54
|
+
const response = await this.callDedicated(() => (0, dedicated_machines_1.getDedicatedRuntime)(leaseId, this.scopeFrom(flags)));
|
|
55
|
+
const lease = response?.lease;
|
|
56
|
+
if (!lease)
|
|
57
|
+
this.error('Dedicated Runtime lease not found.', { exit: 1 });
|
|
58
|
+
const state = (0, dedicated_machines_1.dedicatedLeaseState)(lease);
|
|
59
|
+
if (!TERMINAL_READY_STATES.has(state)) {
|
|
60
|
+
this.error(state === 'stopped'
|
|
61
|
+
? `${leaseId} is stopped. Start it first: \`${this.config.bin} machines dedicated start ${leaseId} --wait\`.`
|
|
62
|
+
: `${leaseId} is ${state}; a terminal opens once it is ready.`, { exit: 1 });
|
|
63
|
+
}
|
|
64
|
+
const listed = await this.callDedicated(() => (0, harnesses_1.listHarnesses)());
|
|
65
|
+
const harness = (0, dedicated_machines_1.dedicatedTerminalHarness)(lease, listed?.harnesses ?? []);
|
|
66
|
+
if (!harness?.daemonId) {
|
|
67
|
+
this.error(`${leaseId} is ${state}, but its daemon is not connected yet. Wait a moment, or run \`${this.config.bin} machines dedicated health-check ${leaseId}\`.`, { exit: 1 });
|
|
68
|
+
}
|
|
69
|
+
process.stderr.write(`Connected to ${(0, dedicated_machines_1.dedicatedLeaseDisplayName)(lease)} (${leaseId}) as skrr-workload. Ctrl-] closes the terminal.\n`);
|
|
70
|
+
let code;
|
|
71
|
+
try {
|
|
72
|
+
code = await (0, dedicated_terminal_1.runDedicatedTerminal)({
|
|
73
|
+
baseURL: this.cliConfig.baseURL,
|
|
74
|
+
token: this.resolvedCredential.token,
|
|
75
|
+
runtimeId: harness._id,
|
|
76
|
+
daemonId: harness.daemonId,
|
|
77
|
+
...(flags.cwd ? { cwd: flags.cwd } : {}),
|
|
78
|
+
...(initialCommand ? { initialCommand } : {}),
|
|
79
|
+
input: process.stdin,
|
|
80
|
+
output: process.stdout,
|
|
81
|
+
errorOutput: process.stderr,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
if (err instanceof dedicated_terminal_1.DedicatedTerminalError)
|
|
86
|
+
this.error(err.message, { exit: 1 });
|
|
87
|
+
throw err;
|
|
88
|
+
}
|
|
89
|
+
if (code !== 0)
|
|
90
|
+
this.exit(code);
|
|
91
|
+
}
|
|
92
|
+
/** Run an API call, turning a refusal into the server's own sentence. */
|
|
93
|
+
async callDedicated(fn) {
|
|
94
|
+
try {
|
|
95
|
+
return await fn();
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
const message = (0, dedicated_machines_1.formatDedicatedRuntimeApiError)(err);
|
|
99
|
+
if (message)
|
|
100
|
+
this.error(message, { exit: 1, code: (0, dedicated_machines_1.dedicatedRuntimeApiErrorCode)(err) });
|
|
101
|
+
this.handleApiError(err);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Print the lease an action returned, or wait for its operation to finish
|
|
106
|
+
* first when `--wait` was passed.
|
|
107
|
+
*/
|
|
108
|
+
async reportLeaseAction(response, flags, goal, verb) {
|
|
109
|
+
let lease = response?.lease;
|
|
110
|
+
const id = (0, dedicated_machines_1.dedicatedLeaseId)(lease);
|
|
111
|
+
if (flags.wait && goal && id) {
|
|
112
|
+
let timeoutMs;
|
|
113
|
+
try {
|
|
114
|
+
timeoutMs = (0, hosted_machines_1.parseDurationMs)(flags.timeout, '--timeout');
|
|
115
|
+
}
|
|
116
|
+
catch (err) {
|
|
117
|
+
this.error(err.message, { exit: 2 });
|
|
118
|
+
}
|
|
119
|
+
if (!flags.json)
|
|
120
|
+
this.log(`${verb} ${id}: ${(0, dedicated_machines_1.dedicatedLeaseState)(lease)}`);
|
|
121
|
+
try {
|
|
122
|
+
lease = await (0, dedicated_wait_1.waitForDedicatedLease)(id, goal, {
|
|
123
|
+
...this.scopeFrom(flags),
|
|
124
|
+
initial: lease,
|
|
125
|
+
intervalMs: flags.interval ? flags.interval * 1000 : undefined,
|
|
126
|
+
timeoutMs,
|
|
127
|
+
// Progress is about the wait, not the result: stderr, so a caller
|
|
128
|
+
// reading `--json` from stdout gets exactly one document.
|
|
129
|
+
onProgress: (progress) => process.stderr.write(` … ${progress}\n`),
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
catch (err) {
|
|
133
|
+
if (err instanceof dedicated_wait_1.DedicatedWaitTimeoutError) {
|
|
134
|
+
process.stderr.write(`${err.message}\n`);
|
|
135
|
+
this.exit(dedicated_wait_1.DEDICATED_WAIT_TIMEOUT_EXIT);
|
|
136
|
+
}
|
|
137
|
+
if (err instanceof dedicated_wait_1.DedicatedWaitFailedError) {
|
|
138
|
+
if (flags.json && err.lease)
|
|
139
|
+
this.log(JSON.stringify({ lease: err.lease }, null, 2));
|
|
140
|
+
this.error(err.message, { exit: 1 });
|
|
141
|
+
}
|
|
142
|
+
const message = (0, dedicated_machines_1.formatDedicatedRuntimeApiError)(err);
|
|
143
|
+
if (message)
|
|
144
|
+
this.error(message, { exit: 1, code: (0, dedicated_machines_1.dedicatedRuntimeApiErrorCode)(err) });
|
|
145
|
+
this.handleApiError(err);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (flags.json) {
|
|
149
|
+
this.log(JSON.stringify({ ...(response || {}), lease }, null, 2));
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
this.log(`Dedicated Runtime ${id || 'unknown'} ${(0, dedicated_machines_1.dedicatedLeaseState)(lease)}.`);
|
|
153
|
+
if (!flags.wait && goal && id) {
|
|
154
|
+
this.log(`The operation continues in the background. Watch it with \`${this.config.bin} machines dedicated show ${id}\`, or pass --wait.`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
exports.DedicatedLeaseCommand = DedicatedLeaseCommand;
|
|
@@ -1,9 +1,58 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Harness, HarnessLease } from './harnesses';
|
|
2
2
|
export type DedicatedLeaseAction = 'start' | 'stop' | 'restart' | 'snapshot' | 'health-check';
|
|
3
3
|
export declare const DEDICATED_LEASE_ACTIONS: DedicatedLeaseAction[];
|
|
4
|
+
export declare const DEDICATED_MACHINE_PRODUCT = "dedicated-machine";
|
|
4
5
|
export interface DedicatedRuntimeScope {
|
|
5
6
|
workspaceId?: string;
|
|
6
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* One Dedicated Runtime lease, as `toPublicMachineLeasePayload` emits it.
|
|
10
|
+
*
|
|
11
|
+
* Only fields the server actually sends belong here — the shared `HarnessLease`
|
|
12
|
+
* once declared three fields nobody ever sent, and optional properties made that
|
|
13
|
+
* compile while the columns stayed empty. Provider ids (instance, volume, AMI)
|
|
14
|
+
* are deliberately absent from the payload and therefore from this type.
|
|
15
|
+
*/
|
|
16
|
+
export interface DedicatedLease extends Omit<HarnessLease, 'storage'> {
|
|
17
|
+
supportReference?: string;
|
|
18
|
+
lifecycleCapabilities?: Record<string, boolean>;
|
|
19
|
+
executionCapabilities?: Record<string, boolean>;
|
|
20
|
+
resources?: {
|
|
21
|
+
cpu?: number;
|
|
22
|
+
memoryGb?: number;
|
|
23
|
+
storageGb?: number;
|
|
24
|
+
architecture?: string;
|
|
25
|
+
os?: string;
|
|
26
|
+
imagePreset?: string;
|
|
27
|
+
imageVersion?: string;
|
|
28
|
+
sizePreset?: string;
|
|
29
|
+
regionClass?: string;
|
|
30
|
+
};
|
|
31
|
+
daemon?: {
|
|
32
|
+
version?: string;
|
|
33
|
+
imageVersion?: string;
|
|
34
|
+
lastHeartbeatAt?: string;
|
|
35
|
+
registeredAt?: string;
|
|
36
|
+
};
|
|
37
|
+
storage?: {
|
|
38
|
+
retentionClass?: string;
|
|
39
|
+
backupProfile?: string;
|
|
40
|
+
lastBackupAt?: string;
|
|
41
|
+
lastRestoreTestAt?: string;
|
|
42
|
+
lastRestoreTestStatus?: string;
|
|
43
|
+
unpaidSince?: string;
|
|
44
|
+
deletionNoticeAt?: string;
|
|
45
|
+
deleteAfter?: string;
|
|
46
|
+
} & Record<string, unknown>;
|
|
47
|
+
recovery?: {
|
|
48
|
+
incidentHold?: {
|
|
49
|
+
status?: string;
|
|
50
|
+
reason?: string;
|
|
51
|
+
heldAt?: string;
|
|
52
|
+
closedAt?: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
}
|
|
7
56
|
export interface CreateDedicatedRuntimeInput extends DedicatedRuntimeScope {
|
|
8
57
|
requestId: string;
|
|
9
58
|
displayName: string;
|
|
@@ -16,7 +65,7 @@ export interface CreateDedicatedRuntimeInput extends DedicatedRuntimeScope {
|
|
|
16
65
|
repositoryRef?: string;
|
|
17
66
|
}
|
|
18
67
|
export interface DedicatedRuntimeResponse {
|
|
19
|
-
lease?:
|
|
68
|
+
lease?: DedicatedLease;
|
|
20
69
|
}
|
|
21
70
|
/**
|
|
22
71
|
* Flags in, request body out — and the point of it being a function is the
|
|
@@ -40,27 +89,214 @@ export declare function dedicatedRuntimeCreateInput(input: {
|
|
|
40
89
|
storageGb?: number;
|
|
41
90
|
retentionClass?: string;
|
|
42
91
|
backupProfile?: string;
|
|
92
|
+
repositoryRef?: string;
|
|
43
93
|
workspaceId?: string;
|
|
44
94
|
}): CreateDedicatedRuntimeInput;
|
|
95
|
+
/**
|
|
96
|
+
* The shapes the server's repository parser accepts: `owner/repo`,
|
|
97
|
+
* `github.com/owner/repo`, or an https URL to it, optionally ending in `.git`.
|
|
98
|
+
*
|
|
99
|
+
* This is a typo catcher, not the authority. The server re-parses the value and
|
|
100
|
+
* decides whether the owner's GitHub App installation covers it; checking the
|
|
101
|
+
* shape here only turns "create failed" into "that is not a repository" before a
|
|
102
|
+
* billable request is sent.
|
|
103
|
+
*/
|
|
104
|
+
export declare function isDedicatedRepositoryRef(value: string): boolean;
|
|
45
105
|
export declare function createDedicatedRuntime(input: CreateDedicatedRuntimeInput): Promise<DedicatedRuntimeResponse>;
|
|
46
106
|
export declare function listDedicatedRuntimes(options?: {
|
|
47
107
|
limit?: number;
|
|
48
108
|
state?: string;
|
|
49
|
-
}): Promise<{
|
|
50
|
-
leases?:
|
|
109
|
+
} & DedicatedRuntimeScope): Promise<{
|
|
110
|
+
leases?: DedicatedLease[];
|
|
51
111
|
}>;
|
|
52
|
-
export declare function getDedicatedRuntime(leaseId: string): Promise<DedicatedRuntimeResponse>;
|
|
53
|
-
export declare function performDedicatedLeaseAction(leaseId: string, action: DedicatedLeaseAction): Promise<DedicatedRuntimeResponse>;
|
|
112
|
+
export declare function getDedicatedRuntime(leaseId: string, scope?: DedicatedRuntimeScope): Promise<DedicatedRuntimeResponse>;
|
|
113
|
+
export declare function performDedicatedLeaseAction(leaseId: string, action: DedicatedLeaseAction, scope?: DedicatedRuntimeScope): Promise<DedicatedRuntimeResponse>;
|
|
54
114
|
export declare function growDedicatedRuntime(leaseId: string, storageGb: number, options?: {
|
|
55
115
|
requestId?: string;
|
|
56
|
-
}): Promise<DedicatedRuntimeResponse>;
|
|
116
|
+
} & DedicatedRuntimeScope): Promise<DedicatedRuntimeResponse>;
|
|
117
|
+
/**
|
|
118
|
+
* Change the monthly spending cap of one lease.
|
|
119
|
+
*
|
|
120
|
+
* The route accepts `spendingLimitCents` and nothing else: who pays is decided
|
|
121
|
+
* at create and there is no API that moves it. A cap below what the month has
|
|
122
|
+
* already spent (or is projected to) is refused rather than stopping the machine
|
|
123
|
+
* on the next reconciler pass.
|
|
124
|
+
*/
|
|
125
|
+
export declare function setDedicatedRuntimeSpendingLimit(leaseId: string, spendingLimitCents: number, scope?: DedicatedRuntimeScope): Promise<DedicatedRuntimeResponse>;
|
|
57
126
|
export declare function closeDedicatedRuntimeIncidentHold(leaseId: string, options?: {
|
|
58
127
|
requestId?: string;
|
|
59
|
-
}): Promise<DedicatedRuntimeResponse>;
|
|
128
|
+
} & DedicatedRuntimeScope): Promise<DedicatedRuntimeResponse>;
|
|
60
129
|
export declare function destroyDedicatedRuntime(leaseId: string, options?: {
|
|
61
130
|
retentionIntent?: 'retain' | 'purge';
|
|
62
|
-
}): Promise<DedicatedRuntimeResponse>;
|
|
63
|
-
export
|
|
64
|
-
|
|
65
|
-
|
|
131
|
+
} & DedicatedRuntimeScope): Promise<DedicatedRuntimeResponse>;
|
|
132
|
+
export interface DedicatedRuntimeExecInput {
|
|
133
|
+
command: string;
|
|
134
|
+
cwd?: string;
|
|
135
|
+
timeoutMs?: number;
|
|
136
|
+
}
|
|
137
|
+
export interface DedicatedRuntimeExecResult {
|
|
138
|
+
/** stdout and stderr, merged in the order the machine produced them, capped at 1 MB. */
|
|
139
|
+
stdout: string;
|
|
140
|
+
/** null when the command was killed at its deadline. */
|
|
141
|
+
exitCode: number | null;
|
|
142
|
+
timedOut: boolean;
|
|
143
|
+
truncated: boolean;
|
|
144
|
+
durationMs: number;
|
|
145
|
+
}
|
|
146
|
+
/** The server's ceiling for one exec; documented beside the route. */
|
|
147
|
+
export declare const DEDICATED_EXEC_MAX_TIMEOUT_MS: number;
|
|
148
|
+
/**
|
|
149
|
+
* Run one command on the machine as the workload user.
|
|
150
|
+
*
|
|
151
|
+
* Not idempotent and not retried: `apiFetch` gives each call a fresh
|
|
152
|
+
* idempotency key, which is the rule for an unfenced write — running the same
|
|
153
|
+
* command twice is two intents even when the text is identical.
|
|
154
|
+
*/
|
|
155
|
+
export declare function execDedicatedRuntime(leaseId: string, input: DedicatedRuntimeExecInput, scope?: DedicatedRuntimeScope): Promise<DedicatedRuntimeExecResult>;
|
|
156
|
+
/** Mirrors the daemon's bounds (daemon/src/tools/file-transfer.ts). */
|
|
157
|
+
export declare const DEDICATED_FILE_CHUNK_BYTES: number;
|
|
158
|
+
export declare const DEDICATED_FILE_MAX_BYTES: number;
|
|
159
|
+
export interface DedicatedFileChunk {
|
|
160
|
+
path: string;
|
|
161
|
+
size: number;
|
|
162
|
+
mtimeMs: number;
|
|
163
|
+
offset: number;
|
|
164
|
+
bytesRead: number;
|
|
165
|
+
dataBase64: string;
|
|
166
|
+
eof: boolean;
|
|
167
|
+
}
|
|
168
|
+
export interface DedicatedFileWriteResult {
|
|
169
|
+
path: string;
|
|
170
|
+
transferId: string;
|
|
171
|
+
staged: number;
|
|
172
|
+
committed: boolean;
|
|
173
|
+
aborted?: boolean;
|
|
174
|
+
}
|
|
175
|
+
export declare function readDedicatedRuntimeFileChunk(leaseId: string, input: {
|
|
176
|
+
path: string;
|
|
177
|
+
offset: number;
|
|
178
|
+
length: number;
|
|
179
|
+
}, scope?: DedicatedRuntimeScope): Promise<DedicatedFileChunk>;
|
|
180
|
+
export declare function writeDedicatedRuntimeFileChunk(leaseId: string, input: {
|
|
181
|
+
path: string;
|
|
182
|
+
transferId: string;
|
|
183
|
+
offset: number;
|
|
184
|
+
dataBase64?: string;
|
|
185
|
+
final?: boolean;
|
|
186
|
+
abort?: boolean;
|
|
187
|
+
totalSize?: number;
|
|
188
|
+
}, scope?: DedicatedRuntimeScope): Promise<DedicatedFileWriteResult>;
|
|
189
|
+
export type DedicatedCopyPlan = {
|
|
190
|
+
direction: 'upload';
|
|
191
|
+
localPath: string;
|
|
192
|
+
leaseId: string;
|
|
193
|
+
remotePath: string;
|
|
194
|
+
} | {
|
|
195
|
+
direction: 'download';
|
|
196
|
+
leaseId: string;
|
|
197
|
+
remotePath: string;
|
|
198
|
+
localPath: string;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* `cp <src> <dst>` where exactly one side is `<lease-id>:<path>`.
|
|
202
|
+
*
|
|
203
|
+
* The remote side is recognised by the lease id prefix rather than by "has a
|
|
204
|
+
* colon", so a Windows path (`C:\\build\\out.zip`) or a local file whose name
|
|
205
|
+
* contains a colon is never mistaken for a machine.
|
|
206
|
+
*/
|
|
207
|
+
export declare function parseDedicatedCopyEndpoints(source: string, destination: string): DedicatedCopyPlan;
|
|
208
|
+
export declare function dedicatedLeaseId(lease: DedicatedLease | HarnessLease | undefined | null): string;
|
|
209
|
+
export declare function dedicatedLeaseState(lease: DedicatedLease | HarnessLease | undefined | null): string;
|
|
210
|
+
export declare function dedicatedLeaseDisplayName(lease: DedicatedLease | HarnessLease | undefined | null): string;
|
|
211
|
+
/** `$12.34` — cents are what the API speaks; dollars are what a person reads. */
|
|
212
|
+
export declare function formatUsdCents(cents: number | null | undefined): string;
|
|
213
|
+
/** `this month $1.23 of $500.00 cap`, or why that sentence cannot be written. */
|
|
214
|
+
export declare function dedicatedSpendSummary(lease: DedicatedLease): string;
|
|
215
|
+
/**
|
|
216
|
+
* The human rendering of `machines dedicated show`, as lines.
|
|
217
|
+
*
|
|
218
|
+
* Pure so it can be pinned without a server. Every field is optional because a
|
|
219
|
+
* lease that is still `requested` has no resources, daemon or spend yet, and a
|
|
220
|
+
* missing value is omitted rather than printed as a column of dashes.
|
|
221
|
+
*/
|
|
222
|
+
export declare function describeDedicatedLease(lease: DedicatedLease, harnesses?: readonly Harness[]): string[];
|
|
223
|
+
/**
|
|
224
|
+
* Every harness row a Dedicated Runtime lease's daemon registered, freshest
|
|
225
|
+
* first.
|
|
226
|
+
*
|
|
227
|
+
* A lease payload names no daemon (provider and daemon ids are deliberately
|
|
228
|
+
* absent), so the join goes the other way: each row a guest daemon registers
|
|
229
|
+
* carries `metadata.machineLeaseId` and `metadata.machineProduct`. One daemon
|
|
230
|
+
* writes one row PER ENGINE it announces (claude, codex, sky-code, or `oversky`
|
|
231
|
+
* when it announces none), all sharing the daemon id.
|
|
232
|
+
*/
|
|
233
|
+
export declare function dedicatedLeaseHarnesses(lease: Pick<DedicatedLease, 'id'>, harnesses: readonly Harness[]): Harness[];
|
|
234
|
+
/**
|
|
235
|
+
* The row an interactive terminal opens on: online, local, with a daemon.
|
|
236
|
+
*
|
|
237
|
+
* Any engine row reaches the same shell — they share the daemon — so the
|
|
238
|
+
* freshest one wins. The terminal relay's own access check refuses a row that
|
|
239
|
+
* is not local or has no daemon, so offering one here would only move the
|
|
240
|
+
* refusal later.
|
|
241
|
+
*/
|
|
242
|
+
export declare function dedicatedTerminalHarness(lease: Pick<DedicatedLease, 'id'>, harnesses: readonly Harness[]): Harness | null;
|
|
243
|
+
/**
|
|
244
|
+
* The harness row an agent should be attached to, for `attach`.
|
|
245
|
+
*
|
|
246
|
+
* Choosing a row also chooses the ENGINE the agent's turns run under, so an
|
|
247
|
+
* ambiguous choice is refused with the options named rather than guessed. A
|
|
248
|
+
* row need not be online to be attached — a stopped machine keeps its rows —
|
|
249
|
+
* but the error says so when it is not.
|
|
250
|
+
*/
|
|
251
|
+
export declare function selectDedicatedAttachHarness(lease: Pick<DedicatedLease, 'id'>, harnesses: readonly Harness[], engine?: string): {
|
|
252
|
+
harness: Harness;
|
|
253
|
+
} | {
|
|
254
|
+
error: string;
|
|
255
|
+
};
|
|
256
|
+
interface CatalogSize {
|
|
257
|
+
id?: string;
|
|
258
|
+
label?: string;
|
|
259
|
+
vcpus?: number;
|
|
260
|
+
memoryGiB?: number;
|
|
261
|
+
accelerator?: string;
|
|
262
|
+
}
|
|
263
|
+
interface CatalogPriceLine {
|
|
264
|
+
label?: string;
|
|
265
|
+
display?: string;
|
|
266
|
+
amountCents?: number | null;
|
|
267
|
+
cadence?: string;
|
|
268
|
+
}
|
|
269
|
+
export interface DedicatedCatalog {
|
|
270
|
+
availability: string;
|
|
271
|
+
disabledReason?: string;
|
|
272
|
+
sizes: CatalogSize[];
|
|
273
|
+
regionClasses: string[];
|
|
274
|
+
storage?: {
|
|
275
|
+
minGb?: number;
|
|
276
|
+
defaultGb?: number;
|
|
277
|
+
maxGb?: number;
|
|
278
|
+
};
|
|
279
|
+
retentionClasses: string[];
|
|
280
|
+
backupProfiles: string[];
|
|
281
|
+
defaultMonthlySpendingLimitCents?: number | null;
|
|
282
|
+
maxUserMonthlySpendingLimitCents?: number | null;
|
|
283
|
+
priceLines: CatalogPriceLine[];
|
|
284
|
+
headline?: string;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* The Dedicated Runtime row of `GET /api/machines/products`, reduced to what a
|
|
288
|
+
* caller needs to choose `create` flags.
|
|
289
|
+
*
|
|
290
|
+
* `--size-preset` has no client-side list of values on purpose — presets are
|
|
291
|
+
* gated by server flags — so this is where a caller learns which ones exist.
|
|
292
|
+
*/
|
|
293
|
+
export declare function dedicatedCatalogFromProducts(payload: unknown): DedicatedCatalog | null;
|
|
294
|
+
/**
|
|
295
|
+
* The product refusal code the server sent (`DEDICATED_RUNTIME_NOT_ASSIGNABLE`,
|
|
296
|
+
* …), for `this.error(message, { code })`. Without it a `--json` caller got the
|
|
297
|
+
* generic `CLI_ERROR` and could only branch on prose (OSK-8685). Falls back to
|
|
298
|
+
* `HTTP_<status>`, the same code `handleApiError` uses for a body with none.
|
|
299
|
+
*/
|
|
300
|
+
export declare function dedicatedRuntimeApiErrorCode(err: unknown): string | undefined;
|
|
66
301
|
export declare function formatDedicatedRuntimeApiError(err: unknown): string | null;
|
|
302
|
+
export {};
|