Documentation
¶
Overview ¶
Package service implements the core business logic for the semantica CLI.
Index ¶
- Variables
- func CompactTokens(n int64) string
- func EnsureProviderGitignore(repoRoot string, installedProviders []string, preExisting map[string]bool) error
- func ExtendBackfillCutoff(ctx context.Context, h *sqlstore.Handle, ...) error
- func FormatDuration(startMs, endMs int64) string
- func InitBackfillState(ctx context.Context, h *sqlstore.Handle, connectedRepoID, repositoryID string) (bool, error)
- func RePushAttribution(ctx context.Context, repoRoot, commitHash, checkpointID string)
- func RelativeTime(ms int64) string
- func SnapshotProviderConfigs(repoRoot string) map[string]bool
- type AIPercentResult
- type AITrendPoint
- type AttributionDiagnostics
- type AttributionInput
- type AttributionResult
- type AttributionService
- func (s *AttributionService) AttributeCommit(ctx context.Context, in AttributionInput) (*AttributionResult, error)
- func (s *AttributionService) Blame(ctx context.Context, in BlameInput) (*AttributionResult, error)
- func (s *AttributionService) ComputeAIPercentFromDiff(ctx context.Context, h *sqlstore.Handle, bs *blobs.Store, diffBytes []byte, ...) (AIPercentResult, error)
- type BackfillResult
- type BlameInput
- type BrokerStatusInfo
- type CheckpointKind
- type CheckpointService
- type CommitMsgHookService
- type ComputeAIPercentInput
- type CreateCheckpointInput
- type CreateCheckpointResult
- type DisableResult
- type DisableService
- type EnableOptions
- type EnableResult
- type EnableService
- type EnableServiceOptions
- type ExplainInput
- type ExplainResult
- type ExplainService
- type FileAttribution
- type FileChange
- type FileDelta
- type GenerateTextFunc
- type LastCheckpointInfo
- type ListCheckpointsInput
- type ListCheckpointsResult
- type ListService
- type ListedCheckpoint
- type NarrativeResultJSON
- type PostCommitResult
- type PostCommitService
- type PreCommitService
- type ProviderAttribution
- type PushAction
- type PushResult
- type RecentSessionInfo
- type RewindInput
- type RewindResult
- type RewindService
- type SaveSummaryInput
- type SessionDetailInput
- type SessionInfo
- type SessionListInput
- type SessionService
- type SessionSummary
- type SessionTranscript
- type SessionTreeResult
- type ShowCheckpointFile
- type ShowCheckpointInput
- type ShowCheckpointResult
- type ShowService
- type StatusInput
- type StatusResult
- type StatusService
- type SuggestInput
- type SuggestPRInput
- type SuggestPRResult
- type SuggestPRService
- type SuggestResult
- type SuggestService
- type TidyAction
- type TidyInput
- type TidyResult
- type TidyService
- type TranscriptEvent
- type TranscriptEventSummary
- type TranscriptMeta
- type TranscriptService
- func (s *TranscriptService) Transcripts(ctx context.Context, in TranscriptsInput) (*TranscriptsResult, error)
- func (s *TranscriptService) TranscriptsForCheckpoint(ctx context.Context, in TranscriptsForCheckpointInput) (*TranscriptsForCheckpointResult, error)
- func (s *TranscriptService) TranscriptsForSession(ctx context.Context, in TranscriptsForSessionInput) (*SessionTranscript, error)
- type TranscriptsForCheckpointInput
- type TranscriptsForCheckpointResult
- type TranscriptsForSessionInput
- type TranscriptsInput
- type TranscriptsResult
- type WorkerInput
- type WorkerService
Constants ¶
This section is empty.
Variables ¶
var ErrNoEventsInWindow = fmt.Errorf("no agent events in delta window")
ErrNoEventsInWindow is returned by ComputeAIPercentFromDiff when no agent events exist in the delta window. The caller can use this to decide whether to attempt an inline ingest before retrying.
var ProviderGitignorePaths = map[string]string{
"claude-code": ".claude/settings.local.json",
"cursor": ".cursor/hooks.json",
"gemini": ".gemini/settings.json",
"copilot": ".github/hooks/semantica.json",
"kiro-ide": ".kiro/hooks/",
"kiro-cli": ".kiro/agents/semantica.json",
}
ProviderGitignorePaths maps hook provider names to repo-local config files that should be gitignored when created by Semantica.
Functions ¶
func CompactTokens ¶
CompactTokens formats a token count as a compact string like "1.5k", "12k", "4.4M".
func EnsureProviderGitignore ¶ added in v0.3.3
func EnsureProviderGitignore(repoRoot string, installedProviders []string, preExisting map[string]bool) error
EnsureProviderGitignore adds gitignore entries for provider config files that were created by Semantica (not pre-existing).
func ExtendBackfillCutoff ¶
func ExtendBackfillCutoff(ctx context.Context, h *sqlstore.Handle, connectedRepoID, repositoryID, commitHash string, linkedAt int64) error
ExtendBackfillCutoff extends the backfill cutoff to include a commit that failed during live push. Re-opens completed backfills if needed.
func FormatDuration ¶
FormatDuration formats a duration in milliseconds between two timestamps as a compact human-readable string.
func InitBackfillState ¶
func InitBackfillState(ctx context.Context, h *sqlstore.Handle, connectedRepoID, repositoryID string) (bool, error)
InitBackfillState snapshots the latest commit link as the replay cutoff and upserts the backfill row. If no commit links exist, returns false.
func RePushAttribution ¶
RePushAttribution re-pushes attribution for a commit to the remote endpoint. Called after auto-playbook saves a summary so the backend gets the enriched playbook_summary and can rematerialize PR comments.
func RelativeTime ¶
RelativeTime formats a unix-milli timestamp as a human-friendly relative duration like "2m", "1h", "3d".
func SnapshotProviderConfigs ¶ added in v0.3.3
SnapshotProviderConfigs returns provider config files that already exist.
Types ¶
type AIPercentResult ¶
type AIPercentResult struct {
Percent float64
TotalLines int
AILines int
ExactLines int // tier 1: exact trimmed match
ModifiedLines int // tier 0 with hunk overlap
FormattedLines int // tier 2: whitespace-normalized match
FilesTouched int // unique files in the diff
Providers []ProviderAttribution
}
AIPercentResult contains the full attribution breakdown returned by ComputeAIPercentFromDiff. The Percent field is the headline number; the remaining fields support richer commit trailers and diagnostics.
type AITrendPoint ¶
type AttributionDiagnostics ¶
type AttributionDiagnostics struct {
EventsConsidered int `json:"events_considered"`
EventsAssistant int `json:"events_assistant"`
PayloadsLoaded int `json:"payloads_loaded"`
AIToolEvents int `json:"ai_tool_events"`
ExactMatches int `json:"exact_matches"`
NormalizedMatches int `json:"normalized_matches"`
ModifiedMatches int `json:"modified_matches"`
Note string `json:"note,omitempty"`
}
AttributionDiagnostics provides transparency into why a particular AI percentage was computed. Useful when AI% is 0 and the user wants to understand which stage of the pipeline had no data.
type AttributionInput ¶
type AttributionInput struct {
RepoPath string // path to the git repository (defaults to ".")
CommitHash string // full or abbreviated commit SHA
}
AttributionInput holds the parameters for an attribution request.
type AttributionResult ¶
type AttributionResult struct {
CommitHash string `json:"commit_hash"`
CheckpointID string `json:"checkpoint_id"`
AIExactLines int `json:"ai_exact_lines"`
AIFormattedLines int `json:"ai_formatted_lines"`
AIModifiedLines int `json:"ai_modified_lines"`
AILines int `json:"ai_lines"` // exact + formatted + modified (headline number)
HumanLines int `json:"human_lines"`
TotalLines int `json:"total_lines"`
AIPercentage float64 `json:"ai_percentage"` // (exact + formatted + modified) / total * 100
FilesAITouched int `json:"files_ai_touched"`
FilesTotal int `json:"files_total"`
FilesCreated []FileChange `json:"files_created,omitempty"`
FilesEdited []FileChange `json:"files_edited,omitempty"`
FilesDeleted []FileChange `json:"files_deleted,omitempty"`
Files []FileAttribution `json:"files,omitempty"`
ProviderDetails []ProviderAttribution `json:"provider_details,omitempty"`
Diagnostics AttributionDiagnostics `json:"diagnostics"`
Evidence string `json:"evidence,omitempty"` // "High", "Medium", "Low"
FallbackCount int `json:"fallback_count,omitempty"` // AI-attributed files with provider-touch or weaker evidence
}
AttributionResult is the full attribution breakdown for a single commit.
type AttributionService ¶
type AttributionService struct{}
AttributionService computes AI vs human attribution for git commits.
func NewAttributionService ¶
func NewAttributionService() *AttributionService
NewAttributionService returns a ready-to-use AttributionService.
func (*AttributionService) AttributeCommit ¶
func (s *AttributionService) AttributeCommit(ctx context.Context, in AttributionInput) (*AttributionResult, error)
AttributeCommit computes the AI attribution breakdown for a single commit.
func (*AttributionService) Blame ¶
func (s *AttributionService) Blame(ctx context.Context, in BlameInput) (*AttributionResult, error)
Blame resolves a generic ref (commit hash or checkpoint ID/prefix) and computes AI attribution. For commits, it produces full line-level attribution against the commit diff. For checkpoints without a commit, it reports AI activity (events and files touched) in the checkpoint's delta window.
func (*AttributionService) ComputeAIPercentFromDiff ¶
func (s *AttributionService) ComputeAIPercentFromDiff( ctx context.Context, h *sqlstore.Handle, bs *blobs.Store, diffBytes []byte, in ComputeAIPercentInput, ) (AIPercentResult, error)
ComputeAIPercentFromDiff computes attribution from a git diff against agent events in a time window. Returns a rich AIPercentResult with per-provider breakdown and tier diagnostics for commit trailers.
Returns ErrNoEventsInWindow when no events exist, allowing the caller to attempt ingestion and retry.
type BackfillResult ¶
type BackfillResult struct {
Uploaded int
Skipped int
Failed bool // true if the batch stopped on a retryable error
Reason string // human-readable reason for failure
Done bool // true if backfill is now complete
}
BackfillResult summarizes one run of the attribution backfill loop.
func DrainBackfillBatch ¶
func DrainBackfillBatch(ctx context.Context, repoRoot, connectedRepoID string, limit int) BackfillResult
DrainBackfillBatch runs up to `limit` replay pushes for the given backfill. It opens the DB, loads backfill state, iterates candidates, and updates cursor/failure state as it goes. Safe to call from connect or worker.
type BlameInput ¶
type BlameInput struct {
RepoPath string // path to the git repository (defaults to ".")
Ref string // commit hash or checkpoint ID/prefix
}
BlameInput holds the parameters for a blame request.
type BrokerStatusInfo ¶
type CheckpointKind ¶
type CheckpointKind string
const ( CheckpointManual CheckpointKind = "manual" CheckpointAuto CheckpointKind = "auto" CheckpointBaseline CheckpointKind = "baseline" )
type CheckpointService ¶
type CheckpointService struct{}
func NewCheckpointService ¶
func NewCheckpointService() *CheckpointService
func (*CheckpointService) Create ¶
func (s *CheckpointService) Create(ctx context.Context, in CreateCheckpointInput) (*CreateCheckpointResult, error)
type CommitMsgHookService ¶
type CommitMsgHookService struct {
RepoPath string
}
func NewCommitMsgHookService ¶
func NewCommitMsgHookService(repoPath string) *CommitMsgHookService
type ComputeAIPercentInput ¶
type ComputeAIPercentInput struct {
RepoRoot string
RepoID string
AfterTs int64 // lower bound of delta window (exclusive)
UpToTs int64 // upper bound of delta window (inclusive, checkpoint created_at)
}
ComputeAIPercentInput holds parameters for the lightweight AI% computation.
type CreateCheckpointInput ¶
type CreateCheckpointInput struct {
RepoPath string
Kind CheckpointKind
Trigger string
Message string
}
type CreateCheckpointResult ¶
type DisableResult ¶
type DisableService ¶
type DisableService struct{}
func NewDisableService ¶
func NewDisableService() *DisableService
func (*DisableService) Disable ¶
func (s *DisableService) Disable(ctx context.Context, repoPath string) (*DisableResult, error)
type EnableOptions ¶
type EnableResult ¶
type EnableResult struct {
RepoRoot string `json:"repo_root"`
SemanticaDir string `json:"semantica_dir"`
DBPath string `json:"db_path"`
RepositoryID string `json:"repository_id,omitempty"`
CheckpointID string `json:"checkpoint_id,omitempty"`
WorkspaceTierTitle string `json:"workspace_tier_title,omitempty"`
UpdateAvailable bool `json:"update_available,omitempty"`
LatestVersion string `json:"latest_version,omitempty"`
UpdateDownloadURL string `json:"update_download_url,omitempty"`
HooksInstalled bool `json:"hooks_installed"`
Providers []string `json:"providers,omitempty"`
}
type EnableService ¶
type EnableService struct {
// contains filtered or unexported fields
}
func NewEnableService ¶
func NewEnableService(opts EnableServiceOptions) (*EnableService, error)
func (*EnableService) Enable ¶
func (s *EnableService) Enable(ctx context.Context, opts EnableOptions) (*EnableResult, error)
type EnableServiceOptions ¶
type EnableServiceOptions struct {
RepoPath string
}
type ExplainInput ¶
type ExplainResult ¶
type ExplainResult struct {
CommitHash string `json:"commit_hash"`
CheckpointID string `json:"checkpoint_id"`
CommitSubject string `json:"commit_subject"`
// Git facts
FilesChanged int `json:"files_changed"`
LinesAdded int `json:"lines_added"`
LinesDeleted int `json:"lines_deleted"`
TopFiles []FileDelta `json:"top_files"`
// Attribution facts
AIPercentage float64 `json:"ai_percentage"`
AILines int `json:"ai_lines"`
HumanLines int `json:"human_lines"`
FilesWithAI int `json:"files_with_ai"`
FilesHumanOnly int `json:"files_human_only"`
// Session facts
SessionCount int `json:"session_count"`
RootSessions int `json:"root_sessions"`
Subagents int `json:"subagents"`
Sessions []SessionSummary `json:"sessions,omitempty"`
// Transcript (for --generate)
Transcript []TranscriptEventSummary `json:"transcript,omitempty"`
// Persisted summary (from --generate)
Summary *NarrativeResultJSON `json:"summary,omitempty"`
}
type ExplainService ¶
type ExplainService struct{}
func NewExplainService ¶
func NewExplainService() *ExplainService
func (*ExplainService) Explain ¶
func (s *ExplainService) Explain(ctx context.Context, in ExplainInput) (*ExplainResult, error)
func (*ExplainService) SaveSummary ¶
func (s *ExplainService) SaveSummary(ctx context.Context, in SaveSummaryInput) error
SaveSummary persists a generated summary to the database.
type FileAttribution ¶
type FileAttribution struct {
Path string `json:"path"`
AIExactLines int `json:"ai_exact_lines"`
AIFormattedLines int `json:"ai_formatted_lines"`
AIModifiedLines int `json:"ai_modified_lines"`
HumanLines int `json:"human_lines"`
TotalLines int `json:"total_lines"`
DeletedNonBlank int `json:"deleted_non_blank"` // deleted non-blank lines (not attributed, display only)
AIPercent float64 `json:"ai_percentage"` // (exact + formatted + modified) / total * 100
EvidenceClass string `json:"evidence_class,omitempty"` // primary evidence class for this file
}
FileAttribution holds per-file line attribution counts using four deterministic categories:
- AI-Exact: line matches AI tool output (trimmed)
- AI-Formatted: matches after whitespace normalization (formatter/linter)
- AI-Modified: in a contiguous group overlapping AI output, but changed
- Human: no overlap with any AI output
type FileChange ¶
FileChange records a file that was created, edited, or deleted in a commit, along with whether the change was performed by an AI agent.
type FileDelta ¶
type FileDelta struct {
Path string `json:"path"`
Added int `json:"added"` // added non-blank lines (same basis as attribution)
Deleted int `json:"deleted"` // deleted non-blank lines
TotalLines int `json:"total_lines"` // equals Added (added non-blank lines)
AILines int `json:"ai_lines"`
HumanLines int `json:"human_lines"`
AIPercent float64 `json:"ai_percentage"`
}
type GenerateTextFunc ¶
GenerateTextFunc matches llm.GenerateText and can be replaced in tests.
type LastCheckpointInfo ¶
type ListCheckpointsInput ¶
type ListCheckpointsResult ¶
type ListCheckpointsResult struct {
RepoRoot string
Items []ListedCheckpoint
}
type ListService ¶
type ListService struct{}
func NewListService ¶
func NewListService() *ListService
func (*ListService) ListCheckpoints ¶
func (s *ListService) ListCheckpoints(ctx context.Context, in ListCheckpointsInput) (*ListCheckpointsResult, error)
type ListedCheckpoint ¶
type NarrativeResultJSON ¶
type NarrativeResultJSON struct {
Title string `json:"title"`
Intent string `json:"intent"`
Outcome string `json:"outcome"`
Learnings []string `json:"learnings"`
Friction []string `json:"friction"`
OpenItems []string `json:"open_items"`
Keywords []string `json:"keywords"`
}
NarrativeResultJSON is the persisted form of an LLM-generated playbook.
type PostCommitResult ¶
type PostCommitService ¶
type PostCommitService struct{}
func NewPostCommitService ¶
func NewPostCommitService() *PostCommitService
func (*PostCommitService) HandlePostCommit ¶
func (s *PostCommitService) HandlePostCommit(ctx context.Context, repoPath string) (*PostCommitResult, error)
type PreCommitService ¶
type PreCommitService struct{}
func NewPreCommitService ¶
func NewPreCommitService() *PreCommitService
func (*PreCommitService) HandlePreCommit ¶
func (s *PreCommitService) HandlePreCommit(ctx context.Context, repoPath string) error
type ProviderAttribution ¶
ProviderAttribution holds per-provider AI line counts for trailer output.
type PushAction ¶
type PushAction string
PushAction classifies the outcome of a push attempt.
const ( PushUploaded PushAction = "uploaded" // remote upsert succeeded PushRetry PushAction = "retry" // transient remote/auth failure PushSkip PushAction = "skip" // local failure or permanently non-retryable )
type PushResult ¶
type PushResult struct {
CommitHash string
CheckpointID string
Action PushAction
AIPercentage float64
Err error
}
PushResult is the structured outcome of tryPushAttribution.
type RecentSessionInfo ¶
type RecentSessionInfo struct {
SessionID string `json:"session_id"`
Provider string `json:"provider"`
StartedAt int64 `json:"started_at"`
LastEventAt int64 `json:"last_event_at"`
StepCount int64 `json:"step_count"`
TokensIn int64 `json:"tokens_in"`
TokensOut int64 `json:"tokens_out"`
TokensCached int64 `json:"tokens_cached,omitempty"`
}
type RewindInput ¶
type RewindResult ¶
type RewindService ¶
type RewindService struct{}
func NewRewindService ¶
func NewRewindService() *RewindService
func (*RewindService) Rewind ¶
func (s *RewindService) Rewind(ctx context.Context, in RewindInput) (*RewindResult, error)
type SaveSummaryInput ¶
type SaveSummaryInput struct {
RepoPath string
CheckpointID string
Summary *NarrativeResultJSON
Model string
}
SaveSummaryInput contains the data needed to persist a generated summary.
type SessionDetailInput ¶
SessionDetailInput holds parameters for a single-session lookup.
type SessionInfo ¶
type SessionInfo struct {
SessionID string `json:"session_id"`
ProviderSessionID string `json:"provider_session_id"`
Provider string `json:"provider"`
ParentSessionID string `json:"parent_session_id,omitempty"`
StartedAt string `json:"started_at"`
LastEventAt string `json:"last_event_at"`
LastEventAtMs int64 `json:"-"` // unix millis, for relative time formatting
StepCount int64 `json:"step_count"`
ToolCallCount int64 `json:"tool_call_count"`
TokensIn int64 `json:"tokens_in"`
TokensOut int64 `json:"tokens_out"`
TokensCached int64 `json:"tokens_cached,omitempty"`
Children []*SessionInfo `json:"children,omitempty"`
}
type SessionListInput ¶
type SessionService ¶
type SessionService struct{}
func NewSessionService ¶
func NewSessionService() *SessionService
func (*SessionService) GetSession ¶
func (s *SessionService) GetSession(ctx context.Context, in SessionDetailInput) (*SessionInfo, error)
GetSession resolves a session ID (prefix or full) and returns its stats.
func (*SessionService) ListSessions ¶
func (s *SessionService) ListSessions(ctx context.Context, in SessionListInput) (*SessionTreeResult, error)
type SessionSummary ¶
type SessionSummary struct {
SessionID string `json:"session_id"`
Provider string `json:"provider"`
IsSubagent bool `json:"is_subagent,omitempty"`
StepCount int64 `json:"step_count"`
ToolCallCount int64 `json:"tool_call_count"`
TokensIn int64 `json:"tokens_in"`
TokensOut int64 `json:"tokens_out"`
TokensCached int64 `json:"tokens_cached,omitempty"`
}
type SessionTranscript ¶
type SessionTranscript struct {
SessionID string `json:"session_id"`
ProviderSessionID string `json:"provider_session_id"`
Provider string `json:"provider"`
Events []TranscriptEvent `json:"events"`
}
type SessionTreeResult ¶
type SessionTreeResult struct {
Roots []*SessionInfo `json:"sessions"`
Total int `json:"total"`
}
SessionTreeResult holds the tree-structured session list.
type ShowCheckpointFile ¶
type ShowCheckpointInput ¶
type ShowCheckpointResult ¶
type ShowCheckpointResult struct {
RepoRoot string `json:"repo_root"`
CheckpointID string `json:"checkpoint_id"`
CommitHash string `json:"commit_hash,omitempty"`
CreatedAtUnix int64 `json:"created_at_unix"`
CreatedAt string `json:"created_at"` // RFC3339
Kind string `json:"kind"`
Trigger string `json:"trigger,omitempty"`
Message string `json:"message,omitempty"`
ManifestHash string `json:"manifest_hash"`
Bytes *int64 `json:"bytes,omitempty"`
FileCount int `json:"file_count"`
Files []ShowCheckpointFile `json:"files"`
}
type ShowService ¶
type ShowService struct{}
func NewShowService ¶
func NewShowService() *ShowService
func (*ShowService) ShowCheckpoint ¶
func (s *ShowService) ShowCheckpoint(ctx context.Context, in ShowCheckpointInput) (*ShowCheckpointResult, error)
type StatusInput ¶
type StatusInput struct {
RepoPath string
}
type StatusResult ¶
type StatusResult struct {
Enabled bool `json:"enabled"`
RepoRoot string `json:"repo_root"`
Connected bool `json:"connected"`
HasRemote bool `json:"has_remote"`
Endpoint string `json:"endpoint"`
RepoProvider string `json:"repo_provider"`
WorkspaceTierTitle string `json:"workspace_tier_title,omitempty"`
UpdateAvailable bool `json:"update_available,omitempty"`
LatestVersion string `json:"latest_version,omitempty"`
UpdateDownloadURL string `json:"update_download_url,omitempty"`
AutoPlaybook bool `json:"auto_playbook"`
AutoImplSummary bool `json:"auto_implementation_summary"`
GitTrailers bool `json:"git_trailers"`
LastCheckpoint *LastCheckpointInfo `json:"last_checkpoint,omitempty"`
RecentSessions []RecentSessionInfo `json:"recent_sessions,omitempty"`
AITrend []AITrendPoint `json:"ai_trend,omitempty"`
PlaybookCount int64 `json:"playbook_count"`
Providers []string `json:"providers"`
Broker *BrokerStatusInfo `json:"broker,omitempty"`
}
type StatusService ¶
type StatusService struct{}
func NewStatusService ¶
func NewStatusService() *StatusService
func (*StatusService) Status ¶
func (s *StatusService) Status(ctx context.Context, in StatusInput) (*StatusResult, error)
type SuggestInput ¶
type SuggestInput struct {
RepoPath string
}
type SuggestPRInput ¶
type SuggestPRResult ¶
type SuggestPRService ¶
type SuggestPRService struct {
GenerateText GenerateTextFunc
}
func NewSuggestPRService ¶
func NewSuggestPRService() *SuggestPRService
func (*SuggestPRService) SuggestPR ¶
func (s *SuggestPRService) SuggestPR(ctx context.Context, in SuggestPRInput) (*SuggestPRResult, error)
type SuggestResult ¶
type SuggestService ¶
type SuggestService struct{}
func NewSuggestService ¶
func NewSuggestService() *SuggestService
func (*SuggestService) Suggest ¶
func (s *SuggestService) Suggest(ctx context.Context, in SuggestInput) (*SuggestResult, error)
type TidyAction ¶
type TidyAction struct {
Category string `json:"category"`
ID string `json:"id"`
Detail string `json:"detail"`
}
TidyAction describes one reported cleanup item.
type TidyResult ¶
type TidyResult struct {
DryRun bool `json:"dry_run"`
BrokerEntriesPruned int `json:"broker_entries_pruned"`
CaptureStatesRemoved int `json:"capture_states_removed"`
CheckpointsMarked int `json:"checkpoints_marked_failed"`
ImplStale int `json:"implementations_stale,omitempty"`
ImplConflicts int `json:"implementations_conflicts,omitempty"`
ImplFailedObs int `json:"implementations_failed_observations,omitempty"`
ImplObsPruned int `json:"implementations_observations_pruned,omitempty"`
Errors int `json:"errors,omitempty"`
Actions []TidyAction `json:"actions,omitempty"`
}
type TidyService ¶
type TidyService struct{}
func NewTidyService ¶
func NewTidyService() *TidyService
func (*TidyService) Tidy ¶
func (s *TidyService) Tidy(ctx context.Context, in TidyInput) (*TidyResult, error)
type TranscriptEvent ¶
type TranscriptEvent struct {
EventID string `json:"event_id"`
SessionID string `json:"session_id"`
Provider string `json:"provider,omitempty"`
Ts int64 `json:"ts"`
TsISO string `json:"ts_iso"`
Kind string `json:"kind"`
Role string `json:"role,omitempty"`
RoleUpper string `json:"role_upper,omitempty"`
ToolName string `json:"tool_name,omitempty"`
FilePath string `json:"file_path,omitempty"`
FileOp string `json:"file_op,omitempty"`
HasThinking bool `json:"has_thinking,omitempty"`
ToolUsesJSON string `json:"tool_uses,omitempty"`
TokensIn int64 `json:"tokens_in,omitempty"`
TokensOut int64 `json:"tokens_out,omitempty"`
TokensCacheRead int64 `json:"tokens_cache_read,omitempty"`
TokensCacheCreate int64 `json:"tokens_cache_create,omitempty"`
Summary string `json:"summary,omitempty"`
ProviderEventID string `json:"provider_event_id,omitempty"`
PayloadHash string `json:"payload_hash,omitempty"`
Payload string `json:"payload,omitempty"` // only when Raw=true
}
type TranscriptEventSummary ¶
type TranscriptEventSummary struct {
Role string `json:"role"`
Summary string `json:"summary,omitempty"`
ToolName string `json:"tool_name,omitempty"`
FilePath string `json:"file_path,omitempty"`
}
TranscriptEventSummary is a lightweight event for the condensed transcript.
type TranscriptMeta ¶
type TranscriptService ¶
type TranscriptService struct{}
func NewTranscriptService ¶
func NewTranscriptService() *TranscriptService
func (*TranscriptService) Transcripts ¶
func (s *TranscriptService) Transcripts(ctx context.Context, in TranscriptsInput) (*TranscriptsResult, error)
Transcripts is the polymorphic entry point: resolves Ref as either a checkpoint or session ID, then delegates to the appropriate method.
func (*TranscriptService) TranscriptsForCheckpoint ¶
func (s *TranscriptService) TranscriptsForCheckpoint(ctx context.Context, in TranscriptsForCheckpointInput) (*TranscriptsForCheckpointResult, error)
func (*TranscriptService) TranscriptsForSession ¶
func (s *TranscriptService) TranscriptsForSession(ctx context.Context, in TranscriptsForSessionInput) (*SessionTranscript, error)
TranscriptsForSession loads the transcript for a specific session by ID.
type TranscriptsForCheckpointInput ¶
type TranscriptsForCheckpointInput struct {
RepoPath string
CheckpointID string
Raw bool // if true, load payload JSON from blob store
Verbose bool // reserved for CLI formatting; included for symmetry
Cumulative bool // if true, show all events up to checkpoint; default is delta (since previous checkpoint)
BySession bool // if true, group events by session
SessionID string // if set, filter to a specific session
Commit bool // if true, filter to sessions that touched files in the commit diff
}
type TranscriptsForCheckpointResult ¶
type TranscriptsForCheckpointResult struct {
Meta TranscriptMeta `json:"meta"`
Events []TranscriptEvent `json:"events"`
Sessions []SessionTranscript `json:"sessions,omitempty"`
}
type TranscriptsForSessionInput ¶
TranscriptsForSessionInput holds parameters for session-first transcript access.
type TranscriptsInput ¶
type TranscriptsInput struct {
RepoPath string
Ref string
ForceCheckpoint bool
ForceSession bool
// Checkpoint-mode flags (ignored/invalid in session mode).
Raw bool
Verbose bool
Cumulative bool
BySession bool
FilterSessionID string
Commit bool
}
TranscriptsInput is the polymorphic entry point. Ref is resolved as a checkpoint or session ID (prefix matching). ForceCheckpoint / ForceSession bypass auto-resolution.
type TranscriptsResult ¶
type TranscriptsResult struct {
ResolvedAs string `json:"resolved_as"` // "checkpoint" or "session"
Checkpoint *TranscriptsForCheckpointResult `json:"checkpoint,omitempty"`
Session *SessionTranscript `json:"session,omitempty"`
}
TranscriptsResult wraps the output from either resolution path.
type WorkerInput ¶
type WorkerService ¶
type WorkerService struct{}
func NewWorkerService ¶
func NewWorkerService() *WorkerService
func (*WorkerService) Run ¶
func (s *WorkerService) Run(ctx context.Context, in WorkerInput) error
Source Files
¶
- attribution.go
- attribution_summary.go
- backfill.go
- checkpoint.go
- disable.go
- enable.go
- explain.go
- hook_commit_msg.go
- list.go
- post-commit.go
- pre-commit.go
- rewind.go
- sessions.go
- show.go
- status.go
- suggest.go
- suggest_pr.go
- tidy.go
- transcripts.go
- worker.go
- worker_enrich.go
- worker_impl.go
- worker_manifest.go
- worker_provenance.go
- worker_push.go
- worker_reconcile.go
- worker_spawn.go