Documentation
¶
Overview ¶
Package tasklifecycle decorates a turn executor with an authoritative task's claim and terminal transitions. It is transport-neutral; Aether is one host.
Index ¶
- Constants
- func ExcludeLocal(_ protocol.MessageAddress, message protocol.ChatMessage) bool
- func IsLocal(message protocol.ChatMessage) bool
- func IsManagedTask(ctx context.Context) bool
- func MarkLocal(message protocol.ChatMessage) protocol.ChatMessage
- func WithManagedTask(ctx context.Context) context.Context
- func Wrap(inner runtime.TurnExecutor, tasks TaskOps) runtime.TurnExecutor
- func WrapWhen(inner runtime.TurnExecutor, tasks TaskOps, predicate Predicate) runtime.TurnExecutor
- type Executor
- type Predicate
- type TaskOps
- type TerminalAcknowledger
Constants ¶
const LocalTaskMetaKey = "local_task"
LocalTaskMetaKey marks a turn whose task id the HARNESS minted for its own correlation (cancel, approvals) rather than receiving from an authoritative task host.
The distinction matters wherever a host has a real task API: claiming a task the host never issued fails, and failing the claim fails the turn. A locally minted id is a correlation handle, not a claim on anything, so a host wraps with ExcludeLocal and leaves those turns alone.
Variables ¶
This section is empty.
Functions ¶
func ExcludeLocal ¶
func ExcludeLocal(_ protocol.MessageAddress, message protocol.ChatMessage) bool
ExcludeLocal is the Predicate for hosts with an authoritative task API: manage every turn except those carrying a locally minted id.
func IsLocal ¶
func IsLocal(message protocol.ChatMessage) bool
IsLocal reports whether this turn's task id was minted locally.
func IsManagedTask ¶
IsManagedTask reports whether the turn is inside an authoritative external task lifecycle.
func MarkLocal ¶
func MarkLocal(message protocol.ChatMessage) protocol.ChatMessage
MarkLocal flags a message whose task id was minted locally.
func WithManagedTask ¶
WithManagedTask marks a turn whose claim and terminal state are owned by an external TaskOps implementation. Durable turn executors use this marker to leave a terminal intent recoverable until Aether (or another task host) has acknowledged it.
func Wrap ¶
func Wrap(inner runtime.TurnExecutor, tasks TaskOps) runtime.TurnExecutor
func WrapWhen ¶
func WrapWhen(inner runtime.TurnExecutor, tasks TaskOps, predicate Predicate) runtime.TurnExecutor
Types ¶
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
func (Executor) Run ¶
func (e Executor) Run(ctx context.Context, addr protocol.MessageAddress, user protocol.ChatMessage) (protocol.ChatMessage, error)
type Predicate ¶
type Predicate func(addr protocol.MessageAddress, user protocol.ChatMessage) bool
Predicate selects turns backed by a real task. Nil selects every non-empty task ID. Hosts that also mint local correlation IDs can restrict lifecycle operations to their trusted task envelope.
type TerminalAcknowledger ¶
type TerminalAcknowledger interface {
AcknowledgeTaskTerminal(ctx context.Context, workspaceID, taskID string) error
}
TerminalAcknowledger closes the durable turn-side half of a task terminal transition after TaskOps has confirmed the authoritative task state. A turn executor that does not keep a durable execution journal need not implement it.