diff --git a/Releases/v5.0.0/.claude/PAI/PULSE/Observability/src/app/docs/page.tsx b/Releases/v5.0.0/.claude/PAI/PULSE/Observability/src/app/docs/page.tsx index f2ab6a9eca..f11dfe5b7b 100644 --- a/Releases/v5.0.0/.claude/PAI/PULSE/Observability/src/app/docs/page.tsx +++ b/Releases/v5.0.0/.claude/PAI/PULSE/Observability/src/app/docs/page.tsx @@ -312,32 +312,101 @@ function DocsLanding({ data }: { data: WikiIndex }) { ); } +function WikiErrorState({ + title, + message, + hint, + onRetry, +}: { + title: string; + message: string; + hint?: string; + onRetry: () => void; +}) { + return ( +
+
+
+ {title} +
+
+ {message} +
+ {hint && ( +
+ {hint} +
+ )} + +
+
+ ); +} + function DocsPageInner() { const searchParams = useSearchParams(); const docSlug = searchParams.get("doc"); const isViewing = !!docSlug; - const { data: indexData } = useQuery({ + const { + data: indexData, + isError: indexIsError, + error: indexError, + refetch: refetchIndex, + } = useQuery({ queryKey: ["wiki-index"], queryFn: async () => { const res = await fetch("/api/wiki"); - if (!res.ok) throw new Error("Failed to fetch wiki index"); + if (!res.ok) throw new Error(`Failed to fetch wiki index (HTTP ${res.status})`); return res.json(); }, staleTime: 30_000, enabled: !isViewing, }); - const { data: docDetail } = useQuery({ + const { + data: docDetail, + isError: docIsError, + error: docError, + refetch: refetchDoc, + } = useQuery({ queryKey: ["wiki-doc", docSlug], queryFn: async () => { const res = await fetch(`/api/wiki/doc/${docSlug}`); - if (!res.ok) throw new Error("Failed to fetch doc"); + if (!res.ok) throw new Error(`Failed to fetch doc (HTTP ${res.status})`); return res.json(); }, enabled: isViewing, }); + if (isViewing && docIsError) { + return ( + refetchDoc()} + /> + ); + } + + if (!isViewing && indexIsError) { + return ( + refetchIndex()} + hint="The Pulse wiki module may not be running. Check pulse.log for details." + /> + ); + } + if (isViewing && docDetail) { return (
diff --git a/Releases/v5.0.0/.claude/PAI/PULSE/package.json b/Releases/v5.0.0/.claude/PAI/PULSE/package.json new file mode 100644 index 0000000000..66e5104215 --- /dev/null +++ b/Releases/v5.0.0/.claude/PAI/PULSE/package.json @@ -0,0 +1,10 @@ +{ + "name": "pai-pulse", + "private": true, + "type": "module", + "description": "PAI Pulse daemon — runtime dependencies for pulse.ts and its modules.", + "dependencies": { + "minisearch": "^7.2.0", + "smol-toml": "^1.6.1" + } +}