agentout

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package agentout renders machine-readable envelopes for AI agents.

Every command that supports --json emits exactly one Envelope on stdout. The envelope is the stable contract between the CLI and any agentic consumer (Claude Code, Codex, gemini-cli, …): the schema field is versioned independently of the CLI version, and fields are only ever added, never renamed or removed, within the same schema version.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Emit

func Emit(w io.Writer, command string, data any) error

Emit writes a success envelope for command with the given data payload.

func EmitError

func EmitError(w io.Writer, command, code, message, hint string) error

EmitError writes a failure envelope. Callers still control the process exit code; this only shapes stdout.

Types

type Envelope

type Envelope struct {
	Schema     string `json:"schema"`      // "multiversa.<command>/v1"
	Command    string `json:"command"`     // command that produced this
	CLIVersion string `json:"cli_version"` // CLI semver at emit time
	OK         bool   `json:"ok"`
	Data       any    `json:"data,omitempty"`
	Error      *Error `json:"error,omitempty"`
}

Envelope is the single top-level JSON shape emitted by --json commands.

type Error

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Hint    string `json:"hint,omitempty"`
}

Error carries a machine-matchable code plus human context. Hint tells the agent what to try next — it is advisory, never an instruction to execute without user approval ("La IA propone, tú decides").

Jump to

Keyboard shortcuts

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