@runeya/runeya 2.0.144 → 2.0.145
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/agent/index.js +7 -1
- package/agent/index.js.map +1 -1
- package/agent-manager-THV3LJOF.js +11 -0
- package/{chat-X3X527EX.js → chat-XYCHMTFE.js} +9 -9
- package/{chunk-7HIPFSOA.js → chunk-57P45FNY.js} +11 -3
- package/chunk-57P45FNY.js.map +1 -0
- package/{chunk-UR3HL373.js → chunk-FE53XX4M.js} +8 -8
- package/{chunk-IXO5KIO5.js → chunk-KS7A5CTW.js} +12 -1
- package/{chunk-IXO5KIO5.js.map → chunk-KS7A5CTW.js.map} +1 -1
- package/{chunk-XAFOP677.js → chunk-MZSDTA4A.js} +480 -233
- package/chunk-MZSDTA4A.js.map +1 -0
- package/{chunk-7L6AQUBR.js → chunk-NCO4OOYT.js} +6 -2
- package/{chunk-7L6AQUBR.js.map → chunk-NCO4OOYT.js.map} +1 -1
- package/{chunk-P73PTVII.js → chunk-ONVAH65J.js} +103 -33
- package/chunk-ONVAH65J.js.map +1 -0
- package/{chunk-NSS47H26.js → chunk-Q4RPY3VW.js} +330 -74
- package/chunk-Q4RPY3VW.js.map +1 -0
- package/{chunk-GXE5TLLJ.js → chunk-QF56Z6LI.js} +17 -17
- package/{companion-2LHKU577.js → companion-HBYSY2D5.js} +11 -7
- package/{desktop-installer-page-6JDSXK2E.js → desktop-installer-page-I5FHFDES.js} +11 -8
- package/desktop-installer-page-I5FHFDES.js.map +1 -0
- package/{desktop-launcher-YPNRQMIS.js → desktop-launcher-GD4QPM66.js} +3 -3
- package/index.js +25 -12
- package/index.js.map +1 -1
- package/{install-gate-2NNH7RM2.js → install-gate-JAEK4BDZ.js} +2 -2
- package/mcp-server/index.js +7 -1
- package/mcp-server/index.js.map +1 -1
- package/package.json +1 -1
- package/settings-manager-QVQRJO6V.js +10 -0
- package/src-DCCEUWE6.js +385 -0
- package/{src-5TEXF3SU.js → src-IODFUZ7A.js} +100 -59
- package/src-IODFUZ7A.js.map +1 -0
- package/{vault-resolver-VK6W5J6W.js → vault-resolver-PN3TYCLJ.js} +3 -2
- package/vault-resolver-PN3TYCLJ.js.map +1 -0
- package/web/assets/{AgentScalarChatInterface.vue-B-SjOsdj.js → AgentScalarChatInterface.vue-npQgDxeP.js} +1 -1
- package/web/assets/{AgentTerminalPage-JzC8DUgu.js → AgentTerminalPage-BTH3yCS2.js} +1 -1
- package/web/assets/{AiChatModals-D1928AxG.js → AiChatModals-It9jnB26.js} +1 -1
- package/web/assets/AppLayout-BTg2CADo.js +1 -0
- package/web/assets/{AppLayout-8sBPr3od.css → AppLayout-tsw5Ow0w.css} +1 -1
- package/web/assets/{AuditPage-BZIJ3_Kr.js → AuditPage-2PKKGLZs.js} +1 -1
- package/web/assets/{CloudAccountPage-DBv470sT.js → CloudAccountPage-CHL61gLe.js} +1 -1
- package/web/assets/{CloudMessagingPage-qCI8-UDL.js → CloudMessagingPage-cgKnABPH.js} +1 -1
- package/web/assets/DashboardPage-CRntTMKY.js +1 -0
- package/web/assets/{DashboardPage-D9-PpC3F.css → DashboardPage-FvNuC_e4.css} +1 -1
- package/web/assets/{DirectoryPickerDialog-B5DvDfQP.js → DirectoryPickerDialog-DCyhT3-W.js} +1 -1
- package/web/assets/{EnvironmentForm-Bw8Djnqm.js → EnvironmentForm-C96PFWRE.js} +1 -1
- package/web/assets/{EnvironmentFormPage-B59uiYtp.js → EnvironmentFormPage-ChorAd63.js} +1 -1
- package/web/assets/{EnvironmentListPage-W9zLDZAg.js → EnvironmentListPage-Dw9ziaI8.js} +1 -1
- package/web/assets/KanbanBoardPage-BZHbEj-q.js +4 -0
- package/web/assets/KanbanBoardPage-eHmsrFGA.css +1 -0
- package/web/assets/{KanbanListPage-Bn9k8Rpc.js → KanbanListPage-B0jlfKqs.js} +1 -1
- package/web/assets/{LaunchProjectPage-Dc7v1UjQ.js → LaunchProjectPage-BVs1JwbV.js} +1 -1
- package/web/assets/LaunchServicesPage-DoLDPqQq.css +1 -0
- package/web/assets/LaunchServicesPage-PBYJly9N.js +1 -0
- package/web/assets/{LaunchShell-LonTJpb3.js → LaunchShell-CGNYr-do.js} +1 -1
- package/web/assets/{LogViewer-DkuqWYkQ.js → LogViewer-BDObx29F.js} +1 -1
- package/web/assets/{OrgKeyPrompt-By1VjlSN.js → OrgKeyPrompt-BbcwiwGw.js} +1 -1
- package/web/assets/{ProcessControls-C0skzKGL.js → ProcessControls-DY0HTKde.js} +1 -1
- package/web/assets/{ProcessDetailPage-BvPX6z_X.js → ProcessDetailPage-BZ9kIQqn.js} +1 -1
- package/web/assets/{ProjectCreateDialog-C4o9u15L.js → ProjectCreateDialog-C1wVDPcK.js} +1 -1
- package/web/assets/{ProjectLocationGate-BJ1CSQt0.js → ProjectLocationGate-bUd_tFpI.js} +1 -1
- package/web/assets/{ProjectPublishDialog-Cp-zXdGm.js → ProjectPublishDialog-APUS1WEN.js} +1 -1
- package/web/assets/{RandomJobTestPage-DF4a1U13.js → RandomJobTestPage-BFNC827R.js} +1 -1
- package/web/assets/ScenarioEditorPage-DFVsMVu5.js +14 -0
- package/web/assets/{SendToChatDialog-Dg2SHkVD.js → SendToChatDialog-QHIkxNio.js} +1 -1
- package/web/assets/{ServiceControlsBar-q2VHWaxK.js → ServiceControlsBar-_UQXb6g0.js} +1 -1
- package/web/assets/ServiceDetailPage-DGIXgHwR.js +2 -0
- package/web/assets/{ServiceFormPage-tT_n7WUy.js → ServiceFormPage-RliAfS3_.js} +1 -1
- package/web/assets/SettingsPage-BSSHxxjM.js +2086 -0
- package/web/assets/{SettingsPage-aGSxZw1n.css → SettingsPage-W8YszhUL.css} +1 -1
- package/web/assets/{UnlockPage-BKAdMJkb.js → UnlockPage-17EgfpJs.js} +1 -1
- package/web/assets/{VaultMigrationPage-D9KUTTss.js → VaultMigrationPage-DeMxpXXJ.js} +1 -1
- package/web/assets/{VersionBadge-moKP5bAv.js → VersionBadge-DBquJl76.js} +1 -1
- package/web/assets/{WikiPage-hLUndDxo.js → WikiPage-GtwpJPqf.js} +1 -1
- package/web/assets/{WikiView-rrjXRR72.js → WikiView-BqaqxMxW.js} +1 -1
- package/web/assets/{add-scalar-classes-CBfRr8B2.js → add-scalar-classes-DhSSqZ5l.js} +2 -2
- package/web/assets/{agent.store-B3dVemmT.js → agent.store-Co44dMZf.js} +1 -1
- package/web/assets/app-mode-BVpTuh0i.js +1 -0
- package/web/assets/auth-Bk1GP5sB.js +2 -0
- package/web/assets/{cloud-chat.store-Wg1poFem.js → cloud-chat.store-CadB14dZ.js} +1 -1
- package/web/assets/{cloud-client-DQlUaoAw.js → cloud-client-0zD_NI6q.js} +2 -2
- package/web/assets/{cloud-session-DRUqcSGP.js → cloud-session-Cjw54Y--.js} +2 -2
- package/web/assets/dist-N4nrnbnA.js +1 -0
- package/web/assets/{editor.store-SoH48ux2.js → editor.store-DmM6ZlTm.js} +1 -1
- package/web/assets/i18n-8FjeJaKW.js +1 -0
- package/web/assets/{index-D_x2s8Ut.js → index-B9DJf2V0.js} +101 -101
- package/web/assets/{index-C_JV7fYy.css → index-teBqdnuv.css} +1 -1
- package/web/assets/{modal-CpsVK_dA.js → modal-UK8xRSnh.js} +1 -1
- package/web/assets/{project-launch.store-C3fZeRGb.js → project-launch.store-B5nhdGdh.js} +1 -1
- package/web/assets/{project.store-BEk4fciH.js → project.store-Bm2JWNbd.js} +1 -1
- package/web/assets/{scenario.store-D-JrRiVO.js → scenario.store-88w6P6s2.js} +2 -2
- package/web/assets/{service.store-B5uYZtyM.js → service.store-XS50iGKo.js} +1 -1
- package/web/assets/{settings-scope-Blnwj3rR.js → settings-scope-CKPq86HZ.js} +1 -1
- package/web/assets/{settings.store-Bo3FYs1o.js → settings.store-BCJ0LJQA.js} +1 -1
- package/web/assets/src-BDZKZr9n.css +1 -0
- package/web/assets/{src-DValZNJU.js → src-Cgix2VOi.js} +5 -5
- package/web/assets/{src-CAwAaB5j.js → src-DBipSD56.js} +1 -1
- package/web/assets/{trpc-DbsE5GvQ.js → trpc-CfuFkKgp.js} +3 -3
- package/web/assets/{useCloudOrg-DygUBG1a.js → useCloudOrg-J8DAnocE.js} +1 -1
- package/web/assets/{useEnvVarAutocomplete-DmYNOXgd.js → useEnvVarAutocomplete-C6zOXYqi.js} +1 -1
- package/web/assets/{useProjectCatalog-D2mHB7dg.js → useProjectCatalog-BB5IR6o8.js} +1 -1
- package/web/assets/{useProjectCloudOrg-avTCVold.js → useProjectCloudOrg-BnlKts7x.js} +1 -1
- package/web/assets/{useServiceUrlHost-Q3fzGox3.js → useServiceUrlHost-hKbKtPMu.js} +1 -1
- package/web/assets/{vue-draggable-plus-WgrMXXmE.js → vue-draggable-plus-D5ni4jMk.js} +1 -1
- package/web/index.html +19 -18
- package/agent-manager-M4NA5YFD.js +0 -11
- package/chunk-7HIPFSOA.js.map +0 -1
- package/chunk-NSS47H26.js.map +0 -1
- package/chunk-P73PTVII.js.map +0 -1
- package/chunk-XAFOP677.js.map +0 -1
- package/desktop-installer-page-6JDSXK2E.js.map +0 -1
- package/settings-manager-32SVMAFN.js +0 -10
- package/src-5TEXF3SU.js.map +0 -1
- package/web/assets/AppLayout-CVQIBYqg.js +0 -1
- package/web/assets/DashboardPage-D0UZM0mr.js +0 -1
- package/web/assets/KanbanBoardPage-DRACMk_D.css +0 -1
- package/web/assets/KanbanBoardPage-DwPqoJDJ.js +0 -4
- package/web/assets/LaunchServicesPage-CXUS9O3y.js +0 -1
- package/web/assets/LaunchServicesPage-DJDIN8HU.css +0 -1
- package/web/assets/ScenarioEditorPage-Dl-gEkJI.js +0 -14
- package/web/assets/ServiceDetailPage-CJ8WaFod.js +0 -2
- package/web/assets/SettingsPage-CWakkv0V.js +0 -2086
- package/web/assets/auth-BCrvnP1U.js +0 -2
- package/web/assets/dist-DoChtT9t.js +0 -1
- package/web/assets/i18n-BszFg0ko.js +0 -1
- package/web/assets/src-DuBXN1hu.css +0 -1
- /package/{agent-manager-M4NA5YFD.js.map → agent-manager-THV3LJOF.js.map} +0 -0
- /package/{chat-X3X527EX.js.map → chat-XYCHMTFE.js.map} +0 -0
- /package/{chunk-UR3HL373.js.map → chunk-FE53XX4M.js.map} +0 -0
- /package/{chunk-GXE5TLLJ.js.map → chunk-QF56Z6LI.js.map} +0 -0
- /package/{companion-2LHKU577.js.map → companion-HBYSY2D5.js.map} +0 -0
- /package/{desktop-launcher-YPNRQMIS.js.map → desktop-launcher-GD4QPM66.js.map} +0 -0
- /package/{install-gate-2NNH7RM2.js.map → install-gate-JAEK4BDZ.js.map} +0 -0
- /package/{settings-manager-32SVMAFN.js.map → settings-manager-QVQRJO6V.js.map} +0 -0
- /package/{vault-resolver-VK6W5J6W.js.map → src-DCCEUWE6.js.map} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
agentManager
|
|
3
|
+
} from "./chunk-QF56Z6LI.js";
|
|
4
|
+
import "./chunk-OZBSOSAS.js";
|
|
5
|
+
import "./chunk-NCO4OOYT.js";
|
|
6
|
+
import "./chunk-KS7A5CTW.js";
|
|
7
|
+
import "./chunk-MZSDTA4A.js";
|
|
8
|
+
export {
|
|
9
|
+
agentManager
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=agent-manager-THV3LJOF.js.map
|
|
@@ -4,15 +4,15 @@ import {
|
|
|
4
4
|
startClaudeCodeSession,
|
|
5
5
|
startCliSession,
|
|
6
6
|
startCodexSession
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-7L6AQUBR.js";
|
|
12
|
-
import "./chunk-MD3VW4HQ.js";
|
|
13
|
-
import "./chunk-XAFOP677.js";
|
|
14
|
-
import "./chunk-IXO5KIO5.js";
|
|
7
|
+
} from "./chunk-ONVAH65J.js";
|
|
8
|
+
import "./chunk-FE53XX4M.js";
|
|
9
|
+
import "./chunk-Q4RPY3VW.js";
|
|
10
|
+
import "./chunk-QF56Z6LI.js";
|
|
15
11
|
import "./chunk-OZBSOSAS.js";
|
|
12
|
+
import "./chunk-NCO4OOYT.js";
|
|
13
|
+
import "./chunk-MD3VW4HQ.js";
|
|
14
|
+
import "./chunk-KS7A5CTW.js";
|
|
15
|
+
import "./chunk-MZSDTA4A.js";
|
|
16
16
|
export {
|
|
17
17
|
chatRouter,
|
|
18
18
|
cliToken,
|
|
@@ -20,4 +20,4 @@ export {
|
|
|
20
20
|
startCliSession,
|
|
21
21
|
startCodexSession
|
|
22
22
|
};
|
|
23
|
-
//# sourceMappingURL=chat-
|
|
23
|
+
//# sourceMappingURL=chat-XYCHMTFE.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
isLauncherProjectId,
|
|
2
3
|
launcherIdFromName
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MZSDTA4A.js";
|
|
4
5
|
|
|
5
6
|
// src/desktop-launcher.ts
|
|
6
7
|
import { mkdir, writeFile, rm, copyFile, access, readdir, readFile } from "fs/promises";
|
|
@@ -15,6 +16,10 @@ function launcherArgs(opts) {
|
|
|
15
16
|
if (opts.agentPort !== null && opts.agentPort !== (opts.port ?? 4e3) + 1) {
|
|
16
17
|
args.push("--agent-port", String(opts.agentPort));
|
|
17
18
|
}
|
|
19
|
+
if (opts.projectId) {
|
|
20
|
+
if (!isLauncherProjectId(opts.projectId)) throw new Error(`Id de projet invalide : ${JSON.stringify(opts.projectId)}`);
|
|
21
|
+
args.push("--project", opts.projectId);
|
|
22
|
+
}
|
|
18
23
|
return args;
|
|
19
24
|
}
|
|
20
25
|
function launcherWorkingDir(workingDir) {
|
|
@@ -246,7 +251,10 @@ function parseLauncherCommand(tokens) {
|
|
|
246
251
|
};
|
|
247
252
|
const port = flag("--port");
|
|
248
253
|
const agentPort = flag("--agent-port") ?? (port === null ? null : port + 1);
|
|
249
|
-
|
|
254
|
+
const projectIndex = args.indexOf("--project");
|
|
255
|
+
const rawProject = projectIndex === -1 ? void 0 : args[projectIndex + 1];
|
|
256
|
+
const projectId = rawProject !== void 0 && isLauncherProjectId(rawProject) ? rawProject : null;
|
|
257
|
+
return { nodePath, cliEntry, port, agentPort, projectId };
|
|
250
258
|
}
|
|
251
259
|
function pinnedDir(dir) {
|
|
252
260
|
return dir === homedir() ? null : dir;
|
|
@@ -458,4 +466,4 @@ export {
|
|
|
458
466
|
uninstallDesktopLauncher,
|
|
459
467
|
listDesktopLaunchers
|
|
460
468
|
};
|
|
461
|
-
//# sourceMappingURL=chunk-
|
|
469
|
+
//# sourceMappingURL=chunk-57P45FNY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/desktop-launcher.ts"],"sourcesContent":["/**\n * Cross-platform desktop launcher (`runeya install-desktop`).\n *\n * Deliberately an explicit sub-command rather than a postinstall hook: npm 12\n * blocks lifecycle scripts by default, so a launcher created that way would be\n * silently missing. Here the user asks for it, and gets the paths back.\n *\n * Nothing is embedded — the launcher points at the Node binary and the CLI\n * entry point currently in use. If the user switches Node version manager,\n * re-running the command re-pins the paths.\n */\nimport { mkdir, writeFile, rm, copyFile, access, readdir, readFile } from 'node:fs/promises';\nimport { execFile } from 'node:child_process';\nimport { promisify } from 'node:util';\nimport { homedir } from 'node:os';\nimport { join, dirname } from 'node:path';\n\nimport {\n slugifyLauncherName,\n launcherIdFromName,\n deriveLauncherIdentity,\n isLauncherProjectId,\n} from '@runeya/packages-shared';\n\nconst exec = promisify(execFile);\n\n/**\n * Le nommage d'un lanceur vit dans `packages/shared` : le serveur en a besoin\n * pour proposer le même nom depuis l'interface. Réexporté ici sous les noms\n * locaux, qui sont ceux que le reste du CLI appelle.\n */\nexport {\n slugifyLauncherName as slugify,\n launcherIdFromName as idFromName,\n deriveLauncherIdentity as deriveIdentity,\n};\n\nexport type InstallOptions = {\n /** Absolute path to the Node binary the launcher must use. */\n nodePath: string;\n /** Absolute path to the CLI entry point (dist/index.js). */\n cliEntry: string;\n /** Directory holding the CLI dist — used to find the bundled icons in assets/. */\n distDir: string;\n /** Working directory to pin, or null to let the desktop decide. */\n workingDir: string | null;\n /** Display name, e.g. \"Runeya\" or \"Runeya — my-stack\". */\n name: string;\n /** Filesystem-safe id derived from the name, e.g. \"runeya-my-stack\". */\n id: string;\n /** Port baked into the launcher, or null to follow Runeya's default. */\n port: number | null;\n /** Agent port, or null to let Runeya derive it from `port + 1`. */\n agentPort: number | null;\n /** Project the launcher opens directly (`--project`), or null for the project list. */\n projectId?: string | null;\n};\n\n/**\n * Arguments the launcher passes to the CLI.\n *\n * `--agent-port` is omitted when it is exactly what Runeya would derive on its\n * own, so the command line stays readable and keeps following the derivation\n * if it ever changes.\n */\nexport function launcherArgs(opts: Pick<InstallOptions, 'port' | 'agentPort' | 'projectId'>): string[] {\n const args = ['--from-desktop'];\n if (opts.port !== null) args.push('--port', String(opts.port));\n if (opts.agentPort !== null && opts.agentPort !== (opts.port ?? 4000) + 1) {\n args.push('--agent-port', String(opts.agentPort));\n }\n if (opts.projectId) {\n // Dernier rempart : l'id finit dans un fichier exécutable.\n if (!isLauncherProjectId(opts.projectId)) throw new Error(`Id de projet invalide : ${JSON.stringify(opts.projectId)}`);\n args.push('--project', opts.projectId);\n }\n return args;\n}\n\nexport type LauncherResult = {\n /** Files created or removed, for reporting back to the user. */\n paths: string[];\n /** Non-fatal problems (missing icon, desktop database refresh failed…). */\n warnings: string[];\n};\n\n/**\n * Le dossier de travail d'un lanceur, avec un repli qui n'est jamais la racine.\n *\n * Sans dossier épinglé, un lanceur hérite du cwd du système — `/` pour le\n * Finder comme pour systemd — et Runeya y placerait son `.runeya`. La racine\n * est en lecture seule sous macOS et interdite d'écriture sous Linux : le home\n * est le seul repli toujours disponible. Le CLI applique la même garde à\n * l'exécution, pour les lanceurs posés avant ce correctif.\n */\nexport function launcherWorkingDir(workingDir: string | null): string {\n return workingDir ?? homedir();\n}\n\nasync function exists(path: string): Promise<boolean> {\n try {\n await access(path);\n return true;\n } catch {\n return false;\n }\n}\n\n/** Best-effort command: never fails the install, just reports a warning. */\nasync function tryExec(file: string, args: string[], warnings: string[]): Promise<void> {\n try {\n await exec(file, args);\n } catch {\n warnings.push(`Commande optionnelle échouée : ${file} (le lanceur est créé, le menu peut mettre un instant à l'afficher)`);\n }\n}\n\n// ─── Linux ───────────────────────────────────────────────────────────────────\n\n/**\n * Quote a value for the `Exec=` key of a .desktop file.\n * Per the Desktop Entry spec, inside a quoted argument the characters\n * `\"`, backtick, `$` and `\\` must each be preceded by a backslash.\n */\nexport function desktopExecQuote(value: string): string {\n return `\"${value.replace(/[\"`$\\\\]/g, (c) => `\\\\${c}`)}\"`;\n}\n\n/** Escape a value for a non-Exec .desktop key (only backslashes are special). */\nfunction desktopValue(value: string): string {\n return value.replace(/\\\\/g, '\\\\\\\\').replace(/\\n/g, ' ');\n}\n\nfunction xdgDataHome(): string {\n return process.env['XDG_DATA_HOME'] || join(homedir(), '.local/share');\n}\n\nfunction linuxPaths(id: string) {\n const dataHome = xdgDataHome();\n const appsDir = join(dataHome, 'applications');\n return {\n appsDir,\n entry: join(appsDir, `${id}.desktop`),\n iconDir: join(dataHome, 'icons/hicolor/scalable/apps'),\n icon: join(dataHome, `icons/hicolor/scalable/apps/${id}.svg`),\n };\n}\n\nasync function installLinux(opts: InstallOptions): Promise<LauncherResult> {\n const paths: string[] = [];\n const warnings: string[] = [];\n const p = linuxPaths(opts.id);\n\n // The icon is an SVG, which the scalable hicolor directory takes as-is.\n const sourceIcon = join(opts.distDir, 'assets/icon.svg');\n let iconName = 'application-x-executable';\n if (await exists(sourceIcon)) {\n await mkdir(p.iconDir, { recursive: true });\n await copyFile(sourceIcon, p.icon);\n paths.push(p.icon);\n iconName = opts.id;\n } else {\n warnings.push(`Icône introuvable (${sourceIcon}), icône générique utilisée`);\n }\n\n // --from-desktop: nobody is watching a terminal, so startup failures must be\n // reported in a browser window rather than written to a discarded stderr.\n const exec_ = [opts.nodePath, opts.cliEntry, ...launcherArgs(opts)]\n .map(desktopExecQuote)\n .join(' ');\n const lines = [\n '[Desktop Entry]',\n 'Type=Application',\n `Name=${desktopValue(opts.name)}`,\n 'Comment=Process and service manager',\n `Exec=${exec_}`,\n `Icon=${iconName}`,\n 'Terminal=false',\n 'Categories=Development;',\n 'StartupNotify=true',\n // Marker used by uninstall-desktop to refuse deleting a hand-written entry\n 'X-Runeya-Managed=true',\n ];\n lines.push(`Path=${desktopValue(launcherWorkingDir(opts.workingDir))}`);\n\n await mkdir(p.appsDir, { recursive: true });\n await writeFile(p.entry, lines.join('\\n') + '\\n', { mode: 0o755 });\n paths.push(p.entry);\n\n await tryExec('update-desktop-database', [p.appsDir], warnings);\n\n return { paths, warnings };\n}\n\nasync function uninstallLinux(id: string): Promise<LauncherResult> {\n const paths: string[] = [];\n const warnings: string[] = [];\n const p = linuxPaths(id);\n for (const target of [p.entry, p.icon]) {\n if (await exists(target)) {\n await rm(target, { force: true });\n paths.push(target);\n }\n }\n if (paths.length) await tryExec('update-desktop-database', [p.appsDir], warnings);\n return { paths, warnings };\n}\n\n// ─── macOS ───────────────────────────────────────────────────────────────────\n\n/** Escape a value destined for a <string> node of an Info.plist. */\nfunction plistString(value: string): string {\n return value\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>');\n}\n\n/** Single-quote a value for the POSIX shell inside the .app stub script. */\nfunction shQuote(value: string): string {\n return `'${value.replace(/'/g, `'\\\\''`)}'`;\n}\n\nfunction macAppPath(name: string): string {\n return join(homedir(), 'Applications', `${name}.app`);\n}\n\nasync function installMac(opts: InstallOptions): Promise<LauncherResult> {\n const warnings: string[] = [];\n const appPath = macAppPath(opts.name);\n const macosDir = join(appPath, 'Contents/MacOS');\n const resourcesDir = join(appPath, 'Contents/Resources');\n const execName = opts.id;\n\n await mkdir(macosDir, { recursive: true });\n await mkdir(resourcesDir, { recursive: true });\n\n // The bundle executable is a shell stub: no compiled code, no signing needed.\n // A locally generated .app carries no quarantine attribute, so Gatekeeper\n // lets it run even unsigned.\n const stub = [\n '#!/bin/sh',\n '# Generated by `runeya install-desktop` — safe to delete.',\n `cd ${shQuote(launcherWorkingDir(opts.workingDir))} || exit 1`,\n `exec ${[opts.nodePath, opts.cliEntry, ...launcherArgs(opts)].map(shQuote).join(' ')} \"$@\"`,\n '',\n ].filter(Boolean).join('\\n');\n await writeFile(join(macosDir, execName), stub, { mode: 0o755 });\n\n // CFBundleIconFile is only emitted when the .icns actually made it into the\n // bundle — a key pointing at a missing file makes Finder fall back silently,\n // which is harder to diagnose than no key at all.\n const sourceIcns = join(opts.distDir, 'assets/icon.icns');\n let iconKey = '';\n if (await exists(sourceIcns)) {\n await copyFile(sourceIcns, join(resourcesDir, `${execName}.icns`));\n iconKey = `\\n <key>CFBundleIconFile</key><string>${plistString(execName)}</string>`;\n } else {\n warnings.push(`Icône introuvable (${sourceIcns}), icône générique utilisée`);\n }\n\n const plist = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n <key>CFBundleName</key><string>${plistString(opts.name)}</string>\n <key>CFBundleDisplayName</key><string>${plistString(opts.name)}</string>\n <key>CFBundleExecutable</key><string>${plistString(execName)}</string>\n <key>CFBundleIdentifier</key><string>dev.runeya.launcher.${plistString(opts.id)}</string>\n <key>CFBundlePackageType</key><string>APPL</string>${iconKey}\n <key>CFBundleInfoDictionaryVersion</key><string>6.0</string>\n <key>CFBundleShortVersionString</key><string>1.0</string>\n <key>NSHighResolutionCapable</key><true/>\n</dict>\n</plist>\n`;\n await writeFile(join(appPath, 'Contents/Info.plist'), plist);\n\n // Ask LaunchServices to notice the new bundle so Spotlight finds it right away.\n await tryExec(\n '/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister',\n ['-f', appPath],\n warnings,\n );\n\n return { paths: [appPath], warnings };\n}\n\nasync function uninstallMac(name: string): Promise<LauncherResult> {\n const appPath = macAppPath(name);\n if (!(await exists(appPath))) return { paths: [], warnings: [] };\n await rm(appPath, { recursive: true, force: true });\n return { paths: [appPath], warnings: [] };\n}\n\n// ─── Windows ─────────────────────────────────────────────────────────────────\n\n/** Single-quote a value for a PowerShell literal string. */\nexport function psQuote(value: string): string {\n return `'${value.replace(/'/g, \"''\")}'`;\n}\n\nfunction windowsLnkPath(name: string): string {\n const appData = process.env['APPDATA'] || join(homedir(), 'AppData/Roaming');\n return join(appData, 'Microsoft/Windows/Start Menu/Programs', `${name}.lnk`);\n}\n\n/**\n * Où vit le script qui lance Runeya sans console.\n *\n * Hors du dossier du menu Démarrer — un `.vbs` posé là apparaîtrait dans la\n * recherche Windows à côté du raccourci — et hors du `dist` du paquet, qu'une\n * réinstallation npm remplace : le script y disparaîtrait sans que rien ne le\n * recrée, faute de postinstall (npm 12 les bloque).\n */\nfunction windowsVbsPath(id: string): string {\n const localAppData = process.env['LOCALAPPDATA'] || join(homedir(), 'AppData/Local');\n return join(localAppData, 'Runeya', `${id}.vbs`);\n}\n\n/** Double-quote a value for a VBScript string literal. */\nexport function vbsQuote(value: string): string {\n return `\"${value.replace(/\"/g, '\"\"')}\"`;\n}\n\n/**\n * Le script qui lance Runeya **sans fenêtre**.\n *\n * `node.exe` est une application console : Windows lui alloue une console, et\n * un raccourci ne sait que la réduire (`WindowStyle = 7`) — d'où une fenêtre de\n * commande dans la barre des tâches pendant tout l'usage de l'application.\n *\n * `wscript.exe`, lui, est une application graphique : il n'ouvre aucune console\n * et lance sa cible en `SW_HIDE` (le `0` de `Run`). La console de Node existe\n * donc toujours — c'est ce qui compte : **elle est seulement cachée, pas\n * absente**, et tout ce que Runeya lance ensuite (l'agent, git, docker, les\n * services) l'hérite sans rien afficher. C'est la même intention que le\n * `windowsHide` des runners, posée une fois pour toute la descendance.\n *\n * Le `False` rend la main immédiatement : `wscript` sort, Runeya reste.\n */\nexport function windowsVbsScript(\n opts: Pick<InstallOptions, 'nodePath' | 'cliEntry' | 'port' | 'agentPort' | 'projectId'> & { workingDir: string | null },\n): string {\n const command = [opts.nodePath, opts.cliEntry, ...launcherArgs(opts)]\n .map((part) => `\"${part}\"`)\n .join(' ');\n return [\n // Commentaires en ASCII : wscript lit un .vbs sans BOM comme de l'ANSI, et\n // des accents s'y afficheraient de travers à qui l'ouvre.\n \"' Runeya launcher - created by 'runeya install-desktop', do not edit.\",\n \"' wscript.exe opens no console; the 0 below starts Runeya hidden.\",\n 'Set sh = CreateObject(\"WScript.Shell\")',\n `sh.CurrentDirectory = ${vbsQuote(launcherWorkingDir(opts.workingDir))}`,\n `sh.Run ${vbsQuote(command)}, 0, False`,\n '',\n ].join('\\n');\n}\n\nasync function runPowerShell(script: string, warnings: string[]): Promise<void> {\n // -EncodedCommand avoids every layer of cmd.exe quoting.\n const encoded = Buffer.from(script, 'utf16le').toString('base64');\n try {\n await exec('powershell.exe', ['-NoProfile', '-NonInteractive', '-EncodedCommand', encoded]);\n } catch (err) {\n warnings.push(`PowerShell a échoué : ${(err as Error).message}`);\n throw err;\n }\n}\n\nasync function installWindows(opts: InstallOptions): Promise<LauncherResult> {\n const warnings: string[] = [];\n const lnk = windowsLnkPath(opts.name);\n\n // The .ico is referenced in place inside the installed dist rather than\n // copied: the shortcut already breaks if that dist moves, so a second copy\n // would only add a file to leave behind.\n const icoPath = join(opts.distDir, 'assets/icon.ico');\n const iconPath = (await exists(icoPath)) ? icoPath : null;\n if (!iconPath) warnings.push(`Icône introuvable (${icoPath}), icône de Node utilisée`);\n\n // Le raccourci ne lance pas Node : il lance `wscript.exe`, qui lance Node\n // sans console. Un raccourci pointant sur `node.exe` laissait une fenêtre de\n // commande dans la barre des tâches, `WindowStyle` ne sachant que la réduire.\n const vbs = windowsVbsPath(opts.id);\n await mkdir(dirname(vbs), { recursive: true });\n await writeFile(vbs, windowsVbsScript(opts), 'utf8');\n\n const wscript = join(process.env['SystemRoot'] || 'C:\\\\Windows', 'System32', 'wscript.exe');\n\n const script = [\n `$ws = New-Object -ComObject WScript.Shell`,\n `$sc = $ws.CreateShortcut(${psQuote(lnk)})`,\n `$sc.TargetPath = ${psQuote(wscript)}`,\n `$sc.Arguments = ${psQuote(`\"${vbs}\"`)}`,\n `$sc.WorkingDirectory = ${psQuote(launcherWorkingDir(opts.workingDir))}`,\n `$sc.Description = 'Runeya — process and service manager'`,\n // L'icône reste celle de Runeya : elle est déclarée à part de la cible.\n iconPath ? `$sc.IconLocation = ${psQuote(iconPath)}` : '',\n `$sc.Save()`,\n ].filter(Boolean).join('\\n');\n\n await mkdir(dirname(lnk), { recursive: true });\n await runPowerShell(script, warnings);\n\n return { paths: [lnk, vbs], warnings };\n}\n\nasync function uninstallWindows(name: string, id: string): Promise<LauncherResult> {\n // Les deux fichiers, et chacun pour lui-même : un raccourci posé avant que le\n // lanceur ne passe par `wscript` n'a pas de `.vbs` à côté de lui, et son\n // absence n'est pas une raison de laisser le raccourci en place.\n const removed: string[] = [];\n for (const path of [windowsLnkPath(name), windowsVbsPath(id)]) {\n if (!(await exists(path))) continue;\n await rm(path, { force: true });\n removed.push(path);\n }\n return { paths: removed, warnings: [] };\n}\n\n// ─── Reading back the launchers already installed ────────────────────────────\n\n/**\n * Un raccourci déjà posé, tel qu'on le relit sur le disque.\n *\n * Les fichiers écrits par `install-desktop` sont la seule source : pas de\n * registre à côté, qui dériverait dès qu'un raccourci est supprimé à la main.\n */\nexport type InstalledLauncher = {\n id: string;\n name: string;\n /** `null` : raccourci global (il démarre dans le dossier personnel). */\n workingDir: string | null;\n port: number | null;\n agentPort: number | null;\n /** Projet ouvert directement (`--project`), ou null. */\n projectId: string | null;\n nodePath: string;\n cliEntry: string;\n /** Les fichiers qui le composent — ceux qu'une suppression retirerait. */\n paths: string[];\n};\n\n/**\n * Les réglages d'un raccourci, relus dans la ligne de commande qu'il lance :\n * `node cli --from-desktop [--port N] [--agent-port M] [--project ID]`.\n *\n * `--agent-port` absent veut dire « port + 1 », comme le dérive Runeya — c'est\n * pour cela que `launcherArgs` l'omet.\n */\nexport function parseLauncherCommand(\n tokens: string[],\n): Pick<InstalledLauncher, 'nodePath' | 'cliEntry' | 'port' | 'agentPort' | 'projectId'> | null {\n const [nodePath, cliEntry, ...args] = tokens;\n if (!nodePath || !cliEntry) return null;\n const flag = (name: string): number | null => {\n const i = args.indexOf(name);\n if (i === -1) return null;\n const value = Number(args[i + 1]);\n return Number.isInteger(value) && value >= 1 && value <= 65_535 ? value : null;\n };\n const port = flag('--port');\n const agentPort = flag('--agent-port') ?? (port === null ? null : port + 1);\n // Un id illisible est ignoré plutôt que recopié dans un raccourci recréé.\n const projectIndex = args.indexOf('--project');\n const rawProject = projectIndex === -1 ? undefined : args[projectIndex + 1];\n const projectId = rawProject !== undefined && isLauncherProjectId(rawProject) ? rawProject : null;\n return { nodePath, cliEntry, port, agentPort, projectId };\n}\n\n/** Le dossier d'un raccourci, rendu à `null` quand il est le repli global. */\nfunction pinnedDir(dir: string): string | null {\n return dir === homedir() ? null : dir;\n}\n\n/**\n * Découper la clé `Exec=` d'un `.desktop` — l'inverse de `desktopExecQuote` :\n * arguments séparés par des espaces, entre guillemets doubles, où `\\x` vaut `x`.\n */\nexport function splitDesktopExec(exec: string): string[] {\n const tokens: string[] = [];\n let current = '';\n let quoted = false;\n let started = false;\n for (let i = 0; i < exec.length; i++) {\n const ch = exec[i]!;\n if (quoted && ch === '\\\\' && i + 1 < exec.length) { current += exec[++i]; continue; }\n if (ch === '\"') { quoted = !quoted; started = true; continue; }\n if (!quoted && ch === ' ') {\n if (started) tokens.push(current);\n current = ''; started = false;\n continue;\n }\n current += ch; started = true;\n }\n if (started) tokens.push(current);\n return tokens;\n}\n\n/** Relire un `.desktop` écrit par `installLinux`. `null` si ce n'en est pas un. */\nexport function parseDesktopEntry(id: string, text: string, path: string): InstalledLauncher | null {\n const keys = new Map<string, string>();\n for (const line of text.split('\\n')) {\n const eq = line.indexOf('=');\n if (eq > 0 && !keys.has(line.slice(0, eq))) keys.set(line.slice(0, eq), line.slice(eq + 1));\n }\n if (keys.get('X-Runeya-Managed') !== 'true') return null;\n const command = parseLauncherCommand(splitDesktopExec(keys.get('Exec') ?? ''));\n if (!command) return null;\n const unescape = (v: string) => v.replace(/\\\\\\\\/g, '\\\\');\n return {\n id,\n name: unescape(keys.get('Name') ?? id),\n workingDir: keys.has('Path') ? pinnedDir(unescape(keys.get('Path')!)) : null,\n ...command,\n paths: [path, linuxPaths(id).icon],\n };\n}\n\nasync function listLinux(): Promise<InstalledLauncher[]> {\n const { appsDir } = linuxPaths('');\n const found: InstalledLauncher[] = [];\n for (const file of await readdir(appsDir).catch(() => [] as string[])) {\n if (!file.endsWith('.desktop')) continue;\n const path = join(appsDir, file);\n const text = await readFile(path, 'utf8').catch(() => '');\n const launcher = parseDesktopEntry(file.slice(0, -'.desktop'.length), text, path);\n if (!launcher) continue;\n // L'icône n'est listée que si elle est là : c'est ce qu'on retirerait.\n if (!(await exists(launcher.paths[1]!))) launcher.paths.length = 1;\n found.push(launcher);\n }\n return found;\n}\n\n/** Découper une ligne shell faite d'arguments passés par `shQuote`. */\nfunction splitShQuoted(line: string): string[] {\n const tokens: string[] = [];\n for (const match of line.matchAll(/'((?:[^']|'\\\\'')*)'/g)) {\n tokens.push(match[1]!.replace(/'\\\\''/g, \"'\"));\n }\n return tokens;\n}\n\n/** Relire un `.app` écrit par `installMac` à partir de son plist et de son script. */\nexport function parseMacApp(plist: string, stub: string, path: string): InstalledLauncher | null {\n const key = (name: string): string | null => {\n const m = plist.match(new RegExp(`<key>${name}</key>\\\\s*<string>([^<]*)</string>`));\n return m ? m[1]!.replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&') : null;\n };\n const identifier = key('CFBundleIdentifier');\n const prefix = 'dev.runeya.launcher.';\n if (!identifier?.startsWith(prefix)) return null;\n\n const lines = stub.split('\\n');\n const cd = lines.find((l) => l.startsWith('cd '));\n const execLine = lines.find((l) => l.startsWith('exec '));\n const command = execLine ? parseLauncherCommand(splitShQuoted(execLine)) : null;\n if (!command) return null;\n const dir = cd ? splitShQuoted(cd)[0] : undefined;\n return {\n id: identifier.slice(prefix.length),\n name: key('CFBundleName') ?? identifier.slice(prefix.length),\n workingDir: dir ? pinnedDir(dir) : null,\n ...command,\n paths: [path],\n };\n}\n\nasync function listMac(): Promise<InstalledLauncher[]> {\n const dir = join(homedir(), 'Applications');\n const found: InstalledLauncher[] = [];\n for (const entry of await readdir(dir).catch(() => [] as string[])) {\n if (!entry.endsWith('.app')) continue;\n const path = join(dir, entry);\n const plist = await readFile(join(path, 'Contents/Info.plist'), 'utf8').catch(() => '');\n const exe = plist.match(/<key>CFBundleExecutable<\\/key>\\s*<string>([^<]*)<\\/string>/)?.[1];\n if (!exe) continue;\n const stub = await readFile(join(path, 'Contents/MacOS', exe), 'utf8').catch(() => '');\n const launcher = parseMacApp(plist, stub, path);\n if (launcher) found.push(launcher);\n }\n return found;\n}\n\n/** Relire un `.vbs` écrit par `windowsVbsScript` : l'inverse de ses `vbsQuote`. */\nexport function parseVbs(id: string, text: string): Omit<InstalledLauncher, 'name' | 'paths'> | null {\n const literal = (prefix: string): string | null => {\n const line = text.split(/\\r?\\n/).find((l) => l.startsWith(prefix));\n const m = line?.slice(prefix.length).match(/^\"((?:[^\"]|\"\")*)\"/);\n return m ? m[1]!.replace(/\"\"/g, '\"') : null;\n };\n const dir = literal('sh.CurrentDirectory = ');\n const run = literal('sh.Run ');\n if (dir === null || run === null) return null;\n const tokens = [...run.matchAll(/\"([^\"]*)\"/g)].map((m) => m[1]!);\n const command = parseLauncherCommand(tokens);\n return command ? { id, workingDir: pinnedDir(dir), ...command } : null;\n}\n\nasync function listWindows(): Promise<InstalledLauncher[]> {\n const vbsDir = dirname(windowsVbsPath('x'));\n const lnkDir = dirname(windowsLnkPath('x'));\n // Le `.vbs` porte l'id, le raccourci du menu Démarrer le nom affiché. L'id\n // étant une fonction pure du nom, c'est lui qui les apparie — sans avoir à\n // demander à PowerShell ce que vise chaque raccourci.\n const lnkById = new Map<string, string>();\n for (const file of await readdir(lnkDir).catch(() => [] as string[])) {\n if (file.toLowerCase().endsWith('.lnk')) lnkById.set(launcherIdFromName(file.slice(0, -4)), file.slice(0, -4));\n }\n const found: InstalledLauncher[] = [];\n for (const file of await readdir(vbsDir).catch(() => [] as string[])) {\n if (!file.toLowerCase().endsWith('.vbs')) continue;\n const id = file.slice(0, -4);\n const parsed = parseVbs(id, await readFile(join(vbsDir, file), 'utf8').catch(() => ''));\n if (!parsed) continue;\n const name = lnkById.get(id);\n found.push({\n ...parsed,\n // Sans raccourci dans le menu, il ne reste que l'id pour le nommer.\n name: name ?? id,\n paths: [...(name ? [windowsLnkPath(name)] : []), join(vbsDir, file)],\n });\n }\n return found;\n}\n\n/** Ce qui empêcherait un raccourci de démarrer, en mots d'utilisateur. */\nexport async function launcherProblems(launcher: InstalledLauncher): Promise<string[]> {\n const problems: string[] = [];\n if (!(await exists(launcher.nodePath))) problems.push(`Node introuvable : ${launcher.nodePath}`);\n if (!(await exists(launcher.cliEntry))) problems.push(`Runeya introuvable : ${launcher.cliEntry}`);\n if (launcher.workingDir && !(await exists(launcher.workingDir))) problems.push(`Dossier introuvable : ${launcher.workingDir}`);\n return problems;\n}\n\n// ─── Entry points ────────────────────────────────────────────────────────────\n\nexport async function installDesktopLauncher(opts: InstallOptions): Promise<LauncherResult> {\n switch (process.platform) {\n case 'linux':\n case 'freebsd':\n case 'openbsd':\n return installLinux(opts);\n case 'darwin':\n return installMac(opts);\n case 'win32':\n return installWindows(opts);\n default:\n throw new Error(`Plateforme non supportée : ${process.platform}`);\n }\n}\n\nexport async function uninstallDesktopLauncher(name: string, id: string): Promise<LauncherResult> {\n switch (process.platform) {\n case 'linux':\n case 'freebsd':\n case 'openbsd':\n return uninstallLinux(id);\n case 'darwin':\n return uninstallMac(name);\n case 'win32':\n return uninstallWindows(name, id);\n default:\n throw new Error(`Plateforme non supportée : ${process.platform}`);\n }\n}\n\n/** Les raccourcis que `install-desktop` a posés sur cette machine. */\nexport async function listDesktopLaunchers(): Promise<InstalledLauncher[]> {\n switch (process.platform) {\n case 'linux':\n case 'freebsd':\n case 'openbsd':\n return listLinux();\n case 'darwin':\n return listMac();\n case 'win32':\n return listWindows();\n default:\n return [];\n }\n}\n"],"mappings":";;;;;;AAWA,SAAS,OAAO,WAAW,IAAI,UAAU,QAAQ,SAAS,gBAAgB;AAC1E,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,MAAM,eAAe;AAS9B,IAAM,OAAO,UAAU,QAAQ;AAyCxB,SAAS,aAAa,MAA0E;AACrG,QAAM,OAAO,CAAC,gBAAgB;AAC9B,MAAI,KAAK,SAAS,KAAM,MAAK,KAAK,UAAU,OAAO,KAAK,IAAI,CAAC;AAC7D,MAAI,KAAK,cAAc,QAAQ,KAAK,eAAe,KAAK,QAAQ,OAAQ,GAAG;AACzE,SAAK,KAAK,gBAAgB,OAAO,KAAK,SAAS,CAAC;AAAA,EAClD;AACA,MAAI,KAAK,WAAW;AAElB,QAAI,CAAC,oBAAoB,KAAK,SAAS,EAAG,OAAM,IAAI,MAAM,2BAA2B,KAAK,UAAU,KAAK,SAAS,CAAC,EAAE;AACrH,SAAK,KAAK,aAAa,KAAK,SAAS;AAAA,EACvC;AACA,SAAO;AACT;AAkBO,SAAS,mBAAmB,YAAmC;AACpE,SAAO,cAAc,QAAQ;AAC/B;AAEA,eAAe,OAAO,MAAgC;AACpD,MAAI;AACF,UAAM,OAAO,IAAI;AACjB,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGA,eAAe,QAAQ,MAAc,MAAgB,UAAmC;AACtF,MAAI;AACF,UAAM,KAAK,MAAM,IAAI;AAAA,EACvB,QAAQ;AACN,aAAS,KAAK,wCAAkC,IAAI,8EAAqE;AAAA,EAC3H;AACF;AASO,SAAS,iBAAiB,OAAuB;AACtD,SAAO,IAAI,MAAM,QAAQ,YAAY,CAAC,MAAM,KAAK,C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,EAAE;AACjG,MAAI,SAAS,cAAc,CAAE,MAAM,OAAO,SAAS,UAAU,EAAI,UAAS,KAAK,yBAAyB,SAAS,UAAU,EAAE;AAC7H,SAAO;AACT;AAIA,eAAsB,uBAAuB,MAA+C;AAC1F,UAAQ,QAAQ,UAAU;AAAA,IACxB,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO,aAAa,IAAI;AAAA,IAC1B,KAAK;AACH,aAAO,WAAW,IAAI;AAAA,IACxB,KAAK;AACH,aAAO,eAAe,IAAI;AAAA,IAC5B;AACE,YAAM,IAAI,MAAM,iCAA8B,QAAQ,QAAQ,EAAE;AAAA,EACpE;AACF;AAEA,eAAsB,yBAAyB,MAAc,IAAqC;AAChG,UAAQ,QAAQ,UAAU;AAAA,IACxB,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO,eAAe,EAAE;AAAA,IAC1B,KAAK;AACH,aAAO,aAAa,IAAI;AAAA,IAC1B,KAAK;AACH,aAAO,iBAAiB,MAAM,EAAE;AAAA,IAClC;AACE,YAAM,IAAI,MAAM,iCAA8B,QAAQ,QAAQ,EAAE;AAAA,EACpE;AACF;AAGA,eAAsB,uBAAqD;AACzE,UAAQ,QAAQ,UAAU;AAAA,IACxB,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO,UAAU;AAAA,IACnB,KAAK;AACH,aAAO,QAAQ;AAAA,IACjB,KAAK;AACH,aAAO,YAAY;AAAA,IACrB;AACE,aAAO,CAAC;AAAA,EACZ;AACF;","names":["exec"]}
|
|
@@ -3,19 +3,19 @@ import {
|
|
|
3
3
|
hasChangedSinceRead,
|
|
4
4
|
rememberFile,
|
|
5
5
|
wasRead
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
SchemaVersionSchema,
|
|
9
|
-
SettingsPrivateSchema,
|
|
10
|
-
SettingsSchema
|
|
11
|
-
} from "./chunk-XAFOP677.js";
|
|
6
|
+
} from "./chunk-NCO4OOYT.js";
|
|
12
7
|
import {
|
|
13
8
|
env,
|
|
14
9
|
legacyMachineFilePath,
|
|
15
10
|
machineFilePath,
|
|
16
11
|
machineRoot,
|
|
17
12
|
orgVaultRoot
|
|
18
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-KS7A5CTW.js";
|
|
14
|
+
import {
|
|
15
|
+
SchemaVersionSchema,
|
|
16
|
+
SettingsPrivateSchema,
|
|
17
|
+
SettingsSchema
|
|
18
|
+
} from "./chunk-MZSDTA4A.js";
|
|
19
19
|
|
|
20
20
|
// ../server/src/services/settings-manager.ts
|
|
21
21
|
import { readFile } from "fs/promises";
|
|
@@ -171,4 +171,4 @@ var settingsManager = new SettingsManager();
|
|
|
171
171
|
export {
|
|
172
172
|
settingsManager
|
|
173
173
|
};
|
|
174
|
-
//# sourceMappingURL=chunk-
|
|
174
|
+
//# sourceMappingURL=chunk-FE53XX4M.js.map
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LAUNCHER_PROJECT_ID_PATTERN
|
|
3
|
+
} from "./chunk-MZSDTA4A.js";
|
|
4
|
+
|
|
1
5
|
// ../server/src/services/vault-resolver.ts
|
|
2
6
|
import { join, sep, resolve } from "path";
|
|
3
7
|
import { homedir } from "os";
|
|
@@ -31,6 +35,12 @@ var EnvSchema = z.object({
|
|
|
31
35
|
// terminal. The web app surfaces it so the user knows which Runeya they are
|
|
32
36
|
// looking at when several are running.
|
|
33
37
|
RUNEYA_FROM_DESKTOP: z.preprocess((v) => v === "true" || v === "1", z.boolean()).default(false),
|
|
38
|
+
// `--project <id>` : l'instance n'ouvre que ce projet. L'interface va droit
|
|
39
|
+
// au choix des services et ne propose ni la liste ni le changement de projet.
|
|
40
|
+
RUNEYA_PROJECT_ID: z.preprocess(
|
|
41
|
+
(v) => typeof v === "string" && v.trim().length > 0 ? v.trim() : void 0,
|
|
42
|
+
z.string().regex(LAUNCHER_PROJECT_ID_PATTERN, "RUNEYA_PROJECT_ID: expected a project id").nullable().default(null)
|
|
43
|
+
),
|
|
34
44
|
// Label shown for this machine in the cloud's "linked machines" screen.
|
|
35
45
|
// Defaults to the hostname (see `getDeviceName`); set it explicitly when a
|
|
36
46
|
// single host runs several instances and you want to tell them apart.
|
|
@@ -66,6 +76,7 @@ var EnvSchema = z.object({
|
|
|
66
76
|
AGENT_BINARY_PATH: data.RUNEYA_AGENT_BINARY_PATH,
|
|
67
77
|
DEVICE_NAME: data.RUNEYA_DEVICE_NAME,
|
|
68
78
|
FROM_DESKTOP: data.RUNEYA_FROM_DESKTOP,
|
|
79
|
+
PROJECT_ID: data.RUNEYA_PROJECT_ID,
|
|
69
80
|
JWT_TTL: data.RUNEYA_JWT_TTL
|
|
70
81
|
}));
|
|
71
82
|
var env = EnvSchema.parse(process.env);
|
|
@@ -414,4 +425,4 @@ export {
|
|
|
414
425
|
legacyVaultRoot,
|
|
415
426
|
resetKeyRoot
|
|
416
427
|
};
|
|
417
|
-
//# sourceMappingURL=chunk-
|
|
428
|
+
//# sourceMappingURL=chunk-KS7A5CTW.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../server/src/services/vault-resolver.ts","../../server/src/config/env.ts"],"sourcesContent":["import { join, sep, resolve } from 'node:path';\nimport { homedir } from 'node:os';\nimport { readdir, mkdir, access, readFile, writeFile, unlink, rename } from 'node:fs/promises';\nimport { existsSync } from 'node:fs';\nimport { env } from '../config/env.js';\n\n/**\n * Where a project's files live, and which key protects them.\n *\n * Runeya holds two kinds of projects, and they do not belong in the same place.\n * A local project *is* a directory on this machine: its data belongs next to\n * the code, in `<cwd>/.runeya`. A cloud project belongs to an organization and\n * is materialized from the doc; tying it to whichever directory happened to\n * launch the server is what made the same project look \"already here\" in one\n * folder and \"to download\" in another. Cloud projects therefore live under the\n * user's home, prefixed by organization and by project.\n *\n * A vault holds a project's own data — project.json, services, environments.\n * It does NOT hold the key that protects it: one key answers for the whole\n * machine (see `keyRoot` at the bottom of this file), which is what the cloud's\n * org-wide canary already assumes.\n */\n\nexport interface Vault {\n /** Directory holding this project's own files. */\n root: string;\n}\n\n/** Identifies a project well enough to place it — the stored shape, or the doc's. */\nexport interface VaultTarget {\n id: string;\n orgId?: string | null;\n}\n\n/**\n * Ids reach us from the cloud, and they end up in filesystem paths. Anything\n * outside this alphabet — a separator, a `..`, a NUL — could walk out of the\n * home directory, so it is rejected rather than sanitized: a mangled id would\n * silently point at the wrong vault.\n */\nconst SAFE_ID = /^[A-Za-z0-9._-]{1,128}$/;\n\nfunction assertSafeId(kind: 'organization' | 'project', id: string): void {\n if (!SAFE_ID.test(id) || id === '.' || id === '..') {\n throw new Error(`Invalid ${kind} id for a vault path: ${JSON.stringify(id)}`);\n }\n}\n\n/**\n * Everything that belongs to this machine rather than to a project.\n *\n * Read from `process.env` rather than the parsed config: tests that mock\n * `config/env.js` would otherwise lose the override and write cloud vaults into\n * the developer's real home directory.\n */\nexport function machineRoot(): string {\n const override = process.env['RUNEYA_HOME'];\n return join(override && override.length > 0 ? override : homedir(), '.runeya');\n}\n\n/**\n * The local vault: the `.runeya` of the directory the server was launched in.\n *\n * Kept on `env.DATA_DIR` so `--data-dir` and the tests keep working. That value\n * is already absolute, resolved once at boot — re-resolving it here would make\n * the vault follow the process's cwd, which is exactly what it must not do.\n */\nexport function localVaultRoot(): string {\n return env.DATA_DIR;\n}\n\n/**\n * Le coffre local se confond-il avec la racine machine, ou se range-t-il dedans ?\n *\n * Runeya lancée depuis le dossier qui abrite son propre `.runeya` — le home,\n * typiquement — y verrait son coffre local : les fichiers d'un projet local\n * iraient alors se mêler aux coffres d'organisation, aux passphrases d'agent et\n * au reste de ce qui appartient à la machine, dans un seul répertoire. Deux\n * natures de données que tout sépare partageraient leur rangement, et supprimer\n * l'une emporterait l'autre.\n */\nexport function localVaultCollidesWithMachineRoot(): boolean {\n return collidesWithMachineRoot(localVaultRoot());\n}\n\n/** The vault of an organization: its projects, and its lock. */\nexport function orgVaultRoot(orgId: string): string {\n assertSafeId('organization', orgId);\n return join(machineRoot(), 'orgs', orgId);\n}\n\n/** The vault of one cloud project, under its organization. */\nexport function projectVaultRoot(orgId: string, projectId: string): string {\n assertSafeId('project', projectId);\n return join(orgVaultRoot(orgId), 'projects', projectId);\n}\n\n/**\n * The organization a vault path belongs to, or null for the local vault.\n *\n * The layout is the authority on ownership — `~/.runeya/orgs/<org>/projects/<id>`\n * says both which project and which organization — so an entity read from a\n * vault carries its couple in the path it came from, even though its own file\n * only ever names its project.\n */\nexport function orgIdOfRoot(root: string): string | null {\n const marker = join(machineRoot(), 'orgs') + sep;\n if (!root.startsWith(marker)) return null;\n const [orgId] = root.slice(marker.length).split(sep);\n return orgId && SAFE_ID.test(orgId) ? orgId : null;\n}\n\n/**\n * La clé sous laquelle une donnée de ce coffre est chiffrée.\n *\n * L'identifiant d'organisation quand le coffre lui appartient, `undefined` pour\n * la clé machine. Le rangement décide donc du chiffrement, sans qu'aucune\n * entité ait à porter un champ de plus : le coffre où on l'écrit dit déjà à qui\n * elle est.\n */\nexport function vaultIdOfRoot(root: string): string | undefined {\n return orgIdOfRoot(root) ?? undefined;\n}\n\n// ─── Projets locaux ─────────────────────────────────────────────────────────\n\n/**\n * Les dossiers des projets locaux de cette machine.\n *\n * Un projet local vit dans le `.runeya` de son dossier. Il y en a un par\n * dossier, et autant de dossiers qu'on en importe ou crée depuis l'interface.\n * Ce fichier de la racine machine en garde la liste, pour que chaque instance\n * de Runeya les voie, quel que soit le dossier d'où elle est lancée.\n */\nconst LOCAL_PROJECTS_FILE = 'local-projects.json';\n\nfunction localProjectsFilePath(): string {\n return join(machineRoot(), LOCAL_PROJECTS_FILE);\n}\n\n/** Le coffre d'un projet local : le `.runeya` de son dossier. */\nexport function localProjectVaultRoot(dir: string): string {\n return join(resolve(dir), '.runeya');\n}\n\n/** Les dossiers enregistrés, absolus, sans doublon. */\nexport async function readLocalProjectDirs(): Promise<string[]> {\n try {\n const parsed = JSON.parse(await readFile(localProjectsFilePath(), 'utf-8')) as { dirs?: unknown };\n const dirs = Array.isArray(parsed.dirs) ? parsed.dirs.filter((d): d is string => typeof d === 'string') : [];\n return [...new Set(dirs.map((d) => resolve(d)))];\n } catch {\n return [];\n }\n}\n\nasync function writeLocalProjectDirs(dirs: string[]): Promise<void> {\n await mkdir(machineRoot(), { recursive: true });\n const path = localProjectsFilePath();\n await writeFile(`${path}.tmp`, JSON.stringify({ dirs }, null, 2), 'utf-8');\n await rename(`${path}.tmp`, path);\n}\n\n/** Ajouter un dossier à la liste. Sans effet s'il y est déjà. */\nexport async function registerLocalProjectDir(dir: string): Promise<void> {\n const target = resolve(dir);\n const dirs = await readLocalProjectDirs();\n if (dirs.includes(target)) return;\n await writeLocalProjectDirs([...dirs, target]);\n}\n\n/** Retirer un dossier de la liste. Son `.runeya` reste sur le disque. */\nexport async function unregisterLocalProjectDir(dir: string): Promise<void> {\n const target = resolve(dir);\n const dirs = await readLocalProjectDirs();\n if (!dirs.includes(target)) return;\n await writeLocalProjectDirs(dirs.filter((d) => d !== target));\n}\n\n/** Un dossier de projet local dont le coffre serait la racine machine, ou dedans. */\nexport function collidesWithMachineRoot(vaultRoot: string): boolean {\n const machine = machineRoot();\n return vaultRoot === machine || vaultRoot.startsWith(machine + sep);\n}\n\n/**\n * Le coffre de chaque projet local connu, par id.\n *\n * Tenu par le store des projets, qui lit les dossiers enregistrés. Sans entrée,\n * un projet local retombe sur le coffre du dossier de lancement, comme avant.\n */\nconst localProjectRoots = new Map<string, string>();\n\nexport function setLocalProjectRoot(projectId: string, root: string): void {\n localProjectRoots.set(projectId, root);\n}\n\nexport function forgetLocalProjectRoot(projectId: string): void {\n localProjectRoots.delete(projectId);\n}\n\n/** Where to read and write a given project. */\nexport function vaultFor(target: VaultTarget): Vault {\n if (!target.orgId) return { root: localProjectRoots.get(target.id) ?? localVaultRoot() };\n return { root: projectVaultRoot(target.orgId, target.id) };\n}\n\n/**\n * Which cloud instance an organization's vault came from.\n *\n * `~/.runeya/orgs/` is machine-global, so a machine that has ever synced against\n * two clouds (a self-hosted or local one and the hosted one) ends up with org\n * ids from both, indistinguishable. Stamping the instance next to the vault is\n * what lets a reader tell \"an org I am not a member of\" from \"an org of a cloud\n * I am simply not signed into\" — and what keeps the sync from offering one\n * cloud's organizations to another.\n */\nconst ORG_CLOUD_FILE = 'cloud.json';\n\nexport async function stampOrgCloud(\n orgId: string,\n cloudUrl: string,\n name?: string,\n accountId?: string,\n): Promise<void> {\n const root = orgVaultRoot(orgId);\n // Not best-effort any more: the stamp is now what tells a later boot which\n // cloud an org's vault came from, and syncing follows those vaults. A stamp\n // silently skipped would leave the org to be claimed by whatever cloud is\n // configured then — so a failure here has to stop the pull it precedes.\n await mkdir(root, { recursive: true });\n // Le nom rejoint le tampon plutôt qu'un fichier à lui : il se connaît au même\n // instant, et une organisation sans nom local n'a plus qu'un hash à montrer\n // dès que la session cloud est éteinte.\n const known = name ?? (await readOrgNames())[orgId];\n // Le compte rejoint le tampon pour la même raison que le cloud : il n'y en a\n // plus un seul sur le poste, et sans lui une organisation serait interrogée\n // avec le token du dernier utilisateur connecté — au mieux un 403, au pire\n // les données d'un homonyme. Un `accountId` omis laisse en place celui qui y\n // était : les appelants qui ne savent pas de quel compte ils parlent ne\n // doivent pas effacer ce que la liaison, elle, savait.\n const kept = accountId ?? (await readOrgAccounts())[orgId];\n const stamp = {\n cloudUrl,\n ...(known ? { name: known } : {}),\n ...(kept ? { accountId: kept } : {}),\n };\n await writeFile(join(root, ORG_CLOUD_FILE), JSON.stringify(stamp, null, 2), 'utf-8');\n}\n\n/**\n * Retenir le compte auquel une organisation appartient.\n *\n * Appelé avec ce que le cloud vient de répondre : une organisation appartient\n * au compte qui la LISTE, et c'est la seule source qui le sache. Le poste, lui,\n * ne peut que deviner — il l'a fait, et il a rangé sous un compte les\n * organisations d'un autre, y compris celles d'un tout autre cloud.\n *\n * Écrase donc le compte déjà tamponné : cette réponse-ci fait autorité, la\n * précédente pouvait être une supposition.\n */\nexport async function rememberOrgAccount(orgId: string, accountId: string): Promise<void> {\n const root = orgVaultRoot(orgId);\n // Aucun coffre : cette organisation n'a rien ici, et lui en créer un pour un\n // simple rattachement rangerait un répertoire vide sous un compte.\n if (!existsSync(root)) return;\n const file = join(root, ORG_CLOUD_FILE);\n let stamp: Record<string, unknown> = {};\n try {\n stamp = JSON.parse(await readFile(file, 'utf-8')) as Record<string, unknown>;\n } catch {\n // Pas de tampon : le rattachement en fonde un.\n }\n if (stamp['accountId'] === accountId) return;\n await writeFile(file, JSON.stringify({ ...stamp, accountId }, null, 2), 'utf-8');\n}\n\n/**\n * Compléter un tampon qui connaît son compte mais pas son cloud.\n *\n * `rememberOrgAccount` n'écrit que le compte : un coffre passé par lui garde\n * donc un tampon sans adresse, et la synchronisation l'écartait dès qu'il y\n * avait plus d'un compte lié — faute de savoir vers quel cloud frapper, alors\n * que le compte tamponné le disait. La déduction seule ne suffit pas : refaite\n * à chaque démarrage, elle laisse le disque faux, et le moindre chemin qui lit\n * l'adresse sans passer par elle retombe dans le trou. On la recopie donc.\n *\n * N'écrase jamais une adresse en place — elle peut désigner un autre cloud que\n * celui du compte, et c'est le tampon qui fait foi.\n */\nexport async function backfillOrgCloud(orgId: string, cloudUrl: string): Promise<boolean> {\n const root = orgVaultRoot(orgId);\n // Aucun coffre : rien à compléter, et en fonder un rangerait un répertoire\n // vide sous un cloud.\n if (!existsSync(root)) return false;\n const file = join(root, ORG_CLOUD_FILE);\n let stamp: Record<string, unknown>;\n try {\n stamp = JSON.parse(await readFile(file, 'utf-8')) as Record<string, unknown>;\n } catch {\n // Pas de tampon du tout : ce n'est pas un rattrapage, c'est une liaison —\n // elle passe par `stampOrgCloud`, qui sait aussi poser nom et compte.\n return false;\n }\n const current = stamp['cloudUrl'];\n if (typeof current === 'string' && current) return false;\n await writeFile(file, JSON.stringify({ ...stamp, cloudUrl }, null, 2), 'utf-8');\n return true;\n}\n\n/**\n * Suivre un compte qui change d'identifiant.\n *\n * Un compte lié avant le multicompte n'a pas d'identité : son identifiant est\n * provisoire, fondé sur son seul cloud, et devient définitif au premier appel\n * qui apprend qui il est. Les tampons posés entre-temps nomment l'ancien — et\n * un tampon qui désigne un compte inexistant rend son organisation muette dès\n * qu'il y a plus d'un compte, c'est-à-dire exactement quand on en a besoin.\n */\nexport async function renameOrgAccount(oldId: string, newId: string): Promise<void> {\n if (oldId === newId) return;\n for (const orgId of await listOrgVaults()) {\n const file = join(orgVaultRoot(orgId), ORG_CLOUD_FILE);\n let stamp: Record<string, unknown>;\n try {\n stamp = JSON.parse(await readFile(file, 'utf-8')) as Record<string, unknown>;\n } catch {\n continue;\n }\n if (stamp['accountId'] !== oldId) continue;\n await writeFile(file, JSON.stringify({ ...stamp, accountId: newId }, null, 2), 'utf-8');\n }\n}\n\n/**\n * Le compte dont chaque organisation relève, lu sur le disque.\n *\n * Pendant exact de `readOrgClouds` : le cloud dit *où* frapper, le compte dit\n * *au nom de qui*. Une organisation sans compte tamponné est celle d'un coffre\n * écrit avant le multicompte ; elle retombe sur le compte unique du poste, ce\n * qui est précisément la situation qu'elle décrivait.\n */\nexport async function readOrgAccounts(): Promise<Record<string, string>> {\n const out: Record<string, string> = {};\n for (const orgId of await listOrgVaults()) {\n try {\n const raw = await readFile(join(orgVaultRoot(orgId), ORG_CLOUD_FILE), 'utf-8');\n const id = (JSON.parse(raw) as { accountId?: unknown }).accountId;\n if (typeof id === 'string' && id) out[orgId] = id;\n } catch {\n // Pas de tampon, ou pas de compte : le poste tranchera avec ce qu'il a.\n }\n }\n return out;\n}\n\n/**\n * Retenir le nom d'une organisation déjà présente ici.\n *\n * Appelé quand le cloud vient de le dire, pour qu'il survive à la déconnexion.\n * Aucun COFFRE n'est créé : une organisation dont ce poste n'a rien n'a pas à\n * recevoir un répertoire pour un simple nom.\n *\n * Le tampon, lui, est écrit même s'il manque — c'est la nuance qui manquait.\n * Tous les coffres ne naissent pas d'une synchronisation : un simple\n * `settingsManager.getSettings(orgId)` crée le répertoire sans passer par\n * `stampOrgCloud`. Renoncer faute de fichier condamnait ces coffres-là à\n * n'afficher qu'un hash pour toujours, quel que soit le nombre de fois où le\n * cloud redit leur nom.\n *\n * Le tampon posé ici ne porte pas de `cloudUrl` : personne ici ne sait de quel\n * cloud vient le coffre, et l'inventer rangerait l'organisation sous le mauvais.\n * Un tampon sans cloud se lit exactement comme l'absence de tampon.\n */\nexport async function rememberOrgName(orgId: string, name: string): Promise<void> {\n const root = orgVaultRoot(orgId);\n if (!existsSync(root)) return;\n const file = join(root, ORG_CLOUD_FILE);\n let stamp: Record<string, unknown> = {};\n try {\n stamp = JSON.parse(await readFile(file, 'utf-8')) as Record<string, unknown>;\n } catch {\n // Pas de tampon, ou illisible : le nom en fonde un.\n }\n if (stamp['name'] === name) return;\n await writeFile(file, JSON.stringify({ ...stamp, name }, null, 2), 'utf-8');\n}\n\n/** Le nom de chaque organisation dont le tampon en porte un. */\nexport async function readOrgNames(): Promise<Record<string, string>> {\n const out: Record<string, string> = {};\n for (const orgId of await listOrgVaults()) {\n try {\n const raw = await readFile(join(orgVaultRoot(orgId), ORG_CLOUD_FILE), 'utf-8');\n const name = (JSON.parse(raw) as { name?: unknown }).name;\n if (typeof name === 'string' && name) out[orgId] = name;\n } catch {\n // Pas de tampon, ou pas encore de nom : l'id fera l'affaire.\n }\n }\n return out;\n}\n\n/**\n * Le logo d'une organisation, gardé à côté de son nom.\n *\n * Même raison d'être que le nom recopié dans le tampon : ce que le poste sait\n * de ses organisations ne doit dépendre ni d'une session cloud ni du réseau.\n * Le nom tient dans le tampon ; les octets, eux, méritent leur propre fichier —\n * `cloud.json` est relu et réécrit à chaque pull, et y mêler 40 Ko de base64\n * ferait payer l'image à des lectures qui n'en veulent pas.\n */\nconst ORG_LOGO_FILE = 'logo.json';\n\ninterface StoredLogo {\n contentType: string;\n base64: string;\n fetchedAt: string;\n}\n\n/** Formats matriciels inertes, la même liste que celle acceptée par le cloud. */\nconst LOGO_TYPES = new Set(['image/png', 'image/jpeg', 'image/webp', 'image/gif']);\n\n/** Garder (ou remplacer) le logo d'une organisation présente ici. */\nexport async function rememberOrgLogo(orgId: string, contentType: string, base64: string): Promise<void> {\n if (!LOGO_TYPES.has(contentType)) return;\n const root = orgVaultRoot(orgId);\n const stored: StoredLogo = { contentType, base64, fetchedAt: new Date().toISOString() };\n await mkdir(root, { recursive: true });\n await writeFile(join(root, ORG_LOGO_FILE), JSON.stringify(stored), 'utf-8');\n}\n\n/** Oublier le logo d'une organisation — elle n'en a plus. */\nexport async function forgetOrgLogo(orgId: string): Promise<void> {\n try {\n await unlink(join(orgVaultRoot(orgId), ORG_LOGO_FILE));\n } catch {\n // Il n'y en avait pas : c'est le résultat voulu.\n }\n}\n\n/**\n * Le logo retenu d'une organisation : ses octets et leur type.\n *\n * Le type est revalidé à la lecture — un fichier trafiqué sur le disque ne doit\n * pas pouvoir faire servir un `image/svg+xml`, donc du script, à l'interface.\n */\nexport async function readOrgLogo(orgId: string): Promise<{ contentType: string; bytes: Uint8Array } | null> {\n try {\n const raw = await readFile(join(orgVaultRoot(orgId), ORG_LOGO_FILE), 'utf-8');\n const { contentType, base64 } = JSON.parse(raw) as Partial<StoredLogo>;\n if (typeof contentType !== 'string' || !LOGO_TYPES.has(contentType)) return null;\n if (typeof base64 !== 'string' || !base64) return null;\n return { contentType, bytes: new Uint8Array(Buffer.from(base64, 'base64')) };\n } catch {\n // Pas de logo retenu, ou fichier illisible.\n return null;\n }\n}\n\n/**\n * Les logos retenus, en data URL, prêts pour un `src`.\n *\n * Le type est revalidé à la lecture : un fichier trafiqué sur le disque ne doit\n * pas pouvoir faire servir un `image/svg+xml` — donc du script — à l'interface.\n */\nexport async function readOrgLogos(): Promise<Record<string, string>> {\n const out: Record<string, string> = {};\n for (const orgId of await listOrgVaults()) {\n const logo = await readOrgLogo(orgId);\n // Pas de logo retenu : l'initiale fera l'affaire.\n if (logo) out[orgId] = `data:${logo.contentType};base64,${Buffer.from(logo.bytes).toString('base64')}`;\n }\n return out;\n}\n\n/** The cloud instance of every org vault that carries a stamp. */\nexport async function readOrgClouds(): Promise<Record<string, string>> {\n const orgsDir = join(machineRoot(), 'orgs');\n const out: Record<string, string> = {};\n let orgIds: string[];\n try {\n orgIds = (await readdir(orgsDir, { withFileTypes: true }))\n .filter((e) => e.isDirectory() && SAFE_ID.test(e.name))\n .map((e) => e.name);\n } catch {\n return out;\n }\n for (const orgId of orgIds) {\n try {\n const raw = await readFile(join(orgsDir, orgId, ORG_CLOUD_FILE), 'utf-8');\n const url = (JSON.parse(raw) as { cloudUrl?: unknown }).cloudUrl;\n if (typeof url === 'string' && url) out[orgId] = url;\n } catch {\n // No stamp (older vault, or never linked here) — simply unknown.\n }\n }\n return out;\n}\n\n/**\n * Les organisations présentes sur ce disque, projets ou non.\n *\n * Distinct de `listCloudVaults`, qui ne voit une organisation qu'à travers ses\n * projets matérialisés : une organisation peut porter des données à elle —\n * agents, clés d'API — sans qu'aucun projet n'ait encore été ouvert ici, et\n * l'ignorer alors reviendrait à les perdre au prochain démarrage.\n */\nexport async function listOrgVaults(): Promise<string[]> {\n const orgsDir = join(machineRoot(), 'orgs');\n try {\n return (await readdir(orgsDir, { withFileTypes: true }))\n .filter((e) => e.isDirectory() && SAFE_ID.test(e.name))\n .map((e) => e.name);\n } catch {\n return [];\n }\n}\n\n/** One cloud project vault found on disk. */\nexport interface CloudVault {\n orgId: string;\n projectId: string;\n root: string;\n}\n\n/**\n * Every cloud project vault present on this machine, by walking\n * `~/.runeya/orgs/<orgId>/projects/<projectId>`.\n *\n * Discovery reads the disk rather than an index on purpose: an index is one\n * more thing that can disagree with what is actually there, and a project\n * present on disk but missing from it is precisely the \"already here, still\n * offered as a download\" bug. Unreadable or foreign directories are skipped in\n * silence — a half-written pull must not take a whole load down.\n */\nexport async function listCloudVaults(): Promise<CloudVault[]> {\n const orgsDir = join(machineRoot(), 'orgs');\n const found: CloudVault[] = [];\n\n let orgIds: string[];\n try {\n orgIds = (await readdir(orgsDir, { withFileTypes: true }))\n .filter((e) => e.isDirectory() && SAFE_ID.test(e.name))\n .map((e) => e.name);\n } catch {\n return found;\n }\n\n for (const orgId of orgIds) {\n const projectsDir = join(orgsDir, orgId, 'projects');\n try {\n for (const entry of await readdir(projectsDir, { withFileTypes: true })) {\n if (!entry.isDirectory() || !SAFE_ID.test(entry.name)) continue;\n const root = join(projectsDir, entry.name);\n // Un répertoire n'est pas un projet : il faut qu'il en porte la fiche.\n //\n // Tout ce qui traînait ici était pris pour un coffre — une copie de\n // sauvegarde, un dossier oublié — et les stores le lisaient, le\n // comptaient, pouvaient le réécrire. Une sauvegarde déposée à côté\n // d'un projet s'est ainsi retrouvée annoncée comme dix-neuf\n // conversations illisibles appartenant à l'organisation.\n //\n // `project.json` est déjà ce qui fait foi ailleurs (`isMaterialized`\n // dans org-sync-scope) : la même règle vaut ici, pour tout le monde.\n if (!(await access(join(root, 'project.json')).then(() => true, () => false))) continue;\n found.push({ orgId, projectId: entry.name, root });\n }\n } catch {\n // Org directory without materialized projects yet.\n }\n }\n return found;\n}\n\n/**\n * Every vault holding data, local first — what stores must read to see it all.\n *\n * Derived from the disk, so it needs no store to have loaded beforehand: a\n * content store can resolve where to read without waiting on the project store.\n */\nexport async function allVaultRoots(): Promise<string[]> {\n const cloud = await listCloudVaults();\n const locals = (await readLocalProjectDirs()).map(localProjectVaultRoot);\n return [...new Set([localVaultRoot(), ...locals, ...cloud.map((v) => v.root)])];\n}\n\n/**\n * A file belonging to the machine rather than to any project.\n *\n * Settings, the audit log, caches: none of them describe a project, and keeping\n * them in the launch directory forced a `.runeya` to exist for someone working\n * only on cloud projects — the very thing vaults remove.\n *\n * For anything ENCRYPTED, use `keyedFilePath` instead.\n */\nexport function machineFilePath(filename: string): string {\n return join(machineRoot(), filename);\n}\n\n/**\n * A machine file whose contents are encrypted.\n *\n * It lives beside the key that opens it, never merely beside the machine. The\n * two are usually the same directory — but a launch directory that owns its own\n * key keeps it (see `keyRoot`), and a file encrypted under that key read from\n * elsewhere would decrypt to blanks, then be saved back blank. Tying the file to\n * its key is what makes that impossible.\n */\nexport async function keyedFilePath(filename: string): Promise<string> {\n return join(await keyRoot(), filename);\n}\n\n/**\n * Where such a file was kept by earlier versions: in the launch directory.\n *\n * Read as a fallback and never written, so a directory shared with an older\n * Runeya keeps working.\n */\nexport function legacyMachineFilePath(filename: string): string {\n return join(localVaultRoot(), filename);\n}\n\n/**\n * Create the local vault, on the way to writing a local project into it.\n *\n * The directory is created here and nowhere else. Runeya no longer makes a\n * `.runeya` just because it was started somewhere: a machine used only for\n * cloud projects should leave the directories it visits untouched, and a\n * `.runeya` appearing in a repository should mean \"there is a local project\n * here\" rather than \"Runeya ran here once\".\n */\nexport async function ensureLocalVault(): Promise<string> {\n const root = localVaultRoot();\n await mkdir(root, { recursive: true });\n return root;\n}\n\n/** Files that mark a directory as already holding an encryption key. */\nconst KEY_FILES = ['.encryption.key.enc', '.runeya-verify'];\n\nlet keyRootPromise: Promise<string> | null = null;\n\n/** True when a directory already holds an encryption key of its own. */\nasync function holdsKey(root: string): Promise<boolean> {\n for (const filename of KEY_FILES) {\n try {\n await access(join(root, filename));\n return true;\n } catch {\n // Not here — keep looking.\n }\n }\n return false;\n}\n\n/**\n * Where this machine's encryption key and its canary live.\n *\n * The key protects everything on the machine — agents, sessions, and the\n * environments of every vault — so there is one, not one per vault, and the\n * machine root is its home.\n *\n * Earlier versions let a launch directory keep a key of its own, which is how a\n * machine ended up with several master passwords and several cloud identities.\n * Such a directory is no longer promoted: the machine key answers as soon as it\n * exists, and the leftover local key is surfaced by `legacyVaultRoot()` so it\n * can be migrated rather than silently obeyed. A machine that has never had a\n * machine key still falls back to the local one, so an un-migrated install\n * keeps opening exactly as before.\n *\n * Resolved once per process: the answer must not change under a running server,\n * and a key written mid-session would otherwise move its own home.\n */\nexport function keyRoot(): Promise<string> {\n keyRootPromise ??= (async () => {\n if (await holdsKey(machineRoot())) return machineRoot();\n return (await holdsKey(localVaultRoot())) ? localVaultRoot() : machineRoot();\n })();\n return keyRootPromise;\n}\n\n/**\n * The launch directory's own key, when the machine key is what we opened.\n *\n * Its presence is the whole trigger for the migration page: this directory\n * holds data encrypted under a key nothing reads any more. Null once migrated,\n * and null too when the local key IS the one in use — there is nothing to\n * migrate then.\n */\nexport async function legacyVaultRoot(): Promise<string | null> {\n const local = localVaultRoot();\n if ((await keyRoot()) === local) return null;\n return (await holdsKey(local)) ? local : null;\n}\n\n/** Test seam: forget the resolved key home. */\nexport function resetKeyRoot(): void {\n keyRootPromise = null;\n}\n","import { z } from 'zod';\nimport { resolve as resolvePath } from 'node:path';\n\n/**\n * Every variable Runeya reads from the process environment is prefixed with\n * `RUNEYA_`. Generic names (PORT, HOST, MODE, DATA_DIR…) are deliberately NOT\n * read: Runeya loads the `.env` of the stack it manages, where those names very\n * often belong to the user's own services.\n *\n * The resolved object keeps short field names (`env.PORT`, `env.HOST`, …) —\n * only the environment keys are prefixed.\n */\n\n// Server port, used to derive the default agent port\nconst serverPort = z.coerce.number().int().min(1).max(65535).default(4000).parse(process.env.RUNEYA_HTTP_PORT);\n\nconst defaultAgentPort = process.env.RUNEYA_AGENT_PORT\n ? z.coerce.number().int().min(1).max(65535).parse(process.env.RUNEYA_AGENT_PORT)\n : serverPort + 1;\n\nconst EnvSchema = z.object({\n RUNEYA_HTTP_PORT: z.coerce.number().int().min(1).max(65535).default(4000),\n RUNEYA_HOST: z.string().default('127.0.0.1'),\n RUNEYA_AGENT_PORT: z.coerce.number().int().min(1).max(65535).default(defaultAgentPort),\n RUNEYA_AGENT_HOST: z.string().default('127.0.0.1'),\n RUNEYA_AGENT_BINARY_PATH: z.string().nullable().default(null),\n RUNEYA_DATA_DIR: z.preprocess((v) => (typeof v === 'string' && v.length > 0 ? v : undefined), z.string().default('.runeya')),\n // Home holding the cloud vaults (`<home>/.runeya/orgs/...`). Defaults to the\n // user's home directory; overridden by tests so they never write to the real\n // one, and usable to relocate the vaults on a shared machine.\n RUNEYA_HOME: z.preprocess((v) => (typeof v === 'string' && v.length > 0 ? v : undefined), z.string().nullable().default(null)),\n RUNEYA_CLOUD_URL: z.string().url().nullable().default(null),\n // Cloud front-end (landing) URL — used by the web app for the registration /\n // onboarding flow. Configured on the server at launch; the web fetches it.\n RUNEYA_CLOUD_APP_URL: z.string().url().nullable().default(null),\n RUNEYA_MODE: z.enum(['local-simple', 'cloud']).default('local-simple'),\n RUNEYA_CORS_ORIGIN: z.string().nullable().default(null),\n RUNEYA_LAN_PROXY: z.preprocess((v) => v === 'true' || v === '1', z.boolean()).default(false),\n // Set by the CLI when it was started from a desktop launcher rather than a\n // terminal. The web app surfaces it so the user knows which Runeya they are\n // looking at when several are running.\n RUNEYA_FROM_DESKTOP: z.preprocess((v) => v === 'true' || v === '1', z.boolean()).default(false),\n // Label shown for this machine in the cloud's \"linked machines\" screen.\n // Defaults to the hostname (see `getDeviceName`); set it explicitly when a\n // single host runs several instances and you want to tell them apart.\n RUNEYA_DEVICE_NAME: z.preprocess(\n (v) => (typeof v === 'string' && v.trim().length > 0 ? v.trim() : undefined),\n z.string().max(64).nullable().default(null),\n ),\n // Lifetime of the JWTs signed by the server (UI session and AI agents).\n // Meant for reproducing an expiry locally, e.g. RUNEYA_JWT_TTL=4s.\n RUNEYA_JWT_TTL: z.preprocess(\n (v) => (typeof v === 'string' && v.trim().length > 0 ? v.trim() : undefined),\n z.string().regex(/^[1-9]\\d{0,5}(s|m|h|d)$/, 'RUNEYA_JWT_TTL: expected e.g. 4s, 30m, 8h, 1d').default('8h'),\n ),\n}).transform((data) => ({\n ...data,\n // Short aliases used throughout the server code\n PORT: data.RUNEYA_HTTP_PORT,\n HOST: data.RUNEYA_HOST,\n MODE: data.RUNEYA_MODE,\n /**\n * Absolute from the start, resolved once against the launch directory.\n *\n * It defaults to a relative `.runeya`, and every caller used to re-resolve it\n * against whatever the process's cwd happened to be. A vault that moves when\n * the process changes directory is a vault that can be silently written to the\n * wrong place — so the answer is fixed here, at boot, and never recomputed.\n */\n DATA_DIR: resolvePath(data.RUNEYA_DATA_DIR),\n HOME_DIR: data.RUNEYA_HOME,\n CLOUD_URL: data.RUNEYA_CLOUD_URL,\n CLOUD_APP_URL: data.RUNEYA_CLOUD_APP_URL,\n CORS_ORIGIN: data.RUNEYA_CORS_ORIGIN,\n AGENT_BINARY_PATH: data.RUNEYA_AGENT_BINARY_PATH,\n DEVICE_NAME: data.RUNEYA_DEVICE_NAME,\n FROM_DESKTOP: data.RUNEYA_FROM_DESKTOP,\n JWT_TTL: data.RUNEYA_JWT_TTL,\n}));\n\nexport type Env = z.infer<typeof EnvSchema>;\n\nexport const env = EnvSchema.parse(process.env);\n"],"mappings":";AAAA,SAAS,MAAM,KAAK,eAAe;AACnC,SAAS,eAAe;AACxB,SAAS,SAAS,OAAO,QAAQ,UAAU,WAAW,QAAQ,cAAc;AAC5E,SAAS,kBAAkB;;;ACH3B,SAAS,SAAS;AAClB,SAAS,WAAW,mBAAmB;AAavC,IAAM,aAAa,EAAE,OAAO,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,KAAK,EAAE,QAAQ,GAAI,EAAE,MAAM,QAAQ,IAAI,gBAAgB;AAE7G,IAAM,mBAAmB,QAAQ,IAAI,oBACjC,EAAE,OAAO,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,KAAK,EAAE,MAAM,QAAQ,IAAI,iBAAiB,IAC7E,aAAa;AAEjB,IAAM,YAAY,EAAE,OAAO;AAAA,EACzB,kBAAkB,EAAE,OAAO,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,KAAK,EAAE,QAAQ,GAAI;AAAA,EACxE,aAAa,EAAE,OAAO,EAAE,QAAQ,WAAW;AAAA,EAC3C,mBAAmB,EAAE,OAAO,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,KAAK,EAAE,QAAQ,gBAAgB;AAAA,EACrF,mBAAmB,EAAE,OAAO,EAAE,QAAQ,WAAW;AAAA,EACjD,0BAA0B,EAAE,OAAO,EAAE,S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AAQ,MAAO,MAAO,QAAO;AACxC,SAAQ,MAAM,SAAS,KAAK,IAAK,QAAQ;AAC3C;AAGO,SAAS,eAAqB;AACnC,mBAAiB;AACnB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../server/src/services/vault-resolver.ts","../../server/src/config/env.ts"],"sourcesContent":["import { join, sep, resolve } from 'node:path';\nimport { homedir } from 'node:os';\nimport { readdir, mkdir, access, readFile, writeFile, unlink, rename } from 'node:fs/promises';\nimport { existsSync } from 'node:fs';\nimport { env } from '../config/env.js';\n\n/**\n * Where a project's files live, and which key protects them.\n *\n * Runeya holds two kinds of projects, and they do not belong in the same place.\n * A local project *is* a directory on this machine: its data belongs next to\n * the code, in `<cwd>/.runeya`. A cloud project belongs to an organization and\n * is materialized from the doc; tying it to whichever directory happened to\n * launch the server is what made the same project look \"already here\" in one\n * folder and \"to download\" in another. Cloud projects therefore live under the\n * user's home, prefixed by organization and by project.\n *\n * A vault holds a project's own data — project.json, services, environments.\n * It does NOT hold the key that protects it: one key answers for the whole\n * machine (see `keyRoot` at the bottom of this file), which is what the cloud's\n * org-wide canary already assumes.\n */\n\nexport interface Vault {\n /** Directory holding this project's own files. */\n root: string;\n}\n\n/** Identifies a project well enough to place it — the stored shape, or the doc's. */\nexport interface VaultTarget {\n id: string;\n orgId?: string | null;\n}\n\n/**\n * Ids reach us from the cloud, and they end up in filesystem paths. Anything\n * outside this alphabet — a separator, a `..`, a NUL — could walk out of the\n * home directory, so it is rejected rather than sanitized: a mangled id would\n * silently point at the wrong vault.\n */\nconst SAFE_ID = /^[A-Za-z0-9._-]{1,128}$/;\n\nfunction assertSafeId(kind: 'organization' | 'project', id: string): void {\n if (!SAFE_ID.test(id) || id === '.' || id === '..') {\n throw new Error(`Invalid ${kind} id for a vault path: ${JSON.stringify(id)}`);\n }\n}\n\n/**\n * Everything that belongs to this machine rather than to a project.\n *\n * Read from `process.env` rather than the parsed config: tests that mock\n * `config/env.js` would otherwise lose the override and write cloud vaults into\n * the developer's real home directory.\n */\nexport function machineRoot(): string {\n const override = process.env['RUNEYA_HOME'];\n return join(override && override.length > 0 ? override : homedir(), '.runeya');\n}\n\n/**\n * The local vault: the `.runeya` of the directory the server was launched in.\n *\n * Kept on `env.DATA_DIR` so `--data-dir` and the tests keep working. That value\n * is already absolute, resolved once at boot — re-resolving it here would make\n * the vault follow the process's cwd, which is exactly what it must not do.\n */\nexport function localVaultRoot(): string {\n return env.DATA_DIR;\n}\n\n/**\n * Le coffre local se confond-il avec la racine machine, ou se range-t-il dedans ?\n *\n * Runeya lancée depuis le dossier qui abrite son propre `.runeya` — le home,\n * typiquement — y verrait son coffre local : les fichiers d'un projet local\n * iraient alors se mêler aux coffres d'organisation, aux passphrases d'agent et\n * au reste de ce qui appartient à la machine, dans un seul répertoire. Deux\n * natures de données que tout sépare partageraient leur rangement, et supprimer\n * l'une emporterait l'autre.\n */\nexport function localVaultCollidesWithMachineRoot(): boolean {\n return collidesWithMachineRoot(localVaultRoot());\n}\n\n/** The vault of an organization: its projects, and its lock. */\nexport function orgVaultRoot(orgId: string): string {\n assertSafeId('organization', orgId);\n return join(machineRoot(), 'orgs', orgId);\n}\n\n/** The vault of one cloud project, under its organization. */\nexport function projectVaultRoot(orgId: string, projectId: string): string {\n assertSafeId('project', projectId);\n return join(orgVaultRoot(orgId), 'projects', projectId);\n}\n\n/**\n * The organization a vault path belongs to, or null for the local vault.\n *\n * The layout is the authority on ownership — `~/.runeya/orgs/<org>/projects/<id>`\n * says both which project and which organization — so an entity read from a\n * vault carries its couple in the path it came from, even though its own file\n * only ever names its project.\n */\nexport function orgIdOfRoot(root: string): string | null {\n const marker = join(machineRoot(), 'orgs') + sep;\n if (!root.startsWith(marker)) return null;\n const [orgId] = root.slice(marker.length).split(sep);\n return orgId && SAFE_ID.test(orgId) ? orgId : null;\n}\n\n/**\n * La clé sous laquelle une donnée de ce coffre est chiffrée.\n *\n * L'identifiant d'organisation quand le coffre lui appartient, `undefined` pour\n * la clé machine. Le rangement décide donc du chiffrement, sans qu'aucune\n * entité ait à porter un champ de plus : le coffre où on l'écrit dit déjà à qui\n * elle est.\n */\nexport function vaultIdOfRoot(root: string): string | undefined {\n return orgIdOfRoot(root) ?? undefined;\n}\n\n// ─── Projets locaux ─────────────────────────────────────────────────────────\n\n/**\n * Les dossiers des projets locaux de cette machine.\n *\n * Un projet local vit dans le `.runeya` de son dossier. Il y en a un par\n * dossier, et autant de dossiers qu'on en importe ou crée depuis l'interface.\n * Ce fichier de la racine machine en garde la liste, pour que chaque instance\n * de Runeya les voie, quel que soit le dossier d'où elle est lancée.\n */\nconst LOCAL_PROJECTS_FILE = 'local-projects.json';\n\nfunction localProjectsFilePath(): string {\n return join(machineRoot(), LOCAL_PROJECTS_FILE);\n}\n\n/** Le coffre d'un projet local : le `.runeya` de son dossier. */\nexport function localProjectVaultRoot(dir: string): string {\n return join(resolve(dir), '.runeya');\n}\n\n/** Les dossiers enregistrés, absolus, sans doublon. */\nexport async function readLocalProjectDirs(): Promise<string[]> {\n try {\n const parsed = JSON.parse(await readFile(localProjectsFilePath(), 'utf-8')) as { dirs?: unknown };\n const dirs = Array.isArray(parsed.dirs) ? parsed.dirs.filter((d): d is string => typeof d === 'string') : [];\n return [...new Set(dirs.map((d) => resolve(d)))];\n } catch {\n return [];\n }\n}\n\nasync function writeLocalProjectDirs(dirs: string[]): Promise<void> {\n await mkdir(machineRoot(), { recursive: true });\n const path = localProjectsFilePath();\n await writeFile(`${path}.tmp`, JSON.stringify({ dirs }, null, 2), 'utf-8');\n await rename(`${path}.tmp`, path);\n}\n\n/** Ajouter un dossier à la liste. Sans effet s'il y est déjà. */\nexport async function registerLocalProjectDir(dir: string): Promise<void> {\n const target = resolve(dir);\n const dirs = await readLocalProjectDirs();\n if (dirs.includes(target)) return;\n await writeLocalProjectDirs([...dirs, target]);\n}\n\n/** Retirer un dossier de la liste. Son `.runeya` reste sur le disque. */\nexport async function unregisterLocalProjectDir(dir: string): Promise<void> {\n const target = resolve(dir);\n const dirs = await readLocalProjectDirs();\n if (!dirs.includes(target)) return;\n await writeLocalProjectDirs(dirs.filter((d) => d !== target));\n}\n\n/** Un dossier de projet local dont le coffre serait la racine machine, ou dedans. */\nexport function collidesWithMachineRoot(vaultRoot: string): boolean {\n const machine = machineRoot();\n return vaultRoot === machine || vaultRoot.startsWith(machine + sep);\n}\n\n/**\n * Le coffre de chaque projet local connu, par id.\n *\n * Tenu par le store des projets, qui lit les dossiers enregistrés. Sans entrée,\n * un projet local retombe sur le coffre du dossier de lancement, comme avant.\n */\nconst localProjectRoots = new Map<string, string>();\n\nexport function setLocalProjectRoot(projectId: string, root: string): void {\n localProjectRoots.set(projectId, root);\n}\n\nexport function forgetLocalProjectRoot(projectId: string): void {\n localProjectRoots.delete(projectId);\n}\n\n/** Where to read and write a given project. */\nexport function vaultFor(target: VaultTarget): Vault {\n if (!target.orgId) return { root: localProjectRoots.get(target.id) ?? localVaultRoot() };\n return { root: projectVaultRoot(target.orgId, target.id) };\n}\n\n/**\n * Which cloud instance an organization's vault came from.\n *\n * `~/.runeya/orgs/` is machine-global, so a machine that has ever synced against\n * two clouds (a self-hosted or local one and the hosted one) ends up with org\n * ids from both, indistinguishable. Stamping the instance next to the vault is\n * what lets a reader tell \"an org I am not a member of\" from \"an org of a cloud\n * I am simply not signed into\" — and what keeps the sync from offering one\n * cloud's organizations to another.\n */\nconst ORG_CLOUD_FILE = 'cloud.json';\n\nexport async function stampOrgCloud(\n orgId: string,\n cloudUrl: string,\n name?: string,\n accountId?: string,\n): Promise<void> {\n const root = orgVaultRoot(orgId);\n // Not best-effort any more: the stamp is now what tells a later boot which\n // cloud an org's vault came from, and syncing follows those vaults. A stamp\n // silently skipped would leave the org to be claimed by whatever cloud is\n // configured then — so a failure here has to stop the pull it precedes.\n await mkdir(root, { recursive: true });\n // Le nom rejoint le tampon plutôt qu'un fichier à lui : il se connaît au même\n // instant, et une organisation sans nom local n'a plus qu'un hash à montrer\n // dès que la session cloud est éteinte.\n const known = name ?? (await readOrgNames())[orgId];\n // Le compte rejoint le tampon pour la même raison que le cloud : il n'y en a\n // plus un seul sur le poste, et sans lui une organisation serait interrogée\n // avec le token du dernier utilisateur connecté — au mieux un 403, au pire\n // les données d'un homonyme. Un `accountId` omis laisse en place celui qui y\n // était : les appelants qui ne savent pas de quel compte ils parlent ne\n // doivent pas effacer ce que la liaison, elle, savait.\n const kept = accountId ?? (await readOrgAccounts())[orgId];\n const stamp = {\n cloudUrl,\n ...(known ? { name: known } : {}),\n ...(kept ? { accountId: kept } : {}),\n };\n await writeFile(join(root, ORG_CLOUD_FILE), JSON.stringify(stamp, null, 2), 'utf-8');\n}\n\n/**\n * Retenir le compte auquel une organisation appartient.\n *\n * Appelé avec ce que le cloud vient de répondre : une organisation appartient\n * au compte qui la LISTE, et c'est la seule source qui le sache. Le poste, lui,\n * ne peut que deviner — il l'a fait, et il a rangé sous un compte les\n * organisations d'un autre, y compris celles d'un tout autre cloud.\n *\n * Écrase donc le compte déjà tamponné : cette réponse-ci fait autorité, la\n * précédente pouvait être une supposition.\n */\nexport async function rememberOrgAccount(orgId: string, accountId: string): Promise<void> {\n const root = orgVaultRoot(orgId);\n // Aucun coffre : cette organisation n'a rien ici, et lui en créer un pour un\n // simple rattachement rangerait un répertoire vide sous un compte.\n if (!existsSync(root)) return;\n const file = join(root, ORG_CLOUD_FILE);\n let stamp: Record<string, unknown> = {};\n try {\n stamp = JSON.parse(await readFile(file, 'utf-8')) as Record<string, unknown>;\n } catch {\n // Pas de tampon : le rattachement en fonde un.\n }\n if (stamp['accountId'] === accountId) return;\n await writeFile(file, JSON.stringify({ ...stamp, accountId }, null, 2), 'utf-8');\n}\n\n/**\n * Compléter un tampon qui connaît son compte mais pas son cloud.\n *\n * `rememberOrgAccount` n'écrit que le compte : un coffre passé par lui garde\n * donc un tampon sans adresse, et la synchronisation l'écartait dès qu'il y\n * avait plus d'un compte lié — faute de savoir vers quel cloud frapper, alors\n * que le compte tamponné le disait. La déduction seule ne suffit pas : refaite\n * à chaque démarrage, elle laisse le disque faux, et le moindre chemin qui lit\n * l'adresse sans passer par elle retombe dans le trou. On la recopie donc.\n *\n * N'écrase jamais une adresse en place — elle peut désigner un autre cloud que\n * celui du compte, et c'est le tampon qui fait foi.\n */\nexport async function backfillOrgCloud(orgId: string, cloudUrl: string): Promise<boolean> {\n const root = orgVaultRoot(orgId);\n // Aucun coffre : rien à compléter, et en fonder un rangerait un répertoire\n // vide sous un cloud.\n if (!existsSync(root)) return false;\n const file = join(root, ORG_CLOUD_FILE);\n let stamp: Record<string, unknown>;\n try {\n stamp = JSON.parse(await readFile(file, 'utf-8')) as Record<string, unknown>;\n } catch {\n // Pas de tampon du tout : ce n'est pas un rattrapage, c'est une liaison —\n // elle passe par `stampOrgCloud`, qui sait aussi poser nom et compte.\n return false;\n }\n const current = stamp['cloudUrl'];\n if (typeof current === 'string' && current) return false;\n await writeFile(file, JSON.stringify({ ...stamp, cloudUrl }, null, 2), 'utf-8');\n return true;\n}\n\n/**\n * Suivre un compte qui change d'identifiant.\n *\n * Un compte lié avant le multicompte n'a pas d'identité : son identifiant est\n * provisoire, fondé sur son seul cloud, et devient définitif au premier appel\n * qui apprend qui il est. Les tampons posés entre-temps nomment l'ancien — et\n * un tampon qui désigne un compte inexistant rend son organisation muette dès\n * qu'il y a plus d'un compte, c'est-à-dire exactement quand on en a besoin.\n */\nexport async function renameOrgAccount(oldId: string, newId: string): Promise<void> {\n if (oldId === newId) return;\n for (const orgId of await listOrgVaults()) {\n const file = join(orgVaultRoot(orgId), ORG_CLOUD_FILE);\n let stamp: Record<string, unknown>;\n try {\n stamp = JSON.parse(await readFile(file, 'utf-8')) as Record<string, unknown>;\n } catch {\n continue;\n }\n if (stamp['accountId'] !== oldId) continue;\n await writeFile(file, JSON.stringify({ ...stamp, accountId: newId }, null, 2), 'utf-8');\n }\n}\n\n/**\n * Le compte dont chaque organisation relève, lu sur le disque.\n *\n * Pendant exact de `readOrgClouds` : le cloud dit *où* frapper, le compte dit\n * *au nom de qui*. Une organisation sans compte tamponné est celle d'un coffre\n * écrit avant le multicompte ; elle retombe sur le compte unique du poste, ce\n * qui est précisément la situation qu'elle décrivait.\n */\nexport async function readOrgAccounts(): Promise<Record<string, string>> {\n const out: Record<string, string> = {};\n for (const orgId of await listOrgVaults()) {\n try {\n const raw = await readFile(join(orgVaultRoot(orgId), ORG_CLOUD_FILE), 'utf-8');\n const id = (JSON.parse(raw) as { accountId?: unknown }).accountId;\n if (typeof id === 'string' && id) out[orgId] = id;\n } catch {\n // Pas de tampon, ou pas de compte : le poste tranchera avec ce qu'il a.\n }\n }\n return out;\n}\n\n/**\n * Retenir le nom d'une organisation déjà présente ici.\n *\n * Appelé quand le cloud vient de le dire, pour qu'il survive à la déconnexion.\n * Aucun COFFRE n'est créé : une organisation dont ce poste n'a rien n'a pas à\n * recevoir un répertoire pour un simple nom.\n *\n * Le tampon, lui, est écrit même s'il manque — c'est la nuance qui manquait.\n * Tous les coffres ne naissent pas d'une synchronisation : un simple\n * `settingsManager.getSettings(orgId)` crée le répertoire sans passer par\n * `stampOrgCloud`. Renoncer faute de fichier condamnait ces coffres-là à\n * n'afficher qu'un hash pour toujours, quel que soit le nombre de fois où le\n * cloud redit leur nom.\n *\n * Le tampon posé ici ne porte pas de `cloudUrl` : personne ici ne sait de quel\n * cloud vient le coffre, et l'inventer rangerait l'organisation sous le mauvais.\n * Un tampon sans cloud se lit exactement comme l'absence de tampon.\n */\nexport async function rememberOrgName(orgId: string, name: string): Promise<void> {\n const root = orgVaultRoot(orgId);\n if (!existsSync(root)) return;\n const file = join(root, ORG_CLOUD_FILE);\n let stamp: Record<string, unknown> = {};\n try {\n stamp = JSON.parse(await readFile(file, 'utf-8')) as Record<string, unknown>;\n } catch {\n // Pas de tampon, ou illisible : le nom en fonde un.\n }\n if (stamp['name'] === name) return;\n await writeFile(file, JSON.stringify({ ...stamp, name }, null, 2), 'utf-8');\n}\n\n/** Le nom de chaque organisation dont le tampon en porte un. */\nexport async function readOrgNames(): Promise<Record<string, string>> {\n const out: Record<string, string> = {};\n for (const orgId of await listOrgVaults()) {\n try {\n const raw = await readFile(join(orgVaultRoot(orgId), ORG_CLOUD_FILE), 'utf-8');\n const name = (JSON.parse(raw) as { name?: unknown }).name;\n if (typeof name === 'string' && name) out[orgId] = name;\n } catch {\n // Pas de tampon, ou pas encore de nom : l'id fera l'affaire.\n }\n }\n return out;\n}\n\n/**\n * Le logo d'une organisation, gardé à côté de son nom.\n *\n * Même raison d'être que le nom recopié dans le tampon : ce que le poste sait\n * de ses organisations ne doit dépendre ni d'une session cloud ni du réseau.\n * Le nom tient dans le tampon ; les octets, eux, méritent leur propre fichier —\n * `cloud.json` est relu et réécrit à chaque pull, et y mêler 40 Ko de base64\n * ferait payer l'image à des lectures qui n'en veulent pas.\n */\nconst ORG_LOGO_FILE = 'logo.json';\n\ninterface StoredLogo {\n contentType: string;\n base64: string;\n fetchedAt: string;\n}\n\n/** Formats matriciels inertes, la même liste que celle acceptée par le cloud. */\nconst LOGO_TYPES = new Set(['image/png', 'image/jpeg', 'image/webp', 'image/gif']);\n\n/** Garder (ou remplacer) le logo d'une organisation présente ici. */\nexport async function rememberOrgLogo(orgId: string, contentType: string, base64: string): Promise<void> {\n if (!LOGO_TYPES.has(contentType)) return;\n const root = orgVaultRoot(orgId);\n const stored: StoredLogo = { contentType, base64, fetchedAt: new Date().toISOString() };\n await mkdir(root, { recursive: true });\n await writeFile(join(root, ORG_LOGO_FILE), JSON.stringify(stored), 'utf-8');\n}\n\n/** Oublier le logo d'une organisation — elle n'en a plus. */\nexport async function forgetOrgLogo(orgId: string): Promise<void> {\n try {\n await unlink(join(orgVaultRoot(orgId), ORG_LOGO_FILE));\n } catch {\n // Il n'y en avait pas : c'est le résultat voulu.\n }\n}\n\n/**\n * Le logo retenu d'une organisation : ses octets et leur type.\n *\n * Le type est revalidé à la lecture — un fichier trafiqué sur le disque ne doit\n * pas pouvoir faire servir un `image/svg+xml`, donc du script, à l'interface.\n */\nexport async function readOrgLogo(orgId: string): Promise<{ contentType: string; bytes: Uint8Array } | null> {\n try {\n const raw = await readFile(join(orgVaultRoot(orgId), ORG_LOGO_FILE), 'utf-8');\n const { contentType, base64 } = JSON.parse(raw) as Partial<StoredLogo>;\n if (typeof contentType !== 'string' || !LOGO_TYPES.has(contentType)) return null;\n if (typeof base64 !== 'string' || !base64) return null;\n return { contentType, bytes: new Uint8Array(Buffer.from(base64, 'base64')) };\n } catch {\n // Pas de logo retenu, ou fichier illisible.\n return null;\n }\n}\n\n/**\n * Les logos retenus, en data URL, prêts pour un `src`.\n *\n * Le type est revalidé à la lecture : un fichier trafiqué sur le disque ne doit\n * pas pouvoir faire servir un `image/svg+xml` — donc du script — à l'interface.\n */\nexport async function readOrgLogos(): Promise<Record<string, string>> {\n const out: Record<string, string> = {};\n for (const orgId of await listOrgVaults()) {\n const logo = await readOrgLogo(orgId);\n // Pas de logo retenu : l'initiale fera l'affaire.\n if (logo) out[orgId] = `data:${logo.contentType};base64,${Buffer.from(logo.bytes).toString('base64')}`;\n }\n return out;\n}\n\n/** The cloud instance of every org vault that carries a stamp. */\nexport async function readOrgClouds(): Promise<Record<string, string>> {\n const orgsDir = join(machineRoot(), 'orgs');\n const out: Record<string, string> = {};\n let orgIds: string[];\n try {\n orgIds = (await readdir(orgsDir, { withFileTypes: true }))\n .filter((e) => e.isDirectory() && SAFE_ID.test(e.name))\n .map((e) => e.name);\n } catch {\n return out;\n }\n for (const orgId of orgIds) {\n try {\n const raw = await readFile(join(orgsDir, orgId, ORG_CLOUD_FILE), 'utf-8');\n const url = (JSON.parse(raw) as { cloudUrl?: unknown }).cloudUrl;\n if (typeof url === 'string' && url) out[orgId] = url;\n } catch {\n // No stamp (older vault, or never linked here) — simply unknown.\n }\n }\n return out;\n}\n\n/**\n * Les organisations présentes sur ce disque, projets ou non.\n *\n * Distinct de `listCloudVaults`, qui ne voit une organisation qu'à travers ses\n * projets matérialisés : une organisation peut porter des données à elle —\n * agents, clés d'API — sans qu'aucun projet n'ait encore été ouvert ici, et\n * l'ignorer alors reviendrait à les perdre au prochain démarrage.\n */\nexport async function listOrgVaults(): Promise<string[]> {\n const orgsDir = join(machineRoot(), 'orgs');\n try {\n return (await readdir(orgsDir, { withFileTypes: true }))\n .filter((e) => e.isDirectory() && SAFE_ID.test(e.name))\n .map((e) => e.name);\n } catch {\n return [];\n }\n}\n\n/** One cloud project vault found on disk. */\nexport interface CloudVault {\n orgId: string;\n projectId: string;\n root: string;\n}\n\n/**\n * Every cloud project vault present on this machine, by walking\n * `~/.runeya/orgs/<orgId>/projects/<projectId>`.\n *\n * Discovery reads the disk rather than an index on purpose: an index is one\n * more thing that can disagree with what is actually there, and a project\n * present on disk but missing from it is precisely the \"already here, still\n * offered as a download\" bug. Unreadable or foreign directories are skipped in\n * silence — a half-written pull must not take a whole load down.\n */\nexport async function listCloudVaults(): Promise<CloudVault[]> {\n const orgsDir = join(machineRoot(), 'orgs');\n const found: CloudVault[] = [];\n\n let orgIds: string[];\n try {\n orgIds = (await readdir(orgsDir, { withFileTypes: true }))\n .filter((e) => e.isDirectory() && SAFE_ID.test(e.name))\n .map((e) => e.name);\n } catch {\n return found;\n }\n\n for (const orgId of orgIds) {\n const projectsDir = join(orgsDir, orgId, 'projects');\n try {\n for (const entry of await readdir(projectsDir, { withFileTypes: true })) {\n if (!entry.isDirectory() || !SAFE_ID.test(entry.name)) continue;\n const root = join(projectsDir, entry.name);\n // Un répertoire n'est pas un projet : il faut qu'il en porte la fiche.\n //\n // Tout ce qui traînait ici était pris pour un coffre — une copie de\n // sauvegarde, un dossier oublié — et les stores le lisaient, le\n // comptaient, pouvaient le réécrire. Une sauvegarde déposée à côté\n // d'un projet s'est ainsi retrouvée annoncée comme dix-neuf\n // conversations illisibles appartenant à l'organisation.\n //\n // `project.json` est déjà ce qui fait foi ailleurs (`isMaterialized`\n // dans org-sync-scope) : la même règle vaut ici, pour tout le monde.\n if (!(await access(join(root, 'project.json')).then(() => true, () => false))) continue;\n found.push({ orgId, projectId: entry.name, root });\n }\n } catch {\n // Org directory without materialized projects yet.\n }\n }\n return found;\n}\n\n/**\n * Every vault holding data, local first — what stores must read to see it all.\n *\n * Derived from the disk, so it needs no store to have loaded beforehand: a\n * content store can resolve where to read without waiting on the project store.\n */\nexport async function allVaultRoots(): Promise<string[]> {\n const cloud = await listCloudVaults();\n const locals = (await readLocalProjectDirs()).map(localProjectVaultRoot);\n return [...new Set([localVaultRoot(), ...locals, ...cloud.map((v) => v.root)])];\n}\n\n/**\n * A file belonging to the machine rather than to any project.\n *\n * Settings, the audit log, caches: none of them describe a project, and keeping\n * them in the launch directory forced a `.runeya` to exist for someone working\n * only on cloud projects — the very thing vaults remove.\n *\n * For anything ENCRYPTED, use `keyedFilePath` instead.\n */\nexport function machineFilePath(filename: string): string {\n return join(machineRoot(), filename);\n}\n\n/**\n * A machine file whose contents are encrypted.\n *\n * It lives beside the key that opens it, never merely beside the machine. The\n * two are usually the same directory — but a launch directory that owns its own\n * key keeps it (see `keyRoot`), and a file encrypted under that key read from\n * elsewhere would decrypt to blanks, then be saved back blank. Tying the file to\n * its key is what makes that impossible.\n */\nexport async function keyedFilePath(filename: string): Promise<string> {\n return join(await keyRoot(), filename);\n}\n\n/**\n * Where such a file was kept by earlier versions: in the launch directory.\n *\n * Read as a fallback and never written, so a directory shared with an older\n * Runeya keeps working.\n */\nexport function legacyMachineFilePath(filename: string): string {\n return join(localVaultRoot(), filename);\n}\n\n/**\n * Create the local vault, on the way to writing a local project into it.\n *\n * The directory is created here and nowhere else. Runeya no longer makes a\n * `.runeya` just because it was started somewhere: a machine used only for\n * cloud projects should leave the directories it visits untouched, and a\n * `.runeya` appearing in a repository should mean \"there is a local project\n * here\" rather than \"Runeya ran here once\".\n */\nexport async function ensureLocalVault(): Promise<string> {\n const root = localVaultRoot();\n await mkdir(root, { recursive: true });\n return root;\n}\n\n/** Files that mark a directory as already holding an encryption key. */\nconst KEY_FILES = ['.encryption.key.enc', '.runeya-verify'];\n\nlet keyRootPromise: Promise<string> | null = null;\n\n/** True when a directory already holds an encryption key of its own. */\nasync function holdsKey(root: string): Promise<boolean> {\n for (const filename of KEY_FILES) {\n try {\n await access(join(root, filename));\n return true;\n } catch {\n // Not here — keep looking.\n }\n }\n return false;\n}\n\n/**\n * Where this machine's encryption key and its canary live.\n *\n * The key protects everything on the machine — agents, sessions, and the\n * environments of every vault — so there is one, not one per vault, and the\n * machine root is its home.\n *\n * Earlier versions let a launch directory keep a key of its own, which is how a\n * machine ended up with several master passwords and several cloud identities.\n * Such a directory is no longer promoted: the machine key answers as soon as it\n * exists, and the leftover local key is surfaced by `legacyVaultRoot()` so it\n * can be migrated rather than silently obeyed. A machine that has never had a\n * machine key still falls back to the local one, so an un-migrated install\n * keeps opening exactly as before.\n *\n * Resolved once per process: the answer must not change under a running server,\n * and a key written mid-session would otherwise move its own home.\n */\nexport function keyRoot(): Promise<string> {\n keyRootPromise ??= (async () => {\n if (await holdsKey(machineRoot())) return machineRoot();\n return (await holdsKey(localVaultRoot())) ? localVaultRoot() : machineRoot();\n })();\n return keyRootPromise;\n}\n\n/**\n * The launch directory's own key, when the machine key is what we opened.\n *\n * Its presence is the whole trigger for the migration page: this directory\n * holds data encrypted under a key nothing reads any more. Null once migrated,\n * and null too when the local key IS the one in use — there is nothing to\n * migrate then.\n */\nexport async function legacyVaultRoot(): Promise<string | null> {\n const local = localVaultRoot();\n if ((await keyRoot()) === local) return null;\n return (await holdsKey(local)) ? local : null;\n}\n\n/** Test seam: forget the resolved key home. */\nexport function resetKeyRoot(): void {\n keyRootPromise = null;\n}\n","import { z } from 'zod';\nimport { resolve as resolvePath } from 'node:path';\nimport { LAUNCHER_PROJECT_ID_PATTERN } from '@runeya/packages-shared';\n\n/**\n * Every variable Runeya reads from the process environment is prefixed with\n * `RUNEYA_`. Generic names (PORT, HOST, MODE, DATA_DIR…) are deliberately NOT\n * read: Runeya loads the `.env` of the stack it manages, where those names very\n * often belong to the user's own services.\n *\n * The resolved object keeps short field names (`env.PORT`, `env.HOST`, …) —\n * only the environment keys are prefixed.\n */\n\n// Server port, used to derive the default agent port\nconst serverPort = z.coerce.number().int().min(1).max(65535).default(4000).parse(process.env.RUNEYA_HTTP_PORT);\n\nconst defaultAgentPort = process.env.RUNEYA_AGENT_PORT\n ? z.coerce.number().int().min(1).max(65535).parse(process.env.RUNEYA_AGENT_PORT)\n : serverPort + 1;\n\nconst EnvSchema = z.object({\n RUNEYA_HTTP_PORT: z.coerce.number().int().min(1).max(65535).default(4000),\n RUNEYA_HOST: z.string().default('127.0.0.1'),\n RUNEYA_AGENT_PORT: z.coerce.number().int().min(1).max(65535).default(defaultAgentPort),\n RUNEYA_AGENT_HOST: z.string().default('127.0.0.1'),\n RUNEYA_AGENT_BINARY_PATH: z.string().nullable().default(null),\n RUNEYA_DATA_DIR: z.preprocess((v) => (typeof v === 'string' && v.length > 0 ? v : undefined), z.string().default('.runeya')),\n // Home holding the cloud vaults (`<home>/.runeya/orgs/...`). Defaults to the\n // user's home directory; overridden by tests so they never write to the real\n // one, and usable to relocate the vaults on a shared machine.\n RUNEYA_HOME: z.preprocess((v) => (typeof v === 'string' && v.length > 0 ? v : undefined), z.string().nullable().default(null)),\n RUNEYA_CLOUD_URL: z.string().url().nullable().default(null),\n // Cloud front-end (landing) URL — used by the web app for the registration /\n // onboarding flow. Configured on the server at launch; the web fetches it.\n RUNEYA_CLOUD_APP_URL: z.string().url().nullable().default(null),\n RUNEYA_MODE: z.enum(['local-simple', 'cloud']).default('local-simple'),\n RUNEYA_CORS_ORIGIN: z.string().nullable().default(null),\n RUNEYA_LAN_PROXY: z.preprocess((v) => v === 'true' || v === '1', z.boolean()).default(false),\n // Set by the CLI when it was started from a desktop launcher rather than a\n // terminal. The web app surfaces it so the user knows which Runeya they are\n // looking at when several are running.\n RUNEYA_FROM_DESKTOP: z.preprocess((v) => v === 'true' || v === '1', z.boolean()).default(false),\n // `--project <id>` : l'instance n'ouvre que ce projet. L'interface va droit\n // au choix des services et ne propose ni la liste ni le changement de projet.\n RUNEYA_PROJECT_ID: z.preprocess(\n (v) => (typeof v === 'string' && v.trim().length > 0 ? v.trim() : undefined),\n z.string().regex(LAUNCHER_PROJECT_ID_PATTERN, 'RUNEYA_PROJECT_ID: expected a project id').nullable().default(null),\n ),\n // Label shown for this machine in the cloud's \"linked machines\" screen.\n // Defaults to the hostname (see `getDeviceName`); set it explicitly when a\n // single host runs several instances and you want to tell them apart.\n RUNEYA_DEVICE_NAME: z.preprocess(\n (v) => (typeof v === 'string' && v.trim().length > 0 ? v.trim() : undefined),\n z.string().max(64).nullable().default(null),\n ),\n // Lifetime of the JWTs signed by the server (UI session and AI agents).\n // Meant for reproducing an expiry locally, e.g. RUNEYA_JWT_TTL=4s.\n RUNEYA_JWT_TTL: z.preprocess(\n (v) => (typeof v === 'string' && v.trim().length > 0 ? v.trim() : undefined),\n z.string().regex(/^[1-9]\\d{0,5}(s|m|h|d)$/, 'RUNEYA_JWT_TTL: expected e.g. 4s, 30m, 8h, 1d').default('8h'),\n ),\n}).transform((data) => ({\n ...data,\n // Short aliases used throughout the server code\n PORT: data.RUNEYA_HTTP_PORT,\n HOST: data.RUNEYA_HOST,\n MODE: data.RUNEYA_MODE,\n /**\n * Absolute from the start, resolved once against the launch directory.\n *\n * It defaults to a relative `.runeya`, and every caller used to re-resolve it\n * against whatever the process's cwd happened to be. A vault that moves when\n * the process changes directory is a vault that can be silently written to the\n * wrong place — so the answer is fixed here, at boot, and never recomputed.\n */\n DATA_DIR: resolvePath(data.RUNEYA_DATA_DIR),\n HOME_DIR: data.RUNEYA_HOME,\n CLOUD_URL: data.RUNEYA_CLOUD_URL,\n CLOUD_APP_URL: data.RUNEYA_CLOUD_APP_URL,\n CORS_ORIGIN: data.RUNEYA_CORS_ORIGIN,\n AGENT_BINARY_PATH: data.RUNEYA_AGENT_BINARY_PATH,\n DEVICE_NAME: data.RUNEYA_DEVICE_NAME,\n FROM_DESKTOP: data.RUNEYA_FROM_DESKTOP,\n PROJECT_ID: data.RUNE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