lightaction

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 10 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 lightaction compiles a versioned authoring language into the existing finite Program contract. It performs no I/O, device discovery or execution.

Index

Constants

View Source
const Contract = "nb1-light-action/v1"
View Source
const MaxRequestBytes = 65536

Variables

View Source
var ErrInvalid = errors.New("invalid light action")

Functions

This section is empty.

Types

type NormalizedAction

type NormalizedAction struct {
	Kind       string   `json:"kind"`
	LED        *int     `json:"led,omitempty"`
	Color      string   `json:"color,omitempty"`
	Colors     []string `json:"colors,omitempty"`
	LEDs       []int    `json:"leds,omitempty"`
	DurationMS *int     `json:"duration_ms,omitempty"`
	OnMS       *int     `json:"on_ms,omitempty"`
	OffMS      *int     `json:"off_ms,omitempty"`
	PeriodMS   *int     `json:"period_ms,omitempty"`
	AttackMS   *int     `json:"attack_ms,omitempty"`
	DecayMS    *int     `json:"decay_ms,omitempty"`
	RestMS     *int     `json:"rest_ms,omitempty"`
	Cycles     *int     `json:"cycles,omitempty"`
	Transition string   `json:"transition,omitempty"`
	OnFinish   string   `json:"on_finish"`
}

NormalizedAction includes only fields applicable to this kind. Colors are raw canonical RGB8, and defaults are explicit. Pointers preserve valid zeros.

type Result

type Result struct {
	SchemaVersion          int              `json:"schema_version"`
	Contract               string           `json:"contract"`
	ProgramCompileContract string           `json:"program_compile_contract"`
	Action                 NormalizedAction `json:"action"`
	Program                control.Program  `json:"program"`
	NominalDurationMS      int64            `json:"nominal_duration_ms"`
	TotalSteps             int              `json:"total_steps"`
	RequiredCapabilities   []string         `json:"required_capabilities"`
}

func CompileJSON

func CompileJSON(data []byte) (Result, error)

CompileJSON accepts one bare action. It does not accept a Program, legacy Effect or the contract/action envelope; those remain distinct input shapes.

func CompileRequest

func CompileRequest(data []byte) (Result, error)

CompileRequest requires exactly {"contract":"nb1-light-action/v1","action":{...}}.

Jump to

Keyboard shortcuts

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