agental 0.43.2 → 0.44.0
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/cli.js +59 -11
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -7411,7 +7411,7 @@ import { parseArgs } from "node:util";
|
|
|
7411
7411
|
|
|
7412
7412
|
// ../src/cli-build.ts
|
|
7413
7413
|
var PUBLISHED = true;
|
|
7414
|
-
var CLI_VERSION = true ? "0.
|
|
7414
|
+
var CLI_VERSION = true ? "0.44.0" : "dev";
|
|
7415
7415
|
var DEFAULT_API_URL = true ? "https://agental.io" : "http://127.0.0.1:8741";
|
|
7416
7416
|
var PACKAGE_NAME = "agental";
|
|
7417
7417
|
var USER_AGENT = `agental-cli/${CLI_VERSION}`;
|
|
@@ -10051,7 +10051,7 @@ var SUBCOMMANDS = {
|
|
|
10051
10051
|
limits: ["budget"],
|
|
10052
10052
|
egress: ["budget", "use-case"],
|
|
10053
10053
|
telemetry: ["set", "test", "unset"],
|
|
10054
|
-
ci: ["set", "reset"],
|
|
10054
|
+
ci: ["jobs", "set", "reset"],
|
|
10055
10055
|
org: ["list", "use", "create"],
|
|
10056
10056
|
members: ["list", "remove"],
|
|
10057
10057
|
"bulk-actions": ["list", "show", "cancel"],
|
|
@@ -12590,7 +12590,6 @@ var SPOT_PRICE_MICROS_PER_HOUR = {
|
|
|
12590
12590
|
};
|
|
12591
12591
|
var SPOT_ON_RECLAIM = ["delete", "stop"];
|
|
12592
12592
|
var SPOT_ON_RECLAIM_READ = [...SPOT_ON_RECLAIM, "upgrade"];
|
|
12593
|
-
var SPOT_RUN_LIMIT_SECONDS = 24 * 60 * 60;
|
|
12594
12593
|
var HOURS_PER_MONTH = 730;
|
|
12595
12594
|
var STOPPED_MICROS_PER_GB_MONTH = 5e4;
|
|
12596
12595
|
var BYTES_PER_GB = 1e9;
|
|
@@ -14306,7 +14305,7 @@ async function main() {
|
|
|
14306
14305
|
await telemetry(positionals.slice(1), values.header, values.json);
|
|
14307
14306
|
return;
|
|
14308
14307
|
case "ci":
|
|
14309
|
-
await ci(positionals.slice(1), { pool: values.pool, template: once(values.template, "--template"), json: values.json });
|
|
14308
|
+
await ci(positionals.slice(1), { pool: values.pool, template: once(values.template, "--template"), limit: values.limit, json: values.json });
|
|
14310
14309
|
return;
|
|
14311
14310
|
case "data-retention":
|
|
14312
14311
|
await dataRetention(positionals.slice(1), values.json);
|
|
@@ -15101,7 +15100,7 @@ async function autoStop(id, inText, at4, never, asJson) {
|
|
|
15101
15100
|
);
|
|
15102
15101
|
return;
|
|
15103
15102
|
}
|
|
15104
|
-
const by = body.setBy === "
|
|
15103
|
+
const by = body.setBy === "sandbox" ? "as the sandbox itself set" : body.setBy === "account" ? "as moved from its account" : `its last start and ${body.ttlSeconds === null ? "the deployment's time limit" : timeInWords(body.ttlSeconds)}`;
|
|
15105
15104
|
process.stdout.write(`${body.sandboxId} stops at ${body.autoStopAt}, in ${timeInWords(body.secondsLeft ?? 0)}: ${by}.
|
|
15106
15105
|
`);
|
|
15107
15106
|
}
|
|
@@ -16116,13 +16115,20 @@ async function dataRetention(positionals, asJson) {
|
|
|
16116
16115
|
}
|
|
16117
16116
|
async function ci(positionals, options) {
|
|
16118
16117
|
const [what, repo, ...rest] = positionals;
|
|
16119
|
-
const usage = "ci takes nothing, set <owner/repo> [--pool <n> | --pool default] [--template <template> | --template default], or reset <owner/repo>";
|
|
16120
|
-
if (rest.length > 0 || what === void 0 && repo !== void 0 || what !== void 0 && what !== "set" && what !== "reset") {
|
|
16118
|
+
const usage = "ci takes nothing, jobs [<owner/repo>] [--limit <n>], set <owner/repo> [--pool <n> | --pool default] [--template <template> | --template default], or reset <owner/repo>";
|
|
16119
|
+
if (rest.length > 0 || what === void 0 && repo !== void 0 || what !== void 0 && what !== "set" && what !== "reset" && what !== "jobs") {
|
|
16121
16120
|
throw new Error(usage);
|
|
16122
16121
|
}
|
|
16123
16122
|
if (what !== "set" && (options.pool !== void 0 || options.template !== void 0)) {
|
|
16124
16123
|
throw new Error("--pool and --template are for ci set.");
|
|
16125
16124
|
}
|
|
16125
|
+
if (what !== "jobs" && options.limit !== void 0) {
|
|
16126
|
+
throw new Error("--limit is for ci jobs.");
|
|
16127
|
+
}
|
|
16128
|
+
if (what === "jobs") {
|
|
16129
|
+
await ciJobs(repo, options.limit, options.json);
|
|
16130
|
+
return;
|
|
16131
|
+
}
|
|
16126
16132
|
if (what === void 0) {
|
|
16127
16133
|
const body = await asked("/v1/runs-on/repositories", { method: "GET" });
|
|
16128
16134
|
if (options.json) {
|
|
@@ -16192,6 +16198,42 @@ async function ci(positionals, options) {
|
|
|
16192
16198
|
process.stdout.write(`${repo}: pool ${poolMax ?? "default"}, template ${templateId ?? "runs-on (empty)"}. Sandboxes made from now on take it; a fork's job always gets the empty template.
|
|
16193
16199
|
`);
|
|
16194
16200
|
}
|
|
16201
|
+
async function ciJobs(repo, limit, asJson) {
|
|
16202
|
+
if (repo !== void 0 && !/^[^/\s]+\/[^/\s]+$/.test(repo)) {
|
|
16203
|
+
throw new Error("ci jobs takes a repository as owner/name, as agental ci jobs acme/app");
|
|
16204
|
+
}
|
|
16205
|
+
const query = new URLSearchParams();
|
|
16206
|
+
if (repo !== void 0) query.set("repository", repo);
|
|
16207
|
+
if (limit !== void 0) {
|
|
16208
|
+
const count = Number(limit);
|
|
16209
|
+
if (!Number.isInteger(count) || count < 1 || count > 500) {
|
|
16210
|
+
throw new Error("--limit is 1 to 500 jobs.");
|
|
16211
|
+
}
|
|
16212
|
+
query.set("limit", String(count));
|
|
16213
|
+
}
|
|
16214
|
+
const body = await asked(`/v1/runs-on/jobs${query.size > 0 ? `?${query}` : ""}`, { method: "GET" });
|
|
16215
|
+
if (asJson) {
|
|
16216
|
+
process.stdout.write(`${JSON.stringify(body, null, 2)}
|
|
16217
|
+
`);
|
|
16218
|
+
return;
|
|
16219
|
+
}
|
|
16220
|
+
if (!body.available) {
|
|
16221
|
+
process.stdout.write("GitHub Actions jobs do not run on sandboxes here.\n");
|
|
16222
|
+
return;
|
|
16223
|
+
}
|
|
16224
|
+
if (body.jobs.length === 0) {
|
|
16225
|
+
process.stdout.write(`No job${repo ? ` of ${repo}` : ""} asked for agental within the history kept. A workflow asks with runs-on: agental.
|
|
16226
|
+
`);
|
|
16227
|
+
return;
|
|
16228
|
+
}
|
|
16229
|
+
for (const job2 of body.jobs) {
|
|
16230
|
+
const title = [job2.workflow, job2.name].filter(Boolean).join(" / ") || `job ${job2.jobId}`;
|
|
16231
|
+
const took = job2.startedAt && job2.endedAt ? `${Math.round((Date.parse(job2.endedAt) - Date.parse(job2.startedAt)) / 1e3)}s` : "";
|
|
16232
|
+
const detail = [job2.repository, job2.branch, job2.size, took, job2.sandboxId, job2.error].filter(Boolean).join(" ");
|
|
16233
|
+
process.stdout.write(`${job2.state.padEnd(9)} ${title} ${detail}
|
|
16234
|
+
`);
|
|
16235
|
+
}
|
|
16236
|
+
}
|
|
16195
16237
|
async function telemetry(positionals, given, asJson) {
|
|
16196
16238
|
const [what, endpoint, ...rest] = positionals;
|
|
16197
16239
|
const usage = "telemetry takes nothing, set <endpoint> [-H name=value]..., test, or unset";
|
|
@@ -16759,7 +16801,11 @@ async function showLimits(positionals, options) {
|
|
|
16759
16801
|
throw new Error(`--step is 10m, hour or day. It was given ${options.step}.`);
|
|
16760
16802
|
}
|
|
16761
16803
|
const query = new URLSearchParams();
|
|
16762
|
-
|
|
16804
|
+
const month = options.from === "month";
|
|
16805
|
+
if (month) {
|
|
16806
|
+
query.set("range", "month");
|
|
16807
|
+
}
|
|
16808
|
+
for (const [name, value] of [["from", month ? void 0 : options.from], ["to", options.to], ["step", options.step]]) {
|
|
16763
16809
|
if (value !== void 0) {
|
|
16764
16810
|
query.set(name, name !== "step" && /^\d{4}-\d{2}-\d{2}$/.test(value) ? `${value}T00:00:00Z` : value);
|
|
16765
16811
|
}
|
|
@@ -16802,7 +16848,9 @@ function describeLimits(body, today, endsNow) {
|
|
|
16802
16848
|
} else {
|
|
16803
16849
|
lines.push(`free starts: ${units(number(now, "meterMb"))} of ${number(now, "freeBurstUnits").toLocaleString("en-US")} units used in the last 15 min`);
|
|
16804
16850
|
}
|
|
16805
|
-
|
|
16851
|
+
const budgetMonth = now["budgetMonth"] && typeof now["budgetMonth"] === "object" ? now["budgetMonth"] : null;
|
|
16852
|
+
const since = typeof budgetMonth?.start === "string" && budgetMonth.start.slice(8, 10) !== "01" ? ` (since ${shortDayOf(budgetMonth.start)})` : "";
|
|
16853
|
+
lines.push(`fees: ${money(number(now, "spentMicros"))} this month${since} of a ${money(number(now, "budgetMicros"))} budget`);
|
|
16806
16854
|
const refused = answer3["refused"] && typeof answer3["refused"] === "object" ? answer3["refused"] : {};
|
|
16807
16855
|
const total = number(refused, "total");
|
|
16808
16856
|
const byReason = Array.isArray(refused["byReason"]) ? refused["byReason"] : [];
|
|
@@ -17139,7 +17187,7 @@ Usage
|
|
|
17139
17187
|
agental metrics <sandbox-id> [--since <date-time>] [--until <date-time>] [--step <seconds>] [--json]
|
|
17140
17188
|
agental metrics --running [--since <date-time>] [--until <date-time>] [--step <seconds>] [--json]
|
|
17141
17189
|
agental telemetry [set <endpoint> [-H <name>=<value>]... | test | unset] [--json]
|
|
17142
|
-
agental ci [set <owner/repo> [--pool <n> | --pool default] [--template <template> | --template default] | reset <owner/repo>] [--json]
|
|
17190
|
+
agental ci [jobs [<owner/repo>] [--limit <n>] | set <owner/repo> [--pool <n> | --pool default] [--template <template> | --template default] | reset <owner/repo>] [--json]
|
|
17143
17191
|
agental data-retention [1 | 7 | 30 | 90 | never] [--json]
|
|
17144
17192
|
agental jobs [--sandbox <sandbox-id> | --template <template>] [--json]
|
|
17145
17193
|
agental job add [<name>] --sandbox <sandbox-id> [--every 1m|15m|1h|1d | --cron "<m h dom mon dow>" [--tz <zone>] | --at <date-time>] [--timeout <time>]
|
|
@@ -17202,7 +17250,7 @@ Usage
|
|
|
17202
17250
|
agental key delete <key>
|
|
17203
17251
|
agental billing [prices | compare | card [save] | details | top-up <dollars> | auto-reload <dollars | off> | email-copy] [--json]
|
|
17204
17252
|
agental billing invoices [--limit <n>] [--json]
|
|
17205
|
-
agental limits [--from <day
|
|
17253
|
+
agental limits [--from <day, date-time or month>] [--to <day or date-time>] [--step 10m|hour|day] [--json]
|
|
17206
17254
|
agental limits budget <dollars> | budget default [--json]
|
|
17207
17255
|
agental egress [budget <dollars> | budget default] [--json]
|
|
17208
17256
|
agental egress use-case "<what your sandboxes will use it for>" [--json]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agental",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.0",
|
|
4
4
|
"description": "The agental command: Linux sandboxes for your agents, from the terminal. npx agental@latest signs you in and installs the agent skills.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "VERTIXER LTD",
|