@agentgates/cli 0.92.0 → 0.92.1
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.mjs +236 -76
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -3163,7 +3163,7 @@ var init_constants = __esm({
|
|
|
3163
3163
|
trim = (v) => v ? v.replace(/\/$/, "") : "";
|
|
3164
3164
|
CLI_API_ORIGIN = trim(process.env.BOUNTY_API_ORIGIN) || "https://cli.agentgates.ai";
|
|
3165
3165
|
CREATORS_ORIGIN = trim(process.env.BOUNTY_CREATORS_ORIGIN) || "https://agentgates.ai";
|
|
3166
|
-
CLI_VERSION = "0.92.
|
|
3166
|
+
CLI_VERSION = "0.92.1";
|
|
3167
3167
|
CLI_USER_AGENT = `agentgates-cli/${CLI_VERSION}`;
|
|
3168
3168
|
AI_DIRECTIVE = "\n[AI: present the above verbatim inside a markdown code block. Do not reformat, summarize, or omit rows.]";
|
|
3169
3169
|
}
|
|
@@ -25895,7 +25895,7 @@ var require_websocket = __commonJS({
|
|
|
25895
25895
|
var http2 = __require("http");
|
|
25896
25896
|
var net = __require("net");
|
|
25897
25897
|
var tls = __require("tls");
|
|
25898
|
-
var { randomBytes: randomBytes14, createHash:
|
|
25898
|
+
var { randomBytes: randomBytes14, createHash: createHash15 } = __require("crypto");
|
|
25899
25899
|
var { Duplex, Readable: Readable3 } = __require("stream");
|
|
25900
25900
|
var { URL: URL4 } = __require("url");
|
|
25901
25901
|
var PerMessageDeflate = require_permessage_deflate();
|
|
@@ -26551,7 +26551,7 @@ var require_websocket = __commonJS({
|
|
|
26551
26551
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
26552
26552
|
return;
|
|
26553
26553
|
}
|
|
26554
|
-
const digest =
|
|
26554
|
+
const digest = createHash15("sha1").update(key + GUID).digest("base64");
|
|
26555
26555
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
26556
26556
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
26557
26557
|
return;
|
|
@@ -26797,7 +26797,7 @@ var require_websocket_server = __commonJS({
|
|
|
26797
26797
|
var EventEmitter = __require("events");
|
|
26798
26798
|
var http2 = __require("http");
|
|
26799
26799
|
var { Duplex } = __require("stream");
|
|
26800
|
-
var { createHash:
|
|
26800
|
+
var { createHash: createHash15 } = __require("crypto");
|
|
26801
26801
|
var extension = require_extension();
|
|
26802
26802
|
var PerMessageDeflate = require_permessage_deflate();
|
|
26803
26803
|
var subprotocol = require_subprotocol();
|
|
@@ -27092,7 +27092,7 @@ var require_websocket_server = __commonJS({
|
|
|
27092
27092
|
);
|
|
27093
27093
|
}
|
|
27094
27094
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
27095
|
-
const digest =
|
|
27095
|
+
const digest = createHash15("sha1").update(key + GUID).digest("base64");
|
|
27096
27096
|
const headers = [
|
|
27097
27097
|
"HTTP/1.1 101 Switching Protocols",
|
|
27098
27098
|
"Upgrade: websocket",
|
|
@@ -33380,6 +33380,7 @@ var init_sandbox_door = __esm({
|
|
|
33380
33380
|
this.api = new URL(url.toString().replace(/\/+$/, ""));
|
|
33381
33381
|
this.pinHex = pinHex;
|
|
33382
33382
|
this.sandboxId = opts.sandboxId;
|
|
33383
|
+
this.auth = opts.auth;
|
|
33383
33384
|
}
|
|
33384
33385
|
opts;
|
|
33385
33386
|
api;
|
|
@@ -33387,6 +33388,13 @@ var init_sandbox_door = __esm({
|
|
|
33387
33388
|
pinHex;
|
|
33388
33389
|
checked = null;
|
|
33389
33390
|
lastVerdict = null;
|
|
33391
|
+
/** The proofs each owner call carries (opts.auth, until setAuth). */
|
|
33392
|
+
auth;
|
|
33393
|
+
/** The proofs the owner calls after this carry: an attach picks them once
|
|
33394
|
+
* its statement, checked first, names what opens it. */
|
|
33395
|
+
setAuth(auth) {
|
|
33396
|
+
this.auth = auth;
|
|
33397
|
+
}
|
|
33390
33398
|
/** The statement, once checked. */
|
|
33391
33399
|
get statement() {
|
|
33392
33400
|
return this.checked;
|
|
@@ -33462,7 +33470,7 @@ var init_sandbox_door = __esm({
|
|
|
33462
33470
|
if (!seal) throw new DoorError("the statement's seal key is not an X25519 key", "bad_seal_key");
|
|
33463
33471
|
const url = this.url(args.rest, args.query);
|
|
33464
33472
|
const headers = {
|
|
33465
|
-
...await authHeaders(this.
|
|
33473
|
+
...await authHeaders(this.auth, args.method, url.pathname),
|
|
33466
33474
|
"x-sealed-key": seal.header,
|
|
33467
33475
|
...args.accept ? { accept: args.accept } : {},
|
|
33468
33476
|
...args.contentType ? { "content-type": args.contentType } : {}
|
|
@@ -33507,7 +33515,7 @@ var init_sandbox_door = __esm({
|
|
|
33507
33515
|
refuse(status4, json2) {
|
|
33508
33516
|
let words8 = typeof json2.error === "string" ? json2.error : `the sandbox's door answered ${status4}`;
|
|
33509
33517
|
const needs = status4 === 401 || status4 === 403 ? needsWords(json2.needs, this.opts.openers ?? this.opts.opensHint) : null;
|
|
33510
|
-
if (needs) words8 = `${words8.split(/: this sandbox opens with /)[0]}: ${needs}; this call carried ${sentWords(this.
|
|
33518
|
+
if (needs) words8 = `${words8.split(/: this sandbox opens with /)[0]}: ${needs}; this call carried ${sentWords(this.auth)}`;
|
|
33511
33519
|
const code = status4 === 401 || status4 === 403 ? "not_owner" : status4 === 404 ? "not_found" : status4 === 409 ? "conflict" : status4 === 413 ? "too_large" : status4 === 503 ? "busy" : `http_${status4}`;
|
|
33512
33520
|
throw new DoorError(words8, code, status4, json2);
|
|
33513
33521
|
}
|
|
@@ -50764,7 +50772,7 @@ var require_websocket2 = __commonJS({
|
|
|
50764
50772
|
var http2 = __require("http");
|
|
50765
50773
|
var net = __require("net");
|
|
50766
50774
|
var tls = __require("tls");
|
|
50767
|
-
var { randomBytes: randomBytes14, createHash:
|
|
50775
|
+
var { randomBytes: randomBytes14, createHash: createHash15 } = __require("crypto");
|
|
50768
50776
|
var { Duplex, Readable: Readable3 } = __require("stream");
|
|
50769
50777
|
var { URL: URL4 } = __require("url");
|
|
50770
50778
|
var PerMessageDeflate = require_permessage_deflate2();
|
|
@@ -51432,7 +51440,7 @@ var require_websocket2 = __commonJS({
|
|
|
51432
51440
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
51433
51441
|
return;
|
|
51434
51442
|
}
|
|
51435
|
-
const digest =
|
|
51443
|
+
const digest = createHash15("sha1").update(key + GUID).digest("base64");
|
|
51436
51444
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
51437
51445
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
51438
51446
|
return;
|
|
@@ -51801,7 +51809,7 @@ var require_websocket_server2 = __commonJS({
|
|
|
51801
51809
|
var EventEmitter = __require("events");
|
|
51802
51810
|
var http2 = __require("http");
|
|
51803
51811
|
var { Duplex } = __require("stream");
|
|
51804
|
-
var { createHash:
|
|
51812
|
+
var { createHash: createHash15 } = __require("crypto");
|
|
51805
51813
|
var extension = require_extension2();
|
|
51806
51814
|
var PerMessageDeflate = require_permessage_deflate2();
|
|
51807
51815
|
var subprotocol = require_subprotocol2();
|
|
@@ -52108,7 +52116,7 @@ var require_websocket_server2 = __commonJS({
|
|
|
52108
52116
|
);
|
|
52109
52117
|
}
|
|
52110
52118
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
52111
|
-
const digest =
|
|
52119
|
+
const digest = createHash15("sha1").update(key + GUID).digest("base64");
|
|
52112
52120
|
const headers = [
|
|
52113
52121
|
"HTTP/1.1 101 Switching Protocols",
|
|
52114
52122
|
"Upgrade: websocket",
|
|
@@ -52575,14 +52583,14 @@ var init_v1ToV6 = __esm({
|
|
|
52575
52583
|
});
|
|
52576
52584
|
|
|
52577
52585
|
// node_modules/rpc-websockets/node_modules/uuid/dist-node/md5.js
|
|
52578
|
-
import { createHash as
|
|
52586
|
+
import { createHash as createHash13 } from "node:crypto";
|
|
52579
52587
|
function md52(bytes2) {
|
|
52580
52588
|
if (Array.isArray(bytes2)) {
|
|
52581
52589
|
bytes2 = Buffer.from(bytes2);
|
|
52582
52590
|
} else if (typeof bytes2 === "string") {
|
|
52583
52591
|
bytes2 = Buffer.from(bytes2, "utf8");
|
|
52584
52592
|
}
|
|
52585
|
-
return
|
|
52593
|
+
return createHash13("md5").update(bytes2).digest();
|
|
52586
52594
|
}
|
|
52587
52595
|
var md5_default2;
|
|
52588
52596
|
var init_md52 = __esm({
|
|
@@ -52689,14 +52697,14 @@ var init_v42 = __esm({
|
|
|
52689
52697
|
});
|
|
52690
52698
|
|
|
52691
52699
|
// node_modules/rpc-websockets/node_modules/uuid/dist-node/sha1.js
|
|
52692
|
-
import { createHash as
|
|
52700
|
+
import { createHash as createHash14 } from "node:crypto";
|
|
52693
52701
|
function sha12(bytes2) {
|
|
52694
52702
|
if (Array.isArray(bytes2)) {
|
|
52695
52703
|
bytes2 = Buffer.from(bytes2);
|
|
52696
52704
|
} else if (typeof bytes2 === "string") {
|
|
52697
52705
|
bytes2 = Buffer.from(bytes2, "utf8");
|
|
52698
52706
|
}
|
|
52699
|
-
return
|
|
52707
|
+
return createHash14("sha1").update(bytes2).digest();
|
|
52700
52708
|
}
|
|
52701
52709
|
var sha1_default2;
|
|
52702
52710
|
var init_sha12 = __esm({
|
|
@@ -74767,6 +74775,7 @@ var import_picocolors13 = __toESM(require_picocolors(), 1);
|
|
|
74767
74775
|
init_passwords_wire();
|
|
74768
74776
|
|
|
74769
74777
|
// src/lib/sandbox-client.ts
|
|
74778
|
+
import { createHash as createHash9 } from "node:crypto";
|
|
74770
74779
|
import { createInterface as createInterface5 } from "node:readline/promises";
|
|
74771
74780
|
init_passwords_wire();
|
|
74772
74781
|
init_passwords_wire();
|
|
@@ -74883,6 +74892,9 @@ function machinesOf(answer) {
|
|
|
74883
74892
|
if (Array.isArray(a?.deployments)) return a.deployments;
|
|
74884
74893
|
return answer && typeof answer === "object" ? [answer] : [];
|
|
74885
74894
|
}
|
|
74895
|
+
function recordSigner(rec) {
|
|
74896
|
+
return rec?.paidByKey ?? rec?.openers?.signers.find((s) => s.kind === "apiKey")?.address ?? null;
|
|
74897
|
+
}
|
|
74886
74898
|
function pendingIdOf(accessKeyHash) {
|
|
74887
74899
|
return `pending-${accessKeyHash.slice(0, 40)}`;
|
|
74888
74900
|
}
|
|
@@ -74935,6 +74947,7 @@ function cpSide(arg) {
|
|
|
74935
74947
|
|
|
74936
74948
|
// src/lib/sandbox-client.ts
|
|
74937
74949
|
init_sandbox_door();
|
|
74950
|
+
init_sandbox_proof();
|
|
74938
74951
|
|
|
74939
74952
|
// src/lib/signing-key.ts
|
|
74940
74953
|
import { promises as fs10 } from "node:fs";
|
|
@@ -75486,7 +75499,12 @@ async function waitForSandbox(deploymentId, auth, timeoutMs, onTick) {
|
|
|
75486
75499
|
}
|
|
75487
75500
|
}
|
|
75488
75501
|
function proofOpenersOfFound(found) {
|
|
75489
|
-
return found.openers
|
|
75502
|
+
return heldOpeners(found.openers) ? proofOpenersOf(found.openers) : null;
|
|
75503
|
+
}
|
|
75504
|
+
var heldOpeners = (o) => o?.from === "chosen" || o?.from === "attached";
|
|
75505
|
+
function readerWords(auth) {
|
|
75506
|
+
if ("wallet" in auth) return `this machine's wallet ${auth.wallet.address}`;
|
|
75507
|
+
return isSigningKey(auth.key) ? `the signing API key ${signingKeyOf(auth.key).address}` : `the compute key agc_...${auth.key.slice(-4)}`;
|
|
75490
75508
|
}
|
|
75491
75509
|
async function doorAuthOf(o, held3) {
|
|
75492
75510
|
const signers = [];
|
|
@@ -75523,31 +75541,61 @@ async function findSandbox(id2, opts = {}) {
|
|
|
75523
75541
|
} catch (err) {
|
|
75524
75542
|
walletError = err;
|
|
75525
75543
|
}
|
|
75526
|
-
const
|
|
75527
|
-
const
|
|
75528
|
-
const
|
|
75544
|
+
const keptSigner = recordSigner(rec);
|
|
75545
|
+
const givenSigner = key && isSigningKey(key) ? signingKeyOf(key).address : null;
|
|
75546
|
+
const keptKey = keptSigner && keptSigner !== givenSigner ? (await findSigningKey(keptSigner))?.secret ?? null : null;
|
|
75547
|
+
const keyFirst = rec?.paidWith === "key" || rec?.paidWith === "attached";
|
|
75548
|
+
const reads = [
|
|
75549
|
+
...key ? [{ key }] : [],
|
|
75550
|
+
...keyFirst && keptKey ? [{ key: keptKey }] : [],
|
|
75551
|
+
...wallet ? [{ wallet }] : [],
|
|
75552
|
+
...!keyFirst && keptKey ? [{ key: keptKey }] : []
|
|
75553
|
+
];
|
|
75529
75554
|
let machine = null;
|
|
75555
|
+
let foundBy = null;
|
|
75530
75556
|
const doorOnly = Boolean(rec && rec.paidWith === "attached" && SANDBOX_ID_RE.test(rec.deploymentId));
|
|
75531
75557
|
const depId = rec?.deploymentId ?? (SANDBOX_ID_RE.test(clean3) ? null : clean3);
|
|
75532
75558
|
let unread = false;
|
|
75559
|
+
let refused2 = null;
|
|
75560
|
+
const notFor = [];
|
|
75533
75561
|
if (doorOnly) {
|
|
75534
|
-
} else if (
|
|
75535
|
-
const
|
|
75536
|
-
|
|
75537
|
-
|
|
75538
|
-
|
|
75539
|
-
|
|
75540
|
-
|
|
75541
|
-
|
|
75542
|
-
|
|
75543
|
-
|
|
75544
|
-
|
|
75545
|
-
|
|
75546
|
-
|
|
75562
|
+
} else if (depId) {
|
|
75563
|
+
for (const auth of reads) {
|
|
75564
|
+
const a = await readMachine(depId, auth).catch(() => null);
|
|
75565
|
+
if (a && a.status === 200) {
|
|
75566
|
+
machine = a.json;
|
|
75567
|
+
foundBy = auth;
|
|
75568
|
+
break;
|
|
75569
|
+
}
|
|
75570
|
+
if (a && a.status === 404) notFor.push(auth);
|
|
75571
|
+
else if (a && (a.status === 401 || a.status === 403)) refused2 ??= new SandboxError(apiWords2(a), apiCode2(a), { status: a.status });
|
|
75572
|
+
else unread = true;
|
|
75573
|
+
}
|
|
75574
|
+
} else {
|
|
75575
|
+
for (const auth of reads) {
|
|
75576
|
+
let all;
|
|
75577
|
+
try {
|
|
75578
|
+
all = await listMachines(auth);
|
|
75579
|
+
} catch (err) {
|
|
75580
|
+
const status5 = err instanceof SandboxError ? err.detail.status : void 0;
|
|
75581
|
+
if (status5 === 401 || status5 === 403) refused2 ??= err;
|
|
75582
|
+
else unread = true;
|
|
75583
|
+
continue;
|
|
75584
|
+
}
|
|
75585
|
+
const m = all.find((x) => sandboxOf(x)?.id === clean3);
|
|
75586
|
+
if (m) {
|
|
75587
|
+
machine = m;
|
|
75588
|
+
foundBy = auth;
|
|
75589
|
+
break;
|
|
75590
|
+
}
|
|
75591
|
+
notFor.push(auth);
|
|
75592
|
+
}
|
|
75547
75593
|
}
|
|
75548
75594
|
if (!machine && !rec) {
|
|
75595
|
+
if (reads.length === 0) throw walletError instanceof Error ? walletError : new SandboxError("no account on this machine to read it with", "no_account");
|
|
75549
75596
|
if (unread) throw new SandboxError("the compute API did not answer, and this machine keeps no record of that sandbox", "unreachable");
|
|
75550
|
-
|
|
75597
|
+
if (refused2) throw refused2;
|
|
75598
|
+
throw new SandboxError(`no sandbox ${clean3} here or for ${notFor.map(readerWords).join(" or ")} (agentgates sandbox ls shows yours)`, "not_found", { status: 404 });
|
|
75551
75599
|
}
|
|
75552
75600
|
const sb = machine ? sandboxOf(machine) : null;
|
|
75553
75601
|
const api2 = sb?.api ?? rec?.api ?? null;
|
|
@@ -75564,11 +75612,12 @@ async function findSandbox(id2, opts = {}) {
|
|
|
75564
75612
|
}
|
|
75565
75613
|
if (rec && (rec.api !== api2 || rec.tlsPin !== tlsPin || rec.sandboxId !== sandboxId)) await writeRecord({ ...rec, api: api2, tlsPin, sandboxId });
|
|
75566
75614
|
let record = rec;
|
|
75567
|
-
|
|
75615
|
+
const byWallet = Boolean(machine && foundBy && "wallet" in foundBy);
|
|
75616
|
+
if (!record && machine && byWallet && wallet) {
|
|
75568
75617
|
record = { v: 1, deploymentId, plan: typeof machine.plan === "string" ? machine.plan : null, sandboxId, api: api2, tlsPin, owner: wallet.address, accessKey: null, paidWith: "x402", createdAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
75569
75618
|
await writeRecord(record).catch(() => void 0);
|
|
75570
75619
|
}
|
|
75571
|
-
const owner = rec?.owner ?? (machine &&
|
|
75620
|
+
const owner = rec?.owner ?? (byWallet && wallet ? wallet.address : null) ?? (machine && foundBy && "key" in foundBy ? await accountOfKey(foundBy.key).catch(() => null) : null);
|
|
75572
75621
|
const openers = record?.openers ?? (machine ? openersOfWire(machine, owner) : null);
|
|
75573
75622
|
let doorAuth = null;
|
|
75574
75623
|
let authError = null;
|
|
@@ -75580,6 +75629,7 @@ async function findSandbox(id2, opts = {}) {
|
|
|
75580
75629
|
authError = err;
|
|
75581
75630
|
}
|
|
75582
75631
|
} else if (rec?.accessKey) doorAuth = { kind: "key", secret: rec.accessKey };
|
|
75632
|
+
else if (foundBy && "key" in foundBy && isSigningKey(foundBy.key)) doorAuth = { kind: "wallet", signer: signingSigner(signingKeyOf(foundBy.key)), as: "the signing API key" };
|
|
75583
75633
|
else if (wallet) doorAuth = { kind: "wallet", signer: walletSigner(wallet) };
|
|
75584
75634
|
else if (key && isSigningKey(key)) doorAuth = { kind: "wallet", signer: signingSigner(signingKeyOf(key)), as: "the signing API key" };
|
|
75585
75635
|
else throw new SandboxError("no key on this machine opens that sandbox's door", "no_account");
|
|
@@ -75589,47 +75639,142 @@ async function findSandbox(id2, opts = {}) {
|
|
|
75589
75639
|
var ATTACHED_OWNER_WORDS = "the owner check did not run: this sandbox was attached here from its address, pin and access key, and this CLI does not know the wallet that bought it";
|
|
75590
75640
|
var ATTACHED_DELETE_WORDS = "a sandbox attached here is deleted by the wallet that bought it (agentgates.ai/sandboxes, Delete): its access key opens its door, not our API";
|
|
75591
75641
|
var ACCESS_KEY_RE = /^sbxk_[0-9a-f]{64}$/;
|
|
75642
|
+
var sha256Hex = (text) => createHash9("sha256").update(text, "utf8").digest("hex");
|
|
75643
|
+
function doorOpensOf(view) {
|
|
75644
|
+
const o = view?.opens;
|
|
75645
|
+
if (!o || o.rule !== "any" && o.rule !== "all" || !Array.isArray(o.signers) || o.signers.some((s) => typeof s !== "string") || !Number.isInteger(o.passwords) || Number(o.passwords) < 0 || Number(o.passwords) > 1) return null;
|
|
75646
|
+
return { rule: o.rule, signers: o.signers.map(addressKey), passwords: Number(o.passwords) };
|
|
75647
|
+
}
|
|
75648
|
+
function doorOpensHold(sandboxId, named, opens) {
|
|
75649
|
+
const hashes = named.signers.map((a) => opensOf(sandboxId, { signers: [a], passwords: [], rule: "any" }).with[0]);
|
|
75650
|
+
return named.rule === opens.rule && hashes.length + named.passwords === opens.with.length && new Set(hashes).size === hashes.length && hashes.every((h) => opens.with.includes(h));
|
|
75651
|
+
}
|
|
75652
|
+
function signerKinds(signers, known) {
|
|
75653
|
+
const kinds = signers.map((a) => known.keys.includes(a) ? "apiKey" : known.wallets.includes(a) ? "wallet" : null);
|
|
75654
|
+
const out = [];
|
|
75655
|
+
for (const k of kinds) out.push(k ?? (out.includes("wallet") || kinds.includes("wallet") ? "apiKey" : "wallet"));
|
|
75656
|
+
return out;
|
|
75657
|
+
}
|
|
75592
75658
|
async function attachSandbox(args) {
|
|
75593
|
-
|
|
75594
|
-
if (!ACCESS_KEY_RE.test(accessKey)) throw new SandboxError("the access key is sbxk_ and 64 hex characters, as agentgates.ai/sandboxes showed it once", "bad_input");
|
|
75659
|
+
let accessKey = String(args.accessKey ?? "").trim() || null;
|
|
75660
|
+
if (accessKey && !ACCESS_KEY_RE.test(accessKey)) throw new SandboxError("the access key is sbxk_ and 64 hex characters, as agentgates.ai/sandboxes showed it once", "bad_input");
|
|
75661
|
+
const keyText = String(args.key ?? "").trim() || null;
|
|
75662
|
+
if (keyText && /^agc_/.test(keyText)) throw new SandboxError("a bearer key (agc_) opens no sandbox: --key takes the signing API key that opens it, ags_ and 64 hex characters", "bad_input");
|
|
75663
|
+
if (keyText && !SIGNING_SECRET_RE.test(keyText)) throw new SandboxError("--key is the signing API key that opens it, ags_ and 64 hex characters, as agentgates.ai showed it once", "bad_input");
|
|
75664
|
+
if (!accessKey && !keyText) throw new SandboxError("what opens it: its access key (--access-key, AGENTGATES_SANDBOX_ACCESS_KEY or piped on stdin), its signing API key (--key ags_...), or both", "bad_input");
|
|
75665
|
+
const signing = keyText ? signingKeyOf(keyText) : null;
|
|
75595
75666
|
const tlsPin = String(args.tlsPin ?? "").trim();
|
|
75596
75667
|
const api2 = String(args.api ?? "").trim().replace(/\/+$/, "");
|
|
75597
75668
|
const sandboxId = /\/v1\/sandboxes\/(sbx_[0-9a-f]{16})$/.exec(api2)?.[1] ?? null;
|
|
75598
75669
|
if (!sandboxId) throw new SandboxError(`"${args.api}" is not a sandbox's address (https://<host>/v1/sandboxes/sbx_...)`, "bad_address");
|
|
75599
|
-
const
|
|
75600
|
-
if (!/^[A-Za-z0-9_-]{1,64}$/.test(
|
|
75601
|
-
|
|
75602
|
-
|
|
75603
|
-
|
|
75604
|
-
|
|
75605
|
-
|
|
75606
|
-
|
|
75607
|
-
|
|
75608
|
-
|
|
75609
|
-
|
|
75610
|
-
machine: null,
|
|
75611
|
-
openers: null
|
|
75670
|
+
const givenId = args.deploymentId ? String(args.deploymentId).trim() : null;
|
|
75671
|
+
if (givenId !== null && !/^[A-Za-z0-9_-]{1,64}$/.test(givenId)) throw new SandboxError(`"${args.deploymentId}" is not a deployment id`, "bad_input");
|
|
75672
|
+
let wallet = null;
|
|
75673
|
+
try {
|
|
75674
|
+
wallet = await payingWallet();
|
|
75675
|
+
} catch {
|
|
75676
|
+
wallet = null;
|
|
75677
|
+
}
|
|
75678
|
+
const doorErr = (err) => {
|
|
75679
|
+
if (err instanceof DoorError) throw new SandboxError(err.message, err.code, { status: err.status });
|
|
75680
|
+
throw err;
|
|
75612
75681
|
};
|
|
75613
75682
|
let door;
|
|
75683
|
+
let verdict;
|
|
75614
75684
|
try {
|
|
75615
|
-
door =
|
|
75685
|
+
door = new SandboxDoor({ api: api2, tlsPin, sandboxId, auth: null, owner: null, ownerUnchecked: ATTACHED_OWNER_WORDS, openers: null, siteOrigin: siteOrigin() });
|
|
75686
|
+
verdict = await door.verify();
|
|
75616
75687
|
} catch (err) {
|
|
75617
|
-
|
|
75618
|
-
|
|
75688
|
+
return doorErr(err);
|
|
75689
|
+
}
|
|
75690
|
+
if (!verdict.ok || !verdict.statement) throw new SandboxError(`its proof did not check, so nothing was sent to it: ${verdict.checks.filter((c) => c.ok !== true).map((c) => `${c.id}: ${c.line}`).join("; ")}`, "proof_failed", { checks: verdict.checks });
|
|
75691
|
+
const st = verdict.statement;
|
|
75692
|
+
const opens = st.opens ?? null;
|
|
75693
|
+
const signerHash = (address) => opensOf(sandboxId, { signers: [address], passwords: [], rule: "any" }).with[0];
|
|
75694
|
+
const passwordHashed = (hash2) => opensOf(sandboxId, { signers: [], passwords: [hash2], rule: "any" }).with[0];
|
|
75695
|
+
let auth;
|
|
75696
|
+
const held3 = { password: accessKey, key: signing, wallet: null };
|
|
75697
|
+
if (opens) {
|
|
75698
|
+
if (signing && !opens.with.includes(signerHash(signing.address))) throw new SandboxError(`that signing API key does not open this sandbox's door: nothing was kept`, "wrong_key");
|
|
75699
|
+
if (wallet && opens.with.includes(signerHash(wallet.address))) held3.wallet = wallet;
|
|
75700
|
+
if (!accessKey && args.readAccessKey && opens.rule === "all" && (held3.key ? 1 : 0) + (held3.wallet ? 1 : 0) + 1 === opens.with.length) {
|
|
75701
|
+
const read = (await args.readAccessKey()).trim().split(/\s+/)[0] ?? "";
|
|
75702
|
+
if (read && !ACCESS_KEY_RE.test(read)) throw new SandboxError("the access key is sbxk_ and 64 hex characters, as agentgates.ai/sandboxes showed it once", "bad_input");
|
|
75703
|
+
accessKey = read || null;
|
|
75704
|
+
held3.password = accessKey;
|
|
75705
|
+
}
|
|
75706
|
+
if (accessKey && !opens.with.includes(passwordHashed(sha256Hex(accessKey)))) throw new SandboxError(`that access key does not open this sandbox's door: nothing was kept`, "wrong_key");
|
|
75707
|
+
const count = (held3.password ? 1 : 0) + (held3.key ? 1 : 0) + (held3.wallet ? 1 : 0);
|
|
75708
|
+
if (opens.rule === "all" && count < opens.with.length) {
|
|
75709
|
+
const holds = [held3.password ? "the access key" : null, held3.key ? "the signing API key" : null, held3.wallet ? "this machine's wallet" : null].filter(Boolean).join(" and ");
|
|
75710
|
+
throw new SandboxError(`it opens only with its ${opens.with.length} openers together, on each call, and this machine holds ${count} of them (${holds}): nothing was kept`, "cannot_open_here");
|
|
75711
|
+
}
|
|
75712
|
+
const signers = [
|
|
75713
|
+
...held3.wallet ? [{ signer: walletSigner(held3.wallet), as: "the wallet" }] : [],
|
|
75714
|
+
...held3.key ? [{ signer: signingSigner(held3.key), as: "the signing API key" }] : []
|
|
75715
|
+
];
|
|
75716
|
+
auth = opens.rule === "all" ? { kind: "all", signers, password: held3.password } : held3.password ? { kind: "key", secret: held3.password } : { kind: "wallet", signer: signers[signers.length - 1].signer, as: signers[signers.length - 1].as };
|
|
75717
|
+
} else {
|
|
75718
|
+
auth = accessKey ? { kind: "key", secret: accessKey } : { kind: "wallet", signer: signingSigner(signing), as: "the signing API key" };
|
|
75619
75719
|
}
|
|
75720
|
+
const sent = auth.kind === "key" ? "the access key" : auth.kind === "wallet" ? auth.as === "the wallet" ? "this machine's wallet" : String(auth.as) : [...auth.signers.map((s) => s.as === "the wallet" ? "this machine's wallet" : s.as), ...auth.password ? ["the access key"] : []].join(" and ");
|
|
75721
|
+
door.setAuth(auth);
|
|
75620
75722
|
let view;
|
|
75621
75723
|
try {
|
|
75622
|
-
view = await door.
|
|
75724
|
+
view = await door.read();
|
|
75623
75725
|
} catch (err) {
|
|
75624
75726
|
const e = err;
|
|
75625
|
-
if (e.status === 401 || e.status === 403) throw new SandboxError("that access key does not open this sandbox's door: nothing was kept"
|
|
75626
|
-
|
|
75627
|
-
throw err;
|
|
75727
|
+
if (e.status === 401 || e.status === 403) throw new SandboxError(auth.kind === "key" ? "that access key does not open this sandbox's door: nothing was kept" : `${err.message}: nothing was kept`, "wrong_key", { status: e.status });
|
|
75728
|
+
return doorErr(err);
|
|
75628
75729
|
}
|
|
75629
|
-
const
|
|
75630
|
-
|
|
75730
|
+
const named = doorOpensOf(view);
|
|
75731
|
+
if (opens && named && !doorOpensHold(sandboxId, named, opens)) throw new SandboxError("its door's own read names other openers than its statement: nothing was kept", "proof_failed");
|
|
75732
|
+
let machine = null;
|
|
75733
|
+
let owner = null;
|
|
75734
|
+
if (signing) {
|
|
75735
|
+
try {
|
|
75736
|
+
if (givenId && !SANDBOX_ID_RE.test(givenId)) {
|
|
75737
|
+
const a = await readMachine(givenId, { key: signing.secret });
|
|
75738
|
+
machine = a.status === 200 ? a.json : null;
|
|
75739
|
+
} else {
|
|
75740
|
+
machine = (await listMachines({ key: signing.secret })).find((m) => sandboxOf(m)?.id === sandboxId) ?? null;
|
|
75741
|
+
}
|
|
75742
|
+
} catch {
|
|
75743
|
+
machine = null;
|
|
75744
|
+
}
|
|
75745
|
+
if (machine && sandboxOf(machine)?.id !== sandboxId) throw new SandboxError(`${givenId} is the deployment of ${sandboxOf(machine)?.id ?? "no sandbox"}, not of ${sandboxId}: nothing was kept`, "bad_input");
|
|
75746
|
+
if (machine) {
|
|
75747
|
+
owner = await accountOfKey(signing.secret).catch(() => null);
|
|
75748
|
+
if (owner && ownerHashOf(owner) !== st.ownerHash) throw new SandboxError("its statement names another owner than the signing API key's account: nothing was kept", "proof_failed");
|
|
75749
|
+
}
|
|
75750
|
+
}
|
|
75751
|
+
const deploymentId = givenId ?? (typeof machine?.deploymentId === "string" && machine.deploymentId ? machine.deploymentId : sandboxId);
|
|
75752
|
+
let openers = null;
|
|
75753
|
+
let openersNote = null;
|
|
75754
|
+
if (named) {
|
|
75755
|
+
const kinds = signerKinds(named.signers, { keys: signing ? [signing.address] : [], wallets: [wallet ? addressKey(wallet.address) : null, owner].filter((x) => Boolean(x)) });
|
|
75756
|
+
const rowHash = typeof machine?.accessKeyHash === "string" && /^[0-9a-f]{64}$/.test(machine.accessKeyHash) ? machine.accessKeyHash : null;
|
|
75757
|
+
const passwordHash = named.passwords === 0 ? null : accessKey ? sha256Hex(accessKey) : rowHash && (!opens || opens.with.includes(passwordHashed(rowHash))) ? rowHash : null;
|
|
75758
|
+
const known = named.passwords === 0 || passwordHash !== null;
|
|
75759
|
+
const withKinds = OPENER_KINDS.filter((k) => k === "password" ? named.passwords > 0 : kinds.includes(k));
|
|
75760
|
+
openers = { with: withKinds, rule: named.rule, signers: named.signers.map((address, i) => ({ kind: kinds[i], address })), passwordHash, from: known ? "attached" : "api" };
|
|
75761
|
+
const said = machine ? openersOfWire(machine, owner) : null;
|
|
75762
|
+
if (said && !sameOpeners(said, openers)) openersNote = `our API's row says it opens with ${opensWords(said)}, its own door ${opensWords(openers)}: held to its door's`;
|
|
75763
|
+
}
|
|
75764
|
+
const keptRec = await findRecord(deploymentId) ?? await findRecord(sandboxId);
|
|
75765
|
+
if (signing) await keepGivenKey(signing, owner);
|
|
75766
|
+
const record = keptRec ? { ...keptRec, sandboxId, api: api2, tlsPin, accessKey: accessKey ?? keptRec.accessKey, owner: keptRec.owner ?? owner, openers: keptRec.openers?.from === "chosen" ? keptRec.openers : openers ?? keptRec.openers ?? null } : { v: 1, deploymentId, plan: typeof machine?.plan === "string" ? machine.plan : null, sandboxId, api: api2, tlsPin, owner, accessKey, paidWith: "attached", createdAt: (/* @__PURE__ */ new Date()).toISOString(), openers };
|
|
75631
75767
|
await writeRecord(record);
|
|
75632
|
-
|
|
75768
|
+
const shown2 = record.openers;
|
|
75769
|
+
const opensOut = shown2 ? {
|
|
75770
|
+
with: [...shown2.with],
|
|
75771
|
+
rule: shown2.rule,
|
|
75772
|
+
words: opensWords(shown2),
|
|
75773
|
+
signers: shown2.signers.map((s) => ({ ...s, here: s.kind === "apiKey" && s.address === signing?.address || s.kind === "wallet" && Boolean(held3.wallet) && s.address === addressKey(held3.wallet.address) })),
|
|
75774
|
+
password: shown2.with.includes("password") ? { here: Boolean(accessKey) } : null,
|
|
75775
|
+
held: heldOpeners(shown2)
|
|
75776
|
+
} : null;
|
|
75777
|
+
return { record, verdict, view, opens: opensOut, sent, openersNote };
|
|
75633
75778
|
}
|
|
75634
75779
|
function canOf(rec, deploymentId) {
|
|
75635
75780
|
const known = Boolean(deploymentId && !SANDBOX_ID_RE.test(deploymentId));
|
|
@@ -76806,27 +76951,42 @@ function firstLineOf(stream, ms) {
|
|
|
76806
76951
|
async function sandboxAttach(address, opts) {
|
|
76807
76952
|
if (!opts.pin) return failWith(opts, new SandboxError("--pin is the sandbox's pin, sha256//..., as agentgates.ai/sandboxes shows it", "bad_input"));
|
|
76808
76953
|
let accessKey = opts.accessKey ?? process.env.AGENTGATES_SANDBOX_ACCESS_KEY ?? "";
|
|
76809
|
-
|
|
76810
|
-
if (!accessKey
|
|
76954
|
+
const piped = !process.stdin.isTTY ? () => firstLineOf(process.stdin, STDIN_KEY_MS) : void 0;
|
|
76955
|
+
if (!accessKey && !opts.key && piped) accessKey = (await piped()).trim().split(/\s+/)[0] ?? "";
|
|
76956
|
+
if (!accessKey && !opts.key) return failWith(opts, new SandboxError("what opens it: its access key (--access-key, AGENTGATES_SANDBOX_ACCESS_KEY, or piped on stdin), its signing API key (--key ags_...), or both", "bad_input"));
|
|
76811
76957
|
let out;
|
|
76812
76958
|
try {
|
|
76813
|
-
out = await attachSandbox({ api: address, tlsPin: opts.pin, accessKey, deploymentId: opts.id ?? null });
|
|
76959
|
+
out = await attachSandbox({ api: address, tlsPin: opts.pin, accessKey: accessKey || null, key: opts.key ?? null, deploymentId: opts.id ?? null, ...!accessKey && piped ? { readAccessKey: piped } : {} });
|
|
76814
76960
|
} catch (err) {
|
|
76815
76961
|
return failWith(opts, err);
|
|
76816
76962
|
}
|
|
76817
76963
|
const r = out.record;
|
|
76964
|
+
const ownerCheck = r.owner ? null : ATTACHED_OWNER_WORDS;
|
|
76818
76965
|
if (jsonMode8(opts)) {
|
|
76819
|
-
say4(JSON.stringify({ ok: true, attached: { deploymentId: r.deploymentId, sandbox: { id: r.sandboxId, api: r.api, tlsPin: r.tlsPin } }, proof: "checked", ownerCheck:
|
|
76966
|
+
say4(JSON.stringify({ ok: true, attached: { deploymentId: r.deploymentId, sandbox: { id: r.sandboxId, api: r.api, tlsPin: r.tlsPin } }, proof: "checked", ...out.opens ? { opens: out.opens } : {}, ...out.openersNote ? { openersNote: out.openersNote } : {}, ...ownerCheck ? { ownerCheck } : {}, door: out.view, delete: ATTACHED_DELETE_WORDS }, null, 2) + "\n");
|
|
76820
76967
|
return;
|
|
76821
76968
|
}
|
|
76822
|
-
say4(` ${import_picocolors14.default.green("ok")} ${r.sandboxId} attached: its proof checked and its door opened with
|
|
76969
|
+
say4(` ${import_picocolors14.default.green("ok")} ${r.sandboxId} attached: its proof checked and its door opened with ${out.sent}
|
|
76970
|
+
`);
|
|
76971
|
+
if (out.opens) say4(` ${import_picocolors14.default.dim(`it opens with ${attachedOpensWords(out.opens)}`)}
|
|
76972
|
+
`);
|
|
76973
|
+
if (out.openersNote) say4(` ${import_picocolors14.default.yellow("!")} ${out.openersNote}
|
|
76823
76974
|
`);
|
|
76824
|
-
say4(` ${import_picocolors14.default.dim(`exec, cp, verify, logs and status reach it from here: agentgates sandbox exec ${r.
|
|
76975
|
+
say4(` ${import_picocolors14.default.dim(`exec, cp, verify, logs and status reach it from here: agentgates sandbox exec ${r.deploymentId} -- <command>`)}
|
|
76825
76976
|
`);
|
|
76826
76977
|
say4(` ${import_picocolors14.default.dim(ATTACHED_DELETE_WORDS)}
|
|
76827
76978
|
|
|
76828
76979
|
`);
|
|
76829
76980
|
}
|
|
76981
|
+
function attachedOpensWords(o) {
|
|
76982
|
+
const names2 = [
|
|
76983
|
+
...o.signers.map((s) => `${s.kind === "apiKey" ? "the signing API key" : "the wallet"} ${s.address}${s.here ? " (held here)" : ""}`),
|
|
76984
|
+
...o.password ? [`the access key${o.password.here ? " (held here)" : ""}`] : []
|
|
76985
|
+
];
|
|
76986
|
+
if (names2.length <= 1) return names2[0] ?? "nothing";
|
|
76987
|
+
const list = `${names2.slice(0, -1).join(", ")} ${o.rule === "all" ? "and" : "or"} ${names2[names2.length - 1]}`;
|
|
76988
|
+
return o.rule === "all" ? `${list}, together on each call` : list;
|
|
76989
|
+
}
|
|
76830
76990
|
async function sandboxStatus(id2, opts) {
|
|
76831
76991
|
let found;
|
|
76832
76992
|
try {
|
|
@@ -76856,7 +77016,7 @@ async function sandboxStatus(id2, opts) {
|
|
|
76856
77016
|
if (!doorView) process.exitCode = 1;
|
|
76857
77017
|
if (jsonMode8(opts)) {
|
|
76858
77018
|
const payments = Array.isArray(found.machine?.invoices) ? found.machine.invoices : [];
|
|
76859
|
-
say4(JSON.stringify({ ok: Boolean(doorView), status: status4, deployment: found.machine, sandbox: { id: found.sandboxId, api: found.api, tlsPin: found.tlsPin }, payments, proof: doorView ? "checked" : "not checked", ...found.openers ? { opens: { with: found.openers.with, rule: found.openers.rule, chosenHere: found.openers.from === "chosen", statement: doorView && found.openers
|
|
77019
|
+
say4(JSON.stringify({ ok: Boolean(doorView), status: status4, deployment: found.machine, sandbox: { id: found.sandboxId, api: found.api, tlsPin: found.tlsPin }, payments, proof: doorView ? "checked" : "not checked", ...found.openers ? { opens: { with: found.openers.with, rule: found.openers.rule, chosenHere: found.openers.from === "chosen", statement: doorView && heldOpeners(found.openers) ? "names exactly these" : "not checked" } } : {}, ...found.ownerUnchecked ? { ownerCheck: found.ownerUnchecked } : {}, can, door: doorView, ...doorError ? { doorError } : {} }, null, 2) + "\n");
|
|
76860
77020
|
return;
|
|
76861
77021
|
}
|
|
76862
77022
|
say4(`
|
|
@@ -76869,7 +77029,7 @@ ${sandboxLines({ deploymentId: found.deploymentId, status: status4, plan: m?.pla
|
|
|
76869
77029
|
for (const inv of invoices) say4(` ${import_picocolors14.default.dim(paymentLine(inv))}
|
|
76870
77030
|
`);
|
|
76871
77031
|
}
|
|
76872
|
-
if (found.openers) say4(` opens ${opensWords(found.openers)}${found.openers
|
|
77032
|
+
if (found.openers) say4(` opens ${opensWords(found.openers)}${heldOpeners(found.openers) ? doorView ? import_picocolors14.default.dim(" (its proof names exactly these)") : "" : import_picocolors14.default.dim(" (as our API says it; not chosen here)")}
|
|
76873
77033
|
`);
|
|
76874
77034
|
if (doorView) {
|
|
76875
77035
|
say4(` proof ${import_picocolors14.default.green("checked")} ${import_picocolors14.default.dim("(4 checks, your own nonce; agentgates sandbox verify shows each)")}
|
|
@@ -77780,7 +77940,7 @@ async function readStdin() {
|
|
|
77780
77940
|
|
|
77781
77941
|
// src/commands/files.ts
|
|
77782
77942
|
var import_picocolors16 = __toESM(require_picocolors(), 1);
|
|
77783
|
-
import { createHash as
|
|
77943
|
+
import { createHash as createHash10 } from "node:crypto";
|
|
77784
77944
|
import { open as open2, rename, rm, stat } from "node:fs/promises";
|
|
77785
77945
|
import { basename as basename2, extname, resolve as resolve3 } from "node:path";
|
|
77786
77946
|
|
|
@@ -78182,7 +78342,7 @@ async function getFile(wallet, key, file, out) {
|
|
|
78182
78342
|
const res = await fetch(url);
|
|
78183
78343
|
if (!res.ok || !res.body) throw new MemoryError(`storage did not hand the file back (HTTP ${res.status})`, "read_failed");
|
|
78184
78344
|
const opener = new FileOpener(file.header, (i, last) => memoryBlockAad(key.address, file.id, i, last));
|
|
78185
|
-
const hash2 =
|
|
78345
|
+
const hash2 = createHash10("sha256");
|
|
78186
78346
|
const partial = `${out}.part-${process.pid}`;
|
|
78187
78347
|
const fh = await open2(partial, "w");
|
|
78188
78348
|
let written = 0;
|
|
@@ -81008,7 +81168,7 @@ async function intentsNoShow(askId, opts) {
|
|
|
81008
81168
|
|
|
81009
81169
|
// src/commands/integrations.ts
|
|
81010
81170
|
var import_picocolors20 = __toESM(require_picocolors(), 1);
|
|
81011
|
-
import { createHash as
|
|
81171
|
+
import { createHash as createHash11, randomBytes as randomBytes13 } from "node:crypto";
|
|
81012
81172
|
init_passwords_wire();
|
|
81013
81173
|
init_terminal_text();
|
|
81014
81174
|
function emit10(opts, data4, human) {
|
|
@@ -81330,7 +81490,7 @@ async function sitesFix(changeId, opts) {
|
|
|
81330
81490
|
const read = expectOk(await signedFetch(wallet, "GET", lanePath(`/sites/changes/${changeId}`)), "sites change");
|
|
81331
81491
|
if (read.change?.state !== "failed" || read.change.code !== "ship_check_failed") throw new Error(`the change is ${read.change?.state ?? "unread"}: only a change the live check stopped is fixed`);
|
|
81332
81492
|
const body = { appId: read.change.appId, id: randomBytes13(16).toString("base64url") };
|
|
81333
|
-
const digest =
|
|
81493
|
+
const digest = createHash11("sha256").update(JSON.stringify(body), "utf8").digest("base64url");
|
|
81334
81494
|
const out = expectOk(await signedFetch(wallet, "POST", lanePath(`/sites/changes/${changeId}/fix/${digest}`), body), "sites fix");
|
|
81335
81495
|
emit10(opts, { ok: true, change: out.change }, () => {
|
|
81336
81496
|
process.stdout.write(`
|
|
@@ -81424,7 +81584,7 @@ init_passwords_wire();
|
|
|
81424
81584
|
|
|
81425
81585
|
// src/lib/ag-wire.ts
|
|
81426
81586
|
init_constants();
|
|
81427
|
-
import { createHash as
|
|
81587
|
+
import { createHash as createHash12 } from "node:crypto";
|
|
81428
81588
|
|
|
81429
81589
|
// src/lib/conversation-seal.ts
|
|
81430
81590
|
var CONVERSATION_SUITE = "AGENTGATES-CONVERSATION-v1";
|
|
@@ -81475,7 +81635,7 @@ function agMemoryKeyAad(ownerWallet, keyId) {
|
|
|
81475
81635
|
return `${AG_SEAL_SUITE}|memory-key|${normalizeAgOwner(ownerWallet)}|${keyId}`;
|
|
81476
81636
|
}
|
|
81477
81637
|
function fleetBindingReportData(publicKey) {
|
|
81478
|
-
return
|
|
81638
|
+
return createHash12("sha512").update(Buffer.from(AG_REPORT_DATA_LABEL, "utf8")).update(Buffer.from(fromB64u2(publicKey))).digest("hex");
|
|
81479
81639
|
}
|
|
81480
81640
|
function parseAgAttestation(raw) {
|
|
81481
81641
|
const a = raw && typeof raw === "object" ? raw : null;
|
|
@@ -81522,7 +81682,7 @@ function verifyAgFleetAttestation(body, opts) {
|
|
|
81522
81682
|
now: opts.now
|
|
81523
81683
|
});
|
|
81524
81684
|
if (!proof.ok) return proof;
|
|
81525
|
-
if (att.keyId !==
|
|
81685
|
+
if (att.keyId !== createHash12("sha256").update(fromB64u2(att.publicKey)).digest("base64url")) {
|
|
81526
81686
|
return { ok: false, reason: "the served key id is not the hash of the served key" };
|
|
81527
81687
|
}
|
|
81528
81688
|
return { ok: true, value: att };
|
|
@@ -87463,7 +87623,7 @@ sandbox.command("status <id>").description("One sandbox: its state, address, end
|
|
|
87463
87623
|
sandbox.command("renew <id>").description("Add paid minutes to its end. Any wallet may pay over x402; the owner may draw its balance.").option("--minutes <n>", "whole minutes to add").option("--hours <n>", "whole hours in place of --minutes").option("--from-balance", "draw this key's prepaid balance (priced first, held to --max-usd)").option("--key <key>", "draw a compute key's account balance (priced first, held to --max-usd): agc_... or ags_...").option("--network <name>", "pay on this network only").option("--max-usd <dollars>", "refuse to pay or draw above this price").option("--quote", "print the price and stop: nothing is paid or drawn").option("--yes", "pay without the prompt (with --max-usd)").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (id2, opts) => {
|
|
87464
87624
|
await sandboxRenew(id2, opts);
|
|
87465
87625
|
});
|
|
87466
|
-
sandbox.command("attach <address>").description("Keep a sandbox bought on agentgates.ai here, from what its page showed once: its address, its pin and its access key. Its proof is checked and its door opened first; then exec, cp, verify, logs and status reach it. A delete still takes the wallet that bought it.").option("--pin <pin>", "its pin, sha256//..., as the page shows it").option("--access-key <key>", "its access key, sbxk_... (or AGENTGATES_SANDBOX_ACCESS_KEY, or piped on stdin)").option("--id <deployment-id>", "its deployment id, when you have it").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (address, opts) => {
|
|
87626
|
+
sandbox.command("attach <address>").description("Keep a sandbox bought on agentgates.ai here, from what its page showed once: its address, its pin, and what opens it (its access key, its signing API key, or both). Its proof is checked, each one given must be among its openers, and its door is opened first; then exec, cp, verify, logs and status reach it. A delete still takes the wallet that bought it.").option("--pin <pin>", "its pin, sha256//..., as the page shows it").option("--access-key <key>", "its access key (its password), sbxk_... (or AGENTGATES_SANDBOX_ACCESS_KEY, or piped on stdin)").option("--key <key>", "its signing API key, ags_...: it signs at its door, is kept here (0600) and never sent").option("--id <deployment-id>", "its deployment id, when you have it").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (address, opts) => {
|
|
87467
87627
|
await sandboxAttach(address, opts);
|
|
87468
87628
|
});
|
|
87469
87629
|
sandbox.command("rm <id>").description("Delete it now: it ends with its disk, and its unused minutes are not refunded. Signed by the owner's key. On a pending id (a purchase's kept access key, no sandbox found yet), drops that key.").option("--yes", "drop a pending id's kept access key without asking").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (id2, opts) => {
|