Path-A task 3/5. Replaces the setTimeout mock that returned the literal "Full AI integration is coming soon!" string with a real streaming provider call. * apps/web/app/api/chat/route.ts (new): POST handler that runs the same auth + resolveWorkspace pipeline workspaceProcedure uses, then streams a response from streamText().toDataStreamResponse(). Maps resolveWorkspace's TRPCError codes to HTTP status (401/403/404/400). Returns a structured 503 with a human-readable hint when OPENAI_API_KEY is unset, so the misconfiguration is surfaced rather than masked by a fake stream. * apps/web/app/(app)/[workspaceSlug]/ai/page.tsx: replace the local message-state + setTimeout placeholder with useChat from @ai-sdk/react. workspace slug is sent on every request body so the server can enforce tenant scoping. Adds a ChatErrorBanner that parses the JSON error body the route emits and renders amber for the "unavailable" case, destructive for other failures. * apps/web/package.json: pull in @ai-sdk/react as a direct dep (previously only transitive via `ai`). The existing aiRouter.chat tRPC mutation is left intact — it powers the right-panel command palette via the non-streaming generateText path, and rebuilding that as streaming was outside the scope of making the dedicated chat page usable. Provider selection still flows from env per packages/ai conventions: OPENAI_API_KEY gates availability, OPENAI_BASE_URL lets operators route through Ollama on CT 108 transparently, OPENAI_MODEL overrides the default gpt-4o-mini. `pnpm lint && pnpm type-check` clean. Closes plans/Plan-daily-driver-finish/Epic-shipping-the-shell/ Task-wire-ai-chat-to-trpc.md. Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|---|---|---|
| .. | ||
| Plan-agent-coordination | ||
| Plan-daily-driver-finish | ||
| Plan-multitenant-cursor-sync | ||
| Plan-multitenant-saas-hardening | ||
| README.md | ||
Plans directory
Human- and agent-oriented backlog. Structure:
plans/
Plan-<plan-slug>/
Plan-<plan-slug>.md
Epic-<epic-slug>/
Epic-<epic-slug>.md
Task-<task-slug>.md
Task-<other-task>.md
- Slug: lowercase, hyphenated, stable across renames of display title when possible.
- Templates: copy from
docs/templates/. - Chunking: keep each Task small enough for one Cursor agent or subagent to own; use Epics for milestones that need several tasks.
See docs/Glossary.md and config/CursorSync.md.
Import to database: from the repo root, with DATABASE_URL and your workspace UUID:
pnpm --filter @tasks/database watch:markdown-backlog
Set MARKDOWN_BACKLOG_WORKSPACE_ID (and optionally MARKDOWN_BACKLOG_REPO_ROOT). This runs an initial sync and watches plans/ for changes.