oneie 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +245 -0
- package/CLAUDE.md +534 -0
- package/README.md +61 -4
- package/one/.obsidian/app.json +1 -0
- package/one/.obsidian/appearance.json +1 -0
- package/one/.obsidian/core-plugins.json +33 -0
- package/one/.obsidian/workspace.json +211 -0
- package/one/connections/a2a.md +551 -0
- package/one/connections/acp.md +761 -0
- package/one/connections/acps.md +731 -0
- package/one/connections/agui.md +767 -0
- package/one/connections/any-backend.md +1702 -0
- package/one/connections/ap2.md +998 -0
- package/one/connections/api-docs.md +1891 -0
- package/one/connections/api.md +2190 -0
- package/one/connections/architecture-diagram.md +94 -0
- package/one/connections/communications.md +449 -0
- package/one/connections/connections.md +339 -0
- package/one/connections/cryptonetworks.md +781 -0
- package/one/connections/documentation.md +1120 -0
- package/one/connections/effect.md +279 -0
- package/one/connections/elizaos.md +1290 -0
- package/one/connections/inference.md +58 -0
- package/one/connections/kyc.md +632 -0
- package/one/connections/mcp.md +842 -0
- package/one/connections/membership.md +1152 -0
- package/one/connections/middleware.md +1067 -0
- package/one/connections/multitenant.md +1341 -0
- package/one/connections/n8n.md +1015 -0
- package/one/connections/patterns.md +89 -0
- package/one/connections/protocols.md +279 -0
- package/one/connections/relationships.md +107 -0
- package/one/connections/schema.md +587 -0
- package/one/connections/service-layer.md +550 -0
- package/one/connections/structure.md +0 -0
- package/one/connections/vectors.md +207 -0
- package/one/connections/wordpress.md +1302 -0
- package/one/connections/workflow-copy.md +905 -0
- package/one/connections/workflow-examples.md +741 -0
- package/one/connections/workflow.md +905 -0
- package/one/connections/workflows/delegation.md +885 -0
- package/one/connections/workflows/frontend.md +1037 -0
- package/one/connections/workflows/strategy.md +903 -0
- package/one/connections/workflows/tasks.md +698 -0
- package/one/connections/x402.md +1249 -0
- package/one/events/events.md +545 -0
- package/one/knowledge/ai-platform.md +305 -0
- package/one/knowledge/architecture-diagram.md +94 -0
- package/one/knowledge/architecture-frontend.md +930 -0
- package/one/knowledge/architecture.md +2077 -0
- package/one/knowledge/crypto.md +960 -0
- package/one/knowledge/dsl.md +1660 -0
- package/one/knowledge/files.md +2471 -0
- package/one/knowledge/frontend.md +1038 -0
- package/one/knowledge/hono.md +2109 -0
- package/one/knowledge/implementation-examples.md +2536 -0
- package/one/knowledge/inference-score.md +159 -0
- package/one/knowledge/knowledge.md +642 -0
- package/one/knowledge/language.md +980 -0
- package/one/knowledge/lessons-learned.md +70 -0
- package/one/knowledge/ontology-6-dimensions.md +0 -0
- package/one/knowledge/ontology-documentation.md +356 -0
- package/one/knowledge/ontology-engineering-specification.md +1292 -0
- package/one/knowledge/ontology-engineering.md +1652 -0
- package/one/knowledge/ontology-frontend-copy-2.md +1492 -0
- package/one/knowledge/ontology-frontend-copy.md +753 -0
- package/one/knowledge/ontology-frontend-specifications.md +2188 -0
- package/one/knowledge/ontology-frontend.md +2427 -0
- package/one/knowledge/ontology-minimal.yaml +299 -0
- package/one/knowledge/ontology.md +2819 -0
- package/one/knowledge/ontology.yaml +1165 -0
- package/one/knowledge/patterns/backend/convex-mutation-pattern.md +100 -0
- package/one/knowledge/patterns/backend/convex-query-pattern.md +88 -0
- package/one/knowledge/patterns/backend/mutation-template.md +231 -0
- package/one/knowledge/patterns/backend/query-template.md +267 -0
- package/one/knowledge/patterns/backend/service-template.md +237 -0
- package/one/knowledge/patterns/design/component-architecture.md +399 -0
- package/one/knowledge/patterns/design/test-driven-design-pattern.md +162 -0
- package/one/knowledge/patterns/design/wireframe-template.md +216 -0
- package/one/knowledge/patterns/frontend/component-template.md +195 -0
- package/one/knowledge/patterns/frontend/form-template.md +276 -0
- package/one/knowledge/patterns/frontend/page-template.md +178 -0
- package/one/knowledge/patterns/frontend/react-component-pattern.md +128 -0
- package/one/knowledge/patterns/test/acceptance-criteria-template.md +378 -0
- package/one/knowledge/patterns/test/technical-test-template.md +544 -0
- package/one/knowledge/patterns/test/test-driven-pattern.md +140 -0
- package/one/knowledge/patterns/test/user-flow-template.md +254 -0
- package/one/knowledge/quality-loop.md +401 -0
- package/one/knowledge/readme.md +131 -0
- package/one/knowledge/rules.md +626 -0
- package/one/knowledge/score.md +67 -0
- package/one/knowledge/specifications.md +855 -0
- package/one/knowledge/tags.md +130 -0
- package/one/organisation/one.md +599 -0
- package/one/organisation/organisation.md +438 -0
- package/one/organisation/revenue.md +673 -0
- package/one/organisation/strategy.md +869 -0
- package/one/organisation/vision.md +98 -0
- package/one/people/anthony-o-connell.md +440 -0
- package/one/people/people.md +567 -0
- package/one/repomix-output.md +92634 -0
- package/one/things/agentkit.md +349 -0
- package/one/things/agents/agent-backend.md +1401 -0
- package/one/things/agents/agent-builder.md +955 -0
- package/one/things/agents/agent-clean.md +709 -0
- package/one/things/agents/agent-clone.md +1341 -0
- package/one/things/agents/agent-designer.md +2177 -0
- package/one/things/agents/agent-director.md +1508 -0
- package/one/things/agents/agent-documenter.md +1049 -0
- package/one/things/agents/agent-frontend.md +1119 -0
- package/one/things/agents/agent-integrator.md +1192 -0
- package/one/things/agents/agent-problem-solver.md +1379 -0
- package/one/things/agents/agent-quality.md +1353 -0
- package/one/things/agents/agent-sales.md +986 -0
- package/one/things/cascade/cascade.yaml +464 -0
- package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +470 -0
- package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +264 -0
- package/one/things/cascade/docs/examples/1-1-agent-prompts.md +486 -0
- package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +497 -0
- package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +227 -0
- package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +516 -0
- package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +544 -0
- package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +223 -0
- package/one/things/cascade/docs/examples/1-3-event-coordination.md +508 -0
- package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +609 -0
- package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +195 -0
- package/one/things/cascade/docs/examples/1-4-knowledge-management.md +577 -0
- package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +797 -0
- package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +212 -0
- package/one/things/cascade/docs/examples/1-5-quality-loops.md +641 -0
- package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +610 -0
- package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +213 -0
- package/one/things/cascade/docs/examples/1-6-numbering-structure.md +575 -0
- package/one/things/cascade/docs/examples/readme.md +222 -0
- package/one/things/cascade/docs/getting-started.md +515 -0
- package/one/things/cascade/docs/workflow.md +1372 -0
- package/one/things/cascade/readme.md +336 -0
- package/one/things/cascade/templates/feature-template.md +267 -0
- package/one/things/claude/agents/advocacy-activation-manager.md +685 -0
- package/one/things/claude/agents/advocacy-campaign-designer.md +663 -0
- package/one/things/claude/agents/analyst.md +483 -0
- package/one/things/claude/agents/architect.md +480 -0
- package/one/things/claude/agents/brand-identity-specialist.md +513 -0
- package/one/things/claude/agents/bstp-token-strategist.md +667 -0
- package/one/things/claude/agents/builder-repo.md +489 -0
- package/one/things/claude/agents/bullstamp-community-builder.md +574 -0
- package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +506 -0
- package/one/things/claude/agents/bulltilt-platform-growth.md +567 -0
- package/one/things/claude/agents/company-bullstamp-character.md +587 -0
- package/one/things/claude/agents/company-bullstamp-community.md +292 -0
- package/one/things/claude/agents/company-bullstamp-marketing.md +292 -0
- package/one/things/claude/agents/company-bullstamp-token.md +292 -0
- package/one/things/claude/agents/company-bulltilt-growth.md +292 -0
- package/one/things/claude/agents/content-bibliography-formatter.md +381 -0
- package/one/things/claude/agents/content-calendar-planner.md +448 -0
- package/one/things/claude/agents/content-chapter-formatter.md +488 -0
- package/one/things/claude/agents/content-formatter.md +546 -0
- package/one/things/claude/agents/content-hook-specialist.md +462 -0
- package/one/things/claude/agents/content-image-formatter.md +535 -0
- package/one/things/claude/agents/content-introduction-formatter.md +485 -0
- package/one/things/claude/agents/content-multiplication-engine.md +556 -0
- package/one/things/claude/agents/content-playbook-writer.md +448 -0
- package/one/things/claude/agents/content-team-manager.md +622 -0
- package/one/things/claude/agents/content-toc-formatter.md +522 -0
- package/one/things/claude/agents/convex-backend-specialist.md +2561 -0
- package/one/things/claude/agents/core-manager.md +582 -0
- package/one/things/claude/agents/core-master.md +403 -0
- package/one/things/claude/agents/cross-functional-manager.md +471 -0
- package/one/things/claude/agents/crypto-airdrop-strategist.md +602 -0
- package/one/things/claude/agents/crypto-analytics-educator.md +553 -0
- package/one/things/claude/agents/crypto-architecture-specialist.md +466 -0
- package/one/things/claude/agents/crypto-community-analyst.md +298 -0
- package/one/things/claude/agents/crypto-community-psychologist.md +509 -0
- package/one/things/claude/agents/crypto-dex-optimization-expert.md +538 -0
- package/one/things/claude/agents/crypto-dex-optimizer.md +292 -0
- package/one/things/claude/agents/crypto-diamond-formation-specialist.md +513 -0
- package/one/things/claude/agents/crypto-diamond-hands.md +292 -0
- package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +554 -0
- package/one/things/claude/agents/crypto-engagement-specialist.md +540 -0
- package/one/things/claude/agents/crypto-market-researcher.md +292 -0
- package/one/things/claude/agents/crypto-marketing-orchestrator.md +523 -0
- package/one/things/claude/agents/crypto-network-effect-amplifier.md +569 -0
- package/one/things/claude/agents/crypto-optimization-analyst.md +554 -0
- package/one/things/claude/agents/crypto-strategic-synthesizer.md +517 -0
- package/one/things/claude/agents/crypto-team-manager.md +387 -0
- package/one/things/claude/agents/crypto-token-analyst.md +278 -0
- package/one/things/claude/agents/crypto-viral-content-creator.md +546 -0
- package/one/things/claude/agents/crypto-wallet-identification-expert.md +517 -0
- package/one/things/claude/agents/crypto-wallet-identifier.md +292 -0
- package/one/things/claude/agents/customer-journey-designer.md +481 -0
- package/one/things/claude/agents/customer-success-manager.md +581 -0
- package/one/things/claude/agents/dev.md +413 -0
- package/one/things/claude/agents/documenter.md +546 -0
- package/one/things/claude/agents/elevate-marketing-orchestrator.md +410 -0
- package/one/things/claude/agents/engagement-specialist.md +509 -0
- package/one/things/claude/agents/engineering-architect.md +387 -0
- package/one/things/claude/agents/engineering-business-analyst.md +537 -0
- package/one/things/claude/agents/engineering-developer.md +387 -0
- package/one/things/claude/agents/engineering-director.md +282 -0
- package/one/things/claude/agents/engineering-ingestor.md +649 -0
- package/one/things/claude/agents/engineering-product-manager.md +537 -0
- package/one/things/claude/agents/engineering-product-owner.md +537 -0
- package/one/things/claude/agents/engineering-project-coordinator.md +537 -0
- package/one/things/claude/agents/engineering-quality-assurance.md +393 -0
- package/one/things/claude/agents/engineering-team-manager.md +512 -0
- package/one/things/claude/agents/engineering-user-experience.md +387 -0
- package/one/things/claude/agents/framework-elevate-manager.md +294 -0
- package/one/things/claude/agents/improver.md +763 -0
- package/one/things/claude/agents/intelligence-team-manager.md +385 -0
- package/one/things/claude/agents/lead-capture-expert.md +466 -0
- package/one/things/claude/agents/lead-magnet-creator.md +453 -0
- package/one/things/claude/agents/market-research-analyst.md +412 -0
- package/one/things/claude/agents/marketing-brand-identity.md +314 -0
- package/one/things/claude/agents/marketing-content-hooks.md +450 -0
- package/one/things/claude/agents/marketing-content-multiplier.md +326 -0
- package/one/things/claude/agents/marketing-content-poster.md +361 -0
- package/one/things/claude/agents/marketing-customer-journey.md +326 -0
- package/one/things/claude/agents/marketing-director.md +397 -0
- package/one/things/claude/agents/marketing-engagement.md +326 -0
- package/one/things/claude/agents/marketing-lead-capture.md +326 -0
- package/one/things/claude/agents/marketing-lead-magnet.md +326 -0
- package/one/things/claude/agents/marketing-network-effects.md +326 -0
- package/one/things/claude/agents/marketing-nurture-campaigns.md +326 -0
- package/one/things/claude/agents/marketing-share-optimizer.md +326 -0
- package/one/things/claude/agents/marketing-team-manager.md +446 -0
- package/one/things/claude/agents/marketing-viral-growth.md +201 -0
- package/one/things/claude/agents/mission-commander.md +373 -0
- package/one/things/claude/agents/network-effect-analyst.md +587 -0
- package/one/things/claude/agents/nextjs-15-specialist.md +1547 -0
- package/one/things/claude/agents/npx.md +890 -0
- package/one/things/claude/agents/nurture-campaign-manager.md +531 -0
- package/one/things/claude/agents/one-master.md +355 -0
- package/one/things/claude/agents/one-orchestrator.md +315 -0
- package/one/things/claude/agents/one.md +601 -0
- package/one/things/claude/agents/playbook-generator.md +503 -0
- package/one/things/claude/agents/pm.md +326 -0
- package/one/things/claude/agents/po.md +345 -0
- package/one/things/claude/agents/qa.md +336 -0
- package/one/things/claude/agents/research-foundation-analyst.md +307 -0
- package/one/things/claude/agents/research-intelligence-gatherer.md +408 -0
- package/one/things/claude/agents/research-market-analyst.md +307 -0
- package/one/things/claude/agents/research-team-manager.md +482 -0
- package/one/things/claude/agents/sales-environment-optimizer.md +494 -0
- package/one/things/claude/agents/sales-team-manager.md +400 -0
- package/one/things/claude/agents/sales-upsell-strategist.md +307 -0
- package/one/things/claude/agents/service-advocacy-campaigns.md +307 -0
- package/one/things/claude/agents/service-advocacy-manager.md +307 -0
- package/one/things/claude/agents/service-success-manager.md +307 -0
- package/one/things/claude/agents/service-team-manager.md +400 -0
- package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +2302 -0
- package/one/things/claude/agents/share-optimization-specialist.md +551 -0
- package/one/things/claude/agents/sm.md +327 -0
- package/one/things/claude/agents/story-teller.md +473 -0
- package/one/things/claude/agents/task-master.md +596 -0
- package/one/things/claude/agents/tauri-cross-platform-specialist.md +1827 -0
- package/one/things/claude/agents/tester.md +556 -0
- package/one/things/claude/agents/the-bull-character-manager.md +580 -0
- package/one/things/claude/agents/tools-playbook-generator.md +489 -0
- package/one/things/claude/agents/turbo-repo-builder.md +316 -0
- package/one/things/claude/agents/upsell-strategist.md +480 -0
- package/one/things/claude/agents/ux-expert.md +335 -0
- package/one/things/claude/agents/viral-growth-orchestrator.md +497 -0
- package/one/things/claude/claude-code-hooks-development.json +21 -0
- package/one/things/claude/claude-code-hooks-production.json +21 -0
- package/one/things/claude/claude-code-hooks.json +25 -0
- package/one/things/claude/commands/agent.md +104 -0
- package/one/things/claude/commands/cascade-status.md +128 -0
- package/one/things/claude/commands/ingest.md +290 -0
- package/one/things/claude/commands/ingestor.md +136 -0
- package/one/things/claude/commands/mission.md +83 -0
- package/one/things/claude/commands/npx.md +133 -0
- package/one/things/claude/commands/one.md +440 -0
- package/one/things/claude/commands/quality-check.md +204 -0
- package/one/things/claude/commands/smart-route.md +220 -0
- package/one/things/claude/commands/start.md +121 -0
- package/one/things/claude/commands/story.md +83 -0
- package/one/things/claude/commands/task.md +173 -0
- package/one/things/claude/hook-bypass.json +32 -0
- package/one/things/claude/hooks/agent-hook-config.json +427 -0
- package/one/things/claude/hooks/agent-hook-manager.js +525 -0
- package/one/things/claude/hooks/agent-load-balancer.js +271 -0
- package/one/things/claude/hooks/agent-request-interceptor.js +70 -0
- package/one/things/claude/hooks/build-hook.sh +156 -0
- package/one/things/claude/hooks/cascade-feedback.js +297 -0
- package/one/things/claude/hooks/cascade-integration-hooks.js +648 -0
- package/one/things/claude/hooks/cleanup-hook.sh +201 -0
- package/one/things/claude/hooks/continuous-improvement-monitor.js +510 -0
- package/one/things/claude/hooks/file-organization-engine.js +427 -0
- package/one/things/claude/hooks/file-organization-hook.sh +80 -0
- package/one/things/claude/hooks/file-organization-monitor.js +269 -0
- package/one/things/claude/hooks/format-hook.sh +43 -0
- package/one/things/claude/hooks/hook-bypass.sh +293 -0
- package/one/things/claude/hooks/hook-config-manager.js +202 -0
- package/one/things/claude/hooks/hook-debouncer.sh +62 -0
- package/one/things/claude/hooks/hook-logger.sh +89 -0
- package/one/things/claude/hooks/hook-orchestrator.js +662 -0
- package/one/things/claude/hooks/hook-performance-report.js +120 -0
- package/one/things/claude/hooks/lint-hook.sh +140 -0
- package/one/things/claude/hooks/mcp-cascade-integration.js +816 -0
- package/one/things/claude/hooks/memory-optimizer.js +510 -0
- package/one/things/claude/hooks/notification-hook.sh +204 -0
- package/one/things/claude/hooks/ontology-compliance.js +394 -0
- package/one/things/claude/hooks/ontology-hook-manager.js +316 -0
- package/one/things/claude/hooks/ontology-validation-engine.js +317 -0
- package/one/things/claude/hooks/ontology-validation-hook.sh +86 -0
- package/one/things/claude/hooks/performance-metrics.json +25 -0
- package/one/things/claude/hooks/performance-monitoring-hook.js +422 -0
- package/one/things/claude/hooks/quality-scoring-engine.js +834 -0
- package/one/things/claude/hooks/security-hook.sh +256 -0
- package/one/things/claude/hooks/simple-load-balancer.js +238 -0
- package/one/things/claude/hooks/startup-optimizer.js +625 -0
- package/one/things/claude/hooks/story-scoring-system.js +445 -0
- package/one/things/claude/hooks/story-validation-engine.js +473 -0
- package/one/things/claude/hooks/story-validation-hook-enhanced.sh +210 -0
- package/one/things/claude/hooks/story-validation-hook.sh +145 -0
- package/one/things/claude/hooks/structure-synchronizer.js +194 -0
- package/one/things/claude/hooks/sub-agent-output-validator.js +647 -0
- package/one/things/claude/hooks/sub-agent-validation-hook.js +343 -0
- package/one/things/claude/hooks/test-hook.sh +145 -0
- package/one/things/claude/hooks/test-story-validation.sh +170 -0
- package/one/things/claude/hooks/trinity-validation-system.js +392 -0
- package/one/things/claude/settings-local.json +86 -0
- package/one/things/cli-code.md +652 -0
- package/one/things/cli-compiler-code.md +652 -0
- package/one/things/cli.md +1045 -0
- package/one/things/components/card-shadcn.md +929 -0
- package/one/things/components/card.md +1050 -0
- package/one/things/components.md +1669 -0
- package/one/things/componets.md +4 -0
- package/one/things/copilotkit.md +1559 -0
- package/one/things/creator-diagram.md +166 -0
- package/one/things/examples/children/lemonade-stand.md +366 -0
- package/one/things/examples/enterprise/crm-saas.md +1429 -0
- package/one/things/features/1-1-agent-prompts/design.md +470 -0
- package/one/things/features/1-1-agent-prompts/tests.md +264 -0
- package/one/things/features/1-1-agent-prompts.md +486 -0
- package/one/things/features/1-2-yaml-orchestrator/design.md +497 -0
- package/one/things/features/1-2-yaml-orchestrator/tests.md +227 -0
- package/one/things/features/1-2-yaml-orchestrator.md +516 -0
- package/one/things/features/1-3-event-coordination/design.md +544 -0
- package/one/things/features/1-3-event-coordination/tests.md +223 -0
- package/one/things/features/1-3-event-coordination.md +508 -0
- package/one/things/features/1-4-knowledge-management/design.md +609 -0
- package/one/things/features/1-4-knowledge-management/tests.md +195 -0
- package/one/things/features/1-4-knowledge-management.md +577 -0
- package/one/things/features/1-5-quality-loops/design.md +797 -0
- package/one/things/features/1-5-quality-loops/tests.md +212 -0
- package/one/things/features/1-5-quality-loops.md +641 -0
- package/one/things/features/1-6-numbering-structure/design.md +610 -0
- package/one/things/features/1-6-numbering-structure/tests.md +213 -0
- package/one/things/features/1-6-numbering-structure.md +575 -0
- package/one/things/features/2-cli.md +1235 -0
- package/one/things/features/use-one-backend.md +1180 -0
- package/one/things/ideas/1-create-workflow.md +189 -0
- package/one/things/plans/1-create-workflow-status.md +555 -0
- package/one/things/plans/1-create-workflow.md +713 -0
- package/one/things/plans/app.md +761 -0
- package/one/things/plans/better-auth-any-backend-revised.md +1065 -0
- package/one/things/plans/better-auth-any-backend.md +1852 -0
- package/one/things/plans/better-auth-available-features.md +235 -0
- package/one/things/plans/big-plan.md +38 -0
- package/one/things/plans/convex-better-auth.md +1109 -0
- package/one/things/plans/convex-on-off.md +389 -0
- package/one/things/plans/desktop.md +1121 -0
- package/one/things/plans/effect-components.md +1669 -0
- package/one/things/plans/effect.md +973 -0
- package/one/things/plans/email.md +953 -0
- package/one/things/plans/enhance-auth.md +1669 -0
- package/one/things/plans/install-components.md +198 -0
- package/one/things/plans/landing.md +728 -0
- package/one/things/plans/layout.md +205 -0
- package/one/things/plans/mail-backend.md +1308 -0
- package/one/things/plans/mail.md +2624 -0
- package/one/things/plans/next-features.md +83 -0
- package/one/things/plans/one.md +658 -0
- package/one/things/plans/ontology-6-dimensions.md +2216 -0
- package/one/things/plans/ontology-driven-strategy.md +866 -0
- package/one/things/plans/ontology-ui-approach.md +357 -0
- package/one/things/plans/open-agent.md +785 -0
- package/one/things/plans/performace.md +90 -0
- package/one/things/plans/releases.md +809 -0
- package/one/things/plans/repos.md +76 -0
- package/one/things/plans/separate-copy-2.md +1293 -0
- package/one/things/plans/separate-copy-3.md +2458 -0
- package/one/things/plans/separate-copy.md +1293 -0
- package/one/things/plans/separate.md +1983 -0
- package/one/things/plans/shadcn-integration-summary.md +450 -0
- package/one/things/plans/sidebar.md +172 -0
- package/one/things/plans/small-fixes.md +5 -0
- package/one/things/plans/test-backend-connection.md +476 -0
- package/one/things/plans/workflow-files.md +1196 -0
- package/one/things/plans/workflow.md +1372 -0
- package/one/things/products/cascade-landing-page.md +737 -0
- package/one/things/products/cascade.md +1518 -0
- package/one/things/products/context-engineering.md +1427 -0
- package/one/things/products/onthology.md +0 -0
- package/one/things/products/ontology-ui-shadcn.md +1280 -0
- package/one/things/products/ontology-ui.md +1387 -0
- package/one/things/products/ontology.md +717 -0
- package/one/things/products/sdk.md +557 -0
- package/one/things/promptkit.md +903 -0
- package/one/things/service-providers-new.md +982 -0
- package/one/things/service-providers.md +1092 -0
- package/one/things/things.md +349 -0
- package/one/things/todo.md +1248 -0
- package/package.json +5 -2
|
@@ -0,0 +1,1015 @@
|
|
|
1
|
+
# N8N Integration - AI Agent Tool Integration
|
|
2
|
+
|
|
3
|
+
**Version:** 1.0.0
|
|
4
|
+
**Purpose:** Enable AI agents to execute n8n workflows as tools, allowing seamless integration between ONE platform and n8n automation workflows
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
n8n is an extensible workflow automation tool that allows users to create complex automations connecting 400+ services. This integration enables:
|
|
11
|
+
|
|
12
|
+
1. **AI Agents → n8n**: Agents can trigger n8n workflows as tools
|
|
13
|
+
2. **n8n → AI Agents**: n8n workflows can call agent actions via webhooks
|
|
14
|
+
3. **Workflow as Tool**: Each n8n workflow becomes a callable tool for agents
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Architecture
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
22
|
+
│ ONE Platform Agents │
|
|
23
|
+
│ (Strategy, Marketing, Sales, Service, etc.) │
|
|
24
|
+
└────────────────┬────────────────────────────────────────────────┘
|
|
25
|
+
│
|
|
26
|
+
│ Execute workflow as tool
|
|
27
|
+
↓
|
|
28
|
+
┌───────────────┐
|
|
29
|
+
│ N8NService │ ← Effect.ts service
|
|
30
|
+
│ (Layer) │
|
|
31
|
+
└───────┬───────┘
|
|
32
|
+
│
|
|
33
|
+
│ HTTP API call
|
|
34
|
+
↓
|
|
35
|
+
┌───────────────────────┐
|
|
36
|
+
│ n8n Instance │
|
|
37
|
+
│ (Self-hosted/Cloud) │
|
|
38
|
+
└───────┬───────────────┘
|
|
39
|
+
│
|
|
40
|
+
│ Executes workflow
|
|
41
|
+
↓
|
|
42
|
+
┌─────────────────────────────────────┐
|
|
43
|
+
│ External Services (400+ integrations)│
|
|
44
|
+
│ ├─ Google Sheets │
|
|
45
|
+
│ ├─ Airtable │
|
|
46
|
+
│ ├─ Slack │
|
|
47
|
+
│ ├─ Notion │
|
|
48
|
+
│ ├─ Zapier │
|
|
49
|
+
│ ├─ GitHub │
|
|
50
|
+
│ └─ Any HTTP API │
|
|
51
|
+
└─────────────────────────────────────┘
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Ontology Mapping
|
|
57
|
+
|
|
58
|
+
### Entity Types Used
|
|
59
|
+
|
|
60
|
+
Uses the unified external integration schema from `Ontology.md`:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
// EXTERNAL INTEGRATIONS (already in Ontology.md)
|
|
64
|
+
| 'external_agent' // External AI agent (not used for n8n)
|
|
65
|
+
| 'external_workflow' // External workflow (n8n, Zapier, Make, etc.)
|
|
66
|
+
| 'external_connection' // Connection config to external service
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Entity Properties
|
|
70
|
+
|
|
71
|
+
**external_workflow Properties (for n8n workflows):**
|
|
72
|
+
```typescript
|
|
73
|
+
{
|
|
74
|
+
platform: "n8n", // Platform identifier
|
|
75
|
+
workflowId: string, // n8n workflow ID
|
|
76
|
+
name: string, // Workflow name
|
|
77
|
+
description: string, // What the workflow does
|
|
78
|
+
webhookUrl?: string, // Trigger URL
|
|
79
|
+
active: boolean, // Is workflow active?
|
|
80
|
+
tags: string[], // n8n tags/categories
|
|
81
|
+
inputSchema: { // Expected input parameters
|
|
82
|
+
[key: string]: {
|
|
83
|
+
type: "string" | "number" | "boolean" | "object" | "array",
|
|
84
|
+
required: boolean,
|
|
85
|
+
description: string,
|
|
86
|
+
default?: any
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
outputSchema: { // Expected output structure
|
|
90
|
+
[key: string]: {
|
|
91
|
+
type: "string" | "number" | "boolean" | "object" | "array",
|
|
92
|
+
description: string
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
executionCount: number, // Total executions
|
|
96
|
+
successRate: number, // 0.0 to 1.0
|
|
97
|
+
averageExecutionTime: number, // milliseconds
|
|
98
|
+
lastExecutedAt?: number,
|
|
99
|
+
createdAt: number,
|
|
100
|
+
updatedAt: number
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Workflow Execution Tracking:**
|
|
105
|
+
|
|
106
|
+
Use events (not a separate entity type) to track executions:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
// Execution as event
|
|
110
|
+
{
|
|
111
|
+
type: 'agent_executed',
|
|
112
|
+
actorId: agentId,
|
|
113
|
+
targetId: workflowId, // external_workflow entity
|
|
114
|
+
timestamp: Date.now(),
|
|
115
|
+
metadata: {
|
|
116
|
+
action: 'workflow_executed',
|
|
117
|
+
platform: 'n8n',
|
|
118
|
+
executionId: 'exec-123', // n8n execution ID
|
|
119
|
+
status: 'success',
|
|
120
|
+
startedAt: number,
|
|
121
|
+
finishedAt: number,
|
|
122
|
+
executionTime: number,
|
|
123
|
+
input: any,
|
|
124
|
+
output: any,
|
|
125
|
+
triggeredBy: {
|
|
126
|
+
source: 'agent' | 'user' | 'cron' | 'webhook'
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**external_connection Properties (for n8n connection):**
|
|
133
|
+
```typescript
|
|
134
|
+
{
|
|
135
|
+
platform: "n8n",
|
|
136
|
+
name: string, // Connection name
|
|
137
|
+
baseUrl?: string, // n8n instance URL
|
|
138
|
+
apiKey?: string, // Encrypted n8n API key
|
|
139
|
+
websocketUrl?: string, // WebSocket endpoint (if supported)
|
|
140
|
+
webhookSecret?: string, // Webhook signature secret
|
|
141
|
+
connectionType: "rest" | "webhook",
|
|
142
|
+
authentication: {
|
|
143
|
+
type: "apiKey",
|
|
144
|
+
credentials: any // Encrypted credentials
|
|
145
|
+
},
|
|
146
|
+
status: "active" | "inactive" | "error",
|
|
147
|
+
lastConnectedAt?: number,
|
|
148
|
+
lastError?: string,
|
|
149
|
+
linkedEntityIds: string[], // Connected workflow IDs
|
|
150
|
+
rateLimits?: {
|
|
151
|
+
requestsPerMinute: number,
|
|
152
|
+
requestsPerDay: number
|
|
153
|
+
},
|
|
154
|
+
createdAt: number,
|
|
155
|
+
updatedAt: number
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Connection Types
|
|
160
|
+
|
|
161
|
+
Use existing connection types:
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
// Agent → n8n workflow
|
|
165
|
+
{
|
|
166
|
+
fromEntityId: agentId,
|
|
167
|
+
toEntityId: workflowId, // external_workflow entity
|
|
168
|
+
relationshipType: 'integrated_with', // Existing type
|
|
169
|
+
metadata: {
|
|
170
|
+
platform: 'n8n',
|
|
171
|
+
integrationType: 'workflow',
|
|
172
|
+
permissions: ['execute', 'view'],
|
|
173
|
+
configuredAt: Date.now()
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Note:** Workflow executions are tracked as events, not as separate entities or connections.
|
|
179
|
+
|
|
180
|
+
### Event Types
|
|
181
|
+
|
|
182
|
+
Use existing consolidated event types:
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
// Workflow executed successfully
|
|
186
|
+
{
|
|
187
|
+
type: 'agent_executed', // Existing type
|
|
188
|
+
actorId: agentId,
|
|
189
|
+
targetId: workflowId, // external_workflow entity
|
|
190
|
+
timestamp: Date.now(),
|
|
191
|
+
metadata: {
|
|
192
|
+
action: 'workflow_executed',
|
|
193
|
+
platform: 'n8n',
|
|
194
|
+
executionId: 'exec-123',
|
|
195
|
+
status: 'success',
|
|
196
|
+
startedAt: 1234567890,
|
|
197
|
+
finishedAt: 1234568890,
|
|
198
|
+
executionTime: 1000,
|
|
199
|
+
input: {...},
|
|
200
|
+
output: {...},
|
|
201
|
+
triggeredBy: {
|
|
202
|
+
source: 'agent'
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Workflow failed
|
|
208
|
+
{
|
|
209
|
+
type: 'agent_failed', // Existing type
|
|
210
|
+
actorId: agentId,
|
|
211
|
+
targetId: workflowId,
|
|
212
|
+
timestamp: Date.now(),
|
|
213
|
+
metadata: {
|
|
214
|
+
action: 'workflow_failed',
|
|
215
|
+
platform: 'n8n',
|
|
216
|
+
executionId: 'exec-124',
|
|
217
|
+
error: 'Connection timeout',
|
|
218
|
+
node: 'HTTP Request',
|
|
219
|
+
triggeredBy: {
|
|
220
|
+
source: 'agent'
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Effect.ts Service Implementation
|
|
229
|
+
|
|
230
|
+
### N8NProvider
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
import { Effect, Layer, Context } from 'effect';
|
|
234
|
+
import { HttpProvider } from './http';
|
|
235
|
+
|
|
236
|
+
export class N8NError extends Error {
|
|
237
|
+
readonly _tag = 'N8NError';
|
|
238
|
+
constructor(
|
|
239
|
+
public readonly message: string,
|
|
240
|
+
public readonly workflowId?: string,
|
|
241
|
+
public readonly statusCode?: number
|
|
242
|
+
) {
|
|
243
|
+
super(message);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export class N8NProvider extends Effect.Service<N8NProvider>()('N8NProvider', {
|
|
248
|
+
effect: Effect.gen(function* () {
|
|
249
|
+
const http = yield* HttpProvider;
|
|
250
|
+
|
|
251
|
+
return {
|
|
252
|
+
/**
|
|
253
|
+
* Execute n8n workflow via webhook
|
|
254
|
+
*/
|
|
255
|
+
executeWorkflow: (args: {
|
|
256
|
+
webhookUrl: string;
|
|
257
|
+
input: Record<string, any>;
|
|
258
|
+
timeout?: number;
|
|
259
|
+
}) =>
|
|
260
|
+
Effect.gen(function* () {
|
|
261
|
+
const result = yield* http.post({
|
|
262
|
+
url: args.webhookUrl,
|
|
263
|
+
body: args.input,
|
|
264
|
+
headers: {
|
|
265
|
+
'Content-Type': 'application/json',
|
|
266
|
+
},
|
|
267
|
+
}).pipe(
|
|
268
|
+
Effect.timeout(args.timeout ?? '30 seconds'),
|
|
269
|
+
Effect.catchAll((error) =>
|
|
270
|
+
Effect.fail(
|
|
271
|
+
new N8NError(
|
|
272
|
+
`Workflow execution failed: ${error.message}`,
|
|
273
|
+
undefined,
|
|
274
|
+
error.statusCode
|
|
275
|
+
)
|
|
276
|
+
)
|
|
277
|
+
)
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
return result.data;
|
|
281
|
+
}),
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Get workflow execution status via n8n API
|
|
285
|
+
*/
|
|
286
|
+
getExecutionStatus: (args: {
|
|
287
|
+
baseUrl: string;
|
|
288
|
+
apiKey: string;
|
|
289
|
+
executionId: string;
|
|
290
|
+
}) =>
|
|
291
|
+
Effect.gen(function* () {
|
|
292
|
+
const result = yield* http.get({
|
|
293
|
+
url: `${args.baseUrl}/api/v1/executions/${args.executionId}`,
|
|
294
|
+
headers: {
|
|
295
|
+
'X-N8N-API-KEY': args.apiKey,
|
|
296
|
+
},
|
|
297
|
+
}).pipe(
|
|
298
|
+
Effect.catchAll((error) =>
|
|
299
|
+
Effect.fail(
|
|
300
|
+
new N8NError(
|
|
301
|
+
`Failed to get execution status: ${error.message}`,
|
|
302
|
+
undefined,
|
|
303
|
+
error.statusCode
|
|
304
|
+
)
|
|
305
|
+
)
|
|
306
|
+
)
|
|
307
|
+
);
|
|
308
|
+
|
|
309
|
+
return result.data as {
|
|
310
|
+
id: string;
|
|
311
|
+
finished: boolean;
|
|
312
|
+
mode: string;
|
|
313
|
+
startedAt: string;
|
|
314
|
+
stoppedAt?: string;
|
|
315
|
+
workflowData: any;
|
|
316
|
+
data?: any;
|
|
317
|
+
};
|
|
318
|
+
}),
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* List workflows from n8n instance
|
|
322
|
+
*/
|
|
323
|
+
listWorkflows: (args: { baseUrl: string; apiKey: string }) =>
|
|
324
|
+
Effect.gen(function* () {
|
|
325
|
+
const result = yield* http.get({
|
|
326
|
+
url: `${args.baseUrl}/api/v1/workflows`,
|
|
327
|
+
headers: {
|
|
328
|
+
'X-N8N-API-KEY': args.apiKey,
|
|
329
|
+
},
|
|
330
|
+
}).pipe(
|
|
331
|
+
Effect.catchAll((error) =>
|
|
332
|
+
Effect.fail(
|
|
333
|
+
new N8NError(
|
|
334
|
+
`Failed to list workflows: ${error.message}`,
|
|
335
|
+
undefined,
|
|
336
|
+
error.statusCode
|
|
337
|
+
)
|
|
338
|
+
)
|
|
339
|
+
)
|
|
340
|
+
);
|
|
341
|
+
|
|
342
|
+
return result.data as Array<{
|
|
343
|
+
id: string;
|
|
344
|
+
name: string;
|
|
345
|
+
active: boolean;
|
|
346
|
+
tags: Array<{ id: string; name: string }>;
|
|
347
|
+
createdAt: string;
|
|
348
|
+
updatedAt: string;
|
|
349
|
+
}>;
|
|
350
|
+
}),
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Activate/deactivate workflow
|
|
354
|
+
*/
|
|
355
|
+
toggleWorkflow: (args: {
|
|
356
|
+
baseUrl: string;
|
|
357
|
+
apiKey: string;
|
|
358
|
+
workflowId: string;
|
|
359
|
+
active: boolean;
|
|
360
|
+
}) =>
|
|
361
|
+
Effect.gen(function* () {
|
|
362
|
+
yield* http.patch({
|
|
363
|
+
url: `${args.baseUrl}/api/v1/workflows/${args.workflowId}`,
|
|
364
|
+
headers: {
|
|
365
|
+
'X-N8N-API-KEY': args.apiKey,
|
|
366
|
+
'Content-Type': 'application/json',
|
|
367
|
+
},
|
|
368
|
+
body: {
|
|
369
|
+
active: args.active,
|
|
370
|
+
},
|
|
371
|
+
}).pipe(
|
|
372
|
+
Effect.catchAll((error) =>
|
|
373
|
+
Effect.fail(
|
|
374
|
+
new N8NError(
|
|
375
|
+
`Failed to toggle workflow: ${error.message}`,
|
|
376
|
+
args.workflowId,
|
|
377
|
+
error.statusCode
|
|
378
|
+
)
|
|
379
|
+
)
|
|
380
|
+
)
|
|
381
|
+
);
|
|
382
|
+
}),
|
|
383
|
+
};
|
|
384
|
+
}),
|
|
385
|
+
dependencies: [HttpProvider.Default],
|
|
386
|
+
}) {}
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### N8NService (Business Logic)
|
|
390
|
+
|
|
391
|
+
```typescript
|
|
392
|
+
import { Effect } from 'effect';
|
|
393
|
+
import { ConvexDatabase } from './convex-database';
|
|
394
|
+
import { N8NProvider } from './n8n-provider';
|
|
395
|
+
|
|
396
|
+
export class N8NService extends Effect.Service<N8NService>()('N8NService', {
|
|
397
|
+
effect: Effect.gen(function* () {
|
|
398
|
+
const db = yield* ConvexDatabase;
|
|
399
|
+
const n8n = yield* N8NProvider;
|
|
400
|
+
|
|
401
|
+
return {
|
|
402
|
+
/**
|
|
403
|
+
* Execute workflow as tool for AI agent
|
|
404
|
+
*/
|
|
405
|
+
executeWorkflowTool: (args: {
|
|
406
|
+
agentId: Id<'entities'>;
|
|
407
|
+
workflowId: Id<'entities'>;
|
|
408
|
+
input: Record<string, any>;
|
|
409
|
+
}) =>
|
|
410
|
+
Effect.gen(function* () {
|
|
411
|
+
// 1. Get workflow entity
|
|
412
|
+
const workflow = yield* db.get(args.workflowId).pipe(
|
|
413
|
+
Effect.flatMap((w) =>
|
|
414
|
+
w?.type === 'n8n_workflow'
|
|
415
|
+
? Effect.succeed(w)
|
|
416
|
+
: Effect.fail(new Error('Invalid workflow'))
|
|
417
|
+
)
|
|
418
|
+
);
|
|
419
|
+
|
|
420
|
+
// 2. Validate input against schema
|
|
421
|
+
yield* validateInput(args.input, workflow.properties.inputSchema);
|
|
422
|
+
|
|
423
|
+
// 3. Create execution record
|
|
424
|
+
const executionId = yield* db.insert('entities', {
|
|
425
|
+
type: 'n8n_execution',
|
|
426
|
+
name: `Execution ${Date.now()}`,
|
|
427
|
+
properties: {
|
|
428
|
+
workflowId: workflow.properties.workflowId,
|
|
429
|
+
executionId: '', // Will be filled after n8n responds
|
|
430
|
+
status: 'running',
|
|
431
|
+
startedAt: Date.now(),
|
|
432
|
+
input: args.input,
|
|
433
|
+
triggeredBy: {
|
|
434
|
+
agentId: args.agentId,
|
|
435
|
+
source: 'agent',
|
|
436
|
+
},
|
|
437
|
+
},
|
|
438
|
+
status: 'active',
|
|
439
|
+
createdAt: Date.now(),
|
|
440
|
+
updatedAt: Date.now(),
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
// 4. Execute workflow via webhook
|
|
444
|
+
const result = yield* n8n
|
|
445
|
+
.executeWorkflow({
|
|
446
|
+
webhookUrl: workflow.properties.webhookUrl,
|
|
447
|
+
input: args.input,
|
|
448
|
+
timeout: 60000, // 1 minute
|
|
449
|
+
})
|
|
450
|
+
.pipe(
|
|
451
|
+
Effect.retry({ times: 2, schedule: Schedule.exponential('1 second') }),
|
|
452
|
+
Effect.catchAll((error) =>
|
|
453
|
+
Effect.gen(function* () {
|
|
454
|
+
// Update execution with error
|
|
455
|
+
yield* db.patch(executionId, {
|
|
456
|
+
properties: {
|
|
457
|
+
...workflow.properties,
|
|
458
|
+
status: 'error',
|
|
459
|
+
finishedAt: Date.now(),
|
|
460
|
+
error: {
|
|
461
|
+
message: error.message,
|
|
462
|
+
},
|
|
463
|
+
},
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
// Log failure event
|
|
467
|
+
yield* db.insert('events', {
|
|
468
|
+
type: 'agent_failed',
|
|
469
|
+
actorId: args.agentId,
|
|
470
|
+
targetId: args.workflowId,
|
|
471
|
+
timestamp: Date.now(),
|
|
472
|
+
metadata: {
|
|
473
|
+
action: 'workflow_failed',
|
|
474
|
+
executionId,
|
|
475
|
+
error: error.message,
|
|
476
|
+
},
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
return Effect.fail(error);
|
|
480
|
+
})
|
|
481
|
+
)
|
|
482
|
+
);
|
|
483
|
+
|
|
484
|
+
// 5. Update execution with success
|
|
485
|
+
const finishedAt = Date.now();
|
|
486
|
+
yield* db.patch(executionId, {
|
|
487
|
+
properties: {
|
|
488
|
+
status: 'success',
|
|
489
|
+
finishedAt,
|
|
490
|
+
executionTime: finishedAt - workflow.properties.startedAt,
|
|
491
|
+
output: result,
|
|
492
|
+
},
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
// 6. Log success event
|
|
496
|
+
yield* db.insert('events', {
|
|
497
|
+
type: 'agent_executed',
|
|
498
|
+
actorId: args.agentId,
|
|
499
|
+
targetId: args.workflowId,
|
|
500
|
+
timestamp: Date.now(),
|
|
501
|
+
metadata: {
|
|
502
|
+
action: 'workflow_executed',
|
|
503
|
+
executionId,
|
|
504
|
+
status: 'success',
|
|
505
|
+
executionTime: finishedAt - workflow.properties.startedAt,
|
|
506
|
+
input: args.input,
|
|
507
|
+
output: result,
|
|
508
|
+
},
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
// 7. Update workflow stats
|
|
512
|
+
yield* db.patch(args.workflowId, {
|
|
513
|
+
properties: {
|
|
514
|
+
...workflow.properties,
|
|
515
|
+
executionCount: workflow.properties.executionCount + 1,
|
|
516
|
+
lastExecutedAt: Date.now(),
|
|
517
|
+
},
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
return {
|
|
521
|
+
executionId,
|
|
522
|
+
status: 'success' as const,
|
|
523
|
+
output: result,
|
|
524
|
+
};
|
|
525
|
+
}),
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Sync workflows from n8n instance
|
|
529
|
+
*/
|
|
530
|
+
syncWorkflows: (args: { credentialId: Id<'entities'>; userId: Id<'entities'> }) =>
|
|
531
|
+
Effect.gen(function* () {
|
|
532
|
+
// 1. Get credentials
|
|
533
|
+
const credential = yield* db.get(args.credentialId).pipe(
|
|
534
|
+
Effect.flatMap((c) =>
|
|
535
|
+
c?.type === 'n8n_credential'
|
|
536
|
+
? Effect.succeed(c)
|
|
537
|
+
: Effect.fail(new Error('Invalid credential'))
|
|
538
|
+
)
|
|
539
|
+
);
|
|
540
|
+
|
|
541
|
+
// 2. List workflows from n8n
|
|
542
|
+
const workflows = yield* n8n.listWorkflows({
|
|
543
|
+
baseUrl: credential.properties.baseUrl,
|
|
544
|
+
apiKey: credential.properties.apiKey,
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
// 3. Create/update workflow entities
|
|
548
|
+
const results = yield* Effect.all(
|
|
549
|
+
workflows.map((w) =>
|
|
550
|
+
Effect.gen(function* () {
|
|
551
|
+
// Check if workflow already exists
|
|
552
|
+
const existing = yield* db
|
|
553
|
+
.query('entities')
|
|
554
|
+
.filter((q) =>
|
|
555
|
+
q.and(
|
|
556
|
+
q.eq(q.field('type'), 'n8n_workflow'),
|
|
557
|
+
q.eq(q.field('properties.workflowId'), w.id)
|
|
558
|
+
)
|
|
559
|
+
)
|
|
560
|
+
.collect()
|
|
561
|
+
.pipe(Effect.map((results) => results[0]));
|
|
562
|
+
|
|
563
|
+
if (existing) {
|
|
564
|
+
// Update existing
|
|
565
|
+
yield* db.patch(existing._id, {
|
|
566
|
+
properties: {
|
|
567
|
+
...existing.properties,
|
|
568
|
+
name: w.name,
|
|
569
|
+
active: w.active,
|
|
570
|
+
tags: w.tags.map((t) => t.name),
|
|
571
|
+
updatedAt: Date.now(),
|
|
572
|
+
},
|
|
573
|
+
});
|
|
574
|
+
return existing._id;
|
|
575
|
+
} else {
|
|
576
|
+
// Create new
|
|
577
|
+
const workflowId = yield* db.insert('entities', {
|
|
578
|
+
type: 'n8n_workflow',
|
|
579
|
+
name: w.name,
|
|
580
|
+
properties: {
|
|
581
|
+
workflowId: w.id,
|
|
582
|
+
name: w.name,
|
|
583
|
+
description: `n8n workflow: ${w.name}`,
|
|
584
|
+
webhookUrl: `${credential.properties.baseUrl}/webhook/${w.id}`,
|
|
585
|
+
active: w.active,
|
|
586
|
+
tags: w.tags.map((t) => t.name),
|
|
587
|
+
inputSchema: {}, // To be filled manually
|
|
588
|
+
outputSchema: {},
|
|
589
|
+
executionCount: 0,
|
|
590
|
+
successRate: 1.0,
|
|
591
|
+
averageExecutionTime: 0,
|
|
592
|
+
createdAt: Date.now(),
|
|
593
|
+
updatedAt: Date.now(),
|
|
594
|
+
},
|
|
595
|
+
status: w.active ? 'active' : 'inactive',
|
|
596
|
+
createdAt: Date.now(),
|
|
597
|
+
updatedAt: Date.now(),
|
|
598
|
+
});
|
|
599
|
+
|
|
600
|
+
// Create connection
|
|
601
|
+
yield* db.insert('connections', {
|
|
602
|
+
fromEntityId: args.userId,
|
|
603
|
+
toEntityId: workflowId,
|
|
604
|
+
relationshipType: 'integrated_with',
|
|
605
|
+
metadata: {
|
|
606
|
+
integrationType: 'n8n_workflow',
|
|
607
|
+
permissions: ['execute', 'view'],
|
|
608
|
+
configuredAt: Date.now(),
|
|
609
|
+
},
|
|
610
|
+
createdAt: Date.now(),
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
return workflowId;
|
|
614
|
+
}
|
|
615
|
+
})
|
|
616
|
+
),
|
|
617
|
+
{ concurrency: 5 }
|
|
618
|
+
);
|
|
619
|
+
|
|
620
|
+
return {
|
|
621
|
+
synced: results.length,
|
|
622
|
+
workflowIds: results,
|
|
623
|
+
};
|
|
624
|
+
}),
|
|
625
|
+
};
|
|
626
|
+
}),
|
|
627
|
+
dependencies: [ConvexDatabase.Default, N8NProvider.Default],
|
|
628
|
+
}) {}
|
|
629
|
+
|
|
630
|
+
// Helper: Validate input against schema
|
|
631
|
+
function validateInput(
|
|
632
|
+
input: Record<string, any>,
|
|
633
|
+
schema: Record<string, any>
|
|
634
|
+
): Effect.Effect<void, Error> {
|
|
635
|
+
return Effect.gen(function* () {
|
|
636
|
+
for (const [key, fieldSchema] of Object.entries(schema)) {
|
|
637
|
+
if (fieldSchema.required && !(key in input)) {
|
|
638
|
+
yield* Effect.fail(new Error(`Missing required field: ${key}`));
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
if (key in input && typeof input[key] !== fieldSchema.type) {
|
|
642
|
+
yield* Effect.fail(
|
|
643
|
+
new Error(`Invalid type for field ${key}: expected ${fieldSchema.type}`)
|
|
644
|
+
);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
---
|
|
652
|
+
|
|
653
|
+
## Convex Function Wrappers
|
|
654
|
+
|
|
655
|
+
```typescript
|
|
656
|
+
// convex/n8n.ts
|
|
657
|
+
import { mutation, query } from './_generated/server';
|
|
658
|
+
import { v } from 'convex/values';
|
|
659
|
+
import { confect } from './confect';
|
|
660
|
+
import { N8NService } from './services/n8n';
|
|
661
|
+
import { MainLayer } from './layers';
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* Execute n8n workflow
|
|
665
|
+
*/
|
|
666
|
+
export const executeWorkflow = confect.mutation({
|
|
667
|
+
args: {
|
|
668
|
+
workflowId: v.id('entities'),
|
|
669
|
+
input: v.any(),
|
|
670
|
+
},
|
|
671
|
+
handler: (ctx, args) =>
|
|
672
|
+
Effect.gen(function* () {
|
|
673
|
+
const userId = yield* getUserId(ctx);
|
|
674
|
+
const service = yield* N8NService;
|
|
675
|
+
|
|
676
|
+
return yield* service.executeWorkflowTool({
|
|
677
|
+
agentId: userId, // Or actual agent ID
|
|
678
|
+
workflowId: args.workflowId,
|
|
679
|
+
input: args.input,
|
|
680
|
+
});
|
|
681
|
+
}).pipe(Effect.provide(MainLayer)),
|
|
682
|
+
});
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Sync workflows from n8n instance
|
|
686
|
+
*/
|
|
687
|
+
export const syncWorkflows = confect.mutation({
|
|
688
|
+
args: {
|
|
689
|
+
credentialId: v.id('entities'),
|
|
690
|
+
},
|
|
691
|
+
handler: (ctx, args) =>
|
|
692
|
+
Effect.gen(function* () {
|
|
693
|
+
const userId = yield* getUserId(ctx);
|
|
694
|
+
const service = yield* N8NService;
|
|
695
|
+
|
|
696
|
+
return yield* service.syncWorkflows({
|
|
697
|
+
credentialId: args.credentialId,
|
|
698
|
+
userId,
|
|
699
|
+
});
|
|
700
|
+
}).pipe(Effect.provide(MainLayer)),
|
|
701
|
+
});
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Get workflow executions
|
|
705
|
+
*/
|
|
706
|
+
export const getWorkflowExecutions = query({
|
|
707
|
+
args: {
|
|
708
|
+
workflowId: v.id('entities'),
|
|
709
|
+
limit: v.optional(v.number()),
|
|
710
|
+
},
|
|
711
|
+
handler: async (ctx, args) => {
|
|
712
|
+
const executions = await ctx.db
|
|
713
|
+
.query('entities')
|
|
714
|
+
.filter((q) =>
|
|
715
|
+
q.and(
|
|
716
|
+
q.eq(q.field('type'), 'n8n_execution'),
|
|
717
|
+
q.eq(q.field('properties.workflowId'), args.workflowId)
|
|
718
|
+
)
|
|
719
|
+
)
|
|
720
|
+
.order('desc')
|
|
721
|
+
.take(args.limit ?? 50);
|
|
722
|
+
|
|
723
|
+
return executions;
|
|
724
|
+
},
|
|
725
|
+
});
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
---
|
|
729
|
+
|
|
730
|
+
## Usage Examples
|
|
731
|
+
|
|
732
|
+
### 1. Agent Using n8n Workflow as Tool
|
|
733
|
+
|
|
734
|
+
```typescript
|
|
735
|
+
// Agent executes "Send Weekly Report" workflow
|
|
736
|
+
export class ReportingAgent extends Effect.Service<ReportingAgent>()(
|
|
737
|
+
'ReportingAgent',
|
|
738
|
+
{
|
|
739
|
+
effect: Effect.gen(function* () {
|
|
740
|
+
const n8n = yield* N8NService;
|
|
741
|
+
|
|
742
|
+
return {
|
|
743
|
+
sendWeeklyReport: (userId: Id<'entities'>) =>
|
|
744
|
+
Effect.gen(function* () {
|
|
745
|
+
// Get user data
|
|
746
|
+
const userData = yield* getUserMetrics(userId);
|
|
747
|
+
|
|
748
|
+
// Execute n8n workflow
|
|
749
|
+
const result = yield* n8n.executeWorkflowTool({
|
|
750
|
+
agentId: 'agent-reporting',
|
|
751
|
+
workflowId: 'workflow-weekly-report',
|
|
752
|
+
input: {
|
|
753
|
+
userId,
|
|
754
|
+
metrics: userData.metrics,
|
|
755
|
+
period: 'week',
|
|
756
|
+
},
|
|
757
|
+
});
|
|
758
|
+
|
|
759
|
+
return result;
|
|
760
|
+
}),
|
|
761
|
+
};
|
|
762
|
+
}),
|
|
763
|
+
}
|
|
764
|
+
) {}
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
### 2. Marketing Agent Using n8n for Email Campaign
|
|
768
|
+
|
|
769
|
+
```typescript
|
|
770
|
+
export class MarketingAgent extends Effect.Service<MarketingAgent>()(
|
|
771
|
+
'MarketingAgent',
|
|
772
|
+
{
|
|
773
|
+
effect: Effect.gen(function* () {
|
|
774
|
+
const n8n = yield* N8NService;
|
|
775
|
+
|
|
776
|
+
return {
|
|
777
|
+
launchEmailCampaign: (args: { campaignId: Id<'entities'> }) =>
|
|
778
|
+
Effect.gen(function* () {
|
|
779
|
+
// Get campaign data
|
|
780
|
+
const campaign = yield* db.get(args.campaignId);
|
|
781
|
+
|
|
782
|
+
// Execute n8n "Email Campaign" workflow
|
|
783
|
+
const result = yield* n8n.executeWorkflowTool({
|
|
784
|
+
agentId: 'agent-marketing',
|
|
785
|
+
workflowId: 'workflow-email-campaign',
|
|
786
|
+
input: {
|
|
787
|
+
subject: campaign.properties.subject,
|
|
788
|
+
recipientSegment: campaign.properties.segment,
|
|
789
|
+
emailTemplate: campaign.properties.template,
|
|
790
|
+
scheduledAt: campaign.properties.scheduledAt,
|
|
791
|
+
},
|
|
792
|
+
});
|
|
793
|
+
|
|
794
|
+
return result;
|
|
795
|
+
}),
|
|
796
|
+
};
|
|
797
|
+
}),
|
|
798
|
+
}
|
|
799
|
+
) {}
|
|
800
|
+
```
|
|
801
|
+
|
|
802
|
+
### 3. Sync n8n Workflows on Onboarding
|
|
803
|
+
|
|
804
|
+
```typescript
|
|
805
|
+
export const onboardN8N = confect.mutation({
|
|
806
|
+
args: {
|
|
807
|
+
apiKey: v.string(),
|
|
808
|
+
baseUrl: v.string(),
|
|
809
|
+
instanceType: v.union(v.literal('cloud'), v.literal('self-hosted')),
|
|
810
|
+
},
|
|
811
|
+
handler: (ctx, args) =>
|
|
812
|
+
Effect.gen(function* () {
|
|
813
|
+
const userId = yield* getUserId(ctx);
|
|
814
|
+
|
|
815
|
+
// 1. Create credential entity
|
|
816
|
+
const credentialId = yield* db.insert('entities', {
|
|
817
|
+
type: 'n8n_credential',
|
|
818
|
+
name: 'n8n Credentials',
|
|
819
|
+
properties: {
|
|
820
|
+
apiKey: args.apiKey,
|
|
821
|
+
baseUrl: args.baseUrl,
|
|
822
|
+
instanceType: args.instanceType,
|
|
823
|
+
active: true,
|
|
824
|
+
createdAt: Date.now(),
|
|
825
|
+
},
|
|
826
|
+
status: 'active',
|
|
827
|
+
createdAt: Date.now(),
|
|
828
|
+
updatedAt: Date.now(),
|
|
829
|
+
});
|
|
830
|
+
|
|
831
|
+
// 2. Sync workflows
|
|
832
|
+
const n8nService = yield* N8NService;
|
|
833
|
+
const syncResult = yield* n8nService.syncWorkflows({
|
|
834
|
+
credentialId,
|
|
835
|
+
userId,
|
|
836
|
+
});
|
|
837
|
+
|
|
838
|
+
return {
|
|
839
|
+
credentialId,
|
|
840
|
+
...syncResult,
|
|
841
|
+
};
|
|
842
|
+
}).pipe(Effect.provide(MainLayer)),
|
|
843
|
+
});
|
|
844
|
+
```
|
|
845
|
+
|
|
846
|
+
---
|
|
847
|
+
|
|
848
|
+
## Frontend Integration
|
|
849
|
+
|
|
850
|
+
### React Component for Workflow Execution
|
|
851
|
+
|
|
852
|
+
```tsx
|
|
853
|
+
// src/components/n8n/WorkflowExecutor.tsx
|
|
854
|
+
import { useMutation, useQuery } from 'convex/react';
|
|
855
|
+
import { api } from '@/convex/_generated/api';
|
|
856
|
+
import { Button } from '@/components/ui/button';
|
|
857
|
+
import { useState } from 'react';
|
|
858
|
+
|
|
859
|
+
export function WorkflowExecutor({ workflowId }: { workflowId: Id<'entities'> }) {
|
|
860
|
+
const [input, setInput] = useState({});
|
|
861
|
+
const executeWorkflow = useMutation(api.n8n.executeWorkflow);
|
|
862
|
+
const executions = useQuery(api.n8n.getWorkflowExecutions, { workflowId, limit: 10 });
|
|
863
|
+
|
|
864
|
+
return (
|
|
865
|
+
<div>
|
|
866
|
+
<h2>Execute Workflow</h2>
|
|
867
|
+
<textarea
|
|
868
|
+
value={JSON.stringify(input, null, 2)}
|
|
869
|
+
onChange={(e) => setInput(JSON.parse(e.target.value))}
|
|
870
|
+
placeholder='{"key": "value"}'
|
|
871
|
+
/>
|
|
872
|
+
<Button
|
|
873
|
+
onClick={() =>
|
|
874
|
+
executeWorkflow({
|
|
875
|
+
workflowId,
|
|
876
|
+
input,
|
|
877
|
+
})
|
|
878
|
+
}
|
|
879
|
+
>
|
|
880
|
+
Execute
|
|
881
|
+
</Button>
|
|
882
|
+
|
|
883
|
+
<h3>Recent Executions</h3>
|
|
884
|
+
<ul>
|
|
885
|
+
{executions?.map((exec) => (
|
|
886
|
+
<li key={exec._id}>
|
|
887
|
+
{exec.properties.status} - {new Date(exec.properties.startedAt).toLocaleString()}
|
|
888
|
+
</li>
|
|
889
|
+
))}
|
|
890
|
+
</ul>
|
|
891
|
+
</div>
|
|
892
|
+
);
|
|
893
|
+
}
|
|
894
|
+
```
|
|
895
|
+
|
|
896
|
+
---
|
|
897
|
+
|
|
898
|
+
## Benefits
|
|
899
|
+
|
|
900
|
+
### For AI Agents
|
|
901
|
+
1. **400+ Service Integrations**: Agents can interact with any service n8n supports
|
|
902
|
+
2. **No-Code Workflows**: Users can create complex workflows without code
|
|
903
|
+
3. **Visual Debugging**: n8n's UI shows workflow execution visually
|
|
904
|
+
4. **Composability**: Agents combine multiple n8n workflows as tools
|
|
905
|
+
|
|
906
|
+
### For Users
|
|
907
|
+
1. **Familiar Interface**: n8n's drag-and-drop workflow builder
|
|
908
|
+
2. **Extensive Library**: Pre-built templates for common tasks
|
|
909
|
+
3. **Self-Hosted Option**: Full control over data and workflows
|
|
910
|
+
4. **Bi-Directional Integration**: n8n can trigger agents AND agents can trigger n8n
|
|
911
|
+
|
|
912
|
+
### For Platform
|
|
913
|
+
1. **Extensibility**: Add integrations without building custom connectors
|
|
914
|
+
2. **User Empowerment**: Users extend platform capabilities themselves
|
|
915
|
+
3. **Ecosystem Growth**: Leverage n8n's 400+ integrations immediately
|
|
916
|
+
4. **Reduced Development**: Don't build integrations that n8n already has
|
|
917
|
+
|
|
918
|
+
---
|
|
919
|
+
|
|
920
|
+
## Common n8n Workflow Patterns
|
|
921
|
+
|
|
922
|
+
### 1. Data Sync Workflow
|
|
923
|
+
**Purpose**: Sync data from Google Sheets to Convex
|
|
924
|
+
```
|
|
925
|
+
Trigger (Webhook) → Google Sheets (Read) → Convex Mutation → Response
|
|
926
|
+
```
|
|
927
|
+
|
|
928
|
+
### 2. Notification Workflow
|
|
929
|
+
**Purpose**: Send multi-channel notifications
|
|
930
|
+
```
|
|
931
|
+
Trigger (Webhook) → Split (Email/SMS/Slack) → Send Notifications → Aggregate Results
|
|
932
|
+
```
|
|
933
|
+
|
|
934
|
+
### 3. Content Publishing Workflow
|
|
935
|
+
**Purpose**: Publish content to multiple platforms
|
|
936
|
+
```
|
|
937
|
+
Trigger (Webhook) → Twitter API → LinkedIn API → Instagram API → Log Results
|
|
938
|
+
```
|
|
939
|
+
|
|
940
|
+
### 4. Analytics Workflow
|
|
941
|
+
**Purpose**: Aggregate analytics from multiple sources
|
|
942
|
+
```
|
|
943
|
+
Cron Trigger → [Google Analytics, Stripe, Convex] → Aggregate → Store in DB
|
|
944
|
+
```
|
|
945
|
+
|
|
946
|
+
### 5. Lead Enrichment Workflow
|
|
947
|
+
**Purpose**: Enrich lead data from multiple sources
|
|
948
|
+
```
|
|
949
|
+
Trigger (New Lead) → Clearbit API → Hunter.io → LinkedIn → Update Convex
|
|
950
|
+
```
|
|
951
|
+
|
|
952
|
+
---
|
|
953
|
+
|
|
954
|
+
## Testing
|
|
955
|
+
|
|
956
|
+
```typescript
|
|
957
|
+
// tests/n8n.test.ts
|
|
958
|
+
import { Effect, Layer } from 'effect';
|
|
959
|
+
import { N8NService } from '@/convex/services/n8n';
|
|
960
|
+
|
|
961
|
+
describe('N8NService', () => {
|
|
962
|
+
it('should execute workflow successfully', async () => {
|
|
963
|
+
const MockN8N = Layer.succeed(N8NProvider, {
|
|
964
|
+
executeWorkflow: () =>
|
|
965
|
+
Effect.succeed({
|
|
966
|
+
success: true,
|
|
967
|
+
data: { message: 'Workflow executed' },
|
|
968
|
+
}),
|
|
969
|
+
});
|
|
970
|
+
|
|
971
|
+
const result = await Effect.runPromise(
|
|
972
|
+
Effect.gen(function* () {
|
|
973
|
+
const service = yield* N8NService;
|
|
974
|
+
return yield* service.executeWorkflowTool({
|
|
975
|
+
agentId: 'agent-123',
|
|
976
|
+
workflowId: 'workflow-456',
|
|
977
|
+
input: { test: true },
|
|
978
|
+
});
|
|
979
|
+
}).pipe(Effect.provide(Layer.merge(MockN8N, MockDB)))
|
|
980
|
+
);
|
|
981
|
+
|
|
982
|
+
expect(result.status).toBe('success');
|
|
983
|
+
});
|
|
984
|
+
});
|
|
985
|
+
```
|
|
986
|
+
|
|
987
|
+
---
|
|
988
|
+
|
|
989
|
+
## Security Considerations
|
|
990
|
+
|
|
991
|
+
1. **API Key Storage**: Encrypt n8n API keys in database
|
|
992
|
+
2. **Webhook Validation**: Validate webhook signatures from n8n
|
|
993
|
+
3. **Rate Limiting**: Prevent workflow execution abuse
|
|
994
|
+
4. **Input Sanitization**: Validate all inputs before sending to n8n
|
|
995
|
+
5. **Permission Checks**: Ensure user has permission to execute workflow
|
|
996
|
+
6. **Execution Limits**: Set timeout and retry limits
|
|
997
|
+
|
|
998
|
+
---
|
|
999
|
+
|
|
1000
|
+
## Summary
|
|
1001
|
+
|
|
1002
|
+
This integration enables:
|
|
1003
|
+
- ✅ **AI Agents → n8n**: Agents execute workflows as tools
|
|
1004
|
+
- ✅ **n8n → AI Agents**: Workflows trigger agent actions
|
|
1005
|
+
- ✅ **100% Effect.ts**: Typed errors, automatic retry, composable
|
|
1006
|
+
- ✅ **Non-Breaking**: Uses existing connection/event types
|
|
1007
|
+
- ✅ **Minimal Entities**: Only 3 new entity types needed
|
|
1008
|
+
- ✅ **Extensible**: Easy to add more n8n features later
|
|
1009
|
+
|
|
1010
|
+
**Next Steps**:
|
|
1011
|
+
1. Add 3 entity types to Ontology.md
|
|
1012
|
+
2. Implement N8NProvider and N8NService
|
|
1013
|
+
3. Create Convex function wrappers
|
|
1014
|
+
4. Build frontend workflow management UI
|
|
1015
|
+
5. Test with common workflows
|