codingagent

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeAnnotationProofread = "annotation-proofread"
	SessionsDirName         = ".reader/coding-agent-sessions"
)

Variables

This section is empty.

Functions

func BuildPrompt

func BuildPrompt(req RunRequest, fileContent string) string

func IsValidID

func IsValidID(id string) bool

Types

type CodexRunner

type CodexRunner struct{}

func (CodexRunner) Run

func (r CodexRunner) Run(ctx context.Context, args []string, stdin string) (RunResult, error)

type RunRequest

type RunRequest struct {
	Root        string `json:"root"`
	Path        string `json:"path"`
	Instruction string `json:"instruction"`
	Mode        string `json:"mode"`
}

type RunResponse

type RunResponse struct {
	SessionID      string    `json:"sessionId"`
	CodexSessionID string    `json:"codexSessionId,omitempty"`
	Status         string    `json:"status"`
	Response       string    `json:"response"`
	ExitCode       int       `json:"exitCode"`
	UpdatedAt      time.Time `json:"updatedAt"`
}

func RunResponseFromSession

func RunResponseFromSession(session *Session) RunResponse

type RunResult

type RunResult struct {
	Stdout      string
	Stderr      string
	LastMessage string
	SessionID   string
	ExitCode    int
}

type Runner

type Runner interface {
	Run(ctx context.Context, args []string, stdin string) (RunResult, error)
}

type Service

type Service struct {
	ProjectRoot  string
	AllowedRoots map[string]string
	Runner       Runner
}

func NewService

func NewService(projectRoot string, runner Runner) *Service

func (*Service) ListSessions

func (s *Service) ListSessions() ([]SessionSummary, error)

func (*Service) ReadSession

func (s *Service) ReadSession(id string) (*Session, error)

func (*Service) Run

func (s *Service) Run(ctx context.Context, req RunRequest, fileContent string) (*Session, error)

func (*Service) SaveSession

func (s *Service) SaveSession(session *Session) error

func (*Service) SetAllowedRoot

func (s *Service) SetAllowedRoot(root, dir string)

type Session

type Session struct {
	ID             string    `json:"id"`
	CodexSessionID string    `json:"codexSessionId,omitempty"`
	Mode           string    `json:"mode"`
	Root           string    `json:"root"`
	Path           string    `json:"path"`
	CreatedAt      time.Time `json:"createdAt"`
	UpdatedAt      time.Time `json:"updatedAt"`
	Turns          []Turn    `json:"turns"`
}

type SessionSummary

type SessionSummary struct {
	ID           string    `json:"id"`
	Mode         string    `json:"mode"`
	Root         string    `json:"root"`
	Path         string    `json:"path"`
	CreatedAt    time.Time `json:"createdAt"`
	UpdatedAt    time.Time `json:"updatedAt"`
	ExitCode     int       `json:"exitCode"`
	LastResponse string    `json:"lastResponse,omitempty"`
}

type Turn

type Turn struct {
	Input      string    `json:"input"`
	Response   string    `json:"response"`
	ExitCode   int       `json:"exitCode"`
	StartedAt  time.Time `json:"startedAt"`
	FinishedAt time.Time `json:"finishedAt"`
	Stdout     string    `json:"stdout,omitempty"`
	Stderr     string    `json:"stderr,omitempty"`
	Error      string    `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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