Skip to content

FormLedger 0.16.0: opens in about three seconds on macOS, and agents can do everything a person can - #17

Merged
nodemode-ai merged 16 commits into
mainfrom
feat/agents-startup-0.16.0
Dec 3, 2026
Merged

nodemode-ai merged 16 commits into
mainfrom
feat/agents-startup-0.16.0

Conversation

@nodemode-ai

Copy link
Copy Markdown
Contributor

FormLedger 0.16.0: opens in about three seconds on macOS, and agents can do everything a person can

Summary

  • Slow open: FormLedger took about 30 seconds to open on a Mac. The page had stopped calling app_ready, so every launch waited for the shell's 20 s fallback. The page calls it again, after its first paint, and the fallback is now 6 s.
  • Agent parity: Claude Code and the other agents can now do everything a person can in FormLedger. The dock connects them with no setup, and risky steps wait for the owner's approval.

Changes

  • Startup (web/src/ui/dom.ts, src-tauri/src/reveal.rs):
    • revealApp waits for first contentful paint and two frames, then invokes app_ready, with a 1.5 s fallback if no paint event arrives.
    • The shell's fallback drops from 20 s to 6 s. The 2.6 s splash minimum, shared with the Form apps, is unchanged.
    • Windows and Linux were not affected.
  • Engine (internal/agent):
    • the /api/live change stream;
    • the window command bridge (/api/agent/commands);
    • /api/agent/routes and /api/agent/call through the full router with the caller's own credential, giving compact results;
    • jobs;
    • owner approval for risky actions.
  • formledger cli mcp: a stdio MCP server that is a client of the running engine, so the engine stays the only writer. Its tools:
    • ledger_overview, ledger_routes, ledger_get and ledger_call;
    • ledger_cli, ledger_export and ledger_print;
    • app_commands, app_command and app_run;
    • job_status.
  • Window:
    • Every page action, menu item and preference is a typed command: 115 in all.
    • Open pages refresh live when the books change elsewhere, keeping drafts with a note.
    • Approval requests show in the dock's Consent dialog.
  • Approval: deleting, posting, cancelling, allocating, amending, confirming, period locks, invitations, the app lock, sign-out and quit all wait for the owner, and are refused with no window. Agents cannot sign in or manage tokens.
  • Read-only tokens run only the window's read commands. The engine keeps its own list rather than trusting the window's flag.
  • Dock:
    • Each agent tab gets its own hashed write token (audited, revoked when the tab closes, cleaned up after a crash).
    • The tab gets FORMLEDGER_TOKEN, FORMLEDGER_URL and FORMLEDGER_AGENT.
    • Claude Code starts with --mcp-config naming cli mcp.
  • Account: a new App tokens panel lists, makes (shown once) and revokes tokens.

Commits

16 commits on top of main (aa79ca8, v0.15.1): 6 feat, 5 fix, 4 docs and 1 chore. All are authored and committed by nodemode-ai, with bodies and no trailers. The release commit is last (8f0ec68). A few earlier commit subjects carry "(0.15.2)", the version planned before agent parity made this a minor release.

Tests

  • Startup, from an independent check (no edits):
    • Main never invoked app_ready (0 of 6 runs); the branch invokes it in every run.
    • After the paint fix, app_ready comes after first contentful paint in 12 of 12 runs: Chromium at 4x CPU, 50 to 103 ms after paint, and WebKit.
    • The engine's time to health is unchanged, 0.25 to 0.9 s, with no network.
    • A ledger encrypted by main's binary opens under the branch binary.
  • Parity (window open, cli mcp with write and read tokens):
    • a change showed live on the open Customers page;
    • posting an invoice and inviting raised the Consent dialog, Deny refused and Allow once posted;
    • the read token was refused on writes, prefs.set and navigation, and could still run view.current, prefs.get and reports;
    • /api/me/tokens was refused for agents.
  • Dock (stand-in claude): it started with the MCP config and a token, listed all 11 tools, and added a customer that showed live. Its token was listed under Account and revoked when the tab closed.
  • At the release commit: gofmt clean, go vet ./... clean, go test ./... exit 0 (no package has test files, as on main), web check and build pass. cargo check passed earlier on the branch.

Not checked: a real macOS launch, including Gatekeeper's first-launch assessment, which depends on FormCompiler's signing and notarisation.

Merging

Merge commit, no squash.

…t opens without the 20 s fallback (0.15.2)

The macOS shell builds the main window at alpha 0 and shows it when the
page invokes app_ready, or after its fallback. v0.1.0 removed revealApp's
invoke while the repo had no desktop shell and it was never put back, so
every macOS launch waited the full 20 s fallback after the engine was up.

revealApp now waits two frames twice, each also settling after 120 ms
because WebKit may hold requestAnimationFrame in an alpha 0 window, then
invokes app_ready in the desktop shell only. No DOM node or style is
touched. Measured in the browser build with a stub shell: app_ready now
arrives 0.36 to 2.7 s after navigation (Chromium at 4x CPU throttle,
WebKit 0.41 to 0.94 s); before it never arrived.
…ever says it has painted (0.15.2)

The fallback in reveal.rs is the only thing that showed the macOS window
in 0.15.1, because the page never invoked app_ready. With the invoke back
it is a safety net only, so a future break of the invoke, or a page that
cannot reach Tauri's IPC, costs at most 6 s after the engine is ready
instead of 20 s. The window is built with the dark background, so a
fallback reveal of a page still loading shows that colour, not white.
SPLASH_MIN stays 2.6 s, shared with the other Form apps.
…val for agents (0.15.2)

A new agent module gives agents the same reach as the person at the window without weakening any scope. GET /api/live streams a change event after every successful write, so the open window can show an agent's work at once, and carries approval requests and window command runs to the window. /api/agent/routes lists every engine route an agent may call; /api/agent/call runs one through the full router with the caller's own credential and compacts the answer (lists cut to a limit and counted, binary output withheld). /api/agent/commands lists, describes and runs the window's command registry. Posting, cancelling, allocating, amending, confirming, deleting, period locks, invitations and the app lock wait for the owner's yes in the window; sign-in, tokens, terminals and claiming are refused. Slow work answers a job id to poll.
… and other agents (0.15.2)

The MCP server is a client of the running server with the same app token as the command line, so one process stays the only writer and the token's role and scope decide what it may do. Tools: ledger_overview, ledger_routes, ledger_get and ledger_call over every engine route, ledger_cli for any cli command, ledger_export and ledger_print to files on this computer, app_commands, app_command and app_run for the open window's command registry, and job_status. Writes made through it go through /api/agent/call, so posting, cancelling, deleting and the other approval classes wait for the owner in the window even when they come in as a cli command.
…, and view.open, view.current and view.refresh commands (0.15.2)

Every API call from the window carries its window id, so the engine's change stream can tell the window's own writes from those of an agent, the command line or another window. On a change from elsewhere the open page refreshes in place: lists, reports and statements reload, master lists reload, and an open document or payment reloads unless the person has unsaved edits, in which case a note says it changed. Pages that are not open are marked and refresh when shown. view.open opens any page with typed parameters (id, kind, status, template, dates), view.current reports what is on screen and view.refresh reloads it.
…command that agents can run, with the owner's approval in the dock (0.15.2)

engine/agent.ts registers the page actions the buttons perform as commands with typed parameters: documents (list, read, save a draft, confirm or post, cancel, amend, make the next document, delete), payments (list, read, open invoices, save, post, allocate, cancel), goods receipts and delivery notes (read, post, cancel), master lists and the cash rule, every report and dashboard series, and templates. ui/agent-bridge.ts adds the menus' window and edit commands to the registry, prefs.get and prefs.set, opens the live stream after sign-in, sends the catalogue to the engine whenever it changes, runs commands the engine relays and answers their results, and feeds approval requests to the dock's Consent dialog, which the dock adapter now wires. Results are compact: long lists are cut to a limit and counted.
… the dock's engine address for the cli (0.15.2)

The cli no longer words an agent refusal (blocked route, denied or unanswered approval, no window, unknown command) as a role refusal. The approval dialog says that Always allow covers that kind of action from that credential until FormLedger restarts. With FORMLEDGER_URL unset the cli follows FORMLEDGER_ENGINE_URL, which the agent dock sets in its terminals, so a cli or MCP server started there reaches the desktop app even on a moved port.
…t results and the live stream (0.15.2)

docs/ledger/agents.md lists the MCP tools, how to connect Claude Code with an app token, the window command groups, which actions wait for the owner's approval and which are never reachable, the limits and jobs, the live stream and the engine routes behind them. README, AGENTS.md, CLAUDE.md, the harness skill and its evals no longer say there is no MCP server, and say that a new window action must be a typed command and a new money-moving route must fall in an approval class. The cli guide names FORMLEDGER_ENGINE_URL and points to the agents page.
…tarts with the formledger MCP server (0.15.2)

Following FormCite's dock: when an agent tab starts (Claude Code, Codex, Cursor, Antigravity) the dock mints a write-scoped app token for the owner, named for the program and the dock ("Claude Code tab, FormLedger dock"), stored hashed like any other token, and puts FORMLEDGER_TOKEN, FORMLEDGER_URL and FORMLEDGER_AGENT in the tab's environment, so the cli works there with no setup. Claude Code is started with --mcp-config naming the running binary's "cli mcp" as the formledger server (the token passed by ${FORMLEDGER_TOKEN} expansion, not on the command line) and a short system note. The token is withdrawn when the tab closes, and tokens left by a run that ended without closing its tabs are withdrawn when the dock mounts; both are audited as the FormLedger dock. The owner's approval still gates the risky actions. tokens.create and tokens.revoke are window-only commands, refused to agents.
…'s tokens, including the dock's tab tokens (0.15.2)

Account had no screen for app tokens, so the cli and its docs sent people to curl. The new panel lists every token of the signed-in user with its scope, prefix and last use, makes one from a name and a scope (the value is shown once, with Copy) and revokes any of them, the dock's tab tokens included. tokens.create and tokens.revoke are registered commands with typed params; the list loads on sign-in and whenever Account opens, and is cleared on sign-out. Rows are kept by id and patched in place.
…nd revokes app tokens (0.15.2)

agents.md describes the per-tab token, its environment, Claude Code's preset MCP server, revocation on close and at start, and the Account panel; cli.md replaces the note that the web app had no token screen; the README's agent paragraph says the dock needs no setup.
… and the shell (0.16.0)

ledger-startup (the missing app_ready call behind the 20 s macOS fallback,
and the shorter fallback) and ledger-parity (the agent module, the live
stream, the command bridge, the stdio MCP server, approval for risky
steps, per-tab dock tokens and the App tokens panel) appended their
sections and left them for one commit at the end.
…o it cannot change the theme or move the owner's window (0.15.2)

verify found a read-only token could run prefs.set and other window commands that change the window but are not marked mutates, which broke the documented rule that a read-only token stays read-only on every path. The engine now decides on its own list rather than trusting the window's flag: a read-only credential may run only view.current, prefs.get, cash.get, template.use, commands whose last segment is get, list or openInvoices, and report.* and dashboard.*, and never one marked mutates. Everything else is refused with read_only, including prefs.set, the theme toggle and navigation (view.open, go.*, nav.*), which count as changes because they alter what the owner sees. agents.md lists the read commands.
…paint (0.15.2)

verify found app_ready firing before first contentful paint in 6 of 6
runs at 4x CPU throttling: the 120 ms backstop on each two-frame wait
won the race against the animation frames, so on macOS the window could
come up on its dark background before the page had painted.

revealApp now waits for the first-contentful-paint entry through a
buffered PerformanceObserver on "paint", then two frames, then invokes
app_ready. The 120 ms backstop only applies to the frames after paint
has been seen. If no paint entry arrives within 1500 ms (WebKit may
withhold frames, and so paint, in a window at alpha 0, or the entry type
is unsupported) it goes ahead, so the shell's 6 s fallback is not the
normal path. Measured at 4x throttling in Chromium and unthrottled in
WebKit, 12 runs: app_ready after FCP in every run, 50 to 147 ms later.
…(0.16.0)

ledger-startup's first measurements read app_ready as coming after paint
when the 120 ms backstop had fired first. The section now records the fix
in 6a54ccc (wait for first contentful paint, then two frames, with a 1.5 s
fallback) and the re-measured numbers.
Bumps every version site to 0.16.0: the Makefile, internal/app/version.go,
web/package.json and both web/package-lock.json fields, the desktop
shell's Cargo.toml, Cargo.lock and tauri.conf.json, the README badge, and
the current-version line of the cmd, internal, src-tauri and web HASHOUT
logs. CHANGELOG.md gains 0.16.0.

The release: the window shows in about three seconds on macOS (the page
calls app_ready again, after its first paint), and Claude Code and the
other agents can do everything a person can, with per-tab dock tokens,
the App tokens panel, a live window and approval for risky steps. A
minor version, since agent parity is new ground beyond the startup fix.
@nodemode-ai
nodemode-ai requested a review from gbarnai as a code owner December 3, 2026 17:35
@nodemode-ai
nodemode-ai merged commit b4d98c7 into main Dec 3, 2026
2 checks passed
@nodemode-ai
nodemode-ai deleted the feat/agents-startup-0.16.0 branch December 3, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant