flows

package
v0.11.0-beta.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

Overview

Package flows provides the unified flow type system stolen from OpenClaw's src/flows/. Every interactive surface in Overkill — provider setup, channel picker, model selection, health checks, search config — produces a FlowContribution. A single WizardPrompter handles all of them.

Storage: Postgres (not SQLite — "Postgres is just the goat").

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FlowContribution

type FlowContribution struct {
	ID       string      `json:"id"`                 // e.g. "provider:setup:deepseek"
	Kind     FlowKind    `json:"kind"`               // "channel" | "core" | "provider" | "search"
	Surface  FlowSurface `json:"surface"`            // "auth-choice" | "health" | "model-picker" | "setup"
	Option   FlowOption  `json:"option"`             // The selectable UI item
	Source   FlowSource  `json:"source,omitempty"`   // Where this came from
	PluginID string      `json:"pluginId,omitempty"` // If registered by a plugin
}

FlowContribution is the universal shape for every interactive flow surface. Every setup wizard, model picker, health check, and channel config produces a slice of these. One WizardPrompter.Select() handles all of them.

type FlowKind

type FlowKind string

FlowKind categorizes a contribution by domain.

const (
	KindChannel  FlowKind = "channel"
	KindCore     FlowKind = "core"
	KindProvider FlowKind = "provider"
	KindSearch   FlowKind = "search"
)

type FlowOption

type FlowOption struct {
	Value string       `json:"value"`          // Stable key for selection
	Label string       `json:"label"`          // Display label
	Hint  string       `json:"hint,omitempty"` // Extra description
	Group *OptionGroup `json:"group,omitempty"`
	Docs  *OptionDocs  `json:"docs,omitempty"`
}

FlowOption is the item a user selects in a flow wizard. Value is the stable key; Label is the display text. Group and Docs provide optional visual grouping and documentation links.

type FlowRecord

type FlowRecord struct {
	ID         string    `json:"id"`
	Kind       string    `json:"kind"`
	Surface    string    `json:"surface"`
	Value      string    `json:"value"`
	Label      string    `json:"label"`
	Hint       string    `json:"hint,omitempty"`
	GroupID    string    `json:"groupId,omitempty"`
	GroupLabel string    `json:"groupLabel,omitempty"`
	Source     string    `json:"source"`
	PluginID   string    `json:"pluginId,omitempty"`
	CreatedAt  time.Time `json:"createdAt"`
}

FlowRecord is the persisted row in the flow_contributions table. It mirrors FlowContribution with database-level fields.

func FromContribution

func FromContribution(c FlowContribution) FlowRecord

FromContribution converts an in-memory contribution to a database record.

func (*FlowRecord) ToContribution

func (r *FlowRecord) ToContribution() FlowContribution

ToContribution converts a database record to the in-memory type.

type FlowSource

type FlowSource string

FlowSource records where a contribution came from. Manifest entries are static declarations in plugin manifests. Install-catalog entries are packages available for download. Runtime entries come from live plugins. Core entries ship with Overkill itself.

const (
	SourceManifest       FlowSource = "manifest"
	SourceInstallCatalog FlowSource = "install-catalog"
	SourceRuntime        FlowSource = "runtime"
	SourceCore           FlowSource = "core"
	SourcePlugin         FlowSource = "plugin"
)

type FlowSurface

type FlowSurface string

FlowSurface identifies which UI surface the contribution belongs to.

const (
	SurfaceAuthChoice  FlowSurface = "auth-choice"
	SurfaceHealth      FlowSurface = "health"
	SurfaceModelPicker FlowSurface = "model-picker"
	SurfaceSetup       FlowSurface = "setup"
)

type OptionDocs

type OptionDocs struct {
	Path  string `json:"path"`
	Label string `json:"label,omitempty"`
}

OptionDocs links to relevant documentation for this option.

type OptionGroup

type OptionGroup struct {
	ID    string `json:"id"`
	Label string `json:"label"`
	Hint  string `json:"hint,omitempty"`
}

OptionGroup visually groups options in the picker UI.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is the Postgres-backed flow contribution registry. Provider flows are dynamic — plugins register themselves at runtime. Channel setup flows are hybrid — bundled channels ship with core, installable channels come from a catalog.

func NewStore

func NewStore(db *sql.DB) *Store

NewStore wires the flow store to an existing Postgres connection pool.

func (*Store) EnsureSchema

func (s *Store) EnsureSchema(ctx context.Context) error

EnsureSchema is a convenience that calls Migrate. Exists so the DB migration runner has a single entry point for all flow-related tables.

func (*Store) ListAll

func (s *Store) ListAll(ctx context.Context) ([]FlowContribution, error)

ListAll returns every flow contribution, newest first.

func (*Store) ListContributions

func (s *Store) ListContributions(ctx context.Context, kind FlowKind, surface FlowSurface) ([]FlowContribution, error)

ListContributions returns all contributions for a given kind and surface.

func (*Store) Migrate

func (s *Store) Migrate(ctx context.Context) error

Migrate creates the flow_contributions table if it doesn't exist.

func (*Store) RegisterChannel

func (s *Store) RegisterChannel(ctx context.Context, c FlowContribution) error

RegisterChannel upserts a channel flow contribution.

func (*Store) RegisterProvider

func (s *Store) RegisterProvider(ctx context.Context, c FlowContribution) error

RegisterProvider upserts a provider flow contribution. Plugins call this at init time to make themselves available in setup wizards.

func (*Store) Remove

func (s *Store) Remove(ctx context.Context, id string) error

Remove deletes a flow contribution by ID. Used when a plugin is uninstalled to clean up its setup entries.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL