@alwith/module-chat 0.5.1 → 0.5.2

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 (209) hide show
  1. package/README.md +23 -10
  2. package/dist/activity-host.d.ts +1 -0
  3. package/dist/activity-host.js +1 -1
  4. package/dist/approval/choice-elicitation-form.js +1 -1
  5. package/dist/approval/choice-schema.js +1 -1
  6. package/dist/approval/permission-options.js +1 -1
  7. package/dist/approval/permission-view.js +1 -1
  8. package/dist/approval/schema-elicitation-form.js +1 -1
  9. package/dist/approval/url-elicitation-card.js +1 -1
  10. package/dist/chunk-15nwm04a.js +2 -0
  11. package/dist/chunk-16y5rmm5.js +2 -0
  12. package/dist/chunk-1d4c9j8w.js +2 -0
  13. package/dist/chunk-20zcgxa5.js +4 -0
  14. package/dist/chunk-2epnn4sq.js +1 -0
  15. package/dist/chunk-2f19pcpn.js +2 -0
  16. package/dist/chunk-3vt71emt.js +2 -0
  17. package/dist/{chunk-6ynartgd.js → chunk-42zr8zpv.js} +2 -2
  18. package/dist/{chunk-7ex6r8ja.js → chunk-4svwa5p8.js} +3 -3
  19. package/dist/chunk-4tkxmh52.js +2 -0
  20. package/dist/chunk-5grywgpq.js +4 -0
  21. package/dist/chunk-5h13saah.js +2 -0
  22. package/dist/chunk-5j3wnans.js +2 -0
  23. package/dist/{chunk-wnq8g0kp.js → chunk-6p5hgnpq.js} +1 -1
  24. package/dist/{chunk-2sgxwycp.js → chunk-6qa5dt1k.js} +1 -1
  25. package/dist/{chunk-6q8b8aww.js → chunk-6qn5srgg.js} +1 -1
  26. package/dist/{chunk-8md0gr7j.js → chunk-6vky4fcv.js} +2 -2
  27. package/dist/chunk-7kcdf82d.js +2 -0
  28. package/dist/{chunk-wmsdg5fb.js → chunk-7q7c0mds.js} +1 -1
  29. package/dist/{chunk-vk39871j.js → chunk-801v0awm.js} +1 -1
  30. package/dist/{chunk-fmxt5ysw.js → chunk-8e7xf2tb.js} +1 -1
  31. package/dist/chunk-8k7wzkna.js +2 -0
  32. package/dist/chunk-8vvn71rf.js +2 -0
  33. package/dist/{chunk-3z0y9amd.js → chunk-9ab18v07.js} +2 -2
  34. package/dist/{chunk-r125b0z5.js → chunk-9dsa5vm7.js} +2 -2
  35. package/dist/chunk-9pdj44jr.js +2 -0
  36. package/dist/{chunk-s2n85pks.js → chunk-9s1cgt7s.js} +1 -1
  37. package/dist/chunk-aqj0v5a9.js +7 -0
  38. package/dist/chunk-azmqtycn.js +2 -0
  39. package/dist/{chunk-3t2c4zky.js → chunk-b5mkvr4d.js} +2 -2
  40. package/dist/chunk-bfe7xk9m.js +3 -0
  41. package/dist/{chunk-ahcmeqvb.js → chunk-bkbemt8g.js} +2 -2
  42. package/dist/{chunk-d0ptk8x8.js → chunk-c4621n0b.js} +1 -1
  43. package/dist/{chunk-9f42d428.js → chunk-cw9tg2sz.js} +1 -1
  44. package/dist/{chunk-dp4g5y18.js → chunk-d675nr2b.js} +2 -2
  45. package/dist/{chunk-2v9kbth7.js → chunk-d8gwsw6j.js} +3 -3
  46. package/dist/{chunk-38skakaz.js → chunk-dgp9q950.js} +1 -1
  47. package/dist/{chunk-kk9q6wtq.js → chunk-dm31xvh3.js} +2 -2
  48. package/dist/chunk-dr6z453e.js +2 -0
  49. package/dist/{chunk-1vxrdkew.js → chunk-ea7zsd2s.js} +2 -2
  50. package/dist/chunk-fgsd4fsd.js +2 -0
  51. package/dist/chunk-fvnb8ds4.js +2 -0
  52. package/dist/{chunk-tcqf45rf.js → chunk-h0dq9ztv.js} +2 -2
  53. package/dist/{chunk-gnthx1zg.js → chunk-h38yw8y3.js} +1 -1
  54. package/dist/chunk-h6df4xfd.js +2 -0
  55. package/dist/chunk-h87xp1gv.js +2 -0
  56. package/dist/{chunk-bwzjm3g8.js → chunk-hx6wfscz.js} +1 -1
  57. package/dist/chunk-j2mcvb68.js +7 -0
  58. package/dist/chunk-jeyvacx6.js +5 -0
  59. package/dist/chunk-jh8jske0.js +2 -0
  60. package/dist/chunk-jn2pj92h.js +2 -0
  61. package/dist/{chunk-dj8v2w6n.js → chunk-jrrvpnf3.js} +1 -1
  62. package/dist/chunk-jsb0zged.js +2 -0
  63. package/dist/chunk-k2y4cpra.js +2 -0
  64. package/dist/{chunk-nfd274y3.js → chunk-k7zzrns3.js} +1 -1
  65. package/dist/chunk-m2myfd89.js +2 -0
  66. package/dist/chunk-m2wxz0sj.js +2 -0
  67. package/dist/chunk-nxarfyj2.js +2 -0
  68. package/dist/chunk-p1pd1twf.js +2 -0
  69. package/dist/chunk-p6558tbk.js +2 -0
  70. package/dist/{chunk-fk5nvz2s.js → chunk-phe3an96.js} +2 -2
  71. package/dist/{chunk-en6qem8e.js → chunk-q7e2bdav.js} +2 -2
  72. package/dist/chunk-qh5fhcrh.js +3 -0
  73. package/dist/{chunk-3abwky4a.js → chunk-sky795ex.js} +1 -1
  74. package/dist/chunk-t3vgbc9s.js +2 -0
  75. package/dist/{chunk-g13txkf0.js → chunk-t5nstx0k.js} +2 -2
  76. package/dist/chunk-trgq8rq1.js +2 -0
  77. package/dist/{chunk-h96s3j1e.js → chunk-v0zn87k5.js} +2 -2
  78. package/dist/chunk-v72t4sf9.js +2 -0
  79. package/dist/chunk-vhat5rbz.js +2 -0
  80. package/dist/chunk-vw2hv2sq.js +2 -0
  81. package/dist/{chunk-jaf9msp7.js → chunk-w3yddw6n.js} +2 -2
  82. package/dist/chunk-x9pramem.js +2 -0
  83. package/dist/chunk-xjen1yt6.js +2 -0
  84. package/dist/chunk-ypvjzkfb.js +2 -0
  85. package/dist/codex/activity-group.js +1 -1
  86. package/dist/codex/assistant-message.js +1 -2
  87. package/dist/codex/async-question-card.js +1 -3
  88. package/dist/codex/disclosure-state.js +1 -1
  89. package/dist/codex/edited-files-card.js +1 -1
  90. package/dist/codex/image-view-activity.js +1 -1
  91. package/dist/codex/markdown-renderer.js +1 -6
  92. package/dist/codex/navigation-audio.js +1 -1
  93. package/dist/codex/navigation-preview.js +1 -1
  94. package/dist/codex/navigation-rail.js +1 -1
  95. package/dist/codex/plan.js +1 -1
  96. package/dist/codex/styles.css +176 -0
  97. package/dist/codex/timeline-virtualizer.js +1 -1
  98. package/dist/codex/user-message.js +1 -1
  99. package/dist/codex/virtualized-turn-list.js +1 -1
  100. package/dist/composer/completion-filter.js +1 -1
  101. package/dist/composer/completion-menu.js +2 -2
  102. package/dist/composer/completion-trigger.js +1 -1
  103. package/dist/composer/effort-slider.js +1 -1
  104. package/dist/composer/menu-radio.js +1 -1
  105. package/dist/composer/model-select.js +1 -1
  106. package/dist/composer/permission-mode-select.js +1 -1
  107. package/dist/composer/prompt-input-attachments.js +1 -1
  108. package/dist/composer/prompt-input-clipboard.js +1 -1
  109. package/dist/composer/prompt-input-context.js +1 -1
  110. package/dist/composer/prompt-input-textarea.js +3 -3
  111. package/dist/composer/prompt-input.js +1 -1
  112. package/dist/image-lightbox.js +1 -1
  113. package/dist/image-preview-dialog.js +1 -1
  114. package/dist/lib/code-highlighter.js +1 -1
  115. package/dist/lib/fuzzy.js +1 -1
  116. package/dist/lib/group-blocks.js +1 -1
  117. package/dist/lib/image-encode.js +1 -1
  118. package/dist/lib/limits.js +1 -1
  119. package/dist/lib/markdown-parser.js +1 -1
  120. package/dist/lib/markdown-rules.js +1 -1
  121. package/dist/lib/model-name.js +1 -1
  122. package/dist/lib/pointer-centered-zoom.js +1 -1
  123. package/dist/lib/prepare-prompt-files.js +1 -1
  124. package/dist/lib/stream-style.js +1 -1
  125. package/dist/lib/streaming-markdown.js +1 -1
  126. package/dist/locales.d.ts +312 -0
  127. package/dist/locales.js +1 -1
  128. package/dist/search/chat-search.js +1 -1
  129. package/dist/search/dom-matches.js +1 -1
  130. package/dist/search/find-bar.js +1 -1
  131. package/dist/search/literal-matches.js +1 -1
  132. package/dist/session-timeline/activity-group.d.ts +7 -0
  133. package/dist/session-timeline/activity-group.js +1 -0
  134. package/dist/session-timeline/activity-projection.d.ts +3 -0
  135. package/dist/session-timeline/activity-projection.js +1 -0
  136. package/dist/session-timeline/assistant-content.d.ts +7 -0
  137. package/dist/session-timeline/assistant-content.js +1 -0
  138. package/dist/session-timeline/assistant-turn.d.ts +28 -0
  139. package/dist/session-timeline/assistant-turn.js +1 -0
  140. package/dist/session-timeline/async-questions.d.ts +5 -0
  141. package/dist/session-timeline/async-questions.js +1 -0
  142. package/dist/session-timeline/edited-files-card.d.ts +18 -0
  143. package/dist/session-timeline/edited-files-card.js +1 -0
  144. package/dist/session-timeline/history-timeline.d.ts +12 -0
  145. package/dist/session-timeline/history-timeline.js +1 -0
  146. package/dist/session-timeline/host.d.ts +14 -0
  147. package/dist/session-timeline/host.js +1 -0
  148. package/dist/session-timeline/navigation-rail.d.ts +10 -0
  149. package/dist/session-timeline/navigation-rail.js +1 -0
  150. package/dist/session-timeline/plan.d.ts +4 -0
  151. package/dist/session-timeline/plan.js +1 -0
  152. package/dist/session-timeline/question-reply.d.ts +8 -0
  153. package/dist/session-timeline/question-reply.js +1 -0
  154. package/dist/session-timeline/resource-content.d.ts +7 -0
  155. package/dist/session-timeline/resource-content.js +1 -0
  156. package/dist/session-timeline/session-timeline.d.ts +40 -0
  157. package/dist/session-timeline/session-timeline.js +1 -0
  158. package/dist/session-timeline/timeline-registry.d.ts +12 -0
  159. package/dist/session-timeline/timeline-registry.js +1 -0
  160. package/dist/session-timeline/turn-error.d.ts +14 -0
  161. package/dist/session-timeline/turn-error.js +1 -0
  162. package/dist/session-timeline/turn-retry.d.ts +2 -0
  163. package/dist/session-timeline/turn-retry.js +1 -0
  164. package/dist/session-timeline/turn-time.d.ts +5 -0
  165. package/dist/session-timeline/turn-time.js +1 -0
  166. package/dist/session-timeline/turns.d.ts +51 -0
  167. package/dist/session-timeline/turns.js +1 -0
  168. package/dist/session-timeline/types.d.ts +31 -0
  169. package/dist/session-timeline/types.js +0 -0
  170. package/dist/session-timeline/use-timeline-scroll.d.ts +12 -0
  171. package/dist/session-timeline/use-timeline-scroll.js +1 -0
  172. package/dist/session-timeline/user-message.d.ts +8 -0
  173. package/dist/session-timeline/user-message.js +1 -0
  174. package/dist/ui/badge.js +1 -1
  175. package/dist/ui/button.js +1 -1
  176. package/dist/ui/card.js +1 -1
  177. package/dist/ui/checkbox.js +1 -1
  178. package/dist/ui/dialog.js +1 -1
  179. package/dist/ui/dropdown-menu.js +1 -1
  180. package/dist/ui/field.js +1 -1
  181. package/dist/ui/hover-card.js +1 -1
  182. package/dist/ui/input-group-textarea.js +1 -1
  183. package/dist/ui/input-group.js +1 -1
  184. package/dist/ui/input.js +1 -1
  185. package/dist/ui/label.js +1 -1
  186. package/dist/ui/radio-group.js +1 -1
  187. package/dist/ui/separator.js +1 -1
  188. package/dist/ui/switch.js +1 -1
  189. package/dist/ui/textarea.js +1 -1
  190. package/dist/ui/tooltip.js +1 -1
  191. package/package.json +32 -4
  192. package/dist/chunk-35j3t609.js +0 -2
  193. package/dist/chunk-6mhdcz0h.js +0 -2
  194. package/dist/chunk-6pmsbx1j.js +0 -2
  195. package/dist/chunk-7ar540cc.js +0 -2
  196. package/dist/chunk-7xdvwjxh.js +0 -2
  197. package/dist/chunk-98g6kwj5.js +0 -2
  198. package/dist/chunk-bbw2zg1a.js +0 -2
  199. package/dist/chunk-c4ps9628.js +0 -2
  200. package/dist/chunk-c8dr4btd.js +0 -2
  201. package/dist/chunk-d4e74rv1.js +0 -2
  202. package/dist/chunk-fk1z4bmr.js +0 -2
  203. package/dist/chunk-j3my6gn8.js +0 -1
  204. package/dist/chunk-k0mayxgs.js +0 -2
  205. package/dist/chunk-k4w61adv.js +0 -2
  206. package/dist/chunk-p141s624.js +0 -2
  207. package/dist/chunk-rgy601b7.js +0 -2
  208. package/dist/chunk-sdv6vdhr.js +0 -7
  209. package/dist/chunk-sptvg9xh.js +0 -2
package/README.md CHANGED
@@ -18,24 +18,37 @@ component does not own a conversation store or create permission requests.
18
18
  | Composer, attachments, completion and selectors | Controlled draft, available commands/files/models/options, submission and error handling |
19
19
  | Approval and elicitation interaction | Original request identity, protocol response, replay and product-specific actions |
20
20
  | Virtual list, search UI and turn navigation | Session identity, viewport, source matches, reveal callback and navigation preferences |
21
+ | Session timeline: turn grouping, history placeholders, retry, follow and anchor scrolling | Client, host capabilities, product slots and the scrolling element |
21
22
 
22
23
  Application navigation, settings, login pages, update UI and general-purpose product controls are not part of this package. Runtime owns execution; `@alwith/api` owns protocol folding. Applications must not reconstruct run state from the chat presentation.
23
24
 
24
- Import @alwith/module-chat/markdown.css for Markdown styling and include the package source in Tailwind's @source scan. Local linked development requires React deduplication in the app bundler; React is a peer, never bundled into chat. Bun component tests alias linked React to the real consumer React exports without installing a global DOM.
25
+ Import @alwith/module-chat/markdown.css for Markdown styling and include the package source in Tailwind's @source scan. With Vite, exclude the package from dependency pre-bundling, because Markdown runs in Web Workers created with `new URL(…, import.meta.url)`, and pre-bundle the CommonJS shims its Base UI components import:
26
+
27
+ ```ts
28
+ optimizeDeps: {
29
+ exclude: ["@alwith/module-chat"],
30
+ include: ["use-sync-external-store/shim", "use-sync-external-store/shim/with-selector"]
31
+ }
32
+ ```
33
+
34
+ Local linked development requires React deduplication in the app bundler; React is a peer, never bundled into chat. Bun component tests alias linked React to the real consumer React exports without installing a global DOM.
25
35
 
26
36
  Run bun install at the workspace root, then bun check --no-script --cwd packages/chat and bun run test:chat. Consumer DOM tests live in both apps and cover the shared implementations through their real app adapters.
27
37
 
28
38
  ACP session folding stays in @alwith/api. This package owns chat presentation and interaction, not Agent processes or a second session database.
29
39
 
30
- `update-scheduler` exports the optional, framework-independent `ChatUpdateScheduler<Snapshot>`.
31
- The host folds every protocol update immediately, then calls `enqueue(sessionId, snapshot)`
32
- with the complete immutable snapshot. One 16ms window publishes the latest snapshot for each
33
- pending session in a single callback; incoming chunks never reset the deadline. Call `flush()`
34
- after enqueueing a lifecycle/configuration change or finishing history replay, `remove(sessionId)`
35
- when dropping a session, and `cancel()` on disconnect/disposal. The callback should publish the
36
- batch to the UI store once. This schedules store notifications, not protocol processing or
37
- Markdown parsing. It retains only pending snapshot references, has no React/DOM/ACP dependency,
38
- and does not change existing components or enable batching unless the host opts in.
40
+ `session-timeline` exports `SessionTimeline`, the whole conversation stream of one session: turns
41
+ grouped from the `@alwith/api` session, Codex activity, plans, edited files, async questions,
42
+ capacity retry, sparse native history and the navigation rail, in the virtual list, following the
43
+ stream until the user scrolls away. The application passes the session, a client (the
44
+ `@nyssance/codex-acp-v2/client` `CodexClient`, or anything with its store and history and retry
45
+ requests) and a `SessionTimelineHost`: the `ActivityHost` plus theme, and optionally file saving,
46
+ diff opening, file icons, tool relabelling and error reporting. Product content goes into slots:
47
+ `leading`, `afterTurn`, `answerActions`, `turnFooter`, `renderUserMessage` and `insert`. `navigation`
48
+ turns the rail on with the application's audio; `anchorNewTurn` anchors a new prompt at the top
49
+ instead of following the bottom; `Viewport` replaces the scrolling element. Key the component by
50
+ session. This entry needs `@nyssance/codex-acp-v2` installed; it is an optional peer for the rest. `turns` exports the grouping for search sources and diagnostics, and `timeline-registry`
51
+ lets search reveal a turn in the mounted timeline. `resource-content` renders a file, link or image the way the timeline does, for an application's `Markdown` inside it; outside the timeline, wrap it in `TimelineProvider`. The update scheduler moved to `@alwith/api/client`.
39
52
 
40
53
  `search` provides Desktop's complete find bar, DOM matching, highlights and navigation. The host supplies its viewport, labels and native-menu subscription; virtualized callers also supply source matches and an async turn-reveal callback. Key the component by session identity to discard the previous search on a session switch. Highlight ownership is per mounted search, and cancelled navigation cannot repaint after close. Source projection stays with the application's message model; the search component never reads a private store.
41
54
 
@@ -4,6 +4,7 @@ export type ChatTranslate = (key: string, values?: Record<string, unknown>) => s
4
4
  export interface ActivityImage {
5
5
  src: string;
6
6
  alt: string;
7
+ uri?: string;
7
8
  }
8
9
  export interface ActivityHost {
9
10
  t: ChatTranslate;
@@ -1 +1 @@
1
- import{It,t,u}from"./chunk-sptvg9xh.js";export{It as ActivityHostProvider,u as ActivityMarkdown,t as useActivityHost};
1
+ import{en,n,i}from"./chunk-azmqtycn.js";export{en as ActivityHostProvider,i as ActivityMarkdown,n as useActivityHost};
@@ -1 +1 @@
1
- import{Se}from"../chunk-6q8b8aww.js";import{e}from"../chunk-vk39871j.js";import{w}from"../chunk-dj8v2w6n.js";import{d}from"../chunk-wmsdg5fb.js";import{r}from"../chunk-bwzjm3g8.js";import{c,s}from"../chunk-nfd274y3.js";import{o}from"../chunk-d0ptk8x8.js";import{Ce,G,h,A}from"../chunk-k0mayxgs.js";import{autoUpdate as X}from"@floating-ui/dom";import{cn as z}from"cn";import{useCallback as L,useEffect as D,useLayoutEffect as j,useMemo as V,useRef as J,useState as q}from"react";import{createPortal as Y}from"react-dom";import{jsx as n,jsxs as p}from"react/jsx-runtime";var v="__other__";function me({current:m,total:B,anchorRef:T,t:b,onAccept:H,onDecline:M}){let k=V(()=>m?Ce(m.requestedSchema):[],[m]),[C,y]=q({}),Q=J(null);D(()=>{if(m?.elicitationId===void 0)return;let t={};for(let{key:u,property:a}of k)if(!h(a)){let g=A(a)[0];if(g)t[u]={selected:g.value}}y(t)},[m?.elicitationId,k]),D(()=>{if(m?.elicitationId!==void 0&&Q.current&&document.activeElement?.tagName!=="INPUT"&&document.activeElement?.tagName!=="TEXTAREA")Q.current.focus()},[m?.elicitationId]);let[U,O]=q(null),[R,W]=q(null),P=L(()=>{let t=T.current;if(!t)return;let u=t.getBoundingClientRect();if(u.width===0){let a=Math.min(640,window.innerWidth*0.9);O({left:(window.innerWidth-a)/2,width:a,bottom:24});return}O({left:u.left,width:u.width,bottom:window.innerHeight-u.bottom+20})},[T]);j(()=>{if(!m)return;let t=0,u=()=>{if(T.current){P();return}t=requestAnimationFrame(u)};return u(),()=>cancelAnimationFrame(t)},[m,P,T]),j(()=>{let t=T.current;if(!m||!t||!R)return;return X(t,R,P,{animationFrame:!0})},[m,R,T,P]);let F=V(()=>{if(!m)return!1;for(let{key:t,property:u}of k){let a=C[t];if(!a)return!1;if(h(u)){if(!a.selectedSet||a.selectedSet.size===0)return!1;if(a.selectedSet.has(v)&&!a.otherText?.trim())return!1}else{if(!a.selected)return!1;if(a.selected===v&&!a.otherText?.trim())return!1}}return!0},[m,k,C]),K=L(async()=>{if(!m)return;if(!F)return;let t={},u={};for(let{key:a,property:g}of k){let f=C[a];if(!f)continue;let N;if(h(g))t[a]=[...f.selectedSet??[]].map((x)=>x===v?(f.otherText??"").trim():x).filter(Boolean);else{let x=f.selected??"";if(t[a]=x===v?(f.otherText??"").trim():x,x!==v)N=A(g).find((i)=>i.value===x)?.preview}let S=f.notes?.trim();if(N||S)u[a]={...N&&{preview:N},...S&&{notes:S}}}await H(m.elicitationId,t,u)},[m,k,C,F,H]),_=L(async()=>{if(m)await M(m.elicitationId)},[m,M]);if(!m||!U)return null;return Y(p("div",{"data-overlay":"ask-user-question",tabIndex:0,onKeyDown:(t)=>{if(t.key==="Escape")t.preventDefault(),_()},className:"bg-card border-border fixed z-50 flex flex-col overflow-hidden rounded-lg border shadow-lg outline-none",style:{left:U.left,width:U.width,bottom:U.bottom,maxHeight:"70vh"},ref:(t)=>{Q.current=t,W(t)},children:[p("div",{className:"border-border flex shrink-0 items-center justify-between gap-2 border-b px-3 py-2",children:[n("div",{className:"text-foreground text-sm font-medium",children:b("askUserQuestion.title")}),B>1&&n("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${B}`})]}),n("div",{className:"min-h-0 flex-1 overflow-y-auto",children:n("div",{className:"space-y-4 px-3 py-3",children:k.map(({key:t,property:u},a)=>{let g=C[t],f=g?.selected,N=g?.selectedSet??new Set,S=A(u),x=h(u);return p("div",{className:"space-y-2",children:[p("div",{className:"flex items-center gap-2",children:[n(Se,{variant:"secondary",className:"font-mono text-[10px] tracking-wide uppercase",children:G(u).title??t}),n("div",{className:"text-foreground text-sm font-medium",children:G(u).description})]}),x?p("div",{className:"space-y-1.5 ps-1",children:[S.map((i)=>p("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[n(w,{checked:N.has(i.value),onCheckedChange:(l)=>{y((E)=>{let I=new Set(E[t]?.selectedSet??new Set);if(l)I.add(i.value);else I.delete(i.value);return{...E,[t]:{...E[t],selectedSet:I}}})}}),p("div",{className:"min-w-0 flex-1",children:[n("div",{className:"text-foreground text-sm",children:i.label}),i.description&&n("div",{className:"text-muted-foreground text-xs",children:i.description})]})]},i.value)),p("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[n(w,{checked:N.has(v),onCheckedChange:(i)=>{y((l)=>{let E=new Set(l[t]?.selectedSet??new Set);if(i)E.add(v);else E.delete(v);return{...l,[t]:{...l[t],selectedSet:E}}})}}),n("div",{className:"text-foreground min-w-0 flex-1 text-sm",children:b("askUserQuestion.other")})]}),N.has(v)&&n("div",{className:"ps-7",children:n(d,{placeholder:b("askUserQuestion.otherPlaceholder"),value:g?.otherText??"",onChange:(i)=>y((l)=>({...l,[t]:{...l[t],otherText:i.target.value}}))})})]}):p(c,{value:f??"",onValueChange:(i)=>y((l)=>({...l,[t]:{...l[t],selected:i}})),className:"space-y-1.5 ps-1",children:[S.map((i)=>{let l=`${a}:${i.value}`;return p("div",{className:z("hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",f===i.value&&"bg-muted/60"),children:[n(s,{value:i.value,id:l}),p(r,{htmlFor:l,className:"min-w-0 flex-1 cursor-pointer",children:[n("div",{className:"text-foreground text-sm font-normal",children:i.label}),i.description&&n("div",{className:"text-muted-foreground text-xs font-normal",children:i.description})]})]},i.value)}),p("div",{className:z("hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",f===v&&"bg-muted/60"),children:[n(s,{value:v,id:`${a}:other`,className:"mt-0.5"}),n(r,{htmlFor:`${a}:other`,className:"text-foreground min-w-0 flex-1 cursor-pointer text-sm font-normal",children:b("askUserQuestion.other")})]}),f===v&&n("div",{className:"ps-7",children:n(d,{placeholder:b("askUserQuestion.otherPlaceholder"),value:g?.otherText??"",onChange:(i)=>y((l)=>({...l,[t]:{...l[t],otherText:i.target.value}}))})})]}),!x&&f&&f!==v&&(()=>{let i=S.find((l)=>l.value===f)?.preview;if(!i)return null;return n("pre",{className:"bg-muted/50 text-muted-foreground ms-1 mt-1 overflow-auto rounded-sm px-2 py-1.5 font-mono text-[11px] whitespace-pre-wrap",children:i})})(),S.some((i)=>i.preview)&&n(o,{placeholder:b("askUserQuestion.notesPlaceholder"),value:g?.notes??"",onChange:(i)=>y((l)=>({...l,[t]:{...l[t],notes:i.target.value}})),rows:1,className:"min-h-0 resize-none text-xs"})]},t)})})}),p("div",{className:"border-border bg-card flex shrink-0 items-center justify-end gap-2 border-t px-3 py-2",children:[n(e,{variant:"ghost",size:"sm",onClick:()=>void _(),children:b("askUserQuestion.cancel")}),n(e,{size:"sm",disabled:!F,onClick:()=>void K(),children:b("askUserQuestion.submit")})]})]}),document.body)}export{me as ChoiceElicitationForm};
1
+ import{Ye}from"../chunk-6qn5srgg.js";import{e}from"../chunk-801v0awm.js";import{P}from"../chunk-jrrvpnf3.js";import{u}from"../chunk-7q7c0mds.js";import{o}from"../chunk-hx6wfscz.js";import{v,c}from"../chunk-k7zzrns3.js";import{s}from"../chunk-c4621n0b.js";import{Oe,se,w,W}from"../chunk-dr6z453e.js";import{autoUpdate as K}from"@floating-ui/dom";import{cn as _}from"cn";import{useCallback as I,useEffect as z,useLayoutEffect as D,useMemo as j,useRef as X,useState as L}from"react";import{createPortal as J}from"react-dom";import{jsx as n,jsxs as p}from"react/jsx-runtime";var f="__other__";function me({current:l,total:q,anchorRef:E,t:x,onAccept:B,onDecline:H}){let S=j(()=>l?Oe(l.requestedSchema):[],[l]),[T,k]=L({}),Q=X(null);z(()=>{if(l?.elicitationId===void 0)return;let t={};for(let{key:d,property:r}of S)if(!w(r)){let g=W(r)[0];if(g)t[d]={selected:g.value}}k(t)},[l?.elicitationId,S]),z(()=>{if(l?.elicitationId!==void 0&&Q.current&&document.activeElement?.tagName!=="INPUT"&&document.activeElement?.tagName!=="TEXTAREA")Q.current.focus()},[l?.elicitationId]);let[C,M]=L(null),[R,G]=L(null),U=I(()=>{let t=E.current;if(!t)return;let d=t.getBoundingClientRect();if(d.width===0){let r=Math.min(640,window.innerWidth*0.9);M({left:(window.innerWidth-r)/2,width:r,bottom:24});return}M({left:d.left,width:d.width,bottom:window.innerHeight-d.bottom+20})},[E]);D(()=>{if(!l)return;let t=0,d=()=>{if(E.current){U();return}t=requestAnimationFrame(d)};return d(),()=>cancelAnimationFrame(t)},[l,U,E]),D(()=>{let t=E.current;if(!l||!t||!R)return;return K(t,R,U,{animationFrame:!0})},[l,R,E,U]);let F=j(()=>{if(!l)return!1;for(let{key:t,property:d}of S){let r=T[t];if(!r)return!1;if(w(d)){if(!r.selectedSet||r.selectedSet.size===0)return!1;if(r.selectedSet.has(f)&&!r.otherText?.trim())return!1}else{if(!r.selected)return!1;if(r.selected===f&&!r.otherText?.trim())return!1}}return!0},[l,S,T]),V=I(async()=>{if(!l)return;if(!F)return;let t={},d={};for(let{key:r,property:g}of S){let m=T[r];if(!m)continue;let b;if(w(g))t[r]=[...m.selectedSet??[]].map((h)=>h===f?(m.otherText??"").trim():h).filter(Boolean);else{let h=m.selected??"";if(t[r]=h===f?(m.otherText??"").trim():h,h!==f)b=W(g).find((i)=>i.value===h)?.preview}let N=m.notes?.trim();if(b||N)d[r]={...b&&{preview:b},...N&&{notes:N}}}await B(l.elicitationId,t,d)},[l,S,T,F,B]),O=I(async()=>{if(l)await H(l.elicitationId)},[l,H]);if(!l||!C)return null;return J(p("div",{"data-overlay":"ask-user-question",tabIndex:0,onKeyDown:(t)=>{if(t.key==="Escape")t.preventDefault(),O()},className:"bg-card border-border fixed z-50 flex flex-col overflow-hidden rounded-lg border shadow-lg outline-none",style:{left:C.left,width:C.width,bottom:C.bottom,maxHeight:"70vh"},ref:(t)=>{Q.current=t,G(t)},children:[p("div",{className:"border-border flex shrink-0 items-center justify-between gap-2 border-b px-3 py-2",children:[n("div",{className:"text-foreground text-sm font-medium",children:x("askUserQuestion.title")}),q>1&&n("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${q}`})]}),n("div",{className:"min-h-0 flex-1 overflow-y-auto",children:n("div",{className:"space-y-4 px-3 py-3",children:S.map(({key:t,property:d},r)=>{let g=T[t],m=g?.selected,b=g?.selectedSet??new Set,N=W(d),h=w(d);return p("div",{className:"space-y-2",children:[p("div",{className:"flex items-center gap-2",children:[n(Ye,{variant:"secondary",className:"font-mono text-[10px] tracking-wide uppercase",children:se(d).title??t}),n("div",{className:"text-foreground text-sm font-medium",children:se(d).description})]}),h?p("div",{className:"space-y-1.5 ps-1",children:[N.map((i)=>p("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[n(P,{checked:b.has(i.value),onCheckedChange:(a)=>{k((y)=>{let A=new Set(y[t]?.selectedSet??new Set);if(a)A.add(i.value);else A.delete(i.value);return{...y,[t]:{...y[t],selectedSet:A}}})}}),p("div",{className:"min-w-0 flex-1",children:[n("div",{className:"text-foreground text-sm",children:i.label}),i.description&&n("div",{className:"text-muted-foreground text-xs",children:i.description})]})]},i.value)),p("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[n(P,{checked:b.has(f),onCheckedChange:(i)=>{k((a)=>{let y=new Set(a[t]?.selectedSet??new Set);if(i)y.add(f);else y.delete(f);return{...a,[t]:{...a[t],selectedSet:y}}})}}),n("div",{className:"text-foreground min-w-0 flex-1 text-sm",children:x("askUserQuestion.other")})]}),b.has(f)&&n("div",{className:"ps-7",children:n(u,{placeholder:x("askUserQuestion.otherPlaceholder"),value:g?.otherText??"",onChange:(i)=>k((a)=>({...a,[t]:{...a[t],otherText:i.target.value}}))})})]}):p(v,{value:m??"",onValueChange:(i)=>k((a)=>({...a,[t]:{...a[t],selected:i}})),className:"space-y-1.5 ps-1",children:[N.map((i)=>{let a=`${r}:${i.value}`;return p("div",{className:_("hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",m===i.value&&"bg-muted/60"),children:[n(c,{value:i.value,id:a}),p(o,{htmlFor:a,className:"min-w-0 flex-1 cursor-pointer",children:[n("div",{className:"text-foreground text-sm font-normal",children:i.label}),i.description&&n("div",{className:"text-muted-foreground text-xs font-normal",children:i.description})]})]},i.value)}),p("div",{className:_("hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",m===f&&"bg-muted/60"),children:[n(c,{value:f,id:`${r}:other`,className:"mt-0.5"}),n(o,{htmlFor:`${r}:other`,className:"text-foreground min-w-0 flex-1 cursor-pointer text-sm font-normal",children:x("askUserQuestion.other")})]}),m===f&&n("div",{className:"ps-7",children:n(u,{placeholder:x("askUserQuestion.otherPlaceholder"),value:g?.otherText??"",onChange:(i)=>k((a)=>({...a,[t]:{...a[t],otherText:i.target.value}}))})})]}),!h&&m&&m!==f&&(()=>{let i=N.find((a)=>a.value===m)?.preview;if(!i)return null;return n("pre",{className:"bg-muted/50 text-muted-foreground ms-1 mt-1 overflow-auto rounded-sm px-2 py-1.5 font-mono text-[11px] whitespace-pre-wrap",children:i})})(),N.some((i)=>i.preview)&&n(s,{placeholder:x("askUserQuestion.notesPlaceholder"),value:g?.notes??"",onChange:(i)=>k((a)=>({...a,[t]:{...a[t],notes:i.target.value}})),rows:1,className:"min-h-0 resize-none text-xs"})]},t)})})}),p("div",{className:"border-border bg-card flex shrink-0 items-center justify-end gap-2 border-t px-3 py-2",children:[n(e,{variant:"ghost",size:"sm",onClick:()=>void O(),children:x("askUserQuestion.cancel")}),n(e,{size:"sm",disabled:!F,onClick:()=>void V(),children:x("askUserQuestion.submit")})]})]}),document.body)}export{me as ChoiceElicitationForm};
@@ -1 +1 @@
1
- import{Ce,G,h,A}from"../chunk-k0mayxgs.js";export{Ce as elicitationFields,G as elicitationLabels,A as elicitationOptions,h as isMultiSelect};
1
+ import{Oe,se,w,W}from"../chunk-dr6z453e.js";export{Oe as elicitationFields,se as elicitationLabels,W as elicitationOptions,w as isMultiSelect};
@@ -1 +1 @@
1
- import{nt,ke,wt,kt}from"../chunk-d4e74rv1.js";export{nt as PERMISSION_KIND_GROUP_ORDER,wt as isAllowKind,kt as isAlwaysKind,ke as sortPermissionOptions};
1
+ import{on,ze,Fn,Dn}from"../chunk-5h13saah.js";export{on as PERMISSION_KIND_GROUP_ORDER,Fn as isAllowKind,Dn as isAlwaysKind,ze as sortPermissionOptions};
@@ -1 +1 @@
1
- import{ke}from"../chunk-d4e74rv1.js";import{autoUpdate as L}from"@floating-ui/dom";import{cn as I}from"cn";import{CheckCheckIcon as M,CheckIcon as h,ShieldXIcon as V,XIcon as F}from"lucide-react";import{useCallback as H,useEffect as N,useId as T,useLayoutEffect as _,useRef as S,useState as f}from"react";import{createPortal as z}from"react-dom";import{jsx as i,jsxs as u}from"react/jsx-runtime";var U={allow_once:{icon:h},allow_always:{icon:M},reject_once:{icon:F},reject_always:{icon:V}};function Y({requestId:p,options:D,title:E,children:P,total:w=1,alwaysLabel:j="always",autoFocus:y="always",anchorRef:n,onRespond:r}){let b=T(),[a,g]=f(0),[s,v]=f(null),[l,A]=f(null),x=S(null),c=ke(D);N(()=>{g(0)},[p]),N(()=>{let e=document.activeElement;if(y==="always"||e===null||e===document.body)x.current?.focus()},[p,l,y]);let d=H(()=>{let e=n?.current;if(!e)return;let t=e.getBoundingClientRect();if(t.width===0){let o=Math.min(640,window.innerWidth*0.9);v({left:(window.innerWidth-o)/2,width:o,bottom:24});return}v({left:t.left,width:t.width,bottom:window.innerHeight-t.bottom+20})},[n]);if(_(()=>{if(!n)return;let e=0,t=()=>{if(n.current)d();else e=requestAnimationFrame(t)};return t(),()=>cancelAnimationFrame(e)},[p,n,d]),_(()=>{let e=n?.current;if(!e||!l)return;return L(e,l,d,{animationFrame:!0})},[n,l,d]),n&&!s)return null;let k=u("div",{ref:A,"data-overlay":"permission-request",className:I("bg-card border-border overflow-hidden rounded-lg border",n&&"fixed z-50"),style:n&&s?{left:s.left,width:s.width,bottom:s.bottom}:void 0,children:[u("div",{className:"border-border border-b px-3 py-2",children:[u("div",{className:"flex items-center justify-between gap-2",children:[i("div",{id:b,className:"text-foreground text-sm font-medium",children:E}),w>1&&i("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${w}`})]}),P]}),i("div",{role:"listbox","aria-labelledby":b,tabIndex:0,ref:x,onKeyDown:(e)=>{let t=c.length;if(t===0&&e.key!=="Escape")return;if(e.key==="ArrowDown"||e.key==="ArrowUp")e.preventDefault(),g((o)=>e.key==="ArrowDown"?(o+1)%t:(o-1+t)%t);else if(e.key==="Enter")e.preventDefault(),r(c[a].optionId);else if(e.key==="Escape")e.preventDefault(),r(null);else if(/^[1-9]$/.test(e.key)&&Number(e.key)<=t)e.preventDefault(),r(c[Number(e.key)-1].optionId)},className:"outline-none",children:c.map((e,t)=>{let o=e.kind??"allow_once",C=U[o]?.icon??h,K=o==="allow_always"||o==="reject_always",O=o==="reject_once"||o==="reject_always";return u("div",{role:"option",tabIndex:-1,"aria-selected":t===a,title:e.description,onClick:()=>void r(e.optionId),onKeyDown:(m)=>{if(m.key==="Enter"||m.key===" ")m.preventDefault(),m.stopPropagation(),r(e.optionId)},className:I("flex cursor-pointer items-center gap-2 px-3 py-1.5 text-sm select-none",t===a?"bg-ring text-accent-foreground":"text-foreground",O&&t!==a&&"text-muted-foreground"),children:[i("span",{className:"min-w-3 text-xs opacity-70",children:t+1}),i(C,{className:"size-3.5 shrink-0 opacity-80"}),i("span",{className:"min-w-0 flex-1 truncate",children:e.name}),K&&i("span",{className:"bg-muted text-muted-foreground rounded px-1.5 py-0.5 text-[10px] tracking-wide uppercase",children:j})]},e.optionId)})})]});return n?z(k,document.body):k}export{Y as PermissionView};
1
+ import{ze}from"../chunk-5h13saah.js";import{autoUpdate as L}from"@floating-ui/dom";import{cn as I}from"cn";import{CheckCheckIcon as M,CheckIcon as h,ShieldXIcon as V,XIcon as F}from"lucide-react";import{useCallback as H,useEffect as N,useId as T,useLayoutEffect as _,useRef as S,useState as f}from"react";import{createPortal as z}from"react-dom";import{jsx as i,jsxs as u}from"react/jsx-runtime";var U={allow_once:{icon:h},allow_always:{icon:M},reject_once:{icon:F},reject_always:{icon:V}};function Y({requestId:p,options:D,title:E,children:P,total:w=1,alwaysLabel:j="always",autoFocus:y="always",anchorRef:n,onRespond:r}){let b=T(),[a,g]=f(0),[s,v]=f(null),[l,A]=f(null),x=S(null),c=ze(D);N(()=>{g(0)},[p]),N(()=>{let e=document.activeElement;if(y==="always"||e===null||e===document.body)x.current?.focus()},[p,l,y]);let d=H(()=>{let e=n?.current;if(!e)return;let t=e.getBoundingClientRect();if(t.width===0){let o=Math.min(640,window.innerWidth*0.9);v({left:(window.innerWidth-o)/2,width:o,bottom:24});return}v({left:t.left,width:t.width,bottom:window.innerHeight-t.bottom+20})},[n]);if(_(()=>{if(!n)return;let e=0,t=()=>{if(n.current)d();else e=requestAnimationFrame(t)};return t(),()=>cancelAnimationFrame(e)},[p,n,d]),_(()=>{let e=n?.current;if(!e||!l)return;return L(e,l,d,{animationFrame:!0})},[n,l,d]),n&&!s)return null;let k=u("div",{ref:A,"data-overlay":"permission-request",className:I("bg-card border-border overflow-hidden rounded-lg border",n&&"fixed z-50"),style:n&&s?{left:s.left,width:s.width,bottom:s.bottom}:void 0,children:[u("div",{className:"border-border border-b px-3 py-2",children:[u("div",{className:"flex items-center justify-between gap-2",children:[i("div",{id:b,className:"text-foreground text-sm font-medium",children:E}),w>1&&i("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${w}`})]}),P]}),i("div",{role:"listbox","aria-labelledby":b,tabIndex:0,ref:x,onKeyDown:(e)=>{let t=c.length;if(t===0&&e.key!=="Escape")return;if(e.key==="ArrowDown"||e.key==="ArrowUp")e.preventDefault(),g((o)=>e.key==="ArrowDown"?(o+1)%t:(o-1+t)%t);else if(e.key==="Enter")e.preventDefault(),r(c[a].optionId);else if(e.key==="Escape")e.preventDefault(),r(null);else if(/^[1-9]$/.test(e.key)&&Number(e.key)<=t)e.preventDefault(),r(c[Number(e.key)-1].optionId)},className:"outline-none",children:c.map((e,t)=>{let o=e.kind??"allow_once",C=U[o]?.icon??h,K=o==="allow_always"||o==="reject_always",O=o==="reject_once"||o==="reject_always";return u("div",{role:"option",tabIndex:-1,"aria-selected":t===a,title:e.description,onClick:()=>void r(e.optionId),onKeyDown:(m)=>{if(m.key==="Enter"||m.key===" ")m.preventDefault(),m.stopPropagation(),r(e.optionId)},className:I("flex cursor-pointer items-center gap-2 px-3 py-1.5 text-sm select-none",t===a?"bg-ring text-accent-foreground":"text-foreground",O&&t!==a&&"text-muted-foreground"),children:[i("span",{className:"min-w-3 text-xs opacity-70",children:t+1}),i(C,{className:"size-3.5 shrink-0 opacity-80"}),i("span",{className:"min-w-0 flex-1 truncate",children:e.name}),K&&i("span",{className:"bg-muted text-muted-foreground rounded px-1.5 py-0.5 text-[10px] tracking-wide uppercase",children:j})]},e.optionId)})})]});return n?z(k,document.body):k}export{Y as PermissionView};
@@ -1 +1 @@
1
- import{e}from"../chunk-vk39871j.js";import{w}from"../chunk-dj8v2w6n.js";import{E,R,Ye,Je,L,et}from"../chunk-wnq8g0kp.js";import{r}from"../chunk-bwzjm3g8.js";import"../chunk-gnthx1zg.js";import{re,oe,je,Qe,Xe,H}from"../chunk-3abwky4a.js";import{d}from"../chunk-wmsdg5fb.js";import{c,s}from"../chunk-nfd274y3.js";import{N}from"../chunk-s2n85pks.js";import{o}from"../chunk-d0ptk8x8.js";import{isArrayProperty as D,isBooleanProperty as S,isNumberProperty as A,isStringProperty as C}from"@alwith/api";import{useEffect as V,useMemo as q,useState as P}from"react";import{jsx as l,jsxs as f}from"react/jsx-runtime";function G(a){if(!C(a))return null;if(a.oneOf&&a.oneOf.length>0)return a.oneOf.map((t)=>({value:t.const,label:t.title??t.const,...t.description?{description:t.description}:{}}));if(a.enum&&a.enum.length>0)return a.enum.map((t)=>({value:t,label:t}));return null}function I(a){let t=a,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 B(a){let t=new Set(a.required??[]);return Object.entries(a.properties??{}).map(([n,i])=>({key:n,property:i,title:i.title??n,description:i.description??null,required:t.has(n),options:G(i),multiOptions:D(i)?I(i.items):null}))}function k(a){let t={};for(let n of a){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(S(n.property))t[n.key]=!1;else if(D(n.property))t[n.key]=[]}return t}function K(a,t){if(a.multiOptions)return Array.isArray(t)&&t.length>0;if(!a.required)return!0;return t!==void 0&&t!==""&&!(Array.isArray(t)&&t.length===0)}function O({id:a,label:t,description:n,control:i}){return f("div",{className:"hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",children:[i,f(r,{htmlFor:a,className:"min-w-0 flex-1 cursor-pointer font-normal",children:[l("div",{className:"text-foreground text-sm",children:t}),n&&l("div",{className:"text-muted-foreground text-xs",children:n})]})]})}function T({id:a,field:t,value:n,onChange:i}){if(t.multiOptions){let u=new Set(Array.isArray(n)?n:[]);return f(re,{children:[l(oe,{variant:"label",children:t.title}),t.description&&l(H,{children:t.description}),l("div",{className:"flex flex-col gap-1",children:t.multiOptions.map((p)=>{let g=`${a}:${p.value}`;return l(O,{id:g,...p,control:l(w,{id:g,checked:u.has(p.value),onCheckedChange:(F)=>{let y=new Set(u);if(F)y.add(p.value);else y.delete(p.value);i([...y])}})},p.value)})})]})}if(t.options)return f(re,{children:[l(oe,{variant:"label",children:t.title}),t.description&&l(H,{children:t.description}),l(c,{value:typeof n==="string"?n:"",onValueChange:(u)=>i(String(u)),className:"flex flex-col gap-1",children:t.options.map((u)=>{let p=`${a}:${u.value}`;return l(O,{id:p,...u,control:l(s,{value:u.value,id:p})},u.value)})})]});return f(Qe,{children:[l(Xe,{htmlFor:a,children:t.title}),S(t.property)?l(N,{id:a,checked:n===!0,onCheckedChange:(u)=>i(u)}):A(t.property)?l(d,{id:a,type:"number",required:t.required,value:typeof n==="number"?n:"",onChange:(u)=>i(u.target.value===""?void 0:Number(u.target.value))}):l(o,{id:a,rows:2,required:t.required,value:typeof n==="string"?n:"",onChange:(u)=>i(u.target.value)}),t.description&&l(H,{children:t.description})]})}function ee({requestId:a,schema:t,message:n,total:i,t:u,onRespond:p}){let g=q(()=>B(t),[t]),[F,y]=P(()=>k(g));V(()=>y(k(g)),[a,g]);let b=g.every((m)=>K(m,F[m.key])),x=()=>{if(!b)return;let m={};for(let[h,v]of Object.entries(F))if(v!==void 0)m[h]=v;p({action:"accept",content:m})};return l(E,{open:!0,onOpenChange:(m)=>!m&&p({action:"cancel"}),children:f(R,{className:"flex max-h-[80vh] flex-col gap-4 sm:max-w-lg",onKeyDown:(m)=>{if(m.key==="Enter"&&(m.metaKey||m.ctrlKey))m.preventDefault(),x()},children:[f(Ye,{children:[f("div",{className:"flex items-center justify-between gap-2 pe-8",children:[l(L,{children:t.title??u("approval.needed")}),i>1&&l("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${i}`})]}),l(et,{children:n})]}),l("div",{className:"min-h-0 flex-1 overflow-y-auto",children:l(je,{children:g.map((m)=>l(T,{id:`${a}:${m.key}`,field:m,value:F[m.key],onChange:(h)=>y((v)=>({...v,[m.key]:h}))},m.key))})}),f(Je,{children:[l(e,{variant:"ghost",onClick:()=>p({action:"decline"}),children:u("actions.decline")}),l(e,{disabled:!b,onClick:x,children:u("actions.submit")})]})]})})}export{ee as SchemaElicitationForm,B as elicitationFields,k as initialValues,K as isAnswered};
1
+ import{e}from"../chunk-801v0awm.js";import{P}from"../chunk-jrrvpnf3.js";import{L,A,tt,nt,_,rt}from"../chunk-6p5hgnpq.js";import{o}from"../chunk-hx6wfscz.js";import"../chunk-h38yw8y3.js";import{ne,re,Fe,De,Be,G}from"../chunk-sky795ex.js";import{u}from"../chunk-7q7c0mds.js";import{v,c}from"../chunk-k7zzrns3.js";import{R}from"../chunk-9s1cgt7s.js";import{s}from"../chunk-c4621n0b.js";import{isArrayProperty as w,isBooleanProperty as D,isNumberProperty as S,isStringProperty as C}from"@alwith/api";import{useEffect as E,useMemo as N,useState as V}from"react";import{jsx as a,jsxs as p}from"react/jsx-runtime";function q(r){if(!C(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 I(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 B(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:w(i)?I(i.items):null}))}function k(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(D(n.property))t[n.key]=!1;else if(w(n.property))t[n.key]=[]}return t}function K(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 O({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(o,{htmlFor:r,className:"min-w-0 flex-1 cursor-pointer font-normal",children:[a("div",{className:"text-foreground text-sm",children:t}),n&&a("div",{className:"text-muted-foreground text-xs",children:n})]})]})}function T({id:r,field:t,value:n,onChange:i}){if(t.multiOptions){let l=new Set(Array.isArray(n)?n:[]);return p(ne,{children:[a(re,{variant:"label",children:t.title}),t.description&&a(G,{children:t.description}),a("div",{className:"flex flex-col gap-1",children:t.multiOptions.map((d)=>{let f=`${r}:${d.value}`;return a(O,{id:f,...d,control:a(P,{id:f,checked:l.has(d.value),onCheckedChange:(y)=>{let g=new Set(l);if(y)g.add(d.value);else g.delete(d.value);i([...g])}})},d.value)})})]})}if(t.options)return p(ne,{children:[a(re,{variant:"label",children:t.title}),t.description&&a(G,{children:t.description}),a(v,{value:typeof n==="string"?n:"",onValueChange:(l)=>i(String(l)),className:"flex flex-col gap-1",children:t.options.map((l)=>{let d=`${r}:${l.value}`;return a(O,{id:d,...l,control:a(c,{value:l.value,id:d})},l.value)})})]});return p(De,{children:[a(Be,{htmlFor:r,children:t.title}),D(t.property)?a(R,{id:r,checked:n===!0,onCheckedChange:(l)=>i(l)}):S(t.property)?a(u,{id:r,type:"number",required:t.required,value:typeof n==="number"?n:"",onChange:(l)=>i(l.target.value===""?void 0:Number(l.target.value))}):a(s,{id:r,rows:2,required:t.required,value:typeof n==="string"?n:"",onChange:(l)=>i(l.target.value)}),t.description&&a(G,{children:t.description})]})}function ee({requestId:r,schema:t,message:n,total:i,t:l,onRespond:d}){let f=N(()=>B(t),[t]),[y,g]=V(()=>k(f));E(()=>g(k(f)),[r,f]);let b=f.every((m)=>K(m,y[m.key])),x=()=>{if(!b)return;let m={};for(let[h,F]of Object.entries(y))if(F!==void 0)m[h]=F;d({action:"accept",content:m})};return a(L,{open:!0,onOpenChange:(m)=>!m&&d({action:"cancel"}),children:p(A,{className:"flex max-h-[80vh] flex-col gap-4 sm:max-w-lg",onKeyDown:(m)=>{if(m.key==="Enter"&&(m.metaKey||m.ctrlKey))m.preventDefault(),x()},children:[p(tt,{children:[p("div",{className:"flex items-center justify-between gap-2 pe-8",children:[a(_,{children:t.title??l("approval.needed")}),i>1&&a("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${i}`})]}),a(rt,{children:n})]}),a("div",{className:"min-h-0 flex-1 overflow-y-auto",children:a(Fe,{children:f.map((m)=>a(T,{id:`${r}:${m.key}`,field:m,value:y[m.key],onChange:(h)=>g((F)=>({...F,[m.key]:h}))},m.key))})}),p(nt,{children:[a(e,{variant:"ghost",onClick:()=>d({action:"decline"}),children:l("actions.decline")}),a(e,{disabled:!b,onClick:x,children:l("actions.submit")})]})]})})}export{ee as SchemaElicitationForm,B as elicitationFields,k as initialValues,K as isAnswered};
@@ -1 +1 @@
1
- import{e}from"../chunk-vk39871j.js";import{Be,ze,$e,Ue,Ve,Ke}from"../chunk-2sgxwycp.js";import{ExternalLinkIcon as d}from"lucide-react";import{jsx as a,jsxs as n}from"react/jsx-runtime";function C({message:r,url:t,t:i,onOpen:l,onRespond:o}){return n(Be,{size:"sm",children:[n(ze,{children:[a(Ue,{children:i("approval.needed")}),a($e,{children:r})]}),a(Ve,{children:n("div",{className:"flex flex-col gap-3",children:[n(e,{variant:"outline",size:"sm",className:"w-fit",onClick:()=>void l(t),children:[a(d,{"data-icon":"inline-start"}),i("approval.openLink")]}),a("p",{className:"text-muted-foreground text-sm",children:i("approval.waitingForLink")})]})}),n(Ke,{className:"flex flex-wrap gap-2",children:[a(e,{variant:"outline",size:"sm",onClick:()=>o("decline"),children:i("actions.decline")}),a(e,{variant:"ghost",size:"sm",onClick:()=>o("cancel"),children:i("actions.cancel")})]})]})}export{C as UrlElicitationCard};
1
+ import{e}from"../chunk-801v0awm.js";import{Ue,Ve,qe,Ke,Ge,We}from"../chunk-6qa5dt1k.js";import{ExternalLinkIcon as d}from"lucide-react";import{jsx as a,jsxs as n}from"react/jsx-runtime";function C({message:r,url:t,t:i,onOpen:l,onRespond:o}){return n(Ue,{size:"sm",children:[n(Ve,{children:[a(Ke,{children:i("approval.needed")}),a(qe,{children:r})]}),a(Ge,{children:n("div",{className:"flex flex-col gap-3",children:[n(e,{variant:"outline",size:"sm",className:"w-fit",onClick:()=>void l(t),children:[a(d,{"data-icon":"inline-start"}),i("approval.openLink")]}),a("p",{className:"text-muted-foreground text-sm",children:i("approval.waitingForLink")})]})}),n(We,{className:"flex flex-wrap gap-2",children:[a(e,{variant:"outline",size:"sm",onClick:()=>o("decline"),children:i("actions.decline")}),a(e,{variant:"ghost",size:"sm",onClick:()=>o("cancel"),children:i("actions.cancel")})]})]})}export{C as UrlElicitationCard};
@@ -0,0 +1,2 @@
1
+ function Rt(t){if(!t||typeof t!=="object"||!("codex"in t))return null;let o=t.codex;if(!o||typeof o!=="object"||!("questionReply"in o))return null;let n=o.questionReply;if(!n||typeof n!=="object"||!("question"in n)||!("answer"in n))return null;return typeof n.question==="string"&&typeof n.answer==="string"?{question:n.question,answer:n.answer}:null}function Lt(t){if(!t||typeof t!=="object"||!("codex"in t))return null;let o=t.codex;if(!o||typeof o!=="object"||!("questionReplyParts"in o))return null;let n=o.questionReplyParts;if(!Array.isArray(n)||n.length===0)return null;let i=n;if(!i.every((e)=>!!e&&typeof e==="object"&&("text"in e)&&typeof e.text==="string"&&(!("question"in e)||e.question===void 0||typeof e.question==="string")))return null;return i.map((e)=>({text:e.text,...e.question===void 0?{}:{question:e.question}}))}
2
+ export{Rt,Lt};
@@ -0,0 +1,2 @@
1
+ import{s}from"./chunk-c4621n0b.js";import{cn as n}from"cn";import{jsx as o}from"react/jsx-runtime";function ce({className:r,...e}){return o(s,{"data-slot":"input-group-control",className:n("flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",r),...e})}
2
+ export{ce};
@@ -0,0 +1,2 @@
1
+ import{nativeTurnId as a}from"@nyssance/codex-acp-v2/client";function xt(o,i){let u=new Set,s=(e)=>{let t=e.items.map(a).find((r)=>r!==null),n=e.items.every((r)=>r.replayed);if(t===void 0||u.has(t))return{turnKey:e.key,turn:e,deferUntilReady:n};return u.add(t),{turnKey:`history:${t}`,aliases:[e.key],turn:e,deferUntilReady:n}};if(!i?.complete)return o.map(s);let d=new Map;for(let e of o){let t=e.items.map(a).find((r)=>r!==null);if(t===void 0)continue;let n=d.get(t)??[];n.push(e),d.set(t,n)}let l=new Set(i.turns.map((e)=>e.turnId)),y=new Set(i.loadedTurnIds);return[...i.turns.flatMap((e)=>{let t=d.get(e.turnId);if(t)return t.map(s);return y.has(e.turnId)?[]:[{turnKey:`history:${e.turnId}`,nativeTurnId:e.turnId,estimatedHeightPx:320,placeholder:!0}]}),...o.filter((e)=>!e.items.some((t)=>l.has(a(t)??""))).map(s)]}
2
+ export{xt};
@@ -0,0 +1,4 @@
1
+ import{kt}from"./chunk-w3yddw6n.js";import{t}from"./chunk-vw2hv2sq.js";import{Rt,Lt}from"./chunk-15nwm04a.js";import{p}from"./chunk-fgsd4fsd.js";import{h}from"./chunk-fvnb8ds4.js";import{isEmbeddedResource as g,isImage as d,isResourceLink as f,isText as x}from"@alwith/api";import{memo as q}from"react";import{jsx as r,jsxs as y}from"react/jsx-runtime";var wt=q(function({item:s,messageTime:c}){let l=t(),o=Lt(s._meta),m=o?o.map((e)=>e.question===void 0?e.text:`${e.question}
2
+ ${e.text}`).join(`
3
+ `):h(s),a=s.content.filter(d),i=s.content.filter((e)=>f(e)||g(e)),u=o??s.content.filter(x).map((e)=>{let n=Rt(e._meta);return n?{question:n.question,text:n.answer}:{text:e.text}});if(m.length===0&&a.length===0&&i.length===0)return null;return y("div",{className:"group/codex-user flex min-w-0 flex-col items-end gap-2","data-content-search-unit-key":s.id,children:[i.length>0&&r("div",{className:"codex-user-mentions",children:i.map((e,n)=>r(p,{block:e},`${s.id}:${n}`))}),r(kt,{host:l,message:s,text:m,textParts:u.some((e)=>("question"in e))?u:void 0,images:a,mentions:[],messageTime:c})]})});
4
+ export{wt};
@@ -0,0 +1 @@
1
+ import{Menu as n}from"@base-ui/react/menu";import{cn as i}from"cn";import{CheckIcon as c,ChevronRightIcon as p}from"lucide-react";import{jsx as t,jsxs as u}from"react/jsx-runtime";function k({...e}){return t(n.Root,{"data-slot":"dropdown-menu",...e})}function $n({...e}){return t(n.Portal,{"data-slot":"dropdown-menu-portal",...e})}function C({...e}){return t(n.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function x({align:e="start",alignOffset:o=0,side:a="bottom",sideOffset:r=4,className:d,...s}){return t(n.Portal,{children:t(n.Positioner,{className:"isolate z-50 outline-none",align:e,alignOffset:o,side:a,sideOffset:r,children:t(n.Popup,{"data-slot":"dropdown-menu-content",className:i("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 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 z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md p-1 shadow-md ring-1 duration-100 outline-none data-closed:overflow-hidden",d),...s})})})}function T({...e}){return t(n.Group,{"data-slot":"dropdown-menu-group",...e})}function j({className:e,inset:o,...a}){return t(n.GroupLabel,{"data-slot":"dropdown-menu-label","data-inset":o,className:i("text-muted-foreground px-2 py-1.5 text-xs font-medium data-inset:pl-8",e),...a})}function I({className:e,inset:o,variant:a="default",...r}){return t(n.Item,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":a,className:i("group/dropdown-menu-item focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:*:[svg]:text-destructive relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}function H({...e}){return t(n.SubmenuRoot,{"data-slot":"dropdown-menu-sub",...e})}function F({className:e,inset:o,children:a,...r}){return u(n.SubmenuTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":o,className:i("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[a,t(p,{className:"ml-auto"})]})}function D({align:e="start",alignOffset:o=-3,side:a="right",sideOffset:r=0,className:d,...s}){return t(x,{"data-slot":"dropdown-menu-sub-content",className:i("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 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 w-auto min-w-[96px] rounded-md p-1 shadow-lg ring-1 duration-100",d),align:e,alignOffset:o,side:a,sideOffset:r,...s})}function ue({className:e,children:o,checked:a,inset:r,...d}){return u(n.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item","data-inset":r,className:i("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:a,...d,children:[t("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-checkbox-item-indicator",children:t(n.CheckboxItemIndicator,{children:t(c,{})})}),o]})}function ot({...e}){return t(n.RadioGroup,{"data-slot":"dropdown-menu-radio-group",...e})}function it({className:e,children:o,inset:a,...r}){return u(n.RadioItem,{"data-slot":"dropdown-menu-radio-item","data-inset":a,className:i("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[t("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:t(n.RadioItemIndicator,{children:t(c,{})})}),o]})}function l({className:e,...o}){return t(n.Separator,{"data-slot":"dropdown-menu-separator",className:i("bg-border -mx-1 my-1 h-px",e),...o})}function Un({className:e,...o}){return t("span",{"data-slot":"dropdown-menu-shortcut",className:i("text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground ml-auto text-xs tracking-widest",e),...o})}export{k,$n,C,x,T,j,I,H,F,D,ue,ot,it,l,Un};
@@ -0,0 +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 Ft(e){g(e).ready.catch((n)=>{console.error(`Failed to load navigation instrument "${e}"`,n)})}function Xn(){c()}function Dt(){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 Bt(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 ln(N,t.length,v.inputTokens,v.outputTokens,o)});_(i,x)}function Yn(e,n,t,i,o,a){if(a==="none")return;_(o,[ln(e,n,t,i,a)])}function ln(e,n,t,i,o){if(o==="none")throw Error("navigationMidiNote: 声音已关闭,不该求音符");if(o==="auto")return yn(t,i);return dn(e,n)}function yn(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 dn(e,n){return y+wn(e,n)}function Zn(e,n){return D(dn(e,n))}function wn(e,n){if(n<=l)return kn(n)[n-e-1];return Math.round((n-e-1)/(n-1)*(l-1))}function kn(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 Jn(){return r.context?.state}function er(e){return g(e).ready}
2
+ export{Ft,Xn,Dt,Bt,Yn,ln,yn,dn,Zn,wn,kn,Jn,er};
@@ -0,0 +1,2 @@
1
+ import{a,Ie,Yt,Pe,Zt,Ne,Jt}from"./chunk-5grywgpq.js";import{t,b,Se,g}from"./chunk-vw2hv2sq.js";import{isText as N}from"@alwith/api";import{createStore as M}from"@alwith/api/client";import{nativeTurnId as x}from"@nyssance/codex-acp-v2/client";import{jsx as f,jsxs as T}from"react/jsx-runtime";var Q=M({entries:{}});function m(n,s){Q.setState((e)=>({entries:{...e.entries,[n]:s}}))}function h(n,s){let e=x(s),r=n.items.findLast((o)=>x(o)!==null),p=n.items.some((o)=>o.kind==="user"&&x(o)===e&&n.turnEndedAt[o.id]!==void 0);return!s.replayed&&e!==null&&r!==void 0&&n.state!=="idle"&&!p&&x(r)===e}function C(n,s){for(let e of n.items){if(e.kind!=="user"||e.echo==="pending")continue;for(let r of[...Ne(e._meta),...e.content.filter(N).flatMap((p)=>Ne(p._meta))])if(r.questionItemId===s)return r.answer}return}function R({sessionId:n,item:s,question:e,index:r}){let p=b(),{t:o}=t(),w=Ie(s.id,r),c=JSON.stringify([n,w]),l=Se(Q,(i)=>i.entries[c]),u=g((i)=>i.sessions[n]),A=g((i)=>i.connection==="ready"),d=l?.draft??Yt(e),v=u===void 0?l?.accepted:C(u,w)??l?.accepted,q=u!==void 0&&h(u,s),D=A&&u?.attached&&!u.restoring&&!u.readOnly,y=v!==void 0?"answered":l?.skipped?"skipped":l?.pending?"submitting":!q?"closed":!D?"unavailable":"pending",E=async()=>{if(Q.getState().entries[c]?.pending||y!=="pending")return;let i=p.state.sessions[n];if(i===void 0||!h(i,s)||!i.attached||i.readOnly||i.restoring)return;let S=Pe(e,d);if(!S.trim())return;let k={questionItemId:w,question:e.title,answer:S};m(c,{draft:d,pending:!0});try{await p.prompt(n,[{type:"text",text:Zt(k),_meta:{codex:{questionReply:k}}}]),m(c,{draft:d,accepted:S})}catch(I){m(c,{draft:d,error:I instanceof Error?I.message:String(I)})}};if(y==="closed")return T("section",{className:"text-muted-foreground flex min-w-0 flex-col gap-1 text-sm","aria-label":e.title,children:[f("p",{className:"whitespace-pre-wrap",children:e.title}),d.text.trim()&&f("p",{className:"whitespace-pre-wrap",children:d.text}),f("span",{role:"status",className:"text-xs",children:o("asyncQuestion.closed")})]});return f(Jt,{question:e,draft:d,status:y,answer:v,error:y==="pending"?l?.error:void 0,t:o,onChange:(i)=>m(c,{draft:i}),onSkip:()=>m(c,{draft:d,skipped:!0}),onSubmit:()=>{E()}})}function vt({sessionId:n,item:s}){return f("div",{className:"flex min-w-0 flex-col gap-3","data-async-questions":s.id,children:a(s._meta).map((e,r)=>f(R,{sessionId:n,item:s,question:e,index:r},Ie(s.id,r)))})}
2
+ export{vt};
@@ -1,2 +1,2 @@
1
- import{He,Oe}from"./chunk-j3my6gn8.js";import{cn as r}from"cn";import{jsx as t,jsxs as a}from"react/jsx-runtime";function n({value:i,onValueChange:o,options:d,itemClassName:l}){return t(He,{value:i,onValueChange:(e)=>o(String(e)),children:d.map((e)=>a(Oe,{value:e.value,disabled:e.disabled,title:e.title,closeOnClick:!0,className:r("gap-2",e.description?"items-start":"items-center",l),children:[e.icon,e.description?a("div",{className:"min-w-0 flex-1",children:[t("div",{className:"text-xs font-medium",children:e.label}),t("div",{className:"text-muted-foreground text-[11px] font-normal",children:e.description})]}):t("span",{className:"min-w-0 flex-1 truncate text-start",children:e.label})]},e.value))})}
2
- export{n};
1
+ import{ot,it}from"./chunk-2epnn4sq.js";import{cn as l}from"cn";import{jsx as t,jsxs as a}from"react/jsx-runtime";function r({value:i,onValueChange:n,options:o,itemClassName:d}){return t(ot,{value:i,onValueChange:(e)=>n(String(e)),children:o.map((e)=>a(it,{value:e.value,disabled:e.disabled,title:e.title,closeOnClick:!0,className:l("gap-2",e.description?"items-start":"items-center",d),children:[e.icon,e.description?a("div",{className:"min-w-0 flex-1",children:[t("div",{className:"text-xs font-medium",children:e.label}),t("div",{className:"text-muted-foreground text-[11px] font-normal",children:e.description})]}):t("span",{className:"min-w-0 flex-1 truncate text-start",children:e.label})]},e.value))})}
2
+ export{r};
@@ -1,3 +1,3 @@
1
- import{t}from"./chunk-sptvg9xh.js";import{ChevronDownIcon as v,ChevronUpIcon as b,FileDiffIcon as C}from"lucide-react";import{useState as m}from"react";import{jsx as d,jsxs as o}from"react/jsx-runtime";function x(e){if(e===null||e.length===0)return 0;return e.split(`
2
- `).length}function ot(e){let l=new Map;for(let u of e)for(let a of u.content){if(a.type!=="diff")continue;let f=a,r=f._meta?.alwith?.hunks??[],h=r.reduce((i,s)=>i+x(s.newText),0),c=r.reduce((i,s)=>i+x(s.oldText),0);for(let i of f.changes){let s=l.get(i.path);if(s)s.additions+=h,s.deletions+=c;else l.set(i.path,{path:i.path,additions:h,deletions:c})}}return[...l.values()]}function le({blocks:e}){return d(it,{files:ot(e)})}function it({files:e,onOpen:l,renderPath:u}){let{t:a,openLink:f}=t(),[r,h]=m(!0),[c,i]=m(!1);if(e.length===0)return null;let s=e.reduce((n,p)=>n+p.additions,0),g=e.reduce((n,p)=>n+p.deletions,0);return o("section",{className:"codex-edited-files-card",children:[o("div",{className:"codex-edited-files-header",children:[d("div",{className:"codex-edited-files-icon","aria-hidden":"true",children:d(C,{})}),o("div",{className:"codex-edited-files-summary",children:[d("strong",{children:a("stream.codex.editedFilesCount",{count:e.length})}),d("button",{type:"button","data-codex-disclosure":"",onClick:()=>{h((n)=>!n),i(!1)},"aria-expanded":r,children:a(r?"stream.codex.hideChanges":"stream.codex.viewChanges")})]}),o("div",{className:"codex-edited-files-total",title:a("stream.codex.changedLines"),children:[o("span",{className:"codex-diff-additions",children:["+",s]}),o("span",{className:"codex-diff-deletions",children:["-",g]})]})]}),r&&o("div",{className:"codex-edited-files-list",children:[(c?e:e.slice(0,3)).map((n)=>o("div",{className:"codex-edited-file-row",children:[d("button",{type:"button",className:"codex-edited-file-path",title:n.path,onClick:()=>l===void 0?f(n.path):l(n),children:u===void 0?n.path:u(n)}),o("span",{className:"codex-edited-file-counts",children:[o("span",{className:"codex-diff-additions",children:["+",n.additions]}),o("span",{className:"codex-diff-deletions",children:["-",n.deletions]})]})]},n.path)),e.length>3&&o("button",{type:"button",className:"codex-edited-files-more","aria-expanded":c,onClick:()=>i((n)=>!n),children:[a(c?"stream.codex.showFewerFiles":"stream.codex.showMoreFiles",{count:e.length-3}),c?d(b,{size:16,"aria-hidden":"true"}):d(v,{size:16,"aria-hidden":"true"})]})]})]})}
3
- export{ot,le,it};
1
+ import{n}from"./chunk-azmqtycn.js";import{ChevronDownIcon as v,ChevronUpIcon as b,FileDiffIcon as C}from"lucide-react";import{useState as m}from"react";import{jsx as d,jsxs as o}from"react/jsx-runtime";function x(e){if(e===null||e.length===0)return 0;return e.split(`
2
+ `).length}function xn(e){let l=new Map;for(let u of e)for(let a of u.content){if(a.type!=="diff")continue;let f=a,r=f._meta?.alwith?.hunks??[],h=r.reduce((i,s)=>i+x(s.newText),0),c=r.reduce((i,s)=>i+x(s.oldText),0);for(let i of f.changes){let s=l.get(i.path);if(s)s.additions+=h,s.deletions+=c;else l.set(i.path,{path:i.path,additions:h,deletions:c})}}return[...l.values()]}function yt({blocks:e}){return d(ve,{files:xn(e)})}function ve({files:e,onOpen:l,renderPath:u}){let{t:a,openLink:f}=n(),[r,h]=m(!0),[c,i]=m(!1);if(e.length===0)return null;let s=e.reduce((t,p)=>t+p.additions,0),g=e.reduce((t,p)=>t+p.deletions,0);return o("section",{className:"codex-edited-files-card",children:[o("div",{className:"codex-edited-files-header",children:[d("div",{className:"codex-edited-files-icon","aria-hidden":"true",children:d(C,{})}),o("div",{className:"codex-edited-files-summary",children:[d("strong",{children:a("stream.codex.editedFilesCount",{count:e.length})}),d("button",{type:"button","data-codex-disclosure":"",onClick:()=>{h((t)=>!t),i(!1)},"aria-expanded":r,children:a(r?"stream.codex.hideChanges":"stream.codex.viewChanges")})]}),o("div",{className:"codex-edited-files-total",title:a("stream.codex.changedLines"),children:[o("span",{className:"codex-diff-additions",children:["+",s]}),o("span",{className:"codex-diff-deletions",children:["-",g]})]})]}),r&&o("div",{className:"codex-edited-files-list",children:[(c?e:e.slice(0,3)).map((t)=>o("div",{className:"codex-edited-file-row",children:[d("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)}),o("span",{className:"codex-edited-file-counts",children:[o("span",{className:"codex-diff-additions",children:["+",t.additions]}),o("span",{className:"codex-diff-deletions",children:["-",t.deletions]})]})]},t.path)),e.length>3&&o("button",{type:"button",className:"codex-edited-files-more","aria-expanded":c,onClick:()=>i((t)=>!t),children:[a(c?"stream.codex.showFewerFiles":"stream.codex.showMoreFiles",{count:e.length-3}),c?d(b,{size:16,"aria-hidden":"true"}):d(v,{size:16,"aria-hidden":"true"})]})]})]})}
3
+ export{xn,yt,ve};
@@ -0,0 +1,2 @@
1
+ import{i}from"./chunk-azmqtycn.js";import{f}from"./chunk-v0zn87k5.js";import{isPlanItems as n,isPlanMarkdown as r}from"@alwith/api";import{jsx as e}from"react/jsx-runtime";function Et({plan:t}){if(r(t))return e("div",{className:"codex-reasoning-details",children:e(i,{text:t.content,streaming:!1})});if(!n(t))return null;return e(f,{entries:t.entries})}
2
+ export{Et};
@@ -0,0 +1,4 @@
1
+ import{e}from"./chunk-801v0awm.js";import{o}from"./chunk-hx6wfscz.js";import{v,c}from"./chunk-k7zzrns3.js";import{s}from"./chunk-c4621n0b.js";import{useId as h}from"react";import{jsx as l,jsxs as g,Fragment as A}from"react/jsx-runtime";function p(n){return n!==null&&typeof n==="object"&&!Array.isArray(n)}function a(n){if(!p(n)||!p(n.codex))return[];let i=n.codex,r=i.questions;if(i.delivery!=="async"||!Array.isArray(r))return[];if(!r.every((t)=>p(t)&&typeof t.title==="string"&&t.title.trim().length>0&&(t.options===null||Array.isArray(t.options)&&t.options.every((d)=>typeof d==="string"))))return[];return r}function Ie(n,i){return JSON.stringify(["request_user_input_async",n,i])}function Yt(n){return{selected:n.options?.length?0:null,text:""}}function Pe(n,i){return i.selected===null?i.text:n.options?.[i.selected]??""}function Zt(n){return`<send_user_message_question_reply>
2
+ ${JSON.stringify([n])}
3
+ </send_user_message_question_reply>`}function Ne(n){if(!p(n)||!p(n.codex))return[];let i=n.codex;return(Array.isArray(i.questionReplyParts)?i.questionReplyParts.map((t)=>p(t)?{...t,answer:t.text}:t):[i.questionReply]).filter((t)=>p(t)&&typeof t.questionItemId==="string"&&typeof t.question==="string"&&typeof t.answer==="string").map(({questionItemId:t,question:d,answer:m})=>({questionItemId:t,question:d,answer:m}))}function Jt({question:n,draft:i,status:r,answer:t,error:d,onChange:m,onSubmit:w,onSkip:Q,t:u}){let f=h(),x=r==="pending",k=r==="answered"||r==="skipped";return g("section",{"aria-labelledby":`${f}-title`,className:"border-border bg-card text-card-foreground flex min-w-0 flex-col gap-3 rounded-xl border p-4",children:[l("h3",{id:`${f}-title`,className:"text-sm font-medium whitespace-pre-wrap",children:n.title}),k?l("p",{className:"text-sm whitespace-pre-wrap",children:r==="answered"?t:u("asyncQuestion.skipped")}):g(A,{children:[(n.options?.length??0)>0&&g(v,{"aria-labelledby":`${f}-title`,disabled:!x,value:i.selected===null?"other":String(i.selected),onValueChange:(y)=>m({...i,selected:y==="other"?null:Number(y)}),children:[n.options?.map((y,b)=>g(o,{className:"flex items-start gap-2 text-sm",children:[l(c,{value:String(b)}),l("span",{className:"whitespace-pre-wrap",children:y})]},b)),g(o,{className:"flex items-center gap-2 text-sm",children:[l(c,{value:"other"}),u("asyncQuestion.other")]})]}),l(s,{"aria-label":u("asyncQuestion.answer"),placeholder:u("asyncQuestion.answer"),value:i.text,readOnly:!x,onChange:(y)=>m({selected:null,text:y.target.value})}),d&&l("p",{role:"alert",className:"text-destructive text-sm",children:d}),g("div",{className:"flex flex-wrap items-center gap-2",children:[l(e,{size:"sm",disabled:!x||Pe(n,i).trim().length===0,onClick:w,children:u(r==="submitting"?"asyncQuestion.submitting":"asyncQuestion.submit")}),l(e,{size:"sm",variant:"ghost",disabled:!x,onClick:Q,children:u("asyncQuestion.skip")}),(r==="closed"||r==="unavailable")&&l("span",{role:"status",className:"text-muted-foreground text-xs",children:u(`asyncQuestion.${r}`)})]})]})]})}
4
+ export{a,Ie,Yt,Pe,Zt,Ne,Jt};
@@ -0,0 +1,2 @@
1
+ var on={allow_once:0,allow_always:1,reject_once:2,reject_always:3};function ze(e){return[...e].toSorted((o,n)=>(on[o.kind]??99)-(on[n.kind]??99))}function Fn(e){return e==="allow_once"||e==="allow_always"}function Dn(e){return e==="allow_always"||e==="reject_always"}
2
+ export{on,ze,Fn,Dn};
@@ -0,0 +1,2 @@
1
+ import{codexMessageError as u,codexTurnError as a}from"@nyssance/codex-acp-v2/client";var c=[10,30,120,300];function Tt(e){let n=0;for(let r=e.length-1;r>=0;r--){let o=e[r],t=o.errors.at(-1),l=t===void 0?null:u(t);if(l===null||a(l).category!=="overloaded")break;if(n++,o.user!==null)break}return c[n-1]??null}
2
+ export{Tt};
@@ -1 +1 @@
1
- import{e}from"./chunk-vk39871j.js";import{Dialog as i}from"@base-ui/react/dialog";import{cn as r}from"cn";import{XIcon as d}from"lucide-react";import{jsx as a,jsxs as l}from"react/jsx-runtime";function E({...o}){return a(i.Root,{"data-slot":"dialog",...o})}function Ht({...o}){return a(i.Trigger,{"data-slot":"dialog-trigger",...o})}function ct({...o}){return a(i.Portal,{"data-slot":"dialog-portal",...o})}function Ze({...o}){return a(i.Close,{"data-slot":"dialog-close",...o})}function ut({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 R({className:o,children:t,showCloseButton:n=!0,...s}){return l(ct,{children:[a(ut,{}),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(d,{}),a("span",{className:"sr-only",children:"Close"})]})]})]})}function Ye({className:o,...t}){return a("div",{"data-slot":"dialog-header",className:r("flex flex-col gap-2",o),...t})}function Je({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 L({className:o,...t}){return a(i.Title,{"data-slot":"dialog-title",className:r("font-heading leading-none font-medium",o),...t})}function et({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{E,Ht,ct,Ze,ut,R,Ye,Je,L,et};
1
+ import{e}from"./chunk-801v0awm.js";import{Dialog as i}from"@base-ui/react/dialog";import{cn as r}from"cn";import{XIcon as d}from"lucide-react";import{jsx as a,jsxs as l}from"react/jsx-runtime";function L({...o}){return a(i.Root,{"data-slot":"dialog",...o})}function zn({...o}){return a(i.Trigger,{"data-slot":"dialog-trigger",...o})}function pn({...o}){return a(i.Portal,{"data-slot":"dialog-portal",...o})}function et({...o}){return a(i.Close,{"data-slot":"dialog-close",...o})}function gn({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 A({className:o,children:t,showCloseButton:n=!0,...s}){return l(pn,{children:[a(gn,{}),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(d,{}),a("span",{className:"sr-only",children:"Close"})]})]})]})}function tt({className:o,...t}){return a("div",{"data-slot":"dialog-header",className:r("flex flex-col gap-2",o),...t})}function nt({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 _({className:o,...t}){return a(i.Title,{"data-slot":"dialog-title",className:r("font-heading leading-none font-medium",o),...t})}function rt({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{L,zn,pn,et,gn,A,tt,nt,_,rt};
@@ -1 +1 @@
1
- import{cn as r}from"cn";import{jsx as d}from"react/jsx-runtime";function Be({className:a,size:t="default",...o}){return d("div",{"data-slot":"card","data-size":t,className:r("group/card bg-card text-card-foreground ring-foreground/10 flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl py-(--card-spacing) text-sm shadow-xs ring-1 [--card-spacing:--spacing(6)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",a),...o})}function ze({className:a,...t}){return d("div",{"data-slot":"card-header",className:r("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",a),...t})}function $e({className:a,...t}){return d("div",{"data-slot":"card-title",className:r("font-heading text-base leading-normal font-medium group-data-[size=sm]/card:text-sm",a),...t})}function Ue({className:a,...t}){return d("div",{"data-slot":"card-description",className:r("text-muted-foreground text-sm",a),...t})}function Rt({className:a,...t}){return d("div",{"data-slot":"card-action",className:r("col-start-2 row-span-2 row-start-1 self-start justify-self-end",a),...t})}function Ve({className:a,...t}){return d("div",{"data-slot":"card-content",className:r("flex flex-col gap-3 px-(--card-spacing)",a),...t})}function Ke({className:a,...t}){return d("div",{"data-slot":"card-footer",className:r("flex items-center rounded-b-xl px-(--card-spacing) [.border-t]:pt-(--card-spacing)",a),...t})}export{Be,ze,$e,Ue,Rt,Ve,Ke};
1
+ import{cn as r}from"cn";import{jsx as d}from"react/jsx-runtime";function Ue({className:a,size:t="default",...o}){return d("div",{"data-slot":"card","data-size":t,className:r("group/card bg-card text-card-foreground ring-foreground/10 flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl py-(--card-spacing) text-sm shadow-xs ring-1 [--card-spacing:--spacing(6)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",a),...o})}function Ve({className:a,...t}){return d("div",{"data-slot":"card-header",className:r("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",a),...t})}function qe({className:a,...t}){return d("div",{"data-slot":"card-title",className:r("font-heading text-base leading-normal font-medium group-data-[size=sm]/card:text-sm",a),...t})}function Ke({className:a,...t}){return d("div",{"data-slot":"card-description",className:r("text-muted-foreground text-sm",a),...t})}function On({className:a,...t}){return d("div",{"data-slot":"card-action",className:r("col-start-2 row-span-2 row-start-1 self-start justify-self-end",a),...t})}function Ge({className:a,...t}){return d("div",{"data-slot":"card-content",className:r("flex flex-col gap-3 px-(--card-spacing)",a),...t})}function We({className:a,...t}){return d("div",{"data-slot":"card-footer",className:r("flex items-center rounded-b-xl px-(--card-spacing) [.border-t]:pt-(--card-spacing)",a),...t})}export{Ue,Ve,qe,Ke,On,Ge,We};
@@ -1 +1 @@
1
- import{mergeProps as a}from"@base-ui/react/merge-props";import{useRender as n}from"@base-ui/react/use-render";import{cva as o}from"class-variance-authority";import{cn as d}from"cn";var lt=o("group/badge focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:ring-[3px] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function Se({className:r,variant:e="default",render:t,...i}){return n({defaultTagName:"span",props:a({className:d(lt({variant:e}),r)},i),render:t,state:{slot:"badge",variant:e}})}export{lt,Se};
1
+ import{mergeProps as a}from"@base-ui/react/merge-props";import{useRender as n}from"@base-ui/react/use-render";import{cva as o}from"class-variance-authority";import{cn as d}from"cn";var mn=o("group/badge focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:ring-[3px] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function Ye({className:r,variant:e="default",render:t,...i}){return n({defaultTagName:"span",props:a({className:d(mn({variant:e}),r)},i),render:t,state:{slot:"badge",variant:e}})}export{mn,Ye};
@@ -1,4 +1,4 @@
1
- function be(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 Re(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{be};
4
+ export{Re};
@@ -0,0 +1,2 @@
1
+ function be(r){if(!r.trimStart().toLowerCase().startsWith("gpt"))return r;let a=/^gpt-\d/iu.test(r.trimStart())?" ":"-";return r.split(/(\s+)/).map((i)=>i.trim().length===0?i:i.split("-").map((t,o)=>{if(t.toLowerCase()==="gpt")return"GPT";if(t.toLowerCase()==="oai")return"OAI";return o>0&&t.length>0?`${t[0]?.toUpperCase()}${t.slice(1)}`:t}).join(a).replace(/^GPT (?=\d)/u,"GPT-")).join("")}
2
+ export{be};
@@ -1 +1 @@
1
- import{Input as t}from"@base-ui/react/input";import{cn as n}from"cn";import{jsx as o}from"react/jsx-runtime";function d({className:i,type:e,...r}){return o(t,{type:e,"data-slot":"input",className:n("border-input file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 h-9 w-full min-w-0 rounded-md border bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-3 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm",i),...r})}export{d};
1
+ import{Input as t}from"@base-ui/react/input";import{cn as n}from"cn";import{jsx as o}from"react/jsx-runtime";function u({className:i,type:e,...r}){return o(t,{type:e,"data-slot":"input",className:n("border-input file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 h-9 w-full min-w-0 rounded-md border bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-3 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm",i),...r})}export{u};
@@ -1 +1 @@
1
- import{Button as n}from"@base-ui/react/button";import{cva as d}from"class-variance-authority";import{cn as o}from"cn";import{jsx as s}from"react/jsx-runtime";var mt=d("group/button focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:ring-3 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:ring-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50 shadow-xs",secondary:"bg-secondary text-secondary-foreground aria-expanded:bg-secondary aria-expanded:text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",lg:"h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-9","icon-xs":"size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function e({className:r,variant:t="default",size:i="default",...a}){return s(n,{"data-slot":"button",className:o(mt({variant:t,size:i,className:r})),...a})}export{mt,e};
1
+ import{Button as n}from"@base-ui/react/button";import{cva as d}from"class-variance-authority";import{cn as o}from"cn";import{jsx as s}from"react/jsx-runtime";var Tn=d("group/button focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:ring-3 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:ring-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50 shadow-xs",secondary:"bg-secondary text-secondary-foreground aria-expanded:bg-secondary aria-expanded:text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",lg:"h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-9","icon-xs":"size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function e({className:r,variant:t="default",size:i="default",...a}){return s(n,{"data-slot":"button",className:o(Tn({variant:t,size:i,className:r})),...a})}export{Tn,e};
@@ -1 +1 @@
1
- import{e}from"./chunk-vk39871j.js";import{cva as i}from"class-variance-authority";import{cn as r}from"cn";import{jsx as o}from"react/jsx-runtime";function tt({className:a,...t}){return o("div",{"data-slot":"input-group",role:"group",className:r("group/input-group border-input has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 relative flex h-9 w-full min-w-0 items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-3 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",a),...t})}var p=i("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function ie({className:a,align:t="inline-start",...s}){return o("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:r(p({align:t}),a),onClick:(n)=>{if(n.target.closest("button"))return;n.currentTarget.parentElement?.querySelector("input")?.focus()},...s})}var l=i("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",sm:"","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function ae({className:a,type:t="button",variant:s="ghost",size:n="xs",...u}){return o(e,{type:t,"data-size":n,variant:s,className:r(l({size:n}),a),...u})}function Ot({className:a,...t}){return o("span",{className:r("text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",a),...t})}export{tt,ie,ae,Ot};
1
+ import{e}from"./chunk-801v0awm.js";import{cva as i}from"class-variance-authority";import{cn as r}from"cn";import{jsx as o}from"react/jsx-runtime";function $e({className:a,...t}){return o("div",{"data-slot":"input-group",role:"group",className:r("group/input-group border-input has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 relative flex h-9 w-full min-w-0 items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-3 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",a),...t})}var p=i("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function le({className:a,align:t="inline-start",...s}){return o("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:r(p({align:t}),a),onClick:(n)=>{if(n.target.closest("button"))return;n.currentTarget.parentElement?.querySelector("input")?.focus()},...s})}var l=i("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",sm:"","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function de({className:a,type:t="button",variant:s="ghost",size:n="xs",...u}){return o(e,{type:t,"data-size":n,variant:s,className:r(l({size:n}),a),...u})}function Bn({className:a,...t}){return o("span",{className:r("text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",a),...t})}export{$e,le,de,Bn};
@@ -0,0 +1,2 @@
1
+ import{e}from"./chunk-801v0awm.js";import{t}from"./chunk-vw2hv2sq.js";import{codexTurnError as T}from"@nyssance/codex-acp-v2/client";import{AlertCircleIcon as R}from"lucide-react";import{useEffect as C,useRef as u,useState as s}from"react";import{jsx as o,jsxs as m}from"react/jsx-runtime";function ye({children:l}){return m("div",{className:"codex-error-message",role:"alert",children:[o(R,{"aria-hidden":"true"}),o("div",{className:"min-w-0 flex-1",children:l})]})}function we({error:l,retry:r}){let{t:f}=t(),p=T(l),[c]=s(()=>r?.delaySeconds==null?null:Date.now()+r.delaySeconds*1000),[v,y]=s(r?.delaySeconds??null),[N,w]=s(!1),[g,x]=s(null),a=u(!1),E=u(!1),S=u(r?.run);S.current=r?.run;let b=u((h)=>{let i=S.current;if(a.current||i===void 0)return;a.current=!0,w(!0),x(null),i(h).catch((n)=>{E.current=!0,a.current=!1,y(null),w(!1),x(n instanceof Error?n.message:String(n))})}),d=r!==void 0&&p.retryable;return C(()=>{if(!d||c===null)return;let i=setInterval(()=>{if(E.current||a.current)return;let n=Math.max(0,Math.ceil((c-Date.now())/1000));if(y(n),n===0)b.current("automatic")},1000);return()=>clearInterval(i)},[c,d]),m(ye,{children:[m("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[o("div",{className:"min-w-0 flex-1 whitespace-pre-wrap",children:p.message}),d&&o(e,{variant:"outline",size:"sm",disabled:N,onClick:()=>b.current("manual"),children:v===null?f("timeline.retry"):f("timeline.retryCountdown",{seconds:v})})]}),g!==null&&o("div",{className:"text-muted-foreground mt-2 text-sm",children:g})]})}
2
+ export{ye,we};
@@ -0,0 +1,2 @@
1
+ import{useCallback as f,useEffect as U,useRef as s,useState as X}from"react";var S=24,q=160,z=45,j=()=>{};function At(e,Y,u=j){let r=s("following"),[A,b]=X(!0),D=s(Y);D.current=Y;let a=s(null),y=s(0),P=s(0),k=s(0),p=s(0),m=s(0),h=s(0),_=s(!1),g=s(null),o=f(()=>{if(a.current!==null)cancelAnimationFrame(a.current);a.current=null},[]),v=f(()=>{u(),o(),h.current++,g.current=null,m.current=0,r.current="reading",b(!1)},[o,u]),T=f(()=>{if(e===null||r.current!=="following"||a.current!==null)return;if(e.scrollTop>=Math.max(0,e.scrollHeight-e.clientHeight))return;y.current=performance.now(),P.current=e.scrollTop,k.current=0;let l=(c)=>{if(a.current=null,r.current!=="following")return;let i=Math.max(0,e.scrollHeight-e.clientHeight),w=i-e.scrollTop;if(w<=0)return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches||w<=1)e.scrollTop=i;else{let E=Math.max(0,c-y.current),H=e.scrollTop===P.current?k.current:0,L=e.scrollTop+H+(w-H)*(1-Math.exp(-E/z));e.scrollTop=L,P.current=e.scrollTop,k.current=L-e.scrollTop,a.current=requestAnimationFrame(l)}y.current=c,p.current=e.scrollTop};a.current=requestAnimationFrame(l)},[e]),d=f(()=>{u(),h.current++,g.current=null,m.current=0,r.current="following",b(!0),T()},[u,T]),B=f((l)=>{u(),o();let c=++h.current;return r.current="locating",_.current=l,g.current=null,m.current=0,b(l),{isCurrent:()=>h.current===c,finish:(i)=>{if(h.current!==c||e===null)return;e.scrollTo({top:i,behavior:"instant"}),p.current=e.scrollTop,r.current=l?"following":"reading"}}},[o,u,e]),x=f(()=>{if(h.current++,r.current==="locating")r.current=_.current?"following":"reading"},[]),G=f((l=null)=>{if(e===null)return;let c=g.current;if(c!==null&&e.scrollHeight!==c){if(g.current=null,e.scrollHeight<c&&e.scrollHeight-e.clientHeight-e.scrollTop<=S)d()}if(r.current==="following"&&l!==null)o(),e.scrollTo({top:l,behavior:"instant"}),p.current=e.scrollTop;else T()},[o,e,T,d]);return U(()=>{if(e===null)return;p.current=e.scrollTop,r.current=e.scrollHeight-e.clientHeight-e.scrollTop<=S?"following":"reading",b(r.current==="following");let l=!1,c=!1,i=null,w=e.closest('[data-slot="scroll-area"]'),F=w??e,E=(n)=>{if(g.current=null,(n<0||r.current==="locating")&&e.scrollHeight>e.clientHeight)v();else u();if(m.current=n,r.current==="reading"&&n>0&&e.scrollHeight-e.clientHeight-e.scrollTop<=1)d()},H=()=>{let n=e.scrollTop>p.current;p.current=e.scrollTop;let t=n&&m.current>0;if(m.current=0,l){c=n;return}if(r.current!=="reading"||!t)return;let M=D.current?q:S;if(e.scrollHeight-e.clientHeight-e.scrollTop<=M)d()},L=(n)=>{if(n.ctrlKey||n.deltaY===0)return;let t=n.target instanceof Element?n.target:null;while(t!==null&&t!==e){if(t.scrollHeight>t.clientHeight&&/auto|scroll/.test(getComputedStyle(t).overflowY)){if(n.deltaY<0?t.scrollTop>0:t.scrollTop+t.clientHeight<t.scrollHeight)return}t=t.parentElement}E(Math.sign(n.deltaY))},C=(n)=>{i=n.touches[0].clientY},O=(n)=>{let t=n.touches[0].clientY;if(i!==null&&t!==i)E(Math.sign(i-t));i=t},I=(n)=>{if(n.defaultPrevented||!(n.target instanceof Element))return;if(n.target.closest("input, textarea, select, button, a, [contenteditable='true']"))return;if(["ArrowUp","PageUp","Home"].includes(n.key)||n.key===" "&&n.shiftKey)E(-1);else if(["ArrowDown","PageDown","End"," "].includes(n.key))E(1)},N=(n)=>{let t=n.target instanceof Element?n.target.closest('[data-slot="scroll-area-scrollbar"][data-orientation="vertical"]'):null,M=t!==null&&t.closest('[data-slot="scroll-area"]')===w;if(l=(n.target===e||M)&&n.button===0&&e.scrollHeight>e.clientHeight,c=!1,l)v()},R=()=>{let n=D.current?q:S;if(l&&c&&e.scrollHeight-e.clientHeight-e.scrollTop<=n)d();l=!1},K=()=>{l=!1},W=(n)=>{if(!(n.target instanceof Element)||n.target.closest("[data-codex-disclosure]")===null)return;v(),g.current=e.scrollHeight};return e.addEventListener("scroll",H,{passive:!0}),e.addEventListener("wheel",L,{passive:!0}),e.addEventListener("touchstart",C,{passive:!0}),e.addEventListener("touchmove",O,{passive:!0}),e.addEventListener("keydown",I),F.addEventListener("pointerdown",N,{capture:!0}),window.addEventListener("pointerup",R),window.addEventListener("pointercancel",K),e.addEventListener("click",W,{capture:!0}),()=>{o(),x(),e.removeEventListener("scroll",H),e.removeEventListener("wheel",L),e.removeEventListener("touchstart",C),e.removeEventListener("touchmove",O),e.removeEventListener("keydown",I),F.removeEventListener("pointerdown",N,{capture:!0}),window.removeEventListener("pointerup",R),window.removeEventListener("pointercancel",K),e.removeEventListener("click",W,{capture:!0})}},[e,o,x,u,d,v]),{isFollowing:A,scrollToBottom:d,stopFollowing:v,schedulePin:T,contentResized:G,beginLocate:B,cancelLocation:x}}
2
+ export{At};
@@ -1,2 +1,2 @@
1
- async function Fe(g,u){try{let a=await(await fetch(g)).blob(),s=u??a.type??"";if(!s.startsWith("image/"))return new Promise((e)=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.onerror=()=>e(null),t.readAsDataURL(a)});let w=s.includes("svg"),n,r,o;if(w){let e=new Image,t=URL.createObjectURL(a);e.src=t;try{await new Promise((h,f)=>{e.onload=()=>h(),e.onerror=()=>f(Error("svg load failed"))})}finally{URL.revokeObjectURL(t)}r=e.naturalWidth||1024,o=e.naturalHeight||1024,n=e}else{let e=await createImageBitmap(a);r=e.width,o=e.height,n=e}let i=Math.min(1,2000/Math.max(r,o)),c=Math.round(r*i),l=Math.round(o*i),d=new OffscreenCanvas(c,l),m=d.getContext("2d");if(!m)throw Error("image-encode: OffscreenCanvas 2d context 不可用");if(m.drawImage(n,0,0,c,l),n instanceof ImageBitmap)n.close();let b=await d.convertToBlob({type:"image/webp",quality:0.85});return new Promise((e)=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.onerror=()=>e(null),t.readAsDataURL(b)})}catch{return null}}
2
- export{Fe};
1
+ async function dt(g,u){try{let a=await(await fetch(g)).blob(),s=u??a.type??"";if(!s.startsWith("image/"))return new Promise((e)=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.onerror=()=>e(null),t.readAsDataURL(a)});let w=s.includes("svg"),n,r,o;if(w){let e=new Image,t=URL.createObjectURL(a);e.src=t;try{await new Promise((h,f)=>{e.onload=()=>h(),e.onerror=()=>f(Error("svg load failed"))})}finally{URL.revokeObjectURL(t)}r=e.naturalWidth||1024,o=e.naturalHeight||1024,n=e}else{let e=await createImageBitmap(a);r=e.width,o=e.height,n=e}let i=Math.min(1,2000/Math.max(r,o)),c=Math.round(r*i),l=Math.round(o*i),d=new OffscreenCanvas(c,l),m=d.getContext("2d");if(!m)throw Error("image-encode: OffscreenCanvas 2d context 不可用");if(m.drawImage(n,0,0,c,l),n instanceof ImageBitmap)n.close();let b=await d.convertToBlob({type:"image/webp",quality:0.85});return new Promise((e)=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.onerror=()=>e(null),t.readAsDataURL(b)})}catch{return null}}
2
+ export{dt};
@@ -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 me({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{me};
1
+ import{PreviewCard as e}from"@base-ui/react/preview-card";import{jsx as o,jsxs as d}from"react/jsx-runtime";function $t({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{$t};
@@ -0,0 +1,2 @@
1
+ import{te}from"./chunk-jh8jske0.js";function K(d,f){if(!f)return[];let h=[],s="",n=[],a=()=>{let t=0,e=0;for(let{start:r,end:o}of te(s,f)){while(t<n.length&&n[t].end<=r)t++;e=Math.max(e,t);while(e<n.length&&n[e].end<o)e++;let l=n[t],c=n[e];if(!l||!c)throw Error("Search text offset has no DOM node");let i=document.createRange();i.setStart(l.node,r-l.start),i.setEnd(c.node,o-c.start),h.push(i)}s="",n=[]},u=new Set(["ADDRESS","ARTICLE","ASIDE","BLOCKQUOTE","DIV","DL","DT","DD","FIGCAPTION","FIGURE","FOOTER","FORM","H1","H2","H3","H4","H5","H6","HEADER","HR","LI","MAIN","NAV","OL","P","PRE","SECTION","TABLE","TD","TH","TR","UL"]),E=(t)=>{if(t.nodeType===Node.TEXT_NODE){let r=t.parentElement;if(!r||r.offsetParent===null&&r.tagName!=="BODY")return;let o=t.nodeValue??"";n.push({node:t,start:s.length,end:s.length+o.length}),s+=o;return}if(!(t instanceof Element))return;if(t.matches("script, style, [hidden], [aria-hidden='true']")){a();return}if(t.tagName==="BR"){a();return}let e=u.has(t.tagName);if(e)a();for(let r of t.childNodes)E(r);if(e)a()};return E(d),a(),h}
2
+ export{K};
@@ -1 +1 @@
1
- import{Switch as a}from"@base-ui/react/switch";import{cn as d}from"cn";import{jsx as e}from"react/jsx-runtime";function N({className:i,size:t="default",...r}){return e(a.Root,{"data-slot":"switch","data-size":t,className:d("peer group/switch focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 relative inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 aria-invalid:ring-3 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px]",i),...r,children:e(a.Thumb,{"data-slot":"switch-thumb",className:"bg-background dark:data-checked:bg-primary-foreground dark:data-unchecked:bg-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0"})})}export{N};
1
+ import{Switch as a}from"@base-ui/react/switch";import{cn as d}from"cn";import{jsx as e}from"react/jsx-runtime";function R({className:i,size:t="default",...r}){return e(a.Root,{"data-slot":"switch","data-size":t,className:d("peer group/switch focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 relative inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 aria-invalid:ring-3 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px]",i),...r,children:e(a.Thumb,{"data-slot":"switch-thumb",className:"bg-background dark:data-checked:bg-primary-foreground dark:data-unchecked:bg-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0"})})}export{R};
@@ -0,0 +1,7 @@
1
+ import{n,i}from"./chunk-azmqtycn.js";import{be}from"./chunk-7kcdf82d.js";import{m}from"./chunk-d8gwsw6j.js";import{d}from"./chunk-trgq8rq1.js";import{M,Nt}from"./chunk-m2wxz0sj.js";import{f}from"./chunk-v0zn87k5.js";import{cn as b}from"cn";import{BotIcon as ue,CheckIcon as me,CopyIcon as pe}from"lucide-react";import{Fragment as ge,useEffect as Z,useRef as H,useState as D}from"react";import{jsx as a,jsxs as y,Fragment as U}from"react/jsx-runtime";function G(e,t){let[o,r]=D(()=>({key:e,mounted:t})),s=t||o.key===e&&o.mounted;if(o.key!==e||o.mounted!==s)r({key:e,mounted:s});return s}var K=new WeakMap,J=1;function T(e){if(e.type==="tool_use"||e.type==="subagent"||e.type==="collab")return`${e.type}:${e.id}`;if(e.type==="thinking"&&e.id!==void 0)return`thinking:${e.id}`;let t=K.get(e);if(t!==void 0)return`${e.type}:${t}`;let o=J;return J+=1,K.set(e,o),`${e.type}:${o}`}function k(e){switch(e){case"pending":case"in_progress":return!0;case"completed":case"failed":case"cancelled":case"interrupted":return!1;default:throw Error(`Unknown ACP tool status: ${e}`)}}function W(e,t){let o=Math.max(0,Math.round(e/1000)),r=Math.floor(o/3600),s=Math.floor(o%3600/60),c=o%60;if(c>=60)s+=Math.floor(c/60),c%=60;if(s>=60)r+=Math.floor(s/60),s%=60;let u=Intl.DurationFormat;if(u)try{return new u(t,{style:"narrow"}).format({hours:r,minutes:s,seconds:r>0?0:c})}catch{}if(r>0)return s>0?`${r}h ${s}m`:`${r}h`;if(s>0)return c>0?`${s}m ${c}s`:`${s}m`;return`${c}s`}var fe="M7.52925 3.7793C7.75652 3.55203 8.10803 3.52383 8.36616 3.69434L8.47065 3.7793L14.2207 9.5293C14.4804 9.789 14.4804 10.211 14.2207 10.4707L8.47065 16.2207C8.21095 16.4804 7.78895 16.4804 7.52925 16.2207C7.26955 15.961 7.26955 15.539 7.52925 15.2793L12.8085 10L7.52925 4.7207L7.44429 4.61621C7.27378 4.35808 7.30198 4.00657 7.52925 3.7793Z";function S({expanded:e,className:t}){return a("svg",{className:b("codex-activity-disclosure",e&&"codex-activity-disclosure-expanded",t),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:a("path",{d:fe})})}function Ce(){return a("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:a("path",{d:"M16.3965 5.01128C16.3963 4.93399 16.3489 4.87691 16.293 4.85406L16.2354 4.84332C13.9306 4.91764 12.5622 5.32101 10.665 6.34722V16.3716C11.3851 15.9994 12.0688 15.7115 12.7861 15.5015C13.8286 15.1965 14.9113 15.0633 16.2402 15.0435L16.2979 15.0308C16.353 15.0063 16.3965 14.9483 16.3965 14.8755V5.01128ZM3.54492 14.8765C3.54492 14.9725 3.62159 15.0422 3.70117 15.0435L4.19629 15.0562C5.94062 15.1247 7.26036 15.4201 8.65918 16.0484C8.05544 15.1706 7.14706 14.436 6.17871 14.1109V14.1099C5.56757 13.9045 5.16816 13.3314 5.16797 12.6988V4.98882C4.86679 4.93786 4.60268 4.8999 4.28223 4.87457L3.72754 4.84429C3.62093 4.84079 3.54505 4.92417 3.54492 5.01226V14.8765ZM17.7266 14.8755C17.7266 15.6314 17.1607 16.2751 16.4121 16.3628L16.2598 16.3736C15.0122 16.3922 14.0555 16.5159 13.1602 16.7779C12.2629 17.0404 11.3966 17.4508 10.3369 18.0738C10.129 18.1959 9.87099 18.1958 9.66309 18.0738C7.71455 16.9283 6.31974 16.4689 4.12988 16.3853L3.68164 16.3736C2.85966 16.3614 2.21484 15.6838 2.21484 14.8765V5.01226C2.21497 4.15391 2.93263 3.4871 3.77246 3.51519L4.39844 3.54937C4.67996 3.57191 4.92258 3.60421 5.16797 3.64214V2.51031C5.16797 1.44939 6.29018 0.645615 7.31055 1.15679L7.31152 1.15582C8.78675 1.89511 10.0656 3.33006 10.5352 4.91461C12.3595 3.98907 13.8688 3.58817 16.1924 3.51324L16.3506 3.51714C17.1285 3.5741 17.7264 4.23496 17.7266 5.01128V14.8755ZM6.49805 12.6988C6.49824 12.7723 6.5442 12.8296 6.60254 12.8492L6.96289 12.9859C7.85245 13.3586 8.68125 13.9846 9.33496 14.7496V5.5816C9.08794 4.37762 8.13648 3.1566 6.95801 2.47613L6.71582 2.34527C6.67779 2.32617 6.6337 2.32502 6.58301 2.35796C6.52946 2.39279 6.49805 2.44863 6.49805 2.51031V12.6988Z"})})}function xe(){return a("svg",{className:"codex-activity-icon",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:a("path",{d:"M7.33057 1.98535C10.2484 1.98535 12.6136 4.3508 12.6138 7.26855C12.6138 8.58031 12.1346 9.77942 11.3433 10.7031L13.9897 13.3496C14.1655 13.5253 14.1655 13.8106 13.9897 13.9863C13.814 14.1621 13.5288 14.1621 13.353 13.9863L10.7017 11.335C9.78678 12.0942 8.61243 12.5518 7.33057 12.5518C4.41281 12.5516 2.04736 10.1864 2.04736 7.26855C2.04754 4.35091 4.41292 1.98553 7.33057 1.98535ZM7.33057 2.88574C4.90998 2.88592 2.94793 4.84796 2.94775 7.26855C2.94775 9.68929 4.90987 11.6522 7.33057 11.6523C9.75141 11.6523 11.7144 9.6894 11.7144 7.26855C11.7142 4.84786 9.75131 2.88574 7.33057 2.88574Z"})})}function ye(){return y("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:[a("path",{d:"M6.19629 7.86231C6.42357 7.63534 6.7752 7.60692 7.0332 7.77734L7.1377 7.86231L8.80371 9.5293C9.06329 9.78889 9.06307 10.21 8.80371 10.4697L7.1377 12.1367C6.878 12.3964 6.45599 12.3964 6.19629 12.1367C5.93686 11.8771 5.93697 11.456 6.19629 11.1963L7.39258 9.99902L6.19629 8.80371L6.11133 8.69922C5.94087 8.4411 5.96904 8.08955 6.19629 7.86231Z"}),a("path",{d:"M13.4668 11.0156C13.7699 11.0776 13.998 11.3456 13.998 11.667C13.9979 11.9883 13.7698 12.2564 13.4668 12.3184L13.333 12.332H10.833C10.466 12.3319 10.1682 12.034 10.168 11.667C10.168 11.2998 10.4659 11.0021 10.833 11.002H13.333L13.4668 11.0156Z"}),a("path",{d:"M12.6602 2.66504C13.3492 2.66504 13.9062 2.66439 14.3564 2.70117C14.8142 2.73859 15.2201 2.81796 15.5967 3.00977C16.1922 3.31321 16.677 3.79805 16.9805 4.39356C17.1722 4.77014 17.2517 5.17604 17.2891 5.63379C17.3258 6.08402 17.3252 6.64102 17.3252 7.33008V12.6602C17.3252 13.3492 17.3258 13.9062 17.2891 14.3564C17.2516 14.8142 17.1723 15.2201 16.9805 15.5967C16.677 16.1922 16.1922 16.677 15.5967 16.9805C15.2201 17.1723 14.8142 17.2516 14.3564 17.2891C13.9062 17.3258 13.3492 17.3252 12.6602 17.3252H7.33008C6.64102 17.3252 6.08402 17.3258 5.63379 17.2891C5.17604 17.2517 4.77014 17.1722 4.39356 16.9805C3.79805 16.677 3.31321 16.1922 3.00977 15.5967C2.81796 15.2201 2.73859 14.8142 2.70117 14.3564C2.66439 13.9062 2.66504 13.3492 2.66504 12.6602V7.33008C2.66504 6.64101 2.66439 6.08402 2.70117 5.63379C2.73858 5.17601 2.81797 4.77016 3.00977 4.39356C3.31321 3.79802 3.79802 3.31321 4.39356 3.00977C4.77016 2.81797 5.17601 2.73858 5.63379 2.70117C6.08402 2.66439 6.64101 2.66504 7.33008 2.66504H12.6602ZM7.33008 3.99512C6.61907 3.99512 6.1257 3.99601 5.74219 4.02734C5.3665 4.05804 5.15508 4.11481 4.99707 4.19531C4.65183 4.37124 4.37124 4.65183 4.19531 4.99707C4.11481 5.15508 4.05805 5.3665 4.02734 5.74219C3.99601 6.1257 3.99512 6.61908 3.99512 7.33008V12.6602C3.99512 13.3711 3.99601 13.8646 4.02734 14.248C4.05805 14.6237 4.11481 14.8352 4.19531 14.9932C4.37124 15.3384 4.65186 15.619 4.99707 15.7949C5.15507 15.8754 5.36654 15.9322 5.74219 15.9629C6.1257 15.9942 6.61908 15.9951 7.33008 15.9951H12.6602C13.3711 15.9951 13.8646 15.9942 14.248 15.9629C14.6237 15.9322 14.8352 15.8754 14.9932 15.7949C15.3384 15.619 15.619 15.3384 15.7949 14.9932C15.8754 14.8352 15.9322 14.6237 15.9629 14.248C15.9942 13.8646 15.9951 13.3711 15.9951 12.6602V7.33008C15.9951 6.61908 15.9942 6.1257 15.9629 5.74219C15.9322 5.36654 15.8754 5.15507 15.7949 4.99707C15.619 4.65186 15.3384 4.37124 14.9932 4.19531C14.8352 4.11481 14.6237 4.05805 14.248 4.02734C13.8646 3.99601 13.3711 3.99512 12.6602 3.99512H7.33008Z"})]})}function ve(){return a("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:a("path",{d:"M11.3312 4.20472C12.7488 2.92391 14.9377 2.96644 16.3039 4.33265L16.4318 4.46742C17.6713 5.8393 17.6713 7.93343 16.4318 9.30531L16.3039 9.44007L10.0119 15.7311C9.68839 16.0546 9.45384 16.2917 9.22185 16.4821L8.98748 16.6588C8.78233 16.799 8.56429 16.9196 8.33709 17.0192L8.10759 17.1119C7.92582 17.1785 7.73843 17.2266 7.52166 17.2711L6.75701 17.4069L4.36345 17.8053C4.22059 17.8291 4.06914 17.8552 3.9406 17.8649C3.84183 17.8723 3.70833 17.875 3.56267 17.8395L3.41423 17.7907C3.19121 17.695 3.00747 17.5271 2.89177 17.316L2.84588 17.2223C2.75958 17.0209 2.76174 16.8276 2.77166 16.6959C2.78136 16.5674 2.80742 16.4159 2.83123 16.2731L3.22966 13.8795L3.36443 13.1149C3.40899 12.898 3.45795 12.7108 3.52459 12.5289L3.61736 12.2985C3.71691 12.0715 3.83772 11.854 3.97771 11.6491L4.15349 11.4147C4.34392 11.1825 4.58171 10.9484 4.90545 10.6246L11.1965 4.33265L11.3312 4.20472ZM5.84588 11.5651C5.49671 11.9142 5.31258 12.0998 5.1867 12.2526L5.07537 12.3991C4.98194 12.5358 4.90157 12.6812 4.83513 12.8327L4.77361 12.9869C4.73328 13.0971 4.70248 13.2125 4.66814 13.3815L4.54119 14.0983L4.14275 16.4918L4.14177 16.4938H4.1447L6.53826 16.0944L7.25505 15.9684C7.42406 15.9341 7.53946 15.9033 7.64959 15.8629L7.80291 15.8014C7.95461 15.7349 8.09953 15.6538 8.2365 15.5602L8.38396 15.4498C8.53674 15.3239 8.72231 15.1398 9.07146 14.7907L14.0588 9.80238L10.8332 6.57679L5.84588 11.5651ZM15.3635 5.27308C14.5281 4.43776 13.2058 4.38573 12.3097 5.11683L12.1369 5.27308L11.7736 5.63636L15.0002 8.86195L15.3635 8.49964L15.5197 8.32581C16.2015 7.48961 16.2015 6.28311 15.5197 5.44691L15.3635 5.27308Z"})})}function he(){return a("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:a("path",{d:"M16.8347 7.91699C16.8347 7.76279 16.8266 7.61021 16.8123 7.45996L15.4705 8.80371C14.2903 9.98388 12.3762 9.98388 11.1961 8.80371C10.016 7.62352 10.0159 5.70942 11.1961 4.5293L12.5378 3.18652C12.3885 3.17238 12.237 3.16505 12.0837 3.16504C9.45947 3.16504 7.33179 5.29272 7.33179 7.91699C7.33184 8.56608 7.46162 9.18329 7.69605 9.74512C7.79981 9.9939 7.74311 10.2811 7.5525 10.4717L3.59547 14.4287C3.0498 14.9744 3.04991 15.8586 3.59547 16.4043L3.70191 16.501C4.25076 16.9483 5.05957 16.9158 5.57105 16.4043L9.52906 12.4473L9.60426 12.3828C9.79018 12.2455 10.0369 12.2131 10.2546 12.3037C10.8166 12.5382 11.4345 12.668 12.0837 12.668C14.7078 12.6678 16.8345 10.541 16.8347 7.91699ZM18.1648 7.91699C18.1646 11.2755 15.4423 13.9979 12.0837 13.998C11.4151 13.998 10.7708 13.8886 10.1677 13.6885L6.51246 17.3457C5.51389 18.3443 3.93332 18.406 2.86207 17.5322L2.65504 17.3457C1.58992 16.2806 1.58992 14.5534 2.65504 13.4883L6.31031 9.83203C6.1104 9.22921 6.00175 8.58526 6.00172 7.91699C6.00172 4.55818 8.72494 1.83496 12.0837 1.83496C12.7838 1.835 13.458 1.95316 14.0857 2.17188L14.1638 2.20508C14.3404 2.29325 14.4697 2.45713 14.5144 2.65234C14.5653 2.87533 14.4984 3.10876 14.3367 3.27051L12.1375 5.4707C11.4767 6.13148 11.4767 7.20251 12.1375 7.86328C12.7983 8.52373 13.8694 8.52395 14.53 7.86328L16.7293 5.66309L16.7937 5.60742C16.9499 5.48687 17.1532 5.44067 17.3484 5.48535C17.5714 5.53648 17.7526 5.69898 17.8279 5.91504C18.0466 6.54272 18.1648 7.21689 18.1648 7.91699Z"})})}function ee({block:e}){if(e.type!=="tool_use")return null;let t=m(e).category;if(t==="read")return a(Ce,{});if(t==="search"||t==="fetch")return a(xe,{});if(t==="execute")return a(ye,{});if(t==="edit")return a(ve,{});return a(he,{})}function E(e,t){let o=e.rawInput[t];return typeof o==="string"&&o.length>0?o:void 0}function we(e){return m(e).target}function q(e){return e.name.startsWith("mcp__")||e.name.startsWith("mcp_")}function te(e,t){let{category:o}=m(e),r=we(e),s=k(e.status);if(q(e))return{leading:e.title};if(o==="execute"){let c=E(e,"command")?.split(`
2
+ `)[0]??r;return c?{leading:t(s?"stream.codex.running":"stream.codex.ran"),trailing:c}:{leading:t(s?"stream.codex.runningCommand":"stream.codex.ranCommandGeneric")}}if(o==="search"){let c=E(e,"pattern")??E(e,"query")??r;return c?{leading:t(s?"stream.codex.searching":"stream.codex.searched"),trailing:t("stream.codex.forDetail",{detail:c})}:{leading:t(s?"stream.codex.searchingFiles":"stream.codex.searchedFiles")}}if(o==="fetch"){let c=E(e,"query")??E(e,"url")??r;return c?{leading:t(s?"stream.codex.searchingWeb":"stream.codex.searchedWeb"),trailing:t("stream.codex.forDetail",{detail:c})}:{leading:t(s?"stream.codex.searchingWeb":"stream.codex.searchedWeb")}}if(o==="read")return r?{leading:t("stream.codex.readLabel"),trailing:r}:{leading:t("stream.codex.readFiles")};if(o==="edit")return r?{leading:t(s?"stream.codex.editingLabel":"stream.codex.editedLabel"),trailing:r}:{leading:t(s?"stream.codex.editingFiles":"stream.codex.editedFiles")};if(o==="delete")return r?{leading:t(s?"stream.codex.deletingLabel":"stream.codex.deletedLabel"),trailing:r}:{leading:t(s?"stream.codex.deletingFiles":"stream.codex.deletedFiles")};if(o==="move")return r?{leading:t(s?"stream.codex.movingLabel":"stream.codex.movedLabel"),trailing:r}:{leading:t(s?"stream.codex.movingFiles":"stream.codex.movedFiles")};return{leading:e.title}}function Le(e,t){let o=te(e,t);return o.trailing===void 0?o.leading:`${o.leading} ${o.trailing}`}function Ne(e){return e.map((t)=>{if(t.type!=="content")return"";let o=t.content;return o.type==="text"?o.text:""}).filter(Boolean).join(`
3
+ `).trim()}function Te(e){return e.flatMap((t)=>{if(t.type!=="content")return[];let o=t.content;return o.type==="image"?[{data:o.data,mimeType:o.mimeType}]:[]})}function $e(e){return e.flatMap((t)=>{if(t.type!=="content")return[];let o=t.content;return o.type==="audio"?[{data:o.data,mimeType:o.mimeType}]:[]})}function ke(e){if(typeof e==="string"&&e.length>0)return e;return}function Ae(e){return e.type==="diff"}function Be(e){let t=e.content.find(Ae);if(t===void 0)return;return t.changes.map((o)=>`${o.operation} ${o.path}`).join(`
4
+ `)}function ne(e){let t=ke(e.rawOutput);if(t!==void 0)return t;let o=Ne(e.content);if(o.length>0)return o;return Be(e)}function Me({block:e,command:t}){let{t:o,Output:r,commandStatus:s}=n(),[c,u]=D(!1),[p,g]=D(!1),x=ne(e),l=s===void 0?e.exitCode===void 0?void 0:o("stream.codex.exitCode",{code:e.exitCode}):s(e),C=()=>{navigator.clipboard.writeText([`$ ${t}`,x].filter((w)=>w!==void 0).join(`
5
+ `)),u(!0),setTimeout(()=>u(!1),1500)};return a("div",{className:"codex-command-details",children:y("div",{className:"codex-command-card",children:[y("div",{className:"codex-command-line-row",children:[a("span",{className:"codex-command-prompt","aria-hidden":"true",children:"$"}),a("button",{type:"button",className:b("codex-command-line",!p&&"codex-command-line-clamped"),"data-codex-disclosure":"","aria-expanded":p,onClick:()=>g((w)=>!w),children:t}),a("button",{type:"button",className:"codex-command-copy","aria-label":o("actions.copy"),onClick:C,children:c?a(me,{}):a(pe,{})})]}),x!==void 0&&(r===void 0?a("pre",{className:"codex-command-output",children:x}):a(r,{text:x})),l!==void 0&&a("div",{className:"codex-command-footer",children:a("span",{className:"codex-command-status",children:l})})]})})}function ae({block:e}){let{t,openLink:o,Patch:r,openImage:s,commandStatus:c,expandToolOutput:u=!1}=n(),p=ne(e),g=r===void 0?void 0:e.content.flatMap((v)=>{if(v.type!=="diff")return[];let I=v;return I.patch?.text?[I.patch.text]:[]}).join(`
6
+ `),x=Te(e.content),l=$e(e.content),[C,w]=d(`tool:${e.id}`,!1),B=G(`tool:${e.id}`,C),L=m(e),N=L.category,h=te(e,t),R=N==="execute"?E(e,"command"):void 0,A=R!==void 0||q(e)||x.length>0||l.length>0||Boolean(g)||u&&p!==void 0,_=!A&&!k(e.status)?L.filePath:void 0;if(N==="execute"&&!k(e.status)&&e.status!=="completed"){let v=c?.(e);if(v)h={...h,leading:v}}if(N==="read"&&k(e.status))return null;let F=y("span",{className:"codex-activity-label",children:[a(ee,{block:e}),a("span",{className:"min-w-0 flex-1 truncate",children:k(e.status)?a("span",{className:"codex-activity-running",children:h.trailing===void 0?h.leading:`${h.leading} ${h.trailing}`}):y(U,{children:[a("span",{className:"codex-activity-leading",children:h.leading}),h.trailing!==void 0&&(_!==void 0?y(U,{children:[" ",a("button",{type:"button",className:"codex-activity-trailing codex-activity-file-link",title:_,onClick:()=>o(_),children:h.trailing})]}):y("span",{className:"codex-activity-trailing",children:[" ",h.trailing]}))]})})]});return y("div",{className:"codex-activity-item",children:[A?y("button",{type:"button",className:"codex-activity-header","data-codex-disclosure":"","aria-label":h.trailing===void 0?h.leading:`${h.leading} ${h.trailing}`,"aria-expanded":C,onClick:()=>w((v)=>!v),children:[F,a(S,{expanded:C})]}):a("div",{className:"codex-activity-header codex-activity-header-static",children:F}),a("div",{className:b("codex-activity-details-grid",C&&"codex-activity-details-grid-open"),children:a("div",{className:"min-h-0 overflow-hidden",children:B&&y(U,{children:[R!==void 0?a(Me,{block:e,command:R}):r!==void 0&&g?a(r,{patch:g}):p!==void 0&&a("pre",{className:"codex-activity-details",children:p}),x.length>0&&a("div",{className:"codex-activity-media",children:x.map((v)=>{let I=`data:${v.mimeType};base64,${v.data}`,z=a("img",{src:I,className:"max-h-48 max-w-full rounded-lg object-contain",alt:""},`${v.mimeType}:${v.data.slice(0,32)}`);return s===void 0?z:a("button",{type:"button",className:"cursor-pointer",onClick:()=>s(I),children:z},I)})}),l.map((v)=>a("audio",{className:"mt-1 w-full","aria-label":t("stream.codex.audioOutput"),controls:!0,src:`data:${v.mimeType};base64,${v.data}`},`${v.mimeType}:${v.data.slice(0,32)}`))]})})})]})}function oe({block:e}){if(e.type==="tool_use")return a(ae,{block:e});if(e.type==="thinking")return a(le,{block:e});if(e.type==="collab")return a(ce,{block:e});return a(ie,{block:e})}function ie({block:e}){let{t,openSession:o}=n(),r=k(e.status),[s,c]=d(`subagent:${e.id}`,r),u=H(r);Z(()=>{if(r)c(!0);if(u.current&&!r)c(!1);u.current=r},[r,c]);let p=`${Re(e.activity,r,e.name,t)}${re(e.model,e.reasoningEffort,t)}`,g=e.threadId??"",x=e.blocks.length>0;return y("div",{className:"codex-activity-item",children:[y("button",{type:"button",className:b("codex-activity-header",!x&&"codex-activity-header-static"),"data-codex-disclosure":"","aria-expanded":x?s:void 0,disabled:!x,onClick:()=>c((l)=>!l),children:[y("span",{className:"codex-activity-label",children:[a(Se,{seed:e.threadId??e.id}),a("span",{className:"min-w-0 flex-1 truncate",children:o===void 0||e.threadId===null?r?a("span",{className:"codex-activity-running",children:p}):p:a("span",{role:"link",tabIndex:0,className:b("codex-agent-link",r&&"codex-activity-running"),"aria-label":t("stream.codex.subagentOpen",{name:e.name}),onClick:(l)=>{l.stopPropagation(),o(g,e.name)},onKeyDown:(l)=>{if(l.key!=="Enter"&&l.key!==" ")return;l.preventDefault(),l.stopPropagation(),o(g,e.name)},children:p})})]}),x&&a(S,{expanded:s})]}),a("div",{className:b("codex-activity-details-grid",s&&"codex-activity-details-grid-open"),children:a("div",{className:"min-h-0 overflow-hidden",children:a("div",{className:"codex-subagent-details",children:e.blocks.map((l)=>{if(l.type==="tool_use")return a(ae,{block:l},l.id);if(l.type==="thinking")return a(le,{block:l},T(l));if(l.type==="subagent")return a(ie,{block:l},l.id);if(l.type==="collab")return a(ce,{block:l},l.id);if(l.type==="text")return a("div",{className:"codex-reasoning-details",children:a(i,{text:l.text,streaming:!1})},T(l));if(l.type==="plan")return a(f,{entries:l.entries},T(l));if(l.type==="image")return a("img",{src:`data:${l.source.media_type};base64,${l.source.data}`,className:"max-h-48 max-w-full rounded-lg object-contain",alt:""},T(l));return null})})})})]})}var Ie=8;function Ee(e){let t=0;for(let o=0;o<e.length;o+=1)t=(t*31+e.charCodeAt(o))%2147483647;return t%Ie}function Se({seed:e}){return a("span",{className:"codex-agent-avatar","data-hue":Ee(e),"aria-hidden":"true"})}function Re(e,t,o,r){switch(e){case"started":return r(t?"stream.codex.subagentWorking":"stream.codex.subagentFinished",{name:o});case"interacted":return r("stream.codex.subagentMessaged",{name:o});case"interrupted":return r("stream.codex.subagentInterrupted",{name:o});case"completed":return r("stream.codex.subagentFinished",{name:o})}}var _e=new Set(["none","minimal","low","medium","high","xhigh","max","ultra","persistent"]);function re(e,t,o){if(e===null)return"";if(t===null)return` · ${be(e)}`;let r=_e.has(t)?o(`stream.codex.reasoningEffort.${t}`):t;return` · ${be(e)} · ${r}`}var Fe={spawnAgent:"spawn",sendInput:"message",sendMessage:"message",followupTask:"message",interruptAgent:"interrupt",listAgents:"list",resumeAgent:"resume",closeAgent:"close"};function se(e){switch(e){case"pending":case"in_progress":return"inProgress";case"completed":return"completed";case"failed":return"failed";case"cancelled":case"interrupted":return"interrupted";default:throw Error(`Unknown ACP tool status: ${e}`)}}function j(e,t,o){if(e.tool==="wait")throw Error("Codex does not present wait calls");let r=se(e.status);if(r==="interrupted")return o("stream.codex.collab.interrupted");return o(`stream.codex.collab.${t}.${Fe[e.tool]}.${r}`)}function De(e){return e.agents.filter((t)=>t.nickname!==null)}function de(e,t){let o=e.agents.length>0?e.agents.length:1;return`${j(e,"header",t)}${t("stream.codex.collab.agentCount",{count:o})}`}var P="\x01";function V(e,t,o,r){let s=Object.fromEntries(Object.keys(r).map((c)=>[c,`${P}${c}${P}`]));return e(t,{...o,...s}).split(new RegExp(`${P}(\\w+)${P}`,"u")).map((c,u)=>a(ge,{children:u%2===1?r[c]:c},`${u}:${c}`))}function Pe({agent:e,showModel:t}){let{t:o,openSession:r}=n(),s=e.nickname??"",c=r===void 0?a("span",{className:"font-medium",children:s}):a("button",{type:"button",className:"codex-agent-link font-medium","aria-label":o("stream.codex.subagentOpen",{name:s}),onClick:()=>r(e.threadId,s),children:s});return y("span",{children:[c,e.role!==null&&` (${e.role})`,t&&re(e.model,e.reasoningEffort,o)]})}function Q({prompt:e}){return a("span",{className:"codex-collab-prompt",title:e,children:e})}function Ve(e,t){let o=e.prompt?.trim()?e.prompt:null,r=se(e.status),s=e.tool==="spawnAgent"&&r==="completed"&&o!==null,c=(e.tool==="sendInput"||e.tool==="sendMessage"||e.tool==="followupTask")&&o!==null,u=De(e),p=[];if(u.length===0)p.push({key:"generic",node:j(e,"row",t)});for(let g of u){let x=a(Pe,{agent:g,showModel:e.tool==="spawnAgent"});if(s)p.push({key:g.threadId,node:a("span",{className:"codex-collab-line",children:V(t,"stream.codex.collab.createdWithInstructions",{},{agent:x,instructions:a(Q,{prompt:o})})})});else if(c)p.push({key:g.threadId,node:a("span",{className:"codex-collab-line",children:V(t,"stream.codex.collab.messagedWithPrompt",{action:r==="interrupted"?t("stream.codex.collab.interrupted"):t(`stream.codex.collab.messaged.${r}`)},{agent:x,prompt:a(Q,{prompt:o})})})});else{let C=e.tool!=="closeAgent"&&e.tool!=="resumeAgent"&&g.state!==null&&g.state!==null?g.state.message?.trim()?t("stream.codex.collab.stateWithMessage",{state:t(`stream.codex.collab.state.${g.state.status}`),message:g.state.message}):t("stream.codex.collab.stateOnly",{state:t(`stream.codex.collab.state.${g.state.status}`)}):"";p.push({key:g.threadId,node:V(t,"stream.codex.collab.agentRow",{action:j(e,"row",t),state:C},{agent:x})})}}if(!s&&!c&&o!==null)p.push({key:"input",node:V(t,"stream.codex.collab.input",{},{prompt:a("span",{className:"codex-collab-input",children:o})})});return p}function ce({block:e}){let{t}=n(),[o,r]=d(`collab:${e.id}`,!1);if(e.tool==="wait")return null;let s=k(e.status),c=de(e,t);return y("div",{className:"codex-activity-item",children:[y("button",{type:"button",className:"codex-activity-header","data-codex-disclosure":"","aria-expanded":o,onClick:()=>r((u)=>!u),children:[y("span",{className:"codex-activity-label",children:[a(ue,{className:"size-4 shrink-0","aria-hidden":"true"}),a("span",{className:"min-w-0 flex-1 truncate",children:s?a("span",{className:"codex-activity-running",children:c}):c})]}),a(S,{expanded:o})]}),a("div",{className:b("codex-activity-details-grid",o&&"codex-activity-details-grid-open"),children:a("div",{className:"min-h-0 overflow-hidden",children:a("div",{className:"codex-subagent-details",children:Ve(e,t).map((u)=>a("div",{className:"codex-collab-row",children:u.node},u.key))})})})]})}function le({block:e}){let{t,i18n:o}=n(),r=Boolean(e.isComplete),[s,c]=d(`thinking:${T(e)}`,!1),u=H(null),p=e.thinking.trim().length>0;Z(()=>{if(r||!p)return;let l=u.current;if(l===null)throw Error("Thinking details are not mounted");let C=new ResizeObserver(()=>{l.scrollTop=l.scrollHeight}),w=null,B=()=>{let N=l.firstElementChild;if(N===w)return;if(w!==null)C.unobserve(w);if(w=N,w!==null)C.observe(w)},L=new MutationObserver(B);return L.observe(l,{childList:!0}),B(),()=>{L.disconnect(),C.disconnect()}},[p,r]);let g=r?e.durationMs!==void 0?t("stream.codex.thoughtFor",{duration:W(e.durationMs,o.language)}):t("stream.codex.thought"):t("message.thinking"),x=e.thinking.trimStart().replace(/^\*\*[^\n]*?\*\*\s*/,"");return y("div",{className:"codex-activity-item",children:[y("button",{type:"button",className:b("codex-activity-header",!p&&"codex-activity-header-static"),"data-codex-disclosure":"","aria-expanded":p?s:void 0,disabled:!p,onClick:()=>c((l)=>!l),children:[a("span",{className:"codex-activity-label",children:a("span",{className:"codex-reasoning-label min-w-0 flex-1 truncate",children:r?g:a("span",{className:"codex-activity-running",children:g})})}),p&&a(S,{expanded:s})]}),a("div",{className:b("codex-activity-details-grid",s&&"codex-activity-details-grid-open"),children:a("div",{className:"min-h-0 overflow-hidden",children:p&&a("div",{ref:u,className:"codex-reasoning-details",role:"region","aria-label":g,"aria-hidden":!s,tabIndex:0,inert:!s,children:a(i,{text:x,streaming:!r})})})})]})}function Oe(e){if(q(e))return"mcp";let t=m(e).category;return t==="think"||t==="switch_mode"?"other":t}function Ue(e,t,o,r){return r(`stream.codex.summary.${e}.${o?"leading":"following"}`,{count:t})}function Ze(e,t,o){let r=new Map;for(let c of e){let u=Oe(c);r.set(u,(r.get(u)??0)+1)}let s=Array.from(r,([c,u],p)=>Ue(c,u,p===0,t));if(o.startsWith("zh"))return s.join("");return new Intl.ListFormat(o,{style:"long",type:"conjunction"}).format(s)}function Pt({stateKey:e,durationMs:t,durationKind:o="work",active:r,defaultExpanded:s=r,startedAt:c,providerId:u,providerIcon:p,children:g}){let{t:x,i18n:l}=n(),[C,w]=d(`work:${e}`,s,!0),B=G(`work:${e}`,C||r),L=H(null),[N,h]=D(0);Z(()=>{if(!r||t!==void 0){L.current=null;return}L.current=c??Date.now();let A=()=>{let F=L.current;if(F===null)throw Error("Codex work section is ticking without a start time");h(Date.now()-F)};A();let _=window.setInterval(A,1000);return()=>window.clearInterval(_)},[r,c,t]);let R=t!==void 0?x(o==="total"?"stream.codex.totalDuration":"stream.codex.workedFor",{duration:W(t,l.language)}):r&&N>=1000?x("stream.codex.workingFor",{duration:W(N,l.language)}):x(r?"stream.codex.working":"stream.codex.worked");return y("section",{className:"codex-work-section",children:[y("button",{type:"button",className:"codex-work-trigger","data-codex-disclosure":"","aria-expanded":C,onClick:()=>w((A)=>!A),children:[u!==void 0&&a("span",{className:"codex-work-provider-icon","data-testid":"codex-work-provider-icon","data-provider-id":u,"aria-hidden":"true",children:p}),a("span",{children:R}),a(S,{expanded:C,className:"codex-work-chevron"})]}),a("div",{className:"codex-work-separator","aria-hidden":"true"}),a("div",{className:b("codex-work-grid",C&&"codex-work-grid-open"),"aria-hidden":!C,inert:!C,children:a("div",{className:"min-h-0 overflow-hidden",children:a("div",{className:"codex-work-body",children:B&&g})})})]})}function He(e,t){if(e.type==="tool_use")return Le(e,t);if(e.type==="thinking")return t("message.thinking");if(e.type==="collab")return de(e,t);return t("stream.codex.subagentWorking",{name:e.name})}function X(e){if(e.type==="thinking")return!e.isComplete;if(e.type==="tool_use"||e.type==="subagent"||e.type==="collab")return k(e.status);return!1}function We(e,t,o=1000){let[r,s]=D({text:e,live:t}),c=H(Date.now());return Z(()=>{if(e===r.text&&t===r.live)return;let u=Date.now(),p=Math.max(0,c.current+o-u);if(p===0||t!==r.live){c.current=u,s({text:e,live:t});return}let g=window.setTimeout(()=>{c.current=Date.now(),s({text:e,live:t})},p);return()=>window.clearTimeout(g)},[r,t,o,e]),t===r.live?r.text:e}function je({blocks:e}){let{t,i18n:o}=n(),r=e.some(X),s=T(e[0]),[c,u]=d(`group:${s}`,!0),p=G(`group:${s}`,c||r),g=e.findLast(X)??e.at(-1);if(g===void 0)throw Error("CodexActivityGroup requires at least one activity block");let x=e.filter((C)=>C.type==="tool_use"),l=We(r?He(g,t):Ze(x,t,o.language),r);return y("div",{className:"codex-activity-group",children:[y("button",{type:"button",className:"codex-activity-group-trigger","aria-expanded":c,onClick:()=>u((C)=>!C),children:[y("span",{className:"codex-activity-label",children:[a(ee,{block:e[0]}),a("span",{className:"truncate",children:r?a("span",{className:"codex-activity-running",children:l}):l})]}),a(S,{expanded:c})]}),a("div",{className:b("codex-activity-group-grid",c&&"codex-activity-group-grid-open"),children:a("div",{className:"min-h-0 overflow-hidden",children:a("div",{className:"codex-activity-group-body",children:p&&e.map((C)=>a(oe,{block:C},T(C)))})})})]})}function Y({blocks:e}){if(e.length===0)throw Error("CodexActivityGroup requires at least one activity block");if(e.length===1)return a(oe,{block:e[0]});return a(je,{blocks:e})}function O({blocks:e}){if(!e.some(M))return a(Y,{blocks:e});let t=[];for(let o of e){let r=t.at(-1);if(r&&M(r[0])===M(o))r.push(o);else t.push([o])}return a(U,{children:t.map((o)=>M(o[0])?a(Nt,{blocks:o.filter(M)},T(o[0])):a(Y,{blocks:o},T(o[0])))})}
7
+ export{Pt,O};