@vellumai/web 0.11.3-staging.2 → 0.11.3-staging.3
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/{access-DWtJQvRI.js → access-RDaLlBt5.js} +1 -1
- package/dist/assets/{account-page-D03pCcnz.js → account-page-JyXn859b.js} +1 -1
- package/dist/assets/{account-shell-DmVQwtZ0.js → account-shell-DuR-x14B.js} +1 -1
- package/dist/assets/{acp-run-detail-panel-COs66Yrd.js → acp-run-detail-panel-BsGRKgJi.js} +1 -1
- package/dist/assets/{activity-steps-panel-CLjBxqNs.js → activity-steps-panel-DGS78a-e.js} +1 -1
- package/dist/assets/{ai-page-D4GbPprS.js → ai-page-84Y9c_q2.js} +1 -1
- package/dist/assets/{app-card-B7C46-7O.js → app-card-Df-Gy7pD.js} +1 -1
- package/dist/assets/{assistant-status-panel-CDUAp33H.js → assistant-status-panel-C92c678g.js} +1 -1
- package/dist/assets/{auth-store-DkOiOQNx.js → auth-store-BJdkkmzu.js} +1 -1
- package/dist/assets/{background-task-detail-panel-xFGqYCUz.js → background-task-detail-panel-Dq1DgR5i.js} +1 -1
- package/dist/assets/billing-page-CAFoZYGH.js +3 -0
- package/dist/assets/{bookmarks-page-DqXq2CVJ.js → bookmarks-page-EeUOpkIO.js} +1 -1
- package/dist/assets/{build-state-B0f3Jn2o.js → build-state-DJaFMxtL.js} +1 -1
- package/dist/assets/{channels-page-route-CbV05RLi.js → channels-page-route-DS9XLjMy.js} +1 -1
- package/dist/assets/chat-markdown-message-C6oOqDdl.js +1 -0
- package/dist/assets/{checkout-page-BxYwG3J8.js → checkout-page-BqIlZAum.js} +1 -1
- package/dist/assets/{command-palette-DSxHNf_m.js → command-palette-D6aRon6x.js} +1 -1
- package/dist/assets/{command-palette-window-page-9lbssBKp.js → command-palette-window-page-B1jt_AiM.js} +1 -1
- package/dist/assets/{composer-settings-MHDtr31Y.js → composer-settings-Du4kV9LG.js} +1 -1
- package/dist/assets/{contacts-page-route-BE3oNfhk.js → contacts-page-route-B4eanbVf.js} +1 -1
- package/dist/assets/{conversation-navigation-DbQqV_fs.js → conversation-navigation-gR_RLe1J.js} +1 -1
- package/dist/assets/{conversation-queries-CMEwcap1.js → conversation-queries-Bx_JApUN.js} +1 -1
- package/dist/assets/{credentials-page-DKfIMfUB.js → credentials-page-BLMs_5u_.js} +1 -1
- package/dist/assets/{csv-preview-DB8q0b_y.js → csv-preview-B0xuZwnc.js} +1 -1
- package/dist/assets/{debug-page-DpWI-aFX.js → debug-page-7plKE23B.js} +2 -2
- package/dist/assets/{deploy-dialogs-BhY-urVH.js → deploy-dialogs-Bjz3OS-8.js} +1 -1
- package/dist/assets/{deploy-store-OFWDAEgC.js → deploy-store-BGcHwvB5.js} +1 -1
- package/dist/assets/{detail-card-Dsnf52vg.js → detail-card-hWrhardR.js} +1 -1
- package/dist/assets/{detail-drawer-AKY7keIJ.js → detail-drawer-s-zfqqMy.js} +1 -1
- package/dist/assets/{detail-panel-stop-button-Cvnn4hYA.js → detail-panel-stop-button-CC6QoK-R.js} +1 -1
- package/dist/assets/{detail-shell-g6Pw4jiP.js → detail-shell-PCaxY4Tf.js} +1 -1
- package/dist/assets/{developer-page-CSFTdMiT.js → developer-page-CV5m0xk-.js} +1 -1
- package/dist/assets/{document-viewer-container-Bousf9D9.js → document-viewer-container-wjJ6ACJv.js} +2 -2
- package/dist/assets/{document-viewer-page-CJuMnNZk.js → document-viewer-page-C8YfZSmS.js} +1 -1
- package/dist/assets/{emails-page-CMoX6WSY.js → emails-page-BqvrSqnK.js} +1 -1
- package/dist/assets/{file-editor-BwWJX7zO.js → file-editor-DOnVeKOG.js} +1 -1
- package/dist/assets/file-markdown-CGC6ZrPT.js +2 -0
- package/dist/assets/{first-run-scope-jh9sT0_v.js → first-run-scope-DKd0ZevK.js} +1 -1
- package/dist/assets/{general-page-Biad-auh.js → general-page-C7kX0xLP.js} +1 -1
- package/dist/assets/{hatching-screen-DtMbgBm6.js → hatching-screen-Dws0nCOf.js} +1 -1
- package/dist/assets/{home-page-route-k81d1Zsb.js → home-page-route-Qs5WbFPD.js} +1 -1
- package/dist/assets/home-tool-permission-card-Do3YeiVC.js +1 -0
- package/dist/assets/{hosting-screen-C-6MdEhq.js → hosting-screen-BJB_azfa.js} +1 -1
- package/dist/assets/{identity-page-route-BEobbSBV.js → identity-page-route-uZNXQbMq.js} +1 -1
- package/dist/assets/{index-BI5VpYa-.js → index-DRExgbkb.js} +1 -1
- package/dist/assets/index-Q1K0w5kB.css +2 -0
- package/dist/assets/{inspect-page-BSPJgPij.js → inspect-page-C1dITgHA.js} +1 -1
- package/dist/assets/{integrations-page-DNYDhZHQ.js → integrations-page-D4EH9FG0.js} +1 -1
- package/dist/assets/{intelligence-layout-CDcBeu8K.js → intelligence-layout-ByKfD_gm.js} +1 -1
- package/dist/assets/{library-detail-page-D5EeSRdZ.js → library-detail-page-BciW_57s.js} +1 -1
- package/dist/assets/{library-page-wPVeE7u1.js → library-page-CMO0VZux.js} +1 -1
- package/dist/assets/{local-runtime-upgrade-DyHUCz7A.js → local-runtime-upgrade-CXKbgZ4c.js} +1 -1
- package/dist/assets/{login-flow-B8CUFAeg.js → login-flow-CN5J4YsY.js} +1 -1
- package/dist/assets/{login-page-BgXMUzWB.js → login-page-5jtwkaF1.js} +1 -1
- package/dist/assets/{logout-page-COe8dRLu.js → logout-page-Bz0x8UvE.js} +1 -1
- package/dist/assets/{logs-layout-BGd_aSZ_.js → logs-layout-B_GC1zBM.js} +1 -1
- package/dist/assets/{memory-page-route-BGEmbUCl.js → memory-page-route-BtL6zJZb.js} +1 -1
- package/dist/assets/{memory-router-playground-page-B4DX4CON.js → memory-router-playground-page-e4uW8QiT.js} +1 -1
- package/dist/assets/{message-files-panel-DTDXhD0C.js → message-files-panel-DxmbSrm8.js} +1 -1
- package/dist/assets/{messages-D2OJUCHs.js → messages-DSdy6Lfi.js} +1 -1
- package/dist/assets/{metric-card-DgbUgyv7.js → metric-card-BSJPacNm.js} +1 -1
- package/dist/assets/{mobile-sidebar-drawer-CRXVtqcP.js → mobile-sidebar-drawer-BGHwfePU.js} +1 -1
- package/dist/assets/{multi-activity-group-Chyfm08f.js → multi-activity-group-D_OVaru-.js} +1 -1
- package/dist/assets/{open-workspace-file-C4HWMBzn.js → open-workspace-file-DViQQLp4.js} +2 -2
- package/dist/assets/{page-shell-CkfnwmIw.js → page-shell-Tpt9AIL2.js} +1 -1
- package/dist/assets/{personality-page-CEbJMhDR.js → personality-page-avdvL3Dx.js} +1 -1
- package/dist/assets/{plans-page-DXCrcLo8.js → plans-page-CdNdqHks.js} +1 -1
- package/dist/assets/{platform-login-notice-CIpebDVw.js → platform-login-notice-BEDBlins.js} +1 -1
- package/dist/assets/{platform-loopback-page-BJf6yE-E.js → platform-loopback-page-DcHVugCF.js} +1 -1
- package/dist/assets/{preview-error-CihmwI1t.js → preview-error-CVMngD78.js} +1 -1
- package/dist/assets/{privacy-page-CxAYEG0r.js → privacy-page-CfJXPReU.js} +1 -1
- package/dist/assets/{privacy-screen-DAzWoGQI.js → privacy-screen-4GElE18b.js} +1 -1
- package/dist/assets/{provider-callback-page--oWycq5i.js → provider-callback-page-rNJpxKm4.js} +1 -1
- package/dist/assets/{provider-signup-page-BaGT8Jl4.js → provider-signup-page-BG-fVW-J.js} +1 -1
- package/dist/assets/{remove-from-device-dialog-C0eaWxwl.js → remove-from-device-dialog-BGqwuQw9.js} +1 -1
- package/dist/assets/{research-onboarding-route-CXimVFK6.js → research-onboarding-route-s_8BLTOQ.js} +1 -1
- package/dist/assets/{retire-confirm-dialog-B1bvTlHS.js → retire-confirm-dialog-Bm7A3sZF.js} +1 -1
- package/dist/assets/{review-terms-screen-BxxGJL-B.js → review-terms-screen-CpWYZlRr.js} +1 -1
- package/dist/assets/routes-DE2XWIds.js +23 -0
- package/dist/assets/{runtime-upgrade-banner--bSmfygH.js → runtime-upgrade-banner-DtzsX2m0.js} +1 -1
- package/dist/assets/{sandbox-bridge-BlniBIsp.js → sandbox-bridge-WZhWtkZd.js} +1 -1
- package/dist/assets/{schedules-page-DCUj-YbP.js → schedules-page-Cfala7Km.js} +1 -1
- package/dist/assets/{select-assistant-screen-C5Cl_pCp.js → select-assistant-screen-BqObBI5Z.js} +1 -1
- package/dist/assets/{settings-divider-BuDc875f.js → settings-divider-Dyvf7Uk6.js} +1 -1
- package/dist/assets/{settings-layout-Clnlm1aB.js → settings-layout-DfPO11SQ.js} +1 -1
- package/dist/assets/{settings-navigation-Cn3KCxOe.js → settings-navigation-C1wEuU56.js} +1 -1
- package/dist/assets/{share-feedback-modal-COUhsUqF.js → share-feedback-modal-Ctgazbnj.js} +1 -1
- package/dist/assets/{sidebar-tree-BXbcoj07.js → sidebar-tree-VXRWtsy4.js} +1 -1
- package/dist/assets/{signup-page-C9ZrCSVo.js → signup-page-CLf-r4oP.js} +1 -1
- package/dist/assets/{site-favicon-B3DMFtr3.js → site-favicon-DfuXzZcN.js} +1 -1
- package/dist/assets/{skill-detail-page-Ckw6_1PG.js → skill-detail-page-ChpWru-e.js} +2 -2
- package/dist/assets/{skill-detail-panel-DdYbYHuj.js → skill-detail-panel-DU0bdJUl.js} +1 -1
- package/dist/assets/{skills-Lf85mR9L.js → skills-B4bfakyU.js} +1 -1
- package/dist/assets/{src-hNk11eS3.js → src-DyqTPMO2.js} +1 -1
- package/dist/assets/{stt-language-picker-modal-B5MO-3gk.js → stt-language-picker-modal-BiWHaqFq.js} +1 -1
- package/dist/assets/{subagent-detail-panel-BKhU7VAv.js → subagent-detail-panel-Gi0UOlsn.js} +1 -1
- package/dist/assets/superpowers-page-nHT_hb33.js +1 -0
- package/dist/assets/{system-events-page-DbcoH4sh.js → system-events-page-Bfpn0HzE.js} +1 -1
- package/dist/assets/{telegram-setup-wizard-C4E0wi1B.js → telegram-setup-wizard-GetgaQy5.js} +1 -1
- package/dist/assets/{text-preview-KOyX3OrO.js → text-preview-CEL0P-WV.js} +1 -1
- package/dist/assets/{theme-stage-page-D4DYc_C8.js → theme-stage-page-CEBFiy-u.js} +1 -1
- package/dist/assets/{tiptap-document-editor-CDIJTTa_.js → tiptap-document-editor-DPkcv0pe.js} +1 -1
- package/dist/assets/{tool-detail-panel-CmbBw4_n.js → tool-detail-panel-84bl2nI3.js} +1 -1
- package/dist/assets/{upgrade-cancel-page-DfjtkvP9.js → upgrade-cancel-page-DNteIqqS.js} +1 -1
- package/dist/assets/{upgrade-success-page-BDWg5oK4.js → upgrade-success-page-CAeO4QtE.js} +1 -1
- package/dist/assets/{use-assistant-identity-details-BAgi4MHa.js → use-assistant-identity-details-DqiKjphK.js} +1 -1
- package/dist/assets/{use-attachment-preview-CB3GsEns.js → use-attachment-preview-B4PALbqs.js} +1 -1
- package/dist/assets/{use-attachment-squares-DPuVHGRC.js → use-attachment-squares-C-9Rz-8O.js} +1 -1
- package/dist/assets/{use-bookmarks-C6IlHWIK.js → use-bookmarks-BWGVUg59.js} +1 -1
- package/dist/assets/{use-checkout-dismiss-refresh-CDwSKr1-.js → use-checkout-dismiss-refresh-BGeYbYii.js} +1 -1
- package/dist/assets/{use-command-palette-sections-DXzS2Tio.js → use-command-palette-sections-D3aj-BzX.js} +1 -1
- package/dist/assets/{use-edge-swipe-back-ZgANxgKE.js → use-edge-swipe-back-BGq52vVr.js} +2 -2
- package/dist/assets/{use-edit-app-BHUYCv4X.js → use-edit-app-u-kyfEFX.js} +1 -1
- package/dist/assets/{use-invite-link-dialog-CdY5FNQa.js → use-invite-link-dialog-Ccf_XNV3.js} +1 -1
- package/dist/assets/{use-is-org-ready-BmOdacs1.js → use-is-org-ready-CQntk0MX.js} +1 -1
- package/dist/assets/{use-onboarding-login-BUaNGE_u.js → use-onboarding-login-Cw_9Ydsv.js} +1 -1
- package/dist/assets/{use-platform-assistant-id-CEMyKEvV.js → use-platform-assistant-id-DMP9urFb.js} +1 -1
- package/dist/assets/{use-platform-gate-CdwOyQ8A.js → use-platform-gate-2lhRAyKS.js} +1 -1
- package/dist/assets/{use-return-to-short-circuit-CTYRB2Ne.js → use-return-to-short-circuit-Dm5PWev2.js} +1 -1
- package/dist/assets/{use-skill-actions-GbdM3IIw.js → use-skill-actions-BopRxJ9x.js} +1 -1
- package/dist/assets/{use-sticky-profiles-LVe9u5gh.js → use-sticky-profiles-5cPu_MUo.js} +1 -1
- package/dist/assets/{use-subagent-card-data-CFKl88ab.js → use-subagent-card-data-VnA5x24X.js} +1 -1
- package/dist/assets/use-transcript-message-by-id-DCOlEJjY.js +1 -0
- package/dist/assets/{use-transcript-messages-vw2Hogaj.js → use-transcript-messages-BEpY7uG4.js} +1 -1
- package/dist/assets/{use-voice-sample-preview-BjIqIVEG.js → use-voice-sample-preview-CzqJYPiZ.js} +1 -1
- package/dist/assets/{viewer-store-DhrkeZmJ.js → viewer-store-CayI6XWh.js} +1 -1
- package/dist/assets/{voice-list-DnqRx15F.js → voice-list-BS2BNjKN.js} +1 -1
- package/dist/assets/{voice-page-CrrYAE9k.js → voice-page-B7t0g-1X.js} +1 -1
- package/dist/assets/{voice-providers-note-ValSs0nz.js → voice-providers-note-Cv7vCsDI.js} +1 -1
- package/dist/assets/{welcome-screen-CiBqE53u.js → welcome-screen-eqR0DNzE.js} +1 -1
- package/dist/assets/{workflow-detail-panel-crM7HRfK.js → workflow-detail-panel-Dlj8i7AM.js} +1 -1
- package/dist/assets/{workspace-page-iAsgehav.js → workspace-page-CAbshSeb.js} +1 -1
- package/dist/index.html +46 -46
- package/package.json +1 -1
- package/dist/assets/billing-page-n2hU_EAj.js +0 -3
- package/dist/assets/chat-markdown-message-WfT4JUja.js +0 -1
- package/dist/assets/file-markdown-CZPyyZhu.js +0 -2
- package/dist/assets/home-tool-permission-card-Bytpm6bE.js +0 -1
- package/dist/assets/index-_S2T-6in.css +0 -2
- package/dist/assets/routes-ZeXUrnzY.js +0 -23
- package/dist/assets/superpowers-page-gPiU1fsq.js +0 -1
- package/dist/assets/use-transcript-message-by-id-cDbEJMB-.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/esm-RwtNn1Lo.js","assets/preload-helper-Cv2QeVDK.js","assets/dist-Br0LBu8Y.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e,r as t}from"./chunk-jRWAZmH_.js";import{t as n}from"./react-BFJW0bSv.js";import{W as r,n as i,t as a}from"./button-BENY-yx_.js";import{t as o}from"./preload-helper-Cv2QeVDK.js";import{t as s}from"./useMutation-CXGTrp4W.js";import{t as c}from"./jsx-runtime-D3ZM-ToX.js";import{t as l}from"./bug-CDEs1Scu.js";import{t as u}from"./download-Byg0fi0d.js";import{t as ee}from"./info-CXkwGlN_.js";import{t as d}from"./lightbulb-DqvoPoCk.js";import{t as te}from"./loader-circle-DOtGXcds.js";import{t as ne}from"./mail-CYjppw70.js";import{t as f}from"./message-circle-C6QWfv9m.js";import{t as p}from"./paperclip-CQEdxfSq.js";import{t as re}from"./send-BlX2px_R.js";import{t as m}from"./x-338EsJDP.js";import{t as h}from"./notice-C0ifrvvJ.js";import{n as ie,t as g}from"./input-DmHXRXaB.js";import{t as _}from"./toggle-C-v4x7_A.js";import{t as v}from"./select-B8-i-CZ4.js";import{t as y}from"./is-electron-BHXrkjI3.js";import{n as b}from"./assistant-identity-store-nE-e8KQw.js";import{n as ae}from"./auth-store-DkOiOQNx.js";import{dn as x}from"./sdk.gen-CBPZ2IdN.js";import{t as S}from"./dist-Br0LBu8Y.js";import{n as C}from"./diagnostics-6dSlxnyU.js";import"./external-urls-EO9DXoFH.js";import{I as oe}from"./react-query.gen-DKb3mEwJ.js";var w=e(n(),1),se=e(r(),1),ce=`vellum:debug:`;function T(){let e={};if(typeof window>`u`)return e;try{for(let t=0;t<window.localStorage.length;t++){let n=window.localStorage.key(t);if(n===null||!n.startsWith(ce))continue;let r=window.localStorage.getItem(n);r!==null&&(e[n]=r)}}catch{}return e}function E(){return{collectedAt:new Date().toISOString(),resolved:{impersonateAssistantVersion:b()},overrides:T()}}var D=t({ShareFeedbackModal:()=>W,dedupeAgainstClientMessages:()=>B,stripBulkBase64:()=>z}),O=c(),k=[{value:`bug_report`,label:`Bug Report`,icon:l,includesLogsByDefault:!0},{value:`feature_request`,label:`Feature Request`,icon:d,includesLogsByDefault:!1},{value:`other`,label:`Other`,icon:f,includesLogsByDefault:!1}],A=[{value:`past_hour`,label:`Past hour`,cutoffMs:3600*1e3},{value:`past_24_hours`,label:`Past 24 hours`,cutoffMs:1440*60*1e3},{value:`all_time`,label:`All time`,cutoffMs:null}],le=A.map(e=>({value:e.value,label:e.label})),j=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`video/mp4`,`video/quicktime`,`video/webm`]),M=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`mp4`,`mov`,`webm`]),N=10,P=50*1024*1024,ue={bug_report:`bug_report`,feature_request:`feature_request`,other:`other`};function de(){if(y())return`electron`;let e=S.getPlatform();return e===`ios`||e===`android`?e:`web`}function fe(e){return typeof e==`object`&&!!e&&`client`in e}function pe(e){if(e.size>P)return!1;if(e.type&&j.has(e.type))return!0;if(!e.type){let t=e.name.split(`.`).pop()?.toLowerCase();return t?M.has(t):!1}return!1}var F=8192,I=/^data:([^;,]+);base64,/i,L=/^[A-Za-z0-9+/]+={0,2}$/;function R(e,t,n=new WeakSet){let r=t(e);if(r)return r.replacement;if(typeof e!=`object`||!e)return e;if(n.has(e))return`[cyclic]`;n.add(e);let i;if(Array.isArray(e))i=e.map(e=>R(e,t,n));else{let r={};for(let[i,a]of Object.entries(e))r[i]=R(a,t,n);i=r}return n.delete(e),i}function z(e){return R(e,e=>{if(typeof e!=`string`)return null;let t=I.exec(e);return t?{replacement:`[stripped data URI ${t[1]}, ${e.length} chars]`}:e.length>=F&&L.test(e)?{replacement:`[stripped base64, ${e.length} chars]`}:null})}function B(e,t){if(!Array.isArray(t))return e;let n=new Map;return t.forEach((e,t)=>{if(e&&typeof e==`object`){let r=e.id;n.set(e,typeof r==`string`?r:`index ${t}`)}}),R(e,e=>{if(typeof e!=`object`||!e)return null;let t=n.get(e);return t===void 0?null:{replacement:`[deduplicated: see clientMessages ${t}]`}})}function V(e,t){let n=Math.ceil(t.length/512),r=new Uint8Array(512+n*512),i=new TextEncoder,a=(e,t,n)=>{let a=i.encode(e);r.set(a.slice(0,n),t)},o=(e,t,n)=>{a(e.toString(8).padStart(n-1,`0`)+`\0`,t,n)};a(e,0,100),o(420,100,8),o(0,108,8),o(0,116,8),o(t.length,124,12),o(Math.floor(Date.now()/1e3),136,12);for(let e=148;e<156;e++)r[e]=32;r[156]=48,a(`ustar\0`,257,6),a(`00`,263,2);let s=0;for(let e=0;e<512;e++)s+=r[e];return o(s,148,7),r[155]=32,r.set(t,512),r}async function H(e,t){try{let n={};t.window.startTime!=null&&(n.startTime=t.window.startTime,n.endTime=t.window.endTime),t.activeConversationId&&(n.conversationId=t.activeConversationId);let{data:r,error:i}=await x({path:{assistant_id:e},body:n,parseAs:`blob`,throwOnError:!1});if(i||!(r instanceof Blob))return null;let a=await r.arrayBuffer();return new Uint8Array(a)}catch{return null}}async function U(){if(!S.isNativePlatform())return null;try{let{App:e}=await o(async()=>{let{App:e}=await import(`./esm-RwtNn1Lo.js`);return{App:e}},__vite__mapDeps([0,1,2])),{id:t,name:n,version:r,build:i}=await e.getInfo();return{id:t,name:n,version:r,build:i}}catch{return null}}async function me(e,t,n,r={}){if(typeof CompressionStream>`u`)return null;let{diagnosticsProvider:i,doctorSessionId:a,extraLogFiles:o=[]}=r,s=new Date,c=A.find(t=>t.value===e),l=s.getTime(),u=c?.cutoffMs==null?null:l-c.cutoffMs,ee=u==null?null:new Date(u).toISOString(),d=null;try{d=i?.()??null}catch{d=null}let te=C(d),ne={collected_at:s.toISOString(),time_range:e,cutoff:ee,log_window:{start_time_ms:u,end_time_ms:l},assistant_id:t,active_conversation_id:n,doctor_session_id:a??null,client_version:null,native_app:await U(),user_agent:typeof navigator<`u`?navigator.userAgent:``,language:typeof navigator<`u`?navigator.language:``,platform:typeof navigator<`u`?navigator.platform:``,url:typeof window<`u`?window.location.href:``,viewport:typeof window<`u`?{width:window.innerWidth,height:window.innerHeight}:null,screen:typeof screen<`u`?{width:screen.width,height:screen.height}:null,connection:typeof navigator<`u`&&`connection`in navigator?{effectiveType:navigator.connection.effectiveType,downlink:navigator.connection.downlink,rtt:navigator.connection.rtt}:null,deviceMemory:typeof navigator<`u`&&`deviceMemory`in navigator?navigator.deviceMemory:null,hardwareConcurrency:typeof navigator<`u`?navigator.hardwareConcurrency:null},f=new TextEncoder,p=f.encode(JSON.stringify(ne,null,2)),re=f.encode(JSON.stringify(te,null,2)),m=[V(`web-client-context.json`,p),V(`web-chat-diagnostics.json`,re)],h=new TextEncoder().encode(JSON.stringify(E(),null,2));m.push(V(`web-debug-flags.json`,h));for(let e of o){let t=e.contents.trim();t&&m.push(V(e.filename,f.encode(t)))}try{let e=typeof window<`u`?window._vellumDebug?.chat:null;if(e){let t=e.getClientMessages?.()??null,n={clientMessages:t,transcriptItems:B(e.getTranscriptItems?.()??null,t),pendingInteractions:e.listPendingInteractions?.()??null,thinkingIndicator:e.thinkingIndicator?.()??null,streamingRing:e.streamingRing?.()??null,reconciliationDiagnostics:e.getReconciliationDiagnostics?.()??null},r=new TextEncoder().encode(JSON.stringify(z(n),null,2));m.push(V(`web-chat-debug-api-triage.json`,r))}}catch{}try{let e=typeof window<`u`?window._vellumDebug?.events:null;if(e){let t={focus:typeof document<`u`?{hasFocus:typeof document.hasFocus==`function`?document.hasFocus():null,visibilityState:document.visibilityState}:null,clients:e.getClients().map(({abortSignal:e,...t})=>({...t,aborted:e.aborted})),events:e.getEvents()},n=new TextEncoder().encode(JSON.stringify(z(t),null,2));m.push(V(`web-sse-liveness-triage.json`,n))}}catch{}if(y()&&window.vellum?.feedback){try{let e=await window.vellum.feedback.diagnostics(),t=new TextEncoder().encode(JSON.stringify(e,null,2));m.push(V(`electron-diagnostics.json`,t))}catch{}try{let e=await window.vellum.feedback.logs();if(e){let t=new TextEncoder().encode(e);m.push(V(`electron-main-logs.txt`,t))}}catch{}}if(t){let e=await H(t,{window:{startTime:u,endTime:l},activeConversationId:n});e&&m.push(V(`platform-logs.tar.gz`,e))}m.push(new Uint8Array(1024));let ie=m.reduce((e,t)=>e+t.length,0),g=new Uint8Array(ie),_=0;for(let e of m)g.set(e,_),_+=e.length;let v=new Blob([g.buffer]),b=await new Response(v.stream().pipeThrough(new CompressionStream(`gzip`))).blob();return new File([b],`web-client-logs-${s.getTime()}.tar.gz`,{type:`application/gzip`})}function W({open:e,onClose:t,initialReason:n,initialMessage:r,onSubmitted:o,assistantId:c,assistantVersion:l,activeConversationId:d,doctorSessionId:f,doctorSessionLog:b,getDiagnosticsSnapshot:x}){let S=ae.use.user(),C=S?.email,ce=S?.isStaff??!1,T=(0,w.useId)(),E=(0,w.useRef)(null),D=(0,w.useRef)(null),A=(0,w.useRef)(null),j=(0,w.useRef)(null),[M,P]=(0,w.useState)(n??`bug_report`),[F,I]=(0,w.useState)(``),[L,R]=(0,w.useState)(``),[z,B]=(0,w.useState)(k.find(e=>e.value===(n??`bug_report`))?.includesLogsByDefault??!0),[V,H]=(0,w.useState)(!1),[U,W]=(0,w.useState)(`past_hour`),[G,K]=(0,w.useState)([]),[_e,q]=(0,w.useState)(null),[ve,J]=(0,w.useState)(!1),[Y,ye]=(0,w.useState)(!1),[X,be]=(0,w.useState)(!1),Z=s(oe()),[xe,Q]=(0,w.useState)(!1),$=Z.isPending||xe,Se=!C,Ce=(0,w.useMemo)(()=>F.trim().length>0&&L.trim().length>0,[F,L]);(0,w.useEffect)(()=>{if(!e)return;let t=n??`bug_report`;P(t),I(r??``),R(C??``),B(k.find(e=>e.value===t)?.includesLogsByDefault??!0),H(!1),W(`past_hour`),K([]),ye(!1),be(!1),q(null),Q(!1),Z.reset();let i=setTimeout(()=>{C?A.current?.focus():j.current?.focus()},50);return()=>clearTimeout(i)},[e]),(0,w.useEffect)(()=>{if(!e)return;let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=t}},[e]);let we=e=>{P(e),V||B(k.find(t=>t.value===e)?.includesLogsByDefault??!1)},Te=()=>{B(e=>!e),H(!0)},Ee=b?.trim()?[{filename:`doctor-session.txt`,contents:b}]:[],De=(0,w.useCallback)(e=>{e.key===`Escape`&&!e.defaultPrevented&&!$&&(e.preventDefault(),t())},[t,$]),Oe=(0,w.useCallback)(e=>{e.target===E.current&&!$&&t()},[t,$]),ke=(0,w.useCallback)(e=>{K(t=>{let n=N-t.length;if(n<=0)return t;let r=new Set(t.map(e=>`${e.name}:${e.size}`)),i=[];for(let t of e){if(i.length>=n)break;if(!pe(t))continue;let e=`${t.name}:${t.size}`;r.has(e)||(r.add(e),i.push(t))}return i.length>0?[...t,...i]:t})},[]),Ae=e=>{e.target.files&&ke(Array.from(e.target.files)),e.target.value=``},je=e=>{e.preventDefault(),J(!1),e.dataTransfer.files?.length&&ke(Array.from(e.dataTransfer.files))},Me=e=>{e.preventDefault(),J(!0)},Ne=e=>{e.preventDefault(),e.currentTarget===e.target&&J(!1)},Pe=e=>{K(t=>t.filter((t,n)=>n!==e))};return e?(0,se.createPortal)((0,O.jsx)(`div`,{ref:E,role:`dialog`,"aria-modal":`true`,"aria-labelledby":T,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onKeyDown:De,onClick:Oe,onDrop:je,onDragOver:Me,onDragLeave:Ne,children:(0,O.jsxs)(`div`,{className:`mx-4 flex w-full max-w-lg flex-col rounded-xl border p-6 shadow-xl`,style:{backgroundColor:`var(--surface-lift)`,borderColor:`var(--border-base)`,maxHeight:`calc(100vh - 2rem)`},children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-4`,style:{borderColor:`var(--border-subtle)`},children:[(0,O.jsx)(`h2`,{id:T,className:`!m-0 text-title-small text-[var(--content-default)]`,children:`Share Feedback`}),(0,O.jsx)(a,{variant:`ghost`,iconOnly:(0,O.jsx)(m,{}),onClick:t,disabled:$,"aria-label":`Close`,tintColor:`var(--content-secondary)`})]}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-3.5 overflow-y-auto pt-4 ${$?`pointer-events-none opacity-60`:``}`,children:[ce&&(0,O.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-2.5`,children:[(0,O.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3`,children:[(0,O.jsx)(_,{checked:X,onChange:()=>be(e=>!e),"aria-label":`Download diagnostics directly`}),(0,O.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Download diagnostics directly`})]}),(0,O.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Admin only — builds the diagnostics archive locally and downloads it instead of submitting feedback or notifying Slack.`})]}),X?(0,O.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,O.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Time range`}),(0,O.jsx)(v,{options:le,value:U,onChange:W,"aria-label":`Diagnostics time range`})]}):(0,O.jsxs)(O.Fragment,{children:[Se&&(0,O.jsx)(g,{id:`${T}-email`,ref:j,label:`Email`,type:`email`,placeholder:`you@example.com`,value:L,onChange:e=>R(e.target.value),leftIcon:(0,O.jsx)(ne,{className:`h-4 w-4`,"aria-hidden":!0}),fullWidth:!0}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,O.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Category`}),(0,O.jsx)(`div`,{className:`flex gap-2`,children:k.map(e=>(0,O.jsx)(he,{option:e,isSelected:M===e.value,onSelect:()=>we(e.value)},e.value))})]}),(0,O.jsx)(`hr`,{className:`border-[var(--border-subtle)]`}),M===`bug_report`&&(0,O.jsxs)(h,{tone:`info`,children:[`Tip: Get faster support by posting in our`,` `,(0,O.jsx)(`a`,{href:`https://vellum.ai/community`,target:`_blank`,rel:`noopener noreferrer`,className:`underline text-[var(--content-default)]`,children:`Discord community`})]}),M===`feature_request`&&(0,O.jsxs)(h,{tone:`info`,children:[`Tip: Vote on features on our`,` `,(0,O.jsx)(`a`,{href:`https://vellum.ai/roadmap`,target:`_blank`,rel:`noopener noreferrer`,className:`underline text-[var(--content-default)]`,children:`public roadmap`})]}),(0,O.jsx)(ie,{id:`${T}-message`,ref:A,label:M===`bug_report`?`What went wrong?`:M===`feature_request`?`Describe your idea`:`What's on your mind?`,rows:3,placeholder:M===`bug_report`?`What did you expect to happen, and what happened instead?`:M===`feature_request`?`What problem would this solve for you?`:`Share your thoughts...`,value:F,onChange:e=>I(e.target.value),fullWidth:!0}),M!==`feature_request`&&(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,O.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5`,children:[(0,O.jsx)(_,{checked:z,onChange:Te,"aria-label":`Include browser diagnostics`}),(0,O.jsx)(`span`,{className:`text-body-medium-lighter leading-6 text-[var(--content-default)]`,children:`Include diagnostics`})]}),(0,O.jsx)(i,{content:`Diagnostics include browser context, assistant logs, and timestamps — never passwords or credentials.`,children:(0,O.jsx)(`button`,{type:`button`,"aria-label":`About diagnostics`,className:`inline-flex items-center justify-center text-[var(--content-tertiary)]`,children:(0,O.jsx)(ee,{className:`h-3.5 w-3.5`})})})]}),z&&(0,O.jsx)(v,{options:le,value:U,onChange:W,"aria-label":`Diagnostics time range`})]}),y()&&d&&M!==`feature_request`&&(0,O.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5`,children:[(0,O.jsx)(_,{checked:Y,onChange:()=>ye(e=>!e),"aria-label":`Include the most recent conversation`}),(0,O.jsx)(`span`,{className:`text-body-medium-lighter leading-6 text-[var(--content-default)]`,children:`Include the most recent conversation`})]}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:[`Attachments`,G.length>0&&(0,O.jsxs)(`span`,{className:`text-[var(--content-tertiary)]`,children:[` · `,G.length,`/`,N]})]}),(0,O.jsx)(a,{variant:`outlined`,size:`compact`,leftIcon:(0,O.jsx)(p,{}),onClick:()=>D.current?.click(),disabled:G.length>=N,children:`Add files`}),(0,O.jsx)(`input`,{ref:D,type:`file`,multiple:!0,accept:`image/png,image/jpeg,image/gif,image/webp,video/mp4,video/quicktime,video/webm`,onChange:Ae,className:`hidden`})]}),G.length>0&&(0,O.jsx)(`div`,{className:`flex gap-2 overflow-x-auto`,children:G.map((e,t)=>(0,O.jsx)(ge,{file:e,onRemove:()=>Pe(t)},`${e.name}-${t}`))}),ve&&(0,O.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Drop files to attach…`})]})]}),_e&&(0,O.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:_e})]}),(0,O.jsx)(`div`,{className:`mt-4 flex items-center justify-end gap-2 border-t pt-4`,style:{borderColor:`var(--border-subtle)`},children:$?(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,O.jsx)(te,{className:`h-4 w-4 animate-spin`}),X?`Preparing diagnostics…`:`Sending feedback…`]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(a,{variant:`ghost`,onClick:t,children:`Cancel`}),X?(0,O.jsx)(a,{variant:`primary`,leftIcon:(0,O.jsx)(u,{}),onClick:async()=>{if(!$){q(null),Q(!0);try{let e=await me(U,c??null,y()?Y?d??null:null:d??null,{diagnosticsProvider:x,doctorSessionId:f,extraLogFiles:Ee});if(!e){q(`Diagnostics export isn't supported in this browser.`);return}let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=e.name,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),0),t()}catch(e){q(e instanceof Error?e.message:`Failed to build diagnostics. Please try again.`)}finally{Q(!1)}}},children:`Download diagnostics`}):(0,O.jsx)(a,{variant:`primary`,leftIcon:(0,O.jsx)(re,{}),onClick:async()=>{if(!(!Ce||$)){q(null),Q(!0);try{let e=z&&M!==`feature_request`?await me(U,c??null,y()?Y?d??null:null:d??null,{diagnosticsProvider:x,doctorSessionId:f,extraLogFiles:Ee}):null,n=de(),r=t=>Z.mutateAsync({headers:{"Content-Type":null},body:{message:F.trim(),classification:ue[M],email:L.trim(),client:t,client_version:void 0,...c?{assistant_id:c}:{},...l?{assistant_version:l}:{},...f?{doctor_session_id:f}:{},...e?{logs_file:e}:{},...G.length?{attachments:G}:{}},bodySerializer:e=>{let t=new FormData;for(let[n,r]of Object.entries(e))if(r!=null){if(n===`attachments`&&Array.isArray(r)){for(let e of r)t.append(`attachments`,e);continue}r instanceof Blob?t.append(n,r):t.append(n,String(r))}return t}});try{await r(n)}catch(e){if(n!==`android`||!fe(e))throw e;await r(`web`)}o?.(),t()}catch(e){q(e instanceof Error?e.message:`Failed to submit feedback. Please try again.`)}finally{Q(!1)}}},disabled:!Ce,children:`Submit`})]})})]})}),document.body):null}function he({option:e,isSelected:t,onSelect:n}){let r=e.icon;return(0,O.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,className:`flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-left transition-colors`,style:{borderColor:t?`var(--primary-base)`:`var(--border-base)`,backgroundColor:t?`color-mix(in oklab, var(--primary-base) 10%, transparent)`:`transparent`},children:[(0,O.jsx)(r,{className:`h-3.5 w-3.5 shrink-0`,style:{color:t?`var(--primary-base)`:`var(--content-secondary)`}}),(0,O.jsx)(`span`,{className:`text-body-small-default`,style:{color:t?`var(--primary-base)`:`var(--content-default)`},children:e.label})]})}function ge({file:e,onRemove:t}){let n=e.type.startsWith(`image/`),r=(0,w.useMemo)(()=>n?URL.createObjectURL(e):null,[e,n]);return(0,w.useEffect)(()=>{if(r)return()=>URL.revokeObjectURL(r)},[r]),(0,O.jsxs)(`div`,{className:`relative flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)]`,title:e.name,children:[n&&r?(0,O.jsx)(`img`,{src:r,alt:e.name,className:`h-full w-full object-cover`}):(0,O.jsx)(p,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,O.jsx)(a,{variant:`ghost`,size:`compact`,iconOnly:(0,O.jsx)(m,{}),onClick:t,"aria-label":`Remove ${e.name}`,className:`absolute top-0.5 right-0.5 h-4 w-4 rounded-full bg-black/60 text-white hover:bg-black/70`,tintColor:`#fff`})]})}export{D as n,W as t};
|
|
2
|
+
import{o as e,r as t}from"./chunk-jRWAZmH_.js";import{t as n}from"./react-BFJW0bSv.js";import{W as r,n as i,t as a}from"./button-BENY-yx_.js";import{t as o}from"./preload-helper-Cv2QeVDK.js";import{t as s}from"./useMutation-CXGTrp4W.js";import{t as c}from"./jsx-runtime-D3ZM-ToX.js";import{t as l}from"./bug-CDEs1Scu.js";import{t as u}from"./download-Byg0fi0d.js";import{t as ee}from"./info-CXkwGlN_.js";import{t as d}from"./lightbulb-DqvoPoCk.js";import{t as te}from"./loader-circle-DOtGXcds.js";import{t as ne}from"./mail-CYjppw70.js";import{t as f}from"./message-circle-C6QWfv9m.js";import{t as p}from"./paperclip-CQEdxfSq.js";import{t as re}from"./send-BlX2px_R.js";import{t as m}from"./x-338EsJDP.js";import{t as h}from"./notice-C0ifrvvJ.js";import{n as ie,t as g}from"./input-DmHXRXaB.js";import{t as _}from"./toggle-C-v4x7_A.js";import{t as v}from"./select-B8-i-CZ4.js";import{t as y}from"./is-electron-BHXrkjI3.js";import{n as b}from"./assistant-identity-store-nE-e8KQw.js";import{n as ae}from"./auth-store-BJdkkmzu.js";import{dn as x}from"./sdk.gen-CBPZ2IdN.js";import{t as S}from"./dist-Br0LBu8Y.js";import{n as C}from"./diagnostics-6dSlxnyU.js";import"./external-urls-EO9DXoFH.js";import{I as oe}from"./react-query.gen-DKb3mEwJ.js";var w=e(n(),1),se=e(r(),1),ce=`vellum:debug:`;function T(){let e={};if(typeof window>`u`)return e;try{for(let t=0;t<window.localStorage.length;t++){let n=window.localStorage.key(t);if(n===null||!n.startsWith(ce))continue;let r=window.localStorage.getItem(n);r!==null&&(e[n]=r)}}catch{}return e}function E(){return{collectedAt:new Date().toISOString(),resolved:{impersonateAssistantVersion:b()},overrides:T()}}var D=t({ShareFeedbackModal:()=>W,dedupeAgainstClientMessages:()=>B,stripBulkBase64:()=>z}),O=c(),k=[{value:`bug_report`,label:`Bug Report`,icon:l,includesLogsByDefault:!0},{value:`feature_request`,label:`Feature Request`,icon:d,includesLogsByDefault:!1},{value:`other`,label:`Other`,icon:f,includesLogsByDefault:!1}],A=[{value:`past_hour`,label:`Past hour`,cutoffMs:3600*1e3},{value:`past_24_hours`,label:`Past 24 hours`,cutoffMs:1440*60*1e3},{value:`all_time`,label:`All time`,cutoffMs:null}],le=A.map(e=>({value:e.value,label:e.label})),j=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`video/mp4`,`video/quicktime`,`video/webm`]),M=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`mp4`,`mov`,`webm`]),N=10,P=50*1024*1024,ue={bug_report:`bug_report`,feature_request:`feature_request`,other:`other`};function de(){if(y())return`electron`;let e=S.getPlatform();return e===`ios`||e===`android`?e:`web`}function fe(e){return typeof e==`object`&&!!e&&`client`in e}function pe(e){if(e.size>P)return!1;if(e.type&&j.has(e.type))return!0;if(!e.type){let t=e.name.split(`.`).pop()?.toLowerCase();return t?M.has(t):!1}return!1}var F=8192,I=/^data:([^;,]+);base64,/i,L=/^[A-Za-z0-9+/]+={0,2}$/;function R(e,t,n=new WeakSet){let r=t(e);if(r)return r.replacement;if(typeof e!=`object`||!e)return e;if(n.has(e))return`[cyclic]`;n.add(e);let i;if(Array.isArray(e))i=e.map(e=>R(e,t,n));else{let r={};for(let[i,a]of Object.entries(e))r[i]=R(a,t,n);i=r}return n.delete(e),i}function z(e){return R(e,e=>{if(typeof e!=`string`)return null;let t=I.exec(e);return t?{replacement:`[stripped data URI ${t[1]}, ${e.length} chars]`}:e.length>=F&&L.test(e)?{replacement:`[stripped base64, ${e.length} chars]`}:null})}function B(e,t){if(!Array.isArray(t))return e;let n=new Map;return t.forEach((e,t)=>{if(e&&typeof e==`object`){let r=e.id;n.set(e,typeof r==`string`?r:`index ${t}`)}}),R(e,e=>{if(typeof e!=`object`||!e)return null;let t=n.get(e);return t===void 0?null:{replacement:`[deduplicated: see clientMessages ${t}]`}})}function V(e,t){let n=Math.ceil(t.length/512),r=new Uint8Array(512+n*512),i=new TextEncoder,a=(e,t,n)=>{let a=i.encode(e);r.set(a.slice(0,n),t)},o=(e,t,n)=>{a(e.toString(8).padStart(n-1,`0`)+`\0`,t,n)};a(e,0,100),o(420,100,8),o(0,108,8),o(0,116,8),o(t.length,124,12),o(Math.floor(Date.now()/1e3),136,12);for(let e=148;e<156;e++)r[e]=32;r[156]=48,a(`ustar\0`,257,6),a(`00`,263,2);let s=0;for(let e=0;e<512;e++)s+=r[e];return o(s,148,7),r[155]=32,r.set(t,512),r}async function H(e,t){try{let n={};t.window.startTime!=null&&(n.startTime=t.window.startTime,n.endTime=t.window.endTime),t.activeConversationId&&(n.conversationId=t.activeConversationId);let{data:r,error:i}=await x({path:{assistant_id:e},body:n,parseAs:`blob`,throwOnError:!1});if(i||!(r instanceof Blob))return null;let a=await r.arrayBuffer();return new Uint8Array(a)}catch{return null}}async function U(){if(!S.isNativePlatform())return null;try{let{App:e}=await o(async()=>{let{App:e}=await import(`./esm-RwtNn1Lo.js`);return{App:e}},__vite__mapDeps([0,1,2])),{id:t,name:n,version:r,build:i}=await e.getInfo();return{id:t,name:n,version:r,build:i}}catch{return null}}async function me(e,t,n,r={}){if(typeof CompressionStream>`u`)return null;let{diagnosticsProvider:i,doctorSessionId:a,extraLogFiles:o=[]}=r,s=new Date,c=A.find(t=>t.value===e),l=s.getTime(),u=c?.cutoffMs==null?null:l-c.cutoffMs,ee=u==null?null:new Date(u).toISOString(),d=null;try{d=i?.()??null}catch{d=null}let te=C(d),ne={collected_at:s.toISOString(),time_range:e,cutoff:ee,log_window:{start_time_ms:u,end_time_ms:l},assistant_id:t,active_conversation_id:n,doctor_session_id:a??null,client_version:null,native_app:await U(),user_agent:typeof navigator<`u`?navigator.userAgent:``,language:typeof navigator<`u`?navigator.language:``,platform:typeof navigator<`u`?navigator.platform:``,url:typeof window<`u`?window.location.href:``,viewport:typeof window<`u`?{width:window.innerWidth,height:window.innerHeight}:null,screen:typeof screen<`u`?{width:screen.width,height:screen.height}:null,connection:typeof navigator<`u`&&`connection`in navigator?{effectiveType:navigator.connection.effectiveType,downlink:navigator.connection.downlink,rtt:navigator.connection.rtt}:null,deviceMemory:typeof navigator<`u`&&`deviceMemory`in navigator?navigator.deviceMemory:null,hardwareConcurrency:typeof navigator<`u`?navigator.hardwareConcurrency:null},f=new TextEncoder,p=f.encode(JSON.stringify(ne,null,2)),re=f.encode(JSON.stringify(te,null,2)),m=[V(`web-client-context.json`,p),V(`web-chat-diagnostics.json`,re)],h=new TextEncoder().encode(JSON.stringify(E(),null,2));m.push(V(`web-debug-flags.json`,h));for(let e of o){let t=e.contents.trim();t&&m.push(V(e.filename,f.encode(t)))}try{let e=typeof window<`u`?window._vellumDebug?.chat:null;if(e){let t=e.getClientMessages?.()??null,n={clientMessages:t,transcriptItems:B(e.getTranscriptItems?.()??null,t),pendingInteractions:e.listPendingInteractions?.()??null,thinkingIndicator:e.thinkingIndicator?.()??null,streamingRing:e.streamingRing?.()??null,reconciliationDiagnostics:e.getReconciliationDiagnostics?.()??null},r=new TextEncoder().encode(JSON.stringify(z(n),null,2));m.push(V(`web-chat-debug-api-triage.json`,r))}}catch{}try{let e=typeof window<`u`?window._vellumDebug?.events:null;if(e){let t={focus:typeof document<`u`?{hasFocus:typeof document.hasFocus==`function`?document.hasFocus():null,visibilityState:document.visibilityState}:null,clients:e.getClients().map(({abortSignal:e,...t})=>({...t,aborted:e.aborted})),events:e.getEvents()},n=new TextEncoder().encode(JSON.stringify(z(t),null,2));m.push(V(`web-sse-liveness-triage.json`,n))}}catch{}if(y()&&window.vellum?.feedback){try{let e=await window.vellum.feedback.diagnostics(),t=new TextEncoder().encode(JSON.stringify(e,null,2));m.push(V(`electron-diagnostics.json`,t))}catch{}try{let e=await window.vellum.feedback.logs();if(e){let t=new TextEncoder().encode(e);m.push(V(`electron-main-logs.txt`,t))}}catch{}}if(t){let e=await H(t,{window:{startTime:u,endTime:l},activeConversationId:n});e&&m.push(V(`platform-logs.tar.gz`,e))}m.push(new Uint8Array(1024));let ie=m.reduce((e,t)=>e+t.length,0),g=new Uint8Array(ie),_=0;for(let e of m)g.set(e,_),_+=e.length;let v=new Blob([g.buffer]),b=await new Response(v.stream().pipeThrough(new CompressionStream(`gzip`))).blob();return new File([b],`web-client-logs-${s.getTime()}.tar.gz`,{type:`application/gzip`})}function W({open:e,onClose:t,initialReason:n,initialMessage:r,onSubmitted:o,assistantId:c,assistantVersion:l,activeConversationId:d,doctorSessionId:f,doctorSessionLog:b,getDiagnosticsSnapshot:x}){let S=ae.use.user(),C=S?.email,ce=S?.isStaff??!1,T=(0,w.useId)(),E=(0,w.useRef)(null),D=(0,w.useRef)(null),A=(0,w.useRef)(null),j=(0,w.useRef)(null),[M,P]=(0,w.useState)(n??`bug_report`),[F,I]=(0,w.useState)(``),[L,R]=(0,w.useState)(``),[z,B]=(0,w.useState)(k.find(e=>e.value===(n??`bug_report`))?.includesLogsByDefault??!0),[V,H]=(0,w.useState)(!1),[U,W]=(0,w.useState)(`past_hour`),[G,K]=(0,w.useState)([]),[_e,q]=(0,w.useState)(null),[ve,J]=(0,w.useState)(!1),[Y,ye]=(0,w.useState)(!1),[X,be]=(0,w.useState)(!1),Z=s(oe()),[xe,Q]=(0,w.useState)(!1),$=Z.isPending||xe,Se=!C,Ce=(0,w.useMemo)(()=>F.trim().length>0&&L.trim().length>0,[F,L]);(0,w.useEffect)(()=>{if(!e)return;let t=n??`bug_report`;P(t),I(r??``),R(C??``),B(k.find(e=>e.value===t)?.includesLogsByDefault??!0),H(!1),W(`past_hour`),K([]),ye(!1),be(!1),q(null),Q(!1),Z.reset();let i=setTimeout(()=>{C?A.current?.focus():j.current?.focus()},50);return()=>clearTimeout(i)},[e]),(0,w.useEffect)(()=>{if(!e)return;let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=t}},[e]);let we=e=>{P(e),V||B(k.find(t=>t.value===e)?.includesLogsByDefault??!1)},Te=()=>{B(e=>!e),H(!0)},Ee=b?.trim()?[{filename:`doctor-session.txt`,contents:b}]:[],De=(0,w.useCallback)(e=>{e.key===`Escape`&&!e.defaultPrevented&&!$&&(e.preventDefault(),t())},[t,$]),Oe=(0,w.useCallback)(e=>{e.target===E.current&&!$&&t()},[t,$]),ke=(0,w.useCallback)(e=>{K(t=>{let n=N-t.length;if(n<=0)return t;let r=new Set(t.map(e=>`${e.name}:${e.size}`)),i=[];for(let t of e){if(i.length>=n)break;if(!pe(t))continue;let e=`${t.name}:${t.size}`;r.has(e)||(r.add(e),i.push(t))}return i.length>0?[...t,...i]:t})},[]),Ae=e=>{e.target.files&&ke(Array.from(e.target.files)),e.target.value=``},je=e=>{e.preventDefault(),J(!1),e.dataTransfer.files?.length&&ke(Array.from(e.dataTransfer.files))},Me=e=>{e.preventDefault(),J(!0)},Ne=e=>{e.preventDefault(),e.currentTarget===e.target&&J(!1)},Pe=e=>{K(t=>t.filter((t,n)=>n!==e))};return e?(0,se.createPortal)((0,O.jsx)(`div`,{ref:E,role:`dialog`,"aria-modal":`true`,"aria-labelledby":T,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onKeyDown:De,onClick:Oe,onDrop:je,onDragOver:Me,onDragLeave:Ne,children:(0,O.jsxs)(`div`,{className:`mx-4 flex w-full max-w-lg flex-col rounded-xl border p-6 shadow-xl`,style:{backgroundColor:`var(--surface-lift)`,borderColor:`var(--border-base)`,maxHeight:`calc(100vh - 2rem)`},children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-4`,style:{borderColor:`var(--border-subtle)`},children:[(0,O.jsx)(`h2`,{id:T,className:`!m-0 text-title-small text-[var(--content-default)]`,children:`Share Feedback`}),(0,O.jsx)(a,{variant:`ghost`,iconOnly:(0,O.jsx)(m,{}),onClick:t,disabled:$,"aria-label":`Close`,tintColor:`var(--content-secondary)`})]}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-3.5 overflow-y-auto pt-4 ${$?`pointer-events-none opacity-60`:``}`,children:[ce&&(0,O.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-2.5`,children:[(0,O.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3`,children:[(0,O.jsx)(_,{checked:X,onChange:()=>be(e=>!e),"aria-label":`Download diagnostics directly`}),(0,O.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Download diagnostics directly`})]}),(0,O.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Admin only — builds the diagnostics archive locally and downloads it instead of submitting feedback or notifying Slack.`})]}),X?(0,O.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,O.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Time range`}),(0,O.jsx)(v,{options:le,value:U,onChange:W,"aria-label":`Diagnostics time range`})]}):(0,O.jsxs)(O.Fragment,{children:[Se&&(0,O.jsx)(g,{id:`${T}-email`,ref:j,label:`Email`,type:`email`,placeholder:`you@example.com`,value:L,onChange:e=>R(e.target.value),leftIcon:(0,O.jsx)(ne,{className:`h-4 w-4`,"aria-hidden":!0}),fullWidth:!0}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,O.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Category`}),(0,O.jsx)(`div`,{className:`flex gap-2`,children:k.map(e=>(0,O.jsx)(he,{option:e,isSelected:M===e.value,onSelect:()=>we(e.value)},e.value))})]}),(0,O.jsx)(`hr`,{className:`border-[var(--border-subtle)]`}),M===`bug_report`&&(0,O.jsxs)(h,{tone:`info`,children:[`Tip: Get faster support by posting in our`,` `,(0,O.jsx)(`a`,{href:`https://vellum.ai/community`,target:`_blank`,rel:`noopener noreferrer`,className:`underline text-[var(--content-default)]`,children:`Discord community`})]}),M===`feature_request`&&(0,O.jsxs)(h,{tone:`info`,children:[`Tip: Vote on features on our`,` `,(0,O.jsx)(`a`,{href:`https://vellum.ai/roadmap`,target:`_blank`,rel:`noopener noreferrer`,className:`underline text-[var(--content-default)]`,children:`public roadmap`})]}),(0,O.jsx)(ie,{id:`${T}-message`,ref:A,label:M===`bug_report`?`What went wrong?`:M===`feature_request`?`Describe your idea`:`What's on your mind?`,rows:3,placeholder:M===`bug_report`?`What did you expect to happen, and what happened instead?`:M===`feature_request`?`What problem would this solve for you?`:`Share your thoughts...`,value:F,onChange:e=>I(e.target.value),fullWidth:!0}),M!==`feature_request`&&(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,O.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5`,children:[(0,O.jsx)(_,{checked:z,onChange:Te,"aria-label":`Include browser diagnostics`}),(0,O.jsx)(`span`,{className:`text-body-medium-lighter leading-6 text-[var(--content-default)]`,children:`Include diagnostics`})]}),(0,O.jsx)(i,{content:`Diagnostics include browser context, assistant logs, and timestamps — never passwords or credentials.`,children:(0,O.jsx)(`button`,{type:`button`,"aria-label":`About diagnostics`,className:`inline-flex items-center justify-center text-[var(--content-tertiary)]`,children:(0,O.jsx)(ee,{className:`h-3.5 w-3.5`})})})]}),z&&(0,O.jsx)(v,{options:le,value:U,onChange:W,"aria-label":`Diagnostics time range`})]}),y()&&d&&M!==`feature_request`&&(0,O.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5`,children:[(0,O.jsx)(_,{checked:Y,onChange:()=>ye(e=>!e),"aria-label":`Include the most recent conversation`}),(0,O.jsx)(`span`,{className:`text-body-medium-lighter leading-6 text-[var(--content-default)]`,children:`Include the most recent conversation`})]}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:[`Attachments`,G.length>0&&(0,O.jsxs)(`span`,{className:`text-[var(--content-tertiary)]`,children:[` · `,G.length,`/`,N]})]}),(0,O.jsx)(a,{variant:`outlined`,size:`compact`,leftIcon:(0,O.jsx)(p,{}),onClick:()=>D.current?.click(),disabled:G.length>=N,children:`Add files`}),(0,O.jsx)(`input`,{ref:D,type:`file`,multiple:!0,accept:`image/png,image/jpeg,image/gif,image/webp,video/mp4,video/quicktime,video/webm`,onChange:Ae,className:`hidden`})]}),G.length>0&&(0,O.jsx)(`div`,{className:`flex gap-2 overflow-x-auto`,children:G.map((e,t)=>(0,O.jsx)(ge,{file:e,onRemove:()=>Pe(t)},`${e.name}-${t}`))}),ve&&(0,O.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Drop files to attach…`})]})]}),_e&&(0,O.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:_e})]}),(0,O.jsx)(`div`,{className:`mt-4 flex items-center justify-end gap-2 border-t pt-4`,style:{borderColor:`var(--border-subtle)`},children:$?(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,O.jsx)(te,{className:`h-4 w-4 animate-spin`}),X?`Preparing diagnostics…`:`Sending feedback…`]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(a,{variant:`ghost`,onClick:t,children:`Cancel`}),X?(0,O.jsx)(a,{variant:`primary`,leftIcon:(0,O.jsx)(u,{}),onClick:async()=>{if(!$){q(null),Q(!0);try{let e=await me(U,c??null,y()?Y?d??null:null:d??null,{diagnosticsProvider:x,doctorSessionId:f,extraLogFiles:Ee});if(!e){q(`Diagnostics export isn't supported in this browser.`);return}let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=e.name,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),0),t()}catch(e){q(e instanceof Error?e.message:`Failed to build diagnostics. Please try again.`)}finally{Q(!1)}}},children:`Download diagnostics`}):(0,O.jsx)(a,{variant:`primary`,leftIcon:(0,O.jsx)(re,{}),onClick:async()=>{if(!(!Ce||$)){q(null),Q(!0);try{let e=z&&M!==`feature_request`?await me(U,c??null,y()?Y?d??null:null:d??null,{diagnosticsProvider:x,doctorSessionId:f,extraLogFiles:Ee}):null,n=de(),r=t=>Z.mutateAsync({headers:{"Content-Type":null},body:{message:F.trim(),classification:ue[M],email:L.trim(),client:t,client_version:void 0,...c?{assistant_id:c}:{},...l?{assistant_version:l}:{},...f?{doctor_session_id:f}:{},...e?{logs_file:e}:{},...G.length?{attachments:G}:{}},bodySerializer:e=>{let t=new FormData;for(let[n,r]of Object.entries(e))if(r!=null){if(n===`attachments`&&Array.isArray(r)){for(let e of r)t.append(`attachments`,e);continue}r instanceof Blob?t.append(n,r):t.append(n,String(r))}return t}});try{await r(n)}catch(e){if(n!==`android`||!fe(e))throw e;await r(`web`)}o?.(),t()}catch(e){q(e instanceof Error?e.message:`Failed to submit feedback. Please try again.`)}finally{Q(!1)}}},disabled:!Ce,children:`Submit`})]})})]})}),document.body):null}function he({option:e,isSelected:t,onSelect:n}){let r=e.icon;return(0,O.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,className:`flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-left transition-colors`,style:{borderColor:t?`var(--primary-base)`:`var(--border-base)`,backgroundColor:t?`color-mix(in oklab, var(--primary-base) 10%, transparent)`:`transparent`},children:[(0,O.jsx)(r,{className:`h-3.5 w-3.5 shrink-0`,style:{color:t?`var(--primary-base)`:`var(--content-secondary)`}}),(0,O.jsx)(`span`,{className:`text-body-small-default`,style:{color:t?`var(--primary-base)`:`var(--content-default)`},children:e.label})]})}function ge({file:e,onRemove:t}){let n=e.type.startsWith(`image/`),r=(0,w.useMemo)(()=>n?URL.createObjectURL(e):null,[e,n]);return(0,w.useEffect)(()=>{if(r)return()=>URL.revokeObjectURL(r)},[r]),(0,O.jsxs)(`div`,{className:`relative flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)]`,title:e.name,children:[n&&r?(0,O.jsx)(`img`,{src:r,alt:e.name,className:`h-full w-full object-cover`}):(0,O.jsx)(p,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,O.jsx)(a,{variant:`ghost`,size:`compact`,iconOnly:(0,O.jsx)(m,{}),onClick:t,"aria-label":`Remove ${e.name}`,className:`absolute top-0.5 right-0.5 h-4 w-4 rounded-full bg-black/60 text-white hover:bg-black/70`,tintColor:`#fff`})]})}export{D as n,W as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-BENY-yx_.js";import{d as r,t as i,u as a}from"./chunk-5KNZJZUH-BUqIilZr.js";import{t as o}from"./jsx-runtime-D3ZM-ToX.js";import{t as s}from"./typography-BeUa5Fd-.js";import{t as c}from"./arrow-left-BikDV6F2.js";import{t as l}from"./chevron-right-DBGgpEiZ.js";import{
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-BENY-yx_.js";import{d as r,t as i,u as a}from"./chunk-5KNZJZUH-BUqIilZr.js";import{t as o}from"./jsx-runtime-D3ZM-ToX.js";import{t as s}from"./typography-BeUa5Fd-.js";import{t as c}from"./arrow-left-BikDV6F2.js";import{t as l}from"./chevron-right-DBGgpEiZ.js";import{l as u}from"./src-DyqTPMO2.js";import{n as d,t as f}from"./runtime-upgrade-banner-DtzsX2m0.js";import{t as p}from"./is-electron-BHXrkjI3.js";import{c as m}from"./platform-detection-C_TK32Dw.js";import{d as h}from"./routes-iipg2wkc.js";import{n as g}from"./use-is-mobile-BP8UePsY.js";import{t as _}from"./use-edge-swipe-back-BGq52vVr.js";import{t as v}from"./link-click-DVtp4tRV.js";var y=e(t(),1),b=`data-page-transition`,x=400,S;function C(){return typeof document<`u`&&typeof document.startViewTransition==`function`}function w(){return m()&&C()}function T(e,t,n,r){if(!w()){e(t,r);return}document.documentElement.setAttribute(b,n),S!==void 0&&clearTimeout(S),S=setTimeout(()=>{S=void 0,document.documentElement.removeAttribute(b)},x),e(t,{...r,viewTransition:!0})}var E=o();function D({sidebar:e,children:t,actions:o,backHref:l,title:u=`Settings`,menuRoute:m=h.settings.root}){let{pathname:v}=a(),b=r(),x=v===m,S=g(),C=(0,y.useRef)(null),w=(0,y.useRef)(null);(0,y.useLayoutEffect)(()=>{w.current?.scrollTo(0,0)},[v]);let D=x?l:m;_({containerRef:C,onBack:(0,y.useCallback)(()=>{b(D)},[b,D]),enabled:S,navKey:v,prefetchHref:D});let O=p(),k=x?`Back from ${u}`:`Back to ${u} menu`,A=(0,E.jsx)(n,{variant:`ghost`,iconOnly:(0,E.jsx)(c,{}),"aria-label":k,tintColor:`var(--content-secondary)`,onClick:()=>T(b,D,`pop`)}),j=(0,E.jsx)(n,{asChild:!0,variant:`outlined`,"aria-label":`Back from ${u}`,className:`h-8 w-8 px-0`,tintColor:`var(--content-secondary)`,children:(0,E.jsx)(i,{to:l,className:`flex items-center justify-center no-underline`,children:(0,E.jsx)(c,{size:16,"aria-hidden":`true`})})});return(0,E.jsxs)(`div`,{ref:C,className:`flex h-full min-h-0 w-full flex-1 flex-col gap-4 p-4 sm:p-6 md:gap-0`,style:{paddingTop:O?`3.75rem`:`1rem`},children:[(0,E.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 md:hidden`,children:[A,(0,E.jsx)(s,{as:`h1`,variant:`body-large-default`,className:`flex-1 truncate text-center`,style:{color:`var(--content-tertiary)`,lineHeight:1.4},children:u}),(0,E.jsx)(`div`,{className:`h-10 w-10 shrink-0`,"aria-hidden":`true`})]}),O?(0,E.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 pb-4 empty:hidden`,children:[(0,E.jsx)(d,{placement:`electron`,className:`px-0 pt-0`}),(0,E.jsx)(f,{placement:`electron`,className:`px-0 pt-0`})]}):null,(0,E.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden md:rounded-[12px] md:border md:border-[var(--border-base)] md:bg-[var(--surface-overlay)]`,children:[(0,E.jsxs)(`div`,{className:`hidden shrink-0 items-center justify-between gap-4 px-6 py-5 md:flex`,children:[(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[j,(0,E.jsx)(`h1`,{className:`text-title-large truncate`,style:{color:`var(--content-emphasised)`,lineHeight:1.2},children:u})]}),(0,E.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:o})]}),(0,E.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[(0,E.jsx)(`aside`,{className:`hidden w-64 shrink-0 overflow-y-auto md:block`,"aria-label":`${u} navigation`,children:e}),x?(0,E.jsx)(`div`,{className:`flex min-w-0 min-h-0 flex-1 flex-col overflow-y-auto overflow-x-hidden pb-6 md:hidden`,children:e}):null,(0,E.jsx)(`main`,{ref:w,className:`min-w-0 min-h-0 flex-1 flex-col gap-4 overflow-y-auto overflow-x-hidden pb-6 md:flex md:px-6 md:pt-0 ${x?`hidden`:`flex`}`,children:t})]})]})]})}function O({items:e,bottomItems:t,indexPath:n}){let{pathname:i}=a(),o=r(),s=g(),c=(e,t,r)=>{let{href:a,onSelect:c}=e,d=a!=null&&(i===a||i.startsWith(a+`/`)||!s&&r&&n!=null&&i===n);return(0,E.jsxs)(y.Fragment,{children:[(0,E.jsx)(u.Item,{icon:e.icon,label:e.label,active:d,trailingIcon:a==null?void 0:l,trailingIconClassName:a==null?void 0:`md:hidden`,href:a,onSelect:c,onClick:a==null?void 0:e=>{v(e)||(e.preventDefault(),T(o,a,`push`))}}),!t&&(0,E.jsx)(`div`,{role:`presentation`,"aria-hidden":!0,className:`my-2 h-px w-full bg-[var(--border-base)] md:hidden`})]},e.id)};return(0,E.jsxs)(`nav`,{"aria-label":`Sidebar navigation`,className:`flex min-h-full flex-col md:gap-2 md:px-6 md:pb-4`,children:[e.map((n,r)=>c(n,r===e.length-1&&!t?.length,r===0)),t&&t.length>0&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`div`,{className:`flex-1`}),(0,E.jsx)(`div`,{role:`presentation`,"aria-hidden":!0,className:`mx-0 my-2 h-px w-full bg-[var(--border-base)] md:mx-0`}),t.map((e,n)=>c(e,n===t.length-1,!1))]})]})}export{D as n,O as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./jsx-runtime-D3ZM-ToX.js";import{E as r}from"./platform-detection-C_TK32Dw.js";import{n as i,r as a}from"./login-flow-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./jsx-runtime-D3ZM-ToX.js";import{E as r}from"./platform-detection-C_TK32Dw.js";import{n as i,r as a}from"./login-flow-CN5J4YsY.js";import{t as o}from"./proxy-B4sTDdE4.js";import{t as s}from"./AnimatePresence-D41IKJOi.js";import{t as c}from"./apple-logo-Dz_HmP0n.js";import{n as l,t as u}from"./use-return-to-short-circuit-Dm5PWev2.js";import{t as d}from"./signup-shell-B_xxhiVU.js";var f=e(t(),1),p=n();function m({words:e}){let[t,n]=(0,f.useState)(0),r=(0,f.useMemo)(()=>e.reduce((e,t)=>e.length>=t.length?e:t),[e]);return(0,f.useEffect)(()=>{let t=setInterval(()=>{n(t=>(t+1)%e.length)},2400);return()=>clearInterval(t)},[e.length]),(0,p.jsxs)(`span`,{className:`signup__rotating`,children:[(0,p.jsxs)(`span`,{className:`signup__rotating-sizer`,"aria-hidden":!0,children:[r,`.`]}),(0,p.jsx)(s,{mode:`wait`,children:(0,p.jsxs)(o.em,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},exit:{opacity:0,y:-16},transition:{duration:.3,ease:`easeInOut`},children:[e[t],`.`]},e[t])})]})}var h=[`Personal Intelligence`,`Software Engineer`,`Finance Ops`,`Household Manager`,`GTM Engineer`,`Product Lead`];function g({returnTo:e}){let[t,n]=(0,f.useState)(null),o=a(e,{authIntent:`signup`});return(0,p.jsxs)(d,{children:[(0,p.jsxs)(`h1`,{className:`signup__title`,children:[`Meet your new`,(0,p.jsx)(`br`,{}),(0,p.jsx)(m,{words:h})]}),(0,p.jsx)(`p`,{className:`signup__subtitle`,children:`The most powerful assistant that can handle your work and life admin tasks.`}),(0,p.jsx)(`div`,{className:`signup__buttons`,children:(0,p.jsx)(`button`,{type:`button`,className:`signup__btn`,onClick:()=>{n(null),r(i,o,{returnTo:e,intent:`signup`}).catch(e=>{console.error(`[signup] auth flow failed:`,e),n(`Something went wrong. Please try again.`)})},children:`Continue`})}),t&&(0,p.jsx)(`p`,{className:`signup__error`,children:t}),(0,p.jsxs)(`p`,{className:`signup__footer`,children:[`Already have an account?`,` `,(0,p.jsx)(`button`,{type:`button`,className:`signup__link`,onClick:()=>{n(null),r(i,a(e),{returnTo:e}).catch(e=>{console.error(`[signup] sign-in flow failed:`,e),n(`Something went wrong. Please try again.`)})},children:`Sign in`})]}),(0,p.jsxs)(`a`,{className:`signup__download`,href:`/downloads`,children:[(0,p.jsx)(c,{size:16}),`Download for macOS`]})]})}function _(){let e=u();return e.kind===`wait`?(0,p.jsx)(d,{children:(0,p.jsx)(l,{})}):e.kind===`redirect`?e.node:(0,p.jsx)(g,{returnTo:e.returnTo})}export{_ as SignupPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{n}from"./button-BENY-yx_.js";import{t as r}from"./jsx-runtime-D3ZM-ToX.js";import{t as i}from"./typography-BeUa5Fd-.js";import{C as a,S as o,T as s,o as c,s as l,w as u}from"./message-content-Beh5mR15.js";import{t as d}from"./brain-ZiC0HCCF.js";import{t as f}from"./check-DSgjgwlo.js";import{t as p}from"./circle-check-q8BVdbgw.js";import{t as m}from"./code-DwZ6Mhdw.js";import"./src-hNk11eS3.js";import{t as h}from"./file-text-DDbRSMUn.js";import{t as g}from"./globe-COk-NH9x.js";import{t as _}from"./monitor-CPgcKlQP.js";import{t as v}from"./sparkles-B94iNYGJ.js";import{t as ee}from"./user-plus-DAap8I1c.js";import{t as y}from"./popover-CAbJ9178.js";import{D as b,O as te}from"./chat-DYLliWTB.js";import{t as x}from"./misc-Z0jXGGeY.js";import{t as ne}from"./proxy-B4sTDdE4.js";import{t as re}from"./AnimatePresence-D41IKJOi.js";import{t as S}from"./use-reduced-motion-CaGZSwLZ.js";import{t as C}from"./three-dot-indicator-BQxSg8G2.js";var w=e(t(),1),T=r();function E(e){let t=e.trimStart();if(!t.startsWith(`**`))return e;let n=t.indexOf(`**`,2);if(n===-1)return t.slice(2).trimStart();let r=t.slice(2,n).trim();return r.length>0?r:e}var ie=/^https?:\/\/\S+/,ae=/^URL:\s*(https?:\/\/\S+)/i,oe=/^\[\d+\]\s*(https?:\/\/\S+)/;function D(e){try{return new URL(e).hostname.replace(/^www\./,``)}catch{return``}}function se(e){let t=e.trim();return ae.exec(t)?.[1]??oe.exec(t)?.[1]??t}function ce(e){return e.trim().replace(/^\d+\.\s+/,``)}function le(e){let t=e.split(/\r?\n/),n=[],r=new Set,i=``;for(let e of t){let t=e.trim();if(!t){i=``;continue}let a=se(t);if(ie.test(a)){r.has(a)||(r.add(a),n.push({title:i,url:a})),i=``;continue}/^Web search results for /i.test(t)||/^Sources:?$/i.test(t)||(i=ce(t))}return n}function O(e){return!e||!e.trim()?[]:le(e).map((e,t)=>{let n=D(e.url);return{rank:t+1,title:e.title,url:e.url,domain:n}})}var ue=5,de=new Set([`web_search`,`web_fetch`]);function k(e){if(!Number.isFinite(e)||e<1e3)return`<1s`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.round(t/60);return n<60?`${n}m`:`${Math.round(n/60)}h`}function A(e){return de.has(e.name)}function j(e){return e?`Searched the web`:`Searching the web`}function M(e){return{visible:e.slice(0,ue),overflowResults:e.slice(ue)}}function fe(e,t){let{visible:n,overflowResults:r}=M(e.results);return{kind:`web_search`,title:j(t),durationLabel:k(e.durationMs),linkCount:e.resultCount,results:n,overflowResults:r}}function pe(e){let t=e.title??e.domain;return{kind:`thinking`,durationLabel:k(e.durationMs),text:`Reading ${t}`}}function me(){return{kind:`web_search`,title:`Searching the web`,durationLabel:``,linkCount:0,results:[]}}function he(){return{kind:`thinking`,durationLabel:``,text:`Reading…`}}function ge(e){let t=O(e);if(t.length===0)return null;let{visible:n,overflowResults:r}=M(t);return{kind:`web_search`,title:j(!0),durationLabel:``,linkCount:t.length,results:n,overflowResults:r}}function _e(e){return{kind:`web_search_error`,title:`Web search failed`,durationLabel:k(e.durationMs),errorMessage:e.errorMessage??`Search is having trouble right now. You can try again in a moment, continue without web search, or paste the relevant details here and I'll use those.`}}function N(){return{kind:`web_search`,title:j(!0),durationLabel:``,linkCount:0,results:[]}}function P(e,t){return t[e.id]??e.activityMetadata}function F(e){return!b(e)}function I(e,t){return e.results.length>0?!1:!!e.errorMessage||!!t.isError}function L(e){return e.confirmationDecision===`denied`||e.confirmationDecision===`timed_out`?`denied`:e.isError?`error`:b(e)?`running`:`completed`}function R(e,t){return e==null||t==null?null:Math.max(0,t-e)}function z(e,t){let n=R(e,t);return n==null?``:k(n)}function B(e){return z(e.startedAt??void 0,e.completedAt??void 0)}function ve(e){return!c(e)&&b(e)}function ye(e,t){if(e.kind===`thinking`)return e.text?e.completedAt==null?e.startedAt!=null&&t!=null?Math.max(0,t-e.startedAt):null:R(e.startedAt,e.completedAt):null;let n=e.toolCall;if(c(n))return null;let r=te(n);return n.completedAt==null?b(n)&&r!=null&&t!=null?Math.max(0,t-r):null:R(r,n.completedAt)}function be(e){return e.some(e=>e.kind===`thinking`?!!e.text&&e.startedAt!=null&&e.completedAt==null:ve(e.toolCall))}function xe(e,t){let n=0,r=!1;for(let i of e){let e=ye(i,t);e!=null&&(r=!0,n+=e)}return r?k(n):``}function Se(e){let{title:t,activity:n}=l(e);return{toolCallId:e.id,toolName:e.name,title:t,activity:n,input:e.input??{},result:e.result,streamedOutput:e.streamedOutput,status:L(e),riskLevel:e.riskLevel,riskReason:e.riskReason,durationLabel:B(e)}}function Ce(e){let{title:t,info:n,activity:r,iconName:i}=l(e);return{kind:`tool`,durationLabel:B(e),startedAt:e.startedAt??void 0,title:t,info:n,activity:r,riskLevel:e.riskLevel,iconName:i,toolCallId:e.id,status:L(e)}}function we(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(A(r)){let e=P(r,t),n=F(r);if(e?.webSearch&&I(e.webSearch,r))return`Web search failed`;if(r.name===`web_search`)return j(n);if(r.name===`web_fetch`)return`Thinking`}else return l(r).title}return``}function Te(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(!A(r)){let{info:e,activity:t}=l(r);return t||e}let i=P(r,t),a=F(r);if(i?.webSearch){let e=i.webSearch;if(I(e,r))return e.errorMessage??`Search is having trouble right now. You can try again in a moment, continue without web search, or paste the relevant details here and I'll use those.`;if(e.results.length>0)return e.results[e.results.length-1].title;if(!a&&e.query)return`Searching ${e.query}`}if(i?.webFetch){let e=i.webFetch;return a?e.title??e.domain:`Reading ${e.domain}`}if(r.name===`web_search`){if(!a){let e=typeof r.input?.query==`string`?r.input.query.trim():``;return e?`Searching ${e}`:``}if(typeof r.result==`string`){let e=O(r.result);if(e.length>0){let t=e[e.length-1].title;if(t)return t}}}if(r.name===`web_fetch`){let e=typeof r.input?.url==`string`?r.input.url:``,t=e?D(e):``;if(t)return a?t:`Reading ${t}`}}return``}function Ee(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(r.name!==`web_search`)continue;let i=P(r,t)?.webSearch?.results;if(i&&i.length>0)return i}return[]}function De(e){return e.includes(`denied`)?`denied`:e.includes(`loading`)?`loading`:e.includes(`error`)?`error`:`complete`}function Oe(e){return De(e.map(e=>e.confirmationDecision===`denied`||e.confirmationDecision===`timed_out`?`denied`:b(e)?`loading`:e.isError?`error`:`complete`))}function ke(e,t){if(c(e))return null;if(!A(e))return Ce(e);let n=P(e,t),r=F(e);if(n?.webSearch){let t=n.webSearch;return I(t,e)?_e(t):fe(t,r)}return n?.webFetch?pe(n.webFetch):r?e.name===`web_search`&&typeof e.result==`string`?ge(e.result)??N():N():e.name===`web_search`?me():he()}function Ae(e,t,n){let r=e.filter(e=>e.kind===`toolCall`).map(e=>e.toolCall).filter(e=>!c(e)),i=[],a=null,o=0;for(let n of e){if(n.kind===`thinking`){n.text&&(i.push({kind:`thinking`,durationLabel:z(n.startedAt,n.completedAt),text:n.text,startedAt:n.startedAt,completedAt:n.completedAt,thinkingItemIndex:o++}),a=n.text);continue}let e=ke(n.toolCall,t);e&&(i.push(e),a=null)}let s=Oe(r),l,u,d;a===null?(l=we(r,t),u=Te(r,t),d=`tool`):(l=`Thinking`,u=E(a),d=`thinking`);let f=Ee(r,t),p=`${i.length} step${i.length===1?``:`s`}`,m=xe(e,n);return{currentStepTitle:l,currentStepInfo:u,currentStepKind:d,stepCount:p,totalDurationLabel:m,steps:i,state:s,carouselItems:f}}var je=.44;function Me(e,t){let n=[...e].sort((e,t)=>e.position-t.position),r=n[0]?.color??`white`,i=n[n.length-1]?.color??`white`,a=n.map(e=>{let t=(e.position-.5)*2*je;return`${e.color} calc(50% + var(--gs-spread-mid) * ${t.toFixed(4)})`}).join(`, `);return[`linear-gradient(${t}deg`,`var(--gs-base) calc(50% - var(--gs-spread))`,`color-mix(in oklab, var(--gs-base) 42%, ${r}) calc(50% - var(--gs-spread-mid))`,a,`color-mix(in oklab, var(--gs-base) 42%, ${i}) calc(50% + var(--gs-spread-mid))`,`var(--gs-base) calc(50% + var(--gs-spread)))`].join(`, `)}function Ne(e){let t=`color-mix(in srgb, ${e} 40%, white)`;return[{position:0,color:t},{position:.5,color:e},{position:1,color:t}]}var Pe=`var(--avatar-accent, var(--content-emphasised))`,Fe=`color-mix(in srgb, currentColor 45%, transparent)`,Ie=1500,Le=106,V=6,H=48,U=.72,W=14,Re=96;function ze(){return typeof CSS>`u`||typeof CSS.supports!=`function`?!1:CSS.supports(`background-clip`,`text`)||CSS.supports(`-webkit-background-clip`,`text`)}function G({children:e,colorHex:t,className:n,"data-testid":r}){let i=(0,w.useRef)(null),a=S(),o=t??Pe,s=(0,w.useMemo)(()=>Me(Ne(o),Le),[o]);(0,w.useLayoutEffect)(()=>{let t=i.current;if(!t)return;if(!ze()){t.style.removeProperty(`background-image`),t.style.removeProperty(`background-color`),t.style.removeProperty(`-webkit-text-fill-color`);return}if(a||typeof t.animate!=`function`)return;let n=null,r=()=>{let r=t.getBoundingClientRect().width||Re,i=(Number.parseFloat(getComputedStyle(t).fontSize)||W)/W,a=Math.min(e.length*V*i,H*i),o=Math.max(1,r+a*2);t.style.setProperty(`--gs-spread`,`${a}px`),t.style.setProperty(`--gs-spread-mid`,`${a*U}px`),t.style.backgroundSize=`${o}px 100%`,n?.cancel(),n=t.animate([{backgroundPosition:`0px center`},{backgroundPosition:`${o}px center`}],{duration:Ie,easing:`linear`,iterations:1/0}),n.startTime=0};r();let o=typeof ResizeObserver>`u`?void 0:new ResizeObserver(r);return o?.observe(t),()=>{o?.disconnect(),n?.cancel()}},[e,a]);let c=Math.min(e.length*V,H);return(0,T.jsx)(`span`,{ref:i,className:n,style:{position:`relative`,display:`inline-block`,backgroundImage:s,backgroundRepeat:`repeat-x`,backgroundSize:`100% 100%`,backgroundColor:`var(--gs-base)`,WebkitBackgroundClip:`text`,backgroundClip:`text`,WebkitTextFillColor:`transparent`,"--gs-base":Fe,"--gs-spread":`${c}px`,"--gs-spread-mid":`${c*U}px`},"data-testid":r,children:e})}var Be=400;function Ve(e,t,n){let[r,i]=(0,w.useState)(e),a=(0,w.useRef)(null),o=(0,w.useRef)(null),s=(0,w.useRef)(null);return(0,w.useEffect)(()=>{if(Object.is(r,e)){o.current=null;return}if(n){s.current&&=(clearTimeout(s.current),null),o.current=null,i(e),a.current=Date.now();return}o.current=e;let c=Date.now();a.current===null&&(a.current=c);let l=c-a.current,u=Math.max(0,t-l);return s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{o.current!==null&&(i(o.current),a.current=Date.now(),o.current=null),s.current=null},u),()=>{s.current&&=(clearTimeout(s.current),null)}},[e,r,t,n]),r}function He({currentStepTitle:e,currentStepInfo:t,bypassDwell:n=!1,animationKey:r,shimmer:a=!1,inline:o=!1}){let s=S(),c=Ve((0,w.useMemo)(()=>({title:e,info:t}),[e,t]),Be,n),l=s?{duration:0}:{duration:.25,ease:[.16,1,.3,1]},u=s?{opacity:0}:{y:-16,opacity:0},d=s?{opacity:1}:{y:0,opacity:1},f=s?{opacity:0}:{y:16,opacity:0},p=typeof c.info==`string`||typeof c.info==`number`,m=p?String(c.info):c.info==null?``:`node`,h=r??`${c.title}::${m}`,g=p?c.info!==``:c.info!=null,_=c.title.trim()!==``,v=g?`block min-w-0`:`block min-w-0 flex-1`;return(0,T.jsx)(re,{initial:!1,mode:`popLayout`,children:(0,T.jsxs)(ne.span,{initial:u,animate:d,exit:f,transition:l,className:`flex min-w-0 flex-1 items-center gap-1`,children:[_?o?(0,T.jsx)(`span`,{className:`${v} truncate text-left text-[13px] font-medium leading-[16px] text-[var(--content-secondary)]`,children:a?(0,T.jsx)(G,{children:c.title}):c.title}):(0,T.jsx)(i,{variant:`body-medium-default`,className:`ml-1 ${v} truncate text-left text-[var(--content-emphasised)]`,children:a?(0,T.jsx)(G,{children:c.title}):c.title}):null,g?(0,T.jsxs)(T.Fragment,{children:[_?(0,T.jsx)(`span`,{"aria-hidden":`true`,className:`ml-1 h-3.5 w-px shrink-0 bg-[var(--border-element)]`}):null,p?o&&!_?(0,T.jsx)(`span`,{className:`block min-w-0 flex-1 truncate text-left text-[13px] font-medium leading-[16px] text-[var(--content-secondary)]`,children:a&&typeof c.info==`string`?(0,T.jsx)(G,{children:c.info}):c.info}):(0,T.jsx)(i,{variant:_?`body-small-default`:`body-medium-default`,className:`ml-1 block min-w-0 flex-1 truncate text-left leading-[16px] ${_?`text-[var(--content-tertiary)]`:`text-[var(--content-emphasised)]`}`,children:a&&!_&&typeof c.info==`string`?(0,T.jsx)(G,{children:c.info}):c.info}):(0,T.jsx)(`span`,{className:`ml-1 block min-w-0 flex-1`,children:c.info})]}):null]},h)})}var K={code:m,terminal:o,file:h,globe:g,pen:u,monitor:_,plug:a,sparkle:v,"user-plus":ee,bolt:s,brain:d};function Ue(e){if(e.kind===`thinking`)return`Thinking`;if(e.kind===`web_search`||e.kind===`web_search_error`)return`Searching the web`;if(e.kind===`tool_error`)return`Error`;let t=e.title;return t.startsWith(`Working`)?t:t===`Reading`||t===`Editing`||t.startsWith(`Running`)?`Working`:t===`Using a skill`?`Using a skill`:(t.startsWith(`Using `),t)}function We(e){if(!e||e===`<1s`)return 0;let t=/^(\d+)(s|m|h)$/.exec(e);if(!t)return 0;let n=Number(t[1]);switch(t[2]){case`h`:return n*36e5;case`m`:return n*6e4;default:return n*1e3}}function Ge(e){let t=null;for(let n of e)(n.kind===`tool`||n.kind===`thinking`)&&n.startedAt!=null&&(t=t==null?n.startedAt:Math.min(t,n.startedAt));return t}function Ke(e){return new Date(e).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`,second:`2-digit`})}function qe({durationLabel:e,startedAt:t}){let r=(0,T.jsx)(i,{variant:`label-medium-default`,className:`text-[var(--content-tertiary)]`,children:e});return t==null?r:(0,T.jsx)(n,{content:`Started at ${Ke(t)}`,side:`top`,align:`end`,children:(0,T.jsx)(`span`,{className:`cursor-default`,children:r})})}function q(e){let t=0,n=!1;for(let r of e)r&&(n=!0,t+=We(r));return n?k(t):``}function J(e){if(e.length===0)return`running`;for(let t of e){if(t.kind===`tool`){if(t.status===`running`)return`running`;continue}if(t.kind===`web_search`&&t.title===`Searching the web`)return`running`}return`completed`}function Y(e){let t=[];for(let n of e){let e=Ue(n),r=t[t.length-1];r&&r.label===e?r.steps.push(n):t.push({label:e,steps:[n]})}return t}function Je({steps:e,renderStep:t,timeline:n=!1}){if(e.length===0)return null;let r=Y(e),i=[],a=0;for(let e of r)i.push(a),a+=e.steps.length;let o=(e,n)=>e.steps.map((e,r)=>{let i=$e(e,n+r);return(0,T.jsx)(w.Fragment,{children:t?t(e):(0,T.jsx)(tt,{step:e})},i)});return n?(0,T.jsx)(`div`,{className:`flex w-full flex-col`,children:r.map((e,t)=>(0,T.jsx)(Ye,{section:e,baseIndex:i[t],isLast:t===r.length-1,renderSectionSteps:o},`${e.label}-${t}`))}):(0,T.jsx)(`div`,{className:`flex w-full flex-col gap-3`,children:r.map((e,t)=>{let n=q(e.steps.map(e=>`durationLabel`in e?e.durationLabel:``)),r=J(e.steps),a=i[t];return(0,T.jsxs)(`div`,{"data-testid":`phase-section`,"data-phase-label":e.label,className:`flex flex-col gap-1`,children:[(0,T.jsx)(et,{label:e.label,durationLabel:n,status:r}),(0,T.jsx)(`div`,{className:`flex min-w-0 flex-col items-start gap-1 pl-[24px]`,children:o(e,a)})]},`${e.label}-${t}`)})})}function Ye({section:e,baseIndex:t,isLast:n,renderSectionSteps:r}){let a=q(e.steps.map(e=>`durationLabel`in e?e.durationLabel:``)),o=J(e.steps),s=e.steps[0]?.kind===`thinking`;return(0,T.jsxs)(`div`,{"data-testid":`phase-section`,"data-phase-label":e.label,className:`relative flex flex-col gap-2`,children:[!n&&(0,T.jsx)(Xe,{}),(0,T.jsxs)(`div`,{"data-testid":`phase-header`,className:`flex items-center justify-between gap-2 py-[2px]`,children:[(0,T.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,T.jsx)(Ze,{status:o,isThinking:s}),(0,T.jsx)(i,{variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e.label})]}),a?(0,T.jsx)(qe,{durationLabel:a,startedAt:Ge(e.steps)}):null]}),(0,T.jsx)(`div`,{className:x(`flex min-w-0 flex-col items-start gap-1 pl-[22px]`,!n&&`pb-3`),children:r(e,t)})]})}function Xe({className:e}){return(0,T.jsx)(`div`,{"aria-hidden":!0,className:x(`absolute bottom-0 left-[6.5px] top-6 w-px bg-[var(--border-subtle)]`,e)})}function Ze({status:e,isThinking:t}){return t?(0,T.jsx)(d,{"aria-hidden":`true`,"data-testid":`phase-header-status-icon`,"data-status":`thinking`,className:`h-[14px] w-[14px] shrink-0 text-[var(--content-secondary)]`}):(0,T.jsx)(Qe,{status:e,testId:`phase-header-status-icon`})}function Qe({status:e,testId:t}){return e===`completed`?(0,T.jsx)(p,{"aria-hidden":`true`,"data-testid":t,"data-status":`completed`,className:`h-[14px] w-[14px] shrink-0 text-[var(--system-positive-strong)]`}):(0,T.jsx)(C,{"data-testid":t,className:`shrink-0`})}function $e(e,t){return e.kind===`tool`&&e.toolCallId?e.toolCallId:`${e.kind}-${t}`}function et({label:e,durationLabel:t,status:n}){return(0,T.jsxs)(`div`,{"data-testid":`phase-header`,className:`flex items-center justify-between py-[2px]`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-1`,children:[n===`completed`?(0,T.jsx)(f,{"aria-hidden":`true`,"data-testid":`phase-header-status-icon`,"data-status":`completed`,className:`h-[14px] w-[14px] text-[var(--system-positive-strong)]`}):(0,T.jsx)(C,{"data-testid":`phase-header-status-icon`,className:`shrink-0`}),(0,T.jsx)(i,{variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e})]}),t?(0,T.jsx)(i,{variant:`label-medium-default`,className:`text-[var(--content-tertiary)]`,children:t}):null]})}function X(e){switch(e.kind){case`thinking`:return!0;case`tool`:return e.info.length>0;case`tool_error`:case`web_search_error`:case`web_search`:return!0}}function tt({step:e}){if(e.kind===`thinking`)return(0,T.jsx)(Q,{children:(0,T.jsx)(Z,{children:E(e.text)})});if(e.kind===`tool`){let t=K[e.iconName]??s;return X(e)?(0,T.jsxs)(Q,{children:[(0,T.jsx)(t,{"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-[var(--content-secondary)]`}),(0,T.jsx)(Z,{children:e.info})]}):null}return e.kind===`tool_error`?(0,T.jsx)(Q,{children:(0,T.jsx)(Z,{children:e.message})}):e.kind===`web_search_error`?(0,T.jsx)(Q,{children:(0,T.jsx)(Z,{children:e.errorMessage})}):(0,T.jsx)(Q,{children:(0,T.jsx)(Z,{children:e.title})})}function Z({children:e}){return(0,T.jsx)(i,{variant:`body-small-default`,className:`min-w-0 truncate text-inherit`,children:e})}function Q({children:e}){return(0,T.jsx)(`div`,{"data-testid":`phase-step-pill`,className:`inline-flex min-w-0 max-w-full items-center gap-1 self-start rounded-full border border-[var(--border-element)] bg-transparent px-2 py-1 text-[var(--content-default)]`,children:e})}var $=`inline-flex min-w-0 items-center gap-1 self-start rounded-full px-2 py-1 text-left leading-normal`,nt=`transition-colors cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--border-focus)]`,rt=`bg-[var(--surface-overlay)] text-[var(--content-default)]`;function it({faviconUrl:e,domain:t,label:n}){let[r,i]=(0,w.useState)(!1),a=!!e&&!r,o=(t&&t.length>0?t:n).charAt(0).toUpperCase();return(0,T.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center overflow-hidden rounded-[var(--radius-sm)]`,children:a?(0,T.jsx)(`img`,{src:e,alt:``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`h-full w-full object-contain`,onError:()=>i(!0)}):(0,T.jsx)(`span`,{className:`text-[10px] font-medium leading-none text-[var(--content-tertiary)]`,children:o})})}function at({label:e,url:t,faviconUrl:n,domain:r,ariaLabel:a}){return(0,T.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,"data-testid":`tool-step-pill`,"data-variant":`web`,"aria-label":a??`Open ${e}`,className:`${$} ${nt} max-w-[240px] no-underline hover:bg-[var(--surface-active)] ${rt}`,children:[(0,T.jsx)(it,{faviconUrl:n,domain:r,label:e}),(0,T.jsx)(i,{variant:`body-small-default`,className:`min-w-0 truncate text-inherit leading-normal`,children:e})]})}function ot(e){if(e.variant===`web`)return(0,T.jsx)(at,{...e});let{iconName:t,label:n,onClick:r,active:a=!1,ariaLabel:o}=e,c=a?`bg-[var(--surface-active)] text-[var(--content-default)]`:rt,l=(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(K[t]??s,{"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-[var(--content-tertiary)]`}),(0,T.jsx)(i,{variant:`body-small-default`,className:`min-w-0 truncate text-inherit leading-normal`,children:n})]});return r?(0,T.jsx)(`button`,{type:`button`,"data-testid":`tool-step-pill`,"data-active":a?``:void 0,"aria-pressed":a,"aria-label":o??`View details: ${n}`,onClick:r,className:`${$} ${nt} max-w-full hover:bg-[var(--surface-active)] ${c}`,children:l}):(0,T.jsx)(`span`,{"data-testid":`tool-step-pill`,className:`${$} max-w-full ${c}`,children:l})}function st(e){let t=(e.domain&&e.domain.length>0?e.domain:e.title).charAt(0);return t?t.toUpperCase():``}function ct({item:e}){let[t,n]=(0,w.useState)(!1),r=!!e.faviconUrl&&!t;return(0,T.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-2 rounded-[var(--radius-md)] px-2 py-1.5 hover:bg-[var(--surface-hover)]`,children:[(0,T.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex h-[14px] w-[14px] shrink-0 items-center justify-center overflow-hidden rounded-[var(--radius-sm)] bg-[var(--surface-overlay)]`,children:r?(0,T.jsx)(`img`,{src:e.faviconUrl,alt:``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`h-full w-full object-contain`,onError:()=>n(!0)}):(0,T.jsx)(`span`,{className:`text-[10px] font-medium leading-none text-[var(--content-default)]`,children:st(e)})}),(0,T.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,T.jsx)(i,{variant:`body-small-default`,className:`truncate text-[var(--content-default)]`,children:e.title}),(0,T.jsx)(i,{variant:`body-small-default`,className:`truncate text-[var(--content-secondary)]`,children:e.domain})]})]})}function lt({results:e}){return(0,T.jsxs)(y.Root,{children:[(0,T.jsx)(y.Trigger,{asChild:!0,children:(0,T.jsx)(`button`,{type:`button`,"data-testid":`web-search-overflow-chip`,className:`inline-flex min-h-[26px] cursor-pointer items-center rounded-[var(--radius-pill)] bg-[var(--surface-base)] px-[10px] py-[6px] outline-none hover:bg-[var(--surface-hover)] focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:(0,T.jsxs)(i,{variant:`body-small-default`,className:`text-[var(--content-default)]`,children:[`+`,e.length,` more`]})})}),(0,T.jsx)(y.Content,{align:`start`,side:`bottom`,className:`flex max-h-[260px] w-[280px] flex-col gap-0.5 overflow-y-auto`,children:e.map(e=>(0,T.jsx)(ct,{item:e},e.rank))})]})}function ut({message:e}){return(0,T.jsx)(`div`,{"data-testid":`web-search-error-chip`,className:`inline-flex items-center gap-1 rounded-[var(--radius-pill)] border border-[var(--border-element)] bg-transparent px-[10px] py-[6px]`,children:(0,T.jsx)(i,{variant:`body-small-default`,className:`text-[var(--content-default)]`,children:e})})}function dt({step:e}){let t=e.overflowResults??[];return(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(e.results??[]).map(e=>(0,T.jsx)(ot,{variant:`web`,url:e.url,faviconUrl:e.faviconUrl,domain:e.domain,label:e.title},e.rank)),t.length>0?(0,T.jsx)(lt,{results:t}):null]})}function ft({step:e}){return(0,T.jsx)(ut,{message:e.errorMessage})}function pt({faviconUrl:e,domain:t,title:n,className:r}){let[i,a]=(0,w.useState)(!1);(0,w.useEffect)(()=>{a(!1)},[e]);let o=!!e&&!i,s=(t&&t.length>0?t:n).charAt(0).toUpperCase();return(0,T.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`site-favicon`,className:x(`inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center overflow-hidden rounded-[var(--radius-sm)]`,r),children:o?(0,T.jsx)(`img`,{src:e,alt:``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`h-full w-full object-contain`,onError:()=>a(!0)}):(0,T.jsx)(`span`,{className:`text-[10px] font-medium leading-none text-[var(--content-tertiary)]`,children:s})})}export{O as C,D as S,de as _,tt as a,be as b,Xe as c,J as d,$e as f,G as g,He as h,ot as i,Ze as l,q as m,ft as n,K as o,X as p,dt as r,Je as s,pt as t,Y as u,Ae as v,E as w,Se as x,k as y};
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{n}from"./button-BENY-yx_.js";import{t as r}from"./jsx-runtime-D3ZM-ToX.js";import{t as i}from"./typography-BeUa5Fd-.js";import{C as a,S as o,T as s,o as c,s as l,w as u}from"./message-content-Beh5mR15.js";import{t as d}from"./brain-ZiC0HCCF.js";import{t as f}from"./check-DSgjgwlo.js";import{t as p}from"./circle-check-q8BVdbgw.js";import{t as m}from"./code-DwZ6Mhdw.js";import"./src-DyqTPMO2.js";import{t as h}from"./file-text-DDbRSMUn.js";import{t as g}from"./globe-COk-NH9x.js";import{t as _}from"./monitor-CPgcKlQP.js";import{t as v}from"./sparkles-B94iNYGJ.js";import{t as ee}from"./user-plus-DAap8I1c.js";import{t as y}from"./popover-CAbJ9178.js";import{D as b,O as te}from"./chat-DYLliWTB.js";import{t as x}from"./misc-Z0jXGGeY.js";import{t as ne}from"./proxy-B4sTDdE4.js";import{t as re}from"./AnimatePresence-D41IKJOi.js";import{t as S}from"./use-reduced-motion-CaGZSwLZ.js";import{t as C}from"./three-dot-indicator-BQxSg8G2.js";var w=e(t(),1),T=r();function E(e){let t=e.trimStart();if(!t.startsWith(`**`))return e;let n=t.indexOf(`**`,2);if(n===-1)return t.slice(2).trimStart();let r=t.slice(2,n).trim();return r.length>0?r:e}var ie=/^https?:\/\/\S+/,ae=/^URL:\s*(https?:\/\/\S+)/i,oe=/^\[\d+\]\s*(https?:\/\/\S+)/;function D(e){try{return new URL(e).hostname.replace(/^www\./,``)}catch{return``}}function se(e){let t=e.trim();return ae.exec(t)?.[1]??oe.exec(t)?.[1]??t}function ce(e){return e.trim().replace(/^\d+\.\s+/,``)}function le(e){let t=e.split(/\r?\n/),n=[],r=new Set,i=``;for(let e of t){let t=e.trim();if(!t){i=``;continue}let a=se(t);if(ie.test(a)){r.has(a)||(r.add(a),n.push({title:i,url:a})),i=``;continue}/^Web search results for /i.test(t)||/^Sources:?$/i.test(t)||(i=ce(t))}return n}function O(e){return!e||!e.trim()?[]:le(e).map((e,t)=>{let n=D(e.url);return{rank:t+1,title:e.title,url:e.url,domain:n}})}var ue=5,de=new Set([`web_search`,`web_fetch`]);function k(e){if(!Number.isFinite(e)||e<1e3)return`<1s`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.round(t/60);return n<60?`${n}m`:`${Math.round(n/60)}h`}function A(e){return de.has(e.name)}function j(e){return e?`Searched the web`:`Searching the web`}function M(e){return{visible:e.slice(0,ue),overflowResults:e.slice(ue)}}function fe(e,t){let{visible:n,overflowResults:r}=M(e.results);return{kind:`web_search`,title:j(t),durationLabel:k(e.durationMs),linkCount:e.resultCount,results:n,overflowResults:r}}function pe(e){let t=e.title??e.domain;return{kind:`thinking`,durationLabel:k(e.durationMs),text:`Reading ${t}`}}function me(){return{kind:`web_search`,title:`Searching the web`,durationLabel:``,linkCount:0,results:[]}}function he(){return{kind:`thinking`,durationLabel:``,text:`Reading…`}}function ge(e){let t=O(e);if(t.length===0)return null;let{visible:n,overflowResults:r}=M(t);return{kind:`web_search`,title:j(!0),durationLabel:``,linkCount:t.length,results:n,overflowResults:r}}function _e(e){return{kind:`web_search_error`,title:`Web search failed`,durationLabel:k(e.durationMs),errorMessage:e.errorMessage??`Search is having trouble right now. You can try again in a moment, continue without web search, or paste the relevant details here and I'll use those.`}}function N(){return{kind:`web_search`,title:j(!0),durationLabel:``,linkCount:0,results:[]}}function P(e,t){return t[e.id]??e.activityMetadata}function F(e){return!b(e)}function I(e,t){return e.results.length>0?!1:!!e.errorMessage||!!t.isError}function L(e){return e.confirmationDecision===`denied`||e.confirmationDecision===`timed_out`?`denied`:e.isError?`error`:b(e)?`running`:`completed`}function R(e,t){return e==null||t==null?null:Math.max(0,t-e)}function z(e,t){let n=R(e,t);return n==null?``:k(n)}function B(e){return z(e.startedAt??void 0,e.completedAt??void 0)}function ve(e){return!c(e)&&b(e)}function ye(e,t){if(e.kind===`thinking`)return e.text?e.completedAt==null?e.startedAt!=null&&t!=null?Math.max(0,t-e.startedAt):null:R(e.startedAt,e.completedAt):null;let n=e.toolCall;if(c(n))return null;let r=te(n);return n.completedAt==null?b(n)&&r!=null&&t!=null?Math.max(0,t-r):null:R(r,n.completedAt)}function be(e){return e.some(e=>e.kind===`thinking`?!!e.text&&e.startedAt!=null&&e.completedAt==null:ve(e.toolCall))}function xe(e,t){let n=0,r=!1;for(let i of e){let e=ye(i,t);e!=null&&(r=!0,n+=e)}return r?k(n):``}function Se(e){let{title:t,activity:n}=l(e);return{toolCallId:e.id,toolName:e.name,title:t,activity:n,input:e.input??{},result:e.result,streamedOutput:e.streamedOutput,status:L(e),riskLevel:e.riskLevel,riskReason:e.riskReason,durationLabel:B(e)}}function Ce(e){let{title:t,info:n,activity:r,iconName:i}=l(e);return{kind:`tool`,durationLabel:B(e),startedAt:e.startedAt??void 0,title:t,info:n,activity:r,riskLevel:e.riskLevel,iconName:i,toolCallId:e.id,status:L(e)}}function we(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(A(r)){let e=P(r,t),n=F(r);if(e?.webSearch&&I(e.webSearch,r))return`Web search failed`;if(r.name===`web_search`)return j(n);if(r.name===`web_fetch`)return`Thinking`}else return l(r).title}return``}function Te(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(!A(r)){let{info:e,activity:t}=l(r);return t||e}let i=P(r,t),a=F(r);if(i?.webSearch){let e=i.webSearch;if(I(e,r))return e.errorMessage??`Search is having trouble right now. You can try again in a moment, continue without web search, or paste the relevant details here and I'll use those.`;if(e.results.length>0)return e.results[e.results.length-1].title;if(!a&&e.query)return`Searching ${e.query}`}if(i?.webFetch){let e=i.webFetch;return a?e.title??e.domain:`Reading ${e.domain}`}if(r.name===`web_search`){if(!a){let e=typeof r.input?.query==`string`?r.input.query.trim():``;return e?`Searching ${e}`:``}if(typeof r.result==`string`){let e=O(r.result);if(e.length>0){let t=e[e.length-1].title;if(t)return t}}}if(r.name===`web_fetch`){let e=typeof r.input?.url==`string`?r.input.url:``,t=e?D(e):``;if(t)return a?t:`Reading ${t}`}}return``}function Ee(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(r.name!==`web_search`)continue;let i=P(r,t)?.webSearch?.results;if(i&&i.length>0)return i}return[]}function De(e){return e.includes(`denied`)?`denied`:e.includes(`loading`)?`loading`:e.includes(`error`)?`error`:`complete`}function Oe(e){return De(e.map(e=>e.confirmationDecision===`denied`||e.confirmationDecision===`timed_out`?`denied`:b(e)?`loading`:e.isError?`error`:`complete`))}function ke(e,t){if(c(e))return null;if(!A(e))return Ce(e);let n=P(e,t),r=F(e);if(n?.webSearch){let t=n.webSearch;return I(t,e)?_e(t):fe(t,r)}return n?.webFetch?pe(n.webFetch):r?e.name===`web_search`&&typeof e.result==`string`?ge(e.result)??N():N():e.name===`web_search`?me():he()}function Ae(e,t,n){let r=e.filter(e=>e.kind===`toolCall`).map(e=>e.toolCall).filter(e=>!c(e)),i=[],a=null,o=0;for(let n of e){if(n.kind===`thinking`){n.text&&(i.push({kind:`thinking`,durationLabel:z(n.startedAt,n.completedAt),text:n.text,startedAt:n.startedAt,completedAt:n.completedAt,thinkingItemIndex:o++}),a=n.text);continue}let e=ke(n.toolCall,t);e&&(i.push(e),a=null)}let s=Oe(r),l,u,d;a===null?(l=we(r,t),u=Te(r,t),d=`tool`):(l=`Thinking`,u=E(a),d=`thinking`);let f=Ee(r,t),p=`${i.length} step${i.length===1?``:`s`}`,m=xe(e,n);return{currentStepTitle:l,currentStepInfo:u,currentStepKind:d,stepCount:p,totalDurationLabel:m,steps:i,state:s,carouselItems:f}}var je=.44;function Me(e,t){let n=[...e].sort((e,t)=>e.position-t.position),r=n[0]?.color??`white`,i=n[n.length-1]?.color??`white`,a=n.map(e=>{let t=(e.position-.5)*2*je;return`${e.color} calc(50% + var(--gs-spread-mid) * ${t.toFixed(4)})`}).join(`, `);return[`linear-gradient(${t}deg`,`var(--gs-base) calc(50% - var(--gs-spread))`,`color-mix(in oklab, var(--gs-base) 42%, ${r}) calc(50% - var(--gs-spread-mid))`,a,`color-mix(in oklab, var(--gs-base) 42%, ${i}) calc(50% + var(--gs-spread-mid))`,`var(--gs-base) calc(50% + var(--gs-spread)))`].join(`, `)}function Ne(e){let t=`color-mix(in srgb, ${e} 40%, white)`;return[{position:0,color:t},{position:.5,color:e},{position:1,color:t}]}var Pe=`var(--avatar-accent, var(--content-emphasised))`,Fe=`color-mix(in srgb, currentColor 45%, transparent)`,Ie=1500,Le=106,V=6,H=48,U=.72,W=14,Re=96;function ze(){return typeof CSS>`u`||typeof CSS.supports!=`function`?!1:CSS.supports(`background-clip`,`text`)||CSS.supports(`-webkit-background-clip`,`text`)}function G({children:e,colorHex:t,className:n,"data-testid":r}){let i=(0,w.useRef)(null),a=S(),o=t??Pe,s=(0,w.useMemo)(()=>Me(Ne(o),Le),[o]);(0,w.useLayoutEffect)(()=>{let t=i.current;if(!t)return;if(!ze()){t.style.removeProperty(`background-image`),t.style.removeProperty(`background-color`),t.style.removeProperty(`-webkit-text-fill-color`);return}if(a||typeof t.animate!=`function`)return;let n=null,r=()=>{let r=t.getBoundingClientRect().width||Re,i=(Number.parseFloat(getComputedStyle(t).fontSize)||W)/W,a=Math.min(e.length*V*i,H*i),o=Math.max(1,r+a*2);t.style.setProperty(`--gs-spread`,`${a}px`),t.style.setProperty(`--gs-spread-mid`,`${a*U}px`),t.style.backgroundSize=`${o}px 100%`,n?.cancel(),n=t.animate([{backgroundPosition:`0px center`},{backgroundPosition:`${o}px center`}],{duration:Ie,easing:`linear`,iterations:1/0}),n.startTime=0};r();let o=typeof ResizeObserver>`u`?void 0:new ResizeObserver(r);return o?.observe(t),()=>{o?.disconnect(),n?.cancel()}},[e,a]);let c=Math.min(e.length*V,H);return(0,T.jsx)(`span`,{ref:i,className:n,style:{position:`relative`,display:`inline-block`,backgroundImage:s,backgroundRepeat:`repeat-x`,backgroundSize:`100% 100%`,backgroundColor:`var(--gs-base)`,WebkitBackgroundClip:`text`,backgroundClip:`text`,WebkitTextFillColor:`transparent`,"--gs-base":Fe,"--gs-spread":`${c}px`,"--gs-spread-mid":`${c*U}px`},"data-testid":r,children:e})}var Be=400;function Ve(e,t,n){let[r,i]=(0,w.useState)(e),a=(0,w.useRef)(null),o=(0,w.useRef)(null),s=(0,w.useRef)(null);return(0,w.useEffect)(()=>{if(Object.is(r,e)){o.current=null;return}if(n){s.current&&=(clearTimeout(s.current),null),o.current=null,i(e),a.current=Date.now();return}o.current=e;let c=Date.now();a.current===null&&(a.current=c);let l=c-a.current,u=Math.max(0,t-l);return s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{o.current!==null&&(i(o.current),a.current=Date.now(),o.current=null),s.current=null},u),()=>{s.current&&=(clearTimeout(s.current),null)}},[e,r,t,n]),r}function He({currentStepTitle:e,currentStepInfo:t,bypassDwell:n=!1,animationKey:r,shimmer:a=!1,inline:o=!1}){let s=S(),c=Ve((0,w.useMemo)(()=>({title:e,info:t}),[e,t]),Be,n),l=s?{duration:0}:{duration:.25,ease:[.16,1,.3,1]},u=s?{opacity:0}:{y:-16,opacity:0},d=s?{opacity:1}:{y:0,opacity:1},f=s?{opacity:0}:{y:16,opacity:0},p=typeof c.info==`string`||typeof c.info==`number`,m=p?String(c.info):c.info==null?``:`node`,h=r??`${c.title}::${m}`,g=p?c.info!==``:c.info!=null,_=c.title.trim()!==``,v=g?`block min-w-0`:`block min-w-0 flex-1`;return(0,T.jsx)(re,{initial:!1,mode:`popLayout`,children:(0,T.jsxs)(ne.span,{initial:u,animate:d,exit:f,transition:l,className:`flex min-w-0 flex-1 items-center gap-1`,children:[_?o?(0,T.jsx)(`span`,{className:`${v} truncate text-left text-[13px] font-medium leading-[16px] text-[var(--content-secondary)]`,children:a?(0,T.jsx)(G,{children:c.title}):c.title}):(0,T.jsx)(i,{variant:`body-medium-default`,className:`ml-1 ${v} truncate text-left text-[var(--content-emphasised)]`,children:a?(0,T.jsx)(G,{children:c.title}):c.title}):null,g?(0,T.jsxs)(T.Fragment,{children:[_?(0,T.jsx)(`span`,{"aria-hidden":`true`,className:`ml-1 h-3.5 w-px shrink-0 bg-[var(--border-element)]`}):null,p?o&&!_?(0,T.jsx)(`span`,{className:`block min-w-0 flex-1 truncate text-left text-[13px] font-medium leading-[16px] text-[var(--content-secondary)]`,children:a&&typeof c.info==`string`?(0,T.jsx)(G,{children:c.info}):c.info}):(0,T.jsx)(i,{variant:_?`body-small-default`:`body-medium-default`,className:`ml-1 block min-w-0 flex-1 truncate text-left leading-[16px] ${_?`text-[var(--content-tertiary)]`:`text-[var(--content-emphasised)]`}`,children:a&&!_&&typeof c.info==`string`?(0,T.jsx)(G,{children:c.info}):c.info}):(0,T.jsx)(`span`,{className:`ml-1 block min-w-0 flex-1`,children:c.info})]}):null]},h)})}var K={code:m,terminal:o,file:h,globe:g,pen:u,monitor:_,plug:a,sparkle:v,"user-plus":ee,bolt:s,brain:d};function Ue(e){if(e.kind===`thinking`)return`Thinking`;if(e.kind===`web_search`||e.kind===`web_search_error`)return`Searching the web`;if(e.kind===`tool_error`)return`Error`;let t=e.title;return t.startsWith(`Working`)?t:t===`Reading`||t===`Editing`||t.startsWith(`Running`)?`Working`:t===`Using a skill`?`Using a skill`:(t.startsWith(`Using `),t)}function We(e){if(!e||e===`<1s`)return 0;let t=/^(\d+)(s|m|h)$/.exec(e);if(!t)return 0;let n=Number(t[1]);switch(t[2]){case`h`:return n*36e5;case`m`:return n*6e4;default:return n*1e3}}function Ge(e){let t=null;for(let n of e)(n.kind===`tool`||n.kind===`thinking`)&&n.startedAt!=null&&(t=t==null?n.startedAt:Math.min(t,n.startedAt));return t}function Ke(e){return new Date(e).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`,second:`2-digit`})}function qe({durationLabel:e,startedAt:t}){let r=(0,T.jsx)(i,{variant:`label-medium-default`,className:`text-[var(--content-tertiary)]`,children:e});return t==null?r:(0,T.jsx)(n,{content:`Started at ${Ke(t)}`,side:`top`,align:`end`,children:(0,T.jsx)(`span`,{className:`cursor-default`,children:r})})}function q(e){let t=0,n=!1;for(let r of e)r&&(n=!0,t+=We(r));return n?k(t):``}function J(e){if(e.length===0)return`running`;for(let t of e){if(t.kind===`tool`){if(t.status===`running`)return`running`;continue}if(t.kind===`web_search`&&t.title===`Searching the web`)return`running`}return`completed`}function Y(e){let t=[];for(let n of e){let e=Ue(n),r=t[t.length-1];r&&r.label===e?r.steps.push(n):t.push({label:e,steps:[n]})}return t}function Je({steps:e,renderStep:t,timeline:n=!1}){if(e.length===0)return null;let r=Y(e),i=[],a=0;for(let e of r)i.push(a),a+=e.steps.length;let o=(e,n)=>e.steps.map((e,r)=>{let i=$e(e,n+r);return(0,T.jsx)(w.Fragment,{children:t?t(e):(0,T.jsx)(tt,{step:e})},i)});return n?(0,T.jsx)(`div`,{className:`flex w-full flex-col`,children:r.map((e,t)=>(0,T.jsx)(Ye,{section:e,baseIndex:i[t],isLast:t===r.length-1,renderSectionSteps:o},`${e.label}-${t}`))}):(0,T.jsx)(`div`,{className:`flex w-full flex-col gap-3`,children:r.map((e,t)=>{let n=q(e.steps.map(e=>`durationLabel`in e?e.durationLabel:``)),r=J(e.steps),a=i[t];return(0,T.jsxs)(`div`,{"data-testid":`phase-section`,"data-phase-label":e.label,className:`flex flex-col gap-1`,children:[(0,T.jsx)(et,{label:e.label,durationLabel:n,status:r}),(0,T.jsx)(`div`,{className:`flex min-w-0 flex-col items-start gap-1 pl-[24px]`,children:o(e,a)})]},`${e.label}-${t}`)})})}function Ye({section:e,baseIndex:t,isLast:n,renderSectionSteps:r}){let a=q(e.steps.map(e=>`durationLabel`in e?e.durationLabel:``)),o=J(e.steps),s=e.steps[0]?.kind===`thinking`;return(0,T.jsxs)(`div`,{"data-testid":`phase-section`,"data-phase-label":e.label,className:`relative flex flex-col gap-2`,children:[!n&&(0,T.jsx)(Xe,{}),(0,T.jsxs)(`div`,{"data-testid":`phase-header`,className:`flex items-center justify-between gap-2 py-[2px]`,children:[(0,T.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,T.jsx)(Ze,{status:o,isThinking:s}),(0,T.jsx)(i,{variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e.label})]}),a?(0,T.jsx)(qe,{durationLabel:a,startedAt:Ge(e.steps)}):null]}),(0,T.jsx)(`div`,{className:x(`flex min-w-0 flex-col items-start gap-1 pl-[22px]`,!n&&`pb-3`),children:r(e,t)})]})}function Xe({className:e}){return(0,T.jsx)(`div`,{"aria-hidden":!0,className:x(`absolute bottom-0 left-[6.5px] top-6 w-px bg-[var(--border-subtle)]`,e)})}function Ze({status:e,isThinking:t}){return t?(0,T.jsx)(d,{"aria-hidden":`true`,"data-testid":`phase-header-status-icon`,"data-status":`thinking`,className:`h-[14px] w-[14px] shrink-0 text-[var(--content-secondary)]`}):(0,T.jsx)(Qe,{status:e,testId:`phase-header-status-icon`})}function Qe({status:e,testId:t}){return e===`completed`?(0,T.jsx)(p,{"aria-hidden":`true`,"data-testid":t,"data-status":`completed`,className:`h-[14px] w-[14px] shrink-0 text-[var(--system-positive-strong)]`}):(0,T.jsx)(C,{"data-testid":t,className:`shrink-0`})}function $e(e,t){return e.kind===`tool`&&e.toolCallId?e.toolCallId:`${e.kind}-${t}`}function et({label:e,durationLabel:t,status:n}){return(0,T.jsxs)(`div`,{"data-testid":`phase-header`,className:`flex items-center justify-between py-[2px]`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-1`,children:[n===`completed`?(0,T.jsx)(f,{"aria-hidden":`true`,"data-testid":`phase-header-status-icon`,"data-status":`completed`,className:`h-[14px] w-[14px] text-[var(--system-positive-strong)]`}):(0,T.jsx)(C,{"data-testid":`phase-header-status-icon`,className:`shrink-0`}),(0,T.jsx)(i,{variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e})]}),t?(0,T.jsx)(i,{variant:`label-medium-default`,className:`text-[var(--content-tertiary)]`,children:t}):null]})}function X(e){switch(e.kind){case`thinking`:return!0;case`tool`:return e.info.length>0;case`tool_error`:case`web_search_error`:case`web_search`:return!0}}function tt({step:e}){if(e.kind===`thinking`)return(0,T.jsx)(Q,{children:(0,T.jsx)(Z,{children:E(e.text)})});if(e.kind===`tool`){let t=K[e.iconName]??s;return X(e)?(0,T.jsxs)(Q,{children:[(0,T.jsx)(t,{"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-[var(--content-secondary)]`}),(0,T.jsx)(Z,{children:e.info})]}):null}return e.kind===`tool_error`?(0,T.jsx)(Q,{children:(0,T.jsx)(Z,{children:e.message})}):e.kind===`web_search_error`?(0,T.jsx)(Q,{children:(0,T.jsx)(Z,{children:e.errorMessage})}):(0,T.jsx)(Q,{children:(0,T.jsx)(Z,{children:e.title})})}function Z({children:e}){return(0,T.jsx)(i,{variant:`body-small-default`,className:`min-w-0 truncate text-inherit`,children:e})}function Q({children:e}){return(0,T.jsx)(`div`,{"data-testid":`phase-step-pill`,className:`inline-flex min-w-0 max-w-full items-center gap-1 self-start rounded-full border border-[var(--border-element)] bg-transparent px-2 py-1 text-[var(--content-default)]`,children:e})}var $=`inline-flex min-w-0 items-center gap-1 self-start rounded-full px-2 py-1 text-left leading-normal`,nt=`transition-colors cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--border-focus)]`,rt=`bg-[var(--surface-overlay)] text-[var(--content-default)]`;function it({faviconUrl:e,domain:t,label:n}){let[r,i]=(0,w.useState)(!1),a=!!e&&!r,o=(t&&t.length>0?t:n).charAt(0).toUpperCase();return(0,T.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center overflow-hidden rounded-[var(--radius-sm)]`,children:a?(0,T.jsx)(`img`,{src:e,alt:``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`h-full w-full object-contain`,onError:()=>i(!0)}):(0,T.jsx)(`span`,{className:`text-[10px] font-medium leading-none text-[var(--content-tertiary)]`,children:o})})}function at({label:e,url:t,faviconUrl:n,domain:r,ariaLabel:a}){return(0,T.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,"data-testid":`tool-step-pill`,"data-variant":`web`,"aria-label":a??`Open ${e}`,className:`${$} ${nt} max-w-[240px] no-underline hover:bg-[var(--surface-active)] ${rt}`,children:[(0,T.jsx)(it,{faviconUrl:n,domain:r,label:e}),(0,T.jsx)(i,{variant:`body-small-default`,className:`min-w-0 truncate text-inherit leading-normal`,children:e})]})}function ot(e){if(e.variant===`web`)return(0,T.jsx)(at,{...e});let{iconName:t,label:n,onClick:r,active:a=!1,ariaLabel:o}=e,c=a?`bg-[var(--surface-active)] text-[var(--content-default)]`:rt,l=(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(K[t]??s,{"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-[var(--content-tertiary)]`}),(0,T.jsx)(i,{variant:`body-small-default`,className:`min-w-0 truncate text-inherit leading-normal`,children:n})]});return r?(0,T.jsx)(`button`,{type:`button`,"data-testid":`tool-step-pill`,"data-active":a?``:void 0,"aria-pressed":a,"aria-label":o??`View details: ${n}`,onClick:r,className:`${$} ${nt} max-w-full hover:bg-[var(--surface-active)] ${c}`,children:l}):(0,T.jsx)(`span`,{"data-testid":`tool-step-pill`,className:`${$} max-w-full ${c}`,children:l})}function st(e){let t=(e.domain&&e.domain.length>0?e.domain:e.title).charAt(0);return t?t.toUpperCase():``}function ct({item:e}){let[t,n]=(0,w.useState)(!1),r=!!e.faviconUrl&&!t;return(0,T.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-2 rounded-[var(--radius-md)] px-2 py-1.5 hover:bg-[var(--surface-hover)]`,children:[(0,T.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex h-[14px] w-[14px] shrink-0 items-center justify-center overflow-hidden rounded-[var(--radius-sm)] bg-[var(--surface-overlay)]`,children:r?(0,T.jsx)(`img`,{src:e.faviconUrl,alt:``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`h-full w-full object-contain`,onError:()=>n(!0)}):(0,T.jsx)(`span`,{className:`text-[10px] font-medium leading-none text-[var(--content-default)]`,children:st(e)})}),(0,T.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,T.jsx)(i,{variant:`body-small-default`,className:`truncate text-[var(--content-default)]`,children:e.title}),(0,T.jsx)(i,{variant:`body-small-default`,className:`truncate text-[var(--content-secondary)]`,children:e.domain})]})]})}function lt({results:e}){return(0,T.jsxs)(y.Root,{children:[(0,T.jsx)(y.Trigger,{asChild:!0,children:(0,T.jsx)(`button`,{type:`button`,"data-testid":`web-search-overflow-chip`,className:`inline-flex min-h-[26px] cursor-pointer items-center rounded-[var(--radius-pill)] bg-[var(--surface-base)] px-[10px] py-[6px] outline-none hover:bg-[var(--surface-hover)] focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:(0,T.jsxs)(i,{variant:`body-small-default`,className:`text-[var(--content-default)]`,children:[`+`,e.length,` more`]})})}),(0,T.jsx)(y.Content,{align:`start`,side:`bottom`,className:`flex max-h-[260px] w-[280px] flex-col gap-0.5 overflow-y-auto`,children:e.map(e=>(0,T.jsx)(ct,{item:e},e.rank))})]})}function ut({message:e}){return(0,T.jsx)(`div`,{"data-testid":`web-search-error-chip`,className:`inline-flex items-center gap-1 rounded-[var(--radius-pill)] border border-[var(--border-element)] bg-transparent px-[10px] py-[6px]`,children:(0,T.jsx)(i,{variant:`body-small-default`,className:`text-[var(--content-default)]`,children:e})})}function dt({step:e}){let t=e.overflowResults??[];return(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(e.results??[]).map(e=>(0,T.jsx)(ot,{variant:`web`,url:e.url,faviconUrl:e.faviconUrl,domain:e.domain,label:e.title},e.rank)),t.length>0?(0,T.jsx)(lt,{results:t}):null]})}function ft({step:e}){return(0,T.jsx)(ut,{message:e.errorMessage})}function pt({faviconUrl:e,domain:t,title:n,className:r}){let[i,a]=(0,w.useState)(!1);(0,w.useEffect)(()=>{a(!1)},[e]);let o=!!e&&!i,s=(t&&t.length>0?t:n).charAt(0).toUpperCase();return(0,T.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`site-favicon`,className:x(`inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center overflow-hidden rounded-[var(--radius-sm)]`,r),children:o?(0,T.jsx)(`img`,{src:e,alt:``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`h-full w-full object-contain`,onError:()=>a(!0)}):(0,T.jsx)(`span`,{className:`text-[10px] font-medium leading-none text-[var(--content-tertiary)]`,children:s})})}export{O as C,D as S,de as _,tt as a,be as b,Xe as c,J as d,$e as f,G as g,He as h,ot as i,Ze as l,q as m,ft as n,K as o,X as p,dt as r,Je as s,pt as t,Y as u,Ae as v,E as w,Se as x,k as y};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-Cw5vs0Ef.js";import{t as n}from"./react-BFJW0bSv.js";import{W as r,t as i}from"./button-BENY-yx_.js";import{d as a,n as o,p as s,u as c}from"./chunk-5KNZJZUH-BUqIilZr.js";import{n as l}from"./QueryClientProvider-CMu7CkQU.js";import{t as u}from"./useQuery-Bz-fbQ-m.js";import{t as d}from"./jsx-runtime-D3ZM-ToX.js";import{t as f}from"./card-q0GJX1HZ.js";import{t as p}from"./createLucideIcon-C1mdGPB9.js";import{t as m}from"./arrow-down-to-line-DmG4pLoU.js";import{t as h}from"./arrow-left-BikDV6F2.js";import{a as g,n as _,o as v,r as y,t as b}from"./use-skill-actions-
|
|
2
|
-
`)){if(c.startsWith(`diff --git `)){r={path:Y(he.exec(c)?.[1]??(c.split(` `).slice(3).join(` `)||``),t),rows:[],added:0,removed:0},n.push(r),i=0,a=0,o=!1,s=!1;continue}if(!r)continue;let e=me.exec(c);if(e){i=Number(e[1]),a=Number(e[2]),o=!0,r.rows.length>0&&r.rows.push({type:`meta`,text:c});continue}if(!c.startsWith(`\\ No newline`)){if(!o&&(c.startsWith(`+++ `)||c.startsWith(`--- `))){let e=ge(c);e!==null&&(c.startsWith(`+++ `)||!s)&&(r.path=Y(e,t),s=c.startsWith(`+++ `));continue}!o&&(c.startsWith(`index `)||c.startsWith(`new file mode `)||c.startsWith(`deleted file mode `)||c.startsWith(`similarity index `)||c.startsWith(`rename `)||c.startsWith(`old mode `)||c.startsWith(`new mode `)||c.startsWith(`Binary files `))||(c.startsWith(`+`)?(r.rows.push({type:`add`,text:c.slice(1),newNo:a}),r.added+=1,a+=1):c.startsWith(`-`)?(r.rows.push({type:`del`,text:c.slice(1),oldNo:i}),r.removed+=1,i+=1):c.startsWith(` `)&&(r.rows.push({type:`ctx`,text:c.slice(1),oldNo:i,newNo:a}),i+=1,a+=1))}}return{files:n,added:n.reduce((e,t)=>e+t.added,0),removed:n.reduce((e,t)=>e+t.removed,0)}}async function ve(e,t,n){let{data:r,error:i,response:a}=await R({path:{assistant_id:e,id:t},throwOnError:!1,signal:n});if(!a||!a.ok){if(a?.status===404)return null;throw a?L(i,a):i??Error(`Failed to fetch skill history.`)}return r??null}function ye(e){return e.isLoading?!1:e.isError||e.revisionCount>0}function X(e,t){let n=!!(e&&t),r=u({queryKey:ne({path:{assistant_id:e??``,id:t}}),queryFn:({signal:n})=>ve(e??``,t,n),enabled:n,refetchOnWindowFocus:!1});return{history:r.data??null,revisions:r.data?.revisions??[],truncatedByCompaction:r.data?.truncatedByCompaction??!1,isLoading:r.isLoading,isError:r.isError}}function be({assistantId:e,skillId:t}){let{revisions:n,truncatedByCompaction:r,isLoading:i,isError:a}=X(e,t);return i?(0,q.jsx)(J,{}):a?(0,q.jsx)(Z,{children:`Couldn't load revision history.`}):(0,q.jsx)(xe,{skillId:t,revisions:n,truncatedByCompaction:r})}function xe({skillId:e,revisions:t,truncatedByCompaction:n}){return t.length===0?(0,q.jsx)(Z,{children:`No changes recorded yet.`}):(0,q.jsxs)(E.Root,{type:`multiple`,className:`flex flex-col gap-2 p-3`,children:[t.map(t=>(0,q.jsx)(Se,{revision:t,skillId:e},t.id)),n&&(0,q.jsx)(`p`,{className:`px-1 pt-1 text-body-small-lighter`,style:{color:`var(--content-tertiary)`},children:`Showing recent changes. Older history is periodically compacted, so this may not reach back to when the skill was created.`})]})}function Z({children:e}){return(0,q.jsx)(`p`,{className:`px-3 py-10 text-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:e})}function Se({revision:e,skillId:t}){let n=(0,K.useMemo)(()=>_e(e.diff,t),[e.diff,t]);return(0,q.jsxs)(E.Item,{value:e.id,className:`overflow-hidden rounded-md border`,style:{borderColor:`var(--border-base)`},children:[(0,q.jsxs)(E.Trigger,{className:`group flex w-full items-center gap-3 px-3 py-2.5 text-left transition-colors hover:bg-[var(--surface-hover)]`,children:[(0,q.jsx)(S,{className:`h-4 w-4 shrink-0 transition-transform group-data-[state=open]:rotate-90`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`block truncate text-body-medium-default`,style:{color:`var(--content-default)`},children:se(e.changedAt)}),(0,q.jsx)(`span`,{className:`mt-0.5 block truncate text-body-small-lighter`,style:{color:`var(--content-tertiary)`},children:e.files.join(` · `)})]}),n.added>0&&(0,q.jsxs)(`span`,{className:`shrink-0 text-body-small-default tabular-nums`,style:{color:`var(--system-positive-strong)`},children:[`+`,n.added]}),n.removed>0&&(0,q.jsxs)(`span`,{className:`shrink-0 text-body-small-default tabular-nums`,style:{color:`var(--system-negative-strong)`},children:[`−`,n.removed]})]}),(0,q.jsxs)(E.Content,{className:`border-t`,style:{borderColor:`var(--border-base)`},children:[(0,q.jsx)(`p`,{className:`px-3 py-2 text-body-small-lighter`,style:{color:`var(--content-tertiary)`},children:ce(e.changedAt)}),n.files.length===0?(0,q.jsx)(`p`,{className:`px-3 pb-3 text-body-small-lighter`,style:{color:`var(--content-tertiary)`},children:`No preview available for this change.`}):n.files.map(e=>(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`border-t px-3 py-1.5 font-mono text-body-small-default`,style:{borderColor:`var(--border-base)`,backgroundColor:`var(--surface-base)`,color:`var(--content-secondary)`},children:e.path}),(0,q.jsx)(`div`,{className:`overflow-x-auto py-1 font-mono text-body-small-lighter`,children:e.rows.map((e,t)=>(0,q.jsx)(Ce,{row:e},t))})]},e.path))]})]})}function Ce({row:e}){if(e.type===`meta`)return(0,q.jsx)(`div`,{className:`px-3 py-0.5`,style:{color:`var(--content-faint)`},"aria-hidden":!0,children:`⋯`});let t=e.type===`add`,n=e.type===`del`;return(0,q.jsxs)(`div`,{className:`flex whitespace-pre`,style:{backgroundColor:t?`var(--system-positive-weak)`:n?`var(--system-negative-weak)`:void 0,color:t?`var(--system-positive-strong)`:n?`var(--system-negative-strong)`:`var(--content-secondary)`},children:[(0,q.jsx)(`span`,{className:`w-10 shrink-0 pr-2 text-right tabular-nums`,style:{color:`var(--content-faint)`},children:e.oldNo??``}),(0,q.jsx)(`span`,{className:`w-10 shrink-0 pr-2 text-right tabular-nums`,style:{color:`var(--content-faint)`},children:e.newNo??``}),(0,q.jsx)(`span`,{className:`w-4 shrink-0 text-center`,children:t?`+`:n?`-`:` `}),(0,q.jsx)(`span`,{className:`flex-1 pr-3`,children:e.text})]})}function we({assistantId:e,skill:t,onBack:n,onInstall:r,onRemove:a,isInstalling:o=!1,isRemoving:s=!1,sourceConversationId:c}){let l=y(t),u=H(t),{fileEntries:d,setSelectedPath:p,activePath:_,activeFile:b,isFilesLoading:x,fileContent:S,isBinary:C,isContentLoading:w}=V(e,t.id),{revisions:E,isLoading:D,isError:O}=X(e,t.id),k=ye({isLoading:D,isError:O,revisionCount:E.length}),[P,F]=(0,K.useState)(`files`),I=k?P:`files`,L=(0,q.jsxs)(`div`,{className:`mb-4 flex items-start gap-3`,children:[(0,q.jsx)(i,{type:`button`,variant:`ghost`,iconOnly:(0,q.jsx)(h,{"aria-hidden":!0}),"aria-label":`Back to skills`,onClick:n}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,q.jsx)(v,{skill:t,className:`h-8 w-8 text-3xl`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,q.jsx)(`h2`,{className:`text-title-medium`,style:{color:`var(--content-default)`},children:t.name}),(0,q.jsx)(g,{origin:t.origin})]}),(0,q.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:t.description}),(0,q.jsx)(B,{skill:{origin:t.origin,sourceConversationId:c},className:`mt-1`})]})]}),l?o?(0,q.jsx)(`div`,{className:`flex h-9 items-center px-3`,children:(0,q.jsx)(M,{className:`h-4 w-4 animate-spin`,style:{color:`var(--content-tertiary)`}})}):(0,q.jsx)(i,{type:`button`,onClick:r,disabled:!r,leftIcon:(0,q.jsx)(m,{"aria-hidden":!0}),children:`Install`}):(0,q.jsx)(i,{type:`button`,variant:u?`dangerOutline`:`outlined`,onClick:a,disabled:!u||s||!a,leftIcon:s?(0,q.jsx)(M,{className:`animate-spin`,"aria-hidden":!0}):(0,q.jsx)(N,{"aria-hidden":!0}),children:`Remove`})]})]}),R=(0,q.jsx)(f.Root,{asChild:!0,noPadding:!0,children:(0,q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden sm:grid`,style:{gridTemplateColumns:`240px 1fr`},children:[(0,q.jsx)(`div`,{className:`max-h-40 shrink-0 overflow-y-auto border-b p-2 sm:max-h-none sm:border-b-0 sm:border-r`,style:{borderColor:`var(--border-base)`},children:x?(0,q.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,q.jsx)(M,{className:`h-4 w-4 animate-spin`,style:{color:`var(--content-tertiary)`}})}):d.length===0?(0,q.jsx)(`p`,{className:`px-3 py-4 text-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`No files available.`}):d.map(e=>{let t=_===e.path,n=(e.mimeType??``).endsWith(`/directory`);return(0,q.jsxs)(`button`,{type:`button`,onClick:()=>p(e.path),className:`flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-body-medium-lighter transition-colors hover:bg-[var(--surface-hover)]`,style:{color:t?`var(--primary-base)`:`var(--content-default)`,backgroundColor:t?`color-mix(in oklab, var(--primary-base) 10%, transparent)`:void 0},children:[n?(0,q.jsx)(j,{className:`h-4 w-4 shrink-0`,style:{color:`var(--system-mid-strong)`}}):(0,q.jsx)(A,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),(0,q.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path)})}),(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:w?(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,q.jsx)(M,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})}):b?(0,q.jsx)(Q,{assistantId:e,skillId:t.id,fileName:b.name,filePath:b.path,content:S,isBinary:C,editable:t.kind===`installed`},`${t.id}/${b.path}`):(0,q.jsx)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Select a file to view its contents.`})})]})});return(0,q.jsxs)(`div`,{className:`flex h-[calc(100vh-14rem)] flex-col`,children:[L,(0,q.jsxs)(T.Root,{value:I,onValueChange:F,className:`flex min-h-0 flex-1 flex-col`,children:[k&&(0,q.jsxs)(T.List,{className:`mb-3`,children:[(0,q.jsx)(T.Trigger,{value:`files`,children:`Files`}),(0,q.jsx)(T.Trigger,{value:`history`,children:`History`})]}),(0,q.jsx)(T.Panel,{value:`files`,forceMount:!0,className:`min-h-0 flex-1 flex-col`,style:{display:I===`files`?`flex`:`none`},children:R}),k&&(0,q.jsx)(T.Panel,{value:`history`,className:`flex min-h-0 flex-1 flex-col`,children:(0,q.jsx)(f.Root,{asChild:!0,noPadding:!0,children:(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,q.jsx)(be,{assistantId:e,skillId:t.id})})})})]})]})}function Q({assistantId:e,skillId:n,fileName:r,filePath:a,content:o,isBinary:s,editable:c}){let u=l(),[d,f]=(0,K.useState)(!1),[p,m]=(0,K.useState)(``),h=`skills/${n}/${a}`,g=re({onSuccess:()=>{f(!1),m(``),u.invalidateQueries({queryKey:[{_id:`skillsByIdFilesContentGet`}]}),u.invalidateQueries({queryKey:[{_id:`skillsByIdFilesGet`}]}),u.invalidateQueries({queryKey:[{_id:`skillsByIdHistoryGet`}]}),a===`SKILL.md`&&U(u,e)},onError:e=>{t(e,{context:`skill-file-save`,bestEffort:!0})}}),_=d&&p!==(o??``),v=(0,K.useCallback)(()=>{!_||g.isPending||g.mutate({path:{assistant_id:e},body:{path:h,content:p,encoding:`utf8`}})},[_,g,e,h,p]),y=(0,K.useCallback)(()=>{f(!0),m(o??``),g.reset()},[o,g]),b=(0,K.useCallback)(()=>{f(!1),m(``),g.reset()},[g]);if(s)return(0,q.jsx)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Binary file — no preview available.`});if(o===null)return(0,q.jsxs)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[`No preview available for `,r,`.`]});let x=c?(0,q.jsx)(i,{variant:`ghost`,size:`regular`,iconOnly:(0,q.jsx)(O,{"aria-hidden":!0}),onClick:()=>void ie(h),"aria-label":`Open in Workspace`,className:`hover:bg-[var(--surface-base)]`}):void 0;return F(r,void 0)&&!d?(0,q.jsx)(`div`,{className:`relative flex h-full flex-col`,children:(0,q.jsxs)(`div`,{className:`relative flex-1 overflow-auto px-6 py-4`,style:{color:`var(--content-default)`},children:[(0,q.jsx)(G,{content:o,fileName:r,showEdit:c,isEditing:!1,onToggleEdit:y,extraActions:x}),(0,q.jsx)(I,{content:o})]})}):(0,q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,q.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,children:[(0,q.jsx)(G,{content:d?p:o,fileName:r,showEdit:c,isEditing:d,onToggleEdit:()=>d?b():y(),extraActions:x}),d?(0,q.jsx)(fe,{value:p,onChange:m,onSave:v}):(0,q.jsx)(ue,{content:o,readOnly:!c,onStartEdit:y})]}),d&&(0,q.jsx)(de,{isDirty:_,isSaving:g.isPending,error:g.isError?`Save failed`:null,onSave:v,onDiscard:b})]})}var Te=e(r(),1);function Ee({fileName:e,content:t,isBinary:n,viewMode:r=`preview`}){return n?(0,q.jsx)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Binary file — no preview available.`}):t===null?(0,q.jsxs)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[`No preview available for `,e,`.`]}):F(e,void 0)&&r===`preview`?(0,q.jsx)(`div`,{className:`h-full overflow-auto px-6 py-4`,style:{color:`var(--content-default)`},children:(0,q.jsx)(I,{content:t})}):(0,q.jsx)(`pre`,{className:`h-full overflow-y-auto whitespace-pre-wrap break-words p-4 font-mono text-body-small-default`,style:{color:`var(--content-default)`},children:t})}function De({assistantId:e,skill:t,onBack:n,onInstall:r,onRemove:a,isInstalling:o=!1,isRemoving:s=!1,swipeContainerRef:c,sourceConversationId:l}){let u=y(t),d=H(t),{fileEntries:p,setSelectedPath:m,activePath:_,activeFile:b,isFilesLoading:x,fileContent:S,isBinary:C,isContentLoading:T}=V(e,t.id),[E,O]=(0,K.useState)(`preview`);(0,K.useEffect)(()=>{O(`preview`)},[_]);let[A,j]=(0,K.useState)(null);(0,K.useEffect)(()=>{j(document.getElementById(`viewport-overlays`))},[]);let N=b?F(b.name,void 0):!1,P=N?E:`raw`,I=(0,q.jsxs)(`div`,{ref:c,className:`fixed inset-0 z-40 flex flex-col overflow-hidden bg-[var(--surface-overlay)]`,style:{paddingTop:`calc(8px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px)))`,paddingBottom:`calc(8px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)))`,paddingLeft:`calc(12px + var(--safe-area-inset-left, env(safe-area-inset-left, 0px)))`,paddingRight:`calc(12px + var(--safe-area-inset-right, env(safe-area-inset-right, 0px)))`},children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(i,{variant:`ghost`,iconOnly:(0,q.jsx)(h,{"aria-hidden":!0}),expandOnMobile:!0,"aria-label":`Back to skills`,onClick:n,className:`max-md:bg-[var(--surface-active)]`}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate px-2 text-center text-body-medium-default`,style:{color:`var(--content-secondary)`},children:t.name}),(0,q.jsx)(Oe,{available:u,removable:d,isInstalling:o,isRemoving:s,onInstall:r,onRemove:a})]}),(0,q.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(v,{skill:t,className:`h-6 w-6 shrink-0 text-[22px] leading-none`}),(0,q.jsx)(`h2`,{className:`min-w-0 truncate text-title-medium`,style:{color:`var(--content-emphasised)`},children:t.name})]}),(0,q.jsx)(g,{origin:t.origin})]}),(0,q.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:t.description}),(0,q.jsx)(B,{skill:{origin:t.origin,sourceConversationId:l}})]}),(0,q.jsx)(f.Root,{asChild:!0,noPadding:!0,children:(0,q.jsxs)(`div`,{className:`mt-6 flex min-h-0 flex-1 flex-col overflow-hidden rounded-2xl border bg-[var(--surface-lift)]`,style:{borderColor:`var(--border-hover)`},children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-3 py-2`,style:{borderColor:`var(--border-hover)`},children:[(0,q.jsx)(Ae,{fileEntries:p,activePath:_,activeName:b?.name??null,onSelect:m}),(0,q.jsx)(D,{iconOnly:!0,ariaLabel:`File view mode`,value:P,onChange:O,items:[{value:`preview`,label:`Preview`,icon:(0,q.jsx)(k,{"aria-hidden":!0}),disabled:!N},{value:`raw`,label:`Source`,icon:(0,q.jsx)(w,{"aria-hidden":!0})}]})]}),(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:x||T?(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,q.jsx)(M,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})}):b?(0,q.jsx)(Ee,{fileName:b.name,content:S,isBinary:C,viewMode:P}):(0,q.jsx)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Select a file to view its contents.`})})]})})]});return A?(0,Te.createPortal)(I,A):I}function Oe({available:e,removable:t,isInstalling:n,isRemoving:r,onInstall:a,onRemove:o}){return n||r?(0,q.jsx)(i,{variant:`ghost`,iconOnly:(0,q.jsx)(M,{className:`animate-spin`,"aria-hidden":!0}),expandOnMobile:!0,disabled:!0,"aria-label":`Pending`,className:`max-md:bg-[var(--surface-active)]`}):e?(0,q.jsx)(i,{variant:`ghost`,iconOnly:(0,q.jsx)(m,{"aria-hidden":!0}),expandOnMobile:!0,"aria-label":`Install skill`,onClick:a,disabled:!a,className:`max-md:bg-[var(--surface-active)]`}):t?(0,q.jsx)(i,{variant:`dangerGhost`,iconOnly:(0,q.jsx)(N,{"aria-hidden":!0}),expandOnMobile:!0,"aria-label":`Remove skill`,onClick:o,disabled:!o,className:`max-md:rounded-full max-md:bg-[var(--system-negative-weak)]`}):(0,q.jsx)(i,{variant:`dangerGhost`,iconOnly:(0,q.jsx)(N,{"aria-hidden":!0}),expandOnMobile:!0,disabled:!0,title:`Bundled skills cannot be removed`,"aria-label":`Bundled skill cannot be removed`,className:`max-md:rounded-full max-md:bg-[var(--system-negative-weak)]`})}function ke(e){return(e??``).endsWith(`/directory`)}function Ae({fileEntries:e,activePath:t,activeName:n,onSelect:r}){let i=n??`Select a file`;return e.length===0?(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-body-medium-default`,style:{color:`var(--content-emphasised)`},children:[(0,q.jsx)($,{}),(0,q.jsx)(`span`,{className:`truncate`,children:i})]}):(0,q.jsxs)(C.Root,{children:[(0,q.jsx)(C.Trigger,{children:(0,q.jsxs)(`button`,{type:`button`,className:`flex min-w-0 items-center gap-2 rounded-md text-body-medium-default`,style:{color:`var(--content-emphasised)`},children:[(0,q.jsx)($,{}),(0,q.jsx)(`span`,{className:`truncate`,children:i}),(0,q.jsx)(x,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0})]})}),(0,q.jsx)(C.Content,{align:`start`,children:e.map(e=>{let n=ke(e.mimeType);return(0,q.jsx)(C.Item,{onSelect:()=>r(e.path),leftIcon:n?(0,q.jsx)(j,{}):(0,q.jsx)(A,{}),"aria-current":e.path===t?`true`:void 0,children:e.name},e.path)})})]})}function $(){return(0,q.jsx)(`span`,{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-[var(--surface-base)]`,"aria-hidden":!0,children:(0,q.jsx)(A,{className:`h-4 w-4`,style:{color:`var(--content-secondary)`}})})}function je(){return(0,q.jsx)(_,{icon:P,iconColor:`var(--system-danger)`,title:`Failed to load skills`,subtitle:`Something went wrong. Try refreshing the page.`})}function Me(){let e=oe(),{skillId:t}=s(),n=a(),r=c(),{pathname:l}=r,d=ae(),f=(0,K.useRef)(null),p=r.state,m=typeof p?.listSearch==`string`?p.listSearch:``,g=u({...ee({path:{assistant_id:e},query:{include:`catalog`}}),select:e=>e.skills,refetchOnMount:`always`}),v=(0,K.useCallback)(()=>{n(`${z.superpowers}${m}`,{replace:!0})},[n,m]);W({containerRef:f,onBack:v,enabled:d,navKey:l,prefetchHref:z.superpowers});let{handleInstall:y,handleRemove:x,isInstallingSkill:S,isRemovingSkill:C,skillPendingRemoval:w,confirmRemove:T,cancelRemove:E}=b(e,{onRemoved:v}),D=g.data,O=(0,K.useMemo)(()=>D?.find(e=>e.id===t)??null,[D,t]),k=u({...te({path:{assistant_id:e,id:t??``}}),enabled:!!t&&O?.origin===`assistant-memory`,select:e=>e.skill.origin===`assistant-memory`?e.skill.sourceConversationId??null:null});if(!t)return(0,q.jsx)(o,{to:z.superpowers,replace:!0});if(g.isLoading)return(0,q.jsx)(J,{});if(g.isError&&!O)return(0,q.jsx)(je,{});if(!O&&g.isFetching)return(0,q.jsx)(J,{});if(!O)return(0,q.jsx)(_,{icon:pe,title:`Skill not found`,subtitle:`This skill may have been removed, or the link is out of date.`,children:(0,q.jsx)(i,{type:`button`,variant:`outlined`,className:`mt-4`,leftIcon:(0,q.jsx)(h,{"aria-hidden":!0}),onClick:v,children:`Back to My Superpowers`})});let A={assistantId:e,skill:O,onBack:v,onInstall:()=>y(O),onRemove:()=>x(O),isInstalling:S(O),isRemoving:C(O),sourceConversationId:k.data??void 0};return(0,q.jsxs)(q.Fragment,{children:[d?(0,q.jsx)(De,{...A,swipeContainerRef:f}):(0,q.jsx)(we,{...A}),(0,q.jsx)(le,{skillName:w?.name??null,onConfirm:T,onCancel:E})]})}export{Me as SkillDetailPage};
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-Cw5vs0Ef.js";import{t as n}from"./react-BFJW0bSv.js";import{W as r,t as i}from"./button-BENY-yx_.js";import{d as a,n as o,p as s,u as c}from"./chunk-5KNZJZUH-BUqIilZr.js";import{n as l}from"./QueryClientProvider-CMu7CkQU.js";import{t as u}from"./useQuery-Bz-fbQ-m.js";import{t as d}from"./jsx-runtime-D3ZM-ToX.js";import{t as f}from"./card-q0GJX1HZ.js";import{t as p}from"./createLucideIcon-C1mdGPB9.js";import{t as m}from"./arrow-down-to-line-DmG4pLoU.js";import{t as h}from"./arrow-left-BikDV6F2.js";import{a as g,n as _,o as v,r as y,t as b}from"./use-skill-actions-BopRxJ9x.js";import{t as x}from"./chevron-down-CrFV6lfm.js";import{t as S}from"./chevron-right-DBGgpEiZ.js";import{t as C}from"./menu-DKE_-iVc.js";import{t as w}from"./code-DwZ6Mhdw.js";import{B as T,V as E,o as D}from"./src-DyqTPMO2.js";import{t as O}from"./external-link-vwewPjbo.js";import{t as k}from"./eye-GcssNJdY.js";import{t as A}from"./file-text-DDbRSMUn.js";import{t as j}from"./folder-DBR-Zigu.js";import{t as M}from"./loader-circle-DOtGXcds.js";import{t as N}from"./trash-2-BKXSi5Tj.js";import{t as P}from"./triangle-alert-CB4pJgCL.js";import{n as F,t as I}from"./file-markdown-CGC6ZrPT.js";import{a as L}from"./api-errors-BQX1Pzcm.js";import{_r as R}from"./sdk.gen-CBPZ2IdN.js";import{d as z}from"./routes-iipg2wkc.js";import{At as ee,Dt as te,Ot as ne,_n as re}from"./react-query.gen-DxjuNs-5.js";import{t as ie}from"./open-workspace-file-DViQQLp4.js";import{n as ae}from"./use-is-mobile-BP8UePsY.js";import{t as oe}from"./use-active-assistant-id-BvHP5Ojg.js";import{i as se,r as ce}from"./format-date-Bi9Bsv-w.js";import{n as B,t as V}from"./use-skill-detail-files-DUcVEycw.js";import{n as H,r as le,t as U}from"./skills-B4bfakyU.js";import{t as W}from"./use-edge-swipe-back-BGq52vVr.js";import{i as ue,n as de,r as fe,t as G}from"./file-editor-DOnVeKOG.js";var pe=p(`search-x`,[[`path`,{d:`m13.5 8.5-5 5`,key:`1cs55j`}],[`path`,{d:`m8.5 8.5 5 5`,key:`a8mexj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),K=e(n(),1),q=d();function J(){return(0,q.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,q.jsx)(M,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})})}var me=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/,he=/^diff --git a\/(.+) b\/\1$/;function Y(e,t){let n=e.replace(/^[ab]\//,``),r=`skills/${t}/`;return n.startsWith(r)?n.slice(r.length):n}function ge(e){let t=e.slice(4).replace(/\t$/,``);return t===`/dev/null`?null:t}function _e(e,t){let n=[],r=null,i=0,a=0,o=!1,s=!1;for(let c of e.split(`
|
|
2
|
+
`)){if(c.startsWith(`diff --git `)){r={path:Y(he.exec(c)?.[1]??(c.split(` `).slice(3).join(` `)||``),t),rows:[],added:0,removed:0},n.push(r),i=0,a=0,o=!1,s=!1;continue}if(!r)continue;let e=me.exec(c);if(e){i=Number(e[1]),a=Number(e[2]),o=!0,r.rows.length>0&&r.rows.push({type:`meta`,text:c});continue}if(!c.startsWith(`\\ No newline`)){if(!o&&(c.startsWith(`+++ `)||c.startsWith(`--- `))){let e=ge(c);e!==null&&(c.startsWith(`+++ `)||!s)&&(r.path=Y(e,t),s=c.startsWith(`+++ `));continue}!o&&(c.startsWith(`index `)||c.startsWith(`new file mode `)||c.startsWith(`deleted file mode `)||c.startsWith(`similarity index `)||c.startsWith(`rename `)||c.startsWith(`old mode `)||c.startsWith(`new mode `)||c.startsWith(`Binary files `))||(c.startsWith(`+`)?(r.rows.push({type:`add`,text:c.slice(1),newNo:a}),r.added+=1,a+=1):c.startsWith(`-`)?(r.rows.push({type:`del`,text:c.slice(1),oldNo:i}),r.removed+=1,i+=1):c.startsWith(` `)&&(r.rows.push({type:`ctx`,text:c.slice(1),oldNo:i,newNo:a}),i+=1,a+=1))}}return{files:n,added:n.reduce((e,t)=>e+t.added,0),removed:n.reduce((e,t)=>e+t.removed,0)}}async function ve(e,t,n){let{data:r,error:i,response:a}=await R({path:{assistant_id:e,id:t},throwOnError:!1,signal:n});if(!a||!a.ok){if(a?.status===404)return null;throw a?L(i,a):i??Error(`Failed to fetch skill history.`)}return r??null}function ye(e){return e.isLoading?!1:e.isError||e.revisionCount>0}function X(e,t){let n=!!(e&&t),r=u({queryKey:ne({path:{assistant_id:e??``,id:t}}),queryFn:({signal:n})=>ve(e??``,t,n),enabled:n,refetchOnWindowFocus:!1});return{history:r.data??null,revisions:r.data?.revisions??[],truncatedByCompaction:r.data?.truncatedByCompaction??!1,isLoading:r.isLoading,isError:r.isError}}function be({assistantId:e,skillId:t}){let{revisions:n,truncatedByCompaction:r,isLoading:i,isError:a}=X(e,t);return i?(0,q.jsx)(J,{}):a?(0,q.jsx)(Z,{children:`Couldn't load revision history.`}):(0,q.jsx)(xe,{skillId:t,revisions:n,truncatedByCompaction:r})}function xe({skillId:e,revisions:t,truncatedByCompaction:n}){return t.length===0?(0,q.jsx)(Z,{children:`No changes recorded yet.`}):(0,q.jsxs)(D.Root,{type:`multiple`,className:`flex flex-col gap-2 p-3`,children:[t.map(t=>(0,q.jsx)(Se,{revision:t,skillId:e},t.id)),n&&(0,q.jsx)(`p`,{className:`px-1 pt-1 text-body-small-lighter`,style:{color:`var(--content-tertiary)`},children:`Showing recent changes. Older history is periodically compacted, so this may not reach back to when the skill was created.`})]})}function Z({children:e}){return(0,q.jsx)(`p`,{className:`px-3 py-10 text-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:e})}function Se({revision:e,skillId:t}){let n=(0,K.useMemo)(()=>_e(e.diff,t),[e.diff,t]);return(0,q.jsxs)(D.Item,{value:e.id,className:`overflow-hidden rounded-md border`,style:{borderColor:`var(--border-base)`},children:[(0,q.jsxs)(D.Trigger,{className:`group flex w-full items-center gap-3 px-3 py-2.5 text-left transition-colors hover:bg-[var(--surface-hover)]`,children:[(0,q.jsx)(S,{className:`h-4 w-4 shrink-0 transition-transform group-data-[state=open]:rotate-90`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`block truncate text-body-medium-default`,style:{color:`var(--content-default)`},children:se(e.changedAt)}),(0,q.jsx)(`span`,{className:`mt-0.5 block truncate text-body-small-lighter`,style:{color:`var(--content-tertiary)`},children:e.files.join(` · `)})]}),n.added>0&&(0,q.jsxs)(`span`,{className:`shrink-0 text-body-small-default tabular-nums`,style:{color:`var(--system-positive-strong)`},children:[`+`,n.added]}),n.removed>0&&(0,q.jsxs)(`span`,{className:`shrink-0 text-body-small-default tabular-nums`,style:{color:`var(--system-negative-strong)`},children:[`−`,n.removed]})]}),(0,q.jsxs)(D.Content,{className:`border-t`,style:{borderColor:`var(--border-base)`},children:[(0,q.jsx)(`p`,{className:`px-3 py-2 text-body-small-lighter`,style:{color:`var(--content-tertiary)`},children:ce(e.changedAt)}),n.files.length===0?(0,q.jsx)(`p`,{className:`px-3 pb-3 text-body-small-lighter`,style:{color:`var(--content-tertiary)`},children:`No preview available for this change.`}):n.files.map(e=>(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`border-t px-3 py-1.5 font-mono text-body-small-default`,style:{borderColor:`var(--border-base)`,backgroundColor:`var(--surface-base)`,color:`var(--content-secondary)`},children:e.path}),(0,q.jsx)(`div`,{className:`overflow-x-auto py-1 font-mono text-body-small-lighter`,children:e.rows.map((e,t)=>(0,q.jsx)(Ce,{row:e},t))})]},e.path))]})]})}function Ce({row:e}){if(e.type===`meta`)return(0,q.jsx)(`div`,{className:`px-3 py-0.5`,style:{color:`var(--content-faint)`},"aria-hidden":!0,children:`⋯`});let t=e.type===`add`,n=e.type===`del`;return(0,q.jsxs)(`div`,{className:`flex whitespace-pre`,style:{backgroundColor:t?`var(--system-positive-weak)`:n?`var(--system-negative-weak)`:void 0,color:t?`var(--system-positive-strong)`:n?`var(--system-negative-strong)`:`var(--content-secondary)`},children:[(0,q.jsx)(`span`,{className:`w-10 shrink-0 pr-2 text-right tabular-nums`,style:{color:`var(--content-faint)`},children:e.oldNo??``}),(0,q.jsx)(`span`,{className:`w-10 shrink-0 pr-2 text-right tabular-nums`,style:{color:`var(--content-faint)`},children:e.newNo??``}),(0,q.jsx)(`span`,{className:`w-4 shrink-0 text-center`,children:t?`+`:n?`-`:` `}),(0,q.jsx)(`span`,{className:`flex-1 pr-3`,children:e.text})]})}function we({assistantId:e,skill:t,onBack:n,onInstall:r,onRemove:a,isInstalling:o=!1,isRemoving:s=!1,sourceConversationId:c}){let l=y(t),u=H(t),{fileEntries:d,setSelectedPath:p,activePath:_,activeFile:b,isFilesLoading:x,fileContent:S,isBinary:C,isContentLoading:w}=V(e,t.id),{revisions:T,isLoading:D,isError:O}=X(e,t.id),k=ye({isLoading:D,isError:O,revisionCount:T.length}),[P,F]=(0,K.useState)(`files`),I=k?P:`files`,L=(0,q.jsxs)(`div`,{className:`mb-4 flex items-start gap-3`,children:[(0,q.jsx)(i,{type:`button`,variant:`ghost`,iconOnly:(0,q.jsx)(h,{"aria-hidden":!0}),"aria-label":`Back to skills`,onClick:n}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,q.jsx)(v,{skill:t,className:`h-8 w-8 text-3xl`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,q.jsx)(`h2`,{className:`text-title-medium`,style:{color:`var(--content-default)`},children:t.name}),(0,q.jsx)(g,{origin:t.origin})]}),(0,q.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:t.description}),(0,q.jsx)(B,{skill:{origin:t.origin,sourceConversationId:c},className:`mt-1`})]})]}),l?o?(0,q.jsx)(`div`,{className:`flex h-9 items-center px-3`,children:(0,q.jsx)(M,{className:`h-4 w-4 animate-spin`,style:{color:`var(--content-tertiary)`}})}):(0,q.jsx)(i,{type:`button`,onClick:r,disabled:!r,leftIcon:(0,q.jsx)(m,{"aria-hidden":!0}),children:`Install`}):(0,q.jsx)(i,{type:`button`,variant:u?`dangerOutline`:`outlined`,onClick:a,disabled:!u||s||!a,leftIcon:s?(0,q.jsx)(M,{className:`animate-spin`,"aria-hidden":!0}):(0,q.jsx)(N,{"aria-hidden":!0}),children:`Remove`})]})]}),R=(0,q.jsx)(f.Root,{asChild:!0,noPadding:!0,children:(0,q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden sm:grid`,style:{gridTemplateColumns:`240px 1fr`},children:[(0,q.jsx)(`div`,{className:`max-h-40 shrink-0 overflow-y-auto border-b p-2 sm:max-h-none sm:border-b-0 sm:border-r`,style:{borderColor:`var(--border-base)`},children:x?(0,q.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,q.jsx)(M,{className:`h-4 w-4 animate-spin`,style:{color:`var(--content-tertiary)`}})}):d.length===0?(0,q.jsx)(`p`,{className:`px-3 py-4 text-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`No files available.`}):d.map(e=>{let t=_===e.path,n=(e.mimeType??``).endsWith(`/directory`);return(0,q.jsxs)(`button`,{type:`button`,onClick:()=>p(e.path),className:`flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-body-medium-lighter transition-colors hover:bg-[var(--surface-hover)]`,style:{color:t?`var(--primary-base)`:`var(--content-default)`,backgroundColor:t?`color-mix(in oklab, var(--primary-base) 10%, transparent)`:void 0},children:[n?(0,q.jsx)(j,{className:`h-4 w-4 shrink-0`,style:{color:`var(--system-mid-strong)`}}):(0,q.jsx)(A,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),(0,q.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path)})}),(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:w?(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,q.jsx)(M,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})}):b?(0,q.jsx)(Q,{assistantId:e,skillId:t.id,fileName:b.name,filePath:b.path,content:S,isBinary:C,editable:t.kind===`installed`},`${t.id}/${b.path}`):(0,q.jsx)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Select a file to view its contents.`})})]})});return(0,q.jsxs)(`div`,{className:`flex h-[calc(100vh-14rem)] flex-col`,children:[L,(0,q.jsxs)(E.Root,{value:I,onValueChange:F,className:`flex min-h-0 flex-1 flex-col`,children:[k&&(0,q.jsxs)(E.List,{className:`mb-3`,children:[(0,q.jsx)(E.Trigger,{value:`files`,children:`Files`}),(0,q.jsx)(E.Trigger,{value:`history`,children:`History`})]}),(0,q.jsx)(E.Panel,{value:`files`,forceMount:!0,className:`min-h-0 flex-1 flex-col`,style:{display:I===`files`?`flex`:`none`},children:R}),k&&(0,q.jsx)(E.Panel,{value:`history`,className:`flex min-h-0 flex-1 flex-col`,children:(0,q.jsx)(f.Root,{asChild:!0,noPadding:!0,children:(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,q.jsx)(be,{assistantId:e,skillId:t.id})})})})]})]})}function Q({assistantId:e,skillId:n,fileName:r,filePath:a,content:o,isBinary:s,editable:c}){let u=l(),[d,f]=(0,K.useState)(!1),[p,m]=(0,K.useState)(``),h=`skills/${n}/${a}`,g=re({onSuccess:()=>{f(!1),m(``),u.invalidateQueries({queryKey:[{_id:`skillsByIdFilesContentGet`}]}),u.invalidateQueries({queryKey:[{_id:`skillsByIdFilesGet`}]}),u.invalidateQueries({queryKey:[{_id:`skillsByIdHistoryGet`}]}),a===`SKILL.md`&&U(u,e)},onError:e=>{t(e,{context:`skill-file-save`,bestEffort:!0})}}),_=d&&p!==(o??``),v=(0,K.useCallback)(()=>{!_||g.isPending||g.mutate({path:{assistant_id:e},body:{path:h,content:p,encoding:`utf8`}})},[_,g,e,h,p]),y=(0,K.useCallback)(()=>{f(!0),m(o??``),g.reset()},[o,g]),b=(0,K.useCallback)(()=>{f(!1),m(``),g.reset()},[g]);if(s)return(0,q.jsx)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Binary file — no preview available.`});if(o===null)return(0,q.jsxs)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[`No preview available for `,r,`.`]});let x=c?(0,q.jsx)(i,{variant:`ghost`,size:`regular`,iconOnly:(0,q.jsx)(O,{"aria-hidden":!0}),onClick:()=>void ie(h),"aria-label":`Open in Workspace`,className:`hover:bg-[var(--surface-base)]`}):void 0;return F(r,void 0)&&!d?(0,q.jsx)(`div`,{className:`relative flex h-full flex-col`,children:(0,q.jsxs)(`div`,{className:`relative flex-1 overflow-auto px-6 py-4`,style:{color:`var(--content-default)`},children:[(0,q.jsx)(G,{content:o,fileName:r,showEdit:c,isEditing:!1,onToggleEdit:y,extraActions:x}),(0,q.jsx)(I,{content:o})]})}):(0,q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,q.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,children:[(0,q.jsx)(G,{content:d?p:o,fileName:r,showEdit:c,isEditing:d,onToggleEdit:()=>d?b():y(),extraActions:x}),d?(0,q.jsx)(fe,{value:p,onChange:m,onSave:v}):(0,q.jsx)(ue,{content:o,readOnly:!c,onStartEdit:y})]}),d&&(0,q.jsx)(de,{isDirty:_,isSaving:g.isPending,error:g.isError?`Save failed`:null,onSave:v,onDiscard:b})]})}var Te=e(r(),1);function Ee({fileName:e,content:t,isBinary:n,viewMode:r=`preview`}){return n?(0,q.jsx)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Binary file — no preview available.`}):t===null?(0,q.jsxs)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[`No preview available for `,e,`.`]}):F(e,void 0)&&r===`preview`?(0,q.jsx)(`div`,{className:`h-full overflow-auto px-6 py-4`,style:{color:`var(--content-default)`},children:(0,q.jsx)(I,{content:t})}):(0,q.jsx)(`pre`,{className:`h-full overflow-y-auto whitespace-pre-wrap break-words p-4 font-mono text-body-small-default`,style:{color:`var(--content-default)`},children:t})}function De({assistantId:e,skill:t,onBack:n,onInstall:r,onRemove:a,isInstalling:o=!1,isRemoving:s=!1,swipeContainerRef:c,sourceConversationId:l}){let u=y(t),d=H(t),{fileEntries:p,setSelectedPath:m,activePath:_,activeFile:b,isFilesLoading:x,fileContent:S,isBinary:C,isContentLoading:E}=V(e,t.id),[D,O]=(0,K.useState)(`preview`);(0,K.useEffect)(()=>{O(`preview`)},[_]);let[A,j]=(0,K.useState)(null);(0,K.useEffect)(()=>{j(document.getElementById(`viewport-overlays`))},[]);let N=b?F(b.name,void 0):!1,P=N?D:`raw`,I=(0,q.jsxs)(`div`,{ref:c,className:`fixed inset-0 z-40 flex flex-col overflow-hidden bg-[var(--surface-overlay)]`,style:{paddingTop:`calc(8px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px)))`,paddingBottom:`calc(8px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)))`,paddingLeft:`calc(12px + var(--safe-area-inset-left, env(safe-area-inset-left, 0px)))`,paddingRight:`calc(12px + var(--safe-area-inset-right, env(safe-area-inset-right, 0px)))`},children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(i,{variant:`ghost`,iconOnly:(0,q.jsx)(h,{"aria-hidden":!0}),expandOnMobile:!0,"aria-label":`Back to skills`,onClick:n,className:`max-md:bg-[var(--surface-active)]`}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate px-2 text-center text-body-medium-default`,style:{color:`var(--content-secondary)`},children:t.name}),(0,q.jsx)(Oe,{available:u,removable:d,isInstalling:o,isRemoving:s,onInstall:r,onRemove:a})]}),(0,q.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(v,{skill:t,className:`h-6 w-6 shrink-0 text-[22px] leading-none`}),(0,q.jsx)(`h2`,{className:`min-w-0 truncate text-title-medium`,style:{color:`var(--content-emphasised)`},children:t.name})]}),(0,q.jsx)(g,{origin:t.origin})]}),(0,q.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:t.description}),(0,q.jsx)(B,{skill:{origin:t.origin,sourceConversationId:l}})]}),(0,q.jsx)(f.Root,{asChild:!0,noPadding:!0,children:(0,q.jsxs)(`div`,{className:`mt-6 flex min-h-0 flex-1 flex-col overflow-hidden rounded-2xl border bg-[var(--surface-lift)]`,style:{borderColor:`var(--border-hover)`},children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-3 py-2`,style:{borderColor:`var(--border-hover)`},children:[(0,q.jsx)(Ae,{fileEntries:p,activePath:_,activeName:b?.name??null,onSelect:m}),(0,q.jsx)(T,{iconOnly:!0,ariaLabel:`File view mode`,value:P,onChange:O,items:[{value:`preview`,label:`Preview`,icon:(0,q.jsx)(k,{"aria-hidden":!0}),disabled:!N},{value:`raw`,label:`Source`,icon:(0,q.jsx)(w,{"aria-hidden":!0})}]})]}),(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:x||E?(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,q.jsx)(M,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})}):b?(0,q.jsx)(Ee,{fileName:b.name,content:S,isBinary:C,viewMode:P}):(0,q.jsx)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Select a file to view its contents.`})})]})})]});return A?(0,Te.createPortal)(I,A):I}function Oe({available:e,removable:t,isInstalling:n,isRemoving:r,onInstall:a,onRemove:o}){return n||r?(0,q.jsx)(i,{variant:`ghost`,iconOnly:(0,q.jsx)(M,{className:`animate-spin`,"aria-hidden":!0}),expandOnMobile:!0,disabled:!0,"aria-label":`Pending`,className:`max-md:bg-[var(--surface-active)]`}):e?(0,q.jsx)(i,{variant:`ghost`,iconOnly:(0,q.jsx)(m,{"aria-hidden":!0}),expandOnMobile:!0,"aria-label":`Install skill`,onClick:a,disabled:!a,className:`max-md:bg-[var(--surface-active)]`}):t?(0,q.jsx)(i,{variant:`dangerGhost`,iconOnly:(0,q.jsx)(N,{"aria-hidden":!0}),expandOnMobile:!0,"aria-label":`Remove skill`,onClick:o,disabled:!o,className:`max-md:rounded-full max-md:bg-[var(--system-negative-weak)]`}):(0,q.jsx)(i,{variant:`dangerGhost`,iconOnly:(0,q.jsx)(N,{"aria-hidden":!0}),expandOnMobile:!0,disabled:!0,title:`Bundled skills cannot be removed`,"aria-label":`Bundled skill cannot be removed`,className:`max-md:rounded-full max-md:bg-[var(--system-negative-weak)]`})}function ke(e){return(e??``).endsWith(`/directory`)}function Ae({fileEntries:e,activePath:t,activeName:n,onSelect:r}){let i=n??`Select a file`;return e.length===0?(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-body-medium-default`,style:{color:`var(--content-emphasised)`},children:[(0,q.jsx)($,{}),(0,q.jsx)(`span`,{className:`truncate`,children:i})]}):(0,q.jsxs)(C.Root,{children:[(0,q.jsx)(C.Trigger,{children:(0,q.jsxs)(`button`,{type:`button`,className:`flex min-w-0 items-center gap-2 rounded-md text-body-medium-default`,style:{color:`var(--content-emphasised)`},children:[(0,q.jsx)($,{}),(0,q.jsx)(`span`,{className:`truncate`,children:i}),(0,q.jsx)(x,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0})]})}),(0,q.jsx)(C.Content,{align:`start`,children:e.map(e=>{let n=ke(e.mimeType);return(0,q.jsx)(C.Item,{onSelect:()=>r(e.path),leftIcon:n?(0,q.jsx)(j,{}):(0,q.jsx)(A,{}),"aria-current":e.path===t?`true`:void 0,children:e.name},e.path)})})]})}function $(){return(0,q.jsx)(`span`,{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-[var(--surface-base)]`,"aria-hidden":!0,children:(0,q.jsx)(A,{className:`h-4 w-4`,style:{color:`var(--content-secondary)`}})})}function je(){return(0,q.jsx)(_,{icon:P,iconColor:`var(--system-danger)`,title:`Failed to load skills`,subtitle:`Something went wrong. Try refreshing the page.`})}function Me(){let e=oe(),{skillId:t}=s(),n=a(),r=c(),{pathname:l}=r,d=ae(),f=(0,K.useRef)(null),p=r.state,m=typeof p?.listSearch==`string`?p.listSearch:``,g=u({...ee({path:{assistant_id:e},query:{include:`catalog`}}),select:e=>e.skills,refetchOnMount:`always`}),v=(0,K.useCallback)(()=>{n(`${z.superpowers}${m}`,{replace:!0})},[n,m]);W({containerRef:f,onBack:v,enabled:d,navKey:l,prefetchHref:z.superpowers});let{handleInstall:y,handleRemove:x,isInstallingSkill:S,isRemovingSkill:C,skillPendingRemoval:w,confirmRemove:T,cancelRemove:E}=b(e,{onRemoved:v}),D=g.data,O=(0,K.useMemo)(()=>D?.find(e=>e.id===t)??null,[D,t]),k=u({...te({path:{assistant_id:e,id:t??``}}),enabled:!!t&&O?.origin===`assistant-memory`,select:e=>e.skill.origin===`assistant-memory`?e.skill.sourceConversationId??null:null});if(!t)return(0,q.jsx)(o,{to:z.superpowers,replace:!0});if(g.isLoading)return(0,q.jsx)(J,{});if(g.isError&&!O)return(0,q.jsx)(je,{});if(!O&&g.isFetching)return(0,q.jsx)(J,{});if(!O)return(0,q.jsx)(_,{icon:pe,title:`Skill not found`,subtitle:`This skill may have been removed, or the link is out of date.`,children:(0,q.jsx)(i,{type:`button`,variant:`outlined`,className:`mt-4`,leftIcon:(0,q.jsx)(h,{"aria-hidden":!0}),onClick:v,children:`Back to My Superpowers`})});let A={assistantId:e,skill:O,onBack:v,onInstall:()=>y(O),onRemove:()=>x(O),isInstalling:S(O),isRemoving:C(O),sourceConversationId:k.data??void 0};return(0,q.jsxs)(q.Fragment,{children:[d?(0,q.jsx)(De,{...A,swipeContainerRef:f}):(0,q.jsx)(we,{...A}),(0,q.jsx)(le,{skillName:w?.name??null,onConfirm:T,onCancel:E})]})}export{Me as SkillDetailPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-Cw5vs0Ef.js";import{t as n}from"./react-BFJW0bSv.js";import{t as r}from"./button-BENY-yx_.js";import{d as i}from"./chunk-5KNZJZUH-BUqIilZr.js";import{n as a}from"./QueryClientProvider-CMu7CkQU.js";import{t as o}from"./useQuery-Bz-fbQ-m.js";import{t as s}from"./jsx-runtime-D3ZM-ToX.js";import{t as c}from"./typography-BeUa5Fd-.js";import{t as l}from"./brain-ZiC0HCCF.js";import{t as u}from"./menu-DKE_-iVc.js";import"./src-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-Cw5vs0Ef.js";import{t as n}from"./react-BFJW0bSv.js";import{t as r}from"./button-BENY-yx_.js";import{d as i}from"./chunk-5KNZJZUH-BUqIilZr.js";import{n as a}from"./QueryClientProvider-CMu7CkQU.js";import{t as o}from"./useQuery-Bz-fbQ-m.js";import{t as s}from"./jsx-runtime-D3ZM-ToX.js";import{t as c}from"./typography-BeUa5Fd-.js";import{t as l}from"./brain-ZiC0HCCF.js";import{t as u}from"./menu-DKE_-iVc.js";import"./src-DyqTPMO2.js";import{t as d}from"./ellipsis-C7C3LPFH.js";import{t as f}from"./loader-circle-DOtGXcds.js";import{t as p}from"./trash-2-BKXSi5Tj.js";import{t as m}from"./file-markdown-CGC6ZrPT.js";import{n as h}from"./resolved-assistants-store-BFI9c7ip.js";import{d as g}from"./routes-iipg2wkc.js";import{Dt as _,gn as v}from"./react-query.gen-DxjuNs-5.js";import{t as y}from"./detail-shell-PCaxY4Tf.js";import{n as b,t as x}from"./use-skill-detail-files-DUcVEycw.js";import{n as S,r as C,t as w}from"./skills-B4bfakyU.js";var T=e(n(),1),E=s();function D({skillId:e,onClose:n}){let s=i(),D=a(),O=h.use.activeAssistantId(),[k,A]=(0,T.useState)(!1),j=o({..._({path:{assistant_id:O??``,id:e}}),select:e=>e.skill,enabled:!!O}),M=j.data,{skillMd:N,fileContent:P,isFilesPending:F,isContentPending:I}=x(O,e),L=v({onSuccess:()=>{O&&w(D,O),n()},onError:e=>{t(e,{context:`skill-detail-panel-remove`})}}),R=()=>{O&&(L.mutate({path:{assistant_id:O,id:e}}),A(!1))},z=j.isPending||F||N!=null&&I,B=M!=null&&S(M);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(y,{icon:M?.emoji?(0,E.jsx)(`span`,{className:`text-xl leading-none`,"aria-hidden":!0,children:M.emoji}):void 0,Glyph:l,title:M?.name??`Skill`,closeLabel:`Close skill details`,onClose:n,headerActions:B?(0,E.jsxs)(u.Root,{children:[(0,E.jsx)(u.Trigger,{asChild:!0,children:(0,E.jsx)(r,{variant:`ghost`,iconOnly:(0,E.jsx)(d,{}),"aria-label":`Skill actions`,className:`shrink-0`})}),(0,E.jsx)(u.Content,{side:`bottom`,align:`end`,children:(0,E.jsx)(u.Item,{leftIcon:(0,E.jsx)(p,{size:14}),onSelect:()=>A(!0),children:`Remove skill`})})]}):void 0,footer:(0,E.jsx)(r,{fullWidth:!0,onClick:()=>s(g.skills.detail(e)),children:`Go to Skill`}),children:j.isError&&!M?(0,E.jsx)(c,{variant:`body-medium-lighter`,as:`p`,className:`py-8 text-center text-[var(--content-tertiary)]`,children:`This skill could not be loaded. It may have been removed.`}):z?(0,E.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,E.jsx)(f,{className:`h-5 w-5 animate-spin text-[var(--content-tertiary)]`})}):(0,E.jsxs)(E.Fragment,{children:[M?.description&&(0,E.jsx)(c,{variant:`body-medium-lighter`,as:`p`,className:`mb-4 text-[var(--content-secondary)]`,children:M.description}),M&&(0,E.jsx)(b,{skill:M,className:`mb-4`,onNavigate:n}),P&&(0,E.jsx)(m,{content:P})]})}),(0,E.jsx)(C,{skillName:k&&M?M.name:null,onConfirm:R,onCancel:()=>A(!1)})]})}export{D as SkillDetailPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-D3ZM-ToX.js";import"./src-
|
|
1
|
+
import{t as e}from"./jsx-runtime-D3ZM-ToX.js";import"./src-DyqTPMO2.js";import{t}from"./confirm-dialog-zx8L9sUi.js";import{jt as n}from"./react-query.gen-DxjuNs-5.js";var r=e();function i({skillName:e,onConfirm:n,onCancel:i}){return(0,r.jsx)(t,{open:e!==null,title:`Remove skill`,message:e?`Remove "${e}" from this assistant?`:``,confirmLabel:`Remove`,destructive:!0,onConfirm:n,onCancel:i})}function a(e){return e.kind===`installed`}function o(e,t){e.invalidateQueries({queryKey:n({path:{assistant_id:t}})})}export{a as n,i as r,o as t};
|