@promptbook/cli 0.112.0-99 → 0.112.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 (814) hide show
  1. package/README.md +37 -21
  2. package/agents/default/developer.book +23 -0
  3. package/apps/agents-server/README.md +19 -2
  4. package/apps/agents-server/env-manual/GITHUB_APP.md +1 -1
  5. package/apps/agents-server/next.config.ts +20 -1
  6. package/apps/agents-server/package.json +1 -1
  7. package/apps/agents-server/playwright.config.ts +3 -0
  8. package/apps/agents-server/public/promptbook-logo-blue.png +0 -0
  9. package/apps/agents-server/public/promptbook-logo-white.png +0 -0
  10. package/apps/agents-server/scripts/prerender-homepage.js +76 -1
  11. package/apps/agents-server/src/app/AddAgentButton.tsx +0 -5
  12. package/apps/agents-server/src/app/[agentName]/layout.tsx +1 -0
  13. package/apps/agents-server/src/app/actions.ts +70 -9
  14. package/apps/agents-server/src/app/admin/about/page.tsx +1 -1
  15. package/apps/agents-server/src/app/admin/api-tokens/ApiTokensClient.tsx +4 -1
  16. package/apps/agents-server/src/app/admin/chat-feedback/ChatFeedbackClient.tsx +3 -0
  17. package/apps/agents-server/src/app/admin/chat-feedback/ChatFeedbackTable.tsx +13 -8
  18. package/apps/agents-server/src/app/admin/chat-feedback/page.tsx +2 -4
  19. package/apps/agents-server/src/app/admin/chat-history/ChatHistoryClient.tsx +3 -0
  20. package/apps/agents-server/src/app/admin/chat-history/ChatHistoryTable.tsx +13 -8
  21. package/apps/agents-server/src/app/admin/chat-history/page.tsx +2 -4
  22. package/apps/agents-server/src/app/admin/cli-access/CliAccessClient.tsx +1 -3
  23. package/apps/agents-server/src/app/admin/code-runners/CodeRunnersClient.tsx +19 -11
  24. package/apps/agents-server/src/app/admin/custom-css/CustomCssClient.tsx +4 -0
  25. package/apps/agents-server/src/app/admin/custom-css/CustomCssEditorPanel.tsx +7 -1
  26. package/apps/agents-server/src/app/admin/custom-css/CustomCssFilesPanel.tsx +7 -1
  27. package/apps/agents-server/src/app/admin/custom-js/CustomJsClient.tsx +11 -0
  28. package/apps/agents-server/src/app/admin/custom-js/CustomJsEditorPanel.tsx +7 -1
  29. package/apps/agents-server/src/app/admin/custom-js/CustomJsFilesPanel.tsx +7 -1
  30. package/apps/agents-server/src/app/admin/files/FilesGalleryClient.tsx +4 -0
  31. package/apps/agents-server/src/app/admin/files/FilesGalleryGrid.tsx +9 -11
  32. package/apps/agents-server/src/app/admin/files/FilesGalleryTable.tsx +9 -8
  33. package/apps/agents-server/src/app/admin/image-generator-test/ImageAttachmentsEditor.tsx +30 -9
  34. package/apps/agents-server/src/app/admin/images/ImagesGalleryClient.tsx +4 -0
  35. package/apps/agents-server/src/app/admin/images/ImagesGalleryGrid.tsx +16 -11
  36. package/apps/agents-server/src/app/admin/images/ImagesGalleryTable.tsx +18 -9
  37. package/apps/agents-server/src/app/admin/limits/LimitsClient.tsx +11 -12
  38. package/apps/agents-server/src/app/admin/login-methods/shibboleth/page.tsx +355 -0
  39. package/apps/agents-server/src/app/admin/logs/LogsClient.tsx +9 -3
  40. package/apps/agents-server/src/app/admin/messages/MessagesClient.tsx +7 -6
  41. package/apps/agents-server/src/app/admin/metadata/MetadataClient.tsx +671 -45
  42. package/apps/agents-server/src/app/admin/servers/CreateServerDialog.tsx +22 -1
  43. package/apps/agents-server/src/app/admin/servers/ServersRegistryTable.tsx +14 -13
  44. package/apps/agents-server/src/app/admin/servers/useCreateServerWizard.ts +57 -20
  45. package/apps/agents-server/src/app/admin/task-manager/TaskManagerClient.tsx +4 -2
  46. package/apps/agents-server/src/app/admin/task-manager/TaskManagerTaskRow.tsx +14 -15
  47. package/apps/agents-server/src/app/admin/task-manager/TaskManagerTasksCard.tsx +4 -1
  48. package/apps/agents-server/src/app/admin/task-manager/useTaskManagerState.ts +6 -9
  49. package/apps/agents-server/src/app/admin/update/CustomCommitPicker.tsx +258 -0
  50. package/apps/agents-server/src/app/admin/update/UpdateClient.tsx +608 -137
  51. package/apps/agents-server/src/app/admin/usage/UsageClient.tsx +4 -2
  52. package/apps/agents-server/src/app/admin/usage/UsageClientAnalyticsPanels.tsx +6 -4
  53. package/apps/agents-server/src/app/admin/usage/UsageClientFormatting.ts +6 -12
  54. package/apps/agents-server/src/app/admin/usage/UsageClientTimelineChart.tsx +7 -4
  55. package/apps/agents-server/src/app/admin/usage/useUsageClientState.ts +12 -4
  56. package/apps/agents-server/src/app/admin/users/[userId]/UserDetailClient.tsx +27 -15
  57. package/apps/agents-server/src/app/agents/[agentName]/ActiveAgentBreadcrumbBinder.tsx +30 -0
  58. package/apps/agents-server/src/app/agents/[agentName]/AgentChatWrapper.tsx +13 -2
  59. package/apps/agents-server/src/app/agents/[agentName]/AgentProfileChat.tsx +20 -25
  60. package/apps/agents-server/src/app/agents/[agentName]/_utils.ts +7 -5
  61. package/apps/agents-server/src/app/agents/[agentName]/api/book/route.ts +2 -0
  62. package/apps/agents-server/src/app/agents/[agentName]/api/user-chats/[chatId]/messages/route.ts +4 -11
  63. package/apps/agents-server/src/app/agents/[agentName]/api/user-chats/[chatId]/stream/route.ts +85 -56
  64. package/apps/agents-server/src/app/agents/[agentName]/book/BookEditorWrapper.tsx +7 -1
  65. package/apps/agents-server/src/app/agents/[agentName]/book/useBookEditorHistory.ts +9 -2
  66. package/apps/agents-server/src/app/agents/[agentName]/chat/AgentChatHistoryPayloadState.ts +38 -4
  67. package/apps/agents-server/src/app/agents/[agentName]/chat/AgentChatHistorySyncOperations.ts +4 -1
  68. package/apps/agents-server/src/app/agents/[agentName]/chat/AgentChatPageLayout.tsx +2 -2
  69. package/apps/agents-server/src/app/agents/[agentName]/chat/AgentChatSidebarDefault.tsx +19 -13
  70. package/apps/agents-server/src/app/agents/[agentName]/chat/CanonicalAgentChatSurface.tsx +30 -16
  71. package/apps/agents-server/src/app/agents/[agentName]/chat/useAgentChatHistoryClientState.ts +2 -15
  72. package/apps/agents-server/src/app/agents/[agentName]/chat/useAgentChatHistorySyncEffects.ts +7 -13
  73. package/apps/agents-server/src/app/agents/[agentName]/chat/useCanonicalAgentChatPanelState.ts +58 -7
  74. package/apps/agents-server/src/app/agents/[agentName]/history/page.tsx +6 -1
  75. package/apps/agents-server/src/app/agents/[agentName]/images/default-avatar.png/route.ts +6 -2
  76. package/apps/agents-server/src/app/agents/[agentName]/integration/CalendarIntegrationSection.tsx +23 -5
  77. package/apps/agents-server/src/app/agents/[agentName]/layout.tsx +47 -1
  78. package/apps/agents-server/src/app/agents/[agentName]/timeouts/AgentTimeoutsClient.tsx +4 -2
  79. package/apps/agents-server/src/app/agents/[agentName]/timeouts/AgentTimeoutsFiltersCard.tsx +9 -4
  80. package/apps/agents-server/src/app/agents/[agentName]/timeouts/AgentTimeoutsTableCard.tsx +4 -1
  81. package/apps/agents-server/src/app/agents/[agentName]/timeouts/AgentTimeoutsTableRow.tsx +10 -3
  82. package/apps/agents-server/src/app/api/admin/cli-access/route.ts +27 -123
  83. package/apps/agents-server/src/app/api/admin/code-runners/authentication/route.ts +33 -125
  84. package/apps/agents-server/src/app/api/admin/code-runners/route.ts +1 -1
  85. package/apps/agents-server/src/app/api/admin/servers/route.ts +5 -0
  86. package/apps/agents-server/src/app/api/admin/update/commits/route.ts +35 -0
  87. package/apps/agents-server/src/app/api/admin/update/log/route.ts +42 -0
  88. package/apps/agents-server/src/app/api/admin/update/route.ts +10 -2
  89. package/apps/agents-server/src/app/api/agents/[agentName]/route.ts +33 -9
  90. package/apps/agents-server/src/app/api/agents/export/route.ts +67 -0
  91. package/apps/agents-server/src/app/api/agents/import/route.ts +168 -0
  92. package/apps/agents-server/src/app/api/auth/change-password/route.ts +53 -6
  93. package/apps/agents-server/src/app/api/auth/login/route.ts +17 -16
  94. package/apps/agents-server/src/app/api/auth/logout/route.ts +2 -10
  95. package/apps/agents-server/src/app/api/auth/shibboleth/acs/route.ts +112 -0
  96. package/apps/agents-server/src/app/api/auth/shibboleth/login/route.ts +70 -0
  97. package/apps/agents-server/src/app/api/auth/shibboleth/metadata/route.ts +15 -0
  98. package/apps/agents-server/src/app/api/auth/shibboleth/status/route.ts +17 -0
  99. package/apps/agents-server/src/app/api/chat/citation-label/route.ts +133 -0
  100. package/apps/agents-server/src/app/api/chat/export/pdf/route.ts +167 -2
  101. package/apps/agents-server/src/app/api/chat/route.ts +29 -7
  102. package/apps/agents-server/src/app/api/chat-feedback/export/route.ts +2 -2
  103. package/apps/agents-server/src/app/api/chat-feedback/route.ts +3 -3
  104. package/apps/agents-server/src/app/api/chat-history/[id]/route.ts +2 -2
  105. package/apps/agents-server/src/app/api/chat-history/export/route.ts +2 -2
  106. package/apps/agents-server/src/app/api/chat-history/route.ts +3 -3
  107. package/apps/agents-server/src/app/api/chat-streaming/route.ts +29 -0
  108. package/apps/agents-server/src/app/api/elevenlabs/tts/route.ts +60 -2
  109. package/apps/agents-server/src/app/api/emails/incoming/sendgrid/route.ts +24 -2
  110. package/apps/agents-server/src/app/api/federated-agents/route.ts +1 -1
  111. package/apps/agents-server/src/app/api/health/route.ts +18 -0
  112. package/apps/agents-server/src/app/api/images/[filename]/route.ts +108 -2
  113. package/apps/agents-server/src/app/api/internal/agent-runner-limits/route.ts +52 -0
  114. package/apps/agents-server/src/app/api/internal/user-chat-jobs/run/route.ts +17 -4
  115. package/apps/agents-server/src/app/api/metadata/export/route.ts +34 -0
  116. package/apps/agents-server/src/app/api/metadata/import/route.ts +47 -0
  117. package/apps/agents-server/src/app/api/metadata/route.ts +4 -0
  118. package/apps/agents-server/src/app/api/openai/v1/audio/transcriptions/route.ts +111 -2
  119. package/apps/agents-server/src/app/api/page-preview/check/route.ts +49 -0
  120. package/apps/agents-server/src/app/api/page-preview/screenshot/route.ts +64 -0
  121. package/apps/agents-server/src/app/api/scrape/route.ts +18 -0
  122. package/apps/agents-server/src/app/api/team-agent-profile/route.ts +20 -0
  123. package/apps/agents-server/src/app/api/upload/route.ts +204 -220
  124. package/apps/agents-server/src/app/api/users/[username]/route.ts +3 -2
  125. package/apps/agents-server/src/app/api/users/route.ts +8 -7
  126. package/apps/agents-server/src/app/api/v1/agents/[agentId]/route.ts +4 -0
  127. package/apps/agents-server/src/app/api/v1/agents/route.ts +2 -0
  128. package/apps/agents-server/src/app/dashboard/page.tsx +12 -17
  129. package/apps/agents-server/src/app/docs/[docId]/page.tsx +1 -1
  130. package/apps/agents-server/src/app/docs/page.tsx +1 -1
  131. package/apps/agents-server/src/app/globals.css +179 -0
  132. package/apps/agents-server/src/app/layout.tsx +33 -4
  133. package/apps/agents-server/src/app/recycle-bin/actions.ts +3 -0
  134. package/apps/agents-server/src/app/recycle-bin/page.tsx +1 -1
  135. package/apps/agents-server/src/app/s3/[first]/[second]/[hash]/[filename]/route.ts +52 -0
  136. package/apps/agents-server/src/app/swagger/SwaggerApiKeysPanel.tsx +4 -1
  137. package/apps/agents-server/src/app/system/settings/KeybindingsSettingsClient.tsx +13 -7
  138. package/apps/agents-server/src/app/system/user-memory/UserMemoryClient.tsx +4 -2
  139. package/apps/agents-server/src/app/system/user-wallet/UserWalletClient.tsx +3 -0
  140. package/apps/agents-server/src/app/system/user-wallet/UserWalletRecordsTable.tsx +5 -1
  141. package/apps/agents-server/src/app/system/utilities/mocked-chats/MockedChatsEditorClient.tsx +3 -0
  142. package/apps/agents-server/src/app/system/utilities/mocked-chats/MockedChatsEditorSidebar.tsx +7 -8
  143. package/apps/agents-server/src/components/AdminTerminal/AdminTerminalCard.tsx +13 -70
  144. package/apps/agents-server/src/components/AdminTerminal/AdminXtermTerminal.tsx +330 -0
  145. package/apps/agents-server/src/components/AdminTerminal/useAdminTerminalSession.ts +45 -5
  146. package/apps/agents-server/src/components/AgentContextMenu/useAgentContextMenuItems.ts +27 -19
  147. package/apps/agents-server/src/components/AgentProfile/AgentProfile.tsx +4 -7
  148. package/apps/agents-server/src/components/AgentProfile/AgentProfileImage.tsx +8 -2
  149. package/apps/agents-server/src/components/ApplicationErrorPage/ApplicationErrorPage.tsx +118 -12
  150. package/apps/agents-server/src/components/DocsToolbar/DocsToolbar.tsx +4 -4
  151. package/apps/agents-server/src/components/DocumentationContent/DocumentationContent.tsx +9 -9
  152. package/apps/agents-server/src/components/FileUploadAvailability/FileUploadAvailabilityContext.tsx +50 -0
  153. package/apps/agents-server/src/components/FileUploadAvailability/FileUploadUnavailableNotice.tsx +45 -0
  154. package/apps/agents-server/src/components/Footer/Footer.tsx +10 -9
  155. package/apps/agents-server/src/components/Footer/getCommitFooterEmoji.ts +112 -0
  156. package/apps/agents-server/src/components/Header/ActiveAgentBreadcrumbContext.tsx +82 -0
  157. package/apps/agents-server/src/components/Header/Header.tsx +24 -15
  158. package/apps/agents-server/src/components/Header/HeaderTypes.ts +6 -0
  159. package/apps/agents-server/src/components/Header/buildHeaderSystemMenuItems.ts +51 -1
  160. package/apps/agents-server/src/components/Header/useHeaderActiveAgent.ts +26 -7
  161. package/apps/agents-server/src/components/Header/useHeaderAgentMenus.tsx +0 -5
  162. package/apps/agents-server/src/components/Homepage/AgentsList.tsx +19 -1
  163. package/apps/agents-server/src/components/Homepage/AgentsListHeader.tsx +44 -1
  164. package/apps/agents-server/src/components/Homepage/AgentsListListView.tsx +6 -0
  165. package/apps/agents-server/src/components/Homepage/AgentsListViewContent.tsx +6 -0
  166. package/apps/agents-server/src/components/Homepage/Card.tsx +1 -1
  167. package/apps/agents-server/src/components/Homepage/Section.tsx +3 -1
  168. package/apps/agents-server/src/components/Homepage/SortableFolderCard.tsx +7 -1
  169. package/apps/agents-server/src/components/Homepage/useAgentsListImportExportState.ts +525 -0
  170. package/apps/agents-server/src/components/Homepage/useAgentsListState.ts +14 -0
  171. package/apps/agents-server/src/components/LayoutWrapper/LayoutWrapper.tsx +93 -70
  172. package/apps/agents-server/src/components/LoginForm/LoginForm.tsx +52 -12
  173. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/ManGoNewAgentWizard.tsx +151 -0
  174. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/ManGoOnboardingNavigation.tsx +50 -0
  175. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/BookLanguagePanel.tsx +125 -0
  176. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/DropZone.tsx +83 -0
  177. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/EmailTestRun.tsx +216 -0
  178. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/KnowledgeList.tsx +79 -0
  179. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/Logo.tsx +20 -0
  180. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/MarkdownBookEditor.tsx +154 -0
  181. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/MarkdownPreview.tsx +188 -0
  182. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/RailStepper.tsx +115 -0
  183. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/StepFrame.tsx +47 -0
  184. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/TestChat.tsx +159 -0
  185. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/WizardShell.tsx +114 -0
  186. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/brand/RailArtwork.tsx +60 -0
  187. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/steps/BookStep.tsx +135 -0
  188. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/steps/DoneStep.tsx +215 -0
  189. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/steps/KnowledgeStep.tsx +152 -0
  190. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/steps/TestStep.tsx +262 -0
  191. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/steps/ZadaniStep.tsx +64 -0
  192. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/ui/Badge.tsx +41 -0
  193. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/ui/Banner.tsx +69 -0
  194. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/ui/Button.tsx +77 -0
  195. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/ui/Card.tsx +33 -0
  196. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/ui/Field.tsx +103 -0
  197. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/ui/IconButton.tsx +40 -0
  198. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/ui/Spinner.tsx +14 -0
  199. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/ui/tokens.ts +37 -0
  200. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/config/bookSections.ts +62 -0
  201. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/config/emailScenarios.ts +22 -0
  202. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/config/steps.ts +46 -0
  203. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/index.ts +11 -0
  204. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/lib/cn.ts +4 -0
  205. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/lib/format.ts +9 -0
  206. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/lib/id.ts +11 -0
  207. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/agentEvalService.ts +30 -0
  208. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/agentTestService.ts +69 -0
  209. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/bookService.ts +21 -0
  210. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/createManGoAgentSource.ts +107 -0
  211. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/draftService.ts +45 -0
  212. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/uploadService.ts +27 -0
  213. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/state/OnboardingProvider.tsx +121 -0
  214. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/types.ts +52 -0
  215. package/apps/agents-server/src/components/NewAgentDialog/NewAgentDialog.tsx +7 -3
  216. package/apps/agents-server/src/components/NewAgentDialog/NewAgentWizardKnowledgeStep.tsx +6 -0
  217. package/apps/agents-server/src/components/NewAgentDialog/createNewAgentWizardSource.ts +1 -1
  218. package/apps/agents-server/src/components/NewAgentDialog/trackNewAgentCreationEvent.ts +1 -1
  219. package/apps/agents-server/src/components/NewAgentDialog/useNewAgentDialog.tsx +113 -14
  220. package/apps/agents-server/src/components/NewAgentDialog/useNewAgentWizardKnowledgeState.ts +8 -1
  221. package/apps/agents-server/src/components/PrintHeader/PrintHeader.tsx +4 -2
  222. package/apps/agents-server/src/components/Skeleton/ConsolePageLoadingSkeleton.tsx +1 -1
  223. package/apps/agents-server/src/components/Skeleton/DocumentationRouteLoadingSkeleton.tsx +1 -1
  224. package/apps/agents-server/src/components/Skeleton/HomepageLoadingSkeleton.tsx +1 -1
  225. package/apps/agents-server/src/components/UsersList/UsersList.tsx +24 -6
  226. package/apps/agents-server/src/components/UsersList/useUsersAdmin.ts +2 -7
  227. package/apps/agents-server/src/constants/defaultAgentAvatarVisual.ts +1 -1
  228. package/apps/agents-server/src/constants/newAgentWizard.ts +17 -8
  229. package/apps/agents-server/src/constants/serverLimits.ts +22 -2
  230. package/apps/agents-server/src/constants/shibbolethAuth.ts +139 -0
  231. package/apps/agents-server/src/database/$provideClientSql.ts +37 -0
  232. package/apps/agents-server/src/database/$provideSupabaseForServer.ts +41 -0
  233. package/apps/agents-server/src/database/customJavascript.ts +62 -1
  234. package/apps/agents-server/src/database/customStylesheet.ts +60 -1
  235. package/apps/agents-server/src/database/getMetadata.ts +121 -4
  236. package/apps/agents-server/src/database/loadAgentsServerEnvFile.ts +29 -0
  237. package/apps/agents-server/src/database/metadataDefaults.ts +85 -31
  238. package/apps/agents-server/src/database/migrate.ts +8 -2
  239. package/apps/agents-server/src/database/migrations/2026-06-0100-shibboleth-auth.sql +136 -0
  240. package/apps/agents-server/src/database/migrations/2026-06-0200-default-agent-avatar-visual-octopus3d3.sql +16 -0
  241. package/apps/agents-server/src/database/migrations/2026-06-1300-user-chat-active-read-indexes.sql +7 -0
  242. package/apps/agents-server/src/database/migrations/2026-06-2200-new-agent-wizard-metadata-key.sql +27 -0
  243. package/apps/agents-server/src/database/migrations/2026-06-2201-new-agent-wizard-mango-default.sql +11 -0
  244. package/apps/agents-server/src/database/migrations/2026-06-2600-agent-directory-performance-indexes.sql +14 -0
  245. package/apps/agents-server/src/database/migrations/2026-06-2700-default-agent-avatar-visual-octopus3d4.sql +16 -0
  246. package/apps/agents-server/src/database/seedCoreAgents.ts +236 -0
  247. package/apps/agents-server/src/database/seedDefaultAgents.ts +225 -0
  248. package/apps/agents-server/src/database/sqlite/$provideLocalSqliteSupabase.ts +234 -41
  249. package/apps/agents-server/src/generated/reservedPaths.ts +3 -0
  250. package/apps/agents-server/src/instrumentation-client.ts +28 -0
  251. package/apps/agents-server/src/instrumentation.ts +19 -0
  252. package/apps/agents-server/src/languages/ServerTranslationKeys.ts +4 -0
  253. package/apps/agents-server/src/languages/translations/czech.yaml +5 -1
  254. package/apps/agents-server/src/languages/translations/english.yaml +5 -1
  255. package/apps/agents-server/src/message-providers/email/sendgrid/verifySendgridInboundParseWebhook.ts +345 -0
  256. package/apps/agents-server/src/middleware/applyEmbeddingHeader.ts +4 -2
  257. package/apps/agents-server/src/middleware/contentSecurityPolicy.ts +97 -0
  258. package/apps/agents-server/src/middleware/resolveAccessControlResponse.ts +3 -2
  259. package/apps/agents-server/src/middleware/resolveMiddlewareResponse.ts +8 -3
  260. package/apps/agents-server/src/middleware.ts +15 -32
  261. package/apps/agents-server/src/search/createDefaultServerSearchProviders/createFederatedAgentsSearchProvider.ts +1 -1
  262. package/apps/agents-server/src/sentry.edge.config.ts +18 -0
  263. package/apps/agents-server/src/sentry.server.config.ts +19 -0
  264. package/apps/agents-server/src/tools/$provideAgentCollectionForServer.ts +2 -9
  265. package/apps/agents-server/src/tools/$provideCdnForServer.ts +187 -15
  266. package/apps/agents-server/src/tools/BrowserConnectionProvider.ts +2 -19
  267. package/apps/agents-server/src/tools/createAgentProgressTools.ts +8 -4
  268. package/apps/agents-server/src/tools/createChatAttachmentToolFunctions.ts +8 -4
  269. package/apps/agents-server/src/tools/createServerChromiumLaunchOptions.ts +44 -0
  270. package/apps/agents-server/src/utils/agentOwnership.ts +54 -5
  271. package/apps/agents-server/src/utils/agentRouting/resolveAgentRouteTarget.ts +101 -19
  272. package/apps/agents-server/src/utils/agentsTransfer/createAgentsExportZipStream.ts +81 -0
  273. package/apps/agents-server/src/utils/agentsTransfer/importAgentsFromFiles.ts +852 -0
  274. package/apps/agents-server/src/utils/assertSafeUrl.ts +136 -0
  275. package/apps/agents-server/src/utils/authenticateUser.ts +112 -4
  276. package/apps/agents-server/src/utils/authenticationAttemptRateLimit.ts +504 -0
  277. package/apps/agents-server/src/utils/backup/createBooksBackupZipStream.ts +91 -7
  278. package/apps/agents-server/src/utils/cdn/classes/DigitalOceanSpaces.ts +48 -4
  279. package/apps/agents-server/src/utils/cdn/classes/TrackedFilesStorage.ts +6 -5
  280. package/apps/agents-server/src/utils/cdn/interfaces/IFilesStorage.ts +5 -0
  281. package/apps/agents-server/src/utils/cdn/utils/getUserFileCdnKey.ts +10 -3
  282. package/apps/agents-server/src/utils/chat/resolveAgentsServerCitationLabel.ts +130 -0
  283. package/apps/agents-server/src/utils/chat/resolveCitationSourceLabel.ts +436 -0
  284. package/apps/agents-server/src/utils/chatExport/renderHtmlToPdfOnServer.ts +66 -17
  285. package/apps/agents-server/src/utils/chatExport/sanitizeChatPdfExportHtml.ts +193 -0
  286. package/apps/agents-server/src/utils/codeRunnerConfiguration.ts +1 -1
  287. package/apps/agents-server/src/utils/createAdminTerminalRouteHandlers.ts +264 -0
  288. package/apps/agents-server/src/utils/currentUserIdentity.ts +22 -9
  289. package/apps/agents-server/src/utils/defaultAgents/loadDefaultAgentBooks.ts +145 -0
  290. package/apps/agents-server/src/utils/errorReporting/agentsServerSentryContext.ts +203 -0
  291. package/apps/agents-server/src/utils/errorReporting/applicationErrorHandling.ts +45 -0
  292. package/apps/agents-server/src/utils/errorReporting/refreshApplicationDocument.ts +10 -0
  293. package/apps/agents-server/src/utils/errorReporting/registerServerErrorSentryLogging.ts +381 -0
  294. package/apps/agents-server/src/utils/errorReporting/sendApplicationErrorReportToSentry.ts +43 -152
  295. package/apps/agents-server/src/utils/errorReporting/sentrySdkConfig.ts +237 -0
  296. package/apps/agents-server/src/utils/errorReporting/sentryStore.ts +187 -0
  297. package/apps/agents-server/src/utils/externalChatRunner/createExternalAgentRepositoryFiles.ts +2 -2
  298. package/apps/agents-server/src/utils/externalChatRunner/processExternalUserChatJob.ts +22 -7
  299. package/apps/agents-server/src/utils/findAgentForCallerWriteAccess.ts +36 -0
  300. package/apps/agents-server/src/utils/getCurrentUser.ts +2 -1
  301. package/apps/agents-server/src/utils/getFederatedServers.ts +3 -74
  302. package/apps/agents-server/src/utils/getUserById.ts +19 -5
  303. package/apps/agents-server/src/utils/getWellKnownAgentUrl.ts +10 -4
  304. package/apps/agents-server/src/utils/iframe/checkIfUrlCanBeEmbedded.ts +68 -0
  305. package/apps/agents-server/src/utils/interactiveTerminalSession.ts +9 -4
  306. package/apps/agents-server/src/utils/isAdminPasswordEqual.ts +28 -0
  307. package/apps/agents-server/src/utils/isUserGlobalAdmin.ts +3 -1
  308. package/apps/agents-server/src/utils/knowledge/createInlineKnowledgeSourceUploader.ts +24 -5
  309. package/apps/agents-server/src/utils/knowledge/resolveWebsiteKnowledgeSourcesForServer.ts +10 -1
  310. package/apps/agents-server/src/utils/localChatRunner/processLocalUserChatJob.ts +23 -8
  311. package/apps/agents-server/src/utils/localization/formatServerLanguageHumanReadableDate.ts +70 -0
  312. package/apps/agents-server/src/utils/localization/getRequestServerLanguage.ts +32 -0
  313. package/apps/agents-server/src/utils/metadataConfigurationTransfer.ts +442 -0
  314. package/apps/agents-server/src/utils/paidApiRequestGuard.ts +241 -0
  315. package/apps/agents-server/src/utils/publicUser.ts +59 -0
  316. package/apps/agents-server/src/utils/serverLimits.ts +26 -1
  317. package/apps/agents-server/src/utils/serverManagement/createManagedServer/bootstrapManagedServer.ts +5 -6
  318. package/apps/agents-server/src/utils/serverManagement/createManagedServer/normalizeCreateServerInput.ts +6 -0
  319. package/apps/agents-server/src/utils/serverManagement/createManagedServer/seedServerCoreAgents.ts +162 -0
  320. package/apps/agents-server/src/utils/serverManagement/createManagedServer/seedServerDefaultAgents.ts +8 -88
  321. package/apps/agents-server/src/utils/serverManagement/createManagedServer.ts +5 -0
  322. package/apps/agents-server/src/utils/session.ts +72 -30
  323. package/apps/agents-server/src/utils/shareTargetPayloads.ts +37 -66
  324. package/apps/agents-server/src/utils/shibbolethAuthentication.ts +957 -0
  325. package/apps/agents-server/src/utils/transpilers/resolveTranspiledTeamExport.ts +10 -10
  326. package/apps/agents-server/src/utils/upload/createBookEditorUploadHandler.ts +19 -28
  327. package/apps/agents-server/src/utils/upload/fileUploadAvailability.ts +91 -0
  328. package/apps/agents-server/src/utils/upload/uploadFileToServer.ts +157 -0
  329. package/apps/agents-server/src/utils/userChat/createImmediateUserChatAnswerModelRequirements.ts +26 -12
  330. package/apps/agents-server/src/utils/userChat/createRunUserChatJobExecutionContext.ts +45 -0
  331. package/apps/agents-server/src/utils/userChat/createRunUserChatJobPersistenceController.ts +17 -11
  332. package/apps/agents-server/src/utils/userChat/createUserChatDetailPayload.ts +33 -18
  333. package/apps/agents-server/src/utils/userChat/createUserChatHarnessProgressCard.ts +99 -0
  334. package/apps/agents-server/src/utils/userChat/createUserChatRunnerProgressCard.ts +63 -0
  335. package/apps/agents-server/src/utils/userChat/hasPotentiallyPendingAssistantMessages.ts +26 -0
  336. package/apps/agents-server/src/utils/userChat/listUserChats.ts +117 -6
  337. package/apps/agents-server/src/utils/userChat/persistUserChatJobProgressCard.ts +40 -0
  338. package/apps/agents-server/src/utils/userChat/resolveUserChatProgressToolHighlights.ts +100 -0
  339. package/apps/agents-server/src/utils/userChat/resolveUserChatWorkerInternalToken.ts +63 -9
  340. package/apps/agents-server/src/utils/userChat/runImmediateUserChatAnswer.ts +1 -1
  341. package/apps/agents-server/src/utils/userChat/runUserChatJob.ts +30 -0
  342. package/apps/agents-server/src/utils/userChat/triggerUserChatJobWorker.ts +54 -19
  343. package/apps/agents-server/src/utils/userChat/userChatMessageLifecycle.ts +0 -1
  344. package/apps/agents-server/src/utils/userChat/userChatProgressCard.ts +366 -0
  345. package/apps/agents-server/src/utils/validateApiKey.ts +7 -3
  346. package/apps/agents-server/src/utils/vpsConfiguration.ts +8 -1
  347. package/apps/agents-server/src/utils/vpsSelfUpdate.ts +816 -59
  348. package/esm/apps/agents-server/src/constants/federatedAgentImport.d.ts +42 -0
  349. package/esm/apps/agents-server/src/constants/serverLimits.d.ts +207 -0
  350. package/esm/apps/agents-server/src/constants/toolUsageLimits.d.ts +55 -0
  351. package/esm/index.es.js +23985 -18820
  352. package/esm/index.es.js.map +1 -1
  353. package/esm/scripts/run-agent-chat/executeAgentChatTurn.d.ts +28 -0
  354. package/esm/scripts/run-agent-chat/runAgentChat.d.ts +5 -0
  355. package/esm/scripts/run-agent-chat/runAgentExec.d.ts +11 -0
  356. package/esm/scripts/run-agent-messages/main/AgentMessageFailureTracker.d.ts +27 -0
  357. package/esm/scripts/run-agent-messages/main/handleAgentWatchError.d.ts +4 -0
  358. package/esm/scripts/run-agent-messages/main/runAgentMessages.d.ts +1 -0
  359. package/esm/scripts/run-agent-messages/messages/createAgentRunnerSystemMessage.d.ts +10 -0
  360. package/esm/scripts/run-agent-messages/messages/moveAgentMessageToFailed.d.ts +17 -0
  361. package/esm/scripts/run-codex-prompts/common/buildCoderRunProgressSnapshot.d.ts +5 -1
  362. package/esm/scripts/run-codex-prompts/common/cliProgressDisplay.d.ts +7 -0
  363. package/esm/scripts/run-codex-prompts/common/coderRunEstimateCache.d.ts +31 -0
  364. package/esm/scripts/run-codex-prompts/common/parseDuration.d.ts +19 -0
  365. package/esm/scripts/run-codex-prompts/common/progressFormatting.d.ts +2 -0
  366. package/esm/scripts/run-codex-prompts/common/resolveAgentSystemMessage.d.ts +6 -0
  367. package/esm/scripts/run-codex-prompts/common/resolveInlineOrFileText.d.ts +14 -0
  368. package/esm/scripts/run-codex-prompts/common/runGoScript/printLiveScriptChunk.d.ts +4 -0
  369. package/esm/scripts/run-codex-prompts/common/sleepWithCountdown.d.ts +27 -0
  370. package/esm/scripts/run-codex-prompts/common/waitForPause.d.ts +12 -0
  371. package/esm/scripts/run-codex-prompts/git/commitChanges.d.ts +3 -1
  372. package/esm/scripts/run-codex-prompts/main/findUnwrittenPrompts.d.ts +19 -0
  373. package/esm/scripts/run-codex-prompts/main/runCodexPromptsServer.d.ts +27 -0
  374. package/esm/scripts/run-codex-prompts/main/runPromptRound.d.ts +5 -3
  375. package/esm/scripts/run-codex-prompts/runners/claude-code/ClaudeCodeRunner.d.ts +3 -1
  376. package/esm/scripts/run-codex-prompts/server/buildCoderServerPromptResponse.d.ts +50 -0
  377. package/esm/scripts/run-codex-prompts/server/buildCoderServerRunState.d.ts +23 -0
  378. package/esm/scripts/run-codex-prompts/server/coderServerHtml.d.ts +9 -0
  379. package/esm/scripts/run-codex-prompts/server/runCoderHttpServer.d.ts +35 -0
  380. package/esm/scripts/run-codex-prompts/server/updatePromptSection.d.ts +9 -0
  381. package/esm/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +8 -0
  382. package/esm/scripts/run-codex-prompts/ui/buildCoderRunUiFrame.d.ts +1 -0
  383. package/esm/scripts/run-codex-prompts/ui/buildRunUiFrameShared.d.ts +5 -1
  384. package/esm/scripts/run-codex-prompts/ui/renderCoderRunUi.d.ts +1 -0
  385. package/esm/src/_packages/components.index.d.ts +4 -0
  386. package/esm/src/_packages/core.index.d.ts +0 -2
  387. package/esm/src/_packages/node.index.d.ts +40 -0
  388. package/esm/src/_packages/types.index.d.ts +18 -0
  389. package/esm/src/avatars/avatarAnimationScheduler.d.ts +4 -0
  390. package/esm/src/avatars/types/AvatarVisualDefinition.d.ts +1 -1
  391. package/esm/src/avatars/visuals/octopus3d3AvatarVisual.d.ts +7 -0
  392. package/esm/src/avatars/visuals/octopus3d4AvatarVisual.d.ts +7 -0
  393. package/esm/src/book-3.0/BookNodeAgentSource.d.ts +38 -0
  394. package/esm/src/book-3.0/CliAgent.d.ts +66 -0
  395. package/esm/src/book-3.0/CliAgent.test.d.ts +1 -0
  396. package/esm/src/book-3.0/LiteAgent.d.ts +68 -0
  397. package/esm/src/book-3.0/LiteAgent.test.d.ts +1 -0
  398. package/esm/src/book-3.0/agentFolderPaths.d.ts +30 -0
  399. package/esm/src/book-3.0/cliAgentEnv.d.ts +33 -0
  400. package/esm/src/book-components/BookEditor/BookEditor.d.ts +6 -5
  401. package/esm/src/book-components/BookEditor/BookEditorAboutPromptbookInformation.d.ts +12 -0
  402. package/esm/src/book-components/BookEditor/BookEditorBrowserConfig.d.ts +2 -0
  403. package/esm/src/book-components/BookEditor/BookEditorForClient.d.ts +7 -0
  404. package/esm/src/book-components/BookEditor/BookEditorMonacoTokenization.d.ts +1 -0
  405. package/esm/src/book-components/BookEditor/BookEditorTheme.d.ts +24 -0
  406. package/esm/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +9 -0
  407. package/esm/src/book-components/BookEditor/useBookEditorMonacoLanguage.d.ts +1 -6
  408. package/esm/src/book-components/BookEditor/useBookEditorMonacoLifecycle.d.ts +1 -4
  409. package/esm/src/book-components/BookEditor/useBookEditorMonacoStyles.d.ts +2 -1
  410. package/esm/src/book-components/Chat/Chat/ChatCitationModal.d.ts +2 -0
  411. package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
  412. package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +4 -0
  413. package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
  414. package/esm/src/book-components/Chat/Chat/ChatToolCallModal.d.ts +2 -0
  415. package/esm/src/book-components/Chat/Chat/ChatToolCallModalContent.d.ts +3 -1
  416. package/esm/src/book-components/Chat/Chat/CitationIframePreview.d.ts +20 -0
  417. package/esm/src/book-components/Chat/Chat/TeamToolCallModalContent.d.ts +2 -0
  418. package/esm/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +1 -0
  419. package/esm/src/book-components/Chat/SourceChip/SourceChip.d.ts +6 -1
  420. package/esm/src/book-components/Chat/hooks/useResolvedCitationLabel.d.ts +12 -0
  421. package/esm/src/book-components/Chat/types/ChatMessage.d.ts +4 -0
  422. package/esm/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
  423. package/esm/src/book-components/Chat/types/CitationLabelResolver.d.ts +8 -0
  424. package/esm/src/book-components/Chat/utils/citationHelpers.d.ts +9 -0
  425. package/esm/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.d.ts +14 -0
  426. package/esm/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.test.d.ts +1 -0
  427. package/esm/src/book-components/Chat/utils/isVisibleChatToolCall.d.ts +10 -0
  428. package/esm/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +4 -0
  429. package/esm/src/book-components/_common/Dropdown/Dropdown.d.ts +1 -1
  430. package/esm/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +1 -1
  431. package/esm/src/book-components/_common/Modal/Modal.d.ts +1 -1
  432. package/esm/src/book-components/icons/AboutIcon.d.ts +1 -1
  433. package/esm/src/book-components/icons/DownloadIcon.d.ts +1 -1
  434. package/esm/src/book-components/icons/ExitFullscreenIcon.d.ts +1 -1
  435. package/esm/src/book-components/icons/FullscreenIcon.d.ts +1 -1
  436. package/esm/src/cli/cli-commands/agent/agentCliOptions.d.ts +38 -0
  437. package/esm/src/cli/cli-commands/agent/chat.d.ts +10 -0
  438. package/esm/src/cli/cli-commands/agent/exec.d.ts +10 -0
  439. package/esm/src/cli/cli-commands/agent/run.test.d.ts +1 -0
  440. package/esm/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +2 -24
  441. package/esm/src/cli/cli-commands/agent.d.ts +14 -0
  442. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer.d.ts +17 -1
  443. package/esm/src/cli/cli-commands/agents-server/run.d.ts +6 -0
  444. package/esm/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +9 -2
  445. package/esm/src/cli/cli-commands/coder/ThinkingLevel.d.ts +1 -1
  446. package/esm/src/cli/cli-commands/coder/ensureCoderDeveloperAgentFile.d.ts +25 -0
  447. package/esm/src/cli/cli-commands/coder/find-unwritten.d.ts +10 -0
  448. package/esm/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +2 -0
  449. package/esm/src/cli/cli-commands/coder/server.d.ts +13 -0
  450. package/esm/src/cli/cli-commands/coder/waitOptions.d.ts +14 -0
  451. package/esm/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +9 -25
  452. package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +22 -0
  453. package/esm/src/commitments/_common/teamInternalAgentAccess.d.ts +9 -1
  454. package/esm/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
  455. package/esm/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -1
  456. package/esm/src/scrapers/website/utils/createShowdownConverter.d.ts +2 -2
  457. package/esm/src/utils/isTimingSafeEqualString.d.ts +25 -0
  458. package/esm/src/utils/validators/url/isValidAgentUrl.d.ts +5 -0
  459. package/esm/src/version.d.ts +1 -1
  460. package/package.json +6 -1
  461. package/servers.ts +1 -16
  462. package/src/_packages/components.index.ts +4 -0
  463. package/src/_packages/core.index.ts +0 -2
  464. package/src/_packages/node.index.ts +40 -0
  465. package/src/_packages/types.index.ts +18 -0
  466. package/src/avatars/avatarAnimationScheduler.ts +76 -4
  467. package/src/avatars/types/AvatarVisualDefinition.ts +2 -0
  468. package/src/avatars/visuals/avatarVisualRegistry.ts +4 -0
  469. package/src/avatars/visuals/fractalAvatarVisual.ts +5 -4
  470. package/src/avatars/visuals/minecraft2AvatarVisual.ts +16 -11
  471. package/src/avatars/visuals/minecraftAvatarVisual.ts +21 -7
  472. package/src/avatars/visuals/octopus3d2AvatarVisual.ts +175 -38
  473. package/src/avatars/visuals/octopus3d3AvatarVisual.ts +1068 -0
  474. package/src/avatars/visuals/octopus3d4AvatarVisual.ts +1295 -0
  475. package/src/avatars/visuals/octopus3dAvatarVisual.ts +69 -17
  476. package/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments/augmentAgentModelRequirementsFromSource.ts +18 -2
  477. package/src/book-2.0/book-language-documentation/renderGroupedCommitmentDocumentationMarkdown.ts +7 -1
  478. package/src/book-3.0/Book.ts +3 -1
  479. package/src/book-3.0/BookNodeAgentSource.ts +135 -0
  480. package/src/book-3.0/CliAgent.ts +252 -0
  481. package/src/book-3.0/LiteAgent.ts +468 -0
  482. package/src/book-3.0/agentFolderPaths.ts +38 -0
  483. package/src/book-3.0/cliAgentEnv.ts +46 -0
  484. package/src/book-components/BookEditor/BookEditor.module.css +61 -0
  485. package/src/book-components/BookEditor/BookEditor.tsx +16 -13
  486. package/src/book-components/BookEditor/BookEditorAboutPromptbookInformation.tsx +72 -0
  487. package/src/book-components/BookEditor/BookEditorActionbar.tsx +35 -5
  488. package/src/book-components/BookEditor/BookEditorBrowserConfig.ts +11 -0
  489. package/src/book-components/BookEditor/BookEditorForClient.tsx +33 -0
  490. package/src/book-components/BookEditor/BookEditorMonaco.tsx +4 -2
  491. package/src/book-components/BookEditor/BookEditorMonacoTokenization.ts +78 -27
  492. package/src/book-components/BookEditor/BookEditorTheme.ts +32 -0
  493. package/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.ts +11 -0
  494. package/src/book-components/BookEditor/useBookEditorMonacoLanguage.ts +55 -89
  495. package/src/book-components/BookEditor/useBookEditorMonacoLifecycle.ts +1 -5
  496. package/src/book-components/BookEditor/useBookEditorMonacoStyles.ts +3 -2
  497. package/src/book-components/BookEditor/useBookEditorMonacoUploads.ts +1 -1
  498. package/src/book-components/Chat/Chat/Chat.module.css +50 -0
  499. package/src/book-components/Chat/Chat/Chat.tsx +4 -0
  500. package/src/book-components/Chat/Chat/ChatCitationModal.tsx +19 -5
  501. package/src/book-components/Chat/Chat/ChatMessageItem.tsx +22 -2
  502. package/src/book-components/Chat/Chat/ChatMessageList.tsx +6 -0
  503. package/src/book-components/Chat/Chat/ChatProps.tsx +6 -0
  504. package/src/book-components/Chat/Chat/ChatToolCallModal.tsx +4 -0
  505. package/src/book-components/Chat/Chat/ChatToolCallModalContent.tsx +4 -0
  506. package/src/book-components/Chat/Chat/CitationIframePreview.tsx +78 -0
  507. package/src/book-components/Chat/Chat/TeamToolCallModalContent.tsx +16 -3
  508. package/src/book-components/Chat/Chat/createChatMessageToolCallRenderModel.ts +2 -9
  509. package/src/book-components/Chat/Chat/useChatPostprocessedMessages.ts +13 -2
  510. package/src/book-components/Chat/MarkdownContent/MarkdownContent.tsx +63 -4
  511. package/src/book-components/Chat/SourceChip/SourceChip.module.css +8 -0
  512. package/src/book-components/Chat/SourceChip/SourceChip.tsx +19 -5
  513. package/src/book-components/Chat/hooks/useResolvedCitationLabel.ts +65 -0
  514. package/src/book-components/Chat/save/html/htmlSaveFormatDefinition.ts +315 -88
  515. package/src/book-components/Chat/save/react/reactSaveFormatDefinition.ts +7 -1
  516. package/src/book-components/Chat/types/ChatMessage.ts +5 -0
  517. package/src/book-components/Chat/types/ChatParticipant.ts +1 -1
  518. package/src/book-components/Chat/types/CitationLabelResolver.ts +9 -0
  519. package/src/book-components/Chat/utils/citationHelpers.ts +90 -2
  520. package/src/book-components/Chat/utils/createCitationFootnoteRenderModel.ts +3 -0
  521. package/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.ts +178 -0
  522. package/src/book-components/Chat/utils/isVisibleChatToolCall.ts +23 -0
  523. package/src/book-components/Chat/utils/parseCitationsFromContent.ts +6 -0
  524. package/src/book-components/Chat/utils/renderMarkdown.ts +3 -2
  525. package/src/book-components/_common/Dropdown/Dropdown.tsx +1 -1
  526. package/src/book-components/_common/MenuHoisting/MenuHoistingContext.tsx +1 -1
  527. package/src/book-components/_common/Modal/Modal.tsx +1 -1
  528. package/src/book-components/icons/AboutIcon.tsx +1 -1
  529. package/src/book-components/icons/DownloadIcon.tsx +1 -1
  530. package/src/book-components/icons/ExitFullscreenIcon.tsx +1 -1
  531. package/src/book-components/icons/FullscreenIcon.tsx +1 -1
  532. package/src/cli/cli-commands/agent/agentCliOptions.ts +92 -0
  533. package/src/cli/cli-commands/agent/chat.ts +54 -0
  534. package/src/cli/cli-commands/agent/exec.ts +60 -0
  535. package/src/cli/cli-commands/agent-folder/agentProjectPaths.ts +15 -28
  536. package/src/cli/cli-commands/agent.ts +44 -0
  537. package/src/cli/cli-commands/agents-server/buildAgentsServer.ts +188 -24
  538. package/src/cli/cli-commands/agents-server/ensureAgentsServerEnvFile.ts +15 -2
  539. package/src/cli/cli-commands/agents-server/run.ts +103 -31
  540. package/src/cli/cli-commands/agents-server/startAgentsServer.ts +250 -41
  541. package/src/cli/cli-commands/agents-server.ts +7 -1
  542. package/src/cli/cli-commands/coder/ThinkingLevel.ts +3 -1
  543. package/src/cli/cli-commands/coder/agentCodingFile.ts +1 -1
  544. package/src/cli/cli-commands/coder/ensureCoderDeveloperAgentFile.ts +79 -0
  545. package/src/cli/cli-commands/coder/find-unwritten.ts +58 -0
  546. package/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.ts +2 -2
  547. package/src/cli/cli-commands/coder/init.ts +6 -1
  548. package/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.ts +10 -0
  549. package/src/cli/cli-commands/coder/printInitializationSummary.ts +3 -0
  550. package/src/cli/cli-commands/coder/run.ts +78 -13
  551. package/src/cli/cli-commands/coder/server.ts +259 -0
  552. package/src/cli/cli-commands/coder/waitOptions.ts +24 -0
  553. package/src/cli/cli-commands/coder.ts +6 -0
  554. package/src/cli/cli-commands/common/promptRunnerCliOptions.ts +33 -49
  555. package/src/cli/common/$deprecateCliCommand.ts +10 -1
  556. package/src/cli/promptbookCli.ts +2 -0
  557. package/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.ts +91 -14
  558. package/src/commands/KNOWLEDGE/utils/knowledgeSourceContentToName.ts +2 -2
  559. package/src/commitments/GOAL/GOAL.ts +7 -2
  560. package/src/commitments/LANGUAGE/LANGUAGE.ts +7 -2
  561. package/src/commitments/TEAM/TEAM.ts +12 -1
  562. package/src/commitments/USE_PROJECT/createUseProjectToolFunctions.ts +8 -1
  563. package/src/commitments/_common/teamInternalAgentAccess.ts +14 -8
  564. package/src/execution/createPipelineExecutor/getKnowledgeForTask.ts +1 -1
  565. package/src/formats/csv/CsvFormatParser.ts +4 -4
  566. package/src/formats/csv/utils/csvParse.ts +2 -2
  567. package/src/import-plugins/JsonFileImportPlugin.ts +15 -2
  568. package/src/import-plugins/TextFileImportPlugin.ts +8 -1
  569. package/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.ts +1 -1
  570. package/src/llm-providers/_common/register/$provideLlmToolsFromEnv.ts +1 -1
  571. package/src/llm-providers/_common/register/$registeredLlmToolsMessage.ts +6 -1
  572. package/src/llm-providers/agent/AgentLlmExecutionTools.ts +2 -2
  573. package/src/llm-providers/agent/AgentLlmExecutionToolsAgentKitRunner.ts +2 -2
  574. package/src/llm-providers/agent/AgentLlmExecutionToolsOpenAiAssistantRunner.ts +2 -2
  575. package/src/llm-providers/anthropic-claude/register-configuration.ts +6 -3
  576. package/src/llm-providers/openai/OpenAiAgentKitExecutionToolsToolBuilder.ts +3 -1
  577. package/src/llm-providers/openai/OpenAiAssistantExecutionToolsToolRunner.ts +1 -1
  578. package/src/llm-providers/openai/OpenAiVectorStoreKnowledgeSourcePreparer.ts +1 -1
  579. package/src/other/templates/getTemplatesPipelineCollection.ts +741 -788
  580. package/src/scrapers/_common/utils/getScraperIntermediateSource.ts +2 -2
  581. package/src/scrapers/website/WebsiteScraper.ts +1 -1
  582. package/src/scrapers/website/utils/createShowdownConverter.ts +2 -2
  583. package/src/scripting/javascript/JavascriptEvalExecutionTools.ts +1 -1
  584. package/src/utils/agents/resolveAgentAvatarImageUrl.ts +1 -1
  585. package/src/utils/chat/chatAttachments/resolveChatAttachmentContent.ts +8 -1
  586. package/src/utils/isTimingSafeEqualString.ts +43 -0
  587. package/src/utils/misc/computeHash.ts +2 -2
  588. package/src/utils/random/$randomToken.ts +2 -2
  589. package/src/utils/validators/url/isValidAgentUrl.ts +5 -7
  590. package/src/version.ts +2 -2
  591. package/src/versions.txt +32 -0
  592. package/umd/apps/agents-server/src/constants/federatedAgentImport.d.ts +42 -0
  593. package/umd/apps/agents-server/src/constants/serverLimits.d.ts +207 -0
  594. package/umd/apps/agents-server/src/constants/toolUsageLimits.d.ts +55 -0
  595. package/umd/index.umd.js +23723 -18556
  596. package/umd/index.umd.js.map +1 -1
  597. package/umd/scripts/run-agent-chat/executeAgentChatTurn.d.ts +28 -0
  598. package/umd/scripts/run-agent-chat/runAgentChat.d.ts +5 -0
  599. package/umd/scripts/run-agent-chat/runAgentExec.d.ts +11 -0
  600. package/umd/scripts/run-agent-messages/main/AgentMessageFailureTracker.d.ts +27 -0
  601. package/umd/scripts/run-agent-messages/main/handleAgentWatchError.d.ts +4 -0
  602. package/umd/scripts/run-agent-messages/main/runAgentMessages.d.ts +1 -0
  603. package/umd/scripts/run-agent-messages/messages/createAgentRunnerSystemMessage.d.ts +10 -0
  604. package/umd/scripts/run-agent-messages/messages/moveAgentMessageToFailed.d.ts +17 -0
  605. package/umd/scripts/run-codex-prompts/common/buildCoderRunProgressSnapshot.d.ts +5 -1
  606. package/umd/scripts/run-codex-prompts/common/cliProgressDisplay.d.ts +7 -0
  607. package/umd/scripts/run-codex-prompts/common/coderRunEstimateCache.d.ts +31 -0
  608. package/umd/scripts/run-codex-prompts/common/parseDuration.d.ts +19 -0
  609. package/umd/scripts/run-codex-prompts/common/progressFormatting.d.ts +2 -0
  610. package/umd/scripts/run-codex-prompts/common/resolveAgentSystemMessage.d.ts +6 -0
  611. package/umd/scripts/run-codex-prompts/common/resolveInlineOrFileText.d.ts +14 -0
  612. package/umd/scripts/run-codex-prompts/common/runGoScript/printLiveScriptChunk.d.ts +4 -0
  613. package/umd/scripts/run-codex-prompts/common/sleepWithCountdown.d.ts +27 -0
  614. package/umd/scripts/run-codex-prompts/common/waitForPause.d.ts +12 -0
  615. package/umd/scripts/run-codex-prompts/git/commitChanges.d.ts +3 -1
  616. package/umd/scripts/run-codex-prompts/main/findUnwrittenPrompts.d.ts +19 -0
  617. package/umd/scripts/run-codex-prompts/main/runCodexPromptsServer.d.ts +27 -0
  618. package/umd/scripts/run-codex-prompts/main/runPromptRound.d.ts +5 -3
  619. package/umd/scripts/run-codex-prompts/runners/claude-code/ClaudeCodeRunner.d.ts +3 -1
  620. package/umd/scripts/run-codex-prompts/server/buildCoderServerPromptResponse.d.ts +50 -0
  621. package/umd/scripts/run-codex-prompts/server/buildCoderServerRunState.d.ts +23 -0
  622. package/umd/scripts/run-codex-prompts/server/coderServerHtml.d.ts +9 -0
  623. package/umd/scripts/run-codex-prompts/server/runCoderHttpServer.d.ts +35 -0
  624. package/umd/scripts/run-codex-prompts/server/updatePromptSection.d.ts +9 -0
  625. package/umd/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +8 -0
  626. package/umd/scripts/run-codex-prompts/ui/buildCoderRunUiFrame.d.ts +1 -0
  627. package/umd/scripts/run-codex-prompts/ui/buildRunUiFrameShared.d.ts +5 -1
  628. package/umd/scripts/run-codex-prompts/ui/renderCoderRunUi.d.ts +1 -0
  629. package/umd/src/_packages/components.index.d.ts +4 -0
  630. package/umd/src/_packages/core.index.d.ts +0 -2
  631. package/umd/src/_packages/node.index.d.ts +40 -0
  632. package/umd/src/_packages/types.index.d.ts +18 -0
  633. package/umd/src/avatars/avatarAnimationScheduler.d.ts +4 -0
  634. package/umd/src/avatars/types/AvatarVisualDefinition.d.ts +1 -1
  635. package/umd/src/avatars/visuals/octopus3d3AvatarVisual.d.ts +7 -0
  636. package/umd/src/avatars/visuals/octopus3d4AvatarVisual.d.ts +7 -0
  637. package/umd/src/book-3.0/BookNodeAgentSource.d.ts +38 -0
  638. package/umd/src/book-3.0/CliAgent.d.ts +66 -0
  639. package/umd/src/book-3.0/CliAgent.test.d.ts +1 -0
  640. package/umd/src/book-3.0/LiteAgent.d.ts +68 -0
  641. package/umd/src/book-3.0/LiteAgent.test.d.ts +1 -0
  642. package/umd/src/book-3.0/agentFolderPaths.d.ts +30 -0
  643. package/umd/src/book-3.0/cliAgentEnv.d.ts +33 -0
  644. package/umd/src/book-components/BookEditor/BookEditor.d.ts +6 -5
  645. package/umd/src/book-components/BookEditor/BookEditorAboutPromptbookInformation.d.ts +12 -0
  646. package/umd/src/book-components/BookEditor/BookEditorBrowserConfig.d.ts +2 -0
  647. package/umd/src/book-components/BookEditor/BookEditorForClient.d.ts +7 -0
  648. package/umd/src/book-components/BookEditor/BookEditorMonacoTokenization.d.ts +1 -0
  649. package/umd/src/book-components/BookEditor/BookEditorTheme.d.ts +24 -0
  650. package/umd/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +9 -0
  651. package/umd/src/book-components/BookEditor/useBookEditorMonacoLanguage.d.ts +1 -6
  652. package/umd/src/book-components/BookEditor/useBookEditorMonacoLifecycle.d.ts +1 -4
  653. package/umd/src/book-components/BookEditor/useBookEditorMonacoStyles.d.ts +2 -1
  654. package/umd/src/book-components/Chat/Chat/ChatCitationModal.d.ts +2 -0
  655. package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
  656. package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +4 -0
  657. package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
  658. package/umd/src/book-components/Chat/Chat/ChatToolCallModal.d.ts +2 -0
  659. package/umd/src/book-components/Chat/Chat/ChatToolCallModalContent.d.ts +3 -1
  660. package/umd/src/book-components/Chat/Chat/CitationIframePreview.d.ts +20 -0
  661. package/umd/src/book-components/Chat/Chat/TeamToolCallModalContent.d.ts +2 -0
  662. package/umd/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +1 -0
  663. package/umd/src/book-components/Chat/SourceChip/SourceChip.d.ts +6 -1
  664. package/umd/src/book-components/Chat/hooks/useResolvedCitationLabel.d.ts +12 -0
  665. package/umd/src/book-components/Chat/types/ChatMessage.d.ts +4 -0
  666. package/umd/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
  667. package/umd/src/book-components/Chat/types/CitationLabelResolver.d.ts +8 -0
  668. package/umd/src/book-components/Chat/utils/citationHelpers.d.ts +9 -0
  669. package/umd/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.d.ts +14 -0
  670. package/umd/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.test.d.ts +1 -0
  671. package/umd/src/book-components/Chat/utils/isVisibleChatToolCall.d.ts +10 -0
  672. package/umd/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +4 -0
  673. package/umd/src/book-components/_common/Dropdown/Dropdown.d.ts +1 -1
  674. package/umd/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +1 -1
  675. package/umd/src/book-components/_common/Modal/Modal.d.ts +1 -1
  676. package/umd/src/book-components/icons/AboutIcon.d.ts +1 -1
  677. package/umd/src/book-components/icons/DownloadIcon.d.ts +1 -1
  678. package/umd/src/book-components/icons/ExitFullscreenIcon.d.ts +1 -1
  679. package/umd/src/book-components/icons/FullscreenIcon.d.ts +1 -1
  680. package/umd/src/cli/cli-commands/agent/agentCliOptions.d.ts +38 -0
  681. package/umd/src/cli/cli-commands/agent/chat.d.ts +10 -0
  682. package/umd/src/cli/cli-commands/agent/exec.d.ts +10 -0
  683. package/umd/src/cli/cli-commands/agent/run.test.d.ts +1 -0
  684. package/umd/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +2 -24
  685. package/umd/src/cli/cli-commands/agent.d.ts +14 -0
  686. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer.d.ts +17 -1
  687. package/umd/src/cli/cli-commands/agents-server/run.d.ts +6 -0
  688. package/umd/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +9 -2
  689. package/umd/src/cli/cli-commands/coder/ThinkingLevel.d.ts +1 -1
  690. package/umd/src/cli/cli-commands/coder/ensureCoderDeveloperAgentFile.d.ts +25 -0
  691. package/umd/src/cli/cli-commands/coder/find-unwritten.d.ts +10 -0
  692. package/umd/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +2 -0
  693. package/umd/src/cli/cli-commands/coder/server.d.ts +13 -0
  694. package/umd/src/cli/cli-commands/coder/waitOptions.d.ts +14 -0
  695. package/umd/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +9 -25
  696. package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +22 -0
  697. package/umd/src/commitments/_common/teamInternalAgentAccess.d.ts +9 -1
  698. package/umd/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
  699. package/umd/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -1
  700. package/umd/src/scrapers/website/utils/createShowdownConverter.d.ts +2 -2
  701. package/umd/src/utils/isTimingSafeEqualString.d.ts +25 -0
  702. package/umd/src/utils/validators/url/isValidAgentUrl.d.ts +5 -0
  703. package/umd/src/version.d.ts +1 -1
  704. package/apps/agents-server/src/app/api/long-streaming/route.ts +0 -23
  705. package/apps/agents-server/src/message-providers/email/_common/utils/parseEmailAddress.test.ts.todo +0 -108
  706. package/apps/agents-server/src/message-providers/email/_common/utils/parseEmailAddresses.test.ts.todo +0 -117
  707. package/apps/agents-server/src/message-providers/email/_common/utils/stringifyEmailAddress.test.ts.todo +0 -119
  708. package/apps/agents-server/src/message-providers/email/_common/utils/stringifyEmailAddresses.test.ts.todo +0 -74
  709. package/apps/agents-server/src/utils/defaultFederatedAgents/DefaultFederatedAgentsSyncOptions.ts +0 -9
  710. package/apps/agents-server/src/utils/defaultFederatedAgents/ensureDefaultFederatedAgentExists.ts +0 -277
  711. package/apps/agents-server/src/utils/defaultFederatedAgents/fetchCoreOrganizationPayload.ts +0 -39
  712. package/apps/agents-server/src/utils/defaultFederatedAgents/fetchFederatedAgentBook.ts +0 -43
  713. package/apps/agents-server/src/utils/defaultFederatedAgents/fetchWithDefaultFederatedAgentTimeout.ts +0 -28
  714. package/apps/agents-server/src/utils/defaultFederatedAgents/getDefaultFederatedAgentSyncPool.ts +0 -38
  715. package/apps/agents-server/src/utils/defaultFederatedAgents/loadActiveLocalAgentIdsByNormalizedName.ts +0 -41
  716. package/apps/agents-server/src/utils/defaultFederatedAgents/loadDefaultFederatedAgentSyncMetadata.ts +0 -76
  717. package/apps/agents-server/src/utils/defaultFederatedAgents/quoteIdentifier.ts +0 -11
  718. package/apps/agents-server/src/utils/defaultFederatedAgents/scheduleDefaultFederatedAgentsSync.ts +0 -88
  719. package/apps/agents-server/src/utils/defaultFederatedAgents/selectDefaultFederatedAgentsFromOrganizationPayload.ts +0 -181
  720. package/apps/agents-server/src/utils/defaultFederatedAgents/synchronizeDefaultFederatedAgents.ts +0 -77
  721. package/apps/agents-server/src/utils/shibboleth/createShibbolethAuthenticationLogPayload.ts +0 -173
  722. package/apps/agents-server/src/utils/shibboleth/writeShibbolethAuthenticationLog.ts +0 -27
  723. package/apps/agents-server/tests/e2e/authentication-and-navigation.spec.ts.todo +0 -178
  724. package/src/_packages/browser.index.ts +0 -31
  725. package/src/_packages/browser.readme.md +0 -43
  726. package/src/book-2.0/agent-source/parseAgentSourceWithCommitments.test.ts.todo +0 -265
  727. package/src/book-components/BookEditor/BookEditorMonaco.test.tsx.todo +0 -115
  728. package/src/book-components/Chat/utils/renderMarkdown.test.ts.tmp +0 -199
  729. package/src/collection/agent-collection/constructors/agent-collection-in-directory/AgentCollectionInDirectory.test.ts.todo +0 -131
  730. package/src/commands/_common/parseCommand.test.ts.todo +0 -48
  731. package/src/commitments/META_LINK/META_LINK.test.ts.todo +0 -75
  732. package/src/conversion/validation/pipelineStringToJson-errors.test.ts.todo +0 -33
  733. package/src/dialogs/simple-prompt/SimplePromptInterfaceTools.ts +0 -51
  734. package/src/executables/browsers/locateSafari.test.ts.tmp +0 -15
  735. package/src/execution/PromptbookFetch.test-type.ts +0 -14
  736. package/src/execution/createPipelineExecutor/00-createPipelineExecutor.test.ts.todo +0 -0
  737. package/src/execution/execution-report/executionReportJsonToString.test.ts.todo +0 -83
  738. package/src/execution/utils/usageToHuman.test.ts.todo +0 -80
  739. package/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.ts +0 -76
  740. package/src/llm-providers/_common/utils/assertUniqueModels.ts +0 -27
  741. package/src/llm-providers/_multiple/playground/playground.ts +0 -141
  742. package/src/llm-providers/_multiple/playground/tsconfig.json +0 -19
  743. package/src/llm-providers/agent/playground/playground.ts +0 -190
  744. package/src/llm-providers/agent/playground/tsconfig.json +0 -19
  745. package/src/llm-providers/anthropic-claude/playground/playground.ts +0 -99
  746. package/src/llm-providers/anthropic-claude/playground/tsconfig.json +0 -19
  747. package/src/llm-providers/azure-openai/playground/playground.ts +0 -101
  748. package/src/llm-providers/azure-openai/playground/tsconfig.json +0 -19
  749. package/src/llm-providers/ollama/playground/playground.ts +0 -120
  750. package/src/llm-providers/ollama/playground/tsconfig.json +0 -19
  751. package/src/llm-providers/openai/playground/playground.ts +0 -406
  752. package/src/llm-providers/openai/playground/tsconfig.json +0 -19
  753. package/src/llm-providers/remote/playground/playground.ts +0 -144
  754. package/src/llm-providers/remote/playground/tsconfig.json +0 -19
  755. package/src/llm-providers/vercel/playground/playground.ts +0 -133
  756. package/src/llm-providers/vercel/playground/tsconfig.json +0 -19
  757. package/src/personas/preparePersona.test.ts.todo +0 -126
  758. package/src/playground/backup/_playground-boilerplate.ts.txt +0 -37
  759. package/src/playground/backup/playground-agent-os.txt +0 -62
  760. package/src/playground/backup/playground-brj-app.ts.txt +0 -302
  761. package/src/playground/backup/playground-browser-playwright.txt +0 -110
  762. package/src/playground/backup/playground-claude-mcp.txt +0 -43
  763. package/src/playground/backup/playground-document-conversion.txt +0 -84
  764. package/src/playground/backup/playground-glob.ts.txt +0 -42
  765. package/src/playground/backup/playground-mcp-server.txt +0 -1
  766. package/src/playground/backup/playground-openai-agent-kit.txt +0 -73
  767. package/src/playground/backup/playground-openai-function-calling.txt +0 -131
  768. package/src/playground/backup/playground-openai-streaming.ts.txt +0 -68
  769. package/src/playground/backup/playground-scrape-knowledge.txt +0 -65
  770. package/src/playground/backup/playground-scraperFetch.ts.txt +0 -44
  771. package/src/playground/backup/playground-using-openai-compatible-route-on-agents-server.ts.txt +0 -49
  772. package/src/playground/backup/playground-write-pavolhejny-bio.txt +0 -120
  773. package/src/playground/permanent/_boilerplate.ts +0 -54
  774. package/src/playground/permanent/agent-with-browser-playground.ts +0 -92
  775. package/src/playground/permanent/error-handling-playground.ts +0 -103
  776. package/src/playground/playground.ts +0 -36
  777. package/src/playground/tsconfig.json +0 -19
  778. package/src/scrapers/_boilerplate/BoilerplateScraper.test.ts.todo +0 -73
  779. package/src/scrapers/_boilerplate/playground/boilerplate-scraper-playground.ts +0 -79
  780. package/src/scrapers/_boilerplate/playground/tsconfig.json +0 -19
  781. package/src/scrapers/_common/utils/files/blobToDataurl.test.ts.todo +0 -17
  782. package/src/scrapers/_common/utils/files/dataurlToBlob.test.ts.todo +0 -52
  783. package/src/scrapers/_common/utils/files/isValidDataurl.test.ts.todo +0 -42
  784. package/src/scrapers/_common/utils/files/shorten.test.ts.todo +0 -13
  785. package/src/scrapers/document/playground/document-scraper-playground.ts +0 -80
  786. package/src/scrapers/document/playground/tsconfig.json +0 -19
  787. package/src/scrapers/document-legacy/playground/legacy-document-scraper-playground.ts +0 -80
  788. package/src/scrapers/document-legacy/playground/tsconfig.json +0 -19
  789. package/src/scrapers/markdown/playground/markdown-scraper-playground.ts +0 -74
  790. package/src/scrapers/markdown/playground/tsconfig.json +0 -19
  791. package/src/scrapers/markitdown/MarkitdownScraper.test.ts.todo +0 -132
  792. package/src/scrapers/markitdown/playground/markitdown-scraper-playground.ts +0 -91
  793. package/src/scrapers/markitdown/playground/tsconfig.json +0 -19
  794. package/src/scrapers/pdf/PdfScraper.test.ts.todo +0 -52
  795. package/src/scrapers/pdf/playground/pdf-scraper-playground.ts +0 -75
  796. package/src/scrapers/pdf/playground/tsconfig.json +0 -19
  797. package/src/scrapers/website/playground/tsconfig.json +0 -19
  798. package/src/scrapers/website/playground/website-scraper-playground.ts +0 -82
  799. package/src/storage/_common/PromptbookStorage.test-type.ts +0 -14
  800. package/src/storage/local-storage/getIndexedDbStorage.ts +0 -36
  801. package/src/storage/local-storage/getLocalStorage.ts +0 -33
  802. package/src/storage/local-storage/getSessionStorage.ts +0 -33
  803. package/src/storage/local-storage/utils/IndexedDbStorageOptions.ts +0 -16
  804. package/src/storage/local-storage/utils/makePromptbookStorageFromIndexedDb.ts +0 -58
  805. package/src/storage/local-storage/utils/makePromptbookStorageFromWebStorage.ts +0 -45
  806. package/src/transpilers/formatted-book-in-markdown/FormattedBookInMarkdownTranspiler.test.ts.todo +0 -35
  807. package/src/transpilers/openai-sdk/playground/playground.ts +0 -85
  808. package/src/transpilers/openai-sdk/playground/tmp/chatbot-openaisdk-1.js +0 -194
  809. package/src/transpilers/openai-sdk/playground/tmp/package.json +0 -3
  810. package/src/transpilers/openai-sdk/playground/tsconfig.json +0 -18
  811. package/src/utils/editable/utils/findUsableParameters.test.ts.todo +0 -43
  812. package/src/utils/editable/utils/stringifyPipelineJson.test.ts.todo +0 -38
  813. package/src/utils/markdown/prettifyMarkdown.test.ts.tmp +0 -42
  814. package/src/utils/serialization/serializeToPromptbookJavascript.test.ts.todo +0 -116
package/README.md CHANGED
@@ -27,11 +27,27 @@ Create persistent AI agents that turn your company's scattered knowledge into ac
27
27
 
28
28
 
29
29
 
30
+ ### Standalone VPS
31
+
32
+ Run the standalone VPS installer only on a fresh server. Interactive mode asks for the installation values:
33
+
34
+ ```bash
35
+ sudo curl -fsSL https://raw.githubusercontent.com/webgptorg/promptbook/refs/heads/main/other/vps/install.sh | bash
36
+ ```
37
+
38
+ Non-interactive mode takes defaults from command-line options. When `--openai-api-key` is provided with the default OpenAI Codex runner, the installer installs and configures Codex automatically; other runner authentication can be configured later from the UI or SSH:
39
+
40
+ ```bash
41
+ sudo curl -fsSL https://raw.githubusercontent.com/webgptorg/promptbook/refs/heads/main/other/vps/install.sh | bash -s -- \
42
+ --non-interactive \
43
+ --yes-i-understand-that-script-should-be-run-on-fresh-server \
44
+ --domain s24.ptbk.io \
45
+ --openai-api-key sk-proj-abcdef \
46
+ --sentry-dsn https://abc@def.ingest.de.sentry.io/123 \
47
+ --admin-password xxx
48
+ ```
30
49
 
31
50
 
32
- <blockquote style="color: #ff8811">
33
- <b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
34
- </blockquote>
35
51
 
36
52
  ## 📦 Package `@promptbook/cli`
37
53
 
@@ -541,9 +557,9 @@ Prompts marked with `[-]` are not ready yet, prompts containing `@@@` are treate
541
557
  #### Features
542
558
 
543
559
  - **Multi-runner execution:** `openai-codex`, `github-copilot`, `cline`, `claude-code`, `opencode`, `gemini`
544
- - **Context injection:** `--context AGENTS.md` or inline extra instructions
560
+ - **Context injection:** `--agent agents/coding/developer.book --context AGENTS.md` or inline extra instructions
545
561
  - **Reasoning control:** `--thinking-level low|medium|high|xhigh` for supported runners
546
- - **Interactive or unattended runs:** default wait mode, or `--no-wait` for batch execution
562
+ - **Unattended or interactive runs:** default auto mode, or `--no-auto` to wait for user confirmation before each prompt
547
563
  - **Git safety:** clean working tree check by default, optional `--ignore-git-changes`
548
564
  - **Opt-in remote pushes:** commits stay local unless you explicitly pass `--auto-push`
549
565
  - **Prompt triage:** `--priority` to process only more important tasks first
@@ -561,11 +577,11 @@ npx ts-node ./src/cli/test/ptbk.ts coder generate-boilerplates --template prompt
561
577
 
562
578
  npx ts-node ./src/cli/test/ptbk.ts coder generate-boilerplates --template prompts/templates/agents-server.md
563
579
 
564
- npx ts-node ./src/cli/test/ptbk.ts coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md
580
+ npx ts-node ./src/cli/test/ptbk.ts coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md
565
581
 
566
- npx ts-node ./src/cli/test/ptbk.ts coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --auto-push
582
+ npx ts-node ./src/cli/test/ptbk.ts coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --auto-push
567
583
 
568
- npx ts-node ./src/cli/test/ptbk.ts coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --ignore-git-changes --no-wait
584
+ npx ts-node ./src/cli/test/ptbk.ts coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --ignore-git-changes
569
585
 
570
586
  npx ts-node ./src/cli/test/ptbk.ts coder find-refactor-candidates
571
587
 
@@ -587,11 +603,11 @@ ptbk coder generate-boilerplates
587
603
 
588
604
  ptbk coder generate-boilerplates --template prompts/templates/common.md
589
605
 
590
- ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --test npm run test
606
+ ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --test npm run test
591
607
 
592
- ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --auto-push
608
+ ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --auto-push
593
609
 
594
- ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --test npm run test --ignore-git-changes --no-wait
610
+ ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --test npm run test --ignore-git-changes
595
611
 
596
612
  ptbk coder find-refactor-candidates
597
613
 
@@ -604,24 +620,24 @@ ptbk coder verify
604
620
 
605
621
  #### What each command does
606
622
 
607
- | Command | What it does |
608
- | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | ------ | ---- | ----- | ------------------------------------------------------------------------ |
623
+ | Command | What it does |
624
+ | ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | ------ | ---- | ----- | ------------------------------------------------------------------------ |
609
625
  | `ptbk coder init` | Creates `prompts/`, `prompts/done/`, the project-generic template files materialized in `prompts/templates/` (currently `common.md`), and a starter `AGENTS.md`; ensures `.env` contains `CODING_AGENT_GIT_NAME`, `CODING_AGENT_GIT_EMAIL`, and `CODING_AGENT_GIT_SIGNING_KEY`; adds helper coder scripts to `package.json`; ensures `.gitignore` contains `/.promptbook`; and configures `.vscode/settings.json` to save pasted prompt images into `prompts/screenshots/`. |
610
- | `ptbk coder generate-boilerplates` | Creates new prompt markdown files with fresh emoji tags so you can quickly fill in coding tasks; `--template` accepts either a built-in alias or a markdown file path relative to the project root. |
611
- | `ptbk coder run` | Picks the next ready prompt, appends optional context, runs it through the selected coding agent, can optionally verify each attempt with a shell test command and feed failing output back for retries, then marks success or failure, commits the result, and pushes only when `--auto-push` is enabled. |
612
- | `ptbk coder find-refactor-candidates` | Scans the repository for oversized or overpacked files and writes prompt files for likely refactors; `--level <xlow | low | medium | high | xhigh | extreme>` ranges from a very benevolent scan to a very aggressive sweep. |
613
- | `ptbk coder verify` | Walks through completed prompts, archives truly finished work, and adds follow-up repair prompts for unfinished results. |
626
+ | `ptbk coder generate-boilerplates` | Creates new prompt markdown files with fresh emoji tags so you can quickly fill in coding tasks; `--template` accepts either a built-in alias or a markdown file path relative to the project root. |
627
+ | `ptbk coder run` | Picks the next ready prompt, appends optional context, runs it through the selected coding agent, can optionally verify each attempt with a shell test command and feed failing output back for retries, then marks success or failure, commits the result, and pushes only when `--auto-push` is enabled. |
628
+ | `ptbk coder find-refactor-candidates` | Scans the repository for oversized or overpacked files and writes prompt files for likely refactors; `--level <xlow | low | medium | high | xhigh | extreme>` ranges from a very benevolent scan to a very aggressive sweep. |
629
+ | `ptbk coder verify` | Walks through completed prompts, archives truly finished work, and adds follow-up repair prompts for unfinished results. |
614
630
 
615
631
  #### Most useful `ptbk coder run` flags
616
632
 
617
633
  | Flag | Purpose |
618
634
  | -------------------------- | -------------------------------------------------------------------------------------------------- |
619
- | `--agent <name>` | Selects the coding backend. |
635
+ | `--harness <name>` | Selects the coding harness. |
620
636
  | `--model <model>` | Chooses the runner model; required for `openai-codex` and `gemini`, optional for `github-copilot`. |
621
637
  | `--context <text-or-file>` | Appends extra instructions inline or from a file like `AGENTS.md`. |
622
638
  | `--test <command>` | Runs a verification command after each prompt attempt and feeds failing output back for retries. |
623
639
  | `--thinking-level <level>` | Sets reasoning effort for supported runners. |
624
- | `--no-wait` | Skips interactive pauses between prompts for unattended execution. |
640
+ | `--no-auto` | Waits for user confirmation before each prompt instead of running automatically through the queue. |
625
641
  | `--ignore-git-changes` | Disables the clean-working-tree guard. |
626
642
  | `--priority <n>` | Runs only prompts at or above the given priority. |
627
643
  | `--dry-run` | Prints which prompts are ready instead of executing them. |
@@ -633,8 +649,8 @@ ptbk coder verify
633
649
 
634
650
  1. Initialize once with `ptbk coder init`.
635
651
  2. Customize `prompts/templates/*.md` if needed, then create or write prompt files in `prompts/`.
636
- 3. Customize the starter `AGENTS.md` with repository-specific instructions, then pass `--context AGENTS.md`.
637
- 4. Run one prompt at a time interactively, or use `--no-wait` for unattended batches.
652
+ 3. Customize the starter `AGENTS.md` with repository-specific instructions, then pass `--agent agents/coding/developer.book --context AGENTS.md`.
653
+ 4. Run unattended batches by default, or pass `--no-auto` to confirm each prompt interactively.
638
654
  5. Finish with `ptbk coder verify` so resolved prompts are archived and broken ones get explicit repair follow-ups.
639
655
 
640
656
 
@@ -0,0 +1,23 @@
1
+ Promptbook Developer
2
+
3
+ RULE
4
+ Keep in mind the DRY _(don't repeat yourself)_ principle.
5
+
6
+ RULE
7
+ Keep in mind the SOLID principles.
8
+
9
+ RULE
10
+ Do a proper analysis of the current functionality before you start implementing.
11
+
12
+ RULE
13
+ Keep small responsibilities of functions and classes, avoid creating big functions or classes that do many things.
14
+
15
+ RULE
16
+ Constants should always be `UPPER_SNAKE_CASE`.
17
+
18
+ RULE
19
+ Boolean variables should always be prefixed with `is`, for example `isUserChatJobLeaseExpired` or `IS_DEBUG_MODE`.
20
+
21
+ RULE
22
+ Do not use abbreviations, for example use `isExpired` instead of `isExp`, `translateMessage` instead of `t`, etc.
23
+ It is fine to use well-known abbreviations, for example `id`, `url`, `html`, etc.
@@ -9,7 +9,7 @@ The installed CLI can initialize a local Agents Server project before it starts
9
9
  ```bash
10
10
  npm install ptbk
11
11
  ptbk agents-server init
12
- ptbk agents-server start --agent github-copilot --model gpt-5.4 --thinking-level xhigh
12
+ ptbk agents-server start --harness github-copilot --model gpt-5.4 --thinking-level xhigh
13
13
  ```
14
14
 
15
15
  `ptbk agents-server init` adds missing placeholders to `.env` and local runtime exclusions to `.gitignore` without deleting existing configuration. Use `PTBK_AGENTS_SERVER_DATABASE=supabase` for a Supabase-backed server or `PTBK_AGENTS_SERVER_DATABASE=sqlite` for a standalone local database in `.promptbook`. When using Supabase, fill the initialized values from your project before starting the server. The Supabase project URL and API keys are available in the [Supabase project API settings](https://supabase.com/docs/guides/api/api-keys), and the PostgreSQL connection string is available from the [Supabase database connection guide](https://supabase.com/docs/guides/database/connecting-to-postgres).
@@ -41,6 +41,24 @@ ptbk agents-server start --agent github-copilot --model gpt-5.4 --thinking-level
41
41
  <a id="agents-server-env-admin-password"></a>
42
42
  - `ADMIN_PASSWORD`: Password for the built-in `admin` login on a self-hosted Agents Server. Choose a private value before using the admin UI.
43
43
 
44
+ <a id="agents-server-env-session-secret"></a>
45
+ - `SESSION_SECRET`: HMAC signing key used to sign the session cookie. Must be set explicitly in production — the server refuses to start session signing when missing instead of falling back to a hardcoded default. Use a long random string, for example the output of `openssl rand -hex 32`. Keep it separate from `ADMIN_PASSWORD` so a leak of either credential cannot forge the other.
46
+
47
+ <a id="agents-server-env-ptbk-agents-server-user-chat-worker-token"></a>
48
+ - `PTBK_AGENTS_SERVER_USER_CHAT_WORKER_TOKEN`: Shared internal token used to authorize background worker routes (`/api/internal/user-chat-jobs/run`, `/api/internal/user-chat-timeouts/run`, and `/api/internal/agent-runner-limits`). Must be set explicitly in production — the server refuses to resolve the worker token when missing instead of falling back to `ADMIN_PASSWORD`, `SUPABASE_SERVICE_ROLE_KEY`, or a hardcoded constant. Use a long random string, for example the output of `openssl rand -hex 32`. The CLI launcher (`ptbk agents-server start`) generates a per-process value automatically when the variable is empty so local development works without configuration.
49
+
50
+ <a id="agents-server-env-promptbook-team-agent-access-token"></a>
51
+ - `PROMPTBOOK_TEAM_AGENT_ACCESS_TOKEN`: Dedicated secret used by same-server `TEAM` calls to authorize access to private teammate agents. Must be a dedicated random string — falling back to `ADMIN_PASSWORD` or `SUPABASE_SERVICE_ROLE_KEY` would let a leak of one credential compromise both authentication boundaries. When not configured, same-server team access stays disabled (the integration fails closed) so leaving the variable empty is safe but disables the feature. Use a long random string, for example the output of `openssl rand -hex 32`.
52
+
53
+ <a id="agents-server-env-sendgrid-inbound-parse-public-key"></a>
54
+ - `SENDGRID_INBOUND_PARSE_PUBLIC_KEY`: Public verification key from SendGrid Signed Webhook settings for `/api/emails/incoming/sendgrid`. The route verifies `X-Twilio-Email-Event-Webhook-Signature` over the raw multipart body before parsing or inserting an inbound `EMAIL` message. Configure either this public key or `SENDGRID_INBOUND_PARSE_WEBHOOK_SECRET`; the SendGrid public-key flow is preferred.
55
+
56
+ <a id="agents-server-env-sendgrid-inbound-parse-webhook-secret"></a>
57
+ - `SENDGRID_INBOUND_PARSE_WEBHOOK_SECRET`: Shared secret for deployments that sign SendGrid Inbound Parse callbacks with HMAC instead of SendGrid's public-key signature flow. Leave empty when `SENDGRID_INBOUND_PARSE_PUBLIC_KEY` is configured. Use a dedicated random string and keep it separate from `SENDGRID_API_KEY`, `ADMIN_PASSWORD`, and other server secrets.
58
+
59
+ <a id="agents-server-env-sendgrid-inbound-parse-hosts"></a>
60
+ - `SENDGRID_INBOUND_PARSE_HOSTS`: Comma-separated list of public hostnames allowed to receive SendGrid Inbound Parse callbacks, for example `mail.example.com,parse.example.com`. The route rejects signed requests delivered through any other `Host` / `X-Forwarded-Host`, so point SendGrid only at the hostnames that are also protected by your reverse-proxy or platform IP allowlisting.
61
+
44
62
  ## Creating servers
45
63
 
46
64
  When creating new Agents server, search across the repository for [☁]
@@ -54,4 +72,3 @@ When creating new Agents server, search across the repository for [☁]
54
72
  - [☁] If using `USE PROJECT` auto-auth, configure [GitHub App integration](./GITHUB_APP.md)
55
73
  - [☁] Add the server to [the list of our servers](https://docs.google.com/spreadsheets/d/1X26iMQqubsxftqD1EJNSlzPYFS94QjCFPXyKdHHDeVs/edit?gid=848307752#gid=848307752)
56
74
  - [☁] Run migration script _(run new instance)_
57
- - [☁] For testing servers, look at the server and change the `CORE_SERVER` to `https://core-test.ptbk.io/`
@@ -32,7 +32,7 @@ GitHub App configuration now lives in **Metadata** so you can customize it per s
32
32
  - **GITHUB_APP_ID** – numeric GitHub App ID from the app settings.
33
33
  - **GITHUB_APP_SLUG** – slug used in `https://github.com/apps/<slug>`.
34
34
  - **GITHUB_APP_PRIVATE_KEY** – PEM-encoded private key. Replace literal newlines with `\n` when editing through the UI and keep the `BEGIN/END` markers.
35
- - **GITHUB_APP_STATE_SECRET** (optional, recommended) – random string used to sign OAuth/connect state. If unset, `ADMIN_PASSWORD` will be used as a fallback.
35
+ - **GITHUB_APP_STATE_SECRET** (optional, recommended) – random string used to sign OAuth/connect state.
36
36
 
37
37
  The values stored in Metadata override any legacy `.env` entries and can differ per server host.
38
38
 
@@ -1,6 +1,8 @@
1
+ import { withSentryConfig } from '@sentry/nextjs';
1
2
  import type { NextConfig } from 'next';
2
3
  import { readdirSync } from 'fs';
3
4
  import path from 'path';
5
+ import { SENTRY_ORGANIZATION, SENTRY_PROJECT } from './src/utils/errorReporting/sentrySdkConfig';
4
6
 
5
7
  /**
6
8
  * Next.js build output directory.
@@ -20,6 +22,11 @@ const agentsServerNodeModulesPath = process.env.PTBK_AGENTS_SERVER_NODE_MODULES_
20
22
  */
21
23
  const isNextValidationIgnored = process.env.PTBK_AGENTS_SERVER_IGNORE_NEXT_VALIDATION === 'true';
22
24
 
25
+ /**
26
+ * Whether Sentry source maps can be uploaded during production builds.
27
+ */
28
+ const IS_SENTRY_SOURCE_MAP_UPLOAD_ENABLED = Boolean(process.env.SENTRY_AUTH_TOKEN);
29
+
23
30
  /**
24
31
  * Exact aliases for local generated Promptbook package entrypoints.
25
32
  */
@@ -122,7 +129,19 @@ const nextConfig: NextConfig = {
122
129
  },
123
130
  };
124
131
 
125
- export default nextConfig;
132
+ export default withSentryConfig(nextConfig, {
133
+ org: SENTRY_ORGANIZATION,
134
+ project: SENTRY_PROJECT,
135
+ silent: true,
136
+ sourcemaps: {
137
+ disable: !IS_SENTRY_SOURCE_MAP_UPLOAD_ENABLED,
138
+ },
139
+ webpack: {
140
+ treeshake: {
141
+ removeDebugLogging: true,
142
+ },
143
+ },
144
+ });
126
145
 
127
146
  /**
128
147
  * Creates webpack/Turbopack aliases from imports like `@promptbook-local/core` to generated local sources.
@@ -7,7 +7,7 @@
7
7
  "dev": "next dev -p 4440",
8
8
  "test": "npm run lint && npm run test-build && npm run test-e2e",
9
9
  "test-e2e": "playwright test",
10
- "pretest-build": "npx kill-port 4021",
10
+ "pretest-build": "npx kill-port 4021 4440 || exit 0",
11
11
  "test-build": "node -r ./scripts/ignore-kill-eperm.js ../../node_modules/next/dist/bin/next build && node ./scripts/prerender-homepage.js",
12
12
  "build": "node -r ./scripts/ignore-kill-eperm.js ../../node_modules/next/dist/bin/next build && node ./scripts/prerender-homepage.js",
13
13
  "start": "next start -p 4440",
@@ -26,6 +26,9 @@ const APP_URL = `http://127.0.0.1:${APP_PORT}`;
26
26
  */
27
27
  const APP_E2E_ENV = {
28
28
  ADMIN_PASSWORD: 'e2e-admin-password',
29
+ SESSION_SECRET: 'e2e-session-secret-must-differ-from-admin-password',
30
+ PTBK_AGENTS_SERVER_USER_CHAT_WORKER_TOKEN: 'e2e-user-chat-worker-token-must-differ-from-admin-password',
31
+ PROMPTBOOK_TEAM_AGENT_ACCESS_TOKEN: 'e2e-team-agent-access-token-must-differ-from-admin-password',
29
32
  NEXT_DIST_DIR: '.next-e2e',
30
33
  NEXT_PUBLIC_SITE_URL: APP_URL,
31
34
  PTBK_AGENTS_SERVER_DATABASE: 'supabase',
@@ -45,6 +45,10 @@ const WAIT_TIMEOUT_MS = 15000;
45
45
  * Timeout for the final homepage download once the server is confirmed ready.
46
46
  */
47
47
  const HOME_REQUEST_TIMEOUT_MS = 30000;
48
+ /**
49
+ * Timeout for stopping the temporary production server before escalating cleanup.
50
+ */
51
+ const STOP_SERVER_TIMEOUT_MS = 10000;
48
52
  /**
49
53
  * When enabled, homepage prerender failures abort the whole build.
50
54
  */
@@ -136,6 +140,65 @@ function waitForServerReady(serverProcess) {
136
140
  });
137
141
  }
138
142
 
143
+ /**
144
+ * Waits briefly for the temporary production server to exit after cleanup starts.
145
+ *
146
+ * @param serverProcess - Spawned `next start` child process.
147
+ * @param gracefulExit - Promise resolved by the child `exit` event.
148
+ * @returns Whether the child exited within the timeout window.
149
+ */
150
+ async function waitForServerStop(serverProcess, gracefulExit) {
151
+ if (serverProcess.exitCode !== null || serverProcess.signalCode !== null) {
152
+ return true;
153
+ }
154
+
155
+ return await Promise.race([
156
+ gracefulExit.then(() => true),
157
+ new Promise((resolve) => setTimeout(() => resolve(false), STOP_SERVER_TIMEOUT_MS)),
158
+ ]);
159
+ }
160
+
161
+ /**
162
+ * Force-stops the temporary production server when normal shutdown does not finish in time.
163
+ *
164
+ * Windows can leave `next start` alive after an `EPERM` kill attempt, so use `taskkill`
165
+ * against the exact PID before giving up on cleanup.
166
+ *
167
+ * @param serverProcess - Spawned `next start` child process.
168
+ */
169
+ async function forceStopServer(serverProcess) {
170
+ if (serverProcess.exitCode !== null || serverProcess.signalCode !== null) {
171
+ return;
172
+ }
173
+
174
+ if (process.platform !== 'win32') {
175
+ try {
176
+ serverProcess.kill('SIGKILL');
177
+ } catch (error) {
178
+ if (!isIgnorableStopServerError(error)) {
179
+ throw error;
180
+ }
181
+ }
182
+ return;
183
+ }
184
+
185
+ await new Promise((resolve, reject) => {
186
+ const taskKillProcess = spawn('taskkill', ['/PID', String(serverProcess.pid), '/T', '/F'], {
187
+ stdio: 'ignore',
188
+ });
189
+
190
+ taskKillProcess.on('error', reject);
191
+ taskKillProcess.on('exit', (code) => {
192
+ if (code === 0 || serverProcess.exitCode !== null || serverProcess.signalCode !== null) {
193
+ resolve();
194
+ return;
195
+ }
196
+
197
+ reject(new Error(`Failed to stop temporary production server process ${serverProcess.pid} with taskkill.`));
198
+ });
199
+ });
200
+ }
201
+
139
202
  /**
140
203
  * Runs the production server for the built app, captures `/`, and keeps the HTML.
141
204
  */
@@ -196,7 +259,19 @@ async function prerenderHomePage() {
196
259
  } finally {
197
260
  detachStopServerHandlers();
198
261
  stopServer();
199
- await gracefulExit;
262
+
263
+ if (!(await waitForServerStop(serverProcess, gracefulExit))) {
264
+ console.warn(
265
+ `Timed out waiting ${STOP_SERVER_TIMEOUT_MS}ms for the temporary production server to stop. Trying a forceful shutdown.`,
266
+ );
267
+ await forceStopServer(serverProcess);
268
+
269
+ if (!(await waitForServerStop(serverProcess, gracefulExit))) {
270
+ console.warn(
271
+ `Timed out waiting ${STOP_SERVER_TIMEOUT_MS}ms for the temporary production server after forceful shutdown.`,
272
+ );
273
+ }
274
+ }
200
275
  }
201
276
  }
202
277
 
@@ -1,6 +1,5 @@
1
1
  'use client';
2
2
 
3
- import { useRouter } from 'next/navigation';
4
3
  import { FileCard } from '../components/Homepage/FileCard';
5
4
  import { useAgentNaming } from '../components/AgentNaming/AgentNamingContext';
6
5
  import { showAlert } from '../components/AsyncDialogs/asyncDialogs';
@@ -21,15 +20,11 @@ type AddAgentButtonProps = {
21
20
  * Renders the add-agent card and creation dialog workflow.
22
21
  */
23
22
  export function AddAgentButton({ currentFolderId }: AddAgentButtonProps) {
24
- const router = useRouter();
25
23
  const { formatText } = useAgentNaming();
26
24
  const { t } = useServerLanguage();
27
25
  const addButtonLabel = formatText(t('agentCreation.addButtonLabel'));
28
26
 
29
27
  const { isPreparingDialog, openNewAgentDialog, dialog } = useNewAgentDialog({
30
- onCreated: ({ targetPath }) => {
31
- router.push(targetPath);
32
- },
33
28
  onCreateFailed: async (error) => {
34
29
  console.error('Failed to create agent:', error);
35
30
  await showAlert({
@@ -0,0 +1 @@
1
+ export { default, generateMetadata } from '../agents/[agentName]/layout';
@@ -3,18 +3,33 @@
3
3
  import { $generateBookBoilerplate } from '@promptbook-local/core';
4
4
  import { string_agent_name, string_book } from '@promptbook-local/types';
5
5
  import { revalidatePath } from 'next/cache';
6
+ import { headers } from 'next/headers';
6
7
  import { string_agent_permanent_id } from '../../../../src/types/typeAliases';
7
8
  import { DEFAULT_NAME_POOL, NAME_POOL_METADATA_KEY, parseNamePool } from '../constants/namePool';
8
- import { NEW_AGENT_WIZZARD_METADATA_KEY, parseNewAgentWizardMode } from '../constants/newAgentWizard';
9
+ import { NEW_AGENT_WIZARD_METADATA_KEY, parseNewAgentWizardMode } from '../constants/newAgentWizard';
9
10
  import { getMetadata } from '../database/getMetadata';
10
11
  import { $provideAgentCollectionForServer } from '../tools/$provideAgentCollectionForServer';
12
+ import { invalidateCachedActiveOrganizationSnapshots } from '../utils/agentOrganization/loadAgentOrganizationState';
13
+ import { resolveAgentRouteTarget } from '../utils/agentRouting/resolveAgentRouteTarget';
14
+ import { buildAgentChatHref, buildAgentProfileHref } from '../utils/agentRouting/agentRouteHrefs';
11
15
  import { type AgentVisibility, parseAgentVisibility } from '../utils/agentVisibility';
12
- import { authenticateUser } from '../utils/authenticateUser';
16
+ import { authenticateUserWithRateLimit } from '../utils/authenticateUser';
17
+ import { resolveAuthenticationAttemptHeaderIp } from '../utils/authenticationAttemptRateLimit';
13
18
  import { createAgentWithDefaultVisibility } from '../utils/createAgentWithDefaultVisibility';
14
19
  import { resolveCurrentUserIdentity } from '../utils/currentUserIdentity';
15
20
  import { isUserAdmin } from '../utils/isUserAdmin';
16
21
  import { clearSession, setSession } from '../utils/session';
17
22
 
23
+ /**
24
+ * Maximum attempts used to confirm a freshly created agent route resolves before navigation starts.
25
+ */
26
+ const CREATED_AGENT_ROUTE_READY_ATTEMPTS = 20;
27
+
28
+ /**
29
+ * Delay between created-agent route-resolution retries.
30
+ */
31
+ const CREATED_AGENT_ROUTE_READY_DELAY_MS = 100;
32
+
18
33
  /**
19
34
  * Creates a new agent from the generated boilerplate template.
20
35
  *
@@ -34,6 +49,8 @@ export async function $createAgentAction(): Promise<{ agentName: string_agent_na
34
49
  const { agentName, permanentId } = await createAgentWithDefaultVisibility(collection, agentSource, {
35
50
  userId: currentUserIdentity?.userId,
36
51
  });
52
+ revalidateCreatedAgentPaths(permanentId);
53
+ await waitForCreatedAgentRoute(permanentId);
37
54
 
38
55
  return { agentName, permanentId };
39
56
  }
@@ -58,11 +75,44 @@ export async function $getNewAgentCreationSettingsAction(): Promise<{
58
75
  defaultVisibility: AgentVisibility;
59
76
  }> {
60
77
  return {
61
- mode: parseNewAgentWizardMode(await getMetadata(NEW_AGENT_WIZZARD_METADATA_KEY)),
78
+ mode: parseNewAgentWizardMode(await getMetadata(NEW_AGENT_WIZARD_METADATA_KEY)),
62
79
  defaultVisibility: parseAgentVisibility(await getMetadata('DEFAULT_VISIBILITY')),
63
80
  };
64
81
  }
65
82
 
83
+ /**
84
+ * Clears cached organization snapshots and route payloads after a new agent is created.
85
+ *
86
+ * @param permanentId - Canonical identifier of the newly created agent.
87
+ */
88
+ function revalidateCreatedAgentPaths(permanentId: string_agent_permanent_id): void {
89
+ invalidateCachedActiveOrganizationSnapshots();
90
+ revalidatePath('/', 'layout');
91
+ revalidatePath('/');
92
+ revalidatePath('/agents');
93
+ revalidatePath('/dashboard');
94
+ revalidatePath(buildAgentProfileHref(permanentId));
95
+ revalidatePath(buildAgentChatHref(permanentId));
96
+ }
97
+
98
+ /**
99
+ * Waits until the new agent can be resolved by the same routing helper the chat page uses.
100
+ *
101
+ * @param permanentId - Canonical identifier of the newly created agent.
102
+ */
103
+ async function waitForCreatedAgentRoute(permanentId: string_agent_permanent_id): Promise<void> {
104
+ for (let attempt = 0; attempt < CREATED_AGENT_ROUTE_READY_ATTEMPTS; attempt++) {
105
+ const routeTarget = await resolveAgentRouteTarget(permanentId, { forceRefresh: true });
106
+ if (routeTarget?.kind === 'local' && routeTarget.canonicalAgentId === permanentId) {
107
+ return;
108
+ }
109
+
110
+ await new Promise((resolve) => setTimeout(resolve, CREATED_AGENT_ROUTE_READY_DELAY_MS));
111
+ }
112
+
113
+ throw new Error(`Created agent "${permanentId}" could not be resolved for routing immediately after creation.`);
114
+ }
115
+
66
116
  /**
67
117
  * Creates a new agent using provided book content.
68
118
  *
@@ -89,6 +139,8 @@ export async function $createAgentFromBookAction(
89
139
  visibility: visibility ?? undefined,
90
140
  userId: currentUserIdentity?.userId,
91
141
  });
142
+ revalidateCreatedAgentPaths(permanentId);
143
+ await waitForCreatedAgentRoute(permanentId);
92
144
 
93
145
  return { agentName, permanentId };
94
146
  }
@@ -100,15 +152,24 @@ export async function $createAgentFromBookAction(
100
152
  * @returns Success state for the login attempt.
101
153
  */
102
154
  export async function loginAction(formData: FormData) {
103
- const username = formData.get('username') as string;
104
- const password = formData.get('password') as string;
155
+ const username = formData.get('username');
156
+ const password = formData.get('password');
105
157
 
106
- console.info(`Login attempt for user: ${username}`);
158
+ if (typeof username !== 'string' || typeof password !== 'string' || !username || !password) {
159
+ return { success: false, message: 'Username and password are required' };
160
+ }
107
161
 
108
- const user = await authenticateUser(username, password);
162
+ const requestIp = resolveAuthenticationAttemptHeaderIp(await headers());
163
+ const authenticationResult = await authenticateUserWithRateLimit(username, password, {
164
+ requestIp,
165
+ });
166
+
167
+ if (authenticationResult.isRateLimited) {
168
+ return { success: false, message: authenticationResult.message };
169
+ }
109
170
 
110
- if (user) {
111
- await setSession(user);
171
+ if (authenticationResult.user) {
172
+ await setSession(authenticationResult.user);
112
173
  revalidatePath('/', 'layout');
113
174
  return { success: true };
114
175
  } else {
@@ -413,7 +413,7 @@ export default async function AdminAboutPage() {
413
413
  ];
414
414
 
415
415
  return (
416
- <div className="min-h-screen bg-gradient-to-br from-blue-50 via-white to-purple-50">
416
+ <div className="min-h-screen bg-gradient-to-br from-blue-50 via-white to-purple-50 dark:from-slate-950 dark:via-slate-950 dark:to-slate-900">
417
417
  <div className="container mx-auto px-4 py-16">
418
418
  <Card className="mb-10 space-y-4">
419
419
  <div>
@@ -2,9 +2,11 @@
2
2
 
3
3
  import { Copy, Plus, Trash } from 'lucide-react';
4
4
  import { useEffect, useState } from 'react';
5
+ import { useServerLanguage } from '../../../components/ServerLanguage/ServerLanguageProvider';
5
6
  import { SecretInput } from '../../../components/SecretInput/SecretInput';
6
7
  import { showConfirm } from '../../../components/AsyncDialogs/asyncDialogs';
7
8
  import { ApiTokenEntry, createApiToken, deleteApiToken, fetchApiTokens } from '../../../utils/apiTokensClient';
9
+ import { formatServerLanguageHumanReadableDate } from '../../../utils/localization/formatServerLanguageHumanReadableDate';
8
10
 
9
11
  /**
10
12
  * Props for rendering a single API token in a masked input.
@@ -44,6 +46,7 @@ function TokenSecretField({ token, onCopy }: TokenSecretFieldProps) {
44
46
  * Renders the admin API token management UI.
45
47
  */
46
48
  export function ApiTokensClient() {
49
+ const { language } = useServerLanguage();
47
50
  const [tokens, setTokens] = useState<ApiTokenEntry[]>([]);
48
51
  const [loading, setLoading] = useState(true);
49
52
  const [error, setError] = useState<string | null>(null);
@@ -182,7 +185,7 @@ export function ApiTokensClient() {
182
185
  </td>
183
186
  <td className="px-6 py-4 text-sm text-gray-500">{entry.note || '-'}</td>
184
187
  <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
185
- {new Date(entry.createdAt).toLocaleDateString()}
188
+ {formatServerLanguageHumanReadableDate(entry.createdAt, language)}
186
189
  </td>
187
190
  <td className="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
188
191
  <button
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { useAgentNaming } from '../../../components/AgentNaming/AgentNamingContext';
4
+ import { useServerLanguage } from '../../../components/ServerLanguage/ServerLanguageProvider';
4
5
  import { ChatFeedbackFiltersCard } from './ChatFeedbackFiltersCard';
5
6
  import { ChatFeedbackTable } from './ChatFeedbackTable';
6
7
  import { ChatFeedbackThreadDialog } from './ChatFeedbackThreadDialog';
@@ -21,6 +22,7 @@ type ChatFeedbackClientProps = {
21
22
  */
22
23
  export function ChatFeedbackClient({ initialAgentName }: ChatFeedbackClientProps) {
23
24
  const { formatText } = useAgentNaming();
25
+ const { language } = useServerLanguage();
24
26
  const chatFeedbackState = useChatFeedbackState({ initialAgentName, formatText });
25
27
 
26
28
  return (
@@ -68,6 +70,7 @@ export function ChatFeedbackClient({ initialAgentName }: ChatFeedbackClientProps
68
70
 
69
71
  <ChatFeedbackTable
70
72
  formatText={formatText}
73
+ language={language}
71
74
  items={chatFeedbackState.items}
72
75
  total={chatFeedbackState.total}
73
76
  loading={chatFeedbackState.loading}
@@ -1,4 +1,6 @@
1
1
  import { Card } from '../../../components/Homepage/Card';
2
+ import type { ServerLanguageCode } from '../../../languages/ServerLanguageRegistry';
3
+ import { formatServerLanguageHumanReadableDate } from '../../../utils/localization/formatServerLanguageHumanReadableDate';
2
4
  import type { UseChatFeedbackState } from './useChatFeedbackState';
3
5
 
4
6
  /**
@@ -25,18 +27,18 @@ type ChatFeedbackTableProps = Pick<
25
27
  * Active text formatter for agent naming.
26
28
  */
27
29
  formatText: (text: string) => string;
30
+
31
+ /**
32
+ * Active UI language used for date formatting.
33
+ */
34
+ language: ServerLanguageCode;
28
35
  };
29
36
 
30
37
  /**
31
38
  * Formats date.
32
39
  */
33
- function formatDate(dateString: string | null | undefined): string {
34
- if (!dateString) return '-';
35
-
36
- const date = new Date(dateString);
37
- if (Number.isNaN(date.getTime())) return dateString;
38
-
39
- return date.toLocaleString();
40
+ function formatDate(dateString: string | null | undefined, language: ServerLanguageCode): string {
41
+ return formatServerLanguageHumanReadableDate(dateString, language, { fallbackLabel: '-' });
40
42
  }
41
43
 
42
44
  /**
@@ -71,6 +73,7 @@ function ChatFeedbackPreviewCell({ value }: { value: unknown }) {
71
73
  */
72
74
  export function ChatFeedbackTable({
73
75
  formatText,
76
+ language,
74
77
  items,
75
78
  total,
76
79
  loading,
@@ -136,7 +139,9 @@ export function ChatFeedbackTable({
136
139
  <tbody className="divide-y divide-gray-200 bg-white">
137
140
  {items.map((row) => (
138
141
  <tr key={row.id}>
139
- <td className="whitespace-nowrap px-4 py-3 text-gray-700">{formatDate(row.createdAt)}</td>
142
+ <td className="whitespace-nowrap px-4 py-3 text-gray-700">
143
+ {formatDate(row.createdAt, language)}
144
+ </td>
140
145
  <td className="whitespace-nowrap px-4 py-3 text-gray-700">{row.agentName}</td>
141
146
  <td className="whitespace-nowrap px-4 py-3 text-gray-700">{row.rating || '-'}</td>
142
147
  <td className="max-w-xs px-4 py-3 text-gray-700">