agent/pkg/lifecycle/submit.go
Snider e90a84eaa0 feat: merge go-agent + go-agentic + php-devops into unified agent repo
Combines three repositories into a single workspace:
- go-agent → pkg/orchestrator (Clotho), pkg/jobrunner, pkg/loop, cmd/
- go-agentic → pkg/lifecycle (allowance, sessions, plans, dispatch)
- php-devops → repos.yaml, setup.sh, scripts/, .core/

Module path: forge.lthn.ai/core/agent

All packages build, all tests pass.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-06 15:23:00 +00:00

35 lines
851 B
Go

package lifecycle
import (
"context"
"time"
"forge.lthn.ai/core/go-log"
)
// SubmitTask creates a new task with the given parameters via the API client.
// It validates that title is non-empty, sets CreatedAt to the current time,
// and delegates creation to client.CreateTask.
func SubmitTask(ctx context.Context, client *Client, title, description string, labels []string, priority TaskPriority) (*Task, error) {
const op = "agentic.SubmitTask"
if title == "" {
return nil, log.E(op, "title is required", nil)
}
task := Task{
Title: title,
Description: description,
Labels: labels,
Priority: priority,
Status: StatusPending,
CreatedAt: time.Now().UTC(),
}
created, err := client.CreateTask(ctx, task)
if err != nil {
return nil, log.E(op, "failed to create task", err)
}
return created, nil
}