limixbot 0.3.32 → 0.3.34
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/{ActivityPanel-DTPq6b6A.js → ActivityPanel-D6DmhLfH.js} +1 -1
- package/dist/assets/{App-Bj6vt28W.js → App-CapYM_v0.js} +115 -115
- package/dist/assets/{AppEventEditor-CIN9KfeN.js → AppEventEditor-Cojg-6wP.js} +1 -1
- package/dist/assets/{BotSettingsDialog-CiDt0xV-.js → BotSettingsDialog-CMEzuD0L.js} +1 -1
- package/dist/assets/{BrowserPanel-CYEYQdY9.js → BrowserPanel-CQESQao4.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-BZviBIr_.js → BrowserProfilesManager-C5WYWdmn.js} +1 -1
- package/dist/assets/{CloudAddDialog-CKOoPJ3V.js → CloudAddDialog-DtqFJ_Nv.js} +1 -1
- package/dist/assets/{ComputerFilesPane-DIDi3dyq.js → ComputerFilesPane-CkhkJsmz.js} +1 -1
- package/dist/assets/{ComputerPanel-CIfRLDu5.js → ComputerPanel-Db3Mn9xa.js} +2 -2
- package/dist/assets/{DataPanel-Cg_iZFBB.js → DataPanel-DEspadUr.js} +1 -1
- package/dist/assets/{DesktopViewer-CdrtMd2T.js → DesktopViewer-BTNJV_Aj.js} +1 -1
- package/dist/assets/{FilesView-DnL4MjaW.js → FilesView-DY3H41C3.js} +1 -1
- package/dist/assets/{GrokMoveDialog-C6j6PaOl.js → GrokMoveDialog-Rj4VoLop.js} +1 -1
- package/dist/assets/{InspectorPanel-AS99t3t_.js → InspectorPanel-D_2UZ8iD.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-B9MXqWn_.js → KeyboardShortcutsModal-Bjq1f2jJ.js} +1 -1
- package/dist/assets/{LiveDesktop-CeMAfpqi.js → LiveDesktop-Di_4nc-R.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-BjpJidzP.js → LocalVmWorkspace-DxYPyIdV.js} +1 -1
- package/dist/assets/{MacLocalControl-10Me_JS2.js → MacLocalControl-CIx84V6Z.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-BqtpdMVD.js → MarkdownFilePreview-2tIWuD5T.js} +1 -1
- package/dist/assets/{MenuMotion-DEol1e9x.js → MenuMotion-DZm5ukRq.js} +1 -1
- package/dist/assets/{NewBotDialog-VLJL3Wg1.js → NewBotDialog-CwlPmfRJ.js} +1 -1
- package/dist/assets/{PhoneAppDialog-DA5gvq4c.js → PhoneAppDialog-CmLZTwqV.js} +1 -1
- package/dist/assets/{PlacesRail-CLjAh1E0.js → PlacesRail-Yl5rjXRm.js} +1 -1
- package/dist/assets/{PluginsPanel-vWuf5IUu.js → PluginsPanel-Bab6fygX.js} +1 -1
- package/dist/assets/{ProIntroduction-Di0HbUFO.js → ProIntroduction-e77gSiw6.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-Cfw7teQ2.js → RemoteAgentSettingsPanel-v5bNpVEu.js} +1 -1
- package/dist/assets/{RoomPanel-Beu1uKue.js → RoomPanel-C2OUTw88.js} +1 -1
- package/dist/assets/{RoutinesPage-B2nYtQla.js → RoutinesPage-B5hwASRF.js} +1 -1
- package/dist/assets/{SettingsModal-CxvxkC4x.js → SettingsModal-Bm1Zltor.js} +1 -1
- package/dist/assets/{ShareTeamDialog-CIgmHhv0.js → ShareTeamDialog-CdA9mmhN.js} +1 -1
- package/dist/assets/{SignedInSites-DdJipkZg.js → SignedInSites-BQvqQcdb.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-BbDoilAy.js → TeamLibraryPanel-sNFe7c0I.js} +1 -1
- package/dist/assets/{TeamMapPage-BdJoToiU.js → TeamMapPage-BYkzRTBi.js} +1 -1
- package/dist/assets/{TriggersPage-tsPRVnW8.js → TriggersPage-k-1XAgSr.js} +1 -1
- package/dist/assets/{VisibilitySection-DtqlyqWE.js → VisibilitySection-DCenKwqa.js} +1 -1
- package/dist/assets/{WebhookTrigger-uKcCBfwA.js → WebhookTrigger-BOjywM8b.js} +1 -1
- package/dist/assets/{WorksOnGrid-W7nCND-A.js → WorksOnGrid-Dx2RAISy.js} +1 -1
- package/dist/assets/{abnfDiagram-YUKMZFIV-1x7ZPsZh.js → abnfDiagram-YUKMZFIV-CVPdxmn2.js} +1 -1
- package/dist/assets/{activity-GpccG6_T.js → activity-B5yJ2GDL.js} +1 -1
- package/dist/assets/{architectureDiagram-47P4ROYG-DPgLYL_N.js → architectureDiagram-47P4ROYG-DZQLCsi2.js} +1 -1
- package/dist/assets/{blockDiagram-E7TT5TSB-B8UWaM8D.js → blockDiagram-E7TT5TSB-BBzWSzMi.js} +1 -1
- package/dist/assets/{c4Diagram-CRA5TL53-PhITusI3.js → c4Diagram-CRA5TL53-BQV6hNIy.js} +1 -1
- package/dist/assets/{calendar-days-P76kOKJY.js → calendar-days-B08vvFAG.js} +1 -1
- package/dist/assets/channel-DkW7YLk2.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-C-oGd3d2.js → chunk-2Q5K7J3B-Sb-Qehaf.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-CVMG7tfk.js → chunk-5VM5RSS4-BB8zfLFE.js} +1 -1
- package/dist/assets/{chunk-7TKQ45FW-DIyFSChV.js → chunk-7TKQ45FW-Dhizosqi.js} +1 -1
- package/dist/assets/{chunk-AW2ZBBNX-C3UOIXSH.js → chunk-AW2ZBBNX-Bn2Zs9UB.js} +1 -1
- package/dist/assets/{chunk-FVRAUYC3-DVAx09Rs.js → chunk-FVRAUYC3-CZVqY4Hi.js} +2 -2
- package/dist/assets/{chunk-HTAEGDNF-BI4rDzDQ.js → chunk-HTAEGDNF-BZeda9aH.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-B6xY9PZq.js → chunk-JWPE2WC7-DZydZZMB.js} +1 -1
- package/dist/assets/{chunk-KQW6MTUR-ws1ilD7-.js → chunk-KQW6MTUR-DAHm8GzR.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-BwfcVKlj.js → chunk-XXDRQBXY-BmoP6TXk.js} +1 -1
- package/dist/assets/{classDiagram-v2-K4WV4PDN-DPeRWn_e.js → classDiagram-v2-K4WV4PDN-BThaxJlW.js} +1 -1
- package/dist/assets/{coins-VtDzkYpc.js → coins-DaYsnbsV.js} +1 -1
- package/dist/assets/{core-CV44ZFYc.js → core-3Ci07HxQ.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-CR5hRFOZ.js → cose-bilkent-JH36ORCC-6l_8qv9P.js} +1 -1
- package/dist/assets/{cynefin-EF2NZ3EQ-BdW2wt4-.js → cynefin-EF2NZ3EQ-LD5zSUkU.js} +1 -1
- package/dist/assets/{cynefinDiagram-3GCD6N5R-EhtqWRNM.js → cynefinDiagram-3GCD6N5R-DKdAEod9.js} +1 -1
- package/dist/assets/{dagre-W4DXFKR2-Di0n1jqp.js → dagre-W4DXFKR2-DjjcU6Qz.js} +1 -1
- package/dist/assets/{diagram-2UJZ2QOL-CgMGoKY7.js → diagram-2UJZ2QOL-yTUzBNbE.js} +1 -1
- package/dist/assets/{diagram-OVF4WLC6-BXlgzlCn.js → diagram-OVF4WLC6-sDqZrfa8.js} +1 -1
- package/dist/assets/{diagram-PFPMY2P6-CdQkKIW8.js → diagram-PFPMY2P6-DOxHpc7E.js} +1 -1
- package/dist/assets/{diagram-UMYRVEAY-DZl5kJRn.js → diagram-UMYRVEAY-ZoGqiYy-.js} +1 -1
- package/dist/assets/{diagram-YEKJPTXX-Bzz0W_ze.js → diagram-YEKJPTXX-DUKWdVhP.js} +1 -1
- package/dist/assets/{diagram-ZIFT7M5P-CMS1E0WQ.js → diagram-ZIFT7M5P-D3HkG8oy.js} +1 -1
- package/dist/assets/{ebnfDiagram-VR2GEFS7-DoPCvtki.js → ebnfDiagram-VR2GEFS7-hYyhCnfG.js} +1 -1
- package/dist/assets/{elk-IJKZMXRS-Bj-Bb2qu.js → elk-IJKZMXRS-D339ZeDG.js} +1 -1
- package/dist/assets/{erDiagram-O2IAPWRE-CB5nst9m.js → erDiagram-O2IAPWRE-D6W7etQ6.js} +1 -1
- package/dist/assets/{file-up-C-A7EgY2.js → file-up-DMfo2dPs.js} +1 -1
- package/dist/assets/{flowDiagram-OXPTDLAJ-CCgbFCEu.js → flowDiagram-OXPTDLAJ-Dg0YwW4g.js} +1 -1
- package/dist/assets/{ganttDiagram-R7TSEDQI-DQVyHiAx.js → ganttDiagram-R7TSEDQI-BFgz4qw1.js} +1 -1
- package/dist/assets/{gitGraphDiagram-XJZIOB7I-jS2mWNam.js → gitGraphDiagram-XJZIOB7I-DaEz7Hat.js} +1 -1
- package/dist/assets/{import-name-X30o5z1B.js → import-name-CLZW2lRg.js} +1 -1
- package/dist/assets/{index-D8oAKMU6.js → index-D-MiT8O1.js} +2 -2
- package/dist/assets/{index-SxUH0lfM.js → index-TQqhRmQq.js} +1 -1
- package/dist/assets/{infoDiagram-5W2HQ5XZ-DzRRVnLP.js → infoDiagram-5W2HQ5XZ-QLlSZCWL.js} +1 -1
- package/dist/assets/{ishikawaDiagram-K3B6WC7H-BHZdIugB.js → ishikawaDiagram-K3B6WC7H-BzTdOh-y.js} +1 -1
- package/dist/assets/{journeyDiagram-COXZFDF6-DNwsxsaw.js → journeyDiagram-COXZFDF6-zUZSaPyg.js} +1 -1
- package/dist/assets/{kanban-definition-P3RFRI5V-DpBOTH95.js → kanban-definition-P3RFRI5V-CaaLn1rY.js} +1 -1
- package/dist/assets/{mcp-servers-DjbULZwc.js → mcp-servers-CgaYkXX0.js} +1 -1
- package/dist/assets/{mermaid.core-DuHmv3Xq.js → mermaid.core-g3fLXVjq.js} +4 -4
- package/dist/assets/{mindmap-definition-LZFPQGKD-BBiNJgPA.js → mindmap-definition-LZFPQGKD-EVL91zhb.js} +1 -1
- package/dist/assets/{minimize-CRS6u26E.js → minimize-BQFa1hwF.js} +1 -1
- package/dist/assets/{monitor-CyzqeASh.js → monitor-x-u922nz.js} +1 -1
- package/dist/assets/{new-bot-Bs8pJ7Bw.js → new-bot-DzbgGXn-.js} +1 -1
- package/dist/assets/{org-library-CC1En5aB.js → org-library-DkbnXLFg.js} +1 -1
- package/dist/assets/{package-format-BCGzeYHa.js → package-format-CB7fxKL9.js} +1 -1
- package/dist/assets/{pegDiagram-BGZESJAR-DqEbd745.js → pegDiagram-BGZESJAR-BqX6F1FW.js} +1 -1
- package/dist/assets/{pieDiagram-CAPJLFHJ-D9U2FmuX.js → pieDiagram-CAPJLFHJ-B8vuxe1N.js} +1 -1
- package/dist/assets/{quadrantDiagram-GDMTTRAM-PKCaSgAj.js → quadrantDiagram-GDMTTRAM-ByzqouSR.js} +1 -1
- package/dist/assets/{rail-DKRV3i4L.js → rail-Nqbc9WBZ.js} +1 -1
- package/dist/assets/{railroadDiagram-SM67HX2B-DqwQrNIl.js → railroadDiagram-SM67HX2B-uN1VBRSb.js} +1 -1
- package/dist/assets/{remote-desktop-panel-B3m0CdWN.js → remote-desktop-panel-BLYwzVmF.js} +1 -1
- package/dist/assets/{requirementDiagram-X7JNWC4A-DyFQPw-w.js → requirementDiagram-X7JNWC4A-BklBK5qP.js} +1 -1
- package/dist/assets/{sankeyDiagram-UM26HJRW-D_-3g90K.js → sankeyDiagram-UM26HJRW-4MFeK8ln.js} +1 -1
- package/dist/assets/{sequenceDiagram-ZO4K6R2Y-BxkfrM9A.js → sequenceDiagram-ZO4K6R2Y-DOUNv1dC.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-VDgtfHsZ.js → sizeCapture-INFHLROL-CJHAWuY5.js} +1 -1
- package/dist/assets/{stateDiagram-v2-TBUQTH76-ey-mFs--.js → stateDiagram-v2-TBUQTH76-BeRDQs-r.js} +1 -1
- package/dist/assets/{styles-Dd_7YOJG.js → styles-C4M0urby.js} +2 -2
- package/dist/assets/{styles-BxpHDI63.css → styles-Uo_xbM0W.css} +1 -1
- package/dist/assets/{swimlanes-N4OXWK64-DYpwISFq.js → swimlanes-N4OXWK64-D6Jn2qj0.js} +1 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-WFJUUdeL.js +8 -0
- package/dist/assets/{team-share-CVqY6tnj.js → team-share-g7t2yuud.js} +1 -1
- package/dist/assets/{timeline-definition-YOQAKGHF-D9iKG2OF.js → timeline-definition-YOQAKGHF-CdFRZP34.js} +1 -1
- package/dist/assets/{usecaseDiagram-VIAY4XPW-Bfbw61-j.js → usecaseDiagram-VIAY4XPW-B-TLOhbx.js} +1 -1
- package/dist/assets/{vennDiagram-BLWOH2XV-DYVrjpQ_.js → vennDiagram-BLWOH2XV-QUyprWmU.js} +1 -1
- package/dist/assets/{vi-DrsTFzsG.js → vi-BZ746Wlh.js} +1 -1
- package/dist/assets/{wardleyDiagram-YMQ3BMBF-3Aod1B1D.js → wardleyDiagram-YMQ3BMBF-ei65JpWZ.js} +1 -1
- package/dist/assets/{xychartDiagram-TAQBALBS-BgJsKil4.js → xychartDiagram-TAQBALBS-Lezk59F3.js} +1 -1
- package/dist/index.html +3 -3
- package/dist/rail.html +5 -5
- package/dist-server/index.js +152 -149
- package/dist-server/package.json +1 -1
- package/dist-server/server/index.js +3 -3
- package/dist-server/server/limix-skill-requirements.js +3 -1
- package/dist-server/server/limix-transfer-account.js +13 -0
- package/dist-server/server/workspace-backup-http.js +8 -3
- package/dist-server/server/workspace-backup.js +23 -3
- package/dist-server/workspace-backup.worker.js +14 -13
- package/package.json +1 -1
- package/dist/assets/channel-CJO5KL4z.js +0 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-BNLJTe-b.js +0 -8
package/dist-server/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"0.3.
|
|
1
|
+
{"type":"module","version":"0.3.34"}
|
|
@@ -633,10 +633,10 @@ process.once("exit", releaseDataDirLeaseAtExit);
|
|
|
633
633
|
let workspaceRestore = { restored: false };
|
|
634
634
|
let restoredAtStart;
|
|
635
635
|
if (existsSync(join(DATA_DIR, ".backups"))) {
|
|
636
|
-
workspaceRestore = applyPendingWorkspaceRestore(DATA_DIR);
|
|
636
|
+
workspaceRestore = applyPendingWorkspaceRestore(DATA_DIR, { accountId: process.env.LIMIX_ACCOUNT_USER_ID ?? null, currentAppVersion: serverVersion() });
|
|
637
637
|
if (workspaceRestore.restored)
|
|
638
638
|
restoredAtStart = workspaceRestore.id;
|
|
639
|
-
if (!workspaceRestore.restored && !workspaceRestore.rolledBack)
|
|
639
|
+
if (!workspaceRestore.restored && !workspaceRestore.rolledBack && !workspaceRestore.blockedReason)
|
|
640
640
|
workspaceRestore = readLastWorkspaceRestore(DATA_DIR) ?? workspaceRestore;
|
|
641
641
|
}
|
|
642
642
|
dataFormatAtStart("stamp", DATA_DIR, serverVersion());
|
|
@@ -12304,7 +12304,7 @@ const workspaceBackupAccess = {
|
|
|
12304
12304
|
}, keepLocked),
|
|
12305
12305
|
status: () => ({ busy: workspaceMaintenance.active, pendingRestore: workspaceMaintenance.pendingRestore }),
|
|
12306
12306
|
};
|
|
12307
|
-
const workspaceCopyAccess = { dataDir: DATA_DIR, appVersion: serverVersion(), readBody, restored: workspaceRestore, ...workspaceBackupAccess, ...(CLOUD_HOME ? { restart: () => { restartRequested = true; gracefulShutdown(); } } : {}) };
|
|
12307
|
+
const workspaceCopyAccess = { accountId: () => process.env.LIMIX_ACCOUNT_USER_ID ?? null, dataDir: DATA_DIR, appVersion: serverVersion(), readBody, restored: workspaceRestore, ...workspaceBackupAccess, ...(CLOUD_HOME ? { restart: () => { restartRequested = true; gracefulShutdown(); } } : {}) };
|
|
12308
12308
|
const workspaceBackupRoutes = createWorkspaceBackupRoutes(workspaceCopyAccess);
|
|
12309
12309
|
let restartRequested = false;
|
|
12310
12310
|
const cloudMoveRoutes = createCloudMoveRoutes();
|
|
@@ -25,7 +25,7 @@ export function extractSkillRequirements(text) {
|
|
|
25
25
|
out.push({ kind: "review", name: raw, evidence });
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
|
-
out.push({ kind, name, ...(match?.[2] ? { required: match[2] } : {}), evidence });
|
|
28
|
+
out.push({ kind, name, ...(kind === "npm" && !["remotion", "@remotion/cli"].includes(name) && /\bnpm\s+(?:install|i)\b[^\n]*\s(?:-g|--global)(?:\s|$)/.test(evidence.split(/\s#|[;&|]/)[0]) ? { installScope: "tool" } : {}), ...(match?.[2] ? { required: match[2] } : {}), evidence });
|
|
29
29
|
};
|
|
30
30
|
const read = (value, kind, evidence) => {
|
|
31
31
|
if (Array.isArray(value))
|
|
@@ -287,6 +287,8 @@ export async function scanSkillRequirements(bots, mcpServers = {}, projects = []
|
|
|
287
287
|
result.status = pkg ? req.required && req.required !== "*" ? "review" : "found" : "missing";
|
|
288
288
|
if (pkg)
|
|
289
289
|
Object.assign(result, pkg);
|
|
290
|
+
if (req.installScope === "tool" && BIN.test(req.name) && !findSkillBinary(req.name, dirs))
|
|
291
|
+
result.status = "missing";
|
|
290
292
|
}
|
|
291
293
|
else if (req.kind === "env")
|
|
292
294
|
result.status = process.env[req.name] ? "found" : "missing";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createHash, timingSafeEqual } from 'node:crypto';
|
|
2
|
+
/** ID is supplied by the desktop's accepted Limix sign-in, never by the import request or editable profile. */
|
|
3
|
+
export function transferAccountHash(id) {
|
|
4
|
+
if (typeof id !== 'string' || !/^limix:[a-z0-9._-]{1,64}$/.test(id))
|
|
5
|
+
throw new Error('Hãy đăng nhập tài khoản Limix trước khi chuyển máy Offline.');
|
|
6
|
+
return createHash('sha256').update(`limix-offline-transfer-v1:${id}`).digest('hex');
|
|
7
|
+
}
|
|
8
|
+
export function assertTransferAccount(owner, accountId) {
|
|
9
|
+
const expected = transferAccountHash(accountId);
|
|
10
|
+
if (!owner || !/^[0-9a-f]{64}$/.test(owner) || !timingSafeEqual(Buffer.from(owner, 'hex'), Buffer.from(expected, 'hex'))) {
|
|
11
|
+
throw new Error('File chuyển máy không thuộc tài khoản Limix đang đăng nhập. Hãy đăng nhập đúng tài khoản đã xuất file. File cũ không có thông tin chủ tài khoản cần được xuất lại.');
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { transferAccountHash } from "./limix-transfer-account.js";
|
|
1
2
|
import { randomUUID } from "node:crypto";
|
|
2
3
|
import { createReadStream, createWriteStream, existsSync, lstatSync, mkdirSync, readdirSync, statSync, unlinkSync } from "node:fs";
|
|
3
4
|
import { join } from "node:path";
|
|
@@ -20,6 +21,7 @@ export function isWorkspaceBackupSessionControl(method, path) {
|
|
|
20
21
|
}
|
|
21
22
|
/** Admin-only; passwords and raw credential metadata never appear in URLs, responses, logs or broadcasts. */
|
|
22
23
|
export function createWorkspaceBackupRoutes(options) {
|
|
24
|
+
const account = () => { const id = options.accountId?.() ?? null; transferAccountHash(id); return id; };
|
|
23
25
|
const artifacts = new Map();
|
|
24
26
|
let operating = false;
|
|
25
27
|
const json = (res, status, body) => {
|
|
@@ -122,6 +124,8 @@ export function createWorkspaceBackupRoutes(options) {
|
|
|
122
124
|
if (method === "GET" && path === `${PREFIX}/status`) {
|
|
123
125
|
json(res, 200, {
|
|
124
126
|
...options.status(),
|
|
127
|
+
accountReady: Boolean(options.accountId?.()),
|
|
128
|
+
blockedReason: options.restored.blockedReason ?? null,
|
|
125
129
|
...(options.restart ? { restarts: true } : {}),
|
|
126
130
|
lastRestoreId: options.restored.restored ? options.restored.id : null,
|
|
127
131
|
safetyCopyPath: options.restored.safetyCopyPath ?? null,
|
|
@@ -141,12 +145,13 @@ export function createWorkspaceBackupRoutes(options) {
|
|
|
141
145
|
if (Buffer.byteLength(JSON.stringify(body.clientState)) > MAX_CLIENT_STATE_BYTES)
|
|
142
146
|
throw failure("Saved drafts exceed the 2 MB backup preference limit.", 413);
|
|
143
147
|
const clientState = Object.fromEntries(Object.entries(body.clientState).filter(([key]) => WORKSPACE_BACKUP_CLIENT_KEYS.includes(key)));
|
|
148
|
+
const currentAccount = account();
|
|
144
149
|
const result = await operate(() => options.exclusive(async () => {
|
|
145
150
|
check(req, auth);
|
|
146
151
|
replacePrevious(auth, ["download"]);
|
|
147
152
|
if (artifacts.size >= 4)
|
|
148
153
|
throw failure("There are already four backup files in progress. Restart or wait an hour before creating another.", 409);
|
|
149
|
-
return createWorkspaceBackup(options.dataDir, { password: body.password, clientState, appVersion: options.appVersion, omitMedia: body.omitMedia });
|
|
154
|
+
return createWorkspaceBackup(options.dataDir, { password: body.password, clientState, appVersion: options.appVersion, omitMedia: body.omitMedia, accountId: currentAccount });
|
|
150
155
|
}));
|
|
151
156
|
try {
|
|
152
157
|
check(req, auth);
|
|
@@ -216,7 +221,7 @@ export function createWorkspaceBackupRoutes(options) {
|
|
|
216
221
|
if (method === "POST" && path === `${PREFIX}/preview`) {
|
|
217
222
|
const body = z.object({ id: z.string().uuid(), password: passwordSchema }).parse(await options.readBody(req));
|
|
218
223
|
const artifact = get(body.id, auth, "upload");
|
|
219
|
-
const result = await operate(() => stageWorkspaceBackup(options.dataDir, artifact.path, { password: body.password, currentAppVersion: options.appVersion }));
|
|
224
|
+
const result = await operate(() => stageWorkspaceBackup(options.dataDir, artifact.path, { password: body.password, currentAppVersion: options.appVersion, accountId: account() }));
|
|
220
225
|
try {
|
|
221
226
|
check(req, auth);
|
|
222
227
|
}
|
|
@@ -238,7 +243,7 @@ export function createWorkspaceBackupRoutes(options) {
|
|
|
238
243
|
get(body.id, auth, "staged");
|
|
239
244
|
const result = await operate(() => options.exclusive(async () => {
|
|
240
245
|
check(req, auth);
|
|
241
|
-
return commitPendingWorkspaceRestore(options.dataDir, body.id);
|
|
246
|
+
return commitPendingWorkspaceRestore(options.dataDir, body.id, { accountId: account(), currentAppVersion: options.appVersion });
|
|
242
247
|
}, true));
|
|
243
248
|
artifacts.delete(body.id);
|
|
244
249
|
const restart = options.restart;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assertTransferAccount, transferAccountHash } from "./limix-transfer-account.js";
|
|
1
2
|
import { assertTransferVersion } from "./limix-transfer-version.js";
|
|
2
3
|
// Encrypted filesystem snapshot: quiesce writers before create/commit; restore runs before config/store load.
|
|
3
4
|
import { createCipheriv, createDecipheriv, createHash, randomBytes, randomUUID, scrypt } from "node:crypto";
|
|
@@ -491,6 +492,7 @@ export async function createWorkspaceBackupSnapshot(dataDir, options, jobId) {
|
|
|
491
492
|
exclusions: options.omitMedia ? [...EXCLUSION_NOTES, "Media files and attachment/upload folders are omitted from this offline transfer."] : EXCLUSION_NOTES, warnings,
|
|
492
493
|
};
|
|
493
494
|
const manifest = {
|
|
495
|
+
...(options.accountId !== undefined ? { account: transferAccountHash(options.accountId) } : {}),
|
|
494
496
|
summary, sourceDataDir: resolve(dataDir), clientState: options.clientState ?? {}, entries,
|
|
495
497
|
};
|
|
496
498
|
writeJson(join(snapshot, "manifest.json"), manifest);
|
|
@@ -530,7 +532,7 @@ function validateManifest(value) {
|
|
|
530
532
|
value.sourceDataDir.length > 4096 || value.sourceDataDir.includes("\0") ||
|
|
531
533
|
value.sourceDataDir === posix.parse(value.sourceDataDir).root || value.sourceDataDir === win32.parse(value.sourceDataDir).root ||
|
|
532
534
|
value.sourceDataDir.replaceAll("\\", "/").split("/").some((part) => part === "." || part === "..") ||
|
|
533
|
-
Object.keys(value).some((key) => !["summary", "sourceDataDir", "clientState", "entries"].includes(key)) ||
|
|
535
|
+
Object.keys(value).some((key) => !["summary", "sourceDataDir", "clientState", "entries", "account"].includes(key)) ||
|
|
534
536
|
Object.keys(value.summary).some((key) => !["format", "version", "id", "createdAt", "appVersion", "files", "directories", "bytes", "bots", "groups", "threads", "messages", "exclusions", "warnings"].includes(key)) || !record(value.clientState) ||
|
|
535
537
|
!Object.values(value.clientState).every((item) => typeof item === "string") || !Array.isArray(value.entries) ||
|
|
536
538
|
value.entries.length > MAX_WORKSPACE_BACKUP_FILES)
|
|
@@ -546,6 +548,8 @@ function validateManifest(value) {
|
|
|
546
548
|
if (!Array.isArray(value.summary[key]) || !value.summary[key].every((item) => typeof item === "string"))
|
|
547
549
|
throw new Error("Invalid workspace backup summary.");
|
|
548
550
|
}
|
|
551
|
+
if (value.account !== undefined && (typeof value.account !== "string" || !/^[0-9a-f]{64}$/.test(value.account)))
|
|
552
|
+
throw new Error("Invalid backup account binding.");
|
|
549
553
|
const names = new Map();
|
|
550
554
|
let bytes = 0;
|
|
551
555
|
let files = 0;
|
|
@@ -718,6 +722,8 @@ export async function stageWorkspaceBackup(dataDir, archivePath, options) {
|
|
|
718
722
|
const tar = await import("tar");
|
|
719
723
|
await tar.x({ file: plaintext, cwd: staged, strict: true, preservePaths: false, umask: 0o077, noChmod: true, brotli: false, zstd: false });
|
|
720
724
|
const manifest = validateStaged(staged, expected);
|
|
725
|
+
if (manifest.account || options.accountId !== undefined)
|
|
726
|
+
assertTransferAccount(manifest.account, options.accountId);
|
|
721
727
|
if (options.currentAppVersion !== undefined)
|
|
722
728
|
assertTransferVersion(manifest.summary.appVersion, options.currentAppVersion);
|
|
723
729
|
rmSync(plaintext);
|
|
@@ -743,7 +749,7 @@ export function stagedWorkspaceData(dataDir, id) {
|
|
|
743
749
|
const staged = join(jobPath(dataDir, id), "staged");
|
|
744
750
|
return { data: join(staged, "data"), sourceDataDir: validateManifest(privateJson(join(staged, "manifest.json"))).sourceDataDir };
|
|
745
751
|
}
|
|
746
|
-
export function commitPendingWorkspaceRestore(dataDir, id) {
|
|
752
|
+
export function commitPendingWorkspaceRestore(dataDir, id, options = {}) {
|
|
747
753
|
const root = backupRoot(dataDir);
|
|
748
754
|
if (existsSync(join(root, "pending-restore.json")))
|
|
749
755
|
throw new Error("A workspace restore is already waiting for restart.");
|
|
@@ -751,6 +757,10 @@ export function commitPendingWorkspaceRestore(dataDir, id) {
|
|
|
751
757
|
throw new Error("This restore was already attempted. Preview the backup again to create a fresh restore attempt.");
|
|
752
758
|
const metadata = readStagedWorkspaceBackup(dataDir, id);
|
|
753
759
|
const manifest = validateStaged(join(jobPath(dataDir, id), "staged"));
|
|
760
|
+
if (manifest.account || options.accountId !== undefined)
|
|
761
|
+
assertTransferAccount(manifest.account, options.accountId);
|
|
762
|
+
if (options.currentAppVersion !== undefined)
|
|
763
|
+
assertTransferVersion(manifest.summary.appVersion, options.currentAppVersion);
|
|
754
764
|
// Adapt before persisting a restart request: a broken legacy file must not trap later boots.
|
|
755
765
|
prepareRestore(dataDir, id, manifest);
|
|
756
766
|
writeJson(join(root, "pending-restore.json"), { id });
|
|
@@ -1060,7 +1070,7 @@ function finishRestore(dataDir, id, consumePending = true) {
|
|
|
1060
1070
|
return result;
|
|
1061
1071
|
}
|
|
1062
1072
|
/** Call after the data-directory lease, before anything reads app state; the old tree stays under .backups/safety-ID. */
|
|
1063
|
-
export function applyPendingWorkspaceRestore(dataDir) {
|
|
1073
|
+
export function applyPendingWorkspaceRestore(dataDir, options = {}) {
|
|
1064
1074
|
const root = backupRoot(dataDir);
|
|
1065
1075
|
const journalFile = join(root, "restore-journal.json");
|
|
1066
1076
|
const pendingFile = join(root, "pending-restore.json");
|
|
@@ -1095,6 +1105,16 @@ export function applyPendingWorkspaceRestore(dataDir) {
|
|
|
1095
1105
|
}
|
|
1096
1106
|
const staged = join(jobPath(dataDir, pending.id), "staged");
|
|
1097
1107
|
const manifest = validateStaged(staged);
|
|
1108
|
+
try {
|
|
1109
|
+
if (manifest.account || options.accountId !== undefined)
|
|
1110
|
+
assertTransferAccount(manifest.account, options.accountId);
|
|
1111
|
+
if (options.currentAppVersion !== undefined)
|
|
1112
|
+
assertTransferVersion(manifest.summary.appVersion, options.currentAppVersion);
|
|
1113
|
+
}
|
|
1114
|
+
catch (error) {
|
|
1115
|
+
rmSync(pendingFile, { force: true });
|
|
1116
|
+
return { restored: false, blockedReason: error instanceof Error ? error.message : "Restore blocked" };
|
|
1117
|
+
}
|
|
1098
1118
|
const prepared = prepareRestore(dataDir, pending.id, manifest);
|
|
1099
1119
|
folder(join(safetyCopyPath, "data"));
|
|
1100
1120
|
const journal = {
|
|
@@ -217,7 +217,7 @@ eing saved from a phone","serverError.secret.credentialDismissed":"this credenti
|
|
|
217
217
|
ot.viewOnly":"You can view {bot}, not chat with it.","serverError.secret.mailboxAlreadyConnected":"this mailbox was already connected","serverError.secret.emailAndPassword":"Enter your email address and its password.","serverError.secret.emailUnavailable":"Email can't be connected here.","serverError.mailbox.adminOnly":"Only the owner or an admin can manage the mailboxes.","serverError.mailbox.addressAndPassword":"Enter your email address and password.","serverError.mailbox.outgoingFields":"Chec\
|
|
218
218
|
k the outgoing server: a name like mail.example.com, a port from 1 to 65535, and SSL/TLS or STARTTLS.","serverError.voice.fishKeyRequired":"Add a Fish Audio key in Settings \u2192 API keys to talk to your bots here.","serverError.voice.fishTranscribeConnection":"Couldn't reach Fish Audio to hear you \u2014 check your connection.","serverError.file.tooLarge":"This file is {size}, over the {limit} limit for opening files from chat. The file itself is still saved as {name}."};function userError(key,params){
|
|
219
219
|
let safe=params&&redactParams(params);return{error:formatServerText(USER_ERROR[key],safe),errorKey:key,...safe?{errorParams:safe}:{}}}function userErrorThrown(key,params){let{error:error62,...fields}=userError(key,params);return Object.assign(new Error(error62),fields)}function userErrorFields(value){let{errorKey,errorParams}=Object(value);if(typeof errorKey!="string"||!Object.hasOwn(USER_ERROR,errorKey))return{};let params=errorParams&&typeof errorParams=="object"&&!Array.isArray(errorParams)?redactParams(
|
|
220
|
-
errorParams):void 0;return{errorKey,...params?{errorParams:params}:{}}}import{createCipheriv,createDecipheriv,createHash as
|
|
220
|
+
errorParams):void 0;return{errorKey,...params?{errorParams:params}:{}}}import{createHash,timingSafeEqual}from"node:crypto";function transferAccountHash(id2){if(typeof id2!="string"||!/^limix:[a-z0-9._-]{1,64}$/.test(id2))throw new Error("H\xE3y \u0111\u0103ng nh\u1EADp t\xE0i kho\u1EA3n Limix tr\u01B0\u1EDBc khi chuy\u1EC3n m\xE1y Offline.");return createHash("sha256").update(`limix-offline-transfer-v1:${id2}`).digest("hex")}import{createCipheriv,createDecipheriv,createHash as createHash3,randomBytes,randomUUID as randomUUID2,scrypt}from"node:crypto";import{chmodSync,closeSync as closeSync3,constants as constants2,cpSync,createReadStream,createWriteStream,existsSync as existsSync3,fstatSync as fstatSync3,fsyncSync as fsyncSync2,lstatSync as lstatSync2,mkdirSync as mkdirSync2,openSync as openSync3,readFileSync as readFileSync5,readdirSync as readdirSync3,readSync as readSync2,realpathSync,renameSync as renameSync4,rmSync as rmSync2,
|
|
221
221
|
writeFileSync as writeFileSync2,writeSync as writeSync2}from"node:fs";import{isAbsolute as isAbsolute3,join as join13,parse as parse3,posix,relative as relative2,resolve as resolve2,sep,win32}from"node:path";import{homedir as homedir2}from"node:os";import{backup,DatabaseSync as DatabaseSync3}from"node:sqlite";import{pipeline}from"node:stream/promises";import{randomUUID}from"node:crypto";import{closeSync,constants,fstatSync,fsyncSync,lstatSync,openSync,readFileSync,renameSync,unlinkSync,writeFileSync}from"node:fs";var RENAME_RETRY_DELAYS_MS=[5,10,20,40,80],RETRYABLE_RENAME_CODES=new Set(["EPERM","EACCES","EBUSY"]);function sleepSync(ms2){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,ms2)}function renameWithRetry(tmp,path,rename=renameSync){for(let attempt=0;;attempt+=1)try{rename(tmp,path);return}catch(e){let code=e.code;if(!code||
|
|
222
222
|
!RETRYABLE_RENAME_CODES.has(code)||attempt>=RENAME_RETRY_DELAYS_MS.length)throw e;sleepSync(RENAME_RETRY_DELAYS_MS[attempt])}}function writeFileAtomic(path,data,options2={}){let tmp=`${path}.${process.pid}.${randomUUID()}.tmp`,fd=null;try{fd=openSync(tmp,"w",options2.mode),writeFileSync(fd,data),options2.durable!==!1&&fsyncSync(fd),closeSync(fd),fd=null,renameWithRetry(tmp,path)}catch(e){if(fd!==null)try{closeSync(fd)}catch{}try{unlinkSync(tmp)}catch{}throw e}}var WORKSPACE_BACKUP_CLIENT_KEYS=["omb-drafts","omb-draft-attachments","omb-draft-send-ids","omb-draft-channel-modes","omb-skin","omb-show-threads","omb-show-run-card","omb-send-key","omb-color-user-bubbles","omb-chat-width","openmausbot.sidebarDensity","openmausbot.sidebarToolsLayout","openmausbot.sidebarCollapsedSections.v1","openmausbot.sidebarSectionOrder.v1","omb-analytics-opt-out","openmausbot.remote-voice.v1"];import{isAbsolute,join}from"node:path";var IMAGE_MAX_BYTES=10*1024*1024;var TURN_IMAGE_MAX_BYTES=4*IMAGE_MAX_BYTES;var DOCUMENT_MIMES={txt:"text/plain",md:"text/markdown",markdown:"text/markdown",csv:"text/csv",tsv:"text/tab-separated-values",json:"application/json",pdf:"application/pdf",rtf:"application/rtf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presenta\
|
|
223
223
|
tionml.presentation",odt:"application/vnd.oasis.opendocument.text",ods:"application/vnd.oasis.opendocument.spreadsheet",odp:"application/vnd.oasis.opendocument.presentation",xmind:"application/vnd.xmind.workbook"},ACCEPTED_DOCUMENT_MIMES=new Set(Object.values(DOCUMENT_MIMES)),AUDIO_MIMES_BY_EXTENSION={opus:"audio/opus",ogg:"audio/ogg",mp3:"audio/mpeg",m4a:"audio/mp4",aac:"audio/aac",wav:"audio/wav",flac:"audio/flac",webm:"audio/webm"},ACCEPTED_AUDIO_MIMES=new Set([...Object.values(AUDIO_MIMES_BY_EXTENSION),
|
|
@@ -1552,7 +1552,7 @@ object({apiKey:optionalText2,providerKeys:external_exports.record(external_expor
|
|
|
1552
1552
|
record(external_exports.string(),external_exports.json());function parseStoredConfig(value){let parsed=storedAppConfigSchema.safeParse(value);if(!parsed.success)throw new Error(schemaIssue(parsed.error,"Invalid stored configuration"));return parsed.data.localVm&&parsed.data.localVm.automaticCapacity===void 0&&(parsed.data.localVm.automaticCapacity=!0),parsed.data}var DEFAULT_CAPTURE_QUIET_MS=2*6e4;var DATA_DIR=process.env.OMB_DATA_DIR||join3(dataHome(),".limixbot"),LEGACY_DATA_DIR=join3(dataHome(),".opengrokbot"),EVENTS_DIR=join3(DATA_DIR,"events"),NATIVE_DIR=join3(DATA_DIR,"native");var storedConfig=settledFileCache(()=>join3(DATA_DIR,"config.json"),()=>parseStoredConfig(parseJson(readFileSync3(join3(DATA_DIR,"config.json"),"utf8"))));var SECRET_FOLDER=".limixbot-secrets";function inSecretFolder(path){return path.split(/[\\/]/).includes(SECRET_FOLDER)}var PORTABLE_CONFIG_KEYS=["profile","language","budgets","billing","rooms","threads","localVm","features","browserProfiles"];function portableWorkspaceConfig(value){if(!value||typeof value!="object"||Array.isArray(value))throw new Error("Invalid workspace configuration in backup.");let config2=parseStoredConfig(value);return Object.fromEntries(PORTABLE_CONFIG_KEYS.filter(key=>config2[key]!==void 0).map(key=>[key,config2[key]]))}function excludedWorkspaceAuthPath(path){return inSecretFolder(path)||/^command-allowlist\.json(?:$|\.\d+\.[0-9a-f-]+\.tmp$)/.test(path)||/^mcp-oauth\.json(?:$|\.\d+\.[0-9a-f-]+\.tmp$)/.test(path)||/^(?:logins\.json\.enc|logins-key|webhook-key)(?:$|\.\d+\.[0-9a-f-]+\.tmp$)/.test(path)||/^connected-apps-installation\.json(?:$|\.\d+\.[0-9a-f-]+\.tmp$)/.test(path)||/^team-policy\.json(?:$|\.\d+\.[0-9a-f-]+\.tmp$)/.test(path)||/^people-connections(?:\/|$)/.test(path)?!0:/^(?:(?:providers|caddy|chrome-profile|\.agent-browser)(?:\/|$)|workspace-credentials\.json$|external-runtimes\.json$|browser-engine-key$)/.
|
|
1553
1553
|
test(path)||/^(?:config\.json|webhooks\.json|workspace-credentials\.json|external-runtimes\.json|browser-engine-key|sessions\.json|tunnel-account\.json)\.\d+(?:\.[0-9a-f-]+)?\.tmp$/.test(path)||/^(?:vm-home|vm-homes\/[^/]+)\/\.browser-profiles(?:\/|$)/.test(path)}function redownloadedOrgLibraryPath(path){return/^org-library\/(?:catalog\.json(?:\.[0-9a-f-]{36}\.tmp)?$|blobs(?:\/|$))/.test(path)}function ephemeralWorkspaceTokenPath(path){return/^(?:hook-tokens(?:\/|$)|sessions\.json\.open$)/.test(
|
|
1554
1554
|
path)}function liveDataEnginePath(path){return/^bots\/[^/]+\/(?:data\.duckdb(?:\.wal)?$|data-tmp(?:\/|$))/.test(path)}function managedTaskSkillLink(source,path,roots){let match=/^task-workspaces\/([^/]+)\/[^/]+\/\.(?:claude|agents|grok)\/skills\/([^/]+)$/.exec(path);if(!match)return!1;let target;try{target=resolve(dirname(source),readlinkSync(source).replace(/^\\\\\?\\/,""))}catch{return!1}return roots.some(root=>{let rel=relative(join4(root,"workspaces",match[1],"skills"),target);return rel!==""&&
|
|
1555
|
-
!rel.startsWith("..")&&!isAbsolute2(rel)||relative(join4(root,"imported-skills",match[2]),target)===""})}import{existsSync as existsSync2,readdirSync as readdirSync2,readFileSync as readFileSync4}from"node:fs";import{join as join12}from"node:path";import{DatabaseSync as DatabaseSync2}from"node:sqlite";import{createHash}from"node:crypto";var CLOUD_OUTSIDE_KEY=`p_${
|
|
1555
|
+
!rel.startsWith("..")&&!isAbsolute2(rel)||relative(join4(root,"imported-skills",match[2]),target)===""})}import{existsSync as existsSync2,readdirSync as readdirSync2,readFileSync as readFileSync4}from"node:fs";import{join as join12}from"node:path";import{DatabaseSync as DatabaseSync2}from"node:sqlite";import{createHash as createHash2}from"node:crypto";var CLOUD_OUTSIDE_KEY=`p_${createHash2("sha256").update("cloud-outside").digest("base64url").slice(0,22)}`,CLOUD_NOBODY_KEY=`p_${createHash2("sha256").update("cloud-nobody").digest("base64url").slice(0,22)}`;import{join as join11}from"node:path";import{appendFileSync}from"node:fs";import{join as join5}from"node:path";import{closeSync as closeSync2,fstatSync as fstatSync2,openSync as openSync2,readSync,renameSync as renameSync3,rmSync,statSync as statSync2,writeSync}from"node:fs";var capProvider=()=>null;function currentThreadLogCap(){try{return capProvider()}catch{return null}}function capThreadLog(file2,maxBytes){if(typeof maxBytes!="number"||!Number.isFinite(maxBytes)||maxBytes<=0)return;let size;try{size=statSync2(file2).size}catch{return}size<=maxBytes||trimToTail(file2,Math.max(1,Math.floor(maxBytes/2)))}function trimToTail(file2,keepBytes){let staging=`${file2}.trim`;try{let source=openSync2(file2,"r");try{let size=fstatSync2(source).size,start=Math.max(0,size-keepBytes),window=Buffer.allocUnsafe(
|
|
1556
1556
|
size-start),filled=0;for(;filled<window.length;){let count2=readSync(source,window,filled,window.length-filled,start+filled);if(count2===0)return;filled+=count2}let firstNewline=window.indexOf(10);if(firstNewline===-1||firstNewline+1>=window.length)return;let target=openSync2(staging,"w",384);try{let written=firstNewline+1;for(;written<window.length;){let count2=writeSync(target,window,written,window.length-written);if(count2===0)throw new Error(`no progress writing ${staging}`);written+=count2}}finally{
|
|
1557
1557
|
closeSync2(target)}}finally{closeSync2(source)}renameSync3(staging,file2)}catch{try{rmSync(staging,{force:!0})}catch{}}}var MAX_HELD_CHARS=256*1024,held=new Map,heldChars=0,timer=null;function flushNativeLog(threadId){let lines=take(threadId);if(!lines)return;let file2=join5(NATIVE_DIR,`${threadId}.ndjson`);try{appendFileSync(file2,lines.join(""),{mode:384}),capThreadLog(file2,currentThreadLogCap())}catch{}}function flushNativeLogs(){timer&&clearTimeout(timer),timer=null;for(let threadId of Array.from(held.keys()))flushNativeLog(threadId)}function take(threadId){let lines=held.get(threadId);if(lines){held.delete(threadId);for(let line of lines)heldChars-=line.length;return lines}}process.once("exit",flushNativeLogs);import{join as join7}from"node:path";import{join as join6}from"node:path";var PUBLISHED_TEAMS_FILE=join6(DATA_DIR,"published-teams.json"),keyMap=external_exports.record(external_exports.string(),external_exports.string()),publishedTeamSchema=external_exports.object({packageId:external_exports.string().min(1),lastRelease:external_exports.string().min(1),keys:external_exports.object({bots:keyMap,rooms:keyMap,routines:keyMap}).default({bots:{},rooms:{},routines:{}})}),fileSchema=external_exports.object({version:external_exports.literal(1),teams:external_exports.record(external_exports.
|
|
1558
1558
|
string(),external_exports.unknown())});var SECTION_CONTEXTS_FILE=join7(DATA_DIR,"section-contexts.json"),sectionContextRecordSchema=external_exports.object({text:external_exports.string(),updatedAt:external_exports.number().finite()}),sectionContextFileSchema=external_exports.object({version:external_exports.literal(1),sections:external_exports.array(external_exports.string()).optional(),memoryKeys:external_exports.record(external_exports.string(),external_exports.string().min(1)).optional(),contexts:external_exports.record(external_exports.
|
|
@@ -1632,9 +1632,9 @@ trim(),expanded=text.startsWith("~/")||text.startsWith("~\\")?join13(home2,text.
|
|
|
1632
1632
|
e files. Move that login storage into the excluded providers folder or outside this workspace before backing up or restoring.`)},environments=[process.env,...Object.values(instances).filter(record3).map(instance=>({...process.env,...record3(instance.environment)?instance.environment:{}}))];for(let environment of environments){let home2=String(environment.HOME||environment.USERPROFILE||homedir2());for(let field of fields)check2(environment[field],field,home2)}for(let instance of Object.values(instances)){
|
|
1633
1633
|
if(!record3(instance)||instance.driver!=="claudeAgent"||!record3(instance.config))continue;let environment={...process.env,...record3(instance.environment)?instance.environment:{}};check2(instance.config.configDir,"config.configDir",String(environment.HOME||environment.USERPROFILE||homedir2()))}}function passwordKey(password,salt){if(typeof password!="string"||password.length<12||Buffer.byteLength(password)>1024)throw new Error("Use a backup password of at least 12 characters (at most 1024 bytes\
|
|
1634
1634
|
).");return new Promise((resolveKey,reject)=>{scrypt(password,salt,32,{N:131072,r:8,p:1,maxmem:256*1024**2},(error62,key)=>{error62?reject(error62):resolveKey(key)})})}function copyRegular(source,destination){let input2=openSync3(source,constants2.O_RDONLY|constants2.O_NOFOLLOW),output2;try{let before=fstatSync3(input2);if(!before.isFile()||before.size>MAX_WORKSPACE_BACKUP_BYTES)throw new Error("A workspace file is not regular or exceeds the 10 GB backup limit.");let mode=before.mode&64?448:384;
|
|
1635
|
-
output2=openSync3(destination,"wx",mode);let chunk=Buffer.allocUnsafe(1024*1024),hash2=
|
|
1635
|
+
output2=openSync3(destination,"wx",mode);let chunk=Buffer.allocUnsafe(1024*1024),hash2=createHash3("sha256"),size=0;for(;;){let count2=readSync2(input2,chunk,0,chunk.length,null);if(!count2)break;if(size+=count2,size>before.size)throw new Error("A workspace file changed during backup. Stop its writer and retry.");hash2.update(chunk.subarray(0,count2));let offset=0;for(;offset<count2;)offset+=writeSync2(output2,chunk,offset,count2-offset)}let after=fstatSync3(input2),current=lstatSync2(source);if(size!==
|
|
1636
1636
|
before.size||after.mtimeMs!==before.mtimeMs||after.ctimeMs!==before.ctimeMs||current.ino!==before.ino||current.dev!==before.dev||current.isSymbolicLink())throw new Error("A workspace file changed during backup. Stop its writer and retry.");return fsyncSync2(output2),{size,mode,sha256:hash2.digest("hex")}}finally{closeSync3(input2),output2!==void 0&&closeSync3(output2)}}function hashFile(path){let fd=openSync3(path,constants2.O_RDONLY|constants2.O_NOFOLLOW);try{if(!fstatSync3(fd).isFile())throw new Error(
|
|
1637
|
-
"The workspace archive contains an unsafe file.");let hash2=
|
|
1637
|
+
"The workspace archive contains an unsafe file.");let hash2=createHash3("sha256"),chunk=Buffer.allocUnsafe(1024*1024);for(;;){let count2=readSync2(fd,chunk,0,chunk.length,null);if(!count2)return hash2.digest("hex");hash2.update(chunk.subarray(0,count2))}}finally{closeSync3(fd)}}function countJsonArray(path){if(!existsSync3(path))return 0;let value=privateJson(path);if(!Array.isArray(value))throw new Error("A workspace roster is not a valid JSON array.");let ids=new Set;for(let item of value){if(!record3(
|
|
1638
1638
|
item)||typeof item.id!="string"||!/^[A-Za-z0-9_-]{1,128}$/.test(item.id)||ids.has(item.id))throw new Error("A workspace roster contains an invalid or duplicate identifier.");if(ids.add(item.id),item.threadId!==void 0&&(typeof item.threadId!="string"||!/^[A-Za-z0-9_-]{1,128}$/.test(item.threadId)))throw new Error("A workspace roster contains an invalid thread identifier.");if(item.tasks!==void 0&&(!Array.isArray(item.tasks)||!item.tasks.every(task=>record3(task)&&typeof task.threadId=="string"&&/^[A-Za-z0-9_-]{1,128}$/.
|
|
1639
1639
|
test(task.threadId))))throw new Error("A workspace roster contains invalid task records.")}return value.length}function databaseCounts(path){if(!existsSync3(path))return{threads:0,messages:0};let db=new DatabaseSync3(path,{readOnly:!0});try{let check2=db.prepare("PRAGMA quick_check").all();if(check2.length!==1||Object.values(check2[0])[0]!=="ok")throw new Error("The message database failed its integrity check.");if(db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN ('messa\
|
|
1640
1640
|
ges', 'thread_state')").all().length!==2)throw new Error("The backup does not contain a supported message database.");let counts=db.prepare("SELECT COUNT(*) AS messages, COUNT(DISTINCT thread_id) AS threads FROM messages").get();return{threads:Number(counts.threads),messages:Number(counts.messages)}}finally{db.close()}}async function createWorkspaceBackupSnapshot(dataDir2,options2,jobId2){if(Object.hasOwn(options2,"credentials"))throw new Error("Workspace backups do not transfer credentials.");assertLocalAuthOutsideSnapshot(dataDir2);let salt=randomBytes(16),key=await passwordKey(options2.password,salt),job=newJob(dataDir2,jobId2),snapshot=join13(job.directory,"snapshot");folder(join13(snapshot,"data"));let entries=[],foldedPaths=new Map,warnings=["Stop external editors and managed desktops before exporting; f\
|
|
@@ -1651,12 +1651,13 @@ folder2=>folder2===target||folder2.startsWith(`${target}${sep}`)))throw userErro
|
|
|
1651
1651
|
record3(entry)&&record3(entry.webhook)&&delete entry.webhook.sealedSecret;writeJson(destination,value)}copied={size:lstatSync2(destination).size,mode:384,sha256:hashFile(destination)}}else copied=copyRegular(SNAPSHOT_DATABASES[path2]?join13(snapshot,SNAPSHOT_DATABASES[path2]):source,destination);if(bytes+=copied.size,bytes>MAX_WORKSPACE_BACKUP_BYTES)throw new Error("The workspace exceeds the 10 GB backup limit.");entries.push({path:path2,type:"file",...copied})}else throw new Error(`Cannot back \
|
|
1652
1652
|
up special or live runtime file: ${path2}`)}};walk(root),skippedLinks&&warnings.push(`${skippedLinks} managed skill discovery link(s) were omitted and are recreated by the app.`),skippedDependencies&&warnings.push(`${skippedDependencies} installed dependency folder(s) (node_modules) were omitted; reinstall them in the project after restoring.`),copiedLinks&&warnings.push(`${copiedLinks} symbolic link(s) inside a workspace were saved as copies of what they point to; restoring creates regular file\
|
|
1653
1653
|
s and folders there.`),skippedWorkLinks&&warnings.push(`${skippedWorkLinks} symbolic link(s) in conversation work folders were omitted; what they point to is outside this backup.`);let summary={format:"openmaus.workspace-backup",version:1,id:job.id,createdAt:new Date().toISOString(),appVersion:options2.appVersion??"unknown",files:entries.filter(entry=>entry.type==="file").length,directories:entries.filter(entry=>entry.type==="directory").length,bytes,bots:countJsonArray(join13(snapshot,"data","b\
|
|
1654
|
-
ots.json")),groups:countJsonArray(join13(snapshot,"data","groups.json")),...databaseCounts(join13(snapshot,"data","messages.db")),exclusions:options2.omitMedia?[...EXCLUSION_NOTES,"Media files and attachment/upload folders are omitted from this offline transfer."]:EXCLUSION_NOTES,warnings},manifest={summary,sourceDataDir:resolve2(dataDir2),clientState:options2.clientState??{},entries};writeJson(join13(snapshot,"
|
|
1655
|
-
let path=join13(job.directory,"workspace.ombbackup"),iv=randomBytes(12),header=Buffer.concat([MAGIC,salt,iv]),cipher=createCipheriv("aes-256-gcm",key,iv);cipher.setAAD(header),writeFileSync2(path,header,{mode:384,flag:"wx"});let tar=await Promise.resolve().then(()=>(init_index_min(),index_min_exports));await pipeline(tar.c({cwd:snapshot,portable:!0,strict:!0},["manifest.json","data"]),cipher,createWriteStream(
|
|
1656
|
-
fsyncSync2(fd)}finally{closeSync3(fd)}return rmSync2(snapshot,{recursive:!0,force:!0}),{id:job.id,path,summary}}catch(error62){throw rmSync2(job.directory,{recursive:!0,force:!0}),error62}finally{key.fill(0)}}function validateManifest(value){if(!record3(value)||!record3(value.summary)||value.summary.format!=="openmaus.workspace-backup"||value.summary.version!==1||typeof value.summary.id!="string"||!ID.test(
|
|
1657
|
-
summary.createdAt))||typeof value.summary.appVersion!="string"||typeof value.sourceDataDir!="string"||!(posix.isAbsolute(value.sourceDataDir)||win32.isAbsolute(value.sourceDataDir))||value.sourceDataDir.length>4096||value.sourceDataDir.includes("\0")||value.sourceDataDir===posix.parse(value.sourceDataDir).root||value.sourceDataDir===win32.parse(value.sourceDataDir).root||value.sourceDataDir.replaceAll(
|
|
1658
|
-
|
|
1659
|
-
.");if(Object.keys(value.clientState).some(key=>!WORKSPACE_BACKUP_CLIENT_KEYS.includes(key))||Buffer.byteLength(JSON.stringify(value.clientState))>2*1024**2)throw new Error("Invalid or oversized workspace client preferences.");for(let key of["files","directories","bytes","bots","groups","threads","messages"])if(!Number.isSafeInteger(value.summary[key])||value.summary[key]<0)throw new Error("Invalid
|
|
1660
|
-
!value.summary[key].every(item=>typeof item=="string"))throw new Error("Invalid workspace backup summary.");let names=new Map,bytes=0,files=0;for(let raw of value.entries){if(!record3(raw)||typeof raw.path!="string"||!validRelative(raw.path)||
|
|
1661
|
-
toLowerCase()))throw new Error("Unsafe or duplicate workspace backup entry.");if(names.set(raw.path.toLowerCase(),String(raw.type)),raw.type==="file"){if(typeof raw.sha256!="string"||!/^[0-9a-f]{64}$/.test(raw.sha256))throw new Error("A
|
|
1662
|
-
directories)throw new Error("Workspace backup contents do not match their summary or exceed the limit.");for(let path of names.keys()){let parts=path.split("/");for(let i=1;i<parts.length;i++)if(names.get(parts.slice(0,i).join("/"))!==
|
|
1654
|
+
ots.json")),groups:countJsonArray(join13(snapshot,"data","groups.json")),...databaseCounts(join13(snapshot,"data","messages.db")),exclusions:options2.omitMedia?[...EXCLUSION_NOTES,"Media files and attachment/upload folders are omitted from this offline transfer."]:EXCLUSION_NOTES,warnings},manifest={...options2.accountId!==void 0?{account:transferAccountHash(options2.accountId)}:{},summary,sourceDataDir:resolve2(dataDir2),clientState:options2.clientState??{},entries};writeJson(join13(snapshot,"m\
|
|
1655
|
+
anifest.json"),manifest),validateManifest(privateJson(join13(snapshot,"manifest.json")));let path=join13(job.directory,"workspace.ombbackup"),iv=randomBytes(12),header=Buffer.concat([MAGIC,salt,iv]),cipher=createCipheriv("aes-256-gcm",key,iv);cipher.setAAD(header),writeFileSync2(path,header,{mode:384,flag:"wx"});let tar=await Promise.resolve().then(()=>(init_index_min(),index_min_exports));await pipeline(tar.c({cwd:snapshot,portable:!0,strict:!0},["manifest.json","data"]),cipher,createWriteStream(
|
|
1656
|
+
path,{flags:"a",mode:384}));let fd=openSync3(path,"a");try{writeSync2(fd,cipher.getAuthTag()),fsyncSync2(fd)}finally{closeSync3(fd)}return rmSync2(snapshot,{recursive:!0,force:!0}),{id:job.id,path,summary}}catch(error62){throw rmSync2(job.directory,{recursive:!0,force:!0}),error62}finally{key.fill(0)}}function validateManifest(value){if(!record3(value)||!record3(value.summary)||value.summary.format!=="openmaus.workspace-backup"||value.summary.version!==1||typeof value.summary.id!="string"||!ID.test(
|
|
1657
|
+
value.summary.id)||typeof value.summary.createdAt!="string"||!Number.isFinite(Date.parse(value.summary.createdAt))||typeof value.summary.appVersion!="string"||typeof value.sourceDataDir!="string"||!(posix.isAbsolute(value.sourceDataDir)||win32.isAbsolute(value.sourceDataDir))||value.sourceDataDir.length>4096||value.sourceDataDir.includes("\0")||value.sourceDataDir===posix.parse(value.sourceDataDir).root||value.sourceDataDir===win32.parse(value.sourceDataDir).root||value.sourceDataDir.replaceAll(
|
|
1658
|
+
"\\","/").split("/").some(part=>part==="."||part==="..")||Object.keys(value).some(key=>!["summary","sourceDataDir","clientState","entries","account"].includes(key))||Object.keys(value.summary).some(key=>!["format","version","id","createdAt","appVersion","files","directories","bytes","bots","groups","threads","messages","exclusions","warnings"].includes(key))||!record3(value.clientState)||!Object.values(value.clientState).every(item=>typeof item=="string")||!Array.isArray(value.entries)||value.entries.
|
|
1659
|
+
length>MAX_WORKSPACE_BACKUP_FILES)throw new Error("Invalid or unsupported workspace backup metadata.");if(Object.keys(value.clientState).some(key=>!WORKSPACE_BACKUP_CLIENT_KEYS.includes(key))||Buffer.byteLength(JSON.stringify(value.clientState))>2*1024**2)throw new Error("Invalid or oversized workspace client preferences.");for(let key of["files","directories","bytes","bots","groups","threads","messages"])if(!Number.isSafeInteger(value.summary[key])||value.summary[key]<0)throw new Error("Invalid\
|
|
1660
|
+
workspace backup summary.");for(let key of["exclusions","warnings"])if(!Array.isArray(value.summary[key])||!value.summary[key].every(item=>typeof item=="string"))throw new Error("Invalid workspace backup summary.");if(value.account!==void 0&&(typeof value.account!="string"||!/^[0-9a-f]{64}$/.test(value.account)))throw new Error("Invalid backup account binding.");let names=new Map,bytes=0,files=0;for(let raw of value.entries){if(!record3(raw)||typeof raw.path!="string"||!validRelative(raw.path)||
|
|
1661
|
+
forbiddenArchivePath(raw.path)||Object.keys(raw).some(key=>!["path","type","size","mode","sha256"].includes(key))||!["file","directory"].includes(String(raw.type))||!Number.isSafeInteger(raw.size)||raw.size<0||![384,448].includes(raw.mode)||names.has(raw.path.toLowerCase()))throw new Error("Unsafe or duplicate workspace backup entry.");if(names.set(raw.path.toLowerCase(),String(raw.type)),raw.type==="file"){if(typeof raw.sha256!="string"||!/^[0-9a-f]{64}$/.test(raw.sha256))throw new Error("A bac\
|
|
1662
|
+
kup file has no valid checksum.");bytes+=raw.size,files++}else if(raw.size!==0)throw new Error("A backup directory has an invalid size.")}if(bytes>MAX_WORKSPACE_BACKUP_BYTES||bytes!==value.summary.bytes||files!==value.summary.files||names.size-files!==value.summary.directories)throw new Error("Workspace backup contents do not match their summary or exceed the limit.");for(let path of names.keys()){let parts=path.split("/");for(let i=1;i<parts.length;i++)if(names.get(parts.slice(0,i).join("/"))!==
|
|
1663
|
+
"directory")throw new Error("A backup entry has an unsafe parent.")}return value}var{dataDir,options,jobId}=workerData;try{parentPort.postMessage({result:await createWorkspaceBackupSnapshot(dataDir,options,jobId)})}catch(error62){parentPort.postMessage({error:error62 instanceof Error?error62.message:"The workspace backup could not finish.",...userErrorFields(error62)})}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{U as a,C as n}from"./mermaid.core-DuHmv3Xq.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{c as r,s as e}from"./flowDiagram-OXPTDLAJ-CCgbFCEu.js";import{_ as o}from"./mermaid.core-DuHmv3Xq.js";import"./chunk-5VM5RSS4-CVMG7tfk.js";import"./chunk-XXDRQBXY-BwfcVKlj.js";import"./chunk-KQW6MTUR-ws1ilD7-.js";import"./chunk-7TKQ45FW-DIyFSChV.js";import"./channel-CJO5KL4z.js";import"./styles-Dd_7YOJG.js";import"./step-CkmJJ7wq.js";var a=o(t=>`${e(t)}
|
|
2
|
-
.swimlane.cluster:not([data-color-id]) rect {
|
|
3
|
-
stroke: ${t.clusterBorder} !important;
|
|
4
|
-
}
|
|
5
|
-
[data-look="neo"].cluster rect {
|
|
6
|
-
filter: none;
|
|
7
|
-
}
|
|
8
|
-
`,"getStyles"),m=a,y=r({styles:m});export{y as diagram};
|