@alwith/module-chat 0.5.11 → 0.5.12

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 (262) hide show
  1. package/dist/activity-host.js +1 -1
  2. package/dist/approval/choice-elicitation-form.js +1 -1
  3. package/dist/approval/choice-schema.js +1 -1
  4. package/dist/approval/permission-options.js +1 -1
  5. package/dist/approval/permission-view.js +1 -1
  6. package/dist/approval/schema-elicitation-form.js +1 -1
  7. package/dist/approval/url-elicitation-card.js +1 -1
  8. package/dist/{chunk-0gwe31zs.js → chunk-023yzyq8.js} +2 -2
  9. package/dist/{chunk-91x8etvh.js → chunk-0qm0fy2r.js} +2 -2
  10. package/dist/{chunk-ha5jfz6r.js → chunk-1dh0q11h.js} +3 -3
  11. package/dist/{chunk-rnykpmn2.js → chunk-1k03fpcj.js} +1 -1
  12. package/dist/{chunk-96xwaa2t.js → chunk-24b1z856.js} +2 -2
  13. package/dist/{chunk-syffw61b.js → chunk-27vftbhf.js} +4 -4
  14. package/dist/{chunk-m99k3e5h.js → chunk-2w576ygb.js} +2 -2
  15. package/dist/{chunk-5kpcpjrb.js → chunk-36t9x2qc.js} +3 -3
  16. package/dist/{chunk-r79zqx0t.js → chunk-3ah1ez70.js} +5 -5
  17. package/dist/{chunk-5w92bzgs.js → chunk-3dvx2q8w.js} +2 -2
  18. package/dist/{chunk-qj63fv6w.js → chunk-3g66qg03.js} +2 -2
  19. package/dist/{chunk-bhze2sjv.js → chunk-3q6ssrs3.js} +2 -2
  20. package/dist/{chunk-krmz8t4p.js → chunk-4wkpatzz.js} +2 -2
  21. package/dist/{chunk-460phps1.js → chunk-58bs5f2z.js} +2 -2
  22. package/dist/{chunk-rszktjdw.js → chunk-62m11b37.js} +3 -3
  23. package/dist/{chunk-t6t6hgzx.js → chunk-63zq5nr8.js} +2 -2
  24. package/dist/chunk-6nyba0m4.js +2 -0
  25. package/dist/{chunk-m6rrt94g.js → chunk-753s76b6.js} +2 -2
  26. package/dist/chunk-76w1a72z.js +2 -0
  27. package/dist/{chunk-30wqrz8v.js → chunk-7avpdkmf.js} +2 -2
  28. package/dist/{chunk-vv1ghqq3.js → chunk-8712sy9s.js} +1 -1
  29. package/dist/{chunk-sr5rcdza.js → chunk-8a1j96d1.js} +2 -2
  30. package/dist/{chunk-7k0wvvy0.js → chunk-8jpm8fnf.js} +1 -1
  31. package/dist/{chunk-ysc51tpb.js → chunk-9hvbm4be.js} +1 -1
  32. package/dist/{chunk-kahn24np.js → chunk-9t8ptjct.js} +2 -2
  33. package/dist/{chunk-5ev4qvsp.js → chunk-9v94xnhp.js} +2 -2
  34. package/dist/{chunk-50qyant6.js → chunk-a1kmc6t8.js} +3 -3
  35. package/dist/{chunk-17zegmxa.js → chunk-a2hygrpr.js} +1 -1
  36. package/dist/{chunk-5m4605a3.js → chunk-ana59z25.js} +1 -1
  37. package/dist/{chunk-magaaqab.js → chunk-anfrrs5x.js} +1 -1
  38. package/dist/chunk-b1vw42he.js +2 -0
  39. package/dist/{chunk-5fgakrmr.js → chunk-b3nt7axf.js} +2 -2
  40. package/dist/{chunk-p1ydsj54.js → chunk-b5z75meq.js} +2 -2
  41. package/dist/{chunk-mgtkmbmd.js → chunk-bbwb4555.js} +2 -2
  42. package/dist/{chunk-znx2e9e7.js → chunk-bcrq96dw.js} +2 -2
  43. package/dist/{chunk-ynw0f8h2.js → chunk-bftrddmr.js} +2 -2
  44. package/dist/{chunk-443z7mve.js → chunk-bna24ggr.js} +2 -2
  45. package/dist/chunk-bzk6wn2s.js +3 -0
  46. package/dist/{chunk-gzff19t3.js → chunk-c7km8xgd.js} +2 -2
  47. package/dist/{chunk-tjgq4882.js → chunk-c9k66x5g.js} +2 -2
  48. package/dist/{chunk-294gms5s.js → chunk-chwg3na0.js} +2 -2
  49. package/dist/chunk-ckft9abb.js +2 -0
  50. package/dist/{chunk-7a6t282a.js → chunk-cy6grsx0.js} +1 -1
  51. package/dist/{chunk-p8nx34zm.js → chunk-d6840cvf.js} +2 -2
  52. package/dist/{chunk-6amcjhqh.js → chunk-ddtb692j.js} +2 -2
  53. package/dist/{chunk-t3ew92b3.js → chunk-dgnk7h62.js} +2 -2
  54. package/dist/{chunk-sex6d2c2.js → chunk-ds6avzj3.js} +2 -2
  55. package/dist/{chunk-k5c82xk9.js → chunk-dxt9j0da.js} +2 -2
  56. package/dist/chunk-e15f3anm.js +3 -0
  57. package/dist/{chunk-j2wty8a3.js → chunk-ee9pzqnq.js} +2 -2
  58. package/dist/{chunk-q905xt4v.js → chunk-evx9d147.js} +2 -2
  59. package/dist/{chunk-dp8pjv6r.js → chunk-f3e3ged2.js} +1 -1
  60. package/dist/chunk-f7n8erng.js +2 -0
  61. package/dist/{chunk-b4dsjhkq.js → chunk-fa0kzj3j.js} +1 -1
  62. package/dist/{chunk-20svvgj3.js → chunk-fnbs3dq1.js} +2 -2
  63. package/dist/{chunk-88xay4pa.js → chunk-fpx4ng0t.js} +2 -2
  64. package/dist/{chunk-hjnf5kvc.js → chunk-fteek5h4.js} +2 -2
  65. package/dist/{chunk-133f0wed.js → chunk-gbbpdhg6.js} +2 -2
  66. package/dist/{chunk-m28hdj8j.js → chunk-gpz9f9zq.js} +2 -2
  67. package/dist/{chunk-0n240acr.js → chunk-gszy4mhj.js} +2 -2
  68. package/dist/{chunk-zbtas7pt.js → chunk-gtqwgjjg.js} +2 -2
  69. package/dist/{chunk-4nh3xzrm.js → chunk-hgj33wbd.js} +2 -2
  70. package/dist/chunk-hh498geh.js +7 -0
  71. package/dist/chunk-hpyaxv6h.js +2 -0
  72. package/dist/{chunk-m8djwdd5.js → chunk-ht28382s.js} +2 -2
  73. package/dist/{chunk-wb3zpzk3.js → chunk-hw99hhjf.js} +1 -1
  74. package/dist/{chunk-jn0q0b7k.js → chunk-hwfwd04r.js} +2 -2
  75. package/dist/{chunk-6edz9f7j.js → chunk-hz1pgnqp.js} +2 -2
  76. package/dist/chunk-jr591zg2.js +2 -0
  77. package/dist/{chunk-y3qgsj79.js → chunk-jtv179nm.js} +1 -1
  78. package/dist/{chunk-cke0v0a7.js → chunk-kbwjcnf6.js} +1 -1
  79. package/dist/{chunk-g7p46jq1.js → chunk-kfs19vc5.js} +2 -2
  80. package/dist/{chunk-7h8pv9eg.js → chunk-ks05sstp.js} +1 -1
  81. package/dist/{chunk-0yvbqccv.js → chunk-kw487283.js} +2 -2
  82. package/dist/{chunk-6d7ppje3.js → chunk-m6h92nq4.js} +2 -2
  83. package/dist/{chunk-fe3c678p.js → chunk-mk379yt7.js} +2 -2
  84. package/dist/{chunk-cgqhz23q.js → chunk-mkw0twsb.js} +2 -2
  85. package/dist/{chunk-4svcj9c6.js → chunk-mvv5xmap.js} +2 -2
  86. package/dist/{chunk-knsf6jm1.js → chunk-mwd0ed0c.js} +2 -2
  87. package/dist/chunk-nad1erxy.js +3 -0
  88. package/dist/{chunk-f1zvbkak.js → chunk-nwrbpw97.js} +1 -1
  89. package/dist/{chunk-5hsmhj1g.js → chunk-phy911dk.js} +2 -2
  90. package/dist/{chunk-7jdazbzv.js → chunk-q256c3hn.js} +2 -2
  91. package/dist/{chunk-a3krtv66.js → chunk-qg1b5k6m.js} +2 -2
  92. package/dist/chunk-qv4x469a.js +2 -0
  93. package/dist/{chunk-qw0jp3wm.js → chunk-qwyvq7bk.js} +2 -2
  94. package/dist/{chunk-tv89wh8b.js → chunk-r0t8zj4g.js} +2 -2
  95. package/dist/{chunk-xh8wth6z.js → chunk-rag9xsg5.js} +2 -2
  96. package/dist/{chunk-abwjd5yv.js → chunk-reaxcamj.js} +1 -1
  97. package/dist/{chunk-e55zxnda.js → chunk-rrrpp44m.js} +2 -2
  98. package/dist/{chunk-64whvkk0.js → chunk-rtg6xfgr.js} +1 -1
  99. package/dist/chunk-s2k5xynq.js +2 -0
  100. package/dist/{chunk-qpc4ca5y.js → chunk-sbyn62qx.js} +2 -2
  101. package/dist/chunk-shsyer15.js +2 -0
  102. package/dist/{chunk-w43dvzqk.js → chunk-sn80gr8g.js} +3 -3
  103. package/dist/{chunk-hxhptw6e.js → chunk-tjpr0adf.js} +2 -2
  104. package/dist/{chunk-zz734bzf.js → chunk-tjykfxrd.js} +2 -2
  105. package/dist/{chunk-rnzphmk6.js → chunk-tm4ee7m3.js} +2 -2
  106. package/dist/{chunk-7drq0g9b.js → chunk-tt40vzdd.js} +2 -2
  107. package/dist/{chunk-f4h7yb7d.js → chunk-vc9ts6wp.js} +2 -2
  108. package/dist/{chunk-cpk3y6ad.js → chunk-vcbv30ph.js} +2 -2
  109. package/dist/{chunk-cjztkcsm.js → chunk-vyccmpdn.js} +2 -2
  110. package/dist/{chunk-w8qmh6he.js → chunk-w45d5th9.js} +2 -2
  111. package/dist/{chunk-0d4xsx23.js → chunk-wmk2dwpf.js} +2 -2
  112. package/dist/{chunk-gj3j9zh5.js → chunk-x2tsybks.js} +3 -3
  113. package/dist/{chunk-nkypxxjk.js → chunk-xa20eex9.js} +1 -1
  114. package/dist/{chunk-hrsz92yq.js → chunk-xd5rqbwp.js} +1 -1
  115. package/dist/{chunk-728v2as1.js → chunk-xj0y094j.js} +2 -2
  116. package/dist/{chunk-377s443r.js → chunk-y0psrvcc.js} +2 -2
  117. package/dist/{chunk-j2wtwb37.js → chunk-y1kkt0m2.js} +2 -2
  118. package/dist/{chunk-ryz4c13z.js → chunk-y6r6tzfh.js} +2 -2
  119. package/dist/chunk-zg2342s2.js +2 -0
  120. package/dist/{chunk-jhk2chpp.js → chunk-zmpbfbnn.js} +1 -1
  121. package/dist/{chunk-mt965yn0.js → chunk-znyyzs85.js} +2 -2
  122. package/dist/{chunk-6pmc9283.js → chunk-zp5ntx27.js} +1 -1
  123. package/dist/{chunk-qah4fs3d.js → chunk-zw3h5xgf.js} +1 -1
  124. package/dist/codex/activity-group.js +1 -1
  125. package/dist/codex/assistant-message.d.ts +2 -1
  126. package/dist/codex/assistant-message.js +1 -1
  127. package/dist/codex/async-question-card.js +1 -1
  128. package/dist/codex/disclosure-state.js +1 -1
  129. package/dist/codex/edited-files-card.js +1 -1
  130. package/dist/codex/image-view-activity.js +1 -1
  131. package/dist/codex/markdown-renderer.js +1 -1
  132. package/dist/codex/navigation-audio.js +1 -1
  133. package/dist/codex/navigation-preview.js +1 -1
  134. package/dist/codex/navigation-rail.js +1 -1
  135. package/dist/codex/patch-view.js +1 -1
  136. package/dist/codex/plan.js +1 -1
  137. package/dist/codex/timeline-virtualizer.js +1 -1
  138. package/dist/codex/turn-activity.d.ts +1 -1
  139. package/dist/codex/turn-activity.js +1 -1
  140. package/dist/codex/user-message.js +1 -1
  141. package/dist/codex/virtualized-turn-list.js +1 -1
  142. package/dist/composer/completion-filter.js +1 -1
  143. package/dist/composer/completion-menu.js +1 -1
  144. package/dist/composer/completion-trigger.js +1 -1
  145. package/dist/composer/effort-slider.js +1 -1
  146. package/dist/composer/menu-radio.js +1 -1
  147. package/dist/composer/model-select.js +1 -1
  148. package/dist/composer/permission-mode-select.js +1 -1
  149. package/dist/composer/prompt-input-attachments.js +1 -1
  150. package/dist/composer/prompt-input-clipboard.js +1 -1
  151. package/dist/composer/prompt-input-context.js +1 -1
  152. package/dist/composer/prompt-input-textarea.js +1 -1
  153. package/dist/composer/prompt-input.js +1 -1
  154. package/dist/conversation/action-card.js +1 -1
  155. package/dist/conversation/composer/composer.d.ts +2 -1
  156. package/dist/conversation/composer/composer.js +1 -1
  157. package/dist/conversation/composer/config-options.js +1 -1
  158. package/dist/conversation/composer/context.d.ts +1 -0
  159. package/dist/conversation/composer/context.js +1 -1
  160. package/dist/conversation/composer/drafts.js +1 -1
  161. package/dist/conversation/composer/long-text.js +1 -1
  162. package/dist/conversation/composer/mention-chips.js +1 -1
  163. package/dist/conversation/composer/model-menu.d.ts +1 -1
  164. package/dist/conversation/composer/model-menu.js +1 -1
  165. package/dist/conversation/composer/pasted-text-attachment.js +1 -1
  166. package/dist/conversation/composer/permission-mode-menu.js +1 -1
  167. package/dist/conversation/composer/prediction.js +1 -1
  168. package/dist/conversation/composer/slash-command-button.js +1 -1
  169. package/dist/conversation/composer/submit-button.js +1 -1
  170. package/dist/conversation/composer/usage-meter.js +1 -1
  171. package/dist/conversation/context.js +1 -1
  172. package/dist/conversation/conversation-body.js +1 -1
  173. package/dist/conversation/conversation-view.js +1 -1
  174. package/dist/conversation/conversation.js +1 -1
  175. package/dist/conversation/diff-modal.js +1 -1
  176. package/dist/conversation/session-actions.js +1 -1
  177. package/dist/image-lightbox.js +1 -1
  178. package/dist/image-preview-dialog.js +1 -1
  179. package/dist/lib/code-highlighter.js +1 -1
  180. package/dist/lib/fuzzy.js +1 -1
  181. package/dist/lib/group-blocks.js +1 -1
  182. package/dist/lib/image-encode.js +1 -1
  183. package/dist/lib/limits.js +1 -1
  184. package/dist/lib/markdown-parser.js +1 -1
  185. package/dist/lib/markdown-rules.js +1 -1
  186. package/dist/lib/model-name.js +1 -1
  187. package/dist/lib/pointer-centered-zoom.js +1 -1
  188. package/dist/lib/prepare-prompt-files.js +1 -1
  189. package/dist/lib/stream-style.js +1 -1
  190. package/dist/lib/streaming-markdown.js +1 -1
  191. package/dist/locales.d.ts +13 -0
  192. package/dist/locales.js +1 -1
  193. package/dist/search/chat-search.js +1 -1
  194. package/dist/search/dom-matches.js +1 -1
  195. package/dist/search/find-bar.js +1 -1
  196. package/dist/search/literal-matches.js +1 -1
  197. package/dist/session-list/archived-sessions.js +1 -1
  198. package/dist/session-list/host.js +1 -1
  199. package/dist/session-list/navigation.js +1 -1
  200. package/dist/session-list/overflow-marquee.js +1 -1
  201. package/dist/session-list/session-groups.js +1 -1
  202. package/dist/session-list/session-info-card.js +1 -1
  203. package/dist/session-list/session-list.js +1 -1
  204. package/dist/session-list/session-row.js +1 -1
  205. package/dist/session-list/session-state-dot.js +1 -1
  206. package/dist/session-list/session-state-menu.js +1 -1
  207. package/dist/session-list/sidebar-overlay.js +1 -1
  208. package/dist/session-list/trailing-swap.js +1 -1
  209. package/dist/session-list/use-activity-preview.js +1 -1
  210. package/dist/session-list/use-project-sessions.js +1 -1
  211. package/dist/session-list/virtual-session-rows.js +1 -1
  212. package/dist/session-timeline/activity-group.js +1 -1
  213. package/dist/session-timeline/activity-projection.d.ts +2 -1
  214. package/dist/session-timeline/activity-projection.js +1 -1
  215. package/dist/session-timeline/assistant-content.js +1 -1
  216. package/dist/session-timeline/assistant-turn.js +1 -1
  217. package/dist/session-timeline/async-questions.js +1 -1
  218. package/dist/session-timeline/edited-files-card.js +1 -1
  219. package/dist/session-timeline/history-timeline.js +1 -1
  220. package/dist/session-timeline/host.js +1 -1
  221. package/dist/session-timeline/navigation-rail.js +1 -1
  222. package/dist/session-timeline/plan.js +1 -1
  223. package/dist/session-timeline/question-reply.js +1 -1
  224. package/dist/session-timeline/resource-content.js +1 -1
  225. package/dist/session-timeline/session-timeline.js +1 -1
  226. package/dist/session-timeline/timeline-registry.js +1 -1
  227. package/dist/session-timeline/turn-activity.js +1 -1
  228. package/dist/session-timeline/turn-error.js +1 -1
  229. package/dist/session-timeline/turn-retry.js +1 -1
  230. package/dist/session-timeline/turns.js +1 -1
  231. package/dist/session-timeline/use-timeline-scroll.js +1 -1
  232. package/dist/session-timeline/user-message.js +1 -1
  233. package/dist/types.d.ts +1 -0
  234. package/dist/ui/alert.js +1 -1
  235. package/dist/ui/badge.js +1 -1
  236. package/dist/ui/card.js +1 -1
  237. package/dist/ui/dialog.js +1 -1
  238. package/dist/ui/dropdown-menu.js +1 -1
  239. package/dist/ui/empty.js +1 -1
  240. package/dist/ui/field.js +1 -1
  241. package/dist/ui/input-group-textarea.js +1 -1
  242. package/dist/ui/input-group.js +1 -1
  243. package/dist/ui/kbd.js +1 -1
  244. package/dist/ui/radio-group.js +1 -1
  245. package/dist/ui/select.js +1 -1
  246. package/dist/ui/tooltip.js +1 -1
  247. package/package.json +1 -1
  248. package/dist/chunk-0kwfy29d.js +0 -2
  249. package/dist/chunk-3e0mfcj6.js +0 -2
  250. package/dist/chunk-3vrtepy0.js +0 -3
  251. package/dist/chunk-4b3s7gyc.js +0 -3
  252. package/dist/chunk-51sbmqdk.js +0 -2
  253. package/dist/chunk-7dzq2t68.js +0 -2
  254. package/dist/chunk-93x6b2qa.js +0 -3
  255. package/dist/chunk-9a4kjze3.js +0 -7
  256. package/dist/chunk-9tdzg6e6.js +0 -2
  257. package/dist/chunk-d84cxw1v.js +0 -2
  258. package/dist/chunk-e11qjnb4.js +0 -2
  259. package/dist/chunk-k3375qqd.js +0 -2
  260. package/dist/chunk-p8qgqtkc.js +0 -2
  261. package/dist/chunk-w6hhyjcn.js +0 -2
  262. package/dist/chunk-zt8qaqbz.js +0 -2
@@ -1,2 +1,2 @@
1
- import{o}from"./chunk-dp8pjv6r.js";import{Ae,Le,De}from"./chunk-b65vdzz3.js";import{n}from"./chunk-ysc51tpb.js";import{x,ne}from"./chunk-bhze2sjv.js";import{hasAccount as M,isGroupedSelect as L}from"@nyssance/codex-acp-v2/client";import{cn as H}from"cn";import{useEffect as W,useState as T}from"react";import{jsx as r,jsxs as u}from"react/jsx-runtime";var m=new Intl.NumberFormat("en-US",{maximumFractionDigits:0}),F=new Intl.NumberFormat("en-US",{style:"percent",maximumFractionDigits:1}),z=new Intl.NumberFormat("en-US",{maximumFractionDigits:1});function f(a){return typeof a==="number"&&!Number.isNaN(a)?Math.max(0,a):0}function O(a,t){let e=Math.min(100,a/t*100),p=e>=90?"text-destructive":e>=70?"text-foreground":"text-muted-foreground";return{pct:e,className:p}}function A(a){let t=x(a.configOptions,"model");return t===void 0?void 0:ne(t)}function Oo(a,t){let e=a.windowDurationMins;if(e===null)return t("usage.usage");if(e%1440===0)return t("usage.windowDays",{count:e/1440});return t("usage.windowHours",{count:Math.round(e/60)})}function I(a){let{client:t}=n(),e=o((s)=>a&&s.connection==="ready"&&M(s.agent)),[p,l]=T(null);return W(()=>{if(!e){l(null);return}let s=!0;t.readRateLimits().then((d)=>{if(s)l(d)},()=>{return});let c=t.onRateLimits((d)=>{if(s)l(d)});return()=>{s=!1,c()}},[e,t]),e?p:null}function dt({session:a}){let{t}=n().host,e=x(a.configOptions,"model"),p=e!==void 0&&(L(e.options)?e.options.some((i)=>i.groupId==="chatgpt"&&i.options.some((y)=>y.value===e.currentValue)):!e.currentValue.startsWith("gateway:")&&e.options.some((i)=>i.value===e.currentValue)),l=I(p),{usage:s,lastTurnUsage:c}=a;if(s===null&&c===null)return null;let d=s&&s.size>0?O(s.used,s.size):null,h=7,b=2*Math.PI*h,N=f(c?.inputTokens),k=f(c?.outputTokens),g=f(c?.cachedReadTokens),w=f(c?.cachedWriteTokens),S=f(c?.totalTokens)||N+k+g+w,R=N+g,C=R>0?F.format(g/R):t("tokens.notAvailable"),D=[[t("tokens.input"),m.format(N)],[t("tokens.output"),m.format(k)],[t("tokens.cachedRead"),m.format(g)],[t("tokens.cachedWrite"),m.format(w)],[t("tokens.cacheHitRate"),C],[t("tokens.total"),m.format(S)]],v=A(a);return u(Ae,{children:[r(Le,{delay:100,closeDelay:100,render:u("button",{type:"button",className:H("hover:text-foreground flex h-7 items-center gap-1.5 rounded-md px-1.5 text-xs tabular-nums",d?.className??"text-muted-foreground"),"aria-label":t("tokens.openDetails"),children:[u("svg",{viewBox:"0 0 18 18",className:"size-4","aria-hidden":"true",children:[r("circle",{cx:"9",cy:"9",r:h,fill:"none",stroke:"currentColor",strokeOpacity:"0.2",strokeWidth:"2"}),d!==null&&r("circle",{cx:"9",cy:"9",r:h,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:b,strokeDashoffset:b*(1-d.pct/100),transform:"rotate(-90 9 9)"})]}),d!==null&&u("span",{children:[Math.round(d.pct),"%"]})]})}),u(De,{align:"end",side:"top",sideOffset:8,className:"w-56 p-0",children:[v!==void 0&&r("div",{className:"border-b px-3 py-2",children:r("p",{className:"text-foreground truncate text-xs font-semibold",title:v,children:v})}),u("div",{className:"flex flex-col gap-3 p-3",children:[c!==null&&u("div",{className:"flex flex-col gap-1.5",children:[r("p",{className:"text-xs font-medium",children:t("tokens.openDetails")}),r("dl",{className:"grid grid-cols-[1fr_auto] gap-x-4 gap-y-1 text-xs",children:D.map(([i,y])=>u("div",{className:"contents",children:[r("dt",{className:"text-muted-foreground",children:i}),r("dd",{className:"text-end tabular-nums",children:y})]},i))})]}),s!==null&&s.size>0&&u("div",{className:"flex flex-col gap-1.5 border-t pt-2",children:[r("p",{className:"text-xs font-medium",children:t("tokens.context")}),r("p",{className:"text-muted-foreground text-xs tabular-nums",children:t("tokens.contextSummary",{used:m.format(s.used),limit:m.format(s.size),percent:z.format(s.used/s.size*100)})})]}),l!==null&&(l.primary!==null||l.secondary!==null)&&u("div",{className:"flex flex-col gap-1.5 border-t pt-2",children:[r("p",{className:"text-xs font-medium",children:t("usage.limits")}),r("dl",{className:"grid grid-cols-[1fr_auto] gap-x-4 gap-y-1 text-xs",children:[l.primary,l.secondary].filter((i)=>i!==null).map((i)=>u("div",{className:"contents",children:[r("dt",{className:"text-muted-foreground",children:Oo(i,t)}),r("dd",{className:"text-end tabular-nums",children:t("usage.used",{percent:Math.round(Math.min(100,Math.max(0,i.usedPercent)))})})]},`${i.windowDurationMins??"window"}`))})]})]})]})]})}
2
- export{Oo,dt};
1
+ import{o}from"./chunk-f3e3ged2.js";import{Ae,Le,De}from"./chunk-b65vdzz3.js";import{n}from"./chunk-9hvbm4be.js";import{x,ne}from"./chunk-3q6ssrs3.js";import{hasAccount as M,isGroupedSelect as L}from"@nyssance/codex-acp-v2/client";import{cn as H}from"cn";import{useEffect as W,useState as T}from"react";import{jsx as r,jsxs as u}from"react/jsx-runtime";var m=new Intl.NumberFormat("en-US",{maximumFractionDigits:0}),F=new Intl.NumberFormat("en-US",{style:"percent",maximumFractionDigits:1}),z=new Intl.NumberFormat("en-US",{maximumFractionDigits:1});function f(a){return typeof a==="number"&&!Number.isNaN(a)?Math.max(0,a):0}function O(a,t){let e=Math.min(100,a/t*100),p=e>=90?"text-destructive":e>=70?"text-foreground":"text-muted-foreground";return{pct:e,className:p}}function A(a){let t=x(a.configOptions,"model");return t===void 0?void 0:ne(t)}function Fo(a,t){let e=a.windowDurationMins;if(e===null)return t("usage.usage");if(e%1440===0)return t("usage.windowDays",{count:e/1440});return t("usage.windowHours",{count:Math.round(e/60)})}function I(a){let{client:t}=n(),e=o((s)=>a&&s.connection==="ready"&&M(s.agent)),[p,l]=T(null);return W(()=>{if(!e){l(null);return}let s=!0;t.readRateLimits().then((d)=>{if(s)l(d)},()=>{return});let c=t.onRateLimits((d)=>{if(s)l(d)});return()=>{s=!1,c()}},[e,t]),e?p:null}function dt({session:a}){let{t}=n().host,e=x(a.configOptions,"model"),p=e!==void 0&&(L(e.options)?e.options.some((i)=>i.groupId==="chatgpt"&&i.options.some((y)=>y.value===e.currentValue)):!e.currentValue.startsWith("gateway:")&&e.options.some((i)=>i.value===e.currentValue)),l=I(p),{usage:s,lastTurnUsage:c}=a;if(s===null&&c===null)return null;let d=s&&s.size>0?O(s.used,s.size):null,h=7,b=2*Math.PI*h,N=f(c?.inputTokens),k=f(c?.outputTokens),g=f(c?.cachedReadTokens),w=f(c?.cachedWriteTokens),S=f(c?.totalTokens)||N+k+g+w,R=N+g,C=R>0?F.format(g/R):t("tokens.notAvailable"),D=[[t("tokens.input"),m.format(N)],[t("tokens.output"),m.format(k)],[t("tokens.cachedRead"),m.format(g)],[t("tokens.cachedWrite"),m.format(w)],[t("tokens.cacheHitRate"),C],[t("tokens.total"),m.format(S)]],v=A(a);return u(Ae,{children:[r(Le,{delay:100,closeDelay:100,render:u("button",{type:"button",className:H("hover:text-foreground flex h-7 items-center gap-1.5 rounded-md px-1.5 text-xs tabular-nums",d?.className??"text-muted-foreground"),"aria-label":t("tokens.openDetails"),children:[u("svg",{viewBox:"0 0 18 18",className:"size-4","aria-hidden":"true",children:[r("circle",{cx:"9",cy:"9",r:h,fill:"none",stroke:"currentColor",strokeOpacity:"0.2",strokeWidth:"2"}),d!==null&&r("circle",{cx:"9",cy:"9",r:h,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:b,strokeDashoffset:b*(1-d.pct/100),transform:"rotate(-90 9 9)"})]}),d!==null&&u("span",{children:[Math.round(d.pct),"%"]})]})}),u(De,{align:"end",side:"top",sideOffset:8,className:"w-56 p-0",children:[v!==void 0&&r("div",{className:"border-b px-3 py-2",children:r("p",{className:"text-foreground truncate text-xs font-semibold",title:v,children:v})}),u("div",{className:"flex flex-col gap-3 p-3",children:[c!==null&&u("div",{className:"flex flex-col gap-1.5",children:[r("p",{className:"text-xs font-medium",children:t("tokens.openDetails")}),r("dl",{className:"grid grid-cols-[1fr_auto] gap-x-4 gap-y-1 text-xs",children:D.map(([i,y])=>u("div",{className:"contents",children:[r("dt",{className:"text-muted-foreground",children:i}),r("dd",{className:"text-end tabular-nums",children:y})]},i))})]}),s!==null&&s.size>0&&u("div",{className:"flex flex-col gap-1.5 border-t pt-2",children:[r("p",{className:"text-xs font-medium",children:t("tokens.context")}),r("p",{className:"text-muted-foreground text-xs tabular-nums",children:t("tokens.contextSummary",{used:m.format(s.used),limit:m.format(s.size),percent:z.format(s.used/s.size*100)})})]}),l!==null&&(l.primary!==null||l.secondary!==null)&&u("div",{className:"flex flex-col gap-1.5 border-t pt-2",children:[r("p",{className:"text-xs font-medium",children:t("usage.limits")}),r("dl",{className:"grid grid-cols-[1fr_auto] gap-x-4 gap-y-1 text-xs",children:[l.primary,l.secondary].filter((i)=>i!==null).map((i)=>u("div",{className:"contents",children:[r("dt",{className:"text-muted-foreground",children:Fo(i,t)}),r("dd",{className:"text-end tabular-nums",children:t("usage.used",{percent:Math.round(Math.min(100,Math.max(0,i.usedPercent)))})})]},`${i.windowDurationMins??"window"}`))})]})]})]})]})}
2
+ export{Fo,dt};
@@ -1,3 +1,3 @@
1
- import{a}from"./chunk-ryz4c13z.js";import{ChevronDownIcon as v,ChevronUpIcon as b,FileDiffIcon as C}from"lucide-react";import{useState as m}from"react";import{jsx as s,jsxs as n}from"react/jsx-runtime";function x(e){if(e===null||e.length===0)return 0;return e.split(`
2
- `).length}function Or(e){let l=new Map;for(let u of e)for(let d of u.content){if(d.type!=="diff")continue;let f=d,r=f._meta?.alwith?.hunks??[],h=r.reduce((o,i)=>o+x(i.newText),0),c=r.reduce((o,i)=>o+x(i.oldText),0);for(let o of f.changes){let i=l.get(o.path);if(i)i.additions+=h,i.deletions+=c;else l.set(o.path,{path:o.path,additions:h,deletions:c})}}return[...l.values()]}function mo({blocks:e}){return s(Ut,{files:Or(e)})}function Ut({files:e,onOpen:l,renderPath:u}){let{t:d,openLink:f}=a(),[r,h]=m(!0),[c,o]=m(!1);if(e.length===0)return null;let i=e.reduce((t,p)=>t+p.additions,0),g=e.reduce((t,p)=>t+p.deletions,0);return n("section",{className:"codex-edited-files-card",children:[n("div",{className:"codex-edited-files-header",children:[s("div",{className:"codex-edited-files-icon","aria-hidden":"true",children:s(C,{})}),n("div",{className:"codex-edited-files-summary",children:[s("strong",{children:d("stream.codex.editedFilesCount",{count:e.length})}),s("button",{type:"button","data-codex-disclosure":"",onClick:()=>{h((t)=>!t),o(!1)},"aria-expanded":r,children:d(r?"stream.codex.hideChanges":"stream.codex.viewChanges")})]}),n("div",{className:"codex-edited-files-total",title:d("stream.codex.changedLines"),children:[n("span",{className:"codex-diff-additions",children:["+",i]}),n("span",{className:"codex-diff-deletions",children:["-",g]})]})]}),r&&n("div",{className:"codex-edited-files-list",children:[(c?e:e.slice(0,3)).map((t)=>n("div",{className:"codex-edited-file-row",children:[s("button",{type:"button",className:"codex-edited-file-path",title:t.path,onClick:()=>l===void 0?f(t.path):l(t),children:u===void 0?t.path:u(t)}),n("span",{className:"codex-edited-file-counts",children:[n("span",{className:"codex-diff-additions",children:["+",t.additions]}),n("span",{className:"codex-diff-deletions",children:["-",t.deletions]})]})]},t.path)),e.length>3&&n("button",{type:"button",className:"codex-edited-files-more","aria-expanded":c,onClick:()=>o((t)=>!t),children:[d(c?"stream.codex.showFewerFiles":"stream.codex.showMoreFiles",{count:e.length-3}),c?s(b,{size:16,"aria-hidden":"true"}):s(v,{size:16,"aria-hidden":"true"})]})]})]})}
3
- export{Or,mo,Ut};
1
+ import{a}from"./chunk-y6r6tzfh.js";import{ChevronDownIcon as v,ChevronUpIcon as b,FileDiffIcon as C}from"lucide-react";import{useState as m}from"react";import{jsx as s,jsxs as n}from"react/jsx-runtime";function x(e){if(e===null||e.length===0)return 0;return e.split(`
2
+ `).length}function Fr(e){let l=new Map;for(let u of e)for(let d of u.content){if(d.type!=="diff")continue;let f=d,r=f._meta?.alwith?.hunks??[],h=r.reduce((o,i)=>o+x(i.newText),0),c=r.reduce((o,i)=>o+x(i.oldText),0);for(let o of f.changes){let i=l.get(o.path);if(i)i.additions+=h,i.deletions+=c;else l.set(o.path,{path:o.path,additions:h,deletions:c})}}return[...l.values()]}function po({blocks:e}){return s($t,{files:Fr(e)})}function $t({files:e,onOpen:l,renderPath:u}){let{t:d,openLink:f}=a(),[r,h]=m(!0),[c,o]=m(!1);if(e.length===0)return null;let i=e.reduce((t,p)=>t+p.additions,0),g=e.reduce((t,p)=>t+p.deletions,0);return n("section",{className:"codex-edited-files-card",children:[n("div",{className:"codex-edited-files-header",children:[s("div",{className:"codex-edited-files-icon","aria-hidden":"true",children:s(C,{})}),n("div",{className:"codex-edited-files-summary",children:[s("strong",{children:d("stream.codex.editedFilesCount",{count:e.length})}),s("button",{type:"button","data-codex-disclosure":"",onClick:()=>{h((t)=>!t),o(!1)},"aria-expanded":r,children:d(r?"stream.codex.hideChanges":"stream.codex.viewChanges")})]}),n("div",{className:"codex-edited-files-total",title:d("stream.codex.changedLines"),children:[n("span",{className:"codex-diff-additions",children:["+",i]}),n("span",{className:"codex-diff-deletions",children:["-",g]})]})]}),r&&n("div",{className:"codex-edited-files-list",children:[(c?e:e.slice(0,3)).map((t)=>n("div",{className:"codex-edited-file-row",children:[s("button",{type:"button",className:"codex-edited-file-path",title:t.path,onClick:()=>l===void 0?f(t.path):l(t),children:u===void 0?t.path:u(t)}),n("span",{className:"codex-edited-file-counts",children:[n("span",{className:"codex-diff-additions",children:["+",t.additions]}),n("span",{className:"codex-diff-deletions",children:["-",t.deletions]})]})]},t.path)),e.length>3&&n("button",{type:"button",className:"codex-edited-files-more","aria-expanded":c,onClick:()=>o((t)=>!t),children:[d(c?"stream.codex.showFewerFiles":"stream.codex.showMoreFiles",{count:e.length-3}),c?s(b,{size:16,"aria-hidden":"true"}):s(v,{size:16,"aria-hidden":"true"})]})]})]})}
3
+ export{Fr,po,$t};
@@ -1 +1 @@
1
- import{e}from"./chunk-6kn920c5.js";import{Dialog as i}from"@base-ui/react/dialog";import{cn as r}from"cn";import{XIcon as g}from"lucide-react";import{jsx as a,jsxs as l}from"react/jsx-runtime";function d({...o}){return a(i.Root,{"data-slot":"dialog",...o})}function Ni({...o}){return a(i.Trigger,{"data-slot":"dialog-trigger",...o})}function $r({...o}){return a(i.Portal,{"data-slot":"dialog-portal",...o})}function rr({...o}){return a(i.Close,{"data-slot":"dialog-close",...o})}function qr({className:o,...t}){return a(i.Backdrop,{"data-slot":"dialog-overlay",className:r("data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs",o),...t})}function u({className:o,children:t,showCloseButton:n=!0,...s}){return l($r,{children:[a(qr,{}),l(i.Popup,{"data-slot":"dialog-content",className:r("bg-popover text-popover-foreground ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl p-6 text-sm ring-1 duration-100 outline-none sm:max-w-md",o),...s,children:[t,n&&l(i.Close,{"data-slot":"dialog-close",render:a(e,{variant:"ghost",className:"absolute top-4 right-4",size:"icon-sm"}),children:[a(g,{}),a("span",{className:"sr-only",children:"Close"})]})]})]})}function b({className:o,...t}){return a("div",{"data-slot":"dialog-header",className:r("flex flex-col gap-2",o),...t})}function X({className:o,showCloseButton:t=!1,children:n,...s}){return l("div",{"data-slot":"dialog-footer",className:r("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",o),...s,children:[n,t&&a(i.Close,{render:a(e,{variant:"outline"}),children:"Close"})]})}function m({className:o,...t}){return a(i.Title,{"data-slot":"dialog-title",className:r("font-heading leading-none font-medium",o),...t})}function w({className:o,...t}){return a(i.Description,{"data-slot":"dialog-description",className:r("text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3",o),...t})}export{d,Ni,$r,rr,qr,u,b,X,m,w};
1
+ import{e}from"./chunk-6kn920c5.js";import{Dialog as i}from"@base-ui/react/dialog";import{cn as r}from"cn";import{XIcon as g}from"lucide-react";import{jsx as a,jsxs as l}from"react/jsx-runtime";function d({...o}){return a(i.Root,{"data-slot":"dialog",...o})}function Mi({...o}){return a(i.Trigger,{"data-slot":"dialog-trigger",...o})}function qr({...o}){return a(i.Portal,{"data-slot":"dialog-portal",...o})}function ir({...o}){return a(i.Close,{"data-slot":"dialog-close",...o})}function Vr({className:o,...t}){return a(i.Backdrop,{"data-slot":"dialog-overlay",className:r("data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs",o),...t})}function u({className:o,children:t,showCloseButton:n=!0,...s}){return l(qr,{children:[a(Vr,{}),l(i.Popup,{"data-slot":"dialog-content",className:r("bg-popover text-popover-foreground ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl p-6 text-sm ring-1 duration-100 outline-none sm:max-w-md",o),...s,children:[t,n&&l(i.Close,{"data-slot":"dialog-close",render:a(e,{variant:"ghost",className:"absolute top-4 right-4",size:"icon-sm"}),children:[a(g,{}),a("span",{className:"sr-only",children:"Close"})]})]})]})}function b({className:o,...t}){return a("div",{"data-slot":"dialog-header",className:r("flex flex-col gap-2",o),...t})}function X({className:o,showCloseButton:t=!1,children:n,...s}){return l("div",{"data-slot":"dialog-footer",className:r("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",o),...s,children:[n,t&&a(i.Close,{render:a(e,{variant:"outline"}),children:"Close"})]})}function m({className:o,...t}){return a(i.Title,{"data-slot":"dialog-title",className:r("font-heading leading-none font-medium",o),...t})}function w({className:o,...t}){return a(i.Description,{"data-slot":"dialog-description",className:r("text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3",o),...t})}export{d,Mi,qr,ir,Vr,u,b,X,m,w};
@@ -1 +1 @@
1
- import{Radio as e}from"@base-ui/react/radio";import{RadioGroup as d}from"@base-ui/react/radio-group";import{cn as o}from"cn";import{jsx as i}from"react/jsx-runtime";function j({className:r,...a}){return i(d,{"data-slot":"radio-group",className:o("grid w-full gap-3",r),...a})}function I({className:r,...a}){return i(e.Root,{"data-slot":"radio-group-item",className:o("group/radio-group-item peer border-input group-has-[:focus-visible]/field-label:not-data-checked:border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary relative flex aspect-square size-4 shrink-0 rounded-full border outline-none group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3",r),...a,children:i(e.Indicator,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:i("span",{className:"bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full"})})})}export{j,I};
1
+ import{Radio as e}from"@base-ui/react/radio";import{RadioGroup as d}from"@base-ui/react/radio-group";import{cn as o}from"cn";import{jsx as i}from"react/jsx-runtime";function j({className:r,...a}){return i(d,{"data-slot":"radio-group",className:o("grid w-full gap-3",r),...a})}function P({className:r,...a}){return i(e.Root,{"data-slot":"radio-group-item",className:o("group/radio-group-item peer border-input group-has-[:focus-visible]/field-label:not-data-checked:border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary relative flex aspect-square size-4 shrink-0 rounded-full border outline-none group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3",r),...a,children:i(e.Indicator,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:i("span",{className:"bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full"})})})}export{j,P};
@@ -1 +1 @@
1
- import{cva as o}from"class-variance-authority";import{cn as n}from"cn";import{jsx as a}from"react/jsx-runtime";function ge({className:e,...t}){return a("div",{"data-slot":"empty",className:n("flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-lg border-dashed p-12 text-center text-balance",e),...t})}function fe({className:e,...t}){return a("div",{"data-slot":"empty-header",className:n("flex max-w-sm flex-col items-center gap-2",e),...t})}var i=o("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",icon:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-6"}},defaultVariants:{variant:"default"}});function gi({className:e,variant:t="default",...r}){return a("div",{"data-slot":"empty-icon","data-variant":t,className:n(i({variant:t,className:e})),...r})}function he({className:e,...t}){return a("div",{"data-slot":"empty-title",className:n("font-heading text-lg font-medium tracking-tight",e),...t})}function ve({className:e,...t}){return a("div",{"data-slot":"empty-description",className:n("text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function fi({className:e,...t}){return a("div",{"data-slot":"empty-content",className:n("flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance",e),...t})}export{ge,fe,gi,he,ve,fi};
1
+ import{cva as o}from"class-variance-authority";import{cn as n}from"cn";import{jsx as a}from"react/jsx-runtime";function ge({className:e,...t}){return a("div",{"data-slot":"empty",className:n("flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-lg border-dashed p-12 text-center text-balance",e),...t})}function fe({className:e,...t}){return a("div",{"data-slot":"empty-header",className:n("flex max-w-sm flex-col items-center gap-2",e),...t})}var i=o("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",icon:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-6"}},defaultVariants:{variant:"default"}});function fi({className:e,variant:t="default",...r}){return a("div",{"data-slot":"empty-icon","data-variant":t,className:n(i({variant:t,className:e})),...r})}function he({className:e,...t}){return a("div",{"data-slot":"empty-title",className:n("font-heading text-lg font-medium tracking-tight",e),...t})}function ve({className:e,...t}){return a("div",{"data-slot":"empty-description",className:n("text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function hi({className:e,...t}){return a("div",{"data-slot":"empty-content",className:n("flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance",e),...t})}export{ge,fe,fi,he,ve,hi};
@@ -0,0 +1,2 @@
1
+ import{Uo}from"./chunk-76w1a72z.js";import{o}from"./chunk-f3e3ged2.js";import{n,C}from"./chunk-9hvbm4be.js";import{E,x,ne}from"./chunk-3q6ssrs3.js";import{isBooleanOption as q,isGroupedSelect as A,isSelectOption as Z}from"@nyssance/codex-acp-v2/client";import{Zap as D}from"lucide-react";import{useRef as F}from"react";import{jsx as w}from"react/jsx-runtime";function gt({sessionId:l,options:u,disabled:B,onModelChange:h,onConfigChange:b,defaultGroup:G={id:"models",name:"Models"},catalog:I=(c)=>c,headerAction:L}){let{host:c,client:N}=n(),{t:i}=c,P=o((e)=>Boolean(e.configPending[l])),p=F({sessionId:l,model:!0}),O=P&&(p.current.sessionId!==l||p.current.model),k=o((e)=>{let r=e.sessions[l];return r?.state==="running"||r?.state==="requires_action"}),t=x(u,"model"),a=x(u,"thought_level"),_=u.filter((e)=>e.configId!=="collaboration_mode"&&(e.category==="model_config"||e.category!=="mode"&&e!==t&&e!==a)),v=_.filter(Z),f=_.filter(q);if(!t&&!a&&v.length===0&&f.length===0)return null;let m=(e,r)=>{if(r===e.currentValue)return Promise.resolve();p.current={sessionId:l,model:e===t};let d=b?b(e.configId,r):N.setConfig(l,e.configId,r);return C(c,d),d},g=a?E(a):[],z=g.reduce((e,r)=>r.name.length>=e.length?r.name:e,""),R=t?ne(t):i("composer.model"),S=(e)=>({api_id:e.value,label:e.name}),V=I(t&&A(t.options)?t.options.map((e)=>({id:e.groupId,name:e.name,models:e.options.map(S)})):[{...G,models:t?E(t).map(S):[]}]),y=V.flatMap((e)=>e.models),M=y.find((e)=>e.api_id===t?.currentValue)??{api_id:t?.currentValue??"",label:R},s=f.find((e)=>e.configId==="fast_mode"||e.configId==="fast-mode");return w(Uo,{disabled:B||O||k,switching:O,value:{...M,label:M.shortLabel??M.label},compactCatalog:!0,models:y,showModelList:Boolean(t),onChange:(e)=>{if(e.api_id===t?.currentValue)return;if(h)h(e.api_id);else if(t)m(t,e.api_id)},header:{name:t?.name??i("composer.model"),action:L},modelGroups:V,t:i,effortConfig:a&&g.length>0?{name:"Effort",value:a.currentValue,levels:g,sizer:z,onChange:(e)=>m(a,e)}:void 0,selectOptions:v.map((e)=>({id:e.configId,name:e.name,value:e.currentValue,options:E(e).map((r)=>({value:r.value,label:r.name})),onChange:(r)=>m(e,r)})),booleanOptions:[{id:"fast_mode",name:i("composer.fastMode"),currentValue:s?.currentValue??!1,disabled:!s,title:!s?i("composer.fastModeUnsupported"):void 0,icon:w(D,{className:"size-4","aria-hidden":"true"})},...f.filter((e)=>e!==s).map((e)=>({id:e.configId,name:e.name,currentValue:e.currentValue}))],onBooleanChange:(e,r)=>{let d=e==="fast_mode"?s:f.find((U)=>U.configId===e);if(!d)throw Error(`Unknown boolean config: ${e}`);m(d,r)}})}
2
+ export{gt};
@@ -1,2 +1,2 @@
1
- import{e}from"./chunk-6kn920c5.js";import{d,u,b,X,m,w}from"./chunk-17zegmxa.js";import{J}from"./chunk-m8djwdd5.js";import{createContext as g,useContext as C,useState as y,useSyncExternalStore as L}from"react";import{jsx as i,jsxs as S}from"react/jsx-runtime";var v=g(null),f=g(null),x=g(null);function pr({host:t,client:o,children:n}){let[l,a]=y(null);J(l!==null);let{t:c}=t;return i(v,{value:t,children:i(f,{value:o,children:S(x,{value:a,children:[n,i(d,{open:l!==null,onOpenChange:(D)=>!D&&a(null),children:S(u,{children:[S(b,{children:[i(m,{children:c("sessionList.deleteTitle")}),i(w,{children:c("sessionList.deleteDescription")})]}),S(X,{children:[i(e,{variant:"outline",onClick:()=>a(null),children:c("sessionList.cancel")}),i(e,{onClick:()=>{if(l)T(t,o.delete(l.sessionId));a(null)},children:c("sessionList.delete")})]})]})})]})})})}function p(){let t=C(v);if(t===null)throw Error("Session list host is missing");return t}function s(){let t=C(f);if(t===null)throw Error("Session list client is missing");return t}function tt(){let t=C(x);if(t===null)throw Error("Session list provider is missing");return t}function r(t){let o=s();return L((n)=>o.store.subscribe(n),()=>t(o.store.getState()),()=>t(o.store.getState()))}function T(t,o){return o.then(()=>{},(n)=>{if(t.reportError)t.reportError(n);else console.error(n)})}
2
- export{pr,p,s,tt,r,T};
1
+ import{e}from"./chunk-6kn920c5.js";import{d,u,b,X,m,w}from"./chunk-a2hygrpr.js";import{J}from"./chunk-ht28382s.js";import{createContext as g,useContext as C,useState as y,useSyncExternalStore as L}from"react";import{jsx as i,jsxs as S}from"react/jsx-runtime";var v=g(null),f=g(null),x=g(null);function gr({host:t,client:o,children:n}){let[l,a]=y(null);J(l!==null);let{t:c}=t;return i(v,{value:t,children:i(f,{value:o,children:S(x,{value:a,children:[n,i(d,{open:l!==null,onOpenChange:(D)=>!D&&a(null),children:S(u,{children:[S(b,{children:[i(m,{children:c("sessionList.deleteTitle")}),i(w,{children:c("sessionList.deleteDescription")})]}),S(X,{children:[i(e,{variant:"outline",onClick:()=>a(null),children:c("sessionList.cancel")}),i(e,{onClick:()=>{if(l)T(t,o.delete(l.sessionId));a(null)},children:c("sessionList.delete")})]})]})})]})})})}function p(){let t=C(v);if(t===null)throw Error("Session list host is missing");return t}function s(){let t=C(f);if(t===null)throw Error("Session list client is missing");return t}function tt(){let t=C(x);if(t===null)throw Error("Session list provider is missing");return t}function r(t){let o=s();return L((n)=>o.store.subscribe(n),()=>t(o.store.getState()),()=>t(o.store.getState()))}function T(t,o){return o.then(()=>{},(n)=>{if(t.reportError)t.reportError(n);else console.error(n)})}
2
+ export{gr,p,s,tt,r,T};
@@ -1,2 +1,2 @@
1
- import{Dn}from"./chunk-7dzq2t68.js";import{e}from"./chunk-6kn920c5.js";import{re,t,ie,o,Ve}from"./chunk-dp8pjv6r.js";import{ho,Ee,Vt,yo,bo}from"./chunk-m6rrt94g.js";import{Re}from"./chunk-c0ac9k7h.js";import{ro}from"./chunk-4b3s7gyc.js";import{no}from"./chunk-rnzphmk6.js";import{Gn,Wn}from"./chunk-a3krtv66.js";import{zn,Un}from"./chunk-6d7ppje3.js";import{Bn}from"./chunk-hxhptw6e.js";import{oo}from"./chunk-0yvbqccv.js";import{$n}from"./chunk-ha5jfz6r.js";import{codexExtensionCapabilities as ze,codexMessageError as Be,codexRetryNotice as qe,codexTurnError as Oe,nativeTurnId as ge}from"@nyssance/codex-acp-v2/client";import{ArrowDownIcon as Fe}from"lucide-react";import{useCallback as V,useEffect as A,useLayoutEffect as ve,useMemo as Q,useRef as b,useState as _}from"react";import{flushSync as Te}from"react-dom";import{jsx as l,jsxs as L}from"react/jsx-runtime";var ye=24;function Ke(n){let m=Math.max(0,n.turnTopPx-ye),v=Math.max(0,n.scrollHeightPx-n.viewportHeightPx),c=m-v;return{scrollTopPx:m,spacerPx:c>0?n.spacerPx+c:n.spacerPx}}function Ue({viewportRef:n,viewportProps:m,children:v}){return l("div",{ref:n,...m,className:"min-h-0 min-w-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain outline-none",children:v})}function _e({sessionId:n,turnId:m,root:v,error:c,connected:S}){let C=b(null),w=ie(),{t:N}=t(),R=V(()=>{w.loadHistoryTurn(n,m).catch(()=>{})},[w,n,m]);return A(()=>{if(!v||!C.current||!S||c)return;let B=new IntersectionObserver((T)=>{if(T.some((P)=>P.isIntersecting))B.disconnect(),R()},{root:v,rootMargin:"800px 0px"});return B.observe(C.current),()=>B.disconnect()},[v,S,c,R]),l("div",{ref:C,className:"flex min-h-80 flex-col justify-center gap-3 py-8","data-history-turn":m,"data-markdown-pending":!0,children:c?L("div",{className:"flex flex-col items-center gap-2",children:[l("p",{role:"alert",className:"text-destructive text-xs",children:c}),l(e,{variant:"outline",size:"sm",onClick:R,disabled:!S,children:N("timeline.navigationRetry")})]}):L("div",{role:"status","aria-label":N("timeline.navigationLoading"),className:"space-y-3",children:[l("div",{className:"bg-muted ml-auto h-5 w-1/3 rounded"}),l("div",{className:"bg-muted h-3 w-4/5 rounded"}),l("div",{className:"bg-muted h-3 w-3/5 rounded"})]})})}function $e(n,m){let v=b([]),c=b(null);if(c.current?.items!==n.items||c.current.state!==n.state||c.current.ended!==n.turnEndedAt||c.current.usage!==n.turnUsage||c.current.historyOrder!==m)c.current={state:n.state,items:n.items,ended:n.turnEndedAt,usage:n.turnUsage,historyOrder:m,turns:ho(n,v.current,m)};let S=c.current.turns;return v.current=S,S}function Ln(n){return l(re,{host:n.host,client:n.client,children:l(De,{...n})})}function De({session:n,leading:m,afterTurn:v,answerActions:c,turnFooter:S,renderUserMessage:C,insert:w,navigation:N,anchorNewTurn:R=!1,Viewport:B=Ue}){let T=ie(),P=t(),y=o((r)=>r.historyNavigation[n.id]),d=$e(n,y?.turns),M=d.at(-1)?.key,xe=yo(n,d),x=n.state!=="idle",D=Q(()=>no(d,y),[d,y]),Y=Q(()=>D.flatMap((r)=>r.turn===void 0?[]:[{...r.turn,key:r.turnKey}]),[D]),he=Q(()=>N===void 0?[]:Gn(d,n.turnUsage,y),[N,d,n.turnUsage,y]),Z=w&&w.afterItemId!==null?d.findIndex((r)=>r.items.some((u)=>u.id===w.afterItemId)):-1,j=b(d);j.current=d;let[a,be]=_(null),h=o((r)=>r.historyPages[n.id]),I=o((r)=>r.connection==="ready"),we=o((r)=>ze(r.agent).sessionRetry),ee=h!==void 0;A(()=>{if(I&&ee&&!n.restoring)T.loadHistoryNavigation(n.id).catch(()=>{})},[T,I,ee,n.id,n.restoring]);let[Se,Pe]=_(!1),F=b(null),[Ie,te]=_(!1),ne=b(0),W=b({key:M,running:x});W.current={key:M,running:x};let[oe,K]=_(0),k=b(0),E=b(null);k.current=oe;let He=V(()=>{if(E.current!==null)E.current.keepTop=!1},[]),{isFollowing:z,scrollToBottom:X,stopFollowing:q,schedulePin:le,contentResized:ae,beginLocate:ue,cancelLocation:se}=oo(a,x,He),ce=V(()=>{if(a===null||!x)return;let r=d.at(-1)?.key;if(r===void 0)return;let u=ue(!0),s=()=>u.isCurrent()&&W.current.running&&W.current.key===r,i=()=>requestAnimationFrame(()=>requestAnimationFrame(()=>{if(!s())return;let g=a.querySelector(`[data-codex-turn="${CSS.escape(r)}"]`);if(g===null)return;let f=a.scrollTop+g.getBoundingClientRect().top-a.getBoundingClientRect().top,H=Ke({turnTopPx:f,scrollHeightPx:a.scrollHeight,viewportHeightPx:a.clientHeight,spacerPx:k.current});E.current=H.spacerPx>0?{element:g,heightPx:g.getBoundingClientRect().height+H.spacerPx,keepTop:!0}:null,Te(()=>K(H.spacerPx)),requestAnimationFrame(()=>{if(s())u.finish(H.scrollTopPx)})})),p=F.current;if(p===null)return;p.scrollToKey(r,void 0,{align:"top"}).then(()=>{if(s())i()})},[ue,x,a,d]);ve(()=>{if(!R||x)return;se(),E.current=null,k.current=0,K(0)},[R,se,x]);let G=V(()=>{q(),T.loadOlderHistory(n.id).catch(()=>{})},[T,n.id,q]);A(()=>{if(a===null)return;let r=()=>{let u=a.scrollTop<600;if(Pe(u),u&&!y?.complete&&I&&!n.restoring&&!z&&h?.cursor&&!h.loading&&!h.error)G()};return r(),a.addEventListener("scroll",r,{passive:!0}),()=>a.removeEventListener("scroll",r)},[I,h,z,G,a,n.restoring,y?.complete]),A(()=>{zn({sessionId:n.id,turns:Y,api:F.current,beforeReveal:q,terminals:n.terminals})},[n.id,n.terminals,Y,q]),A(()=>()=>Un(n.id),[n.id]);let Ne=V(async(r,u)=>{let s=++ne.current;te(!0);try{if(r.isLoaded===!1&&r.nativeTurnId!==void 0)await T.loadHistoryTurn(n.id,r.nativeTurnId),await new Promise((f)=>requestAnimationFrame(()=>f()));if(!u())return null;let i=j.current.find((f)=>f.user?.id===(r.messageId??r.id))??j.current.find((f)=>f.user!==null&&r.nativeTurnId!==void 0&&f.items.some((H)=>ge(H)===r.nativeTurnId));if(!i?.user)return null;let p=i.user.id,g=F.current;if(g===null)throw Error("Virtual timeline is not mounted");return await g.scrollToKey(i.key,(f)=>f.querySelector(`[data-content-search-unit-key="${CSS.escape(p)}"]`),{align:"top"}),document.querySelector(`[data-chat-scroll] [data-content-search-unit-key="${CSS.escape(p)}"]`)}finally{if(ne.current===s)te(!1)}},[T,n.id]),ke=V(async(r)=>{if(r.nativeTurnId!==void 0)await T.previewHistoryTurn(n.id,r.nativeTurnId)},[T,n.id]);A(()=>{if(a===null)return;let r=a.querySelector("[data-codex-timeline]");if(r===null)throw Error("Timeline content element is missing");let u=new ResizeObserver(()=>{let s=E.current,i=null;if(s!==null){let p=Math.max(0,s.heightPx-s.element.getBoundingClientRect().height);if(p!==k.current&&(p<k.current||s.keepTop)){if(k.current=p,Te(()=>K(p)),p===0)E.current=null}if(p>0&&s.keepTop)i=a.scrollTop+s.element.getBoundingClientRect().top-a.getBoundingClientRect().top-ye}ae(i)});if(u.observe(r),u.observe(a),M!==void 0){let s=a.querySelector(`[data-codex-turn="${CSS.escape(M)}"]`);if(s===null)throw Error("Latest turn is not mounted");u.observe(s)}return()=>u.disconnect()},[ae,M,a]),A(()=>{if(n.items.length===0)return;le()},[le,n.items]);let de=b(null);ve(()=>{if(a===null)return;let r=d.at(-1),u=de.current;if(de.current=r===void 0?null:{key:r.key,running:x},r===void 0||u===null||r.user===null||r.replayed)return;if(R){if(x&&n.turnEndedAt[r.user.id]===void 0&&(r.key!==u.key||!u.running))E.current=null,k.current=0,K(0),ce()}else if(r.key!==u.key)X()},[ce,R,x,X,a,n.turnEndedAt,d]);let Ae=(r,u)=>{let s=r,i=s.turn;if(i===void 0){if(s.nativeTurnId===void 0)throw Error(`Turn is missing at index ${u}`);return l(_e,{sessionId:n.id,turnId:s.nativeTurnId,root:a,error:y?.turnErrors[s.nativeTurnId],connected:I&&!z&&!Ie})}let p=d.indexOf(i),g=i.key===xe,f=bo(n,d,p),H=!g&&f.continued,U=i.key===M,O=i.errors.at(-1),me=O===void 0?null:Be(O),J=O===void 0?null:ge(O),Le=U&&!g&&I&&we&&n.attached&&!n.readOnly&&!n.restoring&&O===n.items.at(-1)&&me!==null&&Oe(me).category==="overloaded"&&J!==null&&n.lastStopReason!=="end_turn"&&n.lastStopReason!=="cancelled",fe=S?.(i)??null,Ce=i.work.length>0||i.final.length>0||i.errors.length>0||g||fe!==null||Ee(i)||Vt(i)||U&&(n.error!==null||n.lastStopReason==="cancelled"),pe=i.user===null?null:Re(i);return L("div",{"data-virtualized-turn-content":!0,"data-codex-turn":i.key,className:"flex flex-col gap-1.5",children:[i.user!==null&&(C===void 0?l($n,{item:i.user,messageTime:pe}):C(i.user,pe)),Ce&&l(ro,{sessionId:n.id,turn:i,terminals:n.terminals,active:g,blocked:n.state==="requires_action",continued:H,edits:f.edits,activityItems:f.items,workStartedAt:f.startedAt,isLast:U,error:n.error,retrying:g?qe(n._meta)??void 0:void 0,retry:Le?{turnId:J,delaySeconds:Bn(d),run:(Me)=>T.retrySession(n.id,J,Me)}:void 0,interrupted:Vt(i)||!g&&U&&n.lastStopReason==="cancelled",answerActions:c?.(i),footer:fe}),u===Z&&w?.node,v?.(i)]})};return L("div",{className:"relative flex min-h-0 flex-1 flex-col","data-stream-style":"codexUI",children:[l(B,{viewportRef:be,viewportProps:{"data-chat-scroll":"",style:{overflowAnchor:"none"},tabIndex:0,role:"log","aria-label":P.t("timeline.label")},children:l("div",{className:"codex-timeline-content flex min-h-full w-full flex-col",children:L("div",{"data-timeline-user-message-navigation-content":!0,className:"mx-auto flex w-full max-w-3xl shrink-0 flex-col",children:[w&&Z===-1&&w.node,l(Dn,{ref:F,entries:D,renderTurn:Ae,scrollElement:a,sessionKey:n.id,preserveViewport:!z,leadingInsetPx:12,leadingContent:m===void 0?void 0:l("div",{className:"pt-3",children:m})}),R&&l("div",{"aria-hidden":"true","data-turn-anchor-spacer":!0,className:"shrink-0",style:{height:oe}}),l("div",{"aria-hidden":"true",className:"h-6 shrink-0"})]})})}),l("div",{"aria-hidden":"true",className:"codex-timeline-bottom-fade"}),y?.error&&l("div",{className:"absolute inset-x-0 top-2 z-10 flex justify-center",children:l(e,{variant:"outline",size:"sm",disabled:!I,title:y.error,onClick:()=>{T.loadHistoryNavigation(n.id).catch(()=>{})},children:P.t("timeline.navigationRetry")})}),Se&&h?.cursor&&!y?.complete&&L("div",{className:"absolute inset-x-0 top-2 z-10 flex flex-col items-center gap-1","data-history-loader":!0,children:[l(e,{variant:"outline",size:"sm",disabled:!I||n.restoring||h.loading,onClick:G,children:h.loading?P.t("timeline.loadingEarlier"):P.t("timeline.loadEarlier")}),h.error&&l("p",{role:"alert",className:"bg-background text-destructive max-w-md rounded px-2 py-1 text-xs",children:h.error})]}),N!==void 0&&l(Wn,{items:he,audio:N.audio,scrollRoot:a,beforeReveal:q,ensureItemMounted:Ne,onPreviewItem:ke,onRevealError:(r)=>Ve(P,r),targetTopMarginPx:16},n.id),l("button",{type:"button",className:z?"codex-scroll-to-bottom codex-scroll-to-bottom-hidden":"codex-scroll-to-bottom",tabIndex:z?-1:void 0,onClick:X,"aria-label":P.t("timeline.scrollToBottom"),children:x?L("span",{className:"codex-scroll-to-bottom-dots","aria-hidden":"true",children:[l("span",{className:"codex-wave-dot"}),l("span",{className:"codex-wave-dot"}),l("span",{className:"codex-wave-dot"})]}):l(Fe,{})})]})}
2
- export{Ln};
1
+ import{Hn}from"./chunk-s2k5xynq.js";import{e}from"./chunk-6kn920c5.js";import{re,t,ie,o,Ve}from"./chunk-f3e3ged2.js";import{vo,Ee,Wt,bo,wo}from"./chunk-753s76b6.js";import{Re}from"./chunk-c0ac9k7h.js";import{ao}from"./chunk-nad1erxy.js";import{ro}from"./chunk-tm4ee7m3.js";import{jn,Kn}from"./chunk-qg1b5k6m.js";import{$n,qn}from"./chunk-m6h92nq4.js";import{Un}from"./chunk-tjpr0adf.js";import{io}from"./chunk-kw487283.js";import{Vn}from"./chunk-1dh0q11h.js";import{codexExtensionCapabilities as ze,codexMessageError as Be,codexRetryNotice as qe,codexTurnError as Oe,nativeTurnId as ge}from"@nyssance/codex-acp-v2/client";import{ArrowDownIcon as Fe}from"lucide-react";import{useCallback as V,useEffect as A,useLayoutEffect as ve,useMemo as Q,useRef as b,useState as _}from"react";import{flushSync as Te}from"react-dom";import{jsx as l,jsxs as L}from"react/jsx-runtime";var ye=24;function Ke(n){let m=Math.max(0,n.turnTopPx-ye),v=Math.max(0,n.scrollHeightPx-n.viewportHeightPx),c=m-v;return{scrollTopPx:m,spacerPx:c>0?n.spacerPx+c:n.spacerPx}}function Ue({viewportRef:n,viewportProps:m,children:v}){return l("div",{ref:n,...m,className:"min-h-0 min-w-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain outline-none",children:v})}function _e({sessionId:n,turnId:m,root:v,error:c,connected:S}){let C=b(null),w=ie(),{t:N}=t(),R=V(()=>{w.loadHistoryTurn(n,m).catch(()=>{})},[w,n,m]);return A(()=>{if(!v||!C.current||!S||c)return;let B=new IntersectionObserver((T)=>{if(T.some((P)=>P.isIntersecting))B.disconnect(),R()},{root:v,rootMargin:"800px 0px"});return B.observe(C.current),()=>B.disconnect()},[v,S,c,R]),l("div",{ref:C,className:"flex min-h-80 flex-col justify-center gap-3 py-8","data-history-turn":m,"data-markdown-pending":!0,children:c?L("div",{className:"flex flex-col items-center gap-2",children:[l("p",{role:"alert",className:"text-destructive text-xs",children:c}),l(e,{variant:"outline",size:"sm",onClick:R,disabled:!S,children:N("timeline.navigationRetry")})]}):L("div",{role:"status","aria-label":N("timeline.navigationLoading"),className:"space-y-3",children:[l("div",{className:"bg-muted ml-auto h-5 w-1/3 rounded"}),l("div",{className:"bg-muted h-3 w-4/5 rounded"}),l("div",{className:"bg-muted h-3 w-3/5 rounded"})]})})}function $e(n,m){let v=b([]),c=b(null);if(c.current?.items!==n.items||c.current.state!==n.state||c.current.ended!==n.turnEndedAt||c.current.usage!==n.turnUsage||c.current.historyOrder!==m)c.current={state:n.state,items:n.items,ended:n.turnEndedAt,usage:n.turnUsage,historyOrder:m,turns:vo(n,v.current,m)};let S=c.current.turns;return v.current=S,S}function _n(n){return l(re,{host:n.host,client:n.client,children:l(De,{...n})})}function De({session:n,leading:m,afterTurn:v,answerActions:c,turnFooter:S,renderUserMessage:C,insert:w,navigation:N,anchorNewTurn:R=!1,Viewport:B=Ue}){let T=ie(),P=t(),y=o((r)=>r.historyNavigation[n.id]),d=$e(n,y?.turns),M=d.at(-1)?.key,xe=bo(n,d),x=n.state!=="idle",D=Q(()=>ro(d,y),[d,y]),Y=Q(()=>D.flatMap((r)=>r.turn===void 0?[]:[{...r.turn,key:r.turnKey}]),[D]),he=Q(()=>N===void 0?[]:jn(d,n.turnUsage,y),[N,d,n.turnUsage,y]),Z=w&&w.afterItemId!==null?d.findIndex((r)=>r.items.some((u)=>u.id===w.afterItemId)):-1,j=b(d);j.current=d;let[a,be]=_(null),h=o((r)=>r.historyPages[n.id]),I=o((r)=>r.connection==="ready"),we=o((r)=>ze(r.agent).sessionRetry),ee=h!==void 0;A(()=>{if(I&&ee&&!n.restoring)T.loadHistoryNavigation(n.id).catch(()=>{})},[T,I,ee,n.id,n.restoring]);let[Se,Pe]=_(!1),F=b(null),[Ie,te]=_(!1),ne=b(0),W=b({key:M,running:x});W.current={key:M,running:x};let[oe,K]=_(0),k=b(0),E=b(null);k.current=oe;let He=V(()=>{if(E.current!==null)E.current.keepTop=!1},[]),{isFollowing:z,scrollToBottom:X,stopFollowing:q,schedulePin:le,contentResized:ae,beginLocate:ue,cancelLocation:se}=io(a,x,He),ce=V(()=>{if(a===null||!x)return;let r=d.at(-1)?.key;if(r===void 0)return;let u=ue(!0),s=()=>u.isCurrent()&&W.current.running&&W.current.key===r,i=()=>requestAnimationFrame(()=>requestAnimationFrame(()=>{if(!s())return;let g=a.querySelector(`[data-codex-turn="${CSS.escape(r)}"]`);if(g===null)return;let f=a.scrollTop+g.getBoundingClientRect().top-a.getBoundingClientRect().top,H=Ke({turnTopPx:f,scrollHeightPx:a.scrollHeight,viewportHeightPx:a.clientHeight,spacerPx:k.current});E.current=H.spacerPx>0?{element:g,heightPx:g.getBoundingClientRect().height+H.spacerPx,keepTop:!0}:null,Te(()=>K(H.spacerPx)),requestAnimationFrame(()=>{if(s())u.finish(H.scrollTopPx)})})),p=F.current;if(p===null)return;p.scrollToKey(r,void 0,{align:"top"}).then(()=>{if(s())i()})},[ue,x,a,d]);ve(()=>{if(!R||x)return;se(),E.current=null,k.current=0,K(0)},[R,se,x]);let G=V(()=>{q(),T.loadOlderHistory(n.id).catch(()=>{})},[T,n.id,q]);A(()=>{if(a===null)return;let r=()=>{let u=a.scrollTop<600;if(Pe(u),u&&!y?.complete&&I&&!n.restoring&&!z&&h?.cursor&&!h.loading&&!h.error)G()};return r(),a.addEventListener("scroll",r,{passive:!0}),()=>a.removeEventListener("scroll",r)},[I,h,z,G,a,n.restoring,y?.complete]),A(()=>{$n({sessionId:n.id,turns:Y,api:F.current,beforeReveal:q,terminals:n.terminals})},[n.id,n.terminals,Y,q]),A(()=>()=>qn(n.id),[n.id]);let Ne=V(async(r,u)=>{let s=++ne.current;te(!0);try{if(r.isLoaded===!1&&r.nativeTurnId!==void 0)await T.loadHistoryTurn(n.id,r.nativeTurnId),await new Promise((f)=>requestAnimationFrame(()=>f()));if(!u())return null;let i=j.current.find((f)=>f.user?.id===(r.messageId??r.id))??j.current.find((f)=>f.user!==null&&r.nativeTurnId!==void 0&&f.items.some((H)=>ge(H)===r.nativeTurnId));if(!i?.user)return null;let p=i.user.id,g=F.current;if(g===null)throw Error("Virtual timeline is not mounted");return await g.scrollToKey(i.key,(f)=>f.querySelector(`[data-content-search-unit-key="${CSS.escape(p)}"]`),{align:"top"}),document.querySelector(`[data-chat-scroll] [data-content-search-unit-key="${CSS.escape(p)}"]`)}finally{if(ne.current===s)te(!1)}},[T,n.id]),ke=V(async(r)=>{if(r.nativeTurnId!==void 0)await T.previewHistoryTurn(n.id,r.nativeTurnId)},[T,n.id]);A(()=>{if(a===null)return;let r=a.querySelector("[data-codex-timeline]");if(r===null)throw Error("Timeline content element is missing");let u=new ResizeObserver(()=>{let s=E.current,i=null;if(s!==null){let p=Math.max(0,s.heightPx-s.element.getBoundingClientRect().height);if(p!==k.current&&(p<k.current||s.keepTop)){if(k.current=p,Te(()=>K(p)),p===0)E.current=null}if(p>0&&s.keepTop)i=a.scrollTop+s.element.getBoundingClientRect().top-a.getBoundingClientRect().top-ye}ae(i)});if(u.observe(r),u.observe(a),M!==void 0){let s=a.querySelector(`[data-codex-turn="${CSS.escape(M)}"]`);if(s===null)throw Error("Latest turn is not mounted");u.observe(s)}return()=>u.disconnect()},[ae,M,a]),A(()=>{if(n.items.length===0)return;le()},[le,n.items]);let de=b(null);ve(()=>{if(a===null)return;let r=d.at(-1),u=de.current;if(de.current=r===void 0?null:{key:r.key,running:x},r===void 0||u===null||r.user===null||r.replayed)return;if(R){if(x&&n.turnEndedAt[r.user.id]===void 0&&(r.key!==u.key||!u.running))E.current=null,k.current=0,K(0),ce()}else if(r.key!==u.key)X()},[ce,R,x,X,a,n.turnEndedAt,d]);let Ae=(r,u)=>{let s=r,i=s.turn;if(i===void 0){if(s.nativeTurnId===void 0)throw Error(`Turn is missing at index ${u}`);return l(_e,{sessionId:n.id,turnId:s.nativeTurnId,root:a,error:y?.turnErrors[s.nativeTurnId],connected:I&&!z&&!Ie})}let p=d.indexOf(i),g=i.key===xe,f=wo(n,d,p),H=!g&&f.continued,U=i.key===M,O=i.errors.at(-1),me=O===void 0?null:Be(O),J=O===void 0?null:ge(O),Le=U&&!g&&I&&we&&n.attached&&!n.readOnly&&!n.restoring&&O===n.items.at(-1)&&me!==null&&Oe(me).category==="overloaded"&&J!==null&&n.lastStopReason!=="end_turn"&&n.lastStopReason!=="cancelled",fe=S?.(i)??null,Ce=i.work.length>0||i.final.length>0||i.errors.length>0||g||fe!==null||Ee(i)||Wt(i)||U&&(n.error!==null||n.lastStopReason==="cancelled"),pe=i.user===null?null:Re(i);return L("div",{"data-virtualized-turn-content":!0,"data-codex-turn":i.key,className:"flex flex-col gap-1.5",children:[i.user!==null&&(C===void 0?l(Vn,{item:i.user,messageTime:pe}):C(i.user,pe)),Ce&&l(ao,{sessionId:n.id,turn:i,terminals:n.terminals,active:g,blocked:n.state==="requires_action",continued:H,edits:f.edits,activityItems:f.items,workStartedAt:f.startedAt,isLast:U,error:n.error,retrying:g?qe(n._meta)??void 0:void 0,retry:Le?{turnId:J,delaySeconds:Un(d),run:(Me)=>T.retrySession(n.id,J,Me)}:void 0,interrupted:Wt(i)||!g&&U&&n.lastStopReason==="cancelled",answerActions:c?.(i),footer:fe}),u===Z&&w?.node,v?.(i)]})};return L("div",{className:"relative flex min-h-0 flex-1 flex-col","data-stream-style":"codexUI",children:[l(B,{viewportRef:be,viewportProps:{"data-chat-scroll":"",style:{overflowAnchor:"none"},tabIndex:0,role:"log","aria-label":P.t("timeline.label")},children:l("div",{className:"codex-timeline-content flex min-h-full w-full flex-col",children:L("div",{"data-timeline-user-message-navigation-content":!0,className:"mx-auto flex w-full max-w-3xl shrink-0 flex-col",children:[w&&Z===-1&&w.node,l(Hn,{ref:F,entries:D,renderTurn:Ae,scrollElement:a,sessionKey:n.id,preserveViewport:!z,leadingInsetPx:12,leadingContent:m===void 0?void 0:l("div",{className:"pt-3",children:m})}),R&&l("div",{"aria-hidden":"true","data-turn-anchor-spacer":!0,className:"shrink-0",style:{height:oe}}),l("div",{"aria-hidden":"true",className:"h-6 shrink-0"})]})})}),l("div",{"aria-hidden":"true",className:"codex-timeline-bottom-fade"}),y?.error&&l("div",{className:"absolute inset-x-0 top-2 z-10 flex justify-center",children:l(e,{variant:"outline",size:"sm",disabled:!I,title:y.error,onClick:()=>{T.loadHistoryNavigation(n.id).catch(()=>{})},children:P.t("timeline.navigationRetry")})}),Se&&h?.cursor&&!y?.complete&&L("div",{className:"absolute inset-x-0 top-2 z-10 flex flex-col items-center gap-1","data-history-loader":!0,children:[l(e,{variant:"outline",size:"sm",disabled:!I||n.restoring||h.loading,onClick:G,children:h.loading?P.t("timeline.loadingEarlier"):P.t("timeline.loadEarlier")}),h.error&&l("p",{role:"alert",className:"bg-background text-destructive max-w-md rounded px-2 py-1 text-xs",children:h.error})]}),N!==void 0&&l(Kn,{items:he,audio:N.audio,scrollRoot:a,beforeReveal:q,ensureItemMounted:Ne,onPreviewItem:ke,onRevealError:(r)=>Ve(P,r),targetTopMarginPx:16},n.id),l("button",{type:"button",className:z?"codex-scroll-to-bottom codex-scroll-to-bottom-hidden":"codex-scroll-to-bottom",tabIndex:z?-1:void 0,onClick:X,"aria-label":P.t("timeline.scrollToBottom"),children:x?L("span",{className:"codex-scroll-to-bottom-dots","aria-hidden":"true",children:[l("span",{className:"codex-wave-dot"}),l("span",{className:"codex-wave-dot"}),l("span",{className:"codex-wave-dot"})]}):l(Fe,{})})]})}
2
+ export{_n};
@@ -1,2 +1,2 @@
1
- import{useCallback as S,useLayoutEffect as C,useRef as I,useState as h}from"react";import{jsx as b}from"react/jsx-runtime";var y=30,i=32,g=6;function St({sessionRows:t,viewport:r,renderRow:u}){let o=I(null),[c,m]=h({start:0,end:g}),[d,R]=h(()=>new Set),[E,M]=h(null),v=S((e,n)=>{R((a)=>{if(a.has(e)===n)return a;let l=new Set(a);if(n)l.add(e);else l.delete(e);return l})},[]),f=S(()=>{if(o.current===null||r===null)return;let e=r.getBoundingClientRect().top+r.clientTop-o.current.getBoundingClientRect().top,n=Math.max(0,Math.min(t.length,Math.floor(e/i)-g)),a=Math.max(n,Math.min(t.length,Math.ceil((e+r.clientHeight)/i)+g));m((l)=>l.start===n&&l.end===a?l:{start:n,end:a})},[t.length,r]);C(()=>f()),C(()=>{if(r===null)return;let e,n=()=>{if(e!==void 0)return;e=requestAnimationFrame(()=>{e=void 0,f()})},a=new ResizeObserver(n);if(a.observe(r),r.firstElementChild)a.observe(r.firstElementChild);return r.addEventListener("scroll",n,{passive:!0}),()=>{if(a.disconnect(),r.removeEventListener("scroll",n),e!==void 0)cancelAnimationFrame(e)}},[f,r]);let s=new Set;for(let e=c.start;e<Math.min(c.end,t.length);e++)s.add(e);if(t.length>0)s.add(0),s.add(t.length-1);if(t.forEach((e,n)=>{if(d.has(e.sessionId))s.add(n);if(E===e.sessionId)for(let a=Math.max(0,n-1);a<=Math.min(t.length-1,n+1);a++)s.add(a)}),t.length===0)return null;return b("div",{ref:o,"data-slot":"virtual-session-rows","data-count":t.length,className:"relative w-full",style:{height:t.length*i-(i-y)},children:[...s].toSorted((e,n)=>e-n).map((e)=>{let n=t[e];return b(T,{sessionRow:n,index:e,retainCard:v,onFocus:M,renderRow:u},n.sessionId)})})}function T({sessionRow:t,index:r,retainCard:u,onFocus:o,renderRow:c}){let m=S((d)=>u(t.sessionId,d),[u,t.sessionId]);return b("div",{"data-slot":"virtual-session-row",className:"absolute inset-x-0",style:{top:r*i,height:y},onFocusCapture:()=>o(t.sessionId),onBlurCapture:(d)=>{if(!d.currentTarget.contains(d.relatedTarget))o(null)},children:c(t,m)})}
2
- export{St};
1
+ import{useCallback as S,useLayoutEffect as C,useRef as I,useState as h}from"react";import{jsx as b}from"react/jsx-runtime";var y=30,i=32,g=6;function It({sessionRows:t,viewport:r,renderRow:u}){let o=I(null),[c,m]=h({start:0,end:g}),[d,R]=h(()=>new Set),[E,M]=h(null),v=S((e,n)=>{R((a)=>{if(a.has(e)===n)return a;let l=new Set(a);if(n)l.add(e);else l.delete(e);return l})},[]),f=S(()=>{if(o.current===null||r===null)return;let e=r.getBoundingClientRect().top+r.clientTop-o.current.getBoundingClientRect().top,n=Math.max(0,Math.min(t.length,Math.floor(e/i)-g)),a=Math.max(n,Math.min(t.length,Math.ceil((e+r.clientHeight)/i)+g));m((l)=>l.start===n&&l.end===a?l:{start:n,end:a})},[t.length,r]);C(()=>f()),C(()=>{if(r===null)return;let e,n=()=>{if(e!==void 0)return;e=requestAnimationFrame(()=>{e=void 0,f()})},a=new ResizeObserver(n);if(a.observe(r),r.firstElementChild)a.observe(r.firstElementChild);return r.addEventListener("scroll",n,{passive:!0}),()=>{if(a.disconnect(),r.removeEventListener("scroll",n),e!==void 0)cancelAnimationFrame(e)}},[f,r]);let s=new Set;for(let e=c.start;e<Math.min(c.end,t.length);e++)s.add(e);if(t.length>0)s.add(0),s.add(t.length-1);if(t.forEach((e,n)=>{if(d.has(e.sessionId))s.add(n);if(E===e.sessionId)for(let a=Math.max(0,n-1);a<=Math.min(t.length-1,n+1);a++)s.add(a)}),t.length===0)return null;return b("div",{ref:o,"data-slot":"virtual-session-rows","data-count":t.length,className:"relative w-full",style:{height:t.length*i-(i-y)},children:[...s].toSorted((e,n)=>e-n).map((e)=>{let n=t[e];return b(T,{sessionRow:n,index:e,retainCard:v,onFocus:M,renderRow:u},n.sessionId)})})}function T({sessionRow:t,index:r,retainCard:u,onFocus:o,renderRow:c}){let m=S((d)=>u(t.sessionId,d),[u,t.sessionId]);return b("div",{"data-slot":"virtual-session-row",className:"absolute inset-x-0",style:{top:r*i,height:y},onFocusCapture:()=>o(t.sessionId),onBlurCapture:(d)=>{if(!d.currentTarget.contains(d.relatedTarget))o(null)},children:c(t,m)})}
2
+ export{It};
@@ -1,2 +1,2 @@
1
- import{PreviewCard as e}from"@base-ui/react/preview-card";import{jsx as o,jsxs as d}from"react/jsx-runtime";function Qn({open:r,onOpenChange:a,trigger:i,children:t,...n}){return d(e.Root,{open:r,onOpenChange:a,children:[o(e.Trigger,{render:i,delay:700,closeDelay:100}),o(e.Portal,{children:o(e.Positioner,{...n,className:"isolate z-50",children:o(e.Popup,{"data-slot":"codex-hover-card",className:"m-0 outline-hidden",children:t})})})]})}
2
- export{Qn};
1
+ import{PreviewCard as e}from"@base-ui/react/preview-card";import{jsx as o,jsxs as d}from"react/jsx-runtime";function Yn({open:r,onOpenChange:a,trigger:i,children:t,...n}){return d(e.Root,{open:r,onOpenChange:a,children:[o(e.Trigger,{render:i,delay:700,closeDelay:100}),o(e.Portal,{children:o(e.Positioner,{...n,className:"isolate z-50",children:o(e.Popup,{"data-slot":"codex-hover-card",className:"m-0 outline-hidden",children:t})})})]})}
2
+ export{Yn};
@@ -1,2 +1,2 @@
1
- import{co}from"./chunk-w43dvzqk.js";function lo(t,o){if(co(o))return y(t);return t.map((e)=>({kind:"block",block:e}))}function i(t){return t.type==="thinking"||t.type==="tool_use"||t.type==="subagent"||t.type==="collab"}function c(t){return t.type==="tool_use"&&t.kind!=="think"}function y(t){let o=[],e=[],r=()=>{if(e.length===0)return;o.push({kind:"codexActivityGroup",blocks:e}),e=[]};for(let n of t){if(i(n)&&c(n)){e.push(n);continue}if(r(),i(n)){o.push({kind:"codexActivityGroup",blocks:[n]});continue}o.push({kind:"block",block:n})}return r(),o}
2
- export{lo};
1
+ import{uo}from"./chunk-sn80gr8g.js";function co(t,o){if(uo(o))return y(t);return t.map((e)=>({kind:"block",block:e}))}function i(t){return t.type==="thinking"||t.type==="tool_use"||t.type==="subagent"||t.type==="collab"}function c(t){return t.type==="tool_use"&&t.kind!=="think"}function y(t){let o=[],e=[],r=()=>{if(e.length===0)return;o.push({kind:"codexActivityGroup",blocks:e}),e=[]};for(let n of t){if(i(n)&&c(n)){e.push(n);continue}if(r(),i(n)){o.push({kind:"codexActivityGroup",blocks:[n]});continue}o.push({kind:"block",block:n})}return r(),o}
2
+ export{co};
@@ -1,2 +1,2 @@
1
- import{e}from"./chunk-6kn920c5.js";import{ue}from"./chunk-1drkvxzk.js";import{d,u,b,X,m,w}from"./chunk-17zegmxa.js";import{f}from"./chunk-ek06eyp4.js";import{At,Lt,Mn,Rn,En,at}from"./chunk-7k0wvvy0.js";import{l}from"./chunk-1hy64ewz.js";import{j,I}from"./chunk-5m4605a3.js";import{$e}from"./chunk-ak0k5vg6.js";import{k}from"./chunk-ncekagm6.js";import{isArrayProperty as S,isBooleanProperty as A,isNumberProperty as C,isStringProperty as E}from"@nyssance/codex-acp-v2/client";import{useEffect as N,useMemo as V,useState as R}from"react";import{jsx as o,jsxs as p}from"react/jsx-runtime";function q(r){if(!E(r))return null;if(r.oneOf&&r.oneOf.length>0)return r.oneOf.map((t)=>({value:t.const,label:t.title??t.const,...t.description?{description:t.description}:{}}));if(r.enum&&r.enum.length>0)return r.enum.map((t)=>({value:t,label:t}));return null}function P(r){let t=r,n=t._meta?.alwith?.options;if(Array.isArray(n)&&Array.isArray(t.enum))return n.map((i)=>({value:i.const,label:i.title,...i.description?{description:i.description}:{}}));if(Array.isArray(t.enum))return t.enum.map((i)=>({value:String(i),label:String(i)}));if(Array.isArray(t.oneOf))return t.oneOf.map((i)=>({value:i.const,label:i.title,...i.description?{description:i.description}:{}}));return null}function Pr(r){let t=new Set(r.required??[]);return Object.entries(r.properties??{}).map(([n,i])=>({key:n,property:i,title:i.title??n,description:i.description??null,required:t.has(n),options:q(i),multiOptions:S(i)?P(i.items):null}))}function fr(r){let t={};for(let n of r){let i=n.property.default;if(i!==void 0&&i!==null)t[n.key]=i;else if(n.options)t[n.key]=n.options[0].value;else if(A(n.property))t[n.key]=!1;else if(S(n.property))t[n.key]=[]}return t}function Nr(r,t){if(r.multiOptions)return Array.isArray(t)&&t.length>0;if(!r.required)return!0;return t!==void 0&&t!==""&&!(Array.isArray(t)&&t.length===0)}function D({id:r,label:t,description:n,control:i}){return p("div",{className:"hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",children:[i,p(f,{htmlFor:r,className:"min-w-0 flex-1 cursor-pointer font-normal",children:[o("div",{className:"text-foreground text-sm",children:t}),n&&o("div",{className:"text-muted-foreground text-xs",children:n})]})]})}function L({id:r,field:t,value:n,onChange:i}){if(t.multiOptions){let a=new Set(Array.isArray(n)?n:[]);return p(At,{children:[o(Lt,{variant:"label",children:t.title}),t.description&&o(at,{children:t.description}),o("div",{className:"flex flex-col gap-1",children:t.multiOptions.map((c)=>{let g=`${r}:${c.value}`;return o(D,{id:g,...c,control:o(ue,{id:g,checked:a.has(c.value),onCheckedChange:(F)=>{let y=new Set(a);if(F)y.add(c.value);else y.delete(c.value);i([...y])}})},c.value)})})]})}if(t.options)return p(At,{children:[o(Lt,{variant:"label",children:t.title}),t.description&&o(at,{children:t.description}),o(j,{value:typeof n==="string"?n:"",onValueChange:(a)=>i(String(a)),className:"flex flex-col gap-1",children:t.options.map((a)=>{let c=`${r}:${a.value}`;return o(D,{id:c,...a,control:o(I,{value:a.value,id:c})},a.value)})})]});return p(Rn,{children:[o(En,{htmlFor:r,children:t.title}),A(t.property)?o($e,{id:r,checked:n===!0,onCheckedChange:(a)=>i(a)}):C(t.property)?o(l,{id:r,type:"number",required:t.required,value:typeof n==="number"?n:"",onChange:(a)=>i(a.target.value===""?void 0:Number(a.target.value))}):o(k,{id:r,rows:2,required:t.required,value:typeof n==="string"?n:"",onChange:(a)=>i(a.target.value)}),t.description&&o(at,{children:t.description})]})}function bn({requestId:r,schema:t,message:n,total:i,t:a,onRespond:c}){let g=V(()=>Pr(t),[t]),[F,y]=R(()=>fr(g));N(()=>y(fr(g)),[r,g]);let x=g.every((s)=>Nr(s,F[s.key])),O=()=>{if(!x)return;let s={};for(let[h,v]of Object.entries(F))if(v!==void 0)s[h]=v;c({action:"accept",content:s})};return o(d,{open:!0,onOpenChange:(s)=>!s&&c({action:"cancel"}),children:p(u,{className:"flex max-h-[80vh] flex-col gap-4 sm:max-w-lg",onKeyDown:(s)=>{if(s.key==="Enter"&&(s.metaKey||s.ctrlKey))s.preventDefault(),O()},children:[p(b,{children:[p("div",{className:"flex items-center justify-between gap-2 pe-8",children:[o(m,{children:t.title??a("approval.needed")}),i>1&&o("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${i}`})]}),o(w,{children:n})]}),o("div",{className:"min-h-0 flex-1 overflow-y-auto",children:o(Mn,{children:g.map((s)=>o(L,{id:`${r}:${s.key}`,field:s,value:F[s.key],onChange:(h)=>y((v)=>({...v,[s.key]:h}))},s.key))})}),p(X,{children:[o(e,{variant:"ghost",onClick:()=>c({action:"decline"}),children:a("actions.decline")}),o(e,{disabled:!x,onClick:O,children:a("actions.submit")})]})]})})}
2
- export{Pr,fr,Nr,bn};
1
+ import{e}from"./chunk-6kn920c5.js";import{ue}from"./chunk-1drkvxzk.js";import{d,u,b,X,m,w}from"./chunk-a2hygrpr.js";import{f}from"./chunk-ek06eyp4.js";import{At,Lt,En,An,Ln,at}from"./chunk-8jpm8fnf.js";import{l}from"./chunk-1hy64ewz.js";import{j,P}from"./chunk-ana59z25.js";import{$e}from"./chunk-ak0k5vg6.js";import{k}from"./chunk-ncekagm6.js";import{isArrayProperty as S,isBooleanProperty as A,isNumberProperty as C,isStringProperty as E}from"@nyssance/codex-acp-v2/client";import{useEffect as N,useMemo as V,useState as R}from"react";import{jsx as o,jsxs as p}from"react/jsx-runtime";function q(r){if(!E(r))return null;if(r.oneOf&&r.oneOf.length>0)return r.oneOf.map((t)=>({value:t.const,label:t.title??t.const,...t.description?{description:t.description}:{}}));if(r.enum&&r.enum.length>0)return r.enum.map((t)=>({value:t,label:t}));return null}function L(r){let t=r,n=t._meta?.alwith?.options;if(Array.isArray(n)&&Array.isArray(t.enum))return n.map((i)=>({value:i.const,label:i.title,...i.description?{description:i.description}:{}}));if(Array.isArray(t.enum))return t.enum.map((i)=>({value:String(i),label:String(i)}));if(Array.isArray(t.oneOf))return t.oneOf.map((i)=>({value:i.const,label:i.title,...i.description?{description:i.description}:{}}));return null}function Nr(r){let t=new Set(r.required??[]);return Object.entries(r.properties??{}).map(([n,i])=>({key:n,property:i,title:i.title??n,description:i.description??null,required:t.has(n),options:q(i),multiOptions:S(i)?L(i.items):null}))}function hr(r){let t={};for(let n of r){let i=n.property.default;if(i!==void 0&&i!==null)t[n.key]=i;else if(n.options)t[n.key]=n.options[0].value;else if(A(n.property))t[n.key]=!1;else if(S(n.property))t[n.key]=[]}return t}function Mr(r,t){if(r.multiOptions)return Array.isArray(t)&&t.length>0;if(!r.required)return!0;return t!==void 0&&t!==""&&!(Array.isArray(t)&&t.length===0)}function D({id:r,label:t,description:n,control:i}){return p("div",{className:"hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",children:[i,p(f,{htmlFor:r,className:"min-w-0 flex-1 cursor-pointer font-normal",children:[o("div",{className:"text-foreground text-sm",children:t}),n&&o("div",{className:"text-muted-foreground text-xs",children:n})]})]})}function G({id:r,field:t,value:n,onChange:i}){if(t.multiOptions){let a=new Set(Array.isArray(n)?n:[]);return p(At,{children:[o(Lt,{variant:"label",children:t.title}),t.description&&o(at,{children:t.description}),o("div",{className:"flex flex-col gap-1",children:t.multiOptions.map((c)=>{let g=`${r}:${c.value}`;return o(D,{id:g,...c,control:o(ue,{id:g,checked:a.has(c.value),onCheckedChange:(F)=>{let y=new Set(a);if(F)y.add(c.value);else y.delete(c.value);i([...y])}})},c.value)})})]})}if(t.options)return p(At,{children:[o(Lt,{variant:"label",children:t.title}),t.description&&o(at,{children:t.description}),o(j,{value:typeof n==="string"?n:"",onValueChange:(a)=>i(String(a)),className:"flex flex-col gap-1",children:t.options.map((a)=>{let c=`${r}:${a.value}`;return o(D,{id:c,...a,control:o(P,{value:a.value,id:c})},a.value)})})]});return p(An,{children:[o(Ln,{htmlFor:r,children:t.title}),A(t.property)?o($e,{id:r,checked:n===!0,onCheckedChange:(a)=>i(a)}):C(t.property)?o(l,{id:r,type:"number",required:t.required,value:typeof n==="number"?n:"",onChange:(a)=>i(a.target.value===""?void 0:Number(a.target.value))}):o(k,{id:r,rows:2,required:t.required,value:typeof n==="string"?n:"",onChange:(a)=>i(a.target.value)}),t.description&&o(at,{children:t.description})]})}function kn({requestId:r,schema:t,message:n,total:i,t:a,onRespond:c}){let g=V(()=>Nr(t),[t]),[F,y]=R(()=>hr(g));N(()=>y(hr(g)),[r,g]);let x=g.every((s)=>Mr(s,F[s.key])),O=()=>{if(!x)return;let s={};for(let[h,v]of Object.entries(F))if(v!==void 0)s[h]=v;c({action:"accept",content:s})};return o(d,{open:!0,onOpenChange:(s)=>!s&&c({action:"cancel"}),children:p(u,{className:"flex max-h-[80vh] flex-col gap-4 sm:max-w-lg",onKeyDown:(s)=>{if(s.key==="Enter"&&(s.metaKey||s.ctrlKey))s.preventDefault(),O()},children:[p(b,{children:[p("div",{className:"flex items-center justify-between gap-2 pe-8",children:[o(m,{children:t.title??a("approval.needed")}),i>1&&o("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${i}`})]}),o(w,{children:n})]}),o("div",{className:"min-h-0 flex-1 overflow-y-auto",children:o(En,{children:g.map((s)=>o(G,{id:`${r}:${s.key}`,field:s,value:F[s.key],onChange:(h)=>y((v)=>({...v,[s.key]:h}))},s.key))})}),p(X,{children:[o(e,{variant:"ghost",onClick:()=>c({action:"decline"}),children:a("actions.decline")}),o(e,{disabled:!x,onClick:O,children:a("actions.submit")})]})]})})}
2
+ export{Nr,hr,Mr,kn};
@@ -0,0 +1,3 @@
1
+ import{a,v}from"./chunk-y6r6tzfh.js";import{S}from"./chunk-sn80gr8g.js";import{co}from"./chunk-bftrddmr.js";import{G}from"./chunk-w45d5th9.js";import{so,Me}from"./chunk-hh498geh.js";import{po}from"./chunk-a1kmc6t8.js";import{qt}from"./chunk-8a1j96d1.js";import{cn as M}from"cn";import{jsx as o,jsxs as g}from"react/jsx-runtime";var R=new WeakMap,w=1;function N(t){if(t.type==="tool_use"||t.type==="subagent"||t.type==="collab")return`${t.type}:${t.id}`;let n=R.get(t);if(n!==void 0)return`${t.type}:${n}`;let s=w++;return R.set(t,s),`${t.type}:${s}`}function P({block:t,streaming:n,actions:s}){if(t.isApiError)return o("div",{className:"codex-stream-error",children:t.text});return g("div",{className:"codex-assistant-message",children:[o(v,{text:t.text,streaming:n}),s]})}function I({block:t,streaming:n,actions:s,renderText:i}){switch(t.type){case"text":return i===void 0?o(P,{block:t,streaming:n,actions:s}):i({block:t,streaming:n,actions:s});case"thinking":return t.thinking.length>0?o(v,{text:t.thinking,streaming:!t.isComplete}):null;case"plan":return o(G,{entries:t.entries});case"image":return o("img",{src:`data:${t.source.media_type};base64,${t.source.data}`,className:"max-h-64 rounded",alt:""});case"tool_use":case"subagent":case"collab":return null}}var E=new Set;function mi({message:t,isMostRecentTurn:n,hiddenTools:s=E,time:i,beforeCopy:r,afterCopy:d,providerIcon:u,renderText:T,renderEditedFiles:y}){if(t.streaming===!0&&t.content.every((e)=>e.type==="text"?e.text.length===0:e.type==="thinking"?e.thinking.length===0:!1))return o(A,{});let C=t.content.filter((e)=>e.type==="text").map((e)=>e.text).join(`
2
+ `),b=!t.streaming&&C.trim().length>0?o(Ft,{text:C,isMostRecentTurn:n,beforeCopy:r,afterCopy:d,time:i}):null,l=co(t.content,"compact"),x=l.reduce((e,c,p)=>c.kind==="codexActivityGroup"?p:e,-1),h=l.findIndex((e,c)=>c>x&&e.kind==="block"&&e.block.type==="text"),B=[...t.content].toReversed().find((e)=>e.type==="text"),f=t.content.filter((e)=>e.type==="tool_use"&&S(e).category==="edit"),k=(e)=>{if(e.kind==="codexActivityGroup"){let c=e.blocks.filter((p)=>p.type!=="tool_use"||!s.has(p.name));return c.length===0?null:o(Me,{blocks:c},`activity:${N(c[0])}`)}if(e.kind!=="block")throw Error(`Codex received an incompatible grouped entry: ${e.kind}`);return o(I,{block:e.block,streaming:Boolean(t.streaming),actions:e.block===B?b:void 0,renderText:T},N(e.block))},m=x===-1?0:h===-1?l.length:h;return o(Bt,{stateKey:t.id,active:Boolean(t.streaming),startedAt:t.startedAt,durationMs:t.durationMs,providerId:t.providerId,providerIcon:u,work:l.slice(0,m).map(k),answer:l.length>m?l.slice(m).map(k):null,footer:x!==-1&&f.length>0&&(y===void 0?o(po,{blocks:f}):y(f))})}function Ft({text:t,isMostRecentTurn:n=!1,beforeCopy:s,afterCopy:i,time:r}){let d=a(),{t:u}=d;return g("div",{className:M("mt-1.5 flex h-5 w-fit -translate-x-1 items-center justify-start gap-0.5 [&_*]:transition-none",n?"opacity-100":"opacity-0 group-focus-within/am:opacity-100 group-hover/am:opacity-100"),children:[s,o(qt,{text:t,label:u("actions.copy"),host:d}),i,r&&o("span",{className:"codex-user-time ms-1",title:r.full,children:r.short})]})}function A({label:t}){let{t:n}=a();return o("div",{className:"codex-pending-message py-2",role:"status",children:o("span",{className:"codex-activity-running",children:t??n("message.thinking")})})}function Bt({work:t,answer:n,footer:s,loading:i=!1,loadingLabel:r,...d}){if(i)return o(A,{label:r});return g("div",{className:"group/am codex-assistant-turn",children:[t.length>0&&o(so,{...d,children:t}),n!==null&&(t.length===0?n:o("div",{"data-local-conversation-final-assistant":!0,"data-testid":"codex-final-answer",className:"codex-final-answer",children:n})),s]})}
3
+ export{mi,Ft,Bt};
@@ -1,2 +1,2 @@
1
- var z=/[\\/._\- ]/;function h(r,n){if(n===0)return!0;let s=r[n-1];if(z.test(s))return!0;let c=r[n];if(s===s.toLowerCase()&&c!==c.toLowerCase())return!0;return!1}function Jt(r,n){if(!n)return{score:0,indices:[]};let s=r.toLowerCase(),c=n.toLowerCase(),i=[],t=0,e=0,u=-2;for(let l of c.split("")){let o=-1;while(t<s.length){if(s[t]===l){o=t;break}t++}if(o<0)return null;if(e+=1,o===u+1)e+=4;if(h(r,o))e+=5;let f=r.lastIndexOf("/");if(f!==-1&&o>f)e+=2;i.push(o),u=o,t=o+1}if(e-=Math.floor(r.length/50),r.includes(n))e+=3;return{score:e,indices:i}}function _o(r,n,s,c=100){if(!n)return r.slice(0,c).map((t)=>({item:t,score:0,indices:[]}));let i=[];for(let t of r){let e=Jt(s(t),n);if(!e)continue;i.push({item:t,score:e.score,indices:e.indices})}return i.sort((t,e)=>e.score-t.score),i.slice(0,c)}
2
- export{Jt,_o};
1
+ var z=/[\\/._\- ]/;function h(r,n){if(n===0)return!0;let s=r[n-1];if(z.test(s))return!0;let c=r[n];if(s===s.toLowerCase()&&c!==c.toLowerCase())return!0;return!1}function tn(r,n){if(!n)return{score:0,indices:[]};let s=r.toLowerCase(),c=n.toLowerCase(),i=[],t=0,e=0,u=-2;for(let l of c.split("")){let o=-1;while(t<s.length){if(s[t]===l){o=t;break}t++}if(o<0)return null;if(e+=1,o===u+1)e+=4;if(h(r,o))e+=5;let f=r.lastIndexOf("/");if(f!==-1&&o>f)e+=2;i.push(o),u=o,t=o+1}if(e-=Math.floor(r.length/50),r.includes(n))e+=3;return{score:e,indices:i}}function Ho(r,n,s,c=100){if(!n)return r.slice(0,c).map((t)=>({item:t,score:0,indices:[]}));let i=[];for(let t of r){let e=tn(s(t),n);if(!e)continue;i.push({item:t,score:e.score,indices:e.indices})}return i.sort((t,e)=>e.score-t.score),i.slice(0,c)}
2
+ export{tn,Ho};
@@ -1,2 +1,2 @@
1
- function Po(r,e){if(!e.running)return{kind:"idle"};if(e.blocked)return{kind:"waiting"};if(e.retrying)return{kind:"retrying"};let t=r.findLast((i)=>i.kind==="tool"&&i.active);if(t)return{kind:"tool",ownerKey:t.key};let n=r.findLast((i)=>i.kind!=="user");if(n?.active){if(n.kind==="answer")return{kind:"speaking",ownerKey:n.key};if(n.kind==="text")return{kind:"thinking",ownerKey:n.key};if(n.kind==="reasoning")return{kind:"reasoning",ownerKey:n.key};if(n.kind==="plan")return{kind:"planning",ownerKey:n.key};if(n.kind==="compaction")return{kind:"tool",ownerKey:n.key}}if(n?.kind==="answer")return{kind:"idle"};return{kind:"thinking",ownerKey:n?.key}}
2
- export{Po};
1
+ function No(r,e){if(!e.running)return{kind:"idle"};if(e.blocked)return{kind:"waiting"};if(e.retrying)return{kind:"retrying"};let t=r.findLast((i)=>i.kind==="tool"&&i.active);if(t)return{kind:"tool",ownerKey:t.key};let n=r.findLast((i)=>i.kind!=="user");if(n?.active){if(n.kind==="answer")return{kind:"speaking",ownerKey:n.key};if(n.kind==="text")return{kind:"speaking",ownerKey:n.key};if(n.kind==="reasoning")return{kind:"reasoning",ownerKey:n.key};if(n.kind==="plan")return{kind:"planning",ownerKey:n.key};if(n.kind==="compaction")return{kind:"tool",ownerKey:n.key}}if(n?.kind==="answer")return{kind:"idle"};return{kind:"working",ownerKey:n?.key}}
2
+ export{No};
@@ -1,4 +1,4 @@
1
- function Eo(t,e){if(e===0)return null;let r=e-1;while(r>=0){let n=t[r];if(n===" "||n==="\t"||n===`
1
+ function Ao(t,e){if(e===0)return null;let r=e-1;while(r>=0){let n=t[r];if(n===" "||n==="\t"||n===`
2
2
  `)return null;if(n==="@"||n==="/"){let i=r===0?"":t[r-1],s=r===0||i===`
3
3
  `;if(n==="/"?s&&!/[/\\]/.test(t.slice(r+1,e)):s||i===" "||i==="\t")return{kind:n==="/"?"slash":"at",start:r,end:e,query:t.slice(r+1,e)}}r-=1}return null}
4
- export{Eo};
4
+ export{Ao};
@@ -0,0 +1,2 @@
1
+ import{useCallback as f,useState as r}from"react";var t=new Map;function I(o,e,a=!1){let[p,S]=r(()=>({key:o,expanded:t.get(o)??e})),n=p.expanded;if(p.key!==o||a&&!t.has(o)&&n!==e)n=t.get(o)??e,S({key:o,expanded:n});let k=f((c)=>{S((s)=>{let b=s.key===o?s.expanded:t.get(o)??e,d=typeof c==="function"?c(b):c;return t.set(o,d),s.key===o?{key:o,expanded:d}:s})},[o,e]);return[n,k]}
2
+ export{I};
@@ -1 +1 @@
1
- import{cn as e}from"cn";import{jsx as o}from"react/jsx-runtime";function Go({className:t,...n}){return o("kbd",{"data-slot":"kbd",className:e("pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3",t),...n})}function yi({className:t,...n}){return o("kbd",{"data-slot":"kbd-group",className:e("inline-flex items-center gap-1",t),...n})}export{Go,yi};
1
+ import{cn as e}from"cn";import{jsx as o}from"react/jsx-runtime";function Go({className:t,...n}){return o("kbd",{"data-slot":"kbd",className:e("pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3",t),...n})}function bi({className:t,...n}){return o("kbd",{"data-slot":"kbd-group",className:e("inline-flex items-center gap-1",t),...n})}export{Go,bi};
@@ -1,2 +1,2 @@
1
- import{a}from"./chunk-ryz4c13z.js";import{S}from"./chunk-51sbmqdk.js";import{isContentEntry as k,isImage as b,isResourceLink as N}from"@nyssance/codex-acp-v2/client";import{ChevronRightIcon as w,ImageIcon as C,LoaderCircleIcon as A,RefreshCwIcon as R}from"lucide-react";import{useEffect as B,useState as h}from"react";import{jsx as n,jsxs as y}from"react/jsx-runtime";function pe(e){return e.type==="tool_use"&&e.name==="view_image"&&e.status==="completed"}function T(e){let r=[];for(let[c,l]of e.content.entries()){if(!k(l))continue;let o=l.content;if(b(o))r.push({key:`${e.id}:${c}`,src:`data:${o.mimeType};base64,${o.data}`,alt:e.title??""});if(N(o))r.push({key:`${e.id}:${c}`,path:o.uri,alt:o.name})}if(r.length)return r;let i=e.rawInput;if(i!==null&&typeof i==="object"&&"path"in i&&typeof i.path==="string")return[{key:e.id,path:i.path,alt:i.path.split(/[\\/]/).at(-1)??i.path}];throw Error(`Image view ${e.id} has no image source`)}function E({images:e}){let{loadImage:r,openImageGallery:i,openImage:c,t:l}=a(),[o,g]=h({}),[v,x]=h(0),f=JSON.stringify(e);B(()=>{let t=!0,u=JSON.parse(f);g({});for(let s of u)(s.src!==void 0?Promise.resolve(s.src):s.path!==void 0&&r?r(s.path):Promise.reject(Error("Image loading is unavailable"))).then((d)=>{if(t)g((p)=>({...p,[s.key]:{src:d}}))},()=>{if(t)g((d)=>({...d,[s.key]:{error:!0}}))});return()=>{t=!1}},[f,r,v]);let I=e.flatMap((t)=>{let u=o[t.key];return u&&"src"in u?[{src:u.src,alt:t.alt}]:[]});return n("div",{className:"codex-image-thumbnails",children:e.map((t,u)=>{let s=o[t.key];if(!s)return n("div",{className:"codex-image-thumbnail",role:"status","aria-label":l("stream.codex.imageLoading"),children:n(A,{className:"motion-safe:animate-spin","aria-hidden":"true"})},t.key);if("error"in s)return n("button",{type:"button",className:"codex-image-thumbnail",title:t.alt,"aria-label":l("stream.codex.imageFailed"),onClick:()=>x((m)=>m+1),children:n(R,{"aria-hidden":"true"})},t.key);return n("button",{type:"button",className:"codex-image-thumbnail",title:t.alt,onClick:()=>{let m=e.slice(0,u).filter((d)=>{let p=o[d.key];return p&&"src"in p}).length;if(i)i(I,m);else c?.(s.src)},children:n("img",{src:s.src,alt:t.alt,draggable:!1})},t.key)})})}function so({blocks:e}){let{t:r}=a(),i=e.flatMap(T),[c,l]=S(`image-view:${e[0].id}`,!1);return y("div",{className:"codex-activity-item",children:[y("button",{type:"button",className:"codex-activity-header","data-codex-disclosure":"","aria-expanded":c,onClick:()=>l((o)=>!o),children:[y("span",{className:"codex-activity-label",children:[n(C,{className:"codex-activity-icon","aria-hidden":"true"}),n("span",{className:"codex-activity-leading",children:r("stream.codex.viewedImages",{count:i.length})})]}),n(w,{className:c?"codex-image-chevron codex-image-chevron-open":"codex-image-chevron","aria-hidden":"true"})]}),c&&n(E,{images:i})]})}
2
- export{pe,so};
1
+ import{a}from"./chunk-y6r6tzfh.js";import{I}from"./chunk-ckft9abb.js";import{isContentEntry as b,isImage as N,isResourceLink as w}from"@nyssance/codex-acp-v2/client";import{ChevronRightIcon as C,ImageIcon as S,LoaderCircleIcon as A,RefreshCwIcon as R}from"lucide-react";import{useEffect as B,useState as h}from"react";import{jsx as n,jsxs as y}from"react/jsx-runtime";function pe(e){return e.type==="tool_use"&&e.name==="view_image"&&e.status==="completed"}function T(e){let r=[];for(let[c,l]of e.content.entries()){if(!b(l))continue;let o=l.content;if(N(o))r.push({key:`${e.id}:${c}`,src:`data:${o.mimeType};base64,${o.data}`,alt:e.title??""});if(w(o))r.push({key:`${e.id}:${c}`,path:o.uri,alt:o.name})}if(r.length)return r;let i=e.rawInput;if(i!==null&&typeof i==="object"&&"path"in i&&typeof i.path==="string")return[{key:e.id,path:i.path,alt:i.path.split(/[\\/]/).at(-1)??i.path}];throw Error(`Image view ${e.id} has no image source`)}function E({images:e}){let{loadImage:r,openImageGallery:i,openImage:c,t:l}=a(),[o,g]=h({}),[v,x]=h(0),f=JSON.stringify(e);B(()=>{let t=!0,u=JSON.parse(f);g({});for(let s of u)(s.src!==void 0?Promise.resolve(s.src):s.path!==void 0&&r?r(s.path):Promise.reject(Error("Image loading is unavailable"))).then((d)=>{if(t)g((p)=>({...p,[s.key]:{src:d}}))},()=>{if(t)g((d)=>({...d,[s.key]:{error:!0}}))});return()=>{t=!1}},[f,r,v]);let k=e.flatMap((t)=>{let u=o[t.key];return u&&"src"in u?[{src:u.src,alt:t.alt}]:[]});return n("div",{className:"codex-image-thumbnails",children:e.map((t,u)=>{let s=o[t.key];if(!s)return n("div",{className:"codex-image-thumbnail",role:"status","aria-label":l("stream.codex.imageLoading"),children:n(A,{className:"motion-safe:animate-spin","aria-hidden":"true"})},t.key);if("error"in s)return n("button",{type:"button",className:"codex-image-thumbnail",title:t.alt,"aria-label":l("stream.codex.imageFailed"),onClick:()=>x((m)=>m+1),children:n(R,{"aria-hidden":"true"})},t.key);return n("button",{type:"button",className:"codex-image-thumbnail",title:t.alt,onClick:()=>{let m=e.slice(0,u).filter((d)=>{let p=o[d.key];return p&&"src"in p}).length;if(i)i(k,m);else c?.(s.src)},children:n("img",{src:s.src,alt:t.alt,draggable:!1})},t.key)})})}function lo({blocks:e}){let{t:r}=a(),i=e.flatMap(T),[c,l]=I(`image-view:${e[0].id}`,!1);return y("div",{className:"codex-activity-item",children:[y("button",{type:"button",className:"codex-activity-header","data-codex-disclosure":"","aria-expanded":c,onClick:()=>l((o)=>!o),children:[y("span",{className:"codex-activity-label",children:[n(S,{className:"codex-activity-icon","aria-hidden":"true"}),n("span",{className:"codex-activity-leading",children:r("stream.codex.viewedImages",{count:i.length})})]}),n(C,{className:c?"codex-image-chevron codex-image-chevron-open":"codex-image-chevron","aria-hidden":"true"})]}),c&&n(E,{images:i})]})}
2
+ export{pe,lo};
@@ -1,2 +1,2 @@
1
- import{tr}from"./chunk-tv89wh8b.js";async function m(r){try{let i=await(await fetch(r)).blob();if(typeof createImageBitmap==="function")return(await createImageBitmap(i)).close(),!0;return await new Promise((a)=>{let o=new Image;o.onload=()=>a(!0),o.onerror=()=>a(!1),o.src=r})}catch{return!1}}async function er(r){let n=await Promise.all(r.map(async({id:a,lastModified:o,sourcePath:p,...t})=>{let e=t.url;if(t.url.startsWith("blob:")){let s=await tr(t.url,t.mediaType);if(s===null)return null;e=s}let l=t.mediaType.toLowerCase().startsWith("image/"),c=e.startsWith("data:image/");if(l&&c&&!await m(e))return null;let u=e.startsWith("data:")?e.slice(5,e.indexOf(";")):t.mediaType;return{...t,url:e,mediaType:u}})),i=n.filter((a)=>a!==null);return{files:i,rejectedCount:n.length-i.length}}
2
- export{er};
1
+ import{nr}from"./chunk-r0t8zj4g.js";async function m(r){try{let i=await(await fetch(r)).blob();if(typeof createImageBitmap==="function")return(await createImageBitmap(i)).close(),!0;return await new Promise((a)=>{let o=new Image;o.onload=()=>a(!0),o.onerror=()=>a(!1),o.src=r})}catch{return!1}}async function tr(r){let n=await Promise.all(r.map(async({id:a,lastModified:o,sourcePath:p,...t})=>{let e=t.url;if(t.url.startsWith("blob:")){let s=await nr(t.url,t.mediaType);if(s===null)return null;e=s}let l=t.mediaType.toLowerCase().startsWith("image/"),c=e.startsWith("data:image/");if(l&&c&&!await m(e))return null;let u=e.startsWith("data:")?e.slice(5,e.indexOf(";")):t.mediaType;return{...t,url:e,mediaType:u}})),i=n.filter((a)=>a!==null);return{files:i,rejectedCount:n.length-i.length}}
2
+ export{tr};
@@ -1,2 +1,2 @@
1
- function Ho({container:i,target:f,clientX:e,clientY:n,currentScale:r,nextScale:s}){if(r<=0||s<=0)return null;let o=i.getBoundingClientRect(),t=f.getBoundingClientRect();if(t.width===0||t.height===0)return null;let h=e>=t.left&&e<=t.right&&n>=t.top&&n<=t.bottom,l=h?(e-t.left)/t.width:0.5,a=h?(n-t.top)/t.height:0.5,c=t.width/r,g=t.height/r,m=c*s,u=g*s,d=e-o.left,p=n-o.top,P=i.scrollLeft+(t.left-o.left)+t.width/2,b=i.scrollTop+(t.top-o.top)+t.height/2,C=(l-0.5)*m,x=(a-0.5)*u;return{left:Math.max(0,P+C-d),top:Math.max(0,b+x-p)}}
2
- export{Ho};
1
+ function Oo({container:i,target:f,clientX:e,clientY:n,currentScale:r,nextScale:s}){if(r<=0||s<=0)return null;let o=i.getBoundingClientRect(),t=f.getBoundingClientRect();if(t.width===0||t.height===0)return null;let h=e>=t.left&&e<=t.right&&n>=t.top&&n<=t.bottom,l=h?(e-t.left)/t.width:0.5,a=h?(n-t.top)/t.height:0.5,c=t.width/r,g=t.height/r,m=c*s,u=g*s,d=e-o.left,p=n-o.top,P=i.scrollLeft+(t.left-o.left)+t.width/2,b=i.scrollTop+(t.top-o.top)+t.height/2,C=(l-0.5)*m,x=(a-0.5)*u;return{left:Math.max(0,P+C-d),top:Math.max(0,b+x-p)}}
2
+ export{Oo};
@@ -1,2 +1,2 @@
1
- import{Ho}from"./chunk-t3ew92b3.js";import{d,rr,u,m}from"./chunk-17zegmxa.js";import{cn as M}from"cn";import{XIcon as L}from"lucide-react";import{useCallback as O,useEffect as z,useMemo as j,useRef as H,useState as S}from"react";import{jsx as i,jsxs as A}from"react/jsx-runtime";function Do({open:l,onOpenChange:P,url:h,filename:x,scale:v,onScaleChange:p,containerRef:T,containerClassName:I,dialogContentClassName:R,imageClassName:W}){let g=O((e)=>Math.min(4,Math.max(0.25,e)),[]),[Z,C]=S(1),o=g(v??Z),k=H(null),s=T??k,D=H(null),[f,N]=S({width:0,height:0}),[y,E]=S({width:0,height:0}),b=O((e)=>{let n=g(e);if(typeof p==="function"){p(n);return}C(n)},[p,g]);z(()=>{if(!l)return;if(!h)return;if(typeof v==="number")return;C(1)},[l,h,v]),z(()=>{if(!l)return;let e=s.current;if(!e)return;let n=()=>{N({width:e.clientWidth,height:e.clientHeight})};n();let t=new ResizeObserver(n);return t.observe(e),()=>{t.disconnect()}},[s,l]);let X=O(()=>{b(1)},[b]),r=j(()=>{let{width:e,height:n}=y,{width:t,height:a}=f;if(e===0||n===0)return{width:0,height:0};if(t===0||a===0)return{width:0,height:0};let c=Math.min(t/e,a/n,1),w=e*c,_=n*c;return{width:w*o,height:_*o}},[o,y,f]);if(!h)return null;return i(d,{open:l,onOpenChange:P,children:A(u,{className:M("top-1/2 left-1/2 h-[90vh] max-h-[90vh] w-[90vw]! max-w-[90vw]! -translate-x-1/2 -translate-y-1/2 gap-0 rounded-none bg-transparent p-0 ring-0 sm:w-[90vw]! sm:max-w-[90vw]!",R),showCloseButton:!1,children:[i(m,{className:"sr-only",children:x||"Image preview"}),i(rr,{"aria-label":"Close",className:"absolute top-3 right-3 z-10 flex size-10 items-center justify-center rounded-full bg-black/55 text-white backdrop-blur-sm transition-colors hover:bg-black/75",children:i(L,{className:"size-5"})}),i("div",{ref:s,onWheel:(e)=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();let n=e.deltaY>0?o-0.2:o+0.2,t=g(Number.parseFloat(n.toFixed(2)));if(t===o)return;let a=s.current,c=D.current,w=a&&c?Ho({container:a,target:c,clientX:e.clientX,clientY:e.clientY,currentScale:o,nextScale:t}):null;if(b(t),a&&w)requestAnimationFrame(()=>{a.scrollTo(w)})},className:M("h-full w-full scrollbar-thin overflow-auto",I),children:i("div",{className:"grid min-h-full min-w-full place-items-center",style:{width:Math.max(f.width,r.width),height:Math.max(f.height,r.height)},children:i("div",{className:"shrink-0",children:i("img",{alt:x||"image preview",className:M("block object-contain select-none",W),decoding:"async",draggable:!1,ref:D,onDoubleClick:X,onLoad:(e)=>{let n=e.currentTarget;E({width:n.naturalWidth,height:n.naturalHeight});let t=s.current;if(t&&(t.clientWidth||t.clientHeight))N({width:t.clientWidth,height:t.clientHeight})},style:{imageRendering:"auto",width:r.width||void 0,height:r.height||void 0,maxWidth:r.width?"none":"90vw",maxHeight:r.height?"none":"90vh"},src:h})})})})]})})}
2
- export{Do};
1
+ import{Oo}from"./chunk-dgnk7h62.js";import{d,ir,u,m}from"./chunk-a2hygrpr.js";import{cn as M}from"cn";import{XIcon as L}from"lucide-react";import{useCallback as O,useEffect as z,useMemo as j,useRef as H,useState as S}from"react";import{jsx as i,jsxs as A}from"react/jsx-runtime";function _o({open:l,onOpenChange:P,url:h,filename:x,scale:v,onScaleChange:p,containerRef:T,containerClassName:I,dialogContentClassName:R,imageClassName:W}){let g=O((e)=>Math.min(4,Math.max(0.25,e)),[]),[Z,C]=S(1),o=g(v??Z),k=H(null),s=T??k,D=H(null),[f,N]=S({width:0,height:0}),[y,E]=S({width:0,height:0}),b=O((e)=>{let n=g(e);if(typeof p==="function"){p(n);return}C(n)},[p,g]);z(()=>{if(!l)return;if(!h)return;if(typeof v==="number")return;C(1)},[l,h,v]),z(()=>{if(!l)return;let e=s.current;if(!e)return;let n=()=>{N({width:e.clientWidth,height:e.clientHeight})};n();let t=new ResizeObserver(n);return t.observe(e),()=>{t.disconnect()}},[s,l]);let X=O(()=>{b(1)},[b]),r=j(()=>{let{width:e,height:n}=y,{width:t,height:a}=f;if(e===0||n===0)return{width:0,height:0};if(t===0||a===0)return{width:0,height:0};let c=Math.min(t/e,a/n,1),w=e*c,_=n*c;return{width:w*o,height:_*o}},[o,y,f]);if(!h)return null;return i(d,{open:l,onOpenChange:P,children:A(u,{className:M("top-1/2 left-1/2 h-[90vh] max-h-[90vh] w-[90vw]! max-w-[90vw]! -translate-x-1/2 -translate-y-1/2 gap-0 rounded-none bg-transparent p-0 ring-0 sm:w-[90vw]! sm:max-w-[90vw]!",R),showCloseButton:!1,children:[i(m,{className:"sr-only",children:x||"Image preview"}),i(ir,{"aria-label":"Close",className:"absolute top-3 right-3 z-10 flex size-10 items-center justify-center rounded-full bg-black/55 text-white backdrop-blur-sm transition-colors hover:bg-black/75",children:i(L,{className:"size-5"})}),i("div",{ref:s,onWheel:(e)=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();let n=e.deltaY>0?o-0.2:o+0.2,t=g(Number.parseFloat(n.toFixed(2)));if(t===o)return;let a=s.current,c=D.current,w=a&&c?Oo({container:a,target:c,clientX:e.clientX,clientY:e.clientY,currentScale:o,nextScale:t}):null;if(b(t),a&&w)requestAnimationFrame(()=>{a.scrollTo(w)})},className:M("h-full w-full scrollbar-thin overflow-auto",I),children:i("div",{className:"grid min-h-full min-w-full place-items-center",style:{width:Math.max(f.width,r.width),height:Math.max(f.height,r.height)},children:i("div",{className:"shrink-0",children:i("img",{alt:x||"image preview",className:M("block object-contain select-none",W),decoding:"async",draggable:!1,ref:D,onDoubleClick:X,onLoad:(e)=>{let n=e.currentTarget;E({width:n.naturalWidth,height:n.naturalHeight});let t=s.current;if(t&&(t.clientWidth||t.clientHeight))N({width:t.clientWidth,height:t.clientHeight})},style:{imageRendering:"auto",width:r.width||void 0,height:r.height||void 0,maxWidth:r.width?"none":"90vw",maxHeight:r.height?"none":"90vh"},src:h})})})})]})})}
2
+ export{_o};
@@ -1,2 +1,2 @@
1
- import{CacheStorage as I,Soundfont as M}from"smplr";var T=4,y=21,l=88,s=[39,41,43,44,46,48,50],p=0.035,b=0.16,S=88,E=50,h="acoustic_grand_piano",O="MusyngKite",w="FluidR3_GM",f=[0,2,4,5,7,9,11],U=2,C=5,m=globalThis;if(m.__alwithTimelineUserMessageNavigationAudio?.version!==T)m.__alwithTimelineUserMessageNavigationAudio={version:T,context:null,storage:I("alwith-timeline-navigation-instruments"),players:new Map,nextNoteTime:0,unlockConsumerCount:0};var r=m.__alwithTimelineUserMessageNavigationAudio;function d(){return r.context??=new AudioContext,r.context}function c(){let e=d();if(e.state==="running"){r.nextNoteTime=e.currentTime;return}e.resume().then(()=>{r.nextNoteTime=e.currentTime},(n)=>{if(n instanceof DOMException&&n.name==="NotAllowedError")return;console.error("Failed to unlock timeline navigation audio",n)})}function k(e){let n=d();return M(n,{instrument:e,kit:e===h?O:w,storage:r.storage,volume:E})}function g(e){let n=r.players.get(e);if(n!==void 0)return n;let t=k(e),i={player:t,ready:t.ready};return r.players.set(e,i),i}function Xn(e){g(e).ready.catch((n)=>{console.error(`Failed to load navigation instrument "${e}"`,n)})}function ai(){c()}function Yn(){if(r.unlockConsumerCount===0)window.addEventListener("pointerdown",c,{capture:!0}),window.addEventListener("keydown",c,{capture:!0});return r.unlockConsumerCount++,()=>{if(r.unlockConsumerCount--,r.unlockConsumerCount===0)window.removeEventListener("pointerdown",c,{capture:!0}),window.removeEventListener("keydown",c,{capture:!0})}}function Zn(e,n,t,i,o){if(o==="none")return;let a=Math.sign(n-e),u=Math.abs(n-e),x=Array.from({length:u},(L,A)=>{let N=e+a*(A+1),v=t[N];return vr(N,t.length,v.inputTokens,v.outputTokens,o)});_(i,x)}function si(e,n,t,i,o,a){if(a==="none")return;_(o,[vr(e,n,t,i,a)])}function vr(e,n,t,i,o){if(o==="none")throw Error("navigationMidiNote: 声音已关闭,不该求音符");if(o==="auto")return Rr(t,i);return xr(e,n)}function Rr(e,n){let t=Math.imul(e,5)+Math.imul(n,3)>>>0,i=(Math.imul(e,11)^Math.imul(n,13))>>>0,o=t%f.length;return 12*(U+i%C+1)+f[o]}function xr(e,n){return y+Er(e,n)}function li(e,n){return D(xr(e,n))}function Er(e,n){if(n<=l)return Ar(n)[n-e-1];return Math.round((n-e-1)/(n-1)*(l-1))}function Ar(e){if(e<=s.length)return s.slice(0,e);let n=new Set(s),t=s[0]-1,i=s.at(-1)+1;while(n.size<e&&(t>=0||i<l)){if(t>=0&&n.size<e)n.add(t--);if(i<l&&n.size<e)n.add(i++)}for(let o=0;n.size<e&&o<l;o++)n.add(o);return[...n].toSorted((o,a)=>o-a)}function D(e){return 440*2**((e-69)/12)}function _(e,n){let t=d();if(t.state!=="running")return;let{player:i,ready:o}=g(e);o.then(()=>{let a=Math.max(t.currentTime,r.nextNoteTime);for(let u=0;u<n.length;u++)i.start({note:n[u],time:a+u*p,duration:b,velocity:S});r.nextNoteTime=a+n.length*p}).catch((a)=>{console.error(`Failed to play navigation instrument "${e}"`,a)})}function ci(){return r.context?.state}function di(e){return g(e).ready}
2
- export{Xn,ai,Yn,Zn,si,vr,Rr,xr,li,Er,Ar,ci,di};
1
+ import{CacheStorage as I,Soundfont as M}from"smplr";var T=4,y=21,l=88,s=[39,41,43,44,46,48,50],p=0.035,b=0.16,S=88,E=50,h="acoustic_grand_piano",O="MusyngKite",w="FluidR3_GM",f=[0,2,4,5,7,9,11],U=2,C=5,m=globalThis;if(m.__alwithTimelineUserMessageNavigationAudio?.version!==T)m.__alwithTimelineUserMessageNavigationAudio={version:T,context:null,storage:I("alwith-timeline-navigation-instruments"),players:new Map,nextNoteTime:0,unlockConsumerCount:0};var r=m.__alwithTimelineUserMessageNavigationAudio;function d(){return r.context??=new AudioContext,r.context}function c(){let e=d();if(e.state==="running"){r.nextNoteTime=e.currentTime;return}e.resume().then(()=>{r.nextNoteTime=e.currentTime},(n)=>{if(n instanceof DOMException&&n.name==="NotAllowedError")return;console.error("Failed to unlock timeline navigation audio",n)})}function k(e){let n=d();return M(n,{instrument:e,kit:e===h?O:w,storage:r.storage,volume:E})}function g(e){let n=r.players.get(e);if(n!==void 0)return n;let t=k(e),i={player:t,ready:t.ready};return r.players.set(e,i),i}function Zn(e){g(e).ready.catch((n)=>{console.error(`Failed to load navigation instrument "${e}"`,n)})}function si(){c()}function Jn(){if(r.unlockConsumerCount===0)window.addEventListener("pointerdown",c,{capture:!0}),window.addEventListener("keydown",c,{capture:!0});return r.unlockConsumerCount++,()=>{if(r.unlockConsumerCount--,r.unlockConsumerCount===0)window.removeEventListener("pointerdown",c,{capture:!0}),window.removeEventListener("keydown",c,{capture:!0})}}function eo(e,n,t,i,o){if(o==="none")return;let a=Math.sign(n-e),u=Math.abs(n-e),x=Array.from({length:u},(L,A)=>{let N=e+a*(A+1),v=t[N];return xr(N,t.length,v.inputTokens,v.outputTokens,o)});_(i,x)}function li(e,n,t,i,o,a){if(a==="none")return;_(o,[xr(e,n,t,i,a)])}function xr(e,n,t,i,o){if(o==="none")throw Error("navigationMidiNote: 声音已关闭,不该求音符");if(o==="auto")return Er(t,i);return yr(e,n)}function Er(e,n){let t=Math.imul(e,5)+Math.imul(n,3)>>>0,i=(Math.imul(e,11)^Math.imul(n,13))>>>0,o=t%f.length;return 12*(U+i%C+1)+f[o]}function yr(e,n){return y+Ar(e,n)}function ci(e,n){return D(yr(e,n))}function Ar(e,n){if(n<=l)return Lr(n)[n-e-1];return Math.round((n-e-1)/(n-1)*(l-1))}function Lr(e){if(e<=s.length)return s.slice(0,e);let n=new Set(s),t=s[0]-1,i=s.at(-1)+1;while(n.size<e&&(t>=0||i<l)){if(t>=0&&n.size<e)n.add(t--);if(i<l&&n.size<e)n.add(i++)}for(let o=0;n.size<e&&o<l;o++)n.add(o);return[...n].toSorted((o,a)=>o-a)}function D(e){return 440*2**((e-69)/12)}function _(e,n){let t=d();if(t.state!=="running")return;let{player:i,ready:o}=g(e);o.then(()=>{let a=Math.max(t.currentTime,r.nextNoteTime);for(let u=0;u<n.length;u++)i.start({note:n[u],time:a+u*p,duration:b,velocity:S});r.nextNoteTime=a+n.length*p}).catch((a)=>{console.error(`Failed to play navigation instrument "${e}"`,a)})}function di(){return r.context?.state}function ui(e){return g(e).ready}
2
+ export{Zn,si,Jn,eo,li,xr,Er,yr,ci,Ar,Lr,di,ui};
@@ -0,0 +1,3 @@
1
+ import{q,V}from"./chunk-kbwjcnf6.js";import{e}from"./chunk-6kn920c5.js";import{d,u,b,X,m,w}from"./chunk-a2hygrpr.js";import{l}from"./chunk-1hy64ewz.js";import{Nt,Mt,Rt,xn,Z}from"./chunk-xd5rqbwp.js";import{ce}from"./chunk-xxkdv1zf.js";import{p,s,r}from"./chunk-b3nt7axf.js";import{le,U,D}from"./chunk-f7n8erng.js";import{sessionGroup as F}from"@nyssance/codex-acp-v2/client";import{cn as fe}from"cn";import{ArchiveIcon as ve,FolderIcon as Y,ListFilterIcon as ge,SearchIcon as xe,Trash2Icon as ee}from"lucide-react";import{useEffect as Se,useRef as ye,useState as f}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";function te({className:v,...n}){return i(xn,{align:"start",alignItemWithTrigger:!1,sideOffset:6,...n,className:fe("max-w-(--available-width) min-w-0 p-1",v)})}function H(v){return v instanceof Error?v.message:String(v)}function Le({children:v}){return i("div",{className:"min-h-0 flex-1 overflow-y-auto",children:i("div",{className:"flex flex-col gap-8",children:v})})}function mr({Scroll:v=Le}){let{t:n,i18n:B}=p(),g=s(),N=r((t)=>t.archivedSessions),A=r((t)=>t.connection),[O,se]=f(""),[C,ie]=f("all"),[x,ne]=f("all"),[ae,re]=f(0),[G,K]=f(!0),[z,Q]=f(null),[_,R]=f(null),[I,j]=f(!1),S=ye(!1),[P,y]=f(null),[W,T]=f(null),[oe,J]=f(!1);Se(()=>{if(A!=="ready")return;let t=!1;K(!0),Q(null);async function h(){try{await g.listArchived({reset:!0});let o=new Set;while(!t&&g.state.archivedCursor!==null){let L=g.state.archivedCursor;if(o.has(L))throw Error("Archive pagination returned a repeated cursor");o.add(L),await g.listArchived()}}catch(o){if(!t)Q(H(o))}finally{if(!t)K(!1)}}return h(),()=>{t=!0}},[g,A,ae]);let c=r((t)=>t.projectContext),E=!(c!==null&&A==="ready"&&!G&&z===null)||I,k=(t)=>t.title??n("sessionList.untitled"),de=[...new Set(N.filter((t)=>c&&F(c,t).id!==D).map((t)=>c?F(c,t).id:t.cwd))].toSorted(),ue=O.trim().toLocaleLowerCase(B.language),M=N.filter((t)=>{let h=c?F(c,t).id:null,o=h===D;return k(t).toLocaleLowerCase(B.language).includes(ue)&&(C==="all"||(C==="quick"?o:!o))&&(x==="all"||(x==="quick"?o:h===x))}),me=new Intl.DateTimeFormat(B.language,{dateStyle:"medium",timeStyle:"short"});async function pe(t){if(S.current)return;S.current=!0,j(!0),R(null);try{await g.unarchive(t.sessionId)}catch(h){R(H(h))}finally{S.current=!1,j(!1)}}async function he(){if(S.current||!P)return;S.current=!0,j(!0),T(null);let t=[],h=[];try{for(let o of P){if(!g.state.archivedSessions.some((L)=>L.sessionId===o.sessionId))continue;try{await g.delete(o.sessionId)}catch(L){t.push(o),h.push(`${k(o)}: ${H(L)}`)}}if(t.length)y(t),T(h.join(`
2
+ `));else y(null)}finally{S.current=!1,j(!1)}}return a("section",{className:"flex min-h-0 flex-1 flex-col overflow-hidden","aria-label":n("sessionList.archives.title"),children:[a("div",{className:"mx-auto flex min-h-0 w-full max-w-5xl flex-1 flex-col gap-8 px-6 pt-8 pb-10 lg:pb-14",children:[a("header",{className:"flex min-h-9 shrink-0 flex-wrap items-center justify-between gap-3",children:[i("h1",{className:"text-2xl leading-9 font-semibold tracking-tight",children:n("sessionList.archives.title")}),a(e,{size:"sm",variant:"destructive",className:"h-[30px] text-sm font-normal",disabled:E||N.length===0,onClick:()=>{T(null),J(!0),y([...N])},children:[i(ee,{className:"size-4","aria-hidden":"true"}),n("sessionList.archives.deleteAll")]})]}),a("div",{className:"flex shrink-0 flex-wrap gap-3",children:[a("div",{className:"relative min-w-48 flex-1",children:[i(xe,{"aria-hidden":"true",className:"text-muted-foreground pointer-events-none absolute start-3 top-2.5 size-4"}),i(l,{"aria-label":n("sessionList.archives.search"),placeholder:n("sessionList.archives.search"),value:O,onChange:(t)=>se(t.target.value),className:"rounded-md ps-9"})]}),a(Nt,{value:C,onValueChange:(t)=>{if(t===null)throw Error("Archive chat type cannot be empty");ie(t)},children:[a(Rt,{"aria-label":n("sessionList.archives.chatType"),className:"w-40 rounded-md",children:[i(ge,{"aria-hidden":"true"}),i(Mt,{children:n(`sessionList.archives.${C==="all"?"allChats":C==="quick"?"quickChats":"projectChats"}`)})]}),a(te,{children:[i(Z,{value:"all",children:n("sessionList.archives.allChats")}),i(Z,{value:"quick",children:n("sessionList.archives.quickChats")}),i(Z,{value:"project",children:n("sessionList.archives.projectChats")})]})]}),a(Nt,{value:x,onValueChange:(t)=>{if(t===null)throw Error("Archive project filter cannot be empty");ne(t)},children:[a(Rt,{"aria-label":n("sessionList.archives.project"),className:"w-48 rounded-md",children:[i(Y,{"aria-hidden":"true"}),i(Mt,{className:"truncate",children:x==="all"?n("sessionList.archives.allProjects"):x==="quick"?n("sessionList.archives.noProject"):U(x,c??void 0)})]}),a(te,{children:[i(Z,{value:"all",children:n("sessionList.archives.allProjects")}),i(Z,{value:"quick",children:n("sessionList.archives.noProject")}),de.map((t)=>i(Z,{value:t,title:t,children:U(t,c??void 0)},t))]})]})]}),a(v,{children:[A!=="ready"?i("p",{role:"status",className:"text-muted-foreground",children:n("sessionList.archives.connecting")}):G?a("div",{role:"status",className:"text-muted-foreground flex items-center gap-2",children:[i(ce,{}),n("sessionList.archives.loading")]}):z?i(q,{variant:"destructive",children:a(V,{className:"flex items-center justify-between gap-4",children:[i("span",{children:z}),i(e,{variant:"outline",onClick:()=>re((t)=>t+1),children:n("sessionList.archives.retry")})]})}):N.length===0?a("div",{className:"text-muted-foreground flex flex-col items-center gap-3 py-16",children:[i(ve,{"aria-hidden":"true",className:"size-8"}),i("p",{children:n("sessionList.archives.empty")})]}):M.length===0?i("p",{className:"text-muted-foreground py-12 text-center",children:n("sessionList.archives.noResults")}):(c?le(M,c):[]).filter(([,t])=>t.length>0).map(([t,h])=>a("section",{className:"flex flex-col gap-3",children:[a("div",{className:"flex items-center justify-between gap-3",children:[a("h2",{className:"flex min-w-0 items-center gap-2 text-sm font-medium",title:t===D?void 0:t,children:[i(Y,{"aria-hidden":"true",className:"size-4 shrink-0"}),i("span",{className:"truncate",children:t===D?n("sessionList.archives.noProject"):U(t,c??void 0)})]}),i("span",{className:"text-muted-foreground shrink-0 text-sm",children:n("sessionList.archives.count",{count:h.length})})]}),i("div",{className:"divide-border divide-y overflow-hidden rounded-lg border",children:h.map((o)=>a("article",{"aria-label":k(o),className:"flex flex-wrap items-center gap-4 px-4 py-3",children:[a("div",{className:"min-w-0 flex-1 basis-40",children:[i("h3",{className:"truncate text-sm font-medium",title:k(o),children:k(o)}),o.updatedAt!==null&&i("time",{dateTime:o.updatedAt,title:n("sessionList.archives.updatedAt"),className:"text-muted-foreground text-xs",children:me.format(new Date(o.updatedAt))})]}),a("div",{className:"flex shrink-0 items-center gap-2",children:[i(e,{variant:"ghost",size:"icon-sm","aria-label":n("sessionList.delete"),title:n("sessionList.delete"),disabled:E,className:"text-muted-foreground hover:text-destructive",onClick:()=>{T(null),J(!1),y([o])},children:i(ee,{"aria-hidden":"true"})}),i(e,{variant:"secondary",size:"sm",disabled:E,onClick:()=>void pe(o),children:n("sessionList.archives.unarchive")})]})]},o.sessionId))})]},t)),_&&i(q,{variant:"destructive",children:i(V,{children:_})})]})]}),i(d,{open:P!==null,onOpenChange:(t)=>{if(!t&&!S.current)y(null)},children:a(u,{showCloseButton:!I,children:[a(b,{children:[i(m,{children:n("sessionList.archives.deleteTitle")}),i(w,{children:n(oe?"sessionList.archives.deleteAllDescription":"sessionList.archives.deleteDescription",{count:P?.length??0})})]}),W&&i(q,{variant:"destructive",children:i(V,{className:"max-h-40 overflow-auto whitespace-pre-wrap",children:W})}),a(X,{children:[i(e,{variant:"outline",disabled:I,onClick:()=>y(null),children:n("sessionList.cancel")}),a(e,{variant:"destructive",className:"text-sm font-normal",disabled:E,onClick:()=>void he(),children:[I&&i(ce,{}),n("sessionList.archives.confirmDelete")]})]})]})})]})}
3
+ export{mr};
@@ -1,2 +1,2 @@
1
- import{et,Y}from"./chunk-aprxk7c2.js";import{A}from"./chunk-zz734bzf.js";import{z}from"./chunk-hjnf5kvc.js";import{J}from"./chunk-m8djwdd5.js";import{Se,se,Ie}from"./chunk-7jdazbzv.js";import{PreviewCard as x}from"@base-ui/react/preview-card";import{cn as p}from"cn";import{LockIcon as I}from"lucide-react";import{createContext as S,useContext as k,useLayoutEffect as T,useState as R}from"react";import"@alwith/module-chat/session-list.css";import{jsx as e,jsxs as d,Fragment as E}from"react/jsx-runtime";function pn(o){if(o.as==="ul"){let{as:i,className:r,...a}=o;return e("ul",{className:p("flex w-full min-w-0 flex-col gap-0.5",r),...a})}let{as:t,className:n,...s}=o;return e("div",{className:p("flex w-full min-w-0 flex-col gap-0.5",n),...s})}function Te({className:o,...t}){return e("span",{"data-slot":"navigation-leading",className:p("flex size-6 shrink-0 items-center justify-center [&_.lucide]:size-3.5",o),...t})}function Xe({active:o,className:t,...n}){return e("button",{type:"button","data-active":o?"":void 0,"aria-current":o?"page":void 0,className:p("group/navigation-row focus-visible:outline-ring flex h-[30px] w-full items-center gap-1 overflow-hidden rounded-[10px] ps-1 pe-1.5 text-start text-sm outline-hidden [corner-shape:superellipse(1.5)] focus-visible:outline-2 focus-visible:outline-offset-[-2px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",t),...n})}function Pt({open:o,onOpenChange:t,tooltip:n,leading:s,label:i,count:r,countLabel:a,active:l=!1,actions:N,headerChildren:f,wrapHeader:u,onHeaderClick:w,children:C}){let b=()=>{w?.(),t(!o)},m=p(Se,"relative flex h-[30px] w-full items-center gap-1 rounded-[10px] ps-1 pe-1.5 text-start [corner-shape:superellipse(1.5)]"),h=d(E,{children:[s!=null&&e(Te,{children:s}),f??e(A,{className:"flex-1 text-sm opacity-70",children:i}),e("span",{className:"relative z-10 ms-auto",children:e(Ie,{content:r!==void 0?e(se,{className:p("text-muted-foreground justify-end text-xs opacity-70",a&&"w-auto"),children:e("span",{dir:"ltr",children:a??r})}):void 0,actions:N})})]}),P=f==null?d("div",{"data-active":l?"":void 0,title:n,className:p(m,Y),onClick:b,onKeyDown:(c)=>{if(c.target!==c.currentTarget)return;if(c.key!=="Enter"&&c.key!==" ")return;c.preventDefault(),b()},children:[e("button",{type:"button","aria-expanded":o,"aria-label":typeof i==="string"?i:n,className:"focus-visible:outline-ring absolute inset-0 rounded-[10px] outline-hidden [corner-shape:superellipse(1.5)] focus-visible:outline-2 focus-visible:outline-offset-[-2px]"}),h]}):e("div",{"data-active":l?"":void 0,className:m,children:h});return d("div",{className:"text-[#1a1c1f] dark:text-white",children:[u===void 0?P:u(P),o&&e(pn,{className:"mt-0.5",children:C})]})}var H=S(()=>{}),O=S(()=>{});function Ye(){return k(O)}function Ze(){return k(H)}function Je({active:o=!1,state:t,interruption:n=null,leased:s=!1,media:i,title:r,hoverCard:a,onHoverCardOpenChange:l,subtitle:N,preview:f,listeningPorts:u,onOpenPort:w,accessory:C,meta:b,hint:m,actions:h,className:P,...c}){let y=d("div",{"data-slot":"navigation-session-item","data-active":o,className:p(Se,et,"group/navigation-row focus-visible:outline-ring flex h-[30px] w-full items-center gap-1 overflow-hidden rounded-[10px] ps-1 pe-1.5 text-start text-sm outline-hidden [corner-shape:superellipse(1.5)] focus-visible:outline-2 focus-visible:outline-offset-[-2px]",(f||u!=null&&u.length>0)&&"h-auto min-h-[30px] py-2.5",P),...c,children:[e(Te,{children:t!=null?e(z,{state:t,title:n??void 0}):i}),d("span",{className:"flex min-w-0 flex-1 flex-col",children:[e(A,{className:p("leading-none",t==="done"&&"font-semibold"),children:r}),N!=null&&e(A,{className:"text-muted-foreground text-xs",children:N}),f&&e("span",{className:"text-muted-foreground mt-1.5 line-clamp-2 text-xs leading-[18px] [overflow-wrap:anywhere] break-words",children:f}),u!=null&&u.length>0&&e("span",{className:"text-muted-foreground mt-1.5 flex flex-wrap items-center gap-2 font-mono text-xs",children:u.map((v)=>w?d("button",{type:"button",className:"underline",onPointerDown:(g)=>g.stopPropagation(),onKeyDown:(g)=>g.stopPropagation(),onClick:(g)=>{g.stopPropagation(),w(v)},children:[":",v]},v):d("span",{children:[":",v]},v))})]}),d("span",{className:"relative ms-auto flex shrink-0 items-center gap-1",children:[s&&e(I,{className:"text-muted-foreground size-3"}),e(Ie,{content:C!=null?e(se,{children:C}):b??e(se,{}),actions:h}),m!=null&&e("span",{className:"pointer-events-none absolute end-1 top-1/2 flex h-5 min-w-5 -translate-y-1/2 items-center justify-center",children:m})]})]});if(a==null)return y;return e(L,{row:y,onOpenChange:l,children:a})}function L({row:o,children:t,onOpenChange:n}){let[s,i]=R(!1),[r,a]=R(!1),l=s||r;return T(()=>(n?.(l),()=>n?.(!1)),[l,n]),e(H.Provider,{value:a,children:e(O.Provider,{value:()=>{i(!1),a(!1)},children:e(_,{open:l,onOpenChange:i,trigger:o,children:t})})})}function _({open:o,onOpenChange:t,trigger:n,children:s,side:i="inline-end",sideOffset:r=2,align:a="start",alignOffset:l}){return J(o),d(x.Root,{open:o,onOpenChange:t,children:[e(x.Trigger,{render:n,delay:700,closeDelay:100}),e(x.Portal,{children:e(x.Positioner,{side:i,sideOffset:r,align:a,alignOffset:l,className:"isolate z-50",children:e(x.Popup,{"data-slot":"codex-hover-card",className:"bg-popover text-popover-foreground ring-foreground/10 m-px flex w-80 max-w-[calc(100vw-1rem)] flex-col overflow-hidden rounded-md text-sm shadow-md ring-1 outline-hidden select-none",children:e("div",{className:"flex w-full min-w-0 flex-col px-0 py-1 break-words whitespace-normal",children:s})})})})]})}
2
- export{pn,Te,Xe,Pt,Ye,Ze,Je};
1
+ import{et,Y}from"./chunk-aprxk7c2.js";import{L}from"./chunk-tjykfxrd.js";import{z}from"./chunk-fteek5h4.js";import{J}from"./chunk-ht28382s.js";import{Ie,se,Se}from"./chunk-q256c3hn.js";import{PreviewCard as x}from"@base-ui/react/preview-card";import{cn as p}from"cn";import{LockIcon as I}from"lucide-react";import{createContext as S,useContext as k,useLayoutEffect as T,useState as R}from"react";import"@alwith/module-chat/session-list.css";import{jsx as e,jsxs as d,Fragment as G}from"react/jsx-runtime";function fn(o){if(o.as==="ul"){let{as:i,className:r,...a}=o;return e("ul",{className:p("flex w-full min-w-0 flex-col gap-0.5",r),...a})}let{as:t,className:n,...s}=o;return e("div",{className:p("flex w-full min-w-0 flex-col gap-0.5",n),...s})}function Te({className:o,...t}){return e("span",{"data-slot":"navigation-leading",className:p("flex size-6 shrink-0 items-center justify-center [&_.lucide]:size-3.5",o),...t})}function Xe({active:o,className:t,...n}){return e("button",{type:"button","data-active":o?"":void 0,"aria-current":o?"page":void 0,className:p("group/navigation-row focus-visible:outline-ring flex h-[30px] w-full items-center gap-1 overflow-hidden rounded-[10px] ps-1 pe-1.5 text-start text-sm outline-hidden [corner-shape:superellipse(1.5)] focus-visible:outline-2 focus-visible:outline-offset-[-2px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",t),...n})}function Pt({open:o,onOpenChange:t,tooltip:n,leading:s,label:i,count:r,countLabel:a,active:l=!1,actions:N,headerChildren:f,wrapHeader:u,onHeaderClick:w,children:C}){let b=()=>{w?.(),t(!o)},m=p(Ie,"relative flex h-[30px] w-full items-center gap-1 rounded-[10px] ps-1 pe-1.5 text-start [corner-shape:superellipse(1.5)]"),h=d(G,{children:[s!=null&&e(Te,{children:s}),f??e(L,{className:"flex-1 text-sm opacity-70",children:i}),e("span",{className:"relative z-10 ms-auto",children:e(Se,{content:r!==void 0?e(se,{className:p("text-muted-foreground justify-end text-xs opacity-70",a&&"w-auto"),children:e("span",{dir:"ltr",children:a??r})}):void 0,actions:N})})]}),P=f==null?d("div",{"data-active":l?"":void 0,title:n,className:p(m,Y),onClick:b,onKeyDown:(c)=>{if(c.target!==c.currentTarget)return;if(c.key!=="Enter"&&c.key!==" ")return;c.preventDefault(),b()},children:[e("button",{type:"button","aria-expanded":o,"aria-label":typeof i==="string"?i:n,className:"focus-visible:outline-ring absolute inset-0 rounded-[10px] outline-hidden [corner-shape:superellipse(1.5)] focus-visible:outline-2 focus-visible:outline-offset-[-2px]"}),h]}):e("div",{"data-active":l?"":void 0,className:m,children:h});return d("div",{className:"text-[#1a1c1f] dark:text-white",children:[u===void 0?P:u(P),o&&e(fn,{className:"mt-0.5",children:C})]})}var H=S(()=>{}),O=S(()=>{});function Ye(){return k(O)}function Ze(){return k(H)}function Je({active:o=!1,state:t,interruption:n=null,leased:s=!1,media:i,title:r,hoverCard:a,onHoverCardOpenChange:l,subtitle:N,preview:f,listeningPorts:u,onOpenPort:w,accessory:C,meta:b,hint:m,actions:h,className:P,...c}){let y=d("div",{"data-slot":"navigation-session-item","data-active":o,className:p(Ie,et,"group/navigation-row focus-visible:outline-ring flex h-[30px] w-full items-center gap-1 overflow-hidden rounded-[10px] ps-1 pe-1.5 text-start text-sm outline-hidden [corner-shape:superellipse(1.5)] focus-visible:outline-2 focus-visible:outline-offset-[-2px]",(f||u!=null&&u.length>0)&&"h-auto min-h-[30px] py-2.5",P),...c,children:[e(Te,{children:t!=null?e(z,{state:t,title:n??void 0}):i}),d("span",{className:"flex min-w-0 flex-1 flex-col",children:[e(L,{className:p("leading-none",t==="done"&&"font-semibold"),children:r}),N!=null&&e(L,{className:"text-muted-foreground text-xs",children:N}),f&&e("span",{className:"text-muted-foreground mt-1.5 line-clamp-2 text-xs leading-[18px] [overflow-wrap:anywhere] break-words",children:f}),u!=null&&u.length>0&&e("span",{className:"text-muted-foreground mt-1.5 flex flex-wrap items-center gap-2 font-mono text-xs",children:u.map((v)=>w?d("button",{type:"button",className:"underline",onPointerDown:(g)=>g.stopPropagation(),onKeyDown:(g)=>g.stopPropagation(),onClick:(g)=>{g.stopPropagation(),w(v)},children:[":",v]},v):d("span",{children:[":",v]},v))})]}),d("span",{className:"relative ms-auto flex shrink-0 items-center gap-1",children:[s&&e(I,{className:"text-muted-foreground size-3"}),e(Se,{content:C!=null?e(se,{children:C}):b??e(se,{}),actions:h}),m!=null&&e("span",{className:"pointer-events-none absolute end-1 top-1/2 flex h-5 min-w-5 -translate-y-1/2 items-center justify-center",children:m})]})]});if(a==null)return y;return e(_,{row:y,onOpenChange:l,children:a})}function _({row:o,children:t,onOpenChange:n}){let[s,i]=R(!1),[r,a]=R(!1),l=s||r;return T(()=>(n?.(l),()=>n?.(!1)),[l,n]),e(H.Provider,{value:a,children:e(O.Provider,{value:()=>{i(!1),a(!1)},children:e(E,{open:l,onOpenChange:i,trigger:o,children:t})})})}function E({open:o,onOpenChange:t,trigger:n,children:s,side:i="inline-end",sideOffset:r=2,align:a="start",alignOffset:l}){return J(o),d(x.Root,{open:o,onOpenChange:t,children:[e(x.Trigger,{render:n,delay:700,closeDelay:100}),e(x.Portal,{children:e(x.Positioner,{side:i,sideOffset:r,align:a,alignOffset:l,className:"isolate z-50",children:e(x.Popup,{"data-slot":"codex-hover-card",className:"bg-popover text-popover-foreground ring-foreground/10 m-px flex w-80 max-w-[calc(100vw-1rem)] flex-col overflow-hidden rounded-md text-sm shadow-md ring-1 outline-hidden select-none",children:e("div",{className:"flex w-full min-w-0 flex-col px-0 py-1 break-words whitespace-normal",children:s})})})})]})}
2
+ export{fn,Te,Xe,Pt,Ye,Ze,Je};
@@ -1,2 +1,2 @@
1
- import{g,Kt,wo,Qt,ko,Xt,Co}from"./chunk-5kpcpjrb.js";import{t,ie,ke,o}from"./chunk-dp8pjv6r.js";import{ee}from"./chunk-jhk2chpp.js";import{createStore as E}from"@alwith/api/client";import{isText as k,nativeTurnId as v}from"@nyssance/codex-acp-v2/client";import{jsx as m}from"react/jsx-runtime";var x=E({entries:{}});function p(i,e){x.setState((n)=>({entries:{...n.entries,[i]:e}}))}function q(i,e){let n=v(e),a=i.items.findLast((s)=>v(s)!==null);return!e.replayed&&n!==null&&a!==void 0&&v(a)===n}function M(i,e){for(let n of i.items){if(n.kind!=="user"||n.echo==="pending")continue;for(let a of[...Xt(n._meta),...n.content.filter(k).flatMap((s)=>Xt(s._meta))])if(a.questionItemId===e)return a.answer}return}function O({sessionId:i,item:e,question:n,index:a}){let s=ie(),{t:l}=t(),S=Kt(e.id,a),d=JSON.stringify([i,S]),u=ke(x,(r)=>r.entries[d]),c=o((r)=>r.sessions[i]),A=o((r)=>r.connection==="ready"),f=u?.draft??wo(n),b=c===void 0?u?.accepted:M(c,S)??u?.accepted,h=c!==void 0&&q(c,e),D=A&&c?.attached&&!c.restoring&&!c.readOnly,y=b!==void 0?"answered":u?.skipped?"skipped":u?.pending?"submitting":!h?"closed":!D?"unavailable":"pending",C=async()=>{if(x.getState().entries[d]?.pending||y!=="pending")return;let r=s.state.sessions[i];if(r===void 0||!q(r,e)||!r.attached||r.readOnly||r.restoring)return;let I=Qt(n,f);if(!I.trim())return;let w={questionItemId:S,question:n.title,answer:I};p(d,{draft:f,pending:!0});try{await s.prompt(i,[{type:"text",text:ko(w),_meta:{codex:{questionReply:w}}}]),p(d,{draft:f,accepted:I})}catch(Q){p(d,{draft:f,error:Q instanceof Error?Q.message:String(Q)})}};if(y==="closed")return null;return m(Co,{question:n,draft:f,status:y,answer:b,error:y==="pending"?u?.error:void 0,t:l,onChange:(r)=>p(d,{draft:r}),onSkip:()=>p(d,{draft:f,skipped:!0}),onSubmit:()=>{C()}})}function jt({sessionId:i,item:e}){let n=o((s)=>s.sessions[i]),a=g(e._meta);if(n===void 0||n.readOnly||!q(n,e))return m(ee,{content:e.content.some((s)=>!k(s)||s.text.trim().length>0)?e.content:a.map((s)=>({type:"text",text:s.title})),messageId:e.id,streaming:!1});return m("div",{className:"flex min-w-0 flex-col gap-3","data-async-questions":e.id,children:a.map((s,l)=>m(O,{sessionId:i,item:e,question:s,index:l},Kt(e.id,l)))})}
2
- export{jt};
1
+ import{g,Qt,ko,Xt,Co,Yt,To}from"./chunk-36t9x2qc.js";import{t,ie,ke,o}from"./chunk-f3e3ged2.js";import{ee}from"./chunk-zmpbfbnn.js";import{createStore as E}from"@alwith/api/client";import{isText as k,nativeTurnId as v}from"@nyssance/codex-acp-v2/client";import{jsx as m}from"react/jsx-runtime";var x=E({entries:{}});function p(i,e){x.setState((n)=>({entries:{...n.entries,[i]:e}}))}function q(i,e){let n=v(e),a=i.items.findLast((s)=>v(s)!==null);return!e.replayed&&n!==null&&a!==void 0&&v(a)===n}function M(i,e){for(let n of i.items){if(n.kind!=="user"||n.echo==="pending")continue;for(let a of[...Yt(n._meta),...n.content.filter(k).flatMap((s)=>Yt(s._meta))])if(a.questionItemId===e)return a.answer}return}function O({sessionId:i,item:e,question:n,index:a}){let s=ie(),{t:l}=t(),S=Qt(e.id,a),d=JSON.stringify([i,S]),u=ke(x,(r)=>r.entries[d]),c=o((r)=>r.sessions[i]),A=o((r)=>r.connection==="ready"),f=u?.draft??ko(n),b=c===void 0?u?.accepted:M(c,S)??u?.accepted,h=c!==void 0&&q(c,e),D=A&&c?.attached&&!c.restoring&&!c.readOnly,y=b!==void 0?"answered":u?.skipped?"skipped":u?.pending?"submitting":!h?"closed":!D?"unavailable":"pending",C=async()=>{if(x.getState().entries[d]?.pending||y!=="pending")return;let r=s.state.sessions[i];if(r===void 0||!q(r,e)||!r.attached||r.readOnly||r.restoring)return;let I=Xt(n,f);if(!I.trim())return;let w={questionItemId:S,question:n.title,answer:I};p(d,{draft:f,pending:!0});try{await s.prompt(i,[{type:"text",text:Co(w),_meta:{codex:{questionReply:w}}}]),p(d,{draft:f,accepted:I})}catch(Q){p(d,{draft:f,error:Q instanceof Error?Q.message:String(Q)})}};if(y==="closed")return null;return m(To,{question:n,draft:f,status:y,answer:b,error:y==="pending"?u?.error:void 0,t:l,onChange:(r)=>p(d,{draft:r}),onSkip:()=>p(d,{draft:f,skipped:!0}),onSubmit:()=>{C()}})}function Kt({sessionId:i,item:e}){let n=o((s)=>s.sessions[i]),a=g(e._meta);if(n===void 0||n.readOnly||!q(n,e))return m(ee,{content:e.content.some((s)=>!k(s)||s.text.trim().length>0)?e.content:a.map((s)=>({type:"text",text:s.title})),messageId:e.id,streaming:!1});return m("div",{className:"flex min-w-0 flex-col gap-3","data-async-questions":e.id,children:a.map((s,l)=>m(O,{sessionId:i,item:e,question:s,index:l},Qt(e.id,l)))})}
2
+ export{Kt};
@@ -1,2 +1,2 @@
1
- import{sr}from"./chunk-ryz4c13z.js";import{createContext as s,useContext as l,useSyncExternalStore as m}from"react";import{jsx as r}from"react/jsx-runtime";var c=s(null),u=s(null);function re({host:e,client:n,children:i}){return r(sr,{host:e,children:r(c,{value:e,children:r(u,{value:n,children:i})})})}function t(){let e=l(c);if(e===null)throw Error("Timeline host is missing");return e}function ie(){let e=l(u);if(e===null)throw Error("Timeline client is missing");return e}function ke(e,n){return m((i)=>e.subscribe(i),()=>n(e.getState()),()=>n(e.getState()))}function o(e){let n=ie();return ke(n.store,e)}function Ve(e,n){if(e.reportError)e.reportError(n);else console.error(n)}
1
+ import{lr}from"./chunk-y6r6tzfh.js";import{createContext as s,useContext as l,useSyncExternalStore as m}from"react";import{jsx as r}from"react/jsx-runtime";var c=s(null),u=s(null);function re({host:e,client:n,children:i}){return r(lr,{host:e,children:r(c,{value:e,children:r(u,{value:n,children:i})})})}function t(){let e=l(c);if(e===null)throw Error("Timeline host is missing");return e}function ie(){let e=l(u);if(e===null)throw Error("Timeline client is missing");return e}function ke(e,n){return m((i)=>e.subscribe(i),()=>n(e.getState()),()=>n(e.getState()))}function o(e){let n=ie();return ke(n.store,e)}function Ve(e,n){if(e.reportError)e.reportError(n);else console.error(n)}
2
2
  export{re,t,ie,ke,o,Ve};
@@ -0,0 +1,2 @@
1
+ import{groupSessions as le,projectName as U,isQuickChatDirectory as pr,QUICK_CHATS_GROUP as D}from"@nyssance/codex-acp-v2/client";
2
+ export{le,U,pr,D};
@@ -1,2 +1,2 @@
1
- import{v}from"./chunk-ryz4c13z.js";import{W}from"./chunk-w8qmh6he.js";import{isPlanItems as n,isPlanMarkdown as r}from"@nyssance/codex-acp-v2/client";import{jsx as e}from"react/jsx-runtime";function So({plan:t}){if(r(t))return e("div",{className:"codex-reasoning-details",children:e(v,{text:t.content,streaming:!1})});if(!n(t))return null;return e(W,{entries:t.entries})}
1
+ import{v}from"./chunk-y6r6tzfh.js";import{G}from"./chunk-w45d5th9.js";import{isPlanItems as n,isPlanMarkdown as r}from"@nyssance/codex-acp-v2/client";import{jsx as e}from"react/jsx-runtime";function So({plan:t}){if(r(t))return e("div",{className:"codex-reasoning-details",children:e(v,{text:t.content,streaming:!1})});if(!n(t))return null;return e(G,{entries:t.entries})}
2
2
  export{So};
@@ -1,2 +1,2 @@
1
- var i=new Map,a=new Map,f=new Map;function ir(t,r){if(a.has(t))throw Error("An attachment writer is already registered for this session");return a.set(t,r),()=>{if(a.get(t)===r)a.delete(t)}}function E(t,r){let n=i.get(t);if(!n)return;let e=r(n.attachments);i.set(t,{...n,attachments:e}),a.get(t)?.(e)}function vt(t,r){f.set(t,r),r.finally(()=>{if(f.get(t)===r)f.delete(t)})}async function kr(t){for(;;){let e=i.get(t)?.attachments.flatMap((c)=>{let m=f.get(c.id);return m?[m]:[]})??[];if(!e.length)break;await Promise.all(e)}let r=i.get(t);if(!r)return null;let n=await Promise.all(r.attachments.map(async(e)=>{if(!e.url.startsWith("blob:"))return e;let c=await fetch(e.url);if(!c.ok)throw Error("Cannot read draft image");let m=await c.blob(),l=await new Promise((g,p)=>{let o=new FileReader;o.onload=()=>g(o.result),o.onerror=()=>p(o.error),o.readAsDataURL(m)});return{...e,url:l}}));return{text:r.text,mentions:[...r.mentions],attachments:n,modelId:r.modelId}}function Cr(t,r){if(r===null)i.delete(t);else i.set(t,r)}var s=new Map;function xt(t,r){if(s.has(t))throw Error("A composer is already registered for this session");return s.set(t,r),()=>{if(s.get(t)===r)s.delete(t)}}function Tr(t,r){if(typeof r!=="string"||!r.trim())throw Error("The draft is empty");let n=s.get(t);if(!n)throw Error("The session's composer is not open; open the session first");let e=i.get(t);if(e&&(e.text.length||e.attachments.length||e.mentions.length))throw Error("The composer already has a draft; send or clear it first");n(r),i.set(t,{text:r,attachments:[],mentions:[],modelId:e?.modelId??null})}
2
- export{i,ir,E,vt,kr,Cr,xt,Tr};
1
+ var i=new Map,a=new Map,f=new Map;function ar(t,r){if(a.has(t))throw Error("An attachment writer is already registered for this session");return a.set(t,r),()=>{if(a.get(t)===r)a.delete(t)}}function A(t,r){let n=i.get(t);if(!n)return;let e=r(n.attachments);i.set(t,{...n,attachments:e}),a.get(t)?.(e)}function vt(t,r){f.set(t,r),r.finally(()=>{if(f.get(t)===r)f.delete(t)})}async function Cr(t){for(;;){let e=i.get(t)?.attachments.flatMap((c)=>{let m=f.get(c.id);return m?[m]:[]})??[];if(!e.length)break;await Promise.all(e)}let r=i.get(t);if(!r)return null;let n=await Promise.all(r.attachments.map(async(e)=>{if(!e.url.startsWith("blob:"))return e;let c=await fetch(e.url);if(!c.ok)throw Error("Cannot read draft image");let m=await c.blob(),l=await new Promise((g,p)=>{let o=new FileReader;o.onload=()=>g(o.result),o.onerror=()=>p(o.error),o.readAsDataURL(m)});return{...e,url:l}}));return{text:r.text,mentions:[...r.mentions],attachments:n,modelId:r.modelId}}function Tr(t,r){if(r===null)i.delete(t);else i.set(t,r)}var s=new Map;function xt(t,r){if(s.has(t))throw Error("A composer is already registered for this session");return s.set(t,r),()=>{if(s.get(t)===r)s.delete(t)}}function Ir(t,r){if(typeof r!=="string"||!r.trim())throw Error("The draft is empty");let n=s.get(t);if(!n)throw Error("The session's composer is not open; open the session first");let e=i.get(t);if(e&&(e.text.length||e.attachments.length||e.mentions.length))throw Error("The composer already has a draft; send or clear it first");n(r),i.set(t,{text:r,attachments:[],mentions:[],modelId:e?.modelId??null})}
2
+ export{i,ar,A,vt,Cr,Tr,xt,Ir};
@@ -1,2 +1,2 @@
1
- var t=new Map;var a=0;function Ot(e,n){let r=n?void 0:t.get(e);if(r===void 0)return null;return t.delete(e),t.set(e,r),{...r,tokens:structuredClone(r.tokens)}}function c(e){if(e.isStreaming||e.text.length>1048576)return;if(t.delete(e.text))a-=e.text.length;t.set(e.text,{...e,tokens:structuredClone(e.tokens)}),a+=e.text.length;while(a>2097152||t.size>200){let n=t.keys().next().value;a-=n.length,t.delete(n)}}class l{worker=new Worker(new URL("@alwith/module-chat/markdown-parser.worker",import.meta.url),{type:"module"});clients=new Map;pending=new Map;active=null;failure=null;nextClientId=0;constructor(){this.worker.onmessage=(e)=>{let n=e.data,r=this.active;if(n.clientId!==r?.clientId||n.revision!==r.revision){this.fail(Error("Markdown worker returned an unexpected request"));return}if(this.active=null,!n.ok){this.fail(Error(n.error));return}let i={...r.input,tokens:n.tokens};c(i);let s=this.clients.get(r.clientId),o=this.pending.get(r.clientId),u=o!==void 0&&r.input.isStreaming&&o.input.isStreaming&&o.input.text.startsWith(r.input.text);if(s!==void 0&&(s.revision===r.revision||u))s.onResult(i);this.dispatch()},this.worker.onerror=(e)=>this.fail(Error(e.message)),this.worker.onmessageerror=()=>this.fail(Error("Cannot deserialize Markdown parsing result"))}fail(e){this.failure=e,this.worker.terminate(),this.pending.clear(),this.active=null;for(let n of this.clients.values())n.onError(e)}send(e){try{this.worker.postMessage(e)}catch(n){this.fail(n instanceof Error?n:Error(String(n)))}}dispatch(){if(this.active!==null||this.pending.size===0)return;let e=this.pending.values().next().value;this.pending.delete(e.clientId),this.active=e,this.send({type:"parse",clientId:e.clientId,revision:e.revision,source:e.input.source})}connect(e,n){if(this.failure!==null)throw this.failure;let r=++this.nextClientId,i={revision:0,onResult:e,onError:n};return this.clients.set(r,i),{update:(s)=>{if(this.failure!==null)throw this.failure;i.revision+=1;let o=Ot(s.text,s.isStreaming);if(o!==null){this.pending.delete(r),i.onResult(o);return}this.pending.set(r,{clientId:r,revision:i.revision,input:s}),this.dispatch()},dispose:()=>{if(!this.clients.delete(r))return;if(this.pending.delete(r),this.clients.size===0)this.worker.terminate(),d=void 0;else if(this.failure===null)this.send({type:"dispose",clientId:r})}}}}var d;function to(e,n){return d??=new l,d.connect(e,n)}
2
- export{Ot,to};
1
+ var t=new Map;var a=0;function Ot(e,n){let r=n?void 0:t.get(e);if(r===void 0)return null;return t.delete(e),t.set(e,r),{...r,tokens:structuredClone(r.tokens)}}function c(e){if(e.isStreaming||e.text.length>1048576)return;if(t.delete(e.text))a-=e.text.length;t.set(e.text,{...e,tokens:structuredClone(e.tokens)}),a+=e.text.length;while(a>2097152||t.size>200){let n=t.keys().next().value;a-=n.length,t.delete(n)}}class l{worker=new Worker(new URL("@alwith/module-chat/markdown-parser.worker",import.meta.url),{type:"module"});clients=new Map;pending=new Map;active=null;failure=null;nextClientId=0;constructor(){this.worker.onmessage=(e)=>{let n=e.data,r=this.active;if(n.clientId!==r?.clientId||n.revision!==r.revision){this.fail(Error("Markdown worker returned an unexpected request"));return}if(this.active=null,!n.ok){this.fail(Error(n.error));return}let i={...r.input,tokens:n.tokens};c(i);let s=this.clients.get(r.clientId),o=this.pending.get(r.clientId),u=o!==void 0&&r.input.isStreaming&&o.input.isStreaming&&o.input.text.startsWith(r.input.text);if(s!==void 0&&(s.revision===r.revision||u))s.onResult(i);this.dispatch()},this.worker.onerror=(e)=>this.fail(Error(e.message)),this.worker.onmessageerror=()=>this.fail(Error("Cannot deserialize Markdown parsing result"))}fail(e){this.failure=e,this.worker.terminate(),this.pending.clear(),this.active=null;for(let n of this.clients.values())n.onError(e)}send(e){try{this.worker.postMessage(e)}catch(n){this.fail(n instanceof Error?n:Error(String(n)))}}dispatch(){if(this.active!==null||this.pending.size===0)return;let e=this.pending.values().next().value;this.pending.delete(e.clientId),this.active=e,this.send({type:"parse",clientId:e.clientId,revision:e.revision,source:e.input.source})}connect(e,n){if(this.failure!==null)throw this.failure;let r=++this.nextClientId,i={revision:0,onResult:e,onError:n};return this.clients.set(r,i),{update:(s)=>{if(this.failure!==null)throw this.failure;i.revision+=1;let o=Ot(s.text,s.isStreaming);if(o!==null){this.pending.delete(r),i.onResult(o);return}this.pending.set(r,{clientId:r,revision:i.revision,input:s}),this.dispatch()},dispose:()=>{if(!this.clients.delete(r))return;if(this.pending.delete(r),this.clients.size===0)this.worker.terminate(),d=void 0;else if(this.failure===null)this.send({type:"dispose",clientId:r})}}}}var d;function oo(e,n){return d??=new l,d.connect(e,n)}
2
+ export{Ot,oo};
@@ -1,2 +1,2 @@
1
- import{Ping as l}from"ldrs/react";import"ldrs/react/Ping.css";import{cn as i}from"cn";import{jsx as e,jsxs as u}from"react/jsx-runtime";var gn={requires_action:"bg-red-500",running:"bg-yellow-500",done:"bg-blue-500",idle:"bg-green-500"},fn={requires_action:"text-red-500",running:"text-yellow-500",done:"text-blue-500",idle:"text-green-500"};function z({state:n,className:t,pulse:s=!0,title:r}){if(n===void 0)return null;let o=gn[n];if(n==="running"&&s)return u("span",{title:r,className:i("relative inline-flex size-1.5 shrink-0 items-center justify-center",fn.running,t),children:[e("span",{className:"absolute inset-0 flex items-center justify-center",children:e(l,{size:"26",speed:"2",color:"currentColor"})}),e("span",{className:"relative size-1.5 rounded-full bg-current"})]});return e("span",{title:r,className:i("size-2 shrink-0 rounded-full",o,t)})}
2
- export{gn,fn,z};
1
+ import{Ping as l}from"ldrs/react";import"ldrs/react/Ping.css";import{cn as i}from"cn";import{jsx as e,jsxs as u}from"react/jsx-runtime";var hn={requires_action:"bg-red-500",running:"bg-yellow-500",done:"bg-blue-500",idle:"bg-green-500"},vn={requires_action:"text-red-500",running:"text-yellow-500",done:"text-blue-500",idle:"text-green-500"};function z({state:n,className:t,pulse:s=!0,title:r}){if(n===void 0)return null;let o=hn[n];if(n==="running"&&s)return u("span",{title:r,className:i("relative inline-flex size-1.5 shrink-0 items-center justify-center",vn.running,t),children:[e("span",{className:"absolute inset-0 flex items-center justify-center",children:e(l,{size:"26",speed:"2",color:"currentColor"})}),e("span",{className:"relative size-1.5 rounded-full bg-current"})]});return e("span",{title:r,className:i("size-2 shrink-0 rounded-full",o,t)})}
2
+ export{hn,vn,z};
@@ -1,2 +1,2 @@
1
- import{ze}from"./chunk-cpk3y6ad.js";import{K,Zo}from"./chunk-zbtas7pt.js";import{t}from"./chunk-dp8pjv6r.js";import{Go}from"./chunk-7a6t282a.js";import{ye,be,we}from"./chunk-wb3zpzk3.js";import{cn as d}from"cn";import{SquareIcon as b}from"lucide-react";import{jsx as o,jsxs as n,Fragment as h}from"react/jsx-runtime";var f=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform);function Vo({active:a,sending:r,ready:p,hasMentions:m=!1,onStop:c}){let{t:e}=t(),s=ze(),u=m||s.textInput.value.trim().length>0||s.attachments.files.length>0,l=!p||r||!u,i=a?e("composer.steer"):e("composer.send");return n(h,{children:[a&&o(K,{"aria-label":e("composer.stop"),title:e("composer.stop"),className:"border-border size-7 rounded-full border",onClick:c,children:o(b,{className:"size-3 fill-current"})}),o("div",{className:d(l&&"cursor-not-allowed"),children:n(ye,{children:[o(be,{render:o(Zo,{"aria-label":i,disabled:l,"aria-busy":r,status:r?"submitted":"ready"})}),n(we,{role:"tooltip",children:[o("span",{className:"min-w-0",children:i}),o(Go,{className:"shrink-0",children:f?"↩":"Enter"})]})]})})]})}
2
- export{Vo};
1
+ import{ze}from"./chunk-vcbv30ph.js";import{K,Jo}from"./chunk-gtqwgjjg.js";import{t}from"./chunk-f3e3ged2.js";import{Go}from"./chunk-cy6grsx0.js";import{ye,be,we}from"./chunk-hw99hhjf.js";import{cn as d}from"cn";import{SquareIcon as b}from"lucide-react";import{jsx as o,jsxs as n,Fragment as h}from"react/jsx-runtime";var f=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform);function Wo({active:a,sending:r,ready:p,hasMentions:m=!1,onStop:c}){let{t:e}=t(),s=ze(),u=m||s.textInput.value.trim().length>0||s.attachments.files.length>0,l=!p||r||!u,i=a?e("composer.steer"):e("composer.send");return n(h,{children:[a&&o(K,{"aria-label":e("composer.stop"),title:e("composer.stop"),className:"border-border size-7 rounded-full border",onClick:c,children:o(b,{className:"size-3 fill-current"})}),o("div",{className:d(l&&"cursor-not-allowed"),children:n(ye,{children:[o(be,{render:o(Jo,{"aria-label":i,disabled:l,"aria-busy":r,status:r?"submitted":"ready"})}),n(we,{role:"tooltip",children:[o("span",{className:"min-w-0",children:i}),o(Go,{className:"shrink-0",children:f?"↩":"Enter"})]})]})})]})}
2
+ export{Wo};
@@ -1,2 +1,2 @@
1
- import{i,E,vt}from"./chunk-20svvgj3.js";var qo=5000;function xe(t){return"pastedText"in t}function Ur(t){return`file://${encodeURI(t).replaceAll("#","%23").replaceAll("?","%3F")}`}function Fe(t,e,o){let n=(r,s)=>{for(let[a,x]of i){if(!x.attachments.some((p)=>p.id===e.id))continue;E(a,(p)=>p.map((d)=>d.id===e.id?{...e,url:s===void 0?"":Ur(s),pastedText:{text:e.pastedText.text,status:r}}:d))}};if(!i.get(t)?.attachments.some((r)=>r.id===e.id))return;n("pending"),vt(e.id,o("pasted-text.txt",e.pastedText.text).then((r)=>n("ready",r)).catch(()=>n("error")))}function ft(t,e,o,n){if(t.defaultPrevented||t.currentTarget.disabled)return;if([...t.clipboardData.items].some((a)=>a.kind==="file"&&a.type.startsWith("image/")))return;let r=t.clipboardData.getData("text/plain");if(r.length<qo)return;t.preventDefault(),t.stopPropagation();let s={id:crypto.randomUUID(),type:"file",mediaType:"text/plain",filename:o,url:"",pastedText:{text:r,status:"pending"}};E(e,(a)=>[...a,s]),Fe(e,s,n)}
2
- export{qo,xe,Ur,Fe,ft};
1
+ import{i,A,vt}from"./chunk-fnbs3dq1.js";var Vo=5000;function xe(t){return"pastedText"in t}function $r(t){return`file://${encodeURI(t).replaceAll("#","%23").replaceAll("?","%3F")}`}function Fe(t,e,o){let n=(r,s)=>{for(let[a,x]of i){if(!x.attachments.some((p)=>p.id===e.id))continue;A(a,(p)=>p.map((d)=>d.id===e.id?{...e,url:s===void 0?"":$r(s),pastedText:{text:e.pastedText.text,status:r}}:d))}};if(!i.get(t)?.attachments.some((r)=>r.id===e.id))return;n("pending"),vt(e.id,o("pasted-text.txt",e.pastedText.text).then((r)=>n("ready",r)).catch(()=>n("error")))}function ft(t,e,o,n){if(t.defaultPrevented||t.currentTarget.disabled)return;if([...t.clipboardData.items].some((a)=>a.kind==="file"&&a.type.startsWith("image/")))return;let r=t.clipboardData.getData("text/plain");if(r.length<Vo)return;t.preventDefault(),t.stopPropagation();let s={id:crypto.randomUUID(),type:"file",mediaType:"text/plain",filename:o,url:"",pastedText:{text:r,status:"pending"}};A(e,(a)=>[...a,s]),Fe(e,s,n)}
2
+ export{Vo,xe,$r,Fe,ft};
@@ -1,2 +1,2 @@
1
- import{createPortal as n}from"react-dom";import{jsx as t}from"react/jsx-runtime";function go({src:o,alt:e,onClose:i}){return n(t("button",{type:"button",className:"fixed inset-0 z-[1000] flex items-center justify-center",style:{backgroundColor:"rgba(0,0,0,0.7)"},onClick:i,children:t("img",{src:o,alt:e,style:{maxWidth:"90vw",maxHeight:"90vh",objectFit:"contain",borderRadius:4}})}),document.body)}
2
- export{go};
1
+ import{createPortal as n}from"react-dom";import{jsx as t}from"react/jsx-runtime";function fo({src:o,alt:e,onClose:i}){return n(t("button",{type:"button",className:"fixed inset-0 z-[1000] flex items-center justify-center",style:{backgroundColor:"rgba(0,0,0,0.7)"},onClick:i,children:t("img",{src:o,alt:e,style:{maxWidth:"90vw",maxHeight:"90vh",objectFit:"contain",borderRadius:4}})}),document.body)}
2
+ export{fo};