@useatlas/create 0.0.6 → 0.0.7
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/LICENSE +21 -0
- package/README.md +1 -1
- package/index.ts +253 -36
- package/package.json +4 -4
- package/templates/docker/Dockerfile +1 -1
- package/templates/docker/Dockerfile.sidecar +1 -1
- package/templates/docker/bin/__tests__/duckdb-ingest.test.ts +17 -14
- package/templates/docker/bin/__tests__/failure-threshold.test.ts +148 -0
- package/templates/docker/bin/__tests__/fatal-error-propagation.test.ts +267 -0
- package/templates/docker/bin/__tests__/profiler-heuristics.test.ts +5 -5
- package/templates/docker/bin/__tests__/schema-drift.test.ts +39 -0
- package/templates/docker/bin/atlas.ts +981 -1819
- package/templates/docker/bin/benchmark.ts +14 -16
- package/templates/docker/bin/enrich.ts +7 -2
- package/templates/docker/brand.css +13 -0
- package/templates/docker/data/cybersec-semantic/catalog.yml +222 -0
- package/templates/docker/data/cybersec-semantic/entities/alerts.yml +195 -0
- package/templates/docker/data/cybersec-semantic/entities/assets.yml +191 -0
- package/templates/docker/data/cybersec-semantic/entities/compliance_assessments.yml +170 -0
- package/templates/docker/data/cybersec-semantic/entities/incidents.yml +219 -0
- package/templates/docker/data/cybersec-semantic/entities/organizations.yml +136 -0
- package/templates/docker/data/cybersec-semantic/entities/plans.yml +114 -0
- package/templates/docker/data/cybersec-semantic/entities/remediation_actions.yml +212 -0
- package/templates/docker/data/cybersec-semantic/entities/scan_results.yml +215 -0
- package/templates/docker/data/cybersec-semantic/entities/scans.yml +180 -0
- package/templates/docker/data/cybersec-semantic/entities/subscriptions.yml +184 -0
- package/templates/docker/data/cybersec-semantic/entities/users.yml +140 -0
- package/templates/docker/data/cybersec-semantic/entities/vulnerabilities.yml +154 -0
- package/templates/docker/data/cybersec-semantic/glossary.yml +207 -0
- package/templates/docker/data/cybersec-semantic/metrics/business.yml +148 -0
- package/templates/docker/data/cybersec-semantic/metrics/compliance.yml +138 -0
- package/templates/docker/data/cybersec-semantic/metrics/security.yml +181 -0
- package/templates/docker/data/cybersec.sql +8 -8
- package/templates/docker/data/demo.sql +3 -0
- package/templates/docker/data/ecommerce-semantic/catalog.yml +221 -0
- package/templates/docker/data/ecommerce-semantic/entities/categories.yml +91 -0
- package/templates/docker/data/ecommerce-semantic/entities/customers.yml +133 -0
- package/templates/docker/data/ecommerce-semantic/entities/email_campaigns.yml +119 -0
- package/templates/docker/data/ecommerce-semantic/entities/inventory_levels.yml +153 -0
- package/templates/docker/data/ecommerce-semantic/entities/order_items.yml +159 -0
- package/templates/docker/data/ecommerce-semantic/entities/orders.yml +199 -0
- package/templates/docker/data/ecommerce-semantic/entities/payments.yml +140 -0
- package/templates/docker/data/ecommerce-semantic/entities/product_reviews.yml +155 -0
- package/templates/docker/data/ecommerce-semantic/entities/products.yml +178 -0
- package/templates/docker/data/ecommerce-semantic/entities/promotions.yml +171 -0
- package/templates/docker/data/ecommerce-semantic/entities/returns.yml +144 -0
- package/templates/docker/data/ecommerce-semantic/entities/sellers.yml +124 -0
- package/templates/docker/data/ecommerce-semantic/entities/shipments.yml +159 -0
- package/templates/docker/data/ecommerce-semantic/glossary.yml +193 -0
- package/templates/docker/data/ecommerce-semantic/metrics/customers.yml +116 -0
- package/templates/docker/data/ecommerce-semantic/metrics/operations.yml +131 -0
- package/templates/docker/data/ecommerce-semantic/metrics/revenue.yml +120 -0
- package/templates/docker/docs/deploy.md +2 -1
- package/templates/docker/ee/src/__mocks__/internal.ts +170 -0
- package/templates/docker/ee/src/audit/purge-scheduler.ts +113 -0
- package/templates/docker/ee/src/audit/retention.ts +467 -0
- package/templates/docker/ee/src/auth/ip-allowlist.ts +367 -0
- package/templates/docker/ee/src/auth/roles.ts +562 -0
- package/templates/docker/ee/src/auth/scim.ts +343 -0
- package/templates/docker/ee/src/auth/sso.ts +538 -0
- package/templates/docker/ee/src/backups/engine.ts +355 -0
- package/templates/docker/ee/src/backups/index.ts +26 -0
- package/templates/docker/ee/src/backups/restore.ts +169 -0
- package/templates/docker/ee/src/backups/scheduler.ts +153 -0
- package/templates/docker/ee/src/backups/verify.ts +124 -0
- package/templates/docker/ee/src/branding/white-label.ts +228 -0
- package/templates/docker/ee/src/compliance/masking.ts +477 -0
- package/templates/docker/ee/src/compliance/patterns.ts +16 -0
- package/templates/docker/ee/src/compliance/pii-detection.ts +217 -0
- package/templates/docker/ee/src/compliance/reports.ts +402 -0
- package/templates/docker/ee/src/deploy-mode.ts +37 -0
- package/templates/docker/ee/src/governance/approval.ts +699 -0
- package/templates/docker/ee/src/index.ts +74 -0
- package/templates/docker/ee/src/platform/domains.ts +562 -0
- package/templates/docker/ee/src/platform/model-routing.ts +382 -0
- package/templates/docker/ee/src/platform/residency.ts +265 -0
- package/templates/docker/ee/src/sla/alerting.ts +382 -0
- package/templates/docker/ee/src/sla/index.ts +12 -0
- package/templates/docker/ee/src/sla/metrics.ts +275 -0
- package/templates/docker/ee/src/test-setup.ts +1 -0
- package/templates/docker/next.config.ts +4 -1
- package/templates/docker/package.json +49 -29
- package/templates/docker/sidecar/Dockerfile +1 -1
- package/templates/docker/src/api/index.ts +336 -24
- package/templates/docker/src/api/routes/actions.ts +443 -176
- package/templates/docker/src/api/routes/admin-abuse.ts +219 -0
- package/templates/docker/src/api/routes/admin-approval.ts +418 -0
- package/templates/docker/src/api/routes/admin-audit-retention.ts +405 -0
- package/templates/docker/src/api/routes/admin-auth.ts +122 -0
- package/templates/docker/src/api/routes/admin-branding.ts +252 -0
- package/templates/docker/src/api/routes/admin-compliance.ts +352 -0
- package/templates/docker/src/api/routes/admin-domains.ts +334 -0
- package/templates/docker/src/api/routes/admin-integrations.ts +2667 -0
- package/templates/docker/src/api/routes/admin-ip-allowlist.ts +261 -0
- package/templates/docker/src/api/routes/admin-learned-patterns.ts +525 -0
- package/templates/docker/src/api/routes/admin-model-config.ts +252 -0
- package/templates/docker/src/api/routes/admin-onboarding-emails.ts +145 -0
- package/templates/docker/src/api/routes/admin-orgs.ts +710 -0
- package/templates/docker/src/api/routes/admin-prompts.ts +694 -0
- package/templates/docker/src/api/routes/admin-residency.ts +570 -0
- package/templates/docker/src/api/routes/admin-roles.ts +296 -0
- package/templates/docker/src/api/routes/admin-router.ts +120 -0
- package/templates/docker/src/api/routes/admin-sandbox.ts +417 -0
- package/templates/docker/src/api/routes/admin-scim.ts +262 -0
- package/templates/docker/src/api/routes/admin-sso.ts +545 -0
- package/templates/docker/src/api/routes/admin-suggestions.ts +176 -0
- package/templates/docker/src/api/routes/admin-usage.ts +310 -0
- package/templates/docker/src/api/routes/admin.ts +4156 -898
- package/templates/docker/src/api/routes/auth-preamble.ts +105 -0
- package/templates/docker/src/api/routes/billing.ts +397 -0
- package/templates/docker/src/api/routes/chat.ts +597 -334
- package/templates/docker/src/api/routes/conversations.ts +987 -132
- package/templates/docker/src/api/routes/demo.ts +673 -0
- package/templates/docker/src/api/routes/discord.ts +274 -0
- package/templates/docker/src/api/routes/ee-error-handler.ts +32 -0
- package/templates/docker/src/api/routes/health.ts +129 -14
- package/templates/docker/src/api/routes/middleware.ts +244 -0
- package/templates/docker/src/api/routes/onboarding-emails.ts +134 -0
- package/templates/docker/src/api/routes/onboarding.ts +1109 -0
- package/templates/docker/src/api/routes/openapi.ts +184 -1597
- package/templates/docker/src/api/routes/platform-admin.ts +760 -0
- package/templates/docker/src/api/routes/platform-backups.ts +436 -0
- package/templates/docker/src/api/routes/platform-domains.ts +235 -0
- package/templates/docker/src/api/routes/platform-residency.ts +257 -0
- package/templates/docker/src/api/routes/platform-sla.ts +379 -0
- package/templates/docker/src/api/routes/prompts.ts +221 -0
- package/templates/docker/src/api/routes/public-branding.ts +106 -0
- package/templates/docker/src/api/routes/query.ts +330 -219
- package/templates/docker/src/api/routes/scheduled-tasks.ts +393 -297
- package/templates/docker/src/api/routes/semantic.ts +179 -0
- package/templates/docker/src/api/routes/sessions.ts +210 -0
- package/templates/docker/src/api/routes/shared-domains.ts +98 -0
- package/templates/docker/src/api/routes/shared-schemas.ts +139 -0
- package/templates/docker/src/api/routes/slack.ts +209 -52
- package/templates/docker/src/api/routes/suggestions.ts +233 -0
- package/templates/docker/src/api/routes/tables.ts +67 -0
- package/templates/docker/src/api/routes/teams.ts +222 -0
- package/templates/docker/src/api/routes/validate-sql.ts +188 -0
- package/templates/docker/src/api/routes/validation-hook.ts +62 -0
- package/templates/docker/src/api/routes/widget-loader.ts +356 -0
- package/templates/docker/src/api/routes/widget.ts +428 -0
- package/templates/docker/src/api/routes/wizard.ts +852 -0
- package/templates/docker/src/api/server.ts +187 -69
- package/templates/docker/src/app/error.tsx +5 -2
- package/templates/docker/src/app/globals.css +1 -1
- package/templates/docker/src/app/layout.tsx +7 -2
- package/templates/docker/src/app/page.tsx +39 -5
- package/templates/docker/src/components/data-table/data-table-column-header.tsx +99 -0
- package/templates/docker/src/components/data-table/data-table-date-filter.tsx +225 -0
- package/templates/docker/src/components/data-table/data-table-expandable.tsx +125 -0
- package/templates/docker/src/components/data-table/data-table-faceted-filter.tsx +189 -0
- package/templates/docker/src/components/data-table/data-table-pagination.tsx +112 -0
- package/templates/docker/src/components/data-table/data-table-range-filter.tsx +122 -0
- package/templates/docker/src/components/data-table/data-table-slider-filter.tsx +256 -0
- package/templates/docker/src/components/data-table/data-table-sort-list.tsx +407 -0
- package/templates/docker/src/components/data-table/data-table-toolbar.tsx +149 -0
- package/templates/docker/src/components/data-table/data-table-view-options.tsx +89 -0
- package/templates/docker/src/components/data-table/data-table.tsx +105 -0
- package/templates/docker/src/components/form-dialog.tsx +135 -0
- package/templates/docker/src/components/ui/accordion.tsx +66 -0
- package/templates/docker/src/components/ui/calendar.tsx +220 -0
- package/templates/docker/src/components/ui/checkbox.tsx +32 -0
- package/templates/docker/src/components/ui/faceted.tsx +283 -0
- package/templates/docker/src/components/ui/form.tsx +167 -0
- package/templates/docker/src/components/ui/label.tsx +24 -0
- package/templates/docker/src/components/ui/popover.tsx +89 -0
- package/templates/docker/src/components/ui/progress.tsx +31 -0
- package/templates/docker/src/components/ui/scroll-area.tsx +6 -2
- package/templates/docker/src/components/ui/slider.tsx +63 -0
- package/templates/docker/src/components/ui/sortable.tsx +581 -0
- package/templates/docker/src/components/ui/switch.tsx +35 -0
- package/templates/docker/src/components/ui/textarea.tsx +18 -0
- package/templates/docker/src/config/data-table.ts +82 -0
- package/templates/docker/src/env-check.ts +74 -0
- package/templates/docker/src/hooks/use-callback-ref.ts +27 -0
- package/templates/docker/src/hooks/use-data-table.ts +316 -0
- package/templates/docker/src/hooks/use-debounced-callback.ts +28 -0
- package/templates/docker/src/lib/action-types.ts +7 -41
- package/templates/docker/src/lib/agent-query.ts +4 -2
- package/templates/docker/src/lib/agent.ts +363 -31
- package/templates/docker/src/lib/auth/admin-permissions.ts +38 -0
- package/templates/docker/src/lib/auth/audit.ts +19 -4
- package/templates/docker/src/lib/auth/byot.ts +3 -3
- package/templates/docker/src/lib/auth/client.ts +33 -3
- package/templates/docker/src/lib/auth/detect.ts +29 -8
- package/templates/docker/src/lib/auth/managed.ts +104 -14
- package/templates/docker/src/lib/auth/middleware.ts +53 -6
- package/templates/docker/src/lib/auth/migrate.ts +140 -15
- package/templates/docker/src/lib/auth/oauth-state.ts +123 -0
- package/templates/docker/src/lib/auth/org-permissions.ts +55 -0
- package/templates/docker/src/lib/auth/permissions.ts +26 -19
- package/templates/docker/src/lib/auth/server.ts +355 -9
- package/templates/docker/src/lib/auth/simple-key.ts +3 -3
- package/templates/docker/src/lib/auth/types.ts +15 -21
- package/templates/docker/src/lib/billing/enforcement.ts +368 -0
- package/templates/docker/src/lib/billing/plans.ts +155 -0
- package/templates/docker/src/lib/cache/index.ts +92 -0
- package/templates/docker/src/lib/cache/keys.ts +30 -0
- package/templates/docker/src/lib/cache/lru.ts +79 -0
- package/templates/docker/src/lib/cache/types.ts +31 -0
- package/templates/docker/src/lib/compose-refs.ts +62 -0
- package/templates/docker/src/lib/config.ts +563 -11
- package/templates/docker/src/lib/connection-types.ts +9 -0
- package/templates/docker/src/lib/conversation-types.ts +1 -25
- package/templates/docker/src/lib/conversations.ts +345 -14
- package/templates/docker/src/lib/data-table.ts +61 -0
- package/templates/docker/src/lib/db/connection.ts +793 -39
- package/templates/docker/src/lib/db/internal.ts +985 -139
- package/templates/docker/src/lib/db/migrate.ts +295 -0
- package/templates/docker/src/lib/db/migrations/0000_baseline.sql +703 -0
- package/templates/docker/src/lib/db/migrations/0001_teams_installations.sql +14 -0
- package/templates/docker/src/lib/db/migrations/0002_discord_installations.sql +14 -0
- package/templates/docker/src/lib/db/migrations/0003_telegram_installations.sql +15 -0
- package/templates/docker/src/lib/db/migrations/0004_sandbox_credentials.sql +18 -0
- package/templates/docker/src/lib/db/migrations/0005_oauth_state.sql +16 -0
- package/templates/docker/src/lib/db/migrations/0006_byot_credentials.sql +14 -0
- package/templates/docker/src/lib/db/migrations/0007_gchat_installations.sql +15 -0
- package/templates/docker/src/lib/db/migrations/0008_github_installations.sql +14 -0
- package/templates/docker/src/lib/db/migrations/0009_linear_installations.sql +15 -0
- package/templates/docker/src/lib/db/migrations/0010_whatsapp_installations.sql +14 -0
- package/templates/docker/src/lib/db/migrations/0011_email_installations.sql +16 -0
- package/templates/docker/src/lib/db/migrations/0012_region_migrations.sql +25 -0
- package/templates/docker/src/lib/db/schema.ts +1120 -0
- package/templates/docker/src/lib/db/source-rate-limit.ts +89 -139
- package/templates/docker/src/lib/demo.ts +308 -0
- package/templates/docker/src/lib/discord/store.ts +225 -0
- package/templates/docker/src/lib/effect/ai.ts +243 -0
- package/templates/docker/src/lib/effect/errors.ts +234 -0
- package/templates/docker/src/lib/effect/hono.ts +454 -0
- package/templates/docker/src/lib/effect/index.ts +137 -0
- package/templates/docker/src/lib/effect/layers.ts +496 -0
- package/templates/docker/src/lib/effect/services.ts +776 -0
- package/templates/docker/src/lib/effect/sql.ts +178 -0
- package/templates/docker/src/lib/effect/toolkit.ts +123 -0
- package/templates/docker/src/lib/email/delivery.ts +232 -0
- package/templates/docker/src/lib/email/engine.ts +349 -0
- package/templates/docker/src/lib/email/hooks.ts +107 -0
- package/templates/docker/src/lib/email/index.ts +16 -0
- package/templates/docker/src/lib/email/scheduler.ts +72 -0
- package/templates/docker/src/lib/email/sequence.ts +73 -0
- package/templates/docker/src/lib/email/store.ts +163 -0
- package/templates/docker/src/lib/email/templates.ts +215 -0
- package/templates/docker/src/lib/format.ts +67 -0
- package/templates/docker/src/lib/gchat/store.ts +202 -0
- package/templates/docker/src/lib/github/store.ts +197 -0
- package/templates/docker/src/lib/id.ts +29 -0
- package/templates/docker/src/lib/integrations/types.ts +166 -0
- package/templates/docker/src/lib/learn/pattern-analyzer.ts +224 -0
- package/templates/docker/src/lib/learn/pattern-cache.ts +229 -0
- package/templates/docker/src/lib/learn/pattern-proposer.ts +87 -0
- package/templates/docker/src/lib/learn/suggestion-helpers.ts +34 -0
- package/templates/docker/src/lib/learn/suggestions.ts +139 -0
- package/templates/docker/src/lib/linear/store.ts +200 -0
- package/templates/docker/src/lib/logger.ts +35 -3
- package/templates/docker/src/lib/metering.ts +272 -0
- package/templates/docker/src/lib/parsers.ts +99 -0
- package/templates/docker/src/lib/plugins/hooks.ts +13 -11
- package/templates/docker/src/lib/plugins/index.ts +3 -1
- package/templates/docker/src/lib/plugins/registry.ts +58 -6
- package/templates/docker/src/lib/plugins/settings.ts +147 -0
- package/templates/docker/src/lib/plugins/wiring.ts +6 -9
- package/templates/docker/src/lib/profiler.ts +1665 -0
- package/templates/docker/src/lib/providers.ts +188 -13
- package/templates/docker/src/lib/rls.ts +172 -60
- package/templates/docker/src/lib/sandbox/credentials.ts +206 -0
- package/templates/docker/src/lib/sandbox/validate.ts +179 -0
- package/templates/docker/src/lib/scheduled-task-types.ts +26 -94
- package/templates/docker/src/lib/scheduled-tasks.ts +174 -34
- package/templates/docker/src/lib/scheduler/delivery.ts +248 -150
- package/templates/docker/src/lib/scheduler/engine.ts +190 -154
- package/templates/docker/src/lib/scheduler/executor.ts +74 -23
- package/templates/docker/src/lib/scheduler/preview.ts +72 -0
- package/templates/docker/src/lib/security/abuse.ts +463 -0
- package/templates/docker/src/lib/semantic/diff.ts +267 -0
- package/templates/docker/src/lib/semantic/entities.ts +167 -0
- package/templates/docker/src/lib/semantic/files.ts +283 -0
- package/templates/docker/src/lib/semantic/index.ts +27 -0
- package/templates/docker/src/lib/{semantic-index.ts → semantic/search.ts} +80 -9
- package/templates/docker/src/lib/semantic/sync.ts +581 -0
- package/templates/docker/src/lib/{semantic.ts → semantic/whitelist.ts} +189 -3
- package/templates/docker/src/lib/settings.ts +817 -0
- package/templates/docker/src/lib/sidecar-types.ts +13 -0
- package/templates/docker/src/lib/slack/store.ts +134 -25
- package/templates/docker/src/lib/startup.ts +528 -362
- package/templates/docker/src/lib/teams/store.ts +216 -0
- package/templates/docker/src/lib/telegram/store.ts +202 -0
- package/templates/docker/src/lib/telemetry.ts +40 -0
- package/templates/docker/src/lib/tools/actions/audit.ts +8 -5
- package/templates/docker/src/lib/tools/actions/email.ts +3 -1
- package/templates/docker/src/lib/tools/actions/handler.ts +276 -93
- package/templates/docker/src/lib/tools/actions/jira.ts +2 -2
- package/templates/docker/src/lib/tools/backends/detect.ts +16 -0
- package/templates/docker/src/lib/tools/backends/index.ts +11 -0
- package/templates/docker/src/lib/tools/backends/nsjail.ts +213 -0
- package/templates/docker/src/lib/tools/backends/shared.ts +103 -0
- package/templates/docker/src/lib/tools/backends/types.ts +26 -0
- package/templates/docker/src/lib/tools/explore-nsjail.ts +7 -228
- package/templates/docker/src/lib/tools/explore-sandbox.ts +4 -29
- package/templates/docker/src/lib/tools/explore-sidecar.ts +18 -2
- package/templates/docker/src/lib/tools/explore.ts +246 -54
- package/templates/docker/src/lib/tools/index.ts +17 -0
- package/templates/docker/src/lib/tools/python-nsjail.ts +11 -139
- package/templates/docker/src/lib/tools/python-sandbox.ts +9 -132
- package/templates/docker/src/lib/tools/python-sidecar.ts +184 -3
- package/templates/docker/src/lib/tools/python-stream.ts +33 -0
- package/templates/docker/src/lib/tools/python-wrapper.ts +129 -0
- package/templates/docker/src/lib/tools/python.ts +115 -15
- package/templates/docker/src/lib/tools/registry.ts +14 -2
- package/templates/docker/src/lib/tools/sql.ts +778 -362
- package/templates/docker/src/lib/tracing.ts +16 -0
- package/templates/docker/src/lib/whatsapp/store.ts +198 -0
- package/templates/docker/src/lib/workspace.ts +89 -0
- package/templates/docker/src/progress.ts +121 -0
- package/templates/docker/src/types/data-table.ts +48 -0
- package/templates/docker/src/ui/atlas-chat-reexport.ts +3 -0
- package/templates/docker/src/ui/components/actions/action-approval-card.tsx +26 -19
- package/templates/docker/src/ui/components/actions/action-status-badge.tsx +3 -3
- package/templates/docker/src/ui/components/admin/admin-layout.tsx +57 -39
- package/templates/docker/src/ui/components/admin/admin-sidebar.tsx +213 -35
- package/templates/docker/src/ui/components/admin/delivery-status-badge.tsx +53 -0
- package/templates/docker/src/ui/components/admin/empty-state.tsx +27 -6
- package/templates/docker/src/ui/components/admin/entity-detail.tsx +3 -52
- package/templates/docker/src/ui/components/admin/error-banner.tsx +2 -2
- package/templates/docker/src/ui/components/admin/feature-disabled.tsx +28 -5
- package/templates/docker/src/ui/components/admin-content-wrapper.tsx +87 -0
- package/templates/docker/src/ui/components/atlas-chat.tsx +449 -166
- package/templates/docker/src/ui/components/branding-head.tsx +41 -0
- package/templates/docker/src/ui/components/chart/chart-detection.ts +62 -5
- package/templates/docker/src/ui/components/chart/result-chart.tsx +316 -125
- package/templates/docker/src/ui/components/chat/api-key-bar.tsx +4 -4
- package/templates/docker/src/ui/components/chat/data-table.tsx +45 -4
- package/templates/docker/src/ui/components/chat/error-banner.tsx +86 -5
- package/templates/docker/src/ui/components/chat/follow-up-chips.tsx +29 -0
- package/templates/docker/src/ui/components/chat/markdown.tsx +24 -0
- package/templates/docker/src/ui/components/chat/prompt-library.tsx +206 -0
- package/templates/docker/src/ui/components/chat/python-result-card.tsx +106 -78
- package/templates/docker/src/ui/components/chat/result-card-base.tsx +101 -0
- package/templates/docker/src/ui/components/chat/share-dialog.tsx +377 -0
- package/templates/docker/src/ui/components/chat/sql-result-card.tsx +94 -73
- package/templates/docker/src/ui/components/chat/suggestion-chips.tsx +46 -0
- package/templates/docker/src/ui/components/chat/tool-part.tsx +16 -4
- package/templates/docker/src/ui/components/conversations/conversation-item.tsx +48 -17
- package/templates/docker/src/ui/components/conversations/conversation-list.tsx +38 -24
- package/templates/docker/src/ui/components/conversations/conversation-sidebar.tsx +66 -7
- package/templates/docker/src/ui/components/conversations/delete-confirmation.tsx +9 -2
- package/templates/docker/src/ui/components/error-boundary.tsx +66 -0
- package/templates/docker/src/ui/components/notebook/delete-cell-dialog.tsx +48 -0
- package/templates/docker/src/ui/components/notebook/fork-branch-selector.tsx +68 -0
- package/templates/docker/src/ui/components/notebook/notebook-cell-input.tsx +76 -0
- package/templates/docker/src/ui/components/notebook/notebook-cell-output.tsx +58 -0
- package/templates/docker/src/ui/components/notebook/notebook-cell-toolbar.tsx +91 -0
- package/templates/docker/src/ui/components/notebook/notebook-cell.tsx +119 -0
- package/templates/docker/src/ui/components/notebook/notebook-empty-state.tsx +19 -0
- package/templates/docker/src/ui/components/notebook/notebook-export.ts +287 -0
- package/templates/docker/src/ui/components/notebook/notebook-input-bar.tsx +49 -0
- package/templates/docker/src/ui/components/notebook/notebook-shell.tsx +266 -0
- package/templates/docker/src/ui/components/notebook/notebook-text-cell.tsx +152 -0
- package/templates/docker/src/ui/components/notebook/types.ts +39 -0
- package/templates/docker/src/ui/components/notebook/use-keyboard-nav.ts +109 -0
- package/templates/docker/src/ui/components/notebook/use-notebook.ts +684 -0
- package/templates/docker/src/ui/components/org-switcher.tsx +111 -0
- package/templates/docker/src/ui/components/region-picker.tsx +103 -0
- package/templates/docker/src/ui/components/schema-explorer/schema-explorer.tsx +522 -0
- package/templates/docker/src/ui/components/social-icons.tsx +26 -0
- package/templates/docker/src/ui/components/tour/guided-tour.tsx +81 -0
- package/templates/docker/src/ui/components/tour/index.ts +5 -0
- package/templates/docker/src/ui/components/tour/nav-bar.tsx +100 -0
- package/templates/docker/src/ui/components/tour/tour-overlay.tsx +298 -0
- package/templates/docker/src/ui/components/tour/tour-steps.ts +43 -0
- package/templates/docker/src/ui/components/tour/types.ts +21 -0
- package/templates/docker/src/ui/components/tour/use-tour.ts +193 -0
- package/templates/docker/src/ui/context-reexport.ts +3 -0
- package/templates/docker/src/ui/hooks/theme-init-script.ts +17 -0
- package/templates/docker/src/ui/hooks/use-admin-fetch.ts +38 -30
- package/templates/docker/src/ui/hooks/use-admin-mutation.ts +188 -0
- package/templates/docker/src/ui/hooks/use-atlas-transport.ts +225 -0
- package/templates/docker/src/ui/hooks/use-branding.ts +68 -0
- package/templates/docker/src/ui/hooks/use-conversations.ts +106 -83
- package/templates/docker/src/ui/hooks/use-dark-mode.ts +134 -10
- package/templates/docker/src/ui/hooks/use-deploy-mode.ts +36 -0
- package/templates/docker/src/ui/hooks/use-platform-admin-guard.ts +49 -0
- package/templates/docker/src/ui/lib/action-types.ts +11 -63
- package/templates/docker/src/ui/lib/admin-schemas.ts +744 -0
- package/templates/docker/src/ui/lib/fetch-client.ts +84 -0
- package/templates/docker/src/ui/lib/fetch-error.ts +54 -0
- package/templates/docker/src/ui/lib/helpers.ts +94 -1
- package/templates/docker/src/ui/lib/types.ts +149 -140
- package/templates/docker/tsconfig.json +4 -2
- package/templates/nextjs-standalone/bin/__tests__/duckdb-ingest.test.ts +17 -14
- package/templates/nextjs-standalone/bin/__tests__/failure-threshold.test.ts +148 -0
- package/templates/nextjs-standalone/bin/__tests__/fatal-error-propagation.test.ts +267 -0
- package/templates/nextjs-standalone/bin/__tests__/profiler-heuristics.test.ts +5 -5
- package/templates/nextjs-standalone/bin/__tests__/schema-drift.test.ts +39 -0
- package/templates/nextjs-standalone/bin/atlas.ts +981 -1819
- package/templates/nextjs-standalone/bin/benchmark.ts +14 -16
- package/templates/nextjs-standalone/bin/enrich.ts +7 -2
- package/templates/nextjs-standalone/brand.css +13 -0
- package/templates/nextjs-standalone/data/cybersec-semantic/catalog.yml +222 -0
- package/templates/nextjs-standalone/data/cybersec-semantic/entities/alerts.yml +195 -0
- package/templates/nextjs-standalone/data/cybersec-semantic/entities/assets.yml +191 -0
- package/templates/nextjs-standalone/data/cybersec-semantic/entities/compliance_assessments.yml +170 -0
- package/templates/nextjs-standalone/data/cybersec-semantic/entities/incidents.yml +219 -0
- package/templates/nextjs-standalone/data/cybersec-semantic/entities/organizations.yml +136 -0
- package/templates/nextjs-standalone/data/cybersec-semantic/entities/plans.yml +114 -0
- package/templates/nextjs-standalone/data/cybersec-semantic/entities/remediation_actions.yml +212 -0
- package/templates/nextjs-standalone/data/cybersec-semantic/entities/scan_results.yml +215 -0
- package/templates/nextjs-standalone/data/cybersec-semantic/entities/scans.yml +180 -0
- package/templates/nextjs-standalone/data/cybersec-semantic/entities/subscriptions.yml +184 -0
- package/templates/nextjs-standalone/data/cybersec-semantic/entities/users.yml +140 -0
- package/templates/nextjs-standalone/data/cybersec-semantic/entities/vulnerabilities.yml +154 -0
- package/templates/nextjs-standalone/data/cybersec-semantic/glossary.yml +207 -0
- package/templates/nextjs-standalone/data/cybersec-semantic/metrics/business.yml +148 -0
- package/templates/nextjs-standalone/data/cybersec-semantic/metrics/compliance.yml +138 -0
- package/templates/nextjs-standalone/data/cybersec-semantic/metrics/security.yml +181 -0
- package/templates/nextjs-standalone/data/cybersec.sql +8 -8
- package/templates/nextjs-standalone/data/demo.sql +3 -0
- package/templates/nextjs-standalone/data/ecommerce-semantic/catalog.yml +221 -0
- package/templates/nextjs-standalone/data/ecommerce-semantic/entities/categories.yml +91 -0
- package/templates/nextjs-standalone/data/ecommerce-semantic/entities/customers.yml +133 -0
- package/templates/nextjs-standalone/data/ecommerce-semantic/entities/email_campaigns.yml +119 -0
- package/templates/nextjs-standalone/data/ecommerce-semantic/entities/inventory_levels.yml +153 -0
- package/templates/nextjs-standalone/data/ecommerce-semantic/entities/order_items.yml +159 -0
- package/templates/nextjs-standalone/data/ecommerce-semantic/entities/orders.yml +199 -0
- package/templates/nextjs-standalone/data/ecommerce-semantic/entities/payments.yml +140 -0
- package/templates/nextjs-standalone/data/ecommerce-semantic/entities/product_reviews.yml +155 -0
- package/templates/nextjs-standalone/data/ecommerce-semantic/entities/products.yml +178 -0
- package/templates/nextjs-standalone/data/ecommerce-semantic/entities/promotions.yml +171 -0
- package/templates/nextjs-standalone/data/ecommerce-semantic/entities/returns.yml +144 -0
- package/templates/nextjs-standalone/data/ecommerce-semantic/entities/sellers.yml +124 -0
- package/templates/nextjs-standalone/data/ecommerce-semantic/entities/shipments.yml +159 -0
- package/templates/nextjs-standalone/data/ecommerce-semantic/glossary.yml +193 -0
- package/templates/nextjs-standalone/data/ecommerce-semantic/metrics/customers.yml +116 -0
- package/templates/nextjs-standalone/data/ecommerce-semantic/metrics/operations.yml +131 -0
- package/templates/nextjs-standalone/data/ecommerce-semantic/metrics/revenue.yml +120 -0
- package/templates/nextjs-standalone/docs/deploy.md +2 -1
- package/templates/nextjs-standalone/ee/src/__mocks__/internal.ts +170 -0
- package/templates/nextjs-standalone/ee/src/audit/purge-scheduler.ts +113 -0
- package/templates/nextjs-standalone/ee/src/audit/retention.ts +467 -0
- package/templates/nextjs-standalone/ee/src/auth/ip-allowlist.ts +367 -0
- package/templates/nextjs-standalone/ee/src/auth/roles.ts +562 -0
- package/templates/nextjs-standalone/ee/src/auth/scim.ts +343 -0
- package/templates/nextjs-standalone/ee/src/auth/sso.ts +538 -0
- package/templates/nextjs-standalone/ee/src/backups/engine.ts +355 -0
- package/templates/nextjs-standalone/ee/src/backups/index.ts +26 -0
- package/templates/nextjs-standalone/ee/src/backups/restore.ts +169 -0
- package/templates/nextjs-standalone/ee/src/backups/scheduler.ts +153 -0
- package/templates/nextjs-standalone/ee/src/backups/verify.ts +124 -0
- package/templates/nextjs-standalone/ee/src/branding/white-label.ts +228 -0
- package/templates/nextjs-standalone/ee/src/compliance/masking.ts +477 -0
- package/templates/nextjs-standalone/ee/src/compliance/patterns.ts +16 -0
- package/templates/nextjs-standalone/ee/src/compliance/pii-detection.ts +217 -0
- package/templates/nextjs-standalone/ee/src/compliance/reports.ts +402 -0
- package/templates/nextjs-standalone/ee/src/deploy-mode.ts +37 -0
- package/templates/nextjs-standalone/ee/src/governance/approval.ts +699 -0
- package/templates/nextjs-standalone/ee/src/index.ts +74 -0
- package/templates/nextjs-standalone/ee/src/platform/domains.ts +562 -0
- package/templates/nextjs-standalone/ee/src/platform/model-routing.ts +382 -0
- package/templates/nextjs-standalone/ee/src/platform/residency.ts +265 -0
- package/templates/nextjs-standalone/ee/src/sla/alerting.ts +382 -0
- package/templates/nextjs-standalone/ee/src/sla/index.ts +12 -0
- package/templates/nextjs-standalone/ee/src/sla/metrics.ts +275 -0
- package/templates/nextjs-standalone/ee/src/test-setup.ts +1 -0
- package/templates/nextjs-standalone/next.config.ts +1 -1
- package/templates/nextjs-standalone/package.json +50 -30
- package/templates/nextjs-standalone/src/api/index.ts +336 -24
- package/templates/nextjs-standalone/src/api/routes/actions.ts +443 -176
- package/templates/nextjs-standalone/src/api/routes/admin-abuse.ts +219 -0
- package/templates/nextjs-standalone/src/api/routes/admin-approval.ts +418 -0
- package/templates/nextjs-standalone/src/api/routes/admin-audit-retention.ts +405 -0
- package/templates/nextjs-standalone/src/api/routes/admin-auth.ts +122 -0
- package/templates/nextjs-standalone/src/api/routes/admin-branding.ts +252 -0
- package/templates/nextjs-standalone/src/api/routes/admin-compliance.ts +352 -0
- package/templates/nextjs-standalone/src/api/routes/admin-domains.ts +334 -0
- package/templates/nextjs-standalone/src/api/routes/admin-integrations.ts +2667 -0
- package/templates/nextjs-standalone/src/api/routes/admin-ip-allowlist.ts +261 -0
- package/templates/nextjs-standalone/src/api/routes/admin-learned-patterns.ts +525 -0
- package/templates/nextjs-standalone/src/api/routes/admin-model-config.ts +252 -0
- package/templates/nextjs-standalone/src/api/routes/admin-onboarding-emails.ts +145 -0
- package/templates/nextjs-standalone/src/api/routes/admin-orgs.ts +710 -0
- package/templates/nextjs-standalone/src/api/routes/admin-prompts.ts +694 -0
- package/templates/nextjs-standalone/src/api/routes/admin-residency.ts +570 -0
- package/templates/nextjs-standalone/src/api/routes/admin-roles.ts +296 -0
- package/templates/nextjs-standalone/src/api/routes/admin-router.ts +120 -0
- package/templates/nextjs-standalone/src/api/routes/admin-sandbox.ts +417 -0
- package/templates/nextjs-standalone/src/api/routes/admin-scim.ts +262 -0
- package/templates/nextjs-standalone/src/api/routes/admin-sso.ts +545 -0
- package/templates/nextjs-standalone/src/api/routes/admin-suggestions.ts +176 -0
- package/templates/nextjs-standalone/src/api/routes/admin-usage.ts +310 -0
- package/templates/nextjs-standalone/src/api/routes/admin.ts +4156 -898
- package/templates/nextjs-standalone/src/api/routes/auth-preamble.ts +105 -0
- package/templates/nextjs-standalone/src/api/routes/billing.ts +397 -0
- package/templates/nextjs-standalone/src/api/routes/chat.ts +597 -334
- package/templates/nextjs-standalone/src/api/routes/conversations.ts +987 -132
- package/templates/nextjs-standalone/src/api/routes/demo.ts +673 -0
- package/templates/nextjs-standalone/src/api/routes/discord.ts +274 -0
- package/templates/nextjs-standalone/src/api/routes/ee-error-handler.ts +32 -0
- package/templates/nextjs-standalone/src/api/routes/health.ts +129 -14
- package/templates/nextjs-standalone/src/api/routes/middleware.ts +244 -0
- package/templates/nextjs-standalone/src/api/routes/onboarding-emails.ts +134 -0
- package/templates/nextjs-standalone/src/api/routes/onboarding.ts +1109 -0
- package/templates/nextjs-standalone/src/api/routes/openapi.ts +184 -1597
- package/templates/nextjs-standalone/src/api/routes/platform-admin.ts +760 -0
- package/templates/nextjs-standalone/src/api/routes/platform-backups.ts +436 -0
- package/templates/nextjs-standalone/src/api/routes/platform-domains.ts +235 -0
- package/templates/nextjs-standalone/src/api/routes/platform-residency.ts +257 -0
- package/templates/nextjs-standalone/src/api/routes/platform-sla.ts +379 -0
- package/templates/nextjs-standalone/src/api/routes/prompts.ts +221 -0
- package/templates/nextjs-standalone/src/api/routes/public-branding.ts +106 -0
- package/templates/nextjs-standalone/src/api/routes/query.ts +330 -219
- package/templates/nextjs-standalone/src/api/routes/scheduled-tasks.ts +393 -297
- package/templates/nextjs-standalone/src/api/routes/semantic.ts +179 -0
- package/templates/nextjs-standalone/src/api/routes/sessions.ts +210 -0
- package/templates/nextjs-standalone/src/api/routes/shared-domains.ts +98 -0
- package/templates/nextjs-standalone/src/api/routes/shared-schemas.ts +139 -0
- package/templates/nextjs-standalone/src/api/routes/slack.ts +209 -52
- package/templates/nextjs-standalone/src/api/routes/suggestions.ts +233 -0
- package/templates/nextjs-standalone/src/api/routes/tables.ts +67 -0
- package/templates/nextjs-standalone/src/api/routes/teams.ts +222 -0
- package/templates/nextjs-standalone/src/api/routes/validate-sql.ts +188 -0
- package/templates/nextjs-standalone/src/api/routes/validation-hook.ts +62 -0
- package/templates/nextjs-standalone/src/api/routes/widget-loader.ts +356 -0
- package/templates/nextjs-standalone/src/api/routes/widget.ts +428 -0
- package/templates/nextjs-standalone/src/api/routes/wizard.ts +852 -0
- package/templates/nextjs-standalone/src/api/server.ts +187 -69
- package/templates/nextjs-standalone/src/app/error.tsx +5 -2
- package/templates/nextjs-standalone/src/app/globals.css +1 -1
- package/templates/nextjs-standalone/src/app/layout.tsx +7 -2
- package/templates/nextjs-standalone/src/app/page.tsx +39 -5
- package/templates/nextjs-standalone/src/components/data-table/data-table-column-header.tsx +99 -0
- package/templates/nextjs-standalone/src/components/data-table/data-table-date-filter.tsx +225 -0
- package/templates/nextjs-standalone/src/components/data-table/data-table-expandable.tsx +125 -0
- package/templates/nextjs-standalone/src/components/data-table/data-table-faceted-filter.tsx +189 -0
- package/templates/nextjs-standalone/src/components/data-table/data-table-pagination.tsx +112 -0
- package/templates/nextjs-standalone/src/components/data-table/data-table-range-filter.tsx +122 -0
- package/templates/nextjs-standalone/src/components/data-table/data-table-slider-filter.tsx +256 -0
- package/templates/nextjs-standalone/src/components/data-table/data-table-sort-list.tsx +407 -0
- package/templates/nextjs-standalone/src/components/data-table/data-table-toolbar.tsx +149 -0
- package/templates/nextjs-standalone/src/components/data-table/data-table-view-options.tsx +89 -0
- package/templates/nextjs-standalone/src/components/data-table/data-table.tsx +105 -0
- package/templates/nextjs-standalone/src/components/form-dialog.tsx +135 -0
- package/templates/nextjs-standalone/src/components/ui/accordion.tsx +66 -0
- package/templates/nextjs-standalone/src/components/ui/calendar.tsx +220 -0
- package/templates/nextjs-standalone/src/components/ui/checkbox.tsx +32 -0
- package/templates/nextjs-standalone/src/components/ui/faceted.tsx +283 -0
- package/templates/nextjs-standalone/src/components/ui/form.tsx +167 -0
- package/templates/nextjs-standalone/src/components/ui/label.tsx +24 -0
- package/templates/nextjs-standalone/src/components/ui/popover.tsx +89 -0
- package/templates/nextjs-standalone/src/components/ui/progress.tsx +31 -0
- package/templates/nextjs-standalone/src/components/ui/scroll-area.tsx +6 -2
- package/templates/nextjs-standalone/src/components/ui/slider.tsx +63 -0
- package/templates/nextjs-standalone/src/components/ui/sortable.tsx +581 -0
- package/templates/nextjs-standalone/src/components/ui/switch.tsx +35 -0
- package/templates/nextjs-standalone/src/components/ui/textarea.tsx +18 -0
- package/templates/nextjs-standalone/src/config/data-table.ts +82 -0
- package/templates/nextjs-standalone/src/env-check.ts +74 -0
- package/templates/nextjs-standalone/src/hooks/use-callback-ref.ts +27 -0
- package/templates/nextjs-standalone/src/hooks/use-data-table.ts +316 -0
- package/templates/nextjs-standalone/src/hooks/use-debounced-callback.ts +28 -0
- package/templates/nextjs-standalone/src/lib/action-types.ts +7 -41
- package/templates/nextjs-standalone/src/lib/agent-query.ts +4 -2
- package/templates/nextjs-standalone/src/lib/agent.ts +363 -31
- package/templates/nextjs-standalone/src/lib/api-url.ts +2 -3
- package/templates/nextjs-standalone/src/lib/auth/admin-permissions.ts +38 -0
- package/templates/nextjs-standalone/src/lib/auth/audit.ts +19 -4
- package/templates/nextjs-standalone/src/lib/auth/byot.ts +3 -3
- package/templates/nextjs-standalone/src/lib/auth/detect.ts +29 -8
- package/templates/nextjs-standalone/src/lib/auth/managed.ts +104 -14
- package/templates/nextjs-standalone/src/lib/auth/middleware.ts +53 -6
- package/templates/nextjs-standalone/src/lib/auth/migrate.ts +140 -15
- package/templates/nextjs-standalone/src/lib/auth/oauth-state.ts +123 -0
- package/templates/nextjs-standalone/src/lib/auth/org-permissions.ts +55 -0
- package/templates/nextjs-standalone/src/lib/auth/permissions.ts +26 -19
- package/templates/nextjs-standalone/src/lib/auth/server.ts +355 -9
- package/templates/nextjs-standalone/src/lib/auth/simple-key.ts +3 -3
- package/templates/nextjs-standalone/src/lib/auth/types.ts +15 -21
- package/templates/nextjs-standalone/src/lib/billing/enforcement.ts +368 -0
- package/templates/nextjs-standalone/src/lib/billing/plans.ts +155 -0
- package/templates/nextjs-standalone/src/lib/cache/index.ts +92 -0
- package/templates/nextjs-standalone/src/lib/cache/keys.ts +30 -0
- package/templates/nextjs-standalone/src/lib/cache/lru.ts +79 -0
- package/templates/nextjs-standalone/src/lib/cache/types.ts +31 -0
- package/templates/nextjs-standalone/src/lib/compose-refs.ts +62 -0
- package/templates/nextjs-standalone/src/lib/config.ts +563 -11
- package/templates/nextjs-standalone/src/lib/connection-types.ts +9 -0
- package/templates/nextjs-standalone/src/lib/conversation-types.ts +1 -25
- package/templates/nextjs-standalone/src/lib/conversations.ts +345 -14
- package/templates/nextjs-standalone/src/lib/data-table.ts +61 -0
- package/templates/nextjs-standalone/src/lib/db/connection.ts +793 -39
- package/templates/nextjs-standalone/src/lib/db/internal.ts +985 -139
- package/templates/nextjs-standalone/src/lib/db/migrate.ts +295 -0
- package/templates/nextjs-standalone/src/lib/db/migrations/0000_baseline.sql +703 -0
- package/templates/nextjs-standalone/src/lib/db/migrations/0001_teams_installations.sql +14 -0
- package/templates/nextjs-standalone/src/lib/db/migrations/0002_discord_installations.sql +14 -0
- package/templates/nextjs-standalone/src/lib/db/migrations/0003_telegram_installations.sql +15 -0
- package/templates/nextjs-standalone/src/lib/db/migrations/0004_sandbox_credentials.sql +18 -0
- package/templates/nextjs-standalone/src/lib/db/migrations/0005_oauth_state.sql +16 -0
- package/templates/nextjs-standalone/src/lib/db/migrations/0006_byot_credentials.sql +14 -0
- package/templates/nextjs-standalone/src/lib/db/migrations/0007_gchat_installations.sql +15 -0
- package/templates/nextjs-standalone/src/lib/db/migrations/0008_github_installations.sql +14 -0
- package/templates/nextjs-standalone/src/lib/db/migrations/0009_linear_installations.sql +15 -0
- package/templates/nextjs-standalone/src/lib/db/migrations/0010_whatsapp_installations.sql +14 -0
- package/templates/nextjs-standalone/src/lib/db/migrations/0011_email_installations.sql +16 -0
- package/templates/nextjs-standalone/src/lib/db/migrations/0012_region_migrations.sql +25 -0
- package/templates/nextjs-standalone/src/lib/db/schema.ts +1120 -0
- package/templates/nextjs-standalone/src/lib/db/source-rate-limit.ts +89 -139
- package/templates/nextjs-standalone/src/lib/demo.ts +308 -0
- package/templates/nextjs-standalone/src/lib/discord/store.ts +225 -0
- package/templates/nextjs-standalone/src/lib/effect/ai.ts +243 -0
- package/templates/nextjs-standalone/src/lib/effect/errors.ts +234 -0
- package/templates/nextjs-standalone/src/lib/effect/hono.ts +454 -0
- package/templates/nextjs-standalone/src/lib/effect/index.ts +137 -0
- package/templates/nextjs-standalone/src/lib/effect/layers.ts +496 -0
- package/templates/nextjs-standalone/src/lib/effect/services.ts +776 -0
- package/templates/nextjs-standalone/src/lib/effect/sql.ts +178 -0
- package/templates/nextjs-standalone/src/lib/effect/toolkit.ts +123 -0
- package/templates/nextjs-standalone/src/lib/email/delivery.ts +232 -0
- package/templates/nextjs-standalone/src/lib/email/engine.ts +349 -0
- package/templates/nextjs-standalone/src/lib/email/hooks.ts +107 -0
- package/templates/nextjs-standalone/src/lib/email/index.ts +16 -0
- package/templates/nextjs-standalone/src/lib/email/scheduler.ts +72 -0
- package/templates/nextjs-standalone/src/lib/email/sequence.ts +73 -0
- package/templates/nextjs-standalone/src/lib/email/store.ts +163 -0
- package/templates/nextjs-standalone/src/lib/email/templates.ts +215 -0
- package/templates/nextjs-standalone/src/lib/format.test.ts +117 -0
- package/templates/nextjs-standalone/src/lib/format.ts +67 -0
- package/templates/nextjs-standalone/src/lib/gchat/store.ts +202 -0
- package/templates/nextjs-standalone/src/lib/github/store.ts +197 -0
- package/templates/nextjs-standalone/src/lib/id.ts +29 -0
- package/templates/nextjs-standalone/src/lib/integrations/types.ts +166 -0
- package/templates/nextjs-standalone/src/lib/learn/pattern-analyzer.ts +224 -0
- package/templates/nextjs-standalone/src/lib/learn/pattern-cache.ts +229 -0
- package/templates/nextjs-standalone/src/lib/learn/pattern-proposer.ts +87 -0
- package/templates/nextjs-standalone/src/lib/learn/suggestion-helpers.ts +34 -0
- package/templates/nextjs-standalone/src/lib/learn/suggestions.ts +139 -0
- package/templates/nextjs-standalone/src/lib/linear/store.ts +200 -0
- package/templates/nextjs-standalone/src/lib/logger.ts +35 -3
- package/templates/nextjs-standalone/src/lib/metering.ts +272 -0
- package/templates/nextjs-standalone/src/lib/parsers.ts +99 -0
- package/templates/nextjs-standalone/src/lib/plugins/hooks.ts +13 -11
- package/templates/nextjs-standalone/src/lib/plugins/index.ts +3 -1
- package/templates/nextjs-standalone/src/lib/plugins/registry.ts +58 -6
- package/templates/nextjs-standalone/src/lib/plugins/settings.ts +147 -0
- package/templates/nextjs-standalone/src/lib/plugins/wiring.ts +6 -9
- package/templates/nextjs-standalone/src/lib/profiler.ts +1665 -0
- package/templates/nextjs-standalone/src/lib/providers.ts +188 -13
- package/templates/nextjs-standalone/src/lib/rls.ts +172 -60
- package/templates/nextjs-standalone/src/lib/sandbox/credentials.ts +206 -0
- package/templates/nextjs-standalone/src/lib/sandbox/validate.ts +179 -0
- package/templates/nextjs-standalone/src/lib/scheduled-task-types.ts +26 -94
- package/templates/nextjs-standalone/src/lib/scheduled-tasks.ts +174 -34
- package/templates/nextjs-standalone/src/lib/scheduler/delivery.ts +248 -150
- package/templates/nextjs-standalone/src/lib/scheduler/engine.ts +190 -154
- package/templates/nextjs-standalone/src/lib/scheduler/executor.ts +74 -23
- package/templates/nextjs-standalone/src/lib/scheduler/preview.ts +72 -0
- package/templates/nextjs-standalone/src/lib/security/abuse.ts +463 -0
- package/templates/nextjs-standalone/src/lib/semantic/diff.ts +267 -0
- package/templates/nextjs-standalone/src/lib/semantic/entities.ts +167 -0
- package/templates/nextjs-standalone/src/lib/semantic/files.ts +283 -0
- package/templates/nextjs-standalone/src/lib/semantic/index.ts +27 -0
- package/templates/nextjs-standalone/src/lib/{semantic-index.ts → semantic/search.ts} +80 -9
- package/templates/nextjs-standalone/src/lib/semantic/sync.ts +581 -0
- package/templates/nextjs-standalone/src/lib/{semantic.ts → semantic/whitelist.ts} +189 -3
- package/templates/nextjs-standalone/src/lib/settings.ts +817 -0
- package/templates/nextjs-standalone/src/lib/sidecar-types.ts +13 -0
- package/templates/nextjs-standalone/src/lib/slack/store.ts +134 -25
- package/templates/nextjs-standalone/src/lib/startup.ts +528 -362
- package/templates/nextjs-standalone/src/lib/teams/store.ts +216 -0
- package/templates/nextjs-standalone/src/lib/telegram/store.ts +202 -0
- package/templates/nextjs-standalone/src/lib/telemetry.ts +40 -0
- package/templates/nextjs-standalone/src/lib/tools/actions/audit.ts +8 -5
- package/templates/nextjs-standalone/src/lib/tools/actions/email.ts +3 -1
- package/templates/nextjs-standalone/src/lib/tools/actions/handler.ts +276 -93
- package/templates/nextjs-standalone/src/lib/tools/actions/jira.ts +2 -2
- package/templates/nextjs-standalone/src/lib/tools/backends/detect.ts +16 -0
- package/templates/nextjs-standalone/src/lib/tools/backends/index.ts +11 -0
- package/templates/nextjs-standalone/src/lib/tools/backends/nsjail.ts +213 -0
- package/templates/nextjs-standalone/src/lib/tools/backends/shared.ts +103 -0
- package/templates/nextjs-standalone/src/lib/tools/backends/types.ts +26 -0
- package/templates/nextjs-standalone/src/lib/tools/explore-nsjail.ts +7 -228
- package/templates/nextjs-standalone/src/lib/tools/explore-sandbox.ts +4 -29
- package/templates/nextjs-standalone/src/lib/tools/explore-sidecar.ts +18 -2
- package/templates/nextjs-standalone/src/lib/tools/explore.ts +246 -54
- package/templates/nextjs-standalone/src/lib/tools/index.ts +17 -0
- package/templates/nextjs-standalone/src/lib/tools/python-nsjail.ts +11 -139
- package/templates/nextjs-standalone/src/lib/tools/python-sandbox.ts +9 -132
- package/templates/nextjs-standalone/src/lib/tools/python-sidecar.ts +184 -3
- package/templates/nextjs-standalone/src/lib/tools/python-stream.ts +33 -0
- package/templates/nextjs-standalone/src/lib/tools/python-wrapper.ts +129 -0
- package/templates/nextjs-standalone/src/lib/tools/python.ts +115 -15
- package/templates/nextjs-standalone/src/lib/tools/registry.ts +14 -2
- package/templates/nextjs-standalone/src/lib/tools/sql.ts +778 -362
- package/templates/nextjs-standalone/src/lib/tracing.ts +16 -0
- package/templates/nextjs-standalone/src/lib/whatsapp/store.ts +198 -0
- package/templates/nextjs-standalone/src/lib/workspace.ts +89 -0
- package/templates/nextjs-standalone/src/progress.ts +121 -0
- package/templates/nextjs-standalone/src/types/data-table.ts +48 -0
- package/templates/nextjs-standalone/src/ui/atlas-chat-reexport.ts +3 -0
- package/templates/nextjs-standalone/src/ui/components/actions/action-approval-card.tsx +26 -19
- package/templates/nextjs-standalone/src/ui/components/actions/action-status-badge.tsx +3 -3
- package/templates/nextjs-standalone/src/ui/components/admin/admin-layout.tsx +57 -39
- package/templates/nextjs-standalone/src/ui/components/admin/admin-sidebar.tsx +213 -35
- package/templates/nextjs-standalone/src/ui/components/admin/delivery-status-badge.tsx +53 -0
- package/templates/nextjs-standalone/src/ui/components/admin/empty-state.tsx +27 -6
- package/templates/nextjs-standalone/src/ui/components/admin/entity-detail.tsx +3 -52
- package/templates/nextjs-standalone/src/ui/components/admin/error-banner.tsx +2 -2
- package/templates/nextjs-standalone/src/ui/components/admin/feature-disabled.tsx +28 -5
- package/templates/nextjs-standalone/src/ui/components/admin-content-wrapper.tsx +87 -0
- package/templates/nextjs-standalone/src/ui/components/atlas-chat.tsx +449 -166
- package/templates/nextjs-standalone/src/ui/components/branding-head.tsx +41 -0
- package/templates/nextjs-standalone/src/ui/components/chart/chart-detection.ts +62 -5
- package/templates/nextjs-standalone/src/ui/components/chart/result-chart.tsx +316 -125
- package/templates/nextjs-standalone/src/ui/components/chat/api-key-bar.tsx +4 -4
- package/templates/nextjs-standalone/src/ui/components/chat/data-table.tsx +45 -4
- package/templates/nextjs-standalone/src/ui/components/chat/error-banner.tsx +86 -5
- package/templates/nextjs-standalone/src/ui/components/chat/follow-up-chips.tsx +29 -0
- package/templates/nextjs-standalone/src/ui/components/chat/markdown.tsx +24 -0
- package/templates/nextjs-standalone/src/ui/components/chat/prompt-library.tsx +206 -0
- package/templates/nextjs-standalone/src/ui/components/chat/python-result-card.tsx +106 -78
- package/templates/nextjs-standalone/src/ui/components/chat/result-card-base.tsx +101 -0
- package/templates/nextjs-standalone/src/ui/components/chat/share-dialog.tsx +377 -0
- package/templates/nextjs-standalone/src/ui/components/chat/sql-result-card.tsx +94 -73
- package/templates/nextjs-standalone/src/ui/components/chat/suggestion-chips.tsx +46 -0
- package/templates/nextjs-standalone/src/ui/components/chat/tool-part.tsx +16 -4
- package/templates/nextjs-standalone/src/ui/components/conversations/conversation-item.tsx +48 -17
- package/templates/nextjs-standalone/src/ui/components/conversations/conversation-list.tsx +38 -24
- package/templates/nextjs-standalone/src/ui/components/conversations/conversation-sidebar.tsx +66 -7
- package/templates/nextjs-standalone/src/ui/components/conversations/delete-confirmation.tsx +9 -2
- package/templates/nextjs-standalone/src/ui/components/error-boundary.tsx +66 -0
- package/templates/nextjs-standalone/src/ui/components/notebook/delete-cell-dialog.tsx +48 -0
- package/templates/nextjs-standalone/src/ui/components/notebook/fork-branch-selector.tsx +68 -0
- package/templates/nextjs-standalone/src/ui/components/notebook/notebook-cell-input.tsx +76 -0
- package/templates/nextjs-standalone/src/ui/components/notebook/notebook-cell-output.tsx +58 -0
- package/templates/nextjs-standalone/src/ui/components/notebook/notebook-cell-toolbar.tsx +91 -0
- package/templates/nextjs-standalone/src/ui/components/notebook/notebook-cell.tsx +119 -0
- package/templates/nextjs-standalone/src/ui/components/notebook/notebook-empty-state.tsx +19 -0
- package/templates/nextjs-standalone/src/ui/components/notebook/notebook-export.ts +287 -0
- package/templates/nextjs-standalone/src/ui/components/notebook/notebook-input-bar.tsx +49 -0
- package/templates/nextjs-standalone/src/ui/components/notebook/notebook-shell.tsx +266 -0
- package/templates/nextjs-standalone/src/ui/components/notebook/notebook-text-cell.tsx +152 -0
- package/templates/nextjs-standalone/src/ui/components/notebook/types.ts +39 -0
- package/templates/nextjs-standalone/src/ui/components/notebook/use-keyboard-nav.ts +109 -0
- package/templates/nextjs-standalone/src/ui/components/notebook/use-notebook.ts +684 -0
- package/templates/nextjs-standalone/src/ui/components/org-switcher.tsx +111 -0
- package/templates/nextjs-standalone/src/ui/components/region-picker.tsx +103 -0
- package/templates/nextjs-standalone/src/ui/components/schema-explorer/schema-explorer.tsx +522 -0
- package/templates/nextjs-standalone/src/ui/components/social-icons.tsx +26 -0
- package/templates/nextjs-standalone/src/ui/components/tour/guided-tour.tsx +81 -0
- package/templates/nextjs-standalone/src/ui/components/tour/index.ts +5 -0
- package/templates/nextjs-standalone/src/ui/components/tour/nav-bar.tsx +100 -0
- package/templates/nextjs-standalone/src/ui/components/tour/tour-overlay.tsx +298 -0
- package/templates/nextjs-standalone/src/ui/components/tour/tour-steps.ts +43 -0
- package/templates/nextjs-standalone/src/ui/components/tour/types.ts +21 -0
- package/templates/nextjs-standalone/src/ui/components/tour/use-tour.ts +193 -0
- package/templates/nextjs-standalone/src/ui/context-reexport.ts +3 -0
- package/templates/nextjs-standalone/src/ui/hooks/theme-init-script.ts +17 -0
- package/templates/nextjs-standalone/src/ui/hooks/use-admin-fetch.ts +38 -30
- package/templates/nextjs-standalone/src/ui/hooks/use-admin-mutation.ts +188 -0
- package/templates/nextjs-standalone/src/ui/hooks/use-atlas-transport.ts +225 -0
- package/templates/nextjs-standalone/src/ui/hooks/use-branding.ts +68 -0
- package/templates/nextjs-standalone/src/ui/hooks/use-conversations.ts +106 -83
- package/templates/nextjs-standalone/src/ui/hooks/use-dark-mode.ts +134 -10
- package/templates/nextjs-standalone/src/ui/hooks/use-deploy-mode.ts +36 -0
- package/templates/nextjs-standalone/src/ui/hooks/use-platform-admin-guard.ts +49 -0
- package/templates/nextjs-standalone/src/ui/lib/action-types.ts +11 -63
- package/templates/nextjs-standalone/src/ui/lib/admin-schemas.ts +744 -0
- package/templates/nextjs-standalone/src/ui/lib/fetch-client.ts +84 -0
- package/templates/nextjs-standalone/src/ui/lib/fetch-error.ts +54 -0
- package/templates/nextjs-standalone/src/ui/lib/helpers.ts +94 -1
- package/templates/nextjs-standalone/src/ui/lib/types.ts +149 -140
- package/templates/nextjs-standalone/tsconfig.json +3 -2
- package/templates/docker/src/api/__tests__/actions.test.ts +0 -683
- package/templates/docker/src/api/__tests__/admin.test.ts +0 -820
- package/templates/docker/src/api/__tests__/auth.test.ts +0 -165
- package/templates/docker/src/api/__tests__/chat.test.ts +0 -376
- package/templates/docker/src/api/__tests__/conversations.test.ts +0 -555
- package/templates/docker/src/api/__tests__/cors.test.ts +0 -135
- package/templates/docker/src/api/__tests__/health-plugin.test.ts +0 -176
- package/templates/docker/src/api/__tests__/health.test.ts +0 -283
- package/templates/docker/src/api/__tests__/query.test.ts +0 -891
- package/templates/docker/src/api/__tests__/scheduled-tasks.test.ts +0 -601
- package/templates/docker/src/api/__tests__/slack.test.ts +0 -847
- package/templates/docker/src/lib/__tests__/agent-cache.test.ts +0 -439
- package/templates/docker/src/lib/__tests__/agent-dialect.test.ts +0 -131
- package/templates/docker/src/lib/__tests__/agent-health-annotations.test.ts +0 -166
- package/templates/docker/src/lib/__tests__/agent-integration.test.ts +0 -516
- package/templates/docker/src/lib/__tests__/config-actions.test.ts +0 -166
- package/templates/docker/src/lib/__tests__/config.test.ts +0 -1113
- package/templates/docker/src/lib/__tests__/conversations.test.ts +0 -589
- package/templates/docker/src/lib/__tests__/errors.test.ts +0 -256
- package/templates/docker/src/lib/__tests__/logger.test.ts +0 -200
- package/templates/docker/src/lib/__tests__/plugin-aware-validation.test.ts +0 -321
- package/templates/docker/src/lib/__tests__/providers.test.ts +0 -130
- package/templates/docker/src/lib/__tests__/rls.test.ts +0 -435
- package/templates/docker/src/lib/__tests__/scheduled-task-types.test.ts +0 -124
- package/templates/docker/src/lib/__tests__/scheduled-tasks.test.ts +0 -550
- package/templates/docker/src/lib/__tests__/semantic-index.test.ts +0 -547
- package/templates/docker/src/lib/__tests__/semantic-multisource.test.ts +0 -544
- package/templates/docker/src/lib/__tests__/semantic.test.ts +0 -363
- package/templates/docker/src/lib/__tests__/startup-actions.test.ts +0 -461
- package/templates/docker/src/lib/__tests__/startup-first-run.test.ts +0 -429
- package/templates/docker/src/lib/__tests__/startup.test.ts +0 -470
- package/templates/docker/src/lib/__tests__/tracing.test.ts +0 -28
- package/templates/docker/src/lib/auth/__tests__/audit.test.ts +0 -418
- package/templates/docker/src/lib/auth/__tests__/byot-integration.test.ts +0 -222
- package/templates/docker/src/lib/auth/__tests__/byot.test.ts +0 -366
- package/templates/docker/src/lib/auth/__tests__/detect.test.ts +0 -190
- package/templates/docker/src/lib/auth/__tests__/managed.test.ts +0 -173
- package/templates/docker/src/lib/auth/__tests__/middleware.test.ts +0 -456
- package/templates/docker/src/lib/auth/__tests__/migrate.test.ts +0 -203
- package/templates/docker/src/lib/auth/__tests__/permissions.test.ts +0 -225
- package/templates/docker/src/lib/auth/__tests__/server.test.ts +0 -34
- package/templates/docker/src/lib/auth/__tests__/simple-key.test.ts +0 -176
- package/templates/docker/src/lib/auth/__tests__/types.test.ts +0 -44
- package/templates/docker/src/lib/db/__tests__/connection.test.ts +0 -144
- package/templates/docker/src/lib/db/__tests__/internal.test.ts +0 -387
- package/templates/docker/src/lib/db/__tests__/registry-health.test.ts +0 -190
- package/templates/docker/src/lib/db/__tests__/registry-pool-limits.test.ts +0 -137
- package/templates/docker/src/lib/db/__tests__/registry.test.ts +0 -398
- package/templates/docker/src/lib/db/__tests__/source-rate-limit.test.ts +0 -130
- package/templates/docker/src/lib/errors.ts +0 -154
- package/templates/docker/src/lib/plugins/__tests__/hooks-integration.test.ts +0 -204
- package/templates/docker/src/lib/plugins/__tests__/hooks.test.ts +0 -529
- package/templates/docker/src/lib/plugins/__tests__/migrate.test.ts +0 -875
- package/templates/docker/src/lib/plugins/__tests__/registry.test.ts +0 -373
- package/templates/docker/src/lib/plugins/__tests__/tools.test.ts +0 -49
- package/templates/docker/src/lib/plugins/__tests__/wiring.test.ts +0 -799
- package/templates/docker/src/lib/scheduler/__tests__/delivery.test.ts +0 -192
- package/templates/docker/src/lib/scheduler/__tests__/engine.test.ts +0 -248
- package/templates/docker/src/lib/scheduler/__tests__/format-email.test.ts +0 -96
- package/templates/docker/src/lib/scheduler/__tests__/format-slack.test.ts +0 -78
- package/templates/docker/src/lib/scheduler/__tests__/format-webhook.test.ts +0 -78
- package/templates/docker/src/lib/scheduler/index.ts +0 -7
- package/templates/docker/src/lib/slack/__tests__/api.test.ts +0 -160
- package/templates/docker/src/lib/slack/__tests__/format.test.ts +0 -237
- package/templates/docker/src/lib/slack/__tests__/store.test.ts +0 -188
- package/templates/docker/src/lib/slack/__tests__/threads.test.ts +0 -112
- package/templates/docker/src/lib/slack/__tests__/verify.test.ts +0 -111
- package/templates/docker/src/lib/tools/__tests__/action-permissions.test.ts +0 -594
- package/templates/docker/src/lib/tools/__tests__/custom-validation.test.ts +0 -240
- package/templates/docker/src/lib/tools/__tests__/explore-backend.test.ts +0 -267
- package/templates/docker/src/lib/tools/__tests__/explore-nsjail.test.ts +0 -506
- package/templates/docker/src/lib/tools/__tests__/explore-plugin.test.ts +0 -374
- package/templates/docker/src/lib/tools/__tests__/explore-sdk-compat.test.ts +0 -82
- package/templates/docker/src/lib/tools/__tests__/explore-sidecar.test.ts +0 -210
- package/templates/docker/src/lib/tools/__tests__/python-nsjail.test.ts +0 -515
- package/templates/docker/src/lib/tools/__tests__/python-sandbox.test.ts +0 -397
- package/templates/docker/src/lib/tools/__tests__/python-sidecar.test.ts +0 -365
- package/templates/docker/src/lib/tools/__tests__/python.test.ts +0 -331
- package/templates/docker/src/lib/tools/__tests__/registry-actions.test.ts +0 -132
- package/templates/docker/src/lib/tools/__tests__/registry.test.ts +0 -242
- package/templates/docker/src/lib/tools/__tests__/sql-audit.test.ts +0 -227
- package/templates/docker/src/lib/tools/__tests__/sql-connection-whitelist.test.ts +0 -100
- package/templates/docker/src/lib/tools/__tests__/sql-ratelimit.test.ts +0 -227
- package/templates/docker/src/lib/tools/__tests__/sql.test.ts +0 -709
- package/templates/docker/src/lib/tools/actions/__tests__/audit.test.ts +0 -211
- package/templates/docker/src/lib/tools/actions/__tests__/email.test.ts +0 -378
- package/templates/docker/src/lib/tools/actions/__tests__/handler.test.ts +0 -681
- package/templates/docker/src/lib/tools/actions/__tests__/jira.test.ts +0 -427
- package/templates/docker/src/test-setup.ts +0 -38
- package/templates/docker/src/types/vercel-sandbox.d.ts +0 -61
- package/templates/docker/src/ui/components/chat/managed-auth-card.tsx +0 -116
- package/templates/nextjs-standalone/src/api/__tests__/actions.test.ts +0 -683
- package/templates/nextjs-standalone/src/api/__tests__/admin.test.ts +0 -820
- package/templates/nextjs-standalone/src/api/__tests__/auth.test.ts +0 -165
- package/templates/nextjs-standalone/src/api/__tests__/chat.test.ts +0 -376
- package/templates/nextjs-standalone/src/api/__tests__/conversations.test.ts +0 -555
- package/templates/nextjs-standalone/src/api/__tests__/cors.test.ts +0 -135
- package/templates/nextjs-standalone/src/api/__tests__/health-plugin.test.ts +0 -176
- package/templates/nextjs-standalone/src/api/__tests__/health.test.ts +0 -283
- package/templates/nextjs-standalone/src/api/__tests__/query.test.ts +0 -891
- package/templates/nextjs-standalone/src/api/__tests__/scheduled-tasks.test.ts +0 -601
- package/templates/nextjs-standalone/src/api/__tests__/slack.test.ts +0 -847
- package/templates/nextjs-standalone/src/app/global-error.tsx +0 -68
- package/templates/nextjs-standalone/src/lib/__tests__/agent-cache.test.ts +0 -439
- package/templates/nextjs-standalone/src/lib/__tests__/agent-dialect.test.ts +0 -131
- package/templates/nextjs-standalone/src/lib/__tests__/agent-health-annotations.test.ts +0 -166
- package/templates/nextjs-standalone/src/lib/__tests__/agent-integration.test.ts +0 -516
- package/templates/nextjs-standalone/src/lib/__tests__/config-actions.test.ts +0 -166
- package/templates/nextjs-standalone/src/lib/__tests__/config.test.ts +0 -1113
- package/templates/nextjs-standalone/src/lib/__tests__/conversations.test.ts +0 -589
- package/templates/nextjs-standalone/src/lib/__tests__/errors.test.ts +0 -256
- package/templates/nextjs-standalone/src/lib/__tests__/logger.test.ts +0 -200
- package/templates/nextjs-standalone/src/lib/__tests__/plugin-aware-validation.test.ts +0 -321
- package/templates/nextjs-standalone/src/lib/__tests__/providers.test.ts +0 -130
- package/templates/nextjs-standalone/src/lib/__tests__/rls.test.ts +0 -435
- package/templates/nextjs-standalone/src/lib/__tests__/scheduled-task-types.test.ts +0 -124
- package/templates/nextjs-standalone/src/lib/__tests__/scheduled-tasks.test.ts +0 -550
- package/templates/nextjs-standalone/src/lib/__tests__/semantic-index.test.ts +0 -547
- package/templates/nextjs-standalone/src/lib/__tests__/semantic-multisource.test.ts +0 -544
- package/templates/nextjs-standalone/src/lib/__tests__/semantic.test.ts +0 -363
- package/templates/nextjs-standalone/src/lib/__tests__/startup-actions.test.ts +0 -461
- package/templates/nextjs-standalone/src/lib/__tests__/startup-first-run.test.ts +0 -429
- package/templates/nextjs-standalone/src/lib/__tests__/startup.test.ts +0 -470
- package/templates/nextjs-standalone/src/lib/__tests__/tracing.test.ts +0 -28
- package/templates/nextjs-standalone/src/lib/auth/__tests__/audit.test.ts +0 -418
- package/templates/nextjs-standalone/src/lib/auth/__tests__/byot-integration.test.ts +0 -222
- package/templates/nextjs-standalone/src/lib/auth/__tests__/byot.test.ts +0 -366
- package/templates/nextjs-standalone/src/lib/auth/__tests__/detect.test.ts +0 -190
- package/templates/nextjs-standalone/src/lib/auth/__tests__/managed.test.ts +0 -173
- package/templates/nextjs-standalone/src/lib/auth/__tests__/middleware.test.ts +0 -456
- package/templates/nextjs-standalone/src/lib/auth/__tests__/migrate.test.ts +0 -203
- package/templates/nextjs-standalone/src/lib/auth/__tests__/permissions.test.ts +0 -225
- package/templates/nextjs-standalone/src/lib/auth/__tests__/server.test.ts +0 -34
- package/templates/nextjs-standalone/src/lib/auth/__tests__/simple-key.test.ts +0 -176
- package/templates/nextjs-standalone/src/lib/auth/__tests__/types.test.ts +0 -44
- package/templates/nextjs-standalone/src/lib/db/__tests__/connection.test.ts +0 -144
- package/templates/nextjs-standalone/src/lib/db/__tests__/internal.test.ts +0 -387
- package/templates/nextjs-standalone/src/lib/db/__tests__/registry-health.test.ts +0 -190
- package/templates/nextjs-standalone/src/lib/db/__tests__/registry-pool-limits.test.ts +0 -137
- package/templates/nextjs-standalone/src/lib/db/__tests__/registry.test.ts +0 -398
- package/templates/nextjs-standalone/src/lib/db/__tests__/source-rate-limit.test.ts +0 -130
- package/templates/nextjs-standalone/src/lib/errors.ts +0 -154
- package/templates/nextjs-standalone/src/lib/plugins/__tests__/hooks-integration.test.ts +0 -204
- package/templates/nextjs-standalone/src/lib/plugins/__tests__/hooks.test.ts +0 -529
- package/templates/nextjs-standalone/src/lib/plugins/__tests__/migrate.test.ts +0 -875
- package/templates/nextjs-standalone/src/lib/plugins/__tests__/registry.test.ts +0 -373
- package/templates/nextjs-standalone/src/lib/plugins/__tests__/tools.test.ts +0 -49
- package/templates/nextjs-standalone/src/lib/plugins/__tests__/wiring.test.ts +0 -799
- package/templates/nextjs-standalone/src/lib/scheduler/__tests__/delivery.test.ts +0 -192
- package/templates/nextjs-standalone/src/lib/scheduler/__tests__/engine.test.ts +0 -248
- package/templates/nextjs-standalone/src/lib/scheduler/__tests__/format-email.test.ts +0 -96
- package/templates/nextjs-standalone/src/lib/scheduler/__tests__/format-slack.test.ts +0 -78
- package/templates/nextjs-standalone/src/lib/scheduler/__tests__/format-webhook.test.ts +0 -78
- package/templates/nextjs-standalone/src/lib/scheduler/index.ts +0 -7
- package/templates/nextjs-standalone/src/lib/slack/__tests__/api.test.ts +0 -160
- package/templates/nextjs-standalone/src/lib/slack/__tests__/format.test.ts +0 -237
- package/templates/nextjs-standalone/src/lib/slack/__tests__/store.test.ts +0 -188
- package/templates/nextjs-standalone/src/lib/slack/__tests__/threads.test.ts +0 -112
- package/templates/nextjs-standalone/src/lib/slack/__tests__/verify.test.ts +0 -111
- package/templates/nextjs-standalone/src/lib/tools/__tests__/action-permissions.test.ts +0 -594
- package/templates/nextjs-standalone/src/lib/tools/__tests__/custom-validation.test.ts +0 -240
- package/templates/nextjs-standalone/src/lib/tools/__tests__/explore-backend.test.ts +0 -267
- package/templates/nextjs-standalone/src/lib/tools/__tests__/explore-nsjail.test.ts +0 -506
- package/templates/nextjs-standalone/src/lib/tools/__tests__/explore-plugin.test.ts +0 -374
- package/templates/nextjs-standalone/src/lib/tools/__tests__/explore-sdk-compat.test.ts +0 -82
- package/templates/nextjs-standalone/src/lib/tools/__tests__/explore-sidecar.test.ts +0 -210
- package/templates/nextjs-standalone/src/lib/tools/__tests__/python-nsjail.test.ts +0 -515
- package/templates/nextjs-standalone/src/lib/tools/__tests__/python-sandbox.test.ts +0 -397
- package/templates/nextjs-standalone/src/lib/tools/__tests__/python-sidecar.test.ts +0 -365
- package/templates/nextjs-standalone/src/lib/tools/__tests__/python.test.ts +0 -331
- package/templates/nextjs-standalone/src/lib/tools/__tests__/registry-actions.test.ts +0 -132
- package/templates/nextjs-standalone/src/lib/tools/__tests__/registry.test.ts +0 -242
- package/templates/nextjs-standalone/src/lib/tools/__tests__/sql-audit.test.ts +0 -227
- package/templates/nextjs-standalone/src/lib/tools/__tests__/sql-connection-whitelist.test.ts +0 -100
- package/templates/nextjs-standalone/src/lib/tools/__tests__/sql-ratelimit.test.ts +0 -227
- package/templates/nextjs-standalone/src/lib/tools/__tests__/sql.test.ts +0 -709
- package/templates/nextjs-standalone/src/lib/tools/actions/__tests__/audit.test.ts +0 -211
- package/templates/nextjs-standalone/src/lib/tools/actions/__tests__/email.test.ts +0 -378
- package/templates/nextjs-standalone/src/lib/tools/actions/__tests__/handler.test.ts +0 -681
- package/templates/nextjs-standalone/src/lib/tools/actions/__tests__/jira.test.ts +0 -427
- package/templates/nextjs-standalone/src/test-setup.ts +0 -38
- package/templates/nextjs-standalone/src/ui/components/chat/managed-auth-card.tsx +0 -116
|
@@ -1,1645 +1,232 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* OpenAPI
|
|
2
|
+
* Static OpenAPI path entries for routes that are NOT on OpenAPIHono.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Auth routes are proxied to Better Auth (dynamic, not schema-driven).
|
|
5
|
+
* Widget routes serve static assets (HTML/JS/CSS/TS declarations).
|
|
6
|
+
*
|
|
7
|
+
* These entries are merged into the auto-generated spec in index.ts.
|
|
6
8
|
*/
|
|
7
9
|
|
|
8
|
-
import { Hono } from "hono";
|
|
9
10
|
import { z } from "zod";
|
|
10
|
-
import { QueryRequestSchema, QueryResponseSchema } from "./query";
|
|
11
|
-
import { ChatRequestSchema } from "./chat";
|
|
12
|
-
import {
|
|
13
|
-
ConversationWithMessagesSchema,
|
|
14
|
-
ListConversationsResponseSchema,
|
|
15
|
-
StarConversationBodySchema,
|
|
16
|
-
} from "./conversations";
|
|
17
|
-
import { HealthResponseSchema } from "./health";
|
|
18
|
-
|
|
19
|
-
const openapi = new Hono();
|
|
20
11
|
|
|
21
12
|
function toJsonSchema(schema: z.ZodType): Record<string, unknown> {
|
|
22
13
|
return z.toJSONSchema(schema) as Record<string, unknown>;
|
|
23
14
|
}
|
|
24
15
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
const ErrorSchema = z.object({
|
|
17
|
+
error: z.string(),
|
|
18
|
+
message: z.string(),
|
|
19
|
+
});
|
|
28
20
|
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
const errorResponse = (
|
|
22
|
+
description: string,
|
|
23
|
+
schema: z.ZodType = ErrorSchema,
|
|
24
|
+
) => ({
|
|
32
25
|
description,
|
|
33
|
-
|
|
34
|
-
schema: { type: "string", format: "uuid" },
|
|
26
|
+
content: { "application/json": { schema: toJsonSchema(schema) } },
|
|
35
27
|
});
|
|
36
28
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
maximum: defaults?.maxLimit ?? 100,
|
|
47
|
-
default: defaults?.limit ?? 20,
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: "offset",
|
|
52
|
-
in: "query" as const,
|
|
53
|
-
description: "Number of items to skip (default 0).",
|
|
54
|
-
required: false,
|
|
55
|
-
schema: { type: "integer", minimum: 0, default: 0 },
|
|
56
|
-
},
|
|
57
|
-
];
|
|
58
|
-
|
|
59
|
-
function buildSpec(): Record<string, unknown> {
|
|
60
|
-
const ErrorSchema = z.object({
|
|
61
|
-
error: z.string(),
|
|
62
|
-
message: z.string(),
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
const ValidationErrorSchema = z.object({
|
|
66
|
-
error: z.literal("validation_error"),
|
|
67
|
-
message: z.string(),
|
|
68
|
-
details: z.array(z.unknown()),
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
const RateLimitErrorSchema = ErrorSchema.extend({
|
|
72
|
-
retryAfterSeconds: z.number().int(),
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
const errorResponse = (
|
|
76
|
-
description: string,
|
|
77
|
-
schema: z.ZodType = ErrorSchema,
|
|
78
|
-
) => ({
|
|
79
|
-
description,
|
|
80
|
-
content: { "application/json": { schema: toJsonSchema(schema) } },
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
// Common error responses shared across most routes
|
|
84
|
-
const authErrors = {
|
|
85
|
-
"401": errorResponse("Authentication required"),
|
|
86
|
-
"403": errorResponse("Forbidden — insufficient permissions"),
|
|
87
|
-
"429": errorResponse("Rate limit exceeded", RateLimitErrorSchema),
|
|
88
|
-
"500": errorResponse("Internal server error"),
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
return {
|
|
92
|
-
openapi: "3.1.0",
|
|
93
|
-
info: {
|
|
94
|
-
title: "Atlas API",
|
|
95
|
-
version: "0.1.0",
|
|
29
|
+
/** Static path entries for auth and widget routes. */
|
|
30
|
+
export const staticPaths: Record<string, unknown> = {
|
|
31
|
+
// -------------------------------------------------------------------
|
|
32
|
+
// Auth — Better Auth routes (key endpoints)
|
|
33
|
+
// -------------------------------------------------------------------
|
|
34
|
+
"/api/auth/sign-up/email": {
|
|
35
|
+
post: {
|
|
36
|
+
operationId: "signUpEmail",
|
|
37
|
+
summary: "Sign up with email",
|
|
96
38
|
description:
|
|
97
|
-
"
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// -----------------------------------------------------------------
|
|
111
|
-
// POST /api/chat — Streaming chat (SSE)
|
|
112
|
-
// -----------------------------------------------------------------
|
|
113
|
-
"/api/chat": {
|
|
114
|
-
post: {
|
|
115
|
-
operationId: "chatStream",
|
|
116
|
-
summary: "Chat with the agent (streaming)",
|
|
117
|
-
description:
|
|
118
|
-
"Sends a conversation to the Atlas agent and streams the response as Server-Sent Events using the Vercel AI SDK UI message stream protocol. " +
|
|
119
|
-
"Each SSE event is a JSON object with a 'type' field: 'text-delta' for incremental text, 'tool-call' for tool invocations, " +
|
|
120
|
-
"'tool-result' for tool outputs, 'step-start' for new agent steps, and 'finish' for completion. " +
|
|
121
|
-
"The response includes an `x-conversation-id` header when conversation persistence is enabled.",
|
|
122
|
-
tags: ["Chat"],
|
|
123
|
-
security: [{ bearerAuth: [] }, {}],
|
|
124
|
-
requestBody: {
|
|
125
|
-
required: true,
|
|
126
|
-
content: {
|
|
127
|
-
"application/json": {
|
|
128
|
-
schema: toJsonSchema(ChatRequestSchema),
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
responses: {
|
|
133
|
-
"200": {
|
|
134
|
-
description:
|
|
135
|
-
"Streaming response. The body is a text/event-stream following the Vercel AI SDK data stream protocol.",
|
|
136
|
-
headers: {
|
|
137
|
-
"x-conversation-id": {
|
|
138
|
-
description:
|
|
139
|
-
"Present when conversation persistence is active and the conversation was successfully created or located.",
|
|
140
|
-
schema: { type: "string", format: "uuid" },
|
|
141
|
-
required: false,
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
content: {
|
|
145
|
-
"text/event-stream": {
|
|
146
|
-
schema: {
|
|
147
|
-
type: "string",
|
|
148
|
-
description:
|
|
149
|
-
"SSE stream using the Vercel AI SDK UI message stream protocol. Each event is a JSON object with a 'type' field (text-delta, tool-call, tool-result, step-start, finish).",
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
"400": errorResponse(
|
|
155
|
-
"Bad request (malformed JSON, missing datasource, or invalid conversationId)",
|
|
156
|
-
),
|
|
157
|
-
"401": errorResponse("Authentication required"),
|
|
158
|
-
"403": errorResponse("Forbidden — insufficient permissions"),
|
|
159
|
-
"404": errorResponse(
|
|
160
|
-
"Conversation not found (invalid conversationId)",
|
|
161
|
-
),
|
|
162
|
-
"422": errorResponse(
|
|
163
|
-
"Validation error (invalid request body)",
|
|
164
|
-
ValidationErrorSchema,
|
|
165
|
-
),
|
|
166
|
-
"429": errorResponse(
|
|
167
|
-
"Rate limit exceeded",
|
|
168
|
-
RateLimitErrorSchema,
|
|
169
|
-
),
|
|
170
|
-
"500": errorResponse("Internal server error"),
|
|
171
|
-
"502": errorResponse("LLM provider error"),
|
|
172
|
-
"503": errorResponse(
|
|
173
|
-
"Provider unreachable, auth error, or rate limited",
|
|
174
|
-
),
|
|
175
|
-
"504": errorResponse("Request timed out"),
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
|
|
180
|
-
// -----------------------------------------------------------------
|
|
181
|
-
// POST /api/v1/query — Synchronous JSON query
|
|
182
|
-
// -----------------------------------------------------------------
|
|
183
|
-
"/api/v1/query": {
|
|
184
|
-
post: {
|
|
185
|
-
operationId: "query",
|
|
186
|
-
summary: "Ask a question",
|
|
187
|
-
description:
|
|
188
|
-
"Runs the Atlas agent to completion and returns a structured JSON response with the answer, SQL queries executed, result data, step count, and token usage.",
|
|
189
|
-
tags: ["Query"],
|
|
190
|
-
security: [{ bearerAuth: [] }, {}],
|
|
191
|
-
requestBody: {
|
|
192
|
-
required: true,
|
|
193
|
-
content: {
|
|
194
|
-
"application/json": {
|
|
195
|
-
schema: toJsonSchema(QueryRequestSchema),
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
responses: {
|
|
200
|
-
"200": {
|
|
201
|
-
description: "Successful query response",
|
|
202
|
-
content: {
|
|
203
|
-
"application/json": {
|
|
204
|
-
schema: toJsonSchema(QueryResponseSchema),
|
|
205
|
-
},
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
"400": errorResponse(
|
|
209
|
-
"Bad request (malformed JSON or missing datasource)",
|
|
210
|
-
),
|
|
211
|
-
"401": errorResponse("Authentication required"),
|
|
212
|
-
"403": errorResponse("Forbidden — insufficient permissions"),
|
|
213
|
-
"422": errorResponse(
|
|
214
|
-
"Validation error (invalid request body)",
|
|
215
|
-
ValidationErrorSchema,
|
|
216
|
-
),
|
|
217
|
-
"429": errorResponse(
|
|
218
|
-
"Rate limit exceeded",
|
|
219
|
-
RateLimitErrorSchema,
|
|
220
|
-
),
|
|
221
|
-
"500": errorResponse("Internal server error"),
|
|
222
|
-
"502": errorResponse("LLM provider error"),
|
|
223
|
-
"503": errorResponse(
|
|
224
|
-
"Provider unreachable, auth error, or rate limited",
|
|
225
|
-
),
|
|
226
|
-
"504": errorResponse("Request timed out"),
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
},
|
|
230
|
-
|
|
231
|
-
// -----------------------------------------------------------------
|
|
232
|
-
// GET /api/v1/conversations — List conversations
|
|
233
|
-
// -----------------------------------------------------------------
|
|
234
|
-
"/api/v1/conversations": {
|
|
235
|
-
get: {
|
|
236
|
-
operationId: "listConversations",
|
|
237
|
-
summary: "List conversations",
|
|
238
|
-
description:
|
|
239
|
-
"Returns a paginated list of conversations for the authenticated user. Requires an internal database (DATABASE_URL).",
|
|
240
|
-
tags: ["Conversations"],
|
|
241
|
-
security: [{ bearerAuth: [] }, {}],
|
|
242
|
-
parameters: [
|
|
243
|
-
...paginationParams(),
|
|
244
|
-
{
|
|
245
|
-
name: "starred",
|
|
246
|
-
in: "query",
|
|
247
|
-
description: "Filter by starred status.",
|
|
248
|
-
required: false,
|
|
249
|
-
schema: { type: "boolean" },
|
|
250
|
-
},
|
|
251
|
-
],
|
|
252
|
-
responses: {
|
|
253
|
-
"200": {
|
|
254
|
-
description: "Paginated list of conversations",
|
|
255
|
-
content: {
|
|
256
|
-
"application/json": {
|
|
257
|
-
schema: toJsonSchema(ListConversationsResponseSchema),
|
|
258
|
-
},
|
|
259
|
-
},
|
|
260
|
-
},
|
|
261
|
-
...authErrors,
|
|
262
|
-
"404": errorResponse(
|
|
263
|
-
"Not available (no internal database configured)",
|
|
264
|
-
),
|
|
265
|
-
},
|
|
266
|
-
},
|
|
267
|
-
},
|
|
268
|
-
|
|
269
|
-
// -----------------------------------------------------------------
|
|
270
|
-
// GET/DELETE /api/v1/conversations/{id}
|
|
271
|
-
// -----------------------------------------------------------------
|
|
272
|
-
"/api/v1/conversations/{id}": {
|
|
273
|
-
get: {
|
|
274
|
-
operationId: "getConversation",
|
|
275
|
-
summary: "Get conversation with messages",
|
|
276
|
-
description:
|
|
277
|
-
"Returns a single conversation with all its messages. Enforces ownership when auth is enabled.",
|
|
278
|
-
tags: ["Conversations"],
|
|
279
|
-
security: [{ bearerAuth: [] }, {}],
|
|
280
|
-
parameters: [
|
|
281
|
-
uuidPathParam("id", "Conversation UUID."),
|
|
282
|
-
],
|
|
283
|
-
responses: {
|
|
284
|
-
"200": {
|
|
285
|
-
description: "Conversation with messages",
|
|
286
|
-
content: {
|
|
287
|
-
"application/json": {
|
|
288
|
-
schema: toJsonSchema(ConversationWithMessagesSchema),
|
|
289
|
-
},
|
|
290
|
-
},
|
|
291
|
-
},
|
|
292
|
-
"400": errorResponse("Invalid conversation ID format"),
|
|
293
|
-
...authErrors,
|
|
294
|
-
"404": errorResponse(
|
|
295
|
-
"Conversation not found or not available",
|
|
296
|
-
),
|
|
297
|
-
},
|
|
298
|
-
},
|
|
299
|
-
delete: {
|
|
300
|
-
operationId: "deleteConversation",
|
|
301
|
-
summary: "Delete a conversation",
|
|
302
|
-
description:
|
|
303
|
-
"Deletes a conversation and all its messages. Enforces ownership when auth is enabled.",
|
|
304
|
-
tags: ["Conversations"],
|
|
305
|
-
security: [{ bearerAuth: [] }, {}],
|
|
306
|
-
parameters: [
|
|
307
|
-
uuidPathParam("id", "Conversation UUID."),
|
|
308
|
-
],
|
|
309
|
-
responses: {
|
|
310
|
-
"204": {
|
|
311
|
-
description: "Conversation deleted successfully",
|
|
312
|
-
},
|
|
313
|
-
"400": errorResponse("Invalid conversation ID format"),
|
|
314
|
-
...authErrors,
|
|
315
|
-
"404": errorResponse(
|
|
316
|
-
"Conversation not found or not available",
|
|
317
|
-
),
|
|
318
|
-
},
|
|
319
|
-
},
|
|
320
|
-
},
|
|
321
|
-
|
|
322
|
-
// -----------------------------------------------------------------
|
|
323
|
-
// PATCH /api/v1/conversations/{id}/star
|
|
324
|
-
// -----------------------------------------------------------------
|
|
325
|
-
"/api/v1/conversations/{id}/star": {
|
|
326
|
-
patch: {
|
|
327
|
-
operationId: "starConversation",
|
|
328
|
-
summary: "Star or unstar a conversation",
|
|
329
|
-
description: "Sets the starred status of a conversation.",
|
|
330
|
-
tags: ["Conversations"],
|
|
331
|
-
security: [{ bearerAuth: [] }, {}],
|
|
332
|
-
parameters: [
|
|
333
|
-
uuidPathParam("id", "Conversation UUID."),
|
|
334
|
-
],
|
|
335
|
-
requestBody: {
|
|
336
|
-
required: true,
|
|
337
|
-
content: {
|
|
338
|
-
"application/json": {
|
|
339
|
-
schema: toJsonSchema(StarConversationBodySchema),
|
|
340
|
-
},
|
|
341
|
-
},
|
|
342
|
-
},
|
|
343
|
-
responses: {
|
|
344
|
-
"200": {
|
|
345
|
-
description: "Star status updated",
|
|
346
|
-
content: {
|
|
347
|
-
"application/json": {
|
|
348
|
-
schema: {
|
|
349
|
-
type: "object",
|
|
350
|
-
properties: {
|
|
351
|
-
id: { type: "string", format: "uuid" },
|
|
352
|
-
starred: { type: "boolean" },
|
|
353
|
-
},
|
|
354
|
-
},
|
|
355
|
-
},
|
|
356
|
-
},
|
|
357
|
-
},
|
|
358
|
-
"400": errorResponse("Invalid conversation ID or request body"),
|
|
359
|
-
...authErrors,
|
|
360
|
-
"404": errorResponse("Conversation not found or not available"),
|
|
361
|
-
},
|
|
362
|
-
},
|
|
363
|
-
},
|
|
364
|
-
|
|
365
|
-
// -----------------------------------------------------------------
|
|
366
|
-
// GET /api/health — Health check
|
|
367
|
-
// -----------------------------------------------------------------
|
|
368
|
-
"/api/health": {
|
|
369
|
-
get: {
|
|
370
|
-
operationId: "healthCheck",
|
|
371
|
-
summary: "Health check",
|
|
372
|
-
description:
|
|
373
|
-
"Returns the health status of the Atlas API including checks for datasource connectivity, LLM provider, semantic layer, internal database, explore backend, auth mode, and Slack integration. " +
|
|
374
|
-
"Returns HTTP 200 for 'ok' or 'degraded' status, and 503 for 'error' status.",
|
|
375
|
-
tags: ["Health"],
|
|
376
|
-
security: [],
|
|
377
|
-
responses: {
|
|
378
|
-
"200": {
|
|
379
|
-
description:
|
|
380
|
-
"Service is healthy or degraded (some optional components unavailable)",
|
|
381
|
-
content: {
|
|
382
|
-
"application/json": {
|
|
383
|
-
schema: toJsonSchema(HealthResponseSchema),
|
|
384
|
-
},
|
|
385
|
-
},
|
|
386
|
-
},
|
|
387
|
-
"503": {
|
|
388
|
-
description: "Service is unhealthy (critical component failure)",
|
|
389
|
-
content: {
|
|
390
|
-
"application/json": {
|
|
391
|
-
schema: {
|
|
392
|
-
oneOf: [
|
|
393
|
-
toJsonSchema(HealthResponseSchema),
|
|
394
|
-
toJsonSchema(
|
|
395
|
-
z.object({
|
|
396
|
-
status: z.literal("error"),
|
|
397
|
-
error: z.string(),
|
|
398
|
-
}),
|
|
399
|
-
),
|
|
400
|
-
],
|
|
401
|
-
},
|
|
402
|
-
},
|
|
403
|
-
},
|
|
404
|
-
},
|
|
405
|
-
},
|
|
406
|
-
},
|
|
407
|
-
},
|
|
408
|
-
|
|
409
|
-
// -----------------------------------------------------------------
|
|
410
|
-
// Actions — approval-gated write operations
|
|
411
|
-
// -----------------------------------------------------------------
|
|
412
|
-
"/api/v1/actions": {
|
|
413
|
-
get: {
|
|
414
|
-
operationId: "listActions",
|
|
415
|
-
summary: "List actions",
|
|
416
|
-
description:
|
|
417
|
-
"Returns actions filtered by status. Requires ATLAS_ACTIONS_ENABLED=true and an internal database.",
|
|
418
|
-
tags: ["Actions"],
|
|
419
|
-
security: [{ bearerAuth: [] }, {}],
|
|
420
|
-
parameters: [
|
|
421
|
-
{
|
|
422
|
-
name: "status",
|
|
423
|
-
in: "query",
|
|
424
|
-
description: "Filter by action status (default: pending).",
|
|
425
|
-
required: false,
|
|
426
|
-
schema: {
|
|
427
|
-
type: "string",
|
|
428
|
-
enum: ["pending", "approved", "denied", "executed", "failed", "timed_out", "auto_approved"],
|
|
429
|
-
default: "pending",
|
|
430
|
-
},
|
|
431
|
-
},
|
|
432
|
-
{
|
|
433
|
-
name: "limit",
|
|
434
|
-
in: "query",
|
|
435
|
-
description: "Maximum number of actions to return (1-100, default 50).",
|
|
436
|
-
required: false,
|
|
437
|
-
schema: { type: "integer", minimum: 1, maximum: 100, default: 50 },
|
|
438
|
-
},
|
|
439
|
-
],
|
|
440
|
-
responses: {
|
|
441
|
-
"200": {
|
|
442
|
-
description: "List of actions",
|
|
443
|
-
content: {
|
|
444
|
-
"application/json": {
|
|
445
|
-
schema: {
|
|
446
|
-
type: "object",
|
|
447
|
-
properties: {
|
|
448
|
-
actions: {
|
|
449
|
-
type: "array",
|
|
450
|
-
items: {
|
|
451
|
-
type: "object",
|
|
452
|
-
properties: {
|
|
453
|
-
id: { type: "string", format: "uuid" },
|
|
454
|
-
action_type: { type: "string" },
|
|
455
|
-
target: { type: "string" },
|
|
456
|
-
summary: { type: "string" },
|
|
457
|
-
status: { type: "string", enum: ["pending", "approved", "denied", "executed", "failed", "timed_out", "auto_approved"] },
|
|
458
|
-
requested_by: { type: "string" },
|
|
459
|
-
created_at: { type: "string", format: "date-time" },
|
|
460
|
-
},
|
|
461
|
-
},
|
|
462
|
-
},
|
|
463
|
-
},
|
|
464
|
-
},
|
|
465
|
-
},
|
|
466
|
-
},
|
|
467
|
-
},
|
|
468
|
-
...authErrors,
|
|
469
|
-
"404": errorResponse("Actions not available (no internal database or feature disabled)"),
|
|
470
|
-
},
|
|
471
|
-
},
|
|
472
|
-
},
|
|
473
|
-
|
|
474
|
-
"/api/v1/actions/{id}": {
|
|
475
|
-
get: {
|
|
476
|
-
operationId: "getAction",
|
|
477
|
-
summary: "Get action by ID",
|
|
478
|
-
description: "Returns a single action. Only returns actions requested by the authenticated user.",
|
|
479
|
-
tags: ["Actions"],
|
|
480
|
-
security: [{ bearerAuth: [] }, {}],
|
|
481
|
-
parameters: [uuidPathParam("id", "Action UUID.")],
|
|
482
|
-
responses: {
|
|
483
|
-
"200": {
|
|
484
|
-
description: "Action details",
|
|
485
|
-
content: { "application/json": { schema: { type: "object" } } },
|
|
486
|
-
},
|
|
487
|
-
"400": errorResponse("Invalid action ID format"),
|
|
488
|
-
...authErrors,
|
|
489
|
-
"404": errorResponse("Action not found"),
|
|
490
|
-
},
|
|
491
|
-
},
|
|
492
|
-
},
|
|
493
|
-
|
|
494
|
-
"/api/v1/actions/{id}/approve": {
|
|
495
|
-
post: {
|
|
496
|
-
operationId: "approveAction",
|
|
497
|
-
summary: "Approve a pending action",
|
|
498
|
-
description:
|
|
499
|
-
"Approves a pending action and triggers execution. Returns the updated action with results. " +
|
|
500
|
-
"For admin-only approval mode, the requester cannot approve their own action (separation of duties).",
|
|
501
|
-
tags: ["Actions"],
|
|
502
|
-
security: [{ bearerAuth: [] }],
|
|
503
|
-
parameters: [uuidPathParam("id", "Action UUID.")],
|
|
504
|
-
responses: {
|
|
505
|
-
"200": {
|
|
506
|
-
description: "Action approved and execution result",
|
|
507
|
-
content: { "application/json": { schema: { type: "object" } } },
|
|
508
|
-
},
|
|
509
|
-
"400": errorResponse("Invalid action ID format"),
|
|
510
|
-
...authErrors,
|
|
511
|
-
"404": errorResponse("Action not found"),
|
|
512
|
-
"409": errorResponse("Action has already been resolved"),
|
|
513
|
-
},
|
|
514
|
-
},
|
|
515
|
-
},
|
|
516
|
-
|
|
517
|
-
"/api/v1/actions/{id}/deny": {
|
|
518
|
-
post: {
|
|
519
|
-
operationId: "denyAction",
|
|
520
|
-
summary: "Deny a pending action",
|
|
521
|
-
description:
|
|
522
|
-
"Denies a pending action. Optionally provide a reason in the request body. " +
|
|
523
|
-
"For admin-only approval mode, the requester cannot deny their own action.",
|
|
524
|
-
tags: ["Actions"],
|
|
525
|
-
security: [{ bearerAuth: [] }],
|
|
526
|
-
parameters: [uuidPathParam("id", "Action UUID.")],
|
|
527
|
-
requestBody: {
|
|
528
|
-
required: false,
|
|
529
|
-
content: {
|
|
530
|
-
"application/json": {
|
|
531
|
-
schema: {
|
|
532
|
-
type: "object",
|
|
533
|
-
properties: {
|
|
534
|
-
reason: { type: "string", description: "Optional denial reason." },
|
|
535
|
-
},
|
|
536
|
-
},
|
|
537
|
-
},
|
|
538
|
-
},
|
|
539
|
-
},
|
|
540
|
-
responses: {
|
|
541
|
-
"200": {
|
|
542
|
-
description: "Action denied",
|
|
543
|
-
content: { "application/json": { schema: { type: "object" } } },
|
|
544
|
-
},
|
|
545
|
-
"400": errorResponse("Invalid action ID or request body"),
|
|
546
|
-
...authErrors,
|
|
547
|
-
"404": errorResponse("Action not found"),
|
|
548
|
-
"409": errorResponse("Action has already been resolved"),
|
|
549
|
-
},
|
|
550
|
-
},
|
|
551
|
-
},
|
|
552
|
-
|
|
553
|
-
// -----------------------------------------------------------------
|
|
554
|
-
// Scheduled Tasks
|
|
555
|
-
// -----------------------------------------------------------------
|
|
556
|
-
"/api/v1/scheduled-tasks": {
|
|
557
|
-
get: {
|
|
558
|
-
operationId: "listScheduledTasks",
|
|
559
|
-
summary: "List scheduled tasks",
|
|
560
|
-
description:
|
|
561
|
-
"Returns scheduled tasks owned by the authenticated user. Requires ATLAS_SCHEDULER_ENABLED=true and an internal database.",
|
|
562
|
-
tags: ["Scheduled Tasks"],
|
|
563
|
-
security: [{ bearerAuth: [] }, {}],
|
|
564
|
-
parameters: [
|
|
565
|
-
...paginationParams(),
|
|
566
|
-
{
|
|
567
|
-
name: "enabled",
|
|
568
|
-
in: "query",
|
|
569
|
-
description: "Filter by enabled status.",
|
|
570
|
-
required: false,
|
|
571
|
-
schema: { type: "boolean" },
|
|
572
|
-
},
|
|
573
|
-
],
|
|
574
|
-
responses: {
|
|
575
|
-
"200": {
|
|
576
|
-
description: "Paginated list of scheduled tasks",
|
|
577
|
-
content: { "application/json": { schema: { type: "object" } } },
|
|
578
|
-
},
|
|
579
|
-
...authErrors,
|
|
580
|
-
"404": errorResponse("Scheduled tasks not available (no internal database or feature disabled)"),
|
|
581
|
-
},
|
|
582
|
-
},
|
|
583
|
-
post: {
|
|
584
|
-
operationId: "createScheduledTask",
|
|
585
|
-
summary: "Create a scheduled task",
|
|
586
|
-
description:
|
|
587
|
-
"Creates a recurring query task with a cron schedule and delivery channel.",
|
|
588
|
-
tags: ["Scheduled Tasks"],
|
|
589
|
-
security: [{ bearerAuth: [] }],
|
|
590
|
-
requestBody: {
|
|
591
|
-
required: true,
|
|
592
|
-
content: {
|
|
593
|
-
"application/json": {
|
|
594
|
-
schema: {
|
|
595
|
-
type: "object",
|
|
596
|
-
required: ["name", "question", "cronExpression"],
|
|
597
|
-
properties: {
|
|
598
|
-
name: { type: "string", minLength: 1, maxLength: 200, description: "Task name." },
|
|
599
|
-
question: { type: "string", minLength: 1, maxLength: 2000, description: "Natural language question." },
|
|
600
|
-
cronExpression: { type: "string", description: "Cron schedule (e.g. '0 9 * * *')." },
|
|
601
|
-
deliveryChannel: { type: "string", enum: ["email", "slack", "webhook"], default: "webhook", description: "Delivery channel." },
|
|
602
|
-
recipients: {
|
|
603
|
-
type: "array",
|
|
604
|
-
description: "Delivery targets.",
|
|
605
|
-
items: {
|
|
606
|
-
type: "object",
|
|
607
|
-
properties: {
|
|
608
|
-
type: { type: "string", enum: ["email", "slack", "webhook"] },
|
|
609
|
-
address: { type: "string", description: "Email address (for email type)." },
|
|
610
|
-
channel: { type: "string", description: "Slack channel (for slack type)." },
|
|
611
|
-
teamId: { type: "string", description: "Slack team ID (for slack type)." },
|
|
612
|
-
url: { type: "string", description: "Webhook URL (for webhook type)." },
|
|
613
|
-
headers: { type: "object", additionalProperties: { type: "string" }, description: "Custom headers (for webhook type)." },
|
|
614
|
-
},
|
|
615
|
-
},
|
|
616
|
-
},
|
|
617
|
-
connectionId: { type: "string", nullable: true, description: "Target datasource connection." },
|
|
618
|
-
approvalMode: { type: "string", enum: ["auto", "manual", "admin-only"], default: "auto", description: "Action approval mode." },
|
|
619
|
-
},
|
|
620
|
-
},
|
|
621
|
-
},
|
|
622
|
-
},
|
|
623
|
-
},
|
|
624
|
-
responses: {
|
|
625
|
-
"201": {
|
|
626
|
-
description: "Scheduled task created",
|
|
627
|
-
content: { "application/json": { schema: { type: "object" } } },
|
|
628
|
-
},
|
|
629
|
-
"400": errorResponse("Invalid request body or cron expression"),
|
|
630
|
-
...authErrors,
|
|
631
|
-
"404": errorResponse("Feature not available"),
|
|
632
|
-
},
|
|
633
|
-
},
|
|
634
|
-
},
|
|
635
|
-
|
|
636
|
-
"/api/v1/scheduled-tasks/tick": {
|
|
637
|
-
post: {
|
|
638
|
-
operationId: "schedulerTick",
|
|
639
|
-
summary: "Trigger scheduler tick",
|
|
640
|
-
description:
|
|
641
|
-
"Serverless scheduler tick endpoint for Vercel Cron or external cron services. " +
|
|
642
|
-
"Checks for due tasks and executes them. Requires CRON_SECRET or ATLAS_SCHEDULER_SECRET.",
|
|
643
|
-
tags: ["Scheduled Tasks"],
|
|
644
|
-
security: [{ bearerAuth: [] }],
|
|
645
|
-
responses: {
|
|
646
|
-
"200": {
|
|
647
|
-
description: "Tick completed",
|
|
648
|
-
content: { "application/json": { schema: { type: "object" } } },
|
|
649
|
-
},
|
|
650
|
-
"401": errorResponse("Invalid or missing cron secret"),
|
|
651
|
-
"500": errorResponse("Tick execution failed"),
|
|
652
|
-
},
|
|
653
|
-
},
|
|
654
|
-
},
|
|
655
|
-
|
|
656
|
-
"/api/v1/scheduled-tasks/{id}": {
|
|
657
|
-
get: {
|
|
658
|
-
operationId: "getScheduledTask",
|
|
659
|
-
summary: "Get scheduled task",
|
|
660
|
-
description: "Returns a scheduled task with its 10 most recent runs.",
|
|
661
|
-
tags: ["Scheduled Tasks"],
|
|
662
|
-
security: [{ bearerAuth: [] }, {}],
|
|
663
|
-
parameters: [uuidPathParam("id", "Task UUID.")],
|
|
664
|
-
responses: {
|
|
665
|
-
"200": {
|
|
666
|
-
description: "Scheduled task with recent runs",
|
|
667
|
-
content: { "application/json": { schema: { type: "object" } } },
|
|
668
|
-
},
|
|
669
|
-
"400": errorResponse("Invalid task ID format"),
|
|
670
|
-
...authErrors,
|
|
671
|
-
"404": errorResponse("Task not found"),
|
|
672
|
-
},
|
|
673
|
-
},
|
|
674
|
-
put: {
|
|
675
|
-
operationId: "updateScheduledTask",
|
|
676
|
-
summary: "Update a scheduled task",
|
|
677
|
-
description: "Updates a scheduled task. All fields are optional.",
|
|
678
|
-
tags: ["Scheduled Tasks"],
|
|
679
|
-
security: [{ bearerAuth: [] }],
|
|
680
|
-
parameters: [uuidPathParam("id", "Task UUID.")],
|
|
681
|
-
requestBody: {
|
|
682
|
-
required: true,
|
|
683
|
-
content: {
|
|
684
|
-
"application/json": {
|
|
685
|
-
schema: {
|
|
686
|
-
type: "object",
|
|
687
|
-
properties: {
|
|
688
|
-
name: { type: "string", minLength: 1, maxLength: 200 },
|
|
689
|
-
question: { type: "string", minLength: 1, maxLength: 2000 },
|
|
690
|
-
cronExpression: { type: "string" },
|
|
691
|
-
deliveryChannel: { type: "string", enum: ["email", "slack", "webhook"] },
|
|
692
|
-
recipients: { type: "array", items: { type: "object" } },
|
|
693
|
-
connectionId: { type: "string", nullable: true },
|
|
694
|
-
approvalMode: { type: "string", enum: ["auto", "manual", "admin-only"] },
|
|
695
|
-
enabled: { type: "boolean" },
|
|
696
|
-
},
|
|
697
|
-
},
|
|
698
|
-
},
|
|
699
|
-
},
|
|
700
|
-
},
|
|
701
|
-
responses: {
|
|
702
|
-
"200": {
|
|
703
|
-
description: "Updated scheduled task",
|
|
704
|
-
content: { "application/json": { schema: { type: "object" } } },
|
|
705
|
-
},
|
|
706
|
-
"400": errorResponse("Invalid request body or cron expression"),
|
|
707
|
-
...authErrors,
|
|
708
|
-
"404": errorResponse("Task not found"),
|
|
709
|
-
},
|
|
710
|
-
},
|
|
711
|
-
delete: {
|
|
712
|
-
operationId: "deleteScheduledTask",
|
|
713
|
-
summary: "Delete a scheduled task",
|
|
714
|
-
description: "Soft-deletes (disables) a scheduled task.",
|
|
715
|
-
tags: ["Scheduled Tasks"],
|
|
716
|
-
security: [{ bearerAuth: [] }],
|
|
717
|
-
parameters: [uuidPathParam("id", "Task UUID.")],
|
|
718
|
-
responses: {
|
|
719
|
-
"204": { description: "Task deleted successfully" },
|
|
720
|
-
"400": errorResponse("Invalid task ID format"),
|
|
721
|
-
...authErrors,
|
|
722
|
-
"404": errorResponse("Task not found"),
|
|
723
|
-
},
|
|
724
|
-
},
|
|
725
|
-
},
|
|
726
|
-
|
|
727
|
-
"/api/v1/scheduled-tasks/{id}/run": {
|
|
728
|
-
post: {
|
|
729
|
-
operationId: "triggerScheduledTask",
|
|
730
|
-
summary: "Trigger immediate execution",
|
|
731
|
-
description: "Triggers an immediate execution of a scheduled task.",
|
|
732
|
-
tags: ["Scheduled Tasks"],
|
|
733
|
-
security: [{ bearerAuth: [] }],
|
|
734
|
-
parameters: [uuidPathParam("id", "Task UUID.")],
|
|
735
|
-
responses: {
|
|
736
|
-
"200": {
|
|
737
|
-
description: "Task triggered",
|
|
738
|
-
content: {
|
|
739
|
-
"application/json": {
|
|
740
|
-
schema: {
|
|
741
|
-
type: "object",
|
|
742
|
-
properties: {
|
|
743
|
-
message: { type: "string" },
|
|
744
|
-
taskId: { type: "string", format: "uuid" },
|
|
745
|
-
},
|
|
746
|
-
},
|
|
747
|
-
},
|
|
748
|
-
},
|
|
749
|
-
},
|
|
750
|
-
"400": errorResponse("Invalid task ID format"),
|
|
751
|
-
...authErrors,
|
|
752
|
-
"404": errorResponse("Task not found"),
|
|
753
|
-
},
|
|
754
|
-
},
|
|
755
|
-
},
|
|
756
|
-
|
|
757
|
-
"/api/v1/scheduled-tasks/{id}/runs": {
|
|
758
|
-
get: {
|
|
759
|
-
operationId: "listTaskRuns",
|
|
760
|
-
summary: "List task runs",
|
|
761
|
-
description: "Returns past execution runs for a scheduled task.",
|
|
762
|
-
tags: ["Scheduled Tasks"],
|
|
763
|
-
security: [{ bearerAuth: [] }, {}],
|
|
764
|
-
parameters: [
|
|
765
|
-
uuidPathParam("id", "Task UUID."),
|
|
766
|
-
{
|
|
767
|
-
name: "limit",
|
|
768
|
-
in: "query",
|
|
769
|
-
description: "Maximum number of runs to return (1-100, default 20).",
|
|
770
|
-
required: false,
|
|
771
|
-
schema: { type: "integer", minimum: 1, maximum: 100, default: 20 },
|
|
772
|
-
},
|
|
773
|
-
],
|
|
774
|
-
responses: {
|
|
775
|
-
"200": {
|
|
776
|
-
description: "List of task runs",
|
|
777
|
-
content: {
|
|
778
|
-
"application/json": {
|
|
779
|
-
schema: {
|
|
780
|
-
type: "object",
|
|
781
|
-
properties: {
|
|
782
|
-
runs: { type: "array", items: { type: "object" } },
|
|
783
|
-
},
|
|
784
|
-
},
|
|
785
|
-
},
|
|
786
|
-
},
|
|
787
|
-
},
|
|
788
|
-
"400": errorResponse("Invalid task ID format"),
|
|
789
|
-
...authErrors,
|
|
790
|
-
"404": errorResponse("Task not found"),
|
|
791
|
-
},
|
|
792
|
-
},
|
|
793
|
-
},
|
|
794
|
-
|
|
795
|
-
// -----------------------------------------------------------------
|
|
796
|
-
// Auth — Better Auth routes (key endpoints)
|
|
797
|
-
// -----------------------------------------------------------------
|
|
798
|
-
"/api/auth/sign-up/email": {
|
|
799
|
-
post: {
|
|
800
|
-
operationId: "signUpEmail",
|
|
801
|
-
summary: "Sign up with email",
|
|
802
|
-
description:
|
|
803
|
-
"Creates a new user account with email and password. Only available when auth mode is 'managed' (Better Auth).",
|
|
804
|
-
tags: ["Auth"],
|
|
805
|
-
requestBody: {
|
|
806
|
-
required: true,
|
|
807
|
-
content: {
|
|
808
|
-
"application/json": {
|
|
809
|
-
schema: {
|
|
810
|
-
type: "object",
|
|
811
|
-
required: ["email", "password", "name"],
|
|
812
|
-
properties: {
|
|
813
|
-
email: { type: "string", format: "email" },
|
|
814
|
-
password: { type: "string", minLength: 8 },
|
|
815
|
-
name: { type: "string" },
|
|
816
|
-
},
|
|
817
|
-
},
|
|
818
|
-
},
|
|
819
|
-
},
|
|
820
|
-
},
|
|
821
|
-
responses: {
|
|
822
|
-
"200": {
|
|
823
|
-
description: "User created successfully",
|
|
824
|
-
content: { "application/json": { schema: { type: "object" } } },
|
|
825
|
-
},
|
|
826
|
-
"400": errorResponse("Invalid request"),
|
|
827
|
-
"404": errorResponse("Auth routes not enabled (not in managed mode)"),
|
|
828
|
-
},
|
|
829
|
-
},
|
|
830
|
-
},
|
|
831
|
-
|
|
832
|
-
"/api/auth/sign-in/email": {
|
|
833
|
-
post: {
|
|
834
|
-
operationId: "signInEmail",
|
|
835
|
-
summary: "Sign in with email",
|
|
836
|
-
description:
|
|
837
|
-
"Authenticates a user with email and password. Returns a session token. Only available when auth mode is 'managed'.",
|
|
838
|
-
tags: ["Auth"],
|
|
839
|
-
requestBody: {
|
|
840
|
-
required: true,
|
|
841
|
-
content: {
|
|
842
|
-
"application/json": {
|
|
843
|
-
schema: {
|
|
844
|
-
type: "object",
|
|
845
|
-
required: ["email", "password"],
|
|
846
|
-
properties: {
|
|
847
|
-
email: { type: "string", format: "email" },
|
|
848
|
-
password: { type: "string" },
|
|
849
|
-
},
|
|
850
|
-
},
|
|
851
|
-
},
|
|
852
|
-
},
|
|
853
|
-
},
|
|
854
|
-
responses: {
|
|
855
|
-
"200": {
|
|
856
|
-
description: "Session created",
|
|
857
|
-
content: { "application/json": { schema: { type: "object" } } },
|
|
858
|
-
},
|
|
859
|
-
"401": errorResponse("Invalid credentials"),
|
|
860
|
-
"404": errorResponse("Auth routes not enabled"),
|
|
861
|
-
},
|
|
862
|
-
},
|
|
863
|
-
},
|
|
864
|
-
|
|
865
|
-
"/api/auth/get-session": {
|
|
866
|
-
get: {
|
|
867
|
-
operationId: "getSession",
|
|
868
|
-
summary: "Get current session",
|
|
869
|
-
description:
|
|
870
|
-
"Returns the current session and user info. Requires a valid session cookie or Authorization header.",
|
|
871
|
-
tags: ["Auth"],
|
|
872
|
-
security: [{ bearerAuth: [] }],
|
|
873
|
-
responses: {
|
|
874
|
-
"200": {
|
|
875
|
-
description: "Current session",
|
|
876
|
-
content: { "application/json": { schema: { type: "object" } } },
|
|
877
|
-
},
|
|
878
|
-
"401": errorResponse("Not authenticated"),
|
|
879
|
-
"404": errorResponse("Auth routes not enabled"),
|
|
880
|
-
},
|
|
881
|
-
},
|
|
882
|
-
},
|
|
883
|
-
|
|
884
|
-
"/api/auth/sign-out": {
|
|
885
|
-
post: {
|
|
886
|
-
operationId: "signOut",
|
|
887
|
-
summary: "Sign out",
|
|
888
|
-
description: "Destroys the current session.",
|
|
889
|
-
tags: ["Auth"],
|
|
890
|
-
security: [{ bearerAuth: [] }],
|
|
891
|
-
responses: {
|
|
892
|
-
"200": { description: "Session destroyed" },
|
|
893
|
-
"404": errorResponse("Auth routes not enabled"),
|
|
894
|
-
},
|
|
895
|
-
},
|
|
896
|
-
},
|
|
897
|
-
|
|
898
|
-
// -----------------------------------------------------------------
|
|
899
|
-
// Slack integration
|
|
900
|
-
// -----------------------------------------------------------------
|
|
901
|
-
"/api/slack/commands": {
|
|
902
|
-
post: {
|
|
903
|
-
operationId: "slackCommand",
|
|
904
|
-
summary: "Slack slash command",
|
|
905
|
-
description:
|
|
906
|
-
"Handles Slack slash commands (/atlas). Acks within 3 seconds and processes the query asynchronously. " +
|
|
907
|
-
"Requires SLACK_SIGNING_SECRET. Request signature is verified.",
|
|
908
|
-
tags: ["Slack"],
|
|
909
|
-
requestBody: {
|
|
910
|
-
required: true,
|
|
911
|
-
content: {
|
|
912
|
-
"application/x-www-form-urlencoded": {
|
|
913
|
-
schema: {
|
|
914
|
-
type: "object",
|
|
915
|
-
properties: {
|
|
916
|
-
text: { type: "string", description: "The question text." },
|
|
917
|
-
channel_id: { type: "string" },
|
|
918
|
-
user_id: { type: "string" },
|
|
919
|
-
team_id: { type: "string" },
|
|
920
|
-
response_url: { type: "string" },
|
|
921
|
-
},
|
|
922
|
-
},
|
|
923
|
-
},
|
|
924
|
-
},
|
|
925
|
-
},
|
|
926
|
-
responses: {
|
|
927
|
-
"200": {
|
|
928
|
-
description: "Immediate acknowledgment (processing continues asynchronously)",
|
|
929
|
-
content: {
|
|
930
|
-
"application/json": {
|
|
931
|
-
schema: {
|
|
932
|
-
type: "object",
|
|
933
|
-
properties: {
|
|
934
|
-
response_type: { type: "string" },
|
|
935
|
-
text: { type: "string" },
|
|
936
|
-
},
|
|
937
|
-
},
|
|
938
|
-
},
|
|
939
|
-
},
|
|
940
|
-
},
|
|
941
|
-
"401": errorResponse("Invalid Slack signature"),
|
|
942
|
-
},
|
|
943
|
-
},
|
|
944
|
-
},
|
|
945
|
-
|
|
946
|
-
"/api/slack/events": {
|
|
947
|
-
post: {
|
|
948
|
-
operationId: "slackEvents",
|
|
949
|
-
summary: "Slack Events API",
|
|
950
|
-
description:
|
|
951
|
-
"Handles Slack Events API callbacks including url_verification challenges and thread follow-up messages. " +
|
|
952
|
-
"Bot messages are ignored to prevent loops.",
|
|
953
|
-
tags: ["Slack"],
|
|
954
|
-
requestBody: {
|
|
955
|
-
required: true,
|
|
956
|
-
content: {
|
|
957
|
-
"application/json": {
|
|
958
|
-
schema: {
|
|
959
|
-
type: "object",
|
|
960
|
-
properties: {
|
|
961
|
-
type: { type: "string", enum: ["url_verification", "event_callback"] },
|
|
962
|
-
challenge: { type: "string", description: "Verification challenge (url_verification only)." },
|
|
963
|
-
event: { type: "object", description: "The Slack event payload." },
|
|
964
|
-
},
|
|
965
|
-
},
|
|
966
|
-
},
|
|
967
|
-
},
|
|
968
|
-
},
|
|
969
|
-
responses: {
|
|
970
|
-
"200": {
|
|
971
|
-
description: "Event acknowledged",
|
|
972
|
-
content: {
|
|
973
|
-
"application/json": {
|
|
974
|
-
schema: {
|
|
975
|
-
type: "object",
|
|
976
|
-
properties: {
|
|
977
|
-
ok: { type: "boolean" },
|
|
978
|
-
challenge: { type: "string", description: "Echoed challenge (url_verification only)." },
|
|
979
|
-
},
|
|
980
|
-
},
|
|
981
|
-
},
|
|
982
|
-
},
|
|
983
|
-
},
|
|
984
|
-
"401": errorResponse("Invalid Slack signature"),
|
|
985
|
-
},
|
|
986
|
-
},
|
|
987
|
-
},
|
|
988
|
-
|
|
989
|
-
"/api/slack/install": {
|
|
990
|
-
get: {
|
|
991
|
-
operationId: "slackInstall",
|
|
992
|
-
summary: "Slack OAuth install",
|
|
993
|
-
description:
|
|
994
|
-
"Redirects to the Slack OAuth authorization page. Requires SLACK_CLIENT_ID to be configured.",
|
|
995
|
-
tags: ["Slack"],
|
|
996
|
-
responses: {
|
|
997
|
-
"302": { description: "Redirect to Slack OAuth authorization page" },
|
|
998
|
-
"501": errorResponse("OAuth not configured"),
|
|
999
|
-
},
|
|
1000
|
-
},
|
|
1001
|
-
},
|
|
1002
|
-
|
|
1003
|
-
"/api/slack/callback": {
|
|
1004
|
-
get: {
|
|
1005
|
-
operationId: "slackCallback",
|
|
1006
|
-
summary: "Slack OAuth callback",
|
|
1007
|
-
description:
|
|
1008
|
-
"Handles the OAuth callback from Slack, exchanges the code for a bot token, and saves the installation.",
|
|
1009
|
-
tags: ["Slack"],
|
|
1010
|
-
parameters: [
|
|
1011
|
-
{ name: "code", in: "query", required: true, schema: { type: "string" }, description: "OAuth authorization code." },
|
|
1012
|
-
{ name: "state", in: "query", required: true, schema: { type: "string" }, description: "CSRF state parameter." },
|
|
1013
|
-
],
|
|
1014
|
-
responses: {
|
|
1015
|
-
"200": {
|
|
1016
|
-
description: "Installation successful (HTML response)",
|
|
1017
|
-
content: { "text/html": { schema: { type: "string" } } },
|
|
1018
|
-
},
|
|
1019
|
-
"400": errorResponse("Invalid or expired state, or missing code"),
|
|
1020
|
-
"500": { description: "Installation failed (HTML response)", content: { "text/html": { schema: { type: "string" } } } },
|
|
1021
|
-
"501": errorResponse("OAuth not configured"),
|
|
1022
|
-
},
|
|
1023
|
-
},
|
|
1024
|
-
},
|
|
1025
|
-
|
|
1026
|
-
// -----------------------------------------------------------------
|
|
1027
|
-
// Admin — admin console routes
|
|
1028
|
-
// -----------------------------------------------------------------
|
|
1029
|
-
"/api/v1/admin/overview": {
|
|
1030
|
-
get: {
|
|
1031
|
-
operationId: "adminOverview",
|
|
1032
|
-
summary: "Dashboard overview",
|
|
1033
|
-
description:
|
|
1034
|
-
"Returns counts of connections, entities, metrics, glossary terms, and plugins. Requires admin role.",
|
|
1035
|
-
tags: ["Admin"],
|
|
1036
|
-
security: [{ bearerAuth: [] }],
|
|
1037
|
-
responses: {
|
|
1038
|
-
"200": {
|
|
1039
|
-
description: "Dashboard summary",
|
|
1040
|
-
content: {
|
|
1041
|
-
"application/json": {
|
|
1042
|
-
schema: {
|
|
1043
|
-
type: "object",
|
|
1044
|
-
properties: {
|
|
1045
|
-
connections: { type: "integer" },
|
|
1046
|
-
entities: { type: "integer" },
|
|
1047
|
-
metrics: { type: "integer" },
|
|
1048
|
-
glossaryTerms: { type: "integer" },
|
|
1049
|
-
plugins: { type: "integer" },
|
|
1050
|
-
pluginHealth: {
|
|
1051
|
-
type: "array",
|
|
1052
|
-
items: {
|
|
1053
|
-
type: "object",
|
|
1054
|
-
properties: {
|
|
1055
|
-
id: { type: "string" },
|
|
1056
|
-
name: { type: "string" },
|
|
1057
|
-
type: { type: "string" },
|
|
1058
|
-
status: { type: "string" },
|
|
1059
|
-
},
|
|
1060
|
-
},
|
|
1061
|
-
},
|
|
1062
|
-
},
|
|
1063
|
-
},
|
|
1064
|
-
},
|
|
1065
|
-
},
|
|
1066
|
-
},
|
|
1067
|
-
...authErrors,
|
|
1068
|
-
},
|
|
1069
|
-
},
|
|
1070
|
-
},
|
|
1071
|
-
|
|
1072
|
-
"/api/v1/admin/semantic/entities": {
|
|
1073
|
-
get: {
|
|
1074
|
-
operationId: "adminListEntities",
|
|
1075
|
-
summary: "List semantic entities",
|
|
1076
|
-
description: "Lists all entity YAML files with summary info. Requires admin role.",
|
|
1077
|
-
tags: ["Admin"],
|
|
1078
|
-
security: [{ bearerAuth: [] }],
|
|
1079
|
-
responses: {
|
|
1080
|
-
"200": {
|
|
1081
|
-
description: "List of entities",
|
|
1082
|
-
content: { "application/json": { schema: { type: "object" } } },
|
|
1083
|
-
},
|
|
1084
|
-
...authErrors,
|
|
1085
|
-
},
|
|
1086
|
-
},
|
|
1087
|
-
},
|
|
1088
|
-
|
|
1089
|
-
"/api/v1/admin/semantic/entities/{name}": {
|
|
1090
|
-
get: {
|
|
1091
|
-
operationId: "adminGetEntity",
|
|
1092
|
-
summary: "Get entity details",
|
|
1093
|
-
description: "Returns the full parsed YAML for a specific entity. Requires admin role.",
|
|
1094
|
-
tags: ["Admin"],
|
|
1095
|
-
security: [{ bearerAuth: [] }],
|
|
1096
|
-
parameters: [
|
|
1097
|
-
{ name: "name", in: "path", required: true, schema: { type: "string" }, description: "Entity name (e.g. 'orders')." },
|
|
1098
|
-
],
|
|
1099
|
-
responses: {
|
|
1100
|
-
"200": {
|
|
1101
|
-
description: "Entity YAML content",
|
|
1102
|
-
content: { "application/json": { schema: { type: "object" } } },
|
|
1103
|
-
},
|
|
1104
|
-
"400": errorResponse("Invalid entity name"),
|
|
1105
|
-
...authErrors,
|
|
1106
|
-
"404": errorResponse("Entity not found"),
|
|
1107
|
-
},
|
|
1108
|
-
},
|
|
1109
|
-
},
|
|
1110
|
-
|
|
1111
|
-
"/api/v1/admin/semantic/metrics": {
|
|
1112
|
-
get: {
|
|
1113
|
-
operationId: "adminListMetrics",
|
|
1114
|
-
summary: "List metrics",
|
|
1115
|
-
description: "Lists all metric YAML files grouped by source. Requires admin role.",
|
|
1116
|
-
tags: ["Admin"],
|
|
1117
|
-
security: [{ bearerAuth: [] }],
|
|
1118
|
-
responses: {
|
|
1119
|
-
"200": {
|
|
1120
|
-
description: "List of metrics",
|
|
1121
|
-
content: { "application/json": { schema: { type: "object" } } },
|
|
1122
|
-
},
|
|
1123
|
-
...authErrors,
|
|
1124
|
-
},
|
|
1125
|
-
},
|
|
1126
|
-
},
|
|
1127
|
-
|
|
1128
|
-
"/api/v1/admin/semantic/glossary": {
|
|
1129
|
-
get: {
|
|
1130
|
-
operationId: "adminGetGlossary",
|
|
1131
|
-
summary: "Get glossary",
|
|
1132
|
-
description: "Returns all glossary files (default and per-source). Requires admin role.",
|
|
1133
|
-
tags: ["Admin"],
|
|
1134
|
-
security: [{ bearerAuth: [] }],
|
|
1135
|
-
responses: {
|
|
1136
|
-
"200": {
|
|
1137
|
-
description: "Glossary content",
|
|
1138
|
-
content: { "application/json": { schema: { type: "object" } } },
|
|
1139
|
-
},
|
|
1140
|
-
...authErrors,
|
|
1141
|
-
},
|
|
1142
|
-
},
|
|
1143
|
-
},
|
|
1144
|
-
|
|
1145
|
-
"/api/v1/admin/semantic/catalog": {
|
|
1146
|
-
get: {
|
|
1147
|
-
operationId: "adminGetCatalog",
|
|
1148
|
-
summary: "Get catalog",
|
|
1149
|
-
description: "Returns the parsed catalog.yml. Returns an object with a null catalog field if no catalog exists. Requires admin role.",
|
|
1150
|
-
tags: ["Admin"],
|
|
1151
|
-
security: [{ bearerAuth: [] }],
|
|
1152
|
-
responses: {
|
|
1153
|
-
"200": {
|
|
1154
|
-
description: "Catalog content",
|
|
1155
|
-
content: { "application/json": { schema: { type: "object" } } },
|
|
1156
|
-
},
|
|
1157
|
-
...authErrors,
|
|
1158
|
-
},
|
|
1159
|
-
},
|
|
1160
|
-
},
|
|
1161
|
-
|
|
1162
|
-
"/api/v1/admin/semantic/raw/{file}": {
|
|
1163
|
-
get: {
|
|
1164
|
-
operationId: "adminGetRawFile",
|
|
1165
|
-
summary: "Get raw YAML file",
|
|
1166
|
-
description:
|
|
1167
|
-
"Serves a raw top-level YAML file from the semantic layer (e.g. catalog.yml, glossary.yml). " +
|
|
1168
|
-
"Only .yml files matching the allowed pattern are served. Requires admin role.",
|
|
1169
|
-
tags: ["Admin"],
|
|
1170
|
-
security: [{ bearerAuth: [] }],
|
|
1171
|
-
parameters: [
|
|
1172
|
-
{
|
|
1173
|
-
name: "file",
|
|
1174
|
-
in: "path",
|
|
1175
|
-
required: true,
|
|
1176
|
-
schema: { type: "string", pattern: "^(catalog|glossary)\\.yml$" },
|
|
1177
|
-
description: "Top-level YAML filename (e.g. 'catalog.yml').",
|
|
1178
|
-
},
|
|
1179
|
-
],
|
|
1180
|
-
responses: {
|
|
1181
|
-
"200": {
|
|
1182
|
-
description: "Raw YAML content",
|
|
1183
|
-
content: { "text/plain": { schema: { type: "string" } } },
|
|
1184
|
-
},
|
|
1185
|
-
"400": errorResponse("Invalid file path"),
|
|
1186
|
-
...authErrors,
|
|
1187
|
-
"404": errorResponse("File not found"),
|
|
1188
|
-
},
|
|
1189
|
-
},
|
|
1190
|
-
},
|
|
1191
|
-
|
|
1192
|
-
"/api/v1/admin/semantic/raw/{dir}/{file}": {
|
|
1193
|
-
get: {
|
|
1194
|
-
operationId: "adminGetRawDirFile",
|
|
1195
|
-
summary: "Get raw YAML file from subdirectory",
|
|
1196
|
-
description:
|
|
1197
|
-
"Serves a raw YAML file from a semantic layer subdirectory (e.g. entities/orders.yml, metrics/revenue.yml). " +
|
|
1198
|
-
"Only .yml files in entities/ or metrics/ are allowed. Requires admin role.",
|
|
1199
|
-
tags: ["Admin"],
|
|
1200
|
-
security: [{ bearerAuth: [] }],
|
|
1201
|
-
parameters: [
|
|
1202
|
-
{
|
|
1203
|
-
name: "dir",
|
|
1204
|
-
in: "path",
|
|
1205
|
-
required: true,
|
|
1206
|
-
schema: { type: "string", enum: ["entities", "metrics"] },
|
|
1207
|
-
description: "Subdirectory name.",
|
|
1208
|
-
},
|
|
1209
|
-
{
|
|
1210
|
-
name: "file",
|
|
1211
|
-
in: "path",
|
|
1212
|
-
required: true,
|
|
1213
|
-
schema: { type: "string", pattern: "^[a-zA-Z0-9_-]+\\.yml$" },
|
|
1214
|
-
description: "YAML filename (e.g. 'orders.yml').",
|
|
1215
|
-
},
|
|
1216
|
-
],
|
|
1217
|
-
responses: {
|
|
1218
|
-
"200": {
|
|
1219
|
-
description: "Raw YAML content",
|
|
1220
|
-
content: { "text/plain": { schema: { type: "string" } } },
|
|
1221
|
-
},
|
|
1222
|
-
"400": errorResponse("Invalid file path"),
|
|
1223
|
-
...authErrors,
|
|
1224
|
-
"404": errorResponse("File not found"),
|
|
1225
|
-
},
|
|
1226
|
-
},
|
|
1227
|
-
},
|
|
1228
|
-
|
|
1229
|
-
"/api/v1/admin/semantic/stats": {
|
|
1230
|
-
get: {
|
|
1231
|
-
operationId: "adminSemanticStats",
|
|
1232
|
-
summary: "Semantic layer statistics",
|
|
1233
|
-
description: "Aggregate statistics across the semantic layer. Requires admin role.",
|
|
1234
|
-
tags: ["Admin"],
|
|
1235
|
-
security: [{ bearerAuth: [] }],
|
|
1236
|
-
responses: {
|
|
1237
|
-
"200": {
|
|
1238
|
-
description: "Semantic layer stats",
|
|
1239
|
-
content: {
|
|
1240
|
-
"application/json": {
|
|
1241
|
-
schema: {
|
|
1242
|
-
type: "object",
|
|
1243
|
-
properties: {
|
|
1244
|
-
totalEntities: { type: "integer" },
|
|
1245
|
-
totalColumns: { type: "integer" },
|
|
1246
|
-
totalJoins: { type: "integer" },
|
|
1247
|
-
totalMeasures: { type: "integer" },
|
|
1248
|
-
coverageGaps: {
|
|
1249
|
-
type: "object",
|
|
1250
|
-
properties: {
|
|
1251
|
-
noDescription: { type: "integer" },
|
|
1252
|
-
noColumns: { type: "integer" },
|
|
1253
|
-
noJoins: { type: "integer" },
|
|
1254
|
-
},
|
|
1255
|
-
},
|
|
1256
|
-
},
|
|
1257
|
-
},
|
|
1258
|
-
},
|
|
1259
|
-
},
|
|
1260
|
-
},
|
|
1261
|
-
...authErrors,
|
|
1262
|
-
},
|
|
1263
|
-
},
|
|
1264
|
-
},
|
|
1265
|
-
|
|
1266
|
-
"/api/v1/admin/connections": {
|
|
1267
|
-
get: {
|
|
1268
|
-
operationId: "adminListConnections",
|
|
1269
|
-
summary: "List connections",
|
|
1270
|
-
description: "Lists all registered database connections with type and cached health status. Requires admin role.",
|
|
1271
|
-
tags: ["Admin"],
|
|
1272
|
-
security: [{ bearerAuth: [] }],
|
|
1273
|
-
responses: {
|
|
1274
|
-
"200": {
|
|
1275
|
-
description: "List of connections",
|
|
1276
|
-
content: { "application/json": { schema: { type: "object" } } },
|
|
1277
|
-
},
|
|
1278
|
-
...authErrors,
|
|
1279
|
-
},
|
|
1280
|
-
},
|
|
1281
|
-
},
|
|
1282
|
-
|
|
1283
|
-
"/api/v1/admin/connections/{id}/test": {
|
|
1284
|
-
post: {
|
|
1285
|
-
operationId: "adminTestConnection",
|
|
1286
|
-
summary: "Test a connection",
|
|
1287
|
-
description: "Triggers a live health check for a specific connection. Requires admin role.",
|
|
1288
|
-
tags: ["Admin"],
|
|
1289
|
-
security: [{ bearerAuth: [] }],
|
|
1290
|
-
parameters: [
|
|
1291
|
-
{ name: "id", in: "path", required: true, schema: { type: "string" }, description: "Connection ID (e.g. 'default')." },
|
|
1292
|
-
],
|
|
1293
|
-
responses: {
|
|
1294
|
-
"200": {
|
|
1295
|
-
description: "Connection health check result",
|
|
1296
|
-
content: {
|
|
1297
|
-
"application/json": {
|
|
1298
|
-
schema: {
|
|
1299
|
-
type: "object",
|
|
1300
|
-
properties: {
|
|
1301
|
-
status: { type: "string", enum: ["healthy", "unhealthy"] },
|
|
1302
|
-
latencyMs: { type: "integer" },
|
|
1303
|
-
checkedAt: { type: "string", format: "date-time" },
|
|
1304
|
-
},
|
|
1305
|
-
},
|
|
1306
|
-
},
|
|
1307
|
-
},
|
|
1308
|
-
},
|
|
1309
|
-
...authErrors,
|
|
1310
|
-
"404": errorResponse("Connection not found"),
|
|
1311
|
-
},
|
|
1312
|
-
},
|
|
1313
|
-
},
|
|
1314
|
-
|
|
1315
|
-
"/api/v1/admin/users": {
|
|
1316
|
-
get: {
|
|
1317
|
-
operationId: "adminListUsers",
|
|
1318
|
-
summary: "List users",
|
|
1319
|
-
description: "Lists users with pagination, search, and role filtering. Requires admin role and managed auth.",
|
|
1320
|
-
tags: ["Admin"],
|
|
1321
|
-
security: [{ bearerAuth: [] }],
|
|
1322
|
-
parameters: [
|
|
1323
|
-
...paginationParams({ limit: 50, maxLimit: 200 }),
|
|
1324
|
-
{ name: "search", in: "query", required: false, schema: { type: "string" }, description: "Search by email (contains match)." },
|
|
1325
|
-
{ name: "role", in: "query", required: false, schema: { type: "string", enum: ["viewer", "analyst", "admin"] }, description: "Filter by role." },
|
|
1326
|
-
],
|
|
1327
|
-
responses: {
|
|
1328
|
-
"200": {
|
|
1329
|
-
description: "Paginated list of users",
|
|
1330
|
-
content: { "application/json": { schema: { type: "object" } } },
|
|
1331
|
-
},
|
|
1332
|
-
...authErrors,
|
|
1333
|
-
},
|
|
1334
|
-
},
|
|
1335
|
-
},
|
|
1336
|
-
|
|
1337
|
-
"/api/v1/admin/users/stats": {
|
|
1338
|
-
get: {
|
|
1339
|
-
operationId: "adminUserStats",
|
|
1340
|
-
summary: "User statistics",
|
|
1341
|
-
description: "Aggregate user statistics: total count, banned count, and breakdown by role. Requires admin role.",
|
|
1342
|
-
tags: ["Admin"],
|
|
1343
|
-
security: [{ bearerAuth: [] }],
|
|
1344
|
-
responses: {
|
|
1345
|
-
"200": {
|
|
1346
|
-
description: "User stats",
|
|
1347
|
-
content: {
|
|
1348
|
-
"application/json": {
|
|
1349
|
-
schema: {
|
|
1350
|
-
type: "object",
|
|
1351
|
-
properties: {
|
|
1352
|
-
total: { type: "integer" },
|
|
1353
|
-
banned: { type: "integer" },
|
|
1354
|
-
byRole: {
|
|
1355
|
-
type: "object",
|
|
1356
|
-
properties: {
|
|
1357
|
-
admin: { type: "integer" },
|
|
1358
|
-
analyst: { type: "integer" },
|
|
1359
|
-
viewer: { type: "integer" },
|
|
1360
|
-
},
|
|
1361
|
-
},
|
|
1362
|
-
},
|
|
1363
|
-
},
|
|
1364
|
-
},
|
|
39
|
+
"Creates a new user account with email and password. Only available when auth mode is 'managed' (Better Auth).",
|
|
40
|
+
tags: ["Auth"],
|
|
41
|
+
requestBody: {
|
|
42
|
+
required: true,
|
|
43
|
+
content: {
|
|
44
|
+
"application/json": {
|
|
45
|
+
schema: {
|
|
46
|
+
type: "object",
|
|
47
|
+
required: ["email", "password", "name"],
|
|
48
|
+
properties: {
|
|
49
|
+
email: { type: "string", format: "email" },
|
|
50
|
+
password: { type: "string", minLength: 8 },
|
|
51
|
+
name: { type: "string" },
|
|
1365
52
|
},
|
|
1366
53
|
},
|
|
1367
|
-
...authErrors,
|
|
1368
54
|
},
|
|
1369
55
|
},
|
|
1370
56
|
},
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
summary: "Change user role",
|
|
1376
|
-
description: "Updates a user's role. Cannot change your own role or demote the last admin. Requires admin role.",
|
|
1377
|
-
tags: ["Admin"],
|
|
1378
|
-
security: [{ bearerAuth: [] }],
|
|
1379
|
-
parameters: [{ name: "id", in: "path", required: true, schema: { type: "string" }, description: "User ID." }],
|
|
1380
|
-
requestBody: {
|
|
1381
|
-
required: true,
|
|
1382
|
-
content: {
|
|
1383
|
-
"application/json": {
|
|
1384
|
-
schema: {
|
|
1385
|
-
type: "object",
|
|
1386
|
-
required: ["role"],
|
|
1387
|
-
properties: {
|
|
1388
|
-
role: { type: "string", enum: ["viewer", "analyst", "admin"] },
|
|
1389
|
-
},
|
|
1390
|
-
},
|
|
1391
|
-
},
|
|
1392
|
-
},
|
|
1393
|
-
},
|
|
1394
|
-
responses: {
|
|
1395
|
-
"200": { description: "Role updated", content: { "application/json": { schema: { type: "object" } } } },
|
|
1396
|
-
"400": errorResponse("Invalid role or cannot change own role"),
|
|
1397
|
-
...authErrors,
|
|
1398
|
-
},
|
|
57
|
+
responses: {
|
|
58
|
+
"200": {
|
|
59
|
+
description: "User created successfully",
|
|
60
|
+
content: { "application/json": { schema: { type: "object" } } },
|
|
1399
61
|
},
|
|
62
|
+
"400": errorResponse("Invalid request"),
|
|
63
|
+
"404": errorResponse("Auth routes not enabled (not in managed mode)"),
|
|
1400
64
|
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
1401
67
|
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
},
|
|
1420
|
-
},
|
|
68
|
+
"/api/auth/sign-in/email": {
|
|
69
|
+
post: {
|
|
70
|
+
operationId: "signInEmail",
|
|
71
|
+
summary: "Sign in with email",
|
|
72
|
+
description:
|
|
73
|
+
"Authenticates a user with email and password. Returns a session token. Only available when auth mode is 'managed'.",
|
|
74
|
+
tags: ["Auth"],
|
|
75
|
+
requestBody: {
|
|
76
|
+
required: true,
|
|
77
|
+
content: {
|
|
78
|
+
"application/json": {
|
|
79
|
+
schema: {
|
|
80
|
+
type: "object",
|
|
81
|
+
required: ["email", "password"],
|
|
82
|
+
properties: {
|
|
83
|
+
email: { type: "string", format: "email" },
|
|
84
|
+
password: { type: "string" },
|
|
1421
85
|
},
|
|
1422
86
|
},
|
|
1423
87
|
},
|
|
1424
|
-
responses: {
|
|
1425
|
-
"200": { description: "User banned", content: { "application/json": { schema: { type: "object" } } } },
|
|
1426
|
-
...authErrors,
|
|
1427
|
-
},
|
|
1428
|
-
},
|
|
1429
|
-
},
|
|
1430
|
-
|
|
1431
|
-
"/api/v1/admin/users/{id}/unban": {
|
|
1432
|
-
post: {
|
|
1433
|
-
operationId: "adminUnbanUser",
|
|
1434
|
-
summary: "Unban a user",
|
|
1435
|
-
description: "Removes a ban from a user. Requires admin role.",
|
|
1436
|
-
tags: ["Admin"],
|
|
1437
|
-
security: [{ bearerAuth: [] }],
|
|
1438
|
-
parameters: [{ name: "id", in: "path", required: true, schema: { type: "string" }, description: "User ID." }],
|
|
1439
|
-
responses: {
|
|
1440
|
-
"200": { description: "User unbanned", content: { "application/json": { schema: { type: "object" } } } },
|
|
1441
|
-
...authErrors,
|
|
1442
|
-
},
|
|
1443
|
-
},
|
|
1444
|
-
},
|
|
1445
|
-
|
|
1446
|
-
"/api/v1/admin/users/{id}": {
|
|
1447
|
-
delete: {
|
|
1448
|
-
operationId: "adminDeleteUser",
|
|
1449
|
-
summary: "Delete a user",
|
|
1450
|
-
description: "Permanently deletes a user. Cannot delete yourself or the last admin. Requires admin role.",
|
|
1451
|
-
tags: ["Admin"],
|
|
1452
|
-
security: [{ bearerAuth: [] }],
|
|
1453
|
-
parameters: [{ name: "id", in: "path", required: true, schema: { type: "string" }, description: "User ID." }],
|
|
1454
|
-
responses: {
|
|
1455
|
-
"204": { description: "User deleted" },
|
|
1456
|
-
"400": errorResponse("Cannot delete yourself or last admin"),
|
|
1457
|
-
...authErrors,
|
|
1458
|
-
},
|
|
1459
88
|
},
|
|
1460
89
|
},
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
summary: "Revoke user sessions",
|
|
1466
|
-
description: "Revokes all sessions for a user (force logout). Requires admin role.",
|
|
1467
|
-
tags: ["Admin"],
|
|
1468
|
-
security: [{ bearerAuth: [] }],
|
|
1469
|
-
parameters: [{ name: "id", in: "path", required: true, schema: { type: "string" }, description: "User ID." }],
|
|
1470
|
-
responses: {
|
|
1471
|
-
"200": { description: "Sessions revoked", content: { "application/json": { schema: { type: "object" } } } },
|
|
1472
|
-
...authErrors,
|
|
1473
|
-
},
|
|
90
|
+
responses: {
|
|
91
|
+
"200": {
|
|
92
|
+
description: "Session created",
|
|
93
|
+
content: { "application/json": { schema: { type: "object" } } },
|
|
1474
94
|
},
|
|
95
|
+
"401": errorResponse("Invalid credentials"),
|
|
96
|
+
"404": errorResponse("Auth routes not enabled"),
|
|
1475
97
|
},
|
|
98
|
+
},
|
|
99
|
+
},
|
|
1476
100
|
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
{ name: "to", in: "query", required: false, schema: { type: "string", format: "date-time" }, description: "ISO 8601 end date." },
|
|
1490
|
-
],
|
|
1491
|
-
responses: {
|
|
1492
|
-
"200": {
|
|
1493
|
-
description: "Paginated audit log",
|
|
1494
|
-
content: { "application/json": { schema: { type: "object" } } },
|
|
1495
|
-
},
|
|
1496
|
-
...authErrors,
|
|
1497
|
-
},
|
|
101
|
+
"/api/auth/get-session": {
|
|
102
|
+
get: {
|
|
103
|
+
operationId: "getSession",
|
|
104
|
+
summary: "Get current session",
|
|
105
|
+
description:
|
|
106
|
+
"Returns the current session and user info. Requires a valid session cookie or Authorization header.",
|
|
107
|
+
tags: ["Auth"],
|
|
108
|
+
security: [{ bearerAuth: [] }],
|
|
109
|
+
responses: {
|
|
110
|
+
"200": {
|
|
111
|
+
description: "Current session",
|
|
112
|
+
content: { "application/json": { schema: { type: "object" } } },
|
|
1498
113
|
},
|
|
114
|
+
"401": errorResponse("Not authenticated"),
|
|
115
|
+
"404": errorResponse("Auth routes not enabled"),
|
|
1499
116
|
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
1500
119
|
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
content: { "application/json": { schema: { type: "object" } } },
|
|
1512
|
-
},
|
|
1513
|
-
...authErrors,
|
|
1514
|
-
},
|
|
1515
|
-
},
|
|
120
|
+
"/api/auth/sign-out": {
|
|
121
|
+
post: {
|
|
122
|
+
operationId: "signOut",
|
|
123
|
+
summary: "Sign out",
|
|
124
|
+
description: "Destroys the current session.",
|
|
125
|
+
tags: ["Auth"],
|
|
126
|
+
security: [{ bearerAuth: [] }],
|
|
127
|
+
responses: {
|
|
128
|
+
"200": { description: "Session destroyed" },
|
|
129
|
+
"404": errorResponse("Auth routes not enabled"),
|
|
1516
130
|
},
|
|
131
|
+
},
|
|
132
|
+
},
|
|
1517
133
|
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
},
|
|
134
|
+
// -------------------------------------------------------------------
|
|
135
|
+
// Widget — embeddable chat widget (static assets)
|
|
136
|
+
// -------------------------------------------------------------------
|
|
137
|
+
"/widget": {
|
|
138
|
+
get: {
|
|
139
|
+
operationId: "widgetHost",
|
|
140
|
+
summary: "Widget HTML host page",
|
|
141
|
+
description:
|
|
142
|
+
"Serves a self-contained HTML page for iframe embedding. Renders the AtlasChat component with configurable theme, API URL, position, branding, and initial query.",
|
|
143
|
+
tags: ["Widget"],
|
|
144
|
+
security: [],
|
|
145
|
+
parameters: [
|
|
146
|
+
{ name: "theme", in: "query", required: false, schema: { type: "string", enum: ["light", "dark", "system"], default: "system" }, description: "Color theme." },
|
|
147
|
+
{ name: "apiUrl", in: "query", required: false, schema: { type: "string" }, description: "Atlas API base URL (http/https only)." },
|
|
148
|
+
{ name: "position", in: "query", required: false, schema: { type: "string", enum: ["bottomRight", "bottomLeft", "inline"], default: "inline" }, description: "Widget position." },
|
|
149
|
+
{ name: "logo", in: "query", required: false, schema: { type: "string" }, description: "HTTPS URL to a custom logo image." },
|
|
150
|
+
{ name: "accent", in: "query", required: false, schema: { type: "string" }, description: "Hex color without # (e.g. '4f46e5')." },
|
|
151
|
+
{ name: "welcome", in: "query", required: false, schema: { type: "string" }, description: "Welcome message (max 500 chars)." },
|
|
152
|
+
{ name: "initialQuery", in: "query", required: false, schema: { type: "string" }, description: "Auto-send query on first open (max 500 chars)." },
|
|
153
|
+
],
|
|
154
|
+
responses: {
|
|
155
|
+
"200": { description: "Widget HTML page", content: { "text/html": { schema: { type: "string" } } } },
|
|
156
|
+
"503": { description: "Widget bundle not built", content: { "text/html": { schema: { type: "string" } } } },
|
|
1533
157
|
},
|
|
158
|
+
},
|
|
159
|
+
},
|
|
1534
160
|
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
responses: {
|
|
1546
|
-
"200": {
|
|
1547
|
-
description: "Plugin health check result",
|
|
1548
|
-
content: { "application/json": { schema: { type: "object" } } },
|
|
1549
|
-
},
|
|
1550
|
-
...authErrors,
|
|
1551
|
-
"404": errorResponse("Plugin not found"),
|
|
1552
|
-
},
|
|
1553
|
-
},
|
|
161
|
+
"/widget/atlas-widget.js": {
|
|
162
|
+
get: {
|
|
163
|
+
operationId: "widgetJS",
|
|
164
|
+
summary: "Widget JavaScript bundle",
|
|
165
|
+
description: "Self-contained ESM bundle (React + AtlasChat). Cached for 24 hours.",
|
|
166
|
+
tags: ["Widget"],
|
|
167
|
+
security: [],
|
|
168
|
+
responses: {
|
|
169
|
+
"200": { description: "Widget JS bundle", content: { "application/javascript": { schema: { type: "string" } } } },
|
|
170
|
+
"404": { description: "Widget JS not built", content: { "text/plain": { schema: { type: "string" } } } },
|
|
1554
171
|
},
|
|
172
|
+
},
|
|
173
|
+
},
|
|
1555
174
|
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
content: {
|
|
1567
|
-
"application/json": {
|
|
1568
|
-
schema: {
|
|
1569
|
-
type: "object",
|
|
1570
|
-
properties: {
|
|
1571
|
-
mustChange: { type: "boolean" },
|
|
1572
|
-
},
|
|
1573
|
-
},
|
|
1574
|
-
},
|
|
1575
|
-
},
|
|
1576
|
-
},
|
|
1577
|
-
...authErrors,
|
|
1578
|
-
},
|
|
1579
|
-
},
|
|
175
|
+
"/widget/atlas-widget.css": {
|
|
176
|
+
get: {
|
|
177
|
+
operationId: "widgetCSS",
|
|
178
|
+
summary: "Widget CSS stylesheet",
|
|
179
|
+
description: "Pre-compiled Tailwind CSS for widget components. Cached for 24 hours.",
|
|
180
|
+
tags: ["Widget"],
|
|
181
|
+
security: [],
|
|
182
|
+
responses: {
|
|
183
|
+
"200": { description: "Widget CSS", content: { "text/css": { schema: { type: "string" } } } },
|
|
184
|
+
"404": { description: "Widget CSS not built", content: { "text/plain": { schema: { type: "string" } } } },
|
|
1580
185
|
},
|
|
186
|
+
},
|
|
187
|
+
},
|
|
1581
188
|
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
schema: {
|
|
1594
|
-
type: "object",
|
|
1595
|
-
required: ["currentPassword", "newPassword"],
|
|
1596
|
-
properties: {
|
|
1597
|
-
currentPassword: { type: "string" },
|
|
1598
|
-
newPassword: { type: "string", minLength: 8 },
|
|
1599
|
-
},
|
|
1600
|
-
},
|
|
1601
|
-
},
|
|
1602
|
-
},
|
|
1603
|
-
},
|
|
1604
|
-
responses: {
|
|
1605
|
-
"200": { description: "Password changed", content: { "application/json": { schema: { type: "object" } } } },
|
|
1606
|
-
"400": errorResponse("Invalid current password or weak new password"),
|
|
1607
|
-
...authErrors,
|
|
1608
|
-
},
|
|
1609
|
-
},
|
|
189
|
+
"/widget.js": {
|
|
190
|
+
get: {
|
|
191
|
+
operationId: "widgetLoader",
|
|
192
|
+
summary: "Widget script tag loader",
|
|
193
|
+
description:
|
|
194
|
+
"Returns a self-contained IIFE script that injects a floating chat bubble and iframe overlay into any host page. " +
|
|
195
|
+
"Reads data-* attributes from its own `<script>` tag for configuration. Exposes window.Atlas programmatic API.",
|
|
196
|
+
tags: ["Widget"],
|
|
197
|
+
security: [],
|
|
198
|
+
responses: {
|
|
199
|
+
"200": { description: "Widget loader script (IIFE)", content: { "application/javascript": { schema: { type: "string" } } } },
|
|
1610
200
|
},
|
|
1611
201
|
},
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
"/widget.d.ts": {
|
|
205
|
+
get: {
|
|
206
|
+
operationId: "widgetTypeDeclarations",
|
|
207
|
+
summary: "Widget TypeScript declarations",
|
|
208
|
+
description:
|
|
209
|
+
"Returns ambient TypeScript declarations for window.Atlas. Fallback for embedders who load only the script tag without installing @useatlas/react.",
|
|
210
|
+
tags: ["Widget"],
|
|
211
|
+
security: [],
|
|
212
|
+
responses: {
|
|
213
|
+
"200": { description: "TypeScript ambient declarations", content: { "text/plain": { schema: { type: "string" } } } },
|
|
1620
214
|
},
|
|
1621
215
|
},
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
{ name: "Query", description: "Synchronous JSON query endpoint" },
|
|
1625
|
-
{ name: "Conversations", description: "Conversation history CRUD operations" },
|
|
1626
|
-
{ name: "Health", description: "Service health checks" },
|
|
1627
|
-
{ name: "Actions", description: "Approval-gated write operations (requires ATLAS_ACTIONS_ENABLED=true)" },
|
|
1628
|
-
{ name: "Scheduled Tasks", description: "Recurring query tasks with cron scheduling (requires ATLAS_SCHEDULER_ENABLED=true)" },
|
|
1629
|
-
{ name: "Auth", description: "Authentication routes (managed auth via Better Auth)" },
|
|
1630
|
-
{ name: "Slack", description: "Slack integration (requires SLACK_SIGNING_SECRET)" },
|
|
1631
|
-
{ name: "Admin", description: "Admin console API (requires admin role)" },
|
|
1632
|
-
],
|
|
1633
|
-
};
|
|
1634
|
-
}
|
|
1635
|
-
|
|
1636
|
-
let cachedSpec: Record<string, unknown> | null = null;
|
|
216
|
+
},
|
|
217
|
+
};
|
|
1637
218
|
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
}
|
|
1642
|
-
|
|
1643
|
-
});
|
|
219
|
+
/** Static tag definitions for auth and widget. */
|
|
220
|
+
export const staticTags = [
|
|
221
|
+
{ name: "Auth", description: "Authentication routes (managed auth via Better Auth)" },
|
|
222
|
+
{ name: "Widget", description: "Embeddable chat widget (host page, loader script, assets)" },
|
|
223
|
+
];
|
|
1644
224
|
|
|
1645
|
-
|
|
225
|
+
/** Security scheme used across the API. */
|
|
226
|
+
export const securitySchemes = {
|
|
227
|
+
bearerAuth: {
|
|
228
|
+
type: "http" as const,
|
|
229
|
+
scheme: "bearer",
|
|
230
|
+
description: "API key or JWT token. Pass via Authorization: Bearer <token>.",
|
|
231
|
+
},
|
|
232
|
+
};
|