runtime

package
v0.22.2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package runtime adapts Callee agents to Norma Runtime ACP processes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeAgent added in v0.11.0

func NormalizeAgent(r resource.Resource) (agentconfig.Config, error)

NormalizeAgent returns the Norma Runtime session configuration for a Role.

Types

type AgentSession added in v0.11.0

type AgentSession interface {
	Prepare(ctx context.Context) error
	Turn(ctx context.Context, prompt string) (TurnResult, error)
}

AgentSession executes turns for one concrete Role visit.

type NormaFactory

type NormaFactory struct {
	Stderr            io.Writer
	PermissionHandler acpagent.PermissionHandler
	PermissionBinder  func(acp.SessionId, resource.Resource)
}

NormaFactory builds ACP agents through Norma Runtime.

func (NormaFactory) Start added in v0.11.0

func (f NormaFactory) Start(ctx context.Context, provider Provider) (ProviderProcess, error)

Start initializes one reusable Norma-backed provider process.

type ProcessFactory added in v0.11.0

type ProcessFactory interface {
	Start(ctx context.Context, provider Provider) (ProviderProcess, error)
}

ProcessFactory starts one reusable provider transport process.

type Provider

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

Provider identifies one reusable ACP process.

func ProviderForAgent added in v0.11.0

func ProviderForAgent(r resource.Resource) (Provider, error)

ProviderForAgent returns the reusable ACP process configuration for a Role.

func (Provider) Key

func (p Provider) Key() string

Key returns the stable identity of the provider process.

func (Provider) Type

func (p Provider) Type() string

Type returns the public Callee runtime type for the provider.

type ProviderProcess added in v0.11.0

type ProviderProcess interface {
	NewSession(ctx context.Context, role resource.Resource, effectiveID string) (AgentSession, error)
	Close() error
}

ProviderProcess creates fresh Role visit sessions on one provider process.

type SessionConfiguration added in v0.16.0

type SessionConfiguration struct {
	Model     string
	Reasoning string
}

SessionConfiguration is the model and reasoning selection known for one Role session. Provider-reported values supersede the Role configuration.

type TokenUsage added in v0.16.0

type TokenUsage struct {
	InputTokens      int64
	OutputTokens     int64
	TotalTokens      int64
	CachedReadTokens int64
}

TokenUsage is the provider-reported token usage for one completed turn.

type TokenUsageStatus added in v0.16.0

type TokenUsageStatus string

TokenUsageStatus describes how completely a provider reported usage.

const (
	// TokenUsageComplete means every attempted turn reported usage.
	TokenUsageComplete TokenUsageStatus = "complete"
	// TokenUsagePartial means only some attempted turns reported usage.
	TokenUsagePartial TokenUsageStatus = "partial"
	// TokenUsageUnavailable means no attempted turn reported usage.
	TokenUsageUnavailable TokenUsageStatus = "unavailable"
)

type TurnResult added in v0.16.0

type TurnResult struct {
	Content string
	Usage   *TokenUsage
}

TurnResult is the visible output and optional token usage for one provider turn.

type UsageMetrics added in v0.16.0

type UsageMetrics struct {
	TokenUsage

	TurnsAttempted int
	TurnsReported  int
}

UsageMetrics aggregates provider-reported usage across attempted turns.

func (*UsageMetrics) Add added in v0.16.0

func (m *UsageMetrics) Add(other UsageMetrics)

Add merges another usage aggregate into this one.

func (*UsageMetrics) AddTurn added in v0.16.0

func (m *UsageMetrics) AddTurn(usage *TokenUsage)

AddTurn records one attempted turn and its optional provider usage.

func (UsageMetrics) Status added in v0.16.0

func (m UsageMetrics) Status() TokenUsageStatus

Status reports whether usage is complete, partial, or unavailable.

Jump to

Keyboard shortcuts

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