@promptbook/cli 0.104.0-9 → 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 +255 -130
- 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/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 +9 -7
- 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 +255 -130
- 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 -67
- 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 -70
- 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 -108
- 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 -39
- 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 -90
- 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 -69
- 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 -161
- 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 -46
- package/apps/agents-server/src/app/api/agents/[agentName]/restore/route.ts +0 -20
- package/apps/agents-server/src/app/api/agents/[agentName]/route.ts +0 -61
- 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/browser-test/scroll-facebook/route.ts +0 -62
- 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 -264
- package/apps/agents-server/src/components/AgentProfile/AgentProfileFromSource.tsx +0 -23
- package/apps/agents-server/src/components/AgentProfile/AgentProfileImage.tsx +0 -79
- 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/NewAgentDialog/NewAgentDialog.tsx +0 -88
- 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/migrations/2025-12-0820-agent-history-permanent-id.sql +0 -29
- package/apps/agents-server/src/database/schema.ts +0 -511
- 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]/book+chat/AgentBookAndChatComponent.tsx.todo
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { ResizablePanelsAuto } from '@common/components/ResizablePanelsAuto/ResizablePanelsAuto';
|
|
4
|
-
import { useStateInLocalStorage } from '@common/hooks/useStateInLocalStorage';
|
|
5
|
-
import { AgentChat, BookEditor } from '@promptbook-local/components';
|
|
6
|
-
import { Agent, book } from '@promptbook-local/core';
|
|
7
|
-
// import { RemoteLlmExecutionTools } from '@promptbook-local/remote-client';
|
|
8
|
-
import { OpenAiAssistantExecutionTools } from '@promptbook-local/openai';
|
|
9
|
-
import type { string_book } from '@promptbook-local/types';
|
|
10
|
-
import { useMemo, useState } from 'react';
|
|
11
|
-
|
|
12
|
-
export function AgentBookAndChatComponent() {
|
|
13
|
-
const [apiKey, setApiKey] = useStateInLocalStorage<string>('openai-apiKey', () => '');
|
|
14
|
-
const [isApiKeyVisible, setIsApiKeyVisible] = useState(false);
|
|
15
|
-
const [isApiKeySectionCollapsed, setIsApiKeySectionCollapsed] = useState(!!apiKey);
|
|
16
|
-
|
|
17
|
-
const [agentSource, setAgentSource] = useStateInLocalStorage<string_book>(
|
|
18
|
-
'marigold-agentSource-1',
|
|
19
|
-
// TODO: [🐱🚀] Uplad image to ptbk.io CDN
|
|
20
|
-
() => book`
|
|
21
|
-
Marigold
|
|
22
|
-
|
|
23
|
-
META IMAGE https://westlandsuk.co.uk/wp-content/uploads/2021/06/Inspired.MarigoldFlowers_CMYK_40mm.jpg
|
|
24
|
-
META COLOR #EC810B
|
|
25
|
-
|
|
26
|
-
PERSONA You are writing stories about Witcher
|
|
27
|
-
RULE Do not talk about our world, only about the Witcher universe
|
|
28
|
-
|
|
29
|
-
KNOWLEDGE {Geralt of Rivia}
|
|
30
|
-
Geralt of Rivia is a witcher, a monster hunter for hire, known for his white hair and cat-like eyes.
|
|
31
|
-
He possesses superhuman abilities due to mutations he underwent during the Trial of the Grasses.
|
|
32
|
-
Geralt is skilled in swordsmanship, alchemy, and magic signs.
|
|
33
|
-
He is often accompanied by his horse, Roach, and has a complex relationship with {Yennefer of Vengerberg},
|
|
34
|
-
a powerful sorceress, and {Ciri}, his adopted daughter with a destiny intertwined with his own.
|
|
35
|
-
His secret word is "Apple".
|
|
36
|
-
|
|
37
|
-
KNOWLEDGE {Yennefer of Vengerberg}
|
|
38
|
-
Yennefer of Vengerberg is a formidable sorceress known for her beauty, intelligence, and temper.
|
|
39
|
-
She has a complicated past, having been born with a hunchback and later transformed through magic.
|
|
40
|
-
Yennefer is deeply connected to Geralt of Rivia, with whom she shares a tumultuous romantic relationship.
|
|
41
|
-
She is also a mother figure to {Ciri}, whom she trains in the ways of magic.
|
|
42
|
-
Her secret word is "Banana".
|
|
43
|
-
|
|
44
|
-
KNOWLEDGE {Ciri}
|
|
45
|
-
Ciri, also known as {Cirilla Fiona Elen Riannon}, is a young woman with a mysterious past and a powerful destiny.
|
|
46
|
-
She is the daughter of {Poviss}, the ruler of the kingdom of Cintra, and possesses the Elder Blood, which grants her extraordinary abilities.
|
|
47
|
-
Ciri is a skilled fighter and has been trained in the ways of the sword by Geralt of Rivia.
|
|
48
|
-
Her destiny is intertwined with that of Geralt and Yennefer, as they both seek to protect her from those who would exploit her powers.
|
|
49
|
-
Her secret word is "Cherry".
|
|
50
|
-
|
|
51
|
-
`,
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
const agent = useMemo(() => {
|
|
55
|
-
/*/
|
|
56
|
-
// TODO: [🐱🚀] Try working with `RemoteLlmExecutionTools`
|
|
57
|
-
const llm = new RemoteLlmExecutionTools({
|
|
58
|
-
remoteServerUrl: 'https://promptbook.s5.ptbk.io/',
|
|
59
|
-
identification: {
|
|
60
|
-
isAnonymous: false,
|
|
61
|
-
appId: '20a65fee-59f6-4d05-acd0-8e5ae8345488',
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
/**/
|
|
65
|
-
|
|
66
|
-
/**/
|
|
67
|
-
const llm = new OpenAiAssistantExecutionTools({
|
|
68
|
-
dangerouslyAllowBrowser: true,
|
|
69
|
-
isCreatingNewAssistantsAllowed: true, // <- TODO: [🐱🚀] Test without whether warning is shown
|
|
70
|
-
apiKey,
|
|
71
|
-
assistantId: 'asst_xI94Elk27nssnwAUkG2Cmok8', // <- TODO: [🧠] Make dynamic
|
|
72
|
-
isVerbose: true,
|
|
73
|
-
});
|
|
74
|
-
/**/
|
|
75
|
-
|
|
76
|
-
const agent = new Agent({
|
|
77
|
-
executionTools: {
|
|
78
|
-
llm,
|
|
79
|
-
},
|
|
80
|
-
agentSource: [agentSource, setAgentSource],
|
|
81
|
-
isVerbose: true,
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
return agent;
|
|
85
|
-
}, [agentSource, setAgentSource, apiKey]);
|
|
86
|
-
|
|
87
|
-
return (
|
|
88
|
-
<div className="min-h-screen relative">
|
|
89
|
-
{/* Floating API Key Configuration */}
|
|
90
|
-
<div className={`fixed top-24 right-4 z-50 ${isApiKeySectionCollapsed ? '' : 'min-w-[400px]'}`}>
|
|
91
|
-
{isApiKeySectionCollapsed ? (
|
|
92
|
-
// Collapsed state - small corner button
|
|
93
|
-
<button
|
|
94
|
-
onClick={() => setIsApiKeySectionCollapsed(false)}
|
|
95
|
-
className="bg-gray-100 hover:bg-gray-200 border border-gray-300 rounded-full p-2 shadow-lg transition-all flex items-center gap-1"
|
|
96
|
-
title="Configure OpenAI API Key"
|
|
97
|
-
>
|
|
98
|
-
<span className="text-sm">🔑</span>
|
|
99
|
-
</button>
|
|
100
|
-
) : (
|
|
101
|
-
// Expanded state - full configuration panel
|
|
102
|
-
<div className="bg-white border border-gray-300 rounded-lg shadow-lg">
|
|
103
|
-
<div className="flex items-center justify-between p-3 bg-gray-100 rounded-t-lg border-b border-gray-300">
|
|
104
|
-
<span className="font-medium text-sm">OpenAI API Key</span>
|
|
105
|
-
<button
|
|
106
|
-
onClick={() => setIsApiKeySectionCollapsed(true)}
|
|
107
|
-
className="text-gray-600 hover:text-gray-800 text-lg leading-none"
|
|
108
|
-
title="Collapse"
|
|
109
|
-
>
|
|
110
|
-
✕
|
|
111
|
-
</button>
|
|
112
|
-
</div>
|
|
113
|
-
<div className="p-3">
|
|
114
|
-
<label className="flex items-center gap-2">
|
|
115
|
-
<span className="text-sm font-medium whitespace-nowrap">API Key:</span>
|
|
116
|
-
<input
|
|
117
|
-
type={isApiKeyVisible ? 'text' : 'password'}
|
|
118
|
-
value={apiKey}
|
|
119
|
-
onChange={(e) => setApiKey(e.target.value)}
|
|
120
|
-
placeholder="sk-proj-..."
|
|
121
|
-
className="flex-1 px-3 py-2 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
122
|
-
/>
|
|
123
|
-
<button
|
|
124
|
-
type="button"
|
|
125
|
-
onClick={() => setIsApiKeyVisible(!isApiKeyVisible)}
|
|
126
|
-
className="px-2 py-2 bg-white border border-gray-300 rounded-md hover:bg-gray-50 transition-colors text-sm"
|
|
127
|
-
title={isApiKeyVisible ? 'Hide API key' : 'Show API key'}
|
|
128
|
-
>
|
|
129
|
-
{isApiKeyVisible ? '🙈' : '👁️'}
|
|
130
|
-
</button>
|
|
131
|
-
</label>
|
|
132
|
-
</div>
|
|
133
|
-
</div>
|
|
134
|
-
)}
|
|
135
|
-
</div>
|
|
136
|
-
|
|
137
|
-
<ResizablePanelsAuto name="two-editors">
|
|
138
|
-
<BookEditor
|
|
139
|
-
className="w-full h-full"
|
|
140
|
-
isBorderRadiusDisabled
|
|
141
|
-
height={null}
|
|
142
|
-
value={agentSource}
|
|
143
|
-
onChange={setAgentSource}
|
|
144
|
-
// className={styles.BookEditor}
|
|
145
|
-
isVerbose={false}
|
|
146
|
-
onFileUpload={(file) => {
|
|
147
|
-
return file.name;
|
|
148
|
-
}}
|
|
149
|
-
/>
|
|
150
|
-
|
|
151
|
-
<AgentChat className={`h-full flex flex-col`} {...{ agent }} />
|
|
152
|
-
</ResizablePanelsAuto>
|
|
153
|
-
</div>
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* TODO: [🐱🚀] Make self-learning book createAgentLlmExecutionTools, use bidirectional agentSource
|
|
159
|
-
* TODO: [🚗] Components and pages here should be just tiny UI wraper around proper agent logic and conponents
|
|
160
|
-
*/
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
'use server';
|
|
2
|
-
|
|
3
|
-
import { ForbiddenPage } from '@/src/components/ForbiddenPage/ForbiddenPage';
|
|
4
|
-
import { $provideAgentCollectionForServer } from '@/src/tools/$provideAgentCollectionForServer';
|
|
5
|
-
import { isUserAdmin } from '@/src/utils/isUserAdmin';
|
|
6
|
-
import { headers } from 'next/headers';
|
|
7
|
-
import { $sideEffect } from '../../../../../../../src/utils/organization/$sideEffect';
|
|
8
|
-
import { isAgentDeleted } from '../_utils';
|
|
9
|
-
import { generateAgentMetadata } from '../generateAgentMetadata';
|
|
10
|
-
import { AgentBookAndChat } from './AgentBookAndChat';
|
|
11
|
-
import { DeletedAgentBanner } from '../../../../components/DeletedAgentBanner';
|
|
12
|
-
|
|
13
|
-
export const generateMetadata = generateAgentMetadata;
|
|
14
|
-
|
|
15
|
-
export default async function AgentBookAndChatPage({ params }: { params: Promise<{ agentName: string }> }) {
|
|
16
|
-
$sideEffect(headers());
|
|
17
|
-
|
|
18
|
-
let { agentName } = await params;
|
|
19
|
-
agentName = decodeURIComponent(agentName);
|
|
20
|
-
|
|
21
|
-
const isDeleted = await isAgentDeleted(agentName);
|
|
22
|
-
|
|
23
|
-
if (isDeleted) {
|
|
24
|
-
return (
|
|
25
|
-
<div className="w-screen h-[calc(100vh-60px)] flex items-center justify-center p-8">
|
|
26
|
-
<DeletedAgentBanner />
|
|
27
|
-
</div>
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (!(await isUserAdmin())) {
|
|
32
|
-
/* <- TODO: [👹] Here should be user permissions */
|
|
33
|
-
return <ForbiddenPage />;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const collection = await $provideAgentCollectionForServer();
|
|
37
|
-
const agentSource = await collection.getAgentSource(agentName);
|
|
38
|
-
const agentUrl = `/agents/${agentName}`;
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<div className={`w-screen h-[calc(100vh-60px)]`}>
|
|
42
|
-
<AgentBookAndChat agentName={agentName} initialAgentSource={agentSource} agentUrl={agentUrl} />
|
|
43
|
-
</div>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import dynamic from 'next/dynamic';
|
|
4
|
-
|
|
5
|
-
const SelfLearningBook = dynamic(
|
|
6
|
-
() => import('./AgentBookAndChatComponent').then((module) => module.AgentBookAndChatComponent),
|
|
7
|
-
{
|
|
8
|
-
ssr: false,
|
|
9
|
-
},
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
export default function AgentBookAndChatPage() {
|
|
13
|
-
return <SelfLearningBook />;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* TODO: [🐱🚀] Private / public / open agents
|
|
18
|
-
* TODO: [🐱🚀] Allow http://localhost:4440/agents/agent-123.book to download the agent book file
|
|
19
|
-
* TODO: [🐱🚀] BOOK_MIME_TYPE in config
|
|
20
|
-
* TODO: [🚗] Components and pages here should be just tiny UI wraper around proper agent logic and conponents
|
|
21
|
-
*/
|
|
@@ -1,68 +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, useMemo } from 'react';
|
|
7
|
-
import { string_agent_url } from '../../../../../../../src/types/typeAliases';
|
|
8
|
-
|
|
9
|
-
type AgentChatWrapperProps = {
|
|
10
|
-
agentUrl: string_agent_url;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
// TODO: [🐱🚀] Rename to AgentChatSomethingWrapper
|
|
14
|
-
|
|
15
|
-
export function AgentChatWrapper(props: AgentChatWrapperProps) {
|
|
16
|
-
const { agentUrl } = props;
|
|
17
|
-
|
|
18
|
-
const agentPromise = useMemo(
|
|
19
|
-
() =>
|
|
20
|
-
RemoteAgent.connect({
|
|
21
|
-
agentUrl,
|
|
22
|
-
isVerbose: true,
|
|
23
|
-
}),
|
|
24
|
-
[agentUrl],
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
const { value: agent } = usePromise(agentPromise, [agentPromise]);
|
|
28
|
-
|
|
29
|
-
const handleFeedback = useCallback(
|
|
30
|
-
async (feedback: {
|
|
31
|
-
rating: number;
|
|
32
|
-
textRating?: string;
|
|
33
|
-
chatThread?: string;
|
|
34
|
-
userNote?: string;
|
|
35
|
-
expectedAnswer?: string | null;
|
|
36
|
-
}) => {
|
|
37
|
-
if (!agent) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
await fetch(`${agentUrl}/api/feedback`, {
|
|
42
|
-
method: 'POST',
|
|
43
|
-
headers: {
|
|
44
|
-
'Content-Type': 'application/json',
|
|
45
|
-
},
|
|
46
|
-
body: JSON.stringify({
|
|
47
|
-
rating: feedback.rating.toString(),
|
|
48
|
-
textRating: feedback.textRating,
|
|
49
|
-
chatThread: feedback.chatThread,
|
|
50
|
-
userNote: feedback.textRating, // Mapping textRating to userNote as well if needed, or just textRating
|
|
51
|
-
expectedAnswer: feedback.expectedAnswer,
|
|
52
|
-
agentHash: agent.agentHash,
|
|
53
|
-
}),
|
|
54
|
-
});
|
|
55
|
-
},
|
|
56
|
-
[agent, agentUrl],
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
if (!agent) {
|
|
60
|
-
return <>{/* <- TODO: [🐱🚀] <PromptbookLoading /> */}</>;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return <AgentChat className={`w-full h-full`} agent={agent} onFeedback={handleFeedback} />;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* TODO: [🚗] Transfer the saving logic to `<BookEditor/>` be aware of CRDT / yjs approach to be implementable in future
|
|
68
|
-
*/
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
'use server';
|
|
2
|
-
|
|
3
|
-
import { headers } from 'next/headers';
|
|
4
|
-
import { $sideEffect } from '../../../../../../../src/utils/organization/$sideEffect';
|
|
5
|
-
import { isAgentDeleted } from '../_utils';
|
|
6
|
-
import { generateAgentMetadata } from '../generateAgentMetadata';
|
|
7
|
-
import { AgentChatWrapper } from '../AgentChatWrapper';
|
|
8
|
-
import { DeletedAgentBanner } from '../../../../components/DeletedAgentBanner';
|
|
9
|
-
|
|
10
|
-
export const generateMetadata = generateAgentMetadata;
|
|
11
|
-
|
|
12
|
-
export default async function AgentChatPage({
|
|
13
|
-
params,
|
|
14
|
-
searchParams,
|
|
15
|
-
}: {
|
|
16
|
-
params: Promise<{ agentName: string }>;
|
|
17
|
-
searchParams: Promise<{ message?: string }>;
|
|
18
|
-
}) {
|
|
19
|
-
$sideEffect(headers());
|
|
20
|
-
let { agentName } = await params;
|
|
21
|
-
agentName = decodeURIComponent(agentName);
|
|
22
|
-
const { message } = await searchParams;
|
|
23
|
-
|
|
24
|
-
const isDeleted = await isAgentDeleted(agentName);
|
|
25
|
-
|
|
26
|
-
if (isDeleted) {
|
|
27
|
-
return (
|
|
28
|
-
<main className="w-screen h-screen flex items-center justify-center p-8">
|
|
29
|
-
<DeletedAgentBanner message="This agent has been deleted. You can restore it from the Recycle Bin." />
|
|
30
|
-
</main>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const agentUrl = `/agents/${agentName}`;
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<main className={`w-screen h-screen`}>
|
|
38
|
-
<AgentChatWrapper agentUrl={agentUrl} autoExecuteMessage={message} />
|
|
39
|
-
</main>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* TODO: [🚗] Components and pages here should be just tiny UI wraper around proper agent logic and conponents
|
|
45
|
-
*/
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { $provideAgentCollectionForServer } from '@/src/tools/$provideAgentCollectionForServer';
|
|
2
|
-
import { $provideExecutionToolsForServer } from '@/src/tools/$provideExecutionToolsForServer';
|
|
3
|
-
import { NextRequest, NextResponse } from 'next/server';
|
|
4
|
-
import { $bookTranspilersRegister } from '../../../../../../../../src/transpilers/_common/register/$bookTranspilersRegister';
|
|
5
|
-
import { keepUnused } from '../../../../../../../../src/utils/organization/keepUnused';
|
|
6
|
-
|
|
7
|
-
export async function GET(request: NextRequest, { params }: { params: Promise<{ agentName: string }> }) {
|
|
8
|
-
keepUnused(request);
|
|
9
|
-
keepUnused(params);
|
|
10
|
-
// const agentName = (await params).agentName;
|
|
11
|
-
|
|
12
|
-
try {
|
|
13
|
-
// Get available transpilers
|
|
14
|
-
const transpilers = $bookTranspilersRegister.list().map((transpiler) => ({
|
|
15
|
-
name: transpiler.name,
|
|
16
|
-
title: transpiler.title,
|
|
17
|
-
}));
|
|
18
|
-
|
|
19
|
-
return NextResponse.json({ transpilers });
|
|
20
|
-
} catch (error) {
|
|
21
|
-
console.error('Error getting transpilers:', error);
|
|
22
|
-
return NextResponse.json({ error: 'Failed to get transpilers' }, { status: 500 });
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export async function POST(request: NextRequest, { params }: { params: Promise<{ agentName: string }> }) {
|
|
27
|
-
const agentName = (await params).agentName;
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
const { transpilerName } = await request.json();
|
|
31
|
-
|
|
32
|
-
if (!transpilerName) {
|
|
33
|
-
return NextResponse.json({ error: 'Transpiler name is required' }, { status: 400 });
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Get the transpiler
|
|
37
|
-
const allTranspilers = $bookTranspilersRegister.list();
|
|
38
|
-
const transpiler = allTranspilers.find((t) => t.name === transpilerName);
|
|
39
|
-
if (!transpiler) {
|
|
40
|
-
return NextResponse.json({ error: 'Transpiler not found' }, { status: 404 });
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Get agent source
|
|
44
|
-
const collection = await $provideAgentCollectionForServer();
|
|
45
|
-
const agentSource = await collection.getAgentSource(agentName);
|
|
46
|
-
|
|
47
|
-
if (!agentSource) {
|
|
48
|
-
return NextResponse.json({ error: 'Agent source not found' }, { status: 404 });
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Get execution tools
|
|
52
|
-
const tools = await $provideExecutionToolsForServer();
|
|
53
|
-
|
|
54
|
-
// Transpile the code
|
|
55
|
-
const transpiledCode = await transpiler.transpileBook(agentSource, tools);
|
|
56
|
-
|
|
57
|
-
return NextResponse.json({
|
|
58
|
-
code: transpiledCode,
|
|
59
|
-
transpiler: {
|
|
60
|
-
name: transpiler.name,
|
|
61
|
-
title: transpiler.title,
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
} catch (error) {
|
|
65
|
-
console.error('Error transpiling code:', error);
|
|
66
|
-
return NextResponse.json({ error: 'Failed to transpile code' }, { status: 500 });
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { NEXT_PUBLIC_SITE_URL } from '@/config';
|
|
4
|
-
import Editor from '@monaco-editor/react';
|
|
5
|
-
import { generatePlaceholderAgentProfileImageUrl } from '@promptbook-local/core';
|
|
6
|
-
import { AgentBasicInformation } from '@promptbook-local/types';
|
|
7
|
-
import { ArrowLeftIcon, ChevronDownIcon, CodeIcon } from 'lucide-react';
|
|
8
|
-
import Link from 'next/link';
|
|
9
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
10
|
-
|
|
11
|
-
type Transpiler = {
|
|
12
|
-
name: string;
|
|
13
|
-
title: string;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
type TranspilationResult = {
|
|
17
|
-
code: string;
|
|
18
|
-
transpiler: Transpiler;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
function getLanguageFromTranspiler(transpilerName?: string): string {
|
|
22
|
-
if (!transpilerName) return 'plaintext';
|
|
23
|
-
|
|
24
|
-
// Map transpiler names to Monaco language identifiers
|
|
25
|
-
if (transpilerName.includes('openai-sdk')) return 'javascript';
|
|
26
|
-
if (transpilerName.includes('langchain') || transpilerName.includes('python')) return 'python';
|
|
27
|
-
if (transpilerName.includes('markdown')) return 'markdown';
|
|
28
|
-
|
|
29
|
-
// Default to plaintext for unknown transpilers
|
|
30
|
-
return 'plaintext';
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export default function AgentCodePage({ params }: { params: Promise<{ agentName: string }> }) {
|
|
34
|
-
const [agentName, setAgentName] = useState<string>('');
|
|
35
|
-
const [agentProfile, setAgentProfile] = useState<AgentBasicInformation | null>(null);
|
|
36
|
-
const [transpilers, setTranspilers] = useState<Transpiler[]>([]);
|
|
37
|
-
const [selectedTranspiler, setSelectedTranspiler] = useState<Transpiler | null>(null);
|
|
38
|
-
const [transpiledCode, setTranspiledCode] = useState<string>('');
|
|
39
|
-
const [loading, setLoading] = useState(false);
|
|
40
|
-
const [error, setError] = useState<string>('');
|
|
41
|
-
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
params.then((p) => setAgentName(p.agentName));
|
|
44
|
-
}, [params]);
|
|
45
|
-
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (!agentName) return;
|
|
48
|
-
|
|
49
|
-
// Fetch agent profile
|
|
50
|
-
fetch(`/api/agents/${encodeURIComponent(agentName)}`)
|
|
51
|
-
.then((res) => res.json())
|
|
52
|
-
.then((data) => setAgentProfile(data))
|
|
53
|
-
.catch((err) => console.error('Error fetching agent profile:', err));
|
|
54
|
-
|
|
55
|
-
// Fetch available transpilers
|
|
56
|
-
fetch(`/agents/${encodeURIComponent(agentName)}/code/api`)
|
|
57
|
-
.then((res) => res.json())
|
|
58
|
-
.then((data) => {
|
|
59
|
-
setTranspilers(data.transpilers || []);
|
|
60
|
-
if (data.transpilers && data.transpilers.length > 0) {
|
|
61
|
-
setSelectedTranspiler(data.transpilers[0]);
|
|
62
|
-
}
|
|
63
|
-
})
|
|
64
|
-
.catch((err) => console.error('Error fetching transpilers:', err));
|
|
65
|
-
}, [agentName]);
|
|
66
|
-
|
|
67
|
-
const transpileCode = useCallback(
|
|
68
|
-
async (transpilerName: string) => {
|
|
69
|
-
setLoading(true);
|
|
70
|
-
setError('');
|
|
71
|
-
|
|
72
|
-
try {
|
|
73
|
-
const response = await fetch(`/agents/${encodeURIComponent(agentName)}/code/api`, {
|
|
74
|
-
method: 'POST',
|
|
75
|
-
headers: {
|
|
76
|
-
'Content-Type': 'application/json',
|
|
77
|
-
},
|
|
78
|
-
body: JSON.stringify({ transpilerName }),
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
if (!response.ok) {
|
|
82
|
-
const errorData = await response.json();
|
|
83
|
-
throw new Error(errorData.error || 'Failed to transpile code');
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const result: TranspilationResult = await response.json();
|
|
87
|
-
setTranspiledCode(result.code);
|
|
88
|
-
} catch (err) {
|
|
89
|
-
setError(err instanceof Error ? err.message : 'Failed to transpile code');
|
|
90
|
-
setTranspiledCode('');
|
|
91
|
-
} finally {
|
|
92
|
-
setLoading(false);
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
[agentName],
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
useEffect(() => {
|
|
99
|
-
if (selectedTranspiler && agentName) {
|
|
100
|
-
transpileCode(selectedTranspiler.name);
|
|
101
|
-
}
|
|
102
|
-
}, [selectedTranspiler, agentName, transpileCode]);
|
|
103
|
-
|
|
104
|
-
if (!agentProfile) {
|
|
105
|
-
return (
|
|
106
|
-
<div className="min-h-screen p-6 md:p-12 flex flex-col items-center bg-gray-50">
|
|
107
|
-
<div className="w-full max-w-4xl bg-white rounded-xl shadow-sm border border-gray-200 p-12">
|
|
108
|
-
<div className="text-center">Loading...</div>
|
|
109
|
-
</div>
|
|
110
|
-
</div>
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
<div className="min-h-screen p-6 md:p-12 flex flex-col items-center bg-gray-50">
|
|
116
|
-
<div className="w-full max-w-4xl bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden">
|
|
117
|
-
{/* Header */}
|
|
118
|
-
<div className="p-6 border-b border-gray-200 flex items-center gap-4">
|
|
119
|
-
{/* eslint-disable @typescript-eslint/no-explicit-any, @next/next/no-img-element */}
|
|
120
|
-
|
|
121
|
-
<img
|
|
122
|
-
src={
|
|
123
|
-
agentProfile.meta.image ||
|
|
124
|
-
generatePlaceholderAgentProfileImageUrl(
|
|
125
|
-
agentProfile.permanentId || agentName,
|
|
126
|
-
NEXT_PUBLIC_SITE_URL, // <- TODO: !!!! Use here `const { publicUrl } = await $provideServer();`
|
|
127
|
-
)
|
|
128
|
-
}
|
|
129
|
-
alt={agentProfile.meta.fullname || agentName}
|
|
130
|
-
className="w-16 h-16 rounded-full object-cover border-2 border-gray-200"
|
|
131
|
-
/>
|
|
132
|
-
|
|
133
|
-
<div className="flex-1">
|
|
134
|
-
{/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}
|
|
135
|
-
<h1 className="text-2xl font-bold text-gray-900">
|
|
136
|
-
{(agentProfile as any)?.meta?.fullname || agentName}
|
|
137
|
-
</h1>
|
|
138
|
-
<p className="text-gray-500 flex items-center gap-2">
|
|
139
|
-
<CodeIcon className="w-4 h-4" />
|
|
140
|
-
Generated Code
|
|
141
|
-
</p>
|
|
142
|
-
</div>
|
|
143
|
-
<Link
|
|
144
|
-
href={`/agents/${encodeURIComponent(agentName)}`}
|
|
145
|
-
className="p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 rounded-full transition-colors"
|
|
146
|
-
title="Back to Agent"
|
|
147
|
-
>
|
|
148
|
-
<ArrowLeftIcon className="w-6 h-6" />
|
|
149
|
-
</Link>
|
|
150
|
-
</div>
|
|
151
|
-
|
|
152
|
-
<div className="p-6">
|
|
153
|
-
{/* Transpiler Selector */}
|
|
154
|
-
<div className="mb-6">
|
|
155
|
-
<label className="block text-sm font-medium text-gray-700 mb-2">Select Transpiler</label>
|
|
156
|
-
<div className="relative">
|
|
157
|
-
<select
|
|
158
|
-
value={selectedTranspiler?.name || ''}
|
|
159
|
-
onChange={(e) => {
|
|
160
|
-
const transpiler = transpilers.find((t) => t.name === e.target.value);
|
|
161
|
-
if (transpiler) setSelectedTranspiler(transpiler);
|
|
162
|
-
}}
|
|
163
|
-
className="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
|
|
164
|
-
>
|
|
165
|
-
{transpilers.map((transpiler) => (
|
|
166
|
-
<option key={transpiler.name} value={transpiler.name}>
|
|
167
|
-
{transpiler.title}
|
|
168
|
-
</option>
|
|
169
|
-
))}
|
|
170
|
-
</select>
|
|
171
|
-
<ChevronDownIcon className="absolute right-3 top-3 w-4 h-4 text-gray-400 pointer-events-none" />
|
|
172
|
-
</div>
|
|
173
|
-
</div>
|
|
174
|
-
|
|
175
|
-
{/* Code Display */}
|
|
176
|
-
<div className="bg-gray-50 rounded-lg border border-gray-200 overflow-hidden">
|
|
177
|
-
<div className="p-4 border-b border-gray-200 flex items-center justify-between">
|
|
178
|
-
<h2 className="text-lg font-semibold text-gray-900">
|
|
179
|
-
{selectedTranspiler?.title || 'Generated Code'}
|
|
180
|
-
</h2>
|
|
181
|
-
{loading && <div className="text-sm text-gray-500">Generating...</div>}
|
|
182
|
-
</div>
|
|
183
|
-
<div className="p-4">
|
|
184
|
-
{error && (
|
|
185
|
-
<div className="text-red-600 text-sm mb-4 p-3 bg-red-50 rounded border border-red-200">
|
|
186
|
-
{error}
|
|
187
|
-
</div>
|
|
188
|
-
)}
|
|
189
|
-
{transpiledCode ? (
|
|
190
|
-
<div className="h-96 border border-gray-200 rounded">
|
|
191
|
-
<Editor
|
|
192
|
-
value={transpiledCode}
|
|
193
|
-
language={getLanguageFromTranspiler(selectedTranspiler?.name)}
|
|
194
|
-
options={{
|
|
195
|
-
readOnly: true,
|
|
196
|
-
minimap: { enabled: false },
|
|
197
|
-
fontSize: 14,
|
|
198
|
-
lineNumbers: 'on',
|
|
199
|
-
scrollBeyondLastLine: false,
|
|
200
|
-
automaticLayout: true,
|
|
201
|
-
wordWrap: 'on',
|
|
202
|
-
}}
|
|
203
|
-
loading={
|
|
204
|
-
<div className="flex items-center justify-center h-full text-gray-500">
|
|
205
|
-
Loading editor...
|
|
206
|
-
</div>
|
|
207
|
-
}
|
|
208
|
-
/>
|
|
209
|
-
</div>
|
|
210
|
-
) : loading ? (
|
|
211
|
-
<div className="text-gray-500 text-center py-8">Generating code...</div>
|
|
212
|
-
) : (
|
|
213
|
-
<div className="text-gray-500 text-center py-8">
|
|
214
|
-
Select a transpiler to generate code
|
|
215
|
-
</div>
|
|
216
|
-
)}
|
|
217
|
-
</div>
|
|
218
|
-
</div>
|
|
219
|
-
</div>
|
|
220
|
-
</div>
|
|
221
|
-
</div>
|
|
222
|
-
);
|
|
223
|
-
}
|