";if(e.anyOf||e.oneOf||e.allOf){const l=Ql(e,t);return l||(n.push(i),{schema:e,unsupportedPaths:n})}const a=Array.isArray(e.type)&&e.type.includes("null"),o=gt(e)??(e.properties||e.additionalProperties?"object":void 0);if(s.type=o??e.type,s.nullable=a||e.nullable,s.enum){const{enumValues:l,nullable:r}=ta(s.enum);s.enum=l,r&&(s.nullable=!0),l.length===0&&n.push(i)}if(o==="object"){const l=e.properties??{},r={};for(const[d,c]of Object.entries(l)){const p=at(c,[...t,d]);p.schema&&(r[d]=p.schema),n.push(...p.unsupportedPaths)}if(s.properties=r,e.additionalProperties===!0)n.push(i);else if(e.additionalProperties===!1)s.additionalProperties=!1;else if(e.additionalProperties){const d=at(e.additionalProperties,[...t,"*"]);s.additionalProperties=d.schema??e.additionalProperties,d.unsupportedPaths.length>0&&n.push(i)}}else if(o==="array"){const l=Array.isArray(e.items)?e.items[0]:e.items;if(!l)n.push(i);else{const r=at(l,[...t,"*"]);s.items=r.schema??l,r.unsupportedPaths.length>0&&n.push(i)}}else o==="string"||o==="number"||o==="integer"||o==="boolean"||s.enum||n.push(i);return{schema:s,unsupportedPaths:Array.from(new Set(n))}}function Ql(e,t){if(e.allOf)return null;const n=e.anyOf??e.oneOf;if(!n)return null;const s=[],i=[];let a=!1;for(const r of n){if(!r||typeof r!="object")return null;if(Array.isArray(r.enum)){const{enumValues:d,nullable:c}=ta(r.enum);s.push(...d),c&&(a=!0);continue}if("const"in r){if(r.const===null||r.const===void 0){a=!0;continue}s.push(r.const);continue}if(gt(r)==="null"){a=!0;continue}i.push(r)}if(s.length>0&&i.length===0){const r=[];for(const d of s)r.some(c=>Object.is(c,d))||r.push(d);return{schema:{...e,enum:r,nullable:a,anyOf:void 0,oneOf:void 0,allOf:void 0},unsupportedPaths:[]}}if(i.length===1){const r=at(i[0],t);return r.schema&&(r.schema.nullable=a||r.schema.nullable),r}const o=["string","number","integer","boolean"];return i.every(r=>r.type&&o.includes(String(r.type)))&&i.length>0&&s.length===0?{schema:{...e,nullable:a},unsupportedPaths:[]}:null}function ta(e){const t=e.filter(i=>i!=null),n=t.length!==e.length,s=[];for(const i of t)s.some(a=>Object.is(a,i))||s.push(i);return{enumValues:s,nullable:n}}function Xl(e){const t=e.valid==null?"unknown":e.valid?"valid":"invalid",n=Jl(e.schema),s=n.schema?n.unsupportedPaths.length>0:!1,i=!!e.formValue&&!e.loading&&!s,a=e.connected&&!e.saving&&(e.formMode==="raw"?!0:i),o=e.connected&&!e.applying&&!e.updating&&(e.formMode==="raw"?!0:i),l=e.connected&&!e.applying&&!e.updating;return h`
e.onFormModeChange("form")}
>
Form
e.onFormModeChange("raw")}
>
Raw
${e.loading?"Loadingโฆ":"Reload"}
${e.saving?"Savingโฆ":"Save"}
${e.applying?"Applyingโฆ":"Apply & Restart"}
${e.updating?"Updatingโฆ":"Update & Restart"}
Writes to ~/.clawdbot/clawdbot.json . Apply &
Update restart the gateway and will ping the last active session when it
comes back.
${e.formMode==="form"?h`
${e.schemaLoading?h`
Loading schemaโฆ
`:Wl({schema:n.schema,uiHints:e.uiHints,value:e.formValue,disabled:e.loading||!e.formValue,unsupportedPaths:n.unsupportedPaths,onPatch:e.onFormPatch})}
${s?h`
Form view canโt safely edit some fields.
Use Raw to avoid losing config entries.
`:g}
`:h`
Raw JSON5
`}
${e.issues.length>0?h`
${JSON.stringify(e.issues,null,2)}
`:g}
`}const Zl=[{key:"reactions",label:"Reactions"},{key:"stickers",label:"Stickers"},{key:"polls",label:"Polls"},{key:"permissions",label:"Permissions"},{key:"messages",label:"Messages"},{key:"threads",label:"Threads"},{key:"pins",label:"Pins"},{key:"search",label:"Search"},{key:"memberInfo",label:"Member info"},{key:"roleInfo",label:"Role info"},{key:"channelInfo",label:"Channel info"},{key:"voiceStatus",label:"Voice status"},{key:"events",label:"Events"},{key:"roles",label:"Role changes"},{key:"moderation",label:"Moderation"}],er=[{key:"reactions",label:"Reactions"},{key:"messages",label:"Messages"},{key:"pins",label:"Pins"},{key:"memberInfo",label:"Member info"},{key:"emojiList",label:"Emoji list"}];function tr(e){const t=e.snapshot?.whatsapp,n=e.snapshot?.telegram,s=e.snapshot?.discord??null,i=e.snapshot?.slack??null,a=e.snapshot?.signal??null,o=e.snapshot?.imessage??null,r=["whatsapp","telegram","discord","slack","signal","imessage"].map((d,c)=>({key:d,enabled:sr(d,e),order:c})).sort((d,c)=>d.enabled!==c.enabled?d.enabled?-1:1:d.order-c.order);return h`
${r.map(d=>ir(d.key,e,{whatsapp:t,telegram:n,discord:s,slack:i,signal:a,imessage:o}))}
Connection health
Provider status snapshots from the gateway.
${e.lastSuccessAt?W(e.lastSuccessAt):"n/a"}
${e.lastError?h`
${e.lastError}
`:g}
${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
`}function nr(e){if(!e&&e!==0)return"n/a";const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.round(t/60);return n<60?`${n}m`:`${Math.round(n/60)}h`}function sr(e,t){const n=t.snapshot;if(!n)return!1;switch(e){case"whatsapp":return n.whatsapp.configured||n.whatsapp.linked||n.whatsapp.running;case"telegram":return n.telegram.configured||n.telegram.running;case"discord":return!!(n.discord?.configured||n.discord?.running);case"slack":return!!(n.slack?.configured||n.slack?.running);case"signal":return!!(n.signal?.configured||n.signal?.running);case"imessage":return!!(n.imessage?.configured||n.imessage?.running);default:return!1}}function ir(e,t,n){switch(e){case"whatsapp":{const s=n.whatsapp;return h`
WhatsApp
Link WhatsApp Web and monitor connection health.
Configured
${s?.configured?"Yes":"No"}
Linked
${s?.linked?"Yes":"No"}
Running
${s?.running?"Yes":"No"}
Connected
${s?.connected?"Yes":"No"}
Last connect
${s?.lastConnectedAt?W(s.lastConnectedAt):"n/a"}
Last message
${s?.lastMessageAt?W(s.lastMessageAt):"n/a"}
Auth age
${s?.authAgeMs!=null?nr(s.authAgeMs):"n/a"}
${s?.lastError?h`
${s.lastError}
`:g}
${t.whatsappMessage?h`
${t.whatsappMessage}
`:g}
${t.whatsappQrDataUrl?h`
`:g}
t.onWhatsAppStart(!1)}
>
${t.whatsappBusy?"Workingโฆ":"Show QR"}
t.onWhatsAppStart(!0)}
>
Relink
t.onWhatsAppWait()}
>
Wait for scan
t.onWhatsAppLogout()}
>
Logout
t.onRefresh(!0)}>
Refresh
`}case"telegram":{const s=n.telegram;return h`
Telegram
Bot token and delivery options.
Configured
${s?.configured?"Yes":"No"}
Running
${s?.running?"Yes":"No"}
Mode
${s?.mode??"n/a"}
Last start
${s?.lastStartAt?W(s.lastStartAt):"n/a"}
Last probe
${s?.lastProbeAt?W(s.lastProbeAt):"n/a"}
${s?.lastError?h`
${s.lastError}
`:g}
${s?.probe?h`
Probe ${s.probe.ok?"ok":"failed"} ยท
${s.probe.status??""}
${s.probe.error??""}
`:g}
Bot token
t.onTelegramChange({token:i.target.value})}
/>
Apply default group rules
t.onTelegramChange({groupsWildcardEnabled:i.target.value==="yes"})}
>
No
Yes (allow all groups)
Require mention in groups
t.onTelegramChange({requireMention:i.target.value==="yes"})}
>
Yes
No
Allow from
t.onTelegramChange({allowFrom:i.target.value})}
placeholder="123456789, @team, tg:123"
/>
Proxy
t.onTelegramChange({proxy:i.target.value})}
placeholder="socks5://localhost:9050"
/>
Webhook URL
t.onTelegramChange({webhookUrl:i.target.value})}
placeholder="https://example.com/telegram-webhook"
/>
Webhook secret
t.onTelegramChange({webhookSecret:i.target.value})}
placeholder="secret"
/>
Webhook path
t.onTelegramChange({webhookPath:i.target.value})}
placeholder="/telegram-webhook"
/>
Allow from supports numeric user IDs (recommended) or @usernames. DM the bot
to get your ID, or run /whoami.
${t.telegramTokenLocked?h`
TELEGRAM_BOT_TOKEN is set in the environment. Config edits will not override it.
`:g}
${t.telegramForm.groupsWildcardEnabled?h`
This writes telegram.groups["*"] and allows all groups. Remove it
if you only want specific groups.
t.onTelegramChange({groupsWildcardEnabled:!1})}
>
Remove wildcard
`:g}
${t.telegramStatus?h`
${t.telegramStatus}
`:g}
t.onTelegramSave()}
>
${t.telegramSaving?"Savingโฆ":"Save"}
t.onRefresh(!0)}>
Probe
`}case"discord":{const s=n.discord,i=s?.probe?.bot?.username;return h`
Discord
Bot connection and probe status.
Configured
${s?.configured?"Yes":"No"}
Running
${s?.running?"Yes":"No"}
Bot
${i?`@${i}`:"n/a"}
Last start
${s?.lastStartAt?W(s.lastStartAt):"n/a"}
Last probe
${s?.lastProbeAt?W(s.lastProbeAt):"n/a"}
${s?.lastError?h`
${s.lastError}
`:g}
${s?.probe?h`
Probe ${s.probe.ok?"ok":"failed"} ยท
${s.probe.status??""}
${s.probe.error??""}
`:g}
Tool actions
${Zl.map(a=>h`
${a.label}
t.onDiscordChange({actions:{...t.discordForm.actions,[a.key]:o.target.value==="yes"}})}
>
Enabled
Disabled
`)}
${t.discordTokenLocked?h`
DISCORD_BOT_TOKEN is set in the environment. Config edits will not override it.
`:g}
${t.discordStatus?h`
${t.discordStatus}
`:g}
t.onDiscordSave()}
>
${t.discordSaving?"Savingโฆ":"Save"}
t.onRefresh(!0)}>
Probe
`}case"slack":{const s=n.slack,i=s?.probe?.bot?.name,a=s?.probe?.team?.name;return h`
Slack
Socket mode status and bot details.
Configured
${s?.configured?"Yes":"No"}
Running
${s?.running?"Yes":"No"}
Bot
${i||"n/a"}
Team
${a||"n/a"}
Last start
${s?.lastStartAt?W(s.lastStartAt):"n/a"}
Last probe
${s?.lastProbeAt?W(s.lastProbeAt):"n/a"}
${s?.lastError?h`
${s.lastError}
`:g}
${s?.probe?h`
Probe ${s.probe.ok?"ok":"failed"} ยท
${s.probe.status??""}
${s.probe.error??""}
`:g}
Enabled
t.onSlackChange({enabled:o.target.value==="yes"})}
>
Yes
No
Bot token
t.onSlackChange({botToken:o.target.value})}
/>
App token
t.onSlackChange({appToken:o.target.value})}
/>
DMs enabled
t.onSlackChange({dmEnabled:o.target.value==="yes"})}
>
Enabled
Disabled
Allow DMs from
t.onSlackChange({allowFrom:o.target.value})}
placeholder="U123, U456, *"
/>
Group DMs enabled
t.onSlackChange({groupEnabled:o.target.value==="yes"})}
>
Enabled
Disabled
Group DM channels
t.onSlackChange({groupChannels:o.target.value})}
placeholder="G123, #team"
/>
Reaction notifications
t.onSlackChange({reactionNotifications:o.target.value})}
>
Off
Own
All
Allowlist
Reaction allowlist
t.onSlackChange({reactionAllowlist:o.target.value})}
placeholder="U123, U456"
/>
Text chunk limit
t.onSlackChange({textChunkLimit:o.target.value})}
placeholder="4000"
/>
Media max (MB)
t.onSlackChange({mediaMaxMb:o.target.value})}
placeholder="20"
/>
Slash command
Slash enabled
t.onSlackChange({slashEnabled:o.target.value==="yes"})}
>
Enabled
Disabled
Slash name
t.onSlackChange({slashName:o.target.value})}
placeholder="clawd"
/>
Slash session prefix
t.onSlackChange({slashSessionPrefix:o.target.value})}
placeholder="slack:slash"
/>
Slash ephemeral
t.onSlackChange({slashEphemeral:o.target.value==="yes"})}
>
Yes
No
Channels
Add channel ids or #names and optionally require mentions.
${t.slackForm.channels.map((o,l)=>h`
`)}
t.onSlackChange({channels:[...t.slackForm.channels,{key:"",allow:!0,requireMention:!1}]})}
>
Add channel
Tool actions
${er.map(o=>h`
${o.label}
t.onSlackChange({actions:{...t.slackForm.actions,[o.key]:l.target.value==="yes"}})}
>
Enabled
Disabled
`)}
${t.slackTokenLocked||t.slackAppTokenLocked?h`
${t.slackTokenLocked?"SLACK_BOT_TOKEN ":""}
${t.slackAppTokenLocked?"SLACK_APP_TOKEN ":""}
is set in the environment. Config edits will not override it.
`:g}
${t.slackStatus?h`
${t.slackStatus}
`:g}
t.onSlackSave()}
>
${t.slackSaving?"Savingโฆ":"Save"}
t.onRefresh(!0)}>
Probe
`}case"signal":{const s=n.signal;return h`
`}case"imessage":{const s=n.imessage;return h`
iMessage
imsg CLI and database availability.
Configured
${s?.configured?"Yes":"No"}
Running
${s?.running?"Yes":"No"}
CLI
${s?.cliPath??"n/a"}
DB
${s?.dbPath??"n/a"}
Last start
${s?.lastStartAt?W(s.lastStartAt):"n/a"}
Last probe
${s?.lastProbeAt?W(s.lastProbeAt):"n/a"}
${s?.lastError?h`
${s.lastError}
`:g}
${s?.probe&&!s.probe.ok?h`
Probe failed ยท ${s.probe.error??"unknown error"}
`:g}
Enabled
t.onIMessageChange({enabled:i.target.value==="yes"})}
>
Yes
No
CLI path
t.onIMessageChange({cliPath:i.target.value})}
placeholder="imsg"
/>
DB path
t.onIMessageChange({dbPath:i.target.value})}
placeholder="~/Library/Messages/chat.db"
/>
Service
t.onIMessageChange({service:i.target.value})}
>
Auto
iMessage
SMS
Region
t.onIMessageChange({region:i.target.value})}
placeholder="US"
/>
Allow from
t.onIMessageChange({allowFrom:i.target.value})}
placeholder="chat_id:101, +1555"
/>
Include attachments
t.onIMessageChange({includeAttachments:i.target.value==="yes"})}
>
Yes
No
Media max MB
t.onIMessageChange({mediaMaxMb:i.target.value})}
placeholder="16"
/>
${t.imessageStatus?h`
${t.imessageStatus}
`:g}
t.onIMessageSave()}
>
${t.imessageSaving?"Savingโฆ":"Save"}
t.onRefresh(!0)}>
Probe
`}default:return g}}function ar(e){const t=e.host??"unknown",n=e.ip?`(${e.ip})`:"",s=e.mode??"",i=e.version??"";return`${t} ${n} ${s} ${i}`.trim()}function or(e){const t=e.ts??null;return t?W(t):"n/a"}function na(e){return e?`${dt(e)} (${W(e)})`:"n/a"}function lr(e){if(e.totalTokens==null)return"n/a";const t=e.totalTokens??0,n=e.contextTokens??0;return n?`${t} / ${n}`:String(t)}function rr(e){if(e==null)return"";try{return JSON.stringify(e,null,2)}catch{return String(e)}}function cr(e){const t=e.state??{},n=t.nextRunAtMs?dt(t.nextRunAtMs):"n/a",s=t.lastRunAtMs?dt(t.lastRunAtMs):"n/a";return`${t.lastStatus??"n/a"} ยท next ${n} ยท last ${s}`}function dr(e){const t=e.schedule;return t.kind==="at"?`At ${dt(t.atMs)}`:t.kind==="every"?`Every ${_i(t.everyMs)}`:`Cron ${t.expr}${t.tz?` (${t.tz})`:""}`}function ur(e){const t=e.payload;return t.kind==="systemEvent"?`System: ${t.text}`:`Agent: ${t.message}`}function hr(e){return h`
Scheduler
Gateway-owned cron scheduler status.
Enabled
${e.status?e.status.enabled?"Yes":"No":"n/a"}
Jobs
${e.status?.jobs??"n/a"}
Next wake
${na(e.status?.nextWakeAtMs??null)}
${e.loading?"Refreshingโฆ":"Refresh"}
${e.error?h`${e.error} `:g}
Jobs
All scheduled jobs stored in the gateway.
${e.jobs.length===0?h`No jobs yet.
`:h`
${e.jobs.map(t=>gr(t,e))}
`}
Run history
Latest runs for ${e.runsJobId??"(select a job)"}.
${e.runs.length===0?h`No runs yet.
`:h`
${e.runs.map(t=>fr(t))}
`}
`}function pr(e){const t=e.form;return t.scheduleKind==="at"?h`
Run at
e.onFormChange({scheduleAt:n.target.value})}
/>
`:t.scheduleKind==="every"?h`
Every
e.onFormChange({everyAmount:n.target.value})}
/>
Unit
e.onFormChange({everyUnit:n.target.value})}
>
Minutes
Hours
Days
`:h`
Expression
e.onFormChange({cronExpr:n.target.value})}
/>
Timezone (optional)
e.onFormChange({cronTz:n.target.value})}
/>
`}function gr(e,t){return h`
${e.name}
${dr(e)}
${ur(e)}
${e.enabled?"enabled":"disabled"}
${e.sessionTarget}
${e.wakeMode}
`}function fr(e){return h`
${e.status}
${e.summary??""}
`}function mr(e){return h`
Snapshots
Status, health, and heartbeat data.
${e.loading?"Refreshingโฆ":"Refresh"}
Status
${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(t.target.value)}
placeholder="system-presence"
/>
Params (JSON)
Call
${e.callError?h`
${e.callError}
`:g}
${e.callResult?h`
${e.callResult} `:g}
Models
Catalog from models.list.
${JSON.stringify(e.models??[],null,2)}
Event Log
Latest gateway events.
${e.eventLog.length===0?h`No events yet.
`:h`
${e.eventLog.map(t=>h`
${t.event}
${new Date(t.ts).toLocaleTimeString()}
`)}
`}
`}function br(e){return h`
Connected Instances
Presence beacons from the gateway and clients.
${e.loading?"Loadingโฆ":"Refresh"}
${e.lastError?h`
${e.lastError}
`:g}
${e.statusMessage?h`
${e.statusMessage}
`:g}
${e.entries.length===0?h`
No instances reported yet.
`:e.entries.map(t=>vr(t))}
`}function vr(e){const t=e.lastInputSeconds!=null?`${e.lastInputSeconds}s ago`:"n/a",n=e.mode??"unknown";return h`
${e.host??"unknown host"}
${ar(e)}
${n}
${e.platform?h`${e.platform} `:g}
${e.deviceFamily?h`${e.deviceFamily} `:g}
${e.modelIdentifier?h`${e.modelIdentifier} `:g}
${e.version?h`${e.version} `:g}
`}const hi=["trace","debug","info","warn","error","fatal"];function yr(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString()}function kr(e,t){return t?[e.message,e.subsystem,e.raw].filter(Boolean).join(" ").toLowerCase().includes(t):!0}function $r(e){const t=e.filterText.trim().toLowerCase(),n=hi.some(a=>!e.levelFilters[a]),s=e.entries.filter(a=>a.level&&!e.levelFilters[a.level]?!1:kr(a,t)),i=t||n?"filtered":"visible";return h`
Logs
Gateway file logs (JSONL).
${e.loading?"Loadingโฆ":"Refresh"}
e.onExport(s.map(a=>a.raw),i)}
>
Export ${i}
Filter
e.onFilterTextChange(a.target.value)}
placeholder="Search logs"
/>
Auto-follow
e.onToggleAutoFollow(a.target.checked)}
/>
${hi.map(a=>h`
e.onLevelToggle(a,o.target.checked)}
/>
${a}
`)}
${e.file?h`File: ${e.file}
`:g}
${e.truncated?h`
Log output truncated; showing latest chunk.
`:g}
${e.error?h`${e.error}
`:g}
${s.length===0?h`
No log entries.
`:s.map(a=>h`
${yr(a.time)}
${a.level??""}
${a.subsystem??""}
${a.message??a.raw}
`)}
`}function wr(e){return h`
Nodes
Paired devices and live connections.
${e.loading?"Loadingโฆ":"Refresh"}
${e.nodes.length===0?h`
No nodes found.
`:e.nodes.map(t=>Sr(t))}
`}function Sr(e){const t=!!e.connected,n=!!e.paired,s=typeof e.displayName=="string"&&e.displayName.trim()||(typeof e.nodeId=="string"?e.nodeId:"unknown"),i=Array.isArray(e.caps)?e.caps:[],a=Array.isArray(e.commands)?e.commands:[];return h`
${s}
${typeof e.nodeId=="string"?e.nodeId:""}
${typeof e.remoteIp=="string"?` ยท ${e.remoteIp}`:""}
${typeof e.version=="string"?` ยท ${e.version}`:""}
${n?"paired":"unpaired"}
${t?"connected":"offline"}
${i.slice(0,12).map(o=>h`${String(o)} `)}
${a.slice(0,8).map(o=>h`${String(o)} `)}
`}function xr(e){const t=e.hello?.snapshot,n=t?.uptimeMs?_i(t.uptimeMs):"n/a",s=t?.policy?.tickIntervalMs?`${t.policy.tickIntervalMs}ms`:"n/a";return h`
Snapshot
Latest gateway handshake information.
Status
${e.connected?"Connected":"Disconnected"}
Last Providers Refresh
${e.lastProvidersRefresh?W(e.lastProvidersRefresh):"n/a"}
${e.lastError?h`
${e.lastError}
`:h`
Use Connections 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 ${na(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 Ar=["","off","minimal","low","medium","high"],Tr=[{value:"",label:"inherit"},{value:"off",label:"off (explicit)"},{value:"on",label:"on"}],Cr=["","off","on","stream"];function Er(e){const t=e.result?.sessions??[];return h`
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?h`${e.error}
`:g}
${e.result?`Store: ${e.result.path}`:""}
Key
Label
Kind
Updated
Tokens
Thinking
Verbose
Reasoning
${t.length===0?h`
No sessions found.
`:t.map(n=>_r(n,e.basePath,e.onPatch))}
`}function _r(e,t,n){const s=e.updatedAt?W(e.updatedAt):"n/a",i=e.thinkingLevel??"",a=e.verboseLevel??"",o=e.reasoningLevel??"",l=e.displayName??e.key,r=e.kind!=="global",d=r?`${Hn("chat",t)}?session=${encodeURIComponent(e.key)}`:null;return h`
${e.label??""}
${e.kind}
${s}
${lr(e)}
{const p=c.target.value;n(e.key,{thinkingLevel:p||null})}}
>
${Ar.map(c=>h`${c||"inherit"} `)}
{const p=c.target.value;n(e.key,{verboseLevel:p||null})}}
>
${Tr.map(c=>h`${c.label} `)}
{const p=c.target.value;n(e.key,{reasoningLevel:p||null})}}
>
${Cr.map(c=>h`${c||"inherit"} `)}
`}function Mr(e){const t=e.report?.skills??[],n=e.filter.trim().toLowerCase(),s=n?t.filter(i=>[i.name,i.description,i.source].join(" ").toLowerCase().includes(n)):t;return h`
Skills
Bundled, managed, and workspace skills.
${e.loading?"Loadingโฆ":"Refresh"}
${e.error?h`${e.error}
`:g}
${s.length===0?h`No skills found.
`:h`
${s.map(i=>Lr(i,e))}
`}
`}function Lr(e,t){const n=t.busyKey===e.skillKey,s=t.edits[e.skillKey]??"",i=t.messages[e.skillKey]??null,a=e.install.length>0&&e.missing.bins.length>0,o=[...e.missing.bins.map(r=>`bin:${r}`),...e.missing.env.map(r=>`env:${r}`),...e.missing.config.map(r=>`config:${r}`),...e.missing.os.map(r=>`os:${r}`)],l=[];return e.disabled&&l.push("disabled"),e.blockedByAllowlist&&l.push("blocked by allowlist"),h`
${e.emoji?`${e.emoji} `:""}${e.name}
${no(e.description,140)}
${e.source}
${e.eligible?"eligible":"blocked"}
${e.disabled?h`disabled `:g}
${o.length>0?h`
Missing: ${o.join(", ")}
`:g}
${l.length>0?h`
Reason: ${l.join(", ")}
`:g}
`}const es={reactions:!0,stickers:!0,polls:!0,permissions:!0,messages:!0,threads:!0,pins:!0,search:!0,memberInfo:!0,roleInfo:!0,channelInfo:!0,voiceStatus:!0,events:!0,roles:!1,moderation:!1},ge={reactions:!0,messages:!0,pins:!0,memberInfo:!0,emojiList:!0};async function te(e,t){if(!(!e.client||!e.connected)&&!e.providersLoading){e.providersLoading=!0,e.providersError=null;try{const n=await e.client.request("providers.status",{probe:t,timeoutMs:8e3});e.providersSnapshot=n,e.providersLastSuccess=Date.now(),e.telegramTokenLocked=n.telegram.tokenSource==="env",e.discordTokenLocked=n.discord?.tokenSource==="env",e.slackTokenLocked=n.slack?.botTokenSource==="env",e.slackAppTokenLocked=n.slack?.appTokenSource==="env"}catch(n){e.providersError=String(n)}finally{e.providersLoading=!1}}}async function Rr(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const n=await e.client.request("web.login.start",{force:t,timeoutMs:3e4});e.whatsappLoginMessage=n.message??null,e.whatsappLoginQrDataUrl=n.qrDataUrl??null,e.whatsappLoginConnected=null}catch(n){e.whatsappLoginMessage=String(n),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function Ir(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const t=await e.client.request("web.login.wait",{timeoutMs:12e4});e.whatsappLoginMessage=t.message??null,e.whatsappLoginConnected=t.connected??null,t.connected&&(e.whatsappLoginQrDataUrl=null)}catch(t){e.whatsappLoginMessage=String(t),e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function Pr(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{await e.client.request("web.logout",{}),e.whatsappLoginMessage="Logged out.",e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}catch(t){e.whatsappLoginMessage=String(t)}finally{e.whatsappBusy=!1}}}function Fr(e,t){e.telegramForm={...e.telegramForm,...t}}function Nr(e,t){if(t.actions){e.discordForm={...e.discordForm,...t,actions:{...e.discordForm.actions,...t.actions}};return}e.discordForm={...e.discordForm,...t}}function Or(e,t){if(t.actions){e.slackForm={...e.slackForm,...t,actions:{...e.slackForm.actions,...t.actions}};return}e.slackForm={...e.slackForm,...t}}function Dr(e,t){e.signalForm={...e.signalForm,...t}}function Ur(e,t){e.imessageForm={...e.imessageForm,...t}}async function Br(e){if(!(!e.client||!e.connected)&&!e.telegramSaving){e.telegramSaving=!0,e.telegramConfigStatus=null;try{if(e.telegramForm.groupsWildcardEnabled&&!window.confirm('Telegram groups wildcard "*" allows all groups. Continue?')){e.telegramConfigStatus="Save cancelled.";return}const n={...e.configSnapshot?.config??{}},s={...n.telegram??{}};if(!e.telegramTokenLocked){const p=e.telegramForm.token.trim();p?s.botToken=p:delete s.botToken}const i=s.groups&&typeof s.groups=="object"?{...s.groups}:{};if(e.telegramForm.groupsWildcardEnabled){const p=i["*"]&&typeof i["*"]=="object"?{...i["*"]}:{};p.requireMention=e.telegramForm.requireMention,i["*"]=p,s.groups=i}else i["*"]&&(delete i["*"],Object.keys(i).length>0?s.groups=i:delete s.groups);delete s.requireMention;const a=pe(e.telegramForm.allowFrom);a.length>0?s.allowFrom=a:delete s.allowFrom;const o=e.telegramForm.proxy.trim();o?s.proxy=o:delete s.proxy;const l=e.telegramForm.webhookUrl.trim();l?s.webhookUrl=l:delete s.webhookUrl;const r=e.telegramForm.webhookSecret.trim();r?s.webhookSecret=r:delete s.webhookSecret;const d=e.telegramForm.webhookPath.trim();d?s.webhookPath=d:delete s.webhookPath,n.telegram=s;const c=`${JSON.stringify(n,null,2).trimEnd()}
`;await e.client.request("config.set",{raw:c}),e.telegramConfigStatus="Saved. Restart gateway if needed."}catch(t){e.telegramConfigStatus=String(t)}finally{e.telegramSaving=!1}}}async function Kr(e){if(!(!e.client||!e.connected)&&!e.discordSaving){e.discordSaving=!0,e.discordConfigStatus=null;try{const n={...e.configSnapshot?.config??{}},s={...n.discord??{}},i=e.discordForm;if(i.enabled?delete s.enabled:s.enabled=!1,!e.discordTokenLocked){const S=i.token.trim();S?s.token=S:delete s.token}const a=pe(i.allowFrom),o=pe(i.groupChannels),l={...s.dm??{}};i.dmEnabled?delete l.enabled:l.enabled=!1,a.length>0?l.allowFrom=a:delete l.allowFrom,i.groupEnabled?l.groupEnabled=!0:delete l.groupEnabled,o.length>0?l.groupChannels=o:delete l.groupChannels,Object.keys(l).length>0?s.dm=l:delete s.dm;const r=Number(i.mediaMaxMb);Number.isFinite(r)&&r>0?s.mediaMaxMb=r:delete s.mediaMaxMb;const d=i.historyLimit.trim();if(d.length===0)delete s.historyLimit;else{const S=Number(d);Number.isFinite(S)&&S>=0?s.historyLimit=S:delete s.historyLimit}const c=i.textChunkLimit.trim();if(c.length===0)delete s.textChunkLimit;else{const S=Number(c);Number.isFinite(S)&&S>0?s.textChunkLimit=S:delete s.textChunkLimit}i.replyToMode==="off"?delete s.replyToMode:s.replyToMode=i.replyToMode;const p=Array.isArray(i.guilds)?i.guilds:[],v={};p.forEach(S=>{const E=String(S.key??"").trim();if(!E)return;const N={},R=String(S.slug??"").trim();R&&(N.slug=R),S.requireMention&&(N.requireMention=!0),(S.reactionNotifications==="off"||S.reactionNotifications==="all"||S.reactionNotifications==="own"||S.reactionNotifications==="allowlist")&&(N.reactionNotifications=S.reactionNotifications);const C=pe(S.users);C.length>0&&(N.users=C);const I={};(Array.isArray(S.channels)?S.channels:[]).forEach(H=>{const F=String(H.key??"").trim();if(!F)return;const M={};H.allow===!1&&(M.allow=!1),H.requireMention&&(M.requireMention=!0),I[F]=M}),Object.keys(I).length>0&&(N.channels=I),v[E]=N}),Object.keys(v).length>0?s.guilds=v:delete s.guilds;const w={},y=S=>{const E=i.actions[S];E!==es[S]&&(w[S]=E)};y("reactions"),y("stickers"),y("polls"),y("permissions"),y("messages"),y("threads"),y("pins"),y("search"),y("memberInfo"),y("roleInfo"),y("channelInfo"),y("voiceStatus"),y("events"),y("roles"),y("moderation"),Object.keys(w).length>0?s.actions=w:delete s.actions;const $={...s.slashCommand??{}};i.slashEnabled?$.enabled=!0:delete $.enabled,i.slashName.trim()?$.name=i.slashName.trim():delete $.name,i.slashSessionPrefix.trim()?$.sessionPrefix=i.slashSessionPrefix.trim():delete $.sessionPrefix,i.slashEphemeral?delete $.ephemeral:$.ephemeral=!1,Object.keys($).length>0?s.slashCommand=$:delete s.slashCommand,Object.keys(s).length>0?n.discord=s:delete n.discord;const T=`${JSON.stringify(n,null,2).trimEnd()}
`;await e.client.request("config.set",{raw:T}),e.discordConfigStatus="Saved. Restart gateway if needed."}catch(t){e.discordConfigStatus=String(t)}finally{e.discordSaving=!1}}}async function Hr(e){if(!(!e.client||!e.connected)&&!e.slackSaving){e.slackSaving=!0,e.slackConfigStatus=null;try{const n={...e.configSnapshot?.config??{}},s={...n.slack??{}},i=e.slackForm;if(i.enabled?delete s.enabled:s.enabled=!1,!e.slackTokenLocked){const T=i.botToken.trim();T?s.botToken=T:delete s.botToken}if(!e.slackAppTokenLocked){const T=i.appToken.trim();T?s.appToken=T:delete s.appToken}const a={...s.dm??{}};a.enabled=i.dmEnabled;const o=pe(i.allowFrom);o.length>0?a.allowFrom=o:delete a.allowFrom,i.groupEnabled?a.groupEnabled=!0:delete a.groupEnabled;const l=pe(i.groupChannels);l.length>0?a.groupChannels=l:delete a.groupChannels,Object.keys(a).length>0?s.dm=a:delete s.dm;const r=Number.parseFloat(i.mediaMaxMb);Number.isFinite(r)&&r>0?s.mediaMaxMb=r:delete s.mediaMaxMb;const d=Number.parseInt(i.textChunkLimit,10);Number.isFinite(d)&&d>0?s.textChunkLimit=d:delete s.textChunkLimit,i.reactionNotifications==="own"?delete s.reactionNotifications:s.reactionNotifications=i.reactionNotifications;const c=pe(i.reactionAllowlist);c.length>0?s.reactionAllowlist=c:delete s.reactionAllowlist;const p={...s.slashCommand??{}};i.slashEnabled?p.enabled=!0:delete p.enabled,i.slashName.trim()?p.name=i.slashName.trim():delete p.name,i.slashSessionPrefix.trim()?p.sessionPrefix=i.slashSessionPrefix.trim():delete p.sessionPrefix,i.slashEphemeral?delete p.ephemeral:p.ephemeral=!1,Object.keys(p).length>0?s.slashCommand=p:delete s.slashCommand;const v={},w=T=>{const S=i.actions[T];S!==ge[T]&&(v[T]=S)};w("reactions"),w("messages"),w("pins"),w("memberInfo"),w("emojiList"),Object.keys(v).length>0?s.actions=v:delete s.actions;const y=i.channels.map(T=>{const S=T.key.trim();if(!S)return null;const E={allow:T.allow,requireMention:T.requireMention};return[S,E]}).filter(T=>!!T);y.length>0?s.channels=Object.fromEntries(y):delete s.channels,Object.keys(s).length>0?n.slack=s:delete n.slack;const $=`${JSON.stringify(n,null,2).trimEnd()}
`;await e.client.request("config.set",{raw:$}),e.slackConfigStatus="Saved. Restart gateway if needed."}catch(t){e.slackConfigStatus=String(t)}finally{e.slackSaving=!1}}}async function jr(e){if(!(!e.client||!e.connected)&&!e.signalSaving){e.signalSaving=!0,e.signalConfigStatus=null;try{const n={...e.configSnapshot?.config??{}},s={...n.signal??{}},i=e.signalForm;i.enabled?delete s.enabled:s.enabled=!1;const a=i.account.trim();a?s.account=a:delete s.account;const o=i.httpUrl.trim();o?s.httpUrl=o:delete s.httpUrl;const l=i.httpHost.trim();l?s.httpHost=l:delete s.httpHost;const r=Number(i.httpPort);Number.isFinite(r)&&r>0?s.httpPort=r:delete s.httpPort;const d=i.cliPath.trim();d?s.cliPath=d:delete s.cliPath,i.autoStart?delete s.autoStart:s.autoStart=!1,i.receiveMode==="on-start"||i.receiveMode==="manual"?s.receiveMode=i.receiveMode:delete s.receiveMode,i.ignoreAttachments?s.ignoreAttachments=!0:delete s.ignoreAttachments,i.ignoreStories?s.ignoreStories=!0:delete s.ignoreStories,i.sendReadReceipts?s.sendReadReceipts=!0:delete s.sendReadReceipts;const c=pe(i.allowFrom);c.length>0?s.allowFrom=c:delete s.allowFrom;const p=Number(i.mediaMaxMb);Number.isFinite(p)&&p>0?s.mediaMaxMb=p:delete s.mediaMaxMb,Object.keys(s).length>0?n.signal=s:delete n.signal;const v=`${JSON.stringify(n,null,2).trimEnd()}
`;await e.client.request("config.set",{raw:v}),e.signalConfigStatus="Saved. Restart gateway if needed."}catch(t){e.signalConfigStatus=String(t)}finally{e.signalSaving=!1}}}async function zr(e){if(!(!e.client||!e.connected)&&!e.imessageSaving){e.imessageSaving=!0,e.imessageConfigStatus=null;try{const n={...e.configSnapshot?.config??{}},s={...n.imessage??{}},i=e.imessageForm;i.enabled?delete s.enabled:s.enabled=!1;const a=i.cliPath.trim();a?s.cliPath=a:delete s.cliPath;const o=i.dbPath.trim();o?s.dbPath=o:delete s.dbPath,i.service==="auto"?delete s.service:s.service=i.service;const l=i.region.trim();l?s.region=l:delete s.region;const r=pe(i.allowFrom);r.length>0?s.allowFrom=r:delete s.allowFrom,i.includeAttachments?s.includeAttachments=!0:delete s.includeAttachments;const d=Number(i.mediaMaxMb);Number.isFinite(d)&&d>0?s.mediaMaxMb=d:delete s.mediaMaxMb,Object.keys(s).length>0?n.imessage=s:delete n.imessage;const c=`${JSON.stringify(n,null,2).trimEnd()}
`;await e.client.request("config.set",{raw:c}),e.imessageConfigStatus="Saved. Restart gateway if needed."}catch(t){e.imessageConfigStatus=String(t)}finally{e.imessageSaving=!1}}}async function Ln(e){if(!(!e.client||!e.connected)&&!e.presenceLoading){e.presenceLoading=!0,e.presenceError=null,e.presenceStatus=null;try{const t=await e.client.request("system-presence",{});Array.isArray(t)?(e.presenceEntries=t,e.presenceStatus=t.length===0?"No instances yet.":null):(e.presenceEntries=[],e.presenceStatus="No presence payload.")}catch(t){e.presenceError=String(t)}finally{e.presenceLoading=!1}}}async function ot(e){if(!(!e.client||!e.connected)&&!e.sessionsLoading){e.sessionsLoading=!0,e.sessionsError=null;try{const t={includeGlobal:e.sessionsIncludeGlobal,includeUnknown:e.sessionsIncludeUnknown},n=It(e.sessionsFilterActive,0),s=It(e.sessionsFilterLimit,0);n>0&&(t.activeMinutes=n),s>0&&(t.limit=s);const i=await e.client.request("sessions.list",t);i&&(e.sessionsResult=i)}catch(t){e.sessionsError=String(t)}finally{e.sessionsLoading=!1}}}async function qr(e,t,n){if(!e.client||!e.connected)return;const s={key:t};"thinkingLevel"in n&&(s.thinkingLevel=n.thinkingLevel),"verboseLevel"in n&&(s.verboseLevel=n.verboseLevel),"reasoningLevel"in n&&(s.reasoningLevel=n.reasoningLevel);try{await e.client.request("sessions.patch",s),await ot(e)}catch(i){e.sessionsError=String(i)}}function Ue(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function Vt(e){return e instanceof Error?e.message:String(e)}async function ft(e,t){if(t?.clearMessages&&Object.keys(e.skillMessages).length>0&&(e.skillMessages={}),!(!e.client||!e.connected)&&!e.skillsLoading){e.skillsLoading=!0,e.skillsError=null;try{const n=await e.client.request("skills.status",{});n&&(e.skillsReport=n)}catch(n){e.skillsError=Vt(n)}finally{e.skillsLoading=!1}}}function Wr(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function Gr(e,t,n){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{await e.client.request("skills.update",{skillKey:t,enabled:n}),await ft(e),Ue(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=Vt(s);e.skillsError=i,Ue(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Yr(e,t){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const n=e.skillEdits[t]??"";await e.client.request("skills.update",{skillKey:t,apiKey:n}),await ft(e),Ue(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=Vt(n);e.skillsError=s,Ue(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function Vr(e,t,n,s){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const i=await e.client.request("skills.install",{name:n,installId:s,timeoutMs:12e4});await ft(e),Ue(e,t,{kind:"success",message:i?.message??"Installed"})}catch(i){const a=Vt(i);e.skillsError=a,Ue(e,t,{kind:"error",message:a})}finally{e.skillsBusyKey=null}}}async function Mt(e,t){if(!(!e.client||!e.connected)&&!e.nodesLoading){e.nodesLoading=!0,t?.quiet||(e.lastError=null);try{const n=await e.client.request("node.list",{});e.nodes=Array.isArray(n.nodes)?n.nodes:[]}catch(n){t?.quiet||(e.lastError=String(n))}finally{e.nodesLoading=!1}}}async function Be(e){if(!(!e.client||!e.connected)){e.chatLoading=!0,e.lastError=null;try{const t=await e.client.request("chat.history",{sessionKey:e.sessionKey,limit:200});e.chatMessages=Array.isArray(t.messages)?t.messages:[],e.chatThinkingLevel=t.thinkingLevel??null}catch(t){e.lastError=String(t)}finally{e.chatLoading=!1}}}async function Jr(e,t){if(!e.client||!e.connected)return!1;const n=t.trim();if(!n)return!1;const s=Date.now();e.chatMessages=[...e.chatMessages,{role:"user",content:[{type:"text",text:n}],timestamp:s}],e.chatSending=!0,e.lastError=null;const i=Bn();e.chatRunId=i,e.chatStream="",e.chatStreamStartedAt=s;try{return await e.client.request("chat.send",{sessionKey:e.sessionKey,message:n,deliver:!1,idempotencyKey:i}),!0}catch(a){const o=String(a);return e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,e.lastError=o,e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:"Error: "+o}],timestamp:Date.now()}],!1}finally{e.chatSending=!1}}async function Qr(e){if(!e.client||!e.connected)return!1;const t=e.chatRunId;try{return await e.client.request("chat.abort",t?{sessionKey:e.sessionKey,runId:t}:{sessionKey:e.sessionKey}),!0}catch(n){return e.lastError=String(n),!1}}function Xr(e,t){if(!t||t.sessionKey!==e.sessionKey||t.runId&&e.chatRunId&&t.runId!==e.chatRunId)return null;if(t.state==="delta"){const n=Zr(t.message);if(typeof n=="string"){const s=e.chatStream??"";(!s||n.length>=s.length)&&(e.chatStream=n)}}else t.state==="final"||t.state==="aborted"?(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null):t.state==="error"&&(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.lastError=t.errorMessage??"chat error");return t.state}function Zr(e){const t=e,n=typeof t.role=="string"?t.role:"",s=t.content;if(typeof s=="string")return n==="assistant"?Ne(s):s;if(Array.isArray(s)){const i=s.map(a=>{const o=a;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(a=>typeof a=="string");if(i.length>0){const a=i.join(`
`);return n==="assistant"?Ne(a):a}}return typeof t.text=="string"?n==="assistant"?Ne(t.text):t.text:null}async function re(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});nc(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function ec(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});tc(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function tc(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function nc(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?ut(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=ut(e.configForm):e.configRaw=n,e.configValid=typeof t.valid=="boolean"?t.valid:null,e.configIssues=Array.isArray(t.issues)?t.issues:[];const s=t.config??{},i=s.telegram??{},a=s.discord??{},o=s.slack??{},l=s.signal??{},r=s.imessage??{},d=H=>Array.isArray(H)?H.map(F=>String(F??"").trim()).filter(F=>F.length>0).join(", "):"",c=i.groups&&typeof i.groups=="object"?i.groups:{},p=c["*"]&&typeof c["*"]=="object"?c["*"]:{},v=!!c["*"],w=Array.isArray(i.allowFrom)?d(i.allowFrom):typeof i.allowFrom=="string"?i.allowFrom:"";e.telegramForm={token:typeof i.botToken=="string"?i.botToken:"",requireMention:typeof p.requireMention=="boolean"?p.requireMention:!0,groupsWildcardEnabled:v,allowFrom:w,proxy:typeof i.proxy=="string"?i.proxy:"",webhookUrl:typeof i.webhookUrl=="string"?i.webhookUrl:"",webhookSecret:typeof i.webhookSecret=="string"?i.webhookSecret:"",webhookPath:typeof i.webhookPath=="string"?i.webhookPath:""};const y=a.dm??{},$=a.slashCommand??{},T=a.actions??{},S=a.guilds,E=H=>typeof T[H]=="boolean"?T[H]:es[H];e.discordForm={enabled:typeof a.enabled=="boolean"?a.enabled:!0,token:typeof a.token=="string"?a.token:"",dmEnabled:typeof y.enabled=="boolean"?y.enabled:!0,allowFrom:d(y.allowFrom),groupEnabled:typeof y.groupEnabled=="boolean"?y.groupEnabled:!1,groupChannels:d(y.groupChannels),mediaMaxMb:typeof a.mediaMaxMb=="number"?String(a.mediaMaxMb):"",historyLimit:typeof a.historyLimit=="number"?String(a.historyLimit):"",textChunkLimit:typeof a.textChunkLimit=="number"?String(a.textChunkLimit):"",replyToMode:a.replyToMode==="first"||a.replyToMode==="all"?a.replyToMode:"off",guilds:Array.isArray(S)?[]:typeof S=="object"&&S?Object.entries(S).map(([H,F])=>{const M=F&&typeof F=="object"?F:{},D=M.channels&&typeof M.channels=="object"?M.channels:{},Ke=Object.entries(D).map(([He,be])=>{const Te=be&&typeof be=="object"?be:{};return{key:He,allow:typeof Te.allow=="boolean"?Te.allow:!0,requireMention:typeof Te.requireMention=="boolean"?Te.requireMention:!1}});return{key:H,slug:typeof M.slug=="string"?M.slug:"",requireMention:typeof M.requireMention=="boolean"?M.requireMention:!1,reactionNotifications:M.reactionNotifications==="off"||M.reactionNotifications==="all"||M.reactionNotifications==="own"||M.reactionNotifications==="allowlist"?M.reactionNotifications:"own",users:d(M.users),channels:Ke}}):[],actions:{reactions:E("reactions"),stickers:E("stickers"),polls:E("polls"),permissions:E("permissions"),messages:E("messages"),threads:E("threads"),pins:E("pins"),search:E("search"),memberInfo:E("memberInfo"),roleInfo:E("roleInfo"),channelInfo:E("channelInfo"),voiceStatus:E("voiceStatus"),events:E("events"),roles:E("roles"),moderation:E("moderation")},slashEnabled:typeof $.enabled=="boolean"?$.enabled:!1,slashName:typeof $.name=="string"?$.name:"",slashSessionPrefix:typeof $.sessionPrefix=="string"?$.sessionPrefix:"",slashEphemeral:typeof $.ephemeral=="boolean"?$.ephemeral:!0};const N=o.dm??{},R=o.channels,C=o.slashCommand??{},I=o.actions??{};e.slackForm={enabled:typeof o.enabled=="boolean"?o.enabled:!0,botToken:typeof o.botToken=="string"?o.botToken:"",appToken:typeof o.appToken=="string"?o.appToken:"",dmEnabled:typeof N.enabled=="boolean"?N.enabled:!0,allowFrom:d(N.allowFrom),groupEnabled:typeof N.groupEnabled=="boolean"?N.groupEnabled:!1,groupChannels:d(N.groupChannels),mediaMaxMb:typeof o.mediaMaxMb=="number"?String(o.mediaMaxMb):"",textChunkLimit:typeof o.textChunkLimit=="number"?String(o.textChunkLimit):"",reactionNotifications:o.reactionNotifications==="off"||o.reactionNotifications==="all"||o.reactionNotifications==="allowlist"?o.reactionNotifications:"own",reactionAllowlist:d(o.reactionAllowlist),slashEnabled:typeof C.enabled=="boolean"?C.enabled:!1,slashName:typeof C.name=="string"?C.name:"",slashSessionPrefix:typeof C.sessionPrefix=="string"?C.sessionPrefix:"",slashEphemeral:typeof C.ephemeral=="boolean"?C.ephemeral:!0,actions:{...ge,reactions:typeof I.reactions=="boolean"?I.reactions:ge.reactions,messages:typeof I.messages=="boolean"?I.messages:ge.messages,pins:typeof I.pins=="boolean"?I.pins:ge.pins,memberInfo:typeof I.memberInfo=="boolean"?I.memberInfo:ge.memberInfo,emojiList:typeof I.emojiList=="boolean"?I.emojiList:ge.emojiList},channels:Array.isArray(R)?[]:typeof R=="object"&&R?Object.entries(R).map(([H,F])=>{const M=F&&typeof F=="object"?F:{};return{key:H,allow:typeof M.allow=="boolean"?M.allow:!0,requireMention:typeof M.requireMention=="boolean"?M.requireMention:!1}}):[]},e.signalForm={enabled:typeof l.enabled=="boolean"?l.enabled:!0,account:typeof l.account=="string"?l.account:"",httpUrl:typeof l.httpUrl=="string"?l.httpUrl:"",httpHost:typeof l.httpHost=="string"?l.httpHost:"",httpPort:typeof l.httpPort=="number"?String(l.httpPort):"",cliPath:typeof l.cliPath=="string"?l.cliPath:"",autoStart:typeof l.autoStart=="boolean"?l.autoStart:!0,receiveMode:l.receiveMode==="on-start"||l.receiveMode==="manual"?l.receiveMode:"",ignoreAttachments:typeof l.ignoreAttachments=="boolean"?l.ignoreAttachments:!1,ignoreStories:typeof l.ignoreStories=="boolean"?l.ignoreStories:!1,sendReadReceipts:typeof l.sendReadReceipts=="boolean"?l.sendReadReceipts:!1,allowFrom:d(l.allowFrom),mediaMaxMb:typeof l.mediaMaxMb=="number"?String(l.mediaMaxMb):""},e.imessageForm={enabled:typeof r.enabled=="boolean"?r.enabled:!0,cliPath:typeof r.cliPath=="string"?r.cliPath:"",dbPath:typeof r.dbPath=="string"?r.dbPath:"",service:r.service==="imessage"||r.service==="sms"||r.service==="auto"?r.service:"auto",region:typeof r.region=="string"?r.region:"",allowFrom:d(r.allowFrom),includeAttachments:typeof r.includeAttachments=="boolean"?r.includeAttachments:!1,mediaMaxMb:typeof r.mediaMaxMb=="number"?String(r.mediaMaxMb):""};const Y=t.valid===!1?"Config invalid.":null;e.telegramConfigStatus=Y,e.discordConfigStatus=Y,e.slackConfigStatus=Y,e.signalConfigStatus=Y,e.imessageConfigStatus=Y,e.configFormDirty||(e.configForm=sa(t.config??{}))}async function sc(e){if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const t=e.configFormMode==="form"&&e.configForm?ut(e.configForm):e.configRaw;await e.client.request("config.set",{raw:t}),e.configFormDirty=!1,await re(e)}catch(t){e.lastError=String(t)}finally{e.configSaving=!1}}}async function ic(e){if(!(!e.client||!e.connected)){e.configApplying=!0,e.lastError=null;try{const t=e.configFormMode==="form"&&e.configForm?ut(e.configForm):e.configRaw;await e.client.request("config.apply",{raw:t,sessionKey:e.applySessionKey}),e.configFormDirty=!1,await re(e)}catch(t){e.lastError=String(t)}finally{e.configApplying=!1}}}async function ac(e){if(!(!e.client||!e.connected)){e.updateRunning=!0,e.lastError=null;try{await e.client.request("update.run",{sessionKey:e.applySessionKey})}catch(t){e.lastError=String(t)}finally{e.updateRunning=!1}}}function oc(e,t,n){const s=sa(e.configForm??e.configSnapshot?.config??{});lc(s,t,n),e.configForm=s,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=ut(s))}function sa(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function ut(e){return`${JSON.stringify(e,null,2).trimEnd()}
`}function lc(e,t,n){if(t.length===0)return;let s=e;for(let a=0;a0&&(n.timeoutSeconds=s),n}async function dc(e){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const t=rc(e.cronForm),n=cc(e.cronForm),s={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,enabled:e.cronForm.enabled,schedule:t,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:n,isolation:e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?{postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:void 0};if(!s.name)throw new Error("Name required.");await e.client.request("cron.add",s),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await Jt(e),await ht(e)}catch(t){e.cronError=String(t)}finally{e.cronBusy=!1}}}async function uc(e,t,n){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.update",{id:t.id,patch:{enabled:n}}),await Jt(e),await ht(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function hc(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await ia(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function pc(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.remove",{id:t.id}),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[]),await Jt(e),await ht(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function ia(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("cron.runs",{id:t,limit:50});e.cronRunsJobId=t,e.cronRuns=Array.isArray(n.entries)?n.entries:[]}catch(n){e.cronError=String(n)}}async function Rn(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,s,i]=await Promise.all([e.client.request("status",{}),e.client.request("health",{}),e.client.request("models.list",{}),e.client.request("last-heartbeat",{})]);e.debugStatus=t,e.debugHealth=n;const a=s;e.debugModels=Array.isArray(a?.models)?a?.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}async function gc(e){if(!(!e.client||!e.connected)){e.debugCallError=null,e.debugCallResult=null;try{const t=e.debugCallParams.trim()?JSON.parse(e.debugCallParams):{},n=await e.client.request(e.debugCallMethod.trim(),t);e.debugCallResult=JSON.stringify(n,null,2)}catch(t){e.debugCallError=String(t)}}}const fc=2e3,mc=new Set(["trace","debug","info","warn","error","fatal"]);function bc(e){if(typeof e!="string")return null;const t=e.trim();if(!t.startsWith("{")||!t.endsWith("}"))return null;try{const n=JSON.parse(t);return!n||typeof n!="object"?null:n}catch{return null}}function vc(e){if(typeof e!="string")return null;const t=e.toLowerCase();return mc.has(t)?t:null}function yc(e){if(!e.trim())return{raw:e,message:e};try{const t=JSON.parse(e),n=t&&typeof t._meta=="object"&&t._meta!==null?t._meta:null,s=typeof t.time=="string"?t.time:typeof n?.date=="string"?n?.date:null,i=vc(n?.logLevelName??n?.level),a=typeof t[0]=="string"?t[0]:typeof n?.name=="string"?n?.name:null,o=bc(a);let l=null;o&&(typeof o.subsystem=="string"?l=o.subsystem:typeof o.module=="string"&&(l=o.module)),!l&&a&&a.length<120&&(l=a);let r=null;return typeof t[1]=="string"?r=t[1]:!o&&typeof t[0]=="string"?r=t[0]:typeof t.message=="string"&&(r=t.message),{raw:e,time:s,level:i,subsystem:l,message:r??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function In(e,t){if(!(!e.client||!e.connected)&&!(e.logsLoading&&!t?.quiet)){t?.quiet||(e.logsLoading=!0),e.logsError=null;try{const s=await e.client.request("logs.tail",{cursor:t?.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),a=(Array.isArray(s.lines)?s.lines.filter(l=>typeof l=="string"):[]).map(yc),o=!!(t?.reset||s.reset||e.logsCursor==null);e.logsEntries=o?a:[...e.logsEntries,...a].slice(-fc),typeof s.cursor=="number"&&(e.logsCursor=s.cursor),typeof s.file=="string"&&(e.logsFile=s.file),e.logsTruncated=!!s.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t?.quiet||(e.logsLoading=!1)}}}function kc(e){const t=e.presenceEntries.length,n=e.sessionsResult?.count??null,s=e.cronStatus?.nextWakeAtMs??null,i=e.connected?null:"Disconnected from gateway.",a=e.tab==="chat",o=a&&e.settings.chatFocusMode;return h`
${e.tab==="overview"?xr({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:s,lastProvidersRefresh:e.providersLastSuccess,onSettingsChange:l=>e.applySettings(l),onPasswordChange:l=>e.password=l,onSessionKeyChange:l=>{e.sessionKey=l,e.chatMessage="",e.resetToolStream(),e.applySettings({...e.settings,sessionKey:l,lastActiveSessionKey:l})},onConnect:()=>e.connect(),onRefresh:()=>e.loadOverview()}):g}
${e.tab==="connections"?tr({connected:e.connected,loading:e.providersLoading,snapshot:e.providersSnapshot,lastError:e.providersError,lastSuccessAt:e.providersLastSuccess,whatsappMessage:e.whatsappLoginMessage,whatsappQrDataUrl:e.whatsappLoginQrDataUrl,whatsappConnected:e.whatsappLoginConnected,whatsappBusy:e.whatsappBusy,telegramForm:e.telegramForm,telegramTokenLocked:e.telegramTokenLocked,telegramSaving:e.telegramSaving,telegramStatus:e.telegramConfigStatus,discordForm:e.discordForm,discordTokenLocked:e.discordTokenLocked,discordSaving:e.discordSaving,discordStatus:e.discordConfigStatus,slackForm:e.slackForm,slackTokenLocked:e.slackTokenLocked,slackAppTokenLocked:e.slackAppTokenLocked,slackSaving:e.slackSaving,slackStatus:e.slackConfigStatus,signalForm:e.signalForm,signalSaving:e.signalSaving,signalStatus:e.signalConfigStatus,imessageForm:e.imessageForm,imessageSaving:e.imessageSaving,imessageStatus:e.imessageConfigStatus,onRefresh:l=>te(e,l),onWhatsAppStart:l=>e.handleWhatsAppStart(l),onWhatsAppWait:()=>e.handleWhatsAppWait(),onWhatsAppLogout:()=>e.handleWhatsAppLogout(),onTelegramChange:l=>Fr(e,l),onTelegramSave:()=>e.handleTelegramSave(),onDiscordChange:l=>Nr(e,l),onDiscordSave:()=>e.handleDiscordSave(),onSlackChange:l=>Or(e,l),onSlackSave:()=>e.handleSlackSave(),onSignalChange:l=>Dr(e,l),onSignalSave:()=>e.handleSignalSave(),onIMessageChange:l=>Ur(e,l),onIMessageSave:()=>e.handleIMessageSave()}):g}
${e.tab==="instances"?br({loading:e.presenceLoading,entries:e.presenceEntries,lastError:e.presenceError,statusMessage:e.presenceStatus,onRefresh:()=>Ln(e)}):g}
${e.tab==="sessions"?Er({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:l=>{e.sessionsFilterActive=l.activeMinutes,e.sessionsFilterLimit=l.limit,e.sessionsIncludeGlobal=l.includeGlobal,e.sessionsIncludeUnknown=l.includeUnknown},onRefresh:()=>ot(e),onPatch:(l,r)=>qr(e,l,r)}):g}
${e.tab==="cron"?hr({loading:e.cronLoading,status:e.cronStatus,jobs:e.cronJobs,error:e.cronError,busy:e.cronBusy,form:e.cronForm,runsJobId:e.cronRunsJobId,runs:e.cronRuns,onFormChange:l=>e.cronForm={...e.cronForm,...l},onRefresh:()=>e.loadCron(),onAdd:()=>dc(e),onToggle:(l,r)=>uc(e,l,r),onRun:l=>hc(e,l),onRemove:l=>pc(e,l),onLoadRuns:l=>ia(e,l)}):g}
${e.tab==="skills"?Mr({loading:e.skillsLoading,report:e.skillsReport,error:e.skillsError,filter:e.skillsFilter,edits:e.skillEdits,messages:e.skillMessages,busyKey:e.skillsBusyKey,onFilterChange:l=>e.skillsFilter=l,onRefresh:()=>ft(e,{clearMessages:!0}),onToggle:(l,r)=>Gr(e,l,r),onEdit:(l,r)=>Wr(e,l,r),onSaveKey:l=>Yr(e,l),onInstall:(l,r,d)=>Vr(e,l,r,d)}):g}
${e.tab==="nodes"?wr({loading:e.nodesLoading,nodes:e.nodes,onRefresh:()=>Mt(e)}):g}
${e.tab==="chat"?Kl({sessionKey:e.sessionKey,onSessionKeyChange:l=>{e.sessionKey=l,e.chatMessage="",e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.chatQueue=[],e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:l,lastActiveSessionKey:l}),Be(e)},thinkingLevel:e.chatThinkingLevel,loading:e.chatLoading,sending:e.chatSending,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:e.chatStreamStartedAt,draft:e.chatMessage,queue:e.chatQueue,connected:e.connected,canSend:e.connected,disabledReason:i,error:e.lastError,sessions:e.sessionsResult,isToolOutputExpanded:l=>e.toolOutputExpanded.has(l),onToolOutputToggle:(l,r)=>e.toggleToolOutput(l,r),focusMode:e.settings.chatFocusMode,useNewChatLayout:e.settings.useNewChatLayout,onRefresh:()=>(e.resetToolStream(),Be(e)),onToggleFocusMode:()=>e.applySettings({...e.settings,chatFocusMode:!e.settings.chatFocusMode}),onToggleLayout:()=>e.applySettings({...e.settings,useNewChatLayout:!e.settings.useNewChatLayout}),onDraftChange:l=>e.chatMessage=l,onSend:()=>e.handleSendChat(),canAbort:!!e.chatRunId,onAbort:()=>{e.handleAbortChat()},onQueueRemove:l=>e.removeQueuedMessage(l),onNewSession:()=>e.handleSendChat("/new",{restoreDraft:!0}),sidebarOpen:e.sidebarOpen,sidebarContent:e.sidebarContent,sidebarError:e.sidebarError,splitRatio:e.splitRatio,onOpenSidebar:l=>e.handleOpenSidebar(l),onCloseSidebar:()=>e.handleCloseSidebar(),onSplitRatioChange:l=>e.handleSplitRatioChange(l)}):g}
${e.tab==="config"?Xl({raw:e.configRaw,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,onRawChange:l=>e.configRaw=l,onFormModeChange:l=>e.configFormMode=l,onFormPatch:(l,r)=>oc(e,l,r),onReload:()=>re(e),onSave:()=>sc(e),onApply:()=>ic(e),onUpdate:()=>ac(e)}):g}
${e.tab==="debug"?mr({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:l=>e.debugCallMethod=l,onCallParamsChange:l=>e.debugCallParams=l,onRefresh:()=>Rn(e),onCall:()=>gc(e)}):g}
${e.tab==="logs"?$r({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:l=>e.logsFilterText=l,onLevelToggle:(l,r)=>{e.logsLevelFilters={...e.logsLevelFilters,[l]:r}},onToggleAutoFollow:l=>e.logsAutoFollow=l,onRefresh:()=>In(e,{reset:!0}),onExport:(l,r)=>e.exportLogs(l,r),onScroll:l=>e.handleLogsScroll(l)}):g}
Docs
`}function $c(e,t){const n=Hn(t,e.basePath);return h`
{s.defaultPrevented||s.button!==0||s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||(s.preventDefault(),e.setTab(t))}}
title=${$n(t)}
>
${Ya(t)}
${$n(t)}
`}function wc(e){const t=Sc(e.sessionKey,e.sessionsResult),n=h` `,s=h` `,i=h` `,a=h` `;return h`
{const l=o.target.value;e.sessionKey=l,e.chatMessage="",e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:l,lastActiveSessionKey:l}),Be(e)}}
>
${t.map(o=>h`
${o.displayName??o.key}
`)}
{e.resetToolStream(),Be(e)}}
title="Refresh chat history"
>
${i}
|
e.applySettings({...e.settings,chatFocusMode:!e.settings.chatFocusMode})}
aria-pressed=${e.settings.chatFocusMode}
title="Toggle focus mode (hide sidebar + page header)"
>
${a}
e.applySettings({...e.settings,useNewChatLayout:!e.settings.useNewChatLayout})}
aria-pressed=${e.settings.useNewChatLayout}
title="${e.settings.useNewChatLayout?"Switch to list view":"Switch to grouped view"}"
>
${e.settings.useNewChatLayout?s:n}
`}function Sc(e,t){const n=new Set,s=[];if(n.add(e),s.push({key:e}),t?.sessions)for(const i of t.sessions)n.has(i.key)||(n.add(i.key),s.push({key:i.key,displayName:i.displayName}));return s}const xc=["system","light","dark"];function Ac(e){const t=Math.max(0,xc.indexOf(e.theme)),n=s=>i=>{const o={element:i.currentTarget};(i.clientX||i.clientY)&&(o.pointerClientX=i.clientX,o.pointerClientY=i.clientY),e.setTheme(s,o)};return h`
`}function Tc(){return h`
`}function Cc(){return h`
`}function Ec(){return h`
`}function _c(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function yn(e){return e==="system"?_c():e}const Tt=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,Mc=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,Ct=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},Lc=({nextTheme:e,applyTheme:t,context:n,currentTheme:s})=>{if(s===e)return;const i=globalThis.document??null;if(!i){t();return}const a=i.documentElement,o=i,l=Mc();if(!!o.startViewTransition&&!l){let d=.5,c=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")d=Tt(n.pointerClientX/window.innerWidth),c=Tt(n.pointerClientY/window.innerHeight);else if(n?.element){const p=n.element.getBoundingClientRect();p.width>0&&p.height>0&&typeof window<"u"&&(d=Tt((p.left+p.width/2)/window.innerWidth),c=Tt((p.top+p.height/2)/window.innerHeight))}a.style.setProperty("--theme-switch-x",`${d*100}%`),a.style.setProperty("--theme-switch-y",`${c*100}%`),a.classList.add("theme-transition");try{const p=o.startViewTransition?.(()=>{t()});p?.finished?p.finished.finally(()=>Ct(a)):Ct(a)}catch{Ct(a),t()}return}t(),Ct(a)};var Rc=Object.defineProperty,Ic=Object.getOwnPropertyDescriptor,m=(e,t,n,s)=>{for(var i=s>1?void 0:s?Ic(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(s?o(t,n,i):o(i))||i);return s&&i&&Rc(t,n,i),i};const pi=50,Pc=80,Fc=12e4,Nc={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0};function Oc(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.text=="string")return t.text;const n=t.content;if(!Array.isArray(n))return null;const s=n.map(i=>{if(!i||typeof i!="object")return null;const a=i;return a.type==="text"&&typeof a.text=="string"?a.text:null}).filter(i=>!!i);return s.length===0?null:s.join(`
`)}function gi(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean")return String(e);const t=Oc(e);let n;if(typeof e=="string")n=e;else if(t)n=t;else try{n=JSON.stringify(e,null,2)}catch{n=String(e)}const s=Mi(n,Fc);return s.truncated?`${s.text}
โฆ truncated (${s.total} chars, showing first ${s.text.length}).`:s.text}const Dc={name:"",description:"",enabled:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",sessionTarget:"main",wakeMode:"next-heartbeat",payloadKind:"systemEvent",payloadText:"",deliver:!1,provider:"last",to:"",timeoutSeconds:"",postToMainPrefix:""};let f=class extends Fe{constructor(){super(...arguments),this.settings=za(),this.password="",this.tab="chat",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.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.chatThinkingLevel=null,this.chatQueue=[],this.toolOutputExpanded=new Set,this.sidebarOpen=!1,this.sidebarContent=null,this.sidebarError=null,this.splitRatio=this.settings.splitRatio,this.nodesLoading=!1,this.nodes=[],this.configLoading=!1,this.configRaw=`{
}
`,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.configFormDirty=!1,this.configFormMode="form",this.providersLoading=!1,this.providersSnapshot=null,this.providersError=null,this.providersLastSuccess=null,this.whatsappLoginMessage=null,this.whatsappLoginQrDataUrl=null,this.whatsappLoginConnected=null,this.whatsappBusy=!1,this.telegramForm={token:"",requireMention:!0,groupsWildcardEnabled:!1,allowFrom:"",proxy:"",webhookUrl:"",webhookSecret:"",webhookPath:""},this.telegramSaving=!1,this.telegramTokenLocked=!1,this.telegramConfigStatus=null,this.discordForm={enabled:!0,token:"",dmEnabled:!0,allowFrom:"",groupEnabled:!1,groupChannels:"",mediaMaxMb:"",historyLimit:"",textChunkLimit:"",guilds:[],actions:{...es},slashEnabled:!1,slashName:"",slashSessionPrefix:"",slashEphemeral:!0},this.discordSaving=!1,this.discordTokenLocked=!1,this.discordConfigStatus=null,this.slackForm={enabled:!0,botToken:"",appToken:"",dmEnabled:!0,allowFrom:"",groupEnabled:!1,groupChannels:"",mediaMaxMb:"",textChunkLimit:"",reactionNotifications:"own",reactionAllowlist:"",slashEnabled:!1,slashName:"",slashSessionPrefix:"",slashEphemeral:!0,actions:{...ge},channels:[]},this.slackSaving=!1,this.slackTokenLocked=!1,this.slackAppTokenLocked=!1,this.slackConfigStatus=null,this.signalForm={enabled:!0,account:"",httpUrl:"",httpHost:"",httpPort:"",cliPath:"",autoStart:!0,receiveMode:"",ignoreAttachments:!1,ignoreStories:!1,sendReadReceipts:!1,allowFrom:"",mediaMaxMb:""},this.signalSaving=!1,this.signalConfigStatus=null,this.imessageForm={enabled:!0,cliPath:"",dbPath:"",service:"auto",region:"",allowFrom:"",includeAttachments:!1,mediaMaxMb:""},this.imessageSaving=!1,this.imessageConfigStatus=null,this.presenceLoading=!1,this.presenceEntries=[],this.presenceError=null,this.presenceStatus=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={...Dc},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={...Nc},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.nodesPollInterval=null,this.logsPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.basePath="",this.popStateHandler=()=>this.onPopState(),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.basePath=this.inferBasePath(),this.syncTabWithLocation(!0),this.syncThemeWithSettings(),this.attachThemeListener(),window.addEventListener("popstate",this.popStateHandler),this.applySettingsFromUrl(),this.connect(),this.startNodesPolling(),this.tab==="logs"&&this.startLogsPolling()}firstUpdated(){this.observeTopbar()}disconnectedCallback(){window.removeEventListener("popstate",this.popStateHandler),this.stopNodesPolling(),this.stopLogsPolling(),this.detachThemeListener(),this.topbarObserver?.disconnect(),this.topbarObserver=null,super.disconnectedCallback()}updated(e){if(this.tab==="chat"&&(e.has("chatMessages")||e.has("chatToolMessages")||e.has("chatStream")||e.has("chatLoading")||e.has("tab"))){const t=e.has("tab"),n=e.has("chatLoading")&&e.get("chatLoading")===!0&&this.chatLoading===!1;this.scheduleChatScroll(t||n||!this.chatHasAutoScrolled)}this.tab==="logs"&&(e.has("logsEntries")||e.has("logsAutoFollow")||e.has("tab"))&&this.logsAutoFollow&&this.logsAtBottom&&this.scheduleLogsScroll(e.has("tab")||e.has("logsAutoFollow"))}connect(){this.lastError=null,this.hello=null,this.connected=!1,this.client?.stop(),this.client=new ja({url:this.settings.gatewayUrl,token:this.settings.token.trim()?this.settings.token:void 0,password:this.password.trim()?this.password:void 0,clientName:"clawdbot-control-ui",mode:"webchat",onHello:e=>{this.connected=!0,this.hello=e,this.applySnapshot(e),Mt(this,{quiet:!0}),this.refreshActiveTab()},onClose:({code:e,reason:t})=>{this.connected=!1,this.lastError=`disconnected (${e}): ${t||"no reason"}`},onEvent:e=>this.onEvent(e),onGap:({expected:e,received:t})=>{this.lastError=`event gap detected (expected seq ${e}, got ${t}); refresh recommended`}}),this.client.start()}scheduleChatScroll(e=!1){this.chatScrollFrame&&cancelAnimationFrame(this.chatScrollFrame),this.chatScrollTimeout!=null&&(clearTimeout(this.chatScrollTimeout),this.chatScrollTimeout=null);const t=()=>{const n=this.querySelector(".chat-thread");if(n){const s=getComputedStyle(n).overflowY;if(s==="auto"||s==="scroll"||n.scrollHeight-n.clientHeight>1)return n}return document.scrollingElement??document.documentElement};this.updateComplete.then(()=>{this.chatScrollFrame=requestAnimationFrame(()=>{this.chatScrollFrame=null;const n=t();if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;if(!(e||s<200))return;e&&(this.chatHasAutoScrolled=!0),n.scrollTop=n.scrollHeight;const a=e?150:120;this.chatScrollTimeout=window.setTimeout(()=>{this.chatScrollTimeout=null;const o=t();if(!o)return;const l=o.scrollHeight-o.scrollTop-o.clientHeight;!e&&l>=250||(o.scrollTop=o.scrollHeight)},a)})})}observeTopbar(){if(typeof ResizeObserver>"u")return;const e=this.querySelector(".topbar");if(!e)return;const t=()=>{const{height:n}=e.getBoundingClientRect();this.style.setProperty("--topbar-height",`${n}px`)};t(),this.topbarObserver=new ResizeObserver(()=>t()),this.topbarObserver.observe(e)}startNodesPolling(){this.nodesPollInterval==null&&(this.nodesPollInterval=window.setInterval(()=>{Mt(this,{quiet:!0})},5e3))}stopNodesPolling(){this.nodesPollInterval!=null&&(clearInterval(this.nodesPollInterval),this.nodesPollInterval=null)}startLogsPolling(){this.logsPollInterval==null&&(this.logsPollInterval=window.setInterval(()=>{this.tab==="logs"&&In(this,{quiet:!0})},2e3))}stopLogsPolling(){this.logsPollInterval!=null&&(clearInterval(this.logsPollInterval),this.logsPollInterval=null)}scheduleLogsScroll(e=!1){this.logsScrollFrame&&cancelAnimationFrame(this.logsScrollFrame),this.updateComplete.then(()=>{this.logsScrollFrame=requestAnimationFrame(()=>{this.logsScrollFrame=null;const t=this.querySelector(".log-stream");if(!t)return;const n=t.scrollHeight-t.scrollTop-t.clientHeight;(e||n<80)&&(t.scrollTop=t.scrollHeight)})})}handleLogsScroll(e){const t=e.currentTarget;if(!t)return;const n=t.scrollHeight-t.scrollTop-t.clientHeight;this.logsAtBottom=n<80}exportLogs(e,t){if(e.length===0)return;const n=new Blob([`${e.join(`
`)}
`],{type:"text/plain"}),s=URL.createObjectURL(n),i=document.createElement("a"),a=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");i.href=s,i.download=`clawdbot-logs-${t}-${a}.log`,i.click(),URL.revokeObjectURL(s)}resetToolStream(){this.toolStreamById.clear(),this.toolStreamOrder=[],this.chatToolMessages=[],this.toolOutputExpanded=new Set,this.flushToolStreamSync()}resetChatScroll(){this.chatHasAutoScrolled=!1}toggleToolOutput(e,t){const n=new Set(this.toolOutputExpanded);t?n.add(e):n.delete(e),this.toolOutputExpanded=n}trimToolStream(){if(this.toolStreamOrder.length<=pi)return;const e=this.toolStreamOrder.length-pi,t=this.toolStreamOrder.splice(0,e);for(const n of t)this.toolStreamById.delete(n)}syncToolStreamMessages(){this.chatToolMessages=this.toolStreamOrder.map(e=>this.toolStreamById.get(e)?.message).filter(e=>!!e)}scheduleToolStreamSync(e=!1){if(e){this.flushToolStreamSync();return}this.toolStreamSyncTimer==null&&(this.toolStreamSyncTimer=window.setTimeout(()=>this.flushToolStreamSync(),Pc))}flushToolStreamSync(){this.toolStreamSyncTimer!=null&&(clearTimeout(this.toolStreamSyncTimer),this.toolStreamSyncTimer=null),this.syncToolStreamMessages()}buildToolStreamMessage(e){const t=[];return t.push({type:"toolcall",name:e.name,arguments:e.args??{}}),e.output&&t.push({type:"toolresult",name:e.name,text:e.output}),{role:"assistant",toolCallId:e.toolCallId,runId:e.runId,content:t,timestamp:e.startedAt}}handleAgentEvent(e){if(!e||e.stream!=="tool")return;const t=typeof e.sessionKey=="string"?e.sessionKey:void 0;if(t&&t!==this.sessionKey||!t&&this.chatRunId&&e.runId!==this.chatRunId||this.chatRunId&&e.runId!==this.chatRunId||!this.chatRunId)return;const n=e.data??{},s=typeof n.toolCallId=="string"?n.toolCallId:"";if(!s)return;const i=typeof n.name=="string"?n.name:"tool",a=typeof n.phase=="string"?n.phase:"",o=a==="start"?n.args:void 0,l=a==="update"?gi(n.partialResult):a==="result"?gi(n.result):void 0,r=Date.now();let d=this.toolStreamById.get(s);d?(d.name=i,o!==void 0&&(d.args=o),l!==void 0&&(d.output=l),d.updatedAt=r):(d={toolCallId:s,runId:e.runId,sessionKey:t,name:i,args:o,output:l,startedAt:typeof e.ts=="number"?e.ts:r,updatedAt:r,message:{}},this.toolStreamById.set(s,d),this.toolStreamOrder.push(s)),d.message=this.buildToolStreamMessage(d),this.trimToolStream(),this.scheduleToolStreamSync(a==="result")}onEvent(e){if(this.eventLogBuffer=[{ts:Date.now(),event:e.event,payload:e.payload},...this.eventLogBuffer].slice(0,250),this.tab==="debug"&&(this.eventLog=this.eventLogBuffer),e.event==="agent"){this.handleAgentEvent(e.payload);return}if(e.event==="chat"){const t=e.payload;t?.sessionKey&&this.setLastActiveSessionKey(t.sessionKey);const n=Xr(this,t);(n==="final"||n==="error"||n==="aborted")&&(this.resetToolStream(),this.flushChatQueue()),n==="final"&&Be(this);return}if(e.event==="presence"){const t=e.payload;t?.presence&&Array.isArray(t.presence)&&(this.presenceEntries=t.presence,this.presenceError=null,this.presenceStatus=null);return}e.event==="cron"&&this.tab==="cron"&&this.loadCron()}applySnapshot(e){const t=e.snapshot;t?.presence&&Array.isArray(t.presence)&&(this.presenceEntries=t.presence),t?.health&&(this.debugHealth=t.health)}applySettings(e){const t={...e,lastActiveSessionKey:e.lastActiveSessionKey?.trim()||e.sessionKey.trim()||"main"};this.settings=t,qa(t),e.theme!==this.theme&&(this.theme=e.theme,this.applyResolvedTheme(yn(e.theme))),this.applySessionKey=this.settings.lastActiveSessionKey}setLastActiveSessionKey(e){const t=e.trim();t&&this.settings.lastActiveSessionKey!==t&&this.applySettings({...this.settings,lastActiveSessionKey:t})}applySettingsFromUrl(){if(!window.location.search)return;const e=new URLSearchParams(window.location.search),t=e.get("token"),n=e.get("password"),s=e.get("session");let i=!1;if(t!=null){const o=t.trim();o&&!this.settings.token&&this.applySettings({...this.settings,token:o}),e.delete("token"),i=!0}if(n!=null){const o=n.trim();o&&(this.password=o),e.delete("password"),i=!0}if(s!=null){const o=s.trim();o&&(this.sessionKey=o),e.delete("session"),i=!0}if(!i)return;const a=new URL(window.location.href);a.search=e.toString(),window.history.replaceState({},"",a.toString())}setTab(e){this.tab!==e&&(this.tab=e),e==="chat"&&(this.chatHasAutoScrolled=!1),e==="logs"?this.startLogsPolling():this.stopLogsPolling(),this.refreshActiveTab(),this.syncUrlWithTab(e,!1)}setTheme(e,t){Lc({nextTheme:e,applyTheme:()=>{this.theme=e,this.applySettings({...this.settings,theme:e}),this.applyResolvedTheme(yn(e))},context:t,currentTheme:this.theme})}async refreshActiveTab(){this.tab==="overview"&&await this.loadOverview(),this.tab==="connections"&&await this.loadConnections(),this.tab==="instances"&&await Ln(this),this.tab==="sessions"&&await ot(this),this.tab==="cron"&&await this.loadCron(),this.tab==="skills"&&await ft(this),this.tab==="nodes"&&await Mt(this),this.tab==="chat"&&(await Promise.all([Be(this),ot(this)]),this.scheduleChatScroll(!this.chatHasAutoScrolled)),this.tab==="config"&&(await ec(this),await re(this)),this.tab==="debug"&&(await Rn(this),this.eventLog=this.eventLogBuffer),this.tab==="logs"&&(this.logsAtBottom=!0,await In(this,{reset:!0}),this.scheduleLogsScroll(!0))}inferBasePath(){if(typeof window>"u")return"";const e=window.__CLAWDBOT_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?Kn(e):Ga(window.location.pathname)}syncThemeWithSettings(){this.theme=this.settings.theme??"system",this.applyResolvedTheme(yn(this.theme))}applyResolvedTheme(e){if(this.themeResolved=e,typeof document>"u")return;const t=document.documentElement;t.dataset.theme=e,t.style.colorScheme=e}attachThemeListener(){if(typeof window>"u"||typeof window.matchMedia!="function")return;if(this.themeMedia=window.matchMedia("(prefers-color-scheme: dark)"),this.themeMediaHandler=t=>{this.theme==="system"&&this.applyResolvedTheme(t.matches?"dark":"light")},typeof this.themeMedia.addEventListener=="function"){this.themeMedia.addEventListener("change",this.themeMediaHandler);return}this.themeMedia.addListener(this.themeMediaHandler)}detachThemeListener(){if(!this.themeMedia||!this.themeMediaHandler)return;if(typeof this.themeMedia.removeEventListener=="function"){this.themeMedia.removeEventListener("change",this.themeMediaHandler);return}this.themeMedia.removeListener(this.themeMediaHandler),this.themeMedia=null,this.themeMediaHandler=null}syncTabWithLocation(e){if(typeof window>"u")return;const t=Os(window.location.pathname,this.basePath)??"chat";this.setTabFromRoute(t),this.syncUrlWithTab(t,e)}onPopState(){if(typeof window>"u")return;const e=Os(window.location.pathname,this.basePath);e&&this.setTabFromRoute(e)}setTabFromRoute(e){this.tab!==e&&(this.tab=e),e==="chat"&&(this.chatHasAutoScrolled=!1),e==="logs"?this.startLogsPolling():this.stopLogsPolling(),this.connected&&this.refreshActiveTab()}syncUrlWithTab(e,t){if(typeof window>"u")return;const n=ct(Hn(e,this.basePath));if(ct(window.location.pathname)===n)return;const i=new URL(window.location.href);i.pathname=n,t?window.history.replaceState({},"",i.toString()):window.history.pushState({},"",i.toString())}async loadOverview(){await Promise.all([te(this,!1),Ln(this),ot(this),ht(this),Rn(this)])}async loadConnections(){await Promise.all([te(this,!0),re(this)])}async loadCron(){await Promise.all([ht(this),Jt(this)])}isChatBusy(){return this.chatSending||!!this.chatRunId}isChatStopCommand(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/stop"?!0:n==="stop"||n==="esc"||n==="abort"||n==="wait"||n==="exit"}async handleAbortChat(){this.connected&&(this.chatMessage="",await Qr(this))}enqueueChatMessage(e){const t=e.trim();t&&(this.chatQueue=[...this.chatQueue,{id:Bn(),text:t,createdAt:Date.now()}])}async sendChatMessageNow(e,t){this.resetToolStream();const n=await Jr(this,e);return!n&&t?.previousDraft!=null&&(this.chatMessage=t.previousDraft),n&&this.setLastActiveSessionKey(this.sessionKey),n&&t?.restoreDraft&&t.previousDraft?.trim()&&(this.chatMessage=t.previousDraft),this.scheduleChatScroll(),n&&!this.chatRunId&&this.flushChatQueue(),n}async flushChatQueue(){if(!this.connected||this.isChatBusy())return;const[e,...t]=this.chatQueue;if(!e)return;this.chatQueue=t,await this.sendChatMessageNow(e.text)||(this.chatQueue=[e,...this.chatQueue])}removeQueuedMessage(e){this.chatQueue=this.chatQueue.filter(t=>t.id!==e)}async handleSendChat(e,t){if(!this.connected)return;const n=this.chatMessage,s=(e??this.chatMessage).trim();if(s){if(this.isChatStopCommand(s)){await this.handleAbortChat();return}if(e==null&&(this.chatMessage=""),this.isChatBusy()){this.enqueueChatMessage(s);return}await this.sendChatMessageNow(s,{previousDraft:e==null?n:void 0,restoreDraft:!!(e&&t?.restoreDraft)})}}async handleWhatsAppStart(e){await Rr(this,e),await te(this,!0)}async handleWhatsAppWait(){await Ir(this),await te(this,!0)}async handleWhatsAppLogout(){await Pr(this),await te(this,!0)}async handleTelegramSave(){await Br(this),await re(this),await te(this,!0)}async handleDiscordSave(){await Kr(this),await re(this),await te(this,!0)}async handleSlackSave(){await Hr(this),await re(this),await te(this,!0)}async handleSignalSave(){await jr(this),await re(this),await te(this,!0)}async handleIMessageSave(){await zr(this),await re(this),await te(this,!0)}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 kc(this)}};m([b()],f.prototype,"settings",2);m([b()],f.prototype,"password",2);m([b()],f.prototype,"tab",2);m([b()],f.prototype,"connected",2);m([b()],f.prototype,"theme",2);m([b()],f.prototype,"themeResolved",2);m([b()],f.prototype,"hello",2);m([b()],f.prototype,"lastError",2);m([b()],f.prototype,"eventLog",2);m([b()],f.prototype,"sessionKey",2);m([b()],f.prototype,"chatLoading",2);m([b()],f.prototype,"chatSending",2);m([b()],f.prototype,"chatMessage",2);m([b()],f.prototype,"chatMessages",2);m([b()],f.prototype,"chatToolMessages",2);m([b()],f.prototype,"chatStream",2);m([b()],f.prototype,"chatStreamStartedAt",2);m([b()],f.prototype,"chatRunId",2);m([b()],f.prototype,"chatThinkingLevel",2);m([b()],f.prototype,"chatQueue",2);m([b()],f.prototype,"toolOutputExpanded",2);m([b()],f.prototype,"sidebarOpen",2);m([b()],f.prototype,"sidebarContent",2);m([b()],f.prototype,"sidebarError",2);m([b()],f.prototype,"splitRatio",2);m([b()],f.prototype,"nodesLoading",2);m([b()],f.prototype,"nodes",2);m([b()],f.prototype,"configLoading",2);m([b()],f.prototype,"configRaw",2);m([b()],f.prototype,"configValid",2);m([b()],f.prototype,"configIssues",2);m([b()],f.prototype,"configSaving",2);m([b()],f.prototype,"configApplying",2);m([b()],f.prototype,"updateRunning",2);m([b()],f.prototype,"applySessionKey",2);m([b()],f.prototype,"configSnapshot",2);m([b()],f.prototype,"configSchema",2);m([b()],f.prototype,"configSchemaVersion",2);m([b()],f.prototype,"configSchemaLoading",2);m([b()],f.prototype,"configUiHints",2);m([b()],f.prototype,"configForm",2);m([b()],f.prototype,"configFormDirty",2);m([b()],f.prototype,"configFormMode",2);m([b()],f.prototype,"providersLoading",2);m([b()],f.prototype,"providersSnapshot",2);m([b()],f.prototype,"providersError",2);m([b()],f.prototype,"providersLastSuccess",2);m([b()],f.prototype,"whatsappLoginMessage",2);m([b()],f.prototype,"whatsappLoginQrDataUrl",2);m([b()],f.prototype,"whatsappLoginConnected",2);m([b()],f.prototype,"whatsappBusy",2);m([b()],f.prototype,"telegramForm",2);m([b()],f.prototype,"telegramSaving",2);m([b()],f.prototype,"telegramTokenLocked",2);m([b()],f.prototype,"telegramConfigStatus",2);m([b()],f.prototype,"discordForm",2);m([b()],f.prototype,"discordSaving",2);m([b()],f.prototype,"discordTokenLocked",2);m([b()],f.prototype,"discordConfigStatus",2);m([b()],f.prototype,"slackForm",2);m([b()],f.prototype,"slackSaving",2);m([b()],f.prototype,"slackTokenLocked",2);m([b()],f.prototype,"slackAppTokenLocked",2);m([b()],f.prototype,"slackConfigStatus",2);m([b()],f.prototype,"signalForm",2);m([b()],f.prototype,"signalSaving",2);m([b()],f.prototype,"signalConfigStatus",2);m([b()],f.prototype,"imessageForm",2);m([b()],f.prototype,"imessageSaving",2);m([b()],f.prototype,"imessageConfigStatus",2);m([b()],f.prototype,"presenceLoading",2);m([b()],f.prototype,"presenceEntries",2);m([b()],f.prototype,"presenceError",2);m([b()],f.prototype,"presenceStatus",2);m([b()],f.prototype,"sessionsLoading",2);m([b()],f.prototype,"sessionsResult",2);m([b()],f.prototype,"sessionsError",2);m([b()],f.prototype,"sessionsFilterActive",2);m([b()],f.prototype,"sessionsFilterLimit",2);m([b()],f.prototype,"sessionsIncludeGlobal",2);m([b()],f.prototype,"sessionsIncludeUnknown",2);m([b()],f.prototype,"cronLoading",2);m([b()],f.prototype,"cronJobs",2);m([b()],f.prototype,"cronStatus",2);m([b()],f.prototype,"cronError",2);m([b()],f.prototype,"cronForm",2);m([b()],f.prototype,"cronRunsJobId",2);m([b()],f.prototype,"cronRuns",2);m([b()],f.prototype,"cronBusy",2);m([b()],f.prototype,"skillsLoading",2);m([b()],f.prototype,"skillsReport",2);m([b()],f.prototype,"skillsError",2);m([b()],f.prototype,"skillsFilter",2);m([b()],f.prototype,"skillEdits",2);m([b()],f.prototype,"skillsBusyKey",2);m([b()],f.prototype,"skillMessages",2);m([b()],f.prototype,"debugLoading",2);m([b()],f.prototype,"debugStatus",2);m([b()],f.prototype,"debugHealth",2);m([b()],f.prototype,"debugModels",2);m([b()],f.prototype,"debugHeartbeat",2);m([b()],f.prototype,"debugCallMethod",2);m([b()],f.prototype,"debugCallParams",2);m([b()],f.prototype,"debugCallResult",2);m([b()],f.prototype,"debugCallError",2);m([b()],f.prototype,"logsLoading",2);m([b()],f.prototype,"logsError",2);m([b()],f.prototype,"logsFile",2);m([b()],f.prototype,"logsEntries",2);m([b()],f.prototype,"logsFilterText",2);m([b()],f.prototype,"logsLevelFilters",2);m([b()],f.prototype,"logsAutoFollow",2);m([b()],f.prototype,"logsTruncated",2);m([b()],f.prototype,"logsCursor",2);m([b()],f.prototype,"logsLastFetchAt",2);m([b()],f.prototype,"logsLimit",2);m([b()],f.prototype,"logsMaxBytes",2);m([b()],f.prototype,"logsAtBottom",2);f=m([wi("clawdbot-app")],f);
//# sourceMappingURL=index-R0hOuO5Q.js.map