diff --git a/.agents/skills/t3code-routine-update/SKILL.md b/.agents/skills/t3code-routine-update/SKILL.md deleted file mode 100644 index 35ef7d1bc7cb9..0000000000000 --- a/.agents/skills/t3code-routine-update/SKILL.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -name: t3code-routine-update -description: Routine update ("常规更新") of the user's T3 Code fork - merge upstream into fork main, then deploy a fork main commit to the whiteboard (the running wb-t3 service and the whiteboard sandboxes). Use when the user asks to update/sync T3 Code with upstream or refresh the whiteboard chat. ---- - -# T3 Code routine update - -A routine update carries upstream T3 Code into everything the user runs, in this order: fork `main` → the whiteboard deployment (the running `wb-t3` service and the whiteboard sandboxes). Finish and verify a stage before starting the next. - -## Layout - -- Main checkout `~/utils/t3code`: `origin` = orbitingflea/t3code (the fork), `upstream` = pingdotgg/t3code. It only ever fast-forwards to `origin/main`; all merging, building, and editing happen in worktrees (other agent sessions read this checkout). -- Fork `main` = upstream + the fork's carried changes, kept by **merge**: each catch-up adds git's mechanical merge commit (titled `Merge upstream main () into the fork`, conflict markers left in) and, on top of it, the commit that resolves them. The fork's modified surface is `git diff --stat upstream/main origin/main` (after a merge; before one, diff against `git merge-base origin/main upstream/main`). `git log --no-merges upstream/main..origin/main` also lists history that no longer ships (the steer/fold fixes reverted in `c5c326d638`, older skill revisions), so read the diff, not the log. Drop a carried change when upstream ships an equivalent (check the upstream PR state). What the fork carries: - - The whiteboard: `fork/whiteboard/`, `apps/web/src/fork/whiteboard/`, `apps/web/vite/fork/`, and the embedding changes `fork/whiteboard/run-t3.md` lists. - - Account-change restarts for Codex (#29) and Antigravity (#30): `accountChanged` in `packages/provider-core/src/server/ProviderAdapter.ts`, `releaseIfAccountChanged` and `startBusyTurn` in `ProviderSessionManager.ts`, the Codex and Antigravity adapters, `AntigravityDriver.ts`, `packages/provider-acp/src/server/adapter.ts`, `telemetry/Identify.ts` (exports `CodexAuthJsonSchema`). The fork makes `profileDirectory` a required Antigravity adapter option, so new upstream tests that build the adapter need `profileDirectory: unusedProfileDirectory`. - - Claude approval-cancel fixes: `guardPendingRequestCancellations` in `EventSink.ts`, `ProviderEventIngestor.ts`, `ClaudeAdapterV2.ts`. - - Math rendered by default: `mathRenderingEnabled` defaults to `true` in `packages/contracts/src/settings.ts` and the mobile `AppearancePreferencesProvider.tsx`, with `docs/user/appearance.md`. - - Bold around CJK punctuation: `remark-cjk-friendly` in `packages/shared` (`markdownPipeline.ts`, `package.json`, the `pnpm-workspace.yaml` catalog), tested in `ChatMarkdown.browser.test.tsx`. - - This skill (`.agents/skills/t3code-routine-update/`); always keep it. -- The whiteboard is part of the fork. `fork/whiteboard/` holds its code with its own `package.json` (install with `npm ci` there; it is not a pnpm workspace member). The fork's T3 Code carries the whiteboard's embedding changes, switched by environment variables on the server (`T3CODE_UNSAFE_NO_AUTH`, `T3CODE_CLAUDE_PLUGIN_ROOT`, `T3CODE_CODEX_SKILL_ROOT`, all set by `fork/whiteboard/run-t3.sh`) and by `VITE_T3_WHITEBOARD=1` for the web build. `fork/whiteboard/run-t3.md` lists every embedding change with its files; it is the checklist when an upstream merge moves or deletes one of them. -- Whiteboard deployment `~/.whiteboard/app`: a detached worktree of `~/utils/t3code` at the deployed fork commit (T3 Code at its root, the whiteboard in `fork/whiteboard`). User units `wb-sync` and `wb-web` run from `fork/whiteboard`; `wb-t3.service` runs `fork/whiteboard/run-t3.sh` on 127.0.0.1:6070 with state in `~/.whiteboard/t3-userdata`. Browsers reach the chat only via wb-web's `/chat/` proxy. `~/.local/bin/t3` runs this worktree's server. The sandboxes (`~/utils/wb-sandbox`) mount releases built from a fork commit. - -## Steps - -Before touching anything: `git fetch upstream && git fetch origin`, then report how many commits `main` is behind `upstream/main` and run `git merge-tree --write-tree --name-only origin/main upstream/main` to preview conflicts. Save the push-rule baseline: `git diff --name-only $(git merge-base origin/main upstream/main) origin/main | sort` (the surface) and the added lines of that diff matching `eslint-disable|oxlint-disable|@ts-ignore|@ts-expect-error|@ts-nocheck|biome-ignore|@effect-diagnostics` (the suppressions). - -The user's standing rule (`~/utils/t3code/project-docs/rules/fork-rules.md`) lets a routine update be pushed without asking when it does not widen the fork's surface and adds no suppression comment; otherwise stop before pushing and report it for review. Check that rule there for whether stage 2 also needs the user. - -### 1. Merge upstream into fork main - -The merge lands as two commits, so that review sees only what was changed by hand (the user's decision, 2026-11-02). Commit A is git's mechanical merge with conflict markers left in; nobody edits it. Commit B on top of it holds the conflict resolutions and any fixes. A pull request from B into A shows exactly the remerge diff. Main keeps A in its history; the user accepts that. - -1. Commit A: `git merge-tree --write-tree --name-only origin/main upstream/main`. Line 1 of its output is the merged tree; exit 1 means conflicts, and the conflicted files follow line 1. `git commit-tree -p origin/main -p upstream/main` with the title above; when there are conflicts, the body lists the conflicted files and says the next commit resolves them. Add a fresh worktree on branch `catch-up/` at A. -2. Commit B: resolve conflicts per carried change, keeping upstream's structure and re-applying the fork's change on top of it, with the fork's diff from upstream as small as the change allows. Where a conflict touches how T3 sends Claude usage reads, reset-credit reads or redeems, follow upstream's design; when upstream rewrote code the fork had factored out (e.g. `startTurn` into `startBusyTurn`), move upstream's new body into the fork's helper rather than keeping the fork's old copy. When upstream moved or deleted a file that an embedding change touches, re-port that change into upstream's new location, guided by `fork/whiteboard/run-t3.md`, and update its file lists. `pnpm-lock.yaml`: take upstream's file, then `pnpm install --lockfile-only` so the fork's extra packages are added back. Do this even when git merges the lockfile without a conflict: a textual merge can drop upstream's patched-package references (it lost `micromark`'s `patch_hash` in 2026-10). Commit the resolutions as `fix(fork): resolve upstream merge `, its body naming how non-trivial conflicts were resolved; fixes that steps 3 and 4 need go on top. -3. `vp i`. Then diff `dev/lib/syntax.js` and `package.json` of `node_modules/.pnpm/micromark-extension-gfm-table@*_patch_hash=*/node_modules/micromark-extension-gfm-table/` against the same files in `~/utils/t3code`: pnpm sometimes leaves this patched package unpatched (math in tables then breaks). If they differ, copy the two files over and delete `apps/web/node_modules/.vite`. The same check applies after every install below. -4. Run the tests and typecheck of each package a carried commit touches, including the tests named in `run-t3.md` (e.g. `cd apps/web && vp test run --project browser src/components/ChatMarkdown.browser.test.tsx`; browser tests only run from `apps/web`), then `vp run check:changed upstream/main` (against `upstream/main` it checks exactly the fork's surface; the default picks the same base). If `vp` is not on `PATH`, use `pnpm install --frozen-lockfile` and `/node_modules/.bin/vp`. The first one to three browser runs after an install can fail with "Vite unexpectedly reloaded a test" or dynamic-import errors while Vite optimizes new deps; rerun before treating a failure as real. Inside `wb-t3` your shell inherits `T3CODE_UNSAFE_NO_AUTH` and the other `T3CODE_*` variables `run-t3.sh` sets; unset them for test runs and smoke tests, or the auth and adapter tests fail. -5. Push-rule check: `git diff --name-only upstream/main HEAD | sort` must list no file missing from the baseline surface, and the added suppression lines of `git diff upstream/main HEAD` must be the baseline's. If either fails (and the user has not approved), stop here and report it for review. -6. If `git diff A HEAD` is empty, B is empty: `git push origin A:main`, with no pull request, and go to step 9. -7. Otherwise push both branches: `git push origin A:refs/heads/catch-up/-base HEAD:refs/heads/catch-up/`. Review it the normal devtools way (`~/utils/devtools/review/tools/commands/pr_review/README.md`) with `--base origin/catch-up/-base`: code and prose review, then open the pull request from `catch-up/` into `catch-up/-base` on orbitingflea/t3code, then route. The title is `fix(fork): resolve upstream merge ()`; the body says how each conflict was resolved, and the evidence holds the test and check output. Route judges from the pull request as it does for any other; give it no catch-up mode or list of the fork's surface. -8. If route gives `merge` or `merge-then-review`: `git push origin HEAD:main HEAD:catch-up/-base` (the second push makes GitHub mark the pull request merged), then run `finish` as the README's last section says. For `merge-then-review`, the final report gives the pull request link and what the user should look at. `review-first`: stop and report the pull request and route's reason; main stays where it was. -9. `git -C ~/utils/t3code merge --ff-only origin/main`. Remove the worktree and delete the `catch-up/` branches, local and remote. - -Done when `origin/main` contains `upstream/main`, every `run-t3.md` point still holds in the code, touched tests and typecheck pass, and the main checkout sits at `origin/main`. - -### 2. Deploy fork main to the whiteboard - -Run in `~/.whiteboard/app`. Note its current commit first (`git rev-parse HEAD`); the rollback needs it. - -1. `git fetch origin && git checkout --detach origin/main` (or `--detach ` for a specific fork commit). The working tree must be clean before and after. -2. `pnpm install --frozen-lockfile` at the root, then the micromark check from stage 1 step 3; then `npm ci` in `fork/whiteboard`. -3. Build to a side dir: `cd apps/web && VITE_T3_WHITEBOARD=1 vp build --outDir dist.new`; check that `dist.new/index.html` references `/chat/assets/` and `dist.new/manifest.webmanifest` has `#0a0a0a` (a build without the variable is a normal T3 Code build and does not work behind `/chat/`); move `dist` to `~/.whiteboard/chat-dist.old-` and `dist.new` to `dist`. -4. Snapshot the DB read-only into `statev2.sqlite.bak-sync-` beside the live file, then check `PRAGMA integrity_check` on the copy. The V1 `state.sqlite` there is no longer written. - - ```bash - D=~/.whiteboard/t3-userdata/userdata - bun -e 'import { Database } from "bun:sqlite"; const [src,dst]=process.argv.slice(1); const db=new Database(src,{readonly:true}); db.run("VACUUM INTO ?",[dst]); db.close();' "$D/statev2.sqlite" "$D/statev2.sqlite.bak-sync-" - ``` - -5. Smoke test on a pruned copy: `node apps/server/scripts/migrate-dev-db.ts --source --base-dir /tmp/wbt3-smoke`, with `T3CODE_UNSAFE_NO_AUTH` unset. Never smoke-test on a raw VACUUM copy: it keeps in-flight runs, and the smoke server resumes them as real agents, including the thread running this update. Then run `T3_DATA=/tmp/wbt3-smoke T3_PORT=6079 setsid bash fork/whiteboard/run-t3.sh` in the background, wait for it to listen, and expect 200 from `http://127.0.0.1:6079/chat/` and a JSON reply from `/api/auth/session`. Also check that a websocket to `ws://127.0.0.1:6079/ws?orchestrationProtocol=2` stays open for 5 s and answers a `subscribeServerConfig` request; a socket that closes at once leaves the page stuck on "Still connecting". Stop it by its process group, then also kill the 6079 owner from `ss -H -ltnp` after checking that its `/proc//environ` has `T3_DATA=/tmp/wbt3-smoke` (the server forks a child that keeps the port; its cwd matches the live `wb-t3`, so cwd proves nothing). "Unknown source control provider" log errors are harmless. -6. Deploy the commit to every whiteboard sandbox (`~/utils/wb-sandbox`). Each sandbox mounts a release built from a fixed commit, so restarting a sandbox does not update it. Run `~/utils/wb-sandbox/bin/wb-sandbox list` and note each sandbox's COMMIT (the rollback needs it). Then, for each NAME, run `~/utils/wb-sandbox/bin/wb-sandbox rebuild --commit `. The user runs this update only when restarts are fine, so rebuild all of them without asking. - - Each rebuild restarts that sandbox's whiteboard and T3 services, which interrupts its running threads. A stopped sandbox is started and left running. - - The first rebuild builds the shared release `/srv/whiteboard/` and takes several minutes; run it in the background or with a long timeout. Then run the micromark check against `/srv/whiteboard/` (the release's T3 Code root); if it differs, tell the user before rebuilding the rest. - - A failed rebuild leaves that sandbox on its previous release and exits non-zero. Stop at the first failure and show the user the error tail; the release is shared, so the rest would fail the same way. - - Done when `list` shows the new commit for every sandbox. -7. Restart `wb-t3` last, after pushes and memory notes are written. The restart stops every agent session `wb-t3` runs, even though they live in their own `t3code-*.scope` cgroups, so `/proc/$$/cgroup` does not show whether you are one of them. Check `tr '\0' '\n' < /proc/$$/environ | grep -q '^WB_CHAT_PID='` instead (`run-t3.sh` exports it): if it matches, you run under `wb-t3` and a direct restart kills you mid-turn. Then tell the user that running `wb-t3` threads will be interrupted, schedule the restart with `systemd-run --user --on-active=30s systemctl --user restart wb-t3`, and end the turn; check it in the next turn. Otherwise restart directly. Either way, check the `journalctl --user -u wb-t3` tail and that `/chat/` on 6070 answers 200. When the deployed range changes `fork/whiteboard` (`git diff --stat ..HEAD -- fork/whiteboard`), restart `wb-sync` and `wb-web` as well; they run no agents. - -Done when `~/.whiteboard/app` sits at the pushed fork `main`, the smoke test passed, every sandbox runs the new commit, and `wb-t3` runs the new build. - -## Rollback - -Every stage leaves a way back: fork main is a merge plus its resolution commit (reset to the previous tip); the whiteboard deployment has the DB snapshot, the old `dist`, and the previous commit (`git checkout --detach `, rebuild, restart). A sandbox goes back with `wb-sandbox rebuild --commit `; a release is deleted once no sandbox uses it, so this usually builds it again (several minutes). - -## Afterwards - -Update the memory notes that record current state (fork scope, whiteboard deployment state) with the new shas and date, replacing the old values. - -## Personal live install (optional) - -The user's own install (`t3code.service`, port 3773, `~/.t3/runtime`) is updated only when the user asks; it uses a separate build-and-switch recipe in [`live-install.md`](live-install.md). diff --git a/.agents/skills/t3code-routine-update/live-install.md b/.agents/skills/t3code-routine-update/live-install.md deleted file mode 100644 index 4d002ac80e69c..0000000000000 --- a/.agents/skills/t3code-routine-update/live-install.md +++ /dev/null @@ -1,20 +0,0 @@ -# Updating the personal live install - -The live install is the user's own T3 Code: `t3code.service` (user unit, 127.0.0.1:3773, drop-in `~/.config/systemd/user/t3code.service.d/override.conf`), state in `~/.t3/userdata`. The launcher `~/.t3/runtime/service-launcher.mjs` starts the version named by `activeVersion` in `~/.t3/runtime/service-state.json`, from `~/.t3/runtime/versions//`. Check `systemctl --user status t3code.service` first: if the unit is disabled and inactive, ask the user whether they still use it before building anything. - -`~/.t3/userdata` is live data. Touch it only through the switch script below, which snapshots it first. - -## Scripts - -Durable copies live in `~/.t3/runtime/deploy-scripts/`. They hardcode `/tmp/t3-rebase-deploy` for logs, tarballs, and `stamp-package.mjs`, so start with `mkdir -p /tmp/t3-rebase-deploy && cp ~/.t3/runtime/deploy-scripts/* /tmp/t3-rebase-deploy/`. - -- `pack.sh `: web `vp build`, stamps the version into `apps/server/package.json` (it must happen before the server build, which bakes the version in), `node scripts/cli.ts build`, `stamp-package.mjs` (resolves `catalog:` deps the way `cli.ts publish` does), nightly favicons, `vp pm pack`. Prints the tarball path. -- `stage.sh `: `npm install` into a staging dir, writes `.install-complete`, runs `__service-preflight` against a scratch DB, renames into `~/.t3/runtime/versions/`. -- `switch-main-5.sh`: the last switch, used as a template. Copy it to `switch-main-.sh` and set `NEWV`, `OLDV` (the current `activeVersion`), and the `.bak-switch-main-` suffixes. It snapshots the DB with `VACUUM INTO`, updates the launcher, sets the state, restarts, probes 3773 for 200, and on failure restores DB, launcher, and state and restarts the old version. - -## Steps - -1. Build from a clean worktree at `origin/main`, never from the main checkout. Version string: `-nightly...main.`, the format of the existing names in `~/.t3/runtime/versions/`. -2. `pack.sh`, then `stage.sh`. Stage done when preflight prints `"status":"ready"` with the new version. -3. Run the switch script detached so a restart cannot take your session down: `systemd-run --user --unit switch-main- bash ~/.t3/runtime/switch-main-.sh`. Read the result in `~/.t3/runtime/switch-main-.log`: `SUCCESS` plus the served `index-*.js` bundle name, or a rollback report. -4. New upstream DB migrations run on first start, so the DB snapshot `~/.t3/userdata/state.sqlite.bak-switch-main-` is the only way back to the old version. Keep it until the user confirms the new version works. diff --git a/.agents/skills/verify-whiteboard/SKILL.md b/.agents/skills/verify-whiteboard/SKILL.md index bf8913e678406..447e5a154dba3 100644 --- a/.agents/skills/verify-whiteboard/SKILL.md +++ b/.agents/skills/verify-whiteboard/SKILL.md @@ -44,7 +44,7 @@ It is read-only and checks that each started process is alive, the sync API answ - **Probes.** With the run's env loaded, `node fork/whiteboard/probes/board-math.mjs` and `node fork/whiteboard/probes/board-reference.mjs`. Set `WHITEBOARD_PROBE_SCREENSHOT` (and `WHITEBOARD_PROBE_OFFSCREEN_SCREENSHOT` for the reference probe) to paths under `/evidence/`. - **Chat journey.** `node .agents/skills/verify-whiteboard/scripts/chat-journey.mjs ` drives a `--chat` run end to end. See [chat-embedding](features/chat-embedding.md). -Use only the URLs in the run's env. The probes default to ports 6060 and 6061, and `wb` with the real HOME uses `~/.whiteboard/config.json`; both reach the live whiteboard served from `~/.whiteboard/app`, which people are using. +Use only the URLs in the run's env. The probes default to ports 6060 and 6061, and `wb` with the real HOME uses `~/.whiteboard/config.json`; both can reach a live whiteboard on this machine, and people may be using it. ## Evidence diff --git a/apps/server/src/fork/browserSetupRootWarning.test.ts b/apps/server/src/fork/browserSetupRootWarning.test.ts index da79b58eae78b..89cc60ab0dcaf 100644 --- a/apps/server/src/fork/browserSetupRootWarning.test.ts +++ b/apps/server/src/fork/browserSetupRootWarning.test.ts @@ -32,7 +32,7 @@ const readyHostSpawner = ChildProcessSpawner.make(() => ), ); -// Setup runs as root without sudo, as from `incus exec` or a root shell. +// Setup runs as root without sudo, as in a container or a root shell. const rootSetupOutput = (input: { readonly baseDir?: string; readonly baseDirOwner?: number }) => Effect.gen(function* () { const { baseDirOwner } = input; diff --git a/apps/server/src/fork/claudeUsageExport/claudeUsageExport.test.ts b/apps/server/src/fork/claudeUsageExport/claudeUsageExport.test.ts index 612edfe6ba2c5..c77db8990affd 100644 --- a/apps/server/src/fork/claudeUsageExport/claudeUsageExport.test.ts +++ b/apps/server/src/fork/claudeUsageExport/claudeUsageExport.test.ts @@ -9,12 +9,12 @@ import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner"; import { makeClaudeUsageExport } from "./claudeUsageExport.ts"; -const URL_ = "http://127.0.0.1:6095/usage-push?box=era"; -const KEY = "test-box-key"; -const HOME = "/srv/box/.claude"; +const URL_ = "https://usage.example.com/push?source=test"; +const KEY = "test-key"; +const HOME = "/home/user/.claude"; const RECEIVED_AT = Date.parse("2026-11-03T14:21:07Z"); -// A real rate_limit_event from a sandbox provider log, ids replaced. +// A real rate_limit_event from a provider log, ids replaced. const realEvent = { type: "rate_limit_event", rate_limit_info: { @@ -177,7 +177,7 @@ describe("claude usage event export", () => { ...info, unifiedWindows: { seven_day: { ...info.unifiedWindows.seven_day, utilization: 0.29 } }, }; - const otherHome = "/srv/box/.claude-2"; + const otherHome = "/home/user/.claude-2"; yield* exportEvent(HOME, info); yield* http.nextCall; diff --git a/apps/server/src/fork/generalRoleParity.test.ts b/apps/server/src/fork/generalRoleParity.test.ts index e5e982e2a3103..fa604e15660c3 100644 --- a/apps/server/src/fork/generalRoleParity.test.ts +++ b/apps/server/src/fork/generalRoleParity.test.ts @@ -207,7 +207,7 @@ const claude: ProviderFixture = { return yield* ClaudeAdapterV2.makeClaudeAdapterV2({ instanceId: ClaudeAdapterV2.CLAUDE_DEFAULT_INSTANCE_ID, settings: claudeSettings, - // Fixes the child's TTL, so the person's own Claude settings do not reach the test. + // Fixes the child's TTL, so the developer's own Claude settings do not reach the test. environment: { CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL: claudeChildPromptCacheTtl }, attachmentsDir, fileSystem, diff --git a/apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts b/apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts index 6978e018e1b33..c06b32d95cc8d 100644 --- a/apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts +++ b/apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts @@ -277,9 +277,9 @@ describe("ClaudeAdapterV2 runtime query policy", () => { nativeThreadId: "native-thread-plugin", resume: false, cwd: "/workspace", - environment: { T3CODE_CLAUDE_PLUGIN_ROOT: " /opt/whiteboard " }, + environment: { T3CODE_CLAUDE_PLUGIN_ROOT: " /path/to/whiteboard " }, }); - assert.deepEqual(options.plugins, [{ type: "local", path: "/opt/whiteboard" }]); + assert.deepEqual(options.plugins, [{ type: "local", path: "/path/to/whiteboard" }]); }); it("passes every --add-dir launch directory to Claude", () => { diff --git a/apps/server/src/provider/codexLaunchArgs.test.ts b/apps/server/src/provider/codexLaunchArgs.test.ts index 901af12deee2c..65d47da561f56 100644 --- a/apps/server/src/provider/codexLaunchArgs.test.ts +++ b/apps/server/src/provider/codexLaunchArgs.test.ts @@ -11,8 +11,8 @@ import { describe("resolveCodexSkillRoot", () => { it("returns the configured skill root without surrounding whitespace", () => { NodeAssert.equal( - resolveCodexSkillRoot({ T3CODE_CODEX_SKILL_ROOT: " /opt/whiteboard/skills " }), - "/opt/whiteboard/skills", + resolveCodexSkillRoot({ T3CODE_CODEX_SKILL_ROOT: " /path/to/whiteboard/skills " }), + "/path/to/whiteboard/skills", ); }); diff --git a/fork/whiteboard/README.md b/fork/whiteboard/README.md index 3b9a3d5e3086e..bc790c9d16cf9 100644 --- a/fork/whiteboard/README.md +++ b/fork/whiteboard/README.md @@ -30,7 +30,7 @@ The services read `~/.whiteboard/config.json` when it exists. Every field is opt The default room is `main`; clients connect at `/connect/`, read with `GET /api/board?room=`, and write with `POST /api/board/edit?room=`. Omitting `room` selects `main`. Each room persists at `/room-.json`. -A room slug comes from a directory path: lowercase the path, replace each run of characters that are not letters or digits with a hyphen, trim hyphens at both ends, and use `main` when the result is empty. The chat panel sends the working-directory path of the active conversation's project, so `/home/alice/code/wboard` becomes `home-alice-code-wboard`, and the page title shows the path's last segment as `[Board: wboard]`. The same message carries the chat session id, which the browser uses only to remember that session's last board position and zoom in `localStorage`. +A room slug comes from a directory path: lowercase the path, replace each run of characters that are not letters or digits with a hyphen, trim hyphens at both ends, and use `main` when the result is empty. The chat panel sends the working-directory path of the active conversation's project, so `/srv/code/wboard` becomes `srv-code-wboard`, and the page title shows the path's last segment as `[Board: wboard]`. The same message carries the chat session id, which the browser uses only to remember that session's last board position and zoom in `localStorage`. ```bash curl -s 'http://localhost:6060/api/board?room=' @@ -43,7 +43,7 @@ Install the dependencies first with `npm ci` in this directory; they are separat The sync server and the web server each run as a systemd user service. Save the two unit files below under `~/.config/systemd/user/`, with `WorkingDirectory` set to this directory. -`wb-sync.service`: +`whiteboard-sync.service`: ```ini [Unit] @@ -59,7 +59,7 @@ RestartSec=5 WantedBy=default.target ``` -`wb-web.service`: +`whiteboard-web.service`: ```ini [Unit] @@ -80,16 +80,16 @@ Then enable both. `enable-linger` keeps user services running after you log out. ```bash loginctl enable-linger "$USER" systemctl --user daemon-reload -systemctl --user enable --now wb-sync wb-web +systemctl --user enable --now whiteboard-sync whiteboard-web ``` -Restart after a configuration change with `systemctl --user restart wb-sync wb-web`; read a log with `journalctl --user -u wb-sync -f` or `journalctl --user -u wb-web -f`. +Restart after a configuration change with `systemctl --user restart whiteboard-sync whiteboard-web`; read a log with `journalctl --user -u whiteboard-sync -f` or `journalctl --user -u whiteboard-web -f`. The whiteboard page is at `http://localhost:/`. The same port serves the chat under `/chat/` and the sync websocket under `/sync/`, so exposing `webPort` alone is enough. The Vite dev server binds localhost only. Its HMR transport is intentionally disabled for this persistent page, so refresh manually after changing client source. ## Embedded chat -The chat panel is an iframe holding a T3 Code instance served on `chatPort`. This directory is `fork/whiteboard/` of a T3 Code fork ([orbitingflea/t3code](https://github.com/orbitingflea/t3code)); the T3 Code at the repository root, two levels up, carries the whiteboard's embedding changes, and `run-t3.sh` here starts it. The instance keeps its own data directory and never reads a personal T3 installation. Vite proxies `/chat/` on `webPort` to it, together with the chat's own `/api`, `/ws`, and `/.well-known` paths, so the iframe loads from the whiteboard's origin. See [run-t3.md](run-t3.md) for how to build and run it. +The chat panel is an iframe holding a T3 Code instance served on `chatPort`. This directory is `fork/whiteboard/` of this repository, a T3 Code fork; the T3 Code at the repository root, two levels up, carries the whiteboard's embedding changes, and `run-t3.sh` here starts it. The instance keeps its own data directory and never reads a personal T3 installation. Vite proxies `/chat/` on `webPort` to it, together with the chat's own `/api`, `/ws`, and `/.well-known` paths, so the iframe loads from the whiteboard's origin. See [run-t3.md](run-t3.md) for how to build and run it. ## Tests diff --git a/fork/whiteboard/run-t3.md b/fork/whiteboard/run-t3.md index 5d69f7d035df1..3a957fa1b6865 100644 --- a/fork/whiteboard/run-t3.md +++ b/fork/whiteboard/run-t3.md @@ -18,7 +18,7 @@ VITE_T3_WHITEBOARD=1 pnpm --dir apps/web run build `run-t3.sh` starts the T3 Code of the repository it sits in. Three environment variables override its defaults: `T3_PORT` (default `6070`, must equal `chatPort` in `~/.whiteboard/config.json`), `T3_DATA` (default `~/.whiteboard/t3-userdata`), and `T3_PROJECT` (default the repository root). `T3_PROJECT` is only the server's working directory: with auto-bootstrap off it opens no project, and it does not choose a board. -Save this as `~/.config/systemd/user/wb-t3.service`, with `WorkingDirectory` set to the repository root: +Save this as `~/.config/systemd/user/whiteboard-chat.service`, with `WorkingDirectory` set to the repository root: ```ini [Unit] @@ -39,10 +39,10 @@ Then enable it. `enable-linger` keeps user services running after you log out. ```bash loginctl enable-linger "$USER" systemctl --user daemon-reload -systemctl --user enable --now wb-t3 +systemctl --user enable --now whiteboard-chat ``` -Restart after a rebuild with `systemctl --user restart wb-t3`; read its log with `journalctl --user -u wb-t3 -f`. +Restart after a rebuild with `systemctl --user restart whiteboard-chat`; read its log with `journalctl --user -u whiteboard-chat -f`. ## Embedding changes to T3 Code