Documentation
¶
Index ¶
- func FormatInfoText(info *SessionInfo, home string, now time.Time) string
- func FormatListTable(sessions []Session, home string, now time.Time) string
- func FormatListTableWithHits(matches []SessionMatch, home string, now time.Time, colorMode string) string
- type MatchHit
- type RelocateCWDOptions
- type RelocateCWDResult
- type Session
- type SessionInfo
- type SessionMatch
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatInfoText ¶
func FormatInfoText(info *SessionInfo, home string, now time.Time) string
func FormatListTableWithHits ¶ added in v0.0.59
func FormatListTableWithHits(matches []SessionMatch, home string, now time.Time, colorMode string) string
FormatListTableWithHits formats matching sessions like FormatListTable, with indented hit lines under each row. colorMode is "never" | "always" | "auto". Output has no trailing newline (same TrimRight style as FormatListTable).
Types ¶
type MatchHit ¶ added in v0.0.59
type MatchHit struct {
File string // "summary.json", "chat_history.jsonl"
Line int // 1-based
Part string // title, session_summary, cwd, user, assistant, ...
Snippet string // one-line excerpt
MatchStart int // byte offset into Snippet
MatchLen int // length of match in Snippet
}
MatchHit is one content match inside a session file.
type RelocateCWDOptions ¶ added in v0.0.62
type RelocateCWDOptions struct {
// GrokHome is the Grok home directory. Empty → $GROK_HOME or ~/.grok.
GrokHome string
}
RelocateCWDOptions configures RelocateCWD.
type RelocateCWDResult ¶ added in v0.0.62
type RelocateCWDResult struct {
OldCWD, NewCWD, OldSessionDir, NewSessionDir string
FilesTouched []string // optional
}
RelocateCWDResult reports paths after a successful relocate.
func RelocateCWD ¶ added in v0.0.62
func RelocateCWD(sessionID, targetDir string, opts *RelocateCWDOptions) (*RelocateCWDResult, error)
RelocateCWD relocates a Grok session's workspace cwd by updating explicit JSON fields and moving the session directory under the URL-encoded new cwd key.
Call shape: sessionID first (required), targetDir second (required), opts last (nil OK).
type Session ¶
type SessionInfo ¶
type SessionInfo struct {
Session
CreatedAt, UpdatedAt time.Time
NumMessages int
CurrentModelID string
AgentName string
SandboxProfile string
GitRootDir string
HeadBranch string
HeadCommit string
SessionDir string
SummaryPath string
UpdatesPath string
SignalsPath string
PromptContextPath string
UpdatesExists bool
SignalsExists bool
PromptContextExists bool
ContextTokensUsed int
ContextWindowTokens int
ContextWindowUsage int
TotalTokensBeforeCompaction int
}
func Info ¶
func Info(grokHome, sessionID string) (*SessionInfo, error)
type SessionMatch ¶ added in v0.0.59
SessionMatch is a session that matched a grep pattern, with all hits.
func ListWithGrep ¶ added in v0.0.59
func ListWithGrep(grokHome string, limit int, pattern string) ([]SessionMatch, error)
ListWithGrep discovers sessions, keeps those with ≥1 case-insensitive literal hit in summary.json or chat_history.jsonl, sorts by last_active_at desc, then applies limit.