Local-first knowledge management system with BYO API keys. Features: - 3-panel UI (Nodes | Focus | Helpers) - SQLite + sqlite-vec for vector search - Agent system (Easy/Hard mode orchestrators) - Content extraction (YouTube, PDF, web) - Integrate workflow for connection discovery - Dimension system with auto-assignment Tech stack: - Next.js 15 + TypeScript + Tailwind CSS - Anthropic (Claude) + OpenAI (GPT) via Vercel AI SDK Setup: npm install && npm rebuild better-sqlite3 scripts/dev/bootstrap-local.sh npm run dev MIT License
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import { NextRequest, NextResponse } from 'next/server';
|
|
import { AgentDelegationService } from '@/services/agents/delegation';
|
|
|
|
export async function POST(
|
|
request: NextRequest,
|
|
{ params }: { params: Promise<{ sessionId: string }> }
|
|
) {
|
|
try {
|
|
const { sessionId } = await params;
|
|
const body = await request.json();
|
|
const summary: string | undefined = body?.summary;
|
|
const status: string | undefined = body?.status;
|
|
|
|
if (!summary) {
|
|
return NextResponse.json({ error: 'Summary is required' }, { status: 400 });
|
|
}
|
|
|
|
const normalizedStatus = status && ['queued', 'in_progress', 'completed', 'failed'].includes(status)
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
? (status as any)
|
|
: 'completed';
|
|
|
|
const delegation = AgentDelegationService.completeDelegation(sessionId, summary, normalizedStatus);
|
|
if (!delegation) {
|
|
return NextResponse.json({ error: 'Delegation not found' }, { status: 404 });
|
|
}
|
|
|
|
return NextResponse.json({ delegation });
|
|
} catch (error) {
|
|
console.error('Failed to store delegation summary:', error);
|
|
return NextResponse.json({ error: 'Failed to store delegation summary' }, { status: 500 });
|
|
}
|
|
}
|