analyzer

package
v1.45.11 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ActiveTools   = []string{"Write", "Edit", "Bash", "NotebookEdit", "SlashCommand", "KillShell"}
	QuestionTools = []string{"AskUserQuestion"}
	PlanningTools = []string{"ExitPlanMode", "TodoWrite"}
	PassiveTools  = []string{"Read", "Grep", "Glob", "WebFetch", "WebSearch", "Search", "Fetch", "Task"}
)

Tool categories for state machine classification

TODO: Future improvement - detect passive Bash commands Currently all Bash commands are treated as "active" (code-changing). Could be improved by parsing command strings to differentiate:

  • Passive: ls, cd, pwd, git status, git log, git diff, find, grep
  • Active: mkdir, rm, mv, cp, git commit, npm install, etc.

This requires:

  1. Storing tool Input in ToolUse struct (pkg/jsonl)
  2. Parsing command string from Input["command"]
  3. Handling complex cases: pipes (|), redirects (>), chains (&&)

Complexity: Medium-High. Edge cases are tricky (e.g. "cat file > output").

Functions

This section is empty.

Types

type Status

type Status string

Status represents the current task status

const (
	StatusTaskComplete        Status = "task_complete"
	StatusReviewComplete      Status = "review_complete"
	StatusQuestion            Status = "question"
	StatusPlanReady           Status = "plan_ready"
	StatusSessionLimitReached Status = "session_limit_reached"
	StatusAPIError            Status = "api_error"
	StatusAPIErrorOverloaded  Status = "api_error_overloaded"
	StatusPermissionRequest   Status = "permission_request"
	StatusUnknown             Status = "unknown"
)

func AnalyzeTranscript

func AnalyzeTranscript(transcriptPath string, cfg *config.Config) (Status, error)

AnalyzeTranscript analyzes a transcript file and determines the current status

func AnalyzeTranscriptWithMessages

func AnalyzeTranscriptWithMessages(transcriptPath string, cfg *config.Config) (Status, []jsonl.Message, error)

AnalyzeTranscriptWithMessages analyzes a transcript and also returns the parsed messages. This allows callers to reuse the messages (e.g., for summary generation) without re-reading the file.

func ClassifyLastMessage

func ClassifyLastMessage(text string) Status

ClassifyLastMessage derives a status from a host-provided final assistant message when no Claude-format transcript is available (the Codex path).

This is a deliberate MVP simplification: Codex delivers the final message directly in the Stop payload and its rollout transcript format is not parsed, so the rich tool-based state machine above does not apply. An empty message still means the turn finished, so the default is task_complete, with a light question heuristic on top.

func GetStatusForPreToolUse

func GetStatusForPreToolUse(toolName string) Status

GetStatusForPreToolUse determines status for PreToolUse hook This is called BEFORE tool execution, so we only have the tool name

Jump to

Keyboard shortcuts

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