@vellumai/web 0.11.1-staging.1 → 0.11.1-staging.2

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.
Files changed (134) hide show
  1. package/dist/assets/{access-Cms1bEme.js → access-C97H-xHb.js} +1 -1
  2. package/dist/assets/{account-page-inWgS0vI.js → account-page-Cflmw8J6.js} +1 -1
  3. package/dist/assets/{account-shell-BTUVn2Xx.js → account-shell-BxZ339N3.js} +1 -1
  4. package/dist/assets/{acp-run-detail-panel-B4LJiMqg.js → acp-run-detail-panel-BZ36-1N5.js} +1 -1
  5. package/dist/assets/{activity-steps-panel-V8cTQq1e.js → activity-steps-panel-KMiSlUt3.js} +1 -1
  6. package/dist/assets/{add-credits-modal-kXRkAbd-.js → add-credits-modal-Daz6j8gm.js} +1 -1
  7. package/dist/assets/{ai-page-BwBXejbF.js → ai-page-DPVi-dhB.js} +1 -1
  8. package/dist/assets/{api-Cg8AYMGi.js → api-C8TlQNEU.js} +1 -1
  9. package/dist/assets/api-DDKNgE8n.js +1 -0
  10. package/dist/assets/{api-key-screen-DgcT6PN1.js → api-key-screen-CoLZh8vw.js} +1 -1
  11. package/dist/assets/{app-card-DpKhIlQh.js → app-card-JHbWefmm.js} +1 -1
  12. package/dist/assets/{assistant-status-panel-RXjaS1rn.js → assistant-status-panel-CLMAEQ-v.js} +1 -1
  13. package/dist/assets/{auth-store-BhQdM8W1.js → auth-store-w_EmIQP7.js} +1 -1
  14. package/dist/assets/{avatar-random-pa0KKSz4.js → avatar-random-IysJ0Bdt.js} +1 -1
  15. package/dist/assets/{background-task-actions-XdNtOXmP.js → background-task-actions-yrapeY1n.js} +1 -1
  16. package/dist/assets/{background-task-detail-panel-En7JxNg1.js → background-task-detail-panel-BV9Y227f.js} +1 -1
  17. package/dist/assets/{billing-page-CPd78lB7.js → billing-page-CmkTn62f.js} +1 -1
  18. package/dist/assets/{bookmarks-page-C56JeUsQ.js → bookmarks-page-B2JvSaKf.js} +1 -1
  19. package/dist/assets/{build-state-Bpy5oGW4.js → build-state-DDUJ0MId.js} +1 -1
  20. package/dist/assets/{channels-page-route-BTgUcK8C.js → channels-page-route-DAp7F6ed.js} +1 -1
  21. package/dist/assets/{chat-markdown-message-C-vt9hP_.js → chat-markdown-message-B3Qo04ug.js} +1 -1
  22. package/dist/assets/{checkout-page-Dd-cMev5.js → checkout-page-B8CJoCWQ.js} +1 -1
  23. package/dist/assets/{command-palette-I4bL0EMa.js → command-palette-DH_ybPTY.js} +1 -1
  24. package/dist/assets/{command-palette-window-page-Ci9G8bay.js → command-palette-window-page-KoC7mrpM.js} +1 -1
  25. package/dist/assets/{contacts-page-route-D2BhoJd2.js → contacts-page-route-BJBOnSQK.js} +1 -1
  26. package/dist/assets/{conversation-navigation-D6JNBpfW.js → conversation-navigation-tj2ntPAn.js} +1 -1
  27. package/dist/assets/{conversation-queries-pl1gz6ie.js → conversation-queries-str0jfqv.js} +1 -1
  28. package/dist/assets/{credentials-page-AhDinoZ1.js → credentials-page-DFm5A_Dj.js} +1 -1
  29. package/dist/assets/{debug-page-CK_oYzi-.js → debug-page-6DjAgWtl.js} +1 -1
  30. package/dist/assets/{deploy-dialogs-aZOTf3Se.js → deploy-dialogs-CpUMrpHq.js} +1 -1
  31. package/dist/assets/{deploy-store-CnVNbznH.js → deploy-store-BJ-njgv-.js} +1 -1
  32. package/dist/assets/{detail-card-BQsM7aVb.js → detail-card-D-5EWmAS.js} +1 -1
  33. package/dist/assets/{detail-drawer-CXL5e2Tu.js → detail-drawer-BglFkWVa.js} +1 -1
  34. package/dist/assets/{detail-panel-stop-button-BB_udTHK.js → detail-panel-stop-button-DgKaA6yz.js} +1 -1
  35. package/dist/assets/{detail-shell-aB8B_tLZ.js → detail-shell-D9L3L7AM.js} +1 -1
  36. package/dist/assets/{developer-page-onLldZbG.js → developer-page-dHmIDclp.js} +1 -1
  37. package/dist/assets/{document-viewer-container-BWkL66R6.js → document-viewer-container-Doc7G7NK.js} +2 -2
  38. package/dist/assets/{document-viewer-page-BrUMyoc1.js → document-viewer-page-DJFR9XhM.js} +1 -1
  39. package/dist/assets/{dropdown-Dt0Iof85.js → dropdown-DswWMJhz.js} +1 -1
  40. package/dist/assets/{emails-page--_07UalM.js → emails-page-Ro1_IIiv.js} +1 -1
  41. package/dist/assets/{file-markdown-DYpaSkNo.js → file-markdown-DBLxtb0M.js} +1 -1
  42. package/dist/assets/{first-run-scope-CRBSt0Wi.js → first-run-scope-CZm4WhC7.js} +1 -1
  43. package/dist/assets/{general-page-zY9TVscp.js → general-page-BH3Zl4tV.js} +1 -1
  44. package/dist/assets/{handle-logout-CJkbJFqo.js → handle-logout-C_CDLqjS.js} +1 -1
  45. package/dist/assets/{hatching-screen-BMV3_jw3.js → hatching-screen-CziT_eEj.js} +1 -1
  46. package/dist/assets/{home-page-route-BVqYfryr.js → home-page-route-BSHvc0DH.js} +1 -1
  47. package/dist/assets/{hosting-screen-DZmRKq2R.js → hosting-screen-D6gwvyR3.js} +1 -1
  48. package/dist/assets/{identity-page-route-bSLAtYjH.js → identity-page-route-CvxG-nhn.js} +1 -1
  49. package/dist/assets/{index-BWl1C6Md.js → index-D-NVGcvg.js} +1 -1
  50. package/dist/assets/index-D8Xiv4z3.css +2 -0
  51. package/dist/assets/{inspect-page-BSwyrBOD.js → inspect-page-D0xZPslr.js} +1 -1
  52. package/dist/assets/{integrations-page-D4N7XBxV.js → integrations-page-DuKFioaA.js} +1 -1
  53. package/dist/assets/{intelligence-layout-BHQtSVKp.js → intelligence-layout-CVzq_bDm.js} +1 -1
  54. package/dist/assets/{library-detail-page-CbaVAX9l.js → library-detail-page-BmD8ODsN.js} +1 -1
  55. package/dist/assets/{library-page-BV6AZOZ4.js → library-page-B1_J428q.js} +1 -1
  56. package/dist/assets/{local-runtime-upgrade--xfigQzq.js → local-runtime-upgrade-1CLFIVes.js} +1 -1
  57. package/dist/assets/{login-flow-C67Qs4VU.js → login-flow-BnCQjNXm.js} +1 -1
  58. package/dist/assets/{login-page-v99-qDEh.js → login-page-BnF7_s7c.js} +1 -1
  59. package/dist/assets/{logout-page-D7iA9Kq5.js → logout-page-BguUo424.js} +1 -1
  60. package/dist/assets/{logs-layout-ClP6uOCy.js → logs-layout-BiZ4JakR.js} +1 -1
  61. package/dist/assets/{memory-page-route-BaU_3Ud_.js → memory-page-route-DwmCqWRb.js} +1 -1
  62. package/dist/assets/{memory-router-playground-page-DqiasVxi.js → memory-router-playground-page-Bl-5j5de.js} +1 -1
  63. package/dist/assets/{metric-card-B2kI8coI.js → metric-card-B-Tt9p-1.js} +1 -1
  64. package/dist/assets/{mobile-sidebar-drawer-BmxsSTmg.js → mobile-sidebar-drawer-Cp72bTDC.js} +1 -1
  65. package/dist/assets/{notifications-page-BV9W9NKD.js → notifications-page-CD8OVGKw.js} +1 -1
  66. package/dist/assets/{open-workspace-file-CqN4BPYt.js → open-workspace-file-DYklNHQ0.js} +2 -2
  67. package/dist/assets/{page-shell-CxcCDSYe.js → page-shell-CN7ioeP_.js} +1 -1
  68. package/dist/assets/{personality-page-Mg-bAdAk.js → personality-page-DeZSBQ6W.js} +1 -1
  69. package/dist/assets/{plans-page-B7IYXk_o.js → plans-page-D924rN93.js} +1 -1
  70. package/dist/assets/{platform-login-notice-CozFnzB_.js → platform-login-notice-DIS8PWXu.js} +1 -1
  71. package/dist/assets/{platform-loopback-page-D1a986dJ.js → platform-loopback-page-BTr35x9U.js} +1 -1
  72. package/dist/assets/{privacy-page-spUjG6Rd.js → privacy-page-BGXaPgBR.js} +1 -1
  73. package/dist/assets/{privacy-screen-yW7FzWZI.js → privacy-screen-znr9P7PH.js} +1 -1
  74. package/dist/assets/{provider-callback-page-CGNZRGqn.js → provider-callback-page-Bn1Tp_ej.js} +1 -1
  75. package/dist/assets/{provider-signup-page-CYwWsR4t.js → provider-signup-page-C5z8x-YS.js} +1 -1
  76. package/dist/assets/{research-onboarding-route-B_wcuPdA.js → research-onboarding-route-DpC0dKBR.js} +1 -1
  77. package/dist/assets/{retire-confirm-dialog-DCj4ppbL.js → retire-confirm-dialog-BFbPH66U.js} +1 -1
  78. package/dist/assets/{review-terms-screen-HumnxyCY.js → review-terms-screen-W08isuCB.js} +1 -1
  79. package/dist/assets/risk-FjW-m05l.js +3 -0
  80. package/dist/assets/routes-DOTByxnJ.js +23 -0
  81. package/dist/assets/{runtime-upgrade-banner-6Pt-rFW8.js → runtime-upgrade-banner-4PNA3XVR.js} +1 -1
  82. package/dist/assets/{schedules-page-_J_tbX2p.js → schedules-page-BSr0-mjB.js} +1 -1
  83. package/dist/assets/{select-assistant-screen-BUeWouXT.js → select-assistant-screen-DAkhS0wl.js} +1 -1
  84. package/dist/assets/{session-corner-action-BfLy9WAJ.js → session-corner-action-CqofVz_i.js} +1 -1
  85. package/dist/assets/{settings-divider-DjiuxEcE.js → settings-divider-Bf5WJ9ve.js} +1 -1
  86. package/dist/assets/{settings-layout-BWxjKE-C.js → settings-layout-DcuaK8qu.js} +1 -1
  87. package/dist/assets/{share-feedback-modal-BXQs6sPT.js → share-feedback-modal-Dy0GRvA9.js} +1 -1
  88. package/dist/assets/{sidebar-tree-8Z7uHJol.js → sidebar-tree-DrZXY5Iz.js} +1 -1
  89. package/dist/assets/{signup-page-C8f8vQ6j.js → signup-page-B6mmAQJU.js} +1 -1
  90. package/dist/assets/{site-favicon-CPDg0T08.js → site-favicon-CA7jaNnH.js} +1 -1
  91. package/dist/assets/{skill-detail-page-D1Z_JQ58.js → skill-detail-page-BCPN6NmR.js} +1 -1
  92. package/dist/assets/{skill-detail-panel-B6JNHP6G.js → skill-detail-panel-Cpl1Z7V3.js} +1 -1
  93. package/dist/assets/{skills-DK5e24Im.js → skills-BL4RgwAd.js} +1 -1
  94. package/dist/assets/{slack-setup-wizard-d9M5SFq7.js → slack-setup-wizard-dVkbEE6P.js} +1 -1
  95. package/dist/assets/{src-C3NeO9Jd.js → src-BAS7a2RG.js} +39 -39
  96. package/dist/assets/{subagent-detail-panel-BWOBCd2x.js → subagent-detail-panel-jOUXcDnl.js} +1 -1
  97. package/dist/assets/{subagent-store-Cxv8dl3x.js → subagent-store-C8qemfgn.js} +1 -1
  98. package/dist/assets/{superpowers-page-CB-BP-_4.js → superpowers-page-DltosgGe.js} +1 -1
  99. package/dist/assets/{system-events-page-fXtfs3ck.js → system-events-page-DEQyyquu.js} +1 -1
  100. package/dist/assets/{theme-stage-page-KaftkybS.js → theme-stage-page-CnKpq5QT.js} +1 -1
  101. package/dist/assets/{tiptap-document-editor-DbcVPx_F.js → tiptap-document-editor-D-lwPWrV.js} +1 -1
  102. package/dist/assets/{tool-detail-panel-DV3p07nd.js → tool-detail-panel-86ruMQAQ.js} +1 -1
  103. package/dist/assets/{transcript-message-body-shared-BtDc2xmr.js → transcript-message-body-shared-CT5pk4wz.js} +1 -1
  104. package/dist/assets/{upgrade-cancel-page-RQr89F4R.js → upgrade-cancel-page-DmStvNCn.js} +1 -1
  105. package/dist/assets/{upgrade-success-page-Ckoqx9Vr.js → upgrade-success-page-jOEtujYa.js} +1 -1
  106. package/dist/assets/{use-assistant-capability-BRLl80Z_.js → use-assistant-capability-BaZVGuCu.js} +1 -1
  107. package/dist/assets/{use-assistant-identity-details-Bh8DBBL6.js → use-assistant-identity-details-C99kNyQf.js} +1 -1
  108. package/dist/assets/{use-bookmarks-DBiCgP5h.js → use-bookmarks-B6Y60m9F.js} +1 -1
  109. package/dist/assets/{use-checkout-dismiss-refresh-CRJ6QdGF.js → use-checkout-dismiss-refresh-BZXXQef1.js} +1 -1
  110. package/dist/assets/{use-command-palette-sections-CakTFfva.js → use-command-palette-sections-DWCppiPf.js} +1 -1
  111. package/dist/assets/{use-edit-app-GPeXZFBx.js → use-edit-app-BF9YK7AV.js} +1 -1
  112. package/dist/assets/{use-ios-app-nudge-BjmDFQZ9.js → use-ios-app-nudge-DiqQWH5O.js} +1 -1
  113. package/dist/assets/{use-is-org-ready-CFcTY1Qr.js → use-is-org-ready-BbqlQFXw.js} +1 -1
  114. package/dist/assets/{use-onboarding-login-DfX-NHsX.js → use-onboarding-login-xZhWGmky.js} +1 -1
  115. package/dist/assets/{use-platform-assistant-id-DvilMQ88.js → use-platform-assistant-id-BnFEQQeS.js} +1 -1
  116. package/dist/assets/{use-platform-gate-WUjCKFpL.js → use-platform-gate-D9hR3R0n.js} +1 -1
  117. package/dist/assets/{use-return-to-short-circuit-BcFT9RDa.js → use-return-to-short-circuit-B1mhvgIq.js} +1 -1
  118. package/dist/assets/{use-skill-actions-COF5ItNI.js → use-skill-actions-BLHTDn21.js} +1 -1
  119. package/dist/assets/{use-sticky-profiles-CujEqy9l.js → use-sticky-profiles-GTUzoFP4.js} +1 -1
  120. package/dist/assets/{use-subagent-card-data-Cf2Ih6VE.js → use-subagent-card-data-Cu_-lx6d.js} +1 -1
  121. package/dist/assets/{utils-By2duKuc.js → utils-Ction0uF.js} +1 -1
  122. package/dist/assets/{voice-list-DQtY9O6_.js → voice-list-BMMz4e4M.js} +1 -1
  123. package/dist/assets/{voice-page-CLpMa0T7.js → voice-page-4AS-Fm6W.js} +1 -1
  124. package/dist/assets/{voice-providers-note-CqjCnYyT.js → voice-providers-note-g4IBSHFm.js} +1 -1
  125. package/dist/assets/{welcome-screen-kbK5FGL0.js → welcome-screen-B-88csxO.js} +1 -1
  126. package/dist/assets/{workflow-detail-panel-o8eE21pU.js → workflow-detail-panel-BNzNSNAT.js} +1 -1
  127. package/dist/assets/{workflow-store-CBrRXPJi.js → workflow-store-Cbd3x6KN.js} +1 -1
  128. package/dist/assets/{workspace-page-CkZtbmMR.js → workspace-page-b8SfI_28.js} +1 -1
  129. package/dist/index.html +46 -46
  130. package/package.json +1 -1
  131. package/dist/assets/api-C6QqN4kB.js +0 -1
  132. package/dist/assets/index-CBMHOw4F.css +0 -2
  133. package/dist/assets/risk-Biu4oG7i.js +0 -3
  134. package/dist/assets/routes-CFLMGkjX.js +0 -23
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{n}from"./button-Dy5001j6.js";import{t as r}from"./jsx-runtime-D3ZM-ToX.js";import{t as i}from"./typography-DEI9Ra9z.js";import{_t as a,gt as o,ht as s,m as c,p as l,vt as u}from"./risk-Biu4oG7i.js";import{t as d}from"./brain-BIzJCPA6.js";import{t as f}from"./check-sC49_hjU.js";import{t as p}from"./circle-check-CjGnAahM.js";import{t as m}from"./code-qafFA0_-.js";import{t as h}from"./file-text-BCsUYVEF.js";import{t as g}from"./globe-BDvXuPkw.js";import{t as _}from"./monitor-B5vtTCxm.js";import{t as ee}from"./sparkles-DC8kqYjt.js";import{t as te}from"./user-plus-CXMJ1x_5.js";import"./src-C3NeO9Jd.js";import{t as v}from"./popover-BFL-uOLh.js";import{D as y,O as ne}from"./chat-BIJEFb5u.js";import{t as b}from"./misc-CAQM4FGM.js";import{t as re}from"./proxy-CNtrhN4q.js";import{t as ie}from"./AnimatePresence-D23js3-M.js";import{t as x}from"./use-reduced-motion-bjjt6x6d.js";import{t as S}from"./three-dot-indicator-CfjkCgEH.js";var C=e(t(),1),w=r();function T(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 ae=/^https?:\/\/\S+/,oe=/^URL:\s*(https?:\/\/\S+)/i,se=/^\[\d+\]\s*(https?:\/\/\S+)/;function E(e){try{return new URL(e).hostname.replace(/^www\./,``)}catch{return``}}function ce(e){let t=e.trim();return oe.exec(t)?.[1]??se.exec(t)?.[1]??t}function le(e){return e.trim().replace(/^\d+\.\s+/,``)}function ue(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=ce(t);if(ae.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=le(t))}return n}function D(e){return!e||!e.trim()?[]:ue(e).map((e,t)=>{let n=E(e.url);return{rank:t+1,title:e.title,url:e.url,domain:n}})}var de=5,fe=new Set([`web_search`,`web_fetch`]);function O(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 k(e){return fe.has(e.name)}function A(e){return e?`Searched the web`:`Searching the web`}function j(e){return{visible:e.slice(0,de),overflowResults:e.slice(de)}}function pe(e,t){let{visible:n,overflowResults:r}=j(e.results);return{kind:`web_search`,title:A(t),durationLabel:O(e.durationMs),linkCount:e.resultCount,results:n,overflowResults:r}}function me(e){let t=e.title??e.domain;return{kind:`thinking`,durationLabel:O(e.durationMs),text:`Reading ${t}`}}function he(){return{kind:`web_search`,title:`Searching the web`,durationLabel:``,linkCount:0,results:[]}}function ge(){return{kind:`thinking`,durationLabel:``,text:`Reading…`}}function _e(e){let t=D(e);if(t.length===0)return null;let{visible:n,overflowResults:r}=j(t);return{kind:`web_search`,title:A(!0),durationLabel:``,linkCount:t.length,results:n,overflowResults:r}}function ve(e){return{kind:`web_search_error`,title:`Web search failed`,durationLabel:O(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 M(){return{kind:`web_search`,title:A(!0),durationLabel:``,linkCount:0,results:[]}}function N(e,t){return t[e.id]??e.activityMetadata}function P(e){return!y(e)}function F(e,t){return e.results.length>0?!1:!!e.errorMessage||!!t.isError}function I(e){return e.confirmationDecision===`denied`||e.confirmationDecision===`timed_out`?`denied`:e.isError?`error`:y(e)?`running`:`completed`}function L(e,t){return e==null||t==null?null:Math.max(0,t-e)}function R(e,t){let n=L(e,t);return n==null?``:O(n)}function z(e){return R(e.startedAt??void 0,e.completedAt??void 0)}function ye(e){return!l(e)&&y(e)}function be(e,t){if(e.kind===`thinking`)return e.text?e.completedAt==null?e.startedAt!=null&&t!=null?Math.max(0,t-e.startedAt):null:L(e.startedAt,e.completedAt):null;let n=e.toolCall;if(l(n))return null;let r=ne(n);return n.completedAt==null?y(n)&&r!=null&&t!=null?Math.max(0,t-r):null:L(r,n.completedAt)}function xe(e){return e.some(e=>e.kind===`thinking`?!!e.text&&e.startedAt!=null&&e.completedAt==null:ye(e.toolCall))}function Se(e,t){let n=0,r=!1;for(let i of e){let e=be(i,t);e!=null&&(r=!0,n+=e)}return r?O(n):``}function Ce(e){let{title:t,activity:n}=c(e);return{toolCallId:e.id,toolName:e.name,title:t,activity:n,input:e.input??{},result:e.result,streamedOutput:e.streamedOutput,status:I(e),riskLevel:e.riskLevel,riskReason:e.riskReason,durationLabel:z(e)}}function we(e){let{title:t,info:n,activity:r,iconName:i}=c(e);return{kind:`tool`,durationLabel:z(e),startedAt:e.startedAt??void 0,title:t,info:n,activity:r,riskLevel:e.riskLevel,iconName:i,toolCallId:e.id,status:I(e)}}function Te(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(k(r)){let e=N(r,t),n=P(r);if(e?.webSearch&&F(e.webSearch,r))return`Web search failed`;if(r.name===`web_search`)return A(n);if(r.name===`web_fetch`)return`Thinking`}else return c(r).title}return``}function Ee(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(!k(r)){let{info:e,activity:t}=c(r);return t||e}let i=N(r,t),a=P(r);if(i?.webSearch){let e=i.webSearch;if(F(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=D(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?E(e):``;if(t)return a?t:`Reading ${t}`}}return``}function De(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(r.name!==`web_search`)continue;let i=N(r,t)?.webSearch?.results;if(i&&i.length>0)return i}return[]}function Oe(e){return e.includes(`denied`)?`denied`:e.includes(`loading`)?`loading`:e.includes(`error`)?`error`:`complete`}function ke(e){return Oe(e.map(e=>e.confirmationDecision===`denied`||e.confirmationDecision===`timed_out`?`denied`:y(e)?`loading`:e.isError?`error`:`complete`))}function Ae(e,t){if(l(e))return null;if(!k(e))return we(e);let n=N(e,t),r=P(e);if(n?.webSearch){let t=n.webSearch;return F(t,e)?ve(t):pe(t,r)}return n?.webFetch?me(n.webFetch):r?e.name===`web_search`&&typeof e.result==`string`?_e(e.result)??M():M():e.name===`web_search`?he():ge()}function je(e,t,n){let r=e.filter(e=>e.kind===`toolCall`).map(e=>e.toolCall).filter(e=>!l(e)),i=[],a=null,o=0;for(let n of e){if(n.kind===`thinking`){n.text&&(i.push({kind:`thinking`,durationLabel:R(n.startedAt,n.completedAt),text:n.text,startedAt:n.startedAt,completedAt:n.completedAt,thinkingItemIndex:o++}),a=n.text);continue}let e=Ae(n.toolCall,t);e&&(i.push(e),a=null)}let s=ke(r),c,u,d;a===null?(c=Te(r,t),u=Ee(r,t),d=`tool`):(c=`Thinking`,u=T(a),d=`thinking`);let f=De(r,t),p=`${i.length} step${i.length===1?``:`s`}`,m=Se(e,n);return{currentStepTitle:c,currentStepInfo:u,currentStepKind:d,stepCount:p,totalDurationLabel:m,steps:i,state:s,carouselItems:f}}var Me=.44;function Ne(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*Me;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 Pe(e){let t=`color-mix(in srgb, ${e} 40%, white)`;return[{position:0,color:t},{position:.5,color:e},{position:1,color:t}]}var Fe=`var(--avatar-accent, var(--content-emphasised))`,Ie=`color-mix(in srgb, currentColor 45%, transparent)`,Le=1500,Re=106,B=6,V=48,H=.72,U=14,ze=96;function Be(){return typeof CSS>`u`||typeof CSS.supports!=`function`?!1:CSS.supports(`background-clip`,`text`)||CSS.supports(`-webkit-background-clip`,`text`)}function W({children:e,colorHex:t,className:n,"data-testid":r}){let i=(0,C.useRef)(null),a=x(),o=t??Fe,s=(0,C.useMemo)(()=>Ne(Pe(o),Re),[o]);(0,C.useLayoutEffect)(()=>{let t=i.current;if(!t)return;if(!Be()){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||ze,i=(Number.parseFloat(getComputedStyle(t).fontSize)||U)/U,a=Math.min(e.length*B*i,V*i),o=Math.max(1,r+a*2);t.style.setProperty(`--gs-spread`,`${a}px`),t.style.setProperty(`--gs-spread-mid`,`${a*H}px`),t.style.backgroundSize=`${o}px 100%`,n?.cancel(),n=t.animate([{backgroundPosition:`0px center`},{backgroundPosition:`${o}px center`}],{duration:Le,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*B,V);return(0,w.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":Ie,"--gs-spread":`${c}px`,"--gs-spread-mid":`${c*H}px`},"data-testid":r,children:e})}var Ve=400;function He(e,t,n){let[r,i]=(0,C.useState)(e),a=(0,C.useRef)(null),o=(0,C.useRef)(null),s=(0,C.useRef)(null);return(0,C.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 Ue({currentStepTitle:e,currentStepInfo:t,bypassDwell:n=!1,animationKey:r,shimmer:a=!1,inline:o=!1}){let s=x(),c=He((0,C.useMemo)(()=>({title:e,info:t}),[e,t]),Ve,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()!==``;return(0,w.jsx)(ie,{initial:!1,mode:`popLayout`,children:(0,w.jsxs)(re.span,{initial:u,animate:d,exit:f,transition:l,className:`flex min-w-0 flex-1 items-center gap-1`,children:[_?o?(0,w.jsx)(`span`,{className:g?`shrink-0 whitespace-nowrap text-[13px] font-medium leading-[16px] text-[var(--content-secondary)]`:`block min-w-0 flex-1 truncate text-left text-[13px] font-medium leading-[16px] text-[var(--content-secondary)]`,children:a?(0,w.jsx)(W,{children:c.title}):c.title}):(0,w.jsx)(i,{variant:`body-medium-default`,className:g?`ml-1 shrink-0 whitespace-nowrap text-[var(--content-emphasised)]`:`ml-1 block min-w-0 flex-1 truncate text-left text-[var(--content-emphasised)]`,children:a?(0,w.jsx)(W,{children:c.title}):c.title}):null,g?(0,w.jsxs)(w.Fragment,{children:[_?(0,w.jsx)(`span`,{"aria-hidden":`true`,className:`ml-1 h-3.5 w-px shrink-0 bg-[var(--border-element)]`}):null,p?o&&!_?(0,w.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,w.jsx)(W,{children:c.info}):c.info}):(0,w.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,w.jsx)(W,{children:c.info}):c.info}):(0,w.jsx)(`span`,{className:`ml-1 block min-w-0 flex-1`,children:c.info})]}):null]},h)})}var G={code:m,terminal:s,file:h,globe:g,pen:a,monitor:_,plug:o,sparkle:ee,"user-plus":te,bolt:u,brain:d};function We(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 Ge(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 Ke(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 qe(e){return new Date(e).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`,second:`2-digit`})}function Je({durationLabel:e,startedAt:t}){let r=(0,w.jsx)(i,{variant:`label-medium-default`,className:`text-[var(--content-tertiary)]`,children:e});return t==null?r:(0,w.jsx)(n,{content:`Started at ${qe(t)}`,side:`top`,align:`end`,children:(0,w.jsx)(`span`,{className:`cursor-default`,children:r})})}function K(e){let t=0,n=!1;for(let r of e)r&&(n=!0,t+=Ge(r));return n?O(t):``}function q(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 J(e){let t=[];for(let n of e){let e=We(n),r=t[t.length-1];r&&r.label===e?r.steps.push(n):t.push({label:e,steps:[n]})}return t}function Ye({steps:e,renderStep:t,timeline:n=!1}){if(e.length===0)return null;let r=J(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=et(e,n+r);return(0,w.jsx)(C.Fragment,{children:t?t(e):(0,w.jsx)(nt,{step:e})},i)});return n?(0,w.jsx)(`div`,{className:`flex w-full flex-col`,children:r.map((e,t)=>(0,w.jsx)(Xe,{section:e,baseIndex:i[t],isLast:t===r.length-1,renderSectionSteps:o},`${e.label}-${t}`))}):(0,w.jsx)(`div`,{className:`flex w-full flex-col gap-3`,children:r.map((e,t)=>{let n=K(e.steps.map(e=>`durationLabel`in e?e.durationLabel:``)),r=q(e.steps),a=i[t];return(0,w.jsxs)(`div`,{"data-testid":`phase-section`,"data-phase-label":e.label,className:`flex flex-col gap-1`,children:[(0,w.jsx)(tt,{label:e.label,durationLabel:n,status:r}),(0,w.jsx)(`div`,{className:`flex min-w-0 flex-col items-start gap-1 pl-[24px]`,children:o(e,a)})]},`${e.label}-${t}`)})})}function Xe({section:e,baseIndex:t,isLast:n,renderSectionSteps:r}){let a=K(e.steps.map(e=>`durationLabel`in e?e.durationLabel:``)),o=q(e.steps),s=e.steps[0]?.kind===`thinking`;return(0,w.jsxs)(`div`,{"data-testid":`phase-section`,"data-phase-label":e.label,className:`relative flex flex-col gap-2`,children:[!n&&(0,w.jsx)(Ze,{}),(0,w.jsxs)(`div`,{"data-testid":`phase-header`,className:`flex items-center justify-between gap-2 py-[2px]`,children:[(0,w.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,w.jsx)(Qe,{status:o,isThinking:s}),(0,w.jsx)(i,{variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e.label})]}),a?(0,w.jsx)(Je,{durationLabel:a,startedAt:Ke(e.steps)}):null]}),(0,w.jsx)(`div`,{className:b(`flex min-w-0 flex-col items-start gap-1 pl-[22px]`,!n&&`pb-3`),children:r(e,t)})]})}function Ze({className:e}){return(0,w.jsx)(`div`,{"aria-hidden":!0,className:b(`absolute bottom-0 left-[6.5px] top-6 w-px bg-[var(--border-subtle)]`,e)})}function Qe({status:e,isThinking:t}){return t?(0,w.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,w.jsx)($e,{status:e,testId:`phase-header-status-icon`})}function $e({status:e,testId:t}){return e===`completed`?(0,w.jsx)(p,{"aria-hidden":`true`,"data-testid":t,"data-status":`completed`,className:`h-[14px] w-[14px] shrink-0 text-[var(--system-positive-strong)]`}):(0,w.jsx)(S,{"data-testid":t,className:`shrink-0`})}function et(e,t){return e.kind===`tool`&&e.toolCallId?e.toolCallId:`${e.kind}-${t}`}function tt({label:e,durationLabel:t,status:n}){return(0,w.jsxs)(`div`,{"data-testid":`phase-header`,className:`flex items-center justify-between py-[2px]`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-1`,children:[n===`completed`?(0,w.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,w.jsx)(S,{"data-testid":`phase-header-status-icon`,className:`shrink-0`}),(0,w.jsx)(i,{variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e})]}),t?(0,w.jsx)(i,{variant:`label-medium-default`,className:`text-[var(--content-tertiary)]`,children:t}):null]})}function Y(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 nt({step:e}){if(e.kind===`thinking`)return(0,w.jsx)(Z,{children:(0,w.jsx)(X,{children:T(e.text)})});if(e.kind===`tool`){let t=G[e.iconName]??u;return Y(e)?(0,w.jsxs)(Z,{children:[(0,w.jsx)(t,{"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-[var(--content-secondary)]`}),(0,w.jsx)(X,{children:e.info})]}):null}return e.kind===`tool_error`?(0,w.jsx)(Z,{children:(0,w.jsx)(X,{children:e.message})}):e.kind===`web_search_error`?(0,w.jsx)(Z,{children:(0,w.jsx)(X,{children:e.errorMessage})}):(0,w.jsx)(Z,{children:(0,w.jsx)(X,{children:e.title})})}function X({children:e}){return(0,w.jsx)(i,{variant:`body-small-default`,className:`min-w-0 truncate text-inherit`,children:e})}function Z({children:e}){return(0,w.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 Q=`inline-flex min-w-0 items-center gap-1 self-start rounded-full px-2 py-1 text-left leading-normal`,rt=`transition-colors cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--border-focus)]`,it=`bg-[var(--surface-overlay)] text-[var(--content-default)]`;function at({faviconUrl:e,domain:t,label:n}){let[r,i]=(0,C.useState)(!1),a=!!e&&!r,o=(t&&t.length>0?t:n).charAt(0).toUpperCase();return(0,w.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,w.jsx)(`img`,{src:e,alt:``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`h-full w-full object-contain`,onError:()=>i(!0)}):(0,w.jsx)(`span`,{className:`text-[10px] font-medium leading-none text-[var(--content-tertiary)]`,children:o})})}function ot({label:e,url:t,faviconUrl:n,domain:r,ariaLabel:a}){return(0,w.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,"data-testid":`tool-step-pill`,"data-variant":`web`,"aria-label":a??`Open ${e}`,className:`${Q} ${rt} max-w-[240px] no-underline hover:bg-[var(--surface-active)] ${it}`,children:[(0,w.jsx)(at,{faviconUrl:n,domain:r,label:e}),(0,w.jsx)(i,{variant:`body-small-default`,className:`min-w-0 truncate text-inherit leading-normal`,children:e})]})}function $(e){if(e.variant===`web`)return(0,w.jsx)(ot,{...e});let{iconName:t,label:n,onClick:r,active:a=!1,ariaLabel:o}=e,s=a?`bg-[var(--surface-active)] text-[var(--content-default)]`:it,c=(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(G[t]??u,{"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-[var(--content-tertiary)]`}),(0,w.jsx)(i,{variant:`body-small-default`,className:`min-w-0 truncate text-inherit leading-normal`,children:n})]});return r?(0,w.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:`${Q} ${rt} max-w-full hover:bg-[var(--surface-active)] ${s}`,children:c}):(0,w.jsx)(`span`,{"data-testid":`tool-step-pill`,className:`${Q} max-w-full ${s}`,children:c})}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,C.useState)(!1),r=!!e.faviconUrl&&!t;return(0,w.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,w.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,w.jsx)(`img`,{src:e.faviconUrl,alt:``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`h-full w-full object-contain`,onError:()=>n(!0)}):(0,w.jsx)(`span`,{className:`text-[10px] font-medium leading-none text-[var(--content-default)]`,children:st(e)})}),(0,w.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,w.jsx)(i,{variant:`body-small-default`,className:`truncate text-[var(--content-default)]`,children:e.title}),(0,w.jsx)(i,{variant:`body-small-default`,className:`truncate text-[var(--content-secondary)]`,children:e.domain})]})]})}function lt({results:e}){return(0,w.jsxs)(v.Root,{children:[(0,w.jsx)(v.Trigger,{asChild:!0,children:(0,w.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,w.jsxs)(i,{variant:`body-small-default`,className:`text-[var(--content-default)]`,children:[`+`,e.length,` more`]})})}),(0,w.jsx)(v.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,w.jsx)(ct,{item:e},e.rank))})]})}function ut({message:e}){return(0,w.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,w.jsx)(i,{variant:`body-small-default`,className:`text-[var(--content-default)]`,children:e})})}function dt({step:e}){let t=e.overflowResults??[];return(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(e.results??[]).map(e=>(0,w.jsx)($,{variant:`web`,url:e.url,faviconUrl:e.faviconUrl,domain:e.domain,label:e.title},e.rank)),t.length>0?(0,w.jsx)(lt,{results:t}):null]})}function ft({step:e}){return(0,w.jsx)(ut,{message:e.errorMessage})}function pt({faviconUrl:e,domain:t,title:n,className:r}){let[i,a]=(0,C.useState)(!1);(0,C.useEffect)(()=>{a(!1)},[e]);let o=!!e&&!i,s=(t&&t.length>0?t:n).charAt(0).toUpperCase();return(0,w.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`site-favicon`,className:b(`inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center overflow-hidden rounded-[var(--radius-sm)]`,r),children:o?(0,w.jsx)(`img`,{src:e,alt:``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`h-full w-full object-contain`,onError:()=>a(!0)}):(0,w.jsx)(`span`,{className:`text-[10px] font-medium leading-none text-[var(--content-tertiary)]`,children:s})})}export{D as C,E as S,fe as _,nt as a,xe as b,Ze as c,q as d,et as f,W as g,Ue as h,$ as i,Qe as l,K as m,ft as n,G as o,Y as p,dt as r,Ye as s,pt as t,J as u,je as v,T as w,Ce as x,O as y};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{n}from"./button-Dy5001j6.js";import{t as r}from"./jsx-runtime-D3ZM-ToX.js";import{t as i}from"./typography-DEI9Ra9z.js";import{_t as a,gt as o,ht as s,m as c,p as l,vt as u}from"./risk-FjW-m05l.js";import{t as d}from"./brain-BIzJCPA6.js";import{t as f}from"./check-sC49_hjU.js";import{t as p}from"./circle-check-CjGnAahM.js";import{t as m}from"./code-qafFA0_-.js";import{t as h}from"./file-text-BCsUYVEF.js";import{t as g}from"./globe-BDvXuPkw.js";import{t as _}from"./monitor-B5vtTCxm.js";import{t as ee}from"./sparkles-DC8kqYjt.js";import{t as te}from"./user-plus-CXMJ1x_5.js";import"./src-BAS7a2RG.js";import{t as v}from"./popover-BFL-uOLh.js";import{D as y,O as ne}from"./chat-BIJEFb5u.js";import{t as b}from"./misc-CAQM4FGM.js";import{t as re}from"./proxy-CNtrhN4q.js";import{t as ie}from"./AnimatePresence-D23js3-M.js";import{t as x}from"./use-reduced-motion-bjjt6x6d.js";import{t as S}from"./three-dot-indicator-CfjkCgEH.js";var C=e(t(),1),w=r();function T(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 ae=/^https?:\/\/\S+/,oe=/^URL:\s*(https?:\/\/\S+)/i,se=/^\[\d+\]\s*(https?:\/\/\S+)/;function E(e){try{return new URL(e).hostname.replace(/^www\./,``)}catch{return``}}function ce(e){let t=e.trim();return oe.exec(t)?.[1]??se.exec(t)?.[1]??t}function le(e){return e.trim().replace(/^\d+\.\s+/,``)}function ue(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=ce(t);if(ae.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=le(t))}return n}function D(e){return!e||!e.trim()?[]:ue(e).map((e,t)=>{let n=E(e.url);return{rank:t+1,title:e.title,url:e.url,domain:n}})}var de=5,fe=new Set([`web_search`,`web_fetch`]);function O(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 k(e){return fe.has(e.name)}function A(e){return e?`Searched the web`:`Searching the web`}function j(e){return{visible:e.slice(0,de),overflowResults:e.slice(de)}}function pe(e,t){let{visible:n,overflowResults:r}=j(e.results);return{kind:`web_search`,title:A(t),durationLabel:O(e.durationMs),linkCount:e.resultCount,results:n,overflowResults:r}}function me(e){let t=e.title??e.domain;return{kind:`thinking`,durationLabel:O(e.durationMs),text:`Reading ${t}`}}function he(){return{kind:`web_search`,title:`Searching the web`,durationLabel:``,linkCount:0,results:[]}}function ge(){return{kind:`thinking`,durationLabel:``,text:`Reading…`}}function _e(e){let t=D(e);if(t.length===0)return null;let{visible:n,overflowResults:r}=j(t);return{kind:`web_search`,title:A(!0),durationLabel:``,linkCount:t.length,results:n,overflowResults:r}}function ve(e){return{kind:`web_search_error`,title:`Web search failed`,durationLabel:O(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 M(){return{kind:`web_search`,title:A(!0),durationLabel:``,linkCount:0,results:[]}}function N(e,t){return t[e.id]??e.activityMetadata}function P(e){return!y(e)}function F(e,t){return e.results.length>0?!1:!!e.errorMessage||!!t.isError}function I(e){return e.confirmationDecision===`denied`||e.confirmationDecision===`timed_out`?`denied`:e.isError?`error`:y(e)?`running`:`completed`}function L(e,t){return e==null||t==null?null:Math.max(0,t-e)}function R(e,t){let n=L(e,t);return n==null?``:O(n)}function z(e){return R(e.startedAt??void 0,e.completedAt??void 0)}function ye(e){return!l(e)&&y(e)}function be(e,t){if(e.kind===`thinking`)return e.text?e.completedAt==null?e.startedAt!=null&&t!=null?Math.max(0,t-e.startedAt):null:L(e.startedAt,e.completedAt):null;let n=e.toolCall;if(l(n))return null;let r=ne(n);return n.completedAt==null?y(n)&&r!=null&&t!=null?Math.max(0,t-r):null:L(r,n.completedAt)}function xe(e){return e.some(e=>e.kind===`thinking`?!!e.text&&e.startedAt!=null&&e.completedAt==null:ye(e.toolCall))}function Se(e,t){let n=0,r=!1;for(let i of e){let e=be(i,t);e!=null&&(r=!0,n+=e)}return r?O(n):``}function Ce(e){let{title:t,activity:n}=c(e);return{toolCallId:e.id,toolName:e.name,title:t,activity:n,input:e.input??{},result:e.result,streamedOutput:e.streamedOutput,status:I(e),riskLevel:e.riskLevel,riskReason:e.riskReason,durationLabel:z(e)}}function we(e){let{title:t,info:n,activity:r,iconName:i}=c(e);return{kind:`tool`,durationLabel:z(e),startedAt:e.startedAt??void 0,title:t,info:n,activity:r,riskLevel:e.riskLevel,iconName:i,toolCallId:e.id,status:I(e)}}function Te(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(k(r)){let e=N(r,t),n=P(r);if(e?.webSearch&&F(e.webSearch,r))return`Web search failed`;if(r.name===`web_search`)return A(n);if(r.name===`web_fetch`)return`Thinking`}else return c(r).title}return``}function Ee(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(!k(r)){let{info:e,activity:t}=c(r);return t||e}let i=N(r,t),a=P(r);if(i?.webSearch){let e=i.webSearch;if(F(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=D(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?E(e):``;if(t)return a?t:`Reading ${t}`}}return``}function De(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(r.name!==`web_search`)continue;let i=N(r,t)?.webSearch?.results;if(i&&i.length>0)return i}return[]}function Oe(e){return e.includes(`denied`)?`denied`:e.includes(`loading`)?`loading`:e.includes(`error`)?`error`:`complete`}function ke(e){return Oe(e.map(e=>e.confirmationDecision===`denied`||e.confirmationDecision===`timed_out`?`denied`:y(e)?`loading`:e.isError?`error`:`complete`))}function Ae(e,t){if(l(e))return null;if(!k(e))return we(e);let n=N(e,t),r=P(e);if(n?.webSearch){let t=n.webSearch;return F(t,e)?ve(t):pe(t,r)}return n?.webFetch?me(n.webFetch):r?e.name===`web_search`&&typeof e.result==`string`?_e(e.result)??M():M():e.name===`web_search`?he():ge()}function je(e,t,n){let r=e.filter(e=>e.kind===`toolCall`).map(e=>e.toolCall).filter(e=>!l(e)),i=[],a=null,o=0;for(let n of e){if(n.kind===`thinking`){n.text&&(i.push({kind:`thinking`,durationLabel:R(n.startedAt,n.completedAt),text:n.text,startedAt:n.startedAt,completedAt:n.completedAt,thinkingItemIndex:o++}),a=n.text);continue}let e=Ae(n.toolCall,t);e&&(i.push(e),a=null)}let s=ke(r),c,u,d;a===null?(c=Te(r,t),u=Ee(r,t),d=`tool`):(c=`Thinking`,u=T(a),d=`thinking`);let f=De(r,t),p=`${i.length} step${i.length===1?``:`s`}`,m=Se(e,n);return{currentStepTitle:c,currentStepInfo:u,currentStepKind:d,stepCount:p,totalDurationLabel:m,steps:i,state:s,carouselItems:f}}var Me=.44;function Ne(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*Me;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 Pe(e){let t=`color-mix(in srgb, ${e} 40%, white)`;return[{position:0,color:t},{position:.5,color:e},{position:1,color:t}]}var Fe=`var(--avatar-accent, var(--content-emphasised))`,Ie=`color-mix(in srgb, currentColor 45%, transparent)`,Le=1500,Re=106,B=6,V=48,H=.72,U=14,ze=96;function Be(){return typeof CSS>`u`||typeof CSS.supports!=`function`?!1:CSS.supports(`background-clip`,`text`)||CSS.supports(`-webkit-background-clip`,`text`)}function W({children:e,colorHex:t,className:n,"data-testid":r}){let i=(0,C.useRef)(null),a=x(),o=t??Fe,s=(0,C.useMemo)(()=>Ne(Pe(o),Re),[o]);(0,C.useLayoutEffect)(()=>{let t=i.current;if(!t)return;if(!Be()){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||ze,i=(Number.parseFloat(getComputedStyle(t).fontSize)||U)/U,a=Math.min(e.length*B*i,V*i),o=Math.max(1,r+a*2);t.style.setProperty(`--gs-spread`,`${a}px`),t.style.setProperty(`--gs-spread-mid`,`${a*H}px`),t.style.backgroundSize=`${o}px 100%`,n?.cancel(),n=t.animate([{backgroundPosition:`0px center`},{backgroundPosition:`${o}px center`}],{duration:Le,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*B,V);return(0,w.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":Ie,"--gs-spread":`${c}px`,"--gs-spread-mid":`${c*H}px`},"data-testid":r,children:e})}var Ve=400;function He(e,t,n){let[r,i]=(0,C.useState)(e),a=(0,C.useRef)(null),o=(0,C.useRef)(null),s=(0,C.useRef)(null);return(0,C.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 Ue({currentStepTitle:e,currentStepInfo:t,bypassDwell:n=!1,animationKey:r,shimmer:a=!1,inline:o=!1}){let s=x(),c=He((0,C.useMemo)(()=>({title:e,info:t}),[e,t]),Ve,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()!==``;return(0,w.jsx)(ie,{initial:!1,mode:`popLayout`,children:(0,w.jsxs)(re.span,{initial:u,animate:d,exit:f,transition:l,className:`flex min-w-0 flex-1 items-center gap-1`,children:[_?o?(0,w.jsx)(`span`,{className:g?`shrink-0 whitespace-nowrap text-[13px] font-medium leading-[16px] text-[var(--content-secondary)]`:`block min-w-0 flex-1 truncate text-left text-[13px] font-medium leading-[16px] text-[var(--content-secondary)]`,children:a?(0,w.jsx)(W,{children:c.title}):c.title}):(0,w.jsx)(i,{variant:`body-medium-default`,className:g?`ml-1 shrink-0 whitespace-nowrap text-[var(--content-emphasised)]`:`ml-1 block min-w-0 flex-1 truncate text-left text-[var(--content-emphasised)]`,children:a?(0,w.jsx)(W,{children:c.title}):c.title}):null,g?(0,w.jsxs)(w.Fragment,{children:[_?(0,w.jsx)(`span`,{"aria-hidden":`true`,className:`ml-1 h-3.5 w-px shrink-0 bg-[var(--border-element)]`}):null,p?o&&!_?(0,w.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,w.jsx)(W,{children:c.info}):c.info}):(0,w.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,w.jsx)(W,{children:c.info}):c.info}):(0,w.jsx)(`span`,{className:`ml-1 block min-w-0 flex-1`,children:c.info})]}):null]},h)})}var G={code:m,terminal:s,file:h,globe:g,pen:a,monitor:_,plug:o,sparkle:ee,"user-plus":te,bolt:u,brain:d};function We(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 Ge(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 Ke(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 qe(e){return new Date(e).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`,second:`2-digit`})}function Je({durationLabel:e,startedAt:t}){let r=(0,w.jsx)(i,{variant:`label-medium-default`,className:`text-[var(--content-tertiary)]`,children:e});return t==null?r:(0,w.jsx)(n,{content:`Started at ${qe(t)}`,side:`top`,align:`end`,children:(0,w.jsx)(`span`,{className:`cursor-default`,children:r})})}function K(e){let t=0,n=!1;for(let r of e)r&&(n=!0,t+=Ge(r));return n?O(t):``}function q(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 J(e){let t=[];for(let n of e){let e=We(n),r=t[t.length-1];r&&r.label===e?r.steps.push(n):t.push({label:e,steps:[n]})}return t}function Ye({steps:e,renderStep:t,timeline:n=!1}){if(e.length===0)return null;let r=J(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=et(e,n+r);return(0,w.jsx)(C.Fragment,{children:t?t(e):(0,w.jsx)(nt,{step:e})},i)});return n?(0,w.jsx)(`div`,{className:`flex w-full flex-col`,children:r.map((e,t)=>(0,w.jsx)(Xe,{section:e,baseIndex:i[t],isLast:t===r.length-1,renderSectionSteps:o},`${e.label}-${t}`))}):(0,w.jsx)(`div`,{className:`flex w-full flex-col gap-3`,children:r.map((e,t)=>{let n=K(e.steps.map(e=>`durationLabel`in e?e.durationLabel:``)),r=q(e.steps),a=i[t];return(0,w.jsxs)(`div`,{"data-testid":`phase-section`,"data-phase-label":e.label,className:`flex flex-col gap-1`,children:[(0,w.jsx)(tt,{label:e.label,durationLabel:n,status:r}),(0,w.jsx)(`div`,{className:`flex min-w-0 flex-col items-start gap-1 pl-[24px]`,children:o(e,a)})]},`${e.label}-${t}`)})})}function Xe({section:e,baseIndex:t,isLast:n,renderSectionSteps:r}){let a=K(e.steps.map(e=>`durationLabel`in e?e.durationLabel:``)),o=q(e.steps),s=e.steps[0]?.kind===`thinking`;return(0,w.jsxs)(`div`,{"data-testid":`phase-section`,"data-phase-label":e.label,className:`relative flex flex-col gap-2`,children:[!n&&(0,w.jsx)(Ze,{}),(0,w.jsxs)(`div`,{"data-testid":`phase-header`,className:`flex items-center justify-between gap-2 py-[2px]`,children:[(0,w.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,w.jsx)(Qe,{status:o,isThinking:s}),(0,w.jsx)(i,{variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e.label})]}),a?(0,w.jsx)(Je,{durationLabel:a,startedAt:Ke(e.steps)}):null]}),(0,w.jsx)(`div`,{className:b(`flex min-w-0 flex-col items-start gap-1 pl-[22px]`,!n&&`pb-3`),children:r(e,t)})]})}function Ze({className:e}){return(0,w.jsx)(`div`,{"aria-hidden":!0,className:b(`absolute bottom-0 left-[6.5px] top-6 w-px bg-[var(--border-subtle)]`,e)})}function Qe({status:e,isThinking:t}){return t?(0,w.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,w.jsx)($e,{status:e,testId:`phase-header-status-icon`})}function $e({status:e,testId:t}){return e===`completed`?(0,w.jsx)(p,{"aria-hidden":`true`,"data-testid":t,"data-status":`completed`,className:`h-[14px] w-[14px] shrink-0 text-[var(--system-positive-strong)]`}):(0,w.jsx)(S,{"data-testid":t,className:`shrink-0`})}function et(e,t){return e.kind===`tool`&&e.toolCallId?e.toolCallId:`${e.kind}-${t}`}function tt({label:e,durationLabel:t,status:n}){return(0,w.jsxs)(`div`,{"data-testid":`phase-header`,className:`flex items-center justify-between py-[2px]`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-1`,children:[n===`completed`?(0,w.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,w.jsx)(S,{"data-testid":`phase-header-status-icon`,className:`shrink-0`}),(0,w.jsx)(i,{variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e})]}),t?(0,w.jsx)(i,{variant:`label-medium-default`,className:`text-[var(--content-tertiary)]`,children:t}):null]})}function Y(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 nt({step:e}){if(e.kind===`thinking`)return(0,w.jsx)(Z,{children:(0,w.jsx)(X,{children:T(e.text)})});if(e.kind===`tool`){let t=G[e.iconName]??u;return Y(e)?(0,w.jsxs)(Z,{children:[(0,w.jsx)(t,{"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-[var(--content-secondary)]`}),(0,w.jsx)(X,{children:e.info})]}):null}return e.kind===`tool_error`?(0,w.jsx)(Z,{children:(0,w.jsx)(X,{children:e.message})}):e.kind===`web_search_error`?(0,w.jsx)(Z,{children:(0,w.jsx)(X,{children:e.errorMessage})}):(0,w.jsx)(Z,{children:(0,w.jsx)(X,{children:e.title})})}function X({children:e}){return(0,w.jsx)(i,{variant:`body-small-default`,className:`min-w-0 truncate text-inherit`,children:e})}function Z({children:e}){return(0,w.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 Q=`inline-flex min-w-0 items-center gap-1 self-start rounded-full px-2 py-1 text-left leading-normal`,rt=`transition-colors cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--border-focus)]`,it=`bg-[var(--surface-overlay)] text-[var(--content-default)]`;function at({faviconUrl:e,domain:t,label:n}){let[r,i]=(0,C.useState)(!1),a=!!e&&!r,o=(t&&t.length>0?t:n).charAt(0).toUpperCase();return(0,w.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,w.jsx)(`img`,{src:e,alt:``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`h-full w-full object-contain`,onError:()=>i(!0)}):(0,w.jsx)(`span`,{className:`text-[10px] font-medium leading-none text-[var(--content-tertiary)]`,children:o})})}function ot({label:e,url:t,faviconUrl:n,domain:r,ariaLabel:a}){return(0,w.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,"data-testid":`tool-step-pill`,"data-variant":`web`,"aria-label":a??`Open ${e}`,className:`${Q} ${rt} max-w-[240px] no-underline hover:bg-[var(--surface-active)] ${it}`,children:[(0,w.jsx)(at,{faviconUrl:n,domain:r,label:e}),(0,w.jsx)(i,{variant:`body-small-default`,className:`min-w-0 truncate text-inherit leading-normal`,children:e})]})}function $(e){if(e.variant===`web`)return(0,w.jsx)(ot,{...e});let{iconName:t,label:n,onClick:r,active:a=!1,ariaLabel:o}=e,s=a?`bg-[var(--surface-active)] text-[var(--content-default)]`:it,c=(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(G[t]??u,{"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-[var(--content-tertiary)]`}),(0,w.jsx)(i,{variant:`body-small-default`,className:`min-w-0 truncate text-inherit leading-normal`,children:n})]});return r?(0,w.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:`${Q} ${rt} max-w-full hover:bg-[var(--surface-active)] ${s}`,children:c}):(0,w.jsx)(`span`,{"data-testid":`tool-step-pill`,className:`${Q} max-w-full ${s}`,children:c})}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,C.useState)(!1),r=!!e.faviconUrl&&!t;return(0,w.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,w.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,w.jsx)(`img`,{src:e.faviconUrl,alt:``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`h-full w-full object-contain`,onError:()=>n(!0)}):(0,w.jsx)(`span`,{className:`text-[10px] font-medium leading-none text-[var(--content-default)]`,children:st(e)})}),(0,w.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,w.jsx)(i,{variant:`body-small-default`,className:`truncate text-[var(--content-default)]`,children:e.title}),(0,w.jsx)(i,{variant:`body-small-default`,className:`truncate text-[var(--content-secondary)]`,children:e.domain})]})]})}function lt({results:e}){return(0,w.jsxs)(v.Root,{children:[(0,w.jsx)(v.Trigger,{asChild:!0,children:(0,w.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,w.jsxs)(i,{variant:`body-small-default`,className:`text-[var(--content-default)]`,children:[`+`,e.length,` more`]})})}),(0,w.jsx)(v.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,w.jsx)(ct,{item:e},e.rank))})]})}function ut({message:e}){return(0,w.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,w.jsx)(i,{variant:`body-small-default`,className:`text-[var(--content-default)]`,children:e})})}function dt({step:e}){let t=e.overflowResults??[];return(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(e.results??[]).map(e=>(0,w.jsx)($,{variant:`web`,url:e.url,faviconUrl:e.faviconUrl,domain:e.domain,label:e.title},e.rank)),t.length>0?(0,w.jsx)(lt,{results:t}):null]})}function ft({step:e}){return(0,w.jsx)(ut,{message:e.errorMessage})}function pt({faviconUrl:e,domain:t,title:n,className:r}){let[i,a]=(0,C.useState)(!1);(0,C.useEffect)(()=>{a(!1)},[e]);let o=!!e&&!i,s=(t&&t.length>0?t:n).charAt(0).toUpperCase();return(0,w.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`site-favicon`,className:b(`inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center overflow-hidden rounded-[var(--radius-sm)]`,r),children:o?(0,w.jsx)(`img`,{src:e,alt:``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`h-full w-full object-contain`,onError:()=>a(!0)}):(0,w.jsx)(`span`,{className:`text-[10px] font-medium leading-none text-[var(--content-tertiary)]`,children:s})})}export{D as C,E as S,fe as _,nt as a,xe as b,Ze as c,q as d,et as f,W as g,Ue as h,$ as i,Qe as l,K as m,ft as n,G as o,Y as p,dt as r,Ye as s,pt as t,J as u,je as v,T as w,Ce as x,O as y};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-FWzaVb8P.js";import{t as n}from"./react-BFJW0bSv.js";import{F as r,t as i}from"./button-Dy5001j6.js";import{f as a,l as o,n as s,u as c}from"./chunk-5KNZJZUH-Bsoom5--.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-DRIctGVs.js";import{t as p}from"./createLucideIcon-CAM1RhH8.js";import{t as m}from"./arrow-down-to-line-Bh_5sIPp.js";import{t as h}from"./arrow-left-C2ylPLHq.js";import{a as g,n as _,o as v,r as y,t as b}from"./use-skill-actions-COF5ItNI.js";import{t as x}from"./chevron-down-B5A-0g8A.js";import{t as S}from"./menu-CKZtG-s_.js";import{t as C}from"./code-qafFA0_-.js";import{t as w}from"./external-link-CAce-RVu.js";import{t as T}from"./eye-DTyDWiqu.js";import{t as E}from"./file-text-BCsUYVEF.js";import{t as D}from"./folder-g06qTW2O.js";import{t as O}from"./loader-circle-BzJ2kz3F.js";import{t as k}from"./trash-2-De6X8YiM.js";import{t as A}from"./triangle-alert--e3n47gm.js";import{M as j}from"./src-C3NeO9Jd.js";import{n as M,t as N}from"./file-markdown-DYpaSkNo.js";import{d as P}from"./routes-GmNvdtLW.js";import{St as F,un as I,wt as L}from"./react-query.gen-0mspArBl.js";import{n as ee}from"./use-is-mobile-Cx2xnNUx.js";import{t as te}from"./open-workspace-file-CqN4BPYt.js";import{t as R}from"./use-active-assistant-id-CjvzlL4t.js";import{n as z,t as B}from"./use-skill-detail-files-BVBb8uoK.js";import{n as V,r as ne,t as H}from"./skills-DK5e24Im.js";import{t as U}from"./use-edge-swipe-back-Dbz1hC9g.js";import{i as W,n as G,r as K,t as q}from"./file-editor-DcH2Os5o.js";var J=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`}]]),Y=e(n(),1),X=d();function re({assistantId:e,skill:t,onBack:n,onInstall:r,onRemove:a,isInstalling:o=!1,isRemoving:s=!1,sourceConversationId:c}){let l=y(t),u=V(t),{fileEntries:d,setSelectedPath:p,activePath:_,activeFile:b,isFilesLoading:x,fileContent:S,isBinary:C,isContentLoading:w}=B(e,t.id);return(0,X.jsxs)(`div`,{className:`flex h-[calc(100vh-14rem)] flex-col`,children:[(0,X.jsxs)(`div`,{className:`mb-4 flex items-start gap-3`,children:[(0,X.jsx)(i,{type:`button`,variant:`ghost`,iconOnly:(0,X.jsx)(h,{"aria-hidden":!0}),"aria-label":`Back to skills`,onClick:n}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,X.jsx)(v,{skill:t,className:`h-8 w-8 text-3xl`}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,X.jsx)(`h2`,{className:`text-title-medium`,style:{color:`var(--content-default)`},children:t.name}),(0,X.jsx)(g,{origin:t.origin})]}),(0,X.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:t.description}),(0,X.jsx)(z,{skill:{origin:t.origin,sourceConversationId:c},className:`mt-1`})]})]}),l?o?(0,X.jsx)(`div`,{className:`flex h-9 items-center px-3`,children:(0,X.jsx)(O,{className:`h-4 w-4 animate-spin`,style:{color:`var(--content-tertiary)`}})}):(0,X.jsx)(i,{type:`button`,onClick:r,disabled:!r,leftIcon:(0,X.jsx)(m,{"aria-hidden":!0}),children:`Install`}):(0,X.jsx)(i,{type:`button`,variant:u?`dangerOutline`:`outlined`,onClick:a,disabled:!u||s||!a,leftIcon:s?(0,X.jsx)(O,{className:`animate-spin`,"aria-hidden":!0}):(0,X.jsx)(k,{"aria-hidden":!0}),children:`Remove`})]})]}),(0,X.jsx)(f.Root,{asChild:!0,noPadding:!0,children:(0,X.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden sm:grid`,style:{gridTemplateColumns:`240px 1fr`},children:[(0,X.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,X.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,X.jsx)(O,{className:`h-4 w-4 animate-spin`,style:{color:`var(--content-tertiary)`}})}):d.length===0?(0,X.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,X.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,X.jsx)(D,{className:`h-4 w-4 shrink-0`,style:{color:`var(--system-mid-strong)`}}):(0,X.jsx)(E,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),(0,X.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path)})}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:w?(0,X.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,X.jsx)(O,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})}):b?(0,X.jsx)(ie,{assistantId:e,skillId:t.id,fileName:b.name,filePath:b.path,content:S,isBinary:C,editable:t.kind===`installed`},`${t.id}/${b.path}`):(0,X.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.`})})]})})]})}function ie({assistantId:e,skillId:n,fileName:r,filePath:a,content:o,isBinary:s,editable:c}){let u=l(),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(``),h=`skills/${n}/${a}`,g=I({onSuccess:()=>{f(!1),m(``),u.invalidateQueries({queryKey:[{_id:`skillsByIdFilesContentGet`}]}),u.invalidateQueries({queryKey:[{_id:`skillsByIdFilesGet`}]}),a===`SKILL.md`&&H(u,e)},onError:e=>{t(e,{context:`skill-file-save`,bestEffort:!0})}}),_=d&&p!==(o??``),v=(0,Y.useCallback)(()=>{!_||g.isPending||g.mutate({path:{assistant_id:e},body:{path:h,content:p,encoding:`utf8`}})},[_,g,e,h,p]),y=(0,Y.useCallback)(()=>{f(!0),m(o??``),g.reset()},[o,g]),b=(0,Y.useCallback)(()=>{f(!1),m(``),g.reset()},[g]);if(s)return(0,X.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,X.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,X.jsx)(i,{variant:`ghost`,size:`regular`,iconOnly:(0,X.jsx)(w,{"aria-hidden":!0}),onClick:()=>void te(h),"aria-label":`Open in Workspace`,className:`hover:bg-[var(--surface-base)]`}):void 0;return M(r,void 0)&&!d?(0,X.jsx)(`div`,{className:`relative flex h-full flex-col`,children:(0,X.jsxs)(`div`,{className:`relative flex-1 overflow-auto px-6 py-4`,style:{color:`var(--content-default)`},children:[(0,X.jsx)(q,{content:o,fileName:r,showEdit:c,isEditing:!1,onToggleEdit:y,extraActions:x}),(0,X.jsx)(N,{content:o})]})}):(0,X.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,X.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,children:[(0,X.jsx)(q,{content:d?p:o,fileName:r,showEdit:c,isEditing:d,onToggleEdit:()=>d?b():y(),extraActions:x}),d?(0,X.jsx)(K,{value:p,onChange:m,onSave:v}):(0,X.jsx)(W,{content:o,readOnly:!c,onStartEdit:y})]}),d&&(0,X.jsx)(G,{isDirty:_,isSaving:g.isPending,error:g.isError?`Save failed`:null,onSave:v,onDiscard:b})]})}var ae=e(r(),1);function oe({fileName:e,content:t,isBinary:n,viewMode:r=`preview`}){return n?(0,X.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,X.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,`.`]}):M(e,void 0)&&r===`preview`?(0,X.jsx)(`div`,{className:`h-full overflow-auto px-6 py-4`,style:{color:`var(--content-default)`},children:(0,X.jsx)(N,{content:t})}):(0,X.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 se({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=V(t),{fileEntries:p,setSelectedPath:m,activePath:_,activeFile:b,isFilesLoading:x,fileContent:S,isBinary:w,isContentLoading:E}=B(e,t.id),[D,k]=(0,Y.useState)(`preview`);(0,Y.useEffect)(()=>{k(`preview`)},[_]);let[A,N]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{N(document.getElementById(`viewport-overlays`))},[]);let P=b?M(b.name,void 0):!1,F=P?D:`raw`,I=(0,X.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,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsx)(i,{variant:`ghost`,iconOnly:(0,X.jsx)(h,{"aria-hidden":!0}),expandOnMobile:!0,"aria-label":`Back to skills`,onClick:n,className:`max-md:bg-[var(--surface-active)]`}),(0,X.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,X.jsx)(ce,{available:u,removable:d,isInstalling:o,isRemoving:s,onInstall:r,onRemove:a})]}),(0,X.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(v,{skill:t,className:`h-6 w-6 shrink-0 text-[22px] leading-none`}),(0,X.jsx)(`h2`,{className:`min-w-0 truncate text-title-medium`,style:{color:`var(--content-emphasised)`},children:t.name})]}),(0,X.jsx)(g,{origin:t.origin})]}),(0,X.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:t.description}),(0,X.jsx)(z,{skill:{origin:t.origin,sourceConversationId:l}})]}),(0,X.jsx)(f.Root,{asChild:!0,noPadding:!0,children:(0,X.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,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-3 py-2`,style:{borderColor:`var(--border-hover)`},children:[(0,X.jsx)(Z,{fileEntries:p,activePath:_,activeName:b?.name??null,onSelect:m}),(0,X.jsx)(j,{iconOnly:!0,ariaLabel:`File view mode`,value:F,onChange:k,items:[{value:`preview`,label:`Preview`,icon:(0,X.jsx)(T,{"aria-hidden":!0}),disabled:!P},{value:`raw`,label:`Source`,icon:(0,X.jsx)(C,{"aria-hidden":!0})}]})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:x||E?(0,X.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,X.jsx)(O,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})}):b?(0,X.jsx)(oe,{fileName:b.name,content:S,isBinary:w,viewMode:F}):(0,X.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,ae.createPortal)(I,A):I}function ce({available:e,removable:t,isInstalling:n,isRemoving:r,onInstall:a,onRemove:o}){return n||r?(0,X.jsx)(i,{variant:`ghost`,iconOnly:(0,X.jsx)(O,{className:`animate-spin`,"aria-hidden":!0}),expandOnMobile:!0,disabled:!0,"aria-label":`Pending`,className:`max-md:bg-[var(--surface-active)]`}):e?(0,X.jsx)(i,{variant:`ghost`,iconOnly:(0,X.jsx)(m,{"aria-hidden":!0}),expandOnMobile:!0,"aria-label":`Install skill`,onClick:a,disabled:!a,className:`max-md:bg-[var(--surface-active)]`}):t?(0,X.jsx)(i,{variant:`dangerGhost`,iconOnly:(0,X.jsx)(k,{"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,X.jsx)(i,{variant:`dangerGhost`,iconOnly:(0,X.jsx)(k,{"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 le(e){return(e??``).endsWith(`/directory`)}function Z({fileEntries:e,activePath:t,activeName:n,onSelect:r}){let i=n??`Select a file`;return e.length===0?(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-body-medium-default`,style:{color:`var(--content-emphasised)`},children:[(0,X.jsx)(Q,{}),(0,X.jsx)(`span`,{className:`truncate`,children:i})]}):(0,X.jsxs)(S.Root,{children:[(0,X.jsx)(S.Trigger,{children:(0,X.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,X.jsx)(Q,{}),(0,X.jsx)(`span`,{className:`truncate`,children:i}),(0,X.jsx)(x,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0})]})}),(0,X.jsx)(S.Content,{align:`start`,children:e.map(e=>{let n=le(e.mimeType);return(0,X.jsx)(S.Item,{onSelect:()=>r(e.path),leftIcon:n?(0,X.jsx)(D,{}):(0,X.jsx)(E,{}),"aria-current":e.path===t?`true`:void 0,children:e.name},e.path)})})]})}function Q(){return(0,X.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,X.jsx)(E,{className:`h-4 w-4`,style:{color:`var(--content-secondary)`}})})}function ue(){return(0,X.jsx)(_,{icon:A,iconColor:`var(--system-danger)`,title:`Failed to load skills`,subtitle:`Something went wrong. Try refreshing the page.`})}function $(){return(0,X.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,X.jsx)(O,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})})}function de(){let e=R(),{skillId:t}=a(),n=c(),r=o(),{pathname:l}=r,d=ee(),f=(0,Y.useRef)(null),p=r.state,m=typeof p?.listSearch==`string`?p.listSearch:``,g=u({...L({path:{assistant_id:e},query:{include:`catalog`}}),select:e=>e.skills,refetchOnMount:`always`}),v=(0,Y.useCallback)(()=>{n(`${P.superpowers}${m}`,{replace:!0})},[n,m]);U({containerRef:f,onBack:v,enabled:d,navKey:l});let{handleInstall:y,handleRemove:x,isInstallingSkill:S,isRemovingSkill:C,skillPendingRemoval:w,confirmRemove:T,cancelRemove:E}=b(e,{onRemoved:v}),D=g.data,O=(0,Y.useMemo)(()=>D?.find(e=>e.id===t)??null,[D,t]),k=u({...F({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,X.jsx)(s,{to:P.superpowers,replace:!0});if(g.isLoading)return(0,X.jsx)($,{});if(g.isError&&!O)return(0,X.jsx)(ue,{});if(!O&&g.isFetching)return(0,X.jsx)($,{});if(!O)return(0,X.jsx)(_,{icon:J,title:`Skill not found`,subtitle:`This skill may have been removed, or the link is out of date.`,children:(0,X.jsx)(i,{type:`button`,variant:`outlined`,className:`mt-4`,leftIcon:(0,X.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,X.jsxs)(X.Fragment,{children:[d?(0,X.jsx)(se,{...A,swipeContainerRef:f}):(0,X.jsx)(re,{...A}),(0,X.jsx)(ne,{skillName:w?.name??null,onConfirm:T,onCancel:E})]})}export{de as SkillDetailPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-FWzaVb8P.js";import{t as n}from"./react-BFJW0bSv.js";import{F as r,t as i}from"./button-Dy5001j6.js";import{f as a,l as o,n as s,u as c}from"./chunk-5KNZJZUH-Bsoom5--.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-DRIctGVs.js";import{t as p}from"./createLucideIcon-CAM1RhH8.js";import{t as m}from"./arrow-down-to-line-Bh_5sIPp.js";import{t as h}from"./arrow-left-C2ylPLHq.js";import{a as g,n as _,o as v,r as y,t as b}from"./use-skill-actions-BLHTDn21.js";import{t as x}from"./chevron-down-B5A-0g8A.js";import{t as S}from"./menu-CKZtG-s_.js";import{t as C}from"./code-qafFA0_-.js";import{t as w}from"./external-link-CAce-RVu.js";import{t as T}from"./eye-DTyDWiqu.js";import{t as E}from"./file-text-BCsUYVEF.js";import{t as D}from"./folder-g06qTW2O.js";import{t as O}from"./loader-circle-BzJ2kz3F.js";import{t as k}from"./trash-2-De6X8YiM.js";import{t as A}from"./triangle-alert--e3n47gm.js";import{M as j}from"./src-BAS7a2RG.js";import{n as M,t as N}from"./file-markdown-DBLxtb0M.js";import{d as P}from"./routes-GmNvdtLW.js";import{St as F,un as I,wt as L}from"./react-query.gen-0mspArBl.js";import{n as ee}from"./use-is-mobile-Cx2xnNUx.js";import{t as te}from"./open-workspace-file-DYklNHQ0.js";import{t as R}from"./use-active-assistant-id-CjvzlL4t.js";import{n as z,t as B}from"./use-skill-detail-files-BVBb8uoK.js";import{n as V,r as ne,t as H}from"./skills-BL4RgwAd.js";import{t as U}from"./use-edge-swipe-back-Dbz1hC9g.js";import{i as W,n as G,r as K,t as q}from"./file-editor-DcH2Os5o.js";var J=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`}]]),Y=e(n(),1),X=d();function re({assistantId:e,skill:t,onBack:n,onInstall:r,onRemove:a,isInstalling:o=!1,isRemoving:s=!1,sourceConversationId:c}){let l=y(t),u=V(t),{fileEntries:d,setSelectedPath:p,activePath:_,activeFile:b,isFilesLoading:x,fileContent:S,isBinary:C,isContentLoading:w}=B(e,t.id);return(0,X.jsxs)(`div`,{className:`flex h-[calc(100vh-14rem)] flex-col`,children:[(0,X.jsxs)(`div`,{className:`mb-4 flex items-start gap-3`,children:[(0,X.jsx)(i,{type:`button`,variant:`ghost`,iconOnly:(0,X.jsx)(h,{"aria-hidden":!0}),"aria-label":`Back to skills`,onClick:n}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,X.jsx)(v,{skill:t,className:`h-8 w-8 text-3xl`}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,X.jsx)(`h2`,{className:`text-title-medium`,style:{color:`var(--content-default)`},children:t.name}),(0,X.jsx)(g,{origin:t.origin})]}),(0,X.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:t.description}),(0,X.jsx)(z,{skill:{origin:t.origin,sourceConversationId:c},className:`mt-1`})]})]}),l?o?(0,X.jsx)(`div`,{className:`flex h-9 items-center px-3`,children:(0,X.jsx)(O,{className:`h-4 w-4 animate-spin`,style:{color:`var(--content-tertiary)`}})}):(0,X.jsx)(i,{type:`button`,onClick:r,disabled:!r,leftIcon:(0,X.jsx)(m,{"aria-hidden":!0}),children:`Install`}):(0,X.jsx)(i,{type:`button`,variant:u?`dangerOutline`:`outlined`,onClick:a,disabled:!u||s||!a,leftIcon:s?(0,X.jsx)(O,{className:`animate-spin`,"aria-hidden":!0}):(0,X.jsx)(k,{"aria-hidden":!0}),children:`Remove`})]})]}),(0,X.jsx)(f.Root,{asChild:!0,noPadding:!0,children:(0,X.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden sm:grid`,style:{gridTemplateColumns:`240px 1fr`},children:[(0,X.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,X.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,X.jsx)(O,{className:`h-4 w-4 animate-spin`,style:{color:`var(--content-tertiary)`}})}):d.length===0?(0,X.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,X.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,X.jsx)(D,{className:`h-4 w-4 shrink-0`,style:{color:`var(--system-mid-strong)`}}):(0,X.jsx)(E,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),(0,X.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path)})}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:w?(0,X.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,X.jsx)(O,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})}):b?(0,X.jsx)(ie,{assistantId:e,skillId:t.id,fileName:b.name,filePath:b.path,content:S,isBinary:C,editable:t.kind===`installed`},`${t.id}/${b.path}`):(0,X.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.`})})]})})]})}function ie({assistantId:e,skillId:n,fileName:r,filePath:a,content:o,isBinary:s,editable:c}){let u=l(),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(``),h=`skills/${n}/${a}`,g=I({onSuccess:()=>{f(!1),m(``),u.invalidateQueries({queryKey:[{_id:`skillsByIdFilesContentGet`}]}),u.invalidateQueries({queryKey:[{_id:`skillsByIdFilesGet`}]}),a===`SKILL.md`&&H(u,e)},onError:e=>{t(e,{context:`skill-file-save`,bestEffort:!0})}}),_=d&&p!==(o??``),v=(0,Y.useCallback)(()=>{!_||g.isPending||g.mutate({path:{assistant_id:e},body:{path:h,content:p,encoding:`utf8`}})},[_,g,e,h,p]),y=(0,Y.useCallback)(()=>{f(!0),m(o??``),g.reset()},[o,g]),b=(0,Y.useCallback)(()=>{f(!1),m(``),g.reset()},[g]);if(s)return(0,X.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,X.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,X.jsx)(i,{variant:`ghost`,size:`regular`,iconOnly:(0,X.jsx)(w,{"aria-hidden":!0}),onClick:()=>void te(h),"aria-label":`Open in Workspace`,className:`hover:bg-[var(--surface-base)]`}):void 0;return M(r,void 0)&&!d?(0,X.jsx)(`div`,{className:`relative flex h-full flex-col`,children:(0,X.jsxs)(`div`,{className:`relative flex-1 overflow-auto px-6 py-4`,style:{color:`var(--content-default)`},children:[(0,X.jsx)(q,{content:o,fileName:r,showEdit:c,isEditing:!1,onToggleEdit:y,extraActions:x}),(0,X.jsx)(N,{content:o})]})}):(0,X.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,X.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,children:[(0,X.jsx)(q,{content:d?p:o,fileName:r,showEdit:c,isEditing:d,onToggleEdit:()=>d?b():y(),extraActions:x}),d?(0,X.jsx)(K,{value:p,onChange:m,onSave:v}):(0,X.jsx)(W,{content:o,readOnly:!c,onStartEdit:y})]}),d&&(0,X.jsx)(G,{isDirty:_,isSaving:g.isPending,error:g.isError?`Save failed`:null,onSave:v,onDiscard:b})]})}var ae=e(r(),1);function oe({fileName:e,content:t,isBinary:n,viewMode:r=`preview`}){return n?(0,X.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,X.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,`.`]}):M(e,void 0)&&r===`preview`?(0,X.jsx)(`div`,{className:`h-full overflow-auto px-6 py-4`,style:{color:`var(--content-default)`},children:(0,X.jsx)(N,{content:t})}):(0,X.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 se({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=V(t),{fileEntries:p,setSelectedPath:m,activePath:_,activeFile:b,isFilesLoading:x,fileContent:S,isBinary:w,isContentLoading:E}=B(e,t.id),[D,k]=(0,Y.useState)(`preview`);(0,Y.useEffect)(()=>{k(`preview`)},[_]);let[A,N]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{N(document.getElementById(`viewport-overlays`))},[]);let P=b?M(b.name,void 0):!1,F=P?D:`raw`,I=(0,X.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,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsx)(i,{variant:`ghost`,iconOnly:(0,X.jsx)(h,{"aria-hidden":!0}),expandOnMobile:!0,"aria-label":`Back to skills`,onClick:n,className:`max-md:bg-[var(--surface-active)]`}),(0,X.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,X.jsx)(ce,{available:u,removable:d,isInstalling:o,isRemoving:s,onInstall:r,onRemove:a})]}),(0,X.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(v,{skill:t,className:`h-6 w-6 shrink-0 text-[22px] leading-none`}),(0,X.jsx)(`h2`,{className:`min-w-0 truncate text-title-medium`,style:{color:`var(--content-emphasised)`},children:t.name})]}),(0,X.jsx)(g,{origin:t.origin})]}),(0,X.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:t.description}),(0,X.jsx)(z,{skill:{origin:t.origin,sourceConversationId:l}})]}),(0,X.jsx)(f.Root,{asChild:!0,noPadding:!0,children:(0,X.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,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-3 py-2`,style:{borderColor:`var(--border-hover)`},children:[(0,X.jsx)(Z,{fileEntries:p,activePath:_,activeName:b?.name??null,onSelect:m}),(0,X.jsx)(j,{iconOnly:!0,ariaLabel:`File view mode`,value:F,onChange:k,items:[{value:`preview`,label:`Preview`,icon:(0,X.jsx)(T,{"aria-hidden":!0}),disabled:!P},{value:`raw`,label:`Source`,icon:(0,X.jsx)(C,{"aria-hidden":!0})}]})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:x||E?(0,X.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,X.jsx)(O,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})}):b?(0,X.jsx)(oe,{fileName:b.name,content:S,isBinary:w,viewMode:F}):(0,X.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,ae.createPortal)(I,A):I}function ce({available:e,removable:t,isInstalling:n,isRemoving:r,onInstall:a,onRemove:o}){return n||r?(0,X.jsx)(i,{variant:`ghost`,iconOnly:(0,X.jsx)(O,{className:`animate-spin`,"aria-hidden":!0}),expandOnMobile:!0,disabled:!0,"aria-label":`Pending`,className:`max-md:bg-[var(--surface-active)]`}):e?(0,X.jsx)(i,{variant:`ghost`,iconOnly:(0,X.jsx)(m,{"aria-hidden":!0}),expandOnMobile:!0,"aria-label":`Install skill`,onClick:a,disabled:!a,className:`max-md:bg-[var(--surface-active)]`}):t?(0,X.jsx)(i,{variant:`dangerGhost`,iconOnly:(0,X.jsx)(k,{"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,X.jsx)(i,{variant:`dangerGhost`,iconOnly:(0,X.jsx)(k,{"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 le(e){return(e??``).endsWith(`/directory`)}function Z({fileEntries:e,activePath:t,activeName:n,onSelect:r}){let i=n??`Select a file`;return e.length===0?(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-body-medium-default`,style:{color:`var(--content-emphasised)`},children:[(0,X.jsx)(Q,{}),(0,X.jsx)(`span`,{className:`truncate`,children:i})]}):(0,X.jsxs)(S.Root,{children:[(0,X.jsx)(S.Trigger,{children:(0,X.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,X.jsx)(Q,{}),(0,X.jsx)(`span`,{className:`truncate`,children:i}),(0,X.jsx)(x,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0})]})}),(0,X.jsx)(S.Content,{align:`start`,children:e.map(e=>{let n=le(e.mimeType);return(0,X.jsx)(S.Item,{onSelect:()=>r(e.path),leftIcon:n?(0,X.jsx)(D,{}):(0,X.jsx)(E,{}),"aria-current":e.path===t?`true`:void 0,children:e.name},e.path)})})]})}function Q(){return(0,X.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,X.jsx)(E,{className:`h-4 w-4`,style:{color:`var(--content-secondary)`}})})}function ue(){return(0,X.jsx)(_,{icon:A,iconColor:`var(--system-danger)`,title:`Failed to load skills`,subtitle:`Something went wrong. Try refreshing the page.`})}function $(){return(0,X.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,X.jsx)(O,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})})}function de(){let e=R(),{skillId:t}=a(),n=c(),r=o(),{pathname:l}=r,d=ee(),f=(0,Y.useRef)(null),p=r.state,m=typeof p?.listSearch==`string`?p.listSearch:``,g=u({...L({path:{assistant_id:e},query:{include:`catalog`}}),select:e=>e.skills,refetchOnMount:`always`}),v=(0,Y.useCallback)(()=>{n(`${P.superpowers}${m}`,{replace:!0})},[n,m]);U({containerRef:f,onBack:v,enabled:d,navKey:l});let{handleInstall:y,handleRemove:x,isInstallingSkill:S,isRemovingSkill:C,skillPendingRemoval:w,confirmRemove:T,cancelRemove:E}=b(e,{onRemoved:v}),D=g.data,O=(0,Y.useMemo)(()=>D?.find(e=>e.id===t)??null,[D,t]),k=u({...F({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,X.jsx)(s,{to:P.superpowers,replace:!0});if(g.isLoading)return(0,X.jsx)($,{});if(g.isError&&!O)return(0,X.jsx)(ue,{});if(!O&&g.isFetching)return(0,X.jsx)($,{});if(!O)return(0,X.jsx)(_,{icon:J,title:`Skill not found`,subtitle:`This skill may have been removed, or the link is out of date.`,children:(0,X.jsx)(i,{type:`button`,variant:`outlined`,className:`mt-4`,leftIcon:(0,X.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,X.jsxs)(X.Fragment,{children:[d?(0,X.jsx)(se,{...A,swipeContainerRef:f}):(0,X.jsx)(re,{...A}),(0,X.jsx)(ne,{skillName:w?.name??null,onConfirm:T,onCancel:E})]})}export{de as SkillDetailPage};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-FWzaVb8P.js";import{t as n}from"./react-BFJW0bSv.js";import{t as r}from"./button-Dy5001j6.js";import{u as i}from"./chunk-5KNZJZUH-Bsoom5--.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-DEI9Ra9z.js";import{t as l}from"./brain-BIzJCPA6.js";import{t as u}from"./menu-CKZtG-s_.js";import{t as d}from"./ellipsis-BRJI5_P1.js";import{t as f}from"./loader-circle-BzJ2kz3F.js";import{t as p}from"./trash-2-De6X8YiM.js";import"./src-C3NeO9Jd.js";import{t as m}from"./file-markdown-DYpaSkNo.js";import{n as h}from"./resolved-assistants-store-8HQDfxZh.js";import{d as g}from"./routes-GmNvdtLW.js";import{St as _,ln as v}from"./react-query.gen-0mspArBl.js";import{t as y}from"./detail-shell-aB8B_tLZ.js";import{n as b,t as x}from"./use-skill-detail-files-BVBb8uoK.js";import{n as S,r as C,t as w}from"./skills-DK5e24Im.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
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-FWzaVb8P.js";import{t as n}from"./react-BFJW0bSv.js";import{t as r}from"./button-Dy5001j6.js";import{u as i}from"./chunk-5KNZJZUH-Bsoom5--.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-DEI9Ra9z.js";import{t as l}from"./brain-BIzJCPA6.js";import{t as u}from"./menu-CKZtG-s_.js";import{t as d}from"./ellipsis-BRJI5_P1.js";import{t as f}from"./loader-circle-BzJ2kz3F.js";import{t as p}from"./trash-2-De6X8YiM.js";import"./src-BAS7a2RG.js";import{t as m}from"./file-markdown-DBLxtb0M.js";import{n as h}from"./resolved-assistants-store-8HQDfxZh.js";import{d as g}from"./routes-GmNvdtLW.js";import{St as _,ln as v}from"./react-query.gen-0mspArBl.js";import{t as y}from"./detail-shell-D9L3L7AM.js";import{n as b,t as x}from"./use-skill-detail-files-BVBb8uoK.js";import{n as S,r as C,t as w}from"./skills-BL4RgwAd.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-C3NeO9Jd.js";import{t}from"./confirm-dialog-DZX6LhLy.js";import{Tt as n}from"./react-query.gen-0mspArBl.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};
1
+ import{t as e}from"./jsx-runtime-D3ZM-ToX.js";import"./src-BAS7a2RG.js";import{t}from"./confirm-dialog-DZX6LhLy.js";import{Tt as n}from"./react-query.gen-0mspArBl.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};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-Dy5001j6.js";import{t as r}from"./jsx-runtime-D3ZM-ToX.js";import{t as i}from"./typography-DEI9Ra9z.js";import{t as a}from"./check-sC49_hjU.js";import{t as o}from"./clipboard-copy-JwIceweN.js";import{t as s}from"./external-link-CAce-RVu.js";import"./src-C3NeO9Jd.js";import{t as c}from"./input-C-GkeWCw.js";import{t as l}from"./use-copy-to-clipboard-BarKTY4m.js";var u=e(t(),1),d=[`app_mentions:read`,`assistant:write`,`channels:history`,`channels:join`,`channels:read`,`chat:write`,`files:read`,`files:write`,`groups:history`,`groups:read`,`im:history`,`im:read`,`im:write`,`mpim:history`,`mpim:read`,`reactions:read`,`reactions:write`,`users:read`],f=[`channels:join`,`files:read`,`files:write`,`reactions:read`,`reactions:write`],p=[`channels:history`,`channels:read`,`groups:history`,`groups:read`,`im:history`,`im:read`,`mpim:history`,`mpim:read`,`reactions:read`,`search:read`,`users:read`],m=[`reactions:read`,`search:read`],h=35,g=140,_=300;function v(e,t=``){let n=e.trim().slice(0,h)||`My Assistant`;return{display_information:{name:n,...t?{description:t.slice(0,g)}:{},background_color:`#1a1a2e`},features:{app_home:{home_tab_enabled:!1,messages_tab_enabled:!0,messages_tab_read_only_enabled:!1},bot_user:{display_name:n,always_online:!0},agent_view:{agent_description:(t||n).slice(0,_),suggested_prompts:[]}},oauth_config:{scopes:{bot:[...d],bot_optional:[...f],user:[...p],user_optional:[...m]}},settings:{event_subscriptions:{bot_events:[`app_mention`,`app_context_changed`,`message.channels`,`message.groups`,`message.im`,`message.mpim`,`reaction_added`]},interactivity:{is_enabled:!0},org_deploy_enabled:!1,socket_mode_enabled:!0,token_rotation_enabled:!1}}}var y=r(),b=`https://api.slack.com/apps?new_app=1`,x=`xoxb-`,S=`xapp-`,C=20;function w(e,t,n){let r=e.trim();return r?r.startsWith(t)?r.length<C?`${n} looks truncated — copy the whole value from Slack.`:null:`${n} should start with "${t}".`:null}function T({assistantName:e,onSave:t,saveStatus:r=`idle`,saveError:d=null}){let[f,p]=(0,u.useState)(e),[m,h]=(0,u.useState)(``),g=(0,u.useRef)(!1);(0,u.useEffect)(()=>{g.current||p(e)},[e]);let[_,C]=(0,u.useState)(``),[T,E]=(0,u.useState)(``),{copy:D,copied:O}=l(),k=(0,u.useMemo)(()=>JSON.stringify(v(f,m),null,2),[f,m]),A=f.trim().length>0,j=w(_,x,`Bot token`),M=w(T,S,`App token`),N=_.trim().length>0&&T.trim().length>0&&!j&&!M&&r!==`pending`,P=(0,u.useCallback)(()=>{D(k)},[D,k]),F=(0,u.useCallback)(()=>{window.open(b,`_blank`,`noopener,noreferrer`)},[]),I=(0,u.useCallback)(()=>{N&&t?.(_.trim(),T.trim())},[N,t,_,T]);return(0,y.jsx)(`div`,{"data-slot":`slack-setup-wizard`,children:(0,y.jsxs)(`div`,{className:`flex flex-col gap-5 rounded-lg bg-[var(--surface-sunken)] p-4`,children:[(0,y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,y.jsx)(i,{as:`p`,variant:`body-medium-lighter`,className:`text-[color:var(--content-default)]`,children:`Name your Slack app, copy its manifest, then create it in Slack. All permissions and settings come pre-configured.`}),(0,y.jsx)(c,{label:`App Name`,value:f,onChange:e=>{g.current=!0,p(e.target.value.slice(0,35))},placeholder:`My Assistant`,fullWidth:!0}),(0,y.jsx)(c,{label:`Description (optional)`,value:m,onChange:e=>h(e.target.value.slice(0,140)),placeholder:`What this assistant helps with`,helperText:`Shown on the app's Slack profile.`,fullWidth:!0})]}),(0,y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,y.jsx)(i,{as:`p`,variant:`body-medium-lighter`,className:`text-[color:var(--content-default)]`,children:`In Slack:`}),(0,y.jsxs)(`ol`,{className:`list-decimal list-inside space-y-1 text-body-medium-lighter text-[var(--content-default)]`,children:[(0,y.jsxs)(`li`,{children:[`Under `,(0,y.jsx)(`strong`,{children:`Or start your own way`}),`, pick`,` `,(0,y.jsx)(`strong`,{children:`From a manifest`}),`, then `,(0,y.jsx)(`strong`,{children:`Continue`})]}),(0,y.jsx)(`li`,{children:`Choose your workspace and give it the manifest you copied`}),(0,y.jsxs)(`li`,{children:[`Review the permissions, then click`,` `,(0,y.jsx)(`strong`,{children:`Create and Install`})]}),(0,y.jsxs)(`li`,{children:[`Expand `,(0,y.jsx)(`strong`,{children:`Your app credentials`}),` and copy both the`,` `,(0,y.jsx)(`strong`,{children:`Bot token`}),` and `,(0,y.jsx)(`strong`,{children:`App token`})]})]}),(0,y.jsxs)(i,{as:`p`,variant:`body-small-default`,className:`text-[color:var(--content-faint)]`,children:[`Slack's last screen also offers a command-line walkthrough and a `,(0,y.jsx)(`strong`,{children:`Download app files`}),` button. Skip both — they set up a separate local app, and this assistant needs only the two tokens.`]}),(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,y.jsx)(n,{type:`button`,variant:`outlined`,disabled:!A,onClick:P,leftIcon:O?(0,y.jsx)(a,{"aria-hidden":!0,className:`size-4`}):(0,y.jsx)(o,{"aria-hidden":!0,className:`size-4`}),children:O?`Copied!`:`Copy manifest JSON`}),(0,y.jsx)(n,{type:`button`,disabled:!A,onClick:F,rightIcon:(0,y.jsx)(s,{"aria-hidden":!0,className:`size-4`}),children:`Open Slack`})]}),(0,y.jsxs)(i,{as:`p`,variant:`body-small-default`,className:`text-[color:var(--content-faint)]`,children:[`If Slack shows “Request approval” instead of`,` `,(0,y.jsx)(`strong`,{children:`Install`}),`, a workspace admin needs to approve the app first.`]})]}),(0,y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,y.jsxs)(i,{as:`p`,variant:`body-medium-lighter`,className:`text-[color:var(--content-default)]`,children:[`Paste both tokens from Slack's`,` `,(0,y.jsx)(`strong`,{children:`Your app credentials`}),` panel:`]}),(0,y.jsx)(c,{label:`Bot Token`,type:`password`,value:_,onChange:e=>C(e.target.value),placeholder:`${x}...`,errorText:j??void 0,fullWidth:!0}),(0,y.jsx)(c,{label:`App Token`,type:`password`,value:T,onChange:e=>E(e.target.value),placeholder:`${S}...`,errorText:M??void 0,fullWidth:!0}),(0,y.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,y.jsx)(n,{type:`button`,variant:`primary`,onClick:I,disabled:!N,children:r===`pending`?`Connecting…`:`Connect Slack`})}),r===`success`&&(0,y.jsx)(i,{as:`p`,variant:`body-small-default`,className:`text-[color:var(--content-positive)]`,children:`Credentials saved.`}),r===`error`&&d&&(0,y.jsx)(i,{as:`p`,variant:`body-small-default`,className:`text-[color:var(--system-negative-strong)]`,children:d})]})]})})}export{T as t};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-Dy5001j6.js";import{t as r}from"./jsx-runtime-D3ZM-ToX.js";import{t as i}from"./typography-DEI9Ra9z.js";import{t as a}from"./check-sC49_hjU.js";import{t as o}from"./clipboard-copy-JwIceweN.js";import{t as s}from"./external-link-CAce-RVu.js";import"./src-BAS7a2RG.js";import{t as c}from"./input-C-GkeWCw.js";import{t as l}from"./use-copy-to-clipboard-BarKTY4m.js";var u=e(t(),1),d=[`app_mentions:read`,`assistant:write`,`channels:history`,`channels:join`,`channels:read`,`chat:write`,`files:read`,`files:write`,`groups:history`,`groups:read`,`im:history`,`im:read`,`im:write`,`mpim:history`,`mpim:read`,`reactions:read`,`reactions:write`,`users:read`],f=[`channels:join`,`files:read`,`files:write`,`reactions:read`,`reactions:write`],p=[`channels:history`,`channels:read`,`groups:history`,`groups:read`,`im:history`,`im:read`,`mpim:history`,`mpim:read`,`reactions:read`,`search:read`,`users:read`],m=[`reactions:read`,`search:read`],h=35,g=140,_=300;function v(e,t=``){let n=e.trim().slice(0,h)||`My Assistant`;return{display_information:{name:n,...t?{description:t.slice(0,g)}:{},background_color:`#1a1a2e`},features:{app_home:{home_tab_enabled:!1,messages_tab_enabled:!0,messages_tab_read_only_enabled:!1},bot_user:{display_name:n,always_online:!0},agent_view:{agent_description:(t||n).slice(0,_),suggested_prompts:[]}},oauth_config:{scopes:{bot:[...d],bot_optional:[...f],user:[...p],user_optional:[...m]}},settings:{event_subscriptions:{bot_events:[`app_mention`,`app_context_changed`,`message.channels`,`message.groups`,`message.im`,`message.mpim`,`reaction_added`]},interactivity:{is_enabled:!0},org_deploy_enabled:!1,socket_mode_enabled:!0,token_rotation_enabled:!1}}}var y=r(),b=`https://api.slack.com/apps?new_app=1`,x=`xoxb-`,S=`xapp-`,C=20;function w(e,t,n){let r=e.trim();return r?r.startsWith(t)?r.length<C?`${n} looks truncated — copy the whole value from Slack.`:null:`${n} should start with "${t}".`:null}function T({assistantName:e,onSave:t,saveStatus:r=`idle`,saveError:d=null}){let[f,p]=(0,u.useState)(e),[m,h]=(0,u.useState)(``),g=(0,u.useRef)(!1);(0,u.useEffect)(()=>{g.current||p(e)},[e]);let[_,C]=(0,u.useState)(``),[T,E]=(0,u.useState)(``),{copy:D,copied:O}=l(),k=(0,u.useMemo)(()=>JSON.stringify(v(f,m),null,2),[f,m]),A=f.trim().length>0,j=w(_,x,`Bot token`),M=w(T,S,`App token`),N=_.trim().length>0&&T.trim().length>0&&!j&&!M&&r!==`pending`,P=(0,u.useCallback)(()=>{D(k)},[D,k]),F=(0,u.useCallback)(()=>{window.open(b,`_blank`,`noopener,noreferrer`)},[]),I=(0,u.useCallback)(()=>{N&&t?.(_.trim(),T.trim())},[N,t,_,T]);return(0,y.jsx)(`div`,{"data-slot":`slack-setup-wizard`,children:(0,y.jsxs)(`div`,{className:`flex flex-col gap-5 rounded-lg bg-[var(--surface-sunken)] p-4`,children:[(0,y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,y.jsx)(i,{as:`p`,variant:`body-medium-lighter`,className:`text-[color:var(--content-default)]`,children:`Name your Slack app, copy its manifest, then create it in Slack. All permissions and settings come pre-configured.`}),(0,y.jsx)(c,{label:`App Name`,value:f,onChange:e=>{g.current=!0,p(e.target.value.slice(0,35))},placeholder:`My Assistant`,fullWidth:!0}),(0,y.jsx)(c,{label:`Description (optional)`,value:m,onChange:e=>h(e.target.value.slice(0,140)),placeholder:`What this assistant helps with`,helperText:`Shown on the app's Slack profile.`,fullWidth:!0})]}),(0,y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,y.jsx)(i,{as:`p`,variant:`body-medium-lighter`,className:`text-[color:var(--content-default)]`,children:`In Slack:`}),(0,y.jsxs)(`ol`,{className:`list-decimal list-inside space-y-1 text-body-medium-lighter text-[var(--content-default)]`,children:[(0,y.jsxs)(`li`,{children:[`Under `,(0,y.jsx)(`strong`,{children:`Or start your own way`}),`, pick`,` `,(0,y.jsx)(`strong`,{children:`From a manifest`}),`, then `,(0,y.jsx)(`strong`,{children:`Continue`})]}),(0,y.jsx)(`li`,{children:`Choose your workspace and give it the manifest you copied`}),(0,y.jsxs)(`li`,{children:[`Review the permissions, then click`,` `,(0,y.jsx)(`strong`,{children:`Create and Install`})]}),(0,y.jsxs)(`li`,{children:[`Expand `,(0,y.jsx)(`strong`,{children:`Your app credentials`}),` and copy both the`,` `,(0,y.jsx)(`strong`,{children:`Bot token`}),` and `,(0,y.jsx)(`strong`,{children:`App token`})]})]}),(0,y.jsxs)(i,{as:`p`,variant:`body-small-default`,className:`text-[color:var(--content-faint)]`,children:[`Slack's last screen also offers a command-line walkthrough and a `,(0,y.jsx)(`strong`,{children:`Download app files`}),` button. Skip both — they set up a separate local app, and this assistant needs only the two tokens.`]}),(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,y.jsx)(n,{type:`button`,variant:`outlined`,disabled:!A,onClick:P,leftIcon:O?(0,y.jsx)(a,{"aria-hidden":!0,className:`size-4`}):(0,y.jsx)(o,{"aria-hidden":!0,className:`size-4`}),children:O?`Copied!`:`Copy manifest JSON`}),(0,y.jsx)(n,{type:`button`,disabled:!A,onClick:F,rightIcon:(0,y.jsx)(s,{"aria-hidden":!0,className:`size-4`}),children:`Open Slack`})]}),(0,y.jsxs)(i,{as:`p`,variant:`body-small-default`,className:`text-[color:var(--content-faint)]`,children:[`If Slack shows “Request approval” instead of`,` `,(0,y.jsx)(`strong`,{children:`Install`}),`, a workspace admin needs to approve the app first.`]})]}),(0,y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,y.jsxs)(i,{as:`p`,variant:`body-medium-lighter`,className:`text-[color:var(--content-default)]`,children:[`Paste both tokens from Slack's`,` `,(0,y.jsx)(`strong`,{children:`Your app credentials`}),` panel:`]}),(0,y.jsx)(c,{label:`Bot Token`,type:`password`,value:_,onChange:e=>C(e.target.value),placeholder:`${x}...`,errorText:j??void 0,fullWidth:!0}),(0,y.jsx)(c,{label:`App Token`,type:`password`,value:T,onChange:e=>E(e.target.value),placeholder:`${S}...`,errorText:M??void 0,fullWidth:!0}),(0,y.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,y.jsx)(n,{type:`button`,variant:`primary`,onClick:I,disabled:!N,children:r===`pending`?`Connecting…`:`Connect Slack`})}),r===`success`&&(0,y.jsx)(i,{as:`p`,variant:`body-small-default`,className:`text-[color:var(--content-positive)]`,children:`Credentials saved.`}),r===`error`&&d&&(0,y.jsx)(i,{as:`p`,variant:`body-small-default`,className:`text-[color:var(--system-negative-strong)]`,children:d})]})]})})}export{T as t};