agental 0.29.0 → 0.30.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 +44 -5
- 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.30.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}`;
|
|
@@ -9433,7 +9433,7 @@ var COMMANDS = [
|
|
|
9433
9433
|
{ name: "org", summary: "List, switch and make the accounts you belong to." },
|
|
9434
9434
|
{ name: "members", summary: "List or remove the members of a team." },
|
|
9435
9435
|
{ name: "invite", summary: "Invite someone to your team by email." },
|
|
9436
|
-
{ name: "billing", summary: "Your plan, credits, invoices and card, and buying credits.", examples: ["agental billing", "agental billing
|
|
9436
|
+
{ name: "billing", summary: "Your plan, credits, invoices and card, and buying credits.", examples: ["agental billing", "agental billing compare", "agental billing invoices", "agental billing top-up 500"] },
|
|
9437
9437
|
{ name: "headroom", summary: "How close you run to your plan's limits, and your burst budget." },
|
|
9438
9438
|
{ name: "account", summary: "Export everything agental keeps about your account and you." },
|
|
9439
9439
|
{ name: "login", summary: "Sign in through the browser, or with a key from standard input." },
|
|
@@ -14761,9 +14761,9 @@ async function telemetry(positionals, given, asJson) {
|
|
|
14761
14761
|
}
|
|
14762
14762
|
async function billing(positionals, asJson, limit) {
|
|
14763
14763
|
const [what, amount, ...rest] = positionals;
|
|
14764
|
-
const kinds = ["prices", "invoices", "card", "details", "top-up", "auto-reload"];
|
|
14764
|
+
const kinds = ["prices", "compare", "invoices", "card", "details", "top-up", "auto-reload"];
|
|
14765
14765
|
const near = what !== void 0 && !kinds.includes(what) ? nearest(what, kinds) : null;
|
|
14766
|
-
const usage = `${near ? `billing has no ${what}: did you mean billing ${near}? ` : ""}billing takes nothing, prices, invoices, card, card save, details, top-up <dollars>, or auto-reload <dollars | off>`;
|
|
14766
|
+
const usage = `${near ? `billing has no ${what}: did you mean billing ${near}? ` : ""}billing takes nothing, prices, compare, invoices, card, card save, details, top-up <dollars>, or auto-reload <dollars | off>`;
|
|
14767
14767
|
if (rest.length > 0 || what !== "top-up" && what !== "auto-reload" && !(what === "card" && amount === "save") && amount !== void 0) {
|
|
14768
14768
|
throw new Error(usage);
|
|
14769
14769
|
}
|
|
@@ -14782,6 +14782,11 @@ async function billing(positionals, asJson, limit) {
|
|
|
14782
14782
|
await invoices(asJson, limit);
|
|
14783
14783
|
return;
|
|
14784
14784
|
}
|
|
14785
|
+
case "compare": {
|
|
14786
|
+
const body = await asked("/v1/burst/replay", { method: "GET" });
|
|
14787
|
+
print4(body, () => describePlanReplay(body));
|
|
14788
|
+
return;
|
|
14789
|
+
}
|
|
14785
14790
|
case "details": {
|
|
14786
14791
|
const body = await asked("/v1/billing/details", { method: "GET" });
|
|
14787
14792
|
print4(body, () => describeDetails(body.details));
|
|
@@ -14851,6 +14856,40 @@ function wholeOrCents(micros) {
|
|
|
14851
14856
|
function money(micros) {
|
|
14852
14857
|
return `$${(micros / 1e6).toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
14853
14858
|
}
|
|
14859
|
+
var REPLAY_WHY = {
|
|
14860
|
+
size: "it does not make a size you ran",
|
|
14861
|
+
running_count: "more ran at once than it allows",
|
|
14862
|
+
members: "your members started sandboxes, and it takes none",
|
|
14863
|
+
budget: "its burst fees would have passed your budget",
|
|
14864
|
+
refused: "creates or starts were refused that month, so what they would have used is not known"
|
|
14865
|
+
};
|
|
14866
|
+
function describePlanReplay(body) {
|
|
14867
|
+
if (body.period === null) {
|
|
14868
|
+
return "No full month to compare yet: the account is younger than a month, or its current month began mid-month.\n";
|
|
14869
|
+
}
|
|
14870
|
+
const lastDay = new Date(Date.parse(body.period.end) - 1).toISOString();
|
|
14871
|
+
const month = `The month from ${dayOf(body.period.start)} to ${dayOf(lastDay)}`;
|
|
14872
|
+
if (body.plans.some((plan2) => plan2.why === "refused")) {
|
|
14873
|
+
return `${month}: creates or starts were refused in it, so what they would have used on another plan is not known, and no plan is priced.
|
|
14874
|
+
`;
|
|
14875
|
+
}
|
|
14876
|
+
const lines = [`${month}, on each plan (before tax):`];
|
|
14877
|
+
const yours = body.plans.find((plan2) => plan2.planId === body.yours);
|
|
14878
|
+
const inOrder = [...yours ? [yours] : [], ...body.plans.filter((plan2) => plan2 !== yours)];
|
|
14879
|
+
for (const plan2 of inOrder) {
|
|
14880
|
+
const name = PLAN_NAMES[plan2.planId] ?? plan2.planId;
|
|
14881
|
+
const mark = plan2.planId === body.yours ? " (yours, as charged)" : "";
|
|
14882
|
+
if (plan2.outcome !== "worked" || plan2.billMicros === null) {
|
|
14883
|
+
lines.push(` ${name}${mark}: no amount: ${REPLAY_WHY[plan2.why ?? ""] ?? plan2.why ?? "not known"}`);
|
|
14884
|
+
continue;
|
|
14885
|
+
}
|
|
14886
|
+
const by = yours?.billMicros !== null && yours?.billMicros !== void 0 && plan2.planId !== body.yours ? plan2.billMicros - yours.billMicros : null;
|
|
14887
|
+
const versus = by === null || Math.abs(by) < 1e6 ? "" : by < 0 ? `, ${money(-by)} less` : `, ${money(by)} more`;
|
|
14888
|
+
lines.push(` ${name}${mark}: ${money(plan2.billMicros)}, burst fees ${money(plan2.burstFeesMicros ?? 0)}${versus}`);
|
|
14889
|
+
}
|
|
14890
|
+
return `${lines.join("\n")}
|
|
14891
|
+
`;
|
|
14892
|
+
}
|
|
14854
14893
|
function wholeMoney(micros) {
|
|
14855
14894
|
return micros % 1e6 === 0 ? `$${(micros / 1e6).toLocaleString("en-US")}` : money(micros);
|
|
14856
14895
|
}
|
|
@@ -15629,7 +15668,7 @@ Usage
|
|
|
15629
15668
|
agental key show <key> [--json]
|
|
15630
15669
|
agental key allow-from <key> (<address-or-range>... | --anywhere) [--json]
|
|
15631
15670
|
agental key delete <key>
|
|
15632
|
-
agental billing [prices | card [save] | details | top-up <dollars> | auto-reload <dollars | off>] [--json]
|
|
15671
|
+
agental billing [prices | compare | card [save] | details | top-up <dollars> | auto-reload <dollars | off>] [--json]
|
|
15633
15672
|
agental billing invoices [--limit <n>] [--json]
|
|
15634
15673
|
agental headroom [--from <day or date-time>] [--to <day or date-time>] [--step 10m|hour|day] [--json]
|
|
15635
15674
|
agental headroom budget <dollars> | budget default [--json]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agental",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.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",
|