@dendelion/paper-camp 0.23.2 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/app/assets/{index-SD_x9Z5F.js → index-15mPrQq0.js} +2 -2
  2. package/dist/app/assets/{index-SD_x9Z5F.js.map → index-15mPrQq0.js.map} +1 -1
  3. package/dist/app/assets/{index-DG2ri3IF.js → index-81fEepOO.js} +3 -3
  4. package/dist/app/assets/{index-DG2ri3IF.js.map → index-81fEepOO.js.map} +1 -1
  5. package/dist/app/assets/{index-mmzETz6G.js → index-BBvcyiG4.js} +3 -3
  6. package/dist/app/assets/{index-mmzETz6G.js.map → index-BBvcyiG4.js.map} +1 -1
  7. package/dist/app/assets/index-BJqS77OS.js +2 -0
  8. package/dist/app/assets/{index-Do4T60UL.js.map → index-BJqS77OS.js.map} +1 -1
  9. package/dist/app/assets/index-BVj9hjpY.js +2 -0
  10. package/dist/app/assets/{index-DxehIB14.js.map → index-BVj9hjpY.js.map} +1 -1
  11. package/dist/app/assets/index-CbsAL0YR.js +2 -0
  12. package/dist/app/assets/{index-DePKcR5b.js.map → index-CbsAL0YR.js.map} +1 -1
  13. package/dist/app/assets/index-DdZYRgzN.js +2 -0
  14. package/dist/app/assets/index-DdZYRgzN.js.map +1 -0
  15. package/dist/app/assets/index-cCrMJylm.js +3 -0
  16. package/dist/app/assets/index-cCrMJylm.js.map +1 -0
  17. package/dist/app/assets/main-CpTKYLW_.js +425 -0
  18. package/dist/app/assets/main-CpTKYLW_.js.map +1 -0
  19. package/dist/app/assets/main-iyjvjZKW.css +1 -0
  20. package/dist/app/assets/{sidebar-section-RSOrdZKe.js → sidebar-section-DsDt34HB.js} +2 -2
  21. package/dist/app/assets/{sidebar-section-RSOrdZKe.js.map → sidebar-section-DsDt34HB.js.map} +1 -1
  22. package/dist/app/index.html +2 -2
  23. package/dist/app/toolbar.js +3176 -3113
  24. package/dist/app/toolbar.js.map +1 -1
  25. package/dist/chunks/dev-port.BHJn90Pm.js +52 -0
  26. package/dist/chunks/dev-port.BHJn90Pm.js.map +1 -0
  27. package/dist/chunks/{phase-progress.DvktSTIz.js → machine-registry.BdaWfuyz.js} +1450 -1350
  28. package/dist/chunks/machine-registry.BdaWfuyz.js.map +1 -0
  29. package/dist/cli/index.js +8284 -7777
  30. package/dist/cli/index.js.map +1 -1
  31. package/dist/core/desk-discovery/evidence.d.ts +21 -0
  32. package/dist/core/desk-discovery/evidence.d.ts.map +1 -0
  33. package/dist/core/desk-discovery/evidence.test.d.ts +2 -0
  34. package/dist/core/desk-discovery/evidence.test.d.ts.map +1 -0
  35. package/dist/core/index.d.ts +1 -0
  36. package/dist/core/index.d.ts.map +1 -1
  37. package/dist/core/index.js +123 -114
  38. package/dist/core/machine-registry/index.d.ts +2 -0
  39. package/dist/core/machine-registry/index.d.ts.map +1 -0
  40. package/dist/core/machine-registry/machine-registry.d.ts +39 -0
  41. package/dist/core/machine-registry/machine-registry.d.ts.map +1 -0
  42. package/dist/core/machine-registry/machine-registry.test.d.ts +2 -0
  43. package/dist/core/machine-registry/machine-registry.test.d.ts.map +1 -0
  44. package/dist/core/parse/schemas.d.ts +8 -0
  45. package/dist/core/parse/schemas.d.ts.map +1 -1
  46. package/dist/core/tailnet.d.ts +14 -0
  47. package/dist/core/tailnet.d.ts.map +1 -0
  48. package/dist/core/tailnet.test.d.ts +2 -0
  49. package/dist/core/tailnet.test.d.ts.map +1 -0
  50. package/dist/types/index.d.ts +17 -1
  51. package/dist/types/index.d.ts.map +1 -1
  52. package/dist/types/index.js +19 -17
  53. package/dist/types/index.js.map +1 -1
  54. package/dist/vite/index.js +44 -51
  55. package/dist/vite/index.js.map +1 -1
  56. package/dist/vite/proxy.d.ts +2 -1
  57. package/dist/vite/proxy.d.ts.map +1 -1
  58. package/package.json +1 -1
  59. package/dist/app/assets/index-BHPCJror.js +0 -3
  60. package/dist/app/assets/index-BHPCJror.js.map +0 -1
  61. package/dist/app/assets/index-D_2SBGCS.js +0 -2
  62. package/dist/app/assets/index-D_2SBGCS.js.map +0 -1
  63. package/dist/app/assets/index-DePKcR5b.js +0 -2
  64. package/dist/app/assets/index-Do4T60UL.js +0 -2
  65. package/dist/app/assets/index-DxehIB14.js +0 -2
  66. package/dist/app/assets/main-DiplEwD3.js +0 -425
  67. package/dist/app/assets/main-DiplEwD3.js.map +0 -1
  68. package/dist/app/assets/main-DoJre3S-.css +0 -1
  69. package/dist/chunks/dev-port.DgdJE2bY.js +0 -43
  70. package/dist/chunks/dev-port.DgdJE2bY.js.map +0 -1
  71. package/dist/chunks/phase-progress.DvktSTIz.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index-mmzETz6G.js","sources":["../../../src/app/features/roadmap/hooks/use-roadmap-page.ts","../../../src/app/features/roadmap/hooks/use-roadmap-sidebar.ts","../../../src/app/features/roadmap/modals/add-roadmap-item-modal.tsx","../../../src/app/features/roadmap/modals/promote-roadmap-item-modal.tsx","../../../src/app/features/roadmap/views/add-candidate-form.tsx","../../../src/app/features/roadmap/views/candidate-row.tsx","../../../src/app/features/roadmap/views/goal-banner.tsx","../../../src/app/features/roadmap/constants.ts","../../../src/app/features/roadmap/views/idea-row.tsx","../../../src/app/features/roadmap/views/progress-bar.tsx","../../../src/app/features/roadmap/views/roadmap-item-row.tsx","../../../src/app/features/roadmap/views/horizon-section.tsx","../../../src/app/features/roadmap/roadmap-page.tsx","../../../src/app/features/roadmap/roadmap-sidebar.tsx"],"sourcesContent":["import { useOpenEntity } from '@/app/hooks';\nimport { addRoadmapCandidate } from '@/app/services/content/docs-api';\nimport { useAppStore } from '@/app/stores/app-store';\nimport type { PlanEntry, ResolvedRoadmapItem } from '@/types/index';\nimport { useSearch } from '@tanstack/react-router';\nimport { useEffect, useRef, useState } from 'react';\nimport { filterHorizons } from '../helpers';\n\ninterface Promoting {\n horizonTitle: string;\n item: ResolvedRoadmapItem;\n candidateName?: string;\n}\n\nexport const useRoadmapPage = () => {\n const roadmap = useAppStore((s) => s.roadmap);\n const roadmapError = useAppStore((s) => s.roadmapError);\n const loadRoadmap = useAppStore((s) => s.loadRoadmap);\n const filters = useAppStore((s) => s.roadmapFilters);\n const plans = useAppStore((s) => s.plans);\n const openEntity = useOpenEntity();\n const { item: highlightedItem } = useSearch({ from: '/roadmap' });\n const containerRef = useRef<HTMLDivElement>(null);\n const [promoting, setPromoting] = useState<Promoting | null>(null);\n\n useEffect(() => {\n loadRoadmap();\n }, [loadRoadmap]);\n\n useEffect(() => {\n if (!highlightedItem || !roadmap) return;\n const row = containerRef.current?.querySelector('.roadmap-item-highlighted');\n row?.scrollIntoView({ behavior: 'smooth', block: 'center' });\n }, [highlightedItem, roadmap]);\n\n const graduatedByItem = (item: ResolvedRoadmapItem): PlanEntry[] =>\n plans?.entries.filter((p) => p.subject === item.name) ?? [];\n\n const handleAddCandidate = async (horizonTitle: string, itemName: string, name: string) => {\n await addRoadmapCandidate(horizonTitle, itemName, name);\n await loadRoadmap();\n };\n\n const handlePromote = (\n horizonTitle: string,\n item: ResolvedRoadmapItem,\n candidateName?: string,\n ) => {\n setPromoting({ horizonTitle, item, candidateName });\n };\n\n const horizons = roadmap ? filterHorizons(roadmap, filters) : [];\n const totalVisible = horizons.reduce((count, horizon) => count + horizon.items.length, 0);\n const hasActiveFilters = filters.horizons.length > 0 || filters.statuses.length > 0;\n\n return {\n roadmap,\n roadmapError,\n loadRoadmap,\n horizons,\n totalVisible,\n hasActiveFilters,\n highlightedItem,\n containerRef,\n promoting,\n setPromoting,\n graduatedByItem,\n handleAddCandidate,\n handlePromote,\n onOpenGraduated: openEntity,\n };\n};\n","import { useAppStore } from '@/app/stores/app-store';\nimport type { PlanStatus } from '@/types/index';\nimport { useState } from 'react';\nimport { horizonItemCounts, statusItemCounts } from '../helpers';\n\nconst STATUS_CHIP_ORDER: PlanStatus[] = [\n 'in-progress',\n 'review',\n 'planned',\n 'idea',\n 'done',\n 'dropped',\n];\n\nexport const useRoadmapSidebar = () => {\n const roadmap = useAppStore((s) => s.roadmap);\n const filters = useAppStore((s) => s.roadmapFilters);\n const toggleRoadmapHorizon = useAppStore((s) => s.toggleRoadmapHorizon);\n const toggleRoadmapStatus = useAppStore((s) => s.toggleRoadmapStatus);\n const [addOpen, setAddOpen] = useState(false);\n\n const horizonTitles = roadmap?.horizons.map((horizon) => horizon.title) ?? [];\n const horizonCounts = roadmap ? horizonItemCounts(roadmap, filters) : {};\n const statusCounts = roadmap ? statusItemCounts(roadmap, filters) : {};\n const activeHorizons = new Set(filters.horizons);\n const activeStatuses = new Set(filters.statuses);\n const visibleStatuses = STATUS_CHIP_ORDER.filter(\n (status) => (statusCounts[status] ?? 0) > 0 || activeStatuses.has(status),\n );\n\n return {\n roadmap,\n horizonTitles,\n horizonCounts,\n statusCounts,\n activeHorizons,\n activeStatuses,\n visibleStatuses,\n addOpen,\n setAddOpen,\n toggleRoadmapHorizon,\n toggleRoadmapStatus,\n };\n};\n","import { addRoadmapItem } from '@/app/services/content/docs-api';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { Button, Input, Modal, Select } from '@dendelion/paper-ui';\nimport { useEffect, useRef, useState } from 'react';\n\ninterface AddRoadmapItemModalProps {\n open: boolean;\n horizonTitles: string[];\n onClose: () => void;\n}\n\nexport const AddRoadmapItemModal = ({ open, horizonTitles, onClose }: AddRoadmapItemModalProps) => {\n const loadRoadmap = useAppStore((s) => s.loadRoadmap);\n const [horizon, setHorizon] = useState(horizonTitles[0] ?? '');\n const [name, setName] = useState('');\n const [description, setDescription] = useState('');\n const [saving, setSaving] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const horizonTitlesRef = useRef(horizonTitles);\n horizonTitlesRef.current = horizonTitles;\n\n useEffect(() => {\n if (open) {\n setHorizon(horizonTitlesRef.current[0] ?? '');\n setName('');\n setDescription('');\n setError(null);\n setSaving(false);\n }\n }, [open]);\n\n const handleAdd = async () => {\n if (!name.trim() || !horizon) return;\n setSaving(true);\n setError(null);\n try {\n await addRoadmapItem(horizon, name.trim(), description.trim());\n await loadRoadmap();\n onClose();\n } catch (err) {\n setError((err as Error).message);\n } finally {\n setSaving(false);\n }\n };\n\n return (\n <Modal open={open} onClose={onClose} title=\"Add roadmap item\" size=\"small\">\n <div className=\"flex flex-col gap-4\">\n <Select\n size=\"small\"\n value={horizon}\n onChange={setHorizon}\n disabled={saving}\n options={horizonTitles.map((title) => ({ value: title, label: title }))}\n />\n <Input\n size=\"small\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n placeholder=\"Item name…\"\n disabled={saving}\n autoFocus\n />\n <Input\n size=\"small\"\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') handleAdd();\n }}\n placeholder=\"Description…\"\n disabled={saving}\n />\n {error && <p className=\"m-0 text-watercolor-rose-dark text-sm\">{error}</p>}\n <div className=\"flex justify-end gap-2\">\n <Button type=\"button\" variant=\"ghost\" onClick={onClose} disabled={saving}>\n Cancel\n </Button>\n <Button\n type=\"button\"\n variant=\"primary\"\n onClick={handleAdd}\n disabled={saving || !name.trim() || !horizon}\n >\n {saving ? 'Adding…' : 'Add item'}\n </Button>\n </div>\n </div>\n </Modal>\n );\n};\n","import { buildRoadmapPromotePrompt } from '@/app/features/plans/prompts';\nimport { useSubjectVocabulary } from '@/app/hooks/use-subject-vocabulary';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { oneLineErrorSummary } from '@/app/utils/error-summary';\nimport type { RoadmapItem } from '@/types/index';\nimport { Button, Modal, Select, useToast } from '@dendelion/paper-ui';\nimport { useEffect, useState } from 'react';\n\nconst NO_SUBJECT = '__no-subject__';\n\ninterface PromoteRoadmapItemModalProps {\n horizonTitle: string | null;\n item: RoadmapItem | null;\n candidateName?: string | null;\n onClose: () => void;\n onPromoted: () => void;\n}\n\nexport const PromoteRoadmapItemModal = ({\n horizonTitle,\n item,\n candidateName,\n onClose,\n onPromoted,\n}: PromoteRoadmapItemModalProps) => {\n const promoteRoadmapItem = useAppStore((s) => s.promoteRoadmapItem);\n const launchIdeaExtend = useAppStore((s) => s.launchIdeaExtend);\n const { subjects, available: subjectsAvailable } = useSubjectVocabulary();\n const [subject, setSubject] = useState(NO_SUBJECT);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const { toast } = useToast();\n\n useEffect(() => {\n if (item) {\n // A candidate defaults to its parent item's name — the \"big bet becomes a\n // Subject\" rule — but the picker still lets the user override it.\n setSubject(candidateName ? item.name : NO_SUBJECT);\n setLoading(false);\n setError(null);\n }\n }, [item, candidateName]);\n\n const handlePromote = async () => {\n if (!item || !horizonTitle) return;\n setLoading(true);\n setError(null);\n try {\n const id = await promoteRoadmapItem(\n horizonTitle,\n item,\n subject === NO_SUBJECT ? undefined : subject,\n candidateName ?? undefined,\n );\n const idea = useAppStore.getState().ideaEntries.find((e) => e.id === id);\n if (idea) {\n try {\n await launchIdeaExtend(id, buildRoadmapPromotePrompt(idea, horizonTitle));\n } catch (err) {\n // The idea was created either way — a failed refine launch just means\n // no background research ran, not that the promotion itself failed.\n toast({\n title: 'Idea created, but the refine agent failed to launch',\n description: oneLineErrorSummary((err as Error).message),\n variant: 'error',\n });\n }\n }\n onPromoted();\n onClose();\n } catch (err) {\n setError((err as Error).message);\n } finally {\n setLoading(false);\n }\n };\n\n return (\n <Modal\n open={item !== null}\n onClose={onClose}\n title={candidateName ?? item?.name ?? ''}\n size=\"small\"\n >\n <div className=\"flex flex-col gap-4\">\n {!candidateName && <p className=\"m-0 opacity-80\">{item?.description}</p>}\n <div>\n <Select\n size=\"small\"\n value={subject}\n onChange={setSubject}\n disabled={loading || !subjectsAvailable}\n options={[\n { value: NO_SUBJECT, label: 'No subject' },\n ...(!subjectsAvailable && subject !== NO_SUBJECT\n ? [{ value: subject, label: subject }]\n : []),\n ...subjects.map((s) => ({ value: s, label: s })),\n ]}\n />\n </div>\n {error && <p className=\"m-0 text-watercolor-rose-dark text-sm\">{error}</p>}\n <div className=\"flex justify-end gap-2\">\n <Button type=\"button\" variant=\"ghost\" onClick={onClose} disabled={loading}>\n Cancel\n </Button>\n <Button type=\"button\" variant=\"primary\" onClick={handlePromote} disabled={loading}>\n {loading ? 'Promoting…' : 'Promote to idea'}\n </Button>\n </div>\n </div>\n </Modal>\n );\n};\n","import { Button, Input } from '@dendelion/paper-ui';\nimport { useState } from 'react';\n\ninterface AddCandidateFormProps {\n onAdd: (name: string) => Promise<void>;\n}\n\nexport const AddCandidateForm = ({ onAdd }: AddCandidateFormProps) => {\n const [name, setName] = useState('');\n const [saving, setSaving] = useState(false);\n\n const handleAdd = async () => {\n if (!name.trim()) return;\n setSaving(true);\n try {\n await onAdd(name.trim());\n setName('');\n } finally {\n setSaving(false);\n }\n };\n\n return (\n <div className=\"flex gap-2\">\n <Input\n size=\"small\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') handleAdd();\n }}\n placeholder=\"Add option…\"\n disabled={saving}\n className=\"flex-1\"\n />\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"small\"\n onClick={handleAdd}\n disabled={saving || !name.trim()}\n >\n Add\n </Button>\n </div>\n );\n};\n","import { Button, Card } from '@dendelion/paper-ui';\n\ninterface CandidateRowProps {\n name: string;\n onPromote: () => void;\n}\n\nexport const CandidateRow = ({ name, onPromote }: CandidateRowProps) => (\n <Card size=\"small\" texture=\"kraft\" className=\"plan-row-card\">\n <div className=\"flex items-center gap-3\">\n <span className=\"flex-1\">{name}</span>\n <Button type=\"button\" variant=\"ghost\" size=\"small\" onClick={onPromote}>\n Promote to idea\n </Button>\n </div>\n </Card>\n);\n","import { Markdown } from '@/app/components/markdown';\nimport { useState } from 'react';\n\ninterface GoalBannerProps {\n goal: string;\n}\n\nexport const GoalBanner = ({ goal }: GoalBannerProps) => {\n const [expanded, setExpanded] = useState(false);\n const [firstParagraph, ...restParagraphs] = goal.split(/\\n{2,}/);\n const hasMore = restParagraphs.length > 0;\n\n return (\n <div className=\"mb-6 pb-4 border-b border-black/[8%]\">\n <span className=\"font-handwritten text-xs font-semibold opacity-[0.55]\">The goal</span>\n <div className=\"text-sm leading-relaxed opacity-80 mt-2\">\n <Markdown>{firstParagraph}</Markdown>\n {expanded && hasMore && <Markdown>{restParagraphs.join('\\n\\n')}</Markdown>}\n </div>\n {hasMore && (\n <button\n type=\"button\"\n onClick={() => setExpanded((v) => !v)}\n className=\"bg-transparent border-none p-0 mt-2 cursor-pointer text-2xs opacity-[0.65] underline\"\n >\n {expanded ? 'Show less' : 'Show more'}\n </button>\n )}\n </div>\n );\n};\n","export const HIGHLIGHT_OUTLINE_CLASS = 'outline-[rgba(200,154,90,0.5)]';\n\nexport const CANDIDATE_STAMP = {\n fill: 'rgba(0, 0, 0, 0.06)',\n text: 'rgba(0, 0, 0, 0.55)',\n};\n","import { PrBadge } from '@/app/features/plans/components/pr-badge';\nimport { STATUS_LABEL, STATUS_STAMP } from '@/app/features/plans/constants';\nimport type { PlanEntry, PlanStatus, PrInfo, RoadmapLink } from '@/types/index';\nimport { Card, Stamp } from '@dendelion/paper-ui';\n\nexport interface MergedIdea {\n key: string;\n label: string;\n status: PlanStatus;\n pr?: PrInfo;\n planId?: string;\n planTitle?: string;\n}\n\nexport const mergeIdeas = (links: RoadmapLink[], graduated: PlanEntry[]): MergedIdea[] => {\n const represented = new Set<string>();\n const merged: MergedIdea[] = graduated.map((plan) => {\n if (plan.id) represented.add(plan.id);\n if (plan.idea) represented.add(plan.idea);\n return {\n key: plan.title,\n label: plan.title,\n status: plan.status,\n pr: plan.pr,\n planId: plan.id,\n planTitle: plan.title,\n };\n });\n for (const link of links) {\n if (represented.has(link.id)) continue;\n merged.push({ key: link.id, label: link.id, status: link.status, pr: link.pr });\n }\n return merged;\n};\n\ninterface IdeaRowProps {\n idea: MergedIdea;\n onOpen?: () => void;\n}\n\nexport const IdeaRow = ({ idea, onOpen }: IdeaRowProps) => (\n <Card size=\"small\" texture=\"kraft\" className=\"plan-row-card\">\n <div className=\"flex items-center gap-3\">\n {onOpen ? (\n <button\n type=\"button\"\n onClick={onOpen}\n className=\"flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap bg-transparent border-none p-0 cursor-pointer [font:inherit] text-inherit text-left\"\n >\n {idea.label}\n </button>\n ) : (\n <span className=\"flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap\">\n {idea.label}\n </span>\n )}\n {idea.pr && <PrBadge pr={idea.pr} />}\n <Stamp\n size=\"small\"\n fillColor={STATUS_STAMP[idea.status].fill}\n textColor={STATUS_STAMP[idea.status].text}\n >\n {STATUS_LABEL[idea.status]}\n </Stamp>\n </div>\n </Card>\n);\n","interface ProgressBarProps {\n done: number;\n total: number;\n}\n\nexport const ProgressBar = ({ done, total }: ProgressBarProps) => {\n const percent = total > 0 ? Math.round((done / total) * 100) : 0;\n return (\n <div className=\"w-24 h-1.5 rounded-full bg-black/[0.08] overflow-hidden shrink-0\">\n <div\n className={`h-full rounded-full ${total > 0 ? 'bg-watercolor-green' : 'bg-transparent'}`}\n style={{ width: `${percent}%` }}\n />\n </div>\n );\n};\n","import { STATUS_STAMP } from '@/app/features/plans/constants';\nimport type { PlanEntry, ResolvedRoadmapItem } from '@/types/index';\nimport { Button, Stamp } from '@dendelion/paper-ui';\nimport { useEffect, useState } from 'react';\nimport { CANDIDATE_STAMP, HIGHLIGHT_OUTLINE_CLASS } from '../constants';\nimport { AddCandidateForm } from './add-candidate-form';\nimport { CandidateRow } from './candidate-row';\nimport { IdeaRow, mergeIdeas } from './idea-row';\nimport { ProgressBar } from './progress-bar';\n\nconst graduationCounts = (graduated: PlanEntry[]) => ({\n shipped: graduated.filter((p) => p.status === 'done').length,\n queued: graduated.filter((p) => p.status !== 'done' && p.status !== 'dropped').length,\n});\n\nconst ChevronRightIcon = ({ size = 14 }: { size?: number }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points=\"9 18 15 12 9 6\" />\n </svg>\n);\n\ninterface RoadmapItemRowProps {\n item: ResolvedRoadmapItem;\n graduated: PlanEntry[];\n highlighted: boolean;\n onPromote: () => void;\n onPromoteCandidate: (candidateName: string) => void;\n onAddCandidate: (name: string) => Promise<void>;\n onOpenGraduated: (id: string | undefined, title: string) => void;\n}\n\nexport const RoadmapItemRow = ({\n item,\n graduated,\n highlighted,\n onPromote,\n onPromoteCandidate,\n onAddCandidate,\n onOpenGraduated,\n}: RoadmapItemRowProps) => {\n const [expanded, setExpanded] = useState(highlighted);\n const { shipped, queued } = graduationCounts(graduated);\n const candidates = item.candidates.length;\n const ideas = mergeIdeas(item.links, graduated);\n\n useEffect(() => {\n if (highlighted) setExpanded(true);\n }, [highlighted]);\n\n return (\n <div\n className={`border-b border-black/10 last:border-b-0 ${highlighted ? `roadmap-item-highlighted outline outline-2 outline-offset-[-2px] ${HIGHLIGHT_OUTLINE_CLASS}` : ''}`}\n >\n <button\n type=\"button\"\n aria-expanded={expanded}\n onClick={() => setExpanded((v) => !v)}\n className=\"flex w-full items-center gap-3 py-2.5 px-0 bg-transparent border-none cursor-pointer text-left [font:inherit] text-inherit\"\n >\n <span\n className={`inline-flex items-center opacity-50 shrink-0 ${expanded ? 'rotate-90' : ''}`}\n >\n <ChevronRightIcon />\n </span>\n <span className=\"font-semibold flex-1 min-w-0 truncate\">{item.name}</span>\n <ProgressBar done={item.rollup.done} total={item.rollup.total} />\n {queued > 0 && (\n <Stamp\n size=\"small\"\n fillColor={STATUS_STAMP.planned.fill}\n textColor={STATUS_STAMP.planned.text}\n >\n {queued} in queue\n </Stamp>\n )}\n {shipped > 0 && (\n <Stamp size=\"small\" fillColor={STATUS_STAMP.done.fill} textColor={STATUS_STAMP.done.text}>\n {shipped} shipped\n </Stamp>\n )}\n {candidates > 0 && (\n <Stamp size=\"small\" fillColor={CANDIDATE_STAMP.fill} textColor={CANDIDATE_STAMP.text}>\n {candidates} candidate{candidates === 1 ? '' : 's'}\n </Stamp>\n )}\n </button>\n {expanded && (\n <div className=\"flex flex-col gap-1 pl-6 pb-4\">\n <span className=\"text-sm opacity-70\">{item.description}</span>\n {ideas.map((idea) => (\n <IdeaRow\n key={idea.key}\n idea={idea}\n onOpen={\n idea.planTitle\n ? () => onOpenGraduated(idea.planId, idea.planTitle as string)\n : undefined\n }\n />\n ))}\n {item.candidates.map((candidateName) => (\n <CandidateRow\n key={candidateName}\n name={candidateName}\n onPromote={() => onPromoteCandidate(candidateName)}\n />\n ))}\n <AddCandidateForm onAdd={onAddCandidate} />\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"small\"\n onClick={onPromote}\n className=\"self-start\"\n >\n Promote to idea\n </Button>\n </div>\n )}\n </div>\n );\n};\n","import type { PlanEntry, ResolvedRoadmapHorizon, ResolvedRoadmapItem } from '@/types/index';\nimport { RoadmapItemRow } from './roadmap-item-row';\n\nconst HORIZON_HEADER_CLASSES =\n 'font-handwritten text-md font-semibold opacity-70 leading-none pt-2 px-1 pb-0';\n\ninterface HorizonSectionProps {\n horizon: ResolvedRoadmapHorizon;\n highlightedItem: string | undefined;\n graduatedByItem: (item: ResolvedRoadmapItem) => PlanEntry[];\n onPromote: (item: ResolvedRoadmapItem, candidateName?: string) => void;\n onAddCandidate: (itemName: string, name: string) => Promise<void>;\n onOpenGraduated: (id: string | undefined, title: string) => void;\n}\n\nexport const HorizonSection = ({\n horizon,\n highlightedItem,\n graduatedByItem,\n onPromote,\n onAddCandidate,\n onOpenGraduated,\n}: HorizonSectionProps) => (\n <div className=\"flex flex-col gap-1\">\n <div className={HORIZON_HEADER_CLASSES}>{horizon.title}</div>\n <div className=\"flex flex-col\">\n {horizon.items.map((item) => (\n <RoadmapItemRow\n key={item.name}\n item={item}\n graduated={graduatedByItem(item)}\n highlighted={item.name === highlightedItem}\n onPromote={() => onPromote(item)}\n onPromoteCandidate={(candidateName) => onPromote(item, candidateName)}\n onAddCandidate={(name) => onAddCandidate(item.name, name)}\n onOpenGraduated={onOpenGraduated}\n />\n ))}\n </div>\n </div>\n);\n","import { PageTitle } from '@/app/components/page-title';\nimport { useRoadmapPage } from './hooks';\nimport { PromoteRoadmapItemModal } from './modals';\nimport { GoalBanner, HorizonSection } from './views';\n\nexport const RoadmapPage = () => {\n const {\n roadmap,\n roadmapError,\n loadRoadmap,\n horizons,\n totalVisible,\n hasActiveFilters,\n highlightedItem,\n containerRef,\n promoting,\n setPromoting,\n graduatedByItem,\n handleAddCandidate,\n handlePromote,\n onOpenGraduated,\n } = useRoadmapPage();\n\n if (roadmapError) {\n return (\n <div>\n <PageTitle>Roadmap</PageTitle>\n <p className=\"opacity-50\">\n Couldn't load the roadmap — the server may need a restart to pick up new routes.\n </p>\n </div>\n );\n }\n\n if (!roadmap) {\n return (\n <div>\n <PageTitle>Roadmap</PageTitle>\n <p className=\"opacity-50\">Loading…</p>\n </div>\n );\n }\n\n if (roadmap.horizons.length === 0) {\n return (\n <div>\n <PageTitle>Roadmap</PageTitle>\n <p className=\"opacity-50\">No `ROADMAP.md` found at the project root.</p>\n </div>\n );\n }\n\n return (\n <div ref={containerRef}>\n <PageTitle>Roadmap</PageTitle>\n <GoalBanner goal={roadmap.goal} />\n {totalVisible === 0 ? (\n <p className=\"opacity-50 py-6 px-0 text-center\">\n {hasActiveFilters\n ? 'Nothing matches these filters — clear one from the sidebar to see more.'\n : 'No roadmap items yet — add one from the sidebar.'}\n </p>\n ) : (\n <div className=\"flex flex-col gap-6\">\n {horizons\n .filter((horizon) => horizon.items.length > 0)\n .map((horizon) => (\n <HorizonSection\n key={horizon.title}\n horizon={horizon}\n highlightedItem={highlightedItem}\n graduatedByItem={graduatedByItem}\n onPromote={(item, candidateName) =>\n handlePromote(horizon.title, item, candidateName)\n }\n onAddCandidate={(itemName, name) =>\n handleAddCandidate(horizon.title, itemName, name)\n }\n onOpenGraduated={onOpenGraduated}\n />\n ))}\n </div>\n )}\n <PromoteRoadmapItemModal\n horizonTitle={promoting?.horizonTitle ?? null}\n item={promoting?.item ?? null}\n candidateName={promoting?.candidateName}\n onClose={() => setPromoting(null)}\n onPromoted={loadRoadmap}\n />\n </div>\n );\n};\n","import { STATUS_LABEL, STATUS_STAMP } from '@/app/features/plans/constants';\nimport { Button, ListItem } from '@dendelion/paper-ui';\nimport { useRoadmapSidebar } from './hooks';\nimport { AddRoadmapItemModal } from './modals';\n\n// Matches SidebarSection — handwritten, no caps, one grid cell.\nconst sectionLabelClass = 'pc-row-label font-handwritten text-xs font-semibold opacity-[0.45]';\n\nexport const RoadmapSidebar = () => {\n const {\n roadmap,\n horizonTitles,\n horizonCounts,\n statusCounts,\n activeHorizons,\n activeStatuses,\n visibleStatuses,\n addOpen,\n setAddOpen,\n toggleRoadmapHorizon,\n toggleRoadmapStatus,\n } = useRoadmapSidebar();\n\n if (!roadmap) return null;\n\n return (\n <div className=\"flex flex-col\">\n <div className=\"flex h-[64px] items-center\">\n <Button\n type=\"button\"\n variant=\"primary\"\n size=\"small\"\n onClick={() => setAddOpen(true)}\n disabled={horizonTitles.length === 0}\n >\n + Add item\n </Button>\n </div>\n\n <div>\n <div className={sectionLabelClass}>Horizon</div>\n <div className=\"flex flex-col\">\n {horizonTitles.map((title) => (\n <ListItem\n key={title}\n size=\"small\"\n active={activeHorizons.has(title)}\n onClick={() => toggleRoadmapHorizon(title)}\n className=\"pc-row text-xs\"\n action={<span className=\"text-2xs text-ink-500\">{horizonCounts[title] ?? 0}</span>}\n >\n {title}\n </ListItem>\n ))}\n </div>\n </div>\n\n <div>\n <div className={sectionLabelClass}>Status</div>\n <div className=\"flex flex-col\">\n {visibleStatuses.length === 0 && (\n <span className=\"opacity-50 text-2xs\">No linked ideas</span>\n )}\n {visibleStatuses.map((status) => (\n <ListItem\n key={status}\n size=\"small\"\n active={activeStatuses.has(status)}\n onClick={() => toggleRoadmapStatus(status)}\n className=\"pc-row text-xs\"\n icon={\n <span\n className=\"w-[9px] h-[9px] rounded-full shrink-0\"\n style={{ background: STATUS_STAMP[status].text }}\n />\n }\n action={<span className=\"text-2xs text-ink-500\">{statusCounts[status] ?? 0}</span>}\n >\n {STATUS_LABEL[status]}\n </ListItem>\n ))}\n </div>\n </div>\n\n <AddRoadmapItemModal\n open={addOpen}\n horizonTitles={horizonTitles}\n onClose={() => setAddOpen(false)}\n />\n </div>\n );\n};\n"],"names":["useRoadmapPage","roadmap","useAppStore","s","roadmapError","loadRoadmap","filters","plans","openEntity","useOpenEntity","highlightedItem","useSearch","containerRef","useRef","promoting","setPromoting","useState","useEffect","row","_a","graduatedByItem","item","p","handleAddCandidate","horizonTitle","itemName","name","addRoadmapCandidate","handlePromote","candidateName","horizons","filterHorizons","totalVisible","count","horizon","hasActiveFilters","STATUS_CHIP_ORDER","useRoadmapSidebar","toggleRoadmapHorizon","toggleRoadmapStatus","addOpen","setAddOpen","horizonTitles","horizonCounts","horizonItemCounts","statusCounts","statusItemCounts","activeHorizons","activeStatuses","visibleStatuses","status","AddRoadmapItemModal","open","onClose","setHorizon","setName","description","setDescription","saving","setSaving","error","setError","horizonTitlesRef","handleAdd","addRoadmapItem","err","jsx","Modal","jsxs","Select","title","Input","e","Button","NO_SUBJECT","PromoteRoadmapItemModal","onPromoted","promoteRoadmapItem","launchIdeaExtend","subjects","subjectsAvailable","useSubjectVocabulary","subject","setSubject","loading","setLoading","toast","useToast","id","idea","buildRoadmapPromotePrompt","oneLineErrorSummary","AddCandidateForm","onAdd","CandidateRow","onPromote","Card","GoalBanner","goal","expanded","setExpanded","firstParagraph","restParagraphs","hasMore","Markdown","v","HIGHLIGHT_OUTLINE_CLASS","CANDIDATE_STAMP","mergeIdeas","links","graduated","represented","merged","plan","link","IdeaRow","onOpen","PrBadge","Stamp","STATUS_STAMP","STATUS_LABEL","ProgressBar","done","total","percent","graduationCounts","ChevronRightIcon","size","RoadmapItemRow","highlighted","onPromoteCandidate","onAddCandidate","onOpenGraduated","shipped","queued","candidates","ideas","HORIZON_HEADER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AlEmB,IAoEvB"}
1
+ {"version":3,"file":"index-BBvcyiG4.js","sources":["../../../src/app/features/roadmap/hooks/use-roadmap-page.ts","../../../src/app/features/roadmap/hooks/use-roadmap-sidebar.ts","../../../src/app/features/roadmap/modals/add-roadmap-item-modal.tsx","../../../src/app/features/roadmap/modals/promote-roadmap-item-modal.tsx","../../../src/app/features/roadmap/views/add-candidate-form.tsx","../../../src/app/features/roadmap/views/candidate-row.tsx","../../../src/app/features/roadmap/views/goal-banner.tsx","../../../src/app/features/roadmap/constants.ts","../../../src/app/features/roadmap/views/idea-row.tsx","../../../src/app/features/roadmap/views/progress-bar.tsx","../../../src/app/features/roadmap/views/roadmap-item-row.tsx","../../../src/app/features/roadmap/views/horizon-section.tsx","../../../src/app/features/roadmap/roadmap-page.tsx","../../../src/app/features/roadmap/roadmap-sidebar.tsx"],"sourcesContent":["import { useOpenEntity } from '@/app/hooks';\nimport { addRoadmapCandidate } from '@/app/services/content/docs-api';\nimport { useAppStore } from '@/app/stores/app-store';\nimport type { PlanEntry, ResolvedRoadmapItem } from '@/types/index';\nimport { useSearch } from '@tanstack/react-router';\nimport { useEffect, useRef, useState } from 'react';\nimport { filterHorizons } from '../helpers';\n\ninterface Promoting {\n horizonTitle: string;\n item: ResolvedRoadmapItem;\n candidateName?: string;\n}\n\nexport const useRoadmapPage = () => {\n const roadmap = useAppStore((s) => s.roadmap);\n const roadmapError = useAppStore((s) => s.roadmapError);\n const loadRoadmap = useAppStore((s) => s.loadRoadmap);\n const filters = useAppStore((s) => s.roadmapFilters);\n const plans = useAppStore((s) => s.plans);\n const openEntity = useOpenEntity();\n const { item: highlightedItem } = useSearch({ from: '/roadmap' });\n const containerRef = useRef<HTMLDivElement>(null);\n const [promoting, setPromoting] = useState<Promoting | null>(null);\n\n useEffect(() => {\n loadRoadmap();\n }, [loadRoadmap]);\n\n useEffect(() => {\n if (!highlightedItem || !roadmap) return;\n const row = containerRef.current?.querySelector('.roadmap-item-highlighted');\n row?.scrollIntoView({ behavior: 'smooth', block: 'center' });\n }, [highlightedItem, roadmap]);\n\n const graduatedByItem = (item: ResolvedRoadmapItem): PlanEntry[] =>\n plans?.entries.filter((p) => p.subject === item.name) ?? [];\n\n const handleAddCandidate = async (horizonTitle: string, itemName: string, name: string) => {\n await addRoadmapCandidate(horizonTitle, itemName, name);\n await loadRoadmap();\n };\n\n const handlePromote = (\n horizonTitle: string,\n item: ResolvedRoadmapItem,\n candidateName?: string,\n ) => {\n setPromoting({ horizonTitle, item, candidateName });\n };\n\n const horizons = roadmap ? filterHorizons(roadmap, filters) : [];\n const totalVisible = horizons.reduce((count, horizon) => count + horizon.items.length, 0);\n const hasActiveFilters = filters.horizons.length > 0 || filters.statuses.length > 0;\n\n return {\n roadmap,\n roadmapError,\n loadRoadmap,\n horizons,\n totalVisible,\n hasActiveFilters,\n highlightedItem,\n containerRef,\n promoting,\n setPromoting,\n graduatedByItem,\n handleAddCandidate,\n handlePromote,\n onOpenGraduated: openEntity,\n };\n};\n","import { useAppStore } from '@/app/stores/app-store';\nimport type { PlanStatus } from '@/types/index';\nimport { useState } from 'react';\nimport { horizonItemCounts, statusItemCounts } from '../helpers';\n\nconst STATUS_CHIP_ORDER: PlanStatus[] = [\n 'in-progress',\n 'review',\n 'planned',\n 'idea',\n 'done',\n 'dropped',\n];\n\nexport const useRoadmapSidebar = () => {\n const roadmap = useAppStore((s) => s.roadmap);\n const filters = useAppStore((s) => s.roadmapFilters);\n const toggleRoadmapHorizon = useAppStore((s) => s.toggleRoadmapHorizon);\n const toggleRoadmapStatus = useAppStore((s) => s.toggleRoadmapStatus);\n const [addOpen, setAddOpen] = useState(false);\n\n const horizonTitles = roadmap?.horizons.map((horizon) => horizon.title) ?? [];\n const horizonCounts = roadmap ? horizonItemCounts(roadmap, filters) : {};\n const statusCounts = roadmap ? statusItemCounts(roadmap, filters) : {};\n const activeHorizons = new Set(filters.horizons);\n const activeStatuses = new Set(filters.statuses);\n const visibleStatuses = STATUS_CHIP_ORDER.filter(\n (status) => (statusCounts[status] ?? 0) > 0 || activeStatuses.has(status),\n );\n\n return {\n roadmap,\n horizonTitles,\n horizonCounts,\n statusCounts,\n activeHorizons,\n activeStatuses,\n visibleStatuses,\n addOpen,\n setAddOpen,\n toggleRoadmapHorizon,\n toggleRoadmapStatus,\n };\n};\n","import { addRoadmapItem } from '@/app/services/content/docs-api';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { Button, Input, Modal, Select } from '@dendelion/paper-ui';\nimport { useEffect, useRef, useState } from 'react';\n\ninterface AddRoadmapItemModalProps {\n open: boolean;\n horizonTitles: string[];\n onClose: () => void;\n}\n\nexport const AddRoadmapItemModal = ({ open, horizonTitles, onClose }: AddRoadmapItemModalProps) => {\n const loadRoadmap = useAppStore((s) => s.loadRoadmap);\n const [horizon, setHorizon] = useState(horizonTitles[0] ?? '');\n const [name, setName] = useState('');\n const [description, setDescription] = useState('');\n const [saving, setSaving] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const horizonTitlesRef = useRef(horizonTitles);\n horizonTitlesRef.current = horizonTitles;\n\n useEffect(() => {\n if (open) {\n setHorizon(horizonTitlesRef.current[0] ?? '');\n setName('');\n setDescription('');\n setError(null);\n setSaving(false);\n }\n }, [open]);\n\n const handleAdd = async () => {\n if (!name.trim() || !horizon) return;\n setSaving(true);\n setError(null);\n try {\n await addRoadmapItem(horizon, name.trim(), description.trim());\n await loadRoadmap();\n onClose();\n } catch (err) {\n setError((err as Error).message);\n } finally {\n setSaving(false);\n }\n };\n\n return (\n <Modal open={open} onClose={onClose} title=\"Add roadmap item\" size=\"small\">\n <div className=\"flex flex-col gap-4\">\n <Select\n size=\"small\"\n value={horizon}\n onChange={setHorizon}\n disabled={saving}\n options={horizonTitles.map((title) => ({ value: title, label: title }))}\n />\n <Input\n size=\"small\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n placeholder=\"Item name…\"\n disabled={saving}\n autoFocus\n />\n <Input\n size=\"small\"\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') handleAdd();\n }}\n placeholder=\"Description…\"\n disabled={saving}\n />\n {error && <p className=\"m-0 text-watercolor-rose-dark text-sm\">{error}</p>}\n <div className=\"flex justify-end gap-2\">\n <Button type=\"button\" variant=\"ghost\" onClick={onClose} disabled={saving}>\n Cancel\n </Button>\n <Button\n type=\"button\"\n variant=\"primary\"\n onClick={handleAdd}\n disabled={saving || !name.trim() || !horizon}\n >\n {saving ? 'Adding…' : 'Add item'}\n </Button>\n </div>\n </div>\n </Modal>\n );\n};\n","import { buildRoadmapPromotePrompt } from '@/app/features/plans/prompts';\nimport { useSubjectVocabulary } from '@/app/hooks/use-subject-vocabulary';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { oneLineErrorSummary } from '@/app/utils/error-summary';\nimport type { RoadmapItem } from '@/types/index';\nimport { Button, Modal, Select, useToast } from '@dendelion/paper-ui';\nimport { useEffect, useState } from 'react';\n\nconst NO_SUBJECT = '__no-subject__';\n\ninterface PromoteRoadmapItemModalProps {\n horizonTitle: string | null;\n item: RoadmapItem | null;\n candidateName?: string | null;\n onClose: () => void;\n onPromoted: () => void;\n}\n\nexport const PromoteRoadmapItemModal = ({\n horizonTitle,\n item,\n candidateName,\n onClose,\n onPromoted,\n}: PromoteRoadmapItemModalProps) => {\n const promoteRoadmapItem = useAppStore((s) => s.promoteRoadmapItem);\n const launchIdeaExtend = useAppStore((s) => s.launchIdeaExtend);\n const { subjects, available: subjectsAvailable } = useSubjectVocabulary();\n const [subject, setSubject] = useState(NO_SUBJECT);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const { toast } = useToast();\n\n useEffect(() => {\n if (item) {\n // A candidate defaults to its parent item's name — the \"big bet becomes a\n // Subject\" rule — but the picker still lets the user override it.\n setSubject(candidateName ? item.name : NO_SUBJECT);\n setLoading(false);\n setError(null);\n }\n }, [item, candidateName]);\n\n const handlePromote = async () => {\n if (!item || !horizonTitle) return;\n setLoading(true);\n setError(null);\n try {\n const id = await promoteRoadmapItem(\n horizonTitle,\n item,\n subject === NO_SUBJECT ? undefined : subject,\n candidateName ?? undefined,\n );\n const idea = useAppStore.getState().ideaEntries.find((e) => e.id === id);\n if (idea) {\n try {\n await launchIdeaExtend(id, buildRoadmapPromotePrompt(idea, horizonTitle));\n } catch (err) {\n // The idea was created either way — a failed refine launch just means\n // no background research ran, not that the promotion itself failed.\n toast({\n title: 'Idea created, but the refine agent failed to launch',\n description: oneLineErrorSummary((err as Error).message),\n variant: 'error',\n });\n }\n }\n onPromoted();\n onClose();\n } catch (err) {\n setError((err as Error).message);\n } finally {\n setLoading(false);\n }\n };\n\n return (\n <Modal\n open={item !== null}\n onClose={onClose}\n title={candidateName ?? item?.name ?? ''}\n size=\"small\"\n >\n <div className=\"flex flex-col gap-4\">\n {!candidateName && <p className=\"m-0 opacity-80\">{item?.description}</p>}\n <div>\n <Select\n size=\"small\"\n value={subject}\n onChange={setSubject}\n disabled={loading || !subjectsAvailable}\n options={[\n { value: NO_SUBJECT, label: 'No subject' },\n ...(!subjectsAvailable && subject !== NO_SUBJECT\n ? [{ value: subject, label: subject }]\n : []),\n ...subjects.map((s) => ({ value: s, label: s })),\n ]}\n />\n </div>\n {error && <p className=\"m-0 text-watercolor-rose-dark text-sm\">{error}</p>}\n <div className=\"flex justify-end gap-2\">\n <Button type=\"button\" variant=\"ghost\" onClick={onClose} disabled={loading}>\n Cancel\n </Button>\n <Button type=\"button\" variant=\"primary\" onClick={handlePromote} disabled={loading}>\n {loading ? 'Promoting…' : 'Promote to idea'}\n </Button>\n </div>\n </div>\n </Modal>\n );\n};\n","import { Button, Input } from '@dendelion/paper-ui';\nimport { useState } from 'react';\n\ninterface AddCandidateFormProps {\n onAdd: (name: string) => Promise<void>;\n}\n\nexport const AddCandidateForm = ({ onAdd }: AddCandidateFormProps) => {\n const [name, setName] = useState('');\n const [saving, setSaving] = useState(false);\n\n const handleAdd = async () => {\n if (!name.trim()) return;\n setSaving(true);\n try {\n await onAdd(name.trim());\n setName('');\n } finally {\n setSaving(false);\n }\n };\n\n return (\n <div className=\"flex gap-2\">\n <Input\n size=\"small\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') handleAdd();\n }}\n placeholder=\"Add option…\"\n disabled={saving}\n className=\"flex-1\"\n />\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"small\"\n onClick={handleAdd}\n disabled={saving || !name.trim()}\n >\n Add\n </Button>\n </div>\n );\n};\n","import { Button, Card } from '@dendelion/paper-ui';\n\ninterface CandidateRowProps {\n name: string;\n onPromote: () => void;\n}\n\nexport const CandidateRow = ({ name, onPromote }: CandidateRowProps) => (\n <Card size=\"small\" texture=\"kraft\" className=\"plan-row-card\">\n <div className=\"flex items-center gap-3\">\n <span className=\"flex-1\">{name}</span>\n <Button type=\"button\" variant=\"ghost\" size=\"small\" onClick={onPromote}>\n Promote to idea\n </Button>\n </div>\n </Card>\n);\n","import { Markdown } from '@/app/components/markdown';\nimport { useState } from 'react';\n\ninterface GoalBannerProps {\n goal: string;\n}\n\nexport const GoalBanner = ({ goal }: GoalBannerProps) => {\n const [expanded, setExpanded] = useState(false);\n const [firstParagraph, ...restParagraphs] = goal.split(/\\n{2,}/);\n const hasMore = restParagraphs.length > 0;\n\n return (\n <div className=\"mb-6 pb-4 border-b border-black/[8%]\">\n <span className=\"font-handwritten text-xs font-semibold opacity-[0.55]\">The goal</span>\n <div className=\"text-sm leading-relaxed opacity-80 mt-2\">\n <Markdown>{firstParagraph}</Markdown>\n {expanded && hasMore && <Markdown>{restParagraphs.join('\\n\\n')}</Markdown>}\n </div>\n {hasMore && (\n <button\n type=\"button\"\n onClick={() => setExpanded((v) => !v)}\n className=\"bg-transparent border-none p-0 mt-2 cursor-pointer text-2xs opacity-[0.65] underline\"\n >\n {expanded ? 'Show less' : 'Show more'}\n </button>\n )}\n </div>\n );\n};\n","export const HIGHLIGHT_OUTLINE_CLASS = 'outline-[rgba(200,154,90,0.5)]';\n\nexport const CANDIDATE_STAMP = {\n fill: 'rgba(0, 0, 0, 0.06)',\n text: 'rgba(0, 0, 0, 0.55)',\n};\n","import { PrBadge } from '@/app/features/plans/components/pr-badge';\nimport { STATUS_LABEL, STATUS_STAMP } from '@/app/features/plans/constants';\nimport type { PlanEntry, PlanStatus, PrInfo, RoadmapLink } from '@/types/index';\nimport { Card, Stamp } from '@dendelion/paper-ui';\n\nexport interface MergedIdea {\n key: string;\n label: string;\n status: PlanStatus;\n pr?: PrInfo;\n planId?: string;\n planTitle?: string;\n}\n\nexport const mergeIdeas = (links: RoadmapLink[], graduated: PlanEntry[]): MergedIdea[] => {\n const represented = new Set<string>();\n const merged: MergedIdea[] = graduated.map((plan) => {\n if (plan.id) represented.add(plan.id);\n if (plan.idea) represented.add(plan.idea);\n return {\n key: plan.title,\n label: plan.title,\n status: plan.status,\n pr: plan.pr,\n planId: plan.id,\n planTitle: plan.title,\n };\n });\n for (const link of links) {\n if (represented.has(link.id)) continue;\n merged.push({ key: link.id, label: link.id, status: link.status, pr: link.pr });\n }\n return merged;\n};\n\ninterface IdeaRowProps {\n idea: MergedIdea;\n onOpen?: () => void;\n}\n\nexport const IdeaRow = ({ idea, onOpen }: IdeaRowProps) => (\n <Card size=\"small\" texture=\"kraft\" className=\"plan-row-card\">\n <div className=\"flex items-center gap-3\">\n {onOpen ? (\n <button\n type=\"button\"\n onClick={onOpen}\n className=\"flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap bg-transparent border-none p-0 cursor-pointer [font:inherit] text-inherit text-left\"\n >\n {idea.label}\n </button>\n ) : (\n <span className=\"flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap\">\n {idea.label}\n </span>\n )}\n {idea.pr && <PrBadge pr={idea.pr} />}\n <Stamp\n size=\"small\"\n fillColor={STATUS_STAMP[idea.status].fill}\n textColor={STATUS_STAMP[idea.status].text}\n >\n {STATUS_LABEL[idea.status]}\n </Stamp>\n </div>\n </Card>\n);\n","interface ProgressBarProps {\n done: number;\n total: number;\n}\n\nexport const ProgressBar = ({ done, total }: ProgressBarProps) => {\n const percent = total > 0 ? Math.round((done / total) * 100) : 0;\n return (\n <div className=\"w-24 h-1.5 rounded-full bg-black/[0.08] overflow-hidden shrink-0\">\n <div\n className={`h-full rounded-full ${total > 0 ? 'bg-watercolor-green' : 'bg-transparent'}`}\n style={{ width: `${percent}%` }}\n />\n </div>\n );\n};\n","import { STATUS_STAMP } from '@/app/features/plans/constants';\nimport type { PlanEntry, ResolvedRoadmapItem } from '@/types/index';\nimport { Button, Stamp } from '@dendelion/paper-ui';\nimport { useEffect, useState } from 'react';\nimport { CANDIDATE_STAMP, HIGHLIGHT_OUTLINE_CLASS } from '../constants';\nimport { AddCandidateForm } from './add-candidate-form';\nimport { CandidateRow } from './candidate-row';\nimport { IdeaRow, mergeIdeas } from './idea-row';\nimport { ProgressBar } from './progress-bar';\n\nconst graduationCounts = (graduated: PlanEntry[]) => ({\n shipped: graduated.filter((p) => p.status === 'done').length,\n queued: graduated.filter((p) => p.status !== 'done' && p.status !== 'dropped').length,\n});\n\nconst ChevronRightIcon = ({ size = 14 }: { size?: number }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points=\"9 18 15 12 9 6\" />\n </svg>\n);\n\ninterface RoadmapItemRowProps {\n item: ResolvedRoadmapItem;\n graduated: PlanEntry[];\n highlighted: boolean;\n onPromote: () => void;\n onPromoteCandidate: (candidateName: string) => void;\n onAddCandidate: (name: string) => Promise<void>;\n onOpenGraduated: (id: string | undefined, title: string) => void;\n}\n\nexport const RoadmapItemRow = ({\n item,\n graduated,\n highlighted,\n onPromote,\n onPromoteCandidate,\n onAddCandidate,\n onOpenGraduated,\n}: RoadmapItemRowProps) => {\n const [expanded, setExpanded] = useState(highlighted);\n const { shipped, queued } = graduationCounts(graduated);\n const candidates = item.candidates.length;\n const ideas = mergeIdeas(item.links, graduated);\n\n useEffect(() => {\n if (highlighted) setExpanded(true);\n }, [highlighted]);\n\n return (\n <div\n className={`border-b border-black/10 last:border-b-0 ${highlighted ? `roadmap-item-highlighted outline outline-2 outline-offset-[-2px] ${HIGHLIGHT_OUTLINE_CLASS}` : ''}`}\n >\n <button\n type=\"button\"\n aria-expanded={expanded}\n onClick={() => setExpanded((v) => !v)}\n className=\"flex w-full items-center gap-3 py-2.5 px-0 bg-transparent border-none cursor-pointer text-left [font:inherit] text-inherit\"\n >\n <span\n className={`inline-flex items-center opacity-50 shrink-0 ${expanded ? 'rotate-90' : ''}`}\n >\n <ChevronRightIcon />\n </span>\n <span className=\"font-semibold flex-1 min-w-0 truncate\">{item.name}</span>\n <ProgressBar done={item.rollup.done} total={item.rollup.total} />\n {queued > 0 && (\n <Stamp\n size=\"small\"\n fillColor={STATUS_STAMP.planned.fill}\n textColor={STATUS_STAMP.planned.text}\n >\n {queued} in queue\n </Stamp>\n )}\n {shipped > 0 && (\n <Stamp size=\"small\" fillColor={STATUS_STAMP.done.fill} textColor={STATUS_STAMP.done.text}>\n {shipped} shipped\n </Stamp>\n )}\n {candidates > 0 && (\n <Stamp size=\"small\" fillColor={CANDIDATE_STAMP.fill} textColor={CANDIDATE_STAMP.text}>\n {candidates} candidate{candidates === 1 ? '' : 's'}\n </Stamp>\n )}\n </button>\n {expanded && (\n <div className=\"flex flex-col gap-1 pl-6 pb-4\">\n <span className=\"text-sm opacity-70\">{item.description}</span>\n {ideas.map((idea) => (\n <IdeaRow\n key={idea.key}\n idea={idea}\n onOpen={\n idea.planTitle\n ? () => onOpenGraduated(idea.planId, idea.planTitle as string)\n : undefined\n }\n />\n ))}\n {item.candidates.map((candidateName) => (\n <CandidateRow\n key={candidateName}\n name={candidateName}\n onPromote={() => onPromoteCandidate(candidateName)}\n />\n ))}\n <AddCandidateForm onAdd={onAddCandidate} />\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"small\"\n onClick={onPromote}\n className=\"self-start\"\n >\n Promote to idea\n </Button>\n </div>\n )}\n </div>\n );\n};\n","import type { PlanEntry, ResolvedRoadmapHorizon, ResolvedRoadmapItem } from '@/types/index';\nimport { RoadmapItemRow } from './roadmap-item-row';\n\nconst HORIZON_HEADER_CLASSES =\n 'font-handwritten text-md font-semibold opacity-70 leading-none pt-2 px-1 pb-0';\n\ninterface HorizonSectionProps {\n horizon: ResolvedRoadmapHorizon;\n highlightedItem: string | undefined;\n graduatedByItem: (item: ResolvedRoadmapItem) => PlanEntry[];\n onPromote: (item: ResolvedRoadmapItem, candidateName?: string) => void;\n onAddCandidate: (itemName: string, name: string) => Promise<void>;\n onOpenGraduated: (id: string | undefined, title: string) => void;\n}\n\nexport const HorizonSection = ({\n horizon,\n highlightedItem,\n graduatedByItem,\n onPromote,\n onAddCandidate,\n onOpenGraduated,\n}: HorizonSectionProps) => (\n <div className=\"flex flex-col gap-1\">\n <div className={HORIZON_HEADER_CLASSES}>{horizon.title}</div>\n <div className=\"flex flex-col\">\n {horizon.items.map((item) => (\n <RoadmapItemRow\n key={item.name}\n item={item}\n graduated={graduatedByItem(item)}\n highlighted={item.name === highlightedItem}\n onPromote={() => onPromote(item)}\n onPromoteCandidate={(candidateName) => onPromote(item, candidateName)}\n onAddCandidate={(name) => onAddCandidate(item.name, name)}\n onOpenGraduated={onOpenGraduated}\n />\n ))}\n </div>\n </div>\n);\n","import { PageTitle } from '@/app/components/page-title';\nimport { useRoadmapPage } from './hooks';\nimport { PromoteRoadmapItemModal } from './modals';\nimport { GoalBanner, HorizonSection } from './views';\n\nexport const RoadmapPage = () => {\n const {\n roadmap,\n roadmapError,\n loadRoadmap,\n horizons,\n totalVisible,\n hasActiveFilters,\n highlightedItem,\n containerRef,\n promoting,\n setPromoting,\n graduatedByItem,\n handleAddCandidate,\n handlePromote,\n onOpenGraduated,\n } = useRoadmapPage();\n\n if (roadmapError) {\n return (\n <div>\n <PageTitle>Roadmap</PageTitle>\n <p className=\"opacity-50\">\n Couldn't load the roadmap — the server may need a restart to pick up new routes.\n </p>\n </div>\n );\n }\n\n if (!roadmap) {\n return (\n <div>\n <PageTitle>Roadmap</PageTitle>\n <p className=\"opacity-50\">Loading…</p>\n </div>\n );\n }\n\n if (roadmap.horizons.length === 0) {\n return (\n <div>\n <PageTitle>Roadmap</PageTitle>\n <p className=\"opacity-50\">No `ROADMAP.md` found at the project root.</p>\n </div>\n );\n }\n\n return (\n <div ref={containerRef}>\n <PageTitle>Roadmap</PageTitle>\n <GoalBanner goal={roadmap.goal} />\n {totalVisible === 0 ? (\n <p className=\"opacity-50 py-6 px-0 text-center\">\n {hasActiveFilters\n ? 'Nothing matches these filters — clear one from the sidebar to see more.'\n : 'No roadmap items yet — add one from the sidebar.'}\n </p>\n ) : (\n <div className=\"flex flex-col gap-6\">\n {horizons\n .filter((horizon) => horizon.items.length > 0)\n .map((horizon) => (\n <HorizonSection\n key={horizon.title}\n horizon={horizon}\n highlightedItem={highlightedItem}\n graduatedByItem={graduatedByItem}\n onPromote={(item, candidateName) =>\n handlePromote(horizon.title, item, candidateName)\n }\n onAddCandidate={(itemName, name) =>\n handleAddCandidate(horizon.title, itemName, name)\n }\n onOpenGraduated={onOpenGraduated}\n />\n ))}\n </div>\n )}\n <PromoteRoadmapItemModal\n horizonTitle={promoting?.horizonTitle ?? null}\n item={promoting?.item ?? null}\n candidateName={promoting?.candidateName}\n onClose={() => setPromoting(null)}\n onPromoted={loadRoadmap}\n />\n </div>\n );\n};\n","import { STATUS_LABEL, STATUS_STAMP } from '@/app/features/plans/constants';\nimport { Button, ListItem } from '@dendelion/paper-ui';\nimport { useRoadmapSidebar } from './hooks';\nimport { AddRoadmapItemModal } from './modals';\n\n// Matches SidebarSection — handwritten, no caps, one grid cell.\nconst sectionLabelClass = 'pc-row-label font-handwritten text-xs font-semibold opacity-[0.45]';\n\nexport const RoadmapSidebar = () => {\n const {\n roadmap,\n horizonTitles,\n horizonCounts,\n statusCounts,\n activeHorizons,\n activeStatuses,\n visibleStatuses,\n addOpen,\n setAddOpen,\n toggleRoadmapHorizon,\n toggleRoadmapStatus,\n } = useRoadmapSidebar();\n\n if (!roadmap) return null;\n\n return (\n <div className=\"flex flex-col\">\n <div className=\"flex h-[64px] items-center\">\n <Button\n type=\"button\"\n variant=\"primary\"\n size=\"small\"\n onClick={() => setAddOpen(true)}\n disabled={horizonTitles.length === 0}\n >\n + Add item\n </Button>\n </div>\n\n <div>\n <div className={sectionLabelClass}>Horizon</div>\n <div className=\"flex flex-col\">\n {horizonTitles.map((title) => (\n <ListItem\n key={title}\n size=\"small\"\n active={activeHorizons.has(title)}\n onClick={() => toggleRoadmapHorizon(title)}\n className=\"pc-row text-xs\"\n action={<span className=\"text-2xs text-ink-500\">{horizonCounts[title] ?? 0}</span>}\n >\n {title}\n </ListItem>\n ))}\n </div>\n </div>\n\n <div>\n <div className={sectionLabelClass}>Status</div>\n <div className=\"flex flex-col\">\n {visibleStatuses.length === 0 && (\n <span className=\"opacity-50 text-2xs\">No linked ideas</span>\n )}\n {visibleStatuses.map((status) => (\n <ListItem\n key={status}\n size=\"small\"\n active={activeStatuses.has(status)}\n onClick={() => toggleRoadmapStatus(status)}\n className=\"pc-row text-xs\"\n icon={\n <span\n className=\"w-[9px] h-[9px] rounded-full shrink-0\"\n style={{ background: STATUS_STAMP[status].text }}\n />\n }\n action={<span className=\"text-2xs text-ink-500\">{statusCounts[status] ?? 0}</span>}\n >\n {STATUS_LABEL[status]}\n </ListItem>\n ))}\n </div>\n </div>\n\n <AddRoadmapItemModal\n open={addOpen}\n horizonTitles={horizonTitles}\n onClose={() => setAddOpen(false)}\n />\n </div>\n );\n};\n"],"names":["useRoadmapPage","roadmap","useAppStore","s","roadmapError","loadRoadmap","filters","plans","openEntity","useOpenEntity","highlightedItem","useSearch","containerRef","useRef","promoting","setPromoting","useState","useEffect","row","_a","graduatedByItem","item","p","handleAddCandidate","horizonTitle","itemName","name","addRoadmapCandidate","handlePromote","candidateName","horizons","filterHorizons","totalVisible","count","horizon","hasActiveFilters","STATUS_CHIP_ORDER","useRoadmapSidebar","toggleRoadmapHorizon","toggleRoadmapStatus","addOpen","setAddOpen","horizonTitles","horizonCounts","horizonItemCounts","statusCounts","statusItemCounts","activeHorizons","activeStatuses","visibleStatuses","status","AddRoadmapItemModal","open","onClose","setHorizon","setName","description","setDescription","saving","setSaving","error","setError","horizonTitlesRef","handleAdd","addRoadmapItem","err","jsx","Modal","jsxs","Select","title","Input","e","Button","NO_SUBJECT","PromoteRoadmapItemModal","onPromoted","promoteRoadmapItem","launchIdeaExtend","subjects","subjectsAvailable","useSubjectVocabulary","subject","setSubject","loading","setLoading","toast","useToast","id","idea","buildRoadmapPromotePrompt","oneLineErrorSummary","AddCandidateForm","onAdd","CandidateRow","onPromote","Card","GoalBanner","goal","expanded","setExpanded","firstParagraph","restParagraphs","hasMore","Markdown","v","HIGHLIGHT_OUTLINE_CLASS","CANDIDATE_STAMP","mergeIdeas","links","graduated","represented","merged","plan","link","IdeaRow","onOpen","PrBadge","Stamp","STATUS_STAMP","STATUS_LABEL","ProgressBar","done","total","percent","graduationCounts","ChevronRightIcon","size","RoadmapItemRow","highlighted","onPromoteCandidate","onAddCandidate","onOpenGraduated","shipped","queued","candidates","ideas","HORIZON_HEADER_CLASSES","HorizonSection","RoadmapPage","PageTitle","sectionLabelClass","RoadmapSidebar","ListItem"],"mappings":"iQAcO,MAAMA,EAAiB,IAAM,CAClC,MAAMC,EAAUC,EAAaC,GAAMA,EAAE,OAAO,EACtCC,EAAeF,EAAaC,GAAMA,EAAE,YAAY,EAChDE,EAAcH,EAAaC,GAAMA,EAAE,WAAW,EAC9CG,EAAUJ,EAAaC,GAAMA,EAAE,cAAc,EAC7CI,EAAQL,EAAaC,GAAMA,EAAE,KAAK,EAClCK,EAAaC,EAAA,EACb,CAAE,KAAMC,CAAA,EAAoBC,EAAU,CAAE,KAAM,WAAY,EAC1DC,EA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AK,UAAU,wBAAyB,SAAA3B,EAAc2B,CAAK,GAAK,EAAE,EAE1E,SAAAA,CAAA,EAPIA,CAAA,CASR,CAAA,CACH,CAAA,EACF,SAEC,MAAA,CACC,SAAA,CAAAJ,EAAAA,IAAC,MAAA,CAAI,UAAW2E,EAAmB,SAAA,SAAM,EACzCzE,EAAAA,KAAC,MAAA,CAAI,UAAU,gBACZ,SAAA,CAAAnB,EAAgB,SAAW,GAC1BiB,MAAC,OAAA,CAAK,UAAU,sBAAsB,SAAA,kBAAe,EAEtDjB,EAAgB,IAAKC,GACpBgB,EAAAA,IAAC6E,EAAA,CAEC,KAAK,QACL,OAAQ/F,EAAe,IAAIE,CAAM,EACjC,QAAS,IAAMX,EAAoBW,CAAM,EACzC,UAAU,iBACV,KACEgB,EAAAA,IAAC,OAAA,CACC,UAAU,wCACV,MAAO,CAAE,WAAYqD,EAAarE,CAAM,EAAE,IAAA,CAAK,CAAA,EAGnD,aAAS,OAAA,CAAK,UAAU,wBAAyB,SAAAL,EAAaK,CAAM,GAAK,EAAE,EAE1E,WAAaA,CAAM,CAAA,EAbfA,CAAA,CAeR,CAAA,CAAA,CACH,CAAA,EACF,EAEAgB,EAAAA,IAACf,EAAA,CACC,KAAMX,EACN,cAAAE,EACA,QAAS,IAAMD,EAAW,EAAK,CAAA,CAAA,CACjC,EACF,EAlEmB,IAoEvB"}
@@ -0,0 +1,2 @@
1
+ import{as as E,r as g,u as c,a9 as L,Q as $,at as R,j as r,al as C,ap as S,J as b,G as w,P as K}from"./main-CpTKYLW_.js";const D=(n,e)=>{const t=n.entityId?e.find(s=>s.id===n.entityId):void 0;return t?E(t)?"Promote to fix":`Add to ${t.id}'s fixes`:"Promote to idea"},M=n=>{if(!n)return"";const e=Math.floor((Date.now()-Date.parse(n))/864e5);return Number.isFinite(e)?e<=0?"today":e===1?"1 day ago":`${e} days ago`:""},F="9999-12-31T23:59:59.999Z",z=n=>[...n].sort((e,t)=>(e.occurredAt??F).localeCompare(t.occurredAt??F)),j=(n,e)=>`${n}:${e}`;function O(n){return n.filter(e=>e.outcome==="error").map(e=>{const t=e.planId??e.id;return{id:j("agent-run",t),sourceKind:"agent-run",sourceKey:t,entityId:e.planId,entityTitle:e.planTitle,title:`${e.planTitle} — ${e.taskKind} failed`,reason:e.reason??"The run ended in error with no reason recorded.",occurredAt:e.endedAt,thread:[],status:"open"}})}function q(n){return n.filter(e=>e.status==="fail").map(e=>({id:j("check",e.name),sourceKind:"check",sourceKey:e.name,title:`"${e.name}" check is failing`,reason:`The command was \`${e.cmd}\`.`,output:e.output||void 0,occurredAt:e.lastRun??void 0,thread:[],status:"open"}))}function J(n){return n.filter(e=>{var t;return((t=e.pr)==null?void 0:t.reviewDecision)==="changes-requested"}).map(e=>{const t=e.pr,s=`${t.number}:${t.headSha??"unknown"}`;return{id:j("pr-review",s),sourceKind:"pr-review",sourceKey:s,entityId:e.id,entityTitle:e.title,title:`${e.title} — PR review requested changes`,reason:`PR #${t.number} has unresolved change requests.`,thread:[],status:"open"}})}function B(n,e){return n.map(t=>{var l;const s=e.find(i=>i.issueSource===t.id);if(s!=null&&s.id)return{...t,promotedFixId:s.id};const d=t.entityId?e.find(i=>i.id===t.entityId):void 0;return((l=d==null?void 0:d.fixes)==null?void 0:l.some(i=>i.source==="issue"&&i.text===t.title))&&(d!=null&&d.id)?{...t,promotedFixId:d.id}:t}).filter(t=>{const s=t.promotedFixId&&e.find(d=>d.id===t.promotedFixId);return!(s&&s.status==="done")})}function G(n,e){return e.filter(t=>t.issueId===n.id).sort((t,s)=>t.endedAt.localeCompare(s.endedAt)).map(t=>({kind:"log",date:t.endedAt.slice(0,10),from:"agent",text:t.outcome==="done"?"Ran a fix agent — finished.":t.outcome==="error"?`Ran a fix agent — failed: ${t.reason??"no reason recorded"}`:"Ran a fix agent — superseded by a newer run."}))}const Q=()=>{var k;const[n,e]=g.useState(null),[t,s]=g.useState(null),d=c(o=>o.taskLog),m=c(o=>o.taskLogLoading),l=c(o=>o.loadTaskLog),i=c(o=>o.plans),p=c(o=>o.ideaEntries),f=c(o=>o.agentStatus),a=c(o=>o.launchIssueFix),h=c(o=>o.loadPlans),x=c(o=>o.loadIdeas),{checks:u}=L(),I=$();g.useEffect(()=>{l()},[l]);const P=g.useMemo(()=>((i==null?void 0:i.entries)??[]).filter(o=>o.id!=null),[i]),y=g.useMemo(()=>[...P,...p].filter(o=>o.id!=null),[P,p]),T=g.useMemo(()=>{const o=z([...O(d),...q(u),...J(y)]);return B(o,y).map(v=>({...v,thread:G(v,d)}))},[d,u,y]),A=async o=>{s(o.id);try{await R(o),await Promise.all([h(),x()])}finally{s(null)}},N=(k=f.find(o=>o.taskKind==="issue-fix"&&o.status!=="done"&&o.status!=="error"&&o.status!=="superseded"))==null?void 0:k.issueId;return{issues:T,entities:y,taskLogLoading:m,expandedId:n,setExpandedId:e,openEntity:I,fixingIssueId:N,launchIssueFix:a,promotingId:t,handlePromote:A}},U=({issue:n,expanded:e,onToggle:t,onOpen:s,fixing:d,fixDisabled:m,onFix:l,promoteLabel:i,promoting:p,promoteDisabled:f,onPromote:a,onOpenPromoted:h})=>{const x=async()=>{try{await l()}catch(I){alert(I.message)}},u=async()=>{try{await a()}catch(I){alert(I.message)}};return r.jsxs("div",{className:"border-b border-black/10 last:border-b-0",children:[r.jsxs("div",{className:"flex items-center gap-3 py-2.5",children:[s&&r.jsx("button",{type:"button",onClick:s,"aria-label":`Open ${n.entityTitle}`,className:"bg-transparent border-none p-0 cursor-pointer",children:r.jsx(C,{id:n.entityId})}),r.jsx("button",{type:"button",onClick:t,"aria-expanded":e,className:"flex-1 min-w-0 truncate text-left bg-transparent border-none p-0 cursor-pointer",children:n.title}),r.jsx("span",{className:"opacity-50 text-xs whitespace-nowrap",children:M(n.occurredAt)})]}),e&&r.jsxs("div",{className:"flex flex-col gap-3 pb-4",children:[r.jsx("p",{children:n.reason}),n.output&&r.jsx("pre",{className:"max-h-48 overflow-auto whitespace-pre-wrap text-left font-mono text-2xs opacity-70",children:n.output}),n.thread.length>0&&r.jsx(S,{messages:n.thread,undo:null,undoing:!1,onUndo:()=>{}}),r.jsx("div",{className:"flex items-center gap-3",children:n.promotedFixId?r.jsxs(b,{size:"small",onClick:h,children:["View ",n.promotedFixId]}):r.jsxs(r.Fragment,{children:[r.jsx(b,{size:"small",onClick:x,disabled:m,children:d?"Fixing…":"Fix it here"}),d&&r.jsx(w,{size:"small",label:"Agent fixing…"}),r.jsx(b,{size:"small",onClick:u,disabled:f,children:p?"Promoting…":i}),p&&r.jsx(w,{size:"small",label:"Promoting…"})]})})]})]})},Z=()=>{const{issues:n,entities:e,taskLogLoading:t,expandedId:s,setExpandedId:d,openEntity:m,fixingIssueId:l,launchIssueFix:i,promotingId:p,handlePromote:f}=Q();return r.jsxs("div",{children:[r.jsx(K,{children:"Issues"}),r.jsx("p",{className:"opacity-50 mb-6",children:"Every failing agent run, red check, and PR review, oldest first."}),t&&n.length===0&&r.jsx("p",{className:"opacity-50",children:"Loading…"}),!t&&n.length===0&&r.jsx("p",{className:"opacity-50",children:"Nothing broken right now."}),n.length>0&&r.jsx("div",{className:"flex flex-col",children:n.map(a=>{var x;const h=a.promotedFixId?((x=e.find(u=>u.id===a.promotedFixId))==null?void 0:x.title)??a.promotedFixId:void 0;return r.jsx(U,{issue:a,expanded:s===a.id,onToggle:()=>d(u=>u===a.id?null:a.id),onOpen:a.entityId&&a.entityTitle?()=>m(a.entityId,a.entityTitle):void 0,fixing:l===a.id,fixDisabled:l!==void 0,onFix:()=>i(a.id,a.title,a.reason,a.output),promoteLabel:D(a,e),promoting:p===a.id,promoteDisabled:p!==null,onPromote:()=>f(a),onOpenPromoted:a.promotedFixId?()=>m(a.promotedFixId,h):void 0},a.id)})})]})};export{Z as IssuesPage};
2
+ //# sourceMappingURL=index-BJqS77OS.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-Do4T60UL.js","sources":["../../../src/app/features/issues/helpers.ts","../../../src/core/issues.ts","../../../src/app/features/issues/hooks/use-issues-page.ts","../../../src/app/features/issues/issue-row.tsx","../../../src/app/features/issues/issues-page.tsx"],"sourcesContent":["import { isClosedEntity } from '@/core/status';\nimport type { EntityStatus, Issue } from '@/types/index';\n\nexport const promoteLabel = (\n issue: Issue,\n entities: { id: string; status?: EntityStatus; archived?: boolean }[],\n): string => {\n const parent = issue.entityId ? entities.find((p) => p.id === issue.entityId) : undefined;\n if (!parent) return 'Promote to idea';\n return isClosedEntity(parent) ? 'Promote to fix' : `Add to ${parent.id}'s fixes`;\n};\n\nexport const formatIssueAge = (occurredAt: string | undefined): string => {\n if (!occurredAt) return '';\n const ageDays = Math.floor((Date.now() - Date.parse(occurredAt)) / 86_400_000);\n if (!Number.isFinite(ageDays)) return '';\n if (ageDays <= 0) return 'today';\n return ageDays === 1 ? '1 day ago' : `${ageDays} days ago`;\n};\n\n// Missing timestamps (a live PR review decision) sort last, not first.\nconst NO_TIMESTAMP = '9999-12-31T23:59:59.999Z';\nexport const sortIssuesByAge = <T extends { occurredAt?: string }>(issues: T[]): T[] =>\n [...issues].sort((a, b) =>\n (a.occurredAt ?? NO_TIMESTAMP).localeCompare(b.occurredAt ?? NO_TIMESTAMP),\n );\n","import type {\n DeskCheckState,\n EntityStatus,\n GitSyncFailure,\n Issue,\n PhaseItem,\n PrInfo,\n TaskLogEntry,\n ThreadMessage,\n} from '../types/index';\n\nconst issueId = (sourceKind: Issue['sourceKind'], sourceKey: string): string =>\n `${sourceKind}:${sourceKey}`;\n\n/** A failed agent run (`outcome: 'error'` in tasks.log), keyed by the plan it ran\n * against so a repeat failure on the same plan continues one issue. Runs with no\n * `planId` (e.g. a batch task) key off their own task id instead. */\nexport function collectAgentRunIssues(taskLog: TaskLogEntry[]): Issue[] {\n return taskLog\n .filter((entry) => entry.outcome === 'error')\n .map((entry) => {\n const sourceKey = entry.planId ?? entry.id;\n return {\n id: issueId('agent-run', sourceKey),\n sourceKind: 'agent-run',\n sourceKey,\n entityId: entry.planId,\n entityTitle: entry.planTitle,\n title: `${entry.planTitle} — ${entry.taskKind} failed`,\n reason: entry.reason ?? 'The run ended in error with no reason recorded.',\n occurredAt: entry.endedAt,\n thread: [],\n status: 'open',\n };\n });\n}\n\n/** A red project check (Quality/Tests/Consistency — Docs keeps its own browse flow\n * and is excluded, same carve-out as `buildCheckFixes`), keyed by check name. */\nexport function collectCheckIssues(checks: DeskCheckState[]): Issue[] {\n return checks\n .filter((check) => check.status === 'fail')\n .map((check) => ({\n id: issueId('check', check.name),\n sourceKind: 'check',\n sourceKey: check.name,\n title: `\"${check.name}\" check is failing`,\n reason: `The command was \\`${check.cmd}\\`.`,\n output: check.output || undefined,\n occurredAt: check.lastRun ?? undefined,\n thread: [],\n status: 'open',\n }));\n}\n\n/** A PR review that requested changes, keyed by PR number + head sha so a fresh\n * push that gets re-reviewed continues the same issue rather than a new one. */\nexport function collectPrReviewIssues(\n entities: { id: string; title: string; pr?: PrInfo }[],\n): Issue[] {\n return entities\n .filter((entity) => entity.pr?.reviewDecision === 'changes-requested')\n .map((entity) => {\n const pr = entity.pr as PrInfo;\n const sourceKey = `${pr.number}:${pr.headSha ?? 'unknown'}`;\n return {\n id: issueId('pr-review', sourceKey),\n sourceKind: 'pr-review',\n sourceKey,\n entityId: entity.id,\n entityTitle: entity.title,\n title: `${entity.title} — PR review requested changes`,\n reason: `PR #${pr.number} has unresolved change requests.`,\n thread: [],\n status: 'open',\n };\n });\n}\n\n/** A git rebase/sync failure on the currently checked-out branch, keyed by branch +\n * the ref it failed to reconcile against so a repeat failure of the same rebase\n * continues one issue. */\nexport function collectSyncIssues(\n failure: GitSyncFailure | undefined,\n branch: string,\n entity?: { id: string; title: string },\n): Issue[] {\n if (!failure) return [];\n const sourceKey = `${branch}:${failure.conflictRef ?? failure.stage}`;\n return [\n {\n id: issueId('sync', sourceKey),\n sourceKind: 'sync',\n sourceKey,\n entityId: entity?.id,\n entityTitle: entity?.title,\n title: `${branch} failed to sync`,\n reason: failure.message,\n output: failure.conflictedFiles?.length\n ? `Conflicted files: ${failure.conflictedFiles.join(', ')}`\n : undefined,\n thread: [],\n status: 'open',\n },\n ];\n}\n\n/** Reconciles freshly-collected issues (every one currently detected as failing, so\n * always 'open') against the existing set, keyed by `id`. A repeat failure of the\n * same thing replaces that issue's title/reason/output in place, preserving its\n * position and its thread. An existing issue absent from `fresh` has stopped\n * failing, so it closes — unless it was promoted to a fix entity that hasn't\n * shipped yet (`fixEntityStatus` reports its status), which keeps it open until\n * that entity reaches 'done'. Closure is derived here, never a mark-read button. */\nexport function reconcileIssues(\n existing: Issue[],\n fresh: Issue[],\n fixEntityStatus: (fixId: string) => EntityStatus | undefined = () => undefined,\n): Issue[] {\n const freshById = new Map(fresh.map((issue) => [issue.id, issue]));\n const merged = existing.map((issue): Issue => {\n if (issue.promotedFixId && fixEntityStatus(issue.promotedFixId) === 'done') {\n freshById.delete(issue.id);\n return { ...issue, status: 'closed' };\n }\n const next = freshById.get(issue.id);\n if (!next) return { ...issue, status: 'closed' };\n freshById.delete(issue.id);\n return { ...next, thread: issue.thread, promotedFixId: issue.promotedFixId };\n });\n return [...merged, ...freshById.values()];\n}\n\n/** A spawned fix/idea entity from Promote (IDEA-192 phase 6) stamps `issueSource`;\n * an open parent instead gets a `source: 'issue'` item appended to its inline Fixes list. */\ntype PromotionTarget = {\n id?: string;\n status?: EntityStatus;\n issueSource?: string;\n fixes?: PhaseItem[];\n};\n\n/** Matches every issue against the corpus for a prior Promote (IDEA-192 phase 6),\n * re-derived from disk on every read since issues carry no store of their own —\n * the promotion survives a reload because git holds it, not a stored issue. Once\n * matched, an issue whose target has shipped (`status: 'done'`) closes, even if\n * its original source is still detected as failing. */\nexport function applyPromotions(issues: Issue[], entities: PromotionTarget[]): Issue[] {\n return issues\n .map((issue): Issue => {\n const spawned = entities.find((e) => e.issueSource === issue.id);\n if (spawned?.id) return { ...issue, promotedFixId: spawned.id };\n const parent = issue.entityId ? entities.find((e) => e.id === issue.entityId) : undefined;\n const appended = parent?.fixes?.some((f) => f.source === 'issue' && f.text === issue.title);\n return appended && parent?.id ? { ...issue, promotedFixId: parent.id } : issue;\n })\n .filter((issue) => {\n const target = issue.promotedFixId && entities.find((e) => e.id === issue.promotedFixId);\n return !(target && target.status === 'done');\n });\n}\n\n/** \"Fix it here\" (IDEA-192) launches an `issue-fix` task carrying the issue's id;\n * this reconstructs that issue's thread from every tasks.log entry carrying it,\n * oldest first, so a repeat fix attempt reads as a continuation, not a fresh mystery. */\nexport function issueThreadFromTaskLog(issue: Issue, taskLog: TaskLogEntry[]): ThreadMessage[] {\n return taskLog\n .filter((entry) => entry.issueId === issue.id)\n .sort((a, b) => a.endedAt.localeCompare(b.endedAt))\n .map((entry) => ({\n kind: 'log',\n date: entry.endedAt.slice(0, 10),\n from: 'agent',\n text:\n entry.outcome === 'done'\n ? 'Ran a fix agent — finished.'\n : entry.outcome === 'error'\n ? `Ran a fix agent — failed: ${entry.reason ?? 'no reason recorded'}`\n : 'Ran a fix agent — superseded by a newer run.',\n }));\n}\n","import { useOpenEntity } from '@/app/hooks';\nimport { useDeskChecks } from '@/app/hooks/use-desk-checks';\nimport { promoteIssue } from '@/app/services/agent-api';\nimport { useAppStore } from '@/app/stores/app-store';\nimport {\n applyPromotions,\n collectAgentRunIssues,\n collectCheckIssues,\n collectPrReviewIssues,\n issueThreadFromTaskLog,\n} from '@/core/issues';\nimport type { Issue, PlanEntry } from '@/types/index';\nimport { useEffect, useMemo, useState } from 'react';\nimport { sortIssuesByAge } from '../helpers';\n\nexport const useIssuesPage = () => {\n const [expandedId, setExpandedId] = useState<string | null>(null);\n const [promotingId, setPromotingId] = useState<string | null>(null);\n const taskLog = useAppStore((s) => s.taskLog);\n const taskLogLoading = useAppStore((s) => s.taskLogLoading);\n const loadTaskLog = useAppStore((s) => s.loadTaskLog);\n const plans = useAppStore((s) => s.plans);\n const ideaEntries = useAppStore((s) => s.ideaEntries);\n const agentStatus = useAppStore((s) => s.agentStatus);\n const launchIssueFix = useAppStore((s) => s.launchIssueFix);\n const loadPlans = useAppStore((s) => s.loadPlans);\n const loadIdeas = useAppStore((s) => s.loadIdeas);\n const { checks } = useDeskChecks();\n const openEntity = useOpenEntity();\n\n useEffect(() => {\n loadTaskLog();\n }, [loadTaskLog]);\n\n const planEntities = useMemo(\n () => (plans?.entries ?? []).filter((p): p is PlanEntry & { id: string } => p.id != null),\n [plans],\n );\n\n const entities = useMemo(\n () =>\n [...planEntities, ...ideaEntries].filter(\n (entity): entity is typeof entity & { id: string } => entity.id != null,\n ),\n [planEntities, ideaEntries],\n );\n\n const issues = useMemo(() => {\n const collected = sortIssuesByAge([\n ...collectAgentRunIssues(taskLog),\n ...collectCheckIssues(checks),\n ...collectPrReviewIssues(entities),\n ]);\n return applyPromotions(collected, entities).map((issue) => ({\n ...issue,\n thread: issueThreadFromTaskLog(issue, taskLog),\n }));\n }, [taskLog, checks, entities]);\n\n const handlePromote = async (issue: Issue) => {\n setPromotingId(issue.id);\n try {\n await promoteIssue(issue);\n await Promise.all([loadPlans(), loadIdeas()]);\n } finally {\n setPromotingId(null);\n }\n };\n\n const fixingIssueId = agentStatus.find(\n (t) =>\n t.taskKind === 'issue-fix' &&\n t.status !== 'done' &&\n t.status !== 'error' &&\n t.status !== 'superseded',\n )?.issueId;\n\n return {\n issues,\n entities,\n taskLogLoading,\n expandedId,\n setExpandedId,\n openEntity,\n fixingIssueId,\n launchIssueFix,\n promotingId,\n handlePromote,\n };\n};\n","import { FeedbackThread, PlanIdStamp } from '@/app/features/plans/components';\nimport type { Issue } from '@/types/index';\nimport { Button, Spinner } from '@dendelion/paper-ui';\nimport { formatIssueAge } from './helpers';\n\ninterface IssueRowProps {\n issue: Issue;\n expanded: boolean;\n onToggle: () => void;\n onOpen?: () => void;\n fixing: boolean;\n fixDisabled: boolean;\n onFix: () => Promise<void>;\n promoteLabel: string;\n promoting: boolean;\n promoteDisabled: boolean;\n onPromote: () => Promise<void>;\n onOpenPromoted?: () => void;\n}\n\nexport const IssueRow = ({\n issue,\n expanded,\n onToggle,\n onOpen,\n fixing,\n fixDisabled,\n onFix,\n promoteLabel,\n promoting,\n promoteDisabled,\n onPromote,\n onOpenPromoted,\n}: IssueRowProps) => {\n const handleFix = async () => {\n try {\n await onFix();\n } catch (err) {\n alert((err as Error).message);\n }\n };\n\n const handlePromote = async () => {\n try {\n await onPromote();\n } catch (err) {\n alert((err as Error).message);\n }\n };\n\n return (\n <div className=\"border-b border-black/10 last:border-b-0\">\n <div className=\"flex items-center gap-3 py-2.5\">\n {onOpen && (\n <button\n type=\"button\"\n onClick={onOpen}\n aria-label={`Open ${issue.entityTitle}`}\n className=\"bg-transparent border-none p-0 cursor-pointer\"\n >\n <PlanIdStamp id={issue.entityId} />\n </button>\n )}\n <button\n type=\"button\"\n onClick={onToggle}\n aria-expanded={expanded}\n className=\"flex-1 min-w-0 truncate text-left bg-transparent border-none p-0 cursor-pointer\"\n >\n {issue.title}\n </button>\n <span className=\"opacity-50 text-xs whitespace-nowrap\">\n {formatIssueAge(issue.occurredAt)}\n </span>\n </div>\n {expanded && (\n <div className=\"flex flex-col gap-3 pb-4\">\n <p>{issue.reason}</p>\n {issue.output && (\n <pre className=\"max-h-48 overflow-auto whitespace-pre-wrap text-left font-mono text-2xs opacity-70\">\n {issue.output}\n </pre>\n )}\n {issue.thread.length > 0 && (\n <FeedbackThread messages={issue.thread} undo={null} undoing={false} onUndo={() => {}} />\n )}\n <div className=\"flex items-center gap-3\">\n {issue.promotedFixId ? (\n <Button size=\"small\" onClick={onOpenPromoted}>\n View {issue.promotedFixId}\n </Button>\n ) : (\n <>\n <Button size=\"small\" onClick={handleFix} disabled={fixDisabled}>\n {fixing ? 'Fixing…' : 'Fix it here'}\n </Button>\n {fixing && <Spinner size=\"small\" label=\"Agent fixing…\" />}\n <Button size=\"small\" onClick={handlePromote} disabled={promoteDisabled}>\n {promoting ? 'Promoting…' : promoteLabel}\n </Button>\n {promoting && <Spinner size=\"small\" label=\"Promoting…\" />}\n </>\n )}\n </div>\n </div>\n )}\n </div>\n );\n};\n","import { PageTitle } from '@/app/components/page-title';\nimport { promoteLabel } from './helpers';\nimport { useIssuesPage } from './hooks';\nimport { IssueRow } from './issue-row';\n\nexport const IssuesPage = () => {\n const {\n issues,\n entities,\n taskLogLoading,\n expandedId,\n setExpandedId,\n openEntity,\n fixingIssueId,\n launchIssueFix,\n promotingId,\n handlePromote,\n } = useIssuesPage();\n\n return (\n <div>\n <PageTitle>Issues</PageTitle>\n <p className=\"opacity-50 mb-6\">\n Every failing agent run, red check, and PR review, oldest first.\n </p>\n {taskLogLoading && issues.length === 0 && <p className=\"opacity-50\">Loading…</p>}\n {!taskLogLoading && issues.length === 0 && (\n <p className=\"opacity-50\">Nothing broken right now.</p>\n )}\n {issues.length > 0 && (\n <div className=\"flex flex-col\">\n {issues.map((issue) => {\n const promotedTitle = issue.promotedFixId\n ? (entities.find((p) => p.id === issue.promotedFixId)?.title ?? issue.promotedFixId)\n : undefined;\n return (\n <IssueRow\n key={issue.id}\n issue={issue}\n expanded={expandedId === issue.id}\n onToggle={() => setExpandedId((cur) => (cur === issue.id ? null : issue.id))}\n onOpen={\n issue.entityId && issue.entityTitle\n ? () => openEntity(issue.entityId as string, issue.entityTitle as string)\n : undefined\n }\n fixing={fixingIssueId === issue.id}\n fixDisabled={fixingIssueId !== undefined}\n onFix={() => launchIssueFix(issue.id, issue.title, issue.reason, issue.output)}\n promoteLabel={promoteLabel(issue, entities)}\n promoting={promotingId === issue.id}\n promoteDisabled={promotingId !== null}\n onPromote={() => handlePromote(issue)}\n onOpenPromoted={\n issue.promotedFixId\n ? () => openEntity(issue.promotedFixId as string, promotedTitle as string)\n : undefined\n }\n />\n );\n })}\n </div>\n )}\n </div>\n );\n};\n"],"names":["promoteLabel","issue","entities","parent","p","isClosedEntity","formatIssueAge","occurredAt","ageDays","NO_TIMESTAMP","sortIssuesByAge","issues","a","b","issueId","sourceKind","sourceKey","collectAgentRunIssues","taskLog","entry","collectCheckIssues","checks","check","collectPrReviewIssues","entity","_a","pr","applyPromotions","spawned","e","f","target","issueThreadFromTaskLog","useIssuesPage","expandedId","setExpandedId","useState","promotingId","setPromotingId","useAppStore","s","taskLogLoading","loadTaskLog","plans","ideaEntries","agentStatus","launchIssueFix","loadPlans","loadIdeas","useDeskChecks","openEntity","useOpenEntity","useEffect","planEntities","useMemo","collected","handlePromote","promoteIssue","fixingIssueId","t","IssueRow","expanded","onToggle","onOpen","fixing","fixDisabled","onFix","promoting","promoteDisabled","onPromote","onOpenPromoted","handleFix","err","jsxs","jsx","PlanIdStamp","FeedbackThread","Button","Fragment","Spinner","IssuesPage","PageTitle","promotedTitle","cur"],"mappings":"0HAGO,MAAMA,EAAe,CAC1BC,EACAC,IACW,CACX,MAAMC,EAASF,EAAM,SAAWC,EAAS,KAAME,GAAMA,EAAE,KAAOH,EAAM,QAAQ,EAAI,OAChF,OAAKE,EACEE,EAAeF,CAAM,EAAI,iBAAmB,UAAUA,EAAO,EAAE,WADlD,iBAEtB,EAEaG,EAAkBC,GAA2C,CACxE,GAAI,CAACA,EAAY,MAAO,GACxB,MAAMC,EAAU,KAAK,OAAO,KAAK,IAAA,EAAQ,KAAK,MAAMD,CAAU,GAAK,KAAU,EAC7E,OAAK,OAAO,SAASC,CAAO,EACxBA,GAAW,EAAU,QAClBA,IAAY,EAAI,YAAc,GAAGA,CAAO,YAFT,EAGxC,EAGMC,EAAe,2BACRC,EAAsDC,GACjE,CAAC,GAAGA,CAAM,EAAE,KAAK,CAACC,EAAGC,KAClBD,EAAE,YAAcH,GAAc,cAAcI,EAAE,YAAcJ,CAAY,CAC3E,ECdIK,EAAU,CAACC,EAAiCC,IAChD,GAAGD,CAAU,IAAIC,CAAS,GAKrB,SAASC,EAAsBC,EAAkC,CACtE,OAAOA,EACJ,OAAQC,GAAUA,EAAM,UAAY,OAAO,EAC3C,IAAKA,GAAU,CACd,MAAMH,EAAYG,EAAM,QAAUA,EAAM,GACxC,MAAO,CACL,GAAIL,EAAQ,YAAaE,CAAS,EAClC,WAAY,YACZ,UAAAA,EACA,S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,OACrB,MAAMiF,EAAgBjF,EAAM,gBACvBwB,EAAAvB,EAAS,KAAME,GAAMA,EAAE,KAAOH,EAAM,aAAa,IAAjD,YAAAwB,EAAoD,QAASxB,EAAM,cACpE,OACJ,OACEyE,EAAAA,IAACd,EAAA,CAEC,MAAA3D,EACA,SAAUiC,IAAejC,EAAM,GAC/B,SAAU,IAAMkC,EAAegD,GAASA,IAAQlF,EAAM,GAAK,KAAOA,EAAM,EAAG,EAC3E,OACEA,EAAM,UAAYA,EAAM,YACpB,IAAMiD,EAAWjD,EAAM,SAAoBA,EAAM,WAAqB,EACtE,OAEN,OAAQyD,IAAkBzD,EAAM,GAChC,YAAayD,IAAkB,OAC/B,MAAO,IAAMZ,EAAe7C,EAAM,GAAIA,EAAM,MAAOA,EAAM,OAAQA,EAAM,MAAM,EAC7E,aAAcD,EAAaC,EAAOC,CAAQ,EAC1C,UAAWmC,IAAgBpC,EAAM,GACjC,gBAAiBoC,IAAgB,KACjC,UAAW,IAAMmB,EAAcvD,CAAK,EACpC,eACEA,EAAM,cACF,IAAMiD,EAAWjD,EAAM,cAAyBiF,CAAuB,EACvE,MAAA,EAnBDjF,EAAM,EAAA,CAuBjB,CAAC,CAAA,CACH,CAAA,EAEJ,CAEJ"}
1
+ {"version":3,"file":"index-BJqS77OS.js","sources":["../../../src/app/features/issues/helpers.ts","../../../src/core/issues.ts","../../../src/app/features/issues/hooks/use-issues-page.ts","../../../src/app/features/issues/issue-row.tsx","../../../src/app/features/issues/issues-page.tsx"],"sourcesContent":["import { isClosedEntity } from '@/core/status';\nimport type { EntityStatus, Issue } from '@/types/index';\n\nexport const promoteLabel = (\n issue: Issue,\n entities: { id: string; status?: EntityStatus; archived?: boolean }[],\n): string => {\n const parent = issue.entityId ? entities.find((p) => p.id === issue.entityId) : undefined;\n if (!parent) return 'Promote to idea';\n return isClosedEntity(parent) ? 'Promote to fix' : `Add to ${parent.id}'s fixes`;\n};\n\nexport const formatIssueAge = (occurredAt: string | undefined): string => {\n if (!occurredAt) return '';\n const ageDays = Math.floor((Date.now() - Date.parse(occurredAt)) / 86_400_000);\n if (!Number.isFinite(ageDays)) return '';\n if (ageDays <= 0) return 'today';\n return ageDays === 1 ? '1 day ago' : `${ageDays} days ago`;\n};\n\n// Missing timestamps (a live PR review decision) sort last, not first.\nconst NO_TIMESTAMP = '9999-12-31T23:59:59.999Z';\nexport const sortIssuesByAge = <T extends { occurredAt?: string }>(issues: T[]): T[] =>\n [...issues].sort((a, b) =>\n (a.occurredAt ?? NO_TIMESTAMP).localeCompare(b.occurredAt ?? NO_TIMESTAMP),\n );\n","import type {\n DeskCheckState,\n EntityStatus,\n GitSyncFailure,\n Issue,\n PhaseItem,\n PrInfo,\n TaskLogEntry,\n ThreadMessage,\n} from '../types/index';\n\nconst issueId = (sourceKind: Issue['sourceKind'], sourceKey: string): string =>\n `${sourceKind}:${sourceKey}`;\n\n/** A failed agent run (`outcome: 'error'` in tasks.log), keyed by the plan it ran\n * against so a repeat failure on the same plan continues one issue. Runs with no\n * `planId` (e.g. a batch task) key off their own task id instead. */\nexport function collectAgentRunIssues(taskLog: TaskLogEntry[]): Issue[] {\n return taskLog\n .filter((entry) => entry.outcome === 'error')\n .map((entry) => {\n const sourceKey = entry.planId ?? entry.id;\n return {\n id: issueId('agent-run', sourceKey),\n sourceKind: 'agent-run',\n sourceKey,\n entityId: entry.planId,\n entityTitle: entry.planTitle,\n title: `${entry.planTitle} — ${entry.taskKind} failed`,\n reason: entry.reason ?? 'The run ended in error with no reason recorded.',\n occurredAt: entry.endedAt,\n thread: [],\n status: 'open',\n };\n });\n}\n\n/** A red project check (Quality/Tests/Consistency — Docs keeps its own browse flow\n * and is excluded, same carve-out as `buildCheckFixes`), keyed by check name. */\nexport function collectCheckIssues(checks: DeskCheckState[]): Issue[] {\n return checks\n .filter((check) => check.status === 'fail')\n .map((check) => ({\n id: issueId('check', check.name),\n sourceKind: 'check',\n sourceKey: check.name,\n title: `\"${check.name}\" check is failing`,\n reason: `The command was \\`${check.cmd}\\`.`,\n output: check.output || undefined,\n occurredAt: check.lastRun ?? undefined,\n thread: [],\n status: 'open',\n }));\n}\n\n/** A PR review that requested changes, keyed by PR number + head sha so a fresh\n * push that gets re-reviewed continues the same issue rather than a new one. */\nexport function collectPrReviewIssues(\n entities: { id: string; title: string; pr?: PrInfo }[],\n): Issue[] {\n return entities\n .filter((entity) => entity.pr?.reviewDecision === 'changes-requested')\n .map((entity) => {\n const pr = entity.pr as PrInfo;\n const sourceKey = `${pr.number}:${pr.headSha ?? 'unknown'}`;\n return {\n id: issueId('pr-review', sourceKey),\n sourceKind: 'pr-review',\n sourceKey,\n entityId: entity.id,\n entityTitle: entity.title,\n title: `${entity.title} — PR review requested changes`,\n reason: `PR #${pr.number} has unresolved change requests.`,\n thread: [],\n status: 'open',\n };\n });\n}\n\n/** A git rebase/sync failure on the currently checked-out branch, keyed by branch +\n * the ref it failed to reconcile against so a repeat failure of the same rebase\n * continues one issue. */\nexport function collectSyncIssues(\n failure: GitSyncFailure | undefined,\n branch: string,\n entity?: { id: string; title: string },\n): Issue[] {\n if (!failure) return [];\n const sourceKey = `${branch}:${failure.conflictRef ?? failure.stage}`;\n return [\n {\n id: issueId('sync', sourceKey),\n sourceKind: 'sync',\n sourceKey,\n entityId: entity?.id,\n entityTitle: entity?.title,\n title: `${branch} failed to sync`,\n reason: failure.message,\n output: failure.conflictedFiles?.length\n ? `Conflicted files: ${failure.conflictedFiles.join(', ')}`\n : undefined,\n thread: [],\n status: 'open',\n },\n ];\n}\n\n/** Reconciles freshly-collected issues (every one currently detected as failing, so\n * always 'open') against the existing set, keyed by `id`. A repeat failure of the\n * same thing replaces that issue's title/reason/output in place, preserving its\n * position and its thread. An existing issue absent from `fresh` has stopped\n * failing, so it closes — unless it was promoted to a fix entity that hasn't\n * shipped yet (`fixEntityStatus` reports its status), which keeps it open until\n * that entity reaches 'done'. Closure is derived here, never a mark-read button. */\nexport function reconcileIssues(\n existing: Issue[],\n fresh: Issue[],\n fixEntityStatus: (fixId: string) => EntityStatus | undefined = () => undefined,\n): Issue[] {\n const freshById = new Map(fresh.map((issue) => [issue.id, issue]));\n const merged = existing.map((issue): Issue => {\n if (issue.promotedFixId && fixEntityStatus(issue.promotedFixId) === 'done') {\n freshById.delete(issue.id);\n return { ...issue, status: 'closed' };\n }\n const next = freshById.get(issue.id);\n if (!next) return { ...issue, status: 'closed' };\n freshById.delete(issue.id);\n return { ...next, thread: issue.thread, promotedFixId: issue.promotedFixId };\n });\n return [...merged, ...freshById.values()];\n}\n\n/** A spawned fix/idea entity from Promote (IDEA-192 phase 6) stamps `issueSource`;\n * an open parent instead gets a `source: 'issue'` item appended to its inline Fixes list. */\ntype PromotionTarget = {\n id?: string;\n status?: EntityStatus;\n issueSource?: string;\n fixes?: PhaseItem[];\n};\n\n/** Matches every issue against the corpus for a prior Promote (IDEA-192 phase 6),\n * re-derived from disk on every read since issues carry no store of their own —\n * the promotion survives a reload because git holds it, not a stored issue. Once\n * matched, an issue whose target has shipped (`status: 'done'`) closes, even if\n * its original source is still detected as failing. */\nexport function applyPromotions(issues: Issue[], entities: PromotionTarget[]): Issue[] {\n return issues\n .map((issue): Issue => {\n const spawned = entities.find((e) => e.issueSource === issue.id);\n if (spawned?.id) return { ...issue, promotedFixId: spawned.id };\n const parent = issue.entityId ? entities.find((e) => e.id === issue.entityId) : undefined;\n const appended = parent?.fixes?.some((f) => f.source === 'issue' && f.text === issue.title);\n return appended && parent?.id ? { ...issue, promotedFixId: parent.id } : issue;\n })\n .filter((issue) => {\n const target = issue.promotedFixId && entities.find((e) => e.id === issue.promotedFixId);\n return !(target && target.status === 'done');\n });\n}\n\n/** \"Fix it here\" (IDEA-192) launches an `issue-fix` task carrying the issue's id;\n * this reconstructs that issue's thread from every tasks.log entry carrying it,\n * oldest first, so a repeat fix attempt reads as a continuation, not a fresh mystery. */\nexport function issueThreadFromTaskLog(issue: Issue, taskLog: TaskLogEntry[]): ThreadMessage[] {\n return taskLog\n .filter((entry) => entry.issueId === issue.id)\n .sort((a, b) => a.endedAt.localeCompare(b.endedAt))\n .map((entry) => ({\n kind: 'log',\n date: entry.endedAt.slice(0, 10),\n from: 'agent',\n text:\n entry.outcome === 'done'\n ? 'Ran a fix agent — finished.'\n : entry.outcome === 'error'\n ? `Ran a fix agent — failed: ${entry.reason ?? 'no reason recorded'}`\n : 'Ran a fix agent — superseded by a newer run.',\n }));\n}\n","import { useOpenEntity } from '@/app/hooks';\nimport { useDeskChecks } from '@/app/hooks/use-desk-checks';\nimport { promoteIssue } from '@/app/services/agent-api';\nimport { useAppStore } from '@/app/stores/app-store';\nimport {\n applyPromotions,\n collectAgentRunIssues,\n collectCheckIssues,\n collectPrReviewIssues,\n issueThreadFromTaskLog,\n} from '@/core/issues';\nimport type { Issue, PlanEntry } from '@/types/index';\nimport { useEffect, useMemo, useState } from 'react';\nimport { sortIssuesByAge } from '../helpers';\n\nexport const useIssuesPage = () => {\n const [expandedId, setExpandedId] = useState<string | null>(null);\n const [promotingId, setPromotingId] = useState<string | null>(null);\n const taskLog = useAppStore((s) => s.taskLog);\n const taskLogLoading = useAppStore((s) => s.taskLogLoading);\n const loadTaskLog = useAppStore((s) => s.loadTaskLog);\n const plans = useAppStore((s) => s.plans);\n const ideaEntries = useAppStore((s) => s.ideaEntries);\n const agentStatus = useAppStore((s) => s.agentStatus);\n const launchIssueFix = useAppStore((s) => s.launchIssueFix);\n const loadPlans = useAppStore((s) => s.loadPlans);\n const loadIdeas = useAppStore((s) => s.loadIdeas);\n const { checks } = useDeskChecks();\n const openEntity = useOpenEntity();\n\n useEffect(() => {\n loadTaskLog();\n }, [loadTaskLog]);\n\n const planEntities = useMemo(\n () => (plans?.entries ?? []).filter((p): p is PlanEntry & { id: string } => p.id != null),\n [plans],\n );\n\n const entities = useMemo(\n () =>\n [...planEntities, ...ideaEntries].filter(\n (entity): entity is typeof entity & { id: string } => entity.id != null,\n ),\n [planEntities, ideaEntries],\n );\n\n const issues = useMemo(() => {\n const collected = sortIssuesByAge([\n ...collectAgentRunIssues(taskLog),\n ...collectCheckIssues(checks),\n ...collectPrReviewIssues(entities),\n ]);\n return applyPromotions(collected, entities).map((issue) => ({\n ...issue,\n thread: issueThreadFromTaskLog(issue, taskLog),\n }));\n }, [taskLog, checks, entities]);\n\n const handlePromote = async (issue: Issue) => {\n setPromotingId(issue.id);\n try {\n await promoteIssue(issue);\n await Promise.all([loadPlans(), loadIdeas()]);\n } finally {\n setPromotingId(null);\n }\n };\n\n const fixingIssueId = agentStatus.find(\n (t) =>\n t.taskKind === 'issue-fix' &&\n t.status !== 'done' &&\n t.status !== 'error' &&\n t.status !== 'superseded',\n )?.issueId;\n\n return {\n issues,\n entities,\n taskLogLoading,\n expandedId,\n setExpandedId,\n openEntity,\n fixingIssueId,\n launchIssueFix,\n promotingId,\n handlePromote,\n };\n};\n","import { FeedbackThread, PlanIdStamp } from '@/app/features/plans/components';\nimport type { Issue } from '@/types/index';\nimport { Button, Spinner } from '@dendelion/paper-ui';\nimport { formatIssueAge } from './helpers';\n\ninterface IssueRowProps {\n issue: Issue;\n expanded: boolean;\n onToggle: () => void;\n onOpen?: () => void;\n fixing: boolean;\n fixDisabled: boolean;\n onFix: () => Promise<void>;\n promoteLabel: string;\n promoting: boolean;\n promoteDisabled: boolean;\n onPromote: () => Promise<void>;\n onOpenPromoted?: () => void;\n}\n\nexport const IssueRow = ({\n issue,\n expanded,\n onToggle,\n onOpen,\n fixing,\n fixDisabled,\n onFix,\n promoteLabel,\n promoting,\n promoteDisabled,\n onPromote,\n onOpenPromoted,\n}: IssueRowProps) => {\n const handleFix = async () => {\n try {\n await onFix();\n } catch (err) {\n alert((err as Error).message);\n }\n };\n\n const handlePromote = async () => {\n try {\n await onPromote();\n } catch (err) {\n alert((err as Error).message);\n }\n };\n\n return (\n <div className=\"border-b border-black/10 last:border-b-0\">\n <div className=\"flex items-center gap-3 py-2.5\">\n {onOpen && (\n <button\n type=\"button\"\n onClick={onOpen}\n aria-label={`Open ${issue.entityTitle}`}\n className=\"bg-transparent border-none p-0 cursor-pointer\"\n >\n <PlanIdStamp id={issue.entityId} />\n </button>\n )}\n <button\n type=\"button\"\n onClick={onToggle}\n aria-expanded={expanded}\n className=\"flex-1 min-w-0 truncate text-left bg-transparent border-none p-0 cursor-pointer\"\n >\n {issue.title}\n </button>\n <span className=\"opacity-50 text-xs whitespace-nowrap\">\n {formatIssueAge(issue.occurredAt)}\n </span>\n </div>\n {expanded && (\n <div className=\"flex flex-col gap-3 pb-4\">\n <p>{issue.reason}</p>\n {issue.output && (\n <pre className=\"max-h-48 overflow-auto whitespace-pre-wrap text-left font-mono text-2xs opacity-70\">\n {issue.output}\n </pre>\n )}\n {issue.thread.length > 0 && (\n <FeedbackThread messages={issue.thread} undo={null} undoing={false} onUndo={() => {}} />\n )}\n <div className=\"flex items-center gap-3\">\n {issue.promotedFixId ? (\n <Button size=\"small\" onClick={onOpenPromoted}>\n View {issue.promotedFixId}\n </Button>\n ) : (\n <>\n <Button size=\"small\" onClick={handleFix} disabled={fixDisabled}>\n {fixing ? 'Fixing…' : 'Fix it here'}\n </Button>\n {fixing && <Spinner size=\"small\" label=\"Agent fixing…\" />}\n <Button size=\"small\" onClick={handlePromote} disabled={promoteDisabled}>\n {promoting ? 'Promoting…' : promoteLabel}\n </Button>\n {promoting && <Spinner size=\"small\" label=\"Promoting…\" />}\n </>\n )}\n </div>\n </div>\n )}\n </div>\n );\n};\n","import { PageTitle } from '@/app/components/page-title';\nimport { promoteLabel } from './helpers';\nimport { useIssuesPage } from './hooks';\nimport { IssueRow } from './issue-row';\n\nexport const IssuesPage = () => {\n const {\n issues,\n entities,\n taskLogLoading,\n expandedId,\n setExpandedId,\n openEntity,\n fixingIssueId,\n launchIssueFix,\n promotingId,\n handlePromote,\n } = useIssuesPage();\n\n return (\n <div>\n <PageTitle>Issues</PageTitle>\n <p className=\"opacity-50 mb-6\">\n Every failing agent run, red check, and PR review, oldest first.\n </p>\n {taskLogLoading && issues.length === 0 && <p className=\"opacity-50\">Loading…</p>}\n {!taskLogLoading && issues.length === 0 && (\n <p className=\"opacity-50\">Nothing broken right now.</p>\n )}\n {issues.length > 0 && (\n <div className=\"flex flex-col\">\n {issues.map((issue) => {\n const promotedTitle = issue.promotedFixId\n ? (entities.find((p) => p.id === issue.promotedFixId)?.title ?? issue.promotedFixId)\n : undefined;\n return (\n <IssueRow\n key={issue.id}\n issue={issue}\n expanded={expandedId === issue.id}\n onToggle={() => setExpandedId((cur) => (cur === issue.id ? null : issue.id))}\n onOpen={\n issue.entityId && issue.entityTitle\n ? () => openEntity(issue.entityId as string, issue.entityTitle as string)\n : undefined\n }\n fixing={fixingIssueId === issue.id}\n fixDisabled={fixingIssueId !== undefined}\n onFix={() => launchIssueFix(issue.id, issue.title, issue.reason, issue.output)}\n promoteLabel={promoteLabel(issue, entities)}\n promoting={promotingId === issue.id}\n promoteDisabled={promotingId !== null}\n onPromote={() => handlePromote(issue)}\n onOpenPromoted={\n issue.promotedFixId\n ? () => openEntity(issue.promotedFixId as string, promotedTitle as string)\n : undefined\n }\n />\n );\n })}\n </div>\n )}\n </div>\n );\n};\n"],"names":["promoteLabel","issue","entities","parent","p","isClosedEntity","formatIssueAge","occurredAt","ageDays","NO_TIMESTAMP","sortIssuesByAge","issues","a","b","issueId","sourceKind","sourceKey","collectAgentRunIssues","taskLog","entry","collectCheckIssues","checks","check","collectPrReviewIssues","entity","_a","pr","applyPromotions","spawned","e","f","target","issueThreadFromTaskLog","useIssuesPage","expandedId","setExpandedId","useState","promotingId","setPromotingId","useAppStore","s","taskLogLoading","loadTaskLog","plans","ideaEntries","agentStatus","launchIssueFix","loadPlans","loadIdeas","useDeskChecks","openEntity","useOpenEntity","useEffect","planEntities","useMemo","collected","handlePromote","promoteIssue","fixingIssueId","t","IssueRow","expanded","onToggle","onOpen","fixing","fixDisabled","onFix","promoting","promoteDisabled","onPromote","onOpenPromoted","handleFix","err","jsxs","jsx","PlanIdStamp","FeedbackThread","Button","Fragment","Spinner","IssuesPage","Page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BA,EAAM,WAAqB,EACtE,OAEN,OAAQyD,IAAkBzD,EAAM,GAChC,YAAayD,IAAkB,OAC/B,MAAO,IAAMZ,EAAe7C,EAAM,GAAIA,EAAM,MAAOA,EAAM,OAAQA,EAAM,MAAM,EAC7E,aAAcD,EAAaC,EAAOC,CAAQ,EAC1C,UAAWmC,IAAgBpC,EAAM,GACjC,gBAAiBoC,IAAgB,KACjC,UAAW,IAAMmB,EAAcvD,CAAK,EACpC,eACEA,EAAM,cACF,IAAMiD,EAAWjD,EAAM,cAAyBiF,CAAuB,EACvE,MAAA,EAnBDjF,EAAM,EAAA,CAuBjB,CAAC,CAAA,CACH,CAAA,EAEJ,CAEJ"}
@@ -0,0 +1,2 @@
1
+ import{r as d,u as c,Q as k,j as e,al as h,C as w,am as v,an as E,ao as I,ap as C,aq as D,G as R,J as $,ar as P,P as T}from"./main-CpTKYLW_.js";function S(t){return Math.floor((Date.now()-Date.parse(t))/864e5)}function K(t){return t.kind==="question"?t.ageDays:S(t.date)}const j=t=>Number.isFinite(t)?t<=0?"today":t===1?"1 day ago":`${t} days ago`:"age unknown",L=()=>{const[t,i]=d.useState(null),n=c(s=>s.notifications),p=c(s=>s.notificationsError!==null),x=c(s=>s.plans),u=c(s=>s.loadPlans),o=c(s=>s.loadNotifications),a=c(s=>s.markRead),l=k();return d.useEffect(()=>{o()},[o]),d.useEffect(()=>{if(n)for(const s of n)s.kind!=="question"&&!s.read&&a(s.id)},[n,a]),{notifications:n,loadFailed:p,plans:x,expandedKey:t,setExpandedKey:i,openEntity:l,reload:async()=>{await Promise.all([u(),o()])}}},A={completed:"Completed",reply:"Reply"},F=({notification:t,ageDays:i,onOpen:n})=>e.jsxs("div",{className:"flex items-center gap-3 py-2.5 border-b border-black/10 last:border-b-0",children:[e.jsx("button",{type:"button",onClick:n,"aria-label":`Open ${t.entityTitle}`,className:"bg-transparent border-none p-0 cursor-pointer",children:e.jsx(h,{id:t.entityId})}),e.jsx("span",{className:"text-xs uppercase tracking-wide opacity-40 whitespace-nowrap",children:A[t.kind]}),e.jsx("span",{className:"flex-1 min-w-0 truncate",children:t.text}),e.jsx("span",{className:"opacity-50 text-xs whitespace-nowrap",children:j(i)})]}),O=({question:t,plan:i,expanded:n,onToggle:p,onOpen:x,reload:u})=>{const{toast:o}=w(),[a,l]=d.useState(""),{sending:r,send:s,undo:b,undoing:y,undoEdit:g}=v(i,{reload:u,notify:o}),m=`question-reply:${t.entityId}`;d.useEffect(()=>{const f=E(m);f&&l(f)},[m]),d.useEffect(()=>{a&&I(m,a)},[m,a]);const N=async()=>{a.trim()&&await s(a.trim())&&(l(""),P(m))};return e.jsxs("div",{className:"border-b border-black/10 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-3 py-2.5",children:[e.jsx("button",{type:"button",onClick:x,"aria-label":`Open ${t.entityTitle}`,className:"bg-transparent border-none p-0 cursor-pointer",children:e.jsx(h,{id:t.entityId})}),e.jsx("button",{type:"button",onClick:p,"aria-expanded":n,className:"flex-1 min-w-0 truncate text-left bg-transparent border-none p-0 cursor-pointer",children:t.text}),e.jsx("span",{className:"opacity-50 text-xs whitespace-nowrap",children:j(t.ageDays)})]}),n&&e.jsxs("div",{className:"flex flex-col gap-3 pb-4",children:[e.jsx(C,{messages:i.thread??[],undo:b,undoing:y,onUndo:g}),e.jsx(D,{value:a,onChange:f=>l(f.target.value),"aria-label":`Reply to ${t.entityTitle}`,placeholder:"Reply to resolve and resume…",rows:2,disabled:r}),e.jsxs("div",{className:"flex justify-end items-center gap-3",children:[e.jsx("span",{className:r?"visible":"invisible",children:e.jsx(R,{size:"small",label:"Agent replying…"})}),e.jsx($,{size:"small",onClick:N,disabled:r||!a.trim(),children:"Reply"})]})]})]})},z=()=>{const{notifications:t,loadFailed:i,plans:n,expandedKey:p,setExpandedKey:x,openEntity:u,reload:o}=L();return e.jsxs("div",{children:[e.jsx(T,{children:"Inbox"}),e.jsx("p",{className:"opacity-50 mb-6",children:"Every parked question, completed run, and agent reply, oldest first."}),i&&e.jsx("p",{className:"opacity-50",children:"Couldn't load notifications."}),!i&&!t&&e.jsx("p",{className:"opacity-50",children:"Loading…"}),t&&t.length===0&&e.jsx("p",{className:"opacity-50",children:"Nothing here — no parked questions or recent activity."}),t&&t.length>0&&e.jsx("div",{className:"flex flex-col",children:t.map((a,l)=>{const r=`${a.entityId}-${a.kind}-${l}`,s=()=>u(a.entityId,a.entityTitle);if(a.kind!=="question")return e.jsx(F,{notification:a,ageDays:K(a),onOpen:s},r);const b=n==null?void 0:n.entries.find(y=>y.id===a.entityId);return b?e.jsx(O,{question:a,plan:b,expanded:p===r,onToggle:()=>x(y=>y===r?null:r),onOpen:s,reload:o},r):e.jsxs("div",{className:"flex items-center gap-3 py-2.5 border-b border-black/10 last:border-b-0",children:[e.jsx("button",{type:"button",onClick:s,"aria-label":`Open ${a.entityTitle}`,className:"bg-transparent border-none p-0 cursor-pointer",children:e.jsx(h,{id:a.entityId})}),e.jsx("span",{className:"flex-1 min-w-0 truncate",children:a.text}),e.jsx("span",{className:"opacity-50 text-xs whitespace-nowrap",children:j(a.ageDays)})]},r)})})]})};export{z as InboxPage};
2
+ //# sourceMappingURL=index-BVj9hjpY.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-DxehIB14.js","sources":["../../../src/core/notifications.ts","../../../src/app/features/inbox/helpers.ts","../../../src/app/features/inbox/hooks/use-inbox-page.ts","../../../src/app/features/inbox/notification-row.tsx","../../../src/app/features/inbox/question-row.tsx","../../../src/app/features/inbox/inbox-page.tsx"],"sourcesContent":["import type { Notification, ParkedQuestion, StoredNotification } from '../types/index';\n\nfunction ageInDays(date: string): number {\n return Math.floor((Date.now() - Date.parse(date)) / 86_400_000);\n}\n\nexport function notificationAgeDays(notification: Notification): number {\n return notification.kind === 'question' ? notification.ageDays : ageInDays(notification.date);\n}\n\n/** Every parked question alongside completed/reply notifications, oldest-first — the\n * unified feed (IDEA-153) replacing the questions-only Inbox. */\nexport function mergeNotifications(\n parkedQuestions: ParkedQuestion[],\n stored: StoredNotification[],\n): Notification[] {\n const entries: Notification[] = [\n ...parkedQuestions.map((q): Notification => ({ ...q, kind: 'question' })),\n ...stored,\n ];\n return entries.sort((a, b) => notificationAgeDays(b) - notificationAgeDays(a));\n}\n","export const formatAge = (ageDays: number): string => {\n if (!Number.isFinite(ageDays)) return 'age unknown';\n if (ageDays <= 0) return 'today';\n return ageDays === 1 ? '1 day ago' : `${ageDays} days ago`;\n};\n","import { useOpenEntity } from '@/app/hooks';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { useEffect, useState } from 'react';\n\nexport const useInboxPage = () => {\n const [expandedKey, setExpandedKey] = useState<string | null>(null);\n const notifications = useAppStore((s) => s.notifications);\n const loadFailed = useAppStore((s) => s.notificationsError !== null);\n const plans = useAppStore((s) => s.plans);\n const loadPlans = useAppStore((s) => s.loadPlans);\n const loadNotifications = useAppStore((s) => s.loadNotifications);\n const markRead = useAppStore((s) => s.markRead);\n const openEntity = useOpenEntity();\n\n useEffect(() => {\n loadNotifications();\n }, [loadNotifications]);\n\n useEffect(() => {\n if (!notifications) return;\n for (const n of notifications) {\n if (n.kind !== 'question' && !n.read) markRead(n.id);\n }\n }, [notifications, markRead]);\n\n const reload = async () => {\n await Promise.all([loadPlans(), loadNotifications()]);\n };\n\n return {\n notifications,\n loadFailed,\n plans,\n expandedKey,\n setExpandedKey,\n openEntity,\n reload,\n };\n};\n","import { PlanIdStamp } from '@/app/features/plans/components';\nimport type { StoredNotification } from '@/types/index';\nimport { formatAge } from './helpers';\n\nconst KIND_LABELS: Record<StoredNotification['kind'], string> = {\n completed: 'Completed',\n reply: 'Reply',\n};\n\ninterface NotificationRowProps {\n notification: StoredNotification;\n ageDays: number;\n onOpen: () => void;\n}\n\nexport const NotificationRow = ({ notification, ageDays, onOpen }: NotificationRowProps) => (\n <div className=\"flex items-center gap-3 py-2.5 border-b border-black/10 last:border-b-0\">\n <button\n type=\"button\"\n onClick={onOpen}\n aria-label={`Open ${notification.entityTitle}`}\n className=\"bg-transparent border-none p-0 cursor-pointer\"\n >\n <PlanIdStamp id={notification.entityId} />\n </button>\n <span className=\"text-xs uppercase tracking-wide opacity-40 whitespace-nowrap\">\n {KIND_LABELS[notification.kind]}\n </span>\n <span className=\"flex-1 min-w-0 truncate\">{notification.text}</span>\n <span className=\"opacity-50 text-xs whitespace-nowrap\">{formatAge(ageDays)}</span>\n </div>\n);\n","import { FeedbackThread, PlanIdStamp } from '@/app/features/plans/components';\nimport { useSendFeedbackMessage } from '@/app/features/plans/hooks';\nimport { readLocalDraft, removeLocalDraft, writeLocalDraft } from '@/app/utils/local-draft-store';\nimport type { ParkedQuestion, PlanEntry } from '@/types/index';\nimport { Button, Spinner, Textarea, useToast } from '@dendelion/paper-ui';\nimport { useEffect, useState } from 'react';\nimport { formatAge } from './helpers';\n\ninterface QuestionRowProps {\n question: ParkedQuestion;\n plan: PlanEntry;\n expanded: boolean;\n onToggle: () => void;\n onOpen: () => void;\n reload: () => Promise<void>;\n}\n\nexport const QuestionRow = ({\n question,\n plan,\n expanded,\n onToggle,\n onOpen,\n reload,\n}: QuestionRowProps) => {\n const { toast } = useToast();\n const [input, setInput] = useState('');\n const { sending, send, undo, undoing, undoEdit } = useSendFeedbackMessage(plan, {\n reload,\n notify: toast,\n });\n\n const draftKey = `question-reply:${question.entityId}`;\n\n useEffect(() => {\n const draft = readLocalDraft<string>(draftKey);\n if (draft) setInput(draft);\n }, [draftKey]);\n\n useEffect(() => {\n if (!input) return;\n writeLocalDraft(draftKey, input);\n }, [draftKey, input]);\n\n const handleSend = async () => {\n if (!input.trim()) return;\n if (await send(input.trim())) {\n setInput('');\n removeLocalDraft(draftKey);\n }\n };\n\n return (\n <div className=\"border-b border-black/10 last:border-b-0\">\n <div className=\"flex items-center gap-3 py-2.5\">\n <button\n type=\"button\"\n onClick={onOpen}\n aria-label={`Open ${question.entityTitle}`}\n className=\"bg-transparent border-none p-0 cursor-pointer\"\n >\n <PlanIdStamp id={question.entityId} />\n </button>\n <button\n type=\"button\"\n onClick={onToggle}\n aria-expanded={expanded}\n className=\"flex-1 min-w-0 truncate text-left bg-transparent border-none p-0 cursor-pointer\"\n >\n {question.text}\n </button>\n <span className=\"opacity-50 text-xs whitespace-nowrap\">{formatAge(question.ageDays)}</span>\n </div>\n {expanded && (\n <div className=\"flex flex-col gap-3 pb-4\">\n <FeedbackThread\n messages={plan.thread ?? []}\n undo={undo}\n undoing={undoing}\n onUndo={undoEdit}\n />\n <Textarea\n value={input}\n onChange={(e) => setInput(e.target.value)}\n aria-label={`Reply to ${question.entityTitle}`}\n placeholder=\"Reply to resolve and resume…\"\n rows={2}\n disabled={sending}\n />\n <div className=\"flex justify-end items-center gap-3\">\n <span className={sending ? 'visible' : 'invisible'}>\n <Spinner size=\"small\" label=\"Agent replying…\" />\n </span>\n <Button size=\"small\" onClick={handleSend} disabled={sending || !input.trim()}>\n Reply\n </Button>\n </div>\n </div>\n )}\n </div>\n );\n};\n","import { PageTitle } from '@/app/components/page-title';\nimport { PlanIdStamp } from '@/app/features/plans/components';\nimport { notificationAgeDays } from '@/core/notifications';\nimport { formatAge } from './helpers';\nimport { useInboxPage } from './hooks';\nimport { NotificationRow } from './notification-row';\nimport { QuestionRow } from './question-row';\n\nexport const InboxPage = () => {\n const { notifications, loadFailed, plans, expandedKey, setExpandedKey, openEntity, reload } =\n useInboxPage();\n\n return (\n <div>\n <PageTitle>Inbox</PageTitle>\n <p className=\"opacity-50 mb-6\">\n Every parked question, completed run, and agent reply, oldest first.\n </p>\n {loadFailed && <p className=\"opacity-50\">Couldn't load notifications.</p>}\n {!loadFailed && !notifications && <p className=\"opacity-50\">Loading…</p>}\n {notifications && notifications.length === 0 && (\n <p className=\"opacity-50\">Nothing here — no parked questions or recent activity.</p>\n )}\n {notifications && notifications.length > 0 && (\n <div className=\"flex flex-col\">\n {notifications.map((n, i) => {\n const key = `${n.entityId}-${n.kind}-${i}`;\n const onOpen = () => openEntity(n.entityId, n.entityTitle);\n\n if (n.kind !== 'question') {\n return (\n <NotificationRow\n key={key}\n notification={n}\n ageDays={notificationAgeDays(n)}\n onOpen={onOpen}\n />\n );\n }\n\n const plan = plans?.entries.find((p) => p.id === n.entityId);\n if (!plan) {\n return (\n <div\n key={key}\n className=\"flex items-center gap-3 py-2.5 border-b border-black/10 last:border-b-0\"\n >\n <button\n type=\"button\"\n onClick={onOpen}\n aria-label={`Open ${n.entityTitle}`}\n className=\"bg-transparent border-none p-0 cursor-pointer\"\n >\n <PlanIdStamp id={n.entityId} />\n </button>\n <span className=\"flex-1 min-w-0 truncate\">{n.text}</span>\n <span className=\"opacity-50 text-xs whitespace-nowrap\">\n {formatAge(n.ageDays)}\n </span>\n </div>\n );\n }\n return (\n <QuestionRow\n key={key}\n question={n}\n plan={plan}\n expanded={expandedKey === key}\n onToggle={() => setExpandedKey((cur) => (cur === key ? null : key))}\n onOpen={onOpen}\n reload={reload}\n />\n );\n })}\n </div>\n )}\n </div>\n );\n};\n"],"names":["ageInDays","date","notificationAgeDays","notification","formatAge","ageDays","useInboxPage","expandedKey","setExpandedKey","useState","notifications","useAppStore","loadFailed","plans","loadPlans","loadNotifications","markRead","openEntity","useOpenEntity","useEffect","n","KIND_LABELS","NotificationRow","onOpen","jsxs","jsx","PlanIdStamp","QuestionRow","question","plan","expanded","onToggle","reload","toast","useToast","input","setInput","sending","send","undo","undoing","undoEdit","useSendFeedbackMessage","draftKey","draft","readLocalDraft","writeLocalDraft","handleSend","removeLocalDraft","FeedbackThread","Textarea","e","Spinner","Button","InboxPage","PageTitle","i","key","p","cur"],"mappings":"iJAEA,SAASA,EAAUC,EAAsB,CACvC,OAAO,KAAK,OAAO,KAAK,MAAQ,KAAK,MAAMA,CAAI,GAAK,KAAU,CAChE,CAEO,SAASC,EAAoBC,EAAoC,CACtE,OAAOA,EAAa,OAAS,WAAaA,EAAa,QAAUH,EAAUG,EAAa,IAAI,CAC9F,CCRO,MAAMC,EAAaC,GACnB,OAAO,SAASA,CAAO,EACxBA,GAAW,EAAU,QAClBA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A,wDAAA,CAAsD,EAEjFA,GAAiBA,EAAc,OAAS,GACvCe,EAAAA,IAAC,MAAA,CAAI,UAAU,gBACZ,SAAAf,EAAc,IAAI,CAACU,EAAGoC,IAAM,CAC3B,MAAMC,EAAM,GAAGrC,EAAE,QAAQ,IAAIA,EAAE,IAAI,IAAIoC,CAAC,GAClCjC,EAAS,IAAMN,EAAWG,EAAE,SAAUA,EAAE,WAAW,EAEzD,GAAIA,EAAE,OAAS,WACb,OACEK,EAAAA,IAACH,EAAA,CAEC,aAAcF,EACd,QAASlB,EAAoBkB,CAAC,EAC9B,OAAAG,CAAA,EAHKkC,CAAA,EAQX,MAAM5B,EAAOhB,GAAA,YAAAA,EAAO,QAAQ,KAAM6C,GAAMA,EAAE,KAAOtC,EAAE,UACnD,OAAKS,EAsBHJ,EAAAA,IAACE,EAAA,CAEC,SAAUP,EACV,KAAAS,EACA,SAAUtB,IAAgBkD,EAC1B,SAAU,IAAMjD,EAAgBmD,GAASA,IAAQF,EAAM,KAAOA,CAAI,EAClE,OAAAlC,EACA,OAAAS,CAAA,EANKyB,CAAA,EArBLjC,EAAAA,KAAC,MAAA,CAEC,UAAU,0EAEV,SAAA,CAAAC,EAAAA,IAAC,SAAA,CACC,KAAK,SACL,QAASF,EACT,aAAY,QAAQH,EAAE,WAAW,GACjC,UAAU,gDAEV,SAAAK,EAAAA,IAACC,EAAA,CAAY,GAAIN,EAAE,QAAA,CAAU,CAAA,CAAA,EAE/BK,EAAAA,IAAC,OAAA,CAAK,UAAU,0BAA2B,WAAE,KAAK,QACjD,OAAA,CAAK,UAAU,uCACb,SAAArB,EAAUgB,EAAE,OAAO,CAAA,CACtB,CAAA,CAAA,EAdKqC,CAAA,CA6Bb,CAAC,CAAA,CACH,CAAA,EAEJ,CAEJ"}
1
+ {"version":3,"file":"index-BVj9hjpY.js","sources":["../../../src/core/notifications.ts","../../../src/app/features/inbox/helpers.ts","../../../src/app/features/inbox/hooks/use-inbox-page.ts","../../../src/app/features/inbox/notification-row.tsx","../../../src/app/features/inbox/question-row.tsx","../../../src/app/features/inbox/inbox-page.tsx"],"sourcesContent":["import type { Notification, ParkedQuestion, StoredNotification } from '../types/index';\n\nfunction ageInDays(date: string): number {\n return Math.floor((Date.now() - Date.parse(date)) / 86_400_000);\n}\n\nexport function notificationAgeDays(notification: Notification): number {\n return notification.kind === 'question' ? notification.ageDays : ageInDays(notification.date);\n}\n\n/** Every parked question alongside completed/reply notifications, oldest-first — the\n * unified feed (IDEA-153) replacing the questions-only Inbox. */\nexport function mergeNotifications(\n parkedQuestions: ParkedQuestion[],\n stored: StoredNotification[],\n): Notification[] {\n const entries: Notification[] = [\n ...parkedQuestions.map((q): Notification => ({ ...q, kind: 'question' })),\n ...stored,\n ];\n return entries.sort((a, b) => notificationAgeDays(b) - notificationAgeDays(a));\n}\n","export const formatAge = (ageDays: number): string => {\n if (!Number.isFinite(ageDays)) return 'age unknown';\n if (ageDays <= 0) return 'today';\n return ageDays === 1 ? '1 day ago' : `${ageDays} days ago`;\n};\n","import { useOpenEntity } from '@/app/hooks';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { useEffect, useState } from 'react';\n\nexport const useInboxPage = () => {\n const [expandedKey, setExpandedKey] = useState<string | null>(null);\n const notifications = useAppStore((s) => s.notifications);\n const loadFailed = useAppStore((s) => s.notificationsError !== null);\n const plans = useAppStore((s) => s.plans);\n const loadPlans = useAppStore((s) => s.loadPlans);\n const loadNotifications = useAppStore((s) => s.loadNotifications);\n const markRead = useAppStore((s) => s.markRead);\n const openEntity = useOpenEntity();\n\n useEffect(() => {\n loadNotifications();\n }, [loadNotifications]);\n\n useEffect(() => {\n if (!notifications) return;\n for (const n of notifications) {\n if (n.kind !== 'question' && !n.read) markRead(n.id);\n }\n }, [notifications, markRead]);\n\n const reload = async () => {\n await Promise.all([loadPlans(), loadNotifications()]);\n };\n\n return {\n notifications,\n loadFailed,\n plans,\n expandedKey,\n setExpandedKey,\n openEntity,\n reload,\n };\n};\n","import { PlanIdStamp } from '@/app/features/plans/components';\nimport type { StoredNotification } from '@/types/index';\nimport { formatAge } from './helpers';\n\nconst KIND_LABELS: Record<StoredNotification['kind'], string> = {\n completed: 'Completed',\n reply: 'Reply',\n};\n\ninterface NotificationRowProps {\n notification: StoredNotification;\n ageDays: number;\n onOpen: () => void;\n}\n\nexport const NotificationRow = ({ notification, ageDays, onOpen }: NotificationRowProps) => (\n <div className=\"flex items-center gap-3 py-2.5 border-b border-black/10 last:border-b-0\">\n <button\n type=\"button\"\n onClick={onOpen}\n aria-label={`Open ${notification.entityTitle}`}\n className=\"bg-transparent border-none p-0 cursor-pointer\"\n >\n <PlanIdStamp id={notification.entityId} />\n </button>\n <span className=\"text-xs uppercase tracking-wide opacity-40 whitespace-nowrap\">\n {KIND_LABELS[notification.kind]}\n </span>\n <span className=\"flex-1 min-w-0 truncate\">{notification.text}</span>\n <span className=\"opacity-50 text-xs whitespace-nowrap\">{formatAge(ageDays)}</span>\n </div>\n);\n","import { FeedbackThread, PlanIdStamp } from '@/app/features/plans/components';\nimport { useSendFeedbackMessage } from '@/app/features/plans/hooks';\nimport { readLocalDraft, removeLocalDraft, writeLocalDraft } from '@/app/utils/local-draft-store';\nimport type { ParkedQuestion, PlanEntry } from '@/types/index';\nimport { Button, Spinner, Textarea, useToast } from '@dendelion/paper-ui';\nimport { useEffect, useState } from 'react';\nimport { formatAge } from './helpers';\n\ninterface QuestionRowProps {\n question: ParkedQuestion;\n plan: PlanEntry;\n expanded: boolean;\n onToggle: () => void;\n onOpen: () => void;\n reload: () => Promise<void>;\n}\n\nexport const QuestionRow = ({\n question,\n plan,\n expanded,\n onToggle,\n onOpen,\n reload,\n}: QuestionRowProps) => {\n const { toast } = useToast();\n const [input, setInput] = useState('');\n const { sending, send, undo, undoing, undoEdit } = useSendFeedbackMessage(plan, {\n reload,\n notify: toast,\n });\n\n const draftKey = `question-reply:${question.entityId}`;\n\n useEffect(() => {\n const draft = readLocalDraft<string>(draftKey);\n if (draft) setInput(draft);\n }, [draftKey]);\n\n useEffect(() => {\n if (!input) return;\n writeLocalDraft(draftKey, input);\n }, [draftKey, input]);\n\n const handleSend = async () => {\n if (!input.trim()) return;\n if (await send(input.trim())) {\n setInput('');\n removeLocalDraft(draftKey);\n }\n };\n\n return (\n <div className=\"border-b border-black/10 last:border-b-0\">\n <div className=\"flex items-center gap-3 py-2.5\">\n <button\n type=\"button\"\n onClick={onOpen}\n aria-label={`Open ${question.entityTitle}`}\n className=\"bg-transparent border-none p-0 cursor-pointer\"\n >\n <PlanIdStamp id={question.entityId} />\n </button>\n <button\n type=\"button\"\n onClick={onToggle}\n aria-expanded={expanded}\n className=\"flex-1 min-w-0 truncate text-left bg-transparent border-none p-0 cursor-pointer\"\n >\n {question.text}\n </button>\n <span className=\"opacity-50 text-xs whitespace-nowrap\">{formatAge(question.ageDays)}</span>\n </div>\n {expanded && (\n <div className=\"flex flex-col gap-3 pb-4\">\n <FeedbackThread\n messages={plan.thread ?? []}\n undo={undo}\n undoing={undoing}\n onUndo={undoEdit}\n />\n <Textarea\n value={input}\n onChange={(e) => setInput(e.target.value)}\n aria-label={`Reply to ${question.entityTitle}`}\n placeholder=\"Reply to resolve and resume…\"\n rows={2}\n disabled={sending}\n />\n <div className=\"flex justify-end items-center gap-3\">\n <span className={sending ? 'visible' : 'invisible'}>\n <Spinner size=\"small\" label=\"Agent replying…\" />\n </span>\n <Button size=\"small\" onClick={handleSend} disabled={sending || !input.trim()}>\n Reply\n </Button>\n </div>\n </div>\n )}\n </div>\n );\n};\n","import { PageTitle } from '@/app/components/page-title';\nimport { PlanIdStamp } from '@/app/features/plans/components';\nimport { notificationAgeDays } from '@/core/notifications';\nimport { formatAge } from './helpers';\nimport { useInboxPage } from './hooks';\nimport { NotificationRow } from './notification-row';\nimport { QuestionRow } from './question-row';\n\nexport const InboxPage = () => {\n const { notifications, loadFailed, plans, expandedKey, setExpandedKey, openEntity, reload } =\n useInboxPage();\n\n return (\n <div>\n <PageTitle>Inbox</PageTitle>\n <p className=\"opacity-50 mb-6\">\n Every parked question, completed run, and agent reply, oldest first.\n </p>\n {loadFailed && <p className=\"opacity-50\">Couldn't load notifications.</p>}\n {!loadFailed && !notifications && <p className=\"opacity-50\">Loading…</p>}\n {notifications && notifications.length === 0 && (\n <p className=\"opacity-50\">Nothing here — no parked questions or recent activity.</p>\n )}\n {notifications && notifications.length > 0 && (\n <div className=\"flex flex-col\">\n {notifications.map((n, i) => {\n const key = `${n.entityId}-${n.kind}-${i}`;\n const onOpen = () => openEntity(n.entityId, n.entityTitle);\n\n if (n.kind !== 'question') {\n return (\n <NotificationRow\n key={key}\n notification={n}\n ageDays={notificationAgeDays(n)}\n onOpen={onOpen}\n />\n );\n }\n\n const plan = plans?.entries.find((p) => p.id === n.entityId);\n if (!plan) {\n return (\n <div\n key={key}\n className=\"flex items-center gap-3 py-2.5 border-b border-black/10 last:border-b-0\"\n >\n <button\n type=\"button\"\n onClick={onOpen}\n aria-label={`Open ${n.entityTitle}`}\n className=\"bg-transparent border-none p-0 cursor-pointer\"\n >\n <PlanIdStamp id={n.entityId} />\n </button>\n <span className=\"flex-1 min-w-0 truncate\">{n.text}</span>\n <span className=\"opacity-50 text-xs whitespace-nowrap\">\n {formatAge(n.ageDays)}\n </span>\n </div>\n );\n }\n return (\n <QuestionRow\n key={key}\n question={n}\n plan={plan}\n expanded={expandedKey === key}\n onToggle={() => setExpandedKey((cur) => (cur === key ? null : key))}\n onOpen={onOpen}\n reload={reload}\n />\n );\n })}\n </div>\n )}\n </div>\n );\n};\n"],"names":["ageInDays","date","notificationAgeDays","notification","formatAge","ageDays","useInboxPage","expandedKey","setExpandedKey","useState","notifications","useAppStore","loadFailed","plans","loadPlans","loadNotifications","markRead","openEntity","useOpenEntity","useEffect","n","KIND_LABELS","NotificationRow","onOpen","jsxs","jsx","PlanIdStamp","QuestionRow","question","plan","expanded","onToggle","reload","toast","useToast","input","setInput","sending","send","undo","undoing","undoEdit","useSendFeedbackMessage","draftKey","draft","readLocalDraft","writeLocalDraft","handleSend","removeLocalDraft","FeedbackThread","Textarea","e","Spinner","Button","InboxPage","PageTitle","i","key","p","cur"],"mappings":"gJAEA,SAASA,EAAUC,EAAsB,CACvC,OAAO,KAAK,OAAO,KAAK,MAAQ,KAAK,MAAMA,CAAI,GAAK,KAAU,CAChE,CAEO,SAASC,EAAoBC,EAAoC,CACtE,OAAOA,EAAa,OAAS,WAAaA,EAAa,QAAUH,EAAUG,EAAa,IAAI,CAC9F,CCRO,MAAMC,EAAaC,GACnB,OAAO,SAASA,CAAO,EACxBA,GAAW,EAAU,QAClBA,IAAY,EAAI,YAAc,GAAGA,CAAO,YAFT,cCG3BC,EAAe,IAAM,CAChC,KAAM,CAACC,EAAaC,CAAc,EAAIC,EAAAA,SAAwB,IAAI,EAC5DC,EAAgBC,EAAa,GAAM,EAAE,aAAa,EAClDC,EAAaD,EAAa,GAAM,EAAE,qBAAuB,IAAI,EAC7DE,EAAQF,EAAa,GAAM,EAAE,KAAK,EAClCG,EAAYH,EAAa,GAAM,EAAE,SAAS,EAC1CI,EAAoBJ,EAAa,GAAM,EAAE,iBAAiB,EAC1DK,EAAWL,EAAa,GAAM,EAAE,QAAQ,EACxCM,EAAaC,EAAA,EAEnBC,OAAAA,EAAAA,UAAU,IAAM,CACdJ,EAAA,CACF,EAAG,CAACA,CAAiB,CAAC,EAEtBI,EAAAA,UAAU,IAAM,CACd,GAAKT,EACL,UAAWU,KAAKV,EACVU,EAAE,OAAS,YAAc,CAACA,EAAE,MAAMJ,EAASI,EAAE,EAAE,CAEvD,EAAG,CAACV,EAAeM,CAAQ,CAAC,EAMrB,CACL,cAAAN,EACA,WAAAE,EACA,MAAAC,EACA,YAAAN,EACA,eAAAC,EACA,WAAAS,EACA,OAXa,SAAY,CACzB,MAAM,QAAQ,IAAI,CAACH,IAAaC,EAAA,CAAmB,CAAC,CACtD,CASE,CAEJ,EClCMM,EAA0D,CAC9D,UAAW,YACX,MAAO,OACT,EAQaC,EAAkB,CAAC,CAAE,aA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,QAAA,CAAU,CAAA,CAAA,EAE/BK,EAAAA,IAAC,OAAA,CAAK,UAAU,0BAA2B,WAAE,KAAK,QACjD,OAAA,CAAK,UAAU,uCACb,SAAArB,EAAUgB,EAAE,OAAO,CAAA,CACtB,CAAA,CAAA,EAdKqC,CAAA,CA6Bb,CAAC,CAAA,CACH,CAAA,EAEJ,CAEJ"}
@@ -0,0 +1,2 @@
1
+ import{c as m,r as o,a3 as u,a0 as h,j as e,R as j,g as d,a4 as g,a5 as v,a6 as p,a7 as i,K as c,a8 as r,P as N}from"./main-CpTKYLW_.js";const f=async()=>{const s=await fetch(m("/api/stats"));if(!s.ok)throw new Error(`Failed to fetch stats: ${s.status}`);return s.json()},y=()=>{const[s,a]=o.useState(null),[t,x]=o.useState(!1);return o.useEffect(()=>{f().then(a).catch(()=>x(!0))},[]),{stats:s,loadFailed:t}},T=["open",...u],S={...h,open:"Open"},b={allowed:"success",warning:"warning",rejected:"error"},l=({title:s,children:a})=>e.jsx("div",{className:"flex-[1_1_260px] max-w-[360px] max-[480px]:flex-[1_1_100%] max-[480px]:max-w-none",children:e.jsx(j,{size:"small",texture:"kraft",className:"h-full",children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("span",{className:"font-handwritten text-xs font-semibold opacity-[0.55]",children:s}),a]})})}),n=({label:s,value:a})=>e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"opacity-70",children:s}),e.jsx("span",{className:"font-semibold",children:a})]}),C=({capacity:s})=>{const[a,t]=o.useState(()=>Date.now());return o.useEffect(()=>{const x=setInterval(()=>t(Date.now()),3e4);return()=>clearInterval(x)},[]),e.jsx(l,{title:"Claude capacity",children:s===null?e.jsx("p",{className:"opacity-50 m-0",children:"No agent run has reported capacity yet."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d,{size:"small",variant:b[g(s.snapshot.status)],children:s.snapshot.status}),s.snapshot.overage&&e.jsx(d,{size:"small",variant:"warning",children:"overage"})]}),s.snapshot.rateLimitType&&e.jsx(n,{label:"Window",value:s.snapshot.rateLimitType}),s.snapshot.resetsAt!==void 0&&e.jsx(n,{label:"Resets",value:new Date(v(s.snapshot.resetsAt)).toLocaleTimeString()}),e.jsxs("span",{className:"text-2xs opacity-50",children:["as of last agent run,"," ",p(Math.max(0,a-Date.parse(s.capturedAt)))," ago"]})]})})},L=({sourceLines:s,testLines:a})=>e.jsxs(l,{title:"Codebase size",children:[e.jsx(n,{label:"Source lines",value:s}),e.jsx(n,{label:"Test lines",value:a})]}),w=s=>`${Math.round(s*100)}%`,A=({comments:s})=>e.jsxs(l,{title:"Comment ratio",children:[e.jsx(i,{value:s.ratio*100,color:c.accentSlate}),e.jsx(n,{label:"Ratio",value:w(s.ratio)}),e.jsx(n,{label:"Comment lines",value:s.commentLines}),e.jsx(n,{label:"Source lines",value:s.sourceLines})]}),M=({entitiesByStatus:s})=>e.jsxs(l,{title:"Entities by status",children:[T.filter(a=>s[a]).map(a=>e.jsx(n,{label:S[a],value:s[a]},a)),Object.keys(s).length===0&&e.jsx("p",{className:"opacity-50 m-0",children:"No entities yet."})]}),E=({medianPhaseDurationMs:s})=>e.jsx(l,{title:"Median phase duration",children:s===null?e.jsx("p",{className:"opacity-50 m-0",children:"No phase runs recorded yet."}):e.jsx(n,{label:"Median",value:p(s)})}),k=({mostExpensiveIdeas:s})=>e.jsxs(l,{title:"Most expensive ideas",children:[s.length===0&&e.jsx("p",{className:"opacity-50 m-0",children:"No usage recorded yet."}),s.map(a=>e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx(n,{label:a.planId,value:`${r(a.inputTokens)} in · ${r(a.outputTokens)} out`}),e.jsx("span",{className:"text-2xs opacity-50 truncate",children:a.planTitle})]},a.planId))]}),P=({openQuestions:s,decisions:a})=>e.jsxs(l,{title:"Notes",children:[e.jsx(n,{label:"Open questions",value:s}),e.jsx(n,{label:"Decisions",value:a})]}),_=({tasksPerWeek:s})=>{const a=Math.max(1,...s.map(t=>t.count));return e.jsxs(l,{title:"Tasks per week",children:[s.length===0&&e.jsx("p",{className:"opacity-50 m-0",children:"No tasks run yet."}),s.map(t=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(n,{label:t.week,value:t.count}),e.jsx(i,{value:t.count,max:a,color:c.accentAmber,height:4})]},t.week))]})},D=({testCoveragePct:s})=>e.jsx(l,{title:"Test coverage",children:s===null?e.jsx("p",{className:"opacity-50 m-0",children:"Run `pnpm test` to generate a coverage report."}):e.jsxs(e.Fragment,{children:[e.jsx(i,{value:s,color:c.accentGreen}),e.jsx(n,{label:"Line coverage",value:`${Math.round(s)}%`})]})}),R=({usagePerWeek:s})=>{const a=Math.max(1,...s.map(t=>t.agentMinutes));return e.jsxs(l,{title:"Usage per week",children:[s.length===0&&e.jsx("p",{className:"opacity-50 m-0",children:"No usage recorded yet."}),s.map(t=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(n,{label:t.week,value:`${t.agentMinutes}m`}),e.jsx(i,{value:t.agentMinutes,max:a,color:c.accentAmber,height:4}),e.jsxs("span",{className:"text-2xs opacity-50",children:[r(t.inputTokens)," in · ",r(t.outputTokens)," out"]})]},t.week))]})},I=({stats:s})=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-start gap-2.5",children:[e.jsx(A,{comments:s.comments}),e.jsx(D,{testCoveragePct:s.testCoveragePct}),e.jsx(L,{sourceLines:s.comments.sourceLines,testLines:s.testLines}),e.jsx(M,{entitiesByStatus:s.entitiesByStatus}),e.jsx(P,{openQuestions:s.openQuestions,decisions:s.decisions}),e.jsx(_,{tasksPerWeek:s.tasksPerWeek}),e.jsx(R,{usagePerWeek:s.usagePerWeek}),e.jsx(E,{medianPhaseDurationMs:s.medianPhaseDurationMs}),e.jsx(k,{mostExpensiveIdeas:s.mostExpensiveIdeas}),e.jsx(C,{capacity:s.capacity})]}),e.jsxs("p",{className:"opacity-[0.4] text-2xs mt-6",children:["Generated ",new Date(s.generatedAt).toLocaleString()]})]}),U=()=>{const{stats:s,loadFailed:a}=y();return e.jsxs("div",{children:[e.jsx(N,{children:"Stats"}),e.jsx("p",{className:"opacity-50 mb-6",children:"A read-only look at project health — every number here is informational, none of them gate anything."}),a&&e.jsx("p",{className:"opacity-50",children:"Couldn't load stats."}),!a&&!s&&e.jsx("p",{className:"opacity-50",children:"Loading…"}),s&&e.jsx(I,{stats:s})]})};export{U as StatsPage};
2
+ //# sourceMappingURL=index-CbsAL0YR.js.map