agental 0.43.3 → 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 +58 -9
- 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"],
|
|
@@ -14305,7 +14305,7 @@ async function main() {
|
|
|
14305
14305
|
await telemetry(positionals.slice(1), values.header, values.json);
|
|
14306
14306
|
return;
|
|
14307
14307
|
case "ci":
|
|
14308
|
-
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 });
|
|
14309
14309
|
return;
|
|
14310
14310
|
case "data-retention":
|
|
14311
14311
|
await dataRetention(positionals.slice(1), values.json);
|
|
@@ -16115,13 +16115,20 @@ async function dataRetention(positionals, asJson) {
|
|
|
16115
16115
|
}
|
|
16116
16116
|
async function ci(positionals, options) {
|
|
16117
16117
|
const [what, repo, ...rest] = positionals;
|
|
16118
|
-
const usage = "ci takes nothing, 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") {
|
|
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") {
|
|
16120
16120
|
throw new Error(usage);
|
|
16121
16121
|
}
|
|
16122
16122
|
if (what !== "set" && (options.pool !== void 0 || options.template !== void 0)) {
|
|
16123
16123
|
throw new Error("--pool and --template are for ci set.");
|
|
16124
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
|
+
}
|
|
16125
16132
|
if (what === void 0) {
|
|
16126
16133
|
const body = await asked("/v1/runs-on/repositories", { method: "GET" });
|
|
16127
16134
|
if (options.json) {
|
|
@@ -16191,6 +16198,42 @@ async function ci(positionals, options) {
|
|
|
16191
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.
|
|
16192
16199
|
`);
|
|
16193
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
|
+
}
|
|
16194
16237
|
async function telemetry(positionals, given, asJson) {
|
|
16195
16238
|
const [what, endpoint, ...rest] = positionals;
|
|
16196
16239
|
const usage = "telemetry takes nothing, set <endpoint> [-H name=value]..., test, or unset";
|
|
@@ -16758,7 +16801,11 @@ async function showLimits(positionals, options) {
|
|
|
16758
16801
|
throw new Error(`--step is 10m, hour or day. It was given ${options.step}.`);
|
|
16759
16802
|
}
|
|
16760
16803
|
const query = new URLSearchParams();
|
|
16761
|
-
|
|
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]]) {
|
|
16762
16809
|
if (value !== void 0) {
|
|
16763
16810
|
query.set(name, name !== "step" && /^\d{4}-\d{2}-\d{2}$/.test(value) ? `${value}T00:00:00Z` : value);
|
|
16764
16811
|
}
|
|
@@ -16801,7 +16848,9 @@ function describeLimits(body, today, endsNow) {
|
|
|
16801
16848
|
} else {
|
|
16802
16849
|
lines.push(`free starts: ${units(number(now, "meterMb"))} of ${number(now, "freeBurstUnits").toLocaleString("en-US")} units used in the last 15 min`);
|
|
16803
16850
|
}
|
|
16804
|
-
|
|
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`);
|
|
16805
16854
|
const refused = answer3["refused"] && typeof answer3["refused"] === "object" ? answer3["refused"] : {};
|
|
16806
16855
|
const total = number(refused, "total");
|
|
16807
16856
|
const byReason = Array.isArray(refused["byReason"]) ? refused["byReason"] : [];
|
|
@@ -17138,7 +17187,7 @@ Usage
|
|
|
17138
17187
|
agental metrics <sandbox-id> [--since <date-time>] [--until <date-time>] [--step <seconds>] [--json]
|
|
17139
17188
|
agental metrics --running [--since <date-time>] [--until <date-time>] [--step <seconds>] [--json]
|
|
17140
17189
|
agental telemetry [set <endpoint> [-H <name>=<value>]... | test | unset] [--json]
|
|
17141
|
-
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]
|
|
17142
17191
|
agental data-retention [1 | 7 | 30 | 90 | never] [--json]
|
|
17143
17192
|
agental jobs [--sandbox <sandbox-id> | --template <template>] [--json]
|
|
17144
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>]
|
|
@@ -17201,7 +17250,7 @@ Usage
|
|
|
17201
17250
|
agental key delete <key>
|
|
17202
17251
|
agental billing [prices | compare | card [save] | details | top-up <dollars> | auto-reload <dollars | off> | email-copy] [--json]
|
|
17203
17252
|
agental billing invoices [--limit <n>] [--json]
|
|
17204
|
-
agental limits [--from <day
|
|
17253
|
+
agental limits [--from <day, date-time or month>] [--to <day or date-time>] [--step 10m|hour|day] [--json]
|
|
17205
17254
|
agental limits budget <dollars> | budget default [--json]
|
|
17206
17255
|
agental egress [budget <dollars> | budget default] [--json]
|
|
17207
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",
|