@promptbook/cli 0.104.0-8 → 0.104.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -4
- package/esm/index.es.js +261 -131
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +0 -6
- package/esm/typings/src/_packages/core.index.d.ts +8 -6
- package/esm/typings/src/_packages/types.index.d.ts +8 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +24 -0
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +12 -2
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.tools.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.closed.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/save/_common/string_chat_format_name.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +6 -3
- package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +5 -1
- package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +5 -1
- package/esm/typings/src/book-components/icons/AboutIcon.d.ts +5 -1
- package/esm/typings/src/book-components/icons/AttachmentIcon.d.ts +6 -2
- package/esm/typings/src/book-components/icons/CameraIcon.d.ts +6 -2
- package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +5 -1
- package/esm/typings/src/book-components/icons/MenuIcon.d.ts +5 -1
- package/esm/typings/src/book-components/icons/SaveIcon.d.ts +6 -2
- package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +1 -1
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +18 -12
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +6 -3
- package/esm/typings/src/commands/_common/types/Command.d.ts +1 -1
- package/esm/typings/src/commitments/META/META_DESCRIPTION.d.ts +41 -0
- package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +2 -2
- package/esm/typings/src/commitments/_base/BookCommitment.d.ts +1 -1
- package/esm/typings/src/config.d.ts +8 -1
- package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/countUsage.d.ts +8 -4
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +1 -1
- package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +12 -8
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +7 -1
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/utils/mapToolsToOpenAi.d.ts +8 -0
- package/esm/typings/src/remote-server/ui/ServerApp.d.ts +5 -1
- package/esm/typings/src/scrapers/_common/utils/promptbookFetch.test.d.ts +1 -0
- package/esm/typings/src/search-engines/SearchEngine.d.ts +9 -0
- package/esm/typings/src/search-engines/SearchResult.d.ts +18 -0
- package/esm/typings/src/search-engines/bing/BingSearchEngine.d.ts +15 -0
- package/esm/typings/src/search-engines/dummy/DummySearchEngine.d.ts +15 -0
- package/esm/typings/src/types/LlmToolDefinition.d.ts +20 -0
- package/esm/typings/src/types/ModelRequirements.d.ts +13 -0
- package/esm/typings/src/types/typeAliasEmoji.d.ts +2 -2
- package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +7 -2
- package/esm/typings/src/utils/random/$randomItem.d.ts +1 -1
- package/esm/typings/src/utils/random/$randomSeed.d.ts +1 -1
- package/esm/typings/src/utils/validators/url/isValidAgentUrl.d.ts +16 -0
- package/esm/typings/src/utils/validators/url/isValidAgentUrl.test.d.ts +1 -0
- package/esm/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +2 -1
- package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +4 -3
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +261 -131
- package/umd/index.umd.js.map +1 -1
- package/apps/agents-server/README.md +0 -3
- package/apps/agents-server/TODO.txt +0 -7
- package/apps/agents-server/config.ts +0 -128
- package/apps/agents-server/next.config.ts +0 -45
- package/apps/agents-server/package.json +0 -16
- package/apps/agents-server/postcss.config.mjs +0 -8
- package/apps/agents-server/public/.gitkeep +0 -0
- package/apps/agents-server/public/favicon.ico +0 -0
- package/apps/agents-server/public/fonts/OpenMoji-black-glyf.woff2 +0 -0
- package/apps/agents-server/public/fonts/OpenMoji-color-cbdt.woff2 +0 -0
- package/apps/agents-server/public/logo-blue-white-256.png +0 -0
- package/apps/agents-server/public/sw.js +0 -16
- package/apps/agents-server/public/swagger.json +0 -115
- package/apps/agents-server/scripts/generate-reserved-paths/generate-reserved-paths.ts +0 -54
- package/apps/agents-server/scripts/generate-reserved-paths/tsconfig.json +0 -19
- package/apps/agents-server/src/app/AddAgentButton.tsx +0 -41
- package/apps/agents-server/src/app/[agentName]/[...rest]/page.tsx +0 -11
- package/apps/agents-server/src/app/[agentName]/page.tsx +0 -1
- package/apps/agents-server/src/app/actions.ts +0 -65
- package/apps/agents-server/src/app/admin/api-tokens/ApiTokensClient.tsx +0 -186
- package/apps/agents-server/src/app/admin/api-tokens/page.tsx +0 -13
- package/apps/agents-server/src/app/admin/browser-test/BrowserTestClient.tsx +0 -85
- package/apps/agents-server/src/app/admin/browser-test/page.tsx +0 -13
- package/apps/agents-server/src/app/admin/chat-feedback/ChatFeedbackClient.tsx +0 -561
- package/apps/agents-server/src/app/admin/chat-feedback/page.tsx +0 -22
- package/apps/agents-server/src/app/admin/chat-history/ChatHistoryClient.tsx +0 -591
- package/apps/agents-server/src/app/admin/chat-history/page.tsx +0 -21
- package/apps/agents-server/src/app/admin/messages/MessagesClient.tsx +0 -294
- package/apps/agents-server/src/app/admin/messages/page.tsx +0 -13
- package/apps/agents-server/src/app/admin/messages/send-email/SendEmailClient.tsx +0 -104
- package/apps/agents-server/src/app/admin/messages/send-email/actions.ts +0 -35
- package/apps/agents-server/src/app/admin/messages/send-email/page.tsx +0 -13
- package/apps/agents-server/src/app/admin/metadata/MetadataClient.tsx +0 -481
- package/apps/agents-server/src/app/admin/metadata/page.tsx +0 -13
- package/apps/agents-server/src/app/admin/models/page.tsx +0 -22
- package/apps/agents-server/src/app/admin/users/[userId]/UserDetailClient.tsx +0 -131
- package/apps/agents-server/src/app/admin/users/[userId]/page.tsx +0 -21
- package/apps/agents-server/src/app/admin/users/page.tsx +0 -18
- package/apps/agents-server/src/app/agents/[agentName]/AgentChatWrapper.tsx +0 -92
- package/apps/agents-server/src/app/agents/[agentName]/AgentOptionsMenu.tsx +0 -356
- package/apps/agents-server/src/app/agents/[agentName]/AgentProfileChat.tsx +0 -134
- package/apps/agents-server/src/app/agents/[agentName]/AgentProfileWrapper.tsx +0 -90
- package/apps/agents-server/src/app/agents/[agentName]/AgentUrlCopy.tsx +0 -40
- package/apps/agents-server/src/app/agents/[agentName]/ClearAgentChatFeedbackButton.tsx +0 -63
- package/apps/agents-server/src/app/agents/[agentName]/ClearAgentChatHistoryButton.tsx +0 -63
- package/apps/agents-server/src/app/agents/[agentName]/CloneAgentButton.tsx +0 -41
- package/apps/agents-server/src/app/agents/[agentName]/CopyField.tsx +0 -44
- package/apps/agents-server/src/app/agents/[agentName]/InstallPwaButton.tsx +0 -74
- package/apps/agents-server/src/app/agents/[agentName]/ServiceWorkerRegister.tsx +0 -24
- package/apps/agents-server/src/app/agents/[agentName]/TODO.txt +0 -1
- package/apps/agents-server/src/app/agents/[agentName]/_utils.ts +0 -38
- package/apps/agents-server/src/app/agents/[agentName]/agentLinks.tsx +0 -80
- package/apps/agents-server/src/app/agents/[agentName]/api/agents/route.ts +0 -58
- package/apps/agents-server/src/app/agents/[agentName]/api/book/route.ts +0 -88
- package/apps/agents-server/src/app/agents/[agentName]/api/book/test.http +0 -37
- package/apps/agents-server/src/app/agents/[agentName]/api/chat/route.ts +0 -194
- package/apps/agents-server/src/app/agents/[agentName]/api/feedback/route.ts +0 -54
- package/apps/agents-server/src/app/agents/[agentName]/api/mcp/route.ts +0 -198
- package/apps/agents-server/src/app/agents/[agentName]/api/modelRequirements/TODO.txt +0 -1
- package/apps/agents-server/src/app/agents/[agentName]/api/modelRequirements/route.ts +0 -55
- package/apps/agents-server/src/app/agents/[agentName]/api/modelRequirements/systemMessage/route.ts +0 -47
- package/apps/agents-server/src/app/agents/[agentName]/api/openai/chat/completions/route.ts +0 -10
- package/apps/agents-server/src/app/agents/[agentName]/api/openai/models/route.ts +0 -93
- package/apps/agents-server/src/app/agents/[agentName]/api/openai/v1/chat/completions/route.ts +0 -10
- package/apps/agents-server/src/app/agents/[agentName]/api/openai/v1/models/route.ts +0 -93
- package/apps/agents-server/src/app/agents/[agentName]/api/openrouter/chat/completions/route.ts +0 -10
- package/apps/agents-server/src/app/agents/[agentName]/api/profile/route.ts +0 -80
- package/apps/agents-server/src/app/agents/[agentName]/api/voice/route.ts +0 -184
- package/apps/agents-server/src/app/agents/[agentName]/book/BookEditorWrapper.tsx +0 -143
- package/apps/agents-server/src/app/agents/[agentName]/book/page.tsx +0 -48
- package/apps/agents-server/src/app/agents/[agentName]/book+chat/AgentBookAndChat.tsx +0 -75
- package/apps/agents-server/src/app/agents/[agentName]/book+chat/AgentBookAndChatComponent.tsx.todo +0 -160
- package/apps/agents-server/src/app/agents/[agentName]/book+chat/page.tsx +0 -45
- package/apps/agents-server/src/app/agents/[agentName]/book+chat/page.tsx.todo +0 -21
- package/apps/agents-server/src/app/agents/[agentName]/chat/AgentChatWrapper.tsx +0 -68
- package/apps/agents-server/src/app/agents/[agentName]/chat/page.tsx +0 -45
- package/apps/agents-server/src/app/agents/[agentName]/code/api/route.ts +0 -68
- package/apps/agents-server/src/app/agents/[agentName]/code/page.tsx +0 -223
- package/apps/agents-server/src/app/agents/[agentName]/generateAgentMetadata.ts +0 -51
- package/apps/agents-server/src/app/agents/[agentName]/history/RestoreVersionButton.tsx +0 -46
- package/apps/agents-server/src/app/agents/[agentName]/history/actions.ts +0 -12
- package/apps/agents-server/src/app/agents/[agentName]/history/page.tsx +0 -62
- package/apps/agents-server/src/app/agents/[agentName]/images/default-avatar.png/getAgentDefaultAvatarPrompt.ts +0 -31
- package/apps/agents-server/src/app/agents/[agentName]/images/default-avatar.png/route.ts +0 -157
- package/apps/agents-server/src/app/agents/[agentName]/images/icon-256.png/route.tsx +0 -92
- package/apps/agents-server/src/app/agents/[agentName]/images/page.tsx +0 -200
- package/apps/agents-server/src/app/agents/[agentName]/images/screenshot-fullhd.png/route.tsx +0 -93
- package/apps/agents-server/src/app/agents/[agentName]/images/screenshot-phone.png/route.tsx +0 -93
- package/apps/agents-server/src/app/agents/[agentName]/integration/SdkCodeTabs.tsx +0 -31
- package/apps/agents-server/src/app/agents/[agentName]/integration/WebsiteIntegrationTabs.tsx +0 -26
- package/apps/agents-server/src/app/agents/[agentName]/integration/page.tsx +0 -326
- package/apps/agents-server/src/app/agents/[agentName]/layout.tsx +0 -41
- package/apps/agents-server/src/app/agents/[agentName]/links/page.tsx +0 -189
- package/apps/agents-server/src/app/agents/[agentName]/opengraph-image.tsx +0 -111
- package/apps/agents-server/src/app/agents/[agentName]/page.tsx +0 -114
- package/apps/agents-server/src/app/agents/[agentName]/system-message/page.tsx +0 -100
- package/apps/agents-server/src/app/agents/[agentName]/website-integration/page.tsx +0 -89
- package/apps/agents-server/src/app/agents/page.tsx +0 -11
- package/apps/agents-server/src/app/api/admin-email/route.ts +0 -12
- package/apps/agents-server/src/app/api/agents/[agentName]/clone/route.ts +0 -45
- package/apps/agents-server/src/app/api/agents/[agentName]/restore/route.ts +0 -19
- package/apps/agents-server/src/app/api/agents/[agentName]/route.ts +0 -60
- package/apps/agents-server/src/app/api/agents/route.ts +0 -68
- package/apps/agents-server/src/app/api/api-tokens/route.ts +0 -75
- package/apps/agents-server/src/app/api/auth/change-password/route.ts +0 -75
- package/apps/agents-server/src/app/api/auth/login/route.ts +0 -27
- package/apps/agents-server/src/app/api/auth/logout/route.ts +0 -7
- package/apps/agents-server/src/app/api/browser-test/screenshot/route.ts +0 -30
- package/apps/agents-server/src/app/api/chat/route.ts +0 -32
- package/apps/agents-server/src/app/api/chat-feedback/[id]/route.ts +0 -38
- package/apps/agents-server/src/app/api/chat-feedback/export/route.ts +0 -55
- package/apps/agents-server/src/app/api/chat-feedback/route.ts +0 -157
- package/apps/agents-server/src/app/api/chat-history/[id]/route.ts +0 -37
- package/apps/agents-server/src/app/api/chat-history/export/route.ts +0 -55
- package/apps/agents-server/src/app/api/chat-history/route.ts +0 -147
- package/apps/agents-server/src/app/api/chat-streaming/route.ts +0 -48
- package/apps/agents-server/src/app/api/docs/book.md/route.ts +0 -61
- package/apps/agents-server/src/app/api/emails/incoming/sendgrid/route.ts +0 -48
- package/apps/agents-server/src/app/api/embed.js/route.ts +0 -113
- package/apps/agents-server/src/app/api/federated-agents/route.ts +0 -29
- package/apps/agents-server/src/app/api/images/[filename]/route.ts +0 -107
- package/apps/agents-server/src/app/api/long-running-task/route.ts +0 -7
- package/apps/agents-server/src/app/api/long-streaming/route.ts +0 -20
- package/apps/agents-server/src/app/api/messages/route.ts +0 -102
- package/apps/agents-server/src/app/api/metadata/route.ts +0 -115
- package/apps/agents-server/src/app/api/openai/v1/chat/completions/route.ts +0 -6
- package/apps/agents-server/src/app/api/openai/v1/models/route.ts +0 -65
- package/apps/agents-server/src/app/api/upload/route.ts +0 -166
- package/apps/agents-server/src/app/api/users/[username]/route.ts +0 -75
- package/apps/agents-server/src/app/api/users/route.ts +0 -71
- package/apps/agents-server/src/app/docs/[docId]/page.tsx +0 -42
- package/apps/agents-server/src/app/docs/page.tsx +0 -59
- package/apps/agents-server/src/app/embed/layout.tsx +0 -31
- package/apps/agents-server/src/app/embed/page.tsx +0 -37
- package/apps/agents-server/src/app/globals.css +0 -383
- package/apps/agents-server/src/app/humans.txt/route.ts +0 -15
- package/apps/agents-server/src/app/layout.tsx +0 -144
- package/apps/agents-server/src/app/manifest.ts +0 -114
- package/apps/agents-server/src/app/not-found.tsx +0 -5
- package/apps/agents-server/src/app/page.tsx +0 -144
- package/apps/agents-server/src/app/recycle-bin/RestoreAgentButton.tsx +0 -40
- package/apps/agents-server/src/app/recycle-bin/actions.ts +0 -33
- package/apps/agents-server/src/app/recycle-bin/page.tsx +0 -44
- package/apps/agents-server/src/app/restricted/page.tsx +0 -33
- package/apps/agents-server/src/app/robots.txt/route.ts +0 -15
- package/apps/agents-server/src/app/security.txt/route.ts +0 -15
- package/apps/agents-server/src/app/sitemap.xml/route.ts +0 -39
- package/apps/agents-server/src/app/swagger/page.tsx +0 -14
- package/apps/agents-server/src/app/test/og-image/README.md +0 -1
- package/apps/agents-server/src/app/test/og-image/opengraph-image.tsx +0 -37
- package/apps/agents-server/src/app/test/og-image/page.tsx +0 -22
- package/apps/agents-server/src/components/AgentProfile/AgentProfile.tsx +0 -267
- package/apps/agents-server/src/components/AgentProfile/AgentProfileFromSource.tsx +0 -23
- package/apps/agents-server/src/components/AgentProfile/AgentQrCode.tsx +0 -62
- package/apps/agents-server/src/components/AgentProfile/QrCodeModal.tsx +0 -89
- package/apps/agents-server/src/components/AgentProfile/useAgentBackground.ts +0 -97
- package/apps/agents-server/src/components/Auth/AuthControls.tsx +0 -124
- package/apps/agents-server/src/components/ChangePasswordDialog/ChangePasswordDialog.tsx +0 -41
- package/apps/agents-server/src/components/ChangePasswordForm/ChangePasswordForm.tsx +0 -159
- package/apps/agents-server/src/components/DeletedAgentBanner.tsx +0 -26
- package/apps/agents-server/src/components/DocsToolbar/DocsToolbar.tsx +0 -38
- package/apps/agents-server/src/components/DocumentationContent/DocumentationContent.tsx +0 -90
- package/apps/agents-server/src/components/ErrorPage/ErrorPage.tsx +0 -33
- package/apps/agents-server/src/components/Footer/Footer.tsx +0 -175
- package/apps/agents-server/src/components/ForbiddenPage/ForbiddenPage.tsx +0 -15
- package/apps/agents-server/src/components/ForgottenPasswordDialog/ForgottenPasswordDialog.tsx +0 -61
- package/apps/agents-server/src/components/Header/Header.tsx +0 -742
- package/apps/agents-server/src/components/Homepage/AgentCard.tsx +0 -182
- package/apps/agents-server/src/components/Homepage/AgentsList.tsx +0 -136
- package/apps/agents-server/src/components/Homepage/Card.tsx +0 -18
- package/apps/agents-server/src/components/Homepage/DeletedAgentsList.tsx +0 -66
- package/apps/agents-server/src/components/Homepage/ExternalAgentsSection.tsx +0 -30
- package/apps/agents-server/src/components/Homepage/ExternalAgentsSectionClient.tsx +0 -192
- package/apps/agents-server/src/components/Homepage/ModelCard.tsx +0 -29
- package/apps/agents-server/src/components/Homepage/ModelsSection.tsx +0 -75
- package/apps/agents-server/src/components/Homepage/Section.tsx +0 -17
- package/apps/agents-server/src/components/Homepage/TechInfoCard.tsx +0 -20
- package/apps/agents-server/src/components/LayoutWrapper/LayoutWrapper.tsx +0 -58
- package/apps/agents-server/src/components/LoginDialog/LoginDialog.tsx +0 -41
- package/apps/agents-server/src/components/LoginForm/LoginForm.tsx +0 -158
- package/apps/agents-server/src/components/NotFoundPage/NotFoundPage.tsx +0 -22
- package/apps/agents-server/src/components/OpenMojiIcon/OpenMojiIcon.tsx +0 -29
- package/apps/agents-server/src/components/Portal/Portal.tsx +0 -38
- package/apps/agents-server/src/components/PrintHeader/PrintHeader.tsx +0 -18
- package/apps/agents-server/src/components/RegisterUserDialog/RegisterUserDialog.tsx +0 -61
- package/apps/agents-server/src/components/UsersList/UsersList.tsx +0 -141
- package/apps/agents-server/src/components/UsersList/useUsersAdmin.ts +0 -139
- package/apps/agents-server/src/components/VercelDeploymentCard/VercelDeploymentCard.tsx +0 -57
- package/apps/agents-server/src/components/_utils/generateMetaTxt.ts +0 -30
- package/apps/agents-server/src/components/_utils/headlessParam.tsx +0 -40
- package/apps/agents-server/src/database/$getTableName.ts +0 -18
- package/apps/agents-server/src/database/$provideSupabase.ts +0 -29
- package/apps/agents-server/src/database/$provideSupabaseForBrowser.ts +0 -41
- package/apps/agents-server/src/database/$provideSupabaseForServer.ts +0 -48
- package/apps/agents-server/src/database/$provideSupabaseForWorker.ts +0 -43
- package/apps/agents-server/src/database/getMetadata.ts +0 -31
- package/apps/agents-server/src/database/metadataDefaults.ts +0 -93
- package/apps/agents-server/src/database/migrate.ts +0 -164
- package/apps/agents-server/src/database/migrations/2025-11-0001-initial-schema.sql +0 -161
- package/apps/agents-server/src/database/migrations/2025-11-0002-metadata-table.sql +0 -14
- package/apps/agents-server/src/database/migrations/2025-12-0010-llm-cache.sql +0 -12
- package/apps/agents-server/src/database/migrations/2025-12-0060-api-tokens.sql +0 -13
- package/apps/agents-server/src/database/migrations/2025-12-0070-chat-history-source.sql +0 -2
- package/apps/agents-server/src/database/migrations/2025-12-0240-agent-public-id.sql +0 -3
- package/apps/agents-server/src/database/migrations/2025-12-0360-agent-deleted-at.sql +0 -1
- package/apps/agents-server/src/database/migrations/2025-12-0370-image-table.sql +0 -19
- package/apps/agents-server/src/database/migrations/2025-12-0380-agent-visibility.sql +0 -1
- package/apps/agents-server/src/database/migrations/2025-12-0390-upload-tracking.sql +0 -20
- package/apps/agents-server/src/database/migrations/2025-12-0401-file-upload-status.sql +0 -13
- package/apps/agents-server/src/database/migrations/2025-12-0402-message-table.sql +0 -42
- package/apps/agents-server/src/database/migrations/2025-12-0640-openai-assistant-cache.sql +0 -12
- package/apps/agents-server/src/database/schema.ts +0 -508
- package/apps/agents-server/src/deamons/longRunningTask.ts +0 -37
- package/apps/agents-server/src/generated/reservedPaths.ts +0 -32
- package/apps/agents-server/src/message-providers/email/_common/Email.ts +0 -73
- package/apps/agents-server/src/message-providers/email/_common/utils/TODO.txt +0 -1
- package/apps/agents-server/src/message-providers/email/_common/utils/parseEmailAddress.test.ts.todo +0 -108
- package/apps/agents-server/src/message-providers/email/_common/utils/parseEmailAddress.ts +0 -62
- package/apps/agents-server/src/message-providers/email/_common/utils/parseEmailAddresses.test.ts.todo +0 -117
- package/apps/agents-server/src/message-providers/email/_common/utils/parseEmailAddresses.ts +0 -19
- package/apps/agents-server/src/message-providers/email/_common/utils/stringifyEmailAddress.test.ts.todo +0 -119
- package/apps/agents-server/src/message-providers/email/_common/utils/stringifyEmailAddress.ts +0 -19
- package/apps/agents-server/src/message-providers/email/_common/utils/stringifyEmailAddresses.test.ts.todo +0 -74
- package/apps/agents-server/src/message-providers/email/_common/utils/stringifyEmailAddresses.ts +0 -14
- package/apps/agents-server/src/message-providers/email/sendgrid/SendgridMessageProvider.ts +0 -44
- package/apps/agents-server/src/message-providers/email/sendgrid/parseInboundSendgridEmail.ts +0 -49
- package/apps/agents-server/src/message-providers/email/zeptomail/ZeptomailMessageProvider.ts +0 -51
- package/apps/agents-server/src/message-providers/index.ts +0 -13
- package/apps/agents-server/src/message-providers/interfaces/MessageProvider.ts +0 -11
- package/apps/agents-server/src/middleware.ts +0 -301
- package/apps/agents-server/src/tools/$provideAgentCollectionForServer.ts +0 -54
- package/apps/agents-server/src/tools/$provideBrowserForServer.ts +0 -29
- package/apps/agents-server/src/tools/$provideCdnForServer.ts +0 -41
- package/apps/agents-server/src/tools/$provideExecutionToolsForServer.ts +0 -117
- package/apps/agents-server/src/tools/$provideOpenAiAssistantExecutionToolsForServer.ts +0 -35
- package/apps/agents-server/src/tools/$provideServer.ts +0 -39
- package/apps/agents-server/src/utils/auth.ts +0 -133
- package/apps/agents-server/src/utils/authenticateUser.ts +0 -42
- package/apps/agents-server/src/utils/cache/SupabaseCacheStorage.ts +0 -55
- package/apps/agents-server/src/utils/cdn/classes/DigitalOceanSpaces.ts +0 -119
- package/apps/agents-server/src/utils/cdn/classes/TrackedFilesStorage.ts +0 -57
- package/apps/agents-server/src/utils/cdn/classes/VercelBlobStorage.ts +0 -68
- package/apps/agents-server/src/utils/cdn/interfaces/IFilesStorage.ts +0 -50
- package/apps/agents-server/src/utils/cdn/interfaces/IStorage.ts +0 -14
- package/apps/agents-server/src/utils/cdn/utils/getUserFileCdnKey.ts +0 -28
- package/apps/agents-server/src/utils/cdn/utils/nameToSubfolderPath.ts +0 -9
- package/apps/agents-server/src/utils/cdn/utils/nextRequestToNodeRequest.ts +0 -27
- package/apps/agents-server/src/utils/chatFeedbackAdmin.ts +0 -96
- package/apps/agents-server/src/utils/chatHistoryAdmin.ts +0 -96
- package/apps/agents-server/src/utils/content/extractBodyContentFromHtml.ts +0 -19
- package/apps/agents-server/src/utils/convertToCsv.ts +0 -31
- package/apps/agents-server/src/utils/getCurrentUser.ts +0 -32
- package/apps/agents-server/src/utils/getEffectiveFederatedServers.ts +0 -22
- package/apps/agents-server/src/utils/getFederatedAgents.ts +0 -89
- package/apps/agents-server/src/utils/getFederatedServersFromMetadata.ts +0 -10
- package/apps/agents-server/src/utils/getUserIdFromRequest.ts +0 -35
- package/apps/agents-server/src/utils/getVisibleCommitmentDefinitions.ts +0 -12
- package/apps/agents-server/src/utils/handleChatCompletion.ts +0 -415
- package/apps/agents-server/src/utils/isIpAllowed.ts +0 -101
- package/apps/agents-server/src/utils/isUserAdmin.ts +0 -31
- package/apps/agents-server/src/utils/messages/sendMessage.ts +0 -91
- package/apps/agents-server/src/utils/messagesAdmin.ts +0 -72
- package/apps/agents-server/src/utils/normalization/filenameToPrompt.test.ts +0 -36
- package/apps/agents-server/src/utils/normalization/filenameToPrompt.ts +0 -25
- package/apps/agents-server/src/utils/resolveInheritedAgentSource.ts +0 -100
- package/apps/agents-server/src/utils/session.ts +0 -50
- package/apps/agents-server/src/utils/validateApiKey.ts +0 -124
- package/apps/agents-server/src/utils/validators/validateMimeType.ts +0 -24
- package/apps/agents-server/tailwind.config.ts +0 -26
- package/apps/agents-server/tsconfig.json +0 -29
- package/apps/agents-server/vercel.json +0 -7
- package/esm/typings/servers.d.ts +0 -50
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
export type MetadataType = 'TEXT_SINGLE_LINE' | 'TEXT' | 'NUMBER' | 'BOOLEAN' | 'IMAGE_URL' | 'IP_RANGE';
|
|
2
|
-
|
|
3
|
-
export const metadataDefaults = [
|
|
4
|
-
{
|
|
5
|
-
key: 'SERVER_NAME',
|
|
6
|
-
value: 'Promptbook Agents Server',
|
|
7
|
-
note: 'The name of the server displayed in the heading bar',
|
|
8
|
-
type: 'TEXT_SINGLE_LINE',
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
key: 'SERVER_DESCRIPTION',
|
|
12
|
-
value: 'Agents server powered by Promptbook',
|
|
13
|
-
note: 'The description of the server displayed in the search engine results',
|
|
14
|
-
type: 'TEXT',
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
key: 'SERVER_LOGO_URL',
|
|
18
|
-
value: '',
|
|
19
|
-
note: 'The URL of the logo displayed in the heading bar',
|
|
20
|
-
type: 'IMAGE_URL',
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
key: 'SERVER_FAVICON_URL',
|
|
24
|
-
value: '',
|
|
25
|
-
note: 'The URL of the favicon',
|
|
26
|
-
type: 'IMAGE_URL',
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
key: 'RESTRICT_IP',
|
|
30
|
-
value: '',
|
|
31
|
-
note: 'Comma separated list of allowed IPs or CIDR ranges. If set, only clients from these IPs are allowed to access the server.',
|
|
32
|
-
type: 'IP_RANGE',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
key: 'FEDERATED_SERVERS',
|
|
36
|
-
value: '',
|
|
37
|
-
note: 'Comma separated list of federated servers URLs. The server will look to all federated servers and list their agents.',
|
|
38
|
-
type: 'TEXT',
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
key: 'SHOW_FEDERATED_SERVERS_PUBLICLY',
|
|
42
|
-
value: 'false',
|
|
43
|
-
note: 'Whether to show federated servers and their agents to anonymous users. When false, federated servers are only visible to authenticated users.',
|
|
44
|
-
type: 'BOOLEAN',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
key: 'IS_EXPERIMENTAL_VOICE_CALLING_ENABLED',
|
|
48
|
-
value: 'false',
|
|
49
|
-
note: 'Enable or disable voice calling features for agents. When disabled, voice API endpoints will return 403 Forbidden.',
|
|
50
|
-
type: 'BOOLEAN',
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
key: 'IS_FOOTER_SHOWN',
|
|
54
|
-
value: 'true',
|
|
55
|
-
note: 'Show or hide the footer.',
|
|
56
|
-
type: 'BOOLEAN',
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
key: 'FOOTER_LINKS',
|
|
60
|
-
value: '[]',
|
|
61
|
-
note: 'Extra links to display in the footer, as a JSON array of objects with title and url properties.',
|
|
62
|
-
type: 'TEXT',
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
key: 'MAX_FILE_UPLOAD_SIZE_MB',
|
|
66
|
-
value: '50', // <- TODO: [🌲] To /config.ts
|
|
67
|
-
note: 'Maximum size of file that can be uploaded in MB.',
|
|
68
|
-
type: 'NUMBER',
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
key: 'NAME_POOL',
|
|
72
|
-
value: 'ENGLISH',
|
|
73
|
-
note: 'Language for generating new agent names. Possible values: ENGLISH, CZECH.',
|
|
74
|
-
type: 'TEXT_SINGLE_LINE',
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
key: 'ADMIN_EMAIL',
|
|
78
|
-
value: 'support@ptbk.io',
|
|
79
|
-
note: 'Administrator email address used for password reset and user registration requests.',
|
|
80
|
-
type: 'TEXT_SINGLE_LINE',
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
key: 'DEFAULT_AGENT_VISIBILITY',
|
|
84
|
-
value: 'PRIVATE',
|
|
85
|
-
note: 'Default visibility for new agents. Can be PUBLIC or PRIVATE.',
|
|
86
|
-
type: 'TEXT_SINGLE_LINE',
|
|
87
|
-
},
|
|
88
|
-
] as const satisfies ReadonlyArray<{
|
|
89
|
-
key: string;
|
|
90
|
-
value: string;
|
|
91
|
-
note: string;
|
|
92
|
-
type: MetadataType;
|
|
93
|
-
}>;
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import * as dotenv from 'dotenv';
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
import * as path from 'path';
|
|
4
|
-
import { Client } from 'pg';
|
|
5
|
-
|
|
6
|
-
dotenv.config();
|
|
7
|
-
|
|
8
|
-
async function migrate() {
|
|
9
|
-
console.info('🚀 Starting database migration');
|
|
10
|
-
|
|
11
|
-
// Parse CLI arguments for --only flag
|
|
12
|
-
const args = process.argv.slice(2);
|
|
13
|
-
let onlyPrefixes: string[] | null = null;
|
|
14
|
-
|
|
15
|
-
for (let i = 0; i < args.length; i++) {
|
|
16
|
-
if (args[i] === '--only' && args[i + 1]) {
|
|
17
|
-
onlyPrefixes = args[i + 1]
|
|
18
|
-
.split(',')
|
|
19
|
-
.map((p) => p.trim())
|
|
20
|
-
.filter((p) => p !== '');
|
|
21
|
-
break;
|
|
22
|
-
} else if (args[i]?.startsWith('--only=')) {
|
|
23
|
-
onlyPrefixes = args[i]
|
|
24
|
-
.substring('--only='.length)
|
|
25
|
-
.split(',')
|
|
26
|
-
.map((p) => p.trim())
|
|
27
|
-
.filter((p) => p !== '');
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// 1. Get configuration
|
|
33
|
-
const prefixesEnv = process.env.SUPABASE_MIGRATION_PREFIXES;
|
|
34
|
-
if (!prefixesEnv) {
|
|
35
|
-
console.warn('⚠️ SUPABASE_MIGRATION_PREFIXES is not defined. Skipping migration.');
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
let prefixes = prefixesEnv
|
|
39
|
-
.split(',')
|
|
40
|
-
.map((p) => p.trim())
|
|
41
|
-
.filter((p) => p !== '');
|
|
42
|
-
|
|
43
|
-
if (prefixes.length === 0) {
|
|
44
|
-
console.warn('⚠️ No prefixes found in SUPABASE_MIGRATION_PREFIXES. Skipping migration.');
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Filter prefixes if --only flag is provided
|
|
49
|
-
if (onlyPrefixes !== null) {
|
|
50
|
-
const invalidPrefixes = onlyPrefixes.filter((p) => !prefixes.includes(p));
|
|
51
|
-
if (invalidPrefixes.length > 0) {
|
|
52
|
-
console.error(`❌ Invalid prefixes specified in --only: ${invalidPrefixes.join(', ')}`);
|
|
53
|
-
console.error(` Available prefixes: ${prefixes.join(', ')}`);
|
|
54
|
-
process.exit(1);
|
|
55
|
-
}
|
|
56
|
-
prefixes = onlyPrefixes;
|
|
57
|
-
console.info(`🎯 Running migrations only for: ${prefixes.join(', ')}`);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const connectionString = process.env.POSTGRES_URL || process.env.DATABASE_URL;
|
|
61
|
-
if (!connectionString) {
|
|
62
|
-
console.error('❌ POSTGRES_URL or DATABASE_URL is not defined.');
|
|
63
|
-
process.exit(1);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
console.info(`📋 Found ${prefixes.length} prefixes to migrate: ${prefixes.join(', ')}`);
|
|
67
|
-
|
|
68
|
-
// 2. Connect to database
|
|
69
|
-
const client = new Client({
|
|
70
|
-
connectionString,
|
|
71
|
-
ssl: { rejectUnauthorized: false }, // Required for some Supabase/Heroku connections
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
try {
|
|
75
|
-
await client.connect();
|
|
76
|
-
console.info('🔌 Connected to database');
|
|
77
|
-
|
|
78
|
-
// 3. Read migration files
|
|
79
|
-
const migrationsDir = path.join(__dirname, 'migrations');
|
|
80
|
-
if (!fs.existsSync(migrationsDir)) {
|
|
81
|
-
console.error(`❌ Migrations directory not found at ${migrationsDir}`);
|
|
82
|
-
process.exit(1);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const migrationFiles = fs
|
|
86
|
-
.readdirSync(migrationsDir)
|
|
87
|
-
.filter((file) => file.endsWith('.sql'))
|
|
88
|
-
.sort(); // Ensure files are processed in order
|
|
89
|
-
|
|
90
|
-
console.info(`📂 Found ${migrationFiles.length} migration files`);
|
|
91
|
-
|
|
92
|
-
// 4. Iterate over prefixes and apply migrations
|
|
93
|
-
for (const prefix of prefixes) {
|
|
94
|
-
console.info(`\n🏗️ Migrating prefix: "${prefix}"`);
|
|
95
|
-
const migrationsTableName = `${prefix}Migrations`;
|
|
96
|
-
|
|
97
|
-
// 4.1 Create migrations table if not exists
|
|
98
|
-
const createMigrationsTableSql = `
|
|
99
|
-
CREATE TABLE IF NOT EXISTS "${migrationsTableName}" (
|
|
100
|
-
"filename" TEXT PRIMARY KEY,
|
|
101
|
-
"appliedAt" TIMESTAMP WITH TIME ZONE DEFAULT now()
|
|
102
|
-
);
|
|
103
|
-
`;
|
|
104
|
-
await client.query(createMigrationsTableSql);
|
|
105
|
-
|
|
106
|
-
// Enable RLS for migrations table
|
|
107
|
-
const enableRlsSql = `ALTER TABLE "${migrationsTableName}" ENABLE ROW LEVEL SECURITY;`;
|
|
108
|
-
await client.query(enableRlsSql);
|
|
109
|
-
|
|
110
|
-
// 4.2 Get applied migrations
|
|
111
|
-
const { rows: appliedMigrationsRows } = await client.query(
|
|
112
|
-
`SELECT "filename" FROM "${migrationsTableName}"`,
|
|
113
|
-
);
|
|
114
|
-
const appliedMigrations = new Set(appliedMigrationsRows.map((row) => row.filename));
|
|
115
|
-
|
|
116
|
-
// 4.3 Apply new migrations in one big transaction
|
|
117
|
-
let migrationError = null;
|
|
118
|
-
await client.query('BEGIN');
|
|
119
|
-
try {
|
|
120
|
-
for (const file of migrationFiles) {
|
|
121
|
-
if (appliedMigrations.has(file)) {
|
|
122
|
-
// console.info(` ⏭️ Skipping ${file} (already applied)`);
|
|
123
|
-
continue;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
console.info(` 🚀 Applying ${file}...`);
|
|
127
|
-
const filePath = path.join(migrationsDir, file);
|
|
128
|
-
let sql = fs.readFileSync(filePath, 'utf-8');
|
|
129
|
-
|
|
130
|
-
// Replace prefix placeholder
|
|
131
|
-
sql = sql.replace(/prefix_/g, prefix);
|
|
132
|
-
|
|
133
|
-
try {
|
|
134
|
-
await client.query(sql);
|
|
135
|
-
await client.query(`INSERT INTO "${migrationsTableName}" ("filename") VALUES ($1)`, [file]);
|
|
136
|
-
console.info(` ✅ Applied ${file}`);
|
|
137
|
-
} catch (error) {
|
|
138
|
-
console.error(` ❌ Failed to apply ${file}:`, error);
|
|
139
|
-
migrationError = error;
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
if (migrationError) {
|
|
144
|
-
await client.query('ROLLBACK');
|
|
145
|
-
throw migrationError;
|
|
146
|
-
} else {
|
|
147
|
-
await client.query('COMMIT');
|
|
148
|
-
}
|
|
149
|
-
} catch (error) {
|
|
150
|
-
await client.query('ROLLBACK');
|
|
151
|
-
throw error;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
console.info('\n🎉 All migrations completed successfully');
|
|
156
|
-
} catch (error) {
|
|
157
|
-
console.error('\n❌ Migration failed:', error);
|
|
158
|
-
process.exit(1);
|
|
159
|
-
} finally {
|
|
160
|
-
await client.end();
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
migrate();
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
CREATE TABLE IF NOT EXISTS "prefix_Agent" (
|
|
5
|
-
"id" BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
|
6
|
-
"agentName" TEXT NOT NULL,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
|
10
|
-
"updatedAt" TIMESTAMP WITH TIME ZONE NULL DEFAULT NULL,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"agentHash" TEXT NOT NULL,
|
|
14
|
-
"agentSource" TEXT NOT NULL,
|
|
15
|
-
"agentProfile" JSONB NOT NULL,
|
|
16
|
-
"promptbookEngineVersion" TEXT NOT NULL,
|
|
17
|
-
|
|
18
|
-
"usage" JSONB NULL,
|
|
19
|
-
"preparedModelRequirements" JSONB NULL,
|
|
20
|
-
"preparedExternals" JSONB NULL
|
|
21
|
-
);
|
|
22
|
-
-- Ensure uniqueness of agentName even on repeated schema application without duplicate constraint creation
|
|
23
|
-
CREATE UNIQUE INDEX IF NOT EXISTS "prefix_agent_agentname_key" ON "prefix_Agent" ("agentName");
|
|
24
|
-
COMMENT ON COLUMN "prefix_Agent"."agentName" IS 'The unique name of the agent derived from the first line of the `agentSource`, automatically updated on `agentSource` change';
|
|
25
|
-
COMMENT ON COLUMN "prefix_Agent"."agentHash" IS 'The hash of the `agentSource`, automatically updated on `agentSource` change';
|
|
26
|
-
COMMENT ON COLUMN "prefix_Agent"."agentSource" IS 'The source code of the agent';
|
|
27
|
-
COMMENT ON COLUMN "prefix_Agent"."agentProfile" IS 'The profile of the agent generated from the `agentSource`, automatically updated on `agentSource` change <- TODO: [🕛]';
|
|
28
|
-
COMMENT ON COLUMN "prefix_Agent"."promptbookEngineVersion" IS 'The version of the Promptbook engine used for last update of the agent';
|
|
29
|
-
COMMENT ON COLUMN "prefix_Agent"."usage" IS 'Usage and spending statistics for the agent';
|
|
30
|
-
COMMENT ON COLUMN "prefix_Agent"."preparedModelRequirements" IS 'The prepared model requirements for the agent, generated from the `agentSource` but not after every change (only on explicit request), there is `agentHash` to identify the version of the `agentSource` this was prepared from';
|
|
31
|
-
COMMENT ON COLUMN "prefix_Agent"."preparedExternals" IS 'The prepared externals for the agent, generated from the `agentSource` but not after every change (only on explicit request), there is `agentHash` to identify the version of the `agentSource` this was prepared from';
|
|
32
|
-
|
|
33
|
-
ALTER TABLE "prefix_Agent" ENABLE ROW LEVEL SECURITY;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
CREATE TABLE IF NOT EXISTS "prefix_AgentHistory" (
|
|
37
|
-
"id" BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
|
38
|
-
"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
|
39
|
-
|
|
40
|
-
"agentName" TEXT NOT NULL,
|
|
41
|
-
"agentHash" TEXT NOT NULL,
|
|
42
|
-
"previousAgentHash" TEXT NULL,
|
|
43
|
-
"agentSource" TEXT NOT NULL,
|
|
44
|
-
"promptbookEngineVersion" TEXT NOT NULL
|
|
45
|
-
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
CREATE INDEX IF NOT EXISTS "prefix_AgentHistory_agentName_idx" ON "prefix_AgentHistory" ("agentName");
|
|
49
|
-
CREATE INDEX IF NOT EXISTS "prefix_AgentHistory_agentHash_idx" ON "prefix_AgentHistory" ("agentHash");
|
|
50
|
-
|
|
51
|
-
ALTER TABLE "prefix_AgentHistory" ENABLE ROW LEVEL SECURITY;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
CREATE TABLE IF NOT EXISTS "prefix_ChatHistory" (
|
|
55
|
-
"id" BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
|
|
56
|
-
"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
|
57
|
-
|
|
58
|
-
"messageHash" TEXT NOT NULL,
|
|
59
|
-
"previousMessageHash" TEXT NULL,
|
|
60
|
-
"agentName" TEXT NOT NULL,
|
|
61
|
-
"agentHash" TEXT NOT NULL,
|
|
62
|
-
"message" JSONB NOT NULL,
|
|
63
|
-
|
|
64
|
-
-- Telemetry:
|
|
65
|
-
"promptbookEngineVersion" TEXT NULL,
|
|
66
|
-
"url" TEXT NULL,
|
|
67
|
-
"ip" TEXT NULL,
|
|
68
|
-
"userAgent" TEXT NULL,
|
|
69
|
-
"language" TEXT NULL,
|
|
70
|
-
"platform" TEXT NULL
|
|
71
|
-
);
|
|
72
|
-
COMMENT ON COLUMN "prefix_ChatHistory"."url" IS 'The URL where the chat was happening';
|
|
73
|
-
COMMENT ON COLUMN "prefix_ChatHistory"."ip" IS 'The IP address of the user';
|
|
74
|
-
COMMENT ON COLUMN "prefix_ChatHistory"."userAgent" IS 'The user agent (browser) of the user';
|
|
75
|
-
COMMENT ON COLUMN "prefix_ChatHistory"."language" IS 'The language (from the browser) of the user';
|
|
76
|
-
COMMENT ON COLUMN "prefix_ChatHistory"."platform" IS 'The platform of the user';
|
|
77
|
-
|
|
78
|
-
ALTER TABLE "prefix_ChatHistory" ENABLE ROW LEVEL SECURITY;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
CREATE TABLE IF NOT EXISTS "prefix_ChatFeedback" (
|
|
82
|
-
"id" BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
|
83
|
-
"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
|
84
|
-
|
|
85
|
-
"agentName" TEXT NOT NULL,
|
|
86
|
-
"agentHash" TEXT NOT NULL,
|
|
87
|
-
"rating" TEXT NULL,
|
|
88
|
-
"textRating" TEXT NULL,
|
|
89
|
-
"chatThread" TEXT NULL,
|
|
90
|
-
"userNote" TEXT NULL,
|
|
91
|
-
"expectedAnswer" TEXT NULL,
|
|
92
|
-
|
|
93
|
-
-- Telemetry:
|
|
94
|
-
"promptbookEngineVersion" TEXT NULL,
|
|
95
|
-
"url" TEXT NULL,
|
|
96
|
-
"ip" TEXT NULL,
|
|
97
|
-
"userAgent" TEXT NULL,
|
|
98
|
-
"language" TEXT NULL,
|
|
99
|
-
"platform" TEXT NULL
|
|
100
|
-
);
|
|
101
|
-
COMMENT ON COLUMN "prefix_ChatFeedback"."url" IS 'The URL where the chat was happening';
|
|
102
|
-
COMMENT ON COLUMN "prefix_ChatFeedback"."ip" IS 'The IP address of the user';
|
|
103
|
-
COMMENT ON COLUMN "prefix_ChatFeedback"."userAgent" IS 'The user agent (browser) of the user';
|
|
104
|
-
COMMENT ON COLUMN "prefix_ChatFeedback"."language" IS 'The language (from the browser) of the user';
|
|
105
|
-
COMMENT ON COLUMN "prefix_ChatFeedback"."platform" IS 'The platform of the user';
|
|
106
|
-
|
|
107
|
-
ALTER TABLE "prefix_ChatFeedback" ENABLE ROW LEVEL SECURITY;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
CREATE TABLE IF NOT EXISTS "prefix_User" (
|
|
111
|
-
"id" BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
|
112
|
-
"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
|
113
|
-
"updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
|
114
|
-
|
|
115
|
-
"username" TEXT NOT NULL,
|
|
116
|
-
"passwordHash" TEXT NOT NULL,
|
|
117
|
-
"isAdmin" BOOLEAN NOT NULL DEFAULT FALSE
|
|
118
|
-
);
|
|
119
|
-
CREATE UNIQUE INDEX IF NOT EXISTS "prefix_User_username_idx" ON "prefix_User" ("username");
|
|
120
|
-
|
|
121
|
-
ALTER TABLE "prefix_User" ENABLE ROW LEVEL SECURITY;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
/*
|
|
125
|
-
CREATE TABLE IF NOT EXISTS "prefix_AgentActionHistory" (
|
|
126
|
-
id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
|
|
127
|
-
createdAt TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
|
128
|
-
|
|
129
|
-
);
|
|
130
|
-
*/
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
/*
|
|
134
|
-
CREATE TABLE IF NOT EXISTS "prefix_Xxx" (
|
|
135
|
-
id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
|
|
136
|
-
);
|
|
137
|
-
*/
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
-- Foreign key relationships
|
|
141
|
-
-- Note: Using agentName as the foreign key reference since it's the unique identifier used across tables
|
|
142
|
-
ALTER TABLE "prefix_AgentHistory"
|
|
143
|
-
DROP CONSTRAINT IF EXISTS "prefix_AgentHistory_agentName_fkey",
|
|
144
|
-
ADD CONSTRAINT "prefix_AgentHistory_agentName_fkey"
|
|
145
|
-
FOREIGN KEY ("agentName")
|
|
146
|
-
REFERENCES "prefix_Agent"("agentName")
|
|
147
|
-
ON DELETE CASCADE;
|
|
148
|
-
|
|
149
|
-
ALTER TABLE "prefix_ChatHistory"
|
|
150
|
-
DROP CONSTRAINT IF EXISTS "prefix_ChatHistory_agentName_fkey",
|
|
151
|
-
ADD CONSTRAINT "prefix_ChatHistory_agentName_fkey"
|
|
152
|
-
FOREIGN KEY ("agentName")
|
|
153
|
-
REFERENCES "prefix_Agent"("agentName")
|
|
154
|
-
ON DELETE CASCADE;
|
|
155
|
-
|
|
156
|
-
ALTER TABLE "prefix_ChatFeedback"
|
|
157
|
-
DROP CONSTRAINT IF EXISTS "prefix_ChatFeedback_agentName_fkey",
|
|
158
|
-
ADD CONSTRAINT "prefix_ChatFeedback_agentName_fkey"
|
|
159
|
-
FOREIGN KEY ("agentName")
|
|
160
|
-
REFERENCES "prefix_Agent"("agentName")
|
|
161
|
-
ON DELETE CASCADE;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
CREATE TABLE IF NOT EXISTS "prefix_Metadata" (
|
|
5
|
-
"id" BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
|
6
|
-
"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
|
7
|
-
"updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
|
8
|
-
"key" TEXT NOT NULL,
|
|
9
|
-
"value" TEXT NOT NULL,
|
|
10
|
-
"note" TEXT NULL,
|
|
11
|
-
CONSTRAINT "prefix_Metadata_key_key" UNIQUE ("key")
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
ALTER TABLE "prefix_Metadata" ENABLE ROW LEVEL SECURITY;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
CREATE TABLE IF NOT EXISTS "prefix_LlmCache" (
|
|
2
|
-
"id" BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
|
3
|
-
"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
|
4
|
-
"updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
|
5
|
-
|
|
6
|
-
"hash" TEXT NOT NULL,
|
|
7
|
-
"value" JSONB NOT NULL
|
|
8
|
-
);
|
|
9
|
-
|
|
10
|
-
CREATE UNIQUE INDEX IF NOT EXISTS "prefix_LlmCache_hash_idx" ON "prefix_LlmCache" ("hash");
|
|
11
|
-
|
|
12
|
-
ALTER TABLE "prefix_LlmCache" ENABLE ROW LEVEL SECURITY;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
CREATE TABLE IF NOT EXISTS "prefix_ApiTokens" (
|
|
2
|
-
"id" BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
|
3
|
-
"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
|
4
|
-
"updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
|
5
|
-
|
|
6
|
-
"token" TEXT NOT NULL,
|
|
7
|
-
"note" TEXT,
|
|
8
|
-
"isRevoked" BOOLEAN NOT NULL DEFAULT FALSE
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
CREATE UNIQUE INDEX IF NOT EXISTS "prefix_ApiTokens_token_idx" ON "prefix_ApiTokens" ("token");
|
|
12
|
-
|
|
13
|
-
ALTER TABLE "prefix_ApiTokens" ENABLE ROW LEVEL SECURITY;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ALTER TABLE "prefix_Agent" ADD COLUMN "deletedAt" TEXT;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
CREATE TABLE IF NOT EXISTS "prefix_Image" (
|
|
2
|
-
"id" BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
|
3
|
-
"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
|
4
|
-
"updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
|
5
|
-
|
|
6
|
-
"filename" TEXT NOT NULL,
|
|
7
|
-
"prompt" TEXT NOT NULL,
|
|
8
|
-
"cdnUrl" TEXT NOT NULL,
|
|
9
|
-
"cdnKey" TEXT NOT NULL
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
CREATE UNIQUE INDEX IF NOT EXISTS "prefix_Image_filename_idx" ON "prefix_Image" ("filename");
|
|
13
|
-
|
|
14
|
-
ALTER TABLE "prefix_Image" ENABLE ROW LEVEL SECURITY;
|
|
15
|
-
|
|
16
|
-
COMMENT ON COLUMN "prefix_Image"."filename" IS 'The original filename requested (e.g., cat-sitting-on-keyboard.png)';
|
|
17
|
-
COMMENT ON COLUMN "prefix_Image"."prompt" IS 'The normalized prompt used to generate the image';
|
|
18
|
-
COMMENT ON COLUMN "prefix_Image"."cdnUrl" IS 'The full URL of the uploaded image in CDN';
|
|
19
|
-
COMMENT ON COLUMN "prefix_Image"."cdnKey" IS 'The key used to identify the image in CDN storage';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ALTER TABLE "prefix_Agent" ADD COLUMN "visibility" TEXT NOT NULL DEFAULT 'PRIVATE' CHECK ("visibility" IN ('PUBLIC', 'PRIVATE'));
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
CREATE TABLE IF NOT EXISTS "prefix_File" (
|
|
2
|
-
"id" BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
|
3
|
-
"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
|
4
|
-
|
|
5
|
-
"userId" BIGINT REFERENCES "prefix_User"("id"),
|
|
6
|
-
"fileName" TEXT NOT NULL,
|
|
7
|
-
"fileSize" BIGINT NOT NULL,
|
|
8
|
-
"fileType" TEXT NOT NULL,
|
|
9
|
-
"cdnUrl" TEXT NOT NULL,
|
|
10
|
-
"purpose" TEXT NOT NULL
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
ALTER TABLE "prefix_File" ENABLE ROW LEVEL SECURITY;
|
|
14
|
-
|
|
15
|
-
COMMENT ON COLUMN "prefix_File"."userId" IS 'Reference to the user who uploaded the file';
|
|
16
|
-
COMMENT ON COLUMN "prefix_File"."fileName" IS 'Original name of the uploaded file';
|
|
17
|
-
COMMENT ON COLUMN "prefix_File"."fileSize" IS 'Size of the file in bytes';
|
|
18
|
-
COMMENT ON COLUMN "prefix_File"."fileType" IS 'MIME type of the file';
|
|
19
|
-
COMMENT ON COLUMN "prefix_File"."cdnUrl" IS 'Public URL of the file in CDN';
|
|
20
|
-
COMMENT ON COLUMN "prefix_File"."purpose" IS 'Purpose of the upload (e.g. KNOWLEDGE, SERVER_FAVICON_URL)';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
-- Add status column to track file upload progress
|
|
2
|
-
ALTER TABLE "prefix_File" ADD COLUMN IF NOT EXISTS "status" TEXT NOT NULL DEFAULT 'COMPLETED';
|
|
3
|
-
|
|
4
|
-
-- Add check constraint for valid status values
|
|
5
|
-
-- ALTER TABLE "prefix_File" ADD CONSTRAINT "File_status_check" CHECK ("status" IN ('UPLOADING', 'COMPLETED', 'FAILED'));
|
|
6
|
-
|
|
7
|
-
-- Drop the column cdnUrl if it exists
|
|
8
|
-
ALTER TABLE "prefix_File" DROP COLUMN IF EXISTS "cdnUrl";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-- Add nullable columns storageUrl and shortUrl
|
|
12
|
-
ALTER TABLE "prefix_File" ADD COLUMN IF NOT EXISTS "storageUrl" TEXT NULL;
|
|
13
|
-
ALTER TABLE "prefix_File" ADD COLUMN IF NOT EXISTS "shortUrl" TEXT NULL;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
-- Table: Message
|
|
3
|
-
CREATE TABLE IF NOT EXISTS "prefix_Message" (
|
|
4
|
-
"id" BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
|
5
|
-
"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
|
6
|
-
"channel" TEXT NOT NULL,
|
|
7
|
-
"direction" TEXT NOT NULL,
|
|
8
|
-
"sender" JSONB NOT NULL,
|
|
9
|
-
"recipients" JSONB,
|
|
10
|
-
"content" TEXT NOT NULL,
|
|
11
|
-
"threadId" TEXT,
|
|
12
|
-
"metadata" JSONB
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
COMMENT ON TABLE "prefix_Message" IS 'A generic message structure for various communication channels';
|
|
16
|
-
COMMENT ON COLUMN "prefix_Message"."channel" IS 'The communication channel of the message (e.g. EMAIL, PROMPTBOOK_CHAT)';
|
|
17
|
-
COMMENT ON COLUMN "prefix_Message"."direction" IS 'Is the message send from the Promptbook or to the Promptbook';
|
|
18
|
-
COMMENT ON COLUMN "prefix_Message"."sender" IS 'Who sent the message';
|
|
19
|
-
COMMENT ON COLUMN "prefix_Message"."recipients" IS 'Who are the recipients of the message';
|
|
20
|
-
COMMENT ON COLUMN "prefix_Message"."content" IS 'The content of the message as markdown';
|
|
21
|
-
COMMENT ON COLUMN "prefix_Message"."threadId" IS 'The thread identifier the message belongs to';
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
-- Table: MessageSendAttempt
|
|
25
|
-
CREATE TABLE IF NOT EXISTS "prefix_MessageSendAttempt" (
|
|
26
|
-
"id" BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
|
27
|
-
"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
|
28
|
-
|
|
29
|
-
"messageId" BIGINT NOT NULL REFERENCES "prefix_Message"("id") ON DELETE CASCADE,
|
|
30
|
-
"providerName" TEXT NOT NULL,
|
|
31
|
-
"isSuccessful" BOOLEAN NOT NULL,
|
|
32
|
-
"raw" JSONB
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
COMMENT ON TABLE "prefix_MessageSendAttempt" IS 'Stores each attempt to send the message';
|
|
36
|
-
COMMENT ON COLUMN "prefix_MessageSendAttempt"."messageId" IS 'The message that was attempted to be sent';
|
|
37
|
-
COMMENT ON COLUMN "prefix_MessageSendAttempt"."providerName" IS 'The name of the provider used for sending';
|
|
38
|
-
COMMENT ON COLUMN "prefix_MessageSendAttempt"."isSuccessful" IS 'Whether the attempt was successful';
|
|
39
|
-
COMMENT ON COLUMN "prefix_MessageSendAttempt"."raw" IS 'Raw response or error from the provider';
|
|
40
|
-
|
|
41
|
-
ALTER TABLE "prefix_Message" ENABLE ROW LEVEL SECURITY;
|
|
42
|
-
ALTER TABLE "prefix_MessageSendAttempt" ENABLE ROW LEVEL SECURITY;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
CREATE TABLE IF NOT EXISTS "prefix_OpenAiAssistantCache" (
|
|
2
|
-
"id" BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
|
3
|
-
"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
|
4
|
-
"updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
|
5
|
-
|
|
6
|
-
"agentHash" TEXT NOT NULL,
|
|
7
|
-
"assistantId" TEXT NOT NULL
|
|
8
|
-
);
|
|
9
|
-
|
|
10
|
-
CREATE UNIQUE INDEX IF NOT EXISTS "prefix_OpenAiAssistantCache_agentHash_idx" ON "prefix_OpenAiAssistantCache" ("agentHash");
|
|
11
|
-
|
|
12
|
-
ALTER TABLE "prefix_OpenAiAssistantCache" ENABLE ROW LEVEL SECURITY;
|