adapters

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package adapters defines verified capture integration contracts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasMarkerBlock added in v0.3.0

func HasMarkerBlock(path, marker string) bool

Types

type Adapter

type Adapter interface {
	Descriptor() Descriptor
	Detect(context.Context) (Detection, error)
	Install(context.Context, InstallOptions) (InstallResult, error)
	Uninstall(context.Context, InstallOptions) (InstallResult, error)
	PlanInstall(context.Context, SetupOptions) (SetupPlan, error)
	Status(context.Context) (SetupStatus, error)
	Test(context.Context) (TestResult, error)
	HealthCheck(context.Context) error
	Ingest(context.Context, io.Reader) ([]RawRecord, error)
	Normalize(RawRecord) (RawRecord, error)
	ExtractProjectSignals(RawRecord) ProjectSignals
}

Adapter has one stable lifecycle. It emits signals; app.Service resolves projects.

type Capabilities

type Capabilities struct {
	ModelIdentity       bool `json:"model_identity"`
	InputTokens         bool `json:"input_tokens"`
	OutputTokens        bool `json:"output_tokens"`
	ReasoningTokens     bool `json:"reasoning_tokens"`
	CacheTokens         bool `json:"cache_tokens"`
	ContextUsage        bool `json:"context_usage"`
	ToolCalls           bool `json:"tool_calls"`
	MCPCalls            bool `json:"mcp_calls"`
	Costs               bool `json:"costs"`
	PromptSizes         bool `json:"prompt_sizes"`
	ResponseSizes       bool `json:"response_sizes"`
	SessionLifecycle    bool `json:"session_lifecycle"`
	TaskMetadata        bool `json:"task_metadata"`
	ProjectIdentity     bool `json:"project_identity"`
	WorkingDirectory    bool `json:"working_directory"`
	VCSContext          bool `json:"vcs_context"`
	WorkspaceContext    bool `json:"workspace_context"`
	ProjectSwitchEvents bool `json:"project_switch_events"`
	StructuredEvents    bool `json:"structured_events"`
}

Capabilities reports only data an adapter can actually provide.

type CaptureQuality added in v0.3.0

type CaptureQuality string
const (
	CaptureProviderReported CaptureQuality = "provider_reported"
	CaptureAgentReported    CaptureQuality = "agent_reported"
	CaptureOTELReported     CaptureQuality = "otel_reported"
	CaptureLifecycleOnly    CaptureQuality = "lifecycle_only"
	CaptureExperimental     CaptureQuality = "experimental"
	CaptureEstimated        CaptureQuality = "estimated"
	CaptureManualImport     CaptureQuality = "manual_import"
	CaptureUnavailable      CaptureQuality = "unavailable"
)

type Descriptor

type Descriptor struct {
	ID           string       `json:"id"`
	Name         string       `json:"name"`
	Version      string       `json:"version"`
	Capabilities Capabilities `json:"capabilities"`
}

type Detection

type Detection struct {
	Available bool   `json:"available"`
	Evidence  string `json:"evidence"`
}

type GenericJSONL

type GenericJSONL struct{}

GenericJSONL imports caller-supplied normalized records. It does not infer metrics.

func (GenericJSONL) Descriptor

func (GenericJSONL) Descriptor() Descriptor

func (GenericJSONL) Detect

func (GenericJSONL) ExtractProjectSignals

func (GenericJSONL) ExtractProjectSignals(RawRecord) ProjectSignals

func (GenericJSONL) HealthCheck

func (GenericJSONL) HealthCheck(context.Context) error

func (GenericJSONL) Ingest

func (GenericJSONL) Ingest(_ context.Context, reader io.Reader) ([]RawRecord, error)

func (GenericJSONL) Install

func (GenericJSONL) Normalize

func (GenericJSONL) Normalize(record RawRecord) (RawRecord, error)

func (GenericJSONL) PlanInstall added in v0.3.0

func (GenericJSONL) Status added in v0.3.0

func (GenericJSONL) Test added in v0.3.0

func (GenericJSONL) Uninstall

type InstallOptions

type InstallOptions struct {
	DryRun bool
}

type InstallResult

type InstallResult struct {
	Changed bool          `json:"changed"`
	Actions []string      `json:"actions"`
	Changes []SetupChange `json:"changes,omitempty"`
}

type ProjectSignals

type ProjectSignals struct {
	Project   string
	CWD       string
	GitRoot   string
	Workspace string
}

type RawRecord

type RawRecord struct {
	Source  string
	Payload []byte
}

type Registry

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

func Default

func Default() *Registry

func NewRegistry

func NewRegistry(items ...Adapter) (*Registry, error)

func (*Registry) Get

func (r *Registry) Get(id string) (Adapter, bool)

func (*Registry) List

func (r *Registry) List() []Adapter

type SetupChange added in v0.3.0

type SetupChange struct {
	Path        string `json:"path"`
	Action      string `json:"action"`
	BackupPath  string `json:"backup_path,omitempty"`
	Description string `json:"description"`
}

func ApplyMarkerBlock added in v0.3.0

func ApplyMarkerBlock(path, marker, content string, dryRun bool) (SetupChange, error)

func RemoveMarkerBlock added in v0.3.0

func RemoveMarkerBlock(path, marker string, dryRun bool) (SetupChange, error)

type SetupOptions added in v0.3.0

type SetupOptions struct {
	DryRun bool
	Yes    bool
}

type SetupPlan added in v0.3.0

type SetupPlan struct {
	AdapterID      string         `json:"adapter_id"`
	State          SetupState     `json:"state"`
	CaptureQuality CaptureQuality `json:"capture_quality"`
	Changes        []SetupChange  `json:"changes"`
	Notes          []string       `json:"notes"`
}

type SetupState added in v0.3.0

type SetupState string
const (
	SetupAvailable   SetupState = "available"
	SetupInstalled   SetupState = "installed"
	SetupPartial     SetupState = "partial"
	SetupDrifted     SetupState = "drifted"
	SetupUnavailable SetupState = "unavailable"
)

type SetupStatus added in v0.3.0

type SetupStatus struct {
	AdapterID      string         `json:"adapter_id"`
	Available      bool           `json:"available"`
	Installed      bool           `json:"installed"`
	State          SetupState     `json:"state"`
	CaptureQuality CaptureQuality `json:"capture_quality"`
	Evidence       string         `json:"evidence"`
	Notes          []string       `json:"notes,omitempty"`
}

type TestResult added in v0.3.0

type TestResult struct {
	AdapterID      string         `json:"adapter_id"`
	Passed         bool           `json:"passed"`
	CaptureQuality CaptureQuality `json:"capture_quality"`
	Message        string         `json:"message"`
	TestedAt       time.Time      `json:"tested_at"`
}

Jump to

Keyboard shortcuts

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