Repository navigation
Description
Goal
Give core's desktop app the Tauri-level extension points that ADR-082 (proposed) §3 defines. An app crate outside core, meaning the Pro app crate in nodespace-sync under ADR-081 (proposed), can then build the desktop app from core's library and add:
- Tauri plugins, which carry commands, managed state, setup and run-event handling;
- daemon-ready tasks;
- a channel-rebuilt hook;
- its own update source;
- its own daemon profile (Let an app built on core supply its DaemonProfile via AppExtensions::daemon_profile #3347 adds this on top of this work).
Core's own app crate passes AppExtensions::none(), so the free app behaves exactly as it does today.
#3322 is the anchor for moving the Pro Tauri layer out of core (#3336) and for removing edition branching (#3357). #3322 deletes no Pro code.
Context (verified at main af8ddb6)
There is no seam today
packages/desktop-app/src-tauriis one package,nodespace-app:- lib
nodespace_app_lib, withcrate-type = ["staticlib", "cdylib", "rlib"]; - bin
nodespace-app.
- lib
- A crate that depended on it would run its
build.rs, whosetauri_build::build()fails a release build without staged sidecars. It would also get core'sgenerate_context!(), whichrun()expands itself (src/lib.rs862). src/main.rsbuilds a tokio runtime and callsnodespace_app_lib::run()(29).run()(src/lib.rs311-870) is onetauri::Builderchain:- plugins: 343-353;
.setup: 354-671;.on_menu_event: 672-698;.invoke_handler(generate_handler![…]): 699-861;.build: 862;app.run: 869.
- The Pro code that Move the Pro Tauri layer out of core: pro_* commands, ProClient, proto, update source #3336 moves out sits in exactly these places:
- the 27
commands::pro_sync::*entries (lib.rs 710-736); - the Pro probe in the startup task (lib.rs 607-635);
ProClient::rebindafter a wedged-channel rebuild (commands/nodes.rs600-605);- the Pro release source in
update_check.rs:PRO_LATEST_URL(34-42), theis_pro_build()branch (116-124), andpro_version_from_json/fetch_pro_latest_version(158-194).
- the 27
Tauri facts that shape the design
Checked in the vendored tauri 2.11.2, tauri-build 2.6.2, tauri-codegen 2.6.2 and tauri-utils 2.9.2:
- One handler and one setup. A
Builderholds one invoke handler and one setup closure, and a second call replaces the first (app.rs1650, 1765). Extension commands therefore arrive as Tauri plugins, each with its own handler. - Plugin commands are ACL-checked. They are invoked as
plugin:<name>|<cmd>and always checked (webview/mod.rs1823). The app crate grants them in its own capability; core's capabilities never name them. - Duplicate names replace silently. Registering a second plugin with an existing name silently replaces the first (
plugin.rs880-885). - Plugin setup comes first. It runs inside
Builder::build, before the app's own setup, which runs right after the config windows are created (app.rs2513-2524). Core's managedGrpcClientand shutdown token don't exist yet when a plugin's setup runs. - The calling crate owns the config.
generate_context!()andtauri_build::build()readtauri.conf.json, capabilities and ACL manifests of the crate that calls them.tauri_buildalso emits thedesktop/mobilecfg aliases (tauri-buildlib.rs206-210, 476-477). Core's#[cfg(desktop)]single-instance guard relies on them.- It reads permission files only from the calling crate's direct dependencies.
- Runtime capabilities can panic.
Manager::add_capability(featuredynamic-acl, on by default) resolves a capability against the app's ACL manifests at run time. It panics on an unknown permission (ipc/authority.rs174-179). - The context is runtime-generic.
generate_context!()produces aContext<R>, so a test can build the real app config onMockRuntime.
A constraint the ADR sketch doesn't mention
ADR-082 sketches assemble<R: Runtime> as holding "core's plugins and commands, the extension plugins, the hook state and core's setup". Two things stop that:
- At least 17 non-Pro core commands take
tauri::AppHandleortauri::WebviewWindow, which areWry-typed. Examples:probe_and_recover_channel,check_for_update_command,pin_window_database, and the onboarding and import commands. - Core's setup calls
daemon_setup::ensure_daemon_running(&AppHandle), which would install and start a real launchd service if a test ran it.
So in this plan:
assembleis runtime-generic and applies the extension half: extension plugins, hook state and the update source;run()applies core's own plugins, commands and setup around it, onWry.
MockRuntime tests drive everything an extension contributes through assemble. Making core's commands generic is out of scope (see open questions).
Migration constraint
sync builds the Pro GUI from core's current HEAD, with bunx tauri build --config src-tauri/tauri.pro.conf.json:
- it stages into
src-tauri/binariesandsrc-tauri/resources/models; - the bundle's executable is
nodespace-app.
Every #3322 PR keeps all of these where they are, and passes a Pro-mode compile check.
Design (ADR-082 (proposed) §3)
Crate layout after #3303 and #3305
| Package (path) | Crate | Holds |
|---|---|---|
nodespace-app-lib (packages/desktop-app/app-lib) |
nodespace_app_lib, rlib |
Everything under today's src/ except main.rs; the tests/it Tauri-seam suite; test-support; the Pro proto compile step until #3335 |
nodespace-app (packages/desktop-app/src-tauri) |
bin nodespace-app |
main.rs, build.rs, tauri.conf.json, tauri.pro.conf.json (until #3354), capabilities/ (until #3308), icons, binaries/, resources/ |
nodespace-app-build (packages/desktop-app/app-build) |
nodespace_app_build |
drop_unstaged_bundle_entries and sync_stale_sidecar: build helpers any app crate uses as a build dependency |
There is no separate extension-API crate. An extension app crate depends on nodespace-app-lib, and nothing in core depends on the extension, so there is no cycle.
The extension API
| Item | Added by |
|---|---|
EXTENSION_API_VERSION: (u32, u32) = (1, 0) |
#3304 |
AppExtensions<R>::none(), ::plugin(P) |
#3304 |
assemble(builder, extensions) |
#3304; extended by #3307, #3320, #3347 |
run(extensions, context) |
#3306 |
on_daemon_ready(task), with DaemonReady { app, grpc, shutdown } |
#3307 |
on_channel_rebuilt(hook) |
#3307 |
update_source(UpdateSource { latest: LatestVersionSource, download_url }) |
#3320 |
daemon_profile(DaemonProfile) |
#3347 (the type comes from #3346 and lives in nodespace_app_lib) |
| Core's window capability, added by the library at startup | #3308 |
| The Rust version equals the TypeScript version, and a fixture change must bump it | #3321 |
When each contribution runs
- Plugins.
assembleregisters them after core's single-instance, opener and dialog plugins. Their setup runs before core's setup. A name that collides with a core plugin or an earlier extension plugin is logged and skipped. - Daemon-ready tasks. Spawned, not awaited, once per process, from core's startup task. They run after
ensure_daemon_runningreturns (healthy or not) and after the watcher and token stream are wired. - Channel-rebuilt hooks. Awaited one at a time in
probe_and_recover_channel, afterGrpcClient::reconnect()and before the re-probe. Each hook has a 2-second timeout. A timeout or panic is logged, and recovery continues. - Update source. Held as managed state. The startup update check and
check_for_update_commandread it.
Sub-issues (in order)
| Key | Title | Depends on |
|---|---|---|
| #3303 | Split the desktop Tauri crate into an app-lib library and a thin app crate | NodeSpaceAI/nodespace-docs#90 (ADR-082), #3299 |
| #3305 | Move the bundle-staging build helpers into a nodespace-app-build crate | #3303 |
| #3304 | Add AppExtensions with Tauri-plugin support and a runtime-generic assemble() | #3303 |
| #3306 | Route the desktop app through run(extensions, context) with no extensions in core | #3304, #3305 |
| #3307 | Add daemon-ready tasks and a channel-rebuilt hook to AppExtensions | #3306 |
| #3320 | Let an app built on core supply its update source through AppExtensions | #3306, #3319 |
| #3308 | Have the app library add core's window capability at startup | #3306 |
| #3321 | Enforce EXTENSION_API_VERSION: Rust matches TypeScript, fixture changes bump it | #3307, #3320, #3308, #3315 |
DAG: NodeSpaceAI/nodespace-docs#90 (ADR-082) + #3299 → #3303 → {#3305, #3304} → #3306 → {#3307, #3320 (+#3319), #3308} → #3321 (+#3315).
The keys are not in execution order:
- Split the desktop Tauri crate into an app-lib library and a thin app crate #3303 and Move the bundle-staging build helpers into a nodespace-app-build crate #3305 replace an earlier plan's assembly-option issues.
- Route the desktop app through run(extensions, context) with no extensions in core #3306 to Let an app built on core supply its update source through AppExtensions #3320 keep their meaning, because Move the Pro Tauri layer out of core: pro_* commands, ProClient, proto, update source #3336 and Remove Pro edition branching from the core app, daemon, CLI and installer #3357 reference them.
#3307, #3320 and #3308 can run in parallel. They all touch run(), AppExtensions or assemble, so whichever merges later rebases.
Notes for downstream issues
-
Paths move. Split the desktop Tauri crate into an app-lib library and a thin app crate #3303 moves:
packages/desktop-app/src-tauri/src/…topackages/desktop-app/app-lib/src/…;src-tauri/tests/ittoapp-lib/tests/it;src-tauri/test-supporttoapp-lib/test-support;src-tauri/proto, and the proto step ofbuild.rs, toapp-lib/.
The library's tests run as
-p nodespace-app-lib. Move the Pro Tauri layer out of core: pro_* commands, ProClient, proto, update source #3336 (Add a neutral daemon:data-plane-ready event and stop reloading on pro:tier-detected #3318, Carry the download URL in the update-check payload instead of a hardcoded releases page #3319 to Delete the vendored nodespace_pro.proto, its build.rs step and its build-only deps #3335), Remove Pro edition branching from the core app, daemon, CLI and installer #3357 (Add a DaemonProfile for the app's daemon binary and service env (no behavior change) #3346 to Collapse proto socket, pid and marker tables to debug/release; drop CLI Pro discovery #3355), Add a File menu item that opens the Share / Sync this database entry #3360 and Describe core's access gate and daemon seams without naming the Pro daemon #3363 should find code by symbol, not by path or line. -
Delete the Pro arm of core's built-in update source and its worker parsing #3323 needs only Let an app built on core supply its update source through AppExtensions #3320. After Let an app built on core supply its update source through AppExtensions #3320, the Pro fetcher and parser are generic
VersionEndpointhelpers that stay in core. Delete the Pro arm of core's built-in update source and its worker parsing #3323 deletes onlyPRO_LATEST_URLand the Pro arm ofbuiltin_update_source_for. -
Delete the pro_* commands, ProClient, startup Pro probe and Pro rebind from core #3334 needs only Add daemon-ready tasks and a channel-rebuilt hook to AppExtensions #3307.
- The sync Pro plugin registers
plugin:<name>|pro_*commands. These are namespaced, so they never collide with core's barepro_*commands during the migration. probe_and_recover_channelkeeps itsappparameter, because the channel-rebuilt hooks need it.
- The sync Pro plugin registers
-
Delete the vendored nodespace_pro.proto, its build.rs step and its build-only deps #3335. The Pro proto step and its build dependencies are in
app-lib/build.rsandapp-lib/Cargo.toml.app-lib/build.rsmust keep itsdesktop/mobilecfg alias. -
Let an app built on core supply its DaemonProfile via AppExtensions::daemon_profile #3347 needs only Route the desktop app through run(extensions, context) with no extensions in core #3306.
DaemonProfile(Add a DaemonProfile for the app's daemon binary and service env (no behavior change) #3346) lives innodespace_app_lib, where an extension app crate can name it.- Let an app built on core supply its DaemonProfile via AppExtensions::daemon_profile #3347 adds
AppExtensions::daemon_profile, and installs the profile at the top ofrun(), before the builder exists. - If Enforce EXTENSION_API_VERSION: Rust matches TypeScript, fixture changes bump it #3321 has merged by then, Let an app built on core supply its DaemonProfile via AppExtensions::daemon_profile #3347 bumps the minor version of
EXTENSION_API_VERSIONin both the Rust and TypeScript constants.
-
Add a File menu item that opens the Share / Sync this database entry #3360. The menu code is still inside
run()'s.setupclosure, inapp-lib/src/lib.rs. -
Never copy a parent's dependencies onto its children. Move the Pro Tauri layer out of core: pro_* commands, ProClient, proto, update source #3336's dependency on Split the desktop Tauri crate and add ADR-082's Tauri extension points #3322 belongs on the Move the Pro Tauri layer out of core: pro_* commands, ProClient, proto, update source #3336 parent only. Copied onto Carry the download URL in the update-check payload instead of a hardcoded releases page #3319, it would create the cycle Split the desktop Tauri crate and add ADR-082's Tauri extension points #3322 → Let an app built on core supply its update source through AppExtensions #3320 → Carry the download URL in the update-check payload instead of a hardcoded releases page #3319 → Split the desktop Tauri crate and add ADR-082's Tauri extension points #3322.
Acceptance criteria (parent)
- The library/app split, the build-helper crate and the entry points in the tables above exist in core, and a test covers each one.
- Using only the documented API, a test extension driven through
assembleonMockRuntimecan do each of the following, and each is a test:- register a Tauri plugin whose command is callable through IPC once granted;
- manage state;
- run plugin setup;
- spawn a daemon-ready task that reaches the daemon on the shared channel;
- receive a working channel after a wedged-channel rebuild;
- replace the update source.
- Core's app crate passes
AppExtensions::none(), and the free app is unchanged:- startup;
- the menus;
- Quit from the menu, Cmd+Q, the tray and window close;
- the single-instance handoff;
- the update check;
- channel recovery;
- dialogs and links.
- Core still compiles in Pro mode (
NODESPACE_PRO_SUPABASE_URLandNODESPACE_PRO_ANON_KEYset) after every sub-issue. - sync's current
build-pro-dmg.shflow still works: the app crate is still atsrc-tauri, andnodespace-appis still the package and bin name. -
EXTENSION_API_VERSIONis equal in Rust and TypeScript, and a test enforces it. - No new Pro, sync, tenant or Supabase wording lands in core.
scripts/check-pro-boundary.tspasses after every sub-issue, and its baselines never rise. - Code comments cite ADRs, never GitHub issue numbers.
Dependencies
- Parent blocker: NodeSpaceAI/nodespace-docs#90 (ADR-082) (ADR-082).
- Sub-issue blockers outside Split the desktop Tauri crate and add ADR-082's Tauri extension points #3322: Add the Pro-boundary ratchet check and the CLAUDE.md Pro/sync placement rule #3299 (for Split the desktop Tauri crate into an app-lib library and a thin app crate #3303), Carry the download URL in the update-check payload instead of a hardcoded releases page #3319 (for Let an app built on core supply its update source through AppExtensions #3320) and Publish the extension host API: services, ui and testing entries, version policy #3315 (for Enforce EXTENSION_API_VERSION: Rust matches TypeScript, fixture changes bump it #3321). They are recorded on those sub-issues only.
- Blocks: Delete the Pro arm of core's built-in update source and its worker parsing #3323 (through Let an app built on core supply its update source through AppExtensions #3320), Delete the pro_* commands, ProClient, startup Pro probe and Pro rebind from core #3334 (through Add daemon-ready tasks and a channel-rebuilt hook to AppExtensions #3307) and Let an app built on core supply its DaemonProfile via AppExtensions::daemon_profile #3347 (through Route the desktop app through run(extensions, context) with no extensions in core #3306).
- No SYNC gate: Split the desktop Tauri crate and add ADR-082's Tauri extension points #3322 removes nothing the Pro build uses.
Out of scope
- Moving or deleting Pro code (Move the Pro Tauri layer out of core: pro_* commands, ProClient, proto, update source #3336, Remove Pro edition branching from the core app, daemon, CLI and installer #3357).
- Frontend extension points (Turn the UI-extension registry into ADR-082's build-time frontend extension API #3317).
- Later sync items: the Pro app crate, the Pro plugin and its ACL files, the single core pin, and config generation.
- Making core's own commands runtime-generic.
- Replaceable menu items and URI-scheme handlers.
- The daemon extension points (ADR-082 §4).
Self-assign each sub-issue when you pick it up. Never assign at creation (core CLAUDE.md).
Plan key: C2 (pro-boundary DAG).
🤖 Generated with Claude Code
Activity
mstomar125 commentedon Oct 1, 2026
Superseded by #3414 (umbrella against the final ADR-081–085)