Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.
Desktop: Electron client for private deployments
The Electron main process hosts the desktop modules: it loads the
remote Web SPA, enrolls the computer and runs the Go Local Computer daemon
(apps/computer/local-daemon) as its child, which connects to the Runner
Gateway and runs Agents. The daemon exits with the app.
Common Commands
pnpm --filter @linger/desktop test: unit tests (no Electron binary needed).pnpm --filter @linger/desktop typecheck: typecheck the app.pnpm --filter @linger/desktop build: bundledist/with esbuild and build the Go daemon for this machine intodist/computer/<platform>-<arch>/(needs Go).LINGER_DESKTOP_DAEMON_TARGETS=darwin-arm64,darwin-x64(orwin32-x64) builds the targets a package needs;node scripts/build-daemon.mjs --allbuilds every shipped target.pnpm --filter @linger/desktop electron:install: download the Electron binary; pnpm does not run its install script. SetELECTRON_MIRRORwhen the default host is unreachable.pnpm --filter @linger/desktop start: build and run from source.python3 packaging/mac/package.py [--arch arm64|x64]: buildout/Linger-<version>-<arch>.dmgfor Apple silicon and Intel on Linux afternode build.mjswith the darwin daemon targets. The daemon is signed with the app. Needs thedmgtoolimage frompackaging/mac/Dockerfileandrcodesign(ad-hoc signature). Add--developer-id P12 --developer-id-password FILEfor a Developer ID signature with the hardened runtime, and--notary-key JSONto notarize and staple; see the script's docstring.python3 packaging/win/package.py: buildout/Linger-<version>-x64-setup.exe(per-user NSIS installer) andout/Linger-<version>-x64.zipon Linux afternode build.mjswith thewin32-x64daemon target. Needs thewintoolimage frompackaging/win/Dockerfile. Neither is Authenticode-signed. The updater runs the setup program with/update /relaunch(a progress page only; Retry/Cancel prompts stay visible); the portable folder only links to the release page.python3 packaging/linux/package.py: buildout/Linger-<version>-linux-x64.tar.gz(one folder with thelingerexecutable) afternode build.mjswith thelinux-x64daemon target.
Structure
Connector OAuth opens in the system browser. The desktop prepares an expiring, one-time IPv4 loopback callback before TeamHub creates the link. The callback restores the originating window and forwards the return to its signed-in SPA, which requests TeamHub verification.
The Web link preview panel frames other sites. The window drops their framing refusals (
X-Frame-Options, CSPframe-ancestors) for frames of the app, except the panel's frame, namedlinger-url-preview:<id>. When that frame's final response refuses framing, the window sendspreview.frame-refused, and the panel offers the system browser instead, where the user's sign-ins work.src/main/modules.ts:Moduleinterface, typed bus and the host that starts modules in dependency layers and stops them in reverse.src/main/*.ts: one file per module (Enrollment, WorkspaceGrants, ComputerDaemon, Status, PowerGuard, WindowManager, Tray, DesktopIpc).status.ts,tray-menu.tsandtray-icon.tshold the pure status summary, tray menu and tray icons, drawn from the logo PNGs inresources/tray/with a status badge.src/main/local-server.ts: LocalServer, the setup page's Quick Install path. It fetches the pinned Node runtime (sources in the download region's order,scripts/installs/README.md) and unpacks the linger source package into the install location (the default home, or a folder picked under Customize; tar runs inside the target with relative paths, and the finished folder is moved into place withrenameRetrying, which waits out Windows' short-lived locks on new files) and starts the bundleddist/installer/installer.jsheadless (--no-open), which runs every service natively. It drives the installer's local API itself (InstallerApi): the session frominstaller/launch.html, one job for instancedesktopwith the chosen AI runtime and local models, then the job's progress, which the setup page shows as five steps. Each Install or Try Again is a new attempt: its timers and bar start over, and the bar never moves back within one. There is no installer window. When the job waits for the runtime sign-in (itsruntimestagewaiting_user, orRUNTIME_AUTH_REQUIRED), it asks the installer (GET /api/runtime-login) whether the runtime is signed in after all; only when it is not does a "Sign in to " step show, with a dialog. Authorize starts the runtime's own login through the installer (POST /api/runtime-login), which opens the browser on its localhost callback page itself; Desktop opens only a Codex device page. The dialog waits, checks every few seconds and closes once signed in. The printed link and Claude Code's paste-code form sit behind "Having trouble?"; Cancel stops the login (DELETE /api/runtime-login); the dialog also offers installing another runtime instead (a new job with thatsetupChoice). No sign-in secret passes through the page. The dialog also offers BYOK, with the same form as Customize's BYOK (byokFieldsinsetup.html): a base URL used verbatim, an optional path (default/v1) and endpoint (default the runtime's own), key and model. Its refresh button and Test run the installer headless (--list-byok-models,--check-byok, the endpoint and key on stdin), which listsbase + path + /modelsand sends one request tobase + path + endpointin the format the page derived from that address. Then it saves the installed runtime's executable and profile paths (GET /api/instances/desktop/runtime) asruntimeEnvironmentin the Desktop config, and the runtime itssetupChoiceruns (local-modelsruns on Pi) aspreferredRuntime. The daemon config carries that aspreferred_runtime, and the daemon marks that runtime's diagnosticpreferred, so TeamHub creates Another Me and the starter Agents on it while it is ready instead of on the first ready runtime. Then it signs in with the local owner account, switches the window to the server and enrolls this computer, so setup ends on "Linger is ready". That screen shows the owner account from the instance's owner-onlylocal-account.json(setup-account.ts): the email, the password masked until Show, Copy (the main process writes the clipboard and clears it after 60 s if it still holds the password) and "Open account file location" (shell.showItemInFolder); an unreadable file shows why instead. Only the email and file are kept; Show and Copy read the file again, and closing the setup window hides the password. When the installer set a database from the earlier Simplex app aside (simplex-backup-*in the instance, see the local-installation package), the desktop logslocal_server.legacy_data_set_aside, clears its enrollment so it enrolls this computer again in the fresh database, keeps that folder aslegacyBackupin its config so this happens once, and the ready screen says where the earlier data went. After a logout the SPA's login page askswindow.lingerDesktop.localAccount.available()on load, every 15 s and when the window comes back into view; it is true only while the window shows the origin inlocal-server.json, the services arereadyand TeamHub proves it is this installation's server (one check per 2 s at most). The proof:proveLocalServerposts a fresh 32-byte nonce to TeamHub's own port (POST /v0/local/identityon127.0.0.1:<source.ports.teamhub>frominstance.json) and compares, in constant time, its HMAC-SHA256 underTEAMHUB_LOCAL_IDENTITY_KEY(the instance's privatelocal-identity.key, read byreadLocalIdentity) over the nonce and the window's origin. The installer puts the key only in TeamHub's process environment, never inservices.env,native.envor another service's environment, so no other local service can answer. A new key restarts TeamHub. It asks TeamHub's port rather than the web port, which a program could take and relay through. "Sign in with this computer's account":localAccount.signIn()reads the file in the main process and signs the window's session in withsignInWithPassword, which proves the server first and only then posts the password to the same TeamHub port, setting the cookies for the origin; the install-time sign-in does the same. A failed proof logslocal_server.identity_unverifiedwith a reason (never the key, nonce or proof) and says "Linger on this computer is not responding."; the page gets only{ ok }or the reason it failed (mapped by status and error kind bysignInFailure), never the password. Known gap: the proof covers TeamHub, not the web listener. If the web process dies and another program takes the web port while TeamHub stays up, the proof still passes and the sign-in sets the session cookies for the web origin, which that program then receives. The password never leaves for it, but the session does. Asking the web origin for a proof would not help, because the web server forwards/v0to TeamHub and a relay forwards it the same way; a fix needs a check that the web port belongs to the web process the installer started. Every existing session cookie for the origin has the same exposure. On a Mac older thanMIN_MACOS(14.0, theLSMinimumSystemVersionpackaging/mac/package.pywrites), read with Electron'sprocess.getSystemVersion(), it neither fetches Node.js nor runs the installer, and the failed step says "Linger needs macOS 14.0 or later. This Mac runs macOS . Update macOS in System Settings > General > Software Update, then try again."; see Packaging Details for where the minimum comes from. Quick Install installs therecommendationof the localmodels setup report (installer.js --inspect, run for the selected install location as the setup window opens and again when that location changes, including after a failed install). Checks keep their tool cache in the default home, leave alternative locations untouched, and never migrate installations. In the report,local-modelsis the planned model served by Pi, shown with the model, GPU, memory and download (the card's memory is the whole stack's, so "with its services"); otherwise the named runtime, with why there is no local model. The page words each reason by its code and the structured counts or numeric versions it carries (gpuIndex,freeBytes,requiredBytes,detectedCudaVersion,requiredCudaVersion,driverVersion); the tool's message goes only to the main process log (local_server.inspected), never to the page. Under Customize the Local model card stays visible once the check ends: disabled, "Not available on this computer", with that reason. Forcuda-driver-update-requiredandcuda-driver-version-unknown, the page explains the NVIDIA driver requirement and shows Check again (local.recheck) so the user can re-check after updating the driver. Off macOS the page names the system tray, not the menu bar. Under Customize the local model runs only behind Pi: with another runtime it is greyed (aria-disabled, still focusable), does not toggle, and says "Local models are only available with the Pi runtime."; choosing another runtime clears it, and choosing Pi offers it again. When the tool reports local models blocked now (stack.state: "blocked-now": the model fits the hardware, but other programs hold the memory it needs now; a tool before that field marks it bybasis: "capacity"or reasonfree-memory-required, either one), the install would plan again against the memory free then and stop, so the local model shows on hold and is not offered.gpu-memory-requirednames the GPU and its free against needed memory and says to close programs that use the GPU;free-memory-requiredgives the RAM counts (from the reason, or the tool'sstack.memorywhen the reason has none). The page still wordsgpu-ownership-unknown, which localmodels 0.1.0.dev39 reports. Quick Install installs the runtime the installer recommends instead, and Check again (local.recheck) runs the check again. A tool beforestack.statestill recommendslocal-modelsthere, so the installer's setup adapter (packages/local-installation/src/setup-plan.ts) replaces that pick with an installed runtime (signed-in first), else Codex; that override and the fallbacks go once the pinned tool reportsstate. The page adds no host rule of its own; while the check runs the button waits with a spinner and says what it waits for (the first run downloads the localmodels tool, counted bydownloadevent lines before the report), and Customize marks the recommended runtime and model. While installing, a step that downloads shows its bytes, what remains and the rate from the installer's byte counter (localmodels.stack-progress/v1for the local model and engine); a counter of one file (partial) shows only that file. When the check fails the installer picks, or Codex when it cannot inspect the computer either. It records the install location, source, origin and engine indesktop/local-server.jsonunder the default home (written to a temporary file and renamed, so a power loss leaves the old record or none) and, while the window still uses that origin and the computer is enrolled, restarts the services on launch withinstaller.js --resume, which also restarts them when the instance'suser.envchanged. When another program took the web port, the installer moves the services to a free one and reports the new origin (details.origin, or the setup job'sorigin). The record, the window'sserverUrland thesavedEnrollmentsentry follow it together (setServerwith the previous origin emitsserver.moved, notserver.changed), so the Computer stays enrolled: it reaches TeamHub through the gateway URL TeamHub gave it, and the session cookies are not port-scoped. The record andserverUrlchange only together, so a later launch still resumes. A source folder removed since, or one the installer no longer accepts as a Linger checkout (such as one the earlier Simplex app unpacked, or this package's own folder with files missing since), is unpacked again from the app's package first and replaces the recorded one. The record also names the app version that unpacked the source; when this app brings another source package (it was installed over an older one), that launch unpacks it and resumes on it, with the "Updating Linger" page instead of the older interface. Only when the installer reports the services serving from the new folder (details.source) and the origin answers does it record that folder and prune the older one; otherwise the older services keep running from their folder, the record keeps naming it, and the start failure page's Retry moves them again. An app older than the recorded version (a downgrade) leaves the services on their newer source and logslocal_server.source_newer_than_app. When the local model stops a resume, the start failure names the stack's first known binding reason code (details.reasons, such aspi-extensions-unavailable) in its own words and, bydetails.code, the action that works: Try Again forLOCAL_MODELS_RECOVERY_REQUIRED(the resume applies the approved plan again), Set Up Again to review a new plan or choose another runtime. A Quick Install that stopped before the computer enrolled is not resumed: setup shows again and Install finishes it, reusing a finished job only while its origin answers (a stopped server gets a new job, which starts the services again). The start failure page's Set Up Again forgets the record (local-server.json), clears the active enrollment while keeping per-originsavedEnrollmentsinconfig.json(legacy_data_set_asideclearssavedEnrollmentsas well), clears the server address, and shows setup; the instance and its data stay.Enrollment(src/main/enrollment.ts) sends the localdaemon_idderived from<userData>/computer/state/daemon-identity.json's public key along with any rememberedcomputerIdfor that origin and owner so re-enrolling or recovering an interrupted exchange renews the existing Computer ID and surfacesDAEMON_IDENTITY_IN_USE/DAEMON_IDENTITY_MISMATCHconflicts. It sendsdaemon_idonly when the server's/v0/melists thelocal_computer_enrollment_daemon_idserver capability; a TeamHub older than the desktop omits it and would reject the field.config.jsonkeeps thedaemonIdthe active enrollment named, and at start an enrollment that named none or another one is renewed once the server lists the capability, so a computer an earlier Set Up Again paired anew gets back the Computer that holds its Daemon Identity, with its Agents. TeamHub removes the Computer the renewal named when it never bound a Daemon Identity and has no Agents (the orphan that earlier Set Up Again left), in the same transaction. Before installing or resuming it moves theCOMPOSIO_API_KEY,SONIOX_API_KEY,XAI_API_KEYandTZof an unpacked source package's.envinto<home>/instances/desktop/user.envonce and deletes that.env(never aLINGER_CHECKOUT's), logging only the names of other values it drops; the installer reads onlyuser.envfor the desktop. Setup fails immediately onidentity_conflict,auth_failed, orupgrade_requireddaemon connection states (computer-daemon.tsmapsidentity-conflicttoidentity_conflict, andstatus.tssummarizes it as an error asking to reconnect), then waits up to five minutes for the server to create the Another Me and for the enrolled Computer to reportonlinewhenlocal-computersis served; on timeout it readslocal-computersand says what is missing (offline computer, no writable folder, or no signed-in runtime with each runtime's reported state) and logslocal_server.another_me_missingorlocal_server.computer_offline_after_agents. Customize → API keys takes the Composio key only (provider-keys.ts); voice keys are saved in the app, and aSONIOX_API_KEYorXAI_API_KEYwritten intouser.envby hand still reaches the services and overrides the app's. Install saves the edits before the installer starts (installer.js --instance desktop --user-keys, the keys on stdin) into the owner-onlyinstances/desktop/user.envof the install location, and the page only learns which keys are saved. Both engines pass them to the services whenever they are configured (an edit runs a new job even after a finished one); Native also starts its bundled LiveKit whenever this computer has voice tools, with or without a voice key (see Source Package and Release). There is no settings page after setup yet: keys change on the next Install or Try Again.src/main/diagnostics.ts: Diagnostics, "Show Logs" (opens<userData>/logs) and "Save Diagnostics" (a redactedlinger-diagnostics-<time>.zipin Downloads) for the setup page's failed step, the start failure page and the tray. The zip holds the Desktop logs andconfig.json, the installer job JSON and logs, the instance JSON and service logs under each install home. Credential files (gateway.json,caller.key,control.key,credential.json,launch.html,*.env,*.input.json, keys, cookies, databases) never go in, every saved voice key is replaced wherever a log printed it, and every text passes throughredactplus a secret-key JSON filter, and the person's home folder becomes~. It imports no Electron API, so it is tested with Windows paths on any platform.src/main/diagnostics-upload.ts: "Send Diagnostics" on the same three surfaces, shown only while a receiver is set up (diagnosticsUploadUrlinconfig.json, elseHOSTED_DIAGNOSTICS_UPLOAD_URL, whichbuild.mjsbakes in from the release pipeline'sLINGER_DIAGNOSTICS_UPLOAD_URLsecret and leaves unset in other builds).DiagnosticsSenderbuilds the zip into<userData>/diagnostics-outbox, waits for consent showing every file, the size and the host, uploads it with thelinger.diagnostics-upload/v1protocol and shows the receiver's report id; a retryable failure keeps the zip for Try Again. The setup page draws the flow itself; the tray and the start failure page use native dialogs (diagnostics-dialogs.ts).src/main/window-manager.ts: oneBaseWindowwith two views, the title bar (app://shell/titlebar) and the SPA. macOS keeps native traffic lights, Windows usestitleBarOverlay, Linux draws its own controls. Closing hides the window to the tray. Closing the setup window does not quit either: an installation keeps running, and opening Linger again (a second launch, the Dock, the tray) shows setup until the computer is enrolled (app-window.ts), the main window after. The main window's server form without a server says Back to Setup instead of Cancel. Main window loading policy (windowLoadDecisioninsrc/main/navigation.ts): all server loads (boot,local_ready,resume_ready,server_changed,port_moved,retry,prewarm) pass through one decision helper so duplicateloadURLcalls on hot start are skipped when the target origin is already loaded or pending without a shell page or load failure.BaseWindowis created withshow: falseand revealed on the firstdid-finish-loadordid-fail-loadaftershow(), with a short 1500 ms timeout fallback so a stalled load still reveals the window;preloadAuthenticatedloads the enrolled server in the hidden window without showing it, andprewarmAssetswarms/and/assets/*insession.defaultSession's HTTP cache. On launch the window loadsserverUrlwithout a blocking HTTP probe; ifdid-fail-loadfires andlocalServer.resumable(serverUrl)sees an active resume or a valid matchinglocal-server.json, it shows the Starting page instead ofoffline.html.window.did_finish_loadlogs{ reason, duration_ms, target }with origin + pathname only (never query or hash), andLocalServerresume emitslocal_server.resume_started,local_server.resume_stage(stage,ms),local_server.resume_succeeded(total_ms), andlocal_server.resume_failed(stage,total_ms, redactederrorbounded to 500 chars with query/hash stripped). A resume whose saved BYOK gateway did not come back still succeeds and logslocal_server.byok_gateway_unavailable(code,message).src/main/voice-window.ts: the floating voice window. Electron cannot open Document Picture-in-Picture windows, so the SPA opens a small native window withwindow.open("")under the targetlinger-voice-window-<n>(voiceWindowRequestinnavigation.tsallows only that, from the server's page; every otherwindow.openis still denied) and renders its Voice Mode or Recording window into it, so the call and its state stay in the main page. The window is always on top (on every macOS Space), has no parent so it stays up when the main window is minimized or closed to the tray, and closes with the page (reload, crash, main window closed). While it is open the page is not background-throttled. Only a window the main page itself opened is kept; one from a frame in it is destroyed. It opens at the bottom right of the main window's screen and resizes down to 240x96. Its native close button ends the call or the recording;lingerDesktop.voiceWindow.showMainWindow()(its presence is how the SPA knows the app supports this) restores and focuses the main window, on macOS bringing the app in front of the active one, and the SPA then closes the floating window and keeps the session in the page. An app withoutvoiceWindowkeeps the in-page windows.src/shell/*.html: app-owned pages (title bar, offline/setup page). They have no network access and talk to the main process viasrc/preload/shell.ts. Their text lives in the*.messages.tsbeside them; the main process serves each page throughlocalizePage(src/i18n/page.ts), which adds the page's messages in the current language and the small runtime insrc/shell/messages.html(t,tSpans, anddata-t/data-t-<attribute>fill-in). Markup carries message names, never English or translated text.src/i18n: the shell's languages (English and Simplified Chinese) on the shared core@linger/service-kit/messages.language.tsmatches a language and formats messages;locales/zh-CN.jsonis the shell's Chinese catalog, one namespace per*.messages.ts, following the Web glossary (apps/web/src/i18n/locales/zh-CN.glossary.md).catalog.test.tsfinds every*.messages.tsand fails on a missing or extra translation, a changed placeholder or tag, or a page naming a message it lacks.src/main/language.ts: Language. The shell follows the language picked in the Web client's Settings, which the SPA reports (language.set) once a choice is stored; the main process keeps it in its config. Before any choice it follows the system's preferred languages (Simplified Chinese forzh,zh-CN,zh-Hans-*; English otherwise). A change emitslanguage.changed: the tray menu and status rebuild, the title bar reloads, and the offline page takes it on its next load. The setup page takes the language when it opens; it runs before the SPA has ever reported one, so it uses the stored choice or the system's language. Main-process text (menus, dialogs, notifications) usesLanguage.twith the messages insrc/main/*.messages.ts; a message missing from the catalog shows in English. Errors from transfers and servers stay in English.src/preload/index.ts: the only SPA API,window.lingerDesktop. Itsupdatereads the Updater's state (without the release page URL) and runs the tray's install and check, for the SPA's account menu.src/shared/api.ts,src/shared/shell.ts: preload contract types and IPC channel names.src/main/computer-daemon.ts: ComputerDaemon. While the computer is enrolled it writes<userData>/computer/config.json(owner-only; Computer id, name, Gateway URL, workspace grants and the bundled teamhub CLI directory) and startslinger-computer-daemon --config <file>with the credential inLINGER_COMPUTER_TOKEN(gateway.token_env). The config'sdesktopsection puts the daemon in Desktop mode: no self-update, it exits when its stdin closes, and it reports{"type":"status",...}lines on stdout, which drive the tray and the SPA status. Its log goes to<userData>/logs/computer-daemon.log. Crashes restart with backoff; the exit reason, logged withcomputer_daemon.exitedand shown once starts keep failing, is the last stderr line outside the daemon's log records (a Go crash: itspanic:line), or none; new folders or a new name restart it once tasks finish. On macOS it writes{"type":"hello","features":["permissions.v1"]}to the daemon's stdin after spawn and answerspermission.requestlines withpermission.responsefromsrc/main/system-permissions.ts(the app's own Screen Recording and Accessibility, which shell commands of Agents are attributed to); arelaunchrequest is answered, then quits and relaunches the app. The permission card in the SPA running this computer's own Computer takes Linger's steps (prompt, System Settings, relaunch) and opens CuaDriver's System Settings pane throughlingerDesktop.permissions.actinstead; CuaDriver's prompt and restart, and every step from another page, go through TeamHub to the daemon.src/main/computer-credential.ts: the Gateway credential in<userData>/computer/credential.json(0600).Installs from before the product was renamed Linger move once on start.
index.tsrenames the packaged app's data folder from<appData>/Simplexto<appData>/Lingerbeforeapp.setPath("userData"). ALingerfolder that already holdscomputer/credential.jsonwins and the old folder stays (logged asdesktop.legacy_user_data_kept); one without a credential is set aside asLinger.before-move-<time>, so the Computer keeps its identity. LocalServer runsinstaller.js --migratewhen an instance record still carries asimplex-project name, in the default home and in the homedesktop/local-server.jsonnames when the person chose another install location, before it resumes (packages/local-installation/src/legacy-migration.ts). Instances the installer left unconverted are logged aslocal_server.legacy_instance_skippedwith their home and reason and do not hold the app back; only whendesktopin the home in use stayed unconverted, or the installer could not run there, LocalServer enters the failed state with that reason, and Retry runs the migration again. There is no downgrade path: an older build reads neither the converted instances nor the moved data folder. The bundle ID and Windows AppUserModelID arecom.simplexai.linger.desktop.preview. The Windows setup installs into%LOCALAPPDATA%\Programs\Linger; on upgrade it closes and removes%LOCALAPPDATA%\Programs\Simplexand moves the "Open at login" Run value fromai.simplex.desktop.previewto the new id. The uninstaller (per-user, like the setup) first runsLinger.exe --quit, which a running Linger obeys without asking, then the bundledinstaller.js --instance desktop --stopunderELECTRON_RUN_AS_NODE. That stops the installation manager the desktop started (cancelling a running job) and thedesktopinstance's services in the default home and in the locationdesktop/local-server.jsonnames; services already stopped are left alone and it gives up after about two minutes. When the stop fails, the uninstaller offers Retry; Cancel (the default when silent) ends it with exit code 1 before anything is removed, so the uninstall can be run again. The stop helper records its latest outcome in<home>/installer/stop-latest.jsonand retains the first failure instop-first-failure.json. These bounded records contain only allowlisted failure stages, codes and service names, never error text or paths; a successful retry keeps the first failure. It keeps%APPDATA%\Lingerand the Linger home with all their data; a later install starts the services again (resume, or setup's Install). Setup over an installed release stops it the same way before it replaces the files, since the services run onLinger.exeand hold it open. Setup always stops them with its owninstaller.js, copied to the plugins folder, on the oldLinger.exe: an earlier release's script may not stop them (0.1.2's left TeamHub, web and node-services running on Windows). Each install writesresources\stops-services; a release without it would start on--quit, so setup skips--quitfor it (CloseLinger asks the person to quit a running app). Retry in that prompt runs the stop again. Nothing running: the stop finds nothing and setup goes on. The stop also asks the pinned localmodels kit, when that kit is installed in the home, to unload every model its model library loaded (library status, thenlibrary unloadfor eachloadedmodel), to end its foundations controller underruntime/model-services(foundations stop), and to stop the stack's processes and the gateway the tool started, the library's Bifrost included (stack down); it downloads nothing, and Linger does not end the tool's processes itself. Every stop command runs even when an earlier command fails. A present tool kit that fails verification makes the stop fail, so the uninstaller retains the application for repair and retry. On Windows the tool cannot prove and end a controller from a kit that has no stop command. A quit the person chose (the tray, the app menu, the Dock) does the same for the local models, except the controller, which serves the services that keep running:LocalServerstartsinstaller.js --home <default home> --stop-local-modelsunderELECTRON_RUN_AS_NODE, detached, with its output in<home>/installer/local-models-stop.log, and does not wait for it. If the installed kit fails verification, the helper exits with a failure and logs the repair guidance; the app still quits, and no unverified tool runs. It runs only whendesktop/local-server.jsonnames an installation. The Computer exits with the app, so nothing uses the models until the next launch, whose resume applies the approved plan again even though the services still run, unless the person switched the Computer's model source to a subscription; a BYOK source gets its gateway mounted again instead. A quit for an update or a relaunch, and the--quitof setup or the uninstaller (which stop the models themselves right after), leave them.src/main/legacy-migration.ts: on start, stops a bridge an older version left running and moves its credential and the Desktop 0.16 daemon identity into the daemon layout, so the computer keeps its id.src/main/legacy-bridge.tskeeps only the old bridge paths and the socket handshake that this needs; the bridge itself was deleted.scripts/build-daemon.mjs: cross-compiles the daemon, stamped with theapps/computerrelease the Gateway checks.scripts/stage-computer-tools.mjs: stages the browser and computer-control tools and their Node.js for each daemon target intodist/computer-tools/<target>/with the rootscripts/computer-tool-bundle.mjs;packaging/computer_tools.pyputs them inresources/cli/andresources/runtime/and checks every package for them (see Computer Tools).
Important Conventions
Brand artwork lives in
apps/assets/logo. Its exporter synchronizes desktop resources; macOS tray assets contain only the monochrome L and dot, while other platforms use the full-color dark tile with runtime status badges.Business logic stays in the main process or the backend. The daemon only executes Runner commands.
The gateway credential lives only in the credential file and the daemon's environment, never in
config.jsonor logs. Never log cookies, credentials or channel bodies.Every IPC handler checks that the sender frame is on the configured server origin and validates input with zod. The SPA cannot change the server URL.
Keep Electron imports out of files with unit tests; inject Electron APIs.
Local Full Stack
- In the repository root, start everything with
pnpm devagainst your PostgreSQL (the Web dev server onhttp://127.0.0.1:3000, TeamHub, the Agent Service and the rest), or withdocker compose up --build. - Install the DMG from
packaging/mac/package.py(or runpnpm --filter @linger/desktop start) and enterhttp://127.0.0.1:3000as the server address during setup. That is the only value the user enters; enrollment returns the rest. - With the default local configuration the computer connects to the Agent
Service at
ws://127.0.0.1:4319/v1/runner-gatewayand the bundled teamhub CLI talks toTEAMHUB_BASE_URL. When these services are not reachable from the computer at those addresses (another host, a tunnel), setAGENT_RUNNER_PUBLIC_GATEWAY_URLandTEAMHUB_CLI_BASE_URLto origins the computer can reach. - The computer needs Codex or Claude Code installed and signed in; the
daemon finds them through the login shell PATH. The teamhub CLI runs on
the app's own Node (
ELECTRON_RUN_AS_NODE) in packaged builds and on thenodein PATH from source. The Desktop TeamHub shell launcher useswslpathandWSLENVwhen WSL starts the Windows executable, so the script path andELECTRON_RUN_AS_NODEreach that process correctly. The CLI translates absolute Linux paths for local attachments, input files and Document file outputs using the invoking WSL distribution. Message text and remote paths stay unchanged. The same local file checks apply to the translated path.
Source Package and Release
Read Packaging Details before
changing build.mjs, packaging/, distribution/, the source package, or the
bundled native PostgreSQL, voice tools, TeamHub, or services, and before
building a package.
Development Environment
LINGER_SERVER_URL: initial server origin.LINGER_CHECKOUT: a linger checkout that local installs use instead of the source package; the setup page does not show it. Keys come from the instance'suser.envthere too: the checkout's.envis not read.LINGER_DESKTOP_USER_DATA: separate user data directory.LINGER_COMPUTER_DAEMON: daemon executable to run instead of the bundled one (resources/computer/when packaged,dist/computer/from source).LINGER_BRIDGE_STATE_DIR: where an older version's bridge kept its state, for the one-time migration.LINGER_CODEX_PATH,LINGER_CLAUDE_PATH,LINGER_PI_PATH: absolute runtime paths for the daemon config. OtherLINGER_*andELECTRON_*variables do not reach the daemon. The config'sruntimeEnvironment(the local server's runtime: these paths plusCODEX_HOME,CLAUDE_CONFIG_DIR,PI_CODING_AGENT_DIR) replaces them, names compared case-insensitively for Windows. Its fourLINGER_LOCALMODELS_*paths become the daemon config'slocal_modelssection, which the daemon's model library runs. Every--resumereports the runtime again; a change updatesruntimeEnvironmentand restarts the daemon once its tasks end (computer.runtime), so an install from before the daemon knew the tool gains it.LINGER_LOCALMODELS_DEV_PYTHON,LINGER_LOCALMODELS_DEV_MODULE_DIR: absolute Python and module directory for running a locallocalmodelscheckout in Quick Install and the Desktop Computer without fetching the published kit.LOCALMODELS_DEBUG(simulateortiny) or~/.config/localmodels/debug.jsonenables fast local-model testing in both source and packaged builds.- Without a display, run with
--ozone-platform=headless --disable-gpu. The tray and native menus are skipped in that mode; use Xvfb to check them.