availsync 0.1.0
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/.adal/skills/stripe-best-practices/SKILL.md +42 -0
- package/.adal/skills/stripe-best-practices/references/billing.md +36 -0
- package/.adal/skills/stripe-best-practices/references/connect.md +48 -0
- package/.adal/skills/stripe-best-practices/references/payments.md +79 -0
- package/.adal/skills/stripe-best-practices/references/security.md +109 -0
- package/.adal/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.adal/skills/stripe-projects/SKILL.md +139 -0
- package/.adal/skills/upgrade-stripe/SKILL.md +185 -0
- package/.agents/skills/stripe-best-practices/SKILL.md +42 -0
- package/.agents/skills/stripe-best-practices/references/billing.md +36 -0
- package/.agents/skills/stripe-best-practices/references/connect.md +48 -0
- package/.agents/skills/stripe-best-practices/references/payments.md +79 -0
- package/.agents/skills/stripe-best-practices/references/security.md +109 -0
- package/.agents/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.agents/skills/stripe-projects/SKILL.md +139 -0
- package/.agents/skills/upgrade-stripe/SKILL.md +185 -0
- package/.augment/skills/stripe-best-practices/SKILL.md +42 -0
- package/.augment/skills/stripe-best-practices/references/billing.md +36 -0
- package/.augment/skills/stripe-best-practices/references/connect.md +48 -0
- package/.augment/skills/stripe-best-practices/references/payments.md +79 -0
- package/.augment/skills/stripe-best-practices/references/security.md +109 -0
- package/.augment/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.augment/skills/stripe-projects/SKILL.md +139 -0
- package/.augment/skills/upgrade-stripe/SKILL.md +185 -0
- package/.bob/skills/stripe-best-practices/SKILL.md +42 -0
- package/.bob/skills/stripe-best-practices/references/billing.md +36 -0
- package/.bob/skills/stripe-best-practices/references/connect.md +48 -0
- package/.bob/skills/stripe-best-practices/references/payments.md +79 -0
- package/.bob/skills/stripe-best-practices/references/security.md +109 -0
- package/.bob/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.bob/skills/stripe-projects/SKILL.md +139 -0
- package/.bob/skills/upgrade-stripe/SKILL.md +185 -0
- package/.claude/settings.local.json +7 -0
- package/.claude/skills/stripe-best-practices/SKILL.md +42 -0
- package/.claude/skills/stripe-best-practices/references/billing.md +36 -0
- package/.claude/skills/stripe-best-practices/references/connect.md +48 -0
- package/.claude/skills/stripe-best-practices/references/payments.md +79 -0
- package/.claude/skills/stripe-best-practices/references/security.md +109 -0
- package/.claude/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.claude/skills/stripe-projects/SKILL.md +139 -0
- package/.claude/skills/upgrade-stripe/SKILL.md +185 -0
- package/.codebuddy/skills/stripe-best-practices/SKILL.md +42 -0
- package/.codebuddy/skills/stripe-best-practices/references/billing.md +36 -0
- package/.codebuddy/skills/stripe-best-practices/references/connect.md +48 -0
- package/.codebuddy/skills/stripe-best-practices/references/payments.md +79 -0
- package/.codebuddy/skills/stripe-best-practices/references/security.md +109 -0
- package/.codebuddy/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.codebuddy/skills/stripe-projects/SKILL.md +139 -0
- package/.codebuddy/skills/upgrade-stripe/SKILL.md +185 -0
- package/.commandcode/skills/stripe-best-practices/SKILL.md +42 -0
- package/.commandcode/skills/stripe-best-practices/references/billing.md +36 -0
- package/.commandcode/skills/stripe-best-practices/references/connect.md +48 -0
- package/.commandcode/skills/stripe-best-practices/references/payments.md +79 -0
- package/.commandcode/skills/stripe-best-practices/references/security.md +109 -0
- package/.commandcode/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.commandcode/skills/stripe-projects/SKILL.md +139 -0
- package/.commandcode/skills/upgrade-stripe/SKILL.md +185 -0
- package/.continue/skills/stripe-best-practices/SKILL.md +42 -0
- package/.continue/skills/stripe-best-practices/references/billing.md +36 -0
- package/.continue/skills/stripe-best-practices/references/connect.md +48 -0
- package/.continue/skills/stripe-best-practices/references/payments.md +79 -0
- package/.continue/skills/stripe-best-practices/references/security.md +109 -0
- package/.continue/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.continue/skills/stripe-projects/SKILL.md +139 -0
- package/.continue/skills/upgrade-stripe/SKILL.md +185 -0
- package/.cortex/skills/stripe-best-practices/SKILL.md +42 -0
- package/.cortex/skills/stripe-best-practices/references/billing.md +36 -0
- package/.cortex/skills/stripe-best-practices/references/connect.md +48 -0
- package/.cortex/skills/stripe-best-practices/references/payments.md +79 -0
- package/.cortex/skills/stripe-best-practices/references/security.md +109 -0
- package/.cortex/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.cortex/skills/stripe-projects/SKILL.md +139 -0
- package/.cortex/skills/upgrade-stripe/SKILL.md +185 -0
- package/.crush/skills/stripe-best-practices/SKILL.md +42 -0
- package/.crush/skills/stripe-best-practices/references/billing.md +36 -0
- package/.crush/skills/stripe-best-practices/references/connect.md +48 -0
- package/.crush/skills/stripe-best-practices/references/payments.md +79 -0
- package/.crush/skills/stripe-best-practices/references/security.md +109 -0
- package/.crush/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.crush/skills/stripe-projects/SKILL.md +139 -0
- package/.crush/skills/upgrade-stripe/SKILL.md +185 -0
- package/.env.example +20 -0
- package/.factory/skills/stripe-best-practices/SKILL.md +42 -0
- package/.factory/skills/stripe-best-practices/references/billing.md +36 -0
- package/.factory/skills/stripe-best-practices/references/connect.md +48 -0
- package/.factory/skills/stripe-best-practices/references/payments.md +79 -0
- package/.factory/skills/stripe-best-practices/references/security.md +109 -0
- package/.factory/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.factory/skills/stripe-projects/SKILL.md +139 -0
- package/.factory/skills/upgrade-stripe/SKILL.md +185 -0
- package/.goose/skills/stripe-best-practices/SKILL.md +42 -0
- package/.goose/skills/stripe-best-practices/references/billing.md +36 -0
- package/.goose/skills/stripe-best-practices/references/connect.md +48 -0
- package/.goose/skills/stripe-best-practices/references/payments.md +79 -0
- package/.goose/skills/stripe-best-practices/references/security.md +109 -0
- package/.goose/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.goose/skills/stripe-projects/SKILL.md +139 -0
- package/.goose/skills/upgrade-stripe/SKILL.md +185 -0
- package/.iflow/skills/stripe-best-practices/SKILL.md +42 -0
- package/.iflow/skills/stripe-best-practices/references/billing.md +36 -0
- package/.iflow/skills/stripe-best-practices/references/connect.md +48 -0
- package/.iflow/skills/stripe-best-practices/references/payments.md +79 -0
- package/.iflow/skills/stripe-best-practices/references/security.md +109 -0
- package/.iflow/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.iflow/skills/stripe-projects/SKILL.md +139 -0
- package/.iflow/skills/upgrade-stripe/SKILL.md +185 -0
- package/.junie/skills/stripe-best-practices/SKILL.md +42 -0
- package/.junie/skills/stripe-best-practices/references/billing.md +36 -0
- package/.junie/skills/stripe-best-practices/references/connect.md +48 -0
- package/.junie/skills/stripe-best-practices/references/payments.md +79 -0
- package/.junie/skills/stripe-best-practices/references/security.md +109 -0
- package/.junie/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.junie/skills/stripe-projects/SKILL.md +139 -0
- package/.junie/skills/upgrade-stripe/SKILL.md +185 -0
- package/.kilocode/skills/stripe-best-practices/SKILL.md +42 -0
- package/.kilocode/skills/stripe-best-practices/references/billing.md +36 -0
- package/.kilocode/skills/stripe-best-practices/references/connect.md +48 -0
- package/.kilocode/skills/stripe-best-practices/references/payments.md +79 -0
- package/.kilocode/skills/stripe-best-practices/references/security.md +109 -0
- package/.kilocode/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.kilocode/skills/stripe-projects/SKILL.md +139 -0
- package/.kilocode/skills/upgrade-stripe/SKILL.md +185 -0
- package/.kiro/skills/stripe-best-practices/SKILL.md +42 -0
- package/.kiro/skills/stripe-best-practices/references/billing.md +36 -0
- package/.kiro/skills/stripe-best-practices/references/connect.md +48 -0
- package/.kiro/skills/stripe-best-practices/references/payments.md +79 -0
- package/.kiro/skills/stripe-best-practices/references/security.md +109 -0
- package/.kiro/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.kiro/skills/stripe-projects/SKILL.md +139 -0
- package/.kiro/skills/upgrade-stripe/SKILL.md +185 -0
- package/.kode/skills/stripe-best-practices/SKILL.md +42 -0
- package/.kode/skills/stripe-best-practices/references/billing.md +36 -0
- package/.kode/skills/stripe-best-practices/references/connect.md +48 -0
- package/.kode/skills/stripe-best-practices/references/payments.md +79 -0
- package/.kode/skills/stripe-best-practices/references/security.md +109 -0
- package/.kode/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.kode/skills/stripe-projects/SKILL.md +139 -0
- package/.kode/skills/upgrade-stripe/SKILL.md +185 -0
- package/.mcpjam/skills/stripe-best-practices/SKILL.md +42 -0
- package/.mcpjam/skills/stripe-best-practices/references/billing.md +36 -0
- package/.mcpjam/skills/stripe-best-practices/references/connect.md +48 -0
- package/.mcpjam/skills/stripe-best-practices/references/payments.md +79 -0
- package/.mcpjam/skills/stripe-best-practices/references/security.md +109 -0
- package/.mcpjam/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.mcpjam/skills/stripe-projects/SKILL.md +139 -0
- package/.mcpjam/skills/upgrade-stripe/SKILL.md +185 -0
- package/.mux/skills/stripe-best-practices/SKILL.md +42 -0
- package/.mux/skills/stripe-best-practices/references/billing.md +36 -0
- package/.mux/skills/stripe-best-practices/references/connect.md +48 -0
- package/.mux/skills/stripe-best-practices/references/payments.md +79 -0
- package/.mux/skills/stripe-best-practices/references/security.md +109 -0
- package/.mux/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.mux/skills/stripe-projects/SKILL.md +139 -0
- package/.mux/skills/upgrade-stripe/SKILL.md +185 -0
- package/.neovate/skills/stripe-best-practices/SKILL.md +42 -0
- package/.neovate/skills/stripe-best-practices/references/billing.md +36 -0
- package/.neovate/skills/stripe-best-practices/references/connect.md +48 -0
- package/.neovate/skills/stripe-best-practices/references/payments.md +79 -0
- package/.neovate/skills/stripe-best-practices/references/security.md +109 -0
- package/.neovate/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.neovate/skills/stripe-projects/SKILL.md +139 -0
- package/.neovate/skills/upgrade-stripe/SKILL.md +185 -0
- package/.nixpacksignore +14 -0
- package/.openhands/skills/stripe-best-practices/SKILL.md +42 -0
- package/.openhands/skills/stripe-best-practices/references/billing.md +36 -0
- package/.openhands/skills/stripe-best-practices/references/connect.md +48 -0
- package/.openhands/skills/stripe-best-practices/references/payments.md +79 -0
- package/.openhands/skills/stripe-best-practices/references/security.md +109 -0
- package/.openhands/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.openhands/skills/stripe-projects/SKILL.md +139 -0
- package/.openhands/skills/upgrade-stripe/SKILL.md +185 -0
- package/.pi/skills/stripe-best-practices/SKILL.md +42 -0
- package/.pi/skills/stripe-best-practices/references/billing.md +36 -0
- package/.pi/skills/stripe-best-practices/references/connect.md +48 -0
- package/.pi/skills/stripe-best-practices/references/payments.md +79 -0
- package/.pi/skills/stripe-best-practices/references/security.md +109 -0
- package/.pi/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.pi/skills/stripe-projects/SKILL.md +139 -0
- package/.pi/skills/upgrade-stripe/SKILL.md +185 -0
- package/.pochi/skills/stripe-best-practices/SKILL.md +42 -0
- package/.pochi/skills/stripe-best-practices/references/billing.md +36 -0
- package/.pochi/skills/stripe-best-practices/references/connect.md +48 -0
- package/.pochi/skills/stripe-best-practices/references/payments.md +79 -0
- package/.pochi/skills/stripe-best-practices/references/security.md +109 -0
- package/.pochi/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.pochi/skills/stripe-projects/SKILL.md +139 -0
- package/.pochi/skills/upgrade-stripe/SKILL.md +185 -0
- package/.qoder/skills/stripe-best-practices/SKILL.md +42 -0
- package/.qoder/skills/stripe-best-practices/references/billing.md +36 -0
- package/.qoder/skills/stripe-best-practices/references/connect.md +48 -0
- package/.qoder/skills/stripe-best-practices/references/payments.md +79 -0
- package/.qoder/skills/stripe-best-practices/references/security.md +109 -0
- package/.qoder/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.qoder/skills/stripe-projects/SKILL.md +139 -0
- package/.qoder/skills/upgrade-stripe/SKILL.md +185 -0
- package/.qwen/skills/stripe-best-practices/SKILL.md +42 -0
- package/.qwen/skills/stripe-best-practices/references/billing.md +36 -0
- package/.qwen/skills/stripe-best-practices/references/connect.md +48 -0
- package/.qwen/skills/stripe-best-practices/references/payments.md +79 -0
- package/.qwen/skills/stripe-best-practices/references/security.md +109 -0
- package/.qwen/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.qwen/skills/stripe-projects/SKILL.md +139 -0
- package/.qwen/skills/upgrade-stripe/SKILL.md +185 -0
- package/.roo/skills/stripe-best-practices/SKILL.md +42 -0
- package/.roo/skills/stripe-best-practices/references/billing.md +36 -0
- package/.roo/skills/stripe-best-practices/references/connect.md +48 -0
- package/.roo/skills/stripe-best-practices/references/payments.md +79 -0
- package/.roo/skills/stripe-best-practices/references/security.md +109 -0
- package/.roo/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.roo/skills/stripe-projects/SKILL.md +139 -0
- package/.roo/skills/upgrade-stripe/SKILL.md +185 -0
- package/.trae/skills/stripe-best-practices/SKILL.md +42 -0
- package/.trae/skills/stripe-best-practices/references/billing.md +36 -0
- package/.trae/skills/stripe-best-practices/references/connect.md +48 -0
- package/.trae/skills/stripe-best-practices/references/payments.md +79 -0
- package/.trae/skills/stripe-best-practices/references/security.md +109 -0
- package/.trae/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.trae/skills/stripe-projects/SKILL.md +139 -0
- package/.trae/skills/upgrade-stripe/SKILL.md +185 -0
- package/.vibe/skills/stripe-best-practices/SKILL.md +42 -0
- package/.vibe/skills/stripe-best-practices/references/billing.md +36 -0
- package/.vibe/skills/stripe-best-practices/references/connect.md +48 -0
- package/.vibe/skills/stripe-best-practices/references/payments.md +79 -0
- package/.vibe/skills/stripe-best-practices/references/security.md +109 -0
- package/.vibe/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.vibe/skills/stripe-projects/SKILL.md +139 -0
- package/.vibe/skills/upgrade-stripe/SKILL.md +185 -0
- package/.windsurf/skills/stripe-best-practices/SKILL.md +42 -0
- package/.windsurf/skills/stripe-best-practices/references/billing.md +36 -0
- package/.windsurf/skills/stripe-best-practices/references/connect.md +48 -0
- package/.windsurf/skills/stripe-best-practices/references/payments.md +79 -0
- package/.windsurf/skills/stripe-best-practices/references/security.md +109 -0
- package/.windsurf/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.windsurf/skills/stripe-projects/SKILL.md +139 -0
- package/.windsurf/skills/upgrade-stripe/SKILL.md +185 -0
- package/.zencoder/skills/stripe-best-practices/SKILL.md +42 -0
- package/.zencoder/skills/stripe-best-practices/references/billing.md +36 -0
- package/.zencoder/skills/stripe-best-practices/references/connect.md +48 -0
- package/.zencoder/skills/stripe-best-practices/references/payments.md +79 -0
- package/.zencoder/skills/stripe-best-practices/references/security.md +109 -0
- package/.zencoder/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.zencoder/skills/stripe-projects/SKILL.md +139 -0
- package/.zencoder/skills/upgrade-stripe/SKILL.md +185 -0
- package/AUDIT.md +95 -0
- package/BLOCKERS.md +0 -0
- package/COOLIFY.md +51 -0
- package/MCP_SETUP.md +23 -0
- package/PRODUCTION_CHECKLIST.md +246 -0
- package/README.md +47 -0
- package/ROADMAP.md +91 -0
- package/docs/superpowers/plans/2026-05-11-availsync-frontend-sales-flow.md +2445 -0
- package/frontend/.env.example +2 -0
- package/frontend/app/admin/layout.tsx +13 -0
- package/frontend/app/admin/page.tsx +747 -0
- package/frontend/app/app/activity/page.tsx +257 -0
- package/frontend/app/app/agents/[agentId]/page.tsx +21 -0
- package/frontend/app/app/agents/page.tsx +1155 -0
- package/frontend/app/app/audit/page.tsx +225 -0
- package/frontend/app/app/availability/page.tsx +840 -0
- package/frontend/app/app/holds/page.tsx +262 -0
- package/frontend/app/app/layout.tsx +19 -0
- package/frontend/app/app/onboarding/page.tsx +10 -0
- package/frontend/app/app/onboarding/verify/page.tsx +309 -0
- package/frontend/app/app/page.tsx +508 -0
- package/frontend/app/app/settings/page.tsx +399 -0
- package/frontend/app/app/work/page.tsx +426 -0
- package/frontend/app/changelog/page.tsx +93 -0
- package/frontend/app/checkout/page.tsx +25 -0
- package/frontend/app/docs/api/page.tsx +157 -0
- package/frontend/app/docs/page.tsx +296 -0
- package/frontend/app/docs/pilot/page.tsx +127 -0
- package/frontend/app/docs/quickstart/page.tsx +318 -0
- package/frontend/app/docs/reliability/page.tsx +78 -0
- package/frontend/app/docs/sdk/node/page.tsx +166 -0
- package/frontend/app/globals.css +57 -0
- package/frontend/app/icon.png +0 -0
- package/frontend/app/layout.tsx +87 -0
- package/frontend/app/login/page.tsx +14 -0
- package/frontend/app/page.tsx +47 -0
- package/frontend/app/pricing/page.tsx +66 -0
- package/frontend/app/privacy/page.tsx +52 -0
- package/frontend/app/robots.ts +26 -0
- package/frontend/app/security/page.tsx +74 -0
- package/frontend/app/signup/page.tsx +14 -0
- package/frontend/app/sitemap.ts +14 -0
- package/frontend/app/terms/page.tsx +51 -0
- package/frontend/components/brand/AvailsyncLogo.tsx +56 -0
- package/frontend/components/checkout/CheckoutClient.tsx +100 -0
- package/frontend/components/dashboard/AgentForm.tsx +59 -0
- package/frontend/components/dashboard/AppShell.tsx +291 -0
- package/frontend/components/dashboard/AvailabilityChecker.tsx +117 -0
- package/frontend/components/dashboard/AvailabilityWindowForm.tsx +40 -0
- package/frontend/components/dashboard/HoldForm.tsx +133 -0
- package/frontend/components/dashboard/MetricCard.tsx +10 -0
- package/frontend/components/login/LoginForm.tsx +95 -0
- package/frontend/components/marketing/AgentCoordinationStory.tsx +1530 -0
- package/frontend/components/marketing/Faq.tsx +41 -0
- package/frontend/components/marketing/Hero.tsx +73 -0
- package/frontend/components/marketing/HowItWorks.tsx +28 -0
- package/frontend/components/marketing/ObserveModeTeaser.tsx +41 -0
- package/frontend/components/marketing/PricingTeaser.tsx +23 -0
- package/frontend/components/marketing/ProblemSolution.tsx +36 -0
- package/frontend/components/marketing/SiteFooter.tsx +59 -0
- package/frontend/components/marketing/SiteHeader.tsx +45 -0
- package/frontend/components/marketing/UseCases.tsx +27 -0
- package/frontend/components/onboarding/OnboardingClient.tsx +278 -0
- package/frontend/components/pricing/PricingCards.tsx +65 -0
- package/frontend/components/privacy/CookieConsent.tsx +230 -0
- package/frontend/components/privacy/CookieSettingsButton.tsx +15 -0
- package/frontend/components/seo/JsonLd.tsx +10 -0
- package/frontend/components/signup/SignupForm.tsx +55 -0
- package/frontend/components/ui/Badge.tsx +23 -0
- package/frontend/components/ui/Button.tsx +37 -0
- package/frontend/components/ui/Card.tsx +11 -0
- package/frontend/components/ui/ConfirmDialog.tsx +77 -0
- package/frontend/components/ui/EmptyState.tsx +24 -0
- package/frontend/components/ui/Input.tsx +14 -0
- package/frontend/components/ui/KeyDisplay.tsx +49 -0
- package/frontend/components/ui/Select.tsx +14 -0
- package/frontend/components/ui/Skeleton.tsx +24 -0
- package/frontend/components/ui/Tabs.tsx +19 -0
- package/frontend/components/ui/Textarea.tsx +14 -0
- package/frontend/components/ui/Toast.tsx +78 -0
- package/frontend/components/waitlist/WaitlistDialog.tsx +128 -0
- package/frontend/lib/api.ts +1282 -0
- package/frontend/lib/billing.ts +6 -0
- package/frontend/lib/cookieConsent.ts +113 -0
- package/frontend/lib/format.ts +16 -0
- package/frontend/lib/plans.ts +62 -0
- package/frontend/lib/schemas.ts +108 -0
- package/frontend/lib/seo.ts +376 -0
- package/frontend/lib/setupGuides.ts +630 -0
- package/frontend/lib/storage.ts +30 -0
- package/frontend/next-env.d.ts +6 -0
- package/frontend/next.config.mjs +13 -0
- package/frontend/package-lock.json +14409 -0
- package/frontend/package.json +41 -0
- package/frontend/playwright.config.ts +20 -0
- package/frontend/postcss.config.mjs +8 -0
- package/frontend/public/.gitkeep +0 -0
- package/frontend/public/brand/availsync-logo-board.png +0 -0
- package/frontend/public/brand/availsync-logo-dark.png +0 -0
- package/frontend/public/brand/availsync-mark-dark.png +0 -0
- package/frontend/public/brand/availsync-wordmark-dark.png +0 -0
- package/frontend/public/marketing/hero-agent-coordination.png +0 -0
- package/frontend/tailwind.config.ts +53 -0
- package/frontend/tests/smoke.spec.ts +89 -0
- package/frontend/tsconfig.json +23 -0
- package/jest.config.js +7 -0
- package/nixpacks.toml +11 -0
- package/package.json +53 -0
- package/packages/mcp/LICENSE +21 -0
- package/packages/mcp/README.md +60 -0
- package/packages/mcp/jest.config.cjs +8 -0
- package/packages/mcp/package.json +54 -0
- package/packages/mcp/src/helpers.ts +38 -0
- package/packages/mcp/src/index.test.ts +60 -0
- package/packages/mcp/src/index.ts +387 -0
- package/packages/mcp/tsconfig.json +20 -0
- package/packages/mcp/tsconfig.test.json +12 -0
- package/packages/node/LICENSE +21 -0
- package/packages/node/README.md +120 -0
- package/packages/node/jest.config.cjs +8 -0
- package/packages/node/package.json +46 -0
- package/packages/node/src/index.test.ts +360 -0
- package/packages/node/src/index.ts +402 -0
- package/packages/node/tsconfig.json +20 -0
- package/packages/node/tsconfig.test.json +12 -0
- package/plan.md +923 -0
- package/skills/stripe-best-practices/SKILL.md +42 -0
- package/skills/stripe-best-practices/references/billing.md +36 -0
- package/skills/stripe-best-practices/references/connect.md +48 -0
- package/skills/stripe-best-practices/references/payments.md +79 -0
- package/skills/stripe-best-practices/references/security.md +109 -0
- package/skills/stripe-best-practices/references/treasury.md +16 -0
- package/skills/stripe-projects/SKILL.md +139 -0
- package/skills/upgrade-stripe/SKILL.md +185 -0
- package/skills-lock.json +20 -0
- package/src/core/availability.ts +178 -0
- package/src/core/conflict.ts +209 -0
- package/src/core/work.ts +490 -0
- package/src/db/client.ts +17 -0
- package/src/db/migrations/001_init.sql +88 -0
- package/src/db/migrations/002_stripe.sql +2 -0
- package/src/db/migrations/003_workspace_auth.sql +19 -0
- package/src/db/migrations/004_agent_mcp_status.sql +2 -0
- package/src/db/migrations/005_hold_event_actor.sql +4 -0
- package/src/db/migrations/006_agent_activity.sql +35 -0
- package/src/db/migrations/007_work_coordination.sql +60 -0
- package/src/db/migrations/008_work_claim_leases.sql +20 -0
- package/src/db/migrations/009_billing_subscription_state.sql +23 -0
- package/src/db/migrations/010_agent_api_key_prefix.sql +10 -0
- package/src/db/migrations/011_org_verified_and_work_event_retention.sql +11 -0
- package/src/db/migrations/012_agent_enforcement_mode.sql +12 -0
- package/src/db/migrations/013_support_tickets.sql +21 -0
- package/src/db/migrations/014_paid_plan_waitlist.sql +23 -0
- package/src/db/migrations/015_agent_last_seen.sql +2 -0
- package/src/db/migrations.ts +164 -0
- package/src/db/run-migrations.ts +13 -0
- package/src/index.ts +183 -0
- package/src/lib/activity.ts +137 -0
- package/src/lib/apiKeys.ts +32 -0
- package/src/lib/appInfo.ts +26 -0
- package/src/lib/billingConfig.ts +3 -0
- package/src/lib/env.ts +75 -0
- package/src/lib/logger.ts +8 -0
- package/src/lib/plans.ts +204 -0
- package/src/mcp/server.js +5 -0
- package/src/mcp/server.ts +350 -0
- package/src/middleware/auth.ts +342 -0
- package/src/middleware/requestId.ts +16 -0
- package/src/routes/account.ts +168 -0
- package/src/routes/activity.ts +126 -0
- package/src/routes/admin.ts +514 -0
- package/src/routes/audit.ts +68 -0
- package/src/routes/auth.ts +203 -0
- package/src/routes/availability.ts +325 -0
- package/src/routes/billing.ts +406 -0
- package/src/routes/conflicts.ts +131 -0
- package/src/routes/holds.ts +437 -0
- package/src/routes/mcp.ts +57 -0
- package/src/routes/metrics.ts +39 -0
- package/src/routes/onboarding.ts +273 -0
- package/src/routes/orgs.ts +981 -0
- package/src/routes/preferences.ts +132 -0
- package/src/routes/session.ts +16 -0
- package/src/routes/support.ts +77 -0
- package/src/routes/value.ts +186 -0
- package/src/routes/waitlist.ts +63 -0
- package/src/routes/work.ts +1578 -0
- package/src/server.ts +36 -0
- package/src/types/index.ts +109 -0
- package/tests/integration/activity.route.test.ts +103 -0
- package/tests/integration/admin.route.test.ts +143 -0
- package/tests/integration/agent-keys.route.test.ts +237 -0
- package/tests/integration/availability.route.test.ts +125 -0
- package/tests/integration/billing.route.test.ts +393 -0
- package/tests/integration/conflicts.route.test.ts +131 -0
- package/tests/integration/flows.test.ts +154 -0
- package/tests/integration/helpers.ts +134 -0
- package/tests/integration/holds.route.test.ts +185 -0
- package/tests/integration/metrics.route.test.ts +100 -0
- package/tests/integration/onboarding.verify.route.test.ts +163 -0
- package/tests/integration/preferences.route.test.ts +53 -0
- package/tests/integration/session.route.test.ts +97 -0
- package/tests/integration/system.route.test.ts +92 -0
- package/tests/integration/value.route.test.ts +235 -0
- package/tests/integration/work.route.test.ts +745 -0
- package/tests/setup.ts +4 -0
- package/tests/smoke.sh +62 -0
- package/tests/unit/auth.test.ts +114 -0
- package/tests/unit/availability.test.ts +149 -0
- package/tests/unit/conflict.test.ts +118 -0
- package/tests/unit/env.test.ts +69 -0
- package/tests/unit/migrations.test.ts +135 -0
- package/tests/unit/request-id.test.ts +37 -0
- package/tmp-mobile-agents.png +0 -0
- package/tmp-next-mobile.err.log +10 -0
- package/tmp-next-mobile.log +5 -0
- package/tsconfig.json +16 -0
package/src/server.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
import app, { validateEnv } from './index';
|
|
4
|
+
import { runMigrations } from './db/migrations';
|
|
5
|
+
import { log } from './lib/logger';
|
|
6
|
+
|
|
7
|
+
const PORT = Number(process.env.PORT || 3000);
|
|
8
|
+
const frontendDir = path.resolve(process.cwd(), 'frontend');
|
|
9
|
+
const frontendRequire = createRequire(path.join(frontendDir, 'package.json'));
|
|
10
|
+
const next = frontendRequire('next');
|
|
11
|
+
|
|
12
|
+
async function start() {
|
|
13
|
+
validateEnv();
|
|
14
|
+
await runMigrations();
|
|
15
|
+
|
|
16
|
+
const nextApp = next({
|
|
17
|
+
dev: process.env.NODE_ENV !== 'production',
|
|
18
|
+
dir: frontendDir,
|
|
19
|
+
hostname: '0.0.0.0',
|
|
20
|
+
port: PORT,
|
|
21
|
+
});
|
|
22
|
+
const handle = nextApp.getRequestHandler();
|
|
23
|
+
|
|
24
|
+
await nextApp.prepare();
|
|
25
|
+
|
|
26
|
+
app.all('*', (req, res) => handle(req, res));
|
|
27
|
+
|
|
28
|
+
app.listen(PORT, () => {
|
|
29
|
+
log.info(`Availsync web and API running on :${PORT}`);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
start().catch((err) => {
|
|
34
|
+
log.error('Server failed to start', { message: err.message, stack: err.stack });
|
|
35
|
+
process.exit(1);
|
|
36
|
+
});
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { Request } from 'express';
|
|
2
|
+
|
|
3
|
+
export interface Org {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
plan: 'free' | 'individual' | 'team';
|
|
7
|
+
agent_limit: number;
|
|
8
|
+
verified_at?: Date | null;
|
|
9
|
+
created_at: Date;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface Agent {
|
|
13
|
+
id: string;
|
|
14
|
+
org_id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
api_key_hash: string;
|
|
17
|
+
agent_type: 'external_meeting' | 'internal' | 'focus' | 'generic';
|
|
18
|
+
priority: number;
|
|
19
|
+
enforcement_mode: 'enforce' | 'observe';
|
|
20
|
+
last_seen_at?: Date | null;
|
|
21
|
+
mcp_last_seen_at?: Date | null;
|
|
22
|
+
mcp_client_name?: string | null;
|
|
23
|
+
created_at: Date;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface WorkspaceUser {
|
|
27
|
+
id: string;
|
|
28
|
+
org_id: string;
|
|
29
|
+
email: string;
|
|
30
|
+
password_hash: string;
|
|
31
|
+
role: 'owner' | 'admin';
|
|
32
|
+
created_at: Date;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface Hold {
|
|
36
|
+
id: string;
|
|
37
|
+
agent_id: string;
|
|
38
|
+
org_id: string;
|
|
39
|
+
start_at: Date;
|
|
40
|
+
end_at: Date;
|
|
41
|
+
reason?: string;
|
|
42
|
+
status: 'confirmed' | 'superseded' | 'released';
|
|
43
|
+
booked_by_agent_id?: string;
|
|
44
|
+
metadata?: Record<string, unknown>;
|
|
45
|
+
created_at: Date;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface WorkResource {
|
|
49
|
+
id: string;
|
|
50
|
+
org_id: string;
|
|
51
|
+
resource_type: string;
|
|
52
|
+
resource_key: string;
|
|
53
|
+
label: string;
|
|
54
|
+
created_at: Date;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface WorkClaim {
|
|
58
|
+
id: string;
|
|
59
|
+
agent_id: string;
|
|
60
|
+
org_id: string;
|
|
61
|
+
resource_id: string;
|
|
62
|
+
start_at: Date;
|
|
63
|
+
end_at: Date;
|
|
64
|
+
expires_at: Date;
|
|
65
|
+
last_renewed_at: Date;
|
|
66
|
+
renewal_count: number;
|
|
67
|
+
idempotency_key?: string | null;
|
|
68
|
+
status: 'active' | 'superseded' | 'released' | 'expired' | 'blocked';
|
|
69
|
+
reason?: string;
|
|
70
|
+
metadata?: Record<string, unknown>;
|
|
71
|
+
created_at: Date;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface AvailabilityWindow {
|
|
75
|
+
id: string;
|
|
76
|
+
agent_id: string;
|
|
77
|
+
start_at: Date;
|
|
78
|
+
end_at: Date;
|
|
79
|
+
window_type: 'available' | 'focus' | 'blocked';
|
|
80
|
+
recurrence?: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface AgentPreferences {
|
|
84
|
+
agent_id: string;
|
|
85
|
+
buffer_minutes_after: number;
|
|
86
|
+
buffer_minutes_before: number;
|
|
87
|
+
focus_blocks: FocusBlock[];
|
|
88
|
+
priority_over_agents: string[];
|
|
89
|
+
booking_window_days: number;
|
|
90
|
+
allow_back_to_back: boolean;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface FocusBlock {
|
|
94
|
+
weekday: number;
|
|
95
|
+
start_time: string;
|
|
96
|
+
end_time: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface AvailableSlot {
|
|
100
|
+
start: Date;
|
|
101
|
+
end: Date;
|
|
102
|
+
confidence: number;
|
|
103
|
+
competing_holds_count: number;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface RequestWithAgent extends Request {
|
|
107
|
+
agent: Agent;
|
|
108
|
+
org: Org;
|
|
109
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { afterAll, beforeAll, describe, expect, test } from '@jest/globals';
|
|
2
|
+
import {
|
|
3
|
+
api,
|
|
4
|
+
closeDatabase,
|
|
5
|
+
createOrgAndAgent,
|
|
6
|
+
createWindow,
|
|
7
|
+
getWorkspaceCookie,
|
|
8
|
+
migrateTestDatabase,
|
|
9
|
+
resetDatabase,
|
|
10
|
+
} from './helpers';
|
|
11
|
+
|
|
12
|
+
describe('activity routes', () => {
|
|
13
|
+
let orgId: string;
|
|
14
|
+
let agentId: string;
|
|
15
|
+
let apiKey: string;
|
|
16
|
+
|
|
17
|
+
beforeAll(async () => {
|
|
18
|
+
await migrateTestDatabase();
|
|
19
|
+
await resetDatabase();
|
|
20
|
+
const created = await createOrgAndAgent('Activity Agent', 'generic');
|
|
21
|
+
orgId = created.orgId;
|
|
22
|
+
agentId = created.agentId;
|
|
23
|
+
apiKey = created.apiKey;
|
|
24
|
+
await createWindow(agentId, apiKey, '2030-04-01T09:00:00Z', '2030-04-01T17:00:00Z');
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
afterAll(async () => {
|
|
28
|
+
await resetDatabase();
|
|
29
|
+
await closeDatabase();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('runtime calls write metadata-only activity rows', async () => {
|
|
33
|
+
await api
|
|
34
|
+
.post('/v1/mcp/heartbeat')
|
|
35
|
+
.set('Authorization', `Bearer ${apiKey}`)
|
|
36
|
+
.send({ client_name: 'jest-mcp' })
|
|
37
|
+
.expect(200);
|
|
38
|
+
|
|
39
|
+
await api
|
|
40
|
+
.get('/v1/availability')
|
|
41
|
+
.set('Authorization', `Bearer ${apiKey}`)
|
|
42
|
+
.query({
|
|
43
|
+
agent_id: agentId,
|
|
44
|
+
from: '2030-04-01T09:00:00Z',
|
|
45
|
+
to: '2030-04-01T10:00:00Z',
|
|
46
|
+
duration_minutes: 30,
|
|
47
|
+
})
|
|
48
|
+
.expect(200);
|
|
49
|
+
|
|
50
|
+
await api
|
|
51
|
+
.post('/v1/conflicts/check')
|
|
52
|
+
.set('Authorization', `Bearer ${apiKey}`)
|
|
53
|
+
.send({
|
|
54
|
+
agent_id: agentId,
|
|
55
|
+
start_at: '2030-04-01T09:00:00Z',
|
|
56
|
+
end_at: '2030-04-01T09:30:00Z',
|
|
57
|
+
})
|
|
58
|
+
.expect(200);
|
|
59
|
+
|
|
60
|
+
const response = await api
|
|
61
|
+
.get('/v1/activity')
|
|
62
|
+
.set('Cookie', getWorkspaceCookie(orgId))
|
|
63
|
+
.expect(200);
|
|
64
|
+
|
|
65
|
+
expect(response.body.events.map((event: { activity_type: string }) => event.activity_type)).toEqual(
|
|
66
|
+
expect.arrayContaining(['mcp_heartbeat', 'availability_check', 'conflict_preview']),
|
|
67
|
+
);
|
|
68
|
+
expect(JSON.stringify(response.body.events)).not.toContain(apiKey);
|
|
69
|
+
expect(JSON.stringify(response.body.events)).not.toContain('Authorization');
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('agent key cannot list workspace activity', async () => {
|
|
73
|
+
await api.get('/v1/activity').set('Authorization', `Bearer ${apiKey}`).expect(401);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test('agent can report token usage for itself', async () => {
|
|
77
|
+
await api
|
|
78
|
+
.post('/v1/activity/usage')
|
|
79
|
+
.set('Authorization', `Bearer ${apiKey}`)
|
|
80
|
+
.send({
|
|
81
|
+
activity_type: 'agent_run',
|
|
82
|
+
provider: 'openai',
|
|
83
|
+
model: 'gpt-test',
|
|
84
|
+
input_tokens: 120,
|
|
85
|
+
output_tokens: 80,
|
|
86
|
+
estimated_cost_usd: 0.001,
|
|
87
|
+
})
|
|
88
|
+
.expect(201);
|
|
89
|
+
|
|
90
|
+
const response = await api
|
|
91
|
+
.get('/v1/activity?activity_type=agent_run')
|
|
92
|
+
.set('Cookie', getWorkspaceCookie(orgId))
|
|
93
|
+
.expect(200);
|
|
94
|
+
|
|
95
|
+
expect(response.body.events[0]).toMatchObject({
|
|
96
|
+
provider: 'openai',
|
|
97
|
+
model: 'gpt-test',
|
|
98
|
+
input_tokens: 120,
|
|
99
|
+
output_tokens: 80,
|
|
100
|
+
total_tokens: 200,
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
});
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { afterAll, afterEach, beforeEach, describe, expect, test } from '@jest/globals';
|
|
2
|
+
import pool from '../../src/db/client';
|
|
3
|
+
import {
|
|
4
|
+
api,
|
|
5
|
+
closeDatabase,
|
|
6
|
+
createAgent,
|
|
7
|
+
createOrgAndAgent,
|
|
8
|
+
getWorkspaceCookie,
|
|
9
|
+
migrateTestDatabase,
|
|
10
|
+
resetDatabase,
|
|
11
|
+
} from './helpers';
|
|
12
|
+
|
|
13
|
+
async function ownerEmail(orgId: string): Promise<string> {
|
|
14
|
+
const result = await pool.query(
|
|
15
|
+
`SELECT email
|
|
16
|
+
FROM workspace_users
|
|
17
|
+
WHERE org_id = $1
|
|
18
|
+
ORDER BY created_at ASC
|
|
19
|
+
LIMIT 1`,
|
|
20
|
+
[orgId],
|
|
21
|
+
);
|
|
22
|
+
return result.rows[0].email;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
describe('admin routes', () => {
|
|
26
|
+
const previousAdminEmails = process.env.ADMIN_EMAILS;
|
|
27
|
+
|
|
28
|
+
beforeEach(async () => {
|
|
29
|
+
await migrateTestDatabase();
|
|
30
|
+
await resetDatabase();
|
|
31
|
+
process.env.ADMIN_EMAILS = '';
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
afterEach(() => {
|
|
35
|
+
process.env.ADMIN_EMAILS = previousAdminEmails;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
afterAll(async () => {
|
|
39
|
+
await resetDatabase();
|
|
40
|
+
await closeDatabase();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('requires a workspace session and admin email', async () => {
|
|
44
|
+
const { orgId } = await createOrgAndAgent('Non Admin', 'generic', 0);
|
|
45
|
+
|
|
46
|
+
await api.get('/v1/admin/overview').expect(401);
|
|
47
|
+
await api
|
|
48
|
+
.get('/v1/admin/overview')
|
|
49
|
+
.set('Cookie', getWorkspaceCookie(orgId))
|
|
50
|
+
.expect(403);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test('admin overview returns workspace, plan, activity, and work metrics', async () => {
|
|
54
|
+
const first = await createOrgAndAgent('Admin Agent', 'generic', 0);
|
|
55
|
+
const second = await createOrgAndAgent('Team Agent', 'generic', 0);
|
|
56
|
+
process.env.ADMIN_EMAILS = await ownerEmail(first.orgId);
|
|
57
|
+
|
|
58
|
+
await pool.query(
|
|
59
|
+
`UPDATE orgs
|
|
60
|
+
SET plan = 'team',
|
|
61
|
+
agent_limit = 9999,
|
|
62
|
+
stripe_customer_id = 'cus_test',
|
|
63
|
+
stripe_subscription_id = 'sub_test'
|
|
64
|
+
WHERE id = $1`,
|
|
65
|
+
[second.orgId],
|
|
66
|
+
);
|
|
67
|
+
await api
|
|
68
|
+
.post('/v1/mcp/heartbeat')
|
|
69
|
+
.set('Authorization', `Bearer ${first.apiKey}`)
|
|
70
|
+
.send({ client_name: 'admin-test' })
|
|
71
|
+
.expect(200);
|
|
72
|
+
|
|
73
|
+
const response = await api
|
|
74
|
+
.get('/v1/admin/overview')
|
|
75
|
+
.set('Cookie', getWorkspaceCookie(first.orgId))
|
|
76
|
+
.expect(200);
|
|
77
|
+
|
|
78
|
+
expect(response.body).toMatchObject({
|
|
79
|
+
total_workspaces: 2,
|
|
80
|
+
free_workspaces: 1,
|
|
81
|
+
team_workspaces: 1,
|
|
82
|
+
paid_workspaces: 1,
|
|
83
|
+
total_agents: 2,
|
|
84
|
+
api_calls_today: expect.any(Number),
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('admin org list supports plan and search filters', async () => {
|
|
89
|
+
const first = await createOrgAndAgent('Searchable Owner', 'generic', 0);
|
|
90
|
+
const second = await createOrgAndAgent('Paid Team', 'generic', 0);
|
|
91
|
+
process.env.ADMIN_EMAILS = await ownerEmail(first.orgId);
|
|
92
|
+
await pool.query("UPDATE orgs SET plan = 'individual', agent_limit = 15 WHERE id = $1", [
|
|
93
|
+
second.orgId,
|
|
94
|
+
]);
|
|
95
|
+
await createAgent(second.orgId, 'Second Agent', 'generic', 0);
|
|
96
|
+
|
|
97
|
+
const byPlan = await api
|
|
98
|
+
.get('/v1/admin/orgs?plan=individual')
|
|
99
|
+
.set('Cookie', getWorkspaceCookie(first.orgId))
|
|
100
|
+
.expect(200);
|
|
101
|
+
|
|
102
|
+
expect(byPlan.body.orgs).toHaveLength(1);
|
|
103
|
+
expect(byPlan.body.orgs[0]).toMatchObject({
|
|
104
|
+
id: second.orgId,
|
|
105
|
+
plan: 'individual',
|
|
106
|
+
agent_count: 2,
|
|
107
|
+
owner_email: expect.stringContaining('@'),
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
const byQuery = await api
|
|
111
|
+
.get('/v1/admin/orgs?q=Searchable')
|
|
112
|
+
.set('Cookie', getWorkspaceCookie(first.orgId))
|
|
113
|
+
.expect(200);
|
|
114
|
+
|
|
115
|
+
expect(byQuery.body.orgs).toHaveLength(1);
|
|
116
|
+
expect(byQuery.body.orgs[0].id).toBe(first.orgId);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
test('admin org detail redacts secrets', async () => {
|
|
120
|
+
const { orgId, apiKey } = await createOrgAndAgent('Secret Check', 'generic', 0);
|
|
121
|
+
process.env.ADMIN_EMAILS = await ownerEmail(orgId);
|
|
122
|
+
await api
|
|
123
|
+
.post('/v1/mcp/heartbeat')
|
|
124
|
+
.set('Authorization', `Bearer ${apiKey}`)
|
|
125
|
+
.send({ client_name: 'admin-redaction-test' })
|
|
126
|
+
.expect(200);
|
|
127
|
+
|
|
128
|
+
const response = await api
|
|
129
|
+
.get(`/v1/admin/orgs/${orgId}`)
|
|
130
|
+
.set('Cookie', getWorkspaceCookie(orgId))
|
|
131
|
+
.expect(200);
|
|
132
|
+
|
|
133
|
+
const serialized = JSON.stringify(response.body);
|
|
134
|
+
expect(serialized).not.toContain('api_key_hash');
|
|
135
|
+
expect(serialized).not.toContain('password_hash');
|
|
136
|
+
expect(serialized).not.toContain('token_hash');
|
|
137
|
+
expect(serialized).not.toContain(apiKey);
|
|
138
|
+
expect(response.body.users[0]).toMatchObject({
|
|
139
|
+
email: expect.stringContaining('@'),
|
|
140
|
+
role: 'owner',
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
});
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { afterAll, beforeAll, describe, expect, test } from '@jest/globals';
|
|
2
|
+
import pool from '../../src/db/client';
|
|
3
|
+
import {
|
|
4
|
+
api,
|
|
5
|
+
closeDatabase,
|
|
6
|
+
createOrgAndAgent,
|
|
7
|
+
createWindow,
|
|
8
|
+
getWorkspaceCookie,
|
|
9
|
+
migrateTestDatabase,
|
|
10
|
+
resetDatabase,
|
|
11
|
+
} from './helpers';
|
|
12
|
+
|
|
13
|
+
describe('agent connection and key management', () => {
|
|
14
|
+
let orgId: string;
|
|
15
|
+
let agentId: string;
|
|
16
|
+
let apiKey: string;
|
|
17
|
+
|
|
18
|
+
beforeAll(async () => {
|
|
19
|
+
await migrateTestDatabase();
|
|
20
|
+
await resetDatabase();
|
|
21
|
+
const created = await createOrgAndAgent('Key Agent', 'generic');
|
|
22
|
+
orgId = created.orgId;
|
|
23
|
+
agentId = created.agentId;
|
|
24
|
+
apiKey = created.apiKey;
|
|
25
|
+
await createWindow(agentId, apiKey, '2030-05-01T09:00:00Z', '2030-05-01T17:00:00Z');
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
afterAll(async () => {
|
|
29
|
+
await resetDatabase();
|
|
30
|
+
await closeDatabase();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test('test connection returns setup readiness and last activity', async () => {
|
|
34
|
+
await api
|
|
35
|
+
.post('/v1/mcp/heartbeat')
|
|
36
|
+
.set('Authorization', `Bearer ${apiKey}`)
|
|
37
|
+
.send({ client_name: 'connection-test' })
|
|
38
|
+
.expect(200);
|
|
39
|
+
await api
|
|
40
|
+
.post('/v1/work/check')
|
|
41
|
+
.set('Authorization', `Bearer ${apiKey}`)
|
|
42
|
+
.send({ agent_id: agentId, resource_type: 'repo', resource_key: 'owner/repo' })
|
|
43
|
+
.expect(200);
|
|
44
|
+
const claim = await api
|
|
45
|
+
.post('/v1/work/claim')
|
|
46
|
+
.set('Authorization', `Bearer ${apiKey}`)
|
|
47
|
+
.send({ agent_id: agentId, resource_type: 'repo', resource_key: 'owner/repo' })
|
|
48
|
+
.expect(201);
|
|
49
|
+
await api
|
|
50
|
+
.post(`/v1/work/claims/${claim.body.claim.id}/extend`)
|
|
51
|
+
.set('Authorization', `Bearer ${apiKey}`)
|
|
52
|
+
.send({ duration_minutes: 15 })
|
|
53
|
+
.expect(200);
|
|
54
|
+
await api
|
|
55
|
+
.delete(`/v1/work/claims/${claim.body.claim.id}`)
|
|
56
|
+
.set('Authorization', `Bearer ${apiKey}`)
|
|
57
|
+
.expect(200);
|
|
58
|
+
|
|
59
|
+
const response = await api
|
|
60
|
+
.post(`/v1/orgs/${orgId}/agents/${agentId}/test-connection`)
|
|
61
|
+
.set('Cookie', getWorkspaceCookie(orgId))
|
|
62
|
+
.expect(200);
|
|
63
|
+
|
|
64
|
+
expect(response.body).toMatchObject({
|
|
65
|
+
agent_id: agentId,
|
|
66
|
+
last_seen_at: expect.any(String),
|
|
67
|
+
mcp_status: 'online',
|
|
68
|
+
setup_readiness: {
|
|
69
|
+
agent_created: true,
|
|
70
|
+
mcp_heartbeat_seen: true,
|
|
71
|
+
first_work_check: true,
|
|
72
|
+
first_work_claim: true,
|
|
73
|
+
first_work_extend: true,
|
|
74
|
+
first_work_release: true,
|
|
75
|
+
work: {
|
|
76
|
+
first_work_check: true,
|
|
77
|
+
first_work_claim: true,
|
|
78
|
+
first_work_extend: true,
|
|
79
|
+
first_work_release: true,
|
|
80
|
+
},
|
|
81
|
+
activity: {
|
|
82
|
+
latest_activity_type: 'work_release',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
expect(response.body.last_successful_api_call).toBeTruthy();
|
|
87
|
+
expect(JSON.stringify(response.body)).not.toContain(apiKey);
|
|
88
|
+
expect(JSON.stringify(response.body)).not.toContain('api_key_hash');
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test('valid agent API key updates general last_seen_at without changing MCP heartbeat', async () => {
|
|
92
|
+
const before = await pool.query('SELECT last_seen_at, mcp_last_seen_at FROM agents WHERE id = $1', [agentId]);
|
|
93
|
+
|
|
94
|
+
await api
|
|
95
|
+
.post('/v1/work/check')
|
|
96
|
+
.set('Authorization', `Bearer ${apiKey}`)
|
|
97
|
+
.send({ agent_id: agentId, resource_type: 'repo', resource_key: 'owner/last-seen' })
|
|
98
|
+
.expect(200);
|
|
99
|
+
|
|
100
|
+
const after = await pool.query('SELECT last_seen_at, mcp_last_seen_at FROM agents WHERE id = $1', [agentId]);
|
|
101
|
+
expect(after.rows[0].last_seen_at).toBeTruthy();
|
|
102
|
+
if (before.rows[0].last_seen_at) {
|
|
103
|
+
expect(after.rows[0].last_seen_at.getTime()).toBeGreaterThanOrEqual(before.rows[0].last_seen_at.getTime());
|
|
104
|
+
}
|
|
105
|
+
expect(after.rows[0].mcp_last_seen_at?.toISOString()).toBe(before.rows[0].mcp_last_seen_at?.toISOString());
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test('new keys use prefixed format and agent responses do not expose secrets', async () => {
|
|
109
|
+
expect(apiKey).toMatch(/^avs_live_[a-f0-9]{16}_[a-f0-9]{64}$/);
|
|
110
|
+
|
|
111
|
+
const response = await api
|
|
112
|
+
.get(`/v1/orgs/${orgId}/agents`)
|
|
113
|
+
.set('Cookie', getWorkspaceCookie(orgId))
|
|
114
|
+
.expect(200);
|
|
115
|
+
|
|
116
|
+
const agent = response.body.agents.find((row: { id: string }) => row.id === agentId);
|
|
117
|
+
expect(JSON.stringify(agent)).not.toContain('api_key_hash');
|
|
118
|
+
expect(JSON.stringify(agent)).not.toContain('api_key_prefix');
|
|
119
|
+
expect(JSON.stringify(agent)).not.toContain(apiKey);
|
|
120
|
+
expect(JSON.stringify(agent)).not.toContain(apiKey.split('_')[2]);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
test('dashboard setup test runs safely, releases temporary claim, and does not expose secrets', async () => {
|
|
124
|
+
await api
|
|
125
|
+
.post(`/v1/orgs/${orgId}/agents/${agentId}/setup-test`)
|
|
126
|
+
.set('Authorization', `Bearer ${apiKey}`)
|
|
127
|
+
.send({})
|
|
128
|
+
.expect(401);
|
|
129
|
+
|
|
130
|
+
const before = await pool.query('SELECT mcp_last_seen_at FROM agents WHERE id = $1', [agentId]);
|
|
131
|
+
const response = await api
|
|
132
|
+
.post(`/v1/orgs/${orgId}/agents/${agentId}/setup-test`)
|
|
133
|
+
.set('Cookie', getWorkspaceCookie(orgId))
|
|
134
|
+
.send({ resource_key: 'setup/demo-repo' })
|
|
135
|
+
.expect((res) => {
|
|
136
|
+
expect([200, 409]).toContain(res.status);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
expect(response.body).toMatchObject({
|
|
140
|
+
run_id: expect.any(String),
|
|
141
|
+
steps: expect.arrayContaining([
|
|
142
|
+
expect.objectContaining({ name: 'mcp_status_observed' }),
|
|
143
|
+
expect.objectContaining({ name: 'availability_check' }),
|
|
144
|
+
expect.objectContaining({ name: 'conflict_preview' }),
|
|
145
|
+
expect.objectContaining({ name: 'work_check' }),
|
|
146
|
+
]),
|
|
147
|
+
});
|
|
148
|
+
expect(JSON.stringify(response.body)).not.toContain(apiKey);
|
|
149
|
+
expect(JSON.stringify(response.body)).not.toContain('api_key_hash');
|
|
150
|
+
expect(JSON.stringify(response.body)).not.toContain('cookie');
|
|
151
|
+
|
|
152
|
+
const after = await pool.query('SELECT mcp_last_seen_at FROM agents WHERE id = $1', [agentId]);
|
|
153
|
+
expect(after.rows[0].mcp_last_seen_at?.toISOString()).toBe(before.rows[0].mcp_last_seen_at?.toISOString());
|
|
154
|
+
|
|
155
|
+
const activeClaims = await pool.query(
|
|
156
|
+
`SELECT COUNT(*)::int AS count
|
|
157
|
+
FROM work_claims
|
|
158
|
+
JOIN work_resources ON work_resources.id = work_claims.resource_id
|
|
159
|
+
WHERE work_claims.agent_id = $1
|
|
160
|
+
AND work_resources.resource_key = 'setup/demo-repo'
|
|
161
|
+
AND work_claims.status = 'active'`,
|
|
162
|
+
[agentId],
|
|
163
|
+
);
|
|
164
|
+
expect(activeClaims.rows[0].count).toBe(0);
|
|
165
|
+
|
|
166
|
+
const activity = await pool.query(
|
|
167
|
+
`SELECT activity_type, metadata
|
|
168
|
+
FROM agent_activity_events
|
|
169
|
+
WHERE agent_id = $1
|
|
170
|
+
AND (activity_type LIKE 'setup_test%' OR metadata->>'source' = 'setup_test')`,
|
|
171
|
+
[agentId],
|
|
172
|
+
);
|
|
173
|
+
expect(activity.rows.length).toBeGreaterThan(0);
|
|
174
|
+
expect(activity.rows).toEqual(
|
|
175
|
+
expect.arrayContaining([
|
|
176
|
+
expect.objectContaining({ activity_type: 'setup_test' }),
|
|
177
|
+
expect.objectContaining({ activity_type: 'setup_test_work_claim' }),
|
|
178
|
+
]),
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
const readiness = await api
|
|
182
|
+
.post(`/v1/orgs/${orgId}/agents/${agentId}/test-connection`)
|
|
183
|
+
.set('Cookie', getWorkspaceCookie(orgId))
|
|
184
|
+
.expect(200);
|
|
185
|
+
expect(readiness.body.setup_readiness.work).toMatchObject({
|
|
186
|
+
first_work_check: true,
|
|
187
|
+
first_work_claim: true,
|
|
188
|
+
first_work_extend: true,
|
|
189
|
+
first_work_release: true,
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
test('rotate key invalidates old key and returns new key once', async () => {
|
|
194
|
+
const response = await api
|
|
195
|
+
.post(`/v1/orgs/${orgId}/agents/${agentId}/rotate-key`)
|
|
196
|
+
.set('Cookie', getWorkspaceCookie(orgId))
|
|
197
|
+
.expect(200);
|
|
198
|
+
|
|
199
|
+
const newKey = response.body.api_key;
|
|
200
|
+
expect(newKey).toEqual(expect.any(String));
|
|
201
|
+
expect(newKey).toMatch(/^avs_live_[a-f0-9]{16}_[a-f0-9]{64}$/);
|
|
202
|
+
expect(newKey).not.toBe(apiKey);
|
|
203
|
+
|
|
204
|
+
await api
|
|
205
|
+
.get('/v1/availability')
|
|
206
|
+
.set('Authorization', `Bearer ${apiKey}`)
|
|
207
|
+
.query({
|
|
208
|
+
agent_id: agentId,
|
|
209
|
+
from: '2030-05-01T09:00:00Z',
|
|
210
|
+
to: '2030-05-01T10:00:00Z',
|
|
211
|
+
duration_minutes: 30,
|
|
212
|
+
})
|
|
213
|
+
.expect(401);
|
|
214
|
+
|
|
215
|
+
await api
|
|
216
|
+
.get('/v1/availability')
|
|
217
|
+
.set('Authorization', 'Bearer avs_live_malformed')
|
|
218
|
+
.query({
|
|
219
|
+
agent_id: agentId,
|
|
220
|
+
from: '2030-05-01T09:00:00Z',
|
|
221
|
+
to: '2030-05-01T10:00:00Z',
|
|
222
|
+
duration_minutes: 30,
|
|
223
|
+
})
|
|
224
|
+
.expect(401);
|
|
225
|
+
|
|
226
|
+
await api
|
|
227
|
+
.get('/v1/availability')
|
|
228
|
+
.set('Authorization', `Bearer ${newKey}`)
|
|
229
|
+
.query({
|
|
230
|
+
agent_id: agentId,
|
|
231
|
+
from: '2030-05-01T09:00:00Z',
|
|
232
|
+
to: '2030-05-01T10:00:00Z',
|
|
233
|
+
duration_minutes: 30,
|
|
234
|
+
})
|
|
235
|
+
.expect(200);
|
|
236
|
+
});
|
|
237
|
+
});
|