Files
agent-radar 2ed3415fb7
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
2026-09-01 20:17:27 +08:00

57 lines
1.2 KiB
Go

package reporter
import "context"
// DebugReporter publishes final analytics payloads only to the debug sink.
type DebugReporter struct {
common reporterCommon
debug DebugPublisher
}
func newDebugReporter(config Config) (*DebugReporter, error) {
common, err := newReporterCommon(config)
if err != nil {
return nil, err
}
return &DebugReporter{
common: common,
debug: config.DebugPublisher,
}, nil
}
func (r *DebugReporter) Track(ctx context.Context, events ...Event) {
if r.debug == nil || len(events) == 0 {
return
}
common, _ := r.common.snapshot()
header := r.common.teaHeader()
normalized := normalizeEvents(events, common, header)
if len(normalized) == 0 {
return
}
debugEvents := make([]DebugEvent, 0, len(normalized))
for _, event := range normalized {
params := copyParams(event.Params)
if params == nil {
params = map[string]any{}
}
for key, value := range common {
params[key] = value
}
for key, value := range header.presetParams() {
params[key] = value
}
debugEvents = append(debugEvents, DebugEvent{
Name: event.Name,
ClientTS: event.ClientTS,
Params: params,
})
}
r.debug.PublishAnalyticsDebugEvents(ctx, debugEvents)
}
func (*DebugReporter) Close() error {
return nil
}