@promptbook/cli 0.104.0-1 → 0.104.0-3

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 (128) hide show
  1. package/apps/agents-server/next.config.ts +2 -2
  2. package/apps/agents-server/package.json +7 -3
  3. package/apps/agents-server/public/fonts/OpenMoji-color-cbdt.woff2 +0 -0
  4. package/apps/agents-server/public/swagger.json +115 -0
  5. package/apps/agents-server/scripts/generate-reserved-paths/generate-reserved-paths.ts +54 -0
  6. package/apps/agents-server/scripts/generate-reserved-paths/tsconfig.json +19 -0
  7. package/apps/agents-server/src/app/AddAgentButton.tsx +3 -3
  8. package/apps/agents-server/src/app/actions.ts +17 -5
  9. package/apps/agents-server/src/app/admin/chat-feedback/ChatFeedbackClient.tsx +221 -274
  10. package/apps/agents-server/src/app/admin/chat-history/ChatHistoryClient.tsx +94 -137
  11. package/apps/agents-server/src/app/admin/metadata/MetadataClient.tsx +23 -19
  12. package/apps/agents-server/src/app/agents/[agentName]/AgentChatWrapper.tsx +15 -1
  13. package/apps/agents-server/src/app/agents/[agentName]/AgentOptionsMenu.tsx +51 -9
  14. package/apps/agents-server/src/app/agents/[agentName]/AgentProfileChat.tsx +47 -4
  15. package/apps/agents-server/src/app/agents/[agentName]/AgentProfileWrapper.tsx +2 -0
  16. package/apps/agents-server/src/app/agents/[agentName]/_utils.ts +18 -0
  17. package/apps/agents-server/src/app/agents/[agentName]/agentLinks.tsx +8 -8
  18. package/apps/agents-server/src/app/agents/[agentName]/api/agents/route.ts +17 -26
  19. package/apps/agents-server/src/app/agents/[agentName]/api/chat/route.ts +20 -0
  20. package/apps/agents-server/src/app/agents/[agentName]/api/mcp/route.ts +6 -11
  21. package/apps/agents-server/src/app/agents/[agentName]/api/profile/route.ts +1 -1
  22. package/apps/agents-server/src/app/agents/[agentName]/api/voice/route.ts +5 -2
  23. package/apps/agents-server/src/app/agents/[agentName]/book/BookEditorWrapper.tsx +20 -16
  24. package/apps/agents-server/src/app/agents/[agentName]/book/page.tsx +15 -2
  25. package/apps/agents-server/src/app/agents/[agentName]/book+chat/page.tsx +15 -2
  26. package/apps/agents-server/src/app/agents/[agentName]/chat/page.tsx +12 -0
  27. package/apps/agents-server/src/app/agents/[agentName]/code/api/route.ts +68 -0
  28. package/apps/agents-server/src/app/agents/[agentName]/code/page.tsx +214 -0
  29. package/apps/agents-server/src/app/agents/[agentName]/generateAgentMetadata.ts +5 -0
  30. package/apps/agents-server/src/app/agents/[agentName]/history/actions.ts +2 -2
  31. package/apps/agents-server/src/app/agents/[agentName]/integration/page.tsx +1 -1
  32. package/apps/agents-server/src/app/agents/[agentName]/links/page.tsx +2 -2
  33. package/apps/agents-server/src/app/agents/[agentName]/page.tsx +12 -6
  34. package/apps/agents-server/src/app/agents/[agentName]/system-message/page.tsx +87 -0
  35. package/apps/agents-server/src/app/api/admin-email/route.ts +12 -0
  36. package/apps/agents-server/src/app/api/agents/[agentName]/clone/route.ts +10 -12
  37. package/apps/agents-server/src/app/api/agents/[agentName]/restore/route.ts +19 -0
  38. package/apps/agents-server/src/app/api/agents/[agentName]/route.ts +41 -0
  39. package/apps/agents-server/src/app/api/agents/route.ts +28 -3
  40. package/apps/agents-server/src/app/api/api-tokens/route.ts +6 -7
  41. package/apps/agents-server/src/app/api/docs/book.md/route.ts +61 -0
  42. package/apps/agents-server/src/app/api/federated-agents/route.ts +12 -0
  43. package/apps/agents-server/src/app/api/images/[filename]/route.ts +107 -0
  44. package/apps/agents-server/src/app/api/metadata/route.ts +5 -6
  45. package/apps/agents-server/src/app/api/upload/route.ts +128 -45
  46. package/apps/agents-server/src/app/docs/[docId]/page.tsx +2 -3
  47. package/apps/agents-server/src/app/docs/page.tsx +12 -12
  48. package/apps/agents-server/src/app/globals.css +140 -33
  49. package/apps/agents-server/src/app/layout.tsx +27 -22
  50. package/apps/agents-server/src/app/page.tsx +50 -4
  51. package/apps/agents-server/src/app/recycle-bin/actions.ts +20 -14
  52. package/apps/agents-server/src/app/recycle-bin/page.tsx +25 -41
  53. package/apps/agents-server/src/app/sitemap.xml/route.ts +6 -3
  54. package/apps/agents-server/src/app/swagger/page.tsx +14 -0
  55. package/apps/agents-server/src/components/AgentProfile/AgentProfile.tsx +9 -98
  56. package/apps/agents-server/src/components/AgentProfile/QrCodeModal.tsx +0 -1
  57. package/apps/agents-server/src/components/AgentProfile/useAgentBackground.ts +97 -0
  58. package/apps/agents-server/src/components/Auth/AuthControls.tsx +5 -4
  59. package/apps/agents-server/src/components/DeletedAgentBanner.tsx +26 -0
  60. package/apps/agents-server/src/components/DocsToolbar/DocsToolbar.tsx +38 -0
  61. package/apps/agents-server/src/components/DocumentationContent/DocumentationContent.tsx +11 -9
  62. package/apps/agents-server/src/components/Footer/Footer.tsx +5 -5
  63. package/apps/agents-server/src/components/ForgottenPasswordDialog/ForgottenPasswordDialog.tsx +61 -0
  64. package/apps/agents-server/src/components/Header/Header.tsx +106 -40
  65. package/apps/agents-server/src/components/Homepage/AgentCard.tsx +104 -20
  66. package/apps/agents-server/src/components/Homepage/AgentsList.tsx +72 -12
  67. package/apps/agents-server/src/components/Homepage/DeletedAgentsList.tsx +50 -0
  68. package/apps/agents-server/src/components/LayoutWrapper/LayoutWrapper.tsx +3 -2
  69. package/apps/agents-server/src/components/LoginForm/LoginForm.tsx +50 -1
  70. package/apps/agents-server/src/components/NotFoundPage/NotFoundPage.tsx +7 -2
  71. package/apps/agents-server/src/components/OpenMojiIcon/OpenMojiIcon.tsx +16 -7
  72. package/apps/agents-server/src/components/PrintHeader/PrintHeader.tsx +4 -4
  73. package/apps/agents-server/src/components/RegisterUserDialog/RegisterUserDialog.tsx +61 -0
  74. package/apps/agents-server/src/components/_utils/headlessParam.tsx +7 -3
  75. package/apps/agents-server/src/database/metadataDefaults.ts +19 -1
  76. package/apps/agents-server/src/database/migrations/2025-12-0240-agent-public-id.sql +3 -0
  77. package/apps/agents-server/src/database/migrations/2025-12-0360-agent-deleted-at.sql +1 -0
  78. package/apps/agents-server/src/database/migrations/2025-12-0370-image-table.sql +19 -0
  79. package/apps/agents-server/src/database/migrations/2025-12-0380-agent-visibility.sql +1 -0
  80. package/apps/agents-server/src/database/migrations/2025-12-0390-upload-tracking.sql +20 -0
  81. package/apps/agents-server/src/database/migrations/2025-12-0401-file-upload-status.sql +13 -0
  82. package/apps/agents-server/src/database/migrations/2025-12-0640-openai-assistant-cache.sql +12 -0
  83. package/apps/agents-server/src/database/schema.ts +109 -0
  84. package/apps/agents-server/src/generated/reservedPaths.ts +32 -0
  85. package/apps/agents-server/src/middleware.ts +19 -23
  86. package/apps/agents-server/src/tools/$provideCdnForServer.ts +6 -1
  87. package/apps/agents-server/src/utils/auth.ts +117 -17
  88. package/apps/agents-server/src/utils/cdn/classes/TrackedFilesStorage.ts +57 -0
  89. package/apps/agents-server/src/utils/cdn/classes/VercelBlobStorage.ts +4 -0
  90. package/apps/agents-server/src/utils/cdn/interfaces/IFilesStorage.ts +18 -0
  91. package/apps/agents-server/src/utils/getUserIdFromRequest.ts +35 -0
  92. package/apps/agents-server/src/utils/handleChatCompletion.ts +65 -5
  93. package/apps/agents-server/src/utils/normalization/filenameToPrompt.ts +21 -0
  94. package/apps/agents-server/src/utils/validateApiKey.ts +7 -11
  95. package/esm/index.es.js +194 -34
  96. package/esm/index.es.js.map +1 -1
  97. package/esm/typings/src/_packages/types.index.d.ts +8 -2
  98. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +6 -1
  99. package/esm/typings/src/book-components/Chat/Chat/ChatMessageItem.d.ts +5 -1
  100. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
  101. package/esm/typings/src/book-components/Chat/CodeBlock/CodeBlock.d.ts +13 -0
  102. package/esm/typings/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +1 -0
  103. package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +7 -11
  104. package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +2 -2
  105. package/esm/typings/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +56 -0
  106. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +13 -7
  107. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +6 -0
  108. package/esm/typings/src/commitments/DICTIONARY/DICTIONARY.d.ts +46 -0
  109. package/esm/typings/src/commitments/index.d.ts +2 -1
  110. package/esm/typings/src/llm-providers/ollama/OllamaExecutionTools.d.ts +1 -1
  111. package/esm/typings/src/llm-providers/openai/createOpenAiCompatibleExecutionTools.d.ts +1 -1
  112. package/esm/typings/src/types/Message.d.ts +49 -0
  113. package/esm/typings/src/types/typeAliases.d.ts +12 -0
  114. package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +4 -4
  115. package/esm/typings/src/utils/environment/$isRunningInBrowser.d.ts +1 -1
  116. package/esm/typings/src/utils/environment/$isRunningInJest.d.ts +1 -1
  117. package/esm/typings/src/utils/environment/$isRunningInNode.d.ts +1 -1
  118. package/esm/typings/src/utils/environment/$isRunningInWebWorker.d.ts +1 -1
  119. package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +2 -2
  120. package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +2 -2
  121. package/esm/typings/src/utils/random/$randomBase58.d.ts +12 -0
  122. package/esm/typings/src/version.d.ts +1 -1
  123. package/package.json +1 -1
  124. package/umd/index.umd.js +200 -40
  125. package/umd/index.umd.js.map +1 -1
  126. package/apps/agents-server/package-lock.json +0 -27
  127. package/apps/agents-server/public/fonts/download-font.js +0 -22
  128. package/apps/agents-server/src/components/PrintButton/PrintButton.tsx +0 -18
@@ -5,35 +5,67 @@
5
5
  /**
6
6
  * OpenMoji black and white CSS
7
7
  *
8
- * https://github.com/hfg-gmuend/openmoji/blob/master/font/OpenMoji-black-glyf/openmoji.css
8
+ * https://github.com/hfg-gmuend/openmoji/blob/master/font/OpenMoji-black-glyf
9
9
  */
10
10
  @font-face {
11
11
  font-family: 'OpenMojiBlack';
12
12
  src: url('/fonts/OpenMoji-black-glyf.woff2') format('woff2');
13
- unicode-range: U+23, U+2A, U+2D, U+30-39, U+A9, U+AE, U+200D, U+203C, U+2049, U+20E3, U+2117, U+2120, U+2122,
14
- U+2139, U+2194-2199, U+21A9, U+21AA, U+229C, U+231A, U+231B, U+2328, U+23CF, U+23E9-23F3, U+23F8-23FE, U+24C2,
15
- U+25A1, U+25AA-25AE, U+25B6, U+25C0, U+25C9, U+25D0, U+25D1, U+25E7-25EA, U+25ED, U+25EE, U+25FB-25FE,
16
- U+2600-2605, U+260E, U+2611, U+2614, U+2615, U+2618, U+261D, U+2620, U+2622, U+2623, U+2626, U+262A, U+262E,
17
- U+262F, U+2638-263A, U+2640, U+2642, U+2648-2653, U+265F, U+2660, U+2663, U+2665, U+2666, U+2668, U+267B,
18
- U+267E, U+267F, U+2691-2697, U+2699, U+269B, U+269C, U+26A0, U+26A1, U+26A7, U+26AA, U+26AB, U+26B0, U+26B1,
19
- U+26BD, U+26BE, U+26C4, U+26C5, U+26C8, U+26CE, U+26CF, U+26D1, U+26D3, U+26D4, U+26E9, U+26EA, U+26F0-26F5,
20
- U+26F7-26FA, U+26FD, U+2702, U+2705, U+2708-270D, U+270F, U+2712, U+2714, U+2716, U+271D, U+2721, U+2728,
21
- U+2733, U+2734, U+2744, U+2747, U+274C, U+274E, U+2753-2755, U+2757, U+2763, U+2764, U+2795-2797, U+27A1,
22
- U+27B0, U+27BF, U+2934, U+2935, U+2B05-2B07, U+2B0C, U+2B0D, U+2B1B, U+2B1C, U+2B1F-2B24, U+2B2E, U+2B2F,
23
- U+2B50, U+2B55, U+2B58, U+2B8F, U+2BBA-2BBC, U+2BC3, U+2BC4, U+2BEA, U+2BEB, U+3030, U+303D, U+3297, U+3299,
24
- U+E000-E009, U+E010, U+E011, U+E040-E06D, U+E080-E0B4, U+E0C0-E0CC, U+E0FF-E10D, U+E140-E14A, U+E150-E157,
25
- U+E181-E189, U+E1C0-E1C4, U+E1C6-E1D9, U+E200-E216, U+E240-E269, U+E280-E283, U+E2C0-E2C4, U+E2C6-E2DA,
26
- U+E300-E303, U+E305-E30F, U+E312-E316, U+E318-E322, U+E324-E329, U+E32B, U+E340-E348, U+E380, U+E381, U+F000,
27
- U+F77A, U+F8FF, U+FE0F, U+1F004, U+1F0CF, U+1F10D-1F10F, U+1F12F, U+1F16D-1F171, U+1F17E, U+1F17F, U+1F18E,
28
- U+1F191-1F19A, U+1F1E6-1F1FF, U+1F201, U+1F202, U+1F21A, U+1F22F, U+1F232-1F23A, U+1F250, U+1F251,
29
- U+1F260-1F265, U+1F300-1F321, U+1F324-1F393, U+1F396, U+1F397, U+1F399-1F39B, U+1F39E-1F3F0, U+1F3F3-1F3F5,
30
- U+1F3F7-1F4FD, U+1F4FF-1F53D, U+1F549-1F54E, U+1F550-1F567, U+1F56F, U+1F570, U+1F573-1F57A, U+1F587,
31
- U+1F58A-1F58D, U+1F590, U+1F595, U+1F596, U+1F5A4, U+1F5A5, U+1F5A8, U+1F5B1, U+1F5B2, U+1F5BC, U+1F5C2-1F5C4,
32
- U+1F5D1-1F5D3, U+1F5DC-1F5DE, U+1F5E1, U+1F5E3, U+1F5E8, U+1F5EF, U+1F5F3, U+1F5FA-1F64F, U+1F680-1F6C5,
33
- U+1F6CB-1F6D2, U+1F6D5-1F6D7, U+1F6DC-1F6E5, U+1F6E9, U+1F6EB, U+1F6EC, U+1F6F0, U+1F6F3-1F6FC, U+1F7E0-1F7EB,
34
- U+1F7F0, U+1F90C-1F93A, U+1F93C-1F945, U+1F947-1F9FF, U+1FA70-1FA7C, U+1FA80-1FA88, U+1FA90-1FABD,
35
- U+1FABF-1FAC5, U+1FACE-1FADB, U+1FAE0-1FAE8, U+1FAF0-1FAF8, U+1FBC5-1FBC9, U+E0061-E0067, U+E0069,
36
- U+E006C-E0079, U+E007F;
13
+ unicode-range: U+23, U+2A, U+2D, U+30-39, U+A9, U+AE, U+200D, U+203C, U+2049, U+20E3, U+2117, U+2120, U+2122, U+2139,
14
+ U+2194-2199, U+21A9, U+21AA, U+229C, U+231A, U+231B, U+2328, U+23CF, U+23E9-23F3, U+23F8-23FE, U+24C2, U+25A1,
15
+ U+25AA-25AE, U+25B6, U+25C0, U+25C9, U+25D0, U+25D1, U+25E7-25EA, U+25ED, U+25EE, U+25FB-25FE, U+2600-2605,
16
+ U+260E, U+2611, U+2614, U+2615, U+2618, U+261D, U+2620, U+2622, U+2623, U+2626, U+262A, U+262E, U+262F,
17
+ U+2638-263A, U+2640, U+2642, U+2648-2653, U+265F, U+2660, U+2663, U+2665, U+2666, U+2668, U+267B, U+267E, U+267F,
18
+ U+2691-2697, U+2699, U+269B, U+269C, U+26A0, U+26A1, U+26A7, U+26AA, U+26AB, U+26B0, U+26B1, U+26BD, U+26BE,
19
+ U+26C4, U+26C5, U+26C8, U+26CE, U+26CF, U+26D1, U+26D3, U+26D4, U+26E9, U+26EA, U+26F0-26F5, U+26F7-26FA, U+26FD,
20
+ U+2702, U+2705, U+2708-270D, U+270F, U+2712, U+2714, U+2716, U+271D, U+2721, U+2728, U+2733, U+2734, U+2744,
21
+ U+2747, U+274C, U+274E, U+2753-2755, U+2757, U+2763, U+2764, U+2795-2797, U+27A1, U+27B0, U+27BF, U+2934, U+2935,
22
+ U+2B05-2B07, U+2B0C, U+2B0D, U+2B1B, U+2B1C, U+2B1F-2B24, U+2B2E, U+2B2F, U+2B50, U+2B55, U+2B58, U+2B8F,
23
+ U+2BBA-2BBC, U+2BC3, U+2BC4, U+2BEA, U+2BEB, U+3030, U+303D, U+3297, U+3299, U+E000-E009, U+E010, U+E011,
24
+ U+E040-E06D, U+E080-E0B4, U+E0C0-E0CC, U+E0FF-E10D, U+E140-E14A, U+E150-E157, U+E181-E189, U+E1C0-E1C4,
25
+ U+E1C6-E1D9, U+E200-E216, U+E240-E269, U+E280-E283, U+E2C0-E2C4, U+E2C6-E2DA, U+E300-E303, U+E305-E30F,
26
+ U+E312-E316, U+E318-E322, U+E324-E329, U+E32B, U+E340-E348, U+E380, U+E381, U+F000, U+F77A, U+F8FF, U+FE0F,
27
+ U+1F004, U+1F0CF, U+1F10D-1F10F, U+1F12F, U+1F16D-1F171, U+1F17E, U+1F17F, U+1F18E, U+1F191-1F19A, U+1F1E6-1F1FF,
28
+ U+1F201, U+1F202, U+1F21A, U+1F22F, U+1F232-1F23A, U+1F250, U+1F251, U+1F260-1F265, U+1F300-1F321, U+1F324-1F393,
29
+ U+1F396, U+1F397, U+1F399-1F39B, U+1F39E-1F3F0, U+1F3F3-1F3F5, U+1F3F7-1F4FD, U+1F4FF-1F53D, U+1F549-1F54E,
30
+ U+1F550-1F567, U+1F56F, U+1F570, U+1F573-1F57A, U+1F587, U+1F58A-1F58D, U+1F590, U+1F595, U+1F596, U+1F5A4,
31
+ U+1F5A5, U+1F5A8, U+1F5B1, U+1F5B2, U+1F5BC, U+1F5C2-1F5C4, U+1F5D1-1F5D3, U+1F5DC-1F5DE, U+1F5E1, U+1F5E3,
32
+ U+1F5E8, U+1F5EF, U+1F5F3, U+1F5FA-1F64F, U+1F680-1F6C5, U+1F6CB-1F6D2, U+1F6D5-1F6D7, U+1F6DC-1F6E5, U+1F6E9,
33
+ U+1F6EB, U+1F6EC, U+1F6F0, U+1F6F3-1F6FC, U+1F7E0-1F7EB, U+1F7F0, U+1F90C-1F93A, U+1F93C-1F945, U+1F947-1F9FF,
34
+ U+1FA70-1FA7C, U+1FA80-1FA88, U+1FA90-1FABD, U+1FABF-1FAC5, U+1FACE-1FADB, U+1FAE0-1FAE8, U+1FAF0-1FAF8,
35
+ U+1FBC5-1FBC9, U+E0061-E0067, U+E0069, U+E006C-E0079, U+E007F;
36
+ }
37
+
38
+ /**
39
+ * OpenMoji color CSS
40
+ *
41
+ * https://github.com/hfg-gmuend/openmoji/tree/master/font/OpenMoji-color-cbdt
42
+ */
43
+ @font-face {
44
+ font-family: 'OpenMojiColor';
45
+ src: url('/fonts/OpenMoji-color-cbdt.woff2') format('woff2');
46
+ unicode-range: U+23, U+2A, U+2D, U+30-39, U+A9, U+AE, U+200D, U+203C, U+2049, U+20E3, U+2117, U+2120, U+2122, U+2139,
47
+ U+2194-2199, U+21A9, U+21AA, U+229C, U+231A, U+231B, U+2328, U+23CF, U+23E9-23F3, U+23F8-23FE, U+24C2, U+25A1,
48
+ U+25AA-25AE, U+25B6, U+25C0, U+25C9, U+25D0, U+25D1, U+25E7-25EA, U+25ED, U+25EE, U+25FB-25FE, U+2600-2605,
49
+ U+260E, U+2611, U+2614, U+2615, U+2618, U+261D, U+2620, U+2622, U+2623, U+2626, U+262A, U+262E, U+262F,
50
+ U+2638-263A, U+2640, U+2642, U+2648-2653, U+265F, U+2660, U+2663, U+2665, U+2666, U+2668, U+267B, U+267E, U+267F,
51
+ U+2691-2697, U+2699, U+269B, U+269C, U+26A0, U+26A1, U+26A7, U+26AA, U+26AB, U+26B0, U+26B1, U+26BD, U+26BE,
52
+ U+26C4, U+26C5, U+26C8, U+26CE, U+26CF, U+26D1, U+26D3, U+26D4, U+26E9, U+26EA, U+26F0-26F5, U+26F7-26FA, U+26FD,
53
+ U+2702, U+2705, U+2708-270D, U+270F, U+2712, U+2714, U+2716, U+271D, U+2721, U+2728, U+2733, U+2734, U+2744,
54
+ U+2747, U+274C, U+274E, U+2753-2755, U+2757, U+2763, U+2764, U+2795-2797, U+27A1, U+27B0, U+27BF, U+2934, U+2935,
55
+ U+2B05-2B07, U+2B0C, U+2B0D, U+2B1B, U+2B1C, U+2B1F-2B24, U+2B2E, U+2B2F, U+2B50, U+2B55, U+2B58, U+2B8F,
56
+ U+2BBA-2BBC, U+2BC3, U+2BC4, U+2BEA, U+2BEB, U+3030, U+303D, U+3297, U+3299, U+E000-E009, U+E010, U+E011,
57
+ U+E040-E06D, U+E080-E0B4, U+E0C0-E0CC, U+E0FF-E10D, U+E140-E14A, U+E150-E157, U+E181-E189, U+E1C0-E1C4,
58
+ U+E1C6-E1D9, U+E200-E216, U+E240-E269, U+E280-E283, U+E2C0-E2C4, U+E2C6-E2DA, U+E300-E303, U+E305-E30F,
59
+ U+E312-E316, U+E318-E322, U+E324-E329, U+E32B, U+E340-E348, U+E380, U+E381, U+F000, U+F77A, U+F8FF, U+FE0F,
60
+ U+1F004, U+1F0CF, U+1F10D-1F10F, U+1F12F, U+1F16D-1F171, U+1F17E, U+1F17F, U+1F18E, U+1F191-1F19A, U+1F1E6-1F1FF,
61
+ U+1F201, U+1F202, U+1F21A, U+1F22F, U+1F232-1F23A, U+1F250, U+1F251, U+1F260-1F265, U+1F300-1F321, U+1F324-1F393,
62
+ U+1F396, U+1F397, U+1F399-1F39B, U+1F39E-1F3F0, U+1F3F3-1F3F5, U+1F3F7-1F4FD, U+1F4FF-1F53D, U+1F549-1F54E,
63
+ U+1F550-1F567, U+1F56F, U+1F570, U+1F573-1F57A, U+1F587, U+1F58A-1F58D, U+1F590, U+1F595, U+1F596, U+1F5A4,
64
+ U+1F5A5, U+1F5A8, U+1F5B1, U+1F5B2, U+1F5BC, U+1F5C2-1F5C4, U+1F5D1-1F5D3, U+1F5DC-1F5DE, U+1F5E1, U+1F5E3,
65
+ U+1F5E8, U+1F5EF, U+1F5F3, U+1F5FA-1F64F, U+1F680-1F6C5, U+1F6CB-1F6D2, U+1F6D5-1F6D7, U+1F6DC-1F6E5, U+1F6E9,
66
+ U+1F6EB, U+1F6EC, U+1F6F0, U+1F6F3-1F6FC, U+1F7E0-1F7EB, U+1F7F0, U+1F90C-1F93A, U+1F93C-1F945, U+1F947-1F9FF,
67
+ U+1FA70-1FA7C, U+1FA80-1FA88, U+1FA90-1FABD, U+1FABF-1FAC5, U+1FACE-1FADB, U+1FAE0-1FAE8, U+1FAF0-1FAF8,
68
+ U+1FBC5-1FBC9, U+E0061-E0067, U+E0069, U+E006C-E0079, U+E007F;
37
69
  }
38
70
 
39
71
  :root {
@@ -201,7 +233,7 @@ textarea:focus-visible {
201
233
  /* Print styles */
202
234
  @media print {
203
235
  @page {
204
- margin: 2cm;
236
+ margin: 1cm;
205
237
  }
206
238
 
207
239
  /* Hide UI elements */
@@ -211,7 +243,7 @@ textarea:focus-visible {
211
243
  aside,
212
244
  button:not(.print:block),
213
245
  .no-print,
214
- [role="complementary"],
246
+ [role='complementary'],
215
247
  #portal-root {
216
248
  display: none !important;
217
249
  }
@@ -227,6 +259,14 @@ textarea:focus-visible {
227
259
  color: black !important;
228
260
  }
229
261
 
262
+ /* Remove container padding for full width printing */
263
+ .container {
264
+ padding-left: 0 !important;
265
+ padding-right: 0 !important;
266
+ max-width: none !important;
267
+ width: 100% !important;
268
+ }
269
+
230
270
  /* Remove shadows and backgrounds for clean print */
231
271
  * {
232
272
  box-shadow: none !important;
@@ -236,10 +276,66 @@ textarea:focus-visible {
236
276
  }
237
277
 
238
278
  /* Ensure text visibility */
239
- h1, h2, h3, h4, h5, h6, p, li, span, div {
279
+ h1,
280
+ h2,
281
+ h3,
282
+ h4,
283
+ h5,
284
+ h6,
285
+ p,
286
+ li,
287
+ span,
288
+ div {
240
289
  color: black !important;
241
290
  }
242
291
 
292
+ /* Optimize typography for print */
293
+ .prose {
294
+ font-size: 11pt !important;
295
+ line-height: 1.4 !important;
296
+ max-width: 100% !important;
297
+ }
298
+
299
+ .prose h1 {
300
+ font-size: 22pt !important;
301
+ margin-bottom: 0.5rem !important;
302
+ margin-top: 0 !important;
303
+ line-height: 1.2 !important;
304
+ }
305
+
306
+ .prose h2 {
307
+ font-size: 16pt !important;
308
+ margin-top: 1.5rem !important;
309
+ margin-bottom: 0.5rem !important;
310
+ padding-bottom: 0.25rem !important;
311
+ line-height: 1.3 !important;
312
+ }
313
+
314
+ .prose h3 {
315
+ font-size: 14pt !important;
316
+ margin-top: 1rem !important;
317
+ margin-bottom: 0.5rem !important;
318
+ line-height: 1.3 !important;
319
+ }
320
+
321
+ .prose p,
322
+ .prose ul,
323
+ .prose ol {
324
+ margin-bottom: 0.5rem !important;
325
+ margin-top: 0 !important;
326
+ }
327
+
328
+ .prose li {
329
+ margin-top: 0.2rem !important;
330
+ margin-bottom: 0.2rem !important;
331
+ }
332
+
333
+ .prose pre {
334
+ padding: 0.5rem !important;
335
+ margin-bottom: 0.75rem !important;
336
+ margin-top: 0.5rem !important;
337
+ }
338
+
243
339
  /* Links */
244
340
  a {
245
341
  text-decoration: underline;
@@ -247,30 +343,41 @@ textarea:focus-visible {
247
343
  }
248
344
 
249
345
  /* Preserve borders */
250
- .border, .border-b, .border-t, .border-l, .border-r {
346
+ .border,
347
+ .border-b,
348
+ .border-t,
349
+ .border-l,
350
+ .border-r {
251
351
  border-color: #ddd !important;
252
352
  }
253
353
 
254
354
  /* Page break control */
255
- h1, h2 {
355
+ h1,
356
+ h2 {
256
357
  break-after: avoid;
257
358
  page-break-after: avoid;
258
359
  }
259
360
 
260
- p, li, pre, code {
361
+ p,
362
+ li,
363
+ pre,
364
+ code {
261
365
  break-inside: avoid;
262
366
  page-break-inside: avoid;
263
367
  }
264
368
 
265
369
  /* Specific component overrides */
266
- .card, .bg-white {
370
+ .card,
371
+ .bg-white {
267
372
  border: none !important;
268
373
  }
269
374
 
270
375
  /* Code blocks */
271
- pre, code {
376
+ pre,
377
+ code {
272
378
  background-color: #f5f5f5 !important;
273
379
  border: 1px solid #ddd !important;
274
380
  white-space: pre-wrap !important;
381
+ font-size: 0.9em !important;
275
382
  }
276
383
  }
@@ -83,31 +83,36 @@ export default async function RootLayout({
83
83
  console.error('Failed to parse FOOTER_LINKS', error);
84
84
  }
85
85
 
86
- // Fetch federated servers and add to footerLinks
86
+ // Fetch federated servers and add to footerLinks (only if user is authenticated or SHOW_FEDERATED_SERVERS_PUBLICLY is true)
87
87
  let federatedServers: Array<{ url: string; title: string; logoUrl: string | null }> = [];
88
88
  try {
89
- const federatedServersRaw = await getFederatedServersFromMetadata();
90
- federatedServers = await Promise.all(
91
- federatedServersRaw.map(async (url: string) => {
92
- let logoUrl: string | null = null;
93
- try {
94
- // Try to fetch logo from metadata endpoint if available
95
- const res = await fetch(`${url}/api/metadata`);
96
- if (res.ok) {
97
- const meta = await res.json();
98
- logoUrl = meta.SERVER_LOGO_URL || null;
89
+ const showFederatedServersPublicly = ((await getMetadata('SHOW_FEDERATED_SERVERS_PUBLICLY')) || 'false') === 'true';
90
+
91
+ // Only show federated servers in footer if user is authenticated or if SHOW_FEDERATED_SERVERS_PUBLICLY is true
92
+ if (currentUser || showFederatedServersPublicly) {
93
+ const federatedServersRaw = await getFederatedServersFromMetadata();
94
+ federatedServers = await Promise.all(
95
+ federatedServersRaw.map(async (url: string) => {
96
+ let logoUrl: string | null = null;
97
+ try {
98
+ // Try to fetch logo from metadata endpoint if available
99
+ const res = await fetch(`${url}/api/metadata`);
100
+ if (res.ok) {
101
+ const meta = await res.json();
102
+ logoUrl = meta.SERVER_LOGO_URL || null;
103
+ }
104
+ } catch {
105
+ logoUrl = null;
99
106
  }
100
- } catch {
101
- logoUrl = null;
102
- }
103
- return {
104
- title: `Federated: ${new URL(url).hostname}`,
105
- url,
106
- logoUrl,
107
- };
108
- })
109
- );
110
- footerLinks = [...footerLinks, ...federatedServers];
107
+ return {
108
+ title: `Federated: ${new URL(url).hostname}`,
109
+ url,
110
+ logoUrl,
111
+ };
112
+ })
113
+ );
114
+ footerLinks = [...footerLinks, ...federatedServers];
115
+ }
111
116
  } catch (error) {
112
117
  console.error('Failed to fetch federated servers for footer', error);
113
118
  }
@@ -12,10 +12,13 @@ import { Section } from '../components/Homepage/Section';
12
12
  import { TechInfoCard } from '../components/Homepage/TechInfoCard';
13
13
  import { UsersList } from '../components/UsersList/UsersList';
14
14
  import VercelDeploymentCard from '../components/VercelDeploymentCard/VercelDeploymentCard';
15
+ import { $getTableName } from '../database/$getTableName';
16
+ import { $provideSupabaseForServer } from '../database/$provideSupabaseForServer';
15
17
  import { getLongRunningTask } from '../deamons/longRunningTask';
16
18
  import { $provideAgentCollectionForServer } from '../tools/$provideAgentCollectionForServer';
17
19
  import { $provideExecutionToolsForServer } from '../tools/$provideExecutionToolsForServer';
18
20
  import { $provideServer } from '../tools/$provideServer';
21
+ import { getCurrentUser } from '../utils/getCurrentUser';
19
22
  import { isUserAdmin } from '../utils/isUserAdmin';
20
23
 
21
24
  // Add calendar formats that include seconds
@@ -31,10 +34,55 @@ const calendarWithSeconds = {
31
34
  export default async function HomePage() {
32
35
  $sideEffect(/* Note: [🐶] This will ensure dynamic rendering of page and avoid Next.js pre-render */ headers());
33
36
 
37
+ const currentUser = await getCurrentUser();
34
38
  const isAdmin = await isUserAdmin(); /* <- TODO: [👹] Here should be user permissions */
35
39
 
36
40
  const collection = await $provideAgentCollectionForServer();
37
- const agents = await collection.listAgents();
41
+ const allAgents = await collection.listAgents();
42
+
43
+ // Filter agents based on visibility and user authentication
44
+ const supabase = $provideSupabaseForServer();
45
+ // const { tablePrefix } = await $provideServer();
46
+
47
+ // Get visibility for all agents
48
+ const visibilityResult = await supabase
49
+ .from(await $getTableName(`Agent`))
50
+ .select('agentName, visibility')
51
+ .is('deletedAt', null);
52
+
53
+ let agents: typeof allAgents;
54
+ if (visibilityResult.error) {
55
+ console.error('Error fetching agent visibility:', visibilityResult.error);
56
+ // Fallback to showing all agents if visibility fetch fails
57
+ agents = allAgents;
58
+ } else {
59
+ const visibilityMap = new Map(
60
+ visibilityResult.data.map((item: { agentName: string; visibility: 'PUBLIC' | 'PRIVATE' }) => [
61
+ item.agentName,
62
+ item.visibility,
63
+ ]),
64
+ );
65
+
66
+ // Filter agents based on user authentication and visibility
67
+ agents = allAgents
68
+ .filter((agent) => {
69
+ const visibility = visibilityMap.get(agent.agentName);
70
+ if (!visibility) return false; // If no visibility info, hide the agent
71
+
72
+ // Admins can see all agents
73
+ if (currentUser?.isAdmin) return true;
74
+
75
+ // Authenticated users can see PUBLIC and PRIVATE agents
76
+ if (currentUser) return true;
77
+
78
+ // Unauthenticated users can only see PUBLIC agents
79
+ return visibility === 'PUBLIC';
80
+ })
81
+ .map((agent) => ({
82
+ ...agent,
83
+ visibility: visibilityMap.get(agent.agentName) as 'PUBLIC' | 'PRIVATE',
84
+ }));
85
+ }
38
86
 
39
87
  const longRunningTask = getLongRunningTask();
40
88
 
@@ -52,9 +100,7 @@ export default async function HomePage() {
52
100
 
53
101
  {isAdmin && <UsersList allowCreate={false} />}
54
102
 
55
- {isAdmin && (
56
- <ModelsSection models={models} maxVisible={11} showViewAllLink />
57
- )}
103
+ {isAdmin && <ModelsSection models={models} maxVisible={11} showViewAllLink />}
58
104
 
59
105
  {isAdmin && (
60
106
  <>
@@ -2,25 +2,31 @@
2
2
 
3
3
  import { $provideAgentCollectionForServer } from '@/src/tools/$provideAgentCollectionForServer';
4
4
  import { revalidatePath } from 'next/cache';
5
+ import { isUserAdmin } from '../../utils/isUserAdmin';
5
6
 
6
7
  export async function restoreDeletedAgent(agentName: string) {
7
- const collection = await $provideAgentCollectionForServer();
8
-
9
- // Find the latest history item for this agent
10
- const history = await collection.listAgentHistory(agentName);
11
-
12
- if (history.length === 0) {
13
- throw new Error(`No history found for agent ${agentName}`);
8
+ if (!(await isUserAdmin())) {
9
+ throw new Error('You are not authorized to restore agents');
14
10
  }
15
-
16
- const latestVersion = history[0];
17
-
18
- if (!latestVersion) {
19
- throw new Error(`No history found for agent ${agentName}`);
11
+
12
+ const collection = await $provideAgentCollectionForServer();
13
+
14
+ await collection.restoreAgent(agentName);
15
+
16
+ revalidatePath('/recycle-bin');
17
+ revalidatePath(`/agents/${agentName}`);
18
+ revalidatePath('/');
19
+ }
20
+
21
+ export async function deleteAgent(agentName: string) {
22
+ if (!(await isUserAdmin())) {
23
+ throw new Error('You are not authorized to delete agents');
20
24
  }
21
25
 
22
- await collection.restoreAgent(latestVersion.id);
23
-
26
+ const collection = await $provideAgentCollectionForServer();
27
+
28
+ await collection.deleteAgent(agentName);
29
+
24
30
  revalidatePath('/recycle-bin');
25
31
  revalidatePath(`/agents/${agentName}`);
26
32
  revalidatePath('/');
@@ -1,7 +1,8 @@
1
1
  import { $provideAgentCollectionForServer } from '@/src/tools/$provideAgentCollectionForServer';
2
2
  import { TrashIcon } from 'lucide-react';
3
3
  import Link from 'next/link';
4
- import { RestoreAgentButton } from './RestoreAgentButton';
4
+ import { DeletedAgentsList } from '../../components/Homepage/DeletedAgentsList';
5
+ import { isUserAdmin } from '../../utils/isUserAdmin';
5
6
 
6
7
  export const metadata = {
7
8
  title: 'Recycle Bin',
@@ -10,49 +11,32 @@ export const metadata = {
10
11
  export default async function RecycleBinPage() {
11
12
  const collection = await $provideAgentCollectionForServer();
12
13
  const deletedAgents = await collection.listDeletedAgents();
14
+ const isAdmin = await isUserAdmin();
13
15
 
14
16
  return (
15
- <div className="container mx-auto p-6 max-w-4xl">
16
- <header className="flex items-center gap-4 mb-8">
17
- <div className="bg-red-100 p-3 rounded-full">
18
- <TrashIcon className="w-8 h-8 text-red-600" />
19
- </div>
20
- <div>
21
- <h1 className="text-3xl font-bold text-gray-900">Recycle Bin</h1>
22
- <p className="text-gray-600">Restore deleted agents from here.</p>
23
- </div>
24
- </header>
17
+ <div className="min-h-screen bg-gradient-to-br from-blue-50 via-white to-purple-50">
18
+ <div className="container mx-auto px-4 py-16">
19
+ <header className="flex items-center gap-4 mb-8">
20
+ <div className="bg-red-100 p-3 rounded-full">
21
+ <TrashIcon className="w-8 h-8 text-red-600" />
22
+ </div>
23
+ <div>
24
+ <h1 className="text-3xl font-bold text-gray-900">Recycle Bin</h1>
25
+ <p className="text-gray-600">Restore deleted agents from here.</p>
26
+ </div>
27
+ </header>
25
28
 
26
- {deletedAgents.length === 0 ? (
27
- <div className="text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300">
28
- <p className="text-gray-500 text-lg">Recycle bin is empty</p>
29
- <Link href="/" className="text-blue-600 hover:underline mt-2 inline-block">
30
- Go back to agents
31
- </Link>
32
- </div>
33
- ) : (
34
- <div className="grid gap-4">
35
- {deletedAgents.map((agentName) => (
36
- <div
37
- key={agentName}
38
- className="bg-white p-4 rounded-lg shadow-sm border border-gray-200 flex items-center justify-between hover:shadow-md transition-shadow"
39
- >
40
- <div className="flex items-center gap-3">
41
- <div className="w-10 h-10 bg-gray-100 rounded-full flex items-center justify-center text-gray-500 font-bold text-lg">
42
- {agentName.charAt(0).toUpperCase()}
43
- </div>
44
- <div>
45
- <h3 className="font-semibold text-lg text-gray-900">{agentName}</h3>
46
- <p className="text-sm text-gray-500">Deleted agent</p>
47
- </div>
48
- </div>
49
- <div className="flex gap-2">
50
- <RestoreAgentButton agentName={agentName} />
51
- </div>
52
- </div>
53
- ))}
54
- </div>
55
- )}
29
+ {deletedAgents.length === 0 ? (
30
+ <div className="text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300">
31
+ <p className="text-gray-500 text-lg">Recycle bin is empty</p>
32
+ <Link href="/" className="text-blue-600 hover:underline mt-2 inline-block">
33
+ Go back to agents
34
+ </Link>
35
+ </div>
36
+ ) : (
37
+ <DeletedAgentsList agents={deletedAgents} isAdmin={isAdmin} />
38
+ )}
39
+ </div>
56
40
  </div>
57
41
  );
58
42
  }
@@ -11,13 +11,16 @@ export async function GET() {
11
11
  const collection = await $provideAgentCollectionForServer();
12
12
 
13
13
  // Assume collection.listAgents() returns an array of agent names
14
- const agentNames = await collection.listAgents();
14
+ const agents = await collection.listAgents();
15
15
 
16
16
  // Get base URL from environment or config
17
17
  const baseUrl = NEXT_PUBLIC_SITE_URL?.href || process.env.PUBLIC_URL || 'https://ptbk.io';
18
18
 
19
- const urls = agentNames
20
- .map(({ agentName }) => `<url><loc>${baseUrl}agents/${encodeURIComponent(agentName)}</loc></url>`)
19
+ const urls = agents
20
+ .map(
21
+ ({ permanentId, agentName }) =>
22
+ `<url><loc>${baseUrl}agents/${encodeURIComponent(permanentId || agentName)}</loc></url>`,
23
+ )
21
24
  .join('\n');
22
25
 
23
26
  const xml = spaceTrim(
@@ -0,0 +1,14 @@
1
+ 'use client';
2
+
3
+ import dynamic from 'next/dynamic';
4
+ import 'swagger-ui-react/swagger-ui.css';
5
+
6
+ const SwaggerUI = dynamic(() => import('swagger-ui-react'), { ssr: false });
7
+
8
+ export default function SwaggerPage() {
9
+ return (
10
+ <div className="swagger-container bg-white min-h-screen">
11
+ <SwaggerUI url="/swagger.json" />
12
+ </div>
13
+ );
14
+ }