β Context/ plans
Augment from DB Β· Phase 3 β the search-and-add remote: editable term, provider palette, one-click add
Launched from any π on the org card: an always-editable term bar, a provider palette, one-click add back to the launching list.
Spec reference
Implements Phase 3 of Augment From DB Flow. Scaffold template: apps/org-workbench (Phase 2). Branch: rebuild/turbo-rsbuild.
One robustness decision beyond the spec (D2 refinement): the augment-it:search-request CustomEvent alone is racy β if search-and-add isn't mounted when the π is clicked (its pairing opens via augment-it:navigate, and the federation import is async), the event is gone before the listener exists. The launch envelope therefore ALSO persists to localStorage['augment-it:search-request'] (the repo's established cross-remount pattern β active-flow, active-record-set, session-token all live there); search-and-add reads it on mount and listens for live events thereafter. Same-origin remotes share localStorage, no shared federation memory needed.
Steps
Scaffold
apps/search-and-add/(:3016) β same shape as org-workbench; federation namesearchAndAdd,saa-*CSS prefix.Lib β
types.ts(SearchRequestDetailmirror,ConnectorResult,ConnectorInfo);search-client.ts(wrappers:search.fire,connectors.inventory, and the five add verbs β org links/streams/corpus, person links/corpus);search-context.svelte.ts($state singleton: current request from localStorage-then-events).Components β
TermBar.svelte(the standing constraint: term always visible, always editable, Enter/Search re-fires);ProviderPalette.svelte(chips fromconnectors.inventory:short_label+ cost-tier styling, needs-env/disabled rendered dark and unclickable, SearXNG preselected, "auto" chip = registry default);ResultRow.svelte(title/host/snippet/date, one β routed byentity+target, per-row "added β" / localized error);ResultsList.svelte;App.svelte(context banner "Adding to:Β· ", auto-fire once when a fresh request arrives β searches are reads, the gating thesis governs writes; every add dispatches augment-it:entity-updated).Verb routing β org: linksβ
organization.links.add, streamsβorganization.streams.add, corpusβorganization.corpus.add; person: linksβperson.links.add, corpusβperson.corpus.add(persons have no streams β target disabled for person entities).org-workbench π β
AdditiveListgains an optionalonsearchprop;OrgCardsupplies per-target seed terms (links:"<name>" LinkedInΒ· streams:"<name>" blogΒ· corpus:"<name>" newsβ hardcoded v1 per spec open question); a sharedrequestSearch()helper writes localStorage + dispatchesaugment-it:search-request+augment-it:navigate {remoteId:'searchAndAdd'}.Shell β
SEARCH_AND_ADD_REMOTEin EXTRA_REMOTES;PAIRINGS += {key:'orgWorkbench+searchAndAdd', left:'orgWorkbench', right:'searchAndAdd', defaultLeftPct:55}; federation map line (:3016). Appended LAST soPAIRINGS[0](the default pair) is unchanged.Verify β svelte-check + build both apps + shell build; dev-server smoke
:3016/remoteEntry.js;search.fireregression via the Phase 1 proof; verb-routing unit sanity is svelte-check-level (the verbs themselves were proven in Phases 1β2). Browser walk-through (π β pairing opens β edit term β swap provider β β β card refreshes) is the operator's check.Changelog, commit + push as
attempt(augment-from-db, search-and-add, step3):.
Out of scope
People reveal / person-shaped π dispatch (Phase 4 β the person routing in step 4 is wired but nothing dispatches person entities yet), stream scanning (Phase 5), fire-log persistence (spec open question β ephemeral v1).