lib

package module
v0.53.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const IncrementFrontmatterCommandOperation base.CommandOperation = "increment-frontmatter"

IncrementFrontmatterCommandOperation is the Kafka command operation for atomically incrementing a single frontmatter field by a delta. Published by the executor on agent-task-v1-request; handled by the controller.

View Source
const UpdateFrontmatterCommandOperation base.CommandOperation = "update-frontmatter"

UpdateFrontmatterCommandOperation is the Kafka command operation for atomically setting specific frontmatter keys without touching other keys.

Variables

View Source
var CDBSchemaIDs = cdb.SchemaIDs{
	TaskV1SchemaID,
}
View Source
var TaskV1SchemaID = cdb.SchemaID{
	Group:   "agent",
	Kind:    "task",
	Version: "v1",
}

Functions

This section is empty.

Types

type BodySection added in v0.53.1

type BodySection struct {
	Heading string `json:"heading"`
	Section string `json:"section"`
}

BodySection describes an idempotent body-section write: the controller's UpdateFrontmatterExecutor calls ReplaceOrAppendSection(content, Heading, Section). Heading MUST include the markdown prefix (e.g. "## Failure"). Section MUST include the heading as its first line and a trailing newline.

type IncrementFrontmatterCommand added in v0.53.1

type IncrementFrontmatterCommand struct {
	TaskIdentifier TaskIdentifier `json:"taskIdentifier"`
	Field          string         `json:"field"`
	Delta          int            `json:"delta"`
}

IncrementFrontmatterCommand is the payload for IncrementFrontmatterCommandOperation. The controller reads the current value of Field from disk, adds Delta, and writes the result atomically — so the write is never idempotent.

type Task

type Task struct {
	base.Object[base.Identifier]
	TaskIdentifier TaskIdentifier  `json:"taskIdentifier"`
	Frontmatter    TaskFrontmatter `json:"frontmatter"`
	Content        TaskContent     `json:"content"`
}

Task is the payload published by an agent when it finishes a task. task/controller consumes this from agent-task-v1-request and writes it to the vault file. Frontmatter is a generic map — task/controller serializes it to YAML without interpreting individual fields. Content is the markdown body after the frontmatter closing delimiter. The agent owns the content transformation (status, phase, Result section, etc.).

func (Task) Ptr

func (t Task) Ptr() *Task

func (Task) Validate

func (t Task) Validate(ctx context.Context) error

type TaskAssignee

type TaskAssignee string

TaskAssignee identifies which agent type handles this task. Matched against Config CRD spec.assignee.

func (TaskAssignee) String

func (t TaskAssignee) String() string

func (TaskAssignee) Validate

func (t TaskAssignee) Validate(ctx context.Context) error

type TaskContent

type TaskContent string

TaskContent is the markdown body of a task after the frontmatter closing delimiter.

func (TaskContent) String

func (t TaskContent) String() string

func (TaskContent) Validate

func (t TaskContent) Validate(ctx context.Context) error

type TaskFrontmatter

type TaskFrontmatter map[string]interface{}

TaskFrontmatter is a generic map of frontmatter key-value pairs. Serializable as JSON (Kafka) and YAML (vault file). Typed accessors provide type-safe access to well-known fields.

func (TaskFrontmatter) Assignee

func (f TaskFrontmatter) Assignee() TaskAssignee

func (TaskFrontmatter) CurrentJob added in v0.37.0

func (f TaskFrontmatter) CurrentJob() string

CurrentJob returns the K8s Job name recorded when the executor spawned a Job for this task. Returns an empty string when not set.

func (TaskFrontmatter) MaxRetries added in v0.37.0

func (f TaskFrontmatter) MaxRetries() int

MaxRetries returns the maximum number of failures allowed before escalation. Returns 3 when the field is absent (spec default).

func (TaskFrontmatter) MaxTriggers added in v0.53.1

func (f TaskFrontmatter) MaxTriggers() int

MaxTriggers returns the maximum number of spawn-trigger events allowed for this task. Returns 3 if the field is absent, matching the default for max_retries.

func (TaskFrontmatter) Phase

func (f TaskFrontmatter) Phase() *domain.TaskPhase

func (TaskFrontmatter) RetryCount added in v0.37.0

func (f TaskFrontmatter) RetryCount() int

RetryCount returns the number of failed attempts recorded in frontmatter. Returns 0 when the field is absent.

func (TaskFrontmatter) SpawnNotification added in v0.37.0

func (f TaskFrontmatter) SpawnNotification() bool

SpawnNotification returns true when this result is a job-spawn tracking update rather than an agent outcome. The controller skips the retry counter for these.

func (TaskFrontmatter) Stage

func (f TaskFrontmatter) Stage() string

Stage returns the execution stage from the "stage" key. Returns "prod" if the key is absent or empty.

func (TaskFrontmatter) Status

func (f TaskFrontmatter) Status() domain.TaskStatus

func (TaskFrontmatter) TriggerCount added in v0.53.1

func (f TaskFrontmatter) TriggerCount() int

TriggerCount returns the number of spawn-trigger events that have fired for this task. Returns 0 if the field is absent.

type TaskIdentifier

type TaskIdentifier string

TaskIdentifier uniquely identifies an agent task.

func (TaskIdentifier) Bytes

func (t TaskIdentifier) Bytes() []byte

func (TaskIdentifier) Equal

func (t TaskIdentifier) Equal(identifier base.ObjectIdentifier) bool

func (TaskIdentifier) Ptr

func (t TaskIdentifier) Ptr() *TaskIdentifier

func (TaskIdentifier) String

func (t TaskIdentifier) String() string

func (TaskIdentifier) Validate

func (t TaskIdentifier) Validate(ctx context.Context) error

type TaskIdentifierGenerator

type TaskIdentifierGenerator base.IdentifierGenerator[TaskIdentifier]

TaskIdentifierGenerator generates unique task identifiers.

type TaskIdentifiers

type TaskIdentifiers []TaskIdentifier

TaskIdentifiers is a slice of TaskIdentifier.

func (TaskIdentifiers) Contains

func (t TaskIdentifiers) Contains(value TaskIdentifier) bool

Contains returns true if the slice contains the given identifier.

type UpdateFrontmatterCommand added in v0.53.1

type UpdateFrontmatterCommand struct {
	TaskIdentifier TaskIdentifier  `json:"taskIdentifier"`
	Updates        TaskFrontmatter `json:"updates"`
	Body           *BodySection    `json:"body,omitempty"`
}

UpdateFrontmatterCommand is the payload for UpdateFrontmatterCommandOperation. Merges Updates into the existing frontmatter (partial merge — absent keys preserved). When Body is set, its section is appended to (or replaced in) the task body via lib/delivery.ReplaceOrAppendSection. Unset Body means frontmatter-only update.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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