From 8e310e5568b1310350ba7d9e6564490a3c9c2162 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 27 Nov 2026 23:21:14 -0500 Subject: [PATCH 01/16] fix(core): rebase a copied or moved data folder onto its own library The first read of a data folder now points a library entry that names another data folder's library, or a missing place, at the same folder inside this data folder when it exists there, so a copy no longer edits the original. Libraries placed elsewhere keep their absolute path. --- backend/app/core/config.py | 11 +++++- backend/app/core/data_folder.py | 66 +++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 backend/app/core/data_folder.py diff --git a/backend/app/core/config.py b/backend/app/core/config.py index ad43df9..b6e2f69 100644 --- a/backend/app/core/config.py +++ b/backend/app/core/config.py @@ -43,7 +43,16 @@ def _ensure(path: Path) -> Path: def data_dir() -> Path: raw = env("DATA_DIR") - return _ensure(Path(raw).expanduser() if raw else Path.home() / "FormCite") + folder = _ensure(Path(raw).expanduser() if raw else Path.home() / "FormCite") + key = str(folder.resolve()) + if key not in _SETTLED: + _SETTLED.add(key) + from app.core.data_folder import settle + settle(folder.resolve()) + return folder + + +_SETTLED: set[str] = set() def discovery_path() -> Path: diff --git a/backend/app/core/data_folder.py b/backend/app/core/data_folder.py new file mode 100644 index 0000000..648bcec --- /dev/null +++ b/backend/app/core/data_folder.py @@ -0,0 +1,66 @@ +import json +import os +import tempfile +from pathlib import Path + +REGISTRY = "libraries.json" +DATABASE = "library.sqlite" + + +def _inside(path: Path, folder: Path) -> bool: + try: + path.relative_to(folder) + except ValueError: + return False + return True + + +def _foreign_folder(root: Path, folder: Path) -> bool: + parent = root.parent + if not root.exists(): + return True + return parent != folder and (parent / REGISTRY).is_file() + + +def place(raw: str, folder: Path) -> str: + root = Path(raw).expanduser() + if not root.is_absolute(): + return raw + root = Path(os.path.normpath(root)) + if _inside(root, folder): + return str(root) + here = folder / root.name + if (here / DATABASE).is_file() and _foreign_folder(root, folder): + return str(here) + return str(root) + + +def settle(folder: Path) -> bool: + target = folder / REGISTRY + try: + data = json.loads(target.read_text(encoding="utf-8")) + except (OSError, ValueError): + return False + if not isinstance(data, dict) or not isinstance(data.get("libraries"), list): + return False + changed = False + for item in data["libraries"]: + if not isinstance(item, dict) or not isinstance(item.get("root"), str) or not item["root"]: + continue + fixed = place(item["root"], folder) + if fixed != item["root"]: + item["root"] = fixed + changed = True + if not changed: + return False + fd, tmp = tempfile.mkstemp(prefix=".libraries.", suffix=".tmp", dir=folder) + try: + with os.fdopen(fd, "w", encoding="utf-8") as handle: + json.dump(data, handle, indent=2) + handle.flush() + os.fsync(handle.fileno()) + os.replace(tmp, target) + except BaseException: + Path(tmp).unlink(missing_ok=True) + raise + return True From dae1641abbf8bac2054c874128d1a5f3748eb1b5 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 27 Nov 2026 23:21:56 -0500 Subject: [PATCH 02/16] fix(routers): answer 404 for an unknown api path under every method A catch-all route for /api now sits after every real api route, so the window's static mount no longer answers 405 to a POST, PUT or DELETE on a path that does not exist. The look routes are mounted with the others so the catch-all cannot shadow them. --- backend/app/routers/registry.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/backend/app/routers/registry.py b/backend/app/routers/registry.py index 9b6d50a..dc543bb 100644 --- a/backend/app/routers/registry.py +++ b/backend/app/routers/registry.py @@ -1,4 +1,4 @@ -from fastapi import APIRouter, FastAPI +from fastapi import APIRouter, FastAPI, HTTPException from app.routers import library, system from app.routers import transfer @@ -19,10 +19,19 @@ def register(name: str, router: APIRouter) -> None: GROUPS[name] = router +def _unknown(rest: str) -> None: + raise HTTPException(404, "Not Found") + + def mount(app: FastAPI) -> None: for router in GROUPS.values(): app.include_router(router, prefix=PREFIX) app.include_router(__import__("app.routers.mcp_http", fromlist=["router"]).router) + app.include_router(__import__("app.routers.look", fromlist=["router"]).router) + app.add_api_route( + PREFIX + "/{rest:path}", _unknown, include_in_schema=False, + methods=["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"], + ) register(system.GROUP, system.router) From 5cb73d0d2550dc35848cea329fadd60752c21a09 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 27 Nov 2026 23:24:51 -0500 Subject: [PATCH 03/16] docs(cite): state how form.ext maps cite service answers to json-rpc codes The host section now names the codes form.ext 0.12.0 actually gives: -32001 for a host-side refusal, -32003 for no approved pairing and -32004 for a FormCite refusal such as a removed token. --- docs/CITE_SERVICE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/CITE_SERVICE.md b/docs/CITE_SERVICE.md index 172ac05..6ee9aab 100644 --- a/docs/CITE_SERVICE.md +++ b/docs/CITE_SERVICE.md @@ -294,7 +294,7 @@ The JSON on stdout is `{"file", "entries": [{"time", "host", "name", "token_id", ## What a host maps, and what FormCite itself answers -The cite service speaks plain HTTP with JSON bodies, not JSON-RPC. A host that offers its add-ons a JSON-RPC call into FormCite (form.ext's `fcite.call`) turns these answers into its own error codes: a refusal (403) into its "denied" code, and a method the host does not know into -32601. FormCite never answers a JSON-RPC code. For a route it does not have it answers Starlette's own 404 `{"detail":"Not Found"}` to a `GET` and 405 `{"detail":"Method Not Allowed"}` to a `POST`, with or without a token. +The cite service speaks plain HTTP with JSON bodies, not JSON-RPC. A host that offers its add-ons a JSON-RPC call into FormCite (form.ext's `fcite.call`) turns these answers into its own error codes. form.ext 0.12.0 does it this way: a permission or service the person did not allow in the host is -32001 and never reaches FormCite; a host without `fcite.call` answers -32601; FormCite not running, or a pairing not approved (pending or denied), is -32003; any other answer that is not a success, a 403 for a removed token included, is -32004 with FormCite's own `detail` as the message. FormCite never answers a JSON-RPC code. For a route it does not have it answers Starlette's own 404 `{"detail":"Not Found"}` to a `GET` and 405 `{"detail":"Method Not Allowed"}` to a `POST`, with or without a token. The consent sentence the owner approved for form.ext's `fcite.addon` permission is "Let {Name} search, cite and add to your FormCite library?". That sentence is the host's own prompt. FormCite's approval is a second, separate consent in its Connections view, which shows the request as "Asks to search, cite and add to your FormCite library" (or "Asks to search and cite from your FormCite library" for a read-only request) with Approve, Approve reading only and Deny. From 7c2a4642d5899fd1b38a747b29d0e240eea62f87 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 27 Nov 2026 23:25:09 -0500 Subject: [PATCH 04/16] docs(cite): record the hello example run through form.ext fcite.call FormCite answered a real search from form.ext 0.12.0's host bridge and hello example after consent and approval; the denied and older host error objects are recorded with the two form.ext commits. --- docs/CITE_SERVICE.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/CITE_SERVICE.md b/docs/CITE_SERVICE.md index 6ee9aab..fd92b8e 100644 --- a/docs/CITE_SERVICE.md +++ b/docs/CITE_SERVICE.md @@ -300,7 +300,7 @@ The consent sentence the owner approved for form.ext's `fcite.addon` permission ## Run against a real engine (2026-11-27) -Run once end to end on FormCite 0.11.0 (branch `feat/themes-polish-pairing-0.12.0`): a built window served by the engine on port 8515 with its own data folder, 2,000 BibTeX items imported, style engine hayagriva 0.10.1. The caller was a stand-in client, a Python script making the same loopback HTTP calls a host makes; it was not form.ext's hello example, because form.ext's `fcite.call` is not on form.ext's main. The approval and the revoke were clicks in the window in headless Chrome. +Run once end to end on FormCite 0.11.0 (branch `feat/themes-polish-pairing-0.12.0`): a built window served by the engine on port 8515 with its own data folder, 2,000 BibTeX items imported, style engine hayagriva 0.10.1. This first run checked the routes with a Python script as the caller; the run with form.ext's own host and its hello example is in the next section. The approval and the revoke were clicks in the window in headless Chrome. - Before pairing, no token: search, get, cite, bibliography, add and import each answered 403 `This needs a FormCite service token, and none was sent.` - `POST /pair` `{"host":"standin","name":"Stand-in Host","scope":"write"}` answered 200 with a request id and secret; a poll answered `"status":"pending"`. While pending, a made-up token got 403 `This service token is not known to FormCite.` on all six. @@ -308,3 +308,17 @@ Run once end to end on FormCite 0.11.0 (branch `feat/themes-polish-pairing-0.12. - With the token: `GET /search?q=consequences&limit=2` 200, total 2000, two items; `GET /items/{id}` 200; `POST /cite` apa 200, `(Author0 & Writer0, 1980; Author1 & Writer1, 1981)`; `POST /bibliography` ieee 200, two entries; `POST /items` 201, a new book; `POST /import` 201, one added (a second run of the same text skipped it as a duplicate). The four writes are in the write log under the token's holder. - After the click on Remove access, then Remove: all six answered 403 `This service token was revoked by the person who uses FormCite.` - Layout shift at CPU 4x and 400 ms, 50,000 bytes per second: 0 for opening Connections with the request waiting and 0 for the approval, with and without input. + +## Run with form.ext's hello example (2026-11-27) + +Run on FormCite 0.13.9 (branch `feat/close-0.13.10`), a built window served by the engine on port 8911 with its own data folder: 2,000 BibTeX items imported, plus one item titled "Learning to cite through the R1 closing probe", which only this library holds (the hello example always searches `learning`, and the seed has no other match). The two form.ext commits used: + +- new host: form.ext 0.12.0, `affacd2a9f92845bb054b3a5aef54c5092d344be` (branch `feat/fcite-call-0.12.0`, not merged); +- older host: form.ext 0.11.0, `a449e91b0412446435d3adbef6d57f0fcffa1f7d` (`main`). + +form.ext's window has no switch that sends Preview's `fcite.call` to a real FormCite: Preview always answers from its simulated library. The run therefore used form.ext's own host pieces unchanged, joined by a small page: the contract's host bridge (`contract/host/host-bridge.ts`) mounted the hello example (`contract/examples/hello`) in its sandboxed frame, and the bridge's service handler passed each call to form.ext's Python host client (`FamilyService` in `contract/host/python/formext_host.py`), which paired with FormCite as `formext` ("form.ext") with scope `write` and made the HTTP call. The port came from FormCite's `engine.json`. Everything a person does was a click in Chrome (headless). + +- Allowed: the host's consent listed "Let Hello search, cite and add to your FormCite library?"; after Allow, the request showed in Connections as "form.ext, formext, Asks to search, cite and add to your FormCite library"; after Approve the host collected the token and the hello panel showed `1 found: Learning to cite through the R1 closing probe`. The answer was `{"query":"learning","total":1,"limit":3,"offset":0,"items":[{"id":"5mpqpsrtp7","type":"article-journal","title":"Learning to cite through the R1 closing probe","creators":"Quillfeather","year":2026,"container_title":"Journal of Probe Results","doi":null,"snippet":"[Learning] to cite through the R1 closing probe"}]}`. The engine's access log has `GET /api/cite/v1/search?q=learning&limit=3` 200, and `service tokens` shows the `formext` token last used at the same second. `service-log` shows nothing for it, because the service log holds writes only and a search is a read. +- Denied in the host: with `fcite.addon` turned off, `{"code":-32001,"message":"Hello does not have the fcite.addon permission"}`; with the permission but FormCite not among the allowed services, `{"code":-32001,"message":"Hello was not allowed to use FormCite"}`. Neither reached FormCite. +- Denied in FormCite: after Remove access, `{"code":-32004,"message":"This service token was revoked by the person who uses FormCite."}`; with a new pairing request denied, `{"code":-32003,"message":"FormCite has not approved this app yet"}`. form.ext gives -32001 only for its own permission, never for a FormCite refusal. +- Older host: the 0.11.0 host bridge with the same hello files answered `{"code":-32601,"message":"fcite.call is not in API 1"}`, and the panel showed `-32601: this app cannot reach FormCite yet`. The 0.11.0 Python host's acceptance check (`formext_host.check`) refuses the hello package outright, "it asks for a permission that does not exist", so an older host that runs that check never loads the package and the -32601 is never reached. From ac27830f8cec4eec17e1b3c2d146042c4d83c895 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 27 Nov 2026 23:25:19 -0500 Subject: [PATCH 05/16] docs(backend): log what the form.ext fcite.call run showed of the service Notes that the service log holds writes only, how form.ext maps refusals, and a pairing toast that stayed after approval. --- backend/HASHOUT_LOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/HASHOUT_LOG.md b/backend/HASHOUT_LOG.md index 3320923..f6344d4 100644 --- a/backend/HASHOUT_LOG.md +++ b/backend/HASHOUT_LOG.md @@ -1689,3 +1689,7 @@ Run in v0.12.0 work (2026-11-27), no code changed. A stand-in Python client aske ## app/core/look_store.py, app/routers/look.py, app/main.py {#app-window-look} New in v0.13.9 (2026-11-27). The window look (mode, dark theme, light theme, accent, title field) lives in `window-look.json` in the data folder, written the same way as `network.json` in `app/net/switches.py`: a temp file in the same folder, `fsync`, `os.replace`, under a lock. Every value is checked against a fixed list (themes match `frontend/index.html` and `ui/themes.ts`; accent is `#rrggbb` lowercased or empty for the default), and anything else is dropped, so the file can never feed a bad value into the page. `state()` adds `saved`, true once the file exists. `GET` and `PUT /api/window/look` both depend on `window_only`. The router is included from `main.py` because `routers/registry.py` belongs to the orchestrator; moving it into the registry is a one-line change there. `main.py` now answers `GET /` and `GET /index.html` itself, before the static mount, with `Cache-Control: no-store`: when the look is saved it adds `data-fc-...` attributes to the first `` tag, each value passed through `html.escape(quote=True)`. No page script is added and the engine sends no Content-Security-Policy header, so nothing about that changes. Checked across ports 8812 and 8822 on one data folder; the numbers are in the frontend entry `src-look-in-engine`. + +## app/routers/pair.py, app/routers/service.py, app/routers/cite_read.py, app/service/writelog.py {#app-cite-service-formext-run} + +Run in v0.13.10 work (2026-11-27), no code changed. form.ext 0.12.0 (`affacd2`) host bridge and Python `FamilyService` with its hello example, against the engine on 8911 with 2,001 items: pair as `formext` scope `write`, Approve in Connections, `GET /search?q=learning&limit=3` 200, one hit. The service log is writes only (`writelog`), so a read through a token leaves no line in `service-log`; proof of a read is the engine's access log and the token's `last_used_at`. form.ext maps a revoked token's 403 to -32004 and a denied pairing to -32003; -32001 is only the host's own permission. `FamilyService` takes the port as an argument and does not read `engine.json` itself; the host passes it in. A window toast "form.ext asks to use your library. Open Connections to answer." was still on screen after the request was approved (`/tmp/R1/shots/fc-connections-approved.png`). From f622c970918d6d18b5d45acf20324d456455163b Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 27 Nov 2026 23:26:23 -0500 Subject: [PATCH 06/16] docs(data): explain copying, moving and restoring a data folder A new page lists what the data folder holds and how a copied, moved or older data folder finds its own libraries while a library placed elsewhere keeps its path. --- docs/DATA_FOLDER.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 docs/DATA_FOLDER.md diff --git a/docs/DATA_FOLDER.md b/docs/DATA_FOLDER.md new file mode 100644 index 0000000..73be39b --- /dev/null +++ b/docs/DATA_FOLDER.md @@ -0,0 +1,27 @@ +# The data folder and its libraries + +FormCite keeps everything it writes in one data folder: `~/FormCite` by default, or the folder named by `FORMCITE_DATA_DIR`. + +## What is inside + +- `libraries.json` · the list of libraries and which one is current +- `Library/` · the default library: `library.sqlite` and a `files/` folder for stored attachments +- `engine.json` · where the running engine listens (rewritten at each start) +- `window-look.json`, `network.json` · window look and network switches +- `Logs/` and the engine error log + +A library you create with `library new NAME` lives in the data folder as `NAME/`, unless you give it a folder of your own. + +## Copying, moving and restoring + +A data folder can be copied or moved as a whole: for a backup, to a new computer, or to restore one. Stop FormCite first, then copy or move the folder, and point `FORMCITE_DATA_DIR` at the new place (or put it back at `~/FormCite`). + +The first time FormCite reads a data folder in a run, it checks every entry in `libraries.json`: + +- an entry inside this data folder is kept as it is; +- an entry that points at a library folder of another data folder (a folder holding its own `libraries.json`), or at a place that no longer exists, is pointed at the folder of the same name inside this data folder, when that folder holds a `library.sqlite`; +- any other entry is a library you placed elsewhere on purpose and keeps its path. + +So a copy opens its own libraries and never the original's: an edit made through the copy does not show in the original, and the reverse. A moved folder opens with all its items. A data folder written by an older version, which stored every library by its full path, opens the same way and is rewritten once. + +A library you placed outside the data folder is not copied with it. Copy that folder too, and if its path is different on the new computer, run `library new NAME --root PATH` there. From ff6755ef883747aad0abb261a7ad7eadc0295395 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 27 Nov 2026 23:26:45 -0500 Subject: [PATCH 07/16] docs(hashout): log the data folder rebase, the api 404 and the trash run The backend entry records why copies shared a library and how the catch-all route sits; the frontend entry records the Trash purge run in both themes. --- backend/HASHOUT_LOG.md | 4 ++++ frontend/HASHOUT_LOG.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/backend/HASHOUT_LOG.md b/backend/HASHOUT_LOG.md index f6344d4..b8bc5e3 100644 --- a/backend/HASHOUT_LOG.md +++ b/backend/HASHOUT_LOG.md @@ -1693,3 +1693,7 @@ New in v0.13.9 (2026-11-27). The window look (mode, dark theme, light theme, acc ## app/routers/pair.py, app/routers/service.py, app/routers/cite_read.py, app/service/writelog.py {#app-cite-service-formext-run} Run in v0.13.10 work (2026-11-27), no code changed. form.ext 0.12.0 (`affacd2`) host bridge and Python `FamilyService` with its hello example, against the engine on 8911 with 2,001 items: pair as `formext` scope `write`, Approve in Connections, `GET /search?q=learning&limit=3` 200, one hit. The service log is writes only (`writelog`), so a read through a token leaves no line in `service-log`; proof of a read is the engine's access log and the token's `last_used_at`. form.ext maps a revoked token's 403 to -32004 and a denied pairing to -32003; -32001 is only the host's own permission. `FamilyService` takes the port as an argument and does not read `engine.json` itself; the host passes it in. A window toast "form.ext asks to use your library. Open Connections to answer." was still on screen after the request was approved (`/tmp/R1/shots/fc-connections-approved.png`). + +## app/core/config.py, app/core/data_folder.py, app/routers/registry.py {#app-data-folder-copy-and-api-404} + +New in v0.13.10 (2026-11-27). Cause of the shared copies: `store/libraries.py` writes each library's `root` as a full path, so `cp -a A B` left B's `libraries.json` naming `A/Library`. `data_dir()` now runs `data_folder.settle` once per process per resolved folder, before anything reads `libraries.json`, in the engine and in the CLI alike. `settle` keeps an entry inside the folder, keeps a relative entry untouched, and rewrites an absolute entry outside it to `folder / basename` when that holds `library.sqlite` and the old place is missing or sits in a folder that holds its own `libraries.json`; anything else is a library placed elsewhere and keeps its path. The write is temp file, `fsync`, `os.replace`, as `store/libraries.py` does. The stored value is still absolute because `Library.__post_init__` resolves a relative root against the working folder; storing `Library` relative needs that file changed, which belongs to another slice. Checked on 2,000 items: copy then edit through the copy left the original's title as it was, and the reverse; `mv` to a new name listed 2000 of 2000; an old-format copy written before the fix opened its own library and was rewritten once; a library at `/tmp/R2/ext/Thesis` kept its path through a copy. `registry.mount` now ends with `/api/{rest:path}` for every method raising 404 `Not Found`, after every group, the MCP route and the look routes, so StaticFiles at `/` no longer answers 405 to a POST on an unknown api path. The look router is included here as well as in `main.py`; the first match wins, and the openapi path table hashes the same before and after (90 paths, 112 operations). diff --git a/frontend/HASHOUT_LOG.md b/frontend/HASHOUT_LOG.md index 9c40f58..f34d930 100644 --- a/frontend/HASHOUT_LOG.md +++ b/frontend/HASHOUT_LOG.md @@ -476,3 +476,7 @@ New in v0.13.9 (2026-11-27). Browser storage is per origin, and the desktop engi ## src/ui/detail.ts, src/styles/detail.css, src/ui/pref-detail.ts, src/ui/duplicates.ts, src/ui/trash.ts, src/styles/review.css {#src-title-keys-and-placeholders} New in v0.13.9 (2026-11-27). Supersedes the title keys in `src-title-field-mode`. Plain Enter now saves the title like every other one-line field; Shift+Enter and Ctrl or Cmd+Enter still save; no line break is ever inserted (Enter during IME composition is swallowed and does not save); Escape restores; blur saves. The hint reads "Enter to save" and is `visibility: hidden` until the title row has `:focus-within`, so its space stays reserved. Fixed mode: the title row draws `::before` and `::after` as grid items over the textarea's cell (`position: relative` lifts them above it without a z-index), each 1 px inside the border and filled with `--surface`, so scrolled text never shows in the top or bottom padding and the box cuts at exactly three lines. `::after` is always `--space-1h` plus `--space-4` tall; only its gradient changes when the row carries `data-overflow="true"`, so the fade never changes geometry. `markOverflow()` reads `scrollHeight` against `clientHeight` once from `fit()` after a value is written, and again from one `ResizeObserver` on the title box (a pane that was hidden or a mode change), and writes only that attribute; it skips a box with no height. In Preferences the select lists "Fixed height" first by sorting a copy of `TITLE_FIELD_OPTIONS` in `pref-detail.ts`; the array itself in `engine/preferences.ts` still lists Grow first. Placeholders: each group and trash row is built once with a hidden `div.fc-rv-gone` (dashed `--line-2` border, `--surface-1` fill, muted 12 px text, centered); a merge or restore or purge writes its sentence and unhides it, and `fillGroup` and `fillRow` hide it again. Merge reads "Merged into [kept title]. The extra copy is (copies are) in the trash." with no Undo, because a merge also fills empty fields and moves attachments and notes onto the kept item, and no engine call reverses that. Restore reads "Restored to the library." with Undo, which calls the existing `POST /library/items/{id}/trash` and puts the same row back in place (no reload, so other placeholders keep their height). Purge reads "Deleted for good." Checked in a private built copy, 2,000 items plus a 300-character and a short title, DOI pairs and trashed items made with `./formcite cli`, CPU 4x, 400 ms, 50 kB/s, cache off, fresh engine per load: six alternating selections in Fixed 0 and 0 (overflow true, false, true, false, true, false); focus and leave the title 0 and 0, hint visible then hidden, no request; Enter one PATCH 200, no line break, leaving after it no second request; merge by click and by script call 0 and 0; restore by click and by script call 0 and 0; Undo 0 and 0; Grow then Fixed again marks overflow true. `fc_exit2.py`: every step 0 and 0, `title_after_in_list` True. Note that the CLI with a copied `FORMCITE_DATA_DIR` still reached the same library as the original folder, so copies of a data folder are not isolated. + +## src/ui/trash.ts, src/styles/review.css {#src-trash-purge-run} + +Run in v0.13.10 work (2026-11-27), no code changed. Trash "Deleted for good." in headless Chrome, CPU 4x, 400 ms and 50,000 bytes per second: one item by real clicks (Delete for good, then the confirm) and one by `element.click()` from a script, in dark and in light; the purged row keeps its 44 px box with the dashed placeholder over it, the summary counts down by two, and layout shift is 0 without input and 0 with input in both themes. The copy-isolation note above is fixed in the backend entry `app-data-folder-copy-and-api-404`. From c7cad519b94b959536a99d3171b301392b5bc5cd Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 27 Nov 2026 23:30:45 -0500 Subject: [PATCH 08/16] fix(desktop): open the window when the engine gives its address The shell waited for the engine to print a window key that FormCite's engine never prints, so the packaged app failed after ten seconds. The window claims its key with the launch code, so the wait is removed. --- src-tauri/src/engine_start.rs | 4 ---- src-tauri/src/main.rs | 17 +++-------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src-tauri/src/engine_start.rs b/src-tauri/src/engine_start.rs index fe7a789..489650e 100644 --- a/src-tauri/src/engine_start.rs +++ b/src-tauri/src/engine_start.rs @@ -6,7 +6,6 @@ pub const APP: &str = "FormCite"; pub const SHELL_ENV: &str = "FORMCITE_SHELL_PID"; pub const PARENT_ENV: &str = "FORMCITE_PARENT_PID"; pub const ADDRESS_WAIT: Duration = Duration::from_secs(90); -pub const KEY_WAIT: Duration = Duration::from_secs(10); pub const EXIT_WAIT: Duration = Duration::from_secs(1); pub const BUSY_CODE: i32 = 2; const DATA_NAME: &str = "FormCite"; @@ -19,21 +18,18 @@ const LINE_CHARS: usize = 300; #[derive(Clone, Copy, Debug, PartialEq)] pub enum Wait { Address, - Key, } impl Wait { pub fn limit(self) -> Duration { match self { Wait::Address => ADDRESS_WAIT, - Wait::Key => KEY_WAIT, } } pub fn what(self) -> &'static str { match self { Wait::Address => "its engine to say which address it serves on", - Wait::Key => "its engine to hand over the key for the window", } } } diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index f0f23c9..a304e76 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -200,7 +200,6 @@ fn main() { .env("FORMCITE_ENGINE_PORT", "0") .env(engine_start::PARENT_ENV, std::process::id().to_string()) .env(engine_start::SHELL_ENV, std::process::id().to_string()) - .env("FORMCITE_WINDOW_KEY_STDOUT", "1") .env("FORMCITE_LAUNCH_CODE", &code) .spawn() .map_err(|err| engine_start::Failure::NotStarted(err.to_string())) @@ -218,7 +217,6 @@ fn main() { tauri::async_runtime::spawn(async move { let pattern = regex::Regex::new(r"http://127\.0\.0\.1:(\d+)").unwrap(); - let key_pattern = regex::Regex::new(r"formcite-window-key: ([A-Za-z0-9_-]{32,})").unwrap(); let (tx, mut events) = tauri::async_runtime::channel::(64); let late = tx.clone(); tauri::async_runtime::spawn(async move { @@ -231,8 +229,6 @@ fn main() { }); start_limit(&late, engine_start::Wait::Address.limit(), Some(engine_start::Wait::Address)); let mut port: Option = None; - let mut key: Option = None; - let mut waiting = false; let mut stopped = false; let mut tail = engine_start::Tail::default(); let mut failure = engine_start::Failure::Stopped(None); @@ -254,28 +250,21 @@ fn main() { break; } }; - if key.is_none() { - key = key_pattern.captures(&text).map(|found| found[1].to_string()); - } for line in text.lines() { tail.push(line); } if port.is_none() { port = pattern.captures(&text).and_then(|c| c[1].parse::().ok()); } - if port.is_some() && key.is_some() { + if port.is_some() { break; } - if port.is_some() && !waiting { - waiting = true; - start_limit(&late, engine_start::Wait::Key.limit(), Some(engine_start::Wait::Key)); - } } drop(late); - match port.filter(|_| key.is_some()) { + match port { Some(port) => { let url: tauri::Url = format!("http://127.0.0.1:{port}/#launch={code}").parse().unwrap(); - if !open_main(&handle, url, key) { + if !open_main(&handle, url, None) { engine_failed(&handle, engine_start::Failure::Window, &engine_start::Tail::default()); } } From 6d35171f2f69c8f960967e90258ba1269a36467e Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 27 Nov 2026 23:30:45 -0500 Subject: [PATCH 09/16] feat(desktop): the splash opens in the saved theme on the next launch When the window is ready the shell copies the saved look from the data folder into the splash's own storage. --- src-tauri/src/reveal.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src-tauri/src/reveal.rs b/src-tauri/src/reveal.rs index d841185..f500a5e 100644 --- a/src-tauri/src/reveal.rs +++ b/src-tauri/src/reveal.rs @@ -45,6 +45,21 @@ pub fn app_ready(app: tauri::AppHandle) { show_main(&app); } +fn remember_look(splash: &WebviewWindow) { + let Some(folder) = crate::engine_start::data_folder(&|name: &str| std::env::var(name).ok(), std::env::home_dir().as_deref()) else { return }; + let Ok(text) = std::fs::read_to_string(folder.join("window-look.json")) else { return }; + let Ok(saved) = serde_json::from_str::(&text) else { return }; + let word = |key: &str, fallback: &str| saved.get(key).and_then(|value| value.as_str()).unwrap_or(fallback).to_string(); + let theme = serde_json::json!({ "theme": word("mode", "system"), "accentColor": word("accent", "") }).to_string(); + let look = serde_json::json!({ "dark": word("dark", "default"), "light": word("light", "default") }).to_string(); + let script = format!( + "try {{ localStorage.setItem('formcite.theme', {}); localStorage.setItem('formcite.look', {}); }} catch (e) {{}}", + serde_json::Value::String(theme), + serde_json::Value::String(look) + ); + let _ = splash.eval(&script); +} + fn show_main(app: &tauri::AppHandle) { if REVEALED.swap(true, Ordering::SeqCst) { return; @@ -54,6 +69,7 @@ fn show_main(app: &tauri::AppHandle) { std::thread::sleep(wait); } if let Some(splash) = app.get_webview_window("splash") { + remember_look(&splash); let _ = splash.eval("window.formciteSplashDone && window.formciteSplashDone()"); std::thread::sleep(BAR_FINISH); } From e75cb85a11d4d63426dc3a798df228471f0eaaf5 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 27 Nov 2026 23:30:45 -0500 Subject: [PATCH 10/16] docs(desktop): log the first real desktop run and what it fixed The engine start fix and the splash look, with how each was seen. --- src-tauri/HASHOUT_LOG.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src-tauri/HASHOUT_LOG.md b/src-tauri/HASHOUT_LOG.md index 89da9b0..99eb67a 100644 --- a/src-tauri/HASHOUT_LOG.md +++ b/src-tauri/HASHOUT_LOG.md @@ -260,3 +260,21 @@ Verbatim. Saves position, size and maximized state to `window.json` in the app c - logged: v0.12.0 · 2026-11-27 The old `BACKGROUND` (10,10,10) was the family's card color, not this window's: FormCite's pre-paint ground is `#08080a` dark and `#f3f1ed` light. `background` asks the splash window for the system theme and builds the main window on the matching ground, so off macOS (where the window is visible from build) a light system no longer shows a dark frame under a light page. A saved Dark choice on a light system still gets the light ground for that frame; the shell cannot read the page's storage (the page is on 127.0.0.1 at a new port each launch, the splash on the app origin). The splash page moves to `frontend/public/splash/index.html` (see frontend/HASHOUT_LOG.md #src-live-dot-splash); `tauri.conf.json` must point the splash window there. Not compiled: this sandbox has no GTK. Read against FormLedger's `src-tauri/src/reveal.rs` and form.md's, which still use the constant: `WebviewWindow::theme` returns `tauri::Result`, `get_webview_window` needs the `Manager` import already in the file, and `open_main` passes its `&AppHandle`. + +--- + +## src/main.rs, src/engine_start.rs, src/reveal.rs · the first real desktop run {#first-desktop-run} + +### src/main.rs · the engine start no longer waits for a printed key +- refers-to: src/main.rs :: setup; src/engine_start.rs :: Wait +- kind: fix +- logged: v0.13.10 · 2026-11-27 + +The shell, ported from formtxt, waited ten seconds for the engine to print `formcite-window-key: ...` and failed with "it waited 10 seconds for its engine to hand over the key" when it did not. FormCite's engine never prints its key: the window claims it with the launch code the shell already passes in the address (`#launch=`), through `POST /api/window/key`. So the packaged app could not start. The shell now opens the window as soon as the engine says which address it serves on. `Wait::Key`, `KEY_WAIT`, the key pattern and the `FORMCITE_WINDOW_KEY_STDOUT` environment value are gone. Found and proven by the first release build that was ever run (Linux, WebKitGTK 2.52.6, a virtual display, the engine started from source in place of the frozen one): the library window opened with 2,000 items. A debug build is development mode by design (`dev_url`) and opens the dev server address without starting an engine. + +### src/reveal.rs · remember_look +- refers-to: src/reveal.rs :: remember_look, show_main +- kind: feature +- logged: v0.13.10 · 2026-11-27 + +The splash is on the app's own origin and cannot read the engine's saved look, so it only followed the system's light or dark setting. When the window is ready, `remember_look` reads `window-look.json` from the data folder and writes `formcite.theme` and `formcite.look` into the splash's own storage, which the splash page already reads before paint. The next launch's splash opens in the saved theme: seen in Ocean on the second launch after the file was written. The splash is one launch behind a change of theme, by design; nothing is written when the file is missing or unreadable. From 6872f1284711f4b969dc35c93a7360f50b5ee7d1 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 27 Nov 2026 23:31:13 -0500 Subject: [PATCH 11/16] fix(store): keep a library inside the data folder by its relative path The library list stores a root inside the data folder relative to it, so a copied or moved data folder is self-contained. A library placed elsewhere keeps its full path, and old full-path entries are still read. --- backend/app/store/libraries.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/backend/app/store/libraries.py b/backend/app/store/libraries.py index 4818561..90edc93 100644 --- a/backend/app/store/libraries.py +++ b/backend/app/store/libraries.py @@ -40,7 +40,8 @@ class Library: files_dir: Path = field(init=False) def __post_init__(self) -> None: - root = Path(self.root).expanduser().resolve() + root = Path(self.root).expanduser() + root = (root if root.is_absolute() else data_dir() / root).resolve() object.__setattr__(self, "root", root) object.__setattr__(self, "db_path", root / "library.sqlite") object.__setattr__(self, "files_dir", root / "files") @@ -110,10 +111,15 @@ def _entries(data: dict[str, Any]) -> list[Library]: return out +def _stored_root(root: Path) -> str: + home = data_dir().resolve() + return root.relative_to(home).as_posix() if root.is_relative_to(home) else str(root) + + def _save(libs: list[Library], current_name: str | None) -> None: _write({ "current": current_name, - "libraries": [{"name": lib.name, "root": str(lib.root)} for lib in libs], + "libraries": [{"name": lib.name, "root": _stored_root(lib.root)} for lib in libs], }) From 36bf87d8665b71bfbb31a9c05c2a2d5771bc9496 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 27 Nov 2026 23:31:13 -0500 Subject: [PATCH 12/16] refactor(engine): mount the look routes once, in the registry The registry includes the look router now; the second include in main.py is removed. --- backend/app/main.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/backend/app/main.py b/backend/app/main.py index acafbb9..8a22022 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -13,7 +13,6 @@ from fastapi.staticfiles import StaticFiles from app.core import config, look_store -from app.routers import look as look_routes from app.core.local_guard import LocalGuard from app.core.window_key import WindowKeyGuard from app.routers import registry @@ -52,7 +51,6 @@ async def lifespan(_: FastAPI): app.add_middleware(WindowKeyGuard) app.add_middleware(LocalGuard, origins=config.cors_origins()) registry.mount(app) -app.include_router(look_routes.router) _HTML_TAG = re.compile(r"]*>", re.IGNORECASE) _NO_STORE = {"Cache-Control": "no-store", "Pragma": "no-cache"} From aa75e75e48dc650432a9145d126f42c6746c535f Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 27 Nov 2026 23:41:17 -0500 Subject: [PATCH 13/16] feat(toast): let a notice open something when clicked A notice can now carry an open action, run when its text is clicked, and takes pointer events only then. --- frontend/src/ui/toast.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/ui/toast.ts b/frontend/src/ui/toast.ts index 7056b9c..6732671 100644 --- a/frontend/src/ui/toast.ts +++ b/frontend/src/ui/toast.ts @@ -5,7 +5,9 @@ const timers = new WeakMap(); const VISIBLE_MAX = 4; let watching = false; -export interface NoticeOptions { ms?: number; key?: string } +const openers = new WeakMap void>(); + +export interface NoticeOptions { ms?: number; key?: string; onOpen?: () => void } function stack(root: HTMLElement, fresh?: HTMLElement): void { const gap = parseFloat(getComputedStyle(root).rowGap) || 0; @@ -46,6 +48,7 @@ function watch(root: HTMLElement): void { const target = e.target instanceof Element ? e.target : null; const node = target?.closest('.fc-toast'); if (node && target?.closest('.fc-toast-close')) leave(node); + else if (node) openers.get(node)?.(); }); } @@ -61,12 +64,14 @@ export function toast(text: string, kind: 'info' | 'error' = 'info', opts: Notic const textEl = same.firstElementChild!; if (textEl.textContent !== text) textEl.textContent = text; same.classList.toggle('is-error', kind === 'error'); + if (opts.onOpen) openers.set(same, opts.onOpen); arm(same); stack(root); return () => leave(same); } const node = el(`
`); node.dataset.key = key; + if (opts.onOpen) { openers.set(node, opts.onOpen); node.style.pointerEvents = 'auto'; node.style.cursor = 'pointer'; } node.firstElementChild!.textContent = text; root.append(node); const live = (Array.from(root.children) as HTMLElement[]).filter((n) => !n.classList.contains('is-leaving')); From b0746a6a858365aea5f513329c33e3b8f7b47c18 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 27 Nov 2026 23:41:17 -0500 Subject: [PATCH 14/16] fix(connections): drop the asks toast once the request is answered The toast leaves when the last open request is answered or expires, stays with updated text while another waits, and opens Connections when clicked. --- frontend/src/ui/connections.ts | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/frontend/src/ui/connections.ts b/frontend/src/ui/connections.ts index db9feaa..0a1381f 100644 --- a/frontend/src/ui/connections.ts +++ b/frontend/src/ui/connections.ts @@ -163,13 +163,27 @@ export function bindConnections(engine: Engine, host: HTMLElement): void { setClass(count, 'is-on', n > 0); count.setAttribute('aria-label', n === 1 ? '1 app is waiting for your answer' : `${n} apps are waiting for your answer`); }); + const TOAST_KEY = 'connections-arrived'; + let dropToast: (() => void) | null = null; + const openConnections = (): void => { + if (panes.dataset.view !== 'connections') navs.find((b) => b.dataset.view === 'connections')?.click(); + }; + const askText = (list: PendingRequest[]): string => (list.length === 1 + ? `${list[0].name} asks to use your library. Open Connections to answer.` + : `${list.length} apps ask to use your library. Open Connections to answer.`); + const toastShown = (): boolean => !!document.querySelector(`#toast-root > [data-key="${TOAST_KEY}"]:not(.is-leaving)`); + const settleToast = (): void => { + if (!toastShown()) return; + const now = Date.now(); + const open = Array.from(requests.values()).filter((r) => !r.expiresAt || r.expiresAt > now); + if (!open.length) { dropToast?.(); dropToast = null; return; } + dropToast = toast(askText(open), 'info', { key: TOAST_KEY, ms: 8000, onOpen: openConnections }); + }; c.events.on('request:arrived', (list) => { - const first = list[list.length - 1]; - const text = list.length === 1 - ? `${first.name} asks to use your library. Open Connections to answer.` - : `${list.length} apps ask to use your library. Open Connections to answer.`; - toast(text, 'info', { key: 'connections-arrived', ms: 8000 }); + dropToast = toast(askText(list), 'info', { key: TOAST_KEY, ms: 8000, onOpen: openConnections }); }); + c.events.on('request:remove', settleToast); + c.events.on('request:update', settleToast); host.addEventListener('click', (e) => { const t = e.target instanceof Element ? e.target : null; From 04dd883fad41154275d3b13c5f144f82df48c53f Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 27 Nov 2026 23:41:25 -0500 Subject: [PATCH 15/16] docs(log): note the asks toast following its request Records how the toast is dismissed and opened and what was measured. --- frontend/HASHOUT_LOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/HASHOUT_LOG.md b/frontend/HASHOUT_LOG.md index f34d930..2f5decb 100644 --- a/frontend/HASHOUT_LOG.md +++ b/frontend/HASHOUT_LOG.md @@ -480,3 +480,7 @@ New in v0.13.9 (2026-11-27). Supersedes the title keys in `src-title-field-mode` ## src/ui/trash.ts, src/styles/review.css {#src-trash-purge-run} Run in v0.13.10 work (2026-11-27), no code changed. Trash "Deleted for good." in headless Chrome, CPU 4x, 400 ms and 50,000 bytes per second: one item by real clicks (Delete for good, then the confirm) and one by `element.click()` from a script, in dark and in light; the purged row keeps its 44 px box with the dashed placeholder over it, the summary counts down by two, and layout shift is 0 without input and 0 with input in both themes. The copy-isolation note above is fixed in the backend entry `app-data-folder-copy-and-api-404`. + +## src/ui/connections.ts, src/ui/toast.ts {#src-asks-toast-follows-request} + +New in v0.13.10 (2026-11-27). The "asks to use your library" toast (key `connections-arrived`, raised in `bindConnections`) now follows the requests. `settleToast` runs on `request:remove` and `request:update`: if the toast is on screen and no unexpired request is left it calls the dismiss function `toast()` returned, and if one or more are left it rewrites the same node's text through the existing key. It never raises a toast that is not already showing. `toast()` takes `onOpen`, kept in a WeakMap by node; the root's one click listener runs it for a click anywhere but the close button, and the node gets inline `pointer-events: auto` and `cursor: pointer` only then, since `shell.css` sets `.fc-toast` to `pointer-events: none` and that file is not this slice's. The opener clicks the Connections nav item unless the panes already show it. Checked in a private built copy, 2,000 items, CPU 4x, 400 ms, 50 kB/s, fresh engine and data folder per load: Approve and Deny each took the toast away 0.62 s after the click (the leave transition and the next refresh), layout shift 0 and 0; two requests, one Deny left the toast with the other app's name, the second Deny removed it; a click on the toast text moved the window from Items to Connections. One 0.005 shift with recent input appeared in the two-request runs when Connections opened, which is the view switch and not the toast. From 5abf5700660daa1e25df564e1687db6953160983 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 27 Nov 2026 23:52:09 -0500 Subject: [PATCH 16/16] chore(release): 0.14.0 --- CHANGELOG.md | 17 +++++++++++++++++ README.md | 2 +- backend/HASHOUT_LOG.md | 6 +++--- backend/app/__init__.py | 2 +- docs/CITE_SERVICE.md | 2 +- frontend/HASHOUT_LOG.md | 6 +++--- frontend/package-lock.json | 4 ++-- frontend/package.json | 2 +- frontend/src/version.ts | 2 +- native/formcite-style/Cargo.lock | 2 +- native/formcite-style/Cargo.toml | 2 +- native/formcite-style/pyproject.toml | 2 +- setup/HASHOUT_LOG.md | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/HASHOUT_LOG.md | 6 +++--- src-tauri/tauri.conf.json | 2 +- 17 files changed, 40 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de08646..febb173 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## 0.14.0 + +The desktop app starts, a copied library stands on its own, and an extension has searched a real FormCite. + +### Fixed +- **The desktop app did not start.** It waited ten seconds for its engine to hand over a key that the engine never sends, then gave up. It now opens the window as soon as the engine is ready. Seen working in a release build on Linux: the library opened with 2,000 items. +- **A copied data folder wrote into the original.** The library's place was stored as a full path, so a copy or a moved folder still pointed at the old one. A library inside the data folder is now stored by its relative path, and folders written by older versions are read and corrected on first open. See `docs/DATA_FOLDER.md`. +- **The pairing notice stayed on screen** after the request was answered. It now goes when the request is approved, denied or expires, and clicking it opens Connections. +- An unknown address under `/api` answers "not found" for every kind of request, not "method not allowed" for some. + +### Improved +- **The splash on the desktop** opens in the theme you chose, from the second launch after you choose it. + +### Under the hood +- `docs/CITE_SERVICE.md` records the first run with form.ext's own `hello` example against a real engine: one found title after consent and approval, and the codes a host gives for each refusal. +- Checked for this version: the release build on Linux with the engine started from source; "Deleted for good." in Trash; the arrow keys on the theme list; Meta+Enter and Control+Enter on the title. Not run: a packaged build with the frozen engine, and anything on macOS or Windows. + ## 0.13.9 Your theme and settings now stay with your library, the title saves on Enter, and a removed row says what happened. diff --git a/README.md b/README.md index cf20552..0a904cb 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@

- version 0.13.9 + version 0.14.0 Python 3.12 or later License: GPL-3.0-only Status: early diff --git a/backend/HASHOUT_LOG.md b/backend/HASHOUT_LOG.md index b8bc5e3..06d8e02 100644 --- a/backend/HASHOUT_LOG.md +++ b/backend/HASHOUT_LOG.md @@ -2,7 +2,7 @@ Living log of all comment content, explainers, rationale, TODOs, & removed (hashed-out) code for this side of the repo. Source files stay comment-free per dev-rules `sub-skills/hashout-log/SUB-SKILL.md`; everything they would have said lives here, indexed. This file is also the compressed contextual map of this side: read it first, then edit code surgically. -Current build version: v0.13.9 +Current build version: v0.14.0 Last updated: 2026-11-27 (US Eastern) · the lean rows route for the window's list and opening an attachment --- @@ -1692,8 +1692,8 @@ New in v0.13.9 (2026-11-27). The window look (mode, dark theme, light theme, acc ## app/routers/pair.py, app/routers/service.py, app/routers/cite_read.py, app/service/writelog.py {#app-cite-service-formext-run} -Run in v0.13.10 work (2026-11-27), no code changed. form.ext 0.12.0 (`affacd2`) host bridge and Python `FamilyService` with its hello example, against the engine on 8911 with 2,001 items: pair as `formext` scope `write`, Approve in Connections, `GET /search?q=learning&limit=3` 200, one hit. The service log is writes only (`writelog`), so a read through a token leaves no line in `service-log`; proof of a read is the engine's access log and the token's `last_used_at`. form.ext maps a revoked token's 403 to -32004 and a denied pairing to -32003; -32001 is only the host's own permission. `FamilyService` takes the port as an argument and does not read `engine.json` itself; the host passes it in. A window toast "form.ext asks to use your library. Open Connections to answer." was still on screen after the request was approved (`/tmp/R1/shots/fc-connections-approved.png`). +Run in v0.14.0 work (2026-11-27), no code changed. form.ext 0.12.0 (`affacd2`) host bridge and Python `FamilyService` with its hello example, against the engine on 8911 with 2,001 items: pair as `formext` scope `write`, Approve in Connections, `GET /search?q=learning&limit=3` 200, one hit. The service log is writes only (`writelog`), so a read through a token leaves no line in `service-log`; proof of a read is the engine's access log and the token's `last_used_at`. form.ext maps a revoked token's 403 to -32004 and a denied pairing to -32003; -32001 is only the host's own permission. `FamilyService` takes the port as an argument and does not read `engine.json` itself; the host passes it in. A window toast "form.ext asks to use your library. Open Connections to answer." was still on screen after the request was approved (`/tmp/R1/shots/fc-connections-approved.png`). ## app/core/config.py, app/core/data_folder.py, app/routers/registry.py {#app-data-folder-copy-and-api-404} -New in v0.13.10 (2026-11-27). Cause of the shared copies: `store/libraries.py` writes each library's `root` as a full path, so `cp -a A B` left B's `libraries.json` naming `A/Library`. `data_dir()` now runs `data_folder.settle` once per process per resolved folder, before anything reads `libraries.json`, in the engine and in the CLI alike. `settle` keeps an entry inside the folder, keeps a relative entry untouched, and rewrites an absolute entry outside it to `folder / basename` when that holds `library.sqlite` and the old place is missing or sits in a folder that holds its own `libraries.json`; anything else is a library placed elsewhere and keeps its path. The write is temp file, `fsync`, `os.replace`, as `store/libraries.py` does. The stored value is still absolute because `Library.__post_init__` resolves a relative root against the working folder; storing `Library` relative needs that file changed, which belongs to another slice. Checked on 2,000 items: copy then edit through the copy left the original's title as it was, and the reverse; `mv` to a new name listed 2000 of 2000; an old-format copy written before the fix opened its own library and was rewritten once; a library at `/tmp/R2/ext/Thesis` kept its path through a copy. `registry.mount` now ends with `/api/{rest:path}` for every method raising 404 `Not Found`, after every group, the MCP route and the look routes, so StaticFiles at `/` no longer answers 405 to a POST on an unknown api path. The look router is included here as well as in `main.py`; the first match wins, and the openapi path table hashes the same before and after (90 paths, 112 operations). +New in v0.14.0 (2026-11-27). Cause of the shared copies: `store/libraries.py` writes each library's `root` as a full path, so `cp -a A B` left B's `libraries.json` naming `A/Library`. `data_dir()` now runs `data_folder.settle` once per process per resolved folder, before anything reads `libraries.json`, in the engine and in the CLI alike. `settle` keeps an entry inside the folder, keeps a relative entry untouched, and rewrites an absolute entry outside it to `folder / basename` when that holds `library.sqlite` and the old place is missing or sits in a folder that holds its own `libraries.json`; anything else is a library placed elsewhere and keeps its path. The write is temp file, `fsync`, `os.replace`, as `store/libraries.py` does. The stored value is still absolute because `Library.__post_init__` resolves a relative root against the working folder; storing `Library` relative needs that file changed, which belongs to another slice. Checked on 2,000 items: copy then edit through the copy left the original's title as it was, and the reverse; `mv` to a new name listed 2000 of 2000; an old-format copy written before the fix opened its own library and was rewritten once; a library at `/tmp/R2/ext/Thesis` kept its path through a copy. `registry.mount` now ends with `/api/{rest:path}` for every method raising 404 `Not Found`, after every group, the MCP route and the look routes, so StaticFiles at `/` no longer answers 405 to a POST on an unknown api path. The look router is included here as well as in `main.py`; the first match wins, and the openapi path table hashes the same before and after (90 paths, 112 operations). diff --git a/backend/app/__init__.py b/backend/app/__init__.py index 2dd98b1..9e78220 100644 --- a/backend/app/__init__.py +++ b/backend/app/__init__.py @@ -1 +1 @@ -__version__ = "0.13.9" +__version__ = "0.14.0" diff --git a/docs/CITE_SERVICE.md b/docs/CITE_SERVICE.md index fd92b8e..ba43c2a 100644 --- a/docs/CITE_SERVICE.md +++ b/docs/CITE_SERVICE.md @@ -311,7 +311,7 @@ Run once end to end on FormCite 0.11.0 (branch `feat/themes-polish-pairing-0.12. ## Run with form.ext's hello example (2026-11-27) -Run on FormCite 0.13.9 (branch `feat/close-0.13.10`), a built window served by the engine on port 8911 with its own data folder: 2,000 BibTeX items imported, plus one item titled "Learning to cite through the R1 closing probe", which only this library holds (the hello example always searches `learning`, and the seed has no other match). The two form.ext commits used: +Run on FormCite 0.13.9 (branch `feat/close-0.14.0`), a built window served by the engine on port 8911 with its own data folder: 2,000 BibTeX items imported, plus one item titled "Learning to cite through the R1 closing probe", which only this library holds (the hello example always searches `learning`, and the seed has no other match). The two form.ext commits used: - new host: form.ext 0.12.0, `affacd2a9f92845bb054b3a5aef54c5092d344be` (branch `feat/fcite-call-0.12.0`, not merged); - older host: form.ext 0.11.0, `a449e91b0412446435d3adbef6d57f0fcffa1f7d` (`main`). diff --git a/frontend/HASHOUT_LOG.md b/frontend/HASHOUT_LOG.md index 2f5decb..db274e7 100644 --- a/frontend/HASHOUT_LOG.md +++ b/frontend/HASHOUT_LOG.md @@ -2,7 +2,7 @@ Living log of all comment content, explainers, rationale, TODOs, & removed (hashed-out) code for this side of the repo. Source files stay comment-free per dev-rules `sub-skills/hashout-log/SUB-SKILL.md`; everything they would have said lives here, indexed. This file is also the compressed contextual map of this side: read it first, then edit code surgically. -Current build version: v0.13.9 +Current build version: v0.14.0 Last updated: 2026-11-26 (US Eastern) · window skeleton: shell, engine store, window key, health status --- @@ -479,8 +479,8 @@ New in v0.13.9 (2026-11-27). Supersedes the title keys in `src-title-field-mode` ## src/ui/trash.ts, src/styles/review.css {#src-trash-purge-run} -Run in v0.13.10 work (2026-11-27), no code changed. Trash "Deleted for good." in headless Chrome, CPU 4x, 400 ms and 50,000 bytes per second: one item by real clicks (Delete for good, then the confirm) and one by `element.click()` from a script, in dark and in light; the purged row keeps its 44 px box with the dashed placeholder over it, the summary counts down by two, and layout shift is 0 without input and 0 with input in both themes. The copy-isolation note above is fixed in the backend entry `app-data-folder-copy-and-api-404`. +Run in v0.14.0 work (2026-11-27), no code changed. Trash "Deleted for good." in headless Chrome, CPU 4x, 400 ms and 50,000 bytes per second: one item by real clicks (Delete for good, then the confirm) and one by `element.click()` from a script, in dark and in light; the purged row keeps its 44 px box with the dashed placeholder over it, the summary counts down by two, and layout shift is 0 without input and 0 with input in both themes. The copy-isolation note above is fixed in the backend entry `app-data-folder-copy-and-api-404`. ## src/ui/connections.ts, src/ui/toast.ts {#src-asks-toast-follows-request} -New in v0.13.10 (2026-11-27). The "asks to use your library" toast (key `connections-arrived`, raised in `bindConnections`) now follows the requests. `settleToast` runs on `request:remove` and `request:update`: if the toast is on screen and no unexpired request is left it calls the dismiss function `toast()` returned, and if one or more are left it rewrites the same node's text through the existing key. It never raises a toast that is not already showing. `toast()` takes `onOpen`, kept in a WeakMap by node; the root's one click listener runs it for a click anywhere but the close button, and the node gets inline `pointer-events: auto` and `cursor: pointer` only then, since `shell.css` sets `.fc-toast` to `pointer-events: none` and that file is not this slice's. The opener clicks the Connections nav item unless the panes already show it. Checked in a private built copy, 2,000 items, CPU 4x, 400 ms, 50 kB/s, fresh engine and data folder per load: Approve and Deny each took the toast away 0.62 s after the click (the leave transition and the next refresh), layout shift 0 and 0; two requests, one Deny left the toast with the other app's name, the second Deny removed it; a click on the toast text moved the window from Items to Connections. One 0.005 shift with recent input appeared in the two-request runs when Connections opened, which is the view switch and not the toast. +New in v0.14.0 (2026-11-27). The "asks to use your library" toast (key `connections-arrived`, raised in `bindConnections`) now follows the requests. `settleToast` runs on `request:remove` and `request:update`: if the toast is on screen and no unexpired request is left it calls the dismiss function `toast()` returned, and if one or more are left it rewrites the same node's text through the existing key. It never raises a toast that is not already showing. `toast()` takes `onOpen`, kept in a WeakMap by node; the root's one click listener runs it for a click anywhere but the close button, and the node gets inline `pointer-events: auto` and `cursor: pointer` only then, since `shell.css` sets `.fc-toast` to `pointer-events: none` and that file is not this slice's. The opener clicks the Connections nav item unless the panes already show it. Checked in a private built copy, 2,000 items, CPU 4x, 400 ms, 50 kB/s, fresh engine and data folder per load: Approve and Deny each took the toast away 0.62 s after the click (the leave transition and the next refresh), layout shift 0 and 0; two requests, one Deny left the toast with the other app's name, the second Deny removed it; a click on the toast text moved the window from Items to Connections. One 0.005 shift with recent input appeared in the two-request runs when Connections opened, which is the view switch and not the toast. diff --git a/frontend/package-lock.json b/frontend/package-lock.json index bdff725..2b4a7b3 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "formcite", - "version": "0.13.9", + "version": "0.14.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "formcite", - "version": "0.13.9", + "version": "0.14.0", "license": "GPL-3.0-only", "devDependencies": { "typescript": "7.0.2", diff --git a/frontend/package.json b/frontend/package.json index bc33778..40caf1a 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,7 @@ { "name": "formcite", "private": true, - "version": "0.13.9", + "version": "0.14.0", "description": "FormCite: a local-first personal research library from the Form family", "license": "GPL-3.0-only", "type": "module", diff --git a/frontend/src/version.ts b/frontend/src/version.ts index bf5428e..bc75a42 100644 --- a/frontend/src/version.ts +++ b/frontend/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.13.9'; +export const VERSION = '0.14.0'; diff --git a/native/formcite-style/Cargo.lock b/native/formcite-style/Cargo.lock index 3255038..d34017e 100644 --- a/native/formcite-style/Cargo.lock +++ b/native/formcite-style/Cargo.lock @@ -81,7 +81,7 @@ dependencies = [ [[package]] name = "formcite-style" -version = "0.13.9" +version = "0.14.0" dependencies = [ "hayagriva", "pyo3", diff --git a/native/formcite-style/Cargo.toml b/native/formcite-style/Cargo.toml index c4cee08..17c0094 100644 --- a/native/formcite-style/Cargo.toml +++ b/native/formcite-style/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "formcite-style" -version = "0.13.9" +version = "0.14.0" edition = "2024" rust-version = "1.95" license = "Apache-2.0" diff --git a/native/formcite-style/pyproject.toml b/native/formcite-style/pyproject.toml index 15fa5f5..be0f107 100644 --- a/native/formcite-style/pyproject.toml +++ b/native/formcite-style/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "maturin" [project] name = "formcite-style" -version = "0.13.9" +version = "0.14.0" description = "FormCite citation style engine for the FormCite engine service" license = { text = "Apache-2.0" } requires-python = ">=3.10" diff --git a/setup/HASHOUT_LOG.md b/setup/HASHOUT_LOG.md index 69af0ad..770b7f3 100644 --- a/setup/HASHOUT_LOG.md +++ b/setup/HASHOUT_LOG.md @@ -2,7 +2,7 @@ Living log of all comment content, explainers, rationale, TODOs, and removed code for the root launcher scripts and the `setup/` suite. The scripts stay comment-free; everything they would have said lives here, indexed. Read this first, then edit the scripts surgically. -Current build version: v0.13.9 +Current build version: v0.14.0 Last updated: 2026-11-27 · initial port of the launcher and setup suite --- diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 34b5502..ed3c12b 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -918,7 +918,7 @@ dependencies = [ [[package]] name = "formcite" -version = "0.13.9" +version = "0.14.0" dependencies = [ "fontdb", "objc2", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index bdc872c..9b2e7ce 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "formcite" -version = "0.13.9" +version = "0.14.0" description = "FormCite desktop shell" authors = ["NodeAgentc, Inc."] license = "GPL-3.0-only" diff --git a/src-tauri/HASHOUT_LOG.md b/src-tauri/HASHOUT_LOG.md index 99eb67a..cc05a4d 100644 --- a/src-tauri/HASHOUT_LOG.md +++ b/src-tauri/HASHOUT_LOG.md @@ -2,7 +2,7 @@ Living log of all comment content, explainers, rationale, TODOs, & removed (hashed-out) code for the desktop shell side of the repo. Source files stay comment-free per dev-rules `sub-skills/hashout-log/SUB-SKILL.md`; everything they would have said lives here, indexed. This file is also the compressed contextual map of this side: read it first, then edit code surgically. -Current build version: v0.13.9 +Current build version: v0.14.0 Last updated: 2026-11-26 (US Eastern) · Tauri 2 shell ported from FormTxt, renamed, launch code added --- @@ -268,13 +268,13 @@ The old `BACKGROUND` (10,10,10) was the family's card color, not this window's: ### src/main.rs · the engine start no longer waits for a printed key - refers-to: src/main.rs :: setup; src/engine_start.rs :: Wait - kind: fix -- logged: v0.13.10 · 2026-11-27 +- logged: v0.14.0 · 2026-11-27 The shell, ported from formtxt, waited ten seconds for the engine to print `formcite-window-key: ...` and failed with "it waited 10 seconds for its engine to hand over the key" when it did not. FormCite's engine never prints its key: the window claims it with the launch code the shell already passes in the address (`#launch=`), through `POST /api/window/key`. So the packaged app could not start. The shell now opens the window as soon as the engine says which address it serves on. `Wait::Key`, `KEY_WAIT`, the key pattern and the `FORMCITE_WINDOW_KEY_STDOUT` environment value are gone. Found and proven by the first release build that was ever run (Linux, WebKitGTK 2.52.6, a virtual display, the engine started from source in place of the frozen one): the library window opened with 2,000 items. A debug build is development mode by design (`dev_url`) and opens the dev server address without starting an engine. ### src/reveal.rs · remember_look - refers-to: src/reveal.rs :: remember_look, show_main - kind: feature -- logged: v0.13.10 · 2026-11-27 +- logged: v0.14.0 · 2026-11-27 The splash is on the app's own origin and cannot read the engine's saved look, so it only followed the system's light or dark setting. When the window is ready, `remember_look` reads `window-look.json` from the data folder and writes `formcite.theme` and `formcite.look` into the splash's own storage, which the splash page already reads before paint. The next launch's splash opens in the saved theme: seen in Ocean on the second launch after the file was written. The splash is one launch behind a change of theme, by design; nothing is written when the file is missing or unreadable. diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index d05d501..751c83f 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "FormCite", - "version": "0.13.9", + "version": "0.14.0", "identifier": "ai.nodemode.formcite", "build": { "devUrl": "http://localhost:5330",