@openhands/agent-canvas 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/README.windows.md +2 -2
- package/build/assets/{Trans-DY6toRDu.js → Trans-Ch-OVWEA.js} +1 -1
- package/build/assets/{acp-providers-Djl6vNn-.js → acp-providers-Sy2LKyMa.js} +1 -1
- package/build/assets/{active-backend-context-B3umL5R-.js → active-backend-context-hxq31W25.js} +1 -1
- package/build/assets/{add-backend-modal-DljoP9lc.js → add-backend-modal-Bgy8anoR.js} +1 -1
- package/build/assets/{agent-profiles-settings-BJMmTZgv.js → agent-profiles-settings-3mmXljZX.js} +1 -1
- package/build/assets/{agent-server-conversation-service.api-D_ZvtJjG.js → agent-server-conversation-service.api-CuSdr4Qb.js} +3 -3
- package/build/assets/{agent-settings-lUknCeaF.js → agent-settings-B-W10B4E.js} +1 -1
- package/build/assets/agent-settings-D_yOy8XB.js +1 -0
- package/build/assets/{api-key-entry-screen-CWEHcPJA.js → api-key-entry-screen-Dl0qVYi4.js} +1 -1
- package/build/assets/{app-settings-Dj90qosy.js → app-settings-yVizGXox.js} +1 -1
- package/build/assets/{automation-detail-CXJU0_gF.js → automation-detail-dvJfLs5u.js} +1 -1
- package/build/assets/{automation-export-FWY9LPsG.js → automation-export-BPcgLqPD.js} +1 -1
- package/build/assets/{automations-list-DDGBkWLC.js → automations-list-CUXogTe0.js} +1 -1
- package/build/assets/backend-form-modal-CQJGmItq.js +1 -0
- package/build/assets/{backend-synced-settings-badge-CanzmG12.js → backend-synced-settings-badge-D9hZx05w.js} +1 -1
- package/build/assets/{condenser-settings-30cX9SK6.js → condenser-settings-Ca8fYZ_Z.js} +1 -1
- package/build/assets/conversation-9NBSRoR9.js +1 -0
- package/build/assets/{conversation-BltULtFA.js → conversation-BXg6Oti2.js} +3 -3
- package/build/assets/conversation-panel-CZri9Rup.js +1 -0
- package/build/assets/{conversation-service.api-DQaKzIRj.js → conversation-service.api-DPBQvTKD.js} +1 -1
- package/build/assets/{device-verify-BsznkV-a.js → device-verify-Dj6I4Iqe.js} +1 -1
- package/build/assets/{entry.client-JixNvFrr.js → entry.client-2_3ePAm0.js} +1 -1
- package/build/assets/{extensions-hub-DfvgqzTc.js → extensions-hub-CLjmOGqS.js} +1 -1
- package/build/assets/{extensions-navigation-D9i0DL62.js → extensions-navigation-B5MeUiMq.js} +1 -1
- package/build/assets/{files-tab-DDtEJcGE.js → files-tab-UVoray88.js} +1 -1
- package/build/assets/{git-provider-icon-BjkecAuV.js → git-provider-icon-o6hdnJUB.js} +1 -1
- package/build/assets/{home-BCKWpKpf.js → home-D1IHvGTN.js} +1 -1
- package/build/assets/{install-server-modal-BIugLhVB.js → install-server-modal-BbuQaA2w.js} +1 -1
- package/build/assets/{launch-BgIlZLSX.js → launch-V_3Rp7WS.js} +1 -1
- package/build/assets/{lesson-plan-DgpP80mJ.js → lesson-plan-jC0HBoe6.js} +1 -1
- package/build/assets/{llm-not-configured-banner-BlX8NifC.js → llm-not-configured-banner-DoARbcdL.js} +1 -1
- package/build/assets/{llm-settings-kU5v0H1Z.js → llm-settings-4JMLV8mq.js} +1 -1
- package/build/assets/llm-settings-D91gMw3U.js +1 -0
- package/build/assets/{manage-backends-modal-C8FJQIZR.js → manage-backends-modal-DkWAMSle.js} +1 -1
- package/build/assets/{manifest-56d40d7c.js → manifest-aa5c29f6.js} +1 -1
- package/build/assets/{mcp-CHkklDMv.js → mcp-BQufNPZ6.js} +1 -1
- package/build/assets/{messages-B3RugH7P.js → messages-BnJCqnFf.js} +1 -1
- package/build/assets/{model-selector-BOj1wBlq.js → model-selector-BfqpMkSJ.js} +1 -1
- package/build/assets/{onboarding-DYhDxmI9.js → onboarding-Bu-HN1ze.js} +1 -1
- package/build/assets/{onboarding-modal-CP_WxDC9.js → onboarding-modal-CZgjs5Bx.js} +1 -1
- package/build/assets/{option-service.api-C0tYT4-r.js → option-service.api-BrZ5q87N.js} +1 -1
- package/build/assets/{organization-service.api-CnynNoT-.js → organization-service.api-Bk4pCGU1.js} +1 -1
- package/build/assets/{path-utils-DWcgCGen.js → path-utils-CSmuZoix.js} +1 -1
- package/build/assets/{planner-tab-CCqdXxkL.js → planner-tab-Dhyqcqmb.js} +1 -1
- package/build/assets/{plugins-management-service-BAp70KN7.js → plugins-management-service-BRBLxvUl.js} +1 -1
- package/build/assets/{profiles-service.api-CeYEmSM3.js → profiles-service.api-BMXQ9pZC.js} +1 -1
- package/build/assets/{providers-BxCuC9bZ.js → providers-BpO967xS.js} +1 -1
- package/build/assets/{proxy-CHmFkV16.js → proxy-BgJLtxu7.js} +1 -1
- package/build/assets/{recommended-automations-launcher-CVEF_1pc.js → recommended-automations-launcher-CTcGTl4d.js} +1 -1
- package/build/assets/root-BM5WgQ4_.js +2 -0
- package/build/assets/{root-layout-CttG_lQi.js → root-layout-BdoyoobY.js} +2 -2
- package/build/assets/{schema-field-xUr6rDd6.js → schema-field-BSHrUMme.js} +1 -1
- package/build/assets/{sdk-section-page-CbLrVUa3.js → sdk-section-page-t82gsOqa.js} +1 -1
- package/build/assets/{secrets-service-CZYjNxFw.js → secrets-service-B2GqPV0N.js} +1 -1
- package/build/assets/{secrets-settings-DxTx9HgU.js → secrets-settings-Cx6yJlyb.js} +1 -1
- package/build/assets/{settings-DnlfS09K.js → settings-DmPLkgq0.js} +1 -1
- package/build/assets/{settings-index-BjeuYFFa.js → settings-index-D6sxWSRk.js} +1 -1
- package/build/assets/{settings-modal-DfTcL-mV.js → settings-modal-CwrZKrTq.js} +1 -1
- package/build/assets/{settings-service.api-K4ncGlBv.js → settings-service.api-Ce-ub11I.js} +1 -1
- package/build/assets/{shared-conversation-DWtBkJv7.js → shared-conversation-BDREQPnE.js} +1 -1
- package/build/assets/{sidebar-mobile-menu-toggle-CMmAYkh8.js → sidebar-mobile-menu-toggle-VvvX32iF.js} +1 -1
- package/build/assets/{skills-plugins-BJ040luO.js → skills-plugins-2Y44YHbO.js} +1 -1
- package/build/assets/{skills-settings-BYn4-AQQ.js → skills-settings-BUv04tSc.js} +1 -1
- package/build/assets/{suspense-X5dBsJzn.js → suspense-BO1Tl_Vf.js} +1 -1
- package/build/assets/{terminal-BsGcSpRS.js → terminal-B61WrJdS.js} +1 -1
- package/build/assets/{use-acp-credential-form-EtnbtYt0.js → use-acp-credential-form-MzZM6D7D.js} +1 -1
- package/build/assets/{use-activate-agent-profile-WaAZYz4E.js → use-activate-agent-profile-20v1xU0H.js} +1 -1
- package/build/assets/{use-active-agent-profile-CYY3vGar.js → use-active-agent-profile-BkJN7Xsy.js} +1 -1
- package/build/assets/{use-active-conversation-D-r929nx.js → use-active-conversation-DOZVSVtU.js} +1 -1
- package/build/assets/{use-agent-profiles-DEAMFp-W.js → use-agent-profiles-DwZxnwO5.js} +1 -1
- package/build/assets/{use-agent-state-DijdVAQ0.js → use-agent-state-DHZO1obC.js} +1 -1
- package/build/assets/{use-backends-health-DkC7tKkC.js → use-backends-health-CRHzuvxO.js} +1 -1
- package/build/assets/{use-can-manage-org-profiles-BEo0peGn.js → use-can-manage-org-profiles-C-OhWVBS.js} +1 -1
- package/build/assets/{use-cloud-current-user-id-Dm99wXp2.js → use-cloud-current-user-id-utFreJ0i.js} +1 -1
- package/build/assets/use-config-mJrtZHP1.js +1 -0
- package/build/assets/{use-create-conversation-CTsvZ96U.js → use-create-conversation-DdqsP78F.js} +1 -1
- package/build/assets/{use-create-secret-D5O5qdWC.js → use-create-secret-D0HCOZFu.js} +1 -1
- package/build/assets/{use-handle-plan-click-Mn_SNTCh.js → use-handle-plan-click-DyRASKMC.js} +1 -1
- package/build/assets/use-is-authed-B6M0mcGL.js +1 -0
- package/build/assets/use-llm-profiles-RC-PkpBl.js +1 -0
- package/build/assets/{use-plugins-marketplace-BGb-KgfD.js → use-plugins-marketplace-FHlbeQ4c.js} +1 -1
- package/build/assets/use-runtime-is-ready-RKj2WmEh.js +1 -0
- package/build/assets/use-save-agent-profile-tvDP15mh.js +1 -0
- package/build/assets/{use-save-settings-D1HoCDbn.js → use-save-settings-BGlSfuYn.js} +1 -1
- package/build/assets/{use-settings-BReAMxCG.js → use-settings-CH5LzXD8.js} +1 -1
- package/build/assets/{use-settings-nav-items-xe1YgLnE.js → use-settings-nav-items-Dwktv8wo.js} +1 -1
- package/build/assets/{use-skills-Dqo-pDDx.js → use-skills-CSzSL6HG.js} +1 -1
- package/build/assets/{use-tracking-2ZwQwpg_.js → use-tracking-BIXzagSI.js} +1 -1
- package/build/assets/{use-user-conversation-OAfenBRG.js → use-user-conversation-zpx7I18x.js} +1 -1
- package/build/assets/{useMutation-DCE9RcgK.js → useMutation-DrCAVg5w.js} +1 -1
- package/build/assets/{useMutationState-BUab8Kxr.js → useMutationState-D8QN0ZCy.js} +1 -1
- package/build/assets/{useQueries-CRzaAqzH.js → useQueries-DClgUTc7.js} +1 -1
- package/build/assets/{useQuery-CpjHYtZc.js → useQuery-CRBP8vIS.js} +1 -1
- package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~d1e18dtv-5Q6lQJdE.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~nfpll1wp-BCpa95De.js} +1 -1
- package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~nn5zty47-Zl0G1QCy.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~jewnulst-C57fm7C-.js} +1 -1
- package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~enjl5xdm-mMKDm94D.js → vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~enjl5xdm-B0EIDu4M.js} +1 -1
- package/build/assets/{verification-settings-DnXS6VWv.js → verification-settings-D576N2xa.js} +1 -1
- package/build/index.html +4 -4
- package/build/locales/en/openhands.json +1 -1
- package/config/defaults.json +1 -1
- package/dist/components/features/backends/backend-form-modal.cjs +1 -1
- package/dist/components/features/backends/backend-form-modal.cjs.map +1 -1
- package/dist/components/features/backends/backend-form-modal.d.ts +3 -1
- package/dist/components/features/backends/backend-form-modal.js +17 -16
- package/dist/components/features/backends/backend-form-modal.js.map +1 -1
- package/dist/config/defaults.cjs +1 -1
- package/dist/config/defaults.cjs.map +1 -1
- package/dist/config/defaults.js +1 -1
- package/dist/config/defaults.js.map +1 -1
- package/dist/i18n/translation.cjs +1 -1
- package/dist/i18n/translation.cjs.map +1 -1
- package/dist/i18n/translation.js +1 -1
- package/dist/i18n/translation.js.map +1 -1
- package/dist/locales/en/openhands.json +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.cjs.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/package.json +1 -1
- package/build/assets/agent-settings-BVVFzBWS.js +0 -1
- package/build/assets/backend-form-modal-DSbrafX2.js +0 -1
- package/build/assets/conversation-e0a0_X4S.js +0 -1
- package/build/assets/conversation-panel-Cr9_ZGI-.js +0 -1
- package/build/assets/llm-settings-DJmbryaE.js +0 -1
- package/build/assets/root-uJ2t9rCQ.js +0 -2
- package/build/assets/use-config-CHzNIHpv.js +0 -1
- package/build/assets/use-is-authed-_dhQ2Xuj.js +0 -1
- package/build/assets/use-llm-profiles-BMhPDlwQ.js +0 -1
- package/build/assets/use-runtime-is-ready-CC-KrLKe.js +0 -1
- package/build/assets/use-save-agent-profile-CLMmbx_X.js +0 -1
- /package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~i3v2mlbw-BrJQ3XZH.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~epa72zsm-B4rXs7Zd.js} +0 -0
- /package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~ncdxw0bh-ClHnt5lR.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~lf310vj7-CSVPGId3.js} +0 -0
- /package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~k6tszsdc-Bb-xMtbv.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~ivvrgjsa-BlIZPCXX.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{t as r}from"./useTranslation-CDRCKC9-.js";import{t as i}from"./declaration-gq8V5eTU.js";import{v as a}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{t as r}from"./useTranslation-CDRCKC9-.js";import{t as i}from"./declaration-gq8V5eTU.js";import{v as a}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~lf310vj7-CSVPGId3.js";import{A as o,P as s,j as ee}from"./active-backend-context-hxq31W25.js";import{t as c}from"./utils-D3U3rlqr.js";import{_ as l}from"./form-control-classes-ChpNBe9n.js";import{t as te}from"./brand-button-vMVuyDXu.js";import{r as ne}from"./use-settings-CH5LzXD8.js";import{t as re}from"./use-save-settings-BGlSfuYn.js";import{c as ie,l as ae,n as oe,o as se,r as u,s as d,t as f,u as ce}from"./sdk-settings-schema-Cv7M9eSe.js";import{i as le,n as ue,r as p,t as de}from"./schema-field-BSHrUMme.js";import{n as m,t as h}from"./switch-skeleton-DqQwalyu.js";import{o as fe}from"./extension-module-card-classes-9V3J9J_b.js";var g=e(t(),1),_=n();function v(){return(0,_.jsx)(`div`,{className:`w-[250px] h-[20px] skeleton`})}function y(){return(0,_.jsxs)(`div`,{"data-testid":`app-settings-skeleton`,className:`px-11 py-9 flex flex-col gap-6`,children:[(0,_.jsx)(h,{}),(0,_.jsx)(m,{}),(0,_.jsx)(m,{}),(0,_.jsx)(m,{}),(0,_.jsx)(v,{}),(0,_.jsx)(h,{}),(0,_.jsx)(h,{}),(0,_.jsx)(m,{})]})}var b=(e,t)=>c(`w-fit px-2 py-2 text-sm cursor-pointer rounded-none bg-transparent`,l,`border-b-2 pb-2`,e?`text-white border-white`:`text-[var(--oh-muted)] border-transparent hover:text-white`,t&&`pointer-events-none opacity-30 cursor-not-allowed`);function pe({view:e,setView:t,showAdvanced:n,showAll:a,isDisabled:o=!1}){let{t:s}=r(`openhands`);return!n&&!a?null:(0,_.jsxs)(`div`,{role:`tablist`,"aria-orientation":`horizontal`,className:`mb-6 flex items-center gap-2`,children:[(0,_.jsx)(`button`,{"data-testid":`sdk-section-basic-toggle`,type:`button`,role:`tab`,"aria-selected":e===`basic`,disabled:o,className:b(e===`basic`,o),onClick:()=>t(`basic`),children:s(i.SETTINGS$BASIC)}),n?(0,_.jsx)(`button`,{"data-testid":`sdk-section-advanced-toggle`,type:`button`,role:`tab`,"aria-selected":e===`advanced`,disabled:o,className:b(e===`advanced`,o),onClick:()=>t(`advanced`),children:s(i.SETTINGS$ADVANCED)}):null,a?(0,_.jsx)(`button`,{"data-testid":`sdk-section-all-toggle`,type:`button`,role:`tab`,"aria-selected":e===`all`,disabled:o,className:b(e===`all`,o),onClick:()=>t(`all`),children:s(i.SETTINGS$ALL)}):null]})}var me=new Set,x={basic:0,advanced:1,all:2},he=(e,t)=>x[t]<x[e]?t:e,ge=(e,t)=>x[t]>x[e]?t:e,_e=(e,{showAdvanced:t,showAll:n})=>e===`all`?n?`all`:t?`advanced`:`basic`:e===`advanced`?t?`advanced`:n?`all`:`basic`:`basic`,ve={agent_settings:`agent_settings_diff`,conversation_settings:`conversation_settings_diff`},ye=(e,t)=>e instanceof a?e.response?.status===401?`${t} This agent server requires X-Session-API-Key. Set VITE_SESSION_API_KEY in the frontend to the same value used by the backend SESSION_API_KEY or OH_SESSION_API_KEYS_0.`:e.response?.status===404?`${t} This backend does not expose /api/settings/* schema endpoints. Upgrade to a recent openhands-agent-server release.`:t:t;function S({settingsSources:e,scope:t=`personal`,header:n,extraDirty:a=!1,buildPayload:c,onSaveSuccess:l,getInitialView:m,forceShowAdvancedView:h=!1,allowAllView:v=!0,initialValueOverrides:b,embedded:x=!1,hideSaveButton:S=!1,suppressSuccessToast:be=!1,onSaveControlChange:C,testId:xe=`sdk-section-settings-screen`}){let{t:w}=r(`openhands`),{mutate:Se,isPending:T}=re(t),{data:E,isLoading:Ce,isFetching:D}=ne(t),O=p(E?.agent_settings_schema),k=le(E?.conversation_settings_schema),A=g.useMemo(()=>JSON.stringify(e.map(e=>({source:e.settingsSource,sectionKeys:e.sectionKeys,excludeKeys:e.excludeKeys?Array.from(e.excludeKeys).sort():null}))),[e]),j=g.useMemo(()=>JSON.parse(A).map(e=>({settingsSource:e.source,sectionKeys:e.sectionKeys,excludeKeys:e.excludeKeys?new Set(e.excludeKeys):void 0})),[A]),M=g.useCallback(e=>e===`conversation_settings`?k.data:O.data,[O.data,k.data]),we=j.some(e=>e.settingsSource===`conversation_settings`?k.isLoading:O.isLoading),N=g.useMemo(()=>j.map(e=>{let t=M(e.settingsSource);if(!ce(t))return{...e,filteredSchema:null};let n=new Set(e.sectionKeys),r={...t,sections:t.sections.filter(e=>n.has(e.key))};return{...e,filteredSchema:r}}),[j,M]),P=h||N.some(e=>d(e.filteredSchema)),F=v&&N.some(e=>ie(e.filteredSchema)),Te=g.useMemo(()=>ye(j.reduce((e,t)=>e??(t.settingsSource===`conversation_settings`?k.error:O.error),null),w(i.SETTINGS$SDK_SCHEMA_UNAVAILABLE)),[j,O.error,k.error,w]),Ee=g.useMemo(()=>b?JSON.stringify(b):``,[b]),[I,L]=g.useState(`basic`),[R,z]=g.useState({}),[B,V]=g.useState({}),H=g.useRef(!1),U=g.useMemo(()=>{if(!E)return null;let e={};for(let t of N){if(!t.filteredSchema)return null;e[t.settingsSource]={...e[t.settingsSource]??{},...f(E,t.filteredSchema,t.settingsSource)}}if(b){let t=N[0]?.settingsSource;t&&e[t]&&(e[t]={...e[t],...b})}return e},[E,N,Ee]),W=g.useMemo(()=>{if(!E)return null;let e=null;for(let t of N){if(!t.filteredSchema)return null;let n=m?m(E,t.filteredSchema):ae(E,t.filteredSchema,t.settingsSource);e=e?ge(e,n):n}return e?_e(e,{showAdvanced:P,showAll:F}):null},[E,N,m,P,F]);g.useEffect(()=>{H.current=!1,L(`basic`),z({}),V({})},[t,A]),g.useEffect(()=>{if(!(!U||!W)){if(z(U),b){let e=N[0]?.settingsSource;if(e){let t=Object.fromEntries(Object.keys(b).map(e=>[e,!0]));V({[e]:t})}else V({})}else V({});L(e=>H.current?he(e,W):(H.current=!0,W))}},[U,W]);let G=g.useMemo(()=>{let e=new Map;for(let t of N)if(t.filteredSchema)for(let n of t.filteredSchema.sections)for(let r of n.fields)e.has(r.key)||e.set(r.key,t.settingsSource);return e},[N]),K=g.useMemo(()=>{let e={};for(let t of N)Object.assign(e,R[t.settingsSource]??{});return e},[N,R]),q=g.useMemo(()=>{let e={};for(let t of N)Object.assign(e,B[t.settingsSource]??{});return e},[N,B]),J=g.useCallback((e,t)=>{let n=G.get(e);n&&(z(r=>({...r,[n]:{...r[n]??{},[e]:t}})),V(t=>({...t,[n]:{...t[n]??{},[e]:!0}})))},[G]),De=g.useCallback(e=>{o(s(e)||w(i.ERROR$GENERIC))},[w]),Y=g.useRef(()=>{}),Oe=g.useCallback(()=>{Y.current()},[]),X=g.useRef(()=>({})),ke=g.useCallback(()=>X.current(),[]),Z=()=>{if(N.some(e=>!e.filteredSchema))return;let e;try{let t={};for(let e of N){let n=e.filteredSchema,r=u(n,R[e.settingsSource]??{},B[e.settingsSource]??{},I);if(Object.keys(r).length>0){let n=ve[e.settingsSource];t[n]={...t[n]??{},...r}}}e=c?c(t,{values:K,dirty:q,view:I}):t}catch(e){o(e instanceof Error?e.message:w(i.ERROR$GENERIC));return}Object.keys(e).length!==0&&Se(e,{onError:De,onSuccess:()=>{be||ee(w(i.SETTINGS$SAVED_WARNING)),V({}),l?.()}})};Y.current=Z,X.current=()=>{let e={};for(let t of N){if(!t.filteredSchema)continue;let n=R[t.settingsSource]??{},r=B[t.settingsSource]??{};Object.assign(e,oe(t.filteredSchema,n,r))}return e};let Q=Object.keys(q).length>0,$=Q||a;return g.useEffect(()=>{C&&C({save:Oe,isSaving:T,isDirty:$,values:K,view:I,getDirtyPayload:ke})},[T,$,K,I]),(Ce||D)&&!E||we?(0,_.jsx)(y,{}):N.some(e=>e.filteredSchema&&e.filteredSchema.sections.length>0)?Object.keys(K).length===0?(0,_.jsx)(y,{}):(0,_.jsxs)(`div`,{"data-testid":xe,className:x?`relative flex min-h-0 w-full flex-1 flex-col`:`relative w-full min-h-0`,children:[(0,_.jsx)(pe,{view:I,setView:L,showAdvanced:P,showAll:F,isDisabled:!1}),(0,_.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[n?.({values:K,isDisabled:!1,view:I,onChange:J}),N.map(e=>{if(!e.filteredSchema)return null;let t=R[e.settingsSource]??{};return se(e.filteredSchema,{...K,...t},I,e.excludeKeys??me).map(n=>(0,_.jsx)(`section`,{className:`flex flex-col gap-4`,children:(0,_.jsx)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:n.fields.map(e=>(0,_.jsx)(`div`,{className:de.has(e.key)?`xl:col-span-2`:void 0,children:(0,_.jsx)(ue,{field:e,value:t[e.key],isDisabled:!1,onChange:t=>J(e.key,t)})},e.key))})},`${e.settingsSource}:${n.key}`))}),S?null:(0,_.jsx)(`div`,{className:`flex justify-start pt-2`,children:(0,_.jsx)(te,{testId:`save-button`,type:`button`,variant:`primary`,isDisabled:T||!Q&&!a,onClick:Z,children:w(T?i.SETTINGS$SAVING:i.SETTINGS$SAVE_CHANGES)})})]})]}):(0,_.jsx)(`div`,{"data-testid":`sdk-schema-unavailable`,className:fe,children:(0,_.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:Te})})}export{S as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-BFRubm34.js";import{o as t}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~
|
|
1
|
+
import{r as e}from"./rolldown-runtime-BFRubm34.js";import{o as t}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~lf310vj7-CSVPGId3.js";import{c as n,n as r}from"./agent-server-client-options-DVLRd9sw.js";import{t as i}from"./proxy-BgJLtxu7.js";var a=100;function o(){let e=n().backend;if(e.kind!==`cloud`)throw Error(`Cloud secrets call requires a cloud backend.`);return e}async function s(){let e=o(),t=[],n=null;do{let r=new URLSearchParams({limit:String(a)});n&&r.set(`page_id`,n);let o=await i({backend:e,method:`GET`,path:`/api/v1/secrets/search?${r.toString()}`});t.push(...o.items??[]),n=o.next_page_id}while(n);return t}async function c(e,t,n){await i({backend:o(),method:`POST`,path:`/api/v1/secrets`,body:{name:e,value:t,description:n}})}async function l(e,t,n){await i({backend:o(),method:`PUT`,path:`/api/v1/secrets/${encodeURIComponent(e)}`,body:{name:t,description:n}})}async function u(e){await i({backend:o(),method:`DELETE`,path:`/api/v1/secrets/${encodeURIComponent(e)}`})}var d=e({SecretsService:()=>p});async function f(e,t=3,n=500){for(let r=0;r<t;r+=1)try{return await e()}catch(e){if(r>=t-1)throw e;let i=n*2**r;await new Promise(e=>{setTimeout(e,i)})}throw Error(`Retry attempts exhausted`)}var p=class{static async getSecrets(){try{return n().backend.kind===`cloud`?await f(()=>s()):(await f(()=>new t(r()).listSecrets())).secrets.map(e=>({name:e.name,description:e.description}))}catch(e){return console.error(`Failed to fetch secrets after retries:`,e),[]}}static async createSecret(e,i,a){if(n().backend.kind===`cloud`){await f(()=>c(e,i,a));return}await f(()=>new t(r()).upsertSecret({name:e,value:i,description:a}))}static async updateSecret(e,t,r){if(n().backend.kind===`cloud`){await f(()=>l(e,t,r));return}await this.createSecret(e,t,r)}static async deleteSecret(e){try{if(n().backend.kind===`cloud`){await f(()=>u(e));return}await f(()=>new t(r()).deleteSecret(e))}catch(e){if(e&&typeof e==`object`&&`response`in e&&e.response?.status===404)return;throw e}}};export{d as n,p as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{L as r}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{n as i}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{L as r}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{n as i}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~epa72zsm-B4rXs7Zd.js";import{t as a}from"./useMutation-DrCAVg5w.js";import{t as o}from"./useTranslation-CDRCKC9-.js";import{t as s}from"./declaration-gq8V5eTU.js";import{t as c}from"./back-nav-button-CUS2mi-U.js";import{t as l}from"./pencil-Dj2XjKmI.js";import{t as u}from"./trash-2-Be_7y3Mn.js";import{t as d}from"./utils-D3U3rlqr.js";import{f,l as p}from"./form-control-classes-ChpNBe9n.js";import{t as m}from"./brand-button-vMVuyDXu.js";import{t as h}from"./loading-spinner-BLdswi6q.js";import{n as g,t as _}from"./settings-input-bD6npsDm.js";import{t as v}from"./confirmation-modal-BGLu6XJN.js";import{r as y}from"./typography-D8mHDeNG.js";import"./extension-module-card-classes-9V3J9J_b.js";import{a as b,c as x,i as S,l as C,o as w,r as T,s as E}from"./settings-list-classes-Dp_OgzN0.js";import{t as D}from"./secrets-service-B2GqPV0N.js";import{n as O,t as k}from"./use-create-secret-D0HCOZFu.js";var A=e(t(),1),j=()=>a({mutationFn:e=>D.deleteSecret(e)}),M=()=>a({mutationFn:({secretToEdit:e,name:t,description:n})=>D.updateSecret(e,t,n)}),N=n();function P({mode:e,selectedSecret:t,onCancel:n}){let r=i(),{t:a}=o(`openhands`),{data:c}=O(),{mutate:l}=k(),{mutate:u}=M(),[h,v]=A.useState(null),y=e===`edit`&&t&&c?.find(e=>e.name===t)?.description?.trim()||``,b=()=>{r.invalidateQueries({queryKey:[`secrets-search`]}),r.invalidateQueries({queryKey:[`secrets`]})},x=(e,t,r)=>{l({name:e,value:t,description:r},{onSettled:n,onSuccess:b})},S=(e,t,r)=>{u({secretToEdit:e,name:t,description:r},{onSettled:n,onSuccess:b})};return(0,N.jsxs)(`form`,{"data-testid":e===`add`?`add-secret-form`:`edit-secret-form`,onSubmit:n=>{n.preventDefault();let r=new FormData(n.currentTarget),i=r.get(`secret-name`)?.toString(),o=r.get(`secret-value`)?.toString().trim(),l=r.get(`secret-description`)?.toString();if(i){if(v(null),c?.some(e=>e.name===i&&e.name!==t)){v(a(s.SECRETS$SECRET_ALREADY_EXISTS));return}if(e===`add`){if(!o){v(a(s.SECRETS$SECRET_VALUE_REQUIRED));return}x(i,o,l||void 0)}else e===`edit`&&t&&S(t,i,l||void 0)}},className:`flex flex-col items-start gap-6`,children:[(0,N.jsx)(_,{testId:`name-input`,name:`secret-name`,type:`text`,label:a(s.SETTINGS$NAME),className:`w-full min-w-0`,required:!0,defaultValue:e===`edit`&&t?t:``,placeholder:a(s.SECRETS$API_KEY_EXAMPLE),pattern:`^[a-zA-Z][a-zA-Z0-9_]{0,63}$`,title:a(s.SETTINGS$SECRET_NAME_PATTERN_TITLE)}),h&&(0,N.jsx)(`p`,{className:`text-red-500 text-sm`,children:h}),e===`add`&&(0,N.jsxs)(`label`,{className:`flex flex-col gap-2.5 w-full min-w-0`,children:[(0,N.jsx)(`span`,{className:`text-sm`,children:a(s.FORM$VALUE)}),(0,N.jsx)(`textarea`,{"data-testid":`value-input`,name:`secret-value`,required:!0,className:d(`resize-none`,p,`placeholder:italic`,`disabled:bg-[var(--oh-surface-raised)] disabled:border-[var(--oh-border-subtle)] disabled:cursor-not-allowed`),rows:8})]}),(0,N.jsxs)(`label`,{className:`flex flex-col gap-2.5 w-full min-w-0`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`text-sm`,children:a(s.FORM$DESCRIPTION)}),(0,N.jsx)(g,{})]}),(0,N.jsx)(`input`,{"data-testid":`description-input`,name:`secret-description`,defaultValue:y,className:d(f,`disabled:bg-[var(--oh-surface-raised)] disabled:border-[var(--oh-border-subtle)]`)})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,N.jsx)(m,{testId:`cancel-button`,type:`button`,variant:`secondary`,onClick:n,children:a(s.BUTTON$CANCEL)}),(0,N.jsxs)(m,{testId:`submit-button`,type:`submit`,variant:`primary`,children:[e===`add`&&a(s.SECRETS$ADD_SECRET),e===`edit`&&a(s.SECRETS$EDIT_SECRET)]})]})]})}function F(){return(0,N.jsxs)(`div`,{className:d(S,`justify-between border-t border-[var(--oh-border)] first:border-t-0`),children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-4`,children:[(0,N.jsx)(`span`,{className:`skeleton h-4 w-1/4`}),(0,N.jsx)(`span`,{className:`skeleton h-4 w-1/2`})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,N.jsx)(`span`,{className:`skeleton h-4 w-4`}),(0,N.jsx)(`span`,{className:`skeleton h-4 w-4`})]})]})}function I({title:e,description:t,onEdit:n,onDelete:r}){return(0,N.jsxs)(`tr`,{"data-testid":`secret-item`,className:C,children:[(0,N.jsx)(`td`,{className:d(w,`text-content-2 truncate`),title:e,children:e}),(0,N.jsx)(`td`,{className:d(w,`truncate text-content-2 opacity-80`),title:t||``,children:t||``}),(0,N.jsx)(`td`,{className:w,children:(0,N.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5`,children:[(0,N.jsx)(`button`,{"data-testid":`edit-secret-button`,type:`button`,onClick:n,"aria-label":`Edit ${e}`,className:T,children:(0,N.jsx)(l,{"aria-hidden":!0,className:`size-4`,strokeWidth:2})}),(0,N.jsx)(`button`,{"data-testid":`delete-secret-button`,type:`button`,onClick:r,"aria-label":`Delete ${e}`,className:T,children:(0,N.jsx)(u,{"aria-hidden":!0,className:`size-4`,strokeWidth:2})})]})})]})}var L={hideTitle:!0};function R(){let e=i(),{t}=o(`openhands`),n=(0,A.useRef)(null),{data:r,isLoading:a,hasNextPage:l,isFetchingNextPage:u,onLoadMore:f}=O(),{mutate:p}=j(),[g,_]=A.useState(`list`),[S,C]=A.useState(null),[w,T]=A.useState(!1),D=(0,A.useCallback)(e=>{let t=e.currentTarget;t.scrollHeight-t.scrollTop<=t.clientHeight+100&&l&&!u&&f()},[l,u,f]),k=()=>{e.invalidateQueries({queryKey:[`secrets-search`]}),e.invalidateQueries({queryKey:[`secrets`]})},M=e=>{p(e,{onSettled:()=>{T(!1)},onSuccess:k,onError:k})},L=()=>{S&&M(S)},R=()=>{T(!1)},z=()=>{_(`list`),C(null)},B=g===`add-secret-form`||g===`edit-secret-form`,V=t(g===`add-secret-form`?s.SECRETS$ADD_A_SECRET:s.SECRETS$EDIT_A_SECRET);return(0,N.jsxs)(`div`,{"data-testid":`secrets-settings-screen`,className:`flex flex-col gap-6`,children:[g===`list`?(0,N.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,N.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,N.jsx)(y.H2,{children:t(s.SETTINGS$NAV_SECRETS)}),(0,N.jsx)(`p`,{"data-testid":`settings-page-subtitle`,className:`text-sm leading-5 text-tertiary-light`,children:t(s.SETTINGS$PAGE_SECRETS_SUBLINE)})]}),(0,N.jsx)(m,{testId:`add-secret-button`,type:`button`,variant:`primary`,className:`shrink-0 whitespace-nowrap`,onClick:()=>_(`add-secret-form`),isDisabled:a,children:t(s.SECRETS$ADD_NEW_SECRET)})]}):null,B?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,N.jsx)(c,{testId:`back-to-secrets`,onClick:z,children:t(s.BUTTON$BACK)}),(0,N.jsx)(y.H2,{testId:`secret-editor-title`,children:V})]}):null,a&&g===`list`&&(0,N.jsxs)(`ul`,{children:[(0,N.jsx)(F,{}),(0,N.jsx)(F,{}),(0,N.jsx)(F,{})]}),g===`list`&&!a&&r?.length===0&&(0,N.jsx)(`div`,{"data-testid":`secrets-empty`,className:`rounded-xl border border-[var(--oh-border)] p-8 text-center`,children:(0,N.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:t(s.SECRETS$EMPTY)})}),g===`list`&&!a&&(r?.length??0)>0&&(0,N.jsxs)(`div`,{ref:n,className:b,onScroll:D,children:[(0,N.jsxs)(`table`,{className:`w-full min-w-full table-fixed`,children:[(0,N.jsx)(`thead`,{className:E,children:(0,N.jsxs)(`tr`,{children:[(0,N.jsx)(`th`,{className:d(x,`w-1/4`),children:t(s.SETTINGS$NAME)}),(0,N.jsx)(`th`,{className:d(x,`w-1/2`),children:t(s.SECRETS$DESCRIPTION)}),(0,N.jsx)(`th`,{className:d(x,`w-1/4 text-right`),children:t(s.SETTINGS$ACTIONS)})]})}),(0,N.jsx)(`tbody`,{children:r?.map(e=>(0,N.jsx)(I,{title:e.name,description:e.description,onEdit:()=>{_(`edit-secret-form`),C(e.name)},onDelete:()=>{T(!0),C(e.name)}},e.name))})]}),u&&(0,N.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,N.jsx)(h,{size:`small`})})]}),(g===`add-secret-form`||g===`edit-secret-form`)&&(0,N.jsx)(P,{mode:g===`add-secret-form`?`add`:`edit`,selectedSecret:S,onCancel:z}),w&&(0,N.jsx)(v,{text:t(s.SECRETS$CONFIRM_DELETE_KEY),onConfirm:L,onCancel:R})]})}var z=r(R);export{z as default,L as handle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{E as r,L as i,c as a,j as o,k as s}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{t as c}from"./useTranslation-CDRCKC9-.js";import{t as l}from"./declaration-gq8V5eTU.js";import{C as u,a as d,d as f,f as p,i as m,o as h}from"./active-backend-context-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{E as r,L as i,c as a,j as o,k as s}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{t as c}from"./useTranslation-CDRCKC9-.js";import{t as l}from"./declaration-gq8V5eTU.js";import{C as u,a as d,d as f,f as p,i as m,o as h}from"./active-backend-context-hxq31W25.js";import{n as g,r as _,t as v}from"./use-settings-nav-items-Dwktv8wo.js";import{t as y}from"./utils-D3U3rlqr.js";import{c as b}from"./agent-server-client-options-DVLRd9sw.js";import{t as x}from"./option-service.api-BrZ5q87N.js";import"./navigation-link-D8hfwvxI.js";import"./sidebar-layout-DuzJMMw-.js";import{t as S}from"./sidebar-nav-link-5AlTT5-j.js";import{n as C}from"./use-settings-CH5LzXD8.js";import{n as w}from"./use-agent-profiles-DwZxnwO5.js";import"./close-p3Op5lxI.js";import{r as T}from"./typography-D8mHDeNG.js";import{t as E}from"./settings-section-header-context-COMOIaxV.js";import"./settings-gear-MXCyZW0x.js";import{n as D,r as O}from"./settings-utils-BMdG65By.js";import{t as k}from"./use-breakpoint-B-O0lQ84.js";import{t as A}from"./backend-synced-settings-badge-D9hZx05w.js";import{t as j}from"./settings-like-page-layout-classes-DENKlZpD.js";var M=e(t(),1),N=n();function P({navigationItems:e}){let{t}=c(`openhands`),n=e.filter(e=>e.type===`item`);return(0,N.jsxs)(`aside`,{"data-testid":`settings-navbar-desktop`,className:y(`hidden md:flex md:w-[260px] md:shrink-0 md:flex-col md:gap-2`,`md:sticky md:top-8 md:self-start md:pl-8`),children:[(0,N.jsx)(T.Text,{className:`px-2 text-sm font-normal text-white`,children:t(l.SETTINGS$TITLE)}),(0,N.jsxs)(`div`,{className:`flex flex-col gap-0.5 pt-0.5`,children:[n.map(e=>(0,N.jsx)(S,{to:e.item.to,label:t(e.item.text),end:!0,testId:`sidebar-settings-${e.item.to}`,icon:e.item.icon,disabled:e.disabled,disabledReason:e.disabled&&e.disabledAgentName?t(l.SETTINGS$AGENT_DISABLED_TOOLTIP,{agentName:e.disabledAgentName}):void 0},e.item.to)),(0,N.jsx)(_,{})]}),(0,N.jsx)(`div`,{className:`px-2 pt-3`,children:(0,N.jsx)(A,{})})]})}function F({children:e,navigationItems:t}){return(0,N.jsx)(`div`,{className:`flex h-full flex-col md:pt-8`,children:(0,N.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-10 md:items-start`,children:[(0,N.jsx)(P,{navigationItems:t}),(0,N.jsx)(`main`,{className:j,children:(0,N.jsx)(`div`,{className:`mx-auto w-full min-w-0 max-w-[800px]`,children:e})})]})})}async function I(){try{let e=b(),t;try{let n=await u.fetchQuery({queryKey:[...m.all,e.backend.id,e.orgId],queryFn:w.listProfiles,staleTime:0,...d}),r=n?.active_agent_profile_id??null,i=n?.profiles.find(e=>e.id!=null&&e.id===r);i&&(t=i.agent_kind===`acp`)}catch{}if(t===void 0&&(t=(await u.fetchQuery({queryKey:[...p.byScope(`personal`),e.backend.id,e.orgId],queryFn:()=>C(`personal`),staleTime:0}))?.agent_settings?.agent_kind===`acp`),t)return r(`/settings/agents`)}catch{}return null}var L=async({request:e})=>{let{pathname:t}=new URL(e.url),n=(await u.fetchQuery({queryKey:f.WEB_CLIENT_CONFIG,queryFn:x.getConfig,...h}))?.feature_flags;if(O(t,n)){let e=D(n);if(e&&e!==t)return r(e)}if(g.find(e=>e.to===t)?.disabledByAcp){let e=await I();if(e)return e}return null};function R(){let{t:e}=c(`openhands`),t=s(),n=o(),r=v(),i=k(768),[l,u]=(0,M.useState)(!1),{currentSectionTitle:d,currentSectionSubtitle:f}=(0,M.useMemo)(()=>{let e=r.find(e=>e.type===`item`&&e.item.to===t.pathname);if(e?.type===`item`)return{currentSectionTitle:e.item.text,currentSectionSubtitle:e.item.subtitle};let n=r.find(e=>e.type===`item`);return n?.type===`item`?{currentSectionTitle:n.item.text,currentSectionSubtitle:n.item.subtitle}:{currentSectionTitle:`SETTINGS$TITLE`,currentSectionSubtitle:null}},[r,t.pathname]),p=n.find(e=>e.pathname===t.pathname)?.handle,m=i&&t.pathname===`/settings`;return(0,N.jsx)(`main`,{"data-testid":`settings-screen`,className:`min-h-0`,children:(0,N.jsx)(E,{setHideSectionHeader:u,children:(0,N.jsx)(F,{navigationItems:r,children:(0,N.jsxs)(`div`,{className:`flex flex-col gap-6 pb-8`,children:[!(p?.hideTitle===!0||m||l)&&(0,N.jsxs)(`header`,{className:`space-y-1`,children:[(0,N.jsx)(T.H2,{children:e(d)}),f?(0,N.jsx)(`p`,{"data-testid":`settings-page-subtitle`,className:`text-sm leading-5 text-tertiary-light`,children:e(f)}):null]}),(0,N.jsx)(a,{})]})})})})}var z=i(R);export{L as clientLoader,z as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bt as e}from"./vendor-styling-CI0PQ3ab.js";import{L as t,s as n}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{t as r}from"./useTranslation-CDRCKC9-.js";import{t as i}from"./declaration-gq8V5eTU.js";import{r as a,t as o}from"./use-settings-nav-items-
|
|
1
|
+
import{bt as e}from"./vendor-styling-CI0PQ3ab.js";import{L as t,s as n}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{t as r}from"./useTranslation-CDRCKC9-.js";import{t as i}from"./declaration-gq8V5eTU.js";import{r as a,t as o}from"./use-settings-nav-items-Dwktv8wo.js";import{t as s}from"./use-config-mJrtZHP1.js";import{t as c}from"./sidebar-nav-link-5AlTT5-j.js";import{r as l}from"./typography-D8mHDeNG.js";import{n as u}from"./settings-utils-BMdG65By.js";import{t as d}from"./use-breakpoint-B-O0lQ84.js";import{t as f}from"./backend-synced-settings-badge-D9hZx05w.js";var p=e();function m({navigationItems:e}){let{t}=r(`openhands`),n=e.filter(e=>e.type===`item`);return(0,p.jsxs)(`div`,{"data-testid":`settings-mobile-hub`,className:`flex flex-col gap-4 px-4 py-2 md:hidden`,children:[(0,p.jsx)(l.H2,{children:t(i.SETTINGS$TITLE)}),(0,p.jsxs)(`nav`,{className:`flex flex-col gap-0.5`,children:[n.map(e=>(0,p.jsx)(c,{to:e.item.to,label:t(e.item.text),end:!0,testId:`sidebar-settings-${e.item.to}`,icon:e.item.icon},e.item.to)),(0,p.jsx)(a,{})]}),(0,p.jsx)(`div`,{className:`pt-1`,children:(0,p.jsx)(f,{})})]})}var h=t(function(){let e=d(768),t=o(),{data:r}=s();return e?(0,p.jsx)(m,{navigationItems:t}):(0,p.jsx)(n,{to:u(r?.feature_flags)??`/settings/app`,replace:!0})});export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{t as r}from"./useTranslation-CDRCKC9-.js";import{t as i}from"./declaration-gq8V5eTU.js";import{F as a,t as o}from"./utils-D3U3rlqr.js";import{t as s}from"./modal-backdrop-zVwfOJZr.js";import{r as c,t as l}from"./modal-body-DouOE5KH.js";import{t as u}from"./base-modal-BuF2f0YL.js";import{t as d}from"./modal-classes-Cf-4tbHz.js";import{t as f}from"./brand-button-vMVuyDXu.js";import{n as p}from"./navigation-context-DPs2G0X8.js";import{t as m}from"./settings-input-bD6npsDm.js";import{t as h}from"./settings-mQUckT0g.js";import{t as g}from"./use-tracking-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{t as r}from"./useTranslation-CDRCKC9-.js";import{t as i}from"./declaration-gq8V5eTU.js";import{F as a,t as o}from"./utils-D3U3rlqr.js";import{t as s}from"./modal-backdrop-zVwfOJZr.js";import{r as c,t as l}from"./modal-body-DouOE5KH.js";import{t as u}from"./base-modal-BuF2f0YL.js";import{t as d}from"./modal-classes-Cf-4tbHz.js";import{t as f}from"./brand-button-vMVuyDXu.js";import{n as p}from"./navigation-context-DPs2G0X8.js";import{t as m}from"./settings-input-bD6npsDm.js";import{t as h}from"./settings-mQUckT0g.js";import{t as g}from"./use-tracking-BIXzagSI.js";import{t as _}from"./use-save-settings-BGlSfuYn.js";import{t as v}from"./model-selector-BfqpMkSJ.js";import{a as y,g as b}from"./sdk-settings-schema-Cv7M9eSe.js";import{t as x}from"./settings-utils-BMdG65By.js";var S=e(t(),1),C=n();function w({testId:e,title:t,description:n,buttons:r}){return(0,C.jsx)(u,{testId:e,title:t,description:n,buttons:[{text:r.danger.text,onClick:r.danger.onClick,className:`bg-danger`},{text:r.cancel.text,onClick:r.cancel.onClick,className:`bg-[var(--oh-interactive-selected)]`}]})}function T({settings:e,onClose:t}){let{trackSettingsSaved:n}=g(),{mutate:o}=_(),{currentPath:c}=p(),{t:l}=r(`openhands`),u=S.useRef(null),[d,h]=S.useState(!1),T=async e=>{let r=x(e);await o(r,{onSuccess:()=>{t();let e=r.agent_settings_diff?.llm??{};n({llmModel:e.model,llmApiKeySet:e.api_key?`SET`:`UNSET`,searchApiKeySet:r.search_api_key?`SET`:`UNSET`,remoteRuntimeResourceFactor:r.remote_runtime_resource_factor})}})},E=()=>{T(new FormData(u.current??void 0))},D=e=>{e.preventDefault();let t=new FormData(e.currentTarget);c.startsWith(`/conversations/`)?h(!0):T(t)},O=e.llm_api_key_set,k=y(e,`llm.model`);return(0,C.jsxs)(`div`,{children:[(0,C.jsxs)(`form`,{ref:u,"data-testid":`settings-form`,className:`flex flex-col gap-6`,onSubmit:D,children:[(0,C.jsxs)(`div`,{className:`flex flex-col gap-[17px]`,children:[(0,C.jsx)(v,{currentModel:typeof k==`string`?k:void 0,wrapperClassName:`!flex-col !gap-[17px]`,labelClassName:a.LABEL_CLASSNAME}),(0,C.jsx)(m,{testId:`llm-api-key-input`,name:`llm-api-key-input`,label:l(i.SETTINGS_FORM$API_KEY),type:`password`,className:`w-full`,placeholder:O?`<hidden>`:``,labelClassName:a.LABEL_CLASSNAME}),(0,C.jsx)(b,{testId:`llm-api-key-help-anchor`,text:l(i.SETTINGS$DONT_KNOW_API_KEY),linkText:l(i.SETTINGS$CLICK_FOR_INSTRUCTIONS),href:`https://docs.openhands.dev/usage/local-setup#getting-an-api-key`,size:`settings`,linkColor:`white`})]}),(0,C.jsx)(`div`,{className:`flex flex-col gap-2`,children:(0,C.jsx)(f,{testId:`save-settings-button`,type:`submit`,variant:`primary`,className:`w-full`,children:l(i.BUTTON$SAVE)})})]}),d&&(0,C.jsx)(s,{children:(0,C.jsx)(w,{title:l(i.MODAL$END_SESSION_TITLE),description:l(i.MODAL$END_SESSION_MESSAGE),buttons:{danger:{text:l(i.BUTTON$END_SESSION),onClick:E},cancel:{text:l(i.BUTTON$CANCEL),onClick:()=>h(!1)}}})})]})}function E({onClose:e,settings:t}){let{t:n}=r(`openhands`);return(0,C.jsx)(s,{children:(0,C.jsxs)(`div`,{"data-testid":`ai-config-modal`,className:o(`bg-[var(--oh-surface)] m-4 p-6 rounded-xl flex flex-col gap-[17px] border border-[var(--oh-border)] api-configuration-modal`,c(`md`),l),children:[(0,C.jsx)(`span`,{className:d,children:n(i.AI_SETTINGS$TITLE)}),(0,C.jsx)(b,{testId:`advanced-settings-link`,text:`${n(i.SETTINGS$DESCRIPTION)}. ${n(i.SETTINGS$FOR_OTHER_OPTIONS)} ${n(i.COMMON$SEE)}`,linkText:n(i.COMMON$ADVANCED_SETTINGS),href:`/settings`,suffix:`.`,size:`settings`,linkColor:`white`,suffixClassName:`text-white`}),(0,C.jsx)(T,{settings:t||h,onClose:e})]})})}export{E as SettingsModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~ncdxw0bh-ClHnt5lR.js";import{c as t,n}from"./agent-server-client-options-DVLRd9sw.js";import{t as r}from"./proxy-CHmFkV16.js";import{t as i}from"./settings-mQUckT0g.js";var a=/^[a-zA-Z0-9_-]+$/;function o(e){return a.test(e)}function s(e,t=`mcp`){return e.trim().replace(/[^a-zA-Z0-9_-]+/g,`_`).replace(/_+/g,`_`).replace(/^_+|_+$/g,``)||t}var c={sse_servers:[],stdio_servers:[],shttp_servers:[]},l=`**********`;function u(e,t){return RegExp(`^${t}(_\\d+)?$`).test(e)?void 0:e}function d(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function f(e){if(!d(e))return null;let t=e.mcpServers;return d(t)&&!(`url`in t)&&!(`command`in t)?t:e}function p(e){if(!d(e))return;let t=Object.entries(e).filter(e=>typeof e[1]==`string`);return t.length>0?Object.fromEntries(t):void 0}function m(e){return e===`**********`?!0:Array.isArray(e)?e.some(m):d(e)?Object.values(e).some(m):!1}function h(e){if(!d(e))return;let t={};return d(e.tokens)&&(t.tokens=e.tokens),d(e.client_info)&&(t.client_info=e.client_info),(typeof e.token_expires_at==`number`||e.token_expires_at===null)&&(t.token_expires_at=e.token_expires_at),Object.keys(t).length>0?t:void 0}function g(e){if(d(e))switch(e.strategy){case`none`:return{strategy:`none`};case`api_key`:return typeof e.value==`string`?{strategy:`api_key`,value:e.value,...typeof e.header_name==`string`&&{header_name:e.header_name}}:void 0;case`bearer`:return typeof e.value==`string`?{strategy:`bearer`,value:e.value}:void 0;case`basic`:return typeof e.username!=`string`||typeof e.password!=`string`?void 0:{strategy:`basic`,username:e.username,password:e.password};case`header`:{let t=p(e.headers);return t?{strategy:`header`,headers:t}:void 0}case`oauth2`:{let t=C(e.authentication),n=h(e.state);return{strategy:`oauth2`,...t&&{authentication:t},...n&&{state:n}}}default:return}}function _(e){return g(e.auth)}function v(e){let t={};return e.auth&&!m(e.auth)&&(t.auth=e.auth),e.headers&&Object.keys(e.headers).length>0&&(t.headers=e.headers),t}function y(e){return{...e.name&&{name:e.name},url:e.url,...e.headers&&{headers:e.headers},...e.auth&&{auth:e.auth}}}function b(e){return y(e)}function x(e){return{...y(e),...e.timeout!==void 0&&{timeout:e.timeout}}}function S(e){return{name:e.name,command:e.command,...e.args&&{args:e.args},...e.env&&{env:e.env}}}function C(e){if(!e||typeof e!=`object`)return;let t=e;if(t.type!==`oauth`)return;let n={type:`oauth`};return(t.client_auth_method===`none`||t.client_auth_method===`client_secret_post`||t.client_auth_method===`client_secret_basic`||t.client_auth_method===`private_key_jwt`)&&(n.client_auth_method=t.client_auth_method),(typeof t.scopes==`string`||Array.isArray(t.scopes)&&t.scopes.every(e=>typeof e==`string`))&&(n.scopes=t.scopes),typeof t.client_name==`string`&&(n.client_name=t.client_name),typeof t.client_metadata_url==`string`&&(n.client_metadata_url=t.client_metadata_url),typeof t.client_id==`string`&&(n.client_id=t.client_id),typeof t.client_secret==`string`&&(n.client_secret=t.client_secret),t.additional_client_metadata&&typeof t.additional_client_metadata==`object`&&!Array.isArray(t.additional_client_metadata)&&(n.additional_client_metadata=t.additional_client_metadata),n}function w(e){let t=f(e);if(!t)return{...c};let n=[],r=[],i=[];for(let[e,a]of Object.entries(t)){if(!d(a))continue;let t=a.url;if(t){let r=a.transport,o=_(a),s=p(a.headers);if(r===`sse`){let r=u(e,`sse`),i={url:t};r&&(i.name=r),o&&(i.auth=o),s&&(i.headers=s),n.push(i)}else{let n=u(e,`shttp`),r={url:t};n&&(r.name=n),a.timeout!=null&&(r.timeout=a.timeout),o&&(r.auth=o),s&&(r.headers=s),i.push(r)}}else{if(typeof a.command!=`string`)continue;let t={name:e,command:a.command};a.args&&(t.args=a.args),a.env&&(t.env=a.env),r.push(t)}}return{sse_servers:n,stdio_servers:r,shttp_servers:i}}function T(e){let t={},n=e=>{let n=s(e);if(!(n in t))return n;let r=1;for(;`${n}_${r}`in t;)r+=1;return`${n}_${r}`};for(let r of e.sse_servers){let e={},i;typeof r==`string`?e.url=r:(i=r.name,e.url=r.url,Object.assign(e,v(r))),e.transport=`sse`,t[n(i||`sse`)]=e}for(let r of e.shttp_servers){let e={transport:`http`},i;typeof r==`string`?e.url=r:(i=r.name,e.url=r.url,Object.assign(e,v(r)),r.timeout!=null&&(e.timeout=r.timeout)),t[n(i||`shttp`)]=e}for(let r of e.stdio_servers){let e={command:r.command};r.args&&(e.args=r.args),r.env&&(e.env=r.env),t[n(r.name||`stdio`)]=e}return Object.keys(t).length>0?t:null}function E(){let e=t().backend;if(e.kind!==`cloud`)throw Error(`Cloud settings call requires a cloud backend.`);return e}function D(e){if(e.agent_settings&&Object.keys(e.agent_settings).length>0)return e.agent_settings;let t={},n={};typeof e.llm_model==`string`&&(n.model=e.llm_model),typeof e.llm_base_url==`string`&&(n.base_url=e.llm_base_url),typeof e.llm_api_key==`string`&&(n.api_key=e.llm_api_key),Object.keys(n).length>0&&(t.llm=n);let r={};return typeof e.enable_default_condenser==`boolean`&&(r.enabled=e.enable_default_condenser),typeof e.condenser_max_size==`number`&&(r.max_size=e.condenser_max_size),Object.keys(r).length>0&&(t.condenser=r),typeof e.agent==`string`&&(t.agent=e.agent),e.mcp_config&&Object.keys(e.mcp_config).length>0&&(t.mcp_config=e.mcp_config),t}function O(e){if(e.conversation_settings&&Object.keys(e.conversation_settings).length>0)return e.conversation_settings;let t={};return typeof e.confirmation_mode==`boolean`&&(t.confirmation_mode=e.confirmation_mode),(typeof e.security_analyzer==`string`||e.security_analyzer===null)&&(t.security_analyzer=e.security_analyzer),typeof e.max_iterations==`number`&&(t.max_iterations=e.max_iterations),t}async function k(){let e=await r({backend:E(),method:`GET`,path:`/api/v1/settings`});return{...e,agent_settings:D(e),conversation_settings:O(e),llm_api_key_set:!!e.llm_api_key_set,search_api_key_set:!!e.search_api_key_set,provider_tokens_set:e.provider_tokens_set}}async function A(e){let t=E(),n={};if(e.agent_settings_diff){let t={...e.agent_settings_diff};t.agent_context===null&&delete t.agent_context,Object.keys(t).length>0&&(n.agent_settings_diff=t)}if(e.conversation_settings_diff&&Object.keys(e.conversation_settings_diff).length>0&&(n.conversation_settings_diff=e.conversation_settings_diff),e.app_preferences)for(let[t,r]of Object.entries(e.app_preferences))r!==void 0&&(n[t]=r);await r({backend:t,method:`POST`,path:`/api/v1/settings`,body:n})}async function j(){return r({backend:E(),method:`GET`,path:`/api/v1/settings/agent-schema`})}async function M(){return r({backend:E(),method:`GET`,path:`/api/v1/settings/conversation-schema`})}var N=[`language`,`user_consents_to_analytics`,`enable_sound_notifications`,`git_user_name`,`git_user_email`,`disabled_skills`],P=new Set(N),F=e=>P.has(e),I=e=>{let t={},n={};for(let[r,i]of Object.entries(e))F(r)?t[r]=i:n[r]=i;return{extracted:t,rest:n}},L=e=>JSON.parse(JSON.stringify(e)),R=(e,t)=>({...e??{},...t??{}});async function z(e,t=3,n=500){for(let r=0;r<t;r+=1)try{return await e()}catch(e){if(r>=t-1)throw e;let i=n*2**r;await new Promise(e=>{setTimeout(e,i)})}throw Error(`Retry attempts exhausted`)}var B={redacted:null,encrypted:null,timestamp:0},V=300*1e3,H=()=>Date.now()-B.timestamp<V,U=()=>{B={redacted:null,encrypted:null,timestamp:0}},W=e=>!!e&&typeof e==`object`&&!Array.isArray(e),G=(e,t)=>`Basic ${btoa(`${e}:${t}`)}`,K=e=>{switch(e.strategy){case`none`:return{};case`api_key`:{if(typeof e.value!=`string`||!e.value)return null;let t=typeof e.header_name==`string`&&e.header_name?e.header_name:`Authorization`,n=t===`Authorization`?`Bearer ${e.value}`:e.value;return{[t]:n}}case`bearer`:return typeof e.value!=`string`||!e.value?null:{Authorization:`Bearer ${e.value}`};case`basic`:return typeof e.username!=`string`||typeof e.password!=`string`?null:{Authorization:G(e.username,e.password)};case`header`:return p(e.headers)??{};case`oauth2`:{let t=W(e.state)?e.state.tokens:void 0;return!W(t)||typeof t.access_token!=`string`?null:{Authorization:`Bearer ${t.access_token}`}}default:return null}},q=e=>{if(!W(e))return e;let t=W(e.mcpServers),n=t?e.mcpServers:e,r=Object.fromEntries(Object.entries(n).map(([e,t])=>{if(!W(t)||!W(t.auth))return[e,t];let n=K(t.auth);if(n===null)return[e,t];let r={...t},i={...p(t.headers)??{},...n};return delete r.auth,Object.keys(i).length>0?r.headers=i:delete r.headers,[e,r]}));return t?{...e,mcpServers:r}:r},J=e=>{let t=f(e);return t?Object.values(t).some(e=>m(W(e)?e.auth:void 0)||m(W(e)?e.headers:void 0)||m(W(e)?e.env:void 0)):!1},Y=(e,t)=>{let n=f(e),r=f(t);return!n||!r?!1:Object.keys(n).some(e=>!(e in r))},X=e=>{let t={agent_settings:e.agent_settings??{},conversation_settings:e.conversation_settings??{},llm_api_key_set:e.llm_api_key_is_set},n=e.misc_settings?.app_preferences;if(n)for(let e of N){let r=n[e];r!==void 0&&(t[e]=r)}return t},Z=e=>{let t=R(i.agent_settings??{},e.agent_settings??{}),n=R(i.conversation_settings??{},e.conversation_settings??{}),r={...L(i),...e,provider_tokens_set:{...i.provider_tokens_set??{},...e.provider_tokens_set??{}},agent_settings:t,conversation_settings:n},a=t.llm,o=t.condenser;return typeof t.agent==`string`&&(r.agent=t.agent),typeof a?.model==`string`&&a.model.length>0&&(r.llm_model=a.model),typeof a?.base_url==`string`&&(r.llm_base_url=a.base_url),typeof o?.enabled==`boolean`&&(r.enable_default_condenser=o.enabled),typeof o?.max_size==`number`&&(r.condenser_max_size=o.max_size),typeof n.confirmation_mode==`boolean`&&(r.confirmation_mode=n.confirmation_mode),(typeof n.security_analyzer==`string`||n.security_analyzer===null)&&(r.security_analyzer=n.security_analyzer),typeof n.max_iterations==`number`&&(r.max_iterations=n.max_iterations),r.search_api_key_set=!!r.search_api_key,r},Q=class r{static async fetchSettingsFromApi(t){return z(()=>new e(n()).getSettings({exposeSecrets:t}))}static async getSettings(){if(t().backend.kind===`cloud`)try{return Z(await z(()=>k()))}catch(e){return console.warn(`Failed to fetch cloud settings, using defaults:`,e),Z({})}if(H()&&B.redacted)return Z(X(B.redacted));try{let e=await this.fetchSettingsFromApi();return B.redacted=e,B.timestamp=Date.now(),Z(X(e))}catch(e){return console.warn(`Failed to fetch settings from API, using defaults:`,e),Z({})}}static async getSettingsForConversation(){if(H()&&B.encrypted)return{agentSettings:B.encrypted.agent_settings,conversationSettings:B.encrypted.conversation_settings,secretsEncrypted:!0};let e=await this.fetchSettingsFromApi(`encrypted`);return B.encrypted=e,B.timestamp||=Date.now(),{agentSettings:e.agent_settings,conversationSettings:e.conversation_settings,secretsEncrypted:!0}}static async getSettingsSchema(){return t().backend.kind===`cloud`?await j():await new e(n()).getAgentSchema()}static async getConversationSettingsSchema(){return t().backend.kind===`cloud`?await M():await new e(n()).getConversationSchema()}static async saveSettings(i){let{extracted:a,rest:o}=I(i),s=Object.keys(a).length>0,c={},l=o.agent_settings_diff;l&&Object.keys(l).length>0&&(c.agent_settings_diff=l);let u=o.conversation_settings_diff;u&&Object.keys(u).length>0&&(c.conversation_settings_diff=u),s&&(c.misc_settings_diff={app_preferences:a});let d=t().backend.kind===`cloud`,f=c.agent_settings_diff,p=!!f&&`mcp_config`in f&&f.mcp_config!==null,m;if(p)try{m=d?(await k())?.agent_settings?.mcp_config:(await r.fetchSettingsFromApi())?.agent_settings?.mcp_config}catch{}let h=d&&p&&J(m)&&!Y(m,f?.mcp_config),g=p&&!h;if(d){if(!(c.agent_settings_diff||c.conversation_settings_diff||s))return!0;g&&await z(()=>A({agent_settings_diff:{mcp_config:null}}));let e={};c.agent_settings_diff&&(e.agent_settings_diff={...c.agent_settings_diff},`mcp_config`in e.agent_settings_diff&&(e.agent_settings_diff.mcp_config=q(e.agent_settings_diff.mcp_config))),c.conversation_settings_diff&&(e.conversation_settings_diff=c.conversation_settings_diff),s&&(e.app_preferences=a);try{await z(()=>A(e))}catch(e){if(g&&m)try{await A({agent_settings_diff:{mcp_config:m}})}catch{}throw e}}else{if(!(c.agent_settings_diff||c.conversation_settings_diff||c.misc_settings_diff))return!0;g&&await z(()=>new e(n()).updateSettings({agent_settings_diff:{mcp_config:null}}));try{await z(()=>new e(n()).updateSettings(c))}catch(t){if(g&&m)try{await new e(n()).updateSettings({agent_settings_diff:{mcp_config:m}})}catch{}throw t}}return U(),!0}static invalidateCache(){U()}};export{x as a,T as c,s as d,w as i,a as l,l as n,b as o,m as r,S as s,Q as t,o as u};
|
|
1
|
+
import{o as e}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~lf310vj7-CSVPGId3.js";import{c as t,n}from"./agent-server-client-options-DVLRd9sw.js";import{t as r}from"./proxy-BgJLtxu7.js";import{t as i}from"./settings-mQUckT0g.js";var a=/^[a-zA-Z0-9_-]+$/;function o(e){return a.test(e)}function s(e,t=`mcp`){return e.trim().replace(/[^a-zA-Z0-9_-]+/g,`_`).replace(/_+/g,`_`).replace(/^_+|_+$/g,``)||t}var c={sse_servers:[],stdio_servers:[],shttp_servers:[]},l=`**********`;function u(e,t){return RegExp(`^${t}(_\\d+)?$`).test(e)?void 0:e}function d(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function f(e){if(!d(e))return null;let t=e.mcpServers;return d(t)&&!(`url`in t)&&!(`command`in t)?t:e}function p(e){if(!d(e))return;let t=Object.entries(e).filter(e=>typeof e[1]==`string`);return t.length>0?Object.fromEntries(t):void 0}function m(e){return e===`**********`?!0:Array.isArray(e)?e.some(m):d(e)?Object.values(e).some(m):!1}function h(e){if(!d(e))return;let t={};return d(e.tokens)&&(t.tokens=e.tokens),d(e.client_info)&&(t.client_info=e.client_info),(typeof e.token_expires_at==`number`||e.token_expires_at===null)&&(t.token_expires_at=e.token_expires_at),Object.keys(t).length>0?t:void 0}function g(e){if(d(e))switch(e.strategy){case`none`:return{strategy:`none`};case`api_key`:return typeof e.value==`string`?{strategy:`api_key`,value:e.value,...typeof e.header_name==`string`&&{header_name:e.header_name}}:void 0;case`bearer`:return typeof e.value==`string`?{strategy:`bearer`,value:e.value}:void 0;case`basic`:return typeof e.username!=`string`||typeof e.password!=`string`?void 0:{strategy:`basic`,username:e.username,password:e.password};case`header`:{let t=p(e.headers);return t?{strategy:`header`,headers:t}:void 0}case`oauth2`:{let t=C(e.authentication),n=h(e.state);return{strategy:`oauth2`,...t&&{authentication:t},...n&&{state:n}}}default:return}}function _(e){return g(e.auth)}function v(e){let t={};return e.auth&&!m(e.auth)&&(t.auth=e.auth),e.headers&&Object.keys(e.headers).length>0&&(t.headers=e.headers),t}function y(e){return{...e.name&&{name:e.name},url:e.url,...e.headers&&{headers:e.headers},...e.auth&&{auth:e.auth}}}function b(e){return y(e)}function x(e){return{...y(e),...e.timeout!==void 0&&{timeout:e.timeout}}}function S(e){return{name:e.name,command:e.command,...e.args&&{args:e.args},...e.env&&{env:e.env}}}function C(e){if(!e||typeof e!=`object`)return;let t=e;if(t.type!==`oauth`)return;let n={type:`oauth`};return(t.client_auth_method===`none`||t.client_auth_method===`client_secret_post`||t.client_auth_method===`client_secret_basic`||t.client_auth_method===`private_key_jwt`)&&(n.client_auth_method=t.client_auth_method),(typeof t.scopes==`string`||Array.isArray(t.scopes)&&t.scopes.every(e=>typeof e==`string`))&&(n.scopes=t.scopes),typeof t.client_name==`string`&&(n.client_name=t.client_name),typeof t.client_metadata_url==`string`&&(n.client_metadata_url=t.client_metadata_url),typeof t.client_id==`string`&&(n.client_id=t.client_id),typeof t.client_secret==`string`&&(n.client_secret=t.client_secret),t.additional_client_metadata&&typeof t.additional_client_metadata==`object`&&!Array.isArray(t.additional_client_metadata)&&(n.additional_client_metadata=t.additional_client_metadata),n}function w(e){let t=f(e);if(!t)return{...c};let n=[],r=[],i=[];for(let[e,a]of Object.entries(t)){if(!d(a))continue;let t=a.url;if(t){let r=a.transport,o=_(a),s=p(a.headers);if(r===`sse`){let r=u(e,`sse`),i={url:t};r&&(i.name=r),o&&(i.auth=o),s&&(i.headers=s),n.push(i)}else{let n=u(e,`shttp`),r={url:t};n&&(r.name=n),a.timeout!=null&&(r.timeout=a.timeout),o&&(r.auth=o),s&&(r.headers=s),i.push(r)}}else{if(typeof a.command!=`string`)continue;let t={name:e,command:a.command};a.args&&(t.args=a.args),a.env&&(t.env=a.env),r.push(t)}}return{sse_servers:n,stdio_servers:r,shttp_servers:i}}function T(e){let t={},n=e=>{let n=s(e);if(!(n in t))return n;let r=1;for(;`${n}_${r}`in t;)r+=1;return`${n}_${r}`};for(let r of e.sse_servers){let e={},i;typeof r==`string`?e.url=r:(i=r.name,e.url=r.url,Object.assign(e,v(r))),e.transport=`sse`,t[n(i||`sse`)]=e}for(let r of e.shttp_servers){let e={transport:`http`},i;typeof r==`string`?e.url=r:(i=r.name,e.url=r.url,Object.assign(e,v(r)),r.timeout!=null&&(e.timeout=r.timeout)),t[n(i||`shttp`)]=e}for(let r of e.stdio_servers){let e={command:r.command};r.args&&(e.args=r.args),r.env&&(e.env=r.env),t[n(r.name||`stdio`)]=e}return Object.keys(t).length>0?t:null}function E(){let e=t().backend;if(e.kind!==`cloud`)throw Error(`Cloud settings call requires a cloud backend.`);return e}function D(e){if(e.agent_settings&&Object.keys(e.agent_settings).length>0)return e.agent_settings;let t={},n={};typeof e.llm_model==`string`&&(n.model=e.llm_model),typeof e.llm_base_url==`string`&&(n.base_url=e.llm_base_url),typeof e.llm_api_key==`string`&&(n.api_key=e.llm_api_key),Object.keys(n).length>0&&(t.llm=n);let r={};return typeof e.enable_default_condenser==`boolean`&&(r.enabled=e.enable_default_condenser),typeof e.condenser_max_size==`number`&&(r.max_size=e.condenser_max_size),Object.keys(r).length>0&&(t.condenser=r),typeof e.agent==`string`&&(t.agent=e.agent),e.mcp_config&&Object.keys(e.mcp_config).length>0&&(t.mcp_config=e.mcp_config),t}function O(e){if(e.conversation_settings&&Object.keys(e.conversation_settings).length>0)return e.conversation_settings;let t={};return typeof e.confirmation_mode==`boolean`&&(t.confirmation_mode=e.confirmation_mode),(typeof e.security_analyzer==`string`||e.security_analyzer===null)&&(t.security_analyzer=e.security_analyzer),typeof e.max_iterations==`number`&&(t.max_iterations=e.max_iterations),t}async function k(){let e=await r({backend:E(),method:`GET`,path:`/api/v1/settings`});return{...e,agent_settings:D(e),conversation_settings:O(e),llm_api_key_set:!!e.llm_api_key_set,search_api_key_set:!!e.search_api_key_set,provider_tokens_set:e.provider_tokens_set}}async function A(e){let t=E(),n={};if(e.agent_settings_diff){let t={...e.agent_settings_diff};t.agent_context===null&&delete t.agent_context,Object.keys(t).length>0&&(n.agent_settings_diff=t)}if(e.conversation_settings_diff&&Object.keys(e.conversation_settings_diff).length>0&&(n.conversation_settings_diff=e.conversation_settings_diff),e.app_preferences)for(let[t,r]of Object.entries(e.app_preferences))r!==void 0&&(n[t]=r);await r({backend:t,method:`POST`,path:`/api/v1/settings`,body:n})}async function j(){return r({backend:E(),method:`GET`,path:`/api/v1/settings/agent-schema`})}async function M(){return r({backend:E(),method:`GET`,path:`/api/v1/settings/conversation-schema`})}var N=[`language`,`user_consents_to_analytics`,`enable_sound_notifications`,`git_user_name`,`git_user_email`,`disabled_skills`],P=new Set(N),F=e=>P.has(e),I=e=>{let t={},n={};for(let[r,i]of Object.entries(e))F(r)?t[r]=i:n[r]=i;return{extracted:t,rest:n}},L=e=>JSON.parse(JSON.stringify(e)),R=(e,t)=>({...e??{},...t??{}});async function z(e,t=3,n=500){for(let r=0;r<t;r+=1)try{return await e()}catch(e){if(r>=t-1)throw e;let i=n*2**r;await new Promise(e=>{setTimeout(e,i)})}throw Error(`Retry attempts exhausted`)}var B={redacted:null,encrypted:null,timestamp:0},V=300*1e3,H=()=>Date.now()-B.timestamp<V,U=()=>{B={redacted:null,encrypted:null,timestamp:0}},W=e=>!!e&&typeof e==`object`&&!Array.isArray(e),G=(e,t)=>`Basic ${btoa(`${e}:${t}`)}`,K=e=>{switch(e.strategy){case`none`:return{};case`api_key`:{if(typeof e.value!=`string`||!e.value)return null;let t=typeof e.header_name==`string`&&e.header_name?e.header_name:`Authorization`,n=t===`Authorization`?`Bearer ${e.value}`:e.value;return{[t]:n}}case`bearer`:return typeof e.value!=`string`||!e.value?null:{Authorization:`Bearer ${e.value}`};case`basic`:return typeof e.username!=`string`||typeof e.password!=`string`?null:{Authorization:G(e.username,e.password)};case`header`:return p(e.headers)??{};case`oauth2`:{let t=W(e.state)?e.state.tokens:void 0;return!W(t)||typeof t.access_token!=`string`?null:{Authorization:`Bearer ${t.access_token}`}}default:return null}},q=e=>{if(!W(e))return e;let t=W(e.mcpServers),n=t?e.mcpServers:e,r=Object.fromEntries(Object.entries(n).map(([e,t])=>{if(!W(t)||!W(t.auth))return[e,t];let n=K(t.auth);if(n===null)return[e,t];let r={...t},i={...p(t.headers)??{},...n};return delete r.auth,Object.keys(i).length>0?r.headers=i:delete r.headers,[e,r]}));return t?{...e,mcpServers:r}:r},J=e=>{let t=f(e);return t?Object.values(t).some(e=>m(W(e)?e.auth:void 0)||m(W(e)?e.headers:void 0)||m(W(e)?e.env:void 0)):!1},Y=(e,t)=>{let n=f(e),r=f(t);return!n||!r?!1:Object.keys(n).some(e=>!(e in r))},X=e=>{let t={agent_settings:e.agent_settings??{},conversation_settings:e.conversation_settings??{},llm_api_key_set:e.llm_api_key_is_set},n=e.misc_settings?.app_preferences;if(n)for(let e of N){let r=n[e];r!==void 0&&(t[e]=r)}return t},Z=e=>{let t=R(i.agent_settings??{},e.agent_settings??{}),n=R(i.conversation_settings??{},e.conversation_settings??{}),r={...L(i),...e,provider_tokens_set:{...i.provider_tokens_set??{},...e.provider_tokens_set??{}},agent_settings:t,conversation_settings:n},a=t.llm,o=t.condenser;return typeof t.agent==`string`&&(r.agent=t.agent),typeof a?.model==`string`&&a.model.length>0&&(r.llm_model=a.model),typeof a?.base_url==`string`&&(r.llm_base_url=a.base_url),typeof o?.enabled==`boolean`&&(r.enable_default_condenser=o.enabled),typeof o?.max_size==`number`&&(r.condenser_max_size=o.max_size),typeof n.confirmation_mode==`boolean`&&(r.confirmation_mode=n.confirmation_mode),(typeof n.security_analyzer==`string`||n.security_analyzer===null)&&(r.security_analyzer=n.security_analyzer),typeof n.max_iterations==`number`&&(r.max_iterations=n.max_iterations),r.search_api_key_set=!!r.search_api_key,r},Q=class r{static async fetchSettingsFromApi(t){return z(()=>new e(n()).getSettings({exposeSecrets:t}))}static async getSettings(){if(t().backend.kind===`cloud`)try{return Z(await z(()=>k()))}catch(e){return console.warn(`Failed to fetch cloud settings, using defaults:`,e),Z({})}if(H()&&B.redacted)return Z(X(B.redacted));try{let e=await this.fetchSettingsFromApi();return B.redacted=e,B.timestamp=Date.now(),Z(X(e))}catch(e){return console.warn(`Failed to fetch settings from API, using defaults:`,e),Z({})}}static async getSettingsForConversation(){if(H()&&B.encrypted)return{agentSettings:B.encrypted.agent_settings,conversationSettings:B.encrypted.conversation_settings,secretsEncrypted:!0};let e=await this.fetchSettingsFromApi(`encrypted`);return B.encrypted=e,B.timestamp||=Date.now(),{agentSettings:e.agent_settings,conversationSettings:e.conversation_settings,secretsEncrypted:!0}}static async getSettingsSchema(){return t().backend.kind===`cloud`?await j():await new e(n()).getAgentSchema()}static async getConversationSettingsSchema(){return t().backend.kind===`cloud`?await M():await new e(n()).getConversationSchema()}static async saveSettings(i){let{extracted:a,rest:o}=I(i),s=Object.keys(a).length>0,c={},l=o.agent_settings_diff;l&&Object.keys(l).length>0&&(c.agent_settings_diff=l);let u=o.conversation_settings_diff;u&&Object.keys(u).length>0&&(c.conversation_settings_diff=u),s&&(c.misc_settings_diff={app_preferences:a});let d=t().backend.kind===`cloud`,f=c.agent_settings_diff,p=!!f&&`mcp_config`in f&&f.mcp_config!==null,m;if(p)try{m=d?(await k())?.agent_settings?.mcp_config:(await r.fetchSettingsFromApi())?.agent_settings?.mcp_config}catch{}let h=d&&p&&J(m)&&!Y(m,f?.mcp_config),g=p&&!h;if(d){if(!(c.agent_settings_diff||c.conversation_settings_diff||s))return!0;g&&await z(()=>A({agent_settings_diff:{mcp_config:null}}));let e={};c.agent_settings_diff&&(e.agent_settings_diff={...c.agent_settings_diff},`mcp_config`in e.agent_settings_diff&&(e.agent_settings_diff.mcp_config=q(e.agent_settings_diff.mcp_config))),c.conversation_settings_diff&&(e.conversation_settings_diff=c.conversation_settings_diff),s&&(e.app_preferences=a);try{await z(()=>A(e))}catch(e){if(g&&m)try{await A({agent_settings_diff:{mcp_config:m}})}catch{}throw e}}else{if(!(c.agent_settings_diff||c.conversation_settings_diff||c.misc_settings_diff))return!0;g&&await z(()=>new e(n()).updateSettings({agent_settings_diff:{mcp_config:null}}));try{await z(()=>new e(n()).updateSettings(c))}catch(t){if(g&&m)try{await new e(n()).updateSettings({agent_settings_diff:{mcp_config:m}})}catch{}throw t}}return U(),!0}static invalidateCache(){U()}};export{x as a,T as c,s as d,w as i,a as l,l as n,b as o,m as r,S as s,Q as t,o as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{L as r,P as i,r as a}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{h as o}from"./path-utils-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{L as r,P as i,r as a}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{h as o}from"./path-utils-CSmuZoix.js";import{t as s}from"./useQuery-CRBP8vIS.js";import{t as c}from"./useTranslation-CDRCKC9-.js";import{t as l}from"./declaration-gq8V5eTU.js";import{n as u}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~lf310vj7-CSVPGId3.js";import{t as d}from"./messages-BnJCqnFf.js";import{n as f}from"./agent-server-client-options-DVLRd9sw.js";import{t as p}from"./loading-spinner-BLdswi6q.js";import{t as m}from"./openhands-logo-bcNw5bkY.js";import{c as h}from"./lesson-plan-jC0HBoe6.js";import{n as g}from"./use-event-store-DjgU4wfO.js";var _=e(t(),1),v=e=>s({queryKey:[`shared-conversation`,e],queryFn:()=>{if(!e)throw Error(`Conversation ID is required`);return new u(f()).getSharedConversation(e)},enabled:!!e,retry:!1}),y=e=>o({queryKey:[`shared-conversation-events`,e],queryFn:({pageParam:t})=>{if(!e)throw Error(`Conversation ID is required`);return new u(f()).searchSharedEvents({conversationId:e,limit:100,pageId:t})},initialPageParam:void 0,getNextPageParam:e=>e.next_page_id??void 0,enabled:!!e,retry:!1}),b=({hasNextPage:e,isFetchingNextPage:t,fetchNextPage:n,threshold:r=100})=>{let i=(0,_.useRef)(null),a=(0,_.useCallback)(()=>{if(!i.current||t||!e)return;let{scrollTop:a,scrollHeight:o,clientHeight:s}=i.current;a+s>=o-r&&n()},[e,t,n,r]);return(0,_.useEffect)(()=>{let e=i.current;if(e)return e.addEventListener(`scroll`,a),()=>{e.removeEventListener(`scroll`,a)}},[a]),i},x=n(),S=r(function(){let{t:e}=c(`openhands`),{conversationId:t}=i(),{data:n,isLoading:r,error:o}=v(t),{data:s,isLoading:u,error:f,hasNextPage:S,fetchNextPage:C,isFetchingNextPage:w}=y(t),T=r||u,E=o||f,D=_.useMemo(()=>s?.pages?s.pages.flatMap(e=>e.items):[],[s?.pages]),O=_.useMemo(()=>D.reduce((e,t)=>g(t,e),[]).filter(h),[D]),k=b({hasNextPage:!!S,isFetchingNextPage:w,fetchNextPage:C});return T?(0,x.jsx)(`div`,{className:`flex items-center justify-center h-screen bg-base`,children:(0,x.jsx)(p,{size:`large`})}):E||!n?(0,x.jsx)(`div`,{className:`flex items-center justify-center h-screen bg-base`,children:(0,x.jsx)(`div`,{className:`text-white`,children:e(l.CONVERSATION$NOT_FOUND)})}):(0,x.jsxs)(`div`,{className:`h-screen bg-base text-white flex flex-col`,children:[(0,x.jsx)(`div`,{className:`border-b border-[var(--oh-border-subtle)] p-4 flex-shrink-0`,children:(0,x.jsxs)(`div`,{className:`max-w-4xl mx-auto flex items-start gap-4`,children:[(0,x.jsx)(a,{to:`/conversations`,className:`flex-shrink-0`,"aria-label":e(l.BRANDING$OPENHANDS_LOGO),children:(0,x.jsx)(m,{width:46,height:30})}),(0,x.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,x.jsx)(`h1`,{className:`text-xl font-medium mb-2`,children:n?.title||e(l.CONVERSATION$SHARED_CONVERSATION)}),n?.selected_branch&&(0,x.jsxs)(`div`,{className:`text-sm text-[var(--oh-muted)]`,children:[e(l.CONVERSATION$BRANCH),`: `,n.selected_branch]}),n?.selected_repository&&(0,x.jsxs)(`div`,{className:`text-sm text-[var(--oh-muted)]`,children:[e(l.CONVERSATION$REPOSITORY),`:`,` `,n.selected_repository]}),n?.llm_model&&(0,x.jsxs)(`div`,{className:`text-sm text-[var(--oh-muted)]`,children:[e(l.LLM$MODEL),`: `,n.llm_model]})]})]})}),(0,x.jsx)(`div`,{ref:k,className:`flex-1 overflow-y-auto custom-scrollbar-always px-4 pt-4 gap-2`,children:(0,x.jsxs)(`div`,{className:`max-w-4xl mx-auto p-4 border border-[var(--oh-border-subtle)] rounded`,children:[O.length>0?(0,x.jsx)(d,{messages:O,allEvents:D}):(0,x.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,x.jsx)(`div`,{className:`text-center text-[var(--oh-muted)] py-8`,children:e(l.CONVERSATION$NO_HISTORY_AVAILABLE)})}),w&&(0,x.jsx)(`div`,{className:`flex justify-center py-4`,children:(0,x.jsx)(p,{size:`small`})})]})})]})});export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{n as r}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{n as r}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~epa72zsm-B4rXs7Zd.js";import{t as i}from"./useMutation-DrCAVg5w.js";import{t as a}from"./Trans-Ch-OVWEA.js";import{t as o}from"./useTranslation-CDRCKC9-.js";import{t as s}from"./declaration-gq8V5eTU.js";import{t as c}from"./utils-D3U3rlqr.js";import{t as l}from"./modal-backdrop-zVwfOJZr.js";import{n as u}from"./modal-body-DouOE5KH.js";import{n as d,r as f}from"./base-modal-BuF2f0YL.js";import{_ as p,u as m}from"./form-control-classes-ChpNBe9n.js";import{t as h}from"./brand-button-vMVuyDXu.js";import{t as g}from"./agent-server-conversation-service.api-CuSdr4Qb.js";var _=e(t(),1),v=n();function y({onConfirm:e,onCancel:t,conversationTitle:n,title:r,description:i}){let{t:c}=o(`openhands`),p;return p=i??(n?(0,v.jsx)(a,{ns:`openhands`,i18nKey:s.CONVERSATION$DELETE_WARNING_WITH_TITLE,values:{title:n},components:{title:(0,v.jsx)(`span`,{className:`text-white`})}}):c(s.CONVERSATION$DELETE_WARNING)),(0,v.jsx)(l,{onClose:t,children:(0,v.jsxs)(u,{className:`items-start border border-[var(--oh-border)]`,children:[(0,v.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,v.jsx)(f,{title:r??c(s.CONVERSATION$CONFIRM_DELETE)}),(0,v.jsx)(d,{children:p})]}),(0,v.jsxs)(`div`,{className:`flex justify-end gap-2 w-full`,onClick:e=>e.stopPropagation(),children:[(0,v.jsx)(h,{type:`button`,variant:`secondary`,onClick:t,"data-testid":`cancel-button`,children:c(s.BUTTON$CANCEL)}),(0,v.jsx)(h,{type:`button`,variant:`primary`,onClick:e,"data-testid":`confirm-button`,children:c(s.ACTION$CONFIRM_DELETE)})]})]})})}function b({onConfirm:e,onCancel:t}){let{t:n}=o(`openhands`);return(0,v.jsx)(l,{onClose:t,children:(0,v.jsxs)(u,{className:`items-start border border-[var(--oh-border)]`,children:[(0,v.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,v.jsx)(f,{title:n(s.CONVERSATION$CONFIRM_CLOSE_CONVERSATION)}),(0,v.jsx)(d,{description:n(s.CONVERSATION$CLOSE_CONVERSATION_WARNING)})]}),(0,v.jsxs)(`div`,{className:`flex justify-end gap-2 w-full`,onClick:e=>e.stopPropagation(),children:[(0,v.jsx)(h,{type:`button`,variant:`secondary`,onClick:t,"data-testid":`cancel-button`,children:n(s.BUTTON$CANCEL)}),(0,v.jsx)(h,{type:`button`,variant:`primary`,onClick:e,"data-testid":`confirm-button`,children:n(s.ACTION$CONFIRM_CLOSE)})]})]})})}var x=()=>{let e=r();return i({mutationFn:e=>g.updateConversationTitle(e.conversationId,e.newTitle),onMutate:async t=>{await e.cancelQueries({queryKey:[`user`,`conversations`]});let n=e.getQueryData([`user`,`conversations`]);return e.setQueryData([`user`,`conversations`],e=>e?.map(e=>e.id===t.conversationId?{...e,title:t.newTitle}:e)),e.setQueryData([`user`,`conversation`,t.conversationId],e=>e&&{...e,title:t.newTitle}),{previousConversations:n}},onError:(t,n,r)=>{r?.previousConversations&&e.setQueryData([`user`,`conversations`],r.previousConversations)},onSettled:(t,n,r)=>{e.invalidateQueries({queryKey:[`user`,`conversations`]}),e.invalidateQueries({queryKey:[`user`,`conversation`,r.conversationId]})}})};function S(e){if(!e)return null;try{let t=new URL(e);return t.hostname===`localhost`&&window.location.hostname!==`localhost`?(t.hostname=window.location.hostname,t.toString()):e}catch{return e}}var C=e=>(0,v.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,v.jsx)(`path`,{d:`M12 2C12.5523 2 13 2.44772 13 3V13.5858L15.2929 11.2929C15.6834 10.9024 16.3166 10.9024 16.7071 11.2929C17.0976 11.6834 17.0976 12.3166 16.7071 12.7071L12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L7.29289 12.7071C6.90237 12.3166 6.90237 11.6834 7.29289 11.2929C7.68342 10.9024 8.31658 10.9024 8.70711 11.2929L11 13.5858V3C11 2.44772 11.4477 2 12 2ZM5 17C5.55228 17 6 17.4477 6 18V20H18V18C18 17.4477 18.4477 17 19 17C19.5523 17 20 17.4477 20 18V20C20 21.1046 19.1046 22 18 22H6C4.89543 22 4 21.1046 4 20V18C4 17.4477 4.44772 17 5 17Z`,fill:`currentColor`})}),w=e=>(0,v.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,v.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M21 7.5V9H3V7.5H21ZM3 10.5H21V18H3V10.5ZM21 6H3C2.60218 6 2.22064 6.15804 1.93934 6.43934C1.65804 6.72064 1.5 7.10218 1.5 7.5V18C1.5 18.3978 1.65804 18.7794 1.93934 19.0607C2.22064 19.342 2.60218 19.5 3 19.5H21C21.3978 19.5 21.7794 19.342 22.0607 19.0607C22.342 18.7794 22.5 18.3978 22.5 18V7.5C22.5 7.10218 22.342 6.72064 22.0607 6.43934C21.7794 6.15804 21.3978 6 21 6ZM16.5 15H19.5V16.5H16.5V15Z`,fill:`currentColor`})}),T=_.createContext(null);function E({children:e}){let[t,n]=_.useState(!1),r=_.useCallback(()=>n(!0),[]),i=_.useCallback(()=>n(!1),[]),a=_.useCallback(()=>n(e=>!e),[]),o=_.useMemo(()=>({isOpen:t,open:r,close:i,toggle:a}),[t,r,i,a]);return(0,v.jsx)(T.Provider,{value:o,children:e})}function D(){let e=_.useContext(T);if(!e)throw Error(`useSidebarMobileNav must be used within SidebarMobileNavProvider`);return e}var O=c(`inline-flex shrink-0 cursor-pointer items-center justify-center rounded-md p-1`,`text-[var(--oh-muted)]`,p,m),k=`size-5 shrink-0`,A=e=>(0,v.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,v.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M10 5.5H18C18.2761 5.5 18.5 5.72386 18.5 6V18C18.5 18.2761 18.2761 18.5 18 18.5H10L10 5.5ZM8.5 5.5H6C5.72386 5.5 5.5 5.72386 5.5 6V18C5.5 18.2761 5.72386 18.5 6 18.5H8.5L8.5 5.5ZM18 4H6C4.89543 4 4 4.89543 4 6V18C4 19.1046 4.89543 20 6 20H18C19.1046 20 20 19.1046 20 18V6C20 4.89543 19.1046 4 18 4Z`,fill:`currentColor`})});function j(){let{t:e}=o(`openhands`),{isOpen:t,toggle:n}=D();return(0,v.jsx)(`button`,{type:`button`,"data-testid":`sidebar-mobile-menu-toggle`,onClick:n,"aria-expanded":t,"aria-label":e(t?s.SIDEBAR$CLOSE_MENU:s.SIDEBAR$OPEN_MENU),className:O,children:(0,v.jsx)(A,{className:k,"aria-hidden":!0})})}export{E as a,C as c,b as d,y as f,k as i,S as l,A as n,D as o,O as r,w as s,j as t,x as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{L as r}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{n as i}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~i3v2mlbw-BrJQ3XZH.js";import{t as a}from"./useMutation-DCE9RcgK.js";import{t as o}from"./useQuery-CpjHYtZc.js";import{t as s}from"./useTranslation-CDRCKC9-.js";import{t as c}from"./declaration-gq8V5eTU.js";import{A as l,P as u,j as d,n as f,u as p}from"./active-backend-context-B3umL5R-.js";import{t as m}from"./search-4DHskuhE.js";import{t as h}from"./x-Cb0WAtak.js";import{t as g}from"./utils-D3U3rlqr.js";import{t as _}from"./modal-backdrop-zVwfOJZr.js";import{n as v}from"./modal-classes-Cf-4tbHz.js";import{t as y}from"./brand-button-vMVuyDXu.js";import{t as b}from"./modal-close-button-B6CfxxJj.js";import{t as x}from"./settings-input-bD6npsDm.js";import{t as S}from"./plugins-management-service-BAp70KN7.js";import{a as C,i as w,r as T}from"./extension-module-card-classes-9V3J9J_b.js";import{t as E}from"./settings-switch-5cuxl8Dc.js";import{n as D}from"./circle-plus-check-toggle-C5YxjxvI.js";import{n as O,t as k}from"./use-plugins-marketplace-BGb-KgfD.js";import{n as A}from"./extensions-navigation-D9i0DL62.js";import{n as j}from"./settings-like-page-layout-classes-DENKlZpD.js";var M=e(t(),1),N=n();function P({plugin:e,isBusy:t=!1,isDisabled:n=!1,onOpen:r,onInstall:i,onToggle:a}){let{t:o}=s(`openhands`);return(0,N.jsxs)(`div`,{"data-testid":`plugin-card-${e.name}`,role:`button`,tabIndex:0,onClick:r,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r())},className:g(`flex min-w-0 flex-col gap-3 overflow-hidden p-4`,C,T),children:[(0,N.jsxs)(`header`,{className:`flex items-start justify-between gap-3`,children:[(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsx)(`h3`,{"data-testid":`plugin-name-${e.name}`,className:`truncate text-sm font-semibold text-white`,children:e.name}),e.source?(0,N.jsx)(`p`,{"data-testid":`plugin-source-${e.name}`,className:`mt-0.5 min-w-0 truncate text-xs text-tertiary-alt`,title:e.source,children:e.source}):null]}),e.installed?(0,N.jsx)(D,{testId:`plugin-toggle-${e.name}`,isSelected:e.enabled,isDisabled:n||t,onToggle:a,disableTooltipKey:c.COMMON$DISABLE}):e.isLocal?(0,N.jsx)(`span`,{"data-testid":`plugin-local-badge-${e.name}`,className:g(w,`flex-shrink-0`),children:o(c.SETTINGS$PLUGINS_FILTER_LOCAL)}):(0,N.jsx)(y,{type:`button`,variant:`secondary`,testId:`plugin-install-${e.name}`,isDisabled:n||t,className:`flex-shrink-0 whitespace-nowrap`,onClick:e=>{e?.stopPropagation(),i()},children:o(t?c.SETTINGS$PLUGINS_INSTALLING:c.SETTINGS$PLUGINS_INSTALL)})]}),e.description?(0,N.jsx)(`p`,{"data-testid":`plugin-description-${e.name}`,className:`line-clamp-2 break-words text-xs leading-relaxed text-tertiary-light`,children:e.description}):null,(e.installed||e.isLocal)&&e.version?(0,N.jsx)(`span`,{"data-testid":`plugin-version-${e.name}`,className:g(w,`self-start`),children:o(c.SETTINGS$SKILLS_VERSION,{version:e.version})}):null]})}var F=[{value:`all`,labelKey:c.SETTINGS$PLUGINS_FILTER_ALL},{value:`installed`,labelKey:c.SETTINGS$PLUGINS_FILTER_INSTALLED},{value:`available`,labelKey:c.SETTINGS$PLUGINS_FILTER_AVAILABLE},{value:`local`,labelKey:c.SETTINGS$PLUGINS_FILTER_LOCAL}];function I({search:e,onSearchChange:t,statusFilter:n,onStatusFilterChange:r}){let{t:i}=s(`openhands`);return(0,N.jsxs)(`div`,{"data-testid":`plugins-toolbar`,className:`flex items-stretch gap-2`,children:[(0,N.jsxs)(`div`,{className:g(`relative flex flex-1 min-w-0 items-center`,`rounded-lg border border-[var(--oh-border)] bg-base-secondary`,`focus-within:border-white/40 focus-within:ring-1 focus-within:ring-white/20`,`transition-colors`),children:[(0,N.jsx)(m,{className:`ml-3 h-4 w-4 shrink-0 text-tertiary-alt`,"aria-hidden":!0}),(0,N.jsx)(`input`,{"data-testid":`plugins-search-input`,type:`search`,value:e,onChange:e=>t(e.target.value),placeholder:i(c.SETTINGS$PLUGINS_SEARCH_PLACEHOLDER),"aria-label":i(c.SETTINGS$PLUGINS_SEARCH_PLACEHOLDER),className:g(`flex-1 min-w-0 bg-transparent border-0 outline-none`,`px-3 py-2 text-sm placeholder:text-tertiary-alt`,`[&::-webkit-search-cancel-button]:hidden`)}),e?(0,N.jsx)(`button`,{type:`button`,onClick:()=>t(``),"aria-label":i(c.MCP$SEARCH_CLEAR),className:`mr-2 p-1 rounded text-tertiary-alt hover:text-white cursor-pointer`,children:(0,N.jsx)(h,{className:`h-4 w-4`,"aria-hidden":!0})}):null]}),(0,N.jsx)(`div`,{"data-testid":`plugins-status-filter`,className:`flex shrink-0 items-center gap-1 rounded-lg border border-[var(--oh-border)] bg-base-secondary p-1`,children:F.map(e=>(0,N.jsx)(`button`,{type:`button`,"data-testid":`plugins-filter-${e.value}`,"aria-pressed":n===e.value,onClick:()=>r(e.value),className:g(`cursor-pointer rounded-md px-3 py-1 text-xs transition-colors`,n===e.value?`bg-surface-raised text-white`:`text-tertiary-alt hover:text-white`),children:i(e.labelKey)},e.value))})]})}function L({plugin:e,isBusy:t=!1,isDisabled:n=!1,onToggle:r,onInstall:i,onUninstall:a,onRefresh:o,onClose:l}){let{t:u}=s(`openhands`),d=n||t;return(0,N.jsx)(_,{onClose:l,"aria-label":e.name,children:(0,N.jsxs)(`div`,{"data-testid":`plugin-detail-modal`,"data-plugin-name":e.name,className:`relative flex w-[520px] max-w-[90vw] max-h-[85vh] flex-col rounded-xl border border-[var(--oh-border)] bg-base-secondary`,children:[(0,N.jsx)(b,{onClose:l,testId:`plugin-detail-modal-close`}),(0,N.jsxs)(`header`,{className:`flex-shrink-0 px-6 pb-4 pt-6`,children:[(0,N.jsx)(`h2`,{className:g(`pr-6`,v),children:e.name}),e.source?(0,N.jsx)(`p`,{className:`mt-1 break-all text-xs text-tertiary-alt`,children:e.source}):null]}),(0,N.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-6 custom-scrollbar`,children:[e.description?(0,N.jsx)(`p`,{className:`text-sm leading-relaxed text-tertiary-light`,children:e.description}):null,(0,N.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.isLocal?(0,N.jsx)(`span`,{className:w,children:u(c.SETTINGS$PLUGINS_FILTER_LOCAL)}):null,e.version?(0,N.jsx)(`span`,{className:w,children:u(c.SETTINGS$SKILLS_VERSION,{version:e.version})}):null,e.ref?(0,N.jsxs)(`span`,{className:w,children:[u(c.SETTINGS$PLUGINS_REF_LABEL),` `,e.ref]}):null,e.repoPath?(0,N.jsxs)(`span`,{className:w,children:[u(c.SETTINGS$PLUGINS_REPO_PATH_LABEL),` `,e.repoPath]}):null]}),e.installed?(0,N.jsx)(E,{testId:`plugin-modal-toggle-${e.name}`,isToggled:e.enabled,onToggle:r,isDisabled:d,togglePosition:`right`,children:u(e.enabled?c.SETTINGS$SKILLS_ENABLED:c.SETTINGS$SKILLS_DISABLED)}):null]}),(0,N.jsxs)(`footer`,{className:`flex flex-shrink-0 flex-wrap justify-end gap-2 px-6 pb-6 pt-4`,children:[e.installed?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(y,{type:`button`,variant:`secondary`,testId:`plugin-detail-refresh-${e.name}`,isDisabled:d,onClick:o,children:u(c.SETTINGS$PLUGINS_REFRESH)}),(0,N.jsx)(y,{type:`button`,variant:`secondary`,testId:`plugin-detail-uninstall-${e.name}`,isDisabled:d,onClick:a,children:u(c.SETTINGS$PLUGINS_UNINSTALL)})]}):e.isLocal?null:(0,N.jsx)(y,{type:`button`,variant:`primary`,testId:`plugin-detail-install-${e.name}`,isDisabled:d,onClick:i,children:u(t?c.SETTINGS$PLUGINS_INSTALLING:c.SETTINGS$PLUGINS_INSTALL)}),(0,N.jsx)(y,{type:`button`,variant:`secondary`,testId:`plugin-detail-modal-dismiss`,onClick:l,children:u(c.BUTTON$CLOSE)})]})]})})}function R(){let e=i(),{t}=s(`openhands`);return a({mutationFn:e=>S.installPlugin(e),onSuccess:()=>{e.invalidateQueries({queryKey:p.installed}),e.invalidateQueries({queryKey:p.marketplace}),d(t(c.SETTINGS$PLUGINS_INSTALL_SUCCESS))},onError:e=>{l(u(e)||t(c.ERROR$GENERIC))}})}function z({onClose:e,onInstalled:t}){let{t:n}=s(`openhands`),r=R(),[i,a]=M.useState(``),[o,l]=M.useState(``),[u,d]=M.useState(``),f=i.trim(),p=f.length>0&&!r.isPending;return(0,N.jsx)(_,{onClose:e,"aria-label":n(c.SETTINGS$PLUGINS_ADD_MODAL_TITLE),children:(0,N.jsxs)(`form`,{onSubmit:n=>{n.preventDefault(),p&&r.mutate({source:f,ref:o.trim()||null,repo_path:u.trim()||null},{onSuccess:()=>{t?.(),e()}})},"data-testid":`add-plugin-modal`,className:`relative flex w-[520px] max-w-[90vw] max-h-[85vh] flex-col rounded-xl border border-[var(--oh-border)] bg-base-secondary`,children:[(0,N.jsx)(b,{onClose:e,testId:`add-plugin-modal-close`}),(0,N.jsxs)(`header`,{className:`flex-shrink-0 px-6 pb-4 pt-6`,children:[(0,N.jsx)(`h2`,{className:g(`pr-6`,v),children:n(c.SETTINGS$PLUGINS_ADD_MODAL_TITLE)}),(0,N.jsx)(`p`,{className:`mt-4 text-sm text-tertiary-light`,children:n(c.SETTINGS$PLUGINS_ADD_MODAL_INTRO)})]}),(0,N.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-6 custom-scrollbar`,children:[(0,N.jsx)(x,{testId:`add-plugin-source-input`,label:n(c.SETTINGS$PLUGINS_SOURCE_LABEL),type:`text`,value:i,onChange:a,placeholder:n(c.SETTINGS$PLUGINS_SOURCE_PLACEHOLDER),showRequiredTag:!0}),(0,N.jsx)(x,{testId:`add-plugin-ref-input`,label:n(c.SETTINGS$PLUGINS_REF_LABEL),type:`text`,value:o,onChange:l,showOptionalTag:!0}),(0,N.jsx)(x,{testId:`add-plugin-repo-path-input`,label:n(c.SETTINGS$PLUGINS_REPO_PATH_LABEL),type:`text`,value:u,onChange:d,showOptionalTag:!0})]}),(0,N.jsxs)(`footer`,{className:`flex flex-shrink-0 justify-end gap-2 px-6 pb-6 pt-4`,children:[(0,N.jsx)(y,{type:`button`,variant:`secondary`,onClick:e,testId:`add-plugin-modal-dismiss`,children:n(c.BUTTON$CLOSE)}),(0,N.jsx)(y,{type:`submit`,variant:`primary`,testId:`add-plugin-submit`,isDisabled:!p,children:n(r.isPending?c.SETTINGS$PLUGINS_INSTALLING:c.SETTINGS$PLUGINS_INSTALL)})]})]})})}function B(e,t,n=void 0){let r=new Map;for(let t of e??[])r.set(t.name,{name:t.name,description:t.description,source:t.source,ref:t.ref??null,repoPath:t.repo_path??null,installed:t.installed,enabled:!1,version:null,inCatalog:!0,isLocal:!1});for(let e of t??[]){let t=r.get(e.name);r.set(e.name,{name:e.name,description:t?.description??e.description??null,source:e.source??t?.source??null,ref:e.resolved_ref??t?.ref??null,repoPath:e.repo_path??t?.repoPath??null,installed:!0,enabled:e.enabled,version:e.version??null,inCatalog:t?.inCatalog??!1,isLocal:!1})}for(let e of n??[])r.has(e.name)||r.set(e.name,{name:e.name,description:e.description||null,source:null,ref:null,repoPath:null,installed:!1,enabled:!1,version:e.version||null,inCatalog:!1,isLocal:!0});let i=e=>e.installed?0:e.isLocal?1:2;return Array.from(r.values()).sort((e,t)=>{let n=i(e)-i(t);return n===0?e.name.localeCompare(t.name):n})}function V(e,t){let n=t.trim().toLowerCase();return n?[e.name,e.description??``,e.source??``,e.repoPath??``,e.ref??``].some(e=>e.toLowerCase().includes(n)):!0}function H(e,t){return t===`installed`?e.installed:t===`available`?!e.installed&&!e.isLocal:t===`local`?e.isLocal:!0}var U=()=>o({queryKey:p.installed,queryFn:()=>S.listInstalledPlugins(),staleTime:1e3*60*10,refetchOnWindowFocus:!1}),W=()=>o({queryKey:p.local,queryFn:()=>O.getLocalPlugins(),staleTime:1e3*60*10,refetchOnWindowFocus:!1});function G(){let e=i(),{t}=s(`openhands`);return a({mutationFn:({name:e,enabled:t})=>S.setPluginEnabled(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:p.installed})},onError:e=>{l(u(e)||t(c.ERROR$GENERIC))}})}function K(){let e=i(),{t}=s(`openhands`);return a({mutationFn:e=>S.uninstallPlugin(e),onSuccess:()=>{e.invalidateQueries({queryKey:p.installed}),e.invalidateQueries({queryKey:p.marketplace}),d(t(c.SETTINGS$PLUGINS_UNINSTALL_SUCCESS))},onError:e=>{l(u(e)||t(c.ERROR$GENERIC))}})}function q(){let e=i(),{t}=s(`openhands`);return a({mutationFn:e=>S.refreshPlugin(e),onSuccess:()=>{e.invalidateQueries({queryKey:p.installed}),d(t(c.SETTINGS$PLUGINS_REFRESH_SUCCESS))},onError:e=>{l(u(e)||t(c.ERROR$GENERIC))}})}var J=r(function(){let{t:e}=s(`openhands`),{backend:t}=f(),n=t.kind===`local`,{data:r,isLoading:i}=k(),{data:a,isLoading:o}=U(),{data:l,isLoading:u}=W(),d=R(),p=G(),m=K(),h=q(),[_,v]=M.useState(``),[b,x]=M.useState(`all`),[S,C]=M.useState(null),[w,T]=M.useState(!1),E=M.useMemo(()=>B(r,a,l),[r,a,l]),D=M.useMemo(()=>E.filter(e=>H(e,b)&&V(e,_)),[E,b,_]),O=S?E.find(e=>e.name===S)??null:null,F=i||o||u,J=(p.isPending?p.variables?.name:void 0)??(m.isPending?m.variables:void 0)??(h.isPending?h.variables:void 0)??null,Y=e=>J===e.name||d.isPending&&d.variables?.source===e.source,X=e=>{e.source&&d.mutate({source:e.source,ref:e.ref,repo_path:e.repoPath})},Z=(e,t)=>{p.mutate({name:e.name,enabled:t})},Q=e=>{m.mutate(e.name,{onSuccess:()=>C(null)})},$=e=>{h.mutate(e.name)};return(0,N.jsxs)(`div`,{"data-testid":`skills-plugins-screen`,className:`flex h-full gap-4 md:gap-6 md:pl-8 lg:gap-10 lg:pl-10`,children:[(0,N.jsx)(A,{}),(0,N.jsx)(`main`,{className:g(j,`h-full`),children:(0,N.jsxs)(`div`,{className:`mx-auto flex w-full min-w-0 max-w-[800px] flex-col gap-6`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-4`,children:[(0,N.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,N.jsx)(`h2`,{className:`text-xl font-semibold leading-6 text-foreground`,children:e(c.SETTINGS$PLUGINS_TITLE)}),(0,N.jsx)(`div`,{"data-testid":`plugins-settings-description`,className:`max-w-2xl text-sm text-tertiary-light`,children:e(c.SETTINGS$PLUGINS_PAGE_DESCRIPTION)})]}),(0,N.jsx)(y,{type:`button`,variant:`secondary`,testId:`plugins-add-plugin-button`,isDisabled:!n,className:`flex-shrink-0 whitespace-nowrap`,onClick:()=>T(!0),children:e(c.SETTINGS$PLUGINS_ADD_BUTTON)})]}),F&&(0,N.jsx)(`div`,{className:`flex flex-col gap-4`,children:[1,2,3].map(e=>(0,N.jsx)(`div`,{className:`h-24 rounded-2xl bg-tertiary animate-pulse`},e))}),!F&&E.length===0&&(0,N.jsx)(`div`,{"data-testid":`plugins-empty`,className:`rounded-xl border border-[var(--oh-border)] p-8 text-center`,children:(0,N.jsx)(`p`,{className:`text-sm text-tertiary-light`,children:e(c.SETTINGS$PLUGINS_NO_PLUGINS)})}),!F&&E.length>0&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(I,{search:_,onSearchChange:v,statusFilter:b,onStatusFilterChange:x}),D.length===0?(0,N.jsx)(`div`,{"data-testid":`plugins-no-match`,className:`rounded-xl border border-[var(--oh-border)] p-8 text-center`,children:(0,N.jsx)(`p`,{className:`text-sm text-tertiary-light`,children:e(c.SETTINGS$PLUGINS_NO_MATCH)})}):(0,N.jsx)(`section`,{className:g(`flex min-w-0 flex-col gap-3`,`@container min-w-0 w-full`),children:(0,N.jsx)(`div`,{className:`grid min-w-0 grid-cols-1 gap-3 @min-[600px]:grid-cols-2`,children:D.map(e=>(0,N.jsx)(P,{plugin:e,isBusy:Y(e),isDisabled:!n,onOpen:()=>C(e.name),onInstall:()=>X(e),onToggle:t=>Z(e,t)},e.name))})})]}),O&&(0,N.jsx)(L,{plugin:O,isBusy:Y(O),isDisabled:!n,onToggle:e=>Z(O,e),onInstall:()=>X(O),onUninstall:()=>Q(O),onRefresh:()=>$(O),onClose:()=>C(null)}),w&&(0,N.jsx)(z,{onClose:()=>T(!1)})]})})]})});export{J as default};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{L as r}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{n as i}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~epa72zsm-B4rXs7Zd.js";import{t as a}from"./useMutation-DrCAVg5w.js";import{t as o}from"./useQuery-CRBP8vIS.js";import{t as s}from"./useTranslation-CDRCKC9-.js";import{t as c}from"./declaration-gq8V5eTU.js";import{A as l,P as u,j as d,n as f,u as p}from"./active-backend-context-hxq31W25.js";import{t as m}from"./search-4DHskuhE.js";import{t as h}from"./x-Cb0WAtak.js";import{t as g}from"./utils-D3U3rlqr.js";import{t as _}from"./modal-backdrop-zVwfOJZr.js";import{n as v}from"./modal-classes-Cf-4tbHz.js";import{t as y}from"./brand-button-vMVuyDXu.js";import{t as b}from"./modal-close-button-B6CfxxJj.js";import{t as x}from"./settings-input-bD6npsDm.js";import{t as S}from"./plugins-management-service-BRBLxvUl.js";import{a as C,i as w,r as T}from"./extension-module-card-classes-9V3J9J_b.js";import{t as E}from"./settings-switch-5cuxl8Dc.js";import{n as D}from"./circle-plus-check-toggle-C5YxjxvI.js";import{n as O,t as k}from"./use-plugins-marketplace-FHlbeQ4c.js";import{n as A}from"./extensions-navigation-B5MeUiMq.js";import{n as j}from"./settings-like-page-layout-classes-DENKlZpD.js";var M=e(t(),1),N=n();function P({plugin:e,isBusy:t=!1,isDisabled:n=!1,onOpen:r,onInstall:i,onToggle:a}){let{t:o}=s(`openhands`);return(0,N.jsxs)(`div`,{"data-testid":`plugin-card-${e.name}`,role:`button`,tabIndex:0,onClick:r,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r())},className:g(`flex min-w-0 flex-col gap-3 overflow-hidden p-4`,C,T),children:[(0,N.jsxs)(`header`,{className:`flex items-start justify-between gap-3`,children:[(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsx)(`h3`,{"data-testid":`plugin-name-${e.name}`,className:`truncate text-sm font-semibold text-white`,children:e.name}),e.source?(0,N.jsx)(`p`,{"data-testid":`plugin-source-${e.name}`,className:`mt-0.5 min-w-0 truncate text-xs text-tertiary-alt`,title:e.source,children:e.source}):null]}),e.installed?(0,N.jsx)(D,{testId:`plugin-toggle-${e.name}`,isSelected:e.enabled,isDisabled:n||t,onToggle:a,disableTooltipKey:c.COMMON$DISABLE}):e.isLocal?(0,N.jsx)(`span`,{"data-testid":`plugin-local-badge-${e.name}`,className:g(w,`flex-shrink-0`),children:o(c.SETTINGS$PLUGINS_FILTER_LOCAL)}):(0,N.jsx)(y,{type:`button`,variant:`secondary`,testId:`plugin-install-${e.name}`,isDisabled:n||t,className:`flex-shrink-0 whitespace-nowrap`,onClick:e=>{e?.stopPropagation(),i()},children:o(t?c.SETTINGS$PLUGINS_INSTALLING:c.SETTINGS$PLUGINS_INSTALL)})]}),e.description?(0,N.jsx)(`p`,{"data-testid":`plugin-description-${e.name}`,className:`line-clamp-2 break-words text-xs leading-relaxed text-tertiary-light`,children:e.description}):null,(e.installed||e.isLocal)&&e.version?(0,N.jsx)(`span`,{"data-testid":`plugin-version-${e.name}`,className:g(w,`self-start`),children:o(c.SETTINGS$SKILLS_VERSION,{version:e.version})}):null]})}var F=[{value:`all`,labelKey:c.SETTINGS$PLUGINS_FILTER_ALL},{value:`installed`,labelKey:c.SETTINGS$PLUGINS_FILTER_INSTALLED},{value:`available`,labelKey:c.SETTINGS$PLUGINS_FILTER_AVAILABLE},{value:`local`,labelKey:c.SETTINGS$PLUGINS_FILTER_LOCAL}];function I({search:e,onSearchChange:t,statusFilter:n,onStatusFilterChange:r}){let{t:i}=s(`openhands`);return(0,N.jsxs)(`div`,{"data-testid":`plugins-toolbar`,className:`flex items-stretch gap-2`,children:[(0,N.jsxs)(`div`,{className:g(`relative flex flex-1 min-w-0 items-center`,`rounded-lg border border-[var(--oh-border)] bg-base-secondary`,`focus-within:border-white/40 focus-within:ring-1 focus-within:ring-white/20`,`transition-colors`),children:[(0,N.jsx)(m,{className:`ml-3 h-4 w-4 shrink-0 text-tertiary-alt`,"aria-hidden":!0}),(0,N.jsx)(`input`,{"data-testid":`plugins-search-input`,type:`search`,value:e,onChange:e=>t(e.target.value),placeholder:i(c.SETTINGS$PLUGINS_SEARCH_PLACEHOLDER),"aria-label":i(c.SETTINGS$PLUGINS_SEARCH_PLACEHOLDER),className:g(`flex-1 min-w-0 bg-transparent border-0 outline-none`,`px-3 py-2 text-sm placeholder:text-tertiary-alt`,`[&::-webkit-search-cancel-button]:hidden`)}),e?(0,N.jsx)(`button`,{type:`button`,onClick:()=>t(``),"aria-label":i(c.MCP$SEARCH_CLEAR),className:`mr-2 p-1 rounded text-tertiary-alt hover:text-white cursor-pointer`,children:(0,N.jsx)(h,{className:`h-4 w-4`,"aria-hidden":!0})}):null]}),(0,N.jsx)(`div`,{"data-testid":`plugins-status-filter`,className:`flex shrink-0 items-center gap-1 rounded-lg border border-[var(--oh-border)] bg-base-secondary p-1`,children:F.map(e=>(0,N.jsx)(`button`,{type:`button`,"data-testid":`plugins-filter-${e.value}`,"aria-pressed":n===e.value,onClick:()=>r(e.value),className:g(`cursor-pointer rounded-md px-3 py-1 text-xs transition-colors`,n===e.value?`bg-surface-raised text-white`:`text-tertiary-alt hover:text-white`),children:i(e.labelKey)},e.value))})]})}function L({plugin:e,isBusy:t=!1,isDisabled:n=!1,onToggle:r,onInstall:i,onUninstall:a,onRefresh:o,onClose:l}){let{t:u}=s(`openhands`),d=n||t;return(0,N.jsx)(_,{onClose:l,"aria-label":e.name,children:(0,N.jsxs)(`div`,{"data-testid":`plugin-detail-modal`,"data-plugin-name":e.name,className:`relative flex w-[520px] max-w-[90vw] max-h-[85vh] flex-col rounded-xl border border-[var(--oh-border)] bg-base-secondary`,children:[(0,N.jsx)(b,{onClose:l,testId:`plugin-detail-modal-close`}),(0,N.jsxs)(`header`,{className:`flex-shrink-0 px-6 pb-4 pt-6`,children:[(0,N.jsx)(`h2`,{className:g(`pr-6`,v),children:e.name}),e.source?(0,N.jsx)(`p`,{className:`mt-1 break-all text-xs text-tertiary-alt`,children:e.source}):null]}),(0,N.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-6 custom-scrollbar`,children:[e.description?(0,N.jsx)(`p`,{className:`text-sm leading-relaxed text-tertiary-light`,children:e.description}):null,(0,N.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.isLocal?(0,N.jsx)(`span`,{className:w,children:u(c.SETTINGS$PLUGINS_FILTER_LOCAL)}):null,e.version?(0,N.jsx)(`span`,{className:w,children:u(c.SETTINGS$SKILLS_VERSION,{version:e.version})}):null,e.ref?(0,N.jsxs)(`span`,{className:w,children:[u(c.SETTINGS$PLUGINS_REF_LABEL),` `,e.ref]}):null,e.repoPath?(0,N.jsxs)(`span`,{className:w,children:[u(c.SETTINGS$PLUGINS_REPO_PATH_LABEL),` `,e.repoPath]}):null]}),e.installed?(0,N.jsx)(E,{testId:`plugin-modal-toggle-${e.name}`,isToggled:e.enabled,onToggle:r,isDisabled:d,togglePosition:`right`,children:u(e.enabled?c.SETTINGS$SKILLS_ENABLED:c.SETTINGS$SKILLS_DISABLED)}):null]}),(0,N.jsxs)(`footer`,{className:`flex flex-shrink-0 flex-wrap justify-end gap-2 px-6 pb-6 pt-4`,children:[e.installed?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(y,{type:`button`,variant:`secondary`,testId:`plugin-detail-refresh-${e.name}`,isDisabled:d,onClick:o,children:u(c.SETTINGS$PLUGINS_REFRESH)}),(0,N.jsx)(y,{type:`button`,variant:`secondary`,testId:`plugin-detail-uninstall-${e.name}`,isDisabled:d,onClick:a,children:u(c.SETTINGS$PLUGINS_UNINSTALL)})]}):e.isLocal?null:(0,N.jsx)(y,{type:`button`,variant:`primary`,testId:`plugin-detail-install-${e.name}`,isDisabled:d,onClick:i,children:u(t?c.SETTINGS$PLUGINS_INSTALLING:c.SETTINGS$PLUGINS_INSTALL)}),(0,N.jsx)(y,{type:`button`,variant:`secondary`,testId:`plugin-detail-modal-dismiss`,onClick:l,children:u(c.BUTTON$CLOSE)})]})]})})}function R(){let e=i(),{t}=s(`openhands`);return a({mutationFn:e=>S.installPlugin(e),onSuccess:()=>{e.invalidateQueries({queryKey:p.installed}),e.invalidateQueries({queryKey:p.marketplace}),d(t(c.SETTINGS$PLUGINS_INSTALL_SUCCESS))},onError:e=>{l(u(e)||t(c.ERROR$GENERIC))}})}function z({onClose:e,onInstalled:t}){let{t:n}=s(`openhands`),r=R(),[i,a]=M.useState(``),[o,l]=M.useState(``),[u,d]=M.useState(``),f=i.trim(),p=f.length>0&&!r.isPending;return(0,N.jsx)(_,{onClose:e,"aria-label":n(c.SETTINGS$PLUGINS_ADD_MODAL_TITLE),children:(0,N.jsxs)(`form`,{onSubmit:n=>{n.preventDefault(),p&&r.mutate({source:f,ref:o.trim()||null,repo_path:u.trim()||null},{onSuccess:()=>{t?.(),e()}})},"data-testid":`add-plugin-modal`,className:`relative flex w-[520px] max-w-[90vw] max-h-[85vh] flex-col rounded-xl border border-[var(--oh-border)] bg-base-secondary`,children:[(0,N.jsx)(b,{onClose:e,testId:`add-plugin-modal-close`}),(0,N.jsxs)(`header`,{className:`flex-shrink-0 px-6 pb-4 pt-6`,children:[(0,N.jsx)(`h2`,{className:g(`pr-6`,v),children:n(c.SETTINGS$PLUGINS_ADD_MODAL_TITLE)}),(0,N.jsx)(`p`,{className:`mt-4 text-sm text-tertiary-light`,children:n(c.SETTINGS$PLUGINS_ADD_MODAL_INTRO)})]}),(0,N.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-6 custom-scrollbar`,children:[(0,N.jsx)(x,{testId:`add-plugin-source-input`,label:n(c.SETTINGS$PLUGINS_SOURCE_LABEL),type:`text`,value:i,onChange:a,placeholder:n(c.SETTINGS$PLUGINS_SOURCE_PLACEHOLDER),showRequiredTag:!0}),(0,N.jsx)(x,{testId:`add-plugin-ref-input`,label:n(c.SETTINGS$PLUGINS_REF_LABEL),type:`text`,value:o,onChange:l,showOptionalTag:!0}),(0,N.jsx)(x,{testId:`add-plugin-repo-path-input`,label:n(c.SETTINGS$PLUGINS_REPO_PATH_LABEL),type:`text`,value:u,onChange:d,showOptionalTag:!0})]}),(0,N.jsxs)(`footer`,{className:`flex flex-shrink-0 justify-end gap-2 px-6 pb-6 pt-4`,children:[(0,N.jsx)(y,{type:`button`,variant:`secondary`,onClick:e,testId:`add-plugin-modal-dismiss`,children:n(c.BUTTON$CLOSE)}),(0,N.jsx)(y,{type:`submit`,variant:`primary`,testId:`add-plugin-submit`,isDisabled:!p,children:n(r.isPending?c.SETTINGS$PLUGINS_INSTALLING:c.SETTINGS$PLUGINS_INSTALL)})]})]})})}function B(e,t,n=void 0){let r=new Map;for(let t of e??[])r.set(t.name,{name:t.name,description:t.description,source:t.source,ref:t.ref??null,repoPath:t.repo_path??null,installed:t.installed,enabled:!1,version:null,inCatalog:!0,isLocal:!1});for(let e of t??[]){let t=r.get(e.name);r.set(e.name,{name:e.name,description:t?.description??e.description??null,source:e.source??t?.source??null,ref:e.resolved_ref??t?.ref??null,repoPath:e.repo_path??t?.repoPath??null,installed:!0,enabled:e.enabled,version:e.version??null,inCatalog:t?.inCatalog??!1,isLocal:!1})}for(let e of n??[])r.has(e.name)||r.set(e.name,{name:e.name,description:e.description||null,source:null,ref:null,repoPath:null,installed:!1,enabled:!1,version:e.version||null,inCatalog:!1,isLocal:!0});let i=e=>e.installed?0:e.isLocal?1:2;return Array.from(r.values()).sort((e,t)=>{let n=i(e)-i(t);return n===0?e.name.localeCompare(t.name):n})}function V(e,t){let n=t.trim().toLowerCase();return n?[e.name,e.description??``,e.source??``,e.repoPath??``,e.ref??``].some(e=>e.toLowerCase().includes(n)):!0}function H(e,t){return t===`installed`?e.installed:t===`available`?!e.installed&&!e.isLocal:t===`local`?e.isLocal:!0}var U=()=>o({queryKey:p.installed,queryFn:()=>S.listInstalledPlugins(),staleTime:1e3*60*10,refetchOnWindowFocus:!1}),W=()=>o({queryKey:p.local,queryFn:()=>O.getLocalPlugins(),staleTime:1e3*60*10,refetchOnWindowFocus:!1});function G(){let e=i(),{t}=s(`openhands`);return a({mutationFn:({name:e,enabled:t})=>S.setPluginEnabled(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:p.installed})},onError:e=>{l(u(e)||t(c.ERROR$GENERIC))}})}function K(){let e=i(),{t}=s(`openhands`);return a({mutationFn:e=>S.uninstallPlugin(e),onSuccess:()=>{e.invalidateQueries({queryKey:p.installed}),e.invalidateQueries({queryKey:p.marketplace}),d(t(c.SETTINGS$PLUGINS_UNINSTALL_SUCCESS))},onError:e=>{l(u(e)||t(c.ERROR$GENERIC))}})}function q(){let e=i(),{t}=s(`openhands`);return a({mutationFn:e=>S.refreshPlugin(e),onSuccess:()=>{e.invalidateQueries({queryKey:p.installed}),d(t(c.SETTINGS$PLUGINS_REFRESH_SUCCESS))},onError:e=>{l(u(e)||t(c.ERROR$GENERIC))}})}var J=r(function(){let{t:e}=s(`openhands`),{backend:t}=f(),n=t.kind===`local`,{data:r,isLoading:i}=k(),{data:a,isLoading:o}=U(),{data:l,isLoading:u}=W(),d=R(),p=G(),m=K(),h=q(),[_,v]=M.useState(``),[b,x]=M.useState(`all`),[S,C]=M.useState(null),[w,T]=M.useState(!1),E=M.useMemo(()=>B(r,a,l),[r,a,l]),D=M.useMemo(()=>E.filter(e=>H(e,b)&&V(e,_)),[E,b,_]),O=S?E.find(e=>e.name===S)??null:null,F=i||o||u,J=(p.isPending?p.variables?.name:void 0)??(m.isPending?m.variables:void 0)??(h.isPending?h.variables:void 0)??null,Y=e=>J===e.name||d.isPending&&d.variables?.source===e.source,X=e=>{e.source&&d.mutate({source:e.source,ref:e.ref,repo_path:e.repoPath})},Z=(e,t)=>{p.mutate({name:e.name,enabled:t})},Q=e=>{m.mutate(e.name,{onSuccess:()=>C(null)})},$=e=>{h.mutate(e.name)};return(0,N.jsxs)(`div`,{"data-testid":`skills-plugins-screen`,className:`flex h-full gap-4 md:gap-6 md:pl-8 lg:gap-10 lg:pl-10`,children:[(0,N.jsx)(A,{}),(0,N.jsx)(`main`,{className:g(j,`h-full`),children:(0,N.jsxs)(`div`,{className:`mx-auto flex w-full min-w-0 max-w-[800px] flex-col gap-6`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-4`,children:[(0,N.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,N.jsx)(`h2`,{className:`text-xl font-semibold leading-6 text-foreground`,children:e(c.SETTINGS$PLUGINS_TITLE)}),(0,N.jsx)(`div`,{"data-testid":`plugins-settings-description`,className:`max-w-2xl text-sm text-tertiary-light`,children:e(c.SETTINGS$PLUGINS_PAGE_DESCRIPTION)})]}),(0,N.jsx)(y,{type:`button`,variant:`secondary`,testId:`plugins-add-plugin-button`,isDisabled:!n,className:`flex-shrink-0 whitespace-nowrap`,onClick:()=>T(!0),children:e(c.SETTINGS$PLUGINS_ADD_BUTTON)})]}),F&&(0,N.jsx)(`div`,{className:`flex flex-col gap-4`,children:[1,2,3].map(e=>(0,N.jsx)(`div`,{className:`h-24 rounded-2xl bg-tertiary animate-pulse`},e))}),!F&&E.length===0&&(0,N.jsx)(`div`,{"data-testid":`plugins-empty`,className:`rounded-xl border border-[var(--oh-border)] p-8 text-center`,children:(0,N.jsx)(`p`,{className:`text-sm text-tertiary-light`,children:e(c.SETTINGS$PLUGINS_NO_PLUGINS)})}),!F&&E.length>0&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(I,{search:_,onSearchChange:v,statusFilter:b,onStatusFilterChange:x}),D.length===0?(0,N.jsx)(`div`,{"data-testid":`plugins-no-match`,className:`rounded-xl border border-[var(--oh-border)] p-8 text-center`,children:(0,N.jsx)(`p`,{className:`text-sm text-tertiary-light`,children:e(c.SETTINGS$PLUGINS_NO_MATCH)})}):(0,N.jsx)(`section`,{className:g(`flex min-w-0 flex-col gap-3`,`@container min-w-0 w-full`),children:(0,N.jsx)(`div`,{className:`grid min-w-0 grid-cols-1 gap-3 @min-[600px]:grid-cols-2`,children:D.map(e=>(0,N.jsx)(P,{plugin:e,isBusy:Y(e),isDisabled:!n,onOpen:()=>C(e.name),onInstall:()=>X(e),onToggle:t=>Z(e,t)},e.name))})})]}),O&&(0,N.jsx)(L,{plugin:O,isBusy:Y(O),isDisabled:!n,onToggle:e=>Z(O,e),onInstall:()=>X(O),onUninstall:()=>Q(O),onRefresh:()=>$(O),onClose:()=>C(null)}),w&&(0,N.jsx)(z,{onClose:()=>T(!1)})]})})]})});export{J as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{L as r}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{t as i}from"./Trans-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{L as r}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{t as i}from"./Trans-Ch-OVWEA.js";import{t as a}from"./useTranslation-CDRCKC9-.js";import{t as o}from"./declaration-gq8V5eTU.js";import{A as s,P as c}from"./active-backend-context-hxq31W25.js";import{t as l}from"./search-4DHskuhE.js";import{t as u}from"./x-Cb0WAtak.js";import{t as d}from"./utils-D3U3rlqr.js";import{t as f}from"./modal-backdrop-zVwfOJZr.js";import{n as p}from"./modal-classes-Cf-4tbHz.js";import{t as m}from"./brand-button-vMVuyDXu.js";import{t as h}from"./modal-close-button-B6CfxxJj.js";import{r as g}from"./use-settings-CH5LzXD8.js";import{t as _}from"./skills-9cDZONKh.js";import{t as v}from"./use-save-settings-BGlSfuYn.js";import{t as y}from"./checkmark-h7udgXMM.js";import{t as b}from"./copy-BLmGeJcd.js";import{a as x,r as S}from"./extension-module-card-classes-9V3J9J_b.js";import{t as C}from"./settings-switch-5cuxl8Dc.js";import{n as w,t as T}from"./skill-card-pill-row-eTIkE4nz.js";import{n as E}from"./circle-plus-check-toggle-C5YxjxvI.js";import{t as D}from"./use-skills-CSzSL6HG.js";import{n as O}from"./extensions-navigation-B5MeUiMq.js";import{n as k,t as A}from"./use-launch-skill-in-chat-BnoDgvAy.js";import{t as j}from"./enum-filter-dropdown-DXbVwiNZ.js";import{n as ee}from"./settings-like-page-layout-classes-DENKlZpD.js";var M=e(t(),1),N=n();function P({skillName:e,className:t}){return(0,N.jsx)(`span`,{"aria-hidden":`true`,title:e,"data-testid":`skill-icon-${e}`,className:d(`inline-flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden`,`rounded-lg border border-white/10 bg-surface-raised text-white`,`shadow-[inset_0_1px_0_rgba(255,255,255,0.18)]`,`[&>svg]:h-5 [&>svg]:w-5`,t),children:(0,N.jsx)(_,{})})}var F=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/;function te(e){let t=e.match(/^description:\s*\|\s*\r?\n((?:[ \t].*(?:\r?\n|$))+)/m);if(t)return t[1].replace(/^[ \t]+/gm,``).trim();let n=e.match(/^description:\s*['"](.+?)['"]\s*$/m);if(n)return n[1].trim();let r=e.match(/^description:\s*(.+)\s*$/m);return r?r[1].trim():null}function ne(e){let t=e.match(F);return t?e.slice(t[0].length).trim():e.trim()}function re(e){let t=e.replace(/^#+\s+[^\n]+\n+/,``).trim();return t.split(/\n\s*\n/).map(e=>e.replace(/\s+/g,` `).trim()).find(e=>e.length>0)??t.replace(/\s+/g,` `).trim()}function I(e){let t=e.description?.trim();if(t)return t;let n=e.content?.trim();if(!n)return``;let r=n.match(F);if(r){let e=te(r[1]);if(e)return e}return re(ne(n))}var L=`inline-flex shrink-0 items-center whitespace-nowrap rounded-full border border-text-secondary/35 bg-text-secondary/12 px-2 py-0.5 text-[11px] font-medium leading-4 text-tertiary-light`,R={agentskills:{labelKey:o.SETTINGS$SKILLS_TYPE_AGENTSKILLS},knowledge:{labelKey:o.SETTINGS$SKILLS_TYPE_KNOWLEDGE},repo:{labelKey:o.SETTINGS$SKILLS_TYPE_REPO}};function z({type:e}){let{t}=a(`openhands`),n=R[e];return(0,N.jsx)(`span`,{"data-testid":`skill-type-badge-${e}`,className:L,children:t(n.labelKey)})}function B(e,t,n){if(e)return`${e}-${t}-${n}`}function V(e,t,n={}){let{variant:r=`card`,testIdPrefix:i}=n,a=[{id:`type-${e.type}`,node:(0,N.jsx)(z,{type:e.type})}];if(e.version&&a.push({id:`version-${e.version}`,node:(0,N.jsx)(`span`,{"data-testid":B(i,e.name,`version`)??`skill-version-${e.name}`,className:T,children:t(o.SETTINGS$SKILLS_VERSION,{version:e.version})})}),r===`detail`&&e.license&&a.push({id:`license-${e.license}`,node:(0,N.jsx)(`span`,{"data-testid":B(i,e.name,`license`),className:T,children:e.license})}),r===`detail`&&e.compatibility&&a.push({id:`compatibility-${e.compatibility}`,node:(0,N.jsx)(`span`,{"data-testid":B(i,e.name,`compatibility`),className:T,children:e.compatibility})}),e.disable_model_invocation&&a.push({id:`disable-model-invocation`,node:(0,N.jsxs)(`span`,{"data-testid":B(i,e.name,`disable-model-invocation`)??`skill-disable-model-invocation-${e.name}`,className:`inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded-full border border-[rgba(248,113,113,0.35)] bg-[rgba(248,113,113,0.12)] px-2 py-0.5 text-[11px] font-medium leading-4 text-[#fca5a5]`,children:[(0,N.jsx)(`span`,{className:`size-1.5 rounded-full bg-[#fca5a5]`}),t(o.SETTINGS$SKILLS_DISABLE_MODEL_INVOCATION)]})}),r===`detail`&&e.allowed_tools)for(let t of e.allowed_tools)a.push({id:`allowed-tool-${t}`,node:(0,N.jsx)(`span`,{"data-testid":B(i,e.name,`tool-${t}`),className:d(T,`font-mono`),children:t})});if(r===`detail`&&e.metadata)for(let[t,n]of Object.entries(e.metadata))a.push({id:`metadata-${t}`,node:(0,N.jsxs)(`span`,{"data-testid":B(i,e.name,`metadata-${t}`),className:T,children:[(0,N.jsxs)(`span`,{className:`font-mono text-[10px] text-tertiary-light`,children:[t,`:`]}),` `,n]})});for(let t of e.triggers??[])a.push({id:`trigger-${t}`,node:(0,N.jsx)(`span`,{"data-testid":B(i,e.name,`trigger-${t}`),className:T,children:t})});return a}function H(e){let t=e?.trim();return t?!!(/^https?:\/\//i.test(t)||t.startsWith(`/`)||t.startsWith(`./`)||t.startsWith(`../`)||t.startsWith(`~`)||/^[A-Za-z]:[\\/]/.test(t)||t.includes(`/`)||t.includes(`\\`)):!1}function U({skill:e,enabled:t,onOpen:n,onToggle:r}){let{t:i}=a(`openhands`),[s,c]=M.useState(!1),l=I(e),u=M.useMemo(()=>V(e,i),[e,i]),f=H(e.source);return M.useEffect(()=>{if(!s)return;let e=setTimeout(()=>c(!1),2e3);return()=>clearTimeout(e)},[s]),(0,N.jsx)(`div`,{"data-testid":`skill-card-${e.name}`,role:`button`,tabIndex:0,onClick:n,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},className:d(`flex min-w-0 flex-col gap-3 overflow-hidden p-4`,x,S),children:(0,N.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,N.jsx)(P,{skillName:e.name}),(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3`,children:[(0,N.jsxs)(`header`,{className:`flex items-start justify-between gap-3`,children:[(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsx)(`h3`,{"data-testid":`skill-name-${e.name}`,className:`truncate text-sm font-semibold text-white`,children:e.name}),e.source?(0,N.jsxs)(`div`,{className:`mt-0.5 flex min-w-0 items-center gap-1`,children:[(0,N.jsx)(`p`,{"data-testid":`skill-source-${e.name}`,className:`min-w-0 flex-1 truncate text-xs text-tertiary-alt`,title:e.source,children:e.source}),f?(0,N.jsx)(`button`,{type:`button`,"data-testid":`skill-copy-source-${e.name}`,"aria-label":i(s?o.BUTTON$COPIED:o.SETTINGS$SKILLS_COPY_PATH),disabled:s,onClick:async t=>{t.stopPropagation(),e.source&&(await navigator.clipboard.writeText(e.source),c(!0))},className:`shrink-0 cursor-pointer border-0 bg-transparent p-0.5 text-tertiary-alt hover:text-white disabled:cursor-default [&_path]:fill-current`,children:s?(0,N.jsx)(y,{width:12,height:12}):(0,N.jsx)(b,{width:12,height:12})}):null]}):null]}),(0,N.jsx)(E,{testId:`skill-toggle-${e.name}`,isSelected:t,onToggle:r,disableTooltipKey:o.COMMON$DISABLE})]}),l?(0,N.jsx)(`div`,{"data-testid":`skill-description-${e.name}`,className:`min-w-0`,children:(0,N.jsx)(`p`,{className:`line-clamp-2 break-words text-xs leading-relaxed text-tertiary-light`,children:l})}):null,u.length>0?(0,N.jsx)(w,{pills:u,testId:`skill-triggers-${e.name}`}):null]})]})})}var W=`https://docs.openhands.dev/overview/skills/adding#adding-new-skills`,G=`/add-skill https://github.com/OpenHands/extensions/tree/main/skills/codereview`;function K(e){return e.name===`add-skill`?G:`/${e.name} `}function q({testId:e,label:t,value:n}){return(0,N.jsxs)(`label`,{className:`flex min-w-0 w-full flex-col gap-2.5`,children:[(0,N.jsx)(`span`,{className:`text-sm`,children:t}),(0,N.jsx)(`textarea`,{"data-testid":e,readOnly:!0,value:n,rows:Math.min(12,Math.max(4,n.split(`
|
|
2
2
|
`).length)),className:d(`bg-[var(--oh-surface-raised)] border border-[var(--oh-border-subtle)] w-full min-w-0 rounded-sm p-2 text-sm`,`cursor-not-allowed resize-none custom-scrollbar`)})]})}function J({skill:e,enabled:t,onToggle:n,onClose:r}){let{t:i}=a(`openhands`),s=A(),[c,l]=M.useState(!1),u=M.useMemo(()=>K(e),[e]),d=I(e),g=M.useMemo(()=>V(e,i,{variant:`detail`,testIdPrefix:`skill-modal-pill`}),[e,i]),_=H(e.source);return M.useEffect(()=>{if(!c)return;let e=setTimeout(()=>l(!1),2e3);return()=>clearTimeout(e)},[c]),(0,N.jsx)(f,{onClose:r,"aria-label":e.name,children:(0,N.jsxs)(`div`,{"data-testid":`skill-detail-modal`,"data-skill-name":e.name,className:`relative bg-base-secondary p-6 rounded-xl flex flex-col gap-4 border border-[var(--oh-border)] w-[520px] max-w-[90vw] max-h-[85vh] overflow-y-auto custom-scrollbar`,children:[(0,N.jsx)(h,{onClose:r,testId:`skill-detail-modal-close`}),(0,N.jsxs)(`div`,{className:`flex items-start gap-3 pr-6`,children:[(0,N.jsx)(P,{skillName:e.name}),(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsx)(`h2`,{"data-testid":`skill-modal-name-${e.name}`,className:p,children:e.name}),e.source?(0,N.jsxs)(`div`,{className:`mt-0.5 flex min-w-0 items-center gap-1`,children:[(0,N.jsx)(`p`,{"data-testid":`skill-modal-source-${e.name}`,className:`min-w-0 flex-1 truncate text-xs text-tertiary-alt`,title:e.source,children:e.source}),_?(0,N.jsx)(`button`,{type:`button`,"data-testid":`skill-modal-copy-source-${e.name}`,"aria-label":i(c?o.BUTTON$COPIED:o.SETTINGS$SKILLS_COPY_PATH),disabled:c,onClick:async()=>{e.source&&(await navigator.clipboard.writeText(e.source),l(!0))},className:`shrink-0 cursor-pointer border-0 bg-transparent p-0.5 text-tertiary-alt hover:text-white disabled:cursor-default [&_path]:fill-current`,children:c?(0,N.jsx)(y,{width:12,height:12}):(0,N.jsx)(b,{width:12,height:12})}):null]}):null]})]}),(0,N.jsx)(`div`,{"data-testid":`skill-modal-enable-row-${e.name}`,className:`flex w-full items-center rounded-lg border border-[var(--oh-border)] bg-[rgba(255,255,255,0.04)] px-3 py-2.5`,children:(0,N.jsx)(C,{testId:`skill-modal-toggle-${e.name}`,isToggled:t,onToggle:n,togglePosition:`right`,children:i(t?o.SETTINGS$SKILLS_ENABLED:o.SETTINGS$SKILLS_DISABLED)})}),d?(0,N.jsx)(`p`,{"data-testid":`skill-modal-description-${e.name}`,className:`text-xs text-tertiary-light`,children:d}):null,g.length>0?(0,N.jsx)(w,{pills:g,testId:`skill-modal-pills-${e.name}`}):null,e.content?(0,N.jsx)(q,{testId:`skill-modal-field-content-${e.name}`,label:i(o.SETTINGS$SKILLS_CONTENT),value:e.content}):null,(0,N.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,N.jsx)(m,{type:`button`,variant:`secondary`,onClick:r,testId:`skill-detail-close`,children:i(o.BUTTON$CLOSE)}),(0,N.jsx)(m,{type:`button`,variant:`primary`,isDisabled:!t,onClick:()=>s(u,r),testId:`skill-detail-use-skill-${e.name}`,startContent:(0,N.jsx)(k,{className:`size-4`,"aria-hidden":!0}),children:i(o.SETTINGS$SKILLS_USE_SKILL_BUTTON)})]})]})})}var Y=[o.SETTINGS$SKILLS_ADD_MODAL_STEP_1,o.SETTINGS$SKILLS_ADD_MODAL_STEP_2,o.SETTINGS$SKILLS_ADD_MODAL_STEP_3,o.SETTINGS$SKILLS_ADD_MODAL_STEP_4,o.SETTINGS$SKILLS_ADD_MODAL_STEP_5],X={cmd:(0,N.jsx)(Z,{}),path:(0,N.jsx)(Z,{}),env:(0,N.jsx)(Z,{})};function Z({children:e}){return(0,N.jsx)(`code`,{className:d(`mx-0.5 inline-block rounded-sm border border-[var(--oh-border-subtle)]`,`bg-[var(--oh-surface-raised)] px-1.5 py-0.5 align-baseline font-mono text-[11px] text-white`),children:e})}function ie(){let{t:e}=a(`openhands`),[t,n]=M.useState(!1);return M.useEffect(()=>{if(!t)return;let e=setTimeout(()=>n(!1),2e3);return()=>clearTimeout(e)},[t]),(0,N.jsxs)(`div`,{className:`relative`,children:[(0,N.jsx)(`pre`,{"data-testid":`add-skill-modal-example`,className:d(`overflow-x-auto rounded-sm border border-[var(--oh-border-subtle)]`,`bg-[var(--oh-surface-raised)] p-2 pr-10 text-xs text-white`),children:G}),(0,N.jsx)(`button`,{type:`button`,"data-testid":`add-skill-modal-example-copy`,"aria-label":e(t?o.BUTTON$COPIED:o.BUTTON$COPY),disabled:t,onClick:async()=>{await navigator.clipboard.writeText(G),n(!0)},className:d(`absolute right-2 top-2 cursor-pointer rounded-sm border border-[var(--oh-border-subtle)]`,`bg-base-secondary p-1 text-tertiary-alt transition-colors`,`hover:bg-[var(--oh-surface)] hover:text-white disabled:cursor-default [&_path]:fill-current`),children:t?(0,N.jsx)(y,{width:14,height:14}):(0,N.jsx)(b,{width:14,height:14})})]})}function Q({i18nKey:e}){return(0,N.jsx)(`p`,{className:`text-xs leading-relaxed text-tertiary-light`,children:(0,N.jsx)(i,{ns:`openhands`,i18nKey:e,components:X})})}function ae({onClose:e}){let{t}=a(`openhands`);return(0,N.jsx)(f,{onClose:e,"aria-label":t(o.SETTINGS$SKILLS_ADD_MODAL_TITLE),children:(0,N.jsxs)(`div`,{"data-testid":`add-skill-modal`,className:`relative flex w-[520px] max-w-[90vw] max-h-[85vh] flex-col rounded-xl border border-[var(--oh-border)] bg-base-secondary`,children:[(0,N.jsx)(h,{onClose:e,testId:`add-skill-modal-close`}),(0,N.jsxs)(`header`,{className:`flex-shrink-0 px-6 pb-4 pt-6`,children:[(0,N.jsx)(`h2`,{className:d(`pr-6`,p),children:t(o.SETTINGS$SKILLS_ADD_MODAL_TITLE)}),(0,N.jsx)(`p`,{className:`mt-4 text-sm text-tertiary-light`,children:t(o.SETTINGS$SKILLS_ADD_MODAL_INTRO)})]}),(0,N.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-6 custom-scrollbar`,children:[(0,N.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,N.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:t(o.SETTINGS$SKILLS_ADD_MODAL_CHAT_TITLE)}),(0,N.jsx)(Q,{i18nKey:o.SETTINGS$SKILLS_ADD_MODAL_CHAT_BODY}),(0,N.jsx)(`p`,{className:`text-xs text-tertiary-light`,children:t(o.SETTINGS$SKILLS_ADD_MODAL_EXAMPLE_LABEL)}),(0,N.jsx)(ie,{}),(0,N.jsx)(`ol`,{className:`list-decimal space-y-1 pl-4 text-xs leading-relaxed text-tertiary-light`,children:Y.map(e=>(0,N.jsx)(`li`,{children:e===o.SETTINGS$SKILLS_ADD_MODAL_STEP_3?(0,N.jsx)(i,{ns:`openhands`,i18nKey:e,components:X}):t(e)},e))})]}),(0,N.jsxs)(`section`,{className:`flex flex-col gap-1`,children:[(0,N.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:t(o.SETTINGS$SKILLS_ADD_MODAL_URL_FORMATS_TITLE)}),(0,N.jsx)(`p`,{className:`text-xs leading-relaxed text-tertiary-light`,children:t(o.SETTINGS$SKILLS_ADD_MODAL_URL_FORMATS)})]}),(0,N.jsxs)(`section`,{className:`flex flex-col gap-1`,children:[(0,N.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:t(o.SETTINGS$SKILLS_ADD_MODAL_STORAGE_TITLE)}),(0,N.jsx)(Q,{i18nKey:o.SETTINGS$SKILLS_ADD_MODAL_STORAGE_BODY})]}),(0,N.jsx)(Q,{i18nKey:o.SETTINGS$SKILLS_ADD_MODAL_PRIVATE_REPOS}),(0,N.jsx)(`a`,{href:W,target:`_blank`,rel:`noreferrer`,"data-testid":`add-skill-modal-docs-link`,className:`self-start text-xs text-[var(--oh-muted)] transition-colors hover:text-white hover:underline`,children:t(o.SETTINGS$SKILLS_ADD_MODAL_VIEW_DOCS)})]}),(0,N.jsx)(`footer`,{className:`flex flex-shrink-0 justify-end gap-2 px-6 pb-6 pt-4`,children:(0,N.jsx)(m,{type:`button`,variant:`secondary`,onClick:e,testId:`add-skill-modal-dismiss`,children:t(o.BUTTON$CLOSE)})})]})})}var oe=[`all`,`agentskills`,`knowledge`,`repo`],$={all:o.SETTINGS$SKILLS_TYPE_ALL,agentskills:o.SETTINGS$SKILLS_TYPE_AGENTSKILLS,knowledge:o.SETTINGS$SKILLS_TYPE_KNOWLEDGE,repo:o.SETTINGS$SKILLS_TYPE_REPO};function se({value:e,onChange:t}){return(0,N.jsx)(j,{testId:`skills-type-filter`,value:e,onChange:t,options:oe,labelKeyByValue:$})}function ce({search:e,onSearchChange:t,typeFilter:n,onTypeFilterChange:r}){let{t:i}=a(`openhands`);return(0,N.jsxs)(`div`,{"data-testid":`skills-toolbar`,className:`flex items-stretch gap-2`,children:[(0,N.jsxs)(`div`,{className:d(`relative flex flex-1 min-w-0 items-center`,`rounded-lg border border-[var(--oh-border)] bg-base-secondary`,`focus-within:border-white/40 focus-within:ring-1 focus-within:ring-white/20`,`transition-colors`),children:[(0,N.jsx)(l,{className:`ml-3 h-4 w-4 shrink-0 text-tertiary-alt`,"aria-hidden":!0}),(0,N.jsx)(`input`,{"data-testid":`skills-search-input`,type:`search`,value:e,onChange:e=>t(e.target.value),placeholder:i(o.SETTINGS$SKILLS_SEARCH_PLACEHOLDER),"aria-label":i(o.SETTINGS$SKILLS_SEARCH_PLACEHOLDER),className:d(`flex-1 min-w-0 bg-transparent border-0 outline-none`,`px-3 py-2 text-sm placeholder:text-tertiary-alt`,`[&::-webkit-search-cancel-button]:hidden`)}),e?(0,N.jsx)(`button`,{type:`button`,onClick:()=>t(``),"aria-label":i(o.MCP$SEARCH_CLEAR),className:`mr-2 p-1 rounded text-tertiary-alt hover:text-white cursor-pointer`,children:(0,N.jsx)(u,{className:`h-4 w-4`,"aria-hidden":!0})}):null]}),(0,N.jsx)(se,{value:n,onChange:r})]})}function le(e,t){if(!t)return!0;let n=[e.name,I(e),e.description??``,e.content??``,e.license??``,e.compatibility??``,...e.triggers??[],...e.allowed_tools??[]],r=t.toLowerCase();return n.some(e=>e.toLowerCase().includes(r))}function ue(){let{t:e}=a(`openhands`),{mutate:t}=v(),{data:n,isLoading:r}=g(),{data:i,isLoading:l}=D(),[u,f]=M.useState(new Set),[p,h]=M.useState(!1),[_,y]=M.useState(``),[b,x]=M.useState(`all`),[S,C]=M.useState(null),[w,T]=M.useState(!1);M.useEffect(()=>{r||!n||(f(new Set(n.disabled_skills??[])),h(!0))},[r,n?.disabled_skills]);let E=(e,t)=>{f(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r})};M.useEffect(()=>{p&&t({disabled_skills:Array.from(u)},{onError:t=>{s(c(t)||e(o.ERROR$GENERIC))}})},[u,p,t,e]);let k=r||l||!n,A=M.useMemo(()=>i?i.filter(e=>(b===`all`||e.type===b)&&le(e,_)):[],[i,b,_]);return(0,N.jsxs)(`div`,{"data-testid":`skills-settings-screen`,className:`flex h-full gap-4 md:gap-6 md:pl-8 lg:gap-10 lg:pl-10`,children:[(0,N.jsx)(O,{}),(0,N.jsx)(`main`,{className:d(ee,`h-full`),children:(0,N.jsxs)(`div`,{className:`mx-auto flex w-full min-w-0 max-w-[800px] flex-col gap-6`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-4`,children:[(0,N.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,N.jsx)(`h2`,{className:`text-xl font-semibold leading-6 text-foreground`,children:e(o.SETTINGS$SKILLS_TITLE)}),(0,N.jsx)(`div`,{"data-testid":`skills-settings-description`,className:`max-w-2xl text-sm text-tertiary-light`,children:e(o.SETTINGS$SKILLS_PAGE_DESCRIPTION)})]}),(0,N.jsx)(m,{type:`button`,variant:`secondary`,testId:`skills-add-skill-button`,className:`flex-shrink-0 whitespace-nowrap`,onClick:()=>T(!0),children:e(o.SETTINGS$SKILLS_ADD_BUTTON)})]}),k&&(0,N.jsx)(`div`,{className:`flex flex-col gap-4`,children:[1,2,3].map(e=>(0,N.jsx)(`div`,{className:`h-24 rounded-2xl bg-tertiary animate-pulse`},e))}),!k&&(!i||i.length===0)&&(0,N.jsx)(`div`,{"data-testid":`skills-empty`,className:`rounded-xl border border-[var(--oh-border)] p-8 text-center`,children:(0,N.jsx)(`p`,{className:`text-sm text-tertiary-light`,children:e(o.SETTINGS$SKILLS_NO_SKILLS)})}),!k&&i&&i.length>0&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(ce,{search:_,onSearchChange:y,typeFilter:b,onTypeFilterChange:x}),A.length===0?(0,N.jsx)(`div`,{"data-testid":`skills-no-match`,className:`rounded-xl border border-[var(--oh-border)] p-8 text-center`,children:(0,N.jsx)(`p`,{className:`text-sm text-tertiary-light`,children:e(o.SETTINGS$SKILLS_NO_MATCH)})}):(0,N.jsx)(`section`,{className:d(`flex min-w-0 flex-col gap-3`,`@container min-w-0 w-full`),children:(0,N.jsx)(`div`,{className:`grid min-w-0 grid-cols-1 gap-3 @min-[600px]:grid-cols-2`,children:A.map(e=>(0,N.jsx)(U,{skill:e,enabled:!u.has(e.name),onOpen:()=>C(e),onToggle:t=>E(e.name,t)},e.name))})})]}),S&&(0,N.jsx)(J,{skill:S,enabled:!u.has(S.name),onToggle:e=>E(S.name,e),onClose:()=>C(null)}),w&&(0,N.jsx)(ae,{onClose:()=>T(!1)})]})})]})}var de=r(ue);export{de as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{A as r,C as i,E as a,O as o,T as s,d as c,f as l,g as u,i as d,j as f,k as p,u as m,w as h,x as g,y as _}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{A as r,C as i,E as a,O as o,T as s,d as c,f as l,g as u,i as d,j as f,k as p,u as m,w as h,x as g,y as _}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~epa72zsm-B4rXs7Zd.js";var v=class extends f{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=c(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),b(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return x(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return x(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof i(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!s(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&S(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||h(this.options.staleTime,this.#t)!==h(t.staleTime,this.#t))&&this.#g();let a=this.#_();r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||a!==this.#p)&&this.#v(a)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return w(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(_)),t}#g(){this.#b();let e=h(this.options.staleTime,this.#t);if(l.isServer()||this.#r.isStale||!u(e))return;let t=o(this.#r.dataUpdatedAt,e)+1;this.#d=p.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(l.isServer()||i(this.options.enabled,this.#t)===!1||!u(this.#p)||this.#p===0)&&(this.#f=p.setInterval(()=>{(this.options.refetchIntervalInBackground||r.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(p.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(p.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,a=this.#r,o=this.#i,s=this.#a,l=e===n?this.#n:e.state,{state:u}=e,f={...u},p=!1,m;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&b(e,t),o=i&&S(e,n,t,r);(a||o)&&(f={...f,...d(u.data,e.options)}),t._optimisticResults===`isRestoring`&&(f.fetchStatus=`idle`)}let{error:h,errorUpdatedAt:_,status:v}=f;m=f.data;let y=!1;if(t.placeholderData!==void 0&&m===void 0&&v===`pending`){let e;a?.isPlaceholderData&&t.placeholderData===s?.placeholderData?(e=a.data,y=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(v=`success`,m=g(a?.data,e,t),p=!0)}if(t.select&&m!==void 0&&!y)if(a&&m===o?.data&&t.select===this.#c)m=this.#l;else try{this.#c=t.select,m=t.select(m),m=g(a?.data,m,t),this.#l=m,this.#s=null}catch(e){this.#s=e}this.#s&&(h=this.#s,m=this.#l,_=Date.now(),v=`error`);let x=f.fetchStatus===`fetching`,w=v===`pending`,T=v===`error`,E=w&&x,D=m!==void 0,O={status:v,fetchStatus:f.fetchStatus,isPending:w,isSuccess:v===`success`,isError:T,isInitialLoading:E,isLoading:E,data:m,dataUpdatedAt:f.dataUpdatedAt,error:h,errorUpdatedAt:_,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:f.dataUpdateCount>l.dataUpdateCount||f.errorUpdateCount>l.errorUpdateCount,isFetching:x,isRefetching:x&&!w,isLoadingError:T&&!D,isPaused:f.fetchStatus===`paused`,isPlaceholderData:p,isRefetchError:T&&D,isStale:C(e,t),refetch:this.refetch,promise:this.#o,isEnabled:i(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=O.data!==void 0,r=O.status===`error`&&!t,i=e=>{r?e.reject(O.error):t&&e.resolve(O.data)},a=()=>{i(this.#o=O.promise=c())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||O.data!==o.value)&&a();break;case`rejected`:(!r||O.error!==o.reason)&&a();break}}return O}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!s(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){m.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function y(e,t){return i(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&i(t.retryOnMount,e)===!1)}function b(e,t){return y(e,t)||e.state.data!==void 0&&x(e,t,t.refetchOnMount)}function x(e,t,n){if(i(t.enabled,e)!==!1&&h(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&C(e,t)}return!1}function S(e,t,n,r){return(e!==t||i(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&C(e,n)}function C(e,t){return i(t.enabled,e)!==!1&&e.isStaleByTime(h(t.staleTime,e))}function w(e,t){return!s(e.getCurrentResult(),t)}var T=e(t(),1),E=T.createContext(!1),D=()=>T.useContext(E);E.Provider,n();function O(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var k=T.createContext(O()),A=()=>T.useContext(k),j=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?a(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},M=e=>{T.useEffect(()=>{e.clearReset()},[e])},N=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||a(n,[e.error,r])),P=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},F=(e,t)=>e.isLoading&&e.isFetching&&!t,I=(e,t)=>e?.suspense&&t.isPending,L=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});export{j as a,A as c,F as i,D as l,L as n,N as o,I as r,M as s,P as t,v as u};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{t as r}from"./useTranslation-CDRCKC9-.js";import{t as i}from"./declaration-gq8V5eTU.js";import{t as a}from"./square-chevron-right-Czw3FFWc.js";import{t as o,w as s}from"./utils-D3U3rlqr.js";import{t as c}from"./use-agent-state-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{t as r}from"./useTranslation-CDRCKC9-.js";import{t as i}from"./declaration-gq8V5eTU.js";import{t as a}from"./square-chevron-right-Czw3FFWc.js";import{t as o,w as s}from"./utils-D3U3rlqr.js";import{t as c}from"./use-agent-state-DHZO1obC.js";import{t as l}from"./command-store-D8J5LMW1.js";import{t as u}from"./runtime-waiting-state-BsXLElvN.js";import{n as d,t as f}from"./vendor~terminal-aeP3PnKf.js";import{t as p}from"./conversation-tab-empty-state-B2dDYEwf.js";var m=e(t(),1),h=`[Python Interpreter: `,g=e=>{let t=e.indexOf(h);if(t<0)return e;let n=t+21;return e.indexOf(`]`,n)<=n?e:e.substring(0,t).trim()},_=(e,t,n=!1)=>{let{content:r,type:i}=e;if(i===`input`&&n)return;let a=(r||``).replaceAll(`
|
|
2
2
|
`,`\r
|
|
3
3
|
`).trim();a&&t.writeln(g(a))},v=(e,t,n)=>{if(!e||!t||!n||window.getComputedStyle(n).display===`none`)return!1;let{clientWidth:r,clientHeight:i}=n;return!(r===0||i===0||!e.element)};function y(e){let t=e.ownerDocument.createElement(`span`);t.style.color=`var(--oh-surface-foreground)`,t.style.position=`absolute`,t.style.visibility=`hidden`,t.style.pointerEvents=`none`,e.appendChild(t);let n=getComputedStyle(t).color;return t.remove(),n&&n!==`rgba(0, 0, 0, 0)`?n:getComputedStyle(e).color}var b={current:0},x=()=>{let e=l(e=>e.commands),t=m.useRef(null),n=m.useRef(null),r=m.useRef(null),i=b,a=m.useRef(!1),o=e=>new f({fontFamily:`Menlo, Monaco, 'Courier New', monospace`,fontSize:14,scrollback:1e4,scrollSensitivity:1,fastScrollSensitivity:5,disableStdin:!0,allowTransparency:!0,theme:{background:`rgba(0, 0, 0, 0)`,foreground:y(e)}}),s=m.useCallback(()=>{a.current||v(t.current,n.current,r.current)&&n.current.fit()},[]),c=()=>{t.current&&(n.current&&t.current.loadAddon(n.current),r.current&&(t.current.open(r.current),t.current.write(`\x1B[?25l`),s()))};return m.useEffect(()=>{a.current=!1;let s=r.current;if(s){if(t.current=o(s),n.current=new d,r.current&&(c(),e.length>0)){for(let n=0;n<e.length;n+=1)e[n].type===`input`&&t.current.write(`$ `),_(e[n],t.current,!1);i.current=e.length}return()=>{a.current=!0,t.current?.dispose(),i.current=0}}},[]),m.useEffect(()=>{if(t.current&&e.length>0&&i.current<e.length){for(let n=i.current;n<e.length;n+=1)e[n].type===`input`&&t.current.write(`$ `),_(e[n],t.current,!1);i.current=e.length}},[e]),m.useEffect(()=>{let e=null;return e=new ResizeObserver(()=>{requestAnimationFrame(()=>{s()})}),r.current&&e.observe(r.current),()=>{e?.disconnect()}},[s]),r},S=n();function C({className:e,testId:t}){return(0,S.jsx)(u,{testId:t,className:e})}function w(){let{t:e}=r(`openhands`);return(0,S.jsx)(p,{className:`h-full`,icon:(0,S.jsx)(a,{"aria-hidden":!0,strokeWidth:2,className:`size-full`}),children:e(i.TERMINAL$NO_OUTPUT)})}function T(){let{curAgentState:e}=c(),t=l(e=>e.commands),n=s.includes(e),r=t.length>0,i=n||!r,a=x();return(0,S.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[n&&(0,S.jsx)(C,{className:`pt-16`}),!n&&!r&&(0,S.jsx)(w,{}),(0,S.jsx)(`div`,{className:o(`flex-1 min-h-0 p-4`,i&&`pointer-events-none absolute inset-0 h-0 w-0 overflow-hidden p-0 opacity-0`),children:(0,S.jsx)(`div`,{ref:a,className:`h-full w-full`})})]})}export{T as default};
|
package/build/assets/{use-acp-credential-form-EtnbtYt0.js → use-acp-credential-form-MzZM6D7D.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{n as r}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{n as r}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~epa72zsm-B4rXs7Zd.js";import{t as i}from"./useQuery-CRBP8vIS.js";import{t as a}from"./useTranslation-CDRCKC9-.js";import{t as o}from"./declaration-gq8V5eTU.js";import{p as s}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~lf310vj7-CSVPGId3.js";import{A as c,N as l,P as u,j as d,n as f}from"./active-backend-context-hxq31W25.js";import{t as p}from"./check-Bvi71siz.js";import{t as m}from"./loader-circle-BEykUKYG.js";import{t as h}from"./utils-D3U3rlqr.js";import{n as g}from"./agent-server-client-options-DVLRd9sw.js";import{l as _}from"./form-control-classes-ChpNBe9n.js";import{n as v,t as y}from"./settings-input-bD6npsDm.js";import{a as b,l as x}from"./acp-providers-Sy2LKyMa.js";import{n as S,t as C}from"./use-create-secret-D0HCOZFu.js";var w=e(t(),1),T=n();function E({conflicts:e}){let{t}=a(`openhands`);return(0,T.jsx)(T.Fragment,{children:e.map(([e,n])=>(0,T.jsx)(`p`,{"data-testid":`acp-credential-conflict-warning`,className:`text-sm text-amber-300`,children:t(o.SETTINGS$ACP_CREDENTIAL_CONFLICT_WARNING,{credential:e,conflicting:n})},`${e}:${n}`))})}function D({status:e,isChecking:t,providerName:n,testIdPrefix:r}){let{t:i}=a(`openhands`);return e===`authenticated`?(0,T.jsxs)(`div`,{"data-testid":`${r}-detected`,className:`flex items-start gap-2 rounded-xl border border-green-500/40 bg-green-500/10 px-4 py-3 text-sm text-green-200`,children:[(0,T.jsx)(p,{className:`mt-0.5 size-4 shrink-0 text-green-400`,"aria-hidden":!0}),(0,T.jsx)(`span`,{children:i(o.ONBOARDING$ACP_AUTH_DETECTED,{provider:n})})]}):t?(0,T.jsxs)(`div`,{"data-testid":`${r}-checking`,className:`flex items-center gap-2 text-sm text-[var(--oh-muted)]`,children:[(0,T.jsx)(m,{className:`size-4 shrink-0 animate-spin`,"aria-hidden":!0}),(0,T.jsx)(`span`,{children:i(o.ONBOARDING$ACP_AUTH_CHECKING,{provider:n})})]}):null}function O({field:e,value:t,onChange:n,alreadySet:r,testId:i,showOptionalTag:s}){let{t:c}=a(`openhands`),l=r?c(o.ONBOARDING$ACP_SECRET_ALREADY_SET):``;return(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e.multiline?(0,T.jsxs)(`label`,{className:`flex flex-col gap-2.5`,children:[(0,T.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`text-sm font-mono text-white`,children:e.name}),s&&(0,T.jsx)(v,{})]}),(0,T.jsx)(`textarea`,{"data-testid":i,name:e.name,rows:4,spellCheck:!1,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,value:t,placeholder:l,onChange:e=>n(e.target.value),className:h(_,`font-mono text-xs`)})]}):(0,T.jsx)(y,{testId:i,name:e.name,label:e.name,labelClassName:`font-mono`,type:e.secret?`password`:`text`,value:t,onChange:n,showOptionalTag:s,placeholder:l}),(0,T.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:c(e.hint_key,e.hint_values)})]})}var k=10;function A(e){return`${e.stdout??``}\n${e.stderr??``}`}function j(e){let t;try{t=JSON.parse((e.stdout??``).trim())}catch{return`unknown`}let n=t?.loggedIn;return typeof n==`boolean`?n?`authenticated`:`unauthenticated`:`unknown`}function M(e){let t=A(e).toLowerCase();return t.includes(`not logged in`)?`unauthenticated`:t.includes(`logged in`)?`authenticated`:`unknown`}function N(e){let t=(e.stdout??``).trim();return t===`present`?`authenticated`:t===`absent`?`unauthenticated`:`unknown`}var P={"claude-code":{command:`claude auth status --json`,classify:j},codex:{command:`codex login status`,classify:M},"gemini-cli":{command:`test -f "$HOME/.gemini/oauth_creds.json" && echo present || echo absent`,classify:N}},F=class{static async getAuthStatus(e){let t=P[e];if(!t)return`unknown`;let n=await new s(g()).executeCommand(t.command,void 0,k);return t.classify(n)}};async function I(e){try{return await F.getAuthStatus(e)}catch{return`unknown`}}function L(e,t={}){let{enabled:n=!0}=t,r=f(),a=r.backend.kind===`local`,o=n&&a&&!!e,s=i({queryKey:[`acp-auth-status`,r.backend.id,e],queryFn:()=>I(e),enabled:o,staleTime:1/0,gcTime:1e3*60*15,retry:!1,refetchOnWindowFocus:!1,refetchOnMount:!1});return{status:s.data??`unknown`,isChecking:o&&s.isFetching&&s.data===void 0,isSupported:a}}function R(e,t){let{t:n}=a(`openhands`),i=r(),{mutateAsync:s}=C(),[f,p]=w.useState(!1);return{saveFilled:async(r,{silent:a=!1}={})=>{let f=e.map(e=>({field:e,value:r[e.name]?.trim()})).filter(e=>!!e.value);if(f.length===0)return!0;p(!0);try{for(let{field:e,value:t}of f)await s({name:e.name,value:t});return await i.invalidateQueries({queryKey:[`secrets-search`]}),await i.invalidateQueries({queryKey:[`secrets`]}),!t&&f.some(({field:e})=>e.multiline)?l(n(o.ONBOARDING$ACP_SECRETS_ORPHANED_WARNING)):a||d(n(o.SETTINGS$SAVED)),!0}catch(e){return c(u(e)||n(o.ERROR$GENERIC)),!1}finally{p(!1)}},isSaving:f}}function z(e){let{data:t}=S(),n=w.useMemo(()=>x(e),[e]),[r,i]=w.useState({}),{saveFilled:a,isSaving:o}=R(n,!0);w.useEffect(()=>{i({})},[e]);let s=w.useCallback(e=>(t??[]).some(t=>t.name===e),[t]),c=w.useCallback(e=>!!r[e]?.trim()||s(e),[r,s]),l=w.useCallback((e,t)=>i(n=>({...n,[e]:t})),[]),u=w.useCallback(()=>i({}),[]);return{fields:n,values:r,setValue:l,secretExists:s,hasValueFor:c,conflicts:b(e,c),consumesFileCredentials:!0,isDirty:n.some(e=>!!r[e.name]?.trim()),save:e=>a(r,e),reset:u,isSaving:o}}export{E as a,D as i,L as n,O as r,z as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~
|
|
1
|
+
import{n as e}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~epa72zsm-B4rXs7Zd.js";import{t}from"./useMutation-DrCAVg5w.js";import{f as n,i as r}from"./active-backend-context-hxq31W25.js";import{t as i}from"./settings-service.api-Ce-ub11I.js";import{n as a}from"./use-agent-profiles-DwZxnwO5.js";var o=[`activate-agent-profile`];function s(){let s=e();return t({mutationKey:o,mutationFn:e=>a.activateProfile(e),onMutate:async e=>{await s.cancelQueries({queryKey:r.all});let t=s.getQueriesData({queryKey:r.all});return s.setQueriesData({queryKey:r.all},t=>t&&{...t,active_agent_profile_id:e}),{snapshots:t}},onError:(e,t,n)=>{n?.snapshots?.forEach(([e,t])=>{s.setQueryData(e,t)})},onSuccess:async()=>{i.invalidateCache(),await s.invalidateQueries({queryKey:r.all}),await s.invalidateQueries({queryKey:n.personal()})}})}export{s as n,o as t};
|
package/build/assets/{use-active-agent-profile-CYY3vGar.js → use-active-agent-profile-BkJN7Xsy.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./use-agent-profiles-
|
|
1
|
+
import{t as e}from"./use-agent-profiles-DwZxnwO5.js";function t(){let{data:t,isLoading:n}=e(),r=t?.active_agent_profile_id??null;return{activeProfile:t?.profiles?.find(e=>e.id!=null&&e.id===r)??null,isLoading:n}}function n(){let{activeProfile:e}=t();return e?.agent_kind}export{t as n,n as t};
|
package/build/assets/{use-active-conversation-D-r929nx.js → use-active-conversation-DOZVSVtU.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t}from"./vendor-styling-CI0PQ3ab.js";import{b as n}from"./utils-D3U3rlqr.js";import{n as r}from"./navigation-context-DPs2G0X8.js";import{t as i}from"./conversation-service.api-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t}from"./vendor-styling-CI0PQ3ab.js";import{b as n}from"./utils-D3U3rlqr.js";import{n as r}from"./navigation-context-DPs2G0X8.js";import{t as i}from"./conversation-service.api-DPBQvTKD.js";import{t as a}from"./use-user-conversation-zpx7I18x.js";var o=e(t(),1);function s(){let{conversationId:e}=r();return{conversationId:e}}function c(){let{conversationId:e}=s();if(!e)throw Error(`useConversationId must be used within a route that has a conversationId parameter`);return{conversationId:e}}var l=()=>{let{conversationId:e}=s(),t=!!e&&e.startsWith(`task-`),r=a(!e||t?null:e,e=>{let t=e.state.data;return t&&(!t.conversation_url||t.sandbox_status===`PAUSED`||!t.title&&n(t.execution_status))?3e3:3e4});return(0,o.useEffect)(()=>{let e=r.data;i.setCurrentConversation(e||null)},[e,r.isFetched,r?.data?.execution_status]),r};export{c as n,s as r,l as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./useQuery-
|
|
1
|
+
import{t as e}from"./useQuery-CRBP8vIS.js";import{h as t}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~lf310vj7-CSVPGId3.js";import{a as n,i as r,n as i,o as a}from"./active-backend-context-hxq31W25.js";import{c as o,n as s}from"./agent-server-client-options-DVLRd9sw.js";import{t as c}from"./proxy-BgJLtxu7.js";var l=`/api/agent-profiles`;function u(){let e=o().backend;if(e.kind!==`cloud`)throw Error(`Cloud agent-profile call requires a cloud backend.`);return e}async function d(){return c({backend:u(),method:`GET`,path:l})}async function f(e){return c({backend:u(),method:`GET`,path:`${l}/${encodeURIComponent(e)}`})}async function p(e,t){return c({backend:u(),method:`POST`,path:`${l}/${encodeURIComponent(e)}`,body:t})}async function m(e){return c({backend:u(),method:`DELETE`,path:`${l}/${encodeURIComponent(e)}`})}async function h(e,t){return c({backend:u(),method:`POST`,path:`${l}/${encodeURIComponent(e)}/rename`,body:{new_name:t}})}async function g(e){return c({backend:u(),method:`POST`,path:`${l}/${encodeURIComponent(e)}/activate`,body:{}})}function _(){return o().backend.kind===`cloud`}var v=`default`,y=class{static async listProfiles(){return _()?d():new t(s()).listAgentProfiles()}static async getProfile(e,n){if(_())return f(e);let r=n?{exposeSecrets:n}:{};return new t(s()).getAgentProfile(e,r)}static async saveProfile(e,n){return _()?p(e,n):new t(s()).saveAgentProfile(e,n)}static async deleteProfile(e){return _()?m(e):new t(s()).deleteAgentProfile(e)}static async renameProfile(e,n){return _()?h(e,n):new t(s()).renameAgentProfile(e,n)}static async activateProfile(e){return _()?g(e):new t(s()).activateAgentProfile(e)}};function b(t={}){let{backend:o,orgId:s}=i();return e({queryKey:[...r.all,o.id,s],queryFn:y.listProfiles,...a,...n,enabled:t.enabled??!0,meta:{disableToast:!0}})}export{y as n,v as r,b as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t}from"./vendor-styling-CI0PQ3ab.js";import{C as n}from"./utils-D3U3rlqr.js";import{t as r}from"./common-Dh7OqABE.js";import{t as i}from"./conversation-state-store-B2Bp32XI.js";import{t as a}from"./use-active-conversation-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t}from"./vendor-styling-CI0PQ3ab.js";import{C as n}from"./utils-D3U3rlqr.js";import{t as r}from"./common-Dh7OqABE.js";import{t as i}from"./conversation-state-store-B2Bp32XI.js";import{t as a}from"./use-active-conversation-DOZVSVtU.js";var o=e(t(),1);function s(e){if(!e)return n.LOADING;switch(e){case r.IDLE:return n.AWAITING_USER_INPUT;case r.RUNNING:return n.RUNNING;case r.PAUSED:return n.PAUSED;case r.WAITING_FOR_CONFIRMATION:return n.AWAITING_USER_CONFIRMATION;case r.FINISHED:return n.FINISHED;case r.ERROR:return n.ERROR;case r.STUCK:return n.ERROR;default:return n.LOADING}}function c(){let e=i(e=>e.execution_status),t=a().data?.execution_status??null,n=e??t;return{curAgentState:(0,o.useMemo)(()=>s(n),[n]),executionStatus:n}}export{c as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t}from"./vendor-styling-CI0PQ3ab.js";import{t as n}from"./useQueries-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t}from"./vendor-styling-CI0PQ3ab.js";import{t as n}from"./useQueries-DClgUTc7.js";import{b as r,m as i,o as a}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~lf310vj7-CSVPGId3.js";import{D as o,E as s,L as c,O as l,R as u,T as d,p as f,y as p}from"./active-backend-context-hxq31W25.js";import{n as m}from"./agent-server-client-options-DVLRd9sw.js";import{r as h}from"./organization-service.api-Bk4pCGU1.js";var g=e(t(),1),_=1e4,v=4e3,y=`Invalid API key`,b=`API key required`,x=`Cloud API key or network issue`,S=`Logged out`;function C(e){return e===y}function w(e){return e===b}function T(e){return e===x}function E(e){return e.kind===`cloud`&&!e.apiKey.trim()}function D(e){return e===S}async function O(e){if(e.kind===`cloud`){if(!e.apiKey?.trim())throw Error(b);try{await h(e)}catch(e){throw r.isAxiosError(e)&&e.response?.status===401?Error(S):c(e)?Error(x):e}return!0}try{let t=m({host:e.host,sessionApiKey:e.apiKey||null,timeout:v});await new a(t).getSettings(),f(await new i(t).getServerInfo())}catch(e){throw p(e,401)?Error(y):e}return!0}var k=2,A=300;function j(e){return e instanceof Error?e.message!==`Invalid API key`&&e.message!==`API key required`&&e.message!==`Logged out`:!0}async function M(e){for(let t=0;;t+=1)try{return await O(e)}catch(e){if(t>=k||!j(e))throw e;await new Promise(e=>{setTimeout(e,A)})}}function N(e,t={}){let{probeDisabledOnce:r=!1}=t,i=g.useSyncExternalStore(l,d,d),a=n({queries:e.map(e=>{let t=i[e.id],n=E(e),a=t?.disabled===!0,c=a&&e.kind===`cloud`&&u(t?.lastError),l=!n&&(!a||r||c);return{queryKey:[`backend-health`,e.id,e.kind,e.host,e.apiKey??``],queryFn:async()=>{try{let t=await M(e);return o(e.id),t}catch(t){throw s(e.id,t),t}},enabled:l,refetchInterval:a||n?!1:_,refetchIntervalInBackground:!1,refetchOnMount:a&&r?`always`:!0,refetchOnReconnect:!a&&!n,refetchOnWindowFocus:!a&&!n,retry:!1,staleTime:a?0:_,meta:{disableToast:!0}}})}),c={};return e.forEach((e,t)=>{let n=a[t],r=i[e.id],o=E(e),s=o?!1:r?.disabled===!0,l=o?0:r?.consecutiveFailures??0,u=o?b:r?.lastError??null,d;d=o||s?!1:n.isSuccess?!0:n.isError?!1:null,c[e.id]={isConnected:d,consecutiveFailures:l,lastError:u,disabled:s}}),c}export{N as a,w as i,D as n,C as r,T as t};
|