@alexjbarnes/cockpit 0.4.0 → 0.4.1

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 (373) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +2 -2
  3. package/.next/prerender-manifest.json +3 -3
  4. package/.next/server/app/(app)/agents/[name]/page.js +1 -1
  5. package/.next/server/app/(app)/agents/[name]/page.js.nft.json +1 -1
  6. package/.next/server/app/(app)/agents/[name]/page_client-reference-manifest.js +1 -1
  7. package/.next/server/app/(app)/agents/page.js +2 -2
  8. package/.next/server/app/(app)/agents/page.js.nft.json +1 -1
  9. package/.next/server/app/(app)/agents/page_client-reference-manifest.js +1 -1
  10. package/.next/server/app/(app)/claude-md/edit/page.js +1 -1
  11. package/.next/server/app/(app)/claude-md/edit/page.js.nft.json +1 -1
  12. package/.next/server/app/(app)/claude-md/edit/page_client-reference-manifest.js +1 -1
  13. package/.next/server/app/(app)/claude-md/page.js +1 -1
  14. package/.next/server/app/(app)/claude-md/page.js.nft.json +1 -1
  15. package/.next/server/app/(app)/claude-md/page_client-reference-manifest.js +1 -1
  16. package/.next/server/app/(app)/commands/[name]/page.js +1 -1
  17. package/.next/server/app/(app)/commands/[name]/page.js.nft.json +1 -1
  18. package/.next/server/app/(app)/commands/[name]/page_client-reference-manifest.js +1 -1
  19. package/.next/server/app/(app)/commands/page.js +2 -2
  20. package/.next/server/app/(app)/commands/page.js.nft.json +1 -1
  21. package/.next/server/app/(app)/commands/page_client-reference-manifest.js +1 -1
  22. package/.next/server/app/(app)/hooks/[event]/page.js +1 -1
  23. package/.next/server/app/(app)/hooks/[event]/page.js.nft.json +1 -1
  24. package/.next/server/app/(app)/hooks/[event]/page_client-reference-manifest.js +1 -1
  25. package/.next/server/app/(app)/hooks/page.js +2 -2
  26. package/.next/server/app/(app)/hooks/page.js.nft.json +1 -1
  27. package/.next/server/app/(app)/hooks/page_client-reference-manifest.js +1 -1
  28. package/.next/server/app/(app)/inbox/[id]/page.js +1 -1
  29. package/.next/server/app/(app)/inbox/[id]/page.js.nft.json +1 -1
  30. package/.next/server/app/(app)/inbox/[id]/page_client-reference-manifest.js +1 -1
  31. package/.next/server/app/(app)/inbox/page.js +2 -2
  32. package/.next/server/app/(app)/inbox/page.js.nft.json +1 -1
  33. package/.next/server/app/(app)/inbox/page_client-reference-manifest.js +1 -1
  34. package/.next/server/app/(app)/jobs/[id]/edit/page.js +2 -2
  35. package/.next/server/app/(app)/jobs/[id]/edit/page.js.nft.json +1 -1
  36. package/.next/server/app/(app)/jobs/[id]/edit/page_client-reference-manifest.js +1 -1
  37. package/.next/server/app/(app)/jobs/[id]/page.js +1 -1
  38. package/.next/server/app/(app)/jobs/[id]/page.js.nft.json +1 -1
  39. package/.next/server/app/(app)/jobs/[id]/page_client-reference-manifest.js +1 -1
  40. package/.next/server/app/(app)/jobs/[id]/runs/[runId]/page.js +1 -1
  41. package/.next/server/app/(app)/jobs/[id]/runs/[runId]/page.js.nft.json +1 -1
  42. package/.next/server/app/(app)/jobs/[id]/runs/[runId]/page_client-reference-manifest.js +1 -1
  43. package/.next/server/app/(app)/jobs/page.js +2 -2
  44. package/.next/server/app/(app)/jobs/page.js.nft.json +1 -1
  45. package/.next/server/app/(app)/jobs/page_client-reference-manifest.js +1 -1
  46. package/.next/server/app/(app)/mcp-servers/[name]/page.js +1 -1
  47. package/.next/server/app/(app)/mcp-servers/[name]/page.js.nft.json +1 -1
  48. package/.next/server/app/(app)/mcp-servers/[name]/page_client-reference-manifest.js +1 -1
  49. package/.next/server/app/(app)/mcp-servers/page.js +2 -2
  50. package/.next/server/app/(app)/mcp-servers/page.js.nft.json +1 -1
  51. package/.next/server/app/(app)/mcp-servers/page_client-reference-manifest.js +1 -1
  52. package/.next/server/app/(app)/page.js +2 -2
  53. package/.next/server/app/(app)/page.js.nft.json +1 -1
  54. package/.next/server/app/(app)/page_client-reference-manifest.js +1 -1
  55. package/.next/server/app/(app)/plugins/page.js +2 -2
  56. package/.next/server/app/(app)/plugins/page.js.nft.json +1 -1
  57. package/.next/server/app/(app)/plugins/page_client-reference-manifest.js +1 -1
  58. package/.next/server/app/(app)/reviews/[owner]/[repo]/[number]/page.js +1 -1
  59. package/.next/server/app/(app)/reviews/[owner]/[repo]/[number]/page.js.nft.json +1 -1
  60. package/.next/server/app/(app)/reviews/[owner]/[repo]/[number]/page_client-reference-manifest.js +1 -1
  61. package/.next/server/app/(app)/reviews/[owner]/[repo]/page.js +1 -1
  62. package/.next/server/app/(app)/reviews/[owner]/[repo]/page.js.nft.json +1 -1
  63. package/.next/server/app/(app)/reviews/[owner]/[repo]/page_client-reference-manifest.js +1 -1
  64. package/.next/server/app/(app)/reviews/page.js +2 -2
  65. package/.next/server/app/(app)/reviews/page.js.nft.json +1 -1
  66. package/.next/server/app/(app)/reviews/page_client-reference-manifest.js +1 -1
  67. package/.next/server/app/(app)/sessions/[id]/page.js +1 -1
  68. package/.next/server/app/(app)/sessions/[id]/page.js.nft.json +1 -1
  69. package/.next/server/app/(app)/sessions/[id]/page_client-reference-manifest.js +1 -1
  70. package/.next/server/app/(app)/settings/appearance/page.js +1 -1
  71. package/.next/server/app/(app)/settings/appearance/page.js.nft.json +1 -1
  72. package/.next/server/app/(app)/settings/appearance/page_client-reference-manifest.js +1 -1
  73. package/.next/server/app/(app)/settings/notifications/page.js +1 -1
  74. package/.next/server/app/(app)/settings/notifications/page.js.nft.json +1 -1
  75. package/.next/server/app/(app)/settings/notifications/page_client-reference-manifest.js +1 -1
  76. package/.next/server/app/(app)/settings/page.js +1 -1
  77. package/.next/server/app/(app)/settings/page.js.nft.json +1 -1
  78. package/.next/server/app/(app)/settings/page_client-reference-manifest.js +1 -1
  79. package/.next/server/app/(app)/settings/providers/[id]/page.js +1 -1
  80. package/.next/server/app/(app)/settings/providers/[id]/page.js.nft.json +1 -1
  81. package/.next/server/app/(app)/settings/providers/[id]/page_client-reference-manifest.js +1 -1
  82. package/.next/server/app/(app)/settings/providers/new/page.js +1 -1
  83. package/.next/server/app/(app)/settings/providers/new/page.js.nft.json +1 -1
  84. package/.next/server/app/(app)/settings/providers/new/page_client-reference-manifest.js +1 -1
  85. package/.next/server/app/(app)/settings/providers/page.js +1 -1
  86. package/.next/server/app/(app)/settings/providers/page.js.nft.json +1 -1
  87. package/.next/server/app/(app)/settings/providers/page_client-reference-manifest.js +1 -1
  88. package/.next/server/app/(app)/settings/session/page.js +2 -2
  89. package/.next/server/app/(app)/settings/session/page.js.nft.json +1 -1
  90. package/.next/server/app/(app)/settings/session/page_client-reference-manifest.js +1 -1
  91. package/.next/server/app/(app)/skills/[name]/page.js +1 -1
  92. package/.next/server/app/(app)/skills/[name]/page.js.nft.json +1 -1
  93. package/.next/server/app/(app)/skills/[name]/page_client-reference-manifest.js +1 -1
  94. package/.next/server/app/(app)/skills/page.js +2 -2
  95. package/.next/server/app/(app)/skills/page.js.nft.json +1 -1
  96. package/.next/server/app/(app)/skills/page_client-reference-manifest.js +1 -1
  97. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  98. package/.next/server/app/_global-error.html +1 -1
  99. package/.next/server/app/_global-error.rsc +1 -1
  100. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  101. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  102. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  103. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  104. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  105. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  106. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  107. package/.next/server/app/_not-found.html +1 -1
  108. package/.next/server/app/_not-found.rsc +2 -2
  109. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  110. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  111. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  112. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  113. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  114. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  115. package/.next/server/app/agents.html +1 -1
  116. package/.next/server/app/agents.rsc +4 -4
  117. package/.next/server/app/agents.segments/!KGFwcCk/agents/__PAGE__.segment.rsc +2 -2
  118. package/.next/server/app/agents.segments/!KGFwcCk/agents.segment.rsc +1 -1
  119. package/.next/server/app/agents.segments/!KGFwcCk.segment.rsc +2 -2
  120. package/.next/server/app/agents.segments/_full.segment.rsc +4 -4
  121. package/.next/server/app/agents.segments/_head.segment.rsc +1 -1
  122. package/.next/server/app/agents.segments/_index.segment.rsc +2 -2
  123. package/.next/server/app/agents.segments/_tree.segment.rsc +2 -2
  124. package/.next/server/app/api/jobs/[id]/runs/[runId]/route.js +1 -1
  125. package/.next/server/app/api/jobs/[id]/runs/route.js +1 -1
  126. package/.next/server/app/api/jobs/status/route.js +1 -1
  127. package/.next/server/app/api/plugins/[id]/route.js +1 -1
  128. package/.next/server/app/api/plugins/install/route.js +1 -1
  129. package/.next/server/app/api/plugins/marketplaces/[name]/route.js +1 -1
  130. package/.next/server/app/api/plugins/marketplaces/route.js +1 -1
  131. package/.next/server/app/api/plugins/route.js +1 -1
  132. package/.next/server/app/api/providers/[id]/route.js +1 -1
  133. package/.next/server/app/api/providers/route.js +1 -1
  134. package/.next/server/app/api/sessions/[id]/tabs/route.js +1 -1
  135. package/.next/server/app/claude-md/edit.html +1 -1
  136. package/.next/server/app/claude-md/edit.rsc +4 -4
  137. package/.next/server/app/claude-md/edit.segments/!KGFwcCk/claude-md/edit/__PAGE__.segment.rsc +2 -2
  138. package/.next/server/app/claude-md/edit.segments/!KGFwcCk/claude-md/edit.segment.rsc +1 -1
  139. package/.next/server/app/claude-md/edit.segments/!KGFwcCk/claude-md.segment.rsc +1 -1
  140. package/.next/server/app/claude-md/edit.segments/!KGFwcCk.segment.rsc +2 -2
  141. package/.next/server/app/claude-md/edit.segments/_full.segment.rsc +4 -4
  142. package/.next/server/app/claude-md/edit.segments/_head.segment.rsc +1 -1
  143. package/.next/server/app/claude-md/edit.segments/_index.segment.rsc +2 -2
  144. package/.next/server/app/claude-md/edit.segments/_tree.segment.rsc +2 -2
  145. package/.next/server/app/claude-md.html +1 -1
  146. package/.next/server/app/claude-md.rsc +4 -4
  147. package/.next/server/app/claude-md.segments/!KGFwcCk/claude-md/__PAGE__.segment.rsc +2 -2
  148. package/.next/server/app/claude-md.segments/!KGFwcCk/claude-md.segment.rsc +1 -1
  149. package/.next/server/app/claude-md.segments/!KGFwcCk.segment.rsc +2 -2
  150. package/.next/server/app/claude-md.segments/_full.segment.rsc +4 -4
  151. package/.next/server/app/claude-md.segments/_head.segment.rsc +1 -1
  152. package/.next/server/app/claude-md.segments/_index.segment.rsc +2 -2
  153. package/.next/server/app/claude-md.segments/_tree.segment.rsc +2 -2
  154. package/.next/server/app/commands.html +1 -1
  155. package/.next/server/app/commands.rsc +4 -4
  156. package/.next/server/app/commands.segments/!KGFwcCk/commands/__PAGE__.segment.rsc +2 -2
  157. package/.next/server/app/commands.segments/!KGFwcCk/commands.segment.rsc +1 -1
  158. package/.next/server/app/commands.segments/!KGFwcCk.segment.rsc +2 -2
  159. package/.next/server/app/commands.segments/_full.segment.rsc +4 -4
  160. package/.next/server/app/commands.segments/_head.segment.rsc +1 -1
  161. package/.next/server/app/commands.segments/_index.segment.rsc +2 -2
  162. package/.next/server/app/commands.segments/_tree.segment.rsc +2 -2
  163. package/.next/server/app/hooks.html +1 -1
  164. package/.next/server/app/hooks.rsc +4 -4
  165. package/.next/server/app/hooks.segments/!KGFwcCk/hooks/__PAGE__.segment.rsc +2 -2
  166. package/.next/server/app/hooks.segments/!KGFwcCk/hooks.segment.rsc +1 -1
  167. package/.next/server/app/hooks.segments/!KGFwcCk.segment.rsc +2 -2
  168. package/.next/server/app/hooks.segments/_full.segment.rsc +4 -4
  169. package/.next/server/app/hooks.segments/_head.segment.rsc +1 -1
  170. package/.next/server/app/hooks.segments/_index.segment.rsc +2 -2
  171. package/.next/server/app/hooks.segments/_tree.segment.rsc +2 -2
  172. package/.next/server/app/inbox.html +1 -1
  173. package/.next/server/app/inbox.rsc +4 -4
  174. package/.next/server/app/inbox.segments/!KGFwcCk/inbox/__PAGE__.segment.rsc +2 -2
  175. package/.next/server/app/inbox.segments/!KGFwcCk/inbox.segment.rsc +1 -1
  176. package/.next/server/app/inbox.segments/!KGFwcCk.segment.rsc +2 -2
  177. package/.next/server/app/inbox.segments/_full.segment.rsc +4 -4
  178. package/.next/server/app/inbox.segments/_head.segment.rsc +1 -1
  179. package/.next/server/app/inbox.segments/_index.segment.rsc +2 -2
  180. package/.next/server/app/inbox.segments/_tree.segment.rsc +2 -2
  181. package/.next/server/app/index.html +1 -1
  182. package/.next/server/app/index.rsc +4 -4
  183. package/.next/server/app/index.segments/!KGFwcCk/__PAGE__.segment.rsc +2 -2
  184. package/.next/server/app/index.segments/!KGFwcCk.segment.rsc +2 -2
  185. package/.next/server/app/index.segments/_full.segment.rsc +4 -4
  186. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  187. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  188. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  189. package/.next/server/app/jobs.html +1 -1
  190. package/.next/server/app/jobs.rsc +4 -4
  191. package/.next/server/app/jobs.segments/!KGFwcCk/jobs/__PAGE__.segment.rsc +2 -2
  192. package/.next/server/app/jobs.segments/!KGFwcCk/jobs.segment.rsc +1 -1
  193. package/.next/server/app/jobs.segments/!KGFwcCk.segment.rsc +2 -2
  194. package/.next/server/app/jobs.segments/_full.segment.rsc +4 -4
  195. package/.next/server/app/jobs.segments/_head.segment.rsc +1 -1
  196. package/.next/server/app/jobs.segments/_index.segment.rsc +2 -2
  197. package/.next/server/app/jobs.segments/_tree.segment.rsc +2 -2
  198. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  199. package/.next/server/app/login.html +1 -1
  200. package/.next/server/app/login.rsc +2 -2
  201. package/.next/server/app/login.segments/_full.segment.rsc +2 -2
  202. package/.next/server/app/login.segments/_head.segment.rsc +1 -1
  203. package/.next/server/app/login.segments/_index.segment.rsc +2 -2
  204. package/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  205. package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
  206. package/.next/server/app/login.segments/login.segment.rsc +1 -1
  207. package/.next/server/app/mcp-servers.html +1 -1
  208. package/.next/server/app/mcp-servers.rsc +4 -4
  209. package/.next/server/app/mcp-servers.segments/!KGFwcCk/mcp-servers/__PAGE__.segment.rsc +2 -2
  210. package/.next/server/app/mcp-servers.segments/!KGFwcCk/mcp-servers.segment.rsc +1 -1
  211. package/.next/server/app/mcp-servers.segments/!KGFwcCk.segment.rsc +2 -2
  212. package/.next/server/app/mcp-servers.segments/_full.segment.rsc +4 -4
  213. package/.next/server/app/mcp-servers.segments/_head.segment.rsc +1 -1
  214. package/.next/server/app/mcp-servers.segments/_index.segment.rsc +2 -2
  215. package/.next/server/app/mcp-servers.segments/_tree.segment.rsc +2 -2
  216. package/.next/server/app/plugins.html +1 -1
  217. package/.next/server/app/plugins.rsc +4 -4
  218. package/.next/server/app/plugins.segments/!KGFwcCk/plugins/__PAGE__.segment.rsc +2 -2
  219. package/.next/server/app/plugins.segments/!KGFwcCk/plugins.segment.rsc +1 -1
  220. package/.next/server/app/plugins.segments/!KGFwcCk.segment.rsc +2 -2
  221. package/.next/server/app/plugins.segments/_full.segment.rsc +4 -4
  222. package/.next/server/app/plugins.segments/_head.segment.rsc +1 -1
  223. package/.next/server/app/plugins.segments/_index.segment.rsc +2 -2
  224. package/.next/server/app/plugins.segments/_tree.segment.rsc +2 -2
  225. package/.next/server/app/reviews.html +1 -1
  226. package/.next/server/app/reviews.rsc +4 -4
  227. package/.next/server/app/reviews.segments/!KGFwcCk/reviews/__PAGE__.segment.rsc +2 -2
  228. package/.next/server/app/reviews.segments/!KGFwcCk/reviews.segment.rsc +1 -1
  229. package/.next/server/app/reviews.segments/!KGFwcCk.segment.rsc +2 -2
  230. package/.next/server/app/reviews.segments/_full.segment.rsc +4 -4
  231. package/.next/server/app/reviews.segments/_head.segment.rsc +1 -1
  232. package/.next/server/app/reviews.segments/_index.segment.rsc +2 -2
  233. package/.next/server/app/reviews.segments/_tree.segment.rsc +2 -2
  234. package/.next/server/app/settings/appearance.html +1 -1
  235. package/.next/server/app/settings/appearance.rsc +4 -4
  236. package/.next/server/app/settings/appearance.segments/!KGFwcCk/settings/appearance/__PAGE__.segment.rsc +2 -2
  237. package/.next/server/app/settings/appearance.segments/!KGFwcCk/settings/appearance.segment.rsc +1 -1
  238. package/.next/server/app/settings/appearance.segments/!KGFwcCk/settings.segment.rsc +1 -1
  239. package/.next/server/app/settings/appearance.segments/!KGFwcCk.segment.rsc +2 -2
  240. package/.next/server/app/settings/appearance.segments/_full.segment.rsc +4 -4
  241. package/.next/server/app/settings/appearance.segments/_head.segment.rsc +1 -1
  242. package/.next/server/app/settings/appearance.segments/_index.segment.rsc +2 -2
  243. package/.next/server/app/settings/appearance.segments/_tree.segment.rsc +2 -2
  244. package/.next/server/app/settings/notifications.html +1 -1
  245. package/.next/server/app/settings/notifications.rsc +4 -4
  246. package/.next/server/app/settings/notifications.segments/!KGFwcCk/settings/notifications/__PAGE__.segment.rsc +2 -2
  247. package/.next/server/app/settings/notifications.segments/!KGFwcCk/settings/notifications.segment.rsc +1 -1
  248. package/.next/server/app/settings/notifications.segments/!KGFwcCk/settings.segment.rsc +1 -1
  249. package/.next/server/app/settings/notifications.segments/!KGFwcCk.segment.rsc +2 -2
  250. package/.next/server/app/settings/notifications.segments/_full.segment.rsc +4 -4
  251. package/.next/server/app/settings/notifications.segments/_head.segment.rsc +1 -1
  252. package/.next/server/app/settings/notifications.segments/_index.segment.rsc +2 -2
  253. package/.next/server/app/settings/notifications.segments/_tree.segment.rsc +2 -2
  254. package/.next/server/app/settings/providers/new.html +1 -1
  255. package/.next/server/app/settings/providers/new.rsc +4 -4
  256. package/.next/server/app/settings/providers/new.segments/!KGFwcCk/settings/providers/new/__PAGE__.segment.rsc +2 -2
  257. package/.next/server/app/settings/providers/new.segments/!KGFwcCk/settings/providers/new.segment.rsc +1 -1
  258. package/.next/server/app/settings/providers/new.segments/!KGFwcCk/settings/providers.segment.rsc +1 -1
  259. package/.next/server/app/settings/providers/new.segments/!KGFwcCk/settings.segment.rsc +1 -1
  260. package/.next/server/app/settings/providers/new.segments/!KGFwcCk.segment.rsc +2 -2
  261. package/.next/server/app/settings/providers/new.segments/_full.segment.rsc +4 -4
  262. package/.next/server/app/settings/providers/new.segments/_head.segment.rsc +1 -1
  263. package/.next/server/app/settings/providers/new.segments/_index.segment.rsc +2 -2
  264. package/.next/server/app/settings/providers/new.segments/_tree.segment.rsc +2 -2
  265. package/.next/server/app/settings/providers.html +1 -1
  266. package/.next/server/app/settings/providers.rsc +4 -4
  267. package/.next/server/app/settings/providers.segments/!KGFwcCk/settings/providers/__PAGE__.segment.rsc +2 -2
  268. package/.next/server/app/settings/providers.segments/!KGFwcCk/settings/providers.segment.rsc +1 -1
  269. package/.next/server/app/settings/providers.segments/!KGFwcCk/settings.segment.rsc +1 -1
  270. package/.next/server/app/settings/providers.segments/!KGFwcCk.segment.rsc +2 -2
  271. package/.next/server/app/settings/providers.segments/_full.segment.rsc +4 -4
  272. package/.next/server/app/settings/providers.segments/_head.segment.rsc +1 -1
  273. package/.next/server/app/settings/providers.segments/_index.segment.rsc +2 -2
  274. package/.next/server/app/settings/providers.segments/_tree.segment.rsc +2 -2
  275. package/.next/server/app/settings/session.html +1 -1
  276. package/.next/server/app/settings/session.rsc +4 -4
  277. package/.next/server/app/settings/session.segments/!KGFwcCk/settings/session/__PAGE__.segment.rsc +2 -2
  278. package/.next/server/app/settings/session.segments/!KGFwcCk/settings/session.segment.rsc +1 -1
  279. package/.next/server/app/settings/session.segments/!KGFwcCk/settings.segment.rsc +1 -1
  280. package/.next/server/app/settings/session.segments/!KGFwcCk.segment.rsc +2 -2
  281. package/.next/server/app/settings/session.segments/_full.segment.rsc +4 -4
  282. package/.next/server/app/settings/session.segments/_head.segment.rsc +1 -1
  283. package/.next/server/app/settings/session.segments/_index.segment.rsc +2 -2
  284. package/.next/server/app/settings/session.segments/_tree.segment.rsc +2 -2
  285. package/.next/server/app/settings.html +1 -1
  286. package/.next/server/app/settings.rsc +4 -4
  287. package/.next/server/app/settings.segments/!KGFwcCk/settings/__PAGE__.segment.rsc +2 -2
  288. package/.next/server/app/settings.segments/!KGFwcCk/settings.segment.rsc +1 -1
  289. package/.next/server/app/settings.segments/!KGFwcCk.segment.rsc +2 -2
  290. package/.next/server/app/settings.segments/_full.segment.rsc +4 -4
  291. package/.next/server/app/settings.segments/_head.segment.rsc +1 -1
  292. package/.next/server/app/settings.segments/_index.segment.rsc +2 -2
  293. package/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
  294. package/.next/server/app/skills.html +1 -1
  295. package/.next/server/app/skills.rsc +4 -4
  296. package/.next/server/app/skills.segments/!KGFwcCk/skills/__PAGE__.segment.rsc +2 -2
  297. package/.next/server/app/skills.segments/!KGFwcCk/skills.segment.rsc +1 -1
  298. package/.next/server/app/skills.segments/!KGFwcCk.segment.rsc +2 -2
  299. package/.next/server/app/skills.segments/_full.segment.rsc +4 -4
  300. package/.next/server/app/skills.segments/_head.segment.rsc +1 -1
  301. package/.next/server/app/skills.segments/_index.segment.rsc +2 -2
  302. package/.next/server/app/skills.segments/_tree.segment.rsc +2 -2
  303. package/.next/server/chunks/1011.js +1 -1
  304. package/.next/server/chunks/1979.js +4 -4
  305. package/.next/server/chunks/3136.js +3 -3
  306. package/.next/server/chunks/{5292.js → 4734.js} +2 -2
  307. package/.next/server/chunks/7891.js +3 -1
  308. package/.next/server/middleware-build-manifest.js +1 -1
  309. package/.next/server/pages/404.html +1 -1
  310. package/.next/server/pages/500.html +1 -1
  311. package/.next/server/server-reference-manifest.json +1 -1
  312. package/.next/static/chunks/{25781-c77dc5d11fb85d82.js → 14371-46bd93e838a73082.js} +1 -1
  313. package/.next/static/chunks/{1550-9a32fa02f6722fc7.js → 1550-2b61396833da3dec.js} +4 -4
  314. package/.next/static/chunks/86939-ba1fb2321ef9cd80.js +1 -0
  315. package/.next/static/chunks/app/(app)/agents/[name]/{page-6954a12623e4bdcf.js → page-2b04446e17990f1a.js} +1 -1
  316. package/.next/static/chunks/app/(app)/agents/page-ba23fc2296a7be83.js +1 -0
  317. package/.next/static/chunks/app/(app)/claude-md/edit/{page-575c5ccdc585516c.js → page-a281913e0b8add64.js} +1 -1
  318. package/.next/static/chunks/app/(app)/claude-md/{page-aab6df0c14c657f3.js → page-2d96e3554ef23d18.js} +1 -1
  319. package/.next/static/chunks/app/(app)/commands/[name]/{page-ea86a4400fd29210.js → page-fb34a46c0c086dab.js} +1 -1
  320. package/.next/static/chunks/app/(app)/commands/page-3802984c62d8ac69.js +1 -0
  321. package/.next/static/chunks/app/(app)/hooks/[event]/{page-2c41e810c15a1149.js → page-9481839e736408cb.js} +1 -1
  322. package/.next/static/chunks/app/(app)/hooks/page-f430735f702c7219.js +1 -0
  323. package/.next/static/chunks/app/(app)/inbox/[id]/{page-885a258b67e47b00.js → page-aadeab885f4845b0.js} +1 -1
  324. package/.next/static/chunks/app/(app)/inbox/page-b95594cb0a1a5cac.js +1 -0
  325. package/.next/static/chunks/app/(app)/jobs/[id]/edit/page-cc5a314765daff0b.js +1 -0
  326. package/.next/static/chunks/app/(app)/jobs/[id]/{page-ba516fa01db89ea0.js → page-5890d22a832830ae.js} +1 -1
  327. package/.next/static/chunks/app/(app)/jobs/[id]/runs/[runId]/{page-0650e6f678fae5b8.js → page-0b99d3ca8a0db5a4.js} +1 -1
  328. package/.next/static/chunks/app/(app)/jobs/page-3112e52c1cf2a1c6.js +1 -0
  329. package/.next/static/chunks/app/(app)/{layout-3cd80708648e0723.js → layout-62bd7715bd974abb.js} +1 -1
  330. package/.next/static/chunks/app/(app)/mcp-servers/[name]/{page-9290a7940a32d9ac.js → page-c8586b1dc6f9824d.js} +1 -1
  331. package/.next/static/chunks/app/(app)/mcp-servers/page-bfc2a6ca8f7968c9.js +1 -0
  332. package/.next/static/chunks/app/(app)/page-7fa2e1ffac49c78b.js +1 -0
  333. package/.next/static/chunks/app/(app)/plugins/page-f37a96c5d3bd20a1.js +1 -0
  334. package/.next/static/chunks/app/(app)/reviews/[owner]/[repo]/[number]/{page-4396e9d6df189336.js → page-9bdb676f496d53bd.js} +1 -1
  335. package/.next/static/chunks/app/(app)/reviews/[owner]/[repo]/{page-76a072cbfe3d9f0e.js → page-200fefe31b935564.js} +1 -1
  336. package/.next/static/chunks/app/(app)/reviews/page-2b8118a506454063.js +1 -0
  337. package/.next/static/chunks/app/(app)/sessions/[id]/{page-95bcce2e0b9f827a.js → page-428e74d62712abe2.js} +1 -1
  338. package/.next/static/chunks/app/(app)/settings/appearance/{page-433fcfb9b95fb22e.js → page-e2b21c857330b047.js} +1 -1
  339. package/.next/static/chunks/app/(app)/settings/notifications/{page-e5309337f125a059.js → page-4c4e5802b3993e7f.js} +1 -1
  340. package/.next/static/chunks/app/(app)/settings/page-3c1d956c719f0160.js +1 -0
  341. package/.next/static/chunks/app/(app)/settings/providers/[id]/{page-2cacea2e60ba435c.js → page-020f2eab5c3a93ee.js} +1 -1
  342. package/.next/static/chunks/app/(app)/settings/providers/new/{page-d40acef3abfc7c19.js → page-9010d32aeca78d7f.js} +1 -1
  343. package/.next/static/chunks/app/(app)/settings/providers/{page-098d8f399c663944.js → page-d86ebcd6d1cb033d.js} +1 -1
  344. package/.next/static/chunks/app/(app)/settings/session/page-174370077dbb9079.js +1 -0
  345. package/.next/static/chunks/app/(app)/skills/[name]/{page-7dd7c0f316742c01.js → page-dfea5f58b95c01b6.js} +1 -1
  346. package/.next/static/chunks/app/(app)/skills/page-c33dbb722dbdf826.js +1 -0
  347. package/.next/static/css/4cc7360c7e3ca504.css +1 -0
  348. package/dist/src/lib/models.js +49 -1
  349. package/dist/src/server/claude-bin.js +14 -3
  350. package/dist/src/server/claude-settings.js +3 -0
  351. package/dist/src/server/mcp/cockpit-config-server.js +1 -1
  352. package/dist/src/server/pty-runtime.js +1 -0
  353. package/dist/src/server/session-manager.js +65 -25
  354. package/dist/src/server/transcript.js +26 -5
  355. package/dist/src/server/ws-handler.js +1 -1
  356. package/package.json +1 -1
  357. package/.next/static/chunks/86939-51ae17d3d12c0310.js +0 -1
  358. package/.next/static/chunks/app/(app)/agents/page-b984c01f39aed22e.js +0 -1
  359. package/.next/static/chunks/app/(app)/commands/page-3867a45c1378c6fe.js +0 -1
  360. package/.next/static/chunks/app/(app)/hooks/page-49f9dbb78a3f97df.js +0 -1
  361. package/.next/static/chunks/app/(app)/inbox/page-592249fc155b9fe4.js +0 -1
  362. package/.next/static/chunks/app/(app)/jobs/[id]/edit/page-121bf977a839488c.js +0 -1
  363. package/.next/static/chunks/app/(app)/jobs/page-da3fe23a43277e67.js +0 -1
  364. package/.next/static/chunks/app/(app)/mcp-servers/page-1e828264f81ee08c.js +0 -1
  365. package/.next/static/chunks/app/(app)/page-2d171ffc3e1945e1.js +0 -1
  366. package/.next/static/chunks/app/(app)/plugins/page-7e70e0b3ead44a99.js +0 -1
  367. package/.next/static/chunks/app/(app)/reviews/page-deaa44f0ce253da8.js +0 -1
  368. package/.next/static/chunks/app/(app)/settings/page-353ef8c508418af1.js +0 -1
  369. package/.next/static/chunks/app/(app)/settings/session/page-706118ba33c2b99f.js +0 -1
  370. package/.next/static/chunks/app/(app)/skills/page-48d0bbe201180fc8.js +0 -1
  371. package/.next/static/css/483101dd9c42fb97.css +0 -1
  372. /package/.next/static/{mmHo0MmzQHWjZATtI-VbH → NTa6G91R3HtKCLYuQqdR0}/_buildManifest.js +0 -0
  373. /package/.next/static/{mmHo0MmzQHWjZATtI-VbH → NTa6G91R3HtKCLYuQqdR0}/_ssgManifest.js +0 -0
@@ -164,12 +164,17 @@ class SessionManager {
164
164
  console.warn(`[cockpit-agent] onInit returned null for session ${id.slice(0, 8)}`);
165
165
  }
166
166
  }
167
- ensureSession(id, cwd) {
167
+ ensureSession(id, cwd, opts) {
168
168
  let session = this.sessions.get(id);
169
169
  if (!session) {
170
170
  const prefs = (0, session_prefs_1.getSessionPrefs)(id);
171
- const cliId = prefs?.cliSessionId || id;
172
- const prevIds = prefs?.previousCliSessionIds || [];
171
+ // pinCliSessionId forces the session to resume an exact transcript link
172
+ // (history-view continue), with that link's ancestors as the stitch chain,
173
+ // overriding the usual "resolve to the chain head" behaviour.
174
+ const cliId = opts?.pinCliSessionId || prefs?.cliSessionId || id;
175
+ const prevIds = opts?.pinCliSessionId
176
+ ? ((0, session_prefs_1.findChainForCliSession)(opts.pinCliSessionId)?.truncatedPrevIds ?? [])
177
+ : prefs?.previousCliSessionIds || [];
173
178
  const short = id.slice(0, 8);
174
179
  (0, debug_logger_1.debugLog)(`[session:${short}] ensureSession: cliSessionId=${cliId.slice(0, 8)}, prevIds=[${prevIds.map((p) => p.slice(0, 8)).join(",")}], hasPrefs=${!!prefs}`);
175
180
  const defaults = (0, defaults_1.getDefaults)();
@@ -263,15 +268,16 @@ class SessionManager {
263
268
  // pointer to a regular session (e.g. a hand-edited assistant.json) must not
264
269
  // be rehydrated here — it would lack the MCP-disable/permission restrictions.
265
270
  if (prefs?.cockpitAgent) {
266
- const cwd = (await (0, transcript_1.findSessionCwd)(prefs.cliSessionId || stored)) ?? (await (0, transcript_1.findSessionCwd)(stored));
267
- if (cwd) {
268
- // ensureSession rebuilds in-memory state and (Step 5) registers the MCP-disable
269
- // onInit listener. Model/thinking are restored from session-prefs which the
270
- // in-modal selector and the settings-page write-through both keep current
271
- // so no re-apply is needed here.
272
- this.ensureSession(stored, cwd);
273
- return stored;
274
- }
271
+ // The assistant's cwd is always getCockpitDir(); fall back to it when no
272
+ // transcript exists yet (the assistant was changed but never messaged) so
273
+ // its model/thinking still restore from session-prefs instead of the
274
+ // session being recreated from the assistant.json fallback (Sonnet/High).
275
+ const cwd = (await (0, transcript_1.findSessionCwd)(prefs.cliSessionId || stored)) ?? (await (0, transcript_1.findSessionCwd)(stored)) ?? (0, paths_1.getCockpitDir)();
276
+ // ensureSession rebuilds in-memory state and (Step 5) registers the MCP-disable
277
+ // onInit listener. Model/thinking are restored from session-prefs — which the
278
+ // in-modal selector keeps current — so no re-apply is needed here.
279
+ this.ensureSession(stored, cwd);
280
+ return stored;
275
281
  }
276
282
  }
277
283
  // No stored id, or its transcript is gone — create a fresh session seeded from
@@ -980,6 +986,8 @@ class SessionManager {
980
986
  const levels = this.modelEffortLevels(model);
981
987
  if (levels.length === 0)
982
988
  return null;
989
+ if (session.thinkingLevel === "off")
990
+ return "off";
983
991
  if (levels.includes(session.thinkingLevel))
984
992
  return session.thinkingLevel;
985
993
  return levels[levels.length - 1];
@@ -1002,7 +1010,7 @@ class SessionManager {
1002
1010
  const effortRequest = {
1003
1011
  type: "control_request",
1004
1012
  request_id: `effort-${Date.now()}`,
1005
- request: { subtype: "apply_flag_settings", settings: { effort: session.thinkingLevel } },
1013
+ request: { subtype: "apply_flag_settings", settings: this.thinkingFlagSettings(session.thinkingLevel) },
1006
1014
  };
1007
1015
  session.stdin.write(JSON.stringify(effortRequest) + "\n");
1008
1016
  }
@@ -1047,6 +1055,14 @@ class SessionManager {
1047
1055
  getModel(sessionId) {
1048
1056
  return this.sessions.get(sessionId)?.info.model || "sonnet";
1049
1057
  }
1058
+ /**
1059
+ * Settings patch for the CLI's apply_flag_settings / settings file. "off"
1060
+ * disables thinking via alwaysThinkingEnabled (there is no --effort value for
1061
+ * it); any other level sets effort and ensures thinking is enabled.
1062
+ */
1063
+ thinkingFlagSettings(level) {
1064
+ return level === "off" ? { alwaysThinkingEnabled: false } : { effort: level, alwaysThinkingEnabled: true };
1065
+ }
1050
1066
  setThinkingLevel(sessionId, level) {
1051
1067
  const session = this.sessions.get(sessionId);
1052
1068
  if (!session || session.thinkingLevel === level)
@@ -1058,7 +1074,7 @@ class SessionManager {
1058
1074
  const request = {
1059
1075
  type: "control_request",
1060
1076
  request_id: `effort-${Date.now()}`,
1061
- request: { subtype: "apply_flag_settings", settings: { effort: level } },
1077
+ request: { subtype: "apply_flag_settings", settings: this.thinkingFlagSettings(level) },
1062
1078
  };
1063
1079
  session.stdin.write(JSON.stringify(request) + "\n");
1064
1080
  }
@@ -1618,13 +1634,12 @@ class SessionManager {
1618
1634
  return true;
1619
1635
  }
1620
1636
  this.log(sessionId, `/model command: args="${args}", was=${session.info.model}`);
1621
- this.killProcess(session);
1622
- session.info.model = args;
1623
- session.info.status = "idle";
1624
- session.emitter.emit("status", sessionId, "idle");
1625
- (0, session_prefs_1.setSessionPrefs)(sessionId, { model: args });
1637
+ // Route through setModel so model + modelSlots.main + contextSize persist
1638
+ // together (and the process restarts correctly per runtime). Writing only
1639
+ // prefs.model left modelSlots.main stale, and rehydrate prefers modelSlots,
1640
+ // so the switch reverted on restart.
1641
+ this.setModel(sessionId, args);
1626
1642
  this.emitSystem(session, sessionId, `Model switched to ${args}`);
1627
- this.emitInfoUpdated(session, sessionId);
1628
1643
  return true;
1629
1644
  }
1630
1645
  case "/rename": {
@@ -1800,17 +1815,27 @@ Additional Cockpit rules beyond the CLI's defaults:
1800
1815
  - Read, Grep, Glob, and all other read-only tools: unrestricted.
1801
1816
  </system-reminder>`;
1802
1817
  }
1803
- async recoverSession(id) {
1818
+ async recoverSession(id, opts) {
1804
1819
  if (this.sessions.has(id))
1805
1820
  return true;
1806
1821
  smLog(id, "recovering session: not in memory, searching disk");
1807
1822
  const prefs = (0, session_prefs_1.getSessionPrefs)(id);
1808
- const cwd = (await (0, transcript_1.findSessionCwd)(prefs?.cliSessionId || id)) || (await (0, transcript_1.findSessionCwd)(id));
1823
+ const cwd = (await (0, transcript_1.findSessionCwd)(prefs?.cliSessionId || id)) || (await (0, transcript_1.findSessionCwd)(id)) || opts?.cwd;
1809
1824
  if (!cwd) {
1810
1825
  smLog(id, "recovery failed: no transcript found on disk");
1811
1826
  return false;
1812
1827
  }
1813
- this.ensureSession(id, cwd);
1828
+ // When recovered from a history-view deep link, `id` is the exact transcript
1829
+ // link being viewed, which may be an older link of a compacted/cleared chain.
1830
+ // Pin it as the cliSessionId so the resume continues that link (--resume
1831
+ // appends to the same file) instead of jumping to the chain head — otherwise
1832
+ // the view and the agent diverge.
1833
+ if (opts?.pinExact && (0, transcript_1.transcriptExists)(id, cwd)) {
1834
+ this.ensureSession(id, cwd, { pinCliSessionId: id });
1835
+ }
1836
+ else {
1837
+ this.ensureSession(id, cwd);
1838
+ }
1814
1839
  smLog(id, `recovery succeeded: restored from ${cwd}`);
1815
1840
  return true;
1816
1841
  }
@@ -1985,7 +2010,9 @@ Additional Cockpit rules beyond the CLI's defaults:
1985
2010
  if (cliModel) {
1986
2011
  args.push("--model", cliModel);
1987
2012
  }
1988
- if (this.modelEffortLevels(session.info.model).length > 0) {
2013
+ // "off" has no --effort value; thinking is disabled via a post-init
2014
+ // apply_flag_settings control request below instead.
2015
+ if (this.modelEffortLevels(session.info.model).length > 0 && session.thinkingLevel !== "off") {
1989
2016
  args.push("--effort", session.thinkingLevel);
1990
2017
  }
1991
2018
  const env = { ...process.env };
@@ -2063,6 +2090,16 @@ Additional Cockpit rules beyond the CLI's defaults:
2063
2090
  else if (session.bypassAllPermissions && !session.cockpitAgent) {
2064
2091
  this.sendPermissionMode(session, sessionId, "bypassPermissions");
2065
2092
  }
2093
+ // Thinking "off": there is no --effort value for it and stream mode has no
2094
+ // --settings file, so disable thinking as a settings patch over stdin.
2095
+ if (session.thinkingLevel === "off" && this.modelEffortLevels(session.info.model).length > 0) {
2096
+ const offRequest = {
2097
+ type: "control_request",
2098
+ request_id: `thinking-off-${Date.now()}`,
2099
+ request: { subtype: "apply_flag_settings", settings: { alwaysThinkingEnabled: false } },
2100
+ };
2101
+ proc.stdin.write(JSON.stringify(offRequest) + "\n");
2102
+ }
2066
2103
  if (text) {
2067
2104
  const content = this.buildContent(session, text, images, documents);
2068
2105
  const userInput = { type: "user", message: { role: "user", content } };
@@ -2214,7 +2251,9 @@ Additional Cockpit rules beyond the CLI's defaults:
2214
2251
  const cliModelPty = resolvedPty ? resolvedPty.model.modelId : session.info.model;
2215
2252
  if (cliModelPty)
2216
2253
  extraArgs.push("--model", cliModelPty);
2217
- if (this.modelEffortLevels(session.info.model).length > 0) {
2254
+ // "off" is applied via the settings file (alwaysThinkingEnabled:false) passed
2255
+ // to PtyRuntime below, not --effort (which has no "off" value).
2256
+ if (this.modelEffortLevels(session.info.model).length > 0 && session.thinkingLevel !== "off") {
2218
2257
  extraArgs.push("--effort", session.thinkingLevel);
2219
2258
  }
2220
2259
  if (session.planMode) {
@@ -2267,6 +2306,7 @@ Additional Cockpit rules beyond the CLI's defaults:
2267
2306
  claudeBin: (0, claude_bin_1.getClaudeBin)(),
2268
2307
  extraArgs,
2269
2308
  extraEnv,
2309
+ thinkingEnabled: session.thinkingLevel !== "off",
2270
2310
  onEvents: (events) => {
2271
2311
  const types = events.map((e) => e.type).join(", ");
2272
2312
  console.log(`[sm] pty onEvents for ${sessionId.slice(0, 8)}: [${types}]`);
@@ -239,6 +239,28 @@ const ANSI_RE = /\x1b\[[0-9;]*[a-zA-Z]/g;
239
239
  function stripAnsi(s) {
240
240
  return s.replace(ANSI_RE, "");
241
241
  }
242
+ // Adaptive-thinking models (Fable especially) can emit several thinking blocks
243
+ // in one turn. The CLI writes each as its own JSONL entry under a single
244
+ // message.id with a distinct signature, so the merge below would otherwise stack
245
+ // them; rendered as omitted-display empty strips they read as duplicates. Collapse
246
+ // adjacent thinking blocks into one, matching the live stream path
247
+ // (use-session.ts assistant:thinking). No-op for models that emit a single
248
+ // thinking block per turn (e.g. Opus), and non-adjacent thinking (interleaved
249
+ // around tool calls) is preserved.
250
+ function pushBlockCoalescingThinking(target, block) {
251
+ if (block.type === "thinking") {
252
+ const last = target[target.length - 1];
253
+ if (last && last.type === "thinking") {
254
+ last.text = last.text && block.text ? `${last.text}\n\n${block.text}` : last.text + block.text;
255
+ if (block.redacted)
256
+ last.redacted = true;
257
+ if (block.durationMs)
258
+ last.durationMs = block.durationMs;
259
+ return;
260
+ }
261
+ }
262
+ target.push(block);
263
+ }
242
264
  function parseLines(lines) {
243
265
  const messages = [];
244
266
  const messageById = new Map();
@@ -436,7 +458,7 @@ function parseLines(lines) {
436
458
  const redacted = !block.thinking && !!block.signature;
437
459
  if (!block.thinking && !redacted)
438
460
  continue;
439
- blocks.push({ type: "thinking", text: block.thinking ?? "", durationMs: thinkingDurationMs, redacted });
461
+ pushBlockCoalescingThinking(blocks, { type: "thinking", text: block.thinking ?? "", durationMs: thinkingDurationMs, redacted });
440
462
  }
441
463
  else if (block.type === "text" && block.text) {
442
464
  const cleaned = stripCliXml(block.text);
@@ -472,11 +494,10 @@ function parseLines(lines) {
472
494
  }
473
495
  }
474
496
  for (const b of blocks) {
475
- if (b.type === "tool_use") {
476
- if (existing.blocks.some((eb) => eb.type === "tool_use" && eb.toolUse.id === b.toolUse.id))
477
- continue;
497
+ if (b.type === "tool_use" && existing.blocks.some((eb) => eb.type === "tool_use" && eb.toolUse.id === b.toolUse.id)) {
498
+ continue;
478
499
  }
479
- existing.blocks.push(b);
500
+ pushBlockCoalescingThinking(existing.blocks, b);
480
501
  }
481
502
  }
482
503
  else {
@@ -535,7 +535,7 @@ function createWebSocketHandler(server, sessionManager, terminalManager) {
535
535
  }
536
536
  const sent = sessionManager.sendMessage(msg.sessionId, msg.text, msg.images, msg.documents);
537
537
  if (!sent) {
538
- sessionManager.recoverSession(msg.sessionId).then((recovered) => {
538
+ sessionManager.recoverSession(msg.sessionId, { cwd: msg.cwd, pinExact: msg.historyView }).then((recovered) => {
539
539
  if (recovered) {
540
540
  subscribeSession(msg.sessionId);
541
541
  sessionManager.sendMessage(msg.sessionId, msg.text, msg.images, msg.documents);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexjbarnes/cockpit",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Web UI for Claude Code",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Alex Barnes (https://github.com/alexjbarnes)",
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[86939],{86939:(e,t,s)=>{s.d(t,{Q:()=>j});var a=s(95155);let l=(0,s(99537).A)("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);var r=s(19707),n=s(12651),o=s(9005),d=s(2125),i=s(65738),x=s(12115),c=s(60529),m=s(8081);let u=["low","medium","high","xhigh","max"];function p(e){return/TOKEN|SECRET|PASSWORD/i.test(e)||e.toUpperCase().endsWith("_KEY")}function h({selected:e,onChange:t}){return(0,a.jsx)("div",{className:"ml-auto flex flex-wrap gap-1 justify-end",children:u.map(s=>(0,a.jsx)("button",{type:"button",onClick:()=>t(e.includes(s)?e.filter(e=>e!==s):[...e,s]),className:`rounded px-2 py-0.5 text-xs transition-colors ${e.includes(s)?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:s},s))})}function f({selected:e,onChange:t}){let s=Object.keys(m.XR);return(0,a.jsx)("div",{className:"ml-auto flex flex-wrap gap-1 justify-end",children:s.map(s=>{let l=e.includes(s);return(0,a.jsx)("button",{type:"button",onClick:()=>t(l?e.filter(e=>e!==s):[...e,s]),className:`rounded px-2 py-0.5 text-xs transition-colors ${l?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:m.XR[s].label},s)})})}function g({active:e,onClick:t,icon:s,label:l}){return(0,a.jsxs)("button",{onClick:t,className:`flex items-center gap-2 px-3 py-1.5 rounded text-xs font-medium transition-colors ${e?"bg-primary/10 text-primary":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,children:[s,l]})}function j({provider:e,isNew:t,onSave:s,onCancel:u,onDelete:v,lockedEnvKeys:y}){let[N,b]=(0,x.useState)("general"),[k,w]=(0,x.useState)(e.name),[C,S]=(0,x.useState)(Object.entries(e.envVars)),[E,I]=(0,x.useState)(e.models),[z,A]=(0,x.useState)(""),[D,L]=(0,x.useState)(""),[K,O]=(0,x.useState)(""),[R,_]=(0,x.useState)(""),[$,T]=(0,x.useState)([]),[M,V]=(0,x.useState)(["200k"]),[W,X]=(0,x.useState)(null),[Y,P]=(0,x.useState)(!1),q=new Set(y??[]),F=async()=>{if(k.trim()){P(!0);try{await s({...e,name:k,envVars:Object.fromEntries(C),models:E})}finally{P(!1)}}},G=()=>{z.trim()&&(S([...C,[z.trim(),D]]),A(""),L(""))},Q=()=>{let e=K.trim().replace(/\[.*\]$/,"");e&&M.length>0&&(I([...E,{modelId:e,displayName:R.trim()||e,effortLevels:$,contextSizes:M}]),O(""),_(""),T([]),V(["200k"]))},U=()=>{if(!W||0===W.contextSizes.length)return;let e=W.modelId.trim().replace(/\[.*\]$/,"");I(E.map((t,s)=>s===W.index?{modelId:e,displayName:W.displayName.trim()||e,effortLevels:W.effortLevels,contextSizes:W.contextSizes}:t)),X(null)};return(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[(0,a.jsxs)("div",{className:"flex gap-1 px-1 pb-3 border-b shrink-0",children:[(0,a.jsx)(g,{active:"general"===N,onClick:()=>b("general"),icon:(0,a.jsx)(l,{className:"h-3.5 w-3.5"}),label:"General"}),(0,a.jsx)(g,{active:"models"===N,onClick:()=>b("models"),icon:(0,a.jsx)(r.A,{className:"h-3.5 w-3.5"}),label:"Models"})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto py-4 space-y-4",children:["general"===N&&(0,a.jsxs)("div",{className:"space-y-4 sm:space-y-5",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-1.5 sm:gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(n.A,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,a.jsx)("span",{className:"text-xs font-medium text-foreground",children:"Name"})]}),(0,a.jsx)(c.p,{value:k,onChange:e=>w(e.target.value),placeholder:"e.g. OpenRouter",className:"sm:ml-auto sm:w-56 text-xs h-7"})]}),(0,a.jsxs)("div",{className:"space-y-2 sm:space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(l,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,a.jsx)("span",{className:"text-xs font-medium text-foreground",children:"Environment Variables"})]}),(0,a.jsx)("div",{className:"space-y-1.5",children:C.map(([e,t],s)=>{let l=q.has(e),r=p(e);return(0,a.jsxs)("div",{className:"rounded-lg border border-border px-3 py-2 text-xs space-y-1.5",children:[(0,a.jsx)("div",{className:"flex items-center gap-2",children:l?(0,a.jsx)("span",{className:"font-mono text-muted-foreground truncate",children:e}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c.p,{value:e,onChange:e=>{let a=[...C];a[s]=[e.target.value,t],S(a)},placeholder:"KEY",className:"flex-1 min-w-0 font-mono text-xs h-7"}),(0,a.jsx)("button",{type:"button",onClick:()=>S(C.filter((e,t)=>t!==s)),className:"shrink-0 text-muted-foreground hover:text-foreground p-0.5",children:(0,a.jsx)(o.A,{className:"h-3.5 w-3.5"})})]})}),(0,a.jsx)(c.p,{type:r?"password":"text",value:t,onChange:t=>{let a=[...C];a[s]=[e,t.target.value],S(a)},placeholder:r?"••••••••":"value",className:"w-full font-mono text-xs h-7"})]},s)})}),(0,a.jsxs)("div",{className:"rounded-lg border border-dashed border-input px-3 py-2 space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(c.p,{value:z,onChange:e=>A(e.target.value),placeholder:"NEW_KEY",className:"flex-1 min-w-0 font-mono text-xs h-7",onKeyDown:e=>"Enter"===e.key&&G()}),(0,a.jsx)("button",{type:"button",onClick:G,className:"shrink-0 text-muted-foreground hover:text-foreground p-0.5",children:(0,a.jsx)(d.A,{className:"h-3.5 w-3.5"})})]}),(0,a.jsx)(c.p,{type:p(z)?"password":"text",value:D,onChange:e=>L(e.target.value),placeholder:p(z)?"••••••••":"value",className:"w-full font-mono text-xs h-7",onKeyDown:e=>"Enter"===e.key&&G()})]})]})]}),"models"===N&&(0,a.jsxs)("div",{className:"space-y-4",children:[0===E.length&&!W&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground py-4 text-center",children:"No models configured yet."}),(0,a.jsx)("div",{className:"space-y-1",children:E.map((e,t)=>W?.index===t?(0,a.jsxs)("div",{className:"rounded-lg border border-primary/30 bg-primary/5 px-3 sm:px-4 py-3 space-y-3",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,a.jsx)(c.p,{value:W.modelId,onChange:e=>X({...W,modelId:e.target.value}),placeholder:"Model ID",className:"flex-1 font-mono text-xs h-7"}),(0,a.jsx)(c.p,{value:W.displayName,onChange:e=>X({...W,displayName:e.target.value}),placeholder:"Display name",className:"flex-1 text-xs h-7"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"Thinking"}),(0,a.jsx)(h,{selected:W.effortLevels,onChange:e=>X({...W,effortLevels:e})})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"Context"}),(0,a.jsx)(f,{selected:W.contextSizes,onChange:e=>X({...W,contextSizes:e})})]}),(0,a.jsxs)("div",{className:"flex gap-1.5",children:[(0,a.jsx)("button",{type:"button",onClick:()=>X(null),className:"px-2.5 py-1 text-xs rounded-md border border-input text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:"Cancel"}),(0,a.jsx)("button",{type:"button",onClick:U,disabled:!W.modelId.trim()||0===W.contextSizes.length,className:"px-2.5 py-1 text-xs rounded-md bg-primary text-primary-foreground hover:brightness-110 transition-all disabled:opacity-50",children:"Save"})]})]})]},t):(0,a.jsxs)("button",{type:"button",onClick:()=>X({index:t,modelId:e.modelId,displayName:e.displayName,effortLevels:e.effortLevels??[],contextSizes:e.contextSizes??["200k"]}),className:"flex w-full items-center gap-2 sm:gap-3 rounded-lg border border-border px-3 sm:px-4 py-2.5 text-xs hover:bg-muted/50 transition-colors text-left",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-0.5 sm:gap-3 min-w-0 flex-1",children:[(0,a.jsx)("span",{className:"font-mono font-medium truncate",children:e.modelId}),e.displayName!==e.modelId&&(0,a.jsx)("span",{className:"text-muted-foreground truncate",children:e.displayName})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[e.effortLevels.length>0&&(0,a.jsx)("span",{className:"text-muted-foreground hidden sm:inline",children:e.effortLevels.join(", ")}),(e.contextSizes??[]).filter(e=>"200k"!==e).map(e=>(0,a.jsx)("span",{className:"text-muted-foreground",children:m.XR[e].label},e)),(0,a.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),I(E.filter((e,s)=>s!==t))},className:"text-muted-foreground hover:text-destructive p-0.5",children:(0,a.jsx)(o.A,{className:"h-3 w-3"})})]})]},t))}),(0,a.jsxs)("div",{className:"rounded-lg border border-dashed border-input px-3 sm:px-4 py-3 space-y-3",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,a.jsx)(c.p,{value:K,onChange:e=>O(e.target.value),placeholder:"Model ID (e.g. openai/gpt-4o)",className:"flex-1 font-mono text-xs h-7",onKeyDown:e=>"Enter"===e.key&&Q()}),(0,a.jsx)(c.p,{value:R,onChange:e=>_(e.target.value),placeholder:"Display name",className:"flex-1 text-xs h-7",onKeyDown:e=>"Enter"===e.key&&Q()})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"Thinking"}),(0,a.jsx)(h,{selected:$,onChange:T})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"Context"}),(0,a.jsx)(f,{selected:M,onChange:V})]}),(0,a.jsxs)("button",{type:"button",onClick:Q,disabled:!K.trim()||0===M.length,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md border border-input text-muted-foreground hover:text-foreground hover:bg-muted transition-colors disabled:opacity-50",children:[(0,a.jsx)(d.A,{className:"h-3 w-3"}),"Add model"]})]})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between pt-3 border-t shrink-0",children:[(0,a.jsx)("div",{children:v&&(0,a.jsxs)("button",{onClick:v,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md text-destructive hover:bg-destructive/10 transition-colors",children:[(0,a.jsx)(i.A,{className:"h-3 w-3"}),"Delete"]})}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{onClick:u,className:"px-3 py-1.5 text-xs rounded-md border border-input text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:"Cancel"}),(0,a.jsx)("button",{onClick:F,disabled:!k.trim()||Y,className:"px-4 py-1.5 text-xs rounded-md bg-primary text-primary-foreground hover:brightness-110 transition-all disabled:opacity-50",children:Y?"Saving...":t?"Create":"Save"})]})]})]})}}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[35130],{49194:(e,s,t)=>{Promise.resolve().then(t.bind(t,86646))},86646:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>h});var n=t(95155),a=t(2125),c=t(65738),l=t(73321),r=t(12115),o=t(1550),i=t(45160),d=t(89239),m=t(81477),u=t(42763);function h(){(0,o.si)("Agents",{hideActions:!0});let e="u">typeof localStorage&&localStorage.getItem("cockpit-agents-cwd")||void 0,{agents:s,loading:t,deleteAgent:c}=function(e){let[s,t]=(0,r.useState)([]),[n,a]=(0,r.useState)(!0),c=(0,r.useCallback)(()=>{a(!0);let s=new URLSearchParams;e&&s.set("cwd",e),fetch(`/api/agents?${s}`).then(e=>e.json()).then(e=>t(e.agents)).catch(()=>t([])).finally(()=>a(!1))},[e]);(0,r.useEffect)(()=>{c()},[c]);let l=(0,r.useCallback)(async(s,t)=>{let n=new URLSearchParams({scope:t});"project"===t&&e&&n.set("cwd",e);try{if((await fetch(`/api/agents/${encodeURIComponent(s)}?${n}`,{method:"DELETE"})).ok)return c(),!0;return!1}catch{return!1}},[e,c]);return{agents:s,loading:n,refresh:c,deleteAgent:l}}(e),i=(0,l.useRouter)(),[h,p]=(0,r.useState)(null),[j,f]=(0,r.useState)(!1),g=s.filter(e=>"user"===e.scope),N=s.filter(e=>"project"===e.scope);function b(s){f(!1);let t=new URLSearchParams({scope:s});"project"===s&&e&&t.set("cwd",e),i.push(`/agents/new?${t}`)}function v(s,t){let n=new URLSearchParams({scope:t});"project"===t&&e&&n.set("cwd",e),i.push(`/agents/${encodeURIComponent(s)}?${n}`)}async function w(){h&&(await c(h.name,h.scope),p(null))}return(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("div",{}),(0,n.jsxs)(d.$,{size:"sm",onClick:()=>f(!0),children:[(0,n.jsx)(a.A,{className:"h-4 w-4 mr-1"}),"New Agent"]})]}),t&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading agents..."}),!t&&0===s.length&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"No custom agents found. Create one to get started."}),g.length>0&&(0,n.jsxs)(m.Zp,{children:[(0,n.jsx)(m.aR,{children:(0,n.jsx)(m.ZB,{className:"text-base",children:"Global"})}),(0,n.jsx)(m.Wu,{className:"space-y-1",children:g.map(e=>(0,n.jsx)(x,{name:e.name,scope:"user",description:e.description,onClick:()=>v(e.name,"user"),onDelete:()=>p({name:e.name,scope:"user"})},e.name))})]}),N.length>0&&(0,n.jsxs)(m.Zp,{children:[(0,n.jsx)(m.aR,{children:(0,n.jsx)(m.ZB,{className:"text-base",children:"Project"})}),(0,n.jsx)(m.Wu,{className:"space-y-1",children:N.map(e=>(0,n.jsx)(x,{name:e.name,scope:"project",description:e.description,onClick:()=>v(e.name,"project"),onDelete:()=>p({name:e.name,scope:"project"})},e.name))})]}),(0,n.jsx)(u.lG,{open:j,onOpenChange:f,children:(0,n.jsxs)(u.Cf,{children:[(0,n.jsx)(u.c7,{children:(0,n.jsx)(u.L3,{children:"New Agent"})}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Where should this agent be saved?"}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(d.$,{variant:"outline",className:"flex-1",onClick:()=>b("user"),children:"Global"}),(0,n.jsx)(d.$,{variant:"outline",className:"flex-1",onClick:()=>b("project"),disabled:!e,children:"Project"})]})]})}),(0,n.jsx)(u.lG,{open:!!h,onOpenChange:()=>p(null),children:(0,n.jsxs)(u.Cf,{children:[(0,n.jsx)(u.c7,{children:(0,n.jsx)(u.L3,{children:"Delete Agent"})}),(0,n.jsxs)("p",{className:"text-sm text-muted-foreground mb-4",children:["Delete ",(0,n.jsx)("span",{className:"font-mono font-bold",children:h?.name}),"? This cannot be undone."]}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(d.$,{variant:"outline",onClick:()=>p(null),children:"Cancel"}),(0,n.jsx)(d.$,{variant:"destructive",onClick:w,children:"Delete"})]})]})})]})}function x({name:e,scope:s,description:t,onClick:a,onDelete:l}){return(0,n.jsxs)("div",{className:"flex items-center gap-3 rounded px-2 py-2 hover:bg-muted transition-colors",children:[(0,n.jsxs)("button",{type:"button",className:"flex-1 text-left min-w-0",onClick:a,children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"font-mono font-bold text-sm",children:e}),(0,n.jsx)(i.E,{variant:"secondary",className:"text-[10px]",children:"user"===s?"Global":"Project"})]}),t&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:t})]}),(0,n.jsx)("button",{type:"button",className:"shrink-0 p-1 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors",onClick:e=>{e.stopPropagation(),l()},children:(0,n.jsx)(c.A,{className:"h-4 w-4"})})]})}}},e=>{e.O(0,[989,25781,1550,28441,93794,77358],()=>e(e.s=49194)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[96494],{36456:(e,s,n)=>{"use strict";n.r(s),n.d(s,{default:()=>h});var t=n(95155),a=n(2125),c=n(65738),l=n(73321),o=n(12115),r=n(1550),i=n(45160),d=n(89239),m=n(81477),u=n(42763);function h(){(0,r.si)("Commands",{hideActions:!0});let e="u">typeof localStorage&&localStorage.getItem("cockpit-agents-cwd")||void 0,{commands:s,loading:n,deleteCommand:c}=function(e){let[s,n]=(0,o.useState)([]),[t,a]=(0,o.useState)(!0),c=(0,o.useCallback)(()=>{a(!0);let s=new URLSearchParams;e&&s.set("cwd",e),fetch(`/api/commands?${s}`).then(e=>e.json()).then(e=>n(e.commands)).catch(()=>n([])).finally(()=>a(!1))},[e]);(0,o.useEffect)(()=>{c()},[c]);let l=(0,o.useCallback)(async(s,n)=>{let t=new URLSearchParams({scope:n});"project"===n&&e&&t.set("cwd",e);try{if((await fetch(`/api/commands/${encodeURIComponent(s)}?${t}`,{method:"DELETE"})).ok)return c(),!0;return!1}catch{return!1}},[e,c]);return{commands:s,loading:t,refresh:c,deleteCommand:l}}(e),i=(0,l.useRouter)(),[h,p]=(0,o.useState)(null),[j,f]=(0,o.useState)(!1),N=s.filter(e=>"user"===e.scope),C=s.filter(e=>"project"===e.scope);function b(s){f(!1);let n=new URLSearchParams({scope:s});"project"===s&&e&&n.set("cwd",e),i.push(`/commands/new?${n}`)}function g(s,n){let t=new URLSearchParams({scope:n});"project"===n&&e&&t.set("cwd",e),i.push(`/commands/${encodeURIComponent(s)}?${t}`)}async function v(){h&&(await c(h.name,h.scope),p(null))}return(0,t.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("div",{}),(0,t.jsxs)(d.$,{size:"sm",onClick:()=>f(!0),children:[(0,t.jsx)(a.A,{className:"h-4 w-4 mr-1"}),"New Command"]})]}),n&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading commands..."}),!n&&0===s.length&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"No custom commands found. Create one to get started."}),N.length>0&&(0,t.jsxs)(m.Zp,{children:[(0,t.jsx)(m.aR,{children:(0,t.jsx)(m.ZB,{className:"text-base",children:"Global"})}),(0,t.jsx)(m.Wu,{className:"space-y-1",children:N.map(e=>(0,t.jsx)(x,{name:e.name,scope:"user",description:e.description,onClick:()=>g(e.name,"user"),onDelete:()=>p({name:e.name,scope:"user"})},e.name))})]}),C.length>0&&(0,t.jsxs)(m.Zp,{children:[(0,t.jsx)(m.aR,{children:(0,t.jsx)(m.ZB,{className:"text-base",children:"Project"})}),(0,t.jsx)(m.Wu,{className:"space-y-1",children:C.map(e=>(0,t.jsx)(x,{name:e.name,scope:"project",description:e.description,onClick:()=>g(e.name,"project"),onDelete:()=>p({name:e.name,scope:"project"})},e.name))})]}),(0,t.jsx)(u.lG,{open:j,onOpenChange:f,children:(0,t.jsxs)(u.Cf,{children:[(0,t.jsx)(u.c7,{children:(0,t.jsx)(u.L3,{children:"New Command"})}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Where should this command be saved?"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(d.$,{variant:"outline",className:"flex-1",onClick:()=>b("user"),children:"Global"}),(0,t.jsx)(d.$,{variant:"outline",className:"flex-1",onClick:()=>b("project"),disabled:!e,children:"Project"})]})]})}),(0,t.jsx)(u.lG,{open:!!h,onOpenChange:()=>p(null),children:(0,t.jsxs)(u.Cf,{children:[(0,t.jsx)(u.c7,{children:(0,t.jsx)(u.L3,{children:"Delete Command"})}),(0,t.jsxs)("p",{className:"text-sm text-muted-foreground mb-4",children:["Delete ",(0,t.jsx)("span",{className:"font-mono font-bold",children:h?.name}),"? This cannot be undone."]}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(d.$,{variant:"outline",onClick:()=>p(null),children:"Cancel"}),(0,t.jsx)(d.$,{variant:"destructive",onClick:v,children:"Delete"})]})]})})]})}function x({name:e,scope:s,description:n,onClick:a,onDelete:l}){return(0,t.jsxs)("div",{className:"flex items-center gap-3 rounded px-2 py-2 hover:bg-muted transition-colors",children:[(0,t.jsxs)("button",{type:"button",className:"flex-1 text-left min-w-0",onClick:a,children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"font-mono font-bold text-sm",children:e}),(0,t.jsx)(i.E,{variant:"secondary",className:"text-[10px]",children:"user"===s?"Global":"Project"})]}),n&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:n})]}),(0,t.jsx)("button",{type:"button",className:"shrink-0 p-1 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors",onClick:e=>{e.stopPropagation(),l()},children:(0,t.jsx)(c.A,{className:"h-4 w-4"})})]})}},89850:(e,s,n)=>{Promise.resolve().then(n.bind(n,36456))}},e=>{e.O(0,[989,25781,1550,28441,93794,77358],()=>e(e.s=89850)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[40992],{64025:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>d});var o=s(95155),n=s(73321),a=s(1550),r=s(45160),l=s(81477),c=s(12115);let i={global:"Global",project:"Project","project-local":"Local"},h=new Set(["UserPromptSubmit","PreToolUse","PermissionRequest","Stop","SubagentStop"]);function d(){(0,a.si)("Hooks",{hideActions:!0});let e="u">typeof localStorage&&localStorage.getItem("cockpit-agents-cwd")||void 0,{hooks:t,loading:s}=function(e){let[t,s]=(0,c.useState)([]),[o,n]=(0,c.useState)([]),[a,r]=(0,c.useState)(!0),l=(0,c.useCallback)(()=>{r(!0);let t=new URLSearchParams;e&&t.set("cwd",e),fetch(`/api/hooks?${t}`).then(e=>e.json()).then(e=>{s(e.hooks),n(e.events)}).catch(()=>s([])).finally(()=>r(!1))},[e]);(0,c.useEffect)(()=>{l()},[l]);let i=(0,c.useCallback)(async(t,s,o)=>{let n=new URLSearchParams;e&&n.set("cwd",e);try{if((await fetch(`/api/hooks?${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:t,event:s,hooks:o})})).ok)return l(),!0;return!1}catch{return!1}},[e,l]);return{hooks:t,events:o,loading:a,refresh:l,saveHooks:i}}(e),d=(0,n.useRouter)(),m={};for(let e of t){let t=e.scope;m[t]||(m[t]=[]),m[t].push(e)}return(0,o.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsx)("div",{}),(0,o.jsx)("button",{className:"inline-flex items-center rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground hover:bg-primary/90",onClick:function(){let t=new URLSearchParams;e&&t.set("cwd",e),d.push(`/hooks/new?${t}`)},children:"New Hook"})]}),s&&(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading hooks..."}),!s&&0===t.length&&(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:"No hooks configured. Hooks let you run commands, HTTP requests, or prompts at key points in the agent lifecycle."}),Object.entries(m).map(([t,s])=>(0,o.jsxs)(l.Zp,{children:[(0,o.jsx)(l.aR,{children:(0,o.jsx)(l.ZB,{className:"text-base",children:i[t]||t})}),(0,o.jsx)(l.Wu,{className:"space-y-1",children:s.map(t=>(0,o.jsx)("button",{type:"button",className:"flex w-full items-center gap-3 rounded px-2 py-2 hover:bg-muted transition-colors text-left",onClick:()=>{var s;let o;return s=t.event,o=new URLSearchParams({scope:t.scope,filePath:t.filePath}),void(e&&o.set("cwd",e),d.push(`/hooks/${encodeURIComponent(s)}?${o}`))},children:(0,o.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)("span",{className:"font-mono font-bold text-sm",children:t.event}),h.has(t.event)&&(0,o.jsx)(r.E,{variant:"outline",className:"text-[10px]",children:"can block"})]}),(0,o.jsxs)("p",{className:"text-xs text-muted-foreground mt-0.5",children:[t.hooks.length," hook",1!==t.hooks.length?"s":""," — ",t.hooks.map(e=>e.type).join(", ")]})]})},`${t.event}-${t.scope}`))})]},t))]})}},70532:(e,t,s)=>{Promise.resolve().then(s.bind(s,64025))}},e=>{e.O(0,[989,25781,1550,28441,93794,77358],()=>e(e.s=70532)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[10576],{14577:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(99537).A)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])},34454:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>p});var a=t(95155),n=t(35484),r=t(11012),l=t(14577);let i=(0,t(99537).A)("check-check",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);var c=t(65738),d=t(92571),o=t(64577),h=t(75796),x=t(73321),m=t(12115),u=t(1550),f=t(89239),j=t(42763);function p(){(0,u.si)("Inbox",{hideActions:!0});let e=(0,x.useRouter)(),[s,t]=(0,m.useState)([]),[p,g]=(0,m.useState)(!0),[y,N]=(0,m.useState)(null),[k,v]=(0,m.useState)(!1),b=(0,m.useCallback)(async()=>{let e=await fetch("/api/inbox");e.ok&&t((await e.json()).messages||[]),g(!1)},[]);(0,m.useEffect)(()=>{b()},[b]);let w=async(e,s)=>{e.stopPropagation();let a=!s.read;await fetch(`/api/inbox/${s.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({read:a})}),t(e=>e.map(e=>e.id===s.id?{...e,read:a}:e))},C=async()=>{y&&(await fetch(`/api/inbox/${y}`,{method:"DELETE"}),t(e=>e.filter(e=>e.id!==y)),N(null))},A=async()=>{let e=0!==M;await fetch("/api/inbox",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"mark_all_read",read:e})}),t(s=>s.map(s=>({...s,read:e})))},$=async()=>{await fetch("/api/inbox",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear"})}),t([]),v(!1)},M=s.filter(e=>!e.read).length;return(0,a.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("div",{className:"text-sm text-muted-foreground",children:s.length>0&&(0,a.jsxs)(a.Fragment,{children:[s.length," message",1!==s.length?"s":"",M>0&&` (${M} unread)`]})}),s.length>0&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(f.$,{variant:"outline",size:"sm",onClick:A,children:[(0,a.jsx)(i,{className:"h-3.5 w-3.5 mr-1"}),0===M?"Mark all unread":"Mark all read"]}),(0,a.jsxs)(f.$,{variant:"outline",size:"sm",onClick:()=>v(!0),children:[(0,a.jsx)(c.A,{className:"h-3.5 w-3.5 mr-1"}),"Clear all"]})]})]}),p&&(0,a.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,a.jsx)(d.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!p&&0===s.length&&(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,a.jsx)(o.A,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"No messages."}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Messages from scheduled jobs will appear here."})]}),(0,a.jsx)("div",{className:"space-y-2",children:s.map(s=>(0,a.jsx)("div",{className:`rounded-lg border bg-card transition-colors cursor-pointer hover:bg-accent/50 ${!s.read?"border-l-2 border-l-blue-500":""}`,role:"button",onClick:()=>e.push(`/inbox/${s.id}`),children:(0,a.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[function(e){switch(e){case"error":return(0,a.jsx)(n.A,{className:"h-4 w-4 text-destructive shrink-0"});case"warning":return(0,a.jsx)(r.A,{className:"h-4 w-4 text-yellow-500 shrink-0"});default:return(0,a.jsx)(l.A,{className:"h-4 w-4 text-blue-500 shrink-0"})}}(s.priority),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsx)("span",{className:`text-sm truncate ${!s.read?"font-semibold":""}`,children:s.title})}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-0.5 text-xs text-muted-foreground",children:[s.jobName&&(0,a.jsx)("span",{children:s.jobName}),(0,a.jsx)("span",{children:function(e){let s=Math.floor((Date.now()-e)/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;let t=Math.floor(s/60);if(t<24)return`${t}h ago`;let a=Math.floor(t/24);return`${a}d ago`}(s.createdAt)})]})]}),(0,a.jsxs)("div",{className:"flex items-center shrink-0",children:[(0,a.jsx)(f.$,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",title:s.read?"Mark as unread":"Mark as read",onClick:e=>w(e,s),children:s.read?(0,a.jsx)(h.A,{className:"h-3.5 w-3.5"}):(0,a.jsx)(o.A,{className:"h-3.5 w-3.5"})}),(0,a.jsx)(f.$,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:e=>{var t;return t=s.id,void(e.stopPropagation(),N(t))},children:(0,a.jsx)(c.A,{className:"h-3.5 w-3.5"})})]})]})},s.id))}),(0,a.jsx)(j.lG,{open:!!y,onOpenChange:()=>N(null),children:(0,a.jsxs)(j.Cf,{children:[(0,a.jsx)(j.c7,{children:(0,a.jsx)(j.L3,{children:"Delete Message"})}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Delete this message? This cannot be undone."}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(f.$,{variant:"outline",onClick:()=>N(null),children:"Cancel"}),(0,a.jsx)(f.$,{variant:"destructive",onClick:C,children:"Delete"})]})]})}),(0,a.jsx)(j.lG,{open:k,onOpenChange:()=>v(!1),children:(0,a.jsxs)(j.Cf,{children:[(0,a.jsx)(j.c7,{children:(0,a.jsx)(j.L3,{children:"Clear All Messages"})}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Delete all inbox messages? This cannot be undone."}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(f.$,{variant:"outline",onClick:()=>v(!1),children:"Cancel"}),(0,a.jsx)(f.$,{variant:"destructive",onClick:$,children:"Clear All"})]})]})})]})}},35484:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(99537).A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},46728:(e,s,t)=>{Promise.resolve().then(t.bind(t,34454))},75796:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(99537).A)("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]])}},e=>{e.O(0,[989,25781,1550,28441,93794,77358],()=>e(e.s=46728)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[58179],{39071:(e,t,s)=>{Promise.resolve().then(s.bind(s,72814))},72814:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>S});var n=s(95155),l=s(9005),a=s(31966),i=s(2125),r=s(73321),o=s(12115),d=s(1550),c=s(41158),u=s(89239),m=s(81477),x=s(60529),h=s(8081);function p(e){return""===e?"":Number(e)}function f(e){return""!==e&&Number.isFinite(e)&&e>=1}var j=s(40980),y=s(84949);let v=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],g=["Read","Write","Edit","Bash","Bash git","Bash npm","Bash ls","Grep","Glob","Agent","WebFetch","WebSearch"],N={low:"Low",medium:"Medium",high:"High",xhigh:"XHigh",max:"Max"},b=(0,h.zQ)("sonnet")?.modelId||"",w="w-full rounded-md border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring";function k({checked:e,onChange:t}){return(0,n.jsx)("button",{type:"button",role:"switch","aria-checked":e,onClick:()=>t(!e),className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors ${e?"bg-primary":"bg-muted"}`,children:(0,n.jsx)("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-lg transition-transform ${e?"translate-x-4":"translate-x-0"}`})})}function C({value:e,onChange:t,onRemove:s,canRemove:a}){let i="simple"===e.type;return(0,n.jsxs)("div",{className:"border rounded-md p-3 space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(u.$,{variant:i?"default":"outline",size:"sm",onClick:()=>t({type:"simple",frequency:"daily",time:"09:00"}),children:"Simple"}),(0,n.jsx)(u.$,{variant:i?"outline":"default",size:"sm",onClick:()=>t({type:"cron",expression:"0 9 * * *"}),children:"Cron"})]}),a&&(0,n.jsx)("button",{type:"button",onClick:s,className:"text-muted-foreground hover:text-destructive",children:(0,n.jsx)(l.A,{className:"h-4 w-4"})})]}),i?(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("select",{value:e.frequency,onChange:s=>t({...e,frequency:s.target.value}),className:w,children:[(0,n.jsx)("option",{value:"hourly",children:"Hourly"}),(0,n.jsx)("option",{value:"daily",children:"Daily"}),(0,n.jsx)("option",{value:"weekly",children:"Weekly"}),(0,n.jsx)("option",{value:"monthly",children:"Monthly"})]}),"hourly"!==e.frequency&&(0,n.jsx)(x.p,{type:"time",value:e.time||"09:00",onChange:s=>t({...e,time:s.target.value})}),"weekly"===e.frequency&&(0,n.jsx)("select",{value:e.dayOfWeek??1,onChange:s=>t({...e,dayOfWeek:Number(s.target.value)}),className:w,children:v.map((e,t)=>(0,n.jsx)("option",{value:t,children:e},e))}),"monthly"===e.frequency&&(0,n.jsx)(x.p,{type:"number",min:1,max:31,value:e.dayOfMonth??1,onChange:s=>t({...e,dayOfMonth:Number(s.target.value)}),placeholder:"Day of month"})]}):(0,n.jsx)(x.p,{value:e.expression,onChange:e=>t({type:"cron",expression:e.target.value}),placeholder:"0 9 * * 1-5",className:"font-mono"}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:(0,y.Bg)(e)})]})}function S(){let e=(0,r.useParams)(),t=(0,r.useSearchParams)(),s=e.id,v="new"===s,S=v?t.get("from"):null,$=v?t.get("cwd"):null,M=(0,r.useRouter)();(0,d.si)(S?"Duplicate Job":v?"New Job":"Edit Job",{hideActions:!0});let[D,W]=(0,o.useState)(""),[E,A]=(0,o.useState)($||""),[T,z]=(0,o.useState)(""),[I,O]=(0,o.useState)(!0),[R,P]=(0,o.useState)([{type:"simple",frequency:"daily",time:"09:00"}]),[B,L]=(0,o.useState)(b),[Z,q]=(0,o.useState)("200k"),[J,U]=(0,o.useState)("medium"),[F,_]=(0,o.useState)("anthropic"),[H,K]=(0,o.useState)("stream"),[X,G]=(0,o.useState)(30),[Q,V]=(0,o.useState)(!1),[Y,ee]=(0,o.useState)([]),[et,es]=(0,o.useState)(""),[en,el]=(0,o.useState)([]),[ea,ei]=(0,o.useState)({}),[er,eo]=(0,o.useState)({}),[ed,ec]=(0,o.useState)(new Set),[eu,em]=(0,o.useState)({}),[ex,eh]=(0,o.useState)({}),[ep,ef]=(0,o.useState)([]),[ej,ey]=(0,o.useState)(!1),[ev,eg]=(0,o.useState)(90),[eN,eb]=(0,o.useState)(!1),[ew,ek]=(0,o.useState)([]),[eC,eS]=(0,o.useState)([]),[e$,eM]=(0,o.useState)([]),[eD,eW]=(0,o.useState)(!1),[eE,eA]=(0,o.useState)(!1),[eT,ez]=(0,o.useState)({}),[eI,eO]=(0,o.useState)(!v||!!S),eR="anthropic"===F,eP=e$.find(e=>e.id===F),eB=eR&&B?(0,h.bs)(B):null,eL=eB?.alias||null,eZ=eL?(0,h.r5)(eL):[],eq=eZ.length>1,eJ=!eR&&eP?eP.models.find(e=>e.modelId===B):null,eU=(0,o.useMemo)(()=>eR?eB?.contextSizes??["200k"]:eJ?.contextSizes??["200k"],[eR,eB,eJ]);(0,o.useEffect)(()=>{eU.includes(Z)||q(eU[0]??"200k")},[eU,Z]);let eF=(()=>{if(!eR&&eJ)return eJ.effortLevels;let e=B.replace(/\[.*\]$/,"");for(let t of e$){let s=t.models.find(t=>t.modelId===e);if(s&&s.effortLevels.length>0)return s.effortLevels}return eB?(0,h.iz)(eB):[]})(),e_=g.filter(e=>!Y.includes(e)),eH=e$.filter(e=>!e.isBuiltin);function eK(e){let t=(0,h.zQ)(e);t&&(_("anthropic"),L(t.modelId),q("200k"),U((0,h.Mi)(t)||""))}function eX(e){let t=e.trim();t&&!Y.includes(t)&&ee([...Y,t]),es("")}async function eG(e){if(eu[e]||ex[e])return;eh(t=>({...t,[e]:!0}));let t=new URLSearchParams;E&&t.set("cwd",E);try{let s=await fetch(`/api/mcp-servers/${encodeURIComponent(e)}/tools?${t}`);if(s.ok){let t=await s.json();t.tools&&em(s=>({...s,[e]:t.tools}))}}catch{}finally{eh(t=>({...t,[e]:!1}))}}function eQ(e,t){if(!t)return;let s=ea[e]||[];s.includes(t)||ei({...ea,[e]:[...s,t]})}let eV=(0,o.useCallback)((e,t)=>{W(t?`${e.name} (copy)`:e.name),A(e.cwd),z(e.prompt),O(e.enabled),P((0,y.KU)(e));let s=e.model||"",n=s.replace(/\[.*\]$/,""),l=n.indexOf(":");if(l>0)_(n.slice(0,l)),L(n.slice(l+1));else{_("anthropic");let e=(0,h.AX)(n);L(e?.modelId||b)}let a=/\[1m\]$/i.test(s);q(e.contextSize??(a?"1m":"200k"));let i=(0,h.AX)(n);U(e.thinkingLevel||(0,h.Mi)(i)||""),G(e.maxDurationMinutes??30),V(e.bypassPermissions??!1),ee(e.allowedTools||[]),el(e.mcpServers||[]),ei(e.mcpToolFilters||{}),ey(e.skipIfMissed??!1),eg(e.retentionDays??90),eb(e.inboxOutput??!1),ek(e.notifyProviders||[]),K(e.runtime||"stream")},[]),eY=(0,o.useCallback)(async()=>{let e=S||(v?null:s);if(e)try{let t=await fetch(`/api/jobs/${e}`);if(!t.ok)return void M.push("/jobs");let s=await t.json();eV(s.job,!!S)}finally{eO(!1)}},[s,v,S,M,eV]);async function e0(){let e=f(X),t=f(ev);if(ez({maxDuration:e?void 0:"Enter a duration of at least 1 minute.",retentionDays:t?void 0:"Enter a retention of at least 1 day."}),!e||!t)return;eA(!0);let n=B;!eR&&F&&(n=`${F}:${B}`);let l={name:D,cwd:E,prompt:T,enabled:I,schedule:R[0],schedules:R,model:n,contextSize:Z,thinkingLevel:J||void 0,maxDurationMinutes:X,bypassPermissions:Q,allowedTools:Y,mcpServers:en,mcpToolFilters:ea,skipIfMissed:ej,retentionDays:ev,inboxOutput:eN,notifyProviders:ew,runtime:H};try{let e=v?"/api/jobs":`/api/jobs/${s}`,t=v?"POST":"PUT",n=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(n.ok){let e=await n.json(),t=v?e.job.id:s;M.push(`/jobs/${t}`)}}finally{eA(!1)}}return((0,o.useEffect)(()=>{eY()},[eY]),(0,o.useEffect)(()=>{let e=E?`?cwd=${encodeURIComponent(E)}`:"";fetch(`/api/jobs/mcp-discover${e}`).then(e=>e.json()).then(e=>ef(e.servers)).catch(()=>ef([]))},[E]),(0,o.useEffect)(()=>{fetch("/api/notifications").then(e=>e.json()).then(e=>eS((e.providers||[]).filter(e=>e.enabled))).catch(()=>eS([]))},[]),(0,o.useEffect)(()=>{fetch("/api/providers").then(e=>e.json()).then(e=>{Array.isArray(e)&&eM(e)}).catch(()=>{})},[]),eI)?(0,n.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4",children:(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading..."})}):(0,n.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4",children:(0,n.jsxs)("div",{className:"max-w-2xl mx-auto space-y-4 pb-8",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(u.$,{variant:"ghost",size:"icon",onClick:()=>M.push(v?"/jobs":`/jobs/${s}`),children:(0,n.jsx)(a.A,{className:"h-4 w-4"})}),(0,n.jsx)("h2",{className:"font-semibold",children:S?"Duplicate Job":v?"New Job":"Edit Job"})]}),(0,n.jsx)(m.Zp,{children:(0,n.jsxs)(m.Wu,{className:"pt-6 space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Enabled"}),!I&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Paused — this job will not run on its schedule."})]}),(0,n.jsx)(k,{checked:I,onChange:O})]}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Name"}),(0,n.jsx)(x.p,{value:D,onChange:e=>W(e.target.value),placeholder:"Weekly dependency update"})]}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Prompt"}),(0,n.jsx)("textarea",{value:T,onChange:e=>z(e.target.value),placeholder:"Check for outdated dependencies and create a PR updating them...",className:"w-full min-h-[120px] rounded-md border bg-background px-3 py-2 text-sm font-mono resize-y focus:outline-none focus:ring-2 focus:ring-ring"})]})]})}),(0,n.jsxs)(m.Zp,{children:[(0,n.jsx)(m.aR,{className:"pb-2",children:(0,n.jsx)(m.ZB,{className:"text-sm font-medium",children:"Working Directory"})}),(0,n.jsxs)(m.Wu,{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(x.p,{value:E,onChange:e=>A(e.target.value),placeholder:"Leave empty for scratchpad",className:"flex-1"}),(0,n.jsx)(u.$,{variant:"outline",size:"sm",onClick:()=>eW(!0),children:"Browse"})]}),!E&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"Uses ~/.cockpit/jobs as a temporary scratchpad directory"}),eD&&(0,n.jsx)("div",{className:"border rounded-md p-3",children:(0,n.jsx)(c.K,{onSelect:e=>{A(e),eW(!1)},onCancel:()=>eW(!1)})})]})]}),(0,n.jsxs)(m.Zp,{children:[(0,n.jsx)(m.aR,{className:"pb-2",children:(0,n.jsx)(m.ZB,{className:"text-sm font-medium",children:"Schedule"})}),(0,n.jsxs)(m.Wu,{className:"space-y-3",children:[R.map((e,t)=>(0,n.jsx)(C,{value:e,onChange:e=>P(R.map((s,n)=>n===t?e:s)),onRemove:()=>P(R.filter((e,s)=>s!==t)),canRemove:R.length>1},t)),(0,n.jsxs)("button",{type:"button",onClick:()=>P([...R,{type:"simple",frequency:"daily",time:"09:00"}]),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-primary transition-colors",children:[(0,n.jsx)(i.A,{className:"h-3 w-3"}),"Add schedule"]})]})]}),(0,n.jsxs)(m.Zp,{children:[(0,n.jsx)(m.aR,{className:"pb-2",children:(0,n.jsx)(m.ZB,{className:"text-sm font-medium",children:"Model"})}),(0,n.jsxs)(m.Wu,{className:"space-y-1",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-1.5 px-2 py-2 text-sm",children:[(0,n.jsx)("span",{children:"Provider"}),(0,n.jsxs)("select",{value:F,onChange:e=>{if("anthropic"===e.target.value)(0,h.bs)(B)?_("anthropic"):eK("sonnet");else{var t=e.target.value;_(t);let s=e$.find(e=>e.id===t);if(s&&s.models.length>0){let e=s.models[0];L(e.modelId),q("200k"),U(e.defaultEffort||(e.effortLevels.length>0?e.effortLevels[0]:""))}}},className:w,children:[(0,n.jsx)("option",{value:"anthropic",children:"Anthropic"}),eH.map(e=>(0,n.jsx)("option",{value:e.id,children:e.name},e.id))]})]}),eR&&(0,n.jsxs)("div",{className:"flex items-center justify-between px-2 py-2 text-sm",children:[(0,n.jsx)("span",{children:"Model"}),(0,n.jsx)("div",{className:"flex gap-1 flex-wrap justify-end",children:["haiku","sonnet","opus"].map(e=>(0,n.jsx)(u.$,{variant:eL===e?"default":"outline",size:"sm",onClick:()=>eK(e),children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),!eR&&eP&&(0,n.jsxs)("div",{className:"flex items-center justify-between px-2 py-2 text-sm",children:[(0,n.jsx)("span",{children:"Model"}),(0,n.jsx)("div",{className:"flex gap-1 flex-wrap justify-end",children:eP.models.map(e=>(0,n.jsx)(u.$,{variant:B===e.modelId?"default":"outline",size:"sm",onClick:()=>{L(e.modelId),q("200k"),U(e.defaultEffort||(e.effortLevels.length>0?e.effortLevels[0]:""))},children:e.displayName},e.modelId))})]}),eR&&eq&&(0,n.jsxs)("div",{className:"flex items-center justify-between px-2 py-2 text-sm",children:[(0,n.jsx)("span",{children:"Version"}),(0,n.jsx)("div",{className:"flex gap-1 flex-wrap justify-end",children:eZ.map(e=>(0,n.jsx)(u.$,{variant:eB?.version===e.version?"default":"outline",size:"sm",onClick:()=>(function(e){if(!eL)return;let t=(0,h.r5)(eL).find(t=>t.version===e);if(t){L(t.modelId);let e=(()=>{for(let e of e$){let s=e.models.find(e=>e.modelId===t.modelId);if(s)return s.effortLevels}return[]})(),s=e.length>0?e:(0,h.iz)(t);J&&!s.includes(J)&&U((0,h.Mi)(t)||"")}})(e.version),children:e.version},e.version))})]}),eU.length>=2&&(0,n.jsxs)("div",{className:"flex items-center justify-between px-2 py-2 text-sm",children:[(0,n.jsx)("span",{children:"Context"}),(0,n.jsx)("div",{className:"flex gap-1",children:eU.map(e=>(0,n.jsx)(u.$,{variant:Z===e?"default":"outline",size:"sm",onClick:()=>q(e),children:h.XR[e].label},e))})]}),eF.length>0&&(0,n.jsxs)("div",{className:"flex items-center justify-between px-2 py-2 text-sm",children:[(0,n.jsx)("span",{children:"Thinking"}),(0,n.jsx)("div",{className:"flex gap-1 flex-wrap justify-end",children:eF.map(e=>(0,n.jsx)(u.$,{variant:J===e?"default":"outline",size:"sm",onClick:()=>U(e),children:N[e]},e))})]})]})]}),(0,n.jsxs)(m.Zp,{children:[(0,n.jsx)(m.aR,{className:"pb-2",children:(0,n.jsx)(m.ZB,{className:"text-sm font-medium",children:"Permissions"})}),(0,n.jsxs)(m.Wu,{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Bypass Permissions"}),Q&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"All tool permissions will be auto-approved"})]}),(0,n.jsx)(k,{checked:Q,onChange:V})]}),!Q&&(0,n.jsxs)("div",{className:"space-y-2 border-t pt-4",children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Allowed Tools"}),Y.length>0&&(0,n.jsx)("div",{className:"flex flex-wrap gap-1.5",children:Y.map(e=>(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-md bg-primary/10 text-primary font-mono",children:[e,(0,n.jsx)("button",{type:"button",onClick:()=>{ee(Y.filter(t=>t!==e))},className:"hover:text-destructive",children:(0,n.jsx)(l.A,{className:"h-3 w-3"})})]},e))}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(x.p,{value:et,onChange:e=>es(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),eX(et))},placeholder:"Type tool name and press Enter",className:"flex-1 font-mono"}),(0,n.jsx)(u.$,{variant:"outline",size:"sm",onClick:()=>eX(et),disabled:!et.trim(),children:"Add"})]}),e_.length>0&&(0,n.jsx)("div",{className:"flex flex-wrap gap-1",children:e_.map(e=>(0,n.jsxs)("button",{type:"button",onClick:()=>eX(e),className:"text-xs px-2 py-0.5 rounded border border-dashed border-muted-foreground/30 text-muted-foreground hover:border-primary hover:text-primary transition-colors",children:["+ ",e]},e))}),0===Y.length&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"No tools permitted. Add tools this job is allowed to use."})]})]})]}),(0,n.jsxs)(m.Zp,{children:[(0,n.jsx)(m.aR,{className:"pb-2",children:(0,n.jsx)(m.ZB,{className:"text-sm font-medium",children:"MCP Servers"})}),(0,n.jsxs)(m.Wu,{className:"space-y-2",children:[0===ep.length&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"No MCP servers found. Configure servers in Settings."}),ep.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"flex flex-wrap gap-1.5",children:ep.map(e=>{let t=en.includes(e);return(0,n.jsx)("button",{type:"button",onClick:()=>{if(t){el(en.filter(t=>t!==e));let{[e]:t,...s}=ea;ei(s),ec(t=>{let s=new Set(t);return s.delete(e),s})}else el([...en,e])},className:`inline-flex items-center gap-1 text-xs px-2.5 py-1 rounded-md font-mono transition-colors ${t?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"}`,children:e},e)})}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:0===en.length?"No servers enabled. Select servers to activate.":`${en.length} enabled.`}),en.map(e=>{let t=ea[e]||[],s=ed.has(e),a=er[e]||"";return(0,n.jsxs)("div",{className:"border rounded-md p-2 space-y-2",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>{ec(t=>{let s=new Set(t);return s.has(e)?s.delete(e):(s.add(e),setTimeout(()=>eG(e),0)),s})},className:"w-full flex items-center justify-between text-xs text-muted-foreground hover:text-primary",children:[(0,n.jsx)("span",{className:"font-mono",children:e}),(0,n.jsx)("span",{children:0===t.length?"All tools":`${t.length} tool${1===t.length?"":"s"} filtered`})]}),s&&(0,n.jsxs)("div",{className:"space-y-2 pt-1",children:[t.length>0&&(0,n.jsx)("div",{className:"flex flex-wrap gap-1.5",children:t.map(s=>(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-md bg-primary/10 text-primary font-mono",children:[s,(0,n.jsx)("button",{type:"button",onClick:()=>{let n=t.filter(e=>e!==s);if(0===n.length){let{[e]:t,...s}=ea;ei(s)}else ei({...ea,[e]:n})},className:"hover:text-destructive",children:(0,n.jsx)(l.A,{className:"h-3 w-3"})})]},s))}),ex[e]?(0,n.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"Discovering tools..."}):eu[e]?.length>0?(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"Discovered tools — click to add:"}),(0,n.jsx)("div",{className:"flex flex-wrap gap-1",children:eu[e].map(s=>{let l=t.includes(s);return(0,n.jsx)("button",{type:"button",disabled:l,onClick:()=>eQ(e,s),className:`inline-flex items-center text-xs px-2 py-0.5 rounded font-mono transition-colors ${l?"text-muted-foreground/40 line-through cursor-not-allowed":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,children:s},s)})})]}):null,(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(x.p,{value:a,onChange:t=>eo({...er,[e]:t.target.value}),onKeyDown:s=>{if("Enter"===s.key){s.preventDefault();let n=a.trim();n&&!t.includes(n)&&(eQ(e,n),eo({...er,[e]:""}))}},placeholder:"Tool name or server:tool",className:"flex-1 font-mono text-xs"}),(0,n.jsx)(u.$,{variant:"outline",size:"sm",onClick:()=>{let s=a.trim();s&&!t.includes(s)&&(eQ(e,s),eo({...er,[e]:""}))},disabled:!a.trim(),children:"Add"})]}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"Leave empty to allow all tools. For proxy servers, use server:tool format."})]})]},e)})]})]})]}),(0,n.jsxs)(m.Zp,{children:[(0,n.jsx)(m.aR,{className:"pb-2",children:(0,n.jsx)(m.ZB,{className:"text-sm font-medium",children:"Execution"})}),(0,n.jsxs)(m.Wu,{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Runtime"}),(0,n.jsxs)("div",{className:"flex gap-1",children:[(0,n.jsx)(u.$,{variant:"stream"===H?"default":"outline",size:"sm",onClick:()=>K("stream"),children:"Stream"}),(0,n.jsx)(u.$,{variant:"pty"===H?"default":"outline",size:"sm",onClick:()=>K("pty"),children:"PTY"})]})]}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Max Duration (minutes)"}),(0,n.jsx)(x.p,{type:"number",min:1,value:X,onChange:e=>G(p(e.target.value)),className:(0,j.cn)(eT.maxDuration&&"border-destructive")}),eT.maxDuration&&(0,n.jsx)("p",{className:"text-xs text-destructive",children:eT.maxDuration})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Retry missed runs"}),(0,n.jsx)(k,{checked:!ej,onChange:e=>ey(!e)})]}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Audit log retention (days)"}),(0,n.jsx)(x.p,{type:"number",min:1,value:ev,onChange:e=>eg(p(e.target.value)),className:(0,j.cn)(eT.retentionDays&&"border-destructive")}),eT.retentionDays&&(0,n.jsx)("p",{className:"text-xs text-destructive",children:eT.retentionDays})]})]})]}),(0,n.jsxs)(m.Zp,{children:[(0,n.jsx)(m.aR,{className:"pb-2",children:(0,n.jsx)(m.ZB,{className:"text-sm font-medium",children:"Output"})}),(0,n.jsxs)(m.Wu,{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Send to Inbox"}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"The agent will format its final output as a structured message delivered to your Cockpit inbox."})]}),(0,n.jsx)(k,{checked:eN,onChange:eb})]}),eN&&eC.length>0&&(0,n.jsxs)("div",{className:"mt-4 pt-4 border-t",children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"External notifications"}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 mb-2",children:"Also send to these providers when a message is delivered."}),(0,n.jsx)("div",{className:"space-y-1.5",children:eC.map(e=>(0,n.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[(0,n.jsx)("input",{type:"checkbox",checked:ew.includes(e.id),onChange:t=>ek(s=>t.target.checked?[...s,e.id]:s.filter(t=>t!==e.id)),className:"rounded border-input"}),(0,n.jsx)("span",{children:e.name}),(0,n.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",e.type,")"]})]},e.id))})]})]})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(u.$,{onClick:e0,disabled:eE||!D||!T,children:eE?"Saving...":"Save"}),(0,n.jsx)(u.$,{variant:"outline",onClick:()=>M.push(v?"/jobs":`/jobs/${s}`),children:"Cancel"})]})]})})}},84949:(e,t,s)=>{"use strict";function n(e,t,s){let n=[];for(let l of e.split(",")){let e=l.match(/^(.+)\/(\d+)$/),a=e?Number.parseInt(e[2],10):1,i=e?e[1]:l;if("*"===i)for(let e=t;e<=s;e+=a)n.push(e);else if(i.includes("-")){let[e,t]=i.split("-"),s=Number.parseInt(e,10),l=Number.parseInt(t,10);for(let e=s;e<=l;e+=a)n.push(e)}else n.push(Number.parseInt(i,10))}return n}function l(e){if("cron"===e.type)return`cron: ${e.expression}`;let t=e.time||"00:00";switch(e.frequency){case"hourly":return`Every hour at :${t.split(":")[1]||"00"}`;case"daily":return`Daily at ${t}`;case"weekly":return`Weekly on ${["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e.dayOfWeek??0]} at ${t}`;case"monthly":return`Monthly on day ${e.dayOfMonth??1} at ${t}`}}function a(e){return e.schedules?.length?e.schedules:[e.schedule]}function i(e){return e.map(l).join("; ")}function r(e,t){let s=null;for(let l of e){let e=function(e,t){let s=function(e){let t=e.trim().split(/\s+/);if(5!==t.length)throw Error(`Invalid cron expression: expected 5 fields, got ${t.length}`);return{minute:n(t[0],0,59),hour:n(t[1],0,23),dayOfMonth:n(t[2],1,31),month:n(t[3],1,12),dayOfWeek:n(t[4],0,6),domWild:"*"===t[2],dowWild:"*"===t[4]}}("cron"===e.type?e.expression:function(e){let[t,s]=(e.time||"00:00").split(":").map(Number);switch(e.frequency){case"hourly":return`${s} * * * *`;case"daily":return`${s} ${t} * * *`;case"weekly":return`${s} ${t} * * ${e.dayOfWeek??0}`;case"monthly":return`${s} ${t} ${e.dayOfMonth??1} * *`}}(e)),l=new Date(t.getTime());l.setSeconds(0,0),l.setMinutes(l.getMinutes()+1);for(let e=0;e<525960;e++){if(s.minute.includes(l.getMinutes())&&s.hour.includes(l.getHours())&&s.dayOfMonth.includes(l.getDate())&&s.month.includes(l.getMonth()+1)&&s.dayOfWeek.includes(l.getDay()))return l;l.setMinutes(l.getMinutes()+1)}return new Date(t.getTime()+864e5)}(l,t);(!s||e.getTime()<s.getTime())&&(s=new Date(e.getTime()))}return s??new Date(t.getTime()+864e5)}s.d(t,{Bg:()=>l,JH:()=>i,KU:()=>a,ay:()=>r})}},e=>{e.O(0,[989,25781,1550,28441,93794,77358],()=>e(e.s=39071)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[17288],{22048:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>C});var n=s(95155),a=s(35484),l=s(64962),r=s(92571),i=s(40852),o=s(36619),c=s(99314),d=s(65738),u=s(76721),h=s(14225),m=s(2125),x=s(77618),p=s(73321),f=s(12115),g=s(1550),j=s(45160),N=s(89239),w=s(81477),b=s(42763),y=s(67032),v=s(84949);function S(e){if(!e.lastRunAt)return null;let t=function(e){let t=Math.floor((Date.now()-e)/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let s=Math.floor(t/60);if(s<24)return`${s}h ago`;let n=Math.floor(s/24);return`${n}d ago`}(e.lastRunAt);return"failure"===e.lastRunStatus||"timeout"===e.lastRunStatus?(0,n.jsxs)("span",{className:"flex items-center gap-1 text-destructive",children:[(0,n.jsx)(a.A,{className:"h-3 w-3"}),"Failed ",t]}):"success"===e.lastRunStatus?(0,n.jsxs)("span",{className:"flex items-center gap-1 text-green-500",children:[(0,n.jsx)(l.A,{className:"h-3 w-3"}),"Succeeded ",t]}):"stopped"===e.lastRunStatus?(0,n.jsxs)("span",{className:"flex items-center gap-1 text-muted-foreground",children:["Stopped ",t]}):null}function $({job:e,triggeringJobs:t,stoppingJobs:s,onTrigger:a,onStop:l,onDuplicate:u,onDelete:h,onClick:m}){let x=t.has(e.id)||"running"===e.lastRunStatus?"running":e.enabled?"failure"===e.lastRunStatus||"timeout"===e.lastRunStatus?"failed":"stopped"===e.lastRunStatus?"stopped":"enabled":"disabled";return(0,n.jsx)(w.Zp,{className:"cursor-pointer hover:bg-accent/50 transition-colors",onClick:()=>m(e.id),children:(0,n.jsxs)(w.Wu,{className:"p-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,n.jsx)("span",{className:"font-medium text-sm truncate flex-1 min-w-0",children:e.name}),"running"===x?(0,n.jsx)(j.E,{variant:"default",children:"Running"}):"disabled"===x?(0,n.jsx)(j.E,{variant:"secondary",children:"Disabled"}):"failed"===x?(0,n.jsx)(j.E,{variant:"destructive",children:"Failed"}):"stopped"===x?(0,n.jsx)(j.E,{variant:"secondary",children:"Stopped"}):(0,n.jsx)(j.E,{variant:"default",children:"Enabled"})]}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:(0,v.JH)((0,v.KU)(e))}),(0,n.jsxs)("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Next: ",function(e){if(!e.enabled)return"Disabled";try{return(0,v.ay)((0,v.KU)(e),new Date).toLocaleString()}catch{return"Unknown"}}(e)]}),"running"===x?(0,n.jsx)("p",{className:"text-xs mt-0.5",children:(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,n.jsx)(r.A,{className:"h-3 w-3 animate-spin"}),"Running"]})}):S(e)&&(0,n.jsx)("p",{className:"text-xs mt-0.5",children:S(e)})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:["running"===x&&l&&(0,n.jsx)(N.$,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"Stop now",disabled:s?.has(e.id),onClick:t=>l(t,e.id),children:s?.has(e.id)?(0,n.jsx)(r.A,{className:"h-4 w-4 animate-spin"}):(0,n.jsx)(i.A,{className:"h-4 w-4"})}),(0,n.jsx)(N.$,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"Run now",disabled:t.has(e.id),onClick:t=>a(t,e.id),children:t.has(e.id)?(0,n.jsx)(r.A,{className:"h-4 w-4 animate-spin"}):(0,n.jsx)(o.A,{className:"h-4 w-4"})}),(0,n.jsx)(N.$,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"Duplicate",onClick:t=>u(t,e.id),children:(0,n.jsx)(c.A,{className:"h-4 w-4"})}),(0,n.jsx)(N.$,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",title:"Delete",onClick:t=>h(t,e.id),children:(0,n.jsx)(d.A,{className:"h-4 w-4"})})]})]})]})})}function k({group:e,triggeringJobs:t,stoppingJobs:s,onTrigger:a,onStop:l,onDuplicate:r,onDelete:i,onClickJob:o,onCreateJob:c,defaultExpanded:d}){let[x,p]=(0,f.useState)(d),g=e.jobs.filter(e=>"failure"===e.lastRunStatus||"timeout"===e.lastRunStatus).length;return(0,n.jsxs)("div",{className:"rounded-lg border bg-card",children:[(0,n.jsxs)("div",{role:"button",onClick:()=>p(!x),className:"w-full flex items-center gap-2 p-3 text-left hover:bg-accent/50 rounded-lg transition-colors cursor-pointer",children:[(0,n.jsx)(u.A,{className:`h-4 w-4 shrink-0 text-muted-foreground transition-transform ${x?"rotate-90":""}`}),(0,n.jsx)(h.A,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,n.jsx)("span",{className:"font-medium text-sm truncate flex-1",children:e.dirName}),(0,n.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[g>0&&(0,n.jsxs)(j.E,{variant:"destructive",children:[g," failed"]}),(0,n.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e.jobs.length," job",1!==e.jobs.length?"s":""]}),(0,n.jsx)("button",{onClick:t=>{t.stopPropagation(),c(e.cwd)},className:"p-1 rounded hover:bg-accent",title:"New job in this folder",children:(0,n.jsx)(m.A,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]}),x&&(0,n.jsx)("div",{className:"px-3 pb-3 space-y-2",children:e.jobs.map(e=>(0,n.jsx)($,{job:e,triggeringJobs:t,stoppingJobs:s,onTrigger:a,onStop:l,onDuplicate:r,onDelete:i,onClick:o},e.id))})]})}function C(){(0,g.si)("Scheduled Jobs",{hideActions:!0});let{jobs:e,loading:t,deleteJob:s,triggerJob:a,stopJob:l,refresh:r}=(0,y.Os)(),i=(0,p.useRouter)(),[o,c]=(0,f.useState)(null),[d,u]=(0,f.useState)(new Set),[h,j]=(0,f.useState)(new Set),w=(0,f.useMemo)(()=>(function(e){let t=new Map;for(let s of e){let e=s.cwd||"",n=t.get(e)||[];n.push(s),t.set(e,n)}let s=[];for(let[e,n]of t)s.push({cwd:e,dirName:function(e){if(!e)return"Scratchpad";let t=e.replace(/\/+$/,"").split("/");return t[t.length-1]||e}(e),jobs:n});return s.sort((e,t)=>e.cwd?t.cwd?e.dirName.localeCompare(t.dirName):1:-1),s})(e),[e]);async function v(){o&&(await s(o),c(null))}async function S(e,t){e.stopPropagation(),u(e=>new Set(e).add(t)),await a(t),u(e=>{let s=new Set(e);return s.delete(t),s}),r()}async function C(e,t){e.stopPropagation(),j(e=>new Set(e).add(t)),u(e=>{let s=new Set(e);return s.delete(t),s}),await l(t),j(e=>{let s=new Set(e);return s.delete(t),s}),r()}function D(e,t){e.stopPropagation(),i.push(`/jobs/new/edit?from=${t}`)}function A(e,t){e.stopPropagation(),c(t)}return(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 pb-24 space-y-4",children:[t&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading jobs..."}),!t&&0===e.length&&(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,n.jsx)(x.A,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"No scheduled jobs yet."}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Create one to run Claude on a schedule."})]}),(0,n.jsx)("div",{className:"space-y-2",children:1===w.length?w[0].jobs.map(e=>(0,n.jsx)($,{job:e,triggeringJobs:d,stoppingJobs:h,onTrigger:S,onStop:C,onDuplicate:D,onDelete:A,onClick:e=>i.push(`/jobs/${e}`)},e.id)):w.map(e=>(0,n.jsx)(k,{group:e,triggeringJobs:d,stoppingJobs:h,onTrigger:S,onStop:C,onDuplicate:D,onDelete:A,onClickJob:e=>i.push(`/jobs/${e}`),onCreateJob:e=>i.push(`/jobs/new/edit?cwd=${encodeURIComponent(e)}`),defaultExpanded:w.length<=3},e.cwd))}),(0,n.jsx)("div",{className:"fixed bottom-6 right-6",children:(0,n.jsxs)(N.$,{size:"lg",className:"rounded-full shadow-lg",onClick:()=>i.push("/jobs/new/edit"),children:[(0,n.jsx)(m.A,{className:"h-5 w-5 mr-1"}),"New Job"]})}),(0,n.jsx)(b.lG,{open:!!o,onOpenChange:()=>c(null),children:(0,n.jsxs)(b.Cf,{children:[(0,n.jsx)(b.c7,{children:(0,n.jsx)(b.L3,{children:"Delete Job"})}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Delete this job and all its run history? This cannot be undone."}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(N.$,{variant:"outline",onClick:()=>c(null),children:"Cancel"}),(0,n.jsx)(N.$,{variant:"destructive",onClick:v,children:"Delete"})]})]})})]})}},35484:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(99537).A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},61112:(e,t,s)=>{Promise.resolve().then(s.bind(s,22048))},84949:(e,t,s)=>{"use strict";function n(e,t,s){let n=[];for(let a of e.split(",")){let e=a.match(/^(.+)\/(\d+)$/),l=e?Number.parseInt(e[2],10):1,r=e?e[1]:a;if("*"===r)for(let e=t;e<=s;e+=l)n.push(e);else if(r.includes("-")){let[e,t]=r.split("-"),s=Number.parseInt(e,10),a=Number.parseInt(t,10);for(let e=s;e<=a;e+=l)n.push(e)}else n.push(Number.parseInt(r,10))}return n}function a(e){if("cron"===e.type)return`cron: ${e.expression}`;let t=e.time||"00:00";switch(e.frequency){case"hourly":return`Every hour at :${t.split(":")[1]||"00"}`;case"daily":return`Daily at ${t}`;case"weekly":return`Weekly on ${["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e.dayOfWeek??0]} at ${t}`;case"monthly":return`Monthly on day ${e.dayOfMonth??1} at ${t}`}}function l(e){return e.schedules?.length?e.schedules:[e.schedule]}function r(e){return e.map(a).join("; ")}function i(e,t){let s=null;for(let a of e){let e=function(e,t){let s=function(e){let t=e.trim().split(/\s+/);if(5!==t.length)throw Error(`Invalid cron expression: expected 5 fields, got ${t.length}`);return{minute:n(t[0],0,59),hour:n(t[1],0,23),dayOfMonth:n(t[2],1,31),month:n(t[3],1,12),dayOfWeek:n(t[4],0,6),domWild:"*"===t[2],dowWild:"*"===t[4]}}("cron"===e.type?e.expression:function(e){let[t,s]=(e.time||"00:00").split(":").map(Number);switch(e.frequency){case"hourly":return`${s} * * * *`;case"daily":return`${s} ${t} * * *`;case"weekly":return`${s} ${t} * * ${e.dayOfWeek??0}`;case"monthly":return`${s} ${t} ${e.dayOfMonth??1} * *`}}(e)),a=new Date(t.getTime());a.setSeconds(0,0),a.setMinutes(a.getMinutes()+1);for(let e=0;e<525960;e++){if(s.minute.includes(a.getMinutes())&&s.hour.includes(a.getHours())&&s.dayOfMonth.includes(a.getDate())&&s.month.includes(a.getMonth()+1)&&s.dayOfWeek.includes(a.getDay()))return a;a.setMinutes(a.getMinutes()+1)}return new Date(t.getTime()+864e5)}(a,t);(!s||e.getTime()<s.getTime())&&(s=new Date(e.getTime()))}return s??new Date(t.getTime()+864e5)}s.d(t,{Bg:()=>a,JH:()=>r,KU:()=>l,ay:()=>i})}},e=>{e.O(0,[989,25781,1550,28441,93794,77358],()=>e(e.s=61112)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[67797],{61239:(e,s,t)=>{Promise.resolve().then(t.bind(t,78357))},78357:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>p});var n=t(95155),a=t(2125),l=t(76721),r=t(92571),c=t(31966),i=t(73321),o=t(12115),d=t(1550),m=t(41158),x=t(45160),u=t(89239),h=t(81477),j=t(42763);function p(){(0,d.si)("MCP Servers",{hideActions:!0});let e=(0,i.useSearchParams)(),s=(0,i.useRouter)(),t=e.get("mcp"),a=e.get("scope")||"user",l="u">typeof localStorage&&localStorage.getItem("cockpit-agents-cwd")||void 0,{servers:r,loading:c,getServer:m,deleteServer:x}=function(e){let[s,t]=(0,o.useState)([]),[n,a]=(0,o.useState)(!0),l=(0,o.useCallback)(()=>{a(!0);let s=new URLSearchParams;e&&s.set("cwd",e),fetch(`/api/mcp-servers?${s}`).then(e=>e.json()).then(e=>t(e.servers)).catch(()=>t([])).finally(()=>a(!1))},[e]);(0,o.useEffect)(()=>{l()},[l]);let r=(0,o.useCallback)(async(e,s,t)=>{let n=new URLSearchParams({scope:s});"project"===s&&t&&n.set("cwd",t);try{let s=await fetch(`/api/mcp-servers/${encodeURIComponent(e)}?${n}`);if(!s.ok)return null;return s.json()}catch{return null}},[]),c=(0,o.useCallback)(async(s,t)=>{let n=new URLSearchParams({scope:t});"project"===t&&e&&n.set("cwd",e);try{if((await fetch(`/api/mcp-servers/${encodeURIComponent(s)}?${n}`,{method:"DELETE"})).ok)return l(),!0;return!1}catch{return!1}},[e,l]);return{servers:s,loading:n,refresh:l,getServer:r,deleteServer:c}}(l);return t?(0,n.jsx)(g,{name:t,scope:a,cwd:l,onBack:()=>s.push("/mcp-servers"),getServer:m,onDelete:async(e,s)=>await x(e,s)}):(0,n.jsx)(f,{servers:r,loading:c})}function f({servers:e,loading:s}){let t=(0,i.useRouter)(),[l,r]=(0,o.useState)(!1),[c,d]=(0,o.useState)(!1),x=e.filter(e=>"user"===e.scope),p=e.filter(e=>"project"===e.scope);function g(e,s){r(!1),d(!1);let n=new URLSearchParams({scope:e});"project"===e&&s&&n.set("cwd",s),t.push(`/mcp-servers/new?${n}`)}function v(e,s){t.push(`/mcp-servers?mcp=${encodeURIComponent(e)}&scope=${s}`)}return(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("div",{}),(0,n.jsxs)(u.$,{size:"sm",onClick:()=>r(!0),children:[(0,n.jsx)(a.A,{className:"h-4 w-4 mr-1"}),"New Server"]})]}),s&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading servers..."}),!s&&0===e.length&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"No MCP servers configured. Add one to get started."}),x.length>0&&(0,n.jsxs)(h.Zp,{children:[(0,n.jsx)(h.aR,{children:(0,n.jsx)(h.ZB,{className:"text-base",children:"Global"})}),(0,n.jsx)(h.Wu,{className:"space-y-1",children:x.map(e=>(0,n.jsx)(N,{name:e.name,type:e.type,detail:e.command||e.url,onClick:()=>v(e.name,"user")},e.name))})]}),p.length>0&&(0,n.jsxs)(h.Zp,{children:[(0,n.jsx)(h.aR,{children:(0,n.jsx)(h.ZB,{className:"text-base",children:"Project"})}),(0,n.jsx)(h.Wu,{className:"space-y-1",children:p.map(e=>(0,n.jsx)(N,{name:e.name,type:e.type,detail:e.command||e.url,onClick:()=>v(e.name,"project")},e.name))})]}),(0,n.jsx)(j.lG,{open:l,onOpenChange:e=>{r(e),e||d(!1)},children:(0,n.jsxs)(j.Cf,{children:[(0,n.jsx)(j.c7,{children:(0,n.jsx)(j.L3,{children:"New MCP Server"})}),c?(0,n.jsx)(m.K,{onSelect:e=>g("project",e),onCancel:()=>d(!1)}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Where should this server be saved?"}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(u.$,{variant:"outline",className:"flex-1",onClick:()=>g("user"),children:"Global"}),(0,n.jsx)(u.$,{variant:"outline",className:"flex-1",onClick:()=>d(!0),children:"Project"})]})]})]})})]})}function N({name:e,type:s,detail:t,onClick:a}){return(0,n.jsxs)("button",{type:"button",onClick:a,className:"flex w-full items-center gap-3 rounded px-2 py-2 hover:bg-muted transition-colors text-left",children:[(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"font-mono font-bold text-sm truncate",children:e}),(0,n.jsx)(x.E,{variant:"secondary",className:"text-[10px]",children:s})]}),t&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:t})]}),(0,n.jsx)(l.A,{className:"h-4 w-4 text-muted-foreground shrink-0"})]})}function g({name:e,scope:s,cwd:t,onBack:a,getServer:l,onDelete:c}){let d=decodeURIComponent(e),m=(0,i.useRouter)(),[p,f]=(0,o.useState)(null),[N,w]=(0,o.useState)(!0),[b,y]=(0,o.useState)(!1),[C,k]=(0,o.useState)(null),[S,$]=(0,o.useState)(null),[R,P]=(0,o.useState)(null),[E,U]=(0,o.useState)(!1);async function L(){k("test"),$(null),P(null);try{let e=new URLSearchParams({scope:s});"project"===s&&t&&e.set("cwd",t);let n=await fetch(`/api/mcp-servers/${encodeURIComponent(d)}/test?${e}`,{method:"POST"}),a=await n.json();P(a)}catch{P({success:!1,logs:"Request failed"})}finally{k(null)}}async function A(){U(!1),k("delete"),$(null),await c(d,s)?a():($("Failed to delete server"),k(null))}if((0,o.useEffect)(()=>{l(d,s,t).then(e=>{e?.config?f(e.config):y(!0)}).catch(()=>y(!0)).finally(()=>w(!1))},[d,s,t,l]),N)return(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,n.jsx)(v,{onClick:a}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading..."})]});if(b||!p)return(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,n.jsx)(v,{onClick:a}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Server not found."})]});let D=p.type||(p.command?"stdio":p.url?"http":"stdio"),Z=p.env?Object.keys(p.env):[],I=p.headers?Object.keys(p.headers):[];return(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-6",children:[(0,n.jsx)(v,{onClick:a}),(0,n.jsx)("div",{children:(0,n.jsx)("h1",{className:"font-mono font-bold text-lg",children:d})}),S&&(0,n.jsx)("div",{className:"rounded border border-red-500/30 bg-red-500/5 p-3 text-sm text-red-500",children:S}),(0,n.jsxs)(h.Zp,{children:[(0,n.jsx)(h.aR,{children:(0,n.jsx)(h.ZB,{className:"text-sm",children:"Details"})}),(0,n.jsxs)(h.Wu,{className:"space-y-3 text-sm",children:[(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Scope"}),(0,n.jsx)(x.E,{variant:"secondary",className:"text-[10px]",children:"user"===s?"Global":"Project"})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Type"}),(0,n.jsx)("span",{className:"font-mono",children:D})]}),p.command&&(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Command"}),(0,n.jsx)("span",{className:"font-mono text-xs truncate ml-4 max-w-[60%] text-right",title:p.command,children:p.command})]}),p.args&&p.args.length>0&&(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Arguments"}),(0,n.jsx)("span",{className:"font-mono text-xs text-right max-w-[60%] break-words",title:p.args.join(" "),children:p.args.join(", ")})]}),p.url&&(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"URL"}),(0,n.jsx)("span",{className:"font-mono text-xs truncate ml-4 max-w-[60%] text-right",title:p.url,children:p.url})]}),Z.length>0&&(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Environment"}),(0,n.jsx)("span",{className:"text-xs text-right max-w-[60%] break-words",children:Z.map(e=>(0,n.jsxs)("span",{className:"block font-mono",children:[e,"=",p.env[e]]},e))})]}),I.length>0&&(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Headers"}),(0,n.jsx)("span",{className:"text-xs text-right max-w-[60%] break-words",children:I.map(e=>(0,n.jsxs)("span",{className:"block font-mono",children:[e,": ",p.headers[e]]},e))})]})]})]}),(0,n.jsxs)(h.Zp,{children:[(0,n.jsx)(h.aR,{children:(0,n.jsx)(h.ZB,{className:"text-sm",children:"Actions"})}),(0,n.jsxs)(h.Wu,{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm",children:"Test connection"}),(0,n.jsx)(u.$,{size:"sm",variant:"outline",onClick:L,disabled:null!==C,children:"test"===C?(0,n.jsx)(r.A,{className:"h-4 w-4 animate-spin"}):"Test"})]}),R&&(0,n.jsxs)("div",{className:`rounded border p-2 text-xs ${R.success?"border-green-500/30 bg-green-500/5":"border-red-500/30 bg-red-500/5"}`,children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,n.jsx)("span",{className:`inline-block h-2 w-2 rounded-full ${R.success?"bg-green-500":"bg-red-500"}`}),(0,n.jsx)("span",{className:"font-medium",children:R.success?"Connected":"Failed"})]}),(0,n.jsx)("pre",{className:"whitespace-pre-wrap text-muted-foreground font-mono leading-relaxed",children:R.logs})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm",children:"Edit configuration"}),(0,n.jsx)(u.$,{size:"sm",variant:"outline",onClick:function(){let e=new URLSearchParams({scope:s});"project"===s&&t&&e.set("cwd",t),m.push(`/mcp-servers/${encodeURIComponent(d)}?${e}`)},disabled:null!==C,children:"Edit"})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm",children:"Delete server"}),(0,n.jsx)(u.$,{size:"sm",variant:"destructive",onClick:()=>U(!0),disabled:null!==C,children:"delete"===C?(0,n.jsx)(r.A,{className:"h-4 w-4 animate-spin"}):"Delete"})]})]})]}),(0,n.jsx)(j.lG,{open:E,onOpenChange:U,children:(0,n.jsxs)(j.Cf,{children:[(0,n.jsx)(j.c7,{children:(0,n.jsx)(j.L3,{children:"Delete Server"})}),(0,n.jsxs)("p",{className:"text-sm text-muted-foreground mb-4",children:["Delete ",(0,n.jsx)("span",{className:"font-mono font-bold",children:d}),"? This cannot be undone."]}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(u.$,{variant:"outline",onClick:()=>U(!1),children:"Cancel"}),(0,n.jsx)(u.$,{variant:"destructive",onClick:A,children:"Delete"})]})]})})]})}function v({onClick:e}){return(0,n.jsxs)("button",{type:"button",onClick:e,className:"inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[(0,n.jsx)(c.A,{className:"h-4 w-4"}),"Back to MCP Servers"]})}}},e=>{e.O(0,[989,25781,1550,28441,93794,77358],()=>e(e.s=61239)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[29415],{14683:(e,t,s)=>{Promise.resolve().then(s.bind(s,49524))},49524:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>M});var n=s(95155),l=s(1550),a=s(76721),r=s(14225),o=s(65738),i=s(2125);let c=(0,s(99537).A)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);var d=s(16449),u=s(49804),x=s(73321),h=s(12115),m=s(45160),f=s(89239),p=s(42763),g=s(89323),j=s(64577),w=s(99314),N=s(65377),b=s(92571),v=s(9005),y=s(81477),S=s(16617);function k({preview:e,matchStart:t,matchLength:s}){let l=e.slice(0,t),a=e.slice(t,t+s),r=e.slice(t+s);return(0,n.jsxs)("span",{className:"text-sm text-muted-foreground whitespace-pre-wrap break-words select-text",children:[l,(0,n.jsx)("mark",{className:"bg-yellow-300/30 text-foreground rounded-sm px-0.5",children:a}),r]})}function C({text:e}){let[t,s]=(0,h.useState)(!1),l=(0,h.useCallback)(t=>{t.stopPropagation(),navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!1),1500)},[e]);return(0,n.jsx)(f.$,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:l,title:"Copy full message",children:t?(0,n.jsx)(j.A,{className:"h-3 w-3"}):(0,n.jsx)(w.A,{className:"h-3 w-3"})})}function $({onClose:e}){let[t,s]=(0,h.useState)(""),[l,a]=(0,h.useState)([]),[o,i]=(0,h.useState)(!1),[c,d]=(0,h.useState)(!1),[u,x]=(0,h.useState)(!1),[p,g]=(0,h.useState)(null),[j,w]=(0,h.useState)(null),A=(0,h.useRef)(null),E=(0,h.useRef)(null);(0,h.useEffect)(()=>{A.current?.focus()},[]);let D=(0,h.useCallback)((e,t,s)=>fetch(`/api/sessions/search?q=${encodeURIComponent(e)}&offset=${t}`,{signal:s}).then(e=>e.json()),[]);(0,h.useEffect)(()=>{if(t.length<2){a([]),x(!1),g(null);return}let e=setTimeout(()=>{E.current?.abort();let e=new AbortController;E.current=e,i(!0),D(t,0,e.signal).then(t=>{e.signal.aborted||(a(t.results||[]),g({total:t.totalFilesSearched||0,truncated:!!t.truncated}),x(!0),i(!1))}).catch(e=>{"AbortError"!==e.name&&(i(!1),x(!0))})},500);return()=>{clearTimeout(e)}},[t,D]);let L=(0,h.useCallback)(()=>{if(c||!p?.truncated)return;d(!0);let e=new AbortController;D(t,l.length,e.signal).then(e=>{a(t=>[...t,...e.results||[]]),g({total:e.totalFilesSearched||0,truncated:!!e.truncated}),d(!1)}).catch(()=>{d(!1)})},[t,l.length,c,p?.truncated,D]);(0,h.useEffect)(()=>()=>{E.current?.abort()},[]);let T=(0,h.useCallback)(t=>{t.target===t.currentTarget&&e()},[e]);return((0,h.useEffect)(()=>{let t=t=>{"Escape"===t.key&&(t.preventDefault(),t.stopPropagation(),e())};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e]),j)?(0,n.jsx)(S.Q,{timestamp:j.timestamp,sessionId:j.sessionId,cwd:j.cwd,onClose:()=>w(null)}):(0,n.jsx)("div",{className:"fixed inset-0 z-50 bg-black/50 flex items-center justify-center p-4",onClick:T,children:(0,n.jsxs)(y.Zp,{className:"w-full max-w-2xl flex flex-col",style:{maxHeight:"calc(100dvh - 2rem)"},children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 p-4 border-b",children:[(0,n.jsx)(N.A,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,n.jsx)("input",{ref:A,value:t,onChange:e=>s(e.target.value),placeholder:"Search all session messages...",className:"flex-1 bg-transparent outline-none text-sm"}),o&&(0,n.jsx)(b.A,{className:"h-4 w-4 animate-spin text-muted-foreground shrink-0"}),(0,n.jsx)(f.$,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:e,children:(0,n.jsx)(v.A,{className:"h-4 w-4"})})]}),(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[u&&0===l.length&&(0,n.jsx)("div",{className:"p-8 text-center text-sm text-muted-foreground",children:"No results"}),l.map((e,t)=>(0,n.jsxs)("button",{onClick:()=>w(e),className:"w-full text-left p-4 border-b last:border-b-0 hover:bg-muted/50 transition-colors cursor-pointer",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,n.jsx)(m.E,{variant:"user"===e.role?"default":"secondary",className:"text-[10px] px-1.5 py-0",children:"user"===e.role?"User":"Assistant"}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:new Date(e.timestamp).toLocaleString()}),(0,n.jsx)("div",{className:"ml-auto flex items-center gap-1",children:(0,n.jsx)(C,{text:e.fullContent})})]}),(0,n.jsxs)("div",{className:"mb-1.5 text-[11px] text-muted-foreground",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(r.A,{className:"h-3 w-3 shrink-0"}),(0,n.jsx)("span",{className:"truncate",children:e.dirName})]}),(0,n.jsx)("div",{className:"truncate pl-[18px]",children:e.sessionName})]}),(0,n.jsx)(k,{preview:e.preview,matchStart:e.matchStart,matchLength:e.matchLength})]},`${e.messageId}-${t}`))]}),p&&u&&l.length>0&&(0,n.jsxs)("div",{className:"px-4 py-2 border-t text-[11px] text-muted-foreground flex items-center justify-between",children:[(0,n.jsxs)("span",{children:[l.length," result",1!==l.length?"s":""," across ",p.total," session",1!==p.total?"s":""]}),p.truncated&&(0,n.jsx)("button",{onClick:L,disabled:c,className:"text-[11px] text-primary hover:underline disabled:opacity-50",children:c?"Loading...":"Load more"})]})]})})}function A(){let[e,t]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.shiftKey&&"f"===e.key&&(e.preventDefault(),t(!0))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{onClick:()=>t(!0),className:"w-full flex items-center gap-2 rounded-lg border bg-card px-3 py-2 text-sm text-muted-foreground hover:bg-accent/50 transition-colors",children:[(0,n.jsx)(N.A,{className:"h-4 w-4"}),(0,n.jsx)("span",{children:"Search all session messages..."}),(0,n.jsx)("kbd",{className:"ml-auto hidden sm:inline text-[10px] border rounded px-1.5 py-0.5",children:"Ctrl+Shift+F"})]}),e&&(0,n.jsx)($,{onClose:()=>t(!1)})]})}var E=s(20108);function D({session:e,onClick:t,onDelete:s}){return(0,n.jsxs)("button",{onClick:t,className:"w-full flex items-center gap-3 px-3 py-2 text-left rounded-md hover:bg-accent/50 transition-colors group",children:[(0,n.jsx)("span",{className:"text-sm truncate flex-1",children:e.name}),(0,n.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:["running"===e.status&&(0,n.jsx)(m.E,{variant:"default",className:"text-xs",children:"running"}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:function(e){let t=Math.floor((Date.now()-e)/1e3);if(t<60)return"just now";let s=Math.floor(t/60);if(s<60)return`${s}m ago`;let n=Math.floor(s/60);if(n<24)return`${n}h ago`;let l=Math.floor(n/24);return l<30?`${l}d ago`:new Date(e).toLocaleDateString()}(e.lastActiveAt)}),s&&"running"!==e.status&&(0,n.jsx)("span",{role:"button",onClick:e=>{e.stopPropagation(),s(e)},className:"p-1 rounded hover:bg-destructive/10 opacity-0 group-hover:opacity-100 transition-opacity",title:"Delete session",children:(0,n.jsx)(o.A,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-destructive"})})]})]})}var L=s(23965);let T=null,I="cockpit_fav_dirs";function O({group:e,isFavorite:t,onToggleFavorite:s,onSelectSession:l,onCreateSession:d,onDeleteSession:u,onDeleteAll:x}){let[f,p]=(0,h.useState)(!1),[g,j]=(0,h.useState)(null),[w,N]=(0,h.useState)(!1),b=g||e.sessions,v=b.length<e.totalSessionCount,y=b[0]?.lastActiveAt||0,S=b.filter(e=>"running"===e.status).length,k=async()=>{if(!w){N(!0);try{let t=await fetch(`/api/sessions/group?cwd=${encodeURIComponent(e.cwd)}`);if(t.ok){let e=await t.json();j(e.sessions||[])}}finally{N(!1)}}};return(0,n.jsxs)("div",{className:"rounded-lg border bg-card",children:[(0,n.jsxs)("div",{role:"button",onClick:()=>p(!f),className:"w-full flex items-center gap-2 p-3 text-left hover:bg-accent/50 rounded-lg transition-colors cursor-pointer",children:[(0,n.jsx)(a.A,{className:`h-4 w-4 shrink-0 text-muted-foreground transition-transform ${f?"rotate-90":""}`}),(0,n.jsx)(r.A,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,n.jsx)("span",{className:"font-medium text-sm truncate flex-1",children:e.dirName}),(0,n.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[S>0&&(0,n.jsxs)("span",{className:"text-xs bg-primary text-primary-foreground px-1.5 py-0.5 rounded",children:[S," running"]}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:function(e){let t=Math.floor((Date.now()-e)/1e3);if(t<60)return"just now";let s=Math.floor(t/60);if(s<60)return`${s}m ago`;let n=Math.floor(s/60);if(n<24)return`${n}h ago`;let l=Math.floor(n/24);return l<30?`${l}d ago`:new Date(e).toLocaleDateString()}(y)}),(0,n.jsxs)(m.E,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:[e.totalSessionCount," session",1!==e.totalSessionCount?"s":""]})]})]}),f&&(0,n.jsxs)("div",{className:"px-3 pb-3 space-y-1",children:[(0,n.jsxs)("div",{className:"flex items-center justify-end gap-1 pb-1",children:[(0,n.jsx)("button",{onClick:()=>x(e),className:"p-1 rounded hover:bg-destructive/10",title:"Delete all sessions in this folder",children:(0,n.jsx)(o.A,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-destructive"})}),(0,n.jsx)("button",{onClick:()=>d(e.cwd),className:"p-1 rounded hover:bg-accent",title:"New session in this folder",children:(0,n.jsx)(i.A,{className:"h-3.5 w-3.5 text-muted-foreground"})}),(0,n.jsx)("button",{onClick:()=>s(),className:"p-1 rounded hover:bg-accent",children:(0,n.jsx)(c,{className:`h-3.5 w-3.5 ${t?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`})})]}),b.map(e=>(0,n.jsx)(D,{session:e,onClick:()=>l(e),onDelete:()=>u(e)},e.id)),v&&(0,n.jsx)("button",{onClick:k,disabled:w,className:"w-full text-xs text-muted-foreground hover:text-foreground py-2 rounded hover:bg-accent/50 transition-colors disabled:opacity-50",children:w?"Loading...":`Load all ${e.totalSessionCount} sessions`})]})]})}function P(){let e=(0,x.useRouter)(),{connected:t}=(0,g.h)(),[s,l]=(0,h.useState)(T||[]),[a,r]=(0,h.useState)(new Set),[o,c]=(0,h.useState)(!1),[m,j]=(0,h.useState)(!!T),w=(0,h.useRef)(!1),[N,b]=(0,h.useState)(null),[v,y]=(0,h.useState)(!1),[S,k]=(0,h.useState)(null);(0,h.useEffect)(()=>{r(function(){try{let e=localStorage.getItem(I);if(e)return new Set(JSON.parse(e))}catch{}return new Set}())},[]);let C=(0,h.useCallback)(async()=>{let e=await fetch("/api/sessions");if(e.ok){let t=((await e.json()).groups||[]).filter(e=>!e.cwd.endsWith(".cockpit/reviews"));T=t,l(t)}j(!0)},[]);(0,h.useEffect)(()=>{w.current||(w.current=!0,C())},[C]),(0,h.useEffect)(()=>{t&&C()},[t,C]);let $=e=>{r(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),localStorage.setItem(I,JSON.stringify([...s])),s})},D=async(t,s,n)=>{let l=await fetch("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:t,name:s||void 0,runtime:n})});if(l.ok){let s=await l.json();await (0,L.MN)(s.sessionId),e.push(`/sessions/${s.sessionId}?cwd=${encodeURIComponent(t)}`)}},P=t=>{e.push(`/sessions/${t.id}?cwd=${encodeURIComponent(t.cwd)}&historyView=true`)},M=async()=>{if(N){if(y(!0),"single"===N.type){let{session:e}=N;await fetch(`/api/sessions/${e.id}?cwd=${encodeURIComponent(e.cwd)}`,{method:"DELETE"})}else{let{group:e}=N,t=e.sessions;if(e.totalSessionCount>e.sessions.length){let s=await fetch(`/api/sessions/group?cwd=${encodeURIComponent(e.cwd)}`);s.ok&&(t=(await s.json()).sessions||t)}let s=t.filter(e=>"running"!==e.status).map(e=>({id:e.id,cwd:e.cwd}));s.length>0&&await fetch("/api/sessions/bulk-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessions:s})})}b(null),y(!1),C()}},R=N?.type==="single"?"Delete Session":"Delete All Sessions",F=N?.type==="single"?"Permanently delete this session and its transcript? This cannot be undone.":(()=>{let e=N?.group;if(!e)return"";let t=e.sessions.filter(e=>"running"===e.status).length,s=e.totalSessionCount-t,n=`Permanently delete ${s} session${1!==s?"s":""} in "${e.dirName}"? This cannot be undone.`;return t>0&&(n+=` ${t} running session${1!==t?"s":""} will be skipped.`),n})(),_=s.filter(e=>a.has(e.cwd)),U=s.filter(e=>!a.has(e.cwd));return(0,n.jsxs)("div",{className:"p-4 pb-24 space-y-3",children:[(0,n.jsx)("h1",{className:"text-2xl font-bold",children:"Sessions"}),(0,n.jsx)(A,{}),0===s.length&&m&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"No sessions found. Create one to get started."}),_.map(e=>(0,n.jsx)(O,{group:e,isFavorite:!0,onToggleFavorite:()=>$(e.cwd),onSelectSession:P,onCreateSession:e=>k(e),onDeleteSession:e=>b({type:"single",session:e}),onDeleteAll:e=>b({type:"bulk",group:e})},e.cwd)),_.length>0&&U.length>0&&(0,n.jsx)("div",{className:"border-t"}),U.map(e=>(0,n.jsx)(O,{group:e,isFavorite:!1,onToggleFavorite:()=>$(e.cwd),onSelectSession:P,onCreateSession:e=>k(e),onDeleteSession:e=>b({type:"single",session:e}),onDeleteAll:e=>b({type:"bulk",group:e})},e.cwd)),(0,n.jsx)("div",{className:"fixed bottom-6 right-6",children:(0,n.jsxs)(f.$,{size:"lg",className:"rounded-full shadow-lg",onClick:()=>c(!0),children:[(0,n.jsx)(i.A,{className:"h-5 w-5 mr-1"}),"New Session"]})}),(0,n.jsx)(E.t,{open:o,onOpenChange:c,onSubmit:D}),(0,n.jsx)(p.lG,{open:!!S,onOpenChange:e=>{e||k(null)},children:(0,n.jsxs)(p.Cf,{onClose:()=>k(null),children:[(0,n.jsx)(p.c7,{children:(0,n.jsx)(p.L3,{children:"Choose Backend"})}),(0,n.jsxs)("div",{className:"space-y-3 mt-2",children:[(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Pick how claude runs for this session."}),(0,n.jsx)("button",{type:"button",onClick:()=>{k(null),D(S,"","pty")},className:"w-full text-left rounded-lg border border-input bg-card px-4 py-3 transition-colors hover:border-foreground hover:bg-accent",children:(0,n.jsxs)("div",{className:"flex items-center gap-3 mb-1",children:[(0,n.jsx)(d.A,{className:"h-5 w-5 text-foreground"}),(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsx)("div",{className:"text-sm font-medium",children:"PTY (interactive)"}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground",children:"Pseudo-terminal"})]})]})}),(0,n.jsx)("button",{type:"button",onClick:()=>{k(null),D(S,"","stream")},className:"w-full text-left rounded-lg border border-input bg-card px-4 py-3 transition-colors hover:border-foreground hover:bg-accent",children:(0,n.jsxs)("div",{className:"flex items-center gap-3 mb-1",children:[(0,n.jsx)(u.A,{className:"h-5 w-5 text-foreground"}),(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsx)("div",{className:"text-sm font-medium",children:"Stream (headless)"}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground",children:"Structured output"})]})]})})]})]})}),(0,n.jsx)(p.lG,{open:!!N,onOpenChange:()=>b(null),children:(0,n.jsxs)(p.Cf,{children:[(0,n.jsx)(p.c7,{children:(0,n.jsx)(p.L3,{children:R})}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:F}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(f.$,{variant:"outline",onClick:()=>b(null),disabled:v,children:"Cancel"}),(0,n.jsx)(f.$,{variant:"destructive",onClick:M,disabled:v,children:v?"Deleting...":"Delete"})]})]})})]})}function M(){return(0,l.si)("Cockpit",{usageOnly:!0}),(0,n.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:(0,n.jsx)(P,{})})}}},e=>{e.O(0,[989,25781,1550,28441,93794,77358],()=>e(e.s=14683)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[13472],{48792:(e,s,t)=>{Promise.resolve().then(t.bind(t,66747))},66747:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>N});var n=t(95155),a=t(82749),l=t(92571),i=t(31966),r=t(76721),c=t(73321),o=t(12115),d=t(1550),u=t(45160),m=t(89239),x=t(81477),p=t(42763),h=t(60529);async function j(e,s){try{let t=await fetch(e,s);if(t.ok)return{ok:!0};let n=await t.json().catch(()=>({}));return{ok:!1,error:n.error||`Request failed (${t.status})`}}catch{return{ok:!1,error:"Request failed"}}}let f="__add__",g="__all__";function N(){(0,d.si)("Plugins",{hideActions:!0});let e=(0,c.useRouter)(),s=(0,c.useSearchParams)(),t=s.get("detail"),l=s.get("mkt"),{installed:i,available:r,marketplaces:u,loading:p,error:h,refresh:N,install:k,setEnabled:w,uninstall:C,update:I,addMarketplace:U,removeMarketplace:A,updateMarketplace:E}=function(){let[e,s]=(0,o.useState)([]),[t,n]=(0,o.useState)([]),[a,l]=(0,o.useState)([]),[i,r]=(0,o.useState)(!0),[c,d]=(0,o.useState)(null),u=(0,o.useCallback)(()=>{r(!0),d(null),fetch("/api/plugins").then(async e=>{let s=await e.json();if(!e.ok)throw Error(s.error||"Failed to load plugins");return s}).then(e=>{s(e.installed??[]),n(e.available??[]),l(e.marketplaces??[])}).catch(e=>d(e instanceof Error?e.message:"Failed to load plugins")).finally(()=>r(!1))},[]);(0,o.useEffect)(()=>{u()},[u]);let m=(0,o.useCallback)(async(e,s,t)=>{let n=await j(`/api/plugins/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:s?"enable":"disable",scope:t})});return n.ok&&u(),n},[u]),x=(0,o.useCallback)(async(e,s)=>{let t=new URLSearchParams;s&&t.set("scope",s);let n=await j(`/api/plugins/${encodeURIComponent(e)}?${t}`,{method:"DELETE"});return n.ok&&u(),n},[u]),p=(0,o.useCallback)(async e=>{let s=await j(`/api/plugins/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update"})});return s.ok&&u(),s},[u]),h=(0,o.useCallback)(async(e,s="user")=>{let t=await j("/api/plugins/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin:e,scope:s})});return t.ok&&u(),t},[u]),f=(0,o.useCallback)(async e=>{let s=await j("/api/plugins/marketplaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"add",source:e})});return s.ok&&u(),s},[u]),g=(0,o.useCallback)(async e=>{let s=await j(`/api/plugins/marketplaces/${encodeURIComponent(e)}`,{method:"DELETE"});return s.ok&&u(),s},[u]),N=(0,o.useCallback)(async e=>{let s=e?await j(`/api/plugins/marketplaces/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update"})}):await j("/api/plugins/marketplaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update"})});return s.ok&&u(),s},[u]);return{installed:e,available:t,marketplaces:a,loading:i,error:c,refresh:u,setEnabled:m,uninstall:x,update:p,install:h,addMarketplace:f,removeMarketplace:g,updateMarketplace:N}}(),O=t?i.find(e=>e.id===t)??null:null,T=l?u.find(e=>e.name===l)??null:null,[L,P]=(0,o.useState)("installed"),[_,F]=(0,o.useState)(null),[Z,D]=(0,o.useState)(null),[z,B]=(0,o.useState)(null),W=(0,o.useMemo)(()=>new Set(i.map(e=>e.id)),[i]);async function J(e){F(e),D(null);let s=await k(e,"user");s.ok||D(s.error??"Failed to install plugin"),F(null)}async function M(e){B(f),D(null);let s=await U(e);return s.ok||D(s.error??"Failed to add marketplace"),B(null),s.ok}async function G(e){B(e??g),D(null);let s=await E(e);s.ok||D(s.error??"Failed to update marketplace"),B(null)}return t?(0,n.jsx)(v,{plugin:O,onBack:()=>e.push("/plugins"),onSetEnabled:async(e,s,t)=>{let n=await w(e,s,t);return n.ok&&N(),n},onUninstall:async(e,s)=>await C(e,s),onUpdate:async e=>{let s=await I(e);return s.ok&&N(),s}}):l?(0,n.jsx)($,{marketplace:T,onBack:()=>e.push("/plugins"),onUpdate:async e=>{await E(e),N()},onRemove:async e=>{await A(e),N()}}):(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)(b,{active:"installed"===L,onClick:()=>P("installed"),label:"Installed",count:i.length}),(0,n.jsx)(b,{active:"browse"===L,onClick:()=>P("browse"),label:"Browse",count:r.length}),(0,n.jsx)(b,{active:"marketplaces"===L,onClick:()=>P("marketplaces"),label:"Marketplaces",count:u.length})]}),(0,n.jsx)(m.$,{size:"sm",variant:"ghost",onClick:N,disabled:p,title:"Refresh",children:(0,n.jsx)(a.A,{className:`h-4 w-4 ${p?"animate-spin":""}`})})]}),h&&(0,n.jsx)("div",{className:"rounded border border-red-500/30 bg-red-500/5 p-3 text-sm text-red-500",children:h}),Z&&(0,n.jsx)("div",{className:"rounded border border-red-500/30 bg-red-500/5 p-3 text-sm text-red-500",children:Z}),p&&0===i.length&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading plugins..."}),"installed"===L&&!p&&(0,n.jsx)(x.Zp,{children:(0,n.jsx)(x.Wu,{className:"space-y-1 pt-4",children:0===i.length?(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"No plugins installed. Browse a marketplace to add one."}):i.map(e=>(0,n.jsx)(S,{plugin:e},e.id))})}),"browse"===L&&!p&&(0,n.jsx)(y,{available:r,installedIds:W,busyId:_,onInstall:J}),"marketplaces"===L&&!p&&(0,n.jsx)(R,{marketplaces:u,busy:z,onAdd:M,onUpdate:G})]})}function b({active:e,onClick:s,label:t,count:a}){return(0,n.jsxs)("button",{type:"button",onClick:s,className:`rounded-md px-3 py-1.5 text-sm transition-colors ${e?"bg-muted font-medium":"text-muted-foreground hover:text-foreground"}`,children:[t,(0,n.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground",children:a})]})}function y({available:e,installedIds:s,busyId:t,onInstall:a}){let[i,r]=(0,o.useState)(""),[c,d]=(0,o.useState)(null),j=i.trim().toLowerCase(),f=j?e.filter(e=>e.name.toLowerCase().includes(j)||(e.description?.toLowerCase().includes(j)??!1)):e,g=f.slice(0,100);return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)(h.p,{placeholder:"Search plugins...",value:i,onChange:e=>r(e.target.value)}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"Installs to user scope."}),0===f.length?(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"No plugins match your search."}):(0,n.jsx)(x.Zp,{children:(0,n.jsx)(x.Wu,{className:"space-y-1 pt-4",children:g.map(e=>(0,n.jsx)(k,{plugin:e,installed:s.has(e.pluginId),busy:t===e.pluginId,onInstall:()=>a(e.pluginId),onClick:()=>d(e)},e.pluginId))})}),f.length>g.length&&(0,n.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Showing ",g.length," of ",f.length,". Refine your search to narrow the list."]}),(0,n.jsx)(p.lG,{open:!!c,onOpenChange:()=>d(null),children:(0,n.jsx)(p.Cf,{children:c&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(p.c7,{children:(0,n.jsx)(p.L3,{className:"font-mono font-bold",children:c.name})}),(0,n.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsxs)("span",{className:"text-xs text-muted-foreground",children:["@",c.marketplaceName]}),"number"==typeof c.installCount&&(0,n.jsxs)(u.E,{variant:"secondary",className:"text-[10px]",children:[c.installCount," installs"]})]}),c.description?(0,n.jsx)("p",{className:"text-sm whitespace-pre-wrap",children:c.description}):(0,n.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"No description available."}),(0,n.jsx)("div",{className:"flex justify-end pt-2",children:s.has(c.pluginId)?(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:"Already installed"}):(0,n.jsx)(m.$,{size:"sm",variant:"default",onClick:()=>{a(c.pluginId),d(null)},disabled:t===c.pluginId,children:t===c.pluginId?(0,n.jsx)(l.A,{className:"h-4 w-4 animate-spin"}):"Install"})})]})]})})})]})}function k({plugin:e,installed:s,busy:t,onInstall:a,onClick:i}){let{name:r,marketplace:c}=C(e.pluginId);return(0,n.jsxs)("div",{className:"flex items-center gap-3 rounded px-2 py-2 hover:bg-muted transition-colors",children:[(0,n.jsxs)("button",{type:"button",onClick:i,className:"flex-1 min-w-0 text-left",children:[(0,n.jsx)("span",{className:"block font-mono font-bold text-sm truncate",children:r}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 mt-0.5",children:[c&&(0,n.jsxs)("span",{className:"text-xs text-muted-foreground",children:["@",c]}),"number"==typeof e.installCount&&(0,n.jsxs)(u.E,{variant:"secondary",className:"text-[10px]",children:[e.installCount," installs"]})]}),e.description&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:e.description})]}),(0,n.jsx)("div",{className:"shrink-0",children:s?(0,n.jsx)("span",{className:"px-2 text-xs text-muted-foreground",children:"Installed"}):(0,n.jsx)(m.$,{size:"sm",variant:"outline",onClick:a,disabled:t,children:t?(0,n.jsx)(l.A,{className:"h-3.5 w-3.5 animate-spin"}):"Install"})})]})}function v({plugin:e,onBack:s,onSetEnabled:t,onUninstall:a,onUpdate:i}){let[r,c]=(0,o.useState)(null),[d,h]=(0,o.useState)(null),[j,f]=(0,o.useState)(!1);if(!e)return(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,n.jsx)(w,{onClick:s}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Plugin not found."})]});let{name:g,marketplace:N}=C(e.id),b=e.mcpServers?Object.keys(e.mcpServers):[];async function y(s){c("toggle"),h(null);let n=await t(e.id,s,e.scope);n.ok||h(n.error??"Failed to update plugin"),c(null)}async function k(){c("update"),h(null);let s=await i(e.id);s.ok||h(s.error??"Failed to update plugin"),c(null)}async function S(){f(!1),c("uninstall"),h(null);let t=await a(e.id,e.scope);t.ok?s():(h(t.error??"Failed to uninstall plugin"),c(null))}return(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-6",children:[(0,n.jsx)(w,{onClick:s}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"font-mono font-bold text-lg",children:g}),N&&(0,n.jsxs)("p",{className:"text-sm text-muted-foreground",children:["@",N]})]}),d&&(0,n.jsx)("div",{className:"rounded border border-red-500/30 bg-red-500/5 p-3 text-sm text-red-500",children:d}),(0,n.jsxs)(x.Zp,{children:[(0,n.jsx)(x.aR,{children:(0,n.jsx)(x.ZB,{className:"text-sm",children:"Details"})}),(0,n.jsxs)(x.Wu,{className:"space-y-3 text-sm",children:[(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Version"}),(0,n.jsx)("span",{className:"font-mono",children:e.version})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Scope"}),(0,n.jsx)(u.E,{variant:"secondary",className:"text-[10px]",children:e.scope})]}),(0,n.jsxs)("div",{className:"flex justify-between items-center",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Status"}),(0,n.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:`inline-block h-2 w-2 rounded-full ${e.enabled?"bg-green-500":"bg-muted-foreground/40"}`}),e.enabled?"Enabled":"Disabled"]})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Install path"}),(0,n.jsx)("span",{className:"font-mono text-xs truncate ml-4 max-w-[60%] text-right",title:e.installPath,children:e.installPath})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Installed at"}),(0,n.jsx)("span",{children:I(e.installedAt)})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Last updated"}),(0,n.jsx)("span",{children:I(e.lastUpdated)})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"MCP servers"}),(0,n.jsx)("span",{className:"text-right max-w-[60%] truncate",title:b.join(", "),children:b.length>0?b.join(", "):"None"})]})]})]}),(0,n.jsxs)(x.Zp,{children:[(0,n.jsx)(x.aR,{children:(0,n.jsx)(x.ZB,{className:"text-sm",children:"Actions"})}),(0,n.jsxs)(x.Wu,{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm",children:"Update from marketplace source"}),(0,n.jsx)(m.$,{size:"sm",variant:"outline",onClick:k,disabled:null!==r,children:"update"===r?(0,n.jsx)(l.A,{className:"h-4 w-4 animate-spin"}):"Update"})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("span",{className:"text-sm",children:[e.enabled?"Disable":"Enable"," plugin"]}),(0,n.jsx)(m.$,{size:"sm",variant:e.enabled?"outline":"default",onClick:()=>y(!e.enabled),disabled:null!==r,children:"toggle"===r?(0,n.jsx)(l.A,{className:"h-4 w-4 animate-spin"}):e.enabled?"Disable":"Enable"})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm",children:"Remove from disk"}),(0,n.jsx)(m.$,{size:"sm",variant:"destructive",onClick:()=>f(!0),disabled:null!==r,children:"uninstall"===r?(0,n.jsx)(l.A,{className:"h-4 w-4 animate-spin"}):"Uninstall"})]})]})]}),(0,n.jsx)(p.lG,{open:j,onOpenChange:f,children:(0,n.jsxs)(p.Cf,{children:[(0,n.jsx)(p.c7,{children:(0,n.jsx)(p.L3,{children:"Uninstall Plugin"})}),(0,n.jsxs)("p",{className:"text-sm text-muted-foreground mb-4",children:["Uninstall ",(0,n.jsx)("span",{className:"font-mono font-bold",children:e.id}),"? This removes it from disk."]}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(m.$,{variant:"outline",onClick:()=>f(!1),children:"Cancel"}),(0,n.jsx)(m.$,{variant:"destructive",onClick:S,children:"Uninstall"})]})]})})]})}function w({onClick:e}){return(0,n.jsxs)("button",{type:"button",onClick:e,className:"inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[(0,n.jsx)(i.A,{className:"h-4 w-4"}),"Back to Installed"]})}function C(e){let s=e.lastIndexOf("@");return s>0?{name:e.slice(0,s),marketplace:e.slice(s+1)}:{name:e,marketplace:""}}function S({plugin:e}){let{name:s,marketplace:t}=C(e.id),a=(0,c.useRouter)();return(0,n.jsxs)("button",{type:"button",onClick:()=>a.push(`/plugins?detail=${encodeURIComponent(e.id)}`),className:"flex w-full items-center gap-3 rounded px-2 py-2 hover:bg-muted transition-colors text-left",children:[(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("span",{className:"block font-mono font-bold text-sm truncate",children:s}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 mt-0.5",children:[t&&(0,n.jsxs)("span",{className:"text-xs text-muted-foreground",children:["@",t]}),(0,n.jsxs)(u.E,{variant:"secondary",className:"text-[10px]",children:["v",e.version]}),(0,n.jsx)(u.E,{variant:"secondary",className:"text-[10px]",children:e.scope}),(0,n.jsx)("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${e.enabled?"bg-green-500":"bg-muted-foreground/40"}`})]})]}),(0,n.jsx)(r.A,{className:"h-4 w-4 text-muted-foreground shrink-0"})]})}function I(e){if(!e)return"Unknown";let s=new Date(e);return Number.isNaN(s.getTime())?"Unknown":s.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function R({marketplaces:e,busy:s,onAdd:t,onUpdate:a}){let[i,r]=(0,o.useState)(""),d=(0,c.useRouter)(),u=null!==s;async function p(){let e=i.trim();!e||await t(e)&&r("")}return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(h.p,{placeholder:"owner/repo, URL, or local path",value:i,onChange:e=>r(e.target.value),onKeyDown:e=>{"Enter"===e.key&&p()}}),(0,n.jsx)(m.$,{onClick:p,disabled:u||!i.trim(),children:s===f?(0,n.jsx)(l.A,{className:"h-4 w-4 animate-spin"}):"Add"})]}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"Add a GitHub repo, URL, or local path. Adds at user scope."}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("span",{className:"text-sm text-muted-foreground",children:[e.length," configured"]}),(0,n.jsx)(m.$,{size:"sm",variant:"outline",onClick:()=>a(),disabled:u||0===e.length,children:s===g?(0,n.jsx)(l.A,{className:"h-3.5 w-3.5 animate-spin"}):"Update all"})]}),0===e.length?(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"No marketplaces configured. Add one above to browse its plugins."}):(0,n.jsx)(x.Zp,{children:(0,n.jsx)(x.Wu,{className:"space-y-1 pt-4",children:e.map(e=>(0,n.jsx)(A,{marketplace:e,disabled:u,onClick:()=>d.push(`/plugins?mkt=${encodeURIComponent(e.name)}`)},e.name))})})]})}function $({marketplace:e,onBack:s,onUpdate:t,onRemove:a}){let[i,r]=(0,o.useState)(null),[c,d]=(0,o.useState)(null),[u,h]=(0,o.useState)(!1);if(!e)return(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,n.jsx)(w,{onClick:s}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Marketplace not found."})]});async function j(){r("update"),d(null);try{await t(e.name)}catch{d("Failed to update marketplace")}r(null)}async function f(){h(!1),r("remove"),d(null);try{await a(e.name),s()}catch{d("Failed to remove marketplace"),r(null)}}return(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-6",children:[(0,n.jsx)(w,{onClick:s}),(0,n.jsx)("div",{children:(0,n.jsx)("h1",{className:"font-mono font-bold text-lg",children:e.name})}),c&&(0,n.jsx)("div",{className:"rounded border border-red-500/30 bg-red-500/5 p-3 text-sm text-red-500",children:c}),(0,n.jsxs)(x.Zp,{children:[(0,n.jsx)(x.aR,{children:(0,n.jsx)(x.ZB,{className:"text-sm",children:"Details"})}),(0,n.jsxs)(x.Wu,{className:"space-y-3 text-sm",children:[(0,n.jsx)(U,{label:"Source",value:e.source,mono:!0}),e.repo&&(0,n.jsx)(U,{label:"Repo",value:e.repo,mono:!0}),(0,n.jsx)(U,{label:"Install location",value:e.installLocation,mono:!0})]})]}),(0,n.jsxs)(x.Zp,{children:[(0,n.jsx)(x.aR,{children:(0,n.jsx)(x.ZB,{className:"text-sm",children:"Actions"})}),(0,n.jsxs)(x.Wu,{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm",children:"Update from marketplace source"}),(0,n.jsx)(m.$,{size:"sm",variant:"outline",onClick:j,disabled:null!==i,children:"update"===i?(0,n.jsx)(l.A,{className:"h-4 w-4 animate-spin"}):"Update"})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm",children:"Remove marketplace configuration"}),(0,n.jsx)(m.$,{size:"sm",variant:"destructive",onClick:()=>h(!0),disabled:null!==i,children:"remove"===i?(0,n.jsx)(l.A,{className:"h-4 w-4 animate-spin"}):"Remove"})]})]})]}),(0,n.jsx)(p.lG,{open:u,onOpenChange:h,children:(0,n.jsxs)(p.Cf,{children:[(0,n.jsx)(p.c7,{children:(0,n.jsx)(p.L3,{children:"Remove Marketplace"})}),(0,n.jsxs)("p",{className:"text-sm text-muted-foreground mb-4",children:["Remove ",(0,n.jsx)("span",{className:"font-mono font-bold",children:e.name}),"? This removes the marketplace from your configuration."]}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(m.$,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),(0,n.jsx)(m.$,{variant:"destructive",onClick:f,children:"Remove"})]})]})})]})}function U({label:e,value:s,mono:t}){return(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("span",{className:"text-muted-foreground shrink-0",children:e}),(0,n.jsx)("span",{className:`text-right break-all max-w-[70%] ${t?"font-mono text-xs":""}`,children:s})]})}function A({marketplace:e,disabled:s,onClick:t}){return(0,n.jsxs)("button",{type:"button",onClick:t,disabled:s,className:"flex w-full items-center gap-3 rounded px-2 py-2 hover:bg-muted transition-colors text-left disabled:opacity-50",children:[(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("span",{className:"font-mono font-bold text-sm truncate",children:e.name}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:e.source})]}),(0,n.jsx)(r.A,{className:"h-4 w-4 text-muted-foreground shrink-0"})]})}}},e=>{e.O(0,[989,25781,1550,28441,93794,77358],()=>e(e.s=48792)),_N_E=e.O()}]);