@chibitek/chibi 0.1.180 → 0.1.183
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-C91sfqR5.js → abnfDiagram-O67JEVCF-BJRKA6IQ.js} +1 -1
- package/dist/assets/{arc-ywHVvcgD.js → arc-CZc_uW-u.js} +1 -1
- package/dist/assets/{architectureDiagram-NJMV4G6O-BgUERWVi.js → architectureDiagram-NJMV4G6O-DNLaTXeO.js} +1 -1
- package/dist/assets/{blockDiagram-BEXU5L5S-CpeTJJap.js → blockDiagram-BEXU5L5S-DLXsik0_.js} +1 -1
- package/dist/assets/{c4Diagram-YGBWAQC7-BgdM3M47.js → c4Diagram-YGBWAQC7-DG6hN1C0.js} +1 -1
- package/dist/assets/channel-DmcLphYK.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-BcMR6SsJ.js → chunk-2Q5K7J3B-D5Yjh7-1.js} +1 -1
- package/dist/assets/{chunk-3FUC2YCW-DNzXM7Mm.js → chunk-3FUC2YCW-Bxyjopy0.js} +2 -2
- package/dist/assets/{chunk-5VM5RSS4-kVNi7GcP.js → chunk-5VM5RSS4-DDQZDrcU.js} +1 -1
- package/dist/assets/{chunk-GTNCS2PH-B5bYzLKn.js → chunk-GTNCS2PH-OwVykJDf.js} +1 -1
- package/dist/assets/{chunk-GWA4HPMP-DiMuTVC6.js → chunk-GWA4HPMP-BJRJdRRn.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-Bl2yeh-K.js → chunk-JWPE2WC7-D0rQf2t4.js} +1 -1
- package/dist/assets/{chunk-NETBCI7D-Klel5WGa.js → chunk-NETBCI7D-DbgIhGxq.js} +1 -1
- package/dist/assets/{chunk-WEXAMYUT-CPIykbsI.js → chunk-WEXAMYUT-NVC6qgIT.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-8cVOBFNO.js → chunk-XXDRQBXY-B9iYAoH7.js} +1 -1
- package/dist/assets/{classDiagram-v2-NBCMYWYE-DxDpAPju.js → classDiagram-v2-NBCMYWYE-Cma68soF.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-Bb935SMz.js → cose-bilkent-JH36ORCC-BrXaARl8.js} +1 -1
- package/dist/assets/{cynefin-OW5HDTMX-CxYWe3QR.js → cynefin-OW5HDTMX-DaxVySTi.js} +1 -1
- package/dist/assets/{cynefinDiagram-VND7K2PF-CYhyAhYv.js → cynefinDiagram-VND7K2PF-BhqakyPn.js} +1 -1
- package/dist/assets/{dagre-6A5THRUB-Bb41Vmni.js → dagre-6A5THRUB-C1GSPYtM.js} +1 -1
- package/dist/assets/{diagram-22UHCM2B-BNvUBpgi.js → diagram-22UHCM2B-BJ3lUPTt.js} +1 -1
- package/dist/assets/{diagram-3UASUU5V-D9x2CdxS.js → diagram-3UASUU5V-B15DdW5N.js} +1 -1
- package/dist/assets/{diagram-ATOU4E4O-BXIrC_GF.js → diagram-ATOU4E4O-CXiw2lST.js} +1 -1
- package/dist/assets/{diagram-CDSNMT55-OI4ao0qQ.js → diagram-CDSNMT55-DoqH99bW.js} +1 -1
- package/dist/assets/{diagram-MLGK6HIB-_zZZdxaC.js → diagram-MLGK6HIB-snN4K-CB.js} +1 -1
- package/dist/assets/{diagram-MPIPVDR6-9k65oUfK.js → diagram-MPIPVDR6-DgJvwpZO.js} +1 -1
- package/dist/assets/{ebnfDiagram-ZINNZB2B-Chvztd4J.js → ebnfDiagram-ZINNZB2B-AO646Cux.js} +1 -1
- package/dist/assets/{elk-276RUBZZ-CMWtKZmi.js → elk-276RUBZZ-BQwiFuXz.js} +1 -1
- package/dist/assets/{erDiagram-OPXOYQCR-2vqBM9HW.js → erDiagram-OPXOYQCR-B5VI88HR.js} +1 -1
- package/dist/assets/{flowDiagram-KWPJA3E3-C6y9L478.js → flowDiagram-KWPJA3E3-BNaAddPG.js} +1 -1
- package/dist/assets/{ganttDiagram-FUAMR5RP-uWHpQwJY.js → ganttDiagram-FUAMR5RP-C_ZoEfA5.js} +1 -1
- package/dist/assets/{gitGraphDiagram-X574FWY7-BLM0_X6z.js → gitGraphDiagram-X574FWY7-xthNWdmM.js} +1 -1
- package/dist/assets/{index-YJUVFbCT.js → index-ASohJJer.js} +1 -1
- package/dist/assets/{index-CPnrJ6T1.js → index-DmYwoh4R.js} +152 -152
- package/dist/assets/{infoDiagram-VRGFBTTK-DWeJ1wdL.js → infoDiagram-VRGFBTTK-Qhrkz09J.js} +1 -1
- package/dist/assets/{ishikawaDiagram-OU5B5YK6-R28kPwvB.js → ishikawaDiagram-OU5B5YK6-DzU3-GrV.js} +1 -1
- package/dist/assets/{journeyDiagram-ZHPQQLJL-BHWE5-BX.js → journeyDiagram-ZHPQQLJL-Dif-aG4a.js} +1 -1
- package/dist/assets/{kanban-definition-PNTS6WVX-M-Er9io8.js → kanban-definition-PNTS6WVX-NJ0l6rbK.js} +1 -1
- package/dist/assets/{linear-UI6pE8Wd.js → linear-DpEaZ_8H.js} +1 -1
- package/dist/assets/{mermaid.core-B_hsjjFv.js → mermaid.core-DOBTmT-1.js} +5 -5
- package/dist/assets/{mindmap-definition-NLK3R4M7-C6u7tH0B.js → mindmap-definition-NLK3R4M7-kPRBSQ6K.js} +1 -1
- package/dist/assets/{pegDiagram-GJSIUBJH-HdJHW3kd.js → pegDiagram-GJSIUBJH-BgX62j0G.js} +1 -1
- package/dist/assets/{pieDiagram-5QR66LMP-DYm0T2vD.js → pieDiagram-5QR66LMP-DpC0-6hx.js} +1 -1
- package/dist/assets/{quadrantDiagram-O4NWA36T-CEqOPSKh.js → quadrantDiagram-O4NWA36T-CNrmwxvV.js} +1 -1
- package/dist/assets/{railroadDiagram-XR7U4H2S-I8gLnKDm.js → railroadDiagram-XR7U4H2S-wl7o4Y2J.js} +1 -1
- package/dist/assets/{requirementDiagram-PLB6GJNP-0AbgBQwX.js → requirementDiagram-PLB6GJNP-D2qhVvpT.js} +1 -1
- package/dist/assets/{sankeyDiagram-IPEJSGJF-CELks0t3.js → sankeyDiagram-IPEJSGJF-DZOSOZWs.js} +1 -1
- package/dist/assets/{sequenceDiagram-PO4LG4MO-Lv5pg-Nj.js → sequenceDiagram-PO4LG4MO-eBogKj3g.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-D13uYR-m.js → sizeCapture-INFHLROL-Dp_Vdw0m.js} +1 -1
- package/dist/assets/{stateDiagram-v2-GCMORJYK-C6ntlRJp.js → stateDiagram-v2-GCMORJYK-K79Em0_p.js} +1 -1
- package/dist/assets/{swimlanes-2SLR337P-BBMTJMbP.js → swimlanes-2SLR337P-ByKYlFa_.js} +1 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-BnN5frkm.js +8 -0
- package/dist/assets/{timeline-definition-EJHVYXUP-CQqiq_9n.js → timeline-definition-EJHVYXUP-CzeMeYU0.js} +1 -1
- package/dist/assets/{usecaseDiagram-POWQR4AR-CMdMUvua.js → usecaseDiagram-POWQR4AR-uQjp5Yz3.js} +1 -1
- package/dist/assets/{vennDiagram-UO4OBE2U-DwNRIC20.js → vennDiagram-UO4OBE2U-De8_78dQ.js} +1 -1
- package/dist/assets/{wardleyDiagram-VNRHLVJA-BDP4uswI.js → wardleyDiagram-VNRHLVJA-Dk_VO2LR.js} +1 -1
- package/dist/assets/{xychartDiagram-PMCCYNJV-B9qFFRsi.js → xychartDiagram-PMCCYNJV-DMx2Y7qW.js} +1 -1
- package/dist/handbook/atomic-handbook.html +1 -1
- package/dist/index.html +1 -1
- package/dist-server/drivers/agents-proxy.js +4 -4
- package/dist-server/index.js +333 -244
- package/dist-server/openmausbot.js +30 -9
- package/dist-server/pair-cli.js +30 -9
- package/dist-server/server/drivers/acp/hermes.js +4 -9
- package/dist-server/server/index.js +4 -3
- package/dist-server/server/workspace-backup-copy.js +67 -0
- package/dist-server/server/workspace-backup-http.js +1 -0
- package/dist-server/server/workspace-backup-maintenance.js +12 -2
- package/dist-server/server/workspace-backup.js +34 -52
- package/dist-server/shared/provider-accounts.js +13 -0
- package/dist-server/shared/subscription-bots.js +4 -4
- package/package.json +1 -1
- package/dist/assets/channel-Ck_atLKb.js +0 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-CN2rFhol.js +0 -8
package/dist-server/index.js
CHANGED
|
@@ -409,11 +409,11 @@ var require_codegen = __commonJS({
|
|
|
409
409
|
const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
|
|
410
410
|
return `${varKind} ${this.name}${rhs};` + _n2;
|
|
411
411
|
}
|
|
412
|
-
optimizeNames(names3,
|
|
412
|
+
optimizeNames(names3, constants13) {
|
|
413
413
|
if (!names3[this.name.str])
|
|
414
414
|
return;
|
|
415
415
|
if (this.rhs)
|
|
416
|
-
this.rhs = optimizeExpr(this.rhs, names3,
|
|
416
|
+
this.rhs = optimizeExpr(this.rhs, names3, constants13);
|
|
417
417
|
return this;
|
|
418
418
|
}
|
|
419
419
|
get names() {
|
|
@@ -430,10 +430,10 @@ var require_codegen = __commonJS({
|
|
|
430
430
|
render({ _n: _n2 }) {
|
|
431
431
|
return `${this.lhs} = ${this.rhs};` + _n2;
|
|
432
432
|
}
|
|
433
|
-
optimizeNames(names3,
|
|
433
|
+
optimizeNames(names3, constants13) {
|
|
434
434
|
if (this.lhs instanceof code_1.Name && !names3[this.lhs.str] && !this.sideEffects)
|
|
435
435
|
return;
|
|
436
|
-
this.rhs = optimizeExpr(this.rhs, names3,
|
|
436
|
+
this.rhs = optimizeExpr(this.rhs, names3, constants13);
|
|
437
437
|
return this;
|
|
438
438
|
}
|
|
439
439
|
get names() {
|
|
@@ -494,8 +494,8 @@ var require_codegen = __commonJS({
|
|
|
494
494
|
optimizeNodes() {
|
|
495
495
|
return `${this.code}` ? this : void 0;
|
|
496
496
|
}
|
|
497
|
-
optimizeNames(names3,
|
|
498
|
-
this.code = optimizeExpr(this.code, names3,
|
|
497
|
+
optimizeNames(names3, constants13) {
|
|
498
|
+
this.code = optimizeExpr(this.code, names3, constants13);
|
|
499
499
|
return this;
|
|
500
500
|
}
|
|
501
501
|
get names() {
|
|
@@ -524,12 +524,12 @@ var require_codegen = __commonJS({
|
|
|
524
524
|
}
|
|
525
525
|
return nodes.length > 0 ? this : void 0;
|
|
526
526
|
}
|
|
527
|
-
optimizeNames(names3,
|
|
527
|
+
optimizeNames(names3, constants13) {
|
|
528
528
|
const { nodes } = this;
|
|
529
529
|
let i = nodes.length;
|
|
530
530
|
while (i--) {
|
|
531
531
|
const n = nodes[i];
|
|
532
|
-
if (n.optimizeNames(names3,
|
|
532
|
+
if (n.optimizeNames(names3, constants13))
|
|
533
533
|
continue;
|
|
534
534
|
subtractNames(names3, n.names);
|
|
535
535
|
nodes.splice(i, 1);
|
|
@@ -582,12 +582,12 @@ var require_codegen = __commonJS({
|
|
|
582
582
|
return void 0;
|
|
583
583
|
return this;
|
|
584
584
|
}
|
|
585
|
-
optimizeNames(names3,
|
|
585
|
+
optimizeNames(names3, constants13) {
|
|
586
586
|
var _a4;
|
|
587
|
-
this.else = (_a4 = this.else) === null || _a4 === void 0 ? void 0 : _a4.optimizeNames(names3,
|
|
588
|
-
if (!(super.optimizeNames(names3,
|
|
587
|
+
this.else = (_a4 = this.else) === null || _a4 === void 0 ? void 0 : _a4.optimizeNames(names3, constants13);
|
|
588
|
+
if (!(super.optimizeNames(names3, constants13) || this.else))
|
|
589
589
|
return;
|
|
590
|
-
this.condition = optimizeExpr(this.condition, names3,
|
|
590
|
+
this.condition = optimizeExpr(this.condition, names3, constants13);
|
|
591
591
|
return this;
|
|
592
592
|
}
|
|
593
593
|
get names() {
|
|
@@ -610,10 +610,10 @@ var require_codegen = __commonJS({
|
|
|
610
610
|
render(opts) {
|
|
611
611
|
return `for(${this.iteration})` + super.render(opts);
|
|
612
612
|
}
|
|
613
|
-
optimizeNames(names3,
|
|
614
|
-
if (!super.optimizeNames(names3,
|
|
613
|
+
optimizeNames(names3, constants13) {
|
|
614
|
+
if (!super.optimizeNames(names3, constants13))
|
|
615
615
|
return;
|
|
616
|
-
this.iteration = optimizeExpr(this.iteration, names3,
|
|
616
|
+
this.iteration = optimizeExpr(this.iteration, names3, constants13);
|
|
617
617
|
return this;
|
|
618
618
|
}
|
|
619
619
|
get names() {
|
|
@@ -649,10 +649,10 @@ var require_codegen = __commonJS({
|
|
|
649
649
|
render(opts) {
|
|
650
650
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
|
|
651
651
|
}
|
|
652
|
-
optimizeNames(names3,
|
|
653
|
-
if (!super.optimizeNames(names3,
|
|
652
|
+
optimizeNames(names3, constants13) {
|
|
653
|
+
if (!super.optimizeNames(names3, constants13))
|
|
654
654
|
return;
|
|
655
|
-
this.iterable = optimizeExpr(this.iterable, names3,
|
|
655
|
+
this.iterable = optimizeExpr(this.iterable, names3, constants13);
|
|
656
656
|
return this;
|
|
657
657
|
}
|
|
658
658
|
get names() {
|
|
@@ -694,11 +694,11 @@ var require_codegen = __commonJS({
|
|
|
694
694
|
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
|
|
695
695
|
return this;
|
|
696
696
|
}
|
|
697
|
-
optimizeNames(names3,
|
|
697
|
+
optimizeNames(names3, constants13) {
|
|
698
698
|
var _a4, _b;
|
|
699
|
-
super.optimizeNames(names3,
|
|
700
|
-
(_a4 = this.catch) === null || _a4 === void 0 ? void 0 : _a4.optimizeNames(names3,
|
|
701
|
-
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names3,
|
|
699
|
+
super.optimizeNames(names3, constants13);
|
|
700
|
+
(_a4 = this.catch) === null || _a4 === void 0 ? void 0 : _a4.optimizeNames(names3, constants13);
|
|
701
|
+
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names3, constants13);
|
|
702
702
|
return this;
|
|
703
703
|
}
|
|
704
704
|
get names() {
|
|
@@ -999,7 +999,7 @@ var require_codegen = __commonJS({
|
|
|
999
999
|
function addExprNames(names3, from) {
|
|
1000
1000
|
return from instanceof code_1._CodeOrName ? addNames(names3, from.names) : names3;
|
|
1001
1001
|
}
|
|
1002
|
-
function optimizeExpr(expr, names3,
|
|
1002
|
+
function optimizeExpr(expr, names3, constants13) {
|
|
1003
1003
|
if (expr instanceof code_1.Name)
|
|
1004
1004
|
return replaceName(expr);
|
|
1005
1005
|
if (!canOptimize(expr))
|
|
@@ -1014,14 +1014,14 @@ var require_codegen = __commonJS({
|
|
|
1014
1014
|
return items;
|
|
1015
1015
|
}, []));
|
|
1016
1016
|
function replaceName(n) {
|
|
1017
|
-
const c =
|
|
1017
|
+
const c = constants13[n.str];
|
|
1018
1018
|
if (c === void 0 || names3[n.str] !== 1)
|
|
1019
1019
|
return n;
|
|
1020
1020
|
delete names3[n.str];
|
|
1021
1021
|
return c;
|
|
1022
1022
|
}
|
|
1023
1023
|
function canOptimize(e) {
|
|
1024
|
-
return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names3[c.str] === 1 &&
|
|
1024
|
+
return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names3[c.str] === 1 && constants13[c.str] !== void 0);
|
|
1025
1025
|
}
|
|
1026
1026
|
}
|
|
1027
1027
|
function subtractNames(names3, from) {
|
|
@@ -8022,6 +8022,22 @@ var require_dist = __commonJS({
|
|
|
8022
8022
|
}
|
|
8023
8023
|
});
|
|
8024
8024
|
|
|
8025
|
+
// electron/socket-qos.mjs
|
|
8026
|
+
import { Socket } from "node:net";
|
|
8027
|
+
function installSocketQosCompatibility(prototype = Socket.prototype) {
|
|
8028
|
+
const original = prototype.setTypeOfService;
|
|
8029
|
+
if (typeof original !== "function") return;
|
|
8030
|
+
prototype.setTypeOfService = function(...args) {
|
|
8031
|
+
try {
|
|
8032
|
+
return original.apply(this, args);
|
|
8033
|
+
} catch (error51) {
|
|
8034
|
+
if (error51?.code !== "EINVAL" || error51?.syscall !== "setTypeOfService") throw error51;
|
|
8035
|
+
return this;
|
|
8036
|
+
}
|
|
8037
|
+
};
|
|
8038
|
+
}
|
|
8039
|
+
if (process.platform === "darwin") installSocketQosCompatibility();
|
|
8040
|
+
|
|
8025
8041
|
// server/message-file.ts
|
|
8026
8042
|
import { constants } from "node:fs";
|
|
8027
8043
|
import { open, realpath, stat } from "node:fs/promises";
|
|
@@ -32187,7 +32203,7 @@ async function receiveGoalCommand(runtime, store2, botId, threadId, command, tex
|
|
|
32187
32203
|
|
|
32188
32204
|
// server/index.ts
|
|
32189
32205
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
32190
|
-
import { createHash as
|
|
32206
|
+
import { createHash as createHash54, randomBytes as randomBytes15, randomUUID as randomUUID49, timingSafeEqual as timingSafeEqual9 } from "node:crypto";
|
|
32191
32207
|
import { existsSync as existsSync84, readFileSync as readFileSync107, realpathSync as realpathSync15, rmSync as rmSync24, mkdirSync as mkdirSync72, statSync as statSync30 } from "node:fs";
|
|
32192
32208
|
import { rm as removeDirectory } from "node:fs/promises";
|
|
32193
32209
|
import { createServer as createServer4 } from "node:http";
|
|
@@ -33720,6 +33736,18 @@ var ACCOUNT_PROVIDERS = [
|
|
|
33720
33736
|
keyUrl: "https://platform.minimax.io/console/plan",
|
|
33721
33737
|
signupUrl: "https://www.minimax.io/m-plan"
|
|
33722
33738
|
},
|
|
33739
|
+
{
|
|
33740
|
+
// Coding Plan quota uses its own endpoint, separate from the general Z.ai API.
|
|
33741
|
+
id: "zai",
|
|
33742
|
+
kind: "apiKey",
|
|
33743
|
+
label: "Z.ai GLM Coding Plan",
|
|
33744
|
+
billing: "subscription",
|
|
33745
|
+
driver: "openai-compat",
|
|
33746
|
+
envVar: "ZAI_API_KEY",
|
|
33747
|
+
config: { url: "https://api.z.ai/api/coding/paas/v4", apiKeyEnv: "ZAI_API_KEY", model: "glm-5.3", provider: "" },
|
|
33748
|
+
keyUrl: "https://z.ai/manage-apikey/apikey-list",
|
|
33749
|
+
signupUrl: "https://z.ai/subscribe"
|
|
33750
|
+
},
|
|
33723
33751
|
{
|
|
33724
33752
|
id: "xai",
|
|
33725
33753
|
kind: "apiKey",
|
|
@@ -33758,6 +33786,20 @@ var ACCOUNT_PROVIDERS = [
|
|
|
33758
33786
|
keyUrl: "https://ollama.com/settings/keys",
|
|
33759
33787
|
signupUrl: "https://ollama.com/pricing"
|
|
33760
33788
|
},
|
|
33789
|
+
{
|
|
33790
|
+
// Nous Portal's OpenAI-compatible API, signed in with a portal key. No
|
|
33791
|
+
// Hermes needed (Erick, 2026-11-08).
|
|
33792
|
+
id: "nous",
|
|
33793
|
+
kind: "apiKey",
|
|
33794
|
+
label: "Nous Research",
|
|
33795
|
+
billing: "subscription",
|
|
33796
|
+
driver: "openai-compat",
|
|
33797
|
+
envVar: "NOUS_API_KEY",
|
|
33798
|
+
config: { url: "https://inference-api.nousresearch.com/v1", apiKeyEnv: "NOUS_API_KEY", model: "Hermes-4-405B", provider: "" },
|
|
33799
|
+
keyTest: { provider: "openaiCompat", url: "https://inference-api.nousresearch.com/v1" },
|
|
33800
|
+
keyUrl: "https://portal.nousresearch.com/",
|
|
33801
|
+
signupUrl: "https://portal.nousresearch.com/"
|
|
33802
|
+
},
|
|
33761
33803
|
{
|
|
33762
33804
|
// OpenCode Go is a flat monthly plan used through an OpenCode key.
|
|
33763
33805
|
id: "opencodeGo",
|
|
@@ -42269,10 +42311,10 @@ var SUBSCRIPTION_PROVIDERS = Object.freeze([
|
|
|
42269
42311
|
planOnly: true,
|
|
42270
42312
|
signInUrl: "https://platform.minimax.io/console/plan"
|
|
42271
42313
|
},
|
|
42272
|
-
//
|
|
42273
|
-
//
|
|
42274
|
-
//
|
|
42275
|
-
// Nous Portal and the plan together makes the Nous Research bot only.
|
|
42314
|
+
// A Hermes the person set up themselves with a Z.ai key on the GLM Coding
|
|
42315
|
+
// Plan endpoint (server/drivers/acp/hermes.ts hermesZaiCodingPlan). Atomic
|
|
42316
|
+
// setup never installs Hermes: the Z.ai card takes the plan key directly.
|
|
42317
|
+
// A Hermes on Nous Portal and the plan together makes the Nous Research bot only.
|
|
42276
42318
|
{
|
|
42277
42319
|
id: "zai",
|
|
42278
42320
|
name: "Z.ai GLM",
|
|
@@ -72555,15 +72597,10 @@ var support10 = {
|
|
|
72555
72597
|
// from its log, by the core's stderr check).
|
|
72556
72598
|
promptIdleMs: 3e5,
|
|
72557
72599
|
loginNote: "Hermes CLI is not installed",
|
|
72558
|
-
install:
|
|
72559
|
-
|
|
72560
|
-
|
|
72561
|
-
|
|
72562
|
-
win32: "iex (irm https://hermes-agent.nousresearch.com/install.ps1)"
|
|
72563
|
-
},
|
|
72564
|
-
docsUrl: "https://hermes-agent.nousresearch.com/docs/getting-started/quickstart",
|
|
72565
|
-
signInCommand: "hermes setup"
|
|
72566
|
-
},
|
|
72600
|
+
// No install command: setup never installs Hermes (Erick, 2026-11-08).
|
|
72601
|
+
// Nous Research signs in with a Nous Portal API key instead
|
|
72602
|
+
// (shared/provider-accounts.ts `nous`); Hermes runs only where the person
|
|
72603
|
+
// installed it themselves.
|
|
72567
72604
|
spawnArgs: () => ["acp"],
|
|
72568
72605
|
transformEnv: (env) => {
|
|
72569
72606
|
for (const key5 of ["OPENAI_API_KEY", "OPENROUTER_API_KEY"]) delete env[key5];
|
|
@@ -100957,7 +100994,16 @@ var WorkspaceBackupMaintenance = class {
|
|
|
100957
100994
|
}
|
|
100958
100995
|
async run(work, hooks, keepLocked = false) {
|
|
100959
100996
|
this.assertAvailable();
|
|
100960
|
-
if (
|
|
100997
|
+
if (!keepLocked) {
|
|
100998
|
+
const release2 = this.request();
|
|
100999
|
+
try {
|
|
101000
|
+
await hooks.flush();
|
|
101001
|
+
return await work();
|
|
101002
|
+
} finally {
|
|
101003
|
+
release2();
|
|
101004
|
+
}
|
|
101005
|
+
}
|
|
101006
|
+
if (this.requests || !hooks.idle()) throw Object.assign(new Error("Wait for bot turns, approvals, sign-ins, and computer actions to finish before restoring."), { status: 409 });
|
|
100961
101007
|
this.active = true;
|
|
100962
101008
|
let committed = false;
|
|
100963
101009
|
try {
|
|
@@ -100979,7 +101025,7 @@ var WorkspaceBackupMaintenance = class {
|
|
|
100979
101025
|
|
|
100980
101026
|
// server/workspace-backup-http.ts
|
|
100981
101027
|
import { randomUUID as randomUUID36 } from "node:crypto";
|
|
100982
|
-
import { copyFileSync as copyFileSync4, createReadStream as createReadStream4, createWriteStream as createWriteStream4, existsSync as existsSync62, lstatSync as
|
|
101028
|
+
import { copyFileSync as copyFileSync4, createReadStream as createReadStream4, createWriteStream as createWriteStream4, existsSync as existsSync62, lstatSync as lstatSync14, mkdirSync as mkdirSync56, readdirSync as readdirSync24, statSync as statSync23, unlinkSync as unlinkSync14 } from "node:fs";
|
|
100983
101029
|
import { join as join111 } from "node:path";
|
|
100984
101030
|
import { Transform as Transform3 } from "node:stream";
|
|
100985
101031
|
import { pipeline as pipeline4 } from "node:stream/promises";
|
|
@@ -100999,126 +101045,34 @@ var WORKSPACE_BACKUP_CLIENT_KEYS = [
|
|
|
100999
101045
|
];
|
|
101000
101046
|
|
|
101001
101047
|
// server/workspace-backup.ts
|
|
101002
|
-
import { createHash as
|
|
101048
|
+
import { createHash as createHash44, randomBytes as randomBytes8, randomUUID as randomUUID35 } from "node:crypto";
|
|
101003
101049
|
import {
|
|
101004
101050
|
chmodSync as chmodSync9,
|
|
101005
|
-
closeSync as
|
|
101006
|
-
constants as
|
|
101051
|
+
closeSync as closeSync17,
|
|
101052
|
+
constants as constants11,
|
|
101007
101053
|
copyFileSync as copyFileSync3,
|
|
101008
101054
|
cpSync as cpSync2,
|
|
101009
101055
|
existsSync as existsSync61,
|
|
101010
|
-
fstatSync as
|
|
101011
|
-
|
|
101012
|
-
lstatSync as lstatSync12,
|
|
101056
|
+
fstatSync as fstatSync10,
|
|
101057
|
+
lstatSync as lstatSync13,
|
|
101013
101058
|
mkdirSync as mkdirSync55,
|
|
101014
|
-
openSync as
|
|
101059
|
+
openSync as openSync17,
|
|
101015
101060
|
readFileSync as readFileSync86,
|
|
101016
101061
|
readdirSync as readdirSync23,
|
|
101017
101062
|
readlinkSync as readlinkSync2,
|
|
101018
|
-
readSync as
|
|
101063
|
+
readSync as readSync12,
|
|
101019
101064
|
realpathSync as realpathSync13,
|
|
101020
101065
|
renameSync as renameSync16,
|
|
101021
101066
|
rmSync as rmSync18,
|
|
101022
|
-
writeFileSync as writeFileSync32
|
|
101023
|
-
writeSync as writeSync3
|
|
101067
|
+
writeFileSync as writeFileSync32
|
|
101024
101068
|
} from "node:fs";
|
|
101025
101069
|
import { isAbsolute as isAbsolute20, join as join110, parse as parse6, posix as posix4, relative as relative10, resolve as resolve27, win32 as win325 } from "node:path";
|
|
101026
101070
|
import { homedir as homedir42 } from "node:os";
|
|
101027
101071
|
import { backup, DatabaseSync as DatabaseSync3 } from "node:sqlite";
|
|
101028
101072
|
|
|
101029
|
-
// server/workspace-backup-
|
|
101030
|
-
|
|
101031
|
-
|
|
101032
|
-
"language",
|
|
101033
|
-
"budgets",
|
|
101034
|
-
"billing",
|
|
101035
|
-
"rooms",
|
|
101036
|
-
"threads",
|
|
101037
|
-
"localVm",
|
|
101038
|
-
"features",
|
|
101039
|
-
"browserProfiles"
|
|
101040
|
-
];
|
|
101041
|
-
function portableWorkspaceConfig(value) {
|
|
101042
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("Invalid workspace configuration in backup.");
|
|
101043
|
-
const config2 = parseStoredConfig(value);
|
|
101044
|
-
return Object.fromEntries(PORTABLE_CONFIG_KEYS.filter((key5) => config2[key5] !== void 0).map((key5) => [key5, config2[key5]]));
|
|
101045
|
-
}
|
|
101046
|
-
function restoredWorkspaceConfig(portable, destination) {
|
|
101047
|
-
if (!destination || typeof destination !== "object" || Array.isArray(destination)) throw new Error("Invalid destination workspace configuration; connections were not changed.");
|
|
101048
|
-
const merged = { ...destination };
|
|
101049
|
-
for (const key5 of PORTABLE_CONFIG_KEYS) delete merged[key5];
|
|
101050
|
-
return { ...merged, ...portableWorkspaceConfig(portable) };
|
|
101051
|
-
}
|
|
101052
|
-
function excludedWorkspaceAuthPath(path2) {
|
|
101053
|
-
return /^(?:(?:providers|caddy|chrome-profile|\.agent-browser)(?:\/|$)|workspace-credentials\.json$|instance-keys\.json$|external-runtimes\.json$|browser-engine-key$)/.test(path2) || /^(?:config\.json|webhooks\.json|workspace-credentials\.json|instance-keys\.json|external-runtimes\.json|browser-engine-key|sessions\.json|tunnel-account\.json)\.\d+(?:\.[0-9a-f-]+)?\.tmp$/.test(path2) || /^(?:vm-home|vm-homes\/[^/]+)\/\.browser-profiles(?:\/|$)/.test(path2);
|
|
101054
|
-
}
|
|
101055
|
-
function ephemeralWorkspaceTokenPath(path2) {
|
|
101056
|
-
return /^hook-tokens(?:\/|$)/.test(path2);
|
|
101057
|
-
}
|
|
101058
|
-
|
|
101059
|
-
// server/workspace-backup-private.ts
|
|
101060
|
-
import { existsSync as existsSync58, readFileSync as readFileSync83 } from "node:fs";
|
|
101061
|
-
import { join as join107 } from "node:path";
|
|
101062
|
-
import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
|
|
101063
|
-
function record9(value) {
|
|
101064
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
101065
|
-
}
|
|
101066
|
-
function privateBotIds(dataDir2) {
|
|
101067
|
-
const botIds = /* @__PURE__ */ new Set();
|
|
101068
|
-
const threadIds = /* @__PURE__ */ new Set();
|
|
101069
|
-
const path2 = join107(dataDir2, "bots.json");
|
|
101070
|
-
if (!existsSync58(path2)) return { botIds, threadIds };
|
|
101071
|
-
let value;
|
|
101072
|
-
try {
|
|
101073
|
-
value = JSON.parse(readFileSync83(path2, "utf8"));
|
|
101074
|
-
} catch {
|
|
101075
|
-
return { botIds, threadIds };
|
|
101076
|
-
}
|
|
101077
|
-
if (!Array.isArray(value)) return { botIds, threadIds };
|
|
101078
|
-
for (const bot of value) {
|
|
101079
|
-
if (!record9(bot) || bot.personal !== true || typeof bot.id !== "string") continue;
|
|
101080
|
-
botIds.add(bot.id);
|
|
101081
|
-
if (typeof bot.threadId === "string") threadIds.add(bot.threadId);
|
|
101082
|
-
if (Array.isArray(bot.tasks)) {
|
|
101083
|
-
for (const task2 of bot.tasks) if (record9(task2) && typeof task2.threadId === "string") threadIds.add(task2.threadId);
|
|
101084
|
-
}
|
|
101085
|
-
}
|
|
101086
|
-
return { botIds, threadIds };
|
|
101087
|
-
}
|
|
101088
|
-
function privateBotPath(path2, ids2) {
|
|
101089
|
-
if (ids2.size === 0) return false;
|
|
101090
|
-
const parts = path2.split("/");
|
|
101091
|
-
return parts.slice(1).some((part) => {
|
|
101092
|
-
const stem = part.split(".")[0] ?? part;
|
|
101093
|
-
return ids2.has(part) || ids2.has(stem);
|
|
101094
|
-
});
|
|
101095
|
-
}
|
|
101096
|
-
function scrubPrivateMessages(dbPath, botIds, threadIds) {
|
|
101097
|
-
const attachments = /* @__PURE__ */ new Set();
|
|
101098
|
-
if (!existsSync58(dbPath) || botIds.size === 0 && threadIds.size === 0) return attachments;
|
|
101099
|
-
const db2 = new DatabaseSync2(dbPath);
|
|
101100
|
-
try {
|
|
101101
|
-
const threads = [...threadIds];
|
|
101102
|
-
const bots = [...botIds];
|
|
101103
|
-
const tables = new Set(db2.prepare("SELECT name FROM sqlite_master WHERE type='table'").all().map((row) => String(row.name)));
|
|
101104
|
-
const marks = (count) => Array.from({ length: count }, () => "?").join(", ");
|
|
101105
|
-
if (threads.length && tables.has("messages")) {
|
|
101106
|
-
for (const row of db2.prepare(`SELECT json FROM messages WHERE thread_id IN (${marks(threads.length)})`).all(...threads)) {
|
|
101107
|
-
for (const match of String(row.json).matchAll(/\/api\/attachments\/([A-Za-z0-9._-]{1,200})/g)) attachments.add(match[1]);
|
|
101108
|
-
}
|
|
101109
|
-
db2.prepare(`DELETE FROM messages WHERE thread_id IN (${marks(threads.length)})`).run(...threads);
|
|
101110
|
-
}
|
|
101111
|
-
if (threads.length && tables.has("thread_state")) db2.prepare(`DELETE FROM thread_state WHERE thread_id IN (${marks(threads.length)})`).run(...threads);
|
|
101112
|
-
if (tables.has("chat_followups") && (threads.length || bots.length)) {
|
|
101113
|
-
db2.prepare(`DELETE FROM chat_followups WHERE thread_id IN (${marks(threads.length || 1)}) OR owner_id IN (${marks(bots.length || 1)})`).run(...threads.length ? threads : [""], ...bots.length ? bots : [""]);
|
|
101114
|
-
}
|
|
101115
|
-
if (bots.length && tables.has("memory_files")) db2.prepare(`DELETE FROM memory_files WHERE bot_id IN (${marks(bots.length)})`).run(...bots);
|
|
101116
|
-
db2.exec("VACUUM");
|
|
101117
|
-
} finally {
|
|
101118
|
-
db2.close();
|
|
101119
|
-
}
|
|
101120
|
-
return attachments;
|
|
101121
|
-
}
|
|
101073
|
+
// server/workspace-backup-copy.ts
|
|
101074
|
+
import { createHash as createHash43 } from "node:crypto";
|
|
101075
|
+
import { closeSync as closeSync16, constants as constants10, fstatSync as fstatSync9, fsyncSync as fsyncSync4, lstatSync as lstatSync11, openSync as openSync16, readSync as readSync11, writeSync as writeSync3 } from "node:fs";
|
|
101122
101076
|
|
|
101123
101077
|
// server/workspace-backup-archive.ts
|
|
101124
101078
|
import { createCipheriv, createDecipheriv, createHash as createHash42, randomBytes as randomBytes7, scrypt } from "node:crypto";
|
|
@@ -101239,6 +101193,150 @@ async function readArchive(inputPath, plaintext, password) {
|
|
|
101239
101193
|
}
|
|
101240
101194
|
}
|
|
101241
101195
|
|
|
101196
|
+
// server/workspace-backup-copy.ts
|
|
101197
|
+
function copyRegular(source3, destination, onLiveChange) {
|
|
101198
|
+
let captured;
|
|
101199
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
101200
|
+
let input;
|
|
101201
|
+
try {
|
|
101202
|
+
input = openSync16(source3, constants10.O_RDONLY | constants10.O_NOFOLLOW);
|
|
101203
|
+
} catch (error51) {
|
|
101204
|
+
if (!onLiveChange || error51.code !== "ENOENT") throw error51;
|
|
101205
|
+
onLiveChange(captured ? "changed" : "removed");
|
|
101206
|
+
return captured ?? null;
|
|
101207
|
+
}
|
|
101208
|
+
let output;
|
|
101209
|
+
try {
|
|
101210
|
+
const before = fstatSync9(input);
|
|
101211
|
+
if (!before.isFile() || before.size > MAX_WORKSPACE_BACKUP_BYTES) throw new Error("A workspace file is not regular or exceeds the 64 GB backup limit.");
|
|
101212
|
+
const mode = before.mode & 64 ? 448 : 384;
|
|
101213
|
+
output = openSync16(destination, attempt === 0 ? "wx" : constants10.O_WRONLY | constants10.O_NOFOLLOW | constants10.O_TRUNC, mode);
|
|
101214
|
+
const chunk = Buffer.allocUnsafe(1024 * 1024);
|
|
101215
|
+
const hash4 = createHash43("sha256");
|
|
101216
|
+
let size = 0;
|
|
101217
|
+
while (!onLiveChange || size < before.size) {
|
|
101218
|
+
const length = onLiveChange ? Math.min(chunk.length, before.size - size) : chunk.length;
|
|
101219
|
+
const count = readSync11(input, chunk, 0, length, null);
|
|
101220
|
+
if (!count) break;
|
|
101221
|
+
size += count;
|
|
101222
|
+
if (!onLiveChange && size > before.size) throw new Error("A staged workspace file changed during restore.");
|
|
101223
|
+
hash4.update(chunk.subarray(0, count));
|
|
101224
|
+
let offset = 0;
|
|
101225
|
+
while (offset < count) offset += writeSync3(output, chunk, offset, count - offset);
|
|
101226
|
+
}
|
|
101227
|
+
const after = fstatSync9(input);
|
|
101228
|
+
const current4 = onLiveChange ? null : lstatSync11(source3);
|
|
101229
|
+
const changed2 = size !== before.size || after.size !== before.size || after.mtimeMs !== before.mtimeMs || after.ctimeMs !== before.ctimeMs || current4 !== null && (current4.ino !== before.ino || current4.dev !== before.dev || current4.isSymbolicLink());
|
|
101230
|
+
if (changed2 && !onLiveChange) throw new Error("A staged workspace file changed during restore.");
|
|
101231
|
+
fsyncSync4(output);
|
|
101232
|
+
captured = { size, mode, sha256: hash4.digest("hex") };
|
|
101233
|
+
if (!changed2) return captured;
|
|
101234
|
+
if (attempt === 2) {
|
|
101235
|
+
onLiveChange?.("changed");
|
|
101236
|
+
return captured;
|
|
101237
|
+
}
|
|
101238
|
+
} finally {
|
|
101239
|
+
closeSync16(input);
|
|
101240
|
+
if (output !== void 0) closeSync16(output);
|
|
101241
|
+
}
|
|
101242
|
+
}
|
|
101243
|
+
return captured ?? null;
|
|
101244
|
+
}
|
|
101245
|
+
|
|
101246
|
+
// server/workspace-backup-policy.ts
|
|
101247
|
+
var PORTABLE_CONFIG_KEYS = [
|
|
101248
|
+
"profile",
|
|
101249
|
+
"language",
|
|
101250
|
+
"budgets",
|
|
101251
|
+
"billing",
|
|
101252
|
+
"rooms",
|
|
101253
|
+
"threads",
|
|
101254
|
+
"localVm",
|
|
101255
|
+
"features",
|
|
101256
|
+
"browserProfiles"
|
|
101257
|
+
];
|
|
101258
|
+
function portableWorkspaceConfig(value) {
|
|
101259
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("Invalid workspace configuration in backup.");
|
|
101260
|
+
const config2 = parseStoredConfig(value);
|
|
101261
|
+
return Object.fromEntries(PORTABLE_CONFIG_KEYS.filter((key5) => config2[key5] !== void 0).map((key5) => [key5, config2[key5]]));
|
|
101262
|
+
}
|
|
101263
|
+
function restoredWorkspaceConfig(portable, destination) {
|
|
101264
|
+
if (!destination || typeof destination !== "object" || Array.isArray(destination)) throw new Error("Invalid destination workspace configuration; connections were not changed.");
|
|
101265
|
+
const merged = { ...destination };
|
|
101266
|
+
for (const key5 of PORTABLE_CONFIG_KEYS) delete merged[key5];
|
|
101267
|
+
return { ...merged, ...portableWorkspaceConfig(portable) };
|
|
101268
|
+
}
|
|
101269
|
+
function excludedWorkspaceAuthPath(path2) {
|
|
101270
|
+
return /^(?:(?:providers|caddy|chrome-profile|\.agent-browser)(?:\/|$)|workspace-credentials\.json$|instance-keys\.json$|external-runtimes\.json$|browser-engine-key$)/.test(path2) || /^(?:config\.json|webhooks\.json|workspace-credentials\.json|instance-keys\.json|external-runtimes\.json|browser-engine-key|sessions\.json|tunnel-account\.json)\.\d+(?:\.[0-9a-f-]+)?\.tmp$/.test(path2) || /^(?:vm-home|vm-homes\/[^/]+)\/\.browser-profiles(?:\/|$)/.test(path2);
|
|
101271
|
+
}
|
|
101272
|
+
function ephemeralWorkspaceTokenPath(path2) {
|
|
101273
|
+
return /^hook-tokens(?:\/|$)/.test(path2);
|
|
101274
|
+
}
|
|
101275
|
+
|
|
101276
|
+
// server/workspace-backup-private.ts
|
|
101277
|
+
import { existsSync as existsSync58, readFileSync as readFileSync83 } from "node:fs";
|
|
101278
|
+
import { join as join107 } from "node:path";
|
|
101279
|
+
import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
|
|
101280
|
+
function record9(value) {
|
|
101281
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
101282
|
+
}
|
|
101283
|
+
function privateBotIds(dataDir2) {
|
|
101284
|
+
const botIds = /* @__PURE__ */ new Set();
|
|
101285
|
+
const threadIds = /* @__PURE__ */ new Set();
|
|
101286
|
+
const path2 = join107(dataDir2, "bots.json");
|
|
101287
|
+
if (!existsSync58(path2)) return { botIds, threadIds };
|
|
101288
|
+
let value;
|
|
101289
|
+
try {
|
|
101290
|
+
value = JSON.parse(readFileSync83(path2, "utf8"));
|
|
101291
|
+
} catch {
|
|
101292
|
+
return { botIds, threadIds };
|
|
101293
|
+
}
|
|
101294
|
+
if (!Array.isArray(value)) return { botIds, threadIds };
|
|
101295
|
+
for (const bot of value) {
|
|
101296
|
+
if (!record9(bot) || bot.personal !== true || typeof bot.id !== "string") continue;
|
|
101297
|
+
botIds.add(bot.id);
|
|
101298
|
+
if (typeof bot.threadId === "string") threadIds.add(bot.threadId);
|
|
101299
|
+
if (Array.isArray(bot.tasks)) {
|
|
101300
|
+
for (const task2 of bot.tasks) if (record9(task2) && typeof task2.threadId === "string") threadIds.add(task2.threadId);
|
|
101301
|
+
}
|
|
101302
|
+
}
|
|
101303
|
+
return { botIds, threadIds };
|
|
101304
|
+
}
|
|
101305
|
+
function privateBotPath(path2, ids2) {
|
|
101306
|
+
if (ids2.size === 0) return false;
|
|
101307
|
+
const parts = path2.split("/");
|
|
101308
|
+
return parts.slice(1).some((part) => {
|
|
101309
|
+
const stem = part.split(".")[0] ?? part;
|
|
101310
|
+
return ids2.has(part) || ids2.has(stem);
|
|
101311
|
+
});
|
|
101312
|
+
}
|
|
101313
|
+
function scrubPrivateMessages(dbPath, botIds, threadIds) {
|
|
101314
|
+
const attachments = /* @__PURE__ */ new Set();
|
|
101315
|
+
if (!existsSync58(dbPath) || botIds.size === 0 && threadIds.size === 0) return attachments;
|
|
101316
|
+
const db2 = new DatabaseSync2(dbPath);
|
|
101317
|
+
try {
|
|
101318
|
+
const threads = [...threadIds];
|
|
101319
|
+
const bots = [...botIds];
|
|
101320
|
+
const tables = new Set(db2.prepare("SELECT name FROM sqlite_master WHERE type='table'").all().map((row) => String(row.name)));
|
|
101321
|
+
const marks = (count) => Array.from({ length: count }, () => "?").join(", ");
|
|
101322
|
+
if (threads.length && tables.has("messages")) {
|
|
101323
|
+
for (const row of db2.prepare(`SELECT json FROM messages WHERE thread_id IN (${marks(threads.length)})`).all(...threads)) {
|
|
101324
|
+
for (const match of String(row.json).matchAll(/\/api\/attachments\/([A-Za-z0-9._-]{1,200})/g)) attachments.add(match[1]);
|
|
101325
|
+
}
|
|
101326
|
+
db2.prepare(`DELETE FROM messages WHERE thread_id IN (${marks(threads.length)})`).run(...threads);
|
|
101327
|
+
}
|
|
101328
|
+
if (threads.length && tables.has("thread_state")) db2.prepare(`DELETE FROM thread_state WHERE thread_id IN (${marks(threads.length)})`).run(...threads);
|
|
101329
|
+
if (tables.has("chat_followups") && (threads.length || bots.length)) {
|
|
101330
|
+
db2.prepare(`DELETE FROM chat_followups WHERE thread_id IN (${marks(threads.length || 1)}) OR owner_id IN (${marks(bots.length || 1)})`).run(...threads.length ? threads : [""], ...bots.length ? bots : [""]);
|
|
101331
|
+
}
|
|
101332
|
+
if (bots.length && tables.has("memory_files")) db2.prepare(`DELETE FROM memory_files WHERE bot_id IN (${marks(bots.length)})`).run(...bots);
|
|
101333
|
+
db2.exec("VACUUM");
|
|
101334
|
+
} finally {
|
|
101335
|
+
db2.close();
|
|
101336
|
+
}
|
|
101337
|
+
return attachments;
|
|
101338
|
+
}
|
|
101339
|
+
|
|
101242
101340
|
// server/workspace-backup-secrets.ts
|
|
101243
101341
|
import { randomUUID as randomUUID34 } from "node:crypto";
|
|
101244
101342
|
import { existsSync as existsSync59, readFileSync as readFileSync84 } from "node:fs";
|
|
@@ -101340,7 +101438,7 @@ function markRestoreSecrets(dataDir2, restore2, outcome) {
|
|
|
101340
101438
|
|
|
101341
101439
|
// server/workspace-restore-paths.ts
|
|
101342
101440
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
101343
|
-
import { existsSync as existsSync60, lstatSync as
|
|
101441
|
+
import { existsSync as existsSync60, lstatSync as lstatSync12, readFileSync as readFileSync85, readdirSync as readdirSync22, renameSync as renameSync15, symlinkSync as symlinkSync2, writeFileSync as writeFileSync31 } from "node:fs";
|
|
101344
101442
|
import { dirname as dirname30, isAbsolute as isAbsolute19, join as join109, posix as posix3, relative as relative9, resolve as resolve26, win32 as win324 } from "node:path";
|
|
101345
101443
|
function validRelative(path2) {
|
|
101346
101444
|
return !!path2 && path2.length <= 4096 && !isAbsolute19(path2) && !/[\\\0:]/.test(path2) && path2.split("/").every((part) => !!part && part !== "." && part !== ".." && !/[. ]$/.test(part) && !/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(part));
|
|
@@ -101392,7 +101490,7 @@ function rebaseTree(root, pairs2) {
|
|
|
101392
101490
|
const visit3 = (directory, depth) => {
|
|
101393
101491
|
for (const name2 of readdirSync22(directory)) {
|
|
101394
101492
|
const path2 = join109(directory, name2);
|
|
101395
|
-
const stat8 =
|
|
101493
|
+
const stat8 = lstatSync12(path2);
|
|
101396
101494
|
if (stat8.isDirectory()) {
|
|
101397
101495
|
if (name2 === "projects" && relative9(root, path2).startsWith("providers")) renameProjectDirs(path2, pairs2);
|
|
101398
101496
|
if (depth < 12) visit3(path2, depth + 1);
|
|
@@ -101403,7 +101501,7 @@ function rebaseTree(root, pairs2) {
|
|
|
101403
101501
|
}
|
|
101404
101502
|
}
|
|
101405
101503
|
};
|
|
101406
|
-
for (const top of ["workspaces", "skills", "providers"]) if (existsSync60(join109(root, top)) &&
|
|
101504
|
+
for (const top of ["workspaces", "skills", "providers"]) if (existsSync60(join109(root, top)) && lstatSync12(join109(root, top)).isDirectory()) visit3(join109(root, top), 0);
|
|
101407
101505
|
}
|
|
101408
101506
|
function renameProjectDirs(projects, pairs2) {
|
|
101409
101507
|
for (const name2 of readdirSync22(projects)) {
|
|
@@ -101501,7 +101599,7 @@ var EXCLUSION_NOTES = [
|
|
|
101501
101599
|
"Device pairing, server identity, live leases and runtime files (existing destination identities are preserved).",
|
|
101502
101600
|
SECRETS_NOTE,
|
|
101503
101601
|
"Downloaded tools and caches; these can be installed again.",
|
|
101504
|
-
"Project dependency and build folders (node_modules, .venv, __pycache__, .next, .turbo, .build, DerivedData); reinstall
|
|
101602
|
+
"Project dependency and build folders (node_modules, .venv, __pycache__, .next, .turbo, .build, DerivedData, and in task workspaces .git, *-derived, *.xcarchive, dist and release); reinstall or rebuild them after restoring.",
|
|
101505
101603
|
"External project folders, CLI login homes, browser session homes, OS keychains, companion devices and other servers.",
|
|
101506
101604
|
"VM/container disk layers and remote cloud data; durable files inside this workspace are included."
|
|
101507
101605
|
];
|
|
@@ -101522,14 +101620,14 @@ function preserved(name2, secrets = false) {
|
|
|
101522
101620
|
}
|
|
101523
101621
|
function folder2(path2) {
|
|
101524
101622
|
mkdirSync55(path2, { recursive: true, mode: 448 });
|
|
101525
|
-
const stat8 =
|
|
101623
|
+
const stat8 = lstatSync13(path2);
|
|
101526
101624
|
if (!stat8.isDirectory() || stat8.isSymbolicLink()) throw new Error("The backup directory must be a real directory, not a symbolic link.");
|
|
101527
101625
|
chmodSync9(path2, 448);
|
|
101528
101626
|
}
|
|
101529
101627
|
function backupRoot(dataDir2) {
|
|
101530
101628
|
const root = resolve27(dataDir2);
|
|
101531
101629
|
if (root === parse6(root).root) throw new Error("A filesystem root cannot be a workspace backup target.");
|
|
101532
|
-
const stat8 =
|
|
101630
|
+
const stat8 = lstatSync13(root);
|
|
101533
101631
|
if (!stat8.isDirectory() || stat8.isSymbolicLink()) throw new Error("The workspace data directory must not be a symbolic link.");
|
|
101534
101632
|
const path2 = join110(root, ".backups");
|
|
101535
101633
|
folder2(path2);
|
|
@@ -101539,7 +101637,7 @@ function jobPath(dataDir2, id) {
|
|
|
101539
101637
|
if (!ID2.test(id)) throw new Error("Invalid workspace backup identifier.");
|
|
101540
101638
|
const path2 = join110(backupRoot(dataDir2), id);
|
|
101541
101639
|
if (entryExists(path2)) {
|
|
101542
|
-
const stat8 =
|
|
101640
|
+
const stat8 = lstatSync13(path2);
|
|
101543
101641
|
if (!stat8.isDirectory() || stat8.isSymbolicLink()) throw new Error("Unsafe workspace backup job directory.");
|
|
101544
101642
|
}
|
|
101545
101643
|
return path2;
|
|
@@ -101555,7 +101653,7 @@ function record10(value) {
|
|
|
101555
101653
|
}
|
|
101556
101654
|
function entryExists(path2) {
|
|
101557
101655
|
try {
|
|
101558
|
-
|
|
101656
|
+
lstatSync13(path2);
|
|
101559
101657
|
return true;
|
|
101560
101658
|
} catch (error51) {
|
|
101561
101659
|
if (error51.code === "ENOENT") return false;
|
|
@@ -101563,13 +101661,13 @@ function entryExists(path2) {
|
|
|
101563
101661
|
}
|
|
101564
101662
|
}
|
|
101565
101663
|
function privateJson(path2) {
|
|
101566
|
-
const fd =
|
|
101664
|
+
const fd = openSync17(path2, constants11.O_RDONLY | constants11.O_NOFOLLOW);
|
|
101567
101665
|
try {
|
|
101568
|
-
const stat8 =
|
|
101666
|
+
const stat8 = fstatSync10(fd);
|
|
101569
101667
|
if (!stat8.isFile() || stat8.size > MAX_METADATA_BYTES) throw new Error("Workspace backup metadata is too large or is not a regular file.");
|
|
101570
101668
|
return JSON.parse(readFileSync86(fd, "utf8"));
|
|
101571
101669
|
} finally {
|
|
101572
|
-
|
|
101670
|
+
closeSync17(fd);
|
|
101573
101671
|
}
|
|
101574
101672
|
}
|
|
101575
101673
|
function writeJson(path2, value) {
|
|
@@ -101607,51 +101705,19 @@ function assertLocalAuthOutsideSnapshot(dataDir2) {
|
|
|
101607
101705
|
check2(instance.config.configDir, "config.configDir", String(environment.HOME || environment.USERPROFILE || homedir42()));
|
|
101608
101706
|
}
|
|
101609
101707
|
}
|
|
101610
|
-
function copyRegular(source3, destination) {
|
|
101611
|
-
const input = openSync16(source3, constants10.O_RDONLY | constants10.O_NOFOLLOW);
|
|
101612
|
-
let output;
|
|
101613
|
-
try {
|
|
101614
|
-
const before = fstatSync9(input);
|
|
101615
|
-
if (!before.isFile() || before.size > MAX_WORKSPACE_BACKUP_BYTES) throw new Error("A workspace file is not regular or exceeds the 64 GB backup limit.");
|
|
101616
|
-
const mode = before.mode & 64 ? 448 : 384;
|
|
101617
|
-
output = openSync16(destination, "wx", mode);
|
|
101618
|
-
const chunk = Buffer.allocUnsafe(1024 * 1024);
|
|
101619
|
-
const hash4 = createHash43("sha256");
|
|
101620
|
-
let size = 0;
|
|
101621
|
-
for (; ; ) {
|
|
101622
|
-
const count = readSync11(input, chunk, 0, chunk.length, null);
|
|
101623
|
-
if (!count) break;
|
|
101624
|
-
size += count;
|
|
101625
|
-
if (size > before.size) throw new Error("A workspace file changed during backup. Stop its writer and retry.");
|
|
101626
|
-
hash4.update(chunk.subarray(0, count));
|
|
101627
|
-
let offset = 0;
|
|
101628
|
-
while (offset < count) offset += writeSync3(output, chunk, offset, count - offset);
|
|
101629
|
-
}
|
|
101630
|
-
const after = fstatSync9(input);
|
|
101631
|
-
const current4 = lstatSync12(source3);
|
|
101632
|
-
if (size !== before.size || after.mtimeMs !== before.mtimeMs || after.ctimeMs !== before.ctimeMs || current4.ino !== before.ino || current4.dev !== before.dev || current4.isSymbolicLink()) {
|
|
101633
|
-
throw new Error("A workspace file changed during backup. Stop its writer and retry.");
|
|
101634
|
-
}
|
|
101635
|
-
fsyncSync4(output);
|
|
101636
|
-
return { size, mode, sha256: hash4.digest("hex") };
|
|
101637
|
-
} finally {
|
|
101638
|
-
closeSync16(input);
|
|
101639
|
-
if (output !== void 0) closeSync16(output);
|
|
101640
|
-
}
|
|
101641
|
-
}
|
|
101642
101708
|
function hashFile(path2) {
|
|
101643
|
-
const fd =
|
|
101709
|
+
const fd = openSync17(path2, constants11.O_RDONLY | constants11.O_NOFOLLOW);
|
|
101644
101710
|
try {
|
|
101645
|
-
if (!
|
|
101646
|
-
const hash4 =
|
|
101711
|
+
if (!fstatSync10(fd).isFile()) throw new Error("The workspace archive contains an unsafe file.");
|
|
101712
|
+
const hash4 = createHash44("sha256");
|
|
101647
101713
|
const chunk = Buffer.allocUnsafe(1024 * 1024);
|
|
101648
101714
|
for (; ; ) {
|
|
101649
|
-
const count =
|
|
101715
|
+
const count = readSync12(fd, chunk, 0, chunk.length, null);
|
|
101650
101716
|
if (!count) return hash4.digest("hex");
|
|
101651
101717
|
hash4.update(chunk.subarray(0, count));
|
|
101652
101718
|
}
|
|
101653
101719
|
} finally {
|
|
101654
|
-
|
|
101720
|
+
closeSync17(fd);
|
|
101655
101721
|
}
|
|
101656
101722
|
}
|
|
101657
101723
|
function countJsonArray(path2) {
|
|
@@ -101697,19 +101763,21 @@ async function createWorkspaceBackup(dataDir2, options) {
|
|
|
101697
101763
|
const links = [];
|
|
101698
101764
|
const checkouts = [];
|
|
101699
101765
|
const warnings = [
|
|
101700
|
-
"
|
|
101766
|
+
"Files are captured as the backup runs. External changes made after a file is captured belong to the next backup.",
|
|
101701
101767
|
encrypted ? "Conversation text and user files are not redacted and may contain secrets you pasted. Keep the encrypted backup private." : "This backup is not encrypted. Anyone with the file can read your conversations and files; keep it private.",
|
|
101702
101768
|
...secrets ? ["This backup holds your keys, passwords and tokens. Anyone with the file and its password can use them."] : [],
|
|
101703
101769
|
RESTORE_WARNING
|
|
101704
101770
|
];
|
|
101705
101771
|
let bytes2 = 0;
|
|
101706
101772
|
let skippedLinks = 0;
|
|
101773
|
+
let changedFiles = 0;
|
|
101774
|
+
let removedFiles = 0;
|
|
101707
101775
|
const progress = () => options.onProgress?.({ phase: "copying", files: entries2.length, bytes: bytes2 });
|
|
101708
101776
|
try {
|
|
101709
101777
|
const root = realpathSync13(dataDir2);
|
|
101710
101778
|
const sourceDb = join110(root, "messages.db");
|
|
101711
101779
|
if (existsSync61(sourceDb)) {
|
|
101712
|
-
if (
|
|
101780
|
+
if (lstatSync13(sourceDb).isSymbolicLink()) throw new Error("The message database must not be a symbolic link.");
|
|
101713
101781
|
const db2 = new DatabaseSync3(sourceDb, { readOnly: true });
|
|
101714
101782
|
const completionPulse = setInterval(() => {
|
|
101715
101783
|
}, 25);
|
|
@@ -101742,8 +101810,15 @@ async function createWorkspaceBackup(dataDir2, options) {
|
|
|
101742
101810
|
if (forbiddenArchivePath(path3, secrets)) throw new Error("A workspace filename conflicts with a protected authentication or runtime path.");
|
|
101743
101811
|
if (!validRelative(path3)) throw new Error("A workspace filename cannot be safely restored on supported platforms.");
|
|
101744
101812
|
const source3 = join110(directory, name2);
|
|
101745
|
-
|
|
101746
|
-
|
|
101813
|
+
let stat8;
|
|
101814
|
+
try {
|
|
101815
|
+
stat8 = lstatSync13(source3);
|
|
101816
|
+
} catch (error51) {
|
|
101817
|
+
if (error51.code !== "ENOENT") throw error51;
|
|
101818
|
+
removedFiles++;
|
|
101819
|
+
continue;
|
|
101820
|
+
}
|
|
101821
|
+
if (prefix && REINSTALLABLE_DIRS.has(name2) && (stat8.isDirectory() || stat8.isSymbolicLink()) || path3.startsWith("task-workspaces/") && (name2 === ".git" || stat8.isDirectory() && /^(?:.+-derived|.+\.xcarchive|dist.*|release)$/.test(name2))) continue;
|
|
101747
101822
|
if (stat8.isSymbolicLink() && BROWSER_LOCK_LINKS.has(name2)) continue;
|
|
101748
101823
|
if (stat8.isSymbolicLink()) {
|
|
101749
101824
|
if (/^workspaces\/[^/]+\/\.(?:claude|agents|grok)\/skills\/[^/]+$/.test(path3)) {
|
|
@@ -101769,11 +101844,11 @@ async function createWorkspaceBackup(dataDir2, options) {
|
|
|
101769
101844
|
if (hiddenIds.size && path3 === "bots.json") {
|
|
101770
101845
|
const value = privateJson(source3);
|
|
101771
101846
|
writeJson(destination, Array.isArray(value) ? value.filter((bot) => !(record10(bot) && bot.personal === true)) : value);
|
|
101772
|
-
copied = { size:
|
|
101847
|
+
copied = { size: lstatSync13(destination).size, mode: 384, sha256: hashFile(destination) };
|
|
101773
101848
|
} else if (hiddenIds.size && name2.endsWith(".jsonl")) {
|
|
101774
101849
|
const kept = readFileSync86(source3, "utf8").split("\n").filter((line3) => ![...hiddenIds].some((id) => line3.includes(id)));
|
|
101775
101850
|
writeFileSync32(destination, kept.join("\n"), { mode: 384, flag: "wx" });
|
|
101776
|
-
copied = { size:
|
|
101851
|
+
copied = { size: lstatSync13(destination).size, mode: 384, sha256: hashFile(destination) };
|
|
101777
101852
|
} else if ((path3 === "config.json" || path3 === "webhooks.json") && !secrets) {
|
|
101778
101853
|
const value = privateJson(source3);
|
|
101779
101854
|
if (path3 === "config.json") writeJson(destination, portableWorkspaceConfig(value));
|
|
@@ -101784,8 +101859,19 @@ async function createWorkspaceBackup(dataDir2, options) {
|
|
|
101784
101859
|
}
|
|
101785
101860
|
writeJson(destination, value);
|
|
101786
101861
|
}
|
|
101787
|
-
copied = { size:
|
|
101788
|
-
} else
|
|
101862
|
+
copied = { size: lstatSync13(destination).size, mode: 384, sha256: hashFile(destination) };
|
|
101863
|
+
} else {
|
|
101864
|
+
const captured = copyRegular(
|
|
101865
|
+
path3 === "messages.db" ? join110(snapshot2, "messages-snapshot.db") : source3,
|
|
101866
|
+
destination,
|
|
101867
|
+
path3 === "messages.db" ? void 0 : (kind) => {
|
|
101868
|
+
if (kind === "changed") changedFiles++;
|
|
101869
|
+
else removedFiles++;
|
|
101870
|
+
}
|
|
101871
|
+
);
|
|
101872
|
+
if (!captured) continue;
|
|
101873
|
+
copied = captured;
|
|
101874
|
+
}
|
|
101789
101875
|
bytes2 += copied.size;
|
|
101790
101876
|
if (bytes2 > MAX_WORKSPACE_BACKUP_BYTES) throw new Error("The workspace exceeds the 64 GB backup limit.");
|
|
101791
101877
|
entries2.push({ path: path3, type: "file", ...copied });
|
|
@@ -101794,6 +101880,8 @@ async function createWorkspaceBackup(dataDir2, options) {
|
|
|
101794
101880
|
}
|
|
101795
101881
|
};
|
|
101796
101882
|
walk2(root);
|
|
101883
|
+
if (changedFiles) warnings.push(`${changedFiles} file(s) kept changing during backup. Their captured bytes are included, but may contain an in-progress write.`);
|
|
101884
|
+
if (removedFiles) warnings.push(`${removedFiles} file(s) disappeared before they could be captured and are not included.`);
|
|
101797
101885
|
if (skippedLinks) warnings.push(`${skippedLinks} managed skill discovery link(s) were omitted and are recreated by the app.`);
|
|
101798
101886
|
if (checkouts.length) warnings.push(`${checkouts.length} project checkout(s) with no local changes were left out; clone them again from their remote. Files git ignores in them (such as .env) are not included.`);
|
|
101799
101887
|
if (secrets && !options.secrets) warnings.push("This computer's secure credential store was not available, so connection keys saved there are not in this backup.");
|
|
@@ -101878,12 +101966,12 @@ function validateManifest(value) {
|
|
|
101878
101966
|
return value;
|
|
101879
101967
|
}
|
|
101880
101968
|
async function inspectTar(path2) {
|
|
101881
|
-
const fd =
|
|
101969
|
+
const fd = openSync17(path2, "r");
|
|
101882
101970
|
const signature2 = Buffer.alloc(2);
|
|
101883
101971
|
try {
|
|
101884
|
-
|
|
101972
|
+
readSync12(fd, signature2, 0, 2, 0);
|
|
101885
101973
|
} finally {
|
|
101886
|
-
|
|
101974
|
+
closeSync17(fd);
|
|
101887
101975
|
}
|
|
101888
101976
|
if (signature2[0] === 31 && signature2[1] === 139) throw new Error("Compressed payloads are not supported in this workspace backup version.");
|
|
101889
101977
|
const entries2 = /* @__PURE__ */ new Map();
|
|
@@ -101919,7 +102007,7 @@ function validateStaged(directory, expected) {
|
|
|
101919
102007
|
for (const name2 of readdirSync23(root)) {
|
|
101920
102008
|
const path2 = prefix ? `${prefix}/${name2}` : name2;
|
|
101921
102009
|
if (!declared.has(path2)) throw new Error("Staged workspace contains files absent from its manifest.");
|
|
101922
|
-
const stat8 =
|
|
102010
|
+
const stat8 = lstatSync13(join110(root, name2));
|
|
101923
102011
|
if (stat8.isSymbolicLink()) throw new Error("Staged workspace contains a symbolic link.");
|
|
101924
102012
|
if (stat8.isDirectory()) inspect(join110(root, name2), path2);
|
|
101925
102013
|
}
|
|
@@ -101927,7 +102015,7 @@ function validateStaged(directory, expected) {
|
|
|
101927
102015
|
inspect(join110(directory, "data"));
|
|
101928
102016
|
for (const entry of manifest.entries) {
|
|
101929
102017
|
const path2 = join110(directory, "data", entry.path);
|
|
101930
|
-
const stat8 =
|
|
102018
|
+
const stat8 = lstatSync13(path2);
|
|
101931
102019
|
if (stat8.isSymbolicLink() || (entry.type === "file" ? !stat8.isFile() || stat8.size !== entry.size : !stat8.isDirectory())) {
|
|
101932
102020
|
throw new Error("Staged workspace files do not match the backup manifest.");
|
|
101933
102021
|
}
|
|
@@ -102120,13 +102208,13 @@ function prepareRestore(dataDir2, id, manifest) {
|
|
|
102120
102208
|
const browserHomes = ["vm-home"];
|
|
102121
102209
|
const vmHomes = join110(dataDir2, "vm-homes");
|
|
102122
102210
|
if (entryExists(vmHomes)) {
|
|
102123
|
-
if (!
|
|
102211
|
+
if (!lstatSync13(vmHomes).isDirectory()) throw new Error("Stop managed desktops and repair the VM home directory before restoring.");
|
|
102124
102212
|
for (const name2 of readdirSync23(vmHomes)) if (validRelative(name2)) browserHomes.push(`vm-homes/${name2}`);
|
|
102125
102213
|
}
|
|
102126
102214
|
for (const home of browserHomes) {
|
|
102127
102215
|
const homePath = join110(dataDir2, home);
|
|
102128
102216
|
if (!entryExists(homePath)) continue;
|
|
102129
|
-
if (!
|
|
102217
|
+
if (!lstatSync13(homePath).isDirectory()) throw new Error("Stop managed desktops and repair the VM home directory before restoring.");
|
|
102130
102218
|
const source3 = join110(dataDir2, home, ".browser-profiles");
|
|
102131
102219
|
if (!entryExists(source3)) continue;
|
|
102132
102220
|
folder2(join110(prepared, home));
|
|
@@ -102298,7 +102386,7 @@ function removeWorkspaceBackupJob(dataDir2, id) {
|
|
|
102298
102386
|
}
|
|
102299
102387
|
if (existsSync61(join110(root, `safety-${id}`))) throw new Error("This backup has a recovery copy and cannot be removed.");
|
|
102300
102388
|
if (!entryExists(path2)) return;
|
|
102301
|
-
if (!
|
|
102389
|
+
if (!lstatSync13(path2).isDirectory() || lstatSync13(path2).isSymbolicLink()) throw new Error("Unsafe workspace backup cleanup target.");
|
|
102302
102390
|
rmSync18(path2, { recursive: true, force: true });
|
|
102303
102391
|
}
|
|
102304
102392
|
|
|
@@ -102347,7 +102435,7 @@ function createWorkspaceBackupRoutes(options) {
|
|
|
102347
102435
|
}
|
|
102348
102436
|
function reclaimAbandoned() {
|
|
102349
102437
|
const root = join111(options.dataDir, ".backups");
|
|
102350
|
-
if (!existsSync62(root) ||
|
|
102438
|
+
if (!existsSync62(root) || lstatSync14(root).isSymbolicLink()) return;
|
|
102351
102439
|
for (const entry of readdirSync24(root, { withFileTypes: true })) {
|
|
102352
102440
|
if (!entry.isDirectory() || !/^[a-f0-9-]{36}$/.test(entry.name)) continue;
|
|
102353
102441
|
if (statSync23(join111(root, entry.name)).mtimeMs + EXPIRES_MS > Date.now()) continue;
|
|
@@ -102357,7 +102445,7 @@ function createWorkspaceBackupRoutes(options) {
|
|
|
102357
102445
|
}
|
|
102358
102446
|
}
|
|
102359
102447
|
const uploads = join111(root, "uploads");
|
|
102360
|
-
if (!existsSync62(uploads) ||
|
|
102448
|
+
if (!existsSync62(uploads) || lstatSync14(uploads).isSymbolicLink()) return;
|
|
102361
102449
|
for (const entry of readdirSync24(uploads, { withFileTypes: true })) {
|
|
102362
102450
|
if (!entry.isFile() || !/^[a-f0-9-]{36}\.ombbackup$/.test(entry.name)) continue;
|
|
102363
102451
|
const file2 = join111(uploads, entry.name);
|
|
@@ -102394,10 +102482,10 @@ function createWorkspaceBackupRoutes(options) {
|
|
|
102394
102482
|
function uploadsDirectory() {
|
|
102395
102483
|
const root = join111(options.dataDir, ".backups");
|
|
102396
102484
|
mkdirSync56(root, { recursive: true, mode: 448 });
|
|
102397
|
-
if (
|
|
102485
|
+
if (lstatSync14(root).isSymbolicLink()) throw failure3("Backup storage must not be a symbolic link.");
|
|
102398
102486
|
const directory = join111(root, "uploads");
|
|
102399
102487
|
mkdirSync56(directory, { recursive: true, mode: 448 });
|
|
102400
|
-
if (
|
|
102488
|
+
if (lstatSync14(directory).isSymbolicLink()) throw failure3("Backup storage must not be a symbolic link.");
|
|
102401
102489
|
return directory;
|
|
102402
102490
|
}
|
|
102403
102491
|
async function operate(work) {
|
|
@@ -102420,6 +102508,7 @@ function createWorkspaceBackupRoutes(options) {
|
|
|
102420
102508
|
const restored = options.restored;
|
|
102421
102509
|
json5(res, 200, {
|
|
102422
102510
|
...options.status(),
|
|
102511
|
+
busy: operating || options.status().busy,
|
|
102423
102512
|
progress,
|
|
102424
102513
|
lastRestoreId: restored.restored ? restored.id : null,
|
|
102425
102514
|
safetyCopyPath: restored.safetyCopyPath ?? null,
|
|
@@ -103327,7 +103416,7 @@ import { timingSafeEqual as timingSafeEqual5 } from "node:crypto";
|
|
|
103327
103416
|
import { isIP as isIP2 } from "node:net";
|
|
103328
103417
|
|
|
103329
103418
|
// server/connected-assistants.ts
|
|
103330
|
-
import { createHash as
|
|
103419
|
+
import { createHash as createHash45, randomBytes as randomBytes10, randomUUID as randomUUID37, timingSafeEqual as timingSafeEqual4 } from "node:crypto";
|
|
103331
103420
|
import { existsSync as existsSync63, mkdirSync as mkdirSync57, readdirSync as readdirSync25, readFileSync as readFileSync87, rmSync as rmSync19 } from "node:fs";
|
|
103332
103421
|
import { appendFile as appendFile5, mkdir as mkdir8 } from "node:fs/promises";
|
|
103333
103422
|
import { dirname as dirname31, join as join112 } from "node:path";
|
|
@@ -103342,7 +103431,7 @@ var recordSchema = external_exports.object({
|
|
|
103342
103431
|
allowCreate: external_exports.boolean()
|
|
103343
103432
|
});
|
|
103344
103433
|
var fileSchema3 = external_exports.object({ version: external_exports.literal(1), assistants: external_exports.array(recordSchema) });
|
|
103345
|
-
var hash3 = (token) =>
|
|
103434
|
+
var hash3 = (token) => createHash45("sha256").update(token).digest("hex");
|
|
103346
103435
|
var LAST_USED_WRITE_MS = 6e4;
|
|
103347
103436
|
var ConnectedAssistants = class {
|
|
103348
103437
|
assistants = [];
|
|
@@ -104042,8 +104131,8 @@ function resolveRequestAuth(req, options) {
|
|
|
104042
104131
|
}
|
|
104043
104132
|
|
|
104044
104133
|
// server/sessions.ts
|
|
104045
|
-
import { createHash as
|
|
104046
|
-
import { closeSync as
|
|
104134
|
+
import { createHash as createHash46, randomBytes as randomBytes11, randomUUID as randomUUID38, timingSafeEqual as timingSafeEqual6 } from "node:crypto";
|
|
104135
|
+
import { closeSync as closeSync18, existsSync as existsSync64, fsyncSync as fsyncSync5, mkdirSync as mkdirSync58, openSync as openSync18, readFileSync as readFileSync88, unlinkSync as unlinkSync15 } from "node:fs";
|
|
104047
104136
|
import { dirname as dirname32 } from "node:path";
|
|
104048
104137
|
var SCOPES = ["admin", "client"];
|
|
104049
104138
|
var PAIRING_CODE_ALPHABET = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ";
|
|
@@ -104081,7 +104170,7 @@ var sessionSchema = external_exports.object({
|
|
|
104081
104170
|
membershipAuthority: external_exports.literal("portal").optional()
|
|
104082
104171
|
});
|
|
104083
104172
|
var fileSchema4 = external_exports.object({ version: external_exports.literal(1), sessions: external_exports.array(sessionSchema) });
|
|
104084
|
-
var sha2562 = (value) =>
|
|
104173
|
+
var sha2562 = (value) => createHash46("sha256").update(value).digest("hex");
|
|
104085
104174
|
function sameDigest(a, b3) {
|
|
104086
104175
|
const left = Buffer.from(a, "hex");
|
|
104087
104176
|
const right = Buffer.from(b3, "hex");
|
|
@@ -104166,11 +104255,11 @@ var SessionRegistry = class {
|
|
|
104166
104255
|
}
|
|
104167
104256
|
syncDirectory() {
|
|
104168
104257
|
if (process.platform === "win32") return;
|
|
104169
|
-
const fd =
|
|
104258
|
+
const fd = openSync18(dirname32(this.options.file), "r");
|
|
104170
104259
|
try {
|
|
104171
104260
|
fsyncSync5(fd);
|
|
104172
104261
|
} finally {
|
|
104173
|
-
|
|
104262
|
+
closeSync18(fd);
|
|
104174
104263
|
}
|
|
104175
104264
|
}
|
|
104176
104265
|
/** Atomic write, owner-only, directory owner-only. */
|
|
@@ -105131,7 +105220,7 @@ function removeStream(clients, registry3, client) {
|
|
|
105131
105220
|
}
|
|
105132
105221
|
|
|
105133
105222
|
// server/phone-secret.ts
|
|
105134
|
-
import { createECDH, createHash as
|
|
105223
|
+
import { createECDH, createHash as createHash47 } from "node:crypto";
|
|
105135
105224
|
|
|
105136
105225
|
// node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/errors.js
|
|
105137
105226
|
var HpkeError = class extends Error {
|
|
@@ -107315,7 +107404,7 @@ function phoneSecretKeyIdFromJwk(jwk) {
|
|
|
107315
107404
|
const x2 = decodeBase64URL(jwk.x, 32);
|
|
107316
107405
|
const y = decodeBase64URL(jwk.y, 32);
|
|
107317
107406
|
if (!x2 || !y) return null;
|
|
107318
|
-
return
|
|
107407
|
+
return createHash47("sha256").update(Buffer.concat([Buffer.from([4]), x2, y])).digest().subarray(0, 16).toString("base64url");
|
|
107319
107408
|
}
|
|
107320
107409
|
function phoneSecretAAD(context) {
|
|
107321
107410
|
const fields = [
|
|
@@ -107335,7 +107424,7 @@ function phoneSecretAAD(context) {
|
|
|
107335
107424
|
}
|
|
107336
107425
|
function phoneSecretOperationId(context) {
|
|
107337
107426
|
const aad = phoneSecretAAD(context);
|
|
107338
|
-
return
|
|
107427
|
+
return createHash47("sha256").update(aad).update("\0").update(String(context.version)).update("\n").update(context.encapsulatedKey).update("\n").update(context.ciphertext).digest("base64url");
|
|
107339
107428
|
}
|
|
107340
107429
|
function assertPhoneSecretRequestMatches(context, authenticatedDeviceId, expected) {
|
|
107341
107430
|
if (context.deviceId !== authenticatedDeviceId || context.target !== expected.target || context.requestKey !== expected.requestKey) {
|
|
@@ -107913,8 +108002,8 @@ function appsByBot(result) {
|
|
|
107913
108002
|
}
|
|
107914
108003
|
|
|
107915
108004
|
// server/harness-import/dedupe.ts
|
|
107916
|
-
import { createHash as
|
|
107917
|
-
var fingerprint3 = (skill) =>
|
|
108005
|
+
import { createHash as createHash48 } from "node:crypto";
|
|
108006
|
+
var fingerprint3 = (skill) => createHash48("sha256").update(skill.files.map((file2) => `${file2.file}\0${file2.content.replace(/\r\n/g, "\n").trim()}`).join("\0\0")).digest("hex");
|
|
107918
108007
|
function words3(skill) {
|
|
107919
108008
|
const text18 = skill.files.map((file2) => file2.content).join("\n").toLowerCase();
|
|
107920
108009
|
return new Set(text18.match(/[a-z0-9]{3,}/g) ?? []);
|
|
@@ -108452,7 +108541,7 @@ Imported from ${names3.label}. This is the start of your notes; the whole of the
|
|
|
108452
108541
|
}
|
|
108453
108542
|
|
|
108454
108543
|
// server/harness-import/secrets.ts
|
|
108455
|
-
import { createHash as
|
|
108544
|
+
import { createHash as createHash49 } from "node:crypto";
|
|
108456
108545
|
var EXAMPLE_EMAIL_DOMAINS = /@(?:[a-z0-9-]+\.)*(?:example\.(?:com|org|net)|example|test|invalid)$/i;
|
|
108457
108546
|
var hasLetterAndDigit = (value) => /[A-Za-z]/.test(value) && /\d/.test(value);
|
|
108458
108547
|
var PATTERNS = [
|
|
@@ -108582,7 +108671,7 @@ function createSecretReferencer() {
|
|
|
108582
108671
|
const nameByDigest = /* @__PURE__ */ new Map();
|
|
108583
108672
|
const taken = /* @__PURE__ */ new Set();
|
|
108584
108673
|
const nameFor = (type, value, base5) => {
|
|
108585
|
-
const digest2 =
|
|
108674
|
+
const digest2 = createHash49("sha256").update(`${type}\0${value}`).digest("hex");
|
|
108586
108675
|
const known2 = nameByDigest.get(digest2);
|
|
108587
108676
|
if (known2) return known2;
|
|
108588
108677
|
let name2 = base5;
|
|
@@ -110050,7 +110139,7 @@ In ${identity3.label} this job ran on: ${trigger3}. The event that triggered thi
|
|
|
110050
110139
|
}
|
|
110051
110140
|
|
|
110052
110141
|
// server/harness-import/hermes.ts
|
|
110053
|
-
import { createHash as
|
|
110142
|
+
import { createHash as createHash50 } from "node:crypto";
|
|
110054
110143
|
import { existsSync as existsSync70, statSync as statSync27 } from "node:fs";
|
|
110055
110144
|
import { homedir as homedir46 } from "node:os";
|
|
110056
110145
|
import { basename as basename20, dirname as dirname35, isAbsolute as isAbsolute22, join as join119, resolve as resolve30 } from "node:path";
|
|
@@ -110373,7 +110462,7 @@ function bundledSkills(reader, profile) {
|
|
|
110373
110462
|
const text18 = reader.readText(`${profile.base}skills/.bundled_manifest`) ?? "";
|
|
110374
110463
|
return new Set(text18.split(/\r?\n/).map((line3) => line3.split(":")[0].trim()).filter(Boolean));
|
|
110375
110464
|
}
|
|
110376
|
-
var fingerprint4 = (files) =>
|
|
110465
|
+
var fingerprint4 = (files) => createHash50("sha256").update(files.map((file2) => `${file2.file}\0${file2.content.replace(/\r\n/g, "\n").trim()}`).join("\0\0")).digest("hex");
|
|
110377
110466
|
function mergeSkills2(found) {
|
|
110378
110467
|
const bySlug = /* @__PURE__ */ new Map();
|
|
110379
110468
|
for (const item of found) bySlug.set(item.slug, [...bySlug.get(item.slug) ?? [], { profile: item.profile, files: item.files, print: fingerprint4(item.files) }]);
|
|
@@ -110495,7 +110584,7 @@ function readHermesHome(root, options = {}) {
|
|
|
110495
110584
|
}
|
|
110496
110585
|
|
|
110497
110586
|
// server/harness-import/history.ts
|
|
110498
|
-
import { createHash as
|
|
110587
|
+
import { createHash as createHash51 } from "node:crypto";
|
|
110499
110588
|
import { mkdtempSync as mkdtempSync6, rmSync as rmSync20, statSync as statSync28, writeFileSync as writeFileSync33 } from "node:fs";
|
|
110500
110589
|
import { tmpdir as tmpdir11 } from "node:os";
|
|
110501
110590
|
import { join as join120 } from "node:path";
|
|
@@ -110635,7 +110724,7 @@ function locateFile(reader, ownerId, ref) {
|
|
|
110635
110724
|
return { key: key5, sourcePath: null, bytes: 0 };
|
|
110636
110725
|
}
|
|
110637
110726
|
function uploadIdFor(key5) {
|
|
110638
|
-
const hex3 =
|
|
110727
|
+
const hex3 = createHash51("sha256").update(`grokbot-history:${key5}`).digest("hex");
|
|
110639
110728
|
const variant = (parseInt(hex3[16], 16) & 3 | 8).toString(16);
|
|
110640
110729
|
return `${hex3.slice(0, 8)}-${hex3.slice(8, 12)}-5${hex3.slice(13, 16)}-${variant}${hex3.slice(17, 20)}-${hex3.slice(20, 32)}`;
|
|
110641
110730
|
}
|
|
@@ -111565,8 +111654,8 @@ import { homedir as homedir48 } from "node:os";
|
|
|
111565
111654
|
import { delimiter as delimiter7, join as join122 } from "node:path";
|
|
111566
111655
|
|
|
111567
111656
|
// server/app-installers.ts
|
|
111568
|
-
import { createHash as
|
|
111569
|
-
import { accessSync as accessSync3, constants as
|
|
111657
|
+
import { createHash as createHash52 } from "node:crypto";
|
|
111658
|
+
import { accessSync as accessSync3, constants as constants12, createReadStream as createReadStream5, createWriteStream as createWriteStream5, existsSync as existsSync72, mkdirSync as mkdirSync61, mkdtempSync as mkdtempSync7, renameSync as renameSync17, rmSync as rmSync21 } from "node:fs";
|
|
111570
111659
|
import { homedir as homedir47, tmpdir as tmpdir12 } from "node:os";
|
|
111571
111660
|
import { join as join121 } from "node:path";
|
|
111572
111661
|
import { Readable as Readable2 } from "node:stream";
|
|
@@ -111638,7 +111727,7 @@ async function downloadAsset(asset, dest, deps = {}) {
|
|
|
111638
111727
|
throw new AppInstallError("verify", `The download came from ${final.origin}, not GitHub.`);
|
|
111639
111728
|
}
|
|
111640
111729
|
if (!response.ok || !response.body) throw new AppInstallError("download", `The download answered ${response.status}.`);
|
|
111641
|
-
const hash4 =
|
|
111730
|
+
const hash4 = createHash52("sha256");
|
|
111642
111731
|
let received = 0;
|
|
111643
111732
|
let lastReport = 0;
|
|
111644
111733
|
const counter = async function* (source3) {
|
|
@@ -111691,7 +111780,7 @@ async function verifyPkgSignature(pkg, teamId, run7 = runTool) {
|
|
|
111691
111780
|
}
|
|
111692
111781
|
function writableDir(dir) {
|
|
111693
111782
|
try {
|
|
111694
|
-
accessSync3(dir,
|
|
111783
|
+
accessSync3(dir, constants12.W_OK);
|
|
111695
111784
|
return true;
|
|
111696
111785
|
} catch {
|
|
111697
111786
|
return false;
|
|
@@ -113049,7 +113138,7 @@ function botAccountIds(bot) {
|
|
|
113049
113138
|
}
|
|
113050
113139
|
|
|
113051
113140
|
// server/oauth-accounts.ts
|
|
113052
|
-
import { createHash as
|
|
113141
|
+
import { createHash as createHash53, randomBytes as randomBytes13, randomUUID as randomUUID44, timingSafeEqual as timingSafeEqual7 } from "node:crypto";
|
|
113053
113142
|
import { createServer as createServer3 } from "node:http";
|
|
113054
113143
|
|
|
113055
113144
|
// server/oauth-account-vault.ts
|
|
@@ -113234,7 +113323,7 @@ function createPkcePair() {
|
|
|
113234
113323
|
return { verifier, challenge: pkceChallenge(verifier) };
|
|
113235
113324
|
}
|
|
113236
113325
|
function pkceChallenge(verifier) {
|
|
113237
|
-
return base64url3(
|
|
113326
|
+
return base64url3(createHash53("sha256").update(verifier, "ascii").digest());
|
|
113238
113327
|
}
|
|
113239
113328
|
function buildAuthorizationUrl(input) {
|
|
113240
113329
|
const provider = OAUTH_PROVIDERS[input.provider];
|
|
@@ -113887,7 +113976,7 @@ import { timingSafeEqual as timingSafeEqual8 } from "node:crypto";
|
|
|
113887
113976
|
|
|
113888
113977
|
// server/vault/store.ts
|
|
113889
113978
|
import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, randomBytes as randomBytes14, randomUUID as randomUUID45 } from "node:crypto";
|
|
113890
|
-
import { lstatSync as
|
|
113979
|
+
import { lstatSync as lstatSync15, mkdirSync as mkdirSync64, readFileSync as readFileSync97, rmdirSync } from "node:fs";
|
|
113891
113980
|
import { join as join126 } from "node:path";
|
|
113892
113981
|
|
|
113893
113982
|
// shared/vault.ts
|
|
@@ -113997,7 +114086,7 @@ var VaultStore = class {
|
|
|
113997
114086
|
try {
|
|
113998
114087
|
let stat8;
|
|
113999
114088
|
try {
|
|
114000
|
-
stat8 =
|
|
114089
|
+
stat8 = lstatSync15(this.#file);
|
|
114001
114090
|
} catch (error51) {
|
|
114002
114091
|
if (error51.code === "ENOENT") return [];
|
|
114003
114092
|
throw error51;
|
|
@@ -125203,7 +125292,7 @@ function emailPersonKey(email3) {
|
|
|
125203
125292
|
return opaquePersonKey(`email:${email3.trim().toLowerCase()}`);
|
|
125204
125293
|
}
|
|
125205
125294
|
function opaquePersonKey(basis) {
|
|
125206
|
-
return `p_${
|
|
125295
|
+
return `p_${createHash54("sha256").update(basis).digest("base64url").slice(0, 22)}`;
|
|
125207
125296
|
}
|
|
125208
125297
|
function sharedMembership() {
|
|
125209
125298
|
return hostedWorkspaceConfiguration()?.portalMembership === true || signInAllowList().members.length > 0;
|
|
@@ -129975,7 +130064,7 @@ function ingestEngineHook(capability, body) {
|
|
|
129975
130064
|
if (!commandReceipt("hook.ingest", key5)) {
|
|
129976
130065
|
const dir = join136(TOOL_RESULTS_DIR, threadId.replace(/[^\w.-]/g, "_"));
|
|
129977
130066
|
mkdirSync72(dir, { recursive: true, mode: 448 });
|
|
129978
|
-
const safeId =
|
|
130067
|
+
const safeId = createHash54("sha256").update(key5).digest("hex");
|
|
129979
130068
|
const file2 = join136(dir, `${safeId}.txt`);
|
|
129980
130069
|
const redacted = redactSecretsInText(text18);
|
|
129981
130070
|
const bounded4 = redacted.length > TOOL_RESULT_SPILL_MAX ? `${redacted.slice(0, TOOL_RESULT_SPILL_MAX)}
|
|
@@ -130890,7 +130979,7 @@ bus.subscribe((event) => {
|
|
|
130890
130979
|
source: "delegated-grant"
|
|
130891
130980
|
} : ownVerdict;
|
|
130892
130981
|
if (roomAsk && permission && event.requestId && !verdict?.approve) {
|
|
130893
|
-
const actionHash =
|
|
130982
|
+
const actionHash = createHash54("sha256").update(JSON.stringify([event.threadId, event.requestId, event.tool, event.summary])).digest("hex");
|
|
130894
130983
|
teamRoomsHost?.approvalOpened(event.threadId, event.requestId, event.summary || event.tool, actionHash);
|
|
130895
130984
|
}
|
|
130896
130985
|
if (permission && asker && event.nativeReview === "inactive" && effectiveApprovalMode === "auto" && !nativeReviewNoticed.has(event.threadId)) {
|
|
@@ -132385,7 +132474,7 @@ async function startTurn(botId, text18, opts) {
|
|
|
132385
132474
|
sectionContextSystemPrompt(bot.section),
|
|
132386
132475
|
...instance.driverKind === "codex" ? [model2, effort ?? null] : []
|
|
132387
132476
|
];
|
|
132388
|
-
const sessionConfig = (soul) =>
|
|
132477
|
+
const sessionConfig = (soul) => createHash54("sha256").update(JSON.stringify([...persistentConfig, soul])).digest("hex").slice(0, 16);
|
|
132389
132478
|
const plannedConfig = sessionConfig(bot.soul);
|
|
132390
132479
|
const skillAuthoring = skillAuthoringEnabled(cfg) && agentsMounted;
|
|
132391
132480
|
const attachedText = commsDepth === 0 ? await withZipListings(providerText) : providerText;
|
|
@@ -135488,7 +135577,7 @@ function resolveSkillRequest(args) {
|
|
|
135488
135577
|
error: "reviewedSha256 must match the skill shown on the approval card"
|
|
135489
135578
|
};
|
|
135490
135579
|
}
|
|
135491
|
-
const previewSha256 =
|
|
135580
|
+
const previewSha256 = createHash54("sha256").update(request4.preview).digest("hex");
|
|
135492
135581
|
if (previewSha256 !== request4.sha256) {
|
|
135493
135582
|
return { claimed: true, status: 422, error: "the skill preview changed after review \u2014 deny and recreate it" };
|
|
135494
135583
|
}
|
|
@@ -136496,7 +136585,7 @@ var workspaceBackupRoutes = createWorkspaceBackupRoutes({
|
|
|
136496
136585
|
},
|
|
136497
136586
|
flush: async () => {
|
|
136498
136587
|
await Promise.all([flushAllProfileHistory(), flushAllMemoryJournals(), flushUsageLedger(DATA_DIR), flushDecisionLog(DATA_DIR), flushAdminActivity(DATA_DIR)]);
|
|
136499
|
-
closeMessageDb();
|
|
136588
|
+
if (keepLocked) closeMessageDb();
|
|
136500
136589
|
}
|
|
136501
136590
|
}, keepLocked)
|
|
136502
136591
|
});
|