agental 0.6.0 → 0.6.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 +8 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -46,7 +46,7 @@ import { parseArgs } from "node:util";
|
|
|
46
46
|
|
|
47
47
|
// ../src/cli-build.ts
|
|
48
48
|
var PUBLISHED = true;
|
|
49
|
-
var CLI_VERSION = true ? "0.6.
|
|
49
|
+
var CLI_VERSION = true ? "0.6.2" : "dev";
|
|
50
50
|
var DEFAULT_API_URL = true ? "https://agental.io" : "http://127.0.0.1:8741";
|
|
51
51
|
var PACKAGE_NAME = "agental";
|
|
52
52
|
var USER_AGENT = `agental-cli/${CLI_VERSION}`;
|
|
@@ -2322,8 +2322,10 @@ function needId(id, what) {
|
|
|
2322
2322
|
}
|
|
2323
2323
|
|
|
2324
2324
|
// ../src/cli-shell.ts
|
|
2325
|
+
import { createHash as createHash2, randomBytes as randomBytes4 } from "node:crypto";
|
|
2325
2326
|
var TERMINAL_PROTOCOL = "agental.terminal.v1";
|
|
2326
2327
|
var TICKET_PROTOCOL_PREFIX = "ticket.";
|
|
2328
|
+
var VERIFIER_PROTOCOL_PREFIX = "verifier.";
|
|
2327
2329
|
var MAX_INPUT_BYTES = 64 * 1024;
|
|
2328
2330
|
var LOST = 255;
|
|
2329
2331
|
function clamp(value, fallback) {
|
|
@@ -2367,13 +2369,15 @@ async function shell(client, id, streams = process) {
|
|
|
2367
2369
|
}
|
|
2368
2370
|
const { stdin, stdout, stderr } = streams;
|
|
2369
2371
|
const size = sizeOf(stdout);
|
|
2370
|
-
const
|
|
2372
|
+
const verifier = randomBytes4(32).toString("base64url");
|
|
2373
|
+
const challenge = createHash2("sha256").update(verifier).digest("base64url");
|
|
2374
|
+
const response = await client.request(`/v1/sandboxes/${encodeURIComponent(id)}/terminal`, { method: "POST", body: JSON.stringify({ ...size, challenge }) });
|
|
2371
2375
|
const body = await response.json().catch(() => null);
|
|
2372
2376
|
if (!response.ok || typeof body?.ticket !== "string") {
|
|
2373
2377
|
const error2 = body?.error;
|
|
2374
2378
|
throw new Error(error2 && typeof error2.code === "string" ? `${error2.code}: ${String(error2.message ?? "")}` : `The API answered the terminal with HTTP ${response.status}.`);
|
|
2375
2379
|
}
|
|
2376
|
-
const socket = new WebSocket(webSocketUrl(client.base, body.path), [TERMINAL_PROTOCOL, `${TICKET_PROTOCOL_PREFIX}${body.ticket}`]);
|
|
2380
|
+
const socket = new WebSocket(webSocketUrl(client.base, body.path), [TERMINAL_PROTOCOL, `${TICKET_PROTOCOL_PREFIX}${body.ticket}`, `${VERIFIER_PROTOCOL_PREFIX}${verifier}`]);
|
|
2377
2381
|
socket.binaryType = "arraybuffer";
|
|
2378
2382
|
let exit = null;
|
|
2379
2383
|
let error = null;
|
|
@@ -4847,7 +4851,7 @@ function describePrices(body) {
|
|
|
4847
4851
|
}
|
|
4848
4852
|
if (body.burstFee) {
|
|
4849
4853
|
out.push(
|
|
4850
|
-
`Starting faster than the free burst costs a fee:
|
|
4854
|
+
`Starting faster than the free burst costs a fee: $0.027 for each small sandbox past it, $0.108 for a large, never more than one more hour of what you start. What was started falls by half every ${body.burstFee.halfLifeMinutes} minutes. At most ${wholeMoney(body.burstFee.defaultBudgetMicros)} a month unless you set another budget: agental burst budget <dollars>.`
|
|
4851
4855
|
);
|
|
4852
4856
|
}
|
|
4853
4857
|
if (body.topUps?.length) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agental",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.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",
|