@chibitek/chibi 0.1.185 → 0.1.188
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/assets/{abnfDiagram-O67JEVCF-CVenv9f1.js → abnfDiagram-O67JEVCF-CKDXgnYw.js} +1 -1
- package/dist/assets/{arc-CIRWjkSZ.js → arc--VPK-xet.js} +1 -1
- package/dist/assets/{architectureDiagram-NJMV4G6O-DmIpOaYd.js → architectureDiagram-NJMV4G6O-DSVjpq7n.js} +1 -1
- package/dist/assets/{blockDiagram-BEXU5L5S-BYhb8Ycm.js → blockDiagram-BEXU5L5S-BiQ1JgSl.js} +1 -1
- package/dist/assets/{c4Diagram-YGBWAQC7-B9rBcCno.js → c4Diagram-YGBWAQC7-kWWEc-NZ.js} +1 -1
- package/dist/assets/channel-CQdxuHwI.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-CV6TX9gt.js → chunk-2Q5K7J3B-QJYqMtWJ.js} +1 -1
- package/dist/assets/{chunk-3FUC2YCW-DiOotfQU.js → chunk-3FUC2YCW-C7oGYTZS.js} +2 -2
- package/dist/assets/{chunk-5VM5RSS4-Br5QWC-1.js → chunk-5VM5RSS4-MahQWTzh.js} +1 -1
- package/dist/assets/{chunk-GTNCS2PH-BmvI8RMK.js → chunk-GTNCS2PH-CQfOvr7l.js} +1 -1
- package/dist/assets/{chunk-GWA4HPMP-Do93bTCh.js → chunk-GWA4HPMP-b0lt02Pi.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-qIjG-mTw.js → chunk-JWPE2WC7-J1_ylbx8.js} +1 -1
- package/dist/assets/{chunk-NETBCI7D-DZFFFHT2.js → chunk-NETBCI7D-AWcL9tld.js} +1 -1
- package/dist/assets/{chunk-WEXAMYUT-qqsVaC1g.js → chunk-WEXAMYUT-DpTrAXJV.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-EI-aQ-Wn.js → chunk-XXDRQBXY-2_DCjtc9.js} +1 -1
- package/dist/assets/{classDiagram-v2-NBCMYWYE-D9D8dkAx.js → classDiagram-v2-NBCMYWYE-BBQMtHHs.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-m575JDuA.js → cose-bilkent-JH36ORCC-CmxRmDe8.js} +1 -1
- package/dist/assets/{cynefin-OW5HDTMX-BMm2bhgv.js → cynefin-OW5HDTMX-DjlothXK.js} +1 -1
- package/dist/assets/{cynefinDiagram-VND7K2PF-Dl2MlsqG.js → cynefinDiagram-VND7K2PF-D6HfzP26.js} +1 -1
- package/dist/assets/{dagre-6A5THRUB-Cw8yJ-SY.js → dagre-6A5THRUB-BtzaxY50.js} +1 -1
- package/dist/assets/{diagram-22UHCM2B-DyY0F1qK.js → diagram-22UHCM2B-DsyCiGJD.js} +1 -1
- package/dist/assets/{diagram-3UASUU5V-sMOszbgV.js → diagram-3UASUU5V-CjjvxIr3.js} +1 -1
- package/dist/assets/{diagram-ATOU4E4O-DPo3fHpo.js → diagram-ATOU4E4O-DDu2iVRb.js} +1 -1
- package/dist/assets/{diagram-CDSNMT55-BAHqm-cq.js → diagram-CDSNMT55-BBTViw3h.js} +1 -1
- package/dist/assets/{diagram-MLGK6HIB-BdI4Tf9M.js → diagram-MLGK6HIB-D83j4C6w.js} +1 -1
- package/dist/assets/{diagram-MPIPVDR6-BxqEl_S5.js → diagram-MPIPVDR6-DTpmpL8Q.js} +1 -1
- package/dist/assets/{ebnfDiagram-ZINNZB2B-DLJ3VRtx.js → ebnfDiagram-ZINNZB2B-D3B4hz_Y.js} +1 -1
- package/dist/assets/{elk-276RUBZZ-Yhxabhx6.js → elk-276RUBZZ-CbNicGf_.js} +1 -1
- package/dist/assets/{erDiagram-OPXOYQCR-DZ4Es64N.js → erDiagram-OPXOYQCR-DeSwxwFC.js} +1 -1
- package/dist/assets/{flowDiagram-KWPJA3E3-E36WtrEY.js → flowDiagram-KWPJA3E3-3n_Hk-ZR.js} +1 -1
- package/dist/assets/{ganttDiagram-FUAMR5RP-OpUEVvtU.js → ganttDiagram-FUAMR5RP-BsadEPTf.js} +1 -1
- package/dist/assets/{gitGraphDiagram-X574FWY7-DTZFNsL8.js → gitGraphDiagram-X574FWY7-DOvqN3Jh.js} +1 -1
- package/dist/assets/{index-Bgf1dXAl.js → index-B9LCl5y3.js} +133 -133
- package/dist/assets/{index-Bzph058J.js → index-BmYLMFD8.js} +1 -1
- package/dist/assets/{infoDiagram-VRGFBTTK-mCP2UtfM.js → infoDiagram-VRGFBTTK-CI3tfMt9.js} +1 -1
- package/dist/assets/{ishikawaDiagram-OU5B5YK6-M71dvinX.js → ishikawaDiagram-OU5B5YK6-BE7AjZYf.js} +1 -1
- package/dist/assets/{journeyDiagram-ZHPQQLJL-B2VdVbYS.js → journeyDiagram-ZHPQQLJL-DplNZPox.js} +1 -1
- package/dist/assets/{kanban-definition-PNTS6WVX-l4HpN_KC.js → kanban-definition-PNTS6WVX-Cos64we-.js} +1 -1
- package/dist/assets/{linear-CN0tWTVj.js → linear-DDfQb-jo.js} +1 -1
- package/dist/assets/{mermaid.core-DpBToEGQ.js → mermaid.core-BekbnuLb.js} +5 -5
- package/dist/assets/{mindmap-definition-NLK3R4M7--DJgZ72R.js → mindmap-definition-NLK3R4M7-DJ0MbzMW.js} +1 -1
- package/dist/assets/{pegDiagram-GJSIUBJH-DmTBsA2I.js → pegDiagram-GJSIUBJH-DZNZCZ4O.js} +1 -1
- package/dist/assets/{pieDiagram-5QR66LMP-Cy6JwGMR.js → pieDiagram-5QR66LMP-COD5v2yC.js} +1 -1
- package/dist/assets/{quadrantDiagram-O4NWA36T-DjTftbBA.js → quadrantDiagram-O4NWA36T-D4dlLWfv.js} +1 -1
- package/dist/assets/{railroadDiagram-XR7U4H2S-DeKIQoik.js → railroadDiagram-XR7U4H2S-CEpVYFKl.js} +1 -1
- package/dist/assets/{requirementDiagram-PLB6GJNP-B02KsDuy.js → requirementDiagram-PLB6GJNP-DYD5GX0G.js} +1 -1
- package/dist/assets/{sankeyDiagram-IPEJSGJF-4RLO5vMI.js → sankeyDiagram-IPEJSGJF-C9bPeTfK.js} +1 -1
- package/dist/assets/{sequenceDiagram-PO4LG4MO-CcBW737M.js → sequenceDiagram-PO4LG4MO-eXpmPg9C.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-CaLSjl7R.js → sizeCapture-INFHLROL-DfqKWBhp.js} +1 -1
- package/dist/assets/{stateDiagram-v2-GCMORJYK-blyzRgvD.js → stateDiagram-v2-GCMORJYK-DkIf90iA.js} +1 -1
- package/dist/assets/{swimlanes-2SLR337P-BIi-tuCD.js → swimlanes-2SLR337P-Ds64cQxN.js} +1 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-bO3Klz6Z.js +8 -0
- package/dist/assets/{timeline-definition-EJHVYXUP-oNE7PiRv.js → timeline-definition-EJHVYXUP-Ci3-31qT.js} +1 -1
- package/dist/assets/{usecaseDiagram-POWQR4AR-DzmCYS5I.js → usecaseDiagram-POWQR4AR-DQUGgfBf.js} +1 -1
- package/dist/assets/{vennDiagram-UO4OBE2U-T51P02io.js → vennDiagram-UO4OBE2U-DV5_nmWl.js} +1 -1
- package/dist/assets/{wardleyDiagram-VNRHLVJA-1GfD8Fys.js → wardleyDiagram-VNRHLVJA-DatPTthc.js} +1 -1
- package/dist/assets/{xychartDiagram-PMCCYNJV-BhNMe0uk.js → xychartDiagram-PMCCYNJV-ADaxt1QH.js} +1 -1
- package/dist/index.html +1 -1
- package/dist-server/drivers/agents-proxy.js +41 -1
- package/dist-server/index.js +1249 -1008
- package/dist-server/openmausbot.js +54 -34
- package/dist-server/pair-cli.js +54 -34
- package/dist-server/server/about-me-sync.js +16 -5
- package/dist-server/server/box.js +18 -14
- package/dist-server/server/browser-engine.js +4 -26
- package/dist-server/server/calendar-calls.js +2 -1
- package/dist-server/server/capped-body.js +26 -0
- package/dist-server/server/container-computer.js +23 -26
- package/dist-server/server/drivers/agents-call.js +3 -3
- package/dist-server/server/drivers/agents-catalog.js +2 -2
- package/dist-server/server/drivers/agents-credential.js +6 -0
- package/dist-server/server/drivers/agents-vault.js +35 -0
- package/dist-server/server/engine-failover.js +6 -3
- package/dist-server/server/engine-tiers.js +4 -4
- package/dist-server/server/index.js +22 -19
- package/dist-server/server/local-vm-run.js +10 -0
- package/dist-server/server/local-vm-start.js +22 -0
- package/dist-server/server/model-levels/aliases.js +7 -2
- package/dist-server/server/model-levels/index.js +7 -0
- package/dist-server/server/request-auth.js +15 -18
- package/dist-server/server/routes/message-file.js +1 -1
- package/dist-server/server/routines.js +6 -6
- package/dist-server/server/store.js +1 -1
- package/dist-server/server/stream-tail.js +25 -0
- package/dist-server/server/team-rooms/backend.js +9 -4
- package/dist-server/server/team-rooms/service.js +1 -1
- package/dist-server/server/team-rooms/testing/fake-rooms-backend.js +10 -4
- package/dist-server/server/vault/request.js +174 -0
- package/dist-server/server/vault/runtime.js +13 -3
- package/dist-server/server/vault/store.js +22 -4
- package/dist-server/server/vps-computer.js +13 -31
- package/dist-server/server/watch-along/budget.js +11 -3
- package/dist-server/server/watch-along/live.js +4 -2
- package/dist-server/shared/vault.js +7 -0
- package/dist-server/vps-container-mcp.js +3 -1
- package/package.json +1 -1
- package/dist/assets/channel-NYf_L8uU.js +0 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-DWtkSjpb.js +0 -8
|
@@ -42292,6 +42292,32 @@ var init_chat_images = __esm({
|
|
|
42292
42292
|
}
|
|
42293
42293
|
});
|
|
42294
42294
|
|
|
42295
|
+
// server/capped-body.ts
|
|
42296
|
+
async function readBodyCapped(res, maxBytes) {
|
|
42297
|
+
const declared = Number(res.headers.get("content-length") ?? NaN);
|
|
42298
|
+
if (Number.isFinite(declared) && declared > maxBytes) {
|
|
42299
|
+
await res.body?.cancel().catch(() => void 0);
|
|
42300
|
+
return null;
|
|
42301
|
+
}
|
|
42302
|
+
if (!res.body) {
|
|
42303
|
+
const bytes = Buffer.from(await res.arrayBuffer());
|
|
42304
|
+
return bytes.length > maxBytes ? null : bytes;
|
|
42305
|
+
}
|
|
42306
|
+
const chunks = [];
|
|
42307
|
+
let received = 0;
|
|
42308
|
+
for await (const chunk of res.body) {
|
|
42309
|
+
received += chunk.byteLength;
|
|
42310
|
+
if (received > maxBytes) return null;
|
|
42311
|
+
chunks.push(chunk);
|
|
42312
|
+
}
|
|
42313
|
+
return Buffer.concat(chunks);
|
|
42314
|
+
}
|
|
42315
|
+
var init_capped_body = __esm({
|
|
42316
|
+
"server/capped-body.ts"() {
|
|
42317
|
+
"use strict";
|
|
42318
|
+
}
|
|
42319
|
+
});
|
|
42320
|
+
|
|
42295
42321
|
// server/environment.ts
|
|
42296
42322
|
import { randomUUID as randomUUID10 } from "node:crypto";
|
|
42297
42323
|
import {
|
|
@@ -43077,25 +43103,25 @@ function panelShotCommand({ width = PANEL_FRAME_WIDTH, quality = PANEL_FRAME_QUA
|
|
|
43077
43103
|
].join("; ");
|
|
43078
43104
|
}
|
|
43079
43105
|
async function readFileBase64(cfg, boxId, path4, signal) {
|
|
43080
|
-
let bytes
|
|
43081
|
-
let tooLarge = false;
|
|
43106
|
+
let bytes;
|
|
43082
43107
|
try {
|
|
43083
|
-
const
|
|
43084
|
-
if (
|
|
43085
|
-
const declaredLength = res.headers.get("content-length");
|
|
43086
|
-
if (declaredLength !== null && Number(declaredLength) > MAX_FRAME_BYTES) tooLarge = true;
|
|
43087
|
-
else bytes = Buffer.from(await res.arrayBuffer());
|
|
43088
|
-
}
|
|
43108
|
+
const res2 = await boxFetch(cfg, `/boxes/${boxId}/artifacts?path=${encodeURIComponent(path4)}`, { signal });
|
|
43109
|
+
if (res2.ok) bytes = await readBodyCapped(res2, MAX_FRAME_BYTES);
|
|
43089
43110
|
} catch {
|
|
43090
43111
|
}
|
|
43091
|
-
if (
|
|
43092
|
-
throw new Error(FRAME_TOO_LARGE);
|
|
43093
|
-
}
|
|
43112
|
+
if (bytes === null) throw new Error(FRAME_TOO_LARGE);
|
|
43094
43113
|
if (bytes?.length) return bytes.toString("base64");
|
|
43095
43114
|
signal?.throwIfAborted();
|
|
43096
|
-
const
|
|
43115
|
+
const res = await boxFetch(cfg, `/boxes/${boxId}/files?path=${encodeURIComponent(path4)}&encoding=base64`, { signal });
|
|
43116
|
+
const raw = await readBodyCapped(res, MAX_FRAME_JSON_BYTES).catch(() => void 0);
|
|
43117
|
+
if (raw === null) throw new Error(FRAME_TOO_LARGE);
|
|
43118
|
+
let body = null;
|
|
43119
|
+
try {
|
|
43120
|
+
body = JSON.parse(raw?.toString("utf8") ?? "");
|
|
43121
|
+
} catch {
|
|
43122
|
+
}
|
|
43097
43123
|
const content = body?.content;
|
|
43098
|
-
if (ok && typeof content === "string" && content) {
|
|
43124
|
+
if (res.ok && body?.ok !== false && typeof content === "string" && content) {
|
|
43099
43125
|
if (Buffer.byteLength(content, "base64") > MAX_FRAME_BYTES) throw new Error(FRAME_TOO_LARGE);
|
|
43100
43126
|
return content;
|
|
43101
43127
|
}
|
|
@@ -43124,10 +43150,11 @@ async function screenshotBox(cfg, botId, knownBoxId, options) {
|
|
|
43124
43150
|
if (!data) throw new Error("could not read the frame back from the box");
|
|
43125
43151
|
return { png: data, format: "jpeg" };
|
|
43126
43152
|
}
|
|
43127
|
-
var shellQuote3, BOX_API2, READY, DEFAULT_BOX_TTL_SECONDS, TRIAL_BOX_TTL_SECONDS, BOX_INVENTORY_PAGE_SIZE, MAX_BOX_INVENTORY_PAGES, BOX_ID3, scopedBoxPrefixCache, boxIdCache, QUIESCE_BROWSER, PANEL_PATH, PANEL_FRAME_WIDTH, PANEL_FRAME_QUALITY, PANEL_FRAME_FFMPEG_Q, SHOT_CMD, MAX_FRAME_BYTES, FRAME_TOO_LARGE;
|
|
43153
|
+
var shellQuote3, BOX_API2, READY, DEFAULT_BOX_TTL_SECONDS, TRIAL_BOX_TTL_SECONDS, BOX_INVENTORY_PAGE_SIZE, MAX_BOX_INVENTORY_PAGES, BOX_ID3, scopedBoxPrefixCache, boxIdCache, QUIESCE_BROWSER, PANEL_PATH, PANEL_FRAME_WIDTH, PANEL_FRAME_QUALITY, PANEL_FRAME_FFMPEG_Q, SHOT_CMD, MAX_FRAME_BYTES, FRAME_TOO_LARGE, MAX_FRAME_JSON_BYTES;
|
|
43128
43154
|
var init_box = __esm({
|
|
43129
43155
|
"server/box.ts"() {
|
|
43130
43156
|
"use strict";
|
|
43157
|
+
init_capped_body();
|
|
43131
43158
|
init_config();
|
|
43132
43159
|
init_environment();
|
|
43133
43160
|
init_box_create_idempotency();
|
|
@@ -43153,6 +43180,7 @@ var init_box = __esm({
|
|
|
43153
43180
|
SHOT_CMD = panelShotCommand();
|
|
43154
43181
|
MAX_FRAME_BYTES = 8 * 1024 * 1024;
|
|
43155
43182
|
FRAME_TOO_LARGE = "the box frame exceeds the 8 MB limit";
|
|
43183
|
+
MAX_FRAME_JSON_BYTES = Math.ceil(MAX_FRAME_BYTES / 3) * 4 + 4096;
|
|
43156
43184
|
}
|
|
43157
43185
|
});
|
|
43158
43186
|
|
|
@@ -59297,26 +59325,7 @@ async function installAgentBrowserBinary(options = {}) {
|
|
|
59297
59325
|
if (!response.ok) throw new Error(`the agent-browser download failed (HTTP ${response.status})`);
|
|
59298
59326
|
const declared = Number(response.headers.get("content-length") ?? NaN);
|
|
59299
59327
|
if (Number.isFinite(declared) && declared !== asset.bytes) throw new Error("the agent-browser download did not match its pinned size; nothing was installed");
|
|
59300
|
-
|
|
59301
|
-
let received = 0;
|
|
59302
|
-
if (response.body) {
|
|
59303
|
-
try {
|
|
59304
|
-
for await (const chunk of response.body) {
|
|
59305
|
-
chunks.push(chunk);
|
|
59306
|
-
received += chunk.byteLength;
|
|
59307
|
-
if (received > asset.bytes) {
|
|
59308
|
-
controller.abort();
|
|
59309
|
-
break;
|
|
59310
|
-
}
|
|
59311
|
-
}
|
|
59312
|
-
} catch (error51) {
|
|
59313
|
-
if (received <= asset.bytes) throw error51;
|
|
59314
|
-
}
|
|
59315
|
-
body = Buffer.concat(chunks);
|
|
59316
|
-
} else {
|
|
59317
|
-
body = Buffer.from(await response.arrayBuffer());
|
|
59318
|
-
if (body.length > asset.bytes) controller.abort();
|
|
59319
|
-
}
|
|
59328
|
+
body = await readBodyCapped(response, asset.bytes) ?? Buffer.alloc(0);
|
|
59320
59329
|
} finally {
|
|
59321
59330
|
clearTimeout(timer);
|
|
59322
59331
|
}
|
|
@@ -59540,6 +59549,7 @@ var init_browser_engine = __esm({
|
|
|
59540
59549
|
init_procs();
|
|
59541
59550
|
init_bundle_process_sweep();
|
|
59542
59551
|
init_atomic();
|
|
59552
|
+
init_capped_body();
|
|
59543
59553
|
init_config();
|
|
59544
59554
|
init_browser_bundle_release();
|
|
59545
59555
|
init_browser_runtime();
|
|
@@ -61280,6 +61290,16 @@ function resolveLoopbackTrust(input) {
|
|
|
61280
61290
|
if (input.hostedWorkspace) return { trust: "service", reason: "hosted workspace" };
|
|
61281
61291
|
return { trust: "owner", reason: "self-hosted default" };
|
|
61282
61292
|
}
|
|
61293
|
+
function clientPatchViolation(fields) {
|
|
61294
|
+
return (body) => {
|
|
61295
|
+
if (!body || typeof body !== "object" || Array.isArray(body)) return "body";
|
|
61296
|
+
for (const key of Object.keys(body)) if (!fields.has(key)) return key;
|
|
61297
|
+
return null;
|
|
61298
|
+
};
|
|
61299
|
+
}
|
|
61300
|
+
var clientBotPatchViolation = clientPatchViolation(/* @__PURE__ */ new Set(["unread", "pinned", "pinnedMessageId", "color", "mascotExpression", "mascotBody"]));
|
|
61301
|
+
var clientGroupPatchViolation = clientPatchViolation(/* @__PURE__ */ new Set(["name", "bulletin", "unread", "pinned", "pinnedMessageId", "section"]));
|
|
61302
|
+
var clientTaskPatchViolation = clientPatchViolation(/* @__PURE__ */ new Set(["title", "projectId", "archivedAt", "pinned", "pinnedMessageId"]));
|
|
61283
61303
|
|
|
61284
61304
|
// server/cli.ts
|
|
61285
61305
|
init_atomic();
|
package/dist-server/pair-cli.js
CHANGED
|
@@ -42292,6 +42292,32 @@ var init_chat_images = __esm({
|
|
|
42292
42292
|
}
|
|
42293
42293
|
});
|
|
42294
42294
|
|
|
42295
|
+
// server/capped-body.ts
|
|
42296
|
+
async function readBodyCapped(res, maxBytes) {
|
|
42297
|
+
const declared = Number(res.headers.get("content-length") ?? NaN);
|
|
42298
|
+
if (Number.isFinite(declared) && declared > maxBytes) {
|
|
42299
|
+
await res.body?.cancel().catch(() => void 0);
|
|
42300
|
+
return null;
|
|
42301
|
+
}
|
|
42302
|
+
if (!res.body) {
|
|
42303
|
+
const bytes = Buffer.from(await res.arrayBuffer());
|
|
42304
|
+
return bytes.length > maxBytes ? null : bytes;
|
|
42305
|
+
}
|
|
42306
|
+
const chunks = [];
|
|
42307
|
+
let received = 0;
|
|
42308
|
+
for await (const chunk of res.body) {
|
|
42309
|
+
received += chunk.byteLength;
|
|
42310
|
+
if (received > maxBytes) return null;
|
|
42311
|
+
chunks.push(chunk);
|
|
42312
|
+
}
|
|
42313
|
+
return Buffer.concat(chunks);
|
|
42314
|
+
}
|
|
42315
|
+
var init_capped_body = __esm({
|
|
42316
|
+
"server/capped-body.ts"() {
|
|
42317
|
+
"use strict";
|
|
42318
|
+
}
|
|
42319
|
+
});
|
|
42320
|
+
|
|
42295
42321
|
// server/environment.ts
|
|
42296
42322
|
import { randomUUID as randomUUID10 } from "node:crypto";
|
|
42297
42323
|
import {
|
|
@@ -43077,25 +43103,25 @@ function panelShotCommand({ width = PANEL_FRAME_WIDTH, quality = PANEL_FRAME_QUA
|
|
|
43077
43103
|
].join("; ");
|
|
43078
43104
|
}
|
|
43079
43105
|
async function readFileBase64(cfg, boxId, path4, signal) {
|
|
43080
|
-
let bytes
|
|
43081
|
-
let tooLarge = false;
|
|
43106
|
+
let bytes;
|
|
43082
43107
|
try {
|
|
43083
|
-
const
|
|
43084
|
-
if (
|
|
43085
|
-
const declaredLength = res.headers.get("content-length");
|
|
43086
|
-
if (declaredLength !== null && Number(declaredLength) > MAX_FRAME_BYTES) tooLarge = true;
|
|
43087
|
-
else bytes = Buffer.from(await res.arrayBuffer());
|
|
43088
|
-
}
|
|
43108
|
+
const res2 = await boxFetch(cfg, `/boxes/${boxId}/artifacts?path=${encodeURIComponent(path4)}`, { signal });
|
|
43109
|
+
if (res2.ok) bytes = await readBodyCapped(res2, MAX_FRAME_BYTES);
|
|
43089
43110
|
} catch {
|
|
43090
43111
|
}
|
|
43091
|
-
if (
|
|
43092
|
-
throw new Error(FRAME_TOO_LARGE);
|
|
43093
|
-
}
|
|
43112
|
+
if (bytes === null) throw new Error(FRAME_TOO_LARGE);
|
|
43094
43113
|
if (bytes?.length) return bytes.toString("base64");
|
|
43095
43114
|
signal?.throwIfAborted();
|
|
43096
|
-
const
|
|
43115
|
+
const res = await boxFetch(cfg, `/boxes/${boxId}/files?path=${encodeURIComponent(path4)}&encoding=base64`, { signal });
|
|
43116
|
+
const raw = await readBodyCapped(res, MAX_FRAME_JSON_BYTES).catch(() => void 0);
|
|
43117
|
+
if (raw === null) throw new Error(FRAME_TOO_LARGE);
|
|
43118
|
+
let body = null;
|
|
43119
|
+
try {
|
|
43120
|
+
body = JSON.parse(raw?.toString("utf8") ?? "");
|
|
43121
|
+
} catch {
|
|
43122
|
+
}
|
|
43097
43123
|
const content = body?.content;
|
|
43098
|
-
if (ok && typeof content === "string" && content) {
|
|
43124
|
+
if (res.ok && body?.ok !== false && typeof content === "string" && content) {
|
|
43099
43125
|
if (Buffer.byteLength(content, "base64") > MAX_FRAME_BYTES) throw new Error(FRAME_TOO_LARGE);
|
|
43100
43126
|
return content;
|
|
43101
43127
|
}
|
|
@@ -43124,10 +43150,11 @@ async function screenshotBox(cfg, botId, knownBoxId, options) {
|
|
|
43124
43150
|
if (!data) throw new Error("could not read the frame back from the box");
|
|
43125
43151
|
return { png: data, format: "jpeg" };
|
|
43126
43152
|
}
|
|
43127
|
-
var shellQuote3, BOX_API2, READY, DEFAULT_BOX_TTL_SECONDS, TRIAL_BOX_TTL_SECONDS, BOX_INVENTORY_PAGE_SIZE, MAX_BOX_INVENTORY_PAGES, BOX_ID3, scopedBoxPrefixCache, boxIdCache, QUIESCE_BROWSER, PANEL_PATH, PANEL_FRAME_WIDTH, PANEL_FRAME_QUALITY, PANEL_FRAME_FFMPEG_Q, SHOT_CMD, MAX_FRAME_BYTES, FRAME_TOO_LARGE;
|
|
43153
|
+
var shellQuote3, BOX_API2, READY, DEFAULT_BOX_TTL_SECONDS, TRIAL_BOX_TTL_SECONDS, BOX_INVENTORY_PAGE_SIZE, MAX_BOX_INVENTORY_PAGES, BOX_ID3, scopedBoxPrefixCache, boxIdCache, QUIESCE_BROWSER, PANEL_PATH, PANEL_FRAME_WIDTH, PANEL_FRAME_QUALITY, PANEL_FRAME_FFMPEG_Q, SHOT_CMD, MAX_FRAME_BYTES, FRAME_TOO_LARGE, MAX_FRAME_JSON_BYTES;
|
|
43128
43154
|
var init_box = __esm({
|
|
43129
43155
|
"server/box.ts"() {
|
|
43130
43156
|
"use strict";
|
|
43157
|
+
init_capped_body();
|
|
43131
43158
|
init_config();
|
|
43132
43159
|
init_environment();
|
|
43133
43160
|
init_box_create_idempotency();
|
|
@@ -43153,6 +43180,7 @@ var init_box = __esm({
|
|
|
43153
43180
|
SHOT_CMD = panelShotCommand();
|
|
43154
43181
|
MAX_FRAME_BYTES = 8 * 1024 * 1024;
|
|
43155
43182
|
FRAME_TOO_LARGE = "the box frame exceeds the 8 MB limit";
|
|
43183
|
+
MAX_FRAME_JSON_BYTES = Math.ceil(MAX_FRAME_BYTES / 3) * 4 + 4096;
|
|
43156
43184
|
}
|
|
43157
43185
|
});
|
|
43158
43186
|
|
|
@@ -59297,26 +59325,7 @@ async function installAgentBrowserBinary(options = {}) {
|
|
|
59297
59325
|
if (!response.ok) throw new Error(`the agent-browser download failed (HTTP ${response.status})`);
|
|
59298
59326
|
const declared = Number(response.headers.get("content-length") ?? NaN);
|
|
59299
59327
|
if (Number.isFinite(declared) && declared !== asset.bytes) throw new Error("the agent-browser download did not match its pinned size; nothing was installed");
|
|
59300
|
-
|
|
59301
|
-
let received = 0;
|
|
59302
|
-
if (response.body) {
|
|
59303
|
-
try {
|
|
59304
|
-
for await (const chunk of response.body) {
|
|
59305
|
-
chunks.push(chunk);
|
|
59306
|
-
received += chunk.byteLength;
|
|
59307
|
-
if (received > asset.bytes) {
|
|
59308
|
-
controller.abort();
|
|
59309
|
-
break;
|
|
59310
|
-
}
|
|
59311
|
-
}
|
|
59312
|
-
} catch (error51) {
|
|
59313
|
-
if (received <= asset.bytes) throw error51;
|
|
59314
|
-
}
|
|
59315
|
-
body = Buffer.concat(chunks);
|
|
59316
|
-
} else {
|
|
59317
|
-
body = Buffer.from(await response.arrayBuffer());
|
|
59318
|
-
if (body.length > asset.bytes) controller.abort();
|
|
59319
|
-
}
|
|
59328
|
+
body = await readBodyCapped(response, asset.bytes) ?? Buffer.alloc(0);
|
|
59320
59329
|
} finally {
|
|
59321
59330
|
clearTimeout(timer);
|
|
59322
59331
|
}
|
|
@@ -59540,6 +59549,7 @@ var init_browser_engine = __esm({
|
|
|
59540
59549
|
init_procs();
|
|
59541
59550
|
init_bundle_process_sweep();
|
|
59542
59551
|
init_atomic();
|
|
59552
|
+
init_capped_body();
|
|
59543
59553
|
init_config();
|
|
59544
59554
|
init_browser_bundle_release();
|
|
59545
59555
|
init_browser_runtime();
|
|
@@ -61280,6 +61290,16 @@ function resolveLoopbackTrust(input) {
|
|
|
61280
61290
|
if (input.hostedWorkspace) return { trust: "service", reason: "hosted workspace" };
|
|
61281
61291
|
return { trust: "owner", reason: "self-hosted default" };
|
|
61282
61292
|
}
|
|
61293
|
+
function clientPatchViolation(fields) {
|
|
61294
|
+
return (body) => {
|
|
61295
|
+
if (!body || typeof body !== "object" || Array.isArray(body)) return "body";
|
|
61296
|
+
for (const key of Object.keys(body)) if (!fields.has(key)) return key;
|
|
61297
|
+
return null;
|
|
61298
|
+
};
|
|
61299
|
+
}
|
|
61300
|
+
var clientBotPatchViolation = clientPatchViolation(/* @__PURE__ */ new Set(["unread", "pinned", "pinnedMessageId", "color", "mascotExpression", "mascotBody"]));
|
|
61301
|
+
var clientGroupPatchViolation = clientPatchViolation(/* @__PURE__ */ new Set(["name", "bulletin", "unread", "pinned", "pinnedMessageId", "section"]));
|
|
61302
|
+
var clientTaskPatchViolation = clientPatchViolation(/* @__PURE__ */ new Set(["title", "projectId", "archivedAt", "pinned", "pinnedMessageId"]));
|
|
61283
61303
|
|
|
61284
61304
|
// server/cli.ts
|
|
61285
61305
|
init_atomic();
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { readFileSync } from "node:fs";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { writeFileAtomic } from "./atomic.js";
|
|
9
|
+
import { isPlaceholderText } from "./paw/fill.js";
|
|
9
10
|
export const ABOUT_ME_SIDES = ["atomic", "paw", "nexus"];
|
|
10
11
|
const norm = (text) => text.replace(/\r\n?/g, "\n").trim();
|
|
11
12
|
/** One pass. `now` holds each reachable side's text (a side left out is
|
|
@@ -14,19 +15,29 @@ const norm = (text) => text.replace(/\r\n?/g, "\n").trim();
|
|
|
14
15
|
* edit reaches every other side. Two different edits, or a side seen for
|
|
15
16
|
* the first time that disagrees with the rest, are a conflict: nothing is
|
|
16
17
|
* written. `legacy` (an ICM "Who I am") fills everything when all sides are
|
|
17
|
-
* empty, and a profile still holding it counts as empty.
|
|
18
|
+
* empty, and a profile still holding it counts as empty. A PAW template
|
|
19
|
+
* placeholder ("(fill in)" scaffolding) also counts as empty: it is starter
|
|
20
|
+
* text Atomic wrote itself, never the person's words. A profile the person
|
|
21
|
+
* emptied in Settings since the last pass is a deliberate clear, and it
|
|
22
|
+
* reaches the other sides the way an edit does. Only the profile clears: a
|
|
23
|
+
* PAW file or Nexus read that comes back blank may be a missing folder or a
|
|
24
|
+
* bad response, so it is refilled and never wipes the rest. */
|
|
18
25
|
export function reconcileAboutMe(now, seen, legacy = "") {
|
|
19
26
|
const sides = ABOUT_ME_SIDES.filter((side) => now[side] !== undefined);
|
|
20
|
-
const text = (side) =>
|
|
27
|
+
const text = (side) => {
|
|
28
|
+
const value = side === "atomic" && norm(legacy) && norm(now.atomic) === norm(legacy) ? "" : norm(now[side]);
|
|
29
|
+
return isPlaceholderText(value) ? "" : value;
|
|
30
|
+
};
|
|
21
31
|
const filled = sides.filter((side) => text(side));
|
|
32
|
+
const cleared = sides.filter((side) => side === "atomic" && !norm(now[side]) && norm(seen[side] ?? ""));
|
|
22
33
|
const edited = filled.filter((side) => text(side) !== norm(seen[side] ?? ""));
|
|
23
34
|
const kept = filled.filter((side) => !edited.includes(side));
|
|
24
35
|
const firstContact = edited.some((side) => seen[side] === undefined) && kept.some((side) => text(side) !== text(edited[0]));
|
|
25
|
-
if (new Set(edited.map(text)).size > 1 || firstContact)
|
|
36
|
+
if (new Set(edited.map(text)).size > 1 || firstContact || (cleared.length > 0 && edited.length > 0))
|
|
26
37
|
return { writes: {}, seen, conflict: filled };
|
|
27
38
|
const source = edited[0] ?? kept[0];
|
|
28
|
-
const target = source ? now[source] : legacy;
|
|
29
|
-
if (!norm(target))
|
|
39
|
+
const target = cleared.length ? "" : source ? now[source] : legacy;
|
|
40
|
+
if (!norm(target) && !cleared.length)
|
|
30
41
|
return { writes: {}, seen, conflict: [] };
|
|
31
42
|
const writes = {};
|
|
32
43
|
for (const side of sides)
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
// - X11 desktop with Chrome + Ghostty; passwordless sudo; node 24.
|
|
12
12
|
// - the dedicated IP rotates across archive/resume — never persist it.
|
|
13
13
|
import { createHash } from "node:crypto";
|
|
14
|
+
import { readBodyCapped } from "./capped-body.js";
|
|
14
15
|
import { DATA_DIR } from "./config.js";
|
|
15
16
|
import { loadEnvironmentId } from "./environment.js";
|
|
16
17
|
import { adoptResolvedBox, beginBoxCreate, boxCreateRecoverySnapshot, discardBoxCreate, rememberCreatedBox, resolveBoxCreate, retireDeletedBoxCreate, } from "./box-create-idempotency.js";
|
|
@@ -1235,33 +1236,36 @@ const SHOT_CMD = panelShotCommand();
|
|
|
1235
1236
|
// response cannot exhaust memory.
|
|
1236
1237
|
const MAX_FRAME_BYTES = 8 * 1024 * 1024;
|
|
1237
1238
|
const FRAME_TOO_LARGE = "the box frame exceeds the 8 MB limit";
|
|
1239
|
+
// The files fallback wraps the frame in base64 (4/3) plus a small envelope.
|
|
1240
|
+
const MAX_FRAME_JSON_BYTES = Math.ceil(MAX_FRAME_BYTES / 3) * 4 + 4096;
|
|
1238
1241
|
/** Read a file off the box as base64 — raw artifact bytes when the API
|
|
1239
1242
|
* supports it (33% less transfer, no JSON envelope), else the files API. */
|
|
1240
1243
|
async function readFileBase64(cfg, boxId, path, signal) {
|
|
1241
|
-
let bytes
|
|
1242
|
-
let tooLarge = false;
|
|
1244
|
+
let bytes;
|
|
1243
1245
|
try {
|
|
1244
1246
|
const res = await boxFetch(cfg, `/boxes/${boxId}/artifacts?path=${encodeURIComponent(path)}`, { signal });
|
|
1245
|
-
if (res.ok)
|
|
1246
|
-
|
|
1247
|
-
if (declaredLength !== null && Number(declaredLength) > MAX_FRAME_BYTES)
|
|
1248
|
-
tooLarge = true;
|
|
1249
|
-
else
|
|
1250
|
-
bytes = Buffer.from(await res.arrayBuffer());
|
|
1251
|
-
}
|
|
1247
|
+
if (res.ok)
|
|
1248
|
+
bytes = await readBodyCapped(res, MAX_FRAME_BYTES);
|
|
1252
1249
|
}
|
|
1253
1250
|
catch {
|
|
1254
|
-
/* fall through */
|
|
1251
|
+
/* fall through to the files API */
|
|
1255
1252
|
}
|
|
1256
|
-
if (
|
|
1253
|
+
if (bytes === null)
|
|
1257
1254
|
throw new Error(FRAME_TOO_LARGE);
|
|
1258
|
-
}
|
|
1259
1255
|
if (bytes?.length)
|
|
1260
1256
|
return bytes.toString("base64");
|
|
1261
1257
|
signal?.throwIfAborted();
|
|
1262
|
-
const
|
|
1258
|
+
const res = await boxFetch(cfg, `/boxes/${boxId}/files?path=${encodeURIComponent(path)}&encoding=base64`, { signal });
|
|
1259
|
+
const raw = await readBodyCapped(res, MAX_FRAME_JSON_BYTES).catch(() => undefined);
|
|
1260
|
+
if (raw === null)
|
|
1261
|
+
throw new Error(FRAME_TOO_LARGE);
|
|
1262
|
+
let body = null;
|
|
1263
|
+
try {
|
|
1264
|
+
body = JSON.parse(raw?.toString("utf8") ?? "");
|
|
1265
|
+
}
|
|
1266
|
+
catch { /* unusable envelope */ }
|
|
1263
1267
|
const content = body?.content;
|
|
1264
|
-
if (ok && typeof content === "string" && content) {
|
|
1268
|
+
if (res.ok && body?.ok !== false && typeof content === "string" && content) {
|
|
1265
1269
|
if (Buffer.byteLength(content, "base64") > MAX_FRAME_BYTES)
|
|
1266
1270
|
throw new Error(FRAME_TOO_LARGE);
|
|
1267
1271
|
return content;
|
|
@@ -15,6 +15,7 @@ import { homedir, tmpdir } from "node:os";
|
|
|
15
15
|
import { delimiter, dirname, join, resolve } from "node:path";
|
|
16
16
|
import { sweepRoot } from "../electron/bundle-process-sweep.mjs";
|
|
17
17
|
import { writeFileAtomic } from "./atomic.js";
|
|
18
|
+
import { readBodyCapped } from "./capped-body.js";
|
|
18
19
|
import { DATA_DIR } from "./config.js";
|
|
19
20
|
import { browserBundlePaths } from "./browser-bundle-release.js";
|
|
20
21
|
import { browserRuntimeEnv } from "./browser-runtime.js";
|
|
@@ -298,32 +299,9 @@ export async function installAgentBrowserBinary(options = {}) {
|
|
|
298
299
|
const declared = Number(response.headers.get("content-length") ?? NaN);
|
|
299
300
|
if (Number.isFinite(declared) && declared !== asset.bytes)
|
|
300
301
|
throw new Error("the agent-browser download did not match its pinned size; nothing was installed");
|
|
301
|
-
// Stream, never buffer whole: a body past the pin is cut off mid-flight
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
if (response.body) {
|
|
305
|
-
try {
|
|
306
|
-
for await (const chunk of response.body) {
|
|
307
|
-
chunks.push(chunk);
|
|
308
|
-
received += chunk.byteLength;
|
|
309
|
-
if (received > asset.bytes) {
|
|
310
|
-
controller.abort();
|
|
311
|
-
break;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
catch (error) {
|
|
316
|
-
// Only the abort we asked for is swallowed; the size check reports it.
|
|
317
|
-
if (received <= asset.bytes)
|
|
318
|
-
throw error;
|
|
319
|
-
}
|
|
320
|
-
body = Buffer.concat(chunks);
|
|
321
|
-
}
|
|
322
|
-
else {
|
|
323
|
-
body = Buffer.from(await response.arrayBuffer());
|
|
324
|
-
if (body.length > asset.bytes)
|
|
325
|
-
controller.abort();
|
|
326
|
-
}
|
|
302
|
+
// Stream, never buffer whole: a body past the pin is cut off mid-flight,
|
|
303
|
+
// and the empty buffer it leaves behind fails the exact-size check below.
|
|
304
|
+
body = (await readBodyCapped(response, asset.bytes)) ?? Buffer.alloc(0);
|
|
327
305
|
}
|
|
328
306
|
finally {
|
|
329
307
|
clearTimeout(timer);
|
|
@@ -191,11 +191,12 @@ export class CalendarCallManager {
|
|
|
191
191
|
durationMinutes: patch.durationMinutes ?? previous.durationMinutes,
|
|
192
192
|
attachments: patch.attachments ?? previous.attachments,
|
|
193
193
|
}, this.botExists);
|
|
194
|
+
const scheduleChanged = JSON.stringify(clean.schedule) !== JSON.stringify(previous.schedule);
|
|
194
195
|
const updated = {
|
|
195
196
|
id: previous.id,
|
|
196
197
|
...clean,
|
|
197
198
|
roomId: patch.botIds && !sameRoster(clean.botIds, previous.botIds) ? undefined : previous.roomId,
|
|
198
|
-
nextRunAt: this.initialOccurrence(clean.schedule, this.now()),
|
|
199
|
+
nextRunAt: scheduleChanged ? this.initialOccurrence(clean.schedule, this.now()) : previous.nextRunAt,
|
|
199
200
|
createdAt: previous.createdAt,
|
|
200
201
|
updatedAt: this.now(),
|
|
201
202
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Read a fetch Response body into a Buffer while never holding more than
|
|
2
|
+
* `maxBytes` of it: a longer body is cut off mid-flight and reported as null,
|
|
3
|
+
* so one hostile or broken response cannot exhaust server memory. A declared
|
|
4
|
+
* content-length over the cap skips the read entirely. */
|
|
5
|
+
export async function readBodyCapped(res, maxBytes) {
|
|
6
|
+
const declared = Number(res.headers.get("content-length") ?? NaN);
|
|
7
|
+
if (Number.isFinite(declared) && declared > maxBytes) {
|
|
8
|
+
await res.body?.cancel().catch(() => undefined);
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
if (!res.body) {
|
|
12
|
+
const bytes = Buffer.from(await res.arrayBuffer());
|
|
13
|
+
return bytes.length > maxBytes ? null : bytes;
|
|
14
|
+
}
|
|
15
|
+
const chunks = [];
|
|
16
|
+
let received = 0;
|
|
17
|
+
// returning out of for await cancels the stream, so nothing past the cap
|
|
18
|
+
// is pulled off the socket, let alone buffered
|
|
19
|
+
for await (const chunk of res.body) {
|
|
20
|
+
received += chunk.byteLength;
|
|
21
|
+
if (received > maxBytes)
|
|
22
|
+
return null;
|
|
23
|
+
chunks.push(chunk);
|
|
24
|
+
}
|
|
25
|
+
return Buffer.concat(chunks);
|
|
26
|
+
}
|
|
@@ -16,6 +16,9 @@ import { colimaStartPlan, dockerEnvForColima, startColima } from "./colima-docke
|
|
|
16
16
|
import { spawnOptionsFor } from "./spawn-command.js";
|
|
17
17
|
import { DATA_DIR } from "./config.js";
|
|
18
18
|
import { SPAWNED_PROXIES } from "./proxy-paths.js";
|
|
19
|
+
import { localVmStartableWhenStopped } from "./local-vm-start.js";
|
|
20
|
+
import { viewerSecretToEnv } from "./local-vm-run.js";
|
|
21
|
+
export { localVmStartableWhenStopped };
|
|
19
22
|
const run = promisify(execFile);
|
|
20
23
|
const SCREENSHOT_STATUS_TTL_MS = 10_000;
|
|
21
24
|
export const CUA_DRIVER_VERSION = "0.20.0";
|
|
@@ -182,7 +185,7 @@ LABEL ${MANAGED_LABEL}="1" \\
|
|
|
182
185
|
${IMAGE_LAYER_LABEL}="${IMAGE_LAYER_VERSION}"
|
|
183
186
|
`;
|
|
184
187
|
}
|
|
185
|
-
async function sh(cmd, args, timeout = 8000) {
|
|
188
|
+
async function sh(cmd, args, timeout = 8000, secrets) {
|
|
186
189
|
const resolved = resolveCliSpawn(cmd, args);
|
|
187
190
|
const { stdout } = await run(resolved.command, resolved.args, spawnOptionsFor(resolved, {
|
|
188
191
|
timeout,
|
|
@@ -191,8 +194,8 @@ async function sh(cmd, args, timeout = 8000) {
|
|
|
191
194
|
// Every docker call on a Mac goes to Colima's socket, whatever docker
|
|
192
195
|
// context Docker Desktop may have left active.
|
|
193
196
|
env: cmd === "docker"
|
|
194
|
-
? dockerEnvForColima({ ...process.env, PATH: augmentedPath() })
|
|
195
|
-
: { ...process.env, PATH: augmentedPath() },
|
|
197
|
+
? dockerEnvForColima({ ...process.env, ...secrets, PATH: augmentedPath() })
|
|
198
|
+
: { ...process.env, ...secrets, PATH: augmentedPath() },
|
|
196
199
|
}));
|
|
197
200
|
return { stdout };
|
|
198
201
|
}
|
|
@@ -312,9 +315,8 @@ function emptyStatus(platform, target) {
|
|
|
312
315
|
* Every other problem in `statusProblem` stays the person's call and returns
|
|
313
316
|
* false here: no runtime, daemon down, image never prepared, `create_supported`
|
|
314
317
|
* false, and any existing container — stale image, unmanaged, unsafe network,
|
|
315
|
-
* security or persistence. A stopped container is
|
|
316
|
-
*
|
|
317
|
-
* recreate rather than a start.
|
|
318
|
+
* security or persistence. A stopped container is not recreated either: it is
|
|
319
|
+
* started with its disk (`localVmStartableWhenStopped`).
|
|
318
320
|
*/
|
|
319
321
|
export function localVmRecreatableOnDemand(status) {
|
|
320
322
|
return Boolean(status.runtime)
|
|
@@ -323,17 +325,13 @@ export function localVmRecreatableOnDemand(status) {
|
|
|
323
325
|
&& status.container === "missing"
|
|
324
326
|
&& status.create_supported;
|
|
325
327
|
}
|
|
326
|
-
/** A stopped VM may contain installed applications and files outside the mount.
|
|
327
|
-
* Replacement requires an explicit removal; startup never discards its disk. */
|
|
328
|
-
export function localVmReplaceableWhenStopped(_status) {
|
|
329
|
-
return false;
|
|
330
|
-
}
|
|
331
328
|
/** Whether Auto may attach this Local VM without a person choosing it: the
|
|
332
|
-
* desktop is ready,
|
|
333
|
-
* recreated after idling away
|
|
334
|
-
*
|
|
329
|
+
* desktop is ready, its image is prepared and the container can simply be
|
|
330
|
+
* recreated after idling away, or it is stopped and can be started again.
|
|
331
|
+
* Anything else — no runtime, daemon down, image never prepared, an unmanaged
|
|
332
|
+
* or unsafe container — stays the person's call. */
|
|
335
333
|
export function autoLocalVmAttachable(status) {
|
|
336
|
-
return status.ready === true || localVmRecreatableOnDemand(status) ||
|
|
334
|
+
return status.ready === true || localVmRecreatableOnDemand(status) || localVmStartableWhenStopped(status);
|
|
337
335
|
}
|
|
338
336
|
function statusProblem(status) {
|
|
339
337
|
if (!status.runtime)
|
|
@@ -358,7 +356,7 @@ function statusProblem(status) {
|
|
|
358
356
|
if (status.persistence === "unsafe")
|
|
359
357
|
return "The existing Local VM is missing its durable workspace; recreate it";
|
|
360
358
|
if (status.container === "stopped")
|
|
361
|
-
return "The Local VM is stopped
|
|
359
|
+
return "The Local VM is stopped. Its disk and files are kept, and it starts again the next time a bot uses it.";
|
|
362
360
|
if (status.desktop_error)
|
|
363
361
|
return `The Local VM desktop failed to start: ${status.desktop_error}`;
|
|
364
362
|
if (!status.desktopReady)
|
|
@@ -630,8 +628,8 @@ function appleWorkspaceMountIsSafe(mounts, platform, expectedWorkspace) {
|
|
|
630
628
|
* runtime-specific capability exception is Podman's Firefox sandbox chroot.
|
|
631
629
|
* Callers also differ on restart policy — the VPS
|
|
632
630
|
* container must survive a reboot nobody is watching ("unless-stopped"),
|
|
633
|
-
* while the Local VM
|
|
634
|
-
*
|
|
631
|
+
* while the Local VM never starts by itself at boot: Atomic starts a stopped
|
|
632
|
+
* one when a turn or the person asks (localVmStartableWhenStopped). */
|
|
635
633
|
export function dockerSecurityIsHardened(config, options = {}) {
|
|
636
634
|
if (!config)
|
|
637
635
|
return false;
|
|
@@ -787,8 +785,8 @@ export async function containerComputerAction(action, runner = sh, platform = pr
|
|
|
787
785
|
if (action === "run" && !before.create_supported) {
|
|
788
786
|
throw Object.assign(new Error(before.problem ?? "This runtime cannot create a per-bot Local VM"), { status: 409 });
|
|
789
787
|
}
|
|
790
|
-
if (action === "start") {
|
|
791
|
-
throw Object.assign(new Error("This
|
|
788
|
+
if (action === "start" && !localVmStartableWhenStopped(before)) {
|
|
789
|
+
throw Object.assign(new Error(before.container === "stopped" ? before.problem ?? "This Local VM cannot be started; recreate it" : "The Local VM is not stopped"), {
|
|
792
790
|
status: 409,
|
|
793
791
|
});
|
|
794
792
|
}
|
|
@@ -808,12 +806,11 @@ export async function containerComputerAction(action, runner = sh, platform = pr
|
|
|
808
806
|
await ensureVmWorkspace(platform, target);
|
|
809
807
|
if (action === "remove")
|
|
810
808
|
await rescueFirefoxProfile(runtime, runner, platform, target);
|
|
811
|
-
const
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
await runner(runtime, args, 2 * 60_000);
|
|
809
|
+
const runArgs = () => containerRunArgs(runtime, randomBytes(6).toString("base64url"), target);
|
|
810
|
+
const launch = action === "run" ? viewerSecretToEnv(runtime, runArgs()) : null;
|
|
811
|
+
const removal = ["rm", runtime === "container" ? "--force" : "-f", target.containerName];
|
|
812
|
+
const args = launch?.args ?? (action === "remove" ? removal : [action, target.containerName]);
|
|
813
|
+
await runner(runtime, args, 2 * 60_000, launch?.env);
|
|
817
814
|
}
|
|
818
815
|
return containerComputerStatus(runner, platform, target);
|
|
819
816
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
//
|
|
7
7
|
// Nothing here reads the environment or holds state of its own. The caller
|
|
8
8
|
// passes a ToolCallContext, and the per-turn counters live on it.
|
|
9
|
-
import {
|
|
9
|
+
import { callCredentialTool } from "./agents-credential.js";
|
|
10
10
|
import { normalizeCronSchedule } from "../../shared/routine-schedule.js";
|
|
11
11
|
import { peerRecallSpeaker } from "../peer-provenance.js";
|
|
12
12
|
import { peerName } from "../peer-roster.js";
|
|
@@ -835,8 +835,8 @@ export async function callTool(name, args, context) {
|
|
|
835
835
|
const message = typeof r.message === "string" ? r.message : `Updated room ${roomId}.`;
|
|
836
836
|
return { text: message };
|
|
837
837
|
}
|
|
838
|
-
if (name === "request_credential")
|
|
839
|
-
return
|
|
838
|
+
if (name === "request_credential" || name.startsWith("vault_"))
|
|
839
|
+
return callCredentialTool(name, args, BOT_ID, THREAD_ID, api);
|
|
840
840
|
if (name === "list_routines") {
|
|
841
841
|
const query = new URLSearchParams({ fromBotId: BOT_ID, fromThreadId: THREAD_ID });
|
|
842
842
|
const r = await api(`/api/internal/routines?${query.toString()}`);
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// turn. It is pinned byte for byte, and its size budgeted, by
|
|
11
11
|
// agents-catalog-wire.test.ts: change a description or a schema on purpose,
|
|
12
12
|
// then update the goldens there.
|
|
13
|
-
import { credentialTool } from "./agents-credential.js";
|
|
13
|
+
import { credentialTool, vaultTools } from "./agents-credential.js";
|
|
14
14
|
import { PRIVATE_BOT_HIDDEN_TOOLS, agentToolAnnotations } from "../agent-tool-policy.js";
|
|
15
15
|
/** The profile a spawned proxy was given. Everything is off unless the
|
|
16
16
|
* harness says "1". */
|
|
@@ -450,7 +450,7 @@ const toolDefinitions = (externalRuntime) => [
|
|
|
450
450
|
required: ["room_id", "action"],
|
|
451
451
|
},
|
|
452
452
|
},
|
|
453
|
-
credentialTool,
|
|
453
|
+
credentialTool, ...vaultTools,
|
|
454
454
|
{
|
|
455
455
|
name: "marketplace_search",
|
|
456
456
|
description: "Find an app or service the person wants connected in Atomic's Marketplace: official servers Atomic connects, and official apps through their Claude account. Then call open_marketplace. Never offer to build a connection or a community server.",
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { CREDENTIAL_TARGETS, isCredentialTargetId } from "../../shared/credential-request.js";
|
|
2
|
+
import { callVaultTool, vaultTools } from "./agents-vault.js";
|
|
3
|
+
export { vaultTools };
|
|
4
|
+
/** request_credential and the Vault tools: every way a bot reaches a secret it never sees. */
|
|
5
|
+
export function callCredentialTool(name, args, BOT_ID, THREAD_ID, api) {
|
|
6
|
+
return name === "request_credential" ? requestCredential(args, BOT_ID, THREAD_ID, api) : callVaultTool(args, api);
|
|
7
|
+
}
|
|
2
8
|
export async function requestCredential(args, BOT_ID, THREAD_ID, api) {
|
|
3
9
|
const credentialId = args.credential_id;
|
|
4
10
|
if (!isCredentialTargetId(credentialId)) {
|