@chibitek/chibi 0.1.196 → 0.1.198
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/{TerminalPanel-CB-6ECq_.js → TerminalPanel-Dz1TZ0wu.js} +1 -1
- package/dist/assets/{abnfDiagram-O67JEVCF-C79ttPKo.js → abnfDiagram-O67JEVCF-SKskAxcQ.js} +1 -1
- package/dist/assets/{arc-BUuqriRQ.js → arc-CQDufU-h.js} +1 -1
- package/dist/assets/{architectureDiagram-NJMV4G6O-CxWfPil9.js → architectureDiagram-NJMV4G6O-DXQobWjA.js} +1 -1
- package/dist/assets/{blockDiagram-BEXU5L5S-BSLYuBHS.js → blockDiagram-BEXU5L5S-CHNrpEVF.js} +1 -1
- package/dist/assets/{c4Diagram-YGBWAQC7-B-xzP35S.js → c4Diagram-YGBWAQC7-BdeNJG6e.js} +1 -1
- package/dist/assets/channel-DfD49hlO.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-B11khEvC.js → chunk-2Q5K7J3B-D2zDE5DQ.js} +1 -1
- package/dist/assets/{chunk-3FUC2YCW-DsPETNim.js → chunk-3FUC2YCW-CxoeQhRg.js} +2 -2
- package/dist/assets/{chunk-5VM5RSS4-D6WoBPUT.js → chunk-5VM5RSS4-ClcrZtfH.js} +1 -1
- package/dist/assets/{chunk-GTNCS2PH-CN_1S4k_.js → chunk-GTNCS2PH-D04d-Nyy.js} +1 -1
- package/dist/assets/{chunk-GWA4HPMP-NlXta6PY.js → chunk-GWA4HPMP-Mx5uQubT.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-CLIqUdNW.js → chunk-JWPE2WC7-BXgPQeu7.js} +1 -1
- package/dist/assets/{chunk-NETBCI7D-DnuYREKE.js → chunk-NETBCI7D-Clv8gKTm.js} +1 -1
- package/dist/assets/{chunk-WEXAMYUT-DJKFEs93.js → chunk-WEXAMYUT-DZme_wiE.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-CRWsxQ_5.js → chunk-XXDRQBXY-CMQKcx1L.js} +1 -1
- package/dist/assets/{classDiagram-v2-NBCMYWYE-Cyp63Eux.js → classDiagram-v2-NBCMYWYE-Bpd7hB7C.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-BLjNsWhq.js → cose-bilkent-JH36ORCC-BcmQBhnq.js} +1 -1
- package/dist/assets/{cynefin-OW5HDTMX-BnV2cLbs.js → cynefin-OW5HDTMX-C2LkSU1-.js} +1 -1
- package/dist/assets/{cynefinDiagram-VND7K2PF-ClWXZ7xW.js → cynefinDiagram-VND7K2PF-Cw7sPM6x.js} +1 -1
- package/dist/assets/{dagre-6A5THRUB-Dk58FIJ2.js → dagre-6A5THRUB-CnjCwDnk.js} +1 -1
- package/dist/assets/{diagram-22UHCM2B-BjlV2Pv3.js → diagram-22UHCM2B-pk_SCi-C.js} +1 -1
- package/dist/assets/{diagram-3UASUU5V-BOqom62X.js → diagram-3UASUU5V-C_xsR1E3.js} +1 -1
- package/dist/assets/{diagram-ATOU4E4O-CVw9PK2o.js → diagram-ATOU4E4O-CGNG_IMt.js} +1 -1
- package/dist/assets/{diagram-CDSNMT55-LTIvpF3x.js → diagram-CDSNMT55-f4xIaprL.js} +1 -1
- package/dist/assets/{diagram-MLGK6HIB-DZKwFRor.js → diagram-MLGK6HIB-T_nR_5cE.js} +1 -1
- package/dist/assets/{diagram-MPIPVDR6-CY_QtFYz.js → diagram-MPIPVDR6-Dlfi4liM.js} +1 -1
- package/dist/assets/{ebnfDiagram-ZINNZB2B-Kb2bwfRU.js → ebnfDiagram-ZINNZB2B-Bw0xnYi2.js} +1 -1
- package/dist/assets/{elk-276RUBZZ-D05nrUAY.js → elk-276RUBZZ-BJsPLqbY.js} +1 -1
- package/dist/assets/{erDiagram-OPXOYQCR-cBbx_M93.js → erDiagram-OPXOYQCR-6iHcV-Tc.js} +1 -1
- package/dist/assets/{flowDiagram-KWPJA3E3-CzlBDlR8.js → flowDiagram-KWPJA3E3-DFh0Gt1h.js} +1 -1
- package/dist/assets/{ganttDiagram-FUAMR5RP-DkkjIANc.js → ganttDiagram-FUAMR5RP-DILAB6L4.js} +1 -1
- package/dist/assets/{gitGraphDiagram-X574FWY7-DXlMkWfc.js → gitGraphDiagram-X574FWY7-D6IlhaVw.js} +1 -1
- package/dist/assets/{index-DzInGWYS.js → index-8kxlLBSL.js} +192 -192
- package/dist/assets/{index-B2U0UUX-.js → index-BHae7qZg.js} +1 -1
- package/dist/assets/{infoDiagram-VRGFBTTK-B4MLOatD.js → infoDiagram-VRGFBTTK-Bzmln_R1.js} +1 -1
- package/dist/assets/{ishikawaDiagram-OU5B5YK6-ccVErf8N.js → ishikawaDiagram-OU5B5YK6-DjC6Ebnm.js} +1 -1
- package/dist/assets/{journeyDiagram-ZHPQQLJL-B8-kD51p.js → journeyDiagram-ZHPQQLJL-BZcjSba_.js} +1 -1
- package/dist/assets/{kanban-definition-PNTS6WVX-Kegk_QSG.js → kanban-definition-PNTS6WVX-D1fUH5po.js} +1 -1
- package/dist/assets/{linear-CA_cRwMp.js → linear-BZyLEWc-.js} +1 -1
- package/dist/assets/{mermaid.core-DuwzJ1O8.js → mermaid.core-b0Fx0O9c.js} +5 -5
- package/dist/assets/{mindmap-definition-NLK3R4M7-DngsWKWx.js → mindmap-definition-NLK3R4M7-CAOdNH-r.js} +1 -1
- package/dist/assets/{pegDiagram-GJSIUBJH-BhVSGE6P.js → pegDiagram-GJSIUBJH-Dvprp14g.js} +1 -1
- package/dist/assets/{pieDiagram-5QR66LMP-C-NQpcBB.js → pieDiagram-5QR66LMP-C4KKLpO1.js} +1 -1
- package/dist/assets/{quadrantDiagram-O4NWA36T-urAENfOl.js → quadrantDiagram-O4NWA36T-D-UQvWqb.js} +1 -1
- package/dist/assets/{railroadDiagram-XR7U4H2S-BPyCQBVM.js → railroadDiagram-XR7U4H2S-C_0FI_wl.js} +1 -1
- package/dist/assets/{requirementDiagram-PLB6GJNP-CZDPK8ow.js → requirementDiagram-PLB6GJNP-DjnknP2J.js} +1 -1
- package/dist/assets/{sankeyDiagram-IPEJSGJF-BLkmCnNY.js → sankeyDiagram-IPEJSGJF-D4cjQCOy.js} +1 -1
- package/dist/assets/{sequenceDiagram-PO4LG4MO-DOnJsutQ.js → sequenceDiagram-PO4LG4MO-B4J0-U11.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-BTzltmsq.js → sizeCapture-INFHLROL-CufovZkq.js} +1 -1
- package/dist/assets/{stateDiagram-v2-GCMORJYK-dMgLAXwt.js → stateDiagram-v2-GCMORJYK-BVepbgUB.js} +1 -1
- package/dist/assets/{swimlanes-2SLR337P-d_KFeNnI.js → swimlanes-2SLR337P-Db7S_jMe.js} +1 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-DP7imcRc.js +8 -0
- package/dist/assets/{timeline-definition-EJHVYXUP-quo7Si9R.js → timeline-definition-EJHVYXUP-BU1uwVq3.js} +1 -1
- package/dist/assets/{usecaseDiagram-POWQR4AR-BPt91Frf.js → usecaseDiagram-POWQR4AR-B9Qmteyi.js} +1 -1
- package/dist/assets/{vennDiagram-UO4OBE2U-U_iYVkHo.js → vennDiagram-UO4OBE2U-Dp0ul1PV.js} +1 -1
- package/dist/assets/{wardleyDiagram-VNRHLVJA-Se__ees9.js → wardleyDiagram-VNRHLVJA-Claq9tTf.js} +1 -1
- package/dist/assets/{xychartDiagram-PMCCYNJV-D4CVeuAX.js → xychartDiagram-PMCCYNJV-CG3lYXXA.js} +1 -1
- package/dist/handbook/atomic-handbook.html +1 -1
- package/dist/index.html +1 -1
- package/dist-server/companion/src/routes.js +13 -5
- package/dist-server/container-mcp.js +40 -17
- package/dist-server/index.js +1951 -1967
- package/dist-server/openmausbot.js +69 -17
- package/dist-server/pair-cli.js +69 -17
- package/dist-server/server/app-installers.js +26 -15
- package/dist-server/server/approval-grants.js +1 -1
- package/dist-server/server/config.js +7 -7
- package/dist-server/server/container-computer.js +45 -45
- package/dist-server/server/drivers/claude.js +1 -19
- package/dist-server/server/drivers/session-allow-key.js +27 -0
- package/dist-server/server/index.js +13 -14
- package/dist-server/server/local-vm-inventory.js +19 -1
- package/dist-server/server/oauth-account-tools.js +1 -1
- package/dist-server/server/routes/accounts.js +1 -1
- package/dist-server/server/system-prompt.js +1 -1
- package/dist-server/shared/oauth-account-grants.js +4 -4
- package/dist-server/vps-container-mcp.js +27 -4
- package/package.json +1 -1
- package/dist/assets/channel-AilCgHWM.js +0 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-DUtZuLFb.js +0 -8
|
@@ -17941,7 +17941,7 @@ function saveConfig(patch, options = {}) {
|
|
|
17941
17941
|
const before = configSaveListeners.size ? structuredClone(disk) : disk;
|
|
17942
17942
|
const storedProfiles = storedBrowserProfilesSchema.safeParse(disk.browserProfiles);
|
|
17943
17943
|
if (storedProfiles.success) disk.browserProfiles = storedProfiles.data;
|
|
17944
|
-
for (const key of ["xai", "anthropic", "mistral", "ollamaCloud", "openaiCompat", "box", "opencodeGo", "tts", "imageGen", "profile", "icm", "nexusMemory", "paw", "rooms", "threads", "context", "localVm", "features", "addons", "budgets", "billing", "decisions", "onboarding", "browserEngine", "newBots"]) {
|
|
17944
|
+
for (const key of ["xai", "anthropic", "mistral", "ollamaCloud", "openaiCompat", "box", "opencodeGo", "tts", "imageGen", "profile", "icm", "nexusMemory", "paw", "rooms", "threads", "context", "localVm", "features", "addons", "budgets", "billing", "decisions", "onboarding", "browserEngine", "newBots", "oauthAccounts"]) {
|
|
17945
17945
|
const section = checkedPatch[key];
|
|
17946
17946
|
if (!section) continue;
|
|
17947
17947
|
const current = jsonObjectSchema.safeParse(disk[key]);
|
|
@@ -18539,10 +18539,10 @@ var init_config = __esm({
|
|
|
18539
18539
|
* outrank it. Written only through /api/hipaa, never a generic config patch. */
|
|
18540
18540
|
hipaa: external_exports.object({ enabled: external_exports.boolean().optional() }).optional(),
|
|
18541
18541
|
/** How company bots receive Google and Microsoft accounts connected under
|
|
18542
|
-
* Settings → Accounts.
|
|
18543
|
-
*
|
|
18544
|
-
*
|
|
18545
|
-
* touches how refresh tokens are stored. */
|
|
18542
|
+
* Settings → Accounts. Default is all-company-bots (Erick 2026-10-15):
|
|
18543
|
+
* every non-personal connected account works for every company bot, while
|
|
18544
|
+
* an explicit bot.accounts list still restricts. "opt-in" keeps the legacy
|
|
18545
|
+
* per-bot Access toggle. Never touches how refresh tokens are stored. */
|
|
18546
18546
|
oauthAccounts: external_exports.object({
|
|
18547
18547
|
botGrant: external_exports.enum(["opt-in", "all-company-bots"]).optional()
|
|
18548
18548
|
}).strict().optional(),
|
|
@@ -30322,6 +30322,56 @@ var init_boxagent = __esm({
|
|
|
30322
30322
|
}
|
|
30323
30323
|
});
|
|
30324
30324
|
|
|
30325
|
+
// server/approval-grants.ts
|
|
30326
|
+
function toolName(tool2) {
|
|
30327
|
+
return tool2.trim().replace(/^mcp__.+?__/i, "");
|
|
30328
|
+
}
|
|
30329
|
+
function bareTool(tool2) {
|
|
30330
|
+
return toolName(tool2).toLowerCase();
|
|
30331
|
+
}
|
|
30332
|
+
function collapse(text6) {
|
|
30333
|
+
return text6.trim().replace(/\s+/g, " ");
|
|
30334
|
+
}
|
|
30335
|
+
function isShellTool(tool2) {
|
|
30336
|
+
return SHELL_TOOL.test(bareTool(tool2));
|
|
30337
|
+
}
|
|
30338
|
+
function commandPrefix(summary) {
|
|
30339
|
+
const command = collapse(summary).replace(/^\$\s*/, "");
|
|
30340
|
+
if (!command || SHELL_META.test(command)) return null;
|
|
30341
|
+
const [program, sub] = command.split(" ");
|
|
30342
|
+
if (!program) return null;
|
|
30343
|
+
return sub && /^[a-z][\w-]*$/.test(sub) ? `${program} ${sub}` : program;
|
|
30344
|
+
}
|
|
30345
|
+
var ONCE_GRANT_TTL_MS, ALWAYS_GRANT_TTL_MS, SHELL_TOOL, SHELL_META;
|
|
30346
|
+
var init_approval_grants = __esm({
|
|
30347
|
+
"server/approval-grants.ts"() {
|
|
30348
|
+
"use strict";
|
|
30349
|
+
init_atomic();
|
|
30350
|
+
init_contracts();
|
|
30351
|
+
ONCE_GRANT_TTL_MS = 60 * 6e4;
|
|
30352
|
+
ALWAYS_GRANT_TTL_MS = 8 * 60 * 6e4;
|
|
30353
|
+
SHELL_TOOL = /(?:^|_)(?:bash|shell|sh|zsh|terminal|exec|exec_command|run_terminal_cmd|run_shell_command|local_shell|command|execute)$/i;
|
|
30354
|
+
SHELL_META = /[;&|`<>\n\r]|\$\(|\$\{/;
|
|
30355
|
+
}
|
|
30356
|
+
});
|
|
30357
|
+
|
|
30358
|
+
// server/drivers/session-allow-key.ts
|
|
30359
|
+
function sessionAllowKey(ask) {
|
|
30360
|
+
const tool2 = typeof ask.tool === "string" ? ask.tool.trim() : "";
|
|
30361
|
+
if (!tool2) return null;
|
|
30362
|
+
if (tool2.startsWith("mcp__")) return JSON.stringify(["tool", tool2]);
|
|
30363
|
+
const command = isShellTool(tool2) && typeof ask.input?.command === "string" ? commandPrefix(ask.input.command) : null;
|
|
30364
|
+
if (command) return JSON.stringify(["command", tool2, command]);
|
|
30365
|
+
const stable = (value) => Array.isArray(value) ? value.map(stable) : value && typeof value === "object" ? Object.fromEntries(Object.keys(value).sort().map((key) => [key, stable(value[key])])) : value;
|
|
30366
|
+
return JSON.stringify(["input", tool2, stable(ask.input ?? {})]);
|
|
30367
|
+
}
|
|
30368
|
+
var init_session_allow_key = __esm({
|
|
30369
|
+
"server/drivers/session-allow-key.ts"() {
|
|
30370
|
+
"use strict";
|
|
30371
|
+
init_approval_grants();
|
|
30372
|
+
}
|
|
30373
|
+
});
|
|
30374
|
+
|
|
30325
30375
|
// server/plan-policy.ts
|
|
30326
30376
|
function planToolAllowed(tool2) {
|
|
30327
30377
|
return typeof tool2 === "string" && PLAN_READ_TOOLS.includes(tool2);
|
|
@@ -31295,13 +31345,6 @@ function removePrivateTempDir(filePath) {
|
|
|
31295
31345
|
return false;
|
|
31296
31346
|
}
|
|
31297
31347
|
}
|
|
31298
|
-
function sessionAllowKey(ask) {
|
|
31299
|
-
const tool2 = typeof ask.tool === "string" ? ask.tool.trim() : "";
|
|
31300
|
-
if (!tool2) return null;
|
|
31301
|
-
if (tool2.startsWith("mcp__")) return JSON.stringify(["tool", tool2]);
|
|
31302
|
-
const stable = (value) => Array.isArray(value) ? value.map(stable) : value && typeof value === "object" ? Object.fromEntries(Object.keys(value).sort().map((key) => [key, stable(value[key])])) : value;
|
|
31303
|
-
return JSON.stringify(["input", tool2, stable(ask.input ?? {})]);
|
|
31304
|
-
}
|
|
31305
31348
|
function systemEndedReply(kind) {
|
|
31306
31349
|
return kind === "question" ? { behavior: "answer", message: "Atomic: the turn is ending \u2014 wrap up." } : { behavior: "deny", message: "Atomic: the turn ended" };
|
|
31307
31350
|
}
|
|
@@ -31560,6 +31603,7 @@ var CONNECTOR_CACHE_MS, CLAUDE_ACCOUNT_ENV_KEYS, DEFAULT_AUTOCOMPACT_TOKENS, CLA
|
|
|
31560
31603
|
var init_claude = __esm({
|
|
31561
31604
|
"server/drivers/claude.ts"() {
|
|
31562
31605
|
"use strict";
|
|
31606
|
+
init_session_allow_key();
|
|
31563
31607
|
init_plan_policy();
|
|
31564
31608
|
init_claude_message();
|
|
31565
31609
|
init_config();
|
|
@@ -62235,13 +62279,21 @@ var ALLOWED = [
|
|
|
62235
62279
|
{ method: "GET", path: /^\/api\/threads\/[\w-]+\/export$/ },
|
|
62236
62280
|
{ method: "POST", path: /^\/api\/threads\/[\w-]+\/respond$/ },
|
|
62237
62281
|
{ method: "GET", path: /^\/api\/search$/ },
|
|
62238
|
-
// Team Rooms through the paired computer
|
|
62239
|
-
// Section 8): read
|
|
62240
|
-
//
|
|
62241
|
-
//
|
|
62282
|
+
// Team Rooms and Channels through the paired computer
|
|
62283
|
+
// (docs/chibitek/team-room-plan.md, Section 8): read, reply, keep the read
|
|
62284
|
+
// position, make a room or channel, invite links, join from a link, add or
|
|
62285
|
+
// remove bots, remove people, leave or close, save to Nexus. The computer's
|
|
62286
|
+
// Chibitek sign-in does every one of these and the server checks who may.
|
|
62287
|
+
// A bot's share settings stay on the computer, like the rest of a bot's
|
|
62288
|
+
// settings; approvals are the bot's own cards, answered through /respond.
|
|
62242
62289
|
{ method: "GET", path: /^\/api\/team-rooms$/ },
|
|
62290
|
+
{ method: "POST", path: /^\/api\/team-rooms$/ },
|
|
62291
|
+
{ method: "POST", path: /^\/api\/team-rooms\/join(?:\/preview)?$/ },
|
|
62292
|
+
{ method: "DELETE", path: /^\/api\/team-rooms\/(?:invites|bots)\/[0-9a-f-]{36}$/ },
|
|
62243
62293
|
{ method: "GET", path: /^\/api\/team-rooms\/[0-9a-f-]{36}$/ },
|
|
62244
|
-
{ method: "POST", path: /^\/api\/team-rooms\/[0-9a-f-]{36}\/(?:messages|read)$/ },
|
|
62294
|
+
{ method: "POST", path: /^\/api\/team-rooms\/[0-9a-f-]{36}\/(?:messages|read|archive|leave|invites|bots|save-to-nexus)$/ },
|
|
62295
|
+
{ method: "GET", path: /^\/api\/team-rooms\/[0-9a-f-]{36}\/invites$/ },
|
|
62296
|
+
{ method: "DELETE", path: /^\/api\/team-rooms\/[0-9a-f-]{36}\/members\/[0-9a-f-]{36}$/ },
|
|
62245
62297
|
// App-owned profile images. Upload is image-only and capped at 10 MB by
|
|
62246
62298
|
// the harness; GET is a single bare generated filename, never a path.
|
|
62247
62299
|
{ method: "POST", path: /^\/api\/attachments$/ },
|
package/dist-server/pair-cli.js
CHANGED
|
@@ -17941,7 +17941,7 @@ function saveConfig(patch, options = {}) {
|
|
|
17941
17941
|
const before = configSaveListeners.size ? structuredClone(disk) : disk;
|
|
17942
17942
|
const storedProfiles = storedBrowserProfilesSchema.safeParse(disk.browserProfiles);
|
|
17943
17943
|
if (storedProfiles.success) disk.browserProfiles = storedProfiles.data;
|
|
17944
|
-
for (const key of ["xai", "anthropic", "mistral", "ollamaCloud", "openaiCompat", "box", "opencodeGo", "tts", "imageGen", "profile", "icm", "nexusMemory", "paw", "rooms", "threads", "context", "localVm", "features", "addons", "budgets", "billing", "decisions", "onboarding", "browserEngine", "newBots"]) {
|
|
17944
|
+
for (const key of ["xai", "anthropic", "mistral", "ollamaCloud", "openaiCompat", "box", "opencodeGo", "tts", "imageGen", "profile", "icm", "nexusMemory", "paw", "rooms", "threads", "context", "localVm", "features", "addons", "budgets", "billing", "decisions", "onboarding", "browserEngine", "newBots", "oauthAccounts"]) {
|
|
17945
17945
|
const section = checkedPatch[key];
|
|
17946
17946
|
if (!section) continue;
|
|
17947
17947
|
const current = jsonObjectSchema.safeParse(disk[key]);
|
|
@@ -18539,10 +18539,10 @@ var init_config = __esm({
|
|
|
18539
18539
|
* outrank it. Written only through /api/hipaa, never a generic config patch. */
|
|
18540
18540
|
hipaa: external_exports.object({ enabled: external_exports.boolean().optional() }).optional(),
|
|
18541
18541
|
/** How company bots receive Google and Microsoft accounts connected under
|
|
18542
|
-
* Settings → Accounts.
|
|
18543
|
-
*
|
|
18544
|
-
*
|
|
18545
|
-
* touches how refresh tokens are stored. */
|
|
18542
|
+
* Settings → Accounts. Default is all-company-bots (Erick 2026-10-15):
|
|
18543
|
+
* every non-personal connected account works for every company bot, while
|
|
18544
|
+
* an explicit bot.accounts list still restricts. "opt-in" keeps the legacy
|
|
18545
|
+
* per-bot Access toggle. Never touches how refresh tokens are stored. */
|
|
18546
18546
|
oauthAccounts: external_exports.object({
|
|
18547
18547
|
botGrant: external_exports.enum(["opt-in", "all-company-bots"]).optional()
|
|
18548
18548
|
}).strict().optional(),
|
|
@@ -30322,6 +30322,56 @@ var init_boxagent = __esm({
|
|
|
30322
30322
|
}
|
|
30323
30323
|
});
|
|
30324
30324
|
|
|
30325
|
+
// server/approval-grants.ts
|
|
30326
|
+
function toolName(tool2) {
|
|
30327
|
+
return tool2.trim().replace(/^mcp__.+?__/i, "");
|
|
30328
|
+
}
|
|
30329
|
+
function bareTool(tool2) {
|
|
30330
|
+
return toolName(tool2).toLowerCase();
|
|
30331
|
+
}
|
|
30332
|
+
function collapse(text6) {
|
|
30333
|
+
return text6.trim().replace(/\s+/g, " ");
|
|
30334
|
+
}
|
|
30335
|
+
function isShellTool(tool2) {
|
|
30336
|
+
return SHELL_TOOL.test(bareTool(tool2));
|
|
30337
|
+
}
|
|
30338
|
+
function commandPrefix(summary) {
|
|
30339
|
+
const command = collapse(summary).replace(/^\$\s*/, "");
|
|
30340
|
+
if (!command || SHELL_META.test(command)) return null;
|
|
30341
|
+
const [program, sub] = command.split(" ");
|
|
30342
|
+
if (!program) return null;
|
|
30343
|
+
return sub && /^[a-z][\w-]*$/.test(sub) ? `${program} ${sub}` : program;
|
|
30344
|
+
}
|
|
30345
|
+
var ONCE_GRANT_TTL_MS, ALWAYS_GRANT_TTL_MS, SHELL_TOOL, SHELL_META;
|
|
30346
|
+
var init_approval_grants = __esm({
|
|
30347
|
+
"server/approval-grants.ts"() {
|
|
30348
|
+
"use strict";
|
|
30349
|
+
init_atomic();
|
|
30350
|
+
init_contracts();
|
|
30351
|
+
ONCE_GRANT_TTL_MS = 60 * 6e4;
|
|
30352
|
+
ALWAYS_GRANT_TTL_MS = 8 * 60 * 6e4;
|
|
30353
|
+
SHELL_TOOL = /(?:^|_)(?:bash|shell|sh|zsh|terminal|exec|exec_command|run_terminal_cmd|run_shell_command|local_shell|command|execute)$/i;
|
|
30354
|
+
SHELL_META = /[;&|`<>\n\r]|\$\(|\$\{/;
|
|
30355
|
+
}
|
|
30356
|
+
});
|
|
30357
|
+
|
|
30358
|
+
// server/drivers/session-allow-key.ts
|
|
30359
|
+
function sessionAllowKey(ask) {
|
|
30360
|
+
const tool2 = typeof ask.tool === "string" ? ask.tool.trim() : "";
|
|
30361
|
+
if (!tool2) return null;
|
|
30362
|
+
if (tool2.startsWith("mcp__")) return JSON.stringify(["tool", tool2]);
|
|
30363
|
+
const command = isShellTool(tool2) && typeof ask.input?.command === "string" ? commandPrefix(ask.input.command) : null;
|
|
30364
|
+
if (command) return JSON.stringify(["command", tool2, command]);
|
|
30365
|
+
const stable = (value) => Array.isArray(value) ? value.map(stable) : value && typeof value === "object" ? Object.fromEntries(Object.keys(value).sort().map((key) => [key, stable(value[key])])) : value;
|
|
30366
|
+
return JSON.stringify(["input", tool2, stable(ask.input ?? {})]);
|
|
30367
|
+
}
|
|
30368
|
+
var init_session_allow_key = __esm({
|
|
30369
|
+
"server/drivers/session-allow-key.ts"() {
|
|
30370
|
+
"use strict";
|
|
30371
|
+
init_approval_grants();
|
|
30372
|
+
}
|
|
30373
|
+
});
|
|
30374
|
+
|
|
30325
30375
|
// server/plan-policy.ts
|
|
30326
30376
|
function planToolAllowed(tool2) {
|
|
30327
30377
|
return typeof tool2 === "string" && PLAN_READ_TOOLS.includes(tool2);
|
|
@@ -31295,13 +31345,6 @@ function removePrivateTempDir(filePath) {
|
|
|
31295
31345
|
return false;
|
|
31296
31346
|
}
|
|
31297
31347
|
}
|
|
31298
|
-
function sessionAllowKey(ask) {
|
|
31299
|
-
const tool2 = typeof ask.tool === "string" ? ask.tool.trim() : "";
|
|
31300
|
-
if (!tool2) return null;
|
|
31301
|
-
if (tool2.startsWith("mcp__")) return JSON.stringify(["tool", tool2]);
|
|
31302
|
-
const stable = (value) => Array.isArray(value) ? value.map(stable) : value && typeof value === "object" ? Object.fromEntries(Object.keys(value).sort().map((key) => [key, stable(value[key])])) : value;
|
|
31303
|
-
return JSON.stringify(["input", tool2, stable(ask.input ?? {})]);
|
|
31304
|
-
}
|
|
31305
31348
|
function systemEndedReply(kind) {
|
|
31306
31349
|
return kind === "question" ? { behavior: "answer", message: "Atomic: the turn is ending \u2014 wrap up." } : { behavior: "deny", message: "Atomic: the turn ended" };
|
|
31307
31350
|
}
|
|
@@ -31560,6 +31603,7 @@ var CONNECTOR_CACHE_MS, CLAUDE_ACCOUNT_ENV_KEYS, DEFAULT_AUTOCOMPACT_TOKENS, CLA
|
|
|
31560
31603
|
var init_claude = __esm({
|
|
31561
31604
|
"server/drivers/claude.ts"() {
|
|
31562
31605
|
"use strict";
|
|
31606
|
+
init_session_allow_key();
|
|
31563
31607
|
init_plan_policy();
|
|
31564
31608
|
init_claude_message();
|
|
31565
31609
|
init_config();
|
|
@@ -62235,13 +62279,21 @@ var ALLOWED = [
|
|
|
62235
62279
|
{ method: "GET", path: /^\/api\/threads\/[\w-]+\/export$/ },
|
|
62236
62280
|
{ method: "POST", path: /^\/api\/threads\/[\w-]+\/respond$/ },
|
|
62237
62281
|
{ method: "GET", path: /^\/api\/search$/ },
|
|
62238
|
-
// Team Rooms through the paired computer
|
|
62239
|
-
// Section 8): read
|
|
62240
|
-
//
|
|
62241
|
-
//
|
|
62282
|
+
// Team Rooms and Channels through the paired computer
|
|
62283
|
+
// (docs/chibitek/team-room-plan.md, Section 8): read, reply, keep the read
|
|
62284
|
+
// position, make a room or channel, invite links, join from a link, add or
|
|
62285
|
+
// remove bots, remove people, leave or close, save to Nexus. The computer's
|
|
62286
|
+
// Chibitek sign-in does every one of these and the server checks who may.
|
|
62287
|
+
// A bot's share settings stay on the computer, like the rest of a bot's
|
|
62288
|
+
// settings; approvals are the bot's own cards, answered through /respond.
|
|
62242
62289
|
{ method: "GET", path: /^\/api\/team-rooms$/ },
|
|
62290
|
+
{ method: "POST", path: /^\/api\/team-rooms$/ },
|
|
62291
|
+
{ method: "POST", path: /^\/api\/team-rooms\/join(?:\/preview)?$/ },
|
|
62292
|
+
{ method: "DELETE", path: /^\/api\/team-rooms\/(?:invites|bots)\/[0-9a-f-]{36}$/ },
|
|
62243
62293
|
{ method: "GET", path: /^\/api\/team-rooms\/[0-9a-f-]{36}$/ },
|
|
62244
|
-
{ method: "POST", path: /^\/api\/team-rooms\/[0-9a-f-]{36}\/(?:messages|read)$/ },
|
|
62294
|
+
{ method: "POST", path: /^\/api\/team-rooms\/[0-9a-f-]{36}\/(?:messages|read|archive|leave|invites|bots|save-to-nexus)$/ },
|
|
62295
|
+
{ method: "GET", path: /^\/api\/team-rooms\/[0-9a-f-]{36}\/invites$/ },
|
|
62296
|
+
{ method: "DELETE", path: /^\/api\/team-rooms\/[0-9a-f-]{36}\/members\/[0-9a-f-]{36}$/ },
|
|
62245
62297
|
// App-owned profile images. Upload is image-only and capped at 10 MB by
|
|
62246
62298
|
// the harness; GET is a single bare generated filename, never a path.
|
|
62247
62299
|
{ method: "POST", path: /^\/api\/attachments$/ },
|
|
@@ -32,8 +32,10 @@ export const APP_INSTALLERS = Object.freeze({
|
|
|
32
32
|
ollama: { repo: "ollama/ollama", asset: () => "Ollama-darwin.zip", teamId: "3MU9H2V9Y9", kind: "zip-app", appName: "Ollama.app" },
|
|
33
33
|
podman: {
|
|
34
34
|
repo: "podman-container-tools/podman",
|
|
35
|
-
//
|
|
36
|
-
|
|
35
|
+
// Intel stays on the supported 5.8 maintenance line (through June 2027).
|
|
36
|
+
// Update this reviewed pin for security releases; never resolve Intel via latest.
|
|
37
|
+
asset: (arch) => arch === "arm64" ? "podman-installer-macos-arm64.pkg" : arch === "x64" ? "podman-installer-macos-amd64.pkg" : null,
|
|
38
|
+
releaseTag: (arch) => arch === "x64" ? "v5.8.10" : undefined,
|
|
37
39
|
teamId: "HYSCB8KRL2",
|
|
38
40
|
kind: "pkg",
|
|
39
41
|
},
|
|
@@ -65,9 +67,10 @@ export async function latestReleaseAsset(spec, arch, fetchImpl = fetch, signal)
|
|
|
65
67
|
const name = spec.asset(arch);
|
|
66
68
|
if (!name)
|
|
67
69
|
throw new AppInstallError("unsupported", `No ${spec.repo} installer is published for ${arch} computers.`);
|
|
70
|
+
const tag = spec.releaseTag?.(arch);
|
|
68
71
|
let response;
|
|
69
72
|
try {
|
|
70
|
-
response = await fetchImpl(`https://api.github.com/repos/${spec.repo}/releases
|
|
73
|
+
response = await fetchImpl(`https://api.github.com/repos/${spec.repo}/releases/${tag ? `tags/${encodeURIComponent(tag)}` : "latest"}`, {
|
|
71
74
|
headers: { accept: "application/vnd.github+json", "user-agent": "Atomic" },
|
|
72
75
|
redirect: "follow",
|
|
73
76
|
signal: signal ?? AbortSignal.timeout(30_000),
|
|
@@ -349,22 +352,30 @@ export async function openPodmanInstaller(deps = {}) {
|
|
|
349
352
|
}
|
|
350
353
|
/** After Podman is installed: create and start its virtual machine. The first
|
|
351
354
|
* `machine init` downloads the machine image, so it gets a long timeout. */
|
|
352
|
-
export async function startPodmanMachine(podman, run = (command, args) => runTool(command, args, 30 * 60_000)) {
|
|
353
|
-
const list = await run(podman, ["machine", "list", "--format", "json"]).catch(() => ({ stdout: "[]", stderr: "" }));
|
|
354
|
-
let machines = [];
|
|
355
|
+
export async function startPodmanMachine(podman, run = (command, args) => runTool(command, args, args[0] === "info" || args[1] === "list" ? 10_000 : 30 * 60_000)) {
|
|
355
356
|
try {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
machines
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
if (!machines.length)
|
|
357
|
+
// An unreadable list is not an empty list: never initialize over an error.
|
|
358
|
+
const { stdout } = await run(podman, ["machine", "list", "--format", "json"]);
|
|
359
|
+
const machines = JSON.parse(stdout);
|
|
360
|
+
if (!Array.isArray(machines) || machines.some(machine => !machine || typeof machine.Name !== "string" || typeof machine.Running !== "boolean")) {
|
|
361
|
+
throw new Error("Podman returned an unreadable machine list. Retry from Settings > Computers.");
|
|
362
|
+
}
|
|
363
|
+
if (!machines.length) {
|
|
363
364
|
await run(podman, ["machine", "init"]);
|
|
364
|
-
if (!machines.some((machine) => machine.Running))
|
|
365
365
|
await run(podman, ["machine", "start"]);
|
|
366
|
+
}
|
|
367
|
+
else if (!machines.some(machine => machine.Running)) {
|
|
368
|
+
// Start an existing default (or the sole machine), never a second machine
|
|
369
|
+
// beside a custom setup. Ambiguity needs the person's Podman selection.
|
|
370
|
+
const machine = machines.find(machine => machine.Default === true || machine.Name === "podman-machine-default") ?? (machines.length === 1 ? machines[0] : undefined);
|
|
371
|
+
if (!machine)
|
|
372
|
+
throw new Error("Choose a default machine in Podman Desktop, then retry here.");
|
|
373
|
+
await run(podman, ["machine", "start", machine.Name]);
|
|
374
|
+
}
|
|
375
|
+
// A running flag does not prove the engine is reachable by this connection.
|
|
376
|
+
await run(podman, ["info", "--format", "json"]);
|
|
366
377
|
}
|
|
367
378
|
catch (error) {
|
|
368
|
-
throw new AppInstallError("install", `${error.stderr
|
|
379
|
+
throw new AppInstallError("install", `${error.stderr || String(error)}`.trim());
|
|
369
380
|
}
|
|
370
381
|
}
|
|
@@ -65,7 +65,7 @@ function words(tool) {
|
|
|
65
65
|
function collapse(text) {
|
|
66
66
|
return text.trim().replace(/\s+/g, " ");
|
|
67
67
|
}
|
|
68
|
-
function isShellTool(tool) {
|
|
68
|
+
export function isShellTool(tool) {
|
|
69
69
|
return SHELL_TOOL.test(bareTool(tool));
|
|
70
70
|
}
|
|
71
71
|
/** Why no grant may ever answer this request, or null. Checked when a grant
|
|
@@ -531,10 +531,10 @@ const appConfigSchema = z.object({
|
|
|
531
531
|
* outrank it. Written only through /api/hipaa, never a generic config patch. */
|
|
532
532
|
hipaa: z.object({ enabled: z.boolean().optional() }).optional(),
|
|
533
533
|
/** How company bots receive Google and Microsoft accounts connected under
|
|
534
|
-
* Settings → Accounts.
|
|
535
|
-
*
|
|
536
|
-
*
|
|
537
|
-
* touches how refresh tokens are stored. */
|
|
534
|
+
* Settings → Accounts. Default is all-company-bots (Erick 2026-10-15):
|
|
535
|
+
* every non-personal connected account works for every company bot, while
|
|
536
|
+
* an explicit bot.accounts list still restricts. "opt-in" keeps the legacy
|
|
537
|
+
* per-bot Access toggle. Never touches how refresh tokens are stored. */
|
|
538
538
|
oauthAccounts: z.object({
|
|
539
539
|
botGrant: z.enum(["opt-in", "all-company-bots"]).optional(),
|
|
540
540
|
}).strict().optional(),
|
|
@@ -732,9 +732,9 @@ export function teamRoomsEnabled(cfg) {
|
|
|
732
732
|
* the person switched it on under Plugins → MCP servers; the Claude driver
|
|
733
733
|
* then omits --strict-mcp-config while keeping skills, hooks and the
|
|
734
734
|
* personal CLAUDE.md out. */
|
|
735
|
-
/** How company bots receive connected Google/Microsoft accounts.
|
|
735
|
+
/** How company bots receive connected Google/Microsoft accounts. Default all-company-bots; "opt-in" keeps the legacy per-bot toggle. */
|
|
736
736
|
export function accountBotGrantPolicy(cfg) {
|
|
737
|
-
return cfg.oauthAccounts?.botGrant === "
|
|
737
|
+
return cfg.oauthAccounts?.botGrant === "opt-in" ? "opt-in" : "all-company-bots";
|
|
738
738
|
}
|
|
739
739
|
export function claudeUserMcpEnabled(cfg) {
|
|
740
740
|
return cfg.features?.claudeUserMcp === true;
|
|
@@ -1134,7 +1134,7 @@ export function saveConfig(patch, options = {}) {
|
|
|
1134
1134
|
const storedProfiles = storedBrowserProfilesSchema.safeParse(disk.browserProfiles);
|
|
1135
1135
|
if (storedProfiles.success)
|
|
1136
1136
|
disk.browserProfiles = storedProfiles.data;
|
|
1137
|
-
for (const key of ["xai", "anthropic", "mistral", "ollamaCloud", "openaiCompat", "box", "opencodeGo", "tts", "imageGen", "profile", "icm", "nexusMemory", "paw", "rooms", "threads", "context", "localVm", "features", "addons", "budgets", "billing", "decisions", "onboarding", "browserEngine", "newBots"]) {
|
|
1137
|
+
for (const key of ["xai", "anthropic", "mistral", "ollamaCloud", "openaiCompat", "box", "opencodeGo", "tts", "imageGen", "profile", "icm", "nexusMemory", "paw", "rooms", "threads", "context", "localVm", "features", "addons", "budgets", "billing", "decisions", "onboarding", "browserEngine", "newBots", "oauthAccounts"]) {
|
|
1138
1138
|
const section = checkedPatch[key];
|
|
1139
1139
|
if (!section)
|
|
1140
1140
|
continue;
|
|
@@ -12,7 +12,8 @@ import { tmpdir } from "node:os";
|
|
|
12
12
|
import { dirname, join, resolve } from "node:path";
|
|
13
13
|
import { promisify } from "node:util";
|
|
14
14
|
import { augmentedPath, resolveCliSpawn } from "./env-path.js";
|
|
15
|
-
import {
|
|
15
|
+
import { dockerEnvForColima } from "./colima-docker.js";
|
|
16
|
+
import { startPodmanMachine, AppInstallError } from "./app-installers.js";
|
|
16
17
|
import { spawnOptionsFor } from "./spawn-command.js";
|
|
17
18
|
import { DATA_DIR } from "./config.js";
|
|
18
19
|
import { SPAWNED_PROXIES } from "./proxy-paths.js";
|
|
@@ -53,25 +54,25 @@ const MEMORY_BYTES = 4 * 1024 * 1024 * 1024;
|
|
|
53
54
|
const NANO_CPUS = 2_000_000_000;
|
|
54
55
|
const PIDS_LIMIT = 512;
|
|
55
56
|
const SHM_BYTES = 512 * 1024 * 1024;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
/** Macs run Local VMs only under Podman. Older Docker or Colima desktops keep
|
|
58
|
+
* their folders, containers and port 6080: Podman ones get their own empty
|
|
59
|
+
* `vm-homes/podman-*` folders (backup and restore already cover vm-homes),
|
|
60
|
+
* container names and an ephemeral loopback viewer port. */
|
|
61
|
+
export const PODMAN_MAC_PREFIX = "podman-";
|
|
62
|
+
const separatePodman = (platform) => platform === "darwin";
|
|
63
|
+
export function sharedLocalVmTarget(platform = process.platform) {
|
|
64
|
+
if (!separatePodman(platform))
|
|
65
|
+
return { key: "shared", containerName: CONTAINER, workspaceDir: VM_WORKSPACE_DIR, viewerPort: HOST_VIEWER_PORT, label: "shared" };
|
|
66
|
+
const name = `${PODMAN_MAC_PREFIX}shared`;
|
|
67
|
+
return { key: "shared", containerName: `${CONTAINER}-${name}`, workspaceDir: join(DATA_DIR, "vm-homes", name), viewerPort: null, label: "shared" };
|
|
68
|
+
}
|
|
69
|
+
export const SHARED_LOCAL_VM_TARGET = sharedLocalVmTarget();
|
|
63
70
|
/** Derive filesystem/container identities from a digest, never from a bot's
|
|
64
71
|
* display name or caller-controlled path fragment. */
|
|
65
|
-
export function perBotLocalVmTarget(botId) {
|
|
72
|
+
export function perBotLocalVmTarget(botId, platform = process.platform) {
|
|
66
73
|
const digest = createHash("sha256").update(botId).digest("hex");
|
|
67
|
-
const short = digest.slice(0, 16)
|
|
68
|
-
return {
|
|
69
|
-
key: `bot:${digest}`,
|
|
70
|
-
containerName: `${CONTAINER}-${short}`,
|
|
71
|
-
workspaceDir: join(DATA_DIR, "vm-homes", short),
|
|
72
|
-
viewerPort: null,
|
|
73
|
-
label: digest,
|
|
74
|
-
};
|
|
74
|
+
const short = `${separatePodman(platform) ? PODMAN_MAC_PREFIX : ""}${digest.slice(0, 16)}`;
|
|
75
|
+
return { key: `bot:${digest}`, containerName: `${CONTAINER}-${short}`, workspaceDir: join(DATA_DIR, "vm-homes", short), viewerPort: null, label: digest };
|
|
75
76
|
}
|
|
76
77
|
const LINUX_WHEELS = {
|
|
77
78
|
x86_64: {
|
|
@@ -211,12 +212,10 @@ async function installed(cmd, runner, platform) {
|
|
|
211
212
|
/** Inspect only the host runtime. Unlike a full Local VM status check, this
|
|
212
213
|
* never opens a container, calls Cua, or reads a desktop screenshot. */
|
|
213
214
|
export async function containerRuntimeStatus(runner = sh, platform = process.platform) {
|
|
214
|
-
//
|
|
215
|
-
//
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
? ["podman", "docker"]
|
|
219
|
-
: RUNTIMES.filter((runtime) => runtime !== "container" || platform === "darwin");
|
|
215
|
+
// Macs use only Podman, including when stopped or absent. Falling back to a
|
|
216
|
+
// healthy Docker/Colima silently selects a different image/workspace store.
|
|
217
|
+
const candidates = platform === "darwin" ? ["podman"]
|
|
218
|
+
: platform === "win32" ? ["podman", "docker"] : ["docker", "podman"];
|
|
220
219
|
const present = await Promise.all(candidates.map((runtime) => installed(runtime, runner, platform)));
|
|
221
220
|
const available = candidates.filter((_, index) => present[index]);
|
|
222
221
|
const healthy = await Promise.all(available.map(async (candidate) => {
|
|
@@ -240,22 +239,13 @@ export async function containerRuntimeStatus(runner = sh, platform = process.pla
|
|
|
240
239
|
daemonUp: healthyIndex >= 0,
|
|
241
240
|
};
|
|
242
241
|
}
|
|
243
|
-
/** How this machine's stopped Docker engine is started, or null when Atomic
|
|
244
|
-
* must not try: Colima on a Mac where it is installed, never Docker Desktop
|
|
245
|
-
* on any platform (colima-docker.ts). Linux needs root for the daemon and
|
|
246
|
-
* Windows runs the Local VM on Podman, so neither is started here. */
|
|
247
|
-
export async function containerRuntimeStartPlan(runner = sh, platform = process.platform, env = process.env) {
|
|
248
|
-
return platform === "darwin" && await installed("colima", runner, platform) ? colimaStartPlan(env) : null;
|
|
249
|
-
}
|
|
250
242
|
let runtimeStartInFlight = null;
|
|
251
243
|
let runtimeStartError = null;
|
|
252
|
-
/** Why the last start
|
|
244
|
+
/** Why the last start failed; cleared after Podman answers. */
|
|
253
245
|
export const containerRuntimeError = () => runtimeStartError;
|
|
254
|
-
/** Start
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
* a time: concurrent callers (startup and a turn) share the same attempt.
|
|
258
|
-
* Callers decide whether the person allowed it; this only does it. */
|
|
246
|
+
/** Start installed Podman on macOS using the same setup path as the GUI.
|
|
247
|
+
* Never installs a runtime or touches another runtime's machines or data.
|
|
248
|
+
* Startup and explicit setup share one attempt; failure allows a later retry. */
|
|
259
249
|
export function ensureContainerRuntime(opts = {}) {
|
|
260
250
|
if (runtimeStartInFlight)
|
|
261
251
|
return runtimeStartInFlight;
|
|
@@ -263,10 +253,19 @@ export function ensureContainerRuntime(opts = {}) {
|
|
|
263
253
|
const runner = opts.runner ?? sh;
|
|
264
254
|
const platform = opts.platform ?? process.platform;
|
|
265
255
|
const before = await containerRuntimeStatus(runner, platform);
|
|
266
|
-
if (before.daemonUp || before.runtime !== "
|
|
256
|
+
if (before.daemonUp || platform !== "darwin" || before.runtime !== "podman") {
|
|
267
257
|
return { status: before, started: null, error: null };
|
|
268
|
-
|
|
269
|
-
|
|
258
|
+
}
|
|
259
|
+
try {
|
|
260
|
+
await startPodmanMachine("podman", async (command, args) => ({
|
|
261
|
+
...await runner(command, args, args[0] === "info" || args[1] === "list" ? 10_000 : 30 * 60_000), stderr: "",
|
|
262
|
+
}));
|
|
263
|
+
const status = await containerRuntimeStatus(runner, platform);
|
|
264
|
+
return { status, started: "Podman", error: status.daemonUp ? null : "Podman is not answering. Retry from Settings > Computers." };
|
|
265
|
+
}
|
|
266
|
+
catch (error) {
|
|
267
|
+
return { status: before, started: "Podman", error: error instanceof AppInstallError ? error.detail : String(error) };
|
|
268
|
+
}
|
|
270
269
|
})();
|
|
271
270
|
runtimeStartInFlight = attempt;
|
|
272
271
|
void attempt.then((outcome) => { runtimeStartError = outcome.status.daemonUp ? null : outcome.error; }, () => { });
|
|
@@ -429,7 +428,7 @@ export function cuaExecArgs(args, options = {}) {
|
|
|
429
428
|
...args,
|
|
430
429
|
];
|
|
431
430
|
}
|
|
432
|
-
export async function containerComputerStatus(runner = sh, platform = process.platform, target =
|
|
431
|
+
export async function containerComputerStatus(runner = sh, platform = process.platform, target = sharedLocalVmTarget(platform)) {
|
|
433
432
|
const status = emptyStatus(platform, target);
|
|
434
433
|
const runtimeStatus = await containerRuntimeStatus(runner, platform);
|
|
435
434
|
status.available = runtimeStatus.available;
|
|
@@ -767,7 +766,7 @@ async function prepareManagedImage(runtime, runner) {
|
|
|
767
766
|
await rm(context, { recursive: true, force: true });
|
|
768
767
|
}
|
|
769
768
|
}
|
|
770
|
-
export async function containerComputerAction(action, runner = sh, platform = process.platform, target =
|
|
769
|
+
export async function containerComputerAction(action, runner = sh, platform = process.platform, target = sharedLocalVmTarget(platform)) {
|
|
771
770
|
if (runner === sh && platform === process.platform)
|
|
772
771
|
screenshotStatusCache.delete(target.key);
|
|
773
772
|
const before = await containerComputerStatus(runner, platform, target);
|
|
@@ -857,7 +856,7 @@ export function wholeScreenshot(bytes) {
|
|
|
857
856
|
/** The raw frame, in the shape the live screen poller broadcasts to every
|
|
858
857
|
* client (server/index.ts). The web panel wants a data URL instead, so
|
|
859
858
|
* containerComputerScreenshot below wraps this one. */
|
|
860
|
-
export async function containerComputerFrame(runner = sh, platform = process.platform, target =
|
|
859
|
+
export async function containerComputerFrame(runner = sh, platform = process.platform, target = sharedLocalVmTarget(platform)) {
|
|
861
860
|
const cacheable = runner === sh && platform === process.platform;
|
|
862
861
|
const now = Date.now();
|
|
863
862
|
const cached = screenshotStatusCache.get(target.key);
|
|
@@ -896,7 +895,7 @@ export async function containerComputerFrame(runner = sh, platform = process.pla
|
|
|
896
895
|
throw error;
|
|
897
896
|
}
|
|
898
897
|
}
|
|
899
|
-
export async function containerComputerScreenshot(runner = sh, platform = process.platform, target =
|
|
898
|
+
export async function containerComputerScreenshot(runner = sh, platform = process.platform, target = sharedLocalVmTarget(platform)) {
|
|
900
899
|
const { png, format } = await containerComputerFrame(runner, platform, target);
|
|
901
900
|
return `data:image/${format};base64,${png}`;
|
|
902
901
|
}
|
|
@@ -908,7 +907,8 @@ const screenshotStatusCache = new Map();
|
|
|
908
907
|
* capture keeps warm (at most SCREENSHOT_STATUS_TTL_MS old; any failed
|
|
909
908
|
* capture or lifecycle action drops it) answers instead; anything else is
|
|
910
909
|
* checked fresh, so a VM that comes up is noticed on the next poll. */
|
|
911
|
-
export async function recentContainerComputerStatus(target
|
|
910
|
+
export async function recentContainerComputerStatus(target, runner = sh, platform = process.platform, cache = runner === sh && platform === process.platform ? screenshotStatusCache : null) {
|
|
911
|
+
target ??= sharedLocalVmTarget(platform);
|
|
912
912
|
const cached = cache?.get(target.key);
|
|
913
913
|
if (cached && cached.expiresAt > Date.now())
|
|
914
914
|
return cached.status;
|
|
@@ -944,7 +944,7 @@ export function containerComputerMcp(runtime, control, target = SHARED_LOCAL_VM_
|
|
|
944
944
|
}
|
|
945
945
|
/** Commands shown as a transparent fallback. Normal setup builds the pinned
|
|
946
946
|
* derivative through the API, so users do not need to author a Dockerfile. */
|
|
947
|
-
export function setupCommands(runtime, platform = process.platform, target =
|
|
947
|
+
export function setupCommands(runtime, platform = process.platform, target = sharedLocalVmTarget(platform)) {
|
|
948
948
|
const install = platform === "darwin"
|
|
949
949
|
? "brew install podman; podman machine init; podman machine start"
|
|
950
950
|
: platform === "win32"
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sessionAllowKey } from "./session-allow-key.js";
|
|
1
2
|
import { claudePlanHook, planToolAllowed, PLAN_REFUSAL } from "../plan-policy.js";
|
|
2
3
|
import { firstText } from "./claude-message.js";
|
|
3
4
|
// Claude driver — upstream ClaudeDriver skeleton over agentcal's
|
|
@@ -431,25 +432,6 @@ function removePrivateTempDir(filePath) {
|
|
|
431
432
|
const DENY_TIMEOUT_NOTE = "Atomic: nobody answered this permission request in time. Skip this action and finish what you can without it.";
|
|
432
433
|
const QUESTION_TIMEOUT_NOTE = "Atomic: nobody answered in time. Use your best judgment and continue.";
|
|
433
434
|
const DUPLICATE_ASK_ID_NOTE = "Atomic: duplicate ask id — skipping this request.";
|
|
434
|
-
/** What "this action" means for "Always allow this session". The claude CLI
|
|
435
|
-
* calls --permission-prompt-tool with only tool_name, input and tool_use_id,
|
|
436
|
-
* never its own suggested rules, so the harness keeps the allow itself. An
|
|
437
|
-
* MCP tool is allowed by name, the rule Claude would have suggested for it;
|
|
438
|
-
* every other tool (Bash, Edit, WebFetch...) only for this exact input, keys
|
|
439
|
-
* sorted so two identical asks key alike. null when the ask names no tool. */
|
|
440
|
-
export function sessionAllowKey(ask) {
|
|
441
|
-
const tool = typeof ask.tool === "string" ? ask.tool.trim() : "";
|
|
442
|
-
if (!tool)
|
|
443
|
-
return null;
|
|
444
|
-
if (tool.startsWith("mcp__"))
|
|
445
|
-
return JSON.stringify(["tool", tool]);
|
|
446
|
-
const stable = (value) => Array.isArray(value)
|
|
447
|
-
? value.map(stable)
|
|
448
|
-
: value && typeof value === "object"
|
|
449
|
-
? Object.fromEntries(Object.keys(value).sort().map((key) => [key, stable(value[key])]))
|
|
450
|
-
: value;
|
|
451
|
-
return JSON.stringify(["input", tool, stable(ask.input ?? {})]);
|
|
452
|
-
}
|
|
453
435
|
/** The system-source reply for an ask that outlives the turn — used both to
|
|
454
436
|
* drain in-flight `pending` asks on close() and to answer one that arrives
|
|
455
437
|
* on an already-closed broker (see the `closed` branch below). */
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { commandPrefix, isShellTool } from "../approval-grants.js";
|
|
2
|
+
/** What "this action" means for "Always allow this session". The claude CLI
|
|
3
|
+
* calls --permission-prompt-tool with only tool_name, input and tool_use_id,
|
|
4
|
+
* never its own suggested rules, so the harness keeps the allow itself. An
|
|
5
|
+
* MCP tool is allowed by name, the rule Claude would have suggested for it.
|
|
6
|
+
* A shell command is allowed by its program and subcommand (`git push`,
|
|
7
|
+
* `pnpm test`), the same scope a delegated Always allow covers
|
|
8
|
+
* (approval-grants commandPrefix); a command that chains or redirects keeps
|
|
9
|
+
* to its exact text. Every other tool (Edit, WebFetch...) only for this
|
|
10
|
+
* exact input, keys sorted so two identical asks key alike. null when the
|
|
11
|
+
* ask names no tool. */
|
|
12
|
+
export function sessionAllowKey(ask) {
|
|
13
|
+
const tool = typeof ask.tool === "string" ? ask.tool.trim() : "";
|
|
14
|
+
if (!tool)
|
|
15
|
+
return null;
|
|
16
|
+
if (tool.startsWith("mcp__"))
|
|
17
|
+
return JSON.stringify(["tool", tool]);
|
|
18
|
+
const command = isShellTool(tool) && typeof ask.input?.command === "string" ? commandPrefix(ask.input.command) : null;
|
|
19
|
+
if (command)
|
|
20
|
+
return JSON.stringify(["command", tool, command]);
|
|
21
|
+
const stable = (value) => Array.isArray(value)
|
|
22
|
+
? value.map(stable)
|
|
23
|
+
: value && typeof value === "object"
|
|
24
|
+
? Object.fromEntries(Object.keys(value).sort().map((key) => [key, stable(value[key])]))
|
|
25
|
+
: value;
|
|
26
|
+
return JSON.stringify(["input", tool, stable(ask.input ?? {})]);
|
|
27
|
+
}
|