elicitation

package
v0.1.13 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NoopAwaiterFactory

func NoopAwaiterFactory() func() Awaiter

NoopAwaiterFactory returns a factory that produces noop awaiters.

func NormalizeAction

func NormalizeAction(a string) string

NormalizeAction is kept for backward compatibility; use action.Normalize.

func PayloadKeys

func PayloadKeys(payload map[string]interface{}) []string

func Prompt

Types

type Awaiter

type Awaiter interface {
	AwaitElicitation(ctx context.Context, p *execution.Elicitation) (*execution.ElicitResult, error)
}

type Awaiters

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

func NewAwaiters

func NewAwaiters(newAwaiter func() Awaiter) *Awaiters

func (*Awaiters) Ensure

func (a *Awaiters) Ensure(key string) Awaiter

func (*Awaiters) Lookup

func (a *Awaiters) Lookup(key string) (Awaiter, bool)

func (*Awaiters) Remove

func (a *Awaiters) Remove(key string)

type DefaultRefiner

type DefaultRefiner struct{}

DefaultRefiner adapts the preset refiner to the local Refiner interface.

func (DefaultRefiner) RefineRequestedSchema

func (DefaultRefiner) RefineRequestedSchema(rs *schema.ElicitRequestParamsRequestedSchema)

type Refiner

type Refiner interface {
	RefineRequestedSchema(rs *schema.ElicitRequestParamsRequestedSchema)
}

type Service

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

func New

func New(client apiconv.Client, refiner Refiner, router elicrouter.ElicitationRouter, awaiterFactory func() Awaiter) *Service

New constructs the elicitation service with all collaborators. The refiner is defaulted to a workspace preset implementation when nil. Router and awaiter factory must be supplied by the caller to ensure proper wiring.

func (*Service) AddUserResponseMessage

func (s *Service) AddUserResponseMessage(ctx context.Context, turn *runtimerequestctx.TurnMeta, elicitationID string, payload map[string]interface{}) error

func (*Service) Elicit

func (s *Service) Elicit(ctx context.Context, turn *runtimerequestctx.TurnMeta, role string, req *execution.Elicitation) (string, string, map[string]interface{}, error)

Elicit records a new elicitation control message and waits for a resolution via router/UI. Returns message id, normalized status (accepted/rejected/cancel) and optional payload.

func (*Service) HandleCallback

func (s *Service) HandleCallback(ctx context.Context, convID, elicitationID, action string, payload map[string]interface{}) error

HandleCallback processes an elicitation decision end-to-end: - normalizes the action - updates message status - stores payload (when accepted) - notifies any registered router waiter

func (*Service) Record

Record persists an elicitation control message and returns its message id.

func (*Service) RefineRequestedSchema

func (s *Service) RefineRequestedSchema(rs *schema.ElicitRequestParamsRequestedSchema)

func (*Service) Resolve

func (s *Service) Resolve(ctx context.Context, convID, elicitationID, action string, payload map[string]interface{}, reason string) error

Resolve processes an elicitation decision end-to-end: - normalizes the action - updates message status - stores payload (when accepted) - notifies any registered router waiter

func (*Service) SetStreamPublisher

func (s *Service) SetStreamPublisher(p streaming.Publisher)

SetStreamPublisher wires a streaming publisher so the service can emit canonical elicitation events to the SSE bus.

func (*Service) StoreCancelReason added in v0.1.8

func (s *Service) StoreCancelReason(ctx context.Context, convID, elicitationID, reason string) error

StoreCancelReason persists a user-cancel reason as a user message so the agent can react.

func (*Service) StoreDeclineReason

func (s *Service) StoreDeclineReason(ctx context.Context, convID, elicitationID, reason string) error

StoreDeclineReason persists a user-decline reason as a user message so the agent can react.

func (*Service) StorePayload

func (s *Service) StorePayload(ctx context.Context, convID, elicitationID string, payload map[string]interface{}) error

func (*Service) UpdateStatus

func (s *Service) UpdateStatus(ctx context.Context, convID, elicitationID, action string) error

func (*Service) Wait

func (s *Service) Wait(ctx context.Context, convID, elicitationID string) (string, map[string]interface{}, error)

Wait blocks until an elicitation is accepted/declined via router/UI or optional local awaiter. On accept, it best-effort persists payload and status. It returns (accepted, payload, error).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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