@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/umd/index.umd.js CHANGED
@@ -56,62 +56,12 @@
56
56
  * @generated
57
57
  * @see https://github.com/webgptorg/promptbook
58
58
  */
59
- const PROMPTBOOK_ENGINE_VERSION = '0.104.0-8';
59
+ const PROMPTBOOK_ENGINE_VERSION = '0.104.0';
60
60
  /**
61
61
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
62
62
  * Note: [💞] Ignore a discrepancy between file name and entity name
63
63
  */
64
64
 
65
- /**
66
- * Core Promptbook server configuration.
67
- *
68
- * This server is also used for auto-federation in the Agents Server.
69
- *
70
- * @public exported from `@promptbook/core`
71
- */
72
- const CORE_SERVER = {
73
- title: 'Promptbook Core',
74
- description: `Core Promptbook server used for auto-federation`,
75
- owner: 'AI Web, LLC <legal@ptbk.io> (https://www.ptbk.io/)',
76
- urls: ['https://core.ptbk.io/'],
77
- };
78
- /**
79
- * Available remote servers for the Promptbook
80
- *
81
- * @public exported from `@promptbook/core`
82
- */
83
- const REMOTE_SERVER_URLS = [
84
- {
85
- title: 'Promptbook.Studio',
86
- description: `Server of Promptbook.studio`,
87
- owner: 'AI Web, LLC <legal@ptbk.io> (https://www.ptbk.io/)',
88
- urls: [
89
- 'https://promptbook.s5.ptbk.io/',
90
- // Note: Servers 1-4 are not running
91
- ],
92
- },
93
- {
94
- title: 'Testing Agents',
95
- description: `Testing Agents server on Vercel`,
96
- owner: 'AI Web, LLC <legal@ptbk.io> (https://www.ptbk.io/)',
97
- urls: ['https://s6.ptbk.io/'],
98
- },
99
- CORE_SERVER,
100
- /*
101
- Note: Working on older version of Promptbook and not supported anymore
102
- {
103
- title: 'Pavol Promptbook Server',
104
- description: `Personal server of Pavol Hejný with simple testing server, DO NOT USE IT FOR PRODUCTION`,
105
- owner: 'Pavol Hejný <pavol@ptbk.io> (https://www.pavolhejny.com/)',
106
- isAnonymousModeAllowed: true,
107
- urls: ['https://api.pavolhejny.com/promptbook'],
108
- },
109
- */
110
- ];
111
- /**
112
- * Note: [💞] Ignore a discrepancy between file name and entity name
113
- */
114
-
115
65
  /**
116
66
  * Trims string from all 4 sides
117
67
  *
@@ -1296,9 +1246,10 @@
1296
1246
  /**
1297
1247
  * Default remote server URL for the Promptbook
1298
1248
  *
1249
+ * @deprecated TODO: !!! Deprecate all things related to pipelines and pipelines server
1299
1250
  * @public exported from `@promptbook/core`
1300
1251
  */
1301
- const DEFAULT_REMOTE_SERVER_URL = REMOTE_SERVER_URLS[0].urls[0];
1252
+ const DEFAULT_REMOTE_SERVER_URL = `https://promptbook.s5.ptbk.io/`;
1302
1253
  // <- TODO: [🧜‍♂️]
1303
1254
  /**
1304
1255
  * Default settings for parsing and generating CSV files in Promptbook.
@@ -2744,9 +2695,10 @@
2744
2695
  *
2745
2696
  * Note: [🔂] This function is idempotent.
2746
2697
  * Note: Dataurl are considered perfectly valid.
2747
- * Note: There are two similar functions:
2748
- * - `isValidUrl` which tests any URL
2749
- * - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
2698
+ * Note: There are few similar functions:
2699
+ * - `isValidUrl` *(this one)* which tests any URL
2700
+ * - `isValidAgentUrl` which tests just agent URL
2701
+ * - `isValidPipelineUrl` which tests just pipeline URL
2750
2702
  *
2751
2703
  * @public exported from `@promptbook/utils`
2752
2704
  */
@@ -3024,8 +2976,8 @@
3024
2976
  */
3025
2977
  function removeDiacritics(input) {
3026
2978
  /*eslint no-control-regex: "off"*/
3027
- return input.replace(/[^\u0000-\u007E]/g, (a) => {
3028
- return DIACRITIC_VARIANTS_LETTERS[a] || a;
2979
+ return input.replace(/[^\u0000-\u007E]/g, (character) => {
2980
+ return DIACRITIC_VARIANTS_LETTERS[character] || character;
3029
2981
  });
3030
2982
  }
3031
2983
  /**
@@ -3952,7 +3904,7 @@
3952
3904
  tasks.push(task);
3953
3905
  runningTasks.push(task);
3954
3906
  /* not await */ Promise.resolve(task).then(() => {
3955
- runningTasks = runningTasks.filter((t) => t !== task);
3907
+ runningTasks = runningTasks.filter((runningTask) => runningTask !== task);
3956
3908
  });
3957
3909
  if (maxParallelCount < runningTasks.length) {
3958
3910
  await Promise.race(runningTasks);
@@ -4770,11 +4722,45 @@
4770
4722
  return true;
4771
4723
  }
4772
4724
 
4725
+ /**
4726
+ * Tests if given string is valid agent URL
4727
+ *
4728
+ * Note: There are few similar functions:
4729
+ * - `isValidUrl` which tests any URL
4730
+ * - `isValidAgentUrl` *(this one)* which tests just agent URL
4731
+ * - `isValidPipelineUrl` which tests just pipeline URL
4732
+ *
4733
+ * @public exported from `@promptbook/utils`
4734
+ */
4735
+ function isValidAgentUrl(url) {
4736
+ if (!isValidUrl(url)) {
4737
+ return false;
4738
+ }
4739
+ if (!url.startsWith('https://') && !url.startsWith('http://') /* <- Note: [👣] */) {
4740
+ return false;
4741
+ }
4742
+ if (url.includes('#')) {
4743
+ // TODO: [🐠]
4744
+ return false;
4745
+ }
4746
+ /*
4747
+ Note: [👣][🧠] Is it secure to allow pipeline URLs on private and unsecured networks?
4748
+ if (isUrlOnPrivateNetwork(url)) {
4749
+ return false;
4750
+ }
4751
+ */
4752
+ return true;
4753
+ }
4754
+ /**
4755
+ * TODO: [🐠] Maybe more info why the URL is invalid
4756
+ */
4757
+
4773
4758
  /**
4774
4759
  * Tests if given string is valid pipeline URL URL.
4775
4760
  *
4776
- * Note: There are two similar functions:
4761
+ * Note: There are few similar functions:
4777
4762
  * - `isValidUrl` which tests any URL
4763
+ * - `isValidAgentUrl` which tests just agent URL
4778
4764
  * - `isValidPipelineUrl` *(this one)* which tests just pipeline URL
4779
4765
  *
4780
4766
  * @public exported from `@promptbook/utils`
@@ -5341,10 +5327,14 @@
5341
5327
  }
5342
5328
 
5343
5329
  /**
5344
- * Intercepts LLM tools and counts total usage of the tools
5330
+ * Intercepts LLM tools and counts total usage of the tools.
5345
5331
  *
5346
- * @param llmTools LLM tools to be intercepted with usage counting
5347
- * @returns LLM tools with same functionality with added total cost counting
5332
+ * This function wraps the provided `LlmExecutionTools` with a proxy that tracks the cumulative
5333
+ * usage (tokens, cost, etc.) across all model calls. It provides a way to monitor spending
5334
+ * in real-time through an observable.
5335
+ *
5336
+ * @param llmTools - The LLM tools to be intercepted and tracked
5337
+ * @returns An augmented version of the tools that includes usage tracking capabilities
5348
5338
  * @public exported from `@promptbook/core`
5349
5339
  */
5350
5340
  function countUsage(llmTools) {
@@ -5419,7 +5409,7 @@
5419
5409
  * TODO: [🧠] Is there some meaningfull way how to test this util
5420
5410
  * TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
5421
5411
  * > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
5422
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
5412
+ * TODO: [👷‍♂️] Write a comprehensive manual explaining the construction and usage of LLM tools in the Promptbook ecosystem
5423
5413
  */
5424
5414
 
5425
5415
  /**
@@ -5622,17 +5612,21 @@
5622
5612
  */
5623
5613
 
5624
5614
  /**
5625
- * Joins multiple LLM Execution Tools into one
5615
+ * Joins multiple LLM Execution Tools into one.
5626
5616
  *
5627
- * @returns {LlmExecutionTools} Single wrapper for multiple LlmExecutionTools
5617
+ * This function takes a list of `LlmExecutionTools` and returns a single unified
5618
+ * `MultipleLlmExecutionTools` object. It provides failover and aggregation logic:
5628
5619
  *
5629
- * 0) If there is no LlmExecutionTools, it warns and returns valid but empty LlmExecutionTools
5630
- * 1) If there is only one LlmExecutionTools, it returns it wrapped in a proxy object
5631
- * 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.
5632
- * 3) When all LlmExecutionTools fail, it throws an error with a list of all errors merged into one
5620
+ * 1. **Failover**: When a model call is made, it tries providers in the order they were provided.
5621
+ * If the first provider doesn't support the requested model or fails, it tries the next one.
5622
+ * 2. **Aggregation**: `listModels` returns a combined list of all models available from all providers.
5623
+ * 3. **Empty case**: If no tools are provided, it logs a warning (as Promptbook requires LLMs to function).
5633
5624
  *
5625
+ * @param title - A descriptive title for this collection of joined tools
5626
+ * @param llmExecutionTools - An array of execution tools to be joined
5627
+ * @returns A single unified execution tool wrapper
5634
5628
  *
5635
- * Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools`
5629
+ * Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools`.
5636
5630
  *
5637
5631
  * @public exported from `@promptbook/core`
5638
5632
  */
@@ -5672,7 +5666,7 @@
5672
5666
  }
5673
5667
  /**
5674
5668
  * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
5675
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
5669
+ * TODO: [👷‍♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
5676
5670
  */
5677
5671
 
5678
5672
  /**
@@ -5857,7 +5851,7 @@
5857
5851
  }
5858
5852
  /**
5859
5853
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
5860
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
5854
+ * TODO: [👷‍♂️] Write a comprehensive manual about the construction of LLM tools
5861
5855
  * TODO: [🥃] Allow `ptbk make` without llm tools
5862
5856
  * TODO: This should be maybe not under `_common` but under `utils-internal` / `utils/internal`
5863
5857
  * TODO: [®] DRY Register logic
@@ -8014,7 +8008,7 @@
8014
8008
  }
8015
8009
  /**
8016
8010
  * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
8017
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
8011
+ * TODO: [👷‍♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
8018
8012
  */
8019
8013
 
8020
8014
  /**
@@ -8573,7 +8567,7 @@
8573
8567
  const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
8574
8568
  const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
8575
8569
  const { index } = knowledgePiece;
8576
- const knowledgePieceIndex = index.find((i) => i.modelName === firstKnowledgeIndex.modelName);
8570
+ const knowledgePieceIndex = index.find((knowledgePieceIndex) => knowledgePieceIndex.modelName === firstKnowledgeIndex.modelName);
8577
8571
  // <- TODO: Do not use just first knowledge piece and first index to determine embedding model
8578
8572
  if (knowledgePieceIndex === undefined) {
8579
8573
  return {
@@ -9021,7 +9015,7 @@
9021
9015
  resovedParameterNames = [...resovedParameterNames, currentTask.resultingParameterName];
9022
9016
  })
9023
9017
  .then(() => {
9024
- resolving = resolving.filter((w) => w !== work);
9018
+ resolving = resolving.filter((workItem) => workItem !== work);
9025
9019
  });
9026
9020
  // <- Note: Errors are catched here [3]
9027
9021
  // 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
@@ -9187,7 +9181,7 @@
9187
9181
  // Calculate and update tldr based on pipeline progress
9188
9182
  const cv = newOngoingResult;
9189
9183
  // Calculate progress based on parameters resolved vs total parameters
9190
- const totalParameters = pipeline.parameters.filter((p) => !p.isInput).length;
9184
+ const totalParameters = pipeline.parameters.filter((parameter) => !parameter.isInput).length;
9191
9185
  let resolvedParameters = 0;
9192
9186
  let currentTaskTitle = '';
9193
9187
  // Get the resolved parameters from output parameters
@@ -9374,7 +9368,6 @@
9374
9368
  * @public exported from `@promptbook/core`
9375
9369
  */
9376
9370
  async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
9377
- // console.log('!! makeKnowledgeSourceHandler', knowledgeSource);
9378
9371
  var _a;
9379
9372
  const { fetch = promptbookFetch } = tools;
9380
9373
  const { knowledgeSourceContent } = knowledgeSource;
@@ -11282,7 +11275,12 @@
11282
11275
  * @see {@link ModelVariant}
11283
11276
  * @public exported from `@promptbook/core`
11284
11277
  */
11285
- const MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'IMAGE_GENERATION', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
11278
+ const MODEL_VARIANTS = [
11279
+ 'COMPLETION',
11280
+ 'CHAT',
11281
+ 'IMAGE_GENERATION',
11282
+ 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */,
11283
+ ];
11286
11284
 
11287
11285
  /**
11288
11286
  * Parses the model command
@@ -19311,6 +19309,22 @@
19311
19309
  * TODO: [🤝] DRY Maybe some common abstraction between `computeOpenAiUsage` and `computeAnthropicClaudeUsage`
19312
19310
  */
19313
19311
 
19312
+ /**
19313
+ * Maps Promptbook tools to OpenAI tools.
19314
+ *
19315
+ * @private
19316
+ */
19317
+ function mapToolsToOpenAi(tools) {
19318
+ return tools.map((tool) => ({
19319
+ type: 'function',
19320
+ function: {
19321
+ name: tool.name,
19322
+ description: tool.description,
19323
+ parameters: tool.parameters,
19324
+ },
19325
+ }));
19326
+ }
19327
+
19314
19328
  /**
19315
19329
  * Parses an OpenAI error message to identify which parameter is unsupported
19316
19330
  *
@@ -19508,6 +19522,9 @@
19508
19522
  },
19509
19523
  ],
19510
19524
  user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
19525
+ tools: currentModelRequirements.tools === undefined
19526
+ ? undefined
19527
+ : mapToolsToOpenAi(currentModelRequirements.tools),
19511
19528
  };
19512
19529
  const start = $getCurrentDate();
19513
19530
  if (this.options.isVerbose) {
@@ -19652,6 +19669,7 @@
19652
19669
  const rawPromptContent = templateParameters(content, { ...parameters, modelName });
19653
19670
  const rawRequest = {
19654
19671
  ...modelSettings,
19672
+ model: modelName,
19655
19673
  prompt: rawPromptContent,
19656
19674
  user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
19657
19675
  };
@@ -19906,8 +19924,8 @@
19906
19924
  const rawPromptContent = templateParameters(content, { ...parameters, modelName });
19907
19925
  const rawRequest = {
19908
19926
  ...modelSettings,
19909
- size: modelSettings.size || '1024x1024',
19910
19927
  prompt: rawPromptContent,
19928
+ size: modelSettings.size || '1024x1024',
19911
19929
  user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
19912
19930
  response_format: 'url', // TODO: [🧠] Maybe allow b64_json
19913
19931
  };
@@ -20805,6 +20823,7 @@
20805
20823
  thread: {
20806
20824
  messages: threadMessages,
20807
20825
  },
20826
+ tools: modelRequirements.tools === undefined ? undefined : mapToolsToOpenAi(modelRequirements.tools),
20808
20827
  // <- TODO: Add user identification here> user: this.options.user,
20809
20828
  };
20810
20829
  const start = $getCurrentDate();
@@ -20896,12 +20915,10 @@
20896
20915
 
20897
20916
  // List all assistants
20898
20917
  const assistants = await client.beta.assistants.list();
20899
- console.log('!!! Assistants:', assistants);
20900
-
20918
+
20901
20919
  // Get details of a specific assistant
20902
20920
  const assistantId = 'asst_MO8fhZf4dGloCfXSHeLcIik0';
20903
20921
  const assistant = await client.beta.assistants.retrieve(assistantId);
20904
- console.log('!!! Assistant Details:', assistant);
20905
20922
 
20906
20923
  // Update an assistant
20907
20924
  const updatedAssistant = await client.beta.assistants.update(assistantId, {
@@ -20911,8 +20928,7 @@
20911
20928
  [Math.random().toString(36).substring(2, 15)]: new Date().toISOString(),
20912
20929
  },
20913
20930
  });
20914
- console.log('!!! Updated Assistant:', updatedAssistant);
20915
-
20931
+
20916
20932
  await forEver();
20917
20933
  }
20918
20934
  */
@@ -22218,7 +22234,6 @@
22218
22234
  // Note: Running Markitdown conversion ONLY if the file in the cache does not exist
22219
22235
  if (!(await isFileExisting(cacheFilehandler.filename, this.tools.fs))) {
22220
22236
  const src = source.filename || source.url || null;
22221
- // console.log('!!', { src, source, cacheFilehandler });
22222
22237
  if (src === null) {
22223
22238
  throw new UnexpectedError('Source has no filename or url');
22224
22239
  }
@@ -22231,7 +22246,6 @@
22231
22246
  throw new Error(`Markitdown could not convert the "${source.source}"`);
22232
22247
  // <- TODO: [🍀] Make MarkitdownError
22233
22248
  }
22234
- // console.log('!!', { result, cacheFilehandler });
22235
22249
  // Note: Try to cache the converted content, but don't fail if the filesystem is read-only
22236
22250
  try {
22237
22251
  await this.tools.fs.writeFile(cacheFilehandler.filename, result.text_content);
@@ -22693,8 +22707,8 @@
22693
22707
  */
22694
22708
  function createCommitmentRegex(commitment, aliases = [], requiresContent = true) {
22695
22709
  const allCommitments = [commitment, ...aliases];
22696
- const patterns = allCommitments.map((c) => {
22697
- const escapedCommitment = c.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
22710
+ const patterns = allCommitments.map((commitment) => {
22711
+ const escapedCommitment = commitment.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
22698
22712
  return escapedCommitment.split(/\s+/).join('\\s+');
22699
22713
  });
22700
22714
  const keywordPattern = patterns.join('|');
@@ -22716,8 +22730,8 @@
22716
22730
  */
22717
22731
  function createCommitmentTypeRegex(commitment, aliases = []) {
22718
22732
  const allCommitments = [commitment, ...aliases];
22719
- const patterns = allCommitments.map((c) => {
22720
- const escapedCommitment = c.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
22733
+ const patterns = allCommitments.map((commitment) => {
22734
+ const escapedCommitment = commitment.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
22721
22735
  return escapedCommitment.split(/\s+/).join('\\s+');
22722
22736
  });
22723
22737
  const keywordPattern = patterns.join('|');
@@ -23227,9 +23241,7 @@
23227
23241
  // Get existing dictionary entries from metadata
23228
23242
  const existingDictionary = ((_a = requirements.metadata) === null || _a === void 0 ? void 0 : _a.DICTIONARY) || '';
23229
23243
  // Merge the new dictionary entry with existing entries
23230
- const mergedDictionary = existingDictionary
23231
- ? `${existingDictionary}\n${trimmedContent}`
23232
- : trimmedContent;
23244
+ const mergedDictionary = existingDictionary ? `${existingDictionary}\n${trimmedContent}` : trimmedContent;
23233
23245
  // Store the merged dictionary in metadata for debugging and inspection
23234
23246
  const updatedMetadata = {
23235
23247
  ...requirements.metadata,
@@ -23380,21 +23392,35 @@
23380
23392
  applyToAgentModelRequirements(requirements, content) {
23381
23393
  const trimmedContent = content.trim();
23382
23394
  if (!trimmedContent) {
23383
- return requirements;
23395
+ return {
23396
+ ...requirements,
23397
+ parentAgentUrl: undefined,
23398
+ };
23384
23399
  }
23385
- // Validate URL
23386
- try {
23387
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
23388
- const url = new URL(trimmedContent);
23389
- // TODO: Add more validation if needed (e.g. check for valid protocol)
23400
+ if (trimmedContent.toUpperCase() === 'VOID' ||
23401
+ trimmedContent.toUpperCase() === 'NULL' ||
23402
+ trimmedContent.toUpperCase() === 'NONE' ||
23403
+ trimmedContent.toUpperCase() === 'NIL') {
23404
+ return {
23405
+ ...requirements,
23406
+ parentAgentUrl: null,
23407
+ };
23390
23408
  }
23391
- catch (error) {
23392
- console.warn(`Invalid URL in FROM commitment: ${trimmedContent}`);
23393
- return requirements;
23409
+ if (!isValidAgentUrl(trimmedContent)) {
23410
+ throw new Error(spaceTrim$1.spaceTrim((block) => `
23411
+ Invalid agent URL in FROM commitment: "${trimmedContent}"
23412
+
23413
+ \`\`\`book
23414
+ ${block(content)}
23415
+ \`\`\`
23416
+
23417
+
23418
+ `));
23394
23419
  }
23420
+ const parentAgentUrl = trimmedContent;
23395
23421
  return {
23396
23422
  ...requirements,
23397
- parentAgentUrl: trimmedContent,
23423
+ parentAgentUrl,
23398
23424
  };
23399
23425
  }
23400
23426
  }
@@ -25758,19 +25784,38 @@
25758
25784
  `);
25759
25785
  }
25760
25786
  applyToAgentModelRequirements(requirements, content) {
25761
- // We simply mark that browser capability is enabled in metadata
25762
- // Get existing metadata
25763
- const existingMetadata = requirements.metadata || {};
25764
25787
  // Get existing tools array or create new one
25765
- const existingTools = existingMetadata.tools || [];
25766
- // Add 'browser' to tools if not already present
25767
- const updatedTools = existingTools.includes('browser') ? existingTools : [...existingTools, 'browser'];
25768
- // Return requirements with updated metadata
25788
+ const existingTools = requirements.tools || [];
25789
+ // Add 'web_browser' to tools if not already present
25790
+ const updatedTools = existingTools.some((tool) => tool.name === 'web_browser')
25791
+ ? existingTools
25792
+ : [
25793
+ // TODO: [🔰] Use through proper MCP server
25794
+ ...existingTools,
25795
+ {
25796
+ name: 'web_browser',
25797
+ description: spaceTrim$1.spaceTrim(`
25798
+ A tool that can browse the web.
25799
+ Use this tool when you need to access specific websites or browse the internet.
25800
+ `),
25801
+ parameters: {
25802
+ type: 'object',
25803
+ properties: {
25804
+ url: {
25805
+ type: 'string',
25806
+ description: 'The URL to browse',
25807
+ },
25808
+ },
25809
+ required: ['url'],
25810
+ },
25811
+ },
25812
+ ];
25813
+ // Return requirements with updated tools and metadata
25769
25814
  return {
25770
25815
  ...requirements,
25816
+ tools: updatedTools,
25771
25817
  metadata: {
25772
- ...existingMetadata,
25773
- tools: updatedTools,
25818
+ ...requirements.metadata,
25774
25819
  useBrowser: true,
25775
25820
  },
25776
25821
  };
@@ -25863,13 +25908,13 @@
25863
25908
  * The `USE SEARCH ENGINE` commitment indicates that the agent should utilize a search engine tool
25864
25909
  * to access and retrieve up-to-date information from the internet when necessary.
25865
25910
  *
25866
- * The content following `USE SEARCH ENGINE` is ignored (similar to NOTE).
25911
+ * The content following `USE SEARCH ENGINE` is an arbitrary text that the agent should know (e.g. search scope or instructions).
25867
25912
  *
25868
25913
  * Example usage in agent source:
25869
25914
  *
25870
25915
  * ```book
25871
25916
  * USE SEARCH ENGINE
25872
- * USE SEARCH ENGINE This will be ignored
25917
+ * USE SEARCH ENGINE Hledej informace o Přemyslovcích
25873
25918
  * ```
25874
25919
  *
25875
25920
  * @private [🪔] Maybe export the commitments through some package
@@ -25901,7 +25946,7 @@
25901
25946
 
25902
25947
  ## Key aspects
25903
25948
 
25904
- - The content following \`USE SEARCH ENGINE\` is ignored (similar to NOTE)
25949
+ - The content following \`USE SEARCH ENGINE\` is an arbitrary text that the agent should know (e.g. search scope or instructions).
25905
25950
  - The actual search engine tool usage is handled by the agent runtime
25906
25951
  - Allows the agent to search for current information from the web
25907
25952
  - Useful for research tasks, finding facts, and accessing dynamic content
@@ -25926,20 +25971,45 @@
25926
25971
  `);
25927
25972
  }
25928
25973
  applyToAgentModelRequirements(requirements, content) {
25929
- // We simply mark that search engine capability is enabled in metadata
25930
- // Get existing metadata
25931
- const existingMetadata = requirements.metadata || {};
25932
25974
  // Get existing tools array or create new one
25933
- const existingTools = existingMetadata.tools || [];
25934
- // Add 'search-engine' to tools if not already present
25935
- const updatedTools = existingTools.includes('search-engine') ? existingTools : [...existingTools, 'search-engine'];
25936
- // Return requirements with updated metadata
25975
+ const existingTools = requirements.tools || [];
25976
+ // Add 'web_search' to tools if not already present
25977
+ const updatedTools = existingTools.some((tool) => tool.name === 'web_search')
25978
+ ? existingTools
25979
+ : [
25980
+ ...existingTools,
25981
+ { type: 'web_search' },
25982
+ // <- Note: [🔰] This is just using simple native search tool by OpenAI @see https://platform.openai.com/docs/guides/tools-web-search
25983
+ // In future we will use proper MCP search tool:
25984
+ /*
25985
+
25986
+ {
25987
+ name: 'web_search',
25988
+ description: spaceTrim(`
25989
+ Search the internet for information.
25990
+ Use this tool when you need to find up-to-date information or facts that you don't know.
25991
+ ${!content ? '' : `Search scope / instructions: ${content}`}
25992
+ `),
25993
+ parameters: {
25994
+ type: 'object',
25995
+ properties: {
25996
+ query: {
25997
+ type: 'string',
25998
+ description: 'The search query',
25999
+ },
26000
+ },
26001
+ required: ['query'],
26002
+ },
26003
+ },
26004
+ */
26005
+ ];
26006
+ // Return requirements with updated tools and metadata
25937
26007
  return {
25938
26008
  ...requirements,
26009
+ tools: updatedTools,
25939
26010
  metadata: {
25940
- ...existingMetadata,
25941
- tools: updatedTools,
25942
- useSearchEngine: true,
26011
+ ...requirements.metadata,
26012
+ useSearchEngine: content || true,
25943
26013
  },
25944
26014
  };
25945
26015
  }
@@ -26344,8 +26414,8 @@
26344
26414
  return match;
26345
26415
  });
26346
26416
  // Remove duplicates based on name (keep the first occurrence)
26347
- const uniqueParameters = parameters.filter((param, index, array) => {
26348
- return array.findIndex((p) => p.name === param.name) === index;
26417
+ const uniqueParameters = parameters.filter((parameter, index, array) => {
26418
+ return array.findIndex((parameterItem) => parameterItem.name === parameter.name) === index;
26349
26419
  });
26350
26420
  return uniqueParameters;
26351
26421
  }
@@ -26392,7 +26462,7 @@
26392
26462
  commitment.type === 'DISCARD' ||
26393
26463
  commitment.type === 'REMOVE') {
26394
26464
  const targets = parseParameters(commitment.content)
26395
- .map((p) => p.name.trim().toLowerCase())
26465
+ .map((parameter) => parameter.name.trim().toLowerCase())
26396
26466
  .filter(Boolean);
26397
26467
  if (targets.length === 0) {
26398
26468
  // Ignore DELETE with no targets; also don't pass the DELETE further
@@ -26401,8 +26471,8 @@
26401
26471
  // Drop prior kept commitments that contain any of the targeted tags
26402
26472
  for (let i = filteredCommitments.length - 1; i >= 0; i--) {
26403
26473
  const prev = filteredCommitments[i];
26404
- const prevParams = parseParameters(prev.content).map((p) => p.name.trim().toLowerCase());
26405
- const hasIntersection = prevParams.some((n) => targets.includes(n));
26474
+ const prevParams = parseParameters(prev.content).map((parameter) => parameter.name.trim().toLowerCase());
26475
+ const hasIntersection = prevParams.some((parameterName) => targets.includes(parameterName));
26406
26476
  if (hasIntersection) {
26407
26477
  filteredCommitments.splice(i, 1);
26408
26478
  }
@@ -26430,7 +26500,12 @@
26430
26500
  };
26431
26501
  }
26432
26502
  // Apply each commitment in order using reduce-like pattern
26433
- for (const commitment of filteredCommitments) {
26503
+ for (let i = 0; i < filteredCommitments.length; i++) {
26504
+ const commitment = filteredCommitments[i];
26505
+ // CLOSED commitment should work only if its the last commitment in the book
26506
+ if (commitment.type === 'CLOSED' && i !== filteredCommitments.length - 1) {
26507
+ continue;
26508
+ }
26434
26509
  const definition = getCommitmentDefinition(commitment.type);
26435
26510
  if (definition) {
26436
26511
  try {
@@ -26538,7 +26613,57 @@
26538
26613
  }
26539
26614
  const meta = {};
26540
26615
  const links = [];
26616
+ const capabilities = [];
26541
26617
  for (const commitment of parseResult.commitments) {
26618
+ if (commitment.type === 'USE BROWSER') {
26619
+ capabilities.push({
26620
+ type: 'browser',
26621
+ label: 'Browser',
26622
+ iconName: 'Globe',
26623
+ });
26624
+ continue;
26625
+ }
26626
+ if (commitment.type === 'USE SEARCH ENGINE') {
26627
+ capabilities.push({
26628
+ type: 'search-engine',
26629
+ label: 'Search Internet',
26630
+ iconName: 'Search',
26631
+ });
26632
+ continue;
26633
+ }
26634
+ if (commitment.type === 'KNOWLEDGE') {
26635
+ const content = spaceTrim__default["default"](commitment.content).split('\n')[0] || '';
26636
+ let label = content;
26637
+ let iconName = 'Book';
26638
+ if (content.startsWith('http://') || content.startsWith('https://')) {
26639
+ try {
26640
+ const url = new URL(content);
26641
+ if (url.pathname.endsWith('.pdf')) {
26642
+ label = url.pathname.split('/').pop() || 'Document.pdf';
26643
+ iconName = 'FileText';
26644
+ }
26645
+ else {
26646
+ label = url.hostname.replace(/^www\./, '');
26647
+ }
26648
+ }
26649
+ catch (e) {
26650
+ // Invalid URL, treat as text
26651
+ }
26652
+ }
26653
+ else {
26654
+ // Text content - take first few words
26655
+ const words = content.split(/\s+/);
26656
+ if (words.length > 4) {
26657
+ label = words.slice(0, 4).join(' ') + '...';
26658
+ }
26659
+ }
26660
+ capabilities.push({
26661
+ type: 'knowledge',
26662
+ label,
26663
+ iconName,
26664
+ });
26665
+ continue;
26666
+ }
26542
26667
  if (commitment.type === 'META LINK') {
26543
26668
  const linkValue = spaceTrim__default["default"](commitment.content);
26544
26669
  links.push(linkValue);
@@ -26549,6 +26674,10 @@
26549
26674
  meta.image = spaceTrim__default["default"](commitment.content);
26550
26675
  continue;
26551
26676
  }
26677
+ if (commitment.type === 'META DESCRIPTION') {
26678
+ meta.description = spaceTrim__default["default"](commitment.content);
26679
+ continue;
26680
+ }
26552
26681
  if (commitment.type === 'META COLOR') {
26553
26682
  meta.color = normalizeSeparator(commitment.content);
26554
26683
  continue;
@@ -26585,6 +26714,7 @@
26585
26714
  meta,
26586
26715
  links,
26587
26716
  parameters,
26717
+ capabilities,
26588
26718
  };
26589
26719
  }
26590
26720
  /**