task

package
v0.84.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const CompleteCommandOperation base.CommandOperation = "complete-task"

CompleteCommandOperation is the Kafka command operation for closing an open vault task as completed. Wire string unchanged: "complete-task".

View Source
const CreateCommandOperation base.CommandOperation = "create-task"

CreateCommandOperation is the Kafka command operation for creating a new vault task. Wire string unchanged: "create-task".

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

IncrementFrontmatterCommandOperation is the Kafka command operation for atomic field increment. Wire string unchanged: "increment-frontmatter".

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

UpdateFrontmatterCommandOperation is the Kafka command operation for partial frontmatter update. Wire string unchanged: "update-frontmatter".

Variables

View Source
var ErrTaskAlreadyExists = stderrors.New("task file already exists at title path")

ErrTaskAlreadyExists is returned by the task controller's create-task executor when a task file already occupies the target filename in the vault. The controller writes nothing and the CQRS framework converts this error into a Failure on the result topic. Callers across repositories (e.g. the recurring-task-creator) match it via errors.Is to classify the collision as a benign, expected outcome of replaying a CreateCommand for an already-materialized task, rather than a genuine processing failure.

Functions

This section is empty.

Types

type BodySection

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

BodySection describes an idempotent body-section write for UpdateFrontmatterCommand. Heading MUST include the markdown prefix (e.g. "## Failure"). Section MUST include the heading as its first line and a trailing newline.

type CompleteCommand added in v0.83.0

type CompleteCommand struct {
	TaskIdentifier lib.TaskIdentifier `json:"taskIdentifier"`
	// RecoverySHA is the default-branch HEAD (40-char hex) at close time, for audit.
	RecoverySHA string `json:"recoverySha,omitempty"`
	// TargetVault is the slug of the Obsidian vault this task belongs in.
	// Empty value means "use the controller's legacy default (openclaw)".
	// Wire format uses omitempty so legacy producers that never set it stay byte-compatible.
	TargetVault string `json:"targetVault,omitempty"`
}

CompleteCommand is the payload for CompleteCommandOperation.

It closes the vault task whose task_identifier matches TaskIdentifier, transitioning it to status: completed, phase: done with a # Resolution body section carrying the recovery SHA. The watcher publishes this on a red → green build transition (spec 076); the task controller applies it.

func (CompleteCommand) Validate added in v0.83.0

func (cmd CompleteCommand) Validate(ctx context.Context) error

Validate enforces CompleteCommand schema rules before publishing or processing.

type CompleteCommandSender added in v0.83.0

type CompleteCommandSender interface {
	SendCommand(ctx context.Context, cmd CompleteCommand) error
}

CompleteCommandSender sends CompleteCommand payloads to Kafka. Calls Validate before publishing — a validation error is returned without touching Kafka.

func NewCompleteCommandSender added in v0.83.0

func NewCompleteCommandSender(
	commandObjectSender cdb.CommandObjectSender,
	defaultVault string,
) CompleteCommandSender

NewCompleteCommandSender creates a CompleteCommandSender using the given cdb.CommandObjectSender. The defaultVault is substituted into cmd.TargetVault at SendCommand time when cmd.TargetVault is empty; an invalid defaultVault surfaces as a validation error on the first SendCommand call.

type CreateCommand

type CreateCommand struct {
	TaskIdentifier lib.TaskIdentifier  `json:"taskIdentifier"`
	Title          string              `json:"title"`
	Frontmatter    lib.TaskFrontmatter `json:"frontmatter"`
	Body           string              `json:"body,omitempty"`
	// TargetVault is the slug of the Obsidian vault this task belongs in.
	// Empty value means "use the controller's legacy default (openclaw)".
	// Wire format uses omitempty so legacy producers that never set it stay byte-compatible.
	TargetVault string `json:"targetVault,omitempty"`
}

CreateCommand is the payload for CreateCommandOperation. JSON tags are byte-identical to the former lib.CreateTaskCommand for wire compatibility.

func (CreateCommand) Validate

func (cmd CreateCommand) Validate(ctx context.Context) error

Validate enforces CreateCommand schema rules before publishing or processing.

type CreateCommandSender

type CreateCommandSender interface {
	SendCommand(ctx context.Context, cmd CreateCommand) error
}

CreateCommandSender sends CreateCommand payloads to Kafka. Calls Validate before publishing — a validation error is returned without touching Kafka.

func NewCreateCommandSender

func NewCreateCommandSender(
	commandObjectSender cdb.CommandObjectSender,
	defaultVault string,
) CreateCommandSender

NewCreateCommandSender creates a CreateCommandSender using the given cdb.CommandObjectSender. The defaultVault is substituted into cmd.TargetVault at SendCommand time when cmd.TargetVault is empty; an invalid defaultVault surfaces as a validation error on the first SendCommand call.

type IncrementFrontmatterCommand

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

IncrementFrontmatterCommand is the payload for IncrementFrontmatterCommandOperation. JSON tags are byte-identical to the former lib.IncrementFrontmatterCommand.

func (IncrementFrontmatterCommand) Validate

Validate enforces IncrementFrontmatterCommand schema rules before publishing. TaskIdentifier and Field must be non-empty. Delta is unconstrained (zero and negative are valid).

type IncrementFrontmatterCommandSender

type IncrementFrontmatterCommandSender interface {
	SendCommand(ctx context.Context, cmd IncrementFrontmatterCommand) error
}

IncrementFrontmatterCommandSender sends IncrementFrontmatterCommand payloads to Kafka. Calls Validate before publishing — a validation error is returned without touching Kafka.

func NewIncrementFrontmatterCommandSender

func NewIncrementFrontmatterCommandSender(
	commandObjectSender cdb.CommandObjectSender,
) IncrementFrontmatterCommandSender

NewIncrementFrontmatterCommandSender creates an IncrementFrontmatterCommandSender.

type UpdateFrontmatterCommand

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

UpdateFrontmatterCommand is the payload for UpdateFrontmatterCommandOperation. JSON tags are byte-identical to the former lib.UpdateFrontmatterCommand.

func (UpdateFrontmatterCommand) Validate

func (cmd UpdateFrontmatterCommand) Validate(ctx context.Context) error

Validate enforces UpdateFrontmatterCommand schema rules before publishing. TaskIdentifier must be non-empty. At least one of Updates (non-empty map) or Body (non-nil) must be set — a no-op command with both absent is a producer bug.

type UpdateFrontmatterCommandSender

type UpdateFrontmatterCommandSender interface {
	SendCommand(ctx context.Context, cmd UpdateFrontmatterCommand) error
}

UpdateFrontmatterCommandSender sends UpdateFrontmatterCommand payloads to Kafka. Calls Validate before publishing — a validation error is returned without touching Kafka.

func NewUpdateFrontmatterCommandSender

func NewUpdateFrontmatterCommandSender(
	commandObjectSender cdb.CommandObjectSender,
) UpdateFrontmatterCommandSender

NewUpdateFrontmatterCommandSender creates an UpdateFrontmatterCommandSender.

Jump to

Keyboard shortcuts

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