Documentation
¶
Index ¶
- type AdvanceBackfillCursorParams
- type AgentEvent
- type AgentEventEvidenceLink
- type AgentSession
- type AgentSource
- type Checkpoint
- type CheckpointStat
- type ClaimCheckpointParams
- type CommitLink
- type CompleteBackfillParams
- type CompleteCheckpointParams
- type CountManifestsByStatusParams
- type CountManifestsByStatusRow
- type CountWindowTurnProvenanceParams
- type CountWindowTurnProvenanceRow
- type DBTX
- type FailCheckpointParams
- type GetAgentSessionByProviderIDParams
- type GetCheckpointSummaryRow
- type GetEvidenceLinkParams
- type GetLatestCommitLinkRow
- type GetManifestCommitLinkParams
- type GetManifestCommitLinkRow
- type GetMostRecentParentSessionWithEventsParams
- type GetMostRecentSessionByProviderWithEventsParams
- type GetNextToolResultAfterParams
- type GetNextToolResultAfterRow
- type GetPreviousCommitLinkedCheckpointParams
- type GetPreviousCompletedCheckpointParams
- type GetPromptEventForTurnParams
- type GetPromptEventForTurnRow
- type GetSessionWithStatsRow
- type InsertAgentEventParams
- type InsertCheckpointParams
- type InsertCommitLinkParams
- type InsertEvidenceLinkIfAbsentParams
- type InsertRepositoryParams
- type InsertSessionCheckpointParams
- type ListAgentEventsBySessionPagedParams
- type ListAgentEventsBySessionParams
- type ListAgentSessionsByProviderSessionIDParams
- type ListBackfillReplayCandidatesParams
- type ListBackfillReplayCandidatesRow
- type ListCheckpointsByRepositoryParams
- type ListCheckpointsWithCommitParams
- type ListCheckpointsWithCommitRow
- type ListCommitLinksByRepositoryParams
- type ListCrossRepoSessionsParams
- type ListEventsByProviderInWindowParams
- type ListEventsByProviderInWindowRow
- type ListEventsBySessionASCRow
- type ListEventsInWindowForAnnotationsParams
- type ListEventsInWindowForAnnotationsRow
- type ListEventsInWindowParams
- type ListEventsInWindowRow
- type ListEvidenceLinksInWindowParams
- type ListEvidenceLinksInWindowRow
- type ListFailedManifestReasonsParams
- type ListFailedManifestReasonsRow
- type ListPackagedManifestsParams
- type ListPendingCommitLinkedCheckpointsRow
- type ListPendingManifestsParams
- type ListRecentAIPercentagesParams
- type ListRecentAIPercentagesRow
- type ListRecentSessionsWithStatsParams
- type ListRecentSessionsWithStatsRow
- type ListSessionsForRepositoryParams
- type ListSessionsWithEventsInWindowParams
- type ListSessionsWithStatsAllParams
- type ListSessionsWithStatsAllRow
- type ListSessionsWithStatsParams
- type ListSessionsWithStatsRow
- type ListStalePendingCheckpointsParams
- type ListStalePendingCheckpointsRow
- type ListStepCompanionResultsParams
- type ListStepCompanionResultsRow
- type ListStepEventsForTurnParams
- type ListStepEventsForTurnRow
- type ListStepProvenanceForTurnParams
- type ListStepProvenanceForTurnRow
- type ListTranscriptEventsParams
- type ListTranscriptEventsRow
- type ListUserPromptsForCommitRow
- type MarkCheckpointAttributionComputedParams
- type MarkCheckpointAttributionPushedParams
- type MarkManifestFailedParams
- type MarkManifestUploadedParams
- type MarkManifestUploadingParams
- type ProvenanceManifest
- type Queries
- func (q *Queries) AdvanceBackfillCursor(ctx context.Context, arg AdvanceBackfillCursorParams) error
- func (q *Queries) AgentEventExists(ctx context.Context, eventID string) (bool, error)
- func (q *Queries) ClaimCheckpoint(ctx context.Context, arg ClaimCheckpointParams) (Checkpoint, error)
- func (q *Queries) Close() error
- func (q *Queries) CompleteBackfill(ctx context.Context, arg CompleteBackfillParams) error
- func (q *Queries) CompleteCheckpoint(ctx context.Context, arg CompleteCheckpointParams) error
- func (q *Queries) CountCheckpointsWithSummary(ctx context.Context, repositoryID string) (int64, error)
- func (q *Queries) CountManifestsByStatus(ctx context.Context, arg CountManifestsByStatusParams) ([]CountManifestsByStatusRow, error)
- func (q *Queries) CountSessionsForCheckpoint(ctx context.Context, checkpointID string) (int64, error)
- func (q *Queries) CountWindowTurnProvenance(ctx context.Context, arg CountWindowTurnProvenanceParams) (CountWindowTurnProvenanceRow, error)
- func (q *Queries) DeleteCheckpointByID(ctx context.Context, checkpointID string) error
- func (q *Queries) FailCheckpoint(ctx context.Context, arg FailCheckpointParams) (int64, error)
- func (q *Queries) GetActiveAgentSessionForRepo(ctx context.Context, repositoryID string) (AgentSession, error)
- func (q *Queries) GetAgentSessionByID(ctx context.Context, sessionID string) (AgentSession, error)
- func (q *Queries) GetAgentSessionByProviderID(ctx context.Context, arg GetAgentSessionByProviderIDParams) (AgentSession, error)
- func (q *Queries) GetAttributionBackfill(ctx context.Context, connectedRepoID string) (RemoteAttributionBackfill, error)
- func (q *Queries) GetCheckpointByID(ctx context.Context, checkpointID string) (Checkpoint, error)
- func (q *Queries) GetCheckpointStats(ctx context.Context, checkpointID string) (CheckpointStat, error)
- func (q *Queries) GetCheckpointSummary(ctx context.Context, checkpointID string) (GetCheckpointSummaryRow, error)
- func (q *Queries) GetCommitLinkByCommitHash(ctx context.Context, commitHash string) (CommitLink, error)
- func (q *Queries) GetCommitLinksByCheckpoint(ctx context.Context, checkpointID string) ([]CommitLink, error)
- func (q *Queries) GetEvidenceLink(ctx context.Context, arg GetEvidenceLinkParams) (AgentEventEvidenceLink, error)
- func (q *Queries) GetLatestCheckpointForRepo(ctx context.Context, repositoryID string) (Checkpoint, error)
- func (q *Queries) GetLatestCommitLink(ctx context.Context, repositoryID string) (GetLatestCommitLinkRow, error)
- func (q *Queries) GetManifestCommitLink(ctx context.Context, arg GetManifestCommitLinkParams) (GetManifestCommitLinkRow, error)
- func (q *Queries) GetMostRecentCommitLinkedCheckpoint(ctx context.Context, repositoryID string) (Checkpoint, error)
- func (q *Queries) GetMostRecentParentSessionWithEvents(ctx context.Context, arg GetMostRecentParentSessionWithEventsParams) (AgentSession, error)
- func (q *Queries) GetMostRecentSessionByProviderWithEvents(ctx context.Context, arg GetMostRecentSessionByProviderWithEventsParams) (AgentSession, error)
- func (q *Queries) GetNextToolResultAfter(ctx context.Context, arg GetNextToolResultAfterParams) (GetNextToolResultAfterRow, error)
- func (q *Queries) GetPreviousCommitLinkedCheckpoint(ctx context.Context, arg GetPreviousCommitLinkedCheckpointParams) (Checkpoint, error)
- func (q *Queries) GetPreviousCompletedCheckpoint(ctx context.Context, arg GetPreviousCompletedCheckpointParams) (Checkpoint, error)
- func (q *Queries) GetPromptEventForTurn(ctx context.Context, arg GetPromptEventForTurnParams) (GetPromptEventForTurnRow, error)
- func (q *Queries) GetRepositoryByID(ctx context.Context, repositoryID string) (Repository, error)
- func (q *Queries) GetRepositoryByRootPath(ctx context.Context, rootPath string) (Repository, error)
- func (q *Queries) GetSessionWithStats(ctx context.Context, sessionID string) (GetSessionWithStatsRow, error)
- func (q *Queries) InsertAgentEvent(ctx context.Context, arg InsertAgentEventParams) error
- func (q *Queries) InsertCheckpoint(ctx context.Context, arg InsertCheckpointParams) error
- func (q *Queries) InsertCommitLink(ctx context.Context, arg InsertCommitLinkParams) error
- func (q *Queries) InsertEvidenceLinkIfAbsent(ctx context.Context, arg InsertEvidenceLinkIfAbsentParams) error
- func (q *Queries) InsertRepository(ctx context.Context, arg InsertRepositoryParams) error
- func (q *Queries) InsertSessionCheckpoint(ctx context.Context, arg InsertSessionCheckpointParams) error
- func (q *Queries) ListAgentEventsBySession(ctx context.Context, arg ListAgentEventsBySessionParams) ([]AgentEvent, error)
- func (q *Queries) ListAgentEventsBySessionPaged(ctx context.Context, arg ListAgentEventsBySessionPagedParams) ([]AgentEvent, error)
- func (q *Queries) ListAgentSessionsByProviderSessionID(ctx context.Context, arg ListAgentSessionsByProviderSessionIDParams) ([]AgentSession, error)
- func (q *Queries) ListBackfillReplayCandidates(ctx context.Context, arg ListBackfillReplayCandidatesParams) ([]ListBackfillReplayCandidatesRow, error)
- func (q *Queries) ListCheckpointsByRepository(ctx context.Context, arg ListCheckpointsByRepositoryParams) ([]Checkpoint, error)
- func (q *Queries) ListCheckpointsWithCommit(ctx context.Context, arg ListCheckpointsWithCommitParams) ([]ListCheckpointsWithCommitRow, error)
- func (q *Queries) ListCommitLinksByRepository(ctx context.Context, arg ListCommitLinksByRepositoryParams) ([]CommitLink, error)
- func (q *Queries) ListCrossRepoSessions(ctx context.Context, arg ListCrossRepoSessionsParams) ([]AgentSession, error)
- func (q *Queries) ListDistinctProviders(ctx context.Context, repositoryID string) ([]string, error)
- func (q *Queries) ListEventsByProviderInWindow(ctx context.Context, arg ListEventsByProviderInWindowParams) ([]ListEventsByProviderInWindowRow, error)
- func (q *Queries) ListEventsBySessionASC(ctx context.Context, sessionID string) ([]ListEventsBySessionASCRow, error)
- func (q *Queries) ListEventsInWindow(ctx context.Context, arg ListEventsInWindowParams) ([]ListEventsInWindowRow, error)
- func (q *Queries) ListEventsInWindowForAnnotations(ctx context.Context, arg ListEventsInWindowForAnnotationsParams) ([]ListEventsInWindowForAnnotationsRow, error)
- func (q *Queries) ListEvidenceLinksByEvent(ctx context.Context, eventID string) ([]AgentEventEvidenceLink, error)
- func (q *Queries) ListEvidenceLinksByGroup(ctx context.Context, groupID string) ([]AgentEventEvidenceLink, error)
- func (q *Queries) ListEvidenceLinksInWindow(ctx context.Context, arg ListEvidenceLinksInWindowParams) ([]ListEvidenceLinksInWindowRow, error)
- func (q *Queries) ListFailedManifestReasons(ctx context.Context, arg ListFailedManifestReasonsParams) ([]ListFailedManifestReasonsRow, error)
- func (q *Queries) ListPackagedManifests(ctx context.Context, arg ListPackagedManifestsParams) ([]ProvenanceManifest, error)
- func (q *Queries) ListPendingCommitLinkedCheckpoints(ctx context.Context, repositoryID string) ([]ListPendingCommitLinkedCheckpointsRow, error)
- func (q *Queries) ListPendingManifests(ctx context.Context, arg ListPendingManifestsParams) ([]ProvenanceManifest, error)
- func (q *Queries) ListProvidersByCheckpoint(ctx context.Context, checkpointID string) ([]string, error)
- func (q *Queries) ListRecentAIPercentages(ctx context.Context, arg ListRecentAIPercentagesParams) ([]ListRecentAIPercentagesRow, error)
- func (q *Queries) ListRecentSessionsWithStats(ctx context.Context, arg ListRecentSessionsWithStatsParams) ([]ListRecentSessionsWithStatsRow, error)
- func (q *Queries) ListRepositories(ctx context.Context) ([]Repository, error)
- func (q *Queries) ListSessionsForCheckpoint(ctx context.Context, checkpointID string) ([]AgentSession, error)
- func (q *Queries) ListSessionsForRepository(ctx context.Context, arg ListSessionsForRepositoryParams) ([]AgentSession, error)
- func (q *Queries) ListSessionsWithEventsInWindow(ctx context.Context, arg ListSessionsWithEventsInWindowParams) ([]string, error)
- func (q *Queries) ListSessionsWithStats(ctx context.Context, arg ListSessionsWithStatsParams) ([]ListSessionsWithStatsRow, error)
- func (q *Queries) ListSessionsWithStatsAll(ctx context.Context, arg ListSessionsWithStatsAllParams) ([]ListSessionsWithStatsAllRow, error)
- func (q *Queries) ListStalePendingCheckpoints(ctx context.Context, arg ListStalePendingCheckpointsParams) ([]ListStalePendingCheckpointsRow, error)
- func (q *Queries) ListStepCompanionResults(ctx context.Context, arg ListStepCompanionResultsParams) ([]ListStepCompanionResultsRow, error)
- func (q *Queries) ListStepEventsForTurn(ctx context.Context, arg ListStepEventsForTurnParams) ([]ListStepEventsForTurnRow, error)
- func (q *Queries) ListStepProvenanceForTurn(ctx context.Context, arg ListStepProvenanceForTurnParams) ([]ListStepProvenanceForTurnRow, error)
- func (q *Queries) ListTranscriptEvents(ctx context.Context, arg ListTranscriptEventsParams) ([]ListTranscriptEventsRow, error)
- func (q *Queries) ListUserPromptsForCommit(ctx context.Context, commitHash string) ([]ListUserPromptsForCommitRow, error)
- func (q *Queries) MarkCheckpointAttributionComputed(ctx context.Context, arg MarkCheckpointAttributionComputedParams) error
- func (q *Queries) MarkCheckpointAttributionPushed(ctx context.Context, arg MarkCheckpointAttributionPushedParams) error
- func (q *Queries) MarkManifestFailed(ctx context.Context, arg MarkManifestFailedParams) error
- func (q *Queries) MarkManifestUploaded(ctx context.Context, arg MarkManifestUploadedParams) error
- func (q *Queries) MarkManifestUploading(ctx context.Context, arg MarkManifestUploadingParams) (int64, error)
- func (q *Queries) PromptEventExists(ctx context.Context, turnID sql.NullString) (bool, error)
- func (q *Queries) RecordBackfillFailure(ctx context.Context, arg RecordBackfillFailureParams) error
- func (q *Queries) RecoverStaleUploading(ctx context.Context, arg RecoverStaleUploadingParams) error
- func (q *Queries) ReleaseCheckpointForRetry(ctx context.Context, arg ReleaseCheckpointForRetryParams) (int64, error)
- func (q *Queries) ResetManifestForRetry(ctx context.Context, arg ResetManifestForRetryParams) error
- func (q *Queries) ResetManifestToPackaged(ctx context.Context, arg ResetManifestToPackagedParams) error
- func (q *Queries) ResolveCheckpointByPrefix(ctx context.Context, arg ResolveCheckpointByPrefixParams) ([]string, error)
- func (q *Queries) ResolveCommitLinkByPrefix(ctx context.Context, arg ResolveCommitLinkByPrefixParams) ([]string, error)
- func (q *Queries) ResolveSessionByPrefix(ctx context.Context, arg ResolveSessionByPrefixParams) ([]string, error)
- func (q *Queries) RetryFailedCheckpoint(ctx context.Context, checkpointID string) (int64, error)
- func (q *Queries) SaveCheckpointSummary(ctx context.Context, arg SaveCheckpointSummaryParams) error
- func (q *Queries) StepEventExists(ctx context.Context, arg StepEventExistsParams) (bool, error)
- func (q *Queries) UpdateCheckpointAIPercentage(ctx context.Context, arg UpdateCheckpointAIPercentageParams) error
- func (q *Queries) UpdateRepositoryEnabledAt(ctx context.Context, arg UpdateRepositoryEnabledAtParams) error
- func (q *Queries) UpsertAgentSession(ctx context.Context, arg UpsertAgentSessionParams) (AgentSession, error)
- func (q *Queries) UpsertAgentSource(ctx context.Context, arg UpsertAgentSourceParams) (AgentSource, error)
- func (q *Queries) UpsertAttributionBackfill(ctx context.Context, arg UpsertAttributionBackfillParams) error
- func (q *Queries) UpsertCheckpointStats(ctx context.Context, arg UpsertCheckpointStatsParams) error
- func (q *Queries) UpsertProvenanceManifest(ctx context.Context, arg UpsertProvenanceManifestParams) error
- func (q *Queries) WithTx(tx *sql.Tx) *Queries
- type RecordBackfillFailureParams
- type RecoverStaleUploadingParams
- type ReleaseCheckpointForRetryParams
- type RemoteAttributionBackfill
- type Repository
- type ResetManifestForRetryParams
- type ResetManifestToPackagedParams
- type ResolveCheckpointByPrefixParams
- type ResolveCommitLinkByPrefixParams
- type ResolveSessionByPrefixParams
- type SaveCheckpointSummaryParams
- type SessionCheckpoint
- type StepEventExistsParams
- type UpdateCheckpointAIPercentageParams
- type UpdateRepositoryEnabledAtParams
- type UpsertAgentSessionParams
- type UpsertAgentSourceParams
- type UpsertAttributionBackfillParams
- type UpsertCheckpointStatsParams
- type UpsertProvenanceManifestParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentEvent ¶
type AgentEvent struct {
EventID string `json:"event_id"`
SessionID string `json:"session_id"`
RepositoryID string `json:"repository_id"`
Ts int64 `json:"ts"`
Kind string `json:"kind"`
PayloadHash sql.NullString `json:"payload_hash"`
Role sql.NullString `json:"role"`
ToolUses sql.NullString `json:"tool_uses"`
TokensIn sql.NullInt64 `json:"tokens_in"`
TokensOut sql.NullInt64 `json:"tokens_out"`
TokensCacheRead sql.NullInt64 `json:"tokens_cache_read"`
TokensCacheCreate sql.NullInt64 `json:"tokens_cache_create"`
Summary sql.NullString `json:"summary"`
ProviderEventID sql.NullString `json:"provider_event_id"`
TurnID sql.NullString `json:"turn_id"`
ToolUseID sql.NullString `json:"tool_use_id"`
ToolName sql.NullString `json:"tool_name"`
EventSource string `json:"event_source"`
ProvenanceHash sql.NullString `json:"provenance_hash"`
InsertSeq sql.NullInt64 `json:"insert_seq"`
}
type AgentEventEvidenceLink ¶ added in v0.6.0
type AgentSession ¶
type AgentSession struct {
SessionID string `json:"session_id"`
ProviderSessionID string `json:"provider_session_id"`
ParentSessionID sql.NullString `json:"parent_session_id"`
RepositoryID string `json:"repository_id"`
Provider string `json:"provider"`
SourceID string `json:"source_id"`
StartedAt int64 `json:"started_at"`
LastSeenAt int64 `json:"last_seen_at"`
MetadataJson string `json:"metadata_json"`
SourceRepoPath sql.NullString `json:"source_repo_path"`
Model sql.NullString `json:"model"`
}
type AgentSource ¶
type Checkpoint ¶
type Checkpoint struct {
CheckpointID string `json:"checkpoint_id"`
RepositoryID string `json:"repository_id"`
CreatedAt int64 `json:"created_at"`
Kind string `json:"kind"`
Trigger sql.NullString `json:"trigger"`
Message sql.NullString `json:"message"`
ManifestHash sql.NullString `json:"manifest_hash"`
SizeBytes sql.NullInt64 `json:"size_bytes"`
Status string `json:"status"`
CompletedAt sql.NullInt64 `json:"completed_at"`
SummaryJson sql.NullString `json:"summary_json"`
SummaryModel sql.NullString `json:"summary_model"`
RepositorySequence int64 `json:"repository_sequence"`
EventCursor sql.NullInt64 `json:"event_cursor"`
AttemptCount int64 `json:"attempt_count"`
LastError sql.NullString `json:"last_error"`
NextAttemptAt int64 `json:"next_attempt_at"`
LeaseOwner sql.NullString `json:"lease_owner"`
LeaseUntil sql.NullInt64 `json:"lease_until"`
}
type CheckpointStat ¶
type CheckpointStat struct {
CheckpointID string `json:"checkpoint_id"`
SessionCount int64 `json:"session_count"`
FilesChanged int64 `json:"files_changed"`
AiPercentage float64 `json:"ai_percentage"`
AttributionComputedAt sql.NullInt64 `json:"attribution_computed_at"`
AttributionPushedAt sql.NullInt64 `json:"attribution_pushed_at"`
}
type ClaimCheckpointParams ¶ added in v0.6.0
type CommitLink ¶
type CompleteBackfillParams ¶
type CountManifestsByStatusParams ¶ added in v0.3.9
type CountManifestsByStatusRow ¶ added in v0.3.9
type CountWindowTurnProvenanceParams ¶ added in v0.6.0
type CountWindowTurnProvenanceRow ¶ added in v0.6.0
type FailCheckpointParams ¶
type FailCheckpointParams struct {
CompletedAt sql.NullInt64 `json:"completed_at"`
LastError sql.NullString `json:"last_error"`
CheckpointID string `json:"checkpoint_id"`
}
type GetCheckpointSummaryRow ¶
type GetCheckpointSummaryRow struct {
CheckpointID string `json:"checkpoint_id"`
SummaryJson sql.NullString `json:"summary_json"`
SummaryModel sql.NullString `json:"summary_model"`
}
type GetEvidenceLinkParams ¶ added in v0.6.0
type GetLatestCommitLinkRow ¶
type GetMostRecentParentSessionWithEventsParams ¶ added in v0.4.0
type GetMostRecentSessionByProviderWithEventsParams ¶ added in v0.4.0
type GetNextToolResultAfterParams ¶
type GetNextToolResultAfterParams struct {
SessionID string `json:"session_id"`
TurnID sql.NullString `json:"turn_id"`
Ts int64 `json:"ts"`
}
type GetNextToolResultAfterRow ¶
type GetNextToolResultAfterRow struct {
EventID string `json:"event_id"`
PayloadHash sql.NullString `json:"payload_hash"`
Summary sql.NullString `json:"summary"`
Role sql.NullString `json:"role"`
Kind string `json:"kind"`
Ts int64 `json:"ts"`
}
type GetPromptEventForTurnParams ¶
type GetPromptEventForTurnParams struct {
SessionID string `json:"session_id"`
TurnID sql.NullString `json:"turn_id"`
}
type GetPromptEventForTurnRow ¶
type GetPromptEventForTurnRow struct {
EventID string `json:"event_id"`
PayloadHash sql.NullString `json:"payload_hash"`
}
type GetSessionWithStatsRow ¶
type GetSessionWithStatsRow struct {
SessionID string `json:"session_id"`
ProviderSessionID string `json:"provider_session_id"`
ParentSessionID sql.NullString `json:"parent_session_id"`
Provider string `json:"provider"`
StartedAt int64 `json:"started_at"`
LastEventTs int64 `json:"last_event_ts"`
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"`
}
type InsertAgentEventParams ¶
type InsertAgentEventParams struct {
EventID string `json:"event_id"`
SessionID string `json:"session_id"`
RepositoryID string `json:"repository_id"`
Ts int64 `json:"ts"`
Kind string `json:"kind"`
PayloadHash sql.NullString `json:"payload_hash"`
Role sql.NullString `json:"role"`
ToolUses sql.NullString `json:"tool_uses"`
TokensIn sql.NullInt64 `json:"tokens_in"`
TokensOut sql.NullInt64 `json:"tokens_out"`
TokensCacheRead sql.NullInt64 `json:"tokens_cache_read"`
TokensCacheCreate sql.NullInt64 `json:"tokens_cache_create"`
Summary sql.NullString `json:"summary"`
ProviderEventID sql.NullString `json:"provider_event_id"`
TurnID sql.NullString `json:"turn_id"`
ToolUseID sql.NullString `json:"tool_use_id"`
ToolName sql.NullString `json:"tool_name"`
EventSource string `json:"event_source"`
ProvenanceHash sql.NullString `json:"provenance_hash"`
}
type InsertCheckpointParams ¶
type InsertCheckpointParams struct {
CheckpointID string `json:"checkpoint_id"`
RepositoryID string `json:"repository_id"`
CreatedAt int64 `json:"created_at"`
Kind string `json:"kind"`
Trigger sql.NullString `json:"trigger"`
Message sql.NullString `json:"message"`
ManifestHash sql.NullString `json:"manifest_hash"`
SizeBytes sql.NullInt64 `json:"size_bytes"`
Status string `json:"status"`
CompletedAt sql.NullInt64 `json:"completed_at"`
}
type InsertCommitLinkParams ¶
type InsertEvidenceLinkIfAbsentParams ¶ added in v0.6.0
type InsertRepositoryParams ¶
type ListAgentEventsBySessionPagedParams ¶ added in v0.2.0
type ListAgentSessionsByProviderSessionIDParams ¶ added in v0.2.0
type ListBackfillReplayCandidatesParams ¶
type ListBackfillReplayCandidatesParams struct {
RepositoryID string `json:"repository_id"`
CursorLinkedAt int64 `json:"cursor_linked_at"`
CursorCommitHash string `json:"cursor_commit_hash"`
CutoffLinkedAt int64 `json:"cutoff_linked_at"`
CutoffCommitHash string `json:"cutoff_commit_hash"`
BatchLimit int64 `json:"batch_limit"`
}
type ListCheckpointsWithCommitRow ¶
type ListCheckpointsWithCommitRow struct {
CheckpointID string `json:"checkpoint_id"`
CreatedAt int64 `json:"created_at"`
Kind string `json:"kind"`
Trigger sql.NullString `json:"trigger"`
Message sql.NullString `json:"message"`
SizeBytes sql.NullInt64 `json:"size_bytes"`
Status string `json:"status"`
CompletedAt sql.NullInt64 `json:"completed_at"`
CommitHash sql.NullString `json:"commit_hash"`
ManifestHash sql.NullString `json:"manifest_hash"`
}
type ListEventsByProviderInWindowParams ¶ added in v0.3.9
type ListEventsByProviderInWindowRow ¶ added in v0.3.9
type ListEventsBySessionASCRow ¶
type ListEventsBySessionASCRow struct {
EventID string `json:"event_id"`
SessionID string `json:"session_id"`
RepositoryID string `json:"repository_id"`
Ts int64 `json:"ts"`
Kind string `json:"kind"`
PayloadHash sql.NullString `json:"payload_hash"`
Role sql.NullString `json:"role"`
ToolUses sql.NullString `json:"tool_uses"`
TokensIn sql.NullInt64 `json:"tokens_in"`
TokensOut sql.NullInt64 `json:"tokens_out"`
TokensCacheRead sql.NullInt64 `json:"tokens_cache_read"`
TokensCacheCreate sql.NullInt64 `json:"tokens_cache_create"`
Summary sql.NullString `json:"summary"`
ProviderEventID sql.NullString `json:"provider_event_id"`
TurnID sql.NullString `json:"turn_id"`
ToolUseID sql.NullString `json:"tool_use_id"`
ToolName sql.NullString `json:"tool_name"`
EventSource string `json:"event_source"`
ProvenanceHash sql.NullString `json:"provenance_hash"`
InsertSeq sql.NullInt64 `json:"insert_seq"`
Provider string `json:"provider"`
}
type ListEventsInWindowForAnnotationsParams ¶ added in v0.6.0
type ListEventsInWindowForAnnotationsRow ¶ added in v0.6.0
type ListEventsInWindowForAnnotationsRow struct {
EventID string `json:"event_id"`
SessionID string `json:"session_id"`
Provider string `json:"provider"`
Ts int64 `json:"ts"`
Role sql.NullString `json:"role"`
ToolUses sql.NullString `json:"tool_uses"`
TurnID sql.NullString `json:"turn_id"`
ToolName sql.NullString `json:"tool_name"`
PayloadHash sql.NullString `json:"payload_hash"`
ProvenanceHash sql.NullString `json:"provenance_hash"`
}
type ListEventsInWindowRow ¶
type ListEventsInWindowRow struct {
EventID string `json:"event_id"`
SessionID string `json:"session_id"`
Provider string `json:"provider"`
Model sql.NullString `json:"model"`
Ts int64 `json:"ts"`
Kind string `json:"kind"`
Role sql.NullString `json:"role"`
ToolUses sql.NullString `json:"tool_uses"`
TokensIn sql.NullInt64 `json:"tokens_in"`
TokensOut sql.NullInt64 `json:"tokens_out"`
TokensCacheRead sql.NullInt64 `json:"tokens_cache_read"`
TokensCacheCreate sql.NullInt64 `json:"tokens_cache_create"`
Summary sql.NullString `json:"summary"`
ProviderEventID sql.NullString `json:"provider_event_id"`
PayloadHash sql.NullString `json:"payload_hash"`
InsertSeq sql.NullInt64 `json:"insert_seq"`
}
type ListEvidenceLinksInWindowParams ¶ added in v0.6.0
type ListEvidenceLinksInWindowRow ¶ added in v0.6.0
type ListFailedManifestReasonsParams ¶ added in v0.3.9
type ListFailedManifestReasonsRow ¶ added in v0.3.9
type ListPendingCommitLinkedCheckpointsRow ¶ added in v0.6.0
type ListPendingCommitLinkedCheckpointsRow struct {
CheckpointID string `json:"checkpoint_id"`
RepositorySequence int64 `json:"repository_sequence"`
Status string `json:"status"`
CommitHash string `json:"commit_hash"`
AttemptCount int64 `json:"attempt_count"`
LastError sql.NullString `json:"last_error"`
NextAttemptAt int64 `json:"next_attempt_at"`
LeaseUntil sql.NullInt64 `json:"lease_until"`
}
type ListRecentSessionsWithStatsRow ¶
type ListRecentSessionsWithStatsRow struct {
SessionID string `json:"session_id"`
ProviderSessionID string `json:"provider_session_id"`
ParentSessionID sql.NullString `json:"parent_session_id"`
Provider string `json:"provider"`
StartedAt int64 `json:"started_at"`
LastEventTs int64 `json:"last_event_ts"`
StepCount int64 `json:"step_count"`
TokensIn int64 `json:"tokens_in"`
TokensOut int64 `json:"tokens_out"`
TokensCached int64 `json:"tokens_cached"`
}
type ListSessionsWithStatsAllRow ¶
type ListSessionsWithStatsAllRow struct {
SessionID string `json:"session_id"`
ProviderSessionID string `json:"provider_session_id"`
ParentSessionID sql.NullString `json:"parent_session_id"`
Provider string `json:"provider"`
StartedAt int64 `json:"started_at"`
LastEventTs int64 `json:"last_event_ts"`
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"`
}
type ListSessionsWithStatsRow ¶
type ListSessionsWithStatsRow struct {
SessionID string `json:"session_id"`
ProviderSessionID string `json:"provider_session_id"`
ParentSessionID sql.NullString `json:"parent_session_id"`
Provider string `json:"provider"`
StartedAt int64 `json:"started_at"`
LastEventTs int64 `json:"last_event_ts"`
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"`
}
type ListStepCompanionResultsParams ¶
type ListStepCompanionResultsParams struct {
SessionID string `json:"session_id"`
TurnID sql.NullString `json:"turn_id"`
ToolUseID sql.NullString `json:"tool_use_id"`
}
type ListStepCompanionResultsRow ¶
type ListStepCompanionResultsRow struct {
EventID string `json:"event_id"`
PayloadHash sql.NullString `json:"payload_hash"`
Summary sql.NullString `json:"summary"`
Role sql.NullString `json:"role"`
Kind string `json:"kind"`
Ts int64 `json:"ts"`
}
type ListStepEventsForTurnParams ¶
type ListStepEventsForTurnParams struct {
SessionID string `json:"session_id"`
TurnID sql.NullString `json:"turn_id"`
}
type ListStepEventsForTurnRow ¶
type ListStepEventsForTurnRow struct {
EventID string `json:"event_id"`
Ts int64 `json:"ts"`
ToolName sql.NullString `json:"tool_name"`
ToolUseID sql.NullString `json:"tool_use_id"`
ProvenanceHash sql.NullString `json:"provenance_hash"`
PayloadHash sql.NullString `json:"payload_hash"`
Summary sql.NullString `json:"summary"`
EventSource string `json:"event_source"`
ToolUses sql.NullString `json:"tool_uses"`
}
type ListStepProvenanceForTurnParams ¶
type ListStepProvenanceForTurnParams struct {
SessionID string `json:"session_id"`
TurnID sql.NullString `json:"turn_id"`
}
type ListStepProvenanceForTurnRow ¶
type ListStepProvenanceForTurnRow struct {
EventID string `json:"event_id"`
ToolUseID sql.NullString `json:"tool_use_id"`
ToolName sql.NullString `json:"tool_name"`
ProvenanceHash sql.NullString `json:"provenance_hash"`
}
type ListTranscriptEventsRow ¶
type ListTranscriptEventsRow struct {
EventID string `json:"event_id"`
SessionID string `json:"session_id"`
Provider string `json:"provider"`
Ts int64 `json:"ts"`
Kind string `json:"kind"`
Role sql.NullString `json:"role"`
ToolUses sql.NullString `json:"tool_uses"`
TokensIn sql.NullInt64 `json:"tokens_in"`
TokensOut sql.NullInt64 `json:"tokens_out"`
TokensCacheRead sql.NullInt64 `json:"tokens_cache_read"`
TokensCacheCreate sql.NullInt64 `json:"tokens_cache_create"`
Summary sql.NullString `json:"summary"`
ProviderEventID sql.NullString `json:"provider_event_id"`
PayloadHash sql.NullString `json:"payload_hash"`
}
type ListUserPromptsForCommitRow ¶ added in v0.5.4
type ListUserPromptsForCommitRow struct {
EventID string `json:"event_id"`
TurnID sql.NullString `json:"turn_id"`
Ts int64 `json:"ts"`
Summary sql.NullString `json:"summary"`
PayloadHash sql.NullString `json:"payload_hash"`
}
type MarkCheckpointAttributionComputedParams ¶ added in v0.6.0
type MarkCheckpointAttributionPushedParams ¶ added in v0.6.0
type MarkManifestFailedParams ¶
type MarkManifestFailedParams struct {
LastError sql.NullString `json:"last_error"`
UpdatedAt int64 `json:"updated_at"`
ManifestID string `json:"manifest_id"`
}
type ProvenanceManifest ¶
type ProvenanceManifest struct {
ManifestID string `json:"manifest_id"`
RepositoryID string `json:"repository_id"`
SessionID string `json:"session_id"`
TurnID string `json:"turn_id"`
Provider string `json:"provider"`
Kind string `json:"kind"`
TranscriptRef sql.NullString `json:"transcript_ref"`
ProvenanceBundleHash sql.NullString `json:"provenance_bundle_hash"`
StartedAt int64 `json:"started_at"`
CompletedAt sql.NullInt64 `json:"completed_at"`
Status string `json:"status"`
UploadAttempts int64 `json:"upload_attempts"`
LastError sql.NullString `json:"last_error"`
UploadTransformVersion sql.NullInt64 `json:"upload_transform_version"`
RemoteVerifiedAt sql.NullInt64 `json:"remote_verified_at"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) AdvanceBackfillCursor ¶
func (q *Queries) AdvanceBackfillCursor(ctx context.Context, arg AdvanceBackfillCursorParams) error
Advances the cursor past a successfully pushed or skipped commit. Also clears any failure state since the head-of-line commit moved.
func (*Queries) AgentEventExists ¶ added in v0.6.0
func (*Queries) ClaimCheckpoint ¶ added in v0.6.0
func (q *Queries) ClaimCheckpoint(ctx context.Context, arg ClaimCheckpointParams) (Checkpoint, error)
Atomic claim: takes a due pending checkpoint whose lease is free or expired and increments attempt_count exactly once. A live lease on a pending row represents processing. Returns no row when unavailable.
func (*Queries) CompleteBackfill ¶
func (q *Queries) CompleteBackfill(ctx context.Context, arg CompleteBackfillParams) error
func (*Queries) CompleteCheckpoint ¶
func (q *Queries) CompleteCheckpoint(ctx context.Context, arg CompleteCheckpointParams) error
func (*Queries) CountCheckpointsWithSummary ¶
func (*Queries) CountManifestsByStatus ¶ added in v0.3.9
func (q *Queries) CountManifestsByStatus(ctx context.Context, arg CountManifestsByStatusParams) ([]CountManifestsByStatusRow, error)
Counts manifests by status for the repository within the given window. Used by `semantica doctor` to summarize sync state.
func (*Queries) CountSessionsForCheckpoint ¶
func (*Queries) CountWindowTurnProvenance ¶ added in v0.6.0
func (q *Queries) CountWindowTurnProvenance(ctx context.Context, arg CountWindowTurnProvenanceParams) (CountWindowTurnProvenanceRow, error)
Counts turn bundles in the checkpoint event window. A non-empty bundle hash means local packaging succeeded; failed rows with a hash represent terminal upload failures. Joins use repository, session, turn, and kind. Window bounds use (ts, insert_seq).
func (*Queries) DeleteCheckpointByID ¶
func (*Queries) FailCheckpoint ¶
Terminal failure: permanent error or attempts exhausted; the final error is preserved for doctor and manual retry.
func (*Queries) GetActiveAgentSessionForRepo ¶
func (*Queries) GetAgentSessionByID ¶
func (*Queries) GetAgentSessionByProviderID ¶
func (q *Queries) GetAgentSessionByProviderID(ctx context.Context, arg GetAgentSessionByProviderIDParams) (AgentSession, error)
func (*Queries) GetAttributionBackfill ¶
func (*Queries) GetCheckpointByID ¶
func (*Queries) GetCheckpointStats ¶
func (*Queries) GetCheckpointSummary ¶
func (*Queries) GetCommitLinkByCommitHash ¶
func (*Queries) GetCommitLinksByCheckpoint ¶
func (*Queries) GetEvidenceLink ¶ added in v0.6.0
func (q *Queries) GetEvidenceLink(ctx context.Context, arg GetEvidenceLinkParams) (AgentEventEvidenceLink, error)
func (*Queries) GetLatestCheckpointForRepo ¶
func (*Queries) GetLatestCommitLink ¶
func (q *Queries) GetLatestCommitLink(ctx context.Context, repositoryID string) (GetLatestCommitLinkRow, error)
Returns the most recent commit link for a repository. Used to snapshot the backfill cutoff at connect time.
func (*Queries) GetManifestCommitLink ¶
func (q *Queries) GetManifestCommitLink(ctx context.Context, arg GetManifestCommitLinkParams) (GetManifestCommitLinkRow, error)
Resolves the commit link for the checkpoint that covers a manifest. First finds the earliest checkpoint in the session created at or after the manifest's start time (the covering checkpoint), then joins to commit_links. Returns no rows if the covering checkpoint has no commit.
func (*Queries) GetMostRecentCommitLinkedCheckpoint ¶ added in v0.5.2
func (q *Queries) GetMostRecentCommitLinkedCheckpoint(ctx context.Context, repositoryID string) (Checkpoint, error)
Latest completed commit-linked checkpoint by repository sequence.
func (*Queries) GetMostRecentParentSessionWithEvents ¶ added in v0.4.0
func (q *Queries) GetMostRecentParentSessionWithEvents(ctx context.Context, arg GetMostRecentParentSessionWithEventsParams) (AgentSession, error)
Used by handoff's lineage fallback when no active capture state exists for the repo (e.g. between agent turns). Returns the most recently active parent session (no parent_session_id) within the supplied last_seen_at window that has at least one event in agent_events. The recency floor is the same 24h cutoff the capture-state resolver uses, applied here against the durable agent_sessions data.
func (*Queries) GetMostRecentSessionByProviderWithEvents ¶ added in v0.4.0
func (q *Queries) GetMostRecentSessionByProviderWithEvents(ctx context.Context, arg GetMostRecentSessionByProviderWithEventsParams) (AgentSession, error)
Used by handoff's --from override to source the bundle from a specific provider's most-recent parent session in the repo, regardless of whether a different agent currently holds the active capture state. Same recency and parent-only filters as the lineage fallback, plus a provider filter for explicit cross-agent handoff.
func (*Queries) GetNextToolResultAfter ¶
func (q *Queries) GetNextToolResultAfter(ctx context.Context, arg GetNextToolResultAfterParams) (GetNextToolResultAfterRow, error)
Temporal fallback for companion matching when tool_use_id is empty. Returns the first tool_result in the same turn after the given timestamp. Used by Claude transcript enrichment where tool_result rows lack tool_use_id.
func (*Queries) GetPreviousCommitLinkedCheckpoint ¶
func (q *Queries) GetPreviousCommitLinkedCheckpoint(ctx context.Context, arg GetPreviousCommitLinkedCheckpointParams) (Checkpoint, error)
Ignore manual and baseline checkpoints when anchoring attribution.
func (*Queries) GetPreviousCompletedCheckpoint ¶
func (q *Queries) GetPreviousCompletedCheckpoint(ctx context.Context, arg GetPreviousCompletedCheckpointParams) (Checkpoint, error)
Sequence selects the predecessor; timestamps bound its event window.
func (*Queries) GetPromptEventForTurn ¶
func (q *Queries) GetPromptEventForTurn(ctx context.Context, arg GetPromptEventForTurnParams) (GetPromptEventForTurnRow, error)
func (*Queries) GetRepositoryByID ¶
func (*Queries) GetRepositoryByRootPath ¶
func (*Queries) GetSessionWithStats ¶
func (q *Queries) GetSessionWithStats(ctx context.Context, sessionID string) (GetSessionWithStatsRow, error)
Single session with computed stats. Same columns as ListSessionsWithStats.
func (*Queries) InsertAgentEvent ¶
func (q *Queries) InsertAgentEvent(ctx context.Context, arg InsertAgentEventParams) error
Allocate insert_seq under SQLite's single-writer lock.
func (*Queries) InsertCheckpoint ¶
func (q *Queries) InsertCheckpoint(ctx context.Context, arg InsertCheckpointParams) error
Allocate sequence and event cursor in the insert transaction.
func (*Queries) InsertCommitLink ¶
func (q *Queries) InsertCommitLink(ctx context.Context, arg InsertCommitLinkParams) error
func (*Queries) InsertEvidenceLinkIfAbsent ¶ added in v0.6.0
func (q *Queries) InsertEvidenceLinkIfAbsent(ctx context.Context, arg InsertEvidenceLinkIfAbsentParams) error
Idempotent creation half; the caller re-reads the row and fails closed on an evidence hash mismatch instead of overwriting it.
func (*Queries) InsertRepository ¶
func (q *Queries) InsertRepository(ctx context.Context, arg InsertRepositoryParams) error
func (*Queries) InsertSessionCheckpoint ¶
func (q *Queries) InsertSessionCheckpoint(ctx context.Context, arg InsertSessionCheckpointParams) error
func (*Queries) ListAgentEventsBySession ¶
func (q *Queries) ListAgentEventsBySession(ctx context.Context, arg ListAgentEventsBySessionParams) ([]AgentEvent, error)
func (*Queries) ListAgentEventsBySessionPaged ¶ added in v0.2.0
func (q *Queries) ListAgentEventsBySessionPaged(ctx context.Context, arg ListAgentEventsBySessionPagedParams) ([]AgentEvent, error)
Keyset pagination: returns the next page of events after the given cursor. Pass after_ts=0 and an empty after_event_id to fetch the first page. Order is ascending (chronological) for timeline construction.
func (*Queries) ListAgentSessionsByProviderSessionID ¶ added in v0.2.0
func (q *Queries) ListAgentSessionsByProviderSessionID(ctx context.Context, arg ListAgentSessionsByProviderSessionIDParams) ([]AgentSession, error)
Search by provider_session_id across all providers in a repo. Returns multiple rows if different providers reuse the same ID.
func (*Queries) ListBackfillReplayCandidates ¶
func (q *Queries) ListBackfillReplayCandidates(ctx context.Context, arg ListBackfillReplayCandidatesParams) ([]ListBackfillReplayCandidatesRow, error)
Returns the next batch of commit links eligible for replay, ordered oldest-first. Uses (linked_at, commit_hash) tuple comparison for deterministic cursor-based pagination.
func (*Queries) ListCheckpointsByRepository ¶
func (q *Queries) ListCheckpointsByRepository(ctx context.Context, arg ListCheckpointsByRepositoryParams) ([]Checkpoint, error)
func (*Queries) ListCheckpointsWithCommit ¶
func (q *Queries) ListCheckpointsWithCommit(ctx context.Context, arg ListCheckpointsWithCommitParams) ([]ListCheckpointsWithCommitRow, error)
func (*Queries) ListCommitLinksByRepository ¶
func (q *Queries) ListCommitLinksByRepository(ctx context.Context, arg ListCommitLinksByRepositoryParams) ([]CommitLink, error)
func (*Queries) ListCrossRepoSessions ¶
func (q *Queries) ListCrossRepoSessions(ctx context.Context, arg ListCrossRepoSessionsParams) ([]AgentSession, error)
func (*Queries) ListDistinctProviders ¶
func (*Queries) ListEventsByProviderInWindow ¶ added in v0.3.9
func (q *Queries) ListEventsByProviderInWindow(ctx context.Context, arg ListEventsByProviderInWindowParams) ([]ListEventsByProviderInWindowRow, error)
Returns event count and most-recent event timestamp per provider for the repository in the given window (ts >= since_ts). Used by `semantica doctor` to surface per-provider activity. Providers with zero events are omitted by the GROUP BY; the doctor command joins this against the registered provider list to flag installed-but-silent providers.
func (*Queries) ListEventsBySessionASC ¶
func (*Queries) ListEventsInWindow ¶
func (q *Queries) ListEventsInWindow(ctx context.Context, arg ListEventsInWindowParams) ([]ListEventsInWindowRow, error)
Returns all events for a repository within a time window, without requiring session_checkpoints links. Used by attribution to query events directly by repository and time range. insert_seq feeds deterministic winner selection for equal-quality evidence.
func (*Queries) ListEventsInWindowForAnnotations ¶ added in v0.6.0
func (q *Queries) ListEventsInWindowForAnnotations(ctx context.Context, arg ListEventsInWindowForAnnotationsParams) ([]ListEventsInWindowForAnnotationsRow, error)
Returns events for a repository within a time window with the turn and provenance fields the timeline-annotation detector needs (turn_id and provenance_hash) alongside the payload pointer. Ordered chronologically so the detector can reason about authored-then-revised / authored-then-removed sequences directly.
func (*Queries) ListEvidenceLinksByEvent ¶ added in v0.6.0
func (*Queries) ListEvidenceLinksByGroup ¶ added in v0.6.0
func (*Queries) ListEvidenceLinksInWindow ¶ added in v0.6.0
func (q *Queries) ListEvidenceLinksInWindow(ctx context.Context, arg ListEvidenceLinksInWindowParams) ([]ListEvidenceLinksInWindowRow, error)
Lists tool-delta links and session providers in event-window order, with event recency for deterministic winner selection.
func (*Queries) ListFailedManifestReasons ¶ added in v0.3.9
func (q *Queries) ListFailedManifestReasons(ctx context.Context, arg ListFailedManifestReasonsParams) ([]ListFailedManifestReasonsRow, error)
Returns each distinct last_error and its count for failed manifests in the repository within the given window. No limit: doctor folds these into stable reason groups in Go (e.g. "redaction failed: prompt"). A SQL-side limit would cap raw rows before grouping, which can undercount stable groups that manifest as many per-instance error strings (one per blob hash). The result set is bounded by the number of *distinct* error strings within the 7d window, which is small in practice.
func (*Queries) ListPackagedManifests ¶
func (q *Queries) ListPackagedManifests(ctx context.Context, arg ListPackagedManifestsParams) ([]ProvenanceManifest, error)
Returns manifests ready for upload, scoped to a watermark timestamp. Only packaged status with attempts below the retry cap. Pass 0 for watermark_ts to drain all.
func (*Queries) ListPendingCommitLinkedCheckpoints ¶ added in v0.6.0
func (q *Queries) ListPendingCommitLinkedCheckpoints(ctx context.Context, repositoryID string) ([]ListPendingCommitLinkedCheckpointsRow, error)
Include failed rows because a failed queue head blocks later work. Newest commit links sort first for deterministic deduplication.
func (*Queries) ListPendingManifests ¶
func (q *Queries) ListPendingManifests(ctx context.Context, arg ListPendingManifestsParams) ([]ProvenanceManifest, error)
func (*Queries) ListProvidersByCheckpoint ¶
func (*Queries) ListRecentAIPercentages ¶
func (q *Queries) ListRecentAIPercentages(ctx context.Context, arg ListRecentAIPercentagesParams) ([]ListRecentAIPercentagesRow, error)
func (*Queries) ListRecentSessionsWithStats ¶
func (q *Queries) ListRecentSessionsWithStats(ctx context.Context, arg ListRecentSessionsWithStatsParams) ([]ListRecentSessionsWithStatsRow, error)
Same token separation as ListSessionsWithStats (see comment above).
func (*Queries) ListRepositories ¶
func (q *Queries) ListRepositories(ctx context.Context) ([]Repository, error)
func (*Queries) ListSessionsForCheckpoint ¶
func (*Queries) ListSessionsForRepository ¶
func (q *Queries) ListSessionsForRepository(ctx context.Context, arg ListSessionsForRepositoryParams) ([]AgentSession, error)
func (*Queries) ListSessionsWithEventsInWindow ¶
func (q *Queries) ListSessionsWithEventsInWindow(ctx context.Context, arg ListSessionsWithEventsInWindowParams) ([]string, error)
Returns distinct session IDs that have at least one event in the given time window [after_ts, up_to_ts] for the specified repository.
func (*Queries) ListSessionsWithStats ¶
func (q *Queries) ListSessionsWithStats(ctx context.Context, arg ListSessionsWithStatsParams) ([]ListSessionsWithStatsRow, error)
tokens_in is the non-cached input token count reported by the provider. tokens_cached is cache_read + cache_create. Claude's API reports input_tokens as only the non-cached portion; with heavy prompt caching the cached portion can be >99% of actual context, so we report them separately for clarity.
func (*Queries) ListSessionsWithStatsAll ¶
func (q *Queries) ListSessionsWithStatsAll(ctx context.Context, arg ListSessionsWithStatsAllParams) ([]ListSessionsWithStatsAllRow, error)
Same as ListSessionsWithStats but includes sessions with zero events.
func (*Queries) ListStalePendingCheckpoints ¶
func (q *Queries) ListStalePendingCheckpoints(ctx context.Context, arg ListStalePendingCheckpointsParams) ([]ListStalePendingCheckpointsRow, error)
Returns pending checkpoints older than the given threshold that have no manifest and no commit link. Used by tidy to mark abandoned checkpoints as failed.
func (*Queries) ListStepCompanionResults ¶
func (q *Queries) ListStepCompanionResults(ctx context.Context, arg ListStepCompanionResultsParams) ([]ListStepCompanionResultsRow, error)
Returns tool_result events matching a step's tool_use_id, ordered by timestamp. Returned as :many so the provider enricher can choose the right pairing when multiple results exist (e.g., retried tool calls).
func (*Queries) ListStepEventsForTurn ¶
func (q *Queries) ListStepEventsForTurn(ctx context.Context, arg ListStepEventsForTurnParams) ([]ListStepEventsForTurnRow, error)
Returns step events for provenance bundle packaging. Includes both hook-captured and transcript-sourced events so providers without direct hook capture are covered.
func (*Queries) ListStepProvenanceForTurn ¶
func (q *Queries) ListStepProvenanceForTurn(ctx context.Context, arg ListStepProvenanceForTurnParams) ([]ListStepProvenanceForTurnRow, error)
Returns step provenance hashes for a turn, used to build the upload envelope.
func (*Queries) ListTranscriptEvents ¶
func (q *Queries) ListTranscriptEvents(ctx context.Context, arg ListTranscriptEventsParams) ([]ListTranscriptEventsRow, error)
func (*Queries) ListUserPromptsForCommit ¶ added in v0.5.4
func (q *Queries) ListUserPromptsForCommit(ctx context.Context, commitHash string) ([]ListUserPromptsForCommitRow, error)
Returns user prompts attributable to a single commit.
Isolation rules:
- User prompt events only; assistant and tool-result events are excluded.
- Events must fall within the commit checkpoint window.
- Duplicate turn IDs keep the earliest event for deterministic ordering.
- Events without a turn ID are excluded because they cannot be cited.
func (*Queries) MarkCheckpointAttributionComputed ¶ added in v0.6.0
func (q *Queries) MarkCheckpointAttributionComputed(ctx context.Context, arg MarkCheckpointAttributionComputedParams) error
Records successful attribution, including an empty result. Upsert preserves the marker when the stats row does not exist yet.
func (*Queries) MarkCheckpointAttributionPushed ¶ added in v0.6.0
func (q *Queries) MarkCheckpointAttributionPushed(ctx context.Context, arg MarkCheckpointAttributionPushedParams) error
Records a successful hosted attribution push. Upsert creates missing stats rows.
func (*Queries) MarkManifestFailed ¶
func (q *Queries) MarkManifestFailed(ctx context.Context, arg MarkManifestFailedParams) error
func (*Queries) MarkManifestUploaded ¶
func (q *Queries) MarkManifestUploaded(ctx context.Context, arg MarkManifestUploadedParams) error
func (*Queries) MarkManifestUploading ¶
func (q *Queries) MarkManifestUploading(ctx context.Context, arg MarkManifestUploadingParams) (int64, error)
Guards on status='packaged' so concurrent sync workers cannot both claim the same manifest. Caller checks rows affected: 0 means already claimed.
func (*Queries) PromptEventExists ¶
func (*Queries) RecordBackfillFailure ¶
func (q *Queries) RecordBackfillFailure(ctx context.Context, arg RecordBackfillFailureParams) error
Records a retryable failure on the current head-of-line commit.
func (*Queries) RecoverStaleUploading ¶
func (q *Queries) RecoverStaleUploading(ctx context.Context, arg RecoverStaleUploadingParams) error
Resets manifests stuck in uploading after a crash. Threshold is a unix ms timestamp; rows with updated_at older than this are reset to packaged.
func (*Queries) ReleaseCheckpointForRetry ¶ added in v0.6.0
func (q *Queries) ReleaseCheckpointForRetry(ctx context.Context, arg ReleaseCheckpointForRetryParams) (int64, error)
Transient failure: release the lease with a scheduled retry. The attempt counter was already incremented by the claim. Callers must require one affected row; zero means the lease was lost and the transition was not recorded.
func (*Queries) ResetManifestForRetry ¶
func (q *Queries) ResetManifestForRetry(ctx context.Context, arg ResetManifestForRetryParams) error
Resets a failed or uploading manifest back to packaged for retry. Increments upload_attempts and records the error for diagnostics.
func (*Queries) ResetManifestToPackaged ¶
func (q *Queries) ResetManifestToPackaged(ctx context.Context, arg ResetManifestToPackagedParams) error
Resets a manifest back to packaged without incrementing upload_attempts. Used for auth failures where the manifest itself is healthy and should not burn a retry attempt.
func (*Queries) ResolveCheckpointByPrefix ¶
func (*Queries) ResolveCommitLinkByPrefix ¶
func (*Queries) ResolveSessionByPrefix ¶
func (*Queries) RetryFailedCheckpoint ¶ added in v0.6.0
Manual retry: a human intervened, so the attempt budget resets.
func (*Queries) SaveCheckpointSummary ¶
func (q *Queries) SaveCheckpointSummary(ctx context.Context, arg SaveCheckpointSummaryParams) error
func (*Queries) StepEventExists ¶
func (*Queries) UpdateCheckpointAIPercentage ¶
func (q *Queries) UpdateCheckpointAIPercentage(ctx context.Context, arg UpdateCheckpointAIPercentageParams) error
func (*Queries) UpdateRepositoryEnabledAt ¶
func (q *Queries) UpdateRepositoryEnabledAt(ctx context.Context, arg UpdateRepositoryEnabledAtParams) error
func (*Queries) UpsertAgentSession ¶
func (q *Queries) UpsertAgentSession(ctx context.Context, arg UpsertAgentSessionParams) (AgentSession, error)
func (*Queries) UpsertAgentSource ¶
func (q *Queries) UpsertAgentSource(ctx context.Context, arg UpsertAgentSourceParams) (AgentSource, error)
func (*Queries) UpsertAttributionBackfill ¶
func (q *Queries) UpsertAttributionBackfill(ctx context.Context, arg UpsertAttributionBackfillParams) error
Initializes replay state for a connected repo binding. If the row already exists, extends the cutoff if the new cutoff is newer (never shrinks).
func (*Queries) UpsertCheckpointStats ¶
func (q *Queries) UpsertCheckpointStats(ctx context.Context, arg UpsertCheckpointStatsParams) error
func (*Queries) UpsertProvenanceManifest ¶
func (q *Queries) UpsertProvenanceManifest(ctx context.Context, arg UpsertProvenanceManifestParams) error
type RecordBackfillFailureParams ¶
type RecordBackfillFailureParams struct {
FailedCommitHash sql.NullString `json:"failed_commit_hash"`
LastError sql.NullString `json:"last_error"`
UpdatedAt int64 `json:"updated_at"`
ConnectedRepoID string `json:"connected_repo_id"`
}
type ReleaseCheckpointForRetryParams ¶ added in v0.6.0
type ReleaseCheckpointForRetryParams struct {
LastError sql.NullString `json:"last_error"`
NextAttemptAt int64 `json:"next_attempt_at"`
CheckpointID string `json:"checkpoint_id"`
LeaseOwner sql.NullString `json:"lease_owner"`
}
type RemoteAttributionBackfill ¶
type RemoteAttributionBackfill struct {
ConnectedRepoID string `json:"connected_repo_id"`
RepositoryID string `json:"repository_id"`
CutoffLinkedAt int64 `json:"cutoff_linked_at"`
CutoffCommitHash string `json:"cutoff_commit_hash"`
CursorLinkedAt int64 `json:"cursor_linked_at"`
CursorCommitHash string `json:"cursor_commit_hash"`
Status string `json:"status"`
FailedCommitHash sql.NullString `json:"failed_commit_hash"`
RetryAttempts int64 `json:"retry_attempts"`
LastError sql.NullString `json:"last_error"`
UpdatedAt int64 `json:"updated_at"`
}
type Repository ¶
type ResetManifestForRetryParams ¶
type ResetManifestForRetryParams struct {
LastError sql.NullString `json:"last_error"`
UpdatedAt int64 `json:"updated_at"`
ManifestID string `json:"manifest_id"`
}
type SaveCheckpointSummaryParams ¶
type SaveCheckpointSummaryParams struct {
SummaryJson sql.NullString `json:"summary_json"`
SummaryModel sql.NullString `json:"summary_model"`
CheckpointID string `json:"checkpoint_id"`
}
type SessionCheckpoint ¶
type StepEventExistsParams ¶
type StepEventExistsParams struct {
TurnID sql.NullString `json:"turn_id"`
ToolUseID sql.NullString `json:"tool_use_id"`
ToolName sql.NullString `json:"tool_name"`
}
type UpsertAgentSessionParams ¶
type UpsertAgentSessionParams struct {
SessionID string `json:"session_id"`
ProviderSessionID string `json:"provider_session_id"`
ParentSessionID sql.NullString `json:"parent_session_id"`
RepositoryID string `json:"repository_id"`
Provider string `json:"provider"`
SourceID string `json:"source_id"`
StartedAt int64 `json:"started_at"`
LastSeenAt int64 `json:"last_seen_at"`
MetadataJson string `json:"metadata_json"`
SourceRepoPath sql.NullString `json:"source_repo_path"`
Model sql.NullString `json:"model"`
}
type UpsertAgentSourceParams ¶
type UpsertProvenanceManifestParams ¶
type UpsertProvenanceManifestParams struct {
ManifestID string `json:"manifest_id"`
RepositoryID string `json:"repository_id"`
SessionID string `json:"session_id"`
TurnID string `json:"turn_id"`
Provider string `json:"provider"`
Kind string `json:"kind"`
TranscriptRef sql.NullString `json:"transcript_ref"`
ProvenanceBundleHash sql.NullString `json:"provenance_bundle_hash"`
StartedAt int64 `json:"started_at"`
CompletedAt sql.NullInt64 `json:"completed_at"`
Status string `json:"status"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}