mirror of
https://github.com/supabase/supabase.git
synced 2026-09-06 09:59:03 +08:00
<!-- CURSOR_AGENT_PR_BODY_BEGIN --> ## Stack Draft stack extracted from `docs/monitoring`. Merge bottom-up. Troubleshooting / debugging-guide rewrite is out of scope. 1. #49503 move inspect and advisors 2. #49501 split Studio logs from ClickHouse queries 3. #49500 treat reports as signal dashboards 4. #49502 add Observe the data hub 5. **#49506** add agent setup components ← **this PR** 6. #49504 add hire-an-agent templates 7. #49505 restructure observability nav and overview ## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Docs app feature (MDX components + markdown export). Fifth layer in the observability stack. ## What is the current behavior? There is no shared way to render a monitoring agent prompt, schedule, and Claude/Codex/Cursor setup instructions in both HTML and generated markdown. ## What is the new behavior? - `AgentSetup` and `AgentWatchSchedule` MDX components, registered for HTML and markdown export - Shared `monitoring-agents` data (cadence, prompt ids, harness steps) - Opt-in `AiPrompt` markdown export (`includeInMarkdown`) so quickstarts stay HTML-only - Optional content-listing `subtitle` for schedule labels on cards No agent guide pages yet — those land in #49504 so this PR stays a reviewable code change. ## Additional context Markdown schema handlers share the same data module as the React components. <!-- CURSOR_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-a3cb5ece-925b-4046-b58a-5d69e9a9d794?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-a3cb5ece-925b-4046-b58a-5d69e9a9d794&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Saxon Fletcher <SaxonF@users.noreply.github.com>
90 lines
2.4 KiB
TypeScript
90 lines
2.4 KiB
TypeScript
import {
|
|
getMonitoringAgent,
|
|
getScheduleLabel,
|
|
getScheduleMarks,
|
|
} from '~/data/monitoring-agents.utils'
|
|
|
|
type AgentWatchScheduleProps = {
|
|
id: string
|
|
}
|
|
|
|
function DaySchedule({
|
|
marks,
|
|
cadence,
|
|
}: {
|
|
marks: ReturnType<typeof getScheduleMarks>['marks']
|
|
cadence: string
|
|
}) {
|
|
const labeled = marks.filter((mark) => mark.label)
|
|
|
|
return (
|
|
<div className="space-y-2" role="img" aria-label={`Scheduled ${cadence} across a 24-hour day`}>
|
|
<div className="relative h-4">
|
|
{labeled.map((mark) => {
|
|
const index = marks.findIndex((item) => item.key === mark.key)
|
|
return (
|
|
<span
|
|
key={mark.key}
|
|
className="absolute text-xs text-foreground-muted"
|
|
style={{ left: `${(index / marks.length) * 100}%` }}
|
|
>
|
|
{mark.label}
|
|
</span>
|
|
)
|
|
})}
|
|
</div>
|
|
<div className="flex h-8 gap-px">
|
|
{marks.map((mark) => (
|
|
<span key={mark.key} className="h-full min-w-0 flex-1 rounded-[2px] bg-brand/80" />
|
|
))}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
function WeekSchedule({
|
|
marks,
|
|
cadence,
|
|
}: {
|
|
marks: ReturnType<typeof getScheduleMarks>['marks']
|
|
cadence: string
|
|
}) {
|
|
return (
|
|
<div
|
|
className="grid grid-cols-7 gap-2"
|
|
role="img"
|
|
aria-label={`Scheduled ${cadence} across a week`}
|
|
>
|
|
{marks.map((mark) => (
|
|
<div key={mark.key} className="flex flex-col items-center gap-2">
|
|
<div className="flex h-16 w-full flex-col rounded-md bg-surface-200 p-1">
|
|
<span className="h-3 w-full rounded-[2px] bg-brand/80" />
|
|
</div>
|
|
<span className="text-xs text-foreground-muted">{mark.label}</span>
|
|
</div>
|
|
))}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
function AgentWatchSchedule({ id }: AgentWatchScheduleProps) {
|
|
const agent = getMonitoringAgent(id)
|
|
const { window, marks } = getScheduleMarks(agent.schedule.intervalMinutes)
|
|
const title = getScheduleLabel(agent)
|
|
|
|
return (
|
|
<div className="not-prose my-6 rounded-lg border bg-surface-75 p-4">
|
|
<p className="mb-4 text-sm text-foreground">{title}</p>
|
|
{window === 'week' ? (
|
|
<WeekSchedule marks={marks} cadence={agent.schedule.cadence} />
|
|
) : (
|
|
<DaySchedule marks={marks} cadence={agent.schedule.cadence} />
|
|
)}
|
|
<p className="mt-4 text-sm text-foreground-light">{agent.schedule.onDemand}</p>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export { AgentWatchSchedule }
|
|
export type { AgentWatchScheduleProps }
|