agental 0.39.0 → 0.40.2
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 +253 -28
- 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.40.2" : "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}`;
|
|
@@ -8736,6 +8736,7 @@ var REMOTE = /^(?:([^@:/]+)@)?(sbx_[A-Za-z0-9]+):(.*)$/s;
|
|
|
8736
8736
|
var ON_ITS_WAY = /* @__PURE__ */ new Set(["sandbox_migrating", "sandbox_moved", "invalid_state", "ssh_unavailable", "uncertain_operation"]);
|
|
8737
8737
|
var LOOK_AGAIN_FOR_MS = 12e4;
|
|
8738
8738
|
var LOOK_AGAIN_EVERY_MS = 2e3;
|
|
8739
|
+
var RESTORING_WAIT_MS = 10 * 6e4;
|
|
8739
8740
|
var SSH_LOST = 255;
|
|
8740
8741
|
var SOON_MS = 1e4;
|
|
8741
8742
|
var TRIES_IN_A_ROW = 3;
|
|
@@ -8785,6 +8786,8 @@ function accessIn(record) {
|
|
|
8785
8786
|
}
|
|
8786
8787
|
async function reach(client, sandboxId, waitMs = 0) {
|
|
8787
8788
|
const until2 = Date.now() + waitMs;
|
|
8789
|
+
const restoringUntil = Date.now() + RESTORING_WAIT_MS;
|
|
8790
|
+
let saidRestoring = false;
|
|
8788
8791
|
for (; ; ) {
|
|
8789
8792
|
try {
|
|
8790
8793
|
const access = accessIn(await ask4(client, "GET", sandboxId, "")) ?? accessIn(await ask4(client, "PUT", sandboxId, ""));
|
|
@@ -8794,6 +8797,15 @@ async function reach(client, sandboxId, waitMs = 0) {
|
|
|
8794
8797
|
}
|
|
8795
8798
|
throw new Refused2("ssh_unavailable", "SSH was turned on, and the API gave no address to connect to.");
|
|
8796
8799
|
} catch (error) {
|
|
8800
|
+
if (error instanceof Refused2 && (error.code === "sandbox_not_running" || error.code === "sandbox_archived") && Date.now() + LOOK_AGAIN_EVERY_MS <= restoringUntil && await isRestoring(client, sandboxId)) {
|
|
8801
|
+
if (!saidRestoring) {
|
|
8802
|
+
process.stderr.write(`${sandboxId} is being brought back. Waiting for it.
|
|
8803
|
+
`);
|
|
8804
|
+
saidRestoring = true;
|
|
8805
|
+
}
|
|
8806
|
+
await new Promise((resolve) => setTimeout(resolve, LOOK_AGAIN_EVERY_MS));
|
|
8807
|
+
continue;
|
|
8808
|
+
}
|
|
8797
8809
|
if (!(error instanceof Refused2) || !ON_ITS_WAY.has(error.code) || Date.now() + LOOK_AGAIN_EVERY_MS > until2) {
|
|
8798
8810
|
throw error;
|
|
8799
8811
|
}
|
|
@@ -8801,6 +8813,13 @@ async function reach(client, sandboxId, waitMs = 0) {
|
|
|
8801
8813
|
}
|
|
8802
8814
|
}
|
|
8803
8815
|
}
|
|
8816
|
+
async function isRestoring(client, sandboxId) {
|
|
8817
|
+
const response = await client.request(`/v1/sandboxes/${encodeURIComponent(sandboxId)}`, { method: "GET" });
|
|
8818
|
+
if (!response.ok) {
|
|
8819
|
+
return false;
|
|
8820
|
+
}
|
|
8821
|
+
return (await response.json()).status === "restoring";
|
|
8822
|
+
}
|
|
8804
8823
|
async function letIn(client, sandboxId) {
|
|
8805
8824
|
await ask4(client, "POST", sandboxId, "/keys", { publicKey: publicKey() });
|
|
8806
8825
|
}
|
|
@@ -9460,9 +9479,21 @@ var COMMANDS = [
|
|
|
9460
9479
|
{ name: "ssh-off", summary: "Turn SSH off for a sandbox and close its port." },
|
|
9461
9480
|
{
|
|
9462
9481
|
name: "site",
|
|
9463
|
-
summary: "List, add and remove a sandbox's sites
|
|
9464
|
-
examples: [
|
|
9465
|
-
|
|
9482
|
+
summary: "List, add and remove a sandbox's sites, public links to its ports, and see their visits.",
|
|
9483
|
+
examples: [
|
|
9484
|
+
"agental site sbx_2a9a47e50daec64a",
|
|
9485
|
+
"agental site add sbx_2a9a47e50daec64a 3000",
|
|
9486
|
+
"agental site rm sbx_2a9a47e50daec64a rte_0123456789abcdef",
|
|
9487
|
+
"agental site stats sbx_2a9a47e50daec64a rte_0123456789abcdef --range 24h",
|
|
9488
|
+
"agental site analytics off sbx_2a9a47e50daec64a rte_0123456789abcdef",
|
|
9489
|
+
"agental site analytics org"
|
|
9490
|
+
],
|
|
9491
|
+
flags: [
|
|
9492
|
+
["--json", "list, add, stats, analytics: print as JSON"],
|
|
9493
|
+
["--range <24h|7d>", "stats: the last 24 hours, or 7 days, the default"],
|
|
9494
|
+
["--yes", "analytics off: delete the figures without asking"],
|
|
9495
|
+
["--informed", "analytics org on: you have read what is kept, on Enterprise or with your own server"]
|
|
9496
|
+
]
|
|
9466
9497
|
},
|
|
9467
9498
|
{
|
|
9468
9499
|
name: "start",
|
|
@@ -11517,12 +11548,12 @@ var EMAIL_EVENTS = ["email.received", "email.delivered", "email.bounced"];
|
|
|
11517
11548
|
var MEMBER_EVENTS = ["member.invited", "member.joined", "member.removed", "member.role_changed", "key.revoked"];
|
|
11518
11549
|
var TEMPLATE_EVENTS = ["template.created", "template.updated", "template.secrets_changed", "template.labels_changed", "template.deleted"];
|
|
11519
11550
|
var HEADROOM_EVENTS = [
|
|
11520
|
-
"
|
|
11521
|
-
"
|
|
11522
|
-
"
|
|
11523
|
-
"
|
|
11524
|
-
"
|
|
11525
|
-
"
|
|
11551
|
+
"limits.burst_started",
|
|
11552
|
+
"limits.burst_ended",
|
|
11553
|
+
"limits.refused",
|
|
11554
|
+
"limits.running_count_reached",
|
|
11555
|
+
"limits.budget_threshold",
|
|
11556
|
+
"limits.budget_reached"
|
|
11526
11557
|
];
|
|
11527
11558
|
var JOB_EVENTS = ["job.created", "job.updated", "job.deleted", "job.run_started", "job.run_finished", "job.run_failed", "job.recovered", "job.paused"];
|
|
11528
11559
|
var WEBHOOK_KINDS = [...WEBHOOK_EVENTS, ...EMAIL_EVENTS, ...MEMBER_EVENTS, ...TEMPLATE_EVENTS, ...HEADROOM_EVENTS, ...JOB_EVENTS];
|
|
@@ -11829,15 +11860,19 @@ function needId(id, what) {
|
|
|
11829
11860
|
}
|
|
11830
11861
|
|
|
11831
11862
|
// ../src/cli-sites.ts
|
|
11832
|
-
var USAGE6 = "site takes a sandbox, or list, add or
|
|
11833
|
-
|
|
11834
|
-
|
|
11835
|
-
|
|
11863
|
+
var USAGE6 = "site takes a sandbox, or list, add, rm, stats or analytics, then the sandbox. agental site --help shows each.";
|
|
11864
|
+
var ANALYTICS_USAGE = "site analytics takes on or off, then the sandbox and the site's id, or org, with on or off to change it.";
|
|
11865
|
+
var REPORT_ROWS = 5;
|
|
11866
|
+
async function bodyOf(response) {
|
|
11836
11867
|
try {
|
|
11837
|
-
|
|
11868
|
+
return await response.json();
|
|
11838
11869
|
} catch {
|
|
11839
|
-
|
|
11870
|
+
return null;
|
|
11840
11871
|
}
|
|
11872
|
+
}
|
|
11873
|
+
async function ask8(client, method, pathname, body) {
|
|
11874
|
+
const response = await client.request(pathname, { method, ...body === void 0 ? {} : { body: JSON.stringify(body) } });
|
|
11875
|
+
const answered = await bodyOf(response);
|
|
11841
11876
|
if (!response.ok) {
|
|
11842
11877
|
client.fail(response.status, answered);
|
|
11843
11878
|
}
|
|
@@ -11867,8 +11902,151 @@ function portFrom(given) {
|
|
|
11867
11902
|
}
|
|
11868
11903
|
return port;
|
|
11869
11904
|
}
|
|
11905
|
+
async function siteOn(client, sandbox, target) {
|
|
11906
|
+
const found = (await sitesOf(client, sandbox)).find((route) => route.id === target);
|
|
11907
|
+
if (!found) {
|
|
11908
|
+
throw new Error(`${sandbox} has no site ${target}. agental site ${sandbox} lists its sites.`);
|
|
11909
|
+
}
|
|
11910
|
+
return found;
|
|
11911
|
+
}
|
|
11912
|
+
var printable = (name) => name.replace(new RegExp("\\p{C}", "gu"), "?");
|
|
11913
|
+
var reportJson = (report) => JSON.stringify(report, null, 2).replace(/[^\P{C}\n]/gu, (found) => [...Array(found.length).keys()].map((index) => `\\u${found.charCodeAt(index).toString(16).padStart(4, "0")}`).join(""));
|
|
11914
|
+
function countryName(code) {
|
|
11915
|
+
try {
|
|
11916
|
+
return new Intl.DisplayNames(["en"], { type: "region" }).of(code) ?? code;
|
|
11917
|
+
} catch {
|
|
11918
|
+
return code;
|
|
11919
|
+
}
|
|
11920
|
+
}
|
|
11921
|
+
function comparedIn(report) {
|
|
11922
|
+
const change = report.visitsChangePercent;
|
|
11923
|
+
if (change === null) return "There's nothing to compare it with yet.";
|
|
11924
|
+
const before = report.range === "24h" ? "the day before" : "the 3 before";
|
|
11925
|
+
const subject = report.range === "24h" ? "That's" : "The last 3 days had";
|
|
11926
|
+
if (change === 0) return `${subject} the same as ${before}.`;
|
|
11927
|
+
return `${subject} ${Math.abs(change)}% ${change > 0 ? "more" : "fewer"} than ${before}.`;
|
|
11928
|
+
}
|
|
11929
|
+
function listIn2(title, rows) {
|
|
11930
|
+
if (rows.length === 0) return "";
|
|
11931
|
+
const shown = rows.slice(0, REPORT_ROWS);
|
|
11932
|
+
const width = Math.max(...shown.map((row) => row.name.length));
|
|
11933
|
+
return `
|
|
11934
|
+
${faint(title)}
|
|
11935
|
+
${shown.map((row) => ` ${row.name.padEnd(width)} ${row.count}
|
|
11936
|
+
`).join("")}`;
|
|
11937
|
+
}
|
|
11938
|
+
function reportIn(report, sandbox, siteId) {
|
|
11939
|
+
if (!report.organizationEnabled) {
|
|
11940
|
+
return "Site analytics are off for this organization, so nothing is counted. agental site analytics org on turns them on.\n";
|
|
11941
|
+
}
|
|
11942
|
+
if (!report.enabled) {
|
|
11943
|
+
return `Analytics are off for this site, so nothing is counted. agental site analytics on ${sandbox} ${siteId} turns them on.
|
|
11944
|
+
`;
|
|
11945
|
+
}
|
|
11946
|
+
const span2 = report.range === "24h" ? "in the last 24 hours" : "in the last 7 days";
|
|
11947
|
+
const today = report.range === "24h" ? " today (UTC)" : "";
|
|
11948
|
+
const worked = report.requests > 0 ? ` ${Math.floor((report.requests - report.errors) * 1e3 / report.requests) / 10}% of requests worked${today}.` : "";
|
|
11949
|
+
return [
|
|
11950
|
+
`${report.visits} ${report.visits === 1 ? "visit" : "visits"} ${span2}.
|
|
11951
|
+
`,
|
|
11952
|
+
`${comparedIn(report)} They opened ${report.pageViews} ${report.pageViews === 1 ? "page" : "pages"}.${worked}
|
|
11953
|
+
`,
|
|
11954
|
+
listIn2(`Top pages${today}`, report.pages.map((row) => ({ ...row, name: printable(row.name) }))),
|
|
11955
|
+
listIn2(`Top sources${today}`, report.sources.map((row) => ({ ...row, name: printable(row.name) }))),
|
|
11956
|
+
listIn2(`Top countries${today}`, report.countries.map((row) => ({ ...row, name: printable(countryName(row.name)) })))
|
|
11957
|
+
].join("");
|
|
11958
|
+
}
|
|
11959
|
+
async function siteSwitch(client, turn, words2, options) {
|
|
11960
|
+
const [sandbox, target, ...rest] = words2;
|
|
11961
|
+
if (sandbox === void 0 || target === void 0 || rest.length > 0) {
|
|
11962
|
+
throw new Error(ANALYTICS_USAGE);
|
|
11963
|
+
}
|
|
11964
|
+
if (options.informed) {
|
|
11965
|
+
throw new Error("--informed is for agental site analytics org on.");
|
|
11966
|
+
}
|
|
11967
|
+
const found = await siteOn(client, sandbox, target);
|
|
11968
|
+
const named = found.url ?? `port ${found.port}`;
|
|
11969
|
+
if (turn === "off" && !options.yes && !await client.confirmed(`Turn analytics off for ${named}? Its figures are deleted now and cannot be brought back.`)) {
|
|
11970
|
+
process.stderr.write("Nothing was changed. --yes goes on without asking.\n");
|
|
11971
|
+
process.exitCode = 1;
|
|
11972
|
+
return;
|
|
11973
|
+
}
|
|
11974
|
+
const report = await ask8(client, "PUT", `/v1/host-routes/${encodeURIComponent(target)}/analytics`, { enabled: turn === "on" });
|
|
11975
|
+
if (options.json) {
|
|
11976
|
+
process.stdout.write(`${reportJson(report)}
|
|
11977
|
+
`);
|
|
11978
|
+
return;
|
|
11979
|
+
}
|
|
11980
|
+
if (turn === "off") {
|
|
11981
|
+
process.stdout.write(`Analytics are off for ${named}, and its figures are deleted.
|
|
11982
|
+
`);
|
|
11983
|
+
return;
|
|
11984
|
+
}
|
|
11985
|
+
process.stdout.write(
|
|
11986
|
+
report.organizationEnabled ? `Analytics are on for ${named}.
|
|
11987
|
+
` : "This site's switch is on, but the organization's is off, so nothing is counted until agental site analytics org on.\n"
|
|
11988
|
+
);
|
|
11989
|
+
}
|
|
11990
|
+
async function organizationSwitch(client, words2, options) {
|
|
11991
|
+
const [turn, ...rest] = words2;
|
|
11992
|
+
if (rest.length > 0 || turn !== void 0 && turn !== "on" && turn !== "off") {
|
|
11993
|
+
throw new Error(ANALYTICS_USAGE);
|
|
11994
|
+
}
|
|
11995
|
+
if (options.informed && turn !== "on") {
|
|
11996
|
+
throw new Error("--informed is for agental site analytics org on.");
|
|
11997
|
+
}
|
|
11998
|
+
let setting;
|
|
11999
|
+
if (turn === void 0) {
|
|
12000
|
+
setting = await ask8(client, "GET", "/v1/site-analytics");
|
|
12001
|
+
} else {
|
|
12002
|
+
if (turn === "off" && !options.yes && !await client.confirmed("Turn site analytics off for this organization? Every site's figures are deleted now and cannot be brought back.")) {
|
|
12003
|
+
process.stderr.write("Nothing was changed. --yes goes on without asking.\n");
|
|
12004
|
+
process.exitCode = 1;
|
|
12005
|
+
return;
|
|
12006
|
+
}
|
|
12007
|
+
const put = (body) => client.request("/v1/site-analytics", { method: "PUT", body: JSON.stringify(body) });
|
|
12008
|
+
let response = await put({ enabled: turn === "on" });
|
|
12009
|
+
let answered = await bodyOf(response);
|
|
12010
|
+
const refused = answered?.error;
|
|
12011
|
+
if (response.status === 409 && refused?.code === "notice_required") {
|
|
12012
|
+
process.stderr.write(`${refused.message ?? ""}
|
|
12013
|
+
`);
|
|
12014
|
+
if (!options.informed) {
|
|
12015
|
+
process.stderr.write("Nothing was changed. If your organization accepts this: agental site analytics org on --informed\n");
|
|
12016
|
+
process.exitCode = 1;
|
|
12017
|
+
return;
|
|
12018
|
+
}
|
|
12019
|
+
response = await put({ enabled: true, informed: true });
|
|
12020
|
+
answered = await bodyOf(response);
|
|
12021
|
+
}
|
|
12022
|
+
if (!response.ok) {
|
|
12023
|
+
client.fail(response.status, answered);
|
|
12024
|
+
}
|
|
12025
|
+
setting = answered;
|
|
12026
|
+
}
|
|
12027
|
+
if (options.json) {
|
|
12028
|
+
process.stdout.write(`${JSON.stringify(setting, null, 2)}
|
|
12029
|
+
`);
|
|
12030
|
+
return;
|
|
12031
|
+
}
|
|
12032
|
+
if (turn === "off") {
|
|
12033
|
+
process.stdout.write("Site analytics are off for this organization, and every site's figures are deleted.\n");
|
|
12034
|
+
return;
|
|
12035
|
+
}
|
|
12036
|
+
process.stdout.write(
|
|
12037
|
+
setting.enabled ? `Site analytics are on for this organization. Figures are kept for ${setting.keptDays} days at most.
|
|
12038
|
+
` : `Site analytics are off for this organization.${setting.noticeRequired ? " Turning them on takes --informed, after reading what is kept." : ""}
|
|
12039
|
+
`
|
|
12040
|
+
);
|
|
12041
|
+
}
|
|
11870
12042
|
async function site(client, positionals, options) {
|
|
11871
|
-
|
|
12043
|
+
if (positionals[0] === "analytics") {
|
|
12044
|
+
const [turn, ...words2] = positionals.slice(1);
|
|
12045
|
+
if (turn === "org") return organizationSwitch(client, words2, options);
|
|
12046
|
+
if (turn === "on" || turn === "off") return siteSwitch(client, turn, words2, options);
|
|
12047
|
+
throw new Error(ANALYTICS_USAGE);
|
|
12048
|
+
}
|
|
12049
|
+
const verb = positionals[0] === "list" || positionals[0] === "add" || positionals[0] === "rm" || positionals[0] === "stats" ? positionals[0] : null;
|
|
11872
12050
|
const [sandbox, target, ...rest] = verb === null ? positionals : positionals.slice(1);
|
|
11873
12051
|
if (sandbox === void 0) {
|
|
11874
12052
|
throw new Error(USAGE6);
|
|
@@ -11924,15 +12102,26 @@ async function site(client, positionals, options) {
|
|
|
11924
12102
|
if (target === void 0 || rest.length > 0) {
|
|
11925
12103
|
throw new Error(`site rm needs the sandbox and the site's id, as agental site ${sandbox} lists them.`);
|
|
11926
12104
|
}
|
|
11927
|
-
const found =
|
|
11928
|
-
if (!found) {
|
|
11929
|
-
throw new Error(`${sandbox} has no site ${target}. agental site ${sandbox} lists its sites.`);
|
|
11930
|
-
}
|
|
12105
|
+
const found = await siteOn(client, sandbox, target);
|
|
11931
12106
|
await ask8(client, "POST", `/v1/host-routes/${encodeURIComponent(target)}/hide`);
|
|
11932
12107
|
process.stdout.write(`Removed. ${found.url ?? `Port ${found.port}`} stops working now; adding port ${found.port} again gives a new link.
|
|
11933
12108
|
`);
|
|
11934
12109
|
return;
|
|
11935
12110
|
}
|
|
12111
|
+
case "stats": {
|
|
12112
|
+
if (target === void 0 || rest.length > 0) {
|
|
12113
|
+
throw new Error(`site stats needs the sandbox and the site's id, as agental site ${sandbox} lists them.`);
|
|
12114
|
+
}
|
|
12115
|
+
const range = options.range ?? "7d";
|
|
12116
|
+
if (range !== "24h" && range !== "7d") {
|
|
12117
|
+
throw new Error(`--range is 24h or 7d. It was given ${range}.`);
|
|
12118
|
+
}
|
|
12119
|
+
await siteOn(client, sandbox, target);
|
|
12120
|
+
const report = await ask8(client, "GET", `/v1/host-routes/${encodeURIComponent(target)}/analytics?range=${range}`);
|
|
12121
|
+
process.stdout.write(options.json ? `${reportJson(report)}
|
|
12122
|
+
` : reportIn(report, sandbox, target));
|
|
12123
|
+
return;
|
|
12124
|
+
}
|
|
11936
12125
|
}
|
|
11937
12126
|
}
|
|
11938
12127
|
|
|
@@ -12965,6 +13154,10 @@ async function main() {
|
|
|
12965
13154
|
facets: { type: "string" },
|
|
12966
13155
|
yes: { type: "boolean", default: false },
|
|
12967
13156
|
confirm: { type: "string" },
|
|
13157
|
+
// agental site stats: 24h or 7d.
|
|
13158
|
+
range: { type: "string" },
|
|
13159
|
+
// agental site analytics org on: the person has read what is kept.
|
|
13160
|
+
informed: { type: "boolean", default: false },
|
|
12968
13161
|
sort: { type: "string" },
|
|
12969
13162
|
role: { type: "string" },
|
|
12970
13163
|
"revoke-keys": { type: "boolean", default: false },
|
|
@@ -13095,7 +13288,7 @@ async function main() {
|
|
|
13095
13288
|
await browser(positionals[1], values.headless, values.headed, values.off, values.status);
|
|
13096
13289
|
return;
|
|
13097
13290
|
case "site":
|
|
13098
|
-
await site({ request, fail }, positionals.slice(1), { json: values.json });
|
|
13291
|
+
await site({ request, fail, confirmed }, positionals.slice(1), { json: values.json, range: values.range, yes: values.yes === true, informed: values.informed === true });
|
|
13099
13292
|
return;
|
|
13100
13293
|
case "network":
|
|
13101
13294
|
await network(positionals.slice(1), values);
|
|
@@ -14185,6 +14378,16 @@ function ruleInWords(rule) {
|
|
|
14185
14378
|
const listed = Array.isArray(rule?.allow) ? rule.allow.map(String) : [];
|
|
14186
14379
|
return listed.length > 0 ? `${String(rule?.outbound ?? "")}: ${listed.join(", ")}` : String(rule?.outbound ?? "");
|
|
14187
14380
|
}
|
|
14381
|
+
function ownAddressesWarning(id, removedAll, heldTo, template2) {
|
|
14382
|
+
const blockIt = `agental template network ${template2} blocked, then agental template apply ${template2} ${id}`;
|
|
14383
|
+
if (heldTo === "open") {
|
|
14384
|
+
return removedAll ? `--none removes this sandbox's own addresses. It blocks nothing: its template is open, so it still reaches everything. To block it: ${blockIt}` : `Its template is open, so this sandbox still reaches everything. These addresses count once the template is blocked or an allowlist. To block the rest: ${blockIt}`;
|
|
14385
|
+
}
|
|
14386
|
+
if (removedAll && heldTo === "allowlist") {
|
|
14387
|
+
return "--none removes this sandbox's own addresses. It can still reach the addresses on its template's list.";
|
|
14388
|
+
}
|
|
14389
|
+
return null;
|
|
14390
|
+
}
|
|
14188
14391
|
async function network(positionals, values) {
|
|
14189
14392
|
const [id, ...more] = positionals;
|
|
14190
14393
|
if (!id) {
|
|
@@ -14218,6 +14421,13 @@ async function network(positionals, values) {
|
|
|
14218
14421
|
""
|
|
14219
14422
|
].join("\n")
|
|
14220
14423
|
);
|
|
14424
|
+
if (allow !== void 0) {
|
|
14425
|
+
const warning = ownAddressesWarning(id, values.none, body?.outbound, String(body?.template?.name ?? "<template>"));
|
|
14426
|
+
if (warning) {
|
|
14427
|
+
process.stderr.write(`${warning}
|
|
14428
|
+
`);
|
|
14429
|
+
}
|
|
14430
|
+
}
|
|
14221
14431
|
}
|
|
14222
14432
|
function egressFrom(words2, how) {
|
|
14223
14433
|
const [via, country, session, ...more] = words2.map((word) => word.trim());
|
|
@@ -14930,6 +15140,10 @@ async function ci(positionals, options) {
|
|
|
14930
15140
|
`${item.repository} pool ${item.poolMax ?? `${body.defaultPoolMax} (default)`} template ${item.templateId ?? "runs-on (empty)"} agental is ${item.size} ${item.sandboxes.length} sandboxes, ${busy} busy
|
|
14931
15141
|
`
|
|
14932
15142
|
);
|
|
15143
|
+
for (const sandbox of item.sandboxes.filter((each) => each.heldUntil)) {
|
|
15144
|
+
process.stdout.write(` ${sandbox.name} is kept as a job failed on it, until ${sandbox.heldUntil}: agental start ${sandbox.sandboxId} && agental ssh ${sandbox.sandboxId}
|
|
15145
|
+
`);
|
|
15146
|
+
}
|
|
14933
15147
|
for (const job2 of item.waiting ?? []) {
|
|
14934
15148
|
process.stdout.write(` job ${job2.jobId} waiting since ${job2.since}: ${job2.message}
|
|
14935
15149
|
`);
|
|
@@ -15132,7 +15346,7 @@ Nothing is charged until it is paid. agental billing shows it within a minute of
|
|
|
15132
15346
|
body,
|
|
15133
15347
|
() => body.address === null ? "Billing emails go to the owners alone. An owner can add an address for a copy of each under Billing in the console.\n" : body.confirmed === false ? `${body.address} gets no copies yet: it has to confirm by the link sent to it. An owner can send a new one under Billing in the console.
|
|
15134
15348
|
` : body.waiting === true ? `${body.address} gets no copies for now: whoever set it is no longer an owner. An owner keeps it or removes it under Billing in the console.
|
|
15135
|
-
` : `Billing emails also go to ${body.address}: out of credit, reloads, a failed payment, the free allowance. An owner changes it under Billing in the console.
|
|
15349
|
+
` : `Billing emails also go to ${body.address}: out of credit, reloads, a failed payment, the free allowance, the burst budget. An owner changes it under Billing in the console.
|
|
15136
15350
|
`
|
|
15137
15351
|
);
|
|
15138
15352
|
return;
|
|
@@ -15985,6 +16199,9 @@ ${FILES_USAGE.map((line) => ` ${line}`).join("\n")}
|
|
|
15985
16199
|
agental site list <sandbox-id> [--json]
|
|
15986
16200
|
agental site add <sandbox-id> <port> [--json] a public link to a port, printed
|
|
15987
16201
|
agental site rm <sandbox-id> <site-id> the link stops working, for good
|
|
16202
|
+
agental site stats <sandbox-id> <site-id> [--range 24h|7d] [--json] its visits, pages, sources, countries
|
|
16203
|
+
agental site analytics on|off <sandbox-id> <site-id> [--yes] [--json] off deletes its figures
|
|
16204
|
+
agental site analytics org [on|off] [--informed] [--yes] [--json] the organization's switch
|
|
15988
16205
|
agental email <sandbox-id> [--json]
|
|
15989
16206
|
agental email on|off <sandbox-id>
|
|
15990
16207
|
agental email list <sandbox-id> [--limit <n>] [--json]
|
|
@@ -16057,8 +16274,9 @@ the place of the one it had, so an allowlist names every address each time. A sa
|
|
|
16057
16274
|
template takes it when it next starts, or now when template apply names it, and one made from
|
|
16058
16275
|
it is held to it from its first boot. network says what a sandbox is held to, its template's
|
|
16059
16276
|
rule as it has it, and its own addresses. With --allow it gives the sandbox the addresses that
|
|
16060
|
-
follow as its own, in place of the ones it had, and with --none takes them away
|
|
16061
|
-
its template's rule and never take from it.
|
|
16277
|
+
follow as its own, in place of the ones it had, and with --none takes them away, which does not
|
|
16278
|
+
block the sandbox: they add to its template's rule and never take from it. To block a sandbox,
|
|
16279
|
+
set its template's rule. Open lets everything out whatever they say, blocked
|
|
16062
16280
|
lets out only them, and an allowlist lets out its addresses and them. That holds at once, the
|
|
16063
16281
|
sandbox is not restarted, and what is sent to it, commands, files and SSH, is not affected.
|
|
16064
16282
|
create --allow gives a new sandbox its own from its first boot. These work where GET
|
|
@@ -16177,9 +16395,9 @@ webhooks lists the addresses your account's events are posted to, with what each
|
|
|
16177
16395
|
how its last post went. webhook add makes one: it posts to <url>, which has to be on the public
|
|
16178
16396
|
internet, the kinds --events names, such as sandbox.stopped,sandbox.error, or every kind with
|
|
16179
16397
|
--all, those added later included. The kinds are ${WEBHOOK_KINDS.join(", ")}.
|
|
16180
|
-
A group by its name and .*, as
|
|
16181
|
-
added to it later; quote it, as --events '
|
|
16182
|
-
|
|
16398
|
+
A group by its name and .*, as limits.* or sandbox.*, is every kind of the group, and any
|
|
16399
|
+
added to it later; quote it, as --events 'limits.*,sandbox.error', so the shell leaves it be.
|
|
16400
|
+
limits.* are the organization's, about no sandbox: a burst begun and ended, starts refused,
|
|
16183
16401
|
the running count met, and the burst budget at 80% and reached.
|
|
16184
16402
|
It prints the webhook's signing secret, the one time it is given: each post carries
|
|
16185
16403
|
X-Agental-Signature, the HMAC-SHA256 of its body under that secret. show says what one is sent,
|
|
@@ -16290,6 +16508,13 @@ something listens there now. site add gives a port a link and prints it; the ser
|
|
|
16290
16508
|
sandbox must listen on 0.0.0.0. site rm takes a site away for good: its link stops working at
|
|
16291
16509
|
once, and adding the port again gives a new one. They are the API's host routes with public
|
|
16292
16510
|
true, and site rm is POST /v1/host-routes/{id}/hide.
|
|
16511
|
+
site stats reports a site's visits: a visit is one address and browser on one site on one UTC day, and bots
|
|
16512
|
+
are left out. Figures are totals kept for 7 days at most, with no visitor's address, query
|
|
16513
|
+
or cookie. site analytics off deletes a site's figures at once, and asks first: --yes goes on
|
|
16514
|
+
without asking, and without a terminal nothing is changed unless it is given. site analytics org
|
|
16515
|
+
is the organization's switch, which each site's applies within. On Enterprise or with a server
|
|
16516
|
+
of your own, org on prints what is kept and changes nothing until it is run with --informed,
|
|
16517
|
+
which says that you have read it.
|
|
16293
16518
|
email says whether mail is on for a sandbox, and the domain its addresses end in: any name
|
|
16294
16519
|
before the @ of that domain reaches the sandbox. Mail is off until email on turns it on, for
|
|
16295
16520
|
receiving and for sending both, and each message is charged to the account from then on. email
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agental",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.2",
|
|
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",
|