@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,18 +0,0 @@
|
|
|
1
|
-
import { ForbiddenPage } from '../../../components/ForbiddenPage/ForbiddenPage';
|
|
2
|
-
import { UsersList } from '../../../components/UsersList/UsersList';
|
|
3
|
-
import { isUserAdmin } from '../../../utils/isUserAdmin';
|
|
4
|
-
|
|
5
|
-
export default async function AdminUsersPage() {
|
|
6
|
-
const isAdmin = await isUserAdmin();
|
|
7
|
-
|
|
8
|
-
if (!isAdmin) {
|
|
9
|
-
return <ForbiddenPage />;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// Full users management (list + create) is only available on this page
|
|
13
|
-
return (
|
|
14
|
-
<div className="container mx-auto px-4 py-8">
|
|
15
|
-
<UsersList allowCreate />
|
|
16
|
-
</div>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { usePromise } from '@common/hooks/usePromise';
|
|
4
|
-
import { AgentChat } from '@promptbook-local/components';
|
|
5
|
-
import { RemoteAgent } from '@promptbook-local/core';
|
|
6
|
-
import { useCallback, useEffect, useMemo } from 'react';
|
|
7
|
-
import { string_agent_url } from '../../../../../../src/types/typeAliases';
|
|
8
|
-
|
|
9
|
-
type AgentChatWrapperProps = {
|
|
10
|
-
agentUrl: string_agent_url;
|
|
11
|
-
defaultMessage?: string;
|
|
12
|
-
autoExecuteMessage?: string;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
// TODO: [🐱🚀] Rename to AgentChatSomethingWrapper
|
|
16
|
-
|
|
17
|
-
export function AgentChatWrapper(props: AgentChatWrapperProps) {
|
|
18
|
-
const { agentUrl, defaultMessage, autoExecuteMessage } = props;
|
|
19
|
-
|
|
20
|
-
const agentPromise = useMemo(
|
|
21
|
-
() =>
|
|
22
|
-
RemoteAgent.connect({
|
|
23
|
-
agentUrl,
|
|
24
|
-
isVerbose: true,
|
|
25
|
-
}),
|
|
26
|
-
[agentUrl],
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
const { value: agent } = usePromise(agentPromise, [agentPromise]);
|
|
30
|
-
|
|
31
|
-
const handleFeedback = useCallback(
|
|
32
|
-
async (feedback: {
|
|
33
|
-
rating: number;
|
|
34
|
-
textRating?: string;
|
|
35
|
-
chatThread?: string;
|
|
36
|
-
userNote?: string;
|
|
37
|
-
expectedAnswer?: string | null;
|
|
38
|
-
}) => {
|
|
39
|
-
if (!agent) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
await fetch(`${agentUrl}/api/feedback`, {
|
|
44
|
-
method: 'POST',
|
|
45
|
-
headers: {
|
|
46
|
-
'Content-Type': 'application/json',
|
|
47
|
-
},
|
|
48
|
-
body: JSON.stringify({
|
|
49
|
-
rating: feedback.rating.toString(),
|
|
50
|
-
textRating: feedback.textRating,
|
|
51
|
-
chatThread: feedback.chatThread,
|
|
52
|
-
userNote: feedback.textRating, // Mapping textRating to userNote as well if needed, or just textRating
|
|
53
|
-
expectedAnswer: feedback.expectedAnswer,
|
|
54
|
-
agentHash: agent.agentHash,
|
|
55
|
-
}),
|
|
56
|
-
});
|
|
57
|
-
},
|
|
58
|
-
[agent, agentUrl],
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
// Remove the 'message' query parameter from URL after auto-executing a message
|
|
62
|
-
useEffect(() => {
|
|
63
|
-
if (autoExecuteMessage && typeof window !== 'undefined') {
|
|
64
|
-
// Wait for the message to be processed, then remove the query parameter
|
|
65
|
-
const timer = setTimeout(() => {
|
|
66
|
-
const url = new URL(window.location.href);
|
|
67
|
-
url.searchParams.delete('message');
|
|
68
|
-
window.history.replaceState({}, '', url.toString());
|
|
69
|
-
}, 1000); // 1 second delay to ensure message processing is complete
|
|
70
|
-
|
|
71
|
-
return () => clearTimeout(timer);
|
|
72
|
-
}
|
|
73
|
-
}, [autoExecuteMessage]);
|
|
74
|
-
|
|
75
|
-
if (!agent) {
|
|
76
|
-
return <>{/* <- TODO: [🐱🚀] <PromptbookLoading /> */}</>;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<AgentChat
|
|
81
|
-
className={`w-full h-full`}
|
|
82
|
-
agent={agent}
|
|
83
|
-
onFeedback={handleFeedback}
|
|
84
|
-
defaultMessage={defaultMessage}
|
|
85
|
-
autoExecuteMessage={autoExecuteMessage}
|
|
86
|
-
/>
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* TODO: [🚗] Transfer the saving logic to `<BookEditor/>` be aware of CRDT / yjs approach to be implementable in future
|
|
92
|
-
*/
|
|
@@ -1,356 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { TODO_any } from '@promptbook-local/types';
|
|
4
|
-
import {
|
|
5
|
-
CodeIcon,
|
|
6
|
-
CopyIcon,
|
|
7
|
-
CopyPlusIcon,
|
|
8
|
-
DownloadIcon,
|
|
9
|
-
FileTextIcon,
|
|
10
|
-
MailIcon,
|
|
11
|
-
MessageCircleQuestionIcon,
|
|
12
|
-
MessageSquareIcon,
|
|
13
|
-
MessageSquareShareIcon,
|
|
14
|
-
MoreHorizontalIcon,
|
|
15
|
-
QrCodeIcon,
|
|
16
|
-
SmartphoneIcon,
|
|
17
|
-
SquareSplitHorizontalIcon,
|
|
18
|
-
TrashIcon,
|
|
19
|
-
} from 'lucide-react';
|
|
20
|
-
import { Barlow_Condensed } from 'next/font/google';
|
|
21
|
-
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
22
|
-
import { string_agent_permanent_id, string_data_url, string_url_image } from '../../../../../../src/types/typeAliases';
|
|
23
|
-
import { deleteAgent } from '../../recycle-bin/actions';
|
|
24
|
-
import { getAgentLinks } from './agentLinks';
|
|
25
|
-
|
|
26
|
-
type BeforeInstallPromptEvent = Event & {
|
|
27
|
-
prompt: () => Promise<void>;
|
|
28
|
-
userChoice: Promise<{ outcome: 'accepted' | 'dismissed'; platform: string }>;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const barlowCondensed = Barlow_Condensed({
|
|
32
|
-
subsets: ['latin'],
|
|
33
|
-
weight: ['300', '400', '500', '600', '700'],
|
|
34
|
-
variable: '--font-barlow-condensed',
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
type AgentOptionsMenuProps = {
|
|
38
|
-
agentName: string;
|
|
39
|
-
derivedAgentName: string;
|
|
40
|
-
permanentId?: string_agent_permanent_id;
|
|
41
|
-
agentUrl: string;
|
|
42
|
-
agentEmail: string;
|
|
43
|
-
brandColorHex: string;
|
|
44
|
-
isAdmin?: boolean;
|
|
45
|
-
backgroundImage: string_url_image & string_data_url;
|
|
46
|
-
onShowQrCode?: () => void;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export function AgentOptionsMenu({
|
|
50
|
-
agentName,
|
|
51
|
-
derivedAgentName,
|
|
52
|
-
permanentId,
|
|
53
|
-
agentUrl,
|
|
54
|
-
agentEmail,
|
|
55
|
-
isAdmin = false,
|
|
56
|
-
onShowQrCode,
|
|
57
|
-
}: AgentOptionsMenuProps) {
|
|
58
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
59
|
-
const [copyFeedback, setCopyFeedback] = useState<string | null>(null);
|
|
60
|
-
const menuRef = useRef<HTMLDivElement>(null);
|
|
61
|
-
|
|
62
|
-
// PWA Install state
|
|
63
|
-
const [installPromptEvent, setInstallPromptEvent] = useState<BeforeInstallPromptEvent | null>(null);
|
|
64
|
-
const [isInstalled, setIsInstalled] = useState(false);
|
|
65
|
-
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
function handleBeforeInstallPrompt(e: Event) {
|
|
68
|
-
e.preventDefault();
|
|
69
|
-
setInstallPromptEvent(e as BeforeInstallPromptEvent);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function updateInstalledStatus() {
|
|
73
|
-
const mediaMatch = window.matchMedia('(display-mode: standalone)');
|
|
74
|
-
const standalone = mediaMatch.matches || (window.navigator as TODO_any).standalone === true;
|
|
75
|
-
setIsInstalled(standalone);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
window.addEventListener('beforeinstallprompt', handleBeforeInstallPrompt);
|
|
79
|
-
updateInstalledStatus();
|
|
80
|
-
window.matchMedia('(display-mode: standalone)').addEventListener('change', updateInstalledStatus);
|
|
81
|
-
|
|
82
|
-
return () => {
|
|
83
|
-
window.removeEventListener('beforeinstallprompt', handleBeforeInstallPrompt);
|
|
84
|
-
window.matchMedia('(display-mode: standalone)').removeEventListener('change', updateInstalledStatus);
|
|
85
|
-
};
|
|
86
|
-
}, []);
|
|
87
|
-
|
|
88
|
-
const handleInstallApp = useCallback(async () => {
|
|
89
|
-
if (!installPromptEvent) return;
|
|
90
|
-
try {
|
|
91
|
-
installPromptEvent.prompt();
|
|
92
|
-
const choice = await installPromptEvent.userChoice.catch(() => null);
|
|
93
|
-
if (choice?.outcome === 'accepted') {
|
|
94
|
-
setIsInstalled(true);
|
|
95
|
-
}
|
|
96
|
-
} finally {
|
|
97
|
-
setInstallPromptEvent(null);
|
|
98
|
-
}
|
|
99
|
-
}, [installPromptEvent]);
|
|
100
|
-
|
|
101
|
-
useEffect(() => {
|
|
102
|
-
function handleClickOutside(event: MouseEvent) {
|
|
103
|
-
if (menuRef.current && !menuRef.current.contains(event.target as Node)) {
|
|
104
|
-
setIsOpen(false);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
document.addEventListener('mousedown', handleClickOutside);
|
|
109
|
-
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
110
|
-
}, []);
|
|
111
|
-
|
|
112
|
-
const handleCopy = async (value: string, label: string) => {
|
|
113
|
-
try {
|
|
114
|
-
await navigator.clipboard.writeText(value);
|
|
115
|
-
setCopyFeedback(label);
|
|
116
|
-
setTimeout(() => setCopyFeedback(null), 2000);
|
|
117
|
-
} catch (error) {
|
|
118
|
-
console.error('Failed to copy:', error);
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
const links = getAgentLinks(permanentId || agentName);
|
|
123
|
-
const editBookLink = links.find((l) => l.title === 'Edit Book')!;
|
|
124
|
-
const integrationLink = links.find((l) => l.title === 'Integration')!;
|
|
125
|
-
const historyLink = links.find((l) => l.title === 'History & Feedback')!;
|
|
126
|
-
const allLinksLink = links.find((l) => l.title === 'All Links')!;
|
|
127
|
-
|
|
128
|
-
// "Update URL" logic
|
|
129
|
-
const showUpdateUrl = agentName !== derivedAgentName;
|
|
130
|
-
const updateUrlHref = `/agents/${encodeURIComponent(derivedAgentName)}`;
|
|
131
|
-
|
|
132
|
-
const handleUpdateUrl = () => {
|
|
133
|
-
if (
|
|
134
|
-
window.confirm(
|
|
135
|
-
`Are you sure you want to change the agent URL from "/agents/${agentName}" to "/agents/${derivedAgentName}"?`,
|
|
136
|
-
)
|
|
137
|
-
) {
|
|
138
|
-
window.location.href = updateUrlHref;
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
const handleDeleteAgent = async () => {
|
|
143
|
-
if (
|
|
144
|
-
window.confirm(
|
|
145
|
-
`Are you sure you want to delete the agent "${agentName}"? This action can be undone by restoring it from the recycle bin.`,
|
|
146
|
-
)
|
|
147
|
-
) {
|
|
148
|
-
try {
|
|
149
|
-
await deleteAgent(agentName);
|
|
150
|
-
window.location.href = '/';
|
|
151
|
-
} catch (error) {
|
|
152
|
-
console.error('Failed to delete agent:', error);
|
|
153
|
-
alert('Failed to delete agent. Please try again.');
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
const menuItems = [
|
|
159
|
-
...(showUpdateUrl
|
|
160
|
-
? [
|
|
161
|
-
{
|
|
162
|
-
type: 'action' as const,
|
|
163
|
-
icon: MoreHorizontalIcon,
|
|
164
|
-
label: 'Update URL',
|
|
165
|
-
onClick: handleUpdateUrl,
|
|
166
|
-
highlight: true,
|
|
167
|
-
},
|
|
168
|
-
{ type: 'divider' as const },
|
|
169
|
-
]
|
|
170
|
-
: []),
|
|
171
|
-
{
|
|
172
|
-
type: 'link' as const,
|
|
173
|
-
href: `/agents/${encodeURIComponent(agentName)}/chat`,
|
|
174
|
-
icon: MessageSquareShareIcon,
|
|
175
|
-
label: 'Standalone Chat',
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
type: 'link' as const,
|
|
179
|
-
href: `/agents/${encodeURIComponent(agentName)}/book+chat`,
|
|
180
|
-
icon: SquareSplitHorizontalIcon,
|
|
181
|
-
label: 'Edit Book & Chat',
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
type: 'link' as const,
|
|
185
|
-
href: editBookLink.href,
|
|
186
|
-
icon: editBookLink.icon,
|
|
187
|
-
label: editBookLink.title,
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
type: 'link' as const,
|
|
191
|
-
href: `/agents/${encodeURIComponent(agentName)}/system-message`,
|
|
192
|
-
icon: FileTextIcon,
|
|
193
|
-
label: 'System Message',
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
type: 'link' as const,
|
|
197
|
-
href: `/agents/${encodeURIComponent(agentName)}/code`,
|
|
198
|
-
icon: CodeIcon,
|
|
199
|
-
label: 'View Code',
|
|
200
|
-
},
|
|
201
|
-
{ type: 'divider' as const },
|
|
202
|
-
{
|
|
203
|
-
type: 'link' as const,
|
|
204
|
-
href: integrationLink.href,
|
|
205
|
-
icon: integrationLink.icon,
|
|
206
|
-
label: integrationLink.title,
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
type: 'link' as const,
|
|
210
|
-
href: historyLink.href,
|
|
211
|
-
icon: historyLink.icon,
|
|
212
|
-
label: historyLink.title, // 'History & Feedback'
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
type: 'link' as const,
|
|
216
|
-
href: allLinksLink.href,
|
|
217
|
-
icon: allLinksLink.icon,
|
|
218
|
-
label: allLinksLink.title,
|
|
219
|
-
},
|
|
220
|
-
{ type: 'divider' as const },
|
|
221
|
-
{
|
|
222
|
-
type: 'action' as const,
|
|
223
|
-
icon: CopyIcon,
|
|
224
|
-
label: copyFeedback === 'URL' ? 'Copied!' : 'Copy Agent URL',
|
|
225
|
-
onClick: () => handleCopy(agentUrl, 'URL'),
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
type: 'action' as const,
|
|
229
|
-
icon: MailIcon,
|
|
230
|
-
label: copyFeedback === 'Email' ? 'Copied!' : 'Copy Agent Email',
|
|
231
|
-
onClick: () => handleCopy(agentEmail, 'Email'),
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
type: 'action' as const,
|
|
235
|
-
icon: QrCodeIcon,
|
|
236
|
-
label: 'Show QR Code',
|
|
237
|
-
onClick: onShowQrCode,
|
|
238
|
-
},
|
|
239
|
-
// Install App - only show if PWA is installable and not already installed
|
|
240
|
-
...(!isInstalled && installPromptEvent
|
|
241
|
-
? [
|
|
242
|
-
{
|
|
243
|
-
type: 'action' as const,
|
|
244
|
-
icon: SmartphoneIcon,
|
|
245
|
-
label: 'Install App',
|
|
246
|
-
onClick: handleInstallApp,
|
|
247
|
-
},
|
|
248
|
-
]
|
|
249
|
-
: []),
|
|
250
|
-
// Admin-only items
|
|
251
|
-
...(isAdmin
|
|
252
|
-
? [
|
|
253
|
-
{ type: 'divider' as const },
|
|
254
|
-
{
|
|
255
|
-
type: 'link' as const,
|
|
256
|
-
href: `/admin/chat-history?agentName=${encodeURIComponent(agentName)}`,
|
|
257
|
-
icon: MessageSquareIcon,
|
|
258
|
-
label: 'Chat History',
|
|
259
|
-
},
|
|
260
|
-
{
|
|
261
|
-
type: 'link' as const,
|
|
262
|
-
href: `/admin/chat-feedback?agentName=${encodeURIComponent(agentName)}`,
|
|
263
|
-
icon: MessageCircleQuestionIcon,
|
|
264
|
-
label: 'Chat Feedback',
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
type: 'link' as const,
|
|
268
|
-
href: `/agents/${encodeURIComponent(agentName)}/clone`,
|
|
269
|
-
icon: CopyPlusIcon,
|
|
270
|
-
label: 'Clone Agent',
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
type: 'link' as const,
|
|
274
|
-
href: `/agents/${encodeURIComponent(agentName)}/export`,
|
|
275
|
-
icon: DownloadIcon,
|
|
276
|
-
label: 'Export Agent',
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
type: 'action' as const,
|
|
280
|
-
icon: TrashIcon,
|
|
281
|
-
label: 'Delete Agent',
|
|
282
|
-
onClick: handleDeleteAgent,
|
|
283
|
-
},
|
|
284
|
-
// {
|
|
285
|
-
// type: 'link' as const,
|
|
286
|
-
// href: backgroundImage,
|
|
287
|
-
// icon: DownloadIcon,
|
|
288
|
-
// label: 'Download Background Image',
|
|
289
|
-
// },
|
|
290
|
-
]
|
|
291
|
-
: []),
|
|
292
|
-
];
|
|
293
|
-
|
|
294
|
-
return (
|
|
295
|
-
<div ref={menuRef} className="relative z-[9999]">
|
|
296
|
-
<button
|
|
297
|
-
onClick={() => setIsOpen(!isOpen)}
|
|
298
|
-
className="p-3 rounded-full hover:bg-white/30 transition-all duration-200"
|
|
299
|
-
// style={{ backgroundColor: brandColorHex }}
|
|
300
|
-
aria-label="More options"
|
|
301
|
-
>
|
|
302
|
-
<MoreHorizontalIcon className="w-5 h-5 text-black" />
|
|
303
|
-
</button>
|
|
304
|
-
|
|
305
|
-
{isOpen && (
|
|
306
|
-
<div
|
|
307
|
-
className={`absolute right-0 top-full mt-2 w-56 bg-white rounded-xl shadow-2xl border border-gray-100 py-2 z-[9999] animate-in fade-in slide-in-from-top-2 duration-200 ${barlowCondensed.className}`}
|
|
308
|
-
>
|
|
309
|
-
{menuItems.map((item, index) => {
|
|
310
|
-
if (item.type === 'divider') {
|
|
311
|
-
return <div key={index} className="h-px bg-gray-100 my-2" />;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
if (item.type === 'link') {
|
|
315
|
-
return (
|
|
316
|
-
<a
|
|
317
|
-
key={index}
|
|
318
|
-
href={item.href}
|
|
319
|
-
className="flex items-center gap-3 px-4 py-2.5 text-gray-700 hover:bg-gray-50 transition-colors"
|
|
320
|
-
onClick={() => setIsOpen(false)}
|
|
321
|
-
>
|
|
322
|
-
<item.icon className="w-4 h-4 text-gray-500" />
|
|
323
|
-
<span className="text-sm font-medium">{item.label}</span>
|
|
324
|
-
</a>
|
|
325
|
-
);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
return (
|
|
329
|
-
<button
|
|
330
|
-
key={index}
|
|
331
|
-
onClick={() => {
|
|
332
|
-
item.onClick?.();
|
|
333
|
-
if (item.label !== 'Show QR Code') {
|
|
334
|
-
// Keep menu open for copy feedback
|
|
335
|
-
}
|
|
336
|
-
}}
|
|
337
|
-
className={`flex items-center gap-3 px-4 py-2.5 w-full text-left transition-colors
|
|
338
|
-
${
|
|
339
|
-
item.highlight
|
|
340
|
-
? 'bg-yellow-100 text-yellow-900 font-bold hover:bg-yellow-200'
|
|
341
|
-
: 'text-gray-700 hover:bg-gray-50'
|
|
342
|
-
}
|
|
343
|
-
`}
|
|
344
|
-
>
|
|
345
|
-
<item.icon
|
|
346
|
-
className={`w-4 h-4 ${item.highlight ? 'text-yellow-700' : 'text-gray-500'}`}
|
|
347
|
-
/>
|
|
348
|
-
<span className="text-sm font-medium">{item.label}</span>
|
|
349
|
-
</button>
|
|
350
|
-
);
|
|
351
|
-
})}
|
|
352
|
-
</div>
|
|
353
|
-
)}
|
|
354
|
-
</div>
|
|
355
|
-
);
|
|
356
|
-
}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { usePromise } from '@common/hooks/usePromise';
|
|
4
|
-
import { Chat } from '@promptbook-local/components';
|
|
5
|
-
import { RemoteAgent } from '@promptbook-local/core';
|
|
6
|
-
import { string_book } from '@promptbook-local/types';
|
|
7
|
-
import { useRouter } from 'next/navigation';
|
|
8
|
-
import { useCallback, useMemo, useState } from 'react';
|
|
9
|
-
import spaceTrim from 'spacetrim';
|
|
10
|
-
import { string_agent_url, string_color } from '../../../../../../src/types/typeAliases';
|
|
11
|
-
import { keepUnused } from '../../../../../../src/utils/organization/keepUnused';
|
|
12
|
-
import { $createAgentFromBookAction } from '../../../app/actions';
|
|
13
|
-
import { DeletedAgentBanner } from '../../../components/DeletedAgentBanner';
|
|
14
|
-
|
|
15
|
-
type AgentProfileChatProps = {
|
|
16
|
-
agentUrl: string_agent_url;
|
|
17
|
-
agentName: string;
|
|
18
|
-
fullname: string;
|
|
19
|
-
brandColorHex: string_color;
|
|
20
|
-
avatarSrc: string;
|
|
21
|
-
isDeleted?: boolean;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export function AgentProfileChat({
|
|
25
|
-
agentUrl,
|
|
26
|
-
agentName,
|
|
27
|
-
fullname,
|
|
28
|
-
brandColorHex,
|
|
29
|
-
avatarSrc,
|
|
30
|
-
isDeleted = false,
|
|
31
|
-
}: AgentProfileChatProps) {
|
|
32
|
-
const router = useRouter();
|
|
33
|
-
const [isCreatingAgent, setIsCreatingAgent] = useState(false);
|
|
34
|
-
|
|
35
|
-
keepUnused(isCreatingAgent);
|
|
36
|
-
|
|
37
|
-
const agentPromise = useMemo(
|
|
38
|
-
() =>
|
|
39
|
-
RemoteAgent.connect({
|
|
40
|
-
agentUrl,
|
|
41
|
-
isVerbose: true,
|
|
42
|
-
}),
|
|
43
|
-
[agentUrl],
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
const { value: agent } = usePromise(agentPromise, [agentPromise]);
|
|
47
|
-
|
|
48
|
-
const handleMessage = useCallback(
|
|
49
|
-
async (message: string) => {
|
|
50
|
-
// Redirect to chat page with the message
|
|
51
|
-
router.push(`/agents/${encodeURIComponent(agentName)}/chat?message=${encodeURIComponent(message)}`);
|
|
52
|
-
},
|
|
53
|
-
[agentName, router],
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
const handleCreateAgent = useCallback(
|
|
57
|
-
async (bookContent: string) => {
|
|
58
|
-
setIsCreatingAgent(true);
|
|
59
|
-
try {
|
|
60
|
-
const { permanentId } = await $createAgentFromBookAction(bookContent as string_book);
|
|
61
|
-
if (permanentId) {
|
|
62
|
-
router.push(`/agents/${permanentId}`);
|
|
63
|
-
}
|
|
64
|
-
} catch (error) {
|
|
65
|
-
console.error('Failed to create agent:', error);
|
|
66
|
-
alert('Failed to create agent. Please try again.');
|
|
67
|
-
} finally {
|
|
68
|
-
setIsCreatingAgent(false);
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
[router],
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
const initialMessage = useMemo(() => {
|
|
75
|
-
if (!agent) {
|
|
76
|
-
return 'Loading...';
|
|
77
|
-
}
|
|
78
|
-
return (
|
|
79
|
-
agent.initialMessage ||
|
|
80
|
-
spaceTrim(`
|
|
81
|
-
Hello! I am ${fullname || agentName || 'an AI Agent'}.
|
|
82
|
-
|
|
83
|
-
[Hello](?message=Hello, can you tell me about yourself?)
|
|
84
|
-
`)
|
|
85
|
-
);
|
|
86
|
-
}, [agent, fullname, agentName]);
|
|
87
|
-
|
|
88
|
-
// If agent is deleted, show banner instead of chat
|
|
89
|
-
if (isDeleted) {
|
|
90
|
-
return (
|
|
91
|
-
<div className="w-full min-h-[350px] md:min-h-[500px] flex items-center justify-center">
|
|
92
|
-
<DeletedAgentBanner message="This agent has been deleted. You can restore it from the Recycle Bin." />
|
|
93
|
-
</div>
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// If agent is not loaded yet, we can show a skeleton or just the default Chat structure
|
|
98
|
-
// But to match "same initial message", we need the agent loaded or at least the default fallback.
|
|
99
|
-
// The fallback above matches AgentChat.tsx default.
|
|
100
|
-
|
|
101
|
-
return (
|
|
102
|
-
<div className="w-full h-[calc(100dvh-300px)] min-h-[350px] md:h-[500px]">
|
|
103
|
-
<Chat
|
|
104
|
-
title={`Chat with ${fullname}`}
|
|
105
|
-
participants={[
|
|
106
|
-
{
|
|
107
|
-
name: 'AGENT',
|
|
108
|
-
fullname,
|
|
109
|
-
isMe: false,
|
|
110
|
-
color: brandColorHex,
|
|
111
|
-
avatarSrc,
|
|
112
|
-
// <- TODO: [🧠] Maybe this shouldnt be there
|
|
113
|
-
},
|
|
114
|
-
]}
|
|
115
|
-
messages={[
|
|
116
|
-
{
|
|
117
|
-
sender: 'AGENT',
|
|
118
|
-
content: initialMessage,
|
|
119
|
-
createdAt: new Date(),
|
|
120
|
-
id: 'initial-message',
|
|
121
|
-
isComplete: true,
|
|
122
|
-
},
|
|
123
|
-
]}
|
|
124
|
-
onMessage={handleMessage}
|
|
125
|
-
onCreateAgent={handleCreateAgent}
|
|
126
|
-
isSaveButtonEnabled={false}
|
|
127
|
-
isCopyButtonEnabled={false}
|
|
128
|
-
className="bg-transparent"
|
|
129
|
-
buttonColor={brandColorHex}
|
|
130
|
-
style={{ background: 'transparent' }}
|
|
131
|
-
/>
|
|
132
|
-
</div>
|
|
133
|
-
);
|
|
134
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { AgentBasicInformation, string_agent_name } from '@promptbook-local/types';
|
|
4
|
-
import { AgentProfile } from '../../../components/AgentProfile/AgentProfile';
|
|
5
|
-
import { AgentOptionsMenu } from './AgentOptionsMenu';
|
|
6
|
-
|
|
7
|
-
type AgentProfileWrapperProps = {
|
|
8
|
-
/***
|
|
9
|
-
* @@@
|
|
10
|
-
*/
|
|
11
|
-
readonly agent: AgentBasicInformation;
|
|
12
|
-
|
|
13
|
-
/***
|
|
14
|
-
* @@@
|
|
15
|
-
*/
|
|
16
|
-
readonly agentUrl: string;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Base URL of the agents server
|
|
20
|
-
*/
|
|
21
|
-
readonly publicUrl: URL;
|
|
22
|
-
|
|
23
|
-
/***
|
|
24
|
-
* @@@
|
|
25
|
-
*/
|
|
26
|
-
readonly agentEmail: string;
|
|
27
|
-
|
|
28
|
-
/***
|
|
29
|
-
* @@@
|
|
30
|
-
*/
|
|
31
|
-
readonly agentName: string_agent_name;
|
|
32
|
-
|
|
33
|
-
/***
|
|
34
|
-
* @@@
|
|
35
|
-
*/
|
|
36
|
-
readonly brandColorHex: string;
|
|
37
|
-
|
|
38
|
-
/***
|
|
39
|
-
* @@@
|
|
40
|
-
*/
|
|
41
|
-
readonly isAdmin: boolean;
|
|
42
|
-
|
|
43
|
-
/***
|
|
44
|
-
* @@@
|
|
45
|
-
*/
|
|
46
|
-
readonly isHeadless: boolean;
|
|
47
|
-
|
|
48
|
-
readonly actions: React.ReactNode;
|
|
49
|
-
|
|
50
|
-
/***
|
|
51
|
-
* @@@
|
|
52
|
-
*/
|
|
53
|
-
readonly children: React.ReactNode;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export function AgentProfileWrapper(props: AgentProfileWrapperProps) {
|
|
57
|
-
const { agent, agentUrl, publicUrl, agentEmail, agentName, brandColorHex, isAdmin, isHeadless, actions, children } =
|
|
58
|
-
props;
|
|
59
|
-
|
|
60
|
-
// Derived agentName from agent data
|
|
61
|
-
const derivedAgentName = agent.agentName;
|
|
62
|
-
const permanentId = agent.permanentId;
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<AgentProfile
|
|
66
|
-
agent={agent}
|
|
67
|
-
agentUrl={agentUrl}
|
|
68
|
-
publicUrl={publicUrl}
|
|
69
|
-
permanentId={permanentId || agentName}
|
|
70
|
-
agentEmail={agentEmail}
|
|
71
|
-
isHeadless={isHeadless}
|
|
72
|
-
renderMenu={({ onShowQrCode }) => (
|
|
73
|
-
<AgentOptionsMenu
|
|
74
|
-
agentName={agentName}
|
|
75
|
-
derivedAgentName={derivedAgentName}
|
|
76
|
-
permanentId={permanentId}
|
|
77
|
-
agentUrl={agentUrl}
|
|
78
|
-
agentEmail={agentEmail}
|
|
79
|
-
brandColorHex={brandColorHex}
|
|
80
|
-
isAdmin={isAdmin}
|
|
81
|
-
onShowQrCode={onShowQrCode}
|
|
82
|
-
backgroundImage="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdjYJh39z8ABJgCe/ZvAS4AAAAASUVORK5CYII="
|
|
83
|
-
/>
|
|
84
|
-
)}
|
|
85
|
-
actions={actions}
|
|
86
|
-
>
|
|
87
|
-
{children}
|
|
88
|
-
</AgentProfile>
|
|
89
|
-
);
|
|
90
|
-
}
|