Documentation
¶
Overview ¶
Package presence turns Claude Code hook and status-line payloads into presence updates (RFC 6.4, 7.4). Hooks print nothing and always exit 0.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InWorker ¶
func InWorker() bool
InWorker reports whether this process runs inside a Smif worker, where user hooks also fire but must not count as an interactive session.
func Locate ¶
Locate finds the claude process this hook runs under (walking up from the parent) and its terminal device, so the human can later type a prompt into that session (ADR-0012). It returns 0, "" when there is none (no claude ancestor, or no terminal).
func Term ¶
func Term() string
Term names the terminal from the hook's environment: "tmux" inside tmux, "herdr" in a herdr pane, else $TERM_PROGRAM (Apple_Terminal, iTerm.app, …). With both set the daemon's process walk decides.
func Transcript ¶
Transcript reads the session's name (claude --name, /rename) and the human's last prompt from the end of its transcript. Missing or unreadable files give "", "".
Types ¶
type Payload ¶
type Payload struct {
SessionID string `json:"session_id"`
Cwd string `json:"cwd"`
Event string `json:"hook_event_name"`
// TranscriptPath is the session's JSONL transcript; Prompt is the
// submitted text (UserPromptSubmit only).
TranscriptPath string `json:"transcript_path"`
Prompt string `json:"prompt"`
Workspace struct {
CurrentDir string `json:"current_dir"`
ProjectDir string `json:"project_dir"`
} `json:"workspace"`
}
Payload is the subset of a hook or status-line stdin JSON we use.