@claritylabs/cl-pipelines v0.1.0. For concept explanations and full examples, see the topic pages linked throughout this reference.
Core (@claritylabs/cl-pipelines)
Functions
runPipeline
status: "running", persists the initial checkpoint, and calls scheduler.scheduleAdvance(jobId, 0). Does not execute any phase directly. Safe to call from web request handlers and UI mutation actions.
See runPipeline and advancePhase.
advancePhase
phase.run(ctx), and handles the result. Call this from your SchedulerAdapter implementation, not directly from application code.
buildAgentPhase
Phase<AgentCheckpoint> named "turn" that runs one LLM turn per invocation. Compose with other phases manually when you need a custom graph. Pass to runPipeline via the phases array.
runAgent
buildAgentPhase(opts) and passes the result to runPipeline. Use when you want a pure multi-turn agent loop with no custom phases around it.
See Durable LLM Agent Loop.
createMemoryStorage
StorageAdapter with two additional test-only methods:
_inspect(): Map<string, JobRecord<TState>>— read all stored job records- Implements all five
StorageAdaptermethods in memory
createMemoryScheduler
SchedulerAdapter with two test-only methods:
_bind(fn: (jobId: string) => Promise<void>): void— register the advance handlerdrain(): Promise<void>— flush all pending advances synchronously
Key types
string union
"idle" | "running" | "paused" | "complete" | "error"string union
"resume" | "full"object
object
object
object
union
interface
interface
object
object
type alias
AgentTurn = ModelMessage — re-export of ModelMessage from the Vercel AI SDK.object
Error classes
class
Extends
Error. Base class for all pipeline errors.class
Extends
PipelineError. Thrown when a phase throws an unexpected error (not a { kind: "error" } return).Convex (@claritylabs/cl-pipelines/convex)
Functions
() => object
Returns a Convex field definition object. Spread into
defineTable(...) to add pipelineStatus, pipelineError, pipelineCheckpoint, and pipelineLog columns.function
StorageAdapter backed by Convex mutations. Pass your five pipeline mutation references in the mutations map.function
SchedulerAdapter that calls ctx.scheduler.runAfter(0, advanceAction, { [jobIdArgName]: jobId }). Default jobIdArgName is "jobId".Types
type
The type of the
mutations argument passed to createConvexStorageAdapter. Import and use for type-safe wiring:UI (@claritylabs/cl-pipelines/ui)
Components
compound component
Compound component for displaying job status. Renders
null for "idle", "complete", and undefined status.Sub-components: StatusBanner.Root (alias: StatusBanner), StatusBanner.Indicator, StatusBanner.Title, StatusBanner.Description, StatusBanner.Actions.See Components.component
Renders a
<ul> of LogEntry items. Supports limit, latestOnly, and renderEntry customization. Renders null when entries is empty or undefined.See Components.component
Renders resume and restart buttons. Calls
onRetry("resume") or onRetry("full") on click. Fully customizable via renderButton.See Components.Re-exported types
re-export
"resume" | "full" — re-exported from the core package for convenience in UI code.