@alwith/module-chat 0.5.3 → 0.5.4
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.
- package/dist/activity-host.d.ts +2 -0
- package/dist/activity-host.js +1 -1
- package/dist/approval/choice-elicitation-form.js +1 -1
- package/dist/approval/choice-schema.js +1 -1
- package/dist/approval/permission-options.js +1 -1
- package/dist/approval/permission-view.js +1 -1
- package/dist/approval/schema-elicitation-form.js +1 -1
- package/dist/approval/url-elicitation-card.js +1 -1
- package/dist/{chunk-pcngn73n.js → chunk-0d8k5bmd.js} +2 -2
- package/dist/chunk-0fvpmcps.js +2 -0
- package/dist/{chunk-hesyytcd.js → chunk-0grd0g0x.js} +2 -2
- package/dist/chunk-0habpww5.js +2 -0
- package/dist/chunk-0hpww4x3.js +2 -0
- package/dist/{chunk-d4yhdesy.js → chunk-0k654tyt.js} +2 -2
- package/dist/chunk-0mf7yh69.js +2 -0
- package/dist/{chunk-pb6xtb3n.js → chunk-17wjmyj7.js} +2 -2
- package/dist/{chunk-9bjywaze.js → chunk-1drkvxzk.js} +1 -1
- package/dist/{chunk-cw68hvkc.js → chunk-1txn4b0v.js} +1 -1
- package/dist/{chunk-t2ceq16d.js → chunk-2s4y2v50.js} +2 -2
- package/dist/{chunk-zy6338m6.js → chunk-2ysnmwx1.js} +2 -2
- package/dist/{chunk-691gxr2e.js → chunk-367b1yab.js} +2 -2
- package/dist/{chunk-aaqk0jrt.js → chunk-3nj26hhf.js} +2 -2
- package/dist/{chunk-543v9eke.js → chunk-3ryhmzsq.js} +2 -2
- package/dist/{chunk-x71x2atx.js → chunk-3wsg6710.js} +2 -2
- package/dist/{chunk-h80g3eme.js → chunk-3x1eq95a.js} +2 -2
- package/dist/{chunk-zwvyfjj8.js → chunk-4jagfjhm.js} +2 -2
- package/dist/chunk-4pbh3fph.js +2 -0
- package/dist/{chunk-8r010kvn.js → chunk-5s2wpbdt.js} +1 -1
- package/dist/{chunk-9x4et210.js → chunk-5t3rrnfd.js} +2 -2
- package/dist/{chunk-4mnf89r3.js → chunk-5wyxvpgt.js} +1 -1
- package/dist/{chunk-xem94nq0.js → chunk-65jedxc3.js} +3 -3
- package/dist/{chunk-1dp50khb.js → chunk-68y66m3v.js} +2 -2
- package/dist/{chunk-t9vvcy09.js → chunk-69yx37pv.js} +3 -3
- package/dist/chunk-6d38ff76.js +2 -0
- package/dist/{chunk-w99ah6qt.js → chunk-6j4g51ff.js} +3 -3
- package/dist/chunk-6pq1xmwg.js +2 -0
- package/dist/{chunk-npjw8dm5.js → chunk-6vqnsdgc.js} +1 -1
- package/dist/chunk-76tkqx9n.js +2 -0
- package/dist/{chunk-w92s8704.js → chunk-78ew0821.js} +5 -5
- package/dist/chunk-7e1m1d9x.js +2 -0
- package/dist/chunk-88vkk9s3.js +2 -0
- package/dist/{chunk-eyre28p1.js → chunk-8bzk9e4v.js} +2 -2
- package/dist/{chunk-aygzz2yg.js → chunk-8fn5n4yv.js} +2 -2
- package/dist/chunk-8p0074ye.js +2 -0
- package/dist/chunk-91trh8rj.js +2 -0
- package/dist/{chunk-cr294svm.js → chunk-93q2dm10.js} +1 -1
- package/dist/chunk-94k9byb1.js +2 -0
- package/dist/chunk-9c41y5hw.js +2 -0
- package/dist/{chunk-4dcagj01.js → chunk-a2ftkzak.js} +1 -1
- package/dist/{chunk-jnfp7j32.js → chunk-an03g9e8.js} +2 -2
- package/dist/{chunk-n3raktzz.js → chunk-bwas6kp2.js} +2 -2
- package/dist/{chunk-hwwhxb3x.js → chunk-c6w4bp15.js} +1 -1
- package/dist/{chunk-a7mr12yc.js → chunk-cg97byvk.js} +1 -1
- package/dist/{chunk-kbvkr5mr.js → chunk-cywx4qmv.js} +1 -1
- package/dist/chunk-d2rrvka6.js +2 -0
- package/dist/chunk-dcxprfnp.js +2 -0
- package/dist/chunk-dsdxw9s8.js +2 -0
- package/dist/{chunk-zcrct67v.js → chunk-ehh31hzz.js} +1 -1
- package/dist/{chunk-86kkb0z4.js → chunk-epqjzw63.js} +2 -2
- package/dist/{chunk-87t0qtkr.js → chunk-f0sbnmcs.js} +4 -4
- package/dist/chunk-fwd1zewt.js +2 -0
- package/dist/{chunk-jdv29apq.js → chunk-fzetrkvd.js} +2 -2
- package/dist/{chunk-33mgpcnd.js → chunk-gb2dmt6b.js} +2 -2
- package/dist/{chunk-802bgza1.js → chunk-gmhbqxcg.js} +2 -2
- package/dist/chunk-gsq8mzr7.js +2 -0
- package/dist/{chunk-bycbj1aq.js → chunk-gtddnhdy.js} +2 -2
- package/dist/chunk-gwav4k8b.js +2 -0
- package/dist/{chunk-wqwqx3hc.js → chunk-gy63n5pz.js} +1 -1
- package/dist/chunk-h05s12jn.js +3 -0
- package/dist/chunk-h7gq5y52.js +2 -0
- package/dist/chunk-h9tnsvjr.js +2 -0
- package/dist/{chunk-3jcxkpvs.js → chunk-hhw1pjz6.js} +2 -2
- package/dist/{chunk-51qsyrd6.js → chunk-hjm26kwf.js} +1 -1
- package/dist/chunk-hmj7yqyb.js +3 -0
- package/dist/{chunk-tre0r8qm.js → chunk-hmze7f10.js} +2 -2
- package/dist/{chunk-p0cc67an.js → chunk-hrexfky6.js} +2 -2
- package/dist/{chunk-w2tmm1va.js → chunk-jd61cfkk.js} +2 -2
- package/dist/{chunk-fqj76wq8.js → chunk-jwb3723b.js} +2 -2
- package/dist/chunk-k2zg8xva.js +2 -0
- package/dist/{chunk-0j15twx6.js → chunk-kg1gk77d.js} +2 -2
- package/dist/chunk-kh1tc15g.js +2 -0
- package/dist/chunk-m4mfw5s4.js +7 -0
- package/dist/{chunk-r6e2abj6.js → chunk-m5jhw1e6.js} +2 -2
- package/dist/{chunk-e3mkvx24.js → chunk-mgt5j803.js} +1 -1
- package/dist/{chunk-6fht8rx9.js → chunk-mv8jmv1e.js} +2 -2
- package/dist/{chunk-ptt7q7za.js → chunk-n4cseazv.js} +3 -3
- package/dist/{chunk-2snmjnz9.js → chunk-nb5wjv92.js} +2 -2
- package/dist/{chunk-ek06eyp4.js → chunk-nx91ewps.js} +1 -1
- package/dist/chunk-p2s04v76.js +2 -0
- package/dist/{chunk-ckp6661s.js → chunk-pkgrt90z.js} +2 -2
- package/dist/chunk-py1t2v6e.js +2 -0
- package/dist/chunk-q2ppgpfd.js +2 -0
- package/dist/chunk-q3hdevem.js +2 -0
- package/dist/chunk-q4y1q1na.js +2 -0
- package/dist/{chunk-zzwnpk4q.js → chunk-q98941j2.js} +2 -2
- package/dist/{chunk-0vvn08gg.js → chunk-qbj5s8qa.js} +2 -2
- package/dist/{chunk-qpz97p1m.js → chunk-qgfq5vrz.js} +1 -1
- package/dist/{chunk-8mvg9a32.js → chunk-qqdca2rm.js} +2 -2
- package/dist/{chunk-mk10tgjk.js → chunk-r7c0tca8.js} +2 -2
- package/dist/{chunk-qf3a35g4.js → chunk-r8z8f31m.js} +2 -2
- package/dist/{chunk-awrzpp7x.js → chunk-rd94eyan.js} +2 -2
- package/dist/{chunk-b5g1j1zv.js → chunk-rdtj6bad.js} +2 -2
- package/dist/{chunk-23wzpgbs.js → chunk-rgkhm4s4.js} +2 -2
- package/dist/chunk-s44rx1sz.js +3 -0
- package/dist/{chunk-d6nxypzc.js → chunk-scddkjv8.js} +1 -1
- package/dist/{chunk-st90r31c.js → chunk-sj7jdb7m.js} +1 -1
- package/dist/chunk-spt7tnqx.js +2 -0
- package/dist/{chunk-8kjsqjy6.js → chunk-sqh158m4.js} +1 -1
- package/dist/{chunk-hmtgx7fw.js → chunk-syv6gady.js} +2 -2
- package/dist/{chunk-j4teycge.js → chunk-tpx841s3.js} +2 -2
- package/dist/{chunk-20re64ta.js → chunk-ttk21631.js} +2 -2
- package/dist/chunk-twwqgd8e.js +2 -0
- package/dist/{chunk-rqbbb37p.js → chunk-tzjk7zkc.js} +2 -2
- package/dist/{chunk-maj7m5s7.js → chunk-v5wwv2t9.js} +2 -2
- package/dist/{chunk-dfengqjx.js → chunk-wjs8bwpk.js} +2 -2
- package/dist/{chunk-h4sw0pez.js → chunk-wrs447cs.js} +2 -2
- package/dist/chunk-x053g6f2.js +2 -0
- package/dist/{chunk-cj5pkg2y.js → chunk-xf14bg2v.js} +3 -3
- package/dist/{chunk-dzydvx7r.js → chunk-xfjcwypy.js} +3 -3
- package/dist/{chunk-ncekagm6.js → chunk-xjtqdp82.js} +1 -1
- package/dist/{chunk-9v2gk9ex.js → chunk-xp0nfvxg.js} +2 -2
- package/dist/{chunk-3m06tqqk.js → chunk-xw0gvwh5.js} +2 -2
- package/dist/{chunk-3nmqebb6.js → chunk-y438yezf.js} +3 -3
- package/dist/chunk-y6r6tzfh.js +2 -0
- package/dist/{chunk-mgakm5yv.js → chunk-yegh80h4.js} +2 -2
- package/dist/{chunk-tptnjbrd.js → chunk-yf2p44mq.js} +2 -2
- package/dist/{chunk-cgxcxfh1.js → chunk-yg42bpjr.js} +3 -3
- package/dist/chunk-yhmb3z56.js +2 -0
- package/dist/{chunk-0n82kdek.js → chunk-z3e38981.js} +2 -2
- package/dist/{chunk-px7xxz3v.js → chunk-z4zm74ge.js} +2 -2
- package/dist/{chunk-k50475tn.js → chunk-z75zbdq8.js} +1 -1
- package/dist/{chunk-mmdpwbef.js → chunk-zc2hdmk1.js} +2 -2
- package/dist/codex/activity-group.d.ts +2 -1
- package/dist/codex/activity-group.js +1 -1
- package/dist/codex/assistant-message.js +1 -1
- package/dist/codex/async-question-card.js +1 -1
- package/dist/codex/edited-files-card.js +1 -1
- package/dist/codex/image-view-activity.js +1 -1
- package/dist/codex/markdown-renderer.js +1 -1
- package/dist/codex/navigation-audio.js +1 -1
- package/dist/codex/navigation-preview.js +1 -1
- package/dist/codex/navigation-rail.js +1 -1
- package/dist/codex/patch-view.js +1 -1
- package/dist/codex/timeline-virtualizer.js +1 -1
- package/dist/codex/turn-activity.d.ts +14 -0
- package/dist/codex/turn-activity.js +1 -0
- package/dist/codex/user-message.d.ts +3 -2
- package/dist/codex/user-message.js +1 -1
- package/dist/codex/virtualized-turn-list.js +1 -1
- package/dist/composer/completion-filter.js +1 -1
- package/dist/composer/completion-menu.js +1 -1
- package/dist/composer/completion-trigger.js +1 -1
- package/dist/composer/effort-slider.js +1 -1
- package/dist/composer/menu-radio.js +1 -1
- package/dist/composer/model-select.js +1 -1
- package/dist/composer/permission-mode-select.js +1 -1
- package/dist/composer/prompt-input-attachments.js +1 -1
- package/dist/composer/prompt-input-clipboard.js +1 -1
- package/dist/composer/prompt-input-context.js +1 -1
- package/dist/composer/prompt-input-textarea.js +1 -1
- package/dist/composer/prompt-input.js +1 -1
- package/dist/conversation/action-card.js +1 -1
- package/dist/conversation/composer/composer.js +1 -1
- package/dist/conversation/composer/config-options.js +1 -1
- package/dist/conversation/composer/context.js +1 -1
- package/dist/conversation/composer/drafts.js +1 -1
- package/dist/conversation/composer/file-items.js +1 -1
- package/dist/conversation/composer/long-text.js +1 -1
- package/dist/conversation/composer/mention-chips.js +1 -1
- package/dist/conversation/composer/mention-uri.js +1 -1
- package/dist/conversation/composer/model-menu.js +1 -1
- package/dist/conversation/composer/pasted-text-attachment.js +1 -1
- package/dist/conversation/composer/permission-mode-menu.js +1 -1
- package/dist/conversation/composer/prediction.d.ts +1 -1
- package/dist/conversation/composer/prediction.js +1 -1
- package/dist/conversation/composer/slash-command-button.js +1 -1
- package/dist/conversation/composer/submit-button.js +1 -1
- package/dist/conversation/composer/usage-meter.js +1 -1
- package/dist/conversation/context.js +1 -1
- package/dist/conversation/conversation-body.js +1 -1
- package/dist/conversation/conversation-view.d.ts +1 -0
- package/dist/conversation/conversation-view.js +1 -1
- package/dist/conversation/conversation.js +1 -1
- package/dist/conversation/diff-modal.js +1 -1
- package/dist/conversation/session-actions.js +1 -1
- package/dist/image-lightbox.js +1 -1
- package/dist/image-preview-dialog.js +1 -1
- package/dist/lib/code-highlighter.js +1 -1
- package/dist/lib/fuzzy.js +1 -1
- package/dist/lib/group-blocks.js +1 -1
- package/dist/lib/image-encode.js +1 -1
- package/dist/lib/limits.js +1 -1
- package/dist/lib/markdown-parser.js +1 -1
- package/dist/lib/markdown-rules.js +1 -1
- package/dist/lib/model-name.js +1 -1
- package/dist/lib/pointer-centered-zoom.js +1 -1
- package/dist/lib/prepare-prompt-files.js +1 -1
- package/dist/lib/stream-style.js +1 -1
- package/dist/lib/streaming-markdown.js +1 -1
- package/dist/locales.d.ts +24 -8
- package/dist/locales.js +1 -1
- package/dist/search/chat-search.d.ts +2 -1
- package/dist/search/chat-search.js +1 -1
- package/dist/search/dom-matches.d.ts +1 -0
- package/dist/search/dom-matches.js +1 -1
- package/dist/search/find-bar.js +1 -1
- package/dist/search/literal-matches.js +1 -1
- package/dist/session-list/archived-sessions.js +1 -1
- package/dist/session-list/highlight.js +1 -1
- package/dist/session-list/host.js +1 -1
- package/dist/session-list/hover-info-card.js +1 -1
- package/dist/session-list/navigation.js +1 -1
- package/dist/session-list/overflow-marquee.js +1 -1
- package/dist/session-list/row-stop-button.js +1 -1
- package/dist/session-list/session-groups.js +1 -1
- package/dist/session-list/session-info-card.js +1 -1
- package/dist/session-list/session-list.css +6 -4
- package/dist/session-list/session-list.js +1 -1
- package/dist/session-list/session-row.js +1 -1
- package/dist/session-list/session-state-dot.js +1 -1
- package/dist/session-list/sidebar-overlay.js +1 -1
- package/dist/session-list/trailing-swap.js +1 -1
- package/dist/session-list/use-activity-preview.js +1 -1
- package/dist/session-list/use-project-sessions.js +1 -1
- package/dist/session-timeline/activity-group.js +1 -1
- package/dist/session-timeline/activity-projection.js +1 -1
- package/dist/session-timeline/assistant-content.js +1 -1
- package/dist/session-timeline/assistant-turn.js +1 -1
- package/dist/session-timeline/async-questions.js +1 -1
- package/dist/session-timeline/edited-files-card.js +1 -1
- package/dist/session-timeline/history-timeline.js +1 -1
- package/dist/session-timeline/host.js +1 -1
- package/dist/session-timeline/navigation-rail.js +1 -1
- package/dist/session-timeline/plan.js +1 -1
- package/dist/session-timeline/question-reply.js +1 -1
- package/dist/session-timeline/resource-content.js +1 -1
- package/dist/session-timeline/session-timeline.js +1 -1
- package/dist/session-timeline/timeline-registry.d.ts +2 -0
- package/dist/session-timeline/timeline-registry.js +1 -1
- package/dist/session-timeline/turn-activity.d.ts +3 -0
- package/dist/session-timeline/turn-activity.js +1 -0
- package/dist/session-timeline/turn-error.js +1 -1
- package/dist/session-timeline/turn-retry.js +1 -1
- package/dist/session-timeline/turn-time.js +1 -1
- package/dist/session-timeline/turns.d.ts +1 -0
- package/dist/session-timeline/turns.js +1 -1
- package/dist/session-timeline/use-timeline-scroll.js +1 -1
- package/dist/session-timeline/user-message.js +1 -1
- package/dist/ui/alert.js +1 -1
- package/dist/ui/badge.js +1 -1
- package/dist/ui/button.js +1 -1
- package/dist/ui/card.js +1 -1
- package/dist/ui/checkbox.js +1 -1
- package/dist/ui/dialog.js +1 -1
- package/dist/ui/dropdown-menu.js +1 -1
- package/dist/ui/empty.js +1 -1
- package/dist/ui/field.js +1 -1
- package/dist/ui/hover-card.js +1 -1
- package/dist/ui/input-group-textarea.js +1 -1
- package/dist/ui/input-group.js +1 -1
- package/dist/ui/kbd.js +1 -1
- package/dist/ui/label.js +1 -1
- package/dist/ui/radio-group.js +1 -1
- package/dist/ui/select.js +1 -1
- package/dist/ui/switch.js +1 -1
- package/dist/ui/textarea.js +1 -1
- package/dist/ui/tooltip.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-0pa5t12s.js +0 -2
- package/dist/chunk-14a9wet3.js +0 -2
- package/dist/chunk-1wc83vxg.js +0 -2
- package/dist/chunk-20bww40d.js +0 -2
- package/dist/chunk-20gtemb9.js +0 -2
- package/dist/chunk-2b185a0a.js +0 -2
- package/dist/chunk-2sy8cs84.js +0 -2
- package/dist/chunk-30g0y24x.js +0 -2
- package/dist/chunk-4d8q9bpy.js +0 -2
- package/dist/chunk-67txww0x.js +0 -2
- package/dist/chunk-6ndz2pf9.js +0 -2
- package/dist/chunk-7gaper2w.js +0 -2
- package/dist/chunk-asxwsg2p.js +0 -2
- package/dist/chunk-ctedwb0a.js +0 -3
- package/dist/chunk-czahfwp7.js +0 -2
- package/dist/chunk-d25r0vq3.js +0 -2
- package/dist/chunk-dnn8064m.js +0 -2
- package/dist/chunk-dqw30cz4.js +0 -2
- package/dist/chunk-e43pfcrt.js +0 -2
- package/dist/chunk-hr9d9zpb.js +0 -2
- package/dist/chunk-jf5651fz.js +0 -2
- package/dist/chunk-jmx0awnf.js +0 -2
- package/dist/chunk-maepz12p.js +0 -3
- package/dist/chunk-r41p7378.js +0 -2
- package/dist/chunk-rzajhyrq.js +0 -2
- package/dist/chunk-sc746nr6.js +0 -2
- package/dist/chunk-sgbde4dv.js +0 -2
- package/dist/chunk-tgb70x2n.js +0 -2
- package/dist/chunk-tj44vjyv.js +0 -2
- package/dist/chunk-vxnjsga5.js +0 -2
- package/dist/chunk-vyzzs0nc.js +0 -7
- package/dist/chunk-w0y1svj7.js +0 -3
- package/dist/chunk-wtk721nx.js +0 -2
- package/dist/chunk-x3b4dpac.js +0 -2
- package/dist/chunk-yx02h2ja.js +0 -2
- package/dist/chunk-z8fdvq3v.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{o}from"./chunk-6d38ff76.js";import{ne,Pe,st}from"./chunk-n4cseazv.js";import{jsx as n,jsxs as m,Fragment as r}from"react/jsx-runtime";var c=[];function at({sessionId:s}){let e=o((i)=>i.actions),l=e.some((i)=>i.sessionId===s)?e.filter((i)=>i.sessionId===s):c,t=l.filter(ne),a=l.filter((i)=>!ne(i));return m(r,{children:[a.length>0&&n("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-3 px-6 pb-3","data-session-actions":!0,children:a.map((i)=>n(st,{action:i},i.id))}),t[0]!==void 0&&n(Pe,{action:t[0],total:t.length},t[0].id)]})}
|
|
2
|
+
export{at};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o}from"./chunk-
|
|
2
|
-
export{
|
|
1
|
+
import{o}from"./chunk-6d38ff76.js";import{Re,Me,Ee}from"./chunk-sqh158m4.js";import{n}from"./chunk-76tkqx9n.js";import{y,G}from"./chunk-9c41y5hw.js";import{hasAccount as D}from"@nyssance/codex-acp-v2/client";import{cn as M}from"cn";import{useEffect as C,useState as L}from"react";import{jsx as a,jsxs as u}from"react/jsx-runtime";var d=new Intl.NumberFormat("en-US",{maximumFractionDigits:0}),H=new Intl.NumberFormat("en-US",{style:"percent",maximumFractionDigits:1}),T=new Intl.NumberFormat("en-US",{maximumFractionDigits:1});function p(e){return typeof e==="number"&&!Number.isNaN(e)?Math.max(0,e):0}function W(e,t){let r=Math.min(100,e/t*100),s=r>=90?"text-destructive":r>=70?"text-foreground":"text-muted-foreground";return{pct:r,className:s}}function F(e){let t=y(e.configOptions,"model");return t===void 0?void 0:G(t)}function bn(e,t){let r=e.windowDurationMins;if(r===null)return t("usage.usage");if(r%1440===0)return t("usage.windowDays",{count:r/1440});return t("usage.windowHours",{count:Math.round(r/60)})}function z(){let{client:e}=n(),t=o((i)=>i.connection==="ready"&&D(i.agent)),[r,s]=L(null);return C(()=>{if(!t){s(null);return}let i=!0;e.readRateLimits().then((m)=>{if(i)s(m)},()=>{return});let l=e.onRateLimits((m)=>{if(i)s(m)});return()=>{i=!1,l()}},[t,e]),r}function Ke({session:e}){let{t}=n().host,r=z(),{usage:s,lastTurnUsage:i}=e;if(s===null&&i===null)return null;let l=s&&s.size>0?W(s.used,s.size):null,m=7,N=2*Math.PI*m,x=p(i?.inputTokens),h=p(i?.outputTokens),f=p(i?.cachedReadTokens),v=p(i?.cachedWriteTokens),b=p(i?.totalTokens)||x+h+f+v,k=x+f,w=k>0?H.format(f/k):t("tokens.notAvailable"),R=[[t("tokens.input"),d.format(x)],[t("tokens.output"),d.format(h)],[t("tokens.cachedRead"),d.format(f)],[t("tokens.cachedWrite"),d.format(v)],[t("tokens.cacheHitRate"),w],[t("tokens.total"),d.format(b)]],g=F(e);return u(Re,{children:[a(Me,{delay:100,closeDelay:100,render:u("button",{type:"button",className:M("hover:text-foreground flex h-7 items-center gap-1.5 rounded-md px-1.5 text-xs tabular-nums",l?.className??"text-muted-foreground"),"aria-label":t("tokens.openDetails"),children:[u("svg",{viewBox:"0 0 18 18",className:"size-4","aria-hidden":"true",children:[a("circle",{cx:"9",cy:"9",r:m,fill:"none",stroke:"currentColor",strokeOpacity:"0.2",strokeWidth:"2"}),l!==null&&a("circle",{cx:"9",cy:"9",r:m,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:N,strokeDashoffset:N*(1-l.pct/100),transform:"rotate(-90 9 9)"})]}),l!==null&&u("span",{children:[Math.round(l.pct),"%"]})]})}),u(Ee,{align:"end",side:"top",sideOffset:8,className:"w-56 p-0",children:[g!==void 0&&a("div",{className:"border-b px-3 py-2",children:a("p",{className:"text-foreground truncate text-xs font-semibold",title:g,children:g})}),u("div",{className:"flex flex-col gap-3 p-3",children:[i!==null&&u("div",{className:"flex flex-col gap-1.5",children:[a("p",{className:"text-xs font-medium",children:t("tokens.openDetails")}),a("dl",{className:"grid grid-cols-[1fr_auto] gap-x-4 gap-y-1 text-xs",children:R.map(([c,S])=>u("div",{className:"contents",children:[a("dt",{className:"text-muted-foreground",children:c}),a("dd",{className:"text-end tabular-nums",children:S})]},c))})]}),s!==null&&s.size>0&&u("div",{className:"flex flex-col gap-1.5 border-t pt-2",children:[a("p",{className:"text-xs font-medium",children:t("tokens.context")}),a("p",{className:"text-muted-foreground text-xs tabular-nums",children:t("tokens.contextSummary",{used:d.format(s.used),limit:d.format(s.size),percent:T.format(s.used/s.size*100)})})]}),r!==null&&(r.primary!==null||r.secondary!==null)&&u("div",{className:"flex flex-col gap-1.5 border-t pt-2",children:[a("p",{className:"text-xs font-medium",children:t("usage.limits")}),a("dl",{className:"grid grid-cols-[1fr_auto] gap-x-4 gap-y-1 text-xs",children:[r.primary,r.secondary].filter((c)=>c!==null).map((c)=>u("div",{className:"contents",children:[a("dt",{className:"text-muted-foreground",children:bn(c,t)}),a("dd",{className:"text-end tabular-nums",children:t("usage.used",{percent:Math.round(Math.min(100,Math.max(0,c.usedPercent)))})})]},`${c.windowDurationMins??"window"}`))})]})]})]})]})}
|
|
2
|
+
export{bn,Ke};
|
|
@@ -1,2 +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
|
|
2
|
-
export{
|
|
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 Uo(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{Uo};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Fo}from"./chunk-q4y1q1na.js";import{isPlanItems as o}from"@alwith/api";function Oo(s,r){let n=s.items.findLast((e)=>e.kind!=="user"),a=s.items.map((e)=>{switch(e.kind){case"user":return{key:e.id,kind:"user",active:!1};case"tool":return{key:e.id,kind:"tool",active:e.status==="pending"||e.status==="in_progress"};case"compaction":return{key:e.id,kind:"compaction",active:e.status==="in_progress"};case"plan":return{key:e.id,kind:"plan",active:o(e.plan)&&e.plan.entries.some((t)=>t.status==="in_progress")};case"thought":return{key:e.id,kind:"reasoning",active:e===n};case"assistant":{let t=e._meta?.codex,i=typeof t==="object"&&t!==null&&(("messageCompleted"in t)&&t.messageCompleted===!0||("messageCompletedAt"in t)&&typeof t.messageCompletedAt==="number");return{key:e.id,kind:s.final.includes(e)?"answer":"text",active:e===n&&!i}}}});return Fo(a,r)}
|
|
2
|
+
export{Oo};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{o}from"./chunk-6d38ff76.js";import{n}from"./chunk-76tkqx9n.js";import{isBooleanOption as T,isSelectOption as w}from"@alwith/api";import{codexExtensionCapabilities as j,codexTurnId as B,composerPrediction as F}from"@nyssance/codex-acp-v2/client";import{useEffect as b,useRef as C,useState as P}from"react";function Ze(t,g,c,y){let{client:S}=n(),R=o((e)=>j(e.agent).composerPredictions),k=t.items.findLast((e)=>e.kind==="user"),i=B(k?._meta),O=t.configOptions.flatMap((e)=>w(e)||T(e)?[[e.configId,e.currentValue]]:[]).sort(([e],[u])=>String(e).localeCompare(String(u))),r=JSON.stringify([t.id,i,O]),s=F(t._meta),d=t._meta?.codex,m=typeof d==="object"&&d!==null&&"prediction"in d?d.prediction:null,l=C(null),f=C(!1);b(()=>(f.current=!0,()=>{f.current=!1}),[]);let[a,_]=P(null),[v,x]=P(null),p=y&&R&&g&&t.state==="idle"&&t.lastStopReason==="end_turn"&&!k?.replayed&&i!==null;b(()=>{if(!p||c||a===r||l.current?.key===r||i===null)return;let e={key:r,previousResult:m};l.current=e,x(null),S.requestPrediction(t.id,i).catch((u)=>{if(f.current&&l.current===e)x({key:r,message:u instanceof Error?u.message:String(u)})})},[S,p,c,a,r,m,t.id,i]);let I=p&&!c&&a!==r&&l.current?.key===r&&l.current.previousResult!==m&&s?.sourceTurnId===i,q=I&&s.result.type==="completed"?s.result.text:null,E=y&&g&&t.state==="idle"&&!c&&a!==r?v?.key===r?v.message:I&&s.result.type==="failed"?"Prediction failed":null:null;return{text:q,error:E,invalidate:()=>{if(p)_(r)}}}
|
|
2
|
+
export{Ze};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cn as e}from"cn";import{jsx as o}from"react/jsx-runtime";function
|
|
1
|
+
import{cn as e}from"cn";import{jsx as o}from"react/jsx-runtime";function Un({className:t,...n}){return o("kbd",{"data-slot":"kbd",className:e("pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3",t),...n})}function ei({className:t,...n}){return o("kbd",{"data-slot":"kbd-group",className:e("inline-flex items-center gap-1",t),...n})}export{Un,ei};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createStore as r}from"@alwith/api/client";var Yt=r({sessionId:null,turns:[],api:null,beforeReveal:null,terminals:{}});function Co(e){Yt.setState({...e,terminals:e.terminals??{}})}function To(e){if(Yt.getState().sessionId===e)Yt.setState({sessionId:null,turns:[],api:null,beforeReveal:null,terminals:{}})}async function bi(e,t,n){let i=Yt.getState();if(n.aborted||e===null||i.sessionId!==e||i.api===null)return;if(i.beforeReveal===null)throw Error("Mounted timeline has no navigation lifecycle");i.beforeReveal(),await i.api.scrollToKey(t,void 0,{align:"top"})}
|
|
2
|
+
export{Yt,Co,To,bi};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{isGroupedSelect as i,isSelectOption as o}from"@alwith/api";function I(e){return i(e.options)?e.options.flatMap((t)=>t.options):e.options}function y(e,t){return e.find((n)=>n.category===t&&o(n))}function G(e){return I(e).find((t)=>t.value===e.currentValue)?.name??e.currentValue}
|
|
2
|
+
export{I,y,G};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cva as s}from"class-variance-authority";import{cn as a}from"cn";import{jsx as r}from"react/jsx-runtime";var n=s("group/alert relative grid w-full gap-0.5 rounded-lg border px-4 py-3 text-start text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pe-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"}},defaultVariants:{variant:"default"}});function O({className:t,variant:e,...o}){return r("div",{"data-slot":"alert",role:"alert",className:a(n({variant:e}),t),...o})}function $t({className:t,...e}){return r("div",{"data-slot":"alert-title",className:a("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",t),...e})}function F({className:t,...e}){return r("div",{"data-slot":"alert-description",className:a("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",t),...e})}function
|
|
1
|
+
import{cva as s}from"class-variance-authority";import{cn as a}from"cn";import{jsx as r}from"react/jsx-runtime";var n=s("group/alert relative grid w-full gap-0.5 rounded-lg border px-4 py-3 text-start text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pe-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"}},defaultVariants:{variant:"default"}});function O({className:t,variant:e,...o}){return r("div",{"data-slot":"alert",role:"alert",className:a(n({variant:e}),t),...o})}function $t({className:t,...e}){return r("div",{"data-slot":"alert-title",className:a("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",t),...e})}function F({className:t,...e}){return r("div",{"data-slot":"alert-description",className:a("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",t),...e})}function di({className:t,...e}){return r("div",{"data-slot":"alert-action",className:a("absolute top-2.5 end-3",t),...e})}export{O,$t,F,di};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
2
|
-
export{
|
|
1
|
+
function uo({container:i,target:f,clientX:e,clientY:n,currentScale:r,nextScale:s}){if(r<=0||s<=0)return null;let o=i.getBoundingClientRect(),t=f.getBoundingClientRect();if(t.width===0||t.height===0)return null;let h=e>=t.left&&e<=t.right&&n>=t.top&&n<=t.bottom,l=h?(e-t.left)/t.width:0.5,a=h?(n-t.top)/t.height:0.5,c=t.width/r,g=t.height/r,m=c*s,u=g*s,d=e-o.left,p=n-o.top,P=i.scrollLeft+(t.left-o.left)+t.width/2,b=i.scrollTop+(t.top-o.top)+t.height/2,C=(l-0.5)*m,x=(a-0.5)*u;return{left:Math.max(0,P+C-d),top:Math.max(0,b+x-p)}}
|
|
2
|
+
export{uo};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{wt,j}from"./chunk-r8z8f31m.js";import{M}from"./chunk-3nj26hhf.js";import{bt}from"./chunk-twwqgd8e.js";import{X}from"./chunk-xw0gvwh5.js";import{Fe,he,Be}from"./chunk-yf2p44mq.js";import{PreviewCard as x}from"@base-ui/react/preview-card";import{cn as p}from"cn";import{LockIcon as I}from"lucide-react";import{createContext as S,useContext as k,useLayoutEffect as T,useState as R}from"react";import"@alwith/module-chat/session-list.css";import{jsx as e,jsxs as d,Fragment as E}from"react/jsx-runtime";function oo(o){if(o.as==="ul"){let{as:i,className:s,...a}=o;return e("ul",{className:p("flex w-full min-w-0 flex-col gap-0.5",s),...a})}let{as:t,className:n,...r}=o;return e("div",{className:p("flex w-full min-w-0 flex-col gap-0.5",n),...r})}function Oe({className:o,...t}){return e("span",{"data-slot":"navigation-leading",className:p("flex size-6 shrink-0 items-center justify-center [&_.lucide]:size-3.5",o),...t})}function ht({active:o,className:t,...n}){return e("button",{type:"button","data-active":o?"":void 0,"aria-current":o?"page":void 0,className:p("group/navigation-row focus-visible:outline-ring flex h-[var(--navigation-row-height)] w-full items-center gap-1 overflow-hidden rounded-[10px] ps-1 pe-1.5 text-start text-sm outline-hidden [corner-shape:superellipse(1.5)] focus-visible:outline-2 focus-visible:outline-offset-[-2px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",t),...n})}function Ut({open:o,onOpenChange:t,tooltip:n,leading:r,label:i,count:s,countLabel:a,active:l=!1,actions:N,headerChildren:f,wrapHeader:u,onHeaderClick:w,children:h}){let C=()=>{w?.(),t(!o)},v=p(Fe,"relative flex h-[var(--navigation-row-height)] w-full items-center gap-1 rounded-[10px] ps-1 pe-1.5 text-start [corner-shape:superellipse(1.5)]"),b=d(E,{children:[r!=null&&e(Oe,{children:r}),f??e(M,{className:"flex-1 text-sm opacity-70",children:i}),e("span",{className:"relative z-10 ms-auto",children:e(Be,{content:s!==void 0?e(he,{className:p("text-muted-foreground justify-end text-xs opacity-70",a&&"w-auto"),children:e("span",{dir:"ltr",children:a??s})}):void 0,actions:N})})]}),P=f==null?d("div",{"data-active":l?"":void 0,title:n,className:p(v,j),onClick:C,onKeyDown:(c)=>{if(c.target!==c.currentTarget)return;if(c.key!=="Enter"&&c.key!==" ")return;c.preventDefault(),C()},children:[e("button",{type:"button","aria-expanded":o,"aria-label":typeof i==="string"?i:n,className:"focus-visible:outline-ring absolute inset-0 rounded-[10px] outline-hidden [corner-shape:superellipse(1.5)] focus-visible:outline-2 focus-visible:outline-offset-[-2px]"}),b]}):e("div",{"data-active":l?"":void 0,className:v,children:b});return d("div",{className:"text-[#1a1c1f] dark:text-white",children:[u===void 0?P:u(P),o&&e(oo,{className:"mt-0.5",children:h})]})}var H=S(()=>{}),O=S(()=>{});function vt(){return k(O)}function xt(){return k(H)}function yt({active:o=!1,state:t,interruption:n=null,leased:r=!1,media:i,title:s,hoverCard:a,onHoverCardOpenChange:l,subtitle:N,preview:f,listeningPorts:u,onOpenPort:w,accessory:h,meta:C,hint:v,actions:b,className:P,...c}){let y=d("div",{"data-slot":"navigation-session-item","data-active":o,className:p(Fe,wt,"group/navigation-row focus-visible:outline-ring flex h-[var(--navigation-row-height)] w-full items-center gap-1 overflow-hidden rounded-[10px] ps-1 pe-1.5 text-start text-sm outline-hidden [corner-shape:superellipse(1.5)] focus-visible:outline-2 focus-visible:outline-offset-[-2px]",(f||u!=null&&u.length>0)&&"h-auto min-h-[var(--navigation-row-height)] py-2.5",P),...c,children:[e(Oe,{children:t!=null?e(bt,{state:t,title:n??void 0}):i}),d("span",{className:"flex min-w-0 flex-1 flex-col",children:[e(M,{className:p("leading-none",t==="done"&&"font-semibold"),children:s}),N!=null&&e(M,{className:"text-muted-foreground text-xs",children:N}),f&&e("span",{className:"text-muted-foreground mt-1.5 line-clamp-2 text-xs leading-[18px] [overflow-wrap:anywhere] break-words",children:f}),u!=null&&u.length>0&&e("span",{className:"text-muted-foreground mt-1.5 flex flex-wrap items-center gap-2 font-mono text-xs",children:u.map((m)=>w?d("button",{type:"button",className:"underline",onPointerDown:(g)=>g.stopPropagation(),onKeyDown:(g)=>g.stopPropagation(),onClick:(g)=>{g.stopPropagation(),w(m)},children:[":",m]},m):d("span",{children:[":",m]},m))})]}),d("span",{className:"relative ms-auto flex shrink-0 items-center gap-1",children:[r&&e(I,{className:"text-muted-foreground size-3"}),e(Be,{content:h!=null?e(he,{children:h}):C??e(he,{}),actions:b}),v!=null&&e("span",{className:"pointer-events-none absolute end-1 top-1/2 flex h-5 min-w-5 -translate-y-1/2 items-center justify-center",children:v})]})]});if(a==null)return y;return e(L,{row:y,onOpenChange:l,children:a})}function L({row:o,children:t,onOpenChange:n}){let[r,i]=R(!1),[s,a]=R(!1),l=r||s;return T(()=>(n?.(l),()=>n?.(!1)),[l,n]),e(H.Provider,{value:a,children:e(O.Provider,{value:()=>{i(!1),a(!1)},children:e(_,{open:l,onOpenChange:i,trigger:o,children:t})})})}function _({open:o,onOpenChange:t,trigger:n,children:r,side:i="inline-end",sideOffset:s=2,align:a="start",alignOffset:l}){return X(o),d(x.Root,{open:o,onOpenChange:t,children:[e(x.Trigger,{render:n,delay:700,closeDelay:100}),e(x.Portal,{children:e(x.Positioner,{side:i,sideOffset:s,align:a,alignOffset:l,className:"isolate z-50",children:e(x.Popup,{"data-slot":"codex-hover-card",className:"bg-popover text-popover-foreground ring-foreground/10 m-px flex w-80 max-w-[calc(100vw-1rem)] flex-col overflow-hidden rounded-md text-sm shadow-md ring-1 outline-hidden select-none",children:e("div",{className:"flex w-full min-w-0 flex-col px-0 py-1 break-words whitespace-normal",children:r})})})})]})}
|
|
2
|
+
export{oo,Oe,ht,Ut,vt,xt,yt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Select as r}from"@base-ui/react/select";import{cn as o}from"cn";import{CheckIcon as u,ChevronDownIcon as c,ChevronUpIcon as f}from"lucide-react";import{jsx as e,jsxs as n}from"react/jsx-runtime";var qt=r.Root;function
|
|
1
|
+
import{Select as r}from"@base-ui/react/select";import{cn as o}from"cn";import{CheckIcon as u,ChevronDownIcon as c,ChevronUpIcon as f}from"lucide-react";import{jsx as e,jsxs as n}from"react/jsx-runtime";var qt=r.Root;function ui({className:t,...i}){return e(r.Group,{"data-slot":"select-group",className:o("scroll-my-1 p-1",t),...i})}function Vt({className:t,...i}){return e(r.Value,{"data-slot":"select-value",className:o("flex flex-1 text-start",t),...i})}function Gt({className:t,size:i="default",children:a,...s}){return n(r.Trigger,{"data-slot":"select-trigger","data-size":i,className:o("border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 flex w-fit items-center justify-between gap-1.5 rounded-md border bg-transparent py-2 ps-2.5 pe-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...s,children:[a,e(r.Icon,{render:e(c,{className:"text-muted-foreground pointer-events-none size-4"})})]})}function ao({className:t,children:i,side:a="bottom",sideOffset:s=4,align:d="center",alignOffset:p=0,alignItemWithTrigger:l=!0,...m}){return e(r.Portal,{children:e(r.Positioner,{side:a,sideOffset:s,align:d,alignOffset:p,alignItemWithTrigger:l,className:"isolate z-50",children:n(r.Popup,{"data-slot":"select-content","data-align-trigger":l,className:o("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-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 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md shadow-md ring-1 duration-100 data-[align-trigger=true]:animate-none",t),...m,children:[e(Mr,{}),e(r.List,{children:i}),e(Er,{})]})})})}function mi({className:t,...i}){return e(r.GroupLabel,{"data-slot":"select-label",className:o("text-muted-foreground px-2 py-1.5 text-xs",t),...i})}function K({className:t,children:i,...a}){return n(r.Item,{"data-slot":"select-item",className:o("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 ps-2 pe-8 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...a,children:[e(r.ItemText,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:i}),e(r.ItemIndicator,{render:e("span",{className:"pointer-events-none absolute end-2 flex size-4 items-center justify-center"}),children:e(u,{className:"pointer-events-none"})})]})}function pi({className:t,...i}){return e(r.Separator,{"data-slot":"select-separator",className:o("bg-border pointer-events-none -mx-1 my-1 h-px",t),...i})}function Mr({className:t,...i}){return e(r.ScrollUpArrow,{"data-slot":"select-scroll-up-button",className:o("bg-popover top-0 z-10 flex w-full cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",t),...i,children:e(f,{})})}function Er({className:t,...i}){return e(r.ScrollDownArrow,{"data-slot":"select-scroll-down-button",className:o("bg-popover bottom-0 z-10 flex w-full cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",t),...i,children:e(c,{})})}export{qt,ui,Vt,Gt,ao,mi,K,pi,Mr,Er};
|
|
@@ -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
|
|
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 Vr=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(Vr({variant:t,size:i,className:r})),...a})}export{Vr,e};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Jn,eo}from"./chunk-5s2wpbdt.js";import{cn as l}from"cn";import{jsx as t,jsxs as a}from"react/jsx-runtime";function p({value:i,onValueChange:n,options:o,itemClassName:d}){return t(Jn,{value:i,onValueChange:(e)=>n(String(e)),children:o.map((e)=>a(eo,{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
2
|
export{p};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function*Mt(n,e){if(e.length===0)return;let r=new RegExp(e.replaceAll(/[.*+?^{}()|[\]\\$]/g,String.raw`\$&`),"giu");for(let t of n.matchAll(r))yield{start:t.index,end:t.index+t[0].length}}function Yr(n,e){if(e.length===0)return[];let r=[];for(let{turnKey:t,segments:o}of n){let c=0;for(let s of o)for(let a of Mt(s,e))r.push({turnKey:t,occurrenceInTurn:c}),c+=1}return r}
|
|
2
|
+
export{Mt,Yr};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e}from"./chunk-cg97byvk.js";import{ue}from"./chunk-1drkvxzk.js";import{d,u,w,z,m,k}from"./chunk-1txn4b0v.js";import{h}from"./chunk-nx91ewps.js";import{At,Lt,Qn,Xn,Yn,ut}from"./chunk-sj7jdb7m.js";import{l}from"./chunk-1hy64ewz.js";import{V,R}from"./chunk-ehh31hzz.js";import{Ne}from"./chunk-5wyxvpgt.js";import{C}from"./chunk-xjtqdp82.js";import{isArrayProperty as D,isBooleanProperty as S,isNumberProperty as A,isStringProperty as E}from"@alwith/api";import{useEffect as N,useMemo as q,useState as P}from"react";import{jsx as o,jsxs as p}from"react/jsx-runtime";function L(r){if(!E(r))return null;if(r.oneOf&&r.oneOf.length>0)return r.oneOf.map((t)=>({value:t.const,label:t.title??t.const,...t.description?{description:t.description}:{}}));if(r.enum&&r.enum.length>0)return r.enum.map((t)=>({value:t,label:t}));return null}function G(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 Sr(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:L(i),multiOptions:D(i)?G(i.items):null}))}function hr(r){let t={};for(let n of r){let i=n.property.default;if(i!==void 0&&i!==null)t[n.key]=i;else if(n.options)t[n.key]=n.options[0].value;else if(S(n.property))t[n.key]=!1;else if(D(n.property))t[n.key]=[]}return t}function Nr(r,t){if(r.multiOptions)return Array.isArray(t)&&t.length>0;if(!r.required)return!0;return t!==void 0&&t!==""&&!(Array.isArray(t)&&t.length===0)}function 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(h,{htmlFor:r,className:"min-w-0 flex-1 cursor-pointer font-normal",children:[o("div",{className:"text-foreground text-sm",children:t}),n&&o("div",{className:"text-muted-foreground text-xs",children:n})]})]})}function I({id:r,field:t,value:n,onChange:i}){if(t.multiOptions){let a=new Set(Array.isArray(n)?n:[]);return p(At,{children:[o(Lt,{variant:"label",children:t.title}),t.description&&o(ut,{children:t.description}),o("div",{className:"flex flex-col gap-1",children:t.multiOptions.map((c)=>{let f=`${r}:${c.value}`;return o(O,{id:f,...c,control:o(ue,{id:f,checked:a.has(c.value),onCheckedChange:(y)=>{let g=new Set(a);if(y)g.add(c.value);else g.delete(c.value);i([...g])}})},c.value)})})]})}if(t.options)return p(At,{children:[o(Lt,{variant:"label",children:t.title}),t.description&&o(ut,{children:t.description}),o(V,{value:typeof n==="string"?n:"",onValueChange:(a)=>i(String(a)),className:"flex flex-col gap-1",children:t.options.map((a)=>{let c=`${r}:${a.value}`;return o(O,{id:c,...a,control:o(R,{value:a.value,id:c})},a.value)})})]});return p(Xn,{children:[o(Yn,{htmlFor:r,children:t.title}),S(t.property)?o(Ne,{id:r,checked:n===!0,onCheckedChange:(a)=>i(a)}):A(t.property)?o(l,{id:r,type:"number",required:t.required,value:typeof n==="number"?n:"",onChange:(a)=>i(a.target.value===""?void 0:Number(a.target.value))}):o(C,{id:r,rows:2,required:t.required,value:typeof n==="string"?n:"",onChange:(a)=>i(a.target.value)}),t.description&&o(ut,{children:t.description})]})}function On({requestId:r,schema:t,message:n,total:i,t:a,onRespond:c}){let f=q(()=>Sr(t),[t]),[y,g]=P(()=>hr(f));N(()=>g(hr(f)),[r,f]);let b=f.every((s)=>Nr(s,y[s.key])),x=()=>{if(!b)return;let s={};for(let[v,F]of Object.entries(y))if(F!==void 0)s[v]=F;c({action:"accept",content:s})};return o(d,{open:!0,onOpenChange:(s)=>!s&&c({action:"cancel"}),children:p(u,{className:"flex max-h-[80vh] flex-col gap-4 sm:max-w-lg",onKeyDown:(s)=>{if(s.key==="Enter"&&(s.metaKey||s.ctrlKey))s.preventDefault(),x()},children:[p(w,{children:[p("div",{className:"flex items-center justify-between gap-2 pe-8",children:[o(m,{children:t.title??a("approval.needed")}),i>1&&o("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${i}`})]}),o(k,{children:n})]}),o("div",{className:"min-h-0 flex-1 overflow-y-auto",children:o(Qn,{children:f.map((s)=>o(I,{id:`${r}:${s.key}`,field:s,value:y[s.key],onChange:(v)=>g((F)=>({...F,[s.key]:v}))},s.key))})}),p(z,{children:[o(e,{variant:"ghost",onClick:()=>c({action:"decline"}),children:a("actions.decline")}),o(e,{disabled:!b,onClick:x,children:a("actions.submit")})]})]})})}
|
|
2
|
+
export{Sr,hr,Nr,On};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Radio as e}from"@base-ui/react/radio";import{RadioGroup as d}from"@base-ui/react/radio-group";import{cn as o}from"cn";import{jsx as i}from"react/jsx-runtime";function V({className:r,...a}){return i(d,{"data-slot":"radio-group",className:o("grid w-full gap-3",r),...a})}function
|
|
1
|
+
import{Radio as e}from"@base-ui/react/radio";import{RadioGroup as d}from"@base-ui/react/radio-group";import{cn as o}from"cn";import{jsx as i}from"react/jsx-runtime";function V({className:r,...a}){return i(d,{"data-slot":"radio-group",className:o("grid w-full gap-3",r),...a})}function R({className:r,...a}){return i(e.Root,{"data-slot":"radio-group-item",className:o("group/radio-group-item peer border-input group-has-[:focus-visible]/field-label:not-data-checked:border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary relative flex aspect-square size-4 shrink-0 rounded-full border outline-none group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3",r),...a,children:i(e.Indicator,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:i("span",{className:"bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full"})})})}export{V,R};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e}from"./chunk-
|
|
2
|
-
export{
|
|
1
|
+
import{e}from"./chunk-cg97byvk.js";import{qn,Vn,Gn,Wn,jn,Kn}from"./chunk-scddkjv8.js";import{ExternalLinkIcon as d}from"lucide-react";import{jsx as a,jsxs as n}from"react/jsx-runtime";function Fn({message:r,url:t,t:i,onOpen:l,onRespond:o}){return n(qn,{size:"sm",children:[n(Vn,{children:[a(Wn,{children:i("approval.needed")}),a(Gn,{children:r})]}),a(jn,{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(Kn,{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")})]})]})}
|
|
2
|
+
export{Fn};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Yo}from"./chunk-0grd0g0x.js";import{on,Xo}from"./chunk-rd94eyan.js";import{rn}from"./chunk-rgkhm4s4.js";import{decodeHTMLAttribute as v,decodeHTMLStrict as I}from"entities";import oe from"katex";import{CheckIcon as z,ChevronLeftIcon as ae,ChevronRightIcon as se,CopyIcon as ie,DownloadIcon as ce,FileIcon as de,LinkIcon as le,MailIcon as ue,XIcon as me}from"lucide-react";import"katex/dist/katex.min.css";import{createContext as ge,createElement as U,memo as B,startTransition as fe,useContext as he,useEffect as p,useLayoutEffect as D,useMemo as X,useRef as k,useState as h}from"react";import{jsx as a,jsxs as g,Fragment as te}from"react/jsx-runtime";var G=ge(null);function C(){let e=he(G);if(e===null)throw Error("Markdown host is missing");return e}var pe=80,A=/\[([^\]\n]+)\]\(([^)\n]+)$/,ke=/(^|\n)[^\S\n]*!\[[^\]\n]*(?:\](?:\([^\n]*)?)?\s*$/,we=/\uE200[^\uE201]*$/,be=4,xe=new Set("7zipx.accdb.asarpack.asciidoc.backup.backupdb.bundle.ccproj.cdrdao.code-workspace.config.debugin.deploy.design.docbook.dockerfile.dockerignore.editorconfig.eslintignore.gitattributes.gitignore.gitignore.gitkeep.gradle.graphqls.ignore.ipynb.keychain.keynote.licensee.lockfile.lockfile.markdown.markup.matlab.mkdocs.models.module.msstyle.notebook.npmignore.output.packageinfo.parquet.pickle.plistx.policy.postcssrc.prettierignore.projectfile.python.readme.review.robots.schema.search.series.settingsjson.shader.sqlite.sqlite3.storyboard.styles.system.target.terraform.update.vertex.webapp.webdoc.webpackrc.widget.workspace.xcodeproj.yarnlock".split("."));function y(e,n){let t=0;for(let r=n-1;r>=0&&e[r]==="\\";r-=1)t+=1;return t%2===1}function J(e,n,t){if(t.length!==1)return!1;return e[n-1]===t||e[n+1]===t}function Te(e,n){let t=0;for(let r=0;r<=e.length-n.length;){if(e.startsWith(n,r)&&!y(e,r)&&!J(e,r,n)){t+=1,r+=n.length;continue}r+=1}return t}function ve(e,n){for(let t=e.length-n.length;t>=0;t-=1)if(e.startsWith(n,t)&&!y(e,t)&&!J(e,t,n))return t;return-1}function Ce(e,n){let t=0;for(let r=0;r<=e.length-n.length;){if(e.startsWith(n,r)&&!y(e,r)){t+=1,r+=n.length;continue}r+=1}return t}function ye(e){return Ce(e,"```")%2===1}function V(e){let n=0;for(let t=0;t<e.length;){if(e.startsWith("```",t)){for(t+=3;t<e.length&&!e.startsWith("```",t);)t+=1;if(t<e.length)t+=3;continue}if(e[t]==="`"&&!y(e,t))n+=1;t+=1}return n%2===1}function Ne(e){return e.endsWith(`
|
|
2
2
|
`)?`${e}\`\`\``:`${e}
|
|
3
3
|
\`\`\``}function H(e,n){if(!e.includes(n)||Te(e,n)%2===0)return e;let t=ve(e,n);if(t<0)return e;let r=e.slice(t+n.length);if(r.length===0||/^\s/.test(r)||r.includes(`
|
|
4
4
|
`)||V(r))return e;return`${e}${n}`}function Me(e){return e.startsWith("/")&&!e.startsWith("//")||/^[A-Za-z]:[\\/]/.test(e)||/^\\\\[^\\]+\\[^\\]+/.test(e)||/^\/\/[^/]+\/[^/]+/.test(e)}function Z(e){let n=e.replaceAll("`","").trim(),t=n.match(/^(.*?):(\d+)(?::(\d+))?(?:[-–](\d+)(?::(\d+))?)?$/);if(t!==null){let[,o,s,i,c,d]=t;if(o===void 0||s===void 0)throw Error("Codex file location is incomplete");return{path:o,line:Number.parseInt(s,10),column:i===void 0?void 0:Number.parseInt(i,10),endLine:c===void 0?void 0:Number.parseInt(c,10),endColumn:d===void 0?void 0:Number.parseInt(d,10)}}let r=n.match(/^(.*?)#L(\d+)(?:C(\d+))?(?:-L(\d+)(?:C(\d+))?)?$/);if(r!==null){let[,o,s,i,c,d]=r;if(o===void 0||s===void 0)throw Error("Codex hash file location is incomplete");return{path:o,line:Number.parseInt(s,10),column:i===void 0?void 0:Number.parseInt(i,10),endLine:c===void 0?void 0:Number.parseInt(c,10),endColumn:d===void 0?void 0:Number.parseInt(d,10)}}return{path:n}}function Le(e){let{path:n,line:t,column:r,endLine:o,endColumn:s}=Z(e);if(/^[a-z][a-z0-9+.-]*:\/\//i.test(n)||/^www\./i.test(n)||/^(mailto|tel):/i.test(n))return!1;if(t!==void 0||r!==void 0||o!==void 0||s!==void 0)return!0;if(!/(?:^|[\\/])[^\\/]+\.(?!\d+$)[^\\/.]+$/i.test(n))return!1;let i=/[\\/]/.test(n),c=n.split(/[\\/]/).at(-1);if(c===void 0)throw Error("Codex streaming link target has no file name");let d=c.split(".").at(-1);if(d===void 0||d.length===0)return!1;if(!i&&/[a-z]/.test(d)&&/[A-Z]/.test(d.slice(1)))return!1;if(!i){let u=d.toLowerCase();if(u.length>be&&!xe.has(u))return!1}return!0}function Ee(e){let{path:n}=Z(e);if(Me(n))return!0;try{return new URL(n).protocol==="file:"}catch{return!1}}function Ie(e){let n=e.match(A);if(n===null)return e;let t=n[2];if(t===void 0)throw Error("Codex streaming link target is missing");return Le(t)||Ee(t)?e.replace(A,"$1"):`${e})`}function $e(e){let n=e.replace(we,"");if(n.length===0||n.includes("`")&&V(n))return{isCodeFenceOpen:!1,markdown:n};if(n.includes("```")&&ye(n))return{isCodeFenceOpen:!0,markdown:Ne(n)};if(n.includes(")n=Ie(n);return n=H(n,"**"),n=H(n,"*"),{isCodeFenceOpen:!1,markdown:n}}function Re(e){return e?.type==="paragraph"&&"tokens"in e&&Array.isArray(e.tokens)}function _(e){return Re(e)&&e.tokens.length===1&&e.tokens[0]?.type==="image"}function Y(e){for(let n=0;n<e.length;n+=1){let t=e[n];if(t===void 0)throw Error(`Codex Markdown token is missing at index ${n}`);if("tokens"in t&&Array.isArray(t.tokens))Y(t.tokens);if(!_(t))continue;let r=[...t.tokens],o=n+1,s=o;for(;;){while(e[o]?.type==="space")o+=1;let i=e[o];if(!_(i))break;r.push(...i.tokens),o+=1,s=o}if(s===n+1)continue;t.tokens=r,t.text=r.map((i)=>i.raw).join(`
|
|
5
|
-
`),t.raw=e.slice(n,s).map((i)=>i.raw).join(""),e.splice(n+1,s-n-1)}}function O(e){return{type:"text",raw:e,text:e}}function Pe(e){return{type:"paragraph",raw:e.raw,text:e.text,tokens:e.tokens??[e]}}function E(e){for(let n of e){if(n.type==="list")for(let t of n.items){let r=t.tokens[0];if(r?.type==="heading"){let o=r,s=o.raw.trimEnd(),i=s.match(/^#{1,6}\s+/)?.[0];if(i!==void 0)t.tokens[0]={type:"paragraph",raw:o.raw,text:s,tokens:o.tokens===void 0?[O(s)]:[O(i),...o.tokens]}}if(t.loose)t.tokens=t.tokens.map((o)=>o.type==="text"?Pe(o):o);E(t.tokens)}if("tokens"in n&&Array.isArray(n.tokens))E(n.tokens)}}function Se(e,n,t){e.preventDefault(),e.stopPropagation(),t.openLink(n)}function Fe(e){try{let n=new URL(e);return n.protocol!=="http:"&&n.protocol!=="https:"?null:`${n.origin}/favicon.ico`}catch{return null}}function Ae(e){let n=Fe(e);return n===null?[]:[n,`https://www.google.com/s2/favicons?domain=${new URL(e).origin}&sz=32`]}function He({href:e}){let n=X(()=>Ae(e),[e]),[t,r]=h(),o=n.length===0&&!/^[a-z][a-z0-9+.-]*:/i.test(e),s=e.toLowerCase().startsWith("mailto:")?ue:o?de:le;return g("span",{className:"codex-markdown-favicon",children:[t===void 0?a("span",{className:"codex-markdown-favicon-fallback",children:a(s,{"aria-hidden":!0})}):null,n.map((i)=>a("img",{alt:"",className:t===i?"codex-markdown-favicon-image-loaded":void 0,decoding:"async",draggable:!1,referrerPolicy:"no-referrer",src:i,onLoad:()=>r((c)=>c!==void 0&&n.includes(c)?c:i)},i))]})}function _e({children:e,href:n,title:t}){let r=C();if(r.preview)return a("span",{children:e});return a("a",{className:"codex-markdown-link","data-inline-mention-interactive":"",href:n,title:t,onClick:(o)=>Se(o,n,r),children:g("span",{className:"codex-markdown-link-mention","data-layout":"inline-flow","data-interactive":"","data-underline-on-hover":"",children:[a("span",{className:"codex-markdown-link-icon-container","data-markdown-copy":"exclude",children:a(He,{href:n})}),a("span",{className:"codex-markdown-link-label",children:e})]})})}function Oe({code:e,language:n}){let{theme:t,copyLabel:r}=C(),o=k(null),[s,i]=h(null),[c,d]=h(null),[u,w]=h(!1);if(p(()=>{let f=
|
|
6
|
-
`,1)[0];if(t===void 0)throw Error("Codex Markdown token has no first line");return(t.match(/\S+/)?.[0]??t).slice(0,pe)}function Xe(e){switch(e.type){case"code":return e.raw.trimStart().match(/^(```|~~~)/)?.[1]??"";case"link":return e.href;case"image":{let n=e;return`${n.href}:${W(n.text)}`}case"html":case"space":case"br":case"hr":case"def":return e.raw;case"math":return W(e.text);default:return""}}function ee(e){return`${e.type==="math"?`math-${e.display?"block":"inline"}`:e.type}-${Q(Xe(e))}`}function m(e,n){let t=new Map;return e.map((r)=>{let o=ee(r),s=t.get(o)??0;return t.set(o,s+1),ne(r,`${n}-${o}-${s}`)})}function Ge(e,n){let t=e.task?e.tokens.filter((r)=>r.type!=="checkbox"):e.tokens;return g("li",{className:`codex-markdown-list-item${e.task?"codex-markdown-task-list-item":""}`,children:[e.task?g("div",{className:"codex-markdown-task-checkbox",children:[a("input",{type:"checkbox",className:"codex-markdown-checkbox",checked:e.checked,"data-state":e.checked?"checked":"unchecked",readOnly:!0,disabled:!0}),e.checked?a(z,{}):null]}):null,m(t,n)]},n)}function Je(e,n){let r=`codex-markdown-list ${e.items.some((s)=>s.task)?"codex-markdown-task-list":e.ordered?"codex-markdown-ordered-list":"codex-markdown-unordered-list"}`,o=m(e.items,n);return e.ordered?a("ol",{className:r,start:e.start===""?void 0:e.start,children:o},n):a("ul",{className:r,children:o},n)}function q(e,n,t){let r=t?"th":"td",o=/^\d+$/.test(e.text);return U(r,{key:n,className:`${t?"codex-markdown-table-header":"codex-markdown-table-cell"}${o?" codex-markdown-numeric-table-cell":""}`,align:e.align??void 0},...m(e.tokens,n))}function Ve(e,n){let t=new Map;return a("div",{className:"codex-markdown-table-container","data-markdown-table":!0,tabIndex:-1,children:a("div",{className:"codex-markdown-table-scroller",children:a("div",{className:"codex-markdown-table-wrapper",children:g("table",{className:"codex-markdown-table",children:[a("thead",{children:a("tr",{className:"codex-markdown-table-row",children:e.header.map((r,o)=>q(r,`${n}-header-${o}`,!0))})}),a("tbody",{className:"codex-markdown-table-body",children:e.rows.map((r)=>{let o=Q(r.map((c)=>c.text).join("\x00")),s=t.get(o)??0;t.set(o,s+1);let i=`${n}-row-${o}-${s}`;return a("tr",{className:"codex-markdown-table-row",children:r.map((c,d)=>q(c,`${i}-cell-${d}`,!1))},i)})})]})})})},n)}function K(e,n,t){let r=v(e.href);if(!
|
|
7
|
-
export{
|
|
5
|
+
`),t.raw=e.slice(n,s).map((i)=>i.raw).join(""),e.splice(n+1,s-n-1)}}function O(e){return{type:"text",raw:e,text:e}}function Pe(e){return{type:"paragraph",raw:e.raw,text:e.text,tokens:e.tokens??[e]}}function E(e){for(let n of e){if(n.type==="list")for(let t of n.items){let r=t.tokens[0];if(r?.type==="heading"){let o=r,s=o.raw.trimEnd(),i=s.match(/^#{1,6}\s+/)?.[0];if(i!==void 0)t.tokens[0]={type:"paragraph",raw:o.raw,text:s,tokens:o.tokens===void 0?[O(s)]:[O(i),...o.tokens]}}if(t.loose)t.tokens=t.tokens.map((o)=>o.type==="text"?Pe(o):o);E(t.tokens)}if("tokens"in n&&Array.isArray(n.tokens))E(n.tokens)}}function Se(e,n,t){e.preventDefault(),e.stopPropagation(),t.openLink(n)}function Fe(e){try{let n=new URL(e);return n.protocol!=="http:"&&n.protocol!=="https:"?null:`${n.origin}/favicon.ico`}catch{return null}}function Ae(e){let n=Fe(e);return n===null?[]:[n,`https://www.google.com/s2/favicons?domain=${new URL(e).origin}&sz=32`]}function He({href:e}){let n=X(()=>Ae(e),[e]),[t,r]=h(),o=n.length===0&&!/^[a-z][a-z0-9+.-]*:/i.test(e),s=e.toLowerCase().startsWith("mailto:")?ue:o?de:le;return g("span",{className:"codex-markdown-favicon",children:[t===void 0?a("span",{className:"codex-markdown-favicon-fallback",children:a(s,{"aria-hidden":!0})}):null,n.map((i)=>a("img",{alt:"",className:t===i?"codex-markdown-favicon-image-loaded":void 0,decoding:"async",draggable:!1,referrerPolicy:"no-referrer",src:i,onLoad:()=>r((c)=>c!==void 0&&n.includes(c)?c:i)},i))]})}function _e({children:e,href:n,title:t}){let r=C();if(r.preview)return a("span",{children:e});return a("a",{className:"codex-markdown-link","data-inline-mention-interactive":"",href:n,title:t,onClick:(o)=>Se(o,n,r),children:g("span",{className:"codex-markdown-link-mention","data-layout":"inline-flow","data-interactive":"","data-underline-on-hover":"",children:[a("span",{className:"codex-markdown-link-icon-container","data-markdown-copy":"exclude",children:a(He,{href:n})}),a("span",{className:"codex-markdown-link-label",children:e})]})})}function Oe({code:e,language:n}){let{theme:t,copyLabel:r}=C(),o=k(null),[s,i]=h(null),[c,d]=h(null),[u,w]=h(!1);if(p(()=>{let f=Yo(i,d);return o.current=f,()=>{f.dispose(),o.current=null}},[]),p(()=>{let f=o.current;if(f===null)throw Error("Code highlighter is not mounted");f.update(e,n)},[e,n]),c!==null)throw c;let x=s!==null&&s.code===e&&s.language===n?s.html:null;return g("div",{className:"codex-markdown-code-block","data-markdown-copy":"code-block","data-markdown-copy-text":e,"data-theme":t==="dark"?"dark":"light",children:[g("div",{className:"codex-markdown-code-header","data-markdown-copy":"exclude",children:[a("div",{className:"codex-markdown-code-title",children:n}),a("div",{className:"codex-markdown-code-actions",children:a("button",{type:"button",className:"codex-markdown-code-copy",title:r,onClick:()=>{navigator.clipboard.writeText(e),w(!0),window.setTimeout(()=>w(!1),2000)},children:u?a(z,{}):a(ie,{})})})]}),a("div",{className:"codex-markdown-code-container",dir:"ltr",children:a("code",{className:"codex-markdown-code-content hljs",...x===null?{children:e}:{dangerouslySetInnerHTML:{__html:x}}})})]})}function je({code:e,language:n}){return C().preview?a("span",{children:e}):a(We,{code:e,language:n})}function We({code:e,language:n}){let t=k(null),[r,o]=h(!1);if(p(()=>{if(r)return;let s=t.current;if(s===null)throw Error("Codex code block placeholder is not mounted");if(typeof IntersectionObserver>"u"){let c=window.setTimeout(()=>o(!0),0);return()=>window.clearTimeout(c)}let i=new IntersectionObserver((c)=>{if(!c.some((d)=>d.isIntersecting))return;o(!0),i.disconnect()},{rootMargin:"600px 0px"});return i.observe(s),()=>i.disconnect()},[r]),r)return a(Oe,{code:e,language:n});return a("div",{ref:t,className:"codex-markdown-code-block",children:a("pre",{className:"codex-markdown-code-placeholder",children:a("code",{children:e})})})}function qe(e){let n=[...document.body.querySelectorAll('[data-markdown-image-preview-trigger="true"]')],t=n.map((o)=>{let s=o.querySelector("img");if(s===null)throw Error("Codex image preview trigger has no image");return{src:s.currentSrc||s.src,alt:s.alt}}),r=n.indexOf(e);if(r===-1)throw Error("Codex image preview trigger is outside the document");return{images:t,index:r}}function Ke({preview:e,setPreview:n}){let t=e.images[e.index];if(t===void 0)throw Error(`Codex image preview index is out of range: ${e.index}`);return g("div",{className:"codex-markdown-image-preview",children:[a("img",{src:t.src,alt:t.alt}),g("div",{className:"codex-markdown-image-preview-actions",children:[a("button",{type:"button","aria-label":"Previous image",disabled:e.index===0,onClick:()=>n({...e,index:e.index-1}),children:a(ae,{})}),a("a",{href:t.src,download:!0,"aria-label":"Download image",children:a(ce,{})}),a("button",{type:"button","aria-label":"Next image",disabled:e.index===e.images.length-1,onClick:()=>n({...e,index:e.index+1}),children:a(se,{})}),a("button",{type:"button","aria-label":"Close image preview",onClick:()=>n(void 0),children:a(me,{})})]})]})}function ze(e){return C().preview?a(te,{children:e.alt}):a(Ue,{...e})}function Ue({src:e,alt:n,title:t,allowWide:r}){let o=k(null),[s,i]=h();p(()=>{let d=o.current;if(d===null)throw Error("Codex image preview dialog is not mounted");if(s===void 0){if(d.open)d.close();return}if(!d.open)d.showModal()},[s]);let c=n.length===0?"Open image preview":n;return g(te,{children:[a("button",{type:"button",className:`codex-markdown-image-trigger${r?"codex-markdown-image-trigger-wide":""}`,"aria-label":c,"data-markdown-image-preview-trigger":"true",onClick:(d)=>i(qe(d.currentTarget)),children:a("img",{className:`codex-markdown-image${r?"codex-markdown-image-wide":""}`,src:e,alt:n,title:t,loading:"lazy"})}),a("dialog",{ref:o,className:"codex-markdown-image-dialog","aria-label":c,onClose:()=>i(void 0),children:s===void 0?null:a(Ke,{preview:s,setPreview:i})})]})}function Be({value:e,display:n}){let t=k(null);return D(()=>{if(t.current===null)throw Error("Codex math root is not mounted");oe.render(e,t.current,{displayMode:n,throwOnError:!1})},[n,e]),a("span",{ref:t,className:n?"codex-markdown-math-block":"codex-markdown-inline-math"})}var De=150,T=null;function j(e,n){let t=T;if(t===null)return e;let r=t.cursor,o=r+e.length;t.cursor=o;let s=[],i=r;for(let c of t.runs){if(c.end<=r)continue;if(c.start>=o)break;let d=Math.max(r,c.start),u=Math.min(o,c.end);if(i<d)s.push(e.slice(i-r,d-r));s.push(a("span",{className:"codex-markdown-fade",children:e.slice(d-r,u-r)},`${n}:${t.generation}:${c.start}`)),i=u}if(i<o)s.push(e.slice(i-r));return s}function Q(e){let n=5381;for(let t=0;t<e.length;t+=1)n=(n*33+e.charCodeAt(t))%4294967296;return n.toString(36)}function W(e){let n=e.trim();if(n.length===0)return"";let t=n.split(`
|
|
6
|
+
`,1)[0];if(t===void 0)throw Error("Codex Markdown token has no first line");return(t.match(/\S+/)?.[0]??t).slice(0,pe)}function Xe(e){switch(e.type){case"code":return e.raw.trimStart().match(/^(```|~~~)/)?.[1]??"";case"link":return e.href;case"image":{let n=e;return`${n.href}:${W(n.text)}`}case"html":case"space":case"br":case"hr":case"def":return e.raw;case"math":return W(e.text);default:return""}}function ee(e){return`${e.type==="math"?`math-${e.display?"block":"inline"}`:e.type}-${Q(Xe(e))}`}function m(e,n){let t=new Map;return e.map((r)=>{let o=ee(r),s=t.get(o)??0;return t.set(o,s+1),ne(r,`${n}-${o}-${s}`)})}function Ge(e,n){let t=e.task?e.tokens.filter((r)=>r.type!=="checkbox"):e.tokens;return g("li",{className:`codex-markdown-list-item${e.task?"codex-markdown-task-list-item":""}`,children:[e.task?g("div",{className:"codex-markdown-task-checkbox",children:[a("input",{type:"checkbox",className:"codex-markdown-checkbox",checked:e.checked,"data-state":e.checked?"checked":"unchecked",readOnly:!0,disabled:!0}),e.checked?a(z,{}):null]}):null,m(t,n)]},n)}function Je(e,n){let r=`codex-markdown-list ${e.items.some((s)=>s.task)?"codex-markdown-task-list":e.ordered?"codex-markdown-ordered-list":"codex-markdown-unordered-list"}`,o=m(e.items,n);return e.ordered?a("ol",{className:r,start:e.start===""?void 0:e.start,children:o},n):a("ul",{className:r,children:o},n)}function q(e,n,t){let r=t?"th":"td",o=/^\d+$/.test(e.text);return U(r,{key:n,className:`${t?"codex-markdown-table-header":"codex-markdown-table-cell"}${o?" codex-markdown-numeric-table-cell":""}`,align:e.align??void 0},...m(e.tokens,n))}function Ve(e,n){let t=new Map;return a("div",{className:"codex-markdown-table-container","data-markdown-table":!0,tabIndex:-1,children:a("div",{className:"codex-markdown-table-scroller",children:a("div",{className:"codex-markdown-table-wrapper",children:g("table",{className:"codex-markdown-table",children:[a("thead",{children:a("tr",{className:"codex-markdown-table-row",children:e.header.map((r,o)=>q(r,`${n}-header-${o}`,!0))})}),a("tbody",{className:"codex-markdown-table-body",children:e.rows.map((r)=>{let o=Q(r.map((c)=>c.text).join("\x00")),s=t.get(o)??0;t.set(o,s+1);let i=`${n}-row-${o}-${s}`;return a("tr",{className:"codex-markdown-table-row",children:r.map((c,d)=>q(c,`${i}-cell-${d}`,!1))},i)})})]})})})},n)}function K(e,n,t){let r=v(e.href);if(!rn(r))return null;return a(ze,{src:r,alt:I(e.text),title:e.title==null?void 0:v(e.title),allowWide:t},n)}function ne(e,n){switch(e.type){case"space":case"def":case"internalMessage":return null;case"hr":return a("hr",{className:"codex-markdown-horizontal-rule"},n);case"heading":{let t=e,o={1:"h1",2:"h2",3:"h3",4:"h4",5:"h5",6:"h6"}[t.depth];if(o===void 0)throw Error(`Unsupported Codex Markdown heading depth: ${t.depth}`);return U(o,{key:n,className:`codex-markdown-heading codex-markdown-heading-${t.depth}`},...m(t.tokens,n))}case"paragraph":{let t=e,r=t.tokens.filter((i)=>i.type!=="space"&&i.type!=="br"),o=r.length>0&&r.every((i)=>i.type==="image"),s=o&&r.length>1;return a("p",{className:`codex-markdown-paragraph${o?"codex-markdown-media-paragraph codex-markdown-media-wide-block":""}${s?"codex-markdown-media-grid-paragraph":""}`,"data-markdown-image-grid":s?"true":void 0,"data-wide-markdown-block":o?"true":void 0,"data-wide-markdown-block-kind":o?"image":void 0,children:o?r.map((i,c)=>K(i,`${n}-image-${c}`,!0)):m(t.tokens,n)},n)}case"text":{let t=e;return t.tokens===void 0?j(I(t.text),n):m(t.tokens,n)}case"escape":return j(e.text,n);case"strong":return a("strong",{className:"codex-markdown-strong",children:m(e.tokens,n)},n);case"em":return a("em",{children:m(e.tokens,n)},n);case"del":return a("del",{children:m(e.tokens,n)},n);case"codespan":return a("span",{className:"codex-markdown-inline-code",dir:"ltr","data-markdown-copy":"inline-code",children:e.text},n);case"br":return a("br",{},n);case"link":{let t=e,r=m(t.tokens,n),o=v(t.href);return rn(o)?a(_e,{href:o,title:t.title==null?void 0:v(t.title),children:r},n):a("span",{children:r},n)}case"image":return K(e,n,!1);case"code":{let t=e;return a(je,{code:t.text,language:t.lang},n)}case"blockquote":return a("blockquote",{className:"codex-markdown-blockquote",children:m(e.tokens,n)},n);case"list":return Je(e,n);case"list_item":return Ge(e,n);case"table":return Ve(e,n);case"html":{let t=e;return/^<br\s*\/?>$/i.test(t.raw.trim())?a("br",{},n):t.raw}case"math":{let t=e;return a(Be,{value:t.text,display:t.display},n)}default:throw Error(`Unsupported Codex Markdown token: ${JSON.stringify(e)}`)}}function b(e){switch(e.type){case"text":{let n=e;return n.tokens===void 0?I(n.text):n.tokens.map(b).join("")}case"escape":return e.text;case"paragraph":case"heading":case"strong":case"em":case"del":case"link":case"blockquote":case"list_item":return e.tokens.map(b).join("");case"list":return e.items.map(b).join("");case"table":{let n=e;return[n.header,...n.rows].map((t)=>t.map((r)=>r.tokens.map(b).join("")).join("")).join("")}default:return""}}function Ze({token:e,tokenKey:n,offset:t,runs:r,generation:o}){let s=T;try{return T={cursor:t,runs:r,generation:o},ne(e,n)}finally{T=s}}var Ye=B(function({result:n}){let{text:t,isStreaming:r}=n,o=X(()=>{let l=n.tokens;if(n.source.includes("!["))Y(l);E(l);let R=new Map,P=0;return l.map((M)=>{let L=ee(M),S=R.get(L)??0;R.set(L,S+1);let F=b(M),re={token:M,tokenKey:`root-${L}-${S}`,offset:P,visibleText:F};return P+=F.length,re})},[n]),s=o.map((l)=>l.visibleText).join(""),i=k({text:"",visibleText:"",runs:[],generation:0}),c=i.current,d=t.startsWith(c.text)||s.startsWith(c.visibleText),u=d?c.visibleText.length:0,w=performance.now(),x=r&&d?c.runs.filter((l)=>w-l.firstSeenAtMs<De):[],N=c.generation+(d?0:1),f={text:t,visibleText:s,runs:x.filter((l)=>l.start<s.length).map((l)=>({...l,end:Math.min(l.end,s.length)})),generation:N};if(r&&s.length>u)f.runs.push({start:u,end:s.length,firstSeenAtMs:w});return D(()=>{i.current=f}),a("div",{dir:"auto",className:"codex-markdown-content codex-markdown-root","data-streaming":r?"true":void 0,children:o.map((l)=>a(Ze,{token:l.token,tokenKey:l.tokenKey,offset:l.offset,runs:f.runs,generation:N},l.tokenKey))})}),Qe=B(function({text:n,isStreaming:t}){let r=k(null),[o,s]=h(()=>on(n,t)),[i,c]=h(null);if(p(()=>{let d=Xo((u)=>{fe(()=>s(u))},c);return r.current=d,()=>{d.dispose(),r.current=null}},[]),p(()=>{let d=r.current;if(d===null)throw Error("Markdown parser is not mounted");let u=t?$e(n).markdown:n;d.update({source:u,text:n,isStreaming:t})},[t,n]),i!==null)throw i;return o===null?a("div",{"data-markdown-pending":!0}):a(Ye,{result:o})});function jo({text:e,streaming:n,host:t}){let r=n===!0,[o,s]=h(e);return p(()=>{if(o===e)return;if(!r){s(e);return}let i=requestAnimationFrame(()=>s(e));return()=>cancelAnimationFrame(i)},[o,r,e]),a(G.Provider,{value:t,children:a(Qe,{text:r?o:e,isStreaming:r})})}
|
|
7
|
+
export{jo};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{kn}from"./chunk-4pbh3fph.js";import{o}from"./chunk-6d38ff76.js";import{n,b}from"./chunk-76tkqx9n.js";import{I,y,G}from"./chunk-9c41y5hw.js";import{isBooleanOption as R,isGroupedSelect as U,isSelectOption as A}from"@alwith/api";import{Zap as Z}from"lucide-react";import{jsx as w}from"react/jsx-runtime";function Xe({sessionId:u,options:p,disabled:B,onModelChange:g,onConfigChange:M,defaultGroup:x={id:"models",name:"Models"},catalog:E=(s)=>s,headerAction:L}){let{host:s,client:N}=n(),{t:r}=s,h=o((e)=>Boolean(e.configPending[u])),t=y(p,"model"),l=y(p,"thought_level"),C=p.filter((e)=>e.configId!=="collaboration_mode"&&(e.category==="model_config"||e.category!=="mode"&&e!==t&&e!==l)),O=C.filter(A),d=C.filter(R);if(!t&&!l&&O.length===0&&d.length===0)return null;let c=(e,a)=>{if(a===e.currentValue)return;b(s,M?M(e.configId,a):N.setConfig(u,e.configId,a))},f=l?I(l):[],z=f.reduce((e,a)=>a.name.length>=e.length?a.name:e,""),P=t?G(t):r("composer.model"),v=(e)=>({api_id:e.value,label:e.name}),_=E(t&&U(t.options)?t.options.map((e)=>({id:e.groupId,name:e.name,models:e.options.map(v)})):[{...x,models:t?I(t).map(v):[]}]),S=_.flatMap((e)=>e.models),m=S.find((e)=>e.api_id===t?.currentValue)??{api_id:t?.currentValue??"",label:P},i=d.find((e)=>e.configId==="fast-mode");return w(kn,{disabled:B||h,switching:h,value:{...m,label:m.shortLabel??m.label},compactCatalog:!0,unavailableEffort:{name:"Effort",label:r("composer.unsupported")},models:S,showModelList:Boolean(t),onChange:(e)=>{if(e.api_id===t?.currentValue)return;if(g)g(e.api_id);else if(t)c(t,e.api_id)},header:{name:t?.name??r("composer.model"),action:L},modelGroups:_,t:r,effortConfig:l&&f.length>0?{name:"Effort",value:l.currentValue,levels:f,sizer:z,onChange:(e)=>c(l,e)}:void 0,selectOptions:O.map((e)=>({id:e.configId,name:e.name,value:e.currentValue,options:I(e).map((a)=>({value:a.value,label:a.name})),onChange:(a)=>c(e,a)})),booleanOptions:[{id:"fast_mode",name:r("composer.fastMode"),currentValue:i?.currentValue??!1,disabled:!i,title:!i?r("composer.fastModeUnsupported"):void 0,icon:w(Z,{className:"size-4","aria-hidden":"true"})},...d.filter((e)=>e!==i).map((e)=>({id:e.configId,name:e.name,currentValue:e.currentValue}))],onBooleanChange:(e,a)=>{let V=e==="fast_mode"?i:d.find((k)=>k.configId===e);if(!V)throw Error(`Unknown boolean config: ${e}`);c(V,a)}})}
|
|
2
|
+
export{Xe};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{po}from"./chunk-wjs8bwpk.js";async function m(r){try{let i=await(await fetch(r)).blob();if(typeof createImageBitmap==="function")return(await createImageBitmap(i)).close(),!0;return await new Promise((a)=>{let o=new Image;o.onload=()=>a(!0),o.onerror=()=>a(!1),o.src=r})}catch{return!1}}async function to(r){let n=await Promise.all(r.map(async({id:a,lastModified:o,sourcePath:p,...t})=>{let e=t.url;if(t.url.startsWith("blob:")){let s=await po(t.url,t.mediaType);if(s===null)return null;e=s}let l=t.mediaType.toLowerCase().startsWith("image/"),c=e.startsWith("data:image/");if(l&&c&&!await m(e))return null;let u=e.startsWith("data:")?e.slice(5,e.indexOf(";")):t.mediaType;return{...t,url:e,mediaType:u}})),i=n.filter((a)=>a!==null);return{files:i,rejectedCount:n.length-i.length}}
|
|
2
|
+
export{to};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e}from"./chunk-
|
|
2
|
-
export{
|
|
1
|
+
import{e}from"./chunk-cg97byvk.js";import{d,u,w,z,m,k}from"./chunk-1txn4b0v.js";import{X}from"./chunk-xw0gvwh5.js";import{createContext as C,useContext as v,useState as L,useSyncExternalStore as h}from"react";import{jsx as i,jsxs as p}from"react/jsx-runtime";var f=C(null),x=C(null),D=C(null);function br({host:t,client:o,children:n}){let[l,a]=L(null);X(l!==null);let{t:c}=t;return i(f,{value:t,children:i(x,{value:o,children:p(D,{value:a,children:[n,i(d,{open:l!==null,onOpenChange:(y)=>!y&&a(null),children:p(u,{children:[p(w,{children:[i(m,{children:c("sessionList.deleteTitle")}),i(k,{children:c("sessionList.deleteDescription")})]}),p(z,{children:[i(e,{variant:"outline",onClick:()=>a(null),children:c("sessionList.cancel")}),i(e,{onClick:()=>{if(l)S(t,o.delete(l.sessionId));a(null)},children:c("sessionList.delete")})]})]})})]})})})}function g(){let t=v(f);if(t===null)throw Error("Session list host is missing");return t}function s(){let t=v(x);if(t===null)throw Error("Session list client is missing");return t}function kt(){let t=v(D);if(t===null)throw Error("Session list provider is missing");return t}function r(t){let o=s();return h((n)=>o.store.subscribe(n),()=>t(o.store.getState()),()=>t(o.store.getState()))}function S(t,o){return o.then(()=>{},(n)=>{if(t.reportError)t.reportError(n);else console.error(n)})}
|
|
2
|
+
export{br,g,s,kt,r,S};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{s,r}from"./chunk-
|
|
2
|
-
export{
|
|
1
|
+
import{s,r}from"./chunk-gb2dmt6b.js";import{latestAssistantReply as v}from"@nyssance/codex-acp-v2/client";import{useEffect as S,useState as g}from"react";function vr(e,o){let a=s(),c=r((t)=>t.connection),i=r((t)=>Boolean(t.sessions[e]?.attached)&&!t.sessions[e]?.restoring),u=r((t)=>v(t.sessions[e]?.items)),f=r((t)=>Boolean(t.runStates[e]?.reusableDraft)),[p,y]=g();return S(()=>{if(c!=="ready"||f||i)return;let t=!1,l,n=0,m=async()=>{try{let d=await a.activityReply(e);if(n=0,!t)y(d??void 0)}catch{n++}finally{if(!t&&(o==="running"||n>0&&n<3))l=setTimeout(()=>void m(),5000)}};return m(),()=>{t=!0,clearTimeout(l)}},[a,e,c,f,i,o]),i?u:p??u}
|
|
2
|
+
export{vr};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Ro}from"./chunk-q98941j2.js";import{CheckIcon as N,ChevronDownIcon as E,CopyIcon as T,FileIcon as w}from"lucide-react";import{useEffect as k,useLayoutEffect as H,useRef as I,useState as f}from"react";import{jsx as e,jsxs as p,Fragment as h}from"react/jsx-runtime";var A=20,L='a[href], area[href], button, input, select, textarea, summary, audio[controls], video[controls], iframe, [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"])';function y(n,o,s){if(n.toggleAttribute("inert",!o),!o){n.setAttribute("aria-hidden","true");return}if(s===null)n.removeAttribute("aria-hidden");else n.setAttribute("aria-hidden",s)}function R(n,o){let s=n.getBoundingClientRect(),a=o.getBoundingClientRect();return s.top>=a.top&&s.right<=a.right&&s.bottom<=a.bottom&&s.left>=a.left}function M({text:n,host:o}){let{t:s,Markdown:a}=o,c=I(null),[l,u]=f(!1),[d,x]=f(!1);return H(()=>{let r=c.current;if(!r)throw Error("Codex user message content is missing");let t=()=>{if(r.scrollHeight===0){u(!1);return}let b=Number.parseFloat(getComputedStyle(r).lineHeight);if(!Number.isFinite(b))throw Error("Codex user message line height is invalid");u(r.scrollHeight>A*b+1)};t();let m=new ResizeObserver(t);return m.observe(r),()=>m.disconnect()},[]),k(()=>{if(!l||d)return;let r=c.current;if(!r)throw Error("Codex user message content is missing");let t=new Map,m=typeof IntersectionObserver>"u"?null:new IntersectionObserver((i)=>{for(let g of i){let v=g.target;if(!t.has(v))continue;y(v,g.isIntersecting&&g.intersectionRatio>=1,t.get(v))}},{root:r,rootMargin:"0px",threshold:1}),b=()=>{for(let i of t.keys()){if(r.contains(i))continue;m?.unobserve(i),t.delete(i)}for(let i of r.querySelectorAll(L)){if(t.has(i)||i.hasAttribute("inert"))continue;let g=i.getAttribute("aria-hidden");t.set(i,g),y(i,m===null&&R(i,r),g),m?.observe(i)}};b();let C=new MutationObserver(b);return C.observe(r,{childList:!0,subtree:!0}),()=>{m?.disconnect(),C.disconnect();for(let[i,g]of t)y(i,!0,g)}},[l,d]),p("div",{className:"codex-user-message-content",children:[e("div",{ref:c,className:l&&!d?"codex-user-message-text codex-user-message-text-collapsed":"codex-user-message-text",children:e(a,{text:n,streaming:!1})}),l&&!d&&e("span",{className:"codex-user-message-ellipsis","aria-hidden":"true",children:"…"}),l&&p("button",{type:"button","aria-expanded":d,className:"codex-user-message-collapse-trigger",onClick:()=>{x((r)=>!r)},children:[e("span",{children:d?s("stream.codex.showLess"):s("stream.codex.showMore")}),e(E,{className:d?"codex-user-message-collapse-chevron codex-user-message-collapse-chevron-expanded":"codex-user-message-collapse-chevron","aria-hidden":"true"})]})]})}function Jt({text:n,label:o,host:s}){let[a,c]=f(!1),[l,u]=f(null),d=async()=>{c(!1),u(null);try{await(s?.copyText?s.copyText(n):navigator.clipboard.writeText(n)),c(!0),setTimeout(()=>c(!1),2000)}catch(x){u(String(x)),s?.onCopyError?.(x)}};return e("button",{type:"button",className:"codex-message-action","aria-label":o,title:l??o,onClick:()=>void d(),children:a?e(N,{className:"codex-message-action-confirmed"}):e(T,{})})}function S({image:n,openImage:o}){let[s,a]=f(!1),c=`data:${n.mimeType};base64,${n.data}`;return p(h,{children:[e("button",{type:"button",className:"codex-user-image",onClick:()=>o===void 0?a(!0):o(c),children:e("img",{src:c,alt:""})}),s&&e(Ro,{src:c,alt:"",onClose:()=>a(!1)})]})}function No({message:n,text:o,textParts:s,mentions:a,images:c,messageTime:l,host:u,bubbleStyle:d}){let{t:x,openImage:r}=u;return e("div",{"data-content-search-unit-key":n.id,"data-message-id":n.id,className:"timeline-break codex-user-message scroll-mt-4",children:p("div",{className:"group/codex-user codex-user-message-group",children:[a.length>0&&e("div",{className:"codex-user-mentions",children:a.map((t)=>p("span",{className:"codex-user-mention",title:t.title,children:[e(w,{"aria-hidden":"true"}),e("span",{className:"codex-user-mention-label",children:t.label})]},t.key))}),c.length>0&&e("div",{className:"codex-user-images",children:c.map((t)=>e(S,{image:t,openImage:r},`${t.mimeType}:${t.data}`))}),o.length>0&&e(h,{children:e("div",{"data-user-message-bubble":!0,tabIndex:0,className:"codex-user-bubble",style:d,children:s?s.map((t,m)=>e("div",{className:"codex-user-text-part",children:t.question===void 0?e(M,{text:t.text,host:u}):p(h,{children:[e("div",{className:"codex-user-question-summary",title:t.question,children:t.question}),e("div",{className:"codex-user-question-answer",children:t.text})]})},m)):e(M,{text:o,host:u})})}),p("div",{className:"codex-user-actions",children:[e(Jt,{text:o,label:x("actions.copy"),host:u}),l&&e("span",{className:"codex-user-time",title:l.full,children:l.short})]})]})})}
|
|
2
|
+
export{Jt,No};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{CacheStorage as I,Soundfont as M}from"smplr";var T=4,y=21,l=88,s=[39,41,43,44,46,48,50],p=0.035,b=0.16,S=88,E=50,h="acoustic_grand_piano",O="MusyngKite",w="FluidR3_GM",f=[0,2,4,5,7,9,11],U=2,C=5,m=globalThis;if(m.__alwithTimelineUserMessageNavigationAudio?.version!==T)m.__alwithTimelineUserMessageNavigationAudio={version:T,context:null,storage:I("alwith-timeline-navigation-instruments"),players:new Map,nextNoteTime:0,unlockConsumerCount:0};var r=m.__alwithTimelineUserMessageNavigationAudio;function d(){return r.context??=new AudioContext,r.context}function c(){let e=d();if(e.state==="running"){r.nextNoteTime=e.currentTime;return}e.resume().then(()=>{r.nextNoteTime=e.currentTime},(n)=>{if(n instanceof DOMException&&n.name==="NotAllowedError")return;console.error("Failed to unlock timeline navigation audio",n)})}function k(e){let n=d();return M(n,{instrument:e,kit:e===h?O:w,storage:r.storage,volume:E})}function g(e){let n=r.players.get(e);if(n!==void 0)return n;let t=k(e),i={player:t,ready:t.ready};return r.players.set(e,i),i}function
|
|
2
|
-
export{
|
|
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 Vo(e){g(e).ready.catch((n)=>{console.error(`Failed to load navigation instrument "${e}"`,n)})}function Ci(){c()}function Go(){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 Wo(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 kr(N,t.length,v.inputTokens,v.outputTokens,o)});_(i,x)}function Ti(e,n,t,i,o,a){if(a==="none")return;_(o,[kr(e,n,t,i,a)])}function kr(e,n,t,i,o){if(o==="none")throw Error("navigationMidiNote: 声音已关闭,不该求音符");if(o==="auto")return zr(t,i);return Cr(e,n)}function zr(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 Cr(e,n){return y+Ur(e,n)}function Ii(e,n){return D(Cr(e,n))}function Ur(e,n){if(n<=l)return $r(n)[n-e-1];return Math.round((n-e-1)/(n-1)*(l-1))}function $r(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 Pi(){return r.context?.state}function Si(e){return g(e).ready}
|
|
2
|
+
export{Vo,Ci,Go,Wo,Ti,kr,zr,Cr,Ii,Ur,$r,Pi,Si};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var fr={allow_once:0,allow_always:1,reject_once:2,reject_always:3};function Hn(e){return[...e].toSorted((o,n)=>(fr[o.kind]??99)-(fr[n.kind]??99))}function Qr(e){return e==="allow_once"||e==="allow_always"}function Xr(e){return e==="allow_always"||e==="reject_always"}
|
|
2
|
+
export{fr,Hn,Qr,Xr};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{C}from"./chunk-xjtqdp82.js";import{cn as n}from"cn";import{jsx as o}from"react/jsx-runtime";function Ht({className:r,...e}){return o(C,{"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
2
|
export{Ht};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{O,F}from"./chunk-a2ftkzak.js";import{e}from"./chunk-cg97byvk.js";import{d,u,w,z,m,k}from"./chunk-1txn4b0v.js";import{l}from"./chunk-1hy64ewz.js";import{qt,Vt,Gt,ao,K}from"./chunk-c6w4bp15.js";import{ve}from"./chunk-61vxy6yd.js";import{g,s,r}from"./chunk-gb2dmt6b.js";import{Q,E,xe,B}from"./chunk-68y66m3v.js";import{cn as me}from"cn";import{ArchiveIcon as he,FolderIcon as Y,ListFilterIcon as pe,SearchIcon as fe,Trash2Icon as Z}from"lucide-react";import{useEffect as ge,useRef as Se,useState as h}from"react";import{jsx as i,jsxs as n}from"react/jsx-runtime";function ee({className:p,...a}){return i(ao,{align:"start",alignItemWithTrigger:!1,sideOffset:6,...a,className:me("max-w-(--available-width) min-w-0 p-1",p)})}function _(p){return p instanceof Error?p.message:String(p)}function ye({children:p}){return i("div",{className:"min-h-0 flex-1 overflow-y-auto",children:i("div",{className:"flex flex-col gap-8",children:p})})}function yr({Scroll:p=ye}){let{t:a,i18n:T}=g(),f=s(),L=r((t)=>t.archivedSessions),b=r((t)=>t.connection),[V,te]=h(""),[N,se]=h("all"),[v,ie]=h("all"),[re,ae]=h(0),[H,U]=h(!0),[q,G]=h(null),[R,W]=h(null),[D,A]=h(!1),x=Se(!1),[I,S]=h(null),[J,j]=h(null),[ne,M]=h(!1);ge(()=>{if(b!=="ready")return;let t=!1;U(!0),G(null);async function c(){try{await f.listArchived({reset:!0});let o=new Set;while(!t&&f.state.archivedCursor!==null){let y=f.state.archivedCursor;if(o.has(y))throw Error("Archive pagination returned a repeated cursor");o.add(y),await f.listArchived()}}catch(o){if(!t)G(_(o))}finally{if(!t)U(!1)}}return c(),()=>{t=!0}},[f,b,re]);let P=!(b==="ready"&&!H&&q===null)||D,C=(t)=>t.title??a("sessionList.untitled"),le=[...new Set(L.filter((t)=>!E(t.cwd)).map((t)=>t.cwd))].toSorted(),oe=V.trim().toLocaleLowerCase(T.language),X=L.filter((t)=>{let c=E(t.cwd);return C(t).toLocaleLowerCase(T.language).includes(oe)&&(N==="all"||(N==="quick"?c:!c))&&(v==="all"||(v==="quick"?c:t.cwd===v))}),ce=new Intl.DateTimeFormat(T.language,{dateStyle:"medium",timeStyle:"short"});async function ue(t){if(x.current)return;x.current=!0,A(!0),W(null);try{await f.unarchive(t.sessionId)}catch(c){W(_(c))}finally{x.current=!1,A(!1)}}async function de(){if(x.current||!I)return;x.current=!0,A(!0),j(null);let t=[],c=[];try{for(let o of I){if(!f.state.archivedSessions.some((y)=>y.sessionId===o.sessionId))continue;try{await f.delete(o.sessionId)}catch(y){t.push(o),c.push(`${C(o)}: ${_(y)}`)}}if(t.length)S(t),j(c.join(`
|
|
2
|
+
`));else S(null)}finally{x.current=!1,A(!1)}}return n("section",{className:"flex min-h-0 flex-1 flex-col overflow-hidden","aria-label":a("sessionList.archives.title"),children:[n("div",{className:"mx-auto flex min-h-0 w-full max-w-5xl flex-1 flex-col gap-8 px-6 pt-8 pb-10 lg:pb-14",children:[n("header",{className:"flex min-h-9 shrink-0 flex-wrap items-center justify-between gap-3",children:[i("h1",{className:"text-2xl leading-9 font-semibold tracking-tight",children:a("sessionList.archives.title")}),n(e,{variant:"destructive",className:"text-[color-mix(in_oklab,var(--destructive)_80%,var(--foreground))]",disabled:P||L.length===0,onClick:()=>{j(null),M(!0),S([...L])},children:[i(Z,{"aria-hidden":"true"}),a("sessionList.archives.deleteAll")]})]}),n("div",{className:"flex shrink-0 flex-wrap gap-3",children:[n("div",{className:"relative min-w-48 flex-1",children:[i(fe,{"aria-hidden":"true",className:"text-muted-foreground pointer-events-none absolute start-3 top-2.5 size-4"}),i(l,{"aria-label":a("sessionList.archives.search"),placeholder:a("sessionList.archives.search"),value:V,onChange:(t)=>te(t.target.value),className:"rounded-md ps-9"})]}),n(qt,{value:N,onValueChange:(t)=>{if(t===null)throw Error("Archive chat type cannot be empty");se(t)},children:[n(Gt,{"aria-label":a("sessionList.archives.chatType"),className:"w-40 rounded-md",children:[i(pe,{"aria-hidden":"true"}),i(Vt,{children:a(`sessionList.archives.${N==="all"?"allChats":N==="quick"?"quickChats":"projectChats"}`)})]}),n(ee,{children:[i(K,{value:"all",children:a("sessionList.archives.allChats")}),i(K,{value:"quick",children:a("sessionList.archives.quickChats")}),i(K,{value:"project",children:a("sessionList.archives.projectChats")})]})]}),n(qt,{value:v,onValueChange:(t)=>{if(t===null)throw Error("Archive project filter cannot be empty");ie(t)},children:[n(Gt,{"aria-label":a("sessionList.archives.project"),className:"w-48 rounded-md",children:[i(Y,{"aria-hidden":"true"}),i(Vt,{className:"truncate",children:v==="all"?a("sessionList.archives.allProjects"):v==="quick"?a("sessionList.archives.noProject"):B(v)})]}),n(ee,{children:[i(K,{value:"all",children:a("sessionList.archives.allProjects")}),i(K,{value:"quick",children:a("sessionList.archives.noProject")}),le.map((t)=>i(K,{value:t,title:t,children:B(t)},t))]})]})]}),n(p,{children:[b!=="ready"?i("p",{role:"status",className:"text-muted-foreground",children:a("sessionList.archives.connecting")}):H?n("div",{role:"status",className:"text-muted-foreground flex items-center gap-2",children:[i(ve,{}),a("sessionList.archives.loading")]}):q?i(O,{variant:"destructive",children:n(F,{className:"flex items-center justify-between gap-4",children:[i("span",{children:q}),i(e,{variant:"outline",onClick:()=>ae((t)=>t+1),children:a("sessionList.archives.retry")})]})}):L.length===0?n("div",{className:"text-muted-foreground flex flex-col items-center gap-3 py-16",children:[i(he,{"aria-hidden":"true",className:"size-8"}),i("p",{children:a("sessionList.archives.empty")})]}):X.length===0?i("p",{className:"text-muted-foreground py-12 text-center",children:a("sessionList.archives.noResults")}):xe(X).filter(([,t])=>t.length>0).map(([t,c])=>n("section",{className:"flex flex-col gap-3",children:[n("div",{className:"flex items-center justify-between gap-3",children:[n("h2",{className:"flex min-w-0 items-center gap-2 text-sm font-medium",title:t===Q?void 0:t,children:[i(Y,{"aria-hidden":"true",className:"size-4 shrink-0"}),i("span",{className:"truncate",children:t===Q?a("sessionList.archives.noProject"):B(t)})]}),i("span",{className:"text-muted-foreground shrink-0 text-sm",children:a("sessionList.archives.count",{count:c.length})})]}),i("div",{className:"divide-border divide-y overflow-hidden rounded-lg border",children:c.map((o)=>n("article",{"aria-label":C(o),className:"flex flex-wrap items-center gap-4 px-4 py-3",children:[n("div",{className:"min-w-0 flex-1 basis-40",children:[i("h3",{className:"truncate text-sm font-medium",title:C(o),children:C(o)}),o.updatedAt!==null&&i("time",{dateTime:o.updatedAt,title:a("sessionList.archives.updatedAt"),className:"text-muted-foreground text-xs",children:ce.format(new Date(o.updatedAt))})]}),n("div",{className:"flex shrink-0 items-center gap-2",children:[i(e,{variant:"ghost",size:"icon-sm","aria-label":a("sessionList.delete"),title:a("sessionList.delete"),disabled:P,className:"text-muted-foreground hover:text-destructive",onClick:()=>{j(null),M(!1),S([o])},children:i(Z,{"aria-hidden":"true"})}),i(e,{variant:"secondary",size:"sm",disabled:P,onClick:()=>void ue(o),children:a("sessionList.archives.unarchive")})]})]},o.sessionId))})]},t)),R&&i(O,{variant:"destructive",children:i(F,{children:R})})]})]}),i(d,{open:I!==null,onOpenChange:(t)=>{if(!t&&!x.current)S(null)},children:n(u,{showCloseButton:!D,children:[n(w,{children:[i(m,{children:a("sessionList.archives.deleteTitle")}),i(k,{children:a(ne?"sessionList.archives.deleteAllDescription":"sessionList.archives.deleteDescription",{count:I?.length??0})})]}),J&&i(O,{variant:"destructive",children:i(F,{className:"max-h-40 overflow-auto whitespace-pre-wrap",children:J})}),n(z,{children:[i(e,{variant:"outline",disabled:D,onClick:()=>S(null),children:a("sessionList.cancel")}),n(e,{variant:"destructive",className:"text-[color-mix(in_oklab,var(--destructive)_80%,var(--foreground))]",disabled:P,onClick:()=>void de(),children:[D&&i(ve,{}),a("sessionList.archives.confirmDelete")]})]})]})})]})}
|
|
3
|
+
export{yr};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Mn,x}from"./chunk-tpx841s3.js";import{un}from"./chunk-v5wwv2t9.js";import{Y}from"./chunk-d2rrvka6.js";import{Tn,In,Pn,Sn,Nn,D}from"./chunk-hrexfky6.js";import{fn,hn}from"./chunk-2ysnmwx1.js";import{Ct}from"./chunk-xfjcwypy.js";import{t,o}from"./chunk-6d38ff76.js";import{n}from"./chunk-76tkqx9n.js";import{It}from"./chunk-spt7tnqx.js";import{i,An,T,et}from"./chunk-z3e38981.js";import{Qe}from"./chunk-yegh80h4.js";import{te,Ye}from"./chunk-mv8jmv1e.js";import{tt,ot}from"./chunk-7e1m1d9x.js";import{xn}from"./chunk-k2zg8xva.js";import{Xe}from"./chunk-fwd1zewt.js";import{wn}from"./chunk-jwb3723b.js";import{je}from"./chunk-h9tnsvjr.js";import{Ze}from"./chunk-91trh8rj.js";import{yn}from"./chunk-5t3rrnfd.js";import{Cn}from"./chunk-kg1gk77d.js";import{Ke}from"./chunk-8bzk9e4v.js";import{hasFuzzyFileSearch as Et}from"@nyssance/codex-acp-v2/client";import{PlusIcon as St}from"lucide-react";import{useCallback as S,useEffect as Nt,useLayoutEffect as q,useMemo as J,useRef as K,useState as N}from"react";import{jsx as c,jsxs as v}from"react/jsx-runtime";var Ot=["image/png","image/jpeg","image/webp","image/gif"],Q=[];async function Ft(e){let d=await(await fetch(e.url)).blob();return new Promise((b,G)=>{let I=new FileReader;I.onerror=()=>G(I.error),I.onload=()=>{let O=I.result;b(O.slice(O.indexOf(",")+1))},I.readAsDataURL(d)})}function kt(e){let{t:d}=t(),b=x();return c(D,{"aria-label":d("composer.attachImage"),title:d("composer.attachImage"),onClick:()=>b.openFileDialog(),...e,children:c(St,{className:"size-4"})})}function Ge({session:e,onSubmit:d,onHandOff:b,modelSelector:G,modelMenu:I,inputHeader:O,actions:ft,children:ht,attachmentPolicy:gt,predictions:xt=!0,disabled:yt=!1,preparing:Z=!1,allowPendingInput:Pt=!1}){let{host:F,client:A}=n(),{t:s}=F,k=S((r)=>{if(F.reportError)F.reportError(r);else console.error(r)},[F]),[rt,B]=N(()=>({text:i.get(e.id)?.text??"",revision:0})),{text:M}=rt,[w,bt]=N(()=>i.get(e.id)?.attachments??Q),[h,L]=N(()=>i.get(e.id)?.mentions??[]),W=w.some((r)=>te(r)&&r.pastedText.status!=="ready"),[C,nt]=N(!1),[z,vt]=N(!1),[V,at]=N(!1),u=K(null),it=K(null),a=K(rt),U=S((r)=>{it.current?.(),a.current={text:r,revision:a.current.revision+1},B(a.current)},[]),ct=J(()=>({read:()=>{let p=u.current?.getTextarea(),g=p===null||p===void 0?[a.current.text.length,a.current.text.length]:[p.selectionStart,p.selectionEnd];return{target:e.id,...a.current,selection:g}},compareAndSet(p,g,y){if(p.target!==e.id||p.revision!==a.current.revision)return null;a.current={text:g,revision:a.current.revision+1},B(a.current);let l=u.current?.getTextarea();if(l!==null&&l!==void 0)l.value=g,l.setSelectionRange(y[0],y[1]);return{target:e.id,...a.current,selection:y}}}),[e.id]),_=K(null),pt=S((r)=>(_.current=r,()=>{if(_.current===r)_.current=null}),[]),mt=e.state!=="idle",f=!yt&&!Z&&e.attached&&!e.restoring&&!e.readOnly,R=!e.readOnly&&(Pt||f),E=Ze(e,f&&!C&&!z&&!W&&!V,M.length>0||w.length>0||h.length>0,xt),st=E.invalidate;q(()=>{i.set(e.id,{text:M,attachments:w,mentions:h,modelId:i.get(e.id)?.modelId??null})},[e.id,M,w,h]),q(()=>An(e.id,bt),[e.id]),q(()=>et(e.id,(r)=>{if(!R||C)throw Error("The composer cannot take text now; try again later");if(M.length||w.length||h.length)throw Error("The composer already has a draft; send or clear it first");U(r)}),[e.id,R,C,M,w,h,U]);let lt=o((r)=>Et(r.agent)),wt=J(()=>lt&&f?async(r)=>Qe((await A.fuzzyFileSearch({query:r,roots:[e.cwd]})).files):void 0,[A,lt,f,e.cwd]),X=S((r)=>{L((p)=>p.includes(r)?p:[...p,r])},[]);Nt(()=>{u.current?.focus()},[]);let dt=S(async({text:r,files:p})=>{let g=r.trim();if(g.length===0&&p.length===0&&h.length===0)return;let y=_.current;nt(!0);let l=i.get(e.id),Rt=a.current.revision,j=null;try{let P=[];for(let m of h){let H={kind:"file",absPath:m};P.push({type:"resource_link",uri:tt(H),name:ot(H)})}if(g.length>0)P.push({type:"text",text:g});for(let m of p)if(te(m)){if(m.pastedText.status!=="ready")throw Error("Text attachment is not ready");P.push({type:"resource_link",uri:m.url,name:m.filename??"pasted-text.txt"})}else P.push({type:"image",data:await Ft(m),mimeType:m.mediaType});if(a.current.revision===Rt&&i.get(e.id)===l)a.current={text:"",revision:a.current.revision+1},j=a.current.revision,B(a.current),L([]),T(e.id,()=>Q),i.set(e.id,{text:"",attachments:Q,mentions:[],modelId:l?.modelId??null}),u.current?.resetHeight();if(d)if(y===null)await d(P);else await d(P,(m)=>{if(y.signal.aborted||_.current!==y)return;y.accept(m),b?.(e.id,m)});else if(y===null)await A.prompt(e.id,P);else{let m=await A.prompt(e.id,P);y.accept(m)}st();for(let m of l?.attachments??[])if(m.url.startsWith("blob:")&&!i.get(e.id)?.attachments.some((H)=>H.id===m.id))URL.revokeObjectURL(m.url)}catch(P){if(l&&j!==null&&a.current.revision===j&&i.get(e.id)?.attachments.length===0&&i.get(e.id)?.mentions.length===0)a.current={text:l.text,revision:j+1},B(a.current),L(l.mentions),i.set(e.id,l),T(e.id,()=>l.attachments);throw P}finally{nt(!1),u.current?.focus()}},[A,e.id,h,d,b,st]),Tt=()=>{A.cancel(e.id).catch(k)},At=S((r)=>{let p=r.code==="max_total_size"?Object.assign(Error(s("composer.imageTooLargeTitle")),{description:s("composer.imageTooLargeDescription",{mb:Y})}):Object.assign(Error(s("composer.unsupportedAttachmentTitle")),{description:s("composer.unsupportedAttachmentDescription")});k(p)},[k,s]),Mt=J(()=>({session:e,ready:f,inputReady:R,sending:C,textareaRef:u,draft:ct,interruptRef:it,observeReceipts:pt,addMention:X,setAdding:vt,handsFree:d===void 0||b!==void 0}),[e,f,R,C,ct,pt,X,d,b]),ut=F.writeTextAttachment;return c(It,{value:Mt,children:c("div",{"data-chat-drop-zone":!0,className:"mx-auto w-full max-w-3xl px-6 pb-5",children:v("div",{className:"relative",children:[O&&c("div",{"data-chat-input-header":!0,className:"bg-sidebar dark:bg-foreground/3 relative top-1 z-0 mx-[13px] -mb-[18px] flex min-w-0 items-center gap-2 overflow-hidden rounded-t-2xl px-1.5 pt-1.5 pb-[27px]",children:O}),v(Mn,{attachmentPolicy:gt,value:M,revision:a.current.revision,onValueChange:U,onSubmittedClear:()=>{a.current={text:"",revision:a.current.revision+1},B(a.current)},attachments:w,onAttachmentsChange:(r)=>T(e.id,()=>r),children:[c(un,{handleRef:u,commands:e.commands,searchFiles:wt,onMention:X,onSearchError:k,forcedOpen:V,onForcedOpenChange:at,emptyLabel:s("composer.noCommands"),fileStatusLabels:{loading:s("composer.searchingFiles"),empty:s("composer.noMatchingFiles")}}),v(Tn,{globalDrop:!0,multiple:!0,accept:Ot.join(","),onError:At,onSubmit:dt,onSubmitAsync:dt,onSubmitError:k,canSubmit:()=>f&&!C&&!z&&!W?!0:"chat_not_ready",className:"relative z-10",children:[ht,v(Pn,{className:"px-3 pt-3 pb-0 empty:hidden",children:[z&&c("span",{role:"status",className:"text-muted-foreground text-xs",children:s("composer.addingFiles")}),c(xn,{mentions:h,onRemove:(r)=>L((p)=>p.filter((g)=>g!==r))}),c(hn,{children:(r)=>te(r)?c(wn,{data:r,sessionId:e.id}):c(fn,{data:r,t:s})})]}),v(In,{className:"mb-0 min-h-16 px-3 pt-4 pb-2",onKeyDownCapture:(r)=>{if(!E.text||u.current?.isComposing()||r.nativeEvent.isComposing||r.nativeEvent.keyCode===229||r.shiftKey||r.ctrlKey||r.altKey||r.metaKey||r.target!==u.current?.getTextarea())return;if(r.key==="Tab")r.preventDefault(),r.stopPropagation(),U(E.text)},children:[c(Ct,{className:"min-h-10 bg-transparent text-sm font-normal",ref:u,rows:2,bashMode:!1,disabled:!R,onPasteCapture:ut?(r)=>Ye(r,e.id,s("composer.pastedTextFilename"),ut):void 0,placeholder:E.text||(mt?s("composer.steerPlaceholder"):s("composer.placeholder")),"aria-label":s("composer.placeholder")}),E.error&&c("span",{className:"text-muted-foreground text-xs",role:"status",title:E.error,children:s("composer.predictionUnavailable")})]}),c(Sn,{className:"chat-composer-toolbar @container/input-footer mt-0 mb-2 w-full min-w-0 p-0",children:v("div",{className:"grid w-full min-w-0 grid-cols-[auto_minmax(0,1fr)] items-center gap-x-[5px] px-2",children:[v("div",{className:"flex min-w-0 items-center gap-[5px]",children:[c(kt,{className:"text-foreground",disabled:!R}),c(yn,{textareaRef:u,menuOpen:V,onOpenChange:at,disabled:!f||e.commands.length===0}),c(je,{sessionId:e.id,options:e.configOptions,disabled:!f})]}),v(Nn,{className:"w-full min-w-0 items-center justify-end gap-1",children:[c(Ke,{session:e}),G??c(Xe,{...I,sessionId:e.id,options:e.configOptions,disabled:!f}),ft,c(Cn,{active:mt,sending:C||Z||z,ready:f&&!W,hasMentions:h.length>0,onStop:Tt})]})]})})]})]})]})})})}
|
|
2
|
+
export{Ge};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{vn}from"./chunk-wrs447cs.js";import{n,b}from"./chunk-76tkqx9n.js";import{I,y}from"./chunk-9c41y5hw.js";import{createLucideIcon as k,HandIcon as w,ShieldAlertIcon as S,ShieldCheckIcon as r}from"lucide-react";import{jsx as t}from"react/jsx-runtime";var O=k("ApprovalShield",[["path",{d:"M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11",key:"shield"}],["path",{d:"m8 8 3 3-3 3M13 15h3",key:"terminal"}]]),d={"read-only":w,"workspace-write":r,agent:O,"agent-full-access":S},A={"read-only":"readOnly","workspace-write":"workspaceAccess",agent:"agent","agent-full-access":"fullAccess"};function je({sessionId:u,options:m,disabled:g,onConfigChange:c}){let{host:l,client:f}=n(),{t:a}=l,s=y(m,"mode");if(!s)return null;let o=s.currentValue,p=I(s).map((e)=>{let i=A[e.value];return i?{...e,name:a(`permissionModes.${i}.name`),description:a(`permissionModes.${i}.description`)}:e}),h=p.find((e)=>e.value===o),M=d[o]??r,v=(e)=>{if(e===o)return;b(l,c?c(s.configId,e):f.setConfig(u,s.configId,e))};return t(vn,{value:o,currentName:h?.name??o,icon:t(M,{className:"size-3.5 shrink-0"}),header:a("permissionModes.heading"),disabled:g,label:a("composer.switchPermissionMode"),onValueChange:v,options:p.map((e)=>{let i=d[e.value]??r,C=e.value==="agent-full-access";return{value:e.value,label:t("span",{"data-permission-warning":C?"":void 0,children:e.name}),description:e.description?t("span",{className:"whitespace-normal",children:e.description}):void 0,icon:t(i,{className:"size-3.5 shrink-0"})}})})}
|
|
2
|
+
export{je};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
export{
|
|
1
|
+
var xi=280;function ho({entries:i,gapPx:t,measuredHeightsByKey:o,leadingInsetPx:e=0}){let n=[],r=[],d=new Map,s=[],u=e;for(let[x,a]of i.entries()){d.set(a.turnKey,x);for(let h of a.aliases??[])d.set(h,x);s.push(a.turnKey),r.push(u);let f=a.aliases?.map((h)=>o[h]).find((h)=>h!==void 0),m=o[a.turnKey]??f??a.estimatedHeightPx??280;if(n.push(m),u+=m,x<i.length-1)u+=t}return{bottomOffsetsPx:r.map((x,a)=>{let f=n[a];if(f===void 0)throw Error(`Codex turn height is missing at index ${a}`);return u-x-f}),heightsPx:n,topOffsetsPx:r,totalHeightPx:u,turnIndexByKey:d,turnKeys:s}}function ye({distanceFromBottomPx:i,layout:t,overscanCount:o,viewportHeightPx:e}){if(t.turnKeys.length===0)return{startIndex:0,endIndex:0};let n=Math.min(Math.max(0,i),t.totalHeightPx),r=Math.min(n+Math.max(0,e),t.totalHeightPx),d=g(t.bottomOffsetsPx,r),s=l(t.bottomOffsetsPx,t.heightsPx,n);return{startIndex:Math.max(0,d-o),endIndex:Math.min(t.turnKeys.length,Math.max(s,d+1)+o)}}function jt({anchorKey:i,layout:t,previousRange:o}){let e=t.turnIndexByKey.get(i);if(e===void 0)return null;return{startIndex:e,endIndex:Math.min(t.turnKeys.length,e+o.endIndex-o.startIndex)}}function vo({anchorKey:i,distanceFromBottomPx:t,nextLayout:o,previousLayout:e}){let n=e.turnIndexByKey.get(i),r=o.turnIndexByKey.get(i);if(n===void 0||r===void 0)return null;let d=e.bottomOffsetsPx[n],s=e.heightsPx[n],u=o.bottomOffsetsPx[r],x=o.heightsPx[r];if(d===void 0||s===void 0||u===void 0||x===void 0)throw Error(`Codex turn geometry is missing: ${i}`);return Math.max(0,t+u+x-d-s)}function xo({layout:i,turnKey:t,viewportHeightPx:o}){let e=i.turnIndexByKey.get(t);if(e===void 0)return null;let n=i.bottomOffsetsPx[e],r=i.heightsPx[e];if(n===void 0||r===void 0)throw Error(`Codex turn geometry is missing: ${t}`);return Math.max(0,n-o/2+r/2)}function yo({align:i,layout:t,targetHeightPx:o,targetOffsetPx:e,turnKey:n,viewportHeightPx:r}){let d=t.turnIndexByKey.get(n);if(d===void 0)return null;let s=t.bottomOffsetsPx[d],u=t.heightsPx[d];if(s===void 0||u===void 0)throw Error(`Codex turn geometry is missing: ${n}`);let x=s+u-e;return i==="top"?Math.max(0,x-r+10):Math.max(0,x-o/2-r/2)}function g(i,t){let o=0,e=i.length;while(o<e){let n=Math.floor((o+e)/2),r=i[n];if(r===void 0)throw Error(`Codex bottom offset is missing at index ${n}`);if(r<t)e=n;else o=n+1}return o}function l(i,t,o){let e=0,n=i.length;while(e<n){let r=Math.floor((e+n)/2),d=i[r],s=t[r];if(d===void 0||s===void 0)throw Error(`Codex turn geometry is missing at index ${r}`);if(d+s<=o)n=r;else e=r+1}return e}
|
|
2
|
+
export{xi,ho,ye,jt,vo,xo,yo};
|
|
@@ -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
|
|
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 Rr=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 Ae({className:r,variant:e="default",render:t,...i}){return n({defaultTagName:"span",props:a({className:d(Rr({variant:e}),r)},i),render:t,state:{slot:"badge",variant:e}})}export{Rr,Ae};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{Kt,Qt}from"./chunk-s44rx1sz.js";import{f}from"./chunk-xf14bg2v.js";import{t}from"./chunk-6d38ff76.js";import{Jo,q,$e,tr}from"./chunk-0fvpmcps.js";import{Eo}from"./chunk-x053g6f2.js";import{Z}from"./chunk-3wsg6710.js";import{Xt}from"./chunk-kh1tc15g.js";import{Io}from"./chunk-78ew0821.js";import{Ho}from"./chunk-6pq1xmwg.js";import{Oo}from"./chunk-8p0074ye.js";import{tn,nn}from"./chunk-tzjk7zkc.js";import{Ue}from"./chunk-4jagfjhm.js";import{isContentEntry as oe,isEmbeddedResource as U,isImage as X,isResourceLink as ae,isText as me}from"@alwith/api";import{codexMessageError as z,codexTurnError as J,nativeTurnId as le}from"@nyssance/codex-acp-v2/client";import{LoaderCircleIcon as de,SparklesIcon as ce}from"lucide-react";import{Fragment as ge,memo as pe}from"react";import{jsx as s,jsxs as m,Fragment as R}from"react/jsx-runtime";function D(r){if(X(r))return`${r.mimeType.toLowerCase()}:${r.data}`;if(U(r)&&"blob"in r.resource&&r.resource.mimeType?.toLowerCase().startsWith("image/"))return`${r.resource.mimeType.toLowerCase()}:${r.resource.blob}`;return null}function T({sessionId:r,entry:n,terminals:l,streaming:o,streamingThoughtId:w}){let{t:a}=t();switch(n.kind){case"activity":return s(Eo,{sessionId:r,items:n.items,terminals:l,streamingThoughtId:w});case"text":return f(n.item._meta).length>0?s(Xt,{sessionId:r,item:n.item}):s(Z,{content:n.item.content,messageId:n.item.id,streaming:o});case"plan":return s(Ho,{plan:n.item.plan});case"compaction":if(n.item.status==="failed")return m(tn,{children:[s("div",{children:a("timeline.compactionFailed")}),n.item.error!==null&&s("div",{children:n.item.error})]});return m("div",{className:"codex-context-compaction",children:[s(ce,{"aria-hidden":"true"}),s("span",{children:n.item.status==="completed"?a("stream.codex.contextCompacted"):n.item.status==="cancelled"?a("timeline.interrupted"):a("timeline.compacting")})]})}}function ue({sessionId:r,turn:n,terminals:l,active:o,blocked:w=!1,continued:a=!1,edits:S=n.edits,activityItems:_=n.items,workStartedAt:Y=n.startedAt,isLast:F,error:p,interrupted:M,retry:L,retrying:g,answerActions:W,footer:ee}){let{t:d}=t(),I=n.errors.map((e)=>{let i=z(e);if(i===null)throw Error("Turn error item is missing its diagnostics");let k=L?.turnId===le(e)?L:void 0;return s(nn,{error:i,retry:k},`${e.id}:${k?.delaySeconds??"manual"}`)});if(F&&p!==null&&!n.errors.some((e)=>{let i=z(e);return i!==null&&i.stopReason===p.stopReason&&J(i).message===J(p).message}))I.push(s(nn,{error:p},"current-run-error"));let v=I.length>0?s("div",{className:"codex-turn-errors",children:I}):null,u=n.work,y=u.length>0&&u.every((e)=>e.kind==="compaction");if(Jo(n)||y&&n.final.length===0)return m(R,{children:[s("div",{role:"status",className:"text-muted-foreground flex min-w-0 flex-col gap-2 py-2 text-sm",children:n.work.map((e)=>s(T,{sessionId:r,entry:e,terminals:l,streaming:!1,streamingThoughtId:null},e.key))}),v]});let K=$e(n),O=n.final.filter((e)=>f(e._meta).length===0).map(q).join(`
|
|
2
|
+
`),h=o?null:Ue(n,"assistant"),P=n.items.filter((e)=>e.kind==="tool"&&e.name==="image_generation"&&(e.status==="pending"||e.status==="in_progress")),G=new Set(n.final.flatMap((e)=>e.content.map(D).filter((i)=>i!==null))),N=n.items.flatMap((e)=>{if(e.kind!=="tool"||e.status!=="completed")return[];return e.content.filter(oe).flatMap((i,k)=>{let c=i.content,ie=e.name==="image_generation"&&X(c),re=e.toolKind!=="read"&&e.toolKind!=="search"&&(ae(c)||U(c)&&("blob"in c.resource));if(!ie&&!re)return[];let b=D(c);if(b!==null){if(G.has(b))return[];G.add(b)}return[{key:`${e.id}:${k}`,block:c}]})}),A=n.final.some((e)=>f(e._meta).length===0&&e.content.some((i)=>!me(i)||i.text.trim().length>0)),te=P.length>0||N.length>0||y||A||n.final.some((e)=>f(e._meta).length>0),x=n.items.findIndex((e)=>n.final.includes(e)),C=(e)=>n.items.indexOf(e.kind==="activity"?e.items[0]:e.item),B=u.filter((e)=>x===-1||C(e)<x),ne=u.filter((e)=>x!==-1&&C(e)>x),se=[...n.final.map((e)=>({kind:"answer",item:e,index:n.items.indexOf(e)})),...ne.map((e)=>({kind:"work",entry:e,index:C(e)}))].toSorted((e,i)=>e.index-i.index),H=!o&&!a&&(O.trim().length>0?s(Kt,{text:O,isMostRecentTurn:F,time:h,afterCopy:W}):m("div",{className:"flex items-center gap-0.5",children:[W,h&&s("span",{className:"codex-user-time ms-1",title:h.full,children:h.short})]})),E=Oo({...n,items:_},{running:o,blocked:w,retrying:g!==void 0}),Q=E.kind==="reasoning"?E.ownerKey??null:null,V=E.kind==="thinking",j=tr({...n,items:_});return m(R,{children:[s(Qt,{stateKey:JSON.stringify([r,n.replayed?"history":"live",n.key]),active:o&&!A,defaultExpanded:o&&!A||!n.replayed&&(M||K),...j,startedAt:j.startedAt??Y,loading:V&&n.work.length===0,work:a||y?[]:B.map((e)=>s(T,{sessionId:r,entry:e,terminals:l,streaming:o,streamingThoughtId:Q},e.key)),answer:te||a?m("div",{className:"flex min-w-0 flex-col gap-3",children:[(a||y)&&B.map((e)=>s(T,{sessionId:r,entry:e,terminals:l,streaming:!1,streamingThoughtId:null},e.key)),se.map((e)=>{if(e.kind==="work")return s(T,{sessionId:r,entry:e.entry,terminals:l,streaming:o,streamingThoughtId:Q},e.entry.key);let i=e.item;return m(ge,{children:[f(i._meta).length>0?s(Xt,{sessionId:r,item:i}):s(Z,{content:i.content,messageId:i.id,streaming:o}),i===n.final.at(-1)&&H]},i.id)}),P.map((e)=>m("div",{className:"codex-image-generation",role:"status","aria-label":d(o?"timeline.imageGenerating":"timeline.imageStopped"),"aria-busy":o,children:[s("div",{className:"codex-image-generation-texture","aria-hidden":"true"}),m("span",{className:"codex-image-generation-status",children:[o&&s(de,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),d(o?"timeline.imageGenerating":"timeline.imageStopped")]})]},e.id)),N.length>0&&s("div",{className:"codex-reply-artifacts flex min-w-0 flex-col gap-3",children:N.map((e)=>s(Z,{content:[e.block],messageId:e.key,streaming:!1},e.key))}),n.final.length===0&&H]}):null,footer:m(R,{children:[V&&n.work.length>0&&s("div",{className:"codex-pending-message py-2",role:"status",children:s("span",{className:"codex-activity-running",children:d("message.thinking")})}),ee,S.length>0&&!o&&!a&&s(Io,{items:S}),M&&!K&&s("div",{className:"codex-interrupted-turn",role:"status",children:d("timeline.interrupted")}),!o&&v]})}),o&&g!==void 0&&s("div",{className:"text-muted-foreground py-2 text-sm",role:"status",children:g.capacity?(()=>{let e=/Reconnecting(?:\.\.\.)?\s+(\d+\/\d+)/.exec(g.message)?.[1];return e===void 0?d("timeline.capacityReconnecting"):d("timeline.capacityReconnectingProgress",{progress:e})})():g.message}),o&&v]})}var bo=pe(ue);
|
|
3
|
+
export{bo};
|