descriptor

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package descriptor provides self-description, manifest, and predict functionality for pulse.

Index

Constants

View Source
const DefaultDictionaryLimit = 100

DefaultDictionaryLimit is the default max entries shown for categorical dictionaries.

Variables

This section is empty.

Functions

This section is empty.

Types

type CohortFieldType

type CohortFieldType struct {
	Name        string `json:"name"`
	Categorical bool   `json:"categorical"`
}

CohortFieldType describes a field type available in .pulse files.

type Command

type Command struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

Command describes a CLI leaf command in the manifest.

type Components

type Components struct {
	Aggregators []string `json:"aggregators"`
	Attributes  []string `json:"attributes"`
	Filterers   []string `json:"filterers"`
	Groupers    []string `json:"groupers"`
}

Components lists all registered processing components.

type DictionaryInfo

type DictionaryInfo struct {
	TotalEntries int      `json:"total_entries"`
	Truncated    bool     `json:"truncated"`
	Values       []string `json:"values"`
}

DictionaryInfo describes the categorical dictionary for a field.

type Envelope

type Envelope struct {
	FormatVersion string           `json:"format_version"`
	Data          any              `json:"data"`
	Errors        []*EnvelopeEntry `json:"errors"`
	Warnings      []*EnvelopeEntry `json:"warnings"`
}

Envelope is the standard JSON output wrapper for all descriptor operations. All --json output follows this shape.

func Inspect

func Inspect(fileData io.ReadSeeker, opts *InspectOptions) *Envelope

Inspect reads a .pulse file header and schema, returning structured field information. It never reads record data.

func InspectFromBytes

func InspectFromBytes(data []byte, opts *InspectOptions) *Envelope

InspectFromBytes is a convenience wrapper that creates a reader from bytes.

func NewEnvelope

func NewEnvelope(data any) *Envelope

NewEnvelope creates an envelope with the given data and no errors/warnings.

func Predict

func Predict(fileData io.ReadSeeker, req *types.Request, opts *PredictOptions) *Envelope

Predict validates a request against a .pulse file without executing it. It reads only the header and schema, never record data. The returned Envelope contains the PredictResult in Data and any errors/warnings encountered.

func PredictFromBytes

func PredictFromBytes(data []byte, req *types.Request, opts *PredictOptions) *Envelope

PredictFromBytes is a convenience wrapper that creates a reader from bytes.

func (*Envelope) AddError

func (e *Envelope) AddError(code, message string, details map[string]any)

AddError appends a structured error to the envelope.

func (*Envelope) AddWarning

func (e *Envelope) AddWarning(code, message string, details map[string]any)

AddWarning appends a structured warning to the envelope.

func (*Envelope) MarshalJSON

func (e *Envelope) MarshalJSON() ([]byte, error)

MarshalJSON produces deterministic JSON output.

type EnvelopeEntry

type EnvelopeEntry struct {
	Code    string         `json:"code"`
	Message string         `json:"message"`
	Details map[string]any `json:"details,omitempty"`
}

EnvelopeEntry represents a single error or warning in the envelope.

type InspectField

type InspectField struct {
	Name              string          `json:"name"`
	Type              string          `json:"type"`
	ByteOffset        int             `json:"byte_offset"`
	BitPosition       int             `json:"bit_position"`
	Description       string          `json:"description"`
	DescriptionSource string          `json:"description_source"`
	Categorical       bool            `json:"categorical"`
	Dictionary        *DictionaryInfo `json:"dictionary,omitempty"`
}

InspectField describes a single field in the inspect output.

type InspectOptions

type InspectOptions struct {
	// FullDict disables dictionary truncation when true.
	FullDict bool
	// DictionaryLimit overrides the default truncation limit.
	// Zero means use DefaultDictionaryLimit.
	DictionaryLimit int
}

InspectOptions controls inspect behavior.

type InspectResult

type InspectResult struct {
	FieldCount int             `json:"field_count"`
	Fields     []*InspectField `json:"fields"`
}

InspectResult holds the schema inspection output.

type Manifest

type Manifest struct {
	FormatVersion string            `json:"format_version"`
	Commands      []Command         `json:"commands"`
	Components    Components        `json:"components"`
	CohortTypes   []CohortFieldType `json:"cohort_types"`
	Skills        []SkillMeta       `json:"skills"`
}

Manifest is the root self-description of the Pulse system.

func BuildManifest

func BuildManifest() *Manifest

BuildManifest constructs a deterministic Manifest from the current registries.

type PredictOptions

type PredictOptions struct {
	// Strict upgrades warnings to errors.
	Strict bool
}

PredictOptions controls predict behavior.

type PredictResult

type PredictResult struct {
	Valid      bool               `json:"valid"`
	Request    *types.Request     `json:"request"`
	SchemaInfo *PredictSchemaInfo `json:"schema_info,omitempty"`
}

PredictResult holds the validated request and any diagnostics.

type PredictSchemaInfo

type PredictSchemaInfo struct {
	FieldCount int      `json:"field_count"`
	Fields     []string `json:"fields"`
}

PredictSchemaInfo summarizes the schema used for prediction.

type SkillMeta

type SkillMeta struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

SkillMeta describes a bundled skill.

Jump to

Keyboard shortcuts

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