A local-first multi-agent app development platform, built on PenguinHarness
feat(fork): 数据根与安装目录改成 Adelie 自己的(~/.adelie、ADELIE_HOME,旧名仍认)
lmlihengf46c2dfef7f4
diff --git a/FORK-PROGRESS.md b/FORK-PROGRESS.mdindex 2af998c9..0e278ac7 100644--- a/FORK-PROGRESS.md+++ b/FORK-PROGRESS.md@@ -51,8 +51,30 @@服务端测试会看到旧名字 —— 先 `pnpm --filter …core build` 再跑测试。- 遗留(不在这条里):`~/.penguin`、`PENGUIN_*` 环境变量、`penguin` 命令名(2.2 / 2.3),npm scope `@prismshadow/*`(4.1),以及 `penguin.ooo` 那几个上游服务地址(不能瞎改,见下)。-- [ ] 2.2 **数据根**:`~/.penguin` → `~/.adelie`;`PENGUIN_HOME` 等环境变量名是否跟着改,先定口径- (建议:变量名改成 `ADELIE_*`,并在 `resolveRoot()` 里兼容读一次旧名,方便旧数据迁过来)。+- [x] 2.2a **数据根与安装目录**(2026-10-05):`~/.penguin` → `~/.adelie`,变量 `PENGUIN_HOME` →+ `ADELIE_HOME`(旧名仍读一次,作兼容别名)。逐处:`core/src/state/paths.ts` 的 `resolveRoot()`+ (导出 `ROOT_ENV` / `LEGACY_ROOT_ENV` 两个常量,避免别处再写一遍字符串);`server/src/config.ts`+ 从**传入的** env 对象里按同一优先级取(导入那两个常量);`install.sh` / `install.ps1` 的默认安装目录+ → `~/.adelie`(`PENGUIN_INSTALL_DIR` 这个变量名本轮不动,见 2.2b);`cli/src/commands/update.ts` 的+ `defaultInstallDir`;**两个启动脚本** `scripts/launchers/penguin{,.cmd}` 导出+ `ADELIE_HOME="${ADELIE_HOME:-${PENGUIN_HOME:-$DIR/data}}"` —— 安装器的「数据根在程序目录下的+ `data/`」这一约定因此保住,升级不会把旧装的数据「变没」(旧装仍在 `~/.penguin`,装的又是老启动脚本,+ 所以新版本必须自己会算这个路径);`core` 把子进程环境的剥离规则从「`PENGUIN_` 前缀」扩成+ 「`PENGUIN_` / `ADELIE_` 两前缀」(不扩的话 `ADELIE_HOME` 会漏进 Agent 跑的命令,而它指的正是服务端+ 自己在用的那个根 —— 启动脚本会把它导出来)。CLI 文案 / 注释、`packages/core` 里的端口表、示例+ `examples/self-improving-agent/*` 里写死的 `~/.penguin/data` 一并改。+- [ ] 2.2b **剩下的 `PENGUIN_*` 变量名**(约 38 个名字、全仓 ~4400 处):`PENGUIN_PROFILE` /+ `PENGUIN_WEB_DB` / `PENGUIN_LANG` / `PENGUIN_API_TOKEN` / `PENGUIN_INSTALL_DIR` … 本轮**没动** ——+ 纯改名、零功能收益,而 200 来个测试用例都在设 `PENGUIN_HOME`(它们顺带钉住了兼容别名,改一遍等于+ 把这份覆盖也换掉),一次做完更省事:建议与 4.1 的 scope 改名并作一批。这一批里还剩三处「本机也带+ `~/.penguin`」的,各有原因:**桌面壳的 dev 根** `~/.penguin/dev-data`+ (`packages/desktop/src/app-identity.ts`,被 `desktop` 的脚本与 `cli/test/dev-entry-isolation.test.ts`+ 一起钉住 —— desktop 本机不可构建,按纪律没碰);**远程机器布局**+ (`server/src/machines/layout.ts`:`~/.penguin` / `~/.penguin-dev`,探针 + 安装 + 数据根 + 启动命令+ 自洽,改名要连探针一起,属迁移动作);**dev 数据根** `~/.penguin/dev-data*`(`ports.ts` 表里那几行)。+ 文档面同样的道理:`packages/docs/`(2.5 定的「留作内部参考、不发布不改品牌」)、+ `plugins/*/skills/*/SKILL.md` 里「全局根是 `~/.penguin/data`」那几句、`CONTRIBUTING.md`、+ ui-gallery 的演示路径、web 的 `path-capsules.ts` 注释 —— 全是纯文案,等一次「全量换字」一起做。- [ ] 2.3 **端口与 profile 默认值**:服务器默认端口、CLI 默认端口(现在是 7369)与旧 Adelie 的4000 / 7370 对齐,避免两个产品抢端口。- [x] 2.4 **README 与包元数据**(2026-10-05):根 `README.md` 与 `README.zh.md` 重写成 Adelie 自己的@@ -552,6 +574,65 @@ README 插件表那三条已闭,macOS 那条重跑即绿(确系跑机抖动默认分支切到 `fork/penguin-base`(旧 `main` 另存 `legacy/main` = `7fb74262` 留档),仓库 About改成「基于 PenguinHarness」的说法。细节见「发布 v0.2.0」一节。+## 数据根改名:`~/.penguin` → `~/.adelie`(2026-10-05,条目 2.2a)++一次无人值守的自主推进,只做这一条:**本机数据根与安装目录换成 Adelie 自己的家,变量名跟上,旧名字继续认**。+19 个文件,都在仓库里,没有新依赖、没有切版本号、没发 npm、没发安装包。++### 口径(这条本来就写着「先定口径」)++| 东西 | 旧 | 新 | 兼容 |+| --- | --- | --- | --- |+| 数据根默认值 | `~/.penguin/data` | **`~/.adelie/data`** | 不存在旧默认值,是新装的默认 |+| 数据根变量 | `PENGUIN_HOME` | **`ADELIE_HOME`** | 旧名仍读;两个都设时新名赢 |+| 安装目录默认值 | `~/.penguin` | **`~/.adelie`** | `PENGUIN_INSTALL_DIR` 仍认(名字没改) |+| 其余 `PENGUIN_*` | — | — | **本轮不动**,见 2.2b |++**为什么必须连启动脚本一起改**:安装器的约定是「数据根在程序目录下的 `data/`」——于是默认装到+`~/.penguin` 的旧装,它的数据根就是 `~/.penguin/data`,而这个路径**不来自任何环境变量**,是+`resolveRoot()` 自己算出来的。新代码把默认值挪到 `~/.adelie/data` 之后,旧装里那份数据就会「找不到」+(文件还在,界面里像是空了)。所以 `scripts/launchers/penguin{,.cmd}` 现在导出+`ADELIE_HOME="${ADELIE_HOME:-${PENGUIN_HOME:-$DIR/data}}"`:**装在哪,数据根就是那里的 `data/`**,+与安装器原先的约定一致,升级换代时旧数据照旧读得到。++**为什么顺手扩了环境剥离规则**:`core` 把 `PENGUIN_*` 从 Agent 跑的命令里剥掉,就是为了别让+「服务端自己在用的那个数据根」漏进子进程(`core/src/environment/tools/command/session-manager.ts`)。+名字一改,规则不跟上就等于开了一个新口子 —— 而且漏出去的那个变量恰好是数据根。现在两个前缀都剥。++### 验证(都不是推测)++- **静态**:`pnpm --filter …core|server|ui|cli|web|hmr run typecheck` 六个包全过;`pnpm lint`+ 0 警告 0 错误(2007 文件);`pnpm format:check` 干净。+- **测试**:core **1350 通过 / 5 跳过**(比上轮 +4:`resolveRoot` 三个新用例 + 环境剥离的新前缀用例)·+ server **2563 / 2 跳过**(+4:数据根优先级、`web.db` 跟着根走)· cli **505** · ui **1000** ·+ web **2887 / 2 跳过** —— **0 失败**。200 来个只设旧名 `PENGUIN_HOME` 的用例全绿,等于整套兼容别名+ 被真跑了一遍。+- **安装脚本**:`sh scripts/test-installer.sh` 通过(含它对两个启动脚本的守卫)。+- **启动脚本单独实测**(假程序目录 + 一个打印 `resolveRoot()` 的桩 CLI):无变量 → `<程序目录>/data`;+ 设 `ADELIE_HOME` → 用它;只设旧名 `PENGUIN_HOME` → 沿用;不经启动脚本的裸 `node` → `~/.adelie/data`。+- **真离线装一遍**:隔离 HOME,用**本仓库的** `install.sh --archive payload.tar.gz --universal`+ → 装进 `~/.adelie`,`~/.penguin` **没有被创建**;再把仓库的启动脚本放进那个真实布局跑一遍+ → 数据根解析为 `~/.adelie/data`;把同一棵树搬到 `~/.penguin` 形状(模拟改名前的安装)→+ `~/.penguin/data`,即旧数据仍然找得到。+- **真起服务**:`ADELIE_HOME=/tmp/… PENGUIN_PROFILE=dev PORT=7408 node dist/index.js`,用 Playwright ++ 本机 chromium 打开:标题 `Sign in · Adelie`、登录页正常、**唯一 4xx 是登录前的 `/api/me` 401**;+ 用旧名 `PENGUIN_HOME` 起的两个实例(7401 / 7404)同样照常服务 —— 兼容读旧名这条是跑出来的,不是推的。+- 中间物已清(`/tmp` 回到 2.0G 可用),3003 / 3004 / 4000 全程没碰。++### 一个没解释清楚的现象(留个记录,下一轮留意)++第一次起服务(全新数据根,7403)时,进程 4 分钟 83–91% CPU、端口在 LISTEN 但任何请求都不回;+**同一份代码、同一个根、同一套启动形状**随后重跑(7406 / 7407 / 7408)都是秒级应答,`--prof` 采样里+也没有热的 JS 函数(54% 落在 native/GC)。当时唯一特别的是上一次 Playwright 的 `networkidle` 超时把+chromium 丢在**导航中途**(没关掉)。没能复现,所以**没有改任何代码**,只记在这里。++### 与另一条线的交汇++本轮开工时 `git status --short` 是干净的(那时 `main` 头是 `2d6abe83`,台账里「已完成的轮次」最后一行+还是第四轮)。开工后一分钟(15:01)另一条线在这个 worktree 里提交了 `188990af`「记第五轮(…)与+v0.2.2」——它只加台账里 v0.2.2 那一节与两行表格,**跟本轮改的文件没有重叠**;本轮的改动都还在工作区里、+按本行的提交上去(`git diff` 只含本轮自己的内容)。下一轮开工时照纪律先看 `git status --short`。+## 已完成的轮次| 日期 | 条目 | 做了什么 | 验证 | 提交 |@@ -573,5 +654,6 @@ README 插件表那三条已闭,macOS 那条重跑即绿(确系跑机抖动| 2026-10-05 | 主线收尾 | 「主线三件事」的收尾:桌面更新源去 OSS/探针、根安装脚本去 OSS/探针并指向 Adelie、插件元数据 `repository` 指向 Adelie;顺带修 web 更新弹窗的上游 Releases 链接;`scripts/test-installer.{sh,ps1}` 同步重写 | `sh scripts/test-installer.sh` 通过;`pnpm typecheck` 八包过、`pnpm lint` 0 警告、`pnpm format:check` 干净;core 1346 · server 2552 · cli 505 · web 2886 · desktop 279 全绿 | 见本行提交 || 2026-10-05 | 第四轮 | 工作区选择器支持**新建文件夹**(server `POST /dirs` + Finder 工具栏/右键菜单/内联命名框);侧栏列表选项下拉不再截断文案;画廊 mock 补 `createDir` 路由;写 `RELEASE-v0.2.1.md` | `pnpm typecheck` 八包过、`pnpm lint` 0 警告、`pnpm format:check` 干净;`pnpm -r test` **8837 通过 / 14 跳过 / 0 失败**(docs 62 · core 1346 · ui 999 · server 2557 · cli 505 · web 2887 · desktop 279 · ui-gallery 131 · 四个沙箱插件 71);浏览器实跑建目录/重名/右键菜单 | `301b80a6` `1e3c7c5c` `19ea80fa` || 2026-10-05 | 第四轮 | 升级 **v0.2.1**:tag + GitHub Release(无资产)+ 重打三件安装包放 3003 `/downloads/v0.2.1/`(`BUILD_COMMIT=19ea80fa`);3003 下载区导语不再写死版本;3004 `disable` | 见「v0.2.1:工作区新建文件夹、侧栏下拉与插件手动更新」一节 | tag `v0.2.1` = `19ea80fa` |+| 2026-10-05 | 2.2a | 数据根与安装目录改成 Adelie 自己的:默认 `~/.adelie/data` 与 `~/.adelie`、变量 `ADELIE_HOME`(旧名 `PENGUIN_HOME` 仍读,弹夹在 `resolveRoot()`)、两个启动脚本导出 `ADELIE_HOME=<程序目录>/data`(保住旧装的数据所在)、子进程剥离规则扩到两个前缀;CLI 文案/注释/示例跟上 | 六个包 typecheck 全过;`pnpm lint` 0 警告;`pnpm format:check` 干净;core 1350 / server 2563 / cli 505 / ui 1000 / web 2887 全绿;`test-installer.sh` 通过;启动脚本与「隔离 HOME 离线装进 `~/.adelie`」真跑过;新旧两种数据根各起服务 + 浏览器看过(唯一 4xx 是登录前 401) | 见本行提交 || 2026-10-05 | 第五轮 | 初始 Project 名补成 `default`(core 常量 + `ensureDisplayName` + 启动扫描 + 三条测试);zh 字典 68 处 `Project` → 「项目」;`PrefRow` 手机宽度改为可换行、导入 Trace 不再压住;草稿行删除按钮在触摸屏上常显 | `pnpm typecheck` 八包过、`pnpm lint` 0 警告、`pnpm format:check` 干净;`pnpm -r test` **8840 通过 / 14 跳过 / 0 失败**(docs 62 · core 1346 · ui 1000 · server 2559 · cli 505 · web 2887 · desktop 279 · ui-gallery 131 · 四个沙箱插件 71);浏览器实测四项(含**老数据根升级**、390px 触摸屏) | `e960d0b1` || 2026-10-05 | 第五轮 | 升级 **v0.2.2**:tag + GitHub Release(无资产)+ 重打三件安装包放 3003 `/downloads/v0.2.2/`(`BUILD_COMMIT=2d6abe83`),打包脚本改「边做边清」把峰值从 1.5G 压到 ~0.3G | 见「v0.2.2:默认项目名 default、中文文案、手机上的导入 Trace 与草稿」一节 | tag `v0.2.2` = `2d6abe83` |diff --git a/examples/self-improving-agent/self-evolve-recursive.ts b/examples/self-improving-agent/self-evolve-recursive.tsindex 2404a558..4b29d38d 100644--- a/examples/self-improving-agent/self-evolve-recursive.ts+++ b/examples/self-improving-agent/self-evolve-recursive.ts@@ -91,7 +91,7 @@ Reviewed-by: Aurora Team`;function rootDir(): string {- return process.env.PENGUIN_HOME ?? path.join(os.homedir(), ".penguin", "data");+ return process.env.ADELIE_HOME ?? path.join(os.homedir(), ".adelie", "data");}function agentStateDir(): string {return path.join(rootDir(), PROJECT_ID, "agents", AGENT_ID, "agent_state");diff --git a/examples/self-improving-agent/self-evolve.ts b/examples/self-improving-agent/self-evolve.tsindex f4e8d83a..05d45612 100644--- a/examples/self-improving-agent/self-evolve.ts+++ b/examples/self-improving-agent/self-evolve.ts@@ -71,7 +71,7 @@ Reviewed-by: Aurora Team`;function rootDir(): string {- return process.env.PENGUIN_HOME ?? path.join(os.homedir(), ".penguin", "data");+ return process.env.ADELIE_HOME ?? path.join(os.homedir(), ".adelie", "data");}function agentStateDir(): string {return path.join(rootDir(), PROJECT_ID, "agents", AGENT_ID, "agent_state");diff --git a/examples/self-improving-agent/self-improve.ts b/examples/self-improving-agent/self-improve.tsindex 4e4681ce..dc5631f5 100644--- a/examples/self-improving-agent/self-improve.ts+++ b/examples/self-improving-agent/self-improve.ts@@ -69,9 +69,9 @@ When a task lists explicit rules or an exact output format, follow this disciplisentence count, bullet count, word count), fixing any mismatch first.`;-/** rootDir mirrors the SDK's resolveRoot(): PENGUIN_HOME or ~/.penguin/data. */+/** rootDir mirrors the SDK's resolveRoot(): ADELIE_HOME or ~/.adelie/data. */function rootDir(): string {- return process.env.PENGUIN_HOME ?? path.join(os.homedir(), ".penguin", "data");+ return process.env.ADELIE_HOME ?? path.join(os.homedir(), ".adelie", "data");}function agentStateDir(): string {diff --git a/install.ps1 b/install.ps1index e4931069..c0303e5a 100644--- a/install.ps1+++ b/install.ps1@@ -5,7 +5,7 @@# Options:# $env:PENGUIN_VERSION = "vX.Y.Z" choose a version (same as -Version vX.Y.Z); a published Release# installer defaults to its own version, an unstamped source copy to latest-# $env:PENGUIN_INSTALL_DIR = "<dir>" install dir; default $env:USERPROFILE\.penguin+# $env:PENGUIN_INSTALL_DIR = "<dir>" install dir; default $env:USERPROFILE\.adelie# $env:PENGUIN_ARCHIVE = "<file>" install a local Release zip without network access (same as -ArchivePath)# $env:PENGUIN_DOWNLOAD_SOURCE = "auto|github" choose the online source; default auto (GitHub Releases)# $env:PENGUIN_DOWNLOAD_BASE_URL = "https://..." exact online asset directory selected by the stable forwarder@@ -25,8 +25,9 @@# There is no -Universal on Windows: where the zip is unsuitable, install Node.js >= 24 and run# `npm install -g @prismshadow/penguin-cli` instead.#-# The data dir (%USERPROFILE%\.penguin\data) sits under the install home but is never touched by+# The data dir (%USERPROFILE%\.adelie\data by default) sits under the install home but is never touched by# reinstall/upgrade (which only replace bin/lib/web/node/git). Upgrading = re-running this installer.+# The launcher exports the root it lives under, so an install made before the rename keeps its data.## Docs: https://penguin.ooo/docs/quickstart-cliparam(@@ -139,7 +140,7 @@ function Restore-PreviousInstall(# --- Resolve options (parameters win over env vars, mirroring install.sh's --version) ---if (-not $Version) { $Version = if ($env:PENGUIN_VERSION) { $env:PENGUIN_VERSION } else { "" } }if (-not $InstallDir) {- $InstallDir = if ($env:PENGUIN_INSTALL_DIR) { $env:PENGUIN_INSTALL_DIR } else { Join-Path $env:USERPROFILE ".penguin" }+ $InstallDir = if ($env:PENGUIN_INSTALL_DIR) { $env:PENGUIN_INSTALL_DIR } else { Join-Path $env:USERPROFILE ".adelie" }}if (-not $ArchivePath) {$ArchivePath = if ($env:PENGUIN_ARCHIVE) { $env:PENGUIN_ARCHIVE } else { "" }@@ -297,7 +298,7 @@ try {# --- Extract into staging, then swap by same-volume renames. Keep the previous dirs in .old.$PID# until the installed command runs successfully; any move or launch failure restores them.- # The data dir (%USERPROFILE%\.penguin\data) is never part of the swap. ---+ # The data dir (%USERPROFILE%\.adelie\data by default) is never part of the swap. ---New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null$Staging = Join-Path $InstallDir ".staging.$PID"$OldDir = Join-Path $InstallDir ".old.$PID"diff --git a/install.sh b/install.shindex 5a77c92a..a51b7338 100644--- a/install.sh+++ b/install.sh@@ -6,7 +6,7 @@# Options:# PENGUIN_VERSION=vX.Y.Z choose a version (same as --version vX.Y.Z); a published Release# installer defaults to its own version, an unstamped source copy to latest-# PENGUIN_INSTALL_DIR=<dir> install dir; default ~/.penguin+# PENGUIN_INSTALL_DIR=<dir> install dir; default ~/.adelie# PENGUIN_ARCHIVE=<file> install a local Release archive without network access (same as --archive <file>)# PENGUIN_DOWNLOAD_SOURCE=auto|github choose the online source; default auto (GitHub Releases)# PENGUIN_DOWNLOAD_BASE_URL=<url> exact online asset directory selected by the stable forwarder@@ -24,7 +24,7 @@# v0.1.5 shipped the program tree directly (top-level penguin/); such archives are still# accepted, from --version pins and --archive files alike.#-# The data dir (~/.penguin/data) sits under the install home but is never touched by reinstall/upgrade (which only replace bin/lib/web/node).+# The data dir (~/.adelie/data by default) sits under the install home but is never touched by reinstall/upgrade (which only replace bin/lib/web/node). The launcher exports the root it lives under, so an install made before the rename (at ~/.penguin) keeps reading its own data there.## Docs: https://penguin.ooo/docs/quickstart-cliset -eu@@ -33,7 +33,7 @@ REPO="https://github.com/lmliheng/Adelie"GITHUB_RELEASE_ROOT="$REPO/releases/download"GITHUB_LATEST_BASE="$REPO/releases/latest/download"VERSION="${PENGUIN_VERSION:-}"-INSTALL_DIR="${PENGUIN_INSTALL_DIR:-$HOME/.penguin}"+INSTALL_DIR="${PENGUIN_INSTALL_DIR:-$HOME/.adelie}"BIN_DIR="$HOME/.local/bin"MODIFY_PATH=1UNIVERSAL=0diff --git a/packages/cli/src/client.ts b/packages/cli/src/client.tsindex 4371231e..8023df36 100644--- a/packages/cli/src/client.ts+++ b/packages/cli/src/client.ts@@ -10,7 +10,7 @@* 2. `PENGUIN_API_URL` — the same, from the environment. Server-driven sessions inject* it (with PENGUIN_API_TOKEN) into tool subprocesses, which is how an agent's own* `penguin` calls find the server that runs them.- * 3. A live `server.lock` at the data root (PENGUIN_HOME or ~/.penguin/data): attach to+ * 3. A live `server.lock` at the data root (ADELIE_HOME or ~/.adelie/data): attach to* the running local server on `http://localhost:<port>`.* 4. Auto-start: spawn a detached `node <cli entry> server` with PORT=0, wait for its* lock, attach. The loser of a two-CLI spawn race exits with code 3 ("alreadydiff --git a/packages/cli/src/commands/config.ts b/packages/cli/src/commands/config.tsindex ac378508..e1fbeef5 100644--- a/packages/cli/src/commands/config.ts+++ b/packages/cli/src/commands/config.ts@@ -29,7 +29,7 @@* found in models; `model remove` reports the same condition itself, since removal is* idempotent in core, and clears the default / vision pointers that named the removed entry.* `--root` specifies the data root directory (priority: option >- * PENGUIN_HOME > ~/.penguin/data). The UI language is controlled by the PENGUIN_LANG+ * ADELIE_HOME > ~/.adelie/data). The UI language is controlled by the PENGUIN_LANG* environment variable; `config lang` writes it into the shell startup file and restarts* the shell to take effect.* Docs: /docs/cli § "penguin config".diff --git a/packages/cli/src/commands/update.ts b/packages/cli/src/commands/update.tsindex a7841fec..eb61fa13 100644--- a/packages/cli/src/commands/update.ts+++ b/packages/cli/src/commands/update.ts@@ -5,7 +5,7 @@** There is no single upgrade mechanism, because there is no single install mechanism: the* documented path is the tarball installer (install.sh unpacks bin/lib/web/node into- * PENGUIN_INSTALL_DIR, default ~/.penguin), some users have a global npm install of+ * PENGUIN_INSTALL_DIR, default ~/.adelie), some users have a global npm install of* @prismshadow/penguin-cli, and developers run out of a source checkout. This command works out* which one it is from the real path of the running CLI and upgrades the way that install was* made — never by guessing. A source checkout is refused outright: overwriting a working tree@@ -51,7 +51,7 @@* which would interpolate a user-supplied release tag into a command line — both cases are refused* up front with the command the user should run themselves.*- * The data root (~/.penguin/data) is never touched — the installer only replaces bin/lib/web/node+ * The data root (~/.adelie/data) is never touched — the installer only replaces bin/lib/web/node* — and the confirmation prompt says so, because that is the thing users worry about.* Docs: /docs/cli § "penguin update".*/@@ -217,7 +217,7 @@ export function globalInstallCommand(* Builds the argv and environment for re-running install.sh, preserving the shape of the install* being upgraded rather than the defaults:*- * - `PENGUIN_INSTALL_DIR` is passed whenever the install is not at the default `~/.penguin`, or+ * - `PENGUIN_INSTALL_DIR` is passed whenever the install is not at the default `~/.adelie`, or* the upgrade would silently relocate it;* - `--universal` is passed when the current install has no bundled `node/` directory, or the user* would silently gain a runtime they deliberately did not install (and lose it in reverse);@@ -462,7 +462,7 @@ export function planUpdate(input: {install: InstallInfo;modulePath: string;platform: string;- /** `~/.penguin`, passed in rather than read, so the tarball branch stays pure. */+ /** `~/.adelie`, passed in rather than read, so the tarball branch stays pure. */defaultInstallDir: string;}): UpdatePlan {const { current, target, install } = input;@@ -529,7 +529,7 @@ export function registerUpdateCommand(program: Command, t: Messages): void {const release = await resolveRelease(opts.release, t);const target = release.version;const modulePath = selfPath();- const defaultInstallDir = path.join(homedir(), ".penguin");+ const defaultInstallDir = path.join(homedir(), ".adelie");const plan = planUpdate({current,target,diff --git a/packages/cli/src/i18n.ts b/packages/cli/src/i18n.tsindex 27d48d66..f006eb23 100644--- a/packages/cli/src/i18n.ts+++ b/packages/cli/src/i18n.ts@@ -34,7 +34,7 @@ export interface Messages {modelId: string;/** run/chat's --provider: must be given together with --model-id (the group is never inferred). */provider: string;- /** Data root directory option (priority: --root > PENGUIN_HOME > ~/.penguin/data). */+ /** Data root directory option (priority: --root > ADELIE_HOME > ~/.adelie/data). */root: string;workspace: string;approve: string;@@ -1016,7 +1016,7 @@ const en: Messages = {modelId: "Model to use (upstream model id; defaults to the Project default model)",provider:"Provider group of --model-id; required whenever --model-id is given (the group is never inferred)",- root: "Data root directory (overrides PENGUIN_HOME and ~/.penguin/data)",+ root: "Data root directory (overrides ADELIE_HOME and ~/.adelie/data)",workspace: "Workspace directory; must already exist (defaults to the current directory)",approve:"Approval mode: allow-all (auto-approve, default), deny-all (auto-reject), read-only (auto-approve read-only tools, prompt for the rest), always-ask (prompt per tool)",@@ -1939,7 +1939,7 @@ const en: Messages = {webReady: (url) => `Web UI ready: ${url}`,serverAlreadyRunning: (url) =>`An Adelie server is already running on this data root: ${url}\n` +- `Stop it first, or point PENGUIN_HOME at a separate data root.`,+ `Stop it first, or point ADELIE_HOME at a separate data root.`,webAlreadyRunning: (url) =>`Already running on this data root — opening the existing instance: ${url}`,webProbeFailed: (url, detail, kind, port) => {@@ -1968,7 +1968,7 @@ const zh: Messages = {agentId: "Agent id",modelId: "本次使用的模型(上游模型 id;默认 Project 默认模型)",provider: "--model-id 的 provider 分组;给出 --model-id 时必须一并给出(分组不作任何推断)",- root: "数据根目录(优先于 PENGUIN_HOME 与 ~/.penguin/data)",+ root: "数据根目录(优先于 ADELIE_HOME 与 ~/.adelie/data)",workspace: "Workspace 目录,须为已存在目录(默认当前目录)",approve:"审批模式:allow-all(全部放行,缺省)、deny-all(全部拒绝)、read-only(自动放行只读工具,其余仍逐个询问)、always-ask(逐个询问)",@@ -2825,7 +2825,7 @@ const zh: Messages = {vaultListEmpty: () => "vault 为空。用 `penguin config vault set` 添加。",webReady: (url) => `Web 界面已就绪:${url}`,serverAlreadyRunning: (url) =>- `该数据根目录已有 Adelie 服务在运行:${url}\n请先停止它,或用 PENGUIN_HOME 指定另一个数据根目录。`,+ `该数据根目录已有 Adelie 服务在运行:${url}\n请先停止它,或用 ADELIE_HOME 指定另一个数据根目录。`,webAlreadyRunning: (url) => `该数据根目录已有服务在运行,打开既有实例:${url}`,webProbeFailed: (url, detail, kind, port) => {const hint = {diff --git a/packages/cli/src/root-option.ts b/packages/cli/src/root-option.tsindex 5cc515e0..952c910e 100644--- a/packages/cli/src/root-option.ts+++ b/packages/cli/src/root-option.ts@@ -2,13 +2,13 @@* The `--root` option's meaning, in one place.** Every command that touches the data root offers it, and the priority is a documented part- * of the CLI's contract (/docs/cli): the option wins, then PENGUIN_HOME, then the default+ * of the CLI's contract (/docs/cli): the option wins, then ADELIE_HOME, then the default* root. Two copies of that rule is two chances for one of them to drift.*/import path from "node:path";import { resolveRoot } from "@prismshadow/penguin-core";-/** Data root: `--root` first (relative paths against cwd), else PENGUIN_HOME / ~/.penguin/data. */+/** Data root: `--root` first (relative paths against cwd), else `ADELIE_HOME` / ~/.adelie/data. */export function resolveRootOption(root: string | undefined): string {return root !== undefined ? path.resolve(root) : resolveRoot();}diff --git a/packages/cli/test/dev-entry-isolation.test.ts b/packages/cli/test/dev-entry-isolation.test.tsindex f1710a89..d12e2d02 100644--- a/packages/cli/test/dev-entry-isolation.test.ts+++ b/packages/cli/test/dev-entry-isolation.test.ts@@ -60,8 +60,8 @@ const devServer = runWithEnvDefaults(serverScripts["dev"]);const devCli = runWithEnvDefaults(rootScripts["penguin"]);const devDesktop = runWithEnvDefaults(rootScripts["desktop"]);-/** The installed server/CLI root, `~/.penguin/data` (core's resolveRoot() default). */-const installedRoot = path.join(os.homedir(), ".penguin", "data");+/** The installed server/CLI root, `~/.adelie/data` (core's resolveRoot() default). */+const installedRoot = path.join(os.homedir(), ".adelie", "data");describe("dev entry point isolation (ports and data roots)", () => {it("dev:server and the dev CLI each declare a port and a data root", () => {diff --git a/packages/core/src/agent.ts b/packages/core/src/agent.tsindex d5aac024..3aa16a88 100644--- a/packages/core/src/agent.ts+++ b/packages/core/src/agent.ts@@ -121,7 +121,7 @@ const MAX_SUBAGENT_DEPTH = 1;export interface CreateAgentOptions {agentId?: string;projectId?: string;- /** Local data root directory; defaults to `resolveRoot()` (PENGUIN_HOME or ~/.penguin/data). */+ /** Local data root directory; defaults to `resolveRoot()` (ADELIE_HOME or ~/.adelie/data). */root?: string;/*** Proxy policy for exec_command subprocess environments of every Session this Agentdiff --git a/packages/core/src/environment/tools/command/session-manager.ts b/packages/core/src/environment/tools/command/session-manager.tsindex 6ca827fe..d366142d 100644--- a/packages/core/src/environment/tools/command/session-manager.ts+++ b/packages/core/src/environment/tools/command/session-manager.ts@@ -66,10 +66,11 @@ const HARDENED_ENV: NodeJS.ProcessEnv = {* colors on". The vault still wins, so a user who genuinely wants forced color in commands can* set it there.*- * Every `PENGUIN_*` variable is removed as well — see {@link HARNESS_ENV_PREFIX}. That covers- * `PENGUIN_HOME` and `PENGUIN_WEB_DB`, which select the *data* an Agent-started harness works- * against. They were once left inheriting on the grounds that the self-development case may- * legitimately want the same data root, but inheriting them is not that decision being made — it+ * Every `PENGUIN_*` and `ADELIE_*` variable is removed as well — see {@link HARNESS_ENV_PREFIXES}.+ * That covers `PENGUIN_HOME` / `ADELIE_HOME` and `PENGUIN_WEB_DB`, which select the *data* an+ * Agent-started harness works against. They were once left inheriting on the grounds that the+ * self-development case may legitimately want the same data root, but inheriting them is not that+ * decision being made — it* is an accident of where this process happens to be running. Whenever an Agent spawns a command* the harness is by definition up, holding `<root>/server.lock`, so an Agent-started server on the* inherited root cannot start at all; it exits 3 against a lock whose owner is the very process@@ -97,12 +98,18 @@ const STRIPPED_ENV_KEYS = new Set([]);/**- * Every variable named `PENGUIN_*` is this installation's own configuration — where its data- * lives, which shell it resolved, which release feed it checks, which language its UI speaks —- * and none of it describes the command an Agent is running. Stripping by prefix rather than by- * name is the point: the harness reads two dozen of them today and gains more with each feature,- * and a list has to be remembered at exactly the moment nobody is thinking about it. Twenty-five- * existed when this was written and a by-name list had caught seven.+ * Every variable named `PENGUIN_*` or `ADELIE_*` is this installation's own configuration — where+ * its data lives, which shell it resolved, which release feed it checks, which language its UI+ * speaks — and none of it describes the command an Agent is running. Stripping by prefix rather+ * than by name is the point: the harness reads two dozen of them today and gains more with each+ * feature, and a list has to be remembered at exactly the moment nobody is thinking about it.+ * Twenty-five existed when this was written and a by-name list had caught seven.+ *+ * Two prefixes because the installation carries two spellings of the same settings today:+ * `ADELIE_*` is Adelie's own — the installed launcher exports `ADELIE_HOME` — and `PENGUIN_*` is+ * the pre-rename spelling that existing deployments, systemd units and scripts still set, with+ * the data root read from either. Covering one and not the other would let the *other* through,+ * and the name that leaks would be the one naming the root this process is serving from.** Outbound proxy settings are the deliberate exception to "the harness's environment stays out of* the child", and they are not `PENGUIN_*` — they are HTTP_PROXY and friends, governed by@@ -112,7 +119,7 @@ const STRIPPED_ENV_KEYS = new Set([** The vault still wins, so any single variable that is genuinely wanted can be set there.*/-const HARNESS_ENV_PREFIX = "PENGUIN_";+const HARNESS_ENV_PREFIXES = ["PENGUIN_", "ADELIE_"] as const;/*** Proxy variables removed IN ADDITION when the host supplies a proxy policy (`proxyEnv`,@@ -142,7 +149,8 @@ function hostEnvForChild(policy: ProxyEnvPolicy | null): NodeJS.ProcessEnv {// child as PORT. On POSIX the two are distinct names and only the exact one exists.for (const [key, value] of Object.entries(process.env)) {const name = key.toUpperCase();- if (STRIPPED_ENV_KEYS.has(name) || name.startsWith(HARNESS_ENV_PREFIX)) continue;+ if (STRIPPED_ENV_KEYS.has(name) || HARNESS_ENV_PREFIXES.some((p) => name.startsWith(p)))+ continue;if (policy !== null && PROXY_ENV_KEYS.has(name)) continue;if (policy?.mode === "inject" && name === "NO_PROXY") continue;env[key] = value;diff --git a/packages/core/src/internal/ports.ts b/packages/core/src/internal/ports.tsindex 54e80856..4b353034 100644--- a/packages/core/src/internal/ports.ts+++ b/packages/core/src/internal/ports.ts@@ -13,7 +13,7 @@** | port | who | data root | where |* | ---- | ---------------------------------- | -------------------------- | ------------------------------------ |- * | 7364 | installed server / Web UI | `~/.penguin/data` | `DEFAULT_SERVER_PORT` below |+ * | 7364 | installed server / Web UI | `~/.adelie/data` | `DEFAULT_SERVER_PORT` below |* | 7365 | `pnpm dev:web` (Vite) | none (proxies to 7368) | `packages/web/vite.config.ts` |* | 7367 | `pnpm dev:docs` (Vite) | none (static) | `packages/docs/vite.config.ts` |* | 7368 | `pnpm dev:server` (dev backend) | `~/.penguin/dev-data` | `packages/server/package.json` `dev` |@@ -22,11 +22,17 @@* | 7372 | `pnpm dev:gallery` (Vite) | none (static) | `packages/ui-gallery/vite.config.ts` |** The desktop app binds no fixed port in either form (PORT=0 with a per-instance sticky- * preference); its release profile shares `~/.penguin/data` with the CLI by design and its+ * preference); its release profile shares `~/.adelie/data` with the CLI by design and its* dev profile — an unpackaged run, or any build launched with `--dev` — takes* `~/.penguin/dev-data` (see `packages/desktop/src/app-identity.ts`). The* web e2e harness runs on 8930/8931 against a throwaway root (`packages/web/e2e/run.sh`).*+ * Only the release data root is Adelie's own `~/.adelie/data`: the `dev-data` roots above+ * deliberately keep the pre-rename `~/.penguin` home, because the desktop's dev shell names+ * `~/.penguin/dev-data` as the root it shares with `dev:server` (`app-identity.ts`, and the+ * desktop test that pins it) — the two must move together, and the desktop tree is not+ * buildable here. Moving them is the remainder of ledger item 2.2.+ ** The development backend deliberately does **not** share 7364 with an installed one: the* two are routinely running at once, and before they were split, `pnpm dev` either failed* to bind or -- worse -- the Vite proxy silently talked to the installed server instead ofdiff --git a/packages/core/src/state/paths.ts b/packages/core/src/state/paths.tsindex 02ea7498..87849b80 100644--- a/packages/core/src/state/paths.ts+++ b/packages/core/src/state/paths.ts@@ -1,7 +1,7 @@/*** Local directory layout for Agent State and Project config.*- * Strictly follows the `~/.penguin/data/<project>/agents/<agent>/...` structure.+ * Strictly follows the `~/.adelie/data/<project>/agents/<agent>/...` structure.* This module only provides constants and pure path functions; it never creates directories or reads/writes files.* Docs: /docs/sessions-and-traces § "Data layout".*/@@ -24,14 +24,34 @@ export const DEFAULT_PROJECT_NAME = "default";/** Default Agent id used when none is specified. */export const DEFAULT_AGENT_ID = "default_agent";+/**+ * Environment variable naming the data root, in Adelie's own spelling. Exported so the places+ * that read the root out of a plain env object (the server's config parser, which takes the+ * environment as an argument rather than from `process.env`) cannot drift from the rule here.+ */+export const ROOT_ENV = "ADELIE_HOME";++/**+ * The data root's pre-rename name, still read after `ROOT_ENV`. Every install made before Adelie+ * spelled its environment Adelie's way sets this one (the launcher script and the systemd units+ * of existing deployments do), so dropping it would point those installs at an empty default root+ * and make their Agents, Sessions and usage look gone. Kept as long as those installs exist;+ * setting the new name wins when both are present.+ */+export const LEGACY_ROOT_ENV = "PENGUIN_HOME";+/*** Resolves the local data root directory.- * Prefers the `PENGUIN_HOME` environment variable, otherwise falls back to `~/.penguin/data`- * (under the hidden `~/.penguin` home so it never collides with unrelated folders, and in a- * `data/` subdir kept separate from the installer's binaries under `~/.penguin`).+ * `ROOT_ENV` (`ADELIE_HOME`) wins, then `LEGACY_ROOT_ENV`; with neither set the default is+ * `~/.adelie/data` — under the hidden `~/.adelie` home so it never collides with unrelated+ * folders, and in a `data/` subdir kept separate from the installer's binaries under the same home.*/export function resolveRoot(): string {- return process.env.PENGUIN_HOME ?? path.join(os.homedir(), ".penguin", "data");+ return (+ process.env[ROOT_ENV] ??+ process.env[LEGACY_ROOT_ENV] ??+ path.join(os.homedir(), ".adelie", "data")+ );}/** `<root>/<projectId>`. */diff --git a/packages/core/test/exec-session.test.ts b/packages/core/test/exec-session.test.tsindex 778db75c..fadad292 100644--- a/packages/core/test/exec-session.test.ts+++ b/packages/core/test/exec-session.test.ts@@ -309,6 +309,9 @@ describe("harness environment variables never reach a spawned command", () => {"PENGUIN_SEED_ADMIN_PASSWORD","PENGUIN_HOME","PENGUIN_WEB_DB",+ // The post-rename spelling of the same setting, exported by the installed launcher: both+ // prefixes are the rule, so a root named the new way has to be stripped exactly like the old.+ "ADELIE_HOME",// A sample of the PENGUIN_* the prefix rule covers that no by-name list ever named: the// resolved shell, the release feed, the UI language and the install location. Whether these// specific ones are set at run time is beside the point — the rule is the prefix, and a new@@ -337,6 +340,7 @@ describe("harness environment variables never reach a spawned command", () => {// harness at the running one's data — where the lock is already held, so it cannot start.process.env.PENGUIN_HOME = "/home/someone/.penguin/data";process.env.PENGUIN_WEB_DB = "/home/someone/.penguin/data/web.db";+ process.env.ADELIE_HOME = "/home/someone/.adelie/data";process.env.PENGUIN_SHELL = "/opt/penguin/bin/bash";process.env.PENGUIN_UPDATE_FEED_URL = "https://example.invalid/feed";process.env.PENGUIN_LANG = "zh";@@ -446,6 +450,21 @@ describe("harness environment variables never reach a spawned command", () => {}});+ it("an ADELIE_* nobody has invented yet is stripped by the same prefix rule", async () => {+ // Adelie's own spelling joined the rule when the data root moved: the installed launcher+ // exports ADELIE_HOME, so an Adelie install's serving process has it set, and a rule that+ // covered only PENGUIN_* would hand an Agent-started harness this process's own root.+ process.env.ADELIE_SOME_FUTURE_SETTING = "leaked";+ try {+ const res = await runTool(env, "exec_command", {+ cmd: `node -e "console.log('Y=[' + (process.env.ADELIE_SOME_FUTURE_SETTING ?? '') + ']')"`,+ });+ expect(res.output).toContain("Y=[]");+ } finally {+ delete process.env.ADELIE_SOME_FUTURE_SETTING;+ }+ });+it("the vault can put PENGUIN_HOME back, which is how a shared data root is asked for", async () => {// Sharing a root with the running harness is a legitimate config decision; inheriting it from// whichever process happens to be serving is not. The vault is where that decision is made.diff --git a/packages/core/test/state.test.ts b/packages/core/test/state.test.tsindex 032da364..7a3480e5 100644--- a/packages/core/test/state.test.ts+++ b/packages/core/test/state.test.ts@@ -70,9 +70,11 @@ import { sessionEnvironment } from "../src/internal/session-support.js";let tmpRoot: string;let prevHome: string | undefined;+let prevAdelieHome: string | undefined;beforeEach(async () => {prevHome = process.env.PENGUIN_HOME;+ prevAdelieHome = process.env.ADELIE_HOME;tmpRoot = await fs.mkdtemp(path.join(os.tmpdir(), "penguin-state-"));process.env.PENGUIN_HOME = tmpRoot;});@@ -83,6 +85,11 @@ afterEach(async () => {} else {process.env.PENGUIN_HOME = prevHome;}+ if (prevAdelieHome === undefined) {+ delete process.env.ADELIE_HOME;+ } else {+ process.env.ADELIE_HOME = prevAdelieHome;+ }// Retries: when a test times out, vitest runs this cleanup while the test's un-cancelled// init may still be writing files, so an immediate recursive rm can hit ENOTEMPTY on// Windows (fs.rm retries ENOTEMPTY/EBUSY/EPERM); a no-op when removal succeeds first try.@@ -99,9 +106,28 @@ async function exists(p: string): Promise<boolean> {}describe("paths / resolveRoot", () => {- it("honors PENGUIN_HOME", () => {+ it("still honors the pre-rename PENGUIN_HOME when ADELIE_HOME is unset", () => {expect(resolveRoot()).toBe(tmpRoot);});++ it("honors ADELIE_HOME", () => {+ const own = path.join(tmpRoot, "adelie-home");+ process.env.ADELIE_HOME = own;+ expect(resolveRoot()).toBe(own);+ });++ it("prefers ADELIE_HOME over the pre-rename name when both are set", () => {+ const own = path.join(tmpRoot, "adelie-home");+ process.env.PENGUIN_HOME = path.join(tmpRoot, "legacy-home");+ process.env.ADELIE_HOME = own;+ expect(resolveRoot()).toBe(own);+ });++ it("defaults to ~/.adelie/data with neither name set", () => {+ delete process.env.PENGUIN_HOME;+ delete process.env.ADELIE_HOME;+ expect(resolveRoot()).toBe(path.join(os.homedir(), ".adelie", "data"));+ });});describe("loadAgentState", () => {diff --git a/packages/server/src/config.ts b/packages/server/src/config.tsindex b408b8f1..56412f54 100644--- a/packages/server/src/config.ts+++ b/packages/server/src/config.ts@@ -2,7 +2,7 @@* Server runtime config (ServerConfig) — parsed from environment variables.** The data root directory is shared with the SDK / CLI (`resolveRoot()`:- * PENGUIN_HOME or ~/.penguin/data); the SQLite index database defaults to+ * ADELIE_HOME or ~/.adelie/data); the SQLite index database defaults to* `<root>/web.db` (overridable via PENGUIN_WEB_DB, tests use ":memory:").* In production, the SPA is served statically once the frontend build output* directory (PENGUIN_WEB_DIST, the bundled web-dist/, or ../web/dist) is@@ -12,7 +12,12 @@import fs from "node:fs";import path from "node:path";import { fileURLToPath } from "node:url";-import { DEFAULT_SERVER_PORT, resolveRoot } from "@prismshadow/penguin-core";+import {+ DEFAULT_SERVER_PORT,+ LEGACY_ROOT_ENV,+ resolveRoot,+ ROOT_ENV,+} from "@prismshadow/penguin-core";import { checkoutCliEntry } from "./services/cli-shim.js";export interface ServerConfig {@@ -221,9 +226,12 @@ export function normalizeModelScopeBridgeUrl(raw: string | undefined): string {return `${url.origin}${url.pathname.replace(/\/+$/, "")}`;}-/** Parses server config from environment variables (PORT / HOST / PENGUIN_HOME / PENGUIN_WEB_DIST / PENGUIN_WEB_DB / PENGUIN_PREVIEW_ORIGIN / PENGUIN_GO_ORIGIN / MODELSCOPE_BRIDGE_URL / PENGUIN_SEED_ADMIN_PASSWORD / PENGUIN_DESKTOP_TOKEN / PENGUIN_PORT_FILE / PENGUIN_TRUST_PROXY / PENGUIN_CLI_ENTRY). */+/** Parses server config from environment variables (PORT / HOST / ADELIE_HOME / PENGUIN_WEB_DIST / PENGUIN_WEB_DB / PENGUIN_PREVIEW_ORIGIN / PENGUIN_GO_ORIGIN / MODELSCOPE_BRIDGE_URL / PENGUIN_SEED_ADMIN_PASSWORD / PENGUIN_DESKTOP_TOKEN / PENGUIN_PORT_FILE / PENGUIN_TRUST_PROXY / PENGUIN_CLI_ENTRY). */export function resolveServerConfig(env: NodeJS.ProcessEnv = process.env): ServerConfig {- const root = env.PENGUIN_HOME ?? resolveRoot();+ // The root is read off the passed environment rather than `process.env` (this function takes+ // one so tests can hand it a fabricated environment), so the two names are spelled here as+ // well as in `resolveRoot()` — imported constants, not literals, so they cannot drift.+ const root = env[ROOT_ENV] ?? env[LEGACY_ROOT_ENV] ?? resolveRoot();// An empty PORT string is treated as unset (the common `.env` case of an empty// `PORT=`): Number("") === 0 would pass the range check and bind to a random// port; this matches the CLI's resolvePort convention.diff --git a/packages/server/test/config.test.ts b/packages/server/test/config.test.tsindex 70b44995..29362ce2 100644--- a/packages/server/test/config.test.ts+++ b/packages/server/test/config.test.ts@@ -15,10 +15,36 @@*/import { describe, expect, it } from "vitest";import path from "node:path";+import { resolveRoot } from "@prismshadow/penguin-core";import { resolveServerConfig } from "../src/config.js";const base = { PENGUIN_HOME: "/tmp/penguin-config-test" };+describe("resolveServerConfig: data root", () => {+ it("still honors the pre-rename PENGUIN_HOME", () => {+ expect(resolveServerConfig({ ...base }).root).toBe(base.PENGUIN_HOME);+ });++ it("honors ADELIE_HOME, and prefers it over the pre-rename name", () => {+ expect(resolveServerConfig({ ADELIE_HOME: "/tmp/adelie-config-test" }).root).toBe(+ "/tmp/adelie-config-test",+ );+ expect(resolveServerConfig({ ADELIE_HOME: "/tmp/adelie-config-test", ...base }).root).toBe(+ "/tmp/adelie-config-test",+ );+ });++ it("falls back to the root shared with the SDK / CLI when neither name is set", () => {+ expect(resolveServerConfig({}).root).toBe(resolveRoot());+ });++ it("puts the index database inside whichever root was chosen", () => {+ expect(resolveServerConfig({ ADELIE_HOME: "/tmp/adelie-config-test" }).dbPath).toBe(+ path.join("/tmp/adelie-config-test", "web.db"),+ );+ });+});+describe("resolveServerConfig: PORT parsing", () => {it("reads an empty PORT as unset, not as port 0", () => {const unset = resolveServerConfig({ ...base }).port;diff --git a/scripts/launchers/penguin b/scripts/launchers/penguinindex aedb12db..6eb08cd6 100755--- a/scripts/launchers/penguin+++ b/scripts/launchers/penguin@@ -17,6 +17,13 @@ doneDIR=$(dirname "$(cd -P "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd)")export PENGUIN_WEB_DIST="${PENGUIN_WEB_DIST:-$DIR/web}"+# The data root this install owns. The installer lays the program out in a program directory and+# keeps the data root inside it (`<program>/data`) — that is where an install made before Adelie+# spelled its environment Adelie's way has its Agents, Sessions and usage, so exporting the path+# here is what carries them across an upgrade: without it the new CLI would resolve Adelie's+# default root (~/.adelie/data) instead and that install's data would look gone. An explicit+# ADELIE_HOME wins, then the pre-2.2 PENGUIN_HOME, then this install's own `data/`.+export ADELIE_HOME="${ADELIE_HOME:-${PENGUIN_HOME:-$DIR/data}}"if [ -x "$DIR/node/bin/node" ]; thenexec "$DIR/node/bin/node" "$DIR/lib/dist/penguin.js" "$@"fidiff --git a/scripts/launchers/penguin.cmd b/scripts/launchers/penguin.cmdindex 3318ee13..6282536d 100644--- a/scripts/launchers/penguin.cmd+++ b/scripts/launchers/penguin.cmd@@ -9,6 +9,11 @@ rem then break the plain `penguin` command. Batch files are exempt from that polsetlocalset "DIR=%~dp0.."if not defined PENGUIN_WEB_DIST set "PENGUIN_WEB_DIST=%DIR%\web"+rem The data root this install owns: the installer keeps it inside the program directory as+rem data\, which is where an install made before the rename keeps its Agents and Sessions.+rem An explicit ADELIE_HOME wins, then the pre-2.2 PENGUIN_HOME, then this install's own data\.+if not defined ADELIE_HOME if defined PENGUIN_HOME set "ADELIE_HOME=%PENGUIN_HOME%"+if not defined ADELIE_HOME set "ADELIE_HOME=%DIR%\data"if exist "%DIR%\git\usr\bin\sh.exe" set "PENGUIN_BUNDLED_SHELL=%DIR%\git\usr\bin\sh.exe"if exist "%DIR%\node\node.exe" ("%DIR%\node\node.exe" "%DIR%\lib\dist\penguin.js" %*