feat: add supervisor prototype with embedded frontend
This commit is contained in:
10
internal/domain/agent.go
Normal file
10
internal/domain/agent.go
Normal file
@ -0,0 +1,10 @@
|
||||
package domain
|
||||
|
||||
import "time"
|
||||
|
||||
type Agent struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Kind string `json:"kind"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
32
internal/domain/event.go
Normal file
32
internal/domain/event.go
Normal file
@ -0,0 +1,32 @@
|
||||
package domain
|
||||
|
||||
import "time"
|
||||
|
||||
type EventType string
|
||||
|
||||
const (
|
||||
EventTerminalOutput EventType = "terminal.output"
|
||||
EventSessionStatus EventType = "session.status"
|
||||
EventError EventType = "error"
|
||||
)
|
||||
|
||||
type Event struct {
|
||||
Type EventType `json:"type"`
|
||||
SessionID string `json:"session"`
|
||||
Payload any `json:"payload"`
|
||||
At time.Time `json:"at"`
|
||||
}
|
||||
|
||||
// TerminalOutputEvent carries raw terminal bytes as UTF-8 text.
|
||||
type TerminalOutputEvent struct {
|
||||
Data string `json:"data"`
|
||||
}
|
||||
|
||||
type SessionStatusEvent struct {
|
||||
Status SessionStatus `json:"status"`
|
||||
ExitCode *int `json:"exitCode,omitempty"`
|
||||
}
|
||||
|
||||
type ErrorEvent struct {
|
||||
Message string `json:"message"`
|
||||
}
|
||||
20
internal/domain/run.go
Normal file
20
internal/domain/run.go
Normal file
@ -0,0 +1,20 @@
|
||||
package domain
|
||||
|
||||
import "time"
|
||||
|
||||
type RunStatus string
|
||||
|
||||
const (
|
||||
RunStatusPlanned RunStatus = "planned"
|
||||
RunStatusRunning RunStatus = "running"
|
||||
RunStatusDone RunStatus = "done"
|
||||
RunStatusFailed RunStatus = "failed"
|
||||
)
|
||||
|
||||
type Run struct {
|
||||
ID string `json:"id"`
|
||||
WorkflowID string `json:"workflowId"`
|
||||
RequestedBy string `json:"requestedBy"`
|
||||
Status RunStatus `json:"status"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
25
internal/domain/session.go
Normal file
25
internal/domain/session.go
Normal file
@ -0,0 +1,25 @@
|
||||
package domain
|
||||
|
||||
import "time"
|
||||
|
||||
type SessionStatus string
|
||||
|
||||
const (
|
||||
SessionStatusCreated SessionStatus = "created"
|
||||
SessionStatusRunning SessionStatus = "running"
|
||||
SessionStatusStopped SessionStatus = "stopped"
|
||||
SessionStatusExited SessionStatus = "exited"
|
||||
SessionStatusError SessionStatus = "error"
|
||||
)
|
||||
|
||||
type Session struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
AgentID string `json:"agentId"`
|
||||
Command string `json:"command"`
|
||||
Status SessionStatus `json:"status"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
StartedAt *time.Time `json:"startedAt,omitempty"`
|
||||
ExitedAt *time.Time `json:"exitedAt,omitempty"`
|
||||
ExitCode *int `json:"exitCode,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user