Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

feat(community): color the heatmap by sent count only, bands 0/1-10/11-30/31-50/51+

Gusf670ec28ef21
diff --git a/src/web/src/components/community/bots/bot-activity-heatmap.test.ts b/src/web/src/components/community/bots/bot-activity-heatmap.test.ts
index fc885f340..1a03ed28e 100644
--- a/src/web/src/components/community/bots/bot-activity-heatmap.test.ts
+++ b/src/web/src/components/community/bots/bot-activity-heatmap.test.ts
@@ -80,40 +80,39 @@ describe("BotActivityHeatmap — calendar-axis fill", () => {
expect(newerIdx - olderIdx).toBe(15)
})
- it("colors by ABSOLUTE per-day count (busier bots read darker), not relative to own max", () => {
- // Gus #706/#708: cross-bot comparability. A quiet bot (1/day) must NOT reach
- // the darkest bucket just because it's that bot's own peak. Bucket class is
- // on the trigger cell; find each active day's cell by DOM index and read its
- // bucket class. Thresholds (Gus #714): 1-50=b1, 51-100=b2, 101-500=b3, 500+=b4.
+ it("colors by ABSOLUTE SENT count per day (busier bots read darker), across fixed bands", () => {
+ // Gus /Gus/general #47: color tracks the day's SENT count only, absolute
+ // bands 0 / 1-10 / 11-30 / 31-50 / 51+ (comparable across bots). Bucket class
+ // is on the trigger cell; find each day's cell by DOM index.
const now = new Date()
const r = render([
- { day: utcDayKeyDaysAgo(now, 3), handledCount: 1, sentCount: 0 }, // 1 → b1
- { day: utcDayKeyDaysAgo(now, 2), handledCount: 60, sentCount: 0 }, // 60 → b2
- { day: utcDayKeyDaysAgo(now, 1), handledCount: 200, sentCount: 0 }, // 200 → b3
- { day: utcDayKeyDaysAgo(now, 0), handledCount: 600, sentCount: 5 }, // 605 → b4
+ { day: utcDayKeyDaysAgo(now, 3), handledCount: 99, sentCount: 5 }, // sent 5 → b1
+ { day: utcDayKeyDaysAgo(now, 2), handledCount: 0, sentCount: 20 }, // sent 20 → b2
+ { day: utcDayKeyDaysAgo(now, 1), handledCount: 0, sentCount: 45 }, // sent 45 → b3
+ { day: utcDayKeyDaysAgo(now, 0), handledCount: 0, sentCount: 80 }, // sent 80 → b4
])
// Split into tokens so "bg-status-online" (b4) doesn't match the /opacity
// variants (b1–b3) as a substring.
const tokens = cells(r).map((c) => String(c.props.className).split(/\s+/))
const idx = (n: number) => 29 - n // oldest→newest slot for n days ago
- expect(tokens[idx(3)]).toContain("bg-status-online/30") // 1 msg — palest
- expect(tokens[idx(2)]).toContain("bg-status-online/55") // 60 msgs
- expect(tokens[idx(1)]).toContain("bg-status-online/80") // 200 msgs
- expect(tokens[idx(0)]).toContain("bg-status-online") // 605 msgs — darkest, no /opacity
- // the low-count day must NOT reach the darkest, even though it's this bot's min
+ expect(tokens[idx(3)]).toContain("bg-status-online/30") // sent 5 — palest
+ expect(tokens[idx(2)]).toContain("bg-status-online/55") // sent 20
+ expect(tokens[idx(1)]).toContain("bg-status-online/80") // sent 45
+ expect(tokens[idx(0)]).toContain("bg-status-online") // sent 80 — darkest, no /opacity
+ // a high HANDLED but low SENT day must NOT read dark (handled doesn't color)
expect(tokens[idx(3)]).not.toContain("bg-status-online")
})
- it("weights sent x2 for color only — tooltip still shows raw counts (Gus #716/Blair #717)", () => {
+ it("colors by sent, not handled — a handled-heavy / sent-light day stays pale", () => {
const now = new Date()
- // 30 handled + 20 sent: raw sum 50 (→ b1), but weighted 30+20*2=70 (→ b2).
- // Color must use the weighted score; tooltip must show the raw numbers.
- const r = render([{ day: utcDayKeyDaysAgo(now, 0), handledCount: 30, sentCount: 20 }])
+ // 200 handled but only 3 sent → sent band b1 (pale), NOT dark. Tooltip still
+ // shows both numbers (Blair /Gus/general #48 — color=sent, tooltip=both).
+ const r = render([{ day: utcDayKeyDaysAgo(now, 0), handledCount: 200, sentCount: 3 }])
const cell = cells(r)[29] // today = last slot
- expect(String(cell.props.className).split(/\s+/)).toContain("bg-status-online/55") // b2, weighted
+ expect(String(cell.props.className).split(/\s+/)).toContain("bg-status-online/30") // b1 by sent=3
const tip = tips(r).find((t) => t.includes("handled"))
- expect(tip).toContain("30 messages handled") // raw, NOT the weighted 70
- expect(tip).toContain("20 messages sent")
+ expect(tip).toContain("200 messages handled")
+ expect(tip).toContain("3 messages sent")
})
it("labels active days with full sentences and empty days as 'No activity'", () => {
diff --git a/src/web/src/components/community/bots/bot-activity-heatmap.tsx b/src/web/src/components/community/bots/bot-activity-heatmap.tsx
index fa0e9fa8b..a381f1866 100644
--- a/src/web/src/components/community/bots/bot-activity-heatmap.tsx
+++ b/src/web/src/components/community/bots/bot-activity-heatmap.tsx
@@ -41,19 +41,17 @@ const BUCKET_CLASSES = [
const DATE_FMT = new Intl.DateTimeFormat(undefined, { month: "short", day: "numeric" })
-// ABSOLUTE thresholds (Gus /Gus/working #708/#714): the heatmap is for seeing
-// WHICH AGENTS are busier, not which day — so tint maps a day's weighted score
-// to a fixed band, comparable across bots (a relative-to-own-max scale, the old
-// #628 version, made every bot's peak darkest so all looked equally busy). Bands
-// are sized for the steady-state ~100 msgs/day an agent handles (Gus #714), not
-// today's dev-period cross-wake noise. `score` is the weighted value below, NOT
-// the raw message count.
-function bucketFor(score: number): number {
- if (score <= 0) return 0
- if (score <= 50) return 1 // 1–50
- if (score <= 100) return 2 // 51–100
- if (score <= 500) return 3 // 101–500
- return 4 // 500+
+// ABSOLUTE thresholds on the day's SENT count (Gus /Gus/general #47): tint maps
+// how many messages the bot SENT that day — sending is the impact signal that
+// proves it's doing work, so color tracks sent alone (handled is still shown in
+// the tooltip as context, just doesn't drive the color). Fixed bands are
+// comparable across bots (which agents are busier), not relative to own max.
+function bucketFor(sent: number): number {
+ if (sent <= 0) return 0
+ if (sent <= 10) return 1 // 1–10
+ if (sent <= 30) return 2 // 11–30
+ if (sent <= 50) return 3 // 31–50
+ return 4 // 51+
}
function dayLabel(dayKey: string): string {
@@ -124,11 +122,10 @@ export function BotActivityHeatmap({
const d = byDay.get(key)
return {
key,
- // Coloring weight (Gus #716): sent counts double — sending a message is
- // impact/real work, vs just being woken to handle one. This weight feeds
- // ONLY the color bucket; the tooltip and the stored counts stay raw
- // (Blair #717 — never let the weight leak into what we display or store).
- bucket: d ? bucketFor(d.handledCount + d.sentCount * 2) : 0,
+ // Color tracks the day's SENT count only (Gus /Gus/general #47) — sent
+ // is the impact signal. handled still appears in the tooltip as context
+ // but doesn't drive the color (Blair #48 — tooltip keeps both numbers).
+ bucket: d ? bucketFor(d.sentCount) : 0,
title: tooltipFor(key, d),
}
})