@synap-core/hydration
v0.1.0
Published
Hydration-style onboarding: types + state machine + importer registry + pipeline orchestration. No UI, no React, no fetch. Runs in Node and browsers.
Readme
@synap-core/hydration
Hydration-style onboarding shared between Studio (Next.js) and Relay (Expo). The user lands workspace-less, greets the Orchestrator in a personal channel, dumps data (markdown folder, LinkedIn archive, Apple Notes, raw paste, files, ZIPs), the AI structures each item into entity proposals, and the user reviews before approving.
This package owns the types, state machine, importer registry, and pipeline orchestration for that flow. It is platform-agnostic: no React, no UI, no fetch. Studio and Relay each plug in their own HydrationClient (tRPC wrapper in Studio, HTTP wrapper in Relay) and render their own UI.
Install
{
"dependencies": { "@synap-core/hydration": "workspace:*" }
}Architecture
flow/—HydrationState, purehydrationReducer, stage transitions + guards.importers/—Importerinterface,ImporterRegistry, seven built-ins: markdown, raw-text, file-upload, telegram, linkedin, apple-notes (stub), file-upload.pipeline/—runItemandrunBatchglue importers to theHydrationClient.proposals/—BulkReviewState+ reducer for the grouped approval UI (selection, per-item edits).
The consumer (Studio or Relay) is responsible for:
- Providing a
HydrationClientimplementation. - Reading files off disk / user input into
ImporterInputshapes. - Driving the reducer from UI events.
- Rendering. Everything visual lands in Phase 3.
Quick tour
import {
ImporterRegistry,
registerDefaultImporters,
initialHydrationState,
hydrationReducer,
runBatch,
} from '@synap-core/hydration';
const registry = new ImporterRegistry();
registerDefaultImporters(registry);
const importer = registry.get('markdown');
const payloads = await importer!.parse({ name: 'note.md', type: 'text/markdown', bytes }, ctx);