@alwith/module-chat 0.5.25 → 0.5.26
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/assets/catalogs/alwith/models.json +1 -4
- package/assets/catalogs/custom/models.json +16 -61
- package/assets/catalogs/custom/sources.json +16 -74
- package/assets/catalogs/deepseek/models.json +2 -7
- package/assets/catalogs/openrouter/models.json +6 -22
- package/assets/catalogs/qwen/models.json +5 -19
- package/assets/catalogs/xai/models.json +3 -12
- package/dist/approval/choice-elicitation-form.js +1 -1
- package/dist/approval/url-elicitation-card.js +1 -1
- package/dist/chunk-04kcmpnb.js +2 -0
- package/dist/{chunk-0kvfbr22.js → chunk-13yrk1nh.js} +1 -1
- package/dist/{chunk-7e1wvb6e.js → chunk-1dbc0cfj.js} +1 -1
- package/dist/{chunk-0kb39fpp.js → chunk-2qgz3m2a.js} +1 -1
- package/dist/{chunk-pncx4r2c.js → chunk-2x9mxyxr.js} +1 -1
- package/dist/chunk-3f3y9t21.js +2 -0
- package/dist/{chunk-g93wzhsv.js → chunk-3mfdf7f8.js} +1 -1
- package/dist/{chunk-517bhxvr.js → chunk-3xh0e0ya.js} +1 -1
- package/dist/{chunk-9n2vrkkh.js → chunk-6t98jn94.js} +1 -1
- package/dist/{chunk-f50rww1k.js → chunk-708232f3.js} +1 -1
- package/dist/{chunk-2gg3gcmb.js → chunk-730x182s.js} +1 -1
- package/dist/{chunk-pyznxtyg.js → chunk-7appp9ad.js} +1 -1
- package/dist/{chunk-6wmdpam5.js → chunk-81paw5rb.js} +1 -1
- package/dist/{chunk-9183jr6z.js → chunk-9geb2z3g.js} +2 -2
- package/dist/{chunk-8e5ytb0f.js → chunk-a3tbf7mx.js} +1 -1
- package/dist/{chunk-hq06m42h.js → chunk-a90z5e8w.js} +1 -1
- package/dist/{chunk-ps722b9k.js → chunk-ab0err7k.js} +1 -1
- package/dist/{chunk-96tcqne6.js → chunk-b1rvs016.js} +1 -1
- package/dist/{chunk-n7qcezk8.js → chunk-b6nbarjg.js} +1 -1
- package/dist/{chunk-3k33zp9m.js → chunk-b7z51agd.js} +1 -1
- package/dist/{chunk-b12v22de.js → chunk-btdrvsgy.js} +1 -1
- package/dist/{chunk-ewvb59ye.js → chunk-ch5v5zsw.js} +1 -1
- package/dist/{chunk-tdn5g8xd.js → chunk-d3j5904d.js} +1 -1
- package/dist/{chunk-5r081sme.js → chunk-dwn6bx69.js} +1 -1
- package/dist/{chunk-9zth7avc.js → chunk-e7j7mnmz.js} +1 -1
- package/dist/{chunk-3fm507f7.js → chunk-epq42kf9.js} +1 -1
- package/dist/{chunk-e24jv7zb.js → chunk-fbq107z8.js} +1 -1
- package/dist/{chunk-jamq0frz.js → chunk-gjvpthp9.js} +1 -1
- package/dist/{chunk-gnwa39me.js → chunk-h1f8wgyb.js} +1 -1
- package/dist/{chunk-syhh17rh.js → chunk-hf3t1bxh.js} +1 -1
- package/dist/{chunk-rb0cqdjg.js → chunk-hk66xnxp.js} +1 -1
- package/dist/{chunk-p0s2pg33.js → chunk-hsp0skqs.js} +1 -1
- package/dist/{chunk-kbbq3y2j.js → chunk-htzd730z.js} +1 -1
- package/dist/{chunk-3v3bd582.js → chunk-j2y4wx1h.js} +1 -1
- package/dist/{chunk-pf5655kt.js → chunk-jkbss7sb.js} +1 -1
- package/dist/{chunk-dv4d6mrb.js → chunk-jnc6b9r3.js} +1 -1
- package/dist/{chunk-dx745syv.js → chunk-mahpnk66.js} +1 -1
- package/dist/{chunk-4hwtb6yn.js → chunk-mzpdh336.js} +1 -1
- package/dist/{chunk-1fxadr5w.js → chunk-n432m43g.js} +1 -1
- package/dist/{chunk-9jep8zjg.js → chunk-nh0s0y35.js} +1 -1
- package/dist/{chunk-r4vfytjv.js → chunk-nv3z0brr.js} +1 -1
- package/dist/{chunk-1fr9rhkn.js → chunk-pp2qkwk7.js} +1 -1
- package/dist/{chunk-hswtp9wv.js → chunk-pqphdgp6.js} +1 -1
- package/dist/chunk-pzmeeawh.js +2 -0
- package/dist/chunk-rnrs0cqn.js +2 -0
- package/dist/{chunk-r1as1cra.js → chunk-rp39j6ed.js} +1 -1
- package/dist/{chunk-n5dkkw01.js → chunk-rvh3nbvm.js} +1 -1
- package/dist/chunk-sjg8df4m.js +2 -0
- package/dist/{chunk-b9y436vs.js → chunk-t2z4venp.js} +1 -1
- package/dist/{chunk-kwp1fere.js → chunk-tpwdaz8k.js} +1 -1
- package/dist/{chunk-zp8rq8nh.js → chunk-wgta9nfd.js} +1 -1
- package/dist/chunk-x5swmb1j.js +2 -0
- package/dist/chunk-y1mqx60y.js +2 -0
- 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/composer/menu-radio.js +1 -1
- package/dist/composer/model-select.d.ts +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.d.ts +1 -1
- package/dist/composer/prompt-input.js +1 -1
- package/dist/conversation/action-card.js +1 -1
- package/dist/conversation/composer/composer.js +1 -1
- package/dist/conversation/composer/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/slash-command-button.js +1 -1
- package/dist/conversation/composer/submit-button.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/session-actions.js +1 -1
- package/dist/conversation/subagent-sessions.js +1 -1
- package/dist/image-preview-dialog.js +1 -1
- package/dist/plugins/catalog-skeleton.js +1 -1
- package/dist/plugins/panel-item.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/skill-document.js +1 -1
- package/dist/plugins/skills-tab.js +1 -1
- package/dist/search/chat-search.js +1 -1
- package/dist/search/find-bar.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-store.js +1 -1
- package/dist/session-list/navigation-tabs.js +1 -1
- package/dist/session-list/row-stop-button.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/use-activity-notification.js +1 -1
- package/dist/session-list/use-activity-preview.js +1 -1
- package/dist/session-list/use-project-sessions.js +1 -1
- package/dist/session-timeline/activity-group.js +1 -1
- package/dist/session-timeline/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/resource-content.js +1 -1
- package/dist/session-timeline/session-timeline.js +1 -1
- package/dist/session-timeline/turn-error.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-section.js +1 -1
- package/dist/settings/settings.js +1 -1
- package/package.json +3 -3
- package/rust/permissions/schemas/schema.json +11 -40
- package/dist/chunk-2hzdkgrk.js +0 -2
- package/dist/chunk-33tyec6w.js +0 -2
- package/dist/chunk-e5twctz7.js +0 -2
- package/dist/chunk-k727wnh1.js +0 -2
- package/dist/chunk-pw1pws10.js +0 -2
- package/dist/chunk-qjrgbqhy.js +0 -2
- package/dist/chunk-yyba5e1c.js +0 -2
- /package/dist/{chunk-7p80b5jc.js → chunk-3jwbx8ch.js} +0 -0
- /package/dist/{chunk-kz8zf6y0.js → chunk-a15vdarc.js} +0 -0
- /package/dist/{chunk-z18fvy7d.js → chunk-kpp4v1hs.js} +0 -0
- /package/dist/{chunk-bg0cf6kz.js → chunk-nn72eqzh.js} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{xo}from"./chunk-
|
|
1
|
+
import{xo}from"./chunk-b1rvs016.js";import{n}from"./chunk-zyvvk8b2.js";import{e,g}from"./chunk-k1vkc88d.js";import{B,m,G}from"./chunk-v5mzxjzc.js";import{isBooleanOption as A,isGroupedSelect as Z,isSelectOption as D}from"@nyssance/codex-acp-v2/client";import{Zap as F}from"lucide-react";import{memo as H,useRef as J}from"react";import{jsx as I}from"react/jsx-runtime";function K({sessionId:l,options:p,disabled:x,onModelChange:b,onConfigChange:O,defaultGroup:L={id:"models",name:"Models"},catalog:N=(c)=>c,headerAction:P}){let{host:c,client:k}=e(),{t:i}=c,z=n((o)=>Boolean(o.configPending[l])),M=J({sessionId:l,model:!0}),v=z&&(M.current.sessionId!==l||M.current.model),R=n((o)=>{let r=o.sessions[l];return r?.state==="running"||r?.state==="requires_action"}),t=m(p,"model"),a=m(p,"thought_level"),_=p.filter((o)=>o.configId!=="collaboration_mode"&&(o.category==="model_config"||o.category!=="mode"&&o!==t&&o!==a)),S=_.filter(D),f=_.filter(A);if(!t&&!a&&S.length===0&&f.length===0)return null;let u=(o,r)=>{if(r===o.currentValue)return Promise.resolve();M.current={sessionId:l,model:o===t};let d=O?O(o.configId,r):k.setConfig(l,o.configId,r);return g(c,d),d},h=a?B(a):[],E=h.reduce((o,r)=>r.name.length>=o.length?r.name:o,""),U=t?G(t):i("composer.model"),V=(o)=>({api_id:o.value,label:o.name}),y=N(t&&Z(t.options)?t.options.map((o)=>({id:o.groupId,name:o.name,models:o.options.map(V)})):[{...L,models:t?B(t).map(V):[]}]),w=y.flatMap((o)=>o.models),C=w.find((o)=>o.api_id===t?.currentValue)??{api_id:t?.currentValue??"",label:U},s=f.find((o)=>o.configId==="fast_mode"||o.configId==="fast-mode");return I(xo,{disabled:x||v||R,switching:v,value:{...C,label:C.shortLabel??C.label},compactCatalog:!0,models:w,showModelList:Boolean(t),onChange:(o)=>{if(o.api_id===t?.currentValue)return;if(b)b(o.api_id);else if(t)u(t,o.api_id)},header:{name:t?.name??i("composer.model"),action:P},modelGroups:y,t:i,effortConfig:a&&h.length>0?{name:"Effort",value:a.currentValue,levels:h,sizer:E,onChange:(o)=>u(a,o)}:void 0,selectOptions:S.map((o)=>({id:o.configId,name:o.name,value:o.currentValue,options:B(o).map((r)=>({value:r.value,label:r.name})),onChange:(r)=>u(o,r)})),booleanOptions:[{id:"fast_mode",name:i("composer.fastMode"),currentValue:s?.currentValue??!1,disabled:!s,title:!s?i("composer.fastModeUnsupported"):void 0,icon:I(F,{className:"size-4","aria-hidden":"true"})},...f.filter((o)=>o!==s).map((o)=>({id:o.configId,name:o.name,currentValue:o.currentValue}))],onBooleanChange:(o,r)=>{let d=o==="fast_mode"?s:f.find((q)=>q.configId===o);if(!d)throw Error(`Unknown boolean config: ${o}`);u(d,r)}})}var Ht=H(K);
|
|
2
2
|
export{Ht};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Vo}from"./chunk-n8yww1mr.js";import{we,t,ke,n,rt}from"./chunk-zyvvk8b2.js";import{Ci,nt,kn,Si,_i}from"./chunk-qn2jfxff.js";import{ot}from"./chunk-gha517v4.js";import{Wo}from"./chunk-r4vfytjv.js";import{Pi}from"./chunk-vr0dfq9w.js";import{di,ui}from"./chunk-ef99py8a.js";import{Di,Hi}from"./chunk-qqqcqvrv.js";import{ti}from"./chunk-h09ez7fc.js";import{Ti}from"./chunk-f7ggbprz.js";import{ri}from"./chunk-9jep8zjg.js";import{Button as Q}from"@nyssance/shadcn/vega/components/ui/button";import{codexExtensionCapabilities as Ce,codexMessageError as Me,codexRetryNotice as ze,codexTurnError as Ve,nativeTurnId as fe}from"@nyssance/codex-acp-v2/client";import{ArrowDownIcon as Be}from"lucide-react";import{useCallback as z,useEffect as E,useLayoutEffect as pe,useMemo as J,useRef as h,useState as U}from"react";import{flushSync as ge}from"react-dom";import{jsx as o,jsxs as A}from"react/jsx-runtime";var ve=24;function qe(e){let d=Math.max(0,e.turnTopPx-ve),g=Math.max(0,e.scrollHeightPx-e.viewportHeightPx),s=d-g;return{scrollTopPx:d,spacerPx:s>0?e.spacerPx+s:e.spacerPx}}function Oe({viewportRef:e,viewportProps:d,children:g}){return o("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 Fe({sessionId:e,turnId:d,root:g,error:s,connected:R}){let L=h(null),b=ke(),{t:H}=t(),w=z(()=>{b.loadHistoryTurn(e,d).catch(()=>{})},[b,e,d]);return E(()=>{if(!g||!L.current||!R||s)return;let V=new IntersectionObserver((v)=>{if(v.some((S)=>S.isIntersecting))V.disconnect(),w()},{root:g,rootMargin:"800px 0px"});return V.observe(L.current),()=>V.disconnect()},[g,R,s,w]),o("div",{ref:L,className:"flex min-h-80 flex-col justify-center gap-3 py-8","data-history-turn":d,"data-markdown-pending":!0,children:s?A("div",{className:"flex flex-col items-center gap-2",children:[o("p",{role:"alert",className:"text-destructive text-xs",children:s}),o(Q,{variant:"outline",size:"sm",onClick:w,disabled:!R,children:H("timeline.navigationRetry")})]}):A("div",{role:"status","aria-label":H("timeline.navigationLoading"),className:"space-y-3",children:[o("div",{className:"bg-muted ml-auto h-5 w-1/3 rounded"}),o("div",{className:"bg-muted h-3 w-4/5 rounded"}),o("div",{className:"bg-muted h-3 w-3/5 rounded"})]})})}function Ke(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:Ci(e,g.current,d)};let R=s.current.turns;return g.current=R,R}function Je(e){return o(we,{host:e.host,client:e.client,children:o(Ue,{...e})})}function Ue({session:e,leading:d,afterTurn:g,answerActions:s,turnFooter:R,renderUserMessage:L,insert:b,navigation:H,anchorNewTurn:w=!1,Viewport:V=Oe}){let v=ke(),S=t(),T=n((r)=>r.historyNavigation[e.id]),c=Ke(e,T?.turns),C=c.at(-1)?.key,Te=Si(e,c),y=e.state==="running"||e.state==="requires_action",_=J(()=>Pi(c,T),[c,T]),Y=J(()=>_.flatMap((r)=>r.turn===void 0?[]:[{...r.turn,key:r.turnKey}]),[_]),ye=J(()=>H===void 0?[]:di(c,e.turnUsage,T),[H,c,e.turnUsage,T]),Z=b&&b.afterItemId!==null?c.findIndex((r)=>r.items.some((l)=>l.id===b.afterItemId)):-1,D=h(c);D.current=c;let[a,xe]=U(null),x=n((r)=>r.historyPages[e.id]),P=n((r)=>r.connection==="ready"),he=n((r)=>Ce(r.agent).sessionRetry),ee=x!==void 0;E(()=>{if(P&&ee&&!e.restoring)v.loadHistoryNavigation(e.id).catch(()=>{})},[v,P,ee,e.id,e.restoring]);let[be,Re]=U(!1),O=h(null),[Se,te]=U(!1),ne=h(0),j=h({key:C,running:y});j.current={key:C,running:y};let[re,F]=U(0),N=h(0),k=h(null);N.current=re;let Pe=z(()=>{if(k.current!==null)k.current.keepTop=!1},[]),{isFollowing:M,scrollToBottom:W,stopFollowing:B,schedulePin:ie,contentResized:oe,beginLocate:ae,cancelLocation:le}=Ti(a,y,Pe),ue=z(()=>{if(a===null||!y)return;let r=c.at(-1)?.key;if(r===void 0)return;let l=ae(!0),u=()=>l.isCurrent()&&j.current.running&&j.current.key===r,i=()=>requestAnimationFrame(()=>requestAnimationFrame(()=>{if(!u())return;let p=a.querySelector(`[data-codex-turn="${CSS.escape(r)}"]`);if(p===null)return;let m=a.scrollTop+p.getBoundingClientRect().top-a.getBoundingClientRect().top,I=qe({turnTopPx:m,scrollHeightPx:a.scrollHeight,viewportHeightPx:a.clientHeight,spacerPx:N.current});k.current=I.spacerPx>0?{element:p,heightPx:p.getBoundingClientRect().height+I.spacerPx,keepTop:!0}:null,ge(()=>F(I.spacerPx)),requestAnimationFrame(()=>{if(u())l.finish(I.scrollTopPx)})})),f=O.current;if(f===null)return;f.scrollToKey(r,void 0,{align:"top"}).then(()=>{if(u())i()})},[ae,y,a,c]);pe(()=>{if(!w||y)return;le(),k.current=null,N.current=0,F(0)},[w,le,y]);let X=z(()=>{B(),v.loadOlderHistory(e.id).catch(()=>{})},[v,e.id,B]);E(()=>{if(a===null)return;let r=()=>{let l=a.scrollTop<600;if(Re(l),l&&!T?.complete&&P&&!e.restoring&&!M&&x?.cursor&&!x.loading&&!x.error)X()};return r(),a.addEventListener("scroll",r,{passive:!0}),()=>a.removeEventListener("scroll",r)},[P,x,M,X,a,e.restoring,T?.complete]),E(()=>{Di({sessionId:e.id,turns:Y,api:O.current,beforeReveal:B,terminals:e.terminals})},[e.id,e.terminals,Y,B]),E(()=>()=>Hi(e.id),[e.id]);let Ie=z(async(r,l)=>{let u=++ne.current;te(!0);try{if(r.isLoaded===!1&&r.nativeTurnId!==void 0)await v.loadHistoryTurn(e.id,r.nativeTurnId),await new Promise((m)=>requestAnimationFrame(()=>m()));if(!l())return null;let i=D.current.find((m)=>m.user?.id===(r.messageId??r.id))??D.current.find((m)=>m.user!==null&&r.nativeTurnId!==void 0&&m.items.some((I)=>fe(I)===r.nativeTurnId));if(!i?.user)return null;let f=i.user.id,p=O.current;if(p===null)throw Error("Virtual timeline is not mounted");return await p.scrollToKey(i.key,(m)=>m.querySelector(`[data-content-search-unit-key="${CSS.escape(f)}"]`),{align:"top"}),document.querySelector(`[data-chat-scroll] [data-content-search-unit-key="${CSS.escape(f)}"]`)}finally{if(ne.current===u)te(!1)}},[v,e.id]),He=z(async(r)=>{if(r.nativeTurnId!==void 0)await v.previewHistoryTurn(e.id,r.nativeTurnId)},[v,e.id]);E(()=>{if(a===null)return;let r=a.querySelector("[data-codex-timeline]");if(r===null)throw Error("Timeline content element is missing");let l=new ResizeObserver(()=>{let u=k.current,i=null;if(u!==null){let f=Math.max(0,u.heightPx-u.element.getBoundingClientRect().height);if(f!==N.current&&(f<N.current||u.keepTop)){if(N.current=f,ge(()=>F(f)),f===0)k.current=null}if(f>0&&u.keepTop)i=a.scrollTop+u.element.getBoundingClientRect().top-a.getBoundingClientRect().top-ve}oe(i)});if(l.observe(r),l.observe(a),C!==void 0){let u=a.querySelector(`[data-codex-turn="${CSS.escape(C)}"]`);if(u===null)throw Error("Latest turn is not mounted");l.observe(u)}return()=>l.disconnect()},[oe,C,a]),E(()=>{if(e.items.length===0)return;ie()},[ie,e.items]);let se=h(null);pe(()=>{if(a===null)return;let r=c.at(-1),l=se.current;if(se.current=r===void 0?null:{key:r.key,running:y},r===void 0||l===null||r.user===null||r.replayed)return;if(w){if(y&&e.turnEndedAt[r.user.id]===void 0&&(r.key!==l.key||!l.running))k.current=null,N.current=0,F(0),ue()}else if(r.key!==l.key)W()},[ue,w,y,W,a,e.turnEndedAt,c]);let Ne=(r,l)=>{let u=r,i=u.turn;if(i===void 0){if(u.nativeTurnId===void 0)throw Error(`Turn is missing at index ${l}`);return o(Fe,{sessionId:e.id,turnId:u.nativeTurnId,root:a,error:T?.turnErrors[u.nativeTurnId],connected:P&&!M&&!Se})}let f=c.indexOf(i),p=i.key===Te,m=_i(e,c,f),I=!p&&m.continued,K=i.key===C,q=i.errors.at(-1),ce=q===void 0?null:Me(q),G=q===void 0?null:fe(q),Ee=!e.subagent&&K&&!p&&P&&he&&e.attached&&!e.readOnly&&!e.restoring&&q===e.items.at(-1)&&ce!==null&&Ve(ce).category==="overloaded"&&G!==null&&e.lastStopReason!=="end_turn"&&e.lastStopReason!=="cancelled",de=R?.(i)??null,Ae=i.work.length>0||i.final.length>0||i.errors.length>0||p||de!==null||nt(i)||kn(i)||K&&(e.error!==null||e.lastStopReason==="cancelled"),me=i.user===null?null:ot(i);return A("div",{"data-virtualized-turn-content":!0,"data-codex-turn":i.key,className:"flex flex-col gap-1.5",children:[i.user!==null&&(L===void 0?o(ri,{item:i.user,messageTime:me}):L(i.user,me)),Ae&&o(Wo,{sessionId:e.id,turn:i,terminals:e.terminals,active:p,blocked:e.state==="requires_action",continued:I,edits:m.edits,activityItems:m.items,workStartedAt:m.startedAt,isLast:K,error:e.error,retrying:p?ze(e._meta)??void 0:void 0,retry:Ee?{turnId:G,delaySeconds:ti(c),run:(Le)=>v.retrySession(e.id,G,Le)}:void 0,interrupted:kn(i)||!p&&K&&e.lastStopReason==="cancelled",answerActions:s?.(i),footer:de}),l===Z&&b?.node,g?.(i)]})};return A("div",{className:"relative flex min-h-0 flex-1 flex-col","data-stream-style":"codexUI",children:[o(V,{viewportRef:xe,viewportProps:{"data-chat-scroll":"",style:{overflowAnchor:"none"},tabIndex:0,role:"log","aria-label":S.t("timeline.label")},children:o("div",{className:"codex-timeline-content flex min-h-full w-full flex-col",children:A("div",{"data-timeline-user-message-navigation-content":!0,className:"mx-auto flex w-full max-w-3xl shrink-0 flex-col",children:[b&&Z===-1&&b.node,o(Vo,{ref:O,entries:_,renderTurn:Ne,scrollElement:a,sessionKey:e.id,preserveViewport:!M,leadingInsetPx:12,leadingContent:d===void 0?void 0:o("div",{className:"pt-3",children:d})}),w&&o("div",{"aria-hidden":"true","data-turn-anchor-spacer":!0,className:"shrink-0",style:{height:re}}),o("div",{"aria-hidden":"true",className:"h-6 shrink-0"})]})})}),o("div",{"aria-hidden":"true",className:"codex-timeline-bottom-fade"}),T?.error&&o("div",{className:"absolute inset-x-0 top-2 z-10 flex justify-center",children:o(Q,{variant:"outline",size:"sm",disabled:!P,title:T.error,onClick:()=>{v.loadHistoryNavigation(e.id).catch(()=>{})},children:S.t("timeline.navigationRetry")})}),be&&x?.cursor&&!T?.complete&&A("div",{className:"absolute inset-x-0 top-2 z-10 flex flex-col items-center gap-1","data-history-loader":!0,children:[o(Q,{variant:"outline",size:"sm",disabled:!P||e.restoring||x.loading,onClick:X,children:x.loading?S.t("timeline.loadingEarlier"):S.t("timeline.loadEarlier")}),x.error&&o("p",{role:"alert",className:"bg-background text-destructive max-w-md rounded px-2 py-1 text-xs",children:x.error})]}),H!==void 0&&o(ui,{items:ye,audio:H.audio,scrollRoot:a,beforeReveal:B,ensureItemMounted:Ie,onPreviewItem:He,onRevealError:(r)=>rt(S,r),targetTopMarginPx:16},e.id),o("button",{type:"button",className:M?"codex-scroll-to-bottom codex-scroll-to-bottom-hidden":"codex-scroll-to-bottom",tabIndex:M?-1:void 0,onClick:W,"aria-label":S.t("timeline.scrollToBottom"),children:y?A("span",{className:"codex-scroll-to-bottom-dots","aria-hidden":"true",children:[o("span",{className:"codex-wave-dot"}),o("span",{className:"codex-wave-dot"}),o("span",{className:"codex-wave-dot"})]}):o(Be,{})})]})}
|
|
1
|
+
import{Vo}from"./chunk-n8yww1mr.js";import{we,t,ke,n,rt}from"./chunk-zyvvk8b2.js";import{Ci,nt,kn,Si,_i}from"./chunk-qn2jfxff.js";import{ot}from"./chunk-gha517v4.js";import{Wo}from"./chunk-nv3z0brr.js";import{Pi}from"./chunk-vr0dfq9w.js";import{di,ui}from"./chunk-ef99py8a.js";import{Di,Hi}from"./chunk-qqqcqvrv.js";import{ti}from"./chunk-h09ez7fc.js";import{Ti}from"./chunk-f7ggbprz.js";import{ri}from"./chunk-nh0s0y35.js";import{codexExtensionCapabilities as Ce,codexMessageError as Me,codexRetryNotice as ze,codexTurnError as Ve,nativeTurnId as fe}from"@nyssance/codex-acp-v2/client";import{ArrowDownIcon as Be}from"lucide-react";import{useCallback as z,useEffect as E,useLayoutEffect as pe,useMemo as J,useRef as h,useState as U}from"react";import{flushSync as ge}from"react-dom";import{Button as Q}from"@nyssance/shadcn/vega/components/ui/button";import{jsx as o,jsxs as A}from"react/jsx-runtime";var ve=24;function qe(e){let d=Math.max(0,e.turnTopPx-ve),g=Math.max(0,e.scrollHeightPx-e.viewportHeightPx),s=d-g;return{scrollTopPx:d,spacerPx:s>0?e.spacerPx+s:e.spacerPx}}function Oe({viewportRef:e,viewportProps:d,children:g}){return o("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 Fe({sessionId:e,turnId:d,root:g,error:s,connected:R}){let L=h(null),b=ke(),{t:H}=t(),w=z(()=>{b.loadHistoryTurn(e,d).catch(()=>{})},[b,e,d]);return E(()=>{if(!g||!L.current||!R||s)return;let V=new IntersectionObserver((v)=>{if(v.some((S)=>S.isIntersecting))V.disconnect(),w()},{root:g,rootMargin:"800px 0px"});return V.observe(L.current),()=>V.disconnect()},[g,R,s,w]),o("div",{ref:L,className:"flex min-h-80 flex-col justify-center gap-3 py-8","data-history-turn":d,"data-markdown-pending":!0,children:s?A("div",{className:"flex flex-col items-center gap-2",children:[o("p",{role:"alert",className:"text-destructive text-xs",children:s}),o(Q,{variant:"outline",size:"sm",onClick:w,disabled:!R,children:H("timeline.navigationRetry")})]}):A("div",{role:"status","aria-label":H("timeline.navigationLoading"),className:"space-y-3",children:[o("div",{className:"bg-muted ml-auto h-5 w-1/3 rounded"}),o("div",{className:"bg-muted h-3 w-4/5 rounded"}),o("div",{className:"bg-muted h-3 w-3/5 rounded"})]})})}function Ke(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:Ci(e,g.current,d)};let R=s.current.turns;return g.current=R,R}function Je(e){return o(we,{host:e.host,client:e.client,children:o(Ue,{...e})})}function Ue({session:e,leading:d,afterTurn:g,answerActions:s,turnFooter:R,renderUserMessage:L,insert:b,navigation:H,anchorNewTurn:w=!1,Viewport:V=Oe}){let v=ke(),S=t(),T=n((r)=>r.historyNavigation[e.id]),c=Ke(e,T?.turns),C=c.at(-1)?.key,Te=Si(e,c),y=e.state==="running"||e.state==="requires_action",_=J(()=>Pi(c,T),[c,T]),Y=J(()=>_.flatMap((r)=>r.turn===void 0?[]:[{...r.turn,key:r.turnKey}]),[_]),ye=J(()=>H===void 0?[]:di(c,e.turnUsage,T),[H,c,e.turnUsage,T]),Z=b&&b.afterItemId!==null?c.findIndex((r)=>r.items.some((l)=>l.id===b.afterItemId)):-1,D=h(c);D.current=c;let[a,xe]=U(null),x=n((r)=>r.historyPages[e.id]),P=n((r)=>r.connection==="ready"),he=n((r)=>Ce(r.agent).sessionRetry),ee=x!==void 0;E(()=>{if(P&&ee&&!e.restoring)v.loadHistoryNavigation(e.id).catch(()=>{})},[v,P,ee,e.id,e.restoring]);let[be,Re]=U(!1),O=h(null),[Se,te]=U(!1),ne=h(0),j=h({key:C,running:y});j.current={key:C,running:y};let[re,F]=U(0),N=h(0),k=h(null);N.current=re;let Pe=z(()=>{if(k.current!==null)k.current.keepTop=!1},[]),{isFollowing:M,scrollToBottom:W,stopFollowing:B,schedulePin:ie,contentResized:oe,beginLocate:ae,cancelLocation:le}=Ti(a,y,Pe),ue=z(()=>{if(a===null||!y)return;let r=c.at(-1)?.key;if(r===void 0)return;let l=ae(!0),u=()=>l.isCurrent()&&j.current.running&&j.current.key===r,i=()=>requestAnimationFrame(()=>requestAnimationFrame(()=>{if(!u())return;let p=a.querySelector(`[data-codex-turn="${CSS.escape(r)}"]`);if(p===null)return;let m=a.scrollTop+p.getBoundingClientRect().top-a.getBoundingClientRect().top,I=qe({turnTopPx:m,scrollHeightPx:a.scrollHeight,viewportHeightPx:a.clientHeight,spacerPx:N.current});k.current=I.spacerPx>0?{element:p,heightPx:p.getBoundingClientRect().height+I.spacerPx,keepTop:!0}:null,ge(()=>F(I.spacerPx)),requestAnimationFrame(()=>{if(u())l.finish(I.scrollTopPx)})})),f=O.current;if(f===null)return;f.scrollToKey(r,void 0,{align:"top"}).then(()=>{if(u())i()})},[ae,y,a,c]);pe(()=>{if(!w||y)return;le(),k.current=null,N.current=0,F(0)},[w,le,y]);let X=z(()=>{B(),v.loadOlderHistory(e.id).catch(()=>{})},[v,e.id,B]);E(()=>{if(a===null)return;let r=()=>{let l=a.scrollTop<600;if(Re(l),l&&!T?.complete&&P&&!e.restoring&&!M&&x?.cursor&&!x.loading&&!x.error)X()};return r(),a.addEventListener("scroll",r,{passive:!0}),()=>a.removeEventListener("scroll",r)},[P,x,M,X,a,e.restoring,T?.complete]),E(()=>{Di({sessionId:e.id,turns:Y,api:O.current,beforeReveal:B,terminals:e.terminals})},[e.id,e.terminals,Y,B]),E(()=>()=>Hi(e.id),[e.id]);let Ie=z(async(r,l)=>{let u=++ne.current;te(!0);try{if(r.isLoaded===!1&&r.nativeTurnId!==void 0)await v.loadHistoryTurn(e.id,r.nativeTurnId),await new Promise((m)=>requestAnimationFrame(()=>m()));if(!l())return null;let i=D.current.find((m)=>m.user?.id===(r.messageId??r.id))??D.current.find((m)=>m.user!==null&&r.nativeTurnId!==void 0&&m.items.some((I)=>fe(I)===r.nativeTurnId));if(!i?.user)return null;let f=i.user.id,p=O.current;if(p===null)throw Error("Virtual timeline is not mounted");return await p.scrollToKey(i.key,(m)=>m.querySelector(`[data-content-search-unit-key="${CSS.escape(f)}"]`),{align:"top"}),document.querySelector(`[data-chat-scroll] [data-content-search-unit-key="${CSS.escape(f)}"]`)}finally{if(ne.current===u)te(!1)}},[v,e.id]),He=z(async(r)=>{if(r.nativeTurnId!==void 0)await v.previewHistoryTurn(e.id,r.nativeTurnId)},[v,e.id]);E(()=>{if(a===null)return;let r=a.querySelector("[data-codex-timeline]");if(r===null)throw Error("Timeline content element is missing");let l=new ResizeObserver(()=>{let u=k.current,i=null;if(u!==null){let f=Math.max(0,u.heightPx-u.element.getBoundingClientRect().height);if(f!==N.current&&(f<N.current||u.keepTop)){if(N.current=f,ge(()=>F(f)),f===0)k.current=null}if(f>0&&u.keepTop)i=a.scrollTop+u.element.getBoundingClientRect().top-a.getBoundingClientRect().top-ve}oe(i)});if(l.observe(r),l.observe(a),C!==void 0){let u=a.querySelector(`[data-codex-turn="${CSS.escape(C)}"]`);if(u===null)throw Error("Latest turn is not mounted");l.observe(u)}return()=>l.disconnect()},[oe,C,a]),E(()=>{if(e.items.length===0)return;ie()},[ie,e.items]);let se=h(null);pe(()=>{if(a===null)return;let r=c.at(-1),l=se.current;if(se.current=r===void 0?null:{key:r.key,running:y},r===void 0||l===null||r.user===null||r.replayed)return;if(w){if(y&&e.turnEndedAt[r.user.id]===void 0&&(r.key!==l.key||!l.running))k.current=null,N.current=0,F(0),ue()}else if(r.key!==l.key)W()},[ue,w,y,W,a,e.turnEndedAt,c]);let Ne=(r,l)=>{let u=r,i=u.turn;if(i===void 0){if(u.nativeTurnId===void 0)throw Error(`Turn is missing at index ${l}`);return o(Fe,{sessionId:e.id,turnId:u.nativeTurnId,root:a,error:T?.turnErrors[u.nativeTurnId],connected:P&&!M&&!Se})}let f=c.indexOf(i),p=i.key===Te,m=_i(e,c,f),I=!p&&m.continued,K=i.key===C,q=i.errors.at(-1),ce=q===void 0?null:Me(q),G=q===void 0?null:fe(q),Ee=!e.subagent&&K&&!p&&P&&he&&e.attached&&!e.readOnly&&!e.restoring&&q===e.items.at(-1)&&ce!==null&&Ve(ce).category==="overloaded"&&G!==null&&e.lastStopReason!=="end_turn"&&e.lastStopReason!=="cancelled",de=R?.(i)??null,Ae=i.work.length>0||i.final.length>0||i.errors.length>0||p||de!==null||nt(i)||kn(i)||K&&(e.error!==null||e.lastStopReason==="cancelled"),me=i.user===null?null:ot(i);return A("div",{"data-virtualized-turn-content":!0,"data-codex-turn":i.key,className:"flex flex-col gap-1.5",children:[i.user!==null&&(L===void 0?o(ri,{item:i.user,messageTime:me}):L(i.user,me)),Ae&&o(Wo,{sessionId:e.id,turn:i,terminals:e.terminals,active:p,blocked:e.state==="requires_action",continued:I,edits:m.edits,activityItems:m.items,workStartedAt:m.startedAt,isLast:K,error:e.error,retrying:p?ze(e._meta)??void 0:void 0,retry:Ee?{turnId:G,delaySeconds:ti(c),run:(Le)=>v.retrySession(e.id,G,Le)}:void 0,interrupted:kn(i)||!p&&K&&e.lastStopReason==="cancelled",answerActions:s?.(i),footer:de}),l===Z&&b?.node,g?.(i)]})};return A("div",{className:"relative flex min-h-0 flex-1 flex-col","data-stream-style":"codexUI",children:[o(V,{viewportRef:xe,viewportProps:{"data-chat-scroll":"",style:{overflowAnchor:"none"},tabIndex:0,role:"log","aria-label":S.t("timeline.label")},children:o("div",{className:"codex-timeline-content flex min-h-full w-full flex-col",children:A("div",{"data-timeline-user-message-navigation-content":!0,className:"mx-auto flex w-full max-w-3xl shrink-0 flex-col",children:[b&&Z===-1&&b.node,o(Vo,{ref:O,entries:_,renderTurn:Ne,scrollElement:a,sessionKey:e.id,preserveViewport:!M,leadingInsetPx:12,leadingContent:d===void 0?void 0:o("div",{className:"pt-3",children:d})}),w&&o("div",{"aria-hidden":"true","data-turn-anchor-spacer":!0,className:"shrink-0",style:{height:re}}),o("div",{"aria-hidden":"true",className:"h-6 shrink-0"})]})})}),o("div",{"aria-hidden":"true",className:"codex-timeline-bottom-fade"}),T?.error&&o("div",{className:"absolute inset-x-0 top-2 z-10 flex justify-center",children:o(Q,{variant:"outline",size:"sm",disabled:!P,title:T.error,onClick:()=>{v.loadHistoryNavigation(e.id).catch(()=>{})},children:S.t("timeline.navigationRetry")})}),be&&x?.cursor&&!T?.complete&&A("div",{className:"absolute inset-x-0 top-2 z-10 flex flex-col items-center gap-1","data-history-loader":!0,children:[o(Q,{variant:"outline",size:"sm",disabled:!P||e.restoring||x.loading,onClick:X,children:x.loading?S.t("timeline.loadingEarlier"):S.t("timeline.loadEarlier")}),x.error&&o("p",{role:"alert",className:"bg-background text-destructive max-w-md rounded px-2 py-1 text-xs",children:x.error})]}),H!==void 0&&o(ui,{items:ye,audio:H.audio,scrollRoot:a,beforeReveal:B,ensureItemMounted:Ie,onPreviewItem:He,onRevealError:(r)=>rt(S,r),targetTopMarginPx:16},e.id),o("button",{type:"button",className:M?"codex-scroll-to-bottom codex-scroll-to-bottom-hidden":"codex-scroll-to-bottom",tabIndex:M?-1:void 0,onClick:W,"aria-label":S.t("timeline.scrollToBottom"),children:y?A("span",{className:"codex-scroll-to-bottom-dots","aria-hidden":"true",children:[o("span",{className:"codex-wave-dot"}),o("span",{className:"codex-wave-dot"}),o("span",{className:"codex-wave-dot"})]}):o(Be,{})})]})}
|
|
2
2
|
export{Je};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{C}from"./chunk-heyqzkxq.js";import{s,u}from"./chunk-
|
|
1
|
+
import{C}from"./chunk-heyqzkxq.js";import{s,u}from"./chunk-3f3y9t21.js";import{_,p}from"./chunk-py0zbgaj.js";import{GlobeIcon as b,LogOutIcon as x}from"lucide-react";import{useState as M}from"react";import{Avatar as A,AvatarFallback as N,AvatarImage as y}from"@nyssance/shadcn/vega/components/ui/avatar";import{DropdownMenu as h,DropdownMenuContent as S,DropdownMenuGroup as c,DropdownMenuItem as L,DropdownMenuLabel as P,DropdownMenuRadioGroup as I,DropdownMenuRadioItem as O,DropdownMenuSeparator as d,DropdownMenuSub as G,DropdownMenuSubContent as k,DropdownMenuSubTrigger as R,DropdownMenuTrigger as T}from"@nyssance/shadcn/vega/components/ui/dropdown-menu";import{jsx as o,jsxs as n}from"react/jsx-runtime";function fr(e){return o(c,{...e})}function hr(e){return o(d,{...e})}function oo({className:e,...r}){return o(L,{className:["h-[var(--navigation-row-height,30px)] py-0 [&_svg]:text-muted-foreground",e].filter(Boolean).join(" "),...r})}function vr({languages:e,value:r,onChange:i}){let a=s();return n(G,{children:[n(R,{className:"h-[var(--navigation-row-height,30px)] py-0",children:[o(b,{className:"text-muted-foreground"}),a.t("sessionList.language")]}),o(k,{children:o(I,{value:r,onValueChange:(t)=>void u(a,Promise.resolve(i(t))),children:e.map((t)=>o(O,{value:t.code,children:t.label},t.code))})})]})}function yr({user:e,children:r,onSignOut:i,busy:a=!1}){let t=s(),{t:w}=t,[m,v]=M(!1),[D,l]=M(!1);C(m);let g=a||D,f=n(A,{className:"size-[18px] after:border-0",children:[o(y,{src:e.avatar??void 0,alt:""}),o(N,{className:"bg-primary text-primary-foreground text-xs",children:[...e.name].slice(0,2).join("").toLocaleUpperCase()})]});return n(h,{open:m,onOpenChange:v,children:[n(T,{render:o(p,{disabled:g,className:"text-muted-foreground hover:bg-foreground/8 data-popup-open:bg-foreground/5 font-normal"}),children:[o(_,{children:f}),o("span",{className:"min-w-0 truncate",children:e.name})]}),n(S,{side:"top",align:"start",sideOffset:8,className:"w-[calc(var(--anchor-width)+36px)]",children:[n(c,{children:[n(P,{className:"text-popover-foreground flex items-center gap-2 px-2 py-2 text-sm font-medium",children:[f,n("span",{className:"min-w-0 flex-1",children:[o("span",{className:"block truncate",children:e.name}),o("span",{className:"text-muted-foreground mt-0.5 block truncate text-xs font-normal",children:e.email})]})]}),o(d,{})]}),r,r!=null&&o(d,{}),o(c,{children:n(oo,{disabled:g,onClick:()=>{l(!0),u(t,i()).finally(()=>l(!1))},children:[o(x,{}),w("sessionList.signOut")]})})]})]})}
|
|
2
2
|
export{fr,hr,oo,vr,yr};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{M}from"./chunk-667z0pac.js";import{he}from"./chunk-py0zbgaj.js";import{x,J}from"./chunk-
|
|
1
|
+
import{M}from"./chunk-667z0pac.js";import{he}from"./chunk-py0zbgaj.js";import{x,J}from"./chunk-tpwdaz8k.js";import{N,K}from"./chunk-22tg663v.js";import{de,X}from"./chunk-g9gktxv9.js";import{cn as S}from"cn";import{BoxIcon as U,ChevronRightIcon as E,PlusIcon as z,StarIcon as u}from"lucide-react";import{useState as d}from"react";import{Button as y}from"@nyssance/shadcn/vega/components/ui/button";import{DropdownMenu as L,DropdownMenuContent as j,DropdownMenuGroup as k,DropdownMenuItem as O,DropdownMenuRadioGroup as _,DropdownMenuRadioItem as q,DropdownMenuSeparator as Q,DropdownMenuTrigger as V}from"@nyssance/shadcn/vega/components/ui/dropdown-menu";import{Input as W}from"@nyssance/shadcn/vega/components/ui/input";import{jsx as e,jsxs as a}from"react/jsx-runtime";function qn({sessionId:l,trigger:f,favorite:n=!1,hoverBackground:R=n?"none":void 0,allowRemove:B=!0,submenu:g=!1,className:A,onOpenChange:T}){let{t}=x(),c=X(),H=J(),P=he(),{collections:s,order:C}=de(),i=C.find((o)=>s[o].sessionIds.includes(l)),[F,G]=d(!1),[w,D]=d(!1),[m,b]=d(""),[r,h]=d(!1),v=(o)=>{if(G(o),P(o),T?.(o),!o)D(!1),b("")},p=(o)=>{h(!0),H(o.then(()=>{v(!1)}).finally(()=>h(!1)))};return a(L,{modal:!1,open:F,onOpenChange:(o,I)=>{if(!o&&w&&I.reason==="trigger-hover"){I.cancel();return}v(o)},children:[e(V,{disabled:r,"data-hover-background":R,openOnHover:n||g,"aria-label":t(n&&i!==void 0?"collection.removeFromAll":"collection.addTo"),onMouseDown:(o)=>{if(n)o.preventBaseUIHandler()},onClick:(o)=>{if(!n)return;o.preventBaseUIHandler(),p(c({type:"favorite",sessionId:l}))},render:f??e(y,{variant:"ghost",size:"icon-sm",className:A,"aria-label":t(n&&i!==void 0?"collection.removeFromAll":"collection.addTo"),children:e(u,{className:S(i!==void 0&&"fill-current")})})}),a(j,{className:"w-56 font-normal",side:g?"inline-end":"bottom",align:g?"start":"end",sideOffset:4,children:[e(k,{children:e(_,{value:i??null,children:C.map((o)=>a(q,{value:o,disabled:r||i===o,closeOnClick:!1,onClick:()=>p(c({type:"add",collectionId:o,sessionId:l})),children:[o===N?e(u,{}):s[o].emoji?e("span",{className:"flex size-4 shrink-0 items-center justify-center text-sm","aria-hidden":"true",children:s[o].emoji}):e(U,{}),e("span",{className:"min-w-0 flex-1 truncate",children:K(s[o],t)})]},o))})}),e(Q,{}),a(k,{children:[a(O,{disabled:r,closeOnClick:!1,onClick:()=>D(!0),children:[e(z,{}),t("collection.newCollection")]}),B&&i!==void 0&&a(O,{disabled:r,closeOnClick:!1,onClick:()=>p(c({type:"remove",sessionId:l})),children:[e(u,{}),t("collection.removeFromAll")]})]}),w&&a("form",{className:"flex items-center gap-1 px-2 py-1.5",onSubmit:(o)=>{if(o.preventDefault(),o.stopPropagation(),!m.trim()||r)return;p(c({type:"create",id:`collection-${crypto.randomUUID()}`,name:m,sessionId:l}))},children:[e(W,{autoFocus:!0,"aria-label":t("collection.collectionName"),placeholder:t("collection.collectionName"),value:m,disabled:r,onChange:(o)=>b(o.target.value),onKeyDown:(o)=>o.stopPropagation(),className:"h-7 min-w-0"}),e(y,{size:"xs",type:"submit",disabled:r||!m.trim(),children:t("collection.confirm")})]})]})]})}function er({sessionId:l,allowRemove:f=!0}){let{t:n}=x();return e(qn,{sessionId:l,allowRemove:f,submenu:!0,trigger:e(M,{icon:e(u,{}),label:n("collection.addTo"),trailing:e(E,{className:"rtl:rotate-180"})})})}
|
|
2
2
|
export{qn,er};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n}from"./chunk-zyvvk8b2.js";import{Je}from"./chunk-
|
|
1
|
+
import{n}from"./chunk-zyvvk8b2.js";import{Je}from"./chunk-gjvpthp9.js";import{e,g}from"./chunk-k1vkc88d.js";import{Loader2Icon as h}from"lucide-react";import{Button as v}from"@nyssance/shadcn/vega/components/ui/button";import{Empty as p,EmptyDescription as c,EmptyHeader as l,EmptyTitle as d}from"@nyssance/shadcn/vega/components/ui/empty";import{jsx as o,jsxs as r}from"react/jsx-runtime";function Wt({session:t,timeline:y}){let{host:m,client:s}=e(),{t:i}=m,f=n((E)=>E.historyPages[t.id]?.cursor!=null),u=()=>g(m,s.open(t.id,t.cwd)),a=o(Je,{...y,session:t,client:s,host:m});if(t.restoring)return t.items.length===0?r("div",{className:"text-muted-foreground flex flex-1 items-center justify-center gap-2 text-sm",children:[o(h,{className:"size-4 animate-spin","aria-hidden":"true"}),i("conversation.restoring")]}):a;if(!t.attached&&t.items.length===0)return r(p,{className:"flex-1",children:[r(l,{children:[o(d,{children:i("conversation.reopen")}),o(c,{children:i("conversation.detached")})]}),o(v,{onClick:u,children:i("conversation.reopen")})]});if(t.items.length===0&&t.state==="idle"&&!f)return o(p,{className:"flex-1",children:r(l,{children:[o(d,{className:"text-[28px] font-normal",children:i("conversation.welcomeTitle")}),o(c,{className:"truncate font-mono",children:t.cwd})]})});return a}
|
|
2
2
|
export{Wt};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{yo}from"./chunk-6rgyckw8.js";import{
|
|
1
|
+
import{yo}from"./chunk-6rgyckw8.js";import{cn as v}from"cn";import{XIcon as E}from"lucide-react";import{useCallback as p,useEffect as D,useMemo as X,useRef as N,useState as b}from"react";import{Dialog as _,DialogClose as L,DialogContent as j,DialogTitle as A}from"@nyssance/shadcn/vega/components/ui/dialog";import{jsx as i,jsxs as F}from"react/jsx-runtime";function ho({open:l,onOpenChange:y,url:h,filename:M,scale:d,onScaleChange:f,containerRef:z,containerClassName:H,dialogContentClassName:P,imageClassName:T}){let g=p((e)=>Math.min(4,Math.max(0.25,e)),[]),[I,O]=b(1),o=g(d??I),R=N(null),s=z??R,S=N(null),[m,x]=b({width:0,height:0}),[C,W]=b({width:0,height:0}),w=p((e)=>{let n=g(e);if(typeof f==="function"){f(n);return}O(n)},[f,g]);D(()=>{if(!l)return;if(!h)return;if(typeof d==="number")return;O(1)},[l,h,d]),D(()=>{if(!l)return;let e=s.current;if(!e)return;let n=()=>{x({width:e.clientWidth,height:e.clientHeight})};n();let t=new ResizeObserver(n);return t.observe(e),()=>{t.disconnect()}},[s,l]);let Z=p(()=>{w(1)},[w]),r=X(()=>{let{width:e,height:n}=C,{width:t,height:a}=m;if(e===0||n===0)return{width:0,height:0};if(t===0||a===0)return{width:0,height:0};let c=Math.min(t/e,a/n,1),u=e*c,k=n*c;return{width:u*o,height:k*o}},[o,C,m]);if(!h)return null;return i(_,{open:l,onOpenChange:y,children:F(j,{className:v("top-1/2 left-1/2 h-[90vh] max-h-[90vh] w-[90vw]! max-w-[90vw]! -translate-x-1/2 -translate-y-1/2 gap-0 rounded-none bg-transparent p-0 ring-0 sm:w-[90vw]! sm:max-w-[90vw]!",P),showCloseButton:!1,children:[i(A,{className:"sr-only",children:M||"Image preview"}),i(L,{"aria-label":"Close",className:"absolute top-3 right-3 z-10 flex size-10 items-center justify-center rounded-full bg-black/55 text-white backdrop-blur-sm transition-colors hover:bg-black/75",children:i(E,{className:"size-5"})}),i("div",{ref:s,onWheel:(e)=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();let n=e.deltaY>0?o-0.2:o+0.2,t=g(Number.parseFloat(n.toFixed(2)));if(t===o)return;let a=s.current,c=S.current,u=a&&c?yo({container:a,target:c,clientX:e.clientX,clientY:e.clientY,currentScale:o,nextScale:t}):null;if(w(t),a&&u)requestAnimationFrame(()=>{a.scrollTo(u)})},className:v("h-full w-full scrollbar-thin overflow-auto",H),children:i("div",{className:"grid min-h-full min-w-full place-items-center",style:{width:Math.max(m.width,r.width),height:Math.max(m.height,r.height)},children:i("div",{className:"shrink-0",children:i("img",{alt:M||"image preview",className:v("block object-contain select-none",T),decoding:"async",draggable:!1,ref:S,onDoubleClick:Z,onLoad:(e)=>{let n=e.currentTarget;W({width:n.naturalWidth,height:n.naturalHeight});let t=s.current;if(t&&(t.clientWidth||t.clientHeight))x({width:t.clientWidth,height:t.clientHeight})},style:{imageRendering:"auto",width:r.width||void 0,height:r.height||void 0,maxWidth:r.width?"none":"90vw",maxHeight:r.height?"none":"90vh"},src:h})})})})]})})}
|
|
2
2
|
export{ho};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e}from"./chunk-k1vkc88d.js";import{be}from"./chunk-
|
|
1
|
+
import{e}from"./chunk-k1vkc88d.js";import{be}from"./chunk-pp2qkwk7.js";import{Ae}from"./chunk-qn4zvgc9.js";import{vt}from"./chunk-3jwbx8ch.js";import{format as f}from"date-fns";import{useState as y}from"react";import{Button as x}from"@nyssance/shadcn/vega/components/ui/button";import{Skeleton as m}from"@nyssance/shadcn/vega/components/ui/skeleton";import{jsx as t,jsxs as u,Fragment as h}from"react/jsx-runtime";function ft({label:o,window:a,t:l}){let n=a?100-Math.round(Math.min(100,Math.max(0,a.usedPercent))):0,i=a&&a.resetsAt!==null?l("usage.resetsAt",{time:f(new Date(a.resetsAt*1000),"yyyy/MM/dd HH:mm")}):null;return u("div",{className:"space-y-1.5","aria-busy":!a,children:[u("div",{className:"grid min-h-5 grid-cols-[3.5rem_minmax(0,1fr)_5rem] items-center gap-3",children:[a?t("span",{className:"text-sm",children:o}):t(m,{className:"h-4 w-10 motion-reduce:animate-none"}),a?t("div",{className:"bg-muted h-2 overflow-hidden rounded-full",role:"progressbar","aria-label":o,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,children:t("div",{className:"bg-primary h-full rounded-full",style:{width:`${n}%`}})}):t(m,{className:"h-2 rounded-full motion-reduce:animate-none"}),a?t("span",{className:"text-muted-foreground text-end text-xs tabular-nums",children:l("usage.remaining",{percent:n})}):t(m,{className:"h-4 w-14 justify-self-end motion-reduce:animate-none"})]}),t("div",{className:"text-muted-foreground flex min-h-4 items-center justify-end text-xs",children:a?i:t(m,{className:"h-3 w-32 motion-reduce:animate-none"})})]})}function Vn({account:o,disabled:a,onSignOut:l}){let{t:n}=e().host,i=o===void 0,r=o?.account.account??null,c=o===null?n("usage.accountUnavailable"):r===null?n("usage.notSignedIn"):r.type==="chatgpt"?[r.email,r.planType!=="unknown"?n(`usage.plan.${r.planType}`):null].filter(Boolean).join(" · "):r.type==="apiKey"?n("usage.apiKey"):n("usage.bedrock"),s=o?.rateLimits??null;return u("section",{"aria-busy":i,"aria-label":"Codex",className:"space-y-4",children:[u("div",{className:"flex min-h-8 items-center justify-between gap-4",children:[i?t(m,{className:"h-4 w-40 max-w-[65%] motion-reduce:animate-none"}):t("span",{className:"min-w-0 text-sm break-words",children:c}),i?t(m,{className:"h-8 w-16 shrink-0 motion-reduce:animate-none"}):r!==null&&t(x,{variant:"outline",size:"sm",className:"shrink-0",disabled:a,onClick:l,children:n("connection.signOut")})]}),(i||r!==null)&&t("div",{className:"flex flex-col gap-4",children:i?t(ft,{t:n}):s===null?t("span",{className:"text-muted-foreground text-sm",children:n("usage.unavailable")}):u(h,{children:[s.primary!==null&&t(ft,{label:Ae(s.primary,n),window:s.primary,t:n}),s.secondary!==null&&t(ft,{label:Ae(s.secondary,n),window:s.secondary,t:n}),s.primary===null&&s.secondary===null&&t("span",{className:"text-muted-foreground text-sm",children:n("usage.unavailable")})]})})]})}function ht({bridge:o,className:a="rounded-xl border p-4"}){let{host:l}=e(),n=o.useSettingsAgent(),i=o.useSettingsAccount(),[r,c]=y(!1);return u("div",{className:a,children:[t(Vn,{account:i,disabled:n==null||r,onSignOut:()=>{c(!0),o.requestSignOut().catch((s)=>l.reportError?.(s)).finally(()=>c(!1))}}),i!=null&&!i.account.account&&n&&t(vt,{methods:n.authMethods,signIn:o.requestSignIn}),n?.actions.map((s)=>t(be,{action:s,onRespond:(d,p)=>{o.requestActionResponse(d,p).catch((g)=>l.reportError?.(g))}},s.id))]})}
|
|
2
2
|
export{ft,Vn,ht};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Do}from"./chunk-
|
|
1
|
+
import{Do}from"./chunk-epq42kf9.js";import{e,g}from"./chunk-k1vkc88d.js";import{B,m}from"./chunk-v5mzxjzc.js";import{createLucideIcon as w,HandIcon as y,ShieldAlertIcon as S,ShieldCheckIcon as a}from"lucide-react";import{memo as O}from"react";import{jsx as t}from"react/jsx-runtime";var b=w("ApprovalShield",[["path",{d:"M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11",key:"shield"}],["path",{d:"m8 8 3 3-3 3M13 15h3",key:"terminal"}]]),d={"read-only":y,"workspace-write":a,agent:b,"agent-full-access":S},A={"read-only":"readOnly","workspace-write":"workspaceAccess",agent:"agent","agent-full-access":"fullAccess"};function N({sessionId:u,options:f,disabled:h,onConfigChange:c}){let{host:l,client:M}=e(),{t:r}=l,s=m(f,"mode");if(!s)return null;let o=s.currentValue,p=B(s).map((n)=>{let i=A[n.value];return i?{...n,name:r(`permissionModes.${i}.name`),description:r(`permissionModes.${i}.description`)}:n}),I=p.find((n)=>n.value===o),C=d[o]??a,v=(n)=>{if(n===o)return;g(l,c?c(s.configId,n):M.setConfig(u,s.configId,n))};return t(Do,{value:o,warning:o==="agent-full-access",currentName:I?.name??o,icon:t(C,{className:"size-3.5 shrink-0"}),header:r("permissionModes.heading"),disabled:h,label:r("composer.switchPermissionMode"),onValueChange:v,options:p.map((n)=>{let i=d[n.value]??a,k=n.value==="agent-full-access";return{value:n.value,label:t("span",{"data-permission-warning":k?"":void 0,children:n.name}),description:n.description?t("span",{className:"whitespace-normal",children:n.description}):void 0,icon:t(i,{className:"size-3.5 shrink-0"})}})})}var Kt=O(N);
|
|
2
2
|
export{Kt};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{S}from"./chunk-rezwwmw7.js";import{t}from"./chunk-zyvvk8b2.js";import{Z}from"./chunk-
|
|
1
|
+
import{S}from"./chunk-rezwwmw7.js";import{t}from"./chunk-zyvvk8b2.js";import{Z}from"./chunk-b6nbarjg.js";import{ContentBlock as i}from"@agentclientprotocol/sdk/experimental/v2/unstable";import{isEmbeddedResource as m,isResourceLink as u}from"@nyssance/codex-acp-v2/client";import{jsx as n}from"react/jsx-runtime";function d({block:e,streaming:o}){let r=t();if(i.isText(e)){if(e.text.length===0)return null;return n("div",{className:"codex-assistant-message",children:n(S,{text:e.text,streaming:o})})}if(i.isImage(e))return n(Z,{block:e,generated:!0});if(i.isAudio(e))return n("audio",{controls:!0,src:`data:${e.mimeType};base64,${e.data}`});if(u(e)||m(e))return n(Z,{block:e,generated:!0});return n("div",{className:"text-muted-foreground",children:r.t("timeline.unsupportedContent",{type:e.type})})}function Ce({content:e,messageId:o,streaming:r}){return e.map((s,a)=>n(d,{block:s,streaming:r},`${o}:${a}`))}
|
|
2
2
|
export{Ce};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Ri}from"./chunk-
|
|
1
|
+
import{Ri}from"./chunk-sjg8df4m.js";import{Li,it}from"./chunk-2apyrry0.js";import{Button as et}from"@nyssance/shadcn/vega/components/ui/button";import{cn as rt}from"cn";import{LoaderCircleIcon as nt,SearchIcon as ot}from"lucide-react";import{useCallback as _,useEffect as f,useMemo as J,useRef as b,useState as v}from"react";import{jsx as H,jsxs as q,Fragment as st}from"react/jsx-runtime";var V="chat-search",W="chat-search-current",X=150;function fa(o){let r=o??"";return[...document.querySelectorAll("[data-chat-scroll]")].find((l)=>l.dataset.chatScroll===r)??null}var lt=12;function Rr(o,r="center"){let l=o.closest("[data-chat-scroll]");if(!l)return;let g=o.getBoundingClientRect(),y=l.getBoundingClientRect(),m=r==="start"?lt:(l.clientHeight-g.height)/2;l.scrollTo({top:l.scrollTop+(g.top-y.top)-m,behavior:"smooth"})}function P(o){let r=o.startContainer.parentElement;if(!r)return;Rr(r)}var M=new Map;function Y(){if(typeof CSS>"u"||!("highlights"in CSS)||typeof Highlight>"u")return;if(M.size===0){CSS.highlights.delete(V),CSS.highlights.delete(W);return}let o=[...M.values()];CSS.highlights.set(V,new Highlight(...o.flatMap((r)=>r.all))),CSS.highlights.set(W,new Highlight(...o.flatMap((r)=>r.current?[r.current]:[])))}function ct(){let o=Symbol();return{clearHighlights:()=>{M.delete(o),Y()},applyHighlights:(r,l)=>{M.set(o,{all:r,current:l}),Y()}}}function Ei({getViewport:o,findSourceMatches:r,revealTurn:l,prepareSource:g,subscribeOpen:y,labels:m,placement:K="header"}){let{clearHighlights:s,applyHighlights:p}=J(ct,[]),S=r!==void 0,[c,R]=v(!1),[i,O]=v(""),[z,T]=v(!1),[D,L]=v(null),G=i.trim().length>0;f(()=>{if(!c||!G||g===void 0){T(!1),L(null);return}let e=new AbortController;return T(!0),L(null),g(e.signal).catch((t)=>{if(!e.signal.aborted)L(t instanceof Error?t.message:String(t))}).finally(()=>{if(!e.signal.aborted)T(!1)}),()=>e.abort()},[G,c,g]);let u=J(()=>c&&i.trim()&&r?r(i.trim()):[],[r,c,i]),[F,I]=v(0),[Z,E]=v(0),C=b([]),x=b(0),a=b(null),Q=b(null),U=b(null);f(()=>{if(!y)return;return y(()=>{R(!0);let t=U.current;if(t!==null)t.focus({preventScroll:!0}),t.select()})},[y]);let A=_(async(e,t)=>{let n=u[e];if(n===void 0)return;let h=o();if(h===null)throw Error("Chat scroll container is missing");if(l)await l(n.turnKey,t);if(t.aborted)return;let d=h.querySelector(`[data-turn-key="${CSS.escape(n.turnKey)}"]`);if(d===null)throw Error(`Codex turn is missing: ${n.turnKey}`);if(await Li(d,t),t.aborted)return;if(!l)Rr(d,"start");if(await new Promise((tt)=>requestAnimationFrame(()=>tt())),t.aborted)return;let N=it(d,i.trim());C.current=N;let B=N[n.occurrenceInTurn];if(p(N,B??null),B!==void 0)P(B)},[p,u,o,i,l]),k=b(A);f(()=>{k.current=A},[A]);let w=_(()=>{R(!1),O(""),x.current=0,a.current?.abort(),a.current=null,s(),C.current=[]},[s]);f(()=>{if(!c)return;let e=(t)=>{if(t.key==="Escape"&&Q.current?.contains(document.activeElement))t.preventDefault(),w()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[c,w]),f(()=>{if(!c||!i.trim()){s(),C.current=[],I(0),E(0),x.current=0;return}let e=setTimeout(()=>{if(S)return;let t=o();if(!t)return;let n=it(t,i);if(C.current=n,I(n.length),E(0),p(n,n[0]??null),n[0])P(n[0])},X);return()=>{clearTimeout(e),s()}},[p,s,S,c,i,o]),f(()=>{if(!c||!S||!i.trim())return;let e=new AbortController;a.current?.abort(),a.current=e;let t=setTimeout(()=>{C.current=[],x.current=0,I(u.length),E(0),s(),k.current(0,e.signal)},X);return()=>{if(e.abort(),a.current===e)a.current=null;clearTimeout(t),s()}},[s,u.length,S,c,i]),f(()=>()=>{a.current?.abort(),s()},[s]),f(()=>{if(!c)s()},[s,c]);let j=_((e)=>{if(S){if(u.length===0)return;let n=(x.current+(e?-1:1)+u.length)%u.length;x.current=n,E(n),a.current?.abort();let h=new AbortController;a.current=h,k.current(n,h.signal);return}let t=C.current;if(!t.length)return;E((n)=>{let h=(n+(e?-1:1)+t.length)%t.length,d=t[h];return p(t,d),P(d),h})},[p,u.length,S]);return q(st,{children:[K==="header"&&H(et,{variant:"ghost",size:"icon-sm",title:m.search,onClick:()=>c?w():R(!0),children:H(ot,{})}),c&&q("div",{"data-chat-search":!0,"aria-busy":z||void 0,ref:Q,className:rt("bg-background border-b",K==="body"?"relative shrink-0":"absolute inset-x-0 top-full z-30"),children:[H(Ri,{ref:U,value:i,onChange:O,onFind:j,onClose:w,placeholder:m.placeholder,prevTitle:m.previous,nextTitle:m.next}),i.trim()&&q("div",{className:"text-muted-foreground border-border border-t px-3 py-1 text-[11px]",children:[z?H(nt,{"aria-hidden":"true",className:"size-3 animate-spin"}):F===0?"0 / 0":`${Z+1} / ${F}`,D!==null&&H("span",{role:"alert",children:D})]})]})]})}
|
|
2
2
|
export{fa,Rr,Ei};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r,o}from"./chunk-
|
|
1
|
+
import{r,o}from"./chunk-3f3y9t21.js";import{latestAssistantReply as v}from"@nyssance/codex-acp-v2/client";import{useEffect as S,useState as g}from"react";function Nt(e,s){let a=r(),c=o((t)=>t.connection),i=o((t)=>Boolean(t.sessions[e]?.attached)&&!t.sessions[e]?.restoring),u=o((t)=>v(t.sessions[e]?.items)),f=o((t)=>Boolean(t.runStates[e]?.reusableDraft)),[p,y]=g();return S(()=>{if(c!=="ready"||f||i)return;let t=!1,l,n=0,m=async()=>{try{let d=await a.activityReply(e);if(n=0,!t)y(d??void 0)}catch{n++}finally{if(!t&&(s==="running"||n>0&&n<3))l=setTimeout(()=>void m(),5000)}};return m(),()=>{t=!0,clearTimeout(l)}},[a,e,c,f,i,s]),i?u:p??u}
|
|
2
2
|
export{Nt};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{k,Tn,Ii,Zt,Ni,In,Mi}from"./chunk-sdf73s05.js";import{t,ke,Q,n}from"./chunk-zyvvk8b2.js";import{Ce}from"./chunk-
|
|
1
|
+
import{k,Tn,Ii,Zt,Ni,In,Mi}from"./chunk-sdf73s05.js";import{t,ke,Q,n}from"./chunk-zyvvk8b2.js";import{Ce}from"./chunk-jkbss7sb.js";import{createStore as M}from"@alwith/api/client";import{isText as A,nativeTurnId as b}from"@nyssance/codex-acp-v2/client";import{jsx as y}from"react/jsx-runtime";var v=M({entries:{}});function p(r,e){v.setState((s)=>({entries:{...s.entries,[r]:e}}))}function x(r,e){let s=b(e),a=r.items.findLast((i)=>b(i)!==null);return!e.replayed&&s!==null&&a!==void 0&&b(a)===s}function O(r,e){for(let s of r.items){if(s.kind!=="user"||s.echo==="pending")continue;for(let a of[...In(s._meta),...s.content.filter(A).flatMap((i)=>In(i._meta))])if(a.questionItemId===e)return a.answer}return}function R({sessionId:r,item:e,question:s,index:a}){let i=ke(),{t:l}=t(),m=Tn(e.id,a),c=JSON.stringify([r,m]),u=Q(v,(o)=>o.entries[c]),d=n((o)=>o.sessions[r]),h=n((o)=>o.connection==="ready"),f=u?.draft??Ii(s),q=d===void 0?u?.accepted:O(d,m)??u?.accepted,D=d!==void 0&&x(d,e),C=!d?.subagent&&h&&d?.attached&&!d.restoring&&!d.readOnly,g=q!==void 0?"answered":u?.skipped?"skipped":u?.pending?"submitting":!D?"closed":!C?"unavailable":"pending",E=async()=>{if(v.getState().entries[c]?.pending||g!=="pending")return;let o=i.state.sessions[r];if(o===void 0||!x(o,e)||!o.attached||o.readOnly||o.restoring)return;let S=Zt(s,f);if(!S.trim())return;let w={questionItemId:m,question:s.title,answer:S};p(c,{draft:f,pending:!0});try{await i.prompt(r,[{type:"text",text:Ni(w),_meta:{codex:{questionReply:w}}}]),p(c,{draft:f,accepted:S})}catch(I){p(c,{draft:f,error:I instanceof Error?I.message:String(I)})}};if(g==="closed")return null;return y(Mi,{question:s,draft:f,status:g,answer:q,error:g==="pending"?u?.error:void 0,t:l,onChange:(o)=>p(c,{draft:o}),onSkip:()=>p(c,{draft:f,skipped:!0}),onSubmit:()=>{E()}})}function Pn({sessionId:r,item:e}){let s=n((i)=>i.sessions[r]),a=k(e._meta);if(s===void 0||s.subagent!==void 0||s.readOnly||!x(s,e))return y(Ce,{content:e.content.some((i)=>!A(i)||i.text.trim().length>0)?e.content:a.map((i)=>({type:"text",text:i.title})),messageId:e.id,streaming:!1});return y("div",{className:"flex min-w-0 flex-col gap-3","data-async-questions":e.id,children:a.map((i,l)=>y(R,{sessionId:r,item:e,question:i,index:l},Tn(e.id,l)))})}
|
|
2
2
|
export{Pn};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{s,r,At,o,u}from"./chunk-
|
|
1
|
+
import{s,r,At,o,u}from"./chunk-3f3y9t21.js";import{M}from"./chunk-667z0pac.js";import{ve}from"./chunk-py0zbgaj.js";import{ge}from"./chunk-y1mqx60y.js";import{Ve,ue}from"./chunk-pzmeeawh.js";import{hasRename as F}from"@nyssance/codex-acp-v2/client";import{ArchiveIcon as D,ArchiveRestoreIcon as x,GitForkIcon as A,PencilIcon as H,Trash2Icon as N}from"lucide-react";import{useRef as R,useState as y}from"react";import{jsx as n,jsxs as b,Fragment as C}from"react/jsx-runtime";function nn({sessionRow:e,active:v,onSelect:f,onForked:S=f,onHoverCardOpenChange:c,actions:l}){let a=s(),{t:p,i18n:k}=a,h=r(),d=o((t)=>t.runStates[e.sessionId]),I=At(),m=()=>f(e);return n(ve,{"data-session-id":e.sessionId,role:"button",tabIndex:0,active:v,onClick:m,onKeyDown:(t)=>{if(t.key==="Enter"||t.key===" ")t.preventDefault(),m()},state:d?.state,interruption:d?.interruption??null,title:e.title??p("sessionList.untitled"),onHoverCardOpenChange:c,hoverCard:n(B,{sessionRow:e,onDelete:()=>I(e),onForked:S,actions:l}),meta:e.updatedAt!==null?n("span",{className:"text-muted-foreground shrink-0 text-xs",children:Ve(e.updatedAt,k.language)}):void 0,actions:d!=null?n(ge,{title:p("sessionList.stop"),onStop:()=>u(a,h.stopSession(e.sessionId))}):void 0})}function B({sessionRow:e,onDelete:v,onForked:f,actions:S}){let c=s(),{t:l}=c,a=r(),p=o((i)=>F(i.agent)),k=o((i)=>i.connection==="ready"&&i.agent?.capabilities?.session?.fork!=null),[h,d]=y(!1),[I,m]=y(!1),t=R(!1);return n(ue,{sessionRow:e,renaming:h,onRename:(i)=>{if(d(!1),i!==null)u(c,a.renameSession(e.sessionId,i))},actions:b(C,{children:[p&&n(M,{icon:n(H,{}),label:l("sessionList.rename"),onClick:()=>d(!0)}),S,e.archived?n(M,{icon:n(x,{}),label:l("sessionList.unarchive"),onClick:()=>void u(c,a.unarchive(e.sessionId))}):b(C,{children:[n(M,{icon:n(A,{}),label:l("sessionList.fork"),disabled:!k||I,onClick:()=>{if(t.current)return;t.current=!0,m(!0),u(c,a.fork(e.sessionId,e.cwd).then((i)=>{let g=a.state.sessionList.find((L)=>L.sessionId===i);if(!g)throw Error("Forked chat is missing from the session list");f(g)}).finally(()=>{t.current=!1,m(!1)}))}}),n(M,{icon:n(D,{}),label:l("sessionList.archive"),onClick:()=>void u(c,a.archive(e.sessionId))})]}),n(M,{variant:"destructive",icon:n(N,{}),label:l("sessionList.delete"),onClick:v})]})})}
|
|
2
2
|
export{nn};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ai}from"./chunk-46phvpzh.js";import{t}from"./chunk-zyvvk8b2.js";import{li,ci}from"./chunk-4qp43adx.js";import{Z}from"./chunk-
|
|
1
|
+
import{ai}from"./chunk-46phvpzh.js";import{t}from"./chunk-zyvvk8b2.js";import{li,ci}from"./chunk-4qp43adx.js";import{Z}from"./chunk-b6nbarjg.js";import{ie}from"./chunk-qn2jfxff.js";import{isEmbeddedResource as g,isImage as d,isResourceLink as f,isText as x}from"@nyssance/codex-acp-v2/client";import{memo as p}from"react";import{jsx as r,jsxs as h}from"react/jsx-runtime";var ri=p(function({item:s,messageTime:c}){let l=t(),o=ci(s._meta),m=o?o.map((e)=>e.question===void 0?e.text:`${e.question}
|
|
2
2
|
${e.text}`).join(`
|
|
3
3
|
`):ie(s),a=s.content.filter(d),i=s.content.filter((e)=>f(e)||g(e)),u=o??s.content.filter(x).map((e)=>{let n=li(e._meta);return n?{question:n.question,text:n.answer}:{text:e.text}});if(m.length===0&&a.length===0&&i.length===0)return null;return h("div",{className:"group/codex-user flex min-w-0 flex-col items-end gap-2","data-content-search-unit-key":s.id,children:[i.length>0&&r("div",{className:"codex-user-mentions",children:i.map((e,n)=>r(Z,{block:e},`${s.id}:${n}`))}),r(ai,{host:l,message:s,text:m,textParts:u.some((e)=>("question"in e))?u:void 0,images:a,mentions:[],messageTime:c})]})});
|
|
4
4
|
export{ri};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{gn,fn}from"./chunk-h9m4z5dk.js";import{k}from"./chunk-sdf73s05.js";import{Nn}from"./chunk-8zrfdjy4.js";import{t}from"./chunk-zyvvk8b2.js";import{bi,ie,nt,wi}from"./chunk-qn2jfxff.js";import{vn}from"./chunk-
|
|
1
|
+
import{gn,fn}from"./chunk-h9m4z5dk.js";import{k}from"./chunk-sdf73s05.js";import{Nn}from"./chunk-8zrfdjy4.js";import{t}from"./chunk-zyvvk8b2.js";import{bi,ie,nt,wi}from"./chunk-qn2jfxff.js";import{vn}from"./chunk-wgta9nfd.js";import{Ce}from"./chunk-jkbss7sb.js";import{Pn}from"./chunk-mzpdh336.js";import{Qo}from"./chunk-3p9g44yz.js";import{ni}from"./chunk-wsbh4n9e.js";import{oi}from"./chunk-77cd8tev.js";import{Sn,_n}from"./chunk-730x182s.js";import{ot}from"./chunk-gha517v4.js";import{codexMessageError as z,codexTurnError as J,isContentEntry as oe,isEmbeddedResource as q,isImage as X,isResourceLink as ae,isText as me,nativeTurnId as le}from"@nyssance/codex-acp-v2/client";import{LoaderCircleIcon as de,SparklesIcon as ce}from"lucide-react";import{Fragment as ge,memo as ue,useEffect as pe,useState as fe}from"react";import{jsx as s,jsxs as m,Fragment as E}from"react/jsx-runtime";function U(i){if(X(i))return`${i.mimeType.toLowerCase()}:${i.data}`;if(q(i)&&"blob"in i.resource&&i.resource.mimeType?.toLowerCase().startsWith("image/"))return`${i.resource.mimeType.toLowerCase()}:${i.resource.blob}`;return null}function ye({item:i}){let{t:n}=t(),l=i.status==="in_progress",[o,c]=fe(()=>Date.now()-i.at>=1e4);return pe(()=>{if(!l)return;let a=Math.max(0,i.at+1e4-Date.now());if(c(a===0),a===0)return;let f=setTimeout(()=>c(!0),a);return()=>clearTimeout(f)},[i.id,i.at,l]),m("div",{className:"codex-context-compaction",children:[s(ce,{"aria-hidden":"true"}),s("span",{children:i.status==="completed"?n("stream.codex.contextCompacted"):i.status==="cancelled"?n("timeline.interrupted"):n(o?"timeline.compactingWithDelayNotice":"timeline.compacting")})]})}function N({sessionId:i,entry:n,terminals:l,streaming:o,streamingThoughtId:c}){let{t:a}=t();switch(n.kind){case"activity":return s(vn,{sessionId:i,items:n.items,terminals:l,streamingThoughtId:c});case"text":return k(n.item._meta).length>0?s(Pn,{sessionId:i,item:n.item}):s(Ce,{content:n.item.content,messageId:n.item.id,streaming:o});case"plan":return s(ni,{plan:n.item.plan});case"compaction":if(n.item.status==="failed")return m(Sn,{children:[s("div",{children:a("timeline.compactionFailed")}),n.item.error!==null&&s("div",{children:n.item.error})]});return s(ye,{item:n.item})}}function he({sessionId:i,turn:n,terminals:l,active:o,blocked:c=!1,continued:a=!1,edits:f=n.edits,activityItems:M=n.items,workStartedAt:Y=n.startedAt,isLast:W,error:y,interrupted:F,retry:L,retrying:u,answerActions:K,footer:Z}){let{t:d}=t(),C=n.errors.map((e)=>{let r=z(e);if(r===null)throw Error("Turn error item is missing its diagnostics");let v=L?.turnId===le(e)?L:void 0;return s(_n,{error:r,retry:v},`${e.id}:${v?.delaySeconds??"manual"}`)});if(W&&y!==null&&!n.errors.some((e)=>{let r=z(e);return r!==null&&r.stopReason===y.stopReason&&J(r).message===J(y).message}))C.push(s(_n,{error:y},"current-run-error"));let h=C.length>0?s("div",{className:"codex-turn-errors",children:C}):null,A=n.items.filter(Nn);if(A.length>0&&A.length===n.items.length)return m(E,{children:[s(vn,{sessionId:i,items:A,terminals:l,streamingThoughtId:null}),h]});let x=n.work,T=x.length>0&&x.every((e)=>e.kind==="compaction");if(bi(n)||T&&n.final.length===0)return m(E,{children:[s("div",{role:"status",className:"text-muted-foreground flex min-w-0 flex-col gap-2 py-2 text-sm",children:n.work.map((e)=>s(N,{sessionId:i,entry:e,terminals:l,streaming:!1,streamingThoughtId:null},e.key))}),h]});let O=nt(n),P=n.final.filter((e)=>k(e._meta).length===0).map(ie).join(`
|
|
2
2
|
`),w=o?null:ot(n,"assistant"),D=n.items.filter((e)=>e.kind==="tool"&&e.name==="image_generation"&&(e.status==="pending"||e.status==="in_progress")),G=new Set(n.final.flatMap((e)=>e.content.map(U).filter((r)=>r!==null))),b=n.items.flatMap((e)=>{if(e.kind!=="tool"||e.status!=="completed")return[];return e.content.filter(oe).flatMap((r,v)=>{let g=r.content,se=e.name==="image_generation"&&X(g),re=e.toolKind!=="read"&&e.toolKind!=="search"&&(ae(g)||q(g)&&("blob"in g.resource));if(!se&&!re)return[];let _=U(g);if(_!==null){if(G.has(_))return[];G.add(_)}return[{key:`${e.id}:${v}`,block:g}]})}),R=n.final.some((e)=>k(e._meta).length===0&&e.content.some((r)=>!me(r)||r.text.trim().length>0)),ee=D.length>0||b.length>0||T||R||n.final.some((e)=>k(e._meta).length>0),I=n.items.findIndex((e)=>n.final.includes(e)),S=(e)=>n.items.indexOf(e.kind==="activity"?e.items[0]:e.item),B=x.filter((e)=>I===-1||S(e)<I),te=x.filter((e)=>I!==-1&&S(e)>I),ne=[...n.final.map((e)=>({kind:"answer",item:e,index:n.items.indexOf(e)})),...te.map((e)=>({kind:"work",entry:e,index:S(e)}))].toSorted((e,r)=>e.index-r.index),H=!o&&!a&&(P.trim().length>0?s(gn,{text:P,isMostRecentTurn:W,time:w,afterCopy:K}):m("div",{className:"flex items-center gap-0.5",children:[K,w&&s("span",{className:"codex-user-time ms-1",title:w.full,children:w.short})]})),p=oi({...n,items:M},{running:o,blocked:c,retrying:u!==void 0}),Q=p.kind==="reasoning"?p.ownerKey??null:null,V=p.kind==="thinking",j=wi({...n,items:M});return m(E,{children:[s(fn,{stateKey:JSON.stringify([i,n.replayed?"history":"live",n.key]),active:o&&!R,defaultExpanded:o&&!R||!n.replayed&&(F||O),...j,startedAt:j.startedAt??Y,loading:(V||p.kind==="working")&&n.work.length===0,loadingLabel:p.kind==="working"?d("stream.codex.working"):void 0,work:a||T?[]:B.map((e)=>s(N,{sessionId:i,entry:e,terminals:l,streaming:o,streamingThoughtId:Q},e.key)),answer:ee||a?m("div",{className:"flex min-w-0 flex-col gap-3",children:[(a||T)&&B.map((e)=>s(N,{sessionId:i,entry:e,terminals:l,streaming:!1,streamingThoughtId:null},e.key)),ne.map((e)=>{if(e.kind==="work")return s(N,{sessionId:i,entry:e.entry,terminals:l,streaming:o,streamingThoughtId:Q},e.entry.key);let r=e.item;return m(ge,{children:[k(r._meta).length>0?s(Pn,{sessionId:i,item:r}):s(Ce,{content:r.content,messageId:r.id,streaming:o}),r===n.final.at(-1)&&H]},r.id)}),D.map((e)=>m("div",{className:"codex-image-generation",role:"status","aria-label":d(o?"timeline.imageGenerating":"timeline.imageStopped"),"aria-busy":o,children:[s("div",{className:"codex-image-generation-texture","aria-hidden":"true"}),m("span",{className:"codex-image-generation-status",children:[o&&s(de,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),d(o?"timeline.imageGenerating":"timeline.imageStopped")]})]},e.id)),b.length>0&&s("div",{className:"codex-reply-artifacts flex min-w-0 flex-col gap-3",children:b.map((e)=>s(Ce,{content:[e.block],messageId:e.key,streaming:!1},e.key))}),n.final.length===0&&H]}):null,footer:m(E,{children:[V&&n.work.length>0&&s("div",{className:"codex-pending-message py-2",role:"status",children:s("span",{className:"codex-activity-running",children:d("message.thinking")})}),Z,f.length>0&&!o&&!a&&s(Qo,{items:f}),F&&!O&&s("div",{className:"codex-interrupted-turn",role:"status",children:d("timeline.interrupted")}),!o&&h]})}),o&&u!==void 0&&s("div",{className:"text-muted-foreground py-2 text-sm",role:"status",children:u.capacity?(()=>{let e=/Reconnecting(?:\.\.\.)?\s+(\d+\/\d+)/.exec(u.message)?.[1];return e===void 0?d("timeline.capacityReconnecting"):d("timeline.capacityReconnectingProgress",{progress:e})})():u.message}),o&&h]})}var Wo=ue(he);
|
|
3
3
|
export{Wo};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{Uo}from"./chunk-1zh28e39.js";import{Go}from"./chunk-dfcks9g4.js";import{Oo}from"./chunk-
|
|
1
|
+
import{Uo}from"./chunk-1zh28e39.js";import{Go}from"./chunk-dfcks9g4.js";import{Oo}from"./chunk-x5swmb1j.js";import{Xe}from"./chunk-fgk4f0jq.js";import{n}from"./chunk-zyvvk8b2.js";import{e}from"./chunk-k1vkc88d.js";import{isContentEntry as f,isDiffEntry as g,isFormElicitation as x,isText as h,isToolCallSubject as b,isUrlElicitation as w}from"@nyssance/codex-acp-v2/client";import{jsx as a,jsxs as m}from"react/jsx-runtime";function Le(t){return t.kind==="elicitation"&&x(t.params)}function y(t){let o=t._meta?.codex;if(typeof o!=="object"||o===null)return null;let s=o.description;return typeof s==="string"?s:null}function A(t){let o=t.rawInput;if(typeof o!=="object"||o===null)return null;let s=o.command;if(typeof s==="string")return s;if(Array.isArray(s))return s.map(String).join(" ");return null}function v(t){for(let o of t.content??[])if(g(o)&&o.patch&&o.patch.text.length>0)return o.patch.text;return null}function R(t){return(t.content??[]).filter(f).map((o)=>h(o.content)?o.content.text:"").filter((o)=>o.length>0).join(`
|
|
2
2
|
`)}function T({subject:t,requestTitle:o}){let{host:s}=e();if(!b(t))return null;let r=t.toolCall,l=A(r),i=v(r),c=R(r),p=s.toolTitle?.(r)??r.title;return m("div",{className:"flex flex-col gap-2",children:[p&&p!==o&&l===null&&a("div",{className:"text-sm font-medium",children:p}),l!==null&&m("pre",{className:"bg-muted overflow-x-auto rounded-lg p-3 font-mono text-xs whitespace-pre-wrap",children:[a("span",{className:"text-muted-foreground select-none",children:"$ "}),l]}),i!==null&&a("div",{className:"max-h-80 overflow-auto rounded-lg border","data-stream-style":"codexUI",children:a(Xe,{patch:i,theme:s.theme})}),i===null&&l===null&&c.length>0&&a("pre",{className:"bg-muted max-h-60 overflow-auto rounded-lg p-3 font-mono text-xs whitespace-pre-wrap",children:c}),(r.locations??[]).length>0&&a("ul",{className:"text-muted-foreground flex flex-col gap-0.5 text-xs",children:(r.locations??[]).map((u)=>a("li",{className:"truncate font-mono",children:u.path},`${u.path}:${u.line??""}`))})]})}function d(t,o){let{host:s,client:r}=e();return(l)=>{try{if(o)o(t.id,l);else r.respond(t.id,l)}catch(i){if(s.reportError)s.reportError(i);else console.error(i)}}}function C({action:t,total:o,onRespond:s}){let{host:r}=e(),l=d(t,s),i=t.params,c=r.permissionTitle?.(i)??i.title;return m(Uo,{requestId:t.id,title:c,alwaysLabel:r.t("approval.always"),autoFocus:"if-idle",total:o,options:i.options.map((p)=>({...p,description:y(p)??void 0})),onRespond:(p)=>l({outcome:p===null?{outcome:"cancelled"}:{outcome:"selected",optionId:p}}),children:[i.description&&a("div",{className:"text-muted-foreground mt-0.5 text-xs",children:i.description}),i.subject&&a(T,{subject:i.subject,requestTitle:c})]})}function Ye({action:t,total:o,onRespond:s}){let{host:r}=e(),l=d(t,s),i=n((c)=>t.sessionId===null?void 0:c.sessions[t.sessionId]);return a(Go,{requestId:t.id,schema:t.params.requestedSchema,message:i?.subagent?`${i.title??r.t("subagents.untitled")}: ${t.params.message}`:t.params.message,total:o,t:r.t,onRespond:l})}function be({action:t,total:o,onRespond:s}){let{host:r}=e(),l=d(t,s);if(t.kind==="permission")return a(C,{action:t,total:o,onRespond:s});if(Le(t))return a(Ye,{action:t,total:o??1,onRespond:s});let i=t.params;if(!w(i))throw Error("Unsupported elicitation mode");return a(Oo,{message:i.message,url:i.url,t:r.t,onOpen:r.openLink,onRespond:(c)=>l(c==="cancel"?{action:"cancel"}:{action:"decline"})})}
|
|
3
3
|
export{Le,Ye,be};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{x}from"./chunk-
|
|
1
|
+
import{x}from"./chunk-tpwdaz8k.js";import{EmojiPicker as t}from"frimousse";import{BoxIcon as u}from"lucide-react";import{useState as d}from"react";import{Button as g}from"@nyssance/shadcn/vega/components/ui/button";import{Popover as f,PopoverContent as b,PopoverTrigger as j}from"@nyssance/shadcn/vega/components/ui/popover";import{jsx as o,jsxs as n}from"react/jsx-runtime";function ze({emoji:s,onChange:l}){let[m,r]=d(!1),{t:a,i18n:c,emojibaseUrl:p}=x();return n(f,{open:m,onOpenChange:r,children:[o(j,{onClick:(e)=>e.stopPropagation(),onPointerDown:(e)=>e.stopPropagation(),render:o(g,{variant:"ghost",size:"icon-xs",className:"relative z-10","aria-label":a("collection.emoji"),children:s||o(u,{className:"size-3.5"})})}),o(b,{align:"start",className:"w-auto p-0",children:n(t.Root,{emojibaseUrl:p,locale:c.language==="zh-CN"?"zh":"en",className:"bg-popover flex h-80 w-72 flex-col",onEmojiSelect:({emoji:e})=>{l(e),r(!1)},children:[o(t.Search,{"aria-label":a("collection.emoji"),className:"focus-visible:border-ring mx-2 mt-2 flex h-8 rounded-md border bg-transparent px-2 text-sm outline-none"}),n(t.Viewport,{className:"relative flex-1 outline-none",children:[o(t.Loading,{className:"text-muted-foreground absolute inset-0 flex items-center justify-center text-xs",children:"…"}),o(t.Empty,{className:"text-muted-foreground absolute inset-0 flex items-center justify-center text-xs"}),o(t.List,{className:"pb-1.5 select-none",components:{CategoryHeader:({category:e,...i})=>o("div",{className:"bg-popover text-muted-foreground px-3 pt-3 pb-1.5 text-xs",...i,children:e.label}),Row:({children:e,...i})=>o("div",{className:"scroll-my-1.5 px-1.5",...i,children:e}),Emoji:({emoji:e,...i})=>o("button",{type:"button",className:"data-[active]:bg-accent flex size-8 items-center justify-center rounded-md text-lg",...i,children:e.emoji})}})]})]})})]})}
|
|
2
2
|
export{ze};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{s}from"./chunk-3f3y9t21.js";import{It}from"./chunk-667z0pac.js";import{P}from"./chunk-42atrgm1.js";import{Mt,he}from"./chunk-py0zbgaj.js";import{formatDistanceToNowStrict as x}from"date-fns";import{enUS as H,zhCN as L}from"date-fns/locale";import{ClockIcon as z,MessageSquareIcon as E}from"lucide-react";import{useEffect as g,useState as A}from"react";import{Input as D}from"@nyssance/shadcn/vega/components/ui/input";import{Separator as w}from"@nyssance/shadcn/vega/components/ui/separator";import{jsx as o,jsxs as h,Fragment as M}from"react/jsx-runtime";var S={en:H,"zh-CN":L};function Ve(t,a){let r=a==="zh-CN"?S["zh-CN"]:S.en;return x(new Date(t),{locale:r})}function ue({sessionRow:t,actions:a,shortcut:r,renaming:n=!1,onRename:m}){let{t:i,i18n:C,PathAction:u}=s(),f=he(),y=Mt();g(()=>{f(n)},[n,f]);let[I,p]=A(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?i("sessionList.archived"):t.updatedAt!==null?Ve(t.updatedAt,C.language):null,v=[];if(N!==null)v.push({icon:o(z,{className:"size-3.5"}),text:N});let l=u&&o(u,{cwd:t.cwd,onOpened:y});return o(It,{title:n?o(D,{autoFocus:!0,value:I,className:"h-7 text-sm","aria-label":i("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(P,{className:"min-w-0 flex-1",children:t.title??i("sessionList.untitled")})}),r]}),titleIcon:o(E,{className:"size-3.5"}),details:v,actions:l||a!==void 0?h(M,{children:[l,l&&a!==void 0&&o(w,{}),a]}):void 0})}
|
|
2
|
+
export{Ve,ue};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{We}from"./chunk-7a668qzy.js";import{ne,To}from"./chunk-dwn6bx69.js";import{t}from"./chunk-zyvvk8b2.js";import{cn as d}from"cn";import{SquareIcon as b}from"lucide-react";import{Kbd as f}from"@nyssance/shadcn/vega/components/ui/kbd";import{Tooltip as h,TooltipContent as I,TooltipTrigger as T}from"@nyssance/shadcn/vega/components/ui/tooltip";import{jsx as o,jsxs as n,Fragment as P}from"react/jsx-runtime";var v=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform);function bo({active:a,sending:r,ready:p,hasMentions:m=!1,onStop:c}){let{t:e}=t(),s=We(),u=m||s.textInput.value.trim().length>0||s.attachments.files.length>0,l=!p||r||!u,i=a?e("composer.steer"):e("composer.send");return n(P,{children:[a&&o(ne,{"aria-label":e("composer.stop"),title:e("composer.stop"),className:"border-border size-7 rounded-full border",onClick:c,children:o(b,{className:"size-3 fill-current"})}),o("div",{className:d(l&&"cursor-not-allowed"),children:n(h,{children:[o(T,{render:o(To,{"aria-label":i,disabled:l,"aria-busy":r,status:r?"submitted":"ready"})}),n(I,{role:"tooltip",children:[o("span",{className:"min-w-0",children:i}),o(f,{className:"shrink-0",children:v?"↩":"Enter"})]})]})})]})}
|
|
2
|
+
export{bo};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{l,i}from"./chunk-wtf1eyzy.js";import{f}from"./chunk-1k21j77z.js";import{I}from"./chunk-vgrjqwbq.js";import{le}from"./chunk-
|
|
1
|
+
import{l,i}from"./chunk-wtf1eyzy.js";import{f}from"./chunk-1k21j77z.js";import{I}from"./chunk-vgrjqwbq.js";import{le}from"./chunk-nn72eqzh.js";import{E,ae,se}from"./chunk-tv0fwt2g.js";import{ExternalLinkIcon as W,PlusIcon as _}from"lucide-react";import{useEffect as q,useState as y}from"react";import{Badge as O}from"@nyssance/shadcn/vega/components/ui/badge";import{Button as v}from"@nyssance/shadcn/vega/components/ui/button";import{Dialog as F,DialogContent as G,DialogDescription as J,DialogHeader as K,DialogTitle as Q}from"@nyssance/shadcn/vega/components/ui/dialog";import{Spinner as S}from"@nyssance/shadcn/vega/components/ui/spinner";import{Switch as X}from"@nyssance/shadcn/vega/components/ui/switch";import{jsx as e,jsxs as n,Fragment as T}from"react/jsx-runtime";function lt({entry:r,onBack:p}){let u=l(),{t}=u,P=i((a)=>a.readPlugin),C=i((a)=>a.installed.find(({plugin:g})=>g.id===r.plugin.id)),x=i((a)=>a.busyIds[r.plugin.id]),H=i((a)=>a.install),V=i((a)=>a.uninstall),j=i((a)=>a.setPluginEnabled),[o,B]=y(null),[D,U]=y(null),[R,M]=y(0),[c,z]=y(null);q(()=>{let a=!0;return U(null),B(null),P(r).then((g)=>{if(a)B(g)},(g)=>{if(a)U(g instanceof Error?g.message:String(g))}),()=>{a=!1}},[r,P,R]);let d=o?.summary??r.plugin,m=C?.plugin??d,s=d.interface,b=s?.displayName??d.name,k=m.availability!=="AVAILABLE"||m.installPolicy==="NOT_AVAILABLE",A=s?.longDescription??o?.description??s?.shortDescription,L=[...u.assetUrl?s?.screenshots.map((a)=>u.assetUrl(a))??[]:[],...s?.screenshotUrls??[]];return n("div",{className:"toolbox-surface flex min-h-0 flex-1 flex-col overflow-hidden",children:[e(se,{children:n("header",{className:"flex min-w-0 flex-col gap-4",children:[n("nav",{"aria-label":t("plugins.detail.root"),className:"flex min-w-0 items-center gap-2 text-[13px]",children:[e(v,{variant:"link",size:"sm",className:"text-muted-foreground hover:text-foreground px-2 hover:no-underline",onClick:p,children:t("plugins.detail.root")}),e("span",{"aria-hidden":"true",className:"text-muted-foreground/50 text-sm",children:"/"}),e("span",{"aria-current":"page",className:"truncate",children:b})]}),n("div",{className:"flex min-h-9 flex-wrap items-center justify-between gap-4",children:[n("div",{className:"flex min-w-0 items-center gap-3",children:[e(I,{name:d.name,className:"size-9 shrink-0 rounded-lg"}),e("h1",{className:"min-w-0 text-2xl leading-8 font-semibold break-words",children:b})]}),e("div",{className:"flex shrink-0 items-center gap-3",children:C?n(T,{children:[e(X,{checked:m.enabled,disabled:!!x||k,"aria-label":t(m.enabled?"plugins.card.disable":"plugins.card.enable",{pluginName:b}),onCheckedChange:(a)=>void j(m,a)}),e(v,{variant:"outline",size:"sm",disabled:!!x,onClick:()=>void V(m),children:x?e(S,{}):t("plugins.detail.uninstall")})]}):e(v,{size:"icon-sm",variant:"ghost",className:"text-foreground shrink-0","aria-label":t(k?"plugins.detail.unavailable":"plugins.detail.install"),title:t(k?"plugins.detail.unavailable":"plugins.detail.install"),disabled:!!x||k,onClick:()=>void H({...r,plugin:d}).catch(()=>{}),children:x?e(S,{"aria-hidden":"true"}):e(_,{className:"size-5",strokeWidth:2,"aria-hidden":"true"})})})]})]})}),e(f,{className:"pe-0",viewportClassName:"pe-0",children:n("div",{className:`${E} pt-2`,children:[s?.shortDescription&&e("p",{className:"text-muted-foreground text-sm leading-6",children:s.shortDescription}),d.keywords.length>0&&e("div",{className:"mt-3 flex flex-wrap gap-2",children:[...new Set(d.keywords)].map((a)=>e(O,{variant:"secondary",className:"text-xs font-normal",children:a},a))}),n("div",{className:"mt-6 flex items-stretch overflow-x-auto border-y py-4",children:[s?.developerName&&e(N,{label:t("plugins.detail.developer"),children:s.developerName}),s?.category&&e(N,{label:t("plugins.detail.category"),children:s.category}),(m.localVersion??m.version)&&e(N,{label:t("plugins.detail.version"),children:m.localVersion??m.version}),e(N,{label:t("plugins.headings.marketplace"),children:r.marketplace.interface?.displayName??r.marketplace.name}),s?.websiteUrl&&e(N,{label:t("plugins.detail.website"),children:e(w,{url:s.websiteUrl,label:t("plugins.detail.website")})})]}),!o&&!D&&n("div",{role:"status",className:"text-muted-foreground mt-8 flex items-center gap-2 text-sm",children:[e(S,{}),t("plugins.detail.loading")]}),D&&n("div",{role:"alert",className:"mt-8 space-y-2",children:[n("p",{className:"text-destructive text-sm",children:[t("plugins.detail.errorTitle"),": ",D]}),e(v,{variant:"outline",size:"sm",className:"h-9",onClick:()=>M((a)=>a+1),children:t("plugins.loadError.retry")})]}),A&&e("p",{className:"mt-8 text-sm leading-6 whitespace-pre-wrap",children:A}),L.length>0&&e("div",{className:"mt-6 flex gap-3 overflow-x-auto",children:[...new Set(L)].map((a)=>e("img",{src:a,alt:b,loading:"lazy",className:"max-h-72 max-w-full rounded-xl border object-contain"},a))}),s&&s.capabilities.length>0&&e(h,{label:t("plugins.detail.capabilities"),count:s.capabilities.length,children:s.capabilities.map((a)=>e(O,{variant:"secondary",className:"me-2",children:a},a))}),o&&o.mcpServers.length>0&&e(h,{label:t("plugins.detail.mcpServers"),count:o.mcpServers.length,children:o.mcpServers.map((a)=>n("div",{className:"flex items-center gap-3 py-1",children:[e(I,{name:d.name,className:"size-6 rounded-md"}),e("span",{className:"text-sm font-medium",children:a})]},a))}),o&&o.skills.length>0&&e(h,{label:t("plugins.detail.skills"),count:o.skills.length,children:o.skills.map((a)=>n(v,{variant:"ghost",className:"h-auto w-full justify-start gap-3 rounded-xl px-3 py-3 text-start whitespace-normal",onClick:()=>z(a),children:[e(I,{name:a.name,className:"size-8"}),n("span",{className:"min-w-0 flex-1",children:[e("span",{className:"block text-sm font-medium",children:a.interface?.displayName??a.name}),e("span",{className:"text-muted-foreground mt-1 block truncate text-[13px] leading-5 font-normal",children:a.interface?.shortDescription??a.shortDescription??a.description})]})]},a.path??a.name))}),o&&o.apps.length>0&&e(h,{label:t("plugins.detail.apps"),count:o.apps.length,children:o.apps.map((a)=>n("div",{className:"rounded-xl px-3 py-3",children:[e("div",{className:"text-sm font-medium",children:a.name}),a.description&&e("p",{className:"text-muted-foreground mt-1 text-[13px] leading-5",children:a.description}),a.installUrl&&e(w,{url:a.installUrl,label:t("plugins.installModal.connect")})]},a.id))}),o&&o.hooks.length>0&&e(h,{label:t("plugins.detail.hooks"),count:o.hooks.length,children:o.hooks.map((a)=>e("p",{className:"text-sm",children:a.eventName},a.key))}),(s?.privacyPolicyUrl||s?.termsOfServiceUrl)&&n("div",{className:"mt-10 flex flex-wrap gap-4 border-t pt-4",children:[s.privacyPolicyUrl&&e(w,{url:s.privacyPolicyUrl,label:t("plugins.detail.privacyPolicy")}),s.termsOfServiceUrl&&e(w,{url:s.termsOfServiceUrl,label:t("plugins.detail.termsOfService")})]})]})}),e(F,{open:c!==null,onOpenChange:(a)=>{if(!a)z(null)},children:e(G,{className:ae,children:c&&n(T,{children:[e("div",{className:"shrink-0 pr-8",children:e(I,{name:c.name,className:"size-10"})}),n("div",{className:"min-h-0 space-y-6 overflow-y-auto overscroll-contain",children:[n(K,{className:"gap-3",children:[e(Q,{className:"text-2xl leading-8 font-semibold break-words",children:c.interface?.displayName??c.name}),e(J,{className:"text-sm leading-6 break-words whitespace-pre-wrap",children:c.description})]}),e(le,{path:c.path,description:c.description},c.path??c.name)]})]})})})]})}function N({label:r,children:p}){return n("div",{className:"flex min-w-28 shrink-0 flex-col items-center justify-between gap-1.5 border-e px-6 first:ps-2 last:border-e-0",children:[e("span",{className:"text-muted-foreground text-xs",children:r}),e("span",{className:"flex items-center text-sm font-normal",children:p})]})}function h({label:r,count:p,children:u}){return n("section",{className:"mt-8",children:[n("h2",{className:"text-base font-medium",children:[r," ",e("span",{className:"text-muted-foreground font-normal",children:p})]}),e("div",{className:"mt-3 flex flex-col gap-2",children:u})]})}function w({url:r,label:p}){let{openLink:u}=l();if(!/^https?:\/\//i.test(r))return null;return n(v,{variant:"link",className:"text-muted-foreground h-auto p-0 text-xs",title:r,onClick:()=>u(r),children:[p,e(W,{className:"size-3.5"})]})}
|
|
2
2
|
export{lt};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{C}from"./chunk-heyqzkxq.js";import{s}from"./chunk-
|
|
1
|
+
import{C}from"./chunk-heyqzkxq.js";import{s}from"./chunk-3f3y9t21.js";import{CircleHelpIcon as m}from"lucide-react";import{useRef as c,useState as p}from"react";import{Button as f}from"@nyssance/shadcn/vega/components/ui/button";import{DropdownMenu as h,DropdownMenuContent as g,DropdownMenuTrigger as w}from"@nyssance/shadcn/vega/components/ui/dropdown-menu";import{jsx as e,jsxs as M}from"react/jsx-runtime";function sr({children:l}){let{t:n}=s(),[o,u]=p(!1),r=c(null),[a,d]=p();return C(o),M(h,{open:o,onOpenChange:(t)=>{if(t){let i=r.current?.parentElement;if(!i)throw Error("Help trigger must be mounted in its footer row");d(i.clientWidth)}u(t)},children:[e(w,{render:e(f,{ref:r,variant:"ghost",size:"icon-sm",className:"size-[var(--navigation-row-height,30px)] shrink-0 rounded-[10px] p-0 [corner-shape:superellipse(1.5)]","aria-label":n("sessionList.help"),title:n("sessionList.help")}),children:e(m,{className:"size-4 shrink-0"})}),e(g,{side:"top",align:"end",sideOffset:8,style:{width:a},children:l})]})}
|
|
2
2
|
export{sr};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{cn as v}from"cn";import{ChevronDownIcon as h,ChevronUpIcon as g,XIcon as b}from"lucide-react";import{useEffect as z,useImperativeHandle as B,useRef as N}from"react";import{Button as i}from"@nyssance/shadcn/vega/components/ui/button";import{Input as E}from"@nyssance/shadcn/vega/components/ui/input";import{jsx as t,jsxs as k}from"react/jsx-runtime";function Ri({ref:f,value:r,onChange:p,onFind:o,onClose:s,placeholder:d,autoFocusOpen:a=!0,prevTitle:l,nextTitle:c,className:m}){let n=N(null);B(f,()=>{if(n.current===null)throw Error("FindBar input is not mounted");return n.current},[]),z(()=>{if(!a)return;let e=n.current;if(e===null)throw Error("FindBar input is not mounted");e.focus({preventScroll:!0}),e.select()},[a]);let u=!r;return k("div",{className:v("border-border flex h-9 shrink-0 items-center gap-1 border-b px-2",m),children:[t(E,{ref:n,value:r,onChange:(e)=>p(e.target.value),placeholder:d,className:"h-7 text-xs",onKeyDown:(e)=>{if(e.key==="Escape"){e.preventDefault(),s();return}if(e.key==="Enter"){if(e.preventDefault(),r)o(e.shiftKey)}}}),t(i,{size:"icon",variant:"ghost",className:"size-6",disabled:u,onClick:()=>o(!0),title:l?`${l} (⇧↵)`:"⇧↵",children:t(g,{className:"size-3.5"})}),t(i,{size:"icon",variant:"ghost",className:"size-6",disabled:u,onClick:()=>o(!1),title:c?`${c} (↵)`:"↵",children:t(h,{className:"size-3.5"})}),t(i,{size:"icon",variant:"ghost",className:"size-6",onClick:s,title:"Esc",children:t(b,{className:"size-3.5"})})]})}
|
|
2
|
+
export{Ri};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e}from"./chunk-k1vkc88d.js";import{ht}from"./chunk-kbbq3y2j.js";import{H,Ue,j,yt}from"./chunk-p58e9z34.js";import{mt,gt}from"./chunk-xdvbb3av.js";import{CardSendIcon as pe}from"@solar-icons/react/line-duotone/card-send";import{cn as J}from"cn";import{ChevronDownIcon as se,ExternalLinkIcon as ve,EyeIcon as ne,EyeOffIcon as oe,PlusIcon as ge,ServerIcon as ie,Trash2Icon as fe}from"lucide-react";import{useEffect as V,useRef as ye,useState as y}from"react";import{Button as R}from"@nyssance/shadcn/vega/components/ui/button";import{Collapsible as re,CollapsibleContent as ae,CollapsibleTrigger as le}from"@nyssance/shadcn/vega/components/ui/collapsible";import{Field as D,FieldDescription as de,FieldLabel as O}from"@nyssance/shadcn/vega/components/ui/field";import{Input as ee}from"@nyssance/shadcn/vega/components/ui/input";import{InputGroup as q,InputGroupAddon as ce,InputGroupButton as ue,InputGroupInput as Q}from"@nyssance/shadcn/vega/components/ui/input-group";import{Select as be,SelectContent as he,SelectGroup as xe,SelectItem as Ne,SelectTrigger as Pe,SelectValue as Ce}from"@nyssance/shadcn/vega/components/ui/select";import{Separator as X}from"@nyssance/shadcn/vega/components/ui/separator";import{Spinner as Y}from"@nyssance/shadcn/vega/components/ui/spinner";import{Textarea as we}from"@nyssance/shadcn/vega/components/ui/textarea";import{jsx as t,jsxs as i,Fragment as Se}from"react/jsx-runtime";function W(s){if(s instanceof Error)return s.message;if(typeof s==="object"&&s!==null&&"message"in s)return String(s.message);return String(s)}function Z(){let{host:s}=e();return(d)=>{let u=d instanceof Error?d:Error(W(d));if(s.reportError)s.reportError(u);else console.error(u)}}function Hn({refreshAccountProviders:s,openTopUp:d,group:u}){let{t:v}=e().host,C=Z(),[S,N]=y(0),[l,n]=y(null),[h,c]=y(!0),w=ye(s);return w.current=s,V(()=>{let b=()=>N((p)=>p+1);return window.addEventListener("focus",b),()=>window.removeEventListener("focus",b)},[]),V(()=>{let b=!0;return c(!0),w.current().then(()=>{if(b)n(null),c(!1)},(p)=>{if(b)n(W(p)),c(!1)}),()=>{b=!1}},[S]),t(u,{children:i("div",{className:"space-y-3 rounded-xl border p-4",children:[i("div",{className:"flex items-center justify-between gap-3",children:[t("h3",{className:"text-sm font-medium",children:"ALwith"}),d&&t(R,{variant:"ghost",size:"icon-sm",className:"text-primary hover:text-primary/80","aria-label":v("provider.managed.topUp"),title:v("provider.managed.topUp"),onClick:()=>{d().catch(C)},children:t(pe,{className:"size-4","aria-hidden":"true"})})]}),t("p",{className:"text-muted-foreground text-xs",children:v("provider.managed.description")}),l!==null&&i("div",{className:"space-y-2",children:[t("p",{role:"alert",className:"text-destructive text-xs",children:l}),i(R,{variant:"outline",size:"sm",disabled:h,onClick:()=>N((b)=>b+1),children:[h&&t(Y,{"aria-hidden":"true"}),v("provider.retry")]})]})]})})}function Ki({port:s,bridge:d,group:u,label:v,refreshAccountProviders:C,openTopUp:S}){let{host:N}=e(),{t:l}=N,n=Z(),h=(o)=>N.notify?.(o),c=gt(s,n),w=c?.providers??{},[b,p]=y(null),[x,k]=y(H[0]?.id??""),[F,B]=y(0),[U,A]=y({}),_=async(o,r,f)=>{p(r.id);try{let a=await s.save(o,r.id,f);if(!a.error)A((M)=>{let L={...M};return delete L[r.id],L});if(a.error)n(a.error);if(!a.error)h(l(a.status==="pending"?"provider.pending":f===null?"provider.removed":"provider.saved",{name:r.name}));return a}catch(a){return n(a),null}finally{p(null)}},I=async(o)=>{p(o);try{let r=await s.test(o);if(A((f)=>({...f,[o]:r})),r.ok)h(l("provider.testSuccess",{latency:r.latencyMs??0}));else n(`${l(`provider.testErrors.${r.code}`)}${r.message?`: ${r.message}`:""}`)}catch(r){n(r)}finally{p(null)}},T=async(o,r)=>{p(r.id);try{let f=await s.saveCustom(o,r);if(f.error)n(f.error);else A((a)=>{let M={...a};return delete M[r.id],M}),h(l(f.status==="pending"?"provider.pending":"provider.saved",{name:r.name}));return!f.error}catch(f){return n(f),!1}finally{p(null)}},z=async(o)=>{if(!c)return;p(o.id);try{let r=await s.removeCustom(c.revision,o.id);if(r.error)n(r.error);else k(H[0]?.id??""),h(l(r.status==="pending"?"provider.pending":"provider.removed",{name:o.name}))}catch(r){n(r)}finally{p(null)}},K=async()=>{p("retry");try{let o=await mt(s);if(o.error)n(o.error);else if(o.status==="pending")h(l("provider.pending"))}catch(o){n(o)}finally{p(null)}},P=H.find((o)=>o.id===x)??null,E=c?.customProviders.find((o)=>o.id===x)??null;return V(()=>{if(!c||x==="new"||P||E)return;k(H[0]?.id??"")},[c,x,P,E]),i("div",{className:"flex flex-col gap-6",children:[i(u,{children:[t(v,{children:"Codex"}),t(ht,{bridge:d})]}),C&&t(Hn,{refreshAccountProviders:C,openTopUp:S,group:u}),c?.status==="pending"&&t("p",{className:"text-muted-foreground text-sm",children:l("provider.pending")}),c?.error&&t("p",{className:"text-destructive text-sm",children:c.error}),c&&c.status!=="applied"&&t(R,{variant:"outline",className:"self-start",disabled:b!==null,onClick:()=>void K(),children:l("provider.retry")}),t(u,{children:c&&i(Se,{children:[t(On,{activeId:x,keys:w,customProviders:c.customProviders,onSelect:k,onAdd:()=>k("new"),label:v}),H.map((o)=>t("div",{hidden:x!==o.id,children:t(Bn,{provider:o,saved:w[o.id]??null,revision:c.revision,busy:b!==null,onSave:(r,f)=>_(r,o,f),testResult:U[o.id],onTest:()=>I(o.id)})},o.id)),c.customProviders.map((o)=>t("div",{hidden:x!==o.id,children:t(Jt,{provider:o,revision:c.revision,busy:b!==null,testResult:U[o.id],onTest:()=>I(o.id),onRemove:()=>z(o),onSaved:k,onSave:T})},o.id)),t("div",{hidden:x!=="new",children:t(Jt,{provider:null,revision:c.revision,busy:b!==null,onSaved:(o)=>{B((r)=>r+1),k(o)},onSave:T},F)})]})})]})}function On({activeId:s,keys:d,customProviders:u,onSelect:v,onAdd:C,label:S}){let{t:N}=e().host;return i("div",{children:[t(S,{children:N("provider.label")}),i("div",{className:"grid grid-cols-2 gap-2 py-4 sm:grid-cols-3",children:[H.map((l)=>{let n=l.logo,h=d[l.id]!==void 0;return t(te,{id:l.id,name:l.name,active:s===l.id,configured:h,icon:t(n,{className:"size-5 shrink-0"}),onClick:()=>v(l.id)},l.id)}),u.map((l)=>t(te,{id:l.id,name:l.name,active:s===l.id,configured:!0,icon:t(ie,{className:"size-5 shrink-0"}),onClick:()=>v(l.id)},l.id)),i(R,{type:"button",variant:"outline","aria-pressed":s==="new",onClick:C,className:J("h-9 w-full justify-start gap-2 rounded-full px-4",s==="new"&&"bg-accent"),children:[t(ge,{className:"size-4 shrink-0"}),t("span",{className:"truncate",children:N("provider.customButton")})]})]})]})}function te({id:s,name:d,active:u,configured:v,icon:C,onClick:S}){return i(R,{type:"button",variant:"outline","aria-label":d,"aria-pressed":u,onClick:S,className:J("h-9 w-full gap-2 rounded-full px-4",u&&"bg-accent"),children:[C,t("span",{className:"min-w-0 flex-1 truncate text-center",children:d}),t("span",{"data-testid":`${s}-status`,"data-configured":v,"aria-hidden":"true",className:J("size-2 shrink-0 rounded-full",v?"bg-green-500":"bg-muted-foreground/30")})]})}function Un({result:s}){let{t:d}=e().host;return t("p",{role:"status",className:s.ok?"text-muted-foreground text-xs":"text-destructive text-xs",children:s.ok?d("provider.testSuccess",{latency:s.latencyMs??0}):`${d(`provider.testErrors.${s.code}`)}${s.status?` (HTTP ${s.status})`:""}`})}function me({busy:s,canTest:d,onTest:u,onRemove:v,result:C,children:S}){let{t:N}=e().host;return i("div",{className:"space-y-3 border-t pt-4",children:[C&&t(Un,{result:C}),u&&t("p",{className:"text-muted-foreground text-xs leading-relaxed",children:N("provider.testDescription")}),i("div",{className:"flex flex-wrap items-center gap-2",children:[v&&i(R,{size:"sm",variant:"destructive",className:"font-normal",disabled:s,onClick:v,children:[t(fe,{className:"size-4"}),N("provider.remove")]}),i("div",{className:"ms-auto flex flex-wrap items-center gap-2",children:[u&&t(R,{size:"sm",variant:"outline",disabled:s||!d,onClick:u,children:N("provider.testButton")}),S]})]})]})}function Bn({provider:s,saved:d,revision:u,busy:v,onSave:C,testResult:S,onTest:N}){let{host:l}=e(),{t:n}=l,h=Z(),[c,w]=y(""),[b,p]=y(!1),[x,k]=y({saved:d,revision:u}),[F,B]=y(j(s,d?.region)?.id),[U,A]=y(d?.base_url??""),_=s.logo,I=d!==null,T=c.trim(),z=yt(s,F),K=F!==j(s,x.saved?.region)?.id,P=U.trim()!==(x.saved?.base_url??"");V(()=>{if(u>x.revision&&T===""&&!K&&!P)k({saved:d,revision:u}),B(j(s,d?.region)?.id),A(d?.base_url??"")},[u,d,s,x.revision,T,K,P]);let E=!v&&(T!==""||K||P),o=`${s.id}-api-key`,r=async(a)=>{let M=c,L=F,m=await C(x.revision,a);if(!m)return;let G=m.providers[s.id]??null;k({saved:G,revision:m.revision}),w((g)=>g===M?"":g),B((g)=>g===L?j(s,G?.region)?.id:g),A((g)=>g===U?G?.base_url??"":g)},f=()=>{if(T===""&&x.saved===null)return;r({...T===""?{}:{apiKey:T},...F===void 0?{}:{region:F},...P?{baseUrl:U.trim()}:{}})};return i("div",{className:"space-y-5 rounded-xl border p-4",children:[i("div",{className:"flex flex-wrap items-center gap-3",children:[t(_,{className:"size-6 shrink-0"}),i("div",{className:"min-w-0 flex-1",children:[t("h3",{className:"text-sm font-medium",children:s.name}),t("div",{className:"text-muted-foreground mt-0.5 text-xs",children:I?n("provider.active",{name:s.name,count:s.models.length}):n("provider.inactive")})]}),s.regions&&i(be,{value:F,onValueChange:(a)=>B(a??s.regions?.[0]?.id),children:[t(Pe,{className:"w-32","aria-label":n("provider.region"),children:t(Ce,{})}),t(he,{align:"start",alignItemWithTrigger:!1,sideOffset:6,className:"max-w-(--available-width) min-w-0 p-1",children:t(xe,{children:s.regions.map((a)=>t(Ne,{value:a.id,children:n(`provider.regions.${a.id}`)},a.id))})})]})]}),t(X,{}),i("section",{className:"space-y-4","aria-labelledby":`${s.id}-connection`,children:[t("h4",{id:`${s.id}-connection`,className:"text-sm font-medium",children:n("provider.connectionSettings")}),i(D,{className:"gap-2",children:[i("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t(O,{htmlFor:o,children:n("provider.apiKey")}),z!==null&&i(R,{type:"button",variant:"link",size:"sm",className:"text-muted-foreground h-auto p-0 text-xs",onClick:()=>{try{l.openLink(z)}catch(a){h(a)}},children:[n("provider.getKey",{name:s.name}),t(ve,{className:"size-3","aria-hidden":"true"})]})]}),i(q,{children:[t(Q,{id:o,type:b?"text":"password",autoComplete:"off",spellCheck:!1,placeholder:I?n("provider.apiKeyKept"):n("provider.apiKeyPlaceholder"),value:c,onChange:(a)=>w(a.target.value),onKeyDown:(a)=>{if(a.key==="Enter"&&E)f()}}),t(ce,{align:"inline-end",children:t(ue,{size:"icon-xs","aria-label":n(b?"provider.hideKey":"provider.showKey"),onClick:()=>p((a)=>!a),children:b?t(ne,{}):t(oe,{})})})]})]}),i(re,{className:"space-y-2",children:[i(le,{render:t(R,{variant:"ghost",size:"sm",className:"group px-2.5"}),children:[n("provider.baseUrl"),t(se,{className:"size-4 transition-transform group-aria-expanded:rotate-180","aria-hidden":"true"})]}),t(ae,{children:i(D,{className:"gap-2",children:[t(O,{htmlFor:`${s.id}-base-url`,className:"sr-only",children:n("provider.baseUrl")}),t(q,{children:t(Q,{id:`${s.id}-base-url`,type:"url",spellCheck:!1,placeholder:j(s,F)?.baseUrl??s.baseUrl,value:U,onChange:(a)=>A(a.target.value)})}),t(de,{className:"text-xs",children:n("provider.baseUrlDescription")})]})})]})]}),t(me,{busy:v,canTest:!E,onTest:I?N:void 0,onRemove:I?()=>void r(null):void 0,result:!E?S:void 0,children:i(R,{size:"sm",disabled:!E,onClick:f,children:[v&&t(Y,{"data-icon":"inline-start"}),n("provider.saveButton")]})})]})}function Jt({provider:s,revision:d,busy:u,testResult:v,onTest:C,onRemove:S,onSaved:N,onSave:l}){let{t:n}=e().host,[h,c]=y(s?.name??""),[w,b]=y(s?.baseUrl??""),[p,x]=y(""),[k,F]=y(!1),[B,U]=y(s===null),[A,_]=y(s?.models??[]),[I,T]=y(s?JSON.stringify(s.models,null,2):`[
|
|
1
|
+
import{e}from"./chunk-k1vkc88d.js";import{ht}from"./chunk-htzd730z.js";import{H,Ue,j,yt}from"./chunk-p58e9z34.js";import{mt,gt}from"./chunk-xdvbb3av.js";import{CardSendIcon as pe}from"@solar-icons/react/line-duotone/card-send";import{cn as J}from"cn";import{ChevronDownIcon as se,ExternalLinkIcon as ve,EyeIcon as ne,EyeOffIcon as oe,PlusIcon as ge,ServerIcon as ie,Trash2Icon as fe}from"lucide-react";import{useEffect as V,useRef as ye,useState as y}from"react";import{Button as R}from"@nyssance/shadcn/vega/components/ui/button";import{Collapsible as re,CollapsibleContent as ae,CollapsibleTrigger as le}from"@nyssance/shadcn/vega/components/ui/collapsible";import{Field as D,FieldDescription as de,FieldLabel as O}from"@nyssance/shadcn/vega/components/ui/field";import{Input as ee}from"@nyssance/shadcn/vega/components/ui/input";import{InputGroup as q,InputGroupAddon as ce,InputGroupButton as ue,InputGroupInput as Q}from"@nyssance/shadcn/vega/components/ui/input-group";import{Select as be,SelectContent as he,SelectGroup as xe,SelectItem as Ne,SelectTrigger as Pe,SelectValue as Ce}from"@nyssance/shadcn/vega/components/ui/select";import{Separator as X}from"@nyssance/shadcn/vega/components/ui/separator";import{Spinner as Y}from"@nyssance/shadcn/vega/components/ui/spinner";import{Textarea as we}from"@nyssance/shadcn/vega/components/ui/textarea";import{jsx as t,jsxs as i,Fragment as Se}from"react/jsx-runtime";function W(s){if(s instanceof Error)return s.message;if(typeof s==="object"&&s!==null&&"message"in s)return String(s.message);return String(s)}function Z(){let{host:s}=e();return(d)=>{let u=d instanceof Error?d:Error(W(d));if(s.reportError)s.reportError(u);else console.error(u)}}function Hn({refreshAccountProviders:s,openTopUp:d,group:u}){let{t:v}=e().host,C=Z(),[S,N]=y(0),[l,n]=y(null),[h,c]=y(!0),w=ye(s);return w.current=s,V(()=>{let b=()=>N((p)=>p+1);return window.addEventListener("focus",b),()=>window.removeEventListener("focus",b)},[]),V(()=>{let b=!0;return c(!0),w.current().then(()=>{if(b)n(null),c(!1)},(p)=>{if(b)n(W(p)),c(!1)}),()=>{b=!1}},[S]),t(u,{children:i("div",{className:"space-y-3 rounded-xl border p-4",children:[i("div",{className:"flex items-center justify-between gap-3",children:[t("h3",{className:"text-sm font-medium",children:"ALwith"}),d&&t(R,{variant:"ghost",size:"icon-sm",className:"text-primary hover:text-primary/80","aria-label":v("provider.managed.topUp"),title:v("provider.managed.topUp"),onClick:()=>{d().catch(C)},children:t(pe,{className:"size-4","aria-hidden":"true"})})]}),t("p",{className:"text-muted-foreground text-xs",children:v("provider.managed.description")}),l!==null&&i("div",{className:"space-y-2",children:[t("p",{role:"alert",className:"text-destructive text-xs",children:l}),i(R,{variant:"outline",size:"sm",disabled:h,onClick:()=>N((b)=>b+1),children:[h&&t(Y,{"aria-hidden":"true"}),v("provider.retry")]})]})]})})}function Ki({port:s,bridge:d,group:u,label:v,refreshAccountProviders:C,openTopUp:S}){let{host:N}=e(),{t:l}=N,n=Z(),h=(o)=>N.notify?.(o),c=gt(s,n),w=c?.providers??{},[b,p]=y(null),[x,k]=y(H[0]?.id??""),[F,B]=y(0),[U,A]=y({}),_=async(o,r,f)=>{p(r.id);try{let a=await s.save(o,r.id,f);if(!a.error)A((M)=>{let L={...M};return delete L[r.id],L});if(a.error)n(a.error);if(!a.error)h(l(a.status==="pending"?"provider.pending":f===null?"provider.removed":"provider.saved",{name:r.name}));return a}catch(a){return n(a),null}finally{p(null)}},I=async(o)=>{p(o);try{let r=await s.test(o);if(A((f)=>({...f,[o]:r})),r.ok)h(l("provider.testSuccess",{latency:r.latencyMs??0}));else n(`${l(`provider.testErrors.${r.code}`)}${r.message?`: ${r.message}`:""}`)}catch(r){n(r)}finally{p(null)}},T=async(o,r)=>{p(r.id);try{let f=await s.saveCustom(o,r);if(f.error)n(f.error);else A((a)=>{let M={...a};return delete M[r.id],M}),h(l(f.status==="pending"?"provider.pending":"provider.saved",{name:r.name}));return!f.error}catch(f){return n(f),!1}finally{p(null)}},z=async(o)=>{if(!c)return;p(o.id);try{let r=await s.removeCustom(c.revision,o.id);if(r.error)n(r.error);else k(H[0]?.id??""),h(l(r.status==="pending"?"provider.pending":"provider.removed",{name:o.name}))}catch(r){n(r)}finally{p(null)}},K=async()=>{p("retry");try{let o=await mt(s);if(o.error)n(o.error);else if(o.status==="pending")h(l("provider.pending"))}catch(o){n(o)}finally{p(null)}},P=H.find((o)=>o.id===x)??null,E=c?.customProviders.find((o)=>o.id===x)??null;return V(()=>{if(!c||x==="new"||P||E)return;k(H[0]?.id??"")},[c,x,P,E]),i("div",{className:"flex flex-col gap-6",children:[i(u,{children:[t(v,{children:"Codex"}),t(ht,{bridge:d})]}),C&&t(Hn,{refreshAccountProviders:C,openTopUp:S,group:u}),c?.status==="pending"&&t("p",{className:"text-muted-foreground text-sm",children:l("provider.pending")}),c?.error&&t("p",{className:"text-destructive text-sm",children:c.error}),c&&c.status!=="applied"&&t(R,{variant:"outline",className:"self-start",disabled:b!==null,onClick:()=>void K(),children:l("provider.retry")}),t(u,{children:c&&i(Se,{children:[t(On,{activeId:x,keys:w,customProviders:c.customProviders,onSelect:k,onAdd:()=>k("new"),label:v}),H.map((o)=>t("div",{hidden:x!==o.id,children:t(Bn,{provider:o,saved:w[o.id]??null,revision:c.revision,busy:b!==null,onSave:(r,f)=>_(r,o,f),testResult:U[o.id],onTest:()=>I(o.id)})},o.id)),c.customProviders.map((o)=>t("div",{hidden:x!==o.id,children:t(Jt,{provider:o,revision:c.revision,busy:b!==null,testResult:U[o.id],onTest:()=>I(o.id),onRemove:()=>z(o),onSaved:k,onSave:T})},o.id)),t("div",{hidden:x!=="new",children:t(Jt,{provider:null,revision:c.revision,busy:b!==null,onSaved:(o)=>{B((r)=>r+1),k(o)},onSave:T},F)})]})})]})}function On({activeId:s,keys:d,customProviders:u,onSelect:v,onAdd:C,label:S}){let{t:N}=e().host;return i("div",{children:[t(S,{children:N("provider.label")}),i("div",{className:"grid grid-cols-2 gap-2 py-4 sm:grid-cols-3",children:[H.map((l)=>{let n=l.logo,h=d[l.id]!==void 0;return t(te,{id:l.id,name:l.name,active:s===l.id,configured:h,icon:t(n,{className:"size-5 shrink-0"}),onClick:()=>v(l.id)},l.id)}),u.map((l)=>t(te,{id:l.id,name:l.name,active:s===l.id,configured:!0,icon:t(ie,{className:"size-5 shrink-0"}),onClick:()=>v(l.id)},l.id)),i(R,{type:"button",variant:"outline","aria-pressed":s==="new",onClick:C,className:J("h-9 w-full justify-start gap-2 rounded-full px-4",s==="new"&&"bg-accent"),children:[t(ge,{className:"size-4 shrink-0"}),t("span",{className:"truncate",children:N("provider.customButton")})]})]})]})}function te({id:s,name:d,active:u,configured:v,icon:C,onClick:S}){return i(R,{type:"button",variant:"outline","aria-label":d,"aria-pressed":u,onClick:S,className:J("h-9 w-full gap-2 rounded-full px-4",u&&"bg-accent"),children:[C,t("span",{className:"min-w-0 flex-1 truncate text-center",children:d}),t("span",{"data-testid":`${s}-status`,"data-configured":v,"aria-hidden":"true",className:J("size-2 shrink-0 rounded-full",v?"bg-green-500":"bg-muted-foreground/30")})]})}function Un({result:s}){let{t:d}=e().host;return t("p",{role:"status",className:s.ok?"text-muted-foreground text-xs":"text-destructive text-xs",children:s.ok?d("provider.testSuccess",{latency:s.latencyMs??0}):`${d(`provider.testErrors.${s.code}`)}${s.status?` (HTTP ${s.status})`:""}`})}function me({busy:s,canTest:d,onTest:u,onRemove:v,result:C,children:S}){let{t:N}=e().host;return i("div",{className:"space-y-3 border-t pt-4",children:[C&&t(Un,{result:C}),u&&t("p",{className:"text-muted-foreground text-xs leading-relaxed",children:N("provider.testDescription")}),i("div",{className:"flex flex-wrap items-center gap-2",children:[v&&i(R,{size:"sm",variant:"destructive",className:"font-normal",disabled:s,onClick:v,children:[t(fe,{className:"size-4"}),N("provider.remove")]}),i("div",{className:"ms-auto flex flex-wrap items-center gap-2",children:[u&&t(R,{size:"sm",variant:"outline",disabled:s||!d,onClick:u,children:N("provider.testButton")}),S]})]})]})}function Bn({provider:s,saved:d,revision:u,busy:v,onSave:C,testResult:S,onTest:N}){let{host:l}=e(),{t:n}=l,h=Z(),[c,w]=y(""),[b,p]=y(!1),[x,k]=y({saved:d,revision:u}),[F,B]=y(j(s,d?.region)?.id),[U,A]=y(d?.base_url??""),_=s.logo,I=d!==null,T=c.trim(),z=yt(s,F),K=F!==j(s,x.saved?.region)?.id,P=U.trim()!==(x.saved?.base_url??"");V(()=>{if(u>x.revision&&T===""&&!K&&!P)k({saved:d,revision:u}),B(j(s,d?.region)?.id),A(d?.base_url??"")},[u,d,s,x.revision,T,K,P]);let E=!v&&(T!==""||K||P),o=`${s.id}-api-key`,r=async(a)=>{let M=c,L=F,m=await C(x.revision,a);if(!m)return;let G=m.providers[s.id]??null;k({saved:G,revision:m.revision}),w((g)=>g===M?"":g),B((g)=>g===L?j(s,G?.region)?.id:g),A((g)=>g===U?G?.base_url??"":g)},f=()=>{if(T===""&&x.saved===null)return;r({...T===""?{}:{apiKey:T},...F===void 0?{}:{region:F},...P?{baseUrl:U.trim()}:{}})};return i("div",{className:"space-y-5 rounded-xl border p-4",children:[i("div",{className:"flex flex-wrap items-center gap-3",children:[t(_,{className:"size-6 shrink-0"}),i("div",{className:"min-w-0 flex-1",children:[t("h3",{className:"text-sm font-medium",children:s.name}),t("div",{className:"text-muted-foreground mt-0.5 text-xs",children:I?n("provider.active",{name:s.name,count:s.models.length}):n("provider.inactive")})]}),s.regions&&i(be,{value:F,onValueChange:(a)=>B(a??s.regions?.[0]?.id),children:[t(Pe,{className:"w-32","aria-label":n("provider.region"),children:t(Ce,{})}),t(he,{align:"start",alignItemWithTrigger:!1,sideOffset:6,className:"max-w-(--available-width) min-w-0 p-1",children:t(xe,{children:s.regions.map((a)=>t(Ne,{value:a.id,children:n(`provider.regions.${a.id}`)},a.id))})})]})]}),t(X,{}),i("section",{className:"space-y-4","aria-labelledby":`${s.id}-connection`,children:[t("h4",{id:`${s.id}-connection`,className:"text-sm font-medium",children:n("provider.connectionSettings")}),i(D,{className:"gap-2",children:[i("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t(O,{htmlFor:o,children:n("provider.apiKey")}),z!==null&&i(R,{type:"button",variant:"link",size:"sm",className:"text-muted-foreground h-auto p-0 text-xs",onClick:()=>{try{l.openLink(z)}catch(a){h(a)}},children:[n("provider.getKey",{name:s.name}),t(ve,{className:"size-3","aria-hidden":"true"})]})]}),i(q,{children:[t(Q,{id:o,type:b?"text":"password",autoComplete:"off",spellCheck:!1,placeholder:I?n("provider.apiKeyKept"):n("provider.apiKeyPlaceholder"),value:c,onChange:(a)=>w(a.target.value),onKeyDown:(a)=>{if(a.key==="Enter"&&E)f()}}),t(ce,{align:"inline-end",children:t(ue,{size:"icon-xs","aria-label":n(b?"provider.hideKey":"provider.showKey"),onClick:()=>p((a)=>!a),children:b?t(ne,{}):t(oe,{})})})]})]}),i(re,{className:"space-y-2",children:[i(le,{render:t(R,{variant:"ghost",size:"sm",className:"group px-2.5"}),children:[n("provider.baseUrl"),t(se,{className:"size-4 transition-transform group-aria-expanded:rotate-180","aria-hidden":"true"})]}),t(ae,{children:i(D,{className:"gap-2",children:[t(O,{htmlFor:`${s.id}-base-url`,className:"sr-only",children:n("provider.baseUrl")}),t(q,{children:t(Q,{id:`${s.id}-base-url`,type:"url",spellCheck:!1,placeholder:j(s,F)?.baseUrl??s.baseUrl,value:U,onChange:(a)=>A(a.target.value)})}),t(de,{className:"text-xs",children:n("provider.baseUrlDescription")})]})})]})]}),t(me,{busy:v,canTest:!E,onTest:I?N:void 0,onRemove:I?()=>void r(null):void 0,result:!E?S:void 0,children:i(R,{size:"sm",disabled:!E,onClick:f,children:[v&&t(Y,{"data-icon":"inline-start"}),n("provider.saveButton")]})})]})}function Jt({provider:s,revision:d,busy:u,testResult:v,onTest:C,onRemove:S,onSaved:N,onSave:l}){let{t:n}=e().host,[h,c]=y(s?.name??""),[w,b]=y(s?.baseUrl??""),[p,x]=y(""),[k,F]=y(!1),[B,U]=y(s===null),[A,_]=y(s?.models??[]),[I,T]=y(s?JSON.stringify(s.models,null,2):`[
|
|
2
2
|
{ "label": "My Model", "api_id": "model-id" }
|
|
3
3
|
]`),[z,K]=y(null),[P]=y(()=>s?.id??`custom_${crypto.randomUUID().replaceAll("-","")}`),E=`${P}-name`,o=`${P}-base-url`,r=`${P}-api-key`,f=`${P}-models`,a=h.trim()!==s?.name||w.trim()!==s.baseUrl||p.trim()!==""||I!==JSON.stringify(s.models,null,2),M=(m)=>{if(!m)try{_(Ue(I)),K(null)}catch(G){K(W(G));return}U(m)},L=async()=>{let m;try{m=Ue(I),K(null)}catch(g){K(W(g)),U(!0);return}if(await l(d,{id:P,name:h.trim(),baseUrl:w.trim(),models:m,...p.trim()===""?{}:{apiKey:p.trim()}}))c((g)=>g===h?h.trim():g),b((g)=>g===w?w.trim():g),x((g)=>g===p?"":g),T((g)=>g===I?JSON.stringify(m,null,2):g),N(P)};return i("div",{className:"space-y-5 rounded-xl border p-4",children:[i("div",{className:"flex items-center gap-3",children:[t(ie,{className:"size-6 shrink-0"}),i("div",{className:"min-w-0 flex-1",children:[t("h3",{className:"text-sm font-medium break-words",children:s?.name||n("provider.addCustom")}),t("div",{className:"text-muted-foreground mt-0.5 text-xs",children:n("provider.customDescription")})]}),s&&t("span",{className:"text-muted-foreground shrink-0 text-xs",children:n("provider.configured")})]}),t(X,{}),i("section",{className:"space-y-4","aria-labelledby":`${P}-connection`,children:[t("h4",{id:`${P}-connection`,className:"text-sm font-medium",children:n("provider.connectionSettings")}),i(D,{className:"gap-2",children:[t(O,{htmlFor:E,children:n("provider.name")}),t(ee,{id:E,value:h,onChange:(m)=>c(m.target.value)})]}),i(D,{className:"gap-2",children:[t(O,{htmlFor:o,children:n("provider.baseUrl")}),t(ee,{id:o,type:"url",placeholder:"https://.../v1",value:w,onChange:(m)=>b(m.target.value)})]}),i(D,{className:"gap-2",children:[t(O,{htmlFor:r,children:n("provider.apiKey")}),i(q,{children:[t(Q,{id:r,type:k?"text":"password",autoComplete:"off",placeholder:s?n("provider.apiKeyKept"):n("provider.apiKeyPlaceholder"),value:p,onChange:(m)=>x(m.target.value)}),t(ce,{align:"inline-end",children:t(ue,{size:"icon-xs","aria-label":n(k?"provider.hideKey":"provider.showKey"),onClick:()=>F((m)=>!m),children:k?t(ne,{}):t(oe,{})})})]})]})]}),t(X,{}),i(re,{open:B,onOpenChange:M,className:"space-y-3",children:[i("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t("h4",{className:"text-sm font-medium",children:n("provider.models")}),i(le,{render:t(R,{variant:"ghost",size:"sm"}),children:[n(B?"provider.previewModels":"provider.editModels"),t(se,{className:J("size-4",B&&"rotate-180")})]})]}),!B&&t("ul",{className:"bg-muted/40 divide-y rounded-lg px-3",children:A.map((m)=>i("li",{className:"flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1 py-2.5 text-sm",children:[t("span",{className:"break-all",children:m.label}),t("span",{className:"text-muted-foreground font-mono text-xs break-all",children:m.api_id})]},m.api_id))}),t(ae,{children:i(D,{className:"gap-2","data-invalid":z!==null,children:[t(O,{htmlFor:f,children:n("provider.modelsJson")}),t(we,{id:f,"aria-invalid":z!==null,"aria-describedby":`${f}-description`,spellCheck:!1,className:"min-h-44 font-mono text-xs",value:I,onChange:(m)=>{T(m.target.value),K(null)}}),t(de,{id:`${f}-description`,className:J("text-xs",z&&"text-destructive"),role:z?"alert":void 0,children:z??n("provider.modelsJsonDescription")})]})})]}),t(me,{busy:u,canTest:!a,onTest:s?C:void 0,onRemove:s?S:void 0,result:!a?v:void 0,children:i(R,{size:"sm",disabled:u||!a||h.trim()===""||w.trim()===""||!s&&p.trim()==="",onClick:()=>void L(),children:[u&&t(Y,{"data-icon":"inline-start"}),n("provider.saveButton")]})})]})}
|
|
4
4
|
export{Hn,Ki,On,Un,Bn,Jt};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{io}from"./chunk-
|
|
1
|
+
import{io}from"./chunk-3f3y9t21.js";import{createContext as r,useContext as i}from"react";import{jsx as s}from"react/jsx-runtime";var n=r(null);function ir({host:o,children:t}){return s(n,{value:o,children:t})}function x(){let o=i(n),e={...io(),...o};if(e.t===void 0||e.i18n===void 0)throw Error("Collection host is missing; mount collections inside SessionListProvider or CollectionHostProvider");return e}function Zn(o,t){t.catch((e)=>{if(o.reportError)o.reportError(e);else console.error(e)})}function J(){let o=x();return(t)=>Zn(o,t)}function Qn(){return typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent)}
|
|
2
2
|
export{ir,x,Zn,J,Qn};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{et}from"./chunk-w8qn76a1.js";import{Ai}from"./chunk-8zrfdjy4.js";import{t}from"./chunk-zyvvk8b2.js";import{Z}from"./chunk-
|
|
1
|
+
import{et}from"./chunk-w8qn76a1.js";import{Ai}from"./chunk-8zrfdjy4.js";import{t}from"./chunk-zyvvk8b2.js";import{Z}from"./chunk-b6nbarjg.js";import{wn}from"./chunk-qn2jfxff.js";import{isContentEntry as f,isEmbeddedResource as y,isResourceLink as g}from"@nyssance/codex-acp-v2/client";import{memo as k,useMemo as v}from"react";import{jsx as l,jsxs as u,Fragment as T}from"react/jsx-runtime";function R({item:n}){if(n.name==="view_image"&&n.status==="completed")return null;let r=n.content.filter(f).filter((o)=>y(o.content)||g(o.content));if(r.length===0)return null;return u("fieldset",{className:"mt-1 min-w-0",children:[l("legend",{className:"text-muted-foreground text-xs",children:n.title??n.name}),r.map((o,s)=>l(Z,{block:o.content},`${n.id}:${s}`))]})}var vn=k(function({sessionId:r,items:o,terminals:s,streamingThoughtId:d}){let p=t(),i=o.every(wn),c=p.toolBlock,a=v(()=>o.map((e)=>{let m={...Ai(e,s,e.kind==="thought"&&e.id===d),id:JSON.stringify([r,i?"history":"live",e.id])};return m.type==="tool_use"&&e.kind==="tool"&&c!==void 0?c(m,e):m}),[r,i,o,s,d,c]);return u(T,{children:[l(et,{blocks:a,defaultExpanded:!i}),o.map((e)=>e.kind==="tool"&&l(R,{item:e},e.id))]})});
|
|
2
2
|
export{vn};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{ExternalLinkIcon as d}from"lucide-react";import{Button as n}from"@nyssance/shadcn/vega/components/ui/button";import{Card as c,CardContent as s,CardDescription as p,CardFooter as C,CardHeader as m,CardTitle as v}from"@nyssance/shadcn/vega/components/ui/card";import{jsx as a,jsxs as e}from"react/jsx-runtime";function Oo({message:r,url:t,t:i,onOpen:l,onRespond:o}){return e(c,{size:"sm",children:[e(m,{children:[a(p,{children:i("approval.needed")}),a(v,{children:r})]}),a(s,{children:e("div",{className:"flex flex-col gap-3",children:[e(n,{variant:"outline",size:"sm",className:"w-fit",onClick:()=>void l(t),children:[a(d,{"data-icon":"inline-start"}),i("approval.openLink")]}),a("p",{className:"text-muted-foreground text-sm",children:i("approval.waitingForLink")})]})}),e(C,{className:"flex flex-wrap gap-2",children:[a(n,{variant:"outline",size:"sm",onClick:()=>o("decline"),children:i("actions.decline")}),a(n,{variant:"ghost",size:"sm",onClick:()=>o("cancel"),children:i("actions.cancel")})]})]})}
|
|
2
|
+
export{Oo};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{SquareIcon as l}from"lucide-react";import{useRef as u,useState as c}from"react";import{Button as f}from"@nyssance/shadcn/vega/components/ui/button";import{Spinner as p}from"@nyssance/shadcn/vega/components/ui/spinner";import{jsx as r}from"react/jsx-runtime";function ge({title:t,onStop:i}){let[o,a]=c(!1),e=u(!1),s=async()=>{if(e.current)return;e.current=!0,a(!0);try{await i()}finally{e.current=!1,a(!1)}};return r(f,{variant:"ghost",size:"icon",className:"size-5",title:t,"aria-label":t,"aria-busy":o,disabled:o,onKeyDown:(n)=>n.stopPropagation(),onClick:(n)=>{n.stopPropagation(),s()},children:o?r(p,{className:"size-3","aria-label":t}):r(l,{className:"size-3 fill-current"})})}
|
|
2
|
+
export{ge};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ze}from"../chunk-
|
|
1
|
+
import{ze}from"../chunk-pqphdgp6.js";import"../chunk-tpwdaz8k.js";import"../chunk-3f3y9t21.js";import"../chunk-heyqzkxq.js";export{ze as CollectionEmoji};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{qn,er}from"../chunk-
|
|
1
|
+
import{qn,er}from"../chunk-hf3t1bxh.js";import"../chunk-g9gktxv9.js";import"../chunk-22tg663v.js";import"../chunk-tpwdaz8k.js";import"../chunk-667z0pac.js";import"../chunk-py0zbgaj.js";import"../chunk-42atrgm1.js";import"../chunk-t7drk9ja.js";import"../chunk-3f3y9t21.js";import"../chunk-heyqzkxq.js";import"../chunk-2f9vjmxz.js";import"../chunk-92xxp77d.js";export{er as AddToCollectionAction,qn as CollectionPicker};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ji}from"../chunk-
|
|
1
|
+
import{Ji}from"../chunk-ab0err7k.js";import"../chunk-pqphdgp6.js";import"../chunk-g9gktxv9.js";import"../chunk-22tg663v.js";import"../chunk-tpwdaz8k.js";import"../chunk-py0zbgaj.js";import"../chunk-42atrgm1.js";import"../chunk-t7drk9ja.js";import"../chunk-3f3y9t21.js";import"../chunk-heyqzkxq.js";import"../chunk-2f9vjmxz.js";import"../chunk-92xxp77d.js";export{Ji as CollectionPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-667z0pac.js";import"../chunk-92xxp77d.js";import"../chunk-42atrgm1.js";import"../chunk-2f9vjmxz.js";import"../chunk-heyqzkxq.js";import"../chunk-t7drk9ja.js";import"../chunk-py0zbgaj.js";import"../chunk-
|
|
1
|
+
import"../chunk-667z0pac.js";import"../chunk-92xxp77d.js";import"../chunk-42atrgm1.js";import"../chunk-2f9vjmxz.js";import"../chunk-heyqzkxq.js";import"../chunk-t7drk9ja.js";import"../chunk-py0zbgaj.js";import"../chunk-3f3y9t21.js";import{ir,x,Zn,J}from"../chunk-tpwdaz8k.js";import{N,K,Ie,Pt,or}from"../chunk-22tg663v.js";import{Wn,tr,nr,en,de,X}from"../chunk-g9gktxv9.js";import{qn,er}from"../chunk-hf3t1bxh.js";import{ze}from"../chunk-pqphdgp6.js";import{Ji}from"../chunk-ab0err7k.js";export{er as AddToCollectionAction,ze as CollectionEmoji,ir as CollectionHostProvider,Ji as CollectionPanel,qn as CollectionPicker,nr as CollectionProvider,N as DEFAULT_COLLECTION_ID,Pt as applyCollectionAction,tr as createCollectionStore,K as getCollectionName,Ie as initialCollectionData,or as migrateCollections,Wn as parsePersistedCollections,Zn as reportCollection,x as useCollectionHost,de as useCollectionStore,en as useCollectionStoreApi,X as useDispatchCollection,J as useReportCollection};
|