@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,96 +0,0 @@
|
|
|
1
|
-
import type { AgentsServerDatabase } from '../database/schema';
|
|
2
|
-
|
|
3
|
-
export type ChatFeedbackRow = AgentsServerDatabase['public']['Tables']['ChatFeedback']['Row'];
|
|
4
|
-
export type ChatFeedbackSortField = 'createdAt' | 'agentName' | 'id';
|
|
5
|
-
export type ChatFeedbackSortOrder = 'asc' | 'desc';
|
|
6
|
-
|
|
7
|
-
export type ChatFeedbackListResponse = {
|
|
8
|
-
items: ChatFeedbackRow[];
|
|
9
|
-
total: number;
|
|
10
|
-
page: number;
|
|
11
|
-
pageSize: number;
|
|
12
|
-
sortBy: ChatFeedbackSortField;
|
|
13
|
-
sortOrder: ChatFeedbackSortOrder;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export type ChatFeedbackListParams = {
|
|
17
|
-
page?: number;
|
|
18
|
-
pageSize?: number;
|
|
19
|
-
agentName?: string;
|
|
20
|
-
search?: string;
|
|
21
|
-
sortBy?: ChatFeedbackSortField;
|
|
22
|
-
sortOrder?: ChatFeedbackSortOrder;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Build query string for chat feedback listing.
|
|
27
|
-
*
|
|
28
|
-
* Kept in a dedicated helper so it can be shared between the
|
|
29
|
-
* admin feedback page and other admin UIs (per-agent tools, etc.).
|
|
30
|
-
*/
|
|
31
|
-
function buildQuery(params: ChatFeedbackListParams): string {
|
|
32
|
-
const searchParams = new URLSearchParams();
|
|
33
|
-
|
|
34
|
-
if (params.page && params.page > 0) searchParams.set('page', String(params.page));
|
|
35
|
-
if (params.pageSize && params.pageSize > 0) searchParams.set('pageSize', String(params.pageSize));
|
|
36
|
-
if (params.agentName) searchParams.set('agentName', params.agentName);
|
|
37
|
-
if (params.search) searchParams.set('search', params.search);
|
|
38
|
-
if (params.sortBy) searchParams.set('sortBy', params.sortBy);
|
|
39
|
-
if (params.sortOrder) searchParams.set('sortOrder', params.sortOrder);
|
|
40
|
-
|
|
41
|
-
const qs = searchParams.toString();
|
|
42
|
-
return qs ? `?${qs}` : '';
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Fetch chat feedback from the admin API.
|
|
47
|
-
*/
|
|
48
|
-
export async function $fetchChatFeedback(params: ChatFeedbackListParams = {}): Promise<ChatFeedbackListResponse> {
|
|
49
|
-
const qs = buildQuery(params);
|
|
50
|
-
const response = await fetch(`/api/chat-feedback${qs}`, {
|
|
51
|
-
method: 'GET',
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
if (!response.ok) {
|
|
55
|
-
const data = await response.json().catch(() => ({}));
|
|
56
|
-
throw new Error(data.error || 'Failed to load chat feedback');
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return (await response.json()) as ChatFeedbackListResponse;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Clear chat feedback for a specific agent.
|
|
64
|
-
*/
|
|
65
|
-
export async function $clearAgentChatFeedback(agentName: string): Promise<void> {
|
|
66
|
-
if (!agentName) {
|
|
67
|
-
throw new Error('agentName is required to clear chat feedback');
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const response = await fetch(`/api/chat-feedback?agentName=${encodeURIComponent(agentName)}`, {
|
|
71
|
-
method: 'DELETE',
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
if (!response.ok) {
|
|
75
|
-
const data = await response.json().catch(() => ({}));
|
|
76
|
-
throw new Error(data.error || 'Failed to clear chat feedback');
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Delete a single chat feedback row by ID.
|
|
82
|
-
*/
|
|
83
|
-
export async function $deleteChatFeedbackRow(id: number): Promise<void> {
|
|
84
|
-
if (!id || id <= 0) {
|
|
85
|
-
throw new Error('Valid id is required to delete chat feedback row');
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const response = await fetch(`/api/chat-feedback/${encodeURIComponent(String(id))}`, {
|
|
89
|
-
method: 'DELETE',
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
if (!response.ok) {
|
|
93
|
-
const data = await response.json().catch(() => ({}));
|
|
94
|
-
throw new Error(data.error || 'Failed to delete chat feedback row');
|
|
95
|
-
}
|
|
96
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import type { AgentsServerDatabase } from '../database/schema';
|
|
2
|
-
|
|
3
|
-
export type ChatHistoryRow = AgentsServerDatabase['public']['Tables']['ChatHistory']['Row'];
|
|
4
|
-
export type ChatHistorySortField = 'createdAt' | 'agentName' | 'id';
|
|
5
|
-
export type ChatHistorySortOrder = 'asc' | 'desc';
|
|
6
|
-
|
|
7
|
-
export type ChatHistoryListResponse = {
|
|
8
|
-
items: ChatHistoryRow[];
|
|
9
|
-
total: number;
|
|
10
|
-
page: number;
|
|
11
|
-
pageSize: number;
|
|
12
|
-
sortBy: ChatHistorySortField;
|
|
13
|
-
sortOrder: ChatHistorySortOrder;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export type ChatHistoryListParams = {
|
|
17
|
-
page?: number;
|
|
18
|
-
pageSize?: number;
|
|
19
|
-
agentName?: string;
|
|
20
|
-
search?: string;
|
|
21
|
-
sortBy?: ChatHistorySortField;
|
|
22
|
-
sortOrder?: ChatHistorySortOrder;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Build query string for chat history listing.
|
|
27
|
-
*/
|
|
28
|
-
function buildQuery(params: ChatHistoryListParams): string {
|
|
29
|
-
const searchParams = new URLSearchParams();
|
|
30
|
-
|
|
31
|
-
if (params.page && params.page > 0) searchParams.set('page', String(params.page));
|
|
32
|
-
if (params.pageSize && params.pageSize > 0) searchParams.set('pageSize', String(params.pageSize));
|
|
33
|
-
if (params.agentName) searchParams.set('agentName', params.agentName);
|
|
34
|
-
if (params.search) searchParams.set('search', params.search);
|
|
35
|
-
if (params.sortBy) searchParams.set('sortBy', params.sortBy);
|
|
36
|
-
if (params.sortOrder) searchParams.set('sortOrder', params.sortOrder);
|
|
37
|
-
|
|
38
|
-
const qs = searchParams.toString();
|
|
39
|
-
return qs ? `?${qs}` : '';
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Fetch chat history from the admin API.
|
|
44
|
-
*
|
|
45
|
-
* This is shared between the admin page and other admin UIs (e.g. per-agent tools)
|
|
46
|
-
* to keep the API surface DRY.
|
|
47
|
-
*/
|
|
48
|
-
export async function $fetchChatHistory(params: ChatHistoryListParams = {}): Promise<ChatHistoryListResponse> {
|
|
49
|
-
const qs = buildQuery(params);
|
|
50
|
-
const response = await fetch(`/api/chat-history${qs}`, {
|
|
51
|
-
method: 'GET',
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
if (!response.ok) {
|
|
55
|
-
const data = await response.json().catch(() => ({}));
|
|
56
|
-
throw new Error(data.error || 'Failed to load chat history');
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return (await response.json()) as ChatHistoryListResponse;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Clear chat history for a specific agent.
|
|
64
|
-
*/
|
|
65
|
-
export async function $clearAgentChatHistory(agentName: string): Promise<void> {
|
|
66
|
-
if (!agentName) {
|
|
67
|
-
throw new Error('agentName is required to clear chat history');
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const response = await fetch(`/api/chat-history?agentName=${encodeURIComponent(agentName)}`, {
|
|
71
|
-
method: 'DELETE',
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
if (!response.ok) {
|
|
75
|
-
const data = await response.json().catch(() => ({}));
|
|
76
|
-
throw new Error(data.error || 'Failed to clear chat history');
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Delete a single chat history row by ID.
|
|
82
|
-
*/
|
|
83
|
-
export async function $deleteChatHistoryRow(id: number): Promise<void> {
|
|
84
|
-
if (!id || id <= 0) {
|
|
85
|
-
throw new Error('Valid id is required to delete chat history row');
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const response = await fetch(`/api/chat-history/${encodeURIComponent(String(id))}`, {
|
|
89
|
-
method: 'DELETE',
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
if (!response.ok) {
|
|
93
|
-
const data = await response.json().catch(() => ({}));
|
|
94
|
-
throw new Error(data.error || 'Failed to delete chat history row');
|
|
95
|
-
}
|
|
96
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { string_html } from '@promptbook-local/types';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Extract the first heading from HTML
|
|
5
|
-
*
|
|
6
|
-
* @param contentText HTML
|
|
7
|
-
* @returns heading
|
|
8
|
-
*/
|
|
9
|
-
export function extractBodyContentFromHtml(html: string_html): string_html {
|
|
10
|
-
// Note: Not using DOMParser, because it's overkill for this simple task
|
|
11
|
-
|
|
12
|
-
const match = html.match(/<body[^>]*>(?<bodyContent>[\s\S]*)<\/body>/s);
|
|
13
|
-
|
|
14
|
-
if (!match) {
|
|
15
|
-
return html;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return match.groups!.bodyContent!;
|
|
19
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts an array of objects to a CSV string
|
|
3
|
-
*/
|
|
4
|
-
export function convertToCsv(data: Array<Record<string, unknown>>): string {
|
|
5
|
-
if (data.length === 0) {
|
|
6
|
-
return '';
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const headers = Object.keys(data[0]);
|
|
10
|
-
const csvRows = [headers.join(',')];
|
|
11
|
-
|
|
12
|
-
for (const row of data) {
|
|
13
|
-
const values = headers.map((header) => {
|
|
14
|
-
let value = row[header];
|
|
15
|
-
|
|
16
|
-
if (value === null || value === undefined) {
|
|
17
|
-
value = '';
|
|
18
|
-
} else if (typeof value === 'object') {
|
|
19
|
-
value = JSON.stringify(value);
|
|
20
|
-
} else {
|
|
21
|
-
value = String(value);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const escaped = (value as string).replace(/"/g, '""');
|
|
25
|
-
return `"${escaped}"`;
|
|
26
|
-
});
|
|
27
|
-
csvRows.push(values.join(','));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return csvRows.join('\n');
|
|
31
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { cookies } from 'next/headers';
|
|
2
|
-
import { getSession } from './session';
|
|
3
|
-
|
|
4
|
-
export type UserInfo = {
|
|
5
|
-
username: string;
|
|
6
|
-
isAdmin: boolean;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export async function getCurrentUser(): Promise<UserInfo | null> {
|
|
10
|
-
// Check session
|
|
11
|
-
const session = await getSession();
|
|
12
|
-
if (session) {
|
|
13
|
-
return {
|
|
14
|
-
username: session.username,
|
|
15
|
-
isAdmin: session.isAdmin
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Check legacy admin token
|
|
20
|
-
if (process.env.ADMIN_PASSWORD) {
|
|
21
|
-
const cookieStore = await cookies();
|
|
22
|
-
const adminToken = cookieStore.get('adminToken');
|
|
23
|
-
if (adminToken?.value === process.env.ADMIN_PASSWORD) {
|
|
24
|
-
return {
|
|
25
|
-
username: 'admin',
|
|
26
|
-
isAdmin: true
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { string_promptbook_server_url } from '../../../../src/types/typeAliases';
|
|
2
|
-
import { AUTO_FEDERATED_AGENT_SERVER_URLS } from '../../../../servers';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Computes the effective list of federated servers for the current Agents Server.
|
|
6
|
-
*
|
|
7
|
-
* - Combines servers listed in the FEDERATED_SERVERS metadata (comma-separated)
|
|
8
|
-
* with a set of auto-federated servers defined in the root servers.ts config.
|
|
9
|
-
* - Ensures uniqueness and trims whitespace.
|
|
10
|
-
*/
|
|
11
|
-
export function getEffectiveFederatedServers(federatedServersString: string): Array<string_promptbook_server_url> {
|
|
12
|
-
const manualFederatedServers = federatedServersString
|
|
13
|
-
.split(',')
|
|
14
|
-
.map((s) => s.trim())
|
|
15
|
-
.filter((s): s is string_promptbook_server_url => s !== '');
|
|
16
|
-
|
|
17
|
-
const merged = Array.from(
|
|
18
|
-
new Set<string_promptbook_server_url>([...manualFederatedServers, ...AUTO_FEDERATED_AGENT_SERVER_URLS]),
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
return merged;
|
|
22
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { AgentCollection } from '@promptbook-local/types';
|
|
2
|
-
|
|
3
|
-
type Agent = Awaited<ReturnType<AgentCollection['listAgents']>>[number];
|
|
4
|
-
|
|
5
|
-
type AgentWithUrl = Agent & {
|
|
6
|
-
url: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
type AgentsApiResponse = {
|
|
10
|
-
agents: AgentWithUrl[];
|
|
11
|
-
federatedServers: string[];
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export type AgentsByServer = {
|
|
15
|
-
serverUrl: string;
|
|
16
|
-
agents: AgentWithUrl[];
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Fetches agents from federated servers recursively
|
|
21
|
-
*/
|
|
22
|
-
export async function getFederatedAgents(initialServers: string[]): Promise<AgentsByServer[]> {
|
|
23
|
-
const visited = new Set<string>();
|
|
24
|
-
const queue = [...initialServers];
|
|
25
|
-
const agentsByServer = new Map<string, AgentWithUrl[]>();
|
|
26
|
-
const MAX_SERVERS = 20;
|
|
27
|
-
|
|
28
|
-
while (queue.length > 0 && visited.size < MAX_SERVERS) {
|
|
29
|
-
const serverUrl = queue.shift();
|
|
30
|
-
if (!serverUrl) continue;
|
|
31
|
-
|
|
32
|
-
const normalizedUrl = serverUrl.trim().replace(/\/$/, '');
|
|
33
|
-
if (visited.has(normalizedUrl)) continue;
|
|
34
|
-
visited.add(normalizedUrl);
|
|
35
|
-
|
|
36
|
-
try {
|
|
37
|
-
// TODO: [🧠] Should we use some shorter timeout?
|
|
38
|
-
const response = await fetch(`${normalizedUrl}/api/agents`, {
|
|
39
|
-
next: { revalidate: 600 }, // Cache for 10 minutes
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
if (!response.ok) {
|
|
43
|
-
console.warn(`Failed to fetch agents from ${normalizedUrl}: ${response.status} ${response.statusText}`);
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const data: AgentsApiResponse = await response.json();
|
|
48
|
-
|
|
49
|
-
if (data.agents && Array.isArray(data.agents)) {
|
|
50
|
-
const serverAgents: AgentWithUrl[] = [];
|
|
51
|
-
const existingAgentUrls = new Set<string>();
|
|
52
|
-
|
|
53
|
-
// Collect all existing agent URLs across all servers
|
|
54
|
-
for (const agents of agentsByServer.values()) {
|
|
55
|
-
for (const agent of agents) {
|
|
56
|
-
existingAgentUrls.add(agent.url);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
for (const agent of data.agents) {
|
|
61
|
-
if (agent.url && !existingAgentUrls.has(agent.url)) {
|
|
62
|
-
serverAgents.push(agent);
|
|
63
|
-
existingAgentUrls.add(agent.url);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (serverAgents.length > 0) {
|
|
68
|
-
agentsByServer.set(normalizedUrl, serverAgents);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (data.federatedServers && Array.isArray(data.federatedServers)) {
|
|
73
|
-
for (const server of data.federatedServers) {
|
|
74
|
-
const normalizedServer = server.trim().replace(/\/$/, '');
|
|
75
|
-
if (!visited.has(normalizedServer) && normalizedServer !== '') {
|
|
76
|
-
queue.push(normalizedServer);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
} catch (error) {
|
|
81
|
-
console.error(`Error fetching agents from ${normalizedUrl}:`, error);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return Array.from(agentsByServer.entries()).map(([serverUrl, agents]) => ({
|
|
86
|
-
serverUrl,
|
|
87
|
-
agents,
|
|
88
|
-
}));
|
|
89
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { getMetadata } from '../database/getMetadata';
|
|
2
|
-
import { getEffectiveFederatedServers } from './getEffectiveFederatedServers';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Reads FEDERATED_SERVERS metadata and returns a normalized list of server URLs.
|
|
6
|
-
*/
|
|
7
|
-
export async function getFederatedServersFromMetadata(): Promise<string[]> {
|
|
8
|
-
const federatedServersString = (await getMetadata('FEDERATED_SERVERS')) || '';
|
|
9
|
-
return getEffectiveFederatedServers(federatedServersString);
|
|
10
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { NextRequest } from 'next/server';
|
|
2
|
-
import { keepUnused } from '../../../../src/utils/organization/keepUnused';
|
|
3
|
-
import { $getTableName } from '../database/$getTableName';
|
|
4
|
-
import { $provideSupabaseForServer } from '../database/$provideSupabaseForServer';
|
|
5
|
-
import { getSession } from './session';
|
|
6
|
-
|
|
7
|
-
export async function getUserIdFromRequest(request: NextRequest): Promise<number | null> {
|
|
8
|
-
keepUnused(request); // Unused because we get user from session cookie for now
|
|
9
|
-
|
|
10
|
-
try {
|
|
11
|
-
// 1. Try to get user from session (cookie)
|
|
12
|
-
const session = await getSession();
|
|
13
|
-
if (session && session.username) {
|
|
14
|
-
const supabase = $provideSupabaseForServer();
|
|
15
|
-
const { data } = await supabase
|
|
16
|
-
.from(await $getTableName('User'))
|
|
17
|
-
.select('id')
|
|
18
|
-
.eq('username', session.username)
|
|
19
|
-
.single();
|
|
20
|
-
|
|
21
|
-
if (data) {
|
|
22
|
-
return data.id;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// 2. Try to get user from API key (Authorization header)
|
|
27
|
-
// TODO: [🧠] Implement linking API keys to users if needed
|
|
28
|
-
// const authHeader = request.headers.get('authorization');
|
|
29
|
-
// ...
|
|
30
|
-
} catch (error) {
|
|
31
|
-
console.error('Error getting user ID from request:', error);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { getGroupedCommitmentDefinitions } from '../../../../src/commitments';
|
|
2
|
-
import { NotYetImplementedCommitmentDefinition } from '../../../../src/commitments/_base/NotYetImplementedCommitmentDefinition';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Gets visible commitment definitions for documentation
|
|
6
|
-
* Excluding those that are not yet implemented
|
|
7
|
-
*/
|
|
8
|
-
export function getVisibleCommitmentDefinitions() {
|
|
9
|
-
return getGroupedCommitmentDefinitions().filter(
|
|
10
|
-
(group) => !(group.primary instanceof NotYetImplementedCommitmentDefinition),
|
|
11
|
-
);
|
|
12
|
-
}
|