A local-first multi-agent app development platform, built on PenguinHarness
feat(ports): 默认端口换成 Adelie 自己的(服务端 4000、dev CLI 7370)
lmliheng3835c0e8cdd8
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.mdindex 42f17375..c806a6b1 100644--- a/.github/CONTRIBUTING.md+++ b/.github/CONTRIBUTING.md@@ -21,11 +21,11 @@ pnpm installpnpm build # build first: core's exports point at dist/pnpm dev # backend + web app together (prefixed logs, deps built once)-pnpm dev:server # backend at 127.0.0.1:7368 (not the installed server's 7364)+pnpm dev:server # backend at 127.0.0.1:7368 (not the installed server's 4000)pnpm dev:web # web app (Vite) at 127.0.0.1:7365, /api proxied to 7368pnpm dev:docs # docs site (Vite) at 127.0.0.1:7367pnpm dev:landing # landing page (Vite) at 127.0.0.1:7366-pnpm penguin ... # CLI from source; `penguin web` serves at 127.0.0.1:7369+pnpm penguin ... # CLI from source; `penguin web` serves at 127.0.0.1:7370pnpm desktop # desktop app from source (builds everything first, then Electron)BASE_PATH=/ pnpm build:site # assemble landing + docs exactly like the Pages deploy@@ -74,7 +74,7 @@ your real agents. `pnpm dev`, `pnpm dev:server` and `pnpm desktop` sharedata root admits one server at a time (`<root>/server.lock`) and the dev CLI's`penguin web` is exactly the harness that then asks an Agent to run `pnpm dev` — on ashared root that Agent's `dev:server` would refuse to start, blocked by the harness's-own lock (the same coexistence that already gives it port 7369, see+own lock (the same coexistence that already gives it port 7370, see`packages/core/src/internal/ports.ts`). To aim a dev CLI command at the `pnpm dev`dataset anyway, say so per command — `ADELIE_HOME=~/.penguin/dev-data pnpm penguin ...`,or `--root` where the subcommand takes it. Need a different root?diff --git a/.github/CONTRIBUTING.zh.md b/.github/CONTRIBUTING.zh.mdindex 6215a818..d735b714 100644--- a/.github/CONTRIBUTING.zh.md+++ b/.github/CONTRIBUTING.zh.md@@ -19,11 +19,11 @@ pnpm installpnpm build # 先构建:core 的导出指向 dist/pnpm dev # 服务端 + Web 一起启动(带前缀日志,依赖只构建一次)-pnpm dev:server # 服务端,127.0.0.1:7368(不是已安装 server 的 7364)+pnpm dev:server # 服务端,127.0.0.1:7368(不是已安装 server 的 4000)pnpm dev:web # Web App(Vite),127.0.0.1:7365,/api 代理到 7368pnpm dev:docs # 文档站(Vite),127.0.0.1:7367pnpm dev:landing # 落地页(Vite),127.0.0.1:7366-pnpm penguin ... # 从源码运行 CLI;`penguin web` 服务在 127.0.0.1:7369+pnpm penguin ... # 从源码运行 CLI;`penguin web` 服务在 127.0.0.1:7370pnpm desktop # 从源码运行桌面应用(先全量构建,再启动 Electron)BASE_PATH=/ pnpm build:site # 完全按 Pages 部署的方式组装落地页 + 文档@@ -55,7 +55,7 @@ web/server 消费的是快照副本,只有当该包的 `build` 脚本经由 pn`pnpm desktop` 共用 `~/.penguin/dev-data`;`pnpm penguin` 独占 `~/.penguin/dev-data-cli`,因为一个数据根目录同时只接纳一个 server(`<root>/server.lock`),而开发版 CLI 的 `penguin web` 恰恰就是那个随后会让 Agent 去执行 `pnpm dev` 的 harness——共用根目录时,那个 Agent 的 `dev:server` 会被 harness-自己的锁挡住而拒绝启动(正是这种共存关系也已经为它分配了 7369 端口,见+自己的锁挡住而拒绝启动(正是这种共存关系也已经为它分配了 7370 端口,见`packages/core/src/internal/ports.ts`)。若仍要让某条开发 CLI 命令对准 `pnpm dev` 的数据集,就为该条命令单独声明——`ADELIE_HOME=~/.penguin/dev-data pnpm penguin ...`,或在支持的子命令上使用`--root`。需要另一个根目录?只为需要它的那一条命令内联传入 `ADELIE_HOME`diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.ymlindex e6f73baa..8443e309 100644--- a/.github/workflows/docker.yml+++ b/.github/workflows/docker.yml@@ -96,7 +96,7 @@ jobs:- name: Start the containerrun: |- docker run -d --name penguin -p 127.0.0.1:7364:7364 \+ docker run -d --name penguin -p 127.0.0.1:4000:4000 \-e ADELIE_SEED_ADMIN_PASSWORD=ci-password-123 \-v penguin-data:/data \penguin-harness:pr@@ -104,7 +104,7 @@ jobs:- name: Wait for the serverrun: |for _ in $(seq 1 90); do- if curl -fsS http://127.0.0.1:7364/api/install > /tmp/install.json; then+ if curl -fsS http://127.0.0.1:4000/api/install > /tmp/install.json; thenjq -e '.installId | type == "string" and (. | length) > 0' /tmp/install.jsonexit 0fi@@ -121,13 +121,13 @@ jobs:code="$(curl -s -o /tmp/login.json -w '%{http_code}' -c /tmp/cookies.txt \-H 'content-type: application/json' \-d '{"userId":"admin","password":"ci-password-123"}' \- http://127.0.0.1:7364/api/auth/login)"+ http://127.0.0.1:4000/api/auth/login)"if [ "$code" != "200" ]; thenecho "error: login answered $code" >&2cat /tmp/login.json >&2exit 1fi- curl -fsS -b /tmp/cookies.txt http://127.0.0.1:7364/api/version > /tmp/version.json+ curl -fsS -b /tmp/cookies.txt http://127.0.0.1:4000/api/version > /tmp/version.jsonjq -e '.version | type == "string"' /tmp/version.json# web.db was created by the server itself, so its owner is the euid the server runs as.@@ -169,13 +169,13 @@ jobs:run: |docker start penguinfor _ in $(seq 1 90); do- if curl -fsS http://127.0.0.1:7364/api/install > /dev/null; then break; fi+ if curl -fsS http://127.0.0.1:4000/api/install > /dev/null; then break; fisleep 1donecode="$(curl -s -o /dev/null -w '%{http_code}' \-H 'content-type: application/json' \-d '{"userId":"admin","password":"ci-password-123"}' \- http://127.0.0.1:7364/api/auth/login)"+ http://127.0.0.1:4000/api/auth/login)"if [ "$code" != "200" ]; thenecho "error: login after restart answered $code" >&2docker logs penguin >&2diff --git a/Dockerfile b/Dockerfileindex 0772a007..44fc35d8 100644--- a/Dockerfile+++ b/Dockerfile@@ -1,8 +1,8 @@-# The official Adelie server image: `penguin server` on 0.0.0.0:7364, serving the+# The official Adelie server image: `penguin server` on 0.0.0.0:4000, serving the# Web App, with the data root at /data.## docker build -t penguin-harness:dev .-# docker run -d -p 127.0.0.1:7364:7364 -v penguin-data:/data penguin-harness:dev+# docker run -d -p 127.0.0.1:4000:4000 -v penguin-data:/data penguin-harness:dev## Published from .github/workflows/docker.yml to Docker Hub as hiyouga/penguinharness.# The user-facing contract (first sign-in, volumes, upgrades, reverse proxies) is@@ -242,7 +242,7 @@ ENV HOME=/home/penguin \ADELIE_HOME=/data \ADELIE_WEB_DIST=/opt/penguin/web \HOST=0.0.0.0 \- PORT=7364+ PORT=4000WORKDIR /home/penguin@@ -251,7 +251,7 @@ RUN set -eux; \chown penguin:penguin /dataVOLUME ["/data"]-EXPOSE 7364+EXPOSE 4000COPY --chmod=0755 docker/entrypoint.sh /usr/local/bin/penguin-entrypointdiff --git a/docker/compose.yaml b/docker/compose.yamlindex b3a3902f..29c42df1 100644--- a/docker/compose.yaml+++ b/docker/compose.yaml@@ -9,8 +9,8 @@ services:restart: unless-stoppedports:# On the host's loopback: reachable only from the machine running Docker.- # To open it to a network, publish on all interfaces instead: "7364:7364".- - "127.0.0.1:7364:7364"+ # To open it to a network, publish on all interfaces instead: "4000:4000".+ - "127.0.0.1:4000:4000"volumes:- penguin-data:/data# Shutting down interrupts running Tasks and waits for them to wrap up, which can takediff --git a/install.ps1 b/install.ps1index 2d863d05..2ac85dff 100644--- a/install.ps1+++ b/install.ps1@@ -488,5 +488,5 @@ if ($PathUpdateMessage) {Write-Host ""Write-Host "Get started:"Write-Host " $PenguinCommand --help # all commands"-Write-Host " $PenguinCommand web # start the Web UI at http://127.0.0.1:7364 (a first-login link is printed on first start)"+Write-Host " $PenguinCommand web # start the Web UI at http://127.0.0.1:4000 (a first-login link is printed on first start)"Write-Host " $PenguinCommand server # headless server (PORT / HOST to override)"diff --git a/install.sh b/install.shindex a51b7338..e3972209 100644--- a/install.sh+++ b/install.sh@@ -490,5 +490,5 @@ fiecho ""echo "Get started:"echo " $PENGUIN_COMMAND --help # all commands"-echo " $PENGUIN_COMMAND web # start the Web UI at http://127.0.0.1:7364 (a first-login link is printed on first start)"+echo " $PENGUIN_COMMAND web # start the Web UI at http://127.0.0.1:4000 (a first-login link is printed on first start)"echo " $PENGUIN_COMMAND server # headless server (PORT / HOST to override)"diff --git a/package.json b/package.jsonindex 8b63b731..f8fa3da9 100644--- a/package.json+++ b/package.json@@ -18,7 +18,7 @@"test:e2e": "pnpm --filter @lmliheng/penguin-core test:e2e","build": "pnpm -r build && pnpm link:cli","link:cli": "pnpm --dir packages/cli link --global || echo '[link:cli] pnpm global directory not configured; skipping the global penguin link (run pnpm setup once first)'",- "penguin": "node scripts/run-with-env.mjs ADELIE_HOME=~/.penguin/dev-data-cli ADELIE_PROFILE=dev PORT=7369 -- tsx packages/cli/src/penguin.ts",+ "penguin": "node scripts/run-with-env.mjs ADELIE_HOME=~/.penguin/dev-data-cli ADELIE_PROFILE=dev PORT=7370 -- tsx packages/cli/src/penguin.ts","dev": "concurrently -n server,web -c cyan,magenta \"pnpm dev:server\" \"pnpm dev:web\"","dev:server": "pnpm --filter @lmliheng/penguin-server dev","dev:web": "node scripts/dev-prebuild.mjs && pnpm --filter @lmliheng/penguin-web dev",diff --git a/packages/cli/README.md b/packages/cli/README.mdindex b995c589..a231461b 100644--- a/packages/cli/README.md+++ b/packages/cli/README.md@@ -7,7 +7,7 @@ npm install -g @lmliheng/penguin-cli # requires Node >= 24``````bash-penguin web # start the Web service and open http://127.0.0.1:7364+penguin web # start the Web service and open http://127.0.0.1:4000penguin server # same service, headlesspenguin config model add --model-id deepseek-v4-pro --api-key sk-... --set-defaultdiff --git a/packages/cli/package.json b/packages/cli/package.jsonindex 44ebfccf..e4871d4c 100644--- a/packages/cli/package.json+++ b/packages/cli/package.json@@ -20,7 +20,7 @@"typecheck": "tsc --noEmit -p tsconfig.json","test": "vitest run --passWithNoTests","build": "tsup",- "penguin": "node ../../scripts/run-with-env.mjs ADELIE_HOME=~/.penguin/dev-data-cli ADELIE_PROFILE=dev PORT=7369 -- tsx src/penguin.ts"+ "penguin": "node ../../scripts/run-with-env.mjs ADELIE_HOME=~/.penguin/dev-data-cli ADELIE_PROFILE=dev PORT=7370 -- tsx src/penguin.ts"},"dependencies": {"@modelcontextprotocol/client": "^2.0.0",diff --git a/packages/cli/src/commands/serve.ts b/packages/cli/src/commands/serve.tsindex 179f3de5..fea0de34 100644--- a/packages/cli/src/commands/serve.ts+++ b/packages/cli/src/commands/serve.ts@@ -9,7 +9,7 @@* dynamically imports `@lmliheng/penguin-server` (whose entry point handles dotenv* loading and graceful shutdown on its own), so the two never listen on separate ports* in parallel. Port/host priority: command-line option > existing environment variable- * (including .env) > default 7364 / 127.0.0.1. `penguin web` additionally polls until the+ * (including .env) > default 4000 / 127.0.0.1. `penguin web` additionally polls until the* service is ready, prints the URL, and opens a browser per-platform (`--no-open`* disables this). Before the import, ADELIE_CLI_ENTRY is exported (when node can re-run* this entry) so the server's admin self-update endpoint can invoke `penguin update`.@@ -45,14 +45,14 @@ export interface ReadinessFailure {/** Result of `waitForReady`: ready, or timed out with the retained last probe failure. */export type ReadinessResult = { ready: true } | { ready: false; failure: ReadinessFailure };-/** Default service port — core's DEFAULT_SERVER_PORT (7364), the single source of truth. */+/** Default service port — core's DEFAULT_SERVER_PORT (4000), the single source of truth. */export const DEFAULT_PORT = DEFAULT_SERVER_PORT;/** Default service listen host. */export const DEFAULT_HOST = "127.0.0.1";/*** Resolves the listen port: command-line option takes priority, then the PORT- * environment variable, defaulting to 7364; throws if not an integer or out of the+ * environment variable, defaulting to 4000; throws if not an integer or out of the* 0-65535 range. Exported for unit tests.*/export function resolvePort(option: string | undefined, env: string | undefined): number {diff --git a/packages/cli/src/i18n.ts b/packages/cli/src/i18n.tsindex 4babd6b8..2e4d6498 100644--- a/packages/cli/src/i18n.ts+++ b/packages/cli/src/i18n.ts@@ -1647,7 +1647,7 @@ const en: Messages = {serverDesc:"Start the Web service (HTTP API and the built-in frontend, same process); subcommand reset-admin-password resets a forgotten admin password",webDesc: "Start the Web service and open the UI in a browser once it is ready",- port: "Listen port (falls back to the PORT env var, default 7364)",+ port: "Listen port (falls back to the PORT env var, default 4000)",host: "Listen address (falls back to the HOST env var, default 127.0.0.1)",noOpen: "Do not open a browser automatically",restarting: "Restarting the service to apply the update…",@@ -2552,7 +2552,7 @@ const zh: Messages = {serverDesc:"启动 Web 服务(HTTP API 与内置前端,同一进程);子命令 reset-admin-password 重置忘记的管理员密码",webDesc: "启动 Web 服务,就绪后用浏览器打开界面",- port: "监听端口(其次取环境变量 PORT,缺省 7364)",+ port: "监听端口(其次取环境变量 PORT,缺省 4000)",host: "监听地址(其次取环境变量 HOST,缺省 127.0.0.1)",noOpen: "不自动打开浏览器",restarting: "正在重启服务以应用更新…",diff --git a/packages/cli/test/serve.test.ts b/packages/cli/test/serve.test.tsindex 46ae73f6..ef541cf4 100644--- a/packages/cli/test/serve.test.ts+++ b/packages/cli/test/serve.test.ts@@ -17,14 +17,14 @@ import {} from "../src/commands/serve.js";import { getMessages } from "../src/i18n.js";-describe("resolvePort (option > env var > default 7364)", () => {+describe("resolvePort (option > env var > default 4000)", () => {it("derives DEFAULT_PORT from core's DEFAULT_SERVER_PORT", () => {expect(DEFAULT_PORT).toBe(DEFAULT_SERVER_PORT);});- it("uses the default 7364 when neither is given", () => {- expect(DEFAULT_PORT).toBe(7364);- expect(resolvePort(undefined, undefined)).toBe(7364);- expect(resolvePort(undefined, "")).toBe(7364); // an empty string counts as unset+ it("uses the default 4000 when neither is given", () => {+ expect(DEFAULT_PORT).toBe(4000);+ expect(resolvePort(undefined, undefined)).toBe(4000);+ expect(resolvePort(undefined, "")).toBe(4000); // an empty string counts as unset});it("takes the env var when only the env var is set", () => {expect(resolvePort(undefined, "8080")).toBe(8080);diff --git a/packages/core/src/internal/ports.ts b/packages/core/src/internal/ports.tsindex 2f9bd7c5..48a00918 100644--- a/packages/core/src/internal/ports.ts+++ b/packages/core/src/internal/ports.ts@@ -13,11 +13,11 @@** | port | who | data root | where |* | ---- | ---------------------------------- | -------------------------- | ------------------------------------ |- * | 7364 | installed server / Web UI | `~/.adelie/data` | `DEFAULT_SERVER_PORT` below |+ * | 4000 | 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` |- * | 7369 | `pnpm penguin web` (dev CLI) | `~/.penguin/dev-data-cli` | the root and cli `penguin` scripts |+ * | 7370 | `pnpm penguin web` (dev CLI) | `~/.penguin/dev-data-cli` | the root and cli `penguin` scripts |* | 7371 | a machine's dev-profile server | `~/.penguin-dev/data` there | `DEFAULT_DEV_SERVER_PORT` below |* | 7372 | `pnpm dev:gallery` (Vite) | none (static) | `packages/ui-gallery/vite.config.ts` |*@@ -35,7 +35,16 @@* dev entries write are Adelie's, though (`ADELIE_HOME` / `ADELIE_PROFILE`); only these paths* are still spelled the old way.*- * The development backend deliberately does **not** share 7364 with an installed one: the+ * The release port is Adelie's own number, not the one inherited from upstream. 4000 is where+ * the previous Adelie served its Web UI, so the address people know carries over; upstream+ * PenguinHarness binds 7364, and since the two products are installable side by side, sharing+ * the number would make them fight over the socket. The dev CLI takes 7370 — the old Adelie+ * CLI's `serve` default — and 7370 is a hole in upstream's dev band (7365 / 7368 / 7369 /+ * 7371 / 7372), so a developer running both trees still gets a free port. The dev backend,+ * the dev Web server, the gallery and the machine-forward port below keep upstream's numbers:+ * only the two that a person meets — the installed server and the dev CLI — are Adelie's.+ *+ * The development backend deliberately does **not** share 4000 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 of* the one being worked on. The dev data root is separated for the same reason.@@ -56,15 +65,18 @@* (port, root) pairs above.*/-/** Default main server / Web UI port; deliberately avoids common defaults like 3000/8080. */-export const DEFAULT_SERVER_PORT = 7364;+/** Default main server / Web UI port: Adelie's own number, inherited from the Web UI the+ * previous Adelie served on 4000 — the address the installer prints and people bookmark.+ * Upstream PenguinHarness serves on 7364 instead; the table above says why that one is left+ * to it. Unlike 3000/8080 it is not a default anything else reaches for. */+export const DEFAULT_SERVER_PORT = 4000;/*** Where a dev-profile instance starts the server it installs on another machine* (`packages/server/src/machines/layout.ts`). Its own number because the release-profile- * server on that machine holds 7364, and the forward's local port must equal the remote+ * server on that machine holds 4000, and the forward's local port must equal the remote* one for Workspace previews to resolve — so the two profiles cannot share a number on- * either end. Not 7370: the design repository's reading site (`site/`) serves there, on the- * same developer box whose forward to a machine needs this number free locally.+ * either end. Not 7370: the dev CLI holds that one (see the table), and this forward's local+ * port has to stay free on the very developer box that runs the dev CLI.*/export const DEFAULT_DEV_SERVER_PORT = 7371;diff --git a/packages/core/test/state.test.ts b/packages/core/test/state.test.tsindex 7a3480e5..0d02832a 100644--- a/packages/core/test/state.test.ts+++ b/packages/core/test/state.test.ts@@ -5,6 +5,7 @@ import { parse as parseToml } from "smol-toml";import { afterEach, beforeEach, describe, expect, it } from "vitest";import { clampYield } from "../src/environment/tools/background/index.js";import { DEFAULT_EMPTY_POLL_YIELD_MS } from "../src/environment/tools/command/index.js";+import { DEFAULT_SERVER_PORT } from "../src/internal/ports.js";import {AGENT_ID_PLACEHOLDER,AGENTS_MD_PLACEHOLDER,@@ -548,9 +549,10 @@ describe("assembleSystemPrompt", () => {const state = await loadAgentState({ init: {} });const prompt = assembleSystemPrompt(state);// The wording of these rules is tuned freely; what must not drift is what they never say.- // Ports: the service numbers are deliberately not listed, so a model cannot read one out- // of the prompt and go looking for it.- expect(prompt).not.toContain("7364");+ // Ports: the service number is deliberately not listed, so a model cannot read one out+ // of the prompt and go looking for it. The check follows core's own constant rather than+ // repeating the digits, so moving the default cannot leave it guarding a stale number.+ expect(prompt).not.toContain(String(DEFAULT_SERVER_PORT));// Auth/key failures live entirely in Stop rules, as a special case of the// unresolvable-error rule: retry once, then stop and ask the user to update the key// outside the chat — never through a command that would put the secret on a command line.diff --git a/packages/server/README.md b/packages/server/README.mdindex 92df91a8..4892e0a0 100644--- a/packages/server/README.md+++ b/packages/server/README.md@@ -17,7 +17,7 @@ The full route tables and the SSE protocol are documented in the [Server API ref| Variable | Meaning | Default || --- | --- | --- |-| `PORT` / `HOST` | Listen port / address | `7364` / `127.0.0.1` |+| `PORT` / `HOST` | Listen port / address | `4000` / `127.0.0.1` || `ADELIE_HOME` (was `PENGUIN_HOME`) | Data root (shared with SDK/CLI) | `~/.adelie/data` || `ADELIE_WEB_DB` (was `PENGUIN_WEB_DB`) | SQLite file path | `<root>/web.db` || `ADELIE_WEB_DIST` (was `PENGUIN_WEB_DIST`) | Front-end build dir (static hosting + SPA fallback when present) | `../web/dist`, or the bundled `web-dist/` in the npm package |diff --git a/packages/server/src/config.ts b/packages/server/src/config.tsindex d358d1b4..7871a47a 100644--- a/packages/server/src/config.ts+++ b/packages/server/src/config.ts@@ -26,7 +26,7 @@ import { checkoutCliEntry } from "./services/cli-shim.js";export interface ServerConfig {/** Local data root directory (shared with the SDK/CLI). */root: string;- /** HTTP listen address and port (defaults to 127.0.0.1:7364, deliberately avoiding common ports like 3000/8080). */+ /** HTTP listen address and port (defaults to 127.0.0.1:4000, Adelie's own Web port — upstream serves on 7364). */host: string;/*** Listen port. `0` asks the OS for an ephemeral port (the desktop shell always does),diff --git a/packages/server/test/machines.test.ts b/packages/server/test/machines.test.tsindex a6908691..315176c8 100644--- a/packages/server/test/machines.test.ts+++ b/packages/server/test/machines.test.ts@@ -673,7 +673,7 @@ describe("remote layout", () => {// one a person made by hand are the same installation.expect(RELEASE.programDir.posix).toBe("$HOME/.penguin");expect(RELEASE.dataRoot.posix).toBe("$HOME/.penguin/data");- expect(RELEASE.defaultPort).toBe(7364);+ expect(RELEASE.defaultPort).toBe(4000);expect(DEV.defaultPort).toBe(7371);});diff --git a/packages/web/README.md b/packages/web/README.mdindex be603315..1972d6f3 100644--- a/packages/web/README.md+++ b/packages/web/README.md@@ -23,11 +23,11 @@ DTO types are imported type-only from `@lmliheng/penguin-server/api`; no serverPrereqs: Node >= 24, pnpm; run `pnpm install` at the repo root first (core must be built — the root `dev:*` scripts handle that).```bash-pnpm dev:server # backend at 127.0.0.1:7368 (dev port, not the installed server's 7364)+pnpm dev:server # backend at 127.0.0.1:7368 (dev port, not the installed server's 4000)pnpm dev:web # Vite dev server at 127.0.0.1:7365; /api proxied (SSE passes through)```-The proxy target defaults to `http://127.0.0.1:7368` — the development backend, kept off the installed server's 7364 so the two can run at once (`PORT` moves both, `ADELIE_API_PROXY` overrides the target outright). Auth is a same-origin HttpOnly cookie, so the proxy keeps everything same-origin.+The proxy target defaults to `http://127.0.0.1:7368` — the development backend, kept off the installed server's 4000 so the two can run at once (`PORT` moves both, `ADELIE_API_PROXY` overrides the target outright). Auth is a same-origin HttpOnly cookie, so the proxy keeps everything same-origin.```bashpnpm --filter @lmliheng/penguin-web typecheckdiff --git a/packages/web/src/lib/clipboard.ts b/packages/web/src/lib/clipboard.tsindex 3f6df518..7e40d18c 100644--- a/packages/web/src/lib/clipboard.ts+++ b/packages/web/src/lib/clipboard.ts@@ -4,7 +4,7 @@** `navigator.clipboard` is secure-context-only: it is `undefined` on a plain-HTTP origin* that is not localhost, which is exactly the shape a non-loopback `HOST` bind serves (a- * LAN address, a remote install reached at `http://<host>:7364`). Reaching straight for+ * LAN address, a remote install reached at `http://<host>:4000`). Reaching straight for* it there writes nothing at all, so every copy affordance goes through this entry.** The write itself is `copy-to-clipboard`'s: the Clipboard API in a secure context, anddiff --git a/packages/web/test/vite-config.test.ts b/packages/web/test/vite-config.test.tsindex a3d6ee32..a0c2a413 100644--- a/packages/web/test/vite-config.test.ts+++ b/packages/web/test/vite-config.test.ts@@ -2,7 +2,7 @@* The helpers vite.config.ts is built from.** - The dev server's `/api` proxy defaults to the development backend (7368, not the installed- * server's 7364), follows PORT, treats an empty PORT as unset rather than as port 80, and is+ * server's 4000), follows PORT, treats an empty PORT as unset rather than as port 80, and is* replaced outright by ADELIE_API_PROXY unless that is empty.* - KaTeX's stylesheet ships woff2 only: the woff and truetype fallbacks are dropped, and a* stylesheet without them is left untouched.@@ -11,7 +11,7 @@ import { describe, expect, it } from "vitest";import { apiProxyTarget, dropNonWoff2FontSources } from "../vite.config.js";describe("apiProxyTarget", () => {- it("defaults to the development backend, not the installed server's 7364", () => {+ it("defaults to the development backend, not the installed server's 4000", () => {expect(apiProxyTarget({})).toBe("http://127.0.0.1:7368");});diff --git a/packages/web/vite.config.ts b/packages/web/vite.config.tsindex bfc6adb6..62072256 100644--- a/packages/web/vite.config.ts+++ b/packages/web/vite.config.ts@@ -2,7 +2,7 @@* Vite config: React SPA + Tailwind CSS 4.** Dev server listens on 7365; `/api` is proxied to the **development** backend (127.0.0.1:7368 --- * `pnpm dev:server`, deliberately not the installed server's 7364, which is routinely running at the+ * `pnpm dev:server`, deliberately not the installed server's 4000, which is routinely running at the* same time). Honors PORT so overriding the backend port moves the proxy with it, and* ADELIE_API_PROXY overrides the whole target. SSE (text/event-stream) passes through http-proxy* transparently, no special config needed.