Documentation
¶
Index ¶
- func BaseSessionID(sessionID string) string
- func RedactedHeaders(headers http.Header) map[string][]string
- func SessionPath(dir, agentType, sessionID string) string
- type Analytics
- type AzureBlobSyncer
- type AzureBlobSyncerConfig
- type Event
- type GCSSyncer
- type GCSSyncerConfig
- type RawEvent
- type Recorder
- func (r *Recorder) Dir() string
- func (r *Recorder) Enabled() bool
- func (r *Recorder) PathForSession(agentType, sessionID string) string
- func (r *Recorder) RecordMeta(agentType, sessionID string, payload map[string]any)
- func (r *Recorder) RecordPayload(agentType, sessionID, eventType, direction string, body []byte, ...)
- func (r *Recorder) RecordPayloadChunk(agentType, sessionID, eventType, direction, streamID string, chunkIndex int, ...)
- func (r *Recorder) RecordPayloadSummary(agentType, sessionID, eventType, direction, streamID string, bytesRead int64, ...)
- type SanitizedEvent
- type Summary
- type Usage
- type UsageBucket
- type UsageGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BaseSessionID ¶
func SessionPath ¶
Types ¶
type Analytics ¶
type Analytics struct {
Totals Usage `json:"totals"`
ByUser []UsageGroup `json:"by_user"`
ByAccount []UsageGroup `json:"by_account"`
ByModel []UsageGroup `json:"by_model"`
Timeline []UsageBucket `json:"timeline"`
MaxTimelineTokens int64 `json:"max_timeline_tokens"`
MaxUserTokens int64 `json:"max_user_tokens"`
MaxAccountTokens int64 `json:"max_account_tokens"`
}
type AzureBlobSyncer ¶ added in v0.1.83
type AzureBlobSyncer struct {
// contains filtered or unexported fields
}
AzureBlobSyncer copies the local transcript spool into an Azure blob container and then prunes what it has archived. It is the Azure counterpart of GCSSyncer: same spool, same retention policy, different destination, because the hosts that record transcripts are not all on GCP and a syncer that can only authenticate through the GCE metadata server silently records nothing anywhere else.
func NewAzureBlobSyncer ¶ added in v0.1.83
func NewAzureBlobSyncer(config AzureBlobSyncerConfig) *AzureBlobSyncer
NewAzureBlobSyncer returns nil when the destination or source is not configured, which is how callers keep transcript sync opt-in.
func (*AzureBlobSyncer) Destination ¶ added in v0.1.83
func (s *AzureBlobSyncer) Destination() string
func (*AzureBlobSyncer) Enabled ¶ added in v0.1.83
func (s *AzureBlobSyncer) Enabled() bool
func (*AzureBlobSyncer) Run ¶ added in v0.1.83
func (s *AzureBlobSyncer) Run(ctx context.Context)
type AzureBlobSyncerConfig ¶ added in v0.1.83
type AzureBlobSyncerConfig struct {
SourceDir string
// Destination is the container URL, optionally with a prefix path, e.g.
// https://account.blob.core.windows.net/transcripts/cmux-lawrence.
Destination string
// AccountKey is the storage account shared key. Preferred over a SAS
// because it does not expire, and an expired credential would stop the
// pipeline exactly as silently as the failure this replaces.
AccountKey string
// SASToken is used when no account key is configured.
SASToken string
Interval time.Duration
Timeout time.Duration
LocalRetention time.Duration
MaxLocalBytes int64
Logger *slog.Logger
Client *http.Client
Now func() time.Time
// Backoff overrides the wait before resending a throttled request.
Backoff func(attempt int) time.Duration
// MaxBytesPerSecond caps upload throughput. Zero uses the default; a
// negative value disables pacing.
MaxBytesPerSecond int64
// Sleep waits for a pacing delay. Injectable for tests.
Sleep func(context.Context, time.Duration) error
}
type GCSSyncer ¶
type GCSSyncer struct {
// contains filtered or unexported fields
}
func NewGCSSyncer ¶
func NewGCSSyncer(config GCSSyncerConfig) *GCSSyncer
type GCSSyncerConfig ¶
type RawEvent ¶
type RawEvent struct {
Timestamp string `json:"timestamp"`
Type string `json:"type"`
Payload map[string]any `json:"payload"`
BodyText string `json:"body_text,omitempty"`
BodyBase64 string `json:"body_base64,omitempty"`
}
func ReadRawSession ¶
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
func NewRecorder ¶
func (*Recorder) PathForSession ¶
func (*Recorder) RecordMeta ¶
func (*Recorder) RecordPayload ¶
func (*Recorder) RecordPayloadChunk ¶ added in v0.1.14
type SanitizedEvent ¶
type SanitizedEvent struct {
Timestamp string `json:"timestamp"`
Type string `json:"type"`
Payload map[string]any `json:"payload"`
}
func ReadSanitizedSession ¶
func ReadSanitizedSession(dir, agentType, sessionID string) ([]SanitizedEvent, error)
type Summary ¶
type Summary struct {
AgentType string `json:"agent_type"`
SessionID string `json:"session_id"`
EventCount int `json:"event_count"`
TotalBytes int64 `json:"total_bytes"`
Usage Usage `json:"usage"`
FirstEventAt string `json:"first_event_at,omitempty"`
LastEventAt string `json:"last_event_at,omitempty"`
User string `json:"user,omitempty"`
Account string `json:"account,omitempty"`
HasBodies bool `json:"has_bodies"`
SizeBytes int64 `json:"size_bytes"`
}
func ListSummaries ¶
type Usage ¶
type Usage struct {
Requests int64 `json:"requests"`
InputTokens int64 `json:"input_tokens"`
CachedInputTokens int64 `json:"cached_input_tokens"`
OutputTokens int64 `json:"output_tokens"`
ReasoningTokens int64 `json:"reasoning_tokens"`
TotalTokens int64 `json:"total_tokens"`
PayloadBytes int64 `json:"payload_bytes"`
}
type UsageBucket ¶
type UsageGroup ¶
Click to show internal directories.
Click to hide internal directories.