oneie 3.6.12 → 3.6.14
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/.claude/agents/AUDIT-agent-ops-alignment.md +379 -0
- package/.claude/agents/NEWS-QUICKSTART.md +321 -0
- package/.claude/agents/NEWS-README.md +353 -0
- package/.claude/agents/agent-backend.md +1 -1
- package/.claude/agents/agent-builder.md +220 -151
- package/.claude/agents/agent-clean.md +39 -31
- package/.claude/agents/agent-clone.md +107 -54
- package/.claude/agents/agent-designer.md +76 -71
- package/.claude/agents/agent-director.md +164 -1
- package/.claude/agents/agent-documenter.md +169 -132
- package/.claude/agents/agent-frontend.md +442 -446
- package/.claude/agents/agent-integrator.md +30 -23
- package/.claude/agents/agent-lawyer.md +145 -98
- package/.claude/agents/agent-news.md +363 -0
- package/.claude/agents/agent-onboard.md +99 -69
- package/.claude/agents/agent-ontology.md +585 -0
- package/.claude/agents/agent-ops.md +178 -171
- package/.claude/agents/agent-problem-solver.md +132 -115
- package/.claude/agents/agent-quality.md +94 -77
- package/.claude/agents/agent-sales.md +89 -67
- package/.claude/commands/release.md +3 -1
- package/.claude/commands/server.md +64 -5
- package/.claude/hooks/README-knowledge-hooks.md +266 -80
- package/.claude/hooks/README-root-cleanup.md +200 -0
- package/.claude/hooks/README.md +284 -0
- package/.claude/hooks/__pycache__/done.cpython-313.pyc +0 -0
- package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
- package/.claude/hooks/check-filenames.py +169 -32
- package/.claude/hooks/clean-post.py +195 -28
- package/.claude/hooks/clean-pre.py +96 -11
- package/.claude/hooks/done.py +74 -13
- package/.claude/hooks/format-hook.sh +105 -17
- package/.claude/hooks/hook-logger.sh +121 -7
- package/.claude/hooks/knowledge-post.py +136 -32
- package/.claude/hooks/knowledge-pre.py +129 -34
- package/.claude/hooks/notification-hook.sh +184 -17
- package/.claude/hooks/root-cleanup.py +181 -39
- package/.claude/hooks/security-hook.sh +248 -8
- package/.claude/hooks/tag-all-docs.py +175 -49
- package/.claude/hooks/test-validate-ontology.sh +170 -0
- package/.claude/hooks/todo.py +92 -22
- package/.claude/hooks/validate-ontology-structure-summary.md +243 -0
- package/.claude/hooks/validate-ontology-structure.py +83 -20
- package/AGENTS.md +60 -245
- package/CLAUDE.md +70 -1
- package/README.md +25 -0
- package/folders.yaml +1 -1
- package/one/.claude/settings.local.json +11 -0
- package/one/.obsidian/community-plugins.json +3 -1
- package/one/.obsidian/plugins/editing-toolbar/data.json +328 -0
- package/one/.obsidian/plugins/editing-toolbar/main.js +12 -0
- package/one/.obsidian/plugins/editing-toolbar/manifest.json +10 -0
- package/one/.obsidian/plugins/editing-toolbar/styles.css +1338 -0
- package/one/.obsidian/plugins/terminal/data.json +154 -0
- package/one/.obsidian/plugins/terminal/main.js +197 -0
- package/one/.obsidian/plugins/terminal/manifest.json +14 -0
- package/one/.obsidian/plugins/terminal/styles.css +32 -0
- package/one/.obsidian/workspace.json +71 -45
- package/one/README.md +18 -0
- package/one/connections/a2a.md +49 -0
- package/one/connections/acp.md +47 -0
- package/one/connections/acps.md +18 -0
- package/one/connections/agentkit.md +18 -0
- package/one/connections/agui.md +18 -0
- package/one/connections/any-backend.md +39 -21
- package/one/connections/ap2.md +74 -0
- package/one/connections/api/queries-reference.md +18 -0
- package/one/connections/api-docs.md +18 -0
- package/one/connections/api-reference.md +18 -0
- package/one/connections/api.md +18 -0
- package/one/connections/architecture-diagram.md +18 -0
- package/one/connections/communications.md +18 -0
- package/one/connections/connections.md +18 -0
- package/one/connections/copilotkit.md +18 -0
- package/one/connections/cryptonetworks.md +18 -0
- package/one/connections/documentation.md +18 -0
- package/one/connections/effect.md +18 -0
- package/one/connections/elizaos.md +18 -0
- package/one/connections/groups.md +814 -0
- package/one/connections/inference.md +18 -0
- package/one/connections/integration-examples.md +18 -0
- package/one/connections/integration-guide.md +18 -0
- package/one/connections/integration-phase2.md +32 -14
- package/one/connections/kyc.md +18 -0
- package/one/connections/mcp.md +18 -0
- package/one/connections/membership.md +18 -0
- package/one/connections/middleware.md +18 -0
- package/one/connections/multitenant.md +18 -0
- package/one/connections/n8n.md +18 -0
- package/one/connections/patterns.md +18 -0
- package/one/connections/protocols.md +20 -2
- package/one/connections/relationships.md +18 -0
- package/one/connections/schema.md +18 -0
- package/one/connections/service-layer.md +18 -0
- package/one/connections/vectors.md +18 -0
- package/one/connections/wordpress.md +18 -0
- package/one/connections/workflow-copy.md +18 -0
- package/one/connections/workflow-examples.md +18 -0
- package/one/connections/workflow-onboarding.md +18 -0
- package/one/connections/workflow.md +18 -0
- package/one/connections/workflows/delegation.md +18 -0
- package/one/connections/workflows/frontend.md +18 -0
- package/one/connections/workflows/strategy.md +18 -0
- package/one/connections/workflows/tasks.md +18 -0
- package/one/connections/x402-baazar.md +131 -0
- package/one/connections/x402.md +268 -164
- package/one/events/2024-10-14-deployment-plan.md +15 -16
- package/one/events/2024-10-14-deployment-success.md +15 -16
- package/one/events/2024-10-14-final-sync-complete.md +15 -16
- package/one/events/2024-10-14-release-v2.0.6.md +15 -16
- package/one/events/2024-10-15-agent-clean-v2-summary.md +15 -16
- package/one/events/2024-10-15-handoff-to-clean.md +15 -16
- package/one/events/2024-10-15-package-manager-tests.md +15 -16
- package/one/events/2024-10-15-release-command-complete.md +15 -16
- package/one/events/2025-10-15-private-files-secured.md +18 -0
- package/one/events/2025-10-15-unignore-public-group-docs.md +18 -0
- package/one/events/ALIGNMENT_REPORT_PROBLEM_SOLVER.md +335 -0
- package/one/events/ALIGNMENT_SUMMARY.md +280 -0
- package/one/events/API_ROUTES_FIXES_SUMMARY.md +18 -0
- package/one/events/ASTRO-INTEGRATION-EXAMPLES.md +18 -0
- package/one/events/AUDIT-ONTOLOGY-ALIGNMENT.md +598 -0
- package/one/events/BEFORE_AFTER_COMPARISON.md +18 -0
- package/one/events/CART-DRAWER-INTEGRATION-GUIDE.md +18 -0
- package/one/events/CASCADE-2-BACKEND-AGNOSTIC.md +18 -0
- package/one/events/CLAUDE copy.md +897 -0
- package/one/events/CLEANUP-RELEASE-V2.0.8.md +18 -0
- package/one/events/CONNECTIONS_DEMO.md +18 -0
- package/one/events/CREATE-WEBSITE.md +18 -0
- package/one/events/CRITICAL-FIXES-COMPLETE.md +18 -0
- package/one/events/CUSTOM-DOMAIN.md +18 -0
- package/one/events/DELIVERABLES.md +18 -0
- package/one/events/DEMO-GROUPS-PAGE.md +18 -0
- package/one/events/DEMO-TESTING-SUMMARY.md +18 -0
- package/one/events/DEMO_COMPONENTS.md +18 -0
- package/one/events/DEMO_HOOKS_INDEX.md +18 -0
- package/one/events/DEMO_INFRASTRUCTURE.md +18 -0
- package/one/events/DEMO_INFRASTRUCTURE_SUMMARY.md +18 -0
- package/one/events/DEMO_INTEGRATION_CHECKLIST.md +18 -0
- package/one/events/DEMO_QUICK_REFERENCE.md +18 -0
- package/one/events/DEMO_SETUP.md +18 -0
- package/one/events/DEPLOYMENT copy.md +18 -0
- package/one/events/DEPLOYMENT.md +18 -0
- package/one/events/ECOMMERCE-BEFORE-AFTER.md +16 -0
- package/one/events/ECOMMERCE-DEMO-PLAN.md +18 -0
- package/one/events/ECOMMERCE-ENHANCEMENTS.md +18 -0
- package/one/events/ECOMMERCE-HIGH-CONVERTING-ELEMENTS.md +18 -0
- package/one/events/ECOMMERCE-LIVE-DEMO.md +18 -0
- package/one/events/ECOMMERCE-REFACTOR-SUMMARY.md +18 -0
- package/one/events/ECOMMERCE-SETUP-SUMMARY.md +18 -0
- package/one/events/ECOMMERCE-TEMPLATE-COMPLETE.md +18 -0
- package/one/events/ECOMMERCE-TEMPLATES-SUMMARY.md +18 -0
- package/one/events/EFFECT_TS_API_PATTERN.md +18 -0
- package/one/events/FEATURE-2-4-COMPLETE.md +18 -0
- package/one/events/FEATURE_2_3_COMPLETE.md +18 -0
- package/one/events/GRADIENT-TEXT-PERMANENT-FIX.md +18 -0
- package/one/events/GROUPS-MIGRATION.md +18 -0
- package/one/events/GROUPS_DEMO_IMPLEMENTATION.md +18 -0
- package/one/events/HANDOFF.md +18 -0
- package/one/events/HOOKS-DEMO.md +18 -0
- package/one/events/IMPLEMENTATION-SUMMARY-FINAL.md +18 -0
- package/one/events/IMPLEMENTATION_SUMMARY.md +18 -0
- package/one/events/INSTALL-TESTS.md +18 -0
- package/one/events/INSTALLATION_FOLDERS.md +18 -0
- package/one/events/INSTALLATION_FOLDERS_FILES.md +18 -0
- package/one/events/INSTALLATION_FOLDERS_SUMMARY.md +18 -0
- package/one/events/INTEGRATION-ARCHITECTURE.md +18 -0
- package/one/events/INTEGRATION-CHECKLIST.md +18 -0
- package/one/events/INTEGRATION-ORCHESTRATION.md +18 -0
- package/one/events/INTEGRATION-SUMMARY.md +18 -0
- package/one/events/LANDING-PAGE-EXAMPLE-OUTPUT.md +18 -0
- package/one/events/LANDING-PAGE-IMPLEMENTATION.md +18 -0
- package/one/events/LANDING-PAGE-QUICKSTART.md +18 -0
- package/one/events/LICENSE.md +18 -0
- package/one/events/MCP-CONFIGURATION.md +18 -0
- package/one/events/MCP-SETUP-COMPLETE.md +18 -0
- package/one/events/MIGRATION-REPORT.md +18 -0
- package/one/events/MIGRATION.md +18 -0
- package/one/events/MULTI-ONTOLOGY-COMPLETE-GUIDE.md +18 -0
- package/one/events/MULTI-ONTOLOGY-IMPLEMENTATION-COMPLETE.md +18 -0
- package/one/events/NODE-UPGRADE.md +18 -0
- package/one/events/ONBOARDING-IMPLEMENTATION-COMPLETE copy.md +18 -0
- package/one/events/ONTOLOGY-HOOKS-README.md +18 -0
- package/one/events/ONTOLOGY-INTEGRATION-MANIFEST.md +18 -0
- package/one/events/ONTOLOGY-TUTORIALS-SUMMARY.md +18 -0
- package/one/events/ONTOLOGY-TYPE-GENERATOR-SUMMARY.md +18 -0
- package/one/events/ONTOLOGY_DISCOVERY_IMPLEMENTATION.md +18 -0
- package/one/events/ONTOLOGY_DISCOVERY_QUICKSTART.md +18 -0
- package/one/events/PACKAGE-STRUCTURE.md +18 -0
- package/one/events/PLAYBOOK-SETUP-SUMMARY.md +18 -0
- package/one/events/PROMPT_FIX_FRONTEND_ONLY.md +18 -0
- package/one/events/QA-CHECKLIST.md +18 -0
- package/one/events/QUICK-START-ONTOLOGY.md +18 -0
- package/one/events/README-archived.md +18 -0
- package/one/events/SEARCH_DEMO_CODE_REFERENCE.md +18 -0
- package/one/events/SEARCH_DEMO_DELIVERY.md +18 -0
- package/one/events/SEARCH_DEMO_SUMMARY.md +18 -0
- package/one/events/SEARCH_DEMO_VISUAL_GUIDE.md +18 -0
- package/one/events/SECURITY-AUDIT-FIXES.md +18 -0
- package/one/events/SECURITY-SCAN-COMPLETE.md +18 -0
- package/one/events/SHOP-BUILD-STATUS.md +18 -0
- package/one/events/SHOP-PREMIUM-UPDATE.md +16 -0
- package/one/events/SIMPLE_FIX_FRONTEND_ONLY.md +18 -0
- package/one/events/SITE-WIDE-GRADIENT-FIX.md +18 -0
- package/one/events/STORE-PRODUCTION-READY-STATUS.md +18 -0
- package/one/events/STRIPE-INTEGRATION.md +18 -0
- package/one/events/STRIPE-PAYMENT-METHODS-GUIDE.md +18 -0
- package/one/events/STRIPE-SETUP-GUIDE.md +18 -0
- package/one/events/TEST-PLAN-INDEX.md +18 -0
- package/one/events/TEST-PLAN.md +18 -0
- package/one/events/TEST-SUMMARY.md +18 -0
- package/one/events/TESTS-QUICK-REF.md +18 -0
- package/one/events/TRANSITIONS-QUICK-START.md +18 -0
- package/one/events/TRANSPARENCY-FIXES.md +18 -0
- package/one/events/TYPESCRIPT_FIXES.md +18 -0
- package/one/events/TYPESCRIPT_FIXES_INDEX.md +18 -0
- package/one/events/VIEW-TRANSITIONS.md +18 -0
- package/one/events/agent-director-enhancement-summary.md +18 -0
- package/one/events/agent-onboard-implementation-summary.md +18 -0
- package/one/events/agent-ontology-alignment-completion.md +263 -0
- package/one/events/backend-integration-tests.md +18 -0
- package/one/events/clean-agent-ontology-cleanup-report.md +18 -0
- package/one/events/clean-agent-todo-analysis-summary.md +336 -0
- package/one/events/cloudflare-automation-complete.md +18 -0
- package/one/events/cloudflare-pages-infrastructure-setup.md +18 -0
- package/one/events/contact-page-complete.md +18 -0
- package/one/events/convex-analysis-index.md +18 -0
- package/one/events/convex-structure-analysis.md +18 -0
- package/one/events/deployment-installation-folders.md +18 -0
- package/one/events/deployment-ops-summary.md +18 -0
- package/one/events/deployment-verification.md +18 -0
- package/one/events/design-spec-complete.md +18 -0
- package/one/events/documentation-audit-index.md +473 -0
- package/one/events/documentation-audit-summary.md +417 -0
- package/one/events/documentation-improvement-roadmap.md +906 -0
- package/one/events/documentation-standards-compliance-report.md +538 -0
- package/one/events/events.md +18 -0
- package/one/events/frontend-effects-complete.md +584 -0
- package/one/events/frontend-effects-orchestration.md +1356 -0
- package/one/events/frontend-effects-risk-register.md +1055 -0
- package/one/events/frontend-effects-week1-assignments.md +1594 -0
- package/one/events/hook-ontology-alignment-summary.md +528 -0
- package/one/events/installation-folders-workflow-integration.md +18 -0
- package/one/events/landing-page-generator.md +18 -0
- package/one/events/legal-assessment-2025-10-16.md +18 -0
- package/one/events/onboarding-implementation-complete.md +18 -0
- package/one/events/ontology-test-examples.md +18 -0
- package/one/events/phase1-backend-implementation-complete.md +18 -0
- package/one/events/release.md +18 -0
- package/one/events/root-cleanup-alignment-report.md +265 -0
- package/one/events/separate-implementation-status.md +18 -0
- package/one/events/session-summary-2025-10-18.md +18 -0
- package/one/events/skills-complete.md +18 -0
- package/one/events/skills-infer-6-10-summary.md +18 -0
- package/one/events/skills-phase1-complete.md +18 -0
- package/one/events/structural-analysis-architecture-vs-plans.md +559 -0
- package/one/events/test-dashboard.md +18 -0
- package/one/events/test-index.md +18 -0
- package/one/events/test-report-ontology.md +18 -0
- package/one/events/testing-summary.md +18 -0
- package/one/events/todo-refactoring-complete.md +408 -0
- package/one/events/wave1-backend-implementation-complete.md +698 -0
- package/one/groups/features.md +26 -0
- package/one/groups/groups.md +83 -39
- package/one/groups/one.md +47 -27
- package/one/groups/{strategy copy.md → strategy-copy.md} +23 -5
- package/one/knowledge/.obsidian/ecommerce-ontology.md +18 -0
- package/one/knowledge/100-inference-quick-reference.md +18 -0
- package/one/knowledge/agent-onboard-usage.md +18 -0
- package/one/knowledge/agentic-commerce.md +146 -0
- package/one/knowledge/ai-agents-vs-memecoins-thesis.md +683 -0
- package/one/knowledge/ai-platform.md +18 -0
- package/one/knowledge/ai-token-crypto-analysis-framework.md +1191 -0
- package/one/knowledge/ai-token-paradigm-shift-2025.md +732 -0
- package/one/knowledge/altcoin-cycle-prediction-ontology.md +884 -0
- package/one/knowledge/altcoin-cycle-trading-strategy.md +642 -0
- package/one/knowledge/architecture-any-backend.md +265 -42
- package/one/knowledge/architecture-diagram.md +404 -94
- package/one/knowledge/architecture-frontend.md +130 -51
- package/one/knowledge/architecture.md +1496 -1831
- package/one/knowledge/{ontology.md.backup → archived/ontology.old.md} +18 -0
- package/one/knowledge/astro-effect-complete-vision.md +2148 -0
- package/one/knowledge/astro-effect-simple-architecture.md +717 -0
- package/one/knowledge/audit-agent-onboard-alignment.md +481 -0
- package/one/knowledge/audit-agent-sales-alignment.md +444 -0
- package/one/knowledge/backend-api-reference.md +18 -0
- package/one/knowledge/cli-claude-handoff.md +18 -0
- package/one/knowledge/context-engineering.md +610 -0
- package/one/knowledge/crypto-analysis-strategy.md +1276 -0
- package/one/knowledge/crypto-cycle-2024-2025-analysis.md +44 -0
- package/one/knowledge/crypto.md +18 -0
- package/one/knowledge/docs.md +627 -0
- package/one/knowledge/dsl.md +18 -0
- package/one/knowledge/files.md +18 -0
- package/one/knowledge/frontend.md +18 -0
- package/one/knowledge/hono.md +18 -0
- package/one/knowledge/implementation-examples.md +18 -0
- package/one/knowledge/installation-folders.md +18 -0
- package/one/knowledge/institutional-cycle-paradigm-2025.md +555 -0
- package/one/knowledge/knowledge.md +18 -0
- package/one/knowledge/language.md +18 -0
- package/one/knowledge/lessons-learned.md +18 -0
- package/one/knowledge/lessons-website-building-focus.md +18 -0
- package/one/knowledge/merge-report.md +254 -0
- package/one/knowledge/nine-padel-playbook.md +18 -0
- package/one/knowledge/ontology-blog.yaml +42 -26
- package/one/knowledge/ontology-cheatsheet.md +18 -0
- package/one/knowledge/ontology-community.yaml +60 -37
- package/one/knowledge/ontology-core-universal.md +19 -1
- package/one/knowledge/ontology-core.yaml +58 -45
- package/one/knowledge/ontology-courses.yaml +71 -48
- package/one/knowledge/ontology-creator.md +30 -4
- package/one/knowledge/ontology-crypto.md +1603 -0
- package/one/knowledge/ontology-developer-guide.md +18 -0
- package/one/knowledge/ontology-documentation.md +46 -25
- package/one/knowledge/ontology-ecommerce.md +24 -6
- package/one/knowledge/ontology-education.md +18 -0
- package/one/knowledge/ontology-engineering-specification.md +22 -4
- package/one/knowledge/ontology-engineering.md +67 -43
- package/one/knowledge/ontology-files.yaml +525 -0
- package/one/knowledge/ontology-frontend-master.md +2898 -0
- package/one/knowledge/ontology-frontend-specifications.md +57 -49
- package/one/knowledge/ontology-frontend.md +40 -22
- package/one/knowledge/ontology-index.md +18 -0
- package/one/knowledge/ontology-minimal.yaml +18 -16
- package/one/knowledge/ontology-portfolio.yaml +40 -26
- package/one/knowledge/ontology-quickstart.md +18 -0
- package/one/knowledge/ontology-release.md +317 -0
- package/one/knowledge/ontology-shop.yaml +146 -119
- package/one/knowledge/ontology-tokens.yaml +46 -27
- package/one/knowledge/ontology-tutorial.md +18 -0
- package/one/knowledge/ontology-video-script.md +18 -0
- package/one/knowledge/ontology-visual-guide.md +20 -2
- package/one/knowledge/ontology.md +1329 -304
- package/one/knowledge/ontology.yaml +763 -275
- package/one/knowledge/patterns/backend/convex-mutation-pattern.md +48 -18
- package/one/knowledge/patterns/backend/convex-query-pattern.md +78 -23
- package/one/knowledge/patterns/backend/mutation-template.md +28 -10
- package/one/knowledge/patterns/backend/query-template.md +44 -25
- package/one/knowledge/patterns/backend/service-template.md +35 -14
- package/one/knowledge/patterns/design/component-architecture.md +45 -9
- package/one/knowledge/patterns/design/test-driven-design-pattern.md +37 -3
- package/one/knowledge/patterns/design/wireframe-template.md +36 -2
- package/one/knowledge/patterns/frontend/component-template.md +91 -40
- package/one/knowledge/patterns/frontend/form-template.md +131 -59
- package/one/knowledge/patterns/frontend/page-template.md +59 -28
- package/one/knowledge/patterns/frontend/react-component-pattern.md +87 -27
- package/one/knowledge/patterns/test/acceptance-criteria-template.md +28 -10
- package/one/knowledge/patterns/test/technical-test-template.md +48 -26
- package/one/knowledge/patterns/test/test-driven-pattern.md +25 -5
- package/one/knowledge/patterns/test/user-flow-template.md +18 -0
- package/one/knowledge/provider-agnostic-content.md +995 -0
- package/one/knowledge/provider-creation-guide.md +18 -0
- package/one/knowledge/quality-loop.md +18 -0
- package/one/knowledge/readme-architecture.md +158 -0
- package/one/knowledge/readme.md +18 -0
- package/one/knowledge/rules.md +18 -0
- package/one/knowledge/score.md +18 -0
- package/one/knowledge/specifications.md +18 -0
- package/one/knowledge/tags.md +18 -0
- package/one/knowledge/todo-template.md +18 -0
- package/one/knowledge/todo.md +18 -0
- package/one/knowledge/typescript-patterns.md +18 -0
- package/one/knowledge/universal-generation-language.md +827 -0
- package/one/knowledge/x402-research.md +104 -0
- package/one/license.md +18 -0
- package/one/people/anthony-o-connell.md +48 -19
- package/one/people/people.md +54 -31
- package/one/things/ALIGNMENT_AUDIT_QUALITY_AGENT.md +401 -0
- package/one/things/AUDIT_AGENT_INTEGRATOR_ALIGNMENT.md +588 -0
- package/one/things/AUDIT_REPORT_AGENT_CLEAN.md +461 -0
- package/one/things/CHECKLIST.md +51 -0
- package/one/things/IMPLEMENTATION_STATUS.md +379 -0
- package/one/things/ONE.md +19 -1
- package/one/things/agents/agent-backend.md +198 -98
- package/one/things/agents/agent-builder.md +267 -158
- package/one/things/agents/agent-clean.md +40 -15
- package/one/things/agents/agent-clone.md +33 -50
- package/one/things/agents/agent-deploy.md +59 -11
- package/one/things/agents/agent-designer.md +274 -146
- package/one/things/agents/agent-director.md +20 -2
- package/one/things/agents/agent-documenter.md +126 -46
- package/one/things/agents/agent-frontend.md +104 -22
- package/one/things/agents/agent-integrator.md +153 -76
- package/one/things/agents/agent-lawyer.md +197 -92
- package/one/things/agents/agent-problem-solver.md +302 -224
- package/one/things/agents/agent-quality.md +149 -19
- package/one/things/agents/agent-sales.md +95 -7
- package/one/things/cascade/cascade.yaml +20 -3
- package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +53 -0
- package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +50 -0
- package/one/things/cascade/docs/examples/1-1-agent-prompts.md +76 -0
- package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +49 -3
- package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +45 -0
- package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +32 -0
- package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +45 -3
- package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +44 -0
- package/one/things/cascade/docs/examples/1-3-event-coordination.md +40 -1
- package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +81 -25
- package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +41 -0
- package/one/things/cascade/docs/examples/1-4-knowledge-management.md +91 -16
- package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +136 -73
- package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +43 -0
- package/one/things/cascade/docs/examples/1-5-quality-loops.md +88 -4
- package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +52 -3
- package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +44 -1
- package/one/things/cascade/docs/examples/1-6-numbering-structure.md +78 -14
- package/one/things/cascade/docs/examples/readme.md +37 -0
- package/one/things/cascade/docs/getting-started.md +18 -0
- package/one/things/cascade/docs/workflow.md +18 -12
- package/one/things/cascade/readme.md +43 -0
- package/one/things/cascade/templates/feature-template.md +28 -6
- package/one/things/claude/agents/advocacy-activation-manager.md +64 -39
- package/one/things/claude/agents/advocacy-campaign-designer.md +64 -39
- package/one/things/claude/agents/analyst.md +64 -39
- package/one/things/claude/agents/architect.md +64 -39
- package/one/things/claude/agents/brand-identity-specialist.md +64 -39
- package/one/things/claude/agents/bstp-token-strategist.md +48 -25
- package/one/things/claude/agents/builder-repo.md +69 -26
- package/one/things/claude/agents/bullstamp-community-builder.md +48 -25
- package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +48 -25
- package/one/things/claude/agents/bulltilt-platform-growth.md +48 -25
- package/one/things/claude/agents/company-bullstamp-character.md +45 -30
- package/one/things/claude/agents/company-bullstamp-community.md +45 -30
- package/one/things/claude/agents/company-bullstamp-marketing.md +45 -30
- package/one/things/claude/agents/company-bullstamp-token.md +45 -30
- package/one/things/claude/agents/company-bulltilt-growth.md +45 -30
- package/one/things/claude/agents/content-bibliography-formatter.md +48 -25
- package/one/things/claude/agents/content-calendar-planner.md +59 -34
- package/one/things/claude/agents/content-chapter-formatter.md +60 -35
- package/one/things/claude/agents/content-formatter.md +59 -34
- package/one/things/claude/agents/content-hook-specialist.md +54 -31
- package/one/things/claude/agents/content-image-formatter.md +59 -34
- package/one/things/claude/agents/content-introduction-formatter.md +59 -34
- package/one/things/claude/agents/content-multiplication-engine.md +54 -31
- package/one/things/claude/agents/content-playbook-writer.md +60 -35
- package/one/things/claude/agents/content-team-manager.md +59 -34
- package/one/things/claude/agents/content-toc-formatter.md +60 -35
- package/one/things/claude/agents/convex-backend-specialist.md +380 -216
- package/one/things/claude/agents/core-manager.md +59 -34
- package/one/things/claude/agents/core-master.md +55 -32
- package/one/things/claude/agents/cross-functional-manager.md +46 -41
- package/one/things/claude/agents/crypto-airdrop-strategist.md +74 -54
- package/one/things/claude/agents/crypto-analytics-educator.md +73 -30
- package/one/things/claude/agents/crypto-architecture-specialist.md +70 -39
- package/one/things/claude/agents/crypto-community-analyst.md +47 -31
- package/one/things/claude/agents/crypto-community-psychologist.md +68 -31
- package/one/things/claude/agents/crypto-dex-optimization-expert.md +72 -31
- package/one/things/claude/agents/crypto-dex-optimizer.md +45 -30
- package/one/things/claude/agents/crypto-diamond-formation-specialist.md +69 -30
- package/one/things/claude/agents/crypto-diamond-hands.md +45 -30
- package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +73 -30
- package/one/things/claude/agents/crypto-engagement-specialist.md +71 -30
- package/one/things/claude/agents/crypto-market-researcher.md +45 -30
- package/one/things/claude/agents/crypto-marketing-orchestrator.md +74 -34
- package/one/things/claude/agents/crypto-network-effect-amplifier.md +75 -30
- package/one/things/claude/agents/crypto-optimization-analyst.md +73 -30
- package/one/things/claude/agents/crypto-strategic-synthesizer.md +69 -30
- package/one/things/claude/agents/crypto-team-manager.md +45 -40
- package/one/things/claude/agents/crypto-token-analyst.md +66 -25
- package/one/things/claude/agents/crypto-viral-content-creator.md +64 -61
- package/one/things/claude/agents/crypto-wallet-identification-expert.md +61 -51
- package/one/things/claude/agents/crypto-wallet-identifier.md +45 -30
- package/one/things/claude/agents/customer-journey-designer.md +51 -58
- package/one/things/claude/agents/customer-success-manager.md +51 -58
- package/one/things/claude/agents/dev.md +51 -58
- package/one/things/claude/agents/documenter.md +71 -69
- package/one/things/claude/agents/elevate-marketing-orchestrator.md +45 -52
- package/one/things/claude/agents/engagement-specialist.md +45 -52
- package/one/things/claude/agents/engineering-architect.md +54 -54
- package/one/things/claude/agents/engineering-business-analyst.md +46 -56
- package/one/things/claude/agents/engineering-developer.md +51 -52
- package/one/things/claude/agents/engineering-director.md +65 -25
- package/one/things/claude/agents/engineering-ingestor.md +110 -100
- package/one/things/claude/agents/engineering-product-manager.md +43 -55
- package/one/things/claude/agents/engineering-product-owner.md +46 -56
- package/one/things/claude/agents/engineering-project-coordinator.md +44 -56
- package/one/things/claude/agents/engineering-quality-assurance.md +53 -54
- package/one/things/claude/agents/engineering-team-manager.md +46 -43
- package/one/things/claude/agents/engineering-user-experience.md +51 -52
- package/one/things/claude/agents/framework-elevate-manager.md +45 -30
- package/one/things/claude/agents/improver.md +120 -78
- package/one/things/claude/agents/intelligence-team-manager.md +45 -40
- package/one/things/claude/agents/lead-capture-expert.md +45 -52
- package/one/things/claude/agents/lead-magnet-creator.md +45 -52
- package/one/things/claude/agents/market-research-analyst.md +48 -25
- package/one/things/claude/agents/marketing-brand-identity.md +57 -27
- package/one/things/claude/agents/marketing-content-hooks.md +45 -40
- package/one/things/claude/agents/marketing-content-multiplier.md +45 -40
- package/one/things/claude/agents/marketing-content-poster.md +71 -60
- package/one/things/claude/agents/marketing-customer-journey.md +45 -40
- package/one/things/claude/agents/marketing-director.md +46 -41
- package/one/things/claude/agents/marketing-engagement.md +45 -40
- package/one/things/claude/agents/marketing-lead-capture.md +45 -40
- package/one/things/claude/agents/marketing-lead-magnet.md +45 -40
- package/one/things/claude/agents/marketing-network-effects.md +45 -40
- package/one/things/claude/agents/marketing-nurture-campaigns.md +45 -40
- package/one/things/claude/agents/marketing-share-optimizer.md +45 -40
- package/one/things/claude/agents/marketing-team-manager.md +45 -40
- package/one/things/claude/agents/marketing-viral-growth.md +49 -18
- package/one/things/claude/agents/mission-commander.md +45 -40
- package/one/things/claude/agents/network-effect-analyst.md +48 -31
- package/one/things/claude/agents/nextjs-15-specialist.md +209 -122
- package/one/things/claude/agents/npx.md +126 -70
- package/one/things/claude/agents/nurture-campaign-manager.md +48 -25
- package/one/things/claude/agents/one-master.md +48 -25
- package/one/things/claude/agents/one-orchestrator.md +57 -27
- package/one/things/claude/agents/one.md +88 -31
- package/one/things/claude/agents/playbook-generator.md +48 -25
- package/one/things/claude/agents/pm.md +48 -25
- package/one/things/claude/agents/po.md +51 -26
- package/one/things/claude/agents/qa.md +50 -25
- package/one/things/claude/agents/research-foundation-analyst.md +48 -31
- package/one/things/claude/agents/research-intelligence-gatherer.md +59 -32
- package/one/things/claude/agents/research-market-analyst.md +47 -30
- package/one/things/claude/agents/research-team-manager.md +47 -40
- package/one/things/claude/agents/sales-environment-optimizer.md +50 -25
- package/one/things/claude/agents/sales-team-manager.md +47 -40
- package/one/things/claude/agents/sales-upsell-strategist.md +47 -30
- package/one/things/claude/agents/service-advocacy-campaigns.md +47 -30
- package/one/things/claude/agents/service-advocacy-manager.md +47 -30
- package/one/things/claude/agents/service-success-manager.md +47 -30
- package/one/things/claude/agents/service-team-manager.md +45 -40
- package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +85 -30
- package/one/things/claude/agents/share-optimization-specialist.md +50 -25
- package/one/things/claude/agents/sm.md +50 -25
- package/one/things/claude/agents/story-teller.md +51 -26
- package/one/things/claude/agents/task-master.md +52 -27
- package/one/things/claude/agents/tauri-cross-platform-specialist.md +201 -116
- package/one/things/claude/agents/tester.md +85 -46
- package/one/things/claude/agents/the-bull-character-manager.md +48 -25
- package/one/things/claude/agents/tools-playbook-generator.md +43 -40
- package/one/things/claude/agents/turbo-repo-builder.md +57 -27
- package/one/things/claude/agents/upsell-strategist.md +48 -25
- package/one/things/claude/agents/ux-expert.md +50 -25
- package/one/things/claude/agents/viral-growth-orchestrator.md +50 -27
- package/one/things/claude/commands/agent.md +25 -5
- package/one/things/claude/commands/cascade-status.md +33 -8
- package/one/things/claude/commands/ingest.md +64 -11
- package/one/things/claude/commands/ingestor.md +29 -7
- package/one/things/claude/commands/mission.md +24 -4
- package/one/things/claude/commands/npx.md +30 -7
- package/one/things/claude/commands/one.md +114 -68
- package/one/things/claude/commands/quality-check.md +72 -24
- package/one/things/claude/commands/smart-route.md +45 -4
- package/one/things/claude/commands/start.md +22 -4
- package/one/things/claude/commands/story.md +25 -5
- package/one/things/claude/commands/task.md +21 -1
- package/one/things/cli/cli-code.md +244 -219
- package/one/things/cli/cli-compiler-code.md +244 -219
- package/one/things/cli/cli.md +30 -6
- package/one/things/components/card-shadcn.md +252 -228
- package/one/things/components/card.md +315 -324
- package/one/things/components.md +667 -593
- package/one/things/componets.md +16 -1
- package/one/things/creator-diagram.md +23 -5
- package/one/things/demo-accessibility-animations.md +73 -47
- package/one/things/demo-components.md +225 -219
- package/one/things/demo-design-summary.md +89 -26
- package/one/things/demo-design-system.md +184 -130
- package/one/things/demo-page-layouts.md +52 -25
- package/one/things/designs/accessibility-audit.md +153 -66
- package/one/things/designs/component-specifications.md +163 -65
- package/one/things/designs/design-overview.md +81 -22
- package/one/things/designs/design-tokens.md +127 -93
- package/one/things/designs/wireframes-dashboard.md +64 -7
- package/one/things/docs/api-requests.md +75 -11
- package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +18 -0
- package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +57 -0
- package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +62 -6
- package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +60 -5
- package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +95 -27
- package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +130 -62
- package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +43 -19
- package/one/things/docs/ecommerce/QUICK-START.md +41 -4
- package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +75 -6
- package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +58 -24
- package/one/things/examples/children/lemonade-stand.md +52 -14
- package/one/things/examples/enterprise/crm-saas.md +43 -28
- package/one/things/features/1-1-agent-prompts.md +76 -0
- package/one/things/features/1-2-yaml-orchestrator.md +32 -0
- package/one/things/features/1-3-event-coordination.md +40 -1
- package/one/things/features/1-4-knowledge-management.md +91 -16
- package/one/things/features/1-5-quality-loops.md +88 -4
- package/one/things/features/1-6-numbering-structure.md +78 -14
- package/one/things/features/2-1-dataprovider-interface.md +311 -86
- package/one/things/features/2-2-config-system.md +307 -140
- package/one/things/features/2-3-effectts-services.md +263 -116
- package/one/things/features/2-4-react-hooks.md +217 -201
- package/one/things/features/2-5-auth-migration.md +406 -308
- package/one/things/features/2-6-dashboard-migration.md +112 -13
- package/one/things/features/2-7-alternative-providers.md +138 -65
- package/one/things/features/2-7-implementation-report.md +68 -24
- package/one/things/features/2-cli.md +88 -76
- package/one/things/features/2-design.md +112 -80
- package/one/things/features/2-tests.md +56 -0
- package/one/things/features/AUTH_HOOKS_IMPLEMENTATION.md +91 -36
- package/one/things/features/DECOUPLING.md +36 -18
- package/one/things/features/DEPLOYMENT.md +22 -4
- package/one/things/features/IMPLEMENTATION_SUMMARY.md +48 -2
- package/one/things/features/improve.md +47 -29
- package/one/things/features/remove-convex-deps.md +18 -0
- package/one/things/features/top-features.md +28 -20
- package/one/things/features/use-one-backend.md +210 -173
- package/one/things/features-in-english.md +19 -6
- package/one/things/files.yaml +721 -0
- package/one/things/ideas/1-create-workflow.md +18 -0
- package/one/things/ideas/2-backend-agnostic-frontend.md +57 -2
- package/one/things/implementation/backend-guide.md +64 -19
- package/one/things/interface.md +43 -0
- package/one/things/landing-page-implementation.md +455 -0
- package/one/things/legal/README.md +44 -0
- package/one/things/legal/privacy-policy.md +186 -23
- package/one/things/legal/terms-of-service.md +164 -3
- package/one/things/master-workflow-plan.md +806 -0
- package/one/things/plans/0-timeline.md +36 -0
- package/one/things/plans/1-create-workflow.md +19 -0
- package/one/things/plans/QUICK-START-SIMPLIFICATION.md +333 -0
- package/one/things/plans/README-SIMPLIFICATION.md +349 -0
- package/one/things/plans/SIMPLIFICATION-EXAMPLES.md +16 -0
- package/one/things/plans/SIMPLIFICATION-SUMMARY.md +455 -0
- package/one/things/plans/ai-elements.md +21 -2
- package/one/things/plans/ai-integration.md +108 -59
- package/one/things/plans/ai-sdk.md +85 -48
- package/one/things/plans/ai-tools.md +621 -0
- package/one/things/plans/app.md +142 -71
- package/one/things/plans/architecture-summary.md +34 -5
- package/one/things/plans/async-ai-agents.md +19 -1
- package/one/things/plans/backend-agnostic-frontend.md +70 -8
- package/one/things/plans/backend-cleanup-quickstart.md +52 -18
- package/one/things/plans/backend-ontology-conformance.md +110 -51
- package/one/things/plans/backend-status.md +58 -0
- package/one/things/plans/backend-structure.md +103 -55
- package/one/things/plans/backend-target-structure.md +61 -17
- package/one/things/plans/backend.md +60 -18
- package/one/things/plans/better-auth-any-backend-revised.md +325 -287
- package/one/things/plans/better-auth-any-backend.md +575 -531
- package/one/things/plans/better-auth-available-features.md +43 -5
- package/one/things/plans/big-plan.md +20 -6
- package/one/things/plans/cli-updates-required.md +44 -4
- package/one/things/plans/complete-step-by-step.md +223 -116
- package/one/things/plans/components.md +709 -0
- package/one/things/plans/convex-agents.md +79 -50
- package/one/things/plans/convex-better-auth.md +186 -154
- package/one/things/plans/convex-on-off.md +47 -29
- package/one/things/plans/crypto-token-researcher.md +629 -0
- package/one/things/plans/data-quality-metrics.md +745 -0
- package/one/things/plans/deep-researcher-agent.md +466 -0
- package/one/things/plans/deploy-to-cloudflare.md +55 -13
- package/one/things/plans/deployment-architecture.md +54 -11
- package/one/things/plans/desktop.md +21 -3
- package/one/things/plans/development-plan.md +184 -121
- package/one/things/plans/development-workflow-tldr.md +207 -0
- package/one/things/plans/development-workflow.md +959 -0
- package/one/things/plans/effect-components.md +667 -593
- package/one/things/plans/effect-patterns-reference.md +2235 -0
- package/one/things/plans/effect.md +204 -131
- package/one/things/plans/email.md +21 -8
- package/one/things/plans/enhance-auth.md +64 -41
- package/one/things/plans/execution-strategy.md +1291 -0
- package/one/things/plans/existing-infrastructure.md +712 -0
- package/one/things/plans/feature-based-sites.md +124 -51
- package/one/things/plans/frontend-effects.md +1276 -0
- package/one/things/plans/group-folder-multi-tenancy.md +92 -29
- package/one/things/plans/improve-codebase.md +498 -421
- package/one/things/plans/install-components.md +18 -1
- package/one/things/plans/integrate-frontend-and-backend.md +68 -44
- package/one/things/plans/landing.md +92 -0
- package/one/things/plans/layout.md +45 -1
- package/one/things/plans/mail-backend.md +546 -493
- package/one/things/plans/mail.md +379 -326
- package/one/things/plans/mcp-clear-context-prompt.md +21 -0
- package/one/things/plans/mcp-simple.md +20 -0
- package/one/things/plans/multi-ontology-architecture.md +115 -66
- package/one/things/plans/next-features.md +31 -0
- package/one/things/plans/onboarding.md +20 -1
- package/one/things/plans/one.md +18 -0
- package/one/things/plans/ontology-6-dimensions.md +24 -45
- package/one/things/plans/ontology-compliance-audit.md +315 -0
- package/one/things/plans/ontology-driven-strategy.md +19 -3
- package/one/things/plans/ontology-refine.md +586 -0
- package/one/things/plans/ontology-ui-approach.md +18 -0
- package/one/things/plans/open-agent.md +152 -97
- package/one/things/plans/performace.md +32 -0
- package/one/things/plans/phase-1-foundation.md +620 -0
- package/one/things/plans/phase-3-implementation.md +1037 -0
- package/one/things/plans/quick-wins.md +342 -187
- package/one/things/plans/readme-backend-cleanup.md +54 -13
- package/one/things/plans/release.md +55 -2
- package/one/things/plans/repos.md +22 -0
- package/one/things/plans/separate-copy-2.md +127 -71
- package/one/things/plans/separate-copy-3.md +35 -14
- package/one/things/plans/separate-copy.md +127 -71
- package/one/things/plans/separate-demo.md +37 -3
- package/one/things/plans/separate.md +24 -6
- package/one/things/plans/sequence.md +155 -12
- package/one/things/plans/shadcn-integration-summary.md +104 -44
- package/one/things/plans/sidebar.md +44 -10
- package/one/things/plans/skills.md +103 -0
- package/one/things/plans/small-fixes.md +19 -1
- package/one/things/plans/start-new.md +34 -8
- package/one/things/plans/switch-off-auth.md +22 -0
- package/one/things/plans/sync-checklist.md +30 -0
- package/one/things/plans/test-backend-connection.md +38 -0
- package/one/things/plans/unified-implementation-plan.md +144 -62
- package/one/things/plans/update-demos.md +103 -35
- package/one/things/plans/use-our-backend.md +572 -0
- package/one/things/plans/wave1-onboarding-100-inferences.md +1686 -0
- package/one/things/plans/wave1-onboarding-vision.md +744 -0
- package/one/things/plans/wave1-orchestration-summary.md +604 -0
- package/one/things/plans/wave1-specialist-assignments.md +1413 -0
- package/one/things/plans/workflow-files.md +28 -14
- package/one/things/plans/workflow.md +18 -12
- package/one/things/products/cascade-landing-page.md +150 -46
- package/one/things/products/cascade.md +185 -135
- package/one/things/products/context-engineering.md +411 -350
- package/one/things/products/onthology.md +15 -0
- package/one/things/products/ontology-ui-shadcn.md +375 -353
- package/one/things/products/ontology-ui.md +101 -59
- package/one/things/products/ontology.md +90 -18
- package/one/things/products/sdk.md +181 -165
- package/one/things/promptkit.md +70 -43
- package/one/things/repos/all-repos.md +0 -0
- package/one/things/service-providers-new.md +95 -25
- package/one/things/service-providers.md +231 -202
- package/one/things/structure.md +532 -0
- package/one/things/system.md +18 -0
- package/one/things/templates.md +40 -0
- package/one/things/tests/2-1-dataprovider-interface.md +103 -31
- package/one/things/tests/2-1-test-analysis.md +65 -17
- package/one/things/things.md +48 -13
- package/one/things/todo-acp-integration.md +744 -0
- package/one/things/todo-ai.md +933 -0
- package/one/things/todo-api.md +1078 -0
- package/one/things/todo-assignment.md +580 -0
- package/one/things/todo-buy-chatgpt.md +1450 -0
- package/one/things/todo-components.md +1683 -0
- package/one/things/todo-connections.md +278 -0
- package/one/things/todo-ecommerce-frontend.md +1313 -0
- package/one/things/todo-ecommerce.md +569 -0
- package/one/things/todo-effects.md +1075 -0
- package/one/things/todo-frontend-effects.md +977 -0
- package/one/things/todo-landing-page.md +1091 -0
- package/one/things/todo-mail.md +1160 -0
- package/one/things/todo-master-plan.md +490 -0
- package/one/things/todo-onboard.md +666 -0
- package/one/things/todo-one-ie.md +538 -0
- package/one/things/todo-page.md +606 -0
- package/one/things/todo-plans.md +282 -0
- package/one/things/todo-projects.md +241 -0
- package/one/things/todo-refactoring-plan.md +366 -0
- package/one/things/todo-sequence.md +1621 -0
- package/one/things/todo-use-our-backend.md +1908 -0
- package/one/things/todo-workflow.md +626 -0
- package/one/things/todo-x402.md +2047 -0
- package/one/things/todo.md +459 -1075
- package/one/things/video/scripts-crypto.md +835 -0
- package/one/things/video-script-ontology.md +334 -0
- package/package.json +1 -1
- package/one/knowledge/CLOUDFLARE_ENV_SETUP.md +0 -49
- package/one/knowledge/docs/flow.md +0 -0
- package/one/knowledge/documentation-summary.md +0 -285
- package/one/knowledge/inference-score.md +0 -159
- package/one/knowledge/ontology-frontend-copy-2.md +0 -1492
- package/one/knowledge/ontology-frontend-copy.md +0 -753
- package/one/knowledge/ontology-migration-guide.md +0 -811
- package/one/things/features/0 All Features.md +0 -2
- package/one/things/plans/1-create-workflow-status.md +0 -555
- package/one/things/plans/2-backend-agnostic-frontend.md +0 -546
- package/one/things/plans/2-sites.md +0 -895
- package/one/things/plans/3-groups.md +0 -735
- package/one/things/plans/5-build-frontend.md +0 -0
- package/one/things/plans/5-complete.md +0 -17
- package/one/things/plans/agent-director-100-inference-plans.md +0 -410
- package/one/things/plans/dual-website-strategy.md +0 -612
- package/one/things/plans/releases.md +0 -809
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Mail Backend
|
|
3
|
+
dimension: things
|
|
4
|
+
category: plans
|
|
5
|
+
tags: ai, architecture, artificial-intelligence, backend, convex, frontend
|
|
6
|
+
related_dimensions: events, knowledge
|
|
7
|
+
scope: global
|
|
8
|
+
created: 2025-11-03
|
|
9
|
+
updated: 2025-11-03
|
|
10
|
+
version: 1.0.0
|
|
11
|
+
ai_context: |
|
|
12
|
+
This document is part of the things dimension in the plans category.
|
|
13
|
+
Location: one/things/plans/mail-backend.md
|
|
14
|
+
Purpose: Documents mail backend implementation plan
|
|
15
|
+
Related dimensions: events, knowledge
|
|
16
|
+
For AI agents: Read this to understand mail backend.
|
|
17
|
+
---
|
|
18
|
+
|
|
1
19
|
# Mail Backend Implementation Plan
|
|
2
20
|
|
|
3
21
|
**Goal:** Add complete email functionality to `mail.astro` using Resend, Convex, and Effect.ts to create a fully functional email client.
|
|
@@ -49,6 +67,7 @@
|
|
|
49
67
|
### 1.1 Things (Entities)
|
|
50
68
|
|
|
51
69
|
**Email Entity:**
|
|
70
|
+
|
|
52
71
|
```typescript
|
|
53
72
|
// In things table
|
|
54
73
|
{
|
|
@@ -92,6 +111,7 @@
|
|
|
92
111
|
```
|
|
93
112
|
|
|
94
113
|
**Email Template Entity:**
|
|
114
|
+
|
|
95
115
|
```typescript
|
|
96
116
|
{
|
|
97
117
|
_id: Id<"things">,
|
|
@@ -113,6 +133,7 @@
|
|
|
113
133
|
### 1.2 Connections
|
|
114
134
|
|
|
115
135
|
**Email Relationships:**
|
|
136
|
+
|
|
116
137
|
```typescript
|
|
117
138
|
// Sender → Email (who sent it)
|
|
118
139
|
{
|
|
@@ -142,6 +163,7 @@
|
|
|
142
163
|
### 1.3 Events
|
|
143
164
|
|
|
144
165
|
**Email Lifecycle Events:**
|
|
166
|
+
|
|
145
167
|
```typescript
|
|
146
168
|
// Email drafted
|
|
147
169
|
{
|
|
@@ -212,6 +234,7 @@
|
|
|
212
234
|
### 1.4 Tags
|
|
213
235
|
|
|
214
236
|
**Email Categories:**
|
|
237
|
+
|
|
215
238
|
```typescript
|
|
216
239
|
// Tag for categorization
|
|
217
240
|
{
|
|
@@ -239,318 +262,330 @@
|
|
|
239
262
|
**File:** `convex/services/email/email.ts`
|
|
240
263
|
|
|
241
264
|
```typescript
|
|
242
|
-
import { Effect } from "effect"
|
|
243
|
-
import { ConvexDatabase } from "../providers/convex"
|
|
244
|
-
import { ResendProvider } from "../providers/resend"
|
|
245
|
-
|
|
246
|
-
export class EmailService extends Effect.Service<EmailService>()(
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
const emailId = yield* Effect.tryPromise(() =>
|
|
266
|
-
db.insert("things", {
|
|
267
|
-
type: "email",
|
|
268
|
-
name: args.subject,
|
|
269
|
-
status: "draft",
|
|
270
|
-
createdAt: Date.now(),
|
|
271
|
-
updatedAt: Date.now(),
|
|
272
|
-
properties: {
|
|
273
|
-
from: user.properties.email,
|
|
274
|
-
fromName: user.properties.name,
|
|
275
|
-
to: args.to,
|
|
276
|
-
cc: args.cc,
|
|
277
|
-
bcc: args.bcc,
|
|
278
|
-
subject: args.subject,
|
|
279
|
-
bodyHtml: args.bodyHtml,
|
|
280
|
-
bodyText: args.bodyText,
|
|
281
|
-
folder: "drafts",
|
|
282
|
-
read: true,
|
|
283
|
-
starred: false,
|
|
284
|
-
labels: args.labels || [],
|
|
285
|
-
}
|
|
286
|
-
})
|
|
287
|
-
)
|
|
288
|
-
|
|
289
|
-
// 3. Create connection (user authored email)
|
|
290
|
-
yield* Effect.tryPromise(() =>
|
|
291
|
-
db.insert("connections", {
|
|
292
|
-
fromThingId: args.userId,
|
|
293
|
-
toThingId: emailId,
|
|
294
|
-
relationshipType: "sent_email",
|
|
295
|
-
createdAt: Date.now()
|
|
296
|
-
})
|
|
297
|
-
)
|
|
298
|
-
|
|
299
|
-
// 4. Log event
|
|
300
|
-
yield* Effect.tryPromise(() =>
|
|
301
|
-
db.insert("events", {
|
|
302
|
-
thingId: emailId,
|
|
303
|
-
eventType: "email_drafted",
|
|
304
|
-
timestamp: Date.now(),
|
|
305
|
-
actorType: "user",
|
|
306
|
-
actorId: args.userId,
|
|
307
|
-
metadata: { folder: "drafts" }
|
|
308
|
-
})
|
|
309
|
-
)
|
|
310
|
-
|
|
311
|
-
return emailId
|
|
312
|
-
}),
|
|
313
|
-
|
|
314
|
-
// Send email
|
|
315
|
-
send: (args: SendEmailArgs) =>
|
|
316
|
-
Effect.gen(function* () {
|
|
317
|
-
// 1. Get email
|
|
318
|
-
const email = yield* Effect.tryPromise(() => db.get(args.emailId))
|
|
319
|
-
if (!email) {
|
|
320
|
-
return yield* Effect.fail({
|
|
321
|
-
_tag: "EmailNotFound",
|
|
322
|
-
message: "Email not found"
|
|
323
|
-
})
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
// 2. Update status to sending
|
|
327
|
-
yield* Effect.tryPromise(() =>
|
|
328
|
-
db.patch(args.emailId, {
|
|
329
|
-
status: "sent",
|
|
330
|
-
updatedAt: Date.now(),
|
|
331
|
-
properties: {
|
|
332
|
-
...email.properties,
|
|
333
|
-
folder: "sent"
|
|
334
|
-
}
|
|
335
|
-
})
|
|
336
|
-
)
|
|
337
|
-
|
|
338
|
-
// 3. Schedule actual send via action (async)
|
|
339
|
-
yield* Effect.promise(() =>
|
|
340
|
-
db.scheduler.runAfter(0, internal.email.sendEmailAction, {
|
|
341
|
-
emailId: args.emailId
|
|
342
|
-
})
|
|
343
|
-
)
|
|
344
|
-
|
|
345
|
-
// 4. Log event
|
|
346
|
-
yield* Effect.tryPromise(() =>
|
|
347
|
-
db.insert("events", {
|
|
348
|
-
thingId: args.emailId,
|
|
349
|
-
eventType: "email_sent",
|
|
350
|
-
timestamp: Date.now(),
|
|
351
|
-
actorType: "user",
|
|
352
|
-
actorId: args.userId,
|
|
353
|
-
metadata: {
|
|
354
|
-
recipients: email.properties.to,
|
|
355
|
-
subject: email.properties.subject
|
|
356
|
-
}
|
|
357
|
-
})
|
|
358
|
-
)
|
|
359
|
-
|
|
360
|
-
return { success: true, emailId: args.emailId }
|
|
361
|
-
}),
|
|
362
|
-
|
|
363
|
-
// List emails by folder
|
|
364
|
-
listByFolder: (args: ListByFolderArgs) =>
|
|
365
|
-
Effect.gen(function* () {
|
|
366
|
-
const emails = yield* Effect.tryPromise(() =>
|
|
367
|
-
db.query("things")
|
|
368
|
-
.withIndex("type", q => q.eq("type", "email"))
|
|
369
|
-
.filter(q =>
|
|
370
|
-
q.eq(q.field("properties.folder"), args.folder)
|
|
371
|
-
)
|
|
372
|
-
.order("desc")
|
|
373
|
-
.collect()
|
|
374
|
-
)
|
|
375
|
-
|
|
376
|
-
return emails
|
|
377
|
-
}),
|
|
378
|
-
|
|
379
|
-
// Search emails
|
|
380
|
-
search: (args: SearchEmailArgs) =>
|
|
381
|
-
Effect.gen(function* () {
|
|
382
|
-
const allEmails = yield* Effect.tryPromise(() =>
|
|
383
|
-
db.query("things")
|
|
384
|
-
.withIndex("type", q => q.eq("type", "email"))
|
|
385
|
-
.collect()
|
|
386
|
-
)
|
|
387
|
-
|
|
388
|
-
// Filter by search query
|
|
389
|
-
const query = args.query.toLowerCase()
|
|
390
|
-
const filtered = allEmails.filter(email =>
|
|
391
|
-
email.properties.subject.toLowerCase().includes(query) ||
|
|
392
|
-
email.properties.bodyText.toLowerCase().includes(query) ||
|
|
393
|
-
email.properties.fromName.toLowerCase().includes(query) ||
|
|
394
|
-
email.properties.from.toLowerCase().includes(query)
|
|
395
|
-
)
|
|
396
|
-
|
|
397
|
-
return filtered
|
|
398
|
-
}),
|
|
399
|
-
|
|
400
|
-
// Archive email
|
|
401
|
-
archive: (args: ArchiveEmailArgs) =>
|
|
402
|
-
Effect.gen(function* () {
|
|
403
|
-
const email = yield* Effect.tryPromise(() => db.get(args.emailId))
|
|
404
|
-
if (!email) {
|
|
405
|
-
return yield* Effect.fail({
|
|
406
|
-
_tag: "EmailNotFound",
|
|
407
|
-
message: "Email not found"
|
|
408
|
-
})
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
yield* Effect.tryPromise(() =>
|
|
412
|
-
db.patch(args.emailId, {
|
|
413
|
-
updatedAt: Date.now(),
|
|
414
|
-
properties: {
|
|
415
|
-
...email.properties,
|
|
416
|
-
folder: "archive"
|
|
417
|
-
}
|
|
418
|
-
})
|
|
419
|
-
)
|
|
420
|
-
|
|
421
|
-
// Log event
|
|
422
|
-
yield* Effect.tryPromise(() =>
|
|
423
|
-
db.insert("events", {
|
|
424
|
-
thingId: args.emailId,
|
|
425
|
-
eventType: "email_archived",
|
|
426
|
-
timestamp: Date.now(),
|
|
427
|
-
actorType: "user",
|
|
428
|
-
actorId: args.userId,
|
|
429
|
-
metadata: {}
|
|
430
|
-
})
|
|
431
|
-
)
|
|
265
|
+
import { Effect } from "effect";
|
|
266
|
+
import { ConvexDatabase } from "../providers/convex";
|
|
267
|
+
import { ResendProvider } from "../providers/resend";
|
|
268
|
+
|
|
269
|
+
export class EmailService extends Effect.Service<EmailService>()(
|
|
270
|
+
"EmailService",
|
|
271
|
+
{
|
|
272
|
+
effect: Effect.gen(function* () {
|
|
273
|
+
const db = yield* ConvexDatabase;
|
|
274
|
+
const resend = yield* ResendProvider;
|
|
275
|
+
|
|
276
|
+
return {
|
|
277
|
+
// Create draft email
|
|
278
|
+
createDraft: (args: CreateDraftArgs) =>
|
|
279
|
+
Effect.gen(function* () {
|
|
280
|
+
// 1. Validate user
|
|
281
|
+
const user = yield* Effect.tryPromise(() => db.get(args.userId));
|
|
282
|
+
if (!user) {
|
|
283
|
+
return yield* Effect.fail({
|
|
284
|
+
_tag: "UserNotFound",
|
|
285
|
+
message: "User not found",
|
|
286
|
+
});
|
|
287
|
+
}
|
|
432
288
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
289
|
+
// 2. Create email entity
|
|
290
|
+
const emailId = yield* Effect.tryPromise(() =>
|
|
291
|
+
db.insert("things", {
|
|
292
|
+
type: "email",
|
|
293
|
+
name: args.subject,
|
|
294
|
+
status: "draft",
|
|
295
|
+
createdAt: Date.now(),
|
|
296
|
+
updatedAt: Date.now(),
|
|
297
|
+
properties: {
|
|
298
|
+
from: user.properties.email,
|
|
299
|
+
fromName: user.properties.name,
|
|
300
|
+
to: args.to,
|
|
301
|
+
cc: args.cc,
|
|
302
|
+
bcc: args.bcc,
|
|
303
|
+
subject: args.subject,
|
|
304
|
+
bodyHtml: args.bodyHtml,
|
|
305
|
+
bodyText: args.bodyText,
|
|
306
|
+
folder: "drafts",
|
|
307
|
+
read: true,
|
|
308
|
+
starred: false,
|
|
309
|
+
labels: args.labels || [],
|
|
310
|
+
},
|
|
311
|
+
}),
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
// 3. Create connection (user authored email)
|
|
315
|
+
yield* Effect.tryPromise(() =>
|
|
316
|
+
db.insert("connections", {
|
|
317
|
+
fromThingId: args.userId,
|
|
318
|
+
toThingId: emailId,
|
|
319
|
+
relationshipType: "sent_email",
|
|
320
|
+
createdAt: Date.now(),
|
|
321
|
+
}),
|
|
322
|
+
);
|
|
323
|
+
|
|
324
|
+
// 4. Log event
|
|
325
|
+
yield* Effect.tryPromise(() =>
|
|
326
|
+
db.insert("events", {
|
|
327
|
+
thingId: emailId,
|
|
328
|
+
eventType: "email_drafted",
|
|
329
|
+
timestamp: Date.now(),
|
|
330
|
+
actorType: "user",
|
|
331
|
+
actorId: args.userId,
|
|
332
|
+
metadata: { folder: "drafts" },
|
|
333
|
+
}),
|
|
334
|
+
);
|
|
335
|
+
|
|
336
|
+
return emailId;
|
|
337
|
+
}),
|
|
338
|
+
|
|
339
|
+
// Send email
|
|
340
|
+
send: (args: SendEmailArgs) =>
|
|
341
|
+
Effect.gen(function* () {
|
|
342
|
+
// 1. Get email
|
|
343
|
+
const email = yield* Effect.tryPromise(() => db.get(args.emailId));
|
|
344
|
+
if (!email) {
|
|
345
|
+
return yield* Effect.fail({
|
|
346
|
+
_tag: "EmailNotFound",
|
|
347
|
+
message: "Email not found",
|
|
348
|
+
});
|
|
349
|
+
}
|
|
456
350
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
351
|
+
// 2. Update status to sending
|
|
352
|
+
yield* Effect.tryPromise(() =>
|
|
353
|
+
db.patch(args.emailId, {
|
|
354
|
+
status: "sent",
|
|
355
|
+
updatedAt: Date.now(),
|
|
356
|
+
properties: {
|
|
357
|
+
...email.properties,
|
|
358
|
+
folder: "sent",
|
|
359
|
+
},
|
|
360
|
+
}),
|
|
361
|
+
);
|
|
362
|
+
|
|
363
|
+
// 3. Schedule actual send via action (async)
|
|
364
|
+
yield* Effect.promise(() =>
|
|
365
|
+
db.scheduler.runAfter(0, internal.email.sendEmailAction, {
|
|
366
|
+
emailId: args.emailId,
|
|
367
|
+
}),
|
|
368
|
+
);
|
|
369
|
+
|
|
370
|
+
// 4. Log event
|
|
371
|
+
yield* Effect.tryPromise(() =>
|
|
372
|
+
db.insert("events", {
|
|
373
|
+
thingId: args.emailId,
|
|
374
|
+
eventType: "email_sent",
|
|
375
|
+
timestamp: Date.now(),
|
|
376
|
+
actorType: "user",
|
|
377
|
+
actorId: args.userId,
|
|
378
|
+
metadata: {
|
|
379
|
+
recipients: email.properties.to,
|
|
380
|
+
subject: email.properties.subject,
|
|
381
|
+
},
|
|
382
|
+
}),
|
|
383
|
+
);
|
|
384
|
+
|
|
385
|
+
return { success: true, emailId: args.emailId };
|
|
386
|
+
}),
|
|
387
|
+
|
|
388
|
+
// List emails by folder
|
|
389
|
+
listByFolder: (args: ListByFolderArgs) =>
|
|
390
|
+
Effect.gen(function* () {
|
|
391
|
+
const emails = yield* Effect.tryPromise(() =>
|
|
392
|
+
db
|
|
393
|
+
.query("things")
|
|
394
|
+
.withIndex("type", (q) => q.eq("type", "email"))
|
|
395
|
+
.filter((q) => q.eq(q.field("properties.folder"), args.folder))
|
|
396
|
+
.order("desc")
|
|
397
|
+
.collect(),
|
|
398
|
+
);
|
|
399
|
+
|
|
400
|
+
return emails;
|
|
401
|
+
}),
|
|
402
|
+
|
|
403
|
+
// Search emails
|
|
404
|
+
search: (args: SearchEmailArgs) =>
|
|
405
|
+
Effect.gen(function* () {
|
|
406
|
+
const allEmails = yield* Effect.tryPromise(() =>
|
|
407
|
+
db
|
|
408
|
+
.query("things")
|
|
409
|
+
.withIndex("type", (q) => q.eq("type", "email"))
|
|
410
|
+
.collect(),
|
|
411
|
+
);
|
|
412
|
+
|
|
413
|
+
// Filter by search query
|
|
414
|
+
const query = args.query.toLowerCase();
|
|
415
|
+
const filtered = allEmails.filter(
|
|
416
|
+
(email) =>
|
|
417
|
+
email.properties.subject.toLowerCase().includes(query) ||
|
|
418
|
+
email.properties.bodyText.toLowerCase().includes(query) ||
|
|
419
|
+
email.properties.fromName.toLowerCase().includes(query) ||
|
|
420
|
+
email.properties.from.toLowerCase().includes(query),
|
|
421
|
+
);
|
|
422
|
+
|
|
423
|
+
return filtered;
|
|
424
|
+
}),
|
|
425
|
+
|
|
426
|
+
// Archive email
|
|
427
|
+
archive: (args: ArchiveEmailArgs) =>
|
|
428
|
+
Effect.gen(function* () {
|
|
429
|
+
const email = yield* Effect.tryPromise(() => db.get(args.emailId));
|
|
430
|
+
if (!email) {
|
|
431
|
+
return yield* Effect.fail({
|
|
432
|
+
_tag: "EmailNotFound",
|
|
433
|
+
message: "Email not found",
|
|
434
|
+
});
|
|
435
|
+
}
|
|
480
436
|
|
|
481
|
-
|
|
482
|
-
|
|
437
|
+
yield* Effect.tryPromise(() =>
|
|
438
|
+
db.patch(args.emailId, {
|
|
439
|
+
updatedAt: Date.now(),
|
|
440
|
+
properties: {
|
|
441
|
+
...email.properties,
|
|
442
|
+
folder: "archive",
|
|
443
|
+
},
|
|
444
|
+
}),
|
|
445
|
+
);
|
|
446
|
+
|
|
447
|
+
// Log event
|
|
448
|
+
yield* Effect.tryPromise(() =>
|
|
449
|
+
db.insert("events", {
|
|
450
|
+
thingId: args.emailId,
|
|
451
|
+
eventType: "email_archived",
|
|
452
|
+
timestamp: Date.now(),
|
|
453
|
+
actorType: "user",
|
|
454
|
+
actorId: args.userId,
|
|
455
|
+
metadata: {},
|
|
456
|
+
}),
|
|
457
|
+
);
|
|
458
|
+
|
|
459
|
+
return { success: true };
|
|
460
|
+
}),
|
|
461
|
+
|
|
462
|
+
// Delete email (move to trash)
|
|
463
|
+
delete: (args: DeleteEmailArgs) =>
|
|
464
|
+
Effect.gen(function* () {
|
|
465
|
+
const email = yield* Effect.tryPromise(() => db.get(args.emailId));
|
|
466
|
+
if (!email) {
|
|
467
|
+
return yield* Effect.fail({
|
|
468
|
+
_tag: "EmailNotFound",
|
|
469
|
+
message: "Email not found",
|
|
470
|
+
});
|
|
471
|
+
}
|
|
483
472
|
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
473
|
+
yield* Effect.tryPromise(() =>
|
|
474
|
+
db.patch(args.emailId, {
|
|
475
|
+
updatedAt: Date.now(),
|
|
476
|
+
properties: {
|
|
477
|
+
...email.properties,
|
|
478
|
+
folder: "trash",
|
|
479
|
+
},
|
|
480
|
+
}),
|
|
481
|
+
);
|
|
482
|
+
|
|
483
|
+
return { success: true };
|
|
484
|
+
}),
|
|
485
|
+
|
|
486
|
+
// Mark as read/unread
|
|
487
|
+
markRead: (args: MarkReadArgs) =>
|
|
488
|
+
Effect.gen(function* () {
|
|
489
|
+
const email = yield* Effect.tryPromise(() => db.get(args.emailId));
|
|
490
|
+
if (!email) {
|
|
491
|
+
return yield* Effect.fail({
|
|
492
|
+
_tag: "EmailNotFound",
|
|
493
|
+
message: "Email not found",
|
|
494
|
+
});
|
|
495
|
+
}
|
|
492
496
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
497
|
+
yield* Effect.tryPromise(() =>
|
|
498
|
+
db.patch(args.emailId, {
|
|
499
|
+
updatedAt: Date.now(),
|
|
500
|
+
properties: {
|
|
501
|
+
...email.properties,
|
|
502
|
+
read: args.read,
|
|
503
|
+
},
|
|
504
|
+
}),
|
|
505
|
+
);
|
|
506
|
+
|
|
507
|
+
return { success: true };
|
|
508
|
+
}),
|
|
509
|
+
|
|
510
|
+
// Get folder counts
|
|
511
|
+
getFolderCounts: (args: GetFolderCountsArgs) =>
|
|
512
|
+
Effect.gen(function* () {
|
|
513
|
+
const allEmails = yield* Effect.tryPromise(() =>
|
|
514
|
+
db
|
|
515
|
+
.query("things")
|
|
516
|
+
.withIndex("type", (q) => q.eq("type", "email"))
|
|
517
|
+
.collect(),
|
|
518
|
+
);
|
|
519
|
+
|
|
520
|
+
const counts = {
|
|
521
|
+
inbox: allEmails.filter((e) => e.properties.folder === "inbox")
|
|
522
|
+
.length,
|
|
523
|
+
sent: allEmails.filter((e) => e.properties.folder === "sent")
|
|
524
|
+
.length,
|
|
525
|
+
drafts: allEmails.filter((e) => e.properties.folder === "drafts")
|
|
526
|
+
.length,
|
|
527
|
+
trash: allEmails.filter((e) => e.properties.folder === "trash")
|
|
528
|
+
.length,
|
|
529
|
+
archive: allEmails.filter(
|
|
530
|
+
(e) => e.properties.folder === "archive",
|
|
531
|
+
).length,
|
|
532
|
+
junk: allEmails.filter((e) => e.properties.folder === "junk")
|
|
533
|
+
.length,
|
|
534
|
+
unread: allEmails.filter((e) => !e.properties.read).length,
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
return counts;
|
|
538
|
+
}),
|
|
539
|
+
};
|
|
540
|
+
}),
|
|
541
|
+
dependencies: [ConvexDatabase.Default, ResendProvider.Default],
|
|
542
|
+
},
|
|
543
|
+
) {}
|
|
509
544
|
|
|
510
545
|
// Type definitions
|
|
511
546
|
interface CreateDraftArgs {
|
|
512
|
-
userId: Id<"things"
|
|
513
|
-
to: string[]
|
|
514
|
-
cc?: string[]
|
|
515
|
-
bcc?: string[]
|
|
516
|
-
subject: string
|
|
517
|
-
bodyHtml: string
|
|
518
|
-
bodyText: string
|
|
519
|
-
labels?: string[]
|
|
547
|
+
userId: Id<"things">;
|
|
548
|
+
to: string[];
|
|
549
|
+
cc?: string[];
|
|
550
|
+
bcc?: string[];
|
|
551
|
+
subject: string;
|
|
552
|
+
bodyHtml: string;
|
|
553
|
+
bodyText: string;
|
|
554
|
+
labels?: string[];
|
|
520
555
|
}
|
|
521
556
|
|
|
522
557
|
interface SendEmailArgs {
|
|
523
|
-
emailId: Id<"things"
|
|
524
|
-
userId: Id<"things"
|
|
558
|
+
emailId: Id<"things">;
|
|
559
|
+
userId: Id<"things">;
|
|
525
560
|
}
|
|
526
561
|
|
|
527
562
|
interface ListByFolderArgs {
|
|
528
|
-
folder: "inbox" | "sent" | "drafts" | "trash" | "archive" | "junk"
|
|
529
|
-
userId: Id<"things"
|
|
563
|
+
folder: "inbox" | "sent" | "drafts" | "trash" | "archive" | "junk";
|
|
564
|
+
userId: Id<"things">;
|
|
530
565
|
}
|
|
531
566
|
|
|
532
567
|
interface SearchEmailArgs {
|
|
533
|
-
query: string
|
|
534
|
-
userId: Id<"things"
|
|
568
|
+
query: string;
|
|
569
|
+
userId: Id<"things">;
|
|
535
570
|
}
|
|
536
571
|
|
|
537
572
|
interface ArchiveEmailArgs {
|
|
538
|
-
emailId: Id<"things"
|
|
539
|
-
userId: Id<"things"
|
|
573
|
+
emailId: Id<"things">;
|
|
574
|
+
userId: Id<"things">;
|
|
540
575
|
}
|
|
541
576
|
|
|
542
577
|
interface DeleteEmailArgs {
|
|
543
|
-
emailId: Id<"things"
|
|
544
|
-
userId: Id<"things"
|
|
578
|
+
emailId: Id<"things">;
|
|
579
|
+
userId: Id<"things">;
|
|
545
580
|
}
|
|
546
581
|
|
|
547
582
|
interface MarkReadArgs {
|
|
548
|
-
emailId: Id<"things"
|
|
549
|
-
read: boolean
|
|
583
|
+
emailId: Id<"things">;
|
|
584
|
+
read: boolean;
|
|
550
585
|
}
|
|
551
586
|
|
|
552
587
|
interface GetFolderCountsArgs {
|
|
553
|
-
userId: Id<"things"
|
|
588
|
+
userId: Id<"things">;
|
|
554
589
|
}
|
|
555
590
|
```
|
|
556
591
|
|
|
@@ -559,49 +594,52 @@ interface GetFolderCountsArgs {
|
|
|
559
594
|
**File:** `convex/services/providers/resend.ts`
|
|
560
595
|
|
|
561
596
|
```typescript
|
|
562
|
-
import { Effect, Layer } from "effect"
|
|
563
|
-
import { Resend } from "@convex-dev/resend"
|
|
564
|
-
import { components } from "../../_generated/api"
|
|
565
|
-
|
|
566
|
-
export class ResendProvider extends Effect.Service<ResendProvider>()(
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
}
|
|
597
|
+
import { Effect, Layer } from "effect";
|
|
598
|
+
import { Resend } from "@convex-dev/resend";
|
|
599
|
+
import { components } from "../../_generated/api";
|
|
600
|
+
|
|
601
|
+
export class ResendProvider extends Effect.Service<ResendProvider>()(
|
|
602
|
+
"ResendProvider",
|
|
603
|
+
{
|
|
604
|
+
effect: Effect.gen(function* () {
|
|
605
|
+
const resend = new Resend(components.resend, { testMode: false });
|
|
606
|
+
|
|
607
|
+
return {
|
|
608
|
+
send: (args: ResendSendArgs) =>
|
|
609
|
+
Effect.tryPromise({
|
|
610
|
+
try: async () => {
|
|
611
|
+
const result = await resend.sendEmail(ctx, {
|
|
612
|
+
from: args.from,
|
|
613
|
+
to: args.to,
|
|
614
|
+
cc: args.cc,
|
|
615
|
+
bcc: args.bcc,
|
|
616
|
+
subject: args.subject,
|
|
617
|
+
html: args.html,
|
|
618
|
+
text: args.text,
|
|
619
|
+
});
|
|
620
|
+
return result;
|
|
621
|
+
},
|
|
622
|
+
catch: (error) => ({
|
|
623
|
+
_tag: "ResendError" as const,
|
|
624
|
+
message: error instanceof Error ? error.message : "Unknown error",
|
|
625
|
+
}),
|
|
626
|
+
}),
|
|
627
|
+
};
|
|
628
|
+
}),
|
|
629
|
+
},
|
|
630
|
+
) {}
|
|
593
631
|
|
|
594
632
|
interface ResendSendArgs {
|
|
595
|
-
from: string
|
|
596
|
-
to: string[]
|
|
597
|
-
cc?: string[]
|
|
598
|
-
bcc?: string[]
|
|
599
|
-
subject: string
|
|
600
|
-
html: string
|
|
601
|
-
text: string
|
|
633
|
+
from: string;
|
|
634
|
+
to: string[];
|
|
635
|
+
cc?: string[];
|
|
636
|
+
bcc?: string[];
|
|
637
|
+
subject: string;
|
|
638
|
+
html: string;
|
|
639
|
+
text: string;
|
|
602
640
|
}
|
|
603
641
|
|
|
604
|
-
export const ResendProviderLive = Layer.succeed(ResendProvider, ResendProvider)
|
|
642
|
+
export const ResendProviderLive = Layer.succeed(ResendProvider, ResendProvider);
|
|
605
643
|
```
|
|
606
644
|
|
|
607
645
|
---
|
|
@@ -613,12 +651,12 @@ export const ResendProviderLive = Layer.succeed(ResendProvider, ResendProvider)
|
|
|
613
651
|
**File:** `convex/queries/email.ts`
|
|
614
652
|
|
|
615
653
|
```typescript
|
|
616
|
-
import { query } from "./_generated/server"
|
|
617
|
-
import { v } from "convex/values"
|
|
618
|
-
import { confect } from "convex-helpers/server/confect"
|
|
619
|
-
import { Effect } from "effect"
|
|
620
|
-
import { EmailService } from "./services/email/email"
|
|
621
|
-
import { MainLayer } from "./services/layers"
|
|
654
|
+
import { query } from "./_generated/server";
|
|
655
|
+
import { v } from "convex/values";
|
|
656
|
+
import { confect } from "convex-helpers/server/confect";
|
|
657
|
+
import { Effect } from "effect";
|
|
658
|
+
import { EmailService } from "./services/email/email";
|
|
659
|
+
import { MainLayer } from "./services/layers";
|
|
622
660
|
|
|
623
661
|
// List emails by folder
|
|
624
662
|
export const list = confect.query({
|
|
@@ -629,26 +667,26 @@ export const list = confect.query({
|
|
|
629
667
|
v.literal("drafts"),
|
|
630
668
|
v.literal("trash"),
|
|
631
669
|
v.literal("archive"),
|
|
632
|
-
v.literal("junk")
|
|
670
|
+
v.literal("junk"),
|
|
633
671
|
),
|
|
634
672
|
userId: v.id("things"),
|
|
635
673
|
},
|
|
636
674
|
handler: (ctx, args) =>
|
|
637
675
|
Effect.gen(function* () {
|
|
638
|
-
const emailService = yield* EmailService
|
|
639
|
-
return yield* emailService.listByFolder(args)
|
|
640
|
-
}).pipe(Effect.provide(MainLayer))
|
|
641
|
-
})
|
|
676
|
+
const emailService = yield* EmailService;
|
|
677
|
+
return yield* emailService.listByFolder(args);
|
|
678
|
+
}).pipe(Effect.provide(MainLayer)),
|
|
679
|
+
});
|
|
642
680
|
|
|
643
681
|
// Get single email
|
|
644
682
|
export const get = confect.query({
|
|
645
683
|
args: { id: v.id("things") },
|
|
646
684
|
handler: (ctx, args) =>
|
|
647
685
|
Effect.gen(function* () {
|
|
648
|
-
const email = yield* Effect.tryPromise(() => ctx.db.get(args.id))
|
|
649
|
-
return email
|
|
650
|
-
}).pipe(Effect.provide(MainLayer))
|
|
651
|
-
})
|
|
686
|
+
const email = yield* Effect.tryPromise(() => ctx.db.get(args.id));
|
|
687
|
+
return email;
|
|
688
|
+
}).pipe(Effect.provide(MainLayer)),
|
|
689
|
+
});
|
|
652
690
|
|
|
653
691
|
// Search emails
|
|
654
692
|
export const search = confect.query({
|
|
@@ -658,20 +696,20 @@ export const search = confect.query({
|
|
|
658
696
|
},
|
|
659
697
|
handler: (ctx, args) =>
|
|
660
698
|
Effect.gen(function* () {
|
|
661
|
-
const emailService = yield* EmailService
|
|
662
|
-
return yield* emailService.search(args)
|
|
663
|
-
}).pipe(Effect.provide(MainLayer))
|
|
664
|
-
})
|
|
699
|
+
const emailService = yield* EmailService;
|
|
700
|
+
return yield* emailService.search(args);
|
|
701
|
+
}).pipe(Effect.provide(MainLayer)),
|
|
702
|
+
});
|
|
665
703
|
|
|
666
704
|
// Get folder counts
|
|
667
705
|
export const folderCounts = confect.query({
|
|
668
706
|
args: { userId: v.id("things") },
|
|
669
707
|
handler: (ctx, args) =>
|
|
670
708
|
Effect.gen(function* () {
|
|
671
|
-
const emailService = yield* EmailService
|
|
672
|
-
return yield* emailService.getFolderCounts(args)
|
|
673
|
-
}).pipe(Effect.provide(MainLayer))
|
|
674
|
-
})
|
|
709
|
+
const emailService = yield* EmailService;
|
|
710
|
+
return yield* emailService.getFolderCounts(args);
|
|
711
|
+
}).pipe(Effect.provide(MainLayer)),
|
|
712
|
+
});
|
|
675
713
|
```
|
|
676
714
|
|
|
677
715
|
### 3.2 Mutations
|
|
@@ -679,12 +717,12 @@ export const folderCounts = confect.query({
|
|
|
679
717
|
**File:** `convex/mutations/email.ts`
|
|
680
718
|
|
|
681
719
|
```typescript
|
|
682
|
-
import { mutation } from "./_generated/server"
|
|
683
|
-
import { v } from "convex/values"
|
|
684
|
-
import { confect } from "convex-helpers/server/confect"
|
|
685
|
-
import { Effect } from "effect"
|
|
686
|
-
import { EmailService } from "./services/email/email"
|
|
687
|
-
import { MainLayer } from "./services/layers"
|
|
720
|
+
import { mutation } from "./_generated/server";
|
|
721
|
+
import { v } from "convex/values";
|
|
722
|
+
import { confect } from "convex-helpers/server/confect";
|
|
723
|
+
import { Effect } from "effect";
|
|
724
|
+
import { EmailService } from "./services/email/email";
|
|
725
|
+
import { MainLayer } from "./services/layers";
|
|
688
726
|
|
|
689
727
|
// Create draft
|
|
690
728
|
export const createDraft = confect.mutation({
|
|
@@ -700,10 +738,10 @@ export const createDraft = confect.mutation({
|
|
|
700
738
|
},
|
|
701
739
|
handler: (ctx, args) =>
|
|
702
740
|
Effect.gen(function* () {
|
|
703
|
-
const emailService = yield* EmailService
|
|
704
|
-
return yield* emailService.createDraft(args)
|
|
705
|
-
}).pipe(Effect.provide(MainLayer))
|
|
706
|
-
})
|
|
741
|
+
const emailService = yield* EmailService;
|
|
742
|
+
return yield* emailService.createDraft(args);
|
|
743
|
+
}).pipe(Effect.provide(MainLayer)),
|
|
744
|
+
});
|
|
707
745
|
|
|
708
746
|
// Send email
|
|
709
747
|
export const send = confect.mutation({
|
|
@@ -713,10 +751,10 @@ export const send = confect.mutation({
|
|
|
713
751
|
},
|
|
714
752
|
handler: (ctx, args) =>
|
|
715
753
|
Effect.gen(function* () {
|
|
716
|
-
const emailService = yield* EmailService
|
|
717
|
-
return yield* emailService.send(args)
|
|
718
|
-
}).pipe(Effect.provide(MainLayer))
|
|
719
|
-
})
|
|
754
|
+
const emailService = yield* EmailService;
|
|
755
|
+
return yield* emailService.send(args);
|
|
756
|
+
}).pipe(Effect.provide(MainLayer)),
|
|
757
|
+
});
|
|
720
758
|
|
|
721
759
|
// Archive email
|
|
722
760
|
export const archive = confect.mutation({
|
|
@@ -726,10 +764,10 @@ export const archive = confect.mutation({
|
|
|
726
764
|
},
|
|
727
765
|
handler: (ctx, args) =>
|
|
728
766
|
Effect.gen(function* () {
|
|
729
|
-
const emailService = yield* EmailService
|
|
730
|
-
return yield* emailService.archive(args)
|
|
731
|
-
}).pipe(Effect.provide(MainLayer))
|
|
732
|
-
})
|
|
767
|
+
const emailService = yield* EmailService;
|
|
768
|
+
return yield* emailService.archive(args);
|
|
769
|
+
}).pipe(Effect.provide(MainLayer)),
|
|
770
|
+
});
|
|
733
771
|
|
|
734
772
|
// Delete email
|
|
735
773
|
export const deleteEmail = confect.mutation({
|
|
@@ -739,10 +777,10 @@ export const deleteEmail = confect.mutation({
|
|
|
739
777
|
},
|
|
740
778
|
handler: (ctx, args) =>
|
|
741
779
|
Effect.gen(function* () {
|
|
742
|
-
const emailService = yield* EmailService
|
|
743
|
-
return yield* emailService.delete(args)
|
|
744
|
-
}).pipe(Effect.provide(MainLayer))
|
|
745
|
-
})
|
|
780
|
+
const emailService = yield* EmailService;
|
|
781
|
+
return yield* emailService.delete(args);
|
|
782
|
+
}).pipe(Effect.provide(MainLayer)),
|
|
783
|
+
});
|
|
746
784
|
|
|
747
785
|
// Mark as read/unread
|
|
748
786
|
export const markRead = confect.mutation({
|
|
@@ -752,10 +790,10 @@ export const markRead = confect.mutation({
|
|
|
752
790
|
},
|
|
753
791
|
handler: (ctx, args) =>
|
|
754
792
|
Effect.gen(function* () {
|
|
755
|
-
const emailService = yield* EmailService
|
|
756
|
-
return yield* emailService.markRead(args)
|
|
757
|
-
}).pipe(Effect.provide(MainLayer))
|
|
758
|
-
})
|
|
793
|
+
const emailService = yield* EmailService;
|
|
794
|
+
return yield* emailService.markRead(args);
|
|
795
|
+
}).pipe(Effect.provide(MainLayer)),
|
|
796
|
+
});
|
|
759
797
|
```
|
|
760
798
|
|
|
761
799
|
### 3.3 Actions
|
|
@@ -763,10 +801,10 @@ export const markRead = confect.mutation({
|
|
|
763
801
|
**File:** `convex/actions/email.ts`
|
|
764
802
|
|
|
765
803
|
```typescript
|
|
766
|
-
import { internalAction } from "./_generated/server"
|
|
767
|
-
import { v } from "convex/values"
|
|
768
|
-
import { Resend } from "@convex-dev/resend"
|
|
769
|
-
import { components, internal } from "./_generated/api"
|
|
804
|
+
import { internalAction } from "./_generated/server";
|
|
805
|
+
import { v } from "convex/values";
|
|
806
|
+
import { Resend } from "@convex-dev/resend";
|
|
807
|
+
import { components, internal } from "./_generated/api";
|
|
770
808
|
|
|
771
809
|
// Actually send email via Resend
|
|
772
810
|
export const sendEmailAction = internalAction({
|
|
@@ -774,15 +812,15 @@ export const sendEmailAction = internalAction({
|
|
|
774
812
|
handler: async (ctx, args) => {
|
|
775
813
|
// 1. Get email
|
|
776
814
|
const email = await ctx.runQuery(internal.email.getEmail, {
|
|
777
|
-
id: args.emailId
|
|
778
|
-
})
|
|
815
|
+
id: args.emailId,
|
|
816
|
+
});
|
|
779
817
|
|
|
780
818
|
if (!email) {
|
|
781
|
-
throw new Error("Email not found")
|
|
819
|
+
throw new Error("Email not found");
|
|
782
820
|
}
|
|
783
821
|
|
|
784
822
|
// 2. Send via Resend
|
|
785
|
-
const resend = new Resend(components.resend, { testMode: false })
|
|
823
|
+
const resend = new Resend(components.resend, { testMode: false });
|
|
786
824
|
|
|
787
825
|
try {
|
|
788
826
|
const result = await resend.sendEmail(ctx, {
|
|
@@ -793,36 +831,36 @@ export const sendEmailAction = internalAction({
|
|
|
793
831
|
subject: email.properties.subject,
|
|
794
832
|
html: email.properties.bodyHtml,
|
|
795
833
|
text: email.properties.bodyText,
|
|
796
|
-
})
|
|
834
|
+
});
|
|
797
835
|
|
|
798
836
|
// 3. Update email with Resend ID
|
|
799
837
|
await ctx.runMutation(internal.email.updateResendId, {
|
|
800
838
|
emailId: args.emailId,
|
|
801
839
|
resendId: result.id,
|
|
802
|
-
})
|
|
840
|
+
});
|
|
803
841
|
|
|
804
842
|
// 4. Log delivery event
|
|
805
843
|
await ctx.runMutation(internal.email.logEvent, {
|
|
806
844
|
emailId: args.emailId,
|
|
807
845
|
eventType: "email_delivered",
|
|
808
|
-
metadata: { resendId: result.id }
|
|
809
|
-
})
|
|
846
|
+
metadata: { resendId: result.id },
|
|
847
|
+
});
|
|
810
848
|
|
|
811
|
-
return { success: true, resendId: result.id }
|
|
849
|
+
return { success: true, resendId: result.id };
|
|
812
850
|
} catch (error) {
|
|
813
851
|
// Log failure event
|
|
814
852
|
await ctx.runMutation(internal.email.logEvent, {
|
|
815
853
|
emailId: args.emailId,
|
|
816
854
|
eventType: "email_failed",
|
|
817
855
|
metadata: {
|
|
818
|
-
error: error instanceof Error ? error.message : "Unknown error"
|
|
819
|
-
}
|
|
820
|
-
})
|
|
856
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
857
|
+
},
|
|
858
|
+
});
|
|
821
859
|
|
|
822
|
-
throw error
|
|
860
|
+
throw error;
|
|
823
861
|
}
|
|
824
|
-
}
|
|
825
|
-
})
|
|
862
|
+
},
|
|
863
|
+
});
|
|
826
864
|
```
|
|
827
865
|
|
|
828
866
|
---
|
|
@@ -834,8 +872,8 @@ export const sendEmailAction = internalAction({
|
|
|
834
872
|
**File:** `src/components/mail/use-mail.ts`
|
|
835
873
|
|
|
836
874
|
```typescript
|
|
837
|
-
import { atom, useAtom } from "jotai"
|
|
838
|
-
import { Id } from "@/convex/_generated/dataModel"
|
|
875
|
+
import { atom, useAtom } from "jotai";
|
|
876
|
+
import { Id } from "@/convex/_generated/dataModel";
|
|
839
877
|
|
|
840
878
|
export type MailFolder =
|
|
841
879
|
| "inbox"
|
|
@@ -843,24 +881,24 @@ export type MailFolder =
|
|
|
843
881
|
| "sent"
|
|
844
882
|
| "junk"
|
|
845
883
|
| "trash"
|
|
846
|
-
| "archive"
|
|
884
|
+
| "archive";
|
|
847
885
|
|
|
848
886
|
type Config = {
|
|
849
|
-
selected: Id<"things"> | null
|
|
850
|
-
activeFolder: MailFolder
|
|
851
|
-
searchQuery: string
|
|
852
|
-
activeTab: "all" | "unread"
|
|
853
|
-
}
|
|
887
|
+
selected: Id<"things"> | null;
|
|
888
|
+
activeFolder: MailFolder;
|
|
889
|
+
searchQuery: string;
|
|
890
|
+
activeTab: "all" | "unread";
|
|
891
|
+
};
|
|
854
892
|
|
|
855
893
|
const configAtom = atom<Config>({
|
|
856
894
|
selected: null,
|
|
857
895
|
activeFolder: "inbox",
|
|
858
896
|
searchQuery: "",
|
|
859
897
|
activeTab: "all",
|
|
860
|
-
})
|
|
898
|
+
});
|
|
861
899
|
|
|
862
900
|
export function useMail() {
|
|
863
|
-
return useAtom(configAtom)
|
|
901
|
+
return useAtom(configAtom);
|
|
864
902
|
}
|
|
865
903
|
```
|
|
866
904
|
|
|
@@ -869,42 +907,44 @@ export function useMail() {
|
|
|
869
907
|
**File:** `src/components/mail/MailList.tsx`
|
|
870
908
|
|
|
871
909
|
```tsx
|
|
872
|
-
import { useQuery } from "convex/react"
|
|
873
|
-
import { api } from "@/convex/_generated/api"
|
|
874
|
-
import { formatDistanceToNow } from "date-fns"
|
|
875
|
-
import { cn } from "@/lib/utils"
|
|
876
|
-
import { Badge } from "@/components/ui/badge"
|
|
877
|
-
import { ScrollArea } from "@/components/ui/scroll-area"
|
|
878
|
-
import { useMail } from "./use-mail"
|
|
910
|
+
import { useQuery } from "convex/react";
|
|
911
|
+
import { api } from "@/convex/_generated/api";
|
|
912
|
+
import { formatDistanceToNow } from "date-fns";
|
|
913
|
+
import { cn } from "@/lib/utils";
|
|
914
|
+
import { Badge } from "@/components/ui/badge";
|
|
915
|
+
import { ScrollArea } from "@/components/ui/scroll-area";
|
|
916
|
+
import { useMail } from "./use-mail";
|
|
879
917
|
|
|
880
918
|
export function MailList({ userId }: { userId: string }) {
|
|
881
|
-
const [mail, setMail] = useMail()
|
|
919
|
+
const [mail, setMail] = useMail();
|
|
882
920
|
|
|
883
921
|
// Real-time query from Convex
|
|
884
922
|
const emails = useQuery(api.email.list, {
|
|
885
923
|
folder: mail.activeFolder,
|
|
886
924
|
userId: userId as any, // Type assertion for now
|
|
887
|
-
})
|
|
925
|
+
});
|
|
888
926
|
|
|
889
927
|
// Filter by search query (client-side for now)
|
|
890
|
-
const filteredEmails =
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
928
|
+
const filteredEmails =
|
|
929
|
+
emails?.filter((email) => {
|
|
930
|
+
if (!mail.searchQuery) return true;
|
|
931
|
+
|
|
932
|
+
const query = mail.searchQuery.toLowerCase();
|
|
933
|
+
return (
|
|
934
|
+
email.properties.subject.toLowerCase().includes(query) ||
|
|
935
|
+
email.properties.bodyText.toLowerCase().includes(query) ||
|
|
936
|
+
email.properties.fromName.toLowerCase().includes(query)
|
|
937
|
+
);
|
|
938
|
+
}) || [];
|
|
900
939
|
|
|
901
940
|
// Filter by tab
|
|
902
|
-
const displayEmails =
|
|
903
|
-
|
|
904
|
-
|
|
941
|
+
const displayEmails =
|
|
942
|
+
mail.activeTab === "unread"
|
|
943
|
+
? filteredEmails.filter((e) => !e.properties.read)
|
|
944
|
+
: filteredEmails;
|
|
905
945
|
|
|
906
946
|
if (!emails) {
|
|
907
|
-
return <div className="p-8 text-center">Loading...</div
|
|
947
|
+
return <div className="p-8 text-center">Loading...</div>;
|
|
908
948
|
}
|
|
909
949
|
|
|
910
950
|
if (displayEmails.length === 0) {
|
|
@@ -912,7 +952,7 @@ export function MailList({ userId }: { userId: string }) {
|
|
|
912
952
|
<div className="flex items-center justify-center p-8 text-center text-sm text-muted-foreground">
|
|
913
953
|
No emails found
|
|
914
954
|
</div>
|
|
915
|
-
)
|
|
955
|
+
);
|
|
916
956
|
}
|
|
917
957
|
|
|
918
958
|
return (
|
|
@@ -923,7 +963,7 @@ export function MailList({ userId }: { userId: string }) {
|
|
|
923
963
|
key={email._id}
|
|
924
964
|
className={cn(
|
|
925
965
|
"flex flex-col items-start gap-2 rounded-lg border p-3 text-left text-sm transition-all hover:bg-accent active:scale-[0.99]",
|
|
926
|
-
mail.selected === email._id && "bg-muted ring-2 ring-primary/20"
|
|
966
|
+
mail.selected === email._id && "bg-muted ring-2 ring-primary/20",
|
|
927
967
|
)}
|
|
928
968
|
onClick={() =>
|
|
929
969
|
setMail({
|
|
@@ -935,10 +975,12 @@ export function MailList({ userId }: { userId: string }) {
|
|
|
935
975
|
<div className="flex w-full flex-col gap-1">
|
|
936
976
|
<div className="flex items-center">
|
|
937
977
|
<div className="flex items-center gap-2">
|
|
938
|
-
<div
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
978
|
+
<div
|
|
979
|
+
className={cn(
|
|
980
|
+
"font-semibold",
|
|
981
|
+
!email.properties.read && "text-primary",
|
|
982
|
+
)}
|
|
983
|
+
>
|
|
942
984
|
{email.properties.fromName}
|
|
943
985
|
</div>
|
|
944
986
|
{!email.properties.read && (
|
|
@@ -950,7 +992,7 @@ export function MailList({ userId }: { userId: string }) {
|
|
|
950
992
|
"ml-auto text-xs",
|
|
951
993
|
mail.selected === email._id
|
|
952
994
|
? "text-foreground"
|
|
953
|
-
: "text-muted-foreground"
|
|
995
|
+
: "text-muted-foreground",
|
|
954
996
|
)}
|
|
955
997
|
>
|
|
956
998
|
{formatDistanceToNow(new Date(email.createdAt), {
|
|
@@ -958,10 +1000,12 @@ export function MailList({ userId }: { userId: string }) {
|
|
|
958
1000
|
})}
|
|
959
1001
|
</div>
|
|
960
1002
|
</div>
|
|
961
|
-
<div
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1003
|
+
<div
|
|
1004
|
+
className={cn(
|
|
1005
|
+
"text-xs font-medium",
|
|
1006
|
+
!email.properties.read && "text-primary",
|
|
1007
|
+
)}
|
|
1008
|
+
>
|
|
965
1009
|
{email.properties.subject}
|
|
966
1010
|
</div>
|
|
967
1011
|
</div>
|
|
@@ -981,7 +1025,7 @@ export function MailList({ userId }: { userId: string }) {
|
|
|
981
1025
|
))}
|
|
982
1026
|
</div>
|
|
983
1027
|
</ScrollArea>
|
|
984
|
-
)
|
|
1028
|
+
);
|
|
985
1029
|
}
|
|
986
1030
|
```
|
|
987
1031
|
|
|
@@ -990,60 +1034,60 @@ export function MailList({ userId }: { userId: string }) {
|
|
|
990
1034
|
**File:** `src/components/mail/MailDisplay.tsx`
|
|
991
1035
|
|
|
992
1036
|
```tsx
|
|
993
|
-
import { useQuery, useMutation } from "convex/react"
|
|
994
|
-
import { api } from "@/convex/_generated/api"
|
|
995
|
-
import { toast } from "sonner"
|
|
996
|
-
import { Archive, ArchiveX, Trash2, Reply } from "lucide-react"
|
|
997
|
-
import { Button } from "@/components/ui/button"
|
|
998
|
-
import { Textarea } from "@/components/ui/textarea"
|
|
999
|
-
import { useMail } from "./use-mail"
|
|
1000
|
-
import { useState } from "react"
|
|
1037
|
+
import { useQuery, useMutation } from "convex/react";
|
|
1038
|
+
import { api } from "@/convex/_generated/api";
|
|
1039
|
+
import { toast } from "sonner";
|
|
1040
|
+
import { Archive, ArchiveX, Trash2, Reply } from "lucide-react";
|
|
1041
|
+
import { Button } from "@/components/ui/button";
|
|
1042
|
+
import { Textarea } from "@/components/ui/textarea";
|
|
1043
|
+
import { useMail } from "./use-mail";
|
|
1044
|
+
import { useState } from "react";
|
|
1001
1045
|
|
|
1002
1046
|
export function MailDisplay({ userId }: { userId: string }) {
|
|
1003
|
-
const [mail] = useMail()
|
|
1004
|
-
const [replyText, setReplyText] = useState("")
|
|
1047
|
+
const [mail] = useMail();
|
|
1048
|
+
const [replyText, setReplyText] = useState("");
|
|
1005
1049
|
|
|
1006
1050
|
// Get selected email
|
|
1007
1051
|
const currentMail = useQuery(
|
|
1008
1052
|
api.email.get,
|
|
1009
|
-
mail.selected ? { id: mail.selected } : "skip"
|
|
1010
|
-
)
|
|
1053
|
+
mail.selected ? { id: mail.selected } : "skip",
|
|
1054
|
+
);
|
|
1011
1055
|
|
|
1012
1056
|
// Mutations
|
|
1013
|
-
const archive = useMutation(api.email.archive)
|
|
1014
|
-
const deleteEmail = useMutation(api.email.deleteEmail)
|
|
1015
|
-
const markRead = useMutation(api.email.markRead)
|
|
1057
|
+
const archive = useMutation(api.email.archive);
|
|
1058
|
+
const deleteEmail = useMutation(api.email.deleteEmail);
|
|
1059
|
+
const markRead = useMutation(api.email.markRead);
|
|
1016
1060
|
|
|
1017
1061
|
const handleArchive = async () => {
|
|
1018
|
-
if (!mail.selected) return
|
|
1062
|
+
if (!mail.selected) return;
|
|
1019
1063
|
|
|
1020
|
-
await archive({ emailId: mail.selected, userId: userId as any })
|
|
1021
|
-
toast.success("Email archived")
|
|
1022
|
-
}
|
|
1064
|
+
await archive({ emailId: mail.selected, userId: userId as any });
|
|
1065
|
+
toast.success("Email archived");
|
|
1066
|
+
};
|
|
1023
1067
|
|
|
1024
1068
|
const handleDelete = async () => {
|
|
1025
|
-
if (!mail.selected) return
|
|
1069
|
+
if (!mail.selected) return;
|
|
1026
1070
|
|
|
1027
|
-
await deleteEmail({ emailId: mail.selected, userId: userId as any })
|
|
1028
|
-
toast.success("Email deleted")
|
|
1029
|
-
}
|
|
1071
|
+
await deleteEmail({ emailId: mail.selected, userId: userId as any });
|
|
1072
|
+
toast.success("Email deleted");
|
|
1073
|
+
};
|
|
1030
1074
|
|
|
1031
1075
|
const handleReply = async (e: React.FormEvent) => {
|
|
1032
|
-
e.preventDefault()
|
|
1033
|
-
if (!replyText.trim() || !currentMail) return
|
|
1076
|
+
e.preventDefault();
|
|
1077
|
+
if (!replyText.trim() || !currentMail) return;
|
|
1034
1078
|
|
|
1035
1079
|
// Create draft reply
|
|
1036
1080
|
// TODO: Implement reply functionality
|
|
1037
|
-
toast.success("Reply sent")
|
|
1038
|
-
setReplyText("")
|
|
1039
|
-
}
|
|
1081
|
+
toast.success("Reply sent");
|
|
1082
|
+
setReplyText("");
|
|
1083
|
+
};
|
|
1040
1084
|
|
|
1041
1085
|
if (!currentMail) {
|
|
1042
1086
|
return (
|
|
1043
1087
|
<div className="flex h-full items-center justify-center p-8 text-center text-muted-foreground">
|
|
1044
1088
|
No message selected
|
|
1045
1089
|
</div>
|
|
1046
|
-
)
|
|
1090
|
+
);
|
|
1047
1091
|
}
|
|
1048
1092
|
|
|
1049
1093
|
return (
|
|
@@ -1062,7 +1106,8 @@ export function MailDisplay({ userId }: { userId: string }) {
|
|
|
1062
1106
|
{currentMail.properties.subject}
|
|
1063
1107
|
</div>
|
|
1064
1108
|
<div className="text-sm text-muted-foreground mb-4">
|
|
1065
|
-
From: {currentMail.properties.fromName} ({currentMail.properties.from}
|
|
1109
|
+
From: {currentMail.properties.fromName} ({currentMail.properties.from}
|
|
1110
|
+
)
|
|
1066
1111
|
</div>
|
|
1067
1112
|
<div
|
|
1068
1113
|
className="prose prose-sm max-w-none"
|
|
@@ -1085,7 +1130,7 @@ export function MailDisplay({ userId }: { userId: string }) {
|
|
|
1085
1130
|
</form>
|
|
1086
1131
|
</div>
|
|
1087
1132
|
</div>
|
|
1088
|
-
)
|
|
1133
|
+
);
|
|
1089
1134
|
}
|
|
1090
1135
|
```
|
|
1091
1136
|
|
|
@@ -1135,14 +1180,14 @@ const userId = session.user.id
|
|
|
1135
1180
|
**File:** `convex/http/webhooks/resend.ts`
|
|
1136
1181
|
|
|
1137
1182
|
```typescript
|
|
1138
|
-
import { Hono } from "hono"
|
|
1139
|
-
import { HonoWithConvex, HttpRouterWithHono } from "convex-helpers/server/hono"
|
|
1140
|
-
import { internal } from "../../_generated/api"
|
|
1183
|
+
import { Hono } from "hono";
|
|
1184
|
+
import { HonoWithConvex, HttpRouterWithHono } from "convex-helpers/server/hono";
|
|
1185
|
+
import { internal } from "../../_generated/api";
|
|
1141
1186
|
|
|
1142
|
-
const app: HonoWithConvex = new Hono()
|
|
1187
|
+
const app: HonoWithConvex = new Hono();
|
|
1143
1188
|
|
|
1144
1189
|
app.post("/resend", async (c) => {
|
|
1145
|
-
const body = await c.req.json()
|
|
1190
|
+
const body = await c.req.json();
|
|
1146
1191
|
|
|
1147
1192
|
// Verify webhook signature (Resend provides this)
|
|
1148
1193
|
// const signature = c.req.header("resend-signature")
|
|
@@ -1150,58 +1195,58 @@ app.post("/resend", async (c) => {
|
|
|
1150
1195
|
// return c.json({ error: "Invalid signature" }, 401)
|
|
1151
1196
|
// }
|
|
1152
1197
|
|
|
1153
|
-
const { type, data } = body
|
|
1198
|
+
const { type, data } = body;
|
|
1154
1199
|
|
|
1155
1200
|
switch (type) {
|
|
1156
1201
|
case "email.sent":
|
|
1157
1202
|
await c.env.runMutation(internal.email.handleEmailSent, {
|
|
1158
1203
|
resendId: data.email_id,
|
|
1159
|
-
timestamp: Date.now()
|
|
1160
|
-
})
|
|
1161
|
-
break
|
|
1204
|
+
timestamp: Date.now(),
|
|
1205
|
+
});
|
|
1206
|
+
break;
|
|
1162
1207
|
|
|
1163
1208
|
case "email.delivered":
|
|
1164
1209
|
await c.env.runMutation(internal.email.handleEmailDelivered, {
|
|
1165
1210
|
resendId: data.email_id,
|
|
1166
|
-
timestamp: Date.now()
|
|
1167
|
-
})
|
|
1168
|
-
break
|
|
1211
|
+
timestamp: Date.now(),
|
|
1212
|
+
});
|
|
1213
|
+
break;
|
|
1169
1214
|
|
|
1170
1215
|
case "email.opened":
|
|
1171
1216
|
await c.env.runMutation(internal.email.handleEmailOpened, {
|
|
1172
1217
|
resendId: data.email_id,
|
|
1173
|
-
timestamp: Date.now()
|
|
1174
|
-
})
|
|
1175
|
-
break
|
|
1218
|
+
timestamp: Date.now(),
|
|
1219
|
+
});
|
|
1220
|
+
break;
|
|
1176
1221
|
|
|
1177
1222
|
case "email.clicked":
|
|
1178
1223
|
await c.env.runMutation(internal.email.handleEmailClicked, {
|
|
1179
1224
|
resendId: data.email_id,
|
|
1180
1225
|
clickedLink: data.link,
|
|
1181
|
-
timestamp: Date.now()
|
|
1182
|
-
})
|
|
1183
|
-
break
|
|
1226
|
+
timestamp: Date.now(),
|
|
1227
|
+
});
|
|
1228
|
+
break;
|
|
1184
1229
|
|
|
1185
1230
|
case "email.bounced":
|
|
1186
1231
|
await c.env.runMutation(internal.email.handleEmailBounced, {
|
|
1187
1232
|
resendId: data.email_id,
|
|
1188
1233
|
reason: data.bounce_type,
|
|
1189
|
-
timestamp: Date.now()
|
|
1190
|
-
})
|
|
1191
|
-
break
|
|
1234
|
+
timestamp: Date.now(),
|
|
1235
|
+
});
|
|
1236
|
+
break;
|
|
1192
1237
|
|
|
1193
1238
|
case "email.complained":
|
|
1194
1239
|
await c.env.runMutation(internal.email.handleEmailComplained, {
|
|
1195
1240
|
resendId: data.email_id,
|
|
1196
|
-
timestamp: Date.now()
|
|
1197
|
-
})
|
|
1198
|
-
break
|
|
1241
|
+
timestamp: Date.now(),
|
|
1242
|
+
});
|
|
1243
|
+
break;
|
|
1199
1244
|
}
|
|
1200
1245
|
|
|
1201
|
-
return c.json({ success: true })
|
|
1202
|
-
})
|
|
1246
|
+
return c.json({ success: true });
|
|
1247
|
+
});
|
|
1203
1248
|
|
|
1204
|
-
export default new HttpRouterWithHono(app)
|
|
1249
|
+
export default new HttpRouterWithHono(app);
|
|
1205
1250
|
```
|
|
1206
1251
|
|
|
1207
1252
|
---
|
|
@@ -1209,6 +1254,7 @@ export default new HttpRouterWithHono(app)
|
|
|
1209
1254
|
## Implementation Checklist
|
|
1210
1255
|
|
|
1211
1256
|
### Phase 1: Database Setup
|
|
1257
|
+
|
|
1212
1258
|
- [ ] Add email entity type to things table
|
|
1213
1259
|
- [ ] Add email_template entity type to things table
|
|
1214
1260
|
- [ ] Add connection types: sent_email, received_email, reply_to
|
|
@@ -1216,18 +1262,21 @@ export default new HttpRouterWithHono(app)
|
|
|
1216
1262
|
- [ ] Add tag categories: folder, label, status
|
|
1217
1263
|
|
|
1218
1264
|
### Phase 2: Backend Services
|
|
1265
|
+
|
|
1219
1266
|
- [ ] Create `convex/services/email/email.ts` (EmailService)
|
|
1220
1267
|
- [ ] Create `convex/services/providers/resend.ts` (ResendProvider)
|
|
1221
1268
|
- [ ] Implement createDraft, send, listByFolder, search, archive, delete, markRead
|
|
1222
1269
|
- [ ] Add to MainLayer in `convex/services/layers.ts`
|
|
1223
1270
|
|
|
1224
1271
|
### Phase 3: Convex Layer
|
|
1272
|
+
|
|
1225
1273
|
- [ ] Create `convex/queries/email.ts` (list, get, search, folderCounts)
|
|
1226
1274
|
- [ ] Create `convex/mutations/email.ts` (createDraft, send, archive, delete, markRead)
|
|
1227
1275
|
- [ ] Create `convex/actions/email.ts` (sendEmailAction)
|
|
1228
1276
|
- [ ] Create internal mutations for webhook handlers
|
|
1229
1277
|
|
|
1230
1278
|
### Phase 4: Frontend Integration
|
|
1279
|
+
|
|
1231
1280
|
- [ ] Update `src/components/mail/use-mail.ts` with proper types
|
|
1232
1281
|
- [ ] Update `src/components/mail/MailList.tsx` with useQuery
|
|
1233
1282
|
- [ ] Update `src/components/mail/MailDisplay.tsx` with useMutation
|
|
@@ -1236,12 +1285,14 @@ export default new HttpRouterWithHono(app)
|
|
|
1236
1285
|
- [ ] Add Toaster component for notifications
|
|
1237
1286
|
|
|
1238
1287
|
### Phase 5: Webhooks
|
|
1288
|
+
|
|
1239
1289
|
- [ ] Create `convex/http/webhooks/resend.ts`
|
|
1240
1290
|
- [ ] Configure Resend webhook URL in dashboard
|
|
1241
1291
|
- [ ] Implement webhook signature verification
|
|
1242
1292
|
- [ ] Test email tracking events
|
|
1243
1293
|
|
|
1244
1294
|
### Phase 6: Testing
|
|
1295
|
+
|
|
1245
1296
|
- [ ] Test draft creation
|
|
1246
1297
|
- [ ] Test email sending (receives in real inbox)
|
|
1247
1298
|
- [ ] Test folder navigation
|
|
@@ -1285,6 +1336,7 @@ RESEND_WEBHOOK_SECRET=whsec_...
|
|
|
1285
1336
|
## Success Criteria
|
|
1286
1337
|
|
|
1287
1338
|
### MVP (Minimum Viable Product)
|
|
1339
|
+
|
|
1288
1340
|
- ✅ Users can view emails in inbox
|
|
1289
1341
|
- ✅ Users can compose and send emails
|
|
1290
1342
|
- ✅ Emails deliver to real inboxes
|
|
@@ -1294,6 +1346,7 @@ RESEND_WEBHOOK_SECRET=whsec_...
|
|
|
1294
1346
|
- ✅ Real-time updates when emails arrive
|
|
1295
1347
|
|
|
1296
1348
|
### Full Features
|
|
1349
|
+
|
|
1297
1350
|
- ✅ Reply/Forward functionality
|
|
1298
1351
|
- ✅ Email threading (conversations)
|
|
1299
1352
|
- ✅ Attachments support
|