Documentation
¶
Index ¶
- Constants
- Variables
- func AppendTLDRSection(report, tldr string) string
- func ApplyURLAttemptForTest(rec *JobRecord, ev ProgressEvent)
- func FallbackQueriesForTest(question string, round int) []string
- func FormatDoneMessage(rec JobRecord) string
- func FormatJobStatsLine(rec JobRecord) string
- func FormatPausedMessage(rec JobRecord) string
- func FormatProgressLine(rec JobRecord, ev ProgressEvent) string
- func FormatResearchError(msg string) string
- func FormatResearchErrorForTest(msg string) string
- func FormatURLAttemptLine(rec JobRecord, ev ProgressEvent) string
- func FormatURLFailureSummary(st JobStats) string
- func IsLowQualityForTest(s string) bool
- func IsPausedLLMForTest(err error) bool
- func ParseJSONArrayForTest(s string) []string
- func PauseLLMErrorForTest(detail string) error
- func ResolveUniqueSlug(projectHex, base string) (string, error)
- func ShouldStopFromLLMForTest(s string) bool
- func SlugFromQuery(query string) string
- func TitleFromQuery(query string) string
- type CancelFn
- type Engine
- type EngineConfig
- type EngineResumeState
- type Finding
- type JobRecord
- type JobStats
- type LLMCaller
- type Manager
- func (m *Manager) Cancel(projectHex, target string) error
- func (m *Manager) Delete(projectHex, target string) error
- func (m *Manager) Get(projectHex, target string) (JobRecord, error)
- func (m *Manager) List(projectHex string) ([]JobRecord, error)
- func (m *Manager) Resume(parentCtx context.Context, projectHex, target string, req StartRequest) (JobRecord, error)
- func (m *Manager) Start(parentCtx context.Context, req StartRequest) (JobRecord, error)
- type ProgressEvent
- type ProgressFn
- type RunMeta
- type StartRequest
- type URLAttempt
Constants ¶
View Source
const ( StatusRunning = "running" StatusPaused = "paused" StatusDone = "done" StatusFailed = "failed" StatusCancelled = "cancelled" )
View Source
const ( PhasePlanning = "planning" PhaseSearching = "searching" PhaseReading = "reading" PhaseAnalyzing = "analyzing" PhaseWriting = "writing" PhaseError = "error" )
View Source
const ( URLAttemptOK = "ok" URLAttemptFetchFailed = "fetch_failed" URLEmptyContent = "empty_content" URLAttemptLLMFailed = "llm_failed" URLAttemptLowQuality = "low_quality" URLAttemptParseFailed = "parse_failed" URLAttemptSearchFailed = "search_failed" )
Variables ¶
View Source
var ErrPausedLLM = errors.New("research paused: LLM unavailable")
Functions ¶
func AppendTLDRSection ¶
func ApplyURLAttemptForTest ¶
func ApplyURLAttemptForTest(rec *JobRecord, ev ProgressEvent)
func FallbackQueriesForTest ¶
func FormatDoneMessage ¶
func FormatJobStatsLine ¶
func FormatPausedMessage ¶
func FormatProgressLine ¶
func FormatProgressLine(rec JobRecord, ev ProgressEvent) string
func FormatResearchError ¶
func FormatURLAttemptLine ¶
func FormatURLAttemptLine(rec JobRecord, ev ProgressEvent) string
func FormatURLFailureSummary ¶
func IsLowQualityForTest ¶
func IsPausedLLMForTest ¶
func ParseJSONArrayForTest ¶
func PauseLLMErrorForTest ¶
func ResolveUniqueSlug ¶
func SlugFromQuery ¶
func TitleFromQuery ¶
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func NewEngine ¶
func NewEngine(cfg EngineConfig) *Engine
func (*Engine) CheckpointState ¶
func (e *Engine) CheckpointState() EngineResumeState
func (*Engine) RenderHTML ¶
type EngineConfig ¶
type EngineConfig struct {
Cfg *config.Root
Model string
Question string
Category string
LLM LLMCaller
Resume *EngineResumeState
OnProgress ProgressFn
IsCancelled CancelFn
OnPersist func(*JobRecord)
}
type EngineResumeState ¶
type JobRecord ¶
type JobRecord struct {
ID string `json:"id"`
Slug string `json:"slug"`
Title string `json:"title"`
Question string `json:"question"`
Category string `json:"category,omitempty"`
Status string `json:"status"`
Phase string `json:"phase,omitempty"`
Round int `json:"round,omitempty"`
MaxRounds int `json:"max_rounds,omitempty"`
ParentChatID string `json:"parent_chat_id,omitempty"`
ProjectHex string `json:"project_hex"`
HTMLPath string `json:"html_path,omitempty"`
ResearchPlan string `json:"research_plan,omitempty"`
EvolvingReport string `json:"evolving_report,omitempty"`
Findings []Finding `json:"findings,omitempty"`
QueriesUsed []string `json:"queries_used,omitempty"`
URLsFetched []string `json:"urls_fetched,omitempty"`
URLAttempts []URLAttempt `json:"url_attempts,omitempty"`
Stats JobStats `json:"stats,omitempty"`
Error string `json:"error,omitempty"`
StartedAt time.Time `json:"started_at"`
FinishedAt time.Time `json:"finished_at,omitempty"`
}
type JobStats ¶
type JobStats struct {
DurationSecs float64 `json:"duration_secs,omitempty"`
Rounds int `json:"rounds,omitempty"`
Queries int `json:"queries,omitempty"`
URLs int `json:"urls,omitempty"`
Findings int `json:"findings,omitempty"`
URLReadOK int `json:"url_read_ok,omitempty"`
URLFetchFailed int `json:"url_fetch_failed,omitempty"`
URLEmptyContent int `json:"url_empty_content,omitempty"`
URLLLMFailed int `json:"url_llm_failed,omitempty"`
URLLowQuality int `json:"url_low_quality,omitempty"`
URLParseFailed int `json:"url_parse_failed,omitempty"`
SearchFailures int `json:"search_failures,omitempty"`
SearchEngine string `json:"search_engine,omitempty"`
Model string `json:"model,omitempty"`
Category string `json:"category,omitempty"`
PromptTokens int64 `json:"prompt_tokens,omitempty"`
ResponseTokens int64 `json:"response_tokens,omitempty"`
TotalTokens int64 `json:"total_tokens,omitempty"`
EstimatedTokens int64 `json:"estimated_tokens,omitempty"`
}
type LLMCaller ¶
type LLMCaller interface {
Complete(userPrompt string, maxTokens int) (string, apitype.UsageStats, error)
}
func NewBackendLLM ¶
func NewBackendLLM(ctx context.Context, backend llm.CompletionBackend, cfg *config.Root, model string, usage *apitype.UsageStats) LLMCaller
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func GlobalManager ¶
func GlobalManager() *Manager
type ProgressEvent ¶
type ProgressFn ¶
type ProgressFn func(ProgressEvent)
type StartRequest ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.