UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 5.35 kB
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{mi as t,pi as n}from"./_4____________________________.js";import{GN as r,IN as i,JN as a,OP as o,PN as s,PP as c,fN as l,pN as u,qN as d}from"./_2_____________________________.js";import{c as f,l as p}from"./deferred-ui-support-DZEPWjAk.js";import{B as m,F as h,I as g,O as _,Rt as v,S as y,U as b,d as x,f as S,g as C,j as w,l as T,s as E,u as D,x as O,yt as k}from"./_6____________________.js";var A,j;function M(){return(M=e((()=>{t(),A={chat:{permissions:{title:`Grant {permissions}`,neededOn:`OpenClaw needs access on {node} to continue this action.`,openApp:`Grant access in the OpenClaw Mac app on that device: Settings → This Mac → Permissions. Then tell the agent to try again.`,ready:`Access is available. You can ask the agent to try again.`,following:`Then grant the remaining permissions: {permissions}.`,actions:{"not-determined":`Grant {permissions}`,denied:`Open System Settings`,"restart-required":`Relaunch OpenClaw`,"stale-grant":`Open System Settings`,"disabled-in-openclaw":`Enable {permissions}`},tryAgain:`Try again`,retryMessage:`I granted {permissions}, try again.`,states:{"not-determined":`Choose Grant to review the permission request.`,denied:`Open System Settings to allow access for OpenClaw.`,"restart-required":`If you enabled access in System Settings, relaunch OpenClaw to make it available.`,"stale-grant":`macOS may be using a stale permission grant. Open System Settings to review it.`,"disabled-in-openclaw":`Choose Enable to review and enable this capability in OpenClaw.`},capabilities:{notifications:`Notifications`,accessibility:`Accessibility`,eventPosting:`Event posting`,screenRecording:`Screen Recording`,microphone:`Microphone`,speechRecognition:`Speech Recognition`,camera:`Camera`,cameraEnabled:`Camera in OpenClaw`,location:`Location`,computerControl:`Computer control`,canvas:`Canvas`,automation:`Automation`}}}},j=Object.assign(()=>Object.assign(n.chat.permissions,A.chat.permissions),{catalog:A})})))()}function N(e){let t=i()?.nativeDeviceSettings,n=t?p(t):null,[r,o]=g(!1),[s,u]=m(),d=(t=e.request.capabilities)=>t.map(e=>{let t=`chat.permissions.capabilities.${e}`,n=a(t);return n===t?e:n}).join(`, `),f=()=>n?.read()?.device.nodeId===e.request.nodeId&&t?.resolvePermission,b=h(()=>{let t=n?.read();return e.request.capabilities.filter(e=>{if(e===`computerControl`)return t?.capabilities?.computerControlEnabled!==!0;if(e===`canvas`)return t?.capabilities?.canvasEnabled!==!0;if(e===`cameraEnabled`)return t?.capabilities?.cameraEnabled!==!0;if(e===`location`&&t?.permissions.location?.mode===`off`)return!0;let n=t?.permissions.entries.find(t=>t.id===e);return n?.status!==`granted`||!!n.state})}),E=h(()=>b().filter(e=>e===`computerControl`||e===`canvas`||e===`cameraEnabled`||e===`location`&&n?.read()?.permissions.location?.mode===`off`&&n?.read()?.permissions.entries.find(t=>t.id===e)?.status!==`denied`)),D=()=>!!f()&&b().length===0,O=h(()=>{let t=n?.read();if(f()){if(E().length>0)return{state:`disabled-in-openclaw`,capabilities:E()};for(let e of[`stale-grant`,`restart-required`,`denied`,`not-determined`]){let n=b().filter(n=>{let r=t?.permissions.entries.find(e=>e.id===n);return r?.state===e||e===`denied`&&r?.status===`denied`||e===`not-determined`&&r?.status===`notDetermined`});if(n.length>0)return{state:e,capabilities:n}}}return{state:e.request.state,capabilities:b()}}),A=()=>O().state===`disabled-in-openclaw`?b().filter(e=>!E().includes(e)):[],j=k(function*(){let t=f();t&&!r()&&(o(!0),yield t({...e.request,...O()}))});var M=I(),N=M.firstChild,R=N.firstChild,z=R.firstChild,B=R.nextSibling,V=B.nextSibling,H=V.nextSibling;return M._$owner=v(),x(R,w(l,{name:`shieldCheck`}),z),x(z,()=>a(`chat.permissions.title`,{permissions:d()})),x(B,()=>a(`chat.permissions.neededOn`,{node:e.request.nodeName??e.request.nodeId})),x(N,w(_,{get when(){return f()},get fallback(){var e=P();return x(e,()=>a(`chat.permissions.openApp`)),e},get children(){return[(()=>{var e=P();return x(e,()=>a(D()?`chat.permissions.ready`:`chat.permissions.states.${O().state}`)),e})(),w(_,{get when(){return A().length>0},get children(){var e=P();return x(e,()=>a(`chat.permissions.following`,{permissions:d(A())})),e}}),w(_,{get when(){return D()},get fallback(){var e=F();return e._$$click=()=>{let e=j();e.catch(()=>{}),u({promise:e})},x(e,()=>a(`chat.permissions.actions.${O().state}`,{permissions:d(O().capabilities)})),T(()=>r(),t=>{C(e,`disabled`,t)}),e},get children(){var t=F();return t._$$click=()=>e.onRetry?.(a(`chat.permissions.retryMessage`,{permissions:d()})),x(t,()=>a(`chat.permissions.tryAgain`)),T(()=>!e.onRetry,e=>{C(t,`disabled`,e)}),t}})]}}),V),x(N,w(_,{get when(){return S(()=>!r())()&&s()},keyed:!0,children:({promise:e})=>{let t=h(()=>e,{loadingValue:void 0});return w(y,{fallback:e=>(()=>{var t=L();return x(t,()=>c(e())),t})(),get children(){return t()}})}}),H),T(()=>a(`chat.permissions.title`,{permissions:d()}),e=>{C(N,`aria-label`,e)}),M}var P,F,I,L;function R(){return(R=e((()=>{D(),o(),b(),u(),M(),f(),s(),r(),P=O(`<p>`),F=O(`<button class="btn primary"type=button>`),I=O(`<openclaw-chat-permission-card><section class=chat-permission-card><div class=chat-permission-card__heading><strong></strong></div><p></p><!><!>`,1),L=O(`<p role=alert>`),d(j),E([`click`])})))()}R();export{N as ChatPermissionCard};