Documentation
¶
Index ¶
- type Provider
- func (p *Provider) AreHooksInstalled(ctx context.Context, repoRoot string) bool
- func (p *Provider) BuildHookEvents(ctx context.Context, event *hooks.Event, bs api.BlobPutter) ([]broker.RawEvent, error)
- func (p *Provider) DiscoverSubagentTranscripts(ctx context.Context, parentTranscriptRef string, _ hooks.DiscoveryContext) ([]string, error)
- func (p *Provider) DisplayName() string
- func (p *Provider) HookBinary(ctx context.Context, repoRoot string) (string, error)
- func (p *Provider) InstallHooks(ctx context.Context, repoRoot string, binaryPath string) (int, error)
- func (p *Provider) IsAvailable() bool
- func (p *Provider) Name() string
- func (p *Provider) ParseHookEvent(ctx context.Context, hookName string, stdin io.Reader) (*hooks.Event, error)
- func (p *Provider) PrepareTranscript(ctx context.Context, transcriptRef string) error
- func (p *Provider) ReadFromOffset(ctx context.Context, transcriptRef string, offset int, bs api.BlobPutter) ([]broker.RawEvent, int, error)
- func (p *Provider) SubagentStateKey(subagentTranscriptRef string) string
- func (p *Provider) TranscriptOffset(ctx context.Context, transcriptRef string) (int, error)
- func (p *Provider) UninstallHooks(ctx context.Context, repoRoot string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct{}
Provider implements hooks.HookProvider for Claude Code.
func New ¶ added in v0.5.1
func New() *Provider
New returns the Claude Code hook provider for explicit registry composition via providers.NewHookRegistry().
func (*Provider) AreHooksInstalled ¶
func (*Provider) BuildHookEvents ¶
func (p *Provider) BuildHookEvents(ctx context.Context, event *hooks.Event, bs api.BlobPutter) ([]broker.RawEvent, error)
BuildHookEvents constructs RawEvents directly from hook payloads. Implements hooks.DirectHookEmitter.
func (*Provider) DiscoverSubagentTranscripts ¶
func (p *Provider) DiscoverSubagentTranscripts(ctx context.Context, parentTranscriptRef string, _ hooks.DiscoveryContext) ([]string, error)
DiscoverSubagentTranscripts scans the subagents/ directory under the parent transcript's session directory and returns paths to all child JSONL files. Claude Code stores subagent transcripts at:
<project>/<parent-uuid>/subagents/<agent-id>.jsonl
Compact files (agent-acompact-*.jsonl) are excluded - they are compaction artifacts that coexist with the original transcript. Since event IDs include the transcript path in their content hash, reading both would produce duplicate events with different IDs, inflating attribution.
func (*Provider) DisplayName ¶
func (*Provider) HookBinary ¶
func (*Provider) InstallHooks ¶
func (*Provider) IsAvailable ¶
func (*Provider) ParseHookEvent ¶
func (*Provider) PrepareTranscript ¶
PrepareTranscript implements hooks.TranscriptPreparer. Claude Code writes transcripts asynchronously. On Stop, wait for the stop-hook sentinel corresponding to this invocation; on other events, fall back to the generic hook_progress sentinel.
func (*Provider) ReadFromOffset ¶
func (p *Provider) ReadFromOffset(ctx context.Context, transcriptRef string, offset int, bs api.BlobPutter) ([]broker.RawEvent, int, error)
ReadFromOffset reads transcript events starting from a line-based offset.
Stale offset policy: Claude Code has no compaction hook, so context compaction can rewrite/truncate the transcript, invalidating saved offsets. When the saved offset exceeds the current line count, we treat it as a compaction rewrite - reset to EOF (accept a gap) rather than read from an invalid position. This matches the ContextCompacted "accept a gap" policy.
func (*Provider) SubagentStateKey ¶
SubagentStateKey returns a stable key for a subagent's capture state, derived from the transcript filename (e.g., "agent-a4d3f93317e599c55").