Repository navigation
Description
Overview
Pro-edition GUI surfaces (sync pill, re-login modal, collaboration tab) are hardcoded into shared components behind scattered {#if proSync.isPro} guards. Replace this with a small UI-extension registry whose contributions resolve their rendered variant from two signals: the daemon build-variant capability (app-global) and the active database's DatabaseSettingsNode (node-held, per ADR-053). Shared components import nothing Pro; community builds render upsell teasers in the same slots.
Problem Statement
app-shell.svelteimportsProSyncPill/ProReloginModaldirectly and owns Pro-specific$effectorchestration (relogin state, recovered-items load-once).collection-node-viewer.sveltehardcodes the collaboration tab behindproSync.isPro(lines ~185, ~206).- The single boolean
proSync.isProconflates two independent questions that ADR-053 separates: "can this daemon sync?" (build variant, app-global, static per session) and "is sync enabled/authenticated for the active database?" (held on that database'sDatabaseSettingsNode, changes on database switch or settings edit). A Pro daemon with a non-synced active database currently cannot be represented. - Community edition hides Pro surfaces entirely instead of showcasing upgrade paths (ADR-039 calls for upgrade CTAs in place of sync controls but provides no mechanism).
Proposed Solution
A sibling registry to the existing node-type PluginRegistry — do NOT extend PluginDefinition (different keys, lifecycles, and consumers). One UiExtensionDefinition for Pro sync with a resolveVariant() state machine over the two signals; the registry exposes contributions through a $derived-friendly reactive wrapper.
Variant state machine
| Condition | Variant | Component |
|---|---|---|
proSync.tier !== 'pro' |
teaser |
pro-teaser-pill.svelte (new) — upgrade CTA |
Pro + sync_enabled: false |
enable-prompt |
enable-sync-pill.svelte (new) — enable sync for this database |
Pro + enabled + auth_status: 'local' |
sign-in |
sign-in pill state |
Pro + enabled + auth_status: 'connected' |
connected |
existing pro-sync-pill.svelte, unchanged internally |
sync_enabled/auth_status are read reactively from sharedNodeStore.getNode('database-settings') (fixed symbolic ID) — no bespoke database-settings.svelte.ts store; DatabaseSettingsNode flows through SharedNodeStore like any other node.
Core types
export type ChromeSlot = 'app-shell-overlay' | 'app-shell-modal';
export interface ChromeContribution {
slot: ChromeSlot;
variant: string; // which resolveVariant() output this renders for
lazyLoad: () => Promise<{ default: Component }>;
priority?: number;
}
export interface ViewerExtension {
tab: { appliesTo: string; id: string; label: string };
variant: string;
lazyLoad: () => Promise<{ default: Component<{ nodeId: string }> }>;
priority?: number;
}
export interface UiExtensionDefinition {
id: string;
name: string;
version: string;
chrome?: ChromeContribution[];
viewerExtensions?: ViewerExtension[];
resolveVariant?: () => string | null; // null = contribute nothing
}Registry stays a plain class holding declarative data (mirrors PluginRegistry); reactivity is layered on top in a thin .svelte.ts wrapper exposing getActiveChromeContributions(slot) / getActiveViewerExtensions(nodeType) that read proSync.tier + the database-settings node and filter by the freshly resolved variant. Do not bake $state into the class methods.
Implementation Approach
Phase 1: Registry + reactive wrapper
- Add
lib/plugins/ui-extensions.ts(types +UiExtensionRegistryclass + singleton), mirroringplugin-registry.tsstructure - Add
lib/plugins/ui-extensions.svelte.tsreactive wrapper ($derived.byover tier × database-settings node)
Phase 2: Pro plugin definition + variant components
- Add
lib/plugins/pro-plugin.ts— oneproSyncUiExtensiondefinition with the four-variant chrome array and the collaborationviewerExtensionsentry - New components:
pro-teaser-pill.svelte,enable-sync-pill.svelte(small, static copy — do not make teaser content data-driven) - Existing
pro-sync-pill.svelte/pro-relogin-modal.svelte/collaboration-view.svelteunchanged internally; only their mounting moves to lazy-loaded registry entries
Phase 3: Rewire mount points (delete old gating in the same change — no transition code)
app-shell.svelte: deleteProSyncPill/ProReloginModalimports, Pro$effect/$derivedblocks, and the hardcoded pill slot div; replace with a generic overlay-slot renderer iteratinggetActiveChromeContributions('app-shell-overlay')collection-node-viewer.svelte: delete theproSyncimport and hardcoded{#if proSync.isPro}tab strip; replace with a registry-driven tab strip fromgetActiveViewerExtensions('collection'). Locked/teaser tab state renders when sync is not enabled for the active database, even on a Pro daemon
Phase 4: Two-axis gating in dependent stores
membership.svelte.ts:isProgetter becomesproSync.tier === 'pro' && dbSettings?.properties?.sync_enabled === true(has_role edges are per-database under ADR-053)recovered-items.svelte.ts: foldsync_enabled/auth_statusinto the existing no-op guard (recovered items only exist for databases that have actually synced)pro-sync.svelte.ts: unchanged in shape; re-documentisProas "daemon binary can sync" (axis 1 only), not "sync is active"tauri-sync-listener.ts: NO change — its coalescing is a data-sync concern, not a rendering surface; leave itsproSync.isProgate as-is
Acceptance Criteria
-
app-shell.svelteandcollection-node-viewer.sveltecontain zero Pro component imports and zeroproSync.isProconditionals - All four pill variants render correctly per the state machine (community teaser; Pro+disabled enable-prompt; Pro+local sign-in; Pro+connected live pill)
- Collaboration tab shows locked/teaser state on a Pro daemon when the active database has
sync_enabled: false - Variant re-resolves reactively when the
database-settingsnode changes (no$effectmisuse — derived reads only) - No new bespoke store for database-settings state — read via
sharedNodeStore.getNode('database-settings') -
membership.svelte.tsandrecovered-items.svelte.tsuse the two-axis check - Existing Pro components (
pro-sync-pill,pro-relogin-modal,collaboration-view) unchanged internally - No new responsibilities added to
base-node-viewer.svelte - Tests pass (bun run test:all)
- Code passes bun run quality:fix
Technical Specifications
Reference Files
- PluginRegistry:
packages/desktop-app/src/lib/plugins/plugin-registry.ts— structural template (plain class, lazy-load-and-cache); do NOT extendPluginDefinitionintypes.ts - Schema loader precedent:
packages/desktop-app/src/lib/plugins/schema-plugin-loader.ts— DB-state-materializes-as-plugin pattern - Current mount points:
packages/desktop-app/src/lib/components/layout/app-shell.svelte,packages/desktop-app/src/lib/components/viewers/collection-node-viewer.svelte - Axis-1 signal:
packages/desktop-app/src/lib/stores/pro-sync.svelte.ts(tier,isProderived) - Stores to re-gate:
packages/desktop-app/src/lib/stores/membership.svelte.ts,packages/desktop-app/src/lib/stores/recovered-items.svelte.ts - Reactivity pattern: ADR-049 (canonical reactivity-store pattern) — plain data class + layered
$state/$derived - Architecture basis: ADR-053 (one daemon, N databases; per-database identity) — Pro UI surfaces are views of the active database's DatabaseSettingsNode
Database-switch requirement (coordination note)
Node IDs are unique only within a database. The restart-free database switcher (ADR-053, not yet built) MUST fully repopulate SharedNodeStore on switch; when it does, database-settings re-resolves to the new database's node and all variants re-derive automatically — no on-switch hook needed in this registry. This is the switcher's obligation; record it in that issue when created.
Standards
- Svelte 5 runes; derived values over
$effect createLogger, no raw console- No
anytypes;bun run test, neverbun test - Greenfield: delete replaced gating code in the same PR, no dual-mode support
Dependencies
- Implement DatabaseSettingsNode (database-settings schema + behavior) #1398 (DatabaseSettingsNode must exist with
sync_enabled/auth_statusbefore the variant resolver can read them)
Related Issues
- SharedNodeStore fakes reactivity — replace the version-counter Map with a genuinely reactive per-node source #1490 (reactive per-node source — the wrapper reads nodes through SharedNodeStore and benefits from, but does not block on, that rework)
- Add PTY agents (Claude Code, Gemini, Codex) to AI Chat model selector #1450 / AI-Chat model selector never offers the PTY (agent-CLI) option, leaving provider:'pty' unreachable #1489 (other model-selector UI work, unrelated mechanism)
Non-Goals
- The database switcher UI and its store (separate ADR-053 follow-up work)
- A
database-switcher-rowchrome slot or pill placement inside the switcher region (real coupling, deliberately deferred until the switcher exists;ChromeSlotstays a string union so the slot can be added without registry changes) - Data-driven/node-authored
resolveVariant()or teaser copy — the four variants are a fixed hand-written state machine - Settings-section slots (no current consumer)
- Changes to
tauri-sync-listener.tscoalescing or backend/Tauri commands
Activity
mstomar125 commentedon Jul 7, 2026
Not picked up today — hard-blocked on #1398.
The
sync_enabled/auth_statusproperties the pill state machine reads don't exist until #1398 lands, and re-gatingmembership.isProonsync_enabledbefore #1398 populates that property would regress every existing Pro daemon (the property would be permanently undefined → collaboration tab + live-sync pill silently lost). Even after #1398 it's ~1–2 days (new registry subsystem + reactive.svelte.tswrapper + Pro plugin + two teaser components + rewiring the ~820-line app-shell + re-gating two stores + a test layer). Ordered after #1398.mstomar125 commentedon Jul 10, 2026
Development complete — merged in PR #1607 (
9821b795). Leaving this issue open pending live desktop UI validation.What landed
The Pro-sync UI is now driven by a declarative UI-extension registry with two-axis variant resolution:
proSync.tier, app-global) → non-Pro resolves to the static upgrade teaser.DatabaseSettingsNode.sync_enabled/auth_status, per-database) → Pro resolves toenable-prompt→sign-in→connected.The resolver returns only the chrome contributions / viewer extensions matching the current variant; app-shell overlay/modal slots and the collection-node viewer render them through a generic
ExtensionOutletinstead of hard-coded pill/modal wiring. Membership and recovered-items stores now gate on the two-axisisProSyncActive()(was tier-only).DatabaseSettingsNodeis hydrated on load and after a database switch so the surface re-resolves per active database. Community build resolves to the teaser only — the free experience is unchanged (test:free-usersguardrail green).Verified:
bun run test3989 passed ·test:free-users11 passed ·quality:check(eslint + svelte-check) 0/0 · full pre-push pyramid green.Backend follow-up (tracked here)
There is no per-database "enable sync" intent command yet.
enable-sync-pilltherefore opts a database into sync via the existing interactive sign-in (pro_initiate_oauth), which flipssync_enabled/auth_statuson tenant bind. A dedicated set-sync_enabledcommand would let a Pro user enable sync for a database without immediately signing in — worth adding when the multi-tenant-per-machine surfaces land.Pending
Live desktop UI validation of the variant transitions (teaser → enable → sign-in → connected across database switches) is still to do — batched with the other live checks. Issue stays open until that passes.
malibio commentedon Aug 17, 2026
Triage (2026-08-17): open for 38 days solely on live UI validation.
Last update (2026-07-10) reports development complete and merged in PR #1607 (
9821b795), left open "pending live desktop UI validation." That validation has not happened since.The registry surface is present in the tree —
pro-plugin.ts,enable-sync-pill.svelte,pro-sync-pill.svelte, all wired throughapp-shell.svelte— consistent with the merge report.Ask: @malibio this needs either a 10-minute manual pass in the desktop app (non-Pro teaser → Pro enable-prompt → sign-in → connected, across a database switch) or a decision to close on the strength of the merged implementation and reopen if something surfaces in use. Holding an issue open for over a month on an unscheduled manual check mostly costs signal — it reads as in-flight work when the code has shipped.
Note this overlaps #1535's remaining criterion "Sync pill reflects the active database only; per-database status is correct after switches" — the same manual pass would settle both.
No action taken — triage note only.
mstomar125 commentedon Sep 1, 2026
Verified independently (2026-09-01): this is already fully implemented and shipped.
9821b795"Add UI-extension registry for two-axis Pro-sync surfaces (ADR-053)" (PR Add UI-extension registry for two-axis Pro-sync surfaces (ADR-053) #1607, merged 2026-07-10) implements the issue's exact spec — confirmed a direct ancestor of currentmain(git merge-base --is-ancestor).app-shell.svelteandcollection-node-viewer.sveltehave zeroproSync.isPro/ProSyncPill/ProReloginModalhardcoded references.membership.svelte.tsuses the two-axisisProSyncActive().recovered-items.svelte.tsdeliberately stays tier-only (documented, reasoned deviation — it's per-user not per-database).ui-extensions.test.ts(16),free-user-guardrail.test.ts(11),pro-teaser-pill.test.ts(2),enable-sync-pill.test.ts(2) — 31/31 passing.The only thing keeping this open was a manual live-desktop-UI click-through pass requested in the 2026-08-17 triage comment — not a formal acceptance criterion, and not something this environment can run (no browser/GUI/OAuth capability here, same standing limitation as other interactive validation). Closing on the strength of the merged, tested implementation; reopen if that manual pass surfaces something real.