Initial pipelines server, CLI, TUI, and Go installation
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
package protocol
|
||||
|
||||
const (
|
||||
Ping = "ping"
|
||||
Pong = "pong"
|
||||
Error = "error"
|
||||
Submit = "submit"
|
||||
Submitted = "submitted"
|
||||
List = "list_pipelines"
|
||||
PipelineList = "pipelines"
|
||||
GetPipeline = "get_pipeline"
|
||||
Pipeline = "pipeline"
|
||||
ListTemplates = "list_templates"
|
||||
Templates = "templates"
|
||||
Validate = "validate"
|
||||
Validated = "validated"
|
||||
)
|
||||
|
||||
type Stage struct {
|
||||
Notify *NotificationPolicy `json:"notify,omitempty"`
|
||||
Key string `json:"key"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Output string `json:"output"`
|
||||
Prompt string `json:"prompt"`
|
||||
Configs map[string]string `json:"configs"`
|
||||
Edges map[string]string `json:"edges"`
|
||||
FallbackError bool `json:"fallback_error"`
|
||||
// Additional type-specific Markdown blocks; legacy model fields remain above.
|
||||
Blocks map[string]string `json:"blocks,omitempty"`
|
||||
}
|
||||
|
||||
type NotificationPolicy struct {
|
||||
On []string `json:"on"`
|
||||
Destination string `json:"destination"`
|
||||
Artifacts []string `json:"artifacts,omitempty"`
|
||||
}
|
||||
|
||||
// Public phone setup only. Never include publishing endpoints or credentials.
|
||||
type NotificationEndpoint struct {
|
||||
Destination string `json:"destination"`
|
||||
ServerURL string `json:"server_url,omitempty"`
|
||||
Topic string `json:"topic"`
|
||||
}
|
||||
|
||||
type Template struct {
|
||||
Key string `json:"key"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Source string `json:"source"`
|
||||
Scheduled bool `json:"scheduled"`
|
||||
}
|
||||
|
||||
type Graph struct {
|
||||
Stages []Stage `json:"stages"`
|
||||
Settings *Settings `json:"settings,omitempty"`
|
||||
}
|
||||
|
||||
type Settings struct {
|
||||
Prompt string `json:"prompt"`
|
||||
Schedules []Schedule `json:"schedules"`
|
||||
}
|
||||
|
||||
type Schedule struct {
|
||||
Days []string `json:"days,omitempty"`
|
||||
Times []string `json:"times,omitempty"`
|
||||
Every string `json:"every,omitempty"`
|
||||
Timezone string `json:"timezone,omitempty"`
|
||||
}
|
||||
|
||||
type VersionSummary struct {
|
||||
Version int `json:"version"`
|
||||
Stages int `json:"stages"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
}
|
||||
|
||||
type PipelineDetail struct {
|
||||
PipelineSummary
|
||||
LatestVersion int `json:"latest_version"`
|
||||
VersionCreatedAt string `json:"version_created_at"`
|
||||
ContentHash string `json:"content_hash"`
|
||||
Source string `json:"source"`
|
||||
Graph Graph `json:"graph"`
|
||||
Versions []VersionSummary `json:"versions"`
|
||||
}
|
||||
|
||||
type PipelineSummary struct {
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Version int `json:"version"`
|
||||
Stages int `json:"stages"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
}
|
||||
|
||||
// Message is the JSON envelope shared by the server and client.
|
||||
type Message struct {
|
||||
Graph *Graph `json:"graph,omitempty"`
|
||||
ExpectedVersion int `json:"expected_version,omitempty"`
|
||||
Templates []Template `json:"templates,omitempty"`
|
||||
CreateOnly bool `json:"create_only,omitempty"`
|
||||
NotificationEndpoints []NotificationEndpoint `json:"notification_endpoints,omitempty"`
|
||||
Type string `json:"type"`
|
||||
ID string `json:"id,omitempty"`
|
||||
Time string `json:"time,omitempty"`
|
||||
Error string `json:"error,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Source string `json:"source,omitempty"`
|
||||
Version int `json:"version,omitempty"`
|
||||
Pipelines []PipelineSummary `json:"pipelines,omitempty"`
|
||||
PipelineID int64 `json:"pipeline_id,omitempty"`
|
||||
Detail *PipelineDetail `json:"detail,omitempty"`
|
||||
RunID int64 `json:"run_id,omitempty"`
|
||||
RunDetail *RunDetail `json:"run_detail,omitempty"`
|
||||
Runs []RunSummary `json:"runs,omitempty"`
|
||||
Input map[string]any `json:"input,omitempty"`
|
||||
AllowTools bool `json:"allow_tools,omitempty"`
|
||||
WritePaths []string `json:"write_paths,omitempty"`
|
||||
RequestKey string `json:"request_key,omitempty"`
|
||||
Workspace string `json:"workspace,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package protocol
|
||||
|
||||
const (
|
||||
RunPipeline = "run_pipeline"
|
||||
RunStarted = "run_started"
|
||||
ListRuns = "list_runs"
|
||||
Runs = "runs"
|
||||
GetRun = "get_run"
|
||||
Run = "run"
|
||||
CancelRun = "cancel_run"
|
||||
)
|
||||
|
||||
type RunSummary struct {
|
||||
ID int64 `json:"id"`
|
||||
PipelineID int64 `json:"pipeline_id"`
|
||||
Name string `json:"name"`
|
||||
Version int `json:"version"`
|
||||
ContentHash string `json:"content_hash"`
|
||||
Status string `json:"status"`
|
||||
Outcome string `json:"outcome"`
|
||||
CurrentStage string `json:"current_stage"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
FinishedAt string `json:"finished_at"`
|
||||
Diagnostic string `json:"diagnostic"`
|
||||
}
|
||||
|
||||
type RunStep struct {
|
||||
Notifications []NotificationReceipt `json:"notifications,omitempty"`
|
||||
Sequence int `json:"sequence"`
|
||||
Stage string `json:"stage"`
|
||||
Status string `json:"status"`
|
||||
Outcome string `json:"outcome"`
|
||||
Target string `json:"target"`
|
||||
Input map[string]any `json:"input"`
|
||||
Output map[string]any `json:"output"`
|
||||
Diagnostic string `json:"diagnostic"`
|
||||
SessionID string `json:"session_id"`
|
||||
AgentActive bool `json:"agent_active"`
|
||||
Transcript string `json:"transcript"`
|
||||
StartedAt string `json:"started_at"`
|
||||
FinishedAt string `json:"finished_at"`
|
||||
}
|
||||
|
||||
type NotificationReceipt struct {
|
||||
Destination string `json:"destination"`
|
||||
Status string `json:"status"`
|
||||
Filename string `json:"filename,omitempty"`
|
||||
MessageID string `json:"message_id,omitempty"`
|
||||
AttachmentURL string `json:"attachment_url,omitempty"`
|
||||
Diagnostic string `json:"diagnostic,omitempty"`
|
||||
}
|
||||
|
||||
type RunDetail struct {
|
||||
RunSummary
|
||||
Workspace string `json:"workspace"`
|
||||
AllowTools bool `json:"allow_tools"`
|
||||
WritePaths []string `json:"write_paths"`
|
||||
Input map[string]any `json:"input"`
|
||||
Output map[string]any `json:"output"`
|
||||
Steps []RunStep `json:"steps"`
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package protocol
|
||||
|
||||
const (
|
||||
SuccessEnd = "#success"
|
||||
FailureEnd = "#failure"
|
||||
)
|
||||
|
||||
func IsTerminal(target string) bool { return target == SuccessEnd || target == FailureEnd }
|
||||
|
||||
// ResolveTarget preserves the original # shorthand while making its terminal
|
||||
// result explicit in normalized definitions and legacy stored graphs.
|
||||
func ResolveTarget(outcome, target string) string {
|
||||
if target != "#" {
|
||||
return target
|
||||
}
|
||||
if outcome == "error" {
|
||||
return FailureEnd
|
||||
}
|
||||
return SuccessEnd
|
||||
}
|
||||
Reference in New Issue
Block a user