launchapi

package
v0.63.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package launchapi defines AMQ's versioned public launch-intent contract. Runtime plans, roots, leases, bindings, journals, and backend mutation stay owned by internal/launch and are not represented by caller-writable types.

Index

Constants

View Source
const (
	IntentVersionV1  = 1
	RequestVersionV1 = 1
	ResultVersionV1  = 1
)
View Source
const (
	PrepareOutcomeReady          = "ready"
	PrepareOutcomeActionRequired = "action_required"
	PrepareOutcomeUnsupported    = "unsupported"
)
View Source
const ContractSemverV1 = "0.61.0"

Variables

This section is empty.

Functions

func EncodeResultV1

func EncodeResultV1(writer io.Writer, result any) error

EncodeResultV1 writes the exact bytes returned by MarshalResultV1.

func MarshalLaunchIntentV1

func MarshalLaunchIntentV1(intent LaunchIntentV1) ([]byte, error)

func MarshalResultV1

func MarshalResultV1(result any) ([]byte, error)

MarshalResultV1 is the canonical JSON encoder for all V1 result DTOs.

func ValidateDigest

func ValidateDigest(digest string) error

Types

type ApplyRequestV1

type ApplyRequestV1 struct {
	RequestVersion int              `json:"request_version"`
	Prepare        PrepareRequestV1 `json:"prepare"`
	SubjectDigest  string           `json:"subject_digest"`
	Decisions      []DecisionV1     `json:"decisions"`
}

func DecodeApplyRequestV1

func DecodeApplyRequestV1(data []byte) (ApplyRequestV1, error)

func (ApplyRequestV1) Validate

func (request ApplyRequestV1) Validate() error

type ApplyResultV1

type ApplyResultV1 struct {
	ResultVersion int    `json:"result_version"`
	Outcome       string `json:"outcome"`
	ReasonCode    string `json:"reason_code,omitempty"`
	// FailureDetail is non-contract diagnostic prose for CLI stderr. It is
	// deliberately excluded from the versioned JSON DTO.
	FailureDetail string `json:"-"`
	// SubjectDigest is the pre-mutation subject that this Apply request was
	// authorized against, not a post-mutation Prepare snapshot.
	SubjectDigest string `json:"subject_digest"`
	PlanDigest    string `json:"plan_digest"`
	TrustDigest   string `json:"trust_digest"`
	// SemanticDigest is a deprecated compatibility alias of TrustDigest.
	SemanticDigest string                     `json:"semantic_digest"`
	Backend        string                     `json:"backend"`
	Profile        string                     `json:"profile"`
	Roster         RosterDriftV1              `json:"roster"`
	Observations   []ParticipantObservationV1 `json:"observations"`
	Commands       []CommandV1                `json:"commands,omitempty"`
	FollowUps      []RequiredActionV1         `json:"follow_ups,omitempty"`
	Evidence       []EvidenceRefV1            `json:"evidence,omitempty"`
}

func Apply

func Apply(ctx context.Context, request ApplyRequestV1) (ApplyResultV1, error)

Apply revalidates a prior Prepare subject under launch authority, consumes request-local decisions, provisions the participant roster, and runs the existing managed reconciliation crash contract.

type CloseRequestV1

type CloseRequestV1 = InspectRequestV1

func DecodeCloseRequestV1

func DecodeCloseRequestV1(data []byte) (CloseRequestV1, error)

type CloseResultV1

type CloseResultV1 = LifecycleResultV1

func Close

func Close(ctx context.Context, request CloseRequestV1) (CloseResultV1, error)

type CommandV1

type CommandV1 struct {
	Argv       []string          `json:"argv"`
	Cwd        string            `json:"cwd"`
	EnvOverlay map[string]string `json:"env_overlay,omitempty"`
}

type CompatibilityV1

type CompatibilityV1 struct {
	ContractSemver string   `json:"contract_semver"`
	IntentVersions []int    `json:"intent_versions"`
	ResultVersions []int    `json:"result_versions"`
	Features       []string `json:"features"`
}

func Compatibility

func Compatibility() CompatibilityV1

type DecisionChoiceV1

type DecisionChoiceV1 string
const (
	DecisionTrustExactSubject DecisionChoiceV1 = "trust_exact_subject"
	DecisionDeny              DecisionChoiceV1 = "deny"
	DecisionFreshOnce         DecisionChoiceV1 = "fresh_once"
	DecisionAbort             DecisionChoiceV1 = "abort"
	DecisionCloseOld          DecisionChoiceV1 = "close_old"
	DecisionLeaveOld          DecisionChoiceV1 = "leave_old"
	DecisionAcceptDegraded    DecisionChoiceV1 = "accept_degraded"
)

type DecisionV1

type DecisionV1 struct {
	ActionID string           `json:"action_id"`
	Choice   DecisionChoiceV1 `json:"choice"`
}

type EvidenceRefV1

type EvidenceRefV1 struct {
	EvidenceVersion int       `json:"evidence_version"`
	ID              string    `json:"id"`
	Kind            string    `json:"kind"`
	SHA256          string    `json:"sha256"`
	ObservedAt      time.Time `json:"observed_at"`
}

type ExecutionOptionsV1

type ExecutionOptionsV1 struct {
	RequireWake  bool           `json:"require_wake"`
	NoGitignore  bool           `json:"no_gitignore"`
	Wake         WakeOptionsV1  `json:"wake"`
	Integrations IntegrationsV1 `json:"integrations,omitempty"`
}

type FocusRequestV1

type FocusRequestV1 = InspectRequestV1

func DecodeFocusRequestV1

func DecodeFocusRequestV1(data []byte) (FocusRequestV1, error)

type FocusResultV1

type FocusResultV1 = LifecycleResultV1

func Focus

func Focus(ctx context.Context, request FocusRequestV1) (FocusResultV1, error)

type InjectorMode

type InjectorMode string
const (
	InjectorAuto  InjectorMode = "auto"
	InjectorRaw   InjectorMode = "raw"
	InjectorPaste InjectorMode = "paste"
	InjectorNone  InjectorMode = "none"
)

type InjectorOptionsV1

type InjectorOptionsV1 struct {
	Mode InjectorMode `json:"mode"`
	Via  string       `json:"via,omitempty"`
	Args []string     `json:"args,omitempty"`
}

type InspectRequestV1

type InspectRequestV1 struct {
	RequestVersion int      `json:"request_version"`
	Target         TargetV1 `json:"target"`
}

func DecodeInspectRequestV1

func DecodeInspectRequestV1(data []byte) (InspectRequestV1, error)

type InspectResultV1

type InspectResultV1 = LifecycleResultV1

func Inspect

func Inspect(ctx context.Context, request InspectRequestV1) (InspectResultV1, error)

type IntegrationsV1

type IntegrationsV1 struct {
	Symphony *SymphonyOptionsV1 `json:"symphony,omitempty"`
}

type LaunchIntentV1

type LaunchIntentV1 struct {
	IntentVersion int             `json:"intent_version"`
	Participants  []ParticipantV1 `json:"participants"`
}

func DecodeLaunchIntentV1

func DecodeLaunchIntentV1(data []byte) (LaunchIntentV1, error)

func (*LaunchIntentV1) UnmarshalJSON

func (intent *LaunchIntentV1) UnmarshalJSON(data []byte) error

func (LaunchIntentV1) Validate

func (intent LaunchIntentV1) Validate() error

type LifecycleResultV1

type LifecycleResultV1 struct {
	ResultVersion int                        `json:"result_version"`
	Outcome       string                     `json:"outcome"`
	ReasonCode    string                     `json:"reason_code,omitempty"`
	Backend       string                     `json:"backend"`
	Profile       string                     `json:"profile"`
	State         string                     `json:"state"`
	Observations  []ParticipantObservationV1 `json:"observations"`
	Evidence      []EvidenceRefV1            `json:"evidence,omitempty"`
}

type NegotiatedV1

type NegotiatedV1 struct {
	ContractSemver string   `json:"contract_semver"`
	IntentVersion  int      `json:"intent_version"`
	ResultVersion  int      `json:"result_version"`
	Features       []string `json:"features"`
}

func Negotiate

func Negotiate(requirement RequirementV1) (NegotiatedV1, error)

type ParticipantObservationV1

type ParticipantObservationV1 struct {
	Handle       string `json:"handle"`
	Mailbox      string `json:"mailbox"`
	Runnable     bool   `json:"runnable"`
	Conversation string `json:"conversation"`
	Execution    string `json:"execution"`
	Resource     string `json:"resource"`
	ReasonCode   string `json:"reason_code,omitempty"`
}

type ParticipantPreviewV1

type ParticipantPreviewV1 struct {
	Handle         string              `json:"handle"`
	Runnable       bool                `json:"runnable"`
	Provider       string              `json:"provider,omitempty"`
	Command        *CommandV1          `json:"command,omitempty"`
	ResumePolicy   ResumePolicy        `json:"resume_policy,omitempty"`
	Execution      *ExecutionOptionsV1 `json:"execution,omitempty"`
	PlannedOutcome string              `json:"planned_outcome"`
}

type ParticipantV1

type ParticipantV1 struct {
	Handle       string              `json:"handle"`
	Runnable     bool                `json:"runnable"`
	Executable   string              `json:"executable,omitempty"`
	Args         []string            `json:"args,omitempty"`
	Cwd          *WorkingDirectoryV1 `json:"cwd,omitempty"`
	EnvOverlay   map[string]string   `json:"env_overlay,omitempty"`
	ResumePolicy ResumePolicy        `json:"resume_policy,omitempty"`
	Execution    *ExecutionOptionsV1 `json:"execution,omitempty"`
}

type PrepareRequestV1

type PrepareRequestV1 struct {
	RequestVersion int            `json:"request_version"`
	Target         TargetV1       `json:"target"`
	Launcher       string         `json:"launcher"`
	Intent         LaunchIntentV1 `json:"intent"`
}

func DecodePrepareRequestV1

func DecodePrepareRequestV1(data []byte) (PrepareRequestV1, error)

func (PrepareRequestV1) Validate

func (request PrepareRequestV1) Validate() error

type PrepareResultV1

type PrepareResultV1 struct {
	ResultVersion   int                        `json:"result_version"`
	Outcome         string                     `json:"outcome"`
	Reason          string                     `json:"reason,omitempty"`
	SubjectDigest   string                     `json:"subject_digest"`
	PlanDigest      string                     `json:"plan_digest"`
	TrustDigest     string                     `json:"trust_digest"`
	RequiredActions []RequiredActionV1         `json:"required_actions"`
	Preview         PreviewV1                  `json:"preview"`
	Observations    []ParticipantObservationV1 `json:"observations"`
}

func Prepare

func Prepare(ctx context.Context, request PrepareRequestV1) (PrepareResultV1, error)

Prepare validates and compiles caller intent, then inspects the exact target without creating or changing filesystem, trust, lease, or backend state.

type PreviewV1

type PreviewV1 struct {
	Target       TargetV1               `json:"target"`
	Backend      string                 `json:"backend"`
	Profile      string                 `json:"profile"`
	Participants []ParticipantPreviewV1 `json:"participants"`
	Roster       RosterDriftV1          `json:"roster"`
}

type RequiredActionKindV1

type RequiredActionKindV1 string
const (
	RequiredActionTrustConfirmation     RequiredActionKindV1 = "trust_confirmation"
	RequiredActionStaleConversation     RequiredActionKindV1 = "stale_conversation_decision"
	RequiredActionRebindConfirmation    RequiredActionKindV1 = "rebind_confirmation"
	RequiredActionUnsupportedCapability RequiredActionKindV1 = "unsupported_capability_ack"
)

type RequiredActionV1

type RequiredActionV1 struct {
	ActionID         string               `json:"action_id"`
	Kind             RequiredActionKindV1 `json:"kind"`
	Handles          []string             `json:"handles,omitempty"`
	Resources        []string             `json:"resources,omitempty"`
	AllowedDecisions []DecisionChoiceV1   `json:"allowed_decisions"`
	ReasonCode       string               `json:"reason_code"`
}

type RequirementV1

type RequirementV1 struct {
	ContractSemver string   `json:"contract_semver"`
	IntentVersion  int      `json:"intent_version"`
	ResultVersion  int      `json:"result_version"`
	Features       []string `json:"features"`
}

type ResumePolicy

type ResumePolicy string
const (
	ResumePolicyResume   ResumePolicy = "resume"
	ResumePolicyFresh    ResumePolicy = "fresh"
	ResumePolicyDisabled ResumePolicy = "disabled"
)

type RosterDriftV1

type RosterDriftV1 struct {
	Desired []string `json:"desired"`
	Present []string `json:"present"`
	Missing []string `json:"missing"`
	Extra   []string `json:"extra"`
}

type SymphonyEvent

type SymphonyEvent string
const (
	SymphonyAfterCreate  SymphonyEvent = "after_create"
	SymphonyBeforeRun    SymphonyEvent = "before_run"
	SymphonyAfterRun     SymphonyEvent = "after_run"
	SymphonyBeforeRemove SymphonyEvent = "before_remove"
)

type SymphonyOptionsV1

type SymphonyOptionsV1 struct {
	Events       []SymphonyEvent `json:"events"`
	WorkspaceKey string          `json:"workspace_key,omitempty"`
}

type TargetV1

type TargetV1 struct {
	ProjectRoot string `json:"project_root"`
	SessionRoot string `json:"session_root"`
	Session     string `json:"session"`
}

type WakeOptionsV1

type WakeOptionsV1 struct {
	Mode        WakePolicy         `json:"mode"`
	AuditReason string             `json:"audit_reason,omitempty"`
	Injector    *InjectorOptionsV1 `json:"injector,omitempty"`
}

type WakePolicy

type WakePolicy string
const (
	WakeEnabled  WakePolicy = "enabled"
	WakeDisabled WakePolicy = "disabled"
)

type WorkingDirectoryKind

type WorkingDirectoryKind string
const (
	WorkingDirectoryRelative WorkingDirectoryKind = "relative"
	WorkingDirectoryAbsolute WorkingDirectoryKind = "absolute"
)

type WorkingDirectoryV1

type WorkingDirectoryV1 struct {
	Kind WorkingDirectoryKind `json:"kind"`
	Path string               `json:"path"`
}

Jump to

Keyboard shortcuts

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