Documentation
¶
Overview ¶
Package sessioncapture provides terminal context capture with delta-based tracking. Inspired by lacy's context.sh — only sends what changed since the last query.
Package sessioncapture provides hawk's interface to trace.
trace is a fully independent tool (own repo, own binary, works with any agent). hawk can optionally manage it via slash commands:
/trace-enable — enable session capture /trace-disable — disable session capture /trace-status — show capture status
hawk NEVER auto-enables trace. The user must explicitly opt in.
Index ¶
- type Bridge
- func (b *Bridge) Disable(ctx context.Context, dir string) error
- func (b *Bridge) Enable(ctx context.Context, dir string) error
- func (b *Bridge) GetStatus(ctx context.Context, dir string) (*Status, error)
- func (b *Bridge) ListCheckpoints(ctx context.Context, dir string) ([]Checkpoint, error)
- func (b *Bridge) Ready() bool
- func (b *Bridge) Rewind(ctx context.Context, dir string, checkpointID string) error
- type Checkpoint
- type Status
- type TerminalContext
- type TraceControl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bridge ¶
type Bridge struct {
// contains filtered or unexported fields
}
Bridge wraps the trace CLI for Git-native session capture.
func NewBridge ¶
func NewBridge() *Bridge
NewBridge locates the trace binary and returns a bridge. Returns a no-op bridge if trace is not installed, logging a warning on first use.
func (*Bridge) ListCheckpoints ¶
ListCheckpoints returns available checkpoints for the current session.
type Checkpoint ¶
type Checkpoint struct {
ID string `json:"id"`
SessionID string `json:"session_id"`
Prompt string `json:"prompt,omitempty"`
CreatedAt string `json:"created_at"`
}
Checkpoint represents a rewind point.
type Status ¶
type Status struct {
Enabled bool `json:"enabled"`
SessionID string `json:"session_id,omitempty"`
Agent string `json:"agent,omitempty"`
Phase string `json:"phase,omitempty"`
}
Status holds the parsed output of `trace status --json`.
type TerminalContext ¶ added in v0.2.0
type TerminalContext struct {
// contains filtered or unexported fields
}
TerminalContext captures and tracks terminal state changes between queries. Only includes what changed since the last query to minimize token usage.
func NewTerminalContext ¶ added in v0.2.0
func NewTerminalContext() *TerminalContext
NewTerminalContext creates a new delta-tracking terminal context.
func (*TerminalContext) BuildContext ¶ added in v0.2.0
func (tc *TerminalContext) BuildContext(query string) string
BuildContext returns a delta-based context string and resets tracking state.
func (*TerminalContext) MarkCommand ¶ added in v0.2.0
func (tc *TerminalContext) MarkCommand(cmd string)
MarkCommand records a shell command that was executed.
func (*TerminalContext) MarkExitCode ¶ added in v0.2.0
func (tc *TerminalContext) MarkExitCode(code int)
MarkExitCode records the exit code of the last command.
func (*TerminalContext) Reset ¶ added in v0.2.0
func (tc *TerminalContext) Reset()
Reset clears all state (e.g., on /new session).
type TraceControl ¶ added in v0.2.0
type TraceControl struct {
ProjectDir string
}
TraceControl lets hawk manage trace when the user asks. trace remains independent — hawk just provides UI convenience.
func NewTraceControl ¶ added in v0.2.0
func NewTraceControl(projectDir string) *TraceControl
NewTraceControl creates a controller for the given project.
func (*TraceControl) Disable ¶ added in v0.2.0
func (tc *TraceControl) Disable() (string, error)
Disable deactivates trace for this project. User must explicitly call this.
func (*TraceControl) Enable ¶ added in v0.2.0
func (tc *TraceControl) Enable() (string, error)
Enable activates trace for this project. User must explicitly call this.
func (*TraceControl) IsEnabled ¶ added in v0.2.0
func (tc *TraceControl) IsEnabled() bool
IsEnabled checks if trace is active in this project.
func (*TraceControl) IsInstalled ¶ added in v0.2.0
func (tc *TraceControl) IsInstalled() bool
IsInstalled checks if trace binary exists in PATH.
func (*TraceControl) Status ¶ added in v0.2.0
func (tc *TraceControl) Status() string
Status returns current trace state for display in hawk.