model

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnknownFileName         = "unknown"
	IDECodex                = "codex"
	IDEClaude               = "claude"
	IDEDroid                = "droid"
	IDECursor               = "cursor-agent"
	IDEOpenCode             = "opencode"
	IDEPi                   = "pi"
	IDEGemini               = "gemini"
	DefaultCodexModel       = "gpt-5.4"
	DefaultClaudeModel      = "opus"
	DefaultCursorModel      = "composer-1"
	DefaultOpenCodeModel    = "anthropic/claude-opus-4-6"
	DefaultPiModel          = "anthropic/claude-opus-4-6"
	DefaultGeminiModel      = "gemini-2.5-pro"
	DefaultActivityTimeout  = 10 * time.Minute
	WorkflowRootDirName     = ".compozy"
	WorkflowTasksDirName    = "tasks"
	ArchivedWorkflowDirName = "_archived"
	ModeCodeReview          = "pr-review"
	ModePRDTasks            = "prd-tasks"
)

Variables

This section is empty.

Functions

func ArchivedTasksDir added in v0.1.3

func ArchivedTasksDir(baseDir string) string

func IsActiveWorkflowDirName added in v0.1.3

func IsActiveWorkflowDirName(name string) bool

func TaskDirectory

func TaskDirectory(name string) string

func TasksBaseDir

func TasksBaseDir() string

Types

type ContentBlock added in v0.1.3

type ContentBlock struct {
	Type ContentBlockType `json:"type"`
	Data json.RawMessage  `json:"-"`
}

ContentBlock stores one typed content payload in its canonical JSON form.

func NewContentBlock added in v0.1.3

func NewContentBlock(block any) (ContentBlock, error)

NewContentBlock encodes a typed block into the generic ContentBlock envelope.

func (ContentBlock) AsDiff added in v0.1.3

func (b ContentBlock) AsDiff() (DiffBlock, error)

AsDiff decodes the block as a DiffBlock.

func (ContentBlock) AsImage added in v0.1.3

func (b ContentBlock) AsImage() (ImageBlock, error)

AsImage decodes the block as an ImageBlock.

func (ContentBlock) AsTerminalOutput added in v0.1.3

func (b ContentBlock) AsTerminalOutput() (TerminalOutputBlock, error)

AsTerminalOutput decodes the block as a TerminalOutputBlock.

func (ContentBlock) AsText added in v0.1.3

func (b ContentBlock) AsText() (TextBlock, error)

AsText decodes the block as a TextBlock.

func (ContentBlock) AsToolResult added in v0.1.3

func (b ContentBlock) AsToolResult() (ToolResultBlock, error)

AsToolResult decodes the block as a ToolResultBlock.

func (ContentBlock) AsToolUse added in v0.1.3

func (b ContentBlock) AsToolUse() (ToolUseBlock, error)

AsToolUse decodes the block as a ToolUseBlock.

func (ContentBlock) Decode added in v0.1.3

func (b ContentBlock) Decode() (any, error)

Decode unmarshals the envelope into its typed block payload.

func (ContentBlock) MarshalJSON added in v0.1.3

func (b ContentBlock) MarshalJSON() ([]byte, error)

MarshalJSON preserves the canonical JSON payload stored in Data.

func (*ContentBlock) UnmarshalJSON added in v0.1.3

func (b *ContentBlock) UnmarshalJSON(data []byte) error

UnmarshalJSON validates the payload and stores its canonical JSON form.

type ContentBlockType added in v0.1.3

type ContentBlockType string

ContentBlockType identifies the serialized variant carried by a ContentBlock.

const (
	// BlockText carries plain text or markdown content.
	BlockText ContentBlockType = "text"
	// BlockToolUse carries a tool invocation announcement.
	BlockToolUse ContentBlockType = "tool_use"
	// BlockToolResult carries tool output that is not represented by a richer block.
	BlockToolResult ContentBlockType = "tool_result"
	// BlockDiff carries file modification details.
	BlockDiff ContentBlockType = "diff"
	// BlockTerminalOutput carries terminal execution output.
	BlockTerminalOutput ContentBlockType = "terminal_output"
	// BlockImage carries inline image data.
	BlockImage ContentBlockType = "image"
)

type DiffBlock added in v0.1.3

type DiffBlock struct {
	Type     ContentBlockType `json:"type"`
	FilePath string           `json:"filePath"`
	Diff     string           `json:"diff"`
	OldText  *string          `json:"oldText,omitempty"`
	NewText  string           `json:"newText,omitempty"`
}

DiffBlock carries file modification details.

type ExecutionMode

type ExecutionMode string
const (
	ExecutionModePRReview ExecutionMode = ModeCodeReview
	ExecutionModePRDTasks ExecutionMode = ModePRDTasks
)

type ImageBlock added in v0.1.3

type ImageBlock struct {
	Type     ContentBlockType `json:"type"`
	Data     string           `json:"data"`
	MimeType string           `json:"mimeType"`
	URI      *string          `json:"uri,omitempty"`
}

ImageBlock carries inline image data.

type IssueEntry

type IssueEntry struct {
	Name     string
	AbsPath  string
	Content  string
	CodeFile string
}

type Job

type Job struct {
	CodeFiles     []string
	Groups        map[string][]IssueEntry
	SafeName      string
	Prompt        []byte
	SystemPrompt  string
	OutPromptPath string
	OutLog        string
	ErrLog        string
}

func (Job) IssueCount

func (j Job) IssueCount() int

type ReviewContext

type ReviewContext struct {
	Status      string
	File        string
	Line        int
	Severity    string
	Author      string
	ProviderRef string
}

type ReviewFileMeta

type ReviewFileMeta struct {
	Status      string `yaml:"status"`
	File        string `yaml:"file,omitempty"`
	Line        int    `yaml:"line,omitempty"`
	Severity    string `yaml:"severity,omitempty"`
	Author      string `yaml:"author,omitempty"`
	ProviderRef string `yaml:"provider_ref,omitempty"`
}

type RoundMeta

type RoundMeta struct {
	Provider   string
	PR         string
	Round      int
	CreatedAt  time.Time
	Total      int
	Resolved   int
	Unresolved int
}

type RuntimeConfig

type RuntimeConfig struct {
	Name                   string
	Round                  int
	Provider               string
	PR                     string
	ReviewsDir             string
	TasksDir               string
	DryRun                 bool
	AutoCommit             bool
	Concurrent             int
	BatchSize              int
	IDE                    string
	Model                  string
	AddDirs                []string
	Grouped                bool
	TailLines              int
	ReasoningEffort        string
	SystemPrompt           string
	Mode                   ExecutionMode
	IncludeCompleted       bool
	IncludeResolved        bool
	Timeout                time.Duration
	MaxRetries             int
	RetryBackoffMultiplier float64
}

func (*RuntimeConfig) ApplyDefaults

func (cfg *RuntimeConfig) ApplyDefaults()

type SessionAvailableCommand added in v0.1.3

type SessionAvailableCommand struct {
	Name         string `json:"name"`
	Description  string `json:"description,omitempty"`
	ArgumentHint string `json:"argumentHint,omitempty"`
}

SessionAvailableCommand describes one ACP slash-command style command.

type SessionPlanEntry added in v0.1.3

type SessionPlanEntry struct {
	Content  string `json:"content"`
	Priority string `json:"priority"`
	Status   string `json:"status"`
}

SessionPlanEntry describes one ACP plan entry.

type SessionStatus added in v0.1.3

type SessionStatus string

SessionStatus describes the lifecycle state of a streamed session update.

const (
	// StatusRunning marks an in-flight session update.
	StatusRunning SessionStatus = "running"
	// StatusCompleted marks a completed session.
	StatusCompleted SessionStatus = "completed"
	// StatusFailed marks a failed or canceled session.
	StatusFailed SessionStatus = "failed"
)

type SessionUpdate added in v0.1.3

type SessionUpdate struct {
	Kind              SessionUpdateKind         `json:"kind,omitempty"`
	ToolCallID        string                    `json:"toolCallId,omitempty"`
	ToolCallState     ToolCallState             `json:"toolCallState,omitempty"`
	Blocks            []ContentBlock            `json:"blocks,omitempty"`
	ThoughtBlocks     []ContentBlock            `json:"thoughtBlocks,omitempty"`
	PlanEntries       []SessionPlanEntry        `json:"planEntries,omitempty"`
	AvailableCommands []SessionAvailableCommand `json:"availableCommands,omitempty"`
	CurrentModeID     string                    `json:"currentModeId,omitempty"`
	Usage             Usage                     `json:"usage,omitempty"`
	Status            SessionStatus             `json:"status"`
}

SessionUpdate is the Compozy-owned view of one streamed ACP update.

type SessionUpdateKind added in v0.1.3

type SessionUpdateKind string

SessionUpdateKind identifies the ACP notification variant carried by a SessionUpdate.

const (
	// UpdateKindUnknown marks an update with no additional semantic classification.
	UpdateKindUnknown SessionUpdateKind = ""
	// UpdateKindUserMessageChunk marks a streamed user message chunk.
	UpdateKindUserMessageChunk SessionUpdateKind = "user_message_chunk"
	// UpdateKindAgentMessageChunk marks a streamed agent message chunk.
	UpdateKindAgentMessageChunk SessionUpdateKind = "agent_message_chunk"
	// UpdateKindAgentThoughtChunk marks a streamed agent thought chunk.
	UpdateKindAgentThoughtChunk SessionUpdateKind = "agent_thought_chunk"
	// UpdateKindToolCallStarted marks the start of a tool call lifecycle.
	UpdateKindToolCallStarted SessionUpdateKind = "tool_call_started"
	// UpdateKindToolCallUpdated marks an update to an existing tool call lifecycle.
	UpdateKindToolCallUpdated SessionUpdateKind = "tool_call_updated"
	// UpdateKindPlanUpdated marks a plan update.
	UpdateKindPlanUpdated SessionUpdateKind = "plan_updated"
	// UpdateKindAvailableCommandsUpdated marks an available commands update.
	UpdateKindAvailableCommandsUpdated SessionUpdateKind = "available_commands_updated"
	// UpdateKindCurrentModeUpdated marks a current mode update.
	UpdateKindCurrentModeUpdated SessionUpdateKind = "current_mode_updated"
)

type SolvePreparation

type SolvePreparation struct {
	Jobs              []Job
	InputDir          string
	InputDirPath      string
	ResolvedName      string
	ResolvedPR        string
	ResolvedProvider  string
	ResolvedRound     int
	GroupedSummarized bool
}

type TaskEntry

type TaskEntry struct {
	Content      string
	Status       string
	Domain       string
	TaskType     string
	Scope        string
	Complexity   string
	Dependencies []string
}

type TaskFileMeta

type TaskFileMeta struct {
	Status       string   `yaml:"status"`
	Domain       string   `yaml:"domain,omitempty"`
	TaskType     string   `yaml:"type,omitempty"`
	Scope        string   `yaml:"scope,omitempty"`
	Complexity   string   `yaml:"complexity,omitempty"`
	Dependencies []string `yaml:"dependencies,omitempty"`
}

type TaskMeta

type TaskMeta struct {
	CreatedAt time.Time
	UpdatedAt time.Time
	Total     int
	Completed int
	Pending   int
}

type TerminalOutputBlock added in v0.1.3

type TerminalOutputBlock struct {
	Type       ContentBlockType `json:"type"`
	Command    string           `json:"command,omitempty"`
	Output     string           `json:"output,omitempty"`
	ExitCode   int              `json:"exitCode"`
	TerminalID string           `json:"terminalId,omitempty"`
}

TerminalOutputBlock carries terminal execution details.

type TextBlock added in v0.1.3

type TextBlock struct {
	Type ContentBlockType `json:"type"`
	Text string           `json:"text"`
}

TextBlock carries plain text or markdown output.

type ToolCallState added in v0.1.3

type ToolCallState string

ToolCallState describes the lifecycle state of a tool call entry.

const (
	// ToolCallStateUnknown marks a tool call without an explicit lifecycle state.
	ToolCallStateUnknown ToolCallState = ""
	// ToolCallStatePending marks a pending tool call.
	ToolCallStatePending ToolCallState = "pending"
	// ToolCallStateInProgress marks an in-flight tool call.
	ToolCallStateInProgress ToolCallState = "in_progress"
	// ToolCallStateCompleted marks a completed tool call.
	ToolCallStateCompleted ToolCallState = "completed"
	// ToolCallStateFailed marks a failed tool call.
	ToolCallStateFailed ToolCallState = "failed"
	// ToolCallStateWaitingForConfirmation is reserved for future permission-aware UX.
	ToolCallStateWaitingForConfirmation ToolCallState = "waiting_for_confirmation"
)

type ToolResultBlock added in v0.1.3

type ToolResultBlock struct {
	Type      ContentBlockType `json:"type"`
	ToolUseID string           `json:"toolUseId"`
	Content   string           `json:"content"`
	IsError   bool             `json:"isError,omitempty"`
}

ToolResultBlock carries tool output when a richer block type is not available.

type ToolUseBlock added in v0.1.3

type ToolUseBlock struct {
	Type  ContentBlockType `json:"type"`
	ID    string           `json:"id"`
	Name  string           `json:"name"`
	Input json.RawMessage  `json:"input,omitempty"`
}

ToolUseBlock describes the start of a tool invocation.

type Usage added in v0.1.3

type Usage struct {
	InputTokens  int `json:"inputTokens,omitempty"`
	OutputTokens int `json:"outputTokens,omitempty"`
	TotalTokens  int `json:"totalTokens,omitempty"`
	CacheReads   int `json:"cacheReads,omitempty"`
	CacheWrites  int `json:"cacheWrites,omitempty"`
}

Usage tracks session token consumption.

func (*Usage) Add added in v0.1.3

func (u *Usage) Add(other Usage)

Add accumulates usage from another update into the receiver.

func (Usage) Total added in v0.1.3

func (u Usage) Total() int

Total returns the derived total token count when TotalTokens is not populated.

Jump to

Keyboard shortcuts

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