Goal
Two related pieces of work, naturally bundled:
- Upgrade
github.com/github/copilot-sdk/go from v0.3.0 → v1.0.0 (major version bump).
- Surface premium-request credit counts on the dashboard — the data is already collected end-to-end, just not displayed.
Part 1 — SDK upgrade (v0.3.0 → v1.0.0)
Current pin in go.mod:
github.com/github/copilot-sdk/go v0.3.0
github.com/github/copilot-sdk/go/cmd/bundler
A v0.x → v1.0 jump may contain breaking changes. Touchpoints in this repo:
internal/execution/copilot.go — main consumer
internal/execution/session_usage_collector.go — uses copilot.SessionEvent, SessionEventType*, SessionShutdownData.{TotalPremiumRequests, ModelMetrics}, mm.Usage.{Input,Output,CacheRead,CacheWrite}Tokens, mm.Requests.{Count, Cost}
internal/copilotevents/ — event-decoding helpers (Shutdown, AssistantUsage)
internal/embedded/ — bundler integration
- All
*_test.go files that build copilot.SessionEvent fixtures
Acceptance
Part 2 — Premium request credits on the dashboard
The data is already there:
models.UsageStats.PremiumRequests float64 (internal/models/outcome.go:204) — populated from shutdown.TotalPremiumRequests (internal/execution/session_usage_collector.go:95).
models.ModelUsage.RequestCount float64 per model (internal/models/outcome.go:223) — populated from mm.Requests.Count (internal/execution/session_usage_collector.go:107).
But the webapi layer never reads either field — internal/webapi/store.go only pulls InputTokens + OutputTokens into RunSummary.
Plan
-
Backend (internal/webapi/):
- Add
PremiumRequests float64 to RunSummary and SummaryResponse (types.go).
- Populate from
o.Digest.Usage.PremiumRequests in outcomeToSummary (store.go).
- Aggregate in
Summary() (storage_adapter.go) as AvgPremiumRequests (and/or total).
- For
RunDetail, expose per-model RequestCount so the UI can show a breakdown.
-
Frontend (web/src/):
- Add a
Credits (or Premium Requests) column to RunsTable.tsx.
- Add an
Avg Credits KPI card to KPICards.tsx.
- Add credits to
RunDetail.tsx stats and CSV export (lib/export.ts).
- Format as integer with thousands separators (no
$).
- In
CompareView.tsx / TrendsPage.tsx, mirror token treatment (higher is "more usage", not "better").
-
Display semantics: premium requests ≠ dollars. Make sure the label is clear ("Credits" or "Premium Requests" — pick one and stay consistent). Tooltip should explain it's the Copilot premium-request count reported by the SDK.
Acceptance
Ordering
Do Part 1 first (SDK upgrade) — Part 2 reads SDK-derived fields, and if v1.0.0 renames anything (e.g. TotalPremiumRequests → something else) we don't want to wire the dashboard twice. Then Part 2 on top.
Related
Goal
Two related pieces of work, naturally bundled:
github.com/github/copilot-sdk/gofromv0.3.0→v1.0.0(major version bump).Part 1 — SDK upgrade (v0.3.0 → v1.0.0)
Current pin in
go.mod:A v0.x → v1.0 jump may contain breaking changes. Touchpoints in this repo:
internal/execution/copilot.go— main consumerinternal/execution/session_usage_collector.go— usescopilot.SessionEvent,SessionEventType*,SessionShutdownData.{TotalPremiumRequests, ModelMetrics},mm.Usage.{Input,Output,CacheRead,CacheWrite}Tokens,mm.Requests.{Count, Cost}internal/copilotevents/— event-decoding helpers (Shutdown,AssistantUsage)internal/embedded/— bundler integration*_test.gofiles that buildcopilot.SessionEventfixturesAcceptance
go.mod/go.sumupdated to v1.0.0;go mod tidyclean.make testandmake lintgreen.UsageStats(tokens + premium requests + per-model metrics).Part 2 — Premium request credits on the dashboard
The data is already there:
models.UsageStats.PremiumRequests float64(internal/models/outcome.go:204) — populated fromshutdown.TotalPremiumRequests(internal/execution/session_usage_collector.go:95).models.ModelUsage.RequestCount float64per model (internal/models/outcome.go:223) — populated frommm.Requests.Count(internal/execution/session_usage_collector.go:107).But the webapi layer never reads either field —
internal/webapi/store.goonly pullsInputTokens + OutputTokensintoRunSummary.Plan
Backend (
internal/webapi/):PremiumRequests float64toRunSummaryandSummaryResponse(types.go).o.Digest.Usage.PremiumRequestsinoutcomeToSummary(store.go).Summary()(storage_adapter.go) asAvgPremiumRequests(and/or total).RunDetail, expose per-modelRequestCountso the UI can show a breakdown.Frontend (
web/src/):Credits(orPremium Requests) column toRunsTable.tsx.Avg CreditsKPI card toKPICards.tsx.RunDetail.tsxstats and CSV export (lib/export.ts).$).CompareView.tsx/TrendsPage.tsx, mirror token treatment (higher is "more usage", not "better").Display semantics: premium requests ≠ dollars. Make sure the label is clear ("Credits" or "Premium Requests" — pick one and stay consistent). Tooltip should explain it's the Copilot premium-request count reported by the SDK.
Acceptance
RunSummary/SummaryResponsecarry premium request totals.Ordering
Do Part 1 first (SDK upgrade) — Part 2 reads SDK-derived fields, and if v1.0.0 renames anything (e.g.
TotalPremiumRequests→ something else) we don't want to wire the dashboard twice. Then Part 2 on top.Related
webapitypes and dashboard cards; coordinate to avoid merge conflicts.