@skrr-ai/cli 0.1.90 → 0.1.91
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.
|
@@ -14,6 +14,16 @@ export default class TasksStart extends BaseCommand {
|
|
|
14
14
|
};
|
|
15
15
|
run(): Promise<void>;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* The server's `TASK_WAITING_FOR_MACHINE` answer to a start, or null for any other
|
|
19
|
+
* error. The code rides the response body (the route echoes it); the API client may
|
|
20
|
+
* also lift it onto `err.code`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function waitingForMachine(err: unknown): {
|
|
23
|
+
message?: string;
|
|
24
|
+
reason?: string;
|
|
25
|
+
retryable?: boolean;
|
|
26
|
+
} | null;
|
|
17
27
|
/**
|
|
18
28
|
* What to run next, printed after a start (OSK-12128). A start used to print
|
|
19
29
|
* two ids and stop, and the way to watch it was found by accident. Every
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.waitingForMachine = waitingForMachine;
|
|
3
4
|
exports.startFollowUpLines = startFollowUpLines;
|
|
4
5
|
const core_1 = require("@oclif/core");
|
|
5
6
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
@@ -94,6 +95,30 @@ class TasksStart extends base_command_1.BaseCommand {
|
|
|
94
95
|
result = await data_provider_1.dataService.startTask(taskId, flags.skill ? { skillId: flags.skill } : undefined);
|
|
95
96
|
}
|
|
96
97
|
catch (err) {
|
|
98
|
+
// A stopped Dedicated machine is being started for this work. That is the
|
|
99
|
+
// wake WORKING, not a failure: the server re-drives the start by itself once
|
|
100
|
+
// the machine is assignable (OSK-14010), so report it and exit 0.
|
|
101
|
+
const waiting = waitingForMachine(err);
|
|
102
|
+
if (waiting) {
|
|
103
|
+
if (flags.json) {
|
|
104
|
+
this.log(JSON.stringify({
|
|
105
|
+
waiting: true,
|
|
106
|
+
code: 'TASK_WAITING_FOR_MACHINE',
|
|
107
|
+
taskId,
|
|
108
|
+
task: { ...taskIdentity, id: taskId },
|
|
109
|
+
...(branch ? { branch } : {}),
|
|
110
|
+
...waiting,
|
|
111
|
+
}, null, 2));
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (branch) {
|
|
115
|
+
this.log(`${branch.created ? 'Created' : 'Checked out'} branch: ${branch.branch}`);
|
|
116
|
+
}
|
|
117
|
+
this.log(`Task ${taskIdentity.id} is waiting for the machine to start; the task will run by itself once it is ready.`);
|
|
118
|
+
if (waiting.message)
|
|
119
|
+
this.log(waiting.message);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
97
122
|
// Name the task in the failure. `skrr tasks start` is the command people
|
|
98
123
|
// fan out — five concurrent starts share one stderr, and the server's
|
|
99
124
|
// "Task already has an active run; start rejected" identifies none of
|
|
@@ -119,6 +144,40 @@ class TasksStart extends base_command_1.BaseCommand {
|
|
|
119
144
|
}
|
|
120
145
|
}
|
|
121
146
|
exports.default = TasksStart;
|
|
147
|
+
/**
|
|
148
|
+
* The server's `TASK_WAITING_FOR_MACHINE` answer to a start, or null for any other
|
|
149
|
+
* error. The code rides the response body (the route echoes it); the API client may
|
|
150
|
+
* also lift it onto `err.code`.
|
|
151
|
+
*/
|
|
152
|
+
function waitingForMachine(err) {
|
|
153
|
+
if (!err || typeof err !== 'object')
|
|
154
|
+
return null;
|
|
155
|
+
const e = err;
|
|
156
|
+
let body = {};
|
|
157
|
+
if (typeof e.body === 'string') {
|
|
158
|
+
try {
|
|
159
|
+
const parsed = JSON.parse(e.body);
|
|
160
|
+
if (parsed && typeof parsed === 'object')
|
|
161
|
+
body = parsed;
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
// not JSON: fall back to err.code
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
else if (e.body && typeof e.body === 'object') {
|
|
168
|
+
body = e.body;
|
|
169
|
+
}
|
|
170
|
+
if (body.code !== 'TASK_WAITING_FOR_MACHINE' && e.code !== 'TASK_WAITING_FOR_MACHINE') {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
const text = [body.error, body.message].find((v) => typeof v === 'string');
|
|
174
|
+
const message = text || undefined;
|
|
175
|
+
return {
|
|
176
|
+
...(message ? { message } : {}),
|
|
177
|
+
...(typeof body.reason === 'string' ? { reason: body.reason } : {}),
|
|
178
|
+
...(typeof body.retryable === 'boolean' ? { retryable: body.retryable } : {}),
|
|
179
|
+
};
|
|
180
|
+
}
|
|
122
181
|
/**
|
|
123
182
|
* What to run next, printed after a start (OSK-12128). A start used to print
|
|
124
183
|
* two ids and stop, and the way to watch it was found by accident. Every
|
|
@@ -40560,7 +40560,7 @@ var ry = Object.freeze(T(T(T({}, Object.fromEntries(ey.map(function(e3) {
|
|
|
40560
40560
|
}))), Object.fromEntries(ny.map(function(e3) {
|
|
40561
40561
|
return [e3, "wake"];
|
|
40562
40562
|
}))));
|
|
40563
|
-
var ay = { held_by_session: { detail: "An agent session or a person is using the machine, so it stays on.", fix: "It can be stopped once the session ends, or stop it yourself. Files are preserved; running processes are not." }, held_by_terminal: { detail: "A terminal or SSH connection is open or was used recently, so the machine stays on.", fix: "Close the terminal and it can stop when idle, or stop it yourself. Files are preserved; running processes are not." }, held_by_service: { detail: "A service you declared is running on the machine, so it stays on.", fix: "Stop the service, or stop the machine yourself if you do not need it. Files are preserved; running processes are not." }, held_by_pending_work: { detail: "Work is waiting for this machine, so it stays on.", fix: "It can stop once the waiting work has finished." }, keep_awake: { detail: "You asked to keep this machine awake, so it will not stop automatically for now.", fix: "Cancel keep-awake to let it stop when idle." }, policy_always_on: { detail: "This machine is set to always be on, so it does not stop automatically.", fix: "Change its power policy to on demand to let it stop when idle, or stop it yourself." }, activity_unreadable: { detail: "The machine activity could not be read, so it was left on to be safe. This does not mean it is idle.", fix: "Check that the machine is connected. It can stop once its activity can be read again, or stop it yourself." }, idle_auto_stop: { detail: $v.idle_auto_stop, fix: "Start it again when you need it." }, owner_stop: { detail: "Stopped by you. Your files are kept; running processes are not.", fix: "Start it again when you need it." }, billing_stop: { detail: "Stopped because the account is not in good billing standing. Your files are kept; running processes are not.", fix: "Resolve billing, then start the machine again." }, spend_cap_stop: { detail: "Stopped because the spend cap was reached. Your files are kept; running processes are not.", fix: "Raise the spend cap, then start the machine again." }, woken_by_schedule: { detail: "Started because a scheduled run was due.", fix: null }, woken_by_task: { detail: "Started because a task needed this machine.", fix: null }, woken_by_inbound: { detail: "Started because an incoming event needed this machine.", fix: null }, woken_by_person: { detail: "Started because you asked for this machine.", fix: null }, wake_refused_manual: { detail: "The machine was stopped by you and is set to manual, so it did not start for the waiting work.", fix: "Start it yourself, or change its power policy to on demand." }, wake_refused_spend_cap: { detail: "The machine did not start because the spend cap was reached.", fix: "Raise the spend cap, then start it again." }, wake_refused_entitlement: { detail: "The machine did not start because the plan no longer includes it.", fix: "Restore the plan, then start it again. Your files are preserved." }, wake_refused_provider_capacity: { detail: "The machine did not start because no capacity was available in its zone. It will be tried again.", fix: "Try again shortly or contact support." }, wake_refused_budget: { detail: "The machine did not start because its monthly compute-hour budget was reached.", fix: "Raise the budget, or start the machine manually." }, prewarm_paused_no_activity: { detail: "Starting this machine ahead of scheduled runs is off, because the last few early starts were not followed by any use. Scheduled work still starts it when it is due.", fix: "A start for real work, or a change to the power policy, turns early starts back on." } };
|
|
40563
|
+
var ay = { held_by_session: { detail: "An agent session or a person is using the machine, or did within the idle window, so it stays on.", fix: "It can be stopped once the session ends and the idle window passes, or stop it yourself. Files are preserved; running processes are not." }, held_by_terminal: { detail: "A terminal or SSH connection is open or was used recently, so the machine stays on.", fix: "Close the terminal and it can stop when idle, or stop it yourself. Files are preserved; running processes are not." }, held_by_service: { detail: "A service you declared is running on the machine, so it stays on.", fix: "Stop the service, or stop the machine yourself if you do not need it. Files are preserved; running processes are not." }, held_by_pending_work: { detail: "Work is waiting for this machine, so it stays on.", fix: "It can stop once the waiting work has finished." }, keep_awake: { detail: "You asked to keep this machine awake, so it will not stop automatically for now.", fix: "Cancel keep-awake to let it stop when idle." }, policy_always_on: { detail: "This machine is set to always be on, so it does not stop automatically.", fix: "Change its power policy to on demand to let it stop when idle, or stop it yourself." }, activity_unreadable: { detail: "The machine activity could not be read, so it was left on to be safe. This does not mean it is idle.", fix: "Check that the machine is connected. It can stop once its activity can be read again, or stop it yourself." }, idle_auto_stop: { detail: $v.idle_auto_stop, fix: "Start it again when you need it." }, owner_stop: { detail: "Stopped by you. Your files are kept; running processes are not.", fix: "Start it again when you need it." }, billing_stop: { detail: "Stopped because the account is not in good billing standing. Your files are kept; running processes are not.", fix: "Resolve billing, then start the machine again." }, spend_cap_stop: { detail: "Stopped because the spend cap was reached. Your files are kept; running processes are not.", fix: "Raise the spend cap, then start the machine again." }, woken_by_schedule: { detail: "Started because a scheduled run was due.", fix: null }, woken_by_task: { detail: "Started because a task needed this machine.", fix: null }, woken_by_inbound: { detail: "Started because an incoming event needed this machine.", fix: null }, woken_by_person: { detail: "Started because you asked for this machine.", fix: null }, wake_refused_manual: { detail: "The machine was stopped by you and is set to manual, so it did not start for the waiting work.", fix: "Start it yourself, or change its power policy to on demand." }, wake_refused_spend_cap: { detail: "The machine did not start because the spend cap was reached.", fix: "Raise the spend cap, then start it again." }, wake_refused_entitlement: { detail: "The machine did not start because the plan no longer includes it.", fix: "Restore the plan, then start it again. Your files are preserved." }, wake_refused_provider_capacity: { detail: "The machine did not start because no capacity was available in its zone. It will be tried again.", fix: "Try again shortly or contact support." }, wake_refused_budget: { detail: "The machine did not start because its monthly compute-hour budget was reached.", fix: "Raise the budget, or start the machine manually." }, prewarm_paused_no_activity: { detail: "Starting this machine ahead of scheduled runs is off, because the last few early starts were not followed by any use. Scheduled work still starts it when it is due.", fix: "A start for real work, or a change to the power policy, turns early starts back on." } };
|
|
40564
40564
|
var iy = { busy_report_unavailable: { detail: "The machine has not told the platform when it is busy, so the platform cannot tell whether stopping it would interrupt work.", fix: "Start the machine and update its image (`skrr machines dedicated update-image <lease> --wait`), then try again. Until then it stays always_on." }, daemon_version_unknown: { detail: "The platform could not read which daemon version this machine runs.", fix: "Start the machine so its daemon reports in, then try again." }, daemon_too_old: { detail: "The daemon on this machine is older than the version that can report when it is busy.", fix: "Update the machine image (`skrr machines dedicated update-image <lease> --wait`), then try again. Files are preserved." }, declared_services: { detail: "This machine has declared services. A stopped service is not visible as busy, so an automatic stop could end it without warning.", fix: "Keep this machine always_on, or remove its declared services (`skrr machines dedicated service ls <lease>`)." }, services_unreadable: { detail: "The check that shows whether this machine has declared services cannot be completed yet, so the platform cannot show that an automatic stop is safe.", fix: "There is nothing you can do about this, and trying again will not change it. The machine stays always_on until the check ships; contact support if you need on_demand sooner." } };
|
|
40565
40565
|
var sy = ["CONNECT_COUNTRY_REQUIRED", "CONNECT_COUNTRY_NOT_APPROVED", "CONNECT_COUNTRY_POLICY_NOT_CONFIGURED"];
|
|
40566
40566
|
var cy = { payout_window_not_open: "Skipped: a payout was already made in this payout window.", below_minimum_payout: "Skipped: the available balance was below the minimum payout.", payouts_not_enabled: "Skipped: this Stripe account cannot receive payouts yet.", payout_request_refused: "Skipped: the balance changed while the payout was being reserved. It will be tried again.", payout_request_failed: "Failed: the payout could not be completed because of a problem on our side. Contact support if this keeps happening." };
|