// Mock data for the Solutions pane
const ME = { handle: "marius", name: "Marius P.", initials: "MP", color: "#f54d00" };

const TEAMMATES = {
  marius:  { handle: "marius",  name: "Marius P.",  initials: "MP", color: "#f54d00" },
  ben:     { handle: "ben",     name: "Ben W.",     initials: "BW", color: "#1d4aff" },
  raquel:  { handle: "raquel",  name: "Raquel L.",  initials: "RL", color: "#7c5cff" },
  tomas:   { handle: "tomas",   name: "Tomas K.",   initials: "TK", color: "#22a06b" },
  liang:   { handle: "liang",   name: "Liang Y.",   initials: "LY", color: "#e85d75" },
  oliver:  { handle: "oliver",  name: "Oliver R.",  initials: "OR", color: "#0095a8" },
  hedgie:  { handle: "hedgie",  name: "PostHog",    initials: "PH", color: "#b88800" },
};

const PRIORITY = {
  P0: { color: "#e54848", bg: "rgba(255,95,87,0.16)",  label: "P0", desc: "Critical" },
  P1: { color: "#d8503a", bg: "rgba(255,122,92,0.16)", label: "P1", desc: "High" },
  P2: { color: "#b88800", bg: "rgba(248,190,42,0.16)", label: "P2", desc: "Medium" },
  P3: { color: "#6b6e7a", bg: "rgba(152,152,182,0.16)",label: "P3", desc: "Low" },
  P4: { color: "#a8acb8", bg: "rgba(97,97,128,0.16)",  label: "P4", desc: "Trivial" },
};

// Helper to build a chat thread
const thread = (entries) => entries;

const SOLUTIONS = [
  // ===== READY TO MERGE (one-click for human) =====
  {
    id: "S-2041", kind: "ready", priority: "P0",
    origin: {"kind":"responder","source":"error-tracking","responderId":"resp_e7a2"},
    title: "Stop sending duplicate $pageview events when SPA history pushes twice within 50ms",
    repo: "posthog/posthog-js", branch: "fix/dedupe-pageview-spa", pr: 4421,
    confidence: 0.94, age: "2h ago", files: 2, additions: 18, deletions: 6,
    reviewers: ["marius", "ben"], primaryReviewer: "marius",
    reasoning: "Touches src/posthog-core.ts which Marius authored 71% of (last 90d) and Ben reviewed 9 of the last 12 PRs against.",
    summary: "Stop duplicate \$pageview events that fire when React Router replaces history twice in a single tick.",
    impact: "0.4% of \$pageview events were duplicates – inflated funnels and ~\$1.2k/month over-billing across 2,317 customers.",
    problem: "React Router calls history.replaceState inside its effect cycle. The popstate listener fires twice within ~12ms; both fires capture identical \$pageview events.",
    solution: "Debounce the pageview capture with a 50ms window keyed on (path, search). One regression test added; no public API change.",
    phCodeSession: "code://session/sess_2hKp4xQ7",
    checks: { ci: "passed", tests: "12/12", lint: "clean", coverage: "+0.1%" },
    signals: [
      { type: "error", title: "Duplicate $pageview within 50ms", source: "Error tracking · posthog-js", count: 14820, when: "last 7d", phUrl: "https://app.posthog.com/error_tracking/issues/x9j" },
      { type: "issue", title: "Funnels showing inflated step 1 counts", source: "Linear · WEB-1841", count: 4, when: "this week" },
      { type: "support", title: "\"My pageview count doubled overnight\"", source: "Support · Zendesk #21044", count: 7, when: "last 30d" },
    ],
    tour: [
      { file: "src/posthog-core.ts", start: 412, summary: "Wrap _captureInitialPageview in a 50ms debounce keyed on path+search.", hunk: [
        { t: " ", line: "_captureInitialPageview() {" },
        { t: " ", line: "  if (this.config.capture_pageview === false) return" },
        { t: "-", line: "  this.capture('$pageview')" },
        { t: "+", line: "  this._dedupedPageview()" },
        { t: " ", line: "}" },
      ]},
      { file: "src/posthog-core.ts", start: 438, summary: "New helper. Bails if same (path, search) already captured in last 50ms.", hunk: [
        { t: "+", line: "_dedupedPageview() {" },
        { t: "+", line: "  const key = location.pathname + location.search" },
        { t: "+", line: "  const now = Date.now()" },
        { t: "+", line: "  if (this._lastPageviewKey === key &&" },
        { t: "+", line: "      now - this._lastPageviewAt < 50) return" },
        { t: "+", line: "  this._lastPageviewKey = key" },
        { t: "+", line: "  this._lastPageviewAt = now" },
        { t: "+", line: "  this.capture('$pageview')" },
        { t: "+", line: "}" },
      ]},
      { file: "src/__tests__/pageview.test.ts", start: 88, summary: "Test: two history.pushState calls 20ms apart capture once.", hunk: [
        { t: "+", line: "it('dedupes pageview within 50ms', async () => {" },
        { t: "+", line: "  history.pushState({}, '', '/a')" },
        { t: "+", line: "  await sleep(20)" },
        { t: "+", line: "  history.pushState({}, '', '/a')" },
        { t: "+", line: "  expect(captured('$pageview')).toHaveLength(1)" },
        { t: "+", line: "})" },
      ]},
    ],
    chat: thread([
      { agent: "research", at: "2h ago", text: "I clustered 14,820 'Duplicate $pageview within 50ms' errors over the last 7 days. 96% are React Router apps. Same path, same search params, fires twice within ~12ms median. Cause: history.replaceState fires inside React's effect cycle." },
      { agent: "research", at: "2h ago", text: "Confirmed user impact via 3 support tickets and Linear WEB-1841. Estimated 2,317 customers affected. Marking P0 – billing impact + funnel skew." },
      { agent: "implementation", at: "2h ago", text: "Picked the smallest possible fix: 50ms debounce keyed on path+search. Considered also patching Next.js router events specifically, but dropped that – too narrow and fragile." },
      { agent: "implementation", at: "2h ago", text: "Added one regression test. CI green. No public API changes. Confidence: 94%." },
    ]),
  },
  {
    id: "S-2038", kind: "ready", priority: "P1",
    origin: {"kind":"responder","source":"session-replay","responderId":"resp_r3b8"},
    title: "Fix tooltip overflow when Insights URL > 200 chars on dashboard cards",
    repo: "posthog/posthog", branch: "fix/tooltip-overflow", pr: 31204,
    confidence: 0.91, age: "4h ago", files: 1, additions: 4, deletions: 2,
    reviewers: ["marius", "raquel"], primaryReviewer: "marius",
    reasoning: "Marius owns frontend/src/lib/lemon-ui/. Raquel reviewed the original LemonTooltip implementation.",
    summary: "Cap LemonTooltip width and wrap long URLs so Insights links stop overflowing dashboard cards.",
    impact: "18% of dashboard card hovers affected – 47 replays show users scrolling sideways to read a cut-off URL.",
    problem: "LemonTooltip defaults to whiteSpace: nowrap with no max-width. Insights URLs over ~200 chars push the tooltip off-screen.",
    solution: "Add maxWidth: 360 + wordBreak: break-all to the tooltip style. Four-line diff; existing tooltip tests cover.",
    phCodeSession: "code://session/sess_4kLm9wP2",
    checks: { ci: "passed", tests: "8/8", lint: "clean", coverage: "+0.0%" },
    signals: [
      { type: "replay", title: "User scrolls horizontally on dashboard", source: "Session replay · 47 recordings", count: 47, when: "last 14d" },
      { type: "issue", title: "Tooltip is cut off the screen", source: "GitHub · posthog#28144", count: 1, when: "3 weeks ago" },
    ],
    tour: [
      { file: "frontend/src/lib/lemon-ui/LemonTooltip.tsx", start: 64, summary: "Cap max-width and wrap long URLs.", hunk: [
        { t: " ", line: "const tooltipStyle = {" },
        { t: "-", line: "  whiteSpace: 'nowrap'," },
        { t: "+", line: "  maxWidth: 360," },
        { t: "+", line: "  wordBreak: 'break-all'," },
        { t: " ", line: "}" },
      ]},
    ],
    chat: thread([
      { agent: "research", at: "4h ago", text: "47 replays in 14d show users hand-scrolling tooltips. The pattern is always the same: long Insights URL with query params overflows the viewport. GitHub #28144 corroborates." },
      { agent: "implementation", at: "4h ago", text: "Smallest possible fix in LemonTooltip – 4 lines. Skipped the alternative of truncating with ellipsis, since users actually want to read the URL. Word-break is uglier but readable." },
    ]),
  },
  {
    id: "S-2030", kind: "ready", priority: "P2",
    origin: {"kind":"responder","source":"support","responderId":"resp_s9c1"},
    title: "Use stable instance_id not random() for retention bucket assignment",
    repo: "posthog/posthog", branch: "fix/retention-stable-bucket", pr: 31198,
    confidence: 0.88, age: "9h ago", files: 3, additions: 22, deletions: 14,
    reviewers: ["marius", "tomas"], primaryReviewer: "marius",
    reasoning: "Tomas owns the retention insight. Marius made the last 4 perf changes to retention queries.",
    summary: "Make retention curves stable run-to-run by replacing random() bucketing with a deterministic hash.",
    impact: "Retention insights for ~9% of teams flicker by ±3% between refreshes. Top complaint across 3 Linear tickets and 3 support threads.",
    problem: "Bucket assignment uses random() per call, so two refreshes of the same insight produce different curves. Users assume the underlying numbers are unreliable.",
    solution: "Hash (instance_id, week) with a stable seed and bucket on that. Determinism property covered by tests.",
    phCodeSession: "code://session/sess_7nQp1xR8",
    checks: { ci: "passed", tests: "19/19", lint: "clean" },
    signals: [
      { type: "issue", title: "Retention numbers change on refresh", source: "Linear · DATA-880", count: 3, when: "last 30d" },
      { type: "support", title: "\"Are these numbers reliable?\"", source: "Support · 3 tickets", count: 3, when: "last 60d" },
    ],
    tour: [],
    chat: thread([
      { agent: "research", at: "9h ago", text: "Linear DATA-880 + 3 support tickets all describe retention numbers wobbling. Reproduced locally – random() in bucket assignment is the smoking gun." },
      { agent: "implementation", at: "8h ago", text: "Switched to a stable hash. 22 +/14 −. Tests cover the determinism property explicitly." },
    ]),
  },

  // ===== REVIEW BEFORE MERGING =====
  {
    id: "S-2044", kind: "review", priority: "P1",
    origin: {"kind":"scout","scoutId":"scout_001","scoutName":"Onboarding friction"},
    title: "New onboarding step: ask which framework to bias autocapture defaults",
    repo: "posthog/posthog", branch: "feat/onboarding-framework", pr: 31221,
    confidence: 0.62, age: "11h ago", files: 7, additions: 184, deletions: 12,
    reviewers: ["marius", "liang", "oliver"], primaryReviewer: "marius",
    reasoning: "Marius is reviewing all onboarding-flow changes this quarter (per OWNERS file).",
    summary: "Add a framework picker to onboarding that biases autocapture defaults per stack.",
    impact: "Step 3 of onboarding is where 22% of new orgs drop off. 312 sessions show users editing autocapture rules immediately after.",
    problem: "Autocapture defaults are one-size-fits-all. Next.js users see /api/* events they don't want, React Native users miss \$screen events entirely.",
    solution: "Wizard asks for the framework, then ships defaults tuned per-stack (Next.js excludes /api/*, RN uses \$screen, etc.). Hypothesis: cuts step-3 drop-off by ~6%.",
    phCodeSession: "code://session/sess_8rSt2yU9",
    checks: { ci: "passed", tests: "34/34", lint: "clean" },
    signals: [
      { type: "replay", title: "Users editing autocapture rules immediately after onboarding", source: "Session replay · 312 sessions", count: 312, when: "last 30d" },
      { type: "funnel", title: "Onboarding step 3 → step 4 drop-off", source: "Funnel · Onboarding v4", count: "−22%", when: "rolling 30d" },
      { type: "support", title: "\"Why is /api/health appearing in events?\"", source: "Support · 14 tickets", count: 14, when: "last 90d" },
    ],
    questions: [
      "Should this step be skippable or required?",
      "Bias toward most-popular framework, or default to 'unknown'?",
      "Show a 'change this later' link?",
    ],
    tour: [],
    chat: thread([
      { agent: "research", at: "11h ago", text: "Onboarding step 3 has a 22% drop-off (rolling 30d). Replays show users immediately editing autocapture rules afterward – the defaults don't fit. 14 support tickets explicitly mention this." },
      { agent: "research", at: "11h ago", text: "I'm flagging for human review rather than auto-shipping because the framework picker is a UX surface that affects every new user. Wrong defaults could make this worse." },
      { agent: "implementation", at: "10h ago", text: "Drafted the picker with 6 frameworks (Next, Remix, RN, Vue, Astro, plain). Defaults are conservative. I have 3 open questions in the description – see the panel." },
    ]),
  },
  {
    id: "S-2042", kind: "review", priority: "P2",
    origin: {"kind":"responder","source":"session-replay","responderId":"resp_r5d4"},
    title: "Re-order Insights filter pills by usage frequency per project",
    repo: "posthog/posthog", branch: "feat/insights-filter-reorder", pr: 31215,
    confidence: 0.58, age: "1d ago", files: 4, additions: 96, deletions: 4,
    reviewers: ["marius"], primaryReviewer: "marius",
    reasoning: "Marius authored the Insights filter component originally.",
    summary: "Surface the most-used filter pills to the front of the Insights filter list, per project.",
    impact: "Could shave ~1.2s from time-to-insight. Affects ~80% of weekly active users.",
    problem: "Filter pills are alphabetical. 1,204 sessions over 30 days show users scrolling past the first 4 pills to reach the one they actually want.",
    solution: "Track per-project usage frequency and re-sort. New projects keep alphabetical as a fallback. Opt-in per project.",
    phCodeSession: "code://session/sess_3kJl5xM7",
    checks: { ci: "passed", tests: "16/16", lint: "clean" },
    signals: [
      { type: "replay", title: "Users scroll filter list before clicking", source: "Session replay · 1,204 sessions", count: 1204, when: "last 30d" },
    ],
    questions: ["Keep alphabetical as fallback for new projects?", "Project setting or always on?"],
    tour: [],
    chat: thread([
      { agent: "research", at: "1d ago", text: "1,204 sessions show users scroll filter list before clicking – every time. Strong signal. But the fix changes ordering on a heavily-used surface, so I'm flagging for review." },
      { agent: "implementation", at: "1d ago", text: "Implemented as opt-in per project. 2 open questions – see description." },
    ]),
  },
  {
    id: "S-2039", kind: "review", priority: "P3",
    origin: {"kind":"responder","source":"session-replay","responderId":"resp_r6e2"},
    title: "Surface 'last edited by agent' indicator on dashboard cards",
    repo: "posthog/posthog", branch: "feat/agent-edit-indicator", pr: 31207,
    confidence: 0.55, age: "1d ago", files: 5, additions: 71, deletions: 0,
    reviewers: ["marius", "ben"], primaryReviewer: "marius",
    reasoning: "Marius owns dashboard card UI components.",
    summary: "Add a small avatar indicator showing whether a dashboard card was last edited by a human or an agent.",
    impact: "Agent-driven edits doubled month-over-month. Anticipates 'why did this change?' questions before they become support tickets.",
    problem: "When an agent edits a dashboard card, there's no UI signal. Users wonder if a teammate did it; some assume it's a bug and file tickets.",
    solution: "Small ⊕ glyph in the card corner when the last editor was an agent. Hover for full attribution. Behind a feature flag.",
    phCodeSession: "code://session/sess_2nMo6yT4",
    checks: { ci: "passed", tests: "9/9", lint: "clean" },
    signals: [
      { type: "issue", title: "Discussion in #ai-product about edit attribution", source: "Slack · 18 messages", count: 18, when: "last 7d" },
    ],
    questions: ["Show on hover only, or always visible?"],
    tour: [],
    chat: thread([
      { agent: "research", at: "1d ago", text: "Slack #ai-product has 18 messages this week debating edit attribution. Confidence is moderate – there's not yet a customer ticket, just internal momentum." },
      { agent: "implementation", at: "1d ago", text: "Built both modes (always-on vs hover) behind a flag. One open question for you." },
    ]),
  },
];

const REPORTS = [
  {
    id: "R-1198", status: "researching", priority: "P1",
    origin: {"kind":"responder","source":"error-tracking","responderId":"resp_e8f1"},
    title: "Investigating sporadic websocket disconnects on /insights live mode",
    age: "22 min ago",
    summary: "Live-mode insights occasionally drop their websocket and silently stop updating. The agent is bisecting commits between v1.84 and v1.86 to find the regression.",
    blockers: [],
    progress: 0.65,
    signals: [
      { type: "error", title: "WebsocketUnexpectedClose", source: "Error tracking", count: 412, when: "last 7d" },
      { type: "replay", title: "User stares at stale chart, refreshes", source: "Session replay · 19 sessions", count: 19, when: "last 7d" },
    ],
    primaryReviewer: "marius", reviewers: ["marius"],
    chat: thread([
      { agent: "research", at: "22 min ago", text: "Started investigating WebsocketUnexpectedClose – 412 errors in 7d, all live-mode. Replays confirm user impact (people refresh after ~30s of stale chart)." },
      { agent: "research", at: "8 min ago", text: "Bisecting now. Down to 8 commits between v1.84.2 and v1.86.0. Should have a candidate in ~10 min." },
    ]),
  },
  {
    id: "R-1192", status: "needs-input", priority: "P1",
    origin: {"kind":"scout","scoutId":"scout_003","scoutName":"EU cluster health"},
    title: "Spike in cohort calculation timeouts on EU cluster",
    age: "3h ago",
    summary: "Detected 47 timeouts/hour on cohort recalcs in EU since Friday. Code paths look identical to US. Need access to EU query plans to diagnose.",
    blockers: ["Need read access to EU ClickHouse query log", "Need confirmation no schema drift between regions"],
    signals: [
      { type: "error", title: "CohortCalculationTimeout (EU only)", source: "Error tracking", count: 1640, when: "last 72h" },
    ],
    primaryReviewer: "marius", reviewers: ["marius", "tomas"],
    chat: thread([
      { agent: "research", at: "3h ago", text: "1,640 CohortCalculationTimeout errors in 72h, EU cluster only. US is unaffected. Code paths are identical. I checked schema dumps and DB versions – both match." },
      { agent: "research", at: "3h ago", text: "I'm stuck without read access to EU query logs. Could you grant temporary access (or paste a representative slow query plan)?" },
    ]),
  },
  {
    id: "R-1190", status: "ready", priority: "P2",
    origin: {"kind":"responder","source":"pagerduty","responderId":"resp_p2a4"},
    title: "Ready: queue depth alarm on event ingestion is too noisy",
    age: "5h ago",
    summary: "Alarm fires 12×/day. 11 of those are well below actual capacity. Recommendation written + thresholds proposed. Ready for your call before I open a PR.",
    blockers: [],
    signals: [
      { type: "error", title: "QueueDepthHighAlarm", source: "PagerDuty", count: 84, when: "last 7d" },
      { type: "issue", title: "On-call complaint thread", source: "Slack · #infra-oncall", count: 6, when: "last 14d" },
    ],
    primaryReviewer: "marius", reviewers: ["marius", "tomas"],
    chat: thread([
      { agent: "research", at: "5h ago", text: "Reviewed 84 alarm fires. 73 were below 60% of true ingestion capacity – false positives. Proposed new thresholds: warn at 75%, page at 90%. Backed by 14d of capacity data." },
      { agent: "research", at: "5h ago", text: "Marking ready – happy to open the PR if you sign off, or hand to you to write." },
    ]),
  },
  {
    id: "R-1188", status: "non-actionable", priority: "P3",
    origin: {"kind":"responder","source":"error-tracking","responderId":"resp_e1b7"},
    title: "Investigated: '$session_id is null' errors during high-traffic events",
    age: "1d ago",
    summary: "Reviewed 218 occurrences. All trace back to known Safari ITP behavior – users with all cookies blocked. No PostHog-side fix is feasible without changing the contract for $session_id.",
    blockers: [],
    signals: [
      { type: "error", title: "$session_id is null", source: "Error tracking", count: 218, when: "last 14d" },
    ],
    primaryReviewer: "marius", reviewers: ["marius"],
    chat: thread([
      { agent: "research", at: "1d ago", text: "218 occurrences. I traced 40 of them: all Safari with cookies disabled / ITP. Documented behavior. Closing as non-actionable – happy to be overruled if you think we should change the $session_id contract." },
    ]),
  },
  {
    id: "R-1186", status: "failed", priority: "P2",
    origin: {"kind":"responder","source":"zendesk","responderId":"resp_z4d9"},
    title: "Failed: couldn't reproduce 'dashboards loading slowly' report from acme.io",
    age: "1d ago",
    summary: "Tried 4 reproduction strategies over 90 min. None reproduced the slowness acme.io reported. Asking the team for more detail.",
    blockers: ["Need a session replay or HAR file from the affected user", "Or access to the specific dashboard ID mentioned in the support ticket"],
    signals: [
      { type: "support", title: "Dashboards loading slowly", source: "Support · Zendesk #21088", count: 1, when: "2 days ago" },
    ],
    primaryReviewer: "marius", reviewers: ["marius"],
    chat: thread([
      { agent: "research", at: "1d ago", text: "Tried: cold-cache load, 50-card dashboard with their exact insight types, simulated their query volumes, and ran on a same-region cluster. All under 2s. Couldn't reproduce." },
      { agent: "research", at: "1d ago", text: "Marked failed for now. Will retry if we get a HAR or replay from the user." },
    ]),
  },
  {
    id: "R-1185", status: "needs-input", priority: "P2",
    origin: {"kind":"responder","source":"session-replay","responderId":"resp_r7g3"},
    title: "Considered: in-app survey when feature flag rollout > 50%",
    age: "2d ago",
    summary: "Idea has merit but I couldn't find consistent evidence users want this. Three replays show users hunting for survey config; not enough signal to ship.",
    blockers: ["Product call: should surveys auto-attach to flag rollouts?"],
    signals: [
      { type: "replay", title: "Users browsing surveys & flags in same session", source: "Session replay · 12 sessions", count: 12, when: "last 14d" },
    ],
    primaryReviewer: "marius", reviewers: ["marius", "raquel"],
    chat: thread([
      { agent: "research", at: "2d ago", text: "Weak signal – only 12 sessions show the dual interest. Not enough to act, but worth flagging if product wants to ship anyway." },
    ]),
  },
];

// Daily briefing – the inbox agent's morning dispatch.
// Notes are tagged with a tone that drives visual treatment. Optional `link`
// references a SOLUTION or REPORT id so the user can jump straight in.
const BRIEFING = {
  generatedAt: "7 min ago",
  runId: "run_8x7f2pQa",
  paragraphs: [
    "Your top-of-queue is a P0 that's been waiting since yesterday morning – duplicate $pageview events on SPA history pushes. Pageview-billing drift compounds every hour it sits, so worth a quick look first.",
    "I'm stuck on cohort calculations timing out on EU only – 47/hour since Friday, US is clean. I drafted a report but I need EU query log access to go further. There's also a fresh lead I'm bisecting now: sporadic websocket disconnects on /insights live mode, somewhere between v1.84 and v1.86. Expect an answer in ~2 hours.",
    "Everything else is steady. posthog-js error volume is flat day-over-day, onboarding step-3 drop-off held at 22% (no movement), and no new P0s in the last 24 hours.",
  ],
  signoff: "I'll check back this afternoon – or anytime you ping me.",
};

// ============== Scouts ==============
// User-defined standing agents. Run on a cadence with a freeform prompt.
// Findings land as Reports (never directly into the briefing – too noisy).
const SCOUTS = [
  {
    id: "scout_001",
    recentReports: [0,0,1,0,0,0,2,0,0,1,0,0,0,2],
    name: "Onboarding friction",
    prompt: "Watch for spikes in onboarding step-3 drop-off, replay drops in the wizard flow, and any support tickets mentioning 'stuck on setup'. Surface anything crossing 2× week-over-week.",
    cadence: "daily",
    enabled: true,
    sources: ["session-replay", "support", "funnel"],
    nextRun: "in 14h",
    lastRun: { at: "8h ago", findingsCount: 2, runId: "run_3k9p2x", reportsOpened: 1 },
    runCount: 23,
    createdBy: "marius",
  },
  {
    id: "scout_002",
    recentReports: [0,0,0,1,0,0,0,2,0,1,0,0,3,0],
    name: "Pricing page friction",
    prompt: "Anyone in #help, support tickets, or session replays struggling with the pricing page. Especially loading time, broken CTAs, confusion about plans.",
    cadence: "hourly",
    enabled: true,
    sources: ["session-replay", "support", "slack"],
    nextRun: "in 23m",
    lastRun: { at: "37m ago", findingsCount: 0, runId: "run_8nQk1y", reportsOpened: 0 },
    runCount: 412,
    createdBy: "marius",
  },
  {
    id: "scout_003",
    recentReports: [0,0,0,0,1,0,0,0,0,0,0,1,2,1],
    name: "EU cluster health",
    prompt: "Anomalies in error tracking, query latency, or cohort calculations specific to the EU region. Compare against US baselines.",
    cadence: "hourly",
    enabled: true,
    sources: ["error-tracking", "pagerduty"],
    nextRun: "in 12m",
    lastRun: { at: "48m ago", findingsCount: 1, runId: "run_pX4mLq", reportsOpened: 1 },
    runCount: 384,
    createdBy: "tomas",
  },
  {
    id: "scout_004",
    recentReports: [0,0,0,0,0,0,0,0,0,0,0,0,0,0],
    name: "API deprecation impact",
    prompt: "Track usage of v1 API endpoints we've marked deprecated. Tell me which customers are still calling them and how often.",
    cadence: "weekly",
    enabled: false,
    sources: ["error-tracking"],
    nextRun: "paused",
    lastRun: { at: "5 days ago", findingsCount: 0, runId: "run_zKpL2v", reportsOpened: 0 },
    runCount: 8,
    createdBy: "marius",
  },
];

// Live Responders – currently-running per-signal agent invocations.
const LIVE_RESPONDERS = [
  {
    id: "resp_021",
    triggeredBy: "WebsocketUnexpectedClose spike",
    source: "error-tracking",
    startedAt: "3 min ago",
    step: "Bisecting commits between v1.84.2 and v1.86.0 to find the regression.",
    progress: 0.65,
    eta: "~10 min",
    repo: "posthog/posthog",
  },
  {
    id: "resp_020",
    triggeredBy: "Zendesk ticket cluster: 'numbers look off'",
    source: "zendesk",
    startedAt: "1h ago",
    step: "Cross-referencing the 7 tickets against retention insights – looking for a common project ID.",
    progress: 0.4,
    eta: "~25 min",
    repo: "posthog/posthog",
  },
  {
    id: "resp_019",
    triggeredBy: "Funnel anomaly: signup → first event",
    source: "funnel",
    startedAt: "2h ago",
    step: "Drafting fix for autocapture defaults; running test suite.",
    progress: 0.88,
    eta: "~3 min",
    repo: "posthog/posthog-js",
  },
];

Object.assign(window, { ME, TEAMMATES, PRIORITY, SOLUTIONS, REPORTS, BRIEFING, SCOUTS, LIVE_RESPONDERS });
