completion

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanTransition

func CanTransition(from, to State) bool

func IsStableKey

func IsStableKey(value string) bool

IsStableKey reports whether value can safely participate in a durable correctness namespace. Exact adapters use it for protocol-native affinity values before they are allowed to influence routing or downgrade behavior.

func ValidateTransition

func ValidateTransition(from, to State) error

Types

type Assignment

type Assignment struct {
	CallerID         string            `json:"caller_id"`
	WorkspaceKey     string            `json:"workspace_key,omitempty"`
	TaskID           string            `json:"task_id"`
	IdempotencyKey   string            `json:"idempotency_key"`
	LeaseOwner       string            `json:"lease_owner"`
	CapabilityTier   CapabilityTier    `json:"capability_tier"`
	HarnessID        string            `json:"harness_id,omitempty"`
	HarnessVersion   string            `json:"harness_version,omitempty"`
	HarnessSessionID string            `json:"harness_session_id,omitempty"`
	Root             string            `json:"root,omitempty"`
	ExecAllowed      bool              `json:"exec_allowed,omitempty"`
	Adapter          *adapter.Profile  `json:"adapter,omitempty"`
	Request          canonical.Request `json:"request"`
}

func (Assignment) SessionKey

func (assignment Assignment) SessionKey() string

type CapabilityTier

type CapabilityTier string

CapabilityTier controls which caller-side capabilities a request may use. A request never acquires a more capable tier by heuristic inspection.

const (
	TierChat        CapabilityTier = "chat"
	TierRemoteTools CapabilityTier = "remote_tools"
	TierWorkspace   CapabilityTier = "workspace"
)

func ParseCapabilityTier

func ParseCapabilityTier(value string) (CapabilityTier, error)

type Event

type Event struct {
	ID        string     `json:"id,omitempty"`
	Type      EventType  `json:"type"`
	WorkerID  string     `json:"worker_id,omitempty"`
	Text      string     `json:"text,omitempty"`
	ToolCalls []ToolCall `json:"tool_calls,omitempty"`
	ErrorCode string     `json:"error_code,omitempty"`
	Error     string     `json:"error,omitempty"`
}

func (Event) EndsResponse

func (event Event) EndsResponse() bool

type EventType

type EventType string
const (
	EventAccepted      EventType = "accepted"
	EventProgress      EventType = "progress"
	EventFinal         EventType = "final"
	EventClarification EventType = "clarification"
	EventToolCalls     EventType = "tool_calls"
	EventRejected      EventType = "rejected"
	EventExpired       EventType = "expired"
	EventFailed        EventType = "failed"
	EventUnavailable   EventType = "unavailable"
)

type RoutingIdentity

type RoutingIdentity struct {
	CallerID       string
	WorkspaceKey   string
	TaskID         string
	IdempotencyKey string
	HarnessID      string
	HarnessVersion string
	// HarnessSessionID is a versioned adapter-provided conversation affinity.
	// It is not a task ID: one harness session may contain many terminal Human
	// tasks, while an awaiting-caller clarification reuses the one open task.
	HarnessSessionID string
	Root             string
	ExecAllowed      bool
}

RoutingIdentity is the correctness namespace for a completion request. CallerID comes from authentication; the caller shim supplies the other stable identifiers for tool-capable tiers on every completion request.

func (RoutingIdentity) Namespace

func (id RoutingIdentity) Namespace() string

func (RoutingIdentity) Validate

func (id RoutingIdentity) Validate(tier CapabilityTier) error

type State

type State string
const (
	StateAdmitted        State = "admitted"
	StateLeased          State = "leased"
	StateAwaitingHuman   State = "awaiting_human"
	StateResponded       State = "responded"
	StateAwaitingCaller  State = "awaiting_caller"
	StateToolsDispatched State = "tools_dispatched"
	StateAwaitingResults State = "awaiting_results"
	StateReconciled      State = "reconciled"
	StateCompleted       State = "completed"
	StateCanceled        State = "canceled"
	StateRejected        State = "rejected"
	StateExpired         State = "expired"
	StateFailed          State = "failed"
)

func (State) IsTerminal

func (state State) IsTerminal() bool

func (State) Valid

func (state State) Valid() bool

type ToolCall

type ToolCall struct {
	ID        string         `json:"id"`
	Namespace string         `json:"namespace,omitempty"`
	Name      string         `json:"name"`
	Input     map[string]any `json:"input,omitempty"`
	TextInput *string        `json:"text_input,omitempty"`
}

func (ToolCall) QualifiedName

func (call ToolCall) QualifiedName() string

Directories

Path Synopsis
Package adapter contains explicit, versioned harness capability profiles.
Package adapter contains explicit, versioned harness capability profiles.
Package canonical defines the dialect-neutral model used by completion APIs.
Package canonical defines the dialect-neutral model used by completion APIs.
Package dialect defines the pure wire-codec boundary for model APIs.
Package dialect defines the pure wire-codec boundary for model APIs.
anthropic
Package anthropic implements the Anthropic Messages wire dialect.
Package anthropic implements the Anthropic Messages wire dialect.
openai
Package openai implements the OpenAI Chat Completions wire dialect.
Package openai implements the OpenAI Chat Completions wire dialect.
responses
Package responses implements the OpenAI Responses API wire dialect.
Package responses implements the OpenAI Responses API wire dialect.
Package gateway implements the synchronous, model-compatible completion gateway.
Package gateway implements the synchronous, model-compatible completion gateway.
Package hub provides the in-process worker queue used by gateway.
Package hub provides the in-process worker queue used by gateway.
Package safety implements gateway-side lexical defense and warning labels.
Package safety implements gateway-side lexical defense and warning labels.

Jump to

Keyboard shortcuts

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