${e.loading?l`
Loading chat…
`:p}
${Il(Nh(e),v=>v.key,v=>v.kind==="reading-indicator"?$h(r):v.kind==="stream"?kh(v.text,v.startedAt,e.onOpenSidebar,r):v.kind==="group"?Ah(v,{onOpenSidebar:e.onOpenSidebar,showReasoning:o,assistantName:e.assistantName,assistantAvatar:r.avatar}):p)}
`;return l`
0?t.push({kind:"stream",key:a,text:e.stream,startedAt:e.streamStartedAt??Date.now()}):t.push({kind:"reading-indicator",key:a})}return Fh(t)}function wo(e,t){const n=e,i=typeof n.toolCallId=="string"?n.toolCallId:"";if(i)return`tool:${i}`;const s=typeof n.id=="string"?n.id:"";if(s)return`msg:${s}`;const a=typeof n.messageId=="string"?n.messageId:"";if(a)return`msg:${a}`;const o=typeof n.timestamp=="number"?n.timestamp:null,r=typeof n.role=="string"?n.role:"unknown";return o!=null?`msg:${r}:${o}:${t}`:`msg:${r}:${t}`}const Qi={all:l`
`,env:l`
`,update:l`
`,agents:l`
`,auth:l`
`,channels:l`
`,messages:l`
`,commands:l`
`,hooks:l`
`,skills:l`
`,tools:l`
`,gateway:l`
`,wizard:l`
`,meta:l`
`,logging:l`
`,browser:l`
`,ui:l`
`,models:l`
`,bindings:l`
`,broadcast:l`
`,audio:l`
`,session:l`
`,cron:l`
`,web:l`
`,discovery:l`
`,canvasHost:l`
`,talk:l`
`,plugins:l`
`,default:l`
`},$o=[{key:"env",label:"Environment"},{key:"update",label:"Updates"},{key:"agents",label:"Agents"},{key:"auth",label:"Authentication"},{key:"channels",label:"Channels"},{key:"messages",label:"Messages"},{key:"commands",label:"Commands"},{key:"hooks",label:"Hooks"},{key:"skills",label:"Skills"},{key:"tools",label:"Tools"},{key:"gateway",label:"Gateway"},{key:"wizard",label:"Setup Wizard"}],ko="__all__";function Ao(e){return Qi[e]??Qi.default}function Dh(e,t){const n=Ss[e];return n||{label:t?.title??Ee(e),description:t?.description??""}}function Oh(e){const{key:t,schema:n,uiHints:i}=e;if(!n||$e(n)!=="object"||!n.properties)return[];const s=Object.entries(n.properties).map(([a,o])=>{const r=le([t,a],i),c=r?.label??o.title??Ee(a),u=r?.help??o.description??"",f=r?.order??50;return{key:a,label:c,description:u,order:f}});return s.sort((a,o)=>a.order!==o.order?a.order-o.order:a.key.localeCompare(o.key)),s}function Bh(e,t){if(!e||!t)return[];const n=[];function i(s,a,o){if(s===a)return;if(typeof s!=typeof a){n.push({path:o,from:s,to:a});return}if(typeof s!="object"||s===null||a===null){s!==a&&n.push({path:o,from:s,to:a});return}if(Array.isArray(s)&&Array.isArray(a)){JSON.stringify(s)!==JSON.stringify(a)&&n.push({path:o,from:s,to:a});return}const r=s,c=a,u=new Set([...Object.keys(r),...Object.keys(c)]);for(const f of u)i(r[f],c[f],o?`${o}.${f}`:f)}return i(e,t,""),n}function xo(e,t=40){let n;try{n=JSON.stringify(e)??String(e)}catch{n=String(e)}return n.length<=t?n:n.slice(0,t-3)+"..."}function Uh(e){const t=e.valid==null?"unknown":e.valid?"valid":"invalid",n=Kl(e.schema),i=n.schema?n.unsupportedPaths.length>0:!1,s=n.schema?.properties??{},a=$o.filter(E=>E.key in s),o=new Set($o.map(E=>E.key)),r=Object.keys(s).filter(E=>!o.has(E)).map(E=>({key:E,label:E.charAt(0).toUpperCase()+E.slice(1)})),c=[...a,...r],u=e.activeSection&&n.schema&&$e(n.schema)==="object"?n.schema.properties?.[e.activeSection]:void 0,f=e.activeSection?Dh(e.activeSection,u):null,g=e.activeSection?Oh({key:e.activeSection,schema:u,uiHints:e.uiHints}):[],m=e.formMode==="form"&&!!e.activeSection&&g.length>0,v=e.activeSubsection===ko,b=e.searchQuery||v?null:e.activeSubsection??g[0]?.key??null,d=e.formMode==="form"?Bh(e.originalValue,e.formValue):[],y=e.formMode==="raw"&&e.raw!==e.originalRaw,A=e.formMode==="form"?d.length>0:y,S=!!e.formValue&&!e.loading&&!!n.schema,T=e.connected&&!e.saving&&A&&(e.formMode==="raw"?!0:S),x=e.connected&&!e.applying&&!e.updating&&A&&(e.formMode==="raw"?!0:S),C=e.connected&&!e.applying&&!e.updating;return l`
${A?l`
${e.formMode==="raw"?"Unsaved changes":`${d.length} unsaved change${d.length!==1?"s":""}`}
`:l`
No changes
`}
${e.loading?"Loading…":"Reload"}
${e.saving?"Saving…":"Save"}
${e.applying?"Applying…":"Apply"}
${e.updating?"Updating…":"Update"}
${A&&e.formMode==="form"?l`
View ${d.length} pending
change${d.length!==1?"s":""}
${d.map(E=>l`
${E.path}
${xo(E.from)}
→
${xo(E.to)}
`)}
`:p}
${f&&e.formMode==="form"?l`
${Ao(e.activeSection??"")}
${f.label}
${f.description?l`
${f.description}
`:p}
`:p}
${m?l`
e.onSubsectionChange(ko)}
>
All
${g.map(E=>l`
e.onSubsectionChange(E.key)}
>
${E.label}
`)}
`:p}
${e.formMode==="form"?l`
${e.schemaLoading?l`
`:Zf({schema:n.schema,uiHints:e.uiHints,value:e.formValue,disabled:e.loading||!e.formValue,unsupportedPaths:n.unsupportedPaths,onPatch:e.onFormPatch,searchQuery:e.searchQuery,activeSection:e.activeSection,activeSubsection:b})}
${i?l`
Form view can't safely edit some fields. Use Raw to avoid losing config entries.
`:p}
`:l`
Raw JSON5
`}
${e.issues.length>0?l`
${JSON.stringify(e.issues,null,2)}
`:p}
`}function Kh(e){const t=["last",...e.channels.filter(Boolean)],n=e.form.deliveryChannel?.trim();n&&!t.includes(n)&&t.push(n);const i=new Set;return t.filter(s=>i.has(s)?!1:(i.add(s),!0))}function zh(e,t){if(t==="last")return"last";const n=e.channelMeta?.find(i=>i.id===t);return n?.label?n.label:e.channelLabels?.[t]??t}function Hh(e){const t=Kh(e);return l`
Scheduler
Gateway-owned cron scheduler status.
Enabled
${e.status?e.status.enabled?"Yes":"No":"n/a"}
Jobs
${e.status?.jobs??"n/a"}
Next wake
${xs(e.status?.nextWakeAtMs??null)}
${e.loading?"Refreshing…":"Refresh"}
${e.error?l`${e.error} `:p}
Jobs
All scheduled jobs stored in the gateway.
${e.jobs.length===0?l`
No jobs yet.
`:l`
${e.jobs.map(n=>Gh(n,e))}
`}
Run history
Latest runs for ${e.runsJobId??"(select a job)"}.
${e.runsJobId==null?l`
Select a job to inspect run history.
`:e.runs.length===0?l`
No runs yet.
`:l`
${e.runs.map(n=>Wh(n))}
`}
`}function jh(e){const t=e.form;return t.scheduleKind==="at"?l`
Run at
e.onFormChange({scheduleAt:n.target.value})}
/>
`:t.scheduleKind==="every"?l`
Every
e.onFormChange({everyAmount:n.target.value})}
/>
Unit
e.onFormChange({everyUnit:n.target.value})}
>
Minutes
Hours
Days
`:l`
Expression
e.onFormChange({cronExpr:n.target.value})}
/>
Timezone (optional)
e.onFormChange({cronTz:n.target.value})}
/>
`}function Gh(e,t){const i=`list-item list-item-clickable${t.runsJobId===e.id?" list-item-selected":""}`;return l`
t.onLoadRuns(e.id)}>
${e.name}
${Pl(e)}
${Fl(e)}
${e.agentId?l`
Agent: ${e.agentId}
`:p}
${e.enabled?"enabled":"disabled"}
${e.sessionTarget}
${e.wakeMode}
`}function Wh(e){return l`
${e.status}
${e.summary??""}
`}function qh(e){const n=(e.status&&typeof e.status=="object"?e.status.securityAudit:null)?.summary??null,i=n?.critical??0,s=n?.warn??0,a=n?.info??0,o=i>0?"danger":s>0?"warn":"success",r=i>0?`${i} critical`:s>0?`${s} warnings`:"No critical issues";return l`
Snapshots
Status, health, and heartbeat data.
${e.loading?"Refreshing…":"Refresh"}
Status
${n?l`
Security audit: ${r}${a>0?` · ${a} info`:""}. Run
openclaw security audit --deep for details.
`:p}
${JSON.stringify(e.status??{},null,2)}
Health
${JSON.stringify(e.health??{},null,2)}
Last heartbeat
${JSON.stringify(e.heartbeat??{},null,2)}
Manual RPC
Send a raw gateway method with JSON params.
Method
e.onCallMethodChange(c.target.value)}
placeholder="system-presence"
/>
Params (JSON)
Call
${e.callError?l`
${e.callError}
`:p}
${e.callResult?l`
${e.callResult} `:p}
Models
Catalog from models.list.
${JSON.stringify(e.models??[],null,2)}
Event Log
Latest gateway events.
${e.eventLog.length===0?l`
No events yet.
`:l`
${e.eventLog.map(c=>l`
${c.event}
${new Date(c.ts).toLocaleTimeString()}
`)}
`}
`}function Vh(e){const t=Math.max(0,e),n=Math.floor(t/1e3);if(n<60)return`${n}s`;const i=Math.floor(n/60);return i<60?`${i}m`:`${Math.floor(i/60)}h`}function ze(e,t){return t?l`${e} ${t}
`:p}function Yh(e){const t=e.execApprovalQueue[0];if(!t)return p;const n=t.request,i=t.expiresAtMs-Date.now(),s=i>0?`expires in ${Vh(i)}`:"expired",a=e.execApprovalQueue.length;return l`
${n.command}
${ze("Host",n.host)}
${ze("Agent",n.agentId)}
${ze("Session",n.sessionKey)}
${ze("CWD",n.cwd)}
${ze("Resolved",n.resolvedPath)}
${ze("Security",n.security)}
${ze("Ask",n.ask)}
${e.execApprovalError?l`
${e.execApprovalError}
`:p}
e.handleExecApprovalDecision("allow-once")}
>
Allow once
e.handleExecApprovalDecision("allow-always")}
>
Always allow
e.handleExecApprovalDecision("deny")}
>
Deny
`}function Qh(e){const{pendingGatewayUrl:t}=e;return t?l`
${t}
Only confirm if you trust this URL. Malicious URLs can compromise your system.
e.handleGatewayUrlConfirm()}
>
Confirm
e.handleGatewayUrlCancel()}
>
Cancel
`:p}function Jh(e){return l`
Connected Instances
Presence beacons from the gateway and clients.
${e.loading?"Loading…":"Refresh"}
${e.lastError?l`
${e.lastError}
`:p}
${e.statusMessage?l`
${e.statusMessage}
`:p}
${e.entries.length===0?l`
No instances reported yet.
`:e.entries.map(t=>Zh(t))}
`}function Zh(e){const t=e.lastInputSeconds!=null?`${e.lastInputSeconds}s ago`:"n/a",n=e.mode??"unknown",i=Array.isArray(e.roles)?e.roles.filter(Boolean):[],s=Array.isArray(e.scopes)?e.scopes.filter(Boolean):[],a=s.length>0?s.length>3?`${s.length} scopes`:`scopes: ${s.join(", ")}`:null;return l`
${e.host??"unknown host"}
${ff(e)}
${n}
${i.map(o=>l`${o} `)}
${a?l`${a} `:p}
${e.platform?l`${e.platform} `:p}
${e.deviceFamily?l`${e.deviceFamily} `:p}
${e.modelIdentifier?l`${e.modelIdentifier} `:p}
${e.version?l`${e.version} `:p}
`}const So=["trace","debug","info","warn","error","fatal"];function Xh(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString()}function ev(e,t){return t?[e.message,e.subsystem,e.raw].filter(Boolean).join(" ").toLowerCase().includes(t):!0}function tv(e){const t=e.filterText.trim().toLowerCase(),n=So.some(a=>!e.levelFilters[a]),i=e.entries.filter(a=>a.level&&!e.levelFilters[a.level]?!1:ev(a,t)),s=t||n?"filtered":"visible";return l`
Logs
Gateway file logs (JSONL).
${e.loading?"Loading…":"Refresh"}
e.onExport(i.map(a=>a.raw),s)}
>
Export ${s}
Filter
e.onFilterTextChange(a.target.value)}
placeholder="Search logs"
/>
Auto-follow
e.onToggleAutoFollow(a.target.checked)}
/>
${So.map(a=>l`
e.onLevelToggle(a,o.target.checked)}
/>
${a}
`)}
${e.file?l`File: ${e.file}
`:p}
${e.truncated?l`
Log output truncated; showing latest chunk.
`:p}
${e.error?l`${e.error}
`:p}
${i.length===0?l`
No log entries.
`:i.map(a=>l`
${Xh(a.time)}
${a.level??""}
${a.subsystem??""}
${a.message??a.raw}
`)}
`}function nv(e){const t=rv(e),n=pv(e);return l`
${vv(n)}
${hv(t)}
${iv(e)}
Nodes
Paired devices and live links.
${e.loading?"Loading…":"Refresh"}
${e.nodes.length===0?l`
No nodes found.
`:e.nodes.map(i=>_v(i))}
`}function iv(e){const t=e.devicesList??{pending:[],paired:[]},n=Array.isArray(t.pending)?t.pending:[],i=Array.isArray(t.paired)?t.paired:[];return l`
Devices
Pairing requests + role tokens.
${e.devicesLoading?"Loading…":"Refresh"}
${e.devicesError?l`${e.devicesError}
`:p}
${n.length>0?l`
Pending
${n.map(s=>sv(s,e))}
`:p}
${i.length>0?l`
Paired
${i.map(s=>av(s,e))}
`:p}
${n.length===0&&i.length===0?l`
No paired devices.
`:p}
`}function sv(e,t){const n=e.displayName?.trim()||e.deviceId,i=typeof e.ts=="number"?O(e.ts):"n/a",s=e.role?.trim()?`role: ${e.role}`:"role: -",a=e.isRepair?" · repair":"",o=e.remoteIp?` · ${e.remoteIp}`:"";return l`
${n}
${e.deviceId}${o}
${s} · requested ${i}${a}
`}function av(e,t){const n=e.displayName?.trim()||e.deviceId,i=e.remoteIp?` · ${e.remoteIp}`:"",s=`roles: ${Si(e.roles)}`,a=`scopes: ${Si(e.scopes)}`,o=Array.isArray(e.tokens)?e.tokens:[];return l`
${n}
${e.deviceId}${i}
${s} · ${a}
${o.length===0?l`
Tokens: none
`:l`
Tokens
${o.map(r=>ov(e.deviceId,r,t))}
`}
`}function ov(e,t,n){const i=t.revokedAtMs?"revoked":"active",s=`scopes: ${Si(t.scopes)}`,a=O(t.rotatedAtMs??t.createdAtMs??t.lastUsedAtMs??null);return l`
${t.role} · ${i} · ${s} · ${a}
n.onDeviceRotate(e,t.role,t.scopes)}
>
Rotate
${t.revokedAtMs?p:l`
n.onDeviceRevoke(e,t.role)}
>
Revoke
`}
`}const Re="__defaults__",_o=[{value:"deny",label:"Deny"},{value:"allowlist",label:"Allowlist"},{value:"full",label:"Full"}],lv=[{value:"off",label:"Off"},{value:"on-miss",label:"On miss"},{value:"always",label:"Always"}];function rv(e){const t=e.configForm,n=Av(e.nodes),{defaultBinding:i,agents:s}=Sv(t),a=!!t,o=e.configSaving||e.configFormMode==="raw";return{ready:a,disabled:o,configDirty:e.configDirty,configLoading:e.configLoading,configSaving:e.configSaving,defaultBinding:i,agents:s,nodes:n,onBindDefault:e.onBindDefault,onBindAgent:e.onBindAgent,onSave:e.onSaveBindings,onLoadConfig:e.onLoadConfig,formMode:e.configFormMode}}function Co(e){return e==="allowlist"||e==="full"||e==="deny"?e:"deny"}function cv(e){return e==="always"||e==="off"||e==="on-miss"?e:"on-miss"}function dv(e){const t=e?.defaults??{};return{security:Co(t.security),ask:cv(t.ask),askFallback:Co(t.askFallback??"deny"),autoAllowSkills:!!(t.autoAllowSkills??!1)}}function uv(e){const t=e?.agents??{},n=Array.isArray(t.list)?t.list:[],i=[];return n.forEach(s=>{if(!s||typeof s!="object")return;const a=s,o=typeof a.id=="string"?a.id.trim():"";if(!o)return;const r=typeof a.name=="string"?a.name.trim():void 0,c=a.default===!0;i.push({id:o,name:r||void 0,isDefault:c})}),i}function fv(e,t){const n=uv(e),i=Object.keys(t?.agents??{}),s=new Map;n.forEach(o=>s.set(o.id,o)),i.forEach(o=>{s.has(o)||s.set(o,{id:o})});const a=Array.from(s.values());return a.length===0&&a.push({id:"main",isDefault:!0}),a.sort((o,r)=>{if(o.isDefault&&!r.isDefault)return-1;if(!o.isDefault&&r.isDefault)return 1;const c=o.name?.trim()?o.name:o.id,u=r.name?.trim()?r.name:r.id;return c.localeCompare(u)}),a}function gv(e,t){return e===Re?Re:e&&t.some(n=>n.id===e)?e:Re}function pv(e){const t=e.execApprovalsForm??e.execApprovalsSnapshot?.file??null,n=!!t,i=dv(t),s=fv(e.configForm,t),a=xv(e.nodes),o=e.execApprovalsTarget;let r=o==="node"&&e.execApprovalsTargetNodeId?e.execApprovalsTargetNodeId:null;o==="node"&&r&&!a.some(g=>g.id===r)&&(r=null);const c=gv(e.execApprovalsSelectedAgent,s),u=c!==Re?(t?.agents??{})[c]??null:null,f=Array.isArray(u?.allowlist)?u.allowlist??[]:[];return{ready:n,disabled:e.execApprovalsSaving||e.execApprovalsLoading,dirty:e.execApprovalsDirty,loading:e.execApprovalsLoading,saving:e.execApprovalsSaving,form:t,defaults:i,selectedScope:c,selectedAgent:u,agents:s,allowlist:f,target:o,targetNodeId:r,targetNodes:a,onSelectScope:e.onExecApprovalsSelectAgent,onSelectTarget:e.onExecApprovalsTargetChange,onPatch:e.onExecApprovalsPatch,onRemove:e.onExecApprovalsRemove,onLoad:e.onLoadExecApprovals,onSave:e.onSaveExecApprovals}}function hv(e){const t=e.nodes.length>0,n=e.defaultBinding??"";return l`
Exec node binding
Pin agents to a specific node when using exec host=node .
${e.configSaving?"Saving…":"Save"}
${e.formMode==="raw"?l`
Switch the Config tab to Form mode to edit bindings here.
`:p}
${e.ready?l`
Default binding
Used when agents do not override a node binding.
${e.agents.length===0?l`
No agents found.
`:e.agents.map(i=>kv(i,e))}
`:l`
Load config to edit bindings.
${e.configLoading?"Loading…":"Load config"}
`}
`}function vv(e){const t=e.ready,n=e.target!=="node"||!!e.targetNodeId;return l`
Exec approvals
Allowlist and approval policy for exec host=gateway/node .
${e.saving?"Saving…":"Save"}
${mv(e)}
${t?l`
${yv(e)}
${bv(e)}
${e.selectedScope===Re?p:wv(e)}
`:l`
Load exec approvals to edit allowlists.
${e.loading?"Loading…":"Load approvals"}
`}
`}function mv(e){const t=e.targetNodes.length>0,n=e.targetNodeId??"";return l`
Target
Gateway edits local approvals; node edits the selected node.
Host
{if(i.target.value==="node"){const o=e.targetNodes[0]?.id??null;e.onSelectTarget("node",n||o)}else e.onSelectTarget("gateway",null)}}
>
Gateway
Node
${e.target==="node"?l`
Node
{const a=i.target.value.trim();e.onSelectTarget("node",a||null)}}
>
Select node
${e.targetNodes.map(i=>l`
${i.label}
`)}
`:p}
${e.target==="node"&&!t?l`
No nodes advertise exec approvals yet.
`:p}
`}function yv(e){return l`
Scope
e.onSelectScope(Re)}
>
Defaults
${e.agents.map(t=>{const n=t.name?.trim()?`${t.name} (${t.id})`:t.id;return l`
e.onSelectScope(t.id)}
>
${n}
`})}
`}function bv(e){const t=e.selectedScope===Re,n=e.defaults,i=e.selectedAgent??{},s=t?["defaults"]:["agents",e.selectedScope],a=typeof i.security=="string"?i.security:void 0,o=typeof i.ask=="string"?i.ask:void 0,r=typeof i.askFallback=="string"?i.askFallback:void 0,c=t?n.security:a??"__default__",u=t?n.ask:o??"__default__",f=t?n.askFallback:r??"__default__",g=typeof i.autoAllowSkills=="boolean"?i.autoAllowSkills:void 0,m=g??n.autoAllowSkills,v=g==null;return l`
Security
${t?"Default security mode.":`Default: ${n.security}.`}
Mode
{const y=b.target.value;!t&&y==="__default__"?e.onRemove([...s,"security"]):e.onPatch([...s,"security"],y)}}
>
${t?p:l`
Use default (${n.security})
`}
${_o.map(b=>l`
${b.label}
`)}
Ask
${t?"Default prompt policy.":`Default: ${n.ask}.`}
Mode
{const y=b.target.value;!t&&y==="__default__"?e.onRemove([...s,"ask"]):e.onPatch([...s,"ask"],y)}}
>
${t?p:l`
Use default (${n.ask})
`}
${lv.map(b=>l`
${b.label}
`)}
Ask fallback
${t?"Applied when the UI prompt is unavailable.":`Default: ${n.askFallback}.`}
Fallback
{const y=b.target.value;!t&&y==="__default__"?e.onRemove([...s,"askFallback"]):e.onPatch([...s,"askFallback"],y)}}
>
${t?p:l`
Use default (${n.askFallback})
`}
${_o.map(b=>l`
${b.label}
`)}
Auto-allow skill CLIs
${t?"Allow skill executables listed by the Gateway.":v?`Using default (${n.autoAllowSkills?"on":"off"}).`:`Override (${m?"on":"off"}).`}
Enabled
{const d=b.target;e.onPatch([...s,"autoAllowSkills"],d.checked)}}
/>
${!t&&!v?l`e.onRemove([...s,"autoAllowSkills"])}
>
Use default
`:p}
`}function wv(e){const t=["agents",e.selectedScope,"allowlist"],n=e.allowlist;return l`
Allowlist
Case-insensitive glob patterns.
{const i=[...n,{pattern:""}];e.onPatch(t,i)}}
>
Add pattern
${n.length===0?l`
No allowlist entries yet.
`:n.map((i,s)=>$v(e,i,s))}
`}function $v(e,t,n){const i=t.lastUsedAt?O(t.lastUsedAt):"never",s=t.lastUsedCommand?_i(t.lastUsedCommand,120):null,a=t.lastResolvedPath?_i(t.lastResolvedPath,120):null;return l`
${t.pattern?.trim()?t.pattern:"New pattern"}
Last used: ${i}
${s?l`
${s}
`:p}
${a?l`
${a}
`:p}
Pattern
{const r=o.target;e.onPatch(["agents",e.selectedScope,"allowlist",n,"pattern"],r.value)}}
/>
{if(e.allowlist.length<=1){e.onRemove(["agents",e.selectedScope,"allowlist"]);return}e.onRemove(["agents",e.selectedScope,"allowlist",n])}}
>
Remove
`}function kv(e,t){const n=e.binding??"__default__",i=e.name?.trim()?`${e.name} (${e.id})`:e.id,s=t.nodes.length>0;return l`
${i}
${e.isDefault?"default agent":"agent"} ·
${n==="__default__"?`uses default (${t.defaultBinding??"any"})`:`override: ${e.binding}`}
Binding
{const r=a.target.value.trim();t.onBindAgent(e.index,r==="__default__"?null:r)}}
>
Use default
${t.nodes.map(a=>l`
${a.label}
`)}
`}function Av(e){const t=[];for(const n of e){if(!(Array.isArray(n.commands)?n.commands:[]).some(r=>String(r)==="system.run"))continue;const a=typeof n.nodeId=="string"?n.nodeId.trim():"";if(!a)continue;const o=typeof n.displayName=="string"&&n.displayName.trim()?n.displayName.trim():a;t.push({id:a,label:o===a?a:`${o} · ${a}`})}return t.sort((n,i)=>n.label.localeCompare(i.label)),t}function xv(e){const t=[];for(const n of e){if(!(Array.isArray(n.commands)?n.commands:[]).some(r=>String(r)==="system.execApprovals.get"||String(r)==="system.execApprovals.set"))continue;const a=typeof n.nodeId=="string"?n.nodeId.trim():"";if(!a)continue;const o=typeof n.displayName=="string"&&n.displayName.trim()?n.displayName.trim():a;t.push({id:a,label:o===a?a:`${o} · ${a}`})}return t.sort((n,i)=>n.label.localeCompare(i.label)),t}function Sv(e){const t={id:"main",name:void 0,index:0,isDefault:!0,binding:null};if(!e||typeof e!="object")return{defaultBinding:null,agents:[t]};const i=(e.tools??{}).exec??{},s=typeof i.node=="string"&&i.node.trim()?i.node.trim():null,a=e.agents??{},o=Array.isArray(a.list)?a.list:[];if(o.length===0)return{defaultBinding:s,agents:[t]};const r=[];return o.forEach((c,u)=>{if(!c||typeof c!="object")return;const f=c,g=typeof f.id=="string"?f.id.trim():"";if(!g)return;const m=typeof f.name=="string"?f.name.trim():void 0,v=f.default===!0,d=(f.tools??{}).exec??{},y=typeof d.node=="string"&&d.node.trim()?d.node.trim():null;r.push({id:g,name:m||void 0,index:u,isDefault:v,binding:y})}),r.length===0&&r.push(t),{defaultBinding:s,agents:r}}function _v(e){const t=!!e.connected,n=!!e.paired,i=typeof e.displayName=="string"&&e.displayName.trim()||(typeof e.nodeId=="string"?e.nodeId:"unknown"),s=Array.isArray(e.caps)?e.caps:[],a=Array.isArray(e.commands)?e.commands:[];return l`
${i}
${typeof e.nodeId=="string"?e.nodeId:""}
${typeof e.remoteIp=="string"?` · ${e.remoteIp}`:""}
${typeof e.version=="string"?` · ${e.version}`:""}
${n?"paired":"unpaired"}
${t?"connected":"offline"}
${s.slice(0,12).map(o=>l`${String(o)} `)}
${a.slice(0,8).map(o=>l`${String(o)} `)}
`}function Cv(e){const t=e.hello?.snapshot,n=t?.uptimeMs?Go(t.uptimeMs):"n/a",i=t?.policy?.tickIntervalMs?`${t.policy.tickIntervalMs}ms`:"n/a",s=(()=>{if(e.connected||!e.lastError)return null;const o=e.lastError.toLowerCase();if(!(o.includes("unauthorized")||o.includes("connect failed")))return null;const c=!!e.settings.token.trim(),u=!!e.password.trim();return!c&&!u?l`
This gateway requires auth. Add a token or password, then click Connect.
openclaw dashboard --no-open → tokenized URL
openclaw doctor --generate-gateway-token → set token
`:l`
Auth failed. Re-copy a tokenized URL with
openclaw dashboard --no-open , or update the token, then click Connect.
`})(),a=(()=>{if(e.connected||!e.lastError||(typeof window<"u"?window.isSecureContext:!0))return null;const r=e.lastError.toLowerCase();return!r.includes("secure context")&&!r.includes("device identity required")?null:l`
This page is HTTP, so the browser blocks device identity. Use HTTPS (Tailscale Serve) or open
http://127.0.0.1:18789 on the gateway host.
If you must stay on HTTP, set
gateway.controlUi.allowInsecureAuth: true (token-only).
`})();return l`
Snapshot
Latest gateway handshake information.
Status
${e.connected?"Connected":"Disconnected"}
Last Channels Refresh
${e.lastChannelsRefresh?O(e.lastChannelsRefresh):"n/a"}
${e.lastError?l`
${e.lastError}
${s??""}
${a??""}
`:l`
Use Channels to link WhatsApp, Telegram, Discord, Signal, or iMessage.
`}
Instances
${e.presenceCount}
Presence beacons in the last 5 minutes.
Sessions
${e.sessionsCount??"n/a"}
Recent session keys tracked by the gateway.
Cron
${e.cronEnabled==null?"n/a":e.cronEnabled?"Enabled":"Disabled"}
Next wake ${xs(e.cronNext)}
Notes
Quick reminders for remote control setups.
Tailscale serve
Prefer serve mode to keep the gateway on loopback with tailnet auth.
Session hygiene
Use /new or sessions.patch to reset context.
Cron reminders
Use isolated sessions for recurring runs.
`}const Ev=["","off","minimal","low","medium","high"],Tv=["","off","on"],Lv=[{value:"",label:"inherit"},{value:"off",label:"off (explicit)"},{value:"on",label:"on"}],Iv=["","off","on","stream"];function Rv(e){if(!e)return"";const t=e.trim().toLowerCase();return t==="z.ai"||t==="z-ai"?"zai":t}function fr(e){return Rv(e)==="zai"}function Mv(e){return fr(e)?Tv:Ev}function Pv(e,t){return!t||!e||e==="off"?e:"on"}function Fv(e,t){return e?t&&e==="on"?"low":e:null}function Nv(e){const t=e.result?.sessions??[];return l`
Sessions
Active session keys and per-session overrides.
${e.loading?"Loading…":"Refresh"}
Active within (minutes)
e.onFiltersChange({activeMinutes:n.target.value,limit:e.limit,includeGlobal:e.includeGlobal,includeUnknown:e.includeUnknown})}
/>
Limit
e.onFiltersChange({activeMinutes:e.activeMinutes,limit:n.target.value,includeGlobal:e.includeGlobal,includeUnknown:e.includeUnknown})}
/>
Include global
e.onFiltersChange({activeMinutes:e.activeMinutes,limit:e.limit,includeGlobal:n.target.checked,includeUnknown:e.includeUnknown})}
/>
Include unknown
e.onFiltersChange({activeMinutes:e.activeMinutes,limit:e.limit,includeGlobal:e.includeGlobal,includeUnknown:n.target.checked})}
/>
${e.error?l`${e.error}
`:p}
${e.result?`Store: ${e.result.path}`:""}
Key
Label
Kind
Updated
Tokens
Thinking
Verbose
Reasoning
Actions
${t.length===0?l`
No sessions found.
`:t.map(n=>Dv(n,e.basePath,e.onPatch,e.onDelete,e.loading))}
`}function Dv(e,t,n,i,s){const a=e.updatedAt?O(e.updatedAt):"n/a",o=e.thinkingLevel??"",r=fr(e.modelProvider),c=Pv(o,r),u=Mv(e.modelProvider),f=e.verboseLevel??"",g=e.reasoningLevel??"",m=e.displayName??e.key,v=e.kind!=="global",b=v?`${ms("chat",t)}?session=${encodeURIComponent(e.key)}`:null;return l`
{const y=d.target.value.trim();n(e.key,{label:y||null})}}
/>
${e.kind}
${a}
${pf(e)}
{const y=d.target.value;n(e.key,{thinkingLevel:Fv(y,r)})}}
>
${u.map(d=>l`${d||"inherit"} `)}
{const y=d.target.value;n(e.key,{verboseLevel:y||null})}}
>
${Lv.map(d=>l`${d.label} `)}
{const y=d.target.value;n(e.key,{reasoningLevel:y||null})}}
>
${Iv.map(d=>l`${d||"inherit"} `)}
i(e.key)}>
Delete
`}const cn=[{id:"workspace",label:"Workspace Skills",sources:["openclaw-workspace"]},{id:"built-in",label:"Built-in Skills",sources:["openclaw-bundled"]},{id:"installed",label:"Installed Skills",sources:["openclaw-managed"]},{id:"extra",label:"Extra Skills",sources:["openclaw-extra"]}];function Ov(e){const t=new Map;for(const a of cn)t.set(a.id,{id:a.id,label:a.label,skills:[]});const n=cn.find(a=>a.id==="built-in"),i={id:"other",label:"Other Skills",skills:[]};for(const a of e){const o=a.bundled?n:cn.find(r=>r.sources.includes(a.source));o?t.get(o.id)?.skills.push(a):i.skills.push(a)}const s=cn.map(a=>t.get(a.id)).filter(a=>!!(a&&a.skills.length>0));return i.skills.length>0&&s.push(i),s}function Bv(e){const t=e.report?.skills??[],n=e.filter.trim().toLowerCase(),i=n?t.filter(a=>[a.name,a.description,a.source].join(" ").toLowerCase().includes(n)):t,s=Ov(i);return l`
Skills
Bundled, managed, and workspace skills.
${e.loading?"Loading…":"Refresh"}
${e.error?l`${e.error}
`:p}
${i.length===0?l`
No skills found.
`:l`
${s.map(a=>{const o=a.id==="workspace"||a.id==="built-in";return l`
${a.skills.map(r=>Uv(r,e))}
`})}
`}
`}function Uv(e,t){const n=t.busyKey===e.skillKey,i=t.edits[e.skillKey]??"",s=t.messages[e.skillKey]??null,a=e.install.length>0&&e.missing.bins.length>0,o=!!(e.bundled&&e.source!=="openclaw-bundled"),r=[...e.missing.bins.map(u=>`bin:${u}`),...e.missing.env.map(u=>`env:${u}`),...e.missing.config.map(u=>`config:${u}`),...e.missing.os.map(u=>`os:${u}`)],c=[];return e.disabled&&c.push("disabled"),e.blockedByAllowlist&&c.push("blocked by allowlist"),l`
${e.emoji?`${e.emoji} `:""}${e.name}
${_i(e.description,140)}
${e.source}
${o?l`
bundled
`:p}
${e.eligible?"eligible":"blocked"}
${e.disabled?l`
disabled
`:p}
${r.length>0?l`
Missing: ${r.join(", ")}
`:p}
${c.length>0?l`
Reason: ${c.join(", ")}
`:p}
`}const Kv=/^data:/i,zv=/^https?:\/\//i;function Hv(e){const t=e.agentsList?.agents??[],i=Ko(e.sessionKey)?.agentId??e.agentsList?.defaultId??"main",a=t.find(r=>r.id===i)?.identity,o=a?.avatarUrl??a?.avatar;if(o)return Kv.test(o)||zv.test(o)?o:a?.avatarUrl}function jv(e){const t=e.presenceEntries.length,n=e.sessionsResult?.count??null,i=e.cronStatus?.nextWakeAtMs??null,s=e.connected?null:"Disconnected from gateway.",a=e.tab==="chat",o=a&&(e.settings.chatFocusMode||e.onboarding),r=e.onboarding?!1:e.settings.chatShowThinking,c=Hv(e),u=e.chatAvatarUrl??c??null,f=Ht(e.basePath),g=f?`${f}/favicon.svg`:"/favicon.svg",m=e.configForm??e.configSnapshot?.config,v=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id??null,b=d=>{const A=(e.configForm??e.configSnapshot?.config)?.agents?.list,S=Array.isArray(A)?A:[];let T=S.findIndex(x=>x&&typeof x=="object"&&"id"in x&&x.id===d);if(T<0){const x=[...S,{id:d}];G(e,["agents","list"],x),T=x.length-1}return T};return l`
${e.tab==="overview"?Cv({connected:e.connected,hello:e.hello,settings:e.settings,password:e.password,lastError:e.lastError,presenceCount:t,sessionsCount:n,cronEnabled:e.cronStatus?.enabled??null,cronNext:i,lastChannelsRefresh:e.channelsLastSuccess,onSettingsChange:d=>e.applySettings(d),onPasswordChange:d=>e.password=d,onSessionKeyChange:d=>{e.sessionKey=d,e.chatMessage="",e.resetToolStream(),e.applySettings({...e.settings,sessionKey:d,lastActiveSessionKey:d}),e.loadAssistantIdentity()},onConnect:()=>e.connect(),onRefresh:()=>e.loadOverview()}):p}
${e.tab==="channels"?bg({connected:e.connected,loading:e.channelsLoading,snapshot:e.channelsSnapshot,lastError:e.channelsError,lastSuccessAt:e.channelsLastSuccess,whatsappMessage:e.whatsappLoginMessage,whatsappQrDataUrl:e.whatsappLoginQrDataUrl,whatsappConnected:e.whatsappLoginConnected,whatsappBusy:e.whatsappBusy,configSchema:e.configSchema,configSchemaLoading:e.configSchemaLoading,configForm:e.configForm,configUiHints:e.configUiHints,configSaving:e.configSaving,configFormDirty:e.configFormDirty,nostrProfileFormState:e.nostrProfileFormState,nostrProfileAccountId:e.nostrProfileAccountId,onRefresh:d=>se(e,d),onWhatsAppStart:d=>e.handleWhatsAppStart(d),onWhatsAppWait:()=>e.handleWhatsAppWait(),onWhatsAppLogout:()=>e.handleWhatsAppLogout(),onConfigPatch:(d,y)=>G(e,d,y),onConfigSave:()=>e.handleChannelConfigSave(),onConfigReload:()=>e.handleChannelConfigReload(),onNostrProfileEdit:(d,y)=>e.handleNostrProfileEdit(d,y),onNostrProfileCancel:()=>e.handleNostrProfileCancel(),onNostrProfileFieldChange:(d,y)=>e.handleNostrProfileFieldChange(d,y),onNostrProfileSave:()=>e.handleNostrProfileSave(),onNostrProfileImport:()=>e.handleNostrProfileImport(),onNostrProfileToggleAdvanced:()=>e.handleNostrProfileToggleAdvanced()}):p}
${e.tab==="instances"?Jh({loading:e.presenceLoading,entries:e.presenceEntries,lastError:e.presenceError,statusMessage:e.presenceStatus,onRefresh:()=>vs(e)}):p}
${e.tab==="sessions"?Nv({loading:e.sessionsLoading,result:e.sessionsResult,error:e.sessionsError,activeMinutes:e.sessionsFilterActive,limit:e.sessionsFilterLimit,includeGlobal:e.sessionsIncludeGlobal,includeUnknown:e.sessionsIncludeUnknown,basePath:e.basePath,onFiltersChange:d=>{e.sessionsFilterActive=d.activeMinutes,e.sessionsFilterLimit=d.limit,e.sessionsIncludeGlobal=d.includeGlobal,e.sessionsIncludeUnknown=d.includeUnknown},onRefresh:()=>Je(e),onPatch:(d,y)=>wd(e,d,y),onDelete:d=>$d(e,d)}):p}
${e.tab==="cron"?Hh({loading:e.cronLoading,status:e.cronStatus,jobs:e.cronJobs,error:e.cronError,busy:e.cronBusy,form:e.cronForm,channels:e.channelsSnapshot?.channelMeta?.length?e.channelsSnapshot.channelMeta.map(d=>d.id):e.channelsSnapshot?.channelOrder??[],channelLabels:e.channelsSnapshot?.channelLabels??{},channelMeta:e.channelsSnapshot?.channelMeta??[],runsJobId:e.cronRunsJobId,runs:e.cronRuns,onFormChange:d=>e.cronForm={...e.cronForm,...d},onRefresh:()=>e.loadCron(),onAdd:()=>Mc(e),onToggle:(d,y)=>Pc(e,d,y),onRun:d=>Fc(e,d),onRemove:d=>Nc(e,d),onLoadRuns:d=>qo(e,d)}):p}
${e.tab==="agents"?xf({loading:e.agentsLoading,error:e.agentsError,agentsList:e.agentsList,selectedAgentId:v,activePanel:e.agentsPanel,configForm:m,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configFormDirty,channelsLoading:e.channelsLoading,channelsError:e.channelsError,channelsSnapshot:e.channelsSnapshot,channelsLastSuccess:e.channelsLastSuccess,cronLoading:e.cronLoading,cronStatus:e.cronStatus,cronJobs:e.cronJobs,cronError:e.cronError,agentFilesLoading:e.agentFilesLoading,agentFilesError:e.agentFilesError,agentFilesList:e.agentFilesList,agentFileActive:e.agentFileActive,agentFileContents:e.agentFileContents,agentFileDrafts:e.agentFileDrafts,agentFileSaving:e.agentFileSaving,agentIdentityLoading:e.agentIdentityLoading,agentIdentityError:e.agentIdentityError,agentIdentityById:e.agentIdentityById,agentSkillsLoading:e.agentSkillsLoading,agentSkillsReport:e.agentSkillsReport,agentSkillsError:e.agentSkillsError,agentSkillsAgentId:e.agentSkillsAgentId,skillsFilter:e.skillsFilter,onRefresh:async()=>{await rs(e);const d=e.agentsList?.agents?.map(y=>y.id)??[];d.length>0&&jo(e,d)},onSelectAgent:d=>{e.agentsSelectedId!==d&&(e.agentsSelectedId=d,e.agentFilesList=null,e.agentFilesError=null,e.agentFilesLoading=!1,e.agentFileActive=null,e.agentFileContents={},e.agentFileDrafts={},e.agentSkillsReport=null,e.agentSkillsError=null,e.agentSkillsAgentId=null,Ho(e,d),e.agentsPanel==="files"&&gi(e,d),e.agentsPanel==="skills"&&fn(e,d))},onSelectPanel:d=>{e.agentsPanel=d,d==="files"&&v&&e.agentFilesList?.agentId!==v&&(e.agentFilesList=null,e.agentFilesError=null,e.agentFileActive=null,e.agentFileContents={},e.agentFileDrafts={},gi(e,v)),d==="skills"&&v&&fn(e,v),d==="channels"&&se(e,!1),d==="cron"&&e.loadCron()},onLoadFiles:d=>{(async()=>(await gi(e,d),e.agentFileActive&&await Ba(e,d,e.agentFileActive,{force:!0,preserveDraft:!0})))()},onSelectFile:d=>{e.agentFileActive=d,v&&Ba(e,v,d)},onFileDraftChange:(d,y)=>{e.agentFileDrafts={...e.agentFileDrafts,[d]:y}},onFileReset:d=>{const y=e.agentFileContents[d]??"";e.agentFileDrafts={...e.agentFileDrafts,[d]:y}},onFileSave:d=>{if(!v)return;const y=e.agentFileDrafts[d]??e.agentFileContents[d]??"";af(e,v,d,y)},onToolsProfileChange:(d,y,A)=>{if(!m)return;const S=m.agents?.list;if(!Array.isArray(S))return;const T=S.findIndex(C=>C&&typeof C=="object"&&"id"in C&&C.id===d);if(T<0)return;const x=["agents","list",T,"tools"];y?G(e,[...x,"profile"],y):de(e,[...x,"profile"]),A&&de(e,[...x,"allow"])},onToolsOverridesChange:(d,y,A)=>{if(!m)return;const S=m.agents?.list;if(!Array.isArray(S))return;const T=S.findIndex(C=>C&&typeof C=="object"&&"id"in C&&C.id===d);if(T<0)return;const x=["agents","list",T,"tools"];y.length>0?G(e,[...x,"alsoAllow"],y):de(e,[...x,"alsoAllow"]),A.length>0?G(e,[...x,"deny"],A):de(e,[...x,"deny"])},onConfigReload:()=>pe(e),onConfigSave:()=>un(e),onChannelsRefresh:()=>se(e,!1),onCronRefresh:()=>e.loadCron(),onSkillsFilterChange:d=>e.skillsFilter=d,onSkillsRefresh:()=>{v&&fn(e,v)},onAgentSkillToggle:(d,y,A)=>{if(!m)return;const S=m.agents?.list;if(!Array.isArray(S))return;const T=S.findIndex(Q=>Q&&typeof Q=="object"&&"id"in Q&&Q.id===d);if(T<0)return;const x=S[T],C=y.trim();if(!C)return;const E=e.agentSkillsReport?.skills?.map(Q=>Q.name).filter(Boolean)??[],ce=(Array.isArray(x.skills)?x.skills.map(Q=>String(Q).trim()).filter(Boolean):void 0)??E,H=new Set(ce);A?H.add(C):H.delete(C),G(e,["agents","list",T,"skills"],[...H])},onAgentSkillsClear:d=>{if(!m)return;const y=m.agents?.list;if(!Array.isArray(y))return;const A=y.findIndex(S=>S&&typeof S=="object"&&"id"in S&&S.id===d);A<0||de(e,["agents","list",A,"skills"])},onAgentSkillsDisableAll:d=>{if(!m)return;const y=m.agents?.list;if(!Array.isArray(y))return;const A=y.findIndex(S=>S&&typeof S=="object"&&"id"in S&&S.id===d);A<0||G(e,["agents","list",A,"skills"],[])},onModelChange:(d,y)=>{if(!m)return;const A=e.agentsList?.defaultId??null;if(A&&d===A){const P=["agents","defaults","model"],H=(m.agents?.defaults??{}).model;if(!y){de(e,P);return}if(H&&typeof H=="object"&&!Array.isArray(H)){const Q=H.fallbacks,D={primary:y,...Array.isArray(Q)?{fallbacks:Q}:{}};G(e,P,D)}else G(e,P,{primary:y});return}const S=b(d),T=["agents","list",S,"model"];if(!y){de(e,T);return}const x=(e.configForm??e.configSnapshot?.config)?.agents?.list,E=(Array.isArray(x)&&x[S]?x[S]:null)?.model;if(E&&typeof E=="object"&&!Array.isArray(E)){const P=E.fallbacks,ce={primary:y,...Array.isArray(P)?{fallbacks:P}:{}};G(e,T,ce)}else G(e,T,y)},onModelFallbacksChange:(d,y)=>{if(!m)return;const A=y.map(D=>D.trim()).filter(Boolean),S=e.agentsList?.defaultId??null;if(S&&d===S){const D=["agents","defaults","model"],ae=(m.agents?.defaults??{}).model,he=(()=>{if(typeof ae=="string")return ae.trim()||null;if(ae&&typeof ae=="object"&&!Array.isArray(ae)){const Gt=ae.primary;if(typeof Gt=="string")return Gt.trim()||null}return null})();if(A.length===0){he?G(e,D,{primary:he}):de(e,D);return}G(e,D,he?{primary:he,fallbacks:A}:{fallbacks:A});return}const T=b(d),x=["agents","list",T,"model"],C=(e.configForm??e.configSnapshot?.config)?.agents?.list,P=(Array.isArray(C)&&C[T]?C[T]:null)?.model;if(!P)return;const H=(()=>{if(typeof P=="string")return P.trim()||null;if(P&&typeof P=="object"&&!Array.isArray(P)){const D=P.primary;if(typeof D=="string")return D.trim()||null}return null})();if(A.length===0){H?G(e,x,H):de(e,x);return}G(e,x,H?{primary:H,fallbacks:A}:{fallbacks:A})}}):p}
${e.tab==="skills"?Bv({loading:e.skillsLoading,report:e.skillsReport,error:e.skillsError,filter:e.skillsFilter,edits:e.skillEdits,messages:e.skillMessages,busyKey:e.skillsBusyKey,onFilterChange:d=>e.skillsFilter=d,onRefresh:()=>zt(e,{clearMessages:!0}),onToggle:(d,y)=>Ad(e,d,y),onEdit:(d,y)=>kd(e,d,y),onSaveKey:d=>xd(e,d),onInstall:(d,y,A)=>Sd(e,d,y,A)}):p}
${e.tab==="nodes"?nv({loading:e.nodesLoading,nodes:e.nodes,devicesLoading:e.devicesLoading,devicesError:e.devicesError,devicesList:e.devicesList,configForm:e.configForm??e.configSnapshot?.config,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configFormDirty,configFormMode:e.configFormMode,execApprovalsLoading:e.execApprovalsLoading,execApprovalsSaving:e.execApprovalsSaving,execApprovalsDirty:e.execApprovalsDirty,execApprovalsSnapshot:e.execApprovalsSnapshot,execApprovalsForm:e.execApprovalsForm,execApprovalsSelectedAgent:e.execApprovalsSelectedAgent,execApprovalsTarget:e.execApprovalsTarget,execApprovalsTargetNodeId:e.execApprovalsTargetNodeId,onRefresh:()=>Ln(e),onDevicesRefresh:()=>Ne(e),onDeviceApprove:d=>dd(e,d),onDeviceReject:d=>ud(e,d),onDeviceRotate:(d,y,A)=>fd(e,{deviceId:d,role:y,scopes:A}),onDeviceRevoke:(d,y)=>gd(e,{deviceId:d,role:y}),onLoadConfig:()=>pe(e),onLoadExecApprovals:()=>{const d=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return hs(e,d)},onBindDefault:d=>{d?G(e,["tools","exec","node"],d):de(e,["tools","exec","node"])},onBindAgent:(d,y)=>{const A=["agents","list",d,"tools","exec","node"];y?G(e,A,y):de(e,A)},onSaveBindings:()=>un(e),onExecApprovalsTargetChange:(d,y)=>{e.execApprovalsTarget=d,e.execApprovalsTargetNodeId=y,e.execApprovalsSnapshot=null,e.execApprovalsForm=null,e.execApprovalsDirty=!1,e.execApprovalsSelectedAgent=null},onExecApprovalsSelectAgent:d=>{e.execApprovalsSelectedAgent=d},onExecApprovalsPatch:(d,y)=>yd(e,d,y),onExecApprovalsRemove:d=>bd(e,d),onSaveExecApprovals:()=>{const d=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return md(e,d)}}):p}
${e.tab==="chat"?Ph({sessionKey:e.sessionKey,onSessionKeyChange:d=>{e.sessionKey=d,e.chatMessage="",e.chatAttachments=[],e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.chatQueue=[],e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:d,lastActiveSessionKey:d}),e.loadAssistantIdentity(),Ot(e),Pi(e)},thinkingLevel:e.chatThinkingLevel,showThinking:r,loading:e.chatLoading,sending:e.chatSending,assistantAvatarUrl:u,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:null,draft:e.chatMessage,queue:e.chatQueue,connected:e.connected,canSend:e.connected,disabledReason:s,error:e.lastError,sessions:e.sessionsResult,focusMode:o,onRefresh:()=>Promise.all([Ot(e),Pi(e)]),onToggleFocusMode:()=>{e.onboarding||e.applySettings({...e.settings,chatFocusMode:!e.settings.chatFocusMode})},onChatScroll:d=>e.handleChatScroll(d),onDraftChange:d=>e.chatMessage=d,attachments:e.chatAttachments,onAttachmentsChange:d=>e.chatAttachments=d,onSend:()=>e.handleSendChat(),canAbort:!!e.chatRunId,onAbort:()=>{e.handleAbortChat()},onQueueRemove:d=>e.removeQueuedMessage(d),onNewSession:()=>e.handleSendChat("/new",{restoreDraft:!0}),showNewMessages:e.chatNewMessagesBelow,onScrollToBottom:()=>e.scrollToBottom(),sidebarOpen:e.sidebarOpen,sidebarContent:e.sidebarContent,sidebarError:e.sidebarError,splitRatio:e.splitRatio,onOpenSidebar:d=>e.handleOpenSidebar(d),onCloseSidebar:()=>e.handleCloseSidebar(),onSplitRatioChange:d=>e.handleSplitRatioChange(d),assistantName:e.assistantName,assistantAvatar:e.assistantAvatar}):p}
${e.tab==="config"?Uh({raw:e.configRaw,originalRaw:e.configRawOriginal,valid:e.configValid,issues:e.configIssues,loading:e.configLoading,saving:e.configSaving,applying:e.configApplying,updating:e.updateRunning,connected:e.connected,schema:e.configSchema,schemaLoading:e.configSchemaLoading,uiHints:e.configUiHints,formMode:e.configFormMode,formValue:e.configForm,originalValue:e.configFormOriginal,searchQuery:e.configSearchQuery,activeSection:e.configActiveSection,activeSubsection:e.configActiveSubsection,onRawChange:d=>{e.configRaw=d},onFormModeChange:d=>e.configFormMode=d,onFormPatch:(d,y)=>G(e,d,y),onSearchChange:d=>e.configSearchQuery=d,onSectionChange:d=>{e.configActiveSection=d,e.configActiveSubsection=null},onSubsectionChange:d=>e.configActiveSubsection=d,onReload:()=>pe(e),onSave:()=>un(e),onApply:()=>Xr(e),onUpdate:()=>ec(e)}):p}
${e.tab==="debug"?qh({loading:e.debugLoading,status:e.debugStatus,health:e.debugHealth,models:e.debugModels,heartbeat:e.debugHeartbeat,eventLog:e.eventLog,callMethod:e.debugCallMethod,callParams:e.debugCallParams,callResult:e.debugCallResult,callError:e.debugCallError,onCallMethodChange:d=>e.debugCallMethod=d,onCallParamsChange:d=>e.debugCallParams=d,onRefresh:()=>Tn(e),onCall:()=>wc(e)}):p}
${e.tab==="logs"?tv({loading:e.logsLoading,error:e.logsError,file:e.logsFile,entries:e.logsEntries,filterText:e.logsFilterText,levelFilters:e.logsLevelFilters,autoFollow:e.logsAutoFollow,truncated:e.logsTruncated,onFilterTextChange:d=>e.logsFilterText=d,onLevelToggle:(d,y)=>{e.logsLevelFilters={...e.logsLevelFilters,[d]:y}},onToggleAutoFollow:d=>e.logsAutoFollow=d,onRefresh:()=>is(e,{reset:!0}),onExport:(d,y)=>e.exportLogs(d,y),onScroll:d=>e.handleLogsScroll(d)}):p}
${Yh(e)}
${Qh(e)}
`}var Gv=Object.defineProperty,Wv=Object.getOwnPropertyDescriptor,$=(e,t,n,i)=>{for(var s=i>1?void 0:i?Wv(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(s=(i?o(t,n,s):o(s))||s);return i&&s&&Gv(t,n,s),s};const ki=Tu();function qv(){if(!window.location.search)return!1;const t=new URLSearchParams(window.location.search).get("onboarding");if(!t)return!1;const n=t.trim().toLowerCase();return n==="1"||n==="true"||n==="yes"||n==="on"}let w=class extends rt{constructor(){super(...arguments),this.settings=Ld(),this.password="",this.tab="chat",this.onboarding=qv(),this.connected=!1,this.theme=this.settings.theme??"system",this.themeResolved="dark",this.hello=null,this.lastError=null,this.eventLog=[],this.eventLogBuffer=[],this.toolStreamSyncTimer=null,this.sidebarCloseTimer=null,this.assistantName=ki.name,this.assistantAvatar=ki.avatar,this.assistantAgentId=ki.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatToolMessages=[],this.chatStream=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.compactionStatus=null,this.chatAvatarUrl=null,this.chatThinkingLevel=null,this.chatQueue=[],this.chatAttachments=[],this.sidebarOpen=!1,this.sidebarContent=null,this.sidebarError=null,this.splitRatio=this.settings.splitRatio,this.nodesLoading=!1,this.nodes=[],this.devicesLoading=!1,this.devicesError=null,this.devicesList=null,this.execApprovalsLoading=!1,this.execApprovalsSaving=!1,this.execApprovalsDirty=!1,this.execApprovalsSnapshot=null,this.execApprovalsForm=null,this.execApprovalsSelectedAgent=null,this.execApprovalsTarget="gateway",this.execApprovalsTargetNodeId=null,this.execApprovalQueue=[],this.execApprovalBusy=!1,this.execApprovalError=null,this.pendingGatewayUrl=null,this.configLoading=!1,this.configRaw=`{
}
`,this.configRawOriginal="",this.configValid=null,this.configIssues=[],this.configSaving=!1,this.configApplying=!1,this.updateRunning=!1,this.applySessionKey=this.settings.lastActiveSessionKey,this.configSnapshot=null,this.configSchema=null,this.configSchemaVersion=null,this.configSchemaLoading=!1,this.configUiHints={},this.configForm=null,this.configFormOriginal=null,this.configFormDirty=!1,this.configFormMode="form",this.configSearchQuery="",this.configActiveSection=null,this.configActiveSubsection=null,this.channelsLoading=!1,this.channelsSnapshot=null,this.channelsError=null,this.channelsLastSuccess=null,this.whatsappLoginMessage=null,this.whatsappLoginQrDataUrl=null,this.whatsappLoginConnected=null,this.whatsappBusy=!1,this.nostrProfileFormState=null,this.nostrProfileAccountId=null,this.presenceLoading=!1,this.presenceEntries=[],this.presenceError=null,this.presenceStatus=null,this.agentsLoading=!1,this.agentsList=null,this.agentsError=null,this.agentsSelectedId=null,this.agentsPanel="overview",this.agentFilesLoading=!1,this.agentFilesError=null,this.agentFilesList=null,this.agentFileContents={},this.agentFileDrafts={},this.agentFileActive=null,this.agentFileSaving=!1,this.agentIdentityLoading=!1,this.agentIdentityError=null,this.agentIdentityById={},this.agentSkillsLoading=!1,this.agentSkillsError=null,this.agentSkillsReport=null,this.agentSkillsAgentId=null,this.sessionsLoading=!1,this.sessionsResult=null,this.sessionsError=null,this.sessionsFilterActive="",this.sessionsFilterLimit="120",this.sessionsIncludeGlobal=!0,this.sessionsIncludeUnknown=!1,this.cronLoading=!1,this.cronJobs=[],this.cronStatus=null,this.cronError=null,this.cronForm={...Su},this.cronRunsJobId=null,this.cronRuns=[],this.cronBusy=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.debugLoading=!1,this.debugStatus=null,this.debugHealth=null,this.debugModels=[],this.debugHeartbeat=null,this.debugCallMethod="",this.debugCallParams="{}",this.debugCallResult=null,this.debugCallError=null,this.logsLoading=!1,this.logsError=null,this.logsFile=null,this.logsEntries=[],this.logsFilterText="",this.logsLevelFilters={...xu},this.logsAutoFollow=!0,this.logsTruncated=!1,this.logsCursor=null,this.logsLastFetchAt=null,this.logsLimit=500,this.logsMaxBytes=25e4,this.logsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.chatNewMessagesBelow=!1,this.nodesPollInterval=null,this.logsPollInterval=null,this.debugPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.refreshSessionsAfterChat=new Set,this.basePath="",this.popStateHandler=()=>Gd(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Uu(this)}firstUpdated(){Ku(this)}disconnectedCallback(){zu(this),super.disconnectedCallback()}updated(e){Hu(this,e)}connect(){Ll(this)}handleChatScroll(e){vc(this,e)}handleLogsScroll(e){mc(this,e)}exportLogs(e,t){yc(e,t)}resetToolStream(){Fn(this)}resetChatScroll(){ya(this)}scrollToBottom(){ya(this),Ut(this,!0)}async loadAssistantIdentity(){await Cl(this)}applySettings(e){Pe(this,e)}setTab(e){Od(this,e)}setTheme(e,t){Bd(this,e,t)}async loadOverview(){await bl(this)}async loadCron(){await wn(this)}async handleAbortChat(){await Al(this)}removeQueuedMessage(e){bu(this,e)}async handleSendChat(e,t){await wu(this,e,t)}async handleWhatsAppStart(e){await sc(this,e)}async handleWhatsAppWait(){await ac(this)}async handleWhatsAppLogout(){await oc(this)}async handleChannelConfigSave(){await lc(this)}async handleChannelConfigReload(){await rc(this)}handleNostrProfileEdit(e,t){dc(this,e,t)}handleNostrProfileCancel(){uc(this)}handleNostrProfileFieldChange(e,t){fc(this,e,t)}async handleNostrProfileSave(){await pc(this)}async handleNostrProfileImport(){await hc(this)}handleNostrProfileToggleAdvanced(){gc(this)}async handleExecApprovalDecision(e){const t=this.execApprovalQueue[0];if(!(!t||!this.client||this.execApprovalBusy)){this.execApprovalBusy=!0,this.execApprovalError=null;try{await this.client.request("exec.approval.resolve",{id:t.id,decision:e}),this.execApprovalQueue=this.execApprovalQueue.filter(n=>n.id!==t.id)}catch(n){this.execApprovalError=`Exec approval failed: ${String(n)}`}finally{this.execApprovalBusy=!1}}}handleGatewayUrlConfirm(){const e=this.pendingGatewayUrl;e&&(this.pendingGatewayUrl=null,Pe(this,{...this.settings,gatewayUrl:e}),this.connect())}handleGatewayUrlCancel(){this.pendingGatewayUrl=null}handleOpenSidebar(e){this.sidebarCloseTimer!=null&&(window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=null),this.sidebarContent=e,this.sidebarError=null,this.sidebarOpen=!0}handleCloseSidebar(){this.sidebarOpen=!1,this.sidebarCloseTimer!=null&&window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=window.setTimeout(()=>{this.sidebarOpen||(this.sidebarContent=null,this.sidebarError=null,this.sidebarCloseTimer=null)},200)}handleSplitRatioChange(e){const t=Math.max(.4,Math.min(.7,e));this.splitRatio=t,this.applySettings({...this.settings,splitRatio:t})}render(){return jv(this)}};$([k()],w.prototype,"settings",2);$([k()],w.prototype,"password",2);$([k()],w.prototype,"tab",2);$([k()],w.prototype,"onboarding",2);$([k()],w.prototype,"connected",2);$([k()],w.prototype,"theme",2);$([k()],w.prototype,"themeResolved",2);$([k()],w.prototype,"hello",2);$([k()],w.prototype,"lastError",2);$([k()],w.prototype,"eventLog",2);$([k()],w.prototype,"assistantName",2);$([k()],w.prototype,"assistantAvatar",2);$([k()],w.prototype,"assistantAgentId",2);$([k()],w.prototype,"sessionKey",2);$([k()],w.prototype,"chatLoading",2);$([k()],w.prototype,"chatSending",2);$([k()],w.prototype,"chatMessage",2);$([k()],w.prototype,"chatMessages",2);$([k()],w.prototype,"chatToolMessages",2);$([k()],w.prototype,"chatStream",2);$([k()],w.prototype,"chatStreamStartedAt",2);$([k()],w.prototype,"chatRunId",2);$([k()],w.prototype,"compactionStatus",2);$([k()],w.prototype,"chatAvatarUrl",2);$([k()],w.prototype,"chatThinkingLevel",2);$([k()],w.prototype,"chatQueue",2);$([k()],w.prototype,"chatAttachments",2);$([k()],w.prototype,"sidebarOpen",2);$([k()],w.prototype,"sidebarContent",2);$([k()],w.prototype,"sidebarError",2);$([k()],w.prototype,"splitRatio",2);$([k()],w.prototype,"nodesLoading",2);$([k()],w.prototype,"nodes",2);$([k()],w.prototype,"devicesLoading",2);$([k()],w.prototype,"devicesError",2);$([k()],w.prototype,"devicesList",2);$([k()],w.prototype,"execApprovalsLoading",2);$([k()],w.prototype,"execApprovalsSaving",2);$([k()],w.prototype,"execApprovalsDirty",2);$([k()],w.prototype,"execApprovalsSnapshot",2);$([k()],w.prototype,"execApprovalsForm",2);$([k()],w.prototype,"execApprovalsSelectedAgent",2);$([k()],w.prototype,"execApprovalsTarget",2);$([k()],w.prototype,"execApprovalsTargetNodeId",2);$([k()],w.prototype,"execApprovalQueue",2);$([k()],w.prototype,"execApprovalBusy",2);$([k()],w.prototype,"execApprovalError",2);$([k()],w.prototype,"pendingGatewayUrl",2);$([k()],w.prototype,"configLoading",2);$([k()],w.prototype,"configRaw",2);$([k()],w.prototype,"configRawOriginal",2);$([k()],w.prototype,"configValid",2);$([k()],w.prototype,"configIssues",2);$([k()],w.prototype,"configSaving",2);$([k()],w.prototype,"configApplying",2);$([k()],w.prototype,"updateRunning",2);$([k()],w.prototype,"applySessionKey",2);$([k()],w.prototype,"configSnapshot",2);$([k()],w.prototype,"configSchema",2);$([k()],w.prototype,"configSchemaVersion",2);$([k()],w.prototype,"configSchemaLoading",2);$([k()],w.prototype,"configUiHints",2);$([k()],w.prototype,"configForm",2);$([k()],w.prototype,"configFormOriginal",2);$([k()],w.prototype,"configFormDirty",2);$([k()],w.prototype,"configFormMode",2);$([k()],w.prototype,"configSearchQuery",2);$([k()],w.prototype,"configActiveSection",2);$([k()],w.prototype,"configActiveSubsection",2);$([k()],w.prototype,"channelsLoading",2);$([k()],w.prototype,"channelsSnapshot",2);$([k()],w.prototype,"channelsError",2);$([k()],w.prototype,"channelsLastSuccess",2);$([k()],w.prototype,"whatsappLoginMessage",2);$([k()],w.prototype,"whatsappLoginQrDataUrl",2);$([k()],w.prototype,"whatsappLoginConnected",2);$([k()],w.prototype,"whatsappBusy",2);$([k()],w.prototype,"nostrProfileFormState",2);$([k()],w.prototype,"nostrProfileAccountId",2);$([k()],w.prototype,"presenceLoading",2);$([k()],w.prototype,"presenceEntries",2);$([k()],w.prototype,"presenceError",2);$([k()],w.prototype,"presenceStatus",2);$([k()],w.prototype,"agentsLoading",2);$([k()],w.prototype,"agentsList",2);$([k()],w.prototype,"agentsError",2);$([k()],w.prototype,"agentsSelectedId",2);$([k()],w.prototype,"agentsPanel",2);$([k()],w.prototype,"agentFilesLoading",2);$([k()],w.prototype,"agentFilesError",2);$([k()],w.prototype,"agentFilesList",2);$([k()],w.prototype,"agentFileContents",2);$([k()],w.prototype,"agentFileDrafts",2);$([k()],w.prototype,"agentFileActive",2);$([k()],w.prototype,"agentFileSaving",2);$([k()],w.prototype,"agentIdentityLoading",2);$([k()],w.prototype,"agentIdentityError",2);$([k()],w.prototype,"agentIdentityById",2);$([k()],w.prototype,"agentSkillsLoading",2);$([k()],w.prototype,"agentSkillsError",2);$([k()],w.prototype,"agentSkillsReport",2);$([k()],w.prototype,"agentSkillsAgentId",2);$([k()],w.prototype,"sessionsLoading",2);$([k()],w.prototype,"sessionsResult",2);$([k()],w.prototype,"sessionsError",2);$([k()],w.prototype,"sessionsFilterActive",2);$([k()],w.prototype,"sessionsFilterLimit",2);$([k()],w.prototype,"sessionsIncludeGlobal",2);$([k()],w.prototype,"sessionsIncludeUnknown",2);$([k()],w.prototype,"cronLoading",2);$([k()],w.prototype,"cronJobs",2);$([k()],w.prototype,"cronStatus",2);$([k()],w.prototype,"cronError",2);$([k()],w.prototype,"cronForm",2);$([k()],w.prototype,"cronRunsJobId",2);$([k()],w.prototype,"cronRuns",2);$([k()],w.prototype,"cronBusy",2);$([k()],w.prototype,"skillsLoading",2);$([k()],w.prototype,"skillsReport",2);$([k()],w.prototype,"skillsError",2);$([k()],w.prototype,"skillsFilter",2);$([k()],w.prototype,"skillEdits",2);$([k()],w.prototype,"skillsBusyKey",2);$([k()],w.prototype,"skillMessages",2);$([k()],w.prototype,"debugLoading",2);$([k()],w.prototype,"debugStatus",2);$([k()],w.prototype,"debugHealth",2);$([k()],w.prototype,"debugModels",2);$([k()],w.prototype,"debugHeartbeat",2);$([k()],w.prototype,"debugCallMethod",2);$([k()],w.prototype,"debugCallParams",2);$([k()],w.prototype,"debugCallResult",2);$([k()],w.prototype,"debugCallError",2);$([k()],w.prototype,"logsLoading",2);$([k()],w.prototype,"logsError",2);$([k()],w.prototype,"logsFile",2);$([k()],w.prototype,"logsEntries",2);$([k()],w.prototype,"logsFilterText",2);$([k()],w.prototype,"logsLevelFilters",2);$([k()],w.prototype,"logsAutoFollow",2);$([k()],w.prototype,"logsTruncated",2);$([k()],w.prototype,"logsCursor",2);$([k()],w.prototype,"logsLastFetchAt",2);$([k()],w.prototype,"logsLimit",2);$([k()],w.prototype,"logsMaxBytes",2);$([k()],w.prototype,"logsAtBottom",2);$([k()],w.prototype,"chatNewMessagesBelow",2);w=$([Fo("openclaw-app")],w);
//# sourceMappingURL=index-BJMYln02.js.map