domain

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package domain contains the public, transport-neutral M1 facts.

Index

Constants

View Source
const MaxInteger int64 = 9007199254740991
View Source
const TimeFormat = "2006-01-02T15:04:05.000Z"
View Source
const Version = "bridge-m1-1"

Variables

View Source
var Codes = map[string]int{"FORBIDDEN": -32001, "NOT_FOUND": -32002, "STALE_REVISION": -32003, "LEASE_FENCED": -32004, "INVALID_STATE": -32005, "GATE_CLOSED": -32006, "POLICY_DENIED": -32007, "IDEMPOTENCY_CONFLICT": -32008, "REINITIALIZE_REQUIRED": -32009, "INVALID_CURSOR": -32010, "RECEIPT_NOT_FOUND": -32011, "RECEIPT_UNAVAILABLE": -32012, "AUTHORITY_MISMATCH": -32013, "RESOURCE_LIMIT": -32014, "UNAVAILABLE": -32015, "PARSE_ERROR": -32700, "INVALID_REQUEST": -32600, "METHOD_NOT_FOUND": -32601, "INVALID_PARAMS": -32602, "INTERNAL_ERROR": -32603, "UNAUTHENTICATED": 401}

Functions

func Contains

func Contains(values []string, v string) bool

func Decode

func Decode[T any](v any) (T, error)

func N

func N(o Object, key string) int64

func NewID

func NewID(prefix string) string

func ParseTime

func ParseTime(s string) time.Time

func Ptr

func Ptr[T any](v T) *T

func S

func S(o Object, key string) string

func Stamp

func Stamp(t time.Time) string

func String

func String(v *string) string

Types

type Actor

type Actor struct {
	Kind             string   `json:"kind"`
	PrincipalID      *string  `json:"principal_id"`
	AgentID          *string  `json:"agent_id"`
	AuthorizationIDs []string `json:"authorization_ids"`
}

type Assignment

type Assignment struct {
	AssignmentID   string  `json:"assignment_id"`
	TaskID         string  `json:"task_id"`
	PrincipalID    string  `json:"principal_id"`
	AgentID        string  `json:"agent_id"`
	ClaimGrantID   string  `json:"claim_grant_id"`
	State          string  `json:"state"`
	Generation     int64   `json:"generation"`
	LeaseExpiresAt string  `json:"lease_expires_at"`
	CreatedAt      string  `json:"created_at"`
	EndedAt        *string `json:"ended_at"`
	EndReason      *string `json:"end_reason"`
	EffectiveAt    *string `json:"effective_at"`
	BindingID      string  `json:"binding_id"`
}

type Audit

type Audit struct {
	Action    string  `json:"action"`
	RequestID *string `json:"request_id"`
	Reason    *string `json:"reason"`
}

type CommandResult

type CommandResult struct {
	Task       Task     `json:"task"`
	Records    []Record `json:"records"`
	CommitID   string   `json:"commit_id"`
	LeaseToken string   `json:"lease_token,omitempty"`
}

type CommitBatch

type CommitBatch struct {
	CommitID    string  `json:"commit_id"`
	CommittedAt string  `json:"committed_at"`
	Actor       Actor   `json:"actor"`
	Audit       Audit   `json:"audit"`
	Events      []Event `json:"events"`
}

type Contract

type Contract struct {
	Profile               string      `json:"profile"`
	OwnerPrincipalID      string      `json:"owner_principal_id"`
	Goal                  string      `json:"goal"`
	Constraints           []string    `json:"constraints"`
	InputRefs             []Object    `json:"input_refs"`
	ExpectedOutput        string      `json:"expected_output"`
	AcceptanceRefs        []Object    `json:"acceptance_refs"`
	ContextRefs           []Object    `json:"context_refs"`
	EligibleAgentIDs      []string    `json:"eligible_agent_ids"`
	AcceptancePrincipalID string      `json:"acceptance_principal_id"`
	RecoveryPolicy        string      `json:"recovery_policy"`
	AllowRework           bool        `json:"allow_rework"`
	LeasePolicy           LeasePolicy `json:"lease_policy"`
	Extensions            Object      `json:"extensions"`
}

type Decision

type Decision struct {
	DecisionID   string   `json:"decision_id"`
	TaskID       string   `json:"task_id"`
	SubmissionID string   `json:"submission_id"`
	Outcome      string   `json:"outcome"`
	PrincipalID  string   `json:"principal_id"`
	Reason       string   `json:"reason"`
	EvidenceRefs []Object `json:"evidence_refs"`
	DecidedAt    string   `json:"decided_at"`
}

type Error

type Error struct {
	Code    int       `json:"code"`
	Message string    `json:"message"`
	Data    ErrorData `json:"data"`
}

func E

func E(kind string) *Error

func Stale

func Stale(revision int64) *Error

func (*Error) Error

func (e *Error) Error() string

type ErrorData

type ErrorData struct {
	Kind    string `json:"kind"`
	Retry   string `json:"retry"`
	Details Object `json:"details,omitempty"`
}

type Event

type Event struct {
	EventID      string `json:"event_id"`
	Type         string `json:"type"`
	TaskID       string `json:"task_id"`
	TaskRevision int64  `json:"task_revision"`
	RecordType   string `json:"record_type"`
	Record       Object `json:"record"`
}

type Grant

type Grant struct {
	GrantID             string   `json:"grant_id"`
	TaskID              string   `json:"task_id"`
	OwnerPrincipalID    string   `json:"owner_principal_id"`
	SubjectPrincipalID  string   `json:"subject_principal_id"`
	AgentID             *string  `json:"agent_id"`
	Actions             []string `json:"actions"`
	NotBefore           string   `json:"not_before"`
	ExpiresAt           string   `json:"expires_at"`
	IssuedByPrincipalID string   `json:"issued_by_principal_id"`
	RevokedAt           *string  `json:"revoked_at"`
}

type LeasePolicy

type LeasePolicy struct {
	MinSeconds int64 `json:"min_seconds"`
	MaxSeconds int64 `json:"max_seconds"`
}

type Object

type Object map[string]any

func O

func O(o Object, key string) Object

func ToObject

func ToObject(v any) Object

type Record

type Record struct {
	RecordType string `json:"record_type"`
	Record     Object `json:"record"`
}

func RecordOf

func RecordOf(kind string, value any) Record

func (Record) AsTask

func (r Record) AsTask() (Task, error)

func (Record) ID

func (r Record) ID() string

func (Record) TaskID

func (r Record) TaskID() string

type Relation

type Relation struct {
	RelationID   string `json:"relation_id"`
	TaskID       string `json:"task_id"`
	Kind         string `json:"kind"`
	ParentTaskID string `json:"parent_task_id"`
	CreatedAt    string `json:"created_at"`
}

type Report

type Report struct {
	ReportID     string   `json:"report_id"`
	TaskID       string   `json:"task_id"`
	RunID        string   `json:"run_id"`
	AssignmentID string   `json:"assignment_id"`
	Message      string   `json:"message"`
	EvidenceRefs []Object `json:"evidence_refs"`
	Extensions   Object   `json:"extensions"`
	ReportedAt   string   `json:"reported_at"`
}

type Run

type Run struct {
	RunID        string  `json:"run_id"`
	TaskID       string  `json:"task_id"`
	AssignmentID string  `json:"assignment_id"`
	State        string  `json:"state"`
	StartedAt    string  `json:"started_at"`
	EndedAt      *string `json:"ended_at"`
	EndReason    *string `json:"end_reason"`
}

type Submission

type Submission struct {
	SubmissionID   string   `json:"submission_id"`
	TaskID         string   `json:"task_id"`
	RunID          string   `json:"run_id"`
	AssignmentID   string   `json:"assignment_id"`
	ContentVersion int64    `json:"content_version"`
	Summary        string   `json:"summary"`
	ArtifactRefs   []Object `json:"artifact_refs"`
	EvidenceRefs   []Object `json:"evidence_refs"`
	Extensions     Object   `json:"extensions"`
	SubmittedAt    string   `json:"submitted_at"`
}

type Task

type Task struct {
	TaskID              string   `json:"task_id"`
	State               string   `json:"state"`
	Revision            int64    `json:"revision"`
	Generation          int64    `json:"generation"`
	ContentVersion      *int64   `json:"content_version"`
	ContractDigest      *string  `json:"contract_digest"`
	Contract            Contract `json:"contract"`
	CurrentAssignmentID *string  `json:"current_assignment_id"`
	PendingSubmissionID *string  `json:"pending_submission_id"`
	RecoveryGate        string   `json:"recovery_gate"`
	CreatedAt           string   `json:"created_at"`
	UpdatedAt           string   `json:"updated_at"`
}

Jump to

Keyboard shortcuts

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