limixbot 0.3.105 → 0.3.107
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/cli.js +1 -1
- package/dist/assets/{ActivityPanel-Cbm_MV4_.js → ActivityPanel-Dwy_8Ssw.js} +1 -1
- package/dist/assets/{App-CdDhOj9Z.js → App-DER9VjCj.js} +11 -11
- package/dist/assets/{AppEventEditor-Cbwuipry.js → AppEventEditor-DVPTS46l.js} +1 -1
- package/dist/assets/{BotSettingsDialog-C8LF47q9.js → BotSettingsDialog-CBMhMWpP.js} +1 -1
- package/dist/assets/{BrowserPanel-Xb2e7PXu.js → BrowserPanel-cuhGe02X.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-BNS5E_18.js → BrowserProfilesManager-DCwRz57j.js} +1 -1
- package/dist/assets/{CloudAddDialog-f84YQfvX.js → CloudAddDialog-jmGkr7Un.js} +1 -1
- package/dist/assets/{ComputerFilesPane-BsZ9OtSJ.js → ComputerFilesPane-8K2V3RhW.js} +1 -1
- package/dist/assets/{ComputerPanel-a3_n-Lx2.js → ComputerPanel-pAbCBPNK.js} +2 -2
- package/dist/assets/{DataPanel-C3buf1SP.js → DataPanel-Cqk9kG4Y.js} +1 -1
- package/dist/assets/{GrokMoveDialog-B43cbS0W.js → GrokMoveDialog-CpK4k-BS.js} +1 -1
- package/dist/assets/{InspectorPanel-Cs9FS_iX.js → InspectorPanel-Cy2voxQ9.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-C1Yic9QC.js → KeyboardShortcutsModal-CLLeb5RM.js} +1 -1
- package/dist/assets/{LimixResizeHandles-DKF6WDfT.js → LimixResizeHandles-DN3T-Sxj.js} +1 -1
- package/dist/assets/{LiveDesktop-xm24_62C.js → LiveDesktop-D1zL4cXe.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-B91eNABI.js → LocalVmWorkspace-OPstoi6j.js} +1 -1
- package/dist/assets/{MacLocalControl-CurQWXB4.js → MacLocalControl-BAU_Mxfl.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-8kMe2rTR.js → MarkdownFilePreview-DiDEa2VP.js} +1 -1
- package/dist/assets/{NewBotDialog-dJmhmATK.js → NewBotDialog-_fhvtWem.js} +1 -1
- package/dist/assets/{PhoneAppDialog-CGplah7d.js → PhoneAppDialog-TisX6Kkd.js} +1 -1
- package/dist/assets/{PluginsPanel-Boc4Pd3r.js → PluginsPanel-mfBuYBSI.js} +1 -1
- package/dist/assets/{ProIntroduction-J0r_kMie.js → ProIntroduction-DS75WAZy.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-lJv8UpKf.js → RemoteAgentSettingsPanel-B148emwo.js} +1 -1
- package/dist/assets/{RoomPanel-C0PK6RRW.js → RoomPanel-B_RUQv3X.js} +1 -1
- package/dist/assets/{RoutinesPage-DMdxfslh.js → RoutinesPage-Bt3nAr6K.js} +1 -1
- package/dist/assets/{SettingsModal-DtTIkNSu.js → SettingsModal-BjEnjf-l.js} +1 -1
- package/dist/assets/{ShareTeamDialog-BVjQQgRH.js → ShareTeamDialog-CFdVjk7Z.js} +1 -1
- package/dist/assets/{SignedInSites--OK-tl6k.js → SignedInSites-ChIudtJC.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-bC-6F_Y3.js → TeamLibraryPanel-C5ba9U3p.js} +1 -1
- package/dist/assets/{TeamMapPage-4zEXJFbR.js → TeamMapPage-CMv2EOnM.js} +1 -1
- package/dist/assets/{TriggersPage-BT6g9Qzg.js → TriggersPage-DAFkA0uT.js} +1 -1
- package/dist/assets/{VisibilitySection-CxIPRF7z.js → VisibilitySection-CLxd2eiH.js} +1 -1
- package/dist/assets/{WebhookTrigger-DkFSYsbI.js → WebhookTrigger-C6ySSY-L.js} +1 -1
- package/dist/assets/{WorksOnGrid-Cl8JsM01.js → WorksOnGrid-DDm8ZPUS.js} +1 -1
- package/dist/assets/{core-6oEBX5E0.js → core-Ce8mfU6p.js} +1 -1
- package/dist/assets/{import-name-lXRpvJU5.js → import-name-CzRqCqhy.js} +1 -1
- package/dist/assets/{index-DJS0AZbc.js → index-DQSfzGc3.js} +1 -1
- package/dist/assets/{index-Dv79GO2D.js → index-DsdqtVg4.js} +2 -2
- package/dist/assets/{mcp-servers-CQx7iElK.js → mcp-servers-DQMAYnlB.js} +1 -1
- package/dist/assets/{new-bot-DDzAckAK.js → new-bot-C23M4Uux.js} +1 -1
- package/dist/assets/{org-library-DpkG9WUs.js → org-library-Dq1l049t.js} +1 -1
- package/dist/assets/{package-format-CQ9ehT0X.js → package-format-C7ReB3QW.js} +1 -1
- package/dist/assets/{remote-desktop-panel-C-3gtWIh.js → remote-desktop-panel-Bn0lktN4.js} +1 -1
- package/dist/index.html +1 -1
- package/dist-server/cloud-home-start.js +3 -3
- package/dist-server/index.js +137 -132
- package/dist-server/{openmausbot.js → limixbot.js} +195 -196
- package/dist-server/package.json +1 -1
- package/dist-server/pair-cli.js +195 -196
- package/dist-server/server/bot-api-host.js +11 -8
- package/dist-server/server/bot-channels/engine.js +17 -2
- package/dist-server/server/browser-relay.js +1 -1
- package/dist-server/server/caddy.js +1 -1
- package/dist-server/server/cli-invocation.js +5 -5
- package/dist-server/server/cli-usage.js +25 -25
- package/dist-server/server/cli.js +3 -3
- package/dist-server/server/container-computer.js +1 -1
- package/dist-server/server/drivers/antigravity-acp.js +1 -1
- package/dist-server/server/enterprise.js +2 -2
- package/dist-server/server/fleet-agent.js +2 -2
- package/dist-server/server/fleet-cli.js +4 -4
- package/dist-server/server/fleet.js +23 -17
- package/dist-server/server/headless/main.js +27 -27
- package/dist-server/server/index.js +10 -4
- package/dist-server/server/move-freeze.js +2 -2
- package/dist-server/server/package-export.js +3 -3
- package/dist-server/server/sentinel/paths.js +1 -1
- package/dist-server/server/service-cli.js +6 -6
- package/dist-server/server/service-unit.js +5 -5
- package/dist-server/server/tts/system-voices.js +1 -1
- package/dist-server/server/update-check.js +4 -4
- package/dist-server/server/workspace-backup.js +2 -2
- package/dist-server/server-launcher.js +3 -2
- package/dist-server/workspace-backup.worker.js +5 -5
- package/package.json +1 -1
- /package/dist-server/server/{openmausbot.js → limixbot.js} +0 -0
|
@@ -29,8 +29,8 @@ const READS = new Set(["GET", "HEAD", "OPTIONS"]);
|
|
|
29
29
|
/** What a frozen copy keeps once its workspace is deleted: the marker, this server's identity, Files, downloaded tools
|
|
30
30
|
* and caches, and its own runtime files. Everything else, credentials included, is the person's workspace. */
|
|
31
31
|
const DEVICE_STATE = new Set(["moved.json", "environment-id", "sync", "tools", "cache", ".cache", "tmp", ".tmp", "dist-native", "tunnel-runtime",
|
|
32
|
-
".limixbot-server-child", "openmausbot-server.lease"]);
|
|
33
|
-
const kept = (name) => DEVICE_STATE.has(name) ||
|
|
32
|
+
".limixbot-server-child", ".openmausbot-server-child", "openmausbot-server.lease", "limixbot-server.lease"]);
|
|
33
|
+
const kept = (name) => DEVICE_STATE.has(name) || /^(?:limixbot|openmausbot)-server\.lease\./.test(name);
|
|
34
34
|
/** Switches off every automation that is on, or only those named by key ("routine:<id>", "call:<id>", "webhook:<id>",
|
|
35
35
|
* "app-event:<id>", "wait:<id>"); the person can switch each on again by hand, and a wait is cancelled. Done while frozen,
|
|
36
36
|
* so none of them runs once the freeze lifts. One that can't be switched off is logged, never a reason to stay frozen.
|
|
@@ -161,7 +161,7 @@ export function createBotPackageExport(input) {
|
|
|
161
161
|
enabledAfterInstall: false,
|
|
162
162
|
}];
|
|
163
163
|
});
|
|
164
|
-
const id = portableKey(input.name, "
|
|
164
|
+
const id = portableKey(input.name, "limix-package", new Set());
|
|
165
165
|
const agents = bots.map((bot) => {
|
|
166
166
|
const appearance = { color: bot.color };
|
|
167
167
|
if (bot.mascotExpression)
|
|
@@ -634,7 +634,7 @@ export function createTeamPackageExport(input) {
|
|
|
634
634
|
const exportedRoutines = new Set(routines.map((routine) => routine.key));
|
|
635
635
|
return {
|
|
636
636
|
document,
|
|
637
|
-
filename: `${document.package.id}-${document.package.release}.
|
|
637
|
+
filename: `${document.package.id}-${document.package.release}.limix.json`,
|
|
638
638
|
redacted: [...new Set([...addressRedactions, ...redacted])],
|
|
639
639
|
skipped,
|
|
640
640
|
published: {
|
|
@@ -720,7 +720,7 @@ export function createLibraryPackageExport(input) {
|
|
|
720
720
|
}
|
|
721
721
|
return {
|
|
722
722
|
document,
|
|
723
|
-
filename: `${document.package.id}-${document.package.release}.
|
|
723
|
+
filename: `${document.package.id}-${document.package.release}.limix.json`,
|
|
724
724
|
redacted,
|
|
725
725
|
skipped,
|
|
726
726
|
published: { packageId, lastRelease: release },
|
|
@@ -3,7 +3,7 @@ import { createHash } from "node:crypto";
|
|
|
3
3
|
import { existsSync, realpathSync } from "node:fs";
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
5
|
import { basename, dirname, join, posix, resolve, win32 } from "node:path";
|
|
6
|
-
const FOLDER = "
|
|
6
|
+
const FOLDER = "limixbot-sentinel";
|
|
7
7
|
export function defaultSentinelOut(dataDir, platform = process.platform, home = homedir(), env = process.env) {
|
|
8
8
|
const path = platform === "win32" ? win32 : posix;
|
|
9
9
|
const state = env.XDG_STATE_HOME && path.isAbsolute(env.XDG_STATE_HOME) ? env.XDG_STATE_HOME : path.join(home, ".local", "state");
|
|
@@ -57,7 +57,7 @@ export function runServiceCommand(input, io) {
|
|
|
57
57
|
home,
|
|
58
58
|
bindsLowPorts: Boolean(input.domain),
|
|
59
59
|
...(input.label ? { label: input.label } : {}),
|
|
60
|
-
...(script !== input.script ? { cliPrefix: "npx
|
|
60
|
+
...(script !== input.script ? { cliPrefix: "npx limixbot" } : {}),
|
|
61
61
|
};
|
|
62
62
|
const rendered = platform === "darwin" ? launchdPlist(spec) : systemdUnit(spec);
|
|
63
63
|
mkdirSync(input.dataDir, { recursive: true, mode: 0o700 });
|
|
@@ -84,10 +84,10 @@ function pinnedCopy(input, io) {
|
|
|
84
84
|
version = undefined;
|
|
85
85
|
}
|
|
86
86
|
const prefix = join(input.dataDir, "app", version ?? "latest");
|
|
87
|
-
const command = `npm install --prefix ${prefix}
|
|
88
|
-
io.log(`this run comes from npx's cache, which npm prunes: installing
|
|
87
|
+
const command = `npm install --prefix ${prefix} limixbot@${version ?? "latest"}`;
|
|
88
|
+
io.log(`this run comes from npx's cache, which npm prunes: installing limixbot ${version ?? ""} into ${prefix} for the service`.replace(" ", " "));
|
|
89
89
|
const installed = (input.installCopy ?? installWithNpm)(prefix, version ?? "latest");
|
|
90
|
-
const script = join(prefix, "node_modules", "
|
|
90
|
+
const script = join(prefix, "node_modules", "limixbot", "dist-server", "limixbot.js");
|
|
91
91
|
if (installed && (input.exists ?? existsSync)(script))
|
|
92
92
|
return script;
|
|
93
93
|
io.error(`could not install that copy. Run this, then the same service install command again from it:\n ${command}\n node ${script} service install …`);
|
|
@@ -96,7 +96,7 @@ function pinnedCopy(input, io) {
|
|
|
96
96
|
function installWithNpm(prefix, version) {
|
|
97
97
|
mkdirSync(prefix, { recursive: true, mode: 0o700 });
|
|
98
98
|
const npm = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
99
|
-
return spawnSync(npm, ["install", "--prefix", prefix, `
|
|
99
|
+
return spawnSync(npm, ["install", "--prefix", prefix, `limixbot@${version}`, "--no-audit", "--no-fund"], { stdio: "inherit" }).status === 0;
|
|
100
100
|
}
|
|
101
101
|
function bundleHasSentinel(script) {
|
|
102
102
|
try {
|
|
@@ -163,6 +163,6 @@ function runSentinelService(input, platform, home, io) {
|
|
|
163
163
|
io.log("");
|
|
164
164
|
io.log(`issues: ${join(out, "issues.jsonl")}`);
|
|
165
165
|
io.log(`logs: ${platform === "darwin" ? join(out, "sentinel.log") : "journalctl --user -u openmausbot-sentinel"}`);
|
|
166
|
-
io.log("after an app update or a Node upgrade, check the schedule still points at both:
|
|
166
|
+
io.log("after an app update or a Node upgrade, check the schedule still points at both: limixbot sentinel --check-install");
|
|
167
167
|
return 0;
|
|
168
168
|
}
|
|
@@ -16,7 +16,7 @@ export function serviceCommand(spec) {
|
|
|
16
16
|
}
|
|
17
17
|
export function systemdUnit(spec) {
|
|
18
18
|
const lines = [
|
|
19
|
-
"# Written by `
|
|
19
|
+
"# Written by `limixbot service install`. Re-run it to change the options.",
|
|
20
20
|
"[Unit]",
|
|
21
21
|
`Description=Limix Bot${spec.label ? ` (${spec.label})` : ""}`,
|
|
22
22
|
"After=network-online.target",
|
|
@@ -88,7 +88,7 @@ export function launchdPlist(spec) {
|
|
|
88
88
|
export function unstableInstallWarning(script) {
|
|
89
89
|
const normalized = script.replace(/\\/g, "/");
|
|
90
90
|
if (/\/_npx\//.test(normalized) || /\/\.npm\/_npx\//.test(normalized)) {
|
|
91
|
-
return `this command runs from an npx cache (${dirname(script)}), which npm may delete at any time. Install it permanently first (npm install -g
|
|
91
|
+
return `this command runs from an npx cache (${dirname(script)}), which npm may delete at any time. Install it permanently first (npm install -g limixbot) and run \`limixbot service install\` from that install.`;
|
|
92
92
|
}
|
|
93
93
|
return null;
|
|
94
94
|
}
|
|
@@ -119,10 +119,10 @@ export const SENTINEL_INTERVAL_SECONDS = 120;
|
|
|
119
119
|
/** The app's executable run as Node (ELECTRON_RUN_AS_NODE) survives app updates and Node upgrades; null for an app predating Sentinel. */
|
|
120
120
|
export function shippedSentinelCli(platform, home, exists, hasSentinel = () => true) {
|
|
121
121
|
const candidates = platform === "darwin"
|
|
122
|
-
? ["/Applications/
|
|
123
|
-
node: join(app, "Contents", "MacOS", "Limix Bot"), script: join(app, "Contents", "Resources", "server", "
|
|
122
|
+
? ["/Applications/Limix Bot.app", join(home, "Applications", "Limix Bot.app")].map((app) => ({
|
|
123
|
+
node: join(app, "Contents", "MacOS", "Limix Bot"), script: join(app, "Contents", "Resources", "server", "limixbot.js"),
|
|
124
124
|
}))
|
|
125
|
-
: platform === "linux" ? [{ node: "/opt/OpenMausBot/openmausbot", script: "/opt/OpenMausBot/resources/server/
|
|
125
|
+
: platform === "linux" ? [{ node: "/opt/OpenMausBot/openmausbot", script: "/opt/OpenMausBot/resources/server/limixbot.js" }] : [];
|
|
126
126
|
return candidates.find((cli) => exists(cli.node) && exists(cli.script) && hasSentinel(cli.script)) ?? null;
|
|
127
127
|
}
|
|
128
128
|
export function sentinelCommand(spec) {
|
|
@@ -38,7 +38,7 @@ export async function synthesizeSystem(text, voiceId, run = defaultRun) {
|
|
|
38
38
|
const trimmed = text.trim();
|
|
39
39
|
if (!trimmed)
|
|
40
40
|
return { bytes: new Uint8Array(), mime: "audio/wav" };
|
|
41
|
-
const dir = await mkdtemp(join(tmpdir(), "
|
|
41
|
+
const dir = await mkdtemp(join(tmpdir(), "limixbot-say-"));
|
|
42
42
|
const out = join(dir, "utterance.wav");
|
|
43
43
|
try {
|
|
44
44
|
const args = ["-o", out, "--data-format=LEI16@22050"];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// A self-hosted server cannot replace itself, so this only says whether a newer version exists and how this install is updated.
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { join, sep } from "node:path";
|
|
4
|
-
export const LATEST_RELEASE_URL = "https://api.github.com/repos/
|
|
4
|
+
export const LATEST_RELEASE_URL = "https://api.github.com/repos/leomieo/limix-bot/releases/latest";
|
|
5
5
|
/** Written by .github/workflows/promote-stable.yml: the released version our own Clouds have run for 48 hours. */
|
|
6
|
-
export const STABLE_CHANNEL_URL = "https://raw.githubusercontent.com/
|
|
6
|
+
export const STABLE_CHANNEL_URL = "https://raw.githubusercontent.com/leomieo/limix-bot/channels/stable.json";
|
|
7
7
|
const CACHE_MS = 60 * 60_000;
|
|
8
8
|
/** How long the last answer stands in when the channel cannot be read: an outage of GitHub is no reason to say nothing. */
|
|
9
9
|
const STALE_MS = 24 * 60 * 60_000;
|
|
@@ -19,7 +19,7 @@ export function updateCommand(install, target) {
|
|
|
19
19
|
switch (install) {
|
|
20
20
|
case "docker": return { command: target && !target.stable ? `git pull && ./update.sh --version ${target.version}` : "git pull && ./update.sh", restart: false };
|
|
21
21
|
case "podman": return { command: "git pull && cd deploy/podman && PODMAN_COMPOSE_PROVIDER=podman-compose podman compose --env-file .env -f compose.yaml up -d --build", restart: false };
|
|
22
|
-
case "npm": return { command: `npm install -g
|
|
22
|
+
case "npm": return { command: `npm install -g limixbot@${target?.version ?? "latest"}`, restart: true };
|
|
23
23
|
case "git": return { command: "git pull && pnpm install", restart: true };
|
|
24
24
|
default: return undefined;
|
|
25
25
|
}
|
|
@@ -89,7 +89,7 @@ export function createUpdateChecker(options) {
|
|
|
89
89
|
...updateCommand(options.install),
|
|
90
90
|
});
|
|
91
91
|
const ask = (url) => fetchJson(url, {
|
|
92
|
-
headers: { accept: "application/vnd.github+json", "user-agent": "
|
|
92
|
+
headers: { accept: "application/vnd.github+json", "user-agent": "limixbot-update-check" },
|
|
93
93
|
signal: AbortSignal.timeout(8_000),
|
|
94
94
|
});
|
|
95
95
|
/** Null until a first version has been promoted: the record does not exist yet. */
|
|
@@ -29,7 +29,7 @@ const EXCLUDED = new Set([
|
|
|
29
29
|
".limixbot-server-child", "environment-id", "sessions.json", "tunnel-account.json",
|
|
30
30
|
"team-computers.json",
|
|
31
31
|
"vm-working-folders.json",
|
|
32
|
-
"openmausbot-server.lease", "box-create-requests.lock", "messages.db-wal", "messages.db-shm",
|
|
32
|
+
".limixbot-server-child", ".openmausbot-server-child", "openmausbot-server.lease", "limixbot-server.lease", "box-create-requests.lock", "messages.db-wal", "messages.db-shm",
|
|
33
33
|
"runtime.db-wal", "runtime.db-shm",
|
|
34
34
|
"decider-log",
|
|
35
35
|
"cloud-owner.json",
|
|
@@ -57,7 +57,7 @@ const EXCLUSION_NOTES = [
|
|
|
57
57
|
];
|
|
58
58
|
const RESTORE_WARNING = "Restoring pauses routines, webhooks and calendar calls, ends every wait, and does not resume pending delegations, queued chat messages or queued runs. Definitions and historical receipts are retained; review before enabling them again.";
|
|
59
59
|
function excluded(name) {
|
|
60
|
-
return EXCLUDED.has(name) || excludedWorkspaceAuthPath(name) ||
|
|
60
|
+
return EXCLUDED.has(name) || excludedWorkspaceAuthPath(name) || /^(?:limixbot|openmausbot)-server\.lease\./.test(name) || name.startsWith("box-create-requests.lock.") || /^perm-[A-Za-z0-9_-]+\.sock$/.test(name);
|
|
61
61
|
}
|
|
62
62
|
function forbiddenArchivePath(path) {
|
|
63
63
|
const folded = path.toLowerCase();
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { createRequire as __ombCreateRequire } from "node:module";
|
|
2
2
|
const require = __ombCreateRequire(import.meta.url);
|
|
3
|
-
import{spawn}from"node:child_process";import{existsSync as existsSync2,realpathSync}from"node:fs";import{homedir}from"node:os";import{dirname,join as join2,resolve}from"node:path";import{fileURLToPath,pathToFileURL}from"node:url";import{freemem,totalmem}from"node:os";var MB=1024*1024;function boxMemoryFrom(constrained,total){let cgroupLimit=constrained>0&&constrained<total?constrained:null;return{bytes:cgroupLimit??total,cgroupLimit}}var box;function boxMemory(){return box??=boxMemoryFrom(process.constrainedMemory?.()??0,totalmem()),box}var HEAP_SHARE=.6,HEAP_MIN_MB=128,HEAP_MAX_MB=4096;function heapSizeArgs(cgroupLimit,nodeOptions){return cgroupLimit===null||/--max[-_]old[-_]space[-_]size/.test(nodeOptions??"")?[]:[`--max-old-space-size=${Math.min(HEAP_MAX_MB,Math.max(HEAP_MIN_MB,Math.floor(cgroupLimit*HEAP_SHARE/MB)))}`]}import{execFileSync}from"node:child_process";import{existsSync,linkSync,mkdirSync,readdirSync,readFileSync,readlinkSync,renameSync,unlinkSync,writeFileSync}from"node:fs";import{hostname,uptime}from"node:os";import{join}from"node:path";var LEASE_NAME="openmausbot-server.lease",DELEGATED_CHILD_DIR=".limixbot-server-child";var UUID=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,MAX_PID=2147483647,MAX_BOOT_ID=128;var DataDirLeaseError=class extends Error{name="DataDirLeaseError"};function leaseError(message,cause){return Object.assign(new DataDirLeaseError(message),{cause})}function isPid(value){return Number.isInteger(value)&&value>0&&value<=MAX_PID}var cachedBootSession;function readBootSession(){try{if(process.platform==="linux")return normalizeBootId(readFileSync("/proc/sys/kernel/random/boot_id","utf8"));if(process.platform==="darwin")return normalizeBootId(execFileSync("/usr/sbin/sysctl",["-n","ker\
|
|
3
|
+
import{spawn}from"node:child_process";import{existsSync as existsSync2,realpathSync}from"node:fs";import{homedir}from"node:os";import{dirname,join as join2,resolve}from"node:path";import{fileURLToPath,pathToFileURL}from"node:url";import{freemem,totalmem}from"node:os";var MB=1024*1024;function boxMemoryFrom(constrained,total){let cgroupLimit=constrained>0&&constrained<total?constrained:null;return{bytes:cgroupLimit??total,cgroupLimit}}var box;function boxMemory(){return box??=boxMemoryFrom(process.constrainedMemory?.()??0,totalmem()),box}var HEAP_SHARE=.6,HEAP_MIN_MB=128,HEAP_MAX_MB=4096;function heapSizeArgs(cgroupLimit,nodeOptions){return cgroupLimit===null||/--max[-_]old[-_]space[-_]size/.test(nodeOptions??"")?[]:[`--max-old-space-size=${Math.min(HEAP_MAX_MB,Math.max(HEAP_MIN_MB,Math.floor(cgroupLimit*HEAP_SHARE/MB)))}`]}import{execFileSync}from"node:child_process";import{existsSync,linkSync,mkdirSync,readdirSync,readFileSync,readlinkSync,renameSync,unlinkSync,writeFileSync}from"node:fs";import{hostname,uptime}from"node:os";import{join}from"node:path";var LEASE_NAME="limixbot-server.lease",LEGACY_LEASE_NAME="openmausbot-server.lease",DELEGATED_CHILD_DIR=".limixbot-server-child";var UUID=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,MAX_PID=2147483647,MAX_BOOT_ID=128;var DataDirLeaseError=class extends Error{name="DataDirLeaseError"};function leaseError(message,cause){return Object.assign(new DataDirLeaseError(message),{cause})}function isPid(value){return Number.isInteger(value)&&value>0&&value<=MAX_PID}var cachedBootSession;function readBootSession(){try{if(process.platform==="linux")return normalizeBootId(readFileSync("/proc/sys/kernel/random/boot_id","utf8"));if(process.platform==="darwin")return normalizeBootId(execFileSync("/usr/sbin/sysctl",["-n","ker\
|
|
4
4
|
n.bootsessionuuid"],{encoding:"utf8",timeout:5e3,stdio:["ignore","pipe","ignore"]}))}catch{}return null}function normalizeBootId(value){let id=String(value).trim();return id.length>0&&id.length<=MAX_BOOT_ID&&!/[^0-9A-Za-z:_.-]/.test(id)?id:null}function bootSession(){return cachedBootSession===void 0&&(cachedBootSession=readBootSession()),cachedBootSession}function isBootIdentity(value){return value===null||typeof value=="string"&&normalizeBootId(value)===value}var cachedPidNamespace;function readPidNamespace(){if(process.platform!=="linux")return null;try{return/^pid:\[([1-9][0-9]{0,19})\]$/.exec(readlinkSync("/proc/self/ns/pid"))?.[1]??null}catch{return null}}function pidNamespace(){return cachedPidNamespace===void 0&&(cachedPidNamespace=readPidNamespace()),cachedPidNamespace}function isPidNamespace(value){return value===null||typeof value=="str\
|
|
5
5
|
ing"&&/^[1-9][0-9]{0,19}$/.test(value)}function isStartTicks(value){return value===null||Number.isSafeInteger(value)&&value>=0}function isLeaseOwner(value){return!value||typeof value!="object"||Array.isArray(value)?!1:value.version===1&&isPid(value.pid)&&typeof value.host=="string"&&value.host.length>0&&value.host.length<=255&&!/[\r\n\0]/.test(value.host)&&typeof value.token=="string"&&UUID.test(value.token)&&typeof value.createdAt=="number"&&Number.isFinite(value.createdAt)&&value.createdAt>0&&(value.boot===void 0||isBootIdentity(value.boot))&&(value.uptime===void 0||Number.isInteger(value.uptime)&&value.uptime>=0)&&(value.
|
|
6
6
|
ns===void 0||isPidNamespace(value.ns))&&(value.start===void 0||isStartTicks(value.start))}function parseRecord(path,invalidMessage,validate){let raw;try{raw=readFileSync(path,"utf8")}catch(error){if(error?.code==="ENOENT")return null;throw leaseError("Limix Bot cannot read the data-directory lease; refusing to start to protect its state.",error)}let record;try{record=JSON.parse(raw)}catch(error){throw leaseError(invalidMessage,error)}if(!validate(record))throw leaseError(invalidMessage);return record}function readOwner(path){return parseRecord(path,"The Limix Bot data-directory lease\
|
|
7
7
|
is invalid; refusing to start to protect its state.",isLeaseOwner)}function unlinkExact(path,message){try{unlinkSync(path)}catch(error){if(error?.code!=="ENOENT")throw leaseError(message,error)}}function validateDataDir(dataDir){if(typeof dataDir!="string"||dataDir.trim().length===0||/[\r\n\0]/.test(dataDir))throw leaseError("Limix Bot cannot lease an invalid data directory.");return dataDir}function clearRecordsFromEarlierRunOfThisContainer(dataDir){let boot=bootSession(),ns=pidNamespace();return boot===null||ns===null?[]:clearRecords(dataDir,record=>record.host===hostname()&&record.boot===boot&&typeof record.ns=="string"&&record.ns!==ns)}function clearRecords(dataDir,stale){validateDataDir(dataDir);let entries;try{entries=readdirSync(dataDir)}catch(error){if(error?.code==="ENOENT")return[];throw leaseError("Limix Bot cannot read its data directory.",error)}let paths=[join(dataDir,
|
|
8
|
-
LEASE_NAME),join(dataDir,DELEGATED_CHILD_DIR,LEASE_NAME),...entries.filter(name=>name.startsWith(`${
|
|
8
|
+
LEASE_NAME),join(dataDir,DELEGATED_CHILD_DIR,LEASE_NAME),join(dataDir,LEGACY_LEASE_NAME),join(dataDir,DELEGATED_CHILD_DIR,LEGACY_LEASE_NAME),join(dataDir,".openmausbot-server-child",LEGACY_LEASE_NAME),...entries.filter(name=>[LEASE_NAME,LEGACY_LEASE_NAME].some(prefix=>name.startsWith(`${prefix}.reap-`))).map(name=>join(dataDir,name))],cleared=[];for(let path of paths){let record=readOwner(path);!record||!stale(record)||(unlinkExact(path,"Limix Bot could not remove the data-directory record anoth\
|
|
9
|
+
er machine left."),cleared.push({path,host:record.host,pid:record.pid}))}return cleared}function restartPolicy(now=Date.now){let restarts=0,startedAt=now();return{again(code,stopping=!1){return now()-startedAt>=6e4&&(restarts=0),stopping||code!==75||restarts>=5?!1:(restarts++,startedAt=now(),!0)}}}function serverCommand(here,env,options={}){let bootstrap=join2(here,"desktop-entry.mjs"),cached=(options.exists??existsSync2)(bootstrap),dataDir=env.OMB_DATA_DIR||join2(homedir(),".limixbot");return{args:[...heapSizeArgs((options.box??boxMemory()).cgroupLimit,env.NODE_OPTIONS),cached?bootstrap:join2(here,"index.js")],env:cached?{...env,OMB_SERVER_COMPILE_CACHE:join2(dataDir,"cache","node-compile")}:env}}function superviseServer(start,options={}){let signals=options.signals??process,now=options.
|
|
9
10
|
now??Date.now;return new Promise(done=>{let child,stopping=!1,policy=restartPolicy(now),pass=signal=>()=>{stopping=!0,child.kill(signal)},onTerm=pass("SIGTERM"),onInt=pass("SIGINT"),finish=code=>{signals.off("SIGTERM",onTerm),signals.off("SIGINT",onInt),done(code)},run=()=>{child=start(),child.once("error",()=>finish(1)),child.once("exit",(code,signal)=>{if(policy.again(code,stopping)){console.log("Limix Bot is starting again to finish installing a copy from the desktop app\u2026"),run();return}
|
|
10
11
|
finish(code??(stopping&&(signal==="SIGTERM"||signal==="SIGINT")?0:1))})};signals.on("SIGTERM",onTerm),signals.on("SIGINT",onInt),run()})}function isEntry(){try{return!!process.argv[1]&&import.meta.url===pathToFileURL(realpathSync(resolve(process.argv[1]))).href}catch{return!1}}if(isEntry()){let dataDir=process.env.OMB_DATA_DIR||join2(homedir(),".limixbot");try{for(let{path,pid}of clearRecordsFromEarlierRunOfThisContainer(dataDir))console.log(`Removed ${path}, left by this container's server (pro\
|
|
11
12
|
cess ${pid}) when it stopped without closing.`)}catch(error){console.warn(`The data folder's lease could not be checked: ${error instanceof Error?error.message:String(error)}`)}let server=serverCommand(dirname(fileURLToPath(import.meta.url)),process.env);superviseServer(()=>spawn(process.execPath,server.args,{stdio:"inherit",env:server.env})).then(code=>{process.exitCode=code})}export{serverCommand,superviseServer};
|
|
@@ -1620,11 +1620,11 @@ people,person,"uploads.json")))):[]}function teamPrivateAttachments(root,message
|
|
|
1620
1620
|
(privacy.threads.has(String(row.thread))?candidates:kept).add(name)}}finally{db.close()}}return new Set([...candidates].filter(name=>!kept.has(name)))}function stripTeamPrivate(snapshot,privacy){let threads=[...privacy.threads];strip(snapshot.messages,db=>{for(let table of["messages","thread_state","chat_followups","notification_log"])deleteWhereIn(db,table,"thread_id",threads);if(hasTable(db,"command_receipts")&&db.exec("DELETE FROM command_receipts"),!hasTable(db,"memory_files"))return;let indexed=db.
|
|
1621
1621
|
prepare("SELECT DISTINCT bot_id AS id FROM memory_files").all().map(row=>String(row.id));deleteWhereIn(db,"memory_files","bot_id",indexed.filter(id2=>memberLayer(id2)||privacy.bots.has(id2)))}),strip(snapshot.runtime,db=>{let assignments=[...new Set([...selectWhereIn(db,"assignments","id","requester_thread_id",threads),...selectWhereIn(db,"assignments","id","assignee_thread_id",threads)])];deleteWhereIn(db,"assignment_events","assignment_id",assignments),deleteWhereIn(db,"inbox","assignment_id",
|
|
1622
1622
|
assignments),deleteWhereIn(db,"inbox","owner_thread_id",threads),deleteWhereIn(db,"assignments","id",assignments)})}var TEAM_PRIVATE_NOTE="Members' private chats are theirs alone and are not in this export: their conversations, what bots remember from them, their own Limix Bot and their About you stay out.";var MAX_WORKSPACE_BACKUP_BYTES=10*1024**3,MAX_WORKSPACE_BACKUP_FILES=1e5,MAX_WORKSPACE_BACKUP_UPLOAD_BYTES=MAX_WORKSPACE_BACKUP_BYTES+256*1024**2,MAX_METADATA_BYTES=16*1024**2,MAGIC=Buffer.from(`OMB-WORKSPACE-1
|
|
1623
|
-
`),HEADER_BYTES=MAGIC.length+16+12;var ID=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,WAITS_FILE="waits.json",EXCLUDED=new Set([".backups","tools","browser","agent-browser-profiles","cache",".cache","tmp",".tmp","dist-native","tunnel-runtime","evidence",".limixbot-server-child","environment-id","sessions.json","tunnel-account.json","team-computers.json","vm-working-folders.json","
|
|
1624
|
-
decider-log","cloud-owner.json","sync","claude-user-skills","box","engine-homes",WAITS_FILE,"data-format.json"]),EXCLUSION_NOTES=["Device pairing, server identity, live leases and runtime files (existing destination identities are preserved).","Saved credentials, provider and MCP connections, managed provider login homes and browser login profiles are not transferred. Destination connections are preserved; reconnect on
|
|
1625
|
-
|
|
1626
|
-
bot again after restoring."],RESTORE_WARNING="Restoring pauses routines, webhooks and calendar calls, ends every wait, and does not resume pending delegations, queued chat messages or queued runs. Definitions and historical receipts are retained; review before enabling them again.";function excluded(name){return EXCLUDED.has(name)||excludedWorkspaceAuthPath(name)
|
|
1627
|
-
function forbiddenArchivePath(path){let folded=path.toLowerCase();return excluded(folded.split("/")[0])||excludedWorkspaceAuthPath(folded)||path!==folded&&["config.json","webhooks.json"].includes(folded)}var SNAPSHOT_DATABASES={"messages.db":"messages-snapshot.db","runtime.db":"runtime-snapshot.db"},LIVE_DATABASE_SIDECARS=new Set(Object.keys(SNAPSHOT_DATABASES).flatMap(name=>[`${name}-wal`,`${name}-shm`]));function folder(path){mkdirSync2(path,{recursive:!0,mode:448});let stat=lstatSync2(path);if(!stat.isDirectory()||stat.isSymbolicLink())throw new Error("The backup directory must be a real directory, not a symbolic link.");chmodSync(path,448)}function backupRoot(dataDir2){let root=resolve2(dataDir2);if(root===parse3(root).root)throw new Error("A filesystem root cannot be a workspace backup target.");let stat=lstatSync2(root);if(!stat.isDirectory()||stat.isSymbolicLink())throw new Error("The works\
|
|
1623
|
+
`),HEADER_BYTES=MAGIC.length+16+12;var ID=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,WAITS_FILE="waits.json",EXCLUDED=new Set([".backups","tools","browser","agent-browser-profiles","cache",".cache","tmp",".tmp","dist-native","tunnel-runtime","evidence",".limixbot-server-child","environment-id","sessions.json","tunnel-account.json","team-computers.json","vm-working-folders.json",".limixbot-server-child",".openmausbot-server-child","openmausbot-server.lease","limixbot-server.lease","box-create-requests.\
|
|
1624
|
+
lock","messages.db-wal","messages.db-shm","runtime.db-wal","runtime.db-shm","decider-log","cloud-owner.json","sync","claude-user-skills","box","engine-homes",WAITS_FILE,"data-format.json"]),EXCLUSION_NOTES=["Device pairing, server identity, live leases and runtime files (existing destination identities are preserved).","Saved credentials, provider and MCP connections, managed provider login homes and browser login profiles are not transferred. Destination connections are preserved; reconnect on \
|
|
1625
|
+
a new device.","Downloaded tools and caches (they can be installed again), and recorded browser step screenshots (export them from a conversation to keep them).","Installed dependency folders (node_modules) and symbolic links inside conversation work folders; reinstall or recreate them in the project.","External project folders, CLI login homes, browser session homes, OS keychains, companion devices and other servers.","VM/container disk layers and remote cloud data; durable files inside this wo\
|
|
1626
|
+
rkspace are included.","Waits bots set up: they end within a week, so ask the bot again after restoring."],RESTORE_WARNING="Restoring pauses routines, webhooks and calendar calls, ends every wait, and does not resume pending delegations, queued chat messages or queued runs. Definitions and historical receipts are retained; review before enabling them again.";function excluded(name){return EXCLUDED.has(name)||excludedWorkspaceAuthPath(name)||/^(?:limixbot|openmausbot)-server\.lease\./.test(name)||
|
|
1627
|
+
name.startsWith("box-create-requests.lock.")||/^perm-[A-Za-z0-9_-]+\.sock$/.test(name)}function forbiddenArchivePath(path){let folded=path.toLowerCase();return excluded(folded.split("/")[0])||excludedWorkspaceAuthPath(folded)||path!==folded&&["config.json","webhooks.json"].includes(folded)}var SNAPSHOT_DATABASES={"messages.db":"messages-snapshot.db","runtime.db":"runtime-snapshot.db"},LIVE_DATABASE_SIDECARS=new Set(Object.keys(SNAPSHOT_DATABASES).flatMap(name=>[`${name}-wal`,`${name}-shm`]));function folder(path){mkdirSync2(path,{recursive:!0,mode:448});let stat=lstatSync2(path);if(!stat.isDirectory()||stat.isSymbolicLink())throw new Error("The backup directory must be a real directory, not a symbolic link.");chmodSync(path,448)}function backupRoot(dataDir2){let root=resolve2(dataDir2);if(root===parse3(root).root)throw new Error("A filesystem root cannot be a workspace backup target.");let stat=lstatSync2(root);if(!stat.isDirectory()||stat.isSymbolicLink())throw new Error("The works\
|
|
1628
1628
|
pace data directory must not be a symbolic link.");let path=join13(root,".backups");return folder(path),path}function jobPath(dataDir2,id2){if(!ID.test(id2))throw new Error("Invalid workspace backup identifier.");let path=join13(backupRoot(dataDir2),id2);if(entryExists(path)){let stat=lstatSync2(path);if(!stat.isDirectory()||stat.isSymbolicLink())throw new Error("Unsafe workspace backup job directory.")}return path}function newJob(dataDir2,id2=randomUUID2()){let directory=jobPath(dataDir2,id2);return mkdirSync2(
|
|
1629
1629
|
directory,{mode:448}),{id:id2,directory}}function record3(value){return value!==null&&typeof value=="object"&&!Array.isArray(value)}function entryExists(path){try{return lstatSync2(path),!0}catch(error62){if(error62.code==="ENOENT")return!1;throw error62}}function privateJson(path){let fd=openSync3(path,constants2.O_RDONLY|constants2.O_NOFOLLOW);try{let stat=fstatSync3(fd);if(!stat.isFile()||stat.size>MAX_METADATA_BYTES)throw new Error("Workspace backup metadata is too large or is not a regular \
|
|
1630
1630
|
file.");return JSON.parse(readFileSync5(fd,"utf8"))}finally{closeSync3(fd)}}function writeJson(path,value){let text=JSON.stringify(value);if(Buffer.byteLength(text)>MAX_METADATA_BYTES)throw new Error("Workspace backup metadata exceeds the size limit.");writeFileAtomic(path,text,{mode:384})}function assertLocalAuthOutsideSnapshot(dataDir2){let configPath=join13(dataDir2,"config.json"),config2=existsSync3(configPath)?privateJson(configPath):{},instances=record3(config2)&&record3(config2.instances)?config2.instances:{},fields=["HOME","USERPROFILE","CLAUDE_CONFIG_DIR","CODEX_HOME","GROK_HOME","KIMI_CODE_HOME","HERMES_HOME","FACTORY_HOME_OVERRIDE","XDG_CONFIG_HOME","XDG_DATA_HOME","LOCALAPPDATA"],check2=(value,field,home2)=>{if(typeof value!="string"||!value.trim())return;let text=value.
|
package/package.json
CHANGED
|
File without changes
|