oneie 2.0.1 → 2.0.3
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.
- package/AGENTS.md +245 -0
- package/CLAUDE.md +534 -0
- package/README.md +61 -4
- package/one/.obsidian/app.json +1 -0
- package/one/.obsidian/appearance.json +1 -0
- package/one/.obsidian/core-plugins.json +33 -0
- package/one/.obsidian/workspace.json +211 -0
- package/one/connections/a2a.md +551 -0
- package/one/connections/acp.md +761 -0
- package/one/connections/acps.md +731 -0
- package/one/connections/agui.md +767 -0
- package/one/connections/any-backend.md +1702 -0
- package/one/connections/ap2.md +998 -0
- package/one/connections/api-docs.md +1891 -0
- package/one/connections/api.md +2190 -0
- package/one/connections/architecture-diagram.md +94 -0
- package/one/connections/communications.md +449 -0
- package/one/connections/connections.md +339 -0
- package/one/connections/cryptonetworks.md +781 -0
- package/one/connections/documentation.md +1120 -0
- package/one/connections/effect.md +279 -0
- package/one/connections/elizaos.md +1290 -0
- package/one/connections/inference.md +58 -0
- package/one/connections/kyc.md +632 -0
- package/one/connections/mcp.md +842 -0
- package/one/connections/membership.md +1152 -0
- package/one/connections/middleware.md +1067 -0
- package/one/connections/multitenant.md +1341 -0
- package/one/connections/n8n.md +1015 -0
- package/one/connections/patterns.md +89 -0
- package/one/connections/protocols.md +279 -0
- package/one/connections/relationships.md +107 -0
- package/one/connections/schema.md +587 -0
- package/one/connections/service-layer.md +550 -0
- package/one/connections/structure.md +0 -0
- package/one/connections/vectors.md +207 -0
- package/one/connections/wordpress.md +1302 -0
- package/one/connections/workflow-copy.md +905 -0
- package/one/connections/workflow-examples.md +741 -0
- package/one/connections/workflow.md +905 -0
- package/one/connections/workflows/delegation.md +885 -0
- package/one/connections/workflows/frontend.md +1037 -0
- package/one/connections/workflows/strategy.md +903 -0
- package/one/connections/workflows/tasks.md +698 -0
- package/one/connections/x402.md +1249 -0
- package/one/events/events.md +545 -0
- package/one/knowledge/ai-platform.md +305 -0
- package/one/knowledge/architecture-diagram.md +94 -0
- package/one/knowledge/architecture-frontend.md +930 -0
- package/one/knowledge/architecture.md +2077 -0
- package/one/knowledge/crypto.md +960 -0
- package/one/knowledge/dsl.md +1660 -0
- package/one/knowledge/files.md +2471 -0
- package/one/knowledge/frontend.md +1038 -0
- package/one/knowledge/hono.md +2109 -0
- package/one/knowledge/implementation-examples.md +2536 -0
- package/one/knowledge/inference-score.md +159 -0
- package/one/knowledge/knowledge.md +642 -0
- package/one/knowledge/language.md +980 -0
- package/one/knowledge/lessons-learned.md +70 -0
- package/one/knowledge/ontology-6-dimensions.md +0 -0
- package/one/knowledge/ontology-documentation.md +356 -0
- package/one/knowledge/ontology-engineering-specification.md +1292 -0
- package/one/knowledge/ontology-engineering.md +1652 -0
- package/one/knowledge/ontology-frontend-copy-2.md +1492 -0
- package/one/knowledge/ontology-frontend-copy.md +753 -0
- package/one/knowledge/ontology-frontend-specifications.md +2188 -0
- package/one/knowledge/ontology-frontend.md +2427 -0
- package/one/knowledge/ontology-minimal.yaml +299 -0
- package/one/knowledge/ontology.md +2819 -0
- package/one/knowledge/ontology.yaml +1165 -0
- package/one/knowledge/patterns/backend/convex-mutation-pattern.md +100 -0
- package/one/knowledge/patterns/backend/convex-query-pattern.md +88 -0
- package/one/knowledge/patterns/backend/mutation-template.md +231 -0
- package/one/knowledge/patterns/backend/query-template.md +267 -0
- package/one/knowledge/patterns/backend/service-template.md +237 -0
- package/one/knowledge/patterns/design/component-architecture.md +399 -0
- package/one/knowledge/patterns/design/test-driven-design-pattern.md +162 -0
- package/one/knowledge/patterns/design/wireframe-template.md +216 -0
- package/one/knowledge/patterns/frontend/component-template.md +195 -0
- package/one/knowledge/patterns/frontend/form-template.md +276 -0
- package/one/knowledge/patterns/frontend/page-template.md +178 -0
- package/one/knowledge/patterns/frontend/react-component-pattern.md +128 -0
- package/one/knowledge/patterns/test/acceptance-criteria-template.md +378 -0
- package/one/knowledge/patterns/test/technical-test-template.md +544 -0
- package/one/knowledge/patterns/test/test-driven-pattern.md +140 -0
- package/one/knowledge/patterns/test/user-flow-template.md +254 -0
- package/one/knowledge/quality-loop.md +401 -0
- package/one/knowledge/readme.md +131 -0
- package/one/knowledge/rules.md +626 -0
- package/one/knowledge/score.md +67 -0
- package/one/knowledge/specifications.md +855 -0
- package/one/knowledge/tags.md +130 -0
- package/one/organisation/one.md +599 -0
- package/one/organisation/organisation.md +438 -0
- package/one/organisation/revenue.md +673 -0
- package/one/organisation/strategy.md +869 -0
- package/one/organisation/vision.md +98 -0
- package/one/people/anthony-o-connell.md +440 -0
- package/one/people/people.md +567 -0
- package/one/repomix-output.md +92634 -0
- package/one/things/agentkit.md +349 -0
- package/one/things/agents/agent-backend.md +1401 -0
- package/one/things/agents/agent-builder.md +955 -0
- package/one/things/agents/agent-clean.md +709 -0
- package/one/things/agents/agent-clone.md +1341 -0
- package/one/things/agents/agent-designer.md +2177 -0
- package/one/things/agents/agent-director.md +1508 -0
- package/one/things/agents/agent-documenter.md +1049 -0
- package/one/things/agents/agent-frontend.md +1119 -0
- package/one/things/agents/agent-integrator.md +1192 -0
- package/one/things/agents/agent-problem-solver.md +1379 -0
- package/one/things/agents/agent-quality.md +1353 -0
- package/one/things/agents/agent-sales.md +986 -0
- package/one/things/cascade/cascade.yaml +464 -0
- package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +470 -0
- package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +264 -0
- package/one/things/cascade/docs/examples/1-1-agent-prompts.md +486 -0
- package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +497 -0
- package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +227 -0
- package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +516 -0
- package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +544 -0
- package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +223 -0
- package/one/things/cascade/docs/examples/1-3-event-coordination.md +508 -0
- package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +609 -0
- package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +195 -0
- package/one/things/cascade/docs/examples/1-4-knowledge-management.md +577 -0
- package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +797 -0
- package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +212 -0
- package/one/things/cascade/docs/examples/1-5-quality-loops.md +641 -0
- package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +610 -0
- package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +213 -0
- package/one/things/cascade/docs/examples/1-6-numbering-structure.md +575 -0
- package/one/things/cascade/docs/examples/readme.md +222 -0
- package/one/things/cascade/docs/getting-started.md +515 -0
- package/one/things/cascade/docs/workflow.md +1372 -0
- package/one/things/cascade/readme.md +336 -0
- package/one/things/cascade/templates/feature-template.md +267 -0
- package/one/things/claude/agents/advocacy-activation-manager.md +685 -0
- package/one/things/claude/agents/advocacy-campaign-designer.md +663 -0
- package/one/things/claude/agents/analyst.md +483 -0
- package/one/things/claude/agents/architect.md +480 -0
- package/one/things/claude/agents/brand-identity-specialist.md +513 -0
- package/one/things/claude/agents/bstp-token-strategist.md +667 -0
- package/one/things/claude/agents/builder-repo.md +489 -0
- package/one/things/claude/agents/bullstamp-community-builder.md +574 -0
- package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +506 -0
- package/one/things/claude/agents/bulltilt-platform-growth.md +567 -0
- package/one/things/claude/agents/company-bullstamp-character.md +587 -0
- package/one/things/claude/agents/company-bullstamp-community.md +292 -0
- package/one/things/claude/agents/company-bullstamp-marketing.md +292 -0
- package/one/things/claude/agents/company-bullstamp-token.md +292 -0
- package/one/things/claude/agents/company-bulltilt-growth.md +292 -0
- package/one/things/claude/agents/content-bibliography-formatter.md +381 -0
- package/one/things/claude/agents/content-calendar-planner.md +448 -0
- package/one/things/claude/agents/content-chapter-formatter.md +488 -0
- package/one/things/claude/agents/content-formatter.md +546 -0
- package/one/things/claude/agents/content-hook-specialist.md +462 -0
- package/one/things/claude/agents/content-image-formatter.md +535 -0
- package/one/things/claude/agents/content-introduction-formatter.md +485 -0
- package/one/things/claude/agents/content-multiplication-engine.md +556 -0
- package/one/things/claude/agents/content-playbook-writer.md +448 -0
- package/one/things/claude/agents/content-team-manager.md +622 -0
- package/one/things/claude/agents/content-toc-formatter.md +522 -0
- package/one/things/claude/agents/convex-backend-specialist.md +2561 -0
- package/one/things/claude/agents/core-manager.md +582 -0
- package/one/things/claude/agents/core-master.md +403 -0
- package/one/things/claude/agents/cross-functional-manager.md +471 -0
- package/one/things/claude/agents/crypto-airdrop-strategist.md +602 -0
- package/one/things/claude/agents/crypto-analytics-educator.md +553 -0
- package/one/things/claude/agents/crypto-architecture-specialist.md +466 -0
- package/one/things/claude/agents/crypto-community-analyst.md +298 -0
- package/one/things/claude/agents/crypto-community-psychologist.md +509 -0
- package/one/things/claude/agents/crypto-dex-optimization-expert.md +538 -0
- package/one/things/claude/agents/crypto-dex-optimizer.md +292 -0
- package/one/things/claude/agents/crypto-diamond-formation-specialist.md +513 -0
- package/one/things/claude/agents/crypto-diamond-hands.md +292 -0
- package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +554 -0
- package/one/things/claude/agents/crypto-engagement-specialist.md +540 -0
- package/one/things/claude/agents/crypto-market-researcher.md +292 -0
- package/one/things/claude/agents/crypto-marketing-orchestrator.md +523 -0
- package/one/things/claude/agents/crypto-network-effect-amplifier.md +569 -0
- package/one/things/claude/agents/crypto-optimization-analyst.md +554 -0
- package/one/things/claude/agents/crypto-strategic-synthesizer.md +517 -0
- package/one/things/claude/agents/crypto-team-manager.md +387 -0
- package/one/things/claude/agents/crypto-token-analyst.md +278 -0
- package/one/things/claude/agents/crypto-viral-content-creator.md +546 -0
- package/one/things/claude/agents/crypto-wallet-identification-expert.md +517 -0
- package/one/things/claude/agents/crypto-wallet-identifier.md +292 -0
- package/one/things/claude/agents/customer-journey-designer.md +481 -0
- package/one/things/claude/agents/customer-success-manager.md +581 -0
- package/one/things/claude/agents/dev.md +413 -0
- package/one/things/claude/agents/documenter.md +546 -0
- package/one/things/claude/agents/elevate-marketing-orchestrator.md +410 -0
- package/one/things/claude/agents/engagement-specialist.md +509 -0
- package/one/things/claude/agents/engineering-architect.md +387 -0
- package/one/things/claude/agents/engineering-business-analyst.md +537 -0
- package/one/things/claude/agents/engineering-developer.md +387 -0
- package/one/things/claude/agents/engineering-director.md +282 -0
- package/one/things/claude/agents/engineering-ingestor.md +649 -0
- package/one/things/claude/agents/engineering-product-manager.md +537 -0
- package/one/things/claude/agents/engineering-product-owner.md +537 -0
- package/one/things/claude/agents/engineering-project-coordinator.md +537 -0
- package/one/things/claude/agents/engineering-quality-assurance.md +393 -0
- package/one/things/claude/agents/engineering-team-manager.md +512 -0
- package/one/things/claude/agents/engineering-user-experience.md +387 -0
- package/one/things/claude/agents/framework-elevate-manager.md +294 -0
- package/one/things/claude/agents/improver.md +763 -0
- package/one/things/claude/agents/intelligence-team-manager.md +385 -0
- package/one/things/claude/agents/lead-capture-expert.md +466 -0
- package/one/things/claude/agents/lead-magnet-creator.md +453 -0
- package/one/things/claude/agents/market-research-analyst.md +412 -0
- package/one/things/claude/agents/marketing-brand-identity.md +314 -0
- package/one/things/claude/agents/marketing-content-hooks.md +450 -0
- package/one/things/claude/agents/marketing-content-multiplier.md +326 -0
- package/one/things/claude/agents/marketing-content-poster.md +361 -0
- package/one/things/claude/agents/marketing-customer-journey.md +326 -0
- package/one/things/claude/agents/marketing-director.md +397 -0
- package/one/things/claude/agents/marketing-engagement.md +326 -0
- package/one/things/claude/agents/marketing-lead-capture.md +326 -0
- package/one/things/claude/agents/marketing-lead-magnet.md +326 -0
- package/one/things/claude/agents/marketing-network-effects.md +326 -0
- package/one/things/claude/agents/marketing-nurture-campaigns.md +326 -0
- package/one/things/claude/agents/marketing-share-optimizer.md +326 -0
- package/one/things/claude/agents/marketing-team-manager.md +446 -0
- package/one/things/claude/agents/marketing-viral-growth.md +201 -0
- package/one/things/claude/agents/mission-commander.md +373 -0
- package/one/things/claude/agents/network-effect-analyst.md +587 -0
- package/one/things/claude/agents/nextjs-15-specialist.md +1547 -0
- package/one/things/claude/agents/npx.md +890 -0
- package/one/things/claude/agents/nurture-campaign-manager.md +531 -0
- package/one/things/claude/agents/one-master.md +355 -0
- package/one/things/claude/agents/one-orchestrator.md +315 -0
- package/one/things/claude/agents/one.md +601 -0
- package/one/things/claude/agents/playbook-generator.md +503 -0
- package/one/things/claude/agents/pm.md +326 -0
- package/one/things/claude/agents/po.md +345 -0
- package/one/things/claude/agents/qa.md +336 -0
- package/one/things/claude/agents/research-foundation-analyst.md +307 -0
- package/one/things/claude/agents/research-intelligence-gatherer.md +408 -0
- package/one/things/claude/agents/research-market-analyst.md +307 -0
- package/one/things/claude/agents/research-team-manager.md +482 -0
- package/one/things/claude/agents/sales-environment-optimizer.md +494 -0
- package/one/things/claude/agents/sales-team-manager.md +400 -0
- package/one/things/claude/agents/sales-upsell-strategist.md +307 -0
- package/one/things/claude/agents/service-advocacy-campaigns.md +307 -0
- package/one/things/claude/agents/service-advocacy-manager.md +307 -0
- package/one/things/claude/agents/service-success-manager.md +307 -0
- package/one/things/claude/agents/service-team-manager.md +400 -0
- package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +2302 -0
- package/one/things/claude/agents/share-optimization-specialist.md +551 -0
- package/one/things/claude/agents/sm.md +327 -0
- package/one/things/claude/agents/story-teller.md +473 -0
- package/one/things/claude/agents/task-master.md +596 -0
- package/one/things/claude/agents/tauri-cross-platform-specialist.md +1827 -0
- package/one/things/claude/agents/tester.md +556 -0
- package/one/things/claude/agents/the-bull-character-manager.md +580 -0
- package/one/things/claude/agents/tools-playbook-generator.md +489 -0
- package/one/things/claude/agents/turbo-repo-builder.md +316 -0
- package/one/things/claude/agents/upsell-strategist.md +480 -0
- package/one/things/claude/agents/ux-expert.md +335 -0
- package/one/things/claude/agents/viral-growth-orchestrator.md +497 -0
- package/one/things/claude/claude-code-hooks-development.json +21 -0
- package/one/things/claude/claude-code-hooks-production.json +21 -0
- package/one/things/claude/claude-code-hooks.json +25 -0
- package/one/things/claude/commands/agent.md +104 -0
- package/one/things/claude/commands/cascade-status.md +128 -0
- package/one/things/claude/commands/ingest.md +290 -0
- package/one/things/claude/commands/ingestor.md +136 -0
- package/one/things/claude/commands/mission.md +83 -0
- package/one/things/claude/commands/npx.md +133 -0
- package/one/things/claude/commands/one.md +440 -0
- package/one/things/claude/commands/quality-check.md +204 -0
- package/one/things/claude/commands/smart-route.md +220 -0
- package/one/things/claude/commands/start.md +121 -0
- package/one/things/claude/commands/story.md +83 -0
- package/one/things/claude/commands/task.md +173 -0
- package/one/things/claude/hook-bypass.json +32 -0
- package/one/things/claude/hooks/agent-hook-config.json +427 -0
- package/one/things/claude/hooks/agent-hook-manager.js +525 -0
- package/one/things/claude/hooks/agent-load-balancer.js +271 -0
- package/one/things/claude/hooks/agent-request-interceptor.js +70 -0
- package/one/things/claude/hooks/build-hook.sh +156 -0
- package/one/things/claude/hooks/cascade-feedback.js +297 -0
- package/one/things/claude/hooks/cascade-integration-hooks.js +648 -0
- package/one/things/claude/hooks/cleanup-hook.sh +201 -0
- package/one/things/claude/hooks/continuous-improvement-monitor.js +510 -0
- package/one/things/claude/hooks/file-organization-engine.js +427 -0
- package/one/things/claude/hooks/file-organization-hook.sh +80 -0
- package/one/things/claude/hooks/file-organization-monitor.js +269 -0
- package/one/things/claude/hooks/format-hook.sh +43 -0
- package/one/things/claude/hooks/hook-bypass.sh +293 -0
- package/one/things/claude/hooks/hook-config-manager.js +202 -0
- package/one/things/claude/hooks/hook-debouncer.sh +62 -0
- package/one/things/claude/hooks/hook-logger.sh +89 -0
- package/one/things/claude/hooks/hook-orchestrator.js +662 -0
- package/one/things/claude/hooks/hook-performance-report.js +120 -0
- package/one/things/claude/hooks/lint-hook.sh +140 -0
- package/one/things/claude/hooks/mcp-cascade-integration.js +816 -0
- package/one/things/claude/hooks/memory-optimizer.js +510 -0
- package/one/things/claude/hooks/notification-hook.sh +204 -0
- package/one/things/claude/hooks/ontology-compliance.js +394 -0
- package/one/things/claude/hooks/ontology-hook-manager.js +316 -0
- package/one/things/claude/hooks/ontology-validation-engine.js +317 -0
- package/one/things/claude/hooks/ontology-validation-hook.sh +86 -0
- package/one/things/claude/hooks/performance-metrics.json +25 -0
- package/one/things/claude/hooks/performance-monitoring-hook.js +422 -0
- package/one/things/claude/hooks/quality-scoring-engine.js +834 -0
- package/one/things/claude/hooks/security-hook.sh +256 -0
- package/one/things/claude/hooks/simple-load-balancer.js +238 -0
- package/one/things/claude/hooks/startup-optimizer.js +625 -0
- package/one/things/claude/hooks/story-scoring-system.js +445 -0
- package/one/things/claude/hooks/story-validation-engine.js +473 -0
- package/one/things/claude/hooks/story-validation-hook-enhanced.sh +210 -0
- package/one/things/claude/hooks/story-validation-hook.sh +145 -0
- package/one/things/claude/hooks/structure-synchronizer.js +194 -0
- package/one/things/claude/hooks/sub-agent-output-validator.js +647 -0
- package/one/things/claude/hooks/sub-agent-validation-hook.js +343 -0
- package/one/things/claude/hooks/test-hook.sh +145 -0
- package/one/things/claude/hooks/test-story-validation.sh +170 -0
- package/one/things/claude/hooks/trinity-validation-system.js +392 -0
- package/one/things/claude/settings-local.json +86 -0
- package/one/things/cli-code.md +652 -0
- package/one/things/cli-compiler-code.md +652 -0
- package/one/things/cli.md +1045 -0
- package/one/things/components/card-shadcn.md +929 -0
- package/one/things/components/card.md +1050 -0
- package/one/things/components.md +1669 -0
- package/one/things/componets.md +4 -0
- package/one/things/copilotkit.md +1559 -0
- package/one/things/creator-diagram.md +166 -0
- package/one/things/examples/children/lemonade-stand.md +366 -0
- package/one/things/examples/enterprise/crm-saas.md +1429 -0
- package/one/things/features/1-1-agent-prompts/design.md +470 -0
- package/one/things/features/1-1-agent-prompts/tests.md +264 -0
- package/one/things/features/1-1-agent-prompts.md +486 -0
- package/one/things/features/1-2-yaml-orchestrator/design.md +497 -0
- package/one/things/features/1-2-yaml-orchestrator/tests.md +227 -0
- package/one/things/features/1-2-yaml-orchestrator.md +516 -0
- package/one/things/features/1-3-event-coordination/design.md +544 -0
- package/one/things/features/1-3-event-coordination/tests.md +223 -0
- package/one/things/features/1-3-event-coordination.md +508 -0
- package/one/things/features/1-4-knowledge-management/design.md +609 -0
- package/one/things/features/1-4-knowledge-management/tests.md +195 -0
- package/one/things/features/1-4-knowledge-management.md +577 -0
- package/one/things/features/1-5-quality-loops/design.md +797 -0
- package/one/things/features/1-5-quality-loops/tests.md +212 -0
- package/one/things/features/1-5-quality-loops.md +641 -0
- package/one/things/features/1-6-numbering-structure/design.md +610 -0
- package/one/things/features/1-6-numbering-structure/tests.md +213 -0
- package/one/things/features/1-6-numbering-structure.md +575 -0
- package/one/things/features/2-cli.md +1235 -0
- package/one/things/features/use-one-backend.md +1180 -0
- package/one/things/ideas/1-create-workflow.md +189 -0
- package/one/things/plans/1-create-workflow-status.md +555 -0
- package/one/things/plans/1-create-workflow.md +713 -0
- package/one/things/plans/app.md +761 -0
- package/one/things/plans/better-auth-any-backend-revised.md +1065 -0
- package/one/things/plans/better-auth-any-backend.md +1852 -0
- package/one/things/plans/better-auth-available-features.md +235 -0
- package/one/things/plans/big-plan.md +38 -0
- package/one/things/plans/convex-better-auth.md +1109 -0
- package/one/things/plans/convex-on-off.md +389 -0
- package/one/things/plans/desktop.md +1121 -0
- package/one/things/plans/effect-components.md +1669 -0
- package/one/things/plans/effect.md +973 -0
- package/one/things/plans/email.md +953 -0
- package/one/things/plans/enhance-auth.md +1669 -0
- package/one/things/plans/install-components.md +198 -0
- package/one/things/plans/landing.md +728 -0
- package/one/things/plans/layout.md +205 -0
- package/one/things/plans/mail-backend.md +1308 -0
- package/one/things/plans/mail.md +2624 -0
- package/one/things/plans/next-features.md +83 -0
- package/one/things/plans/one.md +658 -0
- package/one/things/plans/ontology-6-dimensions.md +2216 -0
- package/one/things/plans/ontology-driven-strategy.md +866 -0
- package/one/things/plans/ontology-ui-approach.md +357 -0
- package/one/things/plans/open-agent.md +785 -0
- package/one/things/plans/performace.md +90 -0
- package/one/things/plans/releases.md +809 -0
- package/one/things/plans/repos.md +76 -0
- package/one/things/plans/separate-copy-2.md +1293 -0
- package/one/things/plans/separate-copy-3.md +2458 -0
- package/one/things/plans/separate-copy.md +1293 -0
- package/one/things/plans/separate.md +1983 -0
- package/one/things/plans/shadcn-integration-summary.md +450 -0
- package/one/things/plans/sidebar.md +172 -0
- package/one/things/plans/small-fixes.md +5 -0
- package/one/things/plans/test-backend-connection.md +476 -0
- package/one/things/plans/workflow-files.md +1196 -0
- package/one/things/plans/workflow.md +1372 -0
- package/one/things/products/cascade-landing-page.md +737 -0
- package/one/things/products/cascade.md +1518 -0
- package/one/things/products/context-engineering.md +1427 -0
- package/one/things/products/onthology.md +0 -0
- package/one/things/products/ontology-ui-shadcn.md +1280 -0
- package/one/things/products/ontology-ui.md +1387 -0
- package/one/things/products/ontology.md +717 -0
- package/one/things/products/sdk.md +557 -0
- package/one/things/promptkit.md +903 -0
- package/one/things/service-providers-new.md +982 -0
- package/one/things/service-providers.md +1092 -0
- package/one/things/things.md +349 -0
- package/one/things/todo.md +1248 -0
- package/package.json +5 -2
|
@@ -0,0 +1,903 @@
|
|
|
1
|
+
# Prompt Kit Integration Guide
|
|
2
|
+
|
|
3
|
+
Comprehensive documentation for integrating [Prompt Kit](https://www.prompt-kit.com/) components with **Vercel AI SDK 5** in this Astro + React project.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
**Prompt Kit** is a collection of high-quality, customizable React components specifically designed for AI applications. Built on top of shadcn/ui, it provides production-ready UI components for chat interfaces, AI agents, and autonomous assistants.
|
|
8
|
+
|
|
9
|
+
**Tech Stack:**
|
|
10
|
+
- React 19+
|
|
11
|
+
- shadcn/ui
|
|
12
|
+
- Tailwind CSS v4
|
|
13
|
+
- Vercel AI SDK 5
|
|
14
|
+
- TypeScript
|
|
15
|
+
|
|
16
|
+
**GitHub:** [ibelick/prompt-kit](https://github.com/ibelick/prompt-kit)
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
### Prerequisites
|
|
23
|
+
|
|
24
|
+
- Node.js 18+
|
|
25
|
+
- React 19+ (✅ Already installed in this project)
|
|
26
|
+
- shadcn/ui configured (✅ Already configured)
|
|
27
|
+
- Vercel AI SDK 5 installed
|
|
28
|
+
|
|
29
|
+
### Install Vercel AI SDK 5
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
bun add ai @ai-sdk/openai @ai-sdk/anthropic zod
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Install Prompt Kit Components
|
|
36
|
+
|
|
37
|
+
All Prompt Kit components are installed via the shadcn CLI using the component registry:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Generic pattern
|
|
41
|
+
bunx shadcn@latest add "https://www.prompt-kit.com/c/[COMPONENT_NAME].json"
|
|
42
|
+
|
|
43
|
+
# Or using the shorthand (if supported)
|
|
44
|
+
bunx shadcn@latest add prompt-kit/[component]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Available Components
|
|
50
|
+
|
|
51
|
+
### Core Components
|
|
52
|
+
|
|
53
|
+
| Component | Description | Registry Dependencies |
|
|
54
|
+
|-----------|-------------|----------------------|
|
|
55
|
+
| **prompt-input** | Input field for chat interfaces with auto-resize and submit handling | textarea, tooltip |
|
|
56
|
+
| **message** | Display chat messages with avatars, markdown, and actions | avatar, tooltip |
|
|
57
|
+
| **markdown** | Markdown renderer with syntax highlighting | - |
|
|
58
|
+
| **code-block** | Syntax-highlighted code blocks with Shiki | - |
|
|
59
|
+
| **chat-container** | Chat interface with intelligent auto-scrolling | - |
|
|
60
|
+
| **scroll-button** | Floating button to scroll to bottom | - |
|
|
61
|
+
| **loader** | Loading indicators with multiple variants | button |
|
|
62
|
+
| **prompt-suggestion** | Suggested prompts UI | - |
|
|
63
|
+
| **response-stream** | Display streaming AI responses | - |
|
|
64
|
+
| **reasoning** | Display AI reasoning/thinking process | - |
|
|
65
|
+
| **file-upload** | File upload component for AI interactions | - |
|
|
66
|
+
| **image** | Display images in chat messages | - |
|
|
67
|
+
| **jsx-preview** | Preview JSX components in chat | - |
|
|
68
|
+
| **tool** | Display AI tool usage/calls | - |
|
|
69
|
+
| **source** | Display sources/citations | - |
|
|
70
|
+
| **steps** | Display multi-step processes | - |
|
|
71
|
+
|
|
72
|
+
### NPM Dependencies by Component
|
|
73
|
+
|
|
74
|
+
**prompt-input:**
|
|
75
|
+
```bash
|
|
76
|
+
# Installed automatically with shadcn add
|
|
77
|
+
bunx shadcn@latest add textarea tooltip
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**message:**
|
|
81
|
+
```bash
|
|
82
|
+
bunx shadcn@latest add avatar tooltip
|
|
83
|
+
bun add react-markdown remark-gfm remark-breaks shiki marked
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**code-block:**
|
|
87
|
+
```bash
|
|
88
|
+
bun add shiki
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**chat-container:**
|
|
92
|
+
```bash
|
|
93
|
+
bun add use-stick-to-bottom
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Component Installation
|
|
99
|
+
|
|
100
|
+
### Install All Components (Recommended)
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Core chat components
|
|
104
|
+
bunx shadcn@latest add "https://www.prompt-kit.com/c/prompt-input.json"
|
|
105
|
+
bunx shadcn@latest add "https://www.prompt-kit.com/c/message.json"
|
|
106
|
+
bunx shadcn@latest add "https://www.prompt-kit.com/c/chat-container.json"
|
|
107
|
+
bunx shadcn@latest add "https://www.prompt-kit.com/c/loader.json"
|
|
108
|
+
bunx shadcn@latest add "https://www.prompt-kit.com/c/scroll-button.json"
|
|
109
|
+
|
|
110
|
+
# Advanced components
|
|
111
|
+
bunx shadcn@latest add "https://www.prompt-kit.com/c/prompt-suggestion.json"
|
|
112
|
+
bunx shadcn@latest add "https://www.prompt-kit.com/c/response-stream.json"
|
|
113
|
+
bunx shadcn@latest add "https://www.prompt-kit.com/c/reasoning.json"
|
|
114
|
+
bunx shadcn@latest add "https://www.prompt-kit.com/c/file-upload.json"
|
|
115
|
+
|
|
116
|
+
# Content components
|
|
117
|
+
bunx shadcn@latest add "https://www.prompt-kit.com/c/image.json"
|
|
118
|
+
bunx shadcn@latest add "https://www.prompt-kit.com/c/jsx-preview.json"
|
|
119
|
+
bunx shadcn@latest add "https://www.prompt-kit.com/c/tool.json"
|
|
120
|
+
bunx shadcn@latest add "https://www.prompt-kit.com/c/source.json"
|
|
121
|
+
bunx shadcn@latest add "https://www.prompt-kit.com/c/steps.json"
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Install Dependencies
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# For message component (markdown + syntax highlighting)
|
|
128
|
+
bun add react-markdown remark-gfm remark-breaks shiki marked
|
|
129
|
+
|
|
130
|
+
# For chat container (auto-scroll behavior)
|
|
131
|
+
bun add use-stick-to-bottom
|
|
132
|
+
|
|
133
|
+
# For AI SDK integration
|
|
134
|
+
bun add ai @ai-sdk/openai @ai-sdk/anthropic zod
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Vercel AI SDK 5 Integration
|
|
140
|
+
|
|
141
|
+
### Basic Chat Setup
|
|
142
|
+
|
|
143
|
+
**File:** `src/components/features/ai/AIChat.tsx`
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
"use client";
|
|
147
|
+
|
|
148
|
+
import { useChat } from "ai/react";
|
|
149
|
+
import {
|
|
150
|
+
PromptInput,
|
|
151
|
+
PromptInputTextarea,
|
|
152
|
+
PromptInputActions,
|
|
153
|
+
PromptInputAction,
|
|
154
|
+
} from "@/components/ui/prompt-input";
|
|
155
|
+
import {
|
|
156
|
+
Message,
|
|
157
|
+
MessageAvatar,
|
|
158
|
+
MessageContent,
|
|
159
|
+
} from "@/components/ui/message";
|
|
160
|
+
import {
|
|
161
|
+
ChatContainerRoot,
|
|
162
|
+
ChatContainerContent,
|
|
163
|
+
ChatContainerScrollAnchor,
|
|
164
|
+
} from "@/components/ui/chat-container";
|
|
165
|
+
import { Button } from "@/components/ui/button";
|
|
166
|
+
import { SendIcon } from "lucide-react";
|
|
167
|
+
|
|
168
|
+
export function AIChat() {
|
|
169
|
+
const { messages, input, handleInputChange, handleSubmit, isLoading } =
|
|
170
|
+
useChat({
|
|
171
|
+
api: "/api/chat",
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
return (
|
|
175
|
+
<div className="flex h-full flex-col">
|
|
176
|
+
{/* Chat Messages */}
|
|
177
|
+
<ChatContainerRoot className="flex-1">
|
|
178
|
+
<ChatContainerContent>
|
|
179
|
+
{messages.map((message) => (
|
|
180
|
+
<Message key={message.id} className="mb-4">
|
|
181
|
+
<MessageAvatar
|
|
182
|
+
src={message.role === "user" ? "/user.png" : "/ai.png"}
|
|
183
|
+
alt={message.role}
|
|
184
|
+
fallback={message.role === "user" ? "U" : "AI"}
|
|
185
|
+
/>
|
|
186
|
+
<MessageContent markdown={message.role === "assistant"}>
|
|
187
|
+
{message.content}
|
|
188
|
+
</MessageContent>
|
|
189
|
+
</Message>
|
|
190
|
+
))}
|
|
191
|
+
<ChatContainerScrollAnchor />
|
|
192
|
+
</ChatContainerContent>
|
|
193
|
+
</ChatContainerRoot>
|
|
194
|
+
|
|
195
|
+
{/* Input */}
|
|
196
|
+
<form onSubmit={handleSubmit} className="mt-4">
|
|
197
|
+
<PromptInput
|
|
198
|
+
isLoading={isLoading}
|
|
199
|
+
value={input}
|
|
200
|
+
onValueChange={handleInputChange}
|
|
201
|
+
onSubmit={handleSubmit}
|
|
202
|
+
>
|
|
203
|
+
<PromptInputTextarea placeholder="Ask me anything..." />
|
|
204
|
+
<PromptInputActions>
|
|
205
|
+
<PromptInputAction tooltip="Send message">
|
|
206
|
+
<Button
|
|
207
|
+
type="submit"
|
|
208
|
+
size="icon"
|
|
209
|
+
variant="ghost"
|
|
210
|
+
disabled={isLoading || !input.trim()}
|
|
211
|
+
>
|
|
212
|
+
<SendIcon className="h-4 w-4" />
|
|
213
|
+
</Button>
|
|
214
|
+
</PromptInputAction>
|
|
215
|
+
</PromptInputActions>
|
|
216
|
+
</PromptInput>
|
|
217
|
+
</form>
|
|
218
|
+
</div>
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### API Route (Vercel AI SDK 5)
|
|
224
|
+
|
|
225
|
+
**File:** `src/pages/api/chat.ts`
|
|
226
|
+
|
|
227
|
+
```typescript
|
|
228
|
+
import { streamText } from "ai";
|
|
229
|
+
import { openai } from "@ai-sdk/openai";
|
|
230
|
+
import type { APIRoute } from "astro";
|
|
231
|
+
|
|
232
|
+
export const POST: APIRoute = async ({ request }) => {
|
|
233
|
+
const { messages } = await request.json();
|
|
234
|
+
|
|
235
|
+
const result = streamText({
|
|
236
|
+
model: openai("gpt-4-turbo"),
|
|
237
|
+
messages,
|
|
238
|
+
system: "You are a helpful AI assistant.",
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
return result.toDataStreamResponse();
|
|
242
|
+
};
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Streaming Response with Reasoning
|
|
246
|
+
|
|
247
|
+
**File:** `src/components/features/ai/AIChatWithReasoning.tsx`
|
|
248
|
+
|
|
249
|
+
```tsx
|
|
250
|
+
"use client";
|
|
251
|
+
|
|
252
|
+
import { useChat } from "ai/react";
|
|
253
|
+
import { Message, MessageContent } from "@/components/ui/message";
|
|
254
|
+
import { Reasoning } from "@/components/ui/reasoning";
|
|
255
|
+
import { ResponseStream } from "@/components/ui/response-stream";
|
|
256
|
+
|
|
257
|
+
export function AIChatWithReasoning() {
|
|
258
|
+
const { messages, input, handleInputChange, handleSubmit, isLoading } =
|
|
259
|
+
useChat({
|
|
260
|
+
api: "/api/chat-reasoning",
|
|
261
|
+
streamProtocol: "text",
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
return (
|
|
265
|
+
<div className="space-y-4">
|
|
266
|
+
{messages.map((message) => (
|
|
267
|
+
<Message key={message.id}>
|
|
268
|
+
{message.role === "assistant" ? (
|
|
269
|
+
<div>
|
|
270
|
+
{/* Display reasoning if available */}
|
|
271
|
+
{message.metadata?.reasoning && (
|
|
272
|
+
<Reasoning>
|
|
273
|
+
<ResponseStream content={message.metadata.reasoning} />
|
|
274
|
+
</Reasoning>
|
|
275
|
+
)}
|
|
276
|
+
|
|
277
|
+
{/* Display main content */}
|
|
278
|
+
<MessageContent markdown>
|
|
279
|
+
<ResponseStream content={message.content} />
|
|
280
|
+
</MessageContent>
|
|
281
|
+
</div>
|
|
282
|
+
) : (
|
|
283
|
+
<MessageContent>{message.content}</MessageContent>
|
|
284
|
+
)}
|
|
285
|
+
</Message>
|
|
286
|
+
))}
|
|
287
|
+
</div>
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### File Upload Integration
|
|
293
|
+
|
|
294
|
+
**File:** `src/components/features/ai/AIChatWithFiles.tsx`
|
|
295
|
+
|
|
296
|
+
```tsx
|
|
297
|
+
"use client";
|
|
298
|
+
|
|
299
|
+
import { useChat } from "ai/react";
|
|
300
|
+
import { experimental_useObject as useObject } from "ai/react";
|
|
301
|
+
import { PromptInput, PromptInputAction } from "@/components/ui/prompt-input";
|
|
302
|
+
import { FileUpload } from "@/components/ui/file-upload";
|
|
303
|
+
import { Button } from "@/components/ui/button";
|
|
304
|
+
import { PaperclipIcon } from "lucide-react";
|
|
305
|
+
import { useState } from "react";
|
|
306
|
+
|
|
307
|
+
export function AIChatWithFiles() {
|
|
308
|
+
const [files, setFiles] = useState<File[]>([]);
|
|
309
|
+
|
|
310
|
+
const { messages, input, handleInputChange, handleSubmit, isLoading } =
|
|
311
|
+
useChat({
|
|
312
|
+
api: "/api/chat-files",
|
|
313
|
+
body: {
|
|
314
|
+
files: files.map(f => ({
|
|
315
|
+
name: f.name,
|
|
316
|
+
type: f.type,
|
|
317
|
+
size: f.size,
|
|
318
|
+
})),
|
|
319
|
+
},
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
const handleFileChange = (newFiles: File[]) => {
|
|
323
|
+
setFiles(newFiles);
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
return (
|
|
327
|
+
<form onSubmit={handleSubmit}>
|
|
328
|
+
<PromptInput isLoading={isLoading}>
|
|
329
|
+
<PromptInputTextarea value={input} onChange={handleInputChange} />
|
|
330
|
+
<PromptInputActions>
|
|
331
|
+
<PromptInputAction tooltip="Upload files">
|
|
332
|
+
<FileUpload
|
|
333
|
+
onChange={handleFileChange}
|
|
334
|
+
maxFiles={5}
|
|
335
|
+
maxSize={10 * 1024 * 1024} // 10MB
|
|
336
|
+
>
|
|
337
|
+
<Button type="button" variant="ghost" size="icon">
|
|
338
|
+
<PaperclipIcon className="h-4 w-4" />
|
|
339
|
+
</Button>
|
|
340
|
+
</FileUpload>
|
|
341
|
+
</PromptInputAction>
|
|
342
|
+
</PromptInputActions>
|
|
343
|
+
</PromptInput>
|
|
344
|
+
</form>
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Tool Calling (Function Calling)
|
|
350
|
+
|
|
351
|
+
**File:** `src/pages/api/chat-tools.ts`
|
|
352
|
+
|
|
353
|
+
```typescript
|
|
354
|
+
import { streamText, tool } from "ai";
|
|
355
|
+
import { openai } from "@ai-sdk/openai";
|
|
356
|
+
import { z } from "zod";
|
|
357
|
+
import type { APIRoute } from "astro";
|
|
358
|
+
|
|
359
|
+
export const POST: APIRoute = async ({ request }) => {
|
|
360
|
+
const { messages } = await request.json();
|
|
361
|
+
|
|
362
|
+
const result = streamText({
|
|
363
|
+
model: openai("gpt-4-turbo"),
|
|
364
|
+
messages,
|
|
365
|
+
tools: {
|
|
366
|
+
getWeather: tool({
|
|
367
|
+
description: "Get the current weather for a location",
|
|
368
|
+
parameters: z.object({
|
|
369
|
+
location: z.string().describe("The city and state"),
|
|
370
|
+
}),
|
|
371
|
+
execute: async ({ location }) => {
|
|
372
|
+
// Call weather API
|
|
373
|
+
return {
|
|
374
|
+
location,
|
|
375
|
+
temperature: 72,
|
|
376
|
+
condition: "Sunny",
|
|
377
|
+
};
|
|
378
|
+
},
|
|
379
|
+
}),
|
|
380
|
+
searchDatabase: tool({
|
|
381
|
+
description: "Search the database for information",
|
|
382
|
+
parameters: z.object({
|
|
383
|
+
query: z.string(),
|
|
384
|
+
}),
|
|
385
|
+
execute: async ({ query }) => {
|
|
386
|
+
// Search database
|
|
387
|
+
return { results: ["Result 1", "Result 2"] };
|
|
388
|
+
},
|
|
389
|
+
}),
|
|
390
|
+
},
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
return result.toDataStreamResponse();
|
|
394
|
+
};
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
**Display tool calls:**
|
|
398
|
+
|
|
399
|
+
```tsx
|
|
400
|
+
import { Tool } from "@/components/ui/tool";
|
|
401
|
+
|
|
402
|
+
{message.toolInvocations?.map((toolCall) => (
|
|
403
|
+
<Tool
|
|
404
|
+
key={toolCall.toolCallId}
|
|
405
|
+
name={toolCall.toolName}
|
|
406
|
+
arguments={toolCall.args}
|
|
407
|
+
result={toolCall.result}
|
|
408
|
+
/>
|
|
409
|
+
))}
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
## Astro Integration
|
|
415
|
+
|
|
416
|
+
### Create Chat Page
|
|
417
|
+
|
|
418
|
+
**File:** `src/pages/chat.astro`
|
|
419
|
+
|
|
420
|
+
```astro
|
|
421
|
+
---
|
|
422
|
+
import Layout from "@/layouts/Layout.astro";
|
|
423
|
+
import { AIChat } from "@/components/features/ai/AIChat";
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
<Layout title="AI Chat">
|
|
427
|
+
<div class="container mx-auto h-screen max-w-4xl p-4">
|
|
428
|
+
<h1 class="mb-4 text-2xl font-bold">AI Chat Assistant</h1>
|
|
429
|
+
<div class="h-[calc(100vh-8rem)] rounded-lg border bg-card p-4">
|
|
430
|
+
<AIChat client:load />
|
|
431
|
+
</div>
|
|
432
|
+
</div>
|
|
433
|
+
</Layout>
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
### Environment Variables
|
|
437
|
+
|
|
438
|
+
**File:** `.env`
|
|
439
|
+
|
|
440
|
+
```bash
|
|
441
|
+
# OpenAI
|
|
442
|
+
OPENAI_API_KEY=sk-...
|
|
443
|
+
|
|
444
|
+
# Anthropic
|
|
445
|
+
ANTHROPIC_API_KEY=sk-ant-...
|
|
446
|
+
|
|
447
|
+
# Public (accessible in browser)
|
|
448
|
+
PUBLIC_AI_MODEL=gpt-4-turbo
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
### Convex Integration (Alternative to API Routes)
|
|
452
|
+
|
|
453
|
+
**File:** `convex/ai/chat.ts`
|
|
454
|
+
|
|
455
|
+
```typescript
|
|
456
|
+
import { v } from "convex/values";
|
|
457
|
+
import { mutation } from "../_generated/server";
|
|
458
|
+
import { streamText } from "ai";
|
|
459
|
+
import { openai } from "@ai-sdk/openai";
|
|
460
|
+
|
|
461
|
+
export const sendMessage = mutation({
|
|
462
|
+
args: {
|
|
463
|
+
message: v.string(),
|
|
464
|
+
conversationId: v.optional(v.id("conversations")),
|
|
465
|
+
},
|
|
466
|
+
handler: async (ctx, args) => {
|
|
467
|
+
// Store message in Convex
|
|
468
|
+
const messageId = await ctx.db.insert("messages", {
|
|
469
|
+
content: args.message,
|
|
470
|
+
role: "user",
|
|
471
|
+
conversationId: args.conversationId,
|
|
472
|
+
createdAt: Date.now(),
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
// Get conversation history
|
|
476
|
+
const messages = await ctx.db
|
|
477
|
+
.query("messages")
|
|
478
|
+
.filter(q => q.eq(q.field("conversationId"), args.conversationId))
|
|
479
|
+
.collect();
|
|
480
|
+
|
|
481
|
+
// Note: Streaming requires special handling with Convex
|
|
482
|
+
// Consider using Convex Actions for streaming responses
|
|
483
|
+
|
|
484
|
+
return { messageId };
|
|
485
|
+
},
|
|
486
|
+
});
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
---
|
|
490
|
+
|
|
491
|
+
## Component Reference
|
|
492
|
+
|
|
493
|
+
### PromptInput
|
|
494
|
+
|
|
495
|
+
Auto-resizing textarea with submit handling and actions.
|
|
496
|
+
|
|
497
|
+
```tsx
|
|
498
|
+
import {
|
|
499
|
+
PromptInput,
|
|
500
|
+
PromptInputTextarea,
|
|
501
|
+
PromptInputActions,
|
|
502
|
+
PromptInputAction,
|
|
503
|
+
} from "@/components/ui/prompt-input";
|
|
504
|
+
|
|
505
|
+
<PromptInput
|
|
506
|
+
isLoading={false}
|
|
507
|
+
value={input}
|
|
508
|
+
onValueChange={setInput}
|
|
509
|
+
onSubmit={handleSubmit}
|
|
510
|
+
maxHeight={240}
|
|
511
|
+
>
|
|
512
|
+
<PromptInputTextarea
|
|
513
|
+
placeholder="Type a message..."
|
|
514
|
+
disableAutosize={false}
|
|
515
|
+
/>
|
|
516
|
+
<PromptInputActions>
|
|
517
|
+
<PromptInputAction tooltip="Send" side="top">
|
|
518
|
+
<Button type="submit">Send</Button>
|
|
519
|
+
</PromptInputAction>
|
|
520
|
+
</PromptInputActions>
|
|
521
|
+
</PromptInput>
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
**Props:**
|
|
525
|
+
- `isLoading?: boolean` - Disable input during loading
|
|
526
|
+
- `value?: string` - Controlled value
|
|
527
|
+
- `onValueChange?: (value: string) => void` - Change handler
|
|
528
|
+
- `maxHeight?: number | string` - Max height for auto-resize
|
|
529
|
+
- `onSubmit?: () => void` - Submit handler (Enter key)
|
|
530
|
+
|
|
531
|
+
### Message
|
|
532
|
+
|
|
533
|
+
Display chat messages with avatars and actions.
|
|
534
|
+
|
|
535
|
+
```tsx
|
|
536
|
+
import {
|
|
537
|
+
Message,
|
|
538
|
+
MessageAvatar,
|
|
539
|
+
MessageContent,
|
|
540
|
+
MessageActions,
|
|
541
|
+
MessageAction,
|
|
542
|
+
} from "@/components/ui/message";
|
|
543
|
+
|
|
544
|
+
<Message>
|
|
545
|
+
<MessageAvatar
|
|
546
|
+
src="/avatar.png"
|
|
547
|
+
alt="User"
|
|
548
|
+
fallback="U"
|
|
549
|
+
/>
|
|
550
|
+
<MessageContent markdown={true}>
|
|
551
|
+
**Bold text** and `code`
|
|
552
|
+
</MessageContent>
|
|
553
|
+
<MessageActions>
|
|
554
|
+
<MessageAction tooltip="Copy">
|
|
555
|
+
<Button variant="ghost" size="icon">
|
|
556
|
+
<CopyIcon />
|
|
557
|
+
</Button>
|
|
558
|
+
</MessageAction>
|
|
559
|
+
</MessageActions>
|
|
560
|
+
</Message>
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
**Props:**
|
|
564
|
+
- `markdown?: boolean` - Render content as markdown
|
|
565
|
+
- `src: string` - Avatar image source
|
|
566
|
+
- `alt: string` - Avatar alt text
|
|
567
|
+
- `fallback?: string` - Fallback text for avatar
|
|
568
|
+
|
|
569
|
+
### ChatContainer
|
|
570
|
+
|
|
571
|
+
Auto-scrolling container for chat messages.
|
|
572
|
+
|
|
573
|
+
```tsx
|
|
574
|
+
import {
|
|
575
|
+
ChatContainerRoot,
|
|
576
|
+
ChatContainerContent,
|
|
577
|
+
ChatContainerScrollAnchor,
|
|
578
|
+
} from "@/components/ui/chat-container";
|
|
579
|
+
|
|
580
|
+
<ChatContainerRoot className="h-[600px]">
|
|
581
|
+
<ChatContainerContent>
|
|
582
|
+
{messages.map(msg => (
|
|
583
|
+
<Message key={msg.id}>...</Message>
|
|
584
|
+
))}
|
|
585
|
+
<ChatContainerScrollAnchor />
|
|
586
|
+
</ChatContainerContent>
|
|
587
|
+
</ChatContainerRoot>
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
### Markdown & CodeBlock
|
|
591
|
+
|
|
592
|
+
Render markdown with syntax highlighting.
|
|
593
|
+
|
|
594
|
+
```tsx
|
|
595
|
+
import { Markdown } from "@/components/ui/markdown";
|
|
596
|
+
import { CodeBlock, CodeBlockCode } from "@/components/ui/code-block";
|
|
597
|
+
|
|
598
|
+
<Markdown>
|
|
599
|
+
{`# Heading\n\nParagraph with **bold**`}
|
|
600
|
+
</Markdown>
|
|
601
|
+
|
|
602
|
+
<CodeBlock>
|
|
603
|
+
<CodeBlockCode
|
|
604
|
+
code="const x = 42;"
|
|
605
|
+
language="typescript"
|
|
606
|
+
theme="github-light"
|
|
607
|
+
/>
|
|
608
|
+
</CodeBlock>
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
---
|
|
612
|
+
|
|
613
|
+
## Styling with Tailwind v4
|
|
614
|
+
|
|
615
|
+
All Prompt Kit components use Tailwind v4 with semantic color tokens defined in `src/styles/global.css`.
|
|
616
|
+
|
|
617
|
+
### Custom Theme Colors
|
|
618
|
+
|
|
619
|
+
```css
|
|
620
|
+
/* src/styles/global.css */
|
|
621
|
+
@theme {
|
|
622
|
+
--color-prompt-background: 0 0% 98%;
|
|
623
|
+
--color-prompt-border: 0 0% 90%;
|
|
624
|
+
--color-ai-message: 220 14% 96%;
|
|
625
|
+
--color-user-message: 142 76% 96%;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
.dark {
|
|
629
|
+
--color-prompt-background: 0 0% 8%;
|
|
630
|
+
--color-prompt-border: 0 0% 20%;
|
|
631
|
+
--color-ai-message: 220 14% 12%;
|
|
632
|
+
--color-user-message: 142 76% 12%;
|
|
633
|
+
}
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
### Custom Styles
|
|
637
|
+
|
|
638
|
+
```tsx
|
|
639
|
+
<PromptInput className="bg-[hsl(var(--color-prompt-background))] border-[hsl(var(--color-prompt-border))]">
|
|
640
|
+
...
|
|
641
|
+
</PromptInput>
|
|
642
|
+
|
|
643
|
+
<MessageContent className="bg-[hsl(var(--color-ai-message))]">
|
|
644
|
+
...
|
|
645
|
+
</MessageContent>
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
---
|
|
649
|
+
|
|
650
|
+
## Advanced Patterns
|
|
651
|
+
|
|
652
|
+
### Streaming with Custom Protocol
|
|
653
|
+
|
|
654
|
+
```typescript
|
|
655
|
+
import { streamText, StreamData } from "ai";
|
|
656
|
+
|
|
657
|
+
export const POST: APIRoute = async ({ request }) => {
|
|
658
|
+
const { messages } = await request.json();
|
|
659
|
+
|
|
660
|
+
const data = new StreamData();
|
|
661
|
+
data.append({ type: "metadata", timestamp: Date.now() });
|
|
662
|
+
|
|
663
|
+
const result = streamText({
|
|
664
|
+
model: openai("gpt-4-turbo"),
|
|
665
|
+
messages,
|
|
666
|
+
onFinish: () => {
|
|
667
|
+
data.append({ type: "finished" });
|
|
668
|
+
data.close();
|
|
669
|
+
},
|
|
670
|
+
});
|
|
671
|
+
|
|
672
|
+
return result.toDataStreamResponse({ data });
|
|
673
|
+
};
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
### Multi-Modal Chat (Images + Text)
|
|
677
|
+
|
|
678
|
+
```typescript
|
|
679
|
+
import { streamText } from "ai";
|
|
680
|
+
import { openai } from "@ai-sdk/openai";
|
|
681
|
+
|
|
682
|
+
const result = streamText({
|
|
683
|
+
model: openai("gpt-4-vision-preview"),
|
|
684
|
+
messages: [
|
|
685
|
+
{
|
|
686
|
+
role: "user",
|
|
687
|
+
content: [
|
|
688
|
+
{ type: "text", text: "What's in this image?" },
|
|
689
|
+
{
|
|
690
|
+
type: "image",
|
|
691
|
+
image: new URL("https://example.com/image.jpg")
|
|
692
|
+
},
|
|
693
|
+
],
|
|
694
|
+
},
|
|
695
|
+
],
|
|
696
|
+
});
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
### Suggested Prompts
|
|
700
|
+
|
|
701
|
+
```tsx
|
|
702
|
+
import { PromptSuggestion } from "@/components/ui/prompt-suggestion";
|
|
703
|
+
|
|
704
|
+
const suggestions = [
|
|
705
|
+
"Explain quantum computing",
|
|
706
|
+
"Write a poem about AI",
|
|
707
|
+
"Debug this code",
|
|
708
|
+
];
|
|
709
|
+
|
|
710
|
+
<div className="grid grid-cols-2 gap-2">
|
|
711
|
+
{suggestions.map((suggestion) => (
|
|
712
|
+
<PromptSuggestion
|
|
713
|
+
key={suggestion}
|
|
714
|
+
onClick={() => handleInputChange(suggestion)}
|
|
715
|
+
>
|
|
716
|
+
{suggestion}
|
|
717
|
+
</PromptSuggestion>
|
|
718
|
+
))}
|
|
719
|
+
</div>
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
---
|
|
723
|
+
|
|
724
|
+
## Testing
|
|
725
|
+
|
|
726
|
+
### Unit Tests
|
|
727
|
+
|
|
728
|
+
```typescript
|
|
729
|
+
import { render, screen } from "@testing-library/react";
|
|
730
|
+
import { AIChat } from "@/components/features/ai/AIChat";
|
|
731
|
+
|
|
732
|
+
describe("AIChat", () => {
|
|
733
|
+
it("renders chat interface", () => {
|
|
734
|
+
render(<AIChat />);
|
|
735
|
+
expect(screen.getByPlaceholderText(/ask me anything/i)).toBeInTheDocument();
|
|
736
|
+
});
|
|
737
|
+
});
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
### Integration Tests with Vercel AI SDK
|
|
741
|
+
|
|
742
|
+
```typescript
|
|
743
|
+
import { streamText } from "ai";
|
|
744
|
+
import { openai } from "@ai-sdk/openai";
|
|
745
|
+
|
|
746
|
+
describe("AI Chat API", () => {
|
|
747
|
+
it("streams responses", async () => {
|
|
748
|
+
const result = await streamText({
|
|
749
|
+
model: openai("gpt-4-turbo"),
|
|
750
|
+
messages: [{ role: "user", content: "Hello" }],
|
|
751
|
+
});
|
|
752
|
+
|
|
753
|
+
const stream = result.toDataStream();
|
|
754
|
+
const chunks: string[] = [];
|
|
755
|
+
|
|
756
|
+
for await (const chunk of stream) {
|
|
757
|
+
chunks.push(chunk);
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
expect(chunks.length).toBeGreaterThan(0);
|
|
761
|
+
});
|
|
762
|
+
});
|
|
763
|
+
```
|
|
764
|
+
|
|
765
|
+
---
|
|
766
|
+
|
|
767
|
+
## Performance Optimization
|
|
768
|
+
|
|
769
|
+
### Code Splitting
|
|
770
|
+
|
|
771
|
+
```tsx
|
|
772
|
+
import { lazy, Suspense } from "react";
|
|
773
|
+
import { Loader } from "@/components/ui/loader";
|
|
774
|
+
|
|
775
|
+
const AIChat = lazy(() => import("@/components/features/ai/AIChat"));
|
|
776
|
+
|
|
777
|
+
<Suspense fallback={<Loader />}>
|
|
778
|
+
<AIChat />
|
|
779
|
+
</Suspense>
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
### Memoization
|
|
783
|
+
|
|
784
|
+
```tsx
|
|
785
|
+
import { memo } from "react";
|
|
786
|
+
|
|
787
|
+
const MessageItem = memo(({ message }: { message: Message }) => (
|
|
788
|
+
<Message>
|
|
789
|
+
<MessageContent markdown>{message.content}</MessageContent>
|
|
790
|
+
</Message>
|
|
791
|
+
));
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
---
|
|
795
|
+
|
|
796
|
+
## Deployment
|
|
797
|
+
|
|
798
|
+
### Environment Variables (Cloudflare Pages)
|
|
799
|
+
|
|
800
|
+
```bash
|
|
801
|
+
# Add to Cloudflare Pages settings
|
|
802
|
+
OPENAI_API_KEY=sk-...
|
|
803
|
+
ANTHROPIC_API_KEY=sk-ant-...
|
|
804
|
+
```
|
|
805
|
+
|
|
806
|
+
### Build Configuration
|
|
807
|
+
|
|
808
|
+
```bash
|
|
809
|
+
# Build with AI SDK
|
|
810
|
+
bun run build
|
|
811
|
+
|
|
812
|
+
# Deploy to Cloudflare Pages
|
|
813
|
+
wrangler pages deploy dist --project-name=astro-shadcn
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
---
|
|
817
|
+
|
|
818
|
+
## Troubleshooting
|
|
819
|
+
|
|
820
|
+
### Common Issues
|
|
821
|
+
|
|
822
|
+
**1. "Module not found: react-markdown"**
|
|
823
|
+
```bash
|
|
824
|
+
bun add react-markdown remark-gfm remark-breaks
|
|
825
|
+
```
|
|
826
|
+
|
|
827
|
+
**2. "Shiki syntax highlighting not working"**
|
|
828
|
+
```bash
|
|
829
|
+
bun add shiki
|
|
830
|
+
```
|
|
831
|
+
|
|
832
|
+
**3. "Auto-scroll not working"**
|
|
833
|
+
```bash
|
|
834
|
+
bun add use-stick-to-bottom
|
|
835
|
+
```
|
|
836
|
+
|
|
837
|
+
**4. "Type errors with Vercel AI SDK"**
|
|
838
|
+
```bash
|
|
839
|
+
bun add -D @types/react @types/node
|
|
840
|
+
```
|
|
841
|
+
|
|
842
|
+
### Debug Mode
|
|
843
|
+
|
|
844
|
+
Enable debug logging for Vercel AI SDK:
|
|
845
|
+
|
|
846
|
+
```typescript
|
|
847
|
+
import { streamText } from "ai";
|
|
848
|
+
|
|
849
|
+
const result = streamText({
|
|
850
|
+
model: openai("gpt-4-turbo"),
|
|
851
|
+
messages,
|
|
852
|
+
debug: true, // Enable debug logs
|
|
853
|
+
});
|
|
854
|
+
```
|
|
855
|
+
|
|
856
|
+
---
|
|
857
|
+
|
|
858
|
+
## Resources
|
|
859
|
+
|
|
860
|
+
- **Prompt Kit Docs:** https://www.prompt-kit.com/docs
|
|
861
|
+
- **Vercel AI SDK Docs:** https://sdk.vercel.ai/docs
|
|
862
|
+
- **shadcn/ui Docs:** https://ui.shadcn.com
|
|
863
|
+
- **GitHub:** https://github.com/ibelick/prompt-kit
|
|
864
|
+
- **OpenAI SDK:** https://github.com/openai/openai-node
|
|
865
|
+
- **Anthropic SDK:** https://github.com/anthropics/anthropic-sdk-typescript
|
|
866
|
+
|
|
867
|
+
---
|
|
868
|
+
|
|
869
|
+
## Examples
|
|
870
|
+
|
|
871
|
+
### Complete Chat Implementation
|
|
872
|
+
|
|
873
|
+
See `src/components/features/ai/AIChat.tsx` for a full working example with:
|
|
874
|
+
- Message history
|
|
875
|
+
- Streaming responses
|
|
876
|
+
- File uploads
|
|
877
|
+
- Tool calling
|
|
878
|
+
- Suggested prompts
|
|
879
|
+
- Error handling
|
|
880
|
+
- Loading states
|
|
881
|
+
|
|
882
|
+
### API Route Examples
|
|
883
|
+
|
|
884
|
+
See `src/pages/api/` for:
|
|
885
|
+
- `chat.ts` - Basic streaming chat
|
|
886
|
+
- `chat-tools.ts` - Function calling
|
|
887
|
+
- `chat-files.ts` - File upload handling
|
|
888
|
+
- `chat-reasoning.ts` - Reasoning display
|
|
889
|
+
|
|
890
|
+
---
|
|
891
|
+
|
|
892
|
+
## Next Steps
|
|
893
|
+
|
|
894
|
+
1. ✅ Install Vercel AI SDK and dependencies
|
|
895
|
+
2. ✅ Install Prompt Kit components
|
|
896
|
+
3. ✅ Create API routes for chat
|
|
897
|
+
4. ✅ Build chat UI components
|
|
898
|
+
5. ✅ Test streaming responses
|
|
899
|
+
6. ✅ Add file upload support
|
|
900
|
+
7. ✅ Implement tool calling
|
|
901
|
+
8. ✅ Deploy to Cloudflare Pages
|
|
902
|
+
|
|
903
|
+
**Happy building! 🚀**
|