@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.
Files changed (333) hide show
  1. package/README.md +0 -4
  2. package/esm/index.es.js +261 -131
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/components.index.d.ts +0 -6
  5. package/esm/typings/src/_packages/core.index.d.ts +8 -6
  6. package/esm/typings/src/_packages/types.index.d.ts +8 -0
  7. package/esm/typings/src/_packages/utils.index.d.ts +2 -0
  8. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +24 -0
  9. package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +12 -2
  10. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.tools.test.d.ts +1 -0
  11. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.closed.test.d.ts +1 -0
  12. package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +1 -1
  13. package/esm/typings/src/book-components/Chat/save/_common/string_chat_format_name.d.ts +1 -1
  14. package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +6 -3
  15. package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +5 -1
  16. package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +5 -1
  17. package/esm/typings/src/book-components/icons/AboutIcon.d.ts +5 -1
  18. package/esm/typings/src/book-components/icons/AttachmentIcon.d.ts +6 -2
  19. package/esm/typings/src/book-components/icons/CameraIcon.d.ts +6 -2
  20. package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +5 -1
  21. package/esm/typings/src/book-components/icons/MenuIcon.d.ts +5 -1
  22. package/esm/typings/src/book-components/icons/SaveIcon.d.ts +6 -2
  23. package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +1 -1
  24. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +18 -12
  25. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +6 -3
  26. package/esm/typings/src/commands/_common/types/Command.d.ts +1 -1
  27. package/esm/typings/src/commitments/META/META_DESCRIPTION.d.ts +41 -0
  28. package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +2 -2
  29. package/esm/typings/src/commitments/_base/BookCommitment.d.ts +1 -1
  30. package/esm/typings/src/config.d.ts +8 -1
  31. package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +1 -1
  32. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
  33. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +1 -1
  34. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +1 -1
  35. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/countUsage.d.ts +8 -4
  36. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +1 -1
  37. package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -1
  38. package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +12 -8
  39. package/esm/typings/src/llm-providers/agent/Agent.d.ts +7 -1
  40. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +1 -1
  41. package/esm/typings/src/llm-providers/openai/utils/mapToolsToOpenAi.d.ts +8 -0
  42. package/esm/typings/src/remote-server/ui/ServerApp.d.ts +5 -1
  43. package/esm/typings/src/scrapers/_common/utils/promptbookFetch.test.d.ts +1 -0
  44. package/esm/typings/src/search-engines/SearchEngine.d.ts +9 -0
  45. package/esm/typings/src/search-engines/SearchResult.d.ts +18 -0
  46. package/esm/typings/src/search-engines/bing/BingSearchEngine.d.ts +15 -0
  47. package/esm/typings/src/search-engines/dummy/DummySearchEngine.d.ts +15 -0
  48. package/esm/typings/src/types/LlmToolDefinition.d.ts +20 -0
  49. package/esm/typings/src/types/ModelRequirements.d.ts +13 -0
  50. package/esm/typings/src/types/typeAliasEmoji.d.ts +2 -2
  51. package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +7 -2
  52. package/esm/typings/src/utils/random/$randomItem.d.ts +1 -1
  53. package/esm/typings/src/utils/random/$randomSeed.d.ts +1 -1
  54. package/esm/typings/src/utils/validators/url/isValidAgentUrl.d.ts +16 -0
  55. package/esm/typings/src/utils/validators/url/isValidAgentUrl.test.d.ts +1 -0
  56. package/esm/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +2 -1
  57. package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +4 -3
  58. package/esm/typings/src/version.d.ts +1 -1
  59. package/package.json +1 -1
  60. package/umd/index.umd.js +261 -131
  61. package/umd/index.umd.js.map +1 -1
  62. package/apps/agents-server/README.md +0 -3
  63. package/apps/agents-server/TODO.txt +0 -7
  64. package/apps/agents-server/config.ts +0 -128
  65. package/apps/agents-server/next.config.ts +0 -45
  66. package/apps/agents-server/package.json +0 -16
  67. package/apps/agents-server/postcss.config.mjs +0 -8
  68. package/apps/agents-server/public/.gitkeep +0 -0
  69. package/apps/agents-server/public/favicon.ico +0 -0
  70. package/apps/agents-server/public/fonts/OpenMoji-black-glyf.woff2 +0 -0
  71. package/apps/agents-server/public/fonts/OpenMoji-color-cbdt.woff2 +0 -0
  72. package/apps/agents-server/public/logo-blue-white-256.png +0 -0
  73. package/apps/agents-server/public/sw.js +0 -16
  74. package/apps/agents-server/public/swagger.json +0 -115
  75. package/apps/agents-server/scripts/generate-reserved-paths/generate-reserved-paths.ts +0 -54
  76. package/apps/agents-server/scripts/generate-reserved-paths/tsconfig.json +0 -19
  77. package/apps/agents-server/src/app/AddAgentButton.tsx +0 -41
  78. package/apps/agents-server/src/app/[agentName]/[...rest]/page.tsx +0 -11
  79. package/apps/agents-server/src/app/[agentName]/page.tsx +0 -1
  80. package/apps/agents-server/src/app/actions.ts +0 -65
  81. package/apps/agents-server/src/app/admin/api-tokens/ApiTokensClient.tsx +0 -186
  82. package/apps/agents-server/src/app/admin/api-tokens/page.tsx +0 -13
  83. package/apps/agents-server/src/app/admin/browser-test/BrowserTestClient.tsx +0 -85
  84. package/apps/agents-server/src/app/admin/browser-test/page.tsx +0 -13
  85. package/apps/agents-server/src/app/admin/chat-feedback/ChatFeedbackClient.tsx +0 -561
  86. package/apps/agents-server/src/app/admin/chat-feedback/page.tsx +0 -22
  87. package/apps/agents-server/src/app/admin/chat-history/ChatHistoryClient.tsx +0 -591
  88. package/apps/agents-server/src/app/admin/chat-history/page.tsx +0 -21
  89. package/apps/agents-server/src/app/admin/messages/MessagesClient.tsx +0 -294
  90. package/apps/agents-server/src/app/admin/messages/page.tsx +0 -13
  91. package/apps/agents-server/src/app/admin/messages/send-email/SendEmailClient.tsx +0 -104
  92. package/apps/agents-server/src/app/admin/messages/send-email/actions.ts +0 -35
  93. package/apps/agents-server/src/app/admin/messages/send-email/page.tsx +0 -13
  94. package/apps/agents-server/src/app/admin/metadata/MetadataClient.tsx +0 -481
  95. package/apps/agents-server/src/app/admin/metadata/page.tsx +0 -13
  96. package/apps/agents-server/src/app/admin/models/page.tsx +0 -22
  97. package/apps/agents-server/src/app/admin/users/[userId]/UserDetailClient.tsx +0 -131
  98. package/apps/agents-server/src/app/admin/users/[userId]/page.tsx +0 -21
  99. package/apps/agents-server/src/app/admin/users/page.tsx +0 -18
  100. package/apps/agents-server/src/app/agents/[agentName]/AgentChatWrapper.tsx +0 -92
  101. package/apps/agents-server/src/app/agents/[agentName]/AgentOptionsMenu.tsx +0 -356
  102. package/apps/agents-server/src/app/agents/[agentName]/AgentProfileChat.tsx +0 -134
  103. package/apps/agents-server/src/app/agents/[agentName]/AgentProfileWrapper.tsx +0 -90
  104. package/apps/agents-server/src/app/agents/[agentName]/AgentUrlCopy.tsx +0 -40
  105. package/apps/agents-server/src/app/agents/[agentName]/ClearAgentChatFeedbackButton.tsx +0 -63
  106. package/apps/agents-server/src/app/agents/[agentName]/ClearAgentChatHistoryButton.tsx +0 -63
  107. package/apps/agents-server/src/app/agents/[agentName]/CloneAgentButton.tsx +0 -41
  108. package/apps/agents-server/src/app/agents/[agentName]/CopyField.tsx +0 -44
  109. package/apps/agents-server/src/app/agents/[agentName]/InstallPwaButton.tsx +0 -74
  110. package/apps/agents-server/src/app/agents/[agentName]/ServiceWorkerRegister.tsx +0 -24
  111. package/apps/agents-server/src/app/agents/[agentName]/TODO.txt +0 -1
  112. package/apps/agents-server/src/app/agents/[agentName]/_utils.ts +0 -38
  113. package/apps/agents-server/src/app/agents/[agentName]/agentLinks.tsx +0 -80
  114. package/apps/agents-server/src/app/agents/[agentName]/api/agents/route.ts +0 -58
  115. package/apps/agents-server/src/app/agents/[agentName]/api/book/route.ts +0 -88
  116. package/apps/agents-server/src/app/agents/[agentName]/api/book/test.http +0 -37
  117. package/apps/agents-server/src/app/agents/[agentName]/api/chat/route.ts +0 -194
  118. package/apps/agents-server/src/app/agents/[agentName]/api/feedback/route.ts +0 -54
  119. package/apps/agents-server/src/app/agents/[agentName]/api/mcp/route.ts +0 -198
  120. package/apps/agents-server/src/app/agents/[agentName]/api/modelRequirements/TODO.txt +0 -1
  121. package/apps/agents-server/src/app/agents/[agentName]/api/modelRequirements/route.ts +0 -55
  122. package/apps/agents-server/src/app/agents/[agentName]/api/modelRequirements/systemMessage/route.ts +0 -47
  123. package/apps/agents-server/src/app/agents/[agentName]/api/openai/chat/completions/route.ts +0 -10
  124. package/apps/agents-server/src/app/agents/[agentName]/api/openai/models/route.ts +0 -93
  125. package/apps/agents-server/src/app/agents/[agentName]/api/openai/v1/chat/completions/route.ts +0 -10
  126. package/apps/agents-server/src/app/agents/[agentName]/api/openai/v1/models/route.ts +0 -93
  127. package/apps/agents-server/src/app/agents/[agentName]/api/openrouter/chat/completions/route.ts +0 -10
  128. package/apps/agents-server/src/app/agents/[agentName]/api/profile/route.ts +0 -80
  129. package/apps/agents-server/src/app/agents/[agentName]/api/voice/route.ts +0 -184
  130. package/apps/agents-server/src/app/agents/[agentName]/book/BookEditorWrapper.tsx +0 -143
  131. package/apps/agents-server/src/app/agents/[agentName]/book/page.tsx +0 -48
  132. package/apps/agents-server/src/app/agents/[agentName]/book+chat/AgentBookAndChat.tsx +0 -75
  133. package/apps/agents-server/src/app/agents/[agentName]/book+chat/AgentBookAndChatComponent.tsx.todo +0 -160
  134. package/apps/agents-server/src/app/agents/[agentName]/book+chat/page.tsx +0 -45
  135. package/apps/agents-server/src/app/agents/[agentName]/book+chat/page.tsx.todo +0 -21
  136. package/apps/agents-server/src/app/agents/[agentName]/chat/AgentChatWrapper.tsx +0 -68
  137. package/apps/agents-server/src/app/agents/[agentName]/chat/page.tsx +0 -45
  138. package/apps/agents-server/src/app/agents/[agentName]/code/api/route.ts +0 -68
  139. package/apps/agents-server/src/app/agents/[agentName]/code/page.tsx +0 -223
  140. package/apps/agents-server/src/app/agents/[agentName]/generateAgentMetadata.ts +0 -51
  141. package/apps/agents-server/src/app/agents/[agentName]/history/RestoreVersionButton.tsx +0 -46
  142. package/apps/agents-server/src/app/agents/[agentName]/history/actions.ts +0 -12
  143. package/apps/agents-server/src/app/agents/[agentName]/history/page.tsx +0 -62
  144. package/apps/agents-server/src/app/agents/[agentName]/images/default-avatar.png/getAgentDefaultAvatarPrompt.ts +0 -31
  145. package/apps/agents-server/src/app/agents/[agentName]/images/default-avatar.png/route.ts +0 -157
  146. package/apps/agents-server/src/app/agents/[agentName]/images/icon-256.png/route.tsx +0 -92
  147. package/apps/agents-server/src/app/agents/[agentName]/images/page.tsx +0 -200
  148. package/apps/agents-server/src/app/agents/[agentName]/images/screenshot-fullhd.png/route.tsx +0 -93
  149. package/apps/agents-server/src/app/agents/[agentName]/images/screenshot-phone.png/route.tsx +0 -93
  150. package/apps/agents-server/src/app/agents/[agentName]/integration/SdkCodeTabs.tsx +0 -31
  151. package/apps/agents-server/src/app/agents/[agentName]/integration/WebsiteIntegrationTabs.tsx +0 -26
  152. package/apps/agents-server/src/app/agents/[agentName]/integration/page.tsx +0 -326
  153. package/apps/agents-server/src/app/agents/[agentName]/layout.tsx +0 -41
  154. package/apps/agents-server/src/app/agents/[agentName]/links/page.tsx +0 -189
  155. package/apps/agents-server/src/app/agents/[agentName]/opengraph-image.tsx +0 -111
  156. package/apps/agents-server/src/app/agents/[agentName]/page.tsx +0 -114
  157. package/apps/agents-server/src/app/agents/[agentName]/system-message/page.tsx +0 -100
  158. package/apps/agents-server/src/app/agents/[agentName]/website-integration/page.tsx +0 -89
  159. package/apps/agents-server/src/app/agents/page.tsx +0 -11
  160. package/apps/agents-server/src/app/api/admin-email/route.ts +0 -12
  161. package/apps/agents-server/src/app/api/agents/[agentName]/clone/route.ts +0 -45
  162. package/apps/agents-server/src/app/api/agents/[agentName]/restore/route.ts +0 -19
  163. package/apps/agents-server/src/app/api/agents/[agentName]/route.ts +0 -60
  164. package/apps/agents-server/src/app/api/agents/route.ts +0 -68
  165. package/apps/agents-server/src/app/api/api-tokens/route.ts +0 -75
  166. package/apps/agents-server/src/app/api/auth/change-password/route.ts +0 -75
  167. package/apps/agents-server/src/app/api/auth/login/route.ts +0 -27
  168. package/apps/agents-server/src/app/api/auth/logout/route.ts +0 -7
  169. package/apps/agents-server/src/app/api/browser-test/screenshot/route.ts +0 -30
  170. package/apps/agents-server/src/app/api/chat/route.ts +0 -32
  171. package/apps/agents-server/src/app/api/chat-feedback/[id]/route.ts +0 -38
  172. package/apps/agents-server/src/app/api/chat-feedback/export/route.ts +0 -55
  173. package/apps/agents-server/src/app/api/chat-feedback/route.ts +0 -157
  174. package/apps/agents-server/src/app/api/chat-history/[id]/route.ts +0 -37
  175. package/apps/agents-server/src/app/api/chat-history/export/route.ts +0 -55
  176. package/apps/agents-server/src/app/api/chat-history/route.ts +0 -147
  177. package/apps/agents-server/src/app/api/chat-streaming/route.ts +0 -48
  178. package/apps/agents-server/src/app/api/docs/book.md/route.ts +0 -61
  179. package/apps/agents-server/src/app/api/emails/incoming/sendgrid/route.ts +0 -48
  180. package/apps/agents-server/src/app/api/embed.js/route.ts +0 -113
  181. package/apps/agents-server/src/app/api/federated-agents/route.ts +0 -29
  182. package/apps/agents-server/src/app/api/images/[filename]/route.ts +0 -107
  183. package/apps/agents-server/src/app/api/long-running-task/route.ts +0 -7
  184. package/apps/agents-server/src/app/api/long-streaming/route.ts +0 -20
  185. package/apps/agents-server/src/app/api/messages/route.ts +0 -102
  186. package/apps/agents-server/src/app/api/metadata/route.ts +0 -115
  187. package/apps/agents-server/src/app/api/openai/v1/chat/completions/route.ts +0 -6
  188. package/apps/agents-server/src/app/api/openai/v1/models/route.ts +0 -65
  189. package/apps/agents-server/src/app/api/upload/route.ts +0 -166
  190. package/apps/agents-server/src/app/api/users/[username]/route.ts +0 -75
  191. package/apps/agents-server/src/app/api/users/route.ts +0 -71
  192. package/apps/agents-server/src/app/docs/[docId]/page.tsx +0 -42
  193. package/apps/agents-server/src/app/docs/page.tsx +0 -59
  194. package/apps/agents-server/src/app/embed/layout.tsx +0 -31
  195. package/apps/agents-server/src/app/embed/page.tsx +0 -37
  196. package/apps/agents-server/src/app/globals.css +0 -383
  197. package/apps/agents-server/src/app/humans.txt/route.ts +0 -15
  198. package/apps/agents-server/src/app/layout.tsx +0 -144
  199. package/apps/agents-server/src/app/manifest.ts +0 -114
  200. package/apps/agents-server/src/app/not-found.tsx +0 -5
  201. package/apps/agents-server/src/app/page.tsx +0 -144
  202. package/apps/agents-server/src/app/recycle-bin/RestoreAgentButton.tsx +0 -40
  203. package/apps/agents-server/src/app/recycle-bin/actions.ts +0 -33
  204. package/apps/agents-server/src/app/recycle-bin/page.tsx +0 -44
  205. package/apps/agents-server/src/app/restricted/page.tsx +0 -33
  206. package/apps/agents-server/src/app/robots.txt/route.ts +0 -15
  207. package/apps/agents-server/src/app/security.txt/route.ts +0 -15
  208. package/apps/agents-server/src/app/sitemap.xml/route.ts +0 -39
  209. package/apps/agents-server/src/app/swagger/page.tsx +0 -14
  210. package/apps/agents-server/src/app/test/og-image/README.md +0 -1
  211. package/apps/agents-server/src/app/test/og-image/opengraph-image.tsx +0 -37
  212. package/apps/agents-server/src/app/test/og-image/page.tsx +0 -22
  213. package/apps/agents-server/src/components/AgentProfile/AgentProfile.tsx +0 -267
  214. package/apps/agents-server/src/components/AgentProfile/AgentProfileFromSource.tsx +0 -23
  215. package/apps/agents-server/src/components/AgentProfile/AgentQrCode.tsx +0 -62
  216. package/apps/agents-server/src/components/AgentProfile/QrCodeModal.tsx +0 -89
  217. package/apps/agents-server/src/components/AgentProfile/useAgentBackground.ts +0 -97
  218. package/apps/agents-server/src/components/Auth/AuthControls.tsx +0 -124
  219. package/apps/agents-server/src/components/ChangePasswordDialog/ChangePasswordDialog.tsx +0 -41
  220. package/apps/agents-server/src/components/ChangePasswordForm/ChangePasswordForm.tsx +0 -159
  221. package/apps/agents-server/src/components/DeletedAgentBanner.tsx +0 -26
  222. package/apps/agents-server/src/components/DocsToolbar/DocsToolbar.tsx +0 -38
  223. package/apps/agents-server/src/components/DocumentationContent/DocumentationContent.tsx +0 -90
  224. package/apps/agents-server/src/components/ErrorPage/ErrorPage.tsx +0 -33
  225. package/apps/agents-server/src/components/Footer/Footer.tsx +0 -175
  226. package/apps/agents-server/src/components/ForbiddenPage/ForbiddenPage.tsx +0 -15
  227. package/apps/agents-server/src/components/ForgottenPasswordDialog/ForgottenPasswordDialog.tsx +0 -61
  228. package/apps/agents-server/src/components/Header/Header.tsx +0 -742
  229. package/apps/agents-server/src/components/Homepage/AgentCard.tsx +0 -182
  230. package/apps/agents-server/src/components/Homepage/AgentsList.tsx +0 -136
  231. package/apps/agents-server/src/components/Homepage/Card.tsx +0 -18
  232. package/apps/agents-server/src/components/Homepage/DeletedAgentsList.tsx +0 -66
  233. package/apps/agents-server/src/components/Homepage/ExternalAgentsSection.tsx +0 -30
  234. package/apps/agents-server/src/components/Homepage/ExternalAgentsSectionClient.tsx +0 -192
  235. package/apps/agents-server/src/components/Homepage/ModelCard.tsx +0 -29
  236. package/apps/agents-server/src/components/Homepage/ModelsSection.tsx +0 -75
  237. package/apps/agents-server/src/components/Homepage/Section.tsx +0 -17
  238. package/apps/agents-server/src/components/Homepage/TechInfoCard.tsx +0 -20
  239. package/apps/agents-server/src/components/LayoutWrapper/LayoutWrapper.tsx +0 -58
  240. package/apps/agents-server/src/components/LoginDialog/LoginDialog.tsx +0 -41
  241. package/apps/agents-server/src/components/LoginForm/LoginForm.tsx +0 -158
  242. package/apps/agents-server/src/components/NotFoundPage/NotFoundPage.tsx +0 -22
  243. package/apps/agents-server/src/components/OpenMojiIcon/OpenMojiIcon.tsx +0 -29
  244. package/apps/agents-server/src/components/Portal/Portal.tsx +0 -38
  245. package/apps/agents-server/src/components/PrintHeader/PrintHeader.tsx +0 -18
  246. package/apps/agents-server/src/components/RegisterUserDialog/RegisterUserDialog.tsx +0 -61
  247. package/apps/agents-server/src/components/UsersList/UsersList.tsx +0 -141
  248. package/apps/agents-server/src/components/UsersList/useUsersAdmin.ts +0 -139
  249. package/apps/agents-server/src/components/VercelDeploymentCard/VercelDeploymentCard.tsx +0 -57
  250. package/apps/agents-server/src/components/_utils/generateMetaTxt.ts +0 -30
  251. package/apps/agents-server/src/components/_utils/headlessParam.tsx +0 -40
  252. package/apps/agents-server/src/database/$getTableName.ts +0 -18
  253. package/apps/agents-server/src/database/$provideSupabase.ts +0 -29
  254. package/apps/agents-server/src/database/$provideSupabaseForBrowser.ts +0 -41
  255. package/apps/agents-server/src/database/$provideSupabaseForServer.ts +0 -48
  256. package/apps/agents-server/src/database/$provideSupabaseForWorker.ts +0 -43
  257. package/apps/agents-server/src/database/getMetadata.ts +0 -31
  258. package/apps/agents-server/src/database/metadataDefaults.ts +0 -93
  259. package/apps/agents-server/src/database/migrate.ts +0 -164
  260. package/apps/agents-server/src/database/migrations/2025-11-0001-initial-schema.sql +0 -161
  261. package/apps/agents-server/src/database/migrations/2025-11-0002-metadata-table.sql +0 -14
  262. package/apps/agents-server/src/database/migrations/2025-12-0010-llm-cache.sql +0 -12
  263. package/apps/agents-server/src/database/migrations/2025-12-0060-api-tokens.sql +0 -13
  264. package/apps/agents-server/src/database/migrations/2025-12-0070-chat-history-source.sql +0 -2
  265. package/apps/agents-server/src/database/migrations/2025-12-0240-agent-public-id.sql +0 -3
  266. package/apps/agents-server/src/database/migrations/2025-12-0360-agent-deleted-at.sql +0 -1
  267. package/apps/agents-server/src/database/migrations/2025-12-0370-image-table.sql +0 -19
  268. package/apps/agents-server/src/database/migrations/2025-12-0380-agent-visibility.sql +0 -1
  269. package/apps/agents-server/src/database/migrations/2025-12-0390-upload-tracking.sql +0 -20
  270. package/apps/agents-server/src/database/migrations/2025-12-0401-file-upload-status.sql +0 -13
  271. package/apps/agents-server/src/database/migrations/2025-12-0402-message-table.sql +0 -42
  272. package/apps/agents-server/src/database/migrations/2025-12-0640-openai-assistant-cache.sql +0 -12
  273. package/apps/agents-server/src/database/schema.ts +0 -508
  274. package/apps/agents-server/src/deamons/longRunningTask.ts +0 -37
  275. package/apps/agents-server/src/generated/reservedPaths.ts +0 -32
  276. package/apps/agents-server/src/message-providers/email/_common/Email.ts +0 -73
  277. package/apps/agents-server/src/message-providers/email/_common/utils/TODO.txt +0 -1
  278. package/apps/agents-server/src/message-providers/email/_common/utils/parseEmailAddress.test.ts.todo +0 -108
  279. package/apps/agents-server/src/message-providers/email/_common/utils/parseEmailAddress.ts +0 -62
  280. package/apps/agents-server/src/message-providers/email/_common/utils/parseEmailAddresses.test.ts.todo +0 -117
  281. package/apps/agents-server/src/message-providers/email/_common/utils/parseEmailAddresses.ts +0 -19
  282. package/apps/agents-server/src/message-providers/email/_common/utils/stringifyEmailAddress.test.ts.todo +0 -119
  283. package/apps/agents-server/src/message-providers/email/_common/utils/stringifyEmailAddress.ts +0 -19
  284. package/apps/agents-server/src/message-providers/email/_common/utils/stringifyEmailAddresses.test.ts.todo +0 -74
  285. package/apps/agents-server/src/message-providers/email/_common/utils/stringifyEmailAddresses.ts +0 -14
  286. package/apps/agents-server/src/message-providers/email/sendgrid/SendgridMessageProvider.ts +0 -44
  287. package/apps/agents-server/src/message-providers/email/sendgrid/parseInboundSendgridEmail.ts +0 -49
  288. package/apps/agents-server/src/message-providers/email/zeptomail/ZeptomailMessageProvider.ts +0 -51
  289. package/apps/agents-server/src/message-providers/index.ts +0 -13
  290. package/apps/agents-server/src/message-providers/interfaces/MessageProvider.ts +0 -11
  291. package/apps/agents-server/src/middleware.ts +0 -301
  292. package/apps/agents-server/src/tools/$provideAgentCollectionForServer.ts +0 -54
  293. package/apps/agents-server/src/tools/$provideBrowserForServer.ts +0 -29
  294. package/apps/agents-server/src/tools/$provideCdnForServer.ts +0 -41
  295. package/apps/agents-server/src/tools/$provideExecutionToolsForServer.ts +0 -117
  296. package/apps/agents-server/src/tools/$provideOpenAiAssistantExecutionToolsForServer.ts +0 -35
  297. package/apps/agents-server/src/tools/$provideServer.ts +0 -39
  298. package/apps/agents-server/src/utils/auth.ts +0 -133
  299. package/apps/agents-server/src/utils/authenticateUser.ts +0 -42
  300. package/apps/agents-server/src/utils/cache/SupabaseCacheStorage.ts +0 -55
  301. package/apps/agents-server/src/utils/cdn/classes/DigitalOceanSpaces.ts +0 -119
  302. package/apps/agents-server/src/utils/cdn/classes/TrackedFilesStorage.ts +0 -57
  303. package/apps/agents-server/src/utils/cdn/classes/VercelBlobStorage.ts +0 -68
  304. package/apps/agents-server/src/utils/cdn/interfaces/IFilesStorage.ts +0 -50
  305. package/apps/agents-server/src/utils/cdn/interfaces/IStorage.ts +0 -14
  306. package/apps/agents-server/src/utils/cdn/utils/getUserFileCdnKey.ts +0 -28
  307. package/apps/agents-server/src/utils/cdn/utils/nameToSubfolderPath.ts +0 -9
  308. package/apps/agents-server/src/utils/cdn/utils/nextRequestToNodeRequest.ts +0 -27
  309. package/apps/agents-server/src/utils/chatFeedbackAdmin.ts +0 -96
  310. package/apps/agents-server/src/utils/chatHistoryAdmin.ts +0 -96
  311. package/apps/agents-server/src/utils/content/extractBodyContentFromHtml.ts +0 -19
  312. package/apps/agents-server/src/utils/convertToCsv.ts +0 -31
  313. package/apps/agents-server/src/utils/getCurrentUser.ts +0 -32
  314. package/apps/agents-server/src/utils/getEffectiveFederatedServers.ts +0 -22
  315. package/apps/agents-server/src/utils/getFederatedAgents.ts +0 -89
  316. package/apps/agents-server/src/utils/getFederatedServersFromMetadata.ts +0 -10
  317. package/apps/agents-server/src/utils/getUserIdFromRequest.ts +0 -35
  318. package/apps/agents-server/src/utils/getVisibleCommitmentDefinitions.ts +0 -12
  319. package/apps/agents-server/src/utils/handleChatCompletion.ts +0 -415
  320. package/apps/agents-server/src/utils/isIpAllowed.ts +0 -101
  321. package/apps/agents-server/src/utils/isUserAdmin.ts +0 -31
  322. package/apps/agents-server/src/utils/messages/sendMessage.ts +0 -91
  323. package/apps/agents-server/src/utils/messagesAdmin.ts +0 -72
  324. package/apps/agents-server/src/utils/normalization/filenameToPrompt.test.ts +0 -36
  325. package/apps/agents-server/src/utils/normalization/filenameToPrompt.ts +0 -25
  326. package/apps/agents-server/src/utils/resolveInheritedAgentSource.ts +0 -100
  327. package/apps/agents-server/src/utils/session.ts +0 -50
  328. package/apps/agents-server/src/utils/validateApiKey.ts +0 -124
  329. package/apps/agents-server/src/utils/validators/validateMimeType.ts +0 -24
  330. package/apps/agents-server/tailwind.config.ts +0 -26
  331. package/apps/agents-server/tsconfig.json +0 -29
  332. package/apps/agents-server/vercel.json +0 -7
  333. package/esm/typings/servers.d.ts +0 -50
package/esm/index.es.js CHANGED
@@ -47,62 +47,12 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
47
47
  * @generated
48
48
  * @see https://github.com/webgptorg/promptbook
49
49
  */
50
- const PROMPTBOOK_ENGINE_VERSION = '0.104.0-8';
50
+ const PROMPTBOOK_ENGINE_VERSION = '0.104.0';
51
51
  /**
52
52
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
53
53
  * Note: [💞] Ignore a discrepancy between file name and entity name
54
54
  */
55
55
 
56
- /**
57
- * Core Promptbook server configuration.
58
- *
59
- * This server is also used for auto-federation in the Agents Server.
60
- *
61
- * @public exported from `@promptbook/core`
62
- */
63
- const CORE_SERVER = {
64
- title: 'Promptbook Core',
65
- description: `Core Promptbook server used for auto-federation`,
66
- owner: 'AI Web, LLC <legal@ptbk.io> (https://www.ptbk.io/)',
67
- urls: ['https://core.ptbk.io/'],
68
- };
69
- /**
70
- * Available remote servers for the Promptbook
71
- *
72
- * @public exported from `@promptbook/core`
73
- */
74
- const REMOTE_SERVER_URLS = [
75
- {
76
- title: 'Promptbook.Studio',
77
- description: `Server of Promptbook.studio`,
78
- owner: 'AI Web, LLC <legal@ptbk.io> (https://www.ptbk.io/)',
79
- urls: [
80
- 'https://promptbook.s5.ptbk.io/',
81
- // Note: Servers 1-4 are not running
82
- ],
83
- },
84
- {
85
- title: 'Testing Agents',
86
- description: `Testing Agents server on Vercel`,
87
- owner: 'AI Web, LLC <legal@ptbk.io> (https://www.ptbk.io/)',
88
- urls: ['https://s6.ptbk.io/'],
89
- },
90
- CORE_SERVER,
91
- /*
92
- Note: Working on older version of Promptbook and not supported anymore
93
- {
94
- title: 'Pavol Promptbook Server',
95
- description: `Personal server of Pavol Hejný with simple testing server, DO NOT USE IT FOR PRODUCTION`,
96
- owner: 'Pavol Hejný <pavol@ptbk.io> (https://www.pavolhejny.com/)',
97
- isAnonymousModeAllowed: true,
98
- urls: ['https://api.pavolhejny.com/promptbook'],
99
- },
100
- */
101
- ];
102
- /**
103
- * Note: [💞] Ignore a discrepancy between file name and entity name
104
- */
105
-
106
56
  /**
107
57
  * Trims string from all 4 sides
108
58
  *
@@ -1287,9 +1237,10 @@ const MOMENT_ARG_THRESHOLDS = {
1287
1237
  /**
1288
1238
  * Default remote server URL for the Promptbook
1289
1239
  *
1240
+ * @deprecated TODO: !!! Deprecate all things related to pipelines and pipelines server
1290
1241
  * @public exported from `@promptbook/core`
1291
1242
  */
1292
- const DEFAULT_REMOTE_SERVER_URL = REMOTE_SERVER_URLS[0].urls[0];
1243
+ const DEFAULT_REMOTE_SERVER_URL = `https://promptbook.s5.ptbk.io/`;
1293
1244
  // <- TODO: [🧜‍♂️]
1294
1245
  /**
1295
1246
  * Default settings for parsing and generating CSV files in Promptbook.
@@ -2735,9 +2686,10 @@ function isValidFilePath(filename) {
2735
2686
  *
2736
2687
  * Note: [🔂] This function is idempotent.
2737
2688
  * Note: Dataurl are considered perfectly valid.
2738
- * Note: There are two similar functions:
2739
- * - `isValidUrl` which tests any URL
2740
- * - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
2689
+ * Note: There are few similar functions:
2690
+ * - `isValidUrl` *(this one)* which tests any URL
2691
+ * - `isValidAgentUrl` which tests just agent URL
2692
+ * - `isValidPipelineUrl` which tests just pipeline URL
2741
2693
  *
2742
2694
  * @public exported from `@promptbook/utils`
2743
2695
  */
@@ -3015,8 +2967,8 @@ for (let i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
3015
2967
  */
3016
2968
  function removeDiacritics(input) {
3017
2969
  /*eslint no-control-regex: "off"*/
3018
- return input.replace(/[^\u0000-\u007E]/g, (a) => {
3019
- return DIACRITIC_VARIANTS_LETTERS[a] || a;
2970
+ return input.replace(/[^\u0000-\u007E]/g, (character) => {
2971
+ return DIACRITIC_VARIANTS_LETTERS[character] || character;
3020
2972
  });
3021
2973
  }
3022
2974
  /**
@@ -3943,7 +3895,7 @@ async function forEachAsync(array, options, callbackfunction) {
3943
3895
  tasks.push(task);
3944
3896
  runningTasks.push(task);
3945
3897
  /* not await */ Promise.resolve(task).then(() => {
3946
- runningTasks = runningTasks.filter((t) => t !== task);
3898
+ runningTasks = runningTasks.filter((runningTask) => runningTask !== task);
3947
3899
  });
3948
3900
  if (maxParallelCount < runningTasks.length) {
3949
3901
  await Promise.race(runningTasks);
@@ -4761,11 +4713,45 @@ function isValidPromptbookVersion(version) {
4761
4713
  return true;
4762
4714
  }
4763
4715
 
4716
+ /**
4717
+ * Tests if given string is valid agent URL
4718
+ *
4719
+ * Note: There are few similar functions:
4720
+ * - `isValidUrl` which tests any URL
4721
+ * - `isValidAgentUrl` *(this one)* which tests just agent URL
4722
+ * - `isValidPipelineUrl` which tests just pipeline URL
4723
+ *
4724
+ * @public exported from `@promptbook/utils`
4725
+ */
4726
+ function isValidAgentUrl(url) {
4727
+ if (!isValidUrl(url)) {
4728
+ return false;
4729
+ }
4730
+ if (!url.startsWith('https://') && !url.startsWith('http://') /* <- Note: [👣] */) {
4731
+ return false;
4732
+ }
4733
+ if (url.includes('#')) {
4734
+ // TODO: [🐠]
4735
+ return false;
4736
+ }
4737
+ /*
4738
+ Note: [👣][🧠] Is it secure to allow pipeline URLs on private and unsecured networks?
4739
+ if (isUrlOnPrivateNetwork(url)) {
4740
+ return false;
4741
+ }
4742
+ */
4743
+ return true;
4744
+ }
4745
+ /**
4746
+ * TODO: [🐠] Maybe more info why the URL is invalid
4747
+ */
4748
+
4764
4749
  /**
4765
4750
  * Tests if given string is valid pipeline URL URL.
4766
4751
  *
4767
- * Note: There are two similar functions:
4752
+ * Note: There are few similar functions:
4768
4753
  * - `isValidUrl` which tests any URL
4754
+ * - `isValidAgentUrl` which tests just agent URL
4769
4755
  * - `isValidPipelineUrl` *(this one)* which tests just pipeline URL
4770
4756
  *
4771
4757
  * @public exported from `@promptbook/utils`
@@ -5332,10 +5318,14 @@ function addUsage(...usageItems) {
5332
5318
  }
5333
5319
 
5334
5320
  /**
5335
- * Intercepts LLM tools and counts total usage of the tools
5321
+ * Intercepts LLM tools and counts total usage of the tools.
5336
5322
  *
5337
- * @param llmTools LLM tools to be intercepted with usage counting
5338
- * @returns LLM tools with same functionality with added total cost counting
5323
+ * This function wraps the provided `LlmExecutionTools` with a proxy that tracks the cumulative
5324
+ * usage (tokens, cost, etc.) across all model calls. It provides a way to monitor spending
5325
+ * in real-time through an observable.
5326
+ *
5327
+ * @param llmTools - The LLM tools to be intercepted and tracked
5328
+ * @returns An augmented version of the tools that includes usage tracking capabilities
5339
5329
  * @public exported from `@promptbook/core`
5340
5330
  */
5341
5331
  function countUsage(llmTools) {
@@ -5410,7 +5400,7 @@ function countUsage(llmTools) {
5410
5400
  * TODO: [🧠] Is there some meaningfull way how to test this util
5411
5401
  * TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
5412
5402
  * > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
5413
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
5403
+ * TODO: [👷‍♂️] Write a comprehensive manual explaining the construction and usage of LLM tools in the Promptbook ecosystem
5414
5404
  */
5415
5405
 
5416
5406
  /**
@@ -5613,17 +5603,21 @@ class MultipleLlmExecutionTools {
5613
5603
  */
5614
5604
 
5615
5605
  /**
5616
- * Joins multiple LLM Execution Tools into one
5606
+ * Joins multiple LLM Execution Tools into one.
5617
5607
  *
5618
- * @returns {LlmExecutionTools} Single wrapper for multiple LlmExecutionTools
5608
+ * This function takes a list of `LlmExecutionTools` and returns a single unified
5609
+ * `MultipleLlmExecutionTools` object. It provides failover and aggregation logic:
5619
5610
  *
5620
- * 0) If there is no LlmExecutionTools, it warns and returns valid but empty LlmExecutionTools
5621
- * 1) If there is only one LlmExecutionTools, it returns it wrapped in a proxy object
5622
- * 2) If there are multiple LlmExecutionTools, first will be used first, second will be used if the first hasn`t defined model variant or fails, etc.
5623
- * 3) When all LlmExecutionTools fail, it throws an error with a list of all errors merged into one
5611
+ * 1. **Failover**: When a model call is made, it tries providers in the order they were provided.
5612
+ * If the first provider doesn't support the requested model or fails, it tries the next one.
5613
+ * 2. **Aggregation**: `listModels` returns a combined list of all models available from all providers.
5614
+ * 3. **Empty case**: If no tools are provided, it logs a warning (as Promptbook requires LLMs to function).
5624
5615
  *
5616
+ * @param title - A descriptive title for this collection of joined tools
5617
+ * @param llmExecutionTools - An array of execution tools to be joined
5618
+ * @returns A single unified execution tool wrapper
5625
5619
  *
5626
- * Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools`
5620
+ * Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools`.
5627
5621
  *
5628
5622
  * @public exported from `@promptbook/core`
5629
5623
  */
@@ -5663,7 +5657,7 @@ function joinLlmExecutionTools(title, ...llmExecutionTools) {
5663
5657
  }
5664
5658
  /**
5665
5659
  * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
5666
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
5660
+ * TODO: [👷‍♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
5667
5661
  */
5668
5662
 
5669
5663
  /**
@@ -5848,7 +5842,7 @@ async function $provideLlmToolsForWizardOrCli(options) {
5848
5842
  }
5849
5843
  /**
5850
5844
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
5851
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
5845
+ * TODO: [👷‍♂️] Write a comprehensive manual about the construction of LLM tools
5852
5846
  * TODO: [🥃] Allow `ptbk make` without llm tools
5853
5847
  * TODO: This should be maybe not under `_common` but under `utils-internal` / `utils/internal`
5854
5848
  * TODO: [®] DRY Register logic
@@ -8005,7 +7999,7 @@ function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools) {
8005
7999
  }
8006
8000
  /**
8007
8001
  * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
8008
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
8002
+ * TODO: [👷‍♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
8009
8003
  */
8010
8004
 
8011
8005
  /**
@@ -8564,7 +8558,7 @@ async function getKnowledgeForTask(options) {
8564
8558
  const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
8565
8559
  const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
8566
8560
  const { index } = knowledgePiece;
8567
- const knowledgePieceIndex = index.find((i) => i.modelName === firstKnowledgeIndex.modelName);
8561
+ const knowledgePieceIndex = index.find((knowledgePieceIndex) => knowledgePieceIndex.modelName === firstKnowledgeIndex.modelName);
8568
8562
  // <- TODO: Do not use just first knowledge piece and first index to determine embedding model
8569
8563
  if (knowledgePieceIndex === undefined) {
8570
8564
  return {
@@ -9012,7 +9006,7 @@ async function executePipeline(options) {
9012
9006
  resovedParameterNames = [...resovedParameterNames, currentTask.resultingParameterName];
9013
9007
  })
9014
9008
  .then(() => {
9015
- resolving = resolving.filter((w) => w !== work);
9009
+ resolving = resolving.filter((workItem) => workItem !== work);
9016
9010
  });
9017
9011
  // <- Note: Errors are catched here [3]
9018
9012
  // TODO: BUT if in multiple tasks are errors, only the first one is catched so maybe we should catch errors here and save them to errors array here
@@ -9178,7 +9172,7 @@ function createPipelineExecutor(options) {
9178
9172
  // Calculate and update tldr based on pipeline progress
9179
9173
  const cv = newOngoingResult;
9180
9174
  // Calculate progress based on parameters resolved vs total parameters
9181
- const totalParameters = pipeline.parameters.filter((p) => !p.isInput).length;
9175
+ const totalParameters = pipeline.parameters.filter((parameter) => !parameter.isInput).length;
9182
9176
  let resolvedParameters = 0;
9183
9177
  let currentTaskTitle = '';
9184
9178
  // Get the resolved parameters from output parameters
@@ -9365,7 +9359,6 @@ function mimeTypeToExtension(value) {
9365
9359
  * @public exported from `@promptbook/core`
9366
9360
  */
9367
9361
  async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
9368
- // console.log('!! makeKnowledgeSourceHandler', knowledgeSource);
9369
9362
  var _a;
9370
9363
  const { fetch = promptbookFetch } = tools;
9371
9364
  const { knowledgeSourceContent } = knowledgeSource;
@@ -11273,7 +11266,12 @@ const jokerCommandParser = {
11273
11266
  * @see {@link ModelVariant}
11274
11267
  * @public exported from `@promptbook/core`
11275
11268
  */
11276
- const MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'IMAGE_GENERATION', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
11269
+ const MODEL_VARIANTS = [
11270
+ 'COMPLETION',
11271
+ 'CHAT',
11272
+ 'IMAGE_GENERATION',
11273
+ 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */,
11274
+ ];
11277
11275
 
11278
11276
  /**
11279
11277
  * Parses the model command
@@ -19302,6 +19300,22 @@ resultContent, rawResponse) {
19302
19300
  * TODO: [🤝] DRY Maybe some common abstraction between `computeOpenAiUsage` and `computeAnthropicClaudeUsage`
19303
19301
  */
19304
19302
 
19303
+ /**
19304
+ * Maps Promptbook tools to OpenAI tools.
19305
+ *
19306
+ * @private
19307
+ */
19308
+ function mapToolsToOpenAi(tools) {
19309
+ return tools.map((tool) => ({
19310
+ type: 'function',
19311
+ function: {
19312
+ name: tool.name,
19313
+ description: tool.description,
19314
+ parameters: tool.parameters,
19315
+ },
19316
+ }));
19317
+ }
19318
+
19305
19319
  /**
19306
19320
  * Parses an OpenAI error message to identify which parameter is unsupported
19307
19321
  *
@@ -19499,6 +19513,9 @@ class OpenAiCompatibleExecutionTools {
19499
19513
  },
19500
19514
  ],
19501
19515
  user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
19516
+ tools: currentModelRequirements.tools === undefined
19517
+ ? undefined
19518
+ : mapToolsToOpenAi(currentModelRequirements.tools),
19502
19519
  };
19503
19520
  const start = $getCurrentDate();
19504
19521
  if (this.options.isVerbose) {
@@ -19643,6 +19660,7 @@ class OpenAiCompatibleExecutionTools {
19643
19660
  const rawPromptContent = templateParameters(content, { ...parameters, modelName });
19644
19661
  const rawRequest = {
19645
19662
  ...modelSettings,
19663
+ model: modelName,
19646
19664
  prompt: rawPromptContent,
19647
19665
  user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
19648
19666
  };
@@ -19897,8 +19915,8 @@ class OpenAiCompatibleExecutionTools {
19897
19915
  const rawPromptContent = templateParameters(content, { ...parameters, modelName });
19898
19916
  const rawRequest = {
19899
19917
  ...modelSettings,
19900
- size: modelSettings.size || '1024x1024',
19901
19918
  prompt: rawPromptContent,
19919
+ size: modelSettings.size || '1024x1024',
19902
19920
  user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
19903
19921
  response_format: 'url', // TODO: [🧠] Maybe allow b64_json
19904
19922
  };
@@ -20796,6 +20814,7 @@ class OpenAiAssistantExecutionTools extends OpenAiExecutionTools {
20796
20814
  thread: {
20797
20815
  messages: threadMessages,
20798
20816
  },
20817
+ tools: modelRequirements.tools === undefined ? undefined : mapToolsToOpenAi(modelRequirements.tools),
20799
20818
  // <- TODO: Add user identification here> user: this.options.user,
20800
20819
  };
20801
20820
  const start = $getCurrentDate();
@@ -20887,12 +20906,10 @@ class OpenAiAssistantExecutionTools extends OpenAiExecutionTools {
20887
20906
 
20888
20907
  // List all assistants
20889
20908
  const assistants = await client.beta.assistants.list();
20890
- console.log('!!! Assistants:', assistants);
20891
-
20909
+
20892
20910
  // Get details of a specific assistant
20893
20911
  const assistantId = 'asst_MO8fhZf4dGloCfXSHeLcIik0';
20894
20912
  const assistant = await client.beta.assistants.retrieve(assistantId);
20895
- console.log('!!! Assistant Details:', assistant);
20896
20913
 
20897
20914
  // Update an assistant
20898
20915
  const updatedAssistant = await client.beta.assistants.update(assistantId, {
@@ -20902,8 +20919,7 @@ class OpenAiAssistantExecutionTools extends OpenAiExecutionTools {
20902
20919
  [Math.random().toString(36).substring(2, 15)]: new Date().toISOString(),
20903
20920
  },
20904
20921
  });
20905
- console.log('!!! Updated Assistant:', updatedAssistant);
20906
-
20922
+
20907
20923
  await forEver();
20908
20924
  }
20909
20925
  */
@@ -22209,7 +22225,6 @@ class MarkitdownScraper {
22209
22225
  // Note: Running Markitdown conversion ONLY if the file in the cache does not exist
22210
22226
  if (!(await isFileExisting(cacheFilehandler.filename, this.tools.fs))) {
22211
22227
  const src = source.filename || source.url || null;
22212
- // console.log('!!', { src, source, cacheFilehandler });
22213
22228
  if (src === null) {
22214
22229
  throw new UnexpectedError('Source has no filename or url');
22215
22230
  }
@@ -22222,7 +22237,6 @@ class MarkitdownScraper {
22222
22237
  throw new Error(`Markitdown could not convert the "${source.source}"`);
22223
22238
  // <- TODO: [🍀] Make MarkitdownError
22224
22239
  }
22225
- // console.log('!!', { result, cacheFilehandler });
22226
22240
  // Note: Try to cache the converted content, but don't fail if the filesystem is read-only
22227
22241
  try {
22228
22242
  await this.tools.fs.writeFile(cacheFilehandler.filename, result.text_content);
@@ -22684,8 +22698,8 @@ const _FormattedBookInMarkdownTranspilerRegistration = $bookTranspilersRegister.
22684
22698
  */
22685
22699
  function createCommitmentRegex(commitment, aliases = [], requiresContent = true) {
22686
22700
  const allCommitments = [commitment, ...aliases];
22687
- const patterns = allCommitments.map((c) => {
22688
- const escapedCommitment = c.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
22701
+ const patterns = allCommitments.map((commitment) => {
22702
+ const escapedCommitment = commitment.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
22689
22703
  return escapedCommitment.split(/\s+/).join('\\s+');
22690
22704
  });
22691
22705
  const keywordPattern = patterns.join('|');
@@ -22707,8 +22721,8 @@ function createCommitmentRegex(commitment, aliases = [], requiresContent = true)
22707
22721
  */
22708
22722
  function createCommitmentTypeRegex(commitment, aliases = []) {
22709
22723
  const allCommitments = [commitment, ...aliases];
22710
- const patterns = allCommitments.map((c) => {
22711
- const escapedCommitment = c.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
22724
+ const patterns = allCommitments.map((commitment) => {
22725
+ const escapedCommitment = commitment.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
22712
22726
  return escapedCommitment.split(/\s+/).join('\\s+');
22713
22727
  });
22714
22728
  const keywordPattern = patterns.join('|');
@@ -23218,9 +23232,7 @@ class DictionaryCommitmentDefinition extends BaseCommitmentDefinition {
23218
23232
  // Get existing dictionary entries from metadata
23219
23233
  const existingDictionary = ((_a = requirements.metadata) === null || _a === void 0 ? void 0 : _a.DICTIONARY) || '';
23220
23234
  // Merge the new dictionary entry with existing entries
23221
- const mergedDictionary = existingDictionary
23222
- ? `${existingDictionary}\n${trimmedContent}`
23223
- : trimmedContent;
23235
+ const mergedDictionary = existingDictionary ? `${existingDictionary}\n${trimmedContent}` : trimmedContent;
23224
23236
  // Store the merged dictionary in metadata for debugging and inspection
23225
23237
  const updatedMetadata = {
23226
23238
  ...requirements.metadata,
@@ -23371,21 +23383,35 @@ class FromCommitmentDefinition extends BaseCommitmentDefinition {
23371
23383
  applyToAgentModelRequirements(requirements, content) {
23372
23384
  const trimmedContent = content.trim();
23373
23385
  if (!trimmedContent) {
23374
- return requirements;
23386
+ return {
23387
+ ...requirements,
23388
+ parentAgentUrl: undefined,
23389
+ };
23375
23390
  }
23376
- // Validate URL
23377
- try {
23378
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
23379
- const url = new URL(trimmedContent);
23380
- // TODO: Add more validation if needed (e.g. check for valid protocol)
23391
+ if (trimmedContent.toUpperCase() === 'VOID' ||
23392
+ trimmedContent.toUpperCase() === 'NULL' ||
23393
+ trimmedContent.toUpperCase() === 'NONE' ||
23394
+ trimmedContent.toUpperCase() === 'NIL') {
23395
+ return {
23396
+ ...requirements,
23397
+ parentAgentUrl: null,
23398
+ };
23381
23399
  }
23382
- catch (error) {
23383
- console.warn(`Invalid URL in FROM commitment: ${trimmedContent}`);
23384
- return requirements;
23400
+ if (!isValidAgentUrl(trimmedContent)) {
23401
+ throw new Error(spaceTrim$1((block) => `
23402
+ Invalid agent URL in FROM commitment: "${trimmedContent}"
23403
+
23404
+ \`\`\`book
23405
+ ${block(content)}
23406
+ \`\`\`
23407
+
23408
+
23409
+ `));
23385
23410
  }
23411
+ const parentAgentUrl = trimmedContent;
23386
23412
  return {
23387
23413
  ...requirements,
23388
- parentAgentUrl: trimmedContent,
23414
+ parentAgentUrl,
23389
23415
  };
23390
23416
  }
23391
23417
  }
@@ -25749,19 +25775,38 @@ class UseBrowserCommitmentDefinition extends BaseCommitmentDefinition {
25749
25775
  `);
25750
25776
  }
25751
25777
  applyToAgentModelRequirements(requirements, content) {
25752
- // We simply mark that browser capability is enabled in metadata
25753
- // Get existing metadata
25754
- const existingMetadata = requirements.metadata || {};
25755
25778
  // Get existing tools array or create new one
25756
- const existingTools = existingMetadata.tools || [];
25757
- // Add 'browser' to tools if not already present
25758
- const updatedTools = existingTools.includes('browser') ? existingTools : [...existingTools, 'browser'];
25759
- // Return requirements with updated metadata
25779
+ const existingTools = requirements.tools || [];
25780
+ // Add 'web_browser' to tools if not already present
25781
+ const updatedTools = existingTools.some((tool) => tool.name === 'web_browser')
25782
+ ? existingTools
25783
+ : [
25784
+ // TODO: [🔰] Use through proper MCP server
25785
+ ...existingTools,
25786
+ {
25787
+ name: 'web_browser',
25788
+ description: spaceTrim$1(`
25789
+ A tool that can browse the web.
25790
+ Use this tool when you need to access specific websites or browse the internet.
25791
+ `),
25792
+ parameters: {
25793
+ type: 'object',
25794
+ properties: {
25795
+ url: {
25796
+ type: 'string',
25797
+ description: 'The URL to browse',
25798
+ },
25799
+ },
25800
+ required: ['url'],
25801
+ },
25802
+ },
25803
+ ];
25804
+ // Return requirements with updated tools and metadata
25760
25805
  return {
25761
25806
  ...requirements,
25807
+ tools: updatedTools,
25762
25808
  metadata: {
25763
- ...existingMetadata,
25764
- tools: updatedTools,
25809
+ ...requirements.metadata,
25765
25810
  useBrowser: true,
25766
25811
  },
25767
25812
  };
@@ -25854,13 +25899,13 @@ class UseMcpCommitmentDefinition extends BaseCommitmentDefinition {
25854
25899
  * The `USE SEARCH ENGINE` commitment indicates that the agent should utilize a search engine tool
25855
25900
  * to access and retrieve up-to-date information from the internet when necessary.
25856
25901
  *
25857
- * The content following `USE SEARCH ENGINE` is ignored (similar to NOTE).
25902
+ * The content following `USE SEARCH ENGINE` is an arbitrary text that the agent should know (e.g. search scope or instructions).
25858
25903
  *
25859
25904
  * Example usage in agent source:
25860
25905
  *
25861
25906
  * ```book
25862
25907
  * USE SEARCH ENGINE
25863
- * USE SEARCH ENGINE This will be ignored
25908
+ * USE SEARCH ENGINE Hledej informace o Přemyslovcích
25864
25909
  * ```
25865
25910
  *
25866
25911
  * @private [🪔] Maybe export the commitments through some package
@@ -25892,7 +25937,7 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
25892
25937
 
25893
25938
  ## Key aspects
25894
25939
 
25895
- - The content following \`USE SEARCH ENGINE\` is ignored (similar to NOTE)
25940
+ - The content following \`USE SEARCH ENGINE\` is an arbitrary text that the agent should know (e.g. search scope or instructions).
25896
25941
  - The actual search engine tool usage is handled by the agent runtime
25897
25942
  - Allows the agent to search for current information from the web
25898
25943
  - Useful for research tasks, finding facts, and accessing dynamic content
@@ -25917,20 +25962,45 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
25917
25962
  `);
25918
25963
  }
25919
25964
  applyToAgentModelRequirements(requirements, content) {
25920
- // We simply mark that search engine capability is enabled in metadata
25921
- // Get existing metadata
25922
- const existingMetadata = requirements.metadata || {};
25923
25965
  // Get existing tools array or create new one
25924
- const existingTools = existingMetadata.tools || [];
25925
- // Add 'search-engine' to tools if not already present
25926
- const updatedTools = existingTools.includes('search-engine') ? existingTools : [...existingTools, 'search-engine'];
25927
- // Return requirements with updated metadata
25966
+ const existingTools = requirements.tools || [];
25967
+ // Add 'web_search' to tools if not already present
25968
+ const updatedTools = existingTools.some((tool) => tool.name === 'web_search')
25969
+ ? existingTools
25970
+ : [
25971
+ ...existingTools,
25972
+ { type: 'web_search' },
25973
+ // <- Note: [🔰] This is just using simple native search tool by OpenAI @see https://platform.openai.com/docs/guides/tools-web-search
25974
+ // In future we will use proper MCP search tool:
25975
+ /*
25976
+
25977
+ {
25978
+ name: 'web_search',
25979
+ description: spaceTrim(`
25980
+ Search the internet for information.
25981
+ Use this tool when you need to find up-to-date information or facts that you don't know.
25982
+ ${!content ? '' : `Search scope / instructions: ${content}`}
25983
+ `),
25984
+ parameters: {
25985
+ type: 'object',
25986
+ properties: {
25987
+ query: {
25988
+ type: 'string',
25989
+ description: 'The search query',
25990
+ },
25991
+ },
25992
+ required: ['query'],
25993
+ },
25994
+ },
25995
+ */
25996
+ ];
25997
+ // Return requirements with updated tools and metadata
25928
25998
  return {
25929
25999
  ...requirements,
26000
+ tools: updatedTools,
25930
26001
  metadata: {
25931
- ...existingMetadata,
25932
- tools: updatedTools,
25933
- useSearchEngine: true,
26002
+ ...requirements.metadata,
26003
+ useSearchEngine: content || true,
25934
26004
  },
25935
26005
  };
25936
26006
  }
@@ -26335,8 +26405,8 @@ function parseParameters(text) {
26335
26405
  return match;
26336
26406
  });
26337
26407
  // Remove duplicates based on name (keep the first occurrence)
26338
- const uniqueParameters = parameters.filter((param, index, array) => {
26339
- return array.findIndex((p) => p.name === param.name) === index;
26408
+ const uniqueParameters = parameters.filter((parameter, index, array) => {
26409
+ return array.findIndex((parameterItem) => parameterItem.name === parameter.name) === index;
26340
26410
  });
26341
26411
  return uniqueParameters;
26342
26412
  }
@@ -26383,7 +26453,7 @@ async function createAgentModelRequirementsWithCommitments(agentSource, modelNam
26383
26453
  commitment.type === 'DISCARD' ||
26384
26454
  commitment.type === 'REMOVE') {
26385
26455
  const targets = parseParameters(commitment.content)
26386
- .map((p) => p.name.trim().toLowerCase())
26456
+ .map((parameter) => parameter.name.trim().toLowerCase())
26387
26457
  .filter(Boolean);
26388
26458
  if (targets.length === 0) {
26389
26459
  // Ignore DELETE with no targets; also don't pass the DELETE further
@@ -26392,8 +26462,8 @@ async function createAgentModelRequirementsWithCommitments(agentSource, modelNam
26392
26462
  // Drop prior kept commitments that contain any of the targeted tags
26393
26463
  for (let i = filteredCommitments.length - 1; i >= 0; i--) {
26394
26464
  const prev = filteredCommitments[i];
26395
- const prevParams = parseParameters(prev.content).map((p) => p.name.trim().toLowerCase());
26396
- const hasIntersection = prevParams.some((n) => targets.includes(n));
26465
+ const prevParams = parseParameters(prev.content).map((parameter) => parameter.name.trim().toLowerCase());
26466
+ const hasIntersection = prevParams.some((parameterName) => targets.includes(parameterName));
26397
26467
  if (hasIntersection) {
26398
26468
  filteredCommitments.splice(i, 1);
26399
26469
  }
@@ -26421,7 +26491,12 @@ async function createAgentModelRequirementsWithCommitments(agentSource, modelNam
26421
26491
  };
26422
26492
  }
26423
26493
  // Apply each commitment in order using reduce-like pattern
26424
- for (const commitment of filteredCommitments) {
26494
+ for (let i = 0; i < filteredCommitments.length; i++) {
26495
+ const commitment = filteredCommitments[i];
26496
+ // CLOSED commitment should work only if its the last commitment in the book
26497
+ if (commitment.type === 'CLOSED' && i !== filteredCommitments.length - 1) {
26498
+ continue;
26499
+ }
26425
26500
  const definition = getCommitmentDefinition(commitment.type);
26426
26501
  if (definition) {
26427
26502
  try {
@@ -26529,7 +26604,57 @@ function parseAgentSource(agentSource) {
26529
26604
  }
26530
26605
  const meta = {};
26531
26606
  const links = [];
26607
+ const capabilities = [];
26532
26608
  for (const commitment of parseResult.commitments) {
26609
+ if (commitment.type === 'USE BROWSER') {
26610
+ capabilities.push({
26611
+ type: 'browser',
26612
+ label: 'Browser',
26613
+ iconName: 'Globe',
26614
+ });
26615
+ continue;
26616
+ }
26617
+ if (commitment.type === 'USE SEARCH ENGINE') {
26618
+ capabilities.push({
26619
+ type: 'search-engine',
26620
+ label: 'Search Internet',
26621
+ iconName: 'Search',
26622
+ });
26623
+ continue;
26624
+ }
26625
+ if (commitment.type === 'KNOWLEDGE') {
26626
+ const content = spaceTrim$2(commitment.content).split('\n')[0] || '';
26627
+ let label = content;
26628
+ let iconName = 'Book';
26629
+ if (content.startsWith('http://') || content.startsWith('https://')) {
26630
+ try {
26631
+ const url = new URL(content);
26632
+ if (url.pathname.endsWith('.pdf')) {
26633
+ label = url.pathname.split('/').pop() || 'Document.pdf';
26634
+ iconName = 'FileText';
26635
+ }
26636
+ else {
26637
+ label = url.hostname.replace(/^www\./, '');
26638
+ }
26639
+ }
26640
+ catch (e) {
26641
+ // Invalid URL, treat as text
26642
+ }
26643
+ }
26644
+ else {
26645
+ // Text content - take first few words
26646
+ const words = content.split(/\s+/);
26647
+ if (words.length > 4) {
26648
+ label = words.slice(0, 4).join(' ') + '...';
26649
+ }
26650
+ }
26651
+ capabilities.push({
26652
+ type: 'knowledge',
26653
+ label,
26654
+ iconName,
26655
+ });
26656
+ continue;
26657
+ }
26533
26658
  if (commitment.type === 'META LINK') {
26534
26659
  const linkValue = spaceTrim$2(commitment.content);
26535
26660
  links.push(linkValue);
@@ -26540,6 +26665,10 @@ function parseAgentSource(agentSource) {
26540
26665
  meta.image = spaceTrim$2(commitment.content);
26541
26666
  continue;
26542
26667
  }
26668
+ if (commitment.type === 'META DESCRIPTION') {
26669
+ meta.description = spaceTrim$2(commitment.content);
26670
+ continue;
26671
+ }
26543
26672
  if (commitment.type === 'META COLOR') {
26544
26673
  meta.color = normalizeSeparator(commitment.content);
26545
26674
  continue;
@@ -26576,6 +26705,7 @@ function parseAgentSource(agentSource) {
26576
26705
  meta,
26577
26706
  links,
26578
26707
  parameters,
26708
+ capabilities,
26579
26709
  };
26580
26710
  }
26581
26711
  /**