@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
package/apps/agents-server/src/app/agents/[agentName]/images/screenshot-fullhd.png/route.tsx
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { $provideServer } from '@/src/tools/$provideServer';
|
|
2
|
-
import { PROMPTBOOK_COLOR } from '@promptbook-local/core';
|
|
3
|
-
import { serializeError } from '@promptbook-local/utils';
|
|
4
|
-
import { ImageResponse } from 'next/og';
|
|
5
|
-
import { assertsError } from '../../../../../../../../src/errors/assertsError';
|
|
6
|
-
import { Color } from '../../../../../../../../src/utils/color/Color';
|
|
7
|
-
import { textColor } from '../../../../../../../../src/utils/color/operators/furthest';
|
|
8
|
-
import { grayscale } from '../../../../../../../../src/utils/color/operators/grayscale';
|
|
9
|
-
import { keepUnused } from '../../../../../../../../src/utils/organization/keepUnused';
|
|
10
|
-
import { getAgentName, getAgentProfile } from '../../_utils';
|
|
11
|
-
|
|
12
|
-
const size = {
|
|
13
|
-
width: 1920,
|
|
14
|
-
height: 1080,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export async function GET(request: Request, { params }: { params: Promise<{ agentName: string }> }) {
|
|
18
|
-
keepUnused(request /* <- Note: We dont need `request` parameter */);
|
|
19
|
-
|
|
20
|
-
try {
|
|
21
|
-
const agentName = await getAgentName(params);
|
|
22
|
-
const agentProfile = await getAgentProfile(agentName);
|
|
23
|
-
const agentColor = Color.from(agentProfile.meta.color || PROMPTBOOK_COLOR);
|
|
24
|
-
const backgroundColor = agentColor.then(grayscale(0.5));
|
|
25
|
-
const { publicUrl } = await $provideServer();
|
|
26
|
-
|
|
27
|
-
return new ImageResponse(
|
|
28
|
-
(
|
|
29
|
-
<div
|
|
30
|
-
style={{
|
|
31
|
-
width: '100%',
|
|
32
|
-
height: '100%',
|
|
33
|
-
backgroundColor: backgroundColor.toHex(),
|
|
34
|
-
color: agentColor.then(textColor).toHex(),
|
|
35
|
-
display: 'flex',
|
|
36
|
-
alignItems: 'center',
|
|
37
|
-
justifyContent: 'center',
|
|
38
|
-
}}
|
|
39
|
-
>
|
|
40
|
-
<div
|
|
41
|
-
style={{
|
|
42
|
-
width: '40%',
|
|
43
|
-
display: 'flex',
|
|
44
|
-
alignItems: 'center',
|
|
45
|
-
justifyContent: 'center',
|
|
46
|
-
}}
|
|
47
|
-
>
|
|
48
|
-
{/* Note: `next/image` is not working propperly with `next/og` */}
|
|
49
|
-
{/* eslint-disable-next-line @next/next/no-img-element */}
|
|
50
|
-
<img
|
|
51
|
-
style={{
|
|
52
|
-
width: '80%',
|
|
53
|
-
// backgroundColor: agentColor.toHex(),
|
|
54
|
-
}}
|
|
55
|
-
src={`${publicUrl.href}agents/${agentProfile.permanentId || agentName}/images/icon-256.png`}
|
|
56
|
-
alt="Agent Icon"
|
|
57
|
-
/>
|
|
58
|
-
</div>
|
|
59
|
-
<div style={{ width: '60%', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
|
60
|
-
<h1 style={{ fontSize: '110px' }}>{agentProfile.meta.fullname || agentName}</h1>
|
|
61
|
-
</div>
|
|
62
|
-
</div>
|
|
63
|
-
),
|
|
64
|
-
{
|
|
65
|
-
...size,
|
|
66
|
-
emoji: 'openmoji',
|
|
67
|
-
},
|
|
68
|
-
);
|
|
69
|
-
} catch (error) {
|
|
70
|
-
assertsError(error);
|
|
71
|
-
|
|
72
|
-
console.error(error);
|
|
73
|
-
|
|
74
|
-
return new Response(
|
|
75
|
-
JSON.stringify(
|
|
76
|
-
serializeError(error),
|
|
77
|
-
// <- TODO: [🐱🚀] Rename `serializeError` to `errorToJson`
|
|
78
|
-
null,
|
|
79
|
-
4,
|
|
80
|
-
// <- TODO: [🐱🚀] Allow to configure pretty print for agent server
|
|
81
|
-
),
|
|
82
|
-
{
|
|
83
|
-
status: 400, // <- TODO: [🐱🚀] Make `errorToHttpStatusCode`
|
|
84
|
-
headers: { 'Content-Type': 'application/json' },
|
|
85
|
-
},
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* TODO: [🦚] DRY
|
|
92
|
-
* TODO: [🦚] This should be the true screenshot NOT just image + Agent name
|
|
93
|
-
*/
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { $provideServer } from '@/src/tools/$provideServer';
|
|
2
|
-
import { PROMPTBOOK_COLOR } from '@promptbook-local/core';
|
|
3
|
-
import { serializeError } from '@promptbook-local/utils';
|
|
4
|
-
import { ImageResponse } from 'next/og';
|
|
5
|
-
import { assertsError } from '../../../../../../../../src/errors/assertsError';
|
|
6
|
-
import { Color } from '../../../../../../../../src/utils/color/Color';
|
|
7
|
-
import { textColor } from '../../../../../../../../src/utils/color/operators/furthest';
|
|
8
|
-
import { grayscale } from '../../../../../../../../src/utils/color/operators/grayscale';
|
|
9
|
-
import { keepUnused } from '../../../../../../../../src/utils/organization/keepUnused';
|
|
10
|
-
import { getAgentName, getAgentProfile } from '../../_utils';
|
|
11
|
-
|
|
12
|
-
const size = {
|
|
13
|
-
width: 1080,
|
|
14
|
-
height: 1920,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export async function GET(request: Request, { params }: { params: Promise<{ agentName: string }> }) {
|
|
18
|
-
keepUnused(request /* <- Note: We dont need `request` parameter */);
|
|
19
|
-
|
|
20
|
-
try {
|
|
21
|
-
const agentName = await getAgentName(params);
|
|
22
|
-
const agentProfile = await getAgentProfile(agentName);
|
|
23
|
-
const agentColor = Color.from(agentProfile.meta.color || PROMPTBOOK_COLOR);
|
|
24
|
-
const backgroundColor = agentColor.then(grayscale(0.5));
|
|
25
|
-
const { publicUrl } = await $provideServer();
|
|
26
|
-
|
|
27
|
-
return new ImageResponse(
|
|
28
|
-
(
|
|
29
|
-
<div
|
|
30
|
-
style={{
|
|
31
|
-
width: '100%',
|
|
32
|
-
height: '100%',
|
|
33
|
-
backgroundColor: backgroundColor.toHex(),
|
|
34
|
-
color: agentColor.then(textColor).toHex(),
|
|
35
|
-
display: 'flex',
|
|
36
|
-
alignItems: 'center',
|
|
37
|
-
justifyContent: 'center',
|
|
38
|
-
}}
|
|
39
|
-
>
|
|
40
|
-
<div
|
|
41
|
-
style={{
|
|
42
|
-
width: '40%',
|
|
43
|
-
display: 'flex',
|
|
44
|
-
alignItems: 'center',
|
|
45
|
-
justifyContent: 'center',
|
|
46
|
-
}}
|
|
47
|
-
>
|
|
48
|
-
{/* Note: `next/image` is not working propperly with `next/og` */}
|
|
49
|
-
{/* eslint-disable-next-line @next/next/no-img-element */}
|
|
50
|
-
<img
|
|
51
|
-
style={{
|
|
52
|
-
width: '80%',
|
|
53
|
-
// backgroundColor: agentColor.toHex(),
|
|
54
|
-
}}
|
|
55
|
-
src={`${publicUrl.href}agents/${agentProfile.permanentId || agentName}/images/icon-256.png`}
|
|
56
|
-
alt="Agent Icon"
|
|
57
|
-
/>
|
|
58
|
-
</div>
|
|
59
|
-
<div style={{ width: '60%', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
|
60
|
-
<h1 style={{ fontSize: '110px' }}>{agentProfile.meta.fullname || agentName}</h1>
|
|
61
|
-
</div>
|
|
62
|
-
</div>
|
|
63
|
-
),
|
|
64
|
-
{
|
|
65
|
-
...size,
|
|
66
|
-
emoji: 'openmoji',
|
|
67
|
-
},
|
|
68
|
-
);
|
|
69
|
-
} catch (error) {
|
|
70
|
-
assertsError(error);
|
|
71
|
-
|
|
72
|
-
console.error(error);
|
|
73
|
-
|
|
74
|
-
return new Response(
|
|
75
|
-
JSON.stringify(
|
|
76
|
-
serializeError(error),
|
|
77
|
-
// <- TODO: [🐱🚀] Rename `serializeError` to `errorToJson`
|
|
78
|
-
null,
|
|
79
|
-
4,
|
|
80
|
-
// <- TODO: [🐱🚀] Allow to configure pretty print for agent server
|
|
81
|
-
),
|
|
82
|
-
{
|
|
83
|
-
status: 400, // <- TODO: [🐱🚀] Make `errorToHttpStatusCode`
|
|
84
|
-
headers: { 'Content-Type': 'application/json' },
|
|
85
|
-
},
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* TODO: [🦚] DRY
|
|
92
|
-
* TODO: [🦚] This should be the true screenshot NOT just image + Agent name
|
|
93
|
-
*/
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { CodePreview } from '../../../../../../_common/components/CodePreview/CodePreview';
|
|
4
|
-
import { Tabs, TabsContent, TabsList, TabsTrigger } from '../../../../../../_common/components/Tabs/Tabs';
|
|
5
|
-
|
|
6
|
-
type SdkCodeTabsProps = {
|
|
7
|
-
curlCode: string;
|
|
8
|
-
pythonCode: string;
|
|
9
|
-
jsCode: string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export function SdkCodeTabs({ curlCode, pythonCode, jsCode }: SdkCodeTabsProps) {
|
|
13
|
-
return (
|
|
14
|
-
<Tabs defaultValue="curl" className="w-full">
|
|
15
|
-
<TabsList>
|
|
16
|
-
<TabsTrigger value="curl">cURL</TabsTrigger>
|
|
17
|
-
<TabsTrigger value="python">Python SDK</TabsTrigger>
|
|
18
|
-
<TabsTrigger value="javascript">JavaScript/TypeScript SDK</TabsTrigger>
|
|
19
|
-
</TabsList>
|
|
20
|
-
<TabsContent value="curl">
|
|
21
|
-
<CodePreview code={curlCode} language="bash" />
|
|
22
|
-
</TabsContent>
|
|
23
|
-
<TabsContent value="python">
|
|
24
|
-
<CodePreview code={pythonCode} language="python" />
|
|
25
|
-
</TabsContent>
|
|
26
|
-
<TabsContent value="javascript">
|
|
27
|
-
<CodePreview code={jsCode} language="typescript" />
|
|
28
|
-
</TabsContent>
|
|
29
|
-
</Tabs>
|
|
30
|
-
);
|
|
31
|
-
}
|
package/apps/agents-server/src/app/agents/[agentName]/integration/WebsiteIntegrationTabs.tsx
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { CodePreview } from '../../../../../../_common/components/CodePreview/CodePreview';
|
|
4
|
-
import { Tabs, TabsContent, TabsList, TabsTrigger } from '../../../../../../_common/components/Tabs/Tabs';
|
|
5
|
-
|
|
6
|
-
type WebsiteIntegrationTabsProps = {
|
|
7
|
-
reactCode: string;
|
|
8
|
-
htmlCode: string;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export function WebsiteIntegrationTabs({ reactCode, htmlCode }: WebsiteIntegrationTabsProps) {
|
|
12
|
-
return (
|
|
13
|
-
<Tabs defaultValue="react" className="w-full">
|
|
14
|
-
<TabsList>
|
|
15
|
-
<TabsTrigger value="react">React</TabsTrigger>
|
|
16
|
-
<TabsTrigger value="html">HTML</TabsTrigger>
|
|
17
|
-
</TabsList>
|
|
18
|
-
<TabsContent value="react">
|
|
19
|
-
<CodePreview code={reactCode} language="typescript" />
|
|
20
|
-
</TabsContent>
|
|
21
|
-
<TabsContent value="html">
|
|
22
|
-
<CodePreview code={htmlCode} language="xml" />
|
|
23
|
-
</TabsContent>
|
|
24
|
-
</Tabs>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
'use server';
|
|
2
|
-
|
|
3
|
-
import { $getTableName } from '@/src/database/$getTableName';
|
|
4
|
-
import { $provideSupabase } from '@/src/database/$provideSupabase';
|
|
5
|
-
import { $provideServer } from '@/src/tools/$provideServer';
|
|
6
|
-
import { isUserAdmin } from '@/src/utils/isUserAdmin';
|
|
7
|
-
import { generatePlaceholderAgentProfileImageUrl, PROMPTBOOK_COLOR } from '@promptbook-local/core';
|
|
8
|
-
import { ArrowLeftIcon, BoxIcon, CodeIcon, GlobeIcon, ServerIcon, TerminalIcon } from 'lucide-react';
|
|
9
|
-
import { headers } from 'next/headers';
|
|
10
|
-
import Link from 'next/link';
|
|
11
|
-
import { notFound } from 'next/navigation';
|
|
12
|
-
import spaceTrim from 'spacetrim';
|
|
13
|
-
import { Color } from '../../../../../../../src/utils/color/Color';
|
|
14
|
-
import { withAlpha } from '../../../../../../../src/utils/color/operators/withAlpha';
|
|
15
|
-
import { $sideEffect } from '../../../../../../../src/utils/organization/$sideEffect';
|
|
16
|
-
import { CodePreview } from '../../../../../../_common/components/CodePreview/CodePreview';
|
|
17
|
-
import { getAgentName, getAgentProfile } from '../_utils';
|
|
18
|
-
import { getAgentLinks } from '../agentLinks';
|
|
19
|
-
import { CopyField } from '../CopyField';
|
|
20
|
-
import { generateAgentMetadata } from '../generateAgentMetadata';
|
|
21
|
-
import { SdkCodeTabs } from './SdkCodeTabs';
|
|
22
|
-
import { WebsiteIntegrationTabs } from './WebsiteIntegrationTabs';
|
|
23
|
-
|
|
24
|
-
export const generateMetadata = generateAgentMetadata;
|
|
25
|
-
|
|
26
|
-
export default async function AgentIntegrationPage({ params }: { params: Promise<{ agentName: string }> }) {
|
|
27
|
-
$sideEffect(headers());
|
|
28
|
-
|
|
29
|
-
const agentName = await getAgentName(params);
|
|
30
|
-
const isAdmin = await isUserAdmin();
|
|
31
|
-
|
|
32
|
-
let agentProfile;
|
|
33
|
-
try {
|
|
34
|
-
agentProfile = await getAgentProfile(agentName);
|
|
35
|
-
} catch (error) {
|
|
36
|
-
if (
|
|
37
|
-
error instanceof Error &&
|
|
38
|
-
(error.message.includes('Cannot coerce the result to a single JSON object') ||
|
|
39
|
-
error.message.includes('JSON object requested, multiple (or no) results returned'))
|
|
40
|
-
) {
|
|
41
|
-
notFound();
|
|
42
|
-
}
|
|
43
|
-
throw error;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const { publicUrl } = await $provideServer();
|
|
47
|
-
const baseUrl = `${publicUrl.href}agents/${encodeURIComponent(agentName)}`;
|
|
48
|
-
const agentApiBase = `${publicUrl.href}agents/${encodeURIComponent(agentName)}`;
|
|
49
|
-
const rootUrl = publicUrl.href.replace(/\/$/, '');
|
|
50
|
-
|
|
51
|
-
// Get API Key if admin
|
|
52
|
-
let apiKey = 'ptbk_...';
|
|
53
|
-
if (isAdmin) {
|
|
54
|
-
const supabase = $provideSupabase();
|
|
55
|
-
const table = await $getTableName('ApiTokens');
|
|
56
|
-
const { data } = await supabase
|
|
57
|
-
.from(table)
|
|
58
|
-
.select('token')
|
|
59
|
-
.eq('isRevoked', false)
|
|
60
|
-
.order('createdAt', { ascending: false })
|
|
61
|
-
.limit(1);
|
|
62
|
-
|
|
63
|
-
if (data && data.length > 0) {
|
|
64
|
-
apiKey = data[0].token;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Extract brand color from meta
|
|
69
|
-
const brandColor = Color.from(agentProfile.meta.color || PROMPTBOOK_COLOR);
|
|
70
|
-
const backgroundColor = (await brandColor.then(withAlpha(0.05))).toHex();
|
|
71
|
-
const borderColor = (await brandColor.then(withAlpha(0.1))).toHex();
|
|
72
|
-
const primaryColor = (await brandColor).toHex();
|
|
73
|
-
|
|
74
|
-
// Website Integration Code
|
|
75
|
-
const { fullname, color, image, ...restMeta } = agentProfile.meta;
|
|
76
|
-
const websiteIntegrationReactCode = spaceTrim(
|
|
77
|
-
(block) => `
|
|
78
|
-
import { PromptbookAgentIntegration } from '@promptbook/components';
|
|
79
|
-
|
|
80
|
-
export function YourComponent() {
|
|
81
|
-
return(
|
|
82
|
-
<PromptbookAgentIntegration
|
|
83
|
-
agentUrl="${baseUrl}"
|
|
84
|
-
meta={${block(JSON.stringify({ fullname, color, image, ...restMeta }, null, 4))}}
|
|
85
|
-
/>
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
`,
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
// HTML Integration Code - use single quotes for meta attribute to allow JSON with double quotes inside
|
|
92
|
-
const metaJsonString = JSON.stringify({ fullname, color, image, ...restMeta }, null, 4);
|
|
93
|
-
const websiteIntegrationHtmlCode = spaceTrim(
|
|
94
|
-
(block) => `
|
|
95
|
-
<script src="${publicUrl.href}api/embed.js" async defer></script>
|
|
96
|
-
|
|
97
|
-
<promptbook-agent-integration
|
|
98
|
-
agent-url="${baseUrl}"
|
|
99
|
-
meta='${block(metaJsonString)}'
|
|
100
|
-
/>
|
|
101
|
-
`,
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
// OpenAI Compatible Curl
|
|
105
|
-
const curlCode = spaceTrim(`
|
|
106
|
-
curl ${agentApiBase}/api/openai/v1/chat/completions \\
|
|
107
|
-
-H "Content-Type: application/json" \\
|
|
108
|
-
-H "Authorization: Bearer ${apiKey}" \\
|
|
109
|
-
-d '{
|
|
110
|
-
"model": "agent:${agentName}",
|
|
111
|
-
"messages": [
|
|
112
|
-
{"role": "user", "content": "Hello!"}
|
|
113
|
-
]
|
|
114
|
-
}'
|
|
115
|
-
`);
|
|
116
|
-
|
|
117
|
-
// OpenAI Compatible Python
|
|
118
|
-
const pythonCode = spaceTrim(`
|
|
119
|
-
from openai import OpenAI
|
|
120
|
-
|
|
121
|
-
client = OpenAI(
|
|
122
|
-
base_url="${agentApiBase}/api/openai/v1",
|
|
123
|
-
api_key="${apiKey}",
|
|
124
|
-
)
|
|
125
|
-
|
|
126
|
-
response = client.chat.completions.create(
|
|
127
|
-
model="agent:${agentName}",
|
|
128
|
-
messages=[
|
|
129
|
-
{"role": "user", "content": "Hello!"}
|
|
130
|
-
]
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
print(response.choices[0].message.content)
|
|
134
|
-
`);
|
|
135
|
-
|
|
136
|
-
// OpenAI Compatible JS
|
|
137
|
-
const jsCode = spaceTrim(`
|
|
138
|
-
import OpenAI from 'openai';
|
|
139
|
-
|
|
140
|
-
const client = new OpenAI({
|
|
141
|
-
baseURL: '${agentApiBase}/api/openai/v1',
|
|
142
|
-
apiKey: '${apiKey}',
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
async function main() {
|
|
146
|
-
const response = await client.chat.completions.create({
|
|
147
|
-
model: 'agent:${agentName}',
|
|
148
|
-
messages: [{ role: 'user', content: 'Hello!' }],
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
console.log(response.choices[0].message.content);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
main();
|
|
155
|
-
`);
|
|
156
|
-
|
|
157
|
-
// MCP Config
|
|
158
|
-
const mcpConfigCode = spaceTrim(`
|
|
159
|
-
{
|
|
160
|
-
"mcpServers": {
|
|
161
|
-
"${agentName}": {
|
|
162
|
-
"command": "npx",
|
|
163
|
-
"args": [
|
|
164
|
-
"-y",
|
|
165
|
-
"@promptbook/cli",
|
|
166
|
-
"mcp",
|
|
167
|
-
"${baseUrl}"
|
|
168
|
-
]
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
`);
|
|
173
|
-
|
|
174
|
-
const agentLinks = getAgentLinks(agentProfile.permanentId || agentName);
|
|
175
|
-
const chatLink = agentLinks.find((l) => l.title === 'Chat with Agent')!;
|
|
176
|
-
const websiteIntegrationLink = agentLinks.find((l) => l.title === 'Website Integration')!;
|
|
177
|
-
|
|
178
|
-
return (
|
|
179
|
-
<div
|
|
180
|
-
className="min-h-screen p-6 md:p-12 flex flex-col items-center"
|
|
181
|
-
style={{
|
|
182
|
-
backgroundColor,
|
|
183
|
-
}}
|
|
184
|
-
>
|
|
185
|
-
<div className="w-full max-w-5xl bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden">
|
|
186
|
-
{/* Header */}
|
|
187
|
-
<div className="p-6 border-b flex items-center gap-4" style={{ borderColor }}>
|
|
188
|
-
{agentProfile.meta.image && (
|
|
189
|
-
// eslint-disable-next-line @next/next/no-img-element
|
|
190
|
-
<img
|
|
191
|
-
src={
|
|
192
|
-
agentProfile.meta.image ||
|
|
193
|
-
generatePlaceholderAgentProfileImageUrl(
|
|
194
|
-
agentProfile.permanentId || agentName,
|
|
195
|
-
publicUrl,
|
|
196
|
-
)
|
|
197
|
-
}
|
|
198
|
-
alt={agentProfile.meta.fullname || agentName}
|
|
199
|
-
className="w-16 h-16 rounded-full object-cover border-2"
|
|
200
|
-
style={{ borderColor: primaryColor }}
|
|
201
|
-
/>
|
|
202
|
-
)}
|
|
203
|
-
<div className="flex-1">
|
|
204
|
-
<h1 className="text-2xl font-bold text-gray-900">{agentProfile.meta.fullname || agentName}</h1>
|
|
205
|
-
<p className="text-gray-500 flex items-center gap-2">
|
|
206
|
-
<CodeIcon className="w-4 h-4" />
|
|
207
|
-
Integration Options
|
|
208
|
-
</p>
|
|
209
|
-
</div>
|
|
210
|
-
<Link
|
|
211
|
-
href={chatLink.href}
|
|
212
|
-
className="p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 rounded-full transition-colors"
|
|
213
|
-
title="Back to Agent"
|
|
214
|
-
>
|
|
215
|
-
<ArrowLeftIcon className="w-6 h-6" />
|
|
216
|
-
</Link>
|
|
217
|
-
</div>
|
|
218
|
-
|
|
219
|
-
<div className="p-6 space-y-6">
|
|
220
|
-
{/* Website Integration */}
|
|
221
|
-
<div className="p-6 rounded-xl border-2 border-green-200 bg-green-50/30 shadow-sm">
|
|
222
|
-
<div className="flex items-start gap-4 mb-4">
|
|
223
|
-
<div className="p-3 rounded-xl bg-green-100 text-green-600 shadow-sm">
|
|
224
|
-
<GlobeIcon className="w-6 h-6" />
|
|
225
|
-
</div>
|
|
226
|
-
<div>
|
|
227
|
-
<h2 className="text-xl font-bold text-gray-900">Website Integration</h2>
|
|
228
|
-
<p className="text-gray-600">
|
|
229
|
-
Embed the agent chat widget directly into your React application.
|
|
230
|
-
</p>
|
|
231
|
-
<p className="text-sm text-gray-500 mt-1">
|
|
232
|
-
<Link href={websiteIntegrationLink.href} className="text-blue-600 hover:underline">
|
|
233
|
-
View detailed guide →
|
|
234
|
-
</Link>
|
|
235
|
-
</p>
|
|
236
|
-
</div>
|
|
237
|
-
</div>
|
|
238
|
-
<WebsiteIntegrationTabs
|
|
239
|
-
reactCode={websiteIntegrationReactCode}
|
|
240
|
-
htmlCode={websiteIntegrationHtmlCode}
|
|
241
|
-
/>
|
|
242
|
-
</div>
|
|
243
|
-
|
|
244
|
-
{/* OpenAI API Compatible Endpoint */}
|
|
245
|
-
<div className="p-6 rounded-xl border-2 border-blue-200 bg-blue-50/30 shadow-sm">
|
|
246
|
-
<div className="flex items-start gap-4 mb-4">
|
|
247
|
-
<div className="p-3 rounded-xl bg-blue-100 text-blue-600 shadow-sm">
|
|
248
|
-
<TerminalIcon className="w-6 h-6" />
|
|
249
|
-
</div>
|
|
250
|
-
<div className="flex-1">
|
|
251
|
-
<h2 className="text-xl font-bold text-gray-900">OpenAI Compatible API</h2>
|
|
252
|
-
<p className="text-gray-600">
|
|
253
|
-
Use the agent as a drop-in replacement for OpenAI API in your existing applications.
|
|
254
|
-
</p>
|
|
255
|
-
<div className="grid md:grid-cols-3 gap-4 mt-4 mb-2">
|
|
256
|
-
<CopyField label="Endpoint URL" value={`${agentApiBase}/api/openai/v1`} />
|
|
257
|
-
<CopyField label="Model Name" value={`agent:${agentName}`} />
|
|
258
|
-
{isAdmin ? (
|
|
259
|
-
<CopyField label="API Key" value={apiKey} />
|
|
260
|
-
) : (
|
|
261
|
-
<div className="flex flex-col gap-1">
|
|
262
|
-
<span className="text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|
263
|
-
API Key
|
|
264
|
-
</span>
|
|
265
|
-
<div className="text-sm text-gray-500 italic bg-gray-50 p-2 rounded border border-gray-200">
|
|
266
|
-
Contact admin for API Key
|
|
267
|
-
</div>
|
|
268
|
-
</div>
|
|
269
|
-
)}
|
|
270
|
-
</div>
|
|
271
|
-
{isAdmin && apiKey === 'ptbk_...' && (
|
|
272
|
-
<p className="text-sm text-amber-600 mt-2">
|
|
273
|
-
No API token found.{' '}
|
|
274
|
-
<Link href="/admin/api-tokens" className="underline font-medium">
|
|
275
|
-
Create one in settings
|
|
276
|
-
</Link>
|
|
277
|
-
.
|
|
278
|
-
</p>
|
|
279
|
-
)}
|
|
280
|
-
</div>
|
|
281
|
-
</div>
|
|
282
|
-
|
|
283
|
-
<SdkCodeTabs curlCode={curlCode} pythonCode={pythonCode} jsCode={jsCode} />
|
|
284
|
-
</div>
|
|
285
|
-
|
|
286
|
-
{/* OpenRouter Integration */}
|
|
287
|
-
<div className="p-6 rounded-xl border-2 border-purple-200 bg-purple-50/30 shadow-sm">
|
|
288
|
-
<div className="flex items-start gap-4 mb-4">
|
|
289
|
-
<div className="p-3 rounded-xl bg-purple-100 text-purple-600 shadow-sm">
|
|
290
|
-
<ServerIcon className="w-6 h-6" />
|
|
291
|
-
</div>
|
|
292
|
-
<div>
|
|
293
|
-
<h2 className="text-xl font-bold text-gray-900">OpenRouter Integration</h2>
|
|
294
|
-
<p className="text-gray-600">Connect via OpenRouter compatible endpoint.</p>
|
|
295
|
-
<div className="grid md:grid-cols-2 gap-4 mt-4">
|
|
296
|
-
<CopyField label="Endpoint URL" value={`${agentApiBase}/api/openrouter`} />
|
|
297
|
-
<CopyField label="Model Name" value={`agent:${agentName}`} />
|
|
298
|
-
</div>
|
|
299
|
-
</div>
|
|
300
|
-
</div>
|
|
301
|
-
</div>
|
|
302
|
-
|
|
303
|
-
{/* MCP Integration */}
|
|
304
|
-
<div className="p-6 rounded-xl border-2 border-orange-200 bg-orange-50/30 shadow-sm">
|
|
305
|
-
<div className="flex items-start gap-4 mb-4">
|
|
306
|
-
<div className="p-3 rounded-xl bg-orange-100 text-orange-600 shadow-sm">
|
|
307
|
-
<BoxIcon className="w-6 h-6" />
|
|
308
|
-
</div>
|
|
309
|
-
<div>
|
|
310
|
-
<h2 className="text-xl font-bold text-gray-900">MCP Integration</h2>
|
|
311
|
-
<p className="text-gray-600">
|
|
312
|
-
Use Model Context Protocol to connect this agent with compatible tools and IDEs
|
|
313
|
-
(like Claude Desktop, Cursor, etc.).
|
|
314
|
-
</p>
|
|
315
|
-
</div>
|
|
316
|
-
</div>
|
|
317
|
-
<CodePreview
|
|
318
|
-
code={mcpConfigCode.replace(rootUrl + '/api', agentApiBase + '/api')}
|
|
319
|
-
language="json"
|
|
320
|
-
/>
|
|
321
|
-
</div>
|
|
322
|
-
</div>
|
|
323
|
-
</div>
|
|
324
|
-
</div>
|
|
325
|
-
);
|
|
326
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
'use server';
|
|
2
|
-
|
|
3
|
-
import type { Metadata } from 'next';
|
|
4
|
-
import { getAgentName, getAgentProfile } from './_utils';
|
|
5
|
-
|
|
6
|
-
export async function generateMetadata({ params }: { params: Promise<{ agentName: string }> }): Promise<Metadata> {
|
|
7
|
-
const agentName = await getAgentName(params);
|
|
8
|
-
|
|
9
|
-
try {
|
|
10
|
-
const agentProfile = await getAgentProfile(agentName);
|
|
11
|
-
|
|
12
|
-
const title = agentProfile.meta.fullname || agentProfile.agentName;
|
|
13
|
-
const description = agentProfile.meta.description || agentProfile.personaDescription || undefined;
|
|
14
|
-
|
|
15
|
-
// Use the agent's icon-256.png as the favicon for all agent pages and subpages
|
|
16
|
-
const iconUrl = `/agents/${encodeURIComponent(agentName)}/images/icon-256.png`;
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
title,
|
|
20
|
-
description,
|
|
21
|
-
icons: {
|
|
22
|
-
icon: iconUrl,
|
|
23
|
-
shortcut: iconUrl,
|
|
24
|
-
apple: iconUrl,
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
} catch (error) {
|
|
28
|
-
console.warn(`Failed to generate metadata for agent ${agentName}`, error);
|
|
29
|
-
return {
|
|
30
|
-
title: agentName,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export default async function AgentLayout({
|
|
36
|
-
children,
|
|
37
|
-
}: Readonly<{
|
|
38
|
-
children: React.ReactNode;
|
|
39
|
-
}>) {
|
|
40
|
-
return <>{children}</>;
|
|
41
|
-
}
|