-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagent_task.go
More file actions
35 lines (29 loc) · 1.11 KB
/
Copy pathagent_task.go
File metadata and controls
35 lines (29 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) 2026 Benjamin Borbe All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package lib
import (
"context"
"github.com/bborbe/cqrs/base"
"github.com/bborbe/validation"
)
// 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.).
type Task struct {
base.Object[base.Identifier]
TaskIdentifier TaskIdentifier `json:"taskIdentifier"`
Frontmatter TaskFrontmatter `json:"frontmatter"`
Content TaskContent `json:"content"`
}
func (t Task) Validate(ctx context.Context) error {
return validation.All{
validation.Name("TaskIdentifier", t.TaskIdentifier),
validation.Name("Content", t.Content),
}.Validate(ctx)
}
func (t Task) Ptr() *Task {
return &t
}