Documentation
¶
Index ¶
- Constants
- Variables
- func IsTerminalTaskStatus(status corepkg.TaskStatus) bool
- func ValidateTaskTransition(from, to corepkg.TaskStatus, opts TransitionOptions) error
- type InMemoryQuotaManager
- type InMemorySubAgentCoordinator
- type InMemoryTaskManager
- func (m *InMemoryTaskManager) Cancel(ctx context.Context, id corepkg.TaskID, _ string) error
- func (m *InMemoryTaskManager) Get(_ context.Context, id corepkg.TaskID) (Task, error)
- func (m *InMemoryTaskManager) ReadIncrement(_ context.Context, id corepkg.TaskID, offset uint64, limit int) (items []TaskLogEntry, nextOffset uint64, hasMore bool, err error)
- func (m *InMemoryTaskManager) RegisterExecution(token string, executor TaskExecutorFunc)
- func (m *InMemoryTaskManager) Retry(ctx context.Context, id corepkg.TaskID) (corepkg.TaskID, error)
- func (m *InMemoryTaskManager) Stream(ctx context.Context, id corepkg.TaskID) (<-chan TaskEvent, error)
- func (m *InMemoryTaskManager) Submit(ctx context.Context, spec TaskSpec) (corepkg.TaskID, error)
- func (m *InMemoryTaskManager) UnregisterExecution(token string)
- func (m *InMemoryTaskManager) Wait(ctx context.Context, id corepkg.TaskID) (TaskResult, error)
- type InMemoryTaskManagerOption
- type LogReader
- type NopTaskEventStore
- type QuotaManager
- type Scheduler
- type SubAgentCoordinator
- type Task
- type TaskEvent
- type TaskEventStore
- type TaskEventType
- type TaskExecutionRegistry
- type TaskExecutorFunc
- type TaskLogEntry
- type TaskManager
- type TaskResult
- type TaskSpec
- type TransitionOptions
- type WorktreeHandle
- type WorktreeManager
- func (m *WorktreeManager) Cleanup(ctx context.Context, h *WorktreeHandle) error
- func (m *WorktreeManager) HasChanges(ctx context.Context, h *WorktreeHandle) (bool, error)
- func (m *WorktreeManager) IsAvailable() bool
- func (m *WorktreeManager) Prepare(ctx context.Context, req WorktreeRequest) (*WorktreeHandle, error)
- type WorktreeRequest
Constants ¶
const ( // ErrorCodeNotImplemented indicates a placeholder runtime capability. ErrorCodeNotImplemented = "not_implemented" // ErrorCodeTaskNotFound indicates the task ID does not exist. ErrorCodeTaskNotFound = "task_not_found" // ErrorCodeInvalidTransition indicates an illegal status transition. ErrorCodeInvalidTransition = "invalid_transition" // ErrorCodeRetryExhausted indicates no retry budget remains. ErrorCodeRetryExhausted = "retry_exhausted" // ErrorCodeTaskTimeout is the canonical timeout code for runtime tasks. ErrorCodeTaskTimeout = "task_timeout" // ErrorCodeTaskCancelled is the canonical cancellation code for runtime tasks. ErrorCodeTaskCancelled = "task_cancelled" // ErrorCodeQuotaExceeded indicates runtime quota acquisition failure. ErrorCodeQuotaExceeded = "quota_exceeded" // ErrorCodeTaskExecutionFailed indicates runtime executor returned a non-timeout failure. ErrorCodeTaskExecutionFailed = "task_execution_failed" )
const TaskExecutionTokenMetadataKey = "runtime_execution_token"
Variables ¶
var ErrTaskNotImplemented = newRuntimeError(ErrorCodeNotImplemented, "runtime task manager is not wired", false, nil)
Functions ¶
func IsTerminalTaskStatus ¶
func IsTerminalTaskStatus(status corepkg.TaskStatus) bool
func ValidateTaskTransition ¶
func ValidateTaskTransition(from, to corepkg.TaskStatus, opts TransitionOptions) error
Types ¶
type InMemoryQuotaManager ¶
type InMemoryQuotaManager struct {
// contains filtered or unexported fields
}
func NewInMemoryQuotaManager ¶
func NewInMemoryQuotaManager(defaultLimit int, perKeyLimits map[string]int) *InMemoryQuotaManager
func (*InMemoryQuotaManager) Acquire ¶
func (q *InMemoryQuotaManager) Acquire(ctx context.Context, key string) error
func (*InMemoryQuotaManager) Release ¶
func (q *InMemoryQuotaManager) Release(key string)
type InMemorySubAgentCoordinator ¶
type InMemorySubAgentCoordinator struct {
// contains filtered or unexported fields
}
func NewInMemorySubAgentCoordinator ¶
func NewInMemorySubAgentCoordinator(taskManager TaskManager, quotaManager QuotaManager) *InMemorySubAgentCoordinator
func (*InMemorySubAgentCoordinator) Wait ¶
func (c *InMemorySubAgentCoordinator) Wait(ctx context.Context, id corepkg.TaskID) (TaskResult, error)
type InMemoryTaskManager ¶
type InMemoryTaskManager struct {
// contains filtered or unexported fields
}
InMemoryTaskManager is a safe placeholder until runtime orchestration is wired.
func NewInMemoryTaskManager ¶
func NewInMemoryTaskManager(opts ...InMemoryTaskManagerOption) *InMemoryTaskManager
func (*InMemoryTaskManager) ReadIncrement ¶
func (*InMemoryTaskManager) RegisterExecution ¶
func (m *InMemoryTaskManager) RegisterExecution(token string, executor TaskExecutorFunc)
func (*InMemoryTaskManager) UnregisterExecution ¶
func (m *InMemoryTaskManager) UnregisterExecution(token string)
func (*InMemoryTaskManager) Wait ¶
func (m *InMemoryTaskManager) Wait(ctx context.Context, id corepkg.TaskID) (TaskResult, error)
type InMemoryTaskManagerOption ¶
type InMemoryTaskManagerOption func(*InMemoryTaskManager)
func WithTaskEventStore ¶
func WithTaskEventStore(store TaskEventStore) InMemoryTaskManagerOption
func WithTaskExecutor ¶
func WithTaskExecutor(executor TaskExecutorFunc) InMemoryTaskManagerOption
func WithTerminalHistoryCap ¶
func WithTerminalHistoryCap(limit int) InMemoryTaskManagerOption
type NopTaskEventStore ¶
type NopTaskEventStore struct{}
func (NopTaskEventStore) AppendTaskEvent ¶
func (NopTaskEventStore) AppendTaskEvent(context.Context, TaskEvent) error
func (NopTaskEventStore) AppendTaskLog ¶
func (NopTaskEventStore) AppendTaskLog(context.Context, corepkg.TaskID, TaskLogEntry) error
type QuotaManager ¶
type SubAgentCoordinator ¶
type TaskEventStore ¶
type TaskEventType ¶
type TaskEventType string
const ( TaskEventStatus TaskEventType = "status" TaskEventLog TaskEventType = "log" TaskEventResult TaskEventType = "result" TaskEventError TaskEventType = "error" )
type TaskExecutionRegistry ¶
type TaskExecutionRegistry interface {
RegisterExecution(token string, executor TaskExecutorFunc)
UnregisterExecution(token string)
}
type TaskLogEntry ¶
type TaskManager ¶
type TaskManager interface {
Submit(ctx context.Context, spec TaskSpec) (corepkg.TaskID, error)
Get(ctx context.Context, id corepkg.TaskID) (Task, error)
Cancel(ctx context.Context, id corepkg.TaskID, reason string) error
Retry(ctx context.Context, id corepkg.TaskID) (corepkg.TaskID, error)
Stream(ctx context.Context, id corepkg.TaskID) (<-chan TaskEvent, error)
Wait(ctx context.Context, id corepkg.TaskID) (TaskResult, error)
}
type TaskResult ¶
type TransitionOptions ¶
type TransitionOptions struct {
AllowRetryTransition bool
}
type WorktreeHandle ¶ added in v0.1.8
WorktreeHandle carries metadata for an active worktree managed by WorktreeManager.
type WorktreeManager ¶ added in v0.1.8
type WorktreeManager struct {
// contains filtered or unexported fields
}
WorktreeManager manages temporary git worktrees for subagent isolation.
func NewWorktreeManager ¶ added in v0.1.8
func NewWorktreeManager(workspaceRoot string) (*WorktreeManager, error)
NewWorktreeManager creates a WorktreeManager for the given workspace. Returns an error if the workspace is not a git repository.
func (*WorktreeManager) Cleanup ¶ added in v0.1.8
func (m *WorktreeManager) Cleanup(ctx context.Context, h *WorktreeHandle) error
Cleanup removes a worktree and its owner metadata. Idempotent.
func (*WorktreeManager) HasChanges ¶ added in v0.1.8
func (m *WorktreeManager) HasChanges(ctx context.Context, h *WorktreeHandle) (bool, error)
HasChanges detects whether a worktree has uncommitted modifications.
func (*WorktreeManager) IsAvailable ¶ added in v0.1.8
func (m *WorktreeManager) IsAvailable() bool
IsAvailable reports whether the manager is ready to create worktrees.
func (*WorktreeManager) Prepare ¶ added in v0.1.8
func (m *WorktreeManager) Prepare(ctx context.Context, req WorktreeRequest) (*WorktreeHandle, error)
Prepare creates a temporary git worktree and writes owner metadata.
type WorktreeRequest ¶ added in v0.1.8
WorktreeRequest carries the parameters needed to create a worktree.