@bendyline/gezel-service 1.0.7 → 1.1.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 (237) hide show
  1. package/dist/bin/gezeld.js +6253 -3616
  2. package/dist/handboek-content/whats-new/1.26224.md +1 -0
  3. package/dist/handboek-content/whats-new/1.26226.md +1 -0
  4. package/dist/handboek-content/whats-new/1.26231.md +1 -0
  5. package/dist/handboek-content/whats-new/1.26234.md +1 -0
  6. package/dist/handboek-content/whats-new/1.26237.md +1 -0
  7. package/dist/handboek-content/whats-new/1.26244.md +2 -1
  8. package/dist/handboek-content/whats-new/1.26247.md +88 -0
  9. package/dist/handboek-content/whats-new/whats-new-index.md +1 -0
  10. package/dist/index-store/static-index-worker.js +17 -1
  11. package/dist/index.d.ts +473 -209
  12. package/dist/index.js +6251 -3614
  13. package/dist/memory/embed-worker.js +58 -2
  14. package/dist/memory/image-embed-worker.js +8 -0
  15. package/dist/providers/llama-cpp/gguf-metadata-worker.js +2 -0
  16. package/dist/providers/mlx/python/gezel_mlx_server.py +18 -18
  17. package/dist/ui/assets/AmbientDashboardCard-Cf5fi_fY.js +1 -0
  18. package/dist/ui/assets/{AudioEngineSettings-BDrNIGGm.js → AudioEngineSettings-D3L7HOHe.js} +1 -1
  19. package/dist/ui/assets/{BenchmarksView-CHyujjs8.js → BenchmarksView-B68hrLCl.js} +1 -1
  20. package/dist/ui/assets/CatalogBrowser-DEM9t7Es.js +1 -0
  21. package/dist/ui/assets/{ChannelsSettings-Be_W1mr8.js → ChannelsSettings-DtK_k0Ul.js} +1 -1
  22. package/dist/ui/assets/ChatTimelineView-CQ4Sf4Ip.js +7 -0
  23. package/dist/ui/assets/ConfirmDialog-Dt1ed4Fh.js +1 -0
  24. package/dist/ui/assets/ConnectedAppsPanel-Cl8LEkrt.js +1 -0
  25. package/dist/ui/assets/CraftbookEditor-DEQRlQ2p.js +1 -0
  26. package/dist/ui/assets/{CraftbookScriptEditorView-DXIZYZT3.js → CraftbookScriptEditorView-DhXkkIdK.js} +1 -1
  27. package/dist/ui/assets/{CraftbookTabContent-Bm7t_b37.js → CraftbookTabContent-_oIdpQTG.js} +1 -1
  28. package/dist/ui/assets/{CraftbookToolsetSetup-DTEA-3K3.js → CraftbookToolsetSetup-BKg136L1.js} +1 -1
  29. package/dist/ui/assets/{CraftbooksView-C4X99TTe.js → CraftbooksView-Dm2zH-nW.js} +2 -2
  30. package/dist/ui/assets/{DiffpackReviewView-ClcNxtmF.js → DiffpackReviewView-EFLGJnwr.js} +1 -1
  31. package/dist/ui/assets/DocumentDetail-ClDRj2N-.js +1 -0
  32. package/dist/ui/assets/DocumentsView-ny9oieg2.js +1 -0
  33. package/dist/ui/assets/DropdownMenu-S4d9-3j3.js +1 -0
  34. package/dist/ui/assets/Ds4Settings-CeWlm5Vf.js +1 -0
  35. package/dist/ui/assets/EmbeddedChat-Hjrrgpao.js +1 -0
  36. package/dist/ui/assets/{FaceRecognitionCard-D3hdc7uU.js → FaceRecognitionCard-D7ufKqjI.js} +1 -1
  37. package/dist/ui/assets/FileMapView-DRjf59RH.js +1 -0
  38. package/dist/ui/assets/{FoldersSettings-BcNzl4vT.js → FoldersSettings-DDUhaFio.js} +1 -1
  39. package/dist/ui/assets/GezelDetail-Cph6pVGb.js +1 -0
  40. package/dist/ui/assets/{GezelJsonEditor-fOvYclu9.js → GezelJsonEditor-7vDGyBib.js} +1 -1
  41. package/dist/ui/assets/{GezellenView-BTzhHrxi.js → GezellenView-DQhcO1CP.js} +1 -1
  42. package/dist/ui/assets/{GildeUpdatesCard-Bq6XEpLP.js → GildeUpdatesCard-UKKNm_U8.js} +1 -1
  43. package/dist/ui/assets/{GithubSignInChip-CnlTCG8G.js → GithubSignInChip-DjM3qZsL.js} +1 -1
  44. package/dist/ui/assets/{HandboekMediaProvider-BfQW8_Nr.js → HandboekMediaProvider-DixaXTAH.js} +1 -1
  45. package/dist/ui/assets/HandboekView-BeNQqho9.js +1 -0
  46. package/dist/ui/assets/HistoryView-E2szGNGS.js +1 -0
  47. package/dist/ui/assets/{HomeView-CB_5TJIp.css → HomeView-CNeqCFPc.css} +1 -1
  48. package/dist/ui/assets/HomeView-CkiS3DXy.js +1 -0
  49. package/dist/ui/assets/{ImageEngineSettings-BpMfQy4f.js → ImageEngineSettings-BCKT7Gvi.js} +1 -1
  50. package/dist/ui/assets/{ImageRecognitionSettings-Ct-7-Oas.js → ImageRecognitionSettings-DD6syFez.js} +1 -1
  51. package/dist/ui/assets/IncompleteDownloads-BiPaaahS.js +1 -0
  52. package/dist/ui/assets/InstallProgressRow-DyKOI4MU.js +1 -0
  53. package/dist/ui/assets/KnowledgeCatalogsCard-B132vzRa.js +1 -0
  54. package/dist/ui/assets/KnowledgeView-CtPuIlN4.js +1 -0
  55. package/dist/ui/assets/LlamaCppSettings-D6zHcu4W.js +1 -0
  56. package/dist/ui/assets/{MarkdownField-D-0Zw7gM.js → MarkdownField-CK8K3fzj.js} +1 -1
  57. package/dist/ui/assets/MemoriesTree-DzjXzIrM.js +1 -0
  58. package/dist/ui/assets/{MicrophoneSettings-BIaFxyY_.js → MicrophoneSettings-1FH83SCq.js} +1 -1
  59. package/dist/ui/assets/MlxSettings-BYxUqFnJ.js +1 -0
  60. package/dist/ui/assets/ModelPicker-DoXPfQkQ.js +1 -0
  61. package/dist/ui/assets/{NewScriptDialog-D-gkY8TS.js → NewScriptDialog-C5X-7PMt.js} +1 -1
  62. package/dist/ui/assets/NewTaskDialog-Cyqtmigv.js +2 -0
  63. package/dist/ui/assets/{OllamaSettings-oIE2Mech.js → OllamaSettings-DkjmA-sB.js} +1 -1
  64. package/dist/ui/assets/ProjectChat-YEqUME6k.js +5 -0
  65. package/dist/ui/assets/{ProjectConnectionsTab-BZqp-oKI.js → ProjectConnectionsTab-dFCJpW93.js} +1 -1
  66. package/dist/ui/assets/ProjectGitStatusBar-CjZxG54t.js +1 -0
  67. package/dist/ui/assets/{ProjectGithubView-w8suLCsA.js → ProjectGithubView-CQ4-tmPx.js} +1 -1
  68. package/dist/ui/assets/{ProjectMailTab-DGo7eyB8.js → ProjectMailTab-NaScsZJf.js} +1 -1
  69. package/dist/ui/assets/ProjectOverviewView-ChjxbQas.js +1 -0
  70. package/dist/ui/assets/{ProjectTimeline-DRe3D9qY.js → ProjectTimeline-BZpdCisR.js} +1 -1
  71. package/dist/ui/assets/ProjectsView-J77ECk6V.js +7 -0
  72. package/dist/ui/assets/{RecommendedBadge-BKiDixnB.js → RecommendedBadge-D0m68PAu.js} +1 -1
  73. package/dist/ui/assets/{RemoteServersPanel-DGyl6-Rg.js → RemoteServersPanel-BdLOoORu.js} +1 -1
  74. package/dist/ui/assets/ScriptEditorTabs-BFvIiDFZ.js +2 -0
  75. package/dist/ui/assets/ScriptEditorView-B09rm1vz.js +5 -0
  76. package/dist/ui/assets/{ScriptsView-WQc28TmQ.js → ScriptsView-BvNAJXpo.js} +1 -1
  77. package/dist/ui/assets/{SecurityComplianceSettings-DsMEA4J3.js → SecurityComplianceSettings-DzGOnptO.js} +1 -1
  78. package/dist/ui/assets/SessionSwitcher-6okzcxT7.js +1 -0
  79. package/dist/ui/assets/SettingsView-Dur4dLhW.js +3 -0
  80. package/dist/ui/assets/SquisqIntegration-6v3yNOIP.js +2 -0
  81. package/dist/ui/assets/{StorageCleanupDialog-DHqwyMZZ.js → StorageCleanupDialog-OQlomMJD.js} +1 -1
  82. package/dist/ui/assets/{StorageUsageCard-CdT6SU51.js → StorageUsageCard-f6c6qTbM.js} +1 -1
  83. package/dist/ui/assets/Tabs-jE0Z5Tzd.js +1 -0
  84. package/dist/ui/assets/TaskTabContent-0w3kAUWR.js +1 -0
  85. package/dist/ui/assets/TasksView-BVMT4BAY.js +1 -0
  86. package/dist/ui/assets/{TerminalCodeEditor-77pBm6f3.js → TerminalCodeEditor-DO7zLKy-.js} +2 -2
  87. package/dist/ui/assets/ToolsetsEditor-Bb1wD5mV.js +8 -0
  88. package/dist/ui/assets/TransformToolbarButton-BWYkEB0d.js +5 -0
  89. package/dist/ui/assets/UnrecognizedModels-HtdMZUqK.js +1 -0
  90. package/dist/ui/assets/{VideoEngineSettings-DzMeINuv.js → VideoEngineSettings-Dq8Nw_tK.js} +1 -1
  91. package/dist/ui/assets/{WorkspaceIndexPane-DU4yd4Ai.js → WorkspaceIndexPane-fpDz4MwZ.js} +1 -1
  92. package/dist/ui/assets/{api-BX5xXiFs.js → api-BPraLwsh.js} +1 -1
  93. package/dist/ui/assets/chat-thread-memory-Be48zsyG.js +1 -0
  94. package/dist/ui/assets/chunk-6ECMNUIP-DDVjPyfK.js +15 -0
  95. package/dist/ui/assets/{chunk-6N2J7C2B-B5QIrD9m.js → chunk-6N2J7C2B-CsppiLVr.js} +1 -1
  96. package/dist/ui/assets/{chunk-A6N6IN3I-DXok09eC.js → chunk-A6N6IN3I-ofeM4l8g.js} +1 -1
  97. package/dist/ui/assets/chunk-B7GEAZBI-Divd2h1k.js +1 -0
  98. package/dist/ui/assets/chunk-DXYWKZ52-BXcAlClu.js +1 -0
  99. package/dist/ui/assets/chunk-FLR2ARKC-D7wrvQgT.js +2 -0
  100. package/dist/ui/assets/chunk-IIQYS2YH-DKZhWMpn.js +1 -0
  101. package/dist/ui/assets/{chunk-ILCJ3WFD-WRukZ7R1.js → chunk-ILCJ3WFD-CLZxw4Ge.js} +3 -3
  102. package/dist/ui/assets/chunk-OBADJV7C-CDVOcmYt.js +1 -0
  103. package/dist/ui/assets/chunk-Q77KNJIN-BIDRf0aP.js +6 -0
  104. package/dist/ui/assets/chunk-S5PCVMKU-Df5XzhSE.js +6 -0
  105. package/dist/ui/assets/chunk-UBFT2CDQ-FexGDigd.js +31 -0
  106. package/dist/ui/assets/{chunk-USU6HTKB-D5FmDzJU.js → chunk-USU6HTKB-B_p-YcDp.js} +1 -1
  107. package/dist/ui/assets/chunk-VKXOZTYP-BoVvWSBR.js +5 -0
  108. package/dist/ui/assets/{chunk-6RQOV3B3-CwvKotJw.js → chunk-VPWPEMZJ-DRKoa_j0.js} +1 -1
  109. package/dist/ui/assets/{chunk-WATAOG4Y-DXg2lov5.js → chunk-WATAOG4Y-C1EXVPmG.js} +1 -1
  110. package/dist/ui/assets/{container-B7jJtK5V.js → container-Ce94efbg.js} +1 -1
  111. package/dist/ui/assets/csv-62UGQMzZ.js +1 -0
  112. package/dist/ui/assets/data-B2kHjlc5.js +1 -0
  113. package/dist/ui/assets/dist-B9-VrAP8.js +2 -0
  114. package/dist/ui/assets/dist-BaHut5iX.js +2 -0
  115. package/dist/ui/assets/dist-BqGwkOe5.js +225 -0
  116. package/dist/ui/assets/dist-ZnIgkoEi.js +4 -0
  117. package/dist/ui/assets/{dist-BHl1ZAVG.js → dist-l6uUFZMV.js} +2 -2
  118. package/dist/ui/assets/dist-pLLFUPO-.js +1 -0
  119. package/dist/ui/assets/{doc-s6H7T0IO.js → doc-Dr5K49bx.js} +28 -28
  120. package/dist/ui/assets/document-companion-BQk2kS0F.js +1 -0
  121. package/dist/ui/assets/document-import-QoM9UxJr.js +1 -0
  122. package/dist/ui/assets/docx-sXa1Rf41.js +2 -0
  123. package/dist/ui/assets/{epub-B98SgHBz.js → epub-RopMP0ec.js} +4 -4
  124. package/dist/ui/assets/{export-options-Bu-tI6og.js → export-options-f7PKjEBb.js} +1 -1
  125. package/dist/ui/assets/extract-UTAOG7LV-4WDRw1o4.js +1 -0
  126. package/dist/ui/assets/file-browser-c2tf4MIb.js +5 -0
  127. package/dist/ui/assets/html-BGVOMhkv.js +253 -0
  128. package/dist/ui/assets/icons-DWaUNQbT.js +1 -0
  129. package/dist/ui/assets/images-JLBFCDD4-6JitW0hD.js +1 -0
  130. package/dist/ui/assets/index-B8NcxqcR.css +1 -0
  131. package/dist/ui/assets/index-C0DYtvfg.js +34 -0
  132. package/dist/ui/assets/index-J8TOMdvV.js +2 -0
  133. package/dist/ui/assets/{infer-kCLH1C8z.js → infer-LEGOsu64.js} +2 -2
  134. package/dist/ui/assets/ironcalc-BAi5gOlE.js +3 -0
  135. package/dist/ui/assets/layouts-2A7QNF6Y-CVwP7noP.js +1 -0
  136. package/dist/ui/assets/{mail-link-CI6YD6k2.js → mail-link-DXkmCd5b.js} +1 -1
  137. package/dist/ui/assets/markdown-baseline-9B52XlX2.js +1 -0
  138. package/dist/ui/assets/{markdown-Bi9b5f5Y.js → markdown-ryKA_OmY.js} +1 -1
  139. package/dist/ui/assets/materialize-A34OZGEU-xNNKzytx.js +1 -0
  140. package/dist/ui/assets/model-inventory-ykSm_IT5.js +1 -0
  141. package/dist/ui/assets/{model-quantization-BDzrELN_.js → model-quantization-CLO7XLoF.js} +1 -1
  142. package/dist/ui/assets/{monaco-base-BiVSa1J-.js → monaco-base-B1H1U1Sw.js} +1 -1
  143. package/dist/ui/assets/{monaco-setup-UeltVkg_.js → monaco-setup-DjhrGQui.js} +1 -1
  144. package/dist/ui/assets/{new-project-meta-0xhggGA_.js → new-project-meta-_f9sfcRX.js} +1 -1
  145. package/dist/ui/assets/outside-in-D73N1g_b.js +3 -0
  146. package/dist/ui/assets/{pdf-DgTjy3rN.js → pdf-BOjVDlCK.js} +3 -3
  147. package/dist/ui/assets/{pending-drafts-YVW6X55O.js → pending-drafts-B11MKQ9R.js} +1 -1
  148. package/dist/ui/assets/{poppetje-Ce-02Aqi.js → poppetje-DLB8uevw.js} +2 -2
  149. package/dist/ui/assets/pptx-BuxyNxQh.js +6 -0
  150. package/dist/ui/assets/primitives-CWrGZpPI.js +41 -0
  151. package/dist/ui/assets/run-export-ChaMXrKS.js +23 -0
  152. package/dist/ui/assets/squisq-formats-aAdypXoy.js +1 -0
  153. package/dist/ui/assets/standalone-source-q_Zzd1bd.js +11 -0
  154. package/dist/ui/assets/storage-D8pE2zg0.js +1 -0
  155. package/dist/ui/assets/styles-BhnF3s2q.css +1 -0
  156. package/dist/ui/assets/styles-CKVKwqoQ.js +550 -0
  157. package/dist/ui/assets/table-fcouR4db.js +1 -0
  158. package/dist/ui/assets/{terminal-monaco-setup-DNoK2tN4.js → terminal-monaco-setup-BAzrVzeR.js} +1 -1
  159. package/dist/ui/assets/{useCompactLayout-BarJPYcv.js → useCompactLayout-Dtolvzye.js} +0 -0
  160. package/dist/ui/assets/{useCopilotAvailability-BH1nLXQI.js → useCopilotAvailability-3xZvKgTF.js} +1 -1
  161. package/dist/ui/assets/{useDiffpacks-CK8W_OD_.js → useDiffpacks-Dsnr0wtX.js} +1 -1
  162. package/dist/ui/assets/{useGitSync-DWxX5-7K.js → useGitSync-BCTptQsp.js} +1 -1
  163. package/dist/ui/assets/{useShowWorkInProgressFeatures-DwwviLRO.js → useShowWorkInProgressFeatures-BhDNuQiU.js} +1 -1
  164. package/dist/ui/assets/{useTotalRamBytes-WoN_mi-V.js → useTotalRamBytes-DIx-_pf8.js} +1 -1
  165. package/dist/ui/assets/wasm-DdxEDD2H.js +1 -0
  166. package/dist/ui/assets/wasm_bg-DW9Xt_vt.wasm +0 -0
  167. package/dist/ui/assets/xlsx-DyBGuAO1.js +4 -0
  168. package/dist/ui/index.html +19 -18
  169. package/package.json +11 -11
  170. package/dist/ui/assets/AmbientDashboardCard-C1Ee-FKZ.js +0 -1
  171. package/dist/ui/assets/CatalogBrowser-Bz8ZtxPn.js +0 -1
  172. package/dist/ui/assets/ChatTimelineView-Do9EryEH.js +0 -7
  173. package/dist/ui/assets/ConfirmDialog-BHFs6vmJ.js +0 -1
  174. package/dist/ui/assets/ConnectedAppsPanel-BtMayq0R.js +0 -1
  175. package/dist/ui/assets/CraftbookEditor-D5jTzWwF.js +0 -1
  176. package/dist/ui/assets/DocumentDetail-CPU51d04.js +0 -1
  177. package/dist/ui/assets/DocumentsView-B6OyjvJ0.js +0 -1
  178. package/dist/ui/assets/DropdownMenu-D5fCzIrh.js +0 -1
  179. package/dist/ui/assets/Ds4Settings-CrUM_KGP.js +0 -1
  180. package/dist/ui/assets/EmbeddedChat-ue9ia-WY.js +0 -1
  181. package/dist/ui/assets/FileMapView-CxvfDLGA.js +0 -1
  182. package/dist/ui/assets/GezelDetail-DHuqBK55.js +0 -1
  183. package/dist/ui/assets/HandboekView-CPnnyj29.js +0 -1
  184. package/dist/ui/assets/HistoryView-B4VAfEMe.js +0 -1
  185. package/dist/ui/assets/HomeView-ccH60J6f.js +0 -1
  186. package/dist/ui/assets/KnowledgeCatalogsCard-Bi5Rx9Iz.js +0 -1
  187. package/dist/ui/assets/KnowledgeView-DAwjwLZo.js +0 -1
  188. package/dist/ui/assets/LlamaCppSettings-Ceyk9pDP.js +0 -1
  189. package/dist/ui/assets/MemoriesTree-BKZEPJpm.js +0 -1
  190. package/dist/ui/assets/MlxSettings-CG3wfuc3.js +0 -1
  191. package/dist/ui/assets/ModelPicker-CCBVjLMS.js +0 -1
  192. package/dist/ui/assets/NewPathDialog-D4jnNBfP.js +0 -1
  193. package/dist/ui/assets/NewTaskDialog-Ox9D612Z.js +0 -2
  194. package/dist/ui/assets/ProjectChat-DMwKnkW-.js +0 -5
  195. package/dist/ui/assets/ProjectGitStatusBar-C6bkCSby.js +0 -1
  196. package/dist/ui/assets/ProjectOverviewView-NNwXd_QQ.js +0 -1
  197. package/dist/ui/assets/ProjectsView-SBPgYOq8.js +0 -7
  198. package/dist/ui/assets/ScriptEditorTabs-paocQ6dj.js +0 -2
  199. package/dist/ui/assets/ScriptEditorView-N9zSLqqi.js +0 -5
  200. package/dist/ui/assets/SessionSwitcher-C8te7YSe.js +0 -1
  201. package/dist/ui/assets/SettingsView-Brl4JQkW.js +0 -3
  202. package/dist/ui/assets/Tabs-BAY1Q79B.js +0 -1
  203. package/dist/ui/assets/TaskTabContent-CNPJ4DQj.js +0 -1
  204. package/dist/ui/assets/TasksView-DuMjFS8S.js +0 -1
  205. package/dist/ui/assets/ToolsetsEditor-BdxHnIBj.js +0 -8
  206. package/dist/ui/assets/TransformToolbarButton-CVg5nz36.js +0 -5
  207. package/dist/ui/assets/UnrecognizedModels-Cw9Ku_bW.js +0 -1
  208. package/dist/ui/assets/chat-thread-memory-CZGcwgGo.js +0 -1
  209. package/dist/ui/assets/chunk-6ECMNUIP-C1kohb1U.js +0 -15
  210. package/dist/ui/assets/chunk-AONELFLA-Cv2nS9ga.js +0 -1
  211. package/dist/ui/assets/chunk-IIQYS2YH-Dxg6MAfT.js +0 -1
  212. package/dist/ui/assets/chunk-MIKKUKOD-XIkmalSN.js +0 -31
  213. package/dist/ui/assets/chunk-NNJLSQPW-DJA6camf.js +0 -5
  214. package/dist/ui/assets/chunk-S5PCVMKU-DbCZ5AUH.js +0 -6
  215. package/dist/ui/assets/csv-xmd1_Aqd.js +0 -4
  216. package/dist/ui/assets/dist-BPx-FyRH.js +0 -222
  217. package/dist/ui/assets/dist-Bvo52IGx.js +0 -1
  218. package/dist/ui/assets/dist-D5aoNQwk.js +0 -2
  219. package/dist/ui/assets/docx-Cj4A9MhC.js +0 -2
  220. package/dist/ui/assets/extract-UTAOG7LV-C4b7ycaL.js +0 -1
  221. package/dist/ui/assets/file-browser-80qWoVju.js +0 -5
  222. package/dist/ui/assets/html-C9TlzI57.js +0 -253
  223. package/dist/ui/assets/icons-C9dD-bDi.js +0 -1
  224. package/dist/ui/assets/images-ESPQKVTW-D7SgdVJ_.js +0 -1
  225. package/dist/ui/assets/index-D1m4Wx8V.css +0 -1
  226. package/dist/ui/assets/index-DXWR4qW1.js +0 -34
  227. package/dist/ui/assets/layouts-2A7QNF6Y-De2t-YXl.js +0 -1
  228. package/dist/ui/assets/markdown-baseline-HMqF2ChK.js +0 -1
  229. package/dist/ui/assets/outside-in-BFVUUcLa.js +0 -3
  230. package/dist/ui/assets/pptx-6ChgUEf4.js +0 -6
  231. package/dist/ui/assets/primitives-DEsn1shf.js +0 -41
  232. package/dist/ui/assets/run-export-BrYhHj1O.js +0 -23
  233. package/dist/ui/assets/standalone-source-D6mbpa3h.js +0 -11
  234. package/dist/ui/assets/storage-fn4FCEVK.js +0 -1
  235. package/dist/ui/assets/styles-C0EoNJbk.css +0 -1
  236. package/dist/ui/assets/styles-CKr_yrbn.js +0 -541
  237. package/dist/ui/assets/xlsx-DH7sTb3W.js +0 -4
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{t as r}from"./api-BPraLwsh.js";import{d as i,l as a,m as o,p as s,s as c,y as l}from"./primitives-CWrGZpPI.js";import{a as u,i as ee,n as d,s as te,t as ne}from"./DropdownMenu-S4d9-3j3.js";import{t as re}from"./NewTaskDialog-Cyqtmigv.js";import{TaskTabContent as ie,n as f,t as p}from"./TaskTabContent-0w3kAUWR.js";var m=e(t(),1),h=n(),g=`gezel:tasks:selectedRef`,_=[{value:`one-time`,label:`One-time tasks`},{value:`scheduled`,label:`Scheduled tasks`},{value:`night-shift`,label:`Night Shift tasks`}];function v(e){return e.nightShift?.enabled?`night-shift`:e.origin?.kind===`system-job`||e.cron?`scheduled`:`one-time`}function ae(e,t){let n=new Set(e.filter(e=>!e.parentTaskRef&&v(e)===t).map(e=>e.ref)),r=!0;for(;r;){r=!1;for(let t of e)t.parentTaskRef&&n.has(t.parentTaskRef)&&!n.has(t.ref)&&(n.add(t.ref),r=!0)}return e.filter(e=>n.has(e.ref))}function oe(e){let t=new Map;for(let n of e)t.set(n.ref,n);let n=new Map,r=[];for(let i of e)if(i.parentTaskRef&&t.has(i.parentTaskRef)){let e=n.get(i.parentTaskRef);e?e.push(i):n.set(i.parentTaskRef,[i])}else r.push(i);for(let e of n.values())e.sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return r.map(e=>({parent:e,children:n.get(e.ref)??[]}))}function se(e){return e.nightShift?.enabled?`night-shift`:e.origin?.kind===`system-job`?`system`:e.spawnsCraftbook&&e.craftbook.steps.length===0?`template`:e.spawnsCraftbook&&e.fanout?.materializedAt?`coordinator`:e.cron?`cron`:e.parentTaskRef?`instance`:null}var ce=[{value:``,label:`All statuses`},{value:`active`,label:`Active`},{value:`draft`,label:`Ready to fire`},{value:`paused`,label:`Paused`},{value:`complete`,label:`Complete`},{value:`canceled`,label:`Canceled`}];function le({tasks:e,onTaskChanged:t}){let[n,i]=(0,m.useState)(!1),[a,o]=(0,m.useState)(null),[s,c]=(0,m.useState)(null),l=e.every(t=>t.status===e[0]?.status)?e[0]?.status??`draft`:`draft`,u=e.some(e=>e.origin?.kind===`system-job`)?p.filter(e=>e===`active`||e===`paused`):p,ee=async n=>{i(!0),o(null),c(null);let a=await Promise.allSettled(e.map(e=>e.status===`draft`&&n===`active`?r.activateTask(e.projectId,e.num,!1):r.setTaskStatus(e.projectId,e.num,n))),s=[];for(let e of a)e.status===`fulfilled`?t(e.value):s.push(e.reason instanceof Error?e.reason.message:String(e.reason));s.length>0?c(`Couldn't update ${s.length} of ${e.length} selected tasks. ${s[0]}`):o(`Updated ${e.length} tasks to ${n}.`),i(!1)};return(0,h.jsxs)(`div`,{className:`task-bulk-detail`,"data-testid":`task-bulk-detail`,children:[(0,h.jsxs)(`header`,{className:`task-bulk-header`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`span`,{className:`task-detail-ref`,children:[e.length,` tasks selected`]}),(0,h.jsx)(`h3`,{children:`Selected tasks`}),(0,h.jsx)(`p`,{children:`Change the status for every selected task.`})]}),(0,h.jsx)(f,{value:l,options:u,disabled:n,ariaLabel:`Set status for selected tasks`,onChange:e=>void ee(e)})]}),s&&(0,h.jsx)(`p`,{className:`error`,children:s}),a&&(0,h.jsx)(`output`,{className:`task-bulk-message`,children:a}),(0,h.jsx)(`ul`,{className:`task-bulk-list`,"aria-label":`Selected task titles`,children:e.map(e=>(0,h.jsxs)(`li`,{className:`task-bulk-item`,children:[(0,h.jsx)(`span`,{className:`task-status-dot task-status-${e.status}`,title:e.status,"aria-label":e.status}),(0,h.jsxs)(`span`,{className:`task-row-body`,children:[(0,h.jsx)(`strong`,{children:e.title}),(0,h.jsxs)(`span`,{className:`task-row-meta`,children:[(0,h.jsx)(`span`,{className:`task-ref`,children:e.ref}),(0,h.jsx)(`span`,{className:`task-bulk-current-status`,children:e.status})]})]})]},e.ref))})]})}function y({projectId:e}={}){let[t,n]=(0,m.useState)([]),[f,p]=(0,m.useState)([]),[y,b]=(0,m.useState)([]),[x,S]=(0,m.useState)(e??``),[C,ue]=(0,m.useState)(``),[w,de]=(0,m.useState)(``),[T,E]=(0,m.useState)(`one-time`),[D,O]=(0,m.useState)(null),[k,A]=(0,m.useState)(null),[j,fe]=(0,m.useState)(!1),[M,pe]=(0,m.useState)(()=>new Set),[N,me]=(0,m.useState)(()=>{try{return e===void 0?window.localStorage.getItem(g):null}catch{return null}}),[P,he]=(0,m.useState)(()=>N?new Set([N]):new Set),F=(0,m.useRef)(P),I=(0,m.useRef)(N),L=(0,m.useRef)(null),R=e!==void 0,z=(0,m.useCallback)((t,n)=>{if(F.current=t,he(t),O(null),me(n),e===void 0)try{n?window.localStorage.setItem(g,n):window.localStorage.removeItem(g)}catch{}},[e]),B=(0,m.useCallback)(e=>{I.current=e,z(new Set([e]),e)},[z]);(0,m.useEffect)(()=>{e!==void 0&&S(e)},[e]),(0,m.useEffect)(()=>{r.listProjects().then(e=>n(e.projects)).catch(()=>{}),r.listGezels().then(e=>p(e.gezels)).catch(()=>{})},[]);let V=(0,m.useCallback)(async()=>{try{let e={};C&&(e.status=C),w&&(e.assignee=w);let t=x?await r.listProjectTasks(x,e):await r.listTasks(e);b(t.tasks),A(null)}catch(e){A(e.message)}finally{fe(!0)}},[x,C,w]);(0,m.useEffect)(()=>{V()},[V]),(0,m.useEffect)(()=>{let e=window.setInterval(()=>void V(),4e3);return()=>window.clearInterval(e)},[V]);let H=(0,m.useCallback)(e=>{b(t=>t.map(t=>t.ref===e.ref?e:t))},[]),U=(0,m.useMemo)(()=>ae(y,T),[y,T]),W=(0,m.useMemo)(()=>oe(U),[U]),G=(0,m.useMemo)(()=>W.flatMap(e=>[e.parent,...M.has(e.parent.ref)?e.children:[]]),[W,M]),K=(0,m.useMemo)(()=>G.map(e=>e.ref),[G]);(0,m.useEffect)(()=>{if(K.length===0)return;let e=new Set(K),t=F.current,n=new Set([...t].filter(t=>e.has(t)));if(n.size===0){let e=K[0];e&&(I.current=e,z(new Set([e]),e));return}let r=n.size===t.size&&[...n].every(e=>t.has(e)),i=N&&n.has(N)?N:[...n].at(-1)??null;(!r||i!==N)&&z(n,i)},[z,K,N]);let q=(0,m.useCallback)((e,t)=>{let n=K.indexOf(e),r=K.indexOf(t);return n<0||r<0?[t]:K.slice(Math.min(n,r),Math.max(n,r)+1)},[K]),J=(0,m.useCallback)((e,t={})=>{let n=F.current,r;if(t.range&&I.current){let i=q(I.current,e);r=t.additive?new Set([...n,...i]):new Set(i)}else t.toggle?(r=new Set(n),r.has(e)?r.delete(e):r.add(e),I.current=e):(r=new Set([e]),I.current=e);let i=r.has(e)?e:N&&r.has(N)?N:[...r].at(-1)??null;z(r,i)},[z,q,N]),ge=(0,m.useCallback)((e,t)=>{if(t.button!==0)return;let n=t.ctrlKey||t.metaKey;J(e,{range:t.shiftKey,toggle:n&&!t.shiftKey,additive:n}),L.current=!n&&!t.shiftKey?{anchor:e,base:new Set}:null},[J]),_e=(0,m.useCallback)((e,t)=>{let n=L.current;if(!n||!(t.buttons&1))return;let r=new Set([...n.base,...q(n.anchor,e)]);z(r,e)},[z,q]);(0,m.useEffect)(()=>{let e=()=>{L.current=null};return window.addEventListener(`mouseup`,e),()=>window.removeEventListener(`mouseup`,e)},[]);let Y=e=>({"aria-pressed":P.has(e),onMouseDown:t=>ge(e,t),onMouseEnter:t=>_e(e,t),onClick:t=>{if(t.detail===0){let n=t.ctrlKey||t.metaKey;J(e,{range:t.shiftKey,toggle:n&&!t.shiftKey,additive:n})}}}),X=(0,m.useMemo)(()=>G.filter(e=>P.has(e.ref)),[G,P]),Z=(0,m.useMemo)(()=>{let e=new Map;for(let t of f)e.set(t.id,t.name);return t=>t?e.get(t)??t:``},[f]),Q=(0,m.useCallback)(e=>O(e),[]),ve=(0,m.useCallback)(async e=>{O(null),E(v(e)),await V(),B(e.ref)},[V,B]),ye=j&&U.length===0,$=!j||ye;return(0,h.jsxs)(`div`,{className:`tasks-view${e===void 0?` tasks-view-overall`:``}`,"data-testid":`tasks-view`,children:[(0,h.jsxs)(`header`,{className:`tasks-header`,children:[(0,h.jsx)(`div`,{className:`gz-tray tasks-kind-filter`,role:`radiogroup`,"aria-label":`Task type`,children:_.map(e=>(0,h.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":T===e.value,className:`gz-key${T===e.value?` gz-key-active`:``}`,onClick:()=>E(e.value),children:e.label},e.value))}),(0,h.jsxs)(`div`,{className:`tasks-filters`,children:[e===void 0&&(0,h.jsxs)(i,{value:x||`__ALL__`,onValueChange:e=>S(e===`__ALL__`?``:e),children:[(0,h.jsx)(s,{children:(0,h.jsx)(o,{})}),(0,h.jsxs)(c,{children:[(0,h.jsx)(a,{value:`__ALL__`,children:`All projects`}),t.map(e=>(0,h.jsx)(a,{value:e.id,children:e.name},e.id))]})]}),(0,h.jsxs)(i,{value:C||`__ALL__`,onValueChange:e=>ue(e===`__ALL__`?``:e),children:[(0,h.jsx)(s,{children:(0,h.jsx)(o,{})}),(0,h.jsx)(c,{children:ce.map(e=>(0,h.jsx)(a,{value:e.value||`__ALL__`,children:e.label},e.value||`__ALL__`))})]}),(0,h.jsxs)(i,{value:w||`__ALL__`,onValueChange:e=>de(e===`__ALL__`?``:e),children:[(0,h.jsx)(s,{children:(0,h.jsx)(o,{})}),(0,h.jsxs)(c,{children:[(0,h.jsx)(a,{value:`__ALL__`,children:`Any assignee`}),f.map(e=>(0,h.jsxs)(a,{value:e.id,children:[e.name,e.role?` — ${e.role}`:``]},e.id))]})]}),(0,h.jsxs)(`div`,{className:`tasks-create-split`,children:[(0,h.jsx)(`button`,{type:`button`,className:`primary tasks-create-main`,onClick:()=>Q(`one-time`),disabled:!(x||t[0]),children:`+ New task`}),(0,h.jsxs)(u,{children:[(0,h.jsx)(te,{asChild:!0,children:(0,h.jsx)(`button`,{type:`button`,className:`primary tasks-create-more`,"aria-label":`More task types`,disabled:!(x||t[0]),children:(0,h.jsx)(l,{})})}),(0,h.jsx)(ee,{children:(0,h.jsxs)(ne,{className:`app-nav-menu tasks-create-menu`,sideOffset:4,align:`end`,children:[(0,h.jsxs)(d,{className:`app-nav-menu-item`,onSelect:()=>Q(`scheduled`),children:[(0,h.jsx)(`span`,{children:`New scheduled task`}),(0,h.jsx)(`small`,{children:`Runs a fresh copy on a cadence`})]}),(0,h.jsxs)(d,{className:`app-nav-menu-item`,onSelect:()=>Q(`night-shift`),children:[(0,h.jsx)(`span`,{children:`New Night Shift task`}),(0,h.jsx)(`small`,{children:`Waits for the unattended work window`})]})]})})]})]})]})]}),k&&(0,h.jsx)(`p`,{className:`error`,children:k}),(0,h.jsxs)(`div`,{className:`tasks-layout`,children:[!j&&(0,h.jsx)(`output`,{className:`tasks-empty-state`,children:(0,h.jsx)(`p`,{children:`Loading tasks…`})}),ye&&(0,h.jsx)(`div`,{className:`tasks-empty-state`,children:!k&&(0,h.jsx)(`p`,{children:C||w?`No tasks match these filters.`:`No ${_.find(e=>e.value===T)?.label.toLowerCase()} have been created yet.`})}),(0,h.jsx)(`aside`,{className:`tasks-list`,hidden:$,children:(0,h.jsx)(`ul`,{"aria-label":`Tasks — use Control or Command to toggle and Shift to select a range`,children:W.map(e=>{let t=se(e.parent),n=M.has(e.parent.ref);return(0,h.jsxs)(`li`,{children:[(0,h.jsxs)(`div`,{className:`task-row-wrap`,children:[e.children.length>0&&(0,h.jsx)(`button`,{type:`button`,className:`task-expand`,"aria-label":n?`Collapse instances`:`Expand instances`,"aria-expanded":n,title:n?`Collapse instances`:`Expand instances`,onClick:()=>pe(t=>{let n=new Set(t);return n.has(e.parent.ref)?n.delete(e.parent.ref):n.add(e.parent.ref),n}),children:n?`▾`:`▸`}),(0,h.jsxs)(`button`,{type:`button`,className:`task-row${P.has(e.parent.ref)?` task-row-selected`:``}`,...Y(e.parent.ref),children:[(0,h.jsx)(`span`,{className:`task-status-dot task-status-${e.parent.status}`,title:e.parent.status,"aria-label":e.parent.status}),(0,h.jsxs)(`span`,{className:`task-row-body`,children:[(0,h.jsx)(`span`,{className:`task-title`,title:e.parent.title,children:e.parent.title}),(0,h.jsxs)(`span`,{className:`task-row-meta`,children:[(0,h.jsx)(`span`,{className:`task-ref`,children:R?e.parent.ref.split(`/`).pop()??e.parent.ref:e.parent.ref}),t&&(0,h.jsx)(`span`,{className:`task-badge task-badge-${t}`,children:t===`night-shift`?`night shift`:t}),e.children.length>0&&(0,h.jsxs)(`span`,{className:`task-child-count`,children:[e.children.length,` run`,e.children.length===1?``:`s`]}),(0,h.jsx)(`span`,{className:`task-assignee`,children:e.parent.origin?.kind===`system-job`&&e.parent.origin.managedByGezelId?`${Z(e.parent.origin.managedByGezelId)||`gezel`} · system`:e.parent.assignee.kind===`user`?`You`:Z(e.parent.assignee.gezelId)||`gezel`})]})]})]})]}),n&&e.children.length>0&&(0,h.jsx)(`ul`,{className:`task-children`,children:e.children.map(e=>(0,h.jsx)(`li`,{children:(0,h.jsxs)(`button`,{type:`button`,className:`task-row task-row-child${P.has(e.ref)?` task-row-selected`:``}`,...Y(e.ref),children:[(0,h.jsx)(`span`,{className:`task-status-dot task-status-${e.status}`,title:e.status,"aria-label":e.status}),(0,h.jsxs)(`span`,{className:`task-row-body`,children:[(0,h.jsx)(`span`,{className:`task-title`,title:e.title,children:e.title}),(0,h.jsxs)(`span`,{className:`task-row-meta`,children:[(0,h.jsx)(`span`,{className:`task-ref`,children:R?e.ref.split(`/`).pop()??e.ref:e.ref}),(0,h.jsx)(`span`,{className:`task-assignee`,children:e.origin?.kind===`system-job`&&e.origin.managedByGezelId?`${Z(e.origin.managedByGezelId)||`gezel`} · system`:e.assignee.kind===`user`?`You`:Z(e.assignee.gezelId)||`gezel`})]})]})]})},e.ref))})]},e.parent.ref)})})}),(0,h.jsx)(`section`,{className:`task-detail-panel`,hidden:$,children:X.length>1?(0,h.jsx)(le,{tasks:X,onTaskChanged:H}):N?(0,h.jsx)(ie,{taskRef:N,onTaskChanged:H},N):(0,h.jsx)(`p`,{className:`placeholder`,children:`Click a task to view it here.`})})]}),(0,h.jsx)(re,{open:D!==null,creationMode:D??`one-time`,defaultProjectId:x||t[0]?.id||``,projects:t,gezels:f,projectLocked:e!==void 0,onClose:()=>O(null),onCreated:ve})]})}export{y as TasksView};
@@ -1,3 +1,3 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/terminal-monaco-setup-DNoK2tN4.js","assets/api-BX5xXiFs.js","assets/rolldown-runtime-aKtaBQYM.js","assets/dist-D5aoNQwk.js","assets/dist-BPx-FyRH.js","assets/monaco-DeTXJU-n.js","assets/preload-helper-Czpn1I53.js","assets/chunk-V4NBQF5C-D9I4DV9v.js","assets/iconLabel-uMn49Ame.js","assets/iconLabel-Bdh_-Hrb.css","assets/codiconStyles-104B1IQ5.js","assets/codiconStyles-Bp1tMeMk.css","assets/editor.api-DShZZcgD.js","assets/editor-BOOlEWca.css","assets/monaco-Cvm179Eb.css","assets/completion-data--97asQiQ.js","assets/monaco-base-BiVSa1J-.js","assets/index-DXWR4qW1.js","assets/jsx-runtime-CEpd2cAX.js","assets/react-dom-OL4w_gzs.js","assets/primitives-DEsn1shf.js","assets/Tabs-BAY1Q79B.js","assets/dist-Bvo52IGx.js","assets/NewPathDialog-D4jnNBfP.js","assets/DropdownMenu-D5fCzIrh.js","assets/relative-time-B2kBaekd.js","assets/FileTypeIcon-Cwzl1GkZ.js","assets/model-memory-copy-CeuXAj-T.js","assets/model-context-DBqdK0PS.js","assets/StorageCleanupDialog-DHqwyMZZ.js","assets/poppetje-Ce-02Aqi.js","assets/safe-svg-image-NbuPaBIv.js","assets/ConfirmDialog-BHFs6vmJ.js","assets/doc-s6H7T0IO.js","assets/chunk-O7JILDEF-CqcO1qaI.js","assets/chunk-BAOV476U-CEOFYt8X.js","assets/chunk-4VOD55SX-BFSSw0c8.js","assets/chunk-GAZKTT4R-BkP6-w3z.js","assets/chunk-MIKKUKOD-XIkmalSN.js","assets/chunk-XRW6P7IF-BeQQgMVK.js","assets/chunk-7ZAAICW4-BsCpYJH6.js","assets/markdown-Bi9b5f5Y.js","assets/schemas-JY4jmLbC.js","assets/chunk-6ECMNUIP-C1kohb1U.js","assets/inlineIconMarker-BQI2HLeD.js","assets/chunk-TT6ENR6T-CaYjVwjm.js","assets/chunk-DAMIRKTO-CGniCSiM.js","assets/new-project-meta-0xhggGA_.js","assets/chunk-AE3IUKMM-mZjzzO8Z.js","assets/index-D1m4Wx8V.css"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{t as r}from"./preload-helper-Czpn1I53.js";import{ft as i}from"./index-DXWR4qW1.js";var a=e(t(),1),o=n();function s(e,t){let n=t.getLineCount(),r={lineNumber:n,column:t.getLineMaxColumn(n)};e.setPosition(r),e.revealPosition(r)}var c=(0,a.forwardRef)(function({projectId:e,initialValue:t,placeholder:n,className:c,onChange:l,onSubmit:u,onHistoryPrev:d,onHistoryNext:f,onChatEscape:p,onReady:m},h){let g=(0,a.useRef)(null),_=(0,a.useRef)(null),v=(0,a.useRef)(null),y=(0,a.useRef)(null),[,b]=(0,a.useState)(!1),x=i(),S=(0,a.useRef)(l),C=(0,a.useRef)(u),w=(0,a.useRef)(d),T=(0,a.useRef)(f),E=(0,a.useRef)(p),D=(0,a.useRef)(m);(0,a.useEffect)(()=>{S.current=l,C.current=u,w.current=d,T.current=f,E.current=p,D.current=m});let O=(0,a.useRef)(t),k=(0,a.useRef)(n),A=(0,a.useRef)(t.length),j=(0,a.useRef)(x);return j.current=x,(0,a.useEffect)(()=>{let t=!1,n=[];return(async()=>{let i;try{i=await r(()=>import(`./terminal-monaco-setup-DNoK2tN4.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49])),await i.ensureTerminalMonaco()}catch{return}if(t||!g.current)return;let a=i.monaco;_.current=a;let o=i.terminalModelUri(e);a.editor.getModel(o)?.dispose();let c=a.editor.createModel(O.current,`gezel-terminal`,o);y.current=c;let l=a.editor.create(g.current,{model:c,automaticLayout:!0,lineNumbers:`off`,glyphMargin:!1,folding:!1,minimap:{enabled:!1},lineDecorationsWidth:0,lineNumbersMinChars:0,renderLineHighlight:`none`,scrollBeyondLastLine:!1,overviewRulerLanes:0,hideCursorInOverviewRuler:!0,scrollbar:{vertical:`auto`,horizontal:`hidden`,verticalScrollbarSize:6,useShadows:!1},wordWrap:`on`,fontSize:13.6,fontFamily:`var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace)`,lineHeight:21,padding:{top:6,bottom:6},fixedOverflowWidgets:!0,quickSuggestions:{other:!0,comments:!1,strings:!0},suggestOnTriggerCharacters:!0,acceptSuggestionOnEnter:`off`,tabCompletion:`on`,contextmenu:!1,roundedSelection:!1,guides:{indentation:!1},renderWhitespace:`none`,occurrencesHighlight:`off`,matchBrackets:`never`});v.current=l,a.editor.setTheme(j.current===`dark`?`gezel-terminal-dark`:`gezel-terminal-light`),l.addCommand(a.KeyCode.Enter,()=>C.current(c.getValue())),l.addCommand(a.KeyMod.Shift|a.KeyCode.Enter,()=>l.trigger(`keyboard`,`type`,{text:`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/terminal-monaco-setup-BAzrVzeR.js","assets/api-BPraLwsh.js","assets/rolldown-runtime-aKtaBQYM.js","assets/dist-BaHut5iX.js","assets/dist-BqGwkOe5.js","assets/monaco-DeTXJU-n.js","assets/preload-helper-Czpn1I53.js","assets/chunk-V4NBQF5C-D9I4DV9v.js","assets/iconLabel-uMn49Ame.js","assets/iconLabel-Bdh_-Hrb.css","assets/codiconStyles-104B1IQ5.js","assets/codiconStyles-Bp1tMeMk.css","assets/editor.api-DShZZcgD.js","assets/editor-BOOlEWca.css","assets/monaco-Cvm179Eb.css","assets/completion-data--97asQiQ.js","assets/monaco-base-B1H1U1Sw.js","assets/index-C0DYtvfg.js","assets/jsx-runtime-CEpd2cAX.js","assets/react-dom-OL4w_gzs.js","assets/primitives-CWrGZpPI.js","assets/Tabs-jE0Z5Tzd.js","assets/document-companion-BQk2kS0F.js","assets/DropdownMenu-S4d9-3j3.js","assets/dist-pLLFUPO-.js","assets/relative-time-B2kBaekd.js","assets/FileTypeIcon-Cwzl1GkZ.js","assets/model-context-DBqdK0PS.js","assets/model-memory-copy-CeuXAj-T.js","assets/StorageCleanupDialog-OQlomMJD.js","assets/poppetje-DLB8uevw.js","assets/safe-svg-image-NbuPaBIv.js","assets/ConfirmDialog-Dt1ed4Fh.js","assets/model-inventory-ykSm_IT5.js","assets/doc-Dr5K49bx.js","assets/chunk-O7JILDEF-CqcO1qaI.js","assets/chunk-BAOV476U-CEOFYt8X.js","assets/chunk-4VOD55SX-BFSSw0c8.js","assets/chunk-GAZKTT4R-BkP6-w3z.js","assets/chunk-UBFT2CDQ-FexGDigd.js","assets/chunk-XRW6P7IF-BeQQgMVK.js","assets/chunk-7ZAAICW4-BsCpYJH6.js","assets/markdown-ryKA_OmY.js","assets/schemas-JY4jmLbC.js","assets/chunk-6ECMNUIP-DDVjPyfK.js","assets/inlineIconMarker-BQI2HLeD.js","assets/chunk-TT6ENR6T-CaYjVwjm.js","assets/chunk-DAMIRKTO-CGniCSiM.js","assets/new-project-meta-_f9sfcRX.js","assets/chunk-AE3IUKMM-mZjzzO8Z.js","assets/index-B8NcxqcR.css"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{t as r}from"./preload-helper-Czpn1I53.js";import{ht as i}from"./index-C0DYtvfg.js";var a=e(t(),1),o=n();function s(e,t){let n=t.getLineCount(),r={lineNumber:n,column:t.getLineMaxColumn(n)};e.setPosition(r),e.revealPosition(r)}var c=(0,a.forwardRef)(function({projectId:e,initialValue:t,placeholder:n,className:c,onChange:l,onSubmit:u,onHistoryPrev:d,onHistoryNext:f,onChatEscape:p,onReady:m},h){let g=(0,a.useRef)(null),_=(0,a.useRef)(null),v=(0,a.useRef)(null),y=(0,a.useRef)(null),[,b]=(0,a.useState)(!1),x=i(),S=(0,a.useRef)(l),C=(0,a.useRef)(u),w=(0,a.useRef)(d),T=(0,a.useRef)(f),E=(0,a.useRef)(p),D=(0,a.useRef)(m);(0,a.useEffect)(()=>{S.current=l,C.current=u,w.current=d,T.current=f,E.current=p,D.current=m});let O=(0,a.useRef)(t),k=(0,a.useRef)(n),A=(0,a.useRef)(t.length),j=(0,a.useRef)(x);return j.current=x,(0,a.useEffect)(()=>{let t=!1,n=[];return(async()=>{let i;try{i=await r(()=>import(`./terminal-monaco-setup-BAzrVzeR.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50])),await i.ensureTerminalMonaco()}catch{return}if(t||!g.current)return;let a=i.monaco;_.current=a;let o=i.terminalModelUri(e);a.editor.getModel(o)?.dispose();let c=a.editor.createModel(O.current,`gezel-terminal`,o);y.current=c;let l=a.editor.create(g.current,{model:c,automaticLayout:!0,lineNumbers:`off`,glyphMargin:!1,folding:!1,minimap:{enabled:!1},lineDecorationsWidth:0,lineNumbersMinChars:0,renderLineHighlight:`none`,scrollBeyondLastLine:!1,overviewRulerLanes:0,hideCursorInOverviewRuler:!0,scrollbar:{vertical:`auto`,horizontal:`hidden`,verticalScrollbarSize:6,useShadows:!1},wordWrap:`on`,fontSize:13.6,fontFamily:`var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace)`,lineHeight:21,padding:{top:6,bottom:6},fixedOverflowWidgets:!0,quickSuggestions:{other:!0,comments:!1,strings:!0},suggestOnTriggerCharacters:!0,acceptSuggestionOnEnter:`off`,tabCompletion:`on`,contextmenu:!1,roundedSelection:!1,guides:{indentation:!1},renderWhitespace:`none`,occurrencesHighlight:`off`,matchBrackets:`never`});v.current=l,a.editor.setTheme(j.current===`dark`?`gezel-terminal-dark`:`gezel-terminal-light`),l.addCommand(a.KeyCode.Enter,()=>C.current(c.getValue())),l.addCommand(a.KeyMod.Shift|a.KeyCode.Enter,()=>l.trigger(`keyboard`,`type`,{text:`
3
3
  `}));let u=l.createContextKey(`terminalAtFirstLine`,!0),d=l.createContextKey(`terminalAtLastLine`,!0),f=()=>{let e=l.getPosition();u.set(!e||e.lineNumber===1),d.set(!e||e.lineNumber===c.getLineCount())};f(),n.push(l.onDidChangeCursorPosition(f)),n.push(c.onDidChangeContent(f)),l.addCommand(a.KeyCode.UpArrow,()=>w.current(),`terminalAtFirstLine && !suggestWidgetVisible`),l.addCommand(a.KeyCode.DownArrow,()=>T.current(),`terminalAtLastLine && !suggestWidgetVisible`),n.push(c.onDidChangeContent(()=>{let e=c.getValue(),t=A.current;if(A.current=e.length,E.current&&t<=1&&e.startsWith(`@`)){E.current();return}S.current?.(e)}));let p=k.current;if(p){let e=document.createElement(`div`);e.className=`terminal-editor-placeholder`,e.textContent=p;let t={getId:()=>`gezel.terminal.placeholder`,getDomNode:()=>e,getPosition:()=>({position:{lineNumber:1,column:1},preference:[a.editor.ContentWidgetPositionPreference.EXACT]})},r=!1,i=()=>{let e=c.getValue()===``;e&&!r?(l.addContentWidget(t),r=!0):!e&&r&&(l.removeContentWidget(t),r=!1)};i(),n.push(c.onDidChangeContent(i)),n.push({dispose:()=>{r&&l.removeContentWidget(t)}})}l.focus(),s(l,c),b(!0),D.current?.()})(),()=>{t=!0;for(let e of n)e.dispose();v.current?.dispose(),v.current=null,y.current?.dispose(),y.current=null}},[e]),(0,a.useEffect)(()=>{_.current?.editor.setTheme(x===`dark`?`gezel-terminal-dark`:`gezel-terminal-light`)},[x]),(0,a.useImperativeHandle)(h,()=>({getValue:()=>y.current?.getValue()??``,setValue:e=>{let t=y.current,n=v.current;t&&(t.setValue(e),A.current=e.length,n&&s(n,t))},focus:()=>v.current?.focus()}),[]),(0,o.jsx)(`div`,{ref:g,className:c??`terminal-editor-host`,"data-testid":`terminal-editor`})});export{c as default};
@@ -0,0 +1,8 @@
1
+ import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{n,t as r}from"./jsx-runtime-CEpd2cAX.js";import{t as i}from"./api-BPraLwsh.js";import{i as a,n as o,r as s,t as c}from"./Tabs-jE0Z5Tzd.js";import{J as l,K as u,W as d,Y as f,q as p}from"./primitives-CWrGZpPI.js";import{Z as m}from"./index-C0DYtvfg.js";import{t as h}from"./CatalogBrowser-DEM9t7Es.js";import{t as g}from"./ToolsetConfigForm-gUVMTPR_.js";var _=t({ToolsetsEditor:()=>S}),v=e(n(),1),y=r();function b({iconSvg:e,logoUrl:t,name:n,className:r}){return(0,y.jsx)(m,{iconSvg:e,logoUrl:t,svgClassName:r,imageClassName:r,fallback:(0,y.jsx)(`div`,{className:`${r} toolsets-tile-icon-placeholder`,children:n.slice(0,1)})})}function x({name:e,iconSvg:t,logoUrl:n,tone:r,caption:i,onConfigure:a,onRemove:o,busy:s}){return(0,y.jsxs)(`div`,{className:`toolsets-tile toolsets-tile-${r}`,children:[(0,y.jsx)(b,{iconSvg:t,logoUrl:n,name:e,className:`toolsets-tile-icon`}),(0,y.jsxs)(`div`,{className:`toolsets-tile-body`,children:[(0,y.jsx)(`div`,{className:`toolsets-tile-name`,children:e}),i&&(0,y.jsx)(`div`,{className:`toolsets-tile-caption`,children:i})]}),(a||o)&&(0,y.jsxs)(`div`,{className:`toolsets-tile-actions`,children:[a&&(0,y.jsx)(`button`,{type:`button`,className:`toolsets-tile-action`,disabled:s,onClick:a,title:`Configure`,"aria-label":`Configure`,children:(0,y.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,y.jsx)(`path`,{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33h0a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51h0a1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82v0a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z`})]})}),o&&(0,y.jsx)(`button`,{type:`button`,className:`toolsets-tile-action toolsets-tile-action-danger`,disabled:s,onClick:o,title:`Remove`,"aria-label":`Remove`,children:s?(0,y.jsx)(`span`,{className:`toolsets-tile-action-spinner`,children:`…`}):(0,y.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,y.jsx)(`path`,{d:`M3 6h18`}),(0,y.jsx)(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`}),(0,y.jsx)(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),(0,y.jsx)(`path`,{d:`M10 11v6M14 11v6`})]})})]})]})}function S({scope:e,subject:t,hint:n}){let[r,m]=(0,v.useState)([]),[_,b]=(0,v.useState)(null),[S,C]=(0,v.useState)([]),[w,T]=(0,v.useState)(!1),[E,D]=(0,v.useState)(`catalog`),[O,k]=(0,v.useState)(null),[A,j]=(0,v.useState)(null),[M,N]=(0,v.useState)([]),[P,F]=(0,v.useState)([]),[I,L]=(0,v.useState)(``),[R,z]=(0,v.useState)(`Pasted JSON`),[B,V]=(0,v.useState)(null),[H,U]=(0,v.useState)(null),W=(0,v.useCallback)(async()=>{try{let[t,n]=await Promise.all([i.listInstalledToolsets(e),i.listCatalogItems(`toolset`)]);m(t.toolsets??[]),b(t.roleDefault??null),F((t.discoveryWarnings??[]).map(e=>e.message)),C(n.items)}catch(e){j(e.message)}},[e]);(0,v.useEffect)(()=>{W()},[W]);let G=(0,v.useMemo)(()=>{let e=new Map;for(let t of S)e.set(t.manifest.id,t);return e},[S]),K=(0,v.useMemo)(()=>new Set(r.filter(e=>e.runtime.kind===`builtin`).map(e=>e.runtime.toolsetGroupId)),[r]),q=e.kind===`gezel`&&_!==null&&K.size===0,J=(0,v.useMemo)(()=>!q||!_?[]:_.groupIds.filter(e=>!K.has(e)).map(e=>{let t=`builtin.${e}`,n=G.get(t);return{groupId:e,catalogId:t,name:n?.manifest.name??e,iconSvg:n?.iconSvg,logoUrl:n?.logoUrl}}),[q,_,K,G]),Y=async t=>{k(t),j(null);try{let n=await i.getCatalogItem(`toolset`,t);if(n.manifest.kind!==`toolset`)throw Error(`catalog item is not a toolset`);let r=n.manifest;(r.config??[]).length===0?(await i.installToolset(t,{scope:e}),await W(),T(!1)):V({manifest:r})}catch(e){j(e.message)}finally{k(null)}},X=async t=>{if(!B)return;let n=B.manifest.id;k(n),j(null);try{let r={};for(let[e,n]of Object.entries(t.secrets))typeof n==`string`&&(r[e]=n);await i.installToolset(n,{scope:e,values:t.values,secrets:r}),await W(),V(null),T(!1)}catch(e){j(e.message)}finally{k(null)}},Z=async e=>{k(e),j(null);try{let[t,n]=await Promise.all([i.getCatalogItem(`toolset`,e),i.getToolsetConfig(e)]);if(t.manifest.kind!==`toolset`)throw Error(`catalog item is not a toolset`);let r=t.manifest;U({toolsetId:e,fields:r.config??[],initialValues:n.values,secretsPresent:n.secretsPresent,secretMasks:n.secretMasks,orphanedValueIds:n.orphaned.values,orphanedSecretIds:n.orphaned.secrets})}catch(e){j(e.message)}finally{k(null)}},Q=async e=>{if(!H)return;let t=H.toolsetId;k(t),j(null);try{await i.updateToolsetConfig(t,{values:e.values,secrets:e.secrets}),U(null),await W()}catch(e){j(e.message)}finally{k(null)}},$=async t=>{k(t);try{await i.uninstallToolset(t,e),await W()}catch(e){j(e.message)}finally{k(null)}},ee=async()=>{if(I.trim()){k(`__custom_import__`),j(null),N([]);try{let t=await i.importCustomMcpConfig({scope:e,text:I,sourceName:R.trim()||`Pasted JSON`});await W(),N([`Imported ${t.imported.length} custom MCP server${t.imported.length===1?``:`s`}: ${t.imported.join(`, `)}`,...t.warnings.map(e=>e.serverName?`${e.serverName}: ${e.message}`:e.message)]),L(``),z(`Pasted JSON`),T(!1)}catch(e){j(e.message)}finally{k(null)}}},te=async e=>{if(e){j(null);try{let t=await e.text();L(t),z(e.name)}catch(t){j(`Could not read ${e.name}: ${t.message}`)}}},ne=async()=>{if(!(!_||_.groupIds.length===0)){k(`__customize__`),j(null);try{for(let t of _.groupIds)await i.installToolset(`builtin.${t}`,{scope:e});await W()}catch(e){j(e.message)}finally{k(null)}}},re=e=>e.runtime.kind===`custom-mcp`?e.runtime.serverName:G.get(e.toolsetId)?.manifest.name??e.toolsetId,ie=e=>G.get(e.toolsetId)?.iconSvg,ae=e=>G.get(e.toolsetId)?.logoUrl,oe=e=>{if(e.runtime.kind===`custom-mcp`)return e.runtime.source.kind===`project-file`?`Project config · ${e.runtime.source.relativePath}`:e.runtime.source.sourceName?`Custom · ${e.runtime.source.sourceName}`:`Custom MCP`};return(0,y.jsxs)(`div`,{className:`gezel-toolsets-panel`,children:[(0,y.jsxs)(`div`,{className:`gezel-toolsets-header`,children:[(0,y.jsxs)(`span`,{className:`muted small`,children:[e.kind===`project`?`Additional project toolsets`:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`i`,{children:`Toolsets`}),` for `,t]}),r.length>0?` (${r.length})`:``]}),(0,y.jsx)(`button`,{type:`button`,onClick:()=>T(!0),children:`+ Add toolset`})]}),n&&(0,y.jsx)(`p`,{className:`muted small`,style:{marginTop:`0.25rem`},children:n}),q&&_&&(0,y.jsxs)(`div`,{className:`toolsets-inherit-banner`,children:[(0,y.jsxs)(`p`,{className:`muted small`,style:{margin:0},children:[`Inheriting`,` `,_.role?(0,y.jsxs)(y.Fragment,{children:[`the `,(0,y.jsx)(`strong`,{children:_.role}),` role default`]}):(0,y.jsx)(y.Fragment,{children:`the default toolset bundle`}),`. Add a built-in toolset below to override, or click `,(0,y.jsx)(`em`,{children:`Customize`}),` to take over the full list.`]}),_.groupIds.length>0&&(0,y.jsx)(`button`,{type:`button`,className:`gz-link-button`,disabled:O!==null,onClick:()=>void ne(),children:O===`__customize__`?`Customizing…`:`Customize`})]}),A&&(0,y.jsx)(`p`,{className:`error small`,children:A}),M.map(e=>(0,y.jsx)(`p`,{className:`status small toolsets-notice`,children:e},e)),P.map(e=>(0,y.jsxs)(`p`,{className:`warning small toolsets-notice`,children:[`Project MCP config: `,e]},e)),(r.length>0||J.length>0)&&(0,y.jsxs)(`div`,{className:`toolsets-tile-grid`,children:[r.map(e=>(0,y.jsx)(x,{name:re(e),iconSvg:ie(e),logoUrl:ae(e),tone:`installed`,caption:oe(e),busy:O===e.toolsetId,onConfigure:G.has(e.toolsetId)?()=>void Z(e.toolsetId):void 0,onRemove:e.runtime.kind===`custom-mcp`&&e.runtime.source.kind===`project-file`?void 0:()=>void $(e.toolsetId)},e.toolsetId)),J.map(e=>(0,y.jsx)(x,{name:e.name,iconSvg:e.iconSvg,logoUrl:e.logoUrl,tone:`inherited`,caption:`Role default`},e.catalogId))]}),(0,y.jsx)(l,{open:w&&!B,onOpenChange:e=>{e||T(!1)},children:(0,y.jsxs)(p,{children:[(0,y.jsx)(u,{}),(0,y.jsxs)(d,{className:`template-picker-dialog toolsets-picker-dialog`,children:[(0,y.jsxs)(`header`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`baseline`},children:[(0,y.jsx)(f,{asChild:!0,children:(0,y.jsx)(`h3`,{style:{margin:0},children:`Add toolset`})}),(0,y.jsx)(`button`,{type:`button`,className:`gz-link-button`,onClick:()=>T(!1),children:`Cancel`})]}),(0,y.jsxs)(s,{value:E,onValueChange:e=>D(e),className:`toolsets-picker-tabs`,children:[(0,y.jsxs)(o,{"aria-label":`Toolset source`,children:[(0,y.jsx)(a,{value:`catalog`,children:`Catalog`}),(0,y.jsx)(a,{value:`custom`,children:`Custom MCP`})]}),(0,y.jsx)(c,{value:`catalog`,children:(0,y.jsx)(h,{kind:`toolset`,emptyMessage:`No toolsets in the catalog yet.`,initialItems:S.length>0?S:void 0,action:e=>{if(e.manifest.kind!==`toolset`)return null;let t=e.manifest,n=r.some(e=>e.toolsetId===t.id);return(0,y.jsx)(`button`,{type:`button`,disabled:n||O!==null,onClick:()=>void Y(t.id),children:n?`Installed`:O===t.id?`Loading…`:`Install`})}})}),(0,y.jsxs)(c,{value:`custom`,className:`toolsets-custom-import`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h4`,{children:`Import MCP configuration`}),(0,y.jsxs)(`p`,{className:`muted small`,children:[`Choose a local JSON file or paste its contents. Gezel accepts VS Code’s`,` `,(0,y.jsx)(`code`,{children:`servers`}),` format and the common `,(0,y.jsx)(`code`,{children:`mcpServers`}),` format used by Claude and Cursor.`]})]}),(0,y.jsxs)(`label`,{className:`toolsets-custom-file`,children:[(0,y.jsx)(`span`,{children:`Configuration file`}),(0,y.jsx)(`input`,{type:`file`,accept:`.json,.jsonc,application/json`,onChange:e=>void te(e.currentTarget.files?.[0])})]}),(0,y.jsxs)(`label`,{children:[(0,y.jsx)(`span`,{children:`JSON`}),(0,y.jsx)(`textarea`,{rows:14,spellCheck:!1,value:I,onChange:e=>{L(e.target.value),R!==`Pasted JSON`&&z(`Pasted JSON`)},placeholder:`{
2
+ "servers": {
3
+ "example": {
4
+ "command": "npx",
5
+ "args": ["-y", "@example/mcp-server"]
6
+ }
7
+ }
8
+ }`})]}),(0,y.jsx)(`p`,{className:`warning small`,children:`MCP servers can run code or contact external services. Import only configurations you trust. Environment values and HTTP headers are kept in Gezel’s secret store.`}),(0,y.jsxs)(`div`,{className:`toolsets-custom-actions`,children:[(0,y.jsx)(`button`,{type:`button`,className:`gz-link-button`,onClick:()=>T(!1),children:`Cancel`}),(0,y.jsx)(`button`,{type:`button`,disabled:!I.trim()||O!==null,onClick:()=>void ee(),children:O===`__custom_import__`?`Importing…`:`Import toolsets`})]})]})]})]})]})}),(0,y.jsx)(l,{open:B!==null,onOpenChange:e=>{e||V(null)},children:(0,y.jsxs)(p,{children:[(0,y.jsx)(u,{}),(0,y.jsxs)(d,{className:`template-picker-dialog`,children:[(0,y.jsx)(`header`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`baseline`},children:(0,y.jsx)(f,{asChild:!0,children:(0,y.jsxs)(`h3`,{style:{margin:0},children:[`Configure `,B?.manifest.name]})})}),(0,y.jsx)(`p`,{className:`muted small`,children:`Values configured here apply globally — every gezel that installs this toolset shares the same configuration.`}),B&&(0,y.jsx)(g,{fields:B.manifest.config??[],submitLabel:`Install`,busy:O!==null,onSubmit:X,onCancel:()=>V(null)})]})]})}),(0,y.jsx)(l,{open:H!==null,onOpenChange:e=>{e||U(null)},children:(0,y.jsxs)(p,{children:[(0,y.jsx)(u,{}),(0,y.jsxs)(d,{className:`template-picker-dialog`,children:[(0,y.jsx)(`header`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`baseline`},children:(0,y.jsx)(f,{asChild:!0,children:(0,y.jsxs)(`h3`,{style:{margin:0},children:[`Configure `,H?.toolsetId]})})}),(0,y.jsxs)(`p`,{className:`muted small`,children:[`Configuration for `,(0,y.jsx)(`code`,{children:H?.toolsetId}),` is shared across every gezel that installs it.`]}),H&&(0,y.jsx)(g,{fields:H.fields,initialValues:H.initialValues,initialSecretsPresent:H.secretsPresent,initialSecretMasks:H.secretMasks,orphanedValueIds:H.orphanedValueIds,orphanedSecretIds:H.orphanedSecretIds,submitLabel:`Save`,busy:O!==null,onSubmit:Q,onCancel:()=>U(null)})]})]})})]})}export{_ as n,S as t};
@@ -0,0 +1,5 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-base-B1H1U1Sw.js","assets/index-C0DYtvfg.js","assets/rolldown-runtime-aKtaBQYM.js","assets/jsx-runtime-CEpd2cAX.js","assets/react-dom-OL4w_gzs.js","assets/dist-BqGwkOe5.js","assets/dist-BaHut5iX.js","assets/api-BPraLwsh.js","assets/primitives-CWrGZpPI.js","assets/Tabs-jE0Z5Tzd.js","assets/document-companion-BQk2kS0F.js","assets/DropdownMenu-S4d9-3j3.js","assets/dist-pLLFUPO-.js","assets/relative-time-B2kBaekd.js","assets/FileTypeIcon-Cwzl1GkZ.js","assets/model-context-DBqdK0PS.js","assets/model-memory-copy-CeuXAj-T.js","assets/StorageCleanupDialog-OQlomMJD.js","assets/poppetje-DLB8uevw.js","assets/safe-svg-image-NbuPaBIv.js","assets/ConfirmDialog-Dt1ed4Fh.js","assets/model-inventory-ykSm_IT5.js","assets/doc-Dr5K49bx.js","assets/chunk-O7JILDEF-CqcO1qaI.js","assets/chunk-BAOV476U-CEOFYt8X.js","assets/chunk-4VOD55SX-BFSSw0c8.js","assets/chunk-GAZKTT4R-BkP6-w3z.js","assets/chunk-UBFT2CDQ-FexGDigd.js","assets/chunk-XRW6P7IF-BeQQgMVK.js","assets/chunk-7ZAAICW4-BsCpYJH6.js","assets/markdown-ryKA_OmY.js","assets/schemas-JY4jmLbC.js","assets/preload-helper-Czpn1I53.js","assets/chunk-6ECMNUIP-DDVjPyfK.js","assets/inlineIconMarker-BQI2HLeD.js","assets/chunk-TT6ENR6T-CaYjVwjm.js","assets/chunk-DAMIRKTO-CGniCSiM.js","assets/new-project-meta-_f9sfcRX.js","assets/chunk-AE3IUKMM-mZjzzO8Z.js","assets/index-B8NcxqcR.css","assets/monaco-DeTXJU-n.js","assets/chunk-V4NBQF5C-D9I4DV9v.js","assets/iconLabel-uMn49Ame.js","assets/iconLabel-Bdh_-Hrb.css","assets/codiconStyles-104B1IQ5.js","assets/codiconStyles-Bp1tMeMk.css","assets/editor.api-DShZZcgD.js","assets/editor-BOOlEWca.css","assets/monaco-Cvm179Eb.css"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{t as r}from"./api-BPraLwsh.js";import{H as i,J as a,K as o,W as s,Y as c,q as l}from"./primitives-CWrGZpPI.js";import{ft as u}from"./doc-Dr5K49bx.js";import{n as d}from"./chunk-UBFT2CDQ-FexGDigd.js";import"./markdown-ryKA_OmY.js";import{t as f}from"./preload-helper-Czpn1I53.js";import{z as p}from"./chunk-6ECMNUIP-DDVjPyfK.js";import{i as m,r as h,t as g}from"./styles-CKVKwqoQ.js";import{It as _,N as v,ht as y}from"./index-C0DYtvfg.js";var b=e(t(),1),x=n();function S({value:e,onChange:t}){let{markdownSource:n,replaceAll:r}=m(),i=(0,b.useRef)(e),a=(0,b.useRef)(t);return a.current=t,(0,b.useEffect)(()=>{n!==i.current&&(i.current=n,a.current(n))},[n]),(0,b.useEffect)(()=>{e!==i.current&&(i.current=e,r(e))},[e,r]),null}function C({value:e,onChange:t,ariaLabel:n}){let r=y();return(0,x.jsx)(`section`,{className:`gz-transform-after-editor`,"aria-label":n,children:(0,x.jsxs)(g,{initialMarkdown:(0,b.useRef)(e).current,articleId:`transform-after`,colorScheme:r,allowRecording:!1,allowNarrate:!1,mentionProvider:null,children:[(0,x.jsx)(S,{value:e,onChange:t}),(0,x.jsx)(h,{className:`gz-transform-after-wysiwyg`})]})})}var w={id:`gezel-dark`,background:`#1c1f1c`,backgroundLight:`#252925`,text:`#f0ede4`,textMuted:`#9da195`},T={id:`gezel-light`,background:`#f3eddf`,backgroundLight:`#eae5d6`,text:`#1c1c1c`,textMuted:`#666666`};function E({markdown:e}){let t=(0,b.useMemo)(()=>{try{return u(d(e),{articleId:`transform-before`})}catch{return null}},[e]),n=y()===`dark`?w:T;return(0,x.jsx)(`div`,{className:`gz-transform-before-text`,children:t?(0,x.jsx)(p,{doc:t,theme:v,surface:n,thinMargins:!0}):(0,x.jsx)(`pre`,{className:`gz-transform-before-raw`,children:e})})}function D({original:e,value:t,onChange:n}){let r=(0,b.useRef)(null),i=(0,b.useRef)(null),a=(0,b.useRef)(null),o=(0,b.useRef)(null),[s,c]=(0,b.useState)(null),[l,u]=(0,b.useState)(!1),d=y(),p=(0,b.useRef)(n);p.current=n;let m=(0,b.useRef)(e),h=(0,b.useRef)(t),g=(0,b.useRef)(d);return g.current=d,(0,b.useEffect)(()=>{let e=!1,t=[];return(async()=>{let n;try{n=await f(()=>import(`./monaco-base-B1H1U1Sw.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48])),await n.ensureGezelMonacoBase(),await n.monaco.loadMonacoLanguages(`markdown`)}catch(t){e||c(t.message);return}if(e||!r.current)return;let s=n.monaco;i.current=s;let l=s.editor.createModel(m.current,`markdown`),d=s.editor.createModel(h.current,`markdown`);o.current=d,t.push(l,d);let _=s.editor.createDiffEditor(r.current,{automaticLayout:!0,originalEditable:!1,readOnly:!1,renderSideBySide:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,fixedOverflowWidgets:!0,wordWrap:`on`});a.current=_,_.setModel({original:l,modified:d}),s.editor.setTheme(g.current===`dark`?`gezel-dark`:`gezel-light`),t.push(d.onDidChangeContent(()=>p.current(d.getValue()))),u(!0)})(),()=>{e=!0,a.current?.dispose(),a.current=null;for(let e of t)e.dispose();o.current=null}},[]),(0,b.useEffect)(()=>{let e=o.current;l&&e&&e.getValue()!==t&&e.setValue(t)},[t,l]),(0,b.useEffect)(()=>{i.current?.editor.setTheme(d===`dark`?`gezel-dark`:`gezel-light`)},[d]),(0,x.jsxs)(`div`,{className:`gz-transform-diff`,children:[!l&&!s&&(0,x.jsx)(`p`,{className:`muted small`,children:`Loading diff view…`}),s&&(0,x.jsxs)(`p`,{className:`gz-transform-diff-error`,children:[`Diff view failed to load: `,s]}),(0,x.jsx)(`div`,{ref:r,className:`gz-transform-diff-host`})]})}function O({markdown:e}){let t=(0,b.useRef)(null),n=(0,b.useDeferredValue)(e),r=(0,b.useMemo)(()=>{try{return u(d(n),{articleId:`transform-thinking`})}catch{return null}},[n]),i=y()===`dark`?w:T;return(0,b.useEffect)(()=>{let e=t.current;e&&(e.scrollTop=e.scrollHeight)},[n]),(0,x.jsx)(`div`,{ref:t,className:`gz-transform-thinking`,"aria-live":`polite`,children:r?(0,x.jsx)(p,{doc:r,theme:v,surface:i,thinMargins:!0}):(0,x.jsx)(`pre`,{className:`gz-transform-thinking-raw`,children:e})})}function k(){let[e,t]=(0,b.useState)(null);return(0,b.useEffect)(()=>{let e=!1;return(async()=>{try{let n=await r.getConfig();if(!n.klerkGezelId)return;let{gezels:i}=await r.listGezels(),a=i.find(e=>e.id===n.klerkGezelId);!e&&a&&t(a)}catch{}})(),()=>{e=!0}},[]),e}var A={phase:`idle`,thinking:``,outputPreview:``,result:null,error:null};function j(e,t){switch(t.type){case`status`:return{...e,phase:t.phase===`queued`?`queued`:`streaming`};case`thinking-delta`:return{...e,phase:`streaming`,thinking:e.thinking+t.text};case`output-delta`:return{...e,phase:`streaming`,outputPreview:e.outputPreview+t.text};case`done`:return{...e,phase:`done`,result:t.text};case`error`:return{...e,phase:`error`,error:t.error}}}function M(){let[e,t]=(0,b.useState)(A),n=(0,b.useRef)(null),i=(0,b.useCallback)(e=>{n.current?.abort();let i=new AbortController;n.current=i,t({...A,phase:`streaming`}),r.transformTextStream(e,e=>t(t=>j(t,e)),i.signal).catch(e=>{i.signal.aborted||t(t=>({...t,phase:`error`,error:e instanceof Error?e.message:String(e)}))})},[]),a=(0,b.useCallback)(()=>{n.current?.abort(),n.current=null,t(A)},[]);return(0,b.useEffect)(()=>()=>n.current?.abort(),[]),{state:e,start:i,reset:a}}function N({snapshot:e,context:t,subject:n,parentContext:r,onApply:u,onClose:d}){let[f,p]=(0,b.useState)(``),[m,h]=(0,b.useState)(``),[g,v]=(0,b.useState)(`edit`),{state:y,start:S}=M(),w=k(),T=e.mode===`insert`,A=y.phase===`queued`||y.phase===`streaming`,j=y.phase===`done`,N=!A&&(!T||f.trim().length>0),P=j&&m.trim().length>0,F=w?.name??`AI`;(0,b.useEffect)(()=>{y.phase===`done`&&y.result!==null&&h(y.result)},[y.phase,y.result]);let I=()=>{if(!N)return;let i=f.trim();S({mode:e.mode,text:e.text,context:t,...i?{instruction:i}:{},...n?{subject:n}:{},...r?{parentContext:r}:{},...e.textBefore?{textBefore:e.textBefore}:{},...e.textAfter?{textAfter:e.textAfter}:{}})},L=e=>{e.preventDefault(),I()},R=y.thinking||y.outputPreview;return(0,x.jsx)(a,{open:!0,onOpenChange:e=>{e||d()},children:(0,x.jsxs)(l,{children:[(0,x.jsx)(o,{}),(0,x.jsx)(s,{className:`gz-transform-dialog`,children:(0,x.jsxs)(`form`,{onSubmit:L,style:{display:`contents`},children:[(0,x.jsx)(c,{asChild:!0,children:(0,x.jsx)(`h3`,{children:T?`Add content with AI`:`Edit with AI`})}),(0,x.jsxs)(`div`,{className:`gz-transform-top`,children:[(0,x.jsxs)(`label`,{className:`gz-transform-instruction`,children:[T?`What should be written?`:`How should the text change? (optional)`,(0,x.jsx)(`textarea`,{value:f,onChange:e=>p(e.target.value),placeholder:T?`e.g. add a short summary of the goals, write an intro paragraph`:`e.g. make it more concise, convert to bullet points, add concrete examples`,rows:3,autoFocus:!0,disabled:A})]}),(0,x.jsxs)(`div`,{className:`gz-transform-klerk-row`,children:[(0,x.jsx)(_,{svg:w?.icon,poppetje:w?.poppetje,iconOverride:w?.iconOverride,name:F,size:40,pulsing:A,title:`Transform with ${F}`,onClick:()=>I()}),(0,x.jsx)(`button`,{type:`submit`,className:`primary`,disabled:!N,"aria-label":`Transform with ${F}`,children:A?`Transforming…`:j?`Transform again with ${F}`:`Transform with ${F}`}),y.phase===`queued`&&(0,x.jsx)(`span`,{className:`muted small`,children:`Waiting in queue…`})]})]}),A&&(R?(0,x.jsx)(O,{markdown:R}):(0,x.jsx)(`div`,{className:`gz-transform-thinking`,"aria-live":`polite`,children:`${F} is working…`})),y.phase===`error`&&(0,x.jsx)(`p`,{className:`gz-transform-error`,role:`alert`,children:y.error}),(0,x.jsx)(`div`,{className:`gz-transform-view`,children:j?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`gz-tray gz-transform-view-toggle`,role:`radiogroup`,"aria-label":`Result view`,children:[(0,x.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":g===`edit`,className:`gz-key${g===`edit`?` gz-key-active`:``}`,onClick:()=>v(`edit`),children:T?`New text`:`Before / After`}),(0,x.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":g===`diff`,className:`gz-key${g===`diff`?` gz-key-active`:``}`,onClick:()=>v(`diff`),children:`Diff`})]}),g===`edit`?(0,x.jsxs)(`div`,{className:`gz-transform-panes`,children:[!T&&(0,x.jsxs)(`div`,{className:`gz-transform-before`,children:[(0,x.jsx)(`span`,{className:`gz-transform-pane-label muted small`,children:`Before`}),(0,x.jsx)(E,{markdown:e.text})]}),(0,x.jsxs)(`div`,{className:`gz-transform-after`,children:[(0,x.jsx)(`span`,{className:`gz-transform-pane-label muted small`,children:T?`New text (editable)`:`After (editable)`}),(0,x.jsx)(C,{value:m,onChange:h,ariaLabel:T?`New text`:`Rewritten text`})]})]}):(0,x.jsx)(D,{original:e.text,value:m,onChange:h})]}):T?(0,x.jsx)(`p`,{className:`gz-transform-empty muted small`,children:`New text will be inserted at the cursor.`}):(0,x.jsxs)(`div`,{className:`gz-transform-before`,children:[(0,x.jsx)(`span`,{className:`gz-transform-pane-label muted small`,children:`Selected text`}),(0,x.jsx)(E,{markdown:e.text})]})}),(0,x.jsxs)(i,{children:[(0,x.jsx)(`button`,{type:`button`,onClick:d,children:`Cancel`}),(0,x.jsx)(`button`,{type:`button`,className:`primary`,disabled:!P,onClick:()=>u(m),children:T?`Insert`:`Apply`})]})]})})]})})}var P=2e3,F=1e3;function I(){return(0,x.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:[(0,x.jsx)(`path`,{d:`m2 14 8.5-8.5`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`}),(0,x.jsx)(`path`,{d:`M12 1.8l.7 1.7 1.7.7-1.7.7-.7 1.7-.7-1.7-1.7-.7 1.7-.7.7-1.7Z`,stroke:`currentColor`,strokeWidth:`1.2`,strokeLinejoin:`round`})]})}function L({context:e,subject:t,parentContext:n}){let{tiptapEditor:r,monacoEditor:i,activeView:a,insertAtCursor:o}=m(),[s,c]=(0,b.useState)(null),l=a===`wysiwyg`&&!!r||a===`raw`&&!!i,u=(0,b.useCallback)(()=>{if(a===`wysiwyg`&&r){let{from:e,to:t}=r.state.selection,n=r.state.doc;if(e!==t){let r=n.textBetween(e,t,`
3
+ `);if(r.trim())return{mode:`rewrite`,view:`wysiwyg`,text:r,tiptapRange:{from:e,to:t},tiptapAll:e===0&&t===n.content.size}}return{mode:`insert`,view:`wysiwyg`,text:``,tiptapRange:{from:e,to:t},textBefore:n.textBetween(0,e,`
4
+ `).slice(-2e3),textAfter:n.textBetween(t,n.content.size,`
5
+ `).slice(0,F)}}if(a===`raw`&&i){let e=i.getSelection(),t=i.getModel();if(!e||!t)return null;let n={startLineNumber:e.startLineNumber,startColumn:e.startColumn,endLineNumber:e.endLineNumber,endColumn:e.endColumn};if(!e.isEmpty()){let r=t.getValueInRange(e);if(r.trim())return{mode:`rewrite`,view:`raw`,text:r,monacoRange:n}}let r=t.getValue(),a=t.getOffsetAt({lineNumber:e.startLineNumber,column:e.startColumn}),o=t.getOffsetAt({lineNumber:e.endLineNumber,column:e.endColumn});return{mode:`insert`,view:`raw`,text:``,monacoRange:n,textBefore:r.slice(Math.max(0,a-P),a),textAfter:r.slice(o,o+F)}}return null},[a,r,i]),d=(0,b.useCallback)((e,t)=>{if(e.view===`wysiwyg`&&r&&e.tiptapRange){let{from:n,to:i}=e.tiptapRange;e.tiptapAll?r.chain().focus().selectAll().run():r.chain().focus().setTextSelection({from:n,to:i}).run(),o(t)}else e.view===`raw`&&i&&e.monacoRange&&(i.executeEdits(`ai-transform`,[{range:e.monacoRange,text:t,forceMoveMarkers:!0}]),i.focus())},[r,i,o]);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{type:`button`,className:`ai-btn`,onClick:()=>c(u()),disabled:!l,title:l?`AI: transform the selection, or add new content at the cursor`:`AI transform is available in the editing views`,"aria-label":`Transform with AI`,children:(0,x.jsx)(I,{})}),s&&(0,x.jsx)(N,{snapshot:s,context:e,subject:t,parentContext:n,onApply:e=>{d(s,e),c(null)},onClose:()=>c(null)})]})}export{k as n,L as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{H as r,J as i,N as a}from"./dist-BqGwkOe5.js";import{t as o}from"./dist-BaHut5iX.js";import{t as s}from"./api-BPraLwsh.js";import"./primitives-CWrGZpPI.js";import{a as c,i as l,n as u,s as d,t as f}from"./DropdownMenu-S4d9-3j3.js";import{t as p}from"./model-context-DBqdK0PS.js";import{r as m}from"./model-memory-copy-CeuXAj-T.js";import{t as h}from"./ConfirmDialog-Dt1ed4Fh.js";import{a as g,r as _,t as v}from"./model-inventory-ykSm_IT5.js";import{Et as y,Ft as b,Tt as x}from"./index-C0DYtvfg.js";var S=e(t(),1),C=n(),w=32768,T=8192;function E(e){let t=e.contextCeilingTokens??e.contextWindow;return t!==void 0&&t>32768?t:void 0}function D({engine:e,model:t,updating:n=!1,contextSupported:r,contextEditorOpen:i,onToggleContextEditor:a,fitnessAction:o,visionAction:s,onUpdate:p,updateLabel:m={idle:`Update`,busy:`Updating…`},onDelete:h}){let g=y(e,t.id),_=E(t);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(c,{children:[(0,C.jsx)(d,{asChild:!0,children:(0,C.jsx)(`button`,{type:`button`,className:`model-actions-trigger`,"aria-label":`Actions for ${t.id}`,title:`Model actions`,children:(0,C.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:[(0,C.jsx)(`circle`,{cx:`12`,cy:`5`,r:`1.6`}),(0,C.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.6`}),(0,C.jsx)(`circle`,{cx:`12`,cy:`19`,r:`1.6`})]})})}),(0,C.jsx)(l,{children:(0,C.jsxs)(f,{className:`app-nav-menu`,sideOffset:4,align:`end`,children:[r&&(0,C.jsx)(u,{className:`app-nav-menu-item`,disabled:_===void 0,title:_===void 0?`This model does not advertise a context window large enough to adjust.`:void 0,onSelect:()=>a(),children:i?`Hide context size`:`Context size…`}),o&&(0,C.jsx)(u,{className:`app-nav-menu-item`,disabled:o.checking,title:`Run the fitness check (proeve): startup and decode speed with representative context, tool round-trip, reasoning budget, and context fit.`,onSelect:()=>o.onRun(),children:o.label}),s&&(0,C.jsx)(u,{className:`app-nav-menu-item`,disabled:s.busy,title:s.enabled?`Stop sending images straight to this model. Pictures still reach it as a written description from the image reader, and this model regains cached session resume.`:`Send images to this model itself instead of a written description of them. Costs cached session resume for this model: the engine won't save or reload its conversation state to disk, so a session that goes cold re-reads its history. Speed within a live conversation is unaffected.`,onSelect:()=>s.onToggle(),children:s.busy?`Saving…`:s.enabled?`Turn off vision`:`Turn on vision`}),(0,C.jsx)(u,{className:`app-nav-menu-item`,disabled:g.busy,onSelect:()=>void g.run(),children:g.busy?`Exporting…`:`Export`}),t.updateAvailable&&p&&(0,C.jsx)(u,{className:`app-nav-menu-item`,disabled:n,title:t.availableVersion?`Re-download the current build (→ v${t.availableVersion}) and replace in place.`:`Re-download the current build and replace in place.`,onSelect:()=>p(),children:n?m.busy:m.idle}),!t.readOnly&&h&&(0,C.jsx)(u,{className:`app-nav-menu-item danger`,onSelect:()=>h(),children:`Delete`})]})})]}),g.error&&(0,C.jsx)(`span`,{className:`error small`,children:g.error}),(0,C.jsx)(x,{state:g.progress,canceling:g.canceling,onCancel:g.cancel,onSkipVerification:g.skipVerification,skippingVerification:g.skippingVerification,onDismiss:g.dismissProgress})]})}function O(e,t,n){return Math.min(Math.max(e,t),n)}function k({engine:e,model:t,onSaved:n}){let[i,a]=(0,S.useState)(t.overrideContextTokens??null),[o,c]=(0,S.useState)(!1),[l,u]=(0,S.useState)(null),[d,f]=(0,S.useState)(null);(0,S.useEffect)(()=>{a(t.overrideContextTokens??null)},[t.overrideContextTokens]),(0,S.useEffect)(()=>{let n=!1;return s.getEngineStatus().then(r=>{if(n)return;let i=r.pools?.fastBytes;if(i&&i>0){let n=(r.entries??[]).filter(n=>n.provider===e&&n.modelId===t.id).reduce((e,t)=>e+t.residentBytes,0);f({fastBytes:i,committedBytes:Math.max(0,(r.committedBytes??0)-n)})}}).catch(()=>{}),()=>{n=!0}},[e,t.id]);let h=(0,S.useCallback)(async r=>{c(!0),u(null);try{await s.updateModelContextOverride(e,t.id,r),u(r===null?`Back to automatic — applies when the model next starts.`:`Saved — applies when the model next starts.`),_(e),await n?.()}catch(e){u(`Could not save: ${e instanceof Error?e.message:String(e)}`)}finally{c(!1)}},[e,t.id,n]),g=E(t);if(g===void 0)return null;let v=w,y=t.overrideContextTokens===void 0?t.effectiveContextWindow:t.autoContextWindow,b=O(i??t.overrideContextTokens??y??v,v,g),x=i===null||y!==void 0&&Math.abs(i-y)<T,D=t.overrideContextTokens??null,k=(x?null:b)!==D,A=y===void 0?void 0:(O(y,v,g)-v)/Math.max(1,g-v)*100,j=t.kvBytesPerTokenPerSlot,M=t.weightsResidentBytes??r(t.approxSizeBytes,{mmprojBytes:t.mmprojSizeBytes}),N=t.kvFixedBytesPerSlot??0,P=j===void 0?void 0:M+N+j*b,F=t.plannedSlots??1,I=j===void 0?void 0:M+F*(N+j*b),L=d!==null&&I!==void 0&&I>Math.max(0,d.fastBytes-d.committedBytes);return(0,C.jsxs)(`div`,{className:`model-context-editor`,children:[(0,C.jsxs)(`div`,{className:`gz-budget-slider`,children:[(0,C.jsxs)(`div`,{className:`gz-budget-slider-head`,children:[(0,C.jsxs)(`strong`,{title:`${b.toLocaleString()} tokens per turn`,children:[p(b),` context`]}),x?(0,C.jsx)(`span`,{className:`gz-budget-tag`,children:`Automatic`}):(0,C.jsx)(`span`,{className:`gz-budget-tag ${L?`gz-budget-tag-risky`:`gz-budget-tag-custom`}`,children:L?`Bigger than what fits`:`Custom`}),P!==void 0&&(0,C.jsxs)(`span`,{className:`muted small model-context-editor-estimate`,children:[`~`,m(P),` in memory`,F>1&&I!==void 0?` · ~${m(I)} serving ${F} chats at once`:``]})]}),(0,C.jsxs)(`div`,{className:`gz-budget-track`,children:[(0,C.jsx)(`input`,{type:`range`,min:v,max:g,step:T,value:b,"aria-label":`Context size for ${t.id}`,onChange:e=>a(Number.parseInt(e.target.value,10))}),A!==void 0&&(0,C.jsxs)(`div`,{className:`gz-budget-marker`,style:{left:`${A}%`},title:`Automatic sizing grants ${p(y)} on this machine right now`,"aria-hidden":`true`,children:[(0,C.jsx)(`span`,{className:`gz-budget-marker-arrow`,children:`▲`}),(0,C.jsxs)(`span`,{className:`gz-budget-marker-label`,children:[`Auto · `,p(y)]})]})]}),(0,C.jsxs)(`div`,{className:`gz-budget-scale muted small`,children:[(0,C.jsx)(`span`,{children:p(v)}),(0,C.jsx)(`span`,{children:p(g)})]})]}),j===void 0&&e===`ds4`&&(0,C.jsx)(`p`,{className:`muted small`,children:`Nobody has measured this model's memory-per-token yet, so the footprint above can't be re-priced as you drag. Cold context streams to disk, so expect it to move far less than the window does.`}),j!==void 0&&e===`ds4`&&(0,C.jsxs)(`p`,{className:`muted small`,children:[`ds4 streams cold context to disk, so only part of the window stays resident —`,` ${m(j*1024)} per 1K tokens`,` for this model.`]}),L&&(0,C.jsx)(`output`,{className:`muted small model-context-editor-warning`,children:`Bigger than what fits right now — Gezel will grant as much as memory safely allows and the Context size column shows the result.`}),(0,C.jsxs)(`div`,{className:`model-context-editor-actions`,children:[(0,C.jsx)(`button`,{type:`button`,onClick:()=>void h(x?null:b),disabled:o||!k,children:o?`Saving…`:`Save`}),D!==null&&(0,C.jsx)(`button`,{type:`button`,onClick:()=>void h(null),disabled:o,children:`Back to automatic`})]}),l&&(0,C.jsx)(`p`,{className:`muted small model-context-editor-message`,children:l})]})}function A(e){return e>=10?Math.round(e).toLocaleString():e.toFixed(1)}function j(e){let t=e/1e3;return t<10?`${Number(t.toFixed(1))}s`:`${Math.round(t)}s`}function M(e){if(!e||e.stale)return null;let t=i(e.record);if(!t||t.prefillTokensPerSec==null)return null;let n=A(t.prefillTokensPerSec),r=t.evaluatedPromptTokens.toLocaleString(),a=t.ttftMs==null?null:j(t.ttftMs),o=t.prefillSource===`first-token`;return{label:`prefill ${o?`~`:``}${n} t/s`,title:o?`Reading the ${r}-token check prompt took about ${a??`a moment`} — roughly ${n} tokens/sec. Measured from how long the model took to produce its first word, because this engine does not report its own prefill timing.`:`The engine read the ${r}-token check prompt at ${n} tokens/sec${a?`, ${a} before the first word of the answer`:``}.`}}function N({entry:e,probing:t}){let n=a({...e?{fitness:{record:e.record,stale:e.stale,hardwareChanged:e.hardwareChanged}}:{},probing:t}),r=M(e);return(0,C.jsx)(`td`,{className:`model-fitness-table-cell`,children:(0,C.jsxs)(`div`,{className:`model-fitness-cell`,children:[(0,C.jsx)(`span`,{className:`gz-status-pill model-fitness-badge${n.tier===`probing`?` model-fitness-badge--probing`:``}${n.tier===`ok`?` gz-status-pill--ok`:n.tier===`warn`?` gz-status-pill--warn`:``}`,title:n.detail,children:n.label}),n.reason&&(0,C.jsx)(`span`,{className:`muted small model-fitness-reason`,title:n.detail,children:n.reason}),r&&(0,C.jsx)(`span`,{className:`muted small model-fitness-speeds`,title:r.title,children:r.label})]})})}function P(e,t,n){return{label:t?`Checking fitness…`:e&&!e.stale&&e.record.status!==`blocked`?`Re-run fitness check`:`Run fitness check`,checking:t,onRun:n}}function F({engine:e,onModelsChanged:t}){let[n,r]=(0,S.useState)(!1),[i,a]=(0,S.useState)([]),[o,c]=(0,S.useState)(null),[l,u]=(0,S.useState)(null),[d,f]=(0,S.useState)(null),p=(0,S.useCallback)(async()=>{try{let t=await s.listSharedModelMigrationCandidates(e);r(t.available),a(t.candidates)}catch{r(!1),a([])}},[e]);(0,S.useEffect)(()=>{p();let t=t=>{g(t)===e&&p()};return window.addEventListener(v,t),()=>window.removeEventListener(v,t)},[e,p]),(0,S.useEffect)(()=>{if(!i.some(e=>e.moving))return;let e=window.setInterval(()=>void p(),2e3);return()=>window.clearInterval(e)},[i,p]);let m=(0,S.useCallback)(async e=>{let n=I(e);c(null),u(n),f(null);try{let n=await s.moveModelToShared({source:e.source,engine:e.engine,id:e.id});f(L(n,e.name)),_(e.engine),t?.(),await p()}catch(e){let t=z(e);t.includes(`already being moved`)?await p():f({kind:`error`,text:t})}finally{u(null)}},[t,p]),y=l!==null||i.some(e=>e.moving);return(!n||i.length===0)&&!d?null:(0,C.jsxs)(`div`,{className:`ollama-section shared-model-migration`,"aria-live":`polite`,children:[(0,C.jsx)(`h4`,{children:`Models ready to share`}),(0,C.jsx)(`p`,{className:`muted small shared-model-migration-copy`,children:`These up-to-date models are using space in a private Gezel folder. Move them to the shared model library so every account on this device can use one verified copy.`}),d&&(0,C.jsx)(`p`,{className:d.kind===`error`?`error small`:`muted small`,role:d.kind===`error`?`alert`:`status`,children:d.text}),n&&i.length>0&&(0,C.jsx)(`ul`,{className:`shared-model-migration-list`,children:i.map(e=>{let t=I(e),n=l===t||e.moving;return(0,C.jsxs)(`li`,{children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`strong`,{children:e.name}),(0,C.jsxs)(`span`,{className:`muted small`,children:[e.sourceLabel,` · `,R(e.approxSizeBytes)]})]}),(0,C.jsx)(`button`,{type:`button`,disabled:y,onClick:()=>c(e),children:n?`Moving and verifying…`:`Move to shared location`})]},t)})}),(0,C.jsx)(h,{open:o!==null,title:`Move ${o?.name??`model`} to the shared library?`,message:(0,C.jsxs)(C.Fragment,{children:[`Gezel will copy and verify the complete model through the machine service, publish it atomically, and only then remove the private copy from`,` `,o?.sourceLabel??`this folder`,`. Other accounts on this device will be able to use the shared model.`]}),confirmLabel:`Move model`,onConfirm:()=>o?m(o):void 0,onCancel:()=>c(null)})]})}function I(e){return`${e.source}:${e.engine}:${e.id}`}function L(e,t){return e.warning?{kind:`warning`,text:e.warning}:{kind:`success`,text:`${t} is now in the shared model library.`}}function R(e){return e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${(e/1024**2).toFixed(0)} MB`:e>=1024?`${(e/1024).toFixed(0)} KB`:`${e} B`}function z(e){if(e instanceof o){let t=e.details;if(t&&typeof t==`object`&&`error`in t){let e=t.error;if(typeof e==`string`&&e.length>0)return e}}return e instanceof Error?e.message:String(e)}function B({items:e,onUpdate:t,onRemove:n}){return e.length===0?null:(0,C.jsxs)(`div`,{className:`ollama-section local-model-attention`,children:[(0,C.jsx)(`h4`,{children:`Models needing attention`}),(0,C.jsx)(`p`,{className:`muted small local-model-attention-intro`,children:`Gezel found model files whose metadata is older or unreadable. They won't be used until replaced with a current catalog build, but they remain here so you can update or remove them.`}),(0,C.jsx)(`div`,{className:`ollama-pull-list`,children:e.map(e=>(0,C.jsx)(`div`,{className:`ollama-pull local-model-attention-row`,children:(0,C.jsxs)(`div`,{className:`ollama-pull-head`,children:[(0,C.jsxs)(`div`,{className:`local-model-attention-name`,children:[(0,C.jsx)(`strong`,{children:e.name??e.id}),e.name&&(0,C.jsx)(`code`,{children:e.id})]}),(0,C.jsxs)(`span`,{className:`muted small local-model-attention-reason`,title:e.reason,children:[b(e.bytes),` · `,e.reason]}),(0,C.jsxs)(`span`,{className:`local-model-attention-actions`,children:[e.canUpdate&&(0,C.jsx)(`button`,{type:`button`,className:`gz-link-button`,onClick:()=>t(e.id),children:`Update`}),e.readOnly?(0,C.jsx)(`span`,{className:`muted small`,title:`This model is supplied by the machine-wide model store and must be managed there.`,children:`Machine model`}):(0,C.jsx)(`button`,{type:`button`,className:`gz-link-button`,onClick:()=>n(e.id),children:`Remove`})]})]})},e.id))})]})}export{D as a,P as i,F as n,k as o,N as r,B as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{F as r,I as i,M as a,N as o,P as s,j as c}from"./primitives-DEsn1shf.js";import{Nt as l,bt as u,mn as d}from"./dist-BPx-FyRH.js";import{t as f}from"./api-BX5xXiFs.js";import{t as p}from"./ConfirmDialog-BHFs6vmJ.js";import{t as m}from"./CatalogBrowser-Bz8ZtxPn.js";import{t as h}from"./LicenseButton-D3VmcVG1.js";var g=e(t(),1),_=n(),v=`video-generator`,y=`generate_video`;function b(){let[e,t]=(0,g.useState)([]),[n,r]=(0,g.useState)(!0),[i,a]=(0,g.useState)(!1),o=(0,g.useCallback)(async()=>{r(!0);try{let e=await f.listGezels();t(e.gezels)}catch{}finally{r(!1)}},[]);(0,g.useEffect)(()=>{o();let e=()=>void o();return window.addEventListener(`gezel:gezel-updated`,e),()=>window.removeEventListener(`gezel:gezel-updated`,e)},[o]);let s=(0,g.useMemo)(()=>e.filter(e=>e.fixedFunction?.tool===y),[e]),c=(0,g.useCallback)(e=>{window.dispatchEvent(new CustomEvent(`gezel:open-tab`,{detail:{kind:`gezel`,id:e,activate:!0}}))},[]),l=(0,g.useCallback)(e=>{a(!1),o(),c(e.id)},[o,c]);return n?null:(0,_.jsxs)(`div`,{className:`ff-img-hint`,children:[s.length>0?(0,_.jsxs)(`div`,{className:`ff-img-hint-have`,children:[(0,_.jsx)(`span`,{className:`muted small`,children:`Video-generator gezel`}),s.length===1?(0,_.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>c(s[0].id),title:`Open ${s[0].name}`,children:s[0].name}):(0,_.jsx)(`span`,{children:s.map((e,t)=>(0,_.jsxs)(`span`,{children:[(0,_.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>c(e.id),title:`Open ${e.name}`,children:e.name}),t<s.length-1&&(0,_.jsx)(`span`,{className:`muted`,children:`, `})]},e.id))}),(0,_.jsx)(`span`,{className:`muted small`,children:`— @-mention them in chat to generate.`})]}):(0,_.jsxs)(`div`,{className:`ff-img-hint-empty`,children:[(0,_.jsxs)(`p`,{className:`muted small`,children:[`Once a model is on your device, the easiest way to use it from chat is to add a`,` `,(0,_.jsx)(`strong`,{children:`video-generator gezel`}),`. It takes your exact prompt and passes it straight to the video-generation AI, so use terse, concrete descriptions — e.g.`,` `,(0,_.jsx)(`em`,{children:`"a red hot-air balloon drifting over snowy mountains at sunrise, slow aerial shot."`})]}),(0,_.jsx)(`button`,{type:`button`,className:`primary`,onClick:()=>a(!0),children:`Add a video-generator gezel`})]}),(0,_.jsx)(x,{open:i,onClose:()=>a(!1),onCreated:l})]})}function x({open:e,onClose:t,onCreated:n}){let[u,d]=(0,g.useState)(()=>l()),[p,m]=(0,g.useState)(null),[h,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(null),[S,C]=(0,g.useState)(!1),w=(0,g.useRef)(!1);(0,g.useEffect)(()=>{!e||w.current||(w.current=!0,C(!0),f.getCatalogItem(`gezel-template`,v).then(e=>{e.manifest.kind===`gezel-template`&&m(e.manifest.description)}).catch(e=>{x(e instanceof Error?e.message:String(e))}).finally(()=>C(!1)))},[e]),(0,g.useEffect)(()=>{e&&(d(l()),x(null),y(!1))},[e]);let T=()=>d(l()),E=(0,g.useCallback)(async()=>{if(u.trim()){y(!0),x(null);try{n(await f.createGezelFromTemplate(v,{name:u.trim()}))}catch(e){x(e instanceof Error?e.message:String(e))}finally{y(!1)}}},[u,n]);return(0,_.jsx)(r,{open:e,onOpenChange:e=>{!e&&!h&&t()},children:(0,_.jsxs)(s,{children:[(0,_.jsx)(o,{}),(0,_.jsxs)(c,{className:`template-picker-dialog`,children:[(0,_.jsxs)(`header`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`baseline`},children:[(0,_.jsx)(i,{asChild:!0,children:(0,_.jsx)(`h3`,{style:{margin:0},children:`Add a video-generator gezel`})}),(0,_.jsx)(`button`,{type:`button`,className:`gz-link-button`,onClick:t,disabled:h,children:`Cancel`})]}),(0,_.jsx)(a,{className:`muted small`,style:{margin:`0.25rem 0 0.5rem 0`},children:`Passes your exact prompt straight to the video-generation AI. Works best with terse, concrete descriptions.`}),S&&(0,_.jsx)(`p`,{className:`muted small`,children:`Loading template…`}),p&&(0,_.jsx)(`p`,{className:`muted small`,children:p}),(0,_.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),E()},style:{marginTop:`0.5rem`,padding:`0.6rem`,background:`rgba(79, 125, 255, 0.06)`,borderRadius:`6px`,display:`flex`,flexDirection:`column`,gap:`0.5rem`},children:(0,_.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`,alignItems:`center`},children:[(0,_.jsx)(`span`,{className:`muted small`,style:{flexShrink:0},children:`Name:`}),(0,_.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),disabled:h,style:{flex:1}}),(0,_.jsx)(`button`,{type:`button`,className:`dice-btn`,onClick:T,disabled:h,title:`Pick a random name`,"aria-label":`Pick a random name`,children:`🎲`}),(0,_.jsx)(`button`,{type:`submit`,className:`primary`,disabled:h||!u.trim(),children:h?`Creating…`:`Create`})]})}),b&&(0,_.jsx)(`p`,{className:`error`,children:b})]})]})})}function S(e){return e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${(e/1024**2).toFixed(0)} MB`:e>=1024?`${(e/1024).toFixed(0)} KB`:`${e} B`}function C(e,t){switch(e){case`low`:return`Runs on ${t} GB`;case`mid`:return`${t} GB+`;case`high`:return`${t} GB+ recommended`;case`workstation`:return`${t} GB+ workstation`}}function w(e){return Math.round(e/1024**3)}function T(e,t){return`${t.name} recommends about ${t.minVramGB} GB of fast (GPU / unified) memory, but this machine has roughly ${w(d(e))} GB usable for generation (${w(e.totalRamBytes)} GB total). It may run out of memory or fail to load. Download this ${S(t.approxSizeBytes)} model anyway?`}function E({disabledReason:e,onModelsChanged:t,configuredDefaultModelId:n,onSetActiveModel:r}){let[i,a]=(0,g.useState)([]),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(new Map),[v,y]=(0,g.useState)(null),[b,x]=(0,g.useState)(null),[E,O]=(0,g.useState)(null),k=(0,g.useRef)(c);k.current=c,(0,g.useEffect)(()=>{f.getMemoryProfile().then(e=>x({platform:e.platform,gpuVramBytes:e.gpuVramBytes,totalRamBytes:e.totalRamBytes,usableBytes:e.usableBytes,...e.budgetBytes===void 0?{}:{budgetBytes:e.budgetBytes}})).catch(()=>{})},[]);let A=(0,g.useCallback)(async()=>{try{let e=await f.listInstalledVideoModels();a(e.models),s(null)}catch(e){a([]),s(e.message)}},[]),j=(0,g.useCallback)((e,n)=>{let r=new AbortController;l(t=>{let n=new Map(t),i=n.get(e);return n.set(e,{...i??{id:e,bytesWritten:0,totalBytes:0},controller:r}),n}),n(n=>{n.type===`progress`?l(t=>{let r=new Map(t),i=r.get(e);if(!i)return t;let{retrying:a,verifying:o,...s}=i;return r.set(e,{...s,bytesWritten:n.bytesWrittenAll,totalBytes:n.totalBytesAll||i.totalBytes,fileLabel:`${n.fileIndex+1}/${n.fileCount} ${n.file}`}),r}):n.type===`verifying`?l(t=>{let r=new Map(t),i=r.get(e);return i?(r.set(e,{...i,verifying:n.file}),r):t}):n.type===`retrying`?l(t=>{let r=new Map(t),i=r.get(e);return i?(r.set(e,{...i,retrying:{attempt:n.attempt,maxAttempts:n.maxAttempts,delayMs:n.delayMs,reason:n.reason}}),r):t}):n.type===`error`?l(t=>{let r=new Map(t),i=r.get(e);return i&&r.set(e,{...i,error:n.error,retrying:void 0}),r}):n.type===`done`&&setTimeout(()=>{l(t=>{let n=new Map(t);return n.delete(e),n}),A(),t?.()},800)},r.signal).catch(t=>{r.signal.aborted||l(n=>{let r=new Map(n),i=r.get(e);return i&&r.set(e,{...i,error:t.message}),r})})},[A,t]);(0,g.useEffect)(()=>{A();let e=!1;return f.listActiveVideoPulls().then(({pulls:t})=>{if(!e)for(let e of t)e.finished||(l(t=>{if(t.has(e.id))return t;let n=new Map(t);return n.set(e.id,{id:e.id,bytesWritten:e.bytesWritten,totalBytes:e.totalBytes,controller:new AbortController,...e.retrying?{retrying:e.retrying}:{},...e.error?{error:e.error}:{}}),n}),j(e.id,(t,n)=>f.subscribeVideoPull(e.id,t,n)))}).catch(()=>{}),()=>{e=!0}},[A,j]);let M=(0,g.useCallback)(e=>{k.current.has(e)||j(e,(t,n)=>f.pullVideoModel(e,t,n))},[j]),N=(0,g.useCallback)(e=>{k.current.get(e)?.controller.abort(),l(t=>{let n=new Map(t);return n.delete(e),n}),j(e,(t,n)=>f.pullVideoModel(e,t,n))},[j]),P=(0,g.useCallback)(e=>{k.current.get(e)?.controller.abort(),l(t=>{let n=new Map(t);return n.delete(e),n}),f.cancelVideoPull(e).catch(()=>{})},[]),F=(0,g.useCallback)(async()=>{if(v)try{await f.deleteVideoModel(v),await A(),t?.()}catch(e){s(e.message)}finally{y(null)}},[v,A,t]),I=(0,g.useMemo)(()=>new Set(i.map(e=>e.id)),[i]),L=!!r&&i.length>0,R=n&&I.has(n)?n:i[0]?.id;return(0,_.jsxs)(`div`,{className:`ollama-model-manager`,children:[c.size>0&&(0,_.jsxs)(`div`,{className:`ollama-section`,children:[(0,_.jsx)(`h4`,{children:`Downloading…`}),(0,_.jsx)(`div`,{className:`ollama-pull-list`,children:Array.from(c.values()).map(e=>(0,_.jsx)(D,{pull:e,onCancel:()=>P(e.id),onRetry:()=>N(e.id)},e.id))})]}),(i.length>0||o)&&(0,_.jsxs)(`div`,{className:`ollama-section`,children:[(0,_.jsx)(`h4`,{children:`Local models`}),o&&(0,_.jsx)(`p`,{className:`error`,children:o}),L&&i.length>1&&(0,_.jsxs)(`p`,{className:`muted small`,children:[`The `,(0,_.jsx)(`strong`,{children:`active`}),` model is what the video-generator gezel and the`,` `,(0,_.jsx)(`code`,{children:`generate_video`}),` tool use by default. A gezel can still ask for a specific model per clip; switching reloads the engine, which takes a moment.`]}),i.length>0&&(0,_.jsxs)(`table`,{className:`ollama-model-table`,children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{children:[L&&(0,_.jsx)(`th`,{scope:`col`,className:`gz-active-model-column`,children:`Active`}),(0,_.jsx)(`th`,{children:`Name`}),(0,_.jsx)(`th`,{children:`Size`}),(0,_.jsx)(`th`,{children:`Added`}),(0,_.jsx)(`th`,{})]})}),(0,_.jsx)(`tbody`,{children:i.map(e=>(0,_.jsxs)(`tr`,{children:[L&&(0,_.jsx)(`td`,{className:`gz-active-model-column`,children:(0,_.jsx)(`input`,{type:`radio`,name:`active-video-model`,className:`gz-active-model-radio`,"aria-label":`Use ${e.id} as the active video model`,checked:R===e.id,onChange:()=>{R!==e.id&&r?.(e.id)}})}),(0,_.jsxs)(`td`,{children:[(0,_.jsx)(`code`,{children:e.id}),(0,_.jsx)(`div`,{className:`muted small`,children:e.name})]}),(0,_.jsx)(`td`,{children:S(e.approxSizeBytes)}),(0,_.jsx)(`td`,{className:`muted small`,children:new Date(e.installedAt).toLocaleDateString()}),(0,_.jsx)(`td`,{children:e.readOnly?(0,_.jsx)(`span`,{className:`muted small`,title:`Installed for every user of this machine by the Gezel service. It can only be removed by an administrator, not from here.`,children:`Machine-wide`}):(0,_.jsx)(`button`,{type:`button`,className:`gz-link-button`,onClick:()=>y(e.id),children:`Delete`})})]},e.id))})]})]}),(0,_.jsxs)(`div`,{className:`ollama-section ollama-section--flat ollama-section--download`,children:[(0,_.jsx)(`h4`,{children:`Download a model`}),(0,_.jsx)(m,{kind:`video-model`,emptyMessage:`No video models in the catalog yet. Remote catalog sources can add entries without an app update.`,action:t=>{if(t.manifest.kind!==`video-model`)return null;let n=t.manifest,r=I.has(n.id),i=c.get(n.id),a=!!i,o=i&&i.totalBytes>0?Math.min(100,Math.round(i.bytesWritten/i.totalBytes*100)):null,s=!b||u(b,{minVramGB:n.minVramGB});return(0,_.jsxs)(`div`,{className:`catalog-ollama-action`,children:[(0,_.jsxs)(`div`,{className:`catalog-ollama-meta`,children:[(0,_.jsxs)(`div`,{className:`catalog-ollama-specs muted small`,children:[(0,_.jsx)(`code`,{children:n.id}),(0,_.jsx)(`span`,{children:`·`}),(0,_.jsx)(`span`,{children:S(n.approxSizeBytes)}),(0,_.jsx)(`span`,{children:`·`}),(0,_.jsx)(`span`,{children:n.family.toUpperCase()}),(0,_.jsx)(`span`,{children:`·`}),(0,_.jsx)(`span`,{children:C(n.hardwareTier,n.minVramGB)}),b&&!s&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`span`,{children:`·`}),(0,_.jsx)(`span`,{className:`catalog-ollama-warn`,title:`Recommended ${n.minVramGB} GB · this machine ~${w(d(b))} GB usable`,children:`may exceed this machine`})]})]}),(0,_.jsx)(`div`,{className:`catalog-ollama-pills`,children:(0,_.jsx)(h,{manifest:n})})]}),(0,_.jsx)(`button`,{type:`button`,disabled:r||a||!!e,title:e??void 0,onClick:()=>{s||!b?M(n.id):O({id:n.id,message:T(b,n)})},children:r?`On device`:a?o===null?`Downloading…`:`Downloading… ${o}%`:`Download`})]})}})]}),(0,_.jsx)(p,{open:v!==null,title:`Delete video model?`,message:v?`"${v}" will be removed from local storage. This frees disk space; download it again later to use it.`:``,confirmLabel:`Delete`,danger:!0,onCancel:()=>y(null),onConfirm:F}),(0,_.jsx)(p,{open:E!==null,title:`This model may not fit`,message:E?.message,confirmLabel:`Download anyway`,onCancel:()=>O(null),onConfirm:()=>{E&&M(E.id),O(null)}})]})}function D({pull:e,onCancel:t,onRetry:n}){let r=e.totalBytes>0,i=r?Math.min(100,Math.round(e.bytesWritten/e.totalBytes*100)):0,a;if(e.error)a=e.error;else if(e.retrying){let t=Math.max(1,Math.round(e.retrying.delayMs/1e3));a=`${e.retrying.reason} — retrying in ${t}s (attempt ${e.retrying.attempt}/${e.retrying.maxAttempts})`}else if(e.verifying)a=`Verifying ${e.verifying}…`;else if(r){let t=e.fileLabel?` · ${e.fileLabel}`:``;a=`Downloading… (${S(e.bytesWritten)} of ${S(e.totalBytes)}, ${i}%)${t}`}else a=e.bytesWritten>0?`Downloading… (${S(e.bytesWritten)})`:`Preparing download…`;return(0,_.jsxs)(`div`,{className:`ollama-pull${e.error?` ollama-pull-error`:e.retrying?` ollama-pull-warning`:``}`,children:[(0,_.jsxs)(`div`,{className:`ollama-pull-head`,children:[(0,_.jsx)(`code`,{children:e.id}),(0,_.jsx)(`span`,{className:`muted small`,children:a}),e.error?(0,_.jsx)(`button`,{type:`button`,className:`gz-link-button`,onClick:n,children:`Retry`}):(0,_.jsx)(`button`,{type:`button`,className:`gz-link-button`,onClick:t,children:`Cancel`})]}),r?(0,_.jsxs)(`div`,{className:`ollama-pull-bar`,children:[(0,_.jsx)(`div`,{className:`ollama-pull-bar-fill`,style:{width:`${i}%`}}),(0,_.jsxs)(`span`,{className:`ollama-pull-bar-label`,children:[i,`%`]})]}):(0,_.jsx)(`div`,{className:`ollama-pull-bar ollama-pull-bar-indeterminate`,children:(0,_.jsx)(`div`,{className:`ollama-pull-bar-fill`})})]})}function O({onModelsChanged:e}){let[t,n]=(0,g.useState)({kind:`idle`}),[r,i]=(0,g.useState)(0),[a,o]=(0,g.useState)(null),[s,c]=(0,g.useState)(null),[l,u]=(0,g.useState)(null),d=(0,g.useCallback)(async()=>{n({kind:`probing`});try{let[e,t,r]=await Promise.all([f.getVideoEngineStatus(),f.getConfig(),f.getMemoryProfile().catch(()=>null)]);o(t),c(r),e.engine.status===`not-configured`?n({kind:`engine-not-configured`,status:e}):e.engine.status===`unreachable`?n({kind:`engine-unreachable`,status:e}):e.modelCount===0?n({kind:`no-models`,status:e}):n({kind:`ready`,status:e})}catch(e){n({kind:`probe-failed`,error:e.message})}},[]);(0,g.useEffect)(()=>{d()},[d,r]);let p=t.kind===`probe-failed`,m=`status`in t?t.status.engine.accelerator:void 0,h=(0,g.useCallback)(async e=>{u(`saving…`);try{let t=await f.updateConfig({videoGenerationConfirmation:e});o(t),u(null)}catch(e){u(`save failed: ${e.message}`)}},[]),v=(0,g.useCallback)(async e=>{u(`saving…`);try{let t=await f.updateConfig({defaultVideoModel:e});o(t),u(null)}catch(e){u(`save failed: ${e.message}`)}},[]),y=N(a?.videoGenerationConfirmation);return(0,_.jsxs)(`div`,{className:`provider-card`,children:[(0,_.jsxs)(`div`,{className:`settings-card-header`,children:[(0,_.jsx)(`h3`,{children:`Video generation`}),(0,_.jsx)(P,{probe:t})]}),(0,_.jsx)(`p`,{className:`muted small`,children:`Generate short video clips locally on your own machine. The first-time setup takes a few minutes; after that, each clip can still take anywhere from several minutes to a few hours, depending on the model and your hardware.`}),(0,_.jsx)(b,{}),m===`cpu`&&(0,_.jsx)(M,{memory:s}),t.kind===`probe-failed`&&(0,_.jsxs)(`p`,{className:`error`,children:[`Couldn't reach the Gezel service. Details: `,t.error]}),(0,_.jsx)(E,{...p?{disabledReason:`Video engine is not reachable.`}:{},...a?.defaultVideoModel?{configuredDefaultModelId:a.defaultVideoModel}:{},onSetActiveModel:v,onModelsChanged:()=>{i(e=>e+1),e?.()}}),(0,_.jsxs)(`fieldset`,{className:`provider-row`,style:{flexDirection:`column`,alignItems:`flex-start`},children:[(0,_.jsx)(`legend`,{children:`Confirmation`}),(0,_.jsx)(`p`,{className:`muted small`,children:`Video generation is long-running and monopolizes the GPU, pausing the chat model. Choose whether the agent should ask before each generation.`}),(0,_.jsxs)(`div`,{className:`gz-tray`,role:`radiogroup`,"aria-label":`Video generation confirmation`,children:[(0,_.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":y===`ask`,className:`gz-key${y===`ask`?` gz-key-active`:``}`,onClick:()=>void h(`ask`),children:`Ask before each generation (default)`}),(0,_.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":y===`always-allow`,className:`gz-key${y===`always-allow`?` gz-key-active`:``}`,onClick:()=>void h(`always-allow`),children:`Always allow without asking`})]})]}),l&&(0,_.jsx)(`p`,{className:`muted small`,children:l})]})}var k={amd:`AMD`,nvidia:`Nvidia`,intel:`Intel`};function A(e){if(!(e?.source===`gpu-nvidia`||e?.source===`gpu-vulkan`))return{kind:`no-gpu`};let t=e?.gpuVendor;return t===`nvidia`?{kind:`cuda-unavailable`}:{kind:`unsupported-gpu`,vendorLabel:t?k[t]:null}}var j=`which is extremely slow (minutes to hours per clip)`;function M({memory:e}){let t=A(e);return t.kind===`unsupported-gpu`?(0,_.jsxs)(`p`,{className:`error`,children:[t.vendorLabel?`Your ${t.vendorLabel} GPU`:`This machine's GPU`,` can't be used for video generation — the video engine is built on PyTorch, which only accelerates on NVIDIA (CUDA) cards and Apple Silicon. Chat still runs on your GPU; video will be generated on the `,(0,_.jsx)(`strong`,{children:`CPU`}),`, `,j,`.`]}):t.kind===`cuda-unavailable`?(0,_.jsxs)(`p`,{className:`error`,children:[`An NVIDIA GPU is present, but the video engine couldn't reach CUDA — check that the NVIDIA driver is installed and that `,(0,_.jsx)(`code`,{children:`nvidia-smi`}),` runs. Until then video will be generated on the `,(0,_.jsx)(`strong`,{children:`CPU`}),`, `,j,`.`]}):(0,_.jsxs)(`p`,{className:`error`,children:[`No GPU detected — video will be generated on the `,(0,_.jsx)(`strong`,{children:`CPU`}),`, `,j,`. A CUDA (NVIDIA) GPU or Apple Silicon is strongly recommended.`]})}function N(e){return e===`always-allow`?`always-allow`:`ask`}function P({probe:e}){switch(e.kind){case`idle`:case`probing`:return(0,_.jsx)(`span`,{className:`gz-status-pill`,children:`Probing…`});case`ready`:return(0,_.jsx)(`span`,{className:`gz-status-pill gz-status-pill--ok`,children:`Ready`});case`no-models`:return(0,_.jsx)(`span`,{className:`gz-status-pill gz-status-pill--warn`,children:`No local models`});case`engine-not-configured`:return(0,_.jsx)(`span`,{className:`gz-status-pill gz-status-pill--warn`,children:`Engine not configured`});case`engine-unreachable`:return(0,_.jsx)(`span`,{className:`gz-status-pill gz-status-pill--fail`,children:`Engine unreachable`});case`probe-failed`:return(0,_.jsx)(`span`,{className:`gz-status-pill gz-status-pill--fail`,children:`Service unreachable`})}}export{O as VideoEngineSettings,A as cpuFallbackCause};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{Ct as r,It as i,vn as a}from"./dist-BqGwkOe5.js";import{t as o}from"./api-BPraLwsh.js";import{G as s,J as c,K as l,W as u,Y as d,q as f}from"./primitives-CWrGZpPI.js";import{t as p}from"./ConfirmDialog-Dt1ed4Fh.js";import{t as m}from"./CatalogBrowser-DEM9t7Es.js";import{t as h}from"./LicenseButton-D3VmcVG1.js";var g=e(t(),1),_=n(),v=`video-generator`,y=`generate_video`;function b(){let[e,t]=(0,g.useState)([]),[n,r]=(0,g.useState)(!0),[i,a]=(0,g.useState)(!1),s=(0,g.useCallback)(async()=>{r(!0);try{let e=await o.listGezels();t(e.gezels)}catch{}finally{r(!1)}},[]);(0,g.useEffect)(()=>{s();let e=()=>void s();return window.addEventListener(`gezel:gezel-updated`,e),()=>window.removeEventListener(`gezel:gezel-updated`,e)},[s]);let c=(0,g.useMemo)(()=>e.filter(e=>e.fixedFunction?.tool===y),[e]),l=(0,g.useCallback)(e=>{window.dispatchEvent(new CustomEvent(`gezel:open-tab`,{detail:{kind:`gezel`,id:e,activate:!0}}))},[]),u=(0,g.useCallback)(e=>{a(!1),s(),l(e.id)},[s,l]);return n?null:(0,_.jsxs)(`div`,{className:`ff-img-hint`,children:[c.length>0?(0,_.jsxs)(`div`,{className:`ff-img-hint-have`,children:[(0,_.jsx)(`span`,{className:`muted small`,children:`Video-generator gezel`}),c.length===1?(0,_.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>l(c[0].id),title:`Open ${c[0].name}`,children:c[0].name}):(0,_.jsx)(`span`,{children:c.map((e,t)=>(0,_.jsxs)(`span`,{children:[(0,_.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>l(e.id),title:`Open ${e.name}`,children:e.name}),t<c.length-1&&(0,_.jsx)(`span`,{className:`muted`,children:`, `})]},e.id))}),(0,_.jsx)(`span`,{className:`muted small`,children:`— @-mention them in chat to generate.`})]}):(0,_.jsxs)(`div`,{className:`ff-img-hint-empty`,children:[(0,_.jsxs)(`p`,{className:`muted small`,children:[`Once a model is on your device, the easiest way to use it from chat is to add a`,` `,(0,_.jsx)(`strong`,{children:`video-generator gezel`}),`. It takes your exact prompt and passes it straight to the video-generation AI, so use terse, concrete descriptions — e.g.`,` `,(0,_.jsx)(`em`,{children:`"a red hot-air balloon drifting over snowy mountains at sunrise, slow aerial shot."`})]}),(0,_.jsx)(`button`,{type:`button`,className:`primary`,onClick:()=>a(!0),children:`Add a video-generator gezel`})]}),(0,_.jsx)(x,{open:i,onClose:()=>a(!1),onCreated:u})]})}function x({open:e,onClose:t,onCreated:n}){let[r,a]=(0,g.useState)(()=>i()),[p,m]=(0,g.useState)(null),[h,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(null),[S,C]=(0,g.useState)(!1),w=(0,g.useRef)(!1);(0,g.useEffect)(()=>{!e||w.current||(w.current=!0,C(!0),o.getCatalogItem(`gezel-template`,v).then(e=>{e.manifest.kind===`gezel-template`&&m(e.manifest.description)}).catch(e=>{x(e instanceof Error?e.message:String(e))}).finally(()=>C(!1)))},[e]),(0,g.useEffect)(()=>{e&&(a(i()),x(null),y(!1))},[e]);let T=()=>a(i()),E=(0,g.useCallback)(async()=>{if(r.trim()){y(!0),x(null);try{n(await o.createGezelFromTemplate(v,{name:r.trim()}))}catch(e){x(e instanceof Error?e.message:String(e))}finally{y(!1)}}},[r,n]);return(0,_.jsx)(c,{open:e,onOpenChange:e=>{!e&&!h&&t()},children:(0,_.jsxs)(f,{children:[(0,_.jsx)(l,{}),(0,_.jsxs)(u,{className:`template-picker-dialog`,children:[(0,_.jsxs)(`header`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`baseline`},children:[(0,_.jsx)(d,{asChild:!0,children:(0,_.jsx)(`h3`,{style:{margin:0},children:`Add a video-generator gezel`})}),(0,_.jsx)(`button`,{type:`button`,className:`gz-link-button`,onClick:t,disabled:h,children:`Cancel`})]}),(0,_.jsx)(s,{className:`muted small`,style:{margin:`0.25rem 0 0.5rem 0`},children:`Passes your exact prompt straight to the video-generation AI. Works best with terse, concrete descriptions.`}),S&&(0,_.jsx)(`p`,{className:`muted small`,children:`Loading template…`}),p&&(0,_.jsx)(`p`,{className:`muted small`,children:p}),(0,_.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),E()},style:{marginTop:`0.5rem`,padding:`0.6rem`,background:`rgba(79, 125, 255, 0.06)`,borderRadius:`6px`,display:`flex`,flexDirection:`column`,gap:`0.5rem`},children:(0,_.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`,alignItems:`center`},children:[(0,_.jsx)(`span`,{className:`muted small`,style:{flexShrink:0},children:`Name:`}),(0,_.jsx)(`input`,{value:r,onChange:e=>a(e.target.value),disabled:h,style:{flex:1}}),(0,_.jsx)(`button`,{type:`button`,className:`dice-btn`,onClick:T,disabled:h,title:`Pick a random name`,"aria-label":`Pick a random name`,children:`🎲`}),(0,_.jsx)(`button`,{type:`submit`,className:`primary`,disabled:h||!r.trim(),children:h?`Creating…`:`Create`})]})}),b&&(0,_.jsx)(`p`,{className:`error`,children:b})]})]})})}function S(e){return e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${(e/1024**2).toFixed(0)} MB`:e>=1024?`${(e/1024).toFixed(0)} KB`:`${e} B`}function C(e,t){switch(e){case`low`:return`Runs on ${t} GB`;case`mid`:return`${t} GB+`;case`high`:return`${t} GB+ recommended`;case`workstation`:return`${t} GB+ workstation`}}function w(e){return Math.round(e/1024**3)}function T(e,t){return`${t.name} recommends about ${t.minVramGB} GB of fast (GPU / unified) memory, but this machine has roughly ${w(a(e))} GB usable for generation (${w(e.totalRamBytes)} GB total). It may run out of memory or fail to load. Download this ${S(t.approxSizeBytes)} model anyway?`}function E({disabledReason:e,onModelsChanged:t,configuredDefaultModelId:n,onSetActiveModel:i}){let[s,c]=(0,g.useState)([]),[l,u]=(0,g.useState)(null),[d,f]=(0,g.useState)(new Map),[v,y]=(0,g.useState)(null),[b,x]=(0,g.useState)(null),[E,O]=(0,g.useState)(null),k=(0,g.useRef)(d);k.current=d,(0,g.useEffect)(()=>{o.getMemoryProfile().then(e=>x({platform:e.platform,gpuVramBytes:e.gpuVramBytes,totalRamBytes:e.totalRamBytes,usableBytes:e.usableBytes,...e.budgetBytes===void 0?{}:{budgetBytes:e.budgetBytes}})).catch(()=>{})},[]);let A=(0,g.useCallback)(async()=>{try{let e=await o.listInstalledVideoModels();c(e.models),u(null)}catch(e){c([]),u(e.message)}},[]),j=(0,g.useCallback)((e,n)=>{let r=new AbortController;f(t=>{let n=new Map(t),i=n.get(e);return n.set(e,{...i??{id:e,bytesWritten:0,totalBytes:0},controller:r}),n}),n(n=>{n.type===`progress`?f(t=>{let r=new Map(t),i=r.get(e);if(!i)return t;let{retrying:a,verifying:o,...s}=i;return r.set(e,{...s,bytesWritten:n.bytesWrittenAll,totalBytes:n.totalBytesAll||i.totalBytes,fileLabel:`${n.fileIndex+1}/${n.fileCount} ${n.file}`}),r}):n.type===`verifying`?f(t=>{let r=new Map(t),i=r.get(e);return i?(r.set(e,{...i,verifying:n.file}),r):t}):n.type===`retrying`?f(t=>{let r=new Map(t),i=r.get(e);return i?(r.set(e,{...i,retrying:{attempt:n.attempt,maxAttempts:n.maxAttempts,delayMs:n.delayMs,reason:n.reason}}),r):t}):n.type===`error`?f(t=>{let r=new Map(t),i=r.get(e);return i&&r.set(e,{...i,error:n.error,retrying:void 0}),r}):n.type===`done`&&setTimeout(()=>{f(t=>{let n=new Map(t);return n.delete(e),n}),A(),t?.()},800)},r.signal).catch(t=>{r.signal.aborted||f(n=>{let r=new Map(n),i=r.get(e);return i&&r.set(e,{...i,error:t.message}),r})})},[A,t]);(0,g.useEffect)(()=>{A();let e=!1;return o.listActiveVideoPulls().then(({pulls:t})=>{if(!e)for(let e of t)e.finished||(f(t=>{if(t.has(e.id))return t;let n=new Map(t);return n.set(e.id,{id:e.id,bytesWritten:e.bytesWritten,totalBytes:e.totalBytes,controller:new AbortController,...e.retrying?{retrying:e.retrying}:{},...e.error?{error:e.error}:{}}),n}),j(e.id,(t,n)=>o.subscribeVideoPull(e.id,t,n)))}).catch(()=>{}),()=>{e=!0}},[A,j]);let M=(0,g.useCallback)(e=>{k.current.has(e)||j(e,(t,n)=>o.pullVideoModel(e,t,n))},[j]),N=(0,g.useCallback)(e=>{k.current.get(e)?.controller.abort(),f(t=>{let n=new Map(t);return n.delete(e),n}),j(e,(t,n)=>o.pullVideoModel(e,t,n))},[j]),P=(0,g.useCallback)(e=>{k.current.get(e)?.controller.abort(),f(t=>{let n=new Map(t);return n.delete(e),n}),o.cancelVideoPull(e).catch(()=>{})},[]),F=(0,g.useCallback)(async()=>{if(v)try{await o.deleteVideoModel(v),await A(),t?.()}catch(e){u(e.message)}finally{y(null)}},[v,A,t]),I=(0,g.useMemo)(()=>new Set(s.map(e=>e.id)),[s]),L=!!i&&s.length>0,R=n&&I.has(n)?n:s[0]?.id;return(0,_.jsxs)(`div`,{className:`ollama-model-manager`,children:[d.size>0&&(0,_.jsxs)(`div`,{className:`ollama-section`,children:[(0,_.jsx)(`h4`,{children:`Downloading…`}),(0,_.jsx)(`div`,{className:`ollama-pull-list`,children:Array.from(d.values()).map(e=>(0,_.jsx)(D,{pull:e,onCancel:()=>P(e.id),onRetry:()=>N(e.id)},e.id))})]}),(s.length>0||l)&&(0,_.jsxs)(`div`,{className:`ollama-section`,children:[(0,_.jsx)(`h4`,{children:`Local models`}),l&&(0,_.jsx)(`p`,{className:`error`,children:l}),L&&s.length>1&&(0,_.jsxs)(`p`,{className:`muted small`,children:[`The `,(0,_.jsx)(`strong`,{children:`active`}),` model is what the video-generator gezel and the`,` `,(0,_.jsx)(`code`,{children:`generate_video`}),` tool use by default. A gezel can still ask for a specific model per clip; switching reloads the engine, which takes a moment.`]}),s.length>0&&(0,_.jsxs)(`table`,{className:`ollama-model-table`,children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{children:[L&&(0,_.jsx)(`th`,{scope:`col`,className:`gz-active-model-column`,children:`Active`}),(0,_.jsx)(`th`,{children:`Name`}),(0,_.jsx)(`th`,{children:`Size`}),(0,_.jsx)(`th`,{children:`Added`}),(0,_.jsx)(`th`,{})]})}),(0,_.jsx)(`tbody`,{children:s.map(e=>(0,_.jsxs)(`tr`,{children:[L&&(0,_.jsx)(`td`,{className:`gz-active-model-column`,children:(0,_.jsx)(`input`,{type:`radio`,name:`active-video-model`,className:`gz-active-model-radio`,"aria-label":`Use ${e.id} as the active video model`,checked:R===e.id,onChange:()=>{R!==e.id&&i?.(e.id)}})}),(0,_.jsxs)(`td`,{children:[(0,_.jsx)(`code`,{children:e.id}),(0,_.jsx)(`div`,{className:`muted small`,children:e.name})]}),(0,_.jsx)(`td`,{children:S(e.approxSizeBytes)}),(0,_.jsx)(`td`,{className:`muted small`,children:new Date(e.installedAt).toLocaleDateString()}),(0,_.jsx)(`td`,{children:e.readOnly?(0,_.jsx)(`span`,{className:`muted small`,title:`Installed for every user of this machine by the Gezel service. It can only be removed by an administrator, not from here.`,children:`Machine-wide`}):(0,_.jsx)(`button`,{type:`button`,className:`gz-link-button`,onClick:()=>y(e.id),children:`Delete`})})]},e.id))})]})]}),(0,_.jsxs)(`div`,{className:`ollama-section ollama-section--flat ollama-section--download`,children:[(0,_.jsx)(`h4`,{children:`Download a model`}),(0,_.jsx)(m,{kind:`video-model`,emptyMessage:`No video models in the catalog yet. Remote catalog sources can add entries without an app update.`,action:t=>{if(t.manifest.kind!==`video-model`)return null;let n=t.manifest,i=I.has(n.id),o=d.get(n.id),s=!!o,c=o&&o.totalBytes>0?Math.min(100,Math.round(o.bytesWritten/o.totalBytes*100)):null,l=!b||r(b,{minVramGB:n.minVramGB});return(0,_.jsxs)(`div`,{className:`catalog-ollama-action`,children:[(0,_.jsxs)(`div`,{className:`catalog-ollama-meta`,children:[(0,_.jsxs)(`div`,{className:`catalog-ollama-specs muted small`,children:[(0,_.jsx)(`code`,{children:n.id}),(0,_.jsx)(`span`,{children:`·`}),(0,_.jsx)(`span`,{children:S(n.approxSizeBytes)}),(0,_.jsx)(`span`,{children:`·`}),(0,_.jsx)(`span`,{children:n.family.toUpperCase()}),(0,_.jsx)(`span`,{children:`·`}),(0,_.jsx)(`span`,{children:C(n.hardwareTier,n.minVramGB)}),b&&!l&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`span`,{children:`·`}),(0,_.jsx)(`span`,{className:`catalog-ollama-warn`,title:`Recommended ${n.minVramGB} GB · this machine ~${w(a(b))} GB usable`,children:`may exceed this machine`})]})]}),(0,_.jsx)(`div`,{className:`catalog-ollama-pills`,children:(0,_.jsx)(h,{manifest:n})})]}),(0,_.jsx)(`button`,{type:`button`,disabled:i||s||!!e,title:e??void 0,onClick:()=>{l||!b?M(n.id):O({id:n.id,message:T(b,n)})},children:i?`On device`:s?c===null?`Downloading…`:`Downloading… ${c}%`:`Download`})]})}})]}),(0,_.jsx)(p,{open:v!==null,title:`Delete video model?`,message:v?`"${v}" will be removed from local storage. This frees disk space; download it again later to use it.`:``,confirmLabel:`Delete`,danger:!0,onCancel:()=>y(null),onConfirm:F}),(0,_.jsx)(p,{open:E!==null,title:`This model may not fit`,message:E?.message,confirmLabel:`Download anyway`,onCancel:()=>O(null),onConfirm:()=>{E&&M(E.id),O(null)}})]})}function D({pull:e,onCancel:t,onRetry:n}){let r=e.totalBytes>0,i=r?Math.min(100,Math.round(e.bytesWritten/e.totalBytes*100)):0,a;if(e.error)a=e.error;else if(e.retrying){let t=Math.max(1,Math.round(e.retrying.delayMs/1e3));a=`${e.retrying.reason} — retrying in ${t}s (attempt ${e.retrying.attempt}/${e.retrying.maxAttempts})`}else if(e.verifying)a=`Verifying ${e.verifying}…`;else if(r){let t=e.fileLabel?` · ${e.fileLabel}`:``;a=`Downloading… (${S(e.bytesWritten)} of ${S(e.totalBytes)}, ${i}%)${t}`}else a=e.bytesWritten>0?`Downloading… (${S(e.bytesWritten)})`:`Preparing download…`;return(0,_.jsxs)(`div`,{className:`ollama-pull${e.error?` ollama-pull-error`:e.retrying?` ollama-pull-warning`:``}`,children:[(0,_.jsxs)(`div`,{className:`ollama-pull-head`,children:[(0,_.jsx)(`code`,{children:e.id}),(0,_.jsx)(`span`,{className:`muted small`,children:a}),e.error?(0,_.jsx)(`button`,{type:`button`,className:`gz-link-button`,onClick:n,children:`Retry`}):(0,_.jsx)(`button`,{type:`button`,className:`gz-link-button`,onClick:t,children:`Cancel`})]}),r?(0,_.jsxs)(`div`,{className:`ollama-pull-bar`,children:[(0,_.jsx)(`div`,{className:`ollama-pull-bar-fill`,style:{width:`${i}%`}}),(0,_.jsxs)(`span`,{className:`ollama-pull-bar-label`,children:[i,`%`]})]}):(0,_.jsx)(`div`,{className:`ollama-pull-bar ollama-pull-bar-indeterminate`,children:(0,_.jsx)(`div`,{className:`ollama-pull-bar-fill`})})]})}function O({onModelsChanged:e}){let[t,n]=(0,g.useState)({kind:`idle`}),[r,i]=(0,g.useState)(0),[a,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(null),[u,d]=(0,g.useState)(null),f=(0,g.useCallback)(async()=>{n({kind:`probing`});try{let[e,t,r]=await Promise.all([o.getVideoEngineStatus(),o.getConfig(),o.getMemoryProfile().catch(()=>null)]);s(t),l(r),e.engine.status===`not-configured`?n({kind:`engine-not-configured`,status:e}):e.engine.status===`unreachable`?n({kind:`engine-unreachable`,status:e}):e.modelCount===0?n({kind:`no-models`,status:e}):n({kind:`ready`,status:e})}catch(e){n({kind:`probe-failed`,error:e.message})}},[]);(0,g.useEffect)(()=>{f()},[f,r]);let p=t.kind===`probe-failed`,m=`status`in t?t.status.engine.accelerator:void 0,h=(0,g.useCallback)(async e=>{d(`saving…`);try{let t=await o.updateConfig({videoGenerationConfirmation:e});s(t),d(null)}catch(e){d(`save failed: ${e.message}`)}},[]),v=(0,g.useCallback)(async e=>{d(`saving…`);try{let t=await o.updateConfig({defaultVideoModel:e});s(t),d(null)}catch(e){d(`save failed: ${e.message}`)}},[]),y=N(a?.videoGenerationConfirmation);return(0,_.jsxs)(`div`,{className:`provider-card`,children:[(0,_.jsxs)(`div`,{className:`settings-card-header`,children:[(0,_.jsx)(`h3`,{children:`Video generation`}),(0,_.jsx)(P,{probe:t})]}),(0,_.jsx)(`p`,{className:`muted small`,children:`Generate short video clips locally on your own machine. The first-time setup takes a few minutes; after that, each clip can still take anywhere from several minutes to a few hours, depending on the model and your hardware.`}),(0,_.jsx)(b,{}),m===`cpu`&&(0,_.jsx)(M,{memory:c}),t.kind===`probe-failed`&&(0,_.jsxs)(`p`,{className:`error`,children:[`Couldn't reach the Gezel service. Details: `,t.error]}),(0,_.jsx)(E,{...p?{disabledReason:`Video engine is not reachable.`}:{},...a?.defaultVideoModel?{configuredDefaultModelId:a.defaultVideoModel}:{},onSetActiveModel:v,onModelsChanged:()=>{i(e=>e+1),e?.()}}),(0,_.jsxs)(`fieldset`,{className:`provider-row`,style:{flexDirection:`column`,alignItems:`flex-start`},children:[(0,_.jsx)(`legend`,{children:`Confirmation`}),(0,_.jsx)(`p`,{className:`muted small`,children:`Video generation is long-running and monopolizes the GPU, pausing the chat model. Choose whether the agent should ask before each generation.`}),(0,_.jsxs)(`div`,{className:`gz-tray`,role:`radiogroup`,"aria-label":`Video generation confirmation`,children:[(0,_.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":y===`ask`,className:`gz-key${y===`ask`?` gz-key-active`:``}`,onClick:()=>void h(`ask`),children:`Ask before each generation (default)`}),(0,_.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":y===`always-allow`,className:`gz-key${y===`always-allow`?` gz-key-active`:``}`,onClick:()=>void h(`always-allow`),children:`Always allow without asking`})]})]}),u&&(0,_.jsx)(`p`,{className:`muted small`,children:u})]})}var k={amd:`AMD`,nvidia:`Nvidia`,intel:`Intel`};function A(e){if(!(e?.source===`gpu-nvidia`||e?.source===`gpu-vulkan`))return{kind:`no-gpu`};let t=e?.gpuVendor;return t===`nvidia`?{kind:`cuda-unavailable`}:{kind:`unsupported-gpu`,vendorLabel:t?k[t]:null}}var j=`which is extremely slow (minutes to hours per clip)`;function M({memory:e}){let t=A(e);return t.kind===`unsupported-gpu`?(0,_.jsxs)(`p`,{className:`error`,children:[t.vendorLabel?`Your ${t.vendorLabel} GPU`:`This machine's GPU`,` can't be used for video generation — the video engine is built on PyTorch, which only accelerates on NVIDIA (CUDA) cards and Apple Silicon. Chat still runs on your GPU; video will be generated on the `,(0,_.jsx)(`strong`,{children:`CPU`}),`, `,j,`.`]}):t.kind===`cuda-unavailable`?(0,_.jsxs)(`p`,{className:`error`,children:[`An NVIDIA GPU is present, but the video engine couldn't reach CUDA — check that the NVIDIA driver is installed and that `,(0,_.jsx)(`code`,{children:`nvidia-smi`}),` runs. Until then video will be generated on the `,(0,_.jsx)(`strong`,{children:`CPU`}),`, `,j,`.`]}):(0,_.jsxs)(`p`,{className:`error`,children:[`No GPU detected — video will be generated on the `,(0,_.jsx)(`strong`,{children:`CPU`}),`, `,j,`. A CUDA (NVIDIA) GPU or Apple Silicon is strongly recommended.`]})}function N(e){return e===`always-allow`?`always-allow`:`ask`}function P({probe:e}){switch(e.kind){case`idle`:case`probing`:return(0,_.jsx)(`span`,{className:`gz-status-pill`,children:`Probing…`});case`ready`:return(0,_.jsx)(`span`,{className:`gz-status-pill gz-status-pill--ok`,children:`Ready`});case`no-models`:return(0,_.jsx)(`span`,{className:`gz-status-pill gz-status-pill--warn`,children:`No local models`});case`engine-not-configured`:return(0,_.jsx)(`span`,{className:`gz-status-pill gz-status-pill--warn`,children:`Engine not configured`});case`engine-unreachable`:return(0,_.jsx)(`span`,{className:`gz-status-pill gz-status-pill--fail`,children:`Engine unreachable`});case`probe-failed`:return(0,_.jsx)(`span`,{className:`gz-status-pill gz-status-pill--fail`,children:`Service unreachable`})}}export{O as VideoEngineSettings,A as cpuFallbackCause};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{X as r}from"./dist-BPx-FyRH.js";import{t as i}from"./api-BX5xXiFs.js";import{t as a}from"./MarkdownField-D-0Zw7gM.js";var o=e(t(),1),s=n();function c({path:e,fetchBlob:t,alt:n}){let[r,i]=(0,o.useState)(null),[a,c]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{let n=!1,r=null;return(async()=>{try{let a=await t(e);if(n)return;r=URL.createObjectURL(a),i(r)}catch{n||c(!0)}})(),()=>{n=!0,r&&URL.revokeObjectURL(r)}},[t,e]),a||!r?(0,s.jsx)(`span`,{className:`similar-thumb-fallback`,children:n.slice(0,1).toUpperCase()}):(0,s.jsx)(`img`,{src:r,alt:n})}function l({projectId:e,path:t,fetchBlob:n,onOpen:r}){let[a,l]=(0,o.useState)(`idle`),[u,d]=(0,o.useState)(null),f=(0,o.useCallback)(async()=>{l(`searching`);try{let n=await i.toolFindSimilarImages(e,{path:t,maxResults:8});d(n),l(`done`)}catch{l(`failed`)}},[e,t]);return(0,s.jsxs)(`div`,{className:`similar-images`,children:[a===`idle`&&(0,s.jsx)(`button`,{type:`button`,className:`gz-key`,onClick:()=>void f(),children:`Find similar images`}),a===`searching`&&(0,s.jsx)(`p`,{className:`muted small`,children:`Looking for similar images…`}),a===`failed`&&(0,s.jsx)(`p`,{className:`error small`,children:`The similarity lookup failed.`}),a===`done`&&u&&u.engine!==`vector`&&(0,s.jsx)(`p`,{className:`muted small`,children:`No visual index for this image yet — it builds in the background as images are indexed.`}),a===`done`&&u&&u.engine===`vector`&&u.results.length===0&&(0,s.jsx)(`p`,{className:`muted small`,children:`No visually similar images in this project.`}),a===`done`&&u&&u.engine===`vector`&&u.results.length>0&&(0,s.jsx)(`ul`,{className:`similar-images-strip`,"aria-label":`Images similar to ${t}`,children:u.results.map(e=>(0,s.jsx)(`li`,{children:(0,s.jsxs)(`button`,{type:`button`,className:`similar-thumb`,title:`${e.path} · ${(e.score*100).toFixed(0)}% similar`,onClick:()=>r?.(e.path),children:[(0,s.jsx)(c,{path:e.path,fetchBlob:n,alt:e.path.split(`/`).pop()??e.path}),(0,s.jsx)(`span`,{className:`similar-thumb-name`,children:e.path.split(`/`).pop()})]})},e.path))})]})}var u=()=>void 0;function d({open:e,issueCount:t,onToggle:n}){let r=`${e?`Hide`:`Show`} Boekwachter index pane${t>0?`, ${t} issue${t===1?``:`s`} in this file`:``}`;return(0,s.jsxs)(`button`,{type:`button`,className:`squisq-toolbar-button workspace-index-toggle${e?` squisq-toolbar-button--active`:``}`,onClick:n,"aria-label":r,title:r,"aria-pressed":e,children:[(0,s.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,"aria-hidden":`true`,focusable:`false`,children:[(0,s.jsx)(`rect`,{x:`2.5`,y:`2`,width:`11`,height:`12`,rx:`1.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`}),(0,s.jsx)(`line`,{x1:`5.5`,y1:`2`,x2:`5.5`,y2:`14`,stroke:`currentColor`,strokeWidth:`1.2`}),(0,s.jsx)(`line`,{x1:`8`,y1:`5.25`,x2:`11.5`,y2:`5.25`,stroke:`currentColor`,strokeWidth:`1.1`,strokeLinecap:`round`}),(0,s.jsx)(`line`,{x1:`8`,y1:`8`,x2:`11.5`,y2:`8`,stroke:`currentColor`,strokeWidth:`1.1`,strokeLinecap:`round`}),(0,s.jsx)(`line`,{x1:`8`,y1:`10.75`,x2:`10.5`,y2:`10.75`,stroke:`currentColor`,strokeWidth:`1.1`,strokeLinecap:`round`})]}),t>0&&(0,s.jsx)(`span`,{className:`workspace-index-toggle-count`,"aria-hidden":`true`,children:t})]})}function f({path:e,status:t,issues:n,review:i,loading:c,error:l,onClose:d,onSelectLine:f,onFixIssue:v,onUpdateIssue:y,onOpenTask:b}){let[x,S]=(0,o.useState)(!1),[C,w]=(0,o.useState)(null),[T,E]=(0,o.useState)(null),D=e?e.split(`/`).pop()??e:null,O=e?n?.issues.filter(t=>t.path===e).length??0:0,k=i?.review,A=i?.trackedIssues??[],j=A.length===0?k?.issues??[]:[],M=A.filter(e=>x||e.status===`open`||e.status===`in_progress`),N=k?r(k):null,P=g(t),F=n?`${n.reviewedFiles} of ${n.eligibleFiles} eligible files reviewed`:null,I=async(e,t,n)=>{if(!(!y||C)){w(`${e.ref}:${t}`),E(null);try{await y(e,n)}catch(e){E(e instanceof Error?e.message:String(e))}finally{w(null)}}};return(0,s.jsxs)(`aside`,{className:`workspace-index-pane`,"aria-label":`Boekwachter index results`,children:[(0,s.jsxs)(`header`,{className:`workspace-index-pane-header`,children:[(0,s.jsxs)(`div`,{className:`workspace-index-pane-title`,children:[(0,s.jsx)(`span`,{className:`workspace-index-pane-eyebrow`,children:`Boekwachter`}),(0,s.jsx)(`h2`,{title:e??void 0,children:D??`Index results`})]}),(0,s.jsx)(`button`,{type:`button`,className:`workspace-index-pane-close`,onClick:d,"aria-label":`Close Boekwachter index pane`,title:`Close index pane`,children:(0,s.jsxs)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,s.jsx)(`line`,{x1:`3.5`,y1:`3.5`,x2:`12.5`,y2:`12.5`}),(0,s.jsx)(`line`,{x1:`12.5`,y1:`3.5`,x2:`3.5`,y2:`12.5`})]})})]}),(0,s.jsxs)(`div`,{className:`workspace-index-pane-summary`,children:[(0,s.jsxs)(`span`,{className:`workspace-index-state workspace-index-state-${_(t)}`,children:[(0,s.jsx)(`span`,{"aria-hidden":`true`}),P]}),n&&n.counts.total>0&&(0,s.jsxs)(`span`,{className:`workspace-index-total-issues`,children:[n.counts.total,` workspace issue`,n.counts.total===1?``:`s`]}),F&&(0,s.jsx)(`span`,{className:`workspace-index-coverage`,children:F})]}),(0,s.jsx)(`div`,{className:`workspace-index-pane-body`,children:l?(0,s.jsxs)(`p`,{className:`workspace-index-pane-message error`,role:`alert`,children:[`Couldn’t load the Boekwachter results: `,l]}):e?c?(0,s.jsx)(`p`,{className:`workspace-index-pane-message`,children:`Opening the Boekwachter’s notes…`}):k||A.length>0?(0,s.jsxs)(s.Fragment,{children:[k&&(0,s.jsxs)(`section`,{className:`workspace-index-health`,"aria-label":`File health ${k.health} out of 10`,children:[(0,s.jsxs)(`span`,{className:`workspace-index-health-score`,children:[k.health,(0,s.jsx)(`small`,{children:`/10`})]}),(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`h3`,{children:`File health`}),(0,s.jsx)(`p`,{children:k.healthReason})]})]}),k?.notesMd&&(0,s.jsxs)(`section`,{className:`workspace-index-notes`,children:[(0,s.jsx)(`h3`,{children:`Notes`}),(0,s.jsx)(a,{value:k.notesMd,readOnly:!0,minHeight:`0`,maxHeight:`none`,onCommit:u},`${e}:boekwachter-notes`)]}),(0,s.jsxs)(`section`,{className:`workspace-index-issues`,children:[(0,s.jsxs)(`h3`,{children:[`Issues `,(0,s.jsx)(`span`,{children:A.length||j.length})]}),A.some(e=>e.status===`resolved`||e.status===`dismissed`)&&(0,s.jsx)(`button`,{type:`button`,className:`link-button workspace-index-show-closed`,onClick:()=>S(e=>!e),children:x?`Hide closed`:`Show closed`}),M.length>0||j.length>0?(0,s.jsxs)(`ul`,{children:[M.map(e=>{let t=e.line,n=t==null?null:e.stale?`Previously line ${t}`:`Line ${t}`,r=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(`div`,{className:`workspace-index-issue-meta`,children:[!e.seen&&(0,s.jsx)(`span`,{className:`workspace-index-issue-unread`,title:`Unread issue`,children:`New`}),(0,s.jsx)(`span`,{className:`workspace-index-issue-ref`,children:e.ref}),(0,s.jsx)(`span`,{children:e.severity}),(0,s.jsx)(`span`,{children:e.category}),n&&(0,s.jsx)(`span`,{children:n}),e.stale&&(0,s.jsx)(`span`,{children:`Needs recheck`}),e.status!==`open`&&(0,s.jsx)(`span`,{children:m(e.status)})]}),(0,s.jsx)(`p`,{children:e.message})]});return(0,s.jsxs)(`li`,{"data-status":e.status,children:[t!=null&&f?(0,s.jsx)(`button`,{type:`button`,className:`workspace-index-issue-content workspace-index-issue-selectable`,onClick:()=>{f(t),e.seen||I(e,`read`,{seen:!0})},title:`${e.stale?`Reveal the previous line`:`Select line`} ${t} in ${D??`the source file`}`,children:r}):(0,s.jsx)(`div`,{className:`workspace-index-issue-content`,children:r}),(0,s.jsxs)(`div`,{className:`workspace-index-issue-actions`,children:[e.taskRef&&e.status===`in_progress`&&(0,s.jsxs)(`button`,{type:`button`,className:`link-button workspace-index-issue-task`,onClick:()=>b?.(e.taskRef),children:[`Working · `,e.taskRef]}),(0,s.jsxs)(`div`,{className:`gz-tray workspace-index-issue-tray`,role:`toolbar`,"aria-label":`Actions for ${e.ref}`,children:[y&&(0,s.jsx)(p,{icon:e.seen?`fa-envelope`:`fa-envelope-open`,label:e.seen?`Mark unread`:`Mark read`,disabled:C!==null,onClick:()=>void I(e,e.seen?`unread`:`read`,{seen:!e.seen})}),y&&e.status===`open`&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(p,{icon:`fa-ban`,label:`Not an issue`,disabled:C!==null,onClick:()=>void I(e,`dismiss`,{status:`dismissed`,seen:!0,dismissalReason:`not_an_issue`})}),(0,s.jsx)(p,{icon:`fa-check`,label:`Mark resolved`,disabled:C!==null,onClick:()=>void I(e,`resolve`,{status:`resolved`,seen:!0})})]}),y&&(e.status===`resolved`||e.status===`dismissed`)&&(0,s.jsx)(p,{icon:`fa-rotate-left`,label:`Reopen`,disabled:C!==null,onClick:()=>void I(e,`reopen`,{status:`open`,seen:!0})}),v&&e.status===`open`&&(0,s.jsx)(p,{icon:`fa-wrench`,label:`Fix`,title:`Create a tracked task for ${e.ref}`,className:`workspace-index-issue-fix`,onClick:()=>v(e)})]})]})]},e.id)}),j.map((e,t)=>(0,s.jsx)(h,{issue:e,fileName:D,onSelectLine:f},`${e.category}:${e.message}:${t}`))]}):(0,s.jsx)(`p`,{className:`workspace-index-clean-result`,children:A.length>0?`No open issues in this file.`:`No issues found in this file.`}),T&&(0,s.jsxs)(`p`,{className:`workspace-index-issue-error error`,role:`alert`,children:[`Couldn’t update the issue: `,T]})]}),(0,s.jsxs)(`footer`,{className:`workspace-index-pane-footer`,children:[(0,s.jsx)(`p`,{children:`Leads from a background model pass — its opinion, not a verdict.`}),N&&(0,s.jsx)(`p`,{children:N})]})]}):i?.pending?(0,s.jsx)(`p`,{className:`workspace-index-pane-message`,children:`Not reviewed yet. The Boekwachter studies files while the app is idle or during Night Shift.`}):(0,s.jsx)(`p`,{className:`workspace-index-pane-message`,children:O>0?`${O} indexed issue${O===1?``:`s`} found, but the full review is not available yet.`:`No Boekwachter review is available for this file yet.`}):(0,s.jsx)(`p`,{className:`workspace-index-pane-message`,children:`Select a workspace file to see its review.`})})]})}function p({icon:e,label:t,title:n,className:r,disabled:i,onClick:a}){return(0,s.jsx)(`button`,{type:`button`,className:`gz-key gz-key--icon workspace-index-issue-key${r?` ${r}`:``}`,"aria-label":t,title:n??t,disabled:i,onClick:a,children:(0,s.jsx)(`i`,{className:`fa-solid ${e}`,"aria-hidden":`true`})})}function m(e){switch(e){case`in_progress`:return`In progress`;case`resolved`:return`Resolved`;case`dismissed`:return`Not an issue`;default:return`Open`}}function h({issue:e,fileName:t,onSelectLine:n}){let r=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(`div`,{className:`workspace-index-issue-meta`,children:[(0,s.jsx)(`span`,{children:e.severity}),(0,s.jsx)(`span`,{children:e.category}),e.line!=null&&(0,s.jsxs)(`span`,{children:[`Line `,e.line]})]}),(0,s.jsx)(`p`,{children:e.message})]});return(0,s.jsx)(`li`,{children:e.line!=null&&n?(0,s.jsx)(`button`,{type:`button`,className:`workspace-index-issue-content workspace-index-issue-selectable`,onClick:()=>n(e.line),title:`Select line ${e.line} in ${t??`the source file`}`,children:r}):(0,s.jsx)(`div`,{className:`workspace-index-issue-content`,children:r})})}function g(e){if(!e)return`Checking index`;switch(e.state){case`fresh`:return e.aiScanPending?`AI index in progress`:`Index ready`;case`indexing`:return`Indexing workspace`;case`stale`:return`Index out of date`;case`never`:return`Not indexed`;case`disabled`:return`Indexing off`}}function _(e){return e?e.state===`disabled`?`disabled`:e.state===`indexing`?`indexing`:e.state===`fresh`?e.aiScanPending?`indexing`:`fresh`:`stale`:`checking`}export{c as a,g as i,d as n,l as o,_ as r,f as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{$ as r}from"./dist-BqGwkOe5.js";import{t as i}from"./api-BPraLwsh.js";import{t as a}from"./MarkdownField-CK8K3fzj.js";var o=e(t(),1),s=n();function c({path:e,fetchBlob:t,alt:n}){let[r,i]=(0,o.useState)(null),[a,c]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{let n=!1,r=null;return(async()=>{try{let a=await t(e);if(n)return;r=URL.createObjectURL(a),i(r)}catch{n||c(!0)}})(),()=>{n=!0,r&&URL.revokeObjectURL(r)}},[t,e]),a||!r?(0,s.jsx)(`span`,{className:`similar-thumb-fallback`,children:n.slice(0,1).toUpperCase()}):(0,s.jsx)(`img`,{src:r,alt:n})}function l({projectId:e,path:t,fetchBlob:n,onOpen:r}){let[a,l]=(0,o.useState)(`idle`),[u,d]=(0,o.useState)(null),f=(0,o.useCallback)(async()=>{l(`searching`);try{let n=await i.toolFindSimilarImages(e,{path:t,maxResults:8});d(n),l(`done`)}catch{l(`failed`)}},[e,t]);return(0,s.jsxs)(`div`,{className:`similar-images`,children:[a===`idle`&&(0,s.jsx)(`button`,{type:`button`,className:`gz-key`,onClick:()=>void f(),children:`Find similar images`}),a===`searching`&&(0,s.jsx)(`p`,{className:`muted small`,children:`Looking for similar images…`}),a===`failed`&&(0,s.jsx)(`p`,{className:`error small`,children:`The similarity lookup failed.`}),a===`done`&&u&&u.engine!==`vector`&&(0,s.jsx)(`p`,{className:`muted small`,children:`No visual index for this image yet — it builds in the background as images are indexed.`}),a===`done`&&u&&u.engine===`vector`&&u.results.length===0&&(0,s.jsx)(`p`,{className:`muted small`,children:`No visually similar images in this project.`}),a===`done`&&u&&u.engine===`vector`&&u.results.length>0&&(0,s.jsx)(`ul`,{className:`similar-images-strip`,"aria-label":`Images similar to ${t}`,children:u.results.map(e=>(0,s.jsx)(`li`,{children:(0,s.jsxs)(`button`,{type:`button`,className:`similar-thumb`,title:`${e.path} · ${(e.score*100).toFixed(0)}% similar`,onClick:()=>r?.(e.path),children:[(0,s.jsx)(c,{path:e.path,fetchBlob:n,alt:e.path.split(`/`).pop()??e.path}),(0,s.jsx)(`span`,{className:`similar-thumb-name`,children:e.path.split(`/`).pop()})]})},e.path))})]})}var u=()=>void 0;function d({open:e,issueCount:t,onToggle:n}){let r=`${e?`Hide`:`Show`} Boekwachter index pane${t>0?`, ${t} issue${t===1?``:`s`} in this file`:``}`;return(0,s.jsxs)(`button`,{type:`button`,className:`squisq-toolbar-button workspace-index-toggle${e?` squisq-toolbar-button--active`:``}`,onClick:n,"aria-label":r,title:r,"aria-pressed":e,children:[(0,s.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,"aria-hidden":`true`,focusable:`false`,children:[(0,s.jsx)(`rect`,{x:`2.5`,y:`2`,width:`11`,height:`12`,rx:`1.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`}),(0,s.jsx)(`line`,{x1:`5.5`,y1:`2`,x2:`5.5`,y2:`14`,stroke:`currentColor`,strokeWidth:`1.2`}),(0,s.jsx)(`line`,{x1:`8`,y1:`5.25`,x2:`11.5`,y2:`5.25`,stroke:`currentColor`,strokeWidth:`1.1`,strokeLinecap:`round`}),(0,s.jsx)(`line`,{x1:`8`,y1:`8`,x2:`11.5`,y2:`8`,stroke:`currentColor`,strokeWidth:`1.1`,strokeLinecap:`round`}),(0,s.jsx)(`line`,{x1:`8`,y1:`10.75`,x2:`10.5`,y2:`10.75`,stroke:`currentColor`,strokeWidth:`1.1`,strokeLinecap:`round`})]}),t>0&&(0,s.jsx)(`span`,{className:`workspace-index-toggle-count`,"aria-hidden":`true`,children:t})]})}function f({path:e,status:t,issues:n,review:i,loading:c,error:l,onClose:d,onSelectLine:f,onFixIssue:v,onUpdateIssue:y,onOpenTask:b}){let[x,S]=(0,o.useState)(!1),[C,w]=(0,o.useState)(null),[T,E]=(0,o.useState)(null),D=e?e.split(`/`).pop()??e:null,O=e?n?.issues.filter(t=>t.path===e).length??0:0,k=i?.review,A=i?.trackedIssues??[],j=A.length===0?k?.issues??[]:[],M=A.filter(e=>x||e.status===`open`||e.status===`in_progress`),N=k?r(k):null,P=g(t),F=n?`${n.reviewedFiles} of ${n.eligibleFiles} eligible files reviewed`:null,I=async(e,t,n)=>{if(!(!y||C)){w(`${e.ref}:${t}`),E(null);try{await y(e,n)}catch(e){E(e instanceof Error?e.message:String(e))}finally{w(null)}}};return(0,s.jsxs)(`aside`,{className:`workspace-index-pane`,"aria-label":`Boekwachter index results`,children:[(0,s.jsxs)(`header`,{className:`workspace-index-pane-header`,children:[(0,s.jsxs)(`div`,{className:`workspace-index-pane-title`,children:[(0,s.jsx)(`span`,{className:`workspace-index-pane-eyebrow`,children:`Boekwachter`}),(0,s.jsx)(`h2`,{title:e??void 0,children:D??`Index results`})]}),(0,s.jsx)(`button`,{type:`button`,className:`workspace-index-pane-close`,onClick:d,"aria-label":`Close Boekwachter index pane`,title:`Close index pane`,children:(0,s.jsxs)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,s.jsx)(`line`,{x1:`3.5`,y1:`3.5`,x2:`12.5`,y2:`12.5`}),(0,s.jsx)(`line`,{x1:`12.5`,y1:`3.5`,x2:`3.5`,y2:`12.5`})]})})]}),(0,s.jsxs)(`div`,{className:`workspace-index-pane-summary`,children:[(0,s.jsxs)(`span`,{className:`workspace-index-state workspace-index-state-${_(t)}`,children:[(0,s.jsx)(`span`,{"aria-hidden":`true`}),P]}),n&&n.counts.total>0&&(0,s.jsxs)(`span`,{className:`workspace-index-total-issues`,children:[n.counts.total,` workspace issue`,n.counts.total===1?``:`s`]}),F&&(0,s.jsx)(`span`,{className:`workspace-index-coverage`,children:F})]}),(0,s.jsx)(`div`,{className:`workspace-index-pane-body`,children:l?(0,s.jsxs)(`p`,{className:`workspace-index-pane-message error`,role:`alert`,children:[`Couldn’t load the Boekwachter results: `,l]}):e?c?(0,s.jsx)(`p`,{className:`workspace-index-pane-message`,children:`Opening the Boekwachter’s notes…`}):k||A.length>0?(0,s.jsxs)(s.Fragment,{children:[k&&(0,s.jsxs)(`section`,{className:`workspace-index-health`,"aria-label":`File health ${k.health} out of 10`,children:[(0,s.jsxs)(`span`,{className:`workspace-index-health-score`,children:[k.health,(0,s.jsx)(`small`,{children:`/10`})]}),(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`h3`,{children:`File health`}),(0,s.jsx)(`p`,{children:k.healthReason})]})]}),k?.notesMd&&(0,s.jsxs)(`section`,{className:`workspace-index-notes`,children:[(0,s.jsx)(`h3`,{children:`Notes`}),(0,s.jsx)(a,{value:k.notesMd,readOnly:!0,minHeight:`0`,maxHeight:`none`,onCommit:u},`${e}:boekwachter-notes`)]}),(0,s.jsxs)(`section`,{className:`workspace-index-issues`,children:[(0,s.jsxs)(`h3`,{children:[`Issues `,(0,s.jsx)(`span`,{children:A.length||j.length})]}),A.some(e=>e.status===`resolved`||e.status===`dismissed`)&&(0,s.jsx)(`button`,{type:`button`,className:`link-button workspace-index-show-closed`,onClick:()=>S(e=>!e),children:x?`Hide closed`:`Show closed`}),M.length>0||j.length>0?(0,s.jsxs)(`ul`,{children:[M.map(e=>{let t=e.line,n=t==null?null:e.stale?`Previously line ${t}`:`Line ${t}`,r=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(`div`,{className:`workspace-index-issue-meta`,children:[!e.seen&&(0,s.jsx)(`span`,{className:`workspace-index-issue-unread`,title:`Unread issue`,children:`New`}),(0,s.jsx)(`span`,{className:`workspace-index-issue-ref`,children:e.ref}),(0,s.jsx)(`span`,{children:e.severity}),(0,s.jsx)(`span`,{children:e.category}),n&&(0,s.jsx)(`span`,{children:n}),e.stale&&(0,s.jsx)(`span`,{children:`Needs recheck`}),e.status!==`open`&&(0,s.jsx)(`span`,{children:m(e.status)})]}),(0,s.jsx)(`p`,{children:e.message})]});return(0,s.jsxs)(`li`,{"data-status":e.status,children:[t!=null&&f?(0,s.jsx)(`button`,{type:`button`,className:`workspace-index-issue-content workspace-index-issue-selectable`,onClick:()=>{f(t),e.seen||I(e,`read`,{seen:!0})},title:`${e.stale?`Reveal the previous line`:`Select line`} ${t} in ${D??`the source file`}`,children:r}):(0,s.jsx)(`div`,{className:`workspace-index-issue-content`,children:r}),(0,s.jsxs)(`div`,{className:`workspace-index-issue-actions`,children:[e.taskRef&&e.status===`in_progress`&&(0,s.jsxs)(`button`,{type:`button`,className:`link-button workspace-index-issue-task`,onClick:()=>b?.(e.taskRef),children:[`Working · `,e.taskRef]}),(0,s.jsxs)(`div`,{className:`gz-tray workspace-index-issue-tray`,role:`toolbar`,"aria-label":`Actions for ${e.ref}`,children:[y&&(0,s.jsx)(p,{icon:e.seen?`fa-envelope`:`fa-envelope-open`,label:e.seen?`Mark unread`:`Mark read`,disabled:C!==null,onClick:()=>void I(e,e.seen?`unread`:`read`,{seen:!e.seen})}),y&&e.status===`open`&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(p,{icon:`fa-ban`,label:`Not an issue`,disabled:C!==null,onClick:()=>void I(e,`dismiss`,{status:`dismissed`,seen:!0,dismissalReason:`not_an_issue`})}),(0,s.jsx)(p,{icon:`fa-check`,label:`Mark resolved`,disabled:C!==null,onClick:()=>void I(e,`resolve`,{status:`resolved`,seen:!0})})]}),y&&(e.status===`resolved`||e.status===`dismissed`)&&(0,s.jsx)(p,{icon:`fa-rotate-left`,label:`Reopen`,disabled:C!==null,onClick:()=>void I(e,`reopen`,{status:`open`,seen:!0})}),v&&e.status===`open`&&(0,s.jsx)(p,{icon:`fa-wrench`,label:`Fix`,title:`Create a tracked task for ${e.ref}`,className:`workspace-index-issue-fix`,onClick:()=>v(e)})]})]})]},e.id)}),j.map((e,t)=>(0,s.jsx)(h,{issue:e,fileName:D,onSelectLine:f},`${e.category}:${e.message}:${t}`))]}):(0,s.jsx)(`p`,{className:`workspace-index-clean-result`,children:A.length>0?`No open issues in this file.`:`No issues found in this file.`}),T&&(0,s.jsxs)(`p`,{className:`workspace-index-issue-error error`,role:`alert`,children:[`Couldn’t update the issue: `,T]})]}),(0,s.jsxs)(`footer`,{className:`workspace-index-pane-footer`,children:[(0,s.jsx)(`p`,{children:`Leads from a background model pass — its opinion, not a verdict.`}),N&&(0,s.jsx)(`p`,{children:N})]})]}):i?.pending?(0,s.jsx)(`p`,{className:`workspace-index-pane-message`,children:`Not reviewed yet. The Boekwachter studies files while the app is idle or during Night Shift.`}):(0,s.jsx)(`p`,{className:`workspace-index-pane-message`,children:O>0?`${O} indexed issue${O===1?``:`s`} found, but the full review is not available yet.`:`No Boekwachter review is available for this file yet.`}):(0,s.jsx)(`p`,{className:`workspace-index-pane-message`,children:`Select a workspace file to see its review.`})})]})}function p({icon:e,label:t,title:n,className:r,disabled:i,onClick:a}){return(0,s.jsx)(`button`,{type:`button`,className:`gz-key gz-key--icon workspace-index-issue-key${r?` ${r}`:``}`,"aria-label":t,title:n??t,disabled:i,onClick:a,children:(0,s.jsx)(`i`,{className:`fa-solid ${e}`,"aria-hidden":`true`})})}function m(e){switch(e){case`in_progress`:return`In progress`;case`resolved`:return`Resolved`;case`dismissed`:return`Not an issue`;default:return`Open`}}function h({issue:e,fileName:t,onSelectLine:n}){let r=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(`div`,{className:`workspace-index-issue-meta`,children:[(0,s.jsx)(`span`,{children:e.severity}),(0,s.jsx)(`span`,{children:e.category}),e.line!=null&&(0,s.jsxs)(`span`,{children:[`Line `,e.line]})]}),(0,s.jsx)(`p`,{children:e.message})]});return(0,s.jsx)(`li`,{children:e.line!=null&&n?(0,s.jsx)(`button`,{type:`button`,className:`workspace-index-issue-content workspace-index-issue-selectable`,onClick:()=>n(e.line),title:`Select line ${e.line} in ${t??`the source file`}`,children:r}):(0,s.jsx)(`div`,{className:`workspace-index-issue-content`,children:r})})}function g(e){if(!e)return`Checking index`;switch(e.state){case`fresh`:return e.aiScanPending?`AI index in progress`:`Index ready`;case`indexing`:return`Indexing workspace`;case`stale`:return`Index out of date`;case`never`:return`Not indexed`;case`disabled`:return`Indexing off`}}function _(e){return e?e.state===`disabled`?`disabled`:e.state===`indexing`?`indexing`:e.state===`fresh`?e.aiScanPending?`indexing`:`fresh`:`stale`:`checking`}export{c as a,g as i,d as n,l as o,_ as r,f as t};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t}from"./dist-D5aoNQwk.js";var n=e({api:()=>o});function r(){let e=window.__GEZEL__?.token;if(e)return e;let t=new URLSearchParams(window.location.search).get(`token`);if(t){try{window.localStorage.setItem(`gezel:token`,t)}catch{}return i(),t}return window.localStorage.getItem(`gezel:token`)||``}function i(){try{let e=new URL(window.location.href);if(!e.searchParams.has(`token`))return;e.searchParams.delete(`token`),window.history.replaceState(window.history.state,``,e.toString())}catch{}}function a(){return window.__GEZEL__?.baseUrl??window.location.origin}var o=new t({baseUrl:a(),token:r(),fetch:window.__GEZEL__?.fetch});export{n,o as t};
1
+ import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t}from"./dist-BaHut5iX.js";var n=e({api:()=>o});function r(){let e=window.__GEZEL__?.token;if(e)return e;let t=new URLSearchParams(window.location.search).get(`token`);if(t){try{window.localStorage.setItem(`gezel:token`,t)}catch{}return i(),t}return window.localStorage.getItem(`gezel:token`)||``}function i(){try{let e=new URL(window.location.href);if(!e.searchParams.has(`token`))return;e.searchParams.delete(`token`),window.history.replaceState(window.history.state,``,e.toString())}catch{}}function a(){return window.__GEZEL__?.baseUrl??window.location.origin}var o=new t({baseUrl:a(),token:r(),fetch:window.__GEZEL__?.fetch});export{n,o as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{Gt as r,st as i,yn as a}from"./dist-BqGwkOe5.js";import{t as o}from"./dist-BaHut5iX.js";import{t as s}from"./api-BPraLwsh.js";import{i as c,n as l,r as u,t as d}from"./Tabs-jE0Z5Tzd.js";import{_ as f,g as p,h as m,y as h}from"./primitives-CWrGZpPI.js";import{a as ee,i as g,n as _,s as v,t as y}from"./DropdownMenu-S4d9-3j3.js";import{ft as b}from"./doc-Dr5K49bx.js";import{n as x}from"./chunk-UBFT2CDQ-FexGDigd.js";import"./markdown-ryKA_OmY.js";import{z as S}from"./chunk-6ECMNUIP-DDVjPyfK.js";import{n as C}from"./chunk-VKXOZTYP-BoVvWSBR.js";import{n as w}from"./styles-CKVKwqoQ.js";import{t as T}from"./GezelJsonEditor-7vDGyBib.js";import{t as E}from"./FileTypeIcon-Cwzl1GkZ.js";import{It as D,N as O,X as k,ct as A,ht as j,lt as M,st as N}from"./index-C0DYtvfg.js";import{t as te}from"./CraftbookToolsetSetup-BKg136L1.js";import{t as ne}from"./useShowWorkInProgressFeatures-BhDNuQiU.js";import{r as re}from"./SessionSwitcher-6okzcxT7.js";import{n as P,r as ie,t as F}from"./useCompactLayout-Dtolvzye.js";var I=e(t(),1),L=n();function ae({manifest:e,onSubmit:t,onCancel:n}){let r=e.paramSchema,[i,a]=(0,I.useState)(()=>oe(r)),[o,s]=(0,I.useState)(null),c=(0,I.useMemo)(()=>R(i),[i]),l=(0,I.useMemo)(()=>A(e,c),[e,c]),u=()=>{let e=se(r,i);if(e){s(`"${e}" is required.`);return}t(c)};return(0,L.jsxs)(`form`,{className:`craftbook-param-form`,onSubmit:e=>{e.preventDefault(),u()},children:[(0,L.jsx)(`div`,{className:`craftbook-param-form-title`,children:e.name}),r&&(0,L.jsx)(T,{schema:r,value:i,onChange:e=>{a(e??{}),s(null)},density:`compact`}),(0,L.jsx)(`div`,{className:`craftbook-param-form-preview`,children:(0,L.jsx)(`code`,{children:l})}),o&&(0,L.jsx)(`p`,{className:`craftbook-param-form-error small`,children:o}),(0,L.jsxs)(`div`,{className:`craftbook-param-form-actions`,children:[(0,L.jsx)(`button`,{type:`button`,className:`subtle`,onClick:n,children:`Cancel`}),(0,L.jsx)(`button`,{type:`submit`,className:`primary`,children:`Stage command`})]})]})}function oe(e){let t=e?.properties??{},n={};for(let[e,r]of Object.entries(t)){let t=M(r);t!==void 0&&(n[e]=t)}return n}function se(e,t){let n=Array.isArray(e?.required)?e.required:[];for(let e of n){let n=t[e];if(n==null||n===``)return e}return null}function R(e){let t={};for(let[n,r]of Object.entries(e))r!=null&&(typeof r==`boolean`?t[n]=r?`true`:`false`:typeof r==`number`?t[n]=String(r):typeof r==`string`&&(t[n]=r));return t}function z(e){return e===`win32`?{run:`explorer .`,description:`Open this folder in File Explorer.`}:e===`darwin`?{run:`open .`,description:`Open this folder in Finder.`}:{run:`xdg-open .`,description:`Open this folder in your file manager.`}}function B(e){return[{title:`Getting around`,items:[{run:`pwd`,description:`Show which folder you are in right now.`},{run:`ls`,description:`List the files and folders here.`},{run:`ls -la`,description:`List everything, hidden files included, with sizes and dates.`},{run:`cd "folder-name"`,description:`Move into a folder.`},{run:`cd ..`,description:`Go back up one folder.`},z(e)]},{title:`Reading files`,items:[{run:`cat "file.txt"`,description:`Print a whole file to the screen.`},{run:`head -n 20 "file.txt"`,description:`Show only the first 20 lines of a file.`},{run:`tail -n 20 "file.txt"`,description:`Show only the last 20 lines — handy for logs.`}]},{title:`Making changes`,items:[{run:`mkdir "new-folder"`,description:`Create a new folder.`},{run:`touch "notes.txt"`,description:`Create an empty file.`},{run:`cp "file.txt" "copy.txt"`,description:`Copy a file.`},{run:`mv "old-name.txt" "new-name.txt"`,description:`Rename a file, or move it elsewhere.`},{run:`rm "file.txt"`,description:`Delete a file. There is no undo — be sure first.`}]},{title:`Finding things`,items:[{run:`grep -r "search text" .`,description:`Search every file here for a piece of text.`},{run:`find . -name "*.md"`,description:`Find files by name, anywhere below this folder.`}]},{title:`Tracking your changes`,items:[{run:`git status`,description:`See what you have changed since the last saved version.`},{run:`git diff`,description:`See the exact lines you changed.`},{run:`git log --oneline -10`,description:`See the last ten saved versions, one per line.`},{run:`git branch`,description:`List the branches and show which one you are on.`},{run:`git pull`,description:`Bring in the latest changes from the shared copy.`}]},{title:`When you are stuck`,items:[{run:`clear`,description:`Wipe the screen clean and start fresh.`},{run:`which node`,description:`Show where a tool is installed — or whether it is at all.`},{run:`man ls`,description:`Read the manual for a command. Press q to leave it.`}]}]}function V(e){return[{title:`Getting around`,items:[{run:`pwd`,description:`Show which folder you are in right now.`},{run:`ls`,description:`List the files and folders here.`},{run:`ls -Force`,description:`List everything, hidden files included.`},{run:`cd "folder-name"`,description:`Move into a folder.`},{run:`cd ..`,description:`Go back up one folder.`},z(e)]},{title:`Reading files`,items:[{run:`cat "file.txt"`,description:`Print a whole file to the screen.`},{run:`Get-Content "file.txt" -TotalCount 20`,description:`Show only the first 20 lines of a file.`},{run:`Get-Content "file.txt" -Tail 20`,description:`Show only the last 20 lines — handy for logs.`}]},{title:`Making changes`,items:[{run:`mkdir "new-folder"`,description:`Create a new folder.`},{run:`New-Item -ItemType File "notes.txt"`,description:`Create an empty file.`},{run:`Copy-Item "file.txt" "copy.txt"`,description:`Copy a file.`},{run:`Move-Item "old-name.txt" "new-name.txt"`,description:`Rename a file, or move it elsewhere.`},{run:`Remove-Item "file.txt"`,description:`Delete a file. There is no undo — be sure first.`}]},{title:`Finding things`,items:[{run:`Get-ChildItem -Recurse -File | Select-String -Pattern "search text"`,description:`Search every file here for a piece of text.`},{run:`Get-ChildItem -Recurse -Filter "*.md"`,description:`Find files by name, anywhere below this folder.`}]},{title:`Tracking your changes`,items:[{run:`git status`,description:`See what you have changed since the last saved version.`},{run:`git diff`,description:`See the exact lines you changed.`},{run:`git log --oneline -10`,description:`See the last ten saved versions, one per line.`},{run:`git branch`,description:`List the branches and show which one you are on.`},{run:`git pull`,description:`Bring in the latest changes from the shared copy.`}]},{title:`When you are stuck`,items:[{run:`clear`,description:`Wipe the screen clean and start fresh.`},{run:`Get-Command node`,description:`Show where a tool is installed — or whether it is at all.`},{run:`Get-Help Get-ChildItem`,description:`Read the built-in help for a command.`}]}]}function H(e){return e===`win32`?V(e):B(e)}var U=null;function ce(){let e=window.__GEZEL__?.platform;return e?Promise.resolve(e):(U??=s.health().then(e=>e.platform).catch(()=>void 0),U)}function le(e){let t=e.paramSchema?.properties;return!!t&&Object.keys(t).length>0}var W=[{kind:`npm-script`,title:`npm scripts`,section:`scripts`},{kind:`workspace-script`,title:`Scripts folder`,section:`scripts`},{kind:`vscode-launch`,title:`VSCode launch`,section:`scripts`},{kind:`bin`,title:`Tools on this machine`,section:`commands`}];function ue({projectId:e,section:t=`all`,onAvailabilityChange:n,onStageCommand:r}){let i=ne(),o=t===`all`||t===`commands`,c=t===`all`||t===`scripts`,l=t===`all`||t===`tasks`,u=l||t===`skills`,d=o||c,[h,ee]=(0,I.useState)(null),[g,_]=(0,I.useState)([]),v=(0,I.useRef)(0),[y,b]=(0,I.useState)({}),[x,S]=(0,I.useState)(null),[C,w]=(0,I.useState)(new Set),[T,E]=(0,I.useState)(!1),[D,O]=(0,I.useState)([]),[k,j]=(0,I.useState)(!1),[M,re]=(0,I.useState)(!1),[P,ie]=(0,I.useState)(!1),[F,oe]=(0,I.useState)([]),[se,R]=(0,I.useState)(!1),[z,B]=(0,I.useState)(!1),[V,U]=(0,I.useState)(``),[ue,G]=(0,I.useState)(null),[de,fe]=(0,I.useState)(null),[K,pe]=(0,I.useState)(),[me,he]=(0,I.useState)(`never`),[ge,_e]=(0,I.useState)(null),[ve,q]=(0,I.useState)(null),[J,ye]=(0,I.useState)(()=>window.__GEZEL__?.platform??void 0);(0,I.useEffect)(()=>{if(!o||J)return;let e=!1;return ce().then(t=>{e||ye(t)}),()=>{e=!0}},[o,J]);let Y=(0,I.useCallback)(async()=>{try{let t=await s.getProjectIndex(e);ee(t),_e(null)}catch(e){let t=e instanceof Error?e.message:String(e);/404|not yet indexed/i.test(t)||_e(t)}},[e]),be=(0,I.useCallback)(async()=>{try{let t=await s.getProjectSkills(e);O(t.skills),ie(!0)}catch{}finally{re(!0)}},[e]),xe=(0,I.useCallback)(async()=>{let t=++v.current;try{let n=await s.listProjectCraftbooks(e);if(t!==v.current)return;let r=a(n.items,i),o=new Set(r.map(e=>e.manifest.id));_(r),b(n.missingToolsets??{}),S(n.projectType??null),w(new Set((n.suggestedIds??[]).filter(e=>o.has(e))))}catch{if(t!==v.current)return}finally{t===v.current&&j(!0)}},[e,i]),X=(0,I.useCallback)(e=>{r?.(e),q(`Staged: ${e} — review and press Enter`),window.setTimeout(()=>q(null),2400)},[r]),Se=(0,I.useCallback)((e,t)=>{if(!r){q(`Open this from a project chat to run craftbooks.`),window.setTimeout(()=>q(null),2400);return}X(A(e,t))},[r,X]),Ce=(0,I.useCallback)(e=>{if((y[e.id]?.length??0)>0){fe(e);return}le(e)?G(e):Se(e,{})},[Se,y]),we=(0,I.useCallback)(async()=>{try{let t=await s.getProjectImportsPending(e);oe(t.items),B(!0)}catch{}finally{R(!0)}},[e]);(0,I.useEffect)(()=>{t!==`skills`||!M||!se||!P||!z||n?.(D.length>0||F.length>0)},[t,M,se,P,z,D.length,F.length,n]);let Te=(0,I.useCallback)(async(t,n)=>{try{n===`approve`?await s.approveProjectImport(e,t):await s.rejectProjectImport(e,t),oe(e=>e.filter(e=>e.skillSource!==t)),q(n===`approve`?`Imported craftbook + script`:`Kept as prose-only`)}catch(e){q(`Review failed: ${e instanceof Error?e.message:String(e)}`)}window.setTimeout(()=>q(null),2400)},[e]),Ee=(0,I.useCallback)(async t=>{try{let n=await s.invokeProjectSkill(e,t.source);q(n.started?`${n.assigneeName??`The voorman`} is looking at ${t.name} — task ${n.task.ref}`:`Queued ${t.name} as task ${n.task.ref} — nobody has picked it up yet`)}catch(e){q(`Couldn’t invoke ${t.name}: ${e instanceof Error?e.message:String(e)}`)}window.setTimeout(()=>q(null),2400)},[e]);(0,I.useEffect)(()=>{let t=!1,n=async()=>{if(l&&!t&&xe(),u&&!t&&(be(),we()),d)try{let n=await s.getProjectIndexStatus(e);if(t)return;he(n.state);let r=n.meta?.scannedAt;r&&r!==K?(pe(r),await Y()):n.state===`never`&&await s.refreshProjectIndex(e).catch(()=>{})}catch{}};n();let r=window.setInterval(n,3e4);return()=>{t=!0,window.clearInterval(r)}},[e,K,d,l,u,Y,xe,be,we]);let De=(0,I.useMemo)(()=>{if(!h)return[];let e=V.trim().toLowerCase(),t=[];for(let{kind:n,title:r,section:i}of W){if(i===`commands`?!o:!c)continue;let a=h.commands.filter(e=>e.kind===n).filter(t=>!e||t.name.toLowerCase().includes(e)||t.run.toLowerCase().includes(e)||(t.description?t.description.toLowerCase().includes(e):!1)).sort((e,t)=>n===`npm-script`||n===`workspace-script`?e.name.localeCompare(t.name,void 0,{sensitivity:`base`}):0);a.length>0&&t.push({kind:n,title:r,items:a})}return t},[h,V,o,c]),Oe=(0,I.useMemo)(()=>{if(!o)return[];let e=V.trim().toLowerCase();return H(J).map(t=>({title:t.title,items:e?t.items.filter(t=>t.run.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)):t.items})).filter(e=>e.items.length>0)},[o,J,V]),ke=(0,I.useCallback)(async e=>{try{await navigator.clipboard.writeText(e),q(`Copied: ${e}`),window.setTimeout(()=>q(null),1800)}catch{q(`Couldn’t copy — clipboard blocked.`),window.setTimeout(()=>q(null),2400)}},[]),Ae=h?.commands.length??0,Z=(0,I.useMemo)(()=>{let e=V.trim().toLowerCase();return e?g.filter(t=>{let n=t.manifest;return n.id.toLowerCase().includes(e)||n.name.toLowerCase().includes(e)||n.description.toLowerCase().includes(e)}):g},[g,V]),je=(0,I.useMemo)(()=>{let e=V.trim().toLowerCase();return e?D.filter(t=>t.name.toLowerCase().includes(e)||t.source.toLowerCase().includes(e)||(t.description?.toLowerCase().includes(e)??!1)):D},[D,V]),Me=e=>{let t=e.manifest,n=y[t.id]??[],r=(0,L.jsxs)(`button`,{type:`button`,className:`commands-panel-item`,onClick:()=>Ce(t),title:n.length>0?`${N(t)} — needs setup (${n.length} toolset${n.length===1?``:`s`})`:`Run ${N(t)}`,children:[(0,L.jsxs)(`span`,{className:`commands-panel-item-name`,children:[t.name,n.length>0&&(0,L.jsx)(`span`,{className:`commands-panel-badge small`,children:`setup`})]}),t.description&&(0,L.jsx)(`span`,{className:`commands-panel-item-desc muted small`,children:t.description})]});return n.length>0?(0,L.jsx)(`li`,{children:(0,L.jsxs)(f,{open:de?.id===t.id,onOpenChange:e=>{e||fe(null)},children:[(0,L.jsx)(m,{asChild:!0,children:r}),(0,L.jsx)(p,{side:`left`,align:`start`,children:(0,L.jsx)(te,{missing:n,onAllInstalled:()=>{fe(null),xe(),le(t)?G(t):Se(t,{})},onCancel:()=>fe(null)})})]})},`craftbook:${t.id}`):le(t)?(0,L.jsx)(`li`,{children:(0,L.jsxs)(f,{open:ue?.id===t.id,onOpenChange:e=>{e||G(null)},children:[(0,L.jsx)(m,{asChild:!0,children:r}),(0,L.jsx)(p,{side:`left`,align:`start`,children:(0,L.jsx)(ae,{manifest:t,onSubmit:e=>{Se(t,e),G(null)},onCancel:()=>G(null)})})]})},`craftbook:${t.id}`):(0,L.jsx)(`li`,{children:r},`craftbook:${t.id}`)},Ne=Oe.map(e=>(0,L.jsxs)(`section`,{className:`commands-panel-group`,children:[(0,L.jsx)(`h4`,{className:`commands-panel-group-title muted small`,children:e.title}),(0,L.jsx)(`ul`,{className:`commands-panel-list`,children:e.items.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,className:`commands-panel-item`,onClick:()=>r?X(e.run):void ke(e.run),title:r?`Stage: ${e.run}`:`Copy: ${e.run}`,children:[(0,L.jsx)(`span`,{className:`commands-panel-item-name commands-panel-item-code`,children:e.run}),(0,L.jsx)(`span`,{className:`commands-panel-item-desc muted small`,children:e.description})]})},`primer:${e.run}`))})]},`primer:${e.title}`)),Pe=V.trim().length>0,Fe=Z.filter(e=>C.has(e.manifest.id)),Ie=Z.filter(e=>!C.has(e.manifest.id)),Le=l&&!Pe&&x!==null&&Fe.length>0,Re=h?.commands.filter(e=>e.kind===`bin`).length??0,ze=Ae-Re,Be=H(J).reduce((e,t)=>e+t.items.length,0),Ve=g.length+D.length,[Q,He]=t===`commands`?[Be+Re,`command`]:t===`scripts`?[ze,`script`]:t===`tasks`?[Ve,`task`]:t===`skills`?[D.length,`skill`]:[Ae,`command`],$=d&&(me===`indexing`||me===`never`&&h===null),Ue=t===`tasks`?!k:t===`skills`?!M:$,We=De.length>0||Oe.length>0||Z.length>0||je.length>0||F.length>0,Ge=!Ue&&!We;return(0,L.jsxs)(`div`,{className:`commands-panel`,children:[(0,L.jsxs)(`div`,{className:`commands-panel-toolbar`,children:[(0,L.jsx)(`input`,{className:`commands-panel-filter`,value:V,onChange:e=>U(e.target.value),placeholder:`Filter…`,"aria-label":t===`skills`?`Filter skills`:`Filter commands`}),(0,L.jsx)(`span`,{className:`commands-panel-state muted small`,title:K??``,children:d&&me===`disabled`?`indexing off`:$?`looking…`:d&&me===`stale`?`refreshing…`:Q>0?`${Q} ${He}${Q===1?``:`s`}`:``})]}),ge&&(0,L.jsx)(`p`,{className:`commands-panel-error small`,children:ge}),Ue&&(0,L.jsx)(`p`,{className:`commands-panel-empty muted small`,children:`Looking through your workspace…`}),Ge&&(Pe?(0,L.jsxs)(`p`,{className:`commands-panel-empty muted small`,children:[`Nothing matches “`,V.trim(),`”.`]}):d&&me===`disabled`?(0,L.jsx)(`p`,{className:`commands-panel-empty muted small`,children:`Workspace indexing is off for this project.`}):t===`skills`?(0,L.jsxs)(`p`,{className:`commands-panel-empty muted small`,children:[`No workspace skills here yet — drop one under `,(0,L.jsx)(`code`,{children:`.claude/skills/`}),`,`,` `,(0,L.jsx)(`code`,{children:`.gstack/skills/`}),`, or `,(0,L.jsx)(`code`,{children:`agents/skills/`}),`.`]}):t===`tasks`?(0,L.jsx)(`p`,{className:`commands-panel-empty muted small`,children:`No tasks are available for this project yet. Craftbooks show up here once one applies to this workspace.`}):(0,L.jsxs)(`p`,{className:`commands-panel-empty muted small`,children:[`No `,t===`scripts`?`scripts`:`commands`,` found yet. Add a script to`,` `,(0,L.jsx)(`code`,{children:`package.json`}),` or drop a file in`,(0,L.jsx)(`code`,{children:` scripts/`}),`.`]})),We&&(0,L.jsxs)(`div`,{className:`commands-panel-groups`,children:[u&&F.length>0&&(0,L.jsxs)(`section`,{className:`commands-panel-group`,children:[(0,L.jsxs)(`h4`,{className:`commands-panel-group-title muted small`,children:[`Imports to review (`,F.length,`)`]}),(0,L.jsx)(`ul`,{className:`commands-panel-list`,children:F.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(`div`,{className:`commands-panel-item`,title:e.skillSource,children:[(0,L.jsx)(`span`,{className:`commands-panel-item-name`,children:e.craftbook.name}),(0,L.jsxs)(`span`,{className:`commands-panel-item-desc muted small`,children:[e.scripts.length,` translated script`,e.scripts.length===1?``:`s`,` from `,e.skillSource]}),(0,L.jsxs)(`span`,{className:`commands-panel-item-actions`,children:[(0,L.jsx)(`button`,{type:`button`,className:`commands-panel-mini`,onClick:()=>void Te(e.skillSource,`approve`),children:`Approve`}),(0,L.jsx)(`button`,{type:`button`,className:`commands-panel-mini`,onClick:()=>void Te(e.skillSource,`reject`),children:`Keep prose`})]})]})},`pending:${e.skillSource}`))})]}),t===`commands`&&Ne,De.map(e=>(0,L.jsxs)(`section`,{className:`commands-panel-group`,children:[(0,L.jsx)(`h4`,{className:`commands-panel-group-title muted small`,children:e.title}),(0,L.jsx)(`ul`,{className:`commands-panel-list`,children:e.items.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,className:`commands-panel-item`,onClick:()=>r?X(e.run):void ke(e.run),title:r?`Stage: ${e.run}`:`Copy: ${e.run}`,children:[(0,L.jsx)(`span`,{className:`commands-panel-item-name`,children:e.name}),e.description&&(0,L.jsx)(`span`,{className:`commands-panel-item-desc muted small`,children:e.description})]})},`${e.kind}:${e.name}:${e.source}`))})]},e.kind)),Le?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`section`,{className:`commands-panel-group`,children:[(0,L.jsxs)(`h4`,{className:`commands-panel-group-title muted small`,children:[`Suggested for `,x?.label]}),(0,L.jsx)(`ul`,{className:`commands-panel-list`,children:Fe.map(Me)})]}),Ie.length>0&&(0,L.jsxs)(`section`,{className:`commands-panel-group`,children:[(0,L.jsx)(`button`,{type:`button`,className:`commands-panel-show-all muted small`,"aria-expanded":T,onClick:()=>E(e=>!e),children:T?`Show fewer craftbooks`:`Show all ${Z.length} craftbooks`}),T&&(0,L.jsx)(`ul`,{className:`commands-panel-list`,children:Ie.map(Me)})]})]}):l&&Z.length>0&&(0,L.jsxs)(`section`,{className:`commands-panel-group`,children:[(0,L.jsx)(`h4`,{className:`commands-panel-group-title muted small`,children:`Craftbooks`}),(0,L.jsx)(`ul`,{className:`commands-panel-list`,children:Z.map(Me)})]}),u&&je.length>0&&(0,L.jsxs)(`section`,{className:`commands-panel-group`,children:[(0,L.jsx)(`h4`,{className:`commands-panel-group-title muted small`,children:`Skills (workspace)`}),(0,L.jsx)(`ul`,{className:`commands-panel-list`,children:je.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,className:`commands-panel-item`,onClick:()=>void Ee(e),title:e.source,children:[(0,L.jsx)(`span`,{className:`commands-panel-item-name`,children:e.name}),e.description&&(0,L.jsx)(`span`,{className:`commands-panel-item-desc muted small`,children:e.description}),e.hasShellScripts&&(0,L.jsx)(`span`,{className:`commands-panel-item-desc muted small`,children:`(shell scripts present — prose-only invocation)`})]})},`skill:${e.source}`))})]}),t!==`commands`&&Ne]}),ve&&(0,L.jsx)(`output`,{className:`commands-panel-toast`,children:ve})]})}var G=`gezel:chat-rail-side-fraction`,de=.18,fe=.65,K=.34,pe=192,me=14;function he(e){return Number.isFinite(e)?Math.max(de,Math.min(fe,e)):K}function ge(){if(typeof window>`u`)return K;try{let e=window.localStorage.getItem(G);return e?he(Number.parseFloat(e)):K}catch{return K}}function _e(e,t,n){return`${e}:${t??``}:${n}`}function ve(e,t){if(e!==`artifact`)return t;let n=t.trim().replace(/^\.?\/+/,``);for(;/^artifacts\/+/i.test(n);)n=n.replace(/^artifacts\/+/i,``);return n}function q(e){switch(e){case`read_artifact`:case`write_artifact`:return`artifact`;case`read_document`:case`write_document`:return`document`;case`read_file`:case`read_files`:case`write_file`:return`workspace`;default:return null}}function J(e){return/\.(md|markdown|mdx)$/i.test(e)}function ye(e){return/\.html?$/i.test(e)}function Y(e){return/\.pptx$/i.test(e)}function be({projectId:e,chatKey:t,skillsProjectId:n,compact:r=!1,onTaskChanged:i,banner:a,children:o}){let f=e??`default`,[p,m]=(0,I.useState)([]),h=(0,I.useRef)(0),[ee,g]=(0,I.useState)(null),[_,v]=(0,I.useState)([]),[y,b]=(0,I.useState)(null),[x,S]=(0,I.useState)(`references`),[C,w]=(0,I.useState)(`chat`),[T,E]=(0,I.useState)(null),D=(0,I.useRef)(t);(0,I.useEffect)(()=>{D.current!==t&&(D.current=t,m([]),h.current=0,g(null),v([]),b(null),w(`chat`))},[t]);let O=(0,I.useCallback)((e,t,n)=>{let r=ve(e,t),i=_e(e,n,r),a=Date.now(),o=++h.current,s={key:i,kind:e,path:r,firstSeenAt:a,lastSeenOrder:o,...n?{projectId:n}:{}};return m(e=>{let t=e.find(e=>e.key===i);return t?(s={...t,lastSeenOrder:o},e.map(e=>e.key===i?s:e)):[...e,s]}),s},[]);(0,I.useEffect)(()=>{if(!n){E(null);return}let e=!1,t=async()=>{let[t,r]=await Promise.allSettled([s.getProjectSkills(n),s.getProjectImportsPending(n)]);if(e||t.status!==`fulfilled`||r.status!==`fulfilled`)return;let i=t.value.skills.length>0||r.value.items.length>0;E(i?n:null)};t();let r=window.setInterval(t,3e4);return()=>{e=!0,window.clearInterval(r)}},[n]);let k=(0,I.useCallback)((e,t)=>{let n=t?.scoped??!1;v(t=>{let r=t.find(t=>t.ref===e);return r?n&&!r.scoped?t.map(t=>t.ref===e?{...t,scoped:!0}:t):t:[...t,{ref:e,scoped:n,firstSeenAt:Date.now()}]}),t?.focus&&(b(e),S(`tasks`),w(`tasks`))},[]),A=(0,I.useCallback)(e=>{if(!e.success)return;let t=[...e.videos?.map(e=>({path:e.path,promote:!0}))??[],...e.images?.map(e=>({path:e.path,promote:!1}))??[]];if(t.length>0)for(let n of t){let t=O(`artifact`,n.path,e.projectId);n.promote&&g(t)}let n=q(e.name);if(!n)return;let r=e.paths&&e.paths.length>0?e.paths:e.path?[e.path]:[];if(r.length!==0)for(let t of r)n===`workspace`&&ye(t)||O(n,t,e.projectId)},[O]),j=(0,I.useCallback)((e,t)=>{let n=O(`artifact`,e,t);g(n),w(`references`)},[O]),M=(0,I.useCallback)((e,t)=>{O(`artifact`,e,t)},[O]),N=(0,I.useCallback)((e,t)=>{let n=O(`workspace`,e,t);g(n),w(`references`)},[O]),te=(0,I.useCallback)((e,t)=>{O(`workspace`,e,t)},[O]),ne=(0,I.useMemo)(()=>[...p].sort((e,t)=>t.lastSeenOrder-e.lastSeenOrder).slice(0,12).map(({key:e,kind:t,path:n,projectId:r})=>({key:e,kind:t,path:n,...r?{projectId:r}:{}})),[p]),re=(0,I.useCallback)(e=>{let t=O(e.kind,e.path,e.projectId);g(t),S(`references`),w(`references`)},[O]),P=(0,I.useMemo)(()=>({onToolActivity:A,onArtifactReference:j,onArtifactSeen:M,onWorkspaceReference:N,onWorkspaceSeen:te,recentReferences:ne,onOpenReference:re,onTaskReference:k}),[A,j,M,N,te,ne,re,k]),ie=(0,I.useCallback)((e,t)=>{m(n=>n.map(n=>n.key===e?{...n,kind:t}:n)),g(n=>n&&n.key===e?{...n,kind:t}:n)},[]),ae=(0,I.useRef)(null),oe=F(ae,840,60),se=r||oe,R=ee??p[0]??null,z=R!==null,B=!!(n&&T===n),V=(0,I.useMemo)(()=>[..._].sort((e,t)=>e.scoped===t.scoped?e.firstSeenAt-t.firstSeenAt:e.scoped?-1:1),[_]),H=V.length>0,U=y&&V.find(e=>e.ref===y)?.ref||V[0]?.ref||null,ce=!se&&(H||z||B);(0,I.useEffect)(()=>{z&&S(`references`)},[z]),(0,I.useEffect)(()=>{H&&!z&&S(`tasks`)},[H,z]),(0,I.useEffect)(()=>{B&&!H&&!z&&S(`skills`)},[B,H,z]),(0,I.useEffect)(()=>{B||(x===`skills`&&S(z?`references`:H?`tasks`:`references`),C===`skills`&&w(z?`references`:H?`tasks`:`chat`))},[B,z,H,x,C]);let le=(0,I.useCallback)(e=>{n&&E(e?n:null)},[n]),[W,K]=(0,I.useState)(()=>ge()),J=(0,I.useRef)(null),Y=(0,I.useCallback)(e=>{let t=he(e);K(t);try{window.localStorage.setItem(G,t.toFixed(4))}catch{}},[]),be=(0,I.useCallback)(e=>{e.preventDefault();let t=ae.current?.clientWidth??1;J.current={startX:e.clientX,startFraction:W,containerWidth:t},document.body.classList.add(`chat-rail-resizing`),document.body.style.cursor=`col-resize`;let n=e=>{if(!J.current)return;let{startX:t,startFraction:n,containerWidth:r}=J.current;if(r<=0)return;let i=t-e.clientX;Y(n+i/r)},r=()=>{J.current=null,document.body.style.cursor=``,document.body.classList.remove(`chat-rail-resizing`),window.removeEventListener(`mousemove`,n),window.removeEventListener(`mouseup`,r)};window.addEventListener(`mousemove`,n),window.addEventListener(`mouseup`,r)},[W,Y]),X=(0,I.useCallback)(e=>{let t=e.shiftKey?.08:.02;e.key===`ArrowLeft`?(e.preventDefault(),Y(W+t)):e.key===`ArrowRight`?(e.preventDefault(),Y(W-t)):e.key===`Home`?(e.preventDefault(),Y(fe)):e.key===`End`&&(e.preventDefault(),Y(de))},[W,Y]);return se?(0,L.jsxs)(`div`,{ref:ae,className:`chat-rail-body chat-rail-body-compact`,children:[a&&(0,L.jsx)(`div`,{className:`chat-rail-banner`,children:a(P)}),(0,L.jsxs)(u,{className:`chat-rail-compact-root`,value:C,onValueChange:e=>w(e),children:[(0,L.jsxs)(l,{className:`chat-rail-compact-tabs`,"aria-label":`Conversation panels`,children:[(0,L.jsx)(c,{className:`chat-rail-compact-tab`,value:`chat`,children:`Chat`}),H&&(0,L.jsx)(c,{className:`chat-rail-compact-tab`,value:`tasks`,children:`Task`}),B&&(0,L.jsx)(c,{className:`chat-rail-compact-tab`,value:`skills`,children:`Skills`}),z&&(0,L.jsx)(c,{className:`chat-rail-compact-tab`,value:`references`,children:`References`})]}),(0,L.jsx)(d,{forceMount:!0,className:`chat-rail-compact-panel chat-rail-compact-chat`,value:`chat`,children:(0,L.jsx)(`div`,{className:`chat-rail-main`,children:o(P)})}),H&&U&&(0,L.jsxs)(d,{className:`chat-rail-compact-panel`,value:`tasks`,children:[V.length>1&&(0,L.jsxs)(`div`,{className:`chat-rail-compact-picker-row`,children:[(0,L.jsx)(`span`,{className:`muted small`,children:`Showing`}),(0,L.jsx)(Ce,{variant:`picker`,tasks:V,activeRef:U,selected:!0,onSelect:b})]}),(0,L.jsx)(xe,{taskRef:U,onTaskChanged:i,onOpenTask:e=>window.dispatchEvent(new CustomEvent(`gezel:open-tab`,{detail:{kind:`task`,ref:e}}))},U)]}),B&&n&&(0,L.jsx)(d,{className:`chat-rail-compact-panel`,value:`skills`,children:(0,L.jsx)(ue,{projectId:n,section:`skills`,onAvailabilityChange:le},n)}),z&&R&&(0,L.jsxs)(d,{className:`chat-rail-compact-panel`,value:`references`,children:[p.length>1&&(0,L.jsxs)(`div`,{className:`chat-rail-compact-picker-row`,children:[(0,L.jsx)(`span`,{className:`muted small`,children:`Showing`}),(0,L.jsx)(we,{variant:`picker`,refs:p,activeKey:R.key,selected:!0,onSelect:g})]}),(0,L.jsx)(`div`,{className:`chat-rail-viewer-wrap`,children:(0,L.jsx)(De,{projectId:R.projectId??f,reference:R,onResolved:ie},R.key)})]})]})]}):(0,L.jsxs)(`div`,{ref:ae,className:`chat-rail-body${ce?` chat-rail-body-split`:``}`,style:{"--chat-rail-side-fraction":W.toFixed(4),"--chat-rail-min-main-width":`480px`,"--chat-rail-min-side-width":`${pe}px`,"--chat-rail-grip-track-width":`${me}px`},children:[a&&(0,L.jsx)(`div`,{className:`chat-rail-banner`,children:a(P)}),(0,L.jsx)(`div`,{className:`chat-rail-main`,children:o(P)}),ce&&(0,L.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize reference panel`,tabIndex:0,className:`chat-rail-grip`,onMouseDown:be,onKeyDown:X}),ce&&(0,L.jsx)(`aside`,{className:`chat-rail-side`,children:(0,L.jsxs)(`div`,{className:`chat-rail-side-inner`,children:[([H,z,B].filter(Boolean).length>1||V.length>1||p.length>1)&&(0,L.jsxs)(`div`,{className:`chat-rail-section-tabs`,role:`tablist`,children:[H&&(V.length>1?(0,L.jsx)(Ce,{tasks:V,activeRef:U,selected:x===`tasks`,onOpen:()=>S(`tasks`),onSelect:e=>{b(e),S(`tasks`)}}):(0,L.jsx)(`button`,{type:`button`,role:`tab`,className:`chat-rail-section-tab${x===`tasks`?` is-active`:``}`,"aria-selected":x===`tasks`,onClick:()=>S(`tasks`),children:`Task`})),B&&(0,L.jsx)(`button`,{type:`button`,role:`tab`,className:`chat-rail-section-tab${x===`skills`?` is-active`:``}`,"aria-selected":x===`skills`,onClick:()=>S(`skills`),children:`Skills`}),z&&(p.length>1?(0,L.jsx)(we,{refs:p,activeKey:R.key,selected:x===`references`,onOpen:()=>S(`references`),onSelect:e=>{g(e),S(`references`)}}):(0,L.jsx)(`button`,{type:`button`,role:`tab`,className:`chat-rail-section-tab${x===`references`?` is-active`:``}`,"aria-selected":x===`references`,onClick:()=>S(`references`),children:`References`}))]}),x===`tasks`&&H&&U&&(0,L.jsx)(`div`,{className:`chat-rail-section-body`,children:(0,L.jsx)(`div`,{className:`chat-rail-viewer-wrap`,children:(0,L.jsx)(xe,{taskRef:U,onTaskChanged:i,onOpenTask:e=>window.dispatchEvent(new CustomEvent(`gezel:open-tab`,{detail:{kind:`task`,ref:e}}))},U)})}),x===`references`&&R&&(0,L.jsx)(`div`,{className:`chat-rail-section-body`,children:(0,L.jsx)(`div`,{className:`chat-rail-viewer-wrap`,children:(0,L.jsx)(De,{projectId:R.projectId??f,reference:R,onResolved:ie},R.key)})}),x===`skills`&&n&&(0,L.jsx)(`div`,{className:`chat-rail-section-body`,children:(0,L.jsx)(ue,{projectId:n,section:`skills`,onAvailabilityChange:le},n)})]})})]})}function xe({taskRef:e,onOpenTask:t,onTaskChanged:n}){let[r,i]=(0,I.useState)(null),[a,o]=(0,I.useState)(!1),[c,l]=(0,I.useState)([]),[u,d]=(0,I.useState)(`idle`),[f,p]=(0,I.useState)([]),[m,b]=(0,I.useState)(!1),[x,S]=(0,I.useState)(null);if((0,I.useEffect)(()=>{let e=!1;return s.listGezels().then(t=>{e||p(t.gezels)}).catch(()=>{e||p([])}),()=>{e=!0}},[]),(0,I.useEffect)(()=>{let t=!1;return o(!1),i(null),S(null),s.getTaskByRef(e).then(e=>{t||(i(e),o(!0))}).catch(()=>{t||o(!0)}),()=>{t=!0}},[e]),(0,I.useEffect)(()=>{if(!r){l([]),d(`idle`);return}let e=!1;return d(`loading`),s.listTaskNotes(r.projectId,r.num).then(t=>{e||(l([...t.notes].sort((e,t)=>t.at.localeCompare(e.at))),d(`ready`))}).catch(()=>{e||(l([]),d(`error`))}),()=>{e=!0}},[r]),!a)return(0,L.jsx)(`p`,{className:`muted small chat-rail-task-empty`,children:`Loading task…`});if(!r)return(0,L.jsxs)(`p`,{className:`muted small chat-rail-task-empty`,children:[`Task `,(0,L.jsx)(`code`,{children:e}),` not found.`]});let C=r.craftbook,w=/^(.*) — \d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/.exec(r.title),T=C&&w?.[1]===C.id?C.name:r.title,E=r.origin?.kind===`system-job`?[`active`,`paused`]:[`active`,`paused`,`complete`,`canceled`],O=async e=>{if(!(e===r.status||m)){b(!0),S(null);try{let t=await s.setTaskStatus(r.projectId,r.num,e);i(t),n?.(t)}catch(e){S(e.message)}finally{b(!1)}}},A=r.status===`complete`||r.status===`canceled`,j=C?.steps??[],M=(A?void 0:r.activeStepId)??[...j].reverse().find(e=>e.completedAt)?.id??j[j.length-1]?.id??null;return(0,L.jsxs)(`div`,{className:`chat-rail-task`,children:[j.length>0&&(0,L.jsx)(`div`,{className:`chat-rail-task-track`,children:(0,L.jsx)(k,{steps:j,statusOf:e=>re(e,r.activeStepId,A),selectedStepId:M,centerStepId:M,scroll:!0,stepRole:`button`,onSelect:()=>t?.(r.ref),ariaLabel:`Task progress`})}),(0,L.jsxs)(`div`,{className:`chat-rail-task-topbar`,children:[(0,L.jsxs)(`header`,{className:`chat-rail-task-header`,children:[(0,L.jsx)(`code`,{className:`chat-rail-task-ref`,children:r.ref}),r.status===`draft`?(0,L.jsx)(`span`,{className:`chat-rail-task-status chat-rail-task-status-draft`,children:`draft`}):(0,L.jsxs)(ee,{children:[(0,L.jsx)(v,{asChild:!0,children:(0,L.jsxs)(`button`,{type:`button`,className:`chat-rail-task-status chat-rail-task-status-trigger chat-rail-task-status-${r.status}`,disabled:m,"aria-label":`Task status: ${X(r.status)}. Change status`,"aria-busy":m,children:[(0,L.jsx)(`span`,{children:X(r.status)}),(0,L.jsx)(h,{})]})}),(0,L.jsx)(g,{children:(0,L.jsx)(y,{className:`app-nav-menu chat-rail-task-status-menu`,align:`start`,sideOffset:4,children:E.map(e=>{let t=e===r.status;return(0,L.jsxs)(_,{className:`app-nav-menu-item chat-rail-task-status-option${t?` is-current`:``}`,disabled:t||m,"aria-current":t?`true`:void 0,onSelect:()=>void O(e),children:[(0,L.jsx)(`span`,{className:`task-status-dot task-status-${e}`,"aria-hidden":`true`}),(0,L.jsx)(`span`,{children:X(e)}),t&&(0,L.jsx)(`span`,{className:`sr-only`,children:` (current)`})]},e)})})})]})]}),(0,L.jsx)(`button`,{type:`button`,className:`chat-rail-task-open`,onClick:()=>t?.(r.ref),children:`Open full task`})]}),x&&(0,L.jsxs)(`p`,{className:`error small chat-rail-task-status-error`,role:`alert`,children:[`Couldn't change task status: `,x]}),(0,L.jsx)(`h4`,{className:`chat-rail-task-title`,children:T}),r.description&&(0,L.jsx)(`p`,{className:`chat-rail-task-desc`,children:r.description}),C&&(0,L.jsxs)(`div`,{className:`chat-rail-task-craftbook`,children:[(0,L.jsx)(`span`,{className:`muted small`,children:`From craftbook`}),` `,C.name]}),(0,L.jsxs)(`section`,{className:`chat-rail-task-history`,"aria-label":`History and notes`,children:[(0,L.jsx)(`h5`,{children:`History & notes`}),u===`loading`&&(0,L.jsx)(`p`,{className:`muted small`,children:`Loading notes…`}),u===`error`&&(0,L.jsx)(`p`,{className:`muted small`,children:`Notes unavailable.`}),u===`ready`&&c.length===0&&(0,L.jsx)(`p`,{className:`muted small`,children:`No notes yet.`}),c.length>0&&(0,L.jsx)(`ol`,{className:`chat-rail-task-notes`,children:c.map(e=>{let t=e.stepId?r.craftbook.steps.find(t=>t.id===e.stepId):void 0,n=e.author.kind===`gezel`?e.author.gezelId:void 0,i=n?f.find(e=>e.id===n):void 0;return(0,L.jsxs)(`li`,{className:`chat-rail-task-note`,children:[(0,L.jsxs)(`header`,{className:`chat-rail-task-note-header`,children:[(0,L.jsxs)(`span`,{className:`task-note-author-identity`,children:[i&&(0,L.jsx)(D,{svg:i.icon??null,poppetje:i.poppetje,iconOverride:i.iconOverride,name:i.name,size:22}),(0,L.jsx)(`span`,{children:e.author.kind===`user`?`You`:e.author.name})]}),(0,L.jsx)(`time`,{dateTime:e.at,title:e.at,children:Se(e.at)}),t&&(0,L.jsx)(`span`,{className:`chat-rail-task-note-step`,children:t.name})]}),(0,L.jsx)(Pe,{markdown:e.text,projectId:r.projectId,articleId:`task-note-${e.id}`})]},e.id)})})]})]})}function X(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Se(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function Ce({tasks:e,activeRef:t,selected:n,onOpen:r,onSelect:i,variant:a=`tab`}){return(0,L.jsxs)(ee,{onOpenChange:e=>{e&&r?.()},children:[(0,L.jsx)(v,{asChild:!0,children:(0,L.jsxs)(`button`,{type:`button`,role:a===`tab`?`tab`:void 0,className:a===`tab`?`chat-rail-section-tab chat-rail-section-tab-menu${n?` is-active`:``}`:`chat-rail-compact-picker chat-rail-section-tab-menu`,"aria-selected":a===`tab`?n:void 0,children:[(0,L.jsx)(`span`,{children:a===`tab`?`Tasks`:t??`Choose task`}),(0,L.jsx)(h,{className:`chat-rail-section-tab-chevron`})]})}),(0,L.jsx)(g,{children:(0,L.jsx)(y,{className:`app-nav-menu chat-rail-task-menu`,sideOffset:4,align:`start`,"aria-label":`Choose task`,children:e.map(e=>{let n=e.ref===t;return(0,L.jsxs)(_,{className:`app-nav-menu-item chat-rail-task-menu-item${n?` active`:``}`,"aria-current":n?`true`:void 0,onSelect:()=>i(e.ref),title:e.scoped?`${e.ref} (this thread's task)`:e.ref,children:[(0,L.jsx)(`span`,{className:`chat-rail-menu-check`,"aria-hidden":`true`,children:n&&(0,L.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`m2.25 6.25 2.25 2.25 5.25-5.25`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`})})}),(0,L.jsx)(`code`,{className:`chat-rail-task-menu-ref`,children:e.ref}),e.scoped&&(0,L.jsx)(`span`,{className:`chat-rail-task-menu-scope`,children:`This thread`})]},e.ref)})})})]})}function we({refs:e,activeKey:t,selected:n,onOpen:r,onSelect:i,variant:a=`tab`}){let o=e.find(e=>e.key===t)?.path.split(`/`).pop();return(0,L.jsxs)(ee,{onOpenChange:e=>{e&&r?.()},children:[(0,L.jsx)(v,{asChild:!0,children:(0,L.jsxs)(`button`,{type:`button`,role:a===`tab`?`tab`:void 0,className:a===`tab`?`chat-rail-section-tab chat-rail-section-tab-menu${n?` is-active`:``}`:`chat-rail-compact-picker chat-rail-section-tab-menu`,"aria-selected":a===`tab`?n:void 0,children:[(0,L.jsx)(`span`,{children:a===`tab`?`References`:o??`Choose reference`}),(0,L.jsx)(h,{className:`chat-rail-section-tab-chevron`})]})}),(0,L.jsx)(g,{children:(0,L.jsx)(y,{className:`app-nav-menu chat-rail-reference-menu`,sideOffset:4,align:`start`,"aria-label":`Choose reference`,children:e.map(e=>{let n=e.key===t,r=e.path.split(`/`).pop()||e.path;return(0,L.jsxs)(_,{className:`app-nav-menu-item chat-rail-reference-menu-item${n?` active`:``}`,"aria-current":n?`true`:void 0,onSelect:()=>i(e),title:e.path,children:[(0,L.jsx)(`span`,{className:`chat-rail-menu-check`,"aria-hidden":`true`,children:n&&(0,L.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`m2.25 6.25 2.25 2.25 5.25-5.25`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`})})}),(0,L.jsx)(E,{name:r,className:`chat-rail-reference-menu-icon`}),(0,L.jsx)(`span`,{className:`chat-rail-reference-menu-name`,children:r})]},e.key)})})})]})}async function Te(e,t){let n=[t.kind,...[`artifact`,`workspace`,`document`].filter(e=>e!==t.kind)],r=null;for(let i of n)try{let n=await s.previewReference(e,{kind:i,path:t.path});if(n.mode===`media`){let r=await Ee(e,i,t.path);return{kind:i,mode:`media`,mediaKind:n.mediaKind,blob:r}}return{kind:i,...n}}catch(e){if(r=e,e instanceof o&&e.status===404)continue;throw e}throw r??Error(`not found: ${t.path}`)}async function Ee(e,t,n){return t===`artifact`?s.fetchProjectArtifactBlob(e,n):t===`workspace`?s.fetchProjectWorkspaceBlob(e,n):s.fetchDocumentBlob(n)}function De({projectId:e,reference:t,onClose:n,onResolved:r}){let[i,a]=(0,I.useState)(null),[s,c]=(0,I.useState)(null),[l,u]=(0,I.useState)(null),[d,f]=(0,I.useState)(null),[p,m]=(0,I.useState)(!1),[h,b]=(0,I.useState)(t.kind),[x,S]=(0,I.useState)(null),[C,w]=(0,I.useState)(null),[T,E]=(0,I.useState)(!1),D=t.key,O=t.kind,k=t.path;(0,I.useEffect)(()=>{let t=!1,n=null;return E(!0),a(null),c(null),u(null),f(null),m(!1),S(null),w(null),b(O),(async()=>{try{let i=await Te(e,{kind:O,path:k});if(t)return;i.mode===`media`?(n=URL.createObjectURL(i.blob),u(n),f(i.mediaKind)):i.mode===`binary`?m(!0):(a(i.content),c(i.mode)),b(i.kind),i.kind!==O&&r?.(D,i.kind)}catch(e){t||S(e instanceof o&&e.status===404?`Not found in artifacts, workspace, or documents: ${k}`:e.message)}finally{t||E(!1)}})(),()=>{t=!0,n&&URL.revokeObjectURL(n)}},[e,D,O,k,r]);let A=h!==t.kind,j={projectId:e,kind:h,path:t.path},M=async()=>{w(null);let e=window.__GEZEL__?.saveReferenceCopy;if(!e){w(`Saving a copy is available in the desktop app.`);return}try{let t=await e(j);t.ok||w(t.error)}catch(e){w(e instanceof Error?e.message:String(e))}},N=async()=>{w(null);let e=window.__GEZEL__?.showReferenceInFolder;if(!e){w(`Showing the containing folder is available in the desktop app.`);return}try{let t=await e(j);t.ok||w(t.error)}catch(e){w(e instanceof Error?e.message:String(e))}};return(0,L.jsxs)(`div`,{className:`chat-rail-viewer`,children:[(0,L.jsxs)(`header`,{className:`chat-rail-viewer-header`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`chat-rail-ref-kind chat-rail-ref-kind-${h}`,children:h}),A&&(0,L.jsxs)(`span`,{className:`muted small`,style:{marginLeft:`0.35rem`},children:[`(resolved from `,t.kind,`)`]}),(0,L.jsx)(`code`,{className:`chat-rail-viewer-path`,children:t.path})]}),(0,L.jsxs)(`div`,{className:`chat-rail-viewer-actions`,children:[(0,L.jsxs)(ee,{children:[(0,L.jsx)(v,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,className:`tree-actions-trigger chat-rail-viewer-actions-trigger`,"aria-label":`Actions for ${t.path.split(`/`).pop()||t.path}`,title:`File actions`,children:(0,L.jsx)(`span`,{"aria-hidden":`true`,children:`⋯`})})}),(0,L.jsx)(g,{children:(0,L.jsxs)(y,{className:`app-nav-menu tree-actions-menu chat-rail-viewer-actions-menu`,sideOffset:4,align:`end`,children:[(0,L.jsx)(_,{className:`app-nav-menu-item`,onSelect:()=>void M(),children:`Save copy as…`}),(0,L.jsx)(_,{className:`app-nav-menu-item`,onSelect:()=>void N(),children:`Open containing folder`})]})})]}),n&&(0,L.jsx)(`button`,{type:`button`,className:`chat-rail-viewer-close`,onClick:n,children:`×`})]})]}),C&&(0,L.jsx)(`p`,{className:`error small chat-rail-viewer-action-error`,children:C}),(0,L.jsxs)(`div`,{className:`chat-rail-viewer-body`,children:[T&&(0,L.jsx)(`p`,{className:`muted small`,children:`Loading…`}),x&&(0,L.jsx)(`p`,{className:`error`,children:x}),l!==null&&!T&&!x&&d===`video`&&(0,L.jsx)(Ae,{path:t.path,src:l}),l!==null&&!T&&!x&&d===`audio`&&(0,L.jsx)(Z,{path:t.path,src:l}),l!==null&&!T&&!x&&d===`image`&&(0,L.jsx)(ke,{path:t.path,src:l}),p&&!T&&!x&&(0,L.jsx)(je,{path:t.path,onSaveCopy:()=>void M(),onOpenContainingFolder:()=>void N()}),i!==null&&!T&&!x&&(s===`markdown`||J(t.path)?(0,L.jsx)(Pe,{markdown:i,projectId:e,reportPath:h===`artifact`?t.path:void 0,displayMode:Y(t.path)?`slideshow`:`linear`}):ye(t.path)&&(h===`artifact`||h===`workspace`)?(0,L.jsx)(ie,{projectId:e,path:t.path,source:h===`workspace`?`workspace`:`artifacts`,title:t.path,className:`chat-rail-viewer-iframe`}):(0,L.jsx)(Oe,{path:t.path,content:i}))]})]})}function Oe({path:e,content:t}){return(0,L.jsx)(`div`,{className:`chat-rail-viewer-code`,children:(0,L.jsx)(w,{initialMarkdown:t,fileName:e,height:`100%`,colorScheme:j(),showPlayTab:!1,fullWidth:!0,readOnly:!0},e)})}function ke({path:e,src:t}){return(0,L.jsx)(`div`,{className:`chat-rail-viewer-code`,children:(0,L.jsx)(`img`,{src:t,alt:e,style:{maxWidth:`100%`,maxHeight:`100%`,objectFit:`contain`,display:`block`,margin:`0 auto`}},e)})}function Ae({path:e,src:t}){return(0,L.jsx)(`div`,{className:`chat-rail-viewer-code`,children:(0,L.jsx)(`video`,{src:t,controls:!0,preload:`metadata`,playsInline:!0,style:{maxWidth:`100%`,maxHeight:`100%`,display:`block`,margin:`0 auto`,background:`#000`}},e)})}function Z({path:e,src:t}){return(0,L.jsx)(`div`,{className:`chat-rail-viewer-code chat-rail-audio-preview`,children:(0,L.jsx)(`audio`,{src:t,controls:!0,preload:`metadata`},e)})}function je({path:e,onSaveCopy:t,onOpenContainingFolder:n}){return(0,L.jsxs)(`div`,{className:`chat-rail-machine-file`,children:[(0,L.jsxs)(`svg`,{className:`chat-rail-machine-file-icon`,width:`40`,height:`40`,viewBox:`0 0 40 40`,fill:`none`,"aria-hidden":`true`,children:[(0,L.jsx)(`path`,{d:`M10 4h13l7 7v25H10z`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,L.jsx)(`path`,{d:`M23 4v8h7M15 21h10M15 26h10`,stroke:`currentColor`,strokeWidth:`1.5`})]}),(0,L.jsx)(`p`,{className:`chat-rail-machine-file-label`,children:`<Machine File>`}),(0,L.jsx)(`code`,{className:`chat-rail-machine-file-path`,children:e}),(0,L.jsxs)(`div`,{className:`chat-rail-machine-file-actions`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:t,children:`Save copy as…`}),(0,L.jsx)(`button`,{type:`button`,onClick:n,children:`Open containing folder`})]})]})}var Me={id:`gezel-dark`,background:`#1c1f1c`,backgroundLight:`#252925`,text:`#f0ede4`,textMuted:`#9da195`},Ne={id:`gezel-light`,background:`#f3eddf`,backgroundLight:`#eae5d6`,text:`#1c1c1c`,textMuted:`#666666`};function Pe({markdown:e,projectId:t,reportPath:n,articleId:r=`ref-preview`,displayMode:a=`linear`}){let o=(0,I.useMemo)(()=>{try{return b(x(e),{articleId:r})}catch{return null}},[r,e]),s=j(),c=(0,I.useMemo)(()=>n&&i(e)?P({projectId:t,reportPath:n}):void 0,[e,t,n]),l=s===`dark`?Me:Ne;return o?a===`slideshow`?(0,L.jsx)(`div`,{className:`chat-rail-viewer-slideshow`,children:(0,L.jsx)(C,{doc:o,displayMode:`slideshow`,showControls:!0,enableSwipe:!0,globalKeyboardShortcuts:!1})}):(0,L.jsx)(`div`,{className:`chat-rail-viewer-markdown`,children:(0,L.jsx)(S,{doc:o,theme:O,surface:l,fenceRenderers:c})}):(0,L.jsx)(`pre`,{className:`chat-rail-viewer-raw`,children:e})}var Fe=[e=>`Talk with ${e} about project ideas, to catch up on existing projects, or to spin up a new gezel.`,e=>`Ask ${e} what you should work on next — or just say what's on your mind.`,e=>`${e} knows the whole team. Ask what everyone's doing, delegate something new, or just vent about a stuck project.`,e=>`Got a half-baked idea? ${e} will help shape it into something your gezels can actually start on.`,(e,t)=>`Ask ${e} who's working on what, or hand ${t.object} something new to route.`],Ie=[(e,t)=>`Talk with ${e} about ${t}.`,(e,t)=>`Ask ${e} how ${t} is going, nudge a stuck task, or rework the plan.`,(e,t,n)=>`${e} runs ${t}. Check in on progress, change direction, or approve ${n.possessiveAdjective} latest move.`,(e,t,n)=>`What's blocking ${t}? Ask ${e} — ${n.subject} will either know or can go find out.`,(e,t)=>`Give ${e} a new brief for ${t}, or ask where the last thing landed.`],Le=[e=>`Talk with ${e}.`,(e,t)=>`Ask ${e} a question, hand ${t.object} something to work on, or just see what ${t.subject} ${t.presentBe} up to.`,(e,t)=>`${e} is here when you need ${t.object}. Fire away.`,(e,t)=>`Catch ${e} up on what you want next, or ask what ${t.subject} ${t.presentHave} shipped.`],Re={generate_image:[e=>`${e} only generates images. Describe the image you want exactly — e.g. "log cabin under a rainbow." No need for full sentences.`,e=>`${e} turns a description into an image. Just list what you want to see — "neon city street at night, rain" — keywords are fine.`],generate_video:[e=>`${e} only generates video. Describe the shot you want exactly — e.g. "drone flyover of a snowy forest." No need for full sentences.`,e=>`${e} turns a description into a clip. Just list what you want to see — "waves crashing on rocks at sunset" — keywords are fine.`]},ze=[e=>`${e} forwards whatever you type straight to one tool — there's no chat in the middle. Describe exactly what you want; keywords are fine.`],Be=[e=>`Go ahead, ${e} is listening.`,(e,t)=>`${e} has been waiting patiently. Ask ${t.object} anything.`,e=>`No wrong questions. ${e} has probably heard weirder.`,e=>`Don't be shy — ${e} has seen it all.`];function Ve(e){let{role:t,gezelName:n}=e,i=r(e.gezelGender);if(e.fixedFunctionTool){let t=Re[e.fixedFunctionTool]??ze,r=t[Math.floor(Math.random()*t.length)];return Q(r?r(n):ze[0](n))}if(Math.random()<.15){let e=Be[Math.floor(Math.random()*Be.length)];if(e)return Q(e(n,i))}if(t===`meester`){let e=Fe[Math.floor(Math.random()*Fe.length)];return Q(e?e(n,i):`Talk with ${n}.`)}if(t===`voorman`){let t=e.projectName??`this project`,r=Ie[Math.floor(Math.random()*Ie.length)];return Q(r?r(n,t,i):`Talk with ${n} about ${t}.`)}let a=Le[Math.floor(Math.random()*Le.length)];return Q(a?a(n,i):`Talk with ${n}.`)}function Q(e){let t=/\b(?:e\.g|i\.e|etc|vs|approx|no|fig|Mr|Mrs|Ms|Dr|St)\.$/iu;return e.replace(/(^|[.?!]["')\]]?\s+)(["'(\[]*)(\p{Ll})/gu,(n,r,i,a,o)=>r.startsWith(`.`)&&t.test(e.slice(0,o+1))?n:`${r}${i}${a.toUpperCase()}`)}var He=128,$=new Map,Ue=`meester`;function We(e,t){return`gezel|${e}|${t}`}function Ge(e){return`gezel-all|${e}`}function Ke(e){return`project|${e}`}function qe(e,t){return`project|${e}|${t}`}function Je(e){return $.get(e)}function Ye(e,t){let n={...$.get(e),...t};for($.delete(e),$.set(e,n);$.size>He;){let e=$.keys().next();if(e.done)break;$.delete(e.value)}}export{qe as a,Ve as c,Ke as i,be as l,Ge as n,Je as o,We as r,Ye as s,Ue as t,ue as u};