Archie runs its own agent loop only. Removes Kit resolution and launch, the harness runner and adapters, the setup terminal and sandbox view, harness secrets and OAuth capture (table dropped in migration 0075), the task-tools contract that only Kit containers reached, and the sandbox-kit-spec dependency. Agent profiles carry image and tools only. The egress proxy keeps the model-session path; the sandbox relay code stays for #1867.
64 lines
2.1 KiB
Go
64 lines
2.1 KiB
Go
package webui
|
|
|
|
import (
|
|
"log/slog"
|
|
"net/http"
|
|
|
|
controlpb "github.com/samcharles93/archie-core/internal/contracts/controlplane/v1"
|
|
"github.com/samcharles93/archie-core/internal/domain/storecontract"
|
|
"github.com/samcharles93/archie-core/internal/domain/workflow/task"
|
|
)
|
|
|
|
// tasksAPI owns the /api/tasks routes and /api/task-meta. Optional
|
|
// dependencies (steps, taskLogs, chat) stay nil-safe: each handler
|
|
// reports the feature unavailable rather than the module being absent.
|
|
type tasksAPI struct {
|
|
store storecontract.TaskStore
|
|
steps storecontract.StepReader
|
|
taskLogs TaskLogSource
|
|
chat *ChatService
|
|
log *slog.Logger
|
|
|
|
authorize func(http.ResponseWriter, *http.Request) bool
|
|
configSource func() ConfigViewSource
|
|
recovery func(*http.Request, *task.Task) *taskRecoveryView
|
|
controlPlane controlpb.ControlPlaneServiceClient
|
|
}
|
|
|
|
func newTasksAPI(s *Server) *tasksAPI {
|
|
return &tasksAPI{
|
|
store: s.Store,
|
|
steps: s.Steps,
|
|
taskLogs: s.TaskLogs,
|
|
chat: s.Chat,
|
|
log: s.Log,
|
|
authorize: s.authorizeTaskMutation,
|
|
configSource: s.configSource,
|
|
recovery: s.taskRecovery,
|
|
controlPlane: s.ControlPlane,
|
|
}
|
|
}
|
|
|
|
func (a *tasksAPI) logf(msg string, args ...any) { warnf(a.log, msg, args...) }
|
|
|
|
// warnf logs at warn level and tolerates a nil logger, as tests construct
|
|
// servers without one.
|
|
func warnf(log *slog.Logger, msg string, args ...any) {
|
|
if log != nil {
|
|
log.Warn(msg, args...)
|
|
}
|
|
}
|
|
|
|
func (a *tasksAPI) register(mux *http.ServeMux) {
|
|
mux.HandleFunc("GET /api/tasks", a.handleTasks)
|
|
mux.HandleFunc("GET /api/task-meta", a.handleTaskMeta)
|
|
mux.HandleFunc("POST /api/tasks/{id}/action", a.handleTaskAction)
|
|
mux.HandleFunc("GET /api/tasks/{id}", a.handleTask)
|
|
mux.HandleFunc("GET /api/tasks/{id}/attempts", a.handleTaskAttempts)
|
|
mux.HandleFunc("GET /api/tasks/{id}/changes", a.handleTaskChanges)
|
|
mux.HandleFunc("GET /api/tasks/{id}/debug", a.handleTaskDebug)
|
|
mux.HandleFunc("GET /api/tasks/{id}/logs", a.handleTaskLogs)
|
|
mux.HandleFunc("GET /api/tasks/{id}/transcript", a.handleTaskTranscript)
|
|
mux.HandleFunc("GET /api/tasks/{id}/logs/download", a.handleTaskLogDownload)
|
|
}
|