@stigmer/server-slim 3.38.2 → 3.38.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (561) hide show
  1. package/console/404.html +1 -1
  2. package/console/__next.__PAGE__.txt +2 -2
  3. package/console/__next._full.txt +14 -14
  4. package/console/__next._head.txt +4 -4
  5. package/console/__next._index.txt +9 -9
  6. package/console/__next._tree.txt +1 -1
  7. package/console/_next/static/chunks/06.c_bejgc0xv.js +3 -0
  8. package/console/_next/static/chunks/{11i.dbxqrdc26.js → 0cnrykkxe_pym.js} +1 -1
  9. package/console/_next/static/chunks/{107k.7sfwlnvt.js → 0f9xh0e8xu4u8.js} +1 -1
  10. package/console/_next/static/chunks/0jeu-2mti735o.js +1 -0
  11. package/console/_not-found/__next._full.txt +14 -14
  12. package/console/_not-found/__next._head.txt +4 -4
  13. package/console/_not-found/__next._index.txt +9 -9
  14. package/console/_not-found/__next._not-found.__PAGE__.txt +3 -3
  15. package/console/_not-found/__next._not-found.txt +3 -3
  16. package/console/_not-found/__next._tree.txt +1 -1
  17. package/console/_not-found.html +1 -1
  18. package/console/_not-found.txt +14 -14
  19. package/console/auth/callback/__next._full.txt +16 -16
  20. package/console/auth/callback/__next._head.txt +4 -4
  21. package/console/auth/callback/__next._index.txt +9 -9
  22. package/console/auth/callback/__next._tree.txt +1 -1
  23. package/console/auth/callback/__next.auth.callback.__PAGE__.txt +4 -4
  24. package/console/auth/callback/__next.auth.callback.txt +3 -3
  25. package/console/auth/callback/__next.auth.txt +3 -3
  26. package/console/auth/callback.html +1 -1
  27. package/console/auth/callback.txt +16 -16
  28. package/console/auth/github/callback/__next._full.txt +16 -16
  29. package/console/auth/github/callback/__next._head.txt +4 -4
  30. package/console/auth/github/callback/__next._index.txt +9 -9
  31. package/console/auth/github/callback/__next._tree.txt +1 -1
  32. package/console/auth/github/callback/__next.auth.github.callback.__PAGE__.txt +4 -4
  33. package/console/auth/github/callback/__next.auth.github.callback.txt +3 -3
  34. package/console/auth/github/callback/__next.auth.github.txt +3 -3
  35. package/console/auth/github/callback/__next.auth.txt +3 -3
  36. package/console/auth/github/callback.html +1 -1
  37. package/console/auth/github/callback.txt +16 -16
  38. package/console/auth/oauth/callback/__next._full.txt +16 -16
  39. package/console/auth/oauth/callback/__next._head.txt +4 -4
  40. package/console/auth/oauth/callback/__next._index.txt +9 -9
  41. package/console/auth/oauth/callback/__next._tree.txt +1 -1
  42. package/console/auth/oauth/callback/__next.auth.oauth.callback.__PAGE__.txt +4 -4
  43. package/console/auth/oauth/callback/__next.auth.oauth.callback.txt +3 -3
  44. package/console/auth/oauth/callback/__next.auth.oauth.txt +3 -3
  45. package/console/auth/oauth/callback/__next.auth.txt +3 -3
  46. package/console/auth/oauth/callback.html +1 -1
  47. package/console/auth/oauth/callback.txt +16 -16
  48. package/console/chat/__placeholder__/__placeholder__/__next._full.txt +15 -15
  49. package/console/chat/__placeholder__/__placeholder__/__next._head.txt +4 -4
  50. package/console/chat/__placeholder__/__placeholder__/__next._index.txt +9 -9
  51. package/console/chat/__placeholder__/__placeholder__/__next._tree.txt +1 -1
  52. package/console/chat/__placeholder__/__placeholder__/__next.chat.$d$org.$d$slug.__PAGE__.txt +3 -3
  53. package/console/chat/__placeholder__/__placeholder__/__next.chat.$d$org.$d$slug.txt +3 -3
  54. package/console/chat/__placeholder__/__placeholder__/__next.chat.$d$org.txt +3 -3
  55. package/console/chat/__placeholder__/__placeholder__/__next.chat.txt +3 -3
  56. package/console/chat/__placeholder__/__placeholder__.html +1 -1
  57. package/console/chat/__placeholder__/__placeholder__.txt +15 -15
  58. package/console/conversations/__next._full.txt +15 -15
  59. package/console/conversations/__next._head.txt +4 -4
  60. package/console/conversations/__next._index.txt +9 -9
  61. package/console/conversations/__next._tree.txt +1 -1
  62. package/console/conversations/__next.conversations.__PAGE__.txt +3 -3
  63. package/console/conversations/__next.conversations.txt +3 -3
  64. package/console/conversations/__placeholder__/__placeholder__/__next._full.txt +15 -15
  65. package/console/conversations/__placeholder__/__placeholder__/__next._head.txt +4 -4
  66. package/console/conversations/__placeholder__/__placeholder__/__next._index.txt +9 -9
  67. package/console/conversations/__placeholder__/__placeholder__/__next._tree.txt +1 -1
  68. package/console/conversations/__placeholder__/__placeholder__/__next.conversations.$d$channelId.$d$key.__PAGE__.txt +3 -3
  69. package/console/conversations/__placeholder__/__placeholder__/__next.conversations.$d$channelId.$d$key.txt +3 -3
  70. package/console/conversations/__placeholder__/__placeholder__/__next.conversations.$d$channelId.txt +3 -3
  71. package/console/conversations/__placeholder__/__placeholder__/__next.conversations.txt +3 -3
  72. package/console/conversations/__placeholder__/__placeholder__.html +1 -1
  73. package/console/conversations/__placeholder__/__placeholder__.txt +15 -15
  74. package/console/conversations.html +1 -1
  75. package/console/conversations.txt +15 -15
  76. package/console/dashboard/__next._full.txt +15 -15
  77. package/console/dashboard/__next._head.txt +4 -4
  78. package/console/dashboard/__next._index.txt +9 -9
  79. package/console/dashboard/__next._tree.txt +1 -1
  80. package/console/dashboard/__next.dashboard.__PAGE__.txt +3 -3
  81. package/console/dashboard/__next.dashboard.txt +3 -3
  82. package/console/dashboard.html +1 -1
  83. package/console/dashboard.txt +15 -15
  84. package/console/executions/__placeholder__/__next._full.txt +14 -14
  85. package/console/executions/__placeholder__/__next._head.txt +4 -4
  86. package/console/executions/__placeholder__/__next._index.txt +9 -9
  87. package/console/executions/__placeholder__/__next._tree.txt +1 -1
  88. package/console/executions/__placeholder__/__next.executions.$d$id.__PAGE__.txt +2 -2
  89. package/console/executions/__placeholder__/__next.executions.$d$id.txt +3 -3
  90. package/console/executions/__placeholder__/__next.executions.txt +3 -3
  91. package/console/executions/__placeholder__.html +1 -1
  92. package/console/executions/__placeholder__.txt +14 -14
  93. package/console/index.html +1 -1
  94. package/console/index.txt +14 -14
  95. package/console/invite/__placeholder__/__next._full.txt +15 -15
  96. package/console/invite/__placeholder__/__next._head.txt +4 -4
  97. package/console/invite/__placeholder__/__next._index.txt +9 -9
  98. package/console/invite/__placeholder__/__next._tree.txt +1 -1
  99. package/console/invite/__placeholder__/__next.invite.$d$token.__PAGE__.txt +3 -3
  100. package/console/invite/__placeholder__/__next.invite.$d$token.txt +3 -3
  101. package/console/invite/__placeholder__/__next.invite.txt +3 -3
  102. package/console/invite/__placeholder__.html +1 -1
  103. package/console/invite/__placeholder__.txt +15 -15
  104. package/console/library/__next._full.txt +17 -17
  105. package/console/library/__next._head.txt +4 -4
  106. package/console/library/__next._index.txt +9 -9
  107. package/console/library/__next._tree.txt +1 -1
  108. package/console/library/__next.library.__PAGE__.txt +3 -3
  109. package/console/library/__next.library.txt +5 -5
  110. package/console/library/agents/__next._full.txt +17 -17
  111. package/console/library/agents/__next._head.txt +4 -4
  112. package/console/library/agents/__next._index.txt +9 -9
  113. package/console/library/agents/__next._tree.txt +1 -1
  114. package/console/library/agents/__next.library.agents.__PAGE__.txt +3 -3
  115. package/console/library/agents/__next.library.agents.txt +3 -3
  116. package/console/library/agents/__next.library.txt +5 -5
  117. package/console/library/agents/__placeholder__/__placeholder__/__next._full.txt +17 -17
  118. package/console/library/agents/__placeholder__/__placeholder__/__next._head.txt +4 -4
  119. package/console/library/agents/__placeholder__/__placeholder__/__next._index.txt +9 -9
  120. package/console/library/agents/__placeholder__/__placeholder__/__next._tree.txt +1 -1
  121. package/console/library/agents/__placeholder__/__placeholder__/__next.library.agents.$d$org.$d$slug.__PAGE__.txt +3 -3
  122. package/console/library/agents/__placeholder__/__placeholder__/__next.library.agents.$d$org.$d$slug.txt +3 -3
  123. package/console/library/agents/__placeholder__/__placeholder__/__next.library.agents.$d$org.txt +3 -3
  124. package/console/library/agents/__placeholder__/__placeholder__/__next.library.agents.txt +3 -3
  125. package/console/library/agents/__placeholder__/__placeholder__/__next.library.txt +5 -5
  126. package/console/library/agents/__placeholder__/__placeholder__.html +1 -1
  127. package/console/library/agents/__placeholder__/__placeholder__.txt +17 -17
  128. package/console/library/agents/new/__next._full.txt +18 -18
  129. package/console/library/agents/new/__next._head.txt +4 -4
  130. package/console/library/agents/new/__next._index.txt +9 -9
  131. package/console/library/agents/new/__next._tree.txt +1 -1
  132. package/console/library/agents/new/__next.library.agents.new.__PAGE__.txt +4 -4
  133. package/console/library/agents/new/__next.library.agents.new.txt +3 -3
  134. package/console/library/agents/new/__next.library.agents.txt +3 -3
  135. package/console/library/agents/new/__next.library.txt +5 -5
  136. package/console/library/agents/new.html +1 -1
  137. package/console/library/agents/new.txt +18 -18
  138. package/console/library/agents.html +1 -1
  139. package/console/library/agents.txt +17 -17
  140. package/console/library/mcp-servers/__next._full.txt +17 -17
  141. package/console/library/mcp-servers/__next._head.txt +4 -4
  142. package/console/library/mcp-servers/__next._index.txt +9 -9
  143. package/console/library/mcp-servers/__next._tree.txt +1 -1
  144. package/console/library/mcp-servers/__next.library.mcp-servers.__PAGE__.txt +3 -3
  145. package/console/library/mcp-servers/__next.library.mcp-servers.txt +3 -3
  146. package/console/library/mcp-servers/__next.library.txt +5 -5
  147. package/console/library/mcp-servers/__placeholder__/__placeholder__/__next._full.txt +17 -17
  148. package/console/library/mcp-servers/__placeholder__/__placeholder__/__next._head.txt +4 -4
  149. package/console/library/mcp-servers/__placeholder__/__placeholder__/__next._index.txt +9 -9
  150. package/console/library/mcp-servers/__placeholder__/__placeholder__/__next._tree.txt +1 -1
  151. package/console/library/mcp-servers/__placeholder__/__placeholder__/__next.library.mcp-servers.$d$org.$d$slug.__PAGE__.txt +3 -3
  152. package/console/library/mcp-servers/__placeholder__/__placeholder__/__next.library.mcp-servers.$d$org.$d$slug.txt +3 -3
  153. package/console/library/mcp-servers/__placeholder__/__placeholder__/__next.library.mcp-servers.$d$org.txt +3 -3
  154. package/console/library/mcp-servers/__placeholder__/__placeholder__/__next.library.mcp-servers.txt +3 -3
  155. package/console/library/mcp-servers/__placeholder__/__placeholder__/__next.library.txt +5 -5
  156. package/console/library/mcp-servers/__placeholder__/__placeholder__.html +1 -1
  157. package/console/library/mcp-servers/__placeholder__/__placeholder__.txt +17 -17
  158. package/console/library/mcp-servers/new/__next._full.txt +18 -18
  159. package/console/library/mcp-servers/new/__next._head.txt +4 -4
  160. package/console/library/mcp-servers/new/__next._index.txt +9 -9
  161. package/console/library/mcp-servers/new/__next._tree.txt +1 -1
  162. package/console/library/mcp-servers/new/__next.library.mcp-servers.new.__PAGE__.txt +4 -4
  163. package/console/library/mcp-servers/new/__next.library.mcp-servers.new.txt +3 -3
  164. package/console/library/mcp-servers/new/__next.library.mcp-servers.txt +3 -3
  165. package/console/library/mcp-servers/new/__next.library.txt +5 -5
  166. package/console/library/mcp-servers/new.html +1 -1
  167. package/console/library/mcp-servers/new.txt +18 -18
  168. package/console/library/mcp-servers.html +1 -1
  169. package/console/library/mcp-servers.txt +17 -17
  170. package/console/library/plugins/__next._full.txt +17 -17
  171. package/console/library/plugins/__next._head.txt +4 -4
  172. package/console/library/plugins/__next._index.txt +9 -9
  173. package/console/library/plugins/__next._tree.txt +1 -1
  174. package/console/library/plugins/__next.library.plugins.__PAGE__.txt +3 -3
  175. package/console/library/plugins/__next.library.plugins.txt +3 -3
  176. package/console/library/plugins/__next.library.txt +5 -5
  177. package/console/library/plugins/__placeholder__/__placeholder__/__next._full.txt +17 -17
  178. package/console/library/plugins/__placeholder__/__placeholder__/__next._head.txt +4 -4
  179. package/console/library/plugins/__placeholder__/__placeholder__/__next._index.txt +9 -9
  180. package/console/library/plugins/__placeholder__/__placeholder__/__next._tree.txt +1 -1
  181. package/console/library/plugins/__placeholder__/__placeholder__/__next.library.plugins.$d$org.$d$slug.__PAGE__.txt +3 -3
  182. package/console/library/plugins/__placeholder__/__placeholder__/__next.library.plugins.$d$org.$d$slug.txt +3 -3
  183. package/console/library/plugins/__placeholder__/__placeholder__/__next.library.plugins.$d$org.txt +3 -3
  184. package/console/library/plugins/__placeholder__/__placeholder__/__next.library.plugins.txt +3 -3
  185. package/console/library/plugins/__placeholder__/__placeholder__/__next.library.txt +5 -5
  186. package/console/library/plugins/__placeholder__/__placeholder__.html +1 -1
  187. package/console/library/plugins/__placeholder__/__placeholder__.txt +17 -17
  188. package/console/library/plugins/upload/__next._full.txt +18 -18
  189. package/console/library/plugins/upload/__next._head.txt +4 -4
  190. package/console/library/plugins/upload/__next._index.txt +9 -9
  191. package/console/library/plugins/upload/__next._tree.txt +1 -1
  192. package/console/library/plugins/upload/__next.library.plugins.txt +3 -3
  193. package/console/library/plugins/upload/__next.library.plugins.upload.__PAGE__.txt +4 -4
  194. package/console/library/plugins/upload/__next.library.plugins.upload.txt +3 -3
  195. package/console/library/plugins/upload/__next.library.txt +5 -5
  196. package/console/library/plugins/upload.html +1 -1
  197. package/console/library/plugins/upload.txt +18 -18
  198. package/console/library/plugins.html +1 -1
  199. package/console/library/plugins.txt +17 -17
  200. package/console/library/schedules/__next._full.txt +17 -17
  201. package/console/library/schedules/__next._head.txt +4 -4
  202. package/console/library/schedules/__next._index.txt +9 -9
  203. package/console/library/schedules/__next._tree.txt +1 -1
  204. package/console/library/schedules/__next.library.schedules.__PAGE__.txt +3 -3
  205. package/console/library/schedules/__next.library.schedules.txt +3 -3
  206. package/console/library/schedules/__next.library.txt +5 -5
  207. package/console/library/schedules/__placeholder__/__placeholder__/__next._full.txt +17 -17
  208. package/console/library/schedules/__placeholder__/__placeholder__/__next._head.txt +4 -4
  209. package/console/library/schedules/__placeholder__/__placeholder__/__next._index.txt +9 -9
  210. package/console/library/schedules/__placeholder__/__placeholder__/__next._tree.txt +1 -1
  211. package/console/library/schedules/__placeholder__/__placeholder__/__next.library.schedules.$d$org.$d$slug.__PAGE__.txt +3 -3
  212. package/console/library/schedules/__placeholder__/__placeholder__/__next.library.schedules.$d$org.$d$slug.txt +3 -3
  213. package/console/library/schedules/__placeholder__/__placeholder__/__next.library.schedules.$d$org.txt +3 -3
  214. package/console/library/schedules/__placeholder__/__placeholder__/__next.library.schedules.txt +3 -3
  215. package/console/library/schedules/__placeholder__/__placeholder__/__next.library.txt +5 -5
  216. package/console/library/schedules/__placeholder__/__placeholder__.html +1 -1
  217. package/console/library/schedules/__placeholder__/__placeholder__.txt +17 -17
  218. package/console/library/schedules/new/__next._full.txt +18 -18
  219. package/console/library/schedules/new/__next._head.txt +4 -4
  220. package/console/library/schedules/new/__next._index.txt +9 -9
  221. package/console/library/schedules/new/__next._tree.txt +1 -1
  222. package/console/library/schedules/new/__next.library.schedules.new.__PAGE__.txt +4 -4
  223. package/console/library/schedules/new/__next.library.schedules.new.txt +3 -3
  224. package/console/library/schedules/new/__next.library.schedules.txt +3 -3
  225. package/console/library/schedules/new/__next.library.txt +5 -5
  226. package/console/library/schedules/new.html +1 -1
  227. package/console/library/schedules/new.txt +18 -18
  228. package/console/library/schedules.html +1 -1
  229. package/console/library/schedules.txt +17 -17
  230. package/console/library/skills/__next._full.txt +17 -17
  231. package/console/library/skills/__next._head.txt +4 -4
  232. package/console/library/skills/__next._index.txt +9 -9
  233. package/console/library/skills/__next._tree.txt +1 -1
  234. package/console/library/skills/__next.library.skills.__PAGE__.txt +3 -3
  235. package/console/library/skills/__next.library.skills.txt +3 -3
  236. package/console/library/skills/__next.library.txt +5 -5
  237. package/console/library/skills/__placeholder__/__placeholder__/__next._full.txt +17 -17
  238. package/console/library/skills/__placeholder__/__placeholder__/__next._head.txt +4 -4
  239. package/console/library/skills/__placeholder__/__placeholder__/__next._index.txt +9 -9
  240. package/console/library/skills/__placeholder__/__placeholder__/__next._tree.txt +1 -1
  241. package/console/library/skills/__placeholder__/__placeholder__/__next.library.skills.$d$org.$d$slug.__PAGE__.txt +3 -3
  242. package/console/library/skills/__placeholder__/__placeholder__/__next.library.skills.$d$org.$d$slug.txt +3 -3
  243. package/console/library/skills/__placeholder__/__placeholder__/__next.library.skills.$d$org.txt +3 -3
  244. package/console/library/skills/__placeholder__/__placeholder__/__next.library.skills.txt +3 -3
  245. package/console/library/skills/__placeholder__/__placeholder__/__next.library.txt +5 -5
  246. package/console/library/skills/__placeholder__/__placeholder__.html +1 -1
  247. package/console/library/skills/__placeholder__/__placeholder__.txt +17 -17
  248. package/console/library/skills/new/__next._full.txt +18 -18
  249. package/console/library/skills/new/__next._head.txt +4 -4
  250. package/console/library/skills/new/__next._index.txt +9 -9
  251. package/console/library/skills/new/__next._tree.txt +1 -1
  252. package/console/library/skills/new/__next.library.skills.new.__PAGE__.txt +4 -4
  253. package/console/library/skills/new/__next.library.skills.new.txt +3 -3
  254. package/console/library/skills/new/__next.library.skills.txt +3 -3
  255. package/console/library/skills/new/__next.library.txt +5 -5
  256. package/console/library/skills/new.html +1 -1
  257. package/console/library/skills/new.txt +18 -18
  258. package/console/library/skills.html +1 -1
  259. package/console/library/skills.txt +17 -17
  260. package/console/library/workflows/__next._full.txt +17 -17
  261. package/console/library/workflows/__next._head.txt +4 -4
  262. package/console/library/workflows/__next._index.txt +9 -9
  263. package/console/library/workflows/__next._tree.txt +1 -1
  264. package/console/library/workflows/__next.library.txt +5 -5
  265. package/console/library/workflows/__next.library.workflows.__PAGE__.txt +3 -3
  266. package/console/library/workflows/__next.library.workflows.txt +3 -3
  267. package/console/library/workflows/__placeholder__/__placeholder__/__next._full.txt +17 -17
  268. package/console/library/workflows/__placeholder__/__placeholder__/__next._head.txt +4 -4
  269. package/console/library/workflows/__placeholder__/__placeholder__/__next._index.txt +9 -9
  270. package/console/library/workflows/__placeholder__/__placeholder__/__next._tree.txt +1 -1
  271. package/console/library/workflows/__placeholder__/__placeholder__/__next.library.txt +5 -5
  272. package/console/library/workflows/__placeholder__/__placeholder__/__next.library.workflows.$d$org.$d$slug.__PAGE__.txt +3 -3
  273. package/console/library/workflows/__placeholder__/__placeholder__/__next.library.workflows.$d$org.$d$slug.txt +3 -3
  274. package/console/library/workflows/__placeholder__/__placeholder__/__next.library.workflows.$d$org.txt +3 -3
  275. package/console/library/workflows/__placeholder__/__placeholder__/__next.library.workflows.txt +3 -3
  276. package/console/library/workflows/__placeholder__/__placeholder__.html +1 -1
  277. package/console/library/workflows/__placeholder__/__placeholder__.txt +17 -17
  278. package/console/library/workflows/executions/__next._full.txt +17 -17
  279. package/console/library/workflows/executions/__next._head.txt +4 -4
  280. package/console/library/workflows/executions/__next._index.txt +9 -9
  281. package/console/library/workflows/executions/__next._tree.txt +1 -1
  282. package/console/library/workflows/executions/__next.library.txt +5 -5
  283. package/console/library/workflows/executions/__next.library.workflows.executions.__PAGE__.txt +3 -3
  284. package/console/library/workflows/executions/__next.library.workflows.executions.txt +3 -3
  285. package/console/library/workflows/executions/__next.library.workflows.txt +3 -3
  286. package/console/library/workflows/executions.html +1 -1
  287. package/console/library/workflows/executions.txt +17 -17
  288. package/console/library/workflows/new/__next._full.txt +18 -18
  289. package/console/library/workflows/new/__next._head.txt +4 -4
  290. package/console/library/workflows/new/__next._index.txt +9 -9
  291. package/console/library/workflows/new/__next._tree.txt +1 -1
  292. package/console/library/workflows/new/__next.library.txt +5 -5
  293. package/console/library/workflows/new/__next.library.workflows.new.__PAGE__.txt +4 -4
  294. package/console/library/workflows/new/__next.library.workflows.new.txt +3 -3
  295. package/console/library/workflows/new/__next.library.workflows.txt +3 -3
  296. package/console/library/workflows/new.html +1 -1
  297. package/console/library/workflows/new.txt +18 -18
  298. package/console/library/workflows.html +1 -1
  299. package/console/library/workflows.txt +17 -17
  300. package/console/library.html +1 -1
  301. package/console/library.txt +17 -17
  302. package/console/login/__next._full.txt +16 -16
  303. package/console/login/__next._head.txt +4 -4
  304. package/console/login/__next._index.txt +9 -9
  305. package/console/login/__next._tree.txt +1 -1
  306. package/console/login/__next.login.__PAGE__.txt +4 -4
  307. package/console/login/__next.login.txt +3 -3
  308. package/console/login.html +1 -1
  309. package/console/login.txt +16 -16
  310. package/console/marketplace/__next._full.txt +15 -15
  311. package/console/marketplace/__next._head.txt +4 -4
  312. package/console/marketplace/__next._index.txt +9 -9
  313. package/console/marketplace/__next._tree.txt +1 -1
  314. package/console/marketplace/__next.marketplace.__PAGE__.txt +3 -3
  315. package/console/marketplace/__next.marketplace.txt +3 -3
  316. package/console/marketplace.html +1 -1
  317. package/console/marketplace.txt +15 -15
  318. package/console/oauth/slack/callback/__next._full.txt +16 -16
  319. package/console/oauth/slack/callback/__next._head.txt +4 -4
  320. package/console/oauth/slack/callback/__next._index.txt +9 -9
  321. package/console/oauth/slack/callback/__next._tree.txt +1 -1
  322. package/console/oauth/slack/callback/__next.oauth.slack.callback.__PAGE__.txt +4 -4
  323. package/console/oauth/slack/callback/__next.oauth.slack.callback.txt +3 -3
  324. package/console/oauth/slack/callback/__next.oauth.slack.txt +3 -3
  325. package/console/oauth/slack/callback/__next.oauth.txt +3 -3
  326. package/console/oauth/slack/callback.html +1 -1
  327. package/console/oauth/slack/callback.txt +16 -16
  328. package/console/sessions/__placeholder__/__next._full.txt +14 -14
  329. package/console/sessions/__placeholder__/__next._head.txt +4 -4
  330. package/console/sessions/__placeholder__/__next._index.txt +9 -9
  331. package/console/sessions/__placeholder__/__next._tree.txt +1 -1
  332. package/console/sessions/__placeholder__/__next.sessions.$d$id.__PAGE__.txt +2 -2
  333. package/console/sessions/__placeholder__/__next.sessions.$d$id.txt +3 -3
  334. package/console/sessions/__placeholder__/__next.sessions.txt +3 -3
  335. package/console/sessions/__placeholder__.html +1 -1
  336. package/console/sessions/__placeholder__.txt +14 -14
  337. package/console/settings/__next._full.txt +18 -18
  338. package/console/settings/__next._head.txt +4 -4
  339. package/console/settings/__next._index.txt +9 -9
  340. package/console/settings/__next._tree.txt +1 -1
  341. package/console/settings/__next.settings.__PAGE__.txt +4 -4
  342. package/console/settings/__next.settings.txt +5 -5
  343. package/console/settings/account-preferences/__next._full.txt +17 -17
  344. package/console/settings/account-preferences/__next._head.txt +4 -4
  345. package/console/settings/account-preferences/__next._index.txt +9 -9
  346. package/console/settings/account-preferences/__next._tree.txt +1 -1
  347. package/console/settings/account-preferences/__next.settings.account-preferences.__PAGE__.txt +3 -3
  348. package/console/settings/account-preferences/__next.settings.account-preferences.txt +3 -3
  349. package/console/settings/account-preferences/__next.settings.txt +5 -5
  350. package/console/settings/account-preferences.html +1 -1
  351. package/console/settings/account-preferences.txt +17 -17
  352. package/console/settings/api-keys/__next._full.txt +17 -17
  353. package/console/settings/api-keys/__next._head.txt +4 -4
  354. package/console/settings/api-keys/__next._index.txt +9 -9
  355. package/console/settings/api-keys/__next._tree.txt +1 -1
  356. package/console/settings/api-keys/__next.settings.api-keys.__PAGE__.txt +3 -3
  357. package/console/settings/api-keys/__next.settings.api-keys.txt +3 -3
  358. package/console/settings/api-keys/__next.settings.txt +5 -5
  359. package/console/settings/api-keys.html +1 -1
  360. package/console/settings/api-keys.txt +17 -17
  361. package/console/settings/billing/__next._full.txt +18 -18
  362. package/console/settings/billing/__next._head.txt +4 -4
  363. package/console/settings/billing/__next._index.txt +9 -9
  364. package/console/settings/billing/__next._tree.txt +1 -1
  365. package/console/settings/billing/__next.settings.billing.__PAGE__.txt +4 -4
  366. package/console/settings/billing/__next.settings.billing.txt +3 -3
  367. package/console/settings/billing/__next.settings.txt +5 -5
  368. package/console/settings/billing.html +1 -1
  369. package/console/settings/billing.txt +18 -18
  370. package/console/settings/channel-apps/__next._full.txt +17 -17
  371. package/console/settings/channel-apps/__next._head.txt +4 -4
  372. package/console/settings/channel-apps/__next._index.txt +9 -9
  373. package/console/settings/channel-apps/__next._tree.txt +1 -1
  374. package/console/settings/channel-apps/__next.settings.channel-apps.__PAGE__.txt +3 -3
  375. package/console/settings/channel-apps/__next.settings.channel-apps.txt +3 -3
  376. package/console/settings/channel-apps/__next.settings.txt +5 -5
  377. package/console/settings/channel-apps.html +1 -1
  378. package/console/settings/channel-apps.txt +17 -17
  379. package/console/settings/cursor-accounts/__next._full.txt +18 -18
  380. package/console/settings/cursor-accounts/__next._head.txt +4 -4
  381. package/console/settings/cursor-accounts/__next._index.txt +9 -9
  382. package/console/settings/cursor-accounts/__next._tree.txt +1 -1
  383. package/console/settings/cursor-accounts/__next.settings.cursor-accounts.__PAGE__.txt +4 -4
  384. package/console/settings/cursor-accounts/__next.settings.cursor-accounts.txt +3 -3
  385. package/console/settings/cursor-accounts/__next.settings.txt +5 -5
  386. package/console/settings/cursor-accounts.html +1 -1
  387. package/console/settings/cursor-accounts.txt +18 -18
  388. package/console/settings/environments/__next._full.txt +17 -17
  389. package/console/settings/environments/__next._head.txt +4 -4
  390. package/console/settings/environments/__next._index.txt +9 -9
  391. package/console/settings/environments/__next._tree.txt +1 -1
  392. package/console/settings/environments/__next.settings.environments.__PAGE__.txt +3 -3
  393. package/console/settings/environments/__next.settings.environments.txt +3 -3
  394. package/console/settings/environments/__next.settings.txt +5 -5
  395. package/console/settings/environments.html +1 -1
  396. package/console/settings/environments.txt +17 -17
  397. package/console/settings/identity-providers/__next._full.txt +17 -17
  398. package/console/settings/identity-providers/__next._head.txt +4 -4
  399. package/console/settings/identity-providers/__next._index.txt +9 -9
  400. package/console/settings/identity-providers/__next._tree.txt +1 -1
  401. package/console/settings/identity-providers/__next.settings.identity-providers.__PAGE__.txt +3 -3
  402. package/console/settings/identity-providers/__next.settings.identity-providers.txt +3 -3
  403. package/console/settings/identity-providers/__next.settings.txt +5 -5
  404. package/console/settings/identity-providers.html +1 -1
  405. package/console/settings/identity-providers.txt +17 -17
  406. package/console/settings/invitations/__next._full.txt +17 -17
  407. package/console/settings/invitations/__next._head.txt +4 -4
  408. package/console/settings/invitations/__next._index.txt +9 -9
  409. package/console/settings/invitations/__next._tree.txt +1 -1
  410. package/console/settings/invitations/__next.settings.invitations.__PAGE__.txt +3 -3
  411. package/console/settings/invitations/__next.settings.invitations.txt +3 -3
  412. package/console/settings/invitations/__next.settings.txt +5 -5
  413. package/console/settings/invitations.html +1 -1
  414. package/console/settings/invitations.txt +17 -17
  415. package/console/settings/licenses/__next._full.txt +18 -18
  416. package/console/settings/licenses/__next._head.txt +4 -4
  417. package/console/settings/licenses/__next._index.txt +9 -9
  418. package/console/settings/licenses/__next._tree.txt +1 -1
  419. package/console/settings/licenses/__next.settings.licenses.__PAGE__.txt +4 -4
  420. package/console/settings/licenses/__next.settings.licenses.txt +3 -3
  421. package/console/settings/licenses/__next.settings.txt +5 -5
  422. package/console/settings/licenses.html +1 -1
  423. package/console/settings/licenses.txt +18 -18
  424. package/console/settings/members/__next._full.txt +17 -17
  425. package/console/settings/members/__next._head.txt +4 -4
  426. package/console/settings/members/__next._index.txt +9 -9
  427. package/console/settings/members/__next._tree.txt +1 -1
  428. package/console/settings/members/__next.settings.members.__PAGE__.txt +3 -3
  429. package/console/settings/members/__next.settings.members.txt +3 -3
  430. package/console/settings/members/__next.settings.txt +5 -5
  431. package/console/settings/members.html +1 -1
  432. package/console/settings/members.txt +17 -17
  433. package/console/settings/memory/__next._full.txt +17 -17
  434. package/console/settings/memory/__next._head.txt +4 -4
  435. package/console/settings/memory/__next._index.txt +9 -9
  436. package/console/settings/memory/__next._tree.txt +1 -1
  437. package/console/settings/memory/__next.settings.memory.__PAGE__.txt +3 -3
  438. package/console/settings/memory/__next.settings.memory.txt +3 -3
  439. package/console/settings/memory/__next.settings.txt +5 -5
  440. package/console/settings/memory.html +1 -1
  441. package/console/settings/memory.txt +17 -17
  442. package/console/settings/oauth-apps/__next._full.txt +17 -17
  443. package/console/settings/oauth-apps/__next._head.txt +4 -4
  444. package/console/settings/oauth-apps/__next._index.txt +9 -9
  445. package/console/settings/oauth-apps/__next._tree.txt +1 -1
  446. package/console/settings/oauth-apps/__next.settings.oauth-apps.__PAGE__.txt +3 -3
  447. package/console/settings/oauth-apps/__next.settings.oauth-apps.txt +3 -3
  448. package/console/settings/oauth-apps/__next.settings.txt +5 -5
  449. package/console/settings/oauth-apps.html +1 -1
  450. package/console/settings/oauth-apps.txt +17 -17
  451. package/console/settings/org-preferences/__next._full.txt +17 -17
  452. package/console/settings/org-preferences/__next._head.txt +4 -4
  453. package/console/settings/org-preferences/__next._index.txt +9 -9
  454. package/console/settings/org-preferences/__next._tree.txt +1 -1
  455. package/console/settings/org-preferences/__next.settings.org-preferences.__PAGE__.txt +3 -3
  456. package/console/settings/org-preferences/__next.settings.org-preferences.txt +3 -3
  457. package/console/settings/org-preferences/__next.settings.txt +5 -5
  458. package/console/settings/org-preferences.html +1 -1
  459. package/console/settings/org-preferences.txt +17 -17
  460. package/console/settings/org-profile/__next._full.txt +17 -17
  461. package/console/settings/org-profile/__next._head.txt +4 -4
  462. package/console/settings/org-profile/__next._index.txt +9 -9
  463. package/console/settings/org-profile/__next._tree.txt +1 -1
  464. package/console/settings/org-profile/__next.settings.org-profile.__PAGE__.txt +3 -3
  465. package/console/settings/org-profile/__next.settings.org-profile.txt +3 -3
  466. package/console/settings/org-profile/__next.settings.txt +5 -5
  467. package/console/settings/org-profile.html +1 -1
  468. package/console/settings/org-profile.txt +17 -17
  469. package/console/settings/platform-clients/__next._full.txt +17 -17
  470. package/console/settings/platform-clients/__next._head.txt +4 -4
  471. package/console/settings/platform-clients/__next._index.txt +9 -9
  472. package/console/settings/platform-clients/__next._tree.txt +1 -1
  473. package/console/settings/platform-clients/__next.settings.platform-clients.__PAGE__.txt +3 -3
  474. package/console/settings/platform-clients/__next.settings.platform-clients.txt +3 -3
  475. package/console/settings/platform-clients/__next.settings.txt +5 -5
  476. package/console/settings/platform-clients.html +1 -1
  477. package/console/settings/platform-clients.txt +17 -17
  478. package/console/settings/pricing-governance/__next._full.txt +18 -18
  479. package/console/settings/pricing-governance/__next._head.txt +4 -4
  480. package/console/settings/pricing-governance/__next._index.txt +9 -9
  481. package/console/settings/pricing-governance/__next._tree.txt +1 -1
  482. package/console/settings/pricing-governance/__next.settings.pricing-governance.__PAGE__.txt +4 -4
  483. package/console/settings/pricing-governance/__next.settings.pricing-governance.txt +3 -3
  484. package/console/settings/pricing-governance/__next.settings.txt +5 -5
  485. package/console/settings/pricing-governance.html +1 -1
  486. package/console/settings/pricing-governance.txt +18 -18
  487. package/console/settings/provider-standing/__next._full.txt +18 -18
  488. package/console/settings/provider-standing/__next._head.txt +4 -4
  489. package/console/settings/provider-standing/__next._index.txt +9 -9
  490. package/console/settings/provider-standing/__next._tree.txt +1 -1
  491. package/console/settings/provider-standing/__next.settings.provider-standing.__PAGE__.txt +4 -4
  492. package/console/settings/provider-standing/__next.settings.provider-standing.txt +3 -3
  493. package/console/settings/provider-standing/__next.settings.txt +5 -5
  494. package/console/settings/provider-standing.html +1 -1
  495. package/console/settings/provider-standing.txt +18 -18
  496. package/console/settings/teams/__next._full.txt +17 -17
  497. package/console/settings/teams/__next._head.txt +4 -4
  498. package/console/settings/teams/__next._index.txt +9 -9
  499. package/console/settings/teams/__next._tree.txt +1 -1
  500. package/console/settings/teams/__next.settings.teams.__PAGE__.txt +3 -3
  501. package/console/settings/teams/__next.settings.teams.txt +3 -3
  502. package/console/settings/teams/__next.settings.txt +5 -5
  503. package/console/settings/teams.html +1 -1
  504. package/console/settings/teams.txt +17 -17
  505. package/console/settings/usage/__next._full.txt +17 -17
  506. package/console/settings/usage/__next._head.txt +4 -4
  507. package/console/settings/usage/__next._index.txt +9 -9
  508. package/console/settings/usage/__next._tree.txt +1 -1
  509. package/console/settings/usage/__next.settings.txt +5 -5
  510. package/console/settings/usage/__next.settings.usage.__PAGE__.txt +3 -3
  511. package/console/settings/usage/__next.settings.usage.txt +3 -3
  512. package/console/settings/usage.html +1 -1
  513. package/console/settings/usage.txt +17 -17
  514. package/console/settings.html +1 -1
  515. package/console/settings.txt +18 -18
  516. package/console/workflows/__next._full.txt +14 -14
  517. package/console/workflows/__next._head.txt +4 -4
  518. package/console/workflows/__next._index.txt +9 -9
  519. package/console/workflows/__next._tree.txt +1 -1
  520. package/console/workflows/__next.workflows.__PAGE__.txt +2 -2
  521. package/console/workflows/__next.workflows.txt +3 -3
  522. package/console/workflows/__placeholder__/__placeholder__/__next._full.txt +15 -15
  523. package/console/workflows/__placeholder__/__placeholder__/__next._head.txt +4 -4
  524. package/console/workflows/__placeholder__/__placeholder__/__next._index.txt +9 -9
  525. package/console/workflows/__placeholder__/__placeholder__/__next._tree.txt +1 -1
  526. package/console/workflows/__placeholder__/__placeholder__/__next.workflows.$d$org.$d$slug.__PAGE__.txt +3 -3
  527. package/console/workflows/__placeholder__/__placeholder__/__next.workflows.$d$org.$d$slug.txt +3 -3
  528. package/console/workflows/__placeholder__/__placeholder__/__next.workflows.$d$org.txt +3 -3
  529. package/console/workflows/__placeholder__/__placeholder__/__next.workflows.txt +3 -3
  530. package/console/workflows/__placeholder__/__placeholder__.html +1 -1
  531. package/console/workflows/__placeholder__/__placeholder__.txt +15 -15
  532. package/console/workflows/executions/__next._full.txt +14 -14
  533. package/console/workflows/executions/__next._head.txt +4 -4
  534. package/console/workflows/executions/__next._index.txt +9 -9
  535. package/console/workflows/executions/__next._tree.txt +1 -1
  536. package/console/workflows/executions/__next.workflows.executions.__PAGE__.txt +2 -2
  537. package/console/workflows/executions/__next.workflows.executions.txt +3 -3
  538. package/console/workflows/executions/__next.workflows.txt +3 -3
  539. package/console/workflows/executions/__placeholder__/__next._full.txt +15 -15
  540. package/console/workflows/executions/__placeholder__/__next._head.txt +4 -4
  541. package/console/workflows/executions/__placeholder__/__next._index.txt +9 -9
  542. package/console/workflows/executions/__placeholder__/__next._tree.txt +1 -1
  543. package/console/workflows/executions/__placeholder__/__next.workflows.executions.$d$id.__PAGE__.txt +3 -3
  544. package/console/workflows/executions/__placeholder__/__next.workflows.executions.$d$id.txt +3 -3
  545. package/console/workflows/executions/__placeholder__/__next.workflows.executions.txt +3 -3
  546. package/console/workflows/executions/__placeholder__/__next.workflows.txt +3 -3
  547. package/console/workflows/executions/__placeholder__.html +1 -1
  548. package/console/workflows/executions/__placeholder__.txt +15 -15
  549. package/console/workflows/executions.html +1 -1
  550. package/console/workflows/executions.txt +14 -14
  551. package/console/workflows.html +1 -1
  552. package/console/workflows.txt +14 -14
  553. package/main.js +4 -4
  554. package/package.json +6 -6
  555. package/workflow-bundle-agent-execution.js +12 -6
  556. package/workflow-bundle-workflow-execution.js +12 -6
  557. package/console/_next/static/chunks/0vreqk5pkgf6r.js +0 -1
  558. package/console/_next/static/chunks/112r8l1.mzfwh.js +0 -3
  559. /package/console/_next/static/{FZr8_Ve2GpxQcqrkauBNZ → PcgFo33p14iqrzpNLzQ88}/_buildManifest.js +0 -0
  560. /package/console/_next/static/{FZr8_Ve2GpxQcqrkauBNZ → PcgFo33p14iqrzpNLzQ88}/_clientMiddlewareManifest.js +0 -0
  561. /package/console/_next/static/{FZr8_Ve2GpxQcqrkauBNZ → PcgFo33p14iqrzpNLzQ88}/_ssgManifest.js +0 -0
@@ -0,0 +1,3 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,67407,800692,282155,671010,e=>{"use strict";var t=e.i(271645),s=e.i(768079);function n(){let e=(0,t.useContext)(s.AuthContext);if(!e)throw Error("useAuth must be used within <AuthProvider>");return e}e.s(["useAuth",0,n],800692);var r=e.i(843476),i=e.i(531278),a=e.i(35127);let o=()=>{};function l({children:e}){let n=(0,t.useMemo)(()=>({isAuthenticated:!0,isLoading:!1,user:null,accessToken:null,login:o,logout:o}),[]);return(0,r.jsx)(s.AuthContext.Provider,{value:n,children:e})}let g=(0,t.lazy)(()=>e.A(781195));function c(){return(0,r.jsx)("div",{className:"flex min-h-screen flex-col items-center justify-center gap-3",children:(0,r.jsx)(i.Loader2,{className:"text-muted-foreground size-8 animate-spin"})})}e.s(["AuthProvider",0,function({children:e}){let s=(0,t.useMemo)(()=>(0,a.resolveAuthConfig)(),[]);switch(s.mode){case"disabled":return(0,r.jsx)(l,{children:e});case"oidc":return(0,r.jsx)(t.Suspense,{fallback:(0,r.jsx)(c,{}),children:(0,r.jsx)(g,{config:s.oidc,children:e})})}}],282155),e.s(["AuthGuard",0,function({children:e}){let{isAuthenticated:s,isLoading:a,login:o}=n();if((0,t.useEffect)(()=>{a||s||o()},[a,s,o]),a||!s){let e=!a&&!s;return(0,r.jsxs)("div",{className:"flex min-h-screen flex-col items-center justify-center gap-3",children:[(0,r.jsx)(i.Loader2,{className:"text-muted-foreground size-8 animate-spin"}),(0,r.jsx)("p",{className:"text-muted-foreground text-sm",children:e?"Redirecting you to sign in…":"Loading..."})]})}return(0,r.jsx)(r.Fragment,{children:e})}],671010),e.s([],67407)},275051,776526,850429,603115,227989,262045,337249,524067,644389,352082,440160,766895,e=>{"use strict";var t=e.i(843476),s=e.i(271645),n=e.i(893976),r=e.i(610595),i=e.i(973621),a=e.i(188482),o=e.i(506213),l=e.i(364354);function g({icon:e,label:s,count:r,children:i,disabled:c,open:u,onOpenChange:d}){let m=(0,l.useStigmerPortalContainer)();return(0,t.jsxs)(o.Popover.Root,{open:u,onOpenChange:d,children:[(0,t.jsxs)(a.Tooltip,{children:[(0,t.jsx)(a.TooltipTrigger,{render:(0,t.jsx)("span",{className:"stg:inline-flex"}),children:(0,t.jsx)(o.Popover.Trigger,{disabled:c,"aria-label":s,className:(0,n.cn)("stg:inline-flex stg:h-8 stg:w-8 stg:items-center stg:justify-center stg:rounded-md stg:text-xs stg:transition-colors","stg:text-muted-foreground stg:hover:text-foreground stg:hover:bg-accent-hover","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:(0,t.jsxs)("span",{className:"stg:relative",children:[e,r>0&&(0,t.jsx)("span",{className:"stg:absolute stg:-right-1.5 stg:-top-1.5 stg:flex stg:h-3.5 stg:min-w-3.5 stg:items-center stg:justify-center stg:rounded-full stg:bg-primary stg:px-0.5 stg:text-[0.5rem] stg:font-medium stg:leading-none stg:text-primary-foreground",children:r})]})})}),(0,t.jsx)(a.TooltipContent,{side:"top",children:s})]}),(0,t.jsx)(o.Popover.Portal,{container:m,children:(0,t.jsx)(o.Popover.Positioner,{sideOffset:8,align:"start",children:(0,t.jsx)(o.Popover.Popup,{className:"stg:z-popover stg:overflow-x-hidden stg:overflow-y-auto stg:rounded-lg stg:border stg:border-border stg:bg-popover stg:p-3 stg:shadow-md stg:text-popover-foreground stg:max-h-[80vh]",children:i})})})]})}function c(){return(0,t.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",className:"stg:shrink-0 stg:animate-spin stg:text-muted-foreground","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M8 2a6 6 0 1 0 6 6"})})}function u(){return(0,t.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M8 1.5 1.5 13.5h13L8 1.5z"}),(0,t.jsx)("path",{d:"M8 6v3"}),(0,t.jsx)("circle",{cx:"8",cy:"11",r:"0.5",fill:"currentColor",stroke:"none"})]})}function d(){return(0,t.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M8 12V4M4 7l4-4 4 4"})})}function m(){return(0,t.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:(0,t.jsx)("rect",{x:"3",y:"3",width:"10",height:"10",rx:"2.5"})})}function h(){return(0,t.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M4 4L10 10M10 4L4 10"})})}function p(){return(0,t.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M12.5 7L7 12.5a3.536 3.536 0 0 1-5-5L7.5 2a2.357 2.357 0 0 1 3.333 3.333L5.5 10.667a1.179 1.179 0 0 1-1.667-1.667L9 3.833"})})}function f(){return(0,t.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"3",y:"5",width:"10",height:"8",rx:"2"}),(0,t.jsx)("circle",{cx:"6",cy:"9",r:"1",fill:"currentColor",stroke:"none"}),(0,t.jsx)("circle",{cx:"10",cy:"9",r:"1",fill:"currentColor",stroke:"none"}),(0,t.jsx)("path",{d:"M8 1v4"}),(0,t.jsx)("circle",{cx:"8",cy:"1",r:"1"})]})}function x(){return(0,t.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M1.5 3.5V11a1 1 0 001 1h9a1 1 0 001-1V5.5a1 1 0 00-1-1H7L5.5 3H2.5a1 1 0 00-1 .5z"})})}function v(){return(0,t.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"2",y:"2",width:"12",height:"4",rx:"1"}),(0,t.jsx)("rect",{x:"2",y:"10",width:"12",height:"4",rx:"1"}),(0,t.jsx)("circle",{cx:"5",cy:"4",r:"0.75",fill:"currentColor",stroke:"none"}),(0,t.jsx)("circle",{cx:"5",cy:"12",r:"0.75",fill:"currentColor",stroke:"none"})]})}function b(){return(0,t.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M2 3h12M2 7h8M2 11h10M2 15h6"})})}function j(){return(0,t.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"3",y:"8",width:"10",height:"6",rx:"1.5"}),(0,t.jsx)("path",{d:"M5 8V5.5a3 3 0 0 1 6 0V8"}),(0,t.jsx)("circle",{cx:"8",cy:"11.5",r:"1",fill:"currentColor",stroke:"none"})]})}function y(){return(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M2 4h4m4 0h4M2 8h8m4 0h0M2 12h2m4 0h6"}),(0,t.jsx)("circle",{cx:"8",cy:"4",r:"2"}),(0,t.jsx)("circle",{cx:"12",cy:"8",r:"2"}),(0,t.jsx)("circle",{cx:"6",cy:"12",r:"2"})]})}function k(){return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:items-center stg:gap-1.5",children:[(0,t.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",className:"stg:animate-spin stg:text-muted-foreground","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M8 2a6 6 0 1 0 6 6"})}),(0,t.jsx)("span",{className:"stg:text-[0.6rem] stg:text-muted-foreground",children:"Checking agent requirements..."})]})}function w({open:e,onOpenChange:s,activePanel:r,onActivePanelChange:i,items:g,renderPanel:c,disabled:u}){let d=g.reduce((e,t)=>e+t.count,0),m=g.some(e=>e.hasWarning),h=(0,l.useStigmerPortalContainer)();if(0===g.length)return null;let p=r?g.find(e=>e.id===r):null;return(0,t.jsxs)(o.Popover.Root,{open:e,onOpenChange:e=>{s(e),e||i(null)},children:[(0,t.jsxs)(a.Tooltip,{children:[(0,t.jsx)(a.TooltipTrigger,{render:(0,t.jsx)("span",{className:"stg:inline-flex"}),children:(0,t.jsx)(o.Popover.Trigger,{disabled:u,className:(0,n.cn)("stg:inline-flex stg:h-8 stg:w-8 stg:items-center stg:justify-center stg:rounded-md stg:text-xs stg:transition-colors","stg:text-muted-foreground stg:hover:text-foreground stg:hover:bg-accent-hover","stg:disabled:pointer-events-none stg:disabled:opacity-50"),"aria-label":"Configure agent, tools, and skills",children:(0,t.jsxs)("span",{className:"stg:relative",children:[(0,t.jsx)(y,{}),d>0&&(0,t.jsx)("span",{className:"stg:absolute stg:-right-1.5 stg:-top-1.5 stg:flex stg:h-3.5 stg:min-w-3.5 stg:items-center stg:justify-center stg:rounded-full stg:bg-primary stg:px-0.5 stg:text-[0.5rem] stg:font-medium stg:leading-none stg:text-primary-foreground",children:d}),m&&0===d&&(0,t.jsx)("span",{className:"stg:absolute stg:-right-0.5 stg:-top-0.5 stg:inline-block stg:h-2 stg:w-2 stg:rounded-full stg:bg-warning","aria-label":"Configuration needed"})]})})}),(0,t.jsx)(a.TooltipContent,{side:"top",children:"Configure"})]}),(0,t.jsx)(o.Popover.Portal,{container:h,children:(0,t.jsx)(o.Popover.Positioner,{sideOffset:8,align:"start",children:(0,t.jsx)(o.Popover.Popup,{className:(0,n.cn)("stg:z-popover stg:overflow-x-hidden stg:overflow-y-auto stg:rounded-lg stg:border stg:border-border","stg:bg-popover stg:shadow-md stg:text-popover-foreground","stg:max-h-[80vh]"),children:p?(0,t.jsx)(N,{item:p,onBack:()=>i(null),children:c(r)}):(0,t.jsx)(S,{items:g,onSelect:i})})})})]})}function S({items:e,onSelect:s}){return(0,t.jsx)("div",{className:"stg:py-1",role:"menu",children:e.map(e=>(0,t.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>s(e.id),className:(0,n.cn)("stg:flex stg:w-full stg:items-center stg:gap-2.5 stg:px-3 stg:py-2 stg:text-sm stg:transition-colors","stg:text-foreground stg:hover:bg-accent-hover"),children:[(0,t.jsx)("span",{className:"stg:shrink-0 stg:text-muted-foreground",children:e.icon}),(0,t.jsx)("span",{className:"stg:flex-1 stg:text-left",children:e.label}),e.hasWarning&&(0,t.jsx)("span",{className:"stg:inline-block stg:h-1.5 stg:w-1.5 stg:shrink-0 stg:rounded-full stg:bg-warning","aria-label":"Needs configuration"}),e.count>0&&(0,t.jsx)("span",{className:"stg:rounded-full stg:bg-primary-subtle stg:px-1.5 stg:text-[0.6rem] stg:font-medium stg:text-primary",children:e.count}),(0,t.jsx)(C,{})]},e.id))})}function N({item:e,onBack:s,children:n}){return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:border-b stg:border-border-muted stg:px-3 stg:py-2",children:[(0,t.jsx)("button",{type:"button",onClick:s,className:"stg:shrink-0 stg:rounded stg:p-0.5 stg:text-muted-foreground stg:transition-colors stg:hover:bg-accent-hover stg:hover:text-foreground","aria-label":"Back to configuration menu",children:(0,t.jsx)(E,{})}),(0,t.jsx)("span",{className:"stg:shrink-0 stg:text-muted-foreground",children:e.icon}),(0,t.jsx)("span",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:e.label})]}),(0,t.jsx)("div",{className:"stg:p-3",children:n})]})}function C(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0 stg:text-muted-foreground","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M6 4l4 4-4 4"})})}function E(){return(0,t.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M10 4l-4 4 4 4"})})}var R=e.i(216386),A=e.i(287237);let T=["native","cursor"];function M({value:e,onValueChange:n,className:r,disabled:i}){let a=(0,s.useRef)(null),o=(0,s.useCallback)(t=>{let s;if(i)return;let r=T.indexOf(e);if("ArrowRight"===t.key||"ArrowDown"===t.key?s=(r+1)%T.length:("ArrowLeft"===t.key||"ArrowUp"===t.key)&&(s=(r-1+T.length)%T.length),void 0!==s){t.preventDefault(),n(T[s]);let e=a.current?.querySelectorAll("[role=radio]");e?.[s]?.focus()}},[e,n,i]);return(0,t.jsx)("div",{ref:a,role:"radiogroup","aria-label":"Execution engine",onKeyDown:o,className:["stg:inline-flex stg:items-center stg:rounded-md stg:border stg:border-border stg:bg-background stg:p-0.5",i?"stg:pointer-events-none stg:opacity-50":void 0,r].filter(Boolean).join(" "),children:T.map(s=>{let r=e===s;return(0,t.jsxs)("button",{type:"button",role:"radio","aria-checked":r,"aria-label":A.HARNESS_LABELS[s],tabIndex:r?0:-1,disabled:i,onClick:()=>{r||n(s)},className:["stg:inline-flex stg:items-center stg:gap-1 stg:rounded-[5px] stg:px-2 stg:py-1 stg:text-xs stg:transition-colors stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:disabled:pointer-events-none",r?"stg:bg-accent stg:font-medium stg:text-foreground stg:shadow-sm":"stg:text-muted-foreground stg:hover:text-foreground"].join(" "),children:[A.HARNESS_LABELS[s],"cursor"===s&&(0,t.jsx)("span",{"aria-label":"premium",className:"stg:text-[0.6rem] stg:text-muted-foreground",children:"$$$"})]},s)})})}let I=["agent","plan"],L={agent:{label:"Agent",description:"Full tool access — read, write, and execute"},plan:{label:"Plan",description:"Read-only analysis — search and reason only"}};function P({value:e,onValueChange:r,className:i,disabled:a}){let g=(0,l.useStigmerPortalContainer)(),[c,u]=(0,s.useState)(!1),d=(0,s.useCallback)(e=>{r(e),u(!1)},[r]),m=(0,s.useCallback)(t=>{let s,n=I.indexOf(e);switch(t.key){case"ArrowDown":t.preventDefault(),s=n<I.length-1?n+1:0;break;case"ArrowUp":t.preventDefault(),s=n>0?n-1:I.length-1;break;case"Escape":t.preventDefault(),u(!1);return}void 0!==s&&d(I[s])},[e,d]);return(0,t.jsxs)(o.Popover.Root,{open:c,onOpenChange:u,children:[(0,t.jsxs)(o.Popover.Trigger,{disabled:a,className:(0,n.cn)("stg:inline-flex stg:items-center stg:gap-1 stg:rounded-md stg:px-2 stg:py-1.5 stg:text-xs stg:transition-colors","stg:text-muted-foreground stg:hover:text-foreground stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50",i),children:[(0,t.jsx)("span",{className:"stg:font-medium stg:text-foreground",children:L[e].label}),(0,t.jsx)(O,{})]}),(0,t.jsx)(o.Popover.Portal,{container:g,children:(0,t.jsx)(o.Popover.Positioner,{sideOffset:4,children:(0,t.jsx)(o.Popover.Popup,{role:"listbox","aria-label":"Interaction mode",onKeyDown:m,className:(0,n.cn)("stg:z-50 stg:w-56 stg:rounded-lg stg:border stg:border-border stg:bg-popover stg:p-1 stg:shadow-md","stg:animate-in stg:fade-in-0 stg:zoom-in-95"),children:I.map(s=>{let r=L[s],i=e===s;return(0,t.jsxs)("button",{type:"button",role:"option","aria-selected":i,onClick:()=>d(s),className:(0,n.cn)("stg:flex stg:w-full stg:flex-col stg:gap-0.5 stg:rounded-md stg:px-2.5 stg:py-2 stg:text-left stg:transition-colors","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",i?"stg:bg-accent stg:text-foreground":"stg:text-foreground stg:hover:bg-accent-hover"),children:[(0,t.jsx)("span",{className:"stg:text-xs stg:font-medium",children:r.label}),(0,t.jsx)("span",{className:"stg:text-[0.65rem] stg:leading-snug stg:text-muted-foreground",children:r.description})]},s)})})})})]})}function O(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"stg:shrink-0 stg:text-muted-foreground","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var F=e.i(379410);function D({disabled:e,isSubmitting:s,canSend:r,onSend:i,onStop:o,isStopping:l=!1,showAttach:c,attachmentCount:u,onAttachClick:h,showWorkspace:f,workspaceCount:v,workspaceContent:b,onWorkspaceDirectAction:j,configureItems:y,configOpen:k,onConfigOpenChange:S,configActivePanel:N,onConfigActivePanelChange:C,renderConfigPanel:E,showHarnessSelector:A,harness:T,onHarnessChange:I,showInteractionModePicker:L,interactionMode:O,onInteractionModeChange:B,showModelSelector:$,modelId:_,onModelChange:V,serviceTier:U,onServiceTierChange:W,thinkingMode:z,onThinkingModeChange:H}){return(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-between stg:gap-2 stg:border-t stg:border-border-muted stg:px-3 stg:py-2",children:[(0,t.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:items-center stg:gap-1.5",children:[L&&(0,t.jsx)(P,{value:O??"agent",onValueChange:B,disabled:e}),A&&!$&&(0,t.jsx)(M,{value:T??"native",onValueChange:I,disabled:e}),$&&(0,t.jsx)(R.ModelSelector,{value:_,onValueChange:V,harness:A?void 0:T,initialHarness:A?T:void 0,onHarnessChange:A?I:void 0,serviceTier:U,onServiceTierChange:W,thinkingMode:z,onThinkingModeChange:H,disabled:e})]}),(0,t.jsx)(a.TooltipProvider,{children:(0,t.jsxs)("div",{className:"stg:flex stg:shrink-0 stg:items-center stg:gap-1",children:[f&&(j?(0,t.jsxs)(a.Tooltip,{children:[(0,t.jsx)(a.TooltipTrigger,{render:(0,t.jsx)("span",{className:"stg:inline-flex"}),children:(0,t.jsx)("button",{type:"button",disabled:e,onClick:j,className:(0,n.cn)("stg:inline-flex stg:h-8 stg:w-8 stg:items-center stg:justify-center stg:rounded-md stg:text-xs stg:transition-colors","stg:text-muted-foreground stg:hover:text-foreground stg:hover:bg-accent-hover","stg:disabled:pointer-events-none stg:disabled:opacity-50"),"aria-label":"Workspace",children:(0,t.jsxs)("span",{className:"stg:relative",children:[(0,t.jsx)(x,{}),v>0&&(0,t.jsx)("span",{className:"stg:absolute stg:-right-1.5 stg:-top-1.5 stg:flex stg:h-3.5 stg:min-w-3.5 stg:items-center stg:justify-center stg:rounded-full stg:bg-primary stg:px-0.5 stg:text-[0.5rem] stg:font-medium stg:leading-none stg:text-primary-foreground",children:v})]})})}),(0,t.jsx)(a.TooltipContent,{side:"top",children:"Workspace"})]}):(0,t.jsx)(g,{icon:(0,t.jsx)(x,{}),label:"Workspace",count:v,disabled:e,children:b})),c&&(0,t.jsxs)(a.Tooltip,{children:[(0,t.jsx)(a.TooltipTrigger,{render:(0,t.jsx)("span",{className:"stg:inline-flex"}),children:(0,t.jsx)("button",{type:"button",disabled:e,onClick:h,className:(0,n.cn)("stg:inline-flex stg:h-8 stg:w-8 stg:items-center stg:justify-center stg:rounded-md stg:text-xs stg:transition-colors","stg:text-muted-foreground stg:hover:text-foreground stg:hover:bg-accent-hover","stg:disabled:pointer-events-none stg:disabled:opacity-50"),"aria-label":"Attach files",children:(0,t.jsxs)("span",{className:"stg:relative",children:[(0,t.jsx)(p,{}),u>0&&(0,t.jsx)("span",{className:"stg:absolute stg:-right-1.5 stg:-top-1.5 stg:flex stg:h-3.5 stg:min-w-3.5 stg:items-center stg:justify-center stg:rounded-full stg:bg-primary stg:px-0.5 stg:text-[0.5rem] stg:font-medium stg:leading-none stg:text-primary-foreground",children:u})]})})}),(0,t.jsx)(a.TooltipContent,{side:"top",children:"Attach files"})]}),(0,t.jsx)(w,{open:k,onOpenChange:S,activePanel:N,onActivePanelChange:C,items:y,renderPanel:E,disabled:e}),o?(0,t.jsxs)(a.Tooltip,{children:[(0,t.jsx)(a.TooltipTrigger,{render:(0,t.jsx)("button",{type:"button",onClick:o,className:"stg:flex stg:h-8 stg:w-8 stg:shrink-0 stg:items-center stg:justify-center stg:rounded-full stg:bg-primary stg:text-primary-foreground stg:transition-colors stg:hover:bg-primary-hover","aria-label":"Stop generating"}),children:l?(0,t.jsx)(F.SpinnerIcon,{}):(0,t.jsx)(m,{})}),(0,t.jsx)(a.TooltipContent,{side:"top",children:"Stop"})]}):(0,t.jsx)("button",{type:"button",disabled:!r,onClick:i,className:"stg:flex stg:h-8 stg:w-8 stg:shrink-0 stg:items-center stg:justify-center stg:rounded-lg stg:bg-primary stg:text-primary-foreground stg:transition-colors stg:hover:bg-primary-hover stg:disabled:pointer-events-none stg:disabled:opacity-40","aria-label":"Send message",children:s?(0,t.jsx)(F.SpinnerIcon,{}):(0,t.jsx)(d,{})})]})})]})}var B=e.i(444857),$=e.i(766817),_=e.i(614920),V=e.i(557702),U=e.i(711364);let W=new Set(["image/png","image/jpeg","image/webp","image/gif"]),z={warnings:[],modelCannotSeeImages:!1};var H=e.i(356965),K=e.i(954884),q=e.i(351240);function Y({agentName:e,...s}){return(0,t.jsx)(q.EnvVarForm,{title:e,description:"Enter required credentials to use this agent.",ariaLabel:`Configure ${e}`,...s})}var G=e.i(266584),X=e.i(869803),J=e.i(891287),Z=e.i(486277),Q=e.i(336973),ee=e.i(170255),et=e.i(586108),es=e.i(326283),en=e.i(207344),er=e.i(367539),ei=e.i(288270);let ea={status:"idle",error:null};function eo(e,t){switch(t.type){case"RESOLVE_START":return{status:"resolving",agentRef:t.agentRef,error:null};case"RESOLVE_NEEDS_ENV":return{status:"needsEnvVars",agentRef:t.agentRef,agentId:t.agentId,agentName:t.agentName,missingVariables:t.missingVariables,pendingSignIns:t.pendingSignIns,error:null};case"SIGN_IN_COMPLETED":{if("needsEnvVars"!==e.status)return e;let s=e.pendingSignIns.filter(e=>e.id!==t.id);if(s.length===e.pendingSignIns.length)return e;return{...e,pendingSignIns:s}}case"RESOLVE_READY":case"SUBMIT_READY":return{status:"ready",agentRef:t.agentRef,agentName:t.agentName,resolution:t.resolution,error:null};case"POOL_RESOLVE":if("needsEnvVars"!==e.status)return e;if(0===t.missingVariables.length&&0===e.pendingSignIns.length)return{status:"ready",agentRef:e.agentRef,agentName:e.agentName,resolution:{mode:"direct"},error:null};return{...e,missingVariables:t.missingVariables};case"SUBMIT_START":if("needsEnvVars"!==e.status)return e;return{status:"submitting",agentRef:e.agentRef,agentId:e.agentId,agentName:e.agentName,missingVariables:e.missingVariables,pendingSignIns:e.pendingSignIns,error:null};case"ERROR":if("submitting"===e.status)return{status:"needsEnvVars",agentRef:e.agentRef,agentId:e.agentId,agentName:e.agentName,missingVariables:e.missingVariables,pendingSignIns:e.pendingSignIns,error:t.error};return{...e,error:t.error};case"CLEAR_ERROR":return{...e,error:null};case"RESET":return ea;default:return e}}let el="stigmer.ai/personal",eg="stigmer.ai/for-agent";async function ec(e,t,s){let n=[],r=new Set;for(let i of s.spec?.mcpServerUsages??[]){let s=i.mcpServerRef;if(!s)continue;let a=await e.mcpServer.getByReference(s),o=a.spec?.auth,l=a.metadata?.id??"";if(!o?.targetEnvVar||""===l)continue;r.add(o.targetEnvVar);let g=Q.OAuthConnectionHealth.OAUTH_CONNECTION_HEALTH_NO_GRANT,c=!1;try{let s=await e.mcpServer.getOAuthGrantStatus((0,J.create)(Q.GetOAuthGrantStatusInputSchema,{resourceId:l,org:t}));g=s.connectionHealth,c=s.connected&&g!==Q.OAuthConnectionHealth.OAUTH_CONNECTION_HEALTH_TOKEN_EXPIRED}catch{}c||n.push({ref:{org:s.org||a.metadata?.org||t,slug:s.slug||a.metadata?.slug||""},id:l,name:a.metadata?.name||a.metadata?.slug||s.slug,health:g})}return{pendingSignIns:n,signInVariables:r}}async function eu(e,t){let{org:s,agentId:n,agentSlug:r,agentLabel:i,environmentRef:a}=t,o=await e.agentInstance.list((0,J.create)(Z.ListAgentInstancesRequestSchema,{org:s,labels:{[el]:"true",[eg]:i}}));return o.items.length>0?o.items[0]:e.agentInstance.create(function(e){let{org:t,agentId:s,agentSlug:n,environmentRef:r}=e;return{name:`${n} Personal`,slug:`${n}-personal-${(0,er.generateSlugSuffix)()}`,org:t,agentId:s,labels:{"stigmer.ai/personal":"true","stigmer.ai/for-agent":`${t}/${n}`},environmentRefs:[r]}}({org:s,agentId:n,agentSlug:r,environmentRef:a}))}var ed=e.i(910304);let em=/MCP server '([^']+)' requires environment variable '([^']+)'/g;function eh(e){let t,s=[];for(;null!==(t=em.exec(e));)s.push({serverName:t[1],variableName:t[2]});return em.lastIndex=0,s}function ep(e){return e instanceof ed.StigmerError&&"failed-precondition"===e.code}function ef({error:e,className:r}){let i=(0,s.useMemo)(()=>{if(!e||!ep(e))return null;let t=eh(e.message);return 0===t.length?null:t},[e]);if(!i)return null;let a=(0,s.useMemo)(()=>{let e=new Map;for(let{serverName:t,variableName:s}of i){let n=e.get(t)??[];n.push(s),e.set(t,n)}return e},[i]);return(0,t.jsx)("div",{role:"alert",className:(0,n.cn)("stg:rounded-lg stg:border stg:border-amber-500/30 stg:bg-amber-500/5 stg:p-4",r),children:(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:gap-3",children:[(0,t.jsx)(ev,{className:"stg:mt-0.5 stg:size-4 stg:shrink-0 stg:text-amber-600 stg:dark:text-amber-400"}),(0,t.jsxs)("div",{className:"stg:min-w-0 stg:flex-1 stg:space-y-2",children:[(0,t.jsx)("p",{className:"stg:text-sm stg:font-medium stg:text-amber-800 stg:dark:text-amber-200",children:"Missing environment variables"}),(0,t.jsx)("div",{className:"stg:space-y-1.5",children:Array.from(a).map(([e,s])=>(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{className:"stg:text-xs stg:text-amber-700 stg:dark:text-amber-300",children:[(0,t.jsx)("span",{className:"stg:font-medium",children:e})," requires:"]}),(0,t.jsx)("ul",{className:(0,n.cn)(X.UNSTYLED_LIST,"stg:mt-0.5 stg:space-y-0.5"),children:s.map(e=>(0,t.jsx)("li",{className:"stg:text-xs stg:font-mono stg:text-amber-800/80 stg:dark:text-amber-200/80 stg:pl-3",children:e},e))})]},e))}),(0,t.jsxs)("div",{className:"stg:border-t stg:border-amber-500/20 stg:pt-2",children:[(0,t.jsx)("p",{className:"stg:text-xs stg:text-amber-700/90 stg:dark:text-amber-300/90",children:"You can provide these values in two ways:"}),(0,t.jsxs)("ul",{className:(0,n.cn)(X.UNSTYLED_LIST,"stg:mt-1 stg:space-y-0.5 stg:text-xs stg:text-amber-700/80 stg:dark:text-amber-300/80"),children:[(0,t.jsxs)("li",{className:"stg:flex stg:items-start stg:gap-1.5",children:[(0,t.jsx)("span",{className:"stg:mt-px stg:shrink-0",children:"•"}),(0,t.jsxs)("span",{children:["Add them to your"," ",(0,t.jsx)("strong",{className:"stg:font-medium",children:"personal environment"})," ","in Settings for automatic reuse across sessions."]})]}),(0,t.jsxs)("li",{className:"stg:flex stg:items-start stg:gap-1.5",children:[(0,t.jsx)("span",{className:"stg:mt-px stg:shrink-0",children:"•"}),(0,t.jsxs)("span",{children:["Provide them as"," ",(0,t.jsx)("strong",{className:"stg:font-medium",children:"session variables"})," ","when sending a message."]})]})]})]})]})]})})}function ex(e){return!!e&&!!ep(e)&&eh(e.message).length>0}function ev({className:e}){return(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"10.5",cy:"5.5",r:"3"}),(0,t.jsx)("path",{d:"M8.5 7.5L3 13l1.5 1.5"}),(0,t.jsx)("path",{d:"M5.5 11l1.5 1.5"})]})}var eb=e.i(348728);function ej(e){return`${e.org}/${e.slug}`}let ey={};function ek(e,t){switch(t.type){case"ADD_SERVER":return{...e,[t.key]:{status:"loading",error:null}};case"RESOLVE_NEEDS_SETUP":{let s=e[t.key];if(s?.status!=="loading")return e;return{...e,[t.key]:{status:"needsSetup",mcpServer:t.mcpServer,missingVariables:t.missingVariables,discoveredTools:t.discoveredTools,toolApprovals:t.toolApprovals,oauthConnectionHealth:t.oauthConnectionHealth,error:null}}}case"RESOLVE_READY":{let s=e[t.key];if(s?.status!=="loading")return e;return{...e,[t.key]:{status:"ready",mcpServer:t.mcpServer,discoveredTools:t.discoveredTools,toolApprovals:t.toolApprovals,enabledTools:t.enabledTools,oauthConnectionHealth:t.oauthConnectionHealth,error:null}}}case"POOL_RESOLVE":{let s=e[t.key];if(s?.status!=="needsSetup")return e;if(0===t.missingVariables.length)return{...e,[t.key]:{status:"ready",mcpServer:s.mcpServer,discoveredTools:s.discoveredTools,toolApprovals:s.toolApprovals,enabledTools:t.enabledTools,oauthConnectionHealth:s.oauthConnectionHealth,error:null}};return{...e,[t.key]:{...s,missingVariables:t.missingVariables}}}case"SUBMIT_START":{let s=e[t.key];if(s?.status!=="needsSetup")return e;return{...e,[t.key]:{status:"submitting",mcpServer:s.mcpServer,missingVariables:s.missingVariables,discoveredTools:s.discoveredTools,toolApprovals:s.toolApprovals,oauthConnectionHealth:s.oauthConnectionHealth,error:null}}}case"SUBMIT_DONE":{let s=e[t.key];if(s?.status!=="submitting")return e;return{...e,[t.key]:{status:"ready",mcpServer:s.mcpServer,discoveredTools:s.discoveredTools,toolApprovals:s.toolApprovals,enabledTools:t.enabledTools,oauthConnectionHealth:s.oauthConnectionHealth,error:null}}}case"SUBMIT_FAIL":{let s=e[t.key];if(s?.status!=="submitting")return e;return{...e,[t.key]:{status:"needsSetup",mcpServer:s.mcpServer,missingVariables:s.missingVariables,discoveredTools:s.discoveredTools,toolApprovals:s.toolApprovals,oauthConnectionHealth:s.oauthConnectionHealth,error:t.error}}}case"SET_ENABLED_TOOLS":{let s=e[t.key];if(s?.status!=="ready")return e;return{...e,[t.key]:{...s,enabledTools:t.enabledTools}}}case"SET_ERROR":{let s=e[t.key];if(!s)return e;return{...e,[t.key]:{...s,error:t.error}}}case"CLEAR_ERROR":{let s=e[t.key];if(!s)return e;return{...e,[t.key]:{...s,error:null}}}case"REMOVE_SERVER":{if(!(t.key in e))return e;let{[t.key]:s,...n}=e;return n}case"RESET":return ey;default:return e}}function ew(e,t){let s=e.spec?.defaultEnabledTools;return s&&s.length>0?[...s]:t.map(e=>e.name)}var eS=e.i(841358),eN=e.i(230849),eC=e.i(4144);function eE({sessionVariables:e,disabled:r=!1,className:i,requiredByMap:a}){let o=(0,eN.useScrollShadows)(),l=(0,s.useMemo)(()=>{let t=new Set,s=new Set;for(let n of e.entries){let e=n.key.trim();""!==e&&(t.has(e)&&s.add(e),t.add(e))}return s},[e.entries]);return(0,t.jsxs)("div",{className:(0,n.cn)("stg:w-80 stg:space-y-3",i),"aria-label":"Session variables",children:[(0,t.jsxs)("div",{className:"stg:space-y-0.5",children:[(0,t.jsx)("h3",{className:"stg:text-xs stg:font-medium stg:text-foreground",children:"Session variables"}),(0,t.jsx)("p",{className:"stg:text-[0.65rem] stg:text-muted-foreground",children:"Additional environment variables for this session."})]}),e.entries.length>0?(0,t.jsxs)("div",{className:"stg:relative",children:[o.canScrollUp&&(0,t.jsx)(eC.ScrollFade,{position:"top"}),(0,t.jsx)("div",{ref:o.scrollRef,className:"stg:max-h-64 stg:space-y-2.5 stg:overflow-y-auto",children:e.entries.map(s=>{let n=l.has(s.key.trim());return(0,t.jsx)(eR,{id:s.id,entryKey:s.key,value:s.value,isSecret:s.isSecret,saveForFuture:s.saveForFuture,isDuplicate:n,disabled:r,onUpdate:e.updateEntry,onRemove:e.removeEntry,requiredBy:s.key.trim()?a?.[s.key.trim()]:void 0},s.id)})}),o.canScrollDown&&(0,t.jsx)(eC.ScrollFade,{position:"bottom"})]}):(0,t.jsx)("p",{className:"stg:py-2 stg:text-center stg:text-[0.65rem] stg:text-muted-foreground-subtle",children:"No variables added."}),(0,t.jsxs)("button",{type:"button",onClick:e.addEntry,disabled:r,className:(0,n.cn)("stg:inline-flex stg:w-full stg:items-center stg:justify-center stg:gap-1 stg:rounded-md stg:py-1.5 stg:text-xs","stg:border stg:border-dashed stg:border-border stg:text-muted-foreground","stg:hover:border-border stg:hover:bg-accent-hover stg:hover:text-foreground","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:[(0,t.jsx)(eT,{}),(0,t.jsx)("span",{children:"Add variable"})]})]})}function eR({id:e,entryKey:s,value:r,isSecret:i,saveForFuture:a,isDuplicate:o,disabled:l,onUpdate:g,onRemove:c,requiredBy:u}){let d=`stgm-sv-key-${e}`,m=`stgm-sv-val-${e}`,h=s.trim()||"entry";return(0,t.jsxs)("div",{className:"stg:space-y-1.5",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-1.5",children:[(0,t.jsx)("input",{id:d,type:"text",value:s,onChange:t=>g(e,{key:t.target.value}),disabled:l,placeholder:"VARIABLE_NAME",autoComplete:"off",spellCheck:!1,"aria-label":"Variable name",className:(0,n.cn)("stg:min-w-0 stg:flex-1 stg:rounded-md stg:border stg:border-input stg:bg-background stg:px-2.5 stg:py-1.5 stg:font-mono stg:text-xs stg:text-foreground","stg:placeholder:text-muted-foreground-faint","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50",o&&"stg:border-warning")}),(0,t.jsx)(eA,{checked:i,disabled:l,onChange:t=>g(e,{isSecret:t})}),(0,t.jsx)("button",{type:"button",onClick:()=>c(e),disabled:l,className:"stg:shrink-0 stg:rounded stg:p-0.5 stg:text-muted-foreground stg:hover:text-destructive stg:disabled:pointer-events-none stg:disabled:opacity-50","aria-label":`Remove ${h}`,children:(0,t.jsx)(eM,{})})]}),(0,t.jsx)("div",{className:"stg:relative",children:(0,t.jsx)("input",{id:m,type:i?"password":"text",value:r,onChange:t=>g(e,{value:t.target.value}),disabled:l,placeholder:i?"••••••••":"value",autoComplete:"off","aria-label":`Variable value${s.trim()?` for ${s.trim()}`:""}`,className:(0,n.cn)("stg:w-full stg:rounded-md stg:border stg:border-input stg:bg-background stg:px-2.5 stg:py-1.5 stg:text-xs stg:text-foreground","stg:placeholder:text-muted-foreground-faint","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50")})}),(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-1.5",children:[(0,t.jsx)("button",{type:"button",role:"switch","aria-checked":a,"aria-label":a?"Saved for future runs":"Used once only",disabled:l,onClick:()=>g(e,{saveForFuture:!a}),className:(0,n.cn)("stg:relative stg:inline-flex stg:h-3.5 stg:w-6 stg:shrink-0 stg:cursor-pointer stg:rounded-full stg:transition-colors","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:focus-visible:ring-offset-1","stg:disabled:pointer-events-none stg:disabled:opacity-50",a?"stg:bg-primary":"stg:bg-input"),children:(0,t.jsx)("span",{className:(0,n.cn)("stg:pointer-events-none stg:block stg:h-2.5 stg:w-2.5 stg:translate-y-0.5 stg:rounded-full stg:bg-background stg:shadow-sm stg:ring-0 stg:transition-transform",a?"stg:translate-x-3":"stg:translate-x-0.5")})}),(0,t.jsx)("span",{className:"stg:text-[0.6rem] stg:text-muted-foreground",children:a?"Save for future runs":"This run only"})]}),u&&u.length>0&&(0,t.jsxs)("p",{className:"stg:text-[0.55rem] stg:text-primary-muted",children:["Used by: ",u.join(", ")]}),o&&(0,t.jsx)("p",{className:"stg:text-[0.6rem] stg:text-warning",role:"alert",children:"Duplicate key — last value wins."})]})}function eA({checked:e,disabled:s,onChange:r}){return(0,t.jsxs)("button",{type:"button",role:"switch","aria-checked":e,"aria-label":e?"Marked as secret":"Not marked as secret",disabled:s,onClick:()=>r(!e),className:(0,n.cn)("stg:inline-flex stg:shrink-0 stg:items-center stg:gap-0.5 stg:rounded-md stg:px-1.5 stg:py-1 stg:text-[0.55rem] stg:font-medium stg:uppercase stg:tracking-wider stg:transition-colors","stg:disabled:pointer-events-none stg:disabled:opacity-50",e?"stg:bg-primary-subtle stg:text-primary":"stg:bg-muted-subtle stg:text-muted-foreground stg:hover:bg-muted"),children:[(0,t.jsx)(eI,{}),(0,t.jsx)("span",{children:e?"secret":"plain"})]})}function eT(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M8 3v10M3 8h10"})})}function eM(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M4 4L10 10M10 4L4 10"})})}function eI(){return(0,t.jsxs)("svg",{width:"8",height:"8",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"3",y:"8",width:"10",height:"7",rx:"1.5"}),(0,t.jsx)("path",{d:"M5 8V5a3 3 0 0 1 6 0v3"})]})}var eL=e.i(261024);function eP(e,t){return e*t>115e4||Math.max(e,t)>1568}let eO=new Set(["image/png","image/jpeg"]);function eF(e,t,s){return new Promise(n=>{try{e.toBlob(n,t,s)}catch{n(null)}})}async function eD(e){let t,s=e.type.toLowerCase();if(!s.startsWith("image/")||"function"!=typeof createImageBitmap||"u"<typeof document)return e;try{t=await createImageBitmap(e,{imageOrientation:"from-image"})}catch{return e}try{var n;let r,i,a,o,l=eP(t.width,t.height),g="image/gif"===s;if(!l&&(eO.has(s)||g))return e;let c=l?function(e,t){if(!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0||!eP(e,t))return{width:e,height:t};let s=e/t,n=Math.sqrt(115e4/s),r=n*s;return Math.max(r,n)>1568&&(r>=n?n=(r=1568)/s:r=(n=1568)*s),{width:Math.max(1,Math.floor(Math.min(r,e))),height:Math.max(1,Math.floor(Math.min(n,t)))}}(t.width,t.height):{width:t.width,height:t.height},u=document.createElement("canvas");u.width=c.width,u.height=c.height;let d=u.getContext("2d");if(!d)return e;if(d.drawImage(t,0,0,c.width,c.height),"image/jpeg"===s)i="image/jpeg",r=await eF(u,i,.9);else{let e=await eF(u,"image/png"),t=e?e.size/(c.width*c.height):1/0;if(e&&t<=1)i="image/png",r=e;else{d.globalCompositeOperation="destination-over",d.fillStyle="#ffffff",d.fillRect(0,0,c.width,c.height);let t=await eF(u,"image/jpeg",.9);r=t??e,i=t?"image/jpeg":"image/png"}}if(!r||i===s&&r.size>=e.size)return e;let m="image/jpeg"===i?"jpg":"png",h=i===s?e.name:(n=e.name,o=(a=n.lastIndexOf("."))>0?n.slice(0,a):n,`${o}.${m}`);return new File([r],h,{type:i,lastModified:e.lastModified})}finally{t.close()}}let eB=0;function e$(){return`attachment-${++eB}-${Date.now()}`}function e_(e){let[t,n]=(0,s.useState)(null);return(0,s.useEffect)(()=>{let t=URL.createObjectURL(e);return n(t),()=>URL.revokeObjectURL(t)},[e]),t}var eV=e.i(255928),eU=e.i(933221);function eW({entries:e,onRemove:r,onRetry:i,onPreview:a,disabled:o,className:l}){let[g,c]=(0,s.useState)(null),u=null!==g?e.find(e=>e.id===g)??null:null;return 0===e.length?null:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:(0,n.cn)("stg:flex stg:flex-wrap stg:items-center stg:gap-1.5",l),role:"list","aria-label":"Attached files",children:e.map(e=>(0,t.jsx)(ez,{entry:e,onRemove:()=>r(e.id),onRetry:()=>i(e.id),onPreview:a?()=>a(e):()=>c(e.id),disabled:o},e.id))}),u&&(0,t.jsx)(eJ,{entry:u,onClose:()=>c(null)})]})}function ez({entry:e,onRemove:s,onRetry:n,onPreview:r,disabled:i}){return e.contentType.startsWith("image/")?(0,t.jsx)(eq,{entry:e,onRemove:s,onRetry:n,onPreview:r,disabled:i}):(0,t.jsx)(eY,{entry:e,onRemove:s,onRetry:n,disabled:i})}function eH(e){let t="preparing"===e.phase,s="uploading"===e.phase,n="error"===e.phase;return`${e.file.name}, ${(0,U.formatFileSize)(e.file.size)}${t?", preparing":""}${s?", uploading":""}${n?", upload failed":""}`}function eK(e){return"preparing"===e.phase||"uploading"===e.phase}function eq({entry:e,onRemove:r,onRetry:i,onPreview:o,disabled:l}){let g=e_(e.file),[c,u]=(0,s.useState)(!1);if(c)return(0,t.jsx)(eY,{entry:e,onRemove:r,onRetry:i,disabled:l});let d="error"===e.phase,m=eK(e);return(0,t.jsxs)(a.Tooltip,{children:[(0,t.jsxs)(a.TooltipTrigger,{render:(0,t.jsx)("span",{role:"listitem","aria-label":eH(e),className:"stg:relative stg:inline-flex"}),children:[(0,t.jsxs)("button",{type:"button",onClick:o,"aria-label":`Preview ${e.file.name}`,className:(0,n.cn)(eU.UNSTYLED_BUTTON,"stg:relative stg:block stg:h-14 stg:w-14 stg:overflow-hidden stg:rounded-md stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",d&&"stg:ring-1 stg:ring-destructive"),children:[g?(0,t.jsx)("img",{src:g,alt:"","aria-hidden":"true",onError:()=>u(!0),className:(0,n.cn)("stg:h-full stg:w-full stg:object-cover",(m||d)&&"stg:opacity-50")}):(0,t.jsx)("span",{className:"stg:block stg:h-full stg:w-full stg:animate-pulse stg:bg-muted","aria-hidden":"true"}),m&&(0,t.jsx)("span",{className:"stg:absolute stg:inset-0 stg:flex stg:items-center stg:justify-center",children:(0,t.jsx)(eZ,{size:16})})]}),d&&(0,t.jsx)("button",{type:"button",onClick:i,disabled:l,"aria-label":`Retry uploading ${e.file.name}`,className:(0,n.cn)(eU.UNSTYLED_BUTTON,"stg:absolute stg:left-1/2 stg:top-1/2 stg:-translate-x-1/2 stg:-translate-y-1/2 stg:rounded-full stg:bg-destructive stg:px-1.5 stg:py-0.5 stg:text-[0.6rem] stg:font-medium stg:leading-none stg:text-destructive-foreground stg:shadow-sm stg:hover:bg-destructive-hover stg:disabled:pointer-events-none"),children:"Retry"}),(0,t.jsx)("button",{type:"button",onClick:r,disabled:l,"aria-label":`Remove ${e.file.name}`,className:(0,n.cn)(eU.UNSTYLED_BUTTON,"stg:absolute stg:-right-1.5 stg:-top-1.5 stg:flex stg:h-4 stg:w-4 stg:items-center stg:justify-center stg:rounded-full stg:border stg:border-border stg:bg-background stg:text-muted-foreground stg:shadow-sm stg:hover:text-destructive stg:disabled:pointer-events-none"),children:(0,t.jsx)(e1,{})})]}),(0,t.jsx)(a.TooltipContent,{side:"top",className:"stg:break-all",children:e.file.name})]})}function eY({entry:e,onRemove:s,onRetry:r,disabled:i}){let a="error"===e.phase,o=eK(e);return(0,t.jsxs)("span",{role:"listitem","aria-label":eH(e),className:(0,n.cn)("stg:inline-flex stg:max-w-[200px] stg:items-center stg:gap-1 stg:rounded-md stg:px-2 stg:py-0.5 stg:text-xs",a?"stg:border stg:border-destructive/30 stg:bg-destructive-subtle stg:text-destructive":"stg:bg-muted-subtle stg:text-foreground",o&&"stg:opacity-70"),children:[o&&(0,t.jsx)(eZ,{}),a&&(0,t.jsx)(eQ,{}),!o&&!a&&(0,t.jsx)(e0,{}),(0,t.jsx)("span",{className:"stg:truncate",children:e.file.name}),(0,t.jsx)("span",{className:"stg:shrink-0 stg:text-[0.6rem] stg:tabular-nums stg:text-muted-foreground",children:(0,U.formatFileSize)(e.file.size)}),a&&(0,t.jsx)(eG,{filename:e.file.name,onRetry:r,disabled:i}),(0,t.jsx)(eX,{filename:e.file.name,onRemove:s,disabled:i})]})}function eG({filename:e,onRetry:s,disabled:r}){return(0,t.jsx)("button",{type:"button",onClick:s,disabled:r,className:(0,n.cn)(eU.UNSTYLED_BUTTON,"stg:shrink-0 stg:text-[0.6rem] stg:font-medium stg:text-destructive stg:underline stg:hover:text-destructive-muted stg:disabled:pointer-events-none"),"aria-label":`Retry uploading ${e}`,children:"Retry"})}function eX({filename:e,onRemove:s,disabled:r}){return(0,t.jsx)("button",{type:"button",onClick:s,disabled:r,className:(0,n.cn)(eU.UNSTYLED_BUTTON,"stg:ml-0.5 stg:shrink-0 stg:text-muted-foreground stg:hover:text-destructive stg:disabled:pointer-events-none"),"aria-label":`Remove ${e}`,children:(0,t.jsx)(e1,{})})}function eJ({entry:e,onClose:s}){let n=e_(e.file);return(0,t.jsx)(eV.AttachmentImageLightbox,{src:n,filename:e.file.name,open:!0,onClose:s})}function eZ({size:e=10}){return(0,t.jsx)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",className:"stg:shrink-0 stg:animate-spin stg:text-muted-foreground","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M8 2a6 6 0 1 0 6 6"})})}function eQ(){return(0,t.jsx)("span",{className:"stg:inline-block stg:h-1.5 stg:w-1.5 stg:shrink-0 stg:rounded-full stg:bg-destructive","aria-hidden":"true"})}function e0(){return(0,t.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0 stg:text-muted-foreground","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M8 1H4C3.45 1 3 1.45 3 2V12C3 12.55 3.45 13 4 13H10C10.55 13 11 12.55 11 12V4L8 1Z"}),(0,t.jsx)("path",{d:"M8 1V4H11"})]})}function e1(){return(0,t.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M4 4L10 10M10 4L4 10"})})}let e5=/^image\.(png|jpe?g|gif|webp|tiff?|bmp|avif)$/i,e2={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/tiff":"tiff","image/bmp":"bmp","image/avif":"avif","image/svg+xml":"svg"},e4=0;function e3({refs:e,onRemove:s,disabled:r,className:i}){return 0===e.length?null:(0,t.jsx)("div",{className:(0,n.cn)("stg:flex stg:flex-wrap stg:gap-1.5",i),role:"list","aria-label":"Referenced workspace files",children:e.map(e=>(0,t.jsx)(e6,{path:e,onRemove:()=>s(e),disabled:r},e))})}function e6({path:e,onRemove:s,disabled:n}){let r=e.split("/").pop()??e;return(0,t.jsxs)(a.Tooltip,{children:[(0,t.jsxs)(a.TooltipTrigger,{render:(0,t.jsx)("span",{role:"listitem","aria-label":`Referenced file: ${e}`,className:"stg:inline-flex stg:max-w-[200px] stg:items-center stg:gap-1 stg:rounded-md stg:bg-muted-subtle stg:px-2 stg:py-0.5 stg:text-xs stg:text-foreground"}),children:[(0,t.jsx)(e8,{}),(0,t.jsx)("span",{className:"stg:truncate",children:r}),(0,t.jsx)("button",{type:"button",onClick:s,disabled:n,className:"stg:ml-0.5 stg:shrink-0 stg:text-muted-foreground stg:hover:text-destructive stg:disabled:pointer-events-none","aria-label":`Remove reference to ${e}`,children:(0,t.jsx)(e7,{})})]}),(0,t.jsx)(a.TooltipContent,{side:"top",className:"stg:break-all",children:e})]})}function e8(){return(0,t.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0 stg:text-accent-foreground","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M8 1H4C3.45 1 3 1.45 3 2V12C3 12.55 3.45 13 4 13H10C10.55 13 11 12.55 11 12V4L8 1Z"}),(0,t.jsx)("path",{d:"M8 1V4H11"}),(0,t.jsx)("path",{d:"M5 8H9M5 10H8"})]})}function e7(){return(0,t.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M4 4L10 10M10 4L4 10"})})}var e9=e.i(536907),te=e.i(139666),tt=e.i(282838);let ts=(0,s.forwardRef)(function({onSubmit:e,isSubmitting:r=!1,disabled:o=!1,onStop:l,isStopping:g=!1,isEditing:d=!1,onCancelEdit:m,harness:p,onHarnessChange:x,showHarnessSelector:y=!1,interactionMode:w,onInteractionModeChange:S,showInteractionModePicker:N=!1,defaultModelId:C,onModelChange:E,showModelSelector:R=!0,workspace:A,gitHubConnection:T,enableGitHub:M=!0,enableLocal:I=!1,onBrowseLocalFolder:L,org:P,agentRef:O,onAgentRefChange:F,onAgentResolutionChange:q,onAgentSetupErrorChange:er,initialAgentRef:ed,initialInstanceId:em,lockAgent:eh=!1,mcpServerUsages:ep,onMcpServerUsagesChange:ef,skillRefs:ex,onSkillRefsChange:ev,sessionVariables:eN,enableAttachments:eC=!0,enableFileReferences:eR=!0,onAttachmentValidationError:eA,initialAttachments:eT,placeholder:eM="Reply…",initialRows:eI=1,autoFocus:eP=!1,ariaLabel:eO="Send message",className:eF},eB){(0,tt.useRenderTracer)("SessionComposer",{disabled:o,isSubmitting:r});let[e_,eV]=(0,s.useState)(C),eU=(0,s.useRef)(!1);(0,s.useEffect)(()=>{eU.current||void 0===C||eV(C)},[C]);let ez=(0,s.useCallback)(e=>{eU.current=!0,eV(e)},[]),[eH,eK]=(0,s.useState)("standard"),[eq,eY]=(0,s.useState)("disabled"),[eG,eX]=(0,s.useState)(p??"native");(0,s.useEffect)(()=>{void 0!==p&&eX(p)},[p]);let[eJ,eZ]=(0,s.useState)(()=>new Map),eQ=o||r,e0=null!=l,e1=null!=F&&null!=P,e6=null!=ef&&null!=P,e8=null!=A,e7=null!=ev&&null!=P,ts=null!=eN,[tn,ti]=(0,s.useState)(!1),[ta,to]=(0,s.useState)(null),tl=(0,s.useRef)(void 0),tg=(0,en.usePersonalEnvironment)(e1||e6?P??null:null),tc=(0,s.useMemo)(()=>new Set(Object.keys(tg.environment?.spec?.data??{})),[tg.environment]),tu=(0,et.useStigmer)(),td=function(e){let{personalEnvKeys:t,manualSecrets:n,agentRuntimeEnv:r,mcpRuntimeEnv:i}=e,a=(0,s.useMemo)(()=>{let e=new Map;if(r)for(let[t,s]of Object.entries(r))e.set(t,s);if(i)for(let[t,s]of Object.entries(i))e.set(t,s);if(n)for(let t of n){let s=t.key.trim();""!==s&&""!==t.value.trim()&&e.set(s,{value:t.value,isSecret:t.isSecret})}return e},[n,r,i]),o=(0,s.useMemo)(()=>{let e=new Set;if(t)for(let s of t)e.add(s);for(let t of a.keys())e.add(t);return e},[t,a]),l=(0,s.useMemo)(()=>e=>a.get(e),[a]),g=(0,s.useMemo)(()=>e=>o.has(e),[o]);return{availableKeys:o,getAvailableValue:l,isKeySatisfied:g}}({personalEnvKeys:tc,manualSecrets:eN?.entries}),tm=(0,s.useMemo)(()=>new Set([...td.availableKeys,...te.SYSTEM_ENV_VAR_KEYS]),[td.availableKeys]),th=function(e,t){let n=(0,et.useStigmer)(),r=(0,en.usePersonalEnvironment)(e),[i,a]=(0,s.useReducer)(eo,ea),o=(0,s.useCallback)(()=>a({type:"CLEAR_ERROR"}),[]),l=(0,s.useCallback)(()=>a({type:"RESET"}),[]),g=(0,s.useCallback)(async s=>{if(!e)throw Error("useAgentSetup: cannot resolve agent when org is null.");a({type:"RESOLVE_START",agentRef:s});try{var i;let o=await n.agent.getByReference(s),l=o.metadata?.name??s.slug,{pendingSignIns:g,signInVariables:c}=await ec(n,e,o),u=o.spec?.env?(i=o.spec.env,0===c.size?i:Object.fromEntries(Object.entries(i).filter(([e])=>!c.has(e)))):void 0;if(g.length>0){let e=new Set(Object.keys(r.environment?.spec?.data??{})),n=u?(0,ei.diffEnv)(u,e,t):[];return a({type:"RESOLVE_NEEDS_ENV",agentRef:s,agentId:o.metadata.id,agentName:l,missingVariables:n,pendingSignIns:g}),{status:"needsEnvVars",agentRef:s,agentName:l,missingVariables:n,pendingSignIns:g}}if(!u||0===Object.keys(u).length){let e={mode:"direct"};return a({type:"RESOLVE_READY",agentRef:s,agentName:l,resolution:e}),{status:"ready",agentRef:s,agentName:l,resolution:e}}let d=`${s.org}/${s.slug}`,m=await n.agentInstance.list((0,J.create)(Z.ListAgentInstancesRequestSchema,{org:e,labels:{[el]:"true",[eg]:d}}));if(m.items.length>0){let e={mode:"saved",instanceId:m.items[0].metadata.id};return a({type:"RESOLVE_READY",agentRef:s,agentName:l,resolution:e}),{status:"ready",agentRef:s,agentName:l,resolution:e}}let h=new Set(Object.keys(r.environment?.spec?.data??{})),p=(0,ei.diffEnv)(u,h),f=(0,ei.diffEnv)(u,h,t);if(0===p.length){let t=await r.getOrCreate(),i={org:e,slug:t.metadata.slug,kind:ee.ApiResourceKind.environment},g=await eu(n,{org:e,agentId:o.metadata.id,agentSlug:s.slug,agentLabel:d,environmentRef:i}),c={mode:"saved",instanceId:g.metadata.id};return a({type:"RESOLVE_READY",agentRef:s,agentName:l,resolution:c}),{status:"ready",agentRef:s,agentName:l,resolution:c}}if(0===f.length){let e={mode:"direct"};return a({type:"RESOLVE_READY",agentRef:s,agentName:l,resolution:e}),{status:"ready",agentRef:s,agentName:l,resolution:e}}return a({type:"RESOLVE_NEEDS_ENV",agentRef:s,agentId:o.metadata.id,agentName:l,missingVariables:f,pendingSignIns:[]}),{status:"needsEnvVars",agentRef:s,agentName:l,missingVariables:f,pendingSignIns:[]}}catch(e){throw a({type:"ERROR",error:(0,es.toError)(e)}),e}},[e,n,r,t]),c=(0,s.useCallback)(async(e,t,s)=>{let n={mode:"saved",instanceId:t},r=s??e.slug;return a({type:"RESOLVE_READY",agentRef:e,agentName:r,resolution:n}),{status:"ready",agentRef:e,agentName:r,resolution:n}},[]),u="needsEnvVars"===i.status?i.missingVariables:null;(0,s.useEffect)(()=>{if(!t||0===t.size||!u)return;let e=u.filter(e=>!t.has(e.key));e.length!==u.length&&a({type:"POOL_RESOLVE",missingVariables:e})},[t,u]);let d=(0,s.useCallback)(async(t,s)=>{if("needsEnvVars"!==i.status)throw Error(`useAgentSetup: submitEnvVars requires state.status === 'needsEnvVars'. Current status is '${i.status}'. Call resolveAgent() first and ensure it returned status 'needsEnvVars'.`);if(!e)throw Error("useAgentSetup: cannot submit env vars when org is null.");if(i.pendingSignIns.length>0)throw Error(`useAgentSetup: submitEnvVars requires every pending sign-in to have completed. Still pending: ${i.pendingSignIns.map(e=>e.name).join(", ")}. Call signInCompleted(id) as each lands; the agent is resolved again when the last one does.`);let{agentRef:o,agentId:l,agentName:g}=i;if(!(s?.saveForFuture??!0)){let e={mode:"oneTime",runtimeEnv:t};return a({type:"SUBMIT_READY",agentRef:o,agentName:g,resolution:e}),{status:"ready",agentRef:o,agentName:g,resolution:e}}a({type:"SUBMIT_START"});try{let s=await r.getOrCreate();await r.addVariables(t);let i={org:e,slug:s.metadata.slug,kind:ee.ApiResourceKind.environment},c=`${o.org}/${o.slug}`,u=await eu(n,{org:e,agentId:l,agentSlug:o.slug,agentLabel:c,environmentRef:i}),d={mode:"saved",instanceId:u.metadata.id};return a({type:"SUBMIT_READY",agentRef:o,agentName:g,resolution:d}),{status:"ready",agentRef:o,agentName:g,resolution:d}}catch(e){throw a({type:"ERROR",error:(0,es.toError)(e)}),e}},[e,n,r,i]),m=(0,s.useCallback)(async e=>{if("needsEnvVars"!==i.status)return;let t=i.pendingSignIns.filter(t=>t.id!==e);if(t.length!==i.pendingSignIns.length&&(a({type:"SIGN_IN_COMPLETED",id:e}),0===t.length))try{await g(i.agentRef)}catch{}},[i,g]);return{state:i,resolveAgent:g,submitEnvVars:d,resolveToInstance:c,signInCompleted:m,clearError:o,reset:l}}(e1?P??null:null,tm),tp=function(e,t){let n=(0,et.useStigmer)(),r=(0,en.usePersonalEnvironment)(e),[i,a]=(0,s.useReducer)(ek,ey),o=(0,s.useRef)({}),l=(0,s.useRef)(i);l.current=i;let g=(0,s.useCallback)(async s=>{if(!e)throw Error("useMcpServerSetup: cannot add server when org is null.");let i=ej(s);a({type:"ADD_SERVER",key:i});try{let o,l=await n.mcpServer.getByReference(s),g=l.status?.discoveredCapabilities?.tools??[],c=l.spec?.pinnedToolApprovals??[],u=l.spec?.env;if(!u||0===Object.keys(u).length)return void a({type:"RESOLVE_READY",key:i,mcpServer:l,discoveredTools:g,toolApprovals:c,enabledTools:ew(l,g)});let d=new Set(Object.keys(r.environment?.spec?.data??{})),m=l.spec?.auth;if(m?.targetEnvVar&&l.metadata?.id)try{let t=await n.mcpServer.getOAuthGrantStatus((0,J.create)(Q.GetOAuthGrantStatusInputSchema,{resourceId:l.metadata.id,org:e}));o=t.connectionHealth,t.connected&&d.add(m.targetEnvVar)}catch{}let h=(0,ei.diffEnv)(u,d,t).filter(e=>!e.optional);if(0===h.length)return void a({type:"RESOLVE_READY",key:i,mcpServer:l,discoveredTools:g,toolApprovals:c,enabledTools:ew(l,g),oauthConnectionHealth:o});a({type:"RESOLVE_NEEDS_SETUP",key:i,mcpServer:l,missingVariables:h,discoveredTools:g,toolApprovals:c,oauthConnectionHealth:o})}catch(e){a({type:"SET_ERROR",key:i,error:(0,es.toError)(e)})}},[e,n,r,t]),c=(0,s.useCallback)(e=>{a({type:"REMOVE_SERVER",key:ej(e)})},[]),u=(0,s.useCallback)(async(t,s,n)=>{if(!e)throw Error("useMcpServerSetup: cannot submit env vars when org is null.");let l=ej(t),g=i[l];if(!g||"needsSetup"!==g.status)throw Error(`useMcpServerSetup: submitEnvVars requires the server to be in 'needsSetup' status. Server '${l}' is ${g?`in '${g.status}' status`:"not selected"}. Call addServer() first and wait for it to resolve.`);let{mcpServer:c,discoveredTools:u}=g,d=ew(c,u),m=n?.saveForFuture??!0;if(a({type:"SUBMIT_START",key:l}),!m){Object.assign(o.current,s),a({type:"SUBMIT_DONE",key:l,enabledTools:d});return}try{await r.getOrCreate(),await r.addVariables(s),a({type:"SUBMIT_DONE",key:l,enabledTools:d})}catch(e){a({type:"SUBMIT_FAIL",key:l,error:(0,es.toError)(e)})}},[e,i,r]),d=(0,s.useCallback)((e,t)=>{a({type:"SET_ENABLED_TOOLS",key:ej(e),enabledTools:t})},[]),m=(0,s.useCallback)(e=>{a({type:"CLEAR_ERROR",key:ej(e)})},[]),h=(0,s.useCallback)(()=>{a({type:"RESET"}),o.current={}},[]);(0,s.useEffect)(()=>{if(!t||0===t.size)return;let e=new Set(Object.keys(r.environment?.spec?.data??{}));for(let[s,n]of Object.entries(l.current)){if("needsSetup"!==n.status)continue;let r=n.mcpServer.spec?.env;if(r)a({type:"POOL_RESOLVE",key:s,missingVariables:(0,ei.diffEnv)(r,e,t).filter(e=>!e.optional),enabledTools:ew(n.mcpServer,n.discoveredTools)})}},[t,r.environment]);let p=(0,s.useMemo)(()=>{let e=Object.values(i);return 0===e.length||e.every(e=>"ready"===e.status)},[i]),f=(0,s.useMemo)(()=>Object.values(i).filter(e=>"needsSetup"===e.status).length,[i]),x=(0,s.useMemo)(()=>{let e=[];for(let[t,s]of Object.entries(i)){if("ready"!==s.status)continue;let n=s.discoveredTools.map(e=>e.name),r=0===n.length||s.enabledTools.length===n.length&&s.enabledTools.every(e=>n.includes(e)),i=t.indexOf("/");e.push({mcpServerRef:{org:t.slice(0,i),slug:t.slice(i+1),kind:ee.ApiResourceKind.mcp_server},enabledTools:r?void 0:[...s.enabledTools]})}return e},[i]);return{entries:i,addServer:g,removeServer:c,submitEnvVars:u,setEnabledTools:d,clearError:m,reset:h,allReady:p,needsSetupCount:f,pendingRuntimeEnv:o.current,usageInputs:x}}(e6?P??null:null,tm);(0,s.useEffect)(()=>{"ready"===th.state.status&&(F?.(th.state.agentRef),q?.(th.state.resolution))},[th.state,F,q]),(0,s.useEffect)(()=>{er?.(th.state.error??null)},[th.state.error,er]);let tf=function(e){let t=(0,et.useStigmer)(),[n,r]=(0,s.useState)([]),i=(0,s.useRef)(new Map),a=(0,s.useRef)(n);a.current=n;let o=(0,s.useCallback)(async(e,s,n)=>{let a=new AbortController;i.current.set(e,a);try{let i=new Uint8Array(await s.arrayBuffer());if(a.signal.aborted)return;let o=await t.agentExecution.uploadAttachment((0,J.create)(eL.UploadAttachmentRequestSchema,{filename:s.name,content:i,contentType:n}));if(a.signal.aborted)return;r(t=>t.map(t=>t.id===e?{...t,phase:"ready",storageKey:o.storageKey,error:null}:t))}catch(s){if(a.signal.aborted)return;let t=(0,es.toError)(s).message;r(s=>s.map(s=>s.id===e?{...s,phase:"error",error:t}:s))}finally{i.current.delete(e)}},[t]),l=(0,s.useCallback)(async(t,s)=>{let n=new AbortController;i.current.set(t,n);let l=await eD(s);if(n.signal.aborted)return;i.current.delete(t);let g=(0,U.validateAttachmentSize)(l);if(g){r(e=>e.filter(e=>e.id!==t)),e?.onValidationError?.(g);return}let c=new Set(a.current.filter(e=>e.id!==t).map(e=>e.file.name)),u=(0,U.uniquifyFilename)(l.name,c),d=u===l.name?l:new File([l],u,{type:l.type,lastModified:l.lastModified}),m=(0,U.detectContentType)(d);r(e=>e.map(e=>e.id===t?{...e,file:d,contentType:m,phase:"uploading"}:e)),o(t,d,m)},[e,o]),g=(0,s.useCallback)((t,s)=>{let n=Array.from(t),i=[],g=new Set(a.current.map(e=>e.file.name));for(let t of n){if(s?.prepareImages){let e=e$();i.push({id:e,file:t,phase:"preparing",contentType:(0,U.detectContentType)(t),storageKey:null,error:null}),l(e,t);continue}let n=(0,U.validateAttachmentSize)(t);if(n){e?.onValidationError?.(n);continue}let r=(0,U.uniquifyFilename)(t.name,g);g.add(r);let a=r===t.name?t:new File([t],r,{type:t.type,lastModified:t.lastModified}),c=e$(),u=(0,U.detectContentType)(a);i.push({id:c,file:a,phase:"uploading",contentType:u,storageKey:null,error:null}),o(c,a,u)}i.length>0&&(a.current=[...a.current,...i],r(e=>[...e,...i]))},[e,o,l]),c=(0,s.useCallback)(e=>{let t=i.current.get(e);t&&(t.abort(),i.current.delete(e)),r(t=>t.filter(t=>t.id!==e))},[]),u=(0,s.useCallback)(e=>{r(t=>{let s=t.find(t=>t.id===e);return s&&"error"===s.phase?(o(e,s.file,s.contentType),t.map(t=>t.id===e?{...t,phase:"uploading",error:null}:t)):t})},[o]),d=(0,s.useCallback)(()=>{for(let e of i.current.values())e.abort();i.current.clear(),r([])},[]),m=(0,s.useCallback)(()=>n.filter(e=>"ready"===e.phase&&null!==e.storageKey).map(e=>({filename:e.file.name,storageKey:e.storageKey,contentType:e.contentType})),[n]),h=n.some(e=>"preparing"===e.phase),p=n.some(e=>"preparing"===e.phase||"uploading"===e.phase),f=n.filter(e=>"ready"===e.phase).length,x=n.length>0,v=x&&f===n.length;return{entries:n,isUploading:p,isPreparing:h,readyCount:f,allReady:v,hasEntries:x,addFiles:g,removeEntry:c,retryEntry:u,clear:d,toAttachmentInputs:m}}(eC?{onValidationError:eA}:void 0),{getByKey:tx,getModel:tv,visionLimits:tb,isLoading:tj}=(0,V.useModelRegistry)(),{defaultModel:ty}=(0,V.useModelRegistry)({harness:eG}),tk=(0,s.useMemo)(()=>{let e=e_?tx(e_)??tv(e_):void 0,t=e_,s=e;R&&!tj&&void 0===e&&(t=ty?.modelId??e_,s=ty);let n="fast"===eH&&s?.serviceTiers.includes(B.FAST_SERVICE_TIER)?"fast":"standard",r=void 0!==s&&((0,$.thinkingLocked)(s)||"enabled"===eq&&(0,$.thinkingSelectable)(s))?"enabled":"disabled";return{modelId:t,model:s,serviceTier:n,thinkingMode:r}},[e_,eH,eq,R,tj,tx,tv,ty]),tw=(0,s.useMemo)(()=>eC&&0!==tf.entries.length?function(e,t){if(0===e.warnings.length)return null;if(e.modelCannotSeeImages){let e=t?.modelDisplayName??"The selected model";return`${e} can't view images — attached images will reach the agent as files only.`}let s=e.warnings.filter(e=>"too_large"===e.reason),n=e.warnings.filter(e=>"budget_exhausted"===e.reason),r=[];if(s.length>0){let e=t?.limits?`the ${(0,U.formatFileSize)(t.limits.maxImageBytes)} inline-image limit`:"the inline-image size limit";if(1===s.length){let t=s[0];r.push(`${t.name} (${(0,U.formatFileSize)(t.sizeBytes)}) exceeds ${e} and will reach the agent as a file, not an image`)}else 2===s.length?r.push(`${s[0].name} and ${s[1].name} exceed ${e} and will reach the agent as files, not images`):r.push(`${s.length} images exceed ${e} and will reach the agent as files, not images`)}if(n.length>0){let e=t?.limits?`this turn's inline-image budget (${t.limits.maxImages} images, ${(0,U.formatFileSize)(t.limits.maxTotalBytes)} total)`:"this turn's inline-image budget";r.push(1===n.length?`${n[0].name} is over ${e} and will reach the agent as a file`:`${n.length} images are over ${e} and will reach the agent as files`)}return 0===r.length?null:`${r.join("; ")}.`}(function(e,t){let s=e.filter(e=>W.has(e.contentType.toLowerCase()));if(0===s.length)return z;if(t?.model?.visionCapability===!1)return{warnings:s.map(e=>({name:e.name,sizeBytes:e.sizeBytes,reason:"model_no_vision"})),modelCannotSeeImages:!0};let n=t?.limits;if(!n)return z;let r=[],i=0,a=0;for(let e of s){if(e.sizeBytes>n.maxImageBytes){r.push({name:e.name,sizeBytes:e.sizeBytes,reason:"too_large"});continue}if(i>=n.maxImages||a+e.sizeBytes>n.maxTotalBytes){r.push({name:e.name,sizeBytes:e.sizeBytes,reason:"budget_exhausted"});continue}i+=1,a+=e.sizeBytes}return 0===r.length?z:{warnings:r,modelCannotSeeImages:!1}}(tf.entries.filter(e=>"preparing"!==e.phase).map(e=>({name:e.file.name,sizeBytes:e.file.size,contentType:e.contentType})),{model:tk.model,limits:tb}),{limits:tb,modelDisplayName:tk.model?.displayName}):null,[eC,tf.entries,tk.model,tb]),tS=function(){let[e,t]=(0,s.useState)([]),n=(0,s.useCallback)(e=>{t(t=>t.includes(e)?t:[...t,e])},[]),r=(0,s.useCallback)(e=>{t(t=>{let s=t.filter(t=>t!==e);return s.length===t.length?t:s})},[]),i=(0,s.useCallback)(()=>{t(e=>0===e.length?e:[])},[]);return(0,s.useMemo)(()=>({refs:e,hasRefs:e.length>0,add:n,remove:r,clear:i}),[e,n,r,i])}(),tN=(0,s.useRef)(null),[tC,tE]=(0,s.useState)(!1),[tR,tA]=(0,s.useState)(!1),tT=(0,s.useCallback)(e=>{e.target.files&&e.target.files.length>0&&tf.addFiles(e.target.files),tN.current&&(tN.current.value="")},[tf]),tM=(0,s.useCallback)(e=>{if(e.dataTransfer.types.includes(e9.FILE_REF_MIME)&&eR&&!eQ){e.preventDefault(),e.stopPropagation(),tA(!0),tE(!0);return}eC&&!eQ&&(e.preventDefault(),e.stopPropagation(),tA(!1),tE(!0))},[eC,eR,eQ]),tI=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),tE(!1),tA(!1)},[]),tL=(0,s.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),tE(!1),tA(!1),eQ)return;let t=e.dataTransfer.getData(e9.FILE_REF_MIME);if(t&&eR){try{let{path:e}=JSON.parse(t);e&&tS.add(e)}catch{}return}eC&&e.dataTransfer.files.length>0&&tf.addFiles(e.dataTransfer.files)},[eC,eR,eQ,tf,tS]),tP=(0,s.useCallback)(e=>{let t;if(!eC||eQ)return;let s=(t=e.clipboardData?.files)&&0!==t.length?Array.from(t).map(e=>{var t,s;let n,r,i;return e.type.toLowerCase().startsWith("image/")&&(""===e.name||e5.test(e.name))?new File([e],(t=e.type,s=new Date,n=e=>String(e).padStart(2,"0"),r=`${n(s.getHours())}${n(s.getMinutes())}${n(s.getSeconds())}`,i=e2[t.toLowerCase()]??"png",e4+=1,`pasted-image-${r}-${e4}.${i}`),{type:e.type,lastModified:e.lastModified}):e}):[];0===s.length||(e.preventDefault(),(0,tf.addFiles)(s,{prepareImages:!0}))},[eC,eQ,tf.addFiles]),tO=(0,s.useCallback)(async(t,s)=>{if(eN?.hasSaveForFutureEntries){let e=eN.toSaveForFutureEnv();if(Object.keys(e).length>0)try{await tg.getOrCreate(),await tg.addVariables(e)}catch{}}let n={};Object.assign(n,await (0,te.resolveSystemEnvVarValues)(tu)),"ready"===th.state.status&&"oneTime"===th.state.resolution.mode&&Object.assign(n,th.state.resolution.runtimeEnv);let r=tp.pendingRuntimeEnv;Object.keys(r).length>0&&Object.assign(n,r),eN&&eN.hasValidEntries&&Object.assign(n,eN.toRuntimeEnv());let i=[...eC?tf.toAttachmentInputs():[],...s?.attachments??[]],a=Object.keys(n).length>0,o=i.length>0,l=s?.interactionMode??(N&&w?w:void 0),g=eR&&tS.hasRefs,c=s?.buildFromPlan,u="fast"===tk.serviceTier?tk.serviceTier:void 0,d="enabled"===tk.thinkingMode?tk.thinkingMode:void 0,m=a||o||l||g||c||u||d?{runtimeEnv:a?n:void 0,attachments:o?i:void 0,interactionMode:l,serviceTier:u,thinkingMode:d,workspaceFileRefs:g?[...tS.refs]:void 0,buildFromPlan:c}:void 0;e(t,tk.modelId?(0,_.parseModelKey)(tk.modelId)?.modelId??tk.modelId:void 0,m),eC&&tf.clear(),eR&&tS.clear()},[e,tk,tu,th.state,tp.pendingRuntimeEnv,eN,eC,tf,tg,N,w]),tF=(0,i.useComposer)({onSubmit:tO,disabled:eQ});(0,s.useImperativeHandle)(eB,()=>({setMessage:tF.setMessage,focus:()=>tF.textareaRef.current?.focus(),submit:(e,t)=>{let s=e.trim();s&&!eQ&&tO(s,t)}}),[tF.setMessage,tF.textareaRef,tO,eQ]);let tD=(0,s.useCallback)(e=>{ez(e),E?.(e)},[E]),tB=(0,s.useCallback)(e=>{eX(e),x?.(e)},[x]),t$=(0,s.useCallback)(e=>{S?.(e)},[S]),t_=(0,s.useCallback)((e,t)=>{eZ(s=>{let n=new Map(s);return n.set(e,t),n})},[]),tV="needsEnvVars"===th.state.status,tU="resolving"===th.state.status||"submitting"===th.state.status,tW=(0,s.useCallback)(e=>{ti(e),e||(tl.current=void 0,"agent"===ta&&"needsEnvVars"!==th.state.status&&"submitting"!==th.state.status&&th.reset())},[ta,th]),tz=(0,s.useCallback)(e=>{"agent"===ta&&"agent"!==e&&"needsEnvVars"!==th.state.status&&"submitting"!==th.state.status&&th.reset(),to(e)},[ta,th]),tH=(0,s.useCallback)(async e=>{if(!e){F?.(null),q?.(null);return}try{let t=await th.resolveAgent(e);"ready"===t.status&&(F?.(t.agentRef),q?.(t.resolution),t_(`${t.agentRef.org}/${t.agentRef.slug}`,t.agentName),ti(!1))}catch{}},[th,F,q,t_]),tK=(0,s.useCallback)(async(e,t)=>{try{let s=await th.resolveToInstance(e,t);F?.(s.agentRef),q?.(s.resolution),t_(`${s.agentRef.org}/${s.agentRef.slug}`,s.agentName),ti(!1)}catch{}},[th,F,q,t_]),tq=(0,s.useCallback)(async(e,{saveForFuture:t})=>{try{let s=await th.submitEnvVars(e,{saveForFuture:t});F?.(s.agentRef),q?.(s.resolution),t_(`${s.agentRef.org}/${s.agentRef.slug}`,s.agentName),ti(!1)}catch{}},[th,F,q,t_]),tY=(0,s.useRef)(tH);tY.current=tH;let tG=(0,s.useRef)(tK);tG.current=tK;let tX=(0,s.useRef)(!1);(0,s.useEffect)(()=>{if(!ed||!e1||!P||tX.current)return;let e=!1;return tX.current=!0,(em?tG.current(ed,em):tY.current(ed)).catch(()=>{e||(tX.current=!1)}),()=>{e=!0}},[ed,em,e1,P]);let tJ=(0,s.useRef)(!1);(0,s.useEffect)(()=>{tJ.current||!ed||"needsEnvVars"===th.state.status&&(tJ.current=!0,ti(!0),to("agent"))},[ed,th.state.status]);let tZ=(0,s.useRef)(!1);(0,s.useEffect)(()=>{eT&&eT.length>0&&eC&&!tZ.current&&(tZ.current=!0,tf.addFiles(eT))},[eT,eC,tf]);let tQ=(0,s.useRef)(!1),t0=(0,s.useRef)(tp.addServer);t0.current=tp.addServer;let t1=(0,s.useRef)(tp.setEnabledTools);t1.current=tp.setEnabledTools,(0,s.useEffect)(()=>{if(e6&&!tQ.current&&ep?.length)for(let e of(tQ.current=!0,ep)){let t=e.mcpServerRef;if(!t)continue;let s=e.enabledTools;t0.current(t).then(()=>{s?.length&&t1.current(t,s)}).catch(()=>{})}},[e6,ep]);let t5=(0,s.useMemo)(()=>Object.values(tp.entries).some(e=>"loading"===e.status),[tp.entries]);(0,s.useEffect)(()=>{e6&&!t5&&ef?.(tp.usageInputs)},[e6,tp.usageInputs,ef,t5]);let t2=e6&&!tp.allReady,t4=eC&&tf.isUploading,t3=tF.canSubmit&&!t2&&!t4,t6=tF.canSubmit&&!t2&&t4,[t8,t7]=(0,s.useState)(!1);(0,s.useEffect)(()=>{t4||t7(!1)},[t4]);let t9=(0,s.useCallback)(e=>{if(d&&m&&"Escape"===e.key){e.preventDefault(),m();return}if(!t3&&"Enter"===e.key&&!e.shiftKey){e.preventDefault(),t6&&t7(!0);return}tF.textareaProps.onKeyDown(e)},[t3,t6,tF.textareaProps,d,m]),se=A?.entries.length??0,st=(0,s.useMemo)(()=>{if(!(se>0)&&I&&!M&&L)return async()=>{let e=await L();e&&A?.addLocalPath(e)}},[se,I,M,L,A]),ss=(0,s.useMemo)(()=>se>0?null:M&&!I?"github":null,[se,M,I]),sn=e6?Object.keys(tp.entries).length:0,sr=ex?.length??0,si=eN?.entries.length??0,sa=(0,s.useMemo)(()=>{let e={};if("needsEnvVars"===th.state.status){let t=th.state.agentName;for(let s of th.state.missingVariables)(e[s.key]??=[]).push(t)}if(e6)for(let t of Object.values(tp.entries)){if("needsSetup"!==t.status)continue;let s=t.mcpServer.metadata?.name??"MCP Server";for(let n of t.missingVariables)(e[n.key]??=[]).push(s)}return e},[th.state,e6,tp.entries]),so=(0,s.useMemo)(()=>{let e=[];if(e1){let s=!O&&("needsEnvVars"===th.state.status||"resolving"===th.state.status||"submitting"===th.state.status);(!eh||s)&&e.push({id:"agent",icon:(0,t.jsx)(f,{}),label:"Agent",count:O||s?1:0,hasWarning:s&&"needsEnvVars"===th.state.status})}return e6&&e.push({id:"mcp",icon:(0,t.jsx)(v,{}),label:"MCP Servers",count:sn,hasWarning:tp.needsSetupCount>0}),e7&&e.push({id:"skills",icon:(0,t.jsx)(b,{}),label:"Skills",count:sr}),ts&&e.push({id:"sessionVars",icon:(0,t.jsx)(j,{}),label:"Session Variables",count:si}),e},[e1,eh,O,th.state,e6,sn,tp.needsSetupCount,e7,sr,ts,si]),sl=(0,s.useCallback)(e=>{switch(e){case"agent":return tV&&"needsEnvVars"===th.state.status?(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-3",children:[th.state.pendingSignIns.length>0&&(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-2",children:[(0,t.jsxs)("p",{className:"stg:text-sm stg:text-foreground",children:[th.state.agentName," uses tools nobody in this organization has signed in to yet."]}),(0,t.jsx)("ul",{className:(0,n.cn)(X.UNSTYLED_LIST,"stg:flex stg:flex-col stg:divide-y stg:divide-border stg:rounded-md stg:border stg:border-border"),"aria-label":"Sign-ins this agent needs",children:th.state.pendingSignIns.map(e=>(0,t.jsxs)("li",{className:"stg:flex stg:items-center stg:justify-between stg:gap-3 stg:px-3 stg:py-2",children:[(0,t.jsx)("span",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:e.name}),(0,t.jsx)(G.McpServerReadiness,{org:e.ref.org,slug:e.ref.slug,keysAskedAt:"agent",onSignedIn:e=>{th.signInCompleted(e)}})]},e.id))})]}),0===th.state.pendingSignIns.length&&th.state.missingVariables.length>0&&(0,t.jsx)(Y,{agentName:th.state.agentName,variables:th.state.missingVariables,onSubmit:tq,onCancel:()=>th.reset(),isSubmitting:tU,disabled:eQ,poolValues:td.getAvailableValue}),th.state.error&&(0,t.jsx)(tr,{error:th.state.error})]}):(0,t.jsxs)("div",{className:"stg:relative",children:[(0,t.jsx)(K.AgentPicker,{org:P,value:O??null,onChange:tH,onDisplayNameResolved:t_,disabled:eQ||tU}),tU&&(0,t.jsx)("div",{className:"stg:absolute stg:inset-0 stg:flex stg:items-center stg:justify-center stg:rounded-lg stg:bg-popover/80",children:(0,t.jsx)(k,{})}),th.state.error&&(0,t.jsx)(tr,{error:th.state.error})]});case"mcp":return(0,t.jsx)(eb.McpServerPicker,{org:P,setup:{entries:tp.entries,onServerAdded:e=>tp.addServer(e),onServerRemoved:e=>tp.removeServer(e),onSubmitEnvVars:(e,t,s)=>tp.submitEnvVars(e,t,{saveForFuture:s.saveForFuture}),onEnabledToolsChange:(e,t)=>tp.setEnabledTools(e,t)},initialServerKey:tl.current,onDisplayNameResolved:t_,disabled:eQ,poolValues:td.getAvailableValue});case"skills":return(0,t.jsx)(eS.SkillPicker,{org:P,value:ex??[],onChange:ev,onDisplayNameResolved:t_,disabled:eQ});case"sessionVars":return(0,t.jsx)(eE,{sessionVariables:eN,disabled:eQ,requiredByMap:sa});default:return null}},[tV,th,tU,eQ,P,O,tH,tq,t_,tp,ex,ev,eN,td,sa]);return(0,t.jsx)("div",{role:"form","aria-label":eO,className:(0,n.cn)("stg:shrink-0",eF),children:(0,t.jsxs)("div",{className:(0,n.cn)("stg:rounded-xl stg:border stg:border-border stg:bg-card stg:shadow-sm","stg:focus-within:ring-2 stg:focus-within:ring-ring","plan"===w&&"stg:border-primary-muted",eQ&&!e0&&"stg:opacity-50",tC&&"stg:ring-2 stg:ring-primary/50"),onDragOver:tM,onDragLeave:tI,onDrop:tL,children:[d&&(0,t.jsxs)("div",{role:"status",className:"stg:flex stg:items-center stg:justify-between stg:gap-2 stg:rounded-t-xl stg:border-b stg:border-border stg:bg-muted stg:px-3 stg:py-1.5",children:[(0,t.jsx)("span",{className:"stg:text-xs stg:font-medium stg:text-muted-foreground",children:"Editing message"}),m&&(0,t.jsxs)(a.Tooltip,{children:[(0,t.jsx)(a.TooltipTrigger,{render:(0,t.jsx)("button",{type:"button",onClick:m,"aria-label":"Cancel editing",className:"stg:rounded stg:p-0.5 stg:text-muted-foreground stg:transition-colors stg:hover:bg-accent stg:hover:text-foreground stg:focus-visible:outline-none stg:focus-visible:ring-1 stg:focus-visible:ring-ring"}),children:(0,t.jsx)(h,{})}),(0,t.jsx)(a.TooltipContent,{side:"top",children:"Cancel editing (Esc)"})]})]}),(0,t.jsxs)("div",{className:"stg:relative",children:[(0,t.jsx)("textarea",{...tF.textareaProps,onKeyDown:t9,onPaste:tP,placeholder:eM,rows:eI,autoFocus:eP,className:"stg:block stg:w-full stg:resize-none stg:bg-transparent stg:px-4 stg:pt-3 stg:pb-2 stg:text-sm stg:text-foreground stg:placeholder:text-muted-foreground stg:focus:outline-none stg:disabled:cursor-not-allowed"}),tC&&(0,t.jsx)("div",{className:"stg:pointer-events-none stg:absolute stg:inset-0 stg:flex stg:items-center stg:justify-center stg:rounded-t-xl stg:bg-primary-subtle",children:(0,t.jsx)("span",{className:"stg:text-xs stg:font-medium stg:text-primary",children:tR?"Reference workspace file":"Drop files to attach"})})]}),eC&&(0,t.jsx)("input",{ref:tN,type:"file",multiple:!0,onChange:tT,className:"stg:hidden","aria-hidden":"true",tabIndex:-1}),eC&&tf.hasEntries||eR&&tS.hasRefs?(0,t.jsxs)("div",{className:"stg:space-y-1.5 stg:px-3 stg:pb-2",children:[eC&&tf.hasEntries&&(0,t.jsx)(eW,{entries:tf.entries,onRemove:tf.removeEntry,onRetry:tf.retryEntry,disabled:eQ}),eR&&tS.hasRefs&&(0,t.jsx)(e3,{refs:tS.refs,onRemove:tS.remove,disabled:eQ})]}):null,t8&&(0,t.jsxs)("div",{role:"status",className:"stg:mx-3 stg:mb-2 stg:flex stg:items-center stg:gap-2 stg:rounded-md stg:bg-muted stg:px-2.5 stg:py-1.5 stg:text-xs stg:text-muted-foreground",children:[(0,t.jsx)(c,{}),(0,t.jsx)("span",{children:tf.isPreparing?"Waiting for attachments to finish preparing…":"Waiting for attachments to finish uploading…"})]}),tw&&(0,t.jsxs)("div",{role:"status",className:"stg:mx-3 stg:mb-2 stg:flex stg:items-center stg:gap-2 stg:rounded-md stg:bg-warning/10 stg:px-2.5 stg:py-1.5 stg:text-xs stg:text-warning",children:[(0,t.jsx)(u,{}),(0,t.jsx)("span",{children:tw})]}),e1&&"needsEnvVars"===th.state.status&&!O&&(0,t.jsxs)("div",{role:"status",className:"stg:mx-3 stg:mb-2 stg:flex stg:items-center stg:gap-2 stg:rounded-md stg:bg-warning/10 stg:px-2.5 stg:py-1.5 stg:text-xs stg:text-warning",children:[(0,t.jsx)(u,{}),(0,t.jsx)("span",{children:"Agent needs configuration before use"}),(0,t.jsx)("button",{type:"button",onClick:()=>{ti(!0),to("agent")},disabled:eQ,className:"stg:ml-auto stg:shrink-0 stg:rounded stg:px-1.5 stg:py-0.5 stg:text-[0.6rem] stg:font-medium stg:hover:bg-warning/20 stg:disabled:pointer-events-none stg:disabled:opacity-50",children:"Configure"})]}),e6&&tp.needsSetupCount>0&&(0,t.jsxs)("div",{role:"status",className:"stg:mx-3 stg:mb-2 stg:flex stg:items-center stg:gap-2 stg:rounded-md stg:bg-warning/10 stg:px-2.5 stg:py-1.5 stg:text-xs stg:text-warning",children:[(0,t.jsx)(u,{}),(0,t.jsx)("span",{children:1===tp.needsSetupCount?"1 MCP server needs configuration":`${tp.needsSetupCount} MCP servers need configuration`}),(0,t.jsx)("button",{type:"button",onClick:()=>{1===tp.needsSetupCount?tl.current=Object.entries(tp.entries).find(([,e])=>"needsSetup"===e.status)?.[0]:tl.current=void 0,ti(!0),to("mcp")},disabled:eQ,className:"stg:ml-auto stg:shrink-0 stg:rounded stg:px-1.5 stg:py-0.5 stg:text-[0.6rem] stg:font-medium stg:hover:bg-warning/20 stg:disabled:pointer-events-none stg:disabled:opacity-50",children:"Configure"})]}),(0,t.jsx)(D,{disabled:eQ,isSubmitting:r,canSend:t3,onSend:tF.submit,onStop:l,isStopping:g,showWorkspace:e8,workspaceCount:se,onWorkspaceDirectAction:st,workspaceContent:A?(0,t.jsx)(H.WorkspaceEditor,{workspace:A,disabled:eQ,gitHubConnection:T,enableGitHub:M,enableLocal:I,onBrowseLocalFolder:L,initialPanel:ss}):null,showAttach:eC,attachmentCount:tf.entries.length,onAttachClick:()=>tN.current?.click(),configureItems:so,configOpen:tn,onConfigOpenChange:tW,configActivePanel:ta,onConfigActivePanelChange:tz,renderConfigPanel:sl,showHarnessSelector:y,harness:p,onHarnessChange:tB,showInteractionModePicker:N,interactionMode:w,onInteractionModeChange:t$,showModelSelector:R,modelId:tk.modelId,onModelChange:tD,serviceTier:eH,onServiceTierChange:eK,thinkingMode:eq,onThinkingModeChange:eY})]})})}),tn=(0,s.memo)(ts);function tr({error:e}){return ex(e)?(0,t.jsx)(ef,{error:e,className:"stg:mt-2"}):(0,t.jsx)("p",{className:"stg:mt-2 stg:text-xs stg:text-destructive",children:(0,r.getUserMessage)(e)})}function ti(e,t,s,n){if(e)try{let t=localStorage.getItem(e);if(t){let e=Number(t);if(Number.isFinite(e)&&e>=s&&e<=n)return e}}catch{}return t}function ta({primary:e,secondary:r,resizablePane:i="secondary",defaultSize:a=384,minSize:o=280,maxSize:l=800,storageKey:g,responsiveCollapse:c="none",collapsedPane:u="none",ariaLabel:d="Resize panel",onResize:m,className:h}){let p="primary"===i,f="none"!==u,[x,v]=(0,s.useState)(()=>ti(g,a,o,l)),[b,j]=(0,s.useState)(g),[y,k]=(0,s.useState)(i);(g!==b||i!==y)&&(j(g),k(i),v(ti(g,a,o,l)));let w=(0,s.useRef)(null),S=(0,s.useRef)(0),N=(0,s.useRef)(!1),C=(0,s.useRef)(m);C.current=m,(0,s.useEffect)(()=>{C.current?.(x)},[x]);let E=(0,s.useCallback)(e=>Math.round(Math.max(o,Math.min(l,e))),[o,l]),R=(0,s.useCallback)(e=>{if(g)try{localStorage.setItem(g,String(e))}catch{}},[g]),A=(0,s.useCallback)(e=>{e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),N.current=!0},[]),T=(0,s.useCallback)(e=>{if(!N.current||!w.current)return;let t=e.clientX;cancelAnimationFrame(S.current),S.current=requestAnimationFrame(()=>{let e=w.current;if(!e)return;let s=e.getBoundingClientRect();v(E(p?t-s.left:s.right-t))})},[E,p]),M=(0,s.useCallback)(e=>{N.current&&(N.current=!1,e.currentTarget.releasePointerCapture(e.pointerId),cancelAnimationFrame(S.current),R(x))},[R,x]),I=(0,s.useCallback)(e=>{let t=0;"ArrowLeft"===e.key?t=p?-20:20:"ArrowRight"===e.key&&(t=p?20:-20),0!==t&&(e.preventDefault(),v(e=>{let s=E(e+t);return R(s),s}))},[E,R,p]);(0,s.useEffect)(()=>()=>cancelAnimationFrame(S.current),[]);let L="stg:shrink-0 stg:overflow-hidden",P="stg:min-w-0 stg:flex-1",O="primary"===u?"hidden":"secondary"!==u&&p?L:P,F="secondary"===u?"hidden":"primary"===u||p?P:L;return(0,t.jsxs)("div",{ref:w,className:(0,n.cn)("stg:flex stg:min-h-0 stg:flex-1","none"!==c&&"stg:@container/resizable-split",h),children:[(0,t.jsx)("div",{className:(0,n.cn)(O,"primary"===c&&"stg:@max-3xl/resizable-split:hidden"),style:p&&!f?{width:x}:void 0,children:e}),(0,t.jsx)("div",{role:"separator","aria-orientation":"vertical","aria-valuenow":x,"aria-valuemin":o,"aria-valuemax":l,"aria-label":d,"aria-hidden":f||void 0,tabIndex:f?-1:0,onPointerDown:A,onPointerMove:T,onPointerUp:M,onKeyDown:I,className:(0,n.cn)("stg:group stg:relative stg:z-10 stg:w-1 stg:shrink-0 stg:cursor-col-resize stg:touch-none stg:select-none","stg:bg-[var(--stgm-border,#e5e5e5)]","stg:hover:bg-[var(--stgm-primary,#6366f1)]","stg:focus-visible:bg-[var(--stgm-primary,#6366f1)] stg:focus-visible:outline-none","stg:active:bg-[var(--stgm-primary,#6366f1)]","stg:transition-colors stg:duration-100","none"!==c&&"stg:@max-3xl/resizable-split:hidden",f&&"stg:hidden"),children:(0,t.jsx)("div",{className:"stg:absolute stg:inset-y-0 stg:-left-1.5 stg:-right-1.5"})}),(0,t.jsx)("div",{className:(0,n.cn)(F,"secondary"===c&&"stg:@max-3xl/resizable-split:hidden"),style:p||f?void 0:{width:x},children:r})]})}function to({conversation:e,panel:s,chip:r,headerActions:i,splitStorageKey:a,responsive:o=!0,resizeAriaLabel:l="Resize chat panel",className:g}){let c=null!=s;return(0,t.jsxs)("div",{className:(0,n.cn)("stg:relative stg:flex stg:h-full stg:w-full stg:flex-col",g),children:[(null!=i||null!=r)&&(0,t.jsxs)("div",{className:"stg:absolute stg:top-2 stg:right-6 stg:z-10 stg:flex stg:items-center stg:gap-2",children:[i,r]}),(0,t.jsx)(ta,{resizablePane:"primary",collapsedPane:c?"none":"secondary",defaultSize:420,minSize:320,maxSize:640,storageKey:a,responsiveCollapse:o&&c?"primary":"none",ariaLabel:l,className:"stg:min-h-0 stg:flex-1",primary:e,secondary:s})]})}e.s(["ResizableSplit",0,ta],776526);var tl=e.i(796545),tg=e.i(503353),tc=e.i(469196);let tu=new Map;function td(e){return`${e.id}\u0000${e.readRef??e.gitBranch??""}`}async function tm(e,t,s={}){var n;let r,i,a;if(!s.bustCache){let t=tu.get(td(e));if(t)return t}let o=await t(e);if(null===o)return null;let l=(r=(n=o).some(e=>!0===e.notice),i=n.filter(e=>!e.notice),a=(0,tc.buildFileTree)(i.filter(e=>!e.isDirectory)),{files:i,tree:a,truncated:r});return tu.set(td(e),l),l}function th(e,t){return e.isBasenameHit!==t.isBasenameHit?e.isBasenameHit?-1:1:e.matchStart!==t.matchStart?e.matchStart-t.matchStart:e.path.length!==t.path.length?e.path.length-t.path.length:e.path.localeCompare(t.path)}let tp=[];function tf({entries:e,lister:r,onOpenFile:i,selectedFile:a,className:o}){let[l,g]=(0,s.useState)(""),[c,u]=(0,s.useState)(-1),d=(0,s.useRef)(null),m=(0,s.useId)(),h=(0,s.useCallback)(e=>`${m}-opt-${e}`,[m]),{groups:p,totalMatches:f,isLoading:x,isUnsupported:v}=function({entries:e,lister:t,query:n}){let[r,i]=(0,s.useState)({}),a=(0,s.useRef)(e);a.current=e;let o=e.map(e=>`${e.id}\u0001${e.readRef??""}`).join("\0"),l=(0,s.useRef)(0);return(0,s.useEffect)(()=>{if(!t)return void i({});let e=a.current,s=++l.current;for(let n of(i(t=>{let s={};for(let n of e)s[n.id]=t[n.id]??{status:"loading"};return s}),e))tm(n,t).then(e=>{l.current===s&&i(t=>({...t,[n.id]:null===e?{status:"unsupported"}:{status:"ready",listing:e}}))}).catch(e=>{l.current===s&&i(t=>({...t,[n.id]:{status:"error",error:(0,es.toError)(e)}}))})},[o,t]),(0,s.useMemo)(()=>{if(!t)return{groups:tp,totalMatches:0,isLoading:!1,isUnsupported:!0,error:null};let s=[],i=0,a=!1,o=null,l=0;for(let t of e){let e=r[t.id];if(!e||"loading"===e.status){a=!0;continue}if("unsupported"===e.status){l+=1;continue}let g="error"===e.status?e.error??null:null;g&&!o&&(o=g);let c=e.listing?.truncated??!1,u=e.listing?function(e,t){let s=t.trim();if(0===s.length)return[];let n=s.toLowerCase(),r=[];for(let t of e){if(t.isDirectory||t.notice)continue;let e=t.path.toLowerCase().indexOf(n);if(-1===e)continue;let s=t.path.lastIndexOf("/");r.push({path:t.path,matchStart:e,matchEnd:e+n.length,isBasenameHit:e>=s+1})}return r.sort(th),r.map(({path:e,matchStart:t,matchEnd:s})=>({path:e,matchStart:t,matchEnd:s}))}(e.listing.files,n):[];i+=u.length,(u.length>0||g||c)&&s.push({entry:t,matches:u,truncated:c,error:g})}return{groups:s,totalMatches:i,isLoading:a,isUnsupported:e.length>0&&l===e.length,error:o}},[e,r,n,t])}({entries:e,lister:r,query:l}),b=(0,s.useMemo)(()=>{let e=[];for(let t of p)for(let s of t.matches){if(e.length>=200)return e;e.push({entryId:t.entry.id,entry:t.entry,match:s})}return e},[p]);(0,s.useEffect)(()=>{u(-1)},[l]),(0,s.useEffect)(()=>{d.current?.focus()},[]),(0,s.useEffect)(()=>{if(c<0)return;let e="u">typeof document?document.getElementById(h(c)):null;e?.scrollIntoView?.({block:"nearest"})},[c,h]);let j=(0,s.useCallback)(e=>{if("ArrowDown"===e.key)e.preventDefault(),u(e=>e<b.length-1?e+1:e);else if("ArrowUp"===e.key)e.preventDefault(),u(e=>e>0?e-1:-1);else if("Enter"===e.key){e.preventDefault();let t=b[c];t&&i(t.entryId,t.match.path)}},[b,c,i]),y=l.trim(),k=p.length>1,w=v||0===y.length?"":x&&0===f&&0===p.length?"Searching files…":0===p.length?`No files matching ${y}.`:f>b.length?`Showing the first ${b.length} of ${f} matching files.`:`${b.length} matching ${1===b.length?"file":"files"}.`;return(0,t.jsxs)("div",{className:(0,n.cn)("stg:flex stg:h-full stg:flex-col",o),children:[(0,t.jsx)("div",{role:"status","aria-live":"polite",className:"stg:sr-only",children:w}),(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-1.5 stg:border-b stg:border-border stg:px-2 stg:py-1.5",children:[(0,t.jsx)(tk,{}),(0,t.jsx)("input",{ref:d,type:"text",role:"combobox","aria-expanded":!0,"aria-controls":m,"aria-activedescendant":c>=0?h(c):void 0,value:l,onChange:e=>g(e.target.value),onKeyDown:j,placeholder:"Search files by name…",disabled:v,className:(0,n.cn)("stg:min-w-0 stg:flex-1 stg:bg-transparent stg:text-xs stg:text-foreground","stg:placeholder:text-muted-foreground","stg:focus-visible:outline-none stg:disabled:cursor-not-allowed"),"aria-label":"Search workspace files by name"}),y.length>0&&(0,t.jsx)("button",{type:"button",onClick:()=>{g(""),d.current?.focus()},className:"stg:shrink-0 stg:text-muted-foreground stg:transition-colors stg:hover:text-foreground","aria-label":"Clear search",children:(0,t.jsx)(tw,{})})]}),(0,t.jsx)("div",{className:"stg:min-h-0 stg:flex-1 stg:overflow-y-auto",children:v?(0,t.jsx)(ty,{children:"File search isn’t available here."}):0===y.length?(0,t.jsx)(ty,{children:"Search files by name across the whole workspace."}):x&&0===f&&0===p.length?(0,t.jsx)(ty,{children:"Searching…"}):0===p.length?(0,t.jsxs)(ty,{children:["No files matching “",y,"”."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("ul",{id:m,role:"listbox","aria-label":"Search results",className:(0,n.cn)(X.UNSTYLED_LIST,"stg:py-0.5"),children:function({groups:e,showGroupHeaders:s,selectedFile:n,focusIndex:r,optionId:i,onOpenFile:a}){let o=[],l=0;for(let g of e){for(let e of(s&&o.push((0,t.jsx)(tb,{name:g.entry.name},`h:${g.entry.id}`)),g.matches)){if(l>=200)break;let s=l++,c=n?.entryId===g.entry.id&&n.path===e.path;o.push((0,t.jsx)(tx,{id:i(s),match:e,isFocused:s===r,isOpen:c,onOpen:()=>a(g.entry.id,e.path)},`${g.entry.id}:${e.path}`))}if(g.truncated&&o.push((0,t.jsx)(tj,{children:"Partial listing — too many files to search in full."},`t:${g.entry.id}`)),g.error&&o.push((0,t.jsxs)(tj,{isError:!0,children:["Couldn’t list files: ",g.error.message]},`e:${g.entry.id}`)),l>=200)break}return o}({groups:p,showGroupHeaders:k,selectedFile:a??null,focusIndex:c,optionId:h,onOpenFile:i})}),f>b.length&&(0,t.jsxs)("p",{className:"stg:border-t stg:border-border stg:px-3 stg:py-1.5 stg:text-[0.65rem] stg:text-muted-foreground",children:["Showing the first ",b.length," of ",f," matches — refine your search to narrow the list."]})]})})]})}function tx({id:e,match:s,isFocused:r,isOpen:i,onOpen:a}){let o=s.path.lastIndexOf("/"),l=s.path.slice(o+1),g=o>=0?s.path.slice(0,o):"";return(0,t.jsxs)("li",{id:e,role:"option","aria-selected":r,"aria-current":i?"true":void 0,onClick:a,className:(0,n.cn)("stg:flex stg:cursor-pointer stg:items-baseline stg:gap-1.5 stg:px-3 stg:py-1 stg:text-xs stg:transition-colors",r&&"stg:bg-muted",i&&"stg:bg-muted stg:font-medium stg:text-foreground",!r&&!i&&"stg:hover:bg-muted"),children:[(0,t.jsx)("span",{className:"stg:truncate stg:text-foreground",children:(0,t.jsx)(tv,{text:l,offset:o+1,matchStart:s.matchStart,matchEnd:s.matchEnd})}),g&&(0,t.jsx)("span",{className:"stg:truncate stg:text-[0.65rem] stg:text-muted-foreground",children:(0,t.jsx)(tv,{text:g,offset:0,matchStart:s.matchStart,matchEnd:s.matchEnd})})]})}function tv({text:e,offset:s,matchStart:n,matchEnd:r}){let i=Math.max(0,n-s),a=Math.min(e.length,r-s);return i>=a?(0,t.jsx)(t.Fragment,{children:e}):(0,t.jsxs)(t.Fragment,{children:[e.slice(0,i),(0,t.jsx)("span",{className:"stg:font-semibold stg:text-foreground",children:e.slice(i,a)}),e.slice(a)]})}function tb({name:e}){return(0,t.jsx)("li",{role:"presentation",className:"stg:truncate stg:px-3 stg:pb-0.5 stg:pt-2 stg:text-[0.6rem] stg:font-medium stg:uppercase stg:tracking-wide stg:text-muted-foreground",children:e})}function tj({children:e,isError:s}){return(0,t.jsx)("li",{role:"presentation",className:(0,n.cn)("stg:px-3 stg:py-1 stg:text-[0.65rem]",s?"stg:text-destructive":"stg:text-muted-foreground"),children:e})}function ty({children:e}){return(0,t.jsx)("div",{className:"stg:flex stg:h-full stg:items-center stg:justify-center stg:p-8 stg:text-center stg:text-xs stg:text-muted-foreground",children:e})}function tk(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0 stg:text-muted-foreground","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"5.25",cy:"5.25",r:"3.5"}),(0,t.jsx)("path",{d:"M7.75 7.75L10.5 10.5"})]})}function tw(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M3 3L9 9M9 3L3 9"})})}let tS=[];function tN({entries:e,searcher:r,onOpenFile:i,selectedFile:a,className:o}){let[l,g]=(0,s.useState)(""),[c,u]=(0,s.useState)(-1),d=(0,s.useRef)(null),m=(0,s.useId)(),h=(0,s.useCallback)(e=>`${m}-opt-${e}`,[m]),{groups:p,totalMatches:f,isLoading:x,isRefetching:v,isUnsupported:b}=function({entries:e,searcher:t,query:n,debounceMs:r=300,minLength:i=2}){let[a,o]=(0,s.useState)({}),[l,g]=(0,s.useState)(!1),[c,u]=(0,s.useState)(n);(0,s.useEffect)(()=>{let e=setTimeout(()=>u(n),r);return()=>clearTimeout(e)},[n,r]);let d=(0,s.useRef)(e);d.current=e;let m=e.map(e=>e.id).join("\0"),h=(0,s.useRef)(0),p=c.trim(),f=p.length<i;return(0,s.useEffect)(()=>{if(!t||f){h.current+=1,o({}),g(!1);return}let e=d.current,s=++h.current;g(!0),Promise.all(e.map(async e=>{try{let s=await t(e,p);if(null===s)return[e.id,{status:"unsupported"}];return[e.id,{status:"ready",matches:s.matches,truncated:s.truncated}]}catch(t){return[e.id,{status:"error",error:(0,es.toError)(t)}]}})).then(e=>{if(h.current!==s)return;let t={};for(let[s,n]of e)t[s]=n;o(t),g(!1)})},[m,t,p,f]),(0,s.useMemo)(()=>{if(!t)return{groups:tS,totalMatches:0,isLoading:!1,isRefetching:!1,isUnsupported:!0,error:null};let s=[],n=0,r=null,i=0,o=0;for(let t of e){let e=a[t.id];if(e){if(o+=1,"unsupported"===e.status){i+=1;continue}if("error"===e.status){r||(r=e.error),s.push({entry:t,matches:[],truncated:!1,error:e.error});continue}n+=e.matches.length,(e.matches.length>0||e.truncated)&&s.push({entry:t,matches:e.matches,truncated:e.truncated,error:null})}}let g=o>0;return{groups:s,totalMatches:n,isLoading:l&&!g,isRefetching:l&&g,isUnsupported:e.length>0&&i===e.length,error:r}},[e,a,l,t])}({entries:e,searcher:r,query:l,minLength:2}),j=(0,s.useMemo)(()=>{let e=[];for(let t of p)for(let s of t.matches){if(e.length>=200)return e;e.push({entryId:t.entry.id,match:s})}return e},[p]);(0,s.useEffect)(()=>{u(-1)},[l]),(0,s.useEffect)(()=>{d.current?.focus()},[]),(0,s.useEffect)(()=>{if(c<0)return;let e="u">typeof document?document.getElementById(h(c)):null;e?.scrollIntoView?.({block:"nearest"})},[c,h]);let y=(0,s.useCallback)(e=>{if("ArrowDown"===e.key)e.preventDefault(),u(e=>e<j.length-1?e+1:e);else if("ArrowUp"===e.key)e.preventDefault(),u(e=>e>0?e-1:-1);else if("Enter"===e.key){e.preventDefault();let t=j[c];t&&i(t.entryId,t.match.path,{line:t.match.line})}},[j,c,i]),k=l.trim(),w=k.length>0&&k.length<2,S=p.length>1,N=b||0===k.length?"":w?"Type at least 2 characters to search.":x?"Searching file contents…":0===p.length?`No files containing ${k}.`:f>j.length?`Showing the first ${j.length} of ${f} matches.`:`${f} ${1===f?"match":"matches"}.`;return(0,t.jsxs)("div",{className:(0,n.cn)("stg:flex stg:h-full stg:flex-col",o),children:[(0,t.jsx)("div",{role:"status","aria-live":"polite",className:"stg:sr-only",children:N}),(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-1.5 stg:border-b stg:border-border stg:px-2 stg:py-1.5",children:[(0,t.jsx)(tI,{}),(0,t.jsx)("input",{ref:d,type:"text",role:"combobox","aria-expanded":!0,"aria-controls":m,"aria-activedescendant":c>=0?h(c):void 0,value:l,onChange:e=>g(e.target.value),onKeyDown:y,placeholder:"Search text in files…",disabled:b,className:(0,n.cn)("stg:min-w-0 stg:flex-1 stg:bg-transparent stg:text-xs stg:text-foreground","stg:placeholder:text-muted-foreground","stg:focus-visible:outline-none stg:disabled:cursor-not-allowed"),"aria-label":"Search text in workspace files"}),v&&(0,t.jsx)(tP,{}),k.length>0&&(0,t.jsx)("button",{type:"button",onClick:()=>{g(""),d.current?.focus()},className:"stg:shrink-0 stg:text-muted-foreground stg:transition-colors stg:hover:text-foreground","aria-label":"Clear search",children:(0,t.jsx)(tL,{})})]}),(0,t.jsx)("div",{className:"stg:min-h-0 stg:flex-1 stg:overflow-y-auto",children:b?(0,t.jsx)(tM,{children:"Text search isn’t available here."}):0===k.length?(0,t.jsx)(tM,{children:"Search file contents across the whole workspace."}):w?(0,t.jsxs)(tM,{children:["Type at least ",2," characters to search."]}):x?(0,t.jsx)(tM,{children:"Searching…"}):0===p.length?(0,t.jsxs)(tM,{children:["No files containing “",k,"”."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("ul",{id:m,role:"listbox","aria-label":"Search results",className:(0,n.cn)(X.UNSTYLED_LIST,"stg:py-0.5"),children:function({groups:e,query:s,showEntryHeaders:n,selectedFile:r,focusIndex:i,optionId:a,onOpenFile:o}){let l=[],g=0;for(let c of e){n&&l.push((0,t.jsx)(tR,{name:c.entry.name},`entry:${c.entry.id}`));let e=null;for(let n of c.matches){if(g>=200)break;n.path!==e&&(e=n.path,l.push((0,t.jsx)(tA,{path:n.path},`file:${c.entry.id}:${n.path}`)));let u=g++,d=r?.entryId===c.entry.id&&r.path===n.path;l.push((0,t.jsx)(tC,{id:a(u),match:n,query:s,isFocused:u===i,isOpen:d,onOpen:()=>o(c.entry.id,n.path,{line:n.line})},`line:${c.entry.id}:${n.path}:${n.line}`))}if(c.truncated&&l.push((0,t.jsx)(tT,{children:"Partial results — more matches exist than shown for this workspace."},`t:${c.entry.id}`)),c.error&&l.push((0,t.jsxs)(tT,{isError:!0,children:["Couldn’t search: ",c.error.message]},`e:${c.entry.id}`)),g>=200)break}return l}({groups:p,query:k,showEntryHeaders:S,selectedFile:a??null,focusIndex:c,optionId:h,onOpenFile:i})}),f>j.length&&(0,t.jsxs)("p",{className:"stg:border-t stg:border-border stg:px-3 stg:py-1.5 stg:text-[0.65rem] stg:text-muted-foreground",children:["Showing the first ",j.length," of ",f," matches — refine your search to narrow the list."]})]})})]})}function tC({id:e,match:s,query:r,isFocused:i,isOpen:a,onOpen:o}){return(0,t.jsxs)("li",{id:e,role:"option","aria-selected":i,"aria-current":a?"true":void 0,onClick:o,className:(0,n.cn)("stg:flex stg:cursor-pointer stg:items-baseline stg:gap-2 stg:py-0.5 stg:pl-6 stg:pr-3 stg:text-xs stg:transition-colors",i&&"stg:bg-muted",a&&"stg:bg-muted",!i&&!a&&"stg:hover:bg-muted"),children:[(0,t.jsx)("span",{className:"stg:w-8 stg:shrink-0 stg:text-right stg:font-mono stg:text-[0.65rem] stg:tabular-nums stg:text-muted-foreground-subtle",children:s.line}),(0,t.jsx)("span",{className:"stg:min-w-0 stg:flex-1 stg:truncate stg:font-mono stg:text-muted-foreground",children:(0,t.jsx)(tE,{text:s.preview,query:r})})]})}function tE({text:e,query:s}){let n=function(e,t){let s=t.trim().toLowerCase();if(0===s.length)return[];let n=e.toLowerCase(),r=[],i=0;for(;;){let e=n.indexOf(s,i);if(-1===e)break;let t=e+s.length;r.push({start:e,end:t}),i=t}return r}(e,s);if(0===n.length)return(0,t.jsx)(t.Fragment,{children:e});let r=[],i=0;return n.forEach((s,n)=>{s.start>i&&r.push(e.slice(i,s.start)),r.push((0,t.jsx)("span",{className:"stg:font-semibold stg:text-foreground",children:e.slice(s.start,s.end)},n)),i=s.end}),i<e.length&&r.push(e.slice(i)),(0,t.jsx)(t.Fragment,{children:r})}function tR({name:e}){return(0,t.jsx)("li",{role:"presentation",className:"stg:truncate stg:px-3 stg:pb-0.5 stg:pt-2 stg:text-[0.6rem] stg:font-medium stg:uppercase stg:tracking-wide stg:text-muted-foreground",children:e})}function tA({path:e}){let s=e.lastIndexOf("/"),n=s>=0?e.slice(s+1):e,r=s>=0?e.slice(0,s):"";return(0,t.jsxs)("li",{role:"presentation",className:"stg:flex stg:items-baseline stg:gap-1.5 stg:px-3 stg:pb-0.5 stg:pt-1.5 stg:text-xs",children:[(0,t.jsx)("span",{className:"stg:shrink-0 stg:font-medium stg:text-foreground",children:n}),r&&(0,t.jsx)("span",{className:"stg:truncate stg:text-[0.65rem] stg:text-muted-foreground",children:r})]})}function tT({children:e,isError:s}){return(0,t.jsx)("li",{role:"presentation",className:(0,n.cn)("stg:px-3 stg:py-1 stg:text-[0.65rem]",s?"stg:text-destructive":"stg:text-muted-foreground"),children:e})}function tM({children:e}){return(0,t.jsx)("div",{className:"stg:flex stg:h-full stg:items-center stg:justify-center stg:p-8 stg:text-center stg:text-xs stg:text-muted-foreground",children:e})}function tI(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0 stg:text-muted-foreground","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"5.25",cy:"5.25",r:"3.5"}),(0,t.jsx)("path",{d:"M7.75 7.75L10.5 10.5"})]})}function tL(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M3 3L9 9M9 3L3 9"})})}function tP(){return(0,t.jsx)("span",{"aria-hidden":"true",className:"stg:h-3 stg:w-3 stg:shrink-0 stg:animate-spin stg:rounded-full stg:border stg:border-muted-foreground stg:border-t-transparent"})}var tO=e.i(661438),tF=e.i(851624),tD=e.i(92649),tB=e.i(821354),t$=e.i(583093);let t_={content:null},tV={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",avif:"image/avif",bmp:"image/bmp",ico:"image/x-icon"};function tU(e){let t=e.lastIndexOf(".");return -1===t?null:tV[e.slice(t+1).toLowerCase()]??null}class tW extends Error{constructor(e){super(`"${e}" doesn't exist at the workspace's current ref.`),this.name="WorkspaceFileNotFoundError"}}e.s(["MAX_WORKSPACE_FILE_READ_BYTES",0,1048576,"MAX_WORKSPACE_IMAGE_READ_BYTES",0,0xa00000,"WorkspaceFileNotFoundError",0,tW,"workspaceImageMimeType",0,tU],850429);let tz=[85,72,90,65,78,88,70,82],tH=(0,s.forwardRef)(function({selectedFile:e,entries:r,reader:i,change:a,reveal:o,onClose:l,showHeader:g=!0,className:c},u){let d=r.find(t=>t.id===e.entryId)??null,m=e.path,{content:h,isLoading:p,error:f,isUnsupported:x,refetch:v}=function({entry:e,path:t,reader:n}){let r=!!(n&&e&&t),{data:i,isLoading:a,isRefetching:o,error:l,refetch:g}=(0,t$.useFetch)(r?()=>n(e,t).then(e=>({content:e})):null,[e?.id??null,e?.readRef??null,t??null,n],t_),c=!n||r&&!a&&!l&&null===i.content;return(0,s.useMemo)(()=>({content:i.content,isLoading:a,isRefetching:o,error:l,isUnsupported:c,refetch:g}),[i.content,a,o,l,c,g])}({entry:d,path:m,reader:i});(0,s.useImperativeHandle)(u,()=>({refresh:v}),[v]);let b=void 0!==i&&a?.changeType!==tO.FileChangeType.DELETE,j=void 0!==a&&b,[y,k]=(0,s.useState)(o?"file":void 0!==a?"diff":"file");(0,s.useEffect)(()=>{o&&k("file")},[o?.nonce]);let w=a?b?y:"diff":"file",S=(0,s.useCallback)(e=>{"Escape"===e.key&&l&&(e.stopPropagation(),l())},[l]),N=m.lastIndexOf("/"),C=N>=0?m.slice(N+1):m,E=N>=0?m.slice(0,N):"";return d?(0,t.jsxs)("div",{role:"region","aria-label":"File viewer",tabIndex:-1,className:(0,n.cn)("stg:flex stg:h-full stg:flex-col stg:focus:outline-none",c),onKeyDown:S,children:[g&&(0,t.jsx)(tJ,{basename:C,dir:E,onRefresh:"file"!==w||x?void 0:v,onClose:l}),j&&(0,t.jsx)(tK,{value:y,onChange:k}),(0,t.jsx)("div",{className:"stg:min-h-0 stg:flex-1 stg:overflow-y-auto",children:"diff"===w&&a?(0,t.jsx)("div",{className:"stg:p-3",children:(0,t.jsx)(tD.FileChangeDiff,{change:a,showFileName:!1,showStats:!0})}):(0,t.jsx)(tq,{basename:C,content:h,isLoading:p,isUnsupported:x,error:f,onRetry:v,reveal:o,change:a})})]}):(0,t.jsxs)("div",{role:"region","aria-label":"File viewer",className:(0,n.cn)("stg:flex stg:h-full stg:flex-col",c),onKeyDown:S,children:[g&&(0,t.jsx)(tJ,{basename:C,dir:E,onRefresh:void 0,onClose:l}),(0,t.jsx)("div",{className:"stg:flex stg:flex-1 stg:items-center stg:justify-center stg:p-8 stg:text-center stg:text-xs stg:text-muted-foreground",children:"This file is no longer in the workspace."})]})});function tK({value:e,onChange:r}){let i=(0,s.useRef)([]),a=(0,s.useCallback)(e=>{r(e),i.current[+("diff"!==e)]?.focus()},[r]),o=(0,s.useCallback)(e=>{"ArrowRight"===e.key||"ArrowDown"===e.key?(e.preventDefault(),a("file")):("ArrowLeft"===e.key||"ArrowUp"===e.key)&&(e.preventDefault(),a("diff"))},[a]);return(0,t.jsx)("div",{className:"stg:border-b stg:border-border stg:px-3 stg:py-1.5",children:(0,t.jsx)("div",{role:"radiogroup","aria-label":"File view",className:"stg:inline-flex stg:rounded-md stg:bg-muted stg:p-0.5",children:[{value:"diff",label:"Diff"},{value:"file",label:"File"}].map((s,a)=>{let l=e===s.value;return(0,t.jsx)("button",{ref:e=>{i.current[a]=e},type:"button",role:"radio","aria-checked":l,tabIndex:l?0:-1,onClick:()=>r(s.value),onKeyDown:o,className:(0,n.cn)("stg:inline-flex stg:cursor-pointer stg:items-center stg:rounded-sm stg:px-2 stg:py-0.5 stg:text-xs stg:font-medium stg:transition-colors","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",l?"stg:bg-background stg:text-foreground stg:shadow-sm":"stg:text-muted-foreground stg:hover:text-foreground"),children:s.label},s.value)})})})}function tq({basename:e,content:s,isLoading:n,isUnsupported:r,error:i,onRetry:a,reveal:o,change:l}){var g;let c=i instanceof tW;if((r||c)&&void 0!==(g=l)&&g.changeType!==tO.FileChangeType.DELETE&&g.captureLevel!==tO.FileChangeCaptureLevel.HUNK_ONLY&&void 0!==g.after)return(0,t.jsx)(tG,{change:l,basename:e,reveal:o});if(r)return(0,t.jsx)(tZ,{children:"Preview isn’t available for this file here."});if(n)return(0,t.jsx)(tX,{});if(c)return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:items-center stg:justify-center stg:gap-2 stg:p-8 stg:text-center",children:[(0,t.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"This file isn’t available in the workspace source yet. The agent’s latest changes may still be syncing."}),(0,t.jsx)("button",{type:"button",onClick:a,className:"stg:text-xs stg:font-medium stg:text-foreground stg:underline stg:underline-offset-2 stg:hover:text-muted-foreground stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:focus-visible:rounded-sm",children:"Check again"})]});if(i)return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:items-center stg:justify-center stg:gap-2 stg:p-8 stg:text-center",children:[(0,t.jsx)(t2,{}),(0,t.jsx)("p",{className:"stg:text-sm stg:text-destructive",children:i.message}),(0,t.jsx)("button",{type:"button",onClick:a,className:"stg:text-xs stg:font-medium stg:text-foreground stg:underline stg:underline-offset-2 stg:hover:text-muted-foreground stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:focus-visible:rounded-sm",children:"Retry"})]});if(!s)return(0,t.jsx)(tZ,{children:"Content not available for preview."});let u=tU(e);return s.bytes&&u?(0,t.jsx)(tY,{bytes:s.bytes,mime:u,basename:e,size:s.size,change:l}):s.isBinary?(0,t.jsxs)(tZ,{children:["Binary file — not shown",s.size?` (${tQ(s.size)})`:"","."]}):null===s.text&&s.truncated?(0,t.jsxs)(tZ,{children:["This file is too large to preview",s.size?` (${tQ(s.size)})`:"","."]}):null===s.text?(0,t.jsx)(tZ,{children:"This file can’t be displayed as text."}):(0,t.jsxs)(t.Fragment,{children:[l&&(0,t.jsx)("p",{className:"stg:border-b stg:border-border-muted stg:px-4 stg:py-1.5 stg:text-[0.65rem] stg:text-muted-foreground",children:"Live — may differ from the reviewed change."}),(0,t.jsx)(tF.ArtifactContentRenderer,{content:s.text,fileName:e,isTruncated:s.truncated,reveal:o})]})}function tY({bytes:e,mime:r,basename:i,size:a,change:o}){let l=e_((0,s.useMemo)(()=>new Blob([e],{type:r}),[e,r])),[g,c]=(0,s.useState)(!1),[u,d]=(0,s.useState)(!1);return g?(0,t.jsxs)(tZ,{children:["Binary file — not shown",a?` (${tQ(a)})`:"","."]}):(0,t.jsxs)(t.Fragment,{children:[o&&(0,t.jsx)("p",{className:"stg:border-b stg:border-border-muted stg:px-4 stg:py-1.5 stg:text-[0.65rem] stg:text-muted-foreground",children:"Live — may differ from the reviewed change."}),(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:items-center stg:gap-2 stg:p-4",children:[l?(0,t.jsx)("button",{type:"button",onClick:()=>d(!0),"aria-label":`Preview ${i} at full size`,className:(0,n.cn)(eU.UNSTYLED_BUTTON,"stg:max-w-full stg:rounded-md stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:(0,t.jsx)("img",{src:l,alt:i,onError:()=>c(!0),className:"stg:max-h-[70vh] stg:max-w-full stg:rounded-md stg:border stg:border-border stg:object-contain"})}):(0,t.jsx)("div",{className:"stg:h-48 stg:w-72 stg:max-w-full stg:animate-pulse stg:rounded-md stg:bg-muted","aria-hidden":"true"}),(0,t.jsxs)("p",{className:"stg:text-[0.65rem] stg:tabular-nums stg:text-muted-foreground",children:[r,a?` \xb7 ${tQ(a)}`:""]})]}),(0,t.jsx)(eV.AttachmentImageLightbox,{src:l,filename:i,open:u,onClose:()=>d(!1)})]})}function tG({change:e,basename:s,reveal:n}){let{afterText:r,isBinary:i,isLoading:a,error:o}=(0,tB.useFileChangeContent)(e);return a?(0,t.jsx)(tX,{}):i?(0,t.jsx)(tZ,{children:"Binary file — not shown."}):o||null===r?(0,t.jsx)(tZ,{children:"Content not available for preview."}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"stg:border-b stg:border-border-muted stg:px-4 stg:py-1.5 stg:text-[0.65rem] stg:text-muted-foreground",children:"As of the agent’s last change — not yet in the workspace source."}),(0,t.jsx)(tF.ArtifactContentRenderer,{content:r,fileName:s,reveal:n})]})}function tX(){return(0,t.jsx)("div",{role:"status",className:"stg:space-y-2 stg:p-4","aria-busy":"true","aria-label":"Loading file",children:tz.map((e,s)=>(0,t.jsx)("div",{className:"stg:h-4 stg:animate-pulse stg:rounded stg:bg-muted",style:{width:`${e}%`},"aria-hidden":"true"},s))})}function tJ({basename:e,dir:s,onRefresh:n,onClose:r}){return(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:border-b stg:border-border stg:px-3 stg:py-2",children:[(0,t.jsx)(t0,{}),(0,t.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:flex-1 stg:items-baseline stg:gap-1.5",children:[(0,t.jsxs)(a.Tooltip,{children:[(0,t.jsx)(a.TooltipTrigger,{render:(0,t.jsx)("span",{className:"stg:truncate stg:text-xs stg:font-semibold stg:text-foreground"}),children:e}),(0,t.jsx)(a.TooltipContent,{side:"top",className:"stg:break-all",children:s?`${s}/${e}`:e})]}),s&&(0,t.jsx)("span",{className:"stg:truncate stg:text-[0.65rem] stg:text-muted-foreground",children:s})]}),n&&(0,t.jsx)("button",{type:"button",onClick:n,"aria-label":`Reload ${e}`,className:"stg:shrink-0 stg:rounded stg:p-0.5 stg:text-muted-foreground stg:transition-colors stg:hover:text-foreground stg:focus-visible:outline-none stg:focus-visible:ring-1 stg:focus-visible:ring-ring",children:(0,t.jsx)(t5,{})}),r&&(0,t.jsx)("button",{type:"button",onClick:r,"aria-label":"Close file viewer",className:"stg:shrink-0 stg:rounded stg:p-0.5 stg:text-muted-foreground stg:transition-colors stg:hover:text-foreground stg:focus-visible:outline-none stg:focus-visible:ring-1 stg:focus-visible:ring-ring",children:(0,t.jsx)(t1,{})})]})}function tZ({children:e}){return(0,t.jsx)("div",{className:"stg:flex stg:h-full stg:items-center stg:justify-center stg:p-8 stg:text-center stg:text-xs stg:text-muted-foreground",children:e})}function tQ(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function t0(){return(0,t.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0 stg:text-muted-foreground","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M9.5 1.5H5C4.17 1.5 3.5 2.17 3.5 3V13C3.5 13.83 4.17 14.5 5 14.5H11C11.83 14.5 12.5 13.83 12.5 13V4.5L9.5 1.5Z"}),(0,t.jsx)("path",{d:"M9.5 1.5V4.5H12.5"})]})}function t1(){return(0,t.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M3 3L11 11"}),(0,t.jsx)("path",{d:"M11 3L3 11"})]})}function t5(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M1.5 6a4.5 4.5 0 017.794-3.073M10.5 6a4.5 4.5 0 01-7.794 3.073"}),(0,t.jsx)("path",{d:"M9.5 1v2.5H7M2.5 11V8.5H5"})]})}function t2(){return(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:text-destructive","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"6.5"}),(0,t.jsx)("path",{d:"M8 5.5V8.5"}),(0,t.jsx)("circle",{cx:"8",cy:"11",r:"0.5",fill:"currentColor",stroke:"none"})]})}function t4(e,t){return`${e}${encodeURIComponent(t)}`}function t3({editors:e,activeKey:r,onActivate:i,onPin:o,onClose:l,panelId:g,tabIdPrefix:c,className:u}){let d=(0,s.useCallback)((t,s)=>{let n=t+s;if(n<0||n>=e.length)return;let r=e[n];i(r.entryId,r.path)},[e,i]);return(0,t.jsx)(a.TooltipProvider,{children:(0,t.jsx)("div",{role:"tablist","aria-label":"Open editors","aria-orientation":"horizontal",className:(0,n.cn)("stg:flex stg:shrink-0 stg:items-stretch stg:overflow-x-auto stg:border-b stg:border-border",u),children:e.map((e,s)=>{let u=(0,tg.editorKey)(e.entryId,e.path),m=u===r,h=e.path.lastIndexOf("/"),p=h>=0?e.path.slice(h+1):e.path;return(0,t.jsxs)(a.Tooltip,{children:[(0,t.jsxs)(a.TooltipTrigger,{render:(0,t.jsx)("div",{role:"tab",id:c?t4(c,u):void 0,"aria-selected":m,"aria-controls":g,tabIndex:m?0:-1,onClick:()=>i(e.entryId,e.path),onDoubleClick:()=>o(e.entryId,e.path),onAuxClick:t=>{1===t.button&&(t.preventDefault(),l(e.entryId,e.path))},onKeyDown:t=>{"ArrowRight"===t.key?(t.preventDefault(),d(s,1)):"ArrowLeft"===t.key?(t.preventDefault(),d(s,-1)):"Enter"===t.key||" "===t.key?(t.preventDefault(),i(e.entryId,e.path)):("Delete"===t.key||"Backspace"===t.key)&&(t.preventDefault(),l(e.entryId,e.path))},className:(0,n.cn)("stg:group stg:flex stg:max-w-[12rem] stg:shrink-0 stg:cursor-pointer stg:items-center stg:gap-1.5 stg:border-r stg:border-border stg:px-3 stg:py-1.5 stg:text-xs stg:transition-colors","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring",m?"stg:bg-background stg:text-foreground":"stg:bg-muted-faint stg:text-muted-foreground stg:hover:bg-muted stg:hover:text-foreground")}),children:[(0,t.jsx)("span",{className:(0,n.cn)("stg:truncate",e.preview&&"stg:italic"),children:p}),(0,t.jsx)("span",{"aria-hidden":"true",onClick:t=>{t.stopPropagation(),l(e.entryId,e.path)},className:(0,n.cn)("stg:shrink-0 stg:cursor-pointer stg:rounded stg:p-0.5 stg:text-muted-foreground stg:transition-opacity stg:hover:bg-accent-hover stg:hover:text-foreground",m?"stg:opacity-100":"stg:opacity-0 stg:group-hover:opacity-100"),children:(0,t.jsx)(t6,{})})]}),(0,t.jsx)(a.TooltipContent,{side:"top",className:"stg:break-all",children:e.path})]},u)})})})}function t6(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M3.5 3.5L10.5 10.5"}),(0,t.jsx)("path",{d:"M10.5 3.5L3.5 10.5"})]})}let t8=[];function t7({entries:e,lister:s,selectedFile:n,onOpenFile:r,onActivateFile:i,onRemoveEntry:a}){return(0,t.jsx)("div",{className:"stg:flex stg:flex-col",children:e.map((e,o)=>(0,t.jsx)(t9,{entry:e,lister:s,defaultExpanded:0===o,selectedPath:n?.entryId===e.id?n.path:void 0,onOpenFile:r,onActivateFile:i,onRemove:a},e.id))})}function t9({entry:e,lister:r,defaultExpanded:i,selectedPath:o,onOpenFile:l,onActivateFile:g,onRemove:c}){let[u,d]=(0,s.useState)(i),{tree:m,isLoading:h,error:p,truncated:f,refresh:x}=function({entry:e,lister:t}){let[n,r]=(0,s.useState)(!1),[i,a]=(0,s.useState)(null),[o,l]=(0,s.useState)(t8),[g,c]=(0,s.useState)(!1),u=(0,s.useRef)(0),d=(0,s.useCallback)(async(e,s)=>{if(!t)return;if(!s){let t=tu.get(td(e));if(t){l(t.tree),c(t.truncated),a(null),r(!1);return}}let n=++u.current;r(!0),a(null);try{let i=await tm(e,t,{bustCache:s});if(u.current!==n)return;if(null===i){l(t8),c(!1),r(!1);return}l(i.tree),c(i.truncated),r(!1)}catch(e){if(u.current!==n)return;a((0,es.toError)(e)),l(t8),c(!1),r(!1)}},[t]);(0,s.useEffect)(()=>{if(!e||!t){l(t8),c(!1),r(!1),a(null);return}d(e,!1)},[e,t,d]);let m=(0,s.useCallback)(()=>{e&&t&&d(e,!0)},[e,t,d]);return(0,s.useMemo)(()=>({tree:o,isLoading:n,error:i,truncated:g,refresh:m}),[o,n,i,g,m])}({entry:u?e:null,lister:r});return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col",children:[(0,t.jsxs)("div",{className:"stg:group/root stg:flex stg:items-stretch",children:[(0,t.jsxs)(a.Tooltip,{children:[(0,t.jsxs)(a.TooltipTrigger,{render:(0,t.jsx)("button",{type:"button",onClick:()=>d(e=>!e),"aria-expanded":u,className:(0,n.cn)("stg:flex stg:min-w-0 stg:flex-1 stg:items-center stg:gap-1.5 stg:px-1.5 stg:py-1 stg:text-left stg:text-[0.7rem] stg:font-semibold stg:uppercase stg:tracking-wide stg:text-foreground stg:transition-colors stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring")}),children:[(0,t.jsx)("span",{"aria-hidden":"true",className:"stg:text-[10px] stg:text-muted-foreground-subtle",children:u?"▼":"▶"}),(0,t.jsx)("span",{className:"stg:truncate",children:e.name})]}),(0,t.jsx)(a.TooltipContent,{side:"top",className:"stg:break-all",children:"local"===e.type?e.localPath:e.gitUrl})]}),c&&(0,t.jsxs)(a.Tooltip,{children:[(0,t.jsx)(a.TooltipTrigger,{render:(0,t.jsx)("button",{type:"button",onClick:()=>c(e.id),"aria-label":`Remove ${e.name} from workspace`,className:(0,n.cn)("stg:shrink-0 stg:px-1.5 stg:text-muted-foreground stg:opacity-0 stg:transition-opacity","stg:group-hover/root:opacity-100 stg:focus-visible:opacity-100","stg:hover:text-destructive stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring")}),children:(0,t.jsx)(st,{})}),(0,t.jsx)(a.TooltipContent,{side:"top",children:`Remove ${e.name} from workspace`})]})]}),u&&(0,t.jsx)(se,{entryName:e.name,entryId:e.id,tree:m,isLoading:h,error:p,truncated:f,selectedPath:o,onOpenFile:l,onActivateFile:g,onRetry:x})]})}function se({entryName:e,entryId:s,tree:r,isLoading:i,error:a,truncated:o,selectedPath:l,onOpenFile:g,onActivateFile:c,onRetry:u}){return i?(0,t.jsx)("div",{role:"status",className:"stg:space-y-1.5 stg:px-2 stg:py-2","aria-busy":"true","aria-label":`Loading files for ${e}`,children:[1,2,3,4].map(e=>(0,t.jsx)("div",{className:"stg:h-3.5 stg:animate-pulse stg:rounded stg:bg-muted",style:{width:`${50+10*e}%`},"aria-hidden":"true"},e))}):a?(0,t.jsxs)("div",{className:"stg:px-2 stg:py-2 stg:text-xs stg:text-destructive",children:["Failed to list files: ",a.message,(0,t.jsx)("button",{type:"button",onClick:u,className:"stg:ml-2 stg:rounded-sm stg:underline stg:transition-colors stg:hover:text-destructive stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",children:"Retry"})]}):0===r.length?(0,t.jsx)("p",{className:"stg:px-3 stg:py-2 stg:text-xs stg:text-muted-foreground",children:"No files found."}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("nav",{"aria-label":`File tree for ${e}`,children:(0,t.jsx)("ul",{className:(0,n.cn)(X.UNSTYLED_LIST,"stg:py-0.5 stg:pl-1.5"),role:"tree",children:r.map(e=>(0,t.jsx)(e9.FileTreeNode,{node:e,selectedPath:l??"",onSelect:e=>g(s,e),onActivate:e=>c(s,e),depth:0,enableDrag:!0,showIcons:!0,indentGuides:!0,maxInitialDepth:0},e.path))})}),o&&(0,t.jsx)("p",{className:"stg:px-3 stg:py-1.5 stg:text-[0.65rem] stg:text-muted-foreground",children:"Showing a partial listing — too many files to load in full."})]})}function st(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M4 4L10 10M10 4L4 10"})})}let ss=["files","search"];function sn({entries:e,lister:r,reader:i,searcher:a,view:o,onViewChange:l,builtInViews:g=ss,extraViews:c,virtualDocuments:u,onRemoveEntry:d,onAddLocalFolder:m,editors:h,selectedFile:p,onOpenFile:f,onActivateEditor:x,onPinEditor:v,onCloseEditor:b,onCollapse:j,change:y,reveal:k,className:w}){let[S,N]=(0,s.useState)("files"),C=o??S,E=(0,s.useCallback)(e=>{N(e),l?.(e)},[l]),R=g.includes(C)||(c?.some(e=>e.id===C)??!1),A=g[0]??c?.[0]?.id??"files",T=R?C:A,M=c?.find(e=>e.id===T);return(0,t.jsxs)("div",{className:(0,n.cn)("stg:flex stg:h-full stg:min-h-0",w),children:[(0,t.jsx)(sr,{view:T,onViewChange:E,builtInViews:g,extraViews:c}),(0,t.jsx)(ta,{resizablePane:"primary",defaultSize:288,minSize:200,maxSize:560,storageKey:"stgm-workspace-sidebar-width",ariaLabel:"Resize sidebar",className:"stg:min-h-0 stg:min-w-0 stg:flex-1",primary:M?(0,t.jsx)(sl,{view:M}):"search"===T?(0,t.jsx)(sa,{entries:e,lister:r,searcher:a,selectedFile:p,onOpenFile:f}):(0,t.jsx)(si,{entries:e,lister:r,selectedFile:p,onOpenFile:f,onActivateFile:v,onRemoveEntry:d,onAddLocalFolder:m}),secondary:(0,t.jsx)(sg,{entries:e,reader:i,editors:h,selectedFile:p,virtualDocuments:u,change:y,reveal:k,onActivateEditor:x,onPinEditor:v,onCloseEditor:b,onCollapse:j})})]})}function sr({view:e,onViewChange:r,builtInViews:i,extraViews:o}){let l=[...[{id:"files",label:"Explorer",icon:(0,t.jsx)(sh,{})},{id:"search",label:"Search",icon:(0,t.jsx)(sp,{})}].filter(e=>i.includes(e.id)),...o??[]],g=(0,s.useRef)([]),c=(0,s.useCallback)((e,t)=>{let s=null;"ArrowDown"===e.key||"ArrowRight"===e.key?s=Math.min(t+1,l.length-1):"ArrowUp"===e.key||"ArrowLeft"===e.key?s=Math.max(t-1,0):"Home"===e.key?s=0:"End"===e.key&&(s=l.length-1),null!==s&&s!==t&&(e.preventDefault(),r(l[s].id),g.current[s]?.focus())},[l,r]);return(0,t.jsx)(a.TooltipProvider,{children:(0,t.jsx)("div",{role:"radiogroup","aria-label":"Workspace view","aria-orientation":"vertical",className:"stg:flex stg:w-11 stg:shrink-0 stg:flex-col stg:items-center stg:gap-1 stg:border-r stg:border-border stg:bg-muted-faint stg:py-2",children:l.map((s,i)=>{let o=e===s.id,l=null!=s.badge&&s.badge>0;return(0,t.jsxs)(a.Tooltip,{children:[(0,t.jsxs)(a.TooltipTrigger,{render:(0,t.jsx)("button",{ref:e=>{g.current[i]=e},type:"button",role:"radio","aria-checked":o,"aria-label":l?`${s.label} (${s.badge})`:s.label,tabIndex:o?0:-1,onClick:()=>r(s.id),onKeyDown:e=>c(e,i),className:(0,n.cn)("stg:relative stg:flex stg:h-9 stg:w-9 stg:items-center stg:justify-center stg:rounded-md stg:transition-colors","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",o?"stg:bg-accent stg:text-foreground":"stg:text-muted-foreground stg:hover:bg-accent-hover stg:hover:text-foreground")}),children:[s.icon,l&&(0,t.jsx)("span",{"aria-hidden":"true",className:"stg:absolute stg:-right-0.5 stg:-top-0.5 stg:inline-flex stg:min-w-[0.875rem] stg:items-center stg:justify-center stg:rounded-full stg:bg-primary stg:px-1 stg:py-px stg:text-[9px] stg:font-medium stg:leading-none stg:text-primary-foreground",children:s.badge})]}),(0,t.jsx)(a.TooltipContent,{side:"right",children:s.label})]},s.id)})})})}function si({entries:e,lister:s,selectedFile:n,onOpenFile:r,onActivateFile:i,onRemoveEntry:a,onAddLocalFolder:o}){return(0,t.jsxs)("div",{className:"stg:flex stg:h-full stg:min-h-0 stg:flex-col stg:border-r stg:border-border",children:[(0,t.jsx)(sd,{title:"Explorer"}),(0,t.jsx)("div",{className:"stg:min-h-0 stg:flex-1 stg:overflow-y-auto stg:py-1.5",children:s&&0!==e.length?(0,t.jsx)(t7,{entries:e,lister:s,selectedFile:n,onOpenFile:r,onActivateFile:i,onRemoveEntry:a}):(0,t.jsx)(sm,{children:"No workspace attached."})}),o&&(0,t.jsx)("div",{className:"stg:shrink-0 stg:border-t stg:border-border-muted stg:p-1.5",children:(0,t.jsxs)("button",{type:"button",onClick:o,className:"stg:flex stg:w-full stg:items-center stg:gap-2 stg:rounded-md stg:px-2 stg:py-1.5 stg:text-xs stg:text-foreground stg:transition-colors stg:hover:bg-accent-hover stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",children:[(0,t.jsx)(sf,{}),(0,t.jsx)("span",{className:"stg:flex-1 stg:text-left",children:"Add Folder"})]})})]})}function sa({entries:e,lister:n,searcher:r,selectedFile:i,onOpenFile:a}){let[o,l]=(0,s.useState)("name");return(0,t.jsxs)("div",{className:"stg:flex stg:h-full stg:min-h-0 stg:flex-col stg:border-r stg:border-border",children:[(0,t.jsx)(sd,{title:"Search"}),r&&(0,t.jsx)(so,{value:o,onChange:l}),r&&"text"===o?(0,t.jsx)(tN,{entries:e,searcher:r,onOpenFile:a,selectedFile:i,className:"stg:min-h-0 stg:flex-1"}):(0,t.jsx)(tf,{entries:e,lister:n,onOpenFile:a,selectedFile:i,className:"stg:min-h-0 stg:flex-1"})]})}function so({value:e,onChange:r}){let i=(0,s.useRef)([]),a=(0,s.useCallback)(e=>{r(e),i.current[+("name"!==e)]?.focus()},[r]),o=(0,s.useCallback)(e=>{"ArrowRight"===e.key||"ArrowDown"===e.key?(e.preventDefault(),a("text")):("ArrowLeft"===e.key||"ArrowUp"===e.key)&&(e.preventDefault(),a("name"))},[a]);return(0,t.jsx)("div",{className:"stg:shrink-0 stg:border-b stg:border-border stg:px-2 stg:py-1.5",children:(0,t.jsx)("div",{role:"radiogroup","aria-label":"Search mode",className:"stg:inline-flex stg:rounded-md stg:bg-muted stg:p-0.5",children:[{value:"name",label:"Name"},{value:"text",label:"Text"}].map((s,a)=>{let l=e===s.value;return(0,t.jsx)("button",{ref:e=>{i.current[a]=e},type:"button",role:"radio","aria-checked":l,tabIndex:l?0:-1,onClick:()=>r(s.value),onKeyDown:o,className:(0,n.cn)("stg:rounded stg:px-2.5 stg:py-0.5 stg:text-[0.7rem] stg:font-medium stg:transition-colors","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",l?"stg:bg-background stg:text-foreground stg:shadow-sm":"stg:text-muted-foreground stg:hover:text-foreground"),children:s.label},s.value)})})})}function sl({view:e}){return e.fitted?(0,t.jsx)("div",{className:"stg:flex stg:h-full stg:min-h-0 stg:flex-col stg:border-r stg:border-border",children:e.content}):(0,t.jsxs)("div",{className:"stg:flex stg:h-full stg:min-h-0 stg:flex-col stg:border-r stg:border-border",children:[(0,t.jsx)(sd,{title:e.label}),(0,t.jsx)("div",{className:"stg:min-h-0 stg:flex-1 stg:overflow-y-auto stg:px-3 stg:py-3",children:e.content})]})}function sg({entries:e,reader:r,editors:i,selectedFile:o,virtualDocuments:l,change:g,reveal:c,onActivateEditor:u,onPinEditor:d,onCloseEditor:m,onCollapse:h}){let p=(0,s.useRef)(null),f=(0,s.useId)(),x=`${f}editor-panel`,v=`${f}editor-tab-`,b=o?(0,tg.editorKey)(o.entryId,o.path):null,j=null!==b?l?.find(e=>(0,tg.editorKey)(e.entryId,e.path)===b):void 0,y=o?e.find(e=>e.id===o.entryId)?.name:void 0;return(0,t.jsxs)("div",{className:"stg:flex stg:h-full stg:min-h-0 stg:flex-col",children:[(0,t.jsxs)("div",{className:(0,n.cn)(su,"stg:flex stg:shrink-0 stg:items-stretch stg:border-b stg:border-border stg:pr-24"),children:[(0,t.jsxs)(a.Tooltip,{children:[(0,t.jsx)(a.TooltipTrigger,{render:(0,t.jsx)("button",{type:"button",onClick:h,"aria-label":"Back to chat",className:"stg:flex stg:shrink-0 stg:items-center stg:border-r stg:border-border stg:px-2 stg:text-muted-foreground stg:transition-colors stg:hover:bg-accent-hover stg:hover:text-foreground stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring"}),children:(0,t.jsx)(sx,{})}),(0,t.jsx)(a.TooltipContent,{side:"top",children:"Back to chat"})]}),i.length>0&&(0,t.jsx)(t3,{editors:i,activeKey:b,onActivate:u,onPin:d,onClose:m,panelId:x,tabIdPrefix:v,className:"stg:min-w-0 stg:flex-1 stg:border-b-0"})]}),(0,t.jsx)("div",{className:"stg:flex stg:min-h-0 stg:min-w-0 stg:flex-1 stg:flex-col",...b?{role:"tabpanel",id:x,"aria-labelledby":t4(v,b)}:{},children:j?(0,t.jsx)("div",{className:"stg:min-h-0 stg:min-w-0 stg:flex-1 stg:overflow-y-auto stg:overflow-x-hidden",children:j.content},b??void 0):o?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(sc,{entryName:y,path:o.path,onRefresh:r?()=>p.current?.refresh():void 0}),(0,t.jsx)(tH,{ref:p,selectedFile:o,entries:e,reader:r,change:g,reveal:c,onClose:h,showHeader:!1,className:"stg:min-h-0 stg:flex-1"},b??void 0)]}):(0,t.jsx)("div",{className:"stg:flex stg:flex-1 stg:items-center stg:justify-center stg:p-8 stg:text-center stg:text-xs stg:text-muted-foreground",children:"Select a file to view its contents."})})]})}function sc({entryName:e,path:s,onRefresh:r}){let i=s.split("/").filter(Boolean),o=e?[e,...i]:i;return(0,t.jsxs)("div",{className:"stg:flex stg:shrink-0 stg:items-center stg:gap-1 stg:border-b stg:border-border-muted stg:px-3 stg:py-1 stg:text-[0.65rem] stg:text-muted-foreground",children:[(0,t.jsx)("nav",{"aria-label":"File location",className:"stg:flex stg:min-w-0 stg:flex-1 stg:items-center stg:gap-1",children:o.map((e,s)=>{let r=s===o.length-1;return(0,t.jsxs)("span",{className:"stg:flex stg:min-w-0 stg:items-center stg:gap-1",children:[s>0&&(0,t.jsx)("span",{className:"stg:text-muted-foreground-subtle","aria-hidden":"true",children:"›"}),(0,t.jsx)("span",{className:(0,n.cn)("stg:truncate",r&&"stg:text-foreground"),children:e})]},s)})}),r&&(0,t.jsxs)(a.Tooltip,{children:[(0,t.jsx)(a.TooltipTrigger,{render:(0,t.jsx)("button",{type:"button",onClick:r,"aria-label":"Reload file",className:"stg:shrink-0 stg:rounded stg:p-0.5 stg:text-muted-foreground stg:transition-colors stg:hover:text-foreground stg:focus-visible:outline-none stg:focus-visible:ring-1 stg:focus-visible:ring-ring"}),children:(0,t.jsx)(sv,{})}),(0,t.jsx)(a.TooltipContent,{side:"top",children:"Reload file"})]})]})}let su="stg:h-8";function sd({title:e}){return(0,t.jsx)("div",{className:(0,n.cn)(su,"stg:flex stg:shrink-0 stg:items-center stg:border-b stg:border-border stg:px-3 stg:text-[0.65rem] stg:font-semibold stg:uppercase stg:tracking-wide stg:text-muted-foreground"),children:e})}function sm({children:e}){return(0,t.jsx)("div",{className:"stg:px-2 stg:py-6 stg:text-center stg:text-xs stg:text-muted-foreground",children:e})}function sh(){return(0,t.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M13 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,t.jsx)("path",{d:"M13 3v5h5"})]})}function sp(){return(0,t.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,t.jsx)("path",{d:"M21 21l-4.3-4.3"})]})}function sf(){return(0,t.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0 stg:text-muted-foreground","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M1.5 3.5V11a1 1 0 001 1h9a1 1 0 001-1V5.5a1 1 0 00-1-1H7L5.5 3H2.5a1 1 0 00-1 .5z"}),(0,t.jsx)("path",{d:"M7 7v3M5.5 8.5h3"})]})}function sx(){return(0,t.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M10 3L5 8L10 13"})})}function sv(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M1.5 6a4.5 4.5 0 017.794-3.073M10.5 6a4.5 4.5 0 01-7.794 3.073"}),(0,t.jsx)("path",{d:"M9.5 1v2.5H7M2.5 11V8.5H5"})]})}e.s(["WorkspaceSurface",0,sn],603115);var sb=e.i(577660);let sj=0;function sy(){let[e,t]=(0,s.useState)([]),n=(0,s.useCallback)(()=>{t(e=>[...e,{id:`sv-${++sj}-${Date.now()}`,key:"",value:"",isSecret:!0,saveForFuture:!1}])},[]),r=(0,s.useCallback)(e=>{t(t=>t.filter(t=>t.id!==e))},[]),i=(0,s.useCallback)((e,s)=>{t(t=>t.map(t=>t.id===e?{...t,...s}:t))},[]),a=(0,s.useCallback)(()=>{t([])},[]),o=(0,s.useMemo)(()=>e.some(e=>""!==e.key.trim()&&""!==e.value.trim()),[e]),l=(0,s.useCallback)(()=>{let t={};for(let s of e){let e=s.key.trim();""!==e&&""!==s.value.trim()&&(t[e]={value:s.value,isSecret:s.isSecret})}return t},[e]),g=(0,s.useCallback)(()=>{let t={};for(let s of e){let e=s.key.trim();""!==e&&""!==s.value.trim()&&s.saveForFuture&&(t[e]={value:s.value,isSecret:s.isSecret})}return t},[e]),c=(0,s.useMemo)(()=>e.some(e=>e.saveForFuture&&""!==e.key.trim()&&""!==e.value.trim()),[e]),u=0===e.length;return(0,s.useMemo)(()=>({entries:e,addEntry:n,removeEntry:r,updateEntry:i,clear:a,isEmpty:u,hasValidEntries:o,toRuntimeEnv:l,toSaveForFutureEnv:g,hasSaveForFutureEntries:c}),[e,n,r,i,a,u,o,l,g,c])}var sk=e.i(28434),sw=e.i(433732),sS=e.i(891400),sN=e.i(205730);async function sC(e,t){let s=await e(),n={...t,...s};return Object.keys(n).length>0?n:void 0}function sE(e){if("fast"===e.serviceTier&&!e.modelName)throw Error('SessionRunConfig: serviceTier "fast" requires modelName — the fast tier is a per-model price and Auto (no pinned model) has no tier dimension. Pin the model the surface should run.');if("enabled"===e.thinkingMode&&!e.modelName)throw Error('SessionRunConfig: thinkingMode "enabled" requires modelName — thinking is a per-model capability and Auto (no pinned model) has no variant dimensions. Pin the model the surface should run.')}let sR="stigmer:session:harness";function sA(e){return"cursor"===e?"stigmer:session:model:cursor":"stigmer:session:model"}var sT=e.i(574803);let sM=(0,tg.virtualEntryId)("plan"),sI="Plan",sL=(0,tg.virtualEntryId)("artifact");function sP(e){return e.sandboxPath||e.name}function sO(e){return(0,s.useMemo)(()=>{let t=new Map;for(let s of e){let e=s.metadata?.id??"",n=s.status?.phase??tO.ExecutionPhase.EXECUTION_PHASE_UNSPECIFIED,r=(0,sT.isTerminalPhase)(n);for(let n of s.status?.artifacts??[]){let s=sP(n);t.set(s,{artifact:n,executionId:e,isTerminal:r,hasNameCollision:!1})}}let s=Array.from(t.values());s.sort((e,t)=>e.artifact.name.localeCompare(t.artifact.name,void 0,{sensitivity:"base"}));let n=new Map;for(let e of s){let t=e.artifact.name.toLowerCase();n.set(t,(n.get(t)??0)+1)}let r=s.map(e=>{let t=e.artifact.name.toLowerCase();return(n.get(t)??0)>1?{...e,hasNameCollision:!0}:e});return{artifacts:r,hasArtifacts:r.length>0,artifactCount:r.length}},[e])}function sF({phase:e,hasChanges:t,planKey:n=null,defaultView:r="files",open:i,defaultOpen:a=!1,onOpenChange:o}){let l=(0,tl.useWorkspaceEditorsStoreRef)(),g=void 0!==i,[c,u]=(0,s.useState)(a),d=g?i:c,m=(0,s.useRef)(o);m.current=o;let h=(0,s.useRef)(g);h.current=g;let p=(0,s.useRef)(d);p.current=d;let f=(0,s.useCallback)(e=>{p.current!==e&&(h.current||(p.current=e,u(e)),m.current?.(e))},[]),[x,v]=(0,s.useState)(r),b=(0,s.useRef)(!1),[j,y]=(0,s.useState)(e);if(e!==j){let t=null!==j&&(0,sT.isTerminalPhase)(j),s=null!==e&&(0,sT.isTerminalPhase)(e);y(e),t!==s&&(b.current=!1,v(r))}let[k,w]=(0,s.useState)(t);t!==k&&(w(t),t&&d&&!b.current&&v("changes"));let S=(0,s.useCallback)(()=>{l.openPinned(sM,sI),f(!0)},[l,f]),N=(0,s.useRef)(n);(0,s.useEffect)(()=>{n!==N.current&&(N.current=n,null!==n&&S())},[n,S]);let C=(0,s.useCallback)(()=>f(!0),[f]),E=(0,s.useCallback)(()=>f(!1),[f]),R=(0,s.useCallback)(e=>{b.current=!0,v(e)},[]),A=(0,s.useCallback)((e,t,s)=>{l.openPreview(e,t,s),f(!0)},[l,f]),T=(0,s.useCallback)(e=>{l.openPreview(sL,sP(e)),f(!0)},[l,f]),M=(0,s.useCallback)(e=>{l.pin(sL,sP(e))},[l]),I=(0,s.useCallback)((e,t)=>l.activate(e,t),[l]),L=(0,s.useCallback)((e,t)=>l.pin(e,t),[l]),P=(0,s.useCallback)((e,t)=>l.close(e,t),[l]);return(0,s.useMemo)(()=>({editorsStore:l,isOpen:d,view:x,openPanel:C,closePanel:E,setView:R,openFile:A,activateEditor:I,pinEditor:L,closeEditor:P,openPlanDocument:S,openArtifact:T,pinArtifact:M}),[l,d,x,C,E,R,A,I,L,P,S,T,M])}function sD(e){return(0,s.useMemo)(()=>{let t=new Map;for(let s of e){let e=s.metadata?.id??"";for(let n of s.status?.workspaceWriteBacks??[])t.set(n.workspaceEntryName,{writeBack:n,executionId:e})}let s=Array.from(t.values());return s.sort((e,t)=>e.writeBack.workspaceEntryName.localeCompare(t.writeBack.workspaceEntryName,void 0,{sensitivity:"base"})),{writeBacks:s,hasWriteBacks:s.length>0,writeBackCount:s.length}},[e])}e.s(["ARTIFACT_DOCUMENT_ENTRY_ID",0,sL],227989);var sB=e.i(155917),s$=e.i(174886),s_=e.i(475254);let sV=(0,s_.default)("file-braces",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]),sU=(0,s_.default)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);var sW=e.i(934197),sz=e.i(414385),sH=e.i(311577),sK=e.i(400553),sq=e.i(445726);async function sY(e,t,s){let[n,r]=await Promise.all([e.session.get(t),e.agentExecution.listBySession((0,J.create)(eL.ListAgentExecutionsBySessionRequestSchema,{sessionId:t}))]);if(r.totalPages>1)throw Error(`Session ${t} has ${r.totalPages} pages of executions but transcript export reads a single page. The server has started paginating listBySession; teach fetchSessionTranscript to walk pages before exporting, so no turns are silently dropped.`);let i=s?.resolveOutputs===!1?{}:await sG(e,r.entries,{concurrency:s?.concurrency});return function(e,t,s){let n=s?.includeSuperseded===!0,r=(0,sq.sortChronologically)(t),i=(0,sq.supersededExecutionIds)(r),a=[];for(let e of r){let t=i.has(e.metadata?.id??"");if(t&&!n)continue;let s=e.status?.phase;a.push({execution:e,userPrompt:(0,sq.syntheticUserPrompt)(e),isBuildFromPlan:(0,sq.isBuildFromPlanTurn)(e),superseded:t,inProgress:void 0===s||!(0,sT.isTerminalPhase)(s)})}return{session:e,turns:a,resolvedOutputs:s?.resolvedOutputs??{},includesSuperseded:n}}(n,r.entries,{includeSuperseded:s?.includeSuperseded,resolvedOutputs:i})}async function sG(e,t,s){let n=new Map;for(let e of t)for(let t of function*(e){if(e)for(let t of[e.messages,...e.subAgentExecutions.map(e=>e.messages)])for(let e of t)yield*e.toolCalls}(e.status)){let e=t.outputRef;e?.storageKey&&n.set(e.storageKey,e)}let r={},i=new TextDecoder("utf-8",{fatal:!1});return await sX([...n.values()],s?.concurrency??4,async t=>{let s={storageKey:t.storageKey,mimeType:t.mimeType,isImage:t.isImage,totalSizeBytes:Number(t.sizeBytes)};if(t.isImage){r[t.storageKey]={...s,truncated:!1};return}let n=(0,sq.execIdFromStorageKey)(t.storageKey);if(!n){r[t.storageKey]={...s,truncated:!1,error:`unexpected storage key shape: ${t.storageKey}`};return}try{let a=await e.agentExecution.getArtifactContent((0,J.create)(eL.GetArtifactContentRequestSchema,{executionId:n,storageKey:t.storageKey}));r[t.storageKey]={...s,content:i.decode(a.content),truncated:a.truncated,totalSizeBytes:Number(a.totalSizeBytes)}}catch(e){r[t.storageKey]={...s,truncated:!1,error:e instanceof Error?e.message:String(e)}}}),r}async function sX(e,t,s){let n=e.values(),r=Array.from({length:Math.max(1,Math.min(t,e.length))},async()=>{for(let e of n)await s(e)});await Promise.all(r)}function sJ(e,t){let{session:s,turns:n,resolvedOutputs:r}=e,i=[],a=s.metadata?.id??"",o=(0,sB.resolvedSubject)(s.spec?.subject)??`Session ${a}`;i.push(`# ${o}`,""),i.push(`- Session: \`${a}\``);let l=s.spec?.agentInstanceId;for(let[s,a]of(l&&i.push(`- Agent instance: \`${l}\``),i.push(`- Turns: ${n.length}`),e.includesSuperseded&&i.push("- Includes superseded (edited-and-resubmitted) turns"),t?.generatedAt&&i.push(`- Exported: ${t.generatedAt}`),n.entries())){i.push("","---",""),i.push(`## Turn ${s+1}${function(e){let t=e.execution.status?.startedAt;return t?` \xb7 ${t}`:""}(a)}`),a.superseded&&i.push("","_Superseded by an edited resubmission._"),a.inProgress&&i.push("","_In progress at export time — content is the last persisted snapshot._"),a.isBuildFromPlan&&i.push("","_Build from plan._"),null!==a.userPrompt&&i.push("","**User**","",a.userPrompt),function e(t,s,n,r,i){for(let a of s)switch(a.type){case tO.MessageType.MESSAGE_TOOL:continue;case tO.MessageType.MESSAGE_HUMAN:if(null!==i&&a.content===i)continue;t.push("","**User**","",a.content);continue;case tO.MessageType.MESSAGE_THINKING:t.push("","**Thinking**","",sQ(a.content));continue;case tO.MessageType.MESSAGE_SYSTEM:t.push("","**System**","",sQ(a.content));continue;case tO.MessageType.MESSAGE_AI:for(let s of(a.content.trim()&&t.push("","**Assistant**","",a.content),a.toolCalls)){if("task"===s.name){let i=n.find(e=>e.id===s.id);if(i){!function(t,s,n){let r=[],i=s.subject||s.name||"sub-agent";r.push(`**Sub-agent — ${i}**${function(e){let t=sZ(e.startedAt,e.completedAt);return t?` (${t})`:""}(s)}`),s.input&&r.push("","Input:","",s.input),e(r,s.messages,[],n,null),s.output&&r.push("","Output:","",s.output),s.error&&r.push("","Error:","",s0(s.error)),t.push("",sQ(r.join("\n")))}(t,i,r);continue}}!function(e,t,s){e.push("",`**Tool — \`${t.name}\`**${function(e){let t=[],s=function(e){switch(e){case tO.ToolCallStatus.TOOL_CALL_COMPLETED:return"completed";case tO.ToolCallStatus.TOOL_CALL_FAILED:return"failed";case tO.ToolCallStatus.TOOL_CALL_SKIPPED:return"skipped";case tO.ToolCallStatus.TOOL_CALL_INTERRUPTED:return"interrupted";case tO.ToolCallStatus.TOOL_CALL_RUNNING:return"running";case tO.ToolCallStatus.TOOL_CALL_WAITING_APPROVAL:return"waiting for approval";case tO.ToolCallStatus.TOOL_CALL_PENDING:return"pending";default:return null}}(e.status);s&&t.push(s);let n=sZ(e.startedAt,e.completedAt);return n&&t.push(n),t.length>0?` (${t.join(" · ")})`:""}(t)}`);let n=t.args?JSON.stringify(t.args,null,2):void 0;n&&"{}"!==n&&e.push("",s0(n,"json"));let r=function(e,t){let s=e.outputRef;if(!s?.storageKey)return e.result?{text:e.result}:{};if(s.isImage)return{note:`Image output (${s.mimeType||"image"}, ${Number(s.sizeBytes)} bytes) — not inlined.`};let n=t[s.storageKey];return n?.content!==void 0?{text:n.content,note:n.truncated?`Output truncated at ${n.content.length} of ${n.totalSizeBytes} bytes (server content cap).`:void 0}:{text:s.truncatedPreview||e.result||void 0,note:n?.error?`Offloaded output unavailable (${n.error}) — showing preview.`:"Offloaded output not resolved — showing preview."}}(t,s);r.note&&e.push("",`_${r.note}_`),r.text&&e.push("",s0(r.text)),t.error&&e.push("","Error:","",s0(t.error))}(t,s,r)}continue;default:a.content&&t.push("",sQ(a.content))}}(i,a.execution.status?.messages??[],a.execution.status?.subAgentExecutions??[],r,a.userPrompt);let e=a.execution.status?.error;e&&i.push("","**Execution error**","",sQ(e))}return i.push(""),i.join("\n")}function sZ(e,t){if(!e||!t)return null;let s=Date.parse(e),n=Date.parse(t);if(Number.isNaN(s)||Number.isNaN(n)||n<s)return null;let r=n-s;return r<1e3?`${r}ms`:`${(r/1e3).toFixed(1)}s`}function sQ(e){return e.split("\n").map(e=>e.length>0?`> ${e}`:">").join("\n")}function s0(e,t=""){let s=0;for(let t of e.matchAll(/`+/g))t[0].length>s&&(s=t[0].length);let n="`".repeat(Math.max(3,s+1));return`${n}${t}
2
+ ${e}
3
+ ${n}`}var s1=e.i(846696),s5=e.i(745176);function s2(e,t){let n=(0,et.useStigmer)(),r=t?.includeSuperseded===!0,[i,a]=(0,s.useState)(!1),[o,l]=(0,s.useState)(null),g=(0,s.useCallback)(()=>e?sY(n,e,{includeSuperseded:r}):Promise.reject(Error("Cannot export a transcript without a session id. Pass the session's id to useExportTranscript once the session exists.")),[n,e,r]),c=(0,s.useCallback)(async()=>{l(null),a(!0);let e=g().then(e=>sJ(e,{generatedAt:new Date().toISOString()}));try{"u">typeof ClipboardItem&&navigator.clipboard?.write?await navigator.clipboard.write([new ClipboardItem({"text/plain":e.then(e=>new Blob([e],{type:"text/plain"}))})]):await navigator.clipboard.writeText(await e),s1.toast.success("Transcript copied to clipboard")}catch(t){let e=(0,es.toError)(t);l(e),s1.toast.error(`Couldn't copy the transcript: ${e.message}`)}finally{a(!1)}},[g]),u=(0,s.useCallback)(async e=>{l(null),a(!0);try{var t;let s,n,r=await g(),{content:i,extension:a,mimeType:o}=e(r);(0,s5.downloadTextFile)(i,`${(t=r,n=(s=(0,sB.resolvedSubject)(t.session.spec?.subject))?(0,er.generateSlug)(s).slice(0,60):"",`${n||t.session.metadata?.id||"session"}-transcript`)}.${a}`,o)}catch(t){let e=(0,es.toError)(t);l(e),s1.toast.error(`Couldn't export the transcript: ${e.message}`)}finally{a(!1)}},[g]),d=(0,s.useCallback)(()=>u(e=>({content:sJ(e,{generatedAt:new Date().toISOString()}),extension:"md",mimeType:"text/markdown"})),[u]),m=(0,s.useCallback)(()=>u(e=>({content:JSON.stringify(function(e){let t=e.turns.map(e=>{let t=(0,sz.toJson)(sH.AgentExecutionSchema,e.execution,{useProtoFieldName:!0});if(null!==t&&"object"==typeof t&&!Array.isArray(t)){let e=t.status;null===e||"object"!=typeof e||Array.isArray(e)||delete e.callback_token}return{user_prompt:e.userPrompt,build_from_plan:e.isBuildFromPlan||void 0,superseded:e.superseded||void 0,in_progress:e.inProgress||void 0,execution:t}}),s={};for(let[t,n]of Object.entries(e.resolvedOutputs))s[t]={storage_key:n.storageKey,content:n.content,truncated:n.truncated||void 0,total_size_bytes:n.totalSizeBytes,mime_type:n.mimeType,is_image:n.isImage||void 0,error:n.error};return{format:"stigmer.ai/session-transcript/v1",session:(0,sz.toJson)(sK.SessionSchema,e.session,{useProtoFieldName:!0}),includes_superseded:e.includesSuperseded,turns:t,resolved_outputs:s}}(e),null,2),extension:"json",mimeType:"application/json"})),[u]);return(0,s.useMemo)(()=>({copyMarkdown:c,downloadMarkdown:d,downloadJson:m,isExporting:i,error:o}),[c,d,m,i,o])}function s4({heading:e,count:s,annotation:n,children:r}){return(0,t.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-1",children:[(0,t.jsxs)("h3",{className:"stg:px-2 stg:text-[0.65rem] stg:font-semibold stg:uppercase stg:tracking-wider stg:text-muted-foreground",children:[e,null!=s&&s>0&&(0,t.jsxs)("span",{className:"stg:ml-1 stg:text-muted-foreground-faint",children:["(",s,")"]}),n&&(0,t.jsxs)("span",{className:"stg:ml-1 stg:font-normal stg:normal-case stg:tracking-normal stg:text-muted-foreground-faint",children:["(",n,")"]})]}),r]})}function s3({children:e,meta:s,actions:r,className:i}){return(0,t.jsxs)("div",{className:(0,n.cn)("stg:group stg:flex stg:items-center stg:gap-2 stg:px-2 stg:py-1 stg:text-xs",i),children:[(0,t.jsx)("span",{className:"stg:flex stg:min-w-0 stg:flex-1 stg:items-center stg:gap-2 stg:text-foreground",children:e}),s&&(0,t.jsx)("span",{className:"stg:shrink-0 stg:text-[0.65rem] stg:text-muted-foreground",children:s}),r]})}let s6=(0,n.cn)("stg:flex stg:w-full stg:min-w-0 stg:items-center stg:gap-2 stg:px-2 stg:py-1 stg:text-left stg:text-xs stg:text-muted-foreground stg:transition-colors","stg:hover:bg-muted stg:hover:text-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50");function s8({onClick:e,label:s}){return(0,t.jsx)("button",{type:"button",onClick:e,"aria-label":s,className:(0,n.cn)("stg:flex stg:shrink-0 stg:items-center stg:text-muted-foreground stg:opacity-0 stg:transition-opacity","stg:group-hover:opacity-100 stg:focus-visible:opacity-100","stg:hover:text-destructive","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring"),children:(0,t.jsx)(ne,{})})}function s7({children:e}){return(0,t.jsx)("p",{className:"stg:px-2 stg:text-xs stg:text-muted-foreground-faint",children:e})}function s9({label:e,labelId:s,children:n}){return(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-between stg:gap-2 stg:px-2 stg:py-1 stg:text-xs",children:[(0,t.jsx)("span",{id:s,className:"stg:shrink-0 stg:text-muted-foreground",children:e}),(0,t.jsx)("span",{className:"stg:flex stg:min-w-0 stg:items-center stg:gap-1.5 stg:truncate stg:text-foreground",children:n})]})}function ne(){return(0,t.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M4 4L10 10M10 4L4 10"})})}function nt({agentRef:e,mcpServerUsages:s,skillRefs:n,sessionVariables:r,harness:i,executionTarget:a,modelId:o,autoApprove:l,sessionId:g,mutations:c,accessSlot:u}){let d=null!=r&&!r.isEmpty;return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-5",children:[(0,t.jsx)(ns,{harness:i,executionTarget:a,modelId:o,autoApprove:l}),(0,t.jsx)(nn,{agentRef:e,onRemove:c?.onRemoveAgent}),(0,t.jsx)(nr,{mcpServerUsages:s,onRemove:c?.onRemoveMcp}),(0,t.jsx)(ni,{skillRefs:n,onRemove:c?.onRemoveSkill}),d&&(0,t.jsx)(na,{entries:r.entries}),g&&(0,t.jsx)(no,{sessionId:g}),u&&(0,t.jsx)("section",{children:u})]})}function ns({harness:e,executionTarget:n,modelId:r,autoApprove:i}){let a=(0,s.useId)();return(0,t.jsxs)(s4,{heading:"Run Config",children:[(0,t.jsx)(s9,{label:"Harness",children:A.HARNESS_META[e]?.label??e}),r&&(0,t.jsx)(s9,{label:"Model",children:r}),n&&(0,t.jsx)(s9,{label:"Target",children:"local"===n?"Local":"Cloud"}),i&&(0,t.jsx)(s9,{label:"Auto-approve",labelId:a,children:(0,t.jsx)(sW.Switch,{checked:i.armed,onCheckedChange:i.onChange,"aria-labelledby":a})})]})}function nn({agentRef:e,onRemove:s}){return(0,t.jsx)(s4,{heading:"Agent",children:e?(0,t.jsx)(s3,{actions:s?(0,t.jsx)(s8,{onClick:s,label:`Remove agent ${e.slug}`}):void 0,children:(0,t.jsx)("span",{className:"stg:truncate",children:e.slug})}):(0,t.jsx)(s3,{meta:"built-in",children:(0,t.jsx)("span",{className:"stg:truncate",children:sB.BUILT_IN_ASSISTANT_NAME})})})}function nr({mcpServerUsages:e,onRemove:s}){return(0,t.jsx)(s4,{heading:"MCP Servers",count:e.length,children:e.length>0?e.map(e=>{let n=e.mcpServerRef.slug,r=e.enabledTools?.length;return(0,t.jsx)(s3,{meta:null!=r&&r>0?`${r} tool${1!==r?"s":""}`:void 0,actions:s?(0,t.jsx)(s8,{onClick:()=>s(e.mcpServerRef),label:`Remove MCP server ${n}`}):void 0,children:(0,t.jsx)("span",{className:"stg:truncate",children:n})},`${e.mcpServerRef.org}/${n}`)}):(0,t.jsx)(s7,{children:"No MCP servers attached."})})}function ni({skillRefs:e,onRemove:s}){return(0,t.jsx)(s4,{heading:"Skills",count:e.length,children:e.length>0?e.map(e=>(0,t.jsx)(s3,{actions:s?(0,t.jsx)(s8,{onClick:()=>s(e),label:`Remove skill ${e.slug}`}):void 0,children:(0,t.jsx)("span",{className:"stg:truncate",children:e.slug})},`${e.org}/${e.slug}`)):(0,t.jsx)(s7,{children:"No skills attached."})})}function na({entries:e}){return(0,t.jsx)(s4,{heading:"Session Variables",annotation:"next message only",children:e.map(e=>(0,t.jsx)(s3,{meta:e.isSecret?"********":(0,t.jsx)("span",{className:"stg:inline-block stg:max-w-[140px] stg:truncate stg:align-bottom",children:e.value}),children:(0,t.jsx)("span",{className:"stg:truncate stg:font-medium",children:e.key||"(unnamed)"})},e.id))})}function no({sessionId:e}){let s=s2(e);return(0,t.jsxs)(s4,{heading:"Transcript",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>void s.copyMarkdown(),disabled:s.isExporting,className:s6,children:[(0,t.jsx)(s$.Copy,{className:"stg:size-3.5 stg:shrink-0","aria-hidden":"true"}),"Copy transcript"]}),(0,t.jsxs)("button",{type:"button",onClick:()=>void s.downloadMarkdown(),disabled:s.isExporting,className:s6,children:[(0,t.jsx)(sU,{className:"stg:size-3.5 stg:shrink-0","aria-hidden":"true"}),"Download Markdown"]}),(0,t.jsxs)("button",{type:"button",onClick:()=>void s.downloadJson(),disabled:s.isExporting,className:s6,children:[(0,t.jsx)(sV,{className:"stg:size-3.5 stg:shrink-0","aria-hidden":"true"}),"Download JSON"]})]})}var nl=e.i(482389),ng=e.i(676951),nc=e.i(364802),nu=e.i(193799);let nd=/^(\d+) files? changed(?:, (\d+) insertions?\(\+\))?(?:, (\d+) deletions?\(-\))?$/;function nm(e){let t=e.split("\n");for(let e=t.length-1;e>=0;e--){let s=t[e].trim();if(s)return s}return null}let nh=/^https?:\/\/[^/]+\/([^/]+)\/([^/]+)\/pull\/\d+/;function np({writeBack:e,className:s}){let r=e.phase===nl.WorkspaceWriteBackPhase.WORKSPACE_WRITE_BACK_FAILED,i=!!e.pullRequestUrl,a=function(e){if(e.workspaceEntryName)return e.workspaceEntryName;let t=nh.exec(e.pullRequestUrl);return t?`${t[1]}/${t[2]}`:"Workspace"}(e);return(0,t.jsxs)("div",{role:"article","aria-label":`Write-back: ${a}`,className:(0,n.cn)("stg:flex stg:flex-col",s),children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:px-2 stg:py-1",children:[(0,t.jsx)(nc.TruncatedText,{text:a,className:"stg:min-w-0 stg:flex-1 stg:text-xs stg:font-medium stg:text-foreground"}),(0,t.jsx)(nf,{phase:e.phase,pullRequestNumber:e.pullRequestNumber})]}),i&&(0,t.jsx)(nx,{url:e.pullRequestUrl,number:e.pullRequestNumber}),e.branchName&&(0,t.jsx)(nv,{branchName:e.branchName,baseBranch:e.baseBranch}),e.error&&(0,t.jsx)("div",{className:(0,n.cn)("stg:mx-2 stg:my-1 stg:rounded stg:px-2 stg:py-1 stg:text-xs",r?"stg:bg-destructive-subtle stg:text-destructive":"stg:bg-status-degraded-subtle stg:text-status-degraded"),children:e.error}),e.diffSummary&&(0,t.jsx)(nb,{diffSummary:e.diffSummary})]})}function nf({phase:e,pullRequestNumber:s}){let r;switch(e){case nl.WorkspaceWriteBackPhase.WORKSPACE_WRITE_BACK_COMMITTED:r="Committed";break;case nl.WorkspaceWriteBackPhase.WORKSPACE_WRITE_BACK_PUSHED:r="Pushed";break;case nl.WorkspaceWriteBackPhase.WORKSPACE_WRITE_BACK_PR_CREATED:r=s>0?`PR #${s}`:"PR created";break;case nl.WorkspaceWriteBackPhase.WORKSPACE_WRITE_BACK_FAILED:r="Failed";break;default:return null}return(0,t.jsx)("span",{className:(0,n.cn)("stg:shrink-0 stg:text-[10px] stg:font-medium stg:tabular-nums",e===nl.WorkspaceWriteBackPhase.WORKSPACE_WRITE_BACK_FAILED?"stg:text-destructive":"stg:text-muted-foreground"),children:r})}function nx({url:e,number:s}){return(0,t.jsxs)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:(0,n.cn)("stg:group stg:flex stg:items-center stg:gap-2 stg:px-2 stg:py-1 stg:text-xs stg:text-muted-foreground stg:transition-colors","stg:hover:bg-muted stg:hover:text-foreground",nj),children:[(0,t.jsx)("span",{className:"stg:shrink-0",children:(0,t.jsx)(nk,{})}),(0,t.jsx)("span",{className:"stg:min-w-0 stg:flex-1 stg:truncate stg:text-foreground",children:s>0?`Pull Request #${s}`:"Pull Request"}),(0,t.jsx)("span",{className:"stg:shrink-0 stg:opacity-0 stg:transition-opacity stg:group-hover:opacity-100 stg:group-focus-visible:opacity-100","aria-hidden":"true",children:(0,t.jsx)(nw,{})})]})}function nv({branchName:e,baseBranch:r}){let{copy:i,copied:o}=(0,nu.useCopyFeedback)(),l=(0,s.useCallback)(()=>{i(e)},[i,e]);return(0,t.jsxs)("div",{className:"stg:group stg:flex stg:items-stretch",children:[(0,t.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:flex-1 stg:items-center stg:gap-2 stg:px-2 stg:py-1 stg:text-xs",children:[(0,t.jsx)("span",{className:"stg:shrink-0 stg:text-muted-foreground",children:(0,t.jsx)(ny,{})}),(0,t.jsx)(nc.TruncatedText,{text:e,className:"stg:min-w-0 stg:font-mono stg:text-foreground"}),r&&(0,t.jsxs)("span",{className:"stg:shrink-0 stg:font-mono stg:text-muted-foreground-faint",children:["← ",r]})]}),(0,t.jsxs)(a.Tooltip,{children:[(0,t.jsx)(a.TooltipTrigger,{render:(0,t.jsx)("button",{type:"button",onClick:l,"aria-label":o?"Branch name copied":`Copy branch name ${e}`,className:(0,n.cn)("stg:flex stg:shrink-0 stg:items-center stg:px-2 stg:text-muted-foreground stg:transition-opacity",o?"stg:opacity-100":"stg:opacity-0 stg:group-hover:opacity-100 stg:focus-visible:opacity-100","stg:hover:text-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring")}),children:o?(0,t.jsx)(nN,{}):(0,t.jsx)(nS,{})}),(0,t.jsx)(a.TooltipContent,{side:"top",children:o?"Copied":"Copy branch name"})]})]})}function nb({diffSummary:e}){let s=function(e){let t=nm(e);if(null===t)return null;let s=nd.exec(t);return s?{filesChanged:Number(s[1]),insertions:Number(s[2]??0),deletions:Number(s[3]??0)}:null}(e);if(s)return(0,t.jsx)(ng.DiffSummary,{fileCount:s.filesChanged,additions:s.insertions,deletions:s.deletions,className:"stg:px-2 stg:py-1"});let n=nm(e);return n?(0,t.jsx)("div",{className:"stg:px-2 stg:py-1 stg:font-mono stg:text-xs stg:text-muted-foreground",children:n}):null}let nj="stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring";function ny(){return(0,t.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"4",cy:"3.5",r:"1.5"}),(0,t.jsx)("circle",{cx:"4",cy:"10.5",r:"1.5"}),(0,t.jsx)("circle",{cx:"10",cy:"5.5",r:"1.5"}),(0,t.jsx)("path",{d:"M4 5V9"}),(0,t.jsx)("path",{d:"M10 7V5.5"}),(0,t.jsx)("path",{d:"M4 5C4 5 4 7 7 7C10 7 10 5.5 10 5.5"})]})}function nk(){return(0,t.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"3.5",cy:"3.5",r:"1.5"}),(0,t.jsx)("circle",{cx:"3.5",cy:"10.5",r:"1.5"}),(0,t.jsx)("circle",{cx:"10.5",cy:"10.5",r:"1.5"}),(0,t.jsx)("path",{d:"M3.5 5V9"}),(0,t.jsx)("path",{d:"M7 3.5H8.5C9.6 3.5 10.5 4.4 10.5 5.5V9"})]})}function nw(){return(0,t.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M9 3L3 9"}),(0,t.jsx)("path",{d:"M5 3H9V7"}),(0,t.jsx)("path",{d:"M9 8V10H2V3H4"})]})}function nS(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"4",y:"4",width:"6.5",height:"6.5",rx:"1"}),(0,t.jsx)("path",{d:"M8 4V2.5C8 1.95 7.55 1.5 7 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V7C1.5 7.55 1.95 8 2.5 8H4"})]})}function nN(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M2.5 6.5L5 9L9.5 3.5"})})}function nC({executions:e,expectsWriteBack:s=!1,isSettled:n=!1}){let{writeBacks:r,hasWriteBacks:i}=sD(e);return i?(0,t.jsx)("ul",{role:"list",className:`${X.UNSTYLED_LIST} stg:flex stg:flex-col stg:gap-3`,children:r.map(e=>(0,t.jsx)("li",{children:(0,t.jsx)(np,{writeBack:e.writeBack})},e.writeBack.workspaceEntryName))}):s?(0,t.jsx)("div",{className:"stg:flex stg:flex-col stg:items-center stg:justify-center stg:px-4 stg:py-8 stg:text-center",children:(0,t.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:n?"No changes have been pushed yet. When the agent changes files and you approve them, they are pushed to a branch and pull request here.":"Changes stay in the session workspace while you review them. Approved changes are pushed to a branch and pull request here."})}):(0,t.jsx)("div",{className:"stg:flex stg:flex-col stg:items-center stg:justify-center stg:px-4 stg:py-8 stg:text-center",children:(0,t.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"No changes yet. Pull requests will appear here once the agent pushes its work back to your repository."})})}var nE=e.i(415400);function nR(e,t=!1){return{name:e.name,tooltip:e.sandboxPath||e.name,subtitlePath:t&&e.sandboxPath?function(e){let t=e.lastIndexOf("/");if(t<=0)return null;let s=e.slice(0,t),n=s.slice(s.lastIndexOf("/")+1);return n?`${n}/`:null}(e.sandboxPath):null,sizeBytes:e.sizeBytes,isDirectory:e.kind===tO.ExecutionArtifactKind.DIRECTORY}}e.s(["fromArtifact",0,function(e,t=!1){let s=e.spec?.displayName||e.metadata?.name||"Unnamed",n=e.spec?.source?.taskName??"";return{name:s,tooltip:s,subtitlePath:t&&n?n:null,sizeBytes:e.status?.sizeBytes??BigInt(0),isDirectory:!1}},"fromExecutionArtifact",0,nR],262045);var nA=e.i(879049),nT=e.i(432814);function nM({item:e,onOpen:s,onActivate:r,onDownload:i,isDownloading:o,className:l}){return(0,t.jsxs)("li",{className:(0,n.cn)("stg:group stg:flex stg:items-stretch",l),children:[(0,t.jsxs)(a.Tooltip,{children:[(0,t.jsxs)(a.TooltipTrigger,{render:(0,t.jsx)("button",{type:"button",onClick:s,onDoubleClick:r,className:(0,n.cn)("stg:flex stg:min-w-0 stg:flex-1 stg:items-center stg:gap-2 stg:px-2 stg:py-1 stg:text-left stg:text-xs stg:text-muted-foreground stg:transition-colors","stg:hover:bg-muted stg:hover:text-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring")}),children:[(0,t.jsx)("span",{className:"stg:shrink-0 stg:text-muted-foreground",children:e.isDirectory?(0,t.jsx)(nA.FolderTypeIcon,{open:!1}):(0,t.jsx)(nA.FileTypeIcon,{fileName:e.name})}),(0,t.jsxs)("span",{className:"stg:min-w-0 stg:flex-1 stg:truncate stg:text-foreground",children:[e.name,e.isDirectory&&"/",e.subtitlePath&&(0,t.jsx)("span",{className:"stg:ml-1.5 stg:text-[0.65rem] stg:text-muted-foreground",children:e.subtitlePath})]}),(0,t.jsx)("span",{className:"stg:shrink-0 stg:tabular-nums stg:text-[0.65rem] stg:text-muted-foreground-faint",children:(0,nT.formatArtifactSize)(e.sizeBytes)})]}),(0,t.jsx)(a.TooltipContent,{side:"top",className:"stg:break-all",children:e.tooltip})]}),(0,t.jsxs)(a.Tooltip,{children:[(0,t.jsx)(a.TooltipTrigger,{render:(0,t.jsx)("span",{className:"stg:flex stg:shrink-0"}),children:(0,t.jsx)("button",{type:"button",onClick:i,disabled:o,"aria-label":o?`Preparing ${e.name}`:`Download ${e.name}`,className:(0,n.cn)("stg:flex stg:shrink-0 stg:items-center stg:px-2 stg:text-muted-foreground stg:opacity-0 stg:transition-opacity","stg:group-hover:opacity-100 stg:focus-visible:opacity-100","stg:hover:text-foreground stg:disabled:opacity-50","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring"),children:(0,t.jsx)(nI,{})})}),(0,t.jsx)(a.TooltipContent,{side:"top",children:e.isDirectory?"Download ZIP":"Download"})]})]})}function nI(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M6 1.5V8.5"}),(0,t.jsx)("path",{d:"M3 6L6 9L9 6"}),(0,t.jsx)("path",{d:"M2 10.5H10"})]})}e.s(["ArtifactRowView",0,nM],337249);var nL=e.i(835992);function nP({artifact:e,executionId:n,hasNameCollision:r=!1,onOpen:i,onActivate:a,className:o}){let{download:l,isDownloading:g}=(0,nL.useArtifactDownload)(n),c=(0,s.useMemo)(()=>nR(e,r),[e,r]);return(0,t.jsx)(nM,{item:c,onOpen:i,onActivate:a,onDownload:()=>l(e.storageKey,e.name),isDownloading:g,className:o})}var nO=e.i(848681);function nF({executions:e,org:n,onApplied:r,onImplementPlan:i,onOpenPlan:a,onOpenArtifact:o,onActivateArtifact:l}){let{artifacts:g,hasArtifacts:c}=sO(e),[u,d]=(0,s.useState)(null),m=(0,s.useCallback)(e=>{a&&(0,nO.isPlanArtifact)(e.artifact)?a(e.executionId):o?o(e):d(e)},[a,o]),h=(0,s.useCallback)(e=>{a&&(0,nO.isPlanArtifact)(e.artifact)?a(e.executionId):l?.(e)},[a,l]),p=(0,s.useCallback)(()=>{d(null)},[]);return c?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("ul",{role:"list",className:`${X.UNSTYLED_LIST} stg:flex stg:flex-col`,children:g.map(e=>(0,t.jsx)(nP,{artifact:e.artifact,executionId:e.executionId,hasNameCollision:e.hasNameCollision,onOpen:()=>m(e),onActivate:l?()=>h(e):void 0},sP(e.artifact)))}),u&&(0,t.jsx)(nE.ArtifactPreviewModal,{artifact:u.artifact,executionId:u.executionId,isTerminal:u.isTerminal,org:n,open:!0,onClose:p,onApplied:r,onImplement:(0,nO.isPlanArtifact)(u.artifact)?i:void 0})]}):(0,t.jsx)("div",{className:"stg:flex stg:flex-col stg:items-center stg:justify-center stg:px-4 stg:py-8 stg:text-center",children:(0,t.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"No artifacts yet. Files generated by the agent will appear here."})})}var nD=e.i(186641),nB=e.i(635025);function n$({executions:e}){let s=(0,nD.useSessionUsage)(e);return s.hasUsage?(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-5",children:[(0,t.jsx)(nB.UsageWidget,{executions:e}),s.executionBreakdown.length>0&&(0,t.jsx)(n_,{entries:s.executionBreakdown,executions:e})]}):(0,t.jsx)("div",{className:"stg:flex stg:flex-col stg:items-center stg:justify-center stg:px-4 stg:py-8 stg:text-center",children:(0,t.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"No usage data yet. Cost and token stats will appear here."})})}function n_({entries:e,executions:s}){return(0,t.jsx)(s4,{heading:"Models per run",children:(0,t.jsx)("div",{role:"list","aria-label":"Per-execution model and tier",className:"stg:flex stg:flex-col",children:e.map((e,n)=>{let r=function(e,t){let s=e.find(e=>e.metadata?.id===t);switch(s?.status?.streamingUsage?.requestedServiceTier){case tO.ServiceTier.FAST:return"fast";case tO.ServiceTier.STANDARD:return"standard";default:return null}}(s,e.executionId);return(0,t.jsxs)("div",{className:"stg:flex stg:items-baseline stg:justify-between stg:gap-2 stg:px-2 stg:py-1 stg:text-xs",role:"listitem",children:[(0,t.jsxs)("span",{className:"stg:min-w-0 stg:truncate stg:text-foreground",children:[(0,t.jsxs)("span",{className:"stg:tabular-nums stg:text-muted-foreground",children:["#",n+1]})," ",e.resolvedModel||"—",r&&(0,t.jsxs)(nV,{children:[r," requested"]}),e.isEstimated&&(0,t.jsx)(nV,{children:"Estimated"})]}),(0,t.jsx)("span",{className:"stg:shrink-0 stg:tabular-nums stg:text-[0.65rem] stg:text-muted-foreground",children:(0,nB.formatCost)(e.billableCostUsd)})]},e.executionId)})})})}function nV({children:e}){return(0,t.jsx)("span",{className:"stg:ml-1 stg:rounded stg:bg-muted stg:px-1 stg:py-0.5 stg:text-[0.6rem] stg:font-medium stg:leading-none stg:text-muted-foreground",children:e})}function nU({allExecutions:e,org:n,sessionConfig:r,onApplied:i,onImplementPlan:a,onOpenPlan:o,onOpenArtifact:l,onActivateArtifact:g,includeExecutionFacets:c=!0,expectsWriteBack:u=!1,changesSettled:d=!1}){let{hasWriteBacks:m,writeBackCount:h}=sD(e),{hasArtifacts:p,artifactCount:f}=sO(e);return(0,s.useMemo)(()=>{let s=[];return r&&s.push({id:"configure",label:"Config",icon:(0,t.jsx)(nW,{}),content:(0,t.jsx)(nt,{...r})}),c&&((m||u)&&s.push({id:"changes",label:"Changes",icon:(0,t.jsx)(nz,{}),badge:h>0?h:void 0,content:(0,t.jsx)(nC,{executions:e,expectsWriteBack:u,isSettled:d})}),p&&s.push({id:"artifacts",label:"Artifacts",icon:(0,t.jsx)(nH,{}),badge:f,content:(0,t.jsx)(nF,{executions:e,org:n,onApplied:i,onImplementPlan:a,onOpenPlan:o,onOpenArtifact:l,onActivateArtifact:g})}),s.push({id:"usage",label:"Usage",icon:(0,t.jsx)(nK,{}),content:(0,t.jsx)(n$,{executions:e})})),s},[r,c,u,d,m,h,p,f,e,n,i,a,o,l,g])}function nW(){return(0,t.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"3"}),(0,t.jsx)("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33h.01a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51h.01a1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82v.01a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}function nz(){return(0,t.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"6",cy:"6",r:"2.5"}),(0,t.jsx)("circle",{cx:"6",cy:"18",r:"2.5"}),(0,t.jsx)("circle",{cx:"18",cy:"8",r:"2.5"}),(0,t.jsx)("path",{d:"M6 8.5v7"}),(0,t.jsx)("path",{d:"M18 10.5a7 7 0 0 1-7 5H8.5"})]})}function nH(){return(0,t.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M21 8l-9-5-9 5v8l9 5 9-5z"}),(0,t.jsx)("path",{d:"M3 8l9 5 9-5"}),(0,t.jsx)("path",{d:"M12 13v9"})]})}function nK(){return(0,t.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M3 20h18"}),(0,t.jsx)("path",{d:"M6 20v-6"}),(0,t.jsx)("path",{d:"M11 20V9"}),(0,t.jsx)("path",{d:"M16 20v-9"}),(0,t.jsx)("path",{d:"M21 20V5"})]})}function nq({isOpen:e,onToggle:r,badgeCount:i}){let o=!e&&null!=i&&i>0,l=(0,s.useRef)(null),g=(0,s.useRef)(e);return(0,s.useEffect)(()=>{g.current&&!e&&document.activeElement===document.body&&l.current?.focus(),g.current=e},[e]),(0,t.jsxs)(a.Tooltip,{children:[(0,t.jsxs)(a.TooltipTrigger,{render:(0,t.jsx)("button",{ref:l,type:"button",onClick:r,"aria-expanded":e,"aria-label":e?"Hide panel":"Show panel",className:(0,n.cn)("stg:flex stg:items-center stg:gap-1.5 stg:rounded-md stg:border stg:border-border stg:bg-card stg:px-1.5 stg:py-1","stg:text-muted-foreground stg:transition-colors stg:hover:bg-muted stg:hover:text-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring")}),children:[o&&(0,t.jsx)("span",{"aria-label":`${i} new items`,className:"stg:inline-flex stg:min-w-[1rem] stg:items-center stg:justify-center stg:rounded-full stg:bg-primary stg:px-1 stg:py-px stg:text-[10px] stg:font-medium stg:leading-none stg:text-primary-foreground",children:i}),(0,t.jsx)(nY,{open:e})]}),(0,t.jsx)(a.TooltipContent,{side:"top",children:e?"Hide panel":"Show panel"})]})}function nY({open:e}){return(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"}),(0,t.jsx)("path",{d:"M9.5 2.5v11"}),e&&(0,t.jsx)("rect",{x:"9.5",y:"2.5",width:"5",height:"11",rx:"1.5",fill:"currentColor",stroke:"none"})]})}function nG({onTurnOff:e}){return(0,t.jsxs)("div",{role:"status",className:"stg:flex stg:items-center stg:gap-2 stg:border-t stg:border-border-muted stg:px-4 stg:py-1.5 stg:text-xs stg:text-muted-foreground",children:[(0,t.jsx)(nX,{}),(0,t.jsx)("span",{className:"stg:min-w-0 stg:flex-1 stg:truncate",children:"Auto-approving tool calls for this session"}),(0,t.jsx)("button",{type:"button",onClick:e,className:"stg:shrink-0 stg:rounded stg:font-medium stg:text-foreground stg:underline-offset-2 stg:hover:underline stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",children:"Turn off"})]})}function nX(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0 stg:text-success","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"}),(0,t.jsx)("path",{d:"m9 12 2 2 4-4"})]})}e.s(["PanelChip",0,nq],524067),e.s(["NewSessionViewer",0,function({org:e,onSessionCreated:n,onError:i,gitHubConnection:a,enableGitHub:o=!0,enableLocal:l=!1,onBrowseLocalFolder:g,workspaceFileLister:c,workspaceFileReader:u,workspaceContentSearcher:d,getRuntimeEnv:m,audience:h="integrator",runConfig:p,showModelSelector:f=!0,panel:x="auto",defaultPanelOpen:v,panelOpen:b,onPanelOpenChange:j,defaultHarness:y,accountDefaults:k,initialAgentRef:w,initialInstanceId:S,initialAttachments:N,heading:C="What would you like to work on?",placeholder:E="Describe what you need help with…",initialRows:R=3,autoFocus:T=!0,footerContent:M,className:I}){let L=function(e){let{org:t,onSessionCreated:n,onError:i,getRuntimeEnv:a,defaultHarness:o,metadata:l,sessionContext:g}=e,c="guest"===e.audience,u=c?void 0:e.accountDefaults,d=c?void 0:e.runConfig;d&&sE(d);let m=d?.modelName,h=d?.serviceTier,p=d?.thinkingMode,f=(0,sw.useExecutionTarget)(),x=e.executionTarget??f,v=(0,sN.useRunnerAdapter)(),b=(0,sS.useApprovalDefaults)(),[j,y]=(0,s.useState)(null),k=j??(!c&&((u?.autoApprove??!1)||(b?.autoApproveAll??!1))),[w,S]=(0,s.useState)(()=>{if(c)return"cursor";let e=localStorage.getItem(sR);return"native"===e||"cursor"===e?e:u?.harness??o??A.DEFAULT_HARNESS}),N=(0,s.useRef)(!1);(0,s.useEffect)(()=>{let e=u?.harness;c||N.current||!e||localStorage.getItem(sR)||S(e)},[c,u?.harness]);let C=(0,et.useStigmer)(),{getModel:E,isLoading:R}=(0,V.useModelRegistry)({harness:w}),{create:T}=(0,sk.useCreateAgentExecution)(),M=(0,sb.useWorkspaceEntries)(),I=sy(),[L,P]=(0,s.useState)(void 0),[O,F]=(0,s.useState)(null),[D,B]=(0,s.useState)(null),[$,U]=(0,s.useState)([]),[W,z]=(0,s.useState)([]),[H,K]=(0,s.useState)(!1),[q,Y]=(0,s.useState)(null),G=L&&E(L)?L:void 0,X="cursor"===w?u?.cursorModel:u?.nativeModel,J=X&&E(X)?X:void 0,Z=G??J,Q=(0,s.useCallback)(e=>{if(N.current=!0,S(e),c)return;localStorage.setItem(sR,e);let t=localStorage.getItem(sA(e));P(t?(0,_.parseModelKey)(t)?.modelId??t:void 0)},[c]);(0,s.useEffect)(()=>{if(c||R)return;let e=localStorage.getItem(sA(w));if(e){let t=(0,_.parseModelKey)(e)?.modelId??e;E(t)&&P(t)}},[E,w,c,R]),(0,s.useEffect)(()=>{if(!c&&L){let e=(0,_.parseModelKey)(L)?.modelId??L;localStorage.setItem(sA(w),e)}},[L,w,c]);let ee=(0,s.useCallback)(async(e,s,o)=>{if(!H){if(!t){let e="Select an organization before starting a session.";Y(e),i?.(e);return}K(!0),Y(null);try{let r,i,u=a?await sC(a,o?.runtimeEnv):o?.runtimeEnv,d={workspaceEntries:M.hasEntries?M.toInput():void 0,mcpServerUsages:$.length>0?$:void 0,skillRefs:W.length>0?W:void 0,metadata:l,sessionContext:g,harness:w,executionTarget:x},f={org:t,message:e,modelName:m??s??Z,runtimeEnv:u,attachments:o?.attachments,interactionMode:o?.interactionMode,serviceTier:m?"fast"===h?"fast":void 0:o?.serviceTier,thinkingMode:m?"enabled"===p?"enabled":void 0:o?.thinkingMode,workspaceFileRefs:o?.workspaceFileRefs,autoApproveAll:k||void 0};if(O&&D)"saved"===D.mode?r=D.instanceId:i=(await C.agent.getByReference(O)).metadata.id;else if(c)throw Error("This agent is still loading. Please try again in a moment.");let{sessionId:b}=await T({...f,agentId:i,sessionSpec:{...d,agentInstanceId:r}});v&&"local"===x&&await v.onSessionOpened(b),I.clear(),n(b)}catch(t){let e=(0,r.getUserMessage)(t,"Failed to start session");Y(e),i?.(e)}finally{K(!1)}}},[H,t,c,w,x,k,v,a,Z,m,h,p,M,$,W,l,g,O,D,C.agent,T,I,n,i]);return{harness:w,setHarness:Q,modelId:Z,setModelId:P,agentRef:O,setAgentRef:F,resolution:D,setResolution:B,mcpServerUsages:$,setMcpServerUsages:U,skillRefs:W,setSkillRefs:z,workspace:M,sessionVariables:I,autoApproveAll:k,setAutoApproveAll:y,isSubmitting:H,submitError:q,submit:ee}}({org:e,onSessionCreated:n,onError:i,getRuntimeEnv:m,defaultHarness:y,accountDefaults:k,audience:h,runConfig:p}),[P,O]=(0,s.useState)("agent"),F="guest"===h,D=f&&!F&&p?.modelName===void 0,B="integrator"!==h,$="none"!==x&&!F,{setAgentRef:U,setResolution:W}=L;(0,s.useEffect)(()=>{F&&w&&S&&(U(w),W({mode:"saved",instanceId:S}))},[F,w,S,U,W]);let z=sF({phase:null,hasChanges:!1,defaultView:"configure",open:!!$&&b,defaultOpen:v,onOpenChange:$?j:void 0}),{editors:H,activeKey:K,activeFile:q,reveal:Y}=(0,tl.useWorkspaceEditors)(z.editorsStore),G=Y&&Y.key===K?Y:void 0,X=(0,s.useCallback)(()=>{L.setAgentRef(null),L.setResolution(null)},[L.setAgentRef,L.setResolution]),J=(0,s.useCallback)(e=>{L.setMcpServerUsages(L.mcpServerUsages.filter(t=>t.mcpServerRef.org!==e.org||t.mcpServerRef.slug!==e.slug))},[L.mcpServerUsages,L.setMcpServerUsages]),Z=(0,s.useCallback)(e=>{L.setSkillRefs(L.skillRefs.filter(t=>t.org!==e.org||t.slug!==e.slug))},[L.skillRefs,L.setSkillRefs]),Q=nU({allExecutions:[],org:e,sessionConfig:(0,s.useMemo)(()=>({agentRef:L.agentRef,mcpServerUsages:L.mcpServerUsages,skillRefs:L.skillRefs,sessionVariables:L.sessionVariables,harness:L.harness,executionTarget:void 0,modelId:L.modelId,autoApprove:F?void 0:{armed:L.autoApproveAll,onChange:L.setAutoApproveAll},mutations:B?void 0:{onRemoveAgent:L.agentRef?X:void 0,onRemoveMcp:J,onRemoveSkill:Z}}),[L.agentRef,L.mcpServerUsages,L.skillRefs,L.sessionVariables,L.harness,L.modelId,L.autoApproveAll,L.setAutoApproveAll,F,B,X,J,Z]),includeExecutionFacets:!1}),ee=l&&!!g,es=(0,s.useCallback)(async()=>{let e=await g?.();e&&L.workspace.addLocalPath(e)},[g,L.workspace.addLocalPath]),en=(0,t.jsx)("div",{className:"stg:flex stg:h-full stg:flex-col stg:items-center stg:overflow-y-auto stg:px-4 stg:py-6",children:(0,t.jsxs)("div",{className:"stg:my-auto stg:w-full stg:max-w-2xl stg:space-y-6",children:[(0,t.jsx)("h1",{className:"stg:text-center stg:text-lg stg:font-medium stg:text-foreground",children:C}),(0,t.jsx)(tn,{onSubmit:L.submit,isSubmitting:L.isSubmitting,org:e,workspace:F?void 0:L.workspace,gitHubConnection:o&&!F?a:void 0,enableGitHub:o&&!F,enableLocal:l&&!F,onBrowseLocalFolder:g,agentRef:L.agentRef,onAgentRefChange:F?void 0:L.setAgentRef,onAgentResolutionChange:F?void 0:L.setResolution,initialAgentRef:F?void 0:w,initialInstanceId:F?void 0:S,initialAttachments:F?void 0:N,lockAgent:B&&null!=w,mcpServerUsages:B?void 0:L.mcpServerUsages,onMcpServerUsagesChange:B?void 0:L.setMcpServerUsages,skillRefs:B?void 0:L.skillRefs,onSkillRefsChange:B?void 0:L.setSkillRefs,sessionVariables:B?void 0:L.sessionVariables,showHarnessSelector:!F,harness:L.harness,onHarnessChange:L.setHarness,interactionMode:P,onInteractionModeChange:O,showInteractionModePicker:!F,showModelSelector:D,enableAttachments:!F,defaultModelId:L.modelId,onModelChange:L.setModelId,placeholder:E,initialRows:R,autoFocus:T,ariaLabel:"Start a new session"}),!F&&L.autoApproveAll&&(0,t.jsx)(nG,{onTurnOff:()=>L.setAutoApproveAll(!1)}),M,(0,t.jsx)("p",{className:"stg:text-center stg:text-[0.65rem] stg:text-muted-foreground",children:"Press Enter to send, Shift+Enter for a new line"})]})});return(0,t.jsx)(to,{className:I,resizeAriaLabel:"Resize composer panel",splitStorageKey:"stgm-new-session-chat-width",chip:$?(0,t.jsx)(nq,{isOpen:z.isOpen,onToggle:z.isOpen?z.closePanel:z.openPanel}):void 0,conversation:en,panel:z.isOpen&&$?(0,t.jsx)(sn,{entries:L.workspace.entries,lister:c,reader:u,searcher:d,view:z.view,onViewChange:z.setView,extraViews:Q,onRemoveEntry:L.workspace.remove,onAddLocalFolder:ee?es:void 0,editors:H,selectedFile:q,onOpenFile:z.openFile,onActivateEditor:z.activateEditor,onPinEditor:z.pinEditor,onCloseEditor:z.closeEditor,onCollapse:z.closePanel,reveal:G,className:"stg:h-full"}):null})}],275051);var nJ=e.i(791418);function nZ(e){return e.replace(/\\/g,"/").replace(/^\/+/,"")}function nQ(e,t){return t?e===t?"":e.startsWith(t+"/")?e.slice(t.length+1):null:null}function n0(e,t,s){if(!e||0===t.length)return null;let n=nZ(e);if(s){let e=nQ(n,nZ(s));null!==e&&(n=e)}if(!n||"."===n||"platform"===(0,nJ.classifyPath)(n).kind)return null;let r=t.length>1;for(let e of t){let t=null;if("local"===e.type&&e.localPath?t=nZ(e.localPath):"git"===e.type&&r&&(t=nZ(e.name)),null===t)continue;let s=nQ(n,t);if(""===s)return null;if(s)return{entryId:e.id,path:s}}return 1===t.length?{entryId:t[0].id,path:n}:null}var n1=e.i(226634),n5=e.i(222898),n2=e.i(163568);let n4=(0,s.memo)(function({progress:e,className:r}){let[i,a]=(0,s.useState)(!1);if(!e||0===e.filesChanged)return null;let{filesChanged:o,linesAdded:l,linesRemoved:g,entries:c}=e,u=o-c.length;return(0,t.jsxs)("div",{role:"region","aria-label":"File changes in progress","data-cursor-target":"file-change-progress-bar",className:(0,n.cn)("stg:border-t stg:border-border-muted stg:px-4 stg:py-2",r),children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>a(e=>!e),"aria-expanded":i,className:"stg:flex stg:min-w-0 stg:flex-1 stg:items-center stg:gap-2 stg:text-left stg:text-xs stg:text-muted-foreground stg:hover:text-foreground",children:[(0,t.jsx)("span",{"aria-hidden":"true",className:(0,n.cn)("stg:shrink-0 stg:transition-transform",i&&"stg:rotate-90"),children:"▸"}),(0,t.jsxs)("span",{"aria-live":"polite",className:"stg:min-w-0 stg:truncate",children:[o," ",1===o?"file":"files"," changing…"]})]}),(0,t.jsx)(n5.FileLineStats,{linesAdded:l,linesRemoved:g})]}),i&&(0,t.jsxs)("ul",{className:(0,n.cn)(X.UNSTYLED_LIST,"stg:mt-2 stg:max-h-[30vh] stg:space-y-1 stg:overflow-y-auto"),children:[c.map(e=>{let s=e.pathAfter||e.pathBefore;return(0,t.jsxs)("li",{className:"stg:flex stg:items-center stg:gap-2",children:[(0,t.jsx)(n5.FileKindBadge,{kind:e.kind}),(0,t.jsx)(n2.FilePathLink,{path:s,dirDisplay:"dim",className:"stg:min-w-0 stg:flex-1 stg:text-xs"}),(0,t.jsx)(n5.FileLineStats,{linesAdded:e.linesAdded,linesRemoved:e.linesRemoved})]},s)}),u>0&&(0,t.jsxs)("li",{className:"stg:text-xs stg:text-muted-foreground-faint",children:["… and ",u," more"]})]})]})});var n3=e.i(372063);function n6({changeSets:e,onSubmit:s,submittingDecisionKeys:r,decisionErrors:i,className:a}){return 0===e.length?null:(0,t.jsx)("div",{role:"region","aria-label":"File changes awaiting review","data-cursor-target":"file-review-dock",className:(0,n.cn)("stg:border-t stg:border-border-muted",a),children:(0,t.jsx)("div",{className:"stg:max-h-[40vh] stg:space-y-2 stg:overflow-y-auto stg:px-4 stg:py-2",children:e.map(e=>(0,t.jsx)(n8,{changeSet:e,onSubmit:s,submittingDecisionKeys:r,decisionErrors:i},e.id))})})}let n8=(0,s.memo)(function({changeSet:e,onSubmit:n,submittingDecisionKeys:r,decisionErrors:i}){let a=(0,s.useCallback)((t,s)=>{n(e.id,t,s)},[n,e.id]);return(0,t.jsx)(n3.FileReviewCard,{fileChangeSet:e,onSubmit:a,submittingDecisionKeys:r,decisionErrors:i,showDiffs:!1})});e.s(["FileReviewDock",0,n6],644389);var n7=e.i(6486);let n9=[[85,72,90],[78,65,88,70]];function re({className:e}){return(0,t.jsx)("div",{className:(0,n.cn)("stg:flex stg:flex-col stg:gap-4 stg:pt-6 stg:pb-4",e),"aria-busy":"true","aria-label":"Loading conversation",children:(0,t.jsxs)("div",{className:"stg:animate-pulse stg:space-y-4",children:[(0,t.jsx)("div",{className:"stg:ms-[20%] stg:rounded-lg stg:bg-muted-subtle stg:px-4 stg:py-3",children:(0,t.jsx)("div",{className:"stg:h-4 stg:w-3/5 stg:rounded stg:bg-muted"})}),(0,t.jsx)("div",{className:"stg:space-y-2 stg:px-4",children:n9[0].map((e,s)=>(0,t.jsx)("div",{className:"stg:h-4 stg:rounded stg:bg-muted",style:{width:`${e}%`}},s))}),(0,t.jsx)("div",{className:"stg:ms-[20%] stg:rounded-lg stg:bg-muted-subtle stg:px-4 stg:py-3",children:(0,t.jsx)("div",{className:"stg:h-4 stg:w-2/5 stg:rounded stg:bg-muted"})}),(0,t.jsx)("div",{className:"stg:space-y-2 stg:px-4",children:n9[1].map((e,s)=>(0,t.jsx)("div",{className:"stg:h-4 stg:rounded stg:bg-muted",style:{width:`${e}%`}},s))})]})})}e.s(["ThreadSkeleton",0,re],352082);var rt=e.i(341698),rs=e.i(140076),rn=e.i(972992),rr=e.i(159877);e.i(247167);var ri=e.i(38535),ra=e.i(375954),ro=e.i(945850),rl=e.i(565621);function rg(e){let t=(0,_.parseModelKey)(e);return t?t.modelId:e}let rc=()=>{};var ru=e.i(526025),rd=e.i(980213);let rm=[];function rh(e){return`${e.executionId}:${e.artifact.contentHash}`}var rp=e.i(918789),rf=e.i(61855),rx=e.i(669226),rv=e.i(596639);function rb({plan:e,draft:r,onBuildFromPlan:i,buildDisabled:a,readOnly:o}){let[l,g]=(0,s.useState)("rendered"),c=!o&&void 0!==i,u=(0,rv.useBuildFromPlanHotkey)(c?i:void 0,a),{content:d,isTruncated:m,isLoading:h,error:p,refetch:f}=(0,rx.useArtifactContent)(e.executionId,e.artifact.storageKey,void 0,e.artifact.contentHash),x=o?void 0:r,v=x?.draftText??d,b=void 0!==x&&(!m||x.isEdited),j="edit"!==l||b?l:"rendered";return h?(0,t.jsx)(rj,{children:(0,t.jsx)(rk,{})}):p||null===v?(0,t.jsx)(rj,{children:(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:items-center stg:gap-2 stg:px-4 stg:py-8 stg:text-center",children:[(0,t.jsxs)("p",{className:"stg:text-xs stg:text-muted-foreground",children:["Couldn’t load the plan",p?`: ${p.message}`:"."]}),(0,t.jsx)("button",{type:"button",onClick:f,className:"stg:rounded stg:text-xs stg:font-medium stg:text-foreground stg:underline-offset-2 stg:hover:underline stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",children:"Retry"})]})}):(0,t.jsxs)(rj,{onKeyDown:u,children:[(0,t.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:flex-wrap stg:items-center stg:gap-2",children:[(0,t.jsxs)("div",{className:"stg:inline-flex stg:shrink-0 stg:rounded-md stg:bg-muted stg:p-0.5",role:"tablist","aria-label":"Plan view",children:[(0,t.jsx)(rw,{active:"rendered"===j,onClick:()=>g("rendered"),label:"Rendered"}),(0,t.jsx)(rw,{active:"source"===j,onClick:()=>g("source"),label:"Source"}),void 0!==x&&(0,t.jsx)(rw,{active:"edit"===j,onClick:()=>g("edit"),label:"Edit",disabled:!b})]}),(0,t.jsx)("span",{className:"stg:text-[0.65rem] stg:tabular-nums stg:text-muted-foreground-faint",children:(0,nT.formatArtifactSize)(e.artifact.sizeBytes)}),void 0!==x&&!b&&(0,t.jsx)("span",{className:"stg:min-w-0 stg:text-[0.65rem] stg:text-muted-foreground",children:"This plan is too large to edit in place — download it instead."}),(0,t.jsxs)("div",{className:"stg:ml-auto stg:flex stg:min-w-0 stg:flex-wrap stg:items-center stg:gap-3",children:[x?.isEdited&&(0,t.jsxs)("span",{className:"stg:inline-flex stg:items-center stg:gap-2",children:[(0,t.jsx)("span",{className:"stg:rounded-md stg:bg-accent stg:px-1.5 stg:py-0.5 stg:text-[0.65rem] stg:font-medium stg:text-muted-foreground",children:"Edited"}),(0,t.jsx)("button",{type:"button",onClick:()=>x.setDraft(null),className:"stg:rounded stg:text-[0.65rem] stg:font-medium stg:text-muted-foreground stg:underline-offset-2 stg:hover:text-foreground stg:hover:underline stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",children:"Revert"})]}),o?(0,t.jsx)("span",{role:"status",className:"stg:rounded-md stg:bg-muted stg:px-2 stg:py-0.5 stg:text-[0.65rem] stg:font-medium stg:text-muted-foreground",children:"Superseded by a newer plan"}):i&&(0,t.jsxs)("button",{type:"button",disabled:a,onClick:i,className:(0,n.cn)("stg:inline-flex stg:min-w-0 stg:items-center stg:gap-1.5 stg:rounded-md stg:px-3 stg:py-1.5","stg:text-xs stg:font-medium stg:transition-colors","stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:[(0,t.jsx)(rS,{}),(0,t.jsx)("span",{className:"stg:truncate",children:a?"Starting build…":"Build"})]})]})]}),"rendered"===j&&(0,t.jsx)(ry,{text:v}),"source"===j&&(0,t.jsx)("pre",{className:"stg:overflow-x-auto stg:rounded-md stg:bg-muted stg:p-3 stg:font-mono stg:text-xs stg:whitespace-pre-wrap stg:text-foreground",children:v}),"edit"===j&&void 0!==x&&(0,t.jsx)("textarea",{value:v,onChange:e=>x.setDraft(e.target.value),"aria-label":"Edit plan",spellCheck:!1,rows:28,className:(0,n.cn)("stg:w-full stg:flex-1 stg:resize-y stg:rounded-md stg:border stg:border-border stg:bg-card stg:p-3","stg:font-mono stg:text-xs stg:leading-relaxed stg:text-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring")}),m&&(0,t.jsx)("p",{role:"status",className:"stg:text-[0.65rem] stg:text-muted-foreground",children:"Preview truncated — download the artifact for the full plan."})]})}function rj({children:e,onKeyDown:s}){return(0,t.jsx)("div",{role:"article","aria-label":"Plan document",onKeyDown:s,className:"stg:mx-auto stg:flex stg:w-full stg:max-w-3xl stg:flex-col stg:gap-3 stg:px-4 stg:py-3",children:e})}function ry({text:e}){let{title:n,body:r}=(0,s.useMemo)(()=>(0,rf.extractLeadingH1)((0,rf.unwrapEnclosingMarkdownFence)(e,!0)),[e]);return(0,t.jsxs)("div",{className:"stg:overflow-hidden stg:rounded-lg stg:border stg:border-border-muted stg:bg-card",children:[n&&(0,t.jsx)("header",{className:"stg:border-b stg:border-border-muted stg:bg-muted-faint stg:px-4 stg:py-2.5",children:(0,t.jsx)("span",{className:"stg:block stg:truncate stg:text-sm stg:font-semibold stg:text-foreground",children:n})}),(0,t.jsx)("div",{className:"stgm-prose stg:px-4 stg:py-4",children:(0,t.jsx)(rp.default,{remarkPlugins:rf.REMARK_PLUGINS,components:rf.PLAN_DOCUMENT_MARKDOWN_COMPONENTS,children:r})})]})}function rk(){return(0,t.jsxs)("div",{className:"stg:space-y-2 stg:py-2","aria-hidden":"true",children:[(0,t.jsx)("div",{className:"stg:h-8 stg:w-full stg:animate-pulse stg:rounded-md stg:bg-muted"}),(0,t.jsx)("div",{className:"stg:h-4 stg:w-2/3 stg:animate-pulse stg:rounded stg:bg-muted"}),(0,t.jsx)("div",{className:"stg:h-4 stg:w-full stg:animate-pulse stg:rounded stg:bg-muted"}),(0,t.jsx)("div",{className:"stg:h-4 stg:w-5/6 stg:animate-pulse stg:rounded stg:bg-muted"})]})}function rw({active:e,onClick:s,label:r,disabled:i}){return(0,t.jsx)("button",{type:"button",role:"tab","aria-selected":e,onClick:s,disabled:i,className:(0,n.cn)("stg:rounded stg:px-2 stg:py-0.5 stg:text-[0.65rem] stg:font-medium stg:transition-colors","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",e?"stg:bg-card stg:text-foreground stg:shadow-sm":"stg:text-muted-foreground stg:hover:text-foreground","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:r})}function rS(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M2 6h8M7 3l3 3-3 3"})})}e.i(146696);var rN=e.i(644731);function rC({displayText:e}){let{title:n,body:r}=(0,s.useMemo)(()=>(0,rf.extractLeadingH1)(e),[e]);return(0,t.jsxs)("div",{role:"article","aria-label":"Plan document","aria-busy":"true",className:"stg:mx-auto stg:flex stg:w-full stg:max-w-3xl stg:flex-col stg:gap-3 stg:px-4 stg:py-3",children:[(0,t.jsx)("div",{className:"stg:flex stg:min-w-0 stg:flex-wrap stg:items-center stg:gap-2",children:(0,t.jsxs)("span",{role:"status",className:"stg:inline-flex stg:items-center stg:gap-1.5 stg:rounded-md stg:bg-muted stg:px-2 stg:py-0.5 stg:text-[0.65rem] stg:font-medium stg:text-muted-foreground",children:[(0,t.jsx)(rE,{}),"Writing…"]})}),(0,t.jsxs)("div",{className:"stg:overflow-hidden stg:rounded-lg stg:border stg:border-border-muted stg:bg-card",children:[n&&(0,t.jsx)("header",{className:"stg:border-b stg:border-border-muted stg:bg-muted-faint stg:px-4 stg:py-2.5",children:(0,t.jsx)("span",{className:"stg:block stg:truncate stg:text-sm stg:font-semibold stg:text-foreground",children:n})}),(0,t.jsx)("div",{className:"stgm-prose stg:px-4 stg:py-4",children:(0,t.jsx)(rN.Streamdown,{components:rf.PLAN_DOCUMENT_MARKDOWN_COMPONENTS,isAnimating:!0,caret:"block",children:r})})]})]})}function rE(){return(0,t.jsx)("span",{"aria-hidden":"true",className:"stg:size-1.5 stg:animate-pulse stg:rounded-full stg:bg-primary"})}var rR=e.i(180762),rA=e.i(385062),rT=e.i(285716);function rM({artifact:e,executionId:s,org:r,isTerminal:i,onApplied:a,className:o}){let l=`artifact-doc:${s}:${e.storageKey}:${e.contentHash}`,g=(0,rR.useArtifactInspection)(e,s,r,{cacheKey:l,onApplied:a}),{download:c,isDownloading:u}=(0,nL.useArtifactDownload)(s),d=!g.isDirectory&&null!==g.content;return(0,t.jsxs)("div",{role:"article","aria-label":`Artifact ${e.name}`,className:(0,n.cn)("stg:flex stg:min-h-0 stg:min-w-0 stg:flex-1 stg:flex-col",o),children:[(0,t.jsxs)("div",{className:"stg:sticky stg:top-0 stg:z-10 stg:flex stg:min-w-0 stg:flex-wrap stg:items-center stg:gap-x-3 stg:gap-y-1.5 stg:border-b stg:border-border stg:bg-background stg:px-4 stg:py-2",children:[(0,t.jsx)("span",{className:"stg:shrink-0 stg:text-muted-foreground",children:g.isDirectory?(0,t.jsx)(rO,{}):(0,t.jsx)(rP,{})}),(0,t.jsxs)("span",{className:"stg:truncate stg:text-sm stg:font-medium stg:text-foreground",children:[e.name,g.isDirectory&&"/"]}),(0,t.jsx)("span",{className:"stg:shrink-0 stg:text-[0.65rem] stg:tabular-nums stg:text-muted-foreground-faint",children:(0,nT.formatArtifactSize)(e.sizeBytes)}),g.isDetecting&&!g.detectionLabel&&(0,t.jsx)("span",{className:"stg:h-4 stg:w-24 stg:shrink-0 stg:animate-pulse stg:rounded-full stg:bg-muted","aria-hidden":"true"}),g.detectionLabel&&(0,t.jsx)("span",{className:"stg:inline-flex stg:shrink-0 stg:items-center stg:rounded-full stg:bg-primary-subtle stg:px-2 stg:py-0.5 stg:text-xs stg:font-medium stg:text-primary",children:g.detectionLabel}),(0,t.jsxs)("div",{className:"stg:ml-auto stg:flex stg:min-w-0 stg:flex-wrap stg:items-center stg:gap-3",children:[d&&(0,t.jsxs)("button",{type:"button",onClick:g.copy,"aria-label":g.copied?"Copied to clipboard":"Copy content",className:(0,n.cn)("stg:inline-flex stg:items-center stg:gap-1.5 stg:text-xs stg:font-medium stg:transition-colors",g.copied?"stg:text-success":"stg:text-muted-foreground stg:hover:text-foreground",rL),children:[g.copied?(0,t.jsx)(rB,{}):(0,t.jsx)(rF,{}),g.copied?"Copied":"Copy"]}),(0,t.jsxs)("button",{type:"button",onClick:()=>c(e.storageKey,e.name),disabled:u,className:(0,n.cn)("stg:inline-flex stg:items-center stg:gap-1.5 stg:text-xs stg:font-medium stg:text-muted-foreground stg:transition-colors stg:hover:text-foreground stg:disabled:opacity-50",rL),children:[(0,t.jsx)(rD,{}),u?"Preparing…":g.isDirectory?"Download ZIP":"Download"]}),(0,t.jsx)(rI,{isDetected:g.isDetected,ctaLabel:g.ctaLabel,isTerminal:i,isApplying:g.isApplying,applyResult:g.applyResult,applyError:g.applyError,onApply:g.apply})]})]}),(0,t.jsx)(rA.ArtifactContentBody,{artifact:e,content:g.content,contentType:g.contentType,isLoading:g.isLoading,error:g.error,isTruncated:g.isTruncated,skillDetection:g.skillDetection,className:"stg:min-w-0"}),(0,t.jsx)("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"stg:sr-only",children:g.copied&&"Content copied to clipboard"})]})}function rI({isDetected:e,ctaLabel:s,isTerminal:r,isApplying:i,applyResult:a,applyError:o,onApply:l}){return a?(0,t.jsxs)("span",{className:"stg:inline-flex stg:items-center stg:gap-1.5 stg:text-xs stg:font-medium stg:text-success",children:[(0,t.jsx)(rB,{}),"Applied ","·"," ",a.name||a.kind]}):o?(0,t.jsxs)("span",{className:"stg:inline-flex stg:items-center stg:gap-2",role:"alert",children:[(0,t.jsx)("span",{className:"stg:text-xs stg:text-destructive",children:o.message}),(0,t.jsx)("button",{type:"button",onClick:l,className:(0,n.cn)("stg:text-xs stg:font-medium stg:text-destructive stg:underline stg:transition-colors stg:hover:text-destructive-muted",rL),children:"Retry"})]}):e&&s?(0,t.jsx)("span",{"data-cursor-target":"apply-resource-button",children:(0,t.jsx)(rT.ArtifactApplyButton,{label:s,isTerminal:r,isApplying:i,onApply:l})}):null}let rL="stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:focus-visible:rounded-sm";function rP(){return(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M9.5 1.5H5C4.17 1.5 3.5 2.17 3.5 3V13C3.5 13.83 4.17 14.5 5 14.5H11C11.83 14.5 12.5 13.83 12.5 13V4.5L9.5 1.5Z"}),(0,t.jsx)("path",{d:"M9.5 1.5V4.5H12.5"})]})}function rO(){return(0,t.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M14.5 12.5C14.5 13.33 13.83 14 13 14H3C2.17 14 1.5 13.33 1.5 12.5V3.5C1.5 2.67 2.17 2 3 2H6L8 4.5H13C13.83 4.5 14.5 5.17 14.5 6V12.5Z"})})}function rF(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"4",y:"4",width:"6.5",height:"6.5",rx:"1"}),(0,t.jsx)("path",{d:"M8 4V2.5C8 1.95 7.55 1.5 7 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V7C1.5 7.55 1.95 8 2.5 8H4"})]})}function rD(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M6 1.5V8.5"}),(0,t.jsx)("path",{d:"M3 6L6 9L9 6"}),(0,t.jsx)("path",{d:"M2 10.5H10"})]})}function rB(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M2 6.5L4.5 9L10 3"})})}let r$=(0,s_.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);e.s(["Download",0,r$],440160);var r_=e.i(845132);function rV({sessionId:e,includeSuperseded:s,className:r}){let i=s2(e,{includeSuperseded:s});return(0,t.jsxs)(r_.ActionMenu,{children:[(0,t.jsx)(r_.ActionMenu.Trigger,{"aria-label":"Export transcript",className:(0,n.cn)("stg:size-7",r),children:i.isExporting?(0,t.jsx)(F.SpinnerIcon,{size:14}):(0,t.jsx)(r$,{className:"stg:size-3.5","aria-hidden":"true"})}),(0,t.jsxs)(r_.ActionMenu.Content,{children:[(0,t.jsx)(r_.ActionMenu.Item,{icon:(0,t.jsx)(s$.Copy,{className:"stg:size-3.5","aria-hidden":"true"}),onSelect:()=>void i.copyMarkdown(),disabled:i.isExporting,children:"Copy transcript"}),(0,t.jsx)(r_.ActionMenu.Item,{icon:(0,t.jsx)(sU,{className:"stg:size-3.5","aria-hidden":"true"}),onSelect:()=>void i.downloadMarkdown(),disabled:i.isExporting,children:"Download Markdown"}),(0,t.jsx)(r_.ActionMenu.Item,{icon:(0,t.jsx)(sV,{className:"stg:size-3.5","aria-hidden":"true"}),onSelect:()=>void i.downloadJson(),disabled:i.isExporting,children:"Download JSON"})]})]})}async function rU(e,t){let s=await e.agentExecution.getArtifactContent((0,J.create)(eL.GetArtifactContentRequestSchema,{executionId:t.executionId,storageKey:t.artifact.storageKey}));if(s.truncated)throw Error("plan content truncated — not attaching a partial plan");return new TextDecoder().decode(s.content)}let rW=(0,s.memo)(function({flow:e,modelId:n,setModelId:r,interactionMode:i,setInteractionMode:a,composerRef:o,org:l,gitHubConnection:g,enableGitHub:c,enableLocal:u,onBrowseLocalFolder:d,onBuildFromPlan:m,onOpenPlan:h,isBuildingFromPlan:p,planAttachFailed:f,onDismissPlanAttachFailed:x,onFilePathClick:v,isCurated:b,isGuest:j,isObserver:y,modelSelectorVisible:k,threadSlots:w}){let{conv:S}=e,N=e.submitError??S.sendError??S.stopError,C=(0,s.useCallback)(t=>{e.handleSubmit(t)},[e.handleSubmit]),E=(0,s.useCallback)(()=>{S.stop()},[S.stop]),[R,A]=(0,s.useState)(null),T=S.activeStreamExecution?.metadata?.id??null,M=(0,s.useCallback)(e=>{S.stop(),A(T),o.current?.setMessage(e),o.current?.focus()},[S.stop,T,o]),I=(0,s.useCallback)(()=>{A(null),o.current?.setMessage("")},[o]),L=(0,s.useCallback)((t,s,n)=>{e.handleSubmit(t,s,R?{...n,supersedesExecutionId:R}:n),A(null)},[e.handleSubmit,R]),P=(0,s.useMemo)(()=>({workspaceEntries:S.workspaceEntries??[],onFilePathClick:v}),[S.workspaceEntries,v]);return(0,t.jsxs)("div",{className:"stg:flex stg:h-full stg:min-w-0 stg:flex-col",children:[(0,t.jsx)(n1.MessageThread,{executions:S.completedExecutions,activeStreamExecution:S.activeStreamExecution,pendingUserMessage:S.pendingUserMessage,pendingAttachments:S.pendingAttachments,pendingMessageFailed:!!S.sendError&&!!S.pendingUserMessage,onRetrySend:y?void 0:S.retryLastSend,onRetryExecution:y?void 0:C,onApprovalSubmit:y||j?void 0:e.submitApproval,submittingApprovalIds:S.submittingApprovalIds,approvalErrors:S.approvalErrors,showFileReviewRecords:!0,onEditMessage:y||!S.isStoppable?void 0:M,workspaceEntries:S.workspaceEntries,onFilePathClick:v,sandboxWorkspaceRoot:e.sandboxWorkspaceRoot,onBuildFromPlan:y?void 0:m,onOpenPlan:h,org:l,planActionsDisabled:y||!S.canSendFollowUp||p,planBuildPending:p,contentColumn:"center",slots:w,className:"stg:flex-1"}),(0,t.jsxs)("div",{className:"stg:mx-auto stg:w-full stg:max-w-3xl",children:[f&&(0,t.jsx)(rG,{onDismiss:x}),S.isReconnecting&&(0,t.jsx)(rJ,{}),S.connectTimedOut&&(0,t.jsx)(rZ,{onRetry:S.reconnectStream}),S.isSlow&&!S.connectTimedOut&&(0,t.jsx)(rQ,{}),S.streamError&&(0,t.jsx)(r0,{error:S.streamError,onReconnect:S.reconnectStream}),!y&&N&&(0,t.jsx)(rX,{error:N}),!y&&e.autoApproveAll&&(0,t.jsx)(nG,{onTurnOff:()=>e.setAutoApproveAll(!1)}),(0,t.jsxs)(n7.FilePathContext.Provider,{value:P,children:[(0,t.jsx)(n4,{progress:S.fileChangeProgress}),!y&&(0,t.jsx)(n6,{changeSets:S.fileChangeSets,onSubmit:S.submitFileDecision,submittingDecisionKeys:S.submittingFileDecisionKeys,decisionErrors:S.fileDecisionErrors})]}),!y&&(0,t.jsx)(tn,{ref:o,onSubmit:L,isSubmitting:S.isSending,disabled:!S.canSendFollowUp,onStop:S.isStoppable?E:void 0,isStopping:S.isStopping,isEditing:null!=R,onCancelEdit:I,org:l,harness:e.harness,defaultModelId:n,onModelChange:r,interactionMode:i,onInteractionModeChange:a,showInteractionModePicker:!j,showModelSelector:k,enableAttachments:!j,workspace:j?void 0:e.workspace,gitHubConnection:j?void 0:g,enableGitHub:c&&!j,enableLocal:u&&!j,onBrowseLocalFolder:d,agentRef:e.agentRef,onAgentRefChange:j?void 0:e.setAgentRef,onAgentResolutionChange:j?void 0:e.setResolution,lockAgent:b,mcpServerUsages:b?void 0:e.mcpServerUsages,onMcpServerUsagesChange:b?void 0:e.setMcpServerUsages,skillRefs:b?void 0:e.skillRefs,onSkillRefsChange:b?void 0:e.setSkillRefs,sessionVariables:b?void 0:e.sessionVariables,className:"stg:px-4 stg:py-3"})]})]})});function rz({flow:e,org:n,panel:r,accessSlot:i,onApplied:a,onImplementPlan:o,implementPlanDisabled:l,sessionPlan:g,streamingPlan:c,planDraft:u,openPlanExecutionId:d,onOpenPlan:m,onOpenArtifact:h,onActivateArtifact:p,enableLocal:f,onBrowseLocalFolder:x,workspaceFileLister:v,workspaceFileReader:b,workspaceContentSearcher:j,isCurated:y,isObserver:k,exportSessionId:w}){var S,N;let C,E,{editors:R,activeKey:A,activeFile:T,reveal:M}=(0,tl.useWorkspaceEditors)(r.editorsStore),{artifacts:I}=sO(e.allExecutions),L=M&&M.key===A?M:void 0,P=function(e,t,n,r){var i;let{fileChanges:a}=(i=e?t:rm,(0,s.useMemo)(()=>{let e=(0,rd.deriveExecutionFileChanges)(i);return{fileChanges:e,hasFileChanges:e.length>0,fileChangeCount:e.length}},[i]));return(0,s.useMemo)(()=>e&&n?function(e,t,s,n){for(let r of t){let t=n0(r.path||r.absolutePath,s,n);if(null!==t&&t.entryId===e.entryId&&t.path===e.path)return r}return null}(e,a,n,r)??null:null,[e,a,n,r])}(T&&!(0,tg.isVirtualEntryId)(T.entryId)?T:null,e.allExecutions,e.workspace.entries,e.sandboxWorkspaceRoot),O=(0,s.useMemo)(()=>{if(null===d||d===g?.executionId)return g;let t=e.allExecutions.find(e=>e.metadata?.id===d),s=(0,nO.findPlanArtifact)(t);return s?{executionId:d,artifact:s}:g},[d,g,e.allExecutions]),F=O?.executionId===g?.executionId,D=(0,s.useMemo)(()=>({entryId:sM,path:sI,content:c?(0,t.jsx)(rC,{displayText:c.displayText},`streaming-${c.executionId}`):O?(0,t.jsx)(rb,{plan:O,draft:F?u:void 0,onBuildFromPlan:F?o:void 0,buildDisabled:l,readOnly:!F},rh(O)):(0,t.jsx)(rq,{})}),[c,O,F,u,o,l]),B=(0,s.useMemo)(()=>new Map(I.map(e=>[sP(e.artifact),e])),[I]),$=(0,s.useMemo)(()=>R.filter(e=>e.entryId===sL).map(e=>{let s=B.get(e.path);return{entryId:sL,path:e.path,content:s?(0,t.jsx)(rM,{artifact:s.artifact,executionId:s.executionId,org:n,isTerminal:s.isTerminal,onApplied:a},s.artifact.contentHash||e.path):(0,t.jsx)(rY,{})}}),[R,B,n,a]),_=(0,s.useMemo)(()=>[D,...$],[D,$]),V=e.clearAgent,U=(0,s.useCallback)(t=>{e.setMcpServerUsages(e.mcpServerUsages.filter(e=>e.mcpServerRef.org!==t.org||e.mcpServerRef.slug!==t.slug))},[e.mcpServerUsages,e.setMcpServerUsages]),W=(0,s.useCallback)(t=>{e.setSkillRefs(e.skillRefs.filter(e=>e.org!==t.org||e.slug!==t.slug))},[e.skillRefs,e.setSkillRefs]),z=(0,s.useMemo)(()=>({agentRef:e.agentRef,mcpServerUsages:e.mcpServerUsages,skillRefs:e.skillRefs,sessionVariables:e.sessionVariables,harness:e.harness,executionTarget:e.executionTarget,modelId:e.model[0],autoApprove:k?void 0:{armed:e.autoApproveAll,onChange:e.setAutoApproveAll},sessionId:w,mutations:y?void 0:{onRemoveAgent:e.agentRef?V:void 0,onRemoveMcp:U,onRemoveSkill:W},accessSlot:i}),[e.agentRef,e.mcpServerUsages,e.skillRefs,e.sessionVariables,e.harness,e.executionTarget,e.model,e.autoApproveAll,e.setAutoApproveAll,k,w,y,V,U,W,i]),H="cloud"===e.executionTarget&&e.workspace.entries.some(e=>"git"===e.type),K=e.displayExecution?.status?.phase??tO.ExecutionPhase.EXECUTION_PHASE_UNSPECIFIED,q=nU({allExecutions:e.allExecutions,org:n,sessionConfig:z,onApplied:a,onImplementPlan:o,onOpenPlan:m,onOpenArtifact:h,onActivateArtifact:p,expectsWriteBack:H,changesSettled:(0,sT.isTerminalPhase)(K)}),Y=f&&!!x,G=(0,s.useCallback)(async()=>{let t=await x?.();t&&e.workspace.addLocalPath(t)},[x,e.workspace.addLocalPath]),X=(S=e.allExecutions,N=e.workspace.entries,E=[...C=function(e){let t=new Map;for(let s of e)for(let e of s.status?.workspaceWriteBacks??[])e.commitSha&&t.set(e.workspaceEntryName,e.commitSha);return t}(S)].map(([e,t])=>`${e}\u0001${t}`).join("\0"),(0,s.useMemo)(()=>{if(0===C.size)return N;let e=N.filter(e=>"git"===e.type),t=!1,s=N.map(s=>{let n=function(e,t,s){if("git"!==e.type)return;let n=s.get(e.name);if(n)return n;if(1===t){let e=s.get("");if(e)return e;if(1===s.size)return s.values().next().value}}(s,e.length,C);return n&&n!==s.readRef?(t=!0,{...s,readRef:n}):s});return t?s:N},[N,E]));return(0,t.jsx)(sn,{entries:X,lister:v,reader:b,searcher:j,view:r.view,onViewChange:r.setView,extraViews:q,virtualDocuments:_,onRemoveEntry:e.workspace.remove,onAddLocalFolder:Y?G:void 0,editors:R,selectedFile:T,onOpenFile:r.openFile,onActivateEditor:r.activateEditor,onPinEditor:r.pinEditor,onCloseEditor:r.closeEditor,onCollapse:r.closePanel,change:P??void 0,reveal:L,className:"stg:h-full"})}function rH({error:e}){return(0,t.jsx)("div",{className:"stg:flex stg:min-h-[60vh] stg:flex-col stg:items-center stg:justify-center stg:px-4",children:(0,t.jsxs)("div",{className:"stg:w-full stg:max-w-sm stg:space-y-6 stg:text-center",children:[(0,t.jsx)("div",{className:"stg:mx-auto stg:flex stg:size-12 stg:items-center stg:justify-center stg:rounded-full stg:bg-destructive-subtle",children:(0,t.jsx)(r1,{})}),(0,t.jsxs)("div",{className:"stg:space-y-2",children:[(0,t.jsx)("h1",{className:"stg:text-lg stg:font-semibold",children:"Failed to load session"}),(0,t.jsx)("p",{className:"stg:text-sm stg:text-muted-foreground",children:(0,r.getUserMessage)(e)})]}),(0,t.jsx)("button",{type:"button",onClick:()=>window.location.reload(),className:"stg:inline-flex stg:items-center stg:gap-1.5 stg:rounded-lg stg:border stg:border-border stg:bg-card stg:px-3 stg:py-1.5 stg:text-sm stg:font-medium stg:hover:bg-muted",children:"Try again"})]})})}function rK(){return(0,t.jsx)("div",{className:"stg:flex stg:h-full stg:items-center stg:justify-center",children:(0,t.jsxs)("div",{className:"stg:space-y-2 stg:text-center",children:[(0,t.jsx)(r5,{}),(0,t.jsx)("p",{className:"stg:text-sm stg:text-muted-foreground",children:"Starting session…"})]})})}function rq(){return(0,t.jsxs)("div",{role:"status",className:"stg:mx-auto stg:flex stg:w-full stg:max-w-3xl stg:flex-col stg:items-center stg:gap-1 stg:px-4 stg:py-8 stg:text-center",children:[(0,t.jsx)("p",{className:"stg:text-xs stg:font-medium stg:text-foreground",children:"This turn ended before a plan was completed."}),(0,t.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"Any partial plan text remains in the conversation."})]})}function rY(){return(0,t.jsxs)("div",{role:"status",className:"stg:mx-auto stg:flex stg:w-full stg:max-w-3xl stg:flex-col stg:items-center stg:gap-1 stg:px-4 stg:py-8 stg:text-center",children:[(0,t.jsx)("p",{className:"stg:text-xs stg:font-medium stg:text-foreground",children:"This artifact is no longer available."}),(0,t.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"It may have been replaced by a newer version of this session."})]})}function rG({onDismiss:e}){return(0,t.jsxs)("div",{role:"status",className:"stg:flex stg:items-center stg:gap-2 stg:border-t stg:border-border-muted stg:px-4 stg:py-1.5 stg:text-xs stg:text-muted-foreground",children:[(0,t.jsx)("span",{className:"stg:min-w-0 stg:flex-1 stg:truncate",children:"Couldn’t attach plan.md — the agent will follow the plan from the conversation instead."}),(0,t.jsx)("button",{type:"button",onClick:e,className:"stg:shrink-0 stg:rounded stg:font-medium stg:text-foreground stg:underline-offset-2 stg:hover:underline stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",children:"Dismiss"})]})}function rX({error:e}){return ex(e)?(0,t.jsx)(ef,{error:e,className:"stg:mx-4 stg:my-2"}):(0,t.jsx)("div",{role:"alert",className:"stg:border-t stg:border-border stg:px-4 stg:py-2 stg:text-xs stg:text-destructive",children:(0,r.getUserMessage)(e)})}function rJ(){return(0,t.jsxs)("div",{role:"status","aria-live":"polite",className:"stg:flex stg:items-center stg:gap-2 stg:border-t stg:border-border stg:bg-muted stg:px-4 stg:py-2 stg:text-sm stg:text-muted-foreground",children:[(0,t.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0 stg:animate-spin stg:motion-reduce:animate-none","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),(0,t.jsx)("span",{className:"stg:truncate",children:"Reconnecting…"})]})}function rZ({onRetry:e}){return(0,t.jsxs)("div",{role:"alert",className:"stg:flex stg:items-center stg:gap-3 stg:border-t stg:border-border stg:bg-muted stg:px-4 stg:py-2.5",children:[(0,t.jsx)("p",{className:"stg:min-w-0 stg:flex-1 stg:truncate stg:text-sm stg:text-muted-foreground",children:"The agent hasn’t started yet."}),(0,t.jsx)("button",{type:"button",onClick:e,className:"stg:inline-flex stg:shrink-0 stg:items-center stg:gap-1.5 stg:rounded-md stg:border stg:border-border stg:px-2 stg:py-1 stg:text-xs stg:font-medium stg:hover:bg-card",children:"Retry"})]})}function rQ(){return(0,t.jsxs)("div",{role:"status","aria-live":"polite",className:"stg:flex stg:items-center stg:gap-2 stg:border-t stg:border-border-muted stg:px-4 stg:py-1.5 stg:text-xs stg:text-muted-foreground",children:[(0,t.jsxs)("span",{className:"stg:relative stg:flex stg:h-2 stg:w-2 stg:shrink-0","aria-hidden":"true",children:[(0,t.jsx)("span",{className:"stg:absolute stg:inline-flex stg:h-full stg:w-full stg:animate-ping stg:rounded-full stg:bg-muted-foreground stg:opacity-75 stg:motion-reduce:animate-none"}),(0,t.jsx)("span",{className:"stg:relative stg:inline-flex stg:h-2 stg:w-2 stg:rounded-full stg:bg-muted-foreground"})]}),(0,t.jsx)("span",{className:"stg:min-w-0 stg:flex-1 stg:truncate",children:"Still working — this is taking longer than usual."})]})}function r0({error:e,onReconnect:s}){return(0,t.jsxs)("div",{role:"alert",className:"stg:flex stg:items-center stg:gap-3 stg:border-t stg:border-border stg:bg-muted stg:px-4 stg:py-2.5",children:[(0,t.jsx)("p",{className:"stg:min-w-0 stg:flex-1 stg:truncate stg:text-sm stg:text-muted-foreground",children:(0,r.getUserMessage)(e)}),(0,t.jsx)("button",{type:"button",onClick:s,className:"stg:inline-flex stg:shrink-0 stg:items-center stg:gap-1.5 stg:rounded-md stg:border stg:border-border stg:px-2 stg:py-1 stg:text-xs stg:font-medium stg:hover:bg-card",children:"Reconnect"})]})}function r1(){return(0,t.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:text-destructive",children:[(0,t.jsx)("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),(0,t.jsx)("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),(0,t.jsx)("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}function r5(){return(0,t.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"stg:mx-auto stg:animate-spin stg:text-muted-foreground",children:(0,t.jsx)("path",{d:"M10 2a8 8 0 0 1 0 16",strokeLinecap:"round"})})}e.s(["SessionViewer",0,function({sessionId:e,org:r,gitHubConnection:i,enableGitHub:a=!0,enableLocal:o=!1,onBrowseLocalFolder:l,workspaceFileLister:g,workspaceFileReader:c,workspaceContentSearcher:u,getRuntimeEnv:d,audience:m="integrator",runConfig:h,accountDefaults:p,showModelSelector:f=!0,panel:x="auto",defaultPanelOpen:v,panelOpen:b,onPanelOpenChange:j,headerActions:y,transcriptExport:k=!0,accessSlot:w,onApplied:S,threadSlots:N,className:C}){let E=function(e){let{sessionId:t,org:n,getRuntimeEnv:r}=e,i="guest"===e.audience,a=i?void 0:e.runConfig;a&&sE(a);let o=a?.modelName,l=a?.serviceTier,g=a?.thinkingMode,c=(0,et.useStigmer)(),u=function(e,t){let n,r,i,a,o,l=(0,et.useStigmer)(),{session:g,isLoading:c,error:u,refetch:d}=function(e){let t=(0,et.useStigmer)(),{data:s,isLoading:n,isRefetching:r,error:i,refetch:a}=(0,t$.useFetch)(e?()=>t.session.get(e):null,[e,t],null,{cacheKey:e?`session:${e}`:void 0});return{session:s,isLoading:n,isRefetching:r,error:i,refetch:a}}(e),[m,h]=(0,s.useState)(!1),{executions:p,isLoading:f,error:x,refetch:v}=function(e,t){let s=(0,et.useStigmer)(),{data:n,isLoading:r,isRefetching:i,error:a,refetch:o}=(0,t$.useFetch)(e?()=>s.agentExecution.listBySession((0,J.create)(eL.ListAgentExecutionsBySessionRequestSchema,{sessionId:e})).then(e=>(0,sq.sortChronologically)(e.entries)):null,[e,s],[],{cacheKey:e?`session-executions:${e}`:void 0,refetchInterval:t?.refetchInterval,refetchOnWindowFocus:t?.refetchOnWindowFocus});return{executions:n,isLoading:r,isRefetching:i,error:a,refetch:o}}(e,{refetchInterval:!!m&&5e3,refetchOnWindowFocus:!0}),{create:b,isCreating:j,clearError:y}=(0,sk.useCreateAgentExecution)(),{update:k}=function(){let e=(0,et.useStigmer)(),[t,n]=(0,s.useState)(!1),[r,i]=(0,s.useState)(null),a=(0,s.useCallback)(()=>i(null),[]);return{update:(0,s.useCallback)(async t=>{n(!0),i(null);try{return await e.session.update(t)}catch(e){throw i(e instanceof Error?e.message:"Failed to update session"),e}finally{n(!1)}},[e]),isUpdating:t,error:r,clearError:a}}(),{submitApproval:w,submittingToolCallIds:S,errorsByToolCallId:N,error:C,clearError:E}=function(){let e=(0,et.useStigmer)(),t=(0,ro.useKeyedSubmission)(),[n,r]=(0,s.useState)(null),i=(0,s.useCallback)(()=>{t.clearErrors(),r(null)},[t.clearErrors]),a=(0,s.useCallback)(async(s,n,i,a)=>{r(null);try{await t.run(n,async()=>{await e.agentExecution.submitApproval((0,J.create)(eL.SubmitApprovalInputSchema,{agentExecutionId:s,toolCallId:n,action:i,comment:a??""}))})}catch(e){throw r((0,es.toError)(e)),e}},[e,t.run]);return(0,s.useMemo)(()=>({submitApproval:a,submittingToolCallIds:t.submittingKeys,errorsByToolCallId:t.errorsByKey,error:n,clearError:i}),[a,t.submittingKeys,t.errorsByKey,n,i])}(),{submitFileDecision:R,submittingDecisionKeys:A,decisionErrors:T,clearDecisionError:M,error:I,clearError:L}=(0,rl.useFileReview)();n=(0,sN.useRunnerAdapter)(),r=(0,sw.useExecutionTarget)(),i=null!=g,a=g?.spec?.executionTarget,o=(0,s.useMemo)(()=>{if(i)return(0,rr.fromProtoExecutionTarget)(a??rn.ExecutionTarget.UNSPECIFIED)??r},[i,a,r]),(0,s.useEffect)(()=>{if(n&&e&&"local"===o)return n.onSessionOpened(e).catch(()=>{}),()=>{n.onSessionClosed(e).catch(()=>{})}},[n,e,o]);let[P,O]=(0,s.useState)(null),[F,D]=(0,s.useState)(null),[B,$]=(0,s.useState)(null),[_,V]=(0,s.useState)(null),U=(0,s.useRef)(null),W=(0,s.useMemo)(()=>{for(let e=p.length-1;e>=0;e--){let t=p[e].status?.phase;if(void 0===t||!(0,sT.isTerminalPhase)(t))return p[e].metadata?.id??null}return null},[p]),z=P??W,H=(0,tl.useConversationStoreRef)(),K=(0,ra.useExecutionStream)(z,{store:H}),q=null!==z&&(0,sT.isTerminalPhase)(K.phase),Y=!K.isStreaming&&!q&&(null===z&&0===p.length||K.connectTimedOut||null!==K.error);(0,s.useEffect)(()=>{h(Y)},[Y]),(0,s.useEffect)(()=>{P&&p.some(e=>(e.metadata?.id??"")===P)&&O(null)},[P,p]),(0,s.useEffect)(()=>{K.execution&&(F&&D(null),B&&$(null),_&&V(null))},[F,B,_,K.execution]),(0,s.useEffect)(()=>{z&&(0,sT.isTerminalPhase)(K.phase)&&v()},[z,K.phase,v]);let G=K.execution?.spec?.supersedesExecutionId||null,X=(0,s.useMemo)(()=>(0,sq.supersededExecutionIds)(p,G),[p,G]),Z=(0,s.useMemo)(()=>p.filter(e=>{let t=e.metadata?.id??"";return(!z||t!==z)&&!X.has(t)}),[p,z,X]),Q=(0,s.useMemo)(()=>z?p.find(e=>(e.metadata?.id??"")===z)??null:null,[p,z]),ee=K.execution??Q,en=(0,s.useMemo)(()=>z?K.phase:null,[z,K.phase]),er=en===tO.ExecutionPhase.EXECUTION_PENDING||en===tO.ExecutionPhase.EXECUTION_IN_PROGRESS,ei=function(e,t){let n=(0,et.useStigmer)(),[r,i]=(0,s.useState)(!1),[a,o]=(0,s.useState)(null),l=(0,s.useRef)(e);l.current=e;let g=(0,s.useRef)(n);g.current=n;let c=(0,s.useRef)(t?.onSuccess);c.current=t?.onSuccess;let u=(0,s.useCallback)(()=>o(null),[]),d=(0,s.useCallback)(async e=>{if(!l.current)return null;i(!0),o(null);try{let t=await e();return c.current?.(t),t}catch(e){return o((0,es.toError)(e)),null}finally{i(!1)}},[]),m=(0,s.useCallback)(e=>d(()=>g.current.agentExecution.cancel((0,J.create)(eL.CancelAgentExecutionInputSchema,{id:l.current,reason:e??""}))),[d]),h=(0,s.useCallback)(e=>d(()=>g.current.agentExecution.terminate((0,J.create)(eL.TerminateAgentExecutionInputSchema,{id:l.current,reason:e??""}))),[d]),p=(0,s.useCallback)(e=>d(()=>g.current.agentExecution.pause((0,J.create)(eL.PauseAgentExecutionInputSchema,{id:l.current,reason:e??""}))),[d]),f=(0,s.useCallback)(()=>d(()=>g.current.agentExecution.resume((0,J.create)(eL.ResumeAgentExecutionInputSchema,{id:l.current}))),[d]),x=(0,s.useRef)(null),v=(0,s.useCallback)(e=>{let t=l.current;return t?(x.current?.id!==t&&(x.current={id:t,cancelIssued:!1}),x.current.cancelIssued)?h(e):(x.current.cancelIssued=!0,m(e)):Promise.resolve(null)},[m,h]);return{cancel:m,terminate:h,pause:p,resume:f,stop:v,isSubmitting:r,error:a,clearError:u}}(z,{onSuccess:v}),ea=(0,s.useCallback)(async e=>{er&&await ei.stop(e)},[er,ei.stop]),eo=!j&&null===z,el=(0,s.useMemo)(()=>g?.spec?.workspaceEntries??[],[g]),eg=(0,s.useMemo)(()=>g?.spec?.mcpServerUsages??[],[g]),ec=(0,s.useMemo)(()=>g?.spec?.skillRefs??[],[g]),eu=(0,s.useCallback)(async(s,n)=>{if(e&&g){U.current={message:s,options:n},V(null),n?.buildFromPlan||(D(s),$(n?.attachments??null));try{if(n?.agentInstanceId!==void 0||n?.workspaceEntries!==void 0||n?.mcpServerUsages!==void 0||n?.skillRefs!==void 0){var r,i;let t,s,a,o,g=await l.session.get(e);await k((r=g,i={agentInstanceId:n?.agentInstanceId,workspaceEntries:n?.workspaceEntries,mcpServerUsages:n?.mcpServerUsages,skillRefs:n?.skillRefs},t=(0,ri.toSessionUpdateInput)(r),s=i.workspaceEntries??t.workspaceEntries,a=i.mcpServerUsages??t.mcpServerUsages,o=i.skillRefs??t.skillRefs,{...t,agentInstanceId:i.agentInstanceId??t.agentInstanceId,workspaceEntries:s?.length?s:void 0,mcpServerUsages:a?.length?a:void 0,skillRefs:o?.length?o:void 0})),d()}let a=await b({org:t,sessionId:e,message:s,modelName:n?.modelName,runtimeEnv:n?.runtimeEnv,attachments:n?.attachments,interactionMode:n?.interactionMode,serviceTier:n?.serviceTier,thinkingMode:n?.thinkingMode,buildFromPlan:n?.buildFromPlan,autoApproveAll:n?.autoApproveAll,workspaceFileRefs:n?.workspaceFileRefs,supersedesExecutionId:n?.supersedesExecutionId});O(a.executionId),v()}catch(e){D(s),$(n?.attachments??null),V((0,es.toError)(e))}}},[e,g,t,l,b,k,v,d]),ed=(0,s.useCallback)(()=>{let e=U.current;e&&eu(e.message,e.options)},[eu]),em=(0,s.useCallback)(()=>{V(null),y()},[y]),eh=(0,s.useMemo)(()=>ee?.status?.pendingApprovals??[],[ee]),ep=(0,s.useCallback)(async(e,t,s)=>{z&&await w(z,e,t,s)},[z,w]),ef=(0,s.useMemo)(()=>(ee?.status?.fileChangeSets??[]).filter(e=>e.status===tO.FileChangeSetStatus.AWAITING_REVIEW),[ee]),ex=(0,s.useMemo)(()=>ee?.status?.fileChangeProgress,[ee]),ev=(0,s.useCallback)(async(e,t,s)=>{z&&await R(z,e,t,s)},[z,R]);return{session:g,completedExecutions:Z,activeStreamExecution:ee,activePhase:en,isStreaming:K.isStreaming,isConnecting:K.isConnecting,sendFollowUp:eu,canSendFollowUp:eo,isSending:j,sendError:_,clearSendError:em,retryLastSend:ed,pendingUserMessage:F,pendingAttachments:B,workspaceEntries:el,mcpServerUsages:eg,skillRefs:ec,pendingApprovals:eh,submitApproval:ep,submittingApprovalIds:S,approvalErrors:N,approvalError:C,clearApprovalError:E,fileChangeSets:ef,fileChangeProgress:ex,submitFileDecision:ev,submittingFileDecisionKeys:A,fileDecisionErrors:T,clearFileDecisionError:M,fileReviewError:I,clearFileReviewError:L,isStoppable:er,stop:ea,isStopping:ei.isSubmitting,stopError:ei.error,isLoading:c||f,loadError:u||x,isReconnecting:K.isReconnecting,connectTimedOut:K.connectTimedOut,isSlow:K.isSlow,streamError:K.error,reconnectStream:K.reconnect}}(t,n),d=(0,A.fromProtoHarness)(u.session?.spec?.harness??rn.Harness.UNSPECIFIED),m=(0,rr.fromProtoExecutionTarget)(u.session?.spec?.executionTarget??rn.ExecutionTarget.UNSPECIFIED),[h,p]=function(e){let t=e?.harness,n=e?.enabled??!0,{getModel:r}=(0,V.useModelRegistry)({harness:t}),i="cursor"===t?"stigmer:session:model:cursor":"stigmer:session:model",a=(0,s.useRef)(i),[o,l]=(0,s.useState)(()=>{if(!n)return;let e=localStorage.getItem(i);return e?rg(e):void 0});return((0,s.useEffect)(()=>{if(!n||a.current===i)return;a.current=i;let e=localStorage.getItem(i);l(e?rg(e):void 0)},[n,i]),(0,s.useEffect)(()=>{n&&o&&localStorage.setItem(i,o)},[n,o,i]),n)?[o&&r(o)?o:void 0,l]:[void 0,rc]}({harness:d,enabled:!i}),f=(0,s.useMemo)(()=>{let e=u.completedExecutions.at(-1);return e?.spec?.executionConfig?.modelName||void 0},[u.completedExecutions]),x=h??f,v=[x,p],b=(0,s.useMemo)(()=>(0,rs.fromProtoInteractionMode)(u.completedExecutions.at(-1)?.spec?.executionConfig?.interactionMode),[u.completedExecutions]),[j,y]=(0,s.useState)(null),k=(0,sb.useWorkspaceEntries)(),w=sy(),[S,N]=(0,s.useState)([]),[C,E]=(0,s.useState)([]),R=(0,s.useRef)(!1),T=(0,sS.useApprovalDefaults)(),[M,I]=(0,s.useState)(null),L=!i&&(e.accountDefaults?.autoApprove??!1),P=!i&&(T?.autoApproveAll??!1),O=u.activeStreamExecution?.spec?.autoApproveAll===!0,F=M??(L||P||O),D=(0,s.useCallback)(e=>{I(e)},[]),B=(0,s.useCallback)(async(e,t,s)=>{t===tO.ApprovalAction.APPROVE_ALL&&I(!0),await u.submitApproval(e,t,s)},[u.submitApproval]),$=!i&&"observer"!==e.audience&&!(0,ru.isChannelOriginSession)(u.session),_=(0,s.useRef)(new Set);(0,s.useEffect)(()=>{if(F&&$)for(let e of u.pendingApprovals){let t=e.toolCallId;!t||_.current.has(t)||(_.current.add(t),u.submitApproval(t,tO.ApprovalAction.APPROVE_ALL).catch(()=>{}))}},[F,$,u.pendingApprovals,u.submitApproval]);let U=u.session?.spec?.agentInstanceId??null,{agentRef:W}=function(e){let t=(0,et.useStigmer)(),[n,r]=(0,s.useState)(null),[i,a]=(0,s.useState)(!1),[o,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!e){r(null),a(!1),l(null);return}let s={current:!1};return a(!0),l(null),(async()=>{let n=await t.agentInstance.get(e);if(s.current)return;let i=n.spec?.agentId;if(!i)throw Error(`AgentInstance "${e}" has no spec.agentId. Cannot derive an agent reference.`);let o=await t.agent.get(i);if(s.current)return;let l=o.metadata?.org,g=o.metadata?.slug;if(!l||!g)throw Error(`Agent "${i}" is missing metadata.org or metadata.slug. Cannot construct a ResourceRef.`);r({org:l,slug:g,kind:ee.ApiResourceKind.agent}),a(!1)})().catch(e=>{s.current||(l((0,es.toError)(e)),r(null),a(!1))}),()=>{s.current=!0}},[e,t]),{agentRef:n,isLoading:i,error:o}}(i?null:U),[z,H]=(0,s.useState)(null),[K,q]=(0,s.useState)(null),[Y,G]=(0,s.useState)(!1),[X,Z]=(0,s.useState)(!1);!X&&null!==U&&(""===U?Z(!0):W&&(Z(!0),H(W),q({mode:"saved",instanceId:U})));let Q=(0,s.useCallback)(()=>{H(null),q(null),G(!0)},[]),en=(0,s.useCallback)(e=>{null===e?Q():(H(e),G(!1))},[Q]),er=(0,s.useCallback)(e=>{q(e),null!==e&&G(!1)},[]);(0,s.useEffect)(()=>{if(!u.session||R.current)return;R.current=!0;let e=u.session.spec;for(let t of e?.workspaceEntries??[])if(t.source?.source.case==="gitRepo"){let{url:e,branch:s}=t.source.source.value;k.addGitRepo(e,s||void 0)}else t.source?.source.case==="localPath"&&k.addLocalPath(t.source.source.value.path);let t=(0,ri.toSessionUpdateInput)(u.session);t.mcpServerUsages?.length&&N(t.mcpServerUsages),t.skillRefs?.length&&E(t.skillRefs)},[u.session,k]);let[ei,ea]=(0,s.useState)(null),eo=(0,s.useCallback)(async(e,t,s)=>{let n,i;ea(null);try{if(K){if("saved"===K.mode&&K.instanceId!==U)n=K.instanceId;else if("direct"===K.mode&&z){let e=await c.agent.getByReference(z),t=e.status?.defaultInstanceId;t&&t!==U&&(n=t)}}else Y&&U&&(n="");i=r?await sC(r,s?.runtimeEnv):s?.runtimeEnv}catch(e){ea(e instanceof Error?e:Error(String(e)));return}u.sendFollowUp(e,{agentInstanceId:n,modelName:o??t??x,workspaceEntries:k.hasEntries?k.toInput():void 0,mcpServerUsages:S.length>0?S:void 0,skillRefs:C.length>0?C:void 0,runtimeEnv:i,attachments:s?.attachments,interactionMode:s?.interactionMode,serviceTier:o?"fast"===l?"fast":void 0:s?.serviceTier,thinkingMode:o?"enabled"===g?"enabled":void 0:s?.thinkingMode,buildFromPlan:s?.buildFromPlan,autoApproveAll:F||void 0,workspaceFileRefs:s?.workspaceFileRefs,supersedesExecutionId:s?.supersedesExecutionId}),w.clear()},[u.sendFollowUp,x,o,l,g,k,S,C,w.clear,K,z,Y,U,c,F,r]),el=(0,s.useMemo)(()=>{if(u.activeStreamExecution)return u.activeStreamExecution;let e=u.completedExecutions;return e.length>0?e[e.length-1]:null},[u.activeStreamExecution,u.completedExecutions]),eg=(0,s.useMemo)(()=>[...u.completedExecutions,...u.activeStreamExecution?[u.activeStreamExecution]:[]],[u.completedExecutions,u.activeStreamExecution]),ec=(0,s.useMemo)(()=>u.workspaceEntries.some(e=>e.source?.source.case==="gitRepo")?"/home/daytona/workspace":void 0,[u.workspaceEntries]);return{conv:u,harness:d,executionTarget:m,model:v,interactionMode:[j??b??"agent",y],agentRef:z,setAgentRef:en,resolution:K,setResolution:er,clearAgent:Q,mcpServerUsages:S,setMcpServerUsages:N,skillRefs:C,setSkillRefs:E,workspace:k,sessionVariables:w,autoApproveAll:F,setAutoApproveAll:D,submitApproval:B,handleSubmit:eo,submitError:ei,displayExecution:el,allExecutions:eg,sandboxWorkspaceRoot:ec}}({sessionId:e,org:r,getRuntimeEnv:d,audience:m,runConfig:h,accountDefaults:p}),{conv:R}=E,T="guest"===m,M=f&&!T&&h?.modelName===void 0,I="observer"===m||(0,ru.isChannelOriginSession)(R.session),L="integrator"!==m||I,P="none"!==x&&!T,[O,F]=E.model,[D,B]=E.interactionMode,$=(0,s.useRef)(null),_=E.displayExecution?.status?.phase??tO.ExecutionPhase.EXECUTION_PHASE_UNSPECIFIED,U=_!==tO.ExecutionPhase.EXECUTION_PHASE_UNSPECIFIED,{hasWriteBacks:W,writeBackCount:z}=sD(E.allExecutions),{artifactCount:H}=sO(E.allExecutions),K=(0,et.useStigmer)(),q=(0,s.useMemo)(()=>(0,nO.findLatestSessionPlan)(E.allExecutions),[E.allExecutions]),Y=function(e){let[t,n]=(0,s.useState)(null),r=e?rh(e):null,i=null!==t&&null!==r&&t.key===r?t.text:null,a=(0,s.useRef)(t);a.current=t;let o=(0,s.useRef)(r);o.current=r;let l=(0,s.useCallback)(e=>{let t=o.current;t&&n(null===e?null:{key:t,text:e})},[]),g=(0,s.useCallback)(()=>{let e=a.current,t=o.current;return null!==e&&null!==t&&e.key===t?e.text:null},[]);return(0,s.useMemo)(()=>({draftText:i,isEdited:null!==i,setDraft:l,readDraft:g}),[i,l,g])}(q),G=(0,s.useMemo)(()=>{let e=R.activeStreamExecution,t=(0,rt.findStreamingPlan)(e),s=e?.metadata?.id;return t&&s?{executionId:s,displayText:t.displayText}:void 0},[R.activeStreamExecution]),[X,Z]=(0,s.useState)(!1),[Q,en]=(0,s.useState)(!1),[er,ei]=(0,s.useState)(null),ea=q?rh(q):null,eo=G?`${G.executionId}:streaming`:ea,[el,eg]=(0,s.useState)(eo);eo!==el&&(eg(eo),ei(null));let ec=sF({phase:U?_:null,hasChanges:W,planKey:P?eo:null,open:!!P&&b,defaultOpen:v,onOpenChange:P?j:void 0}),eu=(0,s.useCallback)(()=>{B("agent"),en(!1);let e=e=>{$.current?.submit("Build from plan",{interactionMode:"agent",buildFromPlan:!0,attachments:e})};if(!q)return void e();Z(!0);let t=q.artifact.name;(async()=>{try{let s=Y.readDraft()??await rU(K,q),n=await K.agentExecution.uploadAttachment((0,J.create)(eL.UploadAttachmentRequestSchema,{filename:t,content:new TextEncoder().encode(s),contentType:"text/markdown"}));e([{filename:t,storageKey:n.storageKey,mountPath:`.stigmer/inputs/${t}`,contentType:"text/markdown"}])}catch{en(!0),e()}finally{Z(!1)}})()},[B,q,Y.readDraft,K]),ed=(0,s.useCallback)(e=>{ei(q&&e===q.executionId?null:e),ec.openPlanDocument()},[q,ec.openPlanDocument]),em=(0,s.useCallback)(e=>{ec.openArtifact(e.artifact)},[ec.openArtifact]),eh=(0,s.useCallback)(e=>{ec.pinArtifact(e.artifact)},[ec.pinArtifact]),ep=(0,s.useCallback)(e=>{if(!P)return!1;let t=n0(e,E.workspace.entries,E.sandboxWorkspaceRoot);return!!t&&(ec.openFile(t.entryId,t.path),!0)},[P,E.workspace.entries,E.sandboxWorkspaceRoot,ec.openFile]);return R.isLoading?(0,t.jsx)("div",{className:(0,n.cn)("stg:flex stg:h-full stg:w-full stg:flex-col",C),children:(0,t.jsx)(re,{className:"stg:flex-1 stg:px-0"})}):R.loadError?(0,t.jsx)(rH,{error:R.loadError}):R.session||R.isLoading?(0,t.jsx)(to,{className:C,headerActions:k&&!P?(0,t.jsxs)(t.Fragment,{children:[y,(0,t.jsx)(rV,{sessionId:e})]}):y,chip:P?(0,t.jsx)(nq,{isOpen:ec.isOpen,onToggle:ec.isOpen?ec.closePanel:ec.openPanel,badgeCount:z+H}):void 0,splitStorageKey:"stgm-session-chat-width",conversation:(0,t.jsx)(rW,{flow:E,modelId:O,setModelId:F,interactionMode:D,setInteractionMode:B,composerRef:$,org:r,gitHubConnection:i,enableGitHub:a,enableLocal:o,onBrowseLocalFolder:l,onBuildFromPlan:eu,onOpenPlan:ed,isBuildingFromPlan:X,planAttachFailed:Q,onDismissPlanAttachFailed:()=>en(!1),onFilePathClick:ep,isCurated:L,isGuest:T,isObserver:I,modelSelectorVisible:M,threadSlots:N}),panel:ec.isOpen&&P?(0,t.jsx)(rz,{flow:E,org:r,panel:ec,accessSlot:I?void 0:w,onApplied:S,onImplementPlan:I?void 0:eu,implementPlanDisabled:I||!R.canSendFollowUp||X,sessionPlan:q,streamingPlan:G,planDraft:Y,openPlanExecutionId:er,onOpenPlan:ed,onOpenArtifact:em,onActivateArtifact:eh,enableLocal:o,onBrowseLocalFolder:l,workspaceFileLister:g,workspaceFileReader:c,workspaceContentSearcher:u,isCurated:L,isObserver:I,exportSessionId:k?e:null}):null}):(0,t.jsx)(rK,{})}],766895)}]);