tasklifecycle

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

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

View Source
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

func IsManagedTask(ctx context.Context) bool

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

func WithManagedTask(ctx context.Context) context.Context

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

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 TaskOps

type TaskOps interface {
	ClaimTask(ctx context.Context, taskID string) error
	CompleteTask(ctx context.Context, taskID string) error
	FailTask(ctx context.Context, taskID, reason string) error
}

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.

Jump to

Keyboard shortcuts

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