Documentation
¶
Overview ¶
Package handlers implements the combined-patterns example's two tool handlers. The point of this example is showing that the analytics- widget half and the approval-flow half compose on one App — the rollout_health widget surfaces an insight, then propose_rollout_action proposes a follow-up the user approves.
Replace the body of Snapshot.For and the action-store side of ApprovalProposer with calls into your real telemetry + your real flag-management API; the typed contracts are the integration surface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApprovalProposer ¶
ApprovalProposer is the propose_rollout_action handler bound to the process-wide Tasks engine. It mirrors the approval-flows template's CreateRequestApproval pattern: the synchronous side builds the prompt + creates the task; the background goroutine pauses at RequireInput until the user replies through the bridge.
Swap the body of `runApproval` for the real action-store integration (a flag-management API call, an audit-log entry) when wiring this to a production system.
func NewApprovalProposer ¶
func NewApprovalProposer(engine *tasks.Engine) *ApprovalProposer
NewApprovalProposer constructs a proposer over engine. A nil engine is allowed; the handler degrades to a synchronous "this host did not negotiate Tasks" response (RFC §7.5, capability degradation).
func (*ApprovalProposer) Handler ¶
func (a *ApprovalProposer) Handler(ctx context.Context, in contracts.ProposeRolloutActionInput) (tool.Result[contracts.ProposeRolloutActionOutput], error)
Handler is the propose_rollout_action tool handler.
type Snapshot ¶
type Snapshot struct{}
Snapshot is a synthetic rollout health source. A real deployment would swap this for a telemetry client; the typed contract is unchanged.
func NewSnapshot ¶
func NewSnapshot() *Snapshot
NewSnapshot returns a Snapshot whose For() returns synthetic but realistic data — different flags produce different health profiles so the demo shows the OK / warn / critical tones without configuration.
func (*Snapshot) For ¶
func (s *Snapshot) For(flag string, windowMinutes int) (value float64, tone contracts.HealthTone, trend []float64, suggestion string)
For computes the synthetic health snapshot for a flag and look-back window. The deterministic seed (the flag name's rune sum) means a given flag has a stable health profile across calls — predictable demos, deterministic tests.