interaction

package
v0.1.0-preview.7 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package interaction owns UI-neutral request, response, and broker SPIs.

@import { NamedInterface } from "github.com/spice-framework/spice/annotation/modulith" @NamedInterface("interaction")

Index

Constants

View Source
const MaximumPayloadBytes = 512 << 10

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

type Broker interface {
	Request(context.Context, Scope, Request) (Response, error)
}

Broker is the UI-neutral user-interaction port injected into the engine. Implementations must be concurrent-safe and cooperatively honor context.

type ID

type ID string

ID identifies one interaction lifecycle.

type Request

type Request struct {
	// contains filtered or unexported fields
}

Request asks an injected broker for typed user input.

func NewRequest

func NewRequest(id ID, kind, prompt string, schema json.RawMessage) (Request, error)

NewRequest validates and defensively copies one interaction request.

func (Request) Clone

func (request Request) Clone() Request

func (Request) ID

func (request Request) ID() ID

func (Request) Kind

func (request Request) Kind() string

func (Request) Prompt

func (request Request) Prompt() string

func (Request) Schema

func (request Request) Schema() json.RawMessage

func (Request) Validate

func (request Request) Validate() error

type Requester

type Requester interface {
	Request(context.Context, Request) (Response, error)
}

Requester is a run-bound interaction lifecycle capability. Unlike Broker it accepts no caller-supplied Scope; the owner fixes run authority at binding.

type Response

type Response struct {
	// contains filtered or unexported fields
}

Response completes one interaction with structured user input.

func NewResponse

func NewResponse(id ID, value json.RawMessage) (Response, error)

NewResponse validates and defensively copies one response.

func (Response) Clone

func (response Response) Clone() Response

func (Response) ID

func (response Response) ID() ID

func (Response) Validate

func (response Response) Validate() error

func (Response) Value

func (response Response) Value() json.RawMessage

type Scope

type Scope struct {
	// contains filtered or unexported fields
}

Scope identifies the immutable run authority that owns an interaction. Brokers use it to route pending requests without depending on agent internals.

func NewScope

func NewScope(runID string) (Scope, error)

NewScope constructs a validated interaction scope.

func (Scope) RunID

func (scope Scope) RunID() string

RunID returns the stable run that owns the interaction.

func (Scope) Validate

func (scope Scope) Validate() error

Validate rejects a zero or malformed scope.

type UnavailableBroker

type UnavailableBroker struct{}

UnavailableBroker is the fail-closed fallback when no client owns prompts.

func (UnavailableBroker) Request

type UnavailableRequester

type UnavailableRequester struct{}

UnavailableRequester is a fail-closed capability for direct dispatcher tests and embeddings that deliberately provide no run interaction lifecycle.

func (UnavailableRequester) Request

Request always fails without observing request payload data.

Jump to

Keyboard shortcuts

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