Documentation
¶
Index ¶
- func NoopAwaiterFactory() func() Awaiter
- func NormalizeAction(a string) string
- func PayloadKeys(payload map[string]interface{}) []string
- func Prompt(ctx context.Context, w io.Writer, r io.Reader, p *plan.Elicitation) (*plan.ElicitResult, error)
- type Awaiter
- type Awaiters
- type DefaultRefiner
- type Refiner
- type Service
- func (s *Service) AddUserResponseMessage(ctx context.Context, turn *runtimerequestctx.TurnMeta, elicitationID string, ...) error
- func (s *Service) Elicit(ctx context.Context, turn *runtimerequestctx.TurnMeta, role string, ...) (string, string, map[string]interface{}, error)
- func (s *Service) HandleCallback(ctx context.Context, convID, elicitationID, action string, ...) error
- func (s *Service) Record(ctx context.Context, turn *runtimerequestctx.TurnMeta, role string, ...) (*apiconv.MutableMessage, error)
- func (s *Service) RefineRequestedSchema(rs *schema.ElicitRequestParamsRequestedSchema)
- func (s *Service) Resolve(ctx context.Context, convID, elicitationID, action string, ...) error
- func (s *Service) SetStreamPublisher(p streaming.Publisher)
- func (s *Service) StoreCancelReason(ctx context.Context, convID, elicitationID, reason string) error
- func (s *Service) StoreDeclineReason(ctx context.Context, convID, elicitationID, reason string) error
- func (s *Service) StorePayload(ctx context.Context, convID, elicitationID string, ...) error
- func (s *Service) UpdateStatus(ctx context.Context, convID, elicitationID, action string) error
- func (s *Service) Wait(ctx context.Context, convID, elicitationID string) (string, map[string]interface{}, error)
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 ¶
NormalizeAction is kept for backward compatibility; use action.Normalize.
func PayloadKeys ¶
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 ¶
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 (*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 ¶
func (s *Service) Record(ctx context.Context, turn *runtimerequestctx.TurnMeta, role string, elic *execution.Elicitation) (*apiconv.MutableMessage, error)
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 ¶
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 (*Service) UpdateStatus ¶
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).