Skip to content

Commit 5699486

Browse files
committed
fix(os): refresh USB persistence hardening
1 parent 74cc885 commit 5699486

15 files changed

Lines changed: 276 additions & 22 deletions

packages/agent/vitest.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ export default defineConfig({
3434
"packages/app-core/src/account-pool.ts",
3535
),
3636
},
37+
{
38+
find: /^@elizaos\/app-core\/(.+)$/,
39+
replacement: path.join(monorepoRoot, "packages/app-core/src/$1"),
40+
},
3741
{
3842
find: "@elizaos/app-core",
3943
replacement: path.join(monorepoRoot, "packages/app-core/src/index.ts"),
177 KB
Loading
177 KB
Loading
105 KB
Loading
105 KB
Loading
520 KB
Loading
520 KB
Loading

packages/os/linux/variants/milady-tails/build.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ if [ ! -d "${TAILS_SRC}/config" ]; then
5454
exit 1
5555
fi
5656

57+
if [ "${STAGE}" = "binary" ] && [ "${ELIZAOS_SYNC_CHROOT:-1}" = "1" ]; then
58+
echo "=== syncing elizaOS overlay into existing chroot ==="
59+
"${HERE}/scripts/sync-runtime-to-chroot.sh"
60+
fi
61+
5762
echo "=== building image ${IMAGE} ==="
5863
# The image bakes in only Tails' live-build fork; the Dockerfile's build
5964
# context needs that source available as tails-live-build/. The vendored

packages/os/linux/variants/milady-tails/scripts/prepare-milady-app-overlay.mjs

Lines changed: 115 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,103 @@ export default plugin;
256256

257257
const optionalStubPackages = new Map(
258258
Object.entries({
259+
"@elizaos/app-model-tester": `
260+
export const modelTesterPlugin = {
261+
name: "model-tester",
262+
description: "Model tester routes are not bundled in elizaOS Live.",
263+
routes: [],
264+
};
265+
export default modelTesterPlugin;
266+
`,
267+
"@elizaos/plugin-companion": `
268+
export const appCompanionPlugin = {
269+
name: "companion",
270+
description: "Companion overlay placeholder for elizaOS Live. The full 3D companion bundle can be installed through app updates.",
271+
actions: [],
272+
providers: [],
273+
services: [],
274+
routes: [],
275+
};
276+
export const companionPlugin = appCompanionPlugin;
277+
export const registerCompanionApp = () => undefined;
278+
export default appCompanionPlugin;
279+
`,
280+
"@elizaos/plugin-lifeops": `
281+
export const appLifeOpsPlugin = {
282+
name: "lifeops",
283+
description: "LifeOps placeholder for elizaOS Live. Cloud connectors and proactive workflows become available after provider setup.",
284+
actions: [],
285+
providers: [],
286+
services: [],
287+
routes: [],
288+
};
289+
export const lifeopsPlugin = {
290+
name: "lifeops-routes",
291+
routes: [],
292+
};
293+
export const BrowserBridgePluginService = undefined;
294+
export const browserBridgeProvider = undefined;
295+
export const detectHealthBackend = () => ({ available: false, backend: "none" });
296+
export const handleLifeOpsRoutes = async () => false;
297+
export const handleWebsiteBlockerRoutes = async () => false;
298+
export default appLifeOpsPlugin;
299+
`,
300+
"@elizaos/plugin-documents": `
301+
export const documentsPlugin = {
302+
name: "documents",
303+
description: "Documents app routes are not bundled in the elizaOS Live base runtime.",
304+
routes: [],
305+
};
306+
export const plugin = documentsPlugin;
307+
export default documentsPlugin;
308+
`,
309+
"@elizaos/plugin-hyperliquid-app": `
310+
export const hyperliquidPlugin = {
311+
name: "hyperliquid",
312+
description: "Hyperliquid app routes are not bundled in the elizaOS Live base runtime.",
313+
routes: [],
314+
};
315+
export const plugin = hyperliquidPlugin;
316+
export default hyperliquidPlugin;
317+
`,
318+
"@elizaos/plugin-polymarket-app": `
319+
export const polymarketPlugin = {
320+
name: "polymarket",
321+
description: "Polymarket app routes are not bundled in the elizaOS Live base runtime.",
322+
routes: [],
323+
};
324+
export const plugin = polymarketPlugin;
325+
export default polymarketPlugin;
326+
`,
327+
"@elizaos/plugin-shopify-ui": `
328+
export const shopifyPlugin = {
329+
name: "shopify",
330+
routes: [],
331+
};
332+
export default shopifyPlugin;
333+
`,
334+
"@elizaos/plugin-steward-app": `
335+
export const stewardPlugin = {
336+
name: "steward",
337+
routes: [],
338+
};
339+
export default stewardPlugin;
340+
`,
341+
"@elizaos/plugin-training": `
342+
export const trainingPlugin = {
343+
name: "training",
344+
routes: [],
345+
};
346+
export const registerTrainingRuntimeHooks = async () => undefined;
347+
export default trainingPlugin;
348+
`,
349+
"@elizaos/plugin-vincent": `
350+
export const vincentPlugin = {
351+
name: "vincent",
352+
routes: [],
353+
};
354+
export default vincentPlugin;
355+
`,
259356
"@elizaos/plugin-whatsapp": `
260357
const noop = () => undefined;
261358
const falseRoute = async () => false;
@@ -388,6 +485,15 @@ export default undefined;
388485
}).map(([packageName, source]) => [packageName, `${source.trimStart()}\n`]),
389486
);
390487

488+
const forceLiveStubPackages = new Set([
489+
"@elizaos/plugin-companion",
490+
"@elizaos/plugin-documents",
491+
"@elizaos/plugin-google",
492+
"@elizaos/plugin-hyperliquid-app",
493+
"@elizaos/plugin-lifeops",
494+
"@elizaos/plugin-polymarket-app",
495+
]);
496+
391497
const chromiumFlags = {
392498
"disable-gpu": true,
393499
"disable-gpu-compositing": true,
@@ -495,7 +601,11 @@ function isLiveStubPackage(packageJson) {
495601

496602
function shouldWriteLiveFallbackPackage(packageName) {
497603
const packageJson = readPackageManifest(packageName);
498-
return !packageJson || isLiveStubPackage(packageJson);
604+
return (
605+
forceLiveStubPackages.has(packageName) ||
606+
!packageJson ||
607+
isLiveStubPackage(packageJson)
608+
);
499609
}
500610

501611
function sourcePackageManifest(_packageName, packageJson) {
@@ -1007,7 +1117,10 @@ function collectPackageInventory(projectedPackages = []) {
10071117

10081118
function packageStatus(packageName) {
10091119
const packageJson = readPackageManifest(packageName);
1010-
const generated = !packageJson || isLiveStubPackage(packageJson);
1120+
const generated =
1121+
forceLiveStubPackages.has(packageName) ||
1122+
!packageJson ||
1123+
isLiveStubPackage(packageJson);
10111124
return {
10121125
packageName,
10131126
packagePath: relativeToStage(packageManifestPath(packageName)),

packages/os/linux/variants/milady-tails/scripts/static-smoke.sh

Lines changed: 60 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,48 @@ for unit in \
878878
do
879879
grep -q '^ConditionPathExists=!/run/elizaos/persistence-maintenance$' "${unit}"
880880
done
881+
if [ "${SOURCE_ONLY}" != "1" ]; then
882+
verify_materialized_file() {
883+
local rel="$1"
884+
local src="tails/config/chroot_local-includes/${rel}"
885+
local chroot_path="tails/chroot/${rel}"
886+
local squashfs="tails/binary/live/filesystem.squashfs"
887+
local tmp
888+
889+
if [ -e "${chroot_path}" ] && ! cmp -s "${src}" "${chroot_path}"; then
890+
echo "${chroot_path} is stale; run scripts/sync-runtime-to-chroot.sh before binary rebuilds." >&2
891+
exit 1
892+
fi
893+
894+
if [ -f "${squashfs}" ] && command -v unsquashfs >/dev/null 2>&1; then
895+
tmp="$(mktemp)"
896+
if ! unsquashfs -cat "${squashfs}" "${rel}" >"${tmp}" 2>/dev/null; then
897+
rm -f "${tmp}"
898+
echo "${squashfs} is missing ${rel}" >&2
899+
exit 1
900+
fi
901+
if ! cmp -s "${src}" "${tmp}"; then
902+
rm -f "${tmp}"
903+
echo "${squashfs}:${rel} is stale; rebuild the binary image after syncing the chroot." >&2
904+
exit 1
905+
fi
906+
rm -f "${tmp}"
907+
fi
908+
}
909+
910+
for rel in \
911+
etc/systemd/user/elizaos-agent.service \
912+
etc/systemd/user/elizaos-renderer.service \
913+
etc/systemd/user/milady.service \
914+
usr/lib/systemd/user/tails-create-persistent-storage.service \
915+
usr/local/lib/elizaos/create-persistent-storage-session \
916+
usr/local/lib/elizaos/persistence-maintenance \
917+
usr/local/lib/persistent-storage/on-activated-hooks/MiladyData/20-restart-milady \
918+
usr/local/lib/persistent-storage/on-deactivated-hooks/MiladyData/20-restart-milady
919+
do
920+
verify_materialized_file "${rel}"
921+
done
922+
fi
881923
if grep -q 'systemctl --global enable elizaos-pill.service' \
882924
tails/config/chroot_local-hooks/52-update-systemd-units; then
883925
echo "Voice pill must stay installed but opt-in until the pill renderer is production-ready." >&2
@@ -1186,13 +1228,24 @@ for (const root of [
11861228
throw new Error(`${distIndex}: required runtime plugin dist is missing`);
11871229
}
11881230
}
1189-
const googleStubPath = `${nodeModules}/@elizaos/plugin-google/index.js`;
1190-
const googlePackagePath = `${nodeModules}/@elizaos/plugin-google/package.json`;
1191-
const googlePackage = JSON.parse(fs.readFileSync(googlePackagePath, "utf8"));
1192-
if (googlePackage.version === "0.0.0-elizaos-live-stub") {
1193-
const googleStub = fs.readFileSync(googleStubPath, "utf8");
1194-
if (!googleStub.includes("googlePlugin")) {
1195-
throw new Error(`${googleStubPath}: Google connector stub is malformed`);
1231+
const forcedLiveStubs = new Map([
1232+
["@elizaos/plugin-companion", "companion"],
1233+
["@elizaos/plugin-documents", "documents"],
1234+
["@elizaos/plugin-google", "google"],
1235+
["@elizaos/plugin-hyperliquid-app", "hyperliquid"],
1236+
["@elizaos/plugin-lifeops", "lifeops"],
1237+
["@elizaos/plugin-polymarket-app", "polymarket"],
1238+
]);
1239+
for (const [packageName, marker] of forcedLiveStubs) {
1240+
const stubPath = `${nodeModules}/${packageName}/index.js`;
1241+
const packagePath = `${nodeModules}/${packageName}/package.json`;
1242+
const packageJson = JSON.parse(fs.readFileSync(packagePath, "utf8"));
1243+
if (packageJson.version !== "0.0.0-elizaos-live-stub") {
1244+
throw new Error(`${packagePath}: ${packageName} must be a live-safe stub in the base USB runtime`);
1245+
}
1246+
const stub = fs.readFileSync(stubPath, "utf8");
1247+
if (!stub.includes(marker)) {
1248+
throw new Error(`${stubPath}: ${packageName} live-safe stub is malformed`);
11961249
}
11971250
}
11981251

0 commit comments

Comments
 (0)