viewer

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2026 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, options Options) error

Types

type ActivityPageView

type ActivityPageView struct {
	Items     []ActivityView `json:"items"`
	Truncated bool           `json:"truncated"`
}

type ActivityView

type ActivityView struct {
	StoreID     string    `json:"store_id"`
	ProjectName string    `json:"project_name"`
	SessionKey  string    `json:"session_key"`
	SessionID   string    `json:"session_id"`
	Title       string    `json:"title,omitempty"`
	Adapter     string    `json:"adapter,omitempty"`
	Model       string    `json:"model,omitempty"`
	Branch      string    `json:"branch,omitempty"`
	Status      string    `json:"status,omitempty"`
	TurnCount   int       `json:"turn_count"`
	FileCount   int       `json:"file_count"`
	Additions   int       `json:"additions"`
	Deletions   int       `json:"deletions"`
	StartedAt   time.Time `json:"started_at,omitempty"`
	FinishedAt  time.Time `json:"finished_at,omitempty"`
}

ActivityView is one session in the cross-project feed. It carries the owning store so a click can route back into that project.

type AddProjectRequest

type AddProjectRequest struct {
	Directory       string `json:"directory"`
	Agent           string `json:"agent,omitempty"`
	UpdateGitignore bool   `json:"update_gitignore"`
	GitSync         bool   `json:"git_sync"`
}

AddProjectRequest initializes recording in a directory. This mirrors the flags turnal init accepts.

type AddProjectResult

type AddProjectResult struct {
	StoreID          string   `json:"store_id"`
	Root             string   `json:"root"`
	StorePath        string   `json:"-"`
	Attached         bool     `json:"attached"`
	GitignoreUpdated bool     `json:"gitignore_updated"`
	Hooks            []string `json:"hooks,omitempty"`
	Warning          string   `json:"warning,omitempty"`
}

AddProjectResult reports what the add flow changed on disk.

type BlameLineView

type BlameLineView struct {
	Line      int       `json:"line"`
	Text      string    `json:"text"`
	Kind      string    `json:"kind"`
	TurnKey   string    `json:"turn_key,omitempty"`
	TurnID    uint64    `json:"turn_id,omitempty"`
	SessionID string    `json:"session_id,omitempty"`
	Adapter   string    `json:"adapter,omitempty"`
	Prompt    string    `json:"prompt,omitempty"`
	ToolNames []string  `json:"tool_names,omitempty"`
	Time      time.Time `json:"time,omitempty"`
}

type BlameView

type BlameView struct {
	Path          string          `json:"path"`
	LatestCommit  string          `json:"latest_commit"`
	LatestTime    time.Time       `json:"latest_time"`
	CompleteTurns int             `json:"complete_turns"`
	Lines         []BlameLineView `json:"lines"`
	Warnings      []string        `json:"warnings,omitempty"`
	Truncated     bool            `json:"truncated"`
	TruthSource   string          `json:"truth_source"`
}

type DiffSummaryView

type DiffSummaryView struct {
	TurnKey     string     `json:"turn_key"`
	Files       []FileView `json:"files"`
	Additions   int        `json:"additions"`
	Deletions   int        `json:"deletions"`
	BinaryFiles int        `json:"binary_files"`
	PreCommit   string     `json:"pre_commit"`
	PostCommit  string     `json:"post_commit"`
	TruthSource string     `json:"truth_source"`
}

type ErrPickerCancelled

type ErrPickerCancelled struct{}

ErrPickerCancelled reports that the user dismissed the dialog. This is an ordinary outcome, not a failure.

func (ErrPickerCancelled) Error

func (ErrPickerCancelled) Error() string

type ErrPickerUnavailable

type ErrPickerUnavailable struct{ Reason string }

ErrPickerUnavailable reports that no native folder dialog could be run, so the caller should fall back to typing a path.

func (ErrPickerUnavailable) Error

func (err ErrPickerUnavailable) Error() string

type EventView

type EventView struct {
	Sequence  uint64    `json:"sequence"`
	Type      string    `json:"type"`
	Kind      string    `json:"kind"`
	Title     string    `json:"title"`
	Body      string    `json:"body,omitempty"`
	ToolName  string    `json:"tool_name,omitempty"`
	Time      time.Time `json:"time"`
	Sensitive bool      `json:"sensitive"`
}

type FilePatchView

type FilePatchView struct {
	Path       string `json:"path"`
	Patch      string `json:"patch"`
	Truncated  bool   `json:"truncated"`
	ByteCount  int    `json:"byte_count"`
	LineCount  int    `json:"line_count"`
	LimitBytes int    `json:"limit_bytes"`
	LimitLines int    `json:"limit_lines"`
}

type FileView

type FileView struct {
	Path      string `json:"path"`
	Additions int    `json:"additions"`
	Deletions int    `json:"deletions"`
	Binary    bool   `json:"binary"`
}

type IndexView

type IndexView struct {
	Projects        []ProjectView `json:"projects"`
	ReadOnly        bool          `json:"read_only"`
	NetworkSilent   bool          `json:"network_silent"`
	ViewerStartedAt time.Time     `json:"viewer_started_at"`
	CurrentStoreID  string        `json:"current_store_id,omitempty"`
}

IndexView is the payload for the global landing page.

type ManualSaveView

type ManualSaveView struct {
	ID       string    `json:"id"`
	Message  string    `json:"message,omitempty"`
	Time     time.Time `json:"time,omitempty"`
	Warnings []string  `json:"warnings,omitempty"`
}

ManualSaveView is a standalone folder snapshot, intentionally separate from agent sessions and turns.

type Options

type Options struct {
	// Repo is optional. When turnal ui runs inside a recorded project that
	// project is preselected; from anywhere else the global index opens.
	Repo           *checkpoint.Repo
	Port           int
	NoOpen         bool
	InitialSession string
	Out            io.Writer
}

type ProjectView

type ProjectView struct {
	StoreID      string                `json:"store_id"`
	RepoID       string                `json:"repo_id,omitempty"`
	Name         string                `json:"name"`
	Root         string                `json:"root"`
	Branch       string                `json:"branch,omitempty"`
	Present      bool                  `json:"present"`
	IndexState   string                `json:"index_state,omitempty"`
	HistoryState string                `json:"history_state,omitempty"`
	SessionCount int                   `json:"session_count"`
	TurnCount    int                   `json:"turn_count"`
	Additions    int                   `json:"additions"`
	Deletions    int                   `json:"deletions"`
	LastActivity time.Time             `json:"last_activity,omitempty"`
	LastPrompt   string                `json:"last_prompt,omitempty"`
	LastAdapter  string                `json:"last_adapter,omitempty"`
	AddedAt      time.Time             `json:"added_at,omitempty"`
	Worktrees    []ProjectWorktreeView `json:"worktrees,omitempty"`
}

ProjectView is one recorded project in the global index. Present is false when the store directory is gone; the project stays listed because its recorded history outlives the working tree.

type ProjectWorktreeView

type ProjectWorktreeView struct {
	Root       string `json:"root"`
	GitDir     string `json:"git_dir,omitempty"`
	LastSeenAt string `json:"last_seen_at,omitempty"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(db *projects.DB, current *checkpoint.Repo) (*Server, error)

NewServer builds a viewer over every registered project. The optional repo only preselects a project; the server is never scoped to it.

func (*Server) ServeHTTP

func (server *Server) ServeHTTP(response http.ResponseWriter, request *http.Request)

type Service

type Service struct {
	Repo *checkpoint.Repo
	// contains filtered or unexported fields
}

func NewService

func NewService(repo *checkpoint.Repo) (*Service, error)

func (*Service) Blame

func (service *Service) Blame(ctx context.Context, key, path string, line int) (BlameView, error)

func (*Service) Diff

func (service *Service) Diff(ctx context.Context, key string) (DiffSummaryView, error)

func (*Service) Patch

func (service *Service) Patch(ctx context.Context, key, path string) (FilePatchView, error)

func (*Service) Saves

func (service *Service) Saves(ctx context.Context) ([]ManualSaveView, error)

Saves returns standalone folder snapshots separately from agent sessions.

func (*Service) SessionTurns

func (service *Service) SessionTurns(ctx context.Context, key string) (SessionTurnsView, error)

func (*Service) Sessions

func (service *Service) Sessions(ctx context.Context) ([]SessionSummaryView, error)

func (*Service) Turn

func (service *Service) Turn(ctx context.Context, key string) (TurnDetailView, error)

func (*Service) Workspace

func (service *Service) Workspace(ctx context.Context) (WorkspaceView, error)

type SessionSummaryView

type SessionSummaryView struct {
	Key           string    `json:"key"`
	ID            string    `json:"id"`
	StreamID      string    `json:"stream_id"`
	WorktreeID    string    `json:"worktree_id,omitempty"`
	Adapter       string    `json:"adapter,omitempty"`
	Model         string    `json:"model,omitempty"`
	Branch        string    `json:"branch,omitempty"`
	StartedAt     time.Time `json:"started_at,omitempty"`
	FinishedAt    time.Time `json:"finished_at,omitempty"`
	EventCount    int       `json:"event_count"`
	TurnCount     int       `json:"turn_count"`
	CompleteTurns int       `json:"complete_turns"`
	ErrorCount    int       `json:"error_count"`
	FileCount     int       `json:"file_count"`
	Additions     int       `json:"additions"`
	Deletions     int       `json:"deletions"`
	Status        string    `json:"status"`
	PromptPreview string    `json:"prompt_preview,omitempty"`
	// contains filtered or unexported fields
}

type SessionTurnsView

type SessionTurnsView struct {
	Session SessionSummaryView `json:"session"`
	Turns   []TurnSummaryView  `json:"turns"`
}

type TurnDetailView

type TurnDetailView struct {
	TurnSummaryView
	SessionID string            `json:"session_id"`
	StreamID  string            `json:"stream_id"`
	Events    []EventView       `json:"events"`
	Warnings  []string          `json:"warnings,omitempty"`
	Truncated bool              `json:"truncated"`
	Identity  map[string]string `json:"identity"`
}

type TurnSummaryView

type TurnSummaryView struct {
	Key          string     `json:"key"`
	ID           uint64     `json:"id"`
	Status       string     `json:"status"`
	StartedAt    time.Time  `json:"started_at,omitempty"`
	FinishedAt   time.Time  `json:"finished_at,omitempty"`
	Adapter      string     `json:"adapter,omitempty"`
	Prompt       string     `json:"prompt,omitempty"`
	Assistant    string     `json:"assistant,omitempty"`
	ToolNames    []string   `json:"tool_names,omitempty"`
	EventCount   int        `json:"event_count"`
	ErrorCount   int        `json:"error_count"`
	Files        []FileView `json:"files,omitempty"`
	Additions    int        `json:"additions"`
	Deletions    int        `json:"deletions"`
	PreCommit    string     `json:"pre_commit,omitempty"`
	PostCommit   string     `json:"post_commit,omitempty"`
	Checkpointed bool       `json:"checkpointed"`
}

type WorkspaceView

type WorkspaceView struct {
	Name            string    `json:"name"`
	Root            string    `json:"root"`
	RepoID          string    `json:"repo_id"`
	StoreID         string    `json:"store_id"`
	WorktreeID      string    `json:"worktree_id"`
	SessionCount    int       `json:"session_count"`
	TurnCount       int       `json:"turn_count"`
	IndexState      string    `json:"index_state"`
	HistoryState    string    `json:"history_state"`
	Problems        []string  `json:"problems,omitempty"`
	LastActivity    time.Time `json:"last_activity,omitempty"`
	ReadOnly        bool      `json:"read_only"`
	NetworkSilent   bool      `json:"network_silent"`
	ViewerStartedAt time.Time `json:"viewer_started_at"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL