@vellumai/web 0.10.11-dev.202607222129.31c06e5 → 0.10.11-dev.202607222226.fdf0e3d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{account-page-CzZuoekz.js → account-page-Brc6MISg.js} +1 -1
- package/dist/assets/{acp-run-detail-panel-DssICbn8.js → acp-run-detail-panel-BaB6oApm.js} +1 -1
- package/dist/assets/{activity-steps-panel-CeLVlAeY.js → activity-steps-panel-BcgEri9f.js} +1 -1
- package/dist/assets/{add-credits-modal-BFTdUmH6.js → add-credits-modal-D8VLc5nf.js} +1 -1
- package/dist/assets/{ai-page-ukSnDSJr.js → ai-page-Bb7EdV7s.js} +1 -1
- package/dist/assets/api-B81V8R46.js +1 -0
- package/dist/assets/{api-key-screen-DD_TJKco.js → api-key-screen-BfoqLhUk.js} +1 -1
- package/dist/assets/{api-CxAtNZ-r.js → api-njsh6_Bs.js} +1 -1
- package/dist/assets/{assistant-status-panel-gpwr0glD.js → assistant-status-panel-B8rTp6yC.js} +1 -1
- package/dist/assets/{auth-store-Lzg3kiaw.js → auth-store-DFiCpNm7.js} +1 -1
- package/dist/assets/{background-task-detail-panel-BCXH3MXV.js → background-task-detail-panel-CZIZU-3_.js} +1 -1
- package/dist/assets/{billing-page-BZwgqWS1.js → billing-page-DGwhZrg2.js} +1 -1
- package/dist/assets/{bookmarks-page-B-PbfvFN.js → bookmarks-page-CwP69vLh.js} +1 -1
- package/dist/assets/{build-state-Bo2Ut5Js.js → build-state-CA1JhsTu.js} +1 -1
- package/dist/assets/{channels-page-route-DEwl411M.js → channels-page-route-DbL7iC5n.js} +1 -1
- package/dist/assets/chat-AyO7_TjY.js +1 -0
- package/dist/assets/{command-palette-DNujIsf0.js → command-palette-DfE8WPM2.js} +1 -1
- package/dist/assets/{command-palette-window-page-mWNMMe4I.js → command-palette-window-page-Di4lY1el.js} +1 -1
- package/dist/assets/{community-page-DEcDCjsQ.js → community-page-DRXMghFZ.js} +1 -1
- package/dist/assets/{connect-page-DuBhY8KD.js → connect-page-D5jd0unh.js} +1 -1
- package/dist/assets/{contacts-page-route-BS2duMoh.js → contacts-page-route-Do3cZjIj.js} +1 -1
- package/dist/assets/{credentials-page-DDgYexAA.js → credentials-page-DmCYY2QW.js} +1 -1
- package/dist/assets/{debug-page-B_us491I.js → debug-page-Bem_rAMk.js} +1 -1
- package/dist/assets/{deploy-dialogs-CB5PSyxZ.js → deploy-dialogs-D_yy-neK.js} +1 -1
- package/dist/assets/{detail-panel-stop-button-26G26Tqs.js → detail-panel-stop-button-BMz-xYCK.js} +1 -1
- package/dist/assets/{developer-page-Dqug_k0U.js → developer-page-CiNWt3KG.js} +1 -1
- package/dist/assets/{dictation-overlay-page-Rz3bqW3f.js → dictation-overlay-page-DqQ_F091.js} +1 -1
- package/dist/assets/{document-viewer-page-DmHPShuz.js → document-viewer-page-D5RPZJ1O.js} +1 -1
- package/dist/assets/{emails-page-s9TxP6jP.js → emails-page-CRhlPbt6.js} +1 -1
- package/dist/assets/{general-page-DsrG3cM2.js → general-page-BEmmiAzs.js} +1 -1
- package/dist/assets/{hatching-screen-CuzULcU_.js → hatching-screen-4Z3AxjGv.js} +1 -1
- package/dist/assets/{home-page-route-Cc3ksf3X.js → home-page-route-CA306IYl.js} +1 -1
- package/dist/assets/{hosting-screen-DufVMlwF.js → hosting-screen-2F8vA0FA.js} +1 -1
- package/dist/assets/{identity-page-route-CUrEsO_0.js → identity-page-route-DTjCYFLa.js} +1 -1
- package/dist/assets/{index-C7ix_asE.js → index-BsMTpxFY.js} +15 -15
- package/dist/assets/index-Co1WDHMj.css +2 -0
- package/dist/assets/{inspect-page-BUAbv6xj.js → inspect-page-iMt1eAC6.js} +1 -1
- package/dist/assets/{integrations-page-9JcrAORp.js → integrations-page-BhzE_ZiZ.js} +1 -1
- package/dist/assets/{intelligence-layout-DJjUScCy.js → intelligence-layout-CHz-mmUi.js} +1 -1
- package/dist/assets/{library-detail-page-BCAZmbR6.js → library-detail-page-CfVdveNt.js} +1 -1
- package/dist/assets/{library-page-CiTHHvZ5.js → library-page-D1QDzlf4.js} +1 -1
- package/dist/assets/{login-flow-DYrO-od6.js → login-flow-DMIeEfWg.js} +1 -1
- package/dist/assets/{login-page-DAFzFbRp.js → login-page-C6SqhtR2.js} +1 -1
- package/dist/assets/{logout-page-CsPkQ-4I.js → logout-page-B-X-L9k5.js} +1 -1
- package/dist/assets/{logs-layout-DBJaWlOK.js → logs-layout-DPMZA-O1.js} +1 -1
- package/dist/assets/{memory-page-route-CpPfBU9j.js → memory-page-route-Ne8JUsOW.js} +1 -1
- package/dist/assets/{memory-router-playground-page-DfGhXcZW.js → memory-router-playground-page-C8jJtDLj.js} +1 -1
- package/dist/assets/{mobile-sidebar-drawer-CVT3O8os.js → mobile-sidebar-drawer-BjszmBF6.js} +1 -1
- package/dist/assets/{notifications-page-DcHyVoSk.js → notifications-page-Du7crR6A.js} +1 -1
- package/dist/assets/{oauth-complete-page-DjKBNbdN.js → oauth-complete-page-Brtuma6j.js} +1 -1
- package/dist/assets/{oauth-popup-complete-page-2KKVC5zM.js → oauth-popup-complete-page-D5g6MZ4d.js} +1 -1
- package/dist/assets/{pairing-page-7NMcVDJj.js → pairing-page-CO0LtKfr.js} +1 -1
- package/dist/assets/{personality-page-CwaMBzXV.js → personality-page-BQZk4A6Z.js} +1 -1
- package/dist/assets/{plans-page-Cre3Gpys.js → plans-page-DfnKTk9p.js} +1 -1
- package/dist/assets/{platform-loopback-page-CIcVs3UP.js → platform-loopback-page-CRMnnLSN.js} +1 -1
- package/dist/assets/{plugin-detail-page-R7HOcOd1.js → plugin-detail-page-CuIJmGNQ.js} +1 -1
- package/dist/assets/{privacy-page-CTQpOjs-.js → privacy-page-Cbr2J_gh.js} +1 -1
- package/dist/assets/{privacy-screen-DgHmBdN-.js → privacy-screen-D5chSebS.js} +1 -1
- package/dist/assets/{provider-callback-page-kcYxB4WF.js → provider-callback-page-Bnjzi648.js} +1 -1
- package/dist/assets/{provider-signup-page-D9aI4WFt.js → provider-signup-page-B_PmbXYx.js} +1 -1
- package/dist/assets/{quick-input-page-D2Bqa3St.js → quick-input-page-scF5KfOk.js} +1 -1
- package/dist/assets/{research-mock-page-C6zrZtBI.js → research-mock-page-BmmCclnT.js} +1 -1
- package/dist/assets/{research-onboarding-route-AYDHEowO.js → research-onboarding-route-B9yebuRo.js} +1 -1
- package/dist/assets/{review-terms-screen-BSa9jNvG.js → review-terms-screen-DpLbFygO.js} +1 -1
- package/dist/assets/{risk-C-ZyBTAb.js → risk-BbqTlLoT.js} +1 -1
- package/dist/assets/{schedules-page-gqD1Tbf8.js → schedules-page-CLKGqL2h.js} +1 -1
- package/dist/assets/{select-assistant-screen-CFvCmydl.js → select-assistant-screen-B7zJyRf3.js} +1 -1
- package/dist/assets/{settings-layout-XYxLMpW0.js → settings-layout-N2P6bg_P.js} +1 -1
- package/dist/assets/{share-feedback-modal-Bjh3dK-n.js → share-feedback-modal-CGUQYbcY.js} +1 -1
- package/dist/assets/{sidebar-tree-CDqUGPSK.js → sidebar-tree-GQdUfwEG.js} +1 -1
- package/dist/assets/{signup-page-DgYRwrxX.js → signup-page-AHd7CzDk.js} +1 -1
- package/dist/assets/{site-favicon-DHBOONR1.js → site-favicon-qbssi9h0.js} +1 -1
- package/dist/assets/{skill-detail-page-Dnh8ep5N.js → skill-detail-page-IkwqlMc9.js} +1 -1
- package/dist/assets/{skill-detail-panel-DIn7RLCC.js → skill-detail-panel-BnPL69AH.js} +1 -1
- package/dist/assets/{start-screen-CJb-0lgs.js → start-screen-D7qK4_O6.js} +1 -1
- package/dist/assets/{subagent-detail-panel-V44LtNl6.js → subagent-detail-panel-eat_ca9O.js} +1 -1
- package/dist/assets/{subagent-store-CPEG25fH.js → subagent-store-BqwOmsC4.js} +1 -1
- package/dist/assets/{superpowers-page-X0kSM_TF.js → superpowers-page-CCltvRrV.js} +1 -1
- package/dist/assets/{system-events-page-Duos2ubJ.js → system-events-page-D3UMuAxB.js} +1 -1
- package/dist/assets/{theme-stage-page-BU-Gj4c2.js → theme-stage-page-B0b1KPVd.js} +1 -1
- package/dist/assets/{tier-upgrade-resize-modal-CbRtJhAf.js → tier-upgrade-resize-modal-D-trbxhu.js} +1 -1
- package/dist/assets/{tiptap-document-editor-D1aVS6nK.js → tiptap-document-editor-nlPnBJTC.js} +1 -1
- package/dist/assets/{tool-detail-panel-C-O4opDs.js → tool-detail-panel-aB_RZH3q.js} +1 -1
- package/dist/assets/{upgrade-cancel-page-UaVSwAVr.js → upgrade-cancel-page-ePjord_D.js} +1 -1
- package/dist/assets/{upgrade-success-page-CBs03tVb.js → upgrade-success-page-DmACs_Gb.js} +1 -1
- package/dist/assets/{use-assistant-identity-details-CKel0e_r.js → use-assistant-identity-details-DAh21AVC.js} +1 -1
- package/dist/assets/{use-edge-swipe-back-Dv1ShCT7.js → use-edge-swipe-back-ml98jO84.js} +1 -1
- package/dist/assets/{use-invite-link-dialog-BfVPh6F5.js → use-invite-link-dialog-pv0KHLJJ.js} +1 -1
- package/dist/assets/use-is-org-ready-H4X9wAlh.js +1 -0
- package/dist/assets/{use-onboarding-login-DMLLDHRX.js → use-onboarding-login-DWNrcKii.js} +1 -1
- package/dist/assets/{use-skill-actions-DPXX5qWL.js → use-skill-actions-BTN8htgq.js} +1 -1
- package/dist/assets/{use-skill-detail-files-CuoCiyOy.js → use-skill-detail-files-BXcNZGCQ.js} +1 -1
- package/dist/assets/{voice-page-DdjI8A76.js → voice-page-qgegfGhx.js} +1 -1
- package/dist/assets/{weather-forecast-display-0GtxW555.js → weather-forecast-display-hOGfsTJY.js} +1 -1
- package/dist/assets/{welcome-screen-DZhajJW3.js → welcome-screen-D1epZurC.js} +1 -1
- package/dist/assets/{workflow-detail-panel-Cw0kRLTK.js → workflow-detail-panel-BhP4XSwW.js} +1 -1
- package/dist/assets/{workspace-page-7j1DZUlp.js → workspace-page-DtQtJrjC.js} +1 -1
- package/dist/index.html +13 -13
- package/package.json +1 -1
- package/dist/assets/api-DqHVnn1b.js +0 -1
- package/dist/assets/chat-CNlH625o.js +0 -1
- package/dist/assets/index-BRSW3eiH.css +0 -2
- package/dist/assets/use-is-org-ready-Ba5vxuqM.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{a as i,n as a,s as o}from"./auth-store-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{a as i,n as a,s as o}from"./auth-store-DFiCpNm7.js";import{f as s}from"./native-biometric-DG8Pfu_V.js";import{u as c}from"./routes-D4ff4ONd.js";import{n as l,t as u}from"./login-flow-DMIeEfWg.js";import{Ba as d}from"./index-BsMTpxFY.js";import{r as f,t as p}from"./account-shell-Bw5tLjak.js";var m=e(t(),1),h=r();function g(){let e=i(),t=o(),r=a.use.user(),g=a.use.logout(),[_,v]=(0,m.useState)(null),[y,b]=(0,m.useState)(!1),x=async()=>{v(null),b(!0);try{await s(l,u)}catch(e){console.error(`[account] auth flow failed:`,e),v(`Something went wrong. Please try again.`),b(!1)}};return t?(0,h.jsx)(p,{children:(0,h.jsx)(f,{title:`Loading...`})}):e?(0,h.jsxs)(p,{children:[(0,h.jsx)(f,{title:`Welcome${r?.username?`, ${r.username}`:``}!`,subtitle:`You are signed in.`}),(0,h.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,h.jsx)(n,{to:c.assistant,className:`inline-flex w-full items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] no-underline transition-colors hover:bg-[var(--primary-hover)]`,children:`Go to your assistant`}),(0,h.jsx)(`button`,{type:`button`,onClick:async()=>{await g(),d(c.account.login)},className:`cursor-pointer bg-transparent text-sm font-normal text-[var(--content-secondary)] transition-colors hover:text-[var(--content-default)]`,children:`Sign out`})]})]}):(0,h.jsxs)(p,{children:[(0,h.jsx)(f,{title:`Welcome to Vellum`,subtitle:`Sign in to get started.`}),_&&(0,h.jsx)(`p`,{className:`text-center text-sm text-[var(--system-negative-strong)]`,children:_}),(0,h.jsx)(`div`,{className:`flex flex-col items-center gap-4`,children:(0,h.jsx)(`button`,{type:`button`,onClick:()=>void x(),disabled:y,className:`inline-flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] transition-colors hover:bg-[var(--primary-hover)] disabled:opacity-50`,children:`Sign in`})})]})}export{g as AccountPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-anSemq95.js";import{t as n}from"./react-DJZBPgpf.js";import{t as r}from"./button-CW7wKp2r.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{t as a}from"./typography-1kyF_Eu1.js";import{t as o}from"./createLucideIcon-Bjb-Kuq7.js";import{t as s}from"./arrow-left-C2re-gYj.js";import{t as c}from"./brain-Ci5ws6Wl.js";import{t as l}from"./chevron-down-DpYf9Gwq.js";import{r as u}from"./panel-item-D1WbMkez.js";import{t as d}from"./circle-check-DqvTjWle.js";import{w as f}from"./menu-DSB0wFjY.js";import{t as p}from"./code-B_ruRFrX.js";import{t as m}from"./file-text-DA128T4K.js";import{t as h}from"./globe-DgKSh933.js";import{t as g}from"./repeat-BhXOPeQU.js";import{t as _}from"./triangle-alert-CnjNKhNx.js";import{t as v}from"./x-CswtfvgS.js";import"./src-BT0gNVcT.js";import{t as y}from"./tag-CJyI1Y2J.js";import{t as b}from"./chat-markdown-message-CjK8FRpm.js";import{t as x}from"./three-dot-indicator-BuZzHFUJ.js";import{Ct as S,Ft as C,Go as ee,Ho as w,It as T,Lt as te,Rt as E,St as ne,Vo as re,Xo as ie,Zo as ae,ms as oe,qs as D,wt as se,zs as ce}from"./index-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-anSemq95.js";import{t as n}from"./react-DJZBPgpf.js";import{t as r}from"./button-CW7wKp2r.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{t as a}from"./typography-1kyF_Eu1.js";import{t as o}from"./createLucideIcon-Bjb-Kuq7.js";import{t as s}from"./arrow-left-C2re-gYj.js";import{t as c}from"./brain-Ci5ws6Wl.js";import{t as l}from"./chevron-down-DpYf9Gwq.js";import{r as u}from"./panel-item-D1WbMkez.js";import{t as d}from"./circle-check-DqvTjWle.js";import{w as f}from"./menu-DSB0wFjY.js";import{t as p}from"./code-B_ruRFrX.js";import{t as m}from"./file-text-DA128T4K.js";import{t as h}from"./globe-DgKSh933.js";import{t as g}from"./repeat-BhXOPeQU.js";import{t as _}from"./triangle-alert-CnjNKhNx.js";import{t as v}from"./x-CswtfvgS.js";import"./src-BT0gNVcT.js";import{t as y}from"./tag-CJyI1Y2J.js";import{t as b}from"./chat-markdown-message-CjK8FRpm.js";import{t as x}from"./three-dot-indicator-BuZzHFUJ.js";import{Ct as S,Ft as C,Go as ee,Ho as w,It as T,Lt as te,Rt as E,St as ne,Vo as re,Xo as ie,Zo as ae,ms as oe,qs as D,wt as se,zs as ce}from"./index-BsMTpxFY.js";import{t as le}from"./status-badge-pill-j3ke1d9o.js";var ue=o(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),de=o(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),O=e(n(),1),k=``;function A(e,t){switch(e){case`complete`:case`completed`:return`completed`;case`failed`:case`error`:return`error`;case void 0:return t;default:return`running`}}function fe(e){return(e.messageId?.startsWith(`local-marker-`)??!1)||(e.content?.startsWith(`↻ Steering: `)??!1)}function j(e){let t=e??``;return t.startsWith(`↻ Steering: `)?t.slice(C.length):t}function M(e){let t=e[e.length-1];t&&(t.kind===`agent`||t.kind===`thinking`)&&!t.isComplete&&(e[e.length-1]={...t,isComplete:!0})}function N(e,t){if(t.updateType===`agent_message_chunk`&&fe(t)){M(e),e.push({kind:`user`,id:t.messageId??`steer-${e.length}`,content:j(t.content)});return}switch(t.updateType){case`user_message_chunk`:{let n=t.messageId??k,r=j(t.content),i=e[e.length-1];i&&i.kind===`user`&&i.id===n?e[e.length-1]={...i,content:i.content+r}:(M(e),e.push({kind:`user`,id:n,content:r}));let a=e[e.length-1].content;for(let t=0;t<e.length-1;t++){let n=e[t];if(n.kind===`user`&&n.id.startsWith(`local-marker-`)&&n.content===a){e.splice(t,1);break}}return}case`agent_message_chunk`:{let n=t.messageId??k,r=e[e.length-1];if(r&&r.kind===`agent`&&r.messageId===n){e[e.length-1]={...r,content:r.content+(t.content??``)};return}if(n!==k&&r&&r.kind===`agent`&&r.messageId===k&&!r.isComplete&&r.content===(t.content??``)){e[e.length-1]={...r,messageId:n};return}M(e),e.push({kind:`agent`,messageId:n,content:t.content??``,isComplete:!1});return}case`agent_thought_chunk`:{let n=t.messageId??k,r=e[e.length-1];if(r&&r.kind===`thinking`&&r.messageId===n){e[e.length-1]={...r,content:r.content+(t.content??``)};return}M(e),e.push({kind:`thinking`,messageId:n,content:t.content??``,isComplete:!1});return}case`tool_call`:{let n=t.toolCallId;if(n===void 0)return;M(e),e.push({kind:`tool`,toolCallId:n,title:t.toolTitle??``,toolKind:t.toolKind,status:A(t.toolStatus,`running`),content:t.content,locations:P(t),rawInput:t.rawInput,rawOutput:t.rawOutput});return}case`tool_call_update`:{let n=t.toolCallId;if(n===void 0)return;let r=e.findIndex(e=>e.kind===`tool`&&e.toolCallId===n);if(r===-1)return;let i=e[r],a=P(t);e[r]={...i,title:t.toolTitle??i.title,toolKind:t.toolKind??i.toolKind,status:A(t.toolStatus,i.status),content:t.content??i.content,locations:a??i.locations,rawInput:t.rawInput===void 0?i.rawInput:t.rawInput,rawOutput:t.rawOutput===void 0?i.rawOutput:t.rawOutput};return}case`plan`:{let n=pe(t.content);if(n===null)return;let r=e.findIndex(e=>e.kind===`plan`),i={kind:`plan`,entries:n};r===-1?(M(e),e.push(i)):e[r]=i;return}}}function P(e){let t=e.locations;if(!Array.isArray(t))return;let n=[];for(let e of t){let t=e??{};typeof t.path==`string`&&n.push(typeof t.line==`number`?{path:t.path,line:t.line}:{path:t.path})}return n}function pe(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}let n=Array.isArray(t)?t:Array.isArray(t?.entries)?t.entries:null;return n===null?null:n.map(e=>{let t=e??{},n=t.content??t.label??``;return{label:typeof n==`string`?n:String(n),checked:t.checked===!0||t.status===`completed`}})}function me(e){let t=[];for(let n of e)N(t,n);return t}function F(e,t){if(e===t)return{kind:`identity`};if(e===null)return{kind:`first`};if(t.length<e.length)return{kind:`fallback`};for(let n=0;n<e.length;n++)if(e[n]!==t[n])return n===e.length-1&&t.length===e.length?{kind:`mutate-last`}:{kind:`fallback`};return t.length===e.length?{kind:`identity`}:{kind:`append`,from:e.length}}function I(){let e=null,t=[];function n(n){return t=me(n),e=n,t}function r(r){let i=F(e,r);switch(i.kind){case`identity`:return t;case`first`:return n(r);case`append`:{let n=t.slice();for(let e=i.from;e<r.length;e++)N(n,r[e]);return e=r,t=n,t}case`mutate-last`:case`fallback`:return n(r)}}return{project:r}}function L(e){let t=(0,O.useRef)(null);return t.current??=I(),t.current.project(e)}function R(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{let t=e.trimStart();return t.startsWith(`{`)||t.startsWith(`[`)?[]:[{type:`content`,text:e}]}let n=Array.isArray(t)?t:[t],r=[];for(let e of n){let t=z(e);t&&r.push(t)}return r}function z(e){if(typeof e!=`object`||!e)return null;let t=e;switch(t.type){case`content`:return{type:`content`,text:he(t.content)};case`diff`:return typeof t.path!=`string`||typeof t.newText!=`string`?null:{type:`diff`,path:t.path,newText:t.newText,...typeof t.oldText==`string`?{oldText:t.oldText}:{}};case`terminal`:{let e=ge(t);return e===void 0?{type:`terminal`}:{type:`terminal`,text:e}}default:return null}}function he(e){if(typeof e==`string`)return e;if(typeof e==`object`&&e){let t=e.text;if(typeof t==`string`)return t}return``}function ge(e){if(typeof e.text==`string`)return e.text;if(typeof e.output==`string`)return e.output;if(typeof e.content==`string`)return e.content;if(typeof e.content==`object`&&e.content!==null){let t=e.content.text;if(typeof t==`string`)return t}}function B(e){if(typeof e!=`object`||!e)return;let t=e.command;return typeof t==`string`?t:void 0}function V(e){return R(e).filter(e=>e.type===`content`||e.type===`terminal`).map(e=>`text`in e?e.text??``:``).filter(e=>e.length>0).join(`
|
|
2
2
|
`)}function H(e){if(e!=null){if(typeof e==`string`)return e;if(typeof e==`object`)try{return JSON.stringify(e,null,2)}catch{return String(e)}return String(e)}}function U(e,t){let n=new Map;for(let t of e)t.type===`diff`&&n.set(t.path,{path:t.path,newText:t.newText,...t.oldText===void 0?{}:{oldText:t.oldText}});for(let e of t??[])n.has(e.path)||n.set(e.path,{path:e.path});return Array.from(n.values())}var W=i();function _e({content:e,isComplete:t}){return(0,W.jsxs)(`div`,{"data-testid":`acp-chat-agent-message`,className:`flex w-full flex-col items-start text-chat text-[var(--content-default)]`,children:[(0,W.jsx)(b,{content:e}),!t&&(0,W.jsx)(x,{className:`mt-1`,"data-testid":`acp-chat-agent-streaming`})]})}function ve({entries:e}){return e.length===0?null:(0,W.jsxs)(`div`,{"data-testid":`acp-chat-plan-block`,className:`w-full rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] p-3`,children:[(0,W.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 text-[var(--content-tertiary)]`,children:[(0,W.jsx)(oe,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),(0,W.jsx)(a,{variant:`body-small-emphasised`,className:`text-inherit`,children:`Plan`})]}),(0,W.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:e.map((e,t)=>(0,W.jsxs)(`li`,{"data-testid":`acp-chat-plan-entry`,"data-checked":e.checked,className:`flex items-start gap-2`,children:[e.checked?(0,W.jsx)(d,{"aria-hidden":!0,className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--system-positive-strong)]`}):(0,W.jsx)(f,{"aria-hidden":!0,className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-disabled)]`}),(0,W.jsx)(`span`,{className:e.checked?`text-body-small-default text-[var(--content-tertiary)] line-through`:`text-body-small-default text-[var(--content-default)]`,children:e.label})]},t))})]})}function ye(e){switch(e){case`max_tokens`:case`max_turn_requests`:return`Stopped: limit reached`;case`refusal`:return`Refused`;case`cancelled`:return`Cancelled`;default:return`Completed`}}function be(e){return new Date(e).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}function G({completedAt:e}){return e===void 0?null:(0,W.jsxs)(`span`,{"data-testid":`acp-chat-terminal-time`,children:[`at `,be(e)]})}function xe({status:e,stopReason:t,error:n,completedAt:r}){if(E(e))return null;if(e===`failed`)return(0,W.jsxs)(`div`,{"data-testid":`acp-chat-terminal-block`,"data-terminal-kind":`failed`,className:`flex items-start gap-2 rounded-lg bg-[var(--system-negative-weak)] px-3 py-2 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,W.jsx)(`span`,{"aria-hidden":!0,"data-testid":`acp-chat-terminal-failed-icon`,className:`flex h-[12px] w-4 shrink-0 items-center justify-center`,children:(0,W.jsx)(_,{className:`h-4 w-4`})}),(0,W.jsx)(`span`,{children:n??`Run failed`})]});if(e===`cancelled`)return(0,W.jsxs)(`div`,{"data-testid":`acp-chat-terminal-block`,"data-terminal-kind":`cancelled`,className:`flex items-center gap-2 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,W.jsx)(ce,{"aria-hidden":!0,className:`h-4 w-4 shrink-0`}),(0,W.jsx)(`span`,{children:`Cancelled`}),(0,W.jsx)(G,{completedAt:r})]});let i=ye(t);return(0,W.jsxs)(`div`,{"data-testid":`acp-chat-terminal-block`,"data-terminal-kind":`completed`,className:`flex items-center gap-2 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,W.jsx)(d,{"aria-hidden":!0,className:`h-4 w-4 shrink-0 text-[var(--system-positive-strong)]`}),(0,W.jsx)(`span`,{children:i}),(0,W.jsx)(G,{completedAt:r})]})}function Se({showDot:e,isLast:t,children:n}){return(0,W.jsxs)(`div`,{className:`relative flex items-start gap-2${t?``:` pb-4`}`,children:[!t&&(0,W.jsx)(`div`,{"aria-hidden":!0,className:`absolute bottom-0 left-[6.5px] w-px bg-[var(--border-element)] ${e?`top-[16px]`:`top-0`}`}),e?(0,W.jsx)(`span`,{"aria-hidden":!0,"data-testid":`acp-chat-timeline-dot`,className:`flex h-[14px] w-[14px] shrink-0 items-center justify-center`,children:(0,W.jsx)(`span`,{className:`h-[5px] w-[5px] rounded-full bg-[var(--content-disabled)]`})}):(0,W.jsx)(`span`,{"aria-hidden":!0,className:`h-[14px] w-[14px] shrink-0`}),(0,W.jsx)(`div`,{className:`min-w-0 flex-1`,children:n})]})}function Ce({content:e,isComplete:t}){let[n,r]=(0,O.useState)(null),i=n??!t,a=e.trim().length>0,o=t?`Thought process`:`Thinking`,s=t?(0,W.jsx)(c,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}):(0,W.jsx)(x,{dotSize:5,className:`shrink-0`,"data-testid":`acp-chat-thinking-streaming`});return a?(0,W.jsxs)(`div`,{"data-testid":`acp-chat-thinking-block`,className:`w-full`,children:[(0,W.jsxs)(`button`,{type:`button`,"aria-expanded":i,onClick:()=>r(!i),"data-testid":`acp-chat-thinking-toggle`,className:`flex w-full items-center gap-1.5 text-body-small-default text-[var(--content-tertiary)] transition-colors hover:text-[var(--content-secondary)]`,children:[i?(0,W.jsx)(l,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}):(0,W.jsx)(u,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),s,(0,W.jsx)(`span`,{children:o})]}),i&&(0,W.jsx)(`div`,{"data-testid":`acp-chat-thinking-body`,className:`mt-1.5 border-l-2 border-[var(--border-base)] pl-3 text-body-small-default text-[var(--content-tertiary)]`,children:(0,W.jsx)(b,{content:e})})]}):(0,W.jsx)(`div`,{"data-testid":`acp-chat-thinking-block`,className:`w-full`,children:(0,W.jsxs)(`div`,{className:`flex w-full items-center gap-1.5 text-body-small-default text-[var(--content-tertiary)]`,children:[s,(0,W.jsx)(`span`,{children:o})]})})}var we={running:`neutral`,completed:`positive`,error:`negative`,ended:`neutral`},Te={running:`Running`,completed:`Completed`,error:`Failed`,ended:`Ended`},Ee={read:`Read file`,edit:`Edit file`,delete:`Delete file`,move:`Move file`,search:`Search`,execute:`Run command`,think:`Thinking`,fetch:`Fetch`,switch_mode:`Switch mode`},De=`Tool call`,Oe={read:m,edit:ue,delete:re,move:de,search:ae,execute:w,think:c,fetch:h,switch_mode:g},ke=new Set([`read`,`edit`,`delete`,`move`]);function Ae({toolKind:e}){return(0,W.jsx)(e&&Oe[e]||p,{"aria-hidden":!0,className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)]`})}function K({label:e,value:t,testId:n}){return(0,W.jsxs)(`div`,{"data-testid":n,children:[(0,W.jsx)(`div`,{className:`mb-1 text-body-small-default text-[var(--content-tertiary)]`,children:e}),(0,W.jsx)(`pre`,{className:`max-h-60 overflow-auto rounded-md border border-[var(--border-element)] bg-[var(--surface-base)] p-2.5 font-mono text-body-small-default text-[var(--content-secondary)]`,children:t})]})}function je({block:e,isTerminal:t=!1,onOpenDiff:n,onOpenOutput:r}){let[i,o]=(0,O.useState)(!1),s=(0,O.useMemo)(()=>R(e.content),[e.content]),c=(0,O.useMemo)(()=>V(e.content),[e.content]),d=(0,O.useMemo)(()=>c.split(`
|
|
3
3
|
`).map(e=>e.trim()).find(e=>e.length>0&&!e.startsWith("```"))||`View output`,[c]),f=(0,O.useMemo)(()=>U(s,e.locations),[s,e.locations]),p=t&&e.status===`running`?`ended`:e.status,h=p===`running`,g=e.toolKind&&Ee[e.toolKind]||De,_=B(e.rawInput)??e.title,v=_&&_!==g&&(!ke.has(e.toolKind??``)||f.length===0)?_:null,b=H(e.rawInput),S=H(e.rawOutput),C=b!==void 0||S!==void 0;return(0,W.jsxs)(`div`,{"data-testid":`acp-chat-tool-card`,"data-status":e.status,className:`w-full rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] p-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(Ae,{toolKind:e.toolKind}),(0,W.jsx)(a,{variant:`body-small-emphasised`,className:`min-w-0 flex-1 truncate text-[var(--content-default)]`,title:e.title,children:g}),(0,W.jsx)(y,{tone:we[p],"data-testid":`acp-chat-tool-status`,children:Te[p]}),h&&(0,W.jsx)(x,{className:`shrink-0`,"data-testid":`acp-chat-tool-running`})]}),v&&(0,W.jsx)(`div`,{"data-testid":`acp-chat-tool-detail`,className:`mt-1.5 font-mono text-body-small-default whitespace-pre-wrap break-words text-[var(--content-secondary)]`,children:v}),f.length>0&&(0,W.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:f.map(t=>{let r=t.oldText!==void 0||t.newText!==void 0,i=`flex max-w-full items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-2 py-1 text-body-small-default text-[var(--content-secondary)]`;return r?(0,W.jsxs)(`button`,{type:`button`,"data-testid":`acp-chat-tool-file-chip`,onClick:()=>n(e.toolCallId,t),title:t.path,className:`${i} cursor-pointer transition-colors hover:bg-[var(--surface-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--border-focus)]`,children:[(0,W.jsx)(m,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`truncate font-mono`,children:t.path})]},t.path):(0,W.jsxs)(`span`,{"data-testid":`acp-chat-tool-file-ref`,title:t.path,className:i,children:[(0,W.jsx)(m,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`truncate font-mono`,children:t.path})]},t.path)})}),c.length>0&&(0,W.jsxs)(`button`,{type:`button`,"data-testid":`acp-chat-tool-output-open`,onClick:()=>r?.(e.toolCallId),className:`mt-2 flex w-full items-center gap-2 rounded-md border border-[var(--border-element)] bg-[var(--surface-base)] px-2.5 py-2 text-left transition-colors hover:bg-[var(--surface-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--border-focus)]`,children:[(0,W.jsx)(w,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0 text-[var(--content-tertiary)]`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-body-small-default text-[var(--content-secondary)]`,children:d}),(0,W.jsx)(u,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0 text-[var(--content-tertiary)]`})]}),C&&(0,W.jsxs)(`div`,{className:`mt-2`,"data-testid":`acp-chat-tool-raw`,children:[(0,W.jsxs)(`button`,{type:`button`,"data-testid":`acp-chat-tool-raw-toggle`,"aria-expanded":i,onClick:()=>o(e=>!e),className:`flex items-center gap-1 text-body-small-default text-[var(--content-tertiary)] transition-colors hover:text-[var(--content-default)]`,children:[i?(0,W.jsx)(l,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}):(0,W.jsx)(u,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:i?`Hide raw input/output`:`Show raw input/output`})]}),i&&(0,W.jsxs)(`div`,{className:`mt-1.5 flex flex-col gap-2`,children:[b!==void 0&&(0,W.jsx)(K,{label:`Raw input`,value:b,testId:`acp-chat-tool-raw-input`}),S!==void 0&&(0,W.jsx)(K,{label:`Raw output`,value:S,testId:`acp-chat-tool-raw-output`})]})]})]})}function Me({content:e}){return(0,W.jsx)(`div`,{"data-testid":`acp-chat-user-turn`,className:`flex w-full justify-end`,children:(0,W.jsx)(`div`,{className:`max-w-[80%] rounded-lg bg-[var(--surface-lift)] px-4 py-3 whitespace-pre-wrap text-chat text-[var(--content-default)]`,children:e})})}function Ne(e,t){let n=e=>new Intl.NumberFormat(void 0,{style:`currency`,currency:t}).format(e);return e>0&&e<.01?`<${n(.01)}`:n(e)}var q=new Intl.NumberFormat(`en-US`);function J({label:e,value:t}){return(0,W.jsxs)(`div`,{className:`flex items-baseline gap-1`,"data-usage-stat":e.toLowerCase(),children:[(0,W.jsx)(a,{variant:`label-small-default`,className:`text-[var(--content-tertiary)]`,children:e}),(0,W.jsx)(a,{variant:`body-small-default`,className:`text-[var(--content-secondary)] tabular-nums`,children:t})]})}function Pe({entry:e}){let{inputTokens:t,outputTokens:n,costAmount:r,costCurrency:i}=e;if(t===void 0&&n===void 0)return null;let a=t??0,o=n??0,s=r!=null&&i!=null;return(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,"data-testid":`acp-usage-meter`,children:[(0,W.jsx)(J,{label:`Input`,value:q.format(a)}),(0,W.jsx)(J,{label:`Output`,value:q.format(o)}),s&&(0,W.jsx)(J,{label:`Cost`,value:Ne(r,i)})]})}function Fe({content:e}){return(0,W.jsx)(`div`,{"data-testid":`acp-chat-command-output`,className:`rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] p-3 [&_pre]:!max-h-none`,children:(0,W.jsx)(b,{content:V(e),hardLineBreaks:!0})})}var Y=2e3;function X(e){if(e===``)return[];let t=e.split(`
|
|
4
4
|
`);return e.endsWith(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-CW7wKp2r.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{t as i}from"./typography-1kyF_Eu1.js";import{E as a,S as o,c as s,l as c,x as l}from"./risk-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-CW7wKp2r.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{t as i}from"./typography-1kyF_Eu1.js";import{E as a,S as o,c as s,l as c,x as l}from"./risk-BbqTlLoT.js";import{t as u}from"./chevron-left-B_RAz34t.js";import"./src-BT0gNVcT.js";import{t as d}from"./chat-markdown-message-CjK8FRpm.js";import{C as f,a as p,i as m,n as h,r as g,s as _,y as v}from"./site-favicon-qbssi9h0.js";import{$ as y,E as b,Ga as x,Gt as S,It as C,Q as w,X as T,Y as E,Z as D,et as O,nt as k,tt as A}from"./index-BsMTpxFY.js";import{ToolDetailBody as j,t as M}from"./tool-detail-panel-aB_RZH3q.js";var N=e(t(),1);function P(e,t,n){let r=T(t,n.workflow),i=e=>{let t=w(e,n.workflow.byToolUseId);if(t!==null&&r.has(t))return!0;let i=E(e,n.acpByToolUseId);if(i!==null&&n.acpById[i]!==void 0)return!0;let a=D(e);return a!==void 0&&n.backgroundTaskById[a]!==void 0},a=t.filter(e=>!i(e));if(a.length===t.length)return{items:e,toolCalls:t};let o=new Set(a.map(e=>e.id));return{items:e.filter(e=>e.kind!==`toolCall`||o.has(e.toolCall.id)),toolCalls:a}}function F(e,t){let n=o(),r=x.use.byId(),i=x.use.byToolUseId(),l=x.use.notFoundRunIds(),u=x.use.hydrationFailedRunIds(),d=C.use.byId(),f=C.use.byToolUseId(),p=S.use.byId();return(0,N.useMemo)(()=>{if(!e||t==null)return null;let o=n.find(t=>a(t).includes(e));if(!o)return null;let m=c(o.contentBlocks??[],{splitInlineThinking:o.role!==`user`})[t];if(!m||m.type!==`activity`)return null;let{cardItems:h,toolCalls:g}=s(m.items);return P(h,g,{workflow:{byId:r,byToolUseId:i,notFoundRunIds:l,hydrationFailedRunIds:u},acpById:d,acpByToolUseId:f,backgroundTaskById:p})},[n,e,t,r,i,l,u,d,f,p])}var I=r(),L=60;function R({payload:e,onClose:t}){let[r,a]=(0,N.useState)(null),o=F(e.messageId,e.groupIndex),s=o?.items??e.items,c=o?.toolCalls??e.toolCalls,l=k(s),d=O(l.steps),p=A(l.state,l.steps),m=p===`loading`,h=y(p,l.totalDurationLabel??``,d.failed),g=m&&l.currentStepTitle||h,v=new Map(c.map(e=>[e.id,e])),x=r?r.kind===`thinking`?`Thinking`:r.activity||r.title:``;return(0,I.jsx)(b,{titleNode:r?(0,I.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 py-0.5`,children:[(0,I.jsx)(n,{variant:`ghost`,iconOnly:(0,I.jsx)(u,{}),"aria-label":`Back to all steps`,tooltip:`All steps`,onClick:()=>a(null),className:`-ml-2.5 shrink-0`}),(0,I.jsx)(i,{variant:`title-medium`,className:`min-w-0 shrink truncate leading-snug text-[var(--content-default)]`,children:x})]}):(0,I.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 py-0.5`,children:[(0,I.jsx)(i,{variant:`title-medium`,className:`min-w-0 shrink truncate leading-snug text-[var(--content-default)]`,children:m?(0,I.jsx)(f,{children:g}):g}),l.stepCount?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{"aria-hidden":!0,className:`size-[3px] shrink-0 rounded-full bg-[var(--content-tertiary)]`}),(0,I.jsx)(i,{variant:`title-medium`,className:`shrink-0 whitespace-nowrap leading-snug text-[var(--content-secondary)]`,children:l.stepCount})]}):null]}),closeLabel:`Close steps`,onClose:t,children:r?(0,I.jsx)(B,{detail:r}):(0,I.jsx)(_,{steps:l.steps,timeline:!0,renderStep:t=>(0,I.jsx)(z,{step:t,activeDetail:r,onOpenDetail:a,lookupToolCall:e=>v.get(e),messageId:e.messageId,groupIndex:e.groupIndex})})})}function z({step:e,activeDetail:t,onOpenDetail:n,lookupToolCall:r,messageId:i,groupIndex:a}){if(e.kind===`thinking`){let t=i!=null&&e.thinkingItemIndex!=null?{messageId:i,thinkingGroupIndex:a,thinkingItemIndex:e.thinkingItemIndex}:{};return(0,I.jsx)(m,{iconName:`brain`,label:l(e.text,L),ariaLabel:`View thinking`,active:!1,onClick:()=>n({kind:`thinking`,toolCallId:``,toolName:``,title:`Thinking`,activity:``,input:{},status:`completed`,thinkingText:e.text,...t})})}if(e.kind===`web_search`)return(0,I.jsx)(g,{step:e});if(e.kind===`web_search_error`)return(0,I.jsx)(h,{step:e});if(e.kind!==`tool`)return(0,I.jsx)(p,{step:e});let o=r(e.toolCallId);return(0,I.jsx)(m,{iconName:e.iconName,label:e.activity||e.info||e.title,active:t?.toolCallId===e.toolCallId,onClick:()=>{o&&n(v(o))}})}function B({detail:e}){let t=M(e.kind===`thinking`?e.messageId:void 0,e.thinkingGroupIndex,e.thinkingItemIndex);return(0,I.jsx)(`div`,{className:`flex flex-col gap-4`,children:e.kind===`thinking`?(0,I.jsx)(d,{content:t??e.thinkingText??``,hardLineBreaks:!0}):(0,I.jsx)(j,{detail:e})})}export{R as ActivityStepsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e,r as t}from"./chunk-jRWAZmH_.js";import{t as n}from"./react-DJZBPgpf.js";import{t as r}from"./button-CW7wKp2r.js";import{l as i,m as a,t as o}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{n as s}from"./QueryClientProvider-DKhXIxGb.js";import{t as c}from"./useQuery-B45lW1Kk.js";import{t as l}from"./useMutation-Lj4VunQV.js";import{t as u}from"./jsx-runtime-CVSDxk6A.js";import{t as d}from"./circle-alert-CTnM6GCb.js";import{t as f}from"./loader-circle-Ck8fq3yv.js";import{t as p}from"./modal-D_Y2RPD5.js";import{t as m}from"./dropdown-DQozlhbb.js";import{u as h}from"./routes-D4ff4ONd.js";import{n as g,r as _}from"./browser-Cvy3lr__.js";import{$i as v,Zi as y,ks as b}from"./index-
|
|
1
|
+
import{o as e,r as t}from"./chunk-jRWAZmH_.js";import{t as n}from"./react-DJZBPgpf.js";import{t as r}from"./button-CW7wKp2r.js";import{l as i,m as a,t as o}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{n as s}from"./QueryClientProvider-DKhXIxGb.js";import{t as c}from"./useQuery-B45lW1Kk.js";import{t as l}from"./useMutation-Lj4VunQV.js";import{t as u}from"./jsx-runtime-CVSDxk6A.js";import{t as d}from"./circle-alert-CTnM6GCb.js";import{t as f}from"./loader-circle-Ck8fq3yv.js";import{t as p}from"./modal-D_Y2RPD5.js";import{t as m}from"./dropdown-DQozlhbb.js";import{u as h}from"./routes-D4ff4ONd.js";import{n as g,r as _}from"./browser-Cvy3lr__.js";import{$i as v,Zi as y,ks as b}from"./index-BsMTpxFY.js";var x=t({AddCreditsModal:()=>D}),S=e(n(),1),C=u(),w=[`10.00`,`20.00`,`30.00`,`40.00`,`50.00`,`60.00`,`70.00`,`80.00`,`90.00`,`100.00`];function T(e){let t=parseFloat(e);if(Number.isNaN(t))return`0 credits`;let n=t.toLocaleString(`en-US`,{minimumFractionDigits:2,maximumFractionDigits:2});return`${n.endsWith(`.00`)?n.slice(0,-3):n} credits`}function E(e){if(e&&typeof e==`object`){let t=e.amount;if(Array.isArray(t)&&typeof t[0]==`string`)return t[0]}return`Failed to create checkout session. Please try again.`}function D({open:e,onOpenChange:t}){let n=s(),{pathname:u}=i(),[x]=a(),D=x.toString()?`${u}?${x.toString()}`:u,{data:O,isLoading:k}=c(y()),A=O?.allowed_top_up_amounts?.length?O.allowed_top_up_amounts:w,[j,M]=(0,S.useState)(null),N=j&&A.includes(j)?j:A[0]??w[0],P=l(v());return(0,S.useEffect)(()=>_(()=>{t(!1),n.invalidateQueries(y())}),[t,n]),(0,C.jsx)(p.Root,{open:e,onOpenChange:t,children:(0,C.jsxs)(p.Content,{size:`sm`,children:[(0,C.jsxs)(p.Header,{children:[(0,C.jsx)(p.Title,{icon:b,children:`Add Credits`}),(0,C.jsx)(p.Description,{children:`Purchase credits to continue using the assistant. You'll be redirected to Stripe to complete the payment.`})]}),(0,C.jsx)(p.Body,{children:(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`add-credits-amount`,className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Amount`}),(0,C.jsx)(m,{id:`add-credits-amount`,value:N,onChange:e=>{M(e),P.isError&&P.reset()},disabled:k||!O,options:A.map(e=>({value:e,label:T(e)}))})]}),P.isError&&(0,C.jsxs)(`div`,{className:`flex items-center gap-2 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,C.jsx)(d,{className:`h-3.5 w-3.5 shrink-0`}),E(P.error)]}),(0,C.jsx)(o,{to:h.settings.usageBilling,className:`text-body-small-default text-[var(--content-tertiary)] underline hover:text-[var(--content-secondary)]`,onClick:()=>t(!1),children:`Configure Automatic Top-Ups →`})]})}),(0,C.jsxs)(p.Footer,{children:[(0,C.jsx)(p.Close,{asChild:!0,children:(0,C.jsx)(r,{variant:`outlined`,children:`Cancel`})}),(0,C.jsx)(r,{variant:`primary`,leftIcon:P.isPending?(0,C.jsx)(f,{className:`animate-spin`}):void 0,onClick:()=>{P.isPending||P.mutate({body:{amount:N,return_path:D}},{onSuccess:e=>{g(e.checkout_url)}})},disabled:P.isPending||k||!O,children:`Add credits`})]})]})})}export{x as n,D as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{a as t,c as n,i as r}from"./local-settings-C-dW2vkq.js";import{r as i,t as a}from"./capture-error-anSemq95.js";import{t as o}from"./react-DJZBPgpf.js";import{t as s}from"./button-CW7wKp2r.js";import{m as c,u as l}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{n as u}from"./QueryClientProvider-DKhXIxGb.js";import{t as d}from"./useQuery-B45lW1Kk.js";import{t as f}from"./useMutation-Lj4VunQV.js";import{t as p}from"./jsx-runtime-CVSDxk6A.js";import{t as m}from"./typography-1kyF_Eu1.js";import{t as h}from"./createLucideIcon-Bjb-Kuq7.js";import{t as g}from"./circle-check-DqvTjWle.js";import{t as _}from"./crown-CAZ_Zm41.js";import{t as v}from"./external-link-Cczz6xJ4.js";import{t as y}from"./info-CqgkBvyS.js";import{t as b}from"./loader-circle-Ck8fq3yv.js";import{t as x}from"./notice-CvJ7MBx5.js";import{t as S}from"./tag-CJyI1Y2J.js";import{t as C}from"./input-D3MhHg0d.js";import{t as w}from"./toggle-Ca1aoG-l.js";import{t as T}from"./modal-D_Y2RPD5.js";import{n as E}from"./toast-zHo1wvF9.js";import{t as D}from"./confirm-dialog-DxBl6zcI.js";import{t as O}from"./dropdown-DQozlhbb.js";import{Ut as k,Wt as A,ar as j,lt as M,wn as N}from"./sdk.gen-BR-xXIZm.js";import{Bt as P,H as F,V as I,_t as L,c as R,d as z,f as B,l as V,m as H,p as U,u as W}from"./react-query.gen-DfzfX_Jv.js";import{i as ee,r as G,t as K}from"./utils-DvUW9GK8.js";import{r as te}from"./api-errors-CoE1wFl2.js";import{u as ne}from"./routes-D4ff4ONd.js";import{t as q}from"./use-is-org-ready-Ba5vxuqM.js";import{$a as J,$r as re,Ao as Y,Ar as X,B as Z,Co as ie,Do as ae,Dr as oe,Eo as se,Fr as ce,G as le,H as ue,Ir as de,J as fe,Ji as pe,Jr as me,K as he,Mr as ge,Nr as _e,Oo as ve,Or as ye,Pr as be,Qa as xe,Qr as Se,R as Ce,So as we,To as Te,V as Ee,Vo as De,Xr as Oe,Yr as ke,Za as Ae,Zo as je,Zr as Me,_o as Ne,ai as Pe,ao as Fe,bo as Ie,co as Le,ei as Re,eo as ze,fo as Be,go as Ve,ho as He,io as Ue,jr as We,ko as Ge,kr as Ke,lo as qe,mo as Je,ni as Ye,no as Xe,oi as Ze,oo as Qe,po as $e,q as et,qr as tt,ri as nt,ro as rt,so as it,ti as at,to as ot,vo as st,wo as ct,xo as lt,yo as ut,z as dt}from"./index-C7ix_asE.js";import{i as ft,n as pt,r as mt,t as ht}from"./shared-ui-CUd8SsYi.js";import{t as gt}from"./environment-store-geigPfHz.js";var _t=h(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Q=e(o(),1),vt=`__custom__`;function yt(e){return e?!!(e.profile||e.provider||e.model):!1}function bt(e,t){let n=yt(e);return n===yt(t)?n?(e?.profile??null)===(t?.profile??null)&&(e?.provider??null)===(t?.provider??null)&&(e?.model??null)===(t?.model??null):!0:!1}var $=p();function xt({id:e,displayName:t,description:n,defaultProfileLabel:r,draft:i,profileOptions:a,onDraftChange:o,onToggle:s}){let c=yt(i),l=!i||!c?``:i.provider||i.model?vt:i.profile??``,u=l===vt,d=Fe(),f=d[0]??se[0],p=d.find(e=>e===i?.provider)??f,m=Y(p).map(e=>({value:e.id,label:e.displayName})),h=!!i?.provider&&!i?.model;function g(t){t===`__custom__`?o(e,{profile:null,provider:f,model:Ge(f)??``}):t===``?o(e,null):o(e,{profile:t,provider:null,model:null})}function _(t){let n=Ge(t)??``;o(e,{...i??{},profile:null,provider:t,model:n})}function v(t){o(e,{...i??{},model:t})}return(0,$.jsxs)(`div`,{className:`rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)] p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-body-medium-default font-medium text-[var(--content-default)]`,children:t}),n&&(0,$.jsxs)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:[n,r&&(0,$.jsxs)(`span`,{className:`ml-1.5 text-body-small-default text-[var(--content-tertiary)] opacity-60`,children:[`· Default: `,r]})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[c&&(0,$.jsx)(O,{value:l,onChange:g,options:a,className:`w-44`,menuMinWidth:280,menuAlign:`end`}),(0,$.jsx)(w,{checked:c,onChange:t=>s(e,t),"aria-label":`Override ${t}`})]})]}),c&&u&&(0,$.jsxs)(`div`,{className:`mt-3 space-y-2 border-t border-[var(--border-base)] pt-3`,children:[(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{className:`mb-1 block text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,$.jsx)(O,{value:p??``,onChange:_,options:d.map(e=>({value:e,label:ve[e]??e}))})]}),(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{className:`mb-1 block text-body-small-default text-[var(--content-tertiary)]`,children:`Model`}),(0,$.jsx)(O,{value:i?.model??``,onChange:v,options:m})]})]}),h&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:`Pick a model`})]})]})}function St({isOpen:e,onClose:t,assistantId:n}){let r=(0,Q.useRef)(!1);return(0,$.jsx)(T.Root,{open:e,onOpenChange:e=>{!e&&!r.current&&t()},children:e?(0,$.jsx)(Ct,{assistantId:n,onClose:t,onSavingChange:e=>{r.current=e}}):null})}function Ct({assistantId:e,onClose:t,onSavingChange:n}){let r=u(),{data:i}=d({...R({path:{assistant_id:e}}),staleTime:3e4}),o=(0,Q.useMemo)(()=>i?.llm?.profiles??{},[i?.llm?.profiles]),c=(0,Q.useMemo)(()=>i?.llm?.profileOrder??[],[i?.llm?.profileOrder]),l=(0,Q.useMemo)(()=>i?.llm?.callSites??{},[i?.llm?.callSites]),f=(0,Q.useMemo)(()=>Je(o,c),[o,c]),p=Fe(),m=P({onSuccess:t=>{W(r,{path:{assistant_id:e}},t)}}),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(``),[y,x]=(0,Q.useState)({}),[S,w]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(!1),{data:j,isLoading:M,isError:N,refetch:F}=d({...z({path:{assistant_id:e}}),enabled:!!e,staleTime:6e4,refetchOnWindowFocus:!1}),I=(0,Q.useMemo)(()=>(j?.callSites??[]).filter(e=>e.id!==`mainAgent`),[j]),L=!M&&!N&&!!j&&!!i,B=(0,Q.useMemo)(()=>I.map(e=>e.id),[I]),V=(0,Q.useMemo)(()=>{if(!L)return{};let e={};for(let t of B)if(t in y)e[t]=y[t];else{let n=l[t];e[t]=n?{...n}:{}}return e},[L,B,l,y]),H=(0,Q.useMemo)(()=>new Set(B),[B]),U=(0,Q.useMemo)(()=>Object.entries(l).some(([e,t])=>H.has(e)&&(t?.profile!=null||t?.provider!=null||t?.model!=null)),[l,H]),ee=(0,Q.useMemo)(()=>{if(!L)return!1;for(let e of Object.keys(V))if(!bt(V[e],l[e]))return!0;return!1},[L,V,l]),G=(0,Q.useMemo)(()=>Object.values(V).some(e=>yt(e)&&!!e?.provider&&!e?.model),[V]),K=(0,Q.useMemo)(()=>Ee(f,[]).map(e=>({value:e.name,label:dt(e)})),[f]),te=(0,Q.useCallback)(()=>{if(!_)return;let e={};for(let t of B)e[t]={profile:_};x(e)},[_,B]),ne=(0,Q.useCallback)(e=>[...Ee(f,[e]).map(e=>({value:e.name,label:dt(e)})),{value:vt,label:`Custom`}],[f]),q=(0,Q.useMemo)(()=>{if(!h.trim())return I;let e=h.toLowerCase();return I.filter(t=>(t.displayName??``).toLowerCase().includes(e)||(t.description??``).toLowerCase().includes(e)||(t.domain??``).toLowerCase().includes(e))},[I,h]),J=(0,Q.useMemo)(()=>{if(!j)return[];let e=j.domains.map(e=>e.id),t=new Map(j.domains.map(e=>[e.id,e])),n=[];for(let r of e){let e=q.filter(e=>e.domain===r);e.length>0&&n.push({domain:t.get(r),sites:e})}let r=new Set(e),i=q.filter(e=>!r.has(e.domain));return i.length>0&&n.push({domain:{id:`other`,displayName:`Other`},sites:i}),n},[j,q]),re=(0,Q.useCallback)((e,t)=>{x(n=>({...n,[e]:t}))},[]),Y=(0,Q.useCallback)((e,t)=>{if(!t){x(t=>({...t,[e]:null}));return}let n=Z(f,I.find(t=>t.id===e)?.defaultProfile);if(n)x(t=>({...t,[e]:{profile:n}}));else{let t=p[0]??se[0],n=Ge(t)??``;x(r=>({...r,[e]:{provider:t,model:n}}))}},[I,f,p]),X=(0,Q.useCallback)(async()=>{w(!0),n?.(!0);try{let n={};for(let e of Object.keys(V)){let t=V[e]??null;n[e]=yt(t)?{profile:t?.profile??null,provider:t?.provider??null,model:t?.model??null}:null}await m.mutateAsync({path:{assistant_id:e},body:{llm:{callSites:n}}}),t(),E.success(`Overrides saved.`)}catch(e){E.error(`Failed to save overrides. Please try again.`),a(e,{context:`call_site_overrides_save`})}finally{w(!1),n?.(!1)}},[V,t,m,n,e]),ie=(0,Q.useCallback)(async()=>{w(!0),n?.(!0);try{let n={};for(let e of Object.keys(V))n[e]=null;await m.mutateAsync({path:{assistant_id:e},body:{llm:{callSites:n}}}),t(),E.success(`Overrides reset.`)}catch(e){E.error(`Failed to reset overrides. Please try again.`),a(e,{context:`call_site_overrides_reset`})}finally{w(!1),n?.(!1)}},[V,t,m,n,e]);return(0,$.jsxs)(T.Content,{size:`lg`,hideCloseButton:!0,children:[(0,$.jsxs)(T.Header,{children:[(0,$.jsx)(T.Title,{children:`Action Overrides`}),(0,$.jsx)(T.Description,{children:`Customize which model profile specific actions should use. Uses your default profile if no override is set.`})]}),(0,$.jsxs)(T.Body,{children:[(0,$.jsx)(`div`,{className:`mb-4`,children:(0,$.jsx)(C,{type:`search`,value:h,onChange:e=>g(e.target.value),placeholder:`Search actions…`,leftIcon:(0,$.jsx)(je,{className:`h-4 w-4`}),fullWidth:!0})}),K.length>0&&(0,$.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)] p-3`,children:[(0,$.jsx)(`p`,{className:`min-w-0 flex-1 text-body-medium-default text-[var(--content-default)]`,children:`Use one profile for all actions`}),(0,$.jsx)(O,{value:_,onChange:v,options:K,placeholder:`Choose profile…`,className:`w-44`,menuMinWidth:280,menuAlign:`end`}),(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:te,disabled:!_||!L||S,children:`Apply to all`})]}),M&&(0,$.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,$.jsx)(b,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`})}),N&&(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-12 text-center`,children:[(0,$.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Couldn't load actions`}),(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Make sure your assistant is running`}),(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:()=>void F(),children:`Retry`})]}),!M&&!N&&j&&(0,$.jsx)(`div`,{className:`space-y-4`,children:J.length===0?(0,$.jsx)(`p`,{className:`py-8 text-center text-body-medium-lighter text-[var(--content-tertiary)]`,children:`No actions match your search.`}):J.map(({domain:e,sites:t})=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`mb-2 text-body-small-default font-semibold uppercase tracking-wider text-[var(--content-tertiary)]`,children:e.displayName}),(0,$.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>{let t=(()=>{let t=V[e.id]??null;return!t||!yt(t)?``:t.provider||t.model?`__custom__`:t.profile??``})(),n=e.defaultProfile?f.find(t=>t.name===e.defaultProfile)?.label??e.defaultProfile:null;return(0,$.jsx)(xt,{id:e.id,displayName:e.displayName,description:e.description,defaultProfileLabel:n,draft:V[e.id]??null,profileOptions:ne(t===``||t===`__custom__`?null:t),onDraftChange:re,onToggle:Y},e.id)})})]},e.id))})]}),(0,$.jsxs)(T.Footer,{children:[U&&(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:()=>A(!0),disabled:S||!L,tintColor:`var(--system-negative-strong)`,className:`mr-auto`,children:`Reset to Defaults`}),(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:t,disabled:S,children:`Cancel`}),(0,$.jsx)(s,{variant:`primary`,size:`compact`,onClick:()=>void X(),disabled:!ee||G||S,children:S?(0,$.jsx)(b,{className:`h-4 w-4 animate-spin`}):`Save`})]}),(0,$.jsx)(D,{open:k,title:`Reset to Defaults`,message:`Every task override will be reset and will follow your active profile. This cannot be undone.`,confirmLabel:`Reset to Defaults`,destructive:!0,onConfirm:()=>{A(!1),ie()},onCancel:()=>A(!1)})]})}function wt({blocked:e,availableReplacements:t,replacement:n,onReplacementChange:r,error:i,saving:a,onClose:o,onConfirm:c}){let l=``;if(e){let t=e.label||e.name;l=e.isActive&&e.callSiteIds.length>0?`"${t}" is the active profile and is used by ${e.callSiteIds.length} call site(s). Pick a replacement profile.`:e.isActive?`"${t}" is the active profile. Pick a different active profile before deleting, or select a replacement below.`:`"${t}" is used by ${e.callSiteIds.length} call site(s). Select a replacement profile to reassign them before deleting.`}return(0,$.jsx)(T.Root,{open:e!==null,onOpenChange:e=>{e||o()},children:(0,$.jsxs)(T.Content,{size:`sm`,children:[(0,$.jsx)(T.Header,{children:(0,$.jsx)(T.Title,{children:`Can't Delete Profile`})}),(0,$.jsxs)(T.Body,{className:`space-y-4`,children:[(0,$.jsx)(m,{variant:`body-medium-default`,as:`p`,children:l}),e&&e.callSiteIds.length>0&&(0,$.jsx)(`ul`,{className:`space-y-1 pl-1`,children:e.callSiteIds.map(e=>(0,$.jsxs)(`li`,{className:`text-body-small-default text-(--content-secondary)`,children:[`• `,(0,$.jsx)(`code`,{children:e})]},e))}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Replacement profile`}),(0,$.jsx)(O,{"aria-label":`Replacement profile`,value:n,onChange:r,options:[{value:``,label:`Select a replacement…`},...t.map(e=>({value:e.name,label:e.label??e.name}))]})]}),i&&(0,$.jsx)(m,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:i})]}),(0,$.jsxs)(T.Footer,{children:[(0,$.jsx)(s,{variant:`ghost`,size:`compact`,onClick:o,children:`Cancel`}),(0,$.jsx)(s,{variant:`primary`,size:`compact`,disabled:!n||a,onClick:c,children:a?`Saving…`:`Reassign and Delete`})]})]})})}function Tt(e,t){if(e){let n=Y(e).find(e=>e.id===t);if(n)return n.displayName}let n=t.lastIndexOf(`/`);return n>=0?t.slice(n+1):t}function Et(e,t){let n=[];e.description&&n.push(e.description);let r=e.provider_connection===`vellum`&&t?`vellum`:e.provider,i=[];if(e.model&&i.push(Tt(r,e.model)),r){let e=ve[r]??r;i.push(`hosted by ${e}`)}return i.length>0&&n.push(i.join(` `)),n.join(` – `)}function Dt({profile:e,vellumIsManaged:t,isDragging:n,dropTarget:r,isDeleting:i,deleteError:a,isToggling:o,onDragStart:c,onDragEnd:l,onDragOver:u,onDragLeave:d,onDrop:f,onEditClick:p,onDeleteClick:h,onStatusToggle:g}){let _=e.source===`managed`,v=e.invariant===!0,y=e.status!==`disabled`;return(0,$.jsxs)(`div`,{className:`relative`,children:[r?.name===e.name&&!r.after&&(0,$.jsx)(`div`,{className:`mx-0 h-0.5 rounded-full bg-[var(--border-active)]`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg pr-2 py-2${n?` opacity-50`:``}`,draggable:!_,onDragStart:c,onDragEnd:l,onDragOver:u,onDragLeave:d,onDrop:f,children:[(0,$.jsx)(_t,{className:`h-4 w-4 shrink-0 ${_?`invisible`:`cursor-grab text-[var(--content-tertiary)]`}`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1${y?``:` opacity-55`}`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(m,{variant:`body-medium-default`,as:`span`,className:`text-(--content-default)`,children:e.label??e.name}),_&&(0,$.jsx)(S,{tone:`positive`,title:`Managed by Platform — this profile cannot be disabled, deleted, or renamed.`,children:`Platform`})]}),e.description||e.model||e.provider?(0,$.jsx)(m,{variant:`body-medium-lighter`,as:`p`,className:`mt-0.5 text-(--content-tertiary)`,children:Et(e,t)}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(!v||!y)&&(0,$.jsx)(`div`,{className:`flex shrink-0 items-center`,title:y?`Active — toggle to hide from pickers`:`Disabled — toggle to show in pickers`,children:(0,$.jsx)(w,{checked:y,onChange:e=>g(e),disabled:o,"aria-label":`${y?`Disable`:`Enable`} ${e.label??e.name}`})}),(0,$.jsxs)(`div`,{className:`flex w-[92px] items-center justify-end gap-2`,children:[(0,$.jsx)(s,{variant:`ghost`,size:`compact`,onClick:p,children:_||v?`View`:`Edit`}),(0,$.jsx)(s,{variant:`ghost`,size:`compact`,iconOnly:(0,$.jsx)(De,{}),"aria-label":`Delete ${e.label??e.name}`,disabled:_||v||i,title:_||v?`Managed profiles cannot be deleted`:void 0,onClick:h,tintColor:`var(--system-negative-strong)`})]})]})]}),r?.name===e.name&&r.after&&(0,$.jsx)(`div`,{className:`mx-0 h-0.5 rounded-full bg-[var(--border-active)]`}),a?(0,$.jsx)(m,{variant:`body-small-default`,as:`p`,className:`px-2 pb-1 text-(--system-negative-strong)`,children:a}):null]})}function Ot({isOpen:e,assistantId:t,onClose:n}){let r=u(),{data:i}=d({...R({path:{assistant_id:t}}),staleTime:3e4}),o=(0,Q.useMemo)(()=>i?.llm?.profiles??{},[i?.llm?.profiles]),s=(0,Q.useMemo)(()=>i?.llm?.profileOrder??[],[i?.llm?.profileOrder]),c=i?.llm?.activeProfile??null,l=i?.llm?.callSites??{},f=(0,Q.useMemo)(()=>Je(o,s),[o,s]),p=P({onSuccess:e=>{W(r,{path:{assistant_id:t}},e)}}),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(null),{data:v}=d({...I({path:{assistant_id:t}}),enabled:e}),y=v?.connections,b=y?.some(e=>e.name===`vellum`&&e.provider===`vellum`)??!1,x=Object.keys(o);async function S(e,n,r){let i=r?.mode??`replace`,c=!(e in o);if(i===`merge`&&!c){await p.mutateAsync({path:{assistant_id:t},body:{llm:{profiles:{[e]:n}}}}),h(!1),_(null);return}let l={profiles:{[e]:n}};if(c&&(l.profileOrder=s.includes(e)?s:[...s,e]),c)await p.mutateAsync({path:{assistant_id:t},body:{llm:l}});else{let n=o[e];await p.mutateAsync({path:{assistant_id:t},body:{llm:{profiles:{[e]:null}}}});try{await p.mutateAsync({path:{assistant_id:t},body:{llm:l}})}catch(r){throw a(r,{context:`settings-ai-profile-edit-recreate`}),n!=null&&await p.mutateAsync({path:{assistant_id:t},body:{llm:{profiles:{[e]:n}}}}).catch(()=>{}),r}}c&&E.success(`Profile "${n.label??e}" created`),h(!1),_(null)}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(T.Root,{open:e,onOpenChange:e=>{e||n()},children:e?(0,$.jsx)(kt,{assistantId:t,vellumIsManaged:b,profiles:o,profileOrder:s,orderedProfiles:f,activeProfile:c,callSiteOverrides:l,onClose:n,onEditClick:e=>{_(e),h(!0)},onNewClick:()=>{_(null),h(!0)}}):null}),(0,$.jsx)(Ae,{isOpen:m,mode:g?g.source===`managed`||g.invariant===!0?`view`:`edit`:`create`,profileName:g?.name,initialValues:g??void 0,existingNames:x,connections:y,assistantId:t,onSave:S,onCancel:()=>{h(!1),_(null)}})]})}function kt({assistantId:e,vellumIsManaged:t,profiles:n,profileOrder:r,orderedProfiles:i,activeProfile:o,callSiteOverrides:c,onClose:l,onEditClick:d,onNewClick:f}){let p=u(),h=P({onSuccess:t=>{W(p,{path:{assistant_id:e}},t)}}),[g,_]=(0,Q.useState)({}),[v,y]=(0,Q.useState)({}),[b,x]=(0,Q.useState)(new Set),[S,C]=(0,Q.useState)(null),[w,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(null),j=(0,Q.useRef)(null),M=(0,Q.useRef)(null),[N,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(``),[B,V]=(0,Q.useState)(!1),H=(0,Q.useMemo)(()=>i,[i]);async function U(t,r){if(b.has(t.name))return!1;x(e=>new Set(e).add(t.name)),C(null);let i=r?`active`:`disabled`;if(!n[t.name])return x(e=>{let n=new Set(e);return n.delete(t.name),n}),!1;try{return await h.mutateAsync({path:{assistant_id:e},body:{llm:{profiles:{[t.name]:{status:i}}}}}),!0}catch(e){return a(e,{context:`settings-ai-profile-toggle`}),C(`Couldn't update "${t.label??t.name}". Please try again.`),!1}finally{x(e=>{let n=new Set(e);return n.delete(t.name),n})}}async function ee(t){y(e=>({...e,[t]:!0})),_(e=>{let n={...e};return delete n[t],n});try{let n=r.filter(e=>e!==t);await h.mutateAsync({path:{assistant_id:e},body:{llm:{profiles:{[t]:null},profileOrder:n}}})}catch(e){a(e,{context:`settings-ai-profile-delete`}),_(e=>({...e,[t]:`Failed to delete profile. Please try again.`}))}finally{y(e=>{let n={...e};return delete n[t],n})}}function G(e){let t=H.find(t=>t.name===e)?.label??e,n=e===o,r=Object.entries(c).filter(([t,n])=>t!==`mainAgent`&&n?.profile===e).map(([e])=>e);if(n||r.length>0){F({name:e,label:t,isActive:n,callSiteIds:r}),z(``),L(null);return}ee(e)}async function K(){if(!N||!R)return;V(!0),L(null);let t={};if(N.isActive&&(t.activeProfile=R),N.callSiteIds.length>0){let e={};for(let t of N.callSiteIds)e[t]={profile:R};t.callSites=e}if(Object.keys(t).length>0)try{await h.mutateAsync({path:{assistant_id:e},body:{llm:t}})}catch(e){a(e,{context:`settings-ai-profile-reassign-delete`}),L(`Failed to reassign references. Please try again.`),V(!1);return}let n=N.name;F(null),V(!1),ee(n)}async function te(t,n){if(t===n.name)return;A(null);let i=r.filter(e=>e!==t),o=i.indexOf(n.name);if(o===-1)return;n.after&&(o+=1);let s=[...i.slice(0,o),t,...i.slice(o)];try{await h.mutateAsync({path:{assistant_id:e},body:{llm:{profileOrder:s}}})}catch(e){a(e,{context:`settings-ai-profile-reorder`}),A(`Failed to reorder profiles. Please try again.`)}}let ne=H.filter(e=>e.name!==N?.name&&e.source!==`managed`),q=ne.length>0?ne:H.filter(e=>e.name!==N?.name);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(T.Content,{size:`md`,children:[(0,$.jsxs)(T.Header,{children:[(0,$.jsx)(T.Title,{children:`Model Profiles`}),(0,$.jsx)(T.Description,{children:`Bundle a provider and model into a named profile. Assign profiles to specific actions or swap between them when chatting.`})]}),(0,$.jsxs)(T.Body,{children:[H.length===0?(0,$.jsx)(m,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:`No profiles yet. Create one to get started.`}):(0,$.jsx)(`div`,{className:`space-y-1`,children:H.map(e=>(0,$.jsx)(Dt,{profile:e,vellumIsManaged:t,isDragging:w===e.name,dropTarget:D,isDeleting:v[e.name]??!1,deleteError:g[e.name],isToggling:b.has(e.name),onDragStart:t=>{j.current=e.name,E(e.name),t.dataTransfer&&(t.dataTransfer.effectAllowed=`move`)},onDragEnd:()=>{j.current=null,M.current=null,E(null),O(null)},onDragOver:t=>{t.preventDefault();let n=t.currentTarget.getBoundingClientRect(),r=t.clientY>n.top+n.height/2,i={name:e.name,after:r};M.current=i,O(i)},onDragLeave:t=>{t.currentTarget.contains(t.relatedTarget)||(M.current=null,O(t=>t?.name===e.name?null:t))},onDrop:e=>{e.preventDefault();let t=j.current,n=M.current;j.current=null,M.current=null,E(null),O(null),t&&n&&te(t,n)},onEditClick:()=>d(e),onDeleteClick:()=>G(e.name),onStatusToggle:t=>void U(e,t)},e.name))}),k&&(0,$.jsx)(m,{variant:`body-small-default`,as:`p`,className:`mt-2 text-(--system-negative-strong)`,children:k}),S&&(0,$.jsx)(m,{variant:`body-small-default`,as:`p`,className:`mt-2 text-(--system-negative-strong)`,children:S})]}),(0,$.jsxs)(T.Footer,{className:`justify-between`,children:[(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:f,children:`+ New Profile`}),(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:l,children:`Done`})]})]}),(0,$.jsx)(wt,{blocked:N,availableReplacements:q,replacement:R,onReplacementChange:z,error:I,saving:B,onClose:()=>{F(null),L(null)},onConfirm:()=>void K()})]})}var At=`0.10.8`;function jt(){return G(At)}function Mt({mode:e,connection:t,assistantId:n,existingNames:r,onSave:i,onCancel:a}){let[o,c]=(0,Q.useState)(t?.label??``),l=t?.name??``,d=t?.provider??`anthropic`,f=t?.auth.type??`api_key`,[p,h]=(0,Q.useState)(()=>t?.auth.type===`api_key`?t.auth.credential:t?``:`credential/anthropic/api_key`),[g,_]=(0,Q.useState)(t?.baseUrl??``),[v,y]=(0,Q.useState)(()=>t?.models?t.models.map(e=>e.id).join(`, `):``),[b,x]=(0,Q.useState)(!1),[S,w]=(0,Q.useState)(null),E=d===`openai-compatible`,[D,O]=(0,Q.useState)(``),[k,M]=(0,Q.useState)(!1),N=u(),P=(0,Q.useMemo)(()=>it(p),[p]),F=f===`api_key`&&P!==null,{hasStoredCredential:I,isLoading:R}=Ue({assistantId:n,credentialKind:`credential`,credentialName:P?`${P.service}:${P.field}`:``,enabled:F}),{credentials:z}=J({assistantId:n,enabled:f===`api_key`});(0,Q.useEffect)(()=>{let e=t?.provider??`anthropic`;c(t?.label??``),t?.auth.type===`api_key`?h(t.auth.credential):h(t?``:`credential/${e}/api_key`),w(null),_(t?.baseUrl??``),y(t?.models?t.models.map(e=>e.id).join(`, `):``),O(``),M(!1)},[t]);let B=l.trim().length>0;async function V(){if(B){x(!0),w(null);try{let e;if(f===`api_key`){let t=p.trim()||`credential/${d}/api_key`,r=D.trim();if(r){M(!0);try{let e=it(t);await j({path:{assistant_id:n},body:e?{type:`credential`,name:`${e.service}:${e.field}`,value:r}:{type:`api_key`,name:d,value:r},throwOnError:!0});let i=rt(n,`credential`,e?`${e.service}:${e.field}`:``);N.setQueryData(i,!0),N.invalidateQueries({queryKey:L({path:{assistant_id:n}})})}catch{w(`Failed to save API key. Please try again.`);return}finally{M(!1)}}e={type:`api_key`,credential:t}}else if(t)e=t.auth;else{w(`Nothing to edit. Close and try again.`);return}let r=o.trim()||null,a={auth:e,label:r,...E&&{base_url:g.trim()||null,models:v.trim()?v.split(`,`).map(e=>({id:e.trim()})).filter(e=>e.id):null}},{data:s,error:c,response:u}=await A({path:{assistant_id:n,name:t?.name??l.trim()},body:a});if(!u?.ok){w(qe(u?.status,c)??Qe(u?.status));return}if(!s){w(`Server returned an empty response. Please try again.`);return}i(s)}catch{w(`Failed to save provider. Please try again.`)}finally{x(!1)}}}let H=z.filter(e=>e.service===d),U=e!==`create`&&t?.auth.type===`api_key`,W=H.length>0||U,ee=ze(`Enter your API key`,I);return e===`create`?(0,$.jsx)(xe,{variant:`modal`,assistantId:n,existingNames:r,defaultProviderType:d,onCreated:i,onCancel:a}):(0,$.jsxs)(T.Content,{size:`md`,children:[(0,$.jsxs)(T.Header,{children:[(0,$.jsx)(T.Title,{children:`Edit Provider`}),(0,$.jsx)(T.Description,{children:t?`Editing ${Le(t)}.`:`Edit provider settings.`})]}),(0,$.jsxs)(T.Body,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:[`Display Name`,` `,(0,$.jsx)(`span`,{className:`text-[var(--content-disabled)]`,children:`(optional)`})]}),(0,$.jsx)(C,{value:o,onChange:e=>c(e.target.value),placeholder:`e.g. My Anthropic Key`,fullWidth:!0})]}),E&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Base URL`}),(0,$.jsx)(C,{value:g,onChange:e=>_(e.target.value),placeholder:`https://api.example.com/v1`,fullWidth:!0})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Models`}),(0,$.jsx)(C,{value:v,onChange:e=>y(e.target.value),placeholder:`model-1, model-2`,fullWidth:!0}),(0,$.jsx)(m,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:`Comma-separated model identifiers exposed by your endpoint.`})]})]}),f===`api_key`&&(0,$.jsx)(ot,{apiKeyValue:D,onApiKeyChange:O,credential:p,onCredentialChange:h,isLoadingCredential:R,apiKeyPlaceholder:ee,provider:d,providerCredentials:H,showAdvancedSection:W,onError:w}),f===`oauth_subscription`&&(0,$.jsx)(Xe,{assistantId:n,onConnected:i}),S&&(0,$.jsx)(m,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:S})]}),(0,$.jsxs)(T.Footer,{children:[(0,$.jsx)(s,{variant:`ghost`,size:`compact`,onClick:a,children:`Cancel`}),(0,$.jsx)(s,{variant:`primary`,size:`compact`,disabled:!B||b||k,onClick:()=>void V(),children:b?`Saving…`:`Save`})]})]})}var Nt={anthropic:!0,openai:!0,gemini:!0,fireworks:!0,openrouter:!0,vellum:!0};function Pt(e){return e in Nt}function Ft({isOpen:e,assistantId:t,onClose:n}){let[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(null),s=u(),{data:c,isLoading:l,isError:f}=d({...I({path:{assistant_id:t}}),enabled:e}),p=jt(),{data:m}=d({...B({path:{assistant_id:t}}),enabled:e&&p}),h=(0,Q.useMemo)(()=>{let e=c?.connections??[];return[...e.filter(e=>e.provider===ae),...e.filter(e=>e.provider!==ae)]},[c]);function g(){s.invalidateQueries({queryKey:U({path:{assistant_id:t}})}),s.invalidateQueries({queryKey:V({path:{assistant_id:t}})})}function _(e){s.invalidateQueries({queryKey:F({path:{assistant_id:t}})}),i(!1),o(null)}let v=h.map(e=>e.name),y=()=>{i(!1),o(null)};return(0,$.jsx)(T.Root,{open:e,onOpenChange:e=>{e||(r?y():n())},children:e?r?(0,$.jsx)(Mt,{mode:a?`edit`:`create`,connection:a??void 0,assistantId:t,existingNames:v,onSave:_,onCancel:y}):(0,$.jsx)(It,{connections:h,loading:l,isError:f,assistantId:t,supportsDefaultProvider:p,defaultConnectionName:p?m?.resolvedConnectionName??null:null,onDefaultChanged:g,onClose:n,onEditClick:e=>{o(e),i(!0)},onNewClick:()=>{o(null),i(!0)},onConnectionDeleted:()=>{s.invalidateQueries({queryKey:F({path:{assistant_id:t}})})}}):null})}function It({connections:e,loading:t,isError:n,assistantId:r,supportsDefaultProvider:i,defaultConnectionName:o,onDefaultChanged:c,onClose:l,onEditClick:u,onNewClick:d,onConnectionDeleted:p}){let[h,g]=(0,Q.useState)({}),[_,v]=(0,Q.useState)({}),y=f({...H(),onMutate:e=>{let t=e.body?.connectionName;t&&g(e=>{let n={...e};return delete n[t],n})},onSuccess:c,onError:(e,t)=>{a(e,{context:`settings-ai-set-default-provider`});let n=t.body?.connectionName;n&&g(e=>({...e,[n]:`Failed to set default provider. Please try again.`}))}});function b(e){Pt(e.provider)&&y.mutate({path:{assistant_id:r},body:{provider:e.provider,connectionName:e.name}})}async function x(e){v(t=>({...t,[e]:!0})),g(t=>{let n={...t};return delete n[e],n});try{let{response:t}=await k({path:{assistant_id:r,name:e}});t?.ok||t?.status===404?p(e):t?.status===409?g(t=>({...t,[e]:`This provider is in use by a profile or as the default provider. Update those settings before deleting it.`})):g(t=>({...t,[e]:`Failed to delete provider. Please try again.`}))}catch{g(t=>({...t,[e]:`Failed to delete provider. Please try again.`}))}finally{v(t=>{let n={...t};return delete n[e],n})}}return(0,$.jsxs)(T.Content,{size:`md`,children:[(0,$.jsxs)(T.Header,{children:[(0,$.jsx)(T.Title,{children:`Providers`}),(0,$.jsx)(T.Description,{children:`Manage the model providers your assistant can use.`})]}),(0,$.jsx)(T.Body,{children:t?(0,$.jsx)(`div`,{className:`space-y-2 py-2`,children:[1,2,3].map(e=>(0,$.jsx)(`div`,{className:`h-10 animate-pulse rounded-lg bg-[var(--surface-active)]`},e))}):n?(0,$.jsx)(m,{variant:`body-medium-default`,as:`p`,className:`py-4 text-center text-(--system-negative-strong)`,children:`Failed to load providers. Please try again.`}):e.length===0?(0,$.jsx)(m,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:`No providers yet. Add one to get started.`}):(0,$.jsx)(`div`,{className:`space-y-1`,children:e.map(e=>{let t=_[e.name]??!1,n=h[e.name],r=e.isManaged??!1,a=e.name===o,c=Pt(e.provider),l=y.isPending&&y.variables?.body?.connectionName===e.name;return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg px-2 py-2`,children:[(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(m,{variant:`body-medium-default`,as:`span`,className:`text-(--content-default)`,children:Le(e)}),r&&(0,$.jsx)(S,{tone:`positive`,title:`Managed by Platform — you can rename this provider, but not edit it.`,children:`Platform`}),a&&(0,$.jsx)(S,{tone:`info`,title:`Built-in profiles (Balanced, Quality, Speed) use this provider.`,children:`Default`})]})}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[i&&!a&&(0,$.jsx)(s,{variant:`ghost`,size:`compact`,disabled:!c||l,title:c?`Use this provider for the built-in profiles.`:`Built-in profiles can't run on this provider.`,onClick:()=>b(e),children:`Set as default`}),!r&&(0,$.jsx)(s,{variant:`ghost`,size:`compact`,onClick:()=>u(e),children:`Edit`}),(0,$.jsx)(s,{variant:`ghost`,size:`compact`,iconOnly:(0,$.jsx)(De,{}),"aria-label":`Delete ${Le(e)}`,disabled:r||a||t,title:r?`The Vellum provider cannot be removed`:a?`This is your default provider. Set another provider as default first.`:void 0,onClick:()=>void x(e.name),tintColor:`var(--system-negative-strong)`})]})]}),n?(0,$.jsx)(m,{variant:`body-small-default`,as:`p`,className:`px-2 pb-1 text-(--system-negative-strong)`,children:n}):null]},e.name)})})}),(0,$.jsxs)(T.Footer,{className:`justify-between`,children:[(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:d,children:`+ Add Provider`}),(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:l,children:`Done`})]})]})}function Lt(){let e=fe(),t=u(),{data:n}=d({...R({path:{assistant_id:e}}),staleTime:3e4}),r=jt(),{data:i,refetch:o}=d({...B({path:{assistant_id:e}}),enabled:r}),c=i?.availability,l=n?.llm?.activeProfile??null,f=n?.llm?.advisorProfile??null,p=n?.llm?.callSites??{},{profiles:h,profileOrder:g}=Ce(n?.llm,e),_=(0,Q.useMemo)(()=>Je(h,g),[h,g]),v=P({onSuccess:n=>{W(t,{path:{assistant_id:e}},n)}}),[y,S]=et(l),[C,w]=et(f),[T,D]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(!1),N=(0,Q.useMemo)(()=>Ee(_,[y]),[_,y]),F=(0,Q.useMemo)(()=>Ee(_,[C]),[_,C]),I=Object.entries(p).filter(([e,t])=>e!==`mainAgent`&&(t?.profile!=null||t?.provider!=null||t?.model!=null)).length,L=I===1?`1 Override`:I>0?`${I} Overrides`:`Overrides`,z=y!==l,V=C!==f,H=(0,Q.useCallback)(async()=>{try{let t={};z&&(t.activeProfile=y),V&&(t.advisorProfile=C),await v.mutateAsync({path:{assistant_id:e},body:{llm:t}}),E.success(`Saved.`)}catch(e){E.error(`Failed to save. Please try again.`),a(e,{context:`settings-ai-language-model-save`})}},[z,V,y,C,v,e]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ht,{title:`Language Model`,subtitle:`Configure the LLMs that power your assistant`,children:(0,$.jsxs)(`div`,{className:`space-y-4`,children:[c&&c.status!==`ok`&&(0,$.jsx)(x,{tone:c.status===`unknown`?`warning`:`error`,children:c.message??`Your default provider is not available.`}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Default Profile`}),(0,$.jsx)(O,{value:y??``,onChange:e=>{S(e===``?null:e)},placeholder:`Select a default profile…`,options:N.map(e=>({value:e.name,label:dt(e)}))}),N.length===0?(0,$.jsx)(m,{variant:`body-small-default`,as:`p`,className:`mt-1 text-(--content-tertiary)`,children:`No profiles yet. Click Profiles below to create one.`}):null]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Advisor Profile`}),(0,$.jsx)(O,{value:C??``,onChange:e=>{w(e===``?null:e)},placeholder:`Select an advisor profile…`,options:F.map(e=>({value:e.name,label:dt(e)}))}),(0,$.jsx)(m,{variant:`body-small-default`,as:`p`,className:`mt-1 text-(--content-tertiary)`,children:`Which model your assistant consults for a second opinion`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:()=>M(!0),children:`Providers`}),(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:()=>D(!0),children:`Profiles`}),(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:()=>A(!0),children:L})]}),(z||V)&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(he,{onClick:H,disabled:v.isPending}),v.isPending&&(0,$.jsx)(b,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`})]})]})}),e&&(0,$.jsx)(Ot,{isOpen:T,assistantId:e,onClose:()=>D(!1)}),e&&(0,$.jsx)(St,{isOpen:k,onClose:()=>A(!1),assistantId:e}),e&&(0,$.jsx)(Ft,{isOpen:j,assistantId:e,onClose:()=>{M(!1),r&&o()}})]})}function Rt(){let e=fe();return(0,Q.useCallback)(async(t,n)=>{try{let{data:r}=await j({path:{assistant_id:e},body:{value:n,type:`api_key`,name:t},throwOnError:!0});$e(r)}catch(e){throw e instanceof Error&&e.message===`No assistant found`?E.error(`Assistant not ready. Please try again.`):E.error(`Failed to save ${t} API key. Please try again.`),a(e,{context:`provision_provider_key`}),e}},[e])}var zt=`0.10.12`;function Bt(){return K(zt)}function Vt(){let e=fe(),i=u(),o=q(),{data:s}=d({...R({path:{assistant_id:e}}),enabled:o,staleTime:3e4}),c=P({onSuccess:t=>{W(i,{path:{assistant_id:e}},t)}}),l=Rt(),f=(0,Q.useMemo)(()=>{if(!s)return r(ge,`inference-provider-native`);let e=s.services?.[`web-search`];return(e?.mode===`managed`&&e?.provider!==`inference-provider-native`?`vellum`:e?.provider)||r(`vellum:ai:webSearchProvider`,`inference-provider-native`)},[s]),[p,m]=(0,Q.useState)(!1),[h,g]=et(f),[_,v]=(0,Q.useState)(``),y=st.has(h),{hasStoredCredential:x}=Ue({assistantId:e,credentialKind:`api_key`,credentialName:h,enabled:y}),S=_.trim().length>0,w=p||y&&!x&&!S||h===f&&!S,T=ze(lt[h]??`Enter your API key`,x),D=(0,Q.useCallback)(async()=>{m(!0);let t=_.trim(),r=Ve(h),o=y&&t.length>0;try{o&&await l(h,t),await ee();let n=h===`vellum`?Bt()?{provider:`vellum`,mode:`managed`}:{mode:`managed`}:{provider:h,mode:`your-own`};await c.mutateAsync({path:{assistant_id:e},body:{services:{"web-search":n}}}).catch(e=>{throw E.error(`Failed to update assistant configuration. Please try again.`),a(e,{context:`patch_daemon_config`}),e})}catch{m(!1);return}m(!1);try{if(n(ge,h),o){r&&n(r,t);let a=rt(e,`api_key`,h);i.setQueryData(a,!0),i.invalidateQueries({queryKey:a}),v(``)}E.success(`Web search settings saved.`)}catch(e){a(e,{context:`settings-ai-web-search-persist-local`}),E.error(`Saved, but local preferences could not be written.`)}},[y,c,l,i,e,_,h]),k=(0,Q.useCallback)(()=>{let e=Ve(h);e&&t(e),v(``),g(`inference-provider-native`),n(ge,`inference-provider-native`)},[h,g]);return(0,$.jsx)(ht,{title:`Web Search`,subtitle:`Configure how your assistant should search the web`,children:(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,$.jsx)(O,{"aria-label":`Web search provider`,value:h,onChange:g,options:Ie.map(e=>({value:e,label:ut[e]??e}))})]}),h===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Search runs through your Vellum account.`}),y&&(0,$.jsx)(C,{label:`API Key`,type:`password`,value:_,onChange:e=>v(e.target.value),placeholder:T,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(he,{onClick:D,disabled:w}),p&&(0,$.jsx)(b,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),y&&(0,$.jsx)(le,{onClick:k,filled:!0})]})]})})}var Ht=`default`;function Ut(){let e=fe(),i=u(),{data:o}=d({...R({path:{assistant_id:e}}),staleTime:3e4}),s=P({onSuccess:t=>{W(i,{path:{assistant_id:e}},t)}}),c=Rt(),l=(0,Q.useMemo)(()=>o?o.services?.[`web-fetch`]?.provider||r(`vellum:ai:webFetchProvider`,Ht):r(We,Ht),[o]),[f,p]=(0,Q.useState)(!1),[m,h]=et(l),[g,_]=(0,Q.useState)(``),v=we.has(m),{hasStoredCredential:y}=Ue({assistantId:e,credentialKind:`api_key`,credentialName:m,enabled:v}),x=g.trim().length>0,S=f||v&&!y&&!x||m===l&&!x,w=ze(Te[m]??`Enter your API key`,y),T=(0,Q.useCallback)(async()=>{p(!0);let t=g.trim(),r=v&&t.length>0;try{r&&await c(m,t),await s.mutateAsync({path:{assistant_id:e},body:{services:{"web-fetch":{provider:m}}}}).catch(e=>{throw E.error(`Failed to update assistant configuration. Please try again.`),a(e,{context:`patch_daemon_config`}),e})}catch{p(!1);return}p(!1);try{if(n(We,m),r){let r=He(m);r&&n(r,t);let a=rt(e,`api_key`,m);i.setQueryData(a,!0),i.invalidateQueries({queryKey:a}),_(``)}E.success(`Web fetch settings saved.`)}catch(e){a(e,{context:`settings-ai-web-fetch-persist-local`}),E.error(`Saved, but local preferences could not be written.`)}},[v,s,c,i,e,g,m]),D=(0,Q.useCallback)(()=>{let e=He(m);e&&t(e),_(``),h(Ht),n(We,Ht)},[m,h]);return(0,$.jsx)(ht,{id:`web-fetch`,title:`Web Fetch`,subtitle:`Configure how your assistant reads individual web pages`,children:(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,$.jsx)(O,{value:m,onChange:h,options:ct.map(e=>({value:e,label:ie[e]??e}))})]}),v&&(0,$.jsx)(C,{label:`API Key`,type:`password`,value:g,onChange:e=>_(e.target.value),placeholder:w,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(he,{onClick:T,disabled:S}),f&&(0,$.jsx)(b,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),v&&(0,$.jsx)(le,{onClick:D,filled:!0})]})]})})}function Wt({subdomain:e,onSubdomainChange:t,domainSuffix:n,subdomainPlaceholder:r=`my-assistant`,disabled:i,autoFocus:a,prefix:o,error:s,locked:c,lockedMessage:l}){return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex h-9 w-full items-center rounded-md border bg-[var(--field-bg)] text-body-medium-lighter transition-[border-color] duration-150 ${s?`border-[var(--system-negative-strong)]`:`border-[var(--field-border)] focus-within:border-[var(--border-active)]`}`,children:[o,(0,$.jsx)(`input`,{value:e,onChange:e=>t(e.target.value.toLowerCase().trim()),disabled:i||c,readOnly:c,autoFocus:a,placeholder:r,"aria-label":`Subdomain`,"aria-invalid":!!s,className:`h-full min-w-0 flex-1 bg-transparent ${o?`pl-1.5`:`pl-3`} pr-1 text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] outline-none disabled:cursor-not-allowed disabled:opacity-60`}),(0,$.jsxs)(`span`,{className:`shrink-0 pr-3 font-mono text-[var(--content-secondary)]`,children:[`.`,n]})]}),s&&(0,$.jsx)(`p`,{className:`mt-1.5 text-body-small-default text-[var(--system-negative-strong)]`,children:s}),c&&l&&(0,$.jsx)(`p`,{className:`mt-1.5 text-body-small-default text-[var(--content-tertiary)]`,children:l})]})}function Gt({assistantId:e,assistantHandle:t,emailRootDomain:n}){let r=u(),i=l(),[o,p]=c(),[m,h]=(0,Q.useState)(``),[g,v]=(0,Q.useState)(!1),[y,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(``),[T,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{g||!t||m||(h(t),v(!0))},[t,g,m]);let F=d({...pe(),enabled:!0}),I=F.data,L=I?.entitlements,R=L?.managed_email===!0,z=!!L&&!R,B=!I&&F.isError&&!F.isFetching,V=d({...ke({path:{assistant_id:e}}),enabled:!z}),H=d({...Re({path:{assistant_id:e}}),enabled:!z}),U=V.data?.results?.[0],W=H.data?.results?.[0],ee=U?`${U.subdomain}.${n}`:null,G=d({...Ye({path:{assistant_id:e,id:W?.id??``}}),enabled:!!W?.id,refetchOnWindowFocus:!1}),K=d({...Me({path:{assistant_id:e,id:U?.id??``}}),enabled:!!U?.id,refetchInterval:e=>{let t=e.state.data?.status;return t===`verified`||t===`failed`?!1:1e4},refetchOnWindowFocus:!0});(0,Q.useEffect)(()=>{o.get(`release`)!==`1`||!U||W||(M(!0),p(e=>{let t=new URLSearchParams(e);return t.delete(`release`),t},{replace:!0}))},[W,U,o,p]);let q=f(tt()),J=f(me()),Y=f(Se()),X=f(re()),Z=(0,Q.useCallback)(()=>{let t={assistant_id:e};r.invalidateQueries({queryKey:Oe({path:t})}),r.invalidateQueries({queryKey:at({path:t})}),W?.id&&r.invalidateQueries({queryKey:nt({path:{...t,id:W.id}})}),r.invalidateQueries({queryKey:Ze()})},[W?.id,e,r]),ie=(0,Q.useCallback)(async()=>{let t=m.trim().toLowerCase();if(!t){S(`Enter a subdomain.`);return}A(!1);try{await q.mutateAsync({path:{assistant_id:e},body:{subdomain:t}}),h(``),S(null),Z(),E.success(`Domain ${t}.${n} registered.`)}catch(e){S(te(e,void 0,`Failed to register domain.`))}},[e,n,Z,q,m]),ae=(0,Q.useCallback)(async()=>{let t=C.trim().toLowerCase();if(!t){O(`Enter an email username.`);return}try{await Y.mutateAsync({path:{assistant_id:e},body:{username:t}}),w(``),O(null),Z(),E.success(`Email address created.`)}catch(e){O(te(e,void 0,`Failed to create email address.`))}},[e,Z,Y,C]),oe=(0,Q.useCallback)(async()=>{if(W?.id){P(!1);try{await X.mutateAsync({path:{assistant_id:e,id:W.id}}),Z(),E.success(`Email address removed.`)}catch(e){a(e,{context:`email_address_delete`}),E.error(`Failed to remove email address.`)}}},[W?.id,e,X,Z]),se=(0,Q.useCallback)(async()=>{if(!U?.id)return;if(W){E.error(`Remove the email address first.`);return}M(!1);let t=U.subdomain;try{await J.mutateAsync({path:{assistant_id:e,id:U.id}}),h(t),Z(),E.success(`Domain released.`)}catch(e){a(e,{context:`email_domain_release`}),E.error(`Failed to release domain.`)}},[W,e,J,U?.id,U?.subdomain,Z]);if(F.isLoading)return(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,$.jsx)(b,{className:`h-4 w-4 animate-spin`}),`Checking subscription…`]});if(z)return(0,$.jsxs)(x,{tone:`info`,icon:(0,$.jsx)(_,{className:`h-4 w-4`,"aria-hidden":!0}),title:`Get a dedicated email address for your assistant`,actions:(0,$.jsx)(s,{size:`compact`,onClick:()=>i(`${ne.settings.usage}?tab=billing&adjust_plan`),children:`Upgrade to Pro`}),children:[`Pro plans include a managed`,` `,`<your-subdomain>.${n}`,` inbox — no provider setup required. Or switch to `,(0,$.jsx)(`strong`,{children:`Your Own`}),` to bring an existing provider.`]});let ce=B?(0,$.jsx)(x,{tone:`warning`,title:`Couldn't verify subscription status`,actions:(0,$.jsx)(s,{size:`compact`,variant:`outlined`,onClick:()=>F.refetch(),children:`Retry`}),children:`We couldn't reach the billing service. The form below assumes managed email is enabled for your org — if it isn't, registering a domain will fail.`}):null;return U?W?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[ce,(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Address`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-body-small-default text-[var(--content-default)]`,children:W.address}),(0,$.jsx)(pt,{status:K.data?.status,message:K.data?.message,isLoading:K.isLoading}),(0,$.jsx)(s,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,$.jsx)(De,{}),onClick:()=>P(!0),disabled:X.isPending,"aria-label":`Remove email address`})]}),(0,$.jsx)(D,{open:N,title:`Remove Email Address`,message:(0,$.jsxs)($.Fragment,{children:[`Are you sure you want to remove `,(0,$.jsx)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 font-mono text-[0.9em]`,children:W.address}),`? Your assistant will no longer be able to send or receive email at this address.`]}),confirmLabel:`Remove`,destructive:!0,onConfirm:oe,onCancel:()=>P(!1)})]}),G.data?.usage&&(0,$.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[G.data.usage.sent_today,` /`,` `,G.data.usage.daily_limit,` sent today ·`,` `,G.data.usage.received_today,` received`]})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[ce,(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Domain`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`font-mono text-body-small-default text-[var(--content-default)]`,children:[U.subdomain,`.`,n]}),(0,$.jsx)(pt,{status:K.data?.status,message:K.data?.message,isLoading:K.isLoading}),(0,$.jsx)(s,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,$.jsx)(De,{}),onClick:()=>M(!0),disabled:J.isPending,"aria-label":`Release domain`})]}),(0,$.jsx)(D,{open:j,title:`Release Domain`,message:(0,$.jsxs)($.Fragment,{children:[`Are you sure you want to release `,(0,$.jsxs)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 font-mono text-[0.9em]`,children:[U.subdomain,`.`,n]}),`? The subdomain will become available for others to claim.`]}),confirmLabel:`Release`,destructive:!0,onConfirm:se,onCancel:()=>M(!1)})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Email address`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex h-9 min-w-0 flex-1 items-center rounded-md border bg-[var(--field-bg)] text-body-medium-lighter transition-[border-color] duration-150 ${T?`border-[var(--system-negative-strong)]`:`border-[var(--field-border)] focus-within:border-[var(--border-active)]`}`,children:[(0,$.jsx)(`input`,{value:C,onChange:e=>{w(e.target.value.toLowerCase()),T&&O(null)},placeholder:`hi`,"aria-label":`Email username`,"aria-invalid":!!T,className:`h-full min-w-0 flex-1 bg-transparent pl-3 pr-1 text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] outline-none`}),(0,$.jsxs)(`span`,{className:`shrink-0 pr-3 font-mono text-[var(--content-secondary)]`,children:[`@`,ee]})]}),(0,$.jsx)(s,{onClick:ae,disabled:Y.isPending||!C.trim(),children:Y.isPending?`Creating…`:`Create`})]}),T&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:T})]})]}):(0,$.jsxs)(`div`,{className:`space-y-3`,children:[ce,(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Subdomain`}),(0,$.jsx)(Wt,{subdomain:m,onSubdomainChange:e=>{h(e),y&&S(null)},domainSuffix:n,subdomainPlaceholder:`my-assistant`,error:y}),(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Each assistant gets its own subdomain. Lowercase letters, numbers, and hyphens only.`}),(0,$.jsx)(s,{onClick:()=>A(!0),disabled:q.isPending||!m.trim(),children:q.isPending?`Registering…`:`Register`}),(0,$.jsx)(D,{open:k,title:`Set Subdomain`,message:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 font-mono text-[0.9em]`,children:m.trim().toLowerCase()||`subdomain`}),` will also become your assistant's public handle. You won't be able to change it once set.`]}),confirmLabel:`Confirm`,onConfirm:ie,onCancel:()=>A(!1)})]})}function Kt(){let e=fe(),t=q(),{data:o}=d({...Pe(),enabled:t}),s=o?.results?.[0]?.handle,c=gt.use.emailRootDomain(),l=Be(),[u,f]=(0,Q.useState)(()=>l===`gated`?`your-own`:Ne(r(ye,`managed`),`managed`)),[p,m]=(0,Q.useState)(()=>{let e=r(oe,`resend`);return e===`mailgun`||e===`resend`?e:`resend`}),h=d({queryKey:[`byoEmailCredential`,e,p],queryFn:async()=>{let{data:t}=await M({path:{assistant_id:e},body:{service:p,field:`api_key`},throwOnError:!0});return t},enabled:u===`your-own`||l===`gated`,staleTime:6e4,retry:i,meta:{errorContext:`byo_email_credential_check`}});(0,Q.useEffect)(()=>{h.error&&a(h.error,{context:`byo_email_credential_check`,bestEffort:!0})},[h.error]);let _=h.data?.hasSecret===!0,b=(0,Q.useCallback)(e=>{f(e),n(ye,e)},[]),x=(0,Q.useCallback)(()=>{n(oe,p),E.success(`Email settings saved.`)},[p]),S=(0,Q.useMemo)(()=>be.find(e=>e.id===p)??be[0],[p]),C=(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-[var(--border-subtle)] bg-[var(--surface-sunken)] p-3 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,$.jsx)(y,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--system-positive-strong)]`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`span`,{children:[`Configure `,S.displayName,` via the assistant CLI: ask the assistant to run the`,` `,(0,$.jsx)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 text-[12px]`,children:S.setupSkill}),` `,`skill. It walks you through storing the API key, detecting the domain, and (optionally) wiring up an inbound webhook.`]}),(0,$.jsxs)(`a`,{href:S.docsUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-[var(--system-positive-strong)] underline hover:opacity-80`,children:[`Open `,S.displayName,(0,$.jsx)(v,{className:`h-3 w-3`})]})]})]}),w=(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,$.jsx)(O,{value:p,onChange:e=>{(e===`mailgun`||e===`resend`)&&m(e)},options:be.map(e=>({value:e.id,label:e.displayName}))})]}),_?(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-[var(--system-positive-subtle)] bg-[var(--surface-sunken)] p-3 text-body-small-default text-[var(--content-default)]`,children:[(0,$.jsx)(g,{className:`h-4 w-4 shrink-0 text-[var(--system-positive-strong)]`}),(0,$.jsxs)(`span`,{children:[S.displayName,` API key configured. To reconfigure, run the`,` `,(0,$.jsx)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 text-[12px]`,children:S.setupSkill}),` `,`skill.`]})]}),(0,$.jsxs)(`a`,{href:S.docsUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-body-small-default text-[var(--system-positive-strong)] underline hover:opacity-80`,children:[`Open `,S.displayName,(0,$.jsx)(v,{className:`h-3 w-3`})]})]}):C,(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,$.jsx)(he,{onClick:x,disabled:!1})})]});return l===`gated`?(0,$.jsx)(ht,{id:`email`,title:`Email`,subtitle:`Configure how your assistant sends and receives email`,children:w}):(0,$.jsx)(ft,{id:`email`,title:`Email`,subtitle:`Configure how your assistant sends and receives email`,mode:u,onModeChange:b,children:u===`managed`?(0,$.jsx)(`div`,{className:`space-y-4`,children:l===`disabled`?(0,$.jsx)(ue,{children:`Log in to the Vellum platform to manage email settings.`}):(0,$.jsx)(Gt,{assistantId:e,assistantHandle:s,emailRootDomain:c})}):w})}function qt(){let e=fe(),t=u(),{data:i}=d({...R({path:{assistant_id:e}}),staleTime:3e4}),o=P({onSuccess:n=>{W(t,{path:{assistant_id:e}},n)}}),s=Rt(),[c,l]=et((0,Q.useMemo)(()=>Ne(i?i.services?.[`image-generation`]?.mode??r(`vellum:ai:imageGenMode`,`your-own`):r(Ke,`your-own`),`your-own`),[i])),[f,p]=(0,Q.useState)(()=>r(X,`gemini-3.1-flash-image-preview`)),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(!1),v=(0,Q.useCallback)(async()=>{_(!0);let r=m.trim(),i=c===`your-own`&&r.length>0;try{i&&await s(de(f),r),await o.mutateAsync({path:{assistant_id:e},body:{services:{"image-generation":{mode:c}}}}).catch(e=>{throw E.error(`Failed to update assistant configuration. Please try again.`),a(e,{context:`patch_daemon_config`}),e});try{await N({path:{assistant_id:e},body:{modelId:f},throwOnError:!0})}catch(e){throw E.error(`Failed to update image generation model. Please try again.`),a(e,{context:`set_image_gen_model`}),e}finally{t.invalidateQueries({queryKey:V({path:{assistant_id:e}})})}}catch{_(!1);return}_(!1);try{n(Ke,c),n(X,f),i&&h(``),E.success(`Image generation settings saved.`)}catch(e){a(e,{context:`settings-ai-image-gen-persist-local`}),E.error(`Saved, but local preferences could not be written.`)}},[m,c,f,e,o,s,t]),y=(0,Q.useCallback)(()=>{h(``),p(`gemini-3.1-flash-image-preview`),n(X,`gemini-3.1-flash-image-preview`)},[]);return(0,$.jsx)(ft,{title:`Image Generation`,subtitle:`Configure which model your assistant uses to generate images`,mode:c,onModeChange:e=>l(e),children:c===`managed`?(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Active Model`}),(0,$.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,$.jsx)(O,{className:`flex-1`,value:f,onChange:p,options:_e.map(e=>({value:e,label:ce[e]??e}))}),(0,$.jsx)(he,{onClick:v,disabled:g}),g&&(0,$.jsx)(b,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`})]})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsx)(C,{label:`API Key`,type:`password`,value:m,onChange:e=>h(e.target.value),placeholder:de(f)===`openai`?`Enter your OpenAI API key`:`Enter your Gemini API key`,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Active Model`}),(0,$.jsx)(O,{value:f,onChange:p,options:_e.map(e=>({value:e,label:ce[e]??e}))})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(he,{onClick:v,disabled:g}),g&&(0,$.jsx)(b,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),(0,$.jsx)(le,{onClick:y})]})]})})}function Jt(){return(0,Q.useEffect)(()=>{let e=window.location.hash.slice(1);e&&requestAnimationFrame(()=>{document.getElementById(e)?.scrollIntoView({block:`start`})})},[]),(0,$.jsxs)(`div`,{className:`space-y-5`,children:[(0,$.jsx)(mt,{}),(0,$.jsx)(Lt,{}),(0,$.jsx)(Vt,{}),(0,$.jsx)(Ut,{}),(0,$.jsx)(Kt,{}),(0,$.jsx)(qt,{})]})}export{Jt as AiPage};
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{a as t,c as n,i as r}from"./local-settings-C-dW2vkq.js";import{r as i,t as a}from"./capture-error-anSemq95.js";import{t as o}from"./react-DJZBPgpf.js";import{t as s}from"./button-CW7wKp2r.js";import{m as c,u as l}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{n as u}from"./QueryClientProvider-DKhXIxGb.js";import{t as d}from"./useQuery-B45lW1Kk.js";import{t as f}from"./useMutation-Lj4VunQV.js";import{t as p}from"./jsx-runtime-CVSDxk6A.js";import{t as m}from"./typography-1kyF_Eu1.js";import{t as h}from"./createLucideIcon-Bjb-Kuq7.js";import{t as g}from"./circle-check-DqvTjWle.js";import{t as _}from"./crown-CAZ_Zm41.js";import{t as v}from"./external-link-Cczz6xJ4.js";import{t as y}from"./info-CqgkBvyS.js";import{t as b}from"./loader-circle-Ck8fq3yv.js";import{t as x}from"./notice-CvJ7MBx5.js";import{t as S}from"./tag-CJyI1Y2J.js";import{t as C}from"./input-D3MhHg0d.js";import{t as w}from"./toggle-Ca1aoG-l.js";import{t as T}from"./modal-D_Y2RPD5.js";import{n as E}from"./toast-zHo1wvF9.js";import{t as D}from"./confirm-dialog-DxBl6zcI.js";import{t as O}from"./dropdown-DQozlhbb.js";import{Ut as k,Wt as A,ar as j,lt as M,wn as N}from"./sdk.gen-BR-xXIZm.js";import{Bt as P,H as F,V as I,_t as L,c as R,d as z,f as B,l as V,m as H,p as U,u as W}from"./react-query.gen-DfzfX_Jv.js";import{i as ee,r as G,t as K}from"./utils-DvUW9GK8.js";import{r as te}from"./api-errors-CoE1wFl2.js";import{u as ne}from"./routes-D4ff4ONd.js";import{t as q}from"./use-is-org-ready-H4X9wAlh.js";import{$a as J,$r as re,Ao as Y,Ar as X,B as Z,Co as ie,Do as ae,Dr as oe,Eo as se,Fr as ce,G as le,H as ue,Ir as de,J as fe,Ji as pe,Jr as me,K as he,Mr as ge,Nr as _e,Oo as ve,Or as ye,Pr as be,Qa as xe,Qr as Se,R as Ce,So as we,To as Te,V as Ee,Vo as De,Xr as Oe,Yr as ke,Za as Ae,Zo as je,Zr as Me,_o as Ne,ai as Pe,ao as Fe,bo as Ie,co as Le,ei as Re,eo as ze,fo as Be,go as Ve,ho as He,io as Ue,jr as We,ko as Ge,kr as Ke,lo as qe,mo as Je,ni as Ye,no as Xe,oi as Ze,oo as Qe,po as $e,q as et,qr as tt,ri as nt,ro as rt,so as it,ti as at,to as ot,vo as st,wo as ct,xo as lt,yo as ut,z as dt}from"./index-BsMTpxFY.js";import{i as ft,n as pt,r as mt,t as ht}from"./shared-ui-CUd8SsYi.js";import{t as gt}from"./environment-store-geigPfHz.js";var _t=h(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Q=e(o(),1),vt=`__custom__`;function yt(e){return e?!!(e.profile||e.provider||e.model):!1}function bt(e,t){let n=yt(e);return n===yt(t)?n?(e?.profile??null)===(t?.profile??null)&&(e?.provider??null)===(t?.provider??null)&&(e?.model??null)===(t?.model??null):!0:!1}var $=p();function xt({id:e,displayName:t,description:n,defaultProfileLabel:r,draft:i,profileOptions:a,onDraftChange:o,onToggle:s}){let c=yt(i),l=!i||!c?``:i.provider||i.model?vt:i.profile??``,u=l===vt,d=Fe(),f=d[0]??se[0],p=d.find(e=>e===i?.provider)??f,m=Y(p).map(e=>({value:e.id,label:e.displayName})),h=!!i?.provider&&!i?.model;function g(t){t===`__custom__`?o(e,{profile:null,provider:f,model:Ge(f)??``}):t===``?o(e,null):o(e,{profile:t,provider:null,model:null})}function _(t){let n=Ge(t)??``;o(e,{...i??{},profile:null,provider:t,model:n})}function v(t){o(e,{...i??{},model:t})}return(0,$.jsxs)(`div`,{className:`rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)] p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-body-medium-default font-medium text-[var(--content-default)]`,children:t}),n&&(0,$.jsxs)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:[n,r&&(0,$.jsxs)(`span`,{className:`ml-1.5 text-body-small-default text-[var(--content-tertiary)] opacity-60`,children:[`· Default: `,r]})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[c&&(0,$.jsx)(O,{value:l,onChange:g,options:a,className:`w-44`,menuMinWidth:280,menuAlign:`end`}),(0,$.jsx)(w,{checked:c,onChange:t=>s(e,t),"aria-label":`Override ${t}`})]})]}),c&&u&&(0,$.jsxs)(`div`,{className:`mt-3 space-y-2 border-t border-[var(--border-base)] pt-3`,children:[(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{className:`mb-1 block text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,$.jsx)(O,{value:p??``,onChange:_,options:d.map(e=>({value:e,label:ve[e]??e}))})]}),(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{className:`mb-1 block text-body-small-default text-[var(--content-tertiary)]`,children:`Model`}),(0,$.jsx)(O,{value:i?.model??``,onChange:v,options:m})]})]}),h&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:`Pick a model`})]})]})}function St({isOpen:e,onClose:t,assistantId:n}){let r=(0,Q.useRef)(!1);return(0,$.jsx)(T.Root,{open:e,onOpenChange:e=>{!e&&!r.current&&t()},children:e?(0,$.jsx)(Ct,{assistantId:n,onClose:t,onSavingChange:e=>{r.current=e}}):null})}function Ct({assistantId:e,onClose:t,onSavingChange:n}){let r=u(),{data:i}=d({...R({path:{assistant_id:e}}),staleTime:3e4}),o=(0,Q.useMemo)(()=>i?.llm?.profiles??{},[i?.llm?.profiles]),c=(0,Q.useMemo)(()=>i?.llm?.profileOrder??[],[i?.llm?.profileOrder]),l=(0,Q.useMemo)(()=>i?.llm?.callSites??{},[i?.llm?.callSites]),f=(0,Q.useMemo)(()=>Je(o,c),[o,c]),p=Fe(),m=P({onSuccess:t=>{W(r,{path:{assistant_id:e}},t)}}),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(``),[y,x]=(0,Q.useState)({}),[S,w]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(!1),{data:j,isLoading:M,isError:N,refetch:F}=d({...z({path:{assistant_id:e}}),enabled:!!e,staleTime:6e4,refetchOnWindowFocus:!1}),I=(0,Q.useMemo)(()=>(j?.callSites??[]).filter(e=>e.id!==`mainAgent`),[j]),L=!M&&!N&&!!j&&!!i,B=(0,Q.useMemo)(()=>I.map(e=>e.id),[I]),V=(0,Q.useMemo)(()=>{if(!L)return{};let e={};for(let t of B)if(t in y)e[t]=y[t];else{let n=l[t];e[t]=n?{...n}:{}}return e},[L,B,l,y]),H=(0,Q.useMemo)(()=>new Set(B),[B]),U=(0,Q.useMemo)(()=>Object.entries(l).some(([e,t])=>H.has(e)&&(t?.profile!=null||t?.provider!=null||t?.model!=null)),[l,H]),ee=(0,Q.useMemo)(()=>{if(!L)return!1;for(let e of Object.keys(V))if(!bt(V[e],l[e]))return!0;return!1},[L,V,l]),G=(0,Q.useMemo)(()=>Object.values(V).some(e=>yt(e)&&!!e?.provider&&!e?.model),[V]),K=(0,Q.useMemo)(()=>Ee(f,[]).map(e=>({value:e.name,label:dt(e)})),[f]),te=(0,Q.useCallback)(()=>{if(!_)return;let e={};for(let t of B)e[t]={profile:_};x(e)},[_,B]),ne=(0,Q.useCallback)(e=>[...Ee(f,[e]).map(e=>({value:e.name,label:dt(e)})),{value:vt,label:`Custom`}],[f]),q=(0,Q.useMemo)(()=>{if(!h.trim())return I;let e=h.toLowerCase();return I.filter(t=>(t.displayName??``).toLowerCase().includes(e)||(t.description??``).toLowerCase().includes(e)||(t.domain??``).toLowerCase().includes(e))},[I,h]),J=(0,Q.useMemo)(()=>{if(!j)return[];let e=j.domains.map(e=>e.id),t=new Map(j.domains.map(e=>[e.id,e])),n=[];for(let r of e){let e=q.filter(e=>e.domain===r);e.length>0&&n.push({domain:t.get(r),sites:e})}let r=new Set(e),i=q.filter(e=>!r.has(e.domain));return i.length>0&&n.push({domain:{id:`other`,displayName:`Other`},sites:i}),n},[j,q]),re=(0,Q.useCallback)((e,t)=>{x(n=>({...n,[e]:t}))},[]),Y=(0,Q.useCallback)((e,t)=>{if(!t){x(t=>({...t,[e]:null}));return}let n=Z(f,I.find(t=>t.id===e)?.defaultProfile);if(n)x(t=>({...t,[e]:{profile:n}}));else{let t=p[0]??se[0],n=Ge(t)??``;x(r=>({...r,[e]:{provider:t,model:n}}))}},[I,f,p]),X=(0,Q.useCallback)(async()=>{w(!0),n?.(!0);try{let n={};for(let e of Object.keys(V)){let t=V[e]??null;n[e]=yt(t)?{profile:t?.profile??null,provider:t?.provider??null,model:t?.model??null}:null}await m.mutateAsync({path:{assistant_id:e},body:{llm:{callSites:n}}}),t(),E.success(`Overrides saved.`)}catch(e){E.error(`Failed to save overrides. Please try again.`),a(e,{context:`call_site_overrides_save`})}finally{w(!1),n?.(!1)}},[V,t,m,n,e]),ie=(0,Q.useCallback)(async()=>{w(!0),n?.(!0);try{let n={};for(let e of Object.keys(V))n[e]=null;await m.mutateAsync({path:{assistant_id:e},body:{llm:{callSites:n}}}),t(),E.success(`Overrides reset.`)}catch(e){E.error(`Failed to reset overrides. Please try again.`),a(e,{context:`call_site_overrides_reset`})}finally{w(!1),n?.(!1)}},[V,t,m,n,e]);return(0,$.jsxs)(T.Content,{size:`lg`,hideCloseButton:!0,children:[(0,$.jsxs)(T.Header,{children:[(0,$.jsx)(T.Title,{children:`Action Overrides`}),(0,$.jsx)(T.Description,{children:`Customize which model profile specific actions should use. Uses your default profile if no override is set.`})]}),(0,$.jsxs)(T.Body,{children:[(0,$.jsx)(`div`,{className:`mb-4`,children:(0,$.jsx)(C,{type:`search`,value:h,onChange:e=>g(e.target.value),placeholder:`Search actions…`,leftIcon:(0,$.jsx)(je,{className:`h-4 w-4`}),fullWidth:!0})}),K.length>0&&(0,$.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)] p-3`,children:[(0,$.jsx)(`p`,{className:`min-w-0 flex-1 text-body-medium-default text-[var(--content-default)]`,children:`Use one profile for all actions`}),(0,$.jsx)(O,{value:_,onChange:v,options:K,placeholder:`Choose profile…`,className:`w-44`,menuMinWidth:280,menuAlign:`end`}),(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:te,disabled:!_||!L||S,children:`Apply to all`})]}),M&&(0,$.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,$.jsx)(b,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`})}),N&&(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-12 text-center`,children:[(0,$.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Couldn't load actions`}),(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Make sure your assistant is running`}),(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:()=>void F(),children:`Retry`})]}),!M&&!N&&j&&(0,$.jsx)(`div`,{className:`space-y-4`,children:J.length===0?(0,$.jsx)(`p`,{className:`py-8 text-center text-body-medium-lighter text-[var(--content-tertiary)]`,children:`No actions match your search.`}):J.map(({domain:e,sites:t})=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`mb-2 text-body-small-default font-semibold uppercase tracking-wider text-[var(--content-tertiary)]`,children:e.displayName}),(0,$.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>{let t=(()=>{let t=V[e.id]??null;return!t||!yt(t)?``:t.provider||t.model?`__custom__`:t.profile??``})(),n=e.defaultProfile?f.find(t=>t.name===e.defaultProfile)?.label??e.defaultProfile:null;return(0,$.jsx)(xt,{id:e.id,displayName:e.displayName,description:e.description,defaultProfileLabel:n,draft:V[e.id]??null,profileOptions:ne(t===``||t===`__custom__`?null:t),onDraftChange:re,onToggle:Y},e.id)})})]},e.id))})]}),(0,$.jsxs)(T.Footer,{children:[U&&(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:()=>A(!0),disabled:S||!L,tintColor:`var(--system-negative-strong)`,className:`mr-auto`,children:`Reset to Defaults`}),(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:t,disabled:S,children:`Cancel`}),(0,$.jsx)(s,{variant:`primary`,size:`compact`,onClick:()=>void X(),disabled:!ee||G||S,children:S?(0,$.jsx)(b,{className:`h-4 w-4 animate-spin`}):`Save`})]}),(0,$.jsx)(D,{open:k,title:`Reset to Defaults`,message:`Every task override will be reset and will follow your active profile. This cannot be undone.`,confirmLabel:`Reset to Defaults`,destructive:!0,onConfirm:()=>{A(!1),ie()},onCancel:()=>A(!1)})]})}function wt({blocked:e,availableReplacements:t,replacement:n,onReplacementChange:r,error:i,saving:a,onClose:o,onConfirm:c}){let l=``;if(e){let t=e.label||e.name;l=e.isActive&&e.callSiteIds.length>0?`"${t}" is the active profile and is used by ${e.callSiteIds.length} call site(s). Pick a replacement profile.`:e.isActive?`"${t}" is the active profile. Pick a different active profile before deleting, or select a replacement below.`:`"${t}" is used by ${e.callSiteIds.length} call site(s). Select a replacement profile to reassign them before deleting.`}return(0,$.jsx)(T.Root,{open:e!==null,onOpenChange:e=>{e||o()},children:(0,$.jsxs)(T.Content,{size:`sm`,children:[(0,$.jsx)(T.Header,{children:(0,$.jsx)(T.Title,{children:`Can't Delete Profile`})}),(0,$.jsxs)(T.Body,{className:`space-y-4`,children:[(0,$.jsx)(m,{variant:`body-medium-default`,as:`p`,children:l}),e&&e.callSiteIds.length>0&&(0,$.jsx)(`ul`,{className:`space-y-1 pl-1`,children:e.callSiteIds.map(e=>(0,$.jsxs)(`li`,{className:`text-body-small-default text-(--content-secondary)`,children:[`• `,(0,$.jsx)(`code`,{children:e})]},e))}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Replacement profile`}),(0,$.jsx)(O,{"aria-label":`Replacement profile`,value:n,onChange:r,options:[{value:``,label:`Select a replacement…`},...t.map(e=>({value:e.name,label:e.label??e.name}))]})]}),i&&(0,$.jsx)(m,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:i})]}),(0,$.jsxs)(T.Footer,{children:[(0,$.jsx)(s,{variant:`ghost`,size:`compact`,onClick:o,children:`Cancel`}),(0,$.jsx)(s,{variant:`primary`,size:`compact`,disabled:!n||a,onClick:c,children:a?`Saving…`:`Reassign and Delete`})]})]})})}function Tt(e,t){if(e){let n=Y(e).find(e=>e.id===t);if(n)return n.displayName}let n=t.lastIndexOf(`/`);return n>=0?t.slice(n+1):t}function Et(e,t){let n=[];e.description&&n.push(e.description);let r=e.provider_connection===`vellum`&&t?`vellum`:e.provider,i=[];if(e.model&&i.push(Tt(r,e.model)),r){let e=ve[r]??r;i.push(`hosted by ${e}`)}return i.length>0&&n.push(i.join(` `)),n.join(` – `)}function Dt({profile:e,vellumIsManaged:t,isDragging:n,dropTarget:r,isDeleting:i,deleteError:a,isToggling:o,onDragStart:c,onDragEnd:l,onDragOver:u,onDragLeave:d,onDrop:f,onEditClick:p,onDeleteClick:h,onStatusToggle:g}){let _=e.source===`managed`,v=e.invariant===!0,y=e.status!==`disabled`;return(0,$.jsxs)(`div`,{className:`relative`,children:[r?.name===e.name&&!r.after&&(0,$.jsx)(`div`,{className:`mx-0 h-0.5 rounded-full bg-[var(--border-active)]`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg pr-2 py-2${n?` opacity-50`:``}`,draggable:!_,onDragStart:c,onDragEnd:l,onDragOver:u,onDragLeave:d,onDrop:f,children:[(0,$.jsx)(_t,{className:`h-4 w-4 shrink-0 ${_?`invisible`:`cursor-grab text-[var(--content-tertiary)]`}`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1${y?``:` opacity-55`}`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(m,{variant:`body-medium-default`,as:`span`,className:`text-(--content-default)`,children:e.label??e.name}),_&&(0,$.jsx)(S,{tone:`positive`,title:`Managed by Platform — this profile cannot be disabled, deleted, or renamed.`,children:`Platform`})]}),e.description||e.model||e.provider?(0,$.jsx)(m,{variant:`body-medium-lighter`,as:`p`,className:`mt-0.5 text-(--content-tertiary)`,children:Et(e,t)}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(!v||!y)&&(0,$.jsx)(`div`,{className:`flex shrink-0 items-center`,title:y?`Active — toggle to hide from pickers`:`Disabled — toggle to show in pickers`,children:(0,$.jsx)(w,{checked:y,onChange:e=>g(e),disabled:o,"aria-label":`${y?`Disable`:`Enable`} ${e.label??e.name}`})}),(0,$.jsxs)(`div`,{className:`flex w-[92px] items-center justify-end gap-2`,children:[(0,$.jsx)(s,{variant:`ghost`,size:`compact`,onClick:p,children:_||v?`View`:`Edit`}),(0,$.jsx)(s,{variant:`ghost`,size:`compact`,iconOnly:(0,$.jsx)(De,{}),"aria-label":`Delete ${e.label??e.name}`,disabled:_||v||i,title:_||v?`Managed profiles cannot be deleted`:void 0,onClick:h,tintColor:`var(--system-negative-strong)`})]})]})]}),r?.name===e.name&&r.after&&(0,$.jsx)(`div`,{className:`mx-0 h-0.5 rounded-full bg-[var(--border-active)]`}),a?(0,$.jsx)(m,{variant:`body-small-default`,as:`p`,className:`px-2 pb-1 text-(--system-negative-strong)`,children:a}):null]})}function Ot({isOpen:e,assistantId:t,onClose:n}){let r=u(),{data:i}=d({...R({path:{assistant_id:t}}),staleTime:3e4}),o=(0,Q.useMemo)(()=>i?.llm?.profiles??{},[i?.llm?.profiles]),s=(0,Q.useMemo)(()=>i?.llm?.profileOrder??[],[i?.llm?.profileOrder]),c=i?.llm?.activeProfile??null,l=i?.llm?.callSites??{},f=(0,Q.useMemo)(()=>Je(o,s),[o,s]),p=P({onSuccess:e=>{W(r,{path:{assistant_id:t}},e)}}),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(null),{data:v}=d({...I({path:{assistant_id:t}}),enabled:e}),y=v?.connections,b=y?.some(e=>e.name===`vellum`&&e.provider===`vellum`)??!1,x=Object.keys(o);async function S(e,n,r){let i=r?.mode??`replace`,c=!(e in o);if(i===`merge`&&!c){await p.mutateAsync({path:{assistant_id:t},body:{llm:{profiles:{[e]:n}}}}),h(!1),_(null);return}let l={profiles:{[e]:n}};if(c&&(l.profileOrder=s.includes(e)?s:[...s,e]),c)await p.mutateAsync({path:{assistant_id:t},body:{llm:l}});else{let n=o[e];await p.mutateAsync({path:{assistant_id:t},body:{llm:{profiles:{[e]:null}}}});try{await p.mutateAsync({path:{assistant_id:t},body:{llm:l}})}catch(r){throw a(r,{context:`settings-ai-profile-edit-recreate`}),n!=null&&await p.mutateAsync({path:{assistant_id:t},body:{llm:{profiles:{[e]:n}}}}).catch(()=>{}),r}}c&&E.success(`Profile "${n.label??e}" created`),h(!1),_(null)}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(T.Root,{open:e,onOpenChange:e=>{e||n()},children:e?(0,$.jsx)(kt,{assistantId:t,vellumIsManaged:b,profiles:o,profileOrder:s,orderedProfiles:f,activeProfile:c,callSiteOverrides:l,onClose:n,onEditClick:e=>{_(e),h(!0)},onNewClick:()=>{_(null),h(!0)}}):null}),(0,$.jsx)(Ae,{isOpen:m,mode:g?g.source===`managed`||g.invariant===!0?`view`:`edit`:`create`,profileName:g?.name,initialValues:g??void 0,existingNames:x,connections:y,assistantId:t,onSave:S,onCancel:()=>{h(!1),_(null)}})]})}function kt({assistantId:e,vellumIsManaged:t,profiles:n,profileOrder:r,orderedProfiles:i,activeProfile:o,callSiteOverrides:c,onClose:l,onEditClick:d,onNewClick:f}){let p=u(),h=P({onSuccess:t=>{W(p,{path:{assistant_id:e}},t)}}),[g,_]=(0,Q.useState)({}),[v,y]=(0,Q.useState)({}),[b,x]=(0,Q.useState)(new Set),[S,C]=(0,Q.useState)(null),[w,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(null),j=(0,Q.useRef)(null),M=(0,Q.useRef)(null),[N,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(``),[B,V]=(0,Q.useState)(!1),H=(0,Q.useMemo)(()=>i,[i]);async function U(t,r){if(b.has(t.name))return!1;x(e=>new Set(e).add(t.name)),C(null);let i=r?`active`:`disabled`;if(!n[t.name])return x(e=>{let n=new Set(e);return n.delete(t.name),n}),!1;try{return await h.mutateAsync({path:{assistant_id:e},body:{llm:{profiles:{[t.name]:{status:i}}}}}),!0}catch(e){return a(e,{context:`settings-ai-profile-toggle`}),C(`Couldn't update "${t.label??t.name}". Please try again.`),!1}finally{x(e=>{let n=new Set(e);return n.delete(t.name),n})}}async function ee(t){y(e=>({...e,[t]:!0})),_(e=>{let n={...e};return delete n[t],n});try{let n=r.filter(e=>e!==t);await h.mutateAsync({path:{assistant_id:e},body:{llm:{profiles:{[t]:null},profileOrder:n}}})}catch(e){a(e,{context:`settings-ai-profile-delete`}),_(e=>({...e,[t]:`Failed to delete profile. Please try again.`}))}finally{y(e=>{let n={...e};return delete n[t],n})}}function G(e){let t=H.find(t=>t.name===e)?.label??e,n=e===o,r=Object.entries(c).filter(([t,n])=>t!==`mainAgent`&&n?.profile===e).map(([e])=>e);if(n||r.length>0){F({name:e,label:t,isActive:n,callSiteIds:r}),z(``),L(null);return}ee(e)}async function K(){if(!N||!R)return;V(!0),L(null);let t={};if(N.isActive&&(t.activeProfile=R),N.callSiteIds.length>0){let e={};for(let t of N.callSiteIds)e[t]={profile:R};t.callSites=e}if(Object.keys(t).length>0)try{await h.mutateAsync({path:{assistant_id:e},body:{llm:t}})}catch(e){a(e,{context:`settings-ai-profile-reassign-delete`}),L(`Failed to reassign references. Please try again.`),V(!1);return}let n=N.name;F(null),V(!1),ee(n)}async function te(t,n){if(t===n.name)return;A(null);let i=r.filter(e=>e!==t),o=i.indexOf(n.name);if(o===-1)return;n.after&&(o+=1);let s=[...i.slice(0,o),t,...i.slice(o)];try{await h.mutateAsync({path:{assistant_id:e},body:{llm:{profileOrder:s}}})}catch(e){a(e,{context:`settings-ai-profile-reorder`}),A(`Failed to reorder profiles. Please try again.`)}}let ne=H.filter(e=>e.name!==N?.name&&e.source!==`managed`),q=ne.length>0?ne:H.filter(e=>e.name!==N?.name);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(T.Content,{size:`md`,children:[(0,$.jsxs)(T.Header,{children:[(0,$.jsx)(T.Title,{children:`Model Profiles`}),(0,$.jsx)(T.Description,{children:`Bundle a provider and model into a named profile. Assign profiles to specific actions or swap between them when chatting.`})]}),(0,$.jsxs)(T.Body,{children:[H.length===0?(0,$.jsx)(m,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:`No profiles yet. Create one to get started.`}):(0,$.jsx)(`div`,{className:`space-y-1`,children:H.map(e=>(0,$.jsx)(Dt,{profile:e,vellumIsManaged:t,isDragging:w===e.name,dropTarget:D,isDeleting:v[e.name]??!1,deleteError:g[e.name],isToggling:b.has(e.name),onDragStart:t=>{j.current=e.name,E(e.name),t.dataTransfer&&(t.dataTransfer.effectAllowed=`move`)},onDragEnd:()=>{j.current=null,M.current=null,E(null),O(null)},onDragOver:t=>{t.preventDefault();let n=t.currentTarget.getBoundingClientRect(),r=t.clientY>n.top+n.height/2,i={name:e.name,after:r};M.current=i,O(i)},onDragLeave:t=>{t.currentTarget.contains(t.relatedTarget)||(M.current=null,O(t=>t?.name===e.name?null:t))},onDrop:e=>{e.preventDefault();let t=j.current,n=M.current;j.current=null,M.current=null,E(null),O(null),t&&n&&te(t,n)},onEditClick:()=>d(e),onDeleteClick:()=>G(e.name),onStatusToggle:t=>void U(e,t)},e.name))}),k&&(0,$.jsx)(m,{variant:`body-small-default`,as:`p`,className:`mt-2 text-(--system-negative-strong)`,children:k}),S&&(0,$.jsx)(m,{variant:`body-small-default`,as:`p`,className:`mt-2 text-(--system-negative-strong)`,children:S})]}),(0,$.jsxs)(T.Footer,{className:`justify-between`,children:[(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:f,children:`+ New Profile`}),(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:l,children:`Done`})]})]}),(0,$.jsx)(wt,{blocked:N,availableReplacements:q,replacement:R,onReplacementChange:z,error:I,saving:B,onClose:()=>{F(null),L(null)},onConfirm:()=>void K()})]})}var At=`0.10.8`;function jt(){return G(At)}function Mt({mode:e,connection:t,assistantId:n,existingNames:r,onSave:i,onCancel:a}){let[o,c]=(0,Q.useState)(t?.label??``),l=t?.name??``,d=t?.provider??`anthropic`,f=t?.auth.type??`api_key`,[p,h]=(0,Q.useState)(()=>t?.auth.type===`api_key`?t.auth.credential:t?``:`credential/anthropic/api_key`),[g,_]=(0,Q.useState)(t?.baseUrl??``),[v,y]=(0,Q.useState)(()=>t?.models?t.models.map(e=>e.id).join(`, `):``),[b,x]=(0,Q.useState)(!1),[S,w]=(0,Q.useState)(null),E=d===`openai-compatible`,[D,O]=(0,Q.useState)(``),[k,M]=(0,Q.useState)(!1),N=u(),P=(0,Q.useMemo)(()=>it(p),[p]),F=f===`api_key`&&P!==null,{hasStoredCredential:I,isLoading:R}=Ue({assistantId:n,credentialKind:`credential`,credentialName:P?`${P.service}:${P.field}`:``,enabled:F}),{credentials:z}=J({assistantId:n,enabled:f===`api_key`});(0,Q.useEffect)(()=>{let e=t?.provider??`anthropic`;c(t?.label??``),t?.auth.type===`api_key`?h(t.auth.credential):h(t?``:`credential/${e}/api_key`),w(null),_(t?.baseUrl??``),y(t?.models?t.models.map(e=>e.id).join(`, `):``),O(``),M(!1)},[t]);let B=l.trim().length>0;async function V(){if(B){x(!0),w(null);try{let e;if(f===`api_key`){let t=p.trim()||`credential/${d}/api_key`,r=D.trim();if(r){M(!0);try{let e=it(t);await j({path:{assistant_id:n},body:e?{type:`credential`,name:`${e.service}:${e.field}`,value:r}:{type:`api_key`,name:d,value:r},throwOnError:!0});let i=rt(n,`credential`,e?`${e.service}:${e.field}`:``);N.setQueryData(i,!0),N.invalidateQueries({queryKey:L({path:{assistant_id:n}})})}catch{w(`Failed to save API key. Please try again.`);return}finally{M(!1)}}e={type:`api_key`,credential:t}}else if(t)e=t.auth;else{w(`Nothing to edit. Close and try again.`);return}let r=o.trim()||null,a={auth:e,label:r,...E&&{base_url:g.trim()||null,models:v.trim()?v.split(`,`).map(e=>({id:e.trim()})).filter(e=>e.id):null}},{data:s,error:c,response:u}=await A({path:{assistant_id:n,name:t?.name??l.trim()},body:a});if(!u?.ok){w(qe(u?.status,c)??Qe(u?.status));return}if(!s){w(`Server returned an empty response. Please try again.`);return}i(s)}catch{w(`Failed to save provider. Please try again.`)}finally{x(!1)}}}let H=z.filter(e=>e.service===d),U=e!==`create`&&t?.auth.type===`api_key`,W=H.length>0||U,ee=ze(`Enter your API key`,I);return e===`create`?(0,$.jsx)(xe,{variant:`modal`,assistantId:n,existingNames:r,defaultProviderType:d,onCreated:i,onCancel:a}):(0,$.jsxs)(T.Content,{size:`md`,children:[(0,$.jsxs)(T.Header,{children:[(0,$.jsx)(T.Title,{children:`Edit Provider`}),(0,$.jsx)(T.Description,{children:t?`Editing ${Le(t)}.`:`Edit provider settings.`})]}),(0,$.jsxs)(T.Body,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:[`Display Name`,` `,(0,$.jsx)(`span`,{className:`text-[var(--content-disabled)]`,children:`(optional)`})]}),(0,$.jsx)(C,{value:o,onChange:e=>c(e.target.value),placeholder:`e.g. My Anthropic Key`,fullWidth:!0})]}),E&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Base URL`}),(0,$.jsx)(C,{value:g,onChange:e=>_(e.target.value),placeholder:`https://api.example.com/v1`,fullWidth:!0})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Models`}),(0,$.jsx)(C,{value:v,onChange:e=>y(e.target.value),placeholder:`model-1, model-2`,fullWidth:!0}),(0,$.jsx)(m,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:`Comma-separated model identifiers exposed by your endpoint.`})]})]}),f===`api_key`&&(0,$.jsx)(ot,{apiKeyValue:D,onApiKeyChange:O,credential:p,onCredentialChange:h,isLoadingCredential:R,apiKeyPlaceholder:ee,provider:d,providerCredentials:H,showAdvancedSection:W,onError:w}),f===`oauth_subscription`&&(0,$.jsx)(Xe,{assistantId:n,onConnected:i}),S&&(0,$.jsx)(m,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:S})]}),(0,$.jsxs)(T.Footer,{children:[(0,$.jsx)(s,{variant:`ghost`,size:`compact`,onClick:a,children:`Cancel`}),(0,$.jsx)(s,{variant:`primary`,size:`compact`,disabled:!B||b||k,onClick:()=>void V(),children:b?`Saving…`:`Save`})]})]})}var Nt={anthropic:!0,openai:!0,gemini:!0,fireworks:!0,openrouter:!0,vellum:!0};function Pt(e){return e in Nt}function Ft({isOpen:e,assistantId:t,onClose:n}){let[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(null),s=u(),{data:c,isLoading:l,isError:f}=d({...I({path:{assistant_id:t}}),enabled:e}),p=jt(),{data:m}=d({...B({path:{assistant_id:t}}),enabled:e&&p}),h=(0,Q.useMemo)(()=>{let e=c?.connections??[];return[...e.filter(e=>e.provider===ae),...e.filter(e=>e.provider!==ae)]},[c]);function g(){s.invalidateQueries({queryKey:U({path:{assistant_id:t}})}),s.invalidateQueries({queryKey:V({path:{assistant_id:t}})})}function _(e){s.invalidateQueries({queryKey:F({path:{assistant_id:t}})}),i(!1),o(null)}let v=h.map(e=>e.name),y=()=>{i(!1),o(null)};return(0,$.jsx)(T.Root,{open:e,onOpenChange:e=>{e||(r?y():n())},children:e?r?(0,$.jsx)(Mt,{mode:a?`edit`:`create`,connection:a??void 0,assistantId:t,existingNames:v,onSave:_,onCancel:y}):(0,$.jsx)(It,{connections:h,loading:l,isError:f,assistantId:t,supportsDefaultProvider:p,defaultConnectionName:p?m?.resolvedConnectionName??null:null,onDefaultChanged:g,onClose:n,onEditClick:e=>{o(e),i(!0)},onNewClick:()=>{o(null),i(!0)},onConnectionDeleted:()=>{s.invalidateQueries({queryKey:F({path:{assistant_id:t}})})}}):null})}function It({connections:e,loading:t,isError:n,assistantId:r,supportsDefaultProvider:i,defaultConnectionName:o,onDefaultChanged:c,onClose:l,onEditClick:u,onNewClick:d,onConnectionDeleted:p}){let[h,g]=(0,Q.useState)({}),[_,v]=(0,Q.useState)({}),y=f({...H(),onMutate:e=>{let t=e.body?.connectionName;t&&g(e=>{let n={...e};return delete n[t],n})},onSuccess:c,onError:(e,t)=>{a(e,{context:`settings-ai-set-default-provider`});let n=t.body?.connectionName;n&&g(e=>({...e,[n]:`Failed to set default provider. Please try again.`}))}});function b(e){Pt(e.provider)&&y.mutate({path:{assistant_id:r},body:{provider:e.provider,connectionName:e.name}})}async function x(e){v(t=>({...t,[e]:!0})),g(t=>{let n={...t};return delete n[e],n});try{let{response:t}=await k({path:{assistant_id:r,name:e}});t?.ok||t?.status===404?p(e):t?.status===409?g(t=>({...t,[e]:`This provider is in use by a profile or as the default provider. Update those settings before deleting it.`})):g(t=>({...t,[e]:`Failed to delete provider. Please try again.`}))}catch{g(t=>({...t,[e]:`Failed to delete provider. Please try again.`}))}finally{v(t=>{let n={...t};return delete n[e],n})}}return(0,$.jsxs)(T.Content,{size:`md`,children:[(0,$.jsxs)(T.Header,{children:[(0,$.jsx)(T.Title,{children:`Providers`}),(0,$.jsx)(T.Description,{children:`Manage the model providers your assistant can use.`})]}),(0,$.jsx)(T.Body,{children:t?(0,$.jsx)(`div`,{className:`space-y-2 py-2`,children:[1,2,3].map(e=>(0,$.jsx)(`div`,{className:`h-10 animate-pulse rounded-lg bg-[var(--surface-active)]`},e))}):n?(0,$.jsx)(m,{variant:`body-medium-default`,as:`p`,className:`py-4 text-center text-(--system-negative-strong)`,children:`Failed to load providers. Please try again.`}):e.length===0?(0,$.jsx)(m,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:`No providers yet. Add one to get started.`}):(0,$.jsx)(`div`,{className:`space-y-1`,children:e.map(e=>{let t=_[e.name]??!1,n=h[e.name],r=e.isManaged??!1,a=e.name===o,c=Pt(e.provider),l=y.isPending&&y.variables?.body?.connectionName===e.name;return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg px-2 py-2`,children:[(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(m,{variant:`body-medium-default`,as:`span`,className:`text-(--content-default)`,children:Le(e)}),r&&(0,$.jsx)(S,{tone:`positive`,title:`Managed by Platform — you can rename this provider, but not edit it.`,children:`Platform`}),a&&(0,$.jsx)(S,{tone:`info`,title:`Built-in profiles (Balanced, Quality, Speed) use this provider.`,children:`Default`})]})}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[i&&!a&&(0,$.jsx)(s,{variant:`ghost`,size:`compact`,disabled:!c||l,title:c?`Use this provider for the built-in profiles.`:`Built-in profiles can't run on this provider.`,onClick:()=>b(e),children:`Set as default`}),!r&&(0,$.jsx)(s,{variant:`ghost`,size:`compact`,onClick:()=>u(e),children:`Edit`}),(0,$.jsx)(s,{variant:`ghost`,size:`compact`,iconOnly:(0,$.jsx)(De,{}),"aria-label":`Delete ${Le(e)}`,disabled:r||a||t,title:r?`The Vellum provider cannot be removed`:a?`This is your default provider. Set another provider as default first.`:void 0,onClick:()=>void x(e.name),tintColor:`var(--system-negative-strong)`})]})]}),n?(0,$.jsx)(m,{variant:`body-small-default`,as:`p`,className:`px-2 pb-1 text-(--system-negative-strong)`,children:n}):null]},e.name)})})}),(0,$.jsxs)(T.Footer,{className:`justify-between`,children:[(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:d,children:`+ Add Provider`}),(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:l,children:`Done`})]})]})}function Lt(){let e=fe(),t=u(),{data:n}=d({...R({path:{assistant_id:e}}),staleTime:3e4}),r=jt(),{data:i,refetch:o}=d({...B({path:{assistant_id:e}}),enabled:r}),c=i?.availability,l=n?.llm?.activeProfile??null,f=n?.llm?.advisorProfile??null,p=n?.llm?.callSites??{},{profiles:h,profileOrder:g}=Ce(n?.llm,e),_=(0,Q.useMemo)(()=>Je(h,g),[h,g]),v=P({onSuccess:n=>{W(t,{path:{assistant_id:e}},n)}}),[y,S]=et(l),[C,w]=et(f),[T,D]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(!1),N=(0,Q.useMemo)(()=>Ee(_,[y]),[_,y]),F=(0,Q.useMemo)(()=>Ee(_,[C]),[_,C]),I=Object.entries(p).filter(([e,t])=>e!==`mainAgent`&&(t?.profile!=null||t?.provider!=null||t?.model!=null)).length,L=I===1?`1 Override`:I>0?`${I} Overrides`:`Overrides`,z=y!==l,V=C!==f,H=(0,Q.useCallback)(async()=>{try{let t={};z&&(t.activeProfile=y),V&&(t.advisorProfile=C),await v.mutateAsync({path:{assistant_id:e},body:{llm:t}}),E.success(`Saved.`)}catch(e){E.error(`Failed to save. Please try again.`),a(e,{context:`settings-ai-language-model-save`})}},[z,V,y,C,v,e]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ht,{title:`Language Model`,subtitle:`Configure the LLMs that power your assistant`,children:(0,$.jsxs)(`div`,{className:`space-y-4`,children:[c&&c.status!==`ok`&&(0,$.jsx)(x,{tone:c.status===`unknown`?`warning`:`error`,children:c.message??`Your default provider is not available.`}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Default Profile`}),(0,$.jsx)(O,{value:y??``,onChange:e=>{S(e===``?null:e)},placeholder:`Select a default profile…`,options:N.map(e=>({value:e.name,label:dt(e)}))}),N.length===0?(0,$.jsx)(m,{variant:`body-small-default`,as:`p`,className:`mt-1 text-(--content-tertiary)`,children:`No profiles yet. Click Profiles below to create one.`}):null]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Advisor Profile`}),(0,$.jsx)(O,{value:C??``,onChange:e=>{w(e===``?null:e)},placeholder:`Select an advisor profile…`,options:F.map(e=>({value:e.name,label:dt(e)}))}),(0,$.jsx)(m,{variant:`body-small-default`,as:`p`,className:`mt-1 text-(--content-tertiary)`,children:`Which model your assistant consults for a second opinion`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:()=>M(!0),children:`Providers`}),(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:()=>D(!0),children:`Profiles`}),(0,$.jsx)(s,{variant:`outlined`,size:`compact`,onClick:()=>A(!0),children:L})]}),(z||V)&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(he,{onClick:H,disabled:v.isPending}),v.isPending&&(0,$.jsx)(b,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`})]})]})}),e&&(0,$.jsx)(Ot,{isOpen:T,assistantId:e,onClose:()=>D(!1)}),e&&(0,$.jsx)(St,{isOpen:k,onClose:()=>A(!1),assistantId:e}),e&&(0,$.jsx)(Ft,{isOpen:j,assistantId:e,onClose:()=>{M(!1),r&&o()}})]})}function Rt(){let e=fe();return(0,Q.useCallback)(async(t,n)=>{try{let{data:r}=await j({path:{assistant_id:e},body:{value:n,type:`api_key`,name:t},throwOnError:!0});$e(r)}catch(e){throw e instanceof Error&&e.message===`No assistant found`?E.error(`Assistant not ready. Please try again.`):E.error(`Failed to save ${t} API key. Please try again.`),a(e,{context:`provision_provider_key`}),e}},[e])}var zt=`0.10.12`;function Bt(){return K(zt)}function Vt(){let e=fe(),i=u(),o=q(),{data:s}=d({...R({path:{assistant_id:e}}),enabled:o,staleTime:3e4}),c=P({onSuccess:t=>{W(i,{path:{assistant_id:e}},t)}}),l=Rt(),f=(0,Q.useMemo)(()=>{if(!s)return r(ge,`inference-provider-native`);let e=s.services?.[`web-search`];return(e?.mode===`managed`&&e?.provider!==`inference-provider-native`?`vellum`:e?.provider)||r(`vellum:ai:webSearchProvider`,`inference-provider-native`)},[s]),[p,m]=(0,Q.useState)(!1),[h,g]=et(f),[_,v]=(0,Q.useState)(``),y=st.has(h),{hasStoredCredential:x}=Ue({assistantId:e,credentialKind:`api_key`,credentialName:h,enabled:y}),S=_.trim().length>0,w=p||y&&!x&&!S||h===f&&!S,T=ze(lt[h]??`Enter your API key`,x),D=(0,Q.useCallback)(async()=>{m(!0);let t=_.trim(),r=Ve(h),o=y&&t.length>0;try{o&&await l(h,t),await ee();let n=h===`vellum`?Bt()?{provider:`vellum`,mode:`managed`}:{mode:`managed`}:{provider:h,mode:`your-own`};await c.mutateAsync({path:{assistant_id:e},body:{services:{"web-search":n}}}).catch(e=>{throw E.error(`Failed to update assistant configuration. Please try again.`),a(e,{context:`patch_daemon_config`}),e})}catch{m(!1);return}m(!1);try{if(n(ge,h),o){r&&n(r,t);let a=rt(e,`api_key`,h);i.setQueryData(a,!0),i.invalidateQueries({queryKey:a}),v(``)}E.success(`Web search settings saved.`)}catch(e){a(e,{context:`settings-ai-web-search-persist-local`}),E.error(`Saved, but local preferences could not be written.`)}},[y,c,l,i,e,_,h]),k=(0,Q.useCallback)(()=>{let e=Ve(h);e&&t(e),v(``),g(`inference-provider-native`),n(ge,`inference-provider-native`)},[h,g]);return(0,$.jsx)(ht,{title:`Web Search`,subtitle:`Configure how your assistant should search the web`,children:(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,$.jsx)(O,{"aria-label":`Web search provider`,value:h,onChange:g,options:Ie.map(e=>({value:e,label:ut[e]??e}))})]}),h===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Search runs through your Vellum account.`}),y&&(0,$.jsx)(C,{label:`API Key`,type:`password`,value:_,onChange:e=>v(e.target.value),placeholder:T,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(he,{onClick:D,disabled:w}),p&&(0,$.jsx)(b,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),y&&(0,$.jsx)(le,{onClick:k,filled:!0})]})]})})}var Ht=`default`;function Ut(){let e=fe(),i=u(),{data:o}=d({...R({path:{assistant_id:e}}),staleTime:3e4}),s=P({onSuccess:t=>{W(i,{path:{assistant_id:e}},t)}}),c=Rt(),l=(0,Q.useMemo)(()=>o?o.services?.[`web-fetch`]?.provider||r(`vellum:ai:webFetchProvider`,Ht):r(We,Ht),[o]),[f,p]=(0,Q.useState)(!1),[m,h]=et(l),[g,_]=(0,Q.useState)(``),v=we.has(m),{hasStoredCredential:y}=Ue({assistantId:e,credentialKind:`api_key`,credentialName:m,enabled:v}),x=g.trim().length>0,S=f||v&&!y&&!x||m===l&&!x,w=ze(Te[m]??`Enter your API key`,y),T=(0,Q.useCallback)(async()=>{p(!0);let t=g.trim(),r=v&&t.length>0;try{r&&await c(m,t),await s.mutateAsync({path:{assistant_id:e},body:{services:{"web-fetch":{provider:m}}}}).catch(e=>{throw E.error(`Failed to update assistant configuration. Please try again.`),a(e,{context:`patch_daemon_config`}),e})}catch{p(!1);return}p(!1);try{if(n(We,m),r){let r=He(m);r&&n(r,t);let a=rt(e,`api_key`,m);i.setQueryData(a,!0),i.invalidateQueries({queryKey:a}),_(``)}E.success(`Web fetch settings saved.`)}catch(e){a(e,{context:`settings-ai-web-fetch-persist-local`}),E.error(`Saved, but local preferences could not be written.`)}},[v,s,c,i,e,g,m]),D=(0,Q.useCallback)(()=>{let e=He(m);e&&t(e),_(``),h(Ht),n(We,Ht)},[m,h]);return(0,$.jsx)(ht,{id:`web-fetch`,title:`Web Fetch`,subtitle:`Configure how your assistant reads individual web pages`,children:(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,$.jsx)(O,{value:m,onChange:h,options:ct.map(e=>({value:e,label:ie[e]??e}))})]}),v&&(0,$.jsx)(C,{label:`API Key`,type:`password`,value:g,onChange:e=>_(e.target.value),placeholder:w,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(he,{onClick:T,disabled:S}),f&&(0,$.jsx)(b,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),v&&(0,$.jsx)(le,{onClick:D,filled:!0})]})]})})}function Wt({subdomain:e,onSubdomainChange:t,domainSuffix:n,subdomainPlaceholder:r=`my-assistant`,disabled:i,autoFocus:a,prefix:o,error:s,locked:c,lockedMessage:l}){return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex h-9 w-full items-center rounded-md border bg-[var(--field-bg)] text-body-medium-lighter transition-[border-color] duration-150 ${s?`border-[var(--system-negative-strong)]`:`border-[var(--field-border)] focus-within:border-[var(--border-active)]`}`,children:[o,(0,$.jsx)(`input`,{value:e,onChange:e=>t(e.target.value.toLowerCase().trim()),disabled:i||c,readOnly:c,autoFocus:a,placeholder:r,"aria-label":`Subdomain`,"aria-invalid":!!s,className:`h-full min-w-0 flex-1 bg-transparent ${o?`pl-1.5`:`pl-3`} pr-1 text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] outline-none disabled:cursor-not-allowed disabled:opacity-60`}),(0,$.jsxs)(`span`,{className:`shrink-0 pr-3 font-mono text-[var(--content-secondary)]`,children:[`.`,n]})]}),s&&(0,$.jsx)(`p`,{className:`mt-1.5 text-body-small-default text-[var(--system-negative-strong)]`,children:s}),c&&l&&(0,$.jsx)(`p`,{className:`mt-1.5 text-body-small-default text-[var(--content-tertiary)]`,children:l})]})}function Gt({assistantId:e,assistantHandle:t,emailRootDomain:n}){let r=u(),i=l(),[o,p]=c(),[m,h]=(0,Q.useState)(``),[g,v]=(0,Q.useState)(!1),[y,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(``),[T,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{g||!t||m||(h(t),v(!0))},[t,g,m]);let F=d({...pe(),enabled:!0}),I=F.data,L=I?.entitlements,R=L?.managed_email===!0,z=!!L&&!R,B=!I&&F.isError&&!F.isFetching,V=d({...ke({path:{assistant_id:e}}),enabled:!z}),H=d({...Re({path:{assistant_id:e}}),enabled:!z}),U=V.data?.results?.[0],W=H.data?.results?.[0],ee=U?`${U.subdomain}.${n}`:null,G=d({...Ye({path:{assistant_id:e,id:W?.id??``}}),enabled:!!W?.id,refetchOnWindowFocus:!1}),K=d({...Me({path:{assistant_id:e,id:U?.id??``}}),enabled:!!U?.id,refetchInterval:e=>{let t=e.state.data?.status;return t===`verified`||t===`failed`?!1:1e4},refetchOnWindowFocus:!0});(0,Q.useEffect)(()=>{o.get(`release`)!==`1`||!U||W||(M(!0),p(e=>{let t=new URLSearchParams(e);return t.delete(`release`),t},{replace:!0}))},[W,U,o,p]);let q=f(tt()),J=f(me()),Y=f(Se()),X=f(re()),Z=(0,Q.useCallback)(()=>{let t={assistant_id:e};r.invalidateQueries({queryKey:Oe({path:t})}),r.invalidateQueries({queryKey:at({path:t})}),W?.id&&r.invalidateQueries({queryKey:nt({path:{...t,id:W.id}})}),r.invalidateQueries({queryKey:Ze()})},[W?.id,e,r]),ie=(0,Q.useCallback)(async()=>{let t=m.trim().toLowerCase();if(!t){S(`Enter a subdomain.`);return}A(!1);try{await q.mutateAsync({path:{assistant_id:e},body:{subdomain:t}}),h(``),S(null),Z(),E.success(`Domain ${t}.${n} registered.`)}catch(e){S(te(e,void 0,`Failed to register domain.`))}},[e,n,Z,q,m]),ae=(0,Q.useCallback)(async()=>{let t=C.trim().toLowerCase();if(!t){O(`Enter an email username.`);return}try{await Y.mutateAsync({path:{assistant_id:e},body:{username:t}}),w(``),O(null),Z(),E.success(`Email address created.`)}catch(e){O(te(e,void 0,`Failed to create email address.`))}},[e,Z,Y,C]),oe=(0,Q.useCallback)(async()=>{if(W?.id){P(!1);try{await X.mutateAsync({path:{assistant_id:e,id:W.id}}),Z(),E.success(`Email address removed.`)}catch(e){a(e,{context:`email_address_delete`}),E.error(`Failed to remove email address.`)}}},[W?.id,e,X,Z]),se=(0,Q.useCallback)(async()=>{if(!U?.id)return;if(W){E.error(`Remove the email address first.`);return}M(!1);let t=U.subdomain;try{await J.mutateAsync({path:{assistant_id:e,id:U.id}}),h(t),Z(),E.success(`Domain released.`)}catch(e){a(e,{context:`email_domain_release`}),E.error(`Failed to release domain.`)}},[W,e,J,U?.id,U?.subdomain,Z]);if(F.isLoading)return(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,$.jsx)(b,{className:`h-4 w-4 animate-spin`}),`Checking subscription…`]});if(z)return(0,$.jsxs)(x,{tone:`info`,icon:(0,$.jsx)(_,{className:`h-4 w-4`,"aria-hidden":!0}),title:`Get a dedicated email address for your assistant`,actions:(0,$.jsx)(s,{size:`compact`,onClick:()=>i(`${ne.settings.usage}?tab=billing&adjust_plan`),children:`Upgrade to Pro`}),children:[`Pro plans include a managed`,` `,`<your-subdomain>.${n}`,` inbox — no provider setup required. Or switch to `,(0,$.jsx)(`strong`,{children:`Your Own`}),` to bring an existing provider.`]});let ce=B?(0,$.jsx)(x,{tone:`warning`,title:`Couldn't verify subscription status`,actions:(0,$.jsx)(s,{size:`compact`,variant:`outlined`,onClick:()=>F.refetch(),children:`Retry`}),children:`We couldn't reach the billing service. The form below assumes managed email is enabled for your org — if it isn't, registering a domain will fail.`}):null;return U?W?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[ce,(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Address`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-body-small-default text-[var(--content-default)]`,children:W.address}),(0,$.jsx)(pt,{status:K.data?.status,message:K.data?.message,isLoading:K.isLoading}),(0,$.jsx)(s,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,$.jsx)(De,{}),onClick:()=>P(!0),disabled:X.isPending,"aria-label":`Remove email address`})]}),(0,$.jsx)(D,{open:N,title:`Remove Email Address`,message:(0,$.jsxs)($.Fragment,{children:[`Are you sure you want to remove `,(0,$.jsx)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 font-mono text-[0.9em]`,children:W.address}),`? Your assistant will no longer be able to send or receive email at this address.`]}),confirmLabel:`Remove`,destructive:!0,onConfirm:oe,onCancel:()=>P(!1)})]}),G.data?.usage&&(0,$.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[G.data.usage.sent_today,` /`,` `,G.data.usage.daily_limit,` sent today ·`,` `,G.data.usage.received_today,` received`]})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[ce,(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Domain`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`font-mono text-body-small-default text-[var(--content-default)]`,children:[U.subdomain,`.`,n]}),(0,$.jsx)(pt,{status:K.data?.status,message:K.data?.message,isLoading:K.isLoading}),(0,$.jsx)(s,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,$.jsx)(De,{}),onClick:()=>M(!0),disabled:J.isPending,"aria-label":`Release domain`})]}),(0,$.jsx)(D,{open:j,title:`Release Domain`,message:(0,$.jsxs)($.Fragment,{children:[`Are you sure you want to release `,(0,$.jsxs)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 font-mono text-[0.9em]`,children:[U.subdomain,`.`,n]}),`? The subdomain will become available for others to claim.`]}),confirmLabel:`Release`,destructive:!0,onConfirm:se,onCancel:()=>M(!1)})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Email address`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex h-9 min-w-0 flex-1 items-center rounded-md border bg-[var(--field-bg)] text-body-medium-lighter transition-[border-color] duration-150 ${T?`border-[var(--system-negative-strong)]`:`border-[var(--field-border)] focus-within:border-[var(--border-active)]`}`,children:[(0,$.jsx)(`input`,{value:C,onChange:e=>{w(e.target.value.toLowerCase()),T&&O(null)},placeholder:`hi`,"aria-label":`Email username`,"aria-invalid":!!T,className:`h-full min-w-0 flex-1 bg-transparent pl-3 pr-1 text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] outline-none`}),(0,$.jsxs)(`span`,{className:`shrink-0 pr-3 font-mono text-[var(--content-secondary)]`,children:[`@`,ee]})]}),(0,$.jsx)(s,{onClick:ae,disabled:Y.isPending||!C.trim(),children:Y.isPending?`Creating…`:`Create`})]}),T&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:T})]})]}):(0,$.jsxs)(`div`,{className:`space-y-3`,children:[ce,(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Subdomain`}),(0,$.jsx)(Wt,{subdomain:m,onSubdomainChange:e=>{h(e),y&&S(null)},domainSuffix:n,subdomainPlaceholder:`my-assistant`,error:y}),(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Each assistant gets its own subdomain. Lowercase letters, numbers, and hyphens only.`}),(0,$.jsx)(s,{onClick:()=>A(!0),disabled:q.isPending||!m.trim(),children:q.isPending?`Registering…`:`Register`}),(0,$.jsx)(D,{open:k,title:`Set Subdomain`,message:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 font-mono text-[0.9em]`,children:m.trim().toLowerCase()||`subdomain`}),` will also become your assistant's public handle. You won't be able to change it once set.`]}),confirmLabel:`Confirm`,onConfirm:ie,onCancel:()=>A(!1)})]})}function Kt(){let e=fe(),t=q(),{data:o}=d({...Pe(),enabled:t}),s=o?.results?.[0]?.handle,c=gt.use.emailRootDomain(),l=Be(),[u,f]=(0,Q.useState)(()=>l===`gated`?`your-own`:Ne(r(ye,`managed`),`managed`)),[p,m]=(0,Q.useState)(()=>{let e=r(oe,`resend`);return e===`mailgun`||e===`resend`?e:`resend`}),h=d({queryKey:[`byoEmailCredential`,e,p],queryFn:async()=>{let{data:t}=await M({path:{assistant_id:e},body:{service:p,field:`api_key`},throwOnError:!0});return t},enabled:u===`your-own`||l===`gated`,staleTime:6e4,retry:i,meta:{errorContext:`byo_email_credential_check`}});(0,Q.useEffect)(()=>{h.error&&a(h.error,{context:`byo_email_credential_check`,bestEffort:!0})},[h.error]);let _=h.data?.hasSecret===!0,b=(0,Q.useCallback)(e=>{f(e),n(ye,e)},[]),x=(0,Q.useCallback)(()=>{n(oe,p),E.success(`Email settings saved.`)},[p]),S=(0,Q.useMemo)(()=>be.find(e=>e.id===p)??be[0],[p]),C=(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-[var(--border-subtle)] bg-[var(--surface-sunken)] p-3 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,$.jsx)(y,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--system-positive-strong)]`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`span`,{children:[`Configure `,S.displayName,` via the assistant CLI: ask the assistant to run the`,` `,(0,$.jsx)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 text-[12px]`,children:S.setupSkill}),` `,`skill. It walks you through storing the API key, detecting the domain, and (optionally) wiring up an inbound webhook.`]}),(0,$.jsxs)(`a`,{href:S.docsUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-[var(--system-positive-strong)] underline hover:opacity-80`,children:[`Open `,S.displayName,(0,$.jsx)(v,{className:`h-3 w-3`})]})]})]}),w=(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,$.jsx)(O,{value:p,onChange:e=>{(e===`mailgun`||e===`resend`)&&m(e)},options:be.map(e=>({value:e.id,label:e.displayName}))})]}),_?(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-[var(--system-positive-subtle)] bg-[var(--surface-sunken)] p-3 text-body-small-default text-[var(--content-default)]`,children:[(0,$.jsx)(g,{className:`h-4 w-4 shrink-0 text-[var(--system-positive-strong)]`}),(0,$.jsxs)(`span`,{children:[S.displayName,` API key configured. To reconfigure, run the`,` `,(0,$.jsx)(`code`,{className:`rounded bg-[var(--surface-active)] px-1 py-0.5 text-[12px]`,children:S.setupSkill}),` `,`skill.`]})]}),(0,$.jsxs)(`a`,{href:S.docsUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-body-small-default text-[var(--system-positive-strong)] underline hover:opacity-80`,children:[`Open `,S.displayName,(0,$.jsx)(v,{className:`h-3 w-3`})]})]}):C,(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,$.jsx)(he,{onClick:x,disabled:!1})})]});return l===`gated`?(0,$.jsx)(ht,{id:`email`,title:`Email`,subtitle:`Configure how your assistant sends and receives email`,children:w}):(0,$.jsx)(ft,{id:`email`,title:`Email`,subtitle:`Configure how your assistant sends and receives email`,mode:u,onModeChange:b,children:u===`managed`?(0,$.jsx)(`div`,{className:`space-y-4`,children:l===`disabled`?(0,$.jsx)(ue,{children:`Log in to the Vellum platform to manage email settings.`}):(0,$.jsx)(Gt,{assistantId:e,assistantHandle:s,emailRootDomain:c})}):w})}function qt(){let e=fe(),t=u(),{data:i}=d({...R({path:{assistant_id:e}}),staleTime:3e4}),o=P({onSuccess:n=>{W(t,{path:{assistant_id:e}},n)}}),s=Rt(),[c,l]=et((0,Q.useMemo)(()=>Ne(i?i.services?.[`image-generation`]?.mode??r(`vellum:ai:imageGenMode`,`your-own`):r(Ke,`your-own`),`your-own`),[i])),[f,p]=(0,Q.useState)(()=>r(X,`gemini-3.1-flash-image-preview`)),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(!1),v=(0,Q.useCallback)(async()=>{_(!0);let r=m.trim(),i=c===`your-own`&&r.length>0;try{i&&await s(de(f),r),await o.mutateAsync({path:{assistant_id:e},body:{services:{"image-generation":{mode:c}}}}).catch(e=>{throw E.error(`Failed to update assistant configuration. Please try again.`),a(e,{context:`patch_daemon_config`}),e});try{await N({path:{assistant_id:e},body:{modelId:f},throwOnError:!0})}catch(e){throw E.error(`Failed to update image generation model. Please try again.`),a(e,{context:`set_image_gen_model`}),e}finally{t.invalidateQueries({queryKey:V({path:{assistant_id:e}})})}}catch{_(!1);return}_(!1);try{n(Ke,c),n(X,f),i&&h(``),E.success(`Image generation settings saved.`)}catch(e){a(e,{context:`settings-ai-image-gen-persist-local`}),E.error(`Saved, but local preferences could not be written.`)}},[m,c,f,e,o,s,t]),y=(0,Q.useCallback)(()=>{h(``),p(`gemini-3.1-flash-image-preview`),n(X,`gemini-3.1-flash-image-preview`)},[]);return(0,$.jsx)(ft,{title:`Image Generation`,subtitle:`Configure which model your assistant uses to generate images`,mode:c,onModeChange:e=>l(e),children:c===`managed`?(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Active Model`}),(0,$.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,$.jsx)(O,{className:`flex-1`,value:f,onChange:p,options:_e.map(e=>({value:e,label:ce[e]??e}))}),(0,$.jsx)(he,{onClick:v,disabled:g}),g&&(0,$.jsx)(b,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`})]})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsx)(C,{label:`API Key`,type:`password`,value:m,onChange:e=>h(e.target.value),placeholder:de(f)===`openai`?`Enter your OpenAI API key`:`Enter your Gemini API key`,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:`Active Model`}),(0,$.jsx)(O,{value:f,onChange:p,options:_e.map(e=>({value:e,label:ce[e]??e}))})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(he,{onClick:v,disabled:g}),g&&(0,$.jsx)(b,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),(0,$.jsx)(le,{onClick:y})]})]})})}function Jt(){return(0,Q.useEffect)(()=>{let e=window.location.hash.slice(1);e&&requestAnimationFrame(()=>{document.getElementById(e)?.scrollIntoView({block:`start`})})},[]),(0,$.jsxs)(`div`,{className:`space-y-5`,children:[(0,$.jsx)(mt,{}),(0,$.jsx)(Lt,{}),(0,$.jsx)(Vt,{}),(0,$.jsx)(Ut,{}),(0,$.jsx)(Kt,{}),(0,$.jsx)(qt,{})]})}export{Jt as AiPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./chunk-jRWAZmH_.js";import{B as t,F as n,G as r,H as i,I as ee,J as a,K as o,L as s,R as te,U as c,V as ne,W as l,X as re,Y as u,Z as ie,q as d,z as f}from"./local-mode-Dydd46cS.js";function p(e){return ie(ee,e)}function ae(e){return re(n,e)}var oe=s([`end_turn`,`max_tokens`,`max_turn_requests`,`refusal`,`cancelled`]),se=l({type:i(`acp_session_completed`),acpSessionId:d(),stopReason:oe}).strict(),ce=l({type:i(`acp_session_error`),acpSessionId:d(),error:d()}).strict(),le=l({type:i(`acp_session_spawned`),acpSessionId:d(),agent:d(),parentConversationId:d(),parentToolUseId:d().optional(),task:d().optional()}).strict(),ue=s([`agent_message_chunk`,`agent_thought_chunk`,`user_message_chunk`,`tool_call`,`tool_call_update`,`plan`]),de=l({type:i(`acp_session_update`),acpSessionId:d(),updateType:ue,content:d().optional(),toolCallId:d().optional(),toolTitle:d().optional(),toolKind:d().optional(),toolStatus:d().optional(),rawInput:u().optional(),rawOutput:u().optional(),locations:f(l({path:d(),line:c().optional()})).optional(),messageId:d().optional(),seq:c().optional()}).strict(),fe=l({type:i(`acp_session_usage`),acpSessionId:d(),usedTokens:c(),contextSize:c(),inputTokens:c().optional(),outputTokens:c().optional(),costAmount:c().optional(),costCurrency:d().optional()}).strict(),pe=s([`idle`,`thinking`,`streaming`,`tool_running`,`awaiting_confirmation`]),me=s([`assistant_turn`,`user_turn`,`global`]),he=s([`message_dequeued`,`thinking_delta`,`first_text_delta`,`tool_use_start`,`preview_start`,`tool_result_received`,`confirmation_requested`,`confirmation_resolved`,`context_compacting`,`message_complete`,`generation_cancelled`,`error_terminal`]),ge=l({type:i(`assistant_activity_state`),conversationId:d(),activityVersion:c(),phase:pe,anchor:me,reason:he,requestId:d().optional(),statusText:d().optional()}),_e=l({type:i(`assistant_text_delta`),text:d(),messageId:d().optional(),conversationId:d().optional()}),ve=l({type:i(`assistant_thinking_delta`),thinking:d(),messageId:d().optional(),conversationId:d().optional(),timestampMs:c().optional()}),ye=l({type:i(`assistant_turn_start`),messageId:d(),conversationId:d().optional()}),be=l({type:i(`avatar_updated`),avatarPath:d()}),xe=l({type:i(`background_tool_completed`),id:d(),conversationId:d(),status:s([`completed`,`failed`,`cancelled`]),exitCode:c().nullable().optional(),output:d().optional(),completedAt:c()}),Se=l({type:i(`background_tool_started`),id:d(),toolName:d(),conversationId:d(),command:d(),startedAt:c()}),Ce=l({id:d(),messageId:d(),conversationId:d(),conversationTitle:d().nullable(),messagePreview:d(),messageRole:d(),messageCreatedAt:c(),createdAt:c()}),we=l({type:i(`bookmark.created`),bookmark:Ce}),Te=l({type:i(`bookmark.deleted`),messageId:d()}),Ee=l({type:i(`compaction_circuit_closed`),conversationId:d()}),De=l({type:i(`compaction_circuit_open`),conversationId:d(),reason:i(`3_consecutive_failures`),openUntil:c()}),m=l({label:d(),description:d(),pattern:d()}),h=l({label:d(),scope:d()}),g=l({label:d(),scope:d()}),_=l({filePath:d(),oldContent:d(),newContent:d(),isNewFile:t()}),Oe=s([`allow_once`,`allow_always`,`reject_once`,`reject_always`]),ke=l({optionId:d(),name:d(),kind:Oe}),Ae=s([`sandbox`,`host`]),je=l({type:i(`confirmation_request`),requestId:d(),toolName:d(),input:o(d(),u()),riskLevel:d(),riskReason:d().optional(),isContainerized:t().optional(),executionTarget:Ae.optional(),allowlistOptions:f(m),scopeOptions:f(h),directoryScopeOptions:f(g).optional(),diff:_.optional(),conversationId:d().optional(),persistentDecisionsAllowed:t().optional(),toolUseId:d().optional(),acpToolKind:d().optional(),acpOptions:f(ke).optional()}),Me=l({type:i(`contact_request`),requestId:d(),channel:d().optional(),placeholder:d().optional(),label:d().optional(),description:d().optional(),role:d().optional()}),v=s([`PROVIDER_NETWORK`,`PROVIDER_RATE_LIMIT`,`MANAGED_USAGE_LIMIT`,`PROVIDER_OVERLOADED`,`PROVIDER_API`,`IMAGE_TOO_LARGE`,`PROVIDER_BILLING`,`PROVIDER_ORDERING`,`PROVIDER_WEB_SEARCH`,`PROVIDER_NOT_CONFIGURED`,`PROVIDER_INVALID_KEY`,`MANAGED_KEY_INVALID`,`CONTEXT_TOO_LARGE`,`BUDGET_YIELD_UNRECOVERED`,`MAX_TOKENS_REACHED`,`CONVERSATION_ABORTED`,`CONVERSATION_PROCESSING_FAILED`,`DISK_SPACE_CRITICAL`,`UNKNOWN`]),y=l({type:i(`conversation_error`),conversationId:d(),code:v,userMessage:d(),retryable:t(),debugDetails:d().optional(),errorCategory:d().optional(),connectionName:d().optional(),profileName:d().optional()}),b=s([`created`,`renamed`,`deleted`,`reordered`,`seen_changed`]),x=l({type:i(`conversation_list_invalidated`),reason:b}),Ne=s([`memory_v3`]),Pe=l({type:i(`conversation_notice`),conversationId:d(),source:Ne,code:v,userMessage:d(),errorCategory:d().optional()}),Fe=l({type:i(`conversation_title_updated`),conversationId:d(),title:d()}),Ie=s([`disabled`,`ok`,`warning`,`critical`,`unknown`]),Le=s([`agent-turns`,`background-work`,`remote-ingress`]),S=l({enabled:t(),state:Ie,locked:t(),acknowledged:t(),overrideActive:t(),effectivelyLocked:t(),lockId:d().nullable(),usagePercent:c().nullable(),thresholdPercent:c(),path:d().nullable(),lastCheckedAt:d().nullable(),blockedCapabilities:f(Le),error:d().nullable()}),Re=l({type:i(`disk_pressure_status_changed`),status:S}),ze=l({id:d(),surfaceId:d(),author:d(),content:d(),anchorStart:c().optional(),anchorEnd:c().optional(),anchorText:d().optional(),parentCommentId:d().optional(),status:d(),createdAt:c(),updatedAt:c()}),Be=l({type:i(`document_comment_created`),conversationId:d(),surfaceId:d(),comment:ze}),Ve=l({type:i(`document_comment_deleted`),conversationId:d(),surfaceId:d(),commentId:d()}),He=l({type:i(`document_comment_reopened`),conversationId:d(),surfaceId:d(),commentId:d()}),Ue=l({type:i(`document_comment_resolved`),conversationId:d(),surfaceId:d(),commentId:d(),resolvedBy:d()}),We=l({type:i(`document_editor_update`),conversationId:d(),surfaceId:d(),markdown:d(),mode:d()}),Ge=l({type:i(`error`),message:d(),code:d().optional(),category:d().optional(),errorCategory:d().optional(),requestId:d().optional(),conversationId:d().optional()}),Ke=l({type:i(`generation_cancelled`),conversationId:d().optional()}),C=l({id:d().optional(),filename:d(),mimeType:d(),data:d(),sourceType:s([`sandbox_file`,`host_file`,`tool_block`]).optional(),sizeBytes:c().optional(),thumbnailData:d().optional(),fileBacked:t().optional(),filePath:d().optional()}),qe=l({type:i(`generation_handoff`),conversationId:d().optional(),requestId:d().optional(),queuedCount:c(),messageId:d().optional(),attachments:f(C).optional(),attachmentWarnings:f(d()).optional()}),Je=l({type:i(`home_feed_updated`),updatedAt:d(),newItemCount:c()}),Ye=l({kind:s([`plugin`,`workspace`]),id:d()}),Xe=l({type:i(`hook_event`),conversationId:d().optional(),hookName:d(),owner:Ye,detail:o(d(),u())}),Ze=l({type:i(`identity_changed`),name:d(),role:d(),personality:d(),emoji:d(),home:d()}),Qe=s([`approved`,`rejected`,`answered`,`cancelled`,`superseded`]),$e=l({type:i(`interaction_resolved`),requestId:d(),conversationId:d(),state:Qe,kind:d()}),w=l({semanticUnavailable:t(),reason:d(),fallbackSources:f(d())}),et=l({key:d(),type:d(),kind:d(),finalScore:c(),semantic:c(),recency:c()}),tt=l({type:i(`memory_recalled`),provider:d(),model:d(),degradation:w.optional(),semanticHits:c(),tier1Count:c(),tier2Count:c(),hybridSearchLatencyMs:c(),sparseVectorUsed:t(),mergedCount:c(),selectedCount:c(),injectedTokens:c(),latencyMs:c(),topCandidates:f(et)}),nt=l({type:i(`memory_status`),enabled:t(),degraded:t(),degradation:w.optional(),reason:d().optional(),provider:d().optional(),model:d().optional()}),rt=l({type:i(`message_complete`),messageId:d().optional(),conversationId:d().optional(),source:s([`main`,`aux`]).optional(),attachments:f(C).optional(),attachmentWarnings:f(d()).optional()}),it=l({type:i(`message_dequeued`),conversationId:d(),requestId:d()}),at=l({type:i(`message_queued`),conversationId:d(),requestId:d(),position:c()}),ot=l({type:i(`message_queued_deleted`),conversationId:d(),requestId:d()}),st=l({type:i(`message_request_complete`),conversationId:d(),requestId:d(),runStillActive:t().optional()}),ct=l({type:i(`navigate_settings`),tab:d()}),lt=l({type:i(`notification_intent`),sourceEventName:d(),title:d(),body:d(),deliveryId:d().optional(),deepLinkMetadata:o(d(),u()).optional(),targetGuardianPrincipalId:d().optional(),silent:t().optional()}),ut=l({type:i(`open_conversation`),conversationId:d(),title:d().optional(),anchorMessageId:d().optional(),focus:t().optional()}),dt=l({type:i(`open_panel`),panelType:d(),data:o(d(),u()).optional(),conversationId:d().optional(),surfaceId:d().optional()}),ft=l({type:i(`open_url`),url:d().min(1),title:d().optional(),conversationId:d().optional()}),T=l({id:d(),label:d(),description:d().optional()}),E=l({id:d(),question:d(),description:d().optional(),options:f(T),freeTextPlaceholder:d().optional()}),pt=l({type:i(`question_request`),requestId:d(),questions:f(E),question:d(),description:d().optional(),options:f(T),freeTextPlaceholder:d().optional(),conversationId:d().optional(),toolUseId:d().optional()}),mt=l({type:i(`relationship_state_updated`),updatedAt:d()}),ht=l({type:i(`secret_request`),requestId:d(),service:d(),field:d(),label:d(),description:d().optional(),placeholder:d().optional(),conversationId:d().optional(),purpose:d().optional(),allowedTools:f(d()).optional(),allowedDomains:f(d()).optional(),allowOneTimeSend:t().optional()}),gt=l({type:i(`service_group_update_complete`),installedVersion:d(),success:t(),rolledBackToVersion:d().optional()}),_t=l({type:i(`service_group_update_progress`),statusMessage:d()}),vt=l({type:i(`service_group_update_starting`),targetVersion:d(),expectedDowntimeSeconds:c()}),yt=l({type:d(),content:d().optional(),text:d().optional(),result:d().optional(),input:o(d(),u()).optional(),toolName:d().optional(),isError:t().optional(),toolUseId:d().optional()}).passthrough(),bt=l({type:i(`subagent_event`),conversationId:d(),subagentId:d(),event:yt}).strict(),xt=l({type:i(`subagent_spawned`),subagentId:d(),parentConversationId:d(),label:d(),objective:d(),isFork:t().optional(),parentToolUseId:d().optional()}).strict(),D=s([`pending`,`running`,`awaiting_input`,`completed`,`failed`,`aborted`,`interrupted`]),O=l({inputTokens:c(),outputTokens:c(),estimatedCost:c()}).strict(),St=l({type:i(`subagent_status_changed`),subagentId:d(),status:D,error:d().optional(),usage:O.optional()}).strict(),Ct=l({type:i(`sync_changed`),tags:f(d().min(1)).min(1),originClientId:d().min(1).optional()}),wt=s([`tool_start`,`tool_complete`,`status`]),Tt=l({type:i(`tool_output_chunk`),chunk:d(),conversationId:d().optional(),toolUseId:d().optional(),subType:wt.optional(),subToolName:d().optional(),subToolInput:d().optional(),subToolIsError:t().optional(),subToolId:d().optional(),messageId:d().optional()}),Et=l({pattern:d(),label:d()}),Dt=s([`anthropic-native`,`brave`,`perplexity`,`tavily`,`firecrawl`]),Ot=s([`default`,`firecrawl`]),kt=l({rank:c(),title:d(),url:d(),domain:d(),faviconUrl:d().optional(),snippet:d().optional(),age:d().optional(),score:c().optional()}),At=l({query:d(),provider:Dt,resultCount:c(),durationMs:c(),results:f(kt),errorMessage:d().optional()}),jt=l({url:d(),finalUrl:d(),provider:Ot.optional(),status:c(),contentType:d().optional(),byteCount:c(),charCount:c(),truncated:t(),title:d().optional(),domain:d(),faviconUrl:d().optional(),redirectCount:c(),durationMs:c(),errorMessage:d().optional(),mayRequireJavaScript:t().optional()}),k=l({webSearch:At.optional(),webFetch:jt.optional()}),Mt=l({type:i(`tool_result`),toolName:d(),result:d(),isError:t().optional(),diff:_.optional(),status:d().optional(),conversationId:d().optional(),imageData:d().optional(),imageDataList:f(d()).optional(),toolUseId:d().optional(),messageId:d().optional(),riskLevel:d().optional(),riskReason:d().optional(),matchedTrustRuleId:d().optional(),isContainerized:t().optional(),riskScopeOptions:f(Et).optional(),riskAllowlistOptions:f(m).optional(),riskDirectoryScopeOptions:f(g).optional(),approvalMode:d().optional(),approvalReason:d().optional(),riskThreshold:d().optional(),activityMetadata:k.optional(),errorCode:d().optional(),completedAt:c().optional()}),Nt=l({type:i(`tool_use_preview_start`),toolUseId:d(),toolName:d(),conversationId:d().optional(),messageId:d().optional(),previewStartedAt:c().optional()}),Pt=l({type:i(`tool_use_start`),toolName:d(),input:o(d(),u()),toolUseId:d().optional(),messageId:d().optional(),conversationId:d().optional(),startedAt:c().optional(),previewStartedAt:c().optional()}),Ft=l({type:i(`ui_surface_complete`),conversationId:d(),surfaceId:d(),summary:d(),submittedData:o(d(),u()).optional()}),It=l({type:i(`ui_surface_dismiss`),conversationId:d(),surfaceId:d()}),Lt=l({id:d(),label:d(),style:s([`primary`,`secondary`,`destructive`]).optional(),data:o(d(),u()).optional()}),Rt=l({type:i(`ui_surface_show`),conversationId:d(),surfaceId:d(),surfaceType:d(),title:d().optional(),data:o(d(),u()),actions:f(Lt).optional(),display:s([`inline`,`panel`]).optional(),messageId:d().optional(),persistent:t().optional(),toolCallId:d().optional()}),zt=l({type:i(`ui_surface_update`),conversationId:d(),surfaceId:d(),data:o(d(),u())}),A=l({type:i(`usage_progress`),conversationId:d(),inputTokens:c(),outputTokens:c(),estimatedCost:c(),model:d()}),Bt=l({type:i(`usage_update`),conversationId:d(),inputTokens:c(),outputTokens:c(),cacheCreationInputTokens:c().optional(),cacheReadInputTokens:c().optional(),totalInputTokens:c(),totalOutputTokens:c(),estimatedCost:c(),model:d(),contextWindowTokens:c().optional(),contextWindowMaxTokens:c().optional()}),Vt=l({type:i(`user_message_echo`),text:d(),conversationId:d().optional(),messageId:d().optional(),requestId:d().optional(),clientMessageId:d().optional()}).strict(),j=s([`running`,`completed`,`failed`,`aborted`,`cap_exceeded`,`interrupted`]),Ht=l({type:i(`workflow_completed`),runId:d(),conversationId:d().optional(),status:j,agentsSpawned:c(),inputTokens:c(),outputTokens:c(),summary:d().optional()}).strict(),Ut=l({type:i(`workflow_leaf_finished`),runId:d(),conversationId:d(),seq:c().int(),status:s([`completed`,`failed`]),label:d().optional(),inputTokens:c().optional(),outputTokens:c().optional(),resultSummary:d().optional()}).strict(),Wt=l({type:i(`workflow_leaf_started`),runId:d(),conversationId:d(),seq:c().int(),label:d().optional(),phase:d().optional(),promptSummary:d().optional()}).strict(),Gt=l({type:i(`workflow_progress`),runId:d(),conversationId:d().optional(),agentsSpawned:c(),phase:d().optional(),label:d().optional(),message:d().optional()}).strict(),Kt=l({type:i(`workflow_started`),runId:d(),conversationId:d(),toolUseId:d().optional(),label:d().optional()}).strict(),qt=`syntheticAgentErrorMessage`,Jt=`compactionAgent`,Yt=3e4,Xt=l({cursorInTextField:t().optional().describe(`Whether the cursor is in an editable text field when dictation started`)}).passthrough().describe(`Dictation context (app name, window title, bundle ID, cursor state, selected text)`),Zt=l({transcription:d().describe(`Raw speech transcription`),context:Xt,profileId:d().describe(`Optional dictation profile ID`).optional()}),M=l({id:d(),filename:d(),mimeType:d(),sizeBytes:c(),kind:d(),data:d().optional(),thumbnailData:d().optional(),fileBacked:t().optional()}),Qt=l({pattern:d(),label:d()}),$t=l({label:d(),description:d(),pattern:d()}),en=l({scope:d(),label:d()}),tn=l({requestId:d(),title:d().optional(),description:d().optional(),toolName:d().optional(),riskLevel:d().optional(),riskReason:d().optional(),input:o(d(),u()).optional(),allowlistOptions:f(m).optional(),scopeOptions:f(h).optional(),directoryScopeOptions:f(g).optional(),persistentDecisionsAllowed:t().optional()}),nn=l({requestId:d(),entries:f(E)}),rn=s([`approved`,`denied`,`timed_out`]),N=l({id:d().optional(),name:d(),input:o(d(),u()),result:d().optional(),isError:t().optional(),errorCode:d().optional(),imageData:d().optional(),imageDataList:f(d()).optional(),imageAttachmentIds:f(d()).optional(),startedAt:c().optional(),previewStartedAt:c().optional(),completedAt:c().optional(),confirmationDecision:rn.optional(),confirmationLabel:d().optional(),riskLevel:d().optional(),riskReason:d().optional(),matchedTrustRuleId:d().optional(),autoApproved:t().optional(),approvalMode:d().optional(),approvalReason:d().optional(),riskThreshold:d().optional(),riskScopeOptions:f(Qt).optional(),riskAllowlistOptions:f($t).optional(),riskDirectoryScopeOptions:f(en).optional(),activityMetadata:k.optional(),scopeOptions:f(h).optional(),pendingConfirmation:tn.optional(),pendingQuestion:nn.optional()}),an=l({id:d(),label:d(),style:d().optional(),data:o(d(),u()).optional()}),P=l({surfaceId:d(),surfaceType:d(),title:d().optional(),data:o(d(),u()),actions:f(an).optional(),display:d().optional(),persistent:t().optional(),completed:t().optional(),completionSummary:d().optional(),toolCallId:d().optional()}),on=l({subagentId:d(),label:d(),status:d(),error:d().optional(),conversationId:d().optional(),objective:d().optional()}),sn=l({acpSessionId:d(),agent:d().optional()}),cn=l({id:d(),toolName:d(),conversationId:d(),command:d(),startedAt:c(),status:s([`completed`,`failed`,`cancelled`]),exitCode:c().nullable(),output:d(),completedAt:c()}),ln=l({appUrl:d().optional(),webUrl:d().optional()}),un=l({emoji:d(),op:s([`added`,`removed`]),actorDisplayName:d().optional(),targetChannelTs:d()}),dn=l({channelId:d(),channelName:d().optional(),channelTs:d(),threadTs:d().optional(),sender:l({displayName:d().optional(),externalUserId:d().optional()}).optional(),messageLink:ln.optional(),threadLink:ln.optional(),eventKind:s([`message`,`reaction`]).optional(),reaction:un.optional()}),fn=l({type:i(`text`),text:d()}),pn=l({type:i(`thinking`),thinking:d(),startedAt:c().optional(),completedAt:c().optional()}),mn=l({type:i(`tool_use`),toolCall:N}),hn=l({type:i(`surface`),surface:P}),gn=l({type:i(`attachment`),attachment:M}),_n=ne(`type`,[fn,pn,mn,hn,gn]),vn=l({id:d(),mergedMessageIds:f(d()).optional(),clientMessageId:d().optional(),role:s([`user`,`assistant`]),timestamp:d(),attachments:f(M),toolCalls:f(N).meta({deprecated:!0,description:`Deprecated: superseded by contentBlocks (the tool_use variant). Flat list of tool calls.`}).optional(),surfaces:f(P).meta({deprecated:!0,description:`Deprecated: superseded by contentBlocks (the surface variant). Flat list of surfaces.`}).optional(),textSegments:f(d()).meta({deprecated:!0,description:`Deprecated: superseded by contentBlocks. Text segments split by tool-call boundaries.`}).optional(),thinkingSegments:f(d()).meta({deprecated:!0,description:`Deprecated: superseded by contentBlocks. Reasoning text extracted from thinking blocks.`}).optional(),contentOrder:f(d()).meta({deprecated:!0,description:`Deprecated: superseded by contentBlocks. Positional "<type>:<index>" content ordering (e.g. "text:0", "thinking:1").`}).optional(),contentBlocks:f(_n).optional(),subagentNotification:on.optional(),acpNotification:sn.optional(),backgroundEventNotification:t().optional(),backgroundToolCompletion:cn.optional(),systemCard:t().optional(),slackMessage:dn.optional(),queueStatus:s([`queued`,`processing`]).optional(),queuePosition:c().optional()}),yn=l({status:S}),bn=i(`notification`),xn=s([`new`,`seen`,`acted_on`,`dismissed`]),Sn=s([`low`,`medium`,`high`,`critical`]),Cn=s([`security`,`scheduling`,`background`,`email`,`system`]),wn=s([`heartbeat`,`memory_consolidation`,`schedule`,`auto_analysis`,`user`,`other`]),Tn=l({id:d(),label:d(),prompt:d()}),En=s([`emailDraft`,`documentPreview`,`permissionChat`,`paymentAuth`,`toolPermission`,`updatesList`]),Dn=l({kind:En}),On=l({id:d(),type:bn,priority:c().int().min(0).max(100),title:d().optional(),summary:d(),timestamp:d(),status:xn.default(`new`),expiresAt:d().optional(),actions:f(Tn).optional(),urgency:Sn.optional(),conversationId:d().optional(),detailPanel:Dn.optional(),category:Cn.optional(),noteworthy:t().optional(),fromAssistant:t().optional(),metadata:o(d(),u()).optional(),sourceType:wn.optional(),sourceKey:d().optional(),sourceLabel:d().optional(),createdAt:d()}),kn=s([`deterministic`,`assistant`]),An=l({id:d(),label:d(),icon:d().optional(),prompt:d(),source:kn}),jn=l({greeting:d(),timeAwayLabel:d(),newCount:c().int().min(0)}),Mn=l({items:f(On),updatedAt:d(),contextBanner:jn,suggestedPrompts:f(An)}),Nn=l({id:d(),category:s([`voice`,`world`,`priorities`]),text:d(),confidence:s([`strong`,`uncertain`]),source:s([`onboarding`,`inferred`])}),Pn=l({id:d(),name:d(),description:d(),tier:s([`unlocked`,`next-up`,`earned`]),gate:d(),unlockHint:d().optional(),ctaLabel:d().optional()}),Fn=l({version:i(1),assistantId:d(),tier:a([i(1),i(2),i(3),i(4)]),progressPercent:c(),facts:f(Nn),capabilities:f(Pn),conversationCount:c(),hatchedDate:d(),assistantName:d(),userName:d().optional(),updatedAt:d()}),In=l({key:d(),label:d(),ms:c()}),Ln=l({key:d(),label:d(),ms:c(),subPhases:f(In).optional()}),Rn=l({phases:f(Ln),ttftMs:c().nullish(),totalToFirstTokenMs:c().nullish(),providerDurationMs:c().nullish(),firstTokenKind:s([`thinking`,`text`]).nullish()}),zn=l({provider:d().nullish(),model:d().nullish(),status:d().nullish(),inputTokens:c().nullish(),outputTokens:c().nullish(),cacheCreationInputTokens:c().nullish(),cacheReadInputTokens:c().nullish(),stopReason:d().nullish(),requestMessageCount:c().nullish(),requestToolCount:c().nullish(),responseMessageCount:c().nullish(),responseToolCallCount:c().nullish(),responsePreview:d().nullish(),toolCallNames:f(d()).nullish(),estimatedCostUsd:c().nullish(),durationMs:c().nullish()}),F=l({kind:d(),label:d().nullish(),role:d().nullish(),text:d().nullish(),toolName:d().nullish(),data:u().optional(),language:d().nullish()}),Bn=l({name:d().nullish(),message:d().nullish(),code:d().nullish(),provider:d().nullish(),statusCode:c().nullish(),retryAfterMs:c().nullish(),apiErrorCode:d().nullish(),apiErrorType:d().nullish(),apiErrorParam:d().nullish(),requestId:d().nullish()}),Vn=l({id:d(),createdAt:c(),requestPayload:te(),responsePayload:te(),provider:d().nullish(),summary:zn.nullish(),requestSections:f(F).nullish(),responseSections:f(F).nullish(),agentLoopExitReason:d().nullish(),callSite:d().nullish(),error:Bn.nullish(),latency:Rn.nullish()}),Hn=l({nodeId:d(),score:c(),semanticSimilarity:c(),recencyBoost:c(),type:d().optional()}),Un=l({reason:d(),semanticUnavailable:t(),fallbackSources:f(d())}),Wn=l({enabled:t(),degraded:t(),provider:d().nullable(),model:d().nullable(),degradation:Un.nullable(),semanticHits:c().nullish(),mergedCount:c().nullish(),selectedCount:c().nullish(),tier1Count:c().nullish(),tier2Count:c().nullish(),hybridSearchLatencyMs:c().nullish(),sparseVectorUsed:t().nullish(),injectedTokens:c().nullish(),latencyMs:c().nullish(),topCandidates:f(Hn),injectedText:d().nullable(),reason:d().nullable(),queryContext:d().nullable()}),Gn=l({slug:d(),finalActivation:c(),ownActivation:c(),priorActivation:c(),simUser:c(),simAssistant:c(),simNow:c(),simUserRerankBoost:c().optional(),simAssistantRerankBoost:c().optional(),inRerankPool:t().optional(),spreadContribution:c(),source:d(),status:d()}),Kn=l({d:c(),c_user:c(),c_assistant:c(),c_now:c(),k:c(),hops:c(),top_k:c(),epsilon:c()}),qn=l({turn:c(),mode:d(),concepts:f(Gn),config:Kn}),Jn=l({slug:d(),source:d(),pinned:t(),sectionOrdinal:c().nullable().optional(),sectionHeading:d().nullable().optional()}),Yn=l({turn:c(),live:t(),selections:f(Jn),injectedText:d()}),Xn=l({messageId:d().nullish(),conversationKey:d().nullish(),conversationId:d().nullish(),conversationKind:d(),conversationTotalEstimatedCostUsd:c().nullish(),logs:f(Vn),memoryRecall:Wn.nullable(),memoryV2Activation:qn.nullable(),memoryV3Selection:Yn.nullish()}),Zn=l({type:d(),content:d(),toolName:d().optional(),isError:t().optional(),messageId:d().optional(),toolUseId:d().optional(),input:o(d(),u()).optional()}),Qn=l({subagentId:d(),objective:d().optional(),status:D.optional(),usage:O.optional(),events:f(Zn)}),$n=l({seq:c().int(),kind:s([`agent`,`workflow`]),label:d().optional(),phase:d().optional(),promptSummary:d().optional(),status:d(),resultSummary:d().optional(),inputTokens:c().optional(),outputTokens:c().optional(),createdAt:c().nullable()}),er=l({runId:d(),status:j.optional(),agentsSpawned:c().optional(),inputTokens:c().optional(),outputTokens:c().optional(),phase:d().optional(),leaves:f($n)});function I(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function tr(e){if(I(e))return e;if(typeof e==`string`)try{let t=JSON.parse(e);if(I(t))return t}catch{}return{}}var L=()=>d().optional().catch(void 0),R=()=>t().optional().catch(void 0),z=()=>c().finite().optional().catch(void 0);function B(e){return r(e=>Array.isArray(e)?e.filter(I):[],f(e))}var V=l({title:d().optional(),subtitle:d().optional(),body:d().optional(),metadata:f(l({label:p(),value:p()})).optional(),template:d().optional(),templateData:o(d(),u()).optional()}),nr=r(e=>{let t=(typeof e==`string`?e.split(`,`):Array.isArray(e)?e:[]).map(e=>typeof e==`string`||typeof e==`number`?String(e).trim():``).filter(e=>e.length>0);return t.length>0?t:void 0},f(d()).optional()),H=l({prompt:p().optional(),acceptedTypes:nr,maxFiles:ae().int().positive().optional().catch(void 0),maxSizeBytes:ae().positive().optional().catch(void 0)}),U=l({text:d().catch(``),label:L(),language:L()});function rr(e,t){let n={...t};for(let t of[`text`,`label`,`language`])typeof n[t]!=`string`&&typeof e[t]==`string`&&(n[t]=e[t]);return U.parse(n)}var ir=l({id:d(),title:d(),description:L(),recommended:R(),data:o(d(),u()).optional().catch(void 0)}),ar=r(e=>Array.isArray(e)?e.flatMap(e=>{if(!I(e))return[];let t=typeof e.id==`string`?e.id.trim():``,n=typeof e.title==`string`?e.title.trim():typeof e.label==`string`?e.label.trim():``;return!t||!n?[]:[{...e,id:t,title:n}]}):[],f(ir)),W=l({description:L(),options:ar,selectionMode:r(e=>e===`multiple`?`multiple`:`single`,s([`single`,`multiple`])),commitOnSelect:R(),submitLabel:L()}),G=l({providerKey:r(e=>typeof e==`string`?e.trim():e,d()).catch(``),displayName:L(),description:L(),logoUrl:d().nullable().optional().catch(void 0)}),K=l({id:d().catch(``),type:s([`text`,`textarea`,`select`,`toggle`,`number`,`password`]).catch(`text`),label:d().catch(``),placeholder:L(),required:R(),defaultValue:a([d(),c(),t()]).optional().catch(void 0),options:f(l({label:p(),value:p()})).optional().catch(void 0)}),or=l({id:d().catch(``),title:d().catch(``),description:L(),fields:B(K)}),q=l({description:L(),fields:B(K),submitLabel:L(),pages:B(or).optional().catch(void 0),pageLabels:l({next:L(),back:L(),submit:L()}).optional().catch(void 0),progressStyle:s([`bar`,`tabs`]).optional().catch(void 0)}),sr=l({id:d().catch(``),title:d().catch(``),subtitle:L(),icon:L(),selected:R()}),J=l({items:B(sr),selectionMode:s([`single`,`multiple`,`none`]).catch(`none`)}),cr=l({id:d().catch(``),label:d().catch(``),width:z()}),lr=l({text:p().catch(``),icon:L(),iconColor:L()}),ur=l({id:d().catch(``),cells:o(d(),a([d(),lr]).catch(``)).catch({}),selectable:R(),selected:R()}),Y=l({columns:B(cr),rows:B(ur),selectionMode:s([`none`,`single`,`multiple`]).optional().catch(void 0),caption:L()}),X=l({message:d().catch(``),detail:L(),confirmLabel:L(),confirmedLabel:L(),cancelLabel:L(),destructive:R()}),dr=l({title:d().catch(``),subtitle:L(),description:L(),icon:L(),metrics:f(l({label:p(),value:p()})).optional().catch(void 0),context:s([`app_create`,`general`]).optional().catch(void 0),previewImage:L()}),fr=l({html:d().catch(``),width:z(),height:z(),appId:L(),dirName:L(),reloadGeneration:z(),status:L(),preview:dr.optional().catch(void 0)}),pr=l({title:d().catch(``),surfaceId:d().catch(``),subtitle:L()}),mr=s([`completed`,`partial`,`failed`,`in_progress`]),Z=s([`neutral`,`positive`,`warning`,`negative`]),hr=s([`items`,`timeline`,`diff`,`artifacts`,`warnings`]),gr=()=>({label:p().catch(``),value:a([d(),c()]).catch(``)}),_r=l({...gr(),detail:L(),tone:Z.optional().catch(void 0)}),Q=l(gr()),vr=l({id:L(),title:p().catch(``),description:L(),status:L(),tone:Z.optional().catch(void 0),metadata:B(Q).optional().catch(void 0),href:L()}),yr=l({label:L(),before:L(),after:L()}),br=l({id:L(),title:p().catch(``),description:L(),type:hr.optional().catch(void 0),items:B(vr).optional().catch(void 0),diffs:B(yr).optional().catch(void 0)}),xr=l({eyebrow:L(),status:mr.optional().catch(void 0),summary:L(),metrics:B(_r).optional().catch(void 0),sections:B(br).optional().catch(void 0)}),Sr=[`card`,`channel_setup`,`choice`,`copy_block`,`oauth_connect`,`form`,`list`,`table`,`confirmation`,`dynamic_page`,`file_upload`,`document_preview`,`task_preferences`,`work_result`],Cr=s(Sr);function wr(e,t){let n=e=>{let n=e.safeParse(t);return n.success?n.data:void 0};switch(e){case`card`:return n(V);case`choice`:return n(W);case`copy_block`:return n(U);case`oauth_connect`:return n(G);case`form`:return n(q);case`list`:return n(J);case`table`:return n(Y);case`confirmation`:return n(X);case`dynamic_page`:return n(fr);case`file_upload`:return n(H);case`document_preview`:return n(pr);case`work_result`:return n(xr);case`channel_setup`:case`task_preferences`:return tr(t);default:return e}}var Tr=e({ACPOptionKindSchema:()=>Oe,ACPOptionSchema:()=>ke,AcpSessionCompletedEventSchema:()=>se,AcpSessionErrorEventSchema:()=>ce,AcpSessionSpawnedEventSchema:()=>le,AcpSessionUpdateEventSchema:()=>de,AcpSessionUpdateTypeSchema:()=>ue,AcpSessionUsageEventSchema:()=>fe,AcpStopReasonSchema:()=>oe,AllowlistOptionSchema:()=>m,AssistantActivityAnchorSchema:()=>me,AssistantActivityPhaseSchema:()=>pe,AssistantActivityReasonSchema:()=>he,AssistantActivityStateEventSchema:()=>ge,AssistantEventEnvelopeSchema:()=>Er,AssistantEventSchema:()=>$,AssistantOutboundAttachmentSchema:()=>C,AssistantTextDeltaEventSchema:()=>_e,AssistantThinkingDeltaEventSchema:()=>ve,AssistantTurnStartEventSchema:()=>ye,AvatarUpdatedEventSchema:()=>be,BackgroundToolCompletedEventSchema:()=>xe,BackgroundToolStartedEventSchema:()=>Se,BookmarkCreatedEventSchema:()=>we,BookmarkDeletedEventSchema:()=>Te,BookmarkSummarySchema:()=>Ce,CALL_SITE_COMPACTION_AGENT:()=>Jt,CALL_SITE_SYNTHETIC_AGENT_ERROR_MESSAGE:()=>qt,CapabilitySchema:()=>Pn,CardSurfaceDataSchema:()=>V,ChoiceOptionSchema:()=>ir,ChoiceSurfaceDataSchema:()=>W,CompactionCircuitClosedEventSchema:()=>Ee,CompactionCircuitOpenEventSchema:()=>De,ConfirmationDiffSchema:()=>_,ConfirmationExecutionTargetSchema:()=>Ae,ConfirmationRequestEventSchema:()=>je,ConfirmationSurfaceDataSchema:()=>X,ContactRequestEventSchema:()=>Me,ContextBannerSchema:()=>jn,ConversationAttachmentBlockSchema:()=>gn,ConversationContentBlockSchema:()=>_n,ConversationErrorCodeSchema:()=>v,ConversationErrorEventSchema:()=>y,ConversationListInvalidatedEventSchema:()=>x,ConversationListInvalidatedReasonSchema:()=>b,ConversationMessageAttachmentSchema:()=>M,ConversationMessageSchema:()=>vn,ConversationMessageSurfaceSchema:()=>P,ConversationMessageToolCallSchema:()=>N,ConversationNoticeEventSchema:()=>Pe,ConversationNoticeSourceSchema:()=>Ne,ConversationSlackMessageSchema:()=>dn,ConversationSubagentNotificationSchema:()=>on,ConversationSurfaceBlockSchema:()=>hn,ConversationTextBlockSchema:()=>fn,ConversationThinkingBlockSchema:()=>pn,ConversationTitleUpdatedEventSchema:()=>Fe,ConversationToolUseBlockSchema:()=>mn,CopyBlockSurfaceDataSchema:()=>U,DEFAULT_TOOL_EXECUTION_TIMEOUT_SEC:()=>120,DictationContextSchema:()=>Xt,DictationRequestSchema:()=>Zt,DirectoryScopeOptionSchema:()=>g,DiskPressureBlockedCapabilitySchema:()=>Le,DiskPressureStateSchema:()=>Ie,DiskPressureStatusChangedEventSchema:()=>Re,DiskPressureStatusResponseSchema:()=>yn,DiskPressureStatusSchema:()=>S,DocumentCommentCreatedEventSchema:()=>Be,DocumentCommentDeletedEventSchema:()=>Ve,DocumentCommentReopenedEventSchema:()=>He,DocumentCommentResolvedEventSchema:()=>Ue,DocumentEditorUpdateEventSchema:()=>We,DocumentPreviewSurfaceDataSchema:()=>pr,DynamicPagePreviewSchema:()=>dr,DynamicPageSurfaceDataSchema:()=>fr,ErrorEventSchema:()=>Ge,FactSchema:()=>Nn,FeedActionSchema:()=>Tn,FeedItemCategorySchema:()=>Cn,FeedItemDetailPanelKindSchema:()=>En,FeedItemDetailPanelSchema:()=>Dn,FeedItemSchema:()=>On,FeedItemSourceTypeSchema:()=>wn,FeedItemStatusSchema:()=>xn,FeedItemTypeSchema:()=>bn,FeedItemUrgencySchema:()=>Sn,FileUploadSurfaceDataSchema:()=>H,FormFieldSchema:()=>K,FormPageSchema:()=>or,FormSurfaceDataSchema:()=>q,GenerationCancelledEventSchema:()=>Ke,GenerationHandoffEventSchema:()=>qe,HomeFeedResponseSchema:()=>Mn,HomeFeedUpdatedEventSchema:()=>Je,HookEventOwnerSchema:()=>Ye,HookEventSchema:()=>Xe,IdentityChangedEventSchema:()=>Ze,InteractionResolutionStateSchema:()=>Qe,InteractionResolvedEventSchema:()=>$e,LLMCallErrorSchema:()=>Bn,LLMCallSummarySchema:()=>zn,LLMContextSectionSchema:()=>F,LLMRequestLogEntrySchema:()=>Vn,LatencyBreakdownSchema:()=>Rn,LatencyPhaseSchema:()=>Ln,ListItemSchema:()=>sr,ListSurfaceDataSchema:()=>J,LlmContextResponseSchema:()=>Xn,MemoryCandidateSchema:()=>Hn,MemoryDegradationSchema:()=>Un,MemoryRecallLogSchema:()=>Wn,MemoryRecalledCandidateDebugSchema:()=>et,MemoryRecalledDegradationSchema:()=>w,MemoryRecalledEventSchema:()=>tt,MemoryStatusEventSchema:()=>nt,MemoryV2ActivationLogSchema:()=>qn,MemoryV2ConceptRowSchema:()=>Gn,MemoryV2ConfigSnapshotSchema:()=>Kn,MemoryV3SelectionLogSchema:()=>Yn,MemoryV3SelectionRowSchema:()=>Jn,MessageCompleteEventSchema:()=>rt,MessageDequeuedEventSchema:()=>it,MessageQueuedDeletedEventSchema:()=>ot,MessageQueuedEventSchema:()=>at,MessageRequestCompleteEventSchema:()=>st,NavigateSettingsEventSchema:()=>ct,NotificationIntentEventSchema:()=>lt,OAuthConnectSurfaceDataSchema:()=>G,OpenConversationEventSchema:()=>ut,OpenPanelEventSchema:()=>dt,OpenUrlEventSchema:()=>ft,PendingToolConfirmationSchema:()=>tn,QuestionEntrySchema:()=>E,QuestionOptionSchema:()=>T,QuestionRequestEventSchema:()=>pt,RelationshipStateSchema:()=>Fn,RelationshipStateUpdatedEventSchema:()=>mt,RiskScopeOptionSchema:()=>Et,SSE_REPLAY_RING_AGE_LIMIT_MS:()=>Yt,SSE_REPLAY_RING_COUNT_LIMIT:()=>200,SURFACE_TYPES:()=>Sr,ScopeOptionSchema:()=>h,SecretRequestEventSchema:()=>ht,ServiceGroupUpdateCompleteEventSchema:()=>gt,ServiceGroupUpdateProgressEventSchema:()=>_t,ServiceGroupUpdateStartingEventSchema:()=>vt,SubagentDetailEventSchema:()=>Zn,SubagentDetailResponseSchema:()=>Qn,SubagentEventEventSchema:()=>bt,SubagentInnerEventSchema:()=>yt,SubagentSpawnedEventSchema:()=>xt,SubagentStatusChangedEventSchema:()=>St,SubagentStatusSchema:()=>D,SubagentUsageStatsSchema:()=>O,SuggestedPromptSchema:()=>An,SuggestedPromptSourceSchema:()=>kn,SurfaceActionSchema:()=>Lt,SurfaceTypeSchema:()=>Cr,SyncChangedEventSchema:()=>Ct,TableCellValueSchema:()=>lr,TableColumnSchema:()=>cr,TableRowSchema:()=>ur,TableSurfaceDataSchema:()=>Y,ToolActivityMetadataSchema:()=>k,ToolOutputChunkEventSchema:()=>Tt,ToolOutputChunkSubTypeSchema:()=>wt,ToolResultEventSchema:()=>Mt,ToolUsePreviewStartEventSchema:()=>Nt,ToolUseStartEventSchema:()=>Pt,UISurfaceCompleteEventSchema:()=>Ft,UISurfaceDismissEventSchema:()=>It,UISurfaceShowEventSchema:()=>Rt,UISurfaceUpdateEventSchema:()=>zt,UsageProgressEventSchema:()=>A,UsageUpdateEventSchema:()=>Bt,UserMessageEchoEventSchema:()=>Vt,WebFetchMetadataSchema:()=>jt,WebSearchMetadataSchema:()=>At,WebSearchProviderIdSchema:()=>Dt,WebSearchResultItemSchema:()=>kt,WorkResultDiffSchema:()=>yr,WorkResultItemSchema:()=>vr,WorkResultMetadataSchema:()=>Q,WorkResultMetricSchema:()=>_r,WorkResultSectionSchema:()=>br,WorkResultSectionTypeSchema:()=>hr,WorkResultStatusSchema:()=>mr,WorkResultSurfaceDataSchema:()=>xr,WorkResultToneSchema:()=>Z,WorkflowCompletedEventSchema:()=>Ht,WorkflowJournalResponseSchema:()=>er,WorkflowLeafFinishedEventSchema:()=>Ut,WorkflowLeafSchema:()=>$n,WorkflowLeafStartedEventSchema:()=>Wt,WorkflowProgressEventSchema:()=>Gt,WorkflowRunStatusSchema:()=>j,WorkflowStartedEventSchema:()=>Kt,coerceSurfaceDataRecord:()=>tr,normalizeCopyBlockShowData:()=>rr,safeParseSurfaceData:()=>wr}),$=ne(`type`,[se,ce,le,de,fe,ge,_e,ve,ye,be,xe,Se,we,Te,Ee,De,je,Me,y,x,Pe,Fe,Re,Be,Ve,He,Ue,We,Ge,Ke,qe,Je,Xe,Ze,$e,tt,nt,rt,it,at,ot,st,ct,lt,ut,dt,ft,pt,mt,ht,gt,_t,vt,bt,xt,St,Ct,Tt,Mt,Nt,Pt,Ft,It,Rt,zt,A,Bt,Vt,Ht,Ut,Wt,Gt,Kt]),Er=l({id:d(),conversationId:d().optional(),seq:c().int().optional(),emittedAt:d(),message:$});export{Jt as _,W as a,H as c,G as d,Y as f,Yt as g,yn as h,V as i,q as l,Qn as m,$ as n,X as o,er as p,Tr as r,U as s,Er as t,J as u,qt as v,A as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-CW7wKp2r.js";import{m as r,u as i}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./input-D3MhHg0d.js";import{t as s}from"./dropdown-DQozlhbb.js";import{t as c}from"./is-electron-y5bNUVyG.js";import{u as l}from"./routes-D4ff4ONd.js";import{hn as u}from"./index-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-CW7wKp2r.js";import{m as r,u as i}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./input-D3MhHg0d.js";import{t as s}from"./dropdown-DQozlhbb.js";import{t as c}from"./is-electron-y5bNUVyG.js";import{u as l}from"./routes-D4ff4ONd.js";import{hn as u}from"./index-BsMTpxFY.js";import{a as d,i as f,n as p,o as m,r as h,s as g}from"./provider-key-BPINSkGG.js";import"./onboarding-step-layout-CEt9JOpN.js";var _=e(t(),1),v=a();function y(){let e=i(),[t]=r(),a=t.get(`hosting`),y=c(),b=p(),[x,S]=(0,_.useState)(()=>b?.provider??f.id),[C,w]=(0,_.useState)(()=>b?.key??``),[T,E]=(0,_.useState)(()=>b?.model??m(b?.provider??f.id)??``),[D,O]=(0,_.useState)(()=>b?.baseUrl??``),[k,A]=(0,_.useState)(()=>b?.customModels??``),j=g(x)??f,M=j.models??[],N=j.requiresKey,P=M.length>0,F=x===`openai-compatible`,I=(!(N&&!F)||C.trim().length>0)&&(!P||T.trim().length>0)&&(!F||D.trim().length>0&&k.trim().length>0);return(0,v.jsx)(u,{children:(0,v.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${y?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`px-6 py-16`} text-[var(--content-default)]`,children:[(0,v.jsx)(`h1`,{className:y?`text-title-large`:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Connect a Model Provider`}),(0,v.jsx)(`p`,{className:`text-center text-body-medium-lighter text-[var(--content-tertiary)] ${y?`mt-3.5`:`mt-3`}`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:`Choose the model provider your assistant should use.`}),(0,v.jsxs)(`div`,{className:`flex w-full flex-col gap-4 ${y?`mt-8`:`mt-10`}`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`},children:[(0,v.jsxs)(`div`,{className:`flex flex-col ${y?`gap-2`:`gap-1`}`,children:[(0,v.jsx)(`label`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Provider`}),(0,v.jsx)(s,{"aria-label":`Provider`,value:x,onChange:e=>{let t=g(e);t&&(S(t.id),w(``),E(m(t.id)??``))},options:d.map(e=>({value:e.id,label:e.displayName}))})]}),M.length>0&&(0,v.jsxs)(`div`,{className:`flex flex-col ${y?`gap-2`:`gap-1`}`,children:[(0,v.jsx)(`label`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Model`}),(0,v.jsx)(s,{"aria-label":`Model`,value:T,onChange:E,options:M.map(e=>({value:e.id,label:e.displayName}))})]}),F&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{className:`flex flex-col ${y?`gap-2`:`gap-1`}`,children:[(0,v.jsx)(`label`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Base URL`}),(0,v.jsx)(o,{type:`text`,placeholder:`http://localhost:1234/v1`,value:D,onChange:e=>O(e.target.value),fullWidth:!0})]}),(0,v.jsxs)(`div`,{className:`flex flex-col ${y?`gap-2`:`gap-1`}`,children:[(0,v.jsx)(`label`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Models`}),(0,v.jsx)(o,{type:`text`,placeholder:`model-1, model-2`,value:k,onChange:e=>A(e.target.value),fullWidth:!0}),(0,v.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Comma-separated model identifiers exposed by your endpoint.`})]})]}),N&&(0,v.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,v.jsx)(o,{type:`password`,label:`${j.displayName} API Key`,placeholder:j.apiKeyPlaceholder??`Enter your API key`,value:C,onChange:e=>w(e.target.value),className:`touch-mobile:text-[16px]`,fullWidth:!0}),j.docsUrl&&(0,v.jsxs)(`p`,{className:`self-start text-body-medium-lighter text-[var(--content-tertiary)]`,children:[`Don't have it?`,` `,(0,v.jsx)(`a`,{href:j.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[var(--content-default)] underline`,children:`Get an API key here`})]})]})]}),(0,v.jsxs)(`div`,{className:`mt-8 flex w-full flex-col ${y?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:[(0,v.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:!I,onClick:()=>{if(!I)return;let t=T.trim()||m(x);h({provider:x,key:C.trim(),...t?{model:t}:{},...F?{baseUrl:D.trim(),customModels:k.trim()}:{}}),e(a?`${l.onboarding.privacy}?hosting=${a}`:l.onboarding.privacy)},className:y?void 0:`h-11 text-base`,children:`Continue`}),(0,v.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,onClick:()=>{e(l.onboarding.hosting)},className:y?void 0:`h-11 text-base`,children:`Back`})]})]})})}export{y as ApiKeyScreen};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,ct as t,et as n,o as r}from"./local-mode-Dydd46cS.js";import{h as i}from"./api-
|
|
1
|
+
import{c as e,ct as t,et as n,o as r}from"./local-mode-Dydd46cS.js";import{h as i}from"./api-B81V8R46.js";import{At as a,_ as o,ht as s,mt as c,v as l,y as u}from"./sdk.gen-BR-xXIZm.js";import{a as d,n as f}from"./api-errors-CoE1wFl2.js";import{B as p,T as m,V as h,a as g,i as _,o as v,w as y,z as b}from"./sdk.gen-BCFkwLHb.js";async function x(e,t){let{data:n,error:r,response:i}=await y({body:e??{},query:t?{mode:t}:void 0,throwOnError:!1});return f(i,r,`Failed to hatch assistant.`),i.ok?{ok:!0,status:i.status,data:n}:{ok:!1,status:i.status,error:d(r,i)}}async function S(n){if(t()){let t=n?r(n):e();if(t)return{ok:!0,status:200,data:{id:t.assistantId,name:t.name??t.assistantId,status:`active`,is_local:!0,created:t.hatchedAt??``}}}if(n){let{data:e,error:t,response:r}=await h({path:{id:n},throwOnError:!1});return f(r,t,`Failed to get assistant.`),r.ok?{ok:!0,status:r.status,data:e}:{ok:!1,status:r.status,error:d(t,r)}}let i=await m({query:{hosting:`platform`},throwOnError:!1});if(f(i.response,i.error,`Failed to get assistant.`),!i.response.ok)return{ok:!1,status:i.response.status,error:d(i.error,i.response)};let a=i.data?.results??[];if(a.length>0)return{ok:!0,status:i.response.status,data:a[0]};let o=await m({query:{hosting:`local`},throwOnError:!1});if(f(o.response,o.error,`Failed to get assistant.`),o.response.ok){let e=o.data?.results??[];if(e.length>0)return{ok:!0,status:o.response.status,data:e[0]}}return o.response.ok?{ok:!1,status:404,error:{detail:`No assistants found`}}:{ok:!1,status:o.response.status,error:d(o.error,o.response)}}async function C(e){let{data:t,error:n,response:r}=await a({path:{assistant_id:e},throwOnError:!1});return f(r,n,`Failed to get assistant healthz.`),r.ok&&t?{ok:!0,status:r.status,data:t}:{ok:!1,status:r.status,error:d(n,r)}}async function w(e){let{data:t,error:n,response:r}=await s({path:{assistant_id:e},throwOnError:!1});if(f(r,n,`Failed to get assistant disk pressure status.`),r.ok){let e=i.safeParse(t);return e.success?{ok:!0,status:r.status,data:e.data}:{ok:!1,status:r.status,error:d(e.error.message,r)}}return{ok:!1,status:r.status,error:d(n,r)}}async function T(e){let{data:t,error:n,response:r}=await c({path:{assistant_id:e},throwOnError:!1});if(f(r,n,`Failed to acknowledge assistant disk pressure.`),r.ok){let e=i.safeParse(t);return e.success?{ok:!0,status:r.status,data:e.data}:{ok:!1,status:r.status,error:d(e.error.message,r)}}return{ok:!1,status:r.status,error:d(n,r)}}function E(e){let t=e&&typeof e==`object`&&!Array.isArray(e)?e:{};if(Array.isArray(t.backups))return t.backups;let n=t,r=[],i=n.local?.snapshots;if(Array.isArray(i))for(let e of i)r.push({snapshot_name:e.filename,pvc:``,created_at:e.created_at,ready_to_use:!0,backup_type:`scheduled`,path:e.path});if(Array.isArray(n.offsite)){for(let e of n.offsite)if(Array.isArray(e.snapshots))for(let t of e.snapshots)r.push({snapshot_name:t.filename,pvc:``,created_at:t.created_at,ready_to_use:!t.encrypted,backup_type:`scheduled`,path:t.path})}return r}function D(e){let t=e&&typeof e==`object`&&!Array.isArray(e)?e:{};return Array.isArray(t.backups)?t.backups:[]}async function O(e){let t=!n(),[r,i]=await Promise.all([l({path:{assistant_id:e},throwOnError:!1}),t?v({path:{assistant_id:e},throwOnError:!1}):null]);if(f(r.response,r.error,`Failed to list assistant backups.`),!r.response.ok)return{ok:!1,status:r.response.status,error:d(r.error,r.response)};let a=E(r.data);if(i){if(i.response?.ok){let e=D(i.data);return{ok:!0,status:r.response.status,data:[...e,...a]}}if(a.length===0&&i.response)return{ok:!1,status:i.response.status,error:d(i.error,i.response)}}return{ok:!0,status:r.response.status,data:a}}async function k(e){let{data:t,error:r,response:i}=n()?await o({path:{assistant_id:e},throwOnError:!1}):await _({path:{assistant_id:e},throwOnError:!1});if(f(i,r,`Failed to create assistant backup.`),i.ok){let e=t&&typeof t==`object`&&!Array.isArray(t)?t:{};return{ok:!0,status:i.status,data:e}}return{ok:!1,status:i.status,error:d(r,i)}}async function A(e,t){let{data:r,error:i,response:a}=n()?await u({path:{assistant_id:e},body:{path:t.path??t.snapshot_name},throwOnError:!1}):await g({path:{assistant_id:e,snapshot_name:t.snapshot_name},throwOnError:!1});if(f(a,i,`Failed to restore assistant backup.`),a.ok){let e=r&&typeof r==`object`&&!Array.isArray(r)?r:{};return{ok:!0,status:a.status,data:e}}return{ok:!1,status:a.status,error:d(i,a)}}async function j(e){let{data:t,error:n,response:r}=await b({path:{id:e},throwOnError:!1});return f(r,n,`Failed to restart assistant.`),r.ok?{ok:!0,data:t&&typeof t==`object`&&!Array.isArray(t)?t:{}}:{ok:!1,status:r.status,error:d(n,r)}}async function M(e){let{error:t,response:n}=await p({path:{id:e},throwOnError:!1});return f(n,t,`Failed to retire assistant.`),n.ok?{ok:!0}:{ok:!1,status:n.status,error:d(t,n)}}async function N(){let{data:e,error:t,response:n}=await m({query:{hosting:`all`},throwOnError:!1});return f(n,t,`Failed to list assistants.`),n.ok?{ok:!0,status:n.status,data:e?.results??[]}:{ok:!1,status:n.status,error:d(t,n)}}export{C as a,N as c,M as d,w as i,j as l,k as n,x as o,S as r,O as s,T as t,A as u};
|
package/dist/assets/{assistant-status-panel-gpwr0glD.js → assistant-status-panel-B8rTp6yC.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{n as t,t as n}from"./capture-error-anSemq95.js";import{t as r}from"./react-DJZBPgpf.js";import{t as i}from"./useQuery-B45lW1Kk.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./loader-circle-Ck8fq3yv.js";import"./src-BT0gNVcT.js";import"./tag-CJyI1Y2J.js";import{n as s}from"./toast-zHo1wvF9.js";import"./auth-store-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{n as t,t as n}from"./capture-error-anSemq95.js";import{t as r}from"./react-DJZBPgpf.js";import{t as i}from"./useQuery-B45lW1Kk.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./loader-circle-Ck8fq3yv.js";import"./src-BT0gNVcT.js";import"./tag-CJyI1Y2J.js";import{n as s}from"./toast-zHo1wvF9.js";import"./auth-store-DFiCpNm7.js";import{a as c,r as l}from"./api-njsh6_Bs.js";import{t as u}from"./assistant-feature-flag-store-Bh-_qc7v.js";import{J as d}from"./index-BsMTpxFY.js";import"./environment-store-geigPfHz.js";var f=e(r(),1),p=a();function m({value:e,max:t,caption:n}){let r=t>0?Math.max(0,Math.min(e/t*100,100)):0,i=r>90;return(0,p.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,p.jsx)(`div`,{className:`h-2 w-full overflow-hidden rounded-full bg-[var(--surface-active)]`,children:(0,p.jsx)(`div`,{className:`h-full rounded-full transition-[width] duration-200`,style:{width:`${r}%`,backgroundColor:i?`var(--system-negative-strong)`:`var(--system-positive-strong)`}})}),n&&(0,p.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:n})]})}var h=7,g=2e3;function _(e){let t=(0,f.useRef)(0),n=(0,f.useRef)(null),[r,i]=(0,f.useState)(null),a=(0,f.useCallback)(()=>{if(t.current+=1,t.current>=h){t.current=0;let r=u.getState(),a=!r.settingsDeveloperNav;r.setFlag(`settingsDeveloperNav`,a,e),i(a?`Developer mode enabled`:`Developer mode disabled`),n.current!==null&&clearTimeout(n.current),n.current=setTimeout(()=>{i(null),n.current=null},g)}},[e]);return(0,f.useEffect)(()=>()=>{n.current!==null&&clearTimeout(n.current)},[]),{onTap:a,message:r}}function v({version:e,loading:t,assistantId:n}){let{onTap:r,message:i}=_(n);return t?(0,p.jsxs)(`span`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,p.jsx)(o,{className:`h-4 w-4 animate-spin`}),`Loading version...`]}):e?(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`button`,{type:`button`,className:`break-all text-left text-body-medium-lighter text-[var(--content-default)]`,onClick:r,children:e}),i&&(0,p.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-accent)]`,children:i})]}):(0,p.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`—`})}var y=`currentAssistant`,b=4e3,x=9e4;function S(e,t){return(e.memory?.maxMb??null)!==(t.memory?.maxMb??null)||(e.cpu?.maxCores??null)!==(t.cpu?.maxCores??null)}function C(){let e=d(),{data:r=null,isLoading:a,refetch:o}=i({queryKey:[y,e],queryFn:async()=>{let t=await l(e);return t.ok?t.data:null},retry:!1}),u=r?.id,[p,m]=(0,f.useState)(null),[h,g]=(0,f.useState)(!1),[_,v]=(0,f.useState)(!1),C=(0,f.useRef)(0),w=(0,f.useRef)(0),T=(0,f.useCallback)(async e=>{if(!u)return m(null),g(!1),null;C.current+=1;let r=C.current;g(!0);try{let t=await c(u);return r===C.current?t.ok?(m(t.data),t.data):(e?.keepStaleOnError||m(null),null):null}catch(i){return r===C.current?(e?.keepStaleOnError||m(null),!t(i)&&!e?.keepStaleOnError&&(n(i,{context:`fetch_assistant_healthz`}),s.error(`Failed to load assistant info`)),null):null}finally{r===C.current&&g(!1)}},[u]);return(0,f.useEffect)(()=>{T()},[T]),(0,f.useEffect)(()=>()=>{w.current+=1,v(!1),m(null)},[u]),{assistant:r,assistantLoading:a,healthz:p,healthzLoading:h,healthzPolling:_,refetch:(0,f.useCallback)(async()=>{await o(),await T()},[o,T]),refetchUntilResized:(0,f.useCallback)(async e=>{let t=++w.current,n=Date.now()+x;v(!0);let r=e;try{for(o();Date.now()<n&&t===w.current;){if(await new Promise(e=>setTimeout(e,b)),t!==w.current)return;let e=await T({keepStaleOnError:!0});if(t!==w.current)return;if(e){if(r==null){r=e;continue}if(S(e,r))return}}}finally{t===w.current&&v(!1)}},[T,o])}}function w(e){return e>=1024?`${(e/1024).toFixed(1)} GB`:`${e.toFixed(0)} MB`}export{m as a,_ as i,C as n,v as r,w as t};
|