source

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 27 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package source is where a source registers: its unit codec, its ingestion job, its rows and its workflow facts. Only the composition root and the sources import it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Build

type Build func(cfg config.Config, d Deps) (Module, error)

Build makes a source's module from the config and the shared handles.

type CLI

type CLI struct {
	Name, Usage string
	Run         func(ctx context.Context, args []string, out, errw io.Writer) error
}

CLI is a plugin's own command, run as <command> <Name> ... when Name is not a core command.

type Deps

type Deps struct {
	DB        *sqlite.DB
	Inventory *inventory.Store
	GitHub    *github.Client
	WS        *workspace.Set
	// Sink is the view sink whose columns WS reports as workspace statuses.
	Sink    string
	Turns   *turns.Service
	Briefs  *brief.Queue
	Changes *change.Log
	Clock   port.Clock
	Log     func(format string, args ...any)
	// Git reads the local checkouts; Agents are the agents by name and
	// Intents the loaded intents' registry, nil before a profile loads.
	Git     gitx.Git
	Agents  map[string]turns.Agent
	Intents func() *dintent.Registry
	// Units is the daemon's registry, built after the modules; Links the link store.
	Units func() *unit.Registry
	Links port.LinkStore
}

Deps are the shared handles a source builds from. Briefs is nil when the brief is off, WS when no workspace manager is configured.

type Job

type Job struct {
	Name    string
	Every   time.Duration
	Timeout time.Duration // a run's limit; 0 is the daemon's default
	Run     func(ctx context.Context) (summary, skipped string, err error)
}

type Module

type Module struct {
	ID     unit.ProviderID
	Codec  unit.Codec
	Ingest ingest.Job
	// Rows builds the source's read model provider with the daemon's row deps.
	Rows func(d readmodel.RowDeps) readmodel.Provider
	// Facts are the source's workflow facts; nil until the source offers any.
	Facts automation.Units
	// Track reads a unit about to be tracked, wrapping a failed read in
	// port.ErrNotFound or port.ErrGitHub when it can tell which; nil tracks
	// the source's units unread.
	Track func(ctx context.Context, u unit.Unit) (port.TrackRead, error)
	// Untrack stops following a unit Track followed; set, the source keeps
	// its own follows and the daemon sends it every track and untrack of
	// its units.
	Untrack func(ctx context.Context, u unit.Unit) error
	// Slow is the source's slow job, which rebuilds what the ingestion job
	// keeps cheap; nil is none.
	Slow func(ctx context.Context) (summary, skipped string, err error)

	// Items are the derived items of a row: deterministic, stable ids, no I/O; the viewer comes from the row's payload.
	Items func(row api.Row) []items.Item
	// Card is required when Items is set or the plugin's units carry items.
	Card func(ctx context.Context, row api.Row) (card.Card, error)
	// Identity is the user as this plugin knows them.
	Identity   func(ctx context.Context) (items.Person, error)
	UnitEvents links.EventReader
	UI         *api.PluginUI
	// WebAssets are served under /plugins/<id>/.
	WebAssets fs.FS
	CLI       *CLI
	// Run is a long-running stream; the daemon runs it for an enabled plugin until ctx ends, restarting after 30 s on error.
	Run    func(ctx context.Context) error
	Health func(ctx context.Context) (api.SourceHealth, error)
	// Jobs are extra daemon jobs of the plugin.
	Jobs      []Job
	Publisher port.Effects
	// Proposals is called by the proposals job; a provider with Proposals gets no generic stalled nudge.
	Proposals         func(ctx context.Context, now time.Time) ([]outbox.Proposal, error)
	Payload           turn.PayloadReader
	PlacementDefaults placement.Defaults
	PlacementHints    placement.Hints
}

Module is one source as the daemon runs it.

func (Module) Valid

func (m Module) Valid() error

Valid says why m cannot be registered: a codec, an ingestion job and rows of its own provider, and a card when it derives items.

type Plugin

type Plugin struct {
	ID unit.ProviderID
	// Name is how a person reads the plugin's service, such as "GitHub".
	Name  string
	Codec unit.Codec
	Build Build
}

Plugin is a compiled-in plugin: its codec is registered even when it is disabled.

Jump to

Keyboard shortcuts

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