@jingyi0605/codingns 0.6.1 → 0.7.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 (291) hide show
  1. package/bin/codingns.mjs +225 -0
  2. package/dist/public/assets/AdaptiveButlerPage-B8mg25ze.js +3 -0
  3. package/dist/public/assets/{App-Dsf3ooXU.js → App-C2lNmeKL.js} +6 -6
  4. package/dist/public/assets/{BootstrapPage-CE0m1qSR.js → BootstrapPage-CAVA-a8h.js} +1 -1
  5. package/dist/public/assets/ConversationPage-B6BGOX4C.js +6 -0
  6. package/dist/public/assets/{DesktopDetachPreviewPage-Dxarr_Wf.js → DesktopDetachPreviewPage-B37DUL15.js} +1 -1
  7. package/dist/public/assets/{DesktopWindowPage-VytPwJ4c.js → DesktopWindowPage-CDA6l7lm.js} +1 -1
  8. package/dist/public/assets/{FileContextPanel-DwFzLsOp.js → FileContextPanel-CMGTtAB6.js} +1 -1
  9. package/dist/public/assets/{GitSidebar-CH6WqTrM.js → GitSidebar--DCqBiGL.js} +1 -1
  10. package/dist/public/assets/{MobileCreateSessionSheet-DcxKM00P.js → MobileCreateSessionSheet-THIrIzJ3.js} +1 -1
  11. package/dist/public/assets/{MobileTopHeaderFrame-C5rIKQT6.js → MobileTopHeaderFrame-D-X7pVnV.js} +1 -1
  12. package/dist/public/assets/{MobileWorkspaceSwitcherHeader-CfUnHgv_.js → MobileWorkspaceSwitcherHeader-Cczi7RYu.js} +1 -1
  13. package/dist/public/assets/{RelayConnectEntryPage-CgMvVZwa.js → RelayConnectEntryPage-D417tgWj.js} +1 -1
  14. package/dist/public/assets/{ServerSettingsModal-CFul__z1.js → ServerSettingsModal-BdTxbRbU.js} +1 -1
  15. package/dist/public/assets/SessionIndexPage-D5iefVcc.js +1 -0
  16. package/dist/public/assets/SettingsPage-iCFe_DHP.js +2 -0
  17. package/dist/public/assets/{TerminalManagerPanel-BbORd-ee.js → TerminalManagerPanel-CtldwWz8.js} +1 -1
  18. package/dist/public/assets/{TerminalPage-DWHv6mlu.js → TerminalPage-DAzQTmQC.js} +19 -19
  19. package/dist/public/assets/{TerminalRuntimeFallbackModal-B29YxbQe.js → TerminalRuntimeFallbackModal-DLOhAvaq.js} +1 -1
  20. package/dist/public/assets/{ToolFilesPage-Dx9cv9hu.js → ToolFilesPage-D7thcDEv.js} +1 -1
  21. package/dist/public/assets/{ToolGitPage-D7H3vAia.js → ToolGitPage-uPRsxdcn.js} +1 -1
  22. package/dist/public/assets/{ToolProcessesPage-PqQWxsy-.js → ToolProcessesPage-B1uOk0Ef.js} +1 -1
  23. package/dist/public/assets/{ToolsHomePage-CX05Pe_4.js → ToolsHomePage-rU3V8mmh.js} +1 -1
  24. package/dist/public/assets/{WorkbenchLandingPage-CchkAC75.js → WorkbenchLandingPage-BudM2C69.js} +1 -1
  25. package/dist/public/assets/WorkbenchLayout-Dybarc1V.js +244 -0
  26. package/dist/public/assets/WorkbenchModal-DMQutm1x.js +1 -0
  27. package/dist/public/assets/WorkbenchShellRoute-Cy4WBbzq.js +1 -0
  28. package/dist/public/assets/{WorkbenchShellRoute-RGZpA0_J.css → WorkbenchShellRoute-DhQo_0vu.css} +1 -1
  29. package/dist/public/assets/{WorkspaceDebugDetailPage-Deqy2_pO.js → WorkspaceDebugDetailPage-CHqo-uDf.js} +1 -1
  30. package/dist/public/assets/{WorkspaceDetailPage-Cvf-ZdlB.js → WorkspaceDetailPage-CGkAH1W-.js} +1 -1
  31. package/dist/public/assets/{WorkspaceHomePage-Dsyvqyk1.js → WorkspaceHomePage-CfuPVITd.js} +1 -1
  32. package/dist/public/assets/{client-runtime-manager-DROQJ9v3.js → client-runtime-manager-CKbtaemV.js} +1 -1
  33. package/dist/public/assets/file-tree-icon-Bc0KADEl.js +3 -0
  34. package/dist/public/assets/index-DNRyROOG.css +1 -0
  35. package/dist/public/assets/index-oGylLBIX.js +42 -0
  36. package/dist/public/assets/{login-direct-candidate-resolver-DotM530R.js → login-direct-candidate-resolver-DjJMbqB7.js} +1 -1
  37. package/dist/public/assets/model-switch-api-T55eW6D4.js +1 -0
  38. package/dist/public/assets/{preferences-service-BG6GKG29.js → preferences-service-BTKBl5xM.js} +1 -1
  39. package/dist/public/assets/realtime-client-ww7MnbTD.js +1 -0
  40. package/dist/public/assets/{relay-entry-pmr-c42O.js → relay-entry-sdeFnTbY.js} +1 -1
  41. package/dist/public/assets/styles-BjPytabP.css +1 -0
  42. package/dist/public/assets/{terminal-runtime-meta-8_uRZf7h.js → terminal-runtime-meta-Cvt1ID92.js} +1 -1
  43. package/dist/public/assets/{useRegisteredDebugTemplates-DWX7LXQu.js → useRegisteredDebugTemplates-O-ymgLd9.js} +1 -1
  44. package/dist/public/index.html +2 -2
  45. package/dist/server/config/env.js +21 -1
  46. package/dist/server/config/env.js.map +1 -1
  47. package/dist/server/config/opencode-base-url-resolver.d.ts +16 -0
  48. package/dist/server/config/opencode-base-url-resolver.js +154 -0
  49. package/dist/server/config/opencode-base-url-resolver.js.map +1 -1
  50. package/dist/server/helpers/wechat-claw-runtime/main.d.ts +1 -0
  51. package/dist/server/helpers/wechat-claw-runtime/main.js +38 -0
  52. package/dist/server/helpers/wechat-claw-runtime/main.js.map +1 -0
  53. package/dist/server/helpers/wechat-claw-runtime/modules/errors.d.ts +5 -0
  54. package/dist/server/helpers/wechat-claw-runtime/modules/errors.js +32 -0
  55. package/dist/server/helpers/wechat-claw-runtime/modules/errors.js.map +1 -0
  56. package/dist/server/helpers/wechat-claw-runtime/modules/login-service.d.ts +16 -0
  57. package/dist/server/helpers/wechat-claw-runtime/modules/login-service.js +209 -0
  58. package/dist/server/helpers/wechat-claw-runtime/modules/login-service.js.map +1 -0
  59. package/dist/server/helpers/wechat-claw-runtime/modules/poll-service.d.ts +18 -0
  60. package/dist/server/helpers/wechat-claw-runtime/modules/poll-service.js +135 -0
  61. package/dist/server/helpers/wechat-claw-runtime/modules/poll-service.js.map +1 -0
  62. package/dist/server/helpers/wechat-claw-runtime/modules/runtime-state-store.d.ts +34 -0
  63. package/dist/server/helpers/wechat-claw-runtime/modules/runtime-state-store.js +394 -0
  64. package/dist/server/helpers/wechat-claw-runtime/modules/runtime-state-store.js.map +1 -0
  65. package/dist/server/helpers/wechat-claw-runtime/modules/send-service.d.ts +9 -0
  66. package/dist/server/helpers/wechat-claw-runtime/modules/send-service.js +64 -0
  67. package/dist/server/helpers/wechat-claw-runtime/modules/send-service.js.map +1 -0
  68. package/dist/server/helpers/wechat-claw-runtime/modules/types.d.ts +167 -0
  69. package/dist/server/helpers/wechat-claw-runtime/modules/types.js +3 -0
  70. package/dist/server/helpers/wechat-claw-runtime/modules/types.js.map +1 -0
  71. package/dist/server/helpers/wechat-claw-runtime/modules/wechat-api-client.d.ts +34 -0
  72. package/dist/server/helpers/wechat-claw-runtime/modules/wechat-api-client.js +160 -0
  73. package/dist/server/helpers/wechat-claw-runtime/modules/wechat-api-client.js.map +1 -0
  74. package/dist/server/helpers/wechat-claw-runtime/routes/accounts.d.ts +9 -0
  75. package/dist/server/helpers/wechat-claw-runtime/routes/accounts.js +24 -0
  76. package/dist/server/helpers/wechat-claw-runtime/routes/accounts.js.map +1 -0
  77. package/dist/server/helpers/wechat-claw-runtime/server.d.ts +5 -0
  78. package/dist/server/helpers/wechat-claw-runtime/server.js +36 -0
  79. package/dist/server/helpers/wechat-claw-runtime/server.js.map +1 -0
  80. package/dist/server/middlewares/auth-guard.js +4 -1
  81. package/dist/server/middlewares/auth-guard.js.map +1 -1
  82. package/dist/server/modules/assistant-capability/assistant-capability-service.d.ts +4 -1
  83. package/dist/server/modules/assistant-capability/assistant-capability-service.js +12 -1
  84. package/dist/server/modules/assistant-capability/assistant-capability-service.js.map +1 -1
  85. package/dist/server/modules/butler/butler-control-session-service.d.ts +20 -2
  86. package/dist/server/modules/butler/butler-control-session-service.js +121 -74
  87. package/dist/server/modules/butler/butler-control-session-service.js.map +1 -1
  88. package/dist/server/modules/butler/butler-profile-service.d.ts +3 -1
  89. package/dist/server/modules/butler/butler-profile-service.js +16 -4
  90. package/dist/server/modules/butler/butler-profile-service.js.map +1 -1
  91. package/dist/server/modules/butler/butler-session-service.js +44 -15
  92. package/dist/server/modules/butler/butler-session-service.js.map +1 -1
  93. package/dist/server/modules/channels/channel-bridge-service.d.ts +55 -0
  94. package/dist/server/modules/channels/channel-bridge-service.js +340 -0
  95. package/dist/server/modules/channels/channel-bridge-service.js.map +1 -0
  96. package/dist/server/modules/channels/channel-controller.d.ts +52 -0
  97. package/dist/server/modules/channels/channel-controller.js +54 -0
  98. package/dist/server/modules/channels/channel-controller.js.map +1 -0
  99. package/dist/server/modules/channels/channel-delivery-service.d.ts +63 -0
  100. package/dist/server/modules/channels/channel-delivery-service.js +429 -0
  101. package/dist/server/modules/channels/channel-delivery-service.js.map +1 -0
  102. package/dist/server/modules/channels/channel-gateway-controller.d.ts +15 -0
  103. package/dist/server/modules/channels/channel-gateway-controller.js +16 -0
  104. package/dist/server/modules/channels/channel-gateway-controller.js.map +1 -0
  105. package/dist/server/modules/channels/channel-gateway-service.d.ts +24 -0
  106. package/dist/server/modules/channels/channel-gateway-service.js +56 -0
  107. package/dist/server/modules/channels/channel-gateway-service.js.map +1 -0
  108. package/dist/server/modules/channels/channel-platform-adapters.d.ts +46 -0
  109. package/dist/server/modules/channels/channel-platform-adapters.js +315 -0
  110. package/dist/server/modules/channels/channel-platform-adapters.js.map +1 -0
  111. package/dist/server/modules/channels/channel-platform-catalog.d.ts +3 -0
  112. package/dist/server/modules/channels/channel-platform-catalog.js +42 -0
  113. package/dist/server/modules/channels/channel-platform-catalog.js.map +1 -0
  114. package/dist/server/modules/channels/channel-polling-scheduler.d.ts +31 -0
  115. package/dist/server/modules/channels/channel-polling-scheduler.js +93 -0
  116. package/dist/server/modules/channels/channel-polling-scheduler.js.map +1 -0
  117. package/dist/server/modules/channels/channel-polling-service.d.ts +46 -0
  118. package/dist/server/modules/channels/channel-polling-service.js +176 -0
  119. package/dist/server/modules/channels/channel-polling-service.js.map +1 -0
  120. package/dist/server/modules/channels/channel-service.d.ts +108 -0
  121. package/dist/server/modules/channels/channel-service.js +397 -0
  122. package/dist/server/modules/channels/channel-service.js.map +1 -0
  123. package/dist/server/modules/channels/wechat-claw-client.d.ts +51 -0
  124. package/dist/server/modules/channels/wechat-claw-client.js +245 -0
  125. package/dist/server/modules/channels/wechat-claw-client.js.map +1 -0
  126. package/dist/server/modules/channels/wechat-claw-runtime-boundary.d.ts +4 -0
  127. package/dist/server/modules/channels/wechat-claw-runtime-boundary.js +13 -0
  128. package/dist/server/modules/channels/wechat-claw-runtime-boundary.js.map +1 -0
  129. package/dist/server/modules/channels/wechat-claw-runtime-client.d.ts +14 -0
  130. package/dist/server/modules/channels/wechat-claw-runtime-client.js +95 -0
  131. package/dist/server/modules/channels/wechat-claw-runtime-client.js.map +1 -0
  132. package/dist/server/modules/channels/wechat-claw-runtime-manager.d.ts +16 -0
  133. package/dist/server/modules/channels/wechat-claw-runtime-manager.js +133 -0
  134. package/dist/server/modules/channels/wechat-claw-runtime-manager.js.map +1 -0
  135. package/dist/server/modules/channels/wechat-claw-runtime-types.d.ts +1 -0
  136. package/dist/server/modules/channels/wechat-claw-runtime-types.js +2 -0
  137. package/dist/server/modules/channels/wechat-claw-runtime-types.js.map +1 -0
  138. package/dist/server/modules/opencli/opencli-bridge-skill-service.d.ts +12 -0
  139. package/dist/server/modules/opencli/opencli-bridge-skill-service.js +125 -0
  140. package/dist/server/modules/opencli/opencli-bridge-skill-service.js.map +1 -0
  141. package/dist/server/modules/opencli/opencli-catalog-service.d.ts +50 -0
  142. package/dist/server/modules/opencli/opencli-catalog-service.js +345 -0
  143. package/dist/server/modules/opencli/opencli-catalog-service.js.map +1 -0
  144. package/dist/server/modules/opencli/opencli-controller.d.ts +13 -0
  145. package/dist/server/modules/opencli/opencli-controller.js +30 -0
  146. package/dist/server/modules/opencli/opencli-controller.js.map +1 -0
  147. package/dist/server/modules/opencli/opencli-health-service.d.ts +28 -0
  148. package/dist/server/modules/opencli/opencli-health-service.js +106 -0
  149. package/dist/server/modules/opencli/opencli-health-service.js.map +1 -0
  150. package/dist/server/modules/opencli/opencli-install-discovery.d.ts +23 -0
  151. package/dist/server/modules/opencli/opencli-install-discovery.js +130 -0
  152. package/dist/server/modules/opencli/opencli-install-discovery.js.map +1 -0
  153. package/dist/server/modules/opencli/opencli-management-service.d.ts +59 -0
  154. package/dist/server/modules/opencli/opencli-management-service.js +152 -0
  155. package/dist/server/modules/opencli/opencli-management-service.js.map +1 -0
  156. package/dist/server/modules/opencli/opencli-runtime-builder.d.ts +11 -0
  157. package/dist/server/modules/opencli/opencli-runtime-builder.js +214 -0
  158. package/dist/server/modules/opencli/opencli-runtime-builder.js.map +1 -0
  159. package/dist/server/modules/opencli/opencli-runtime-layout.d.ts +3 -0
  160. package/dist/server/modules/opencli/opencli-runtime-layout.js +11 -0
  161. package/dist/server/modules/opencli/opencli-runtime-layout.js.map +1 -0
  162. package/dist/server/modules/opencli/opencli-runtime-profile-service.d.ts +29 -0
  163. package/dist/server/modules/opencli/opencli-runtime-profile-service.js +104 -0
  164. package/dist/server/modules/opencli/opencli-runtime-profile-service.js.map +1 -0
  165. package/dist/server/modules/opencli/opencli-runtime-resolver.d.ts +29 -0
  166. package/dist/server/modules/opencli/opencli-runtime-resolver.js +110 -0
  167. package/dist/server/modules/opencli/opencli-runtime-resolver.js.map +1 -0
  168. package/dist/server/modules/opencli/opencli-session-prompt-service.d.ts +11 -0
  169. package/dist/server/modules/opencli/opencli-session-prompt-service.js +66 -0
  170. package/dist/server/modules/opencli/opencli-session-prompt-service.js.map +1 -0
  171. package/dist/server/modules/provider/provider-catalog-service.d.ts +45 -0
  172. package/dist/server/modules/provider/provider-catalog-service.js +204 -0
  173. package/dist/server/modules/provider/provider-catalog-service.js.map +1 -0
  174. package/dist/server/modules/provider/provider-controller.d.ts +16 -2
  175. package/dist/server/modules/provider/provider-controller.js +49 -6
  176. package/dist/server/modules/provider/provider-controller.js.map +1 -1
  177. package/dist/server/modules/provider/provider-disabled.d.ts +8 -0
  178. package/dist/server/modules/provider/provider-disabled.js +45 -0
  179. package/dist/server/modules/provider/provider-disabled.js.map +1 -0
  180. package/dist/server/modules/provider/provider-discovery-helper-client.d.ts +1 -0
  181. package/dist/server/modules/provider/provider-discovery-helper-client.js.map +1 -1
  182. package/dist/server/modules/provider/provider-discovery-helper-process.js +3 -3
  183. package/dist/server/modules/provider/provider-discovery-helper-process.js.map +1 -1
  184. package/dist/server/modules/provider/provider-discovery-runtime.d.ts +1 -1
  185. package/dist/server/modules/provider/provider-discovery-runtime.js +12 -8
  186. package/dist/server/modules/provider/provider-discovery-runtime.js.map +1 -1
  187. package/dist/server/modules/provider/provider-runtime-state-service.d.ts +24 -0
  188. package/dist/server/modules/provider/provider-runtime-state-service.js +141 -0
  189. package/dist/server/modules/provider/provider-runtime-state-service.js.map +1 -0
  190. package/dist/server/modules/sessions/claude-compatible-provider-registry.d.ts +16 -0
  191. package/dist/server/modules/sessions/claude-compatible-provider-registry.js +91 -0
  192. package/dist/server/modules/sessions/claude-compatible-provider-registry.js.map +1 -0
  193. package/dist/server/modules/sessions/session-history-service.d.ts +9 -3
  194. package/dist/server/modules/sessions/session-history-service.js +198 -62
  195. package/dist/server/modules/sessions/session-history-service.js.map +1 -1
  196. package/dist/server/modules/sessions/session-live-runtime-router-service.js +9 -4
  197. package/dist/server/modules/sessions/session-live-runtime-router-service.js.map +1 -1
  198. package/dist/server/modules/sessions/session-live-runtime-service.d.ts +8 -4
  199. package/dist/server/modules/sessions/session-live-runtime-service.js +99 -88
  200. package/dist/server/modules/sessions/session-live-runtime-service.js.map +1 -1
  201. package/dist/server/modules/sessions/session-permission-request-service.d.ts +5 -2
  202. package/dist/server/modules/sessions/session-permission-request-service.js +26 -27
  203. package/dist/server/modules/sessions/session-permission-request-service.js.map +1 -1
  204. package/dist/server/modules/sessions/session-provider-config-service.d.ts +18 -1
  205. package/dist/server/modules/sessions/session-provider-config-service.js +142 -17
  206. package/dist/server/modules/sessions/session-provider-config-service.js.map +1 -1
  207. package/dist/server/modules/sessions/session-provider-error-mapper.js +7 -0
  208. package/dist/server/modules/sessions/session-provider-error-mapper.js.map +1 -1
  209. package/dist/server/modules/skills/skill-manager-service.d.ts +5 -0
  210. package/dist/server/modules/skills/skill-manager-service.js +26 -0
  211. package/dist/server/modules/skills/skill-manager-service.js.map +1 -1
  212. package/dist/server/modules/tasks/task-helper-process-handlers.d.ts +1 -0
  213. package/dist/server/modules/tasks/task-helper-process-handlers.js +1 -1
  214. package/dist/server/modules/tasks/task-helper-process-handlers.js.map +1 -1
  215. package/dist/server/modules/tasks/task-types.d.ts +2 -0
  216. package/dist/server/modules/tasks/task-types.js +2 -0
  217. package/dist/server/modules/tasks/task-types.js.map +1 -1
  218. package/dist/server/routes/channels.d.ts +3 -0
  219. package/dist/server/routes/channels.js +16 -0
  220. package/dist/server/routes/channels.js.map +1 -0
  221. package/dist/server/routes/opencli.d.ts +3 -0
  222. package/dist/server/routes/opencli.js +7 -0
  223. package/dist/server/routes/opencli.js.map +1 -0
  224. package/dist/server/routes/providers.js +5 -2
  225. package/dist/server/routes/providers.js.map +1 -1
  226. package/dist/server/routes/public.d.ts +2 -1
  227. package/dist/server/routes/public.js +3 -1
  228. package/dist/server/routes/public.js.map +1 -1
  229. package/dist/server/server/create-server.d.ts +30 -0
  230. package/dist/server/server/create-server.js +104 -12
  231. package/dist/server/server/create-server.js.map +1 -1
  232. package/dist/server/shared/http/error-handler.js +59 -3
  233. package/dist/server/shared/http/error-handler.js.map +1 -1
  234. package/dist/server/storage/repositories/channel-account-repository.d.ts +12 -0
  235. package/dist/server/storage/repositories/channel-account-repository.js +153 -0
  236. package/dist/server/storage/repositories/channel-account-repository.js.map +1 -0
  237. package/dist/server/storage/repositories/channel-delivery-repository.d.ts +13 -0
  238. package/dist/server/storage/repositories/channel-delivery-repository.js +156 -0
  239. package/dist/server/storage/repositories/channel-delivery-repository.js.map +1 -0
  240. package/dist/server/storage/repositories/channel-inbound-event-repository.d.ts +12 -0
  241. package/dist/server/storage/repositories/channel-inbound-event-repository.js +144 -0
  242. package/dist/server/storage/repositories/channel-inbound-event-repository.js.map +1 -0
  243. package/dist/server/storage/repositories/channel-thread-repository.d.ts +12 -0
  244. package/dist/server/storage/repositories/channel-thread-repository.js +152 -0
  245. package/dist/server/storage/repositories/channel-thread-repository.js.map +1 -0
  246. package/dist/server/storage/repositories/opencli-catalog-entry-repository.d.ts +9 -0
  247. package/dist/server/storage/repositories/opencli-catalog-entry-repository.js +85 -0
  248. package/dist/server/storage/repositories/opencli-catalog-entry-repository.js.map +1 -0
  249. package/dist/server/storage/repositories/opencli-provider-repository.d.ts +8 -0
  250. package/dist/server/storage/repositories/opencli-provider-repository.js +88 -0
  251. package/dist/server/storage/repositories/opencli-provider-repository.js.map +1 -0
  252. package/dist/server/storage/repositories/opencli-runtime-profile-repository.d.ts +11 -0
  253. package/dist/server/storage/repositories/opencli-runtime-profile-repository.js +127 -0
  254. package/dist/server/storage/repositories/opencli-runtime-profile-repository.js.map +1 -0
  255. package/dist/server/storage/repositories/provider-control-repository.d.ts +9 -0
  256. package/dist/server/storage/repositories/provider-control-repository.js +51 -0
  257. package/dist/server/storage/repositories/provider-control-repository.js.map +1 -0
  258. package/dist/server/storage/repositories/provider-runtime-state-repository.d.ts +9 -0
  259. package/dist/server/storage/repositories/provider-runtime-state-repository.js +50 -0
  260. package/dist/server/storage/repositories/provider-runtime-state-repository.js.map +1 -0
  261. package/dist/server/storage/sqlite/client.js +53 -0
  262. package/dist/server/storage/sqlite/client.js.map +1 -1
  263. package/dist/server/storage/sqlite/schema.sql +180 -0
  264. package/dist/server/types/domain.d.ts +132 -0
  265. package/dist/server/ws/workbench-ws-hub.js +8 -2
  266. package/dist/server/ws/workbench-ws-hub.js.map +1 -1
  267. package/node_modules/@codingns/session-sync-core/dist/providers/codex.js +28 -11
  268. package/node_modules/@codingns/session-sync-core/dist/providers/codex.js.map +1 -1
  269. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js +61 -8
  270. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js.map +1 -1
  271. package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.d.ts +5 -0
  272. package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.js +1 -1
  273. package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.js.map +1 -1
  274. package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.d.ts +3 -0
  275. package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.js +94 -21
  276. package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.js.map +1 -1
  277. package/package.json +1 -1
  278. package/dist/public/assets/AdaptiveButlerPage-Dw72U3hG.js +0 -3
  279. package/dist/public/assets/ConversationPage-8wOY7SX-.js +0 -4
  280. package/dist/public/assets/SessionIndexPage-B-tRhBXC.js +0 -1
  281. package/dist/public/assets/SettingsPage-C9LGxSQZ.js +0 -1
  282. package/dist/public/assets/WorkbenchLayout-pOZvEqp7.js +0 -3
  283. package/dist/public/assets/WorkbenchModal-ColqvV6a.js +0 -1
  284. package/dist/public/assets/WorkbenchShellRoute-C0_h4lP6.js +0 -1
  285. package/dist/public/assets/file-tree-icon-Bp3Ntt7u.js +0 -31
  286. package/dist/public/assets/index-B84Po2NA.css +0 -1
  287. package/dist/public/assets/index-C-0oeG_5.js +0 -42
  288. package/dist/public/assets/model-switch-api-Bh9nYslz.js +0 -1
  289. package/dist/public/assets/session-runtime-machine-YN84QBlr.js +0 -21
  290. package/dist/public/assets/styles-CsEMfdaS.css +0 -1
  291. /package/dist/public/assets/{styles-DRVvx_kv.js → styles-lhQGDlPF.js} +0 -0
@@ -1 +1 @@
1
- import{b as c,j as e,t as s}from"./index-C-0oeG_5.js";import{j as $,u as q,b as R,f as z,k as H,r as _,a as L,D as J,h as T,d as y,e as A,l as K,m as Q,c as U,g as X,i as Y}from"./useRegisteredDebugTemplates-DWX7LXQu.js";import{u as Z,t as ee,s as se}from"./WorkbenchLayout-pOZvEqp7.js";import{c as C}from"./model-switch-api-Bh9nYslz.js";import{g as I,r as ae}from"./terminal-runtime-meta-8_uRZf7h.js";import{c as le,u as te,f as ne}from"./App-Dsf3ooXU.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./WorkbenchModal-ColqvV6a.js";import"./relay-entry-pmr-c42O.js";function be(){var S;const{workspaceId:u=""}=le(),j=te(),{showToast:d}=ne(),{navigationGroups:E,selectWorkspace:f}=Z(),r=((S=E.find(a=>a.workspace.id===u))==null?void 0:S.workspace)??null,[h,m]=c.useState(null),[N,o]=c.useState(null),[n,k]=c.useState(null),w=c.useRef(null);c.useEffect(()=>{u&&f(u)},[f,u]);const P=c.useMemo(()=>r?{id:r.id,path:r.path,name:r.name}:null,[r]),l=$(P),b=q(P),g=c.useMemo(()=>n??R(l.templates,l.runtimeStatuses),[n,l.runtimeStatuses,l.templates]),M=c.useMemo(()=>(n==null?void 0:n.items.some(a=>{var t;return(t=a.planItem)==null?void 0:t.missingRequirements.includes("service_discovery")}))??!1,[n]),O=c.useMemo(()=>new Map(l.runtimeStatuses.map(a=>[a.templateId,a])),[l.runtimeStatuses]);if(c.useEffect(()=>{!n||!w.current||typeof w.current.scrollIntoView=="function"&&w.current.scrollIntoView({behavior:"smooth",block:"start"})},[n]),!r)return e.jsx("main",{className:"workbench-page conversation-page-shell debug-readiness-page-shell",children:e.jsxs("div",{className:"workbench-empty-guide surface-card",children:[e.jsx("h1",{children:s("shell.workspaceDetailMissingTitle")}),e.jsx("p",{children:s("shell.workspaceDetailMissingBody")})]})});return e.jsx("main",{className:"workbench-page conversation-page-shell debug-readiness-page-shell",children:e.jsxs("div",{className:"debug-readiness-page",children:[e.jsxs("section",{className:"debug-readiness-hero surface-card",children:[e.jsx("div",{className:"debug-readiness-hero-header",children:e.jsxs("div",{className:"debug-readiness-hero-copy",children:[e.jsx("h2",{children:s("shell.workspaceDetailDebugPageTitle")}),e.jsx("p",{children:s("shell.workspaceDetailRegisteredDebugPageDescription")})]})}),e.jsxs("div",{className:"debug-readiness-hero-toolbar",children:[e.jsxs("div",{className:"workbench-modal-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>j(ee(r.id)),children:s("shell.goBack")}),e.jsx("button",{type:"button",className:"secondary-button",disabled:h!==null,onClick:()=>{B()},children:h==="sync"?s("shell.workspaceDetailRegisteredDebugActionSyncingTemplates"):s("shell.workspaceDetailRegisteredDebugActionSyncTemplates")}),e.jsx("button",{type:"button",className:"secondary-button",disabled:h!==null,onClick:()=>{F()},children:h==="plan"?s("shell.workspaceDetailDebugActionPlanning"):s("shell.workspaceDetailDebugActionPlan")}),e.jsx("button",{type:"button",className:"primary-button",disabled:h!==null,onClick:()=>{W()},children:h==="run"?s("shell.workspaceDetailRegisteredDebugActionRunningRegistered"):s("shell.workspaceDetailRegisteredDebugActionRunRegistered")}),e.jsx("button",{type:"button",className:"secondary-button",disabled:h!==null,onClick:()=>{V()},children:h==="refresh"?s("shell.workspaceDetailDebugActionRefreshing"):s("shell.workspaceDetailDebugActionRefresh")})]}),N?e.jsx("p",{className:"workbench-manage-status status-text","data-tone":"error",children:N}):null]}),e.jsxs("div",{className:"debug-readiness-summary-grid debug-readiness-summary-grid-hero",children:[e.jsxs("article",{className:"debug-readiness-summary-card","data-tone":_(g,l.templates.length),children:[e.jsx("span",{children:s("shell.workspaceDetailDebugOverallStatusLabel")}),e.jsx("strong",{children:z(g,l.templates.length)}),e.jsx("small",{children:H(g,l.templates.length)})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryRegisteredCountLabel")}),e.jsx("strong",{children:l.templates.length})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryConfiguredPortLabel")}),e.jsx("strong",{children:l.templates.filter(a=>a.port!==null).length}),e.jsx("small",{children:s("shell.workspaceDetailRegisteredDebugRuntimeScopeNote")})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryRunnableCountLabel")}),e.jsx("strong",{children:g.runnableCount})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryOrchestratedCountLabel")}),e.jsx("strong",{children:g.orchestratedCount})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryBlockedCountLabel")}),e.jsx("strong",{children:g.blockedCount})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryLastRefreshLabel")}),e.jsx("strong",{children:L(l.lastRefreshedAt)}),e.jsx("small",{children:r.path})]})]})]}),e.jsx(J,{workspace:{id:r.id,path:r.path,name:r.name},state:b,variant:"page"}),n?e.jsxs("section",{ref:w,className:"debug-readiness-section surface-card",children:[e.jsxs("div",{className:"debug-readiness-section-header",children:[e.jsxs("div",{children:[e.jsx("h3",{children:s("shell.workspaceDetailDebugLaunchPlanTitle")}),e.jsx("p",{children:s("shell.workspaceDetailRegisteredDebugLaunchPlanDescription")})]}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>k(null),children:s("shell.workspaceDetailDebugLaunchPlanDismissAction")})]}),e.jsxs("div",{className:"workbench-manage-kv-list",children:[e.jsxs("div",{className:"workbench-manage-kv-item",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugLaunchPlanGeneratedAtLabel")}),e.jsx("span",{children:L(n.generatedAt)})]}),e.jsxs("div",{className:"workbench-manage-kv-item",children:[e.jsx("span",{children:s("shell.workspaceDetailDebugLaunchPlanAutoStartLabel")}),e.jsx("span",{children:n.autoStartAllowed?s("shell.workspaceDetailDebugLaunchPlanAutoStartAllowed"):s("shell.workspaceDetailDebugLaunchPlanAutoStartBlocked")})]}),e.jsxs("div",{className:"workbench-manage-kv-item",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugLaunchPlanRunnableLabel")}),e.jsx("span",{children:n.runnableCount})]}),e.jsxs("div",{className:"workbench-manage-kv-item",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugLaunchPlanOrchestratedLabel")}),e.jsx("span",{children:n.orchestratedCount})]}),e.jsxs("div",{className:"workbench-manage-kv-item",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugLaunchPlanBlockedLabel")}),e.jsx("span",{children:n.blockedCount})]})]}),e.jsx("p",{className:"workbench-manage-hint",children:s("shell.workspaceDetailRegisteredDebugLaunchPlanNote")}),M?e.jsx("p",{className:"workbench-manage-hint",children:s("shell.workspaceDetailRegisteredDebugLaunchPlanServiceDiscoveryHelp")}):null,n.items.length>0?e.jsx("div",{className:"debug-readiness-runtime-list",children:n.items.map(a=>e.jsxs("article",{className:"debug-readiness-runtime-item",children:[e.jsxs("div",{className:"debug-readiness-runtime-item-header",children:[e.jsx("strong",{children:a.template.name}),e.jsx("span",{children:T(a.template)})]}),e.jsxs("div",{className:"debug-readiness-runtime-item-grid",children:[e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePathLabel")}),e.jsx("strong",{title:a.template.cwd,children:y(a.template.cwd,r.path)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePortLabel")}),e.jsx("strong",{children:A(a.assignedPort)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemRuntimeLabel")}),e.jsx("strong",{children:I(a.template.runtimeType)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemActionLabel")}),e.jsx("strong",{children:K(a.decision)})]})]}),e.jsxs("p",{className:"workbench-manage-hint",children:[s("shell.workspaceDetailRegisteredDebugPlanItemReasonLabel"),": ",a.reason]})]},a.template.id))}):e.jsx("p",{className:"workbench-section-empty",children:s("shell.workspaceDetailRegisteredDebugTemplatesEmpty")})]}):null,e.jsxs("section",{className:"debug-readiness-section surface-card",children:[e.jsxs("div",{className:"debug-readiness-section-header",children:[e.jsxs("div",{children:[e.jsx("h3",{children:s("shell.workspaceDetailRegisteredDebugTemplatesTitle")}),e.jsx("p",{children:s("shell.workspaceDetailRegisteredDebugTemplatesDescription")})]}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>j(se(r.id)),children:s("shell.workspaceDetailRegisteredDebugOpenProcessManagerAction")})]}),l.loading&&l.templates.length===0?e.jsx("p",{className:"workbench-section-empty",children:s("common.loading")}):null,l.error&&l.templates.length===0?e.jsx("p",{className:"workbench-manage-status status-text","data-tone":"error",children:l.error}):null,!l.loading&&l.templates.length===0?e.jsx("p",{className:"workbench-section-empty",children:s("shell.workspaceDetailRegisteredDebugTemplatesEmpty")}):null,l.templates.length>0?e.jsx("div",{className:"debug-readiness-service-grid",children:l.templates.map(a=>{const t=O.get(a.id)??null,p=Q(a,t);return e.jsxs("article",{className:"debug-readiness-service-card",children:[e.jsxs("div",{className:"debug-readiness-service-card-header",children:[e.jsxs("div",{children:[e.jsx("strong",{children:a.name}),e.jsx("p",{title:a.cwd,children:y(a.cwd,r.path)})]}),e.jsx("span",{className:"debug-readiness-chip","data-tone":p,children:U(a,t)})]}),e.jsxs("div",{className:"debug-readiness-service-card-grid",children:[e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePathLabel")}),e.jsx("strong",{title:a.cwd,children:y(a.cwd,r.path)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePortLabel")}),e.jsx("strong",{children:A(a.port)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplateRuntimeTypeLabel")}),e.jsx("strong",{children:I(a.runtimeType)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugRuntimeProcessLabel")}),e.jsx("strong",{children:X(t)})]})]}),e.jsxs("div",{className:"debug-readiness-service-card-list",children:[e.jsxs("p",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemCommandLabel")}),e.jsx("strong",{children:T(a)})]}),e.jsxs("p",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemReasonLabel")}),e.jsx("strong",{children:Y(a,t)})]})]})]},a.id)})}):null]})]})});async function B(){m("sync"),o(null);try{await l.refreshAll(),k(null),d({title:s("shell.workspaceDetailRegisteredDebugActionSyncTemplatesSuccess"),tone:"success"})}catch(a){const t=x(a,s("shell.workspaceDetailRegisteredDebugActionSyncTemplatesFailed"));o(t),d({title:t,tone:"error"})}finally{m(null)}}async function F(){m("plan"),o(null);try{if(!b.targetId)throw new Error(s("shell.workspaceDetailDebugActionTargetMissing"));const a=await C(b.targetId),t=R(l.templates,l.runtimeStatuses,a);k(t),d({title:s("shell.workspaceDetailDebugActionPlanSuccess"),tone:"info"})}catch(a){const t=x(a,s("shell.workspaceDetailDebugActionPlanFailed"));o(t),d({title:t,tone:"error"})}finally{m(null)}}async function W(){var a,t;m("run"),o(null);try{const p=n??(b.targetId?R(l.templates,l.runtimeStatuses,await C(b.targetId)):R(l.templates,l.runtimeStatuses));k(p);const D=p.items.filter(i=>i.decision!=="blocked");if(D.length===0){const i=s("shell.workspaceDetailRegisteredDebugActionRunRegisteredSkipped");o(i),d({title:i,tone:"info"});return}const v=[];for(const i of D)try{await ae(i.template.id,{runtimeType:i.template.runtimeType??void 0,argsOverride:(a=i.planItem)==null?void 0:a.args,envPatch:(t=i.planItem)==null?void 0:t.envPatch,portOverride:i.assignedPort})}catch(G){v.push(`${i.template.name}: ${x(G,s("shell.workspaceDetailRegisteredDebugActionRunRegisteredFailed"))}`)}if(await l.refreshRuntime(),v.length>0)throw new Error(v.join(";"));d({title:s("shell.workspaceDetailRegisteredDebugActionRunRegisteredSuccess"),tone:"success"})}catch(p){const D=x(p,s("shell.workspaceDetailRegisteredDebugActionRunRegisteredFailed"));o(D),d({title:D,tone:"error"})}finally{m(null)}}async function V(){m("refresh"),o(null);try{await l.refreshRuntime(),d({title:s("shell.workspaceDetailDebugActionRefreshSuccess"),tone:"success"})}catch(a){const t=x(a,s("shell.workspaceDetailRegisteredDebugActionRefreshFailed"));o(t),d({title:t,tone:"error"})}finally{m(null)}}}function x(u,j){return u instanceof Error&&u.message.trim()?u.message:j}export{be as WorkspaceDebugDetailPage};
1
+ import{b as c,j as e,t as s}from"./index-oGylLBIX.js";import{j as $,u as q,b as R,f as z,k as H,r as _,a as L,D as J,h as T,d as y,e as A,l as K,m as Q,c as U,g as X,i as Y}from"./useRegisteredDebugTemplates-O-ymgLd9.js";import{u as Z,t as ee,s as se}from"./WorkbenchLayout-Dybarc1V.js";import{c as C}from"./model-switch-api-T55eW6D4.js";import{g as I,r as ae}from"./terminal-runtime-meta-Cvt1ID92.js";import{c as le,u as te,f as ne}from"./App-C2lNmeKL.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./WorkbenchModal-DMQutm1x.js";import"./relay-entry-sdeFnTbY.js";function be(){var S;const{workspaceId:u=""}=le(),j=te(),{showToast:d}=ne(),{navigationGroups:E,selectWorkspace:f}=Z(),r=((S=E.find(a=>a.workspace.id===u))==null?void 0:S.workspace)??null,[h,m]=c.useState(null),[N,o]=c.useState(null),[n,k]=c.useState(null),w=c.useRef(null);c.useEffect(()=>{u&&f(u)},[f,u]);const P=c.useMemo(()=>r?{id:r.id,path:r.path,name:r.name}:null,[r]),l=$(P),b=q(P),g=c.useMemo(()=>n??R(l.templates,l.runtimeStatuses),[n,l.runtimeStatuses,l.templates]),M=c.useMemo(()=>(n==null?void 0:n.items.some(a=>{var t;return(t=a.planItem)==null?void 0:t.missingRequirements.includes("service_discovery")}))??!1,[n]),O=c.useMemo(()=>new Map(l.runtimeStatuses.map(a=>[a.templateId,a])),[l.runtimeStatuses]);if(c.useEffect(()=>{!n||!w.current||typeof w.current.scrollIntoView=="function"&&w.current.scrollIntoView({behavior:"smooth",block:"start"})},[n]),!r)return e.jsx("main",{className:"workbench-page conversation-page-shell debug-readiness-page-shell",children:e.jsxs("div",{className:"workbench-empty-guide surface-card",children:[e.jsx("h1",{children:s("shell.workspaceDetailMissingTitle")}),e.jsx("p",{children:s("shell.workspaceDetailMissingBody")})]})});return e.jsx("main",{className:"workbench-page conversation-page-shell debug-readiness-page-shell",children:e.jsxs("div",{className:"debug-readiness-page",children:[e.jsxs("section",{className:"debug-readiness-hero surface-card",children:[e.jsx("div",{className:"debug-readiness-hero-header",children:e.jsxs("div",{className:"debug-readiness-hero-copy",children:[e.jsx("h2",{children:s("shell.workspaceDetailDebugPageTitle")}),e.jsx("p",{children:s("shell.workspaceDetailRegisteredDebugPageDescription")})]})}),e.jsxs("div",{className:"debug-readiness-hero-toolbar",children:[e.jsxs("div",{className:"workbench-modal-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>j(ee(r.id)),children:s("shell.goBack")}),e.jsx("button",{type:"button",className:"secondary-button",disabled:h!==null,onClick:()=>{B()},children:h==="sync"?s("shell.workspaceDetailRegisteredDebugActionSyncingTemplates"):s("shell.workspaceDetailRegisteredDebugActionSyncTemplates")}),e.jsx("button",{type:"button",className:"secondary-button",disabled:h!==null,onClick:()=>{F()},children:h==="plan"?s("shell.workspaceDetailDebugActionPlanning"):s("shell.workspaceDetailDebugActionPlan")}),e.jsx("button",{type:"button",className:"primary-button",disabled:h!==null,onClick:()=>{W()},children:h==="run"?s("shell.workspaceDetailRegisteredDebugActionRunningRegistered"):s("shell.workspaceDetailRegisteredDebugActionRunRegistered")}),e.jsx("button",{type:"button",className:"secondary-button",disabled:h!==null,onClick:()=>{V()},children:h==="refresh"?s("shell.workspaceDetailDebugActionRefreshing"):s("shell.workspaceDetailDebugActionRefresh")})]}),N?e.jsx("p",{className:"workbench-manage-status status-text","data-tone":"error",children:N}):null]}),e.jsxs("div",{className:"debug-readiness-summary-grid debug-readiness-summary-grid-hero",children:[e.jsxs("article",{className:"debug-readiness-summary-card","data-tone":_(g,l.templates.length),children:[e.jsx("span",{children:s("shell.workspaceDetailDebugOverallStatusLabel")}),e.jsx("strong",{children:z(g,l.templates.length)}),e.jsx("small",{children:H(g,l.templates.length)})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryRegisteredCountLabel")}),e.jsx("strong",{children:l.templates.length})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryConfiguredPortLabel")}),e.jsx("strong",{children:l.templates.filter(a=>a.port!==null).length}),e.jsx("small",{children:s("shell.workspaceDetailRegisteredDebugRuntimeScopeNote")})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryRunnableCountLabel")}),e.jsx("strong",{children:g.runnableCount})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryOrchestratedCountLabel")}),e.jsx("strong",{children:g.orchestratedCount})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryBlockedCountLabel")}),e.jsx("strong",{children:g.blockedCount})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryLastRefreshLabel")}),e.jsx("strong",{children:L(l.lastRefreshedAt)}),e.jsx("small",{children:r.path})]})]})]}),e.jsx(J,{workspace:{id:r.id,path:r.path,name:r.name},state:b,variant:"page"}),n?e.jsxs("section",{ref:w,className:"debug-readiness-section surface-card",children:[e.jsxs("div",{className:"debug-readiness-section-header",children:[e.jsxs("div",{children:[e.jsx("h3",{children:s("shell.workspaceDetailDebugLaunchPlanTitle")}),e.jsx("p",{children:s("shell.workspaceDetailRegisteredDebugLaunchPlanDescription")})]}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>k(null),children:s("shell.workspaceDetailDebugLaunchPlanDismissAction")})]}),e.jsxs("div",{className:"workbench-manage-kv-list",children:[e.jsxs("div",{className:"workbench-manage-kv-item",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugLaunchPlanGeneratedAtLabel")}),e.jsx("span",{children:L(n.generatedAt)})]}),e.jsxs("div",{className:"workbench-manage-kv-item",children:[e.jsx("span",{children:s("shell.workspaceDetailDebugLaunchPlanAutoStartLabel")}),e.jsx("span",{children:n.autoStartAllowed?s("shell.workspaceDetailDebugLaunchPlanAutoStartAllowed"):s("shell.workspaceDetailDebugLaunchPlanAutoStartBlocked")})]}),e.jsxs("div",{className:"workbench-manage-kv-item",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugLaunchPlanRunnableLabel")}),e.jsx("span",{children:n.runnableCount})]}),e.jsxs("div",{className:"workbench-manage-kv-item",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugLaunchPlanOrchestratedLabel")}),e.jsx("span",{children:n.orchestratedCount})]}),e.jsxs("div",{className:"workbench-manage-kv-item",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugLaunchPlanBlockedLabel")}),e.jsx("span",{children:n.blockedCount})]})]}),e.jsx("p",{className:"workbench-manage-hint",children:s("shell.workspaceDetailRegisteredDebugLaunchPlanNote")}),M?e.jsx("p",{className:"workbench-manage-hint",children:s("shell.workspaceDetailRegisteredDebugLaunchPlanServiceDiscoveryHelp")}):null,n.items.length>0?e.jsx("div",{className:"debug-readiness-runtime-list",children:n.items.map(a=>e.jsxs("article",{className:"debug-readiness-runtime-item",children:[e.jsxs("div",{className:"debug-readiness-runtime-item-header",children:[e.jsx("strong",{children:a.template.name}),e.jsx("span",{children:T(a.template)})]}),e.jsxs("div",{className:"debug-readiness-runtime-item-grid",children:[e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePathLabel")}),e.jsx("strong",{title:a.template.cwd,children:y(a.template.cwd,r.path)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePortLabel")}),e.jsx("strong",{children:A(a.assignedPort)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemRuntimeLabel")}),e.jsx("strong",{children:I(a.template.runtimeType)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemActionLabel")}),e.jsx("strong",{children:K(a.decision)})]})]}),e.jsxs("p",{className:"workbench-manage-hint",children:[s("shell.workspaceDetailRegisteredDebugPlanItemReasonLabel"),": ",a.reason]})]},a.template.id))}):e.jsx("p",{className:"workbench-section-empty",children:s("shell.workspaceDetailRegisteredDebugTemplatesEmpty")})]}):null,e.jsxs("section",{className:"debug-readiness-section surface-card",children:[e.jsxs("div",{className:"debug-readiness-section-header",children:[e.jsxs("div",{children:[e.jsx("h3",{children:s("shell.workspaceDetailRegisteredDebugTemplatesTitle")}),e.jsx("p",{children:s("shell.workspaceDetailRegisteredDebugTemplatesDescription")})]}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>j(se(r.id)),children:s("shell.workspaceDetailRegisteredDebugOpenProcessManagerAction")})]}),l.loading&&l.templates.length===0?e.jsx("p",{className:"workbench-section-empty",children:s("common.loading")}):null,l.error&&l.templates.length===0?e.jsx("p",{className:"workbench-manage-status status-text","data-tone":"error",children:l.error}):null,!l.loading&&l.templates.length===0?e.jsx("p",{className:"workbench-section-empty",children:s("shell.workspaceDetailRegisteredDebugTemplatesEmpty")}):null,l.templates.length>0?e.jsx("div",{className:"debug-readiness-service-grid",children:l.templates.map(a=>{const t=O.get(a.id)??null,p=Q(a,t);return e.jsxs("article",{className:"debug-readiness-service-card",children:[e.jsxs("div",{className:"debug-readiness-service-card-header",children:[e.jsxs("div",{children:[e.jsx("strong",{children:a.name}),e.jsx("p",{title:a.cwd,children:y(a.cwd,r.path)})]}),e.jsx("span",{className:"debug-readiness-chip","data-tone":p,children:U(a,t)})]}),e.jsxs("div",{className:"debug-readiness-service-card-grid",children:[e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePathLabel")}),e.jsx("strong",{title:a.cwd,children:y(a.cwd,r.path)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePortLabel")}),e.jsx("strong",{children:A(a.port)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplateRuntimeTypeLabel")}),e.jsx("strong",{children:I(a.runtimeType)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugRuntimeProcessLabel")}),e.jsx("strong",{children:X(t)})]})]}),e.jsxs("div",{className:"debug-readiness-service-card-list",children:[e.jsxs("p",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemCommandLabel")}),e.jsx("strong",{children:T(a)})]}),e.jsxs("p",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemReasonLabel")}),e.jsx("strong",{children:Y(a,t)})]})]})]},a.id)})}):null]})]})});async function B(){m("sync"),o(null);try{await l.refreshAll(),k(null),d({title:s("shell.workspaceDetailRegisteredDebugActionSyncTemplatesSuccess"),tone:"success"})}catch(a){const t=x(a,s("shell.workspaceDetailRegisteredDebugActionSyncTemplatesFailed"));o(t),d({title:t,tone:"error"})}finally{m(null)}}async function F(){m("plan"),o(null);try{if(!b.targetId)throw new Error(s("shell.workspaceDetailDebugActionTargetMissing"));const a=await C(b.targetId),t=R(l.templates,l.runtimeStatuses,a);k(t),d({title:s("shell.workspaceDetailDebugActionPlanSuccess"),tone:"info"})}catch(a){const t=x(a,s("shell.workspaceDetailDebugActionPlanFailed"));o(t),d({title:t,tone:"error"})}finally{m(null)}}async function W(){var a,t;m("run"),o(null);try{const p=n??(b.targetId?R(l.templates,l.runtimeStatuses,await C(b.targetId)):R(l.templates,l.runtimeStatuses));k(p);const D=p.items.filter(i=>i.decision!=="blocked");if(D.length===0){const i=s("shell.workspaceDetailRegisteredDebugActionRunRegisteredSkipped");o(i),d({title:i,tone:"info"});return}const v=[];for(const i of D)try{await ae(i.template.id,{runtimeType:i.template.runtimeType??void 0,argsOverride:(a=i.planItem)==null?void 0:a.args,envPatch:(t=i.planItem)==null?void 0:t.envPatch,portOverride:i.assignedPort})}catch(G){v.push(`${i.template.name}: ${x(G,s("shell.workspaceDetailRegisteredDebugActionRunRegisteredFailed"))}`)}if(await l.refreshRuntime(),v.length>0)throw new Error(v.join(";"));d({title:s("shell.workspaceDetailRegisteredDebugActionRunRegisteredSuccess"),tone:"success"})}catch(p){const D=x(p,s("shell.workspaceDetailRegisteredDebugActionRunRegisteredFailed"));o(D),d({title:D,tone:"error"})}finally{m(null)}}async function V(){m("refresh"),o(null);try{await l.refreshRuntime(),d({title:s("shell.workspaceDetailDebugActionRefreshSuccess"),tone:"success"})}catch(a){const t=x(a,s("shell.workspaceDetailRegisteredDebugActionRefreshFailed"));o(t),d({title:t,tone:"error"})}finally{m(null)}}}function x(u,j){return u instanceof Error&&u.message.trim()?u.message:j}export{be as WorkspaceDebugDetailPage};
@@ -1 +1 @@
1
- import{b as d,j as e,t as s}from"./index-C-0oeG_5.js";import{u as J,b as N,v as Q,x as U,y as Y,o as ee,t as se,z as ae,s as L,A as le,C as ie,c as oe,g as O}from"./WorkbenchLayout-pOZvEqp7.js";import{a as F,r as ne}from"./model-switch-api-Bh9nYslz.js";import{b as te,f as re,a as ce,c as de,d as me,e as he,g as ue,h as pe,i as be,u as je,j as ge,D as xe}from"./useRegisteredDebugTemplates-DWX7LXQu.js";import{g as ke}from"./terminal-runtime-meta-8_uRZf7h.js";import{f as fe,a as ve,M as we}from"./MobileWorkspaceSwitcherHeader-CfUnHgv_.js";import{M as Ne}from"./MobileCreateSessionSheet-DcxKM00P.js";import{c as Ce,u as ye,f as Re}from"./App-Dsf3ooXU.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./WorkbenchModal-ColqvV6a.js";import"./relay-entry-pmr-c42O.js";import"./MobileTopHeaderFrame-C5rIKQT6.js";function De({workspaceId:a,workspacePath:o,state:t,onOpenProcessManager:b}){const u=d.useMemo(()=>te(t.templates,t.runtimeStatuses),[t.runtimeStatuses,t.templates]),k=d.useMemo(()=>new Map(t.runtimeStatuses.map(c=>[c.templateId,c])),[t.runtimeStatuses]);return e.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:[e.jsxs("div",{className:"mobile-feature-section-header",children:[e.jsx("div",{children:e.jsx("h2",{children:s("shell.workspaceDetailRegisteredDebugTemplatesTitle")})}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>b(a),children:s("shell.workspaceDetailRegisteredDebugOpenProcessManagerAction")})]}),e.jsx("p",{className:"mobile-workspace-composition-note",children:s("shell.workspaceDetailRegisteredDebugTemplatesDescription")}),e.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailDebugOverallStatusLabel")}),e.jsx("strong",{children:re(u,t.templates.length)})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryRegisteredCountLabel")}),e.jsx("strong",{children:t.templates.length})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryRunnableCountLabel")}),e.jsx("strong",{children:u.runnableCount})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryOrchestratedCountLabel")}),e.jsx("strong",{children:u.orchestratedCount})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryBlockedCountLabel")}),e.jsx("strong",{children:u.blockedCount})]}),e.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryLastRefreshLabel")}),e.jsx("strong",{children:ce(t.lastRefreshedAt)})]})]}),t.loading&&t.templates.length===0?e.jsx("p",{children:s("common.loading")}):null,t.error&&t.templates.length===0?e.jsx("p",{className:"status-text","data-tone":"error",children:t.error}):null,!t.loading&&t.templates.length===0?e.jsx("p",{children:s("shell.workspaceDetailRegisteredDebugTemplatesEmpty")}):null,t.templates.length>0?e.jsx("div",{className:"mobile-feature-stack",children:t.templates.map(c=>{const m=k.get(c.id)??null;return e.jsxs("article",{className:"surface-card mobile-session-row",children:[e.jsxs("div",{className:"mobile-session-row-primary mobile-session-row-primary-static",children:[e.jsx("span",{className:"mobile-session-row-title",children:c.name}),e.jsx("span",{className:"mobile-session-row-provider",children:de(c,m)})]}),e.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePathLabel")}),e.jsx("strong",{title:c.cwd,children:me(c.cwd,o)})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePortLabel")}),e.jsx("strong",{children:he(c.port)})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplateRuntimeTypeLabel")}),e.jsx("strong",{children:ke(c.runtimeType)})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugRuntimeProcessLabel")}),e.jsx("strong",{children:ue(m)})]}),e.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemCommandLabel")}),e.jsx("strong",{children:pe(c)})]}),e.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemReasonLabel")}),e.jsx("strong",{children:be(c,m)})]})]})]},c.id)})}):null]})}function We(a){return a.isArchived!==!0&&!O(a)}function Me(a){return a.isArchived===!0&&!O(a)}const C=60*1e3,y=10;function ze(){var E;const{workspaceId:a=""}=Ce(),o=ye(),{showToast:t}=Re(),{navigationGroups:b,currentWorkspaceId:u,favoriteSessionIds:k,workspaceManagementStateById:c,selectWorkspace:m,subscribeGitSnapshot:R,requestGitRefresh:D,subscribeWorkspaceManagementSnapshot:W,requestWorkspaceManagementRefresh:M,toggleFavoriteSession:_,archiveSession:G,unarchiveSession:V,startDraftSession:H}=J(),[S,T]=d.useState(!1),[Z,f]=d.useState(!1),[A,P]=d.useState(y),v=fe(b),h=ve(b,a),i=(h==null?void 0:h.workspace)??null,p=v.find(l=>l.workspace.id===(i==null?void 0:i.id))??(i?{workspace:i,label:i.name,subtitle:i.path}:null),w=d.useMemo(()=>[...(h==null?void 0:h.sessions)??[]].filter(We),[h]),g=d.useMemo(()=>[...(h==null?void 0:h.sessions)??[]].filter(Me),[h]);d.useEffect(()=>{a&&m(a)},[m,a]),d.useEffect(()=>{if(!a)return;const l=N(Ae(a),C),r=N(B(a),C);R(a,{knownRevision:(l==null?void 0:l.revision)??null}),W(a,{knownRevision:(r==null?void 0:r.revision)??null}),l||D(a),r||M(a)},[D,M,R,W,a]),d.useEffect(()=>{P(y)},[a]);const n=d.useMemo(()=>{if(!a)return{loading:!1,error:null,hasMeaningfulSummary:!1,summary:null};const l=N(B(a),C),r=c[a]??null,j=(r==null?void 0:r.detail)??(i?Pe(i,l):l??null);return{loading:(r==null?void 0:r.loading)??!1,error:(r==null?void 0:r.error)??null,hasMeaningfulSummary:Ie(j),summary:j}},[i,a,c]),x=d.useMemo(()=>n.summary?Q(n.summary.codeComposition.items,s("shell.manageWorkspaceCodeCompositionOther")):[],[n.summary]),K=d.useMemo(()=>x.length>0?U(x):void 0,[x]),I=d.useMemo(()=>g.slice(0,A),[g,A]),q=je(i?{id:i.id,path:i.path,name:i.name}:null),$=ge(i?{id:i.id,path:i.path,name:i.name}:null);async function z(){if(!(!i||!(typeof window>"u"||window.confirm(s("shell.manageWorkspaceRemoveConfirmTarget",{name:i.name}))))){T(!0);try{await ne(i.id),t({title:s("shell.manageWorkspaceRemoveSuccess"),tone:"success"}),o("/workspaces",{replace:!0})}catch(r){t({title:r instanceof Error?r.message:s("shell.manageWorkspaceRemoveFailed"),tone:"error"})}finally{T(!1)}}}function X(l,r){f(!1),H(l,r)}return i?e.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-detail-page",children:[e.jsx(we,{currentWorkspace:p?{id:p.workspace.id,name:p.label,path:p.subtitle}:null,workspaces:b.map(l=>l.workspace),workspaceOptions:v,heading:s("shell.workspaceDetailTitle"),triggerLabel:(p==null?void 0:p.label)??i.name,onSelectWorkspace:l=>{m(l),o(se(l))},content:e.jsxs("div",{className:"mobile-workspace-detail-header-actions",children:[e.jsx("button",{type:"button",className:"primary-button",onClick:()=>f(!0),children:s("shell.createSession")}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{m(i.id),o(Y(i.id))},children:s("shell.filesEntry")}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{m(i.id),o(ee(i.id))},children:s("shell.terminalsEntry")})]})}),e.jsxs("div",{className:"mobile-page-top-body mobile-workspace-detail-body",children:[e.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-detail-summary-panel",children:[e.jsxs("div",{className:"mobile-feature-section-header",children:[e.jsx("div",{children:e.jsx("h2",{children:s("shell.workspaceDetailSummaryTitle")})}),u!==i.id?e.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-switch-button",onClick:()=>m(i.id),children:s("shell.switchWorkspace")}):null]}),n.loading&&n.summary===null?e.jsx("p",{children:s("common.loading")}):null,n.error?e.jsx("p",{className:"status-text","data-tone":"error",children:n.error}):null,n.summary?e.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[e.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[e.jsx("span",{children:s("shell.manageWorkspacePathLabel")}),e.jsx("strong",{title:n.summary.path,children:n.summary.path})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.manageWorkspaceCurrentBranch")}),e.jsx("strong",{title:n.summary.git.currentBranch??s("common.unknown"),children:n.summary.git.currentBranch??s("common.unknown")})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.manageWorkspaceGitCommitCount")}),e.jsx("strong",{children:n.hasMeaningfulSummary?n.summary.git.commitCount??0:"—"})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.manageWorkspaceCodeCompositionFiles")}),e.jsx("strong",{children:n.hasMeaningfulSummary?n.summary.codeComposition.scannedFileCount:"—"})]})]}):null,e.jsxs("div",{className:"mobile-feature-inline-actions mobile-workspace-detail-summary-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{m(i.id),o(ae(i.id))},children:s("shell.gitEntry")}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{m(i.id),o(L(i.id))},children:s("shell.terminalManagerEntry")}),e.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:S,onClick:()=>{z()},children:S?s("shell.manageWorkspaceRemoving"):s("shell.manageWorkspaceRemoveAction")})]})]}),e.jsx(xe,{workspace:i?{id:i.id,path:i.path,name:i.name}:null,state:q,variant:"mobile"}),i?e.jsx(De,{workspaceId:i.id,workspacePath:i.path,state:$,onOpenProcessManager:l=>{m(l),o(L(l))}}):null,e.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:[e.jsxs("div",{className:"mobile-feature-section-header",children:[e.jsx("div",{children:e.jsx("h2",{children:s("shell.manageWorkspaceCodeCompositionLabel")})}),n.summary?e.jsx("span",{className:"mobile-feature-counter",children:n.summary.codeComposition.scannedFileCount}):null]}),n.loading&&n.summary===null?e.jsx("p",{children:s("common.loading")}):null,n.summary?x.length>0?e.jsxs("div",{className:"workbench-manage-type-chart",children:[e.jsxs("div",{className:"workbench-manage-type-chart-ring",style:K,"aria-hidden":"true",children:[e.jsx("strong",{className:"workbench-manage-type-chart-total",children:n.summary.codeComposition.scannedFileCount}),e.jsx("span",{className:"workbench-manage-type-chart-caption",children:s("shell.manageWorkspaceCodeCompositionFiles")})]}),e.jsx("div",{className:"workbench-manage-type-list",children:x.map(l=>e.jsxs("div",{className:"workbench-manage-type-item",children:[e.jsxs("span",{className:"workbench-manage-type-meta",children:[e.jsx("span",{className:"workbench-manage-type-swatch",style:{backgroundColor:l.color},"aria-hidden":"true"}),e.jsx("span",{className:"workbench-manage-type-name",children:l.type})]}),e.jsxs("span",{children:[l.count," · ",le(l)]})]},l.key))})]}):e.jsx("p",{children:n.summary.codeComposition.error??s("shell.manageWorkspaceNoCodeComposition")}):null,(E=n.summary)!=null&&E.codeComposition.truncated?e.jsx("p",{className:"mobile-workspace-composition-note",children:s("shell.manageWorkspaceCodeTruncated",{count:n.summary.codeComposition.scannedFileCount})}):null]}),e.jsxs("section",{className:"mobile-feature-section",children:[e.jsxs("div",{className:"mobile-feature-section-header",children:[e.jsx("div",{children:e.jsx("h2",{children:s("shell.recentSessionsSectionTitle")})}),e.jsx("span",{className:"mobile-feature-counter",children:w.length})]}),e.jsx("div",{className:"mobile-feature-stack",children:w.length===0?e.jsx("article",{className:"mobile-feature-empty surface-card",children:e.jsx("p",{children:s("shell.emptyWorkspaceSessions")})}):w.map(l=>{const r=ie(l.title,s("common.unknown")),j=k.includes(l.sessionId);return e.jsxs("article",{className:"mobile-session-row surface-card",children:[e.jsxs("button",{type:"button",className:"mobile-session-row-primary",onClick:()=>o(oe(i.id,l.sessionId)),children:[e.jsx("span",{className:"mobile-session-row-title",title:r.fullTitle,children:r.displayTitle}),e.jsx("span",{className:"mobile-session-row-provider",children:F(l.provider)})]}),e.jsxs("div",{className:"mobile-session-row-actions",children:[e.jsx("span",{className:"mobile-feature-badge mobile-session-row-count",children:l.messageCount}),e.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":j?s("shell.unfavoriteAction"):s("shell.favoriteAction"),title:j?s("shell.unfavoriteAction"):s("shell.favoriteAction"),onClick:()=>{_(l.sessionId)},children:e.jsx(Se,{active:j})}),e.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":s("shell.archiveAction"),title:s("shell.archiveAction"),onClick:()=>{G(l.sessionId)},children:e.jsx(Te,{})})]})]},l.sessionId)})})]}),g.length>0?e.jsxs("section",{className:"mobile-feature-section",children:[e.jsxs("div",{className:"mobile-feature-section-header",children:[e.jsx("div",{children:e.jsx("h2",{children:s("shell.archiveModalTitle")})}),e.jsx("span",{className:"mobile-feature-counter",children:g.length})]}),e.jsx("div",{className:"mobile-feature-stack",children:I.map(l=>e.jsxs("article",{className:"mobile-session-row surface-card",children:[e.jsxs("div",{className:"mobile-session-row-primary mobile-session-row-primary-static",children:[e.jsx("span",{className:"mobile-session-row-title",title:l.title,children:l.title}),e.jsx("span",{className:"mobile-session-row-provider",children:F(l.provider)})]}),e.jsx("div",{className:"mobile-session-row-actions",children:e.jsx("button",{type:"button",className:"secondary-button mobile-session-row-restore",onClick:()=>{V(l.sessionId)},children:s("shell.unarchiveAction")})})]},l.sessionId))}),I.length<g.length?e.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-expand-button",onClick:()=>{P(l=>l+y)},children:s("shell.archiveExpandMore")}):null]}):null]}),e.jsx(Ne,{open:Z,workspaces:b.map(l=>l.workspace),workspaceOptions:v,initialWorkspaceId:u??i.id,onClose:()=>f(!1),onSelect:X})]}):e.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:e.jsxs("article",{className:"mobile-feature-empty surface-card",children:[e.jsx("h1",{children:s("shell.workspaceDetailMissingTitle")}),e.jsx("p",{children:s("shell.workspaceDetailMissingBody")}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>o("/workspaces"),children:s("shell.mobileWorkspacesEntry")})]})})}function Se({active:a}){return e.jsx("svg",{viewBox:"0 0 24 24",fill:a?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.8",children:e.jsx("path",{d:"m12 3.6 2.6 5.2 5.7.8-4.1 4 1 5.7L12 16.5 6.8 19.3l1-5.7-4.1-4 5.7-.8Z"})})}function Te(){return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[e.jsx("path",{d:"M4 7.5h16"}),e.jsx("path",{d:"M6.4 7.5h11.2l-.9 10.2a2 2 0 0 1-2 1.8H9.3a2 2 0 0 1-2-1.8Z"}),e.jsx("path",{d:"M8 4.5h8a1.5 1.5 0 0 1 1.5 1.5v1.5h-11V6A1.5 1.5 0 0 1 8 4.5Z"}),e.jsx("path",{d:"M10 11.5h4"})]})}function B(a){return`workspace-management.summary.${a}`}function Ae(a){return`git-sidebar.snapshot.${a}`}function Pe(a,o){const t=(o==null?void 0:o.git.repoRoot)??a.repoRoot??null;return{workspaceId:a.id,name:a.name,path:a.path,git:{isRepository:(o==null?void 0:o.git.isRepository)??!!t,repoRoot:t,currentBranch:(o==null?void 0:o.git.currentBranch)??null,commitCount:(o==null?void 0:o.git.commitCount)??null,remotes:(o==null?void 0:o.git.remotes)??[],error:(o==null?void 0:o.git.error)??null},codeComposition:(o==null?void 0:o.codeComposition)??{scannedFileCount:0,truncated:!1,items:[],error:null}}}function Ie(a){return a?a.git.isRepository||a.git.repoRoot!==null||a.git.currentBranch!==null||a.git.commitCount!==null||a.git.remotes.length>0||a.codeComposition.scannedFileCount>0||a.codeComposition.items.length>0||a.codeComposition.error!==null:!1}export{ze as WorkspaceDetailPage};
1
+ import{b as d,j as e,t as s}from"./index-oGylLBIX.js";import{u as J,b as N,v as Q,x as U,y as Y,o as ee,t as se,z as ae,s as L,A as le,C as ie,c as oe,g as O}from"./WorkbenchLayout-Dybarc1V.js";import{a as F,r as ne}from"./model-switch-api-T55eW6D4.js";import{b as te,f as re,a as ce,c as de,d as me,e as he,g as ue,h as pe,i as be,u as je,j as ge,D as xe}from"./useRegisteredDebugTemplates-O-ymgLd9.js";import{g as ke}from"./terminal-runtime-meta-Cvt1ID92.js";import{f as fe,a as ve,M as we}from"./MobileWorkspaceSwitcherHeader-Cczi7RYu.js";import{M as Ne}from"./MobileCreateSessionSheet-THIrIzJ3.js";import{c as Ce,u as ye,f as Re}from"./App-C2lNmeKL.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./WorkbenchModal-DMQutm1x.js";import"./relay-entry-sdeFnTbY.js";import"./MobileTopHeaderFrame-D-X7pVnV.js";function De({workspaceId:a,workspacePath:o,state:t,onOpenProcessManager:b}){const u=d.useMemo(()=>te(t.templates,t.runtimeStatuses),[t.runtimeStatuses,t.templates]),k=d.useMemo(()=>new Map(t.runtimeStatuses.map(c=>[c.templateId,c])),[t.runtimeStatuses]);return e.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:[e.jsxs("div",{className:"mobile-feature-section-header",children:[e.jsx("div",{children:e.jsx("h2",{children:s("shell.workspaceDetailRegisteredDebugTemplatesTitle")})}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>b(a),children:s("shell.workspaceDetailRegisteredDebugOpenProcessManagerAction")})]}),e.jsx("p",{className:"mobile-workspace-composition-note",children:s("shell.workspaceDetailRegisteredDebugTemplatesDescription")}),e.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailDebugOverallStatusLabel")}),e.jsx("strong",{children:re(u,t.templates.length)})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryRegisteredCountLabel")}),e.jsx("strong",{children:t.templates.length})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryRunnableCountLabel")}),e.jsx("strong",{children:u.runnableCount})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryOrchestratedCountLabel")}),e.jsx("strong",{children:u.orchestratedCount})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryBlockedCountLabel")}),e.jsx("strong",{children:u.blockedCount})]}),e.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryLastRefreshLabel")}),e.jsx("strong",{children:ce(t.lastRefreshedAt)})]})]}),t.loading&&t.templates.length===0?e.jsx("p",{children:s("common.loading")}):null,t.error&&t.templates.length===0?e.jsx("p",{className:"status-text","data-tone":"error",children:t.error}):null,!t.loading&&t.templates.length===0?e.jsx("p",{children:s("shell.workspaceDetailRegisteredDebugTemplatesEmpty")}):null,t.templates.length>0?e.jsx("div",{className:"mobile-feature-stack",children:t.templates.map(c=>{const m=k.get(c.id)??null;return e.jsxs("article",{className:"surface-card mobile-session-row",children:[e.jsxs("div",{className:"mobile-session-row-primary mobile-session-row-primary-static",children:[e.jsx("span",{className:"mobile-session-row-title",children:c.name}),e.jsx("span",{className:"mobile-session-row-provider",children:de(c,m)})]}),e.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePathLabel")}),e.jsx("strong",{title:c.cwd,children:me(c.cwd,o)})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePortLabel")}),e.jsx("strong",{children:he(c.port)})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplateRuntimeTypeLabel")}),e.jsx("strong",{children:ke(c.runtimeType)})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugRuntimeProcessLabel")}),e.jsx("strong",{children:ue(m)})]}),e.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemCommandLabel")}),e.jsx("strong",{children:pe(c)})]}),e.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemReasonLabel")}),e.jsx("strong",{children:be(c,m)})]})]})]},c.id)})}):null]})}function We(a){return a.isArchived!==!0&&!O(a)}function Me(a){return a.isArchived===!0&&!O(a)}const C=60*1e3,y=10;function ze(){var E;const{workspaceId:a=""}=Ce(),o=ye(),{showToast:t}=Re(),{navigationGroups:b,currentWorkspaceId:u,favoriteSessionIds:k,workspaceManagementStateById:c,selectWorkspace:m,subscribeGitSnapshot:R,requestGitRefresh:D,subscribeWorkspaceManagementSnapshot:W,requestWorkspaceManagementRefresh:M,toggleFavoriteSession:_,archiveSession:G,unarchiveSession:V,startDraftSession:H}=J(),[S,T]=d.useState(!1),[Z,f]=d.useState(!1),[A,P]=d.useState(y),v=fe(b),h=ve(b,a),i=(h==null?void 0:h.workspace)??null,p=v.find(l=>l.workspace.id===(i==null?void 0:i.id))??(i?{workspace:i,label:i.name,subtitle:i.path}:null),w=d.useMemo(()=>[...(h==null?void 0:h.sessions)??[]].filter(We),[h]),g=d.useMemo(()=>[...(h==null?void 0:h.sessions)??[]].filter(Me),[h]);d.useEffect(()=>{a&&m(a)},[m,a]),d.useEffect(()=>{if(!a)return;const l=N(Ae(a),C),r=N(B(a),C);R(a,{knownRevision:(l==null?void 0:l.revision)??null}),W(a,{knownRevision:(r==null?void 0:r.revision)??null}),l||D(a),r||M(a)},[D,M,R,W,a]),d.useEffect(()=>{P(y)},[a]);const n=d.useMemo(()=>{if(!a)return{loading:!1,error:null,hasMeaningfulSummary:!1,summary:null};const l=N(B(a),C),r=c[a]??null,j=(r==null?void 0:r.detail)??(i?Pe(i,l):l??null);return{loading:(r==null?void 0:r.loading)??!1,error:(r==null?void 0:r.error)??null,hasMeaningfulSummary:Ie(j),summary:j}},[i,a,c]),x=d.useMemo(()=>n.summary?Q(n.summary.codeComposition.items,s("shell.manageWorkspaceCodeCompositionOther")):[],[n.summary]),K=d.useMemo(()=>x.length>0?U(x):void 0,[x]),I=d.useMemo(()=>g.slice(0,A),[g,A]),q=je(i?{id:i.id,path:i.path,name:i.name}:null),$=ge(i?{id:i.id,path:i.path,name:i.name}:null);async function z(){if(!(!i||!(typeof window>"u"||window.confirm(s("shell.manageWorkspaceRemoveConfirmTarget",{name:i.name}))))){T(!0);try{await ne(i.id),t({title:s("shell.manageWorkspaceRemoveSuccess"),tone:"success"}),o("/workspaces",{replace:!0})}catch(r){t({title:r instanceof Error?r.message:s("shell.manageWorkspaceRemoveFailed"),tone:"error"})}finally{T(!1)}}}function X(l,r){f(!1),H(l,r)}return i?e.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-detail-page",children:[e.jsx(we,{currentWorkspace:p?{id:p.workspace.id,name:p.label,path:p.subtitle}:null,workspaces:b.map(l=>l.workspace),workspaceOptions:v,heading:s("shell.workspaceDetailTitle"),triggerLabel:(p==null?void 0:p.label)??i.name,onSelectWorkspace:l=>{m(l),o(se(l))},content:e.jsxs("div",{className:"mobile-workspace-detail-header-actions",children:[e.jsx("button",{type:"button",className:"primary-button",onClick:()=>f(!0),children:s("shell.createSession")}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{m(i.id),o(Y(i.id))},children:s("shell.filesEntry")}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{m(i.id),o(ee(i.id))},children:s("shell.terminalsEntry")})]})}),e.jsxs("div",{className:"mobile-page-top-body mobile-workspace-detail-body",children:[e.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-detail-summary-panel",children:[e.jsxs("div",{className:"mobile-feature-section-header",children:[e.jsx("div",{children:e.jsx("h2",{children:s("shell.workspaceDetailSummaryTitle")})}),u!==i.id?e.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-switch-button",onClick:()=>m(i.id),children:s("shell.switchWorkspace")}):null]}),n.loading&&n.summary===null?e.jsx("p",{children:s("common.loading")}):null,n.error?e.jsx("p",{className:"status-text","data-tone":"error",children:n.error}):null,n.summary?e.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[e.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[e.jsx("span",{children:s("shell.manageWorkspacePathLabel")}),e.jsx("strong",{title:n.summary.path,children:n.summary.path})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.manageWorkspaceCurrentBranch")}),e.jsx("strong",{title:n.summary.git.currentBranch??s("common.unknown"),children:n.summary.git.currentBranch??s("common.unknown")})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.manageWorkspaceGitCommitCount")}),e.jsx("strong",{children:n.hasMeaningfulSummary?n.summary.git.commitCount??0:"—"})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.manageWorkspaceCodeCompositionFiles")}),e.jsx("strong",{children:n.hasMeaningfulSummary?n.summary.codeComposition.scannedFileCount:"—"})]})]}):null,e.jsxs("div",{className:"mobile-feature-inline-actions mobile-workspace-detail-summary-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{m(i.id),o(ae(i.id))},children:s("shell.gitEntry")}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{m(i.id),o(L(i.id))},children:s("shell.terminalManagerEntry")}),e.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:S,onClick:()=>{z()},children:S?s("shell.manageWorkspaceRemoving"):s("shell.manageWorkspaceRemoveAction")})]})]}),e.jsx(xe,{workspace:i?{id:i.id,path:i.path,name:i.name}:null,state:q,variant:"mobile"}),i?e.jsx(De,{workspaceId:i.id,workspacePath:i.path,state:$,onOpenProcessManager:l=>{m(l),o(L(l))}}):null,e.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:[e.jsxs("div",{className:"mobile-feature-section-header",children:[e.jsx("div",{children:e.jsx("h2",{children:s("shell.manageWorkspaceCodeCompositionLabel")})}),n.summary?e.jsx("span",{className:"mobile-feature-counter",children:n.summary.codeComposition.scannedFileCount}):null]}),n.loading&&n.summary===null?e.jsx("p",{children:s("common.loading")}):null,n.summary?x.length>0?e.jsxs("div",{className:"workbench-manage-type-chart",children:[e.jsxs("div",{className:"workbench-manage-type-chart-ring",style:K,"aria-hidden":"true",children:[e.jsx("strong",{className:"workbench-manage-type-chart-total",children:n.summary.codeComposition.scannedFileCount}),e.jsx("span",{className:"workbench-manage-type-chart-caption",children:s("shell.manageWorkspaceCodeCompositionFiles")})]}),e.jsx("div",{className:"workbench-manage-type-list",children:x.map(l=>e.jsxs("div",{className:"workbench-manage-type-item",children:[e.jsxs("span",{className:"workbench-manage-type-meta",children:[e.jsx("span",{className:"workbench-manage-type-swatch",style:{backgroundColor:l.color},"aria-hidden":"true"}),e.jsx("span",{className:"workbench-manage-type-name",children:l.type})]}),e.jsxs("span",{children:[l.count," · ",le(l)]})]},l.key))})]}):e.jsx("p",{children:n.summary.codeComposition.error??s("shell.manageWorkspaceNoCodeComposition")}):null,(E=n.summary)!=null&&E.codeComposition.truncated?e.jsx("p",{className:"mobile-workspace-composition-note",children:s("shell.manageWorkspaceCodeTruncated",{count:n.summary.codeComposition.scannedFileCount})}):null]}),e.jsxs("section",{className:"mobile-feature-section",children:[e.jsxs("div",{className:"mobile-feature-section-header",children:[e.jsx("div",{children:e.jsx("h2",{children:s("shell.recentSessionsSectionTitle")})}),e.jsx("span",{className:"mobile-feature-counter",children:w.length})]}),e.jsx("div",{className:"mobile-feature-stack",children:w.length===0?e.jsx("article",{className:"mobile-feature-empty surface-card",children:e.jsx("p",{children:s("shell.emptyWorkspaceSessions")})}):w.map(l=>{const r=ie(l.title,s("common.unknown")),j=k.includes(l.sessionId);return e.jsxs("article",{className:"mobile-session-row surface-card",children:[e.jsxs("button",{type:"button",className:"mobile-session-row-primary",onClick:()=>o(oe(i.id,l.sessionId)),children:[e.jsx("span",{className:"mobile-session-row-title",title:r.fullTitle,children:r.displayTitle}),e.jsx("span",{className:"mobile-session-row-provider",children:F(l.provider)})]}),e.jsxs("div",{className:"mobile-session-row-actions",children:[e.jsx("span",{className:"mobile-feature-badge mobile-session-row-count",children:l.messageCount}),e.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":j?s("shell.unfavoriteAction"):s("shell.favoriteAction"),title:j?s("shell.unfavoriteAction"):s("shell.favoriteAction"),onClick:()=>{_(l.sessionId)},children:e.jsx(Se,{active:j})}),e.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":s("shell.archiveAction"),title:s("shell.archiveAction"),onClick:()=>{G(l.sessionId)},children:e.jsx(Te,{})})]})]},l.sessionId)})})]}),g.length>0?e.jsxs("section",{className:"mobile-feature-section",children:[e.jsxs("div",{className:"mobile-feature-section-header",children:[e.jsx("div",{children:e.jsx("h2",{children:s("shell.archiveModalTitle")})}),e.jsx("span",{className:"mobile-feature-counter",children:g.length})]}),e.jsx("div",{className:"mobile-feature-stack",children:I.map(l=>e.jsxs("article",{className:"mobile-session-row surface-card",children:[e.jsxs("div",{className:"mobile-session-row-primary mobile-session-row-primary-static",children:[e.jsx("span",{className:"mobile-session-row-title",title:l.title,children:l.title}),e.jsx("span",{className:"mobile-session-row-provider",children:F(l.provider)})]}),e.jsx("div",{className:"mobile-session-row-actions",children:e.jsx("button",{type:"button",className:"secondary-button mobile-session-row-restore",onClick:()=>{V(l.sessionId)},children:s("shell.unarchiveAction")})})]},l.sessionId))}),I.length<g.length?e.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-expand-button",onClick:()=>{P(l=>l+y)},children:s("shell.archiveExpandMore")}):null]}):null]}),e.jsx(Ne,{open:Z,workspaces:b.map(l=>l.workspace),workspaceOptions:v,initialWorkspaceId:u??i.id,onClose:()=>f(!1),onSelect:X})]}):e.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:e.jsxs("article",{className:"mobile-feature-empty surface-card",children:[e.jsx("h1",{children:s("shell.workspaceDetailMissingTitle")}),e.jsx("p",{children:s("shell.workspaceDetailMissingBody")}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>o("/workspaces"),children:s("shell.mobileWorkspacesEntry")})]})})}function Se({active:a}){return e.jsx("svg",{viewBox:"0 0 24 24",fill:a?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.8",children:e.jsx("path",{d:"m12 3.6 2.6 5.2 5.7.8-4.1 4 1 5.7L12 16.5 6.8 19.3l1-5.7-4.1-4 5.7-.8Z"})})}function Te(){return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[e.jsx("path",{d:"M4 7.5h16"}),e.jsx("path",{d:"M6.4 7.5h11.2l-.9 10.2a2 2 0 0 1-2 1.8H9.3a2 2 0 0 1-2-1.8Z"}),e.jsx("path",{d:"M8 4.5h8a1.5 1.5 0 0 1 1.5 1.5v1.5h-11V6A1.5 1.5 0 0 1 8 4.5Z"}),e.jsx("path",{d:"M10 11.5h4"})]})}function B(a){return`workspace-management.summary.${a}`}function Ae(a){return`git-sidebar.snapshot.${a}`}function Pe(a,o){const t=(o==null?void 0:o.git.repoRoot)??a.repoRoot??null;return{workspaceId:a.id,name:a.name,path:a.path,git:{isRepository:(o==null?void 0:o.git.isRepository)??!!t,repoRoot:t,currentBranch:(o==null?void 0:o.git.currentBranch)??null,commitCount:(o==null?void 0:o.git.commitCount)??null,remotes:(o==null?void 0:o.git.remotes)??[],error:(o==null?void 0:o.git.error)??null},codeComposition:(o==null?void 0:o.codeComposition)??{scannedFileCount:0,truncated:!1,items:[],error:null}}}function Ie(a){return a?a.git.isRepository||a.git.repoRoot!==null||a.git.currentBranch!==null||a.git.commitCount!==null||a.git.remotes.length>0||a.codeComposition.scannedFileCount>0||a.codeComposition.items.length>0||a.codeComposition.error!==null:!1}export{ze as WorkspaceDetailPage};
@@ -1 +1 @@
1
- import{b as r,j as e,t}from"./index-C-0oeG_5.js";import{u as Be,i as re,b as y,w as ie,B as oe,c as ne,d as Fe,e as Oe,f as qe,g as Ue,h as De,j as Ve,l as Ke,k as Ge,n as We,o as Qe,p as Xe,q as $e,s as ze,t as H}from"./WorkbenchLayout-pOZvEqp7.js";import{s as Je}from"./butler-records-events-DgWCG364.js";import{a as se}from"./model-switch-api-Bh9nYslz.js";import{f as Ye,a as te,M as Ze}from"./MobileWorkspaceSwitcherHeader-CfUnHgv_.js";import{u as ei,f as ii}from"./App-Dsf3ooXU.js";import{M as oi}from"./MobileCreateSessionSheet-DcxKM00P.js";import{W as ni}from"./WorkbenchModal-ColqvV6a.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./relay-entry-pmr-c42O.js";import"./MobileTopHeaderFrame-C5rIKQT6.js";function si(n){return n.status==="active"}function ti(n){return n.status==="queued"||n.status==="running"}function ai(n,m){return n.filter(si).length+m.filter(ti).length}function li(n){const m=r.useMemo(()=>n.notifications.filter(a=>n.showArchivedNotifications||!n.archivedNotificationIds.has(a.id)),[n.archivedNotificationIds,n.notifications,n.showArchivedNotifications]);return e.jsx(ni,{open:n.open,title:t("shell.globalNotificationsPanelTitle"),description:t("shell.globalNotificationsPanelDescription"),className:"workbench-notification-modal-card mobile-notification-modal-card",onClose:n.onClose,children:e.jsxs("div",{className:"workbench-notification-pane mobile-notification-pane",role:"tabpanel","aria-label":t("shell.globalNotificationsAction"),children:[e.jsx("div",{className:"workbench-notification-toolbar",children:e.jsxs("label",{className:"workbench-notification-filter",children:[e.jsx("input",{type:"checkbox",checked:n.showArchivedNotifications,onChange:a=>n.onToggleShowArchivedNotifications(a.target.checked)}),e.jsx("span",{children:t("shell.globalNotificationsShowArchived")})]})}),m.length>0?e.jsx("div",{className:"workbench-notification-list",children:m.map(a=>{const u=n.archivedNotificationIds.has(a.id);return e.jsxs("article",{className:"workbench-notification-item","data-archived":u,children:[e.jsxs("button",{type:"button",className:"workbench-notification-item-content",onClick:()=>{n.onSelectNotification(a)},children:[e.jsx("span",{className:"workbench-notification-item-kind",children:ci(a.kind)}),e.jsx("strong",{children:a.title}),e.jsx("p",{children:a.body})]}),e.jsxs("div",{className:"workbench-notification-item-side",children:[e.jsx("time",{children:ri(a.createdAt)}),e.jsx("button",{type:"button",className:"secondary-button workbench-notification-item-action-button",onClick:()=>{if(u){n.onUnarchiveNotification(a.id);return}n.onArchiveNotification(a.id)},children:u?t("shell.globalNotificationsRemoveArchiveAction"):t("shell.globalNotificationsArchiveAction")})]})]},a.id)})}):e.jsx("p",{className:"workbench-notification-empty",children:t("shell.globalNotificationsEmpty")})]})})}function ci(n){switch(n){case"follow_up_waiting_user":return t("shell.globalNotificationKindWaitingUser");case"follow_up_completed":return t("shell.globalNotificationKindFollowUpCompleted");case"follow_up_failed":return t("shell.globalNotificationKindFollowUpFailed");case"verification_failed":return t("shell.globalNotificationKindVerificationFailed");default:return t("shell.globalNotificationsPanelTitle")}}function ri(n){const m=new Date(n);return Number.isNaN(m.getTime())?n:new Intl.DateTimeFormat(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(m)}function di(n){return n.isArchived!==!0&&!Ue(n)}function mi(n){return n.activityState==="idle"&&re(n)===!1}function ae(n){return n==="creating"||n==="running"}function le(n){return n.lastEventAt??n.lastMessageAt??n.updatedAt??n.createdAt}function ce(n){return n?new Date(n).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):t("common.unknown")}function x(n){return n!==null&&n>0}const A=60*1e3,ui=15e3;function Si(){var ee;const n=ei(),{showToast:m}=ii(),a=Be(),{navigationGroups:u,currentWorkspaceId:O,refreshNavigation:q,selectWorkspace:p,startDraftSession:de,subscribeGitSnapshot:U,requestGitRefresh:D,addGitSnapshotListener:V,subscribeTerminalManagerSnapshot:K,requestTerminalManagerRefresh:G,addTerminalManagerSnapshotListener:W}=a,me=a.globalNotifications??[],ue=new Set(a.archivedNotificationIds??[]),he=a.showArchivedNotifications??!1,Q=a.unreadNotificationCount??0,pe=a.setShowArchivedNotifications??(()=>{}),be=a.archiveNotification??(()=>{}),fe=a.unarchiveNotification??(()=>{}),[X,b]=r.useState(null),[we,R]=r.useState(!1),[ke,$]=r.useState(!1),[ge,M]=r.useState(!1),[d,g]=r.useState({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null}),[f,C]=r.useState({loading:!0,activeTaskCount:0,pendingInboxCount:0}),E=Ye(u),j=te(u,O)??te(u,((ee=u[0])==null?void 0:ee.workspace.id)??null),i=(j==null?void 0:j.workspace)??null,I=E.find(o=>o.workspace.id===(i==null?void 0:i.id))??(i?{workspace:i,label:i.name,subtitle:i.path}:null),S=[...(j==null?void 0:j.sessions)??[]].filter(di),P=S.filter(re),z=S.filter(mi),ve=S.filter(o=>o.isFavorite===!0),J=P.slice(0,6),Y=ve.slice(0,6),Ne=d.quickLaunchRunning===null?"…":d.quickLaunchRunning?t("shell.workspaceHomeQuickLaunchRunning"):t("shell.workspaceHomeQuickLaunchStopped");r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o){g({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null});return}const s=y(B(o),A);g(c=>{var l,v,w;return{...c,gitLoading:s===null,branch:((l=s==null?void 0:s.status)==null?void 0:l.snapshot.enabled)===!1?null:((v=s==null?void 0:s.status)==null?void 0:v.snapshot.branch)??null,changedFileCount:((w=s==null?void 0:s.status)==null?void 0:w.changes.length)??null}})},[i==null?void 0:i.id]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(o)return V(s=>{s.workspaceId===o&&(ie(B(o),s),g(c=>{var l,v,w,T;return{...c,gitLoading:!1,branch:((l=s.status)==null?void 0:l.snapshot.enabled)===!1?null:((v=s.status)==null?void 0:v.snapshot.branch)??((w=s.branches)==null?void 0:w.currentBranch)??null,changedFileCount:((T=s.status)==null?void 0:T.changes.length)??null}}))})},[V,i==null?void 0:i.id]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o){g(c=>({...c,gitLoading:!1,branch:null,changedFileCount:null}));return}const s=y(F(o),A);g(c=>({...c,terminalLoading:s===null,activeTerminalCount:s?s.terminals.filter(l=>ae(l.status)).length:null,quickLaunchRunning:s?s.templateStatuses.some(l=>l.occupied):null}))},[i==null?void 0:i.id]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o){g(s=>({...s,terminalLoading:!1,activeTerminalCount:null,quickLaunchRunning:null}));return}return W(s=>{s.workspaceId===o&&(ie(F(o),{revision:s.revision??null,terminals:s.terminals,templates:s.templates,templateStatuses:s.templateStatuses}),g(c=>({...c,terminalLoading:!1,activeTerminalCount:s.terminals.filter(l=>ae(l.status)).length,quickLaunchRunning:s.templateStatuses.some(l=>l.occupied)})))})},[W,i==null?void 0:i.id]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o)return;const s=y(B(o),A);U(o,{knownRevision:(s==null?void 0:s.revision)??null}),!s&&D(o)},[i==null?void 0:i.id,D,U]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o)return;const s=y(F(o),A);K(o,{knownRevision:(s==null?void 0:s.revision)??null}),!s&&G(o)},[i==null?void 0:i.id,G,K]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o){C({loading:!1,activeTaskCount:0,pendingInboxCount:0});return}let s=!1;async function c(T){C(N=>({...N,loading:!0}));try{const N=await De();if(!N.initialized||!N.profile){s||C({loading:!1,activeTaskCount:0,pendingInboxCount:0});return}const[L,Ee,Pe]=await Promise.all([Ve(),Ke(),Ge({workspaceId:o})]);if(s)return;const _e=new Set(L.overview.projects.filter(h=>h.workspaceId===o).map(h=>h.id)),He=L.overview.verifications.filter(h=>h.projectId?_e.has(h.projectId):!1);C({loading:!1,activeTaskCount:ai(Ee.items.filter(h=>h.workspaceId===o),He),pendingInboxCount:Pe.items.filter(h=>h.status!=="closed").length})}catch(N){if(s)return;C(L=>({...L,loading:!1})),T&&m({title:t("shell.butlerLoadFailed"),description:N instanceof Error?N.message:void 0,tone:"error"})}}c(!0);const l=window.setInterval(()=>{c(!1)},ui),v=Je(()=>{c(!1)}),w=()=>{c(!1)};return window.addEventListener(oe,w),()=>{s=!0,window.clearInterval(l),v(),window.removeEventListener(oe,w)}},[i==null?void 0:i.id,m]);async function xe(o){await q(),p(o.id),b(null),n(H(o.id))}async function je(o){await q(),p(o.id),b(null),n(H(o.id))}function Ce(){i&&(p(i.id),n(Xe(i.id,"git")))}function Se(){i&&(p(i.id),n(Qe(i.id)))}function Ie(){i&&(p(i.id),n(ze(i.id)))}function Te(){i&&(p(i.id),n($e(i.id)))}function _(){i&&n(We(i.id))}function Z(){i&&R(!0)}function Le(o,s){R(!1),de(o,s)}function ye(){i&&(p(i.id),n(H(i.id)))}function Ae(o){p(o)}const Re=[{label:t("shell.workspaceHomeMetricActive"),value:P.length,accent:x(P.length),onClick:S.length>0?_:void 0},{label:t("shell.workspaceHomeMetricUnread"),value:Q,accent:x(Q),onClick:()=>M(!0)},{label:t("shell.workspaceHomeMetricTerminal"),value:d.terminalLoading?"…":d.activeTerminalCount??"—",accent:d.terminalLoading===!1&&x(d.activeTerminalCount),onClick:i?Se:void 0},{label:t("shell.workspaceHomeMetricChanges"),value:d.gitLoading?"…":d.changedFileCount??"—",accent:d.gitLoading===!1&&x(d.changedFileCount),onClick:i?Ce:void 0}],Me=[{label:t("shell.workspaceHomeWaitingInputLabel"),value:z.length,accent:x(z.length),onClick:S.length>0?_:void 0},{label:t("shell.workspaceHomeButlerLabel"),value:f.loading?"…":f.activeTaskCount,accent:f.loading===!1&&x(f.activeTaskCount),onClick:i?Te:void 0},{label:t("shell.workspaceHomeQuickLaunchStatusLabel"),value:Ne,accent:d.quickLaunchRunning===!0,onClick:i?Ie:void 0},{label:t("shell.butlerInboxAction"),value:f.loading?"…":f.pendingInboxCount,accent:f.loading===!1&&x(f.pendingInboxCount),onClick:i?()=>$(!0):void 0}];return e.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-home-page",children:[e.jsx(Ze,{currentWorkspace:I?{id:I.workspace.id,name:I.label,path:I.subtitle}:null,workspaces:u.map(o=>o.workspace),workspaceOptions:E,onSelectWorkspace:Ae,sheetContent:o=>e.jsxs("div",{className:"mobile-workspace-home-group mobile-workspace-home-sheet-group",children:[e.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{o(),b("import")},children:[e.jsx("span",{className:"mobile-workspace-home-row-label",children:t("shell.importWorkspaceTitle")}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]}),e.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{o(),b("clone")},children:[e.jsx("span",{className:"mobile-workspace-home-row-label",children:t("shell.cloneWorkspaceTitle")}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]})]})}),i?e.jsx(e.Fragment,{children:e.jsxs("div",{className:"mobile-page-top-body mobile-workspace-home-body",children:[e.jsx("section",{className:"mobile-workspace-home-section",children:e.jsx("div",{className:"mobile-workspace-home-metrics-card","aria-label":t("shell.workspaceHomeStatusSectionTitle"),children:e.jsx("div",{className:"mobile-workspace-home-toolbar-summary",children:Re.map(o=>o.onClick?e.jsxs("button",{type:"button",className:"mobile-workspace-home-toolbar-metric","data-accent":o.accent?"true":void 0,onClick:o.onClick,children:[e.jsx("strong",{className:"mobile-workspace-home-toolbar-metric-value",children:o.value}),e.jsx("span",{className:"mobile-workspace-home-toolbar-metric-label",children:o.label})]},o.label):e.jsxs("div",{className:"mobile-workspace-home-toolbar-metric","data-accent":o.accent?"true":void 0,role:"listitem",children:[e.jsx("strong",{className:"mobile-workspace-home-toolbar-metric-value",children:o.value}),e.jsx("span",{className:"mobile-workspace-home-toolbar-metric-label",children:o.label})]},o.label))})})}),e.jsx("section",{className:"mobile-workspace-home-section",children:e.jsxs("div",{className:"mobile-workspace-home-primary-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",onClick:ye,children:t("shell.workspaceDetailTitle")}),e.jsx("button",{type:"button",className:"primary-button",onClick:Z,children:t("shell.createSession")})]})}),e.jsx("section",{className:"mobile-workspace-home-section",children:e.jsx("div",{className:"mobile-workspace-home-group",children:Me.map(o=>e.jsxs("button",{type:"button",className:"mobile-workspace-home-row","data-accent":o.accent?"true":void 0,onClick:o.onClick,children:[e.jsx("span",{className:"mobile-workspace-home-row-label",children:o.label}),e.jsxs("span",{className:"mobile-workspace-home-row-trailing",children:[e.jsx("strong",{children:o.value}),e.jsx(k,{})]})]},o.label))})}),e.jsxs("section",{className:"mobile-workspace-home-section",children:[e.jsxs("div",{className:"mobile-workspace-home-section-header",children:[e.jsx("p",{className:"mobile-workspace-home-section-title",children:t("shell.workspaceHomeActiveSessionsSectionTitle")}),i?e.jsx("button",{type:"button",className:"mobile-workspace-home-link-button",onClick:_,children:t("shell.workspaceHomeViewAllAction")}):null]}),e.jsx("div",{className:"mobile-workspace-home-group",children:J.length===0?e.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-empty-row",onClick:Z,children:[e.jsxs("div",{className:"mobile-workspace-home-session-main",children:[e.jsx("span",{className:"mobile-workspace-home-session-title",children:t("shell.createSession")}),e.jsx("span",{className:"mobile-workspace-home-session-meta",children:i.name})]}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]}):J.map(o=>e.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>n(ne(i.id,o.sessionId)),children:[e.jsxs("div",{className:"mobile-workspace-home-session-main",children:[e.jsx("span",{className:"mobile-workspace-home-session-title",children:o.title||t("common.unknown")}),e.jsxs("span",{className:"mobile-workspace-home-session-meta",children:[se(o.provider,"full")," · ",ce(le(o))]})]}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]},o.sessionId))})]}),Y.length>0?e.jsxs("section",{className:"mobile-workspace-home-section",children:[e.jsx("div",{className:"mobile-workspace-home-section-header",children:e.jsx("p",{className:"mobile-workspace-home-section-title",children:t("shell.favoriteSectionTitle")})}),e.jsx("div",{className:"mobile-workspace-home-group",children:Y.map(o=>e.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>n(ne(i.id,o.sessionId)),children:[e.jsxs("div",{className:"mobile-workspace-home-session-main",children:[e.jsx("span",{className:"mobile-workspace-home-session-title",children:o.title||t("common.unknown")}),e.jsxs("span",{className:"mobile-workspace-home-session-meta",children:[se(o.provider,"full")," · ",ce(le(o))]})]}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]},o.sessionId))})]}):null]})}):e.jsx("div",{className:"mobile-page-top-body mobile-workspace-home-body",children:e.jsxs("section",{className:"mobile-workspace-home-section mobile-workspace-home-empty",children:[e.jsx("p",{className:"mobile-workspace-home-section-title",children:t("shell.workspaceHomeSwitcherTitle")}),e.jsxs("div",{className:"mobile-workspace-home-group",children:[e.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:()=>b("import"),children:[e.jsx("span",{className:"mobile-workspace-home-row-label",children:t("shell.importWorkspaceTitle")}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]}),e.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:()=>b("clone"),children:[e.jsx("span",{className:"mobile-workspace-home-row-label",children:t("shell.cloneWorkspaceTitle")}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]})]})]})}),e.jsx(Fe,{open:X==="import",onClose:()=>b(null),onImported:xe}),e.jsx(Oe,{open:X==="clone",onClose:()=>b(null),onCloned:je}),e.jsx(oi,{open:we,workspaces:u.map(o=>o.workspace),workspaceOptions:E,initialWorkspaceId:(i==null?void 0:i.id)??O??null,onClose:()=>R(!1),onSelect:Le}),e.jsx(qe,{open:ke,preferredWorkspaceId:(i==null?void 0:i.id)??null,compactComposer:!0,onClose:()=>$(!1)}),e.jsx(li,{open:ge,notifications:me,archivedNotificationIds:ue,showArchivedNotifications:he,onClose:()=>M(!1),onToggleShowArchivedNotifications:pe,onArchiveNotification:be,onUnarchiveNotification:fe,onSelectNotification:o=>{M(!1),o.routePath&&n(o.routePath)}})]})}function B(n){return`git-sidebar.snapshot.${n}`}function F(n){return`terminal-manager.snapshot.${n}`}function k(){return e.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}export{Si as WorkspaceHomePage};
1
+ import{b as r,j as e,t}from"./index-oGylLBIX.js";import{u as Be,i as re,b as y,w as ie,B as oe,c as ne,d as Fe,e as Oe,f as qe,g as Ue,h as De,j as Ve,l as Ke,k as Ge,n as We,o as Qe,p as Xe,q as $e,s as ze,t as H}from"./WorkbenchLayout-Dybarc1V.js";import{s as Je}from"./butler-records-events-DgWCG364.js";import{a as se}from"./model-switch-api-T55eW6D4.js";import{f as Ye,a as te,M as Ze}from"./MobileWorkspaceSwitcherHeader-Cczi7RYu.js";import{u as ei,f as ii}from"./App-C2lNmeKL.js";import{M as oi}from"./MobileCreateSessionSheet-THIrIzJ3.js";import{W as ni}from"./WorkbenchModal-DMQutm1x.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./relay-entry-sdeFnTbY.js";import"./MobileTopHeaderFrame-D-X7pVnV.js";function si(n){return n.status==="active"}function ti(n){return n.status==="queued"||n.status==="running"}function ai(n,m){return n.filter(si).length+m.filter(ti).length}function li(n){const m=r.useMemo(()=>n.notifications.filter(a=>n.showArchivedNotifications||!n.archivedNotificationIds.has(a.id)),[n.archivedNotificationIds,n.notifications,n.showArchivedNotifications]);return e.jsx(ni,{open:n.open,title:t("shell.globalNotificationsPanelTitle"),description:t("shell.globalNotificationsPanelDescription"),className:"workbench-notification-modal-card mobile-notification-modal-card",onClose:n.onClose,children:e.jsxs("div",{className:"workbench-notification-pane mobile-notification-pane",role:"tabpanel","aria-label":t("shell.globalNotificationsAction"),children:[e.jsx("div",{className:"workbench-notification-toolbar",children:e.jsxs("label",{className:"workbench-notification-filter",children:[e.jsx("input",{type:"checkbox",checked:n.showArchivedNotifications,onChange:a=>n.onToggleShowArchivedNotifications(a.target.checked)}),e.jsx("span",{children:t("shell.globalNotificationsShowArchived")})]})}),m.length>0?e.jsx("div",{className:"workbench-notification-list",children:m.map(a=>{const u=n.archivedNotificationIds.has(a.id);return e.jsxs("article",{className:"workbench-notification-item","data-archived":u,children:[e.jsxs("button",{type:"button",className:"workbench-notification-item-content",onClick:()=>{n.onSelectNotification(a)},children:[e.jsx("span",{className:"workbench-notification-item-kind",children:ci(a.kind)}),e.jsx("strong",{children:a.title}),e.jsx("p",{children:a.body})]}),e.jsxs("div",{className:"workbench-notification-item-side",children:[e.jsx("time",{children:ri(a.createdAt)}),e.jsx("button",{type:"button",className:"secondary-button workbench-notification-item-action-button",onClick:()=>{if(u){n.onUnarchiveNotification(a.id);return}n.onArchiveNotification(a.id)},children:u?t("shell.globalNotificationsRemoveArchiveAction"):t("shell.globalNotificationsArchiveAction")})]})]},a.id)})}):e.jsx("p",{className:"workbench-notification-empty",children:t("shell.globalNotificationsEmpty")})]})})}function ci(n){switch(n){case"follow_up_waiting_user":return t("shell.globalNotificationKindWaitingUser");case"follow_up_completed":return t("shell.globalNotificationKindFollowUpCompleted");case"follow_up_failed":return t("shell.globalNotificationKindFollowUpFailed");case"verification_failed":return t("shell.globalNotificationKindVerificationFailed");default:return t("shell.globalNotificationsPanelTitle")}}function ri(n){const m=new Date(n);return Number.isNaN(m.getTime())?n:new Intl.DateTimeFormat(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(m)}function di(n){return n.isArchived!==!0&&!Ue(n)}function mi(n){return n.activityState==="idle"&&re(n)===!1}function ae(n){return n==="creating"||n==="running"}function le(n){return n.lastEventAt??n.lastMessageAt??n.updatedAt??n.createdAt}function ce(n){return n?new Date(n).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):t("common.unknown")}function x(n){return n!==null&&n>0}const A=60*1e3,ui=15e3;function Si(){var ee;const n=ei(),{showToast:m}=ii(),a=Be(),{navigationGroups:u,currentWorkspaceId:O,refreshNavigation:q,selectWorkspace:p,startDraftSession:de,subscribeGitSnapshot:U,requestGitRefresh:D,addGitSnapshotListener:V,subscribeTerminalManagerSnapshot:K,requestTerminalManagerRefresh:G,addTerminalManagerSnapshotListener:W}=a,me=a.globalNotifications??[],ue=new Set(a.archivedNotificationIds??[]),he=a.showArchivedNotifications??!1,Q=a.unreadNotificationCount??0,pe=a.setShowArchivedNotifications??(()=>{}),be=a.archiveNotification??(()=>{}),fe=a.unarchiveNotification??(()=>{}),[X,b]=r.useState(null),[we,R]=r.useState(!1),[ke,$]=r.useState(!1),[ge,M]=r.useState(!1),[d,g]=r.useState({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null}),[f,C]=r.useState({loading:!0,activeTaskCount:0,pendingInboxCount:0}),E=Ye(u),j=te(u,O)??te(u,((ee=u[0])==null?void 0:ee.workspace.id)??null),i=(j==null?void 0:j.workspace)??null,I=E.find(o=>o.workspace.id===(i==null?void 0:i.id))??(i?{workspace:i,label:i.name,subtitle:i.path}:null),S=[...(j==null?void 0:j.sessions)??[]].filter(di),P=S.filter(re),z=S.filter(mi),ve=S.filter(o=>o.isFavorite===!0),J=P.slice(0,6),Y=ve.slice(0,6),Ne=d.quickLaunchRunning===null?"…":d.quickLaunchRunning?t("shell.workspaceHomeQuickLaunchRunning"):t("shell.workspaceHomeQuickLaunchStopped");r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o){g({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null});return}const s=y(B(o),A);g(c=>{var l,v,w;return{...c,gitLoading:s===null,branch:((l=s==null?void 0:s.status)==null?void 0:l.snapshot.enabled)===!1?null:((v=s==null?void 0:s.status)==null?void 0:v.snapshot.branch)??null,changedFileCount:((w=s==null?void 0:s.status)==null?void 0:w.changes.length)??null}})},[i==null?void 0:i.id]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(o)return V(s=>{s.workspaceId===o&&(ie(B(o),s),g(c=>{var l,v,w,T;return{...c,gitLoading:!1,branch:((l=s.status)==null?void 0:l.snapshot.enabled)===!1?null:((v=s.status)==null?void 0:v.snapshot.branch)??((w=s.branches)==null?void 0:w.currentBranch)??null,changedFileCount:((T=s.status)==null?void 0:T.changes.length)??null}}))})},[V,i==null?void 0:i.id]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o){g(c=>({...c,gitLoading:!1,branch:null,changedFileCount:null}));return}const s=y(F(o),A);g(c=>({...c,terminalLoading:s===null,activeTerminalCount:s?s.terminals.filter(l=>ae(l.status)).length:null,quickLaunchRunning:s?s.templateStatuses.some(l=>l.occupied):null}))},[i==null?void 0:i.id]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o){g(s=>({...s,terminalLoading:!1,activeTerminalCount:null,quickLaunchRunning:null}));return}return W(s=>{s.workspaceId===o&&(ie(F(o),{revision:s.revision??null,terminals:s.terminals,templates:s.templates,templateStatuses:s.templateStatuses}),g(c=>({...c,terminalLoading:!1,activeTerminalCount:s.terminals.filter(l=>ae(l.status)).length,quickLaunchRunning:s.templateStatuses.some(l=>l.occupied)})))})},[W,i==null?void 0:i.id]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o)return;const s=y(B(o),A);U(o,{knownRevision:(s==null?void 0:s.revision)??null}),!s&&D(o)},[i==null?void 0:i.id,D,U]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o)return;const s=y(F(o),A);K(o,{knownRevision:(s==null?void 0:s.revision)??null}),!s&&G(o)},[i==null?void 0:i.id,G,K]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o){C({loading:!1,activeTaskCount:0,pendingInboxCount:0});return}let s=!1;async function c(T){C(N=>({...N,loading:!0}));try{const N=await De();if(!N.initialized||!N.profile){s||C({loading:!1,activeTaskCount:0,pendingInboxCount:0});return}const[L,Ee,Pe]=await Promise.all([Ve(),Ke(),Ge({workspaceId:o})]);if(s)return;const _e=new Set(L.overview.projects.filter(h=>h.workspaceId===o).map(h=>h.id)),He=L.overview.verifications.filter(h=>h.projectId?_e.has(h.projectId):!1);C({loading:!1,activeTaskCount:ai(Ee.items.filter(h=>h.workspaceId===o),He),pendingInboxCount:Pe.items.filter(h=>h.status!=="closed").length})}catch(N){if(s)return;C(L=>({...L,loading:!1})),T&&m({title:t("shell.butlerLoadFailed"),description:N instanceof Error?N.message:void 0,tone:"error"})}}c(!0);const l=window.setInterval(()=>{c(!1)},ui),v=Je(()=>{c(!1)}),w=()=>{c(!1)};return window.addEventListener(oe,w),()=>{s=!0,window.clearInterval(l),v(),window.removeEventListener(oe,w)}},[i==null?void 0:i.id,m]);async function xe(o){await q(),p(o.id),b(null),n(H(o.id))}async function je(o){await q(),p(o.id),b(null),n(H(o.id))}function Ce(){i&&(p(i.id),n(Xe(i.id,"git")))}function Se(){i&&(p(i.id),n(Qe(i.id)))}function Ie(){i&&(p(i.id),n(ze(i.id)))}function Te(){i&&(p(i.id),n($e(i.id)))}function _(){i&&n(We(i.id))}function Z(){i&&R(!0)}function Le(o,s){R(!1),de(o,s)}function ye(){i&&(p(i.id),n(H(i.id)))}function Ae(o){p(o)}const Re=[{label:t("shell.workspaceHomeMetricActive"),value:P.length,accent:x(P.length),onClick:S.length>0?_:void 0},{label:t("shell.workspaceHomeMetricUnread"),value:Q,accent:x(Q),onClick:()=>M(!0)},{label:t("shell.workspaceHomeMetricTerminal"),value:d.terminalLoading?"…":d.activeTerminalCount??"—",accent:d.terminalLoading===!1&&x(d.activeTerminalCount),onClick:i?Se:void 0},{label:t("shell.workspaceHomeMetricChanges"),value:d.gitLoading?"…":d.changedFileCount??"—",accent:d.gitLoading===!1&&x(d.changedFileCount),onClick:i?Ce:void 0}],Me=[{label:t("shell.workspaceHomeWaitingInputLabel"),value:z.length,accent:x(z.length),onClick:S.length>0?_:void 0},{label:t("shell.workspaceHomeButlerLabel"),value:f.loading?"…":f.activeTaskCount,accent:f.loading===!1&&x(f.activeTaskCount),onClick:i?Te:void 0},{label:t("shell.workspaceHomeQuickLaunchStatusLabel"),value:Ne,accent:d.quickLaunchRunning===!0,onClick:i?Ie:void 0},{label:t("shell.butlerInboxAction"),value:f.loading?"…":f.pendingInboxCount,accent:f.loading===!1&&x(f.pendingInboxCount),onClick:i?()=>$(!0):void 0}];return e.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-home-page",children:[e.jsx(Ze,{currentWorkspace:I?{id:I.workspace.id,name:I.label,path:I.subtitle}:null,workspaces:u.map(o=>o.workspace),workspaceOptions:E,onSelectWorkspace:Ae,sheetContent:o=>e.jsxs("div",{className:"mobile-workspace-home-group mobile-workspace-home-sheet-group",children:[e.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{o(),b("import")},children:[e.jsx("span",{className:"mobile-workspace-home-row-label",children:t("shell.importWorkspaceTitle")}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]}),e.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{o(),b("clone")},children:[e.jsx("span",{className:"mobile-workspace-home-row-label",children:t("shell.cloneWorkspaceTitle")}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]})]})}),i?e.jsx(e.Fragment,{children:e.jsxs("div",{className:"mobile-page-top-body mobile-workspace-home-body",children:[e.jsx("section",{className:"mobile-workspace-home-section",children:e.jsx("div",{className:"mobile-workspace-home-metrics-card","aria-label":t("shell.workspaceHomeStatusSectionTitle"),children:e.jsx("div",{className:"mobile-workspace-home-toolbar-summary",children:Re.map(o=>o.onClick?e.jsxs("button",{type:"button",className:"mobile-workspace-home-toolbar-metric","data-accent":o.accent?"true":void 0,onClick:o.onClick,children:[e.jsx("strong",{className:"mobile-workspace-home-toolbar-metric-value",children:o.value}),e.jsx("span",{className:"mobile-workspace-home-toolbar-metric-label",children:o.label})]},o.label):e.jsxs("div",{className:"mobile-workspace-home-toolbar-metric","data-accent":o.accent?"true":void 0,role:"listitem",children:[e.jsx("strong",{className:"mobile-workspace-home-toolbar-metric-value",children:o.value}),e.jsx("span",{className:"mobile-workspace-home-toolbar-metric-label",children:o.label})]},o.label))})})}),e.jsx("section",{className:"mobile-workspace-home-section",children:e.jsxs("div",{className:"mobile-workspace-home-primary-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",onClick:ye,children:t("shell.workspaceDetailTitle")}),e.jsx("button",{type:"button",className:"primary-button",onClick:Z,children:t("shell.createSession")})]})}),e.jsx("section",{className:"mobile-workspace-home-section",children:e.jsx("div",{className:"mobile-workspace-home-group",children:Me.map(o=>e.jsxs("button",{type:"button",className:"mobile-workspace-home-row","data-accent":o.accent?"true":void 0,onClick:o.onClick,children:[e.jsx("span",{className:"mobile-workspace-home-row-label",children:o.label}),e.jsxs("span",{className:"mobile-workspace-home-row-trailing",children:[e.jsx("strong",{children:o.value}),e.jsx(k,{})]})]},o.label))})}),e.jsxs("section",{className:"mobile-workspace-home-section",children:[e.jsxs("div",{className:"mobile-workspace-home-section-header",children:[e.jsx("p",{className:"mobile-workspace-home-section-title",children:t("shell.workspaceHomeActiveSessionsSectionTitle")}),i?e.jsx("button",{type:"button",className:"mobile-workspace-home-link-button",onClick:_,children:t("shell.workspaceHomeViewAllAction")}):null]}),e.jsx("div",{className:"mobile-workspace-home-group",children:J.length===0?e.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-empty-row",onClick:Z,children:[e.jsxs("div",{className:"mobile-workspace-home-session-main",children:[e.jsx("span",{className:"mobile-workspace-home-session-title",children:t("shell.createSession")}),e.jsx("span",{className:"mobile-workspace-home-session-meta",children:i.name})]}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]}):J.map(o=>e.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>n(ne(i.id,o.sessionId)),children:[e.jsxs("div",{className:"mobile-workspace-home-session-main",children:[e.jsx("span",{className:"mobile-workspace-home-session-title",children:o.title||t("common.unknown")}),e.jsxs("span",{className:"mobile-workspace-home-session-meta",children:[se(o.provider,"full")," · ",ce(le(o))]})]}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]},o.sessionId))})]}),Y.length>0?e.jsxs("section",{className:"mobile-workspace-home-section",children:[e.jsx("div",{className:"mobile-workspace-home-section-header",children:e.jsx("p",{className:"mobile-workspace-home-section-title",children:t("shell.favoriteSectionTitle")})}),e.jsx("div",{className:"mobile-workspace-home-group",children:Y.map(o=>e.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>n(ne(i.id,o.sessionId)),children:[e.jsxs("div",{className:"mobile-workspace-home-session-main",children:[e.jsx("span",{className:"mobile-workspace-home-session-title",children:o.title||t("common.unknown")}),e.jsxs("span",{className:"mobile-workspace-home-session-meta",children:[se(o.provider,"full")," · ",ce(le(o))]})]}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]},o.sessionId))})]}):null]})}):e.jsx("div",{className:"mobile-page-top-body mobile-workspace-home-body",children:e.jsxs("section",{className:"mobile-workspace-home-section mobile-workspace-home-empty",children:[e.jsx("p",{className:"mobile-workspace-home-section-title",children:t("shell.workspaceHomeSwitcherTitle")}),e.jsxs("div",{className:"mobile-workspace-home-group",children:[e.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:()=>b("import"),children:[e.jsx("span",{className:"mobile-workspace-home-row-label",children:t("shell.importWorkspaceTitle")}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]}),e.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:()=>b("clone"),children:[e.jsx("span",{className:"mobile-workspace-home-row-label",children:t("shell.cloneWorkspaceTitle")}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]})]})]})}),e.jsx(Fe,{open:X==="import",onClose:()=>b(null),onImported:xe}),e.jsx(Oe,{open:X==="clone",onClose:()=>b(null),onCloned:je}),e.jsx(oi,{open:we,workspaces:u.map(o=>o.workspace),workspaceOptions:E,initialWorkspaceId:(i==null?void 0:i.id)??O??null,onClose:()=>R(!1),onSelect:Le}),e.jsx(qe,{open:ke,preferredWorkspaceId:(i==null?void 0:i.id)??null,compactComposer:!0,onClose:()=>$(!1)}),e.jsx(li,{open:ge,notifications:me,archivedNotificationIds:ue,showArchivedNotifications:he,onClose:()=>M(!1),onToggleShowArchivedNotifications:pe,onArchiveNotification:be,onUnarchiveNotification:fe,onSelectNotification:o=>{M(!1),o.routePath&&n(o.routePath)}})]})}function B(n){return`git-sidebar.snapshot.${n}`}function F(n){return`terminal-manager.snapshot.${n}`}function k(){return e.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}export{Si as WorkspaceHomePage};
@@ -1 +1 @@
1
- import{e as d,C as a,h as u,i as c}from"./index-C-0oeG_5.js";async function l(){const t=d.getState().platform==="web"?"web":"desktop";return await a.request(`/api/client/runtime-config?platform=${encodeURIComponent(t)}`)}async function g(){const n=d.getState(),t=u(n);if(!t)return;const s=await l(),r=p(s.relayTunnel);if(m(t.relayTunnel??null,r))return;const e=new Date().toISOString();if(c(t)){d.updateRuntime({discoveredHosts:n.discoveredHosts.map(i=>i.id===t.id?{...i,relayTunnel:r,updatedAt:e}:i)});return}await d.update({hosts:n.hosts.map(i=>i.id===t.id?{...i,relayTunnel:r,updatedAt:e}:i)})}function p(n){return!n||n.provider!=="codingns_relay"||!n.controlBaseUrl||!n.tunnelDomain||!n.bindingId?null:{provider:n.provider,enabled:n.enabled,controlBaseUrl:n.controlBaseUrl,tunnelDomain:n.tunnelDomain.trim().toLowerCase(),bindingId:n.bindingId,hostFingerprint:n.hostFingerprint,candidateEndpoints:n.candidateEndpoints}}function m(n,t){if(n===t)return!0;if(!n||!t)return n===t;if(n.provider!==t.provider||n.enabled!==t.enabled||n.controlBaseUrl!==t.controlBaseUrl||n.tunnelDomain!==t.tunnelDomain||(n.bindingId??null)!==(t.bindingId??null)||(n.hostFingerprint??null)!==(t.hostFingerprint??null))return!1;const s=n.candidateEndpoints??[],r=t.candidateEndpoints??[];return s.length!==r.length?!1:s.every((e,i)=>{const o=r[i];return e.endpointId===(o==null?void 0:o.endpointId)&&e.kind===o.kind&&e.url===o.url&&e.priority===o.priority&&e.expiresAt===o.expiresAt&&e.source===o.source})}export{l as fetchAuthenticatedClientRuntimeConfig,g as syncActiveHostAuthenticatedRuntimeConfig};
1
+ import{e as d,C as a,h as u,i as c}from"./index-oGylLBIX.js";async function l(){const t=d.getState().platform==="web"?"web":"desktop";return await a.request(`/api/client/runtime-config?platform=${encodeURIComponent(t)}`)}async function g(){const n=d.getState(),t=u(n);if(!t)return;const s=await l(),r=p(s.relayTunnel);if(m(t.relayTunnel??null,r))return;const e=new Date().toISOString();if(c(t)){d.updateRuntime({discoveredHosts:n.discoveredHosts.map(i=>i.id===t.id?{...i,relayTunnel:r,updatedAt:e}:i)});return}await d.update({hosts:n.hosts.map(i=>i.id===t.id?{...i,relayTunnel:r,updatedAt:e}:i)})}function p(n){return!n||n.provider!=="codingns_relay"||!n.controlBaseUrl||!n.tunnelDomain||!n.bindingId?null:{provider:n.provider,enabled:n.enabled,controlBaseUrl:n.controlBaseUrl,tunnelDomain:n.tunnelDomain.trim().toLowerCase(),bindingId:n.bindingId,hostFingerprint:n.hostFingerprint,candidateEndpoints:n.candidateEndpoints}}function m(n,t){if(n===t)return!0;if(!n||!t)return n===t;if(n.provider!==t.provider||n.enabled!==t.enabled||n.controlBaseUrl!==t.controlBaseUrl||n.tunnelDomain!==t.tunnelDomain||(n.bindingId??null)!==(t.bindingId??null)||(n.hostFingerprint??null)!==(t.hostFingerprint??null))return!1;const s=n.candidateEndpoints??[],r=t.candidateEndpoints??[];return s.length!==r.length?!1:s.every((e,i)=>{const o=r[i];return e.endpointId===(o==null?void 0:o.endpointId)&&e.kind===o.kind&&e.url===o.url&&e.priority===o.priority&&e.expiresAt===o.expiresAt&&e.source===o.source})}export{l as fetchAuthenticatedClientRuntimeConfig,g as syncActiveHostAuthenticatedRuntimeConfig};
@@ -0,0 +1,3 @@
1
+ import{b as u,j as a,t as d,J as Ie,H as Fe,D as Ue,A as Ae}from"./index-oGylLBIX.js";import{D as De}from"./WorkbenchModal-DMQutm1x.js";import{f as he,e as me}from"./App-C2lNmeKL.js";import{bC as q,bD as Oe,bE as $e,bF as He}from"./WorkbenchLayout-Dybarc1V.js";const A="allow-forms allow-modals allow-scripts",_e=`${A} allow-same-origin`,Ze=new Set(["abstract","as","async","await","break","case","catch","class","const","continue","default","delete","do","else","enum","export","extends","false","finally","for","from","function","if","implements","import","in","instanceof","interface","let","new","null","package","private","protected","public","readonly","return","static","super","switch","this","throw","true","try","type","typeof","undefined","var","void","while","with","yield"]),Be=new Set(["and","as","assert","async","await","break","class","continue","def","del","elif","else","except","False","finally","for","from","global","if","import","in","is","lambda","None","nonlocal","not","or","pass","raise","return","True","try","while","with","yield"]),Ge=new Set(["case","do","done","elif","else","esac","export","fi","for","function","if","in","local","readonly","return","then","until","while"]),Ye=new Set(["add","alter","and","as","asc","between","by","create","delete","desc","drop","from","group","having","insert","into","join","left","like","limit","not","null","offset","on","or","order","right","select","set","table","union","update","values","where"]),Je=new Set(["add","arg","cmd","copy","entrypoint","env","expose","from","healthcheck","label","maintainer","onbuild","run","shell","stopsignal","user","volume","workdir","as"]),qe=new Set(["trace","debug","info","warn","warning","error","fatal"]);function Zt({workspaceId:e,filePath:t,open:n,onClose:r,onSaved:o,diffContent:s}){var de,ue;const[i,l]=u.useState(null),[c,h]=u.useState(""),[f,p]=u.useState(!1),[k,b]=u.useState(!1),[g,w]=u.useState("preview"),[y,$]=u.useState("regular"),[S,N]=u.useState(0),[se,C]=u.useState("fit"),[oe,P]=u.useState(1),[H,W]=u.useState(1),[_,E]=u.useState(110),[Z,V]=u.useState(!0),{showToast:v}=he(),j=me(),ae=u.useRef(r),le=u.useRef(v),I=u.useMemo(()=>re(t),[t]),be=u.useMemo(()=>Ut(s),[s]),x=(i==null?void 0:i.kind)??null,R=!!((de=i==null?void 0:i.capabilities)!=null&&de.canEdit),ye=!!((ue=i==null?void 0:i.capabilities)!=null&&ue.canRefresh),ce=tt(x,I),L=u.useMemo(()=>nt(i,j.isDesktop),[j.isDesktop,i]),B=u.useMemo(()=>rt(i,j.isDesktop),[j.isDesktop,i]),Se=u.useMemo(()=>ee(L,S),[L,S]),je=u.useMemo(()=>st(L,S,H,_,Z),[L,S,H,_,Z]),Le=u.useMemo(()=>ee(L,S),[L,S]),Me=(i==null?void 0:i.content)??"",Ne=u.useDeferredValue(c),G=R&&c!==Me,Ce=we(x),Pe=K(x),We=Qe(x,I);if(u.useEffect(()=>{ae.current=r},[r]),u.useEffect(()=>{le.current=v},[v]),u.useEffect(()=>{if(!n){l(null),h(""),p(!1),b(!1),w(pe(t,null)),ge({setResourceRefreshVersion:N,setImageScale:P,setImageScaleMode:C,setPdfPage:W,setPdfScale:E,setPdfFitWidth:V}),$("regular");return}if(!e||!t)return;const m=e,F=t;let U=!1;async function ze(){p(!0);try{const J=await q(m,F);U||X(J,F,{preserveMode:!1,setPreview:l,setEditorContent:h,setMode:w,setResourceRefreshVersion:N,setImageScale:P,setImageScaleMode:C,setPdfPage:W,setPdfScale:E,setPdfFitWidth:V})}catch(J){U||(le.current({title:Q(J,d("conversation.filePanelOpenFailed")),tone:"error"}),ae.current())}finally{U||p(!1)}}return ze(),()=>{U=!0}},[t,n,e]),!n||!t)return null;const M=t,T=e;async function Ee(){if(!(!T||!(i!=null&&i.version)||!R)){b(!0);try{await Oe(T,M,c,i.version);const m=await q(T,M);X(m,M,{preserveMode:!1,setPreview:l,setEditorContent:h,setMode:w,setResourceRefreshVersion:N,setImageScale:P,setImageScaleMode:C,setPdfPage:W,setPdfScale:E,setPdfFitWidth:V}),await o(M),v({title:d("conversation.filePanelSaveSuccess"),tone:"success"})}catch(m){v({title:Q(m,d("conversation.filePanelSaveFailed")),tone:"error"})}finally{b(!1)}}}async function Ve(){if(!(!T||!ye||G)){p(!0);try{const m=await q(T,M);X(m,M,{preserveMode:!0,setPreview:l,setEditorContent:h,setMode:w,setResourceRefreshVersion:N,setImageScale:P,setImageScaleMode:C,setPdfPage:W,setPdfScale:E,setPdfFitWidth:V}),N(F=>F+1)}catch(m){v({title:Q(m,d("conversation.fileViewerRefreshFailed")),tone:"error"})}finally{p(!1)}}}async function Re(){if(!B)return;const m=await j.bridge.openExternal(B);m.ok||v({title:m.detail??d("conversation.fileViewerOpenExternalFailed"),tone:"error"})}const Y=Ke({canShowPreviewTab:Ce,canShowCodeTab:Pe,canEdit:R}),Te=et({preview:i,canOpenExternal:!!B,isDirty:G,handleRefreshPreview:Ve,handleOpenExternal:Re,imageScaleMode:se,imageScale:oe,setImageScale:P,setImageScaleMode:C,pdfPage:H,setPdfPage:W,pdfScale:_,setPdfScale:E,pdfFitWidth:Z,setPdfFitWidth:V});return a.jsxs(De,{open:n,title:t,description:d("conversation.fileViewerHint").replace("{language}",ce),size:y,layout:"viewer",className:`file-viewer-modal${j.isDesktop&&y!=="full"?" is-resizable":""}`,bodyClassName:"file-viewer-modal-body",onClose:r,children:[a.jsxs("div",{className:"file-viewer-toolbar",children:[a.jsxs("div",{className:"file-viewer-toolbar-start",children:[a.jsxs("div",{className:"file-viewer-tabs",role:"tablist","aria-label":d("conversation.fileViewerModeLabel"),children:[Y.includes("preview")?a.jsx("button",{type:"button",className:"file-viewer-tab","data-active":g==="preview",role:"tab","aria-selected":g==="preview",onClick:()=>w("preview"),children:d("conversation.fileViewerPreview")}):null,Y.includes("code")?a.jsx("button",{type:"button",className:"file-viewer-tab","data-active":g==="code",role:"tab","aria-selected":g==="code",onClick:()=>w("code"),children:d("conversation.fileViewerCode")}):null,Y.includes("edit")?a.jsx("button",{type:"button",className:"file-viewer-tab","data-active":g==="edit",role:"tab","aria-selected":g==="edit",onClick:()=>w("edit"),disabled:!R,children:d("conversation.fileViewerEdit")}):null]}),a.jsx("span",{className:"file-viewer-language",children:ce})]}),a.jsxs("div",{className:"file-viewer-toolbar-end",children:[a.jsxs("div",{className:"file-viewer-size-group",role:"group","aria-label":d("conversation.fileViewerSizeLabel"),children:[a.jsx("button",{type:"button",className:"secondary-button file-viewer-action-button","data-active":y==="regular",onClick:()=>$("regular"),children:d("conversation.fileViewerSizeDefault")}),a.jsx("button",{type:"button",className:"secondary-button file-viewer-action-button","data-active":y==="full",onClick:()=>$("full"),children:d("conversation.fileViewerSizeFull")})]}),a.jsx("div",{className:"file-viewer-actions",children:Te.map(m=>a.jsx("button",{type:"button",className:"secondary-button file-viewer-action-button","data-active":m.active?"true":void 0,onClick:()=>void m.onClick(),disabled:m.disabled,children:m.label},m.id))}),R?a.jsx("button",{type:"button",className:"primary-button",onClick:()=>void Ee(),disabled:!G||k,children:k?d("conversation.filePanelSaving"):d("conversation.filePanelSave")}):null]})]}),a.jsx("div",{className:"file-viewer-body",children:f?a.jsx("p",{className:"status-text",children:d("common.loading")}):(i==null?void 0:i.supported)===!1?a.jsx("p",{className:"status-text",children:i.reason??d("conversation.filePanelUnsupported")}):g==="edit"?a.jsx(lt,{content:c,deferredContent:Ne,language:I,useInlineRenderedEditor:We,onContentChange:h}):g==="preview"&&x==="html"?a.jsx(at,{src:Le,filePath:t}):g==="preview"&&x==="image"?a.jsx(ut,{src:Se,filePath:t,scale:oe,scaleMode:se}):g==="preview"&&x==="pdf"?a.jsx(ft,{src:je,filePath:t}):g==="preview"&&x==="markdown"?a.jsx(ht,{content:c}):a.jsx(mt,{content:c,language:I,overviewMarkers:be})})]})}function pe(e,t){return t==="markdown"||t==="html"||t==="image"||t==="pdf"||Tt(e??"")||zt(e??"")?"preview":"code"}function X(e,t,n){n.setPreview(e),n.setEditorContent(e.content??""),n.setMode(r=>n.preserveMode&&Xe(r,e.kind)?r:pe(t,e.kind)),ge(n)}function ge(e){e.setResourceRefreshVersion(0),e.setImageScale(1),e.setImageScaleMode("fit"),e.setPdfPage(1),e.setPdfScale(110),e.setPdfFitWidth(!0)}function we(e){return e==="markdown"||e==="html"||e==="image"||e==="pdf"}function K(e){return e==="text"||e==="markdown"||e==="html"}function Xe(e,t){return e==="preview"?we(t):K(t)}function Qe(e,t){return e==="text"&&Rt(t)}function Ke(e){const t=[];return e.canShowPreviewTab&&t.push("preview"),e.canShowCodeTab?(t.push("code"),t.push("edit")):e.canEdit&&t.push("edit"),t}function et(e){var r,o;if(!((r=e.preview)!=null&&r.supported))return[];const t=[],n=!((o=e.preview.capabilities)!=null&&o.canRefresh)||e.isDirty;return e.preview.kind==="image"&&t.push({id:"image-zoom-out",label:d("conversation.fileViewerZoomOut"),onClick:()=>{e.setImageScaleMode("custom"),e.setImageScale(s=>Math.max(.25,fe(s-.25)))}},{id:"image-zoom-in",label:d("conversation.fileViewerZoomIn"),onClick:()=>{e.setImageScaleMode("custom"),e.setImageScale(s=>Math.min(4,fe(s+.25)))}},{id:"image-fit",label:d("conversation.fileViewerFit"),active:e.imageScaleMode==="fit",onClick:()=>{e.setImageScaleMode("fit"),e.setImageScale(1)}},{id:"image-actual",label:d("conversation.fileViewerActualSize"),active:e.imageScaleMode==="actual",onClick:()=>{e.setImageScaleMode("actual"),e.setImageScale(1)}},{id:"image-refresh",label:d("conversation.fileViewerRefreshPreview"),disabled:n,onClick:e.handleRefreshPreview}),e.preview.kind==="pdf"&&t.push({id:"pdf-prev-page",label:d("conversation.fileViewerPreviousPage"),disabled:e.pdfPage<=1,onClick:()=>e.setPdfPage(s=>Math.max(1,s-1))},{id:"pdf-page-indicator",label:d("conversation.fileViewerPageIndicator").replace("{page}",String(e.pdfPage)),disabled:!0,onClick:()=>{}},{id:"pdf-next-page",label:d("conversation.fileViewerNextPage"),onClick:()=>e.setPdfPage(s=>s+1)},{id:"pdf-zoom-out",label:d("conversation.fileViewerZoomOut"),onClick:()=>{e.setPdfFitWidth(!1),e.setPdfScale(s=>Math.max(50,Math.round(s-10)))}},{id:"pdf-zoom-in",label:d("conversation.fileViewerZoomIn"),onClick:()=>{e.setPdfFitWidth(!1),e.setPdfScale(s=>Math.min(300,Math.round(s+10)))}},{id:"pdf-fit-width",label:d("conversation.fileViewerFitWidth"),active:e.pdfFitWidth,onClick:()=>e.setPdfFitWidth(!0)},{id:"pdf-refresh",label:d("conversation.fileViewerRefreshPreview"),disabled:n,onClick:e.handleRefreshPreview}),(e.preview.kind==="html"||e.preview.kind==="markdown"||e.preview.kind==="text")&&t.push({id:"text-refresh",label:d("conversation.fileViewerRefreshPreview"),disabled:n,onClick:e.handleRefreshPreview}),e.canOpenExternal&&t.push({id:"open-external",label:d("conversation.fileViewerOpenExternal"),onClick:e.handleOpenExternal}),t}function tt(e,t){switch(e){case"image":return d("conversation.fileViewerImage");case"pdf":return d("conversation.fileViewerPdf");case"html":return"HTML";case"markdown":return"Markdown";default:return ie(t)}}function ee(e,t){if(!e)return null;const n=new URL(e,window.location.origin);return n.searchParams.set("_preview",String(t)),n.hash="",n.toString()}function nt(e,t){var n;return e?!t&&e.previewPath&&typeof window<"u"&&((n=window.location)!=null&&n.origin)?new URL(e.previewPath,window.location.origin).toString():e.previewUrl??null:null}function rt(e,t){var n;if(!e)return null;if(e.previewPath){if(!t&&typeof window<"u"&&((n=window.location)!=null&&n.origin))return new URL(e.previewPath,window.location.origin).toString();if(t){const r=it(e.previewPath);if(r)return r}}return e.previewUrl??null}function it(e){try{const t=Ie(Fe()).baseUrl;return Ue(e,t)}catch{return null}}function st(e,t,n,r,o){const s=ee(e,t);if(!s)return null;const i=new URL(s,window.location.origin),l=new URLSearchParams;return l.set("page",String(n)),l.set("zoom",o?"page-width":String(r)),i.hash=l.toString(),i.toString()}function ot(e){var t;if(typeof window>"u"||!((t=window.location)!=null&&t.origin))return A;try{if(new URL(e,window.location.origin).origin!==window.location.origin)return _e}catch{return A}return A}function fe(e){return Math.round(e*100)/100}function at({src:e,filePath:t}){if(!e)return a.jsx("p",{className:"status-text",children:d("conversation.fileViewerHtmlPreviewUnavailable")});const n=ot(e);return a.jsx("div",{className:"file-viewer-html-frame-shell",children:a.jsx("iframe",{className:"file-viewer-html-frame","data-testid":"file-viewer-html-preview",title:t,src:e,sandbox:n},e)})}function lt(e){return e.useInlineRenderedEditor?a.jsx(ct,{content:e.content,deferredContent:e.deferredContent,language:e.language,onContentChange:e.onContentChange}):a.jsx("textarea",{className:"file-viewer-editor","data-testid":"file-viewer-editor",value:e.content,onChange:t=>e.onContentChange(t.target.value),spellCheck:!1})}function ct(e){const t=u.useRef(null);function n(r){const o=t.current;o&&(o.scrollTop=r.currentTarget.scrollTop,o.scrollLeft=r.currentTarget.scrollLeft)}return a.jsxs("div",{className:"file-viewer-inline-editor-shell",children:[a.jsx("div",{ref:t,className:"file-viewer-inline-editor-render","data-testid":"file-viewer-inline-render","aria-hidden":"true",children:a.jsx(dt,{content:e.deferredContent,language:e.language})}),a.jsx("textarea",{className:"file-viewer-editor file-viewer-editor-input","data-testid":"file-viewer-editor",value:e.content,onChange:r=>e.onContentChange(r.target.value),onScroll:n,spellCheck:!1})]})}function dt({content:e,language:t}){const n=e.split(/\r?\n/);return a.jsx("div",{className:"file-viewer-inline-editor-content",children:n.map((r,o)=>{const s=ve(r,t);return a.jsx("div",{className:"file-viewer-inline-editor-line",children:a.jsx("code",{className:"file-viewer-inline-editor-code",children:s.length?s.map((i,l)=>a.jsx("span",{className:`code-token ${i.kind}`,children:i.text},`${o}-${l}-${i.text}`)):a.jsx("span",{className:"code-token plain",children:" "})})},`${o}-${r}`)})})}function ut({src:e,filePath:t,scale:n,scaleMode:r}){return e?a.jsx("div",{className:"file-viewer-media-shell","data-mode":r,children:a.jsx("div",{className:"file-viewer-image-stage",children:a.jsx("img",{className:"file-viewer-image","data-testid":"file-viewer-image-preview","data-mode":r,src:e,alt:t,style:r==="fit"?void 0:{transform:`scale(${n})`}})})}):a.jsx("p",{className:"status-text",children:d("conversation.fileViewerImageUnavailable")})}function ft({src:e,filePath:t}){return e?a.jsx("div",{className:"file-viewer-pdf-shell",children:a.jsx("iframe",{className:"file-viewer-pdf-frame","data-testid":"file-viewer-pdf-preview",title:t,src:e},e)}):a.jsx("p",{className:"status-text",children:d("conversation.fileViewerPdfUnavailable")})}function ht({content:e}){return a.jsx("div",{className:"markdown-content file-viewer-markdown",children:a.jsx($e,{remarkPlugins:[He],components:{pre(t){const n=gt(t.children);return n?a.jsx(pt,{content:n.content,language:n.language,codeClassName:n.codeClassName}):a.jsx("pre",{children:t.children})},code(t){const n=typeof t.className=="string"?t.className:"";return a.jsx("code",{className:n||void 0,children:t.children})}},children:e})})}function mt({content:e,language:t,overviewMarkers:n=[]}){const r=e.split(/\r?\n/),o=u.useRef(null),s=u.useMemo(()=>{const i=new Map;for(const l of n)for(let c=0;c<l.span;c++)i.set(l.line+c,l.kind);return i},[n]);return a.jsxs("div",{className:"file-viewer-code-block",children:[a.jsxs("div",{className:"file-viewer-code-header",children:[a.jsx("span",{className:"file-viewer-code-header-label",children:ie(t)}),a.jsx(xe,{content:e})]}),a.jsxs("div",{className:"file-viewer-scroll-shell",children:[a.jsx("div",{className:"file-viewer-code-body",ref:o,children:r.map((i,l)=>{const c=ve(i,t),h=l+1,f=s.get(h);return a.jsxs("div",{className:`file-viewer-code-line${f?` diff-line-${f}`:""}`,children:[a.jsx("span",{className:"file-viewer-code-gutter",children:h}),a.jsx("code",{className:"file-viewer-code-content",children:c.length?c.map((p,k)=>a.jsx("span",{className:`code-token ${p.kind}`,children:p.text},`${l}-${k}-${p.text}`)):a.jsx("span",{className:"code-token plain",children:" "})})]},`${l}-${i}`)})}),a.jsx(Dt,{markers:n,totalLines:r.length,scrollContainerRef:o})]})]})}function pt({content:e,language:t,codeClassName:n}){const r=t?O(t):null;return a.jsxs("div",{className:"file-viewer-markdown-copy-block",children:[a.jsxs("div",{className:"file-viewer-markdown-copy-header",children:[a.jsx("span",{className:"file-viewer-markdown-copy-label",children:r?ie(r):d("conversation.fileViewerPlainText")}),a.jsx(xe,{content:e})]}),a.jsx("pre",{className:n,children:a.jsx("code",{children:e})})]})}function xe({content:e}){const{showToast:t}=he(),n=me(),[r,o]=u.useState(!1);if(!e.trim())return null;async function s(){if(!r){o(!0);try{await xt(e,n),t({title:d("conversation.copyContentSuccess"),tone:"success"})}catch(i){t({title:i instanceof Error?i.message:d("conversation.copyContentFailed"),tone:"error"})}finally{o(!1)}}}return a.jsx("button",{type:"button",className:"file-viewer-copy-button","aria-label":d("conversation.copyAction"),title:d("conversation.copyAction"),onClick:()=>void s(),disabled:r,children:a.jsx(It,{})})}function te(e){var t;return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(n=>te(n)).join(""):u.isValidElement(e)?te(((t=e.props)==null?void 0:t.children)??""):""}function gt(e){const t=Array.isArray(e)?e[0]:e;if(!u.isValidElement(t))return null;const n=t.props,r=typeof n.className=="string"?n.className:"",o=/language-([^\s]+)/.exec(r);return{content:te(n.children).replace(/\n$/,""),codeClassName:r||void 0,language:(o==null?void 0:o[1])??null}}function wt(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function xt(e,t){var n;if(!(t.isDesktop&&(await t.bridge.writeClipboardText(e)).ok)){if(typeof navigator<"u"&&((n=navigator.clipboard)!=null&&n.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!wt(e))throw new Error(d("conversation.copyContentFailed"))}}function ve(e,t){const n=O(t);return n==="json"?vt(e):n==="yaml"?St(e):n==="toml"?jt(e):n==="ini"?ke(e):n==="env"?Lt(e):n==="properties"?Mt(e):n==="conf"?Nt(e):n==="editorconfig"?Ct(e):n==="dockerfile"?Pt(e):n==="gitignore"?Wt(e):n==="log"?Et(e):n==="python"?z(e,Be,"#"):n==="shell"?z(e,Ge,"#"):n==="sql"?yt(e):n==="html"||n==="xml"?kt(e):n==="css"?bt(e):n==="markdown"?[{text:e,kind:"plain"}]:z(e,Ze,"//")}function z(e,t,n){const r=[];let o=0;for(;o<e.length;){const s=e.slice(o);if(s.startsWith(n)){r.push({text:s,kind:"comment"});break}const i=/^(?:'[^'\\]*(?:\\.[^'\\]*)*'|"[^"\\]*(?:\\.[^"\\]*)*"|`[^`\\]*(?:\\.[^`\\]*)*`)/.exec(s);if(i){r.push({text:i[0],kind:"string"}),o+=i[0].length;continue}const l=/^(?:0x[\da-fA-F]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/.exec(s);if(l){r.push({text:l[0],kind:"number"}),o+=l[0].length;continue}const c=/^[A-Za-z_][\w$-]*/.exec(s);if(c){const f=c[0],p=f.toLowerCase();f==="true"||f==="false"||p==="true"||p==="false"?r.push({text:f,kind:"boolean"}):f==="null"||f==="None"||p==="none"?r.push({text:f,kind:"null"}):t.has(f)||t.has(p)?r.push({text:f,kind:"keyword"}):r.push({text:f,kind:"plain"}),o+=f.length;continue}const h=/^(?:===|!==|==|!=|<=|>=|=>|&&|\|\||[+\-*/%=<>!?:|&^~]+)/.exec(s);if(h){r.push({text:h[0],kind:"operator"}),o+=h[0].length;continue}r.push({text:s[0]??"",kind:"plain"}),o+=1}return r}function vt(e){const t=[];let n=0;for(;n<e.length;){const r=e.slice(n),o=/^"(?:[^"\\]|\\.)*"/.exec(r);if(o){const c=e.slice(n+o[0].length).trimStart()[0];t.push({text:o[0],kind:c===":"?"attr":"string"}),n+=o[0].length;continue}const s=/^(?:-?\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i.exec(r);if(s){t.push({text:s[0],kind:"number"}),n+=s[0].length;continue}const i=/^(?:true|false|null)\b/.exec(r);if(i){const c=i[0]==="null"?"null":"boolean";t.push({text:i[0],kind:c}),n+=i[0].length;continue}const l=/^(?::|,|\{|\}|\[|\])/.exec(r);if(l){t.push({text:l[0],kind:"operator"}),n+=l[0].length;continue}t.push({text:r[0]??"",kind:"plain"}),n+=1}return t}function kt(e){const t=[];let n=0;for(;n<e.length;){const r=e.slice(n);if(r.startsWith("<!--")){t.push({text:r,kind:"comment"});break}const o=/^(<\/?[\w:-]+)/.exec(r);if(o){t.push({text:o[0],kind:"tag"}),n+=o[0].length;continue}const s=/^([\w:-]+)(=)/.exec(r);if(s){t.push({text:s[1]??"",kind:"attr"}),t.push({text:s[2]??"",kind:"operator"}),n+=s[0].length;continue}const i=/^(?:'[^']*'|"[^"]*")/.exec(r);if(i){t.push({text:i[0],kind:"string"}),n+=i[0].length;continue}const l=/^(?:\/?>)/.exec(r);if(l){t.push({text:l[0],kind:"operator"}),n+=l[0].length;continue}t.push({text:r[0]??"",kind:"plain"}),n+=1}return t}function bt(e){const t=[];let n=0;for(;n<e.length;){const r=e.slice(n);if(r.startsWith("/*")){t.push({text:r,kind:"comment"});break}const o=/^(?:'[^']*'|"[^"]*")/.exec(r);if(o){t.push({text:o[0],kind:"string"}),n+=o[0].length;continue}const s=/^([A-Za-z-]+)(\s*:)/.exec(r);if(s){t.push({text:s[1]??"",kind:"attr"}),t.push({text:s[2]??"",kind:"operator"}),n+=s[0].length;continue}const i=/^(?:#(?:[\da-fA-F]{3,8})|\d+(?:\.\d+)?(?:px|rem|em|vh|vw|%)?)/.exec(r);if(i){t.push({text:i[0],kind:"number"}),n+=i[0].length;continue}const l=/^(?:@media|@supports|@import|@keyframes)\b/.exec(r);if(l){t.push({text:l[0],kind:"keyword"}),n+=l[0].length;continue}const c=/^(?:[{}:;(),.>])/.exec(r);if(c){t.push({text:c[0],kind:"operator"}),n+=c[0].length;continue}t.push({text:r[0]??"",kind:"plain"}),n+=1}return t}function yt(e){return z(e,Ye,"--")}function St(e){const t=[];let n=0;for(;n<e.length;){const r=e.slice(n);if(r.startsWith("#")){t.push({text:r,kind:"comment"});break}const o=/^([A-Za-z0-9_.-]+)(\s*:)/.exec(r);if(o){t.push({text:o[1]??"",kind:"attr"}),t.push({text:o[2]??"",kind:"operator"}),n+=o[0].length;continue}const s=/^(?:'[^']*'|"[^"]*")/.exec(r);if(s){t.push({text:s[0],kind:"string"}),n+=s[0].length;continue}const i=/^(?:-?\d+(?:\.\d+)?)/.exec(r);if(i){t.push({text:i[0],kind:"number"}),n+=i[0].length;continue}const l=/^(?:true|false|yes|no|null|~)\b/i.exec(r);if(l){const h=l[0].toLowerCase(),f=h==="null"||h==="~"?"null":"boolean";t.push({text:l[0],kind:f}),n+=l[0].length;continue}const c=/^(?:[-?:,[\]{}|>])/.exec(r);if(c){t.push({text:c[0],kind:"operator"}),n+=c[0].length;continue}t.push({text:r[0]??"",kind:"plain"}),n+=1}return t}function jt(e){const t=[];let n=0;for(;n<e.length;){const r=e.slice(n);if(r.startsWith("#")){t.push({text:r,kind:"comment"});break}const o=/^(\[\[?[^\]]+\]?\])/.exec(r);if(o){t.push({text:o[0],kind:"tag"}),n+=o[0].length;continue}const s=/^([A-Za-z0-9_.-]+)(\s*=)/.exec(r);if(s){t.push({text:s[1]??"",kind:"attr"}),t.push({text:s[2]??"",kind:"operator"}),n+=s[0].length;continue}const i=D(r,{trueValues:["true"],falseValues:["false"],nullValues:[]});if(i){t.push(...i.tokens),n+=i.length;continue}const l=/^(?:[,[\]{}])/.exec(r);if(l){t.push({text:l[0],kind:"operator"}),n+=l[0].length;continue}t.push({text:r[0]??"",kind:"plain"}),n+=1}return t}function ke(e){const t=[];let n=0;for(;n<e.length;){const r=e.slice(n),o=r.trimStart();if(o.startsWith(";")||o.startsWith("#")){t.push({text:r,kind:"comment"});break}const s=/^(\[[^\]]+\])/.exec(r);if(s){t.push({text:s[0],kind:"tag"}),n+=s[0].length;continue}const i=/^([A-Za-z0-9_.-]+)(\s*[=:])/.exec(r);if(i){t.push({text:i[1]??"",kind:"attr"}),t.push({text:i[2]??"",kind:"operator"}),n+=i[0].length;continue}const l=D(r,{trueValues:["true","yes","on"],falseValues:["false","no","off"],nullValues:["null"]});if(l){t.push(...l.tokens),n+=l.length;continue}t.push({text:r[0]??"",kind:"plain"}),n+=1}return t}function Lt(e){if(e.trimStart().startsWith("#"))return[{text:e,kind:"comment"}];const n=/^(\s*)(export)(\s+)/.exec(e),r=n?n[0].length:0,o=[];n&&(o.push({text:n[1]??"",kind:"plain"}),o.push({text:n[2]??"",kind:"keyword"}),o.push({text:n[3]??"",kind:"plain"}));const s=e.slice(r),i=/^([A-Za-z_][A-Za-z0-9_]*)(=)/.exec(s);if(!i)return ke(e);o.push({text:i[1]??"",kind:"attr"}),o.push({text:i[2]??"",kind:"operator"});const l=s.slice(i[0].length),c=D(l,{trueValues:["true"],falseValues:["false"],nullValues:["null"]});return c?(o.push(...c.tokens),o):(o.push({text:l,kind:"plain"}),o)}function Mt(e){return ne(e,{commentPrefixes:["#","!"],allowSection:!1,delimiters:["=",":"]})}function Nt(e){return ne(e,{commentPrefixes:["#",";"],allowSection:!0,delimiters:["=",":"]})}function Ct(e){return ne(e,{commentPrefixes:["#",";"],allowSection:!0,delimiters:["="]})}function Pt(e){return z(e,Je,"#")}function Wt(e){const t=e.trimStart();if(!t)return[];if(t.startsWith("#"))return[{text:e,kind:"comment"}];if(t.startsWith("!")){const n=e.length-t.length,r=e.slice(0,n),o=t.slice(1);return[{text:r,kind:"plain"},{text:"!",kind:"operator"},{text:o,kind:"string"}]}return[{text:e,kind:"string"}]}function Et(e){const t=[];let n=0;for(;n<e.length;){const r=e.slice(n);if(r.startsWith("#")){t.push({text:r,kind:"comment"});break}const o=/^(?:\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(?:[.,]\d{3,6})?(?:Z|[+-]\d{2}:\d{2})?)/.exec(r);if(o){t.push({text:o[0],kind:"tag"}),n+=o[0].length;continue}const s=/^(?:\[(TRACE|DEBUG|INFO|WARN|WARNING|ERROR|FATAL)\])/.exec(r);if(s){t.push({text:r.slice(0,s[0].length),kind:"keyword"}),n+=s[0].length;continue}const i=/^[A-Za-z_][\w-]*/.exec(r);if(i){const c=i[0];qe.has(c.toLowerCase())?t.push({text:c,kind:"keyword"}):t.push({text:c,kind:"plain"}),n+=c.length;continue}const l=/^(?:\d+(?:\.\d+)?)/.exec(r);if(l){t.push({text:l[0],kind:"number"}),n+=l[0].length;continue}t.push({text:r[0]??"",kind:"plain"}),n+=1}return t}function ne(e,t){const n=e.trimStart();if(t.commentPrefixes.some(c=>n.startsWith(c)))return[{text:e,kind:"comment"}];if(t.allowSection){const c=/^(\[[^\]]+\])/.exec(e);if(c)return[{text:c[0],kind:"tag"}]}const r=/^([A-Za-z0-9_.\-*?]+)(\s*(?:=|:))/.exec(e);if(!r)return[{text:e,kind:"plain"}];const o=(r[2]??"").trim();if(!t.delimiters.includes(o))return[{text:e,kind:"plain"}];const s=[{text:r[1]??"",kind:"attr"},{text:r[2]??"",kind:"operator"}],i=e.slice(r[0].length),l=Vt(i);return l.length&&s.push(...l),s}function Vt(e){if(!e)return[];const t=[];let n=0;for(;n<e.length;){const r=e.slice(n),o=D(r,{trueValues:["true","yes","on"],falseValues:["false","no","off"],nullValues:["null"]});if(o){t.push(...o.tokens),n+=o.length;continue}if(r.startsWith("#")||r.startsWith(";")){t.push({text:r,kind:"comment"});break}t.push({text:r[0]??"",kind:"plain"}),n+=1}return t}function D(e,t){const n=/^(?:'[^']*'|"[^"]*")/.exec(e);if(n)return{tokens:[{text:n[0],kind:"string"}],length:n[0].length};const r=/^(?:-?\d+(?:\.\d+)?)/.exec(e);if(r)return{tokens:[{text:r[0],kind:"number"}],length:r[0].length};const o=/^[A-Za-z0-9_.:+/-]+/.exec(e);if(!o)return null;const s=o[0],i=s.toLowerCase();return t.trueValues.includes(i)?{tokens:[{text:s,kind:"boolean"}],length:s.length}:t.falseValues.includes(i)?{tokens:[{text:s,kind:"boolean"}],length:s.length}:t.nullValues.includes(i)?{tokens:[{text:s,kind:"null"}],length:s.length}:{tokens:[{text:s,kind:"plain"}],length:s.length}}function re(e){var r,o;if(!e)return"plain";const t=((r=e.split(/[\\/]/).pop())==null?void 0:r.toLowerCase())??"";if(t===".env"||t.startsWith(".env."))return"env";if(t===".editorconfig")return"editorconfig";if(t==="dockerfile"||t.endsWith(".dockerfile"))return"dockerfile";if(t===".gitignore")return"gitignore";switch(((o=e.split(".").pop())==null?void 0:o.toLowerCase())??""){case"md":case"markdown":return"markdown";case"ts":case"tsx":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"json":return"json";case"log":return"log";case"properties":return"properties";case"toml":return"toml";case"ini":return"ini";case"conf":return"conf";case"dockerfile":return"dockerfile";case"css":case"scss":case"less":return"css";case"html":case"htm":return"html";case"xml":case"svg":return"xml";case"py":return"python";case"sh":case"bash":case"zsh":return"shell";case"sql":return"sql";case"yml":case"yaml":return"yaml";case"rs":return"rust";case"go":return"go";case"java":return"java";case"c":case"h":case"cpp":case"cc":case"hpp":return"cpp";default:return"plain"}}function O(e){const t=e.toLowerCase();switch(t){case"ts":case"tsx":case"typescript":return"typescript";case"js":case"jsx":case"javascript":return"javascript";case"bash":case"shell":case"sh":case"zsh":return"shell";case"md":case"markdown":return"markdown";case"properties":return"properties";case"toml":return"toml";case"ini":return"ini";case"env":return"env";case"conf":return"conf";case"editorconfig":return"editorconfig";case"dockerfile":return"dockerfile";case"gitignore":return"gitignore";case"log":return"log";default:return t}}function Rt(e){const t=O(e);return t==="json"||t==="yaml"||t==="toml"||t==="ini"||t==="env"||t==="properties"||t==="conf"||t==="editorconfig"||t==="dockerfile"||t==="gitignore"}function ie(e){switch(O(e)){case"typescript":return"TypeScript";case"javascript":return"JavaScript";case"markdown":return"Markdown";case"json":return"JSON";case"properties":return"Properties";case"toml":return"TOML";case"ini":return"INI";case"env":return"ENV";case"conf":return"CONF";case"editorconfig":return"EditorConfig";case"dockerfile":return"Dockerfile";case"gitignore":return"GitIgnore";case"log":return"Log";case"css":return"CSS";case"html":return"HTML";case"xml":return"XML";case"python":return"Python";case"shell":return"Shell";case"sql":return"SQL";case"yaml":return"YAML";case"rust":return"Rust";case"go":return"Go";case"java":return"Java";case"cpp":return"C/C++";default:return d("conversation.fileViewerPlainText")}}function Tt(e){return re(e)==="markdown"}function zt(e){return re(e)==="html"}function It(){return a.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[a.jsx("path",{d:"M5 2.5h7.5v9H5z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),a.jsx("path",{d:"M3.5 5H2.4V13.5H10V12.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function Q(e,t){return e instanceof Ae?e.message:t}function Ft(e){const t=[],n=e.replace(/\r\n/g,`
2
+ `).split(`
3
+ `);let r=0,o=0;for(const s of n){if(s.startsWith("diff --git")||s.startsWith("index ")||s.startsWith("--- ")||s.startsWith("+++ ")){t.push({kind:"meta",text:s,oldLineNo:null,newLineNo:null});continue}const i=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(s);if(i){r=parseInt(i[1],10),o=parseInt(i[2],10),t.push({kind:"hunk",text:s,oldLineNo:null,newLineNo:null});continue}if(s.startsWith(" ")||s===""){t.push({kind:"context",text:s.slice(1),oldLineNo:r,newLineNo:o}),r++,o++;continue}if(s.startsWith("+")){t.push({kind:"add",text:s.slice(1),oldLineNo:null,newLineNo:o}),o++;continue}if(s.startsWith("-")){t.push({kind:"remove",text:s.slice(1),oldLineNo:r,newLineNo:null}),r++;continue}t.push({kind:"meta",text:s,oldLineNo:null,newLineNo:null})}return t}function Ut(e){if(!(e!=null&&e.trim()))return[];const t=Ft(e),n=[];let r=0,o=[];function s(){if(o.length===0){r=0;return}const i=r>0?"modify":"add";At(n,o,i),r=0,o=[]}for(const i of t){if(i.kind==="remove"){r+=1;continue}if(i.kind==="add"){i.newLineNo!==null&&o.push(i.newLineNo);continue}s()}return s(),n}function At(e,t,n){const r=t.filter(i=>i>0);if(r.length===0)return;let o=r[0]??1,s=o;for(let i=1;i<r.length;i+=1){const l=r[i]??s;if(l===s+1){s=l;continue}e.push({line:o,span:s-o+1,kind:n}),o=l,s=l}e.push({line:o,span:s-o+1,kind:n})}function Dt({markers:e,totalLines:t,scrollContainerRef:n}){const[r,o]=u.useState({top:0,height:0});if(u.useEffect(()=>{const i=n.current;if(!i){o({top:0,height:0});return}const l=i;function c(){const{clientHeight:h,scrollHeight:f,scrollTop:p}=l;if(f<=0||h<=0||f<=h){o({top:0,height:0});return}const k=h/f,b=Math.min(100,Math.max(12,k*100)),g=f-h,w=Math.max(0,100-b),y=g<=0?0:p/g*w;o({top:y,height:b})}return c(),l.addEventListener("scroll",c,{passive:!0}),window.addEventListener("resize",c),()=>{l.removeEventListener("scroll",c),window.removeEventListener("resize",c)}},[n]),e.length===0&&r.height===0)return null;const s=Math.max(t,1);return a.jsxs("div",{className:"file-overview-ruler","data-testid":"file-overview-ruler","aria-hidden":"true",children:[e.map(i=>{const l=(i.line-1)/s*100,c=Math.max(2,i.span/s*100);return a.jsx("div",{className:`file-overview-marker is-${i.kind}`,"data-kind":i.kind,style:{top:`${l}%`,height:`${c}%`}},`${i.kind}-${i.line}-${i.span}`)}),r.height>0?a.jsx("div",{className:"file-overview-viewport",style:{top:`${r.top}%`,height:`${r.height}%`}}):null]})}function Bt(e){const t=e.toLowerCase();if(t===".env"||t.startsWith(".env."))return"ENV";if(t.endsWith(".d.ts"))return"DTS";switch(t.includes(".")?t.slice(t.lastIndexOf(".")+1):""){case"ts":return"TS";case"tsx":return"TSX";case"js":return"JS";case"jsx":return"JSX";case"json":return"{}";case"md":return"MD";case"css":return"CSS";case"scss":return"SASS";case"html":return"HTML";case"yml":case"yaml":return"YAML";case"png":case"jpg":case"jpeg":case"gif":case"svg":case"webp":return"IMG";case"txt":return"TXT";default:return"FILE"}}function Gt(e){const t=e.toLowerCase();return t===".env"||t.startsWith(".env.")?"env":t.endsWith(".md")?"md":t.endsWith(".css")||t.endsWith(".scss")?"style":t.endsWith(".png")||t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".gif")||t.endsWith(".svg")||t.endsWith(".webp")?"image":t.endsWith(".ts")||t.endsWith(".tsx")||t.endsWith(".js")||t.endsWith(".jsx")?"code":t.endsWith(".json")||t.endsWith(".yml")||t.endsWith(".yaml")?"data":"default"}export{Zt as F,Gt as a,Bt as r};