@alwith/module-chat 0.6.8 → 0.6.10
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/README.md +1 -1
- package/assets/catalogs/anthropic/models.json +308 -0
- package/assets/provider-catalog.json +29 -0
- package/dist/activity-host.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-3v39hqex.js → chunk-0aakfvnm.js} +2 -2
- package/dist/{chunk-8d86yqzq.js → chunk-0bqjz323.js} +1 -1
- package/dist/{chunk-8689y4n5.js → chunk-0e6fsbhg.js} +2 -2
- package/dist/{chunk-zae7p9pm.js → chunk-0f4hevya.js} +2 -2
- package/dist/chunk-0knwqeea.js +2 -0
- package/dist/{chunk-jwzwz2wr.js → chunk-118vx38k.js} +2 -2
- package/dist/{chunk-stzsxdpp.js → chunk-1gwv9823.js} +2 -2
- package/dist/{chunk-n3d2mv93.js → chunk-1jae0var.js} +3 -3
- package/dist/{chunk-wr5r2t2m.js → chunk-1wdq75b1.js} +2 -2
- package/dist/{chunk-rfahybr0.js → chunk-1zfg0nxv.js} +1 -1
- package/dist/{chunk-fgr2g610.js → chunk-23g1j51d.js} +3 -3
- package/dist/{chunk-1bfxezrb.js → chunk-2fh11ysa.js} +2 -2
- package/dist/{chunk-xrbydq2j.js → chunk-2kskj0w5.js} +2 -2
- package/dist/{chunk-fd8x014y.js → chunk-2vq4ee43.js} +2 -2
- package/dist/{chunk-grgq7twf.js → chunk-2wqn18x2.js} +2 -2
- package/dist/{chunk-fzgra242.js → chunk-2yy6y89g.js} +2 -2
- package/dist/{chunk-bpenajbp.js → chunk-384sh0aw.js} +2 -2
- package/dist/{chunk-ckhw0gr5.js → chunk-3azwj6wd.js} +2 -2
- package/dist/{chunk-qm649qdv.js → chunk-3b6m3wgn.js} +2 -2
- package/dist/{chunk-3jfkrwjq.js → chunk-3k1vzaxd.js} +2 -2
- package/dist/{chunk-5t8zx5e4.js → chunk-3r69g00w.js} +3 -3
- package/dist/{chunk-zmbf0v0n.js → chunk-3svrvg8g.js} +1 -1
- package/dist/{chunk-36mdfph1.js → chunk-42v3qgdq.js} +2 -2
- package/dist/{chunk-29jan02g.js → chunk-48fj5m0p.js} +2 -2
- package/dist/{chunk-wwq7d7qm.js → chunk-4bba521x.js} +3 -3
- package/dist/{chunk-q5fn378d.js → chunk-4jb5eb68.js} +1 -1
- package/dist/{chunk-gwa7hbzr.js → chunk-4pxxxt8s.js} +1 -1
- package/dist/{chunk-ym6h1x3a.js → chunk-4s8gw49m.js} +2 -2
- package/dist/{chunk-9e6rv193.js → chunk-4ytrtcdb.js} +2 -2
- package/dist/{chunk-zk2hwm10.js → chunk-5c1wx64d.js} +2 -2
- package/dist/{chunk-tqz7csrk.js → chunk-5e5hvfzj.js} +2 -2
- package/dist/{chunk-24kpx8fg.js → chunk-5pk4srmv.js} +2 -2
- package/dist/{chunk-c7p3vpyx.js → chunk-5q93tpax.js} +2 -2
- package/dist/{chunk-dz5ymd3t.js → chunk-67swkna1.js} +1 -1
- package/dist/{chunk-a8gzs651.js → chunk-6f7e67x1.js} +2 -2
- package/dist/{chunk-x6yxbndc.js → chunk-6k7249zb.js} +2 -2
- package/dist/{chunk-jg6r0ckn.js → chunk-7d7rq137.js} +1 -1
- package/dist/{chunk-q0bwkhpy.js → chunk-7mfkaftt.js} +2 -2
- package/dist/{chunk-7qwbxdyb.js → chunk-7nckaz1t.js} +2 -2
- package/dist/{chunk-k10kbwqc.js → chunk-7vcwgkhs.js} +2 -2
- package/dist/{chunk-5v8f2sbp.js → chunk-7zsa59w7.js} +2 -2
- package/dist/{chunk-akvpgx43.js → chunk-85nkcdqg.js} +2 -2
- package/dist/{chunk-xbqvb31f.js → chunk-8n1rq3xt.js} +2 -2
- package/dist/{chunk-70j4ee5r.js → chunk-8xtp7pxb.js} +1 -1
- package/dist/{chunk-1zypzzje.js → chunk-9098ssbp.js} +1 -1
- package/dist/{chunk-a8j61zs9.js → chunk-91ppvzvv.js} +2 -2
- package/dist/{chunk-jzaxy8af.js → chunk-ag4vzemv.js} +2 -2
- package/dist/{chunk-m1adrey8.js → chunk-ak2frpw9.js} +2 -2
- package/dist/{chunk-t1zw5wrq.js → chunk-as79cv4d.js} +2 -2
- package/dist/{chunk-ek3v1g24.js → chunk-b5jq0ken.js} +2 -2
- package/dist/{chunk-02jpgxy7.js → chunk-bktb5ys5.js} +1 -1
- package/dist/{chunk-c61yvpy3.js → chunk-c162bdr0.js} +2 -2
- package/dist/{chunk-f1r8wh4e.js → chunk-cbp0q0yt.js} +1 -1
- package/dist/{chunk-80r0jch1.js → chunk-ccmcm6sv.js} +2 -2
- package/dist/{chunk-5f889j6j.js → chunk-czp860hf.js} +2 -2
- package/dist/{chunk-84gk74hf.js → chunk-dnn1fcg8.js} +2 -2
- package/dist/{chunk-8an4t4kh.js → chunk-dwpx56ge.js} +1 -1
- package/dist/{chunk-0y1c3v1b.js → chunk-evs7bhpp.js} +1 -1
- package/dist/{chunk-8rpen55z.js → chunk-exkwydhf.js} +3 -3
- package/dist/chunk-f0g5k1d0.js +2 -0
- package/dist/{chunk-5f5jfr40.js → chunk-f17jdv7p.js} +1 -1
- package/dist/{chunk-7jmqq7b5.js → chunk-fvg2w21q.js} +3 -3
- package/dist/{chunk-acnqnrqb.js → chunk-gp0bxakd.js} +2 -2
- package/dist/{chunk-njre3ygs.js → chunk-gt343hrf.js} +2 -2
- package/dist/{chunk-4j6gy4me.js → chunk-h5zbmv4r.js} +2 -2
- package/dist/{chunk-p6gwrqjp.js → chunk-h800j36s.js} +2 -2
- package/dist/{chunk-hbm3sgw7.js → chunk-hpjh92s8.js} +2 -2
- package/dist/{chunk-pks7f314.js → chunk-jnpb9sqy.js} +5 -5
- package/dist/{chunk-h4adycra.js → chunk-jt54wp2c.js} +1 -1
- package/dist/{chunk-e0c8pmjc.js → chunk-jxgn4r9q.js} +3 -3
- package/dist/{chunk-0eewkw7t.js → chunk-k4dg1jep.js} +2 -2
- package/dist/{chunk-75ve01mr.js → chunk-k7d2y0wx.js} +2 -2
- package/dist/{chunk-pza08wvz.js → chunk-kc56dhwd.js} +2 -2
- package/dist/{chunk-z5c4njqk.js → chunk-khdjy444.js} +2 -2
- package/dist/chunk-km434w1k.js +2 -0
- package/dist/{chunk-ajjd22hb.js → chunk-ktknydpy.js} +3 -3
- package/dist/{chunk-2tc8kgsa.js → chunk-kvkpd69n.js} +2 -2
- package/dist/{chunk-s8xpf179.js → chunk-m58ryg53.js} +2 -2
- package/dist/{chunk-3m59n5gr.js → chunk-mma530jr.js} +1 -1
- package/dist/{chunk-70bm3f7n.js → chunk-mveefs0j.js} +2 -2
- package/dist/{chunk-v0mbfaqw.js → chunk-n14f6z0f.js} +2 -2
- package/dist/{chunk-9p1jvznr.js → chunk-ncs6yc8v.js} +2 -2
- package/dist/{chunk-g0gq72z9.js → chunk-ncsdkb8h.js} +2 -2
- package/dist/{chunk-xgyb00qq.js → chunk-ne804jep.js} +2 -2
- package/dist/{chunk-np76wm1k.js → chunk-nrz6w8rd.js} +1 -1
- package/dist/{chunk-j18830g5.js → chunk-ny85vn0b.js} +2 -2
- package/dist/{chunk-zfag3ne0.js → chunk-pj7m1bs8.js} +2 -2
- package/dist/chunk-pmzkz6hg.js +2 -0
- package/dist/{chunk-80a1fdx8.js → chunk-pnm040ke.js} +1 -1
- package/dist/{chunk-gfrzmgz4.js → chunk-pp1rr3jj.js} +1 -1
- package/dist/{chunk-m7wse5yk.js → chunk-ps3vgzbn.js} +2 -2
- package/dist/{chunk-2kjbas8a.js → chunk-q06r0t1d.js} +2 -2
- package/dist/{chunk-kxw57gdb.js → chunk-q4rad054.js} +2 -2
- package/dist/{chunk-v5mb5c61.js → chunk-q6ymd3n1.js} +2 -2
- package/dist/{chunk-yfws137b.js → chunk-qephgzb6.js} +2 -2
- package/dist/{chunk-p5mfv6t6.js → chunk-r5xd9p8p.js} +2 -2
- package/dist/{chunk-s4m2h876.js → chunk-rkww8p94.js} +1 -1
- package/dist/{chunk-wbhxpwm7.js → chunk-rnb0q6bt.js} +2 -2
- package/dist/{chunk-kctrzc57.js → chunk-rzx4tyx8.js} +1 -1
- package/dist/{chunk-bxmgvyfe.js → chunk-ss918bxh.js} +2 -2
- package/dist/{chunk-h9ywpga2.js → chunk-ts8edszy.js} +2 -2
- package/dist/{chunk-fbmbc4wt.js → chunk-tsfpx3fp.js} +2 -2
- package/dist/{chunk-8428vfp3.js → chunk-ttk7b5mr.js} +2 -2
- package/dist/{chunk-eq7vpgn7.js → chunk-v931rjk2.js} +2 -2
- package/dist/{chunk-g79y6q3f.js → chunk-v9nbx36v.js} +2 -2
- package/dist/{chunk-ha2f2cwz.js → chunk-va11ek5z.js} +2 -2
- package/dist/{chunk-958qyr8g.js → chunk-vdjhch6s.js} +2 -2
- package/dist/{chunk-pdrz9qs1.js → chunk-vfkhj17k.js} +2 -2
- package/dist/chunk-vnwb90j9.js +2 -0
- package/dist/{chunk-xgcwrqpw.js → chunk-vw7pqffn.js} +2 -2
- package/dist/{chunk-hkjj3prp.js → chunk-w89hdkar.js} +2 -2
- package/dist/{chunk-zjevkw68.js → chunk-wg45j5yr.js} +2 -2
- package/dist/{chunk-32s8dn1a.js → chunk-wjr2cjt1.js} +2 -2
- package/dist/{chunk-bt0t1pev.js → chunk-wq9hmwvb.js} +2 -2
- package/dist/chunk-wsny5ye8.js +2 -0
- package/dist/{chunk-6z36709h.js → chunk-wteebw32.js} +2 -2
- package/dist/{chunk-9wk2xp6v.js → chunk-x15sq8ff.js} +2 -2
- package/dist/{chunk-1fh3vvpe.js → chunk-x210arqv.js} +3 -3
- package/dist/{chunk-kjt77brz.js → chunk-x29s0dbq.js} +2 -2
- package/dist/{chunk-gkp0e28t.js → chunk-x2vms9xf.js} +2 -2
- package/dist/{chunk-jxgtgpa9.js → chunk-xmt5r1xe.js} +2 -2
- package/dist/{chunk-7egc2evj.js → chunk-xnszvze2.js} +2 -2
- package/dist/{chunk-nsy1ne51.js → chunk-xphfecws.js} +2 -2
- package/dist/{chunk-p38vws4a.js → chunk-xrsa8v3g.js} +2 -2
- package/dist/{chunk-1940kkcm.js → chunk-xw2zfj4c.js} +2 -2
- package/dist/chunk-y583je9q.js +2 -0
- package/dist/{chunk-nm4dtceb.js → chunk-yathdy79.js} +2 -2
- package/dist/{chunk-658y6xth.js → chunk-ydxrj4as.js} +2 -2
- package/dist/{chunk-8504eft8.js → chunk-ye7bksyy.js} +3 -3
- package/dist/{chunk-fnw16wjx.js → chunk-ynfp9w3s.js} +2 -2
- package/dist/{chunk-3zwbr9xs.js → chunk-yqnjd8mp.js} +2 -2
- package/dist/{chunk-18z4wmhb.js → chunk-z4jk07k1.js} +1 -1
- package/dist/{chunk-q9h89nv1.js → chunk-zns42kp5.js} +2 -2
- package/dist/{chunk-6pnsagt4.js → chunk-zx63zvpy.js} +1 -1
- package/dist/{chunk-brfr0m5g.js → chunk-zyjcpz4s.js} +1 -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.js +1 -1
- package/dist/codex/user-message.js +1 -1
- package/dist/codex/virtualized-turn-list.js +1 -1
- package/dist/collections/collection-emoji.js +1 -1
- package/dist/collections/collection-menu.js +1 -1
- package/dist/collections/collection-panel.js +1 -1
- package/dist/collections/collections.js +1 -1
- package/dist/collections/host.js +1 -1
- package/dist/collections/model.js +1 -1
- package/dist/collections/store.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/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/app-mentions.js +1 -1
- package/dist/conversation/composer/apps-menu.js +1 -1
- package/dist/conversation/composer/composer.js +1 -1
- package/dist/conversation/composer/context.js +1 -1
- package/dist/conversation/composer/drafts.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/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/prompt-history.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/connection-notice.js +1 -1
- package/dist/conversation/context.js +1 -1
- package/dist/conversation/conversation-body.js +1 -1
- package/dist/conversation/conversation-search.js +1 -1
- 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/draft-project-picker.js +1 -1
- package/dist/conversation/session-actions.js +1 -1
- package/dist/conversation/subagent-sessions.js +1 -1
- package/dist/generated/commands.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/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/plugins/catalog-skeleton.js +1 -1
- package/dist/plugins/host.js +1 -1
- package/dist/plugins/plugin-detail-page.js +1 -1
- package/dist/plugins/plugins-page.js +1 -1
- package/dist/plugins/plugins.js +1 -1
- package/dist/plugins/read-skill-document.js +1 -1
- package/dist/plugins/skill-document.js +1 -1
- package/dist/plugins/skills-tab.js +1 -1
- package/dist/search/chat-search.js +1 -1
- package/dist/search/codex-source-matches.js +1 -1
- 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/account-menu.js +1 -1
- package/dist/session-list/activity-list.js +1 -1
- package/dist/session-list/archived-sessions.js +1 -1
- package/dist/session-list/help-menu.js +1 -1
- package/dist/session-list/host.js +1 -1
- package/dist/session-list/navigation-controls.js +1 -1
- package/dist/session-list/navigation-header.js +1 -1
- package/dist/session-list/navigation-store.js +1 -1
- package/dist/session-list/navigation-tabs.js +1 -1
- package/dist/session-list/navigation.js +1 -1
- package/dist/session-list/platform.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.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/session-state-menu.js +1 -1
- package/dist/session-list/shortcut-hint.js +1 -1
- package/dist/session-list/shortcut.js +1 -1
- package/dist/session-list/sidebar-overlay.js +1 -1
- package/dist/session-list/use-activity-notification.js +1 -1
- package/dist/session-list/use-activity-preview.js +1 -1
- package/dist/session-list/use-cmd-held.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/image-generation-progress.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.js +1 -1
- package/dist/session-timeline/turn-activity.js +1 -1
- package/dist/session-timeline/turn-error.js +1 -1
- package/dist/session-timeline/turn-retry.js +1 -1
- 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/settings/codex-account-card.js +1 -1
- package/dist/settings/login-card.js +1 -1
- package/dist/settings/model-alias-settings.js +1 -1
- package/dist/settings/provider-logos.d.ts +1 -0
- package/dist/settings/provider-logos.js +1 -1
- package/dist/settings/provider-section.js +1 -1
- package/dist/settings/providers-port.js +1 -1
- package/dist/settings/providers.d.ts +1 -0
- package/dist/settings/providers.js +1 -1
- package/dist/settings/settings-bridge.js +1 -1
- package/dist/settings/settings.js +1 -1
- package/native/win32-x64/alwith_native_chat.dll +0 -0
- package/native/win32-x64/artifact.json +1 -1
- package/package.json +2 -2
- package/dist/chunk-3twka9f7.js +0 -2
- package/dist/chunk-5yq8k08p.js +0 -2
- package/dist/chunk-c47xfjk4.js +0 -2
- package/dist/chunk-kmeccf75.js +0 -2
- package/dist/chunk-w65d6934.js +0 -2
- package/dist/chunk-yvr086m7.js +0 -2
- package/dist/chunk-zqe4mjgy.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{xe,c}from"./chunk-k7y6dqf2.js";import{I}from"./chunk-qcj6f1rq.js";import{L}from"./chunk-
|
|
1
|
+
import{xe,c}from"./chunk-k7y6dqf2.js";import{I}from"./chunk-qcj6f1rq.js";import{L}from"./chunk-8n1rq3xt.js";import{S}from"./chunk-vdjhch6s.js";import{Ke,Ee,qe}from"./chunk-gbsqs904.js";import{PreviewCard as h}from"@base-ui/react/preview-card";import{cn as p}from"cn";import{LockIcon as D}from"lucide-react";import{createContext as _,useContext as E,useLayoutEffect as M,useState as T}from"react";import"@alwith/module-chat/session-list.css";import{jsx as e,jsxs as d,Fragment as K}from"react/jsx-runtime";function k(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 m({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 u({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,30px)] w-full items-center gap-1 overflow-hidden rounded-[10px] ps-1 pe-1.5 text-start text-sm outline-hidden [corner-shape:superellipse(1.5)] focus-visible:outline-2 focus-visible:outline-offset-[-2px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",t),...n})}function Q({open:o,onOpenChange:t,tooltip:n,leading:r,label:i,count:s,countLabel:a,active:l=!1,actions:C,headerChildren:g,wrapHeader:f,onHeaderClick:b,children:P}){let y=()=>{b?.(),t(!o)},x=p(Ke,"relative flex h-[var(--navigation-row-height,30px)] w-full items-center gap-1 rounded-[10px] ps-1 pe-1.5 text-start [corner-shape:superellipse(1.5)]"),R=d(K,{children:[r!=null&&e(m,{children:r}),g??e(I,{className:"flex-1 text-sm opacity-70",children:i}),e("span",{className:"relative z-10 ms-auto",children:e(qe,{content:s!==void 0?e(Ee,{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:C})})]}),H=g==null?d("div",{"data-active":l?"":void 0,title:n,className:p(x,c),onClick:y,onKeyDown:(v)=>{if(v.target!==v.currentTarget)return;if(v.key!=="Enter"&&v.key!==" ")return;v.preventDefault(),y()},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]"}),R]}):e("div",{"data-active":l?"":void 0,className:x,children:R});return d("div",{className:"text-[#1a1c1f] dark:text-white",children:[f===void 0?H:f(H),o&&e(k,{className:"mt-0.5",children:P})]})}var G=_(()=>{}),z=_(()=>{});function Rt(){return E(z)}function ve(){return E(G)}function ye({active:o=!1,state:t,interruption:n=null,leased:r=!1,media:i,title:s,hoverCard:a,onHoverCardOpenChange:l,subtitle:C,preview:g,listeningPorts:f,onOpenPort:b,accessory:P,meta:y,hint:x,actions:R,className:H,...v}){let O=d("div",{"data-slot":"navigation-session-item","data-active":o,className:p(Ke,xe,"group/navigation-row focus-visible:outline-ring flex h-[var(--navigation-row-height,30px)] w-full items-center gap-1 overflow-hidden rounded-[10px] ps-1 pe-1.5 text-start text-sm outline-hidden [corner-shape:superellipse(1.5)] focus-visible:outline-2 focus-visible:outline-offset-[-2px]",(g||f!=null&&f.length>0)&&"h-auto min-h-[var(--navigation-row-height,30px)] py-2.5",H),...v,children:[e(m,{children:t!=null?e(L,{state:t,title:n??void 0}):i}),d("span",{className:"flex min-w-0 flex-1 flex-col",children:[e(I,{className:p("leading-none",t==="done"&&"font-semibold"),children:s}),C!=null&&e(I,{className:"text-muted-foreground text-xs",children:C}),g&&e("span",{className:"text-muted-foreground mt-1.5 line-clamp-2 text-xs leading-[18px] [overflow-wrap:anywhere] break-words",children:g}),f!=null&&f.length>0&&e("span",{className:"text-muted-foreground mt-1.5 flex flex-wrap items-center gap-2 font-mono text-xs",children:f.map((N)=>b?d("button",{type:"button",className:"underline",onPointerDown:(w)=>w.stopPropagation(),onKeyDown:(w)=>w.stopPropagation(),onClick:(w)=>{w.stopPropagation(),b(N)},children:[":",N]},N):d("span",{children:[":",N]},N))})]}),d("span",{className:"relative ms-auto flex shrink-0 items-center gap-1",children:[r&&e(D,{className:"text-muted-foreground size-3"}),e(qe,{content:P!=null?e(Ee,{children:P}):y??e(Ee,{}),actions:R}),x!=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:x})]})]});if(a==null)return O;return e(q,{row:O,onOpenChange:l,children:a})}function q({row:o,children:t,onOpenChange:n}){let[r,i]=T(!1),[s,a]=T(!1),l=r||s;return M(()=>(n?.(l),()=>n?.(!1)),[l,n]),e(G.Provider,{value:a,children:e(z.Provider,{value:()=>{i(!1),a(!1)},children:e(j,{open:l,onOpenChange:i,trigger:o,children:t})})})}function j({open:o,onOpenChange:t,trigger:n,children:r,side:i="inline-end",sideOffset:s=2,align:a="start",alignOffset:l}){return S(o),d(h.Root,{open:o,onOpenChange:t,children:[e(h.Trigger,{render:n,delay:700,closeDelay:100}),e(h.Portal,{children:e(h.Positioner,{side:i,sideOffset:s,align:a,alignOffset:l,className:"isolate z-50",children:e(h.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
2
|
export{k,m,u,Q,Rt,ve,ye};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{invoke as r}from"@tauri-apps/api/core";import{listen as t,once as s,emit as n,emitTo as o}from"@tauri-apps/api/event";var C={providersRead:()=>r("plugin:alwith-chat|providers_read"),providersSave:(e)=>r("plugin:alwith-chat|providers_save",e),providersSaveCustom:(e)=>r("plugin:alwith-chat|providers_save_custom",e),providersRemoveCustom:(e)=>r("plugin:alwith-chat|providers_remove_custom",e),providersTest:(e)=>r("plugin:alwith-chat|providers_test",e),providersApply:()=>r("plugin:alwith-chat|providers_apply"),providersAccountBind:(e)=>r("plugin:alwith-chat|providers_account_bind",e),providersRefreshManaged:(e)=>r("plugin:alwith-chat|providers_refresh_managed",e),providersClearManaged:()=>r("plugin:alwith-chat|providers_clear_managed"),readSkillDocument:(e)=>r("plugin:alwith-chat|read_skill_document",e),sessionsList:(e)=>r("plugin:alwith-chat|sessions_list",e),sessionsCountTypes:(e)=>r("plugin:alwith-chat|sessions_count_types",e),sessionsPersonaEvidence:(e)=>r("plugin:alwith-chat|sessions_persona_evidence",e),getModelPricing:()=>r("plugin:alwith-chat|get_model_pricing"),scanSessionAggregates:(e)=>r("plugin:alwith-chat|scan_session_aggregates",e),exportWeekSessions:()=>r("plugin:alwith-chat|export_week_sessions"),dailyTokenUsage:(e)=>r("plugin:alwith-chat|daily_token_usage",e),downloadUsageJson:(e)=>r("plugin:alwith-chat|download_usage_json",e),wordCloud:(e)=>r("plugin:alwith-chat|word_cloud",e)},rn={"providers:changed":{name:"providers:changed",listen:(e)=>t("providers:changed",e),once:(e)=>s("providers:changed",e),emit:(e)=>n("providers:changed",e),emitTo:(e,i)=>o(e,"providers:changed",i)},"providers:managed-revoked":{name:"providers:managed-revoked",listen:(e)=>t("providers:managed-revoked",e),once:(e)=>s("providers:managed-revoked",e),emit:(e)=>n("providers:managed-revoked",e),emitTo:(e,i)=>o(e,"providers:managed-revoked",i)}};function
|
|
2
|
-
export{C,rn,
|
|
1
|
+
import{invoke as r}from"@tauri-apps/api/core";import{listen as t,once as s,emit as n,emitTo as o}from"@tauri-apps/api/event";var C={providersRead:()=>r("plugin:alwith-chat|providers_read"),providersSave:(e)=>r("plugin:alwith-chat|providers_save",e),providersSaveCustom:(e)=>r("plugin:alwith-chat|providers_save_custom",e),providersRemoveCustom:(e)=>r("plugin:alwith-chat|providers_remove_custom",e),providersTest:(e)=>r("plugin:alwith-chat|providers_test",e),providersApply:()=>r("plugin:alwith-chat|providers_apply"),providersAccountBind:(e)=>r("plugin:alwith-chat|providers_account_bind",e),providersRefreshManaged:(e)=>r("plugin:alwith-chat|providers_refresh_managed",e),providersClearManaged:()=>r("plugin:alwith-chat|providers_clear_managed"),readSkillDocument:(e)=>r("plugin:alwith-chat|read_skill_document",e),sessionsList:(e)=>r("plugin:alwith-chat|sessions_list",e),sessionsCountTypes:(e)=>r("plugin:alwith-chat|sessions_count_types",e),sessionsPersonaEvidence:(e)=>r("plugin:alwith-chat|sessions_persona_evidence",e),getModelPricing:()=>r("plugin:alwith-chat|get_model_pricing"),scanSessionAggregates:(e)=>r("plugin:alwith-chat|scan_session_aggregates",e),exportWeekSessions:()=>r("plugin:alwith-chat|export_week_sessions"),dailyTokenUsage:(e)=>r("plugin:alwith-chat|daily_token_usage",e),downloadUsageJson:(e)=>r("plugin:alwith-chat|download_usage_json",e),wordCloud:(e)=>r("plugin:alwith-chat|word_cloud",e)},rn={"providers:changed":{name:"providers:changed",listen:(e)=>t("providers:changed",e),once:(e)=>s("providers:changed",e),emit:(e)=>n("providers:changed",e),emitTo:(e,i)=>o(e,"providers:changed",i)},"providers:managed-revoked":{name:"providers:managed-revoked",listen:(e)=>t("providers:managed-revoked",e),once:(e)=>s("providers:managed-revoked",e),emit:(e)=>n("providers:managed-revoked",e),emitTo:(e,i)=>o(e,"providers:managed-revoked",i)}};function Qr(e){return typeof e==="object"&&e!==null&&typeof e.code==="string"&&typeof e.message==="string"}function pa(e){if(Qr(e)||e instanceof Error)return e.message;return String(e)}
|
|
2
|
+
export{C,rn,Qr,pa};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createStore as r}from"@alwith/api/client";var Oe=r({sessionId:null,turns:[],api:null,beforeReveal:null,terminals:{}});function
|
|
2
|
-
export{Oe,
|
|
1
|
+
import{createStore as r}from"@alwith/api/client";var Oe=r({sessionId:null,turns:[],api:null,beforeReveal:null,terminals:{}});function Wi(e){Oe.setState({...e,terminals:e.terminals??{}})}function Zi(e){if(Oe.getState().sessionId===e)Oe.setState({sessionId:null,turns:[],api:null,beforeReveal:null,terminals:{}})}async function Qi(e,n,t){let i=Oe.getState();if(t.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(n,void 0,{align:"top"})}
|
|
2
|
+
export{Oe,Wi,Zi,Qi};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createPortal as n}from"react-dom";import{jsx as t}from"react/jsx-runtime";function
|
|
2
|
-
export{
|
|
1
|
+
import{createPortal as n}from"react-dom";import{jsx as t}from"react/jsx-runtime";function ki({src:o,alt:e,onClose:i}){return n(t("button",{type:"button",className:"fixed inset-0 z-[1000] flex items-center justify-center",style:{backgroundColor:"rgba(0,0,0,0.7)"},onClick:i,children:t("img",{src:o,alt:e,style:{maxWidth:"90vw",maxHeight:"90vh",objectFit:"contain",borderRadius:4}})}),document.body)}
|
|
2
|
+
export{ki};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t,ct}from"./chunk-
|
|
2
|
-
export{
|
|
1
|
+
import{t,ct}from"./chunk-cbp0q0yt.js";import{isEmbeddedResource as B,isImage as h,isResourceLink as E}from"@nyssance/codex-acp-v2/client";import{DownloadIcon as T,FileIcon as N,ImageOffIcon as L,LoaderCircleIcon as F}from"lucide-react";import{useState as y}from"react";import{Button as u}from"@nyssance/shadcn/vega/components/ui/button";import{jsx as n,jsxs as o}from"react/jsx-runtime";function $r(e){let s=e.split(/[\\/]/).at(-1)??e;if(e.startsWith("file:")||/^https?:/.test(e))s=new URL(e).pathname.split("/").at(-1)??"";try{return decodeURIComponent(s)||"attachment"}catch(a){if(a instanceof URIError)return s||"attachment";throw a}}function U(e,s){let a=document.createElement("a");a.href=s,a.download=e,a.click()}function Y({block:e,generated:s=!1}){let a=t(),[p,d]=y(!1),[I,C]=y(null);if(E(e)){if(e.uri==="codex-image:unavailable")return o("span",{className:"text-muted-foreground flex items-center gap-2 rounded-lg border p-3 text-sm",children:[n(L,{className:"size-4"}),a.t("timeline.imageUnavailable")]});let c=$r(e.uri);return o(u,{variant:"outline",className:"h-auto max-w-full min-w-0 justify-start gap-3 overflow-hidden p-3","aria-label":e.title??e.name,title:e.uri,onClick:()=>a.openLink(e.uri),children:[n(N,{}),o("span",{className:"min-w-0 flex-1 text-start",children:[n("span",{className:"block truncate",children:e.title??e.name}),o("span",{className:"text-muted-foreground block truncate text-xs",children:[(e.title??e.name)!==c&&`${c} · `,e.mimeType??c.split(".").at(-1)?.toUpperCase()]})]})]})}if(!B(e)&&!h(e))return null;let i=h(e)?{uri:e.uri??`image.${e.mimeType.split("/")[1]??"png"}`,mimeType:e.mimeType,blob:e.data}:e.resource,r=$r(i.uri);if("text"in i)return o("div",{className:"min-w-0",children:[n("pre",{className:"overflow-x-auto whitespace-pre-wrap",children:i.text}),o(u,{variant:"link",size:"sm",className:"max-w-full min-w-0",title:i.uri,onClick:()=>a.openLink(i.uri),children:[n(N,{}),n("span",{className:"truncate",children:r})]})]});let l=`data:${i.mimeType??"application/octet-stream"};base64,${i.blob}`,f=i.mimeType?.toLowerCase().startsWith("image/")&&I!==l,{openImage:g,openImageGallery:w}=a,x=w?()=>w([{src:l,alt:r,uri:i.uri}],0):g&&(()=>g(l)),m=s&&f,R=async()=>{d(!0);try{if(a.saveFile)await a.saveFile(r,i.blob);else U(r,l)}catch(c){ct(a,c)}finally{d(!1)}},v=n("img",{src:l,alt:"",className:s?"max-h-[40rem] max-w-full object-contain":"max-h-96 max-w-full rounded object-contain",onError:()=>C(l)});return o("div",{className:m?"codex-generated-image":"flex max-w-full min-w-0 flex-col items-start gap-1",children:[f&&(x===void 0?v:n(u,{variant:"ghost",className:s?"codex-generated-image-preview h-auto max-w-full p-0":"h-auto max-w-full p-0","aria-label":a.t("timeline.viewImage"),onClick:x,children:v})),o(u,{variant:m?"secondary":"link",size:m?"icon":"sm",className:m?"codex-generated-image-download":"max-w-full min-w-0",disabled:p,title:a.t("timeline.download",{name:r}),"aria-label":a.t("timeline.download",{name:r}),onClick:()=>{R()},children:[p?n(F,{className:"motion-safe:animate-spin"}):n(T,{}),!m&&n("span",{className:"truncate",children:r})]})]})}
|
|
2
|
+
export{$r,Y};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var z=/[\\/._\- ]/;function h(r,n){if(n===0)return!0;let s=r[n-1];if(z.test(s))return!0;let c=r[n];if(s===s.toLowerCase()&&c!==c.toLowerCase())return!0;return!1}function pn(r,n){if(!n)return{score:0,indices:[]};let s=r.toLowerCase(),c=n.toLowerCase(),i=[],t=0,e=0,u=-2;for(let l of c.split("")){let o=-1;while(t<s.length){if(s[t]===l){o=t;break}t++}if(o<0)return null;if(e+=1,o===u+1)e+=4;if(h(r,o))e+=5;let f=r.lastIndexOf("/");if(f!==-1&&o>f)e+=2;i.push(o),u=o,t=o+1}if(e-=Math.floor(r.length/50),r.includes(n))e+=3;return{score:e,indices:i}}function
|
|
2
|
-
export{pn,
|
|
1
|
+
var z=/[\\/._\- ]/;function h(r,n){if(n===0)return!0;let s=r[n-1];if(z.test(s))return!0;let c=r[n];if(s===s.toLowerCase()&&c!==c.toLowerCase())return!0;return!1}function pn(r,n){if(!n)return{score:0,indices:[]};let s=r.toLowerCase(),c=n.toLowerCase(),i=[],t=0,e=0,u=-2;for(let l of c.split("")){let o=-1;while(t<s.length){if(s[t]===l){o=t;break}t++}if(o<0)return null;if(e+=1,o===u+1)e+=4;if(h(r,o))e+=5;let f=r.lastIndexOf("/");if(f!==-1&&o>f)e+=2;i.push(o),u=o,t=o+1}if(e-=Math.floor(r.length/50),r.includes(n))e+=3;return{score:e,indices:i}}function _o(r,n,s,c=100){if(!n)return r.slice(0,c).map((t)=>({item:t,score:0,indices:[]}));let i=[];for(let t of r){let e=pn(s(t),n);if(!e)continue;i.push({item:t,score:e.score,indices:e.indices})}return i.sort((t,e)=>e.score-t.score),i.slice(0,c)}
|
|
2
|
+
export{pn,_o};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t}from"./chunk-
|
|
1
|
+
import{t}from"./chunk-cbp0q0yt.js";import{codexTurnError as R}from"@nyssance/codex-acp-v2/client";import{AlertCircleIcon as C}from"lucide-react";import{useEffect as k,useRef as i,useState as s}from"react";import{Button as I}from"@nyssance/shadcn/vega/components/ui/button";import{jsx as n,jsxs as m}from"react/jsx-runtime";function Pn({children:u}){return m("div",{className:"codex-error-message",role:"alert",children:[n(C,{"aria-hidden":"true"}),n("div",{className:"min-w-0 flex-1",children:u})]})}function Tn({error:u,retry:e}){let{t:f,turnErrorAction:T}=t(),c=R(u),[l]=s(()=>e?.delaySeconds==null?null:Date.now()+e.delaySeconds*1000),[p,v]=s(e?.delaySeconds??null),[h,y]=s(!1),[x,g]=s(null),o=i(!1),w=i(!1),E=i(e?.run);E.current=e?.run;let S=i((N)=>{let a=E.current;if(o.current||a===void 0)return;o.current=!0,y(!0),g(null),a(N).catch((r)=>{w.current=!0,o.current=!1,v(null),y(!1),g(r instanceof Error?r.message:String(r))})}),b=T?.(c),d=b===void 0&&e!==void 0&&c.retryable;return k(()=>{if(!d||l===null)return;let a=setInterval(()=>{if(w.current||o.current)return;let r=Math.max(0,Math.ceil((l-Date.now())/1000));if(v(r),r===0)S.current("automatic")},1000);return()=>clearInterval(a)},[l,d]),m(Pn,{children:[m("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[n("div",{className:"min-w-0 flex-1 whitespace-pre-wrap",children:c.message}),b,d&&n(I,{variant:"outline",size:"sm",disabled:h,onClick:()=>S.current("manual"),children:p===null?f("timeline.retry"):f("timeline.retryCountdown",{seconds:p})})]}),x!==null&&n("div",{className:"text-muted-foreground mt-2 text-sm",children:x})]})}
|
|
2
2
|
export{Pn,Tn};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r,a,n}from"./chunk-
|
|
1
|
+
import{r,a,n}from"./chunk-6f7e67x1.js";import{Ae,ne,Z}from"./chunk-vnwb90j9.js";import{sessionGroup as j}from"@nyssance/codex-acp-v2/client";import{cn as de}from"cn";import{ArchiveIcon as ue,FolderIcon as Q,ListFilterIcon as me,SearchIcon as pe,Trash2Icon as U}from"lucide-react";import{useEffect as he,useRef as fe,useState as d}from"react";import{Alert as P,AlertDescription as T}from"@nyssance/shadcn/vega/components/ui/alert";import{Button as g}from"@nyssance/shadcn/vega/components/ui/button";import{Dialog as ve,DialogContent as ge,DialogDescription as xe,DialogFooter as Se,DialogHeader as ye,DialogTitle as Le}from"@nyssance/shadcn/vega/components/ui/dialog";import{Input as Ne}from"@nyssance/shadcn/vega/components/ui/input";import{Select as _,SelectContent as Ce,SelectItem as x,SelectTrigger as R,SelectValue as W}from"@nyssance/shadcn/vega/components/ui/select";import{Spinner as J}from"@nyssance/shadcn/vega/components/ui/spinner";import{jsx as t,jsxs as i}from"react/jsx-runtime";function M({className:u,...s}){return t(Ce,{align:"start",alignItemWithTrigger:!1,sideOffset:6,...s,className:de("max-w-(--available-width) min-w-0 p-1",u)})}function E(u){return u instanceof Error?u.message:String(u)}function we({children:u}){return t("div",{className:"min-h-0 flex-1 overflow-y-auto",children:t("div",{className:"flex flex-col gap-8",children:u})})}function br({Scroll:u=we}){let{t:s,i18n:A}=r(),m=a(),S=n((e)=>e.archivedSessions),N=n((e)=>e.connection),[B,X]=d(""),[y,Y]=d("all"),[p,ee]=d("all"),[te,se]=d(0),[q,z]=d(!0),[I,F]=d(null),[V,H]=d(null),[C,w]=d(!1),h=fe(!1),[D,f]=d(null),[O,b]=d(null),[ie,G]=d(!1);he(()=>{if(N!=="ready")return;let e=!1;z(!0),F(null);async function c(){try{await m.listArchived({reset:!0});let l=new Set;while(!e&&m.state.archivedCursor!==null){let v=m.state.archivedCursor;if(l.has(v))throw Error("Archive pagination returned a repeated cursor");l.add(v),await m.listArchived()}}catch(l){if(!e)F(E(l))}finally{if(!e)z(!1)}}return c(),()=>{e=!0}},[m,N,te]);let o=n((e)=>e.projectContext),k=!(o!==null&&N==="ready"&&!q&&I===null)||C,L=(e)=>e.title??s("sessionList.untitled"),ae=[...new Set(S.filter((e)=>o&&j(o,e).id!==Z).map((e)=>o?j(o,e).id:e.cwd))].toSorted(),re=B.trim().toLocaleLowerCase(A.language),K=S.filter((e)=>{let c=o?j(o,e).id:null,l=c===Z;return L(e).toLocaleLowerCase(A.language).includes(re)&&(y==="all"||(y==="quick"?l:!l))&&(p==="all"||(p==="quick"?l:c===p))}),le=new Intl.DateTimeFormat(A.language,{dateStyle:"medium",timeStyle:"short"});async function oe(e){if(h.current)return;h.current=!0,w(!0),H(null);try{await m.unarchive(e.sessionId)}catch(c){H(E(c))}finally{h.current=!1,w(!1)}}async function ce(){if(h.current||!D)return;h.current=!0,w(!0),b(null);let e=[],c=[];try{for(let l of D){if(!m.state.archivedSessions.some((v)=>v.sessionId===l.sessionId))continue;try{await m.delete(l.sessionId)}catch(v){e.push(l),c.push(`${L(l)}: ${E(v)}`)}}if(e.length)f(e),b(c.join(`
|
|
2
2
|
`));else f(null)}finally{h.current=!1,w(!1)}}return i("section",{className:"flex min-h-0 flex-1 flex-col overflow-hidden","aria-label":s("sessionList.archives.title"),children:[i("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:[i("header",{className:"flex min-h-9 shrink-0 flex-wrap items-center justify-between gap-3",children:[t("h1",{className:"text-2xl leading-9 font-semibold tracking-tight",children:s("sessionList.archives.title")}),i(g,{size:"sm",variant:"destructive",className:"h-[30px] text-sm font-normal",disabled:k||S.length===0,onClick:()=>{b(null),G(!0),f([...S])},children:[t(U,{className:"size-4","aria-hidden":"true"}),s("sessionList.archives.deleteAll")]})]}),i("div",{className:"flex shrink-0 flex-wrap gap-3",children:[i("div",{className:"relative min-w-48 flex-1",children:[t(pe,{"aria-hidden":"true",className:"text-muted-foreground pointer-events-none absolute start-3 top-2.5 size-4"}),t(Ne,{"aria-label":s("sessionList.archives.search"),placeholder:s("sessionList.archives.search"),value:B,onChange:(e)=>X(e.target.value),className:"rounded-md ps-9"})]}),i(_,{value:y,onValueChange:(e)=>{if(e===null)throw Error("Archive chat type cannot be empty");Y(e)},children:[i(R,{"aria-label":s("sessionList.archives.chatType"),className:"w-40 rounded-md",children:[t(me,{"aria-hidden":"true"}),t(W,{children:s(`sessionList.archives.${y==="all"?"allChats":y==="quick"?"quickChats":"projectChats"}`)})]}),i(M,{children:[t(x,{value:"all",children:s("sessionList.archives.allChats")}),t(x,{value:"quick",children:s("sessionList.archives.quickChats")}),t(x,{value:"project",children:s("sessionList.archives.projectChats")})]})]}),i(_,{value:p,onValueChange:(e)=>{if(e===null)throw Error("Archive project filter cannot be empty");ee(e)},children:[i(R,{"aria-label":s("sessionList.archives.project"),className:"w-48 rounded-md",children:[t(Q,{"aria-hidden":"true"}),t(W,{className:"truncate",children:p==="all"?s("sessionList.archives.allProjects"):p==="quick"?s("sessionList.archives.noProject"):ne(p,o??void 0)})]}),i(M,{children:[t(x,{value:"all",children:s("sessionList.archives.allProjects")}),t(x,{value:"quick",children:s("sessionList.archives.noProject")}),ae.map((e)=>t(x,{value:e,title:e,children:ne(e,o??void 0)},e))]})]})]}),i(u,{children:[N!=="ready"?t("p",{role:"status",className:"text-muted-foreground",children:s("sessionList.archives.connecting")}):q?i("div",{role:"status",className:"text-muted-foreground flex items-center gap-2",children:[t(J,{}),s("sessionList.archives.loading")]}):I?t(P,{variant:"destructive",children:i(T,{className:"flex items-center justify-between gap-4",children:[t("span",{children:I}),t(g,{variant:"outline",onClick:()=>se((e)=>e+1),children:s("sessionList.archives.retry")})]})}):S.length===0?i("div",{className:"text-muted-foreground flex flex-col items-center gap-3 py-16",children:[t(ue,{"aria-hidden":"true",className:"size-8"}),t("p",{children:s("sessionList.archives.empty")})]}):K.length===0?t("p",{className:"text-muted-foreground py-12 text-center",children:s("sessionList.archives.noResults")}):(o?Ae(K,o):[]).filter(([,e])=>e.length>0).map(([e,c])=>i("section",{className:"flex flex-col gap-3",children:[i("div",{className:"flex items-center justify-between gap-3",children:[i("h2",{className:"flex min-w-0 items-center gap-2 text-sm font-medium",title:e===Z?void 0:e,children:[t(Q,{"aria-hidden":"true",className:"size-4 shrink-0"}),t("span",{className:"truncate",children:e===Z?s("sessionList.archives.noProject"):ne(e,o??void 0)})]}),t("span",{className:"text-muted-foreground shrink-0 text-sm",children:s("sessionList.archives.count",{count:c.length})})]}),t("div",{className:"divide-border divide-y overflow-hidden rounded-lg border",children:c.map((l)=>i("article",{"aria-label":L(l),className:"flex flex-wrap items-center gap-4 px-4 py-3",children:[i("div",{className:"min-w-0 flex-1 basis-40",children:[t("h3",{className:"truncate text-sm font-medium",title:L(l),children:L(l)}),l.updatedAt!==null&&t("time",{dateTime:l.updatedAt,title:s("sessionList.archives.updatedAt"),className:"text-muted-foreground text-xs",children:le.format(new Date(l.updatedAt))})]}),i("div",{className:"flex shrink-0 items-center gap-2",children:[t(g,{variant:"ghost",size:"icon-sm","aria-label":s("sessionList.delete"),title:s("sessionList.delete"),disabled:k,className:"text-muted-foreground hover:text-destructive",onClick:()=>{b(null),G(!1),f([l])},children:t(U,{"aria-hidden":"true"})}),t(g,{variant:"secondary",size:"sm",disabled:k,onClick:()=>void oe(l),children:s("sessionList.archives.unarchive")})]})]},l.sessionId))})]},e)),V&&t(P,{variant:"destructive",children:t(T,{children:V})})]})]}),t(ve,{open:D!==null,onOpenChange:(e)=>{if(!e&&!h.current)f(null)},children:i(ge,{showCloseButton:!C,children:[i(ye,{children:[t(Le,{children:s("sessionList.archives.deleteTitle")}),t(xe,{children:s(ie?"sessionList.archives.deleteAllDescription":"sessionList.archives.deleteDescription",{count:D?.length??0})})]}),O&&t(P,{variant:"destructive",children:t(T,{className:"max-h-40 overflow-auto whitespace-pre-wrap",children:O})}),i(Se,{children:[t(g,{variant:"outline",disabled:C,onClick:()=>f(null),children:s("sessionList.cancel")}),i(g,{variant:"destructive",className:"text-sm font-normal",disabled:k,onClick:()=>void ce(),children:[C&&t(J,{}),s("sessionList.archives.confirmDelete")]})]})]})})]})}
|
|
3
|
-
export{
|
|
3
|
+
export{br};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{Mn,
|
|
1
|
+
import{ki}from"./chunk-ncs6yc8v.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 Mn({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(ki,{src:c,alt:"",onClose:()=>a(!1)})]})}function wi({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(Mn,{text:o,label:x("actions.copy"),host:u}),l&&e("span",{className:"codex-user-time",title:l.full,children:l.short})]})]})})}
|
|
2
|
+
export{Mn,wi};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r}from"./chunk-
|
|
1
|
+
import{r}from"./chunk-6f7e67x1.js";import{Et}from"./chunk-7x150rqz.js";import{I}from"./chunk-qcj6f1rq.js";import{Rt,ve}from"./chunk-mma530jr.js";import{formatDistanceToNowStrict as H}from"date-fns";import{enUS as L,zhCN as z}from"date-fns/locale";import{ClockIcon as E,MessageSquareIcon as A}from"lucide-react";import{useEffect as g,useState as D}from"react";import{Input as w}from"@nyssance/shadcn/vega/components/ui/input";import{Separator as M}from"@nyssance/shadcn/vega/components/ui/separator";import{jsx as o,jsxs as h,Fragment as O}from"react/jsx-runtime";var S={en:L,"zh-CN":z};function $e(t,a){let i=a==="zh-CN"?S["zh-CN"]:S.en;return H(new Date(t),{locale:i})}function pe({sessionRow:t,actions:a,shortcut:i,renaming:n=!1,onRename:m}){let{t:s,i18n:C,PathAction:u}=r(),f=ve(),y=Rt();g(()=>{f(n)},[n,f]);let[x,p]=D(t.title??"");g(()=>{if(n)p(t.title??"")},[n,t.title]);let d=(e)=>{let c=e.trim();m?.(c!==""&&c!==t.title?c:null)},N=t.archived?s("sessionList.archived"):t.updatedAt!==null?$e(t.updatedAt,C.language):null,v=[];if(N!==null)v.push({icon:o(E,{className:"size-3.5"}),text:N});let l=u&&o(u,{cwd:t.cwd,onOpened:y});return o(Et,{title:n?o(w,{autoFocus:!0,value:x,className:"h-7 text-sm","aria-label":s("sessionList.rename"),onChange:(e)=>p(e.target.value),onKeyDown:(e)=>{if(e.stopPropagation(),e.key==="Enter")d(e.target.value);if(e.key==="Escape")m?.(null)},onBlur:(e)=>d(e.target.value)}):h("span",{className:"flex items-center gap-2",children:[o("span",{className:"min-w-0",children:o(I,{className:"min-w-0 flex-1",children:t.title??s("sessionList.untitled")})}),i]}),titleIcon:o(A,{className:"size-3.5"}),details:v,actions:l||a!==void 0?h(O,{children:[l,l&&a!==void 0&&o(M,{}),a]}):void 0})}
|
|
2
2
|
export{$e,pe};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{be}from"./chunk-
|
|
1
|
+
import{be}from"./chunk-pmzkz6hg.js";import{Vo,N}from"./chunk-k7d2y0wx.js";import{Ro,Fo,Do,Ho,Oo,R}from"./chunk-xrsa8v3g.js";import{t,o}from"./chunk-cbp0q0yt.js";import{e}from"./chunk-zx63zvpy.js";import{Ko}from"./chunk-yathdy79.js";import{No}from"./chunk-2fh11ysa.js";import{bo}from"./chunk-ttk7b5mr.js";import{yo,xo}from"./chunk-xnszvze2.js";import{un}from"./chunk-ts8edszy.js";import{vn}from"./chunk-m58ryg53.js";import{s,jo,z,qt}from"./chunk-2kskj0w5.js";import{zt}from"./chunk-ewjh6s2b.js";import{Re,$t}from"./chunk-w89hdkar.js";import{Wt,Qt}from"./chunk-9rt2pfsm.js";import{qo}from"./chunk-118vx38k.js";import{jt}from"./chunk-8xtp7pxb.js";import{To}from"./chunk-as79cv4d.js";import{Yt}from"./chunk-jt54wp2c.js";import{Vt}from"./chunk-fw2jj4hh.js";import{Io}from"./chunk-3azwj6wd.js";import{Lo}from"./chunk-wteebw32.js";import{Eo}from"./chunk-5c1wx64d.js";import{Gt}from"./chunk-zyjcpz4s.js";import{hasFuzzyFileSearch as Nt}from"@nyssance/codex-acp-v2/client";import{PlusIcon as St}from"lucide-react";import{useCallback as O,useEffect as kt,useLayoutEffect as Z,useMemo as tt,useRef as V,useState as F}from"react";import{jsx as i,jsxs as v,Fragment as Bt}from"react/jsx-runtime";var Ot=["image/png","image/jpeg","image/webp","image/gif"],et=[];async function Ft(r){let h=await(await fetch(r.url)).blob();return new Promise((l,C)=>{let T=new FileReader;T.onerror=()=>C(T.error),T.onload=()=>{let U=T.result;l(U.slice(U.indexOf(",")+1))},T.readAsDataURL(h)})}function Dt(r){let{t:h}=t(),l=N();return i(R,{"aria-label":h("composer.attachImage"),title:h("composer.attachImage"),onClick:()=>l.openFileDialog(),...r,children:i(St,{className:"size-4"})})}function Ut({session:r,onSubmit:h,onShellCommand:l,onHandOff:C,modelSelector:T,modelMenu:U,inputHeader:rt,actions:ft,leadingTools:ht,agentControls:X=!0,placeholder:gt,children:xt,attachmentPolicy:yt,predictions:Pt=!0,disabled:bt=!1,preparing:ot=!1,allowPendingInput:vt=!1}){let{host:D,client:E}=e(),{t:p}=D,B=O((n)=>{if(D.reportError)D.reportError(n);else console.error(n)},[D]),[nt,_]=F(()=>({text:s.get(r.id)?.text??"",revision:0})),{text:d}=nt,[A,wt]=F(()=>s.get(r.id)?.attachments??et),[g,H]=F(()=>s.get(r.id)?.mentions??[]),q=A.some((n)=>Re(n)&&n.pastedText.status!=="ready"),[M,at]=F(!1),[K,It]=F(!1),[J,it]=F(!1),u=V(null),ct=V(null),a=V(nt),S=O((n)=>{ct.current?.(),a.current={text:n,revision:a.current.revision+1},_(a.current)},[]),Tt=Io(r,S),st=tt(()=>({read:()=>{let c=u.current?.getTextarea(),x=c===null||c===void 0?[a.current.text.length,a.current.text.length]:[c.selectionStart,c.selectionEnd];return{target:r.id,...a.current,selection:x}},compareAndSet(c,x,w){if(c.target!==r.id||c.revision!==a.current.revision)return null;a.current={text:x,revision:a.current.revision+1},_(a.current);let y=u.current?.getTextarea();if(y!==null&&y!==void 0)y.value=x,y.setSelectionRange(w[0],w[1]);return{target:r.id,...a.current,selection:w}}}),[r.id]),L=V(null),mt=O((n)=>(L.current=n,()=>{if(L.current===n)L.current=null}),[]),W=r.state!=="idle",P=l!==void 0&&d.startsWith("!"),f=!bt&&!ot&&r.attached&&!r.restoring&&!r.readOnly,k=!r.readOnly&&(vt||f),j=Vt(r,f&&!M&&!K&&!q&&!J,d.length>0||A.length>0||g.length>0,Pt&&!P),pt=j.invalidate;Z(()=>{s.set(r.id,{text:d,attachments:A,mentions:g,modelId:s.get(r.id)?.modelId??null})},[r.id,d,A,g]),Z(()=>jo(r.id,wt),[r.id]),Z(()=>qt(r.id,(n)=>{if(!k||M)throw Error("The composer cannot take text now; try again later");if(d.length||A.length||g.length)throw Error("The composer already has a draft; send or clear it first");S(n)}),[r.id,k,M,d,A,g,S]);let lt=o((n)=>Nt(n.agent)),At=tt(()=>lt&&f?async(n)=>zt((await E.fuzzyFileSearch({query:n,roots:[r.cwd],cancellationToken:null})).files):void 0,[E,lt,f,r.cwd]),Q=O((n)=>{H((c)=>c.includes(n)?c:[...c,n])},[]);kt(()=>{u.current?.focus()},[]);let dt=O(async({text:n,files:c})=>{let x=l!==void 0&&n.startsWith("!")?n.slice(1):null;if(x!==null){if(x.trim().length===0)return;if(c.length||g.length)throw Error("Shell commands cannot include file references or attachments");if(r.state!=="idle")throw Error("Wait for the current turn before running a shell command")}let w=n.trim();if(w.length===0&&c.length===0&&g.length===0)return;let y=L.current;at(!0);let I=s.get(r.id),Rt=a.current.revision,G=null;try{let b=Ko(w);for(let m of g){let Y={kind:"file",absPath:m};b.push({type:"resource_link",uri:Wt(Y),name:Qt(Y)})}if(w.length>0)b.push({type:"text",text:w});for(let m of c)if(Re(m)){if(m.pastedText.status!=="ready")throw Error("Text attachment is not ready");b.push({type:"resource_link",uri:m.url,name:m.filename??"pasted-text.txt"})}else b.push({type:"image",data:await Ft(m),mimeType:m.mediaType});if(a.current.revision===Rt&&s.get(r.id)===I)a.current={text:"",revision:a.current.revision+1},G=a.current.revision,_(a.current),H([]),z(r.id,()=>et),s.set(r.id,{text:"",attachments:et,mentions:[],modelId:I?.modelId??null}),u.current?.resetHeight();if(x!==null&&l)await l(x);else if(h)if(y===null)await h(b);else await h(b,(m)=>{if(y.signal.aborted||L.current!==y)return;y.accept(m),C?.(r.id,m)});else if(y===null)await E.prompt(r.id,b);else{let m=await E.prompt(r.id,b);y.accept(m)}pt();for(let m of I?.attachments??[])if(m.url.startsWith("blob:")&&!s.get(r.id)?.attachments.some((Y)=>Y.id===m.id))URL.revokeObjectURL(m.url)}catch(b){if(I&&G!==null&&a.current.revision===G&&s.get(r.id)?.attachments.length===0&&s.get(r.id)?.mentions.length===0)a.current={text:I.text,revision:G+1},_(a.current),H(I.mentions),s.set(r.id,I),z(r.id,()=>I.attachments);throw b}finally{at(!1),u.current?.focus()}},[E,r.id,r.state,g,h,l,C,pt]),Mt=()=>{E.cancel(r.id).catch(B)},Ct=O((n)=>{let c=n.code==="max_total_size"?Object.assign(Error(p("composer.imageTooLargeTitle")),{description:p("composer.imageTooLargeDescription",{mb:be})}):Object.assign(Error(p("composer.unsupportedAttachmentTitle")),{description:p("composer.unsupportedAttachmentDescription")});B(c)},[B,p]),Et=tt(()=>({session:r,ready:f,inputReady:k,sending:M,textareaRef:u,draft:st,interruptRef:ct,observeReceipts:mt,addMention:Q,setAdding:It,shellMode:P,handsFree:!P&&(h===void 0||C!==void 0)}),[r,f,k,M,st,mt,Q,h,C,P]),ut=D.writeTextAttachment;return i(vn,{value:Et,children:i("div",{"data-chat-drop-zone":!0,className:"mx-auto w-full max-w-3xl px-6 pb-5",children:v("div",{className:"relative",children:[rt&&i("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:rt}),v(Vo,{attachmentPolicy:yt,value:d,revision:a.current.revision,onValueChange:S,onSubmittedClear:()=>{a.current={text:"",revision:a.current.revision+1},_(a.current)},attachments:A,onAttachmentsChange:(n)=>z(r.id,()=>n),children:[X&&i(bo,{bashMode:l!==void 0,handleRef:u,commands:r.commands,searchFiles:At,onMention:Q,onSearchError:B,forcedOpen:J,onForcedOpenChange:it,emptyLabel:p("composer.noCommands"),fileStatusLabels:{loading:p("composer.searchingFiles"),empty:p("composer.noMatchingFiles")}}),v(Ro,{"data-shell-mode":P||void 0,bashMode:l!==void 0,globalDrop:!0,multiple:!0,accept:Ot.join(","),onError:Ct,onSubmit:dt,onSubmitAsync:dt,onSubmitError:B,canSubmit:()=>f&&!M&&!K&&!q&&(!P||!W&&d.slice(1).trim().length>0)?!0:"chat_not_ready",className:"relative z-10",children:[xt,v(Do,{className:"px-3 pt-3 pb-0 empty:hidden",children:[K&&i("span",{role:"status",className:"text-muted-foreground text-xs",children:p("composer.addingFiles")}),i(qo,{mentions:g,onRemove:(n)=>H((c)=>c.filter((x)=>x!==n))}),i(xo,{children:(n)=>Re(n)?i(To,{data:n,sessionId:r.id}):i(yo,{data:n,t:p})})]}),v(Fo,{className:"mb-0 min-h-16 px-3 pt-4 pb-2",onKeyDownCapture:(n)=>{if(!j.text||u.current?.isComposing()||n.nativeEvent.isComposing||n.nativeEvent.keyCode===229||n.shiftKey||n.ctrlKey||n.altKey||n.metaKey||n.target!==u.current?.getTextarea())return;if(n.key==="Tab")n.preventDefault(),n.stopPropagation(),S(j.text)},children:[P&&i("span",{"data-shell-prefix":!0,"aria-hidden":"true",className:"text-destructive self-start pt-0.5 text-sm",children:"❗"}),i(un,{className:"min-h-10 bg-transparent text-sm font-normal",ref:u,rows:2,onKeyDown:Tt,bashMode:l!==void 0,disabled:!k,onPasteCapture:ut?(n)=>$t(n,r.id,p("composer.pastedTextFilename"),ut):void 0,placeholder:P?"! command":j.text||gt||(W?p("composer.steerPlaceholder"):p("composer.placeholder")),"aria-label":p("composer.placeholder")})]}),i(Ho,{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:[i(Dt,{className:"text-foreground",disabled:!k}),ht,X&&v(Bt,{children:[i(Lo,{textareaRef:u,menuOpen:J,onOpenChange:it,disabled:!f||r.commands.length===0}),i(No,{disabled:!f||P,onSelect:(n)=>{S(`${d}${d&&!/\s$/.test(d)?" ":""}${n} `),u.current?.getTextarea()?.focus()}}),i(Yt,{sessionId:r.id,options:r.configOptions,disabled:!f})]})]}),v(Oo,{className:"w-full min-w-0 items-center justify-end gap-1",children:[X&&i(Gt,{session:r}),T??i(jt,{...U,sessionId:r.id,options:r.configOptions,disabled:!f}),ft,i(Eo,{active:W,sending:M||ot||K,ready:f&&!q&&(!P||!W&&d.slice(1).trim().length>0),hasMentions:g.length>0,onStop:Mt})]})]})})]})]})]})})})}
|
|
2
2
|
export{Ut};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c}from"./chunk-k7y6dqf2.js";import{a,n}from"./chunk-
|
|
2
|
-
export{
|
|
1
|
+
import{c}from"./chunk-k7y6dqf2.js";import{a,n}from"./chunk-6f7e67x1.js";import{k,m,u,Q}from"./chunk-mma530jr.js";import{w,te,ro}from"./chunk-0knwqeea.js";import{je}from"./chunk-9098ssbp.js";import{A,W}from"./chunk-yqnjd8mp.js";import{ue,ee}from"./chunk-7mfkaftt.js";import{closestCorners as fe,DndContext as Ce,KeyboardSensor as ye,PointerSensor as Se,useSensor as X,useSensors as De}from"@dnd-kit/core";import{SortableContext as Y,sortableKeyboardCoordinates as we,useSortable as ae,verticalListSortingStrategy as Z}from"@dnd-kit/sortable";import{CSS as ce}from"@dnd-kit/utilities";import{cn as G}from"cn";import{BrushCleaningIcon as ve,MessageSquareIcon as Ne,MoreHorizontalIcon as Ie,PencilIcon as he,PlusIcon as de,StarIcon as be,Trash2Icon as me}from"lucide-react";import{useEffect as xe,useMemo as Me,useState as R}from"react";import{Button as v}from"@nyssance/shadcn/vega/components/ui/button";import{Dialog as oe,DialogContent as ne,DialogDescription as ie,DialogFooter as le,DialogHeader as re,DialogTitle as se}from"@nyssance/shadcn/vega/components/ui/dialog";import{DropdownMenu as Ee,DropdownMenuContent as ke,DropdownMenuGroup as Le,DropdownMenuItem as H,DropdownMenuTrigger as Re}from"@nyssance/shadcn/vega/components/ui/dropdown-menu";import{Input as Pe}from"@nyssance/shadcn/vega/components/ui/input";import{jsx as e,jsxs as s,Fragment as ze}from"react/jsx-runtime";function Te({collectionId:l,sessionId:y,children:x}){let{attributes:N,listeners:I,setNodeRef:i,transform:g,transition:f,isDragging:M}=ae({id:JSON.stringify([l,y]),data:{type:"session",collectionId:l,sessionId:y}});return e("div",{ref:i,style:{transform:ce.Transform.toString(g),transition:f},className:G("w-full min-w-0",M&&"opacity-50"),...N,...I,role:"group",children:x})}function Be({collection:l,children:y,onEdit:x,onConfirm:N,onNewChat:I}){let{t:i}=w(),g=ee(),f=te(),{attributes:M,listeners:p,setNodeRef:h,transform:P,transition:T,isDragging:z}=ae({id:l.id,disabled:{draggable:l.id===A,droppable:!1},data:{type:"collection"}});return e("div",{ref:h,style:{transform:ce.Transform.toString(P),transition:T},className:G("w-full min-w-0",z&&"opacity-50"),children:e(Q,{open:!l.collapsed,onOpenChange:(d)=>f(g({type:"collapse",id:l.id,collapsed:!d})),label:W(l,i),count:l.sessionIds.length,leading:l.id===A?e(be,{className:"size-3.5"}):e(je,{emoji:l.emoji,onChange:(d)=>f(g({type:"emoji",id:l.id,emoji:d}))}),wrapHeader:(d)=>e("div",{...M,...p,role:"group",children:d}),actions:s(Ee,{children:[e(Re,{onClick:(d)=>d.stopPropagation(),onPointerDown:(d)=>d.stopPropagation(),render:e(v,{variant:"ghost",size:"icon",className:"size-5","aria-label":i("collection.more",{name:W(l,i)}),children:e(Ie,{className:"size-3.5"})})}),e(ke,{children:s(Le,{children:[l.id!==A&&s(H,{onClick:x,children:[e(he,{}),i("collection.rename")]}),s(H,{onClick:I,children:[e(de,{}),i("collection.newChat")]}),s(H,{onClick:()=>N("clear"),children:[e(ve,{}),i("collection.clearCollection")]}),l.id!==A&&s(H,{variant:"destructive",onClick:()=>N("delete"),children:[e(me,{}),i("collection.deleteCollection")]})]})})]}),children:y})})}function He({children:l}){return e("div",{className:"min-h-0 flex-1 overflow-y-auto ps-2 pe-0 pb-1",children:l})}function ur({renderRow:l,onSelect:y,onNewChat:x,Scroll:N=He}){let I=w(),{t:i}=I,g=ee(),f=te(),M=a(),{collections:p,order:h}=ue(),P=n((o)=>o.sessionList),T=n((o)=>o.archivedSessions),z=n((o)=>o.sessionListLoaded),d=n((o)=>o.sessionListError),F=Me(()=>new Map([...T,...P].map((o)=>[o.sessionId,o])),[T,P]),U=I.isMac??ro(),[S,E]=R(null),[L,K]=R(""),[_,O]=R(""),[D,B]=R(null),[C,q]=R(!1),pe=De(X(Se,{activationConstraint:{distance:5}}),X(ye,{coordinateGetter:we})),j=h.flatMap((o)=>p[o].collapsed?[]:p[o].sessionIds.flatMap((t)=>{let r=F.get(t);return r&&!r.archived?[r]:[]}));xe(()=>{let o=(t)=>{if(t.defaultPrevented||t.isComposing||t.repeat||t.shiftKey||t.altKey)return;if(U?!t.metaKey||t.ctrlKey:!t.ctrlKey||t.metaKey)return;if(document.querySelector('[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"]'))return;if(t.target instanceof HTMLElement&&(t.target.isContentEditable||t.target.closest("input,textarea,[role=dialog],[role=menu]")))return;let r=Number(t.key)-1;if(!Number.isInteger(r)||r<0||r>8||!j[r])return;t.preventDefault(),y(j[r])};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[j,U,y]);let ge=({active:o,over:t})=>{if(t===null)return;let r=o.data.current,b=t.data.current;if(r?.type==="session"&&b!==void 0){let V=b.type==="session"?String(b.collectionId):String(t.id);f(g({type:"move",sourceCollectionId:String(r.collectionId),collectionId:V,sessionId:String(r.sessionId),index:b.type==="session"?p[V].sessionIds.indexOf(String(b.sessionId)):void 0}))}else if(r?.type==="collection"&&b?.type==="collection"&&String(t.id)!==A)f(g({type:"reorder",id:String(o.id),index:h.indexOf(String(t.id))}))},J=(o,t)=>{q(!0),f(o.then(t).finally(()=>q(!1)))};return s(ze,{children:[e(N,{children:s(k,{children:[s(u,{className:G(c,"font-normal"),onClick:()=>{E("new"),K(""),O("")},children:[e(m,{children:e(de,{})}),e("span",{children:i("collection.newCollection")})]}),d&&s("div",{className:"text-muted-foreground px-2 text-sm",children:[e("p",{role:"alert",children:d}),e(v,{variant:"ghost",onClick:()=>f(M.listSessions({reset:!0})),children:i("collection.retry")})]}),e(Ce,{sensors:pe,collisionDetection:fe,onDragEnd:ge,children:e(Y,{items:h,strategy:Z,children:e(k,{children:h.map((o)=>e(Be,{collection:p[o],onNewChat:()=>x(o),onEdit:()=>{E(o),K(p[o].name),O(p[o].emoji??"")},onConfirm:(t)=>B({id:o,type:t}),children:e(Y,{items:p[o].sessionIds.map((t)=>JSON.stringify([o,t])),strategy:Z,children:p[o].sessionIds.map((t)=>{let r=F.get(t);if(r?.archived)return null;if(!r)return z?s("div",{className:"text-muted-foreground flex h-[var(--navigation-row-height)] w-full items-center gap-1 rounded-[10px] ps-1 pe-1.5 text-sm font-normal",children:[e(m,{children:e(Ne,{className:"size-3.5"})}),e("span",{className:"min-w-0 flex-1 truncate",children:i("collection.unavailable")}),e(v,{variant:"ghost",size:"icon",className:"size-5 [&_svg]:size-3.5","aria-label":i("collection.removeFromGroup"),onClick:()=>f(g({type:"remove",sessionId:t,collectionId:o})),children:e(me,{})})]},t):null;return e(Te,{collectionId:o,sessionId:t,children:l(r,()=>{},o)},t)})})},o))})})})]})}),e(oe,{open:S!==null,onOpenChange:(o)=>{if(!o&&!C)E(null)},children:s(ne,{children:[s(re,{children:[e(se,{children:i(S==="new"?"collection.newCollection":"collection.rename")}),e(ie,{children:i("collection.collectionName")})]}),s("form",{onSubmit:(o)=>{if(o.preventDefault(),S===null||!L.trim()||C)return;let t=S==="new"?`collection-${crypto.randomUUID()}`:S;J(g([S==="new"?{type:"create",id:t,name:L}:{type:"rename",id:t,name:L},{type:"emoji",id:t,emoji:_}]),()=>E(null))},className:"flex flex-col gap-3",children:[e(Pe,{autoFocus:!0,"aria-label":i("collection.collectionName"),value:L,onChange:(o)=>K(o.target.value),disabled:C}),S!=="new"&&e(je,{emoji:_,onChange:O}),s(le,{children:[e(v,{type:"button",variant:"outline",disabled:C,onClick:()=>E(null),children:i("collection.cancel")}),e(v,{type:"submit",disabled:C||!L.trim(),children:i("collection.confirm")})]})]})]})}),e(oe,{open:D!==null,onOpenChange:(o)=>{if(!o&&!C)B(null)},children:s(ne,{children:[s(re,{children:[e(se,{children:i(D?.type==="delete"?"collection.deleteCollection":"collection.clearCollection")}),e(ie,{children:i("collection.confirmCollectionChange",{name:D===null?"":W(p[D.id],i)})})]}),s(le,{children:[e(v,{variant:"outline",disabled:C,onClick:()=>B(null),children:i("collection.cancel")}),e(v,{disabled:C,onClick:()=>{if(D!==null)J(g({type:D.type,id:D.id}),()=>B(null))},children:i("collection.confirm")})]})]})})]})}
|
|
2
|
+
export{ur};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r,a,n,p}from"./chunk-
|
|
2
|
-
export{
|
|
1
|
+
import{r,a,n,p}from"./chunk-6f7e67x1.js";import{L}from"./chunk-8n1rq3xt.js";import{k,Q,ye}from"./chunk-mma530jr.js";import{he,G,oe}from"./chunk-5q93tpax.js";import{po}from"./chunk-ak2frpw9.js";import{me}from"./chunk-h4r8cx37.js";import{pe}from"./chunk-pnm040ke.js";import{ge}from"./chunk-85nkcdqg.js";import{Lt}from"./chunk-f17jdv7p.js";import{co}from"./chunk-rnb0q6bt.js";import{ActivityIcon as E}from"lucide-react";import{useEffect as K,useMemo as P}from"react";import{Kbd as M}from"@nyssance/shadcn/vega/components/ui/kbd";import{jsx as c,jsxs as D,Fragment as q}from"react/jsx-runtime";function H(o,d){return o.find((l)=>l.sessionId===d.sessionId)??{sessionId:d.sessionId,cwd:d.cwd,title:d.title||null,updatedAt:null,archived:!1}}function Ir({selectedId:o,onSelect:d,isForeground:l,onOpen:w,accessory:R,rowActions:h}){let N=r(),{t:x}=N,m=n((t)=>t.runStates),v=n((t)=>t.drafts),u=n((t)=>t.sessionList),g=G((t)=>t.activityOrder),f=P(()=>g.flatMap((t)=>{let e=m[t];return e&&he({runStates:m,drafts:v},t)?[{sid:t,record:e,sessionRow:H(u,e)}]:[]}),[g,m,v,u]),b=P(()=>{let t=new Map;for(let e of f){let i=e.sid===o||l?.(e.sid)?"foreground":"background",S=t.get(i)??[];S.push(e),t.set(i,S)}return["foreground","background"].filter((e)=>t.has(e)||e==="background").map((e)=>({key:e,rows:t.get(e)??[]}))},[f,o,l]),y=G((t)=>t.activityCollapsedGroups),s=oe(),I=b.flatMap((t)=>t.key==="foreground"||!y.has(t.key)?t.rows:[]),A=(t)=>{if(w?.(t))return;d(t)},O=co();K(()=>{let t=(e)=>{if(e.defaultPrevented||e.isComposing||e.repeat||!po(e))return;if(document.querySelector('[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"]'))return;let i=Number(e.key);if(!Number.isInteger(i)||i<1||i>9)return;let S=I[i-1];if(!S)return;e.preventDefault(),A(S.sessionRow)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)});let C=(t)=>{let e=I.indexOf(t);return c(T,{sessionRow:t.sessionRow,state:t.record.state,interruption:t.record.interruption,active:t.sid===o,tasks:t.record.tasks,listeningPorts:t.record.listeningPorts,onOpen:()=>A(t.sessionRow),accessory:R?.(t.sid),actions:h?.(t.sessionRow),hint:e<9&&O?c(M,{children:ge(`CommandOrControl+${e+1}`)}):void 0},t.sid)};return c(k,{children:b.map((t)=>t.key==="foreground"?c(k,{children:t.rows.map(C)},t.key):c(Q,{open:!y.has(t.key),onOpenChange:(e)=>{let i=new Set(y);if(e)i.delete(t.key);else i.add(t.key);s({activityCollapsedGroups:i})},leading:c(E,{className:"text-muted-foreground size-3.5 shrink-0"}),label:x("sessionList.background"),count:t.rows.length,children:t.rows.map(C)},t.key))})}function T({sessionRow:o,state:d,interruption:l,active:w,tasks:R,listeningPorts:h,accessory:N,actions:x,onOpen:m,hint:v}){let u=r(),g=a(),{t:f}=u,b=o.title??f("sessionList.untitled"),y=Lt(o.sessionId,d);return D(q,{children:[c(ye,{"data-session-id":o.sessionId,active:w,role:"button",tabIndex:0,hoverCard:c(pe,{sessionRow:o,actions:x}),onClick:m,onKeyDown:(s)=>{if(s.target!==s.currentTarget)return;if(s.key==="Enter"||s.key===" ")s.preventDefault(),m()},state:d,interruption:l,title:b,preview:y,listeningPorts:h,onOpenPort:u.openLink&&((s)=>u.openLink?.(`http://localhost:${s}`)),accessory:N,hint:v,actions:c(me,{title:f("sessionList.stop"),onStop:()=>p(u,g.stopSession(o.sessionId))})}),R.map((s)=>D("div",{className:"border-border/60 before:border-border/60 relative ms-4 flex min-h-7 items-center gap-2 border-s py-1 ps-4 pe-2 text-xs before:absolute before:start-0 before:top-3.5 before:w-2 before:border-t",children:[c(L,{state:"running"}),c("span",{className:"text-muted-foreground min-w-0 flex-1 truncate leading-5",title:s.title,children:s.title})]},s.id))]})}
|
|
2
|
+
export{Ir};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{terminalOf as u,textOf as p}from"@nyssance/codex-acp-v2/client";function Nn(n){if(n.kind!=="tool")return!1;let t=n._meta?.codex;return typeof t==="object"&&t!==null&&"commandSource"in t&&t.commandSource==="userShell"}function
|
|
2
|
-
export{Nn,
|
|
1
|
+
import{terminalOf as u,textOf as p}from"@nyssance/codex-acp-v2/client";function Nn(n){if(n.kind!=="tool")return!1;let t=n._meta?.codex;return typeof t==="object"&&t!==null&&"commandSource"in t&&t.commandSource==="userShell"}function vi(n,t,r){if(n.kind!=="tool"){let o=p(n.content),d=/^\s*\*\*([^\n]*?)\*\*\s*$/.exec(o);return{type:"thinking",id:n.id,thinking:d?d[1]:o,isComplete:!r}}if(n.name==="subagent"){let o=s(n.rawInput,n.id);return{type:"subagent",id:n.id,name:g(o.agentPath,n.id),threadId:f(o.agentThreadId,"agentThreadId",n.id),activity:y(o.activity,n.id),model:l(o.model,"model",n.id),reasoningEffort:l(o.reasoningEffort,"reasoningEffort",n.id),status:n.status??"pending",blocks:[]}}if(n.name==="collab"){let o=s(s(s(n._meta,n.id).codex,n.id).collaboration,n.id);if(typeof o.tool!=="string"||!Array.isArray(o.agents))throw Error(`Collaboration call ${n.id} lacks codex-acp-v2 agent metadata`);return{type:"collab",id:n.id,tool:o.tool,status:n.status??"pending",prompt:l(s(n.rawInput,n.id).prompt,"prompt",n.id),agents:o.agents}}let a=typeof n.rawInput==="object"&&n.rawInput!==null&&!Array.isArray(n.rawInput)?{...n.rawInput}:{},i=u(n,t);if(Array.isArray(a.command))a.command=a.command.map(String).join(" ");if(n.toolKind==="execute"&&n.name!=="mcp"&&n.name!=="dynamic_tool"&&typeof a.command!=="string"){let o=i?.command??n.title;if(o!==null)a.command=o}let e=n.rawOutput;if(typeof e==="object"&&e!==null&&"output"in e&&typeof e.output==="string")e=e.output;if(i!==null&&i.output.length>0)e=i.output;let c=i?.exitStatus?.exitCode;return{type:"tool_use",id:n.id,name:n.name??"",title:n.title??n.name??"",kind:n.toolKind??"other",status:n.status??"pending",content:n.content,locations:n.locations,rawInput:a,rawOutput:e,...Nn(n)?{userShell:!0}:{},...typeof c==="number"?{exitCode:c}:{}}}function s(n,t){if(typeof n!=="object"||n===null||Array.isArray(n))throw Error(`Tool call ${t} is missing an object codex-acp-v2 always sends`);return n}function l(n,t,r){if(n===null||typeof n==="string")return n;throw Error(`Tool call ${r} has a non-string ${t}`)}function g(n,t){let r=typeof n==="string"?n.split("/").findLast(Boolean):void 0;if(r===void 0)throw Error(`Subagent ${t} has no agent path`);return r}function f(n,t,r){if(typeof n==="string")return n;throw Error(`Tool call ${r} has no ${t}`)}function y(n,t){if(n==="started"||n==="interacted"||n==="interrupted"||n==="completed")return n;throw Error(`Subagent ${t} has an unknown activity ${String(n)}`)}
|
|
2
|
+
export{Nn,vi};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
2
|
-
export{
|
|
1
|
+
function bi(r,e){if(!e.running)return{kind:"idle"};if(e.blocked)return{kind:"waiting"};if(e.retrying)return{kind:"retrying"};let t=r.findLast((i)=>i.kind==="tool"&&i.active);if(t)return{kind:"tool",ownerKey:t.key};let n=r.findLast((i)=>i.kind!=="user");if(n?.active){if(n.kind==="answer")return{kind:"speaking",ownerKey:n.key};if(n.kind==="text")return{kind:"speaking",ownerKey:n.key};if(n.kind==="reasoning")return{kind:"reasoning",ownerKey:n.key};if(n.kind==="plan")return{kind:"planning",ownerKey:n.key};if(n.kind==="compaction")return{kind:"tool",ownerKey:n.key}}if(n?.kind==="answer")return{kind:"idle"};return{kind:"working",ownerKey:n?.key}}
|
|
2
|
+
export{bi};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{L}from"./chunk-
|
|
2
|
-
export{
|
|
1
|
+
import{L}from"./chunk-8n1rq3xt.js";import{Button as u}from"@nyssance/shadcn/vega/components/ui/button";import{DropdownMenu as d,DropdownMenuContent as m,DropdownMenuGroup as w,DropdownMenuItem as i,DropdownMenuLabel as S,DropdownMenuTrigger as c}from"@nyssance/shadcn/vega/components/ui/dropdown-menu";import{jsx as e,jsxs as a}from"react/jsx-runtime";var M=["requires_action","running","done","idle"];function Tr({sessions:l,onSelect:p,t:n}){return e("div",{className:"flex shrink-0 items-center gap-0.5",role:"group","aria-label":n("sessionList.states.title"),children:M.map((o)=>{let s=l.filter((t)=>t.state===o),r=n(`sessionList.states.${o}`);return a(d,{children:[a(c,{render:e(u,{variant:"ghost",size:"xs"}),"aria-label":`${r}: ${s.length}`,children:[e(L,{state:o,pulse:!1}),e("span",{className:"tabular-nums",children:s.length})]}),e(m,{"aria-label":r,className:"w-72 max-w-[calc(100vw-1rem)]",children:a(w,{children:[e(S,{children:r}),s.length===0?e(i,{disabled:!0,children:n("sessionList.states.empty")}):s.map((t)=>a(i,{onClick:()=>p(t),children:[e(L,{state:t.state,pulse:!1}),e("span",{className:"min-w-0 flex-1 truncate",children:t.title||n("sessionList.untitled")})]},t.sessionId))]})})]},o)})})}
|
|
2
|
+
export{Tr};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b}from"./chunk-57p1s7hy.js";import{o}from"./chunk-
|
|
2
|
-
export{yn,
|
|
1
|
+
import{b}from"./chunk-57p1s7hy.js";import{o}from"./chunk-cbp0q0yt.js";import{tt}from"./chunk-rkww8p94.js";import{g,K}from"./chunk-w0dfvr05.js";import{e}from"./chunk-zx63zvpy.js";import{Hn}from"./chunk-wyr7zv2j.js";import{ChevronDownIcon as G,ChevronRightIcon as F,GitBranchIcon as Y,Loader2Icon as J,SquareIcon as Z}from"lucide-react";import{useCallback as ss,useEffect as es,useId as Q,useRef as O,useState as k}from"react";import{Button as z}from"@nyssance/shadcn/vega/components/ui/button";import{jsx as t,jsxs as p,Fragment as as}from"react/jsx-runtime";function yn(s,l){let d=o((u)=>u.sessions),r=o((u)=>u.actions),[v,m]=k(()=>new Set);return(u)=>{let c=l?.(u)??null,a=Hn(s.id,u,d,r,s);if(a.length===0)return c;let h=`${s.id}:${u.key}`;return{active:c?.active===!0||a.some((i)=>i.status==="running"||i.status==="requires_action"),defaultExpanded:c?.defaultExpanded===!0||v.has(h),content:p(as,{children:[t(ei,{sessionId:s.id,turn:u,parent:s,tasks:a,onExpand:()=>m((i)=>i.has(h)?i:new Set([...i,h]))}),c?.content]})}}}function ei({sessionId:s,turn:l,parent:d,tasks:r,onExpand:v}){let{host:m}=e(),u=o((n)=>n.sessions),c=o((n)=>n.actions),a=r??Hn(s,l,u,c,d),h=a.some((n)=>n.status==="running"),i=a.some((n)=>n.status==="running"||n.status==="requires_action"),[x,w]=b(`subagents:${s}:${l.key}`,i,!0),C=Q();if(a.length===0)return null;let f=new Map;for(let n of a)f.set(n.status,(f.get(n.status)??0)+1);let N=[...f].map(([n,I])=>`${m.t(`subagents.${n}`)} ${I}`).join(" · ");return p("section",{"data-subagent-sessions":!0,"data-subagent-turn":l.key,"aria-label":m.t("subagents.group"),className:"my-2 min-w-0",children:[p(z,{variant:"ghost",size:"sm",className:"text-muted-foreground h-auto min-h-8 max-w-full justify-start gap-2 text-xs","aria-expanded":x,"aria-controls":C,onClick:()=>{if(!x)v?.();w(!x)},children:[x?t(G,{className:"size-3.5 shrink-0"}):t(F,{className:"size-3.5 shrink-0"}),h?t(J,{className:"size-3.5 shrink-0 motion-safe:animate-spin","aria-hidden":"true"}):t(Y,{className:"size-3.5 shrink-0"}),p("span",{className:"shrink-0",children:[m.t("subagents.group")," · ",a.length]}),t("span",{className:"truncate",role:"status",children:N})]}),t("div",{id:C,hidden:!x,className:"border-border ms-3 min-w-0 border-s ps-2",children:a.map((n)=>t(ts,{task:n,cwd:d?.cwd??u[s]?.cwd??"",visible:x,stateKey:`${s}:${l.key}:${n.key}`,onRead:()=>{v?.(),w(!0)}},n.key))})]})}function A(s,l){if(!l)return s;let d=new Map(s.items.map((r)=>[`${r.kind}:${r.id}`,r]));for(let r of l.items)d.set(`${r.kind}:${r.id}`,r);return{...s,...l,items:[...d.values()]}}function ts({task:s,cwd:l,stateKey:d,visible:r,onRead:v}){let{client:m,host:u}=e(),{t:c}=u,a=s.session,h=o((y)=>y.connection==="ready"),[i,x]=b(`subagent:${d}`,!1),[w,C]=k(!1),[f,N]=k(null),[n,I]=k(null),[R,U]=k(null),[B,P]=k(!1),q=O(!1),_=O(!1),j=Q(),W=a&&g(a.configOptions,"model"),T=s.title??c("subagents.untitled"),H=n?A(n,a):a,V=h&&a?.attached&&a.subagent?.capabilities?.cancel!=null&&(s.status==="running"||s.status==="requires_action"),M=s.threadId,D=a?.cwd??l,E=ss(async(y)=>{if(!m.readSubagentHistory||M===null||q.current)return;_.current=!0,q.current=!0,P(!0),N(null);try{let S=await m.readSubagentHistory(M,D,y);I((L)=>L===null?S.session:A(S.session,L)),U(S.cursor)}catch(S){N(S instanceof Error?S.message:String(S))}finally{q.current=!1,P(!1)}},[m,M,D]);es(()=>{if(r&&i&&!_.current)E(null)},[r,i,E]);let X=async()=>{if(!a)throw Error("A live child session is required for cancellation");C(!0),N(null);try{await m.cancel(a.id)}catch(y){N(y instanceof Error?y.message:String(y))}finally{C(!1)}};return p("section",{"aria-label":T,className:"min-w-0",children:[p("div",{className:"flex min-w-0 items-center gap-1",children:[p(z,{variant:"ghost",size:"sm",className:"min-w-0 flex-1 justify-start gap-2","aria-label":`${T} · ${c(`subagents.${s.status}`)}`,"aria-expanded":i,"aria-controls":j,onClick:()=>{if(!i)v();x(!i)},children:[i?t(G,{className:"size-3.5 shrink-0"}):t(F,{className:"size-3.5 shrink-0"}),t("span",{className:"truncate",children:T}),t("span",{className:"text-muted-foreground ms-auto shrink-0 text-xs",role:"status",children:c(`subagents.${s.status}`)})]}),V&&t(z,{variant:"ghost",size:"icon-sm",disabled:w,"aria-label":c("subagents.cancel",{name:T}),onClick:()=>{X()},children:w?t(J,{className:"size-3.5 animate-spin"}):t(Z,{className:"size-3.5"})})]}),f&&!i&&t("p",{role:"alert",className:"text-destructive px-2 py-1 text-xs",children:f}),p("div",{id:j,hidden:!i,className:"min-w-0 ps-4",children:[(s.description||W)&&p("div",{className:"text-muted-foreground flex min-w-0 items-center gap-2 px-2 py-1 text-xs",children:[t("span",{className:"min-w-0 flex-1 truncate",title:s.description??void 0,children:s.description}),W&&t("span",{className:"shrink-0",children:K(W)})]}),f&&p("div",{role:"alert",className:"text-destructive px-2 py-1 text-xs",children:[f," ",s.threadId&&t(z,{variant:"ghost",size:"sm",onClick:()=>{E(n===null?null:R)},children:c("timeline.retry")})]}),B&&t("p",{role:"status",className:"text-muted-foreground px-2 py-2 text-xs",children:c("timeline.loadingEarlier")}),R&&t(z,{variant:"ghost",size:"sm",disabled:B,onClick:()=>{E(R)},children:c("timeline.loadEarlier")}),r&&i&&(H&&H.items.length>0?t("div",{className:"flex max-h-72 min-h-0 flex-col",children:t(ns,{session:H})}):!B&&!f&&t("p",{className:"text-muted-foreground px-2 py-3 text-xs",children:c("subagents.noMessages")}))]})]})}function ns({session:s}){let{client:l,host:d}=e(),r=yn(s);return t(tt,{session:s,client:l,host:d,turnWork:r})}
|
|
2
|
+
export{yn,ei};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ei}from"./chunk-9e6rv193.js";import{Se,t,_e,o,ct}from"./chunk-f1r8wh4e.js";import{Fi,st,Rn,Oi,Ui}from"./chunk-658y6xth.js";import{it}from"./chunk-tv1frh1m.js";import{li}from"./chunk-fgr2g610.js";import{ai}from"./chunk-29jan02g.js";import{_i,Pi}from"./chunk-36mdfph1.js";import{qi,Wi}from"./chunk-v0mbfaqw.js";import{ri}from"./chunk-0eewkw7t.js";import{si}from"./chunk-pza08wvz.js";import{bi}from"./chunk-7jmqq7b5.js";import{codexExtensionCapabilities as Me,codexMessageError as ze,codexRetryNotice as Ve,codexTurnError as Be,nativeTurnId as ge}from"@nyssance/codex-acp-v2/client";import{ArrowDownIcon as qe}from"lucide-react";import{useCallback as M,useEffect as N,useLayoutEffect as ve,useMemo as Q,useRef as h,useState as U}from"react";import{flushSync as Te}from"react-dom";import{Button as Y}from"@nyssance/shadcn/vega/components/ui/button";import{jsx as i,jsxs as E}from"react/jsx-runtime";var ye=24;function Oe(e){let d=Math.max(0,e.turnTopPx-ye),g=Math.max(0,e.scrollHeightPx-e.viewportHeightPx),s=d-g;return{scrollTopPx:d,spacerPx:s>0?e.spacerPx+s:e.spacerPx}}function Fe({viewportRef:e,viewportProps:d,children:g}){return i("div",{ref:e,...d,className:"min-h-0 min-w-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain outline-none",children:g})}function Ke({sessionId:e,turnId:d,root:g,error:s,connected:R}){let z=h(null),V=_e(),{t:b}=t(),S=M(()=>{V.loadHistoryTurn(e,d).catch(()=>{})},[V,e,d]);return N(()=>{if(!g||!z.current||!R||s)return;let w=new IntersectionObserver((_)=>{if(_.some((v)=>v.isIntersecting))w.disconnect(),S()},{root:g,rootMargin:"800px 0px"});return w.observe(z.current),()=>w.disconnect()},[g,R,s,S]),i("div",{ref:z,className:"flex min-h-80 flex-col justify-center gap-3 py-8","data-history-turn":d,"data-markdown-pending":!0,children:s?E("div",{className:"flex flex-col items-center gap-2",children:[i("p",{role:"alert",className:"text-destructive text-xs",children:s}),i(Y,{variant:"outline",size:"sm",onClick:S,disabled:!R,children:b("timeline.navigationRetry")})]}):E("div",{role:"status","aria-label":b("timeline.navigationLoading"),className:"space-y-3",children:[i("div",{className:"bg-muted ml-auto h-5 w-1/3 rounded"}),i("div",{className:"bg-muted h-3 w-4/5 rounded"}),i("div",{className:"bg-muted h-3 w-3/5 rounded"})]})})}function Ue(e,d){let g=h([]),s=h(null);if(s.current?.items!==e.items||s.current.state!==e.state||s.current.ended!==e.turnEndedAt||s.current.usage!==e.turnUsage||s.current.historyOrder!==d)s.current={state:e.state,items:e.items,ended:e.turnEndedAt,usage:e.turnUsage,historyOrder:d,turns:Fi(e,g.current,d)};let R=s.current.turns;return g.current=R,R}function tt(e){return i(Se,{host:e.host,client:e.client,children:i(We,{...e})})}function We({session:e,leading:d,afterTurn:g,turnWork:s,answerActions:R,turnFooter:z,renderUserMessage:V,insert:b,navigation:S,anchorNewTurn:w=!1,Viewport:_=Fe}){let v=_e(),A=t(),T=o((n)=>n.historyNavigation[e.id]),c=Ue(e,T?.turns),L=c.at(-1)?.key,xe=Oi(e,c),y=e.state==="running"||e.state==="requires_action",W=Q(()=>ai(c,T),[c,T]),Z=Q(()=>W.flatMap((n)=>n.turn===void 0?[]:[{...n.turn,key:n.turnKey}]),[W]),he=Q(()=>S===void 0?[]:_i(c,e.turnUsage,T),[S,c,e.turnUsage,T]),ee=b&&b.afterItemId!==null?c.findIndex((n)=>n.items.some((a)=>a.id===b.afterItemId)):-1,D=h(c);D.current=c;let[l,be]=U(null),x=o((n)=>n.historyPages[e.id]),k=o((n)=>n.connection==="ready"),we=o((n)=>Me(n.agent).sessionRetry),te=x!==void 0;N(()=>{if(k&&te&&!e.restoring)v.loadHistoryNavigation(e.id).catch(()=>{})},[v,k,te,e.id,e.restoring]);let[Re,ke]=U(!1),O=h(null),[Pe,ne]=U(!1),re=h(0),j=h({key:L,running:y});j.current={key:L,running:y};let[ie,F]=U(0),I=h(0),H=h(null);I.current=ie;let Ie=M(()=>{if(H.current!==null)H.current.keepTop=!1},[]),{isFollowing:C,scrollToBottom:X,stopFollowing:B,schedulePin:oe,contentResized:le,beginLocate:ae,cancelLocation:ue}=si(l,y,Ie),se=M(()=>{if(l===null||!y)return;let n=c.at(-1)?.key;if(n===void 0)return;let a=ae(!0),u=()=>a.isCurrent()&&j.current.running&&j.current.key===n,r=()=>requestAnimationFrame(()=>requestAnimationFrame(()=>{if(!u())return;let f=l.querySelector(`[data-codex-turn="${CSS.escape(n)}"]`);if(f===null)return;let m=l.scrollTop+f.getBoundingClientRect().top-l.getBoundingClientRect().top,P=Oe({turnTopPx:m,scrollHeightPx:l.scrollHeight,viewportHeightPx:l.clientHeight,spacerPx:I.current});H.current=P.spacerPx>0?{element:f,heightPx:f.getBoundingClientRect().height+P.spacerPx,keepTop:!0}:null,Te(()=>F(P.spacerPx)),requestAnimationFrame(()=>{if(u())a.finish(P.scrollTopPx)})})),p=O.current;if(p===null)return;p.scrollToKey(n,void 0,{align:"top"}).then(()=>{if(u())r()})},[ae,y,l,c]);ve(()=>{if(!w||y)return;ue(),H.current=null,I.current=0,F(0)},[w,ue,y]);let G=M(()=>{B(),v.loadOlderHistory(e.id).catch(()=>{})},[v,e.id,B]);N(()=>{if(l===null)return;let n=()=>{let a=l.scrollTop<600;if(ke(a),a&&!T?.complete&&k&&!e.restoring&&!C&&x?.cursor&&!x.loading&&!x.error)G()};return n(),l.addEventListener("scroll",n,{passive:!0}),()=>l.removeEventListener("scroll",n)},[k,x,C,G,l,e.restoring,T?.complete]),N(()=>{qi({sessionId:e.id,turns:Z,api:O.current,beforeReveal:B,terminals:e.terminals})},[e.id,e.terminals,Z,B]),N(()=>()=>Wi(e.id),[e.id]);let He=M(async(n,a)=>{let u=++re.current;ne(!0);try{if(n.isLoaded===!1&&n.nativeTurnId!==void 0)await v.loadHistoryTurn(e.id,n.nativeTurnId),await new Promise((m)=>requestAnimationFrame(()=>m()));if(!a())return null;let r=D.current.find((m)=>m.user?.id===(n.messageId??n.id))??D.current.find((m)=>m.user!==null&&n.nativeTurnId!==void 0&&m.items.some((P)=>ge(P)===n.nativeTurnId));if(!r?.user)return null;let p=r.user.id,f=O.current;if(f===null)throw Error("Virtual timeline is not mounted");return await f.scrollToKey(r.key,(m)=>m.querySelector(`[data-content-search-unit-key="${CSS.escape(p)}"]`),{align:"top"}),document.querySelector(`[data-chat-scroll] [data-content-search-unit-key="${CSS.escape(p)}"]`)}finally{if(re.current===u)ne(!1)}},[v,e.id]),Ne=M(async(n)=>{if(n.nativeTurnId!==void 0)await v.previewHistoryTurn(e.id,n.nativeTurnId)},[v,e.id]);N(()=>{if(l===null)return;let n=l.querySelector("[data-codex-timeline]");if(n===null)throw Error("Timeline content element is missing");let a=new ResizeObserver(()=>{let u=H.current,r=null;if(u!==null){let p=Math.max(0,u.heightPx-u.element.getBoundingClientRect().height);if(p!==I.current&&(p<I.current||u.keepTop)){if(I.current=p,Te(()=>F(p)),p===0)H.current=null}if(p>0&&u.keepTop)r=l.scrollTop+u.element.getBoundingClientRect().top-l.getBoundingClientRect().top-ye}le(r)});if(a.observe(n),a.observe(l),L!==void 0){let u=l.querySelector(`[data-codex-turn="${CSS.escape(L)}"]`);if(u===null)throw Error("Latest turn is not mounted");a.observe(u)}return()=>a.disconnect()},[le,L,l]),N(()=>{if(e.items.length===0)return;oe()},[oe,e.items]);let ce=h(null);ve(()=>{if(l===null)return;let n=c.at(-1),a=ce.current;if(ce.current=n===void 0?null:{key:n.key,running:y},n===void 0||a===null||n.user===null||n.replayed)return;if(w){if(y&&e.turnEndedAt[n.user.id]===void 0&&(n.key!==a.key||!a.running))H.current=null,I.current=0,F(0),se()}else if(n.key!==a.key)X()},[se,w,y,X,l,e.turnEndedAt,c]);let Ee=(n,a)=>{let u=n,r=u.turn;if(r===void 0){if(u.nativeTurnId===void 0)throw Error(`Turn is missing at index ${a}`);return i(Ke,{sessionId:e.id,turnId:u.nativeTurnId,root:l,error:T?.turnErrors[u.nativeTurnId],connected:k&&!C&&!Pe})}let p=c.indexOf(r),f=r.key===xe,m=Ui(e,c,p),P=!f&&m.continued,K=r.key===L,q=r.errors.at(-1),de=q===void 0?null:ze(q),J=q===void 0?null:ge(q),Ae=!e.subagent&&K&&!f&&k&&we&&e.attached&&!e.readOnly&&!e.restoring&&q===e.items.at(-1)&&de!==null&&Be(de).kind==="overloaded"&&J!==null&&e.lastStopReason!=="end_turn"&&e.lastStopReason!=="cancelled",me=z?.(r)??null,pe=s?.(r)??null,Le=pe!==null||r.work.length>0||r.final.length>0||r.errors.length>0||f||me!==null||st(r)||Rn(r)||K&&(e.error!==null||e.lastStopReason==="cancelled"),fe=r.user===null?null:it(r);return E("div",{"data-virtualized-turn-content":!0,"data-codex-turn":r.key,className:"flex flex-col gap-1.5",children:[r.user!==null&&(V===void 0?i(bi,{item:r.user,messageTime:fe}):V(r.user,fe)),Le&&i(li,{sessionId:e.id,turn:r,terminals:e.terminals,active:f,blocked:e.state==="requires_action",continued:P,edits:m.edits,activityItems:m.items,workStartedAt:m.startedAt,isLast:K,error:e.error,retrying:f?Ve(e._meta)??void 0:void 0,retry:Ae?{turnId:J,delaySeconds:ri(c),run:(Ce)=>v.retrySession(e.id,J,Ce)}:void 0,interrupted:Rn(r)||!f&&K&&e.lastStopReason==="cancelled",extraWork:pe,answerActions:R?.(r),footer:me}),a===ee&&b?.node,g?.(r)]})};return E("div",{className:"relative flex min-h-0 flex-1 flex-col","data-stream-style":"codexUI",children:[i(_,{viewportRef:be,viewportProps:{"data-chat-scroll":"",style:{overflowAnchor:"none"},tabIndex:0,role:"log","aria-label":A.t("timeline.label")},children:i("div",{className:"codex-timeline-content flex min-h-full w-full flex-col",children:E("div",{"data-timeline-user-message-navigation-content":!0,className:"mx-auto flex w-full max-w-3xl shrink-0 flex-col",children:[b&&ee===-1&&b.node,i(ei,{ref:O,entries:W,renderTurn:Ee,scrollElement:l,sessionKey:e.id,preserveViewport:!C,leadingInsetPx:12,leadingContent:d===void 0?void 0:i("div",{className:"pt-3",children:d})}),w&&i("div",{"aria-hidden":"true","data-turn-anchor-spacer":!0,className:"shrink-0",style:{height:ie}}),i("div",{"aria-hidden":"true",className:"h-6 shrink-0"})]})})}),i("div",{"aria-hidden":"true",className:"codex-timeline-bottom-fade"}),T?.error&&i("div",{className:"absolute inset-x-0 top-2 z-10 flex justify-center",children:i(Y,{variant:"outline",size:"sm",disabled:!k,title:T.error,onClick:()=>{v.loadHistoryNavigation(e.id).catch(()=>{})},children:A.t("timeline.navigationRetry")})}),Re&&x?.cursor&&!T?.complete&&E("div",{className:"absolute inset-x-0 top-2 z-10 flex flex-col items-center gap-1","data-history-loader":!0,children:[i(Y,{variant:"outline",size:"sm",disabled:!k||e.restoring||x.loading,onClick:G,children:x.loading?A.t("timeline.loadingEarlier"):A.t("timeline.loadEarlier")}),x.error&&i("p",{role:"alert",className:"bg-background text-destructive max-w-md rounded px-2 py-1 text-xs",children:x.error})]}),S!==void 0&&i(Pi,{items:he,audio:S.audio,scrollRoot:l,beforeReveal:B,ensureItemMounted:He,onPreviewItem:Ne,onRevealError:(n)=>ct(A,n),targetTopMarginPx:16},e.id),i("button",{type:"button",className:C?"codex-scroll-to-bottom codex-scroll-to-bottom-hidden":"codex-scroll-to-bottom",tabIndex:C?-1:void 0,onClick:X,"aria-label":A.t("timeline.scrollToBottom"),children:y?E("span",{className:"codex-scroll-to-bottom-dots","aria-hidden":"true",children:[i("span",{className:"codex-wave-dot"}),i("span",{className:"codex-wave-dot"}),i("span",{className:"codex-wave-dot"})]}):i(qe,{})})]})}
|
|
1
|
+
import{ti}from"./chunk-4ytrtcdb.js";import{Se,t,_e,o,ct}from"./chunk-cbp0q0yt.js";import{Di,st,Rn,Ui,Bi}from"./chunk-ydxrj4as.js";import{it}from"./chunk-tv1frh1m.js";import{ci}from"./chunk-23g1j51d.js";import{si}from"./chunk-48fj5m0p.js";import{Pi,Ti}from"./chunk-42v3qgdq.js";import{Wi,Zi}from"./chunk-n14f6z0f.js";import{ai}from"./chunk-k4dg1jep.js";import{li}from"./chunk-kc56dhwd.js";import{Ci}from"./chunk-fvg2w21q.js";import{codexExtensionCapabilities as Me,codexMessageError as ze,codexRetryNotice as Ve,codexTurnError as Be,nativeTurnId as ge}from"@nyssance/codex-acp-v2/client";import{ArrowDownIcon as qe}from"lucide-react";import{useCallback as M,useEffect as N,useLayoutEffect as ve,useMemo as Q,useRef as h,useState as U}from"react";import{flushSync as Te}from"react-dom";import{Button as Y}from"@nyssance/shadcn/vega/components/ui/button";import{jsx as i,jsxs as E}from"react/jsx-runtime";var ye=24;function Oe(e){let d=Math.max(0,e.turnTopPx-ye),g=Math.max(0,e.scrollHeightPx-e.viewportHeightPx),s=d-g;return{scrollTopPx:d,spacerPx:s>0?e.spacerPx+s:e.spacerPx}}function Fe({viewportRef:e,viewportProps:d,children:g}){return i("div",{ref:e,...d,className:"min-h-0 min-w-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain outline-none",children:g})}function Ke({sessionId:e,turnId:d,root:g,error:s,connected:R}){let z=h(null),V=_e(),{t:b}=t(),S=M(()=>{V.loadHistoryTurn(e,d).catch(()=>{})},[V,e,d]);return N(()=>{if(!g||!z.current||!R||s)return;let w=new IntersectionObserver((_)=>{if(_.some((v)=>v.isIntersecting))w.disconnect(),S()},{root:g,rootMargin:"800px 0px"});return w.observe(z.current),()=>w.disconnect()},[g,R,s,S]),i("div",{ref:z,className:"flex min-h-80 flex-col justify-center gap-3 py-8","data-history-turn":d,"data-markdown-pending":!0,children:s?E("div",{className:"flex flex-col items-center gap-2",children:[i("p",{role:"alert",className:"text-destructive text-xs",children:s}),i(Y,{variant:"outline",size:"sm",onClick:S,disabled:!R,children:b("timeline.navigationRetry")})]}):E("div",{role:"status","aria-label":b("timeline.navigationLoading"),className:"space-y-3",children:[i("div",{className:"bg-muted ml-auto h-5 w-1/3 rounded"}),i("div",{className:"bg-muted h-3 w-4/5 rounded"}),i("div",{className:"bg-muted h-3 w-3/5 rounded"})]})})}function Ue(e,d){let g=h([]),s=h(null);if(s.current?.items!==e.items||s.current.state!==e.state||s.current.ended!==e.turnEndedAt||s.current.usage!==e.turnUsage||s.current.historyOrder!==d)s.current={state:e.state,items:e.items,ended:e.turnEndedAt,usage:e.turnUsage,historyOrder:d,turns:Di(e,g.current,d)};let R=s.current.turns;return g.current=R,R}function tt(e){return i(Se,{host:e.host,client:e.client,children:i(We,{...e})})}function We({session:e,leading:d,afterTurn:g,turnWork:s,answerActions:R,turnFooter:z,renderUserMessage:V,insert:b,navigation:S,anchorNewTurn:w=!1,Viewport:_=Fe}){let v=_e(),A=t(),T=o((n)=>n.historyNavigation[e.id]),c=Ue(e,T?.turns),L=c.at(-1)?.key,xe=Ui(e,c),y=e.state==="running"||e.state==="requires_action",W=Q(()=>si(c,T),[c,T]),Z=Q(()=>W.flatMap((n)=>n.turn===void 0?[]:[{...n.turn,key:n.turnKey}]),[W]),he=Q(()=>S===void 0?[]:Pi(c,e.turnUsage,T),[S,c,e.turnUsage,T]),ee=b&&b.afterItemId!==null?c.findIndex((n)=>n.items.some((a)=>a.id===b.afterItemId)):-1,D=h(c);D.current=c;let[l,be]=U(null),x=o((n)=>n.historyPages[e.id]),k=o((n)=>n.connection==="ready"),we=o((n)=>Me(n.agent).sessionRetry),te=x!==void 0;N(()=>{if(k&&te&&!e.restoring)v.loadHistoryNavigation(e.id).catch(()=>{})},[v,k,te,e.id,e.restoring]);let[Re,ke]=U(!1),O=h(null),[Pe,ne]=U(!1),re=h(0),j=h({key:L,running:y});j.current={key:L,running:y};let[ie,F]=U(0),I=h(0),H=h(null);I.current=ie;let Ie=M(()=>{if(H.current!==null)H.current.keepTop=!1},[]),{isFollowing:C,scrollToBottom:X,stopFollowing:B,schedulePin:oe,contentResized:le,beginLocate:ae,cancelLocation:ue}=li(l,y,Ie),se=M(()=>{if(l===null||!y)return;let n=c.at(-1)?.key;if(n===void 0)return;let a=ae(!0),u=()=>a.isCurrent()&&j.current.running&&j.current.key===n,r=()=>requestAnimationFrame(()=>requestAnimationFrame(()=>{if(!u())return;let f=l.querySelector(`[data-codex-turn="${CSS.escape(n)}"]`);if(f===null)return;let m=l.scrollTop+f.getBoundingClientRect().top-l.getBoundingClientRect().top,P=Oe({turnTopPx:m,scrollHeightPx:l.scrollHeight,viewportHeightPx:l.clientHeight,spacerPx:I.current});H.current=P.spacerPx>0?{element:f,heightPx:f.getBoundingClientRect().height+P.spacerPx,keepTop:!0}:null,Te(()=>F(P.spacerPx)),requestAnimationFrame(()=>{if(u())a.finish(P.scrollTopPx)})})),p=O.current;if(p===null)return;p.scrollToKey(n,void 0,{align:"top"}).then(()=>{if(u())r()})},[ae,y,l,c]);ve(()=>{if(!w||y)return;ue(),H.current=null,I.current=0,F(0)},[w,ue,y]);let G=M(()=>{B(),v.loadOlderHistory(e.id).catch(()=>{})},[v,e.id,B]);N(()=>{if(l===null)return;let n=()=>{let a=l.scrollTop<600;if(ke(a),a&&!T?.complete&&k&&!e.restoring&&!C&&x?.cursor&&!x.loading&&!x.error)G()};return n(),l.addEventListener("scroll",n,{passive:!0}),()=>l.removeEventListener("scroll",n)},[k,x,C,G,l,e.restoring,T?.complete]),N(()=>{Wi({sessionId:e.id,turns:Z,api:O.current,beforeReveal:B,terminals:e.terminals})},[e.id,e.terminals,Z,B]),N(()=>()=>Zi(e.id),[e.id]);let He=M(async(n,a)=>{let u=++re.current;ne(!0);try{if(n.isLoaded===!1&&n.nativeTurnId!==void 0)await v.loadHistoryTurn(e.id,n.nativeTurnId),await new Promise((m)=>requestAnimationFrame(()=>m()));if(!a())return null;let r=D.current.find((m)=>m.user?.id===(n.messageId??n.id))??D.current.find((m)=>m.user!==null&&n.nativeTurnId!==void 0&&m.items.some((P)=>ge(P)===n.nativeTurnId));if(!r?.user)return null;let p=r.user.id,f=O.current;if(f===null)throw Error("Virtual timeline is not mounted");return await f.scrollToKey(r.key,(m)=>m.querySelector(`[data-content-search-unit-key="${CSS.escape(p)}"]`),{align:"top"}),document.querySelector(`[data-chat-scroll] [data-content-search-unit-key="${CSS.escape(p)}"]`)}finally{if(re.current===u)ne(!1)}},[v,e.id]),Ne=M(async(n)=>{if(n.nativeTurnId!==void 0)await v.previewHistoryTurn(e.id,n.nativeTurnId)},[v,e.id]);N(()=>{if(l===null)return;let n=l.querySelector("[data-codex-timeline]");if(n===null)throw Error("Timeline content element is missing");let a=new ResizeObserver(()=>{let u=H.current,r=null;if(u!==null){let p=Math.max(0,u.heightPx-u.element.getBoundingClientRect().height);if(p!==I.current&&(p<I.current||u.keepTop)){if(I.current=p,Te(()=>F(p)),p===0)H.current=null}if(p>0&&u.keepTop)r=l.scrollTop+u.element.getBoundingClientRect().top-l.getBoundingClientRect().top-ye}le(r)});if(a.observe(n),a.observe(l),L!==void 0){let u=l.querySelector(`[data-codex-turn="${CSS.escape(L)}"]`);if(u===null)throw Error("Latest turn is not mounted");a.observe(u)}return()=>a.disconnect()},[le,L,l]),N(()=>{if(e.items.length===0)return;oe()},[oe,e.items]);let ce=h(null);ve(()=>{if(l===null)return;let n=c.at(-1),a=ce.current;if(ce.current=n===void 0?null:{key:n.key,running:y},n===void 0||a===null||n.user===null||n.replayed)return;if(w){if(y&&e.turnEndedAt[n.user.id]===void 0&&(n.key!==a.key||!a.running))H.current=null,I.current=0,F(0),se()}else if(n.key!==a.key)X()},[se,w,y,X,l,e.turnEndedAt,c]);let Ee=(n,a)=>{let u=n,r=u.turn;if(r===void 0){if(u.nativeTurnId===void 0)throw Error(`Turn is missing at index ${a}`);return i(Ke,{sessionId:e.id,turnId:u.nativeTurnId,root:l,error:T?.turnErrors[u.nativeTurnId],connected:k&&!C&&!Pe})}let p=c.indexOf(r),f=r.key===xe,m=Bi(e,c,p),P=!f&&m.continued,K=r.key===L,q=r.errors.at(-1),de=q===void 0?null:ze(q),J=q===void 0?null:ge(q),Ae=!e.subagent&&K&&!f&&k&&we&&e.attached&&!e.readOnly&&!e.restoring&&q===e.items.at(-1)&&de!==null&&Be(de).kind==="overloaded"&&J!==null&&e.lastStopReason!=="end_turn"&&e.lastStopReason!=="cancelled",me=z?.(r)??null,pe=s?.(r)??null,Le=pe!==null||r.work.length>0||r.final.length>0||r.errors.length>0||f||me!==null||st(r)||Rn(r)||K&&(e.error!==null||e.lastStopReason==="cancelled"),fe=r.user===null?null:it(r);return E("div",{"data-virtualized-turn-content":!0,"data-codex-turn":r.key,className:"flex flex-col gap-1.5",children:[r.user!==null&&(V===void 0?i(Ci,{item:r.user,messageTime:fe}):V(r.user,fe)),Le&&i(ci,{sessionId:e.id,turn:r,terminals:e.terminals,active:f,blocked:e.state==="requires_action",continued:P,edits:m.edits,activityItems:m.items,workStartedAt:m.startedAt,isLast:K,error:e.error,retrying:f?Ve(e._meta)??void 0:void 0,retry:Ae?{turnId:J,delaySeconds:ai(c),run:(Ce)=>v.retrySession(e.id,J,Ce)}:void 0,interrupted:Rn(r)||!f&&K&&e.lastStopReason==="cancelled",extraWork:pe,answerActions:R?.(r),footer:me}),a===ee&&b?.node,g?.(r)]})};return E("div",{className:"relative flex min-h-0 flex-1 flex-col","data-stream-style":"codexUI",children:[i(_,{viewportRef:be,viewportProps:{"data-chat-scroll":"",style:{overflowAnchor:"none"},tabIndex:0,role:"log","aria-label":A.t("timeline.label")},children:i("div",{className:"codex-timeline-content flex min-h-full w-full flex-col",children:E("div",{"data-timeline-user-message-navigation-content":!0,className:"mx-auto flex w-full max-w-3xl shrink-0 flex-col",children:[b&&ee===-1&&b.node,i(ti,{ref:O,entries:W,renderTurn:Ee,scrollElement:l,sessionKey:e.id,preserveViewport:!C,leadingInsetPx:12,leadingContent:d===void 0?void 0:i("div",{className:"pt-3",children:d})}),w&&i("div",{"aria-hidden":"true","data-turn-anchor-spacer":!0,className:"shrink-0",style:{height:ie}}),i("div",{"aria-hidden":"true",className:"h-6 shrink-0"})]})})}),i("div",{"aria-hidden":"true",className:"codex-timeline-bottom-fade"}),T?.error&&i("div",{className:"absolute inset-x-0 top-2 z-10 flex justify-center",children:i(Y,{variant:"outline",size:"sm",disabled:!k,title:T.error,onClick:()=>{v.loadHistoryNavigation(e.id).catch(()=>{})},children:A.t("timeline.navigationRetry")})}),Re&&x?.cursor&&!T?.complete&&E("div",{className:"absolute inset-x-0 top-2 z-10 flex flex-col items-center gap-1","data-history-loader":!0,children:[i(Y,{variant:"outline",size:"sm",disabled:!k||e.restoring||x.loading,onClick:G,children:x.loading?A.t("timeline.loadingEarlier"):A.t("timeline.loadEarlier")}),x.error&&i("p",{role:"alert",className:"bg-background text-destructive max-w-md rounded px-2 py-1 text-xs",children:x.error})]}),S!==void 0&&i(Ti,{items:he,audio:S.audio,scrollRoot:l,beforeReveal:B,ensureItemMounted:He,onPreviewItem:Ne,onRevealError:(n)=>ct(A,n),targetTopMarginPx:16},e.id),i("button",{type:"button",className:C?"codex-scroll-to-bottom codex-scroll-to-bottom-hidden":"codex-scroll-to-bottom",tabIndex:C?-1:void 0,onClick:X,"aria-label":A.t("timeline.scrollToBottom"),children:y?E("span",{className:"codex-scroll-to-bottom-dots","aria-hidden":"true",children:[i("span",{className:"codex-wave-dot"}),i("span",{className:"codex-wave-dot"}),i("span",{className:"codex-wave-dot"})]}):i(qe,{})})]})}
|
|
2
2
|
export{tt};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{fe}from"./chunk-
|
|
2
|
-
export{
|
|
1
|
+
import{fe}from"./chunk-ak2frpw9.js";import{useEffect as s,useState as w}from"react";function co(){let[i,e]=w(!1);return s(()=>{let t=fe()?"Meta":"Control",o=(n)=>{if(n.key===t)e(!0)},r=(n)=>{if(n.key===t)e(!1)},d=()=>e(!1);return window.addEventListener("keydown",o),window.addEventListener("keyup",r),window.addEventListener("blur",d),()=>{window.removeEventListener("keydown",o),window.removeEventListener("keyup",r),window.removeEventListener("blur",d)}},[]),i}
|
|
2
|
+
export{co};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{qi}from"./chunk-kvkpd69n.js";import{isText as s,terminalOf as i}from"@nyssance/codex-acp-v2/client";function n(t){if(typeof t==="string")return[t];if(Array.isArray(t))return t.flatMap(n);if(typeof t!=="object"||t===null)return[];return Object.entries(t).flatMap(([r,e])=>r==="data"||r==="blob"?[]:n(e))}function u(t){return s(t)?[t.text]:[]}function p(t,r){switch(t.kind){case"user":case"assistant":case"thought":return t.content.flatMap(u);case"tool":return[t.title??"",...n(t.rawInput),...n(i(t,r)?.output||t.rawOutput),...n(t.content)];case"plan":return n(t.plan);case"compaction":return[t.error??""]}}function On(t,r,e={}){let o=r.trim();if(o.length===0)return[];return qi(t.map((a)=>({turnKey:a.key,segments:a.items.flatMap((c)=>p(c,e))})),o)}
|
|
2
2
|
export{On};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{zo}from"./chunk-xphfecws.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 Go(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 zo(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{Go};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{wo,ko,Bt}from"./chunk-f0g5k1d0.js";import{Xe,N}from"./chunk-k7d2y0wx.js";import{cn as D}from"cn";import{forwardRef as M,useCallback as R,useEffect as x,useImperativeHandle as F,useRef as d}from"react";import{InputGroupTextarea as K}from"@nyssance/shadcn/vega/components/ui/input-group";import{jsx as q}from"react/jsx-runtime";var z=(c)=>!c.shiftKey,L=()=>!1,un=M(({onChange:c,onKeyDown:T,onCompositionStart:b,onCompositionEnd:y,className:E,placeholder:I,bashMode:C=!1,isSendShortcut:H=z,isNewlineShortcut:S=L,...h},P)=>{let n=Xe(),p=N(),u=d(!1),i=d(!1),a=d(null),l=d(null),o=R(()=>{if(globalThis.CSS?.supports?.("field-sizing","content")||l.current!==null)return;l.current=requestAnimationFrame(()=>{l.current=null;let e=a.current;if(!e||u.current)return;e.style.height="auto",e.style.height=`${e.scrollHeight}px`})},[]);x(()=>{let e=a.current;if(!e||globalThis.CSS?.supports?.("field-sizing","content"))return;let t,r=new ResizeObserver(([s])=>{if(s&&s.contentRect.width!==t)t=s.contentRect.width,o()});return r.observe(e),o(),()=>{if(r.disconnect(),l.current!==null)cancelAnimationFrame(l.current);l.current=null}},[o]),x(o,[o,n?.textInput.value,h.value]);let f=C&&(n?.textInput.value??"").startsWith("!"),w=(e)=>{if(u.current||e.nativeEvent.isComposing||e.nativeEvent.keyCode===229||i.current)return;if(T?.(e),e.defaultPrevented)return;if(e.key.length===1&&e.key.charCodeAt(0)<32&&e.key!==`
|
|
2
2
|
`&&e.key!=="\r"&&e.key!=="\t"){e.preventDefault();return}if(f&&n){let t=e.currentTarget.selectionStart===0&&e.currentTarget.selectionEnd===0;if(e.key==="Escape"||(e.key==="Backspace"||e.key==="Delete")&&t){e.preventDefault(),n.textInput.setInput(n.textInput.value.slice(1));return}}if(e.key==="Enter"){if(S(e.nativeEvent)){e.preventDefault();let t=e.currentTarget,{selectionStart:r,selectionEnd:s,value:m}=t,g=`${m.slice(0,r)}
|
|
3
|
-
${m.slice(s)}`;if(n)n.textInput.setInput(g);else t.value=g;let v=r+1;t.setSelectionRange(v,v),o();return}if(H(e.nativeEvent)){e.preventDefault();let t=e.currentTarget.form;if(!t)return;let r=t.querySelector('button[type="submit"]');if(!r||r.disabled)return;t.requestSubmit(r)}}if(e.key==="Backspace"&&e.currentTarget.value===""&&p.files.length>0){e.preventDefault();let t=p.files.at(-1);if(t)p.remove(t.id)}},k=(e)=>{let t=e.clipboardData?.items;if(!t)return;let{imageFiles:r,sawNonImageFile:s}=
|
|
3
|
+
${m.slice(s)}`;if(n)n.textInput.setInput(g);else t.value=g;let v=r+1;t.setSelectionRange(v,v),o();return}if(H(e.nativeEvent)){e.preventDefault();let t=e.currentTarget.form;if(!t)return;let r=t.querySelector('button[type="submit"]');if(!r||r.disabled)return;t.requestSubmit(r)}}if(e.key==="Backspace"&&e.currentTarget.value===""&&p.files.length>0){e.preventDefault();let t=p.files.at(-1);if(t)p.remove(t.id)}},k=(e)=>{let t=e.clipboardData?.items;if(!t)return;let{imageFiles:r,sawNonImageFile:s}=wo(t),m=ko(t);if(r.length>0)e.preventDefault(),p.add(r);else if(s&&!m)e.preventDefault()},A=n?{value:u.current&&a.current?a.current.value:f?n.textInput.value.slice(1):n.textInput.value,onChange:(e)=>{let t=u.current?e.currentTarget.value:Bt(e.currentTarget);n.textInput.setInput(f?`!${t}`:t),o(),c?.(e)}}:{onChange:(e)=>{if(!u.current)Bt(e.currentTarget);o(),c?.(e)}};return F(P,()=>({resetHeight:()=>{if(a.current)a.current.style.height="auto"},focus:()=>{a.current?.focus()},isComposing:()=>u.current||i.current,getTextarea:()=>a.current}),[]),q(K,{"data-chat-input":!0,ref:a,rows:3,className:D("field-sizing-content max-h-(--chat-input-max-height) min-h-[calc(var(--chat-input-line-height)*3)] min-w-0 flex-1 overflow-x-hidden","leading-(--chat-input-line-height)","placeholder:text-chat-input-placeholder p-0 pe-2.5","bg-chat-input-bg",E),name:"message",onCompositionEnd:(e)=>{u.current=!1;let t=Bt(e.currentTarget);n?.textInput.setInput(f?`!${t}`:t),o(),y?.(e),i.current=!0,requestAnimationFrame(()=>{i.current=!1})},onCompositionStart:(e)=>{i.current=!1,u.current=!0,b?.(e)},onKeyDown:w,onPaste:k,placeholder:I,...h,...A})});un.displayName="PromptInputTextarea";
|
|
4
4
|
export{un};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c}from"./chunk-k7y6dqf2.js";import{cn as o}from"cn";import{motion as u}from"motion/react";import{jsx as i,jsxs as g}from"react/jsx-runtime";function We({active:n,expanded:r=!1,highlight:s=!0,className:a,...l}){return i("button",{type:"button","data-active":n?"":void 0,"aria-current":n?"page":void 0,className:o(s&&c,"focus-visible:outline-foreground/10 flex shrink-0 items-center justify-center rounded-[10px] outline-hidden [corner-shape:superellipse(1.5)] focus-visible:outline-2 focus-visible:outline-offset-2 [&_svg]:size-4",r?"h-[var(--navigation-row-height,30px)] min-w-[var(--navigation-row-height,30px)]":"size-[var(--navigation-row-height,30px)]",a),...l})}function
|
|
2
|
-
export{We,
|
|
1
|
+
import{c}from"./chunk-k7y6dqf2.js";import{cn as o}from"cn";import{motion as u}from"motion/react";import{jsx as i,jsxs as g}from"react/jsx-runtime";function We({active:n,expanded:r=!1,highlight:s=!0,className:a,...l}){return i("button",{type:"button","data-active":n?"":void 0,"aria-current":n?"page":void 0,className:o(s&&c,"focus-visible:outline-foreground/10 flex shrink-0 items-center justify-center rounded-[10px] outline-hidden [corner-shape:superellipse(1.5)] focus-visible:outline-2 focus-visible:outline-offset-2 [&_svg]:size-4",r?"h-[var(--navigation-row-height,30px)] min-w-[var(--navigation-row-height,30px)]":"size-[var(--navigation-row-height,30px)]",a),...l})}function Rr({tabs:n,view:r,onViewChange:s,onReset:a,notifications:l,trailing:p,className:d}){return g("div",{className:o("relative mb-2 flex h-[var(--navigation-row-height,30px)] shrink-0 items-center gap-0.5",d),children:[i("div",{role:"tablist",className:"bg-foreground/5 flex h-[var(--navigation-row-height,30px)] w-52 flex-none items-center gap-0.5 rounded-[10px] [corner-shape:superellipse(1.5)]",children:n.map((e)=>{let t=r===e.key;return g(We,{role:"tab",active:t,expanded:t,highlight:!1,"aria-selected":t,title:e.title,onClick:()=>s(e.key),onDoubleClick:a&&(()=>a(e.key)),className:o("relative isolate h-[var(--navigation-row-height,30px)] min-w-[var(--navigation-row-height,30px)] justify-start rounded-[10px] px-[6px] text-sm [corner-shape:superellipse(1.5)] [&_svg]:relative [&_svg]:z-10 [&_svg]:size-[18px] [&_svg]:shrink-0",t?"grow transition-[flex-grow] duration-200 ease-out":"grow-0 duration-0"),children:[t&&i(u.span,{layoutId:"navigation-selected-pill","aria-hidden":"true",className:"bg-foreground/8 pointer-events-none absolute inset-0 -z-10 rounded-[10px] [corner-shape:superellipse(1.5)]",transition:{duration:0.2,ease:[0.22,1,0.36,1]}}),e.icon,l?.has(e.key)&&i("span",{"data-activity-notification":!0,"aria-hidden":"true",className:"bg-destructive pointer-events-none absolute top-1 right-1 z-20 size-1.5 rounded-full motion-safe:animate-[activity-notification-pulse_2s_ease-in-out_infinite]"}),i("span",{className:o("relative z-10 grid",t?"ms-1.5 grid-cols-[1fr] transition-[grid-template-columns,margin-inline-start] duration-200 ease-out":"ms-0 grid-cols-[0fr] duration-0"),children:i("span",{className:"min-w-0 overflow-hidden whitespace-nowrap",children:e.title})})]},e.key)})}),p!=null&&i("div",{className:"ms-auto flex shrink-0 items-center gap-0.5",children:p})]})}
|
|
2
|
+
export{We,Rr};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{dn}from"./chunk-
|
|
1
|
+
import{dn}from"./chunk-7vcwgkhs.js";import{Co}from"./chunk-x29s0dbq.js";import{Ye}from"./chunk-k7d2y0wx.js";import{autoUpdate as ot}from"@floating-ui/dom";import{cn as G}from"cn";import{BookOpenTextIcon as rt,FileIcon as st,StoreIcon as it}from"lucide-react";import{useCallback as lt,useEffect as d,useLayoutEffect as J,useMemo as X,useRef as Y,useState as v}from"react";import{createPortal as ut}from"react-dom";import{Button as Z}from"@nyssance/shadcn/vega/components/ui/button";import{Separator as at}from"@nyssance/shadcn/vega/components/ui/separator";import{jsx as m,jsxs as w,Fragment as ct}from"react/jsx-runtime";function bo({handleRef:l,anchorRef:a,commands:T,searchFiles:u,onMention:_,onSearchError:B,fileSearchDebounceMs:C=0,bashMode:H=!1,forcedOpen:s=!1,onForcedOpenChange:p,emptyLabel:R,fileStatusLabels:E,morePlugins:M}){let A=Ye(),i=A.textInput.value,[j,z]=v(0),[g,D]=v(null),[x,h]=v(0),K=Y(null);d(()=>{let t=l.current?.getTextarea();if(!t)return;let e=()=>z(t.selectionStart??0),n=()=>{if(document.activeElement===t)e()};return t.addEventListener("keyup",e),t.addEventListener("click",e),t.addEventListener("input",e),t.addEventListener("select",e),t.addEventListener("focus",e),document.addEventListener("selectionchange",n),()=>{t.removeEventListener("keyup",e),t.removeEventListener("click",e),t.removeEventListener("input",e),t.removeEventListener("select",e),t.removeEventListener("focus",e),document.removeEventListener("selectionchange",n)}},[l]);let U=X(()=>H&&i.startsWith("!")?null:Co(i,j),[i,j,H]),o=U?.kind==="at"&&!u?null:U,P=`${o?.kind??"forced"}:${o?.query??""}:${s}`,[F,O]=v(P);if(F!==P)O(P),h(0);let L=Y(null);d(()=>{if(!s){L.current=null;return}if(L.current===null)L.current=i;else if(i!==L.current)p?.(!1)},[s,i,p]);let y=o?.kind==="at"?o.query:null;d(()=>{if(y===null||!u){D(null);return}let t=!0,e=()=>{u(y).then((r)=>{if(t)D({query:y,search:u,items:r})},(r)=>{if(t)D({query:y,search:u,items:[]}),B(r)})},n=C>0?window.setTimeout(e,C):null;if(n===null)e();return()=>{if(t=!1,n!==null)window.clearTimeout(n)}},[y,u,C,B]);let f=X(()=>{if(o?.kind==="at")return g?.query===o.query&&g.search===u?g.items:[];if(o)return dn(T,o.query);if(s)return dn(T,"");return[]},[o,s,T,g,u]),[tt,q]=v(!1);d(()=>{let t=l.current?.getTextarea();if(!t)return;let e=()=>q(!0),n=()=>{if(q(!1),s)p?.(!1)};return q(document.activeElement===t),t.addEventListener("focus",e),t.addEventListener("blur",n),()=>{t.removeEventListener("focus",e),t.removeEventListener("blur",n)}},[l,s,p]),d(()=>{if(s)l.current?.getTextarea()?.focus()},[s,l]);let c=tt&&(o!==null?o.kind==="slash"||f.length>0||!!E:s);d(()=>{if(!c)return;K.current?.querySelector(`[data-idx="${x}"]`)?.scrollIntoView({block:"nearest"})},[x,c]);function V(t){let e=l.current?.getTextarea();if(!e)return;let n,r;if(o){let S=o.kind==="slash"?`/${t.payload} `:`@${t.label} `;if(n=i.slice(0,o.start)+S+i.slice(o.end),o.kind==="at")_?.(t.payload);r=o.start+S.length}else if(s)n=`${i.length===0||i.endsWith(`
|
|
2
2
|
`)?i:`${i}
|
|
3
3
|
`}/${t.payload} `,r=n.length,p?.(!1);else return;A.textInput.setInput(n),requestAnimationFrame(()=>{e.focus(),e.setSelectionRange(r,r)})}d(()=>{let t=l.current?.getTextarea();if(!t)return;let e=(n)=>{if(!c)return;if(l.current?.isComposing()||n.isComposing||n.keyCode===229)return;if(n.key==="ArrowDown")n.preventDefault(),n.stopPropagation(),h((r)=>f.length===0?0:Math.min(f.length-1,r+1));else if(n.key==="ArrowUp")n.preventDefault(),n.stopPropagation(),h((r)=>Math.max(0,r-1));else if(n.key==="Enter"||n.key==="Tab"){n.preventDefault(),n.stopPropagation();let r=f[x];if(r)V(r)}else if(n.key==="Escape")if(n.preventDefault(),n.stopPropagation(),o)z(Math.max(0,o.start-1)),t.setSelectionRange(o.start,o.start);else p?.(!1)};return t.addEventListener("keydown",e,!0),()=>t.removeEventListener("keydown",e,!0)});let[b,W]=v(null),[N,et]=v(null),I=lt(()=>{let t=a?.current;if(!t)return;let e=t.getBoundingClientRect();W({left:e.left,width:e.width,bottom:window.innerHeight-e.top+8})},[a]);if(J(()=>{if(!c){W(null);return}I()},[c,I]),J(()=>{let t=a?.current;if(!c||!t||!N)return;return ot(t,N,I,{animationFrame:!0})},[c,N,a,I]),!c||a&&!b)return null;let k=o?o.kind==="slash":s,nt=k?rt:st,Q=m("div",{ref:et,className:a?"fixed z-50":"absolute inset-x-0 bottom-full z-50 mb-2",style:a&&b?{left:b.left,width:b.width,bottom:b.bottom}:void 0,children:w("div",{ref:K,role:"listbox",onMouseDown:(t)=>t.preventDefault(),className:"bg-popover text-popover-foreground ring-foreground/10 pointer-events-auto w-full overflow-hidden rounded-lg p-1 shadow-md ring-1 outline-hidden",children:[w("div",{className:"max-h-72 overflow-y-auto",children:[f.length===0&&k&&m("div",{className:"text-muted-foreground px-2 py-3 text-xs",children:R}),f.length===0&&!k&&E&&m("div",{role:"status",className:"text-muted-foreground px-2 py-3 text-xs",children:g?.query===y&&g.search===u?E.empty:E.loading}),f.map((t,e)=>w(Z,{type:"button",variant:"ghost",role:"option","aria-selected":e===x,"data-idx":e,onMouseDown:(n)=>{n.preventDefault(),V(t)},onMouseEnter:()=>h(e),className:G("flex h-auto w-full items-center justify-start gap-2.5 rounded-md px-2.5 py-2 text-start",e===x&&"bg-muted"),children:[m(nt,{className:G("size-4 shrink-0",k?"text-blue-500":"text-muted-foreground")}),m("span",{className:"text-foreground shrink-0 text-sm font-medium",children:t.label}),t.description&&m("span",{className:"text-muted-foreground min-w-0 flex-1 truncate text-xs",children:t.description})]},t.key))]}),k&&M&&w(ct,{children:[m(at,{}),w(Z,{type:"button",variant:"ghost",onMouseDown:(t)=>{t.preventDefault(),p?.(!1),M.open()},className:"h-auto w-full justify-start px-2.5 py-2",children:[m(it,{"data-icon":"inline-start"}),M.label]})]})]})});return a?ut(Q,document.body):Q}
|
|
4
|
-
export{
|
|
4
|
+
export{bo};
|