contract

package
v1.2.16 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const SchemaVersion = "1.0"

SchemaVersion is the JSON output schema version every envelope carries.

Variables

View Source
var Codes = map[string]CodeSpec{
	"E_INTEGRITY":             {Exit: 1, Retryable: false, Core: true},
	"E_IO":                    {Exit: 1, Retryable: false, Core: true},
	"E_UNKNOWN":               {Exit: 1, Retryable: false, Core: true},
	"E_USAGE":                 {Exit: 2, Retryable: false, Core: true},
	"E_VALIDATION":            {Exit: 2, Retryable: false, Core: true},
	"E_NOT_FOUND":             {Exit: 3, Retryable: false, Core: true},
	"E_AUTH":                  {Exit: 4, Retryable: false, Core: true},
	"E_CONFIG":                {Exit: 4, Retryable: false, Core: true},
	"E_FORBIDDEN":             {Exit: 4, Retryable: false, Core: true},
	"E_CONFIRMATION_REQUIRED": {Exit: 5, Retryable: false, Core: true},
	"E_CONFLICT":              {Exit: 6, Retryable: false, Core: true},
	"E_NETWORK":               {Exit: 7, Retryable: true, Core: true},
	"E_RATE_LIMITED":          {Exit: 7, Retryable: true, Core: true},
	"E_SERVER":                {Exit: 7, Retryable: true, Core: true},
	"E_TIMEOUT":               {Exit: 8, Retryable: true, Core: true},
	"E_INTERRUPTED":           {Exit: 130, Retryable: true, Core: true},
	"E_CANCELLED":             {Exit: 5, Retryable: false, Core: false},
}

Codes is the frozen canonical error-code table (core + this tool's registered extensions). It is the binding source for code -> exit -> retryable.

View Source
var ErrorEnvelopeKeys = []string{"ok", "schema_version", "error", "meta"}
View Source
var ErrorObjectKeys = []string{"code", "message", "details", "retryable"}
View Source
var MetaOptionalKeys = []string{"notices"}
View Source
var MetaRequiredKeys = []string{"duration_ms"}
View Source
var SuccessEnvelopeKeys = []string{"ok", "schema_version", "data", "meta"}

Canonical envelope key sets (snake_case).

Functions

func ExitFor

func ExitFor(code string) int

ExitFor returns the canonical process exit code for an E_* code (1 if unknown).

func Retryable

func Retryable(code string) bool

Retryable reports whether an agent may back off and retry an E_* code.

Types

type CodeSpec

type CodeSpec struct {
	Exit      int
	Retryable bool
	Core      bool
}

CodeSpec is the canonical exit code + retryability for an E_* error code.

Jump to

Keyboard shortcuts

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