{"modulePath":"github.com/bborbe/agent","version":"v0.150.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package task\n\n## Constants\n\n```go\nconst CompleteCommandOperation base.CommandOperation = \"complete-task\"\n```\nCompleteCommandOperation is the Kafka command operation for closing an open vault task as completed. Wire string unchanged: \"complete-task\".\n\n```go\nconst CreateCommandOperation base.CommandOperation = \"create-task\"\n```\nCreateCommandOperation is the Kafka command operation for creating a new vault task. Wire string unchanged: \"create-task\".\n\n```go\nconst IncrementFrontmatterCommandOperation base.CommandOperation = \"increment-frontmatter\"\n```\nIncrementFrontmatterCommandOperation is the Kafka command operation for atomic field increment. Wire string unchanged: \"increment-frontmatter\".\n\n```go\nconst UpdateFrontmatterCommandOperation base.CommandOperation = \"update-frontmatter\"\n```\nUpdateFrontmatterCommandOperation is the Kafka command operation for partial frontmatter update. Wire string unchanged: \"update-frontmatter\".\n\n## Variables\n\n```go\nvar ErrTaskAlreadyExists = stderrors.New(\"task file already exists at title path\")\n```\nErrTaskAlreadyExists 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.\n\n## Types\n\n```go\ntype BodySection struct {\n\tHeading string `json:\"heading\"`\n\tSection string `json:\"section\"`\n}\n```\nBodySection 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.\n\n```go\ntype CompleteCommand struct {\n\tTaskIdentifier lib.TaskIdentifier `json:\"taskIdentifier\"`\n\t// RecoverySHA is the default-branch HEAD (40-char hex) at close time, for audit.\n\tRecoverySHA string `json:\"recoverySha,omitempty\"`\n\t// TargetVault is the slug of the Obsidian vault this task belongs in.\n\t// Empty value means \"use the controller's legacy default (openclaw)\".\n\t// Wire format uses omitempty so legacy producers that never set it stay byte-compatible.\n\tTargetVault string `json:\"targetVault,omitempty\"`\n}\n```\nCompleteCommand is the payload for CompleteCommandOperation.\n\nIt 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.\n\n```go\nfunc (cmd CompleteCommand) Validate(ctx context.Context) error\n```\nValidate enforces CompleteCommand schema rules before publishing or processing.\n\n```go\ntype CompleteCommandSender interface {\n\tSendCommand(ctx context.Context, cmd CompleteCommand) error\n}\n```\nCompleteCommandSender sends CompleteCommand payloads to Kafka. Calls Validate before publishing — a validation error is returned without touching Kafka.\n\n```go\nfunc NewCompleteCommandSender(\n\tcommandObjectSender cdb.CommandObjectSender,\n\tdefaultVault string,\n) CompleteCommandSender\n```\nNewCompleteCommandSender 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.\n\n```go\ntype CreateCommand struct {\n\tTaskIdentifier lib.TaskIdentifier  `json:\"taskIdentifier\"`\n\tTitle          string              `json:\"title\"`\n\tFrontmatter    lib.TaskFrontmatter `json:\"frontmatter\"`\n\tBody           string              `json:\"body,omitempty\"`\n\t// TargetVault is the slug of the Obsidian vault this task belongs in.\n\t// Empty value means \"use the controller's legacy default (openclaw)\".\n\t// Wire format uses omitempty so legacy producers that never set it stay byte-compatible.\n\tTargetVault string `json:\"targetVault,omitempty\"`\n}\n```\nCreateCommand is the payload for CreateCommandOperation. JSON tags are byte-identical to the former lib.CreateTaskCommand for wire compatibility.\n\n```go\nfunc (cmd CreateCommand) Validate(ctx context.Context) error\n```\nValidate enforces CreateCommand schema rules before publishing or processing.\n\n```go\ntype CreateCommandSender interface {\n\tSendCommand(ctx context.Context, cmd CreateCommand) error\n}\n```\nCreateCommandSender sends CreateCommand payloads to Kafka. Calls Validate before publishing — a validation error is returned without touching Kafka.\n\n```go\nfunc NewCreateCommandSender(\n\tcommandObjectSender cdb.CommandObjectSender,\n\tdefaultVault string,\n) CreateCommandSender\n```\nNewCreateCommandSender 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.\n\n```go\ntype IncrementFrontmatterCommand struct {\n\tTaskIdentifier lib.TaskIdentifier `json:\"taskIdentifier\"`\n\tField          string             `json:\"field\"`\n\tDelta          int                `json:\"delta\"`\n\t// TargetVault is the slug of the Obsidian vault this task belongs in.\n\t// Empty value means consumers fall through and process the command (same\n\t// semantics as the result path), so legacy unstamped producers keep working.\n\t// Wire format uses omitempty so legacy producers that never set it stay byte-compatible.\n\tTargetVault string `json:\"targetVault,omitempty\"`\n}\n```\nIncrementFrontmatterCommand is the payload for IncrementFrontmatterCommandOperation. JSON tags are byte-identical to the former lib.IncrementFrontmatterCommand.\n\n```go\nfunc (cmd IncrementFrontmatterCommand) Validate(ctx context.Context) error\n```\nValidate enforces IncrementFrontmatterCommand schema rules before publishing. TaskIdentifier and Field must be non-empty. Delta is unconstrained (zero and negative are valid).\n\n```go\ntype IncrementFrontmatterCommandSender interface {\n\tSendCommand(ctx context.Context, cmd IncrementFrontmatterCommand) error\n}\n```\nIncrementFrontmatterCommandSender sends IncrementFrontmatterCommand payloads to Kafka. Calls Validate before publishing — a validation error is returned without touching Kafka.\n\n```go\nfunc NewIncrementFrontmatterCommandSender(\n\tcommandObjectSender cdb.CommandObjectSender,\n\tdefaultVault string,\n) IncrementFrontmatterCommandSender\n```\nNewIncrementFrontmatterCommandSender creates an IncrementFrontmatterCommandSender 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.\n\n```go\ntype UpdateFrontmatterCommand struct {\n\tTaskIdentifier lib.TaskIdentifier  `json:\"taskIdentifier\"`\n\tUpdates        lib.TaskFrontmatter `json:\"updates\"`\n\tBody           *BodySection        `json:\"body,omitempty\"`\n\t// TargetVault is the slug of the Obsidian vault this task belongs in.\n\t// Empty value means consumers fall through and process the command (same\n\t// semantics as the result path), so legacy unstamped producers keep working.\n\t// Wire format uses omitempty so legacy producers that never set it stay byte-compatible.\n\tTargetVault string `json:\"targetVault,omitempty\"`\n}\n```\nUpdateFrontmatterCommand is the payload for UpdateFrontmatterCommandOperation. JSON tags are byte-identical to the former lib.UpdateFrontmatterCommand.\n\n```go\nfunc (cmd UpdateFrontmatterCommand) Validate(ctx context.Context) error\n```\nValidate 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.\n\n```go\ntype UpdateFrontmatterCommandSender interface {\n\tSendCommand(ctx context.Context, cmd UpdateFrontmatterCommand) error\n}\n```\nUpdateFrontmatterCommandSender sends UpdateFrontmatterCommand payloads to Kafka. Calls Validate before publishing — a validation error is returned without touching Kafka.\n\n```go\nfunc NewUpdateFrontmatterCommandSender(\n\tcommandObjectSender cdb.CommandObjectSender,\n\tdefaultVault string,\n) UpdateFrontmatterCommandSender\n```\nNewUpdateFrontmatterCommandSender creates an UpdateFrontmatterCommandSender 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.\n\n","path":"github.com/bborbe/agent/command/task","name":"task","synopsis":"","isRedistributable":true}
