diff --git a/dashboards/open-brain-dashboard-next/app/api/audit/delete/route.ts b/dashboards/open-brain-dashboard-next/app/api/audit/delete/route.ts index c87410ddd..7c4f2344f 100644 --- a/dashboards/open-brain-dashboard-next/app/api/audit/delete/route.ts +++ b/dashboards/open-brain-dashboard-next/app/api/audit/delete/route.ts @@ -14,7 +14,7 @@ export async function POST(request: NextRequest) { } try { - const { ids } = (await request.json()) as { ids: number[] }; + const { ids } = (await request.json()) as { ids: string[] }; if (!Array.isArray(ids) || ids.length === 0) { return NextResponse.json({ error: "No IDs provided" }, { status: 400 }); } diff --git a/dashboards/open-brain-dashboard-next/app/api/duplicates/resolve/route.ts b/dashboards/open-brain-dashboard-next/app/api/duplicates/resolve/route.ts index 4b352b4ab..e9d5556e6 100644 --- a/dashboards/open-brain-dashboard-next/app/api/duplicates/resolve/route.ts +++ b/dashboards/open-brain-dashboard-next/app/api/duplicates/resolve/route.ts @@ -15,8 +15,8 @@ export async function POST(request: NextRequest) { try { const { action, thought_id_a, thought_id_b } = (await request.json()) as { action: "keep_a" | "keep_b" | "keep_both"; - thought_id_a: number; - thought_id_b: number; + thought_id_a: string; + thought_id_b: string; }; if (!thought_id_a || !thought_id_b) { diff --git a/dashboards/open-brain-dashboard-next/app/api/kanban/delete/route.ts b/dashboards/open-brain-dashboard-next/app/api/kanban/delete/route.ts index cee605279..67bfe5626 100644 --- a/dashboards/open-brain-dashboard-next/app/api/kanban/delete/route.ts +++ b/dashboards/open-brain-dashboard-next/app/api/kanban/delete/route.ts @@ -16,9 +16,9 @@ export async function POST(request: NextRequest) { const body = await request.json(); const { thoughtId } = body; - if (!thoughtId || typeof thoughtId !== "number") { + if (!thoughtId || typeof thoughtId !== "string") { return NextResponse.json( - { error: "thoughtId (number) is required" }, + { error: "thoughtId (string) is required" }, { status: 400 } ); } diff --git a/dashboards/open-brain-dashboard-next/app/api/kanban/update/route.ts b/dashboards/open-brain-dashboard-next/app/api/kanban/update/route.ts index 532f69afe..658ca4b1f 100644 --- a/dashboards/open-brain-dashboard-next/app/api/kanban/update/route.ts +++ b/dashboards/open-brain-dashboard-next/app/api/kanban/update/route.ts @@ -25,9 +25,9 @@ export async function POST(request: NextRequest) { const body = await request.json(); const { thoughtId, status, importance, content, type } = body; - if (!thoughtId || typeof thoughtId !== "number") { + if (!thoughtId || typeof thoughtId !== "string") { return NextResponse.json( - { error: "thoughtId (number) is required" }, + { error: "thoughtId (string) is required" }, { status: 400 } ); } diff --git a/dashboards/open-brain-dashboard-next/app/audit/page.tsx b/dashboards/open-brain-dashboard-next/app/audit/page.tsx index 463eb4d10..9e227bb83 100644 --- a/dashboards/open-brain-dashboard-next/app/audit/page.tsx +++ b/dashboards/open-brain-dashboard-next/app/audit/page.tsx @@ -8,7 +8,7 @@ import type { Thought, BrowseResponse } from "@/lib/types"; export default function AuditPage() { const [data, setData] = useState(null); - const [selected, setSelected] = useState>(new Set()); + const [selected, setSelected] = useState>(new Set()); const [page, setPage] = useState(1); const [loading, setLoading] = useState(true); const [showDelete, setShowDelete] = useState(false); @@ -33,7 +33,7 @@ export default function AuditPage() { load(); }, [load]); - const toggleSelect = (id: number) => { + const toggleSelect = (id: string) => { setSelected((prev) => { const next = new Set(prev); if (next.has(id)) next.delete(id); diff --git a/dashboards/open-brain-dashboard-next/app/thoughts/[id]/page.tsx b/dashboards/open-brain-dashboard-next/app/thoughts/[id]/page.tsx index c23f1148d..f47228974 100644 --- a/dashboards/open-brain-dashboard-next/app/thoughts/[id]/page.tsx +++ b/dashboards/open-brain-dashboard-next/app/thoughts/[id]/page.tsx @@ -25,9 +25,7 @@ export default async function ThoughtDetailPage({ const { apiKey } = await requireSessionOrRedirect(); const session = await getSession(); const excludeRestricted = !session.restrictedUnlocked; - const { id } = await params; - const thoughtId = parseInt(id, 10); - if (isNaN(thoughtId)) notFound(); + const { id: thoughtId } = await params; let thought; try { diff --git a/dashboards/open-brain-dashboard-next/components/ConnectionsPanel.tsx b/dashboards/open-brain-dashboard-next/components/ConnectionsPanel.tsx index 8eaf4ad9f..fc720f909 100644 --- a/dashboards/open-brain-dashboard-next/components/ConnectionsPanel.tsx +++ b/dashboards/open-brain-dashboard-next/components/ConnectionsPanel.tsx @@ -6,7 +6,7 @@ import { TypeBadge } from "./ThoughtCard"; import { FormattedDate } from "./FormattedDate"; interface Connection { - id: number; + id: string; type: string; importance: number; preview: string; @@ -23,7 +23,7 @@ export function ConnectionsPanel({ thoughtId, hasMetadata, }: { - thoughtId: number; + thoughtId: string; hasMetadata: boolean; }) { const [connections, setConnections] = useState([]); diff --git a/dashboards/open-brain-dashboard-next/components/KanbanBoard.tsx b/dashboards/open-brain-dashboard-next/components/KanbanBoard.tsx index 8026fc6ac..712794eb0 100644 --- a/dashboards/open-brain-dashboard-next/components/KanbanBoard.tsx +++ b/dashboards/open-brain-dashboard-next/components/KanbanBoard.tsx @@ -20,7 +20,7 @@ import { KanbanCardModal } from "@/components/KanbanCardModal"; const AUTO_ARCHIVE_DAYS = 30; async function apiUpdateKanban( - thoughtId: number, + thoughtId: string, updates: Record ): Promise { const res = await fetch("/api/kanban/update", { @@ -112,7 +112,7 @@ export function KanbanBoard() { const { active, over } = event; if (!over) return; - const thoughtId = active.id as number; + const thoughtId = active.id as string; const newStatus = over.id as string; // Find which column the thought is currently in @@ -138,7 +138,7 @@ export function KanbanBoard() { }); } - async function handlePriorityChange(thoughtId: number, newImportance: number) { + async function handlePriorityChange(thoughtId: string, newImportance: number) { previousThoughts.current = [...thoughts]; setThoughts((prev) => prev.map((t) => @@ -155,7 +155,7 @@ export function KanbanBoard() { } } - async function handleArchive(thoughtId: number) { + async function handleArchive(thoughtId: string) { previousThoughts.current = [...thoughts]; setThoughts((prev) => prev.map((t) => @@ -174,7 +174,7 @@ export function KanbanBoard() { } } - async function handleDelete(thoughtId: number) { + async function handleDelete(thoughtId: string) { previousThoughts.current = [...thoughts]; setThoughts((prev) => prev.filter((t) => t.id !== thoughtId)); @@ -193,7 +193,7 @@ export function KanbanBoard() { } async function handleModalSave( - thoughtId: number, + thoughtId: string, updates: Record ) { previousThoughts.current = [...thoughts]; diff --git a/dashboards/open-brain-dashboard-next/components/KanbanCard.tsx b/dashboards/open-brain-dashboard-next/components/KanbanCard.tsx index 20edf1f12..d76ebfa56 100644 --- a/dashboards/open-brain-dashboard-next/components/KanbanCard.tsx +++ b/dashboards/open-brain-dashboard-next/components/KanbanCard.tsx @@ -20,9 +20,9 @@ function formatAge(dateString: string): string { interface KanbanCardProps { thought: Thought; onCardClick: (thought: Thought) => void; - onPriorityChange: (thoughtId: number, importance: number) => void; + onPriorityChange: (thoughtId: string, importance: number) => void; showArchiveButton?: boolean; - onArchive?: (thoughtId: number) => void; + onArchive?: (thoughtId: string) => void; } export function KanbanCard({ diff --git a/dashboards/open-brain-dashboard-next/components/KanbanCardModal.tsx b/dashboards/open-brain-dashboard-next/components/KanbanCardModal.tsx index 5042919da..b471793e6 100644 --- a/dashboards/open-brain-dashboard-next/components/KanbanCardModal.tsx +++ b/dashboards/open-brain-dashboard-next/components/KanbanCardModal.tsx @@ -8,11 +8,11 @@ import { KANBAN_STATUSES, KANBAN_LABELS, PRIORITY_LEVELS, getPriorityLevel, THOU interface KanbanCardModalProps { thought: Thought; onSave: ( - thoughtId: number, + thoughtId: string, updates: { content?: string; status?: string; importance?: number; type?: string } ) => void; - onArchive: (thoughtId: number) => void; - onDelete: (thoughtId: number) => void; + onArchive: (thoughtId: string) => void; + onDelete: (thoughtId: string) => void; onClose: () => void; } diff --git a/dashboards/open-brain-dashboard-next/components/KanbanColumn.tsx b/dashboards/open-brain-dashboard-next/components/KanbanColumn.tsx index 3195418a7..48a545081 100644 --- a/dashboards/open-brain-dashboard-next/components/KanbanColumn.tsx +++ b/dashboards/open-brain-dashboard-next/components/KanbanColumn.tsx @@ -24,8 +24,8 @@ interface KanbanColumnProps { status: string; thoughts: Thought[]; onCardClick: (thought: Thought) => void; - onPriorityChange: (thoughtId: number, importance: number) => void; - onArchive: (thoughtId: number) => void; + onPriorityChange: (thoughtId: string, importance: number) => void; + onArchive: (thoughtId: string) => void; } export function KanbanColumn({ diff --git a/dashboards/open-brain-dashboard-next/components/ReflectionComposer.tsx b/dashboards/open-brain-dashboard-next/components/ReflectionComposer.tsx index 4fb3e9e39..5e425e416 100644 --- a/dashboards/open-brain-dashboard-next/components/ReflectionComposer.tsx +++ b/dashboards/open-brain-dashboard-next/components/ReflectionComposer.tsx @@ -23,7 +23,7 @@ const emptyForm: ReflectionInput = { reflection_type: "decision_trace", }; -export function ReflectionComposer({ thoughtId }: { thoughtId: number }) { +export function ReflectionComposer({ thoughtId }: { thoughtId: string }) { const [open, setOpen] = useState(false); const [form, setForm] = useState({ ...emptyForm }); const [submitting, setSubmitting] = useState(false); diff --git a/dashboards/open-brain-dashboard-next/lib/api.ts b/dashboards/open-brain-dashboard-next/lib/api.ts index 846a1200e..3bc7c1dc7 100644 --- a/dashboards/open-brain-dashboard-next/lib/api.ts +++ b/dashboards/open-brain-dashboard-next/lib/api.ts @@ -73,7 +73,7 @@ export async function fetchThoughts( export async function fetchThought( apiKey: string, - id: number, + id: string, excludeRestricted: boolean = true ): Promise { const qs = excludeRestricted ? "" : "?exclude_restricted=false"; @@ -82,10 +82,10 @@ export async function fetchThought( export async function updateThought( apiKey: string, - id: number, + id: string, data: { content?: string; type?: string; importance?: number; status?: string | null } -): Promise<{ id: number; action: string; message: string }> { - return apiFetch<{ id: number; action: string; message: string }>( +): Promise<{ id: string; action: string; message: string }> { + return apiFetch<{ id: string; action: string; message: string }>( apiKey, `/thought/${id}`, { @@ -136,7 +136,7 @@ export async function fetchDuplicates( export async function deleteThought( apiKey: string, - id: number + id: string ): Promise { const url = `${API_URL}/thought/${id}`; const res = await fetch(url, { @@ -186,7 +186,7 @@ export async function fetchStats( } export interface CaptureResult { - thought_id: number; + thought_id: string; action: string; type: string; sensitivity_tier: string; @@ -206,7 +206,7 @@ export async function captureThought( export async function fetchReflections( apiKey: string, - thoughtId: number + thoughtId: string ): Promise { const data = await apiFetch<{ reflections: Reflection[] }>( apiKey, diff --git a/dashboards/open-brain-dashboard-next/lib/types.ts b/dashboards/open-brain-dashboard-next/lib/types.ts index f58a1cbe2..4bf8c5f58 100644 --- a/dashboards/open-brain-dashboard-next/lib/types.ts +++ b/dashboards/open-brain-dashboard-next/lib/types.ts @@ -1,5 +1,5 @@ export interface Thought { - id: number; + id: string; uuid?: string; content: string; type: string; @@ -65,7 +65,7 @@ export function getPriorityLevel(importance: number) { export interface Reflection { id: number; - thought_id: number; + thought_id: string; trigger_context: string; options: unknown[]; factors: unknown[]; @@ -104,8 +104,8 @@ export interface StatsResponse { } export interface DuplicatePair { - thought_id_a: number; - thought_id_b: number; + thought_id_a: string; + thought_id_b: string; similarity: number; content_a: string; content_b: string; @@ -163,7 +163,7 @@ export type AddToBrainMode = "auto" | "single" | "extract"; export interface AddToBrainResult { path: "single" | "extract"; - thought_id?: number; + thought_id?: string; job_id?: number; type?: string; status?: string;