Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ type ToolArgs any
type Metadata map[string]any

type InterceptionRecord struct {
ID string
InitiatorID, Provider, Model string
Metadata Metadata
StartedAt time.Time
// keep-sorted start
ID string
InitiatorID string
UserAgent string
Provider string
Model string
StartedAt time.Time
Metadata Metadata
// keep-sorted end
}

type InterceptionRecordEnded struct {
Expand Down
3 changes: 2 additions & 1 deletion interception.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ func newInterceptionProcessor(p Provider, logger slog.Logger, recorder Recorder,

if err := recorder.RecordInterception(r.Context(), &InterceptionRecord{
ID: interceptor.ID().String(),
Metadata: actor.metadata,
InitiatorID: actor.id,
UserAgent: r.UserAgent(), // TODO make this smarter
Provider: p.Name(),
Model: interceptor.Model(),
Metadata: actor.metadata,
}); err != nil {
logger.Warn(r.Context(), "failed to record interception", slog.Error(err))
http.Error(w, "failed to record interception", http.StatusInternalServerError)
Expand Down