Repository navigation
FormCite 0.15.2: macOS menu bar only, top-right agent and gear, Preferences as a floating dialog, item details and the arXiv PDF - #19
Merged
Conversation
Migration 0003 adds a changes table filled by SQLite triggers on items, item_tags, tags, collections, collection_items, notes, attachments, relations and saved searches, so a write from the engine, ./formcite cli, the stdio MCP server, an import or a direct sqlite3 write is recorded the same way, with a monotonic sequence. db.tx() stamps the writing request's origin into the one-row change_origin table inside the transaction and clears it before COMMIT, so no other connection ever sees it. The table keeps the last 5000 changes.
GET /api/changes/stream is a server-sent event stream for the window key only. It opens with hello (library name, sequence, and whether the caller fell behind or the library switched), then sends each batch of new changes as one message with kind, item id, reference id and origin. Changes the window made itself are dropped from the batch and only advance the sequence, so they never echo back. A stream lives 30 seconds and the window reconnects from its last sequence, which keeps engine shutdown prompt. OriginStamp tags each engine request as window or agent for the change rows.
….16.0) uvicorn waits for open responses on Ctrl+C, so an open window kept ./formcite serve alive for up to the stream's 30 second life. The stream now also ends as soon as uvicorn's own exit flag is set, read from the SIGINT handler uvicorn installs; shutdown with the window open measured 0.28 s, down from 29.8 s.
io/changes.ts reads /api/changes/stream with the window key header, the same way as every other window call. engine/live.ts keeps the last sequence and library, reconnects from them, and turns each batch into the Library notices the panes already patch from: items added, removed or restored, an item changed, collections changed, tags changed. Bursts settle for 120 ms (600 ms at most), so 30 adds and 30 tag writes in half a second arrive as a few notices, not 60. Filing in or out of the shown collection or tag, or out of Unfiled, adds or removes the rows in view; deleting the shown collection or tag returns to All items. Items an agent added are remembered for six seconds for the row highlight.
…t (0.16.0) Library.stale() asks every pane to re-read once, keeping scope, search, sort and selection, for a window that fell more than 5000 changes behind or a burst of more than 40 edits. ItemListModel.refresh() reloads the page around the rows in view rather than from the top, and the insert and remove fallbacks use it, so a burst over the twelve-row insert limit no longer blanks the rows of a scrolled list while page 0 loads. A short agent highlight fades on new rows: a 2 px accent edge and the accent wash as an inset shadow, so the row box never changes; it steps off with reduced motion.
…nds (0.16.0)
The window publishes the commands it offers, each with typed arguments, to PUT /api/window/commands and long-polls GET /api/window/commands/next for runs; it posts each outcome to /api/window/commands/runs/{id}. Every route needs the window key. The engine keeps the catalogue and a short queue in memory, checks arguments against the published types, and never offers Connections, the network switches, the token store, edit and window.close to an agent, whatever the window publishes.
…library (0.16.0) Edit any field of an item, trash, restore, delete forever and empty the Trash, notes, untag, rename and delete tags, attachments and the PDF on disk, fetch an arXiv PDF, add a PDF by the identifier in it, relations, saved and rule searches, duplicates and merging, export, import of a file, import batches and undo, keywords to tags, libraries, items that need a title, the network switches read-only, and window_commands, window_command_run and window_command_result for the open window. Answers are one line per row with ids; permanent deletes carry destructive and need confirm: true. Collection tools stay with the collection slice.
…mmand an agent can run (0.16.0) engine/bridge.ts keeps the argument types of each offered command (describeCommand), checks a run's arguments and answers what the window then shows: view, scope, search, sort, selection and counts. io/bridge.ts publishes the offered commands and long-polls the engine for runs, with a back-off when the engine is away. ui/parity.ts registers the actions that had no command (select and reveal an item, search, sort and scope the list, every view, Preferences at a section, appearance, theme and accent, Home at launch, the title field, switching library, the Add dialog by identifier, minimize and zoom) and describes those and the existing ones, the reader's and the collection commands included. Connections, the network switches and the clipboard edit commands stay the person's.
SCHEMA.md gains the changes and change_origin tables from schema version 3, with every kind and origin. WINDOW.md says what now shows up live in the item list and sidebar, and documents GET /api/changes/stream, its messages and how a reconnect catches up.
The list loads before the feed can open, since the feed waits for the window key, and the first hello starts from the engine's latest sequence. A write landing in that gap was never shown. The first hello now calls Library.stale() once; when nothing changed, the re-read writes the same text into the same rows and touches no DOM.
…search (0.16.0) An agent clearing the search sent an empty string and the bridge refused it as a missing required argument; the text is now optional, as clearing the search box is for a person.
…person's (0.16.0) docs/MCP.md lists the tools that cover the rest of the library and the three window tools, with their read-only and destructive marks; docs/WINDOW.md says how the bridge works (the registry, describeCommand, the publish and long-poll routes, the refusals); the formcite skill tells an agent which tool fits which request and when to run a window command so the person sees it; the README's agents list says what an agent can now do and what stays the person's.
…on 429 and 503 (0.16.0) A service can now name a pace group, and every service in one group waits its turn on one clock, so a lookup on export.arxiv.org, the OAI fallback on oaipmh.arxiv.org and a PDF download from arxiv.org together keep to arXiv's one request every three seconds instead of three separate clocks. An answer of 429 or 503 is retried twice: the wait is the server's Retry-After when it gives whole seconds, else 4 s then 8 s, at most 20 s, and it holds the whole group so no other call jumps in. Every attempt is still in Recent calls.
…che and an add that never doubles (0.16.0) services/lookup_jobs.py is a queue of lookup jobs with one worker for records and one for arXiv PDFs. A job holds up to 50 identifiers; its arXiv ids are asked for in one id_list query (arxiv.fetch_many), the records go into a one-hour cache in lookup.resolve, and each identifier then goes through lookup.add with the PDF left to the second worker, so records never wait behind downloads. A job can file every item into a collection and tag it. The same identifiers sent again while their job is unfinished join that job instead of queueing a second one. lookup.add now checks for a duplicate and creates the item under one lock, so two calls for the same paper at once make one item and the second reports it as existing. add takes fetch_pdf so the queue can attach PDFs later.
…ve at once (0.16.0) Calls to /mcp ran on asyncio's default thread pool, a handful of threads on a small machine, and the 30 s limit counted the time a call sat waiting for a thread. Twenty parallel lookups therefore all ran out together. /mcp now has its own pool of 64 threads, the limit counts from when the request arrived, and the arrival time travels with the call in a context variable so a tool can ask http.budget how long it may still wait, leaving 8 s to answer.
…wers (0.16.0) New tools: create_collection (name, optional parent; answers the one already there instead of a second), add_to_collection, remove_from_collection, rename_collection and delete_collection over the library service's existing collection functions, each taking a collection id or its exact name. delete_collection carries destructiveHint, so the agent client asks the person, needs confirm equal to the collection's exact name, refuses a collection with sub-collections, and leaves the items in the library. add_by_identifiers takes up to 50 identifiers with an optional collection and tags; add_by_identifier and lookup_preview go through the same queue; every one answers within wait_seconds (default 20, capped by the HTTP budget) and leaves a job_id for the new lookup_status when unfinished. Items now come back compact: id, title, year, an authors summary with the count, identifiers (doi, arXiv, ISBN, PMID, url), tags and collections. fields adds named parts such as abstract, full answers the stored item. One 200-author arXiv paper was 60,421 characters in full and is 774 now. list_items and search take offset, and list_items a collection name. The server instructions say plainly how to make collections, to batch lookups, and to say first when part of a request could not be done.
…ions (0.16.0)
The dock's own Claude Code got 'Only the FormCite window can do this' when it tried to make a collection, because every write under /api/library needs the window key. Creating a collection, renaming or moving it, and adding or removing items are ordinary library writes like adding an item, which a write token may already do through /api/cite/v1 and MCP. So WindowKeyGuard now lets exactly POST /api/library/collections, PATCH /api/library/collections/{id} and POST or DELETE /api/library/collections/{id}/items through with a service token of write scope, and writes each one to the service log with its outcome.
Unchanged and window-only: deleting a collection over HTTP, every other write, Connections, the network switches, the token store and the terminal. A read token or no token on those four routes is still refused, now with the token's own reason after the old sentence.
The feed was started from start() in ui/app.ts, a file whose other uncommitted hunks belong to the reader, so the committed tree never opened it and agent writes still did not show (fc-verify V1). main.ts now starts it beside mountParity, and LiveFeed waits for the window key itself (loadWindowKey shares the claim app.ts already started), so it never runs without a key.
…aper (0.16.0) reader.page, reader.find and reader.close drive the reader's own page box, find bar and Back button, so the person sees the same steps they would take, and answer what the reader shows (page 3 of 26, 17 of 50 matches). They step aside when the reader registers commands of those ids itself. The bridge's no-window answer now also names the stdio case, where the MCP server runs apart from the engine and cannot reach a window.
…, and say first what could not be done (0.16.0) The formcite skill and docs/MCP.md list the collection tools, add_by_identifiers and lookup_status, and tell an agent plainly: it can make and fill a collection itself, lookups are rate limited so several papers go in one add_by_identifiers call, an unfinished lookup is polled with its job_id and never resent, and when part of a request could not be done the first line of the reply says so. docs/SERVICE_TOKENS.md states which collection routes a write token may use and that deleting a collection over HTTP stays with the window. The server's own instructions in protocol.py say the same.
ItemListModel now listens for library:stale and refreshes around the rows in view, so a window that fell behind or took a burst of more than 40 edits re-reads its list even before the list view's scroll-anchor hunks are committed. The view only sets its scroll hold on that notice, so the refresh is not run twice.
tools.py imports PARITY_TOOLS from tools_parity.py and lists them last in TOOLS, and the server instructions point an agent at them and at window_commands. 65 tools, no name twice; nine carry destructiveHint, read by _describe from each tool's destructive flag. Done here at fc-parity's request, since tools.py and protocol.py had my hunks.
A headless switch left the window on the old library until the change feed's next library check. use_library now also queues the window's own library.use command through the bridge, which posts the same switch again (harmless) and resets the list, the details pane and the sidebar, as the Switch button in Preferences does. With no window open nothing is queued.
…(0.16.0)
In the owner's dock session the agent asked window_commands with {"query": "collection"} and was refused for an unknown argument. query now keeps the commands whose id or title holds every word given, beside the group filter.
…pts (0.16.0) The collection command files a given item or the selected one, but the bridge described only its collection, so an agent naming the item was refused as an unknown argument. The description now carries item as optional, and the run waits for the filing to land before it answers.
…inks (0.16.0)
GET /api/library/attachments/{id}/file answers the stored PDF to the window alone (window key required), with HTTP ranges, no-store and nosniff, so the in-app reader can stream a 100-page paper. It refuses an attachment that is not a PDF.
POST /api/library/open-url opens an http, https or mailto address in the person's browser, for links clicked inside a paper in the desktop shell, where a new window cannot open. Anything else is refused.
…y (0.16.0) PDF.js (Apache-2.0) renders papers in the window. It is pinned exactly and listed in NOTICE.md with the licenses of the data files it carries. A small Vite plugin serves PDF.js's CMaps, standard fonts, wasm image decoders and ICC profile under /pdfjs/ from node_modules in development, and copies them into dist/pdfjs/ at build time, so nothing is fetched from a CDN or the network. The QuickJS scripting engine is left out because the reader runs no PDF JavaScript.
The reader replaces the main area with the paper and a Back control, the way Duplicates and Trash do, and returns to the view it came from. It renders with PDF.js's viewer: a continuous scroll of pages drawn at the screen's pixel ratio, only the pages near the viewport rendered and a small page cache, so a 100-page paper opens about as fast as a 15-page one. The worker is a local asset and the PDF.js code and styles load only when the first paper opens. The bar holds Back, the sidebar toggle, the title, the page box and count, zoom (out, a Fit width, Fit page, Automatic or percent list, in), find, dark pages, Open in the system viewer, download and print. The sidebar shows page thumbnails, drawn as they scroll into view and capped at 60 at a time, or the paper's outline. Find highlights every match with next and previous and a count. The text layer makes text selectable and copyable; internal links jump within the paper and outside links open in the browser (through the engine in the desktop shell). Ctrl or Cmd with +, - and 0, Ctrl-wheel and pinch zoom; arrows, n, p, j, k, Home, End and Page Up and Down page; Esc closes find, then goes back. The last page and zoom are kept per paper (the most recent 300), with the sidebar, its tab and dark pages as preferences. An item whose PDF is not attached yet gets its open-access copy from arXiv first, with progress shown, then opens; an error offers Try again and the system viewer. The loading veil fades in only after 220 ms, the find bar floats over the pages, and every control has a fixed width, so nothing moves on open or while scrolling. Pages stay white in both themes unless dark pages is on. The new glyphs are added to ui/icons.ts.
…ds (0.16.0)
The shell gains the reader's pane after Home, a Paper title in the top bar, and one mountReader call beside the other views.
This commit also carries fc-agent's window collection commands, which share app.ts: collection.new {name, parent} makes a collection (under a parent found by name or id) and shows it, or asks for a name in the sidebar when called with none; collection.add-selection {collection, item?} adds the selected item, or the one named, to a collection; collection.show {collection} shows a collection's items. They live in ui/collections.ts with their calls in io/collections.ts (both new), and replace the old collection.new row in app.ts's command table. Both collection.new and collection.show were run once from MCP's window_command_run against an open window.
…wer stays (0.16.0) The detail pane's first button is now View paper, in the accent colour; for an item with only an arXiv identifier it gets the open-access PDF and then opens it. Beside it a small button opens the PDF in the system viewer (or FormPDF), as Open PDF used to. The pane re-reads the item once the reader has attached a fetched PDF. The Library menu and the row menu start with View Paper (Cmd or Ctrl+O) and Open in System Viewer (Cmd or Ctrl+Shift+O, the old Open Attachment). item.view takes an item id, so an agent or another window command can open a paper too.
A double-click on a row, or Enter while the list has focus, runs item.view for that item. This commit also carries fc-live's uncommitted hunks in the same file (see fc16-requests.md): the list keeps the row at the top of the view in place when the live feed inserts items above it (the scroll anchor in reset and paint), and rows an agent added carry the is-agent highlight from engine/live.
…e (0.16.0) fc-verify V3: after a reload the dead page's long-poll was still waiting in the engine, took the next run, and that run stayed sent for ever, since only queued runs expired. Each page now polls with its own session id. The first poll of a new session makes it the window's session, wakes and ends the old page's poll with no run, and puts back in the queue any run the old session took without answering, oldest first. A poll from a superseded session takes nothing, and the window waits a second before asking again, so two tabs cannot spin. A sent run that gets no answer in 30 s expires with a sentence saying to run it again, so an agent always gets a result or a clear error. A window without a session id is served as before.
….16.0) fc-verify V2 measured layout shift when an agent made collections with the window open: 0.00022 as the New collection row moved down, then 0.00070 as the Tags section moved too, since the Collections section grew with its content. The open Collections section now has a fixed height (its former maximum, the heading and six rows), so Tags never moves. The New collection row sits outside the scrolling list, in its own last row of the section's grid, so it stays put while collections are added above it. The No collections yet message now sits below the list, where the first collection takes its place. Agent-made collections join the end of the tree, since they get the next position. Measured with seven collections created through a write token at 4x CPU throttling: no layout-shift entries. Creating one from the window, and folding the section, work as before.
…dow (0.16.0) fc-agent (collection tools, write-token routes, the arXiv queue and pace, compact results), fc-live (the change table, the feed and applying it in place, the fixed Collections section), fc-reader (the in-app reader and its two routes) and fc-parity (the window command bridge, the headless tools, sessions for the bridge's long poll) appended their sections here and left them for one commit at the end.
The in-app reader, the live window, agents able to do everything a person can (collections included), batch adds, and the fixes for the failures in the 2 December session: no collection tools, the dock's access refused, lookups timing out, oversized answers and a window that never updated.
Bumps every version site to 0.16.0: frontend/package.json and both package-lock.json fields, frontend/src/version.ts, backend/app/__init__.py, the style engine's Cargo.toml, Cargo.lock and pyproject.toml, the desktop shell's Cargo.toml, Cargo.lock and tauri.conf.json, the README badge and the current-version line of the backend, setup and src-tauri HASHOUT logs. The release: View paper inside the window, a window that follows every library change as it happens, agents able to do everything a person can (65 tools and the window command bridge, collections included), batch adds, and fixes for the failures in the 2 December dock session. CHANGELOG.md has it in full.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FormCite 0.15.2: macOS menu bar only, top-right agent and gear, Preferences as a floating dialog, item details and the arXiv PDF
Summary
0.15.1 fixed the slow start and the traffic-light inset. The owner then reported five more problems on macOS. This release fixes them, and brings FormCite to every line of the Form shell standard (
FORM_SHELL_STANDARD.md). Seven roles worked on one branch.setAsAppMenunever took effect. Either the stored choice was in-window ("menus": "window"in~/FormCite/window-look.json), or the build rejected as a whole. The Linux shell, run under Xvfb with the Mac menu path forced on, accepted the full list.icon-btnmarkup and SVGs, byte for byte, sit right of Add.display: gridon.fc-il-rowoverrode[hidden], so 54 hidden pool rows covered the first screen and took the click (2da855c).arxiv-pdfservice with its own switch and a Recent calls row, and is streamed with a type, size (100 MB), host and time (120 s) limit (14ea2ad, c7a7c7c, 45ca9d2, after the engine-tests review E1 to E11).Tests
npm run build(tsc and vite) passes at 50b1992.compilealland--selfcheck(formcite 0.15.2) pass.