@nextclaw/ui 0.27.1 → 0.27.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/.vite/manifest.json +419 -419
- package/dist/assets/{account-panel-BVNV8XqM.js → account-panel-DiKpSvqS.js} +1 -1
- package/dist/assets/{agents-CfpN8PQc.js → agents-lT-bDFex.js} +1 -1
- package/dist/assets/agents-nyTxTl89.js +1 -0
- package/dist/assets/{api-CI6_8Qt1.js → api-BaML_txv.js} +1 -1
- package/dist/assets/{app-presenter-provider-2DwHRRle.js → app-presenter-provider-DSlY9Lz6.js} +6 -6
- package/dist/assets/{appearance-settings-page-Cn9w3F-K.js → appearance-settings-page-BNIxFwEY.js} +1 -1
- package/dist/assets/apps-D7Se5AXs.js +1 -0
- package/dist/assets/{book-open-i_BjUBqL.js → book-open-oG0GrLyy.js} +1 -1
- package/dist/assets/{card-DokH7OBp.js → card-DxCOCY_7.js} +1 -1
- package/dist/assets/{channels-list-page-B7G9lHUm.js → channels-list-page-UQ1xjKw9.js} +1 -1
- package/dist/assets/{circle-dashed-Cx8CIEbg.js → circle-dashed-pgOOTUik.js} +1 -1
- package/dist/assets/{client-CUJUci3r.js → client-C1Z8ITVa.js} +1 -1
- package/dist/assets/{config-split-page-hY1xug28.js → config-split-page-Cfozkh5B.js} +1 -1
- package/dist/assets/{confirm-dialog-B-ejV666.js → confirm-dialog-BdEQiFoD.js} +1 -1
- package/dist/assets/{context-menu-dGVv8klA.js → context-menu-DVgLoPqH.js} +1 -1
- package/dist/assets/{createLucideIcon-reFMl-W-.js → createLucideIcon-D-7Sxfw7.js} +1 -1
- package/dist/assets/cron-wSJKKm6g.js +1 -0
- package/dist/assets/{desktop-capabilities-page-CYJTQ3nC.js → desktop-capabilities-page-gakZ5UKX.js} +1 -1
- package/dist/assets/{desktop-update-config-guKAozXO.js → desktop-update-config-CVUwJyV-.js} +1 -1
- package/dist/assets/{dialog-DLOwdjT1.js → dialog-InO6RVpm.js} +1 -1
- package/dist/assets/{dist-ZaFFmAGl.js → dist-BxOjfeaD.js} +1 -1
- package/dist/assets/doc-browser-Cuedjp9j.js +1 -0
- package/dist/assets/{doc-browser-context-CTmOmuqa.js → doc-browser-context-Bs122rxO.js} +1 -1
- package/dist/assets/{download-DovI3Yvf.js → download-BN4aCzSx.js} +1 -1
- package/dist/assets/{extensions-BZ3qrM8M.js → extensions-hxS830nS.js} +1 -1
- package/dist/assets/{external-link-DUD3AbsF.js → external-link-NwtWKzE2.js} +1 -1
- package/dist/assets/{form-actions-B8VniHts.js → form-actions-XP38NiPw.js} +1 -1
- package/dist/assets/{i18n-IGQbjBqS.js → i18n-Bzo4IocH.js} +2 -2
- package/dist/assets/inbox-CnpKPeFb.js +1 -0
- package/dist/assets/{inbox-ClAG7SI_.js → inbox-DofXi7Xv.js} +1 -1
- package/dist/assets/{keyboard-shortcuts-settings-page-BqfbbKir.js → keyboard-shortcuts-settings-page-Cn3zyBq_.js} +1 -1
- package/dist/assets/login-page-3Yv6FU7k.js +1 -0
- package/dist/assets/{login-page-DYaozpzz.js → login-page-CkfjjXD2.js} +1 -1
- package/dist/assets/{main-CWYF9QU_.js → main-BI7BtvLx.js} +2 -2
- package/dist/assets/main-i18n-catalog.config-ykBbOfNP.js +1 -0
- package/dist/assets/marketplace-BkdTZexc.js +1 -0
- package/dist/assets/mcp-marketplace-page-BqFum360.js +1 -0
- package/dist/assets/{model-config-page-Cduyz2Hy.js → model-config-page-BCGCP2Wc.js} +1 -1
- package/dist/assets/{navigation-link-D-JSWFxj.js → navigation-link-tawg3qi2.js} +1 -1
- package/dist/assets/panel-app-i18n-catalog.config-DEFg3R5S.js +1 -0
- package/dist/assets/panel-apps-CRjFqZZD.js +1 -0
- package/dist/assets/{panelStandalone-oHxbXvYt.js → panelStandalone-smtUeY2k.js} +2 -2
- package/dist/assets/plus-v29lPO18.js +1 -0
- package/dist/assets/{privacy-settings-page-DG9E8N-F.js → privacy-settings-page-D4TI_vdw.js} +1 -1
- package/dist/assets/{projects-CzBaTOTL.js → projects-Rm2oKUPt.js} +1 -1
- package/dist/assets/{provider-models-COzjYl29.js → provider-models-CWtoV3BJ.js} +1 -1
- package/dist/assets/{provider-scoped-model-input-Cvy74uj8.js → provider-scoped-model-input-DJzdGBE8.js} +1 -1
- package/dist/assets/{providers-config-page-7rCwVnhh.js → providers-config-page-gzLkTzMP.js} +1 -1
- package/dist/assets/{puzzle-C5Wfpjk_.js → puzzle-CXL_z0vz.js} +1 -1
- package/dist/assets/{pwa-CAg_9zFs.js → pwa-Blsqtn1m.js} +1 -1
- package/dist/assets/{refresh-cw-OhwaPDn1.js → refresh-cw-CqsHJPqR.js} +1 -1
- package/dist/assets/remote-DTe4pS7P.js +1 -0
- package/dist/assets/{rotate-cw-aBponvp7.js → rotate-cw-DS-Gca0a.js} +1 -1
- package/dist/assets/{runtime-config-page-BF1wxvzR.js → runtime-config-page-B5CCnrei.js} +1 -1
- package/dist/assets/{save-394QCMXn.js → save-CwxRo7hc.js} +1 -1
- package/dist/assets/{search-BG2qAlNZ.js → search-Drx-sMCE.js} +1 -1
- package/dist/assets/{search-config-page-D4LeiB9y.js → search-config-page-BjVONAIH.js} +1 -1
- package/dist/assets/{secrets-config-page-BzGcr5Vw.js → secrets-config-page-BB32noHT.js} +1 -1
- package/dist/assets/security-config--ilpaAEr.js +1 -0
- package/dist/assets/{select-xUXYV0Gr.js → select-DHYR109w.js} +1 -1
- package/dist/assets/{service-apps-panel-D3wwPRzV.js → service-apps-panel-DOKGtwsR.js} +1 -1
- package/dist/assets/{settings-2-CWOGRRaA.js → settings-2-DAPjKYtK.js} +1 -1
- package/dist/assets/{status-dot-CYifnSnt.js → status-dot-xxVxbdQr.js} +1 -1
- package/dist/assets/{tag-chip-CjM6lyeh.js → tag-chip-0lQj9HFa.js} +1 -1
- package/dist/assets/{theme-provider-BToFZGZG.js → theme-provider-DDJOlUxn.js} +1 -1
- package/dist/assets/{trash-2-DvJ6duOW.js → trash-2-B8mbrtCx.js} +1 -1
- package/dist/assets/{use-config-COusaY5p.js → use-config-BpKXDcM_.js} +1 -1
- package/dist/assets/{use-desktop-capabilities-B-u6ojjW.js → use-desktop-capabilities-C1bXk7fx.js} +1 -1
- package/dist/assets/{use-viewport-layout-IKKGpjzF.js → use-viewport-layout-D6seoW0Z.js} +1 -1
- package/dist/assets/{x-E9VB4HQx.js → x-DLvS4xvV.js} +1 -1
- package/dist/index.html +36 -36
- package/dist/panel-standalone.html +14 -14
- package/package.json +2 -2
- package/src/features/chat/features/conversation/components/__tests__/session-conversation-input-top-slot.test.tsx +71 -0
- package/src/features/chat/features/conversation/components/session-conversation-input-top-slot.tsx +6 -7
- package/src/features/chat/features/conversation/hooks/__tests__/use-session-conversation-controller.test.tsx +41 -0
- package/src/features/chat/features/conversation/hooks/use-session-conversation-controller.ts +4 -1
- package/src/shared/lib/i18n/locales/en-US/chat.json +0 -1
- package/src/shared/lib/i18n/locales/zh-CN/chat.json +0 -1
- package/dist/assets/agents-E4nu-17c.js +0 -1
- package/dist/assets/apps-YFlJirpx.js +0 -1
- package/dist/assets/cron-CH5c55CR.js +0 -1
- package/dist/assets/doc-browser-ClDUWo9V.js +0 -1
- package/dist/assets/inbox-BjBZIbgx.js +0 -1
- package/dist/assets/login-page-BxSMwUsc.js +0 -1
- package/dist/assets/main-i18n-catalog.config-itg3Gvzp.js +0 -1
- package/dist/assets/marketplace-CnQ5USfr.js +0 -1
- package/dist/assets/mcp-marketplace-page-Dor6H9IC.js +0 -1
- package/dist/assets/panel-app-i18n-catalog.config-BfLHr1tc.js +0 -1
- package/dist/assets/panel-apps-C-izvtu9.js +0 -1
- package/dist/assets/plus-DUdl68Eo.js +0 -1
- package/dist/assets/remote-DvCdHjzA.js +0 -1
- package/dist/assets/security-config-vD_V0BQF.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./chunk-DF37yw5_.js";import{S as t}from"./theme-provider-BToFZGZG.js";import{Lt as n,Qn as r,Yt as i,Zn as a,_n as o,lr as s,ur as c,xr as l}from"./api-CI6_8Qt1.js";import{$t as u,Ft as d,It as f,Pt as p,d as m,en as h,m as g,rn as _,zt as ee}from"./app-presenter-provider-2DwHRRle.js";import{t as v}from"./createLucideIcon-reFMl-W-.js";import{G as y,W as b,g as x,h as S,lt as C,vt as w}from"./context-menu-dGVv8klA.js";import{z as T}from"./dist-ZaFFmAGl.js";import{t as E}from"./circle-dashed-Cx8CIEbg.js";import{i as D}from"./x-E9VB4HQx.js";import{t as O}from"./refresh-cw-OhwaPDn1.js";import{t as k}from"./trash-2-DvJ6duOW.js";import{s as A}from"./i18n-IGQbjBqS.js";import{a as j,d as M,f as N,i as P,l as F,n as I,o as L,r as R,t as z,u as B}from"./dialog-DLOwdjT1.js";import{g as V,h as H,p as U}from"./provider-models-COzjYl29.js";var W=v(`CirclePause`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]]),te=v(`Radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]),G=v(`ShieldPlus`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M9 12h6`,key:`1c52cq`}],[`path`,{d:`M12 9v6`,key:`199k2o`}]]),ne=v(`Unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),K=e(l(),1),q=c();function re({appId:e,appTitle:t,dataEntry:n,dataLoading:r,deleteError:a,deletePending:o,open:s,purgeData:c,onDelete:l,onOpenChange:u,onPurgeDataChange:p}){let m=(0,K.useRef)(null);(0,K.useEffect)(()=>{a&&m.current?.focus()},[a]);let h=()=>u(!1);return(0,q.jsx)(z,{open:s,onOpenChange:e=>!o&&u(e),children:(0,q.jsxs)(I,{className:`max-w-md`,onEscapeKeyDown:e=>o&&e.preventDefault(),onInteractOutside:e=>o&&e.preventDefault(),children:[(0,q.jsxs)(j,{showClose:!1,children:[(0,q.jsx)(L,{children:A(`serviceAppsDeleteConfirmTitle`)}),(0,q.jsxs)(R,{children:[A(`serviceAppsDeleteConfirmDescription`),` `,t]})]}),(0,q.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,q.jsx)(f,{checked:!c,description:A(`serviceAppsKeepDataDescription`),label:A(`appPackagesKeepData`),onClick:()=>p(!1)}),(0,q.jsx)(f,{checked:c,destructive:!0,disabled:!n||r,description:A(`serviceAppsDeleteDataDescription`),label:A(`appPackagesDeleteData`),onClick:()=>p(!0)})]}),n?(0,q.jsx)(`div`,{className:`mt-3`,children:(0,q.jsx)(d,{storage:n.storage,usage:n.usage})}):(0,q.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-muted-foreground`,children:A(r?`appPackagesLoading`:`serviceAppsDataUnavailable`)}),a?(0,q.jsx)(`p`,{ref:m,role:`alert`,tabIndex:-1,className:`mt-3 text-xs text-destructive`,children:a instanceof Error?a.message:A(`appPackagesActionFailed`)}):null,(0,q.jsxs)(P,{className:`mt-5 gap-2 sm:gap-0`,children:[(0,q.jsx)(i,{autoFocus:!0,type:`button`,variant:`outline`,disabled:o,onClick:h,children:A(`cancel`)}),(0,q.jsxs)(i,{type:`button`,variant:c?`destructive`:`default`,disabled:o||c&&!n,onClick:()=>l(e,c,h),children:[o?(0,q.jsx)(D,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}):null,A(c?`appDataDeletePermanently`:`serviceAppsDelete`)]})]})]})})}function ie({action:e,grants:t,agents:n,grantAgentPending:r,onGrantAgent:i,onRevoke:a}){let[o,s]=(0,K.useState)(!1),c=new Set(t.flatMap(e=>e.caller.surface===`agent`?[e.caller.agentId]:[])),l=n.filter(e=>!c.has(e.id));return(0,q.jsxs)(`div`,{className:`py-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`flex h-6 w-6 shrink-0 items-center justify-center text-muted-foreground`,children:(0,q.jsx)(b,{className:`h-3.5 w-3.5`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`div`,{className:`truncate text-xs font-medium text-foreground`,children:e.title??e.name}),e.description?(0,q.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:e.description}):null]})]}),(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[e.runtimeState?(0,q.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:A(`serviceAppsRuntimeState_${e.runtimeState}`)}):null,(0,q.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.risk}),(0,q.jsxs)(U,{open:o,onOpenChange:s,children:[(0,q.jsx)(V,{asChild:!0,children:(0,q.jsx)(`button`,{type:`button`,disabled:r||l.length===0,className:`ml-1 rounded-md p-1 text-muted-foreground/70 transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:cursor-not-allowed disabled:opacity-40`,title:A(`serviceAppsGrantToAgent`),"aria-label":A(`serviceAppsGrantToAgent`),children:(0,q.jsx)(G,{className:`h-3.5 w-3.5`})})}),(0,q.jsxs)(H,{align:`end`,variant:`menu`,children:[(0,q.jsx)(`div`,{className:`px-2 py-1.5 text-[11px] font-medium text-muted-foreground`,children:A(`serviceAppsGrantToAgent`)}),l.map(t=>(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{i(e.id,t.id),s(!1)},className:`${x} text-foreground ${S.item}`,children:[(0,q.jsx)(w,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,q.jsx)(`span`,{className:`min-w-0 truncate`,children:t.displayName?.trim()||t.id})]},t.id))]})]})]})]}),t.map(e=>(0,q.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-between gap-2 pl-8`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,q.jsx)(u,{className:`h-3 w-3 shrink-0 text-emerald-500`}),(0,q.jsxs)(`span`,{className:`truncate`,children:[A(`serviceAppsGrantedTo`),` `,J(e)]})]}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>a(e),className:`rounded-md p-1 text-muted-foreground/70 transition-colors hover:bg-[var(--interaction-hover)] hover:text-rose-600 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,title:A(`serviceAppsRevokeGrant`),"aria-label":A(`serviceAppsRevokeGrant`),children:(0,q.jsx)(k,{className:`h-3 w-3`})})]},`${e.caller.surface}:${J(e)}:${e.actionId}`))]})}function J(e){return e.caller.surface===`panel-app`?e.caller.appId:e.caller.agentId}function Y({app:e,actions:n,actionsOpen:r,grants:i,agents:a,deletePending:s,deleteError:c,dataEntry:l,dataLoading:u,isDiscovering:d,onActionsOpenChange:f,onDiscover:p,onManagePackage:_,onDelete:ee,onResetDelete:v,onRestart:y,onRevoke:b,onGrantAgent:x,grantAgentPending:S}){let[w,E]=(0,K.useState)(!1),[O,j]=(0,K.useState)(!1),[P,I]=(0,K.useState)(!1),[L,R]=(0,K.useState)(!1),z=e.status!==`starting`&&e.status!==`stopped`,W=e.status===`running`||e.status===`failed`,G=e.sourceKind===`package`?e.packageId:void 0,J=se(e),Y=()=>{E(!1),R(!1),v(),j(!0)};return(0,q.jsx)(M,{delayDuration:250,children:(0,q.jsxs)(`section`,{className:`group bg-card transition-colors hover:bg-[var(--interaction-hover)]`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-3 px-4 py-3.5`,children:[(0,q.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,q.jsx)(h,{className:`h-4 w-4`})}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.title}),(0,q.jsx)(ae,{status:e.status})]}),e.description?(0,q.jsx)(`div`,{className:`mt-1 truncate text-xs leading-5 text-muted-foreground`,children:e.description}):null,e.lastError?(0,q.jsx)(`div`,{className:`mt-1.5 truncate text-xs text-rose-600`,title:e.lastError,children:e.lastError}):null]}),(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[z?(0,q.jsxs)(F,{children:[(0,q.jsx)(N,{asChild:!0,children:(0,q.jsxs)(`button`,{type:`button`,disabled:d,className:`inline-flex h-7 items-center gap-1.5 rounded-md bg-foreground px-2.5 text-xs font-medium text-background transition-colors hover:bg-foreground/85 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-foreground/40 disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":A(`serviceAppsDiscoverActions`),onClick:()=>p(e.id),children:[d?(0,q.jsx)(D,{className:`h-3.5 w-3.5 animate-spin`}):(0,q.jsx)(te,{className:`h-3.5 w-3.5`}),(0,q.jsx)(`span`,{children:A(`serviceAppsConnect`)})]})}),(0,q.jsx)(B,{side:`bottom`,className:`max-w-56 text-xs`,children:A(`serviceAppsDiscoverActionsHint`)})]}):null,(0,q.jsxs)(U,{open:w,onOpenChange:E,children:[(0,q.jsxs)(F,{children:[(0,q.jsx)(N,{asChild:!0,children:(0,q.jsx)(V,{asChild:!0,children:(0,q.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:opacity-50`,"aria-label":A(`serviceAppsMoreActions`),disabled:s,children:(0,q.jsx)(C,{className:`h-3.5 w-3.5`})})})}),(0,q.jsx)(B,{side:`bottom`,className:`text-xs`,children:A(`serviceAppsMoreActions`)})]}),(0,q.jsxs)(H,{align:`end`,variant:`menu`,children:[(0,q.jsx)(`div`,{className:`my-1 h-px bg-border`}),(0,q.jsx)(X,{disabled:!W,icon:ne,label:A(`serviceAppsDisconnectRuntime`),onClick:()=>{E(!1),y(e.id)}}),G?(0,q.jsx)(X,{icon:t,label:A(`serviceAppsManagePackage`),onClick:()=>{E(!1),_(G)}}):(0,q.jsx)(X,{destructive:!0,disabled:s,icon:k,label:A(`serviceAppsDelete`),onClick:Y}),(0,q.jsx)(`div`,{className:`my-1 h-px bg-border`}),(0,q.jsx)(m,{page:g(`service-app`,e.id,e.title),onSelect:()=>E(!1)})]})]})]})]}),(0,q.jsxs)(`div`,{className:`border-t border-border/60`,children:[(0,q.jsxs)(`div`,{className:`flex items-stretch`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>f(!r),className:`flex min-w-0 flex-1 items-center justify-between gap-2 px-4 py-2 text-left text-xs text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border`,"aria-expanded":r,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`span`,{children:A(`serviceAppsActionsSection`)}),(0,q.jsx)(`span`,{className:`tabular-nums text-muted-foreground/70`,children:n.length})]}),(0,q.jsx)(T,{className:o(`h-3.5 w-3.5 shrink-0 text-muted-foreground/70 transition-transform`,r&&`rotate-180`)})]}),J.length>0?(0,q.jsxs)(`button`,{type:`button`,onClick:()=>I(e=>!e),className:`flex shrink-0 items-center gap-1 border-l border-border/60 px-3 text-xs text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border`,"aria-expanded":P,children:[(0,q.jsx)(`span`,{children:A(`serviceAppsDetails`)}),(0,q.jsx)(T,{className:o(`h-3.5 w-3.5 transition-transform`,P&&`rotate-180`)})]}):null]}),r?(0,q.jsx)(`div`,{className:`border-t border-border/60 px-4 py-2.5`,children:n.length===0?(0,q.jsx)(`div`,{className:`py-1 text-xs text-muted-foreground`,children:A(`serviceAppsActionsEmpty`)}):(0,q.jsx)(`div`,{className:`divide-y divide-border/50`,children:n.map(e=>(0,q.jsx)(ie,{action:e,grants:i.filter(t=>t.actionId===e.id),agents:a,grantAgentPending:S,onGrantAgent:x,onRevoke:b},e.id))})}):null,P?(0,q.jsx)(ce,{rows:J}):null]}),e.sourceKind===`package`?null:(0,q.jsx)(re,{appId:e.id,appTitle:e.title,dataEntry:l,dataLoading:u,deleteError:c,deletePending:s,open:O,purgeData:L,onDelete:ee,onOpenChange:j,onPurgeDataChange:R})]})})}function ae({status:e}){let t=oe(e),n=t.icon;return(0,q.jsxs)(F,{children:[(0,q.jsx)(N,{asChild:!0,children:(0,q.jsxs)(`span`,{className:o(`inline-flex shrink-0 items-center gap-1 text-xs`,t.className),"aria-label":t.label,children:[(0,q.jsx)(n,{className:o(`h-3 w-3`,t.iconClassName)}),(0,q.jsx)(`span`,{children:t.label})]})}),(0,q.jsx)(B,{side:`bottom`,className:`text-xs`,children:t.tooltip})]})}function oe(e){switch(e){case`running`:return{className:`text-emerald-700`,icon:_,label:A(`serviceAppsStatus_running`),tooltip:A(`serviceAppsStatusHint_running`)};case`starting`:return{className:`text-blue-700`,icon:D,iconClassName:`animate-spin`,label:A(`serviceAppsStatus_starting`),tooltip:A(`serviceAppsStatusHint_starting`)};case`failed`:return{className:`text-rose-700`,icon:y,label:A(`serviceAppsStatus_failed`),tooltip:A(`serviceAppsStatusHint_failed`)};case`stopped`:return{className:`text-muted-foreground`,icon:W,label:A(`serviceAppsStatus_stopped`),tooltip:A(`serviceAppsStatusHint_stopped`)};default:return{className:`text-muted-foreground`,icon:E,label:A(`serviceAppsStatus_idle`),tooltip:A(`serviceAppsStatusHint_idle`)}}}function X({destructive:e=!1,disabled:t=!1,icon:n,label:r,onClick:i}){return(0,q.jsxs)(`button`,{type:`button`,className:o(x,e?S.destructive:`text-foreground ${S.item}`),disabled:t,onClick:i,children:[(0,q.jsx)(n,{className:o(`h-4 w-4 shrink-0`,!e&&`text-muted-foreground`)}),(0,q.jsx)(`span`,{children:r})]})}function se(e){let t=[e.command,...e.args??[]].filter(e=>!!e?.trim()).join(` `);return[{label:A(`serviceAppsCommand`),value:t},{label:A(`serviceAppsCwd`),value:e.cwd},{label:A(`serviceAppsManifest`),value:e.manifestPath},{label:A(`serviceAppsLastStarted`),value:e.lastStartedAt},{label:A(`serviceAppsLastReady`),value:e.lastReadyAt},{label:A(`serviceAppsLastFailed`),value:e.lastFailedAt}].filter(e=>e.value)}function ce({rows:e}){return(0,q.jsx)(`div`,{className:`border-t border-border/60 px-4 py-2.5`,children:(0,q.jsx)(`dl`,{className:`grid grid-cols-[4.75rem_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs`,children:e.map(e=>(0,q.jsx)(le,{label:e.label,value:e.value},e.label))})})}function le({label:e,value:t}){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground/70`,children:e}),(0,q.jsx)(`dd`,{className:`min-w-0 truncate font-mono text-muted-foreground`,title:t,children:t})]})}var Z=[`service-apps`],Q=[`service-actions`],$=[`service-action-grants`],ue=[`app-data`];function de(){return r({queryKey:Z,queryFn:()=>n.serviceApps.listServiceApps()})}function fe(){return r({queryKey:Q,queryFn:()=>n.serviceApps.listServiceActions()})}function pe(){return r({queryKey:$,queryFn:()=>n.serviceApps.listServiceActionGrants()})}function me(){let e=s();return a({mutationFn:e=>n.serviceApps.restartServiceApp(e),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Z}),e.invalidateQueries({queryKey:Q})])}})}function he(){let e=s();return a({mutationFn:e=>n.serviceApps.deleteServiceApp(e.appId,e.purgeData),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Z}),e.invalidateQueries({queryKey:Q}),e.invalidateQueries({queryKey:$}),e.invalidateQueries({queryKey:ue})])}})}function ge(){let e=s();return a({mutationFn:e=>n.serviceApps.discoverServiceAppActions(e),onSuccess:async()=>{await e.invalidateQueries({queryKey:Z})}})}function _e(){let e=s();return a({mutationFn:e=>n.serviceApps.revokeServiceActionGrant(e),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Q}),e.invalidateQueries({queryKey:$})])}})}function ve(){let e=s();return a({mutationFn:e=>n.serviceApps.grantAgentServiceActions(e.agentId,e.actionIds),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Q}),e.invalidateQueries({queryKey:$})])}})}function ye({onManagePackage:e,resourceId:t}){let n=de(),r=p(),i=fe(),a=pe(),o=ee(),s=he(),c=me(),l=ge(),u=_e(),d=ve(),[f,m]=(0,K.useState)({}),[g,_]=(0,K.useState)({}),v=()=>{n.refetch(),i.refetch(),a.refetch(),r.refetch()};if(n.isLoading||i.isLoading||a.isLoading)return(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:A(`serviceAppsLoading`)});if(n.isError||i.isError||a.isError){let e=n.error??i.error??a.error;return(0,q.jsx)(`div`,{className:`p-4 text-sm text-rose-600`,children:e instanceof Error?e.message:A(`serviceAppsLoadFailed`)})}let y=(n.data?.entries??[]).filter(e=>!t||e.id===t);if(t&&!y.length)return(0,q.jsx)(`p`,{role:`alert`,className:`p-4`,children:A(`resourceNotFound`)});let b=n.data?.diagnostics??[],x=i.data?.actions??[],S=a.data?.grants??[],C=e=>{l.mutateAsync(e).then(t=>{m(n=>({...n,[e]:t.actions})),_(t=>({...t,[e]:!0}))})},w=(r.data?.entries??[]).filter(e=>e.source===`workspace-service`&&e.lifecycle===`active`);return(0,q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-card text-card-foreground`,children:[(0,q.jsx)(`div`,{className:`flex min-h-12 shrink-0 items-center justify-end border-b border-border/60 px-4 py-2`,children:(0,q.jsx)(M,{delayDuration:250,children:(0,q.jsxs)(F,{children:[(0,q.jsx)(N,{asChild:!0,children:(0,q.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,"aria-label":A(`serviceAppsRefresh`),onClick:v,children:(0,q.jsx)(O,{className:`h-3.5 w-3.5`})})}),(0,q.jsx)(B,{side:`bottom`,className:`text-xs`,children:A(`serviceAppsRefresh`)})]})})}),b.length>0?(0,q.jsxs)(`div`,{role:`alert`,className:`mx-3 mt-3 rounded-xl border border-destructive/20 bg-destructive/5 px-3 py-2.5 text-xs text-destructive sm:mx-4`,children:[(0,q.jsx)(`div`,{className:`font-medium`,children:A(`serviceAppsLoadFailed`)}),(0,q.jsx)(`ul`,{className:`mt-1 space-y-1`,children:b.map(e=>(0,q.jsxs)(`li`,{className:`break-words`,children:[e.appId,`: `,e.message]},e.stagedPath))})]}):null,y.length===0?(0,q.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 py-8 text-center`,children:(0,q.jsxs)(`div`,{className:`w-full max-w-xs`,children:[(0,q.jsx)(`div`,{className:`mx-auto flex h-10 w-10 items-center justify-center rounded-xl bg-muted text-muted-foreground`,children:(0,q.jsx)(h,{className:`h-5 w-5`})}),(0,q.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-foreground`,children:A(`serviceAppsEmptyTitle`)}),(0,q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:A(`serviceAppsEmptyDescription`)})]})}):(0,q.jsx)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto p-3 sm:p-4`,children:(0,q.jsx)(`div`,{className:`overflow-hidden rounded-xl border border-border/70 bg-card`,children:y.map(n=>(0,q.jsx)(Y,{app:n,actions:f[n.id]??x.filter(e=>e.appId===n.id),actionsOpen:g[n.id]??!!t,grants:S,agents:o.data?.agents??[],deletePending:s.isPending,deleteError:s.error,dataEntry:w.find(e=>e.appId===n.id),dataLoading:r.isLoading,isDiscovering:l.isPending,onActionsOpenChange:e=>_(t=>({...t,[n.id]:e})),onDiscover:C,onManagePackage:e,onDelete:(e,t,n)=>void s.mutate({appId:e,purgeData:t},{onSuccess:n}),onResetDelete:s.reset,onRestart:e=>void c.mutate(e),onRevoke:e=>void u.mutate({actionId:e.actionId,caller:e.caller}),onGrantAgent:(e,t)=>void d.mutate({actionIds:[e],agentId:t}),grantAgentPending:d.isPending},n.id))})})]})}export{ye as ServiceAppsPanel};
|
|
1
|
+
import{i as e}from"./chunk-DF37yw5_.js";import{S as t}from"./theme-provider-DDJOlUxn.js";import{Lt as n,Qn as r,Yt as i,Zn as a,_n as o,lr as s,ur as c,xr as l}from"./api-BaML_txv.js";import{$t as u,Ft as d,It as f,Pt as p,d as m,en as h,m as g,rn as _,zt as ee}from"./app-presenter-provider-DSlY9Lz6.js";import{t as v}from"./createLucideIcon-D-7Sxfw7.js";import{G as y,W as b,g as x,h as S,lt as C,vt as w}from"./context-menu-DVgLoPqH.js";import{z as T}from"./dist-BxOjfeaD.js";import{t as E}from"./circle-dashed-pgOOTUik.js";import{i as D}from"./x-DLvS4xvV.js";import{t as O}from"./refresh-cw-CqsHJPqR.js";import{t as k}from"./trash-2-B8mbrtCx.js";import{s as A}from"./i18n-Bzo4IocH.js";import{a as j,d as M,f as N,i as P,l as F,n as I,o as L,r as R,t as z,u as B}from"./dialog-InO6RVpm.js";import{g as V,h as H,p as U}from"./provider-models-CWtoV3BJ.js";var W=v(`CirclePause`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]]),te=v(`Radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]),G=v(`ShieldPlus`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M9 12h6`,key:`1c52cq`}],[`path`,{d:`M12 9v6`,key:`199k2o`}]]),ne=v(`Unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),K=e(l(),1),q=c();function re({appId:e,appTitle:t,dataEntry:n,dataLoading:r,deleteError:a,deletePending:o,open:s,purgeData:c,onDelete:l,onOpenChange:u,onPurgeDataChange:p}){let m=(0,K.useRef)(null);(0,K.useEffect)(()=>{a&&m.current?.focus()},[a]);let h=()=>u(!1);return(0,q.jsx)(z,{open:s,onOpenChange:e=>!o&&u(e),children:(0,q.jsxs)(I,{className:`max-w-md`,onEscapeKeyDown:e=>o&&e.preventDefault(),onInteractOutside:e=>o&&e.preventDefault(),children:[(0,q.jsxs)(j,{showClose:!1,children:[(0,q.jsx)(L,{children:A(`serviceAppsDeleteConfirmTitle`)}),(0,q.jsxs)(R,{children:[A(`serviceAppsDeleteConfirmDescription`),` `,t]})]}),(0,q.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,q.jsx)(f,{checked:!c,description:A(`serviceAppsKeepDataDescription`),label:A(`appPackagesKeepData`),onClick:()=>p(!1)}),(0,q.jsx)(f,{checked:c,destructive:!0,disabled:!n||r,description:A(`serviceAppsDeleteDataDescription`),label:A(`appPackagesDeleteData`),onClick:()=>p(!0)})]}),n?(0,q.jsx)(`div`,{className:`mt-3`,children:(0,q.jsx)(d,{storage:n.storage,usage:n.usage})}):(0,q.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-muted-foreground`,children:A(r?`appPackagesLoading`:`serviceAppsDataUnavailable`)}),a?(0,q.jsx)(`p`,{ref:m,role:`alert`,tabIndex:-1,className:`mt-3 text-xs text-destructive`,children:a instanceof Error?a.message:A(`appPackagesActionFailed`)}):null,(0,q.jsxs)(P,{className:`mt-5 gap-2 sm:gap-0`,children:[(0,q.jsx)(i,{autoFocus:!0,type:`button`,variant:`outline`,disabled:o,onClick:h,children:A(`cancel`)}),(0,q.jsxs)(i,{type:`button`,variant:c?`destructive`:`default`,disabled:o||c&&!n,onClick:()=>l(e,c,h),children:[o?(0,q.jsx)(D,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}):null,A(c?`appDataDeletePermanently`:`serviceAppsDelete`)]})]})]})})}function ie({action:e,grants:t,agents:n,grantAgentPending:r,onGrantAgent:i,onRevoke:a}){let[o,s]=(0,K.useState)(!1),c=new Set(t.flatMap(e=>e.caller.surface===`agent`?[e.caller.agentId]:[])),l=n.filter(e=>!c.has(e.id));return(0,q.jsxs)(`div`,{className:`py-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`flex h-6 w-6 shrink-0 items-center justify-center text-muted-foreground`,children:(0,q.jsx)(b,{className:`h-3.5 w-3.5`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`div`,{className:`truncate text-xs font-medium text-foreground`,children:e.title??e.name}),e.description?(0,q.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:e.description}):null]})]}),(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[e.runtimeState?(0,q.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:A(`serviceAppsRuntimeState_${e.runtimeState}`)}):null,(0,q.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.risk}),(0,q.jsxs)(U,{open:o,onOpenChange:s,children:[(0,q.jsx)(V,{asChild:!0,children:(0,q.jsx)(`button`,{type:`button`,disabled:r||l.length===0,className:`ml-1 rounded-md p-1 text-muted-foreground/70 transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:cursor-not-allowed disabled:opacity-40`,title:A(`serviceAppsGrantToAgent`),"aria-label":A(`serviceAppsGrantToAgent`),children:(0,q.jsx)(G,{className:`h-3.5 w-3.5`})})}),(0,q.jsxs)(H,{align:`end`,variant:`menu`,children:[(0,q.jsx)(`div`,{className:`px-2 py-1.5 text-[11px] font-medium text-muted-foreground`,children:A(`serviceAppsGrantToAgent`)}),l.map(t=>(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{i(e.id,t.id),s(!1)},className:`${x} text-foreground ${S.item}`,children:[(0,q.jsx)(w,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,q.jsx)(`span`,{className:`min-w-0 truncate`,children:t.displayName?.trim()||t.id})]},t.id))]})]})]})]}),t.map(e=>(0,q.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-between gap-2 pl-8`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,q.jsx)(u,{className:`h-3 w-3 shrink-0 text-emerald-500`}),(0,q.jsxs)(`span`,{className:`truncate`,children:[A(`serviceAppsGrantedTo`),` `,J(e)]})]}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>a(e),className:`rounded-md p-1 text-muted-foreground/70 transition-colors hover:bg-[var(--interaction-hover)] hover:text-rose-600 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,title:A(`serviceAppsRevokeGrant`),"aria-label":A(`serviceAppsRevokeGrant`),children:(0,q.jsx)(k,{className:`h-3 w-3`})})]},`${e.caller.surface}:${J(e)}:${e.actionId}`))]})}function J(e){return e.caller.surface===`panel-app`?e.caller.appId:e.caller.agentId}function Y({app:e,actions:n,actionsOpen:r,grants:i,agents:a,deletePending:s,deleteError:c,dataEntry:l,dataLoading:u,isDiscovering:d,onActionsOpenChange:f,onDiscover:p,onManagePackage:_,onDelete:ee,onResetDelete:v,onRestart:y,onRevoke:b,onGrantAgent:x,grantAgentPending:S}){let[w,E]=(0,K.useState)(!1),[O,j]=(0,K.useState)(!1),[P,I]=(0,K.useState)(!1),[L,R]=(0,K.useState)(!1),z=e.status!==`starting`&&e.status!==`stopped`,W=e.status===`running`||e.status===`failed`,G=e.sourceKind===`package`?e.packageId:void 0,J=se(e),Y=()=>{E(!1),R(!1),v(),j(!0)};return(0,q.jsx)(M,{delayDuration:250,children:(0,q.jsxs)(`section`,{className:`group bg-card transition-colors hover:bg-[var(--interaction-hover)]`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-3 px-4 py-3.5`,children:[(0,q.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,q.jsx)(h,{className:`h-4 w-4`})}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.title}),(0,q.jsx)(ae,{status:e.status})]}),e.description?(0,q.jsx)(`div`,{className:`mt-1 truncate text-xs leading-5 text-muted-foreground`,children:e.description}):null,e.lastError?(0,q.jsx)(`div`,{className:`mt-1.5 truncate text-xs text-rose-600`,title:e.lastError,children:e.lastError}):null]}),(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[z?(0,q.jsxs)(F,{children:[(0,q.jsx)(N,{asChild:!0,children:(0,q.jsxs)(`button`,{type:`button`,disabled:d,className:`inline-flex h-7 items-center gap-1.5 rounded-md bg-foreground px-2.5 text-xs font-medium text-background transition-colors hover:bg-foreground/85 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-foreground/40 disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":A(`serviceAppsDiscoverActions`),onClick:()=>p(e.id),children:[d?(0,q.jsx)(D,{className:`h-3.5 w-3.5 animate-spin`}):(0,q.jsx)(te,{className:`h-3.5 w-3.5`}),(0,q.jsx)(`span`,{children:A(`serviceAppsConnect`)})]})}),(0,q.jsx)(B,{side:`bottom`,className:`max-w-56 text-xs`,children:A(`serviceAppsDiscoverActionsHint`)})]}):null,(0,q.jsxs)(U,{open:w,onOpenChange:E,children:[(0,q.jsxs)(F,{children:[(0,q.jsx)(N,{asChild:!0,children:(0,q.jsx)(V,{asChild:!0,children:(0,q.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:opacity-50`,"aria-label":A(`serviceAppsMoreActions`),disabled:s,children:(0,q.jsx)(C,{className:`h-3.5 w-3.5`})})})}),(0,q.jsx)(B,{side:`bottom`,className:`text-xs`,children:A(`serviceAppsMoreActions`)})]}),(0,q.jsxs)(H,{align:`end`,variant:`menu`,children:[(0,q.jsx)(`div`,{className:`my-1 h-px bg-border`}),(0,q.jsx)(X,{disabled:!W,icon:ne,label:A(`serviceAppsDisconnectRuntime`),onClick:()=>{E(!1),y(e.id)}}),G?(0,q.jsx)(X,{icon:t,label:A(`serviceAppsManagePackage`),onClick:()=>{E(!1),_(G)}}):(0,q.jsx)(X,{destructive:!0,disabled:s,icon:k,label:A(`serviceAppsDelete`),onClick:Y}),(0,q.jsx)(`div`,{className:`my-1 h-px bg-border`}),(0,q.jsx)(m,{page:g(`service-app`,e.id,e.title),onSelect:()=>E(!1)})]})]})]})]}),(0,q.jsxs)(`div`,{className:`border-t border-border/60`,children:[(0,q.jsxs)(`div`,{className:`flex items-stretch`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>f(!r),className:`flex min-w-0 flex-1 items-center justify-between gap-2 px-4 py-2 text-left text-xs text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border`,"aria-expanded":r,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`span`,{children:A(`serviceAppsActionsSection`)}),(0,q.jsx)(`span`,{className:`tabular-nums text-muted-foreground/70`,children:n.length})]}),(0,q.jsx)(T,{className:o(`h-3.5 w-3.5 shrink-0 text-muted-foreground/70 transition-transform`,r&&`rotate-180`)})]}),J.length>0?(0,q.jsxs)(`button`,{type:`button`,onClick:()=>I(e=>!e),className:`flex shrink-0 items-center gap-1 border-l border-border/60 px-3 text-xs text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border`,"aria-expanded":P,children:[(0,q.jsx)(`span`,{children:A(`serviceAppsDetails`)}),(0,q.jsx)(T,{className:o(`h-3.5 w-3.5 transition-transform`,P&&`rotate-180`)})]}):null]}),r?(0,q.jsx)(`div`,{className:`border-t border-border/60 px-4 py-2.5`,children:n.length===0?(0,q.jsx)(`div`,{className:`py-1 text-xs text-muted-foreground`,children:A(`serviceAppsActionsEmpty`)}):(0,q.jsx)(`div`,{className:`divide-y divide-border/50`,children:n.map(e=>(0,q.jsx)(ie,{action:e,grants:i.filter(t=>t.actionId===e.id),agents:a,grantAgentPending:S,onGrantAgent:x,onRevoke:b},e.id))})}):null,P?(0,q.jsx)(ce,{rows:J}):null]}),e.sourceKind===`package`?null:(0,q.jsx)(re,{appId:e.id,appTitle:e.title,dataEntry:l,dataLoading:u,deleteError:c,deletePending:s,open:O,purgeData:L,onDelete:ee,onOpenChange:j,onPurgeDataChange:R})]})})}function ae({status:e}){let t=oe(e),n=t.icon;return(0,q.jsxs)(F,{children:[(0,q.jsx)(N,{asChild:!0,children:(0,q.jsxs)(`span`,{className:o(`inline-flex shrink-0 items-center gap-1 text-xs`,t.className),"aria-label":t.label,children:[(0,q.jsx)(n,{className:o(`h-3 w-3`,t.iconClassName)}),(0,q.jsx)(`span`,{children:t.label})]})}),(0,q.jsx)(B,{side:`bottom`,className:`text-xs`,children:t.tooltip})]})}function oe(e){switch(e){case`running`:return{className:`text-emerald-700`,icon:_,label:A(`serviceAppsStatus_running`),tooltip:A(`serviceAppsStatusHint_running`)};case`starting`:return{className:`text-blue-700`,icon:D,iconClassName:`animate-spin`,label:A(`serviceAppsStatus_starting`),tooltip:A(`serviceAppsStatusHint_starting`)};case`failed`:return{className:`text-rose-700`,icon:y,label:A(`serviceAppsStatus_failed`),tooltip:A(`serviceAppsStatusHint_failed`)};case`stopped`:return{className:`text-muted-foreground`,icon:W,label:A(`serviceAppsStatus_stopped`),tooltip:A(`serviceAppsStatusHint_stopped`)};default:return{className:`text-muted-foreground`,icon:E,label:A(`serviceAppsStatus_idle`),tooltip:A(`serviceAppsStatusHint_idle`)}}}function X({destructive:e=!1,disabled:t=!1,icon:n,label:r,onClick:i}){return(0,q.jsxs)(`button`,{type:`button`,className:o(x,e?S.destructive:`text-foreground ${S.item}`),disabled:t,onClick:i,children:[(0,q.jsx)(n,{className:o(`h-4 w-4 shrink-0`,!e&&`text-muted-foreground`)}),(0,q.jsx)(`span`,{children:r})]})}function se(e){let t=[e.command,...e.args??[]].filter(e=>!!e?.trim()).join(` `);return[{label:A(`serviceAppsCommand`),value:t},{label:A(`serviceAppsCwd`),value:e.cwd},{label:A(`serviceAppsManifest`),value:e.manifestPath},{label:A(`serviceAppsLastStarted`),value:e.lastStartedAt},{label:A(`serviceAppsLastReady`),value:e.lastReadyAt},{label:A(`serviceAppsLastFailed`),value:e.lastFailedAt}].filter(e=>e.value)}function ce({rows:e}){return(0,q.jsx)(`div`,{className:`border-t border-border/60 px-4 py-2.5`,children:(0,q.jsx)(`dl`,{className:`grid grid-cols-[4.75rem_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs`,children:e.map(e=>(0,q.jsx)(le,{label:e.label,value:e.value},e.label))})})}function le({label:e,value:t}){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground/70`,children:e}),(0,q.jsx)(`dd`,{className:`min-w-0 truncate font-mono text-muted-foreground`,title:t,children:t})]})}var Z=[`service-apps`],Q=[`service-actions`],$=[`service-action-grants`],ue=[`app-data`];function de(){return r({queryKey:Z,queryFn:()=>n.serviceApps.listServiceApps()})}function fe(){return r({queryKey:Q,queryFn:()=>n.serviceApps.listServiceActions()})}function pe(){return r({queryKey:$,queryFn:()=>n.serviceApps.listServiceActionGrants()})}function me(){let e=s();return a({mutationFn:e=>n.serviceApps.restartServiceApp(e),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Z}),e.invalidateQueries({queryKey:Q})])}})}function he(){let e=s();return a({mutationFn:e=>n.serviceApps.deleteServiceApp(e.appId,e.purgeData),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Z}),e.invalidateQueries({queryKey:Q}),e.invalidateQueries({queryKey:$}),e.invalidateQueries({queryKey:ue})])}})}function ge(){let e=s();return a({mutationFn:e=>n.serviceApps.discoverServiceAppActions(e),onSuccess:async()=>{await e.invalidateQueries({queryKey:Z})}})}function _e(){let e=s();return a({mutationFn:e=>n.serviceApps.revokeServiceActionGrant(e),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Q}),e.invalidateQueries({queryKey:$})])}})}function ve(){let e=s();return a({mutationFn:e=>n.serviceApps.grantAgentServiceActions(e.agentId,e.actionIds),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Q}),e.invalidateQueries({queryKey:$})])}})}function ye({onManagePackage:e,resourceId:t}){let n=de(),r=p(),i=fe(),a=pe(),o=ee(),s=he(),c=me(),l=ge(),u=_e(),d=ve(),[f,m]=(0,K.useState)({}),[g,_]=(0,K.useState)({}),v=()=>{n.refetch(),i.refetch(),a.refetch(),r.refetch()};if(n.isLoading||i.isLoading||a.isLoading)return(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:A(`serviceAppsLoading`)});if(n.isError||i.isError||a.isError){let e=n.error??i.error??a.error;return(0,q.jsx)(`div`,{className:`p-4 text-sm text-rose-600`,children:e instanceof Error?e.message:A(`serviceAppsLoadFailed`)})}let y=(n.data?.entries??[]).filter(e=>!t||e.id===t);if(t&&!y.length)return(0,q.jsx)(`p`,{role:`alert`,className:`p-4`,children:A(`resourceNotFound`)});let b=n.data?.diagnostics??[],x=i.data?.actions??[],S=a.data?.grants??[],C=e=>{l.mutateAsync(e).then(t=>{m(n=>({...n,[e]:t.actions})),_(t=>({...t,[e]:!0}))})},w=(r.data?.entries??[]).filter(e=>e.source===`workspace-service`&&e.lifecycle===`active`);return(0,q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-card text-card-foreground`,children:[(0,q.jsx)(`div`,{className:`flex min-h-12 shrink-0 items-center justify-end border-b border-border/60 px-4 py-2`,children:(0,q.jsx)(M,{delayDuration:250,children:(0,q.jsxs)(F,{children:[(0,q.jsx)(N,{asChild:!0,children:(0,q.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,"aria-label":A(`serviceAppsRefresh`),onClick:v,children:(0,q.jsx)(O,{className:`h-3.5 w-3.5`})})}),(0,q.jsx)(B,{side:`bottom`,className:`text-xs`,children:A(`serviceAppsRefresh`)})]})})}),b.length>0?(0,q.jsxs)(`div`,{role:`alert`,className:`mx-3 mt-3 rounded-xl border border-destructive/20 bg-destructive/5 px-3 py-2.5 text-xs text-destructive sm:mx-4`,children:[(0,q.jsx)(`div`,{className:`font-medium`,children:A(`serviceAppsLoadFailed`)}),(0,q.jsx)(`ul`,{className:`mt-1 space-y-1`,children:b.map(e=>(0,q.jsxs)(`li`,{className:`break-words`,children:[e.appId,`: `,e.message]},e.stagedPath))})]}):null,y.length===0?(0,q.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 py-8 text-center`,children:(0,q.jsxs)(`div`,{className:`w-full max-w-xs`,children:[(0,q.jsx)(`div`,{className:`mx-auto flex h-10 w-10 items-center justify-center rounded-xl bg-muted text-muted-foreground`,children:(0,q.jsx)(h,{className:`h-5 w-5`})}),(0,q.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-foreground`,children:A(`serviceAppsEmptyTitle`)}),(0,q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:A(`serviceAppsEmptyDescription`)})]})}):(0,q.jsx)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto p-3 sm:p-4`,children:(0,q.jsx)(`div`,{className:`overflow-hidden rounded-xl border border-border/70 bg-card`,children:y.map(n=>(0,q.jsx)(Y,{app:n,actions:f[n.id]??x.filter(e=>e.appId===n.id),actionsOpen:g[n.id]??!!t,grants:S,agents:o.data?.agents??[],deletePending:s.isPending,deleteError:s.error,dataEntry:w.find(e=>e.appId===n.id),dataLoading:r.isLoading,isDiscovering:l.isPending,onActionsOpenChange:e=>_(t=>({...t,[n.id]:e})),onDiscover:C,onManagePackage:e,onDelete:(e,t,n)=>void s.mutate({appId:e,purgeData:t},{onSuccess:n}),onResetDelete:s.reset,onRestart:e=>void c.mutate(e),onRevoke:e=>void u.mutate({actionId:e.actionId,caller:e.caller}),onGrantAgent:(e,t)=>void d.mutate({actionIds:[e],agentId:t}),grantAgentPending:d.isPending},n.id))})})]})}export{ye as ServiceAppsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-
|
|
1
|
+
import{t as e}from"./createLucideIcon-D-7Sxfw7.js";var t=e(`Settings2`,[[`path`,{d:`M20 7h-9`,key:`3s1dr2`}],[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./chunk-DF37yw5_.js";import{_n as t,ur as n,xr as r}from"./api-
|
|
1
|
+
import{i as e}from"./chunk-DF37yw5_.js";import{_n as t,ur as n,xr as r}from"./api-BaML_txv.js";var i=e(r(),1),a=n();function o({name:e,src:n,className:r,imgClassName:o,fallback:s}){let[c,l]=(0,i.useState)(!1),u=!!n&&!c;return(0,a.jsx)(`div`,{className:t(`inline-flex shrink-0 items-center justify-center overflow-hidden`,r),children:u?(0,a.jsx)(`img`,{src:n,alt:`${e} logo`,className:t(`block h-6 w-6 object-contain`,o),onError:()=>l(!0),draggable:!1}):s??(0,a.jsx)(`span`,{className:`text-lg font-bold uppercase`,children:e.slice(0,1)})})}var s={active:{dot:`bg-emerald-500`,text:`text-emerald-600`,bg:`bg-emerald-50`},ready:{dot:`bg-emerald-500`,text:`text-emerald-600`,bg:`bg-emerald-50`},inactive:{dot:`bg-gray-300`,text:`text-gray-400`,bg:`bg-gray-100/80`},setup:{dot:`bg-gray-300`,text:`text-gray-400`,bg:`bg-gray-100/80`},warning:{dot:`bg-amber-400`,text:`text-amber-600`,bg:`bg-amber-50`}};function c({status:e,label:n,className:r}){let i=s[e];return(0,a.jsxs)(`div`,{className:t(`inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-2 py-0.5`,i.bg,r),children:[(0,a.jsx)(`span`,{className:t(`h-1.5 w-1.5 rounded-full`,i.dot)}),(0,a.jsx)(`span`,{className:t(`text-[11px] font-medium`,i.text),children:n})]})}export{o as n,c as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./chunk-DF37yw5_.js";import{_n as t,gn as n,ur as r,xr as i}from"./api-
|
|
1
|
+
import{i as e}from"./chunk-DF37yw5_.js";import{_n as t,gn as n,ur as r,xr as i}from"./api-BaML_txv.js";var a={telegram:`telegram.svg`,slack:`slack.svg`,discord:`discord.svg`,whatsapp:`whatsapp.svg`,qq:`qq.svg`,feishu:`feishu.svg`,dingtalk:`dingtalk.svg`,wecom:`wecom.svg`,weixin:`weixin.svg`,email:`email.svg`};function o(e,t){let n=e[t.toLowerCase()];return n?`/logos/${n}`:null}function s(e){return o(a,e)}var c=e(i(),1),l=r(),u=c.createContext(null);function d({defaultValue:e,value:t,onValueChange:n,children:r}){return(0,l.jsx)(u.Provider,{value:{value:t,onValueChange:n},children:r})}function f({children:e,className:n}){return(0,l.jsx)(`div`,{role:`tablist`,onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;let t=Array.from(e.currentTarget.querySelectorAll(`[role="tab"]:not(:disabled)`));if(t.length===0)return;let n=t.indexOf(document.activeElement),r=e.key===`Home`?0:e.key===`End`?t.length-1:e.key===`ArrowRight`?(Math.max(n,-1)+1)%t.length:(n<=0?t.length:n)-1;e.preventDefault(),t[r]?.focus(),t[r]?.click()},className:t(`inline-flex h-9 max-md:h-auto items-center justify-center rounded-xl bg-muted p-1 text-muted-foreground`,n),children:e})}function p({value:e,children:n,className:r}){let i=c.useContext(u);if(!i)throw Error(`TabsTrigger must be used within Tabs`);let a=i.value===e;return(0,l.jsx)(`button`,{type:`button`,onClick:()=>i.onValueChange(e),role:`tab`,"aria-selected":a,tabIndex:a?0:-1,"data-state":a?`active`:`inactive`,className:t(`inline-flex max-md:min-h-[var(--control-touch-size)] items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-[13px] font-medium transition-all duration-fast focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:pointer-events-none disabled:opacity-50`,a?`bg-[var(--interaction-selection)] text-foreground`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,r),children:n})}function m({value:e,children:n,className:r}){let i=c.useContext(u);if(!i)throw Error(`TabsContent must be used within Tabs`);return i.value===e?(0,l.jsx)(`div`,{className:t(`mt-2 animate-fade-in`,r),children:n}):null}var h=n(`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium`,{variants:{tone:{subtle:`border-gray-200 bg-gray-50 text-gray-600`,neutral:`border-gray-200 bg-white text-gray-600`,success:`border-emerald-200 bg-emerald-50 text-emerald-700`,warning:`border-amber-200 bg-amber-50 text-amber-800`,danger:`border-rose-200 bg-rose-50 text-rose-600`,info:`border-primary/20 bg-primary/10 text-primary`}},defaultVariants:{tone:`subtle`}}),g=c.forwardRef(({className:e,tone:n,...r},i)=>(0,l.jsx)(`span`,{ref:i,className:t(h({tone:n}),e),...r}));g.displayName=`TagChip`;export{p as a,f as i,d as n,s as o,m as r,g as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./chunk-DF37yw5_.js";import{Lt as t,Qn as n,Sn as r,Xn as i,Yt as a,Zn as o,fn as s,hn as c,lr as l,ur as ee,xr as u}from"./api-CI6_8Qt1.js";import{t as d}from"./createLucideIcon-reFMl-W-.js";import{J as te}from"./context-menu-dGVv8klA.js";import{d as ne,f as re,l as f,p,s as m}from"./i18n-IGQbjBqS.js";import{a as ie,i as ae,n as oe,o as h,r as se,t as ce}from"./dialog-DLOwdjT1.js";import{n as g}from"./navigation-history-CCnxsAKR.js";var _=`nextclaw.ui.theme`,v=`default`,le=`plain-paper`;function y(e){return e===`default`?le:e}var b=[{value:`default`,labelKey:`themeDefault`,appearance:`light`},{value:`plain-paper`,labelKey:`themePlainPaper`,appearance:`light`},{value:`paper-ink`,labelKey:`themePaperInk`,appearance:`light`},{value:`work`,labelKey:`themeWork`,appearance:`light`},{value:`night`,labelKey:`themeNight`,appearance:`dark`},{value:`charcoal`,labelKey:`themeCharcoal`,appearance:`dark`},{value:`island`,labelKey:`themeIsland`,appearance:`light`},{value:`natural`,labelKey:`themeNatural`,appearance:`light`},{value:`minimal`,labelKey:`themeMinimal`,appearance:`light`},{value:`warm`,labelKey:`themeWarm`,appearance:`light`},{value:`cool`,labelKey:`themeCool`,appearance:`light`},{value:`dawn`,labelKey:`themeDawn`,appearance:`light`},{value:`graphite`,labelKey:`themeGraphite`,appearance:`light`},{value:`probe`,labelKey:`themeProbe`,appearance:`light`}],ue=b.map(({value:e})=>e),de=b.map(({value:e,labelKey:t})=>({value:e,labelKey:t}));function x(e){return typeof e==`string`?ue.includes(e)?e:e===`leaf`?`warm`:null:null}function S(e){return b.find(t=>t.value===y(e))?.appearance??`light`}var C=new class{constructor(){this.activeTheme=v,this.initialized=!1,this.listeners=new Set,this.resolveInitialTheme=()=>{if(typeof window>`u`)return v;try{let e=x(window.localStorage.getItem(_));if(e)return e}catch{}return v},this.initializeTheme=()=>(this.initialized||=(this.activeTheme=this.resolveInitialTheme(),this.applyThemeAttribute(this.activeTheme),!0),this.activeTheme),this.getTheme=()=>this.initialized?this.activeTheme:this.initializeTheme(),this.setTheme=e=>{this.initializeTheme(),e!==this.activeTheme&&(this.activeTheme=e,this.applyThemeAttribute(this.activeTheme),this.saveTheme(this.activeTheme),this.listeners.forEach(e=>e(this.activeTheme)))},this.subscribeThemeChange=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}),this.applyThemeAttribute=e=>{if(typeof document>`u`)return;let t=S(e);document.documentElement.setAttribute(`data-theme`,y(e)),document.documentElement.setAttribute(`data-theme-appearance`,t),document.documentElement.style.colorScheme=t},this.saveTheme=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(_,e)}catch{}}}};function w(){return C.initializeTheme()}function fe(){return C.getTheme()}function pe(e){C.setTheme(e)}function me(e){return C.subscribeThemeChange(e)}var T=d(`Boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),E=d(`ShieldAlert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),D=class{constructor(e){this.authorizationManager=e,this.handleIframeMessage=({event:e,iframe:t})=>{this.isBridgeRequest(e.data)&&(!t?.contentWindow||e.source!==t.contentWindow||this.handleBridgeRequest({event:e,iframe:t},e.data))},this.handleBridgeRequest=async(e,t)=>{try{let n=this.getBridgeContext(t),r=await this.dispatchRequest(n,t);this.postResponse(e,{type:`nextclaw:panel-app-service-actions:response`,requestId:t.requestId,ok:!0,data:r})}catch(n){this.postResponse(e,{type:`nextclaw:panel-app-service-actions:response`,requestId:t.requestId,ok:!1,error:this.toBridgeError(n)})}},this.dispatchRequest=async(e,n)=>{switch(n.method){case`list`:return await t.serviceApps.listServiceActions({bridgeSessionToken:e.token});case`requestGrant`:return await this.confirmAndGrant(e,this.requireActionId(n));case`revokeGrant`:return await t.serviceApps.revokeServiceAction(this.requireActionId(n),{bridgeSessionToken:e.token});case`invoke`:return await this.invokeWithAuthorization(e,n);case`agent.send`:return await this.sendAgentMessageWithAuthorization(e,n);case`agent.generateObject`:return await this.generateAgentObjectWithAuthorization(e,n);case`verification.list`:return await t.serviceApps.listVerificationRecords({acceptanceId:n.payload?.acceptanceId,appId:n.payload?.appId,limit:n.payload?.limit,bridgeSessionToken:e.token});case`acceptance.status`:return await t.serviceApps.getPortableRuntimeAcceptanceStatus({appId:n.payload?.appId,locale:n.payload?.locale,bridgeSessionToken:e.token});case`acceptance.export`:return await t.serviceApps.exportPortableRuntimeAcceptance({appId:n.payload?.appId,locale:n.payload?.locale,bridgeSessionToken:e.token});default:throw Error(`Unsupported panel bridge method: ${String(n.method)}`)}},this.invokeWithAuthorization=async(e,n)=>{let r=this.requireActionId(n);try{return await t.serviceApps.invokeServiceAction(r,this.readOptionalRecord(n.payload?.input),{bridgeSessionToken:e.token})}catch(i){if(!(i instanceof c)||i.code!==`AUTHORIZATION_REQUIRED`)throw i;return await this.confirmAndGrant(e,r,this.readOptionalRecord(n.payload?.input)),await t.serviceApps.invokeServiceAction(r,this.readOptionalRecord(n.payload?.input),{bridgeSessionToken:e.token})}},this.sendAgentMessageWithAuthorization=async(e,n)=>{try{return await t.panelApps.sendAgentMessage(this.readAgentSendRequest(n),{bridgeSessionToken:e.token})}catch(r){if(!(r instanceof c)||r.code!==`AUTHORIZATION_REQUIRED`)throw r;return await this.confirmAndGrantAgentCapability(e,`agent:send`),await t.panelApps.sendAgentMessage(this.readAgentSendRequest(n),{bridgeSessionToken:e.token})}},this.generateAgentObjectWithAuthorization=async(e,n)=>{try{return await t.panelApps.generateAgentObject(this.readGenerateObjectRequest(n),{bridgeSessionToken:e.token})}catch(r){if(!(r instanceof c)||r.code!==`AUTHORIZATION_REQUIRED`)throw r;return await this.confirmAndGrantAgentCapability(e,`agent:generateObject`),await t.panelApps.generateAgentObject(this.readGenerateObjectRequest(n),{bridgeSessionToken:e.token})}},this.confirmAndGrantAgentCapability=async(e,n)=>{if(!await this.authorizationManager.requestAuthorization({panelAppId:e.appId,actions:[{actionId:n,actionTitle:n===`agent:send`?`Send agent message`:`Generate object`,actionDescription:n===`agent:send`?`Send a message to a NextClaw Agent session.`:`Send context to a NextClaw Agent session and receive a structured object.`,risk:`write`}]}))throw new c({code:`AUTHORIZATION_REJECTED`,message:`Permission rejected for ${n}.`});return await t.panelApps.grantAgentCapability(n,{bridgeSessionToken:e.token})},this.confirmAndGrant=async(e,n,r)=>{let i=await this.listGrantCandidateActions(e,n);if(!await this.authorizationManager.requestAuthorization({panelAppId:e.appId,actions:i.map(e=>({actionId:e.id,actionTitle:e.title,actionDescription:e.description,risk:e.risk})),inputPreview:this.createInputPreview(r)}))throw new c({code:`AUTHORIZATION_REJECTED`,message:`Permission rejected for ${n}.`});let a=await t.serviceApps.grantServiceActions(i.map(e=>e.id),{bridgeSessionToken:e.token}),o=a.grants.find(e=>e.actionId===n)??a.grants[0];if(!o)throw Error(`No permission grant returned for ${n}.`);return o},this.listGrantCandidateActions=async(e,n)=>{let r=await t.serviceApps.listServiceActions({bridgeSessionToken:e.token}),i=r.actions.find(e=>e.id===n);if(i&&i.grantState!==`not-granted`)return[i];let a=r.actions.filter(e=>e.grantState===`not-granted`),o=[...a.filter(e=>e.id===n),...a.filter(e=>e.id!==n)];return o.length>0?o:[{appId:i?.appId??n.split(`.`)[0]??n,description:i?.description,id:n,name:i?.name??n,risk:i?.risk??`dangerous`,title:i?.title}]},this.createInputPreview=e=>{if(!(!e||Object.keys(e).length===0))try{let t=JSON.stringify(e,null,2);return t.length>500?`${t.slice(0,500)}...`:t}catch{return`[unserializable input]`}},this.getBridgeContext=e=>({appId:e.appId,token:e.runtimeToken}),this.requireActionId=e=>{let t=e.payload?.actionId?.trim();if(!t)throw Error(`Panel bridge actionId is required.`);return t},this.readOptionalRecord=e=>{if(e!==void 0)return this.requireRecord(e,`input`)},this.readAgentSendRequest=e=>({payload:this.requireRecord(e.payload?.request,`agent.send request`)}),this.readGenerateObjectRequest=e=>({input:this.requireRecord(e.payload?.input,`generateObject input`)}),this.requireRecord=(e,t)=>{if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`${t} is required.`);return e},this.postResponse=(e,t)=>{e.iframe?.contentWindow?.postMessage(t,`*`)},this.toBridgeError=e=>e instanceof c?{code:e.code,message:e.message,details:e.details}:{message:e instanceof Error?e.message:String(e)},this.isBridgeRequest=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`nextclaw:panel-app-service-actions:request`&&typeof t.requestId==`string`&&typeof t.runtimeToken==`string`&&typeof t.appId==`string`&&(t.method===`invoke`||t.method===`agent.send`||t.method===`agent.generateObject`||t.method===`acceptance.export`||t.method===`acceptance.status`||t.method===`list`||t.method===`requestGrant`||t.method===`revokeGrant`||t.method===`verification.list`)}}};function he(){return`service-action-auth-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}var O=s((e,t)=>({pending:null,requestAuthorization:async n=>await new Promise(r=>{t().pending?.resolve(!1),e({pending:{id:he(),...n,resolve:r}})}),resolveAuthorization:n=>{let{pending:r}=t();r&&(r.resolve(n),e({pending:null}))}})),ge=class{constructor(){this.requestAuthorization=async e=>await O.getState().requestAuthorization(e)}},k=class{constructor(){this.serviceActionAuthorizationManager=new ge,this.panelAppBridgeManager=new D(this.serviceActionAuthorizationManager)}},A=e(u(),1),j=ee(),M=globalThis,N=M.__NEXTCLAW_PANEL_APP_HOST_CONTEXT__??(0,A.createContext)(null);M.__NEXTCLAW_PANEL_APP_HOST_CONTEXT__=N;function P({children:e,presenter:t}){let n=(0,A.useMemo)(()=>t??new k,[t]);return(0,j.jsx)(N.Provider,{value:n,children:e})}function F(){let e=(0,A.useContext)(N);if(!e)throw Error(`usePanelAppHostPresenter must be used inside PanelAppHostProvider`);return e}var I=[`panel-apps`],L=[`panel-app`];function R(e,t){return e.id===t||e.appId===t}function z(e,t,n){return e&&{...e,entries:e.entries.map(e=>R(e,t)?n(e):e)}}function B(e,t){return z(e,t.id,()=>t)}function V(e,t){let n=e?.entries.reduce((e,t)=>Math.max(e,t.mainSidebarOrder??-1),-1)??-1;return z(e,t.id,e=>({...e,...typeof t.preferences.favorite==`boolean`?{favorite:t.preferences.favorite}:{},...typeof t.preferences.mainSidebar==`boolean`?t.preferences.mainSidebar?{mainSidebar:!0,mainSidebarOrder:e.mainSidebar?e.mainSidebarOrder:n+1}:{mainSidebar:!1,mainSidebarOrder:void 0}:{}}))}function _e(e={}){return n({queryKey:I,queryFn:()=>t.panelApps.listPanelApps(),enabled:e.enabled??!0,staleTime:0})}function H(e,r={}){return n({queryKey:[...L,e],queryFn:()=>t.panelApps.getPanelApp(e),enabled:!!e&&(r.enabled??!0),staleTime:5e3})}function ve(){let e=l();return o({mutationFn:({id:e,preferences:n})=>t.panelApps.updatePanelAppPreferences(e,n),onMutate:async t=>{await e.cancelQueries({queryKey:I});let n=e.getQueryData(I)?.entries.find(e=>R(e,t.id));return e.setQueryData(I,e=>V(e,t)),{previousEntry:n}},onSuccess:t=>{e.setQueryData(I,e=>B(e,t)),e.setQueryData([...L,t.appId],t)},onError:(t,n,r)=>{let a=r?.previousEntry;a&&e.setQueryData(I,e=>z(e,n.id,()=>a));let o=t instanceof Error?t.message:String(t);i.error(`${m(`panelAppsPreferenceUpdateFailed`)}: ${o}`)}})}function ye(){let e=l();return o({mutationFn:e=>t.panelApps.recordPanelAppOpened(e),onSuccess:t=>{e.setQueryData(I,e=>B(e,t)),e.setQueryData([...L,t.appId],t)}})}function U(){let e=l();return o({mutationFn:e=>t.panelApps.grantClient(e),onSuccess:()=>{e.invalidateQueries({queryKey:I}),e.invalidateQueries({queryKey:L})}})}function be(){let e=l();return o({mutationFn:e=>t.panelApps.deletePanelApp(e),onSuccess:()=>{e.invalidateQueries({queryKey:I}),e.invalidateQueries({queryKey:L})}})}function W(){let e=F(),{isPending:t,mutateAsync:n}=U(),r=(0,A.useRef)(new Map);return{ensurePanelAppClientGrant:(0,A.useCallback)(async t=>{if(!t.clientDeclared||t.clientGranted)return!0;let i=r.current.get(t.appId);if(i)return await i;let a=(async()=>await e.serviceActionAuthorizationManager.requestAuthorization({panelAppId:t.appId,actions:[{actionId:`nextclaw.client`,actionTitle:m(`panelAppsClientGrantTitle`),actionDescription:m(`panelAppsClientGrantDescription`),risk:`dangerous`}]})?(await n(t.appId),!0):!1)();r.current.set(t.appId,a);try{return await a}finally{r.current.delete(t.appId)}},[n,e]),isPending:t}}function xe(e){let r=l(),i=(0,A.useId)(),{ensurePanelAppClientGrant:a}=W(),o=!!(e?.clientDeclared&&!e.clientGranted),s=n({queryKey:[`panel-app-client-grant`,e?.appId??`none`,e?.clientGranted??!1],queryFn:async()=>await a(e),enabled:o,gcTime:0,retry:!1,staleTime:1/0}),c=e?o?s.isError?`error`:s.isPending?`checking`:s.data?`allowed`:`denied`:`allowed`:`idle`;return n({queryKey:[`panel-app-open`,i,e?.appId??`none`],queryFn:async()=>{let n=await t.panelApps.recordPanelAppOpened(e.id);return r.setQueryData(I,e=>B(e,n)),r.setQueryData([...L,n.appId],n),n},enabled:!!(e&&c===`allowed`),retry:!1,staleTime:1/0}),{retryClientGrant:s.refetch,state:c}}var G=`allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-downloads allow-pointer-lock allow-presentation`;function K(e){e?.focus({preventScroll:!0}),e?.contentWindow?.focus()}function q(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.kind===`document`?!0:t.kind===`element`&&Array.isArray(t.path)&&t.path.length>0&&t.path.length<=30&&t.path.every(e=>typeof e?.index==`number`&&Number.isInteger(e.index)&&e.index>=0&&e.index<=1e3&&typeof e.tagName==`string`&&e.tagName.length>0&&e.tagName.length<=32)}function Se(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.currentUrl==`string`&&q(t.target)}function Ce(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.type===r.scrollMessageType&&t.version===r.version&&q(t.target)&&typeof t.x==`number`&&Number.isFinite(t.x)&&t.x>=0&&typeof t.y==`number`&&Number.isFinite(t.y)&&t.y>=0}function J({currentUrl:e,iframeRef:t,isEnabled:n,restorationKey:i}){let a=i&&e?JSON.stringify([i,e]):null;return(0,A.useEffect)(()=>{if(!e||!n||!a)return;let r=a,i=n=>{n.source!==t.current?.contentWindow||!Ce(n.data)||g.save(r,{x:n.data.x,y:n.data.y,payload:{currentUrl:e,target:n.data.target}})};return window.addEventListener(`message`,i),()=>window.removeEventListener(`message`,i)},[e,t,n,a]),(0,A.useCallback)(()=>{if(!e||!n||!a)return;let i=g.read(a);!i||!Se(i.payload)||i.payload.currentUrl!==e||t.current?.contentWindow?.postMessage({type:r.restoreScrollMessageType,version:r.version,target:i.payload.target,x:i.x,y:i.y},`*`)},[e,t,n,a])}function Y({appId:e,restorationScope:t,unavailableAction:n}){let r=F(),i=H(e),a=(0,A.useRef)(null),o=(0,A.useMemo)(()=>i.data,[i.data]),s=xe(o),c=J({currentUrl:o?.contentPath??null,iframeRef:a,isEnabled:!!o,restorationKey:o?`panel-app:${t}:${o.appId}`:null});return(0,A.useEffect)(()=>{let e=e=>{r.panelAppBridgeManager.handleIframeMessage({event:e,iframe:a.current})};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[r]),i.isLoading?(0,j.jsx)(X,{message:m(`panelAppsLoading`)}):i.isError?(0,j.jsx)(X,{message:i.error instanceof Error?i.error.message:m(`panelAppsLoadFailed`),actionLabel:m(`panelAppsTryAgain`),onAction:()=>void i.refetch()}):o?s.state===`checking`||s.state===`idle`?(0,j.jsx)(X,{message:m(`panelAppsCheckingPermission`)}):s.state===`denied`||s.state===`error`?(0,j.jsx)(X,{message:s.state===`denied`?m(`panelAppsPermissionDenied`):m(`panelAppsPermissionFailed`),actionLabel:m(`panelAppsTryAgain`),onAction:()=>void s.retryClientGrant()}):(0,j.jsx)(`div`,{className:`h-full min-h-0 bg-background`,children:(0,j.jsx)(`iframe`,{ref:a,src:o.contentPath,title:o.title,sandbox:G,className:`block h-full w-full border-0 bg-background`,onLoad:c,onPointerOver:e=>K(e.currentTarget)},o.appId)}):(0,j.jsx)(X,{message:m(`panelAppsMainUnavailable`),actionLabel:n?.label,onAction:n?.onAction})}function X({actionLabel:e,message:t,onAction:n}){return(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-background px-6 text-center`,children:(0,j.jsxs)(`div`,{className:`max-w-sm`,children:[(0,j.jsx)(`div`,{className:`mx-auto flex h-10 w-10 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:n?(0,j.jsx)(te,{className:`h-5 w-5`}):(0,j.jsx)(T,{className:`h-5 w-5`})}),(0,j.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-muted-foreground`,children:t}),e&&n?(0,j.jsx)(`button`,{type:`button`,className:`mt-4 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:n,children:e}):null]})})}var Z=(0,A.createContext)(null);function we({children:e}){let[t,n]=(0,A.useState)(()=>ne());(0,A.useEffect)(()=>p(e=>{n(e)}),[]);let r=(0,A.useCallback)(e=>{re(e),n(f())},[]),i=(0,A.useCallback)(()=>{r(t===`en`?`zh`:`en`)},[t,r]),a=(0,A.useMemo)(()=>({language:t,setLanguage:r,toggleLanguage:i}),[t,r,i]);return(0,j.jsx)(Z.Provider,{value:a,children:e})}function Te(){let e=(0,A.useContext)(Z);if(!e)throw Error(`useI18n must be used within I18nProvider`);return{...e,t:m}}function Ee({appId:e}){let t=H(e),n=(0,A.useMemo)(()=>t.data,[t.data]);return(0,A.useEffect)(()=>{let e=document.title;return document.title=`${n?.title??m(`panelAppsTitle`)} · NextClaw`,()=>{document.title=e}},[n?.title]),(0,j.jsx)(`main`,{className:`h-dvh min-h-0 w-full overflow-hidden bg-background`,children:(0,j.jsx)(Y,{appId:e,restorationScope:`standalone`})})}function De(){let e=O(e=>e.pending),t=O(e=>e.resolveAuthorization);return(0,j.jsx)(ce,{open:!!e,onOpenChange:e=>{e||t(!1)},children:(0,j.jsxs)(oe,{children:[(0,j.jsxs)(ie,{showClose:!1,children:[(0,j.jsxs)(h,{className:`flex items-center gap-2`,children:[(0,j.jsx)(E,{className:`h-4 w-4 text-amber-600`}),m(`serviceActionAuthorizationTitle`)]}),(0,j.jsx)(se,{children:m(`serviceActionAuthorizationDescription`)})]}),e?(0,j.jsxs)(`div`,{className:`space-y-3 rounded-md border border-border bg-muted/60 p-3 text-sm`,children:[(0,j.jsx)(Q,{label:m(`serviceActionAuthorizationSource`),value:e.panelAppId}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:m(`serviceActionAuthorizationActions`)}),(0,j.jsx)(`div`,{className:`max-h-64 space-y-2 overflow-auto`,children:e.actions.map(e=>(0,j.jsx)(Oe,{action:e},e.actionId))})]}),e.inputPreview?(0,j.jsx)(Q,{label:m(`serviceActionAuthorizationInput`),value:e.inputPreview}):null]}):null,(0,j.jsxs)(ae,{className:`gap-2 sm:gap-0`,children:[(0,j.jsx)(a,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:m(`serviceActionAuthorizationReject`)}),(0,j.jsx)(a,{type:`button`,onClick:()=>t(!0),children:m(`serviceActionAuthorizationAllow`)})]})]})})}function Oe({action:e}){return(0,j.jsxs)(`div`,{className:`space-y-1 rounded border border-border bg-card px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,j.jsx)(`div`,{className:`min-w-0 break-words text-xs font-medium text-foreground`,children:e.actionTitle??e.actionId}),(0,j.jsx)(`div`,{className:`shrink-0 rounded bg-amber-50 px-1.5 py-0.5 text-[11px] font-medium text-amber-700`,children:e.risk??`dangerous`})]}),(0,j.jsx)(`div`,{className:`break-words text-[11px] text-muted-foreground`,children:e.actionId}),e.actionDescription?(0,j.jsx)(`div`,{className:`break-words text-xs text-muted-foreground`,children:e.actionDescription}):null]})}function Q({label:e,value:t}){return(0,j.jsxs)(`div`,{className:`grid grid-cols-[5rem_minmax(0,1fr)] gap-3`,children:[(0,j.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:e}),(0,j.jsx)(`div`,{className:`min-w-0 break-words text-xs text-foreground`,children:t})]})}var $=(0,A.createContext)(null);function ke({children:e}){let[t,n]=(0,A.useState)(()=>w());(0,A.useEffect)(()=>me(e=>{n(e)}),[]);let r=(0,A.useCallback)(e=>{pe(e),n(fe())},[]),i=(0,A.useMemo)(()=>({theme:t,setTheme:r}),[t,r]);return(0,j.jsx)($.Provider,{value:i,children:e})}function Ae(){let e=(0,A.useContext)($);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}export{v as C,x as D,w as E,y as O,T as S,S as T,ve as _,we as a,D as b,J as c,W as d,be as f,ye as g,_e as h,Ee as i,G as l,H as m,Ae as n,Te as o,U as p,De as r,Y as s,ke as t,K as u,P as v,de as w,E as x,k as y};
|
|
1
|
+
import{i as e}from"./chunk-DF37yw5_.js";import{Lt as t,Qn as n,Sn as r,Xn as i,Yt as a,Zn as o,fn as s,hn as c,lr as l,ur as ee,xr as u}from"./api-BaML_txv.js";import{t as d}from"./createLucideIcon-D-7Sxfw7.js";import{J as te}from"./context-menu-DVgLoPqH.js";import{d as ne,f as re,l as f,p,s as m}from"./i18n-Bzo4IocH.js";import{a as ie,i as ae,n as oe,o as h,r as se,t as ce}from"./dialog-InO6RVpm.js";import{n as g}from"./navigation-history-CCnxsAKR.js";var _=`nextclaw.ui.theme`,v=`default`,le=`plain-paper`;function y(e){return e===`default`?le:e}var b=[{value:`default`,labelKey:`themeDefault`,appearance:`light`},{value:`plain-paper`,labelKey:`themePlainPaper`,appearance:`light`},{value:`paper-ink`,labelKey:`themePaperInk`,appearance:`light`},{value:`work`,labelKey:`themeWork`,appearance:`light`},{value:`night`,labelKey:`themeNight`,appearance:`dark`},{value:`charcoal`,labelKey:`themeCharcoal`,appearance:`dark`},{value:`island`,labelKey:`themeIsland`,appearance:`light`},{value:`natural`,labelKey:`themeNatural`,appearance:`light`},{value:`minimal`,labelKey:`themeMinimal`,appearance:`light`},{value:`warm`,labelKey:`themeWarm`,appearance:`light`},{value:`cool`,labelKey:`themeCool`,appearance:`light`},{value:`dawn`,labelKey:`themeDawn`,appearance:`light`},{value:`graphite`,labelKey:`themeGraphite`,appearance:`light`},{value:`probe`,labelKey:`themeProbe`,appearance:`light`}],ue=b.map(({value:e})=>e),de=b.map(({value:e,labelKey:t})=>({value:e,labelKey:t}));function x(e){return typeof e==`string`?ue.includes(e)?e:e===`leaf`?`warm`:null:null}function S(e){return b.find(t=>t.value===y(e))?.appearance??`light`}var C=new class{constructor(){this.activeTheme=v,this.initialized=!1,this.listeners=new Set,this.resolveInitialTheme=()=>{if(typeof window>`u`)return v;try{let e=x(window.localStorage.getItem(_));if(e)return e}catch{}return v},this.initializeTheme=()=>(this.initialized||=(this.activeTheme=this.resolveInitialTheme(),this.applyThemeAttribute(this.activeTheme),!0),this.activeTheme),this.getTheme=()=>this.initialized?this.activeTheme:this.initializeTheme(),this.setTheme=e=>{this.initializeTheme(),e!==this.activeTheme&&(this.activeTheme=e,this.applyThemeAttribute(this.activeTheme),this.saveTheme(this.activeTheme),this.listeners.forEach(e=>e(this.activeTheme)))},this.subscribeThemeChange=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}),this.applyThemeAttribute=e=>{if(typeof document>`u`)return;let t=S(e);document.documentElement.setAttribute(`data-theme`,y(e)),document.documentElement.setAttribute(`data-theme-appearance`,t),document.documentElement.style.colorScheme=t},this.saveTheme=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(_,e)}catch{}}}};function w(){return C.initializeTheme()}function fe(){return C.getTheme()}function pe(e){C.setTheme(e)}function me(e){return C.subscribeThemeChange(e)}var T=d(`Boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),E=d(`ShieldAlert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),D=class{constructor(e){this.authorizationManager=e,this.handleIframeMessage=({event:e,iframe:t})=>{this.isBridgeRequest(e.data)&&(!t?.contentWindow||e.source!==t.contentWindow||this.handleBridgeRequest({event:e,iframe:t},e.data))},this.handleBridgeRequest=async(e,t)=>{try{let n=this.getBridgeContext(t),r=await this.dispatchRequest(n,t);this.postResponse(e,{type:`nextclaw:panel-app-service-actions:response`,requestId:t.requestId,ok:!0,data:r})}catch(n){this.postResponse(e,{type:`nextclaw:panel-app-service-actions:response`,requestId:t.requestId,ok:!1,error:this.toBridgeError(n)})}},this.dispatchRequest=async(e,n)=>{switch(n.method){case`list`:return await t.serviceApps.listServiceActions({bridgeSessionToken:e.token});case`requestGrant`:return await this.confirmAndGrant(e,this.requireActionId(n));case`revokeGrant`:return await t.serviceApps.revokeServiceAction(this.requireActionId(n),{bridgeSessionToken:e.token});case`invoke`:return await this.invokeWithAuthorization(e,n);case`agent.send`:return await this.sendAgentMessageWithAuthorization(e,n);case`agent.generateObject`:return await this.generateAgentObjectWithAuthorization(e,n);case`verification.list`:return await t.serviceApps.listVerificationRecords({acceptanceId:n.payload?.acceptanceId,appId:n.payload?.appId,limit:n.payload?.limit,bridgeSessionToken:e.token});case`acceptance.status`:return await t.serviceApps.getPortableRuntimeAcceptanceStatus({appId:n.payload?.appId,locale:n.payload?.locale,bridgeSessionToken:e.token});case`acceptance.export`:return await t.serviceApps.exportPortableRuntimeAcceptance({appId:n.payload?.appId,locale:n.payload?.locale,bridgeSessionToken:e.token});default:throw Error(`Unsupported panel bridge method: ${String(n.method)}`)}},this.invokeWithAuthorization=async(e,n)=>{let r=this.requireActionId(n);try{return await t.serviceApps.invokeServiceAction(r,this.readOptionalRecord(n.payload?.input),{bridgeSessionToken:e.token})}catch(i){if(!(i instanceof c)||i.code!==`AUTHORIZATION_REQUIRED`)throw i;return await this.confirmAndGrant(e,r,this.readOptionalRecord(n.payload?.input)),await t.serviceApps.invokeServiceAction(r,this.readOptionalRecord(n.payload?.input),{bridgeSessionToken:e.token})}},this.sendAgentMessageWithAuthorization=async(e,n)=>{try{return await t.panelApps.sendAgentMessage(this.readAgentSendRequest(n),{bridgeSessionToken:e.token})}catch(r){if(!(r instanceof c)||r.code!==`AUTHORIZATION_REQUIRED`)throw r;return await this.confirmAndGrantAgentCapability(e,`agent:send`),await t.panelApps.sendAgentMessage(this.readAgentSendRequest(n),{bridgeSessionToken:e.token})}},this.generateAgentObjectWithAuthorization=async(e,n)=>{try{return await t.panelApps.generateAgentObject(this.readGenerateObjectRequest(n),{bridgeSessionToken:e.token})}catch(r){if(!(r instanceof c)||r.code!==`AUTHORIZATION_REQUIRED`)throw r;return await this.confirmAndGrantAgentCapability(e,`agent:generateObject`),await t.panelApps.generateAgentObject(this.readGenerateObjectRequest(n),{bridgeSessionToken:e.token})}},this.confirmAndGrantAgentCapability=async(e,n)=>{if(!await this.authorizationManager.requestAuthorization({panelAppId:e.appId,actions:[{actionId:n,actionTitle:n===`agent:send`?`Send agent message`:`Generate object`,actionDescription:n===`agent:send`?`Send a message to a NextClaw Agent session.`:`Send context to a NextClaw Agent session and receive a structured object.`,risk:`write`}]}))throw new c({code:`AUTHORIZATION_REJECTED`,message:`Permission rejected for ${n}.`});return await t.panelApps.grantAgentCapability(n,{bridgeSessionToken:e.token})},this.confirmAndGrant=async(e,n,r)=>{let i=await this.listGrantCandidateActions(e,n);if(!await this.authorizationManager.requestAuthorization({panelAppId:e.appId,actions:i.map(e=>({actionId:e.id,actionTitle:e.title,actionDescription:e.description,risk:e.risk})),inputPreview:this.createInputPreview(r)}))throw new c({code:`AUTHORIZATION_REJECTED`,message:`Permission rejected for ${n}.`});let a=await t.serviceApps.grantServiceActions(i.map(e=>e.id),{bridgeSessionToken:e.token}),o=a.grants.find(e=>e.actionId===n)??a.grants[0];if(!o)throw Error(`No permission grant returned for ${n}.`);return o},this.listGrantCandidateActions=async(e,n)=>{let r=await t.serviceApps.listServiceActions({bridgeSessionToken:e.token}),i=r.actions.find(e=>e.id===n);if(i&&i.grantState!==`not-granted`)return[i];let a=r.actions.filter(e=>e.grantState===`not-granted`),o=[...a.filter(e=>e.id===n),...a.filter(e=>e.id!==n)];return o.length>0?o:[{appId:i?.appId??n.split(`.`)[0]??n,description:i?.description,id:n,name:i?.name??n,risk:i?.risk??`dangerous`,title:i?.title}]},this.createInputPreview=e=>{if(!(!e||Object.keys(e).length===0))try{let t=JSON.stringify(e,null,2);return t.length>500?`${t.slice(0,500)}...`:t}catch{return`[unserializable input]`}},this.getBridgeContext=e=>({appId:e.appId,token:e.runtimeToken}),this.requireActionId=e=>{let t=e.payload?.actionId?.trim();if(!t)throw Error(`Panel bridge actionId is required.`);return t},this.readOptionalRecord=e=>{if(e!==void 0)return this.requireRecord(e,`input`)},this.readAgentSendRequest=e=>({payload:this.requireRecord(e.payload?.request,`agent.send request`)}),this.readGenerateObjectRequest=e=>({input:this.requireRecord(e.payload?.input,`generateObject input`)}),this.requireRecord=(e,t)=>{if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`${t} is required.`);return e},this.postResponse=(e,t)=>{e.iframe?.contentWindow?.postMessage(t,`*`)},this.toBridgeError=e=>e instanceof c?{code:e.code,message:e.message,details:e.details}:{message:e instanceof Error?e.message:String(e)},this.isBridgeRequest=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`nextclaw:panel-app-service-actions:request`&&typeof t.requestId==`string`&&typeof t.runtimeToken==`string`&&typeof t.appId==`string`&&(t.method===`invoke`||t.method===`agent.send`||t.method===`agent.generateObject`||t.method===`acceptance.export`||t.method===`acceptance.status`||t.method===`list`||t.method===`requestGrant`||t.method===`revokeGrant`||t.method===`verification.list`)}}};function he(){return`service-action-auth-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}var O=s((e,t)=>({pending:null,requestAuthorization:async n=>await new Promise(r=>{t().pending?.resolve(!1),e({pending:{id:he(),...n,resolve:r}})}),resolveAuthorization:n=>{let{pending:r}=t();r&&(r.resolve(n),e({pending:null}))}})),ge=class{constructor(){this.requestAuthorization=async e=>await O.getState().requestAuthorization(e)}},k=class{constructor(){this.serviceActionAuthorizationManager=new ge,this.panelAppBridgeManager=new D(this.serviceActionAuthorizationManager)}},A=e(u(),1),j=ee(),M=globalThis,N=M.__NEXTCLAW_PANEL_APP_HOST_CONTEXT__??(0,A.createContext)(null);M.__NEXTCLAW_PANEL_APP_HOST_CONTEXT__=N;function P({children:e,presenter:t}){let n=(0,A.useMemo)(()=>t??new k,[t]);return(0,j.jsx)(N.Provider,{value:n,children:e})}function F(){let e=(0,A.useContext)(N);if(!e)throw Error(`usePanelAppHostPresenter must be used inside PanelAppHostProvider`);return e}var I=[`panel-apps`],L=[`panel-app`];function R(e,t){return e.id===t||e.appId===t}function z(e,t,n){return e&&{...e,entries:e.entries.map(e=>R(e,t)?n(e):e)}}function B(e,t){return z(e,t.id,()=>t)}function V(e,t){let n=e?.entries.reduce((e,t)=>Math.max(e,t.mainSidebarOrder??-1),-1)??-1;return z(e,t.id,e=>({...e,...typeof t.preferences.favorite==`boolean`?{favorite:t.preferences.favorite}:{},...typeof t.preferences.mainSidebar==`boolean`?t.preferences.mainSidebar?{mainSidebar:!0,mainSidebarOrder:e.mainSidebar?e.mainSidebarOrder:n+1}:{mainSidebar:!1,mainSidebarOrder:void 0}:{}}))}function _e(e={}){return n({queryKey:I,queryFn:()=>t.panelApps.listPanelApps(),enabled:e.enabled??!0,staleTime:0})}function H(e,r={}){return n({queryKey:[...L,e],queryFn:()=>t.panelApps.getPanelApp(e),enabled:!!e&&(r.enabled??!0),staleTime:5e3})}function ve(){let e=l();return o({mutationFn:({id:e,preferences:n})=>t.panelApps.updatePanelAppPreferences(e,n),onMutate:async t=>{await e.cancelQueries({queryKey:I});let n=e.getQueryData(I)?.entries.find(e=>R(e,t.id));return e.setQueryData(I,e=>V(e,t)),{previousEntry:n}},onSuccess:t=>{e.setQueryData(I,e=>B(e,t)),e.setQueryData([...L,t.appId],t)},onError:(t,n,r)=>{let a=r?.previousEntry;a&&e.setQueryData(I,e=>z(e,n.id,()=>a));let o=t instanceof Error?t.message:String(t);i.error(`${m(`panelAppsPreferenceUpdateFailed`)}: ${o}`)}})}function ye(){let e=l();return o({mutationFn:e=>t.panelApps.recordPanelAppOpened(e),onSuccess:t=>{e.setQueryData(I,e=>B(e,t)),e.setQueryData([...L,t.appId],t)}})}function U(){let e=l();return o({mutationFn:e=>t.panelApps.grantClient(e),onSuccess:()=>{e.invalidateQueries({queryKey:I}),e.invalidateQueries({queryKey:L})}})}function be(){let e=l();return o({mutationFn:e=>t.panelApps.deletePanelApp(e),onSuccess:()=>{e.invalidateQueries({queryKey:I}),e.invalidateQueries({queryKey:L})}})}function W(){let e=F(),{isPending:t,mutateAsync:n}=U(),r=(0,A.useRef)(new Map);return{ensurePanelAppClientGrant:(0,A.useCallback)(async t=>{if(!t.clientDeclared||t.clientGranted)return!0;let i=r.current.get(t.appId);if(i)return await i;let a=(async()=>await e.serviceActionAuthorizationManager.requestAuthorization({panelAppId:t.appId,actions:[{actionId:`nextclaw.client`,actionTitle:m(`panelAppsClientGrantTitle`),actionDescription:m(`panelAppsClientGrantDescription`),risk:`dangerous`}]})?(await n(t.appId),!0):!1)();r.current.set(t.appId,a);try{return await a}finally{r.current.delete(t.appId)}},[n,e]),isPending:t}}function xe(e){let r=l(),i=(0,A.useId)(),{ensurePanelAppClientGrant:a}=W(),o=!!(e?.clientDeclared&&!e.clientGranted),s=n({queryKey:[`panel-app-client-grant`,e?.appId??`none`,e?.clientGranted??!1],queryFn:async()=>await a(e),enabled:o,gcTime:0,retry:!1,staleTime:1/0}),c=e?o?s.isError?`error`:s.isPending?`checking`:s.data?`allowed`:`denied`:`allowed`:`idle`;return n({queryKey:[`panel-app-open`,i,e?.appId??`none`],queryFn:async()=>{let n=await t.panelApps.recordPanelAppOpened(e.id);return r.setQueryData(I,e=>B(e,n)),r.setQueryData([...L,n.appId],n),n},enabled:!!(e&&c===`allowed`),retry:!1,staleTime:1/0}),{retryClientGrant:s.refetch,state:c}}var G=`allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-downloads allow-pointer-lock allow-presentation`;function K(e){e?.focus({preventScroll:!0}),e?.contentWindow?.focus()}function q(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.kind===`document`?!0:t.kind===`element`&&Array.isArray(t.path)&&t.path.length>0&&t.path.length<=30&&t.path.every(e=>typeof e?.index==`number`&&Number.isInteger(e.index)&&e.index>=0&&e.index<=1e3&&typeof e.tagName==`string`&&e.tagName.length>0&&e.tagName.length<=32)}function Se(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.currentUrl==`string`&&q(t.target)}function Ce(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.type===r.scrollMessageType&&t.version===r.version&&q(t.target)&&typeof t.x==`number`&&Number.isFinite(t.x)&&t.x>=0&&typeof t.y==`number`&&Number.isFinite(t.y)&&t.y>=0}function J({currentUrl:e,iframeRef:t,isEnabled:n,restorationKey:i}){let a=i&&e?JSON.stringify([i,e]):null;return(0,A.useEffect)(()=>{if(!e||!n||!a)return;let r=a,i=n=>{n.source!==t.current?.contentWindow||!Ce(n.data)||g.save(r,{x:n.data.x,y:n.data.y,payload:{currentUrl:e,target:n.data.target}})};return window.addEventListener(`message`,i),()=>window.removeEventListener(`message`,i)},[e,t,n,a]),(0,A.useCallback)(()=>{if(!e||!n||!a)return;let i=g.read(a);!i||!Se(i.payload)||i.payload.currentUrl!==e||t.current?.contentWindow?.postMessage({type:r.restoreScrollMessageType,version:r.version,target:i.payload.target,x:i.x,y:i.y},`*`)},[e,t,n,a])}function Y({appId:e,restorationScope:t,unavailableAction:n}){let r=F(),i=H(e),a=(0,A.useRef)(null),o=(0,A.useMemo)(()=>i.data,[i.data]),s=xe(o),c=J({currentUrl:o?.contentPath??null,iframeRef:a,isEnabled:!!o,restorationKey:o?`panel-app:${t}:${o.appId}`:null});return(0,A.useEffect)(()=>{let e=e=>{r.panelAppBridgeManager.handleIframeMessage({event:e,iframe:a.current})};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[r]),i.isLoading?(0,j.jsx)(X,{message:m(`panelAppsLoading`)}):i.isError?(0,j.jsx)(X,{message:i.error instanceof Error?i.error.message:m(`panelAppsLoadFailed`),actionLabel:m(`panelAppsTryAgain`),onAction:()=>void i.refetch()}):o?s.state===`checking`||s.state===`idle`?(0,j.jsx)(X,{message:m(`panelAppsCheckingPermission`)}):s.state===`denied`||s.state===`error`?(0,j.jsx)(X,{message:s.state===`denied`?m(`panelAppsPermissionDenied`):m(`panelAppsPermissionFailed`),actionLabel:m(`panelAppsTryAgain`),onAction:()=>void s.retryClientGrant()}):(0,j.jsx)(`div`,{className:`h-full min-h-0 bg-background`,children:(0,j.jsx)(`iframe`,{ref:a,src:o.contentPath,title:o.title,sandbox:G,className:`block h-full w-full border-0 bg-background`,onLoad:c,onPointerOver:e=>K(e.currentTarget)},o.appId)}):(0,j.jsx)(X,{message:m(`panelAppsMainUnavailable`),actionLabel:n?.label,onAction:n?.onAction})}function X({actionLabel:e,message:t,onAction:n}){return(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-background px-6 text-center`,children:(0,j.jsxs)(`div`,{className:`max-w-sm`,children:[(0,j.jsx)(`div`,{className:`mx-auto flex h-10 w-10 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:n?(0,j.jsx)(te,{className:`h-5 w-5`}):(0,j.jsx)(T,{className:`h-5 w-5`})}),(0,j.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-muted-foreground`,children:t}),e&&n?(0,j.jsx)(`button`,{type:`button`,className:`mt-4 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:n,children:e}):null]})})}var Z=(0,A.createContext)(null);function we({children:e}){let[t,n]=(0,A.useState)(()=>ne());(0,A.useEffect)(()=>p(e=>{n(e)}),[]);let r=(0,A.useCallback)(e=>{re(e),n(f())},[]),i=(0,A.useCallback)(()=>{r(t===`en`?`zh`:`en`)},[t,r]),a=(0,A.useMemo)(()=>({language:t,setLanguage:r,toggleLanguage:i}),[t,r,i]);return(0,j.jsx)(Z.Provider,{value:a,children:e})}function Te(){let e=(0,A.useContext)(Z);if(!e)throw Error(`useI18n must be used within I18nProvider`);return{...e,t:m}}function Ee({appId:e}){let t=H(e),n=(0,A.useMemo)(()=>t.data,[t.data]);return(0,A.useEffect)(()=>{let e=document.title;return document.title=`${n?.title??m(`panelAppsTitle`)} · NextClaw`,()=>{document.title=e}},[n?.title]),(0,j.jsx)(`main`,{className:`h-dvh min-h-0 w-full overflow-hidden bg-background`,children:(0,j.jsx)(Y,{appId:e,restorationScope:`standalone`})})}function De(){let e=O(e=>e.pending),t=O(e=>e.resolveAuthorization);return(0,j.jsx)(ce,{open:!!e,onOpenChange:e=>{e||t(!1)},children:(0,j.jsxs)(oe,{children:[(0,j.jsxs)(ie,{showClose:!1,children:[(0,j.jsxs)(h,{className:`flex items-center gap-2`,children:[(0,j.jsx)(E,{className:`h-4 w-4 text-amber-600`}),m(`serviceActionAuthorizationTitle`)]}),(0,j.jsx)(se,{children:m(`serviceActionAuthorizationDescription`)})]}),e?(0,j.jsxs)(`div`,{className:`space-y-3 rounded-md border border-border bg-muted/60 p-3 text-sm`,children:[(0,j.jsx)(Q,{label:m(`serviceActionAuthorizationSource`),value:e.panelAppId}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:m(`serviceActionAuthorizationActions`)}),(0,j.jsx)(`div`,{className:`max-h-64 space-y-2 overflow-auto`,children:e.actions.map(e=>(0,j.jsx)(Oe,{action:e},e.actionId))})]}),e.inputPreview?(0,j.jsx)(Q,{label:m(`serviceActionAuthorizationInput`),value:e.inputPreview}):null]}):null,(0,j.jsxs)(ae,{className:`gap-2 sm:gap-0`,children:[(0,j.jsx)(a,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:m(`serviceActionAuthorizationReject`)}),(0,j.jsx)(a,{type:`button`,onClick:()=>t(!0),children:m(`serviceActionAuthorizationAllow`)})]})]})})}function Oe({action:e}){return(0,j.jsxs)(`div`,{className:`space-y-1 rounded border border-border bg-card px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,j.jsx)(`div`,{className:`min-w-0 break-words text-xs font-medium text-foreground`,children:e.actionTitle??e.actionId}),(0,j.jsx)(`div`,{className:`shrink-0 rounded bg-amber-50 px-1.5 py-0.5 text-[11px] font-medium text-amber-700`,children:e.risk??`dangerous`})]}),(0,j.jsx)(`div`,{className:`break-words text-[11px] text-muted-foreground`,children:e.actionId}),e.actionDescription?(0,j.jsx)(`div`,{className:`break-words text-xs text-muted-foreground`,children:e.actionDescription}):null]})}function Q({label:e,value:t}){return(0,j.jsxs)(`div`,{className:`grid grid-cols-[5rem_minmax(0,1fr)] gap-3`,children:[(0,j.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:e}),(0,j.jsx)(`div`,{className:`min-w-0 break-words text-xs text-foreground`,children:t})]})}var $=(0,A.createContext)(null);function ke({children:e}){let[t,n]=(0,A.useState)(()=>w());(0,A.useEffect)(()=>me(e=>{n(e)}),[]);let r=(0,A.useCallback)(e=>{pe(e),n(fe())},[]),i=(0,A.useMemo)(()=>({theme:t,setTheme:r}),[t,r]);return(0,j.jsx)($.Provider,{value:i,children:e})}function Ae(){let e=(0,A.useContext)($);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}export{v as C,x as D,w as E,y as O,T as S,S as T,ve as _,we as a,D as b,J as c,W as d,be as f,ye as g,_e as h,Ee as i,G as l,H as m,Ae as n,Te as o,U as p,De as r,Y as s,ke as t,K as u,P as v,de as w,E as x,k as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-
|
|
1
|
+
import{t as e}from"./createLucideIcon-D-7Sxfw7.js";var t=e(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{At as e,Ct as t,Dt as n,Et as r,Ot as i,Qn as a,St as o,Tt as s,Xn as c,Zn as l,_t as u,at as d,dt as f,gt as p,ht as m,kt as h,lr as g,lt as _,mt as v,ot as y,rt as b,st as x,ut as S,vt as C,wt as w,yt as T}from"./api-
|
|
1
|
+
import{At as e,Ct as t,Dt as n,Et as r,Ot as i,Qn as a,St as o,Tt as s,Xn as c,Zn as l,_t as u,at as d,dt as f,gt as p,ht as m,kt as h,lr as g,lt as _,mt as v,ot as y,rt as b,st as x,ut as S,vt as C,wt as w,yt as T}from"./api-BaML_txv.js";import{s as E}from"./i18n-Bzo4IocH.js";function D(){return a({queryKey:[`config`],queryFn:_,staleTime:3e4,refetchOnWindowFocus:!0})}function O(){return a({queryKey:[`config-meta`],queryFn:S,staleTime:1/0})}function k(){return a({queryKey:[`product-analytics-status`],queryFn:v,staleTime:15e3,refetchOnWindowFocus:!0})}function A(){return a({queryKey:[`providers`],queryFn:u,staleTime:3e4,refetchOnWindowFocus:!0})}function j(){return a({queryKey:[`provider-templates`],queryFn:p,staleTime:1/0})}function M(e={}){return a({queryKey:[`provider-model-catalog`],queryFn:m,staleTime:3e4,refetchInterval:t=>e.pollWhileRefreshing&&t.state.data?.refreshing?1e3:!1,refetchOnMount:e.refreshOnMount?`always`:!0,refetchOnWindowFocus:!0})}function N(){return a({queryKey:[`config-schema`],queryFn:f,staleTime:1/0})}function P(){let e=g();return l({mutationFn:s,onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),c.success(E(`configSaved`))},onError:e=>{c.error(E(`configSaveFailed`)+`: `+e.message)}})}function F(){let e=g();return l({mutationFn:({data:e})=>r(e),onSuccess:t=>{e.setQueryData([`config`],e=>e&&{...e,productAnalytics:t}),e.invalidateQueries({queryKey:[`product-analytics-status`]}),c.success(E(`configSavedApplied`))},onError:e=>{c.error(`${E(`configSaveFailed`)}: ${e.message}`)}})}function I(){let e=g();return l({mutationFn:({data:e})=>h(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),c.success(E(`configSavedApplied`))},onError:e=>{c.error(E(`configSaveFailed`)+`: `+e.message)}})}function L(){let e=g();return l({mutationFn:({provider:e,data:t})=>n(e,t),onSuccess:(t,n)=>{e.setQueryData([`providers`],e=>e&&{providers:{...e.providers,[n.provider]:t}}),e.invalidateQueries({queryKey:[`providers`]}),e.invalidateQueries({queryKey:[`config`]}),n.silentSuccess||c.success(E(`configSaved`))},onError:e=>{c.error(E(`configSaveFailed`)+`: `+e.message)}})}function R(){let e=g();return l({mutationFn:({data:e})=>b(e??{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`providers`]}),e.invalidateQueries({queryKey:[`config`]}),c.success(E(`configSaved`))},onError:e=>{c.error(E(`configSaveFailed`)+`: `+e.message)}})}function z(){let e=g();return l({mutationFn:({provider:e})=>d(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`providers`]}),e.invalidateQueries({queryKey:[`config`]}),c.success(E(`configSaved`))},onError:e=>{c.error(E(`configSaveFailed`)+`: `+e.message)}})}function B(){return l({mutationFn:({provider:e,data:n})=>t(e,n)})}function V(){return l({mutationFn:({provider:e,data:t})=>y(e,t)})}function H(){return l({mutationFn:({provider:e,data:t})=>o(e,t)})}function U(){return l({mutationFn:({provider:e,data:t})=>T(e,t)})}function W(){return l({mutationFn:({provider:e})=>C(e)})}function G(){let e=g();return l({mutationFn:({channel:e,data:t})=>w(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),c.success(E(`configSavedApplying`))},onError:e=>{c.error(E(`configSaveFailed`)+`: `+e.message)}})}function K(){let e=g();return l({mutationFn:({data:e})=>i(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),c.success(E(`configSavedApplied`))},onError:e=>{c.error(E(`configSaveFailed`)+`: `+e.message)}})}function q(){let t=g();return l({mutationFn:({data:t})=>e(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),c.success(E(`configSavedApplied`))},onError:e=>{c.error(E(`configSaveFailed`)+`: `+e.message)}})}function J(){return l({mutationFn:({actionId:e,data:t})=>x(e,t),onError:e=>{c.error(E(`error`)+`: `+e.message)}})}export{q as S,P as _,z as a,K as b,W as c,M as d,j as f,G as g,B as h,R as i,U as l,H as m,O as n,V as o,A as p,N as r,J as s,D as t,k as u,F as v,I as x,L as y};
|
package/dist/assets/{use-desktop-capabilities-B-u6ojjW.js → use-desktop-capabilities-C1bXk7fx.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Lt as e,Qn as t,Zn as n,lr as r}from"./api-
|
|
1
|
+
import{Lt as e,Qn as t,Zn as n,lr as r}from"./api-BaML_txv.js";var i=new class{constructor(){this.getStatus=async()=>await e.capabilityAccess.getDesktopStatus(),this.listGrants=async()=>await e.capabilityAccess.listDesktopGrants(),this.grantAccess=async t=>await e.capabilityAccess.grantDesktopAccess(t),this.requestSystemPermission=async()=>await e.capabilityAccess.requestDesktopPermissions(),this.openSystemSettings=async()=>await e.capabilityAccess.openDesktopPermissionSettings(),this.revokeGrant=async t=>await e.capabilityAccess.revokeDesktopAccess(t)}},a=[`feature-controls`];function o(){return t({queryKey:a,queryFn:e.featureControls.get})}var s=[`desktop-capability`,`status`],c=[`desktop-capability`,`grants`];function l(){return t({queryKey:s,queryFn:i.getStatus})}function u(){return d(o().data)}function d(e){return e?.desktopAutomation.available===!0}function f(){return t({queryKey:c,queryFn:i.listGrants})}function p(){let e=r();return n({mutationFn:i.requestSystemPermission,onSuccess:async()=>{await e.invalidateQueries({queryKey:s})}})}function m(){return n({mutationFn:i.openSystemSettings})}function h(){let e=r();return n({mutationFn:async e=>await i.revokeGrant(e),onSuccess:async()=>{await e.invalidateQueries({queryKey:c})}})}export{p as a,m as i,f as n,h as o,l as r,i as s,u as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./chunk-DF37yw5_.js";import{fn as t,xr as n}from"./api-
|
|
1
|
+
import{i as e}from"./chunk-DF37yw5_.js";import{fn as t,xr as n}from"./api-BaML_txv.js";import{t as r}from"./createLucideIcon-D-7Sxfw7.js";import{n as i,t as a}from"./middleware-B--6mAUM.js";var o=r(`KeyRound`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),s=`nextclaw.app.viewport-layout`,c=1;function l(e){return typeof e!=`number`||!Number.isFinite(e)?`desktop`:e<=767?`mobile`:`desktop`}function u(){let e=typeof window>`u`?null:window.innerWidth??null;return{mode:l(e),width:e,isSidebarCollapsed:!1,isMainSidebarAppGroupCollapsed:!1}}function d(e,t){if(!e||typeof e!=`object`)return null;let n=e[t];return typeof n==`boolean`?n:null}var f=t()(i(()=>u(),{name:s,version:c,storage:a(()=>window.localStorage),partialize:e=>({isSidebarCollapsed:e.isSidebarCollapsed,isMainSidebarAppGroupCollapsed:e.isMainSidebarAppGroupCollapsed}),merge:(e,t)=>{let n=d(e,`isSidebarCollapsed`),r=d(e,`isMainSidebarAppGroupCollapsed`);return{...t,...n===null?{}:{isSidebarCollapsed:n},...r===null?{}:{isMainSidebarAppGroupCollapsed:r}}}})),p=new class{constructor(){this.consumerCount=0,this.started=!1,this.attach=()=>(this.consumerCount+=1,this.consumerCount===1&&this.start(),()=>{this.consumerCount=Math.max(0,this.consumerCount-1),this.consumerCount===0&&this.stop()}),this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`resize`,this.handleViewportChange),window.addEventListener(`orientationchange`,this.handleViewportChange),this.syncFromWindow())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`resize`,this.handleViewportChange),window.removeEventListener(`orientationchange`,this.handleViewportChange),this.started=!1)},this.getSnapshot=()=>f.getState(),this.setSidebarCollapsed=e=>{f.setState({isSidebarCollapsed:e})},this.setMainSidebarAppGroupCollapsed=e=>{f.setState({isMainSidebarAppGroupCollapsed:e})},this.collapseSidebarForDenseRightPanels=e=>{if(!e.isDocBrowserOpen||!e.isDocBrowserDocked||!e.isWorkspacePanelOpen)return;let t=this.getSnapshot();if(t.mode!==`desktop`||t.isSidebarCollapsed)return;let n=typeof t.width==`number`?t.width:typeof window>`u`?null:window.innerWidth;typeof n!=`number`||!Number.isFinite(n)||n>1800||this.setSidebarCollapsed(!0)},this.toggleSidebarCollapsed=()=>{f.setState(e=>({isSidebarCollapsed:!e.isSidebarCollapsed}))},this.toggleMainSidebarAppGroupCollapsed=()=>{f.setState(e=>({isMainSidebarAppGroupCollapsed:!e.isMainSidebarAppGroupCollapsed}))},this.resetForTests=()=>{this.consumerCount=0,this.stop(),f.setState(u())},this.handleViewportChange=()=>{this.syncFromWindow()},this.syncFromWindow=()=>{if(typeof window>`u`)return;let e=window.innerWidth??null;f.setState({width:e,mode:l(e)})}}},m=e(n(),1);function h(){return(0,m.useEffect)(()=>p.attach(),[]),{isMobile:f(e=>e.mode)===`mobile`}}export{o as i,p as n,f as r,h as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-
|
|
1
|
+
import{t as e}from"./createLucideIcon-D-7Sxfw7.js";var t=e(`Globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),n=e(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),r=e(`MessageSquare`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),i=e(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),a=e(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t as a,n as i,i as n,r,a as t};
|
package/dist/index.html
CHANGED
|
@@ -192,48 +192,48 @@
|
|
|
192
192
|
})();
|
|
193
193
|
</script>
|
|
194
194
|
<title>NextClaw</title>
|
|
195
|
-
<script type="module" crossorigin src="/assets/main-
|
|
195
|
+
<script type="module" crossorigin src="/assets/main-BI7BtvLx.js"></script>
|
|
196
196
|
<link rel="modulepreload" crossorigin href="/assets/chunk-DF37yw5_.js">
|
|
197
197
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-DWTEM3RW.js">
|
|
198
|
-
<link rel="modulepreload" crossorigin href="/assets/i18n-
|
|
199
|
-
<link rel="modulepreload" crossorigin href="/assets/api-
|
|
200
|
-
<link rel="modulepreload" crossorigin href="/assets/client-
|
|
201
|
-
<link rel="modulepreload" crossorigin href="/assets/createLucideIcon-
|
|
202
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
198
|
+
<link rel="modulepreload" crossorigin href="/assets/i18n-Bzo4IocH.js">
|
|
199
|
+
<link rel="modulepreload" crossorigin href="/assets/api-BaML_txv.js">
|
|
200
|
+
<link rel="modulepreload" crossorigin href="/assets/client-C1Z8ITVa.js">
|
|
201
|
+
<link rel="modulepreload" crossorigin href="/assets/createLucideIcon-D-7Sxfw7.js">
|
|
202
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-BxOjfeaD.js">
|
|
203
203
|
<link rel="modulepreload" crossorigin href="/assets/katex-BzT-4KBu.js">
|
|
204
|
-
<link rel="modulepreload" crossorigin href="/assets/search-
|
|
205
|
-
<link rel="modulepreload" crossorigin href="/assets/external-link-
|
|
206
|
-
<link rel="modulepreload" crossorigin href="/assets/inbox-
|
|
207
|
-
<link rel="modulepreload" crossorigin href="/assets/x-
|
|
208
|
-
<link rel="modulepreload" crossorigin href="/assets/plus-
|
|
209
|
-
<link rel="modulepreload" crossorigin href="/assets/context-menu-
|
|
210
|
-
<link rel="modulepreload" crossorigin href="/assets/puzzle-
|
|
211
|
-
<link rel="modulepreload" crossorigin href="/assets/book-open-
|
|
212
|
-
<link rel="modulepreload" crossorigin href="/assets/dialog-
|
|
204
|
+
<link rel="modulepreload" crossorigin href="/assets/search-Drx-sMCE.js">
|
|
205
|
+
<link rel="modulepreload" crossorigin href="/assets/external-link-NwtWKzE2.js">
|
|
206
|
+
<link rel="modulepreload" crossorigin href="/assets/inbox-DofXi7Xv.js">
|
|
207
|
+
<link rel="modulepreload" crossorigin href="/assets/x-DLvS4xvV.js">
|
|
208
|
+
<link rel="modulepreload" crossorigin href="/assets/plus-v29lPO18.js">
|
|
209
|
+
<link rel="modulepreload" crossorigin href="/assets/context-menu-DVgLoPqH.js">
|
|
210
|
+
<link rel="modulepreload" crossorigin href="/assets/puzzle-CXL_z0vz.js">
|
|
211
|
+
<link rel="modulepreload" crossorigin href="/assets/book-open-oG0GrLyy.js">
|
|
212
|
+
<link rel="modulepreload" crossorigin href="/assets/dialog-InO6RVpm.js">
|
|
213
213
|
<link rel="modulepreload" crossorigin href="/assets/navigation-history-CCnxsAKR.js">
|
|
214
|
-
<link rel="modulepreload" crossorigin href="/assets/theme-provider-
|
|
215
|
-
<link rel="modulepreload" crossorigin href="/assets/download-
|
|
214
|
+
<link rel="modulepreload" crossorigin href="/assets/theme-provider-DDJOlUxn.js">
|
|
215
|
+
<link rel="modulepreload" crossorigin href="/assets/download-BN4aCzSx.js">
|
|
216
216
|
<link rel="modulepreload" crossorigin href="/assets/middleware-B--6mAUM.js">
|
|
217
|
-
<link rel="modulepreload" crossorigin href="/assets/use-viewport-layout-
|
|
218
|
-
<link rel="modulepreload" crossorigin href="/assets/refresh-cw-
|
|
219
|
-
<link rel="modulepreload" crossorigin href="/assets/trash-2-
|
|
217
|
+
<link rel="modulepreload" crossorigin href="/assets/use-viewport-layout-D6seoW0Z.js">
|
|
218
|
+
<link rel="modulepreload" crossorigin href="/assets/refresh-cw-CqsHJPqR.js">
|
|
219
|
+
<link rel="modulepreload" crossorigin href="/assets/trash-2-B8mbrtCx.js">
|
|
220
220
|
<link rel="modulepreload" crossorigin href="/assets/host-capabilities-B107nwS3.js">
|
|
221
|
-
<link rel="modulepreload" crossorigin href="/assets/navigation-link-
|
|
222
|
-
<link rel="modulepreload" crossorigin href="/assets/use-desktop-capabilities-
|
|
223
|
-
<link rel="modulepreload" crossorigin href="/assets/status-dot-
|
|
224
|
-
<link rel="modulepreload" crossorigin href="/assets/doc-browser-context-
|
|
225
|
-
<link rel="modulepreload" crossorigin href="/assets/tag-chip-
|
|
226
|
-
<link rel="modulepreload" crossorigin href="/assets/card-
|
|
227
|
-
<link rel="modulepreload" crossorigin href="/assets/confirm-dialog-
|
|
228
|
-
<link rel="modulepreload" crossorigin href="/assets/provider-models-
|
|
229
|
-
<link rel="modulepreload" crossorigin href="/assets/select-
|
|
230
|
-
<link rel="modulepreload" crossorigin href="/assets/use-config-
|
|
231
|
-
<link rel="modulepreload" crossorigin href="/assets/app-presenter-provider-
|
|
232
|
-
<link rel="modulepreload" crossorigin href="/assets/provider-scoped-model-input-
|
|
233
|
-
<link rel="modulepreload" crossorigin href="/assets/settings-2-
|
|
234
|
-
<link rel="modulepreload" crossorigin href="/assets/agents-
|
|
235
|
-
<link rel="modulepreload" crossorigin href="/assets/pwa-
|
|
236
|
-
<link rel="modulepreload" crossorigin href="/assets/login-page-
|
|
221
|
+
<link rel="modulepreload" crossorigin href="/assets/navigation-link-tawg3qi2.js">
|
|
222
|
+
<link rel="modulepreload" crossorigin href="/assets/use-desktop-capabilities-C1bXk7fx.js">
|
|
223
|
+
<link rel="modulepreload" crossorigin href="/assets/status-dot-xxVxbdQr.js">
|
|
224
|
+
<link rel="modulepreload" crossorigin href="/assets/doc-browser-context-Bs122rxO.js">
|
|
225
|
+
<link rel="modulepreload" crossorigin href="/assets/tag-chip-0lQj9HFa.js">
|
|
226
|
+
<link rel="modulepreload" crossorigin href="/assets/card-DxCOCY_7.js">
|
|
227
|
+
<link rel="modulepreload" crossorigin href="/assets/confirm-dialog-BdEQiFoD.js">
|
|
228
|
+
<link rel="modulepreload" crossorigin href="/assets/provider-models-CWtoV3BJ.js">
|
|
229
|
+
<link rel="modulepreload" crossorigin href="/assets/select-DHYR109w.js">
|
|
230
|
+
<link rel="modulepreload" crossorigin href="/assets/use-config-BpKXDcM_.js">
|
|
231
|
+
<link rel="modulepreload" crossorigin href="/assets/app-presenter-provider-DSlY9Lz6.js">
|
|
232
|
+
<link rel="modulepreload" crossorigin href="/assets/provider-scoped-model-input-DJzdGBE8.js">
|
|
233
|
+
<link rel="modulepreload" crossorigin href="/assets/settings-2-DAPjKYtK.js">
|
|
234
|
+
<link rel="modulepreload" crossorigin href="/assets/agents-lT-bDFex.js">
|
|
235
|
+
<link rel="modulepreload" crossorigin href="/assets/pwa-Blsqtn1m.js">
|
|
236
|
+
<link rel="modulepreload" crossorigin href="/assets/login-page-CkfjjXD2.js">
|
|
237
237
|
<link rel="stylesheet" crossorigin href="/assets/context-menu-DEcVZfaU.css">
|
|
238
238
|
<link rel="stylesheet" crossorigin href="/assets/app-presenter-provider-D3BuuOyZ.css">
|
|
239
239
|
<link rel="stylesheet" crossorigin href="/assets/main-D_zmSVS1.css">
|
|
@@ -5,24 +5,24 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<meta name="theme-color" content="#ffffff" />
|
|
7
7
|
<title>Panel App · NextClaw</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/panelStandalone-
|
|
8
|
+
<script type="module" crossorigin src="/assets/panelStandalone-smtUeY2k.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-DF37yw5_.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-DWTEM3RW.js">
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/i18n-
|
|
12
|
-
<link rel="modulepreload" crossorigin href="/assets/api-
|
|
13
|
-
<link rel="modulepreload" crossorigin href="/assets/client-
|
|
14
|
-
<link rel="modulepreload" crossorigin href="/assets/createLucideIcon-
|
|
15
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/i18n-Bzo4IocH.js">
|
|
12
|
+
<link rel="modulepreload" crossorigin href="/assets/api-BaML_txv.js">
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/client-C1Z8ITVa.js">
|
|
14
|
+
<link rel="modulepreload" crossorigin href="/assets/createLucideIcon-D-7Sxfw7.js">
|
|
15
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-BxOjfeaD.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/katex-BzT-4KBu.js">
|
|
17
|
-
<link rel="modulepreload" crossorigin href="/assets/search-
|
|
18
|
-
<link rel="modulepreload" crossorigin href="/assets/external-link-
|
|
19
|
-
<link rel="modulepreload" crossorigin href="/assets/inbox-
|
|
20
|
-
<link rel="modulepreload" crossorigin href="/assets/x-
|
|
21
|
-
<link rel="modulepreload" crossorigin href="/assets/plus-
|
|
22
|
-
<link rel="modulepreload" crossorigin href="/assets/context-menu-
|
|
23
|
-
<link rel="modulepreload" crossorigin href="/assets/dialog-
|
|
17
|
+
<link rel="modulepreload" crossorigin href="/assets/search-Drx-sMCE.js">
|
|
18
|
+
<link rel="modulepreload" crossorigin href="/assets/external-link-NwtWKzE2.js">
|
|
19
|
+
<link rel="modulepreload" crossorigin href="/assets/inbox-DofXi7Xv.js">
|
|
20
|
+
<link rel="modulepreload" crossorigin href="/assets/x-DLvS4xvV.js">
|
|
21
|
+
<link rel="modulepreload" crossorigin href="/assets/plus-v29lPO18.js">
|
|
22
|
+
<link rel="modulepreload" crossorigin href="/assets/context-menu-DVgLoPqH.js">
|
|
23
|
+
<link rel="modulepreload" crossorigin href="/assets/dialog-InO6RVpm.js">
|
|
24
24
|
<link rel="modulepreload" crossorigin href="/assets/navigation-history-CCnxsAKR.js">
|
|
25
|
-
<link rel="modulepreload" crossorigin href="/assets/theme-provider-
|
|
25
|
+
<link rel="modulepreload" crossorigin href="/assets/theme-provider-DDJOlUxn.js">
|
|
26
26
|
<link rel="stylesheet" crossorigin href="/assets/context-menu-DEcVZfaU.css">
|
|
27
27
|
<link rel="stylesheet" crossorigin href="/assets/panelStandalone-XRlWxbRS.css">
|
|
28
28
|
</head>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/ui",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
|
|
35
35
|
"zod": "^3.23.8",
|
|
36
36
|
"zustand": "^5.0.2",
|
|
37
|
+
"@nextclaw/client-sdk": "0.12.12",
|
|
37
38
|
"@nextclaw/agent-chat": "0.3.14",
|
|
38
39
|
"@nextclaw/agent-chat-ui": "0.12.2",
|
|
39
40
|
"@nextclaw/ncp": "0.11.2",
|
|
40
|
-
"@nextclaw/client-sdk": "0.12.11",
|
|
41
41
|
"@nextclaw/ncp-http-agent-client": "0.4.26",
|
|
42
42
|
"@nextclaw/ncp-react": "0.5.30",
|
|
43
43
|
"@nextclaw/ncp-toolkit": "0.6.27",
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
2
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { I18nProvider } from '@/app/components/i18n-provider';
|
|
5
|
+
import type { ChatComposerSubmission } from '@/features/chat/stores/chat-composer-draft.store';
|
|
6
|
+
import type { SessionConversationInputSnapshot } from '@/features/chat/features/conversation/hooks/use-session-conversation-input-state';
|
|
7
|
+
import type { SessionConversationInputController } from '@/features/chat/features/conversation/types/session-conversation-input.types';
|
|
8
|
+
import { SessionConversationInputTopSlot } from '@/features/chat/features/conversation/components/session-conversation-input-top-slot';
|
|
9
|
+
|
|
10
|
+
const submission: ChatComposerSubmission = {
|
|
11
|
+
envelope: {
|
|
12
|
+
sessionId: 'session-confirmation', idempotencyKey: 'user-confirmation',
|
|
13
|
+
message: {
|
|
14
|
+
id: 'user-confirmation', sessionId: 'session-confirmation', role: 'user',
|
|
15
|
+
status: 'final', timestamp: '2026-09-26T00:00:00.000Z',
|
|
16
|
+
parts: [{ type: 'text', text: '你好' }],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
composer: { text: '你好', nodes: [], attachments: [], selectedSkills: [], skillRecords: [] },
|
|
20
|
+
status: 'sending',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
function renderTopSlot(status: ChatComposerSubmission['status'], queued = false, text = '') {
|
|
24
|
+
const inputSnapshot: SessionConversationInputSnapshot = {
|
|
25
|
+
...submission.composer, text, composerFocusRequestId: 0, pendingProjectRoot: null,
|
|
26
|
+
pendingSessionType: 'default', selectedModel: null, selectedSessionType: 'default',
|
|
27
|
+
selectedThinkingLevel: null, sendError: null, pendingSubmission: { ...submission, status },
|
|
28
|
+
};
|
|
29
|
+
const controller: SessionConversationInputController = {
|
|
30
|
+
canEditQueuedInput: true, canStopGeneration: true, isSending: true,
|
|
31
|
+
primaryAction: 'send', sendDisabled: true, stopDisabled: false,
|
|
32
|
+
queuedInputs: queued ? [{ id: 'user-confirmation', isSubmitting: true, preview: '你好' }] : [],
|
|
33
|
+
deleteQueuedInput: vi.fn(), editQueuedInput: vi.fn(), steerQueuedInput: vi.fn(),
|
|
34
|
+
send: vi.fn(), sendSteering: vi.fn(), sendPresetMessage: vi.fn(), stop: vi.fn(),
|
|
35
|
+
retryPendingSubmission: vi.fn(), restorePendingSubmission: vi.fn(), discardPendingSubmission: vi.fn(),
|
|
36
|
+
};
|
|
37
|
+
const view = render(<I18nProvider>
|
|
38
|
+
<SessionConversationInputTopSlot inputSnapshot={inputSnapshot} controller={controller} />
|
|
39
|
+
</I18nProvider>);
|
|
40
|
+
return { ...view, controller };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
describe('SessionConversationInputTopSlot', () => {
|
|
44
|
+
it.each([false, true])('does not add a receipt card during normal sending (queued: %s)', (queued) => {
|
|
45
|
+
const { container } = renderTopSlot('sending', queued);
|
|
46
|
+
expect(screen.queryByRole('status')).toBeNull();
|
|
47
|
+
expect(screen.queryByText('Checking whether the message was received…')).toBeNull();
|
|
48
|
+
expect(screen.queryAllByText('你好')).toHaveLength(queued ? 1 : 0);
|
|
49
|
+
if (!queued) expect(container.childElementCount).toBe(0);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('keeps recovery available when the send result is unknown', () => {
|
|
53
|
+
const { controller } = renderTopSlot('uncertain');
|
|
54
|
+
expect(screen.getByRole('status').textContent).toContain('你好');
|
|
55
|
+
fireEvent.click(screen.getByRole('button', { name: 'Check and retry original request' }));
|
|
56
|
+
expect(controller.retryPendingSubmission).toHaveBeenCalledOnce();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('does not offer to overwrite new input with a rejected message', () => {
|
|
60
|
+
renderTopSlot('rejected', false, '新的草稿');
|
|
61
|
+
expect(screen.getByRole('status').textContent).toContain('你好');
|
|
62
|
+
expect((screen.getByRole('button', { name: 'Restore message' }) as HTMLButtonElement).disabled).toBe(true);
|
|
63
|
+
expect(screen.getByRole('button', { name: 'Discard failed message' })).toBeTruthy();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('lets a rejected message be restored when the composer is empty', () => {
|
|
67
|
+
const { controller } = renderTopSlot('rejected');
|
|
68
|
+
fireEvent.click(screen.getByRole('button', { name: 'Restore message' }));
|
|
69
|
+
expect(controller.restorePendingSubmission).toHaveBeenCalledOnce();
|
|
70
|
+
});
|
|
71
|
+
});
|
package/src/features/chat/features/conversation/components/session-conversation-input-top-slot.tsx
CHANGED
|
@@ -9,10 +9,11 @@ export function SessionConversationInputTopSlot({ inputSnapshot, controller }: {
|
|
|
9
9
|
readonly controller: SessionConversationInputController;
|
|
10
10
|
}) {
|
|
11
11
|
const submission = inputSnapshot.pendingSubmission;
|
|
12
|
-
|
|
12
|
+
const needsRecovery = submission && submission.status !== 'sending';
|
|
13
|
+
if (!needsRecovery && controller.queuedInputs.length === 0) return null;
|
|
13
14
|
return <>
|
|
14
15
|
{controller.queuedInputs.length > 0 && <SessionQueuedInputRows controller={controller} />}
|
|
15
|
-
{
|
|
16
|
+
{needsRecovery && <SubmissionStatus submission={submission} controller={controller}
|
|
16
17
|
hasComposerContent={Boolean(inputSnapshot.text.trim() || inputSnapshot.selectedSkills.length || inputSnapshot.attachments.length)} />}
|
|
17
18
|
</>;
|
|
18
19
|
}
|
|
@@ -22,11 +23,9 @@ function SubmissionStatus({ submission, controller, hasComposerContent }: {
|
|
|
22
23
|
readonly controller: SessionConversationInputController;
|
|
23
24
|
readonly hasComposerContent: boolean;
|
|
24
25
|
}) {
|
|
25
|
-
const statusText = submission.status === '
|
|
26
|
-
? t('
|
|
27
|
-
: submission.
|
|
28
|
-
? t('chatSubmissionRejected')
|
|
29
|
-
: t(submission.envelope.sessionId ? 'chatSendResultUnknown' : 'chatSendResultUnknownChild');
|
|
26
|
+
const statusText = submission.status === 'rejected'
|
|
27
|
+
? t('chatSubmissionRejected')
|
|
28
|
+
: t(submission.envelope.sessionId ? 'chatSendResultUnknown' : 'chatSendResultUnknownChild');
|
|
30
29
|
return <div className="rounded-lg border border-border bg-muted/50 px-3 py-2 text-sm" role="status">
|
|
31
30
|
<p>{statusText}</p>
|
|
32
31
|
<p className="mt-1 max-h-16 overflow-auto whitespace-pre-wrap text-muted-foreground">{submission.composer.text}</p>
|